@osamash/floor-planner 1.0.7 → 1.0.9

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,33 +1,25 @@
1
- (function(In,se){typeof exports=="object"&&typeof module<"u"?se(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],se):(In=typeof globalThis<"u"?globalThis:In||self,se(In.FloorPlanner={},In.React))})(this,function(In,se){"use strict";var nR=Object.defineProperty;var rR=(In,se,mi)=>se in In?nR(In,se,{enumerable:!0,configurable:!0,writable:!0,value:mi}):In[se]=mi;var vt=(In,se,mi)=>rR(In,typeof se!="symbol"?se+"":se,mi);function mi(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Cm(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var Kl={exports:{}},Fa={};/**
1
+ (function(En,se){typeof exports=="object"&&typeof module<"u"?se(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],se):(En=typeof globalThis<"u"?globalThis:En||self,se(En.FloorPlanner={},En.React))})(this,(function(En,se){"use strict";var nR=Object.defineProperty;var rR=(En,se,ai)=>se in En?nR(En,se,{enumerable:!0,configurable:!0,writable:!0,value:ai}):En[se]=ai;var ut=(En,se,ai)=>rR(En,typeof se!="symbol"?se+"":se,ai);function ai(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Cm(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var Wl={exports:{}},Pa={};/**
2
2
  * @license React
3
- * react-jsx-runtime.production.min.js
3
+ * react-jsx-runtime.production.js
4
4
  *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Rm;function N2(){if(Rm)return Fa;Rm=1;var n=se,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,c){var h,f={},p=null,d=null;c!==void 0&&(p=""+c),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(d=l.ref);for(h in l)r.call(l,h)&&!s.hasOwnProperty(h)&&(f[h]=l[h]);if(a&&a.defaultProps)for(h in l=a.defaultProps,l)f[h]===void 0&&(f[h]=l[h]);return{$$typeof:e,type:a,key:p,ref:d,props:f,_owner:i.current}}return Fa.Fragment=t,Fa.jsx=o,Fa.jsxs=o,Fa}var za={};/**
9
+ */var Rm;function N2(){if(Rm)return Pa;Rm=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(r,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var a in i)a!=="key"&&(s[a]=i[a])}else s=i;return i=s.ref,{$$typeof:n,type:r,key:o,ref:i!==void 0?i:null,props:s}}return Pa.Fragment=e,Pa.jsx=t,Pa.jsxs=t,Pa}var Ia={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Pm;function U2(){return Pm||(Pm=1,process.env.NODE_ENV!=="production"&&function(){var n=se,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.offscreen"),m=Symbol.iterator,x="@@iterator";function v(k){if(k===null||typeof k!="object")return null;var ye=m&&k[m]||k[x];return typeof ye=="function"?ye:null}var _=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(k){{for(var ye=arguments.length,je=new Array(ye>1?ye-1:0),dt=1;dt<ye;dt++)je[dt-1]=arguments[dt];M("error",k,je)}}function M(k,ye,je){{var dt=_.ReactDebugCurrentFrame,Pt=dt.getStackAddendum();Pt!==""&&(ye+="%s",je=je.concat([Pt]));var qt=je.map(function(pt){return String(pt)});qt.unshift("Warning: "+ye),Function.prototype.apply.call(console[k],console,qt)}}var b=!1,S=!1,T=!1,q=!1,O=!1,A;A=Symbol.for("react.module.reference");function L(k){return!!(typeof k=="string"||typeof k=="function"||k===r||k===s||O||k===i||k===c||k===h||q||k===d||b||S||T||typeof k=="object"&&k!==null&&(k.$$typeof===p||k.$$typeof===f||k.$$typeof===o||k.$$typeof===a||k.$$typeof===l||k.$$typeof===A||k.getModuleId!==void 0))}function N(k,ye,je){var dt=k.displayName;if(dt)return dt;var Pt=ye.displayName||ye.name||"";return Pt!==""?je+"("+Pt+")":je}function Z(k){return k.displayName||"Context"}function Y(k){if(k==null)return null;if(typeof k.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof k=="function")return k.displayName||k.name||null;if(typeof k=="string")return k;switch(k){case r:return"Fragment";case t:return"Portal";case s:return"Profiler";case i:return"StrictMode";case c:return"Suspense";case h:return"SuspenseList"}if(typeof k=="object")switch(k.$$typeof){case a:var ye=k;return Z(ye)+".Consumer";case o:var je=k;return Z(je._context)+".Provider";case l:return N(k,k.render,"ForwardRef");case f:var dt=k.displayName||null;return dt!==null?dt:Y(k.type)||"Memo";case p:{var Pt=k,qt=Pt._payload,pt=Pt._init;try{return Y(pt(qt))}catch{return null}}}return null}var ee=Object.assign,ue=0,te,ae,B,Se,$,oe,Ae;function Ie(){}Ie.__reactDisabledLog=!0;function Ce(){{if(ue===0){te=console.log,ae=console.info,B=console.warn,Se=console.error,$=console.group,oe=console.groupCollapsed,Ae=console.groupEnd;var k={configurable:!0,enumerable:!0,value:Ie,writable:!0};Object.defineProperties(console,{info:k,log:k,warn:k,error:k,group:k,groupCollapsed:k,groupEnd:k})}ue++}}function V(){{if(ue--,ue===0){var k={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ee({},k,{value:te}),info:ee({},k,{value:ae}),warn:ee({},k,{value:B}),error:ee({},k,{value:Se}),group:ee({},k,{value:$}),groupCollapsed:ee({},k,{value:oe}),groupEnd:ee({},k,{value:Ae})})}ue<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ne=_.ReactCurrentDispatcher,X;function pe(k,ye,je){{if(X===void 0)try{throw Error()}catch(Pt){var dt=Pt.stack.trim().match(/\n( *(at )?)/);X=dt&&dt[1]||""}return`
18
- `+X+k}}var Ee=!1,Q;{var Ne=typeof WeakMap=="function"?WeakMap:Map;Q=new Ne}function le(k,ye){if(!k||Ee)return"";{var je=Q.get(k);if(je!==void 0)return je}var dt;Ee=!0;var Pt=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var qt;qt=ne.current,ne.current=null,Ce();try{if(ye){var pt=function(){throw Error()};if(Object.defineProperty(pt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pt,[])}catch(W){dt=W}Reflect.construct(k,[],pt)}else{try{pt.call()}catch(W){dt=W}k.call(pt.prototype)}}else{try{throw Error()}catch(W){dt=W}k()}}catch(W){if(W&&dt&&typeof W.stack=="string"){for(var Xe=W.stack.split(`
19
- `),vn=dt.stack.split(`
20
- `),tn=Xe.length-1,P=vn.length-1;tn>=1&&P>=0&&Xe[tn]!==vn[P];)P--;for(;tn>=1&&P>=0;tn--,P--)if(Xe[tn]!==vn[P]){if(tn!==1||P!==1)do if(tn--,P--,P<0||Xe[tn]!==vn[P]){var G=`
21
- `+Xe[tn].replace(" at new "," at ");return k.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",k.displayName)),typeof k=="function"&&Q.set(k,G),G}while(tn>=1&&P>=0);break}}}finally{Ee=!1,ne.current=qt,V(),Error.prepareStackTrace=Pt}var re=k?k.displayName||k.name:"",ie=re?pe(re):"";return typeof k=="function"&&Q.set(k,ie),ie}function F(k,ye,je){return le(k,!1)}function lt(k){var ye=k.prototype;return!!(ye&&ye.isReactComponent)}function Le(k,ye,je){if(k==null)return"";if(typeof k=="function")return le(k,lt(k));if(typeof k=="string")return pe(k);switch(k){case c:return pe("Suspense");case h:return pe("SuspenseList")}if(typeof k=="object")switch(k.$$typeof){case l:return F(k.render);case f:return Le(k.type,ye,je);case p:{var dt=k,Pt=dt._payload,qt=dt._init;try{return Le(qt(Pt),ye,je)}catch{}}}return""}var Ge=Object.prototype.hasOwnProperty,De={},Ue=_.ReactDebugCurrentFrame;function ge(k){if(k){var ye=k._owner,je=Le(k.type,k._source,ye?ye.type:null);Ue.setExtraStackFrame(je)}else Ue.setExtraStackFrame(null)}function $e(k,ye,je,dt,Pt){{var qt=Function.call.bind(Ge);for(var pt in k)if(qt(k,pt)){var Xe=void 0;try{if(typeof k[pt]!="function"){var vn=Error((dt||"React class")+": "+je+" type `"+pt+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof k[pt]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw vn.name="Invariant Violation",vn}Xe=k[pt](ye,pt,dt,je,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(tn){Xe=tn}Xe&&!(Xe instanceof Error)&&(ge(Pt),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",dt||"React class",je,pt,typeof Xe),ge(null)),Xe instanceof Error&&!(Xe.message in De)&&(De[Xe.message]=!0,ge(Pt),E("Failed %s type: %s",je,Xe.message),ge(null))}}}var ot=Array.isArray;function wt(k){return ot(k)}function U(k){{var ye=typeof Symbol=="function"&&Symbol.toStringTag,je=ye&&k[Symbol.toStringTag]||k.constructor.name||"Object";return je}}function I(k){try{return J(k),!1}catch{return!0}}function J(k){return""+k}function de(k){if(I(k))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",U(k)),J(k)}var be=_.ReactCurrentOwner,fe={key:!0,ref:!0,__self:!0,__source:!0},Fe,Te;function Ye(k){if(Ge.call(k,"ref")){var ye=Object.getOwnPropertyDescriptor(k,"ref").get;if(ye&&ye.isReactWarning)return!1}return k.ref!==void 0}function Ke(k){if(Ge.call(k,"key")){var ye=Object.getOwnPropertyDescriptor(k,"key").get;if(ye&&ye.isReactWarning)return!1}return k.key!==void 0}function Re(k,ye){typeof k.ref=="string"&&be.current}function ze(k,ye){{var je=function(){Fe||(Fe=!0,E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ye))};je.isReactWarning=!0,Object.defineProperty(k,"key",{get:je,configurable:!0})}}function We(k,ye){{var je=function(){Te||(Te=!0,E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ye))};je.isReactWarning=!0,Object.defineProperty(k,"ref",{get:je,configurable:!0})}}var tt=function(k,ye,je,dt,Pt,qt,pt){var Xe={$$typeof:e,type:k,key:ye,ref:je,props:pt,_owner:qt};return Xe._store={},Object.defineProperty(Xe._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Xe,"_self",{configurable:!1,enumerable:!1,writable:!1,value:dt}),Object.defineProperty(Xe,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Pt}),Object.freeze&&(Object.freeze(Xe.props),Object.freeze(Xe)),Xe};function Pe(k,ye,je,dt,Pt){{var qt,pt={},Xe=null,vn=null;je!==void 0&&(de(je),Xe=""+je),Ke(ye)&&(de(ye.key),Xe=""+ye.key),Ye(ye)&&(vn=ye.ref,Re(ye,Pt));for(qt in ye)Ge.call(ye,qt)&&!fe.hasOwnProperty(qt)&&(pt[qt]=ye[qt]);if(k&&k.defaultProps){var tn=k.defaultProps;for(qt in tn)pt[qt]===void 0&&(pt[qt]=tn[qt])}if(Xe||vn){var P=typeof k=="function"?k.displayName||k.name||"Unknown":k;Xe&&ze(pt,P),vn&&We(pt,P)}return tt(k,Xe,vn,Pt,dt,be.current,pt)}}var gt=_.ReactCurrentOwner,H=_.ReactDebugCurrentFrame;function _e(k){if(k){var ye=k._owner,je=Le(k.type,k._source,ye?ye.type:null);H.setExtraStackFrame(je)}else H.setExtraStackFrame(null)}var Oe;Oe=!1;function Ve(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function we(){{if(gt.current){var k=Y(gt.current.type);if(k)return`
22
-
23
- Check the render method of \``+k+"`."}return""}}function me(k){return""}var Qe={};function ft(k){{var ye=we();if(!ye){var je=typeof k=="string"?k:k.displayName||k.name;je&&(ye=`
24
-
25
- Check the top-level render call using <`+je+">.")}return ye}}function Ot(k,ye){{if(!k._store||k._store.validated||k.key!=null)return;k._store.validated=!0;var je=ft(ye);if(Qe[je])return;Qe[je]=!0;var dt="";k&&k._owner&&k._owner!==gt.current&&(dt=" It was passed a child from "+Y(k._owner.type)+"."),_e(k),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',je,dt),_e(null)}}function _t(k,ye){{if(typeof k!="object")return;if(wt(k))for(var je=0;je<k.length;je++){var dt=k[je];Ve(dt)&&Ot(dt,ye)}else if(Ve(k))k._store&&(k._store.validated=!0);else if(k){var Pt=v(k);if(typeof Pt=="function"&&Pt!==k.entries)for(var qt=Pt.call(k),pt;!(pt=qt.next()).done;)Ve(pt.value)&&Ot(pt.value,ye)}}}function Ar(k){{var ye=k.type;if(ye==null||typeof ye=="string")return;var je;if(typeof ye=="function")je=ye.propTypes;else if(typeof ye=="object"&&(ye.$$typeof===l||ye.$$typeof===f))je=ye.propTypes;else return;if(je){var dt=Y(ye);$e(je,k.props,"prop",dt,k)}else if(ye.PropTypes!==void 0&&!Oe){Oe=!0;var Pt=Y(ye);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Pt||"Unknown")}typeof ye.getDefaultProps=="function"&&!ye.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function jn(k){{for(var ye=Object.keys(k.props),je=0;je<ye.length;je++){var dt=ye[je];if(dt!=="children"&&dt!=="key"){_e(k),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",dt),_e(null);break}}k.ref!==null&&(_e(k),E("Invalid attribute `ref` supplied to `React.Fragment`."),_e(null))}}var vo={};function Cr(k,ye,je,dt,Pt,qt){{var pt=L(k);if(!pt){var Xe="";(k===void 0||typeof k=="object"&&k!==null&&Object.keys(k).length===0)&&(Xe+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var vn=me();vn?Xe+=vn:Xe+=we();var tn;k===null?tn="null":wt(k)?tn="array":k!==void 0&&k.$$typeof===e?(tn="<"+(Y(k.type)||"Unknown")+" />",Xe=" Did you accidentally export a JSX literal instead of a component?"):tn=typeof k,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",tn,Xe)}var P=Pe(k,ye,je,Pt,qt);if(P==null)return P;if(pt){var G=ye.children;if(G!==void 0)if(dt)if(wt(G)){for(var re=0;re<G.length;re++)_t(G[re],k);Object.freeze&&Object.freeze(G)}else E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else _t(G,k)}if(Ge.call(ye,"key")){var ie=Y(k),W=Object.keys(ye).filter(function(nt){return nt!=="key"}),Me=W.length>0?"{key: someKey, "+W.join(": ..., ")+": ...}":"{key: someKey}";if(!vo[ie+Me]){var ke=W.length>0?"{"+W.join(": ..., ")+": ...}":"{}";E(`A props object containing a "key" prop is being spread into JSX:
17
+ */var Pm;function U2(){return Pm||(Pm=1,process.env.NODE_ENV!=="production"&&(function(){function n(U){if(U==null)return null;if(typeof U=="function")return U.$$typeof===L?null:U.displayName||U.name||null;if(typeof U=="string")return U;switch(U){case x:return"Fragment";case _:return"Profiler";case v:return"StrictMode";case S:return"Suspense";case T:return"SuspenseList";case A:return"Activity"}if(typeof U=="object")switch(typeof U.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),U.$$typeof){case m:return"Portal";case M:return(U.displayName||"Context")+".Provider";case b:return(U._context.displayName||"Context")+".Consumer";case E:var $=U.render;return U=U.displayName,U||(U=$.displayName||$.name||"",U=U!==""?"ForwardRef("+U+")":"ForwardRef"),U;case q:return $=U.displayName||null,$!==null?$:n(U.type)||"Memo";case O:$=U._payload,U=U._init;try{return n(U($))}catch{}}return null}function e(U){return""+U}function t(U){try{e(U);var $=!1}catch{$=!0}if($){$=console;var pe=$.error,Se=typeof Symbol=="function"&&Symbol.toStringTag&&U[Symbol.toStringTag]||U.constructor.name||"Object";return pe.call($,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Se),e(U)}}function r(U){if(U===x)return"<>";if(typeof U=="object"&&U!==null&&U.$$typeof===O)return"<...>";try{var $=n(U);return $?"<"+$+">":"<...>"}catch{return"<...>"}}function i(){var U=N.A;return U===null?null:U.getOwner()}function s(){return Error("react-stack-top-frame")}function o(U){if(Z.call(U,"key")){var $=Object.getOwnPropertyDescriptor(U,"key").get;if($&&$.isReactWarning)return!1}return U.key!==void 0}function a(U,$){function pe(){ce||(ce=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",$))}pe.isReactWarning=!0,Object.defineProperty(U,"key",{get:pe,configurable:!0})}function l(){var U=n(this.type);return J[U]||(J[U]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),U=this.props.ref,U!==void 0?U:null}function c(U,$,pe,Se,be,V,te,W){return pe=V.ref,U={$$typeof:d,type:U,key:$,props:V,_owner:be},(pe!==void 0?pe:null)!==null?Object.defineProperty(U,"ref",{enumerable:!1,get:l}):Object.defineProperty(U,"ref",{enumerable:!1,value:null}),U._store={},Object.defineProperty(U._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(U,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(U,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.defineProperty(U,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:W}),Object.freeze&&(Object.freeze(U.props),Object.freeze(U)),U}function h(U,$,pe,Se,be,V,te,W){var ue=$.children;if(ue!==void 0)if(Se)if(K(ue)){for(Se=0;Se<ue.length;Se++)f(ue[Se]);Object.freeze&&Object.freeze(ue)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(ue);if(Z.call($,"key")){ue=n(U);var ye=Object.keys($).filter(function(Le){return Le!=="key"});Se=0<ye.length?"{key: someKey, "+ye.join(": ..., ")+": ...}":"{key: someKey}",xe[ue+Se]||(ye=0<ye.length?"{"+ye.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
26
18
  let props = %s;
27
19
  <%s {...props} />
28
20
  React keys must be passed directly to JSX without using spread:
29
21
  let props = %s;
30
- <%s key={someKey} {...props} />`,Me,ie,ke,ie),vo[ie+Me]=!0}}return k===r?jn(P):Ar(P),P}}function Os(k,ye,je){return Cr(k,ye,je,!0)}function Ia(k,ye,je){return Cr(k,ye,je,!1)}var qs=Ia,Di=Os;za.Fragment=r,za.jsx=qs,za.jsxs=Di}()),za}var Im;function F2(){return Im||(Im=1,process.env.NODE_ENV==="production"?Kl.exports=N2():Kl.exports=U2()),Kl.exports}var C=F2();const Lm=n=>{let e;const t=new Set,r=(c,h)=>{const f=typeof c=="function"?c(e):c;if(!Object.is(f,e)){const p=e;e=h??(typeof f!="object"||f===null)?f:Object.assign({},e,f),t.forEach(d=>d(e,p))}},i=()=>e,a={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(t.add(c),()=>t.delete(c))},l=e=n(r,i,a);return a},z2=n=>n?Lm(n):Lm,k2=n=>n;function B2(n,e=k2){const t=se.useSyncExternalStore(n.subscribe,se.useCallback(()=>e(n.getState()),[n,e]),se.useCallback(()=>e(n.getInitialState()),[n,e]));return se.useDebugValue(t),t}const Om=n=>{const e=z2(n),t=r=>B2(e,r);return Object.assign(t,e),t},V2=n=>n?Om(n):Om;/**
22
+ <%s key={someKey} {...props} />`,Se,ue,ye,ue),xe[ue+Se]=!0)}if(ue=null,pe!==void 0&&(t(pe),ue=""+pe),o($)&&(t($.key),ue=""+$.key),"key"in $){pe={};for(var Q in $)Q!=="key"&&(pe[Q]=$[Q])}else pe=$;return ue&&a(pe,typeof U=="function"?U.displayName||U.name||"Unknown":U),c(U,ue,V,be,i(),pe,te,W)}function f(U){typeof U=="object"&&U!==null&&U.$$typeof===d&&U._store&&(U._store.validated=1)}var p=se,d=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),b=Symbol.for("react.consumer"),M=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),A=Symbol.for("react.activity"),L=Symbol.for("react.client.reference"),N=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,K=Array.isArray,ne=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(U){return U()}};var ce,J={},oe=p.react_stack_bottom_frame.bind(p,s)(),B=ne(r(s)),xe={};Ia.Fragment=x,Ia.jsx=function(U,$,pe,Se,be){var V=1e4>N.recentlyCreatedOwnerStacks++;return h(U,$,pe,!1,Se,be,V?Error("react-stack-top-frame"):oe,V?ne(r(U)):B)},Ia.jsxs=function(U,$,pe,Se,be){var V=1e4>N.recentlyCreatedOwnerStacks++;return h(U,$,pe,!0,Se,be,V?Error("react-stack-top-frame"):oe,V?ne(r(U)):B)}})()),Ia}var Im;function F2(){return Im||(Im=1,process.env.NODE_ENV==="production"?Wl.exports=N2():Wl.exports=U2()),Wl.exports}var C=F2();const Lm=n=>{let e;const t=new Set,r=(c,h)=>{const f=typeof c=="function"?c(e):c;if(!Object.is(f,e)){const p=e;e=h??(typeof f!="object"||f===null)?f:Object.assign({},e,f),t.forEach(d=>d(e,p))}},i=()=>e,a={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(t.add(c),()=>t.delete(c))},l=e=n(r,i,a);return a},z2=(n=>n?Lm(n):Lm),k2=n=>n;function B2(n,e=k2){const t=se.useSyncExternalStore(n.subscribe,se.useCallback(()=>e(n.getState()),[n,e]),se.useCallback(()=>e(n.getInitialState()),[n,e]));return se.useDebugValue(t),t}const Om=n=>{const e=z2(n),t=r=>B2(e,r);return Object.assign(t,e),t},V2=(n=>n?Om(n):Om);/**
31
23
  * @license
32
24
  * MIT License
33
25
  *
@@ -50,40 +42,40 @@ React keys must be passed directly to JSX without using spread:
50
42
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51
43
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52
44
  * SOFTWARE.
53
- */var ka="delete",jt=5,dr=1<<jt,Kn=dr-1,It={};function lh(){return{value:!1}}function Ir(n){n&&(n.value=!0)}function ch(){}function xo(n){return n.size===void 0&&(n.size=n.__iterate(qm)),n.size}function cs(n,e){if(typeof e!="number"){var t=e>>>0;if(""+t!==e||t===4294967295)return NaN;e=t}return e<0?xo(n)+e:e}function qm(){return!0}function Ba(n,e,t){return(n===0&&!Nm(n)||t!==void 0&&n<=-t)&&(e===void 0||t!==void 0&&e>=t)}function yo(n,e){return Dm(n,e,0)}function Va(n,e){return Dm(n,e,e)}function Dm(n,e,t){return n===void 0?t:Nm(n)?e===1/0?e:Math.max(0,e+n)|0:e===void 0||e===n?n:Math.min(e,n)|0}function Nm(n){return n<0||n===0&&1/n===-1/0}var Um="@@__IMMUTABLE_ITERABLE__@@";function sr(n){return!!(n&&n[Um])}var Zl="@@__IMMUTABLE_KEYED__@@";function Xt(n){return!!(n&&n[Zl])}var Jl="@@__IMMUTABLE_INDEXED__@@";function Zn(n){return!!(n&&n[Jl])}function Ql(n){return Xt(n)||Zn(n)}var Ln=function(e){return sr(e)?e:wn(e)},Lr=function(n){function e(t){return Xt(t)?t:fs(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e}(Ln),Fs=function(n){function e(t){return Zn(t)?t:qr(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e}(Ln),So=function(n){function e(t){return sr(t)&&!Ql(t)?t:Mo(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e}(Ln);Ln.Keyed=Lr,Ln.Indexed=Fs,Ln.Set=So;var Fm="@@__IMMUTABLE_SEQ__@@";function ec(n){return!!(n&&n[Fm])}var zm="@@__IMMUTABLE_RECORD__@@";function us(n){return!!(n&&n[zm])}function Or(n){return sr(n)||us(n)}var hs="@@__IMMUTABLE_ORDERED__@@";function Wr(n){return!!(n&&n[hs])}var Eo=0,pr=1,mr=2,uh=typeof Symbol=="function"&&Symbol.iterator,km="@@iterator",tc=uh||km,Lt=function(e){this.next=e};Lt.prototype.toString=function(){return"[Iterator]"},Lt.KEYS=Eo,Lt.VALUES=pr,Lt.ENTRIES=mr,Lt.prototype.inspect=Lt.prototype.toSource=function(){return this.toString()},Lt.prototype[tc]=function(){return this};function rn(n,e,t,r){var i=n===Eo?e:n===pr?t:[e,t];return r?r.value=i:r={value:i,done:!1},r}function zn(){return{value:void 0,done:!0}}function hh(n){return Array.isArray(n)?!0:!!nc(n)}function Bm(n){return n&&typeof n.next=="function"}function fh(n){var e=nc(n);return e&&e.call(n)}function nc(n){var e=n&&(uh&&n[uh]||n[km]);if(typeof e=="function")return e}function H2(n){var e=nc(n);return e&&e===n.entries}function G2(n){var e=nc(n);return e&&e===n.keys}var bo=Object.prototype.hasOwnProperty;function dh(n){return Array.isArray(n)||typeof n=="string"?!0:n&&typeof n=="object"&&Number.isInteger(n.length)&&n.length>=0&&(n.length===0?Object.keys(n).length===1:n.hasOwnProperty(n.length-1))}var wn=function(n){function e(t){return t==null?mh():Or(t)?t.toSeq():j2(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.toSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq {","}")},e.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},e.prototype.__iterate=function(r,i){var s=this._cache;if(s){for(var o=s.length,a=0;a!==o;){var l=s[i?o-++a:a++];if(r(l[1],l[0],this)===!1)break}return a}return this.__iterateUncached(r,i)},e.prototype.__iterator=function(r,i){var s=this._cache;if(s){var o=s.length,a=0;return new Lt(function(){if(a===o)return zn();var l=s[i?o-++a:a++];return rn(r,l[0],l[1])})}return this.__iteratorUncached(r,i)},e}(Ln),fs=function(n){function e(t){return t==null?mh().toKeyedSeq():sr(t)?Xt(t)?t.toSeq():t.fromEntrySeq():us(t)?t.toSeq():gh(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.toKeyedSeq=function(){return this},e}(wn),qr=function(n){function e(t){return t==null?mh():sr(t)?Xt(t)?t.entrySeq():t.toIndexedSeq():us(t)?t.toSeq().entrySeq():Hm(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toIndexedSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq [","]")},e}(wn),Mo=function(n){function e(t){return(sr(t)&&!Ql(t)?t:qr(t)).toSetSeq()}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toSetSeq=function(){return this},e}(wn);wn.isSeq=ec,wn.Keyed=fs,wn.Set=Mo,wn.Indexed=qr,wn.prototype[Fm]=!0;var wo=function(n){function e(t){this._array=t,this.size=t.length}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.get=function(r,i){return this.has(r)?this._array[cs(this,r)]:i},e.prototype.__iterate=function(r,i){for(var s=this._array,o=s.length,a=0;a!==o;){var l=i?o-++a:a++;if(r(s[l],l,this)===!1)break}return a},e.prototype.__iterator=function(r,i){var s=this._array,o=s.length,a=0;return new Lt(function(){if(a===o)return zn();var l=i?o-++a:a++;return rn(r,l,s[l])})},e}(qr),ph=function(n){function e(t){var r=Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]);this._object=t,this._keys=r,this.size=r.length}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.get=function(r,i){return i!==void 0&&!this.has(r)?i:this._object[r]},e.prototype.has=function(r){return bo.call(this._object,r)},e.prototype.__iterate=function(r,i){for(var s=this._object,o=this._keys,a=o.length,l=0;l!==a;){var c=o[i?a-++l:l++];if(r(s[c],c,this)===!1)break}return l},e.prototype.__iterator=function(r,i){var s=this._object,o=this._keys,a=o.length,l=0;return new Lt(function(){if(l===a)return zn();var c=o[i?a-++l:l++];return rn(r,c,s[c])})},e}(fs);ph.prototype[hs]=!0;var W2=function(n){function e(t){this._collection=t,this.size=t.length||t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.__iterateUncached=function(r,i){if(i)return this.cacheResult().__iterate(r,i);var s=this._collection,o=fh(s),a=0;if(Bm(o))for(var l;!(l=o.next()).done&&r(l.value,a++,this)!==!1;);return a},e.prototype.__iteratorUncached=function(r,i){if(i)return this.cacheResult().__iterator(r,i);var s=this._collection,o=fh(s);if(!Bm(o))return new Lt(zn);var a=0;return new Lt(function(){var l=o.next();return l.done?l:rn(r,a++,l.value)})},e}(qr),Vm;function mh(){return Vm||(Vm=new wo([]))}function gh(n){var e=_h(n);if(e)return e.fromEntrySeq();if(typeof n=="object")return new ph(n);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+n)}function Hm(n){var e=_h(n);if(e)return e;throw new TypeError("Expected Array or collection object of values: "+n)}function j2(n){var e=_h(n);if(e)return H2(n)?e.fromEntrySeq():G2(n)?e.toSetSeq():e;if(typeof n=="object")return new ph(n);throw new TypeError("Expected Array or collection object of values, or keyed object: "+n)}function _h(n){return dh(n)?new wo(n):hh(n)?new W2(n):void 0}var Gm="@@__IMMUTABLE_MAP__@@";function rc(n){return!!(n&&n[Gm])}function vh(n){return rc(n)&&Wr(n)}function xh(n){return!!(n&&typeof n.equals=="function"&&typeof n.hashCode=="function")}function sn(n,e){if(n===e||n!==n&&e!==e)return!0;if(!n||!e)return!1;if(typeof n.valueOf=="function"&&typeof e.valueOf=="function"){if(n=n.valueOf(),e=e.valueOf(),n===e||n!==n&&e!==e)return!0;if(!n||!e)return!1}return!!(xh(n)&&xh(e)&&n.equals(e))}var Ha=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(e,t){e|=0,t|=0;var r=e&65535,i=t&65535;return r*i+((e>>>16)*i+r*(t>>>16)<<16>>>0)|0};function ic(n){return n>>>1&1073741824|n&3221225471}var X2=Object.prototype.valueOf;function or(n){if(n==null)return Wm(n);if(typeof n.hashCode=="function")return ic(n.hashCode(n));var e=Q2(n);if(e==null)return Wm(e);switch(typeof e){case"boolean":return e?1108378657:1108378656;case"number":return $2(e);case"string":return e.length>ey?Y2(e):yh(e);case"object":case"function":return Z2(e);case"symbol":return K2(e);default:if(typeof e.toString=="function")return yh(e.toString());throw new Error("Value type "+typeof e+" cannot be hashed.")}}function Wm(n){return n===null?1108378658:1108378659}function $2(n){if(n!==n||n===1/0)return 0;var e=n|0;for(e!==n&&(e^=n*4294967295);n>4294967295;)n/=4294967295,e^=n;return ic(e)}function Y2(n){var e=wh[n];return e===void 0&&(e=yh(n),Mh===ty&&(Mh=0,wh={}),Mh++,wh[n]=e),e}function yh(n){for(var e=0,t=0;t<n.length;t++)e=31*e+n.charCodeAt(t)|0;return ic(e)}function K2(n){var e=Ym[n];return e!==void 0||(e=$m(),Ym[n]=e),e}function Z2(n){var e;if(Sh&&(e=Eh.get(n),e!==void 0)||(e=n[zs],e!==void 0)||!Xm&&(e=n.propertyIsEnumerable&&n.propertyIsEnumerable[zs],e!==void 0||(e=J2(n),e!==void 0)))return e;if(e=$m(),Sh)Eh.set(n,e);else{if(jm!==void 0&&jm(n)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(Xm)Object.defineProperty(n,zs,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(n.propertyIsEnumerable!==void 0&&n.propertyIsEnumerable===n.constructor.prototype.propertyIsEnumerable)n.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},n.propertyIsEnumerable[zs]=e;else if(n.nodeType!==void 0)n[zs]=e;else throw new Error("Unable to set a non-enumerable property on object.")}return e}var jm=Object.isExtensible,Xm=function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}}();function J2(n){if(n&&n.nodeType>0)switch(n.nodeType){case 1:return n.uniqueID;case 9:return n.documentElement&&n.documentElement.uniqueID}}function Q2(n){return n.valueOf!==X2&&typeof n.valueOf=="function"?n.valueOf(n):n}function $m(){var n=++bh;return bh&1073741824&&(bh=0),n}var Sh=typeof WeakMap=="function",Eh;Sh&&(Eh=new WeakMap);var Ym=Object.create(null),bh=0,zs="__immutablehash__";typeof Symbol=="function"&&(zs=Symbol(zs));var ey=16,ty=255,Mh=0,wh={},sc=function(n){function e(t,r){this._iter=t,this._useKeys=r,this.size=t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.get=function(r,i){return this._iter.get(r,i)},e.prototype.has=function(r){return this._iter.has(r)},e.prototype.valueSeq=function(){return this._iter.valueSeq()},e.prototype.reverse=function(){var r=this,i=Th(this,!0);return this._useKeys||(i.valueSeq=function(){return r._iter.toSeq().reverse()}),i},e.prototype.map=function(r,i){var s=this,o=e0(this,r,i);return this._useKeys||(o.valueSeq=function(){return s._iter.toSeq().map(r,i)}),o},e.prototype.__iterate=function(r,i){var s=this;return this._iter.__iterate(function(o,a){return r(o,a,s)},i)},e.prototype.__iterator=function(r,i){return this._iter.__iterator(r,i)},e}(fs);sc.prototype[hs]=!0;var Km=function(n){function e(t){this._iter=t,this.size=t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.includes=function(r){return this._iter.includes(r)},e.prototype.__iterate=function(r,i){var s=this,o=0;return i&&xo(this),this._iter.__iterate(function(a){return r(a,i?s.size-++o:o++,s)},i)},e.prototype.__iterator=function(r,i){var s=this,o=this._iter.__iterator(pr,i),a=0;return i&&xo(this),new Lt(function(){var l=o.next();return l.done?l:rn(r,i?s.size-++a:a++,l.value,l)})},e}(qr),Zm=function(n){function e(t){this._iter=t,this.size=t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.has=function(r){return this._iter.includes(r)},e.prototype.__iterate=function(r,i){var s=this;return this._iter.__iterate(function(o){return r(o,o,s)},i)},e.prototype.__iterator=function(r,i){var s=this._iter.__iterator(pr,i);return new Lt(function(){var o=s.next();return o.done?o:rn(r,o.value,o.value,o)})},e}(Mo),Jm=function(n){function e(t){this._iter=t,this.size=t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.entrySeq=function(){return this._iter.toSeq()},e.prototype.__iterate=function(r,i){var s=this;return this._iter.__iterate(function(o){if(o){s0(o);var a=sr(o);return r(a?o.get(1):o[1],a?o.get(0):o[0],s)}},i)},e.prototype.__iterator=function(r,i){var s=this._iter.__iterator(pr,i);return new Lt(function(){for(;;){var o=s.next();if(o.done)return o;var a=o.value;if(a){s0(a);var l=sr(a);return rn(r,l?a.get(0):a[0],l?a.get(1):a[1],o)}}})},e}(fs);Km.prototype.cacheResult=sc.prototype.cacheResult=Zm.prototype.cacheResult=Jm.prototype.cacheResult=Rh;function Qm(n){var e=gi(n);return e._iter=n,e.size=n.size,e.flip=function(){return n},e.reverse=function(){var t=n.reverse.apply(this);return t.flip=function(){return n.reverse()},t},e.has=function(t){return n.includes(t)},e.includes=function(t){return n.has(t)},e.cacheResult=Rh,e.__iterateUncached=function(t,r){var i=this;return n.__iterate(function(s,o){return t(o,s,i)!==!1},r)},e.__iteratorUncached=function(t,r){if(t===mr){var i=n.__iterator(t,r);return new Lt(function(){var s=i.next();if(!s.done){var o=s.value[0];s.value[0]=s.value[1],s.value[1]=o}return s})}return n.__iterator(t===pr?Eo:pr,r)},e}function e0(n,e,t){var r=gi(n);return r.size=n.size,r.has=function(i){return n.has(i)},r.get=function(i,s){var o=n.get(i,It);return o===It?s:e.call(t,o,i,n)},r.__iterateUncached=function(i,s){var o=this;return n.__iterate(function(a,l,c){return i(e.call(t,a,l,c),l,o)!==!1},s)},r.__iteratorUncached=function(i,s){var o=n.__iterator(mr,s);return new Lt(function(){var a=o.next();if(a.done)return a;var l=a.value,c=l[0];return rn(i,c,e.call(t,l[1],c,n),a)})},r}function Th(n,e){var t=this,r=gi(n);return r._iter=n,r.size=n.size,r.reverse=function(){return n},n.flip&&(r.flip=function(){var i=Qm(n);return i.reverse=function(){return n.flip()},i}),r.get=function(i,s){return n.get(e?i:-1-i,s)},r.has=function(i){return n.has(e?i:-1-i)},r.includes=function(i){return n.includes(i)},r.cacheResult=Rh,r.__iterate=function(i,s){var o=this,a=0;return s&&xo(n),n.__iterate(function(l,c){return i(l,e?c:s?o.size-++a:a++,o)},!s)},r.__iterator=function(i,s){var o=0;s&&xo(n);var a=n.__iterator(mr,!s);return new Lt(function(){var l=a.next();if(l.done)return l;var c=l.value;return rn(i,e?c[0]:s?t.size-++o:o++,c[1],l)})},r}function t0(n,e,t,r){var i=gi(n);return r&&(i.has=function(s){var o=n.get(s,It);return o!==It&&!!e.call(t,o,s,n)},i.get=function(s,o){var a=n.get(s,It);return a!==It&&e.call(t,a,s,n)?a:o}),i.__iterateUncached=function(s,o){var a=this,l=0;return n.__iterate(function(c,h,f){if(e.call(t,c,h,f))return l++,s(c,r?h:l-1,a)},o),l},i.__iteratorUncached=function(s,o){var a=n.__iterator(mr,o),l=0;return new Lt(function(){for(;;){var c=a.next();if(c.done)return c;var h=c.value,f=h[0],p=h[1];if(e.call(t,p,f,n))return rn(s,r?f:l++,p,c)}})},i}function ny(n,e,t){var r=qe().asMutable();return n.__iterate(function(i,s){r.update(e.call(t,i,s,n),0,function(o){return o+1})}),r.asImmutable()}function ry(n,e,t){var r=Xt(n),i=(Wr(n)?xi():qe()).asMutable();n.__iterate(function(o,a){i.update(e.call(t,o,a,n),function(l){return l=l||[],l.push(r?[a,o]:o),l})});var s=Ch(n);return i.map(function(o){return $t(n,s(o))}).asImmutable()}function iy(n,e,t){var r=Xt(n),i=[[],[]];n.__iterate(function(o,a){i[e.call(t,o,a,n)?1:0].push(r?[a,o]:o)});var s=Ch(n);return i.map(function(o){return $t(n,s(o))})}function Ah(n,e,t,r){var i=n.size;if(Ba(e,t,i))return n;if(typeof i>"u"&&(e<0||t<0))return Ah(n.toSeq().cacheResult(),e,t,r);var s=yo(e,i),o=Va(t,i),a=o-s,l;a===a&&(l=a<0?0:a);var c=gi(n);return c.size=l===0?l:n.size&&l||void 0,!r&&ec(n)&&l>=0&&(c.get=function(h,f){return h=cs(this,h),h>=0&&h<l?n.get(h+s,f):f}),c.__iterateUncached=function(h,f){var p=this;if(l===0)return 0;if(f)return this.cacheResult().__iterate(h,f);var d=0,m=!0,x=0;return n.__iterate(function(v,_){if(!(m&&(m=d++<s)))return x++,h(v,r?_:x-1,p)!==!1&&x!==l}),x},c.__iteratorUncached=function(h,f){if(l!==0&&f)return this.cacheResult().__iterator(h,f);if(l===0)return new Lt(zn);var p=n.__iterator(h,f),d=0,m=0;return new Lt(function(){for(;d++<s;)p.next();if(++m>l)return zn();var x=p.next();return r||h===pr||x.done?x:h===Eo?rn(h,m-1,void 0,x):rn(h,m-1,x.value[1],x)})},c}function sy(n,e,t){var r=gi(n);return r.__iterateUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterate(i,s);var a=0;return n.__iterate(function(l,c,h){return e.call(t,l,c,h)&&++a&&i(l,c,o)}),a},r.__iteratorUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterator(i,s);var a=n.__iterator(mr,s),l=!0;return new Lt(function(){if(!l)return zn();var c=a.next();if(c.done)return c;var h=c.value,f=h[0],p=h[1];return e.call(t,p,f,o)?i===mr?c:rn(i,f,p,c):(l=!1,zn())})},r}function n0(n,e,t,r){var i=gi(n);return i.__iterateUncached=function(s,o){var a=this;if(o)return this.cacheResult().__iterate(s,o);var l=!0,c=0;return n.__iterate(function(h,f,p){if(!(l&&(l=e.call(t,h,f,p))))return c++,s(h,r?f:c-1,a)}),c},i.__iteratorUncached=function(s,o){var a=this;if(o)return this.cacheResult().__iterator(s,o);var l=n.__iterator(mr,o),c=!0,h=0;return new Lt(function(){var f,p,d;do{if(f=l.next(),f.done)return r||s===pr?f:s===Eo?rn(s,h++,void 0,f):rn(s,h++,f.value[1],f);var m=f.value;p=m[0],d=m[1],c&&(c=e.call(t,d,p,a))}while(c);return s===mr?f:rn(s,p,d,f)})},i}var oy=function(n){function e(t){this._wrappedIterables=t.flatMap(function(r){return r._wrappedIterables?r._wrappedIterables:[r]}),this.size=this._wrappedIterables.reduce(function(r,i){if(r!==void 0){var s=i.size;if(s!==void 0)return r+s}},0),this[Zl]=this._wrappedIterables[0][Zl],this[Jl]=this._wrappedIterables[0][Jl],this[hs]=this._wrappedIterables[0][hs]}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.__iterateUncached=function(r,i){if(this._wrappedIterables.length!==0){if(i)return this.cacheResult().__iterate(r,i);for(var s=0,o=Xt(this),a=o?mr:pr,l=this._wrappedIterables[s].__iterator(a,i),c=!0,h=0;c;){for(var f=l.next();f.done;){if(s++,s===this._wrappedIterables.length)return h;l=this._wrappedIterables[s].__iterator(a,i),f=l.next()}var p=o?r(f.value[1],f.value[0],this):r(f.value,h,this);c=p!==!1,h++}return h}},e.prototype.__iteratorUncached=function(r,i){var s=this;if(this._wrappedIterables.length===0)return new Lt(zn);if(i)return this.cacheResult().__iterator(r,i);var o=0,a=this._wrappedIterables[o].__iterator(r,i);return new Lt(function(){for(var l=a.next();l.done;){if(o++,o===s._wrappedIterables.length)return l;a=s._wrappedIterables[o].__iterator(r,i),l=a.next()}return l})},e}(wn);function ay(n,e){var t=Xt(n),r=[n].concat(e).map(function(s){return sr(s)?t&&(s=Lr(s)):s=t?gh(s):Hm(Array.isArray(s)?s:[s]),s}).filter(function(s){return s.size!==0});if(r.length===0)return n;if(r.length===1){var i=r[0];if(i===n||t&&Xt(i)||Zn(n)&&Zn(i))return i}return new oy(r)}function r0(n,e,t){var r=gi(n);return r.__iterateUncached=function(i,s){if(s)return this.cacheResult().__iterate(i,s);var o=0,a=!1;function l(c,h){c.__iterate(function(f,p){return(!e||h<e)&&sr(f)?l(f,h+1):(o++,i(f,t?p:o-1,r)===!1&&(a=!0)),!a},s)}return l(n,0),o},r.__iteratorUncached=function(i,s){if(s)return this.cacheResult().__iterator(i,s);var o=n.__iterator(i,s),a=[],l=0;return new Lt(function(){for(;o;){var c=o.next();if(c.done!==!1){o=a.pop();continue}var h=c.value;if(i===mr&&(h=h[1]),(!e||a.length<e)&&sr(h))a.push(o),o=h.__iterator(i,s);else return t?c:rn(i,l++,h,c)}return zn()})},r}function ly(n,e,t){var r=Ch(n);return n.toSeq().map(function(i,s){return r(e.call(t,i,s,n))}).flatten(!0)}function cy(n,e){var t=gi(n);return t.size=n.size&&n.size*2-1,t.__iterateUncached=function(r,i){var s=this,o=0;return n.__iterate(function(a){return(!o||r(e,o++,s)!==!1)&&r(a,o++,s)!==!1},i),o},t.__iteratorUncached=function(r,i){var s=n.__iterator(pr,i),o=0,a;return new Lt(function(){return(!a||o%2)&&(a=s.next(),a.done)?a:o%2?rn(r,o++,e):rn(r,o++,a.value,a)})},t}function To(n,e,t){e||(e=o0);var r=Xt(n),i=0,s=n.toSeq().map(function(o,a){return[a,o,i++,t?t(o,a,n):o]}).valueSeq().toArray();return s.sort(function(o,a){return e(o[3],a[3])||o[2]-a[2]}).forEach(r?function(o,a){s[a].length=2}:function(o,a){s[a]=o[1]}),r?fs(s):Zn(n)?qr(s):Mo(s)}function oc(n,e,t){if(e||(e=o0),t){var r=n.toSeq().map(function(i,s){return[i,t(i,s,n)]}).reduce(function(i,s){return i0(e,i[1],s[1])?s:i});return r&&r[0]}return n.reduce(function(i,s){return i0(e,i,s)?s:i})}function i0(n,e,t){var r=n(t,e);return r===0&&t!==e&&(t==null||t!==t)||r>0}function ac(n,e,t,r){var i=gi(n),s=new wo(t).map(function(o){return o.size});return i.size=r?s.max():s.min(),i.__iterate=function(o,a){for(var l=this.__iterator(pr,a),c,h=0;!(c=l.next()).done&&o(c.value,h++,this)!==!1;);return h},i.__iteratorUncached=function(o,a){var l=t.map(function(f){return f=Ln(f),fh(a?f.reverse():f)}),c=0,h=!1;return new Lt(function(){var f;return h||(f=l.map(function(p){return p.next()}),h=r?f.every(function(p){return p.done}):f.some(function(p){return p.done})),h?zn():rn(o,c++,e.apply(null,f.map(function(p){return p.value})))})},i}function $t(n,e){return n===e?n:ec(n)?e:n.constructor(e)}function s0(n){if(n!==Object(n))throw new TypeError("Expected [K, V] tuple: "+n)}function Ch(n){return Xt(n)?Lr:Zn(n)?Fs:So}function gi(n){return Object.create((Xt(n)?fs:Zn(n)?qr:Mo).prototype)}function Rh(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):wn.prototype.cacheResult.call(this)}function o0(n,e){return n===void 0&&e===void 0?0:n===void 0?1:e===void 0?-1:n>e?1:n<e?-1:0}function _i(n,e){e=e||0;for(var t=Math.max(0,n.length-e),r=new Array(t),i=0;i<t;i++)r[i]=n[i+e];return r}function Ga(n,e){if(!n)throw new Error(e)}function gr(n){Ga(n!==1/0,"Cannot perform this action with an infinite size.")}function a0(n){if(dh(n)&&typeof n!="string")return n;if(Wr(n))return n.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+n)}var uy=Object.prototype.toString;function Ph(n){if(!n||typeof n!="object"||uy.call(n)!=="[object Object]")return!1;var e=Object.getPrototypeOf(n);if(e===null)return!0;for(var t=e,r=Object.getPrototypeOf(e);r!==null;)t=r,r=Object.getPrototypeOf(t);return t===e}function ds(n){return typeof n=="object"&&(Or(n)||Array.isArray(n)||Ph(n))}function Wa(n){try{return typeof n=="string"?JSON.stringify(n):String(n)}catch{return JSON.stringify(n)}}function l0(n,e){return Or(n)?n.has(e):ds(n)&&bo.call(n,e)}function Ih(n,e,t){return Or(n)?n.get(e,t):l0(n,e)?typeof n.get=="function"?n.get(e):n[e]:t}function lc(n){if(Array.isArray(n))return _i(n);var e={};for(var t in n)bo.call(n,t)&&(e[t]=n[t]);return e}function c0(n,e){if(!ds(n))throw new TypeError("Cannot update non-data-structure value: "+n);if(Or(n)){if(!n.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+n);return n.remove(e)}if(!bo.call(n,e))return n;var t=lc(n);return Array.isArray(t)?t.splice(e,1):delete t[e],t}function u0(n,e,t){if(!ds(n))throw new TypeError("Cannot update non-data-structure value: "+n);if(Or(n)){if(!n.set)throw new TypeError("Cannot update immutable value without .set() method: "+n);return n.set(e,t)}if(bo.call(n,e)&&t===n[e])return n;var r=lc(n);return r[e]=t,r}function ks(n,e,t,r){r||(r=t,t=void 0);var i=h0(Or(n),n,a0(e),0,t,r);return i===It?t:i}function h0(n,e,t,r,i,s){var o=e===It;if(r===t.length){var a=o?i:e,l=s(a);return l===a?e:l}if(!o&&!ds(e))throw new TypeError("Cannot update within non-data-structure value in path ["+Array.from(t).slice(0,r).map(Wa)+"]: "+e);var c=t[r],h=o?It:Ih(e,c,It),f=h0(h===It?n:Or(h),h,t,r+1,i,s);return f===h?e:f===It?c0(e,c):u0(o?n?vi():{}:e,c,f)}function f0(n,e,t){return ks(n,e,It,function(){return t})}function Lh(n,e){return f0(this,n,e)}function d0(n,e){return ks(n,e,function(){return It})}function Oh(n){return d0(this,n)}function qh(n,e,t,r){return ks(n,[e],t,r)}function Dh(n,e,t){return arguments.length===1?n(this):qh(this,n,e,t)}function Nh(n,e,t){return ks(this,n,e,t)}function p0(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];return g0(this,n)}function m0(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];if(typeof n!="function")throw new TypeError("Invalid merger function: "+n);return g0(this,e,n)}function g0(n,e,t){for(var r=[],i=0;i<e.length;i++){var s=Lr(e[i]);s.size!==0&&r.push(s)}return r.length===0?n:n.toSeq().size===0&&!n.__ownerID&&r.length===1?us(n)?n:n.constructor(r[0]):n.withMutations(function(o){for(var a=t?function(c,h){qh(o,h,It,function(f){return f===It?c:t(f,c,h)})}:function(c,h){o.set(h,c)},l=0;l<r.length;l++)r[l].forEach(a)})}function hy(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return Xa(n,e)}function fy(n,e){for(var t=[],r=arguments.length-2;r-- >0;)t[r]=arguments[r+2];return Xa(e,t,n)}function dy(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return ja(n,e)}function py(n,e){for(var t=[],r=arguments.length-2;r-- >0;)t[r]=arguments[r+2];return ja(e,t,n)}function ja(n,e,t){return Xa(n,e,my(t))}function Xa(n,e,t){if(!ds(n))throw new TypeError("Cannot merge into non-data-structure value: "+n);if(Or(n))return typeof t=="function"&&n.mergeWith?n.mergeWith.apply(n,[t].concat(e)):n.merge?n.merge.apply(n,e):n.concat.apply(n,e);for(var r=Array.isArray(n),i=n,s=r?Fs:Lr,o=r?function(l){i===n&&(i=lc(i)),i.push(l)}:function(l,c){var h=bo.call(i,c),f=h&&t?t(i[c],l,c):l;(!h||f!==i[c])&&(i===n&&(i=lc(i)),i[c]=f)},a=0;a<e.length;a++)s(e[a]).forEach(o);return i}function my(n){function e(t,r,i){return ds(t)&&ds(r)&&gy(t,r)?Xa(t,[r],e):n?n(t,r,i):r}return e}function gy(n,e){var t=wn(n),r=wn(e);return Zn(t)===Zn(r)&&Xt(t)===Xt(r)}function _0(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];return ja(this,n)}function v0(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return ja(this,e,n)}function Uh(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return ks(this,n,vi(),function(r){return Xa(r,e)})}function Fh(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return ks(this,n,vi(),function(r){return ja(r,e)})}function $a(n){var e=this.asMutable();return n(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this}function Ya(){return this.__ownerID?this:this.__ensureOwner(new ch)}function Ka(){return this.__ensureOwner()}function zh(){return this.__altered}var qe=function(n){function e(t){return t==null?vi():rc(t)&&!Wr(t)?t:vi().withMutations(function(r){var i=n(t);gr(i.size),i.forEach(function(s,o){return r.set(o,s)})})}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return this.__toString("Map {","}")},e.prototype.get=function(r,i){return this._root?this._root.get(0,void 0,r,i):i},e.prototype.set=function(r,i){return S0(this,r,i)},e.prototype.remove=function(r){return S0(this,r,It)},e.prototype.deleteAll=function(r){var i=Ln(r);return i.size===0?this:this.withMutations(function(s){i.forEach(function(o){return s.remove(o)})})},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):vi()},e.prototype.sort=function(r){return xi(To(this,r))},e.prototype.sortBy=function(r,i){return xi(To(this,i,r))},e.prototype.map=function(r,i){var s=this;return this.withMutations(function(o){o.forEach(function(a,l){o.set(l,r.call(i,a,l,s))})})},e.prototype.__iterator=function(r,i){return new _y(this,r,i)},e.prototype.__iterate=function(r,i){var s=this,o=0;return this._root&&this._root.iterate(function(a){return o++,r(a[1],a[0],s)},i),o},e.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?Bh(this.size,this._root,r,this.__hash):this.size===0?vi():(this.__ownerID=r,this.__altered=!1,this)},e}(Lr);qe.isMap=rc;var on=qe.prototype;on[Gm]=!0,on[ka]=on.remove,on.removeAll=on.deleteAll,on.setIn=Lh,on.removeIn=on.deleteIn=Oh,on.update=Dh,on.updateIn=Nh,on.merge=on.concat=p0,on.mergeWith=m0,on.mergeDeep=_0,on.mergeDeepWith=v0,on.mergeIn=Uh,on.mergeDeepIn=Fh,on.withMutations=$a,on.wasAltered=zh,on.asImmutable=Ka,on["@@transducer/init"]=on.asMutable=Ya,on["@@transducer/step"]=function(n,e){return n.set(e[0],e[1])},on["@@transducer/result"]=function(n){return n.asImmutable()};var Za=function(e,t){this.ownerID=e,this.entries=t};Za.prototype.get=function(e,t,r,i){for(var s=this.entries,o=0,a=s.length;o<a;o++)if(sn(r,s[o][0]))return s[o][1];return i},Za.prototype.update=function(e,t,r,i,s,o,a){for(var l=s===It,c=this.entries,h=0,f=c.length;h<f&&!sn(i,c[h][0]);h++);var p=h<f;if(p?c[h][1]===s:l)return this;if(Ir(a),(l||!p)&&Ir(o),!(l&&c.length===1)){if(!p&&!l&&c.length>=by)return vy(e,c,i,s);var d=e&&e===this.ownerID,m=d?c:_i(c);return p?l?h===f-1?m.pop():m[h]=m.pop():m[h]=[i,s]:m.push([i,s]),d?(this.entries=m,this):new Za(e,m)}};var Ao=function(e,t,r){this.ownerID=e,this.bitmap=t,this.nodes=r};Ao.prototype.get=function(e,t,r,i){t===void 0&&(t=or(r));var s=1<<((e===0?t:t>>>e)&Kn),o=this.bitmap;return(o&s)===0?i:this.nodes[b0(o&s-1)].get(e+jt,t,r,i)},Ao.prototype.update=function(e,t,r,i,s,o,a){r===void 0&&(r=or(i));var l=(t===0?r:r>>>t)&Kn,c=1<<l,h=this.bitmap,f=(h&c)!==0;if(!f&&s===It)return this;var p=b0(h&c-1),d=this.nodes,m=f?d[p]:void 0,x=Vh(m,e,t+jt,r,i,s,o,a);if(x===m)return this;if(!f&&x&&d.length>=My)return yy(e,d,h,l,x);if(f&&!x&&d.length===2&&E0(d[p^1]))return d[p^1];if(f&&x&&d.length===1&&E0(x))return x;var v=e&&e===this.ownerID,_=f?x?h:h^c:h|c,E=f?x?M0(d,p,x,v):Ey(d,p,v):Sy(d,p,x,v);return v?(this.bitmap=_,this.nodes=E,this):new Ao(e,_,E)};var Ja=function(e,t,r){this.ownerID=e,this.count=t,this.nodes=r};Ja.prototype.get=function(e,t,r,i){t===void 0&&(t=or(r));var s=(e===0?t:t>>>e)&Kn,o=this.nodes[s];return o?o.get(e+jt,t,r,i):i},Ja.prototype.update=function(e,t,r,i,s,o,a){r===void 0&&(r=or(i));var l=(t===0?r:r>>>t)&Kn,c=s===It,h=this.nodes,f=h[l];if(c&&!f)return this;var p=Vh(f,e,t+jt,r,i,s,o,a);if(p===f)return this;var d=this.count;if(!f)d++;else if(!p&&(d--,d<wy))return xy(e,h,d,l);var m=e&&e===this.ownerID,x=M0(h,l,p,m);return m?(this.count=d,this.nodes=x,this):new Ja(e,d,x)};var Co=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entries=r};Co.prototype.get=function(e,t,r,i){for(var s=this.entries,o=0,a=s.length;o<a;o++)if(sn(r,s[o][0]))return s[o][1];return i},Co.prototype.update=function(e,t,r,i,s,o,a){r===void 0&&(r=or(i));var l=s===It;if(r!==this.keyHash)return l?this:(Ir(a),Ir(o),Hh(this,e,t,r,[i,s]));for(var c=this.entries,h=0,f=c.length;h<f&&!sn(i,c[h][0]);h++);var p=h<f;if(p?c[h][1]===s:l)return this;if(Ir(a),(l||!p)&&Ir(o),l&&f===2)return new ki(e,this.keyHash,c[h^1]);var d=e&&e===this.ownerID,m=d?c:_i(c);return p?l?h===f-1?m.pop():m[h]=m.pop():m[h]=[i,s]:m.push([i,s]),d?(this.entries=m,this):new Co(e,this.keyHash,m)};var ki=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entry=r};ki.prototype.get=function(e,t,r,i){return sn(r,this.entry[0])?this.entry[1]:i},ki.prototype.update=function(e,t,r,i,s,o,a){var l=s===It,c=sn(i,this.entry[0]);if(c?s===this.entry[1]:l)return this;if(Ir(a),l){Ir(o);return}return c?e&&e===this.ownerID?(this.entry[1]=s,this):new ki(e,this.keyHash,[i,s]):(Ir(o),Hh(this,e,t,or(i),[i,s]))},Za.prototype.iterate=Co.prototype.iterate=function(n,e){for(var t=this.entries,r=0,i=t.length-1;r<=i;r++)if(n(t[e?i-r:r])===!1)return!1},Ao.prototype.iterate=Ja.prototype.iterate=function(n,e){for(var t=this.nodes,r=0,i=t.length-1;r<=i;r++){var s=t[e?i-r:r];if(s&&s.iterate(n,e)===!1)return!1}},ki.prototype.iterate=function(n,e){return n(this.entry)};var _y=function(n){function e(t,r,i){this._type=r,this._reverse=i,this._stack=t._root&&x0(t._root)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.next=function(){for(var r=this._type,i=this._stack;i;){var s=i.node,o=i.index++,a=void 0;if(s.entry){if(o===0)return kh(r,s.entry)}else if(s.entries){if(a=s.entries.length-1,o<=a)return kh(r,s.entries[this._reverse?a-o:o])}else if(a=s.nodes.length-1,o<=a){var l=s.nodes[this._reverse?a-o:o];if(l){if(l.entry)return kh(r,l.entry);i=this._stack=x0(l,i)}continue}i=this._stack=this._stack.__prev}return zn()},e}(Lt);function kh(n,e){return rn(n,e[0],e[1])}function x0(n,e){return{node:n,index:0,__prev:e}}function Bh(n,e,t,r){var i=Object.create(on);return i.size=n,i._root=e,i.__ownerID=t,i.__hash=r,i.__altered=!1,i}var y0;function vi(){return y0||(y0=Bh(0))}function S0(n,e,t){var r,i;if(n._root){var s=lh(),o=lh();if(r=Vh(n._root,n.__ownerID,0,void 0,e,t,s,o),!o.value)return n;i=n.size+(s.value?t===It?-1:1:0)}else{if(t===It)return n;i=1,r=new Za(n.__ownerID,[[e,t]])}return n.__ownerID?(n.size=i,n._root=r,n.__hash=void 0,n.__altered=!0,n):r?Bh(i,r):vi()}function Vh(n,e,t,r,i,s,o,a){return n?n.update(e,t,r,i,s,o,a):s===It?n:(Ir(a),Ir(o),new ki(e,r,[i,s]))}function E0(n){return n.constructor===ki||n.constructor===Co}function Hh(n,e,t,r,i){if(n.keyHash===r)return new Co(e,r,[n.entry,i]);var s=(t===0?n.keyHash:n.keyHash>>>t)&Kn,o=(t===0?r:r>>>t)&Kn,a,l=s===o?[Hh(n,e,t+jt,r,i)]:(a=new ki(e,r,i),s<o?[n,a]:[a,n]);return new Ao(e,1<<s|1<<o,l)}function vy(n,e,t,r){n||(n=new ch);for(var i=new ki(n,or(t),[t,r]),s=0;s<e.length;s++){var o=e[s];i=i.update(n,0,void 0,o[0],o[1])}return i}function xy(n,e,t,r){for(var i=0,s=0,o=new Array(t),a=0,l=1,c=e.length;a<c;a++,l<<=1){var h=e[a];h!==void 0&&a!==r&&(i|=l,o[s++]=h)}return new Ao(n,i,o)}function yy(n,e,t,r,i){for(var s=0,o=new Array(dr),a=0;t!==0;a++,t>>>=1)o[a]=t&1?e[s++]:void 0;return o[r]=i,new Ja(n,s+1,o)}function b0(n){return n-=n>>1&1431655765,n=(n&858993459)+(n>>2&858993459),n=n+(n>>4)&252645135,n+=n>>8,n+=n>>16,n&127}function M0(n,e,t,r){var i=r?n:_i(n);return i[e]=t,i}function Sy(n,e,t,r){var i=n.length+1;if(r&&e+1===i)return n[e]=t,n;for(var s=new Array(i),o=0,a=0;a<i;a++)a===e?(s[a]=t,o=-1):s[a]=n[a+o];return s}function Ey(n,e,t){var r=n.length-1;if(t&&e===r)return n.pop(),n;for(var i=new Array(r),s=0,o=0;o<r;o++)o===e&&(s=1),i[o]=n[o+s];return i}var by=dr/4,My=dr/2,wy=dr/4,w0="@@__IMMUTABLE_LIST__@@";function Gh(n){return!!(n&&n[w0])}var Je=function(n){function e(t){var r=cc();if(t==null)return r;if(Gh(t))return t;var i=n(t),s=i.size;return s===0?r:(gr(s),s>0&&s<dr?el(0,s,jt,null,new ps(i.toArray())):r.withMutations(function(o){o.setSize(s),i.forEach(function(a,l){return o.set(l,a)})}))}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("List [","]")},e.prototype.get=function(r,i){if(r=cs(this,r),r>=0&&r<this.size){r+=this._origin;var s=A0(this,r);return s&&s.array[r&Kn]}return i},e.prototype.set=function(r,i){return Ty(this,r,i)},e.prototype.remove=function(r){return this.has(r)?r===0?this.shift():r===this.size-1?this.pop():this.splice(r,1):this},e.prototype.insert=function(r,i){return this.splice(r,0,i)},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=jt,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):cc()},e.prototype.push=function(){var r=arguments,i=this.size;return this.withMutations(function(s){ms(s,0,i+r.length);for(var o=0;o<r.length;o++)s.set(i+o,r[o])})},e.prototype.pop=function(){return ms(this,0,-1)},e.prototype.unshift=function(){var r=arguments;return this.withMutations(function(i){ms(i,-r.length);for(var s=0;s<r.length;s++)i.set(s,r[s])})},e.prototype.shift=function(){return ms(this,1)},e.prototype.shuffle=function(r){return r===void 0&&(r=Math.random),this.withMutations(function(i){for(var s=i.size,o,a;s;)o=Math.floor(r()*s--),a=i.get(o),i.set(o,i.get(s)),i.set(s,a)})},e.prototype.concat=function(){for(var r=arguments,i=[],s=0;s<arguments.length;s++){var o=r[s],a=n(typeof o!="string"&&hh(o)?o:[o]);a.size!==0&&i.push(a)}return i.length===0?this:this.size===0&&!this.__ownerID&&i.length===1?this.constructor(i[0]):this.withMutations(function(l){i.forEach(function(c){return c.forEach(function(h){return l.push(h)})})})},e.prototype.setSize=function(r){return ms(this,0,r)},e.prototype.map=function(r,i){var s=this;return this.withMutations(function(o){for(var a=0;a<s.size;a++)o.set(a,r.call(i,o.get(a),a,s))})},e.prototype.slice=function(r,i){var s=this.size;return Ba(r,i,s)?this:ms(this,yo(r,s),Va(i,s))},e.prototype.__iterator=function(r,i){var s=i?this.size:0,o=T0(this,i);return new Lt(function(){var a=o();return a===Qa?zn():rn(r,i?--s:s++,a)})},e.prototype.__iterate=function(r,i){for(var s=i?this.size:0,o=T0(this,i),a;(a=o())!==Qa&&r(a,i?--s:s++,this)!==!1;);return s},e.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?el(this._origin,this._capacity,this._level,this._root,this._tail,r,this.__hash):this.size===0?cc():(this.__ownerID=r,this.__altered=!1,this)},e}(Fs);Je.isList=Gh;var yn=Je.prototype;yn[w0]=!0,yn[ka]=yn.remove,yn.merge=yn.concat,yn.setIn=Lh,yn.deleteIn=yn.removeIn=Oh,yn.update=Dh,yn.updateIn=Nh,yn.mergeIn=Uh,yn.mergeDeepIn=Fh,yn.withMutations=$a,yn.wasAltered=zh,yn.asImmutable=Ka,yn["@@transducer/init"]=yn.asMutable=Ya,yn["@@transducer/step"]=function(n,e){return n.push(e)},yn["@@transducer/result"]=function(n){return n.asImmutable()};var ps=function(e,t){this.array=e,this.ownerID=t};ps.prototype.removeBefore=function(e,t,r){if((r&(1<<t+jt)-1)===0||this.array.length===0)return this;var i=r>>>t&Kn;if(i>=this.array.length)return new ps([],e);var s=i===0,o;if(t>0){var a=this.array[i];if(o=a&&a.removeBefore(e,t-jt,r),o===a&&s)return this}if(s&&!o)return this;var l=Ro(this,e);if(!s)for(var c=0;c<i;c++)l.array[c]=void 0;return o&&(l.array[i]=o),l},ps.prototype.removeAfter=function(e,t,r){if(r===(t?1<<t+jt:dr)||this.array.length===0)return this;var i=r-1>>>t&Kn;if(i>=this.array.length)return this;var s;if(t>0){var o=this.array[i];if(s=o&&o.removeAfter(e,t-jt,r),s===o&&i===this.array.length-1)return this}var a=Ro(this,e);return a.array.splice(i+1),s&&(a.array[i]=s),a};var Qa={};function T0(n,e){var t=n._origin,r=n._capacity,i=tl(r),s=n._tail;return o(n._root,n._level,0);function o(c,h,f){return h===0?a(c,f):l(c,h,f)}function a(c,h){var f=h===i?s&&s.array:c&&c.array,p=h>t?0:t-h,d=r-h;return d>dr&&(d=dr),function(){if(p===d)return Qa;var m=e?--d:p++;return f&&f[m]}}function l(c,h,f){var p,d=c&&c.array,m=f>t?0:t-f>>h,x=(r-f>>h)+1;return x>dr&&(x=dr),function(){for(;;){if(p){var v=p();if(v!==Qa)return v;p=null}if(m===x)return Qa;var _=e?--x:m++;p=o(d&&d[_],h-jt,f+(_<<h))}}}}function el(n,e,t,r,i,s,o){var a=Object.create(yn);return a.size=e-n,a._origin=n,a._capacity=e,a._level=t,a._root=r,a._tail=i,a.__ownerID=s,a.__hash=o,a.__altered=!1,a}function cc(){return el(0,0,jt)}function Ty(n,e,t){if(e=cs(n,e),e!==e)return n;if(e>=n.size||e<0)return n.withMutations(function(o){e<0?ms(o,e).set(0,t):ms(o,0,e+1).set(e,t)});e+=n._origin;var r=n._tail,i=n._root,s=lh();return e>=tl(n._capacity)?r=Wh(r,n.__ownerID,0,e,t,s):i=Wh(i,n.__ownerID,n._level,e,t,s),s.value?n.__ownerID?(n._root=i,n._tail=r,n.__hash=void 0,n.__altered=!0,n):el(n._origin,n._capacity,n._level,i,r):n}function Wh(n,e,t,r,i,s){var o=r>>>t&Kn,a=n&&o<n.array.length;if(!a&&i===void 0)return n;var l;if(t>0){var c=n&&n.array[o],h=Wh(c,e,t-jt,r,i,s);return h===c?n:(l=Ro(n,e),l.array[o]=h,l)}return a&&n.array[o]===i?n:(s&&Ir(s),l=Ro(n,e),i===void 0&&o===l.array.length-1?l.array.pop():l.array[o]=i,l)}function Ro(n,e){return e&&n&&e===n.ownerID?n:new ps(n?n.array.slice():[],e)}function A0(n,e){if(e>=tl(n._capacity))return n._tail;if(e<1<<n._level+jt){for(var t=n._root,r=n._level;t&&r>0;)t=t.array[e>>>r&Kn],r-=jt;return t}}function ms(n,e,t){e!==void 0&&(e|=0),t!==void 0&&(t|=0);var r=n.__ownerID||new ch,i=n._origin,s=n._capacity,o=i+e,a=t===void 0?s:t<0?s+t:i+t;if(o===i&&a===s)return n;if(o>=a)return n.clear();for(var l=n._level,c=n._root,h=0;o+h<0;)c=new ps(c&&c.array.length?[void 0,c]:[],r),l+=jt,h+=1<<l;h&&(o+=h,i+=h,a+=h,s+=h);for(var f=tl(s),p=tl(a);p>=1<<l+jt;)c=new ps(c&&c.array.length?[c]:[],r),l+=jt;var d=n._tail,m=p<f?A0(n,a-1):p>f?new ps([],r):d;if(d&&p>f&&o<s&&d.array.length){c=Ro(c,r);for(var x=c,v=l;v>jt;v-=jt){var _=f>>>v&Kn;x=x.array[_]=Ro(x.array[_],r)}x.array[f>>>jt&Kn]=d}if(a<s&&(m=m&&m.removeAfter(r,0,a)),o>=p)o-=p,a-=p,l=jt,c=null,m=m&&m.removeBefore(r,0,o);else if(o>i||p<f){for(h=0;c;){var E=o>>>l&Kn;if(E!==p>>>l&Kn)break;E&&(h+=(1<<l)*E),l-=jt,c=c.array[E]}c&&o>i&&(c=c.removeBefore(r,l,o-h)),c&&p<f&&(c=c.removeAfter(r,l,p-h)),h&&(o-=h,a-=h)}return n.__ownerID?(n.size=a-o,n._origin=o,n._capacity=a,n._level=l,n._root=c,n._tail=m,n.__hash=void 0,n.__altered=!0,n):el(o,a,l,c,m)}function tl(n){return n<dr?0:n-1>>>jt<<jt}var xi=function(n){function e(t){return t==null?nl():vh(t)?t:nl().withMutations(function(r){var i=Lr(t);gr(i.size),i.forEach(function(s,o){return r.set(o,s)})})}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("OrderedMap {","}")},e.prototype.get=function(r,i){var s=this._map.get(r);return s!==void 0?this._list.get(s)[1]:i},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this.__altered=!0,this):nl()},e.prototype.set=function(r,i){return R0(this,r,i)},e.prototype.remove=function(r){return R0(this,r,It)},e.prototype.__iterate=function(r,i){var s=this;return this._list.__iterate(function(o){return o&&r(o[1],o[0],s)},i)},e.prototype.__iterator=function(r,i){return this._list.fromEntrySeq().__iterator(r,i)},e.prototype.__ensureOwner=function(r){if(r===this.__ownerID)return this;var i=this._map.__ensureOwner(r),s=this._list.__ensureOwner(r);return r?jh(i,s,r,this.__hash):this.size===0?nl():(this.__ownerID=r,this.__altered=!1,this._map=i,this._list=s,this)},e}(qe);xi.isOrderedMap=vh,xi.prototype[hs]=!0,xi.prototype[ka]=xi.prototype.remove;function jh(n,e,t,r){var i=Object.create(xi.prototype);return i.size=n?n.size:0,i._map=n,i._list=e,i.__ownerID=t,i.__hash=r,i.__altered=!1,i}var C0;function nl(){return C0||(C0=jh(vi(),cc()))}function R0(n,e,t){var r=n._map,i=n._list,s=r.get(e),o=s!==void 0,a,l;if(t===It){if(!o)return n;i.size>=dr&&i.size>=r.size*2?(l=i.filter(function(c,h){return c!==void 0&&s!==h}),a=l.toKeyedSeq().map(function(c){return c[0]}).flip().toMap(),n.__ownerID&&(a.__ownerID=l.__ownerID=n.__ownerID)):(a=r.remove(e),l=s===i.size-1?i.pop():i.set(s,void 0))}else if(o){if(t===i.get(s)[1])return n;a=r,l=i.set(s,[e,t])}else a=r.set(e,i.size),l=i.set(i.size,[e,t]);return n.__ownerID?(n.size=a.size,n._map=a,n._list=l,n.__hash=void 0,n.__altered=!0,n):jh(a,l)}var P0="@@__IMMUTABLE_STACK__@@";function uc(n){return!!(n&&n[P0])}var hc=function(n){function e(t){return t==null?fc():uc(t)?t:fc().pushAll(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("Stack [","]")},e.prototype.get=function(r,i){var s=this._head;for(r=cs(this,r);s&&r--;)s=s.next;return s?s.value:i},e.prototype.peek=function(){return this._head&&this._head.value},e.prototype.push=function(){var r=arguments;if(arguments.length===0)return this;for(var i=this.size+arguments.length,s=this._head,o=arguments.length-1;o>=0;o--)s={value:r[o],next:s};return this.__ownerID?(this.size=i,this._head=s,this.__hash=void 0,this.__altered=!0,this):rl(i,s)},e.prototype.pushAll=function(r){if(r=n(r),r.size===0)return this;if(this.size===0&&uc(r))return r;gr(r.size);var i=this.size,s=this._head;return r.__iterate(function(o){i++,s={value:o,next:s}},!0),this.__ownerID?(this.size=i,this._head=s,this.__hash=void 0,this.__altered=!0,this):rl(i,s)},e.prototype.pop=function(){return this.slice(1)},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):fc()},e.prototype.slice=function(r,i){if(Ba(r,i,this.size))return this;var s=yo(r,this.size),o=Va(i,this.size);if(o!==this.size)return n.prototype.slice.call(this,r,i);for(var a=this.size-s,l=this._head;s--;)l=l.next;return this.__ownerID?(this.size=a,this._head=l,this.__hash=void 0,this.__altered=!0,this):rl(a,l)},e.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?rl(this.size,this._head,r,this.__hash):this.size===0?fc():(this.__ownerID=r,this.__altered=!1,this)},e.prototype.__iterate=function(r,i){var s=this;if(i)return new wo(this.toArray()).__iterate(function(l,c){return r(l,c,s)},i);for(var o=0,a=this._head;a&&r(a.value,o++,this)!==!1;)a=a.next;return o},e.prototype.__iterator=function(r,i){if(i)return new wo(this.toArray()).__iterator(r,i);var s=0,o=this._head;return new Lt(function(){if(o){var a=o.value;return o=o.next,rn(r,s++,a)}return zn()})},e}(Fs);hc.isStack=uc;var Jn=hc.prototype;Jn[P0]=!0,Jn.shift=Jn.pop,Jn.unshift=Jn.push,Jn.unshiftAll=Jn.pushAll,Jn.withMutations=$a,Jn.wasAltered=zh,Jn.asImmutable=Ka,Jn["@@transducer/init"]=Jn.asMutable=Ya,Jn["@@transducer/step"]=function(n,e){return n.unshift(e)},Jn["@@transducer/result"]=function(n){return n.asImmutable()};function rl(n,e,t,r){var i=Object.create(Jn);return i.size=n,i._head=e,i.__ownerID=t,i.__hash=r,i.__altered=!1,i}var I0;function fc(){return I0||(I0=rl(0))}var L0="@@__IMMUTABLE_SET__@@";function dc(n){return!!(n&&n[L0])}function Xh(n){return dc(n)&&Wr(n)}function $h(n,e){if(n===e)return!0;if(!sr(e)||n.size!==void 0&&e.size!==void 0&&n.size!==e.size||n.__hash!==void 0&&e.__hash!==void 0&&n.__hash!==e.__hash||Xt(n)!==Xt(e)||Zn(n)!==Zn(e)||Wr(n)!==Wr(e))return!1;if(n.size===0&&e.size===0)return!0;var t=!Ql(n);if(Wr(n)){var r=n.entries();return e.every(function(l,c){var h=r.next().value;return h&&sn(h[1],l)&&(t||sn(h[0],c))})&&r.next().done}var i=!1;if(n.size===void 0)if(e.size===void 0)typeof n.cacheResult=="function"&&n.cacheResult();else{i=!0;var s=n;n=e,e=s}var o=!0,a=e.__iterate(function(l,c){if(t?!n.has(l):i?!sn(l,n.get(c,It)):!sn(n.get(c,It),l))return o=!1,!1});return o&&n.size===a}function Bs(n,e){var t=function(r){n.prototype[r]=e[r]};return Object.keys(e).forEach(t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(t),n}function pc(n){if(!n||typeof n!="object")return n;if(!sr(n)){if(!ds(n))return n;n=wn(n)}if(Xt(n)){var e={};return n.__iterate(function(r,i){e[i]=pc(r)}),e}var t=[];return n.__iterate(function(r){t.push(pc(r))}),t}var il=function(n){function e(t){return t==null?sl():dc(t)&&!Wr(t)?t:sl().withMutations(function(r){var i=n(t);gr(i.size),i.forEach(function(s){return r.add(s)})})}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(r){return this(Lr(r).keySeq())},e.intersect=function(r){return r=Ln(r).toArray(),r.length?Nn.intersect.apply(e(r.pop()),r):sl()},e.union=function(r){return r=Ln(r).toArray(),r.length?Nn.union.apply(e(r.pop()),r):sl()},e.prototype.toString=function(){return this.__toString("Set {","}")},e.prototype.has=function(r){return this._map.has(r)},e.prototype.add=function(r){return mc(this,this._map.set(r,r))},e.prototype.remove=function(r){return mc(this,this._map.remove(r))},e.prototype.clear=function(){return mc(this,this._map.clear())},e.prototype.map=function(r,i){var s=this,o=!1,a=mc(this,this._map.mapEntries(function(l){var c=l[1],h=r.call(i,c,c,s);return h!==c&&(o=!0),[h,h]},i));return o?a:this},e.prototype.union=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];return r=r.filter(function(s){return s.size!==0}),r.length===0?this:this.size===0&&!this.__ownerID&&r.length===1?this.constructor(r[0]):this.withMutations(function(s){for(var o=0;o<r.length;o++)typeof r[o]=="string"?s.add(r[o]):n(r[o]).forEach(function(a){return s.add(a)})})},e.prototype.intersect=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];if(r.length===0)return this;r=r.map(function(o){return n(o)});var s=[];return this.forEach(function(o){r.every(function(a){return a.includes(o)})||s.push(o)}),this.withMutations(function(o){s.forEach(function(a){o.remove(a)})})},e.prototype.subtract=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];if(r.length===0)return this;r=r.map(function(o){return n(o)});var s=[];return this.forEach(function(o){r.some(function(a){return a.includes(o)})&&s.push(o)}),this.withMutations(function(o){s.forEach(function(a){o.remove(a)})})},e.prototype.sort=function(r){return Lo(To(this,r))},e.prototype.sortBy=function(r,i){return Lo(To(this,i,r))},e.prototype.wasAltered=function(){return this._map.wasAltered()},e.prototype.__iterate=function(r,i){var s=this;return this._map.__iterate(function(o){return r(o,o,s)},i)},e.prototype.__iterator=function(r,i){return this._map.__iterator(r,i)},e.prototype.__ensureOwner=function(r){if(r===this.__ownerID)return this;var i=this._map.__ensureOwner(r);return r?this.__make(i,r):this.size===0?this.__empty():(this.__ownerID=r,this._map=i,this)},e}(So);il.isSet=dc;var Nn=il.prototype;Nn[L0]=!0,Nn[ka]=Nn.remove,Nn.merge=Nn.concat=Nn.union,Nn.withMutations=$a,Nn.asImmutable=Ka,Nn["@@transducer/init"]=Nn.asMutable=Ya,Nn["@@transducer/step"]=function(n,e){return n.add(e)},Nn["@@transducer/result"]=function(n){return n.asImmutable()},Nn.__empty=sl,Nn.__make=O0;function mc(n,e){return n.__ownerID?(n.size=e.size,n._map=e,n):e===n._map?n:e.size===0?n.__empty():n.__make(e)}function O0(n,e){var t=Object.create(Nn);return t.size=n?n.size:0,t._map=n,t.__ownerID=e,t}var q0;function sl(){return q0||(q0=O0(vi()))}var D0=function(n){function e(t,r,i){if(i===void 0&&(i=1),!(this instanceof e))return new e(t,r,i);if(Ga(i!==0,"Cannot step a Range by 0"),Ga(t!==void 0,"You must define a start value when using Range"),Ga(r!==void 0,"You must define an end value when using Range"),i=Math.abs(i),r<t&&(i=-i),this._start=t,this._end=r,this._step=i,this.size=Math.max(0,Math.ceil((r-t)/i-1)+1),this.size===0){if(Yh)return Yh;Yh=this}}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return this.size===0?"Range []":"Range [ "+this._start+"..."+this._end+(this._step!==1?" by "+this._step:"")+" ]"},e.prototype.get=function(r,i){return this.has(r)?this._start+cs(this,r)*this._step:i},e.prototype.includes=function(r){var i=(r-this._start)/this._step;return i>=0&&i<this.size&&i===Math.floor(i)},e.prototype.slice=function(r,i){return Ba(r,i,this.size)?this:(r=yo(r,this.size),i=Va(i,this.size),i<=r?new e(0,0):new e(this.get(r,this._end),this.get(i,this._end),this._step))},e.prototype.indexOf=function(r){var i=r-this._start;if(i%this._step===0){var s=i/this._step;if(s>=0&&s<this.size)return s}return-1},e.prototype.lastIndexOf=function(r){return this.indexOf(r)},e.prototype.__iterate=function(r,i){for(var s=this.size,o=this._step,a=i?this._start+(s-1)*o:this._start,l=0;l!==s&&r(a,i?s-++l:l++,this)!==!1;)a+=i?-o:o;return l},e.prototype.__iterator=function(r,i){var s=this.size,o=this._step,a=i?this._start+(s-1)*o:this._start,l=0;return new Lt(function(){if(l===s)return zn();var c=a;return a+=i?-o:o,rn(r,i?s-++l:l++,c)})},e.prototype.equals=function(r){return r instanceof e?this._start===r._start&&this._end===r._end&&this._step===r._step:$h(this,r)},e}(qr),Yh;function Kh(n,e,t){for(var r=a0(e),i=0;i!==r.length;)if(n=Ih(n,r[i++],It),n===It)return t;return n}function N0(n,e){return Kh(this,n,e)}function U0(n,e){return Kh(n,e,It)!==It}function Ay(n){return U0(this,n)}function F0(){gr(this.size);var n={};return this.__iterate(function(e,t){n[t]=e}),n}Ln.Iterator=Lt,Bs(Ln,{toArray:function(){gr(this.size);var e=new Array(this.size||0),t=Xt(this),r=0;return this.__iterate(function(i,s){e[r++]=t?[s,i]:i}),e},toIndexedSeq:function(){return new Km(this)},toJS:function(){return pc(this)},toKeyedSeq:function(){return new sc(this,!0)},toMap:function(){return qe(this.toKeyedSeq())},toObject:F0,toOrderedMap:function(){return xi(this.toKeyedSeq())},toOrderedSet:function(){return Lo(Xt(this)?this.valueSeq():this)},toSet:function(){return il(Xt(this)?this.valueSeq():this)},toSetSeq:function(){return new Zm(this)},toSeq:function(){return Zn(this)?this.toIndexedSeq():Xt(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return hc(Xt(this)?this.valueSeq():this)},toList:function(){return Je(Xt(this)?this.valueSeq():this)},toString:function(){return"[Collection]"},__toString:function(e,t){return this.size===0?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return $t(this,ay(this,e))},includes:function(e){return this.some(function(t){return sn(t,e)})},entries:function(){return this.__iterator(mr)},every:function(e,t){gr(this.size);var r=!0;return this.__iterate(function(i,s,o){if(!e.call(t,i,s,o))return r=!1,!1}),r},filter:function(e,t){return $t(this,t0(this,e,t,!0))},partition:function(e,t){return iy(this,e,t)},find:function(e,t,r){var i=this.findEntry(e,t);return i?i[1]:r},forEach:function(e,t){return gr(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){gr(this.size),e=e!==void 0?""+e:",";var t="",r=!0;return this.__iterate(function(i){r?r=!1:t+=e,t+=i!=null?i.toString():""}),t},keys:function(){return this.__iterator(Eo)},map:function(e,t){return $t(this,e0(this,e,t))},reduce:function(e,t,r){return z0(this,e,t,r,arguments.length<2,!1)},reduceRight:function(e,t,r){return z0(this,e,t,r,arguments.length<2,!0)},reverse:function(){return $t(this,Th(this,!0))},slice:function(e,t){return $t(this,Ah(this,e,t,!0))},some:function(e,t){gr(this.size);var r=!1;return this.__iterate(function(i,s,o){if(e.call(t,i,s,o))return r=!0,!1}),r},sort:function(e){return $t(this,To(this,e))},values:function(){return this.__iterator(pr)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==void 0?this.size===0:!this.some(function(){return!0})},count:function(e,t){return xo(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return ny(this,e,t)},equals:function(e){return $h(this,e)},entrySeq:function(){var e=this;if(e._cache)return new wo(e._cache);var t=e.toSeq().map(Ry).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Zh(e),t)},findEntry:function(e,t,r){var i=r;return this.__iterate(function(s,o,a){if(e.call(t,s,o,a))return i=[o,s],!1}),i},findKey:function(e,t){var r=this.findEntry(e,t);return r&&r[0]},findLast:function(e,t,r){return this.toKeyedSeq().reverse().find(e,t,r)},findLastEntry:function(e,t,r){return this.toKeyedSeq().reverse().findEntry(e,t,r)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(e){return this.find(qm,null,e)},flatMap:function(e,t){return $t(this,ly(this,e,t))},flatten:function(e){return $t(this,r0(this,e,!0))},fromEntrySeq:function(){return new Jm(this)},get:function(e,t){return this.find(function(r,i){return sn(i,e)},void 0,t)},getIn:N0,groupBy:function(e,t){return ry(this,e,t)},has:function(e){return this.get(e,It)!==It},hasIn:Ay,isSubset:function(e){return e=typeof e.includes=="function"?e:Ln(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return e=typeof e.isSubset=="function"?e:Ln(e),e.isSubset(this)},keyOf:function(e){return this.findKey(function(t){return sn(t,e)})},keySeq:function(){return this.toSeq().map(Cy).toIndexedSeq()},last:function(e){return this.toSeq().reverse().first(e)},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return oc(this,e)},maxBy:function(e,t){return oc(this,t,e)},min:function(e){return oc(this,e?k0(e):V0)},minBy:function(e,t){return oc(this,t?k0(t):V0,e)},rest:function(){return this.slice(1)},skip:function(e){return e===0?this:this.slice(Math.max(0,e))},skipLast:function(e){return e===0?this:this.slice(0,-Math.max(0,e))},skipWhile:function(e,t){return $t(this,n0(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Zh(e),t)},sortBy:function(e,t){return $t(this,To(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return this.slice(-Math.max(0,e))},takeWhile:function(e,t){return $t(this,sy(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Zh(e),t)},update:function(e){return e(this)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=Py(this))}});var kn=Ln.prototype;kn[Um]=!0,kn[tc]=kn.values,kn.toJSON=kn.toArray,kn.__toStringMapper=Wa,kn.inspect=kn.toSource=function(){return this.toString()},kn.chain=kn.flatMap,kn.contains=kn.includes,Bs(Lr,{flip:function(){return $t(this,Qm(this))},mapEntries:function(e,t){var r=this,i=0;return $t(this,this.toSeq().map(function(s,o){return e.call(t,[o,s],i++,r)}).fromEntrySeq())},mapKeys:function(e,t){var r=this;return $t(this,this.toSeq().flip().map(function(i,s){return e.call(t,i,s,r)}).flip())}});var ol=Lr.prototype;ol[Zl]=!0,ol[tc]=kn.entries,ol.toJSON=F0,ol.__toStringMapper=function(n,e){return Wa(e)+": "+Wa(n)},Bs(Fs,{toKeyedSeq:function(){return new sc(this,!1)},filter:function(e,t){return $t(this,t0(this,e,t,!1))},findIndex:function(e,t){var r=this.findEntry(e,t);return r?r[0]:-1},indexOf:function(e){var t=this.keyOf(e);return t===void 0?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return t===void 0?-1:t},reverse:function(){return $t(this,Th(this,!1))},slice:function(e,t){return $t(this,Ah(this,e,t,!1))},splice:function(e,t){var r=arguments.length;if(t=Math.max(t||0,0),r===0||r===2&&!t)return this;e=yo(e,e<0?this.count():this.size);var i=this.slice(0,e);return $t(this,r===1?i:i.concat(_i(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var r=this.findLastEntry(e,t);return r?r[0]:-1},first:function(e){return this.get(0,e)},flatten:function(e){return $t(this,r0(this,e,!1))},get:function(e,t){return e=cs(this,e),e<0||this.size===1/0||this.size!==void 0&&e>this.size?t:this.find(function(r,i){return i===e},void 0,t)},has:function(e){return e=cs(this,e),e>=0&&(this.size!==void 0?this.size===1/0||e<this.size:this.indexOf(e)!==-1)},interpose:function(e){return $t(this,cy(this,e))},interleave:function(){var e=[this].concat(_i(arguments)),t=ac(this.toSeq(),qr.of,e),r=t.flatten(!0);return t.size&&(r.size=t.size*e.length),$t(this,r)},keySeq:function(){return D0(0,this.size)},last:function(e){return this.get(-1,e)},skipWhile:function(e,t){return $t(this,n0(this,e,t,!1))},zip:function(){var e=[this].concat(_i(arguments));return $t(this,ac(this,B0,e))},zipAll:function(){var e=[this].concat(_i(arguments));return $t(this,ac(this,B0,e,!0))},zipWith:function(e){var t=_i(arguments);return t[0]=this,$t(this,ac(this,e,t))}});var Po=Fs.prototype;Po[Jl]=!0,Po[hs]=!0,Bs(So,{get:function(e,t){return this.has(e)?e:t},includes:function(e){return this.has(e)},keySeq:function(){return this.valueSeq()}});var Io=So.prototype;Io.has=kn.includes,Io.contains=Io.includes,Io.keys=Io.values,Bs(fs,ol),Bs(qr,Po),Bs(Mo,Io);function z0(n,e,t,r,i,s){return gr(n.size),n.__iterate(function(o,a,l){i?(i=!1,t=o):t=e.call(r,t,o,a,l)},s),t}function Cy(n,e){return e}function Ry(n,e){return[e,n]}function Zh(n){return function(){return!n.apply(this,arguments)}}function k0(n){return function(){return-n.apply(this,arguments)}}function B0(){return _i(arguments)}function V0(n,e){return n<e?1:n>e?-1:0}function Py(n){if(n.size===1/0)return 0;var e=Wr(n),t=Xt(n),r=e?1:0;return n.__iterate(t?e?function(i,s){r=31*r+H0(or(i),or(s))|0}:function(i,s){r=r+H0(or(i),or(s))|0}:e?function(i){r=31*r+or(i)|0}:function(i){r=r+or(i)|0}),Iy(n.size,r)}function Iy(n,e){return e=Ha(e,3432918353),e=Ha(e<<15|e>>>-15,461845907),e=Ha(e<<13|e>>>-13,5),e=(e+3864292196|0)^n,e=Ha(e^e>>>16,2246822507),e=Ha(e^e>>>13,3266489909),e=ic(e^e>>>16),e}function H0(n,e){return n^e+2654435769+(n<<6)+(n>>2)|0}var Lo=function(n){function e(t){return t==null?Jh():Xh(t)?t:Jh().withMutations(function(r){var i=So(t);gr(i.size),i.forEach(function(s){return r.add(s)})})}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(r){return this(Lr(r).keySeq())},e.prototype.toString=function(){return this.__toString("OrderedSet {","}")},e}(il);Lo.isOrderedSet=Xh;var Vs=Lo.prototype;Vs[hs]=!0,Vs.zip=Po.zip,Vs.zipWith=Po.zipWith,Vs.zipAll=Po.zipAll,Vs.__empty=Jh,Vs.__make=G0;function G0(n,e){var t=Object.create(Vs);return t.size=n?n.size:0,t._map=n,t.__ownerID=e,t}var W0;function Jh(){return W0||(W0=G0(nl()))}var Ly={LeftThenRight:-1,RightThenLeft:1};function Oy(n){if(us(n))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(Or(n))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(n===null||typeof n!="object")throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}var St=function(e,t){var r;Oy(e);var i=function(a){var l=this;if(a instanceof i)return a;if(!(this instanceof i))return new i(a);if(!r){r=!0;var c=Object.keys(e),h=s._indices={};s._name=t,s._keys=c,s._defaultValues=e;for(var f=0;f<c.length;f++){var p=c[f];h[p]=f,s[p]?typeof console=="object"&&console.warn&&console.warn("Cannot define "+ef(this)+' with property "'+p+'" since that property name is part of the Record API.'):qy(s,p)}}return this.__ownerID=void 0,this._values=Je().withMutations(function(d){d.setSize(l._keys.length),Lr(a).forEach(function(m,x){d.set(l._indices[x],m===l._defaultValues[x]?void 0:m)})}),this},s=i.prototype=Object.create(Jt);return s.constructor=i,t&&(i.displayName=t),i};St.prototype.toString=function(){for(var e=ef(this)+" { ",t=this._keys,r,i=0,s=t.length;i!==s;i++)r=t[i],e+=(i?", ":"")+r+": "+Wa(this.get(r));return e+" }"},St.prototype.equals=function(e){return this===e||us(e)&&Oo(this).equals(Oo(e))},St.prototype.hashCode=function(){return Oo(this).hashCode()},St.prototype.has=function(e){return this._indices.hasOwnProperty(e)},St.prototype.get=function(e,t){if(!this.has(e))return t;var r=this._indices[e],i=this._values.get(r);return i===void 0?this._defaultValues[e]:i},St.prototype.set=function(e,t){if(this.has(e)){var r=this._values.set(this._indices[e],t===this._defaultValues[e]?void 0:t);if(r!==this._values&&!this.__ownerID)return Qh(this,r)}return this},St.prototype.remove=function(e){return this.set(e)},St.prototype.clear=function(){var e=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:Qh(this,e)},St.prototype.wasAltered=function(){return this._values.wasAltered()},St.prototype.toSeq=function(){return Oo(this)},St.prototype.toJS=function(){return pc(this)},St.prototype.entries=function(){return this.__iterator(mr)},St.prototype.__iterator=function(e,t){return Oo(this).__iterator(e,t)},St.prototype.__iterate=function(e,t){return Oo(this).__iterate(e,t)},St.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._values.__ensureOwner(e);return e?Qh(this,t,e):(this.__ownerID=e,this._values=t,this)},St.isRecord=us,St.getDescriptiveName=ef;var Jt=St.prototype;Jt[zm]=!0,Jt[ka]=Jt.remove,Jt.deleteIn=Jt.removeIn=Oh,Jt.getIn=N0,Jt.hasIn=kn.hasIn,Jt.merge=p0,Jt.mergeWith=m0,Jt.mergeIn=Uh,Jt.mergeDeep=_0,Jt.mergeDeepWith=v0,Jt.mergeDeepIn=Fh,Jt.setIn=Lh,Jt.update=Dh,Jt.updateIn=Nh,Jt.withMutations=$a,Jt.asMutable=Ya,Jt.asImmutable=Ka,Jt[tc]=Jt.entries,Jt.toJSON=Jt.toObject=kn.toObject,Jt.inspect=Jt.toSource=function(){return this.toString()};function Qh(n,e,t){var r=Object.create(Object.getPrototypeOf(n));return r._values=e,r.__ownerID=t,r}function ef(n){return n.constructor.displayName||n.constructor.name||"Record"}function Oo(n){return gh(n._keys.map(function(e){return[e,n.get(e)]}))}function qy(n,e){try{Object.defineProperty(n,e,{get:function(){return this.get(e)},set:function(t){Ga(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}catch{}}var Dy=function(n){function e(t,r){if(!(this instanceof e))return new e(t,r);if(this._value=t,this.size=r===void 0?1/0:Math.max(0,r),this.size===0){if(tf)return tf;tf=this}}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return this.size===0?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},e.prototype.get=function(r,i){return this.has(r)?this._value:i},e.prototype.includes=function(r){return sn(this._value,r)},e.prototype.slice=function(r,i){var s=this.size;return Ba(r,i,s)?this:new e(this._value,Va(i,s)-yo(r,s))},e.prototype.reverse=function(){return this},e.prototype.indexOf=function(r){return sn(this._value,r)?0:-1},e.prototype.lastIndexOf=function(r){return sn(this._value,r)?this.size:-1},e.prototype.__iterate=function(r,i){for(var s=this.size,o=0;o!==s&&r(this._value,i?s-++o:o++,this)!==!1;);return o},e.prototype.__iterator=function(r,i){var s=this,o=this.size,a=0;return new Lt(function(){return a===o?zn():rn(r,i?o-++a:a++,s._value)})},e.prototype.equals=function(r){return r instanceof e?sn(this._value,r._value):$h(this,r)},e}(qr),tf;function Dt(n,e){return j0([],e||Ny,n,"",e&&e.length>2?[]:void 0,{"":n})}function j0(n,e,t,r,i,s){if(typeof t!="string"&&!Or(t)&&(dh(t)||hh(t)||Ph(t))){if(~n.indexOf(t))throw new TypeError("Cannot convert circular structure to Immutable");n.push(t),i&&r!==""&&i.push(r);var o=e.call(s,r,wn(t).map(function(a,l){return j0(n,e,a,l,i,t)}),i&&i.slice());return n.pop(),i&&i.pop(),o}return t}function Ny(n,e){return Zn(e)?e.toList():Xt(e)?e.toMap():e.toSet()}var Uy="5.1.3",Fy=Ln;const zy=Object.freeze(Object.defineProperty({__proto__:null,Collection:Ln,Iterable:Fy,List:Je,Map:qe,OrderedMap:xi,OrderedSet:Lo,PairSorting:Ly,Range:D0,Record:St,Repeat:Dy,Seq:wn,Set:il,Stack:hc,fromJS:Dt,get:Ih,getIn:Kh,has:l0,hasIn:U0,hash:or,is:sn,isAssociative:Ql,isCollection:sr,isImmutable:Or,isIndexed:Zn,isKeyed:Xt,isList:Gh,isMap:rc,isOrdered:Wr,isOrderedMap:vh,isOrderedSet:Xh,isPlainObject:Ph,isRecord:us,isSeq:ec,isSet:dc,isStack:uc,isValueObject:xh,merge:hy,mergeDeep:dy,mergeDeepWith:py,mergeWith:fy,remove:c0,removeIn:d0,set:u0,setIn:f0,update:qh,updateIn:ks,version:Uy},Symbol.toStringTag,{value:"Module"})),fn="MODE_IDLE",Hs="MODE_2D_ZOOM_IN",Gs="MODE_2D_ZOOM_OUT",Ws="MODE_2D_PAN",Bi="MODE_3D_VIEW",qo="MODE_3D_FIRST_PERSON",jr="MODE_WAITING_DRAWING_LINE",Xr="MODE_DRAGGING_LINE",$r="MODE_DRAGGING_VERTEX",Yr="MODE_DRAGGING_ITEM",Kr="MODE_DRAGGING_HOLE",_r="MODE_DRAWING_LINE",vr="MODE_DRAWING_HOLE",Dr="MODE_DRAWING_ITEM",Vi="MODE_ROTATING_ITEM",nf="MODE_UPLOADING_IMAGE",rf="MODE_FITTING_IMAGE",sf="MODE_VIEWING_CATALOG",X0="MODE_CONFIGURING_PROJECT",of=[fn,Hs,Gs,Ws,jr,_r,vr,Dr,Xr,$r,Yr,Kr,rf,nf,Vi],ky="mm",yi="cm",$0=[ky,yi,"m","in","ft","mi"],Si=1e-6,Nr={DELETE:46,BACKSPACE:8,ESC:27,Z:90,ALT:18,C:67,V:86,CTRL:17,ENTER:13,TAB:9},ar=(n,e=6)=>n&&e?parseFloat(parseFloat(n.toString()).toFixed(e)):0,Do=n=>{let e=n;return e<0&&(e=~e+1),e};function af(n,e){return n.x===e.x?n.y-e.y:n.x-e.x}function gc(n,e){return af(n,e)>0?e:n}function lf(n,e){return af(n,e)>0?n:e}function al(n){return n.sort(af)}function Bn(n,e,t,r){let i=n-t,s=e-r;return Math.sqrt(i*i+s*s)}function _c(n,e){let{x:t,y:r}=n,{x:i,y:s}=e;return Bn(t,r,i,s)}function vc(n){return{a:0,b:1,c:-n}}function xc(n){return{a:1,b:0,c:-n}}function By(n,e,t,r,i){return Do(n*r+e*i+t)/Math.sqrt(n*n+e*e)}function Vy(n,e,t,r,i){let s=n*n+e*e;return{x:(e*(e*r-n*i)-n*t)/s,y:(n*-e*r+n*i-e*t)/s}}function ll(n,e,t,r,i,s){let o=e*r-n*i;if(o===0)return;let a=(n*s-t*r)/o;return{x:(t*i-e*s)/o,y:a}}function Hy(n,e,t,r){let{x:i,y:s}=n,{x:o,y:a}=e,{x:l,y:c}=t,{x:h,y:f}=r,p=(f-c)*(o-i)-(h-l)*(a-s),d=(h-l)*(s-c)-(f-c)*(i-l),m=(o-i)*(s-c)-(a-s)*(i-l);if(Do(p)<=Si){if(Do(d)<=Si&&Do(m)<=Si){let _=(T,q)=>T.x===q.x?T.y-q.y:T.x-q.x,E=[n,e].sort(_),M=[t.toJS(),r.toJS()].sort(_),[b,S]=[E,M].sort((T,q)=>_(T[0],q[0]));return b[1].x===S[0].x?{type:S[0].y<=b[1].y?"colinear":"none"}:{type:S[0].x<=b[1].x?"colinear":"none"}}return{type:"parallel"}}let x=d/p,v=m/p;return x>=0-Si&&x<=1+Si&&v>=0-Si&&v<=1+Si?{type:"intersecting",point:{x:i+x*(o-i),y:s+x*(a-s)}}:{type:"none"}}function Y0(n,e,t,r,i,s){let o=i-n,a=s-e,l=t-n,c=r-e,h=o*l+a*c,f=l*l+c*c,p=-1;f!=0&&(p=h/f);let d,m;p<0?(d=n,m=e):p>1?(d=t,m=r):(d=n+p*l,m=e+p*c);let x=i-d,v=s-m;return Math.sqrt(x*x+v*v)}function Gy(n,e,t,r,i,s,o=Si){return Y0(n,e,t,r,i,s)<=o}function Wy(n,e,t,r,i,s){if(n===t)return{x:n,y:s};if(e===r)return{x:i,y:e};let o=(r-e)/(t-n),a=e-o*n,l=-1/o,h=(s-l*i-a)/(o-l),f=o*h+a;return{x:h,y:f}}function Vn(n,e,t,r,i,s){let o=Bn(n,e,t,r),l=Bn(n,e,i,s)/o;return n>t&&(l=jy(l,0,1,1,0)),l}function jy(n,e,t,r,i){return r+(i-r)*(n-e)/(t-e)}function Xy(n,e,t,r){return-Math.atan2(e-r,t-n)*180/Math.PI}function cf(n,e,t,r){return Math.atan2(r-e,t-n)}function $y(n,e,t,r){return Math.atan2(Math.abs(r-e),Math.abs(t-n))}function Zr({x:n,y:e},{x:t,y:r}){return Do(n-t)<=Si&&Do(e-r)<=Si}function yc(n,e,t,r,i,s=6){let o=cf(n,e,t,r);return{x:ar(n+Math.cos(o)*i,s),y:ar(e+Math.sin(o)*i,s)}}function Yy(n,e,t){let r=n.length>>1,i,s,o=n[2*r-3]-t,a=n[2*r-2]-e,l=n[2*r-1]-t;if(a===0&&l===0)return!1;for(let h=0;h<r;h++){if(i=a,o=l,a=n[2*h]-e,l=n[2*h+1]-t,a===0&&l===0)return!1;o!==l&&(s=l>o)}let c=0;for(let h=0;h<r;h++){if(i=a,o=l,a=n[2*h]-e,l=n[2*h+1]-t,o<0&&l<0||o>0&&l>0||i<0&&a<0)continue;if(o===l&&Math.min(i,a)<0)return!0;if(o===l)continue;let f=i+(a-i)*-o/(l-o);if(f===0)return!1;f>0&&c++,o===0&&s&&l>o&&c--,o===0&&!s&&l<o&&c--,s=l>o}return(c&1)===1}function Ky(n,e){let t=Math.cos(n);return t<e?0:t}function Zy(n,e){let t=Math.sin(n);return t<e?0:t}function Jy(n,e,t,r){return{x:(n+t)/2,y:(e+r)/2}}function Qy(n){let e=n.reduce((t,r)=>({x:t.x+r.x,y:t.y+r.y}),{x:0,y:0});return{x:e.x/n.length,y:e.y/n.length}}function K0(n,e,t,r,i){let s=i*Math.PI/180,o=Math.cos(s),a=Math.sin(s),l=n-t,c=e-r;return{x:o*l-a*c+t,y:a*l+o*c+r}}const uf="SNAP_POINT",hf="SNAP_LINE",ff="SNAP_SEGMENT",df="SNAP_GRID",Z0="SNAP_GUIDE",e3=qe({SNAP_POINT:!0,SNAP_LINE:!0,SNAP_SEGMENT:!0,SNAP_GRID:!1,SNAP_GUIDE:!0});class t3 extends St({type:"point",x:-1,y:-1,radius:1,priority:1,related:Je()}){nearestPoint(e,t){return{x:this.x,y:this.y,distance:Bn(this.x,this.y,e,t)}}isNear(e,t,r){return~(this.x-e)+1<r&&~(this.y-t)+1<r}}class n3 extends St({type:"line",a:-1,b:-1,c:-1,radius:1,priority:1,related:Je()}){nearestPoint(e,t){return{...Vy(this.a,this.b,this.c,e,t),distance:By(this.a,this.b,this.c,e,t)}}isNear(e,t,r){return!0}}class r3 extends St({type:"line-segment",x1:-1,y1:-1,x2:-1,y2:-1,radius:1,priority:1,related:Je()}){nearestPoint(e,t){return{...Wy(this.x1,this.y1,this.x2,this.y2,e,t),distance:Y0(this.x1,this.y1,this.x2,this.y2,e,t)}}isNear(e,t,r){return!0}}class i3 extends St({type:"grid",x:-1,y:-1,radius:1,priority:1,related:Je()}){nearestPoint(e,t){return{x:this.x,y:this.y,distance:Bn(this.x,this.y,e,t)}}isNear(e,t,r){return~(this.x-e)+1<r&&~(this.y-t)+1<r}}function Ei(n,e,t,r){let i={point:r.get(uf),line:r.get(hf),"line-segment":r.get(ff),grid:r.get(df)};return n.valueSeq().filter(s=>i[s.type]&&s.isNear(e,t,s.radius)).map(s=>({snap:s,point:s.nearestPoint(e,t)})).filter(({snap:{radius:s},point:{distance:o}})=>o<s).min(({snap:{priority:s},point:{distance:o}},{snap:{priority:a},point:{distance:l}})=>s===a?o<l?-1:1:s>a?-1:1)}function pf(n,e,t,r,i,s){return s=Je([s]),n.push(new t3({x:e,y:t,radius:r,priority:i,related:s}))}function Sc(n,e,t,r,i,s,o){return o=Je([o]),n.withMutations(a=>{if(a.some(c=>c.type==="line"&&e===c.a&&t===c.b&&r===c.c))return a;a.valueSeq().filter(c=>c.type==="line").map(c=>ll(c.a,c.b,c.c,e,t,r)).filter(c=>c!==void 0).forEach(({x:c,y:h})=>pf(a,c,h,20,40)),a.push(new n3({a:e,b:t,c:r,radius:i,priority:s,related:o}))})}function cl(n,e,t,r,i,s,o,a){return a=Je([a]),n.push(new r3({x1:e,y1:t,x2:r,y2:i,radius:s,priority:o,related:a}))}function s3(n,e,t,r,i,s){return s=Je([s]),n.push(new i3({x:e,y:t,radius:r,priority:i,related:s}))}let Hi=(n,e,t)=>n?qe(n).map(r=>new e(r)).toMap():t||qe();class mf extends St({id:"",type:"",properties:qe()},"Grid"){constructor(e={}){super({...e,properties:Dt(e.properties||{})})}}const o3=qe({h1:new mf({id:"h1",type:"horizontal-streak",properties:{step:20,colors:["#808080","#ddd","#ddd","#ddd","#ddd"]}}),v1:new mf({id:"v1",type:"vertical-streak",properties:{step:20,colors:["#808080","#ddd","#ddd","#ddd","#ddd"]}})});class J0 extends St({vertices:Je(),lines:Je(),holes:Je(),areas:Je(),items:Je()},"ElementsSet"){constructor(e={}){super({vertices:Je(e.vertices||[]),lines:Je(e.lines||[]),holes:Je(e.holes||[]),areas:Je(e.areas||[]),items:Je(e.items||[])})}}const No={id:"",type:"",prototype:"",name:"",misc:qe(),selected:!1,properties:qe(),visible:!0};let Q0=class extends St({...No,x:-1,y:-1,prototype:"vertices",lines:Je(),areas:Je()},"Vertex"){constructor(e={}){super({...e,lines:Je(e.lines||[]),areas:Je(e.areas||[])})}},eg=class extends St({...No,prototype:"lines",vertices:Je(),holes:Je()},"Line"){constructor(e={}){super({...e,properties:Dt(e.properties||{}),vertices:Je(e.vertices||[]),holes:Je(e.holes||[])})}},tg=class extends St({...No,prototype:"holes",offset:-1,line:""},"Hole"){constructor(e={}){super({...e,properties:Dt(e.properties||{})})}},ng=class extends St({...No,prototype:"areas",vertices:Je(),holes:Je()},"Area"){constructor(e={}){super({...e,properties:Dt(e.properties||{}),vertices:Je(e.vertices||[])})}},rg=class extends St({...No,prototype:"items",x:0,y:0,rotation:0},"Item"){constructor(e={}){super({...e,properties:Dt(e.properties||{})})}},gf=class extends St({id:"",altitude:0,order:0,opacity:1,name:"",visible:!0,vertices:qe(),lines:qe(),holes:qe(),areas:qe(),items:qe(),selected:new J0},"Layer"){constructor(e={}){super({...e,vertices:Hi(e.vertices,Q0),lines:Hi(e.lines,eg),holes:Hi(e.holes,tg),areas:Hi(e.areas,ng),items:Hi(e.items,rg),selected:new J0(e.selected)})}},_f=class extends St({...No,prototype:"groups",x:0,y:0,rotation:0,elements:qe()},"Group"){constructor(e={}){super({...e,properties:Dt(e.properties||{}),elements:Dt(e.elements||{})})}};const a3=qe({"layer-1":new gf({id:"layer-1",name:"default"})});let Ec=class extends St({unit:"cm",layers:qe(),grids:qe(),selectedLayer:null,groups:qe(),width:3e3,height:2e3,meta:qe(),guides:qe()},"Scene"){constructor(e={}){let t=Hi(e.layers,gf,a3);super({...e,grids:Hi(e.grids,mf,o3),layers:t,selectedLayer:t.first().id,groups:Hi(e.groups||{},_f),meta:e.meta?Dt(e.meta):qe(),guides:e.guides?Dt(e.guides):qe({horizontal:qe(),vertical:qe(),circular:qe()})})}};class l3 extends St({name:"",prototype:"",info:qe(),properties:qe()},"CatalogElement"){constructor(e={}){super({...e,info:Dt(e.info),properties:Dt(e.properties)})}}let vf=class extends St({ready:!1,page:"root",path:Je(),elements:qe()},"Catalog"){constructor(e={}){let t=Hi(e.elements,l3);super({elements:t,ready:!t.isEmpty()})}factoryElement(e,t,r){if(!this.elements.has(e)){let o=this.elements.map(a=>a.name).toArray();throw new Error(`Element ${e} does not exist in catalog ${o}`)}const i=this.elements.get(e),s=i.properties.map((o,a)=>r&&r.has(a)?r.get(a):o.get("defaultValue"));switch(i.prototype){case"lines":return new eg(t).merge({properties:s});case"holes":return new tg(t).merge({properties:s});case"areas":return new ng(t).merge({properties:s});case"items":return new rg(t).merge({properties:s});default:throw new Error("prototype not valid")}}};class ig extends St({list:Je(),first:null,last:null,redoList:Je()},"HistoryStructure"){constructor(e={}){super({list:Dt(e.list||[]),first:new Ec(e.scene),last:new Ec(e.last||e.scene)})}}let bc=class extends St({mode:fn,scene:new Ec,sceneHistory:new ig,catalog:new vf,viewer2D:qe(),mouse:qe({x:0,y:0}),zoom:0,snapMask:e3,snapElements:Je(),activeSnapElement:null,drawingSupport:qe(),draggingSupport:qe(),rotatingSupport:qe(),errors:Je(),warnings:Je(),clipboardProperties:qe(),selectedElementsHistory:Je(),misc:qe(),alterate:!1},"State"){constructor(e={}){super({...e,scene:new Ec(e.scene),sceneHistory:new ig(e),catalog:new vf(e.catalog||{}),viewer2D:qe(e.viewer2D||{}),drawingSupport:qe(e.drawingSupport||{}),draggingSupport:qe(e.draggingSupport||{}),rotatingSupport:qe(e.rotatingSupport||{}),misc:e.misc?Dt(e.misc):qe()})}};function Mc(n){let e=[];for(let t=0;t<n;++t)e.push([]);return e}class sg{constructor(e,t){vt(this,"u");vt(this,"v");this.u=e,this.v=t}}class c3{constructor(e){vt(this,"count");vt(this,"subgraphs");vt(this,"time");vt(this,"V");vt(this,"E");vt(this,"adj");vt(this,"children");this.count=0,this.subgraphs=[],this.time=0,this.children=0,this.V=e,this.E=0,this.adj=[],this.adj=Mc(e)}addEdge(e,t){this.adj[e].push(t),this.E++}_BCCUtil(e,t,r,i,s){t[e]=r[e]=++this.time,this.children=0,this.adj[e].forEach(o=>{if(t[o]==-1){if(this.children++,s[o]=e,i.push(new sg(e,o)),this._BCCUtil(o,t,r,i,s),r[e]>r[o]&&(r[e]=r[o]),t[e]==1&&this.children>1||t[e]>1&&r[o]>=t[e]){let a=[];for(;i[i.length-1].u!=e||i[i.length-1].v!=o;)a.push(i[i.length-1]),i.splice(i.length-1,1);a.push(i[i.length-1]),this.subgraphs.push(a),a=[],i.splice(i.length-1,1),this.count++}}else o!=s[e]&&t[o]<r[e]&&(r[e]>t[o]&&(r[e]=t[o]),i.push(new sg(e,o)))})}BCC(){let e=this.V,t=Mc(e),r=Mc(e),i=Mc(e),s=[];for(let o=0;o<e;o++)t[o]=-1,r[o]=-1,i[o]=-1;for(let o=0;o<e;o++){t[o]==-1&&this._BCCUtil(o,t,r,s,i);let a=0,l=[];for(;s.length>0;)a=1,l.push(s[s.length-1]),s.splice(s.length-1,1);a==1&&(this.subgraphs.push(l),l=[],this.count++)}}}const u3=(n,e)=>{let t=[];return n.forEach(r=>{t.push([]);let i=h3(r);i.forEach(s=>{e.adj[s].forEach(a=>{s<=a&&i.has(a)&&t[t.length-1].push([s,a])})})}),t},h3=n=>{let e=new Set;return n.forEach(t=>{e.add(t.u),e.add(t.v)}),e};function f3(n,e){return[n[0]-e[0],n[1]-e[1]]}function og(n,e){return(n%e+e)%e}function d3(n){return n.map(function(t){return{ev:t,color:0,direction:-1}})}function p3(n,e){let t=f3(e,n);return Math.atan2(t[1],t[0])}function m3(n,e){return n.map(function(t,r){let i=[];return e.forEach(function(s,o){let a,l;s[0]===r&&(a=s[1],l=1),s[1]===r&&(a=s[0],l=0),a!==void 0&&i.push({index:o,endpoint:a,angle:p3(t,n[a]),edge:s,position:l})}),i.sort(function(s,o){return o.angle-s.angle}),i})}function ag(n,e){let t,r;for(t=0;t<e.length;t+=1)if(e[t].color<2)return r=-1*e[t].direction,cg(e,t,r),{edge:t,direction:r,position:r===-1?0:1}}function lg(n,e,t,r){let i=n[r[e][t]],s=i.length,o,a,l;for(l=0;l<s;l+=1)if(o=i[l],o.index===e)return a=i[og(l+1,i.length)],{edge:a.index,vertex:a.endpoint,position:a.position,direction:a.position?1:-1}}function cg(n,e,t){n[e].color+=1,n[e].direction=t}function g3(n,e){let t=d3(e),r=m3(n,e),i=[],s=[],o=[],a,l,c,h,f=ag(r,t);for(;f!==void 0;){for(a=[e[f.edge][og(f.position+1,2)],e[f.edge][f.position]],l=[f.edge],c=[f.direction],h=lg(r,f.edge,f.position,e);h.edge!==f.edge;)a.push(h.vertex),l.push(h.edge),c.push(h.direction),cg(t,h.edge,h.direction),h=lg(r,h.edge,h.position,e);s.push(l),i.push(a),o.push(c),f=ag(r,t)}return{v_cycles:i,e_cycles:s,dir_e_cycles:o,ev_mapping:t}}function _3(n,e){let t=[],r,i,s;for(s=0;s<e.length;s+=1)r=e[s],i=n[s],(r.length<3||i[0]!==i[i.length-1])&&t.push(s);return t}function v3(n,e){let t=g3(n,e),r=t.v_cycles,i=t.e_cycles;_3(r,i).forEach(p=>{r.splice(p,1),i.splice(p,1)});let o=t.dir_e_cycles,l=t.e_cycles.map((p,d)=>p.map(function(m,x){let v,_;return o[d][x]>0?(v=e[m][0],_=e[m][1]):(v=e[m][1],_=e[m][0]),(n[_][0]-n[v][0])*(n[_][1]+n[v][1])})).map(p=>p.reduce((d,m)=>d+m)),c=l.filter(p=>p>0).length,h=l.length-c,f=c>=h?1:-1;return{v_cycles:t.v_cycles.filter((p,d)=>f*l[d]>0),e_cycles:t.e_cycles.filter((p,d)=>f*l[d]>0),ev_mapping:t.ev_mapping}}function x3(n,e){let t=Je();const r=new c3(n.length);e.forEach(([l,c])=>{r.addEdge(l,c),r.addEdge(c,l)}),r.BCC();const i=r.subgraphs.filter(l=>l.length>=3),s=u3(i,r),o=[];return s.forEach(l=>{l.forEach(c=>o.push(c))}),v3(n,o).v_cycles.forEach(l=>{l.shift(),t=t.push(l)}),t}function y3(n){let e=0,t=0,r=n.size;for(e=0;e<r;e++){let{x:i,y:s}=n.get(e)||{x:0,y:0},{x:o,y:a}=n.get((e+1)%r)||{x:0,y:0};t+=(o-i)*(a+s)}return t>0}function xf(n,e=Je(),t=qe()){let{width:r,height:i}=n,s,o,a;return e.withMutations(l=>{if(n.layers.forEach(c=>{let{lines:h,vertices:f}=c;f.forEach(({id:p,x:d,y:m})=>{t.get(uf)&&pf(l,d,m,10,10,p),t.get(hf)&&({a:s,b:o,c:a}=vc(m),Sc(l,s,o,a,10,1,p),{a:s,b:o,c:a}=xc(d),Sc(l,s,o,a,10,1,p))}),t.get(ff)&&h.forEach(({id:p,vertices:[d,m]})=>{let{x,y:v}=f.get(d),{x:_,y:E}=f.get(m);cl(l,x,v,_,E,20,1,p)})}),t.get(df)){let c=5,h=100/c,f=r/h,p=i/h;for(let d=0;d<f;d++){let m=d*h;for(let x=0;x<p;x++){let v=x*h,_=!(d%c),E=!(x%c);s3(l,m,v,10,_&&E?15:10,null)}}}if(t.get(Z0)){let c=n.getIn(["guides","horizontal"]),h=n.getIn(["guides","vertical"]),f=c.valueSeq(),p=h.valueSeq();f.forEach(d=>{p.forEach(m=>{pf(l,m,d,10,10)})}),f.forEach(d=>cl(l,0,d,r,d,20,1)),p.forEach(d=>cl(l,d,0,d,i,20,1))}})}var wc={exports:{}},S3=wc.exports,ug;function yf(){return ug||(ug=1,function(n,e){(function(t,r){n.exports=r()})(S3,function(){var t=Array.prototype.slice;function r(u,g){g&&(u.prototype=Object.create(g.prototype)),u.prototype.constructor=u}function i(u){return l(u)?u:F(u)}r(s,i);function s(u){return c(u)?u:lt(u)}r(o,i);function o(u){return h(u)?u:Le(u)}r(a,i);function a(u){return l(u)&&!f(u)?u:Ge(u)}function l(u){return!!(u&&u[d])}function c(u){return!!(u&&u[m])}function h(u){return!!(u&&u[x])}function f(u){return c(u)||h(u)}function p(u){return!!(u&&u[v])}i.isIterable=l,i.isKeyed=c,i.isIndexed=h,i.isAssociative=f,i.isOrdered=p,i.Keyed=s,i.Indexed=o,i.Set=a;var d="@@__IMMUTABLE_ITERABLE__@@",m="@@__IMMUTABLE_KEYED__@@",x="@@__IMMUTABLE_INDEXED__@@",v="@@__IMMUTABLE_ORDERED__@@",_="delete",E=5,M=1<<E,b=M-1,S={},T={value:!1},q={value:!1};function O(u){return u.value=!1,u}function A(u){u&&(u.value=!0)}function L(){}function N(u,g){g=g||0;for(var y=Math.max(0,u.length-g),w=new Array(y),R=0;R<y;R++)w[R]=u[R+g];return w}function Z(u){return u.size===void 0&&(u.size=u.__iterate(ee)),u.size}function Y(u,g){if(typeof g!="number"){var y=g>>>0;if(""+y!==g||y===4294967295)return NaN;g=y}return g<0?Z(u)+g:g}function ee(){return!0}function ue(u,g,y){return(u===0||y!==void 0&&u<=-y)&&(g===void 0||y!==void 0&&g>=y)}function te(u,g){return B(u,g,0)}function ae(u,g){return B(u,g,g)}function B(u,g,y){return u===void 0?y:u<0?Math.max(0,g+u):g===void 0?u:Math.min(g,u)}var Se=0,$=1,oe=2,Ae=typeof Symbol=="function"&&Symbol.iterator,Ie="@@iterator",Ce=Ae||Ie;function V(u){this.next=u}V.prototype.toString=function(){return"[Iterator]"},V.KEYS=Se,V.VALUES=$,V.ENTRIES=oe,V.prototype.inspect=V.prototype.toSource=function(){return this.toString()},V.prototype[Ce]=function(){return this};function ne(u,g,y,w){var R=u===0?g:u===1?y:[g,y];return w?w.value=R:w={value:R,done:!1},w}function X(){return{value:void 0,done:!0}}function pe(u){return!!Ne(u)}function Ee(u){return u&&typeof u.next=="function"}function Q(u){var g=Ne(u);return g&&g.call(u)}function Ne(u){var g=u&&(Ae&&u[Ae]||u[Ie]);if(typeof g=="function")return g}function le(u){return u&&typeof u.length=="number"}r(F,i);function F(u){return u==null?I():l(u)?u.toSeq():be(u)}F.of=function(){return F(arguments)},F.prototype.toSeq=function(){return this},F.prototype.toString=function(){return this.__toString("Seq {","}")},F.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},F.prototype.__iterate=function(u,g){return Fe(this,u,g,!0)},F.prototype.__iterator=function(u,g){return Te(this,u,g,!0)},r(lt,F);function lt(u){return u==null?I().toKeyedSeq():l(u)?c(u)?u.toSeq():u.fromEntrySeq():J(u)}lt.prototype.toKeyedSeq=function(){return this},r(Le,F);function Le(u){return u==null?I():l(u)?c(u)?u.entrySeq():u.toIndexedSeq():de(u)}Le.of=function(){return Le(arguments)},Le.prototype.toIndexedSeq=function(){return this},Le.prototype.toString=function(){return this.__toString("Seq [","]")},Le.prototype.__iterate=function(u,g){return Fe(this,u,g,!1)},Le.prototype.__iterator=function(u,g){return Te(this,u,g,!1)},r(Ge,F);function Ge(u){return(u==null?I():l(u)?c(u)?u.entrySeq():u:de(u)).toSetSeq()}Ge.of=function(){return Ge(arguments)},Ge.prototype.toSetSeq=function(){return this},F.isSeq=wt,F.Keyed=lt,F.Set=Ge,F.Indexed=Le;var De="@@__IMMUTABLE_SEQ__@@";F.prototype[De]=!0,r(Ue,Le);function Ue(u){this._array=u,this.size=u.length}Ue.prototype.get=function(u,g){return this.has(u)?this._array[Y(this,u)]:g},Ue.prototype.__iterate=function(u,g){for(var y=this._array,w=y.length-1,R=0;R<=w;R++)if(u(y[g?w-R:R],R,this)===!1)return R+1;return R},Ue.prototype.__iterator=function(u,g){var y=this._array,w=y.length-1,R=0;return new V(function(){return R>w?X():ne(u,R,y[g?w-R++:R++])})},r(ge,lt);function ge(u){var g=Object.keys(u);this._object=u,this._keys=g,this.size=g.length}ge.prototype.get=function(u,g){return g!==void 0&&!this.has(u)?g:this._object[u]},ge.prototype.has=function(u){return this._object.hasOwnProperty(u)},ge.prototype.__iterate=function(u,g){for(var y=this._object,w=this._keys,R=w.length-1,D=0;D<=R;D++){var z=w[g?R-D:D];if(u(y[z],z,this)===!1)return D+1}return D},ge.prototype.__iterator=function(u,g){var y=this._object,w=this._keys,R=w.length-1,D=0;return new V(function(){var z=w[g?R-D:D];return D++>R?X():ne(u,z,y[z])})},ge.prototype[v]=!0,r($e,Le);function $e(u){this._iterable=u,this.size=u.length||u.size}$e.prototype.__iterateUncached=function(u,g){if(g)return this.cacheResult().__iterate(u,g);var y=this._iterable,w=Q(y),R=0;if(Ee(w))for(var D;!(D=w.next()).done&&u(D.value,R++,this)!==!1;);return R},$e.prototype.__iteratorUncached=function(u,g){if(g)return this.cacheResult().__iterator(u,g);var y=this._iterable,w=Q(y);if(!Ee(w))return new V(X);var R=0;return new V(function(){var D=w.next();return D.done?D:ne(u,R++,D.value)})},r(ot,Le);function ot(u){this._iterator=u,this._iteratorCache=[]}ot.prototype.__iterateUncached=function(u,g){if(g)return this.cacheResult().__iterate(u,g);for(var y=this._iterator,w=this._iteratorCache,R=0;R<w.length;)if(u(w[R],R++,this)===!1)return R;for(var D;!(D=y.next()).done;){var z=D.value;if(w[R]=z,u(z,R++,this)===!1)break}return R},ot.prototype.__iteratorUncached=function(u,g){if(g)return this.cacheResult().__iterator(u,g);var y=this._iterator,w=this._iteratorCache,R=0;return new V(function(){if(R>=w.length){var D=y.next();if(D.done)return D;w[R]=D.value}return ne(u,R,w[R++])})};function wt(u){return!!(u&&u[De])}var U;function I(){return U||(U=new Ue([]))}function J(u){var g=Array.isArray(u)?new Ue(u).fromEntrySeq():Ee(u)?new ot(u).fromEntrySeq():pe(u)?new $e(u).fromEntrySeq():typeof u=="object"?new ge(u):void 0;if(!g)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+u);return g}function de(u){var g=fe(u);if(!g)throw new TypeError("Expected Array or iterable object of values: "+u);return g}function be(u){var g=fe(u)||typeof u=="object"&&new ge(u);if(!g)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+u);return g}function fe(u){return le(u)?new Ue(u):Ee(u)?new ot(u):pe(u)?new $e(u):void 0}function Fe(u,g,y,w){var R=u._cache;if(R){for(var D=R.length-1,z=0;z<=D;z++){var K=R[y?D-z:z];if(g(K[1],w?K[0]:z,u)===!1)return z+1}return z}return u.__iterateUncached(g,y)}function Te(u,g,y,w){var R=u._cache;if(R){var D=R.length-1,z=0;return new V(function(){var K=R[y?D-z:z];return z++>D?X():ne(g,w?K[0]:z-1,K[1])})}return u.__iteratorUncached(g,y)}function Ye(u,g){return g?Ke(g,u,"",{"":u}):Re(u)}function Ke(u,g,y,w){return Array.isArray(g)?u.call(w,y,Le(g).map(function(R,D){return Ke(u,R,D,g)})):ze(g)?u.call(w,y,lt(g).map(function(R,D){return Ke(u,R,D,g)})):g}function Re(u){return Array.isArray(u)?Le(u).map(Re).toList():ze(u)?lt(u).map(Re).toMap():u}function ze(u){return u&&(u.constructor===Object||u.constructor===void 0)}function We(u,g){if(u===g||u!==u&&g!==g)return!0;if(!u||!g)return!1;if(typeof u.valueOf=="function"&&typeof g.valueOf=="function"){if(u=u.valueOf(),g=g.valueOf(),u===g||u!==u&&g!==g)return!0;if(!u||!g)return!1}return!!(typeof u.equals=="function"&&typeof g.equals=="function"&&u.equals(g))}function tt(u,g){if(u===g)return!0;if(!l(g)||u.size!==void 0&&g.size!==void 0&&u.size!==g.size||u.__hash!==void 0&&g.__hash!==void 0&&u.__hash!==g.__hash||c(u)!==c(g)||h(u)!==h(g)||p(u)!==p(g))return!1;if(u.size===0&&g.size===0)return!0;var y=!f(u);if(p(u)){var w=u.entries();return g.every(function(ce,he){var ve=w.next().value;return ve&&We(ve[1],ce)&&(y||We(ve[0],he))})&&w.next().done}var R=!1;if(u.size===void 0)if(g.size===void 0)typeof u.cacheResult=="function"&&u.cacheResult();else{R=!0;var D=u;u=g,g=D}var z=!0,K=g.__iterate(function(ce,he){if(y?!u.has(ce):R?!We(ce,u.get(he,S)):!We(u.get(he,S),ce))return z=!1,!1});return z&&u.size===K}r(Pe,Le);function Pe(u,g){if(!(this instanceof Pe))return new Pe(u,g);if(this._value=u,this.size=g===void 0?1/0:Math.max(0,g),this.size===0){if(gt)return gt;gt=this}}Pe.prototype.toString=function(){return this.size===0?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},Pe.prototype.get=function(u,g){return this.has(u)?this._value:g},Pe.prototype.includes=function(u){return We(this._value,u)},Pe.prototype.slice=function(u,g){var y=this.size;return ue(u,g,y)?this:new Pe(this._value,ae(g,y)-te(u,y))},Pe.prototype.reverse=function(){return this},Pe.prototype.indexOf=function(u){return We(this._value,u)?0:-1},Pe.prototype.lastIndexOf=function(u){return We(this._value,u)?this.size:-1},Pe.prototype.__iterate=function(u,g){for(var y=0;y<this.size;y++)if(u(this._value,y,this)===!1)return y+1;return y},Pe.prototype.__iterator=function(u,g){var y=this,w=0;return new V(function(){return w<y.size?ne(u,w++,y._value):X()})},Pe.prototype.equals=function(u){return u instanceof Pe?We(this._value,u._value):tt(u)};var gt;function H(u,g){if(!u)throw new Error(g)}r(_e,Le);function _e(u,g,y){if(!(this instanceof _e))return new _e(u,g,y);if(H(y!==0,"Cannot step a Range by 0"),u=u||0,g===void 0&&(g=1/0),y=y===void 0?1:Math.abs(y),g<u&&(y=-y),this._start=u,this._end=g,this._step=y,this.size=Math.max(0,Math.ceil((g-u)/y-1)+1),this.size===0){if(Oe)return Oe;Oe=this}}_e.prototype.toString=function(){return this.size===0?"Range []":"Range [ "+this._start+"..."+this._end+(this._step!==1?" by "+this._step:"")+" ]"},_e.prototype.get=function(u,g){return this.has(u)?this._start+Y(this,u)*this._step:g},_e.prototype.includes=function(u){var g=(u-this._start)/this._step;return g>=0&&g<this.size&&g===Math.floor(g)},_e.prototype.slice=function(u,g){return ue(u,g,this.size)?this:(u=te(u,this.size),g=ae(g,this.size),g<=u?new _e(0,0):new _e(this.get(u,this._end),this.get(g,this._end),this._step))},_e.prototype.indexOf=function(u){var g=u-this._start;if(g%this._step===0){var y=g/this._step;if(y>=0&&y<this.size)return y}return-1},_e.prototype.lastIndexOf=function(u){return this.indexOf(u)},_e.prototype.__iterate=function(u,g){for(var y=this.size-1,w=this._step,R=g?this._start+y*w:this._start,D=0;D<=y;D++){if(u(R,D,this)===!1)return D+1;R+=g?-w:w}return D},_e.prototype.__iterator=function(u,g){var y=this.size-1,w=this._step,R=g?this._start+y*w:this._start,D=0;return new V(function(){var z=R;return R+=g?-w:w,D>y?X():ne(u,D++,z)})},_e.prototype.equals=function(u){return u instanceof _e?this._start===u._start&&this._end===u._end&&this._step===u._step:tt(this,u)};var Oe;r(Ve,i);function Ve(){throw TypeError("Abstract")}r(we,Ve);function we(){}r(me,Ve);function me(){}r(Qe,Ve);function Qe(){}Ve.Keyed=we,Ve.Indexed=me,Ve.Set=Qe;var ft=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(g,y){g=g|0,y=y|0;var w=g&65535,R=y&65535;return w*R+((g>>>16)*R+w*(y>>>16)<<16>>>0)|0};function Ot(u){return u>>>1&1073741824|u&3221225471}function _t(u){if(u===!1||u===null||u===void 0||typeof u.valueOf=="function"&&(u=u.valueOf(),u===!1||u===null||u===void 0))return 0;if(u===!0)return 1;var g=typeof u;if(g==="number"){if(u!==u||u===1/0)return 0;var y=u|0;for(y!==u&&(y^=u*4294967295);u>4294967295;)u/=4294967295,y^=u;return Ot(y)}if(g==="string")return u.length>je?Ar(u):jn(u);if(typeof u.hashCode=="function")return u.hashCode();if(g==="object")return vo(u);if(typeof u.toString=="function")return jn(u.toString());throw new Error("Value type "+g+" cannot be hashed.")}function Ar(u){var g=qt[u];return g===void 0&&(g=jn(u),Pt===dt&&(Pt=0,qt={}),Pt++,qt[u]=g),g}function jn(u){for(var g=0,y=0;y<u.length;y++)g=31*g+u.charCodeAt(y)|0;return Ot(g)}function vo(u){var g;if(qs&&(g=Di.get(u),g!==void 0)||(g=u[ye],g!==void 0)||!Os&&(g=u.propertyIsEnumerable&&u.propertyIsEnumerable[ye],g!==void 0||(g=Ia(u),g!==void 0)))return g;if(g=++k,k&1073741824&&(k=0),qs)Di.set(u,g);else{if(Cr!==void 0&&Cr(u)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(Os)Object.defineProperty(u,ye,{enumerable:!1,configurable:!1,writable:!1,value:g});else if(u.propertyIsEnumerable!==void 0&&u.propertyIsEnumerable===u.constructor.prototype.propertyIsEnumerable)u.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},u.propertyIsEnumerable[ye]=g;else if(u.nodeType!==void 0)u[ye]=g;else throw new Error("Unable to set a non-enumerable property on object.")}return g}var Cr=Object.isExtensible,Os=function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}}();function Ia(u){if(u&&u.nodeType>0)switch(u.nodeType){case 1:return u.uniqueID;case 9:return u.documentElement&&u.documentElement.uniqueID}}var qs=typeof WeakMap=="function",Di;qs&&(Di=new WeakMap);var k=0,ye="__immutablehash__";typeof Symbol=="function"&&(ye=Symbol(ye));var je=16,dt=255,Pt=0,qt={};function pt(u){H(u!==1/0,"Cannot perform this action with an infinite size.")}r(Xe,we);function Xe(u){return u==null?rt():vn(u)&&!p(u)?u:rt().withMutations(function(g){var y=s(u);pt(y.size),y.forEach(function(w,R){return g.set(R,w)})})}Xe.of=function(){var u=t.call(arguments,0);return rt().withMutations(function(g){for(var y=0;y<u.length;y+=2){if(y+1>=u.length)throw new Error("Missing value for key: "+u[y]);g.set(u[y],u[y+1])}})},Xe.prototype.toString=function(){return this.__toString("Map {","}")},Xe.prototype.get=function(u,g){return this._root?this._root.get(0,void 0,u,g):g},Xe.prototype.set=function(u,g){return Tt(this,u,g)},Xe.prototype.setIn=function(u,g){return this.updateIn(u,S,function(){return g})},Xe.prototype.remove=function(u){return Tt(this,u,S)},Xe.prototype.deleteIn=function(u){return this.updateIn(u,function(){return S})},Xe.prototype.update=function(u,g,y){return arguments.length===1?u(this):this.updateIn([u],g,y)},Xe.prototype.updateIn=function(u,g,y){y||(y=g,g=void 0);var w=Ds(this,y2(u),g,y);return w===S?void 0:w},Xe.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):rt()},Xe.prototype.merge=function(){return Rt(this,void 0,arguments)},Xe.prototype.mergeWith=function(u){var g=t.call(arguments,1);return Rt(this,u,g)},Xe.prototype.mergeIn=function(u){var g=t.call(arguments,1);return this.updateIn(u,rt(),function(y){return typeof y.merge=="function"?y.merge.apply(y,g):g[g.length-1]})},Xe.prototype.mergeDeep=function(){return Rt(this,Xn,arguments)},Xe.prototype.mergeDeepWith=function(u){var g=t.call(arguments,1);return Rt(this,as(u),g)},Xe.prototype.mergeDeepIn=function(u){var g=t.call(arguments,1);return this.updateIn(u,rt(),function(y){return typeof y.mergeDeep=="function"?y.mergeDeep.apply(y,g):g[g.length-1]})},Xe.prototype.sort=function(u){return xn(Na(this,u))},Xe.prototype.sortBy=function(u,g){return xn(Na(this,g,u))},Xe.prototype.withMutations=function(u){var g=this.asMutable();return u(g),g.wasAltered()?g.__ensureOwner(this.__ownerID):this},Xe.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new L)},Xe.prototype.asImmutable=function(){return this.__ensureOwner()},Xe.prototype.wasAltered=function(){return this.__altered},Xe.prototype.__iterator=function(u,g){return new ke(this,u,g)},Xe.prototype.__iterate=function(u,g){var y=this,w=0;return this._root&&this._root.iterate(function(R){return w++,u(R[1],R[0],y)},g),w},Xe.prototype.__ensureOwner=function(u){return u===this.__ownerID?this:u?ct(this.size,this._root,u,this.__hash):(this.__ownerID=u,this.__altered=!1,this)};function vn(u){return!!(u&&u[tn])}Xe.isMap=vn;var tn="@@__IMMUTABLE_MAP__@@",P=Xe.prototype;P[tn]=!0,P[_]=P.remove,P.removeIn=P.deleteIn;function G(u,g){this.ownerID=u,this.entries=g}G.prototype.get=function(u,g,y,w){for(var R=this.entries,D=0,z=R.length;D<z;D++)if(We(y,R[D][0]))return R[D][1];return w},G.prototype.update=function(u,g,y,w,R,D,z){for(var K=R===S,ce=this.entries,he=0,ve=ce.length;he<ve&&!We(w,ce[he][0]);he++);var Ze=he<ve;if(Ze?ce[he][1]===R:K)return this;if(A(z),(K||!Ze)&&A(D),!(K&&ce.length===1)){if(!Ze&&!K&&ce.length>=Yn)return Vt(u,ce,w,R);var at=u&&u===this.ownerID,xt=at?ce:N(ce);return Ze?K?he===ve-1?xt.pop():xt[he]=xt.pop():xt[he]=[w,R]:xt.push([w,R]),at?(this.entries=xt,this):new G(u,xt)}};function re(u,g,y){this.ownerID=u,this.bitmap=g,this.nodes=y}re.prototype.get=function(u,g,y,w){g===void 0&&(g=_t(y));var R=1<<((u===0?g:g>>>u)&b),D=this.bitmap;return(D&R)===0?w:this.nodes[nn(D&R-1)].get(u+E,g,y,w)},re.prototype.update=function(u,g,y,w,R,D,z){y===void 0&&(y=_t(w));var K=(g===0?y:y>>>g)&b,ce=1<<K,he=this.bitmap,ve=(he&ce)!==0;if(!ve&&R===S)return this;var Ze=nn(he&ce-1),at=this.nodes,xt=ve?at[Ze]:void 0,At=Ut(xt,u,g+E,y,w,R,D,z);if(At===xt)return this;if(!ve&&At&&at.length>=Wl)return ln(u,at,he,K,At);if(ve&&!At&&at.length===2&&an(at[Ze^1]))return at[Ze^1];if(ve&&At&&at.length===1&&an(At))return At;var hn=u&&u===this.ownerID,pi=ve?At?he:he^ce:he|ce,zi=ve?At?nr(at,Ze,At,hn):Un(at,Ze,hn):fr(at,Ze,At,hn);return hn?(this.bitmap=pi,this.nodes=zi,this):new re(u,pi,zi)};function ie(u,g,y){this.ownerID=u,this.count=g,this.nodes=y}ie.prototype.get=function(u,g,y,w){g===void 0&&(g=_t(y));var R=(u===0?g:g>>>u)&b,D=this.nodes[R];return D?D.get(u+E,g,y,w):w},ie.prototype.update=function(u,g,y,w,R,D,z){y===void 0&&(y=_t(w));var K=(g===0?y:y>>>g)&b,ce=R===S,he=this.nodes,ve=he[K];if(ce&&!ve)return this;var Ze=Ut(ve,u,g+E,y,w,R,D,z);if(Ze===ve)return this;var at=this.count;if(!ve)at++;else if(!Ze&&(at--,at<ls))return ut(u,he,at,K);var xt=u&&u===this.ownerID,At=nr(he,K,Ze,xt);return xt?(this.count=at,this.nodes=At,this):new ie(u,at,At)};function W(u,g,y){this.ownerID=u,this.keyHash=g,this.entries=y}W.prototype.get=function(u,g,y,w){for(var R=this.entries,D=0,z=R.length;D<z;D++)if(We(y,R[D][0]))return R[D][1];return w},W.prototype.update=function(u,g,y,w,R,D,z){y===void 0&&(y=_t(w));var K=R===S;if(y!==this.keyHash)return K?this:(A(z),A(D),Bt(this,u,g,y,[w,R]));for(var ce=this.entries,he=0,ve=ce.length;he<ve&&!We(w,ce[he][0]);he++);var Ze=he<ve;if(Ze?ce[he][1]===R:K)return this;if(A(z),(K||!Ze)&&A(D),K&&ve===2)return new Me(u,this.keyHash,ce[he^1]);var at=u&&u===this.ownerID,xt=at?ce:N(ce);return Ze?K?he===ve-1?xt.pop():xt[he]=xt.pop():xt[he]=[w,R]:xt.push([w,R]),at?(this.entries=xt,this):new W(u,this.keyHash,xt)};function Me(u,g,y){this.ownerID=u,this.keyHash=g,this.entry=y}Me.prototype.get=function(u,g,y,w){return We(y,this.entry[0])?this.entry[1]:w},Me.prototype.update=function(u,g,y,w,R,D,z){var K=R===S,ce=We(w,this.entry[0]);if(ce?R===this.entry[1]:K)return this;if(A(z),K){A(D);return}return ce?u&&u===this.ownerID?(this.entry[1]=R,this):new Me(u,this.keyHash,[w,R]):(A(D),Bt(this,u,g,_t(w),[w,R]))},G.prototype.iterate=W.prototype.iterate=function(u,g){for(var y=this.entries,w=0,R=y.length-1;w<=R;w++)if(u(y[g?R-w:w])===!1)return!1},re.prototype.iterate=ie.prototype.iterate=function(u,g){for(var y=this.nodes,w=0,R=y.length-1;w<=R;w++){var D=y[g?R-w:w];if(D&&D.iterate(u,g)===!1)return!1}},Me.prototype.iterate=function(u,g){return u(this.entry)},r(ke,V);function ke(u,g,y){this._type=g,this._reverse=y,this._stack=u._root&&et(u._root)}ke.prototype.next=function(){for(var u=this._type,g=this._stack;g;){var y=g.node,w=g.index++,R;if(y.entry){if(w===0)return nt(u,y.entry)}else if(y.entries){if(R=y.entries.length-1,w<=R)return nt(u,y.entries[this._reverse?R-w:w])}else if(R=y.nodes.length-1,w<=R){var D=y.nodes[this._reverse?R-w:w];if(D){if(D.entry)return nt(u,D.entry);g=this._stack=et(D,g)}continue}g=this._stack=this._stack.__prev}return X()};function nt(u,g){return ne(u,g[0],g[1])}function et(u,g){return{node:u,index:0,__prev:g}}function ct(u,g,y,w){var R=Object.create(P);return R.size=u,R._root=g,R.__ownerID=y,R.__hash=w,R.__altered=!1,R}var mt;function rt(){return mt||(mt=ct(0))}function Tt(u,g,y){var w,R;if(u._root){var D=O(T),z=O(q);if(w=Ut(u._root,u.__ownerID,0,void 0,g,y,D,z),!z.value)return u;R=u.size+(D.value?y===S?-1:1:0)}else{if(y===S)return u;R=1,w=new G(u.__ownerID,[[g,y]])}return u.__ownerID?(u.size=R,u._root=w,u.__hash=void 0,u.__altered=!0,u):w?ct(R,w):rt()}function Ut(u,g,y,w,R,D,z,K){return u?u.update(g,y,w,R,D,z,K):D===S?u:(A(K),A(z),new Me(g,w,[R,D]))}function an(u){return u.constructor===Me||u.constructor===W}function Bt(u,g,y,w,R){if(u.keyHash===w)return new W(g,w,[u.entry,R]);var D=(y===0?u.keyHash:u.keyHash>>>y)&b,z=(y===0?w:w>>>y)&b,K,ce=D===z?[Bt(u,g,y+E,w,R)]:(K=new Me(g,w,R),D<z?[u,K]:[K,u]);return new re(g,1<<D|1<<z,ce)}function Vt(u,g,y,w){u||(u=new L);for(var R=new Me(u,_t(y),[y,w]),D=0;D<g.length;D++){var z=g[D];R=R.update(u,0,void 0,z[0],z[1])}return R}function ut(u,g,y,w){for(var R=0,D=0,z=new Array(y),K=0,ce=1,he=g.length;K<he;K++,ce<<=1){var ve=g[K];ve!==void 0&&K!==w&&(R|=ce,z[D++]=ve)}return new re(u,R,z)}function ln(u,g,y,w,R){for(var D=0,z=new Array(M),K=0;y!==0;K++,y>>>=1)z[K]=y&1?g[D++]:void 0;return z[w]=R,new ie(u,D+1,z)}function Rt(u,g,y){for(var w=[],R=0;R<y.length;R++){var D=y[R],z=s(D);l(D)||(z=z.map(function(K){return Ye(K)})),w.push(z)}return $n(u,g,w)}function Xn(u,g,y){return u&&u.mergeDeep&&l(g)?u.mergeDeep(g):We(u,g)?u:g}function as(u){return function(g,y,w){if(g&&g.mergeDeepWith&&l(y))return g.mergeDeepWith(u,y);var R=u(g,y,w);return We(g,R)?g:R}}function $n(u,g,y){return y=y.filter(function(w){return w.size!==0}),y.length===0?u:u.size===0&&!u.__ownerID&&y.length===1?u.constructor(y[0]):u.withMutations(function(w){for(var R=g?function(z,K){w.update(K,S,function(ce){return ce===S?z:g(ce,z,K)})}:function(z,K){w.set(K,z)},D=0;D<y.length;D++)y[D].forEach(R)})}function Ds(u,g,y,w){var R=u===S,D=g.next();if(D.done){var z=R?y:u,K=w(z);return K===z?u:K}H(R||u&&u.set,"invalid keyPath");var ce=D.value,he=R?S:u.get(ce,S),ve=Ds(he,g,y,w);return ve===he?u:ve===S?u.remove(ce):(R?rt():u).set(ce,ve)}function nn(u){return u=u-(u>>1&1431655765),u=(u&858993459)+(u>>2&858993459),u=u+(u>>4)&252645135,u=u+(u>>8),u=u+(u>>16),u&127}function nr(u,g,y,w){var R=w?u:N(u);return R[g]=y,R}function fr(u,g,y,w){var R=u.length+1;if(w&&g+1===R)return u[g]=y,u;for(var D=new Array(R),z=0,K=0;K<R;K++)K===g?(D[K]=y,z=-1):D[K]=u[K+z];return D}function Un(u,g,y){var w=u.length-1;if(y&&g===w)return u.pop(),u;for(var R=new Array(w),D=0,z=0;z<w;z++)z===g&&(D=1),R[z]=u[z+D];return R}var Yn=M/4,Wl=M/2,ls=M/4;r(cn,me);function cn(u){var g=gm();if(u==null)return g;if(n2(u))return u;var y=o(u),w=y.size;return w===0?g:(pt(w),w>0&&w<M?Xl(0,w,E,null,new Ns(y.toArray())):g.withMutations(function(R){R.setSize(w),y.forEach(function(D,z){return R.set(z,D)})}))}cn.of=function(){return this(arguments)},cn.prototype.toString=function(){return this.__toString("List [","]")},cn.prototype.get=function(u,g){if(u=Y(this,u),u>=0&&u<this.size){u+=this._origin;var y=o2(this,u);return y&&y.array[u&b]}return g},cn.prototype.set=function(u,g){return BC(this,u,g)},cn.prototype.remove=function(u){return this.has(u)?u===0?this.shift():u===this.size-1?this.pop():this.splice(u,1):this},cn.prototype.insert=function(u,g){return this.splice(u,0,g)},cn.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=E,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):gm()},cn.prototype.push=function(){var u=arguments,g=this.size;return this.withMutations(function(y){Us(y,0,g+u.length);for(var w=0;w<u.length;w++)y.set(g+w,u[w])})},cn.prototype.pop=function(){return Us(this,0,-1)},cn.prototype.unshift=function(){var u=arguments;return this.withMutations(function(g){Us(g,-u.length);for(var y=0;y<u.length;y++)g.set(y,u[y])})},cn.prototype.shift=function(){return Us(this,1)},cn.prototype.merge=function(){return Qu(this,void 0,arguments)},cn.prototype.mergeWith=function(u){var g=t.call(arguments,1);return Qu(this,u,g)},cn.prototype.mergeDeep=function(){return Qu(this,Xn,arguments)},cn.prototype.mergeDeepWith=function(u){var g=t.call(arguments,1);return Qu(this,as(u),g)},cn.prototype.setSize=function(u){return Us(this,0,u)},cn.prototype.slice=function(u,g){var y=this.size;return ue(u,g,y)?this:Us(this,te(u,y),ae(g,y))},cn.prototype.__iterator=function(u,g){var y=0,w=i2(this,g);return new V(function(){var R=w();return R===jl?X():ne(u,y++,R)})},cn.prototype.__iterate=function(u,g){for(var y=0,w=i2(this,g),R;(R=w())!==jl&&u(R,y++,this)!==!1;);return y},cn.prototype.__ensureOwner=function(u){return u===this.__ownerID?this:u?Xl(this._origin,this._capacity,this._level,this._root,this._tail,u,this.__hash):(this.__ownerID=u,this)};function n2(u){return!!(u&&u[r2])}cn.isList=n2;var r2="@@__IMMUTABLE_LIST__@@",rr=cn.prototype;rr[r2]=!0,rr[_]=rr.remove,rr.setIn=P.setIn,rr.deleteIn=rr.removeIn=P.removeIn,rr.update=P.update,rr.updateIn=P.updateIn,rr.mergeIn=P.mergeIn,rr.mergeDeepIn=P.mergeDeepIn,rr.withMutations=P.withMutations,rr.asMutable=P.asMutable,rr.asImmutable=P.asImmutable,rr.wasAltered=P.wasAltered;function Ns(u,g){this.array=u,this.ownerID=g}Ns.prototype.removeBefore=function(u,g,y){if(y===g?1<<g:this.array.length===0)return this;var w=y>>>g&b;if(w>=this.array.length)return new Ns([],u);var R=w===0,D;if(g>0){var z=this.array[w];if(D=z&&z.removeBefore(u,g-E,y),D===z&&R)return this}if(R&&!D)return this;var K=La(this,u);if(!R)for(var ce=0;ce<w;ce++)K.array[ce]=void 0;return D&&(K.array[w]=D),K},Ns.prototype.removeAfter=function(u,g,y){if(y===(g?1<<g:0)||this.array.length===0)return this;var w=y-1>>>g&b;if(w>=this.array.length)return this;var R;if(g>0){var D=this.array[w];if(R=D&&D.removeAfter(u,g-E,y),R===D&&w===this.array.length-1)return this}var z=La(this,u);return z.array.splice(w+1),R&&(z.array[w]=R),z};var jl={};function i2(u,g){var y=u._origin,w=u._capacity,R=$l(w),D=u._tail;return z(u._root,u._level,0);function z(he,ve,Ze){return ve===0?K(he,Ze):ce(he,ve,Ze)}function K(he,ve){var Ze=ve===R?D&&D.array:he&&he.array,at=ve>y?0:y-ve,xt=w-ve;return xt>M&&(xt=M),function(){if(at===xt)return jl;var At=g?--xt:at++;return Ze&&Ze[At]}}function ce(he,ve,Ze){var at,xt=he&&he.array,At=Ze>y?0:y-Ze>>ve,hn=(w-Ze>>ve)+1;return hn>M&&(hn=M),function(){do{if(at){var pi=at();if(pi!==jl)return pi;at=null}if(At===hn)return jl;var zi=g?--hn:At++;at=z(xt&&xt[zi],ve-E,Ze+(zi<<ve))}while(!0)}}}function Xl(u,g,y,w,R,D,z){var K=Object.create(rr);return K.size=g-u,K._origin=u,K._capacity=g,K._level=y,K._root=w,K._tail=R,K.__ownerID=D,K.__hash=z,K.__altered=!1,K}var s2;function gm(){return s2||(s2=Xl(0,0,E))}function BC(u,g,y){if(g=Y(u,g),g!==g)return u;if(g>=u.size||g<0)return u.withMutations(function(z){g<0?Us(z,g).set(0,y):Us(z,0,g+1).set(g,y)});g+=u._origin;var w=u._tail,R=u._root,D=O(q);return g>=$l(u._capacity)?w=_m(w,u.__ownerID,0,g,y,D):R=_m(R,u.__ownerID,u._level,g,y,D),D.value?u.__ownerID?(u._root=R,u._tail=w,u.__hash=void 0,u.__altered=!0,u):Xl(u._origin,u._capacity,u._level,R,w):u}function _m(u,g,y,w,R,D){var z=w>>>y&b,K=u&&z<u.array.length;if(!K&&R===void 0)return u;var ce;if(y>0){var he=u&&u.array[z],ve=_m(he,g,y-E,w,R,D);return ve===he?u:(ce=La(u,g),ce.array[z]=ve,ce)}return K&&u.array[z]===R?u:(A(D),ce=La(u,g),R===void 0&&z===ce.array.length-1?ce.array.pop():ce.array[z]=R,ce)}function La(u,g){return g&&u&&g===u.ownerID?u:new Ns(u?u.array.slice():[],g)}function o2(u,g){if(g>=$l(u._capacity))return u._tail;if(g<1<<u._level+E){for(var y=u._root,w=u._level;y&&w>0;)y=y.array[g>>>w&b],w-=E;return y}}function Us(u,g,y){g!==void 0&&(g=g|0),y!==void 0&&(y=y|0);var w=u.__ownerID||new L,R=u._origin,D=u._capacity,z=R+g,K=y===void 0?D:y<0?D+y:R+y;if(z===R&&K===D)return u;if(z>=K)return u.clear();for(var ce=u._level,he=u._root,ve=0;z+ve<0;)he=new Ns(he&&he.array.length?[void 0,he]:[],w),ce+=E,ve+=1<<ce;ve&&(z+=ve,R+=ve,K+=ve,D+=ve);for(var Ze=$l(D),at=$l(K);at>=1<<ce+E;)he=new Ns(he&&he.array.length?[he]:[],w),ce+=E;var xt=u._tail,At=at<Ze?o2(u,K-1):at>Ze?new Ns([],w):xt;if(xt&&at>Ze&&z<D&&xt.array.length){he=La(he,w);for(var hn=he,pi=ce;pi>E;pi-=E){var zi=Ze>>>pi&b;hn=hn.array[zi]=La(hn.array[zi],w)}hn.array[Ze>>>E&b]=xt}if(K<D&&(At=At&&At.removeAfter(w,0,K)),z>=at)z-=at,K-=at,ce=E,he=null,At=At&&At.removeBefore(w,0,z);else if(z>R||at<Ze){for(ve=0;he;){var oh=z>>>ce&b;if(oh!==at>>>ce&b)break;oh&&(ve+=(1<<ce)*oh),ce-=E,he=he.array[oh]}he&&z>R&&(he=he.removeBefore(w,ce,z-ve)),he&&at<Ze&&(he=he.removeAfter(w,ce,at-ve)),ve&&(z-=ve,K-=ve)}return u.__ownerID?(u.size=K-z,u._origin=z,u._capacity=K,u._level=ce,u._root=he,u._tail=At,u.__hash=void 0,u.__altered=!0,u):Xl(z,K,ce,he,At)}function Qu(u,g,y){for(var w=[],R=0,D=0;D<y.length;D++){var z=y[D],K=o(z);K.size>R&&(R=K.size),l(z)||(K=K.map(function(ce){return Ye(ce)})),w.push(K)}return R>u.size&&(u=u.setSize(R)),$n(u,g,w)}function $l(u){return u<M?0:u-1>>>E<<E}r(xn,Xe);function xn(u){return u==null?eh():a2(u)?u:eh().withMutations(function(g){var y=s(u);pt(y.size),y.forEach(function(w,R){return g.set(R,w)})})}xn.of=function(){return this(arguments)},xn.prototype.toString=function(){return this.__toString("OrderedMap {","}")},xn.prototype.get=function(u,g){var y=this._map.get(u);return y!==void 0?this._list.get(y)[1]:g},xn.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):eh()},xn.prototype.set=function(u,g){return c2(this,u,g)},xn.prototype.remove=function(u){return c2(this,u,S)},xn.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},xn.prototype.__iterate=function(u,g){var y=this;return this._list.__iterate(function(w){return w&&u(w[1],w[0],y)},g)},xn.prototype.__iterator=function(u,g){return this._list.fromEntrySeq().__iterator(u,g)},xn.prototype.__ensureOwner=function(u){if(u===this.__ownerID)return this;var g=this._map.__ensureOwner(u),y=this._list.__ensureOwner(u);return u?vm(g,y,u,this.__hash):(this.__ownerID=u,this._map=g,this._list=y,this)};function a2(u){return vn(u)&&p(u)}xn.isOrderedMap=a2,xn.prototype[v]=!0,xn.prototype[_]=xn.prototype.remove;function vm(u,g,y,w){var R=Object.create(xn.prototype);return R.size=u?u.size:0,R._map=u,R._list=g,R.__ownerID=y,R.__hash=w,R}var l2;function eh(){return l2||(l2=vm(rt(),gm()))}function c2(u,g,y){var w=u._map,R=u._list,D=w.get(g),z=D!==void 0,K,ce;if(y===S){if(!z)return u;R.size>=M&&R.size>=w.size*2?(ce=R.filter(function(he,ve){return he!==void 0&&D!==ve}),K=ce.toKeyedSeq().map(function(he){return he[0]}).flip().toMap(),u.__ownerID&&(K.__ownerID=ce.__ownerID=u.__ownerID)):(K=w.remove(g),ce=D===R.size-1?R.pop():R.set(D,void 0))}else if(z){if(y===R.get(D)[1])return u;K=w,ce=R.set(D,[g,y])}else K=w.set(g,R.size),ce=R.set(R.size,[g,y]);return u.__ownerID?(u.size=K.size,u._map=K,u._list=ce,u.__hash=void 0,u):vm(K,ce)}r(Hr,lt);function Hr(u,g){this._iter=u,this._useKeys=g,this.size=u.size}Hr.prototype.get=function(u,g){return this._iter.get(u,g)},Hr.prototype.has=function(u){return this._iter.has(u)},Hr.prototype.valueSeq=function(){return this._iter.valueSeq()},Hr.prototype.reverse=function(){var u=this,g=xm(this,!0);return this._useKeys||(g.valueSeq=function(){return u._iter.toSeq().reverse()}),g},Hr.prototype.map=function(u,g){var y=this,w=h2(this,u,g);return this._useKeys||(w.valueSeq=function(){return y._iter.toSeq().map(u,g)}),w},Hr.prototype.__iterate=function(u,g){var y=this,w;return this._iter.__iterate(this._useKeys?function(R,D){return u(R,D,y)}:(w=g?_2(this):0,function(R){return u(R,g?--w:w++,y)}),g)},Hr.prototype.__iterator=function(u,g){if(this._useKeys)return this._iter.__iterator(u,g);var y=this._iter.__iterator($,g),w=g?_2(this):0;return new V(function(){var R=y.next();return R.done?R:ne(u,g?--w:w++,R.value,R)})},Hr.prototype[v]=!0,r(Oa,Le);function Oa(u){this._iter=u,this.size=u.size}Oa.prototype.includes=function(u){return this._iter.includes(u)},Oa.prototype.__iterate=function(u,g){var y=this,w=0;return this._iter.__iterate(function(R){return u(R,w++,y)},g)},Oa.prototype.__iterator=function(u,g){var y=this._iter.__iterator($,g),w=0;return new V(function(){var R=y.next();return R.done?R:ne(u,w++,R.value,R)})},r(qa,Ge);function qa(u){this._iter=u,this.size=u.size}qa.prototype.has=function(u){return this._iter.includes(u)},qa.prototype.__iterate=function(u,g){var y=this;return this._iter.__iterate(function(w){return u(w,w,y)},g)},qa.prototype.__iterator=function(u,g){var y=this._iter.__iterator($,g);return new V(function(){var w=y.next();return w.done?w:ne(u,w.value,w.value,w)})},r(Da,lt);function Da(u){this._iter=u,this.size=u.size}Da.prototype.entrySeq=function(){return this._iter.toSeq()},Da.prototype.__iterate=function(u,g){var y=this;return this._iter.__iterate(function(w){if(w){g2(w);var R=l(w);return u(R?w.get(1):w[1],R?w.get(0):w[0],y)}},g)},Da.prototype.__iterator=function(u,g){var y=this._iter.__iterator($,g);return new V(function(){for(;;){var w=y.next();if(w.done)return w;var R=w.value;if(R){g2(R);var D=l(R);return ne(u,D?R.get(0):R[0],D?R.get(1):R[1],w)}}})},Oa.prototype.cacheResult=Hr.prototype.cacheResult=qa.prototype.cacheResult=Da.prototype.cacheResult=Em;function u2(u){var g=Ni(u);return g._iter=u,g.size=u.size,g.flip=function(){return u},g.reverse=function(){var y=u.reverse.apply(this);return y.flip=function(){return u.reverse()},y},g.has=function(y){return u.includes(y)},g.includes=function(y){return u.has(y)},g.cacheResult=Em,g.__iterateUncached=function(y,w){var R=this;return u.__iterate(function(D,z){return y(z,D,R)!==!1},w)},g.__iteratorUncached=function(y,w){if(y===oe){var R=u.__iterator(y,w);return new V(function(){var D=R.next();if(!D.done){var z=D.value[0];D.value[0]=D.value[1],D.value[1]=z}return D})}return u.__iterator(y===$?Se:$,w)},g}function h2(u,g,y){var w=Ni(u);return w.size=u.size,w.has=function(R){return u.has(R)},w.get=function(R,D){var z=u.get(R,S);return z===S?D:g.call(y,z,R,u)},w.__iterateUncached=function(R,D){var z=this;return u.__iterate(function(K,ce,he){return R(g.call(y,K,ce,he),ce,z)!==!1},D)},w.__iteratorUncached=function(R,D){var z=u.__iterator(oe,D);return new V(function(){var K=z.next();if(K.done)return K;var ce=K.value,he=ce[0];return ne(R,he,g.call(y,ce[1],he,u),K)})},w}function xm(u,g){var y=Ni(u);return y._iter=u,y.size=u.size,y.reverse=function(){return u},u.flip&&(y.flip=function(){var w=u2(u);return w.reverse=function(){return u.flip()},w}),y.get=function(w,R){return u.get(g?w:-1-w,R)},y.has=function(w){return u.has(g?w:-1-w)},y.includes=function(w){return u.includes(w)},y.cacheResult=Em,y.__iterate=function(w,R){var D=this;return u.__iterate(function(z,K){return w(z,K,D)},!R)},y.__iterator=function(w,R){return u.__iterator(w,!R)},y}function f2(u,g,y,w){var R=Ni(u);return w&&(R.has=function(D){var z=u.get(D,S);return z!==S&&!!g.call(y,z,D,u)},R.get=function(D,z){var K=u.get(D,S);return K!==S&&g.call(y,K,D,u)?K:z}),R.__iterateUncached=function(D,z){var K=this,ce=0;return u.__iterate(function(he,ve,Ze){if(g.call(y,he,ve,Ze))return ce++,D(he,w?ve:ce-1,K)},z),ce},R.__iteratorUncached=function(D,z){var K=u.__iterator(oe,z),ce=0;return new V(function(){for(;;){var he=K.next();if(he.done)return he;var ve=he.value,Ze=ve[0],at=ve[1];if(g.call(y,at,Ze,u))return ne(D,w?Ze:ce++,at,he)}})},R}function VC(u,g,y){var w=Xe().asMutable();return u.__iterate(function(R,D){w.update(g.call(y,R,D,u),0,function(z){return z+1})}),w.asImmutable()}function HC(u,g,y){var w=c(u),R=(p(u)?xn():Xe()).asMutable();u.__iterate(function(z,K){R.update(g.call(y,z,K,u),function(ce){return ce=ce||[],ce.push(w?[K,z]:z),ce})});var D=v2(u);return R.map(function(z){return Zt(u,D(z))})}function ym(u,g,y,w){var R=u.size;if(g!==void 0&&(g=g|0),y!==void 0&&(y===1/0?y=R:y=y|0),ue(g,y,R))return u;var D=te(g,R),z=ae(y,R);if(D!==D||z!==z)return ym(u.toSeq().cacheResult(),g,y,w);var K=z-D,ce;K===K&&(ce=K<0?0:K);var he=Ni(u);return he.size=ce===0?ce:u.size&&ce||void 0,!w&&wt(u)&&ce>=0&&(he.get=function(ve,Ze){return ve=Y(this,ve),ve>=0&&ve<ce?u.get(ve+D,Ze):Ze}),he.__iterateUncached=function(ve,Ze){var at=this;if(ce===0)return 0;if(Ze)return this.cacheResult().__iterate(ve,Ze);var xt=0,At=!0,hn=0;return u.__iterate(function(pi,zi){if(!(At&&(At=xt++<D)))return hn++,ve(pi,w?zi:hn-1,at)!==!1&&hn!==ce}),hn},he.__iteratorUncached=function(ve,Ze){if(ce!==0&&Ze)return this.cacheResult().__iterator(ve,Ze);var at=ce!==0&&u.__iterator(ve,Ze),xt=0,At=0;return new V(function(){for(;xt++<D;)at.next();if(++At>ce)return X();var hn=at.next();return w||ve===$?hn:ve===Se?ne(ve,At-1,void 0,hn):ne(ve,At-1,hn.value[1],hn)})},he}function GC(u,g,y){var w=Ni(u);return w.__iterateUncached=function(R,D){var z=this;if(D)return this.cacheResult().__iterate(R,D);var K=0;return u.__iterate(function(ce,he,ve){return g.call(y,ce,he,ve)&&++K&&R(ce,he,z)}),K},w.__iteratorUncached=function(R,D){var z=this;if(D)return this.cacheResult().__iterator(R,D);var K=u.__iterator(oe,D),ce=!0;return new V(function(){if(!ce)return X();var he=K.next();if(he.done)return he;var ve=he.value,Ze=ve[0],at=ve[1];return g.call(y,at,Ze,z)?R===oe?he:ne(R,Ze,at,he):(ce=!1,X())})},w}function d2(u,g,y,w){var R=Ni(u);return R.__iterateUncached=function(D,z){var K=this;if(z)return this.cacheResult().__iterate(D,z);var ce=!0,he=0;return u.__iterate(function(ve,Ze,at){if(!(ce&&(ce=g.call(y,ve,Ze,at))))return he++,D(ve,w?Ze:he-1,K)}),he},R.__iteratorUncached=function(D,z){var K=this;if(z)return this.cacheResult().__iterator(D,z);var ce=u.__iterator(oe,z),he=!0,ve=0;return new V(function(){var Ze,at,xt;do{if(Ze=ce.next(),Ze.done)return w||D===$?Ze:D===Se?ne(D,ve++,void 0,Ze):ne(D,ve++,Ze.value[1],Ze);var At=Ze.value;at=At[0],xt=At[1],he&&(he=g.call(y,xt,at,K))}while(he);return D===oe?Ze:ne(D,at,xt,Ze)})},R}function WC(u,g){var y=c(u),w=[u].concat(g).map(function(z){return l(z)?y&&(z=s(z)):z=y?J(z):de(Array.isArray(z)?z:[z]),z}).filter(function(z){return z.size!==0});if(w.length===0)return u;if(w.length===1){var R=w[0];if(R===u||y&&c(R)||h(u)&&h(R))return R}var D=new Ue(w);return y?D=D.toKeyedSeq():h(u)||(D=D.toSetSeq()),D=D.flatten(!0),D.size=w.reduce(function(z,K){if(z!==void 0){var ce=K.size;if(ce!==void 0)return z+ce}},0),D}function p2(u,g,y){var w=Ni(u);return w.__iterateUncached=function(R,D){var z=0,K=!1;function ce(he,ve){var Ze=this;he.__iterate(function(at,xt){return(!g||ve<g)&&l(at)?ce(at,ve+1):R(at,y?xt:z++,Ze)===!1&&(K=!0),!K},D)}return ce(u,0),z},w.__iteratorUncached=function(R,D){var z=u.__iterator(R,D),K=[],ce=0;return new V(function(){for(;z;){var he=z.next();if(he.done!==!1){z=K.pop();continue}var ve=he.value;if(R===oe&&(ve=ve[1]),(!g||K.length<g)&&l(ve))K.push(z),z=ve.__iterator(R,D);else return y?he:ne(R,ce++,ve,he)}return X()})},w}function jC(u,g,y){var w=v2(u);return u.toSeq().map(function(R,D){return w(g.call(y,R,D,u))}).flatten(!0)}function XC(u,g){var y=Ni(u);return y.size=u.size&&u.size*2-1,y.__iterateUncached=function(w,R){var D=this,z=0;return u.__iterate(function(K,ce){return(!z||w(g,z++,D)!==!1)&&w(K,z++,D)!==!1},R),z},y.__iteratorUncached=function(w,R){var D=u.__iterator($,R),z=0,K;return new V(function(){return(!K||z%2)&&(K=D.next(),K.done)?K:z%2?ne(w,z++,g):ne(w,z++,K.value,K)})},y}function Na(u,g,y){g||(g=x2);var w=c(u),R=0,D=u.toSeq().map(function(z,K){return[K,z,R++,y?y(z,K,u):z]}).toArray();return D.sort(function(z,K){return g(z[3],K[3])||z[2]-K[2]}).forEach(w?function(z,K){D[K].length=2}:function(z,K){D[K]=z[1]}),w?lt(D):h(u)?Le(D):Ge(D)}function th(u,g,y){if(g||(g=x2),y){var w=u.toSeq().map(function(R,D){return[R,y(R,D,u)]}).reduce(function(R,D){return m2(g,R[1],D[1])?D:R});return w&&w[0]}else return u.reduce(function(R,D){return m2(g,R,D)?D:R})}function m2(u,g,y){var w=u(y,g);return w===0&&y!==g&&(y==null||y!==y)||w>0}function Sm(u,g,y){var w=Ni(u);return w.size=new Ue(y).map(function(R){return R.size}).min(),w.__iterate=function(R,D){for(var z=this.__iterator($,D),K,ce=0;!(K=z.next()).done&&R(K.value,ce++,this)!==!1;);return ce},w.__iteratorUncached=function(R,D){var z=y.map(function(he){return he=i(he),Q(D?he.reverse():he)}),K=0,ce=!1;return new V(function(){var he;return ce||(he=z.map(function(ve){return ve.next()}),ce=he.some(function(ve){return ve.done})),ce?X():ne(R,K++,g.apply(null,he.map(function(ve){return ve.value})))})},w}function Zt(u,g){return wt(u)?g:u.constructor(g)}function g2(u){if(u!==Object(u))throw new TypeError("Expected [K, V] tuple: "+u)}function _2(u){return pt(u.size),Z(u)}function v2(u){return c(u)?s:h(u)?o:a}function Ni(u){return Object.create((c(u)?lt:h(u)?Le:Ge).prototype)}function Em(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):F.prototype.cacheResult.call(this)}function x2(u,g){return u>g?1:u<g?-1:0}function y2(u){var g=Q(u);if(!g){if(!le(u))throw new TypeError("Expected iterable or array-like: "+u);g=Q(i(u))}return g}r(Rr,we);function Rr(u,g){var y,w=function(z){if(z instanceof w)return z;if(!(this instanceof w))return new w(z);if(!y){y=!0;var K=Object.keys(u);$C(R,K),R.size=K.length,R._name=g,R._keys=K,R._defaultValues=u}this._map=Xe(z)},R=w.prototype=Object.create(Fn);return R.constructor=w,w}Rr.prototype.toString=function(){return this.__toString(S2(this)+" {","}")},Rr.prototype.has=function(u){return this._defaultValues.hasOwnProperty(u)},Rr.prototype.get=function(u,g){if(!this.has(u))return g;var y=this._defaultValues[u];return this._map?this._map.get(u,y):y},Rr.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var u=this.constructor;return u._empty||(u._empty=nh(this,rt()))},Rr.prototype.set=function(u,g){if(!this.has(u))throw new Error('Cannot set unknown key "'+u+'" on '+S2(this));if(this._map&&!this._map.has(u)){var y=this._defaultValues[u];if(g===y)return this}var w=this._map&&this._map.set(u,g);return this.__ownerID||w===this._map?this:nh(this,w)},Rr.prototype.remove=function(u){if(!this.has(u))return this;var g=this._map&&this._map.remove(u);return this.__ownerID||g===this._map?this:nh(this,g)},Rr.prototype.wasAltered=function(){return this._map.wasAltered()},Rr.prototype.__iterator=function(u,g){var y=this;return s(this._defaultValues).map(function(w,R){return y.get(R)}).__iterator(u,g)},Rr.prototype.__iterate=function(u,g){var y=this;return s(this._defaultValues).map(function(w,R){return y.get(R)}).__iterate(u,g)},Rr.prototype.__ensureOwner=function(u){if(u===this.__ownerID)return this;var g=this._map&&this._map.__ensureOwner(u);return u?nh(this,g,u):(this.__ownerID=u,this._map=g,this)};var Fn=Rr.prototype;Fn[_]=Fn.remove,Fn.deleteIn=Fn.removeIn=P.removeIn,Fn.merge=P.merge,Fn.mergeWith=P.mergeWith,Fn.mergeIn=P.mergeIn,Fn.mergeDeep=P.mergeDeep,Fn.mergeDeepWith=P.mergeDeepWith,Fn.mergeDeepIn=P.mergeDeepIn,Fn.setIn=P.setIn,Fn.update=P.update,Fn.updateIn=P.updateIn,Fn.withMutations=P.withMutations,Fn.asMutable=P.asMutable,Fn.asImmutable=P.asImmutable;function nh(u,g,y){var w=Object.create(Object.getPrototypeOf(u));return w._map=g,w.__ownerID=y,w}function S2(u){return u._name||u.constructor.name||"Record"}function $C(u,g){try{g.forEach(YC.bind(void 0,u))}catch{}}function YC(u,g){Object.defineProperty(u,g,{get:function(){return this.get(g)},set:function(y){H(this.__ownerID,"Cannot set on an immutable record."),this.set(g,y)}})}r(un,Qe);function un(u){return u==null?wm():bm(u)&&!p(u)?u:wm().withMutations(function(g){var y=a(u);pt(y.size),y.forEach(function(w){return g.add(w)})})}un.of=function(){return this(arguments)},un.fromKeys=function(u){return this(s(u).keySeq())},un.prototype.toString=function(){return this.__toString("Set {","}")},un.prototype.has=function(u){return this._map.has(u)},un.prototype.add=function(u){return Mm(this,this._map.set(u,!0))},un.prototype.remove=function(u){return Mm(this,this._map.remove(u))},un.prototype.clear=function(){return Mm(this,this._map.clear())},un.prototype.union=function(){var u=t.call(arguments,0);return u=u.filter(function(g){return g.size!==0}),u.length===0?this:this.size===0&&!this.__ownerID&&u.length===1?this.constructor(u[0]):this.withMutations(function(g){for(var y=0;y<u.length;y++)a(u[y]).forEach(function(w){return g.add(w)})})},un.prototype.intersect=function(){var u=t.call(arguments,0);if(u.length===0)return this;u=u.map(function(y){return a(y)});var g=this;return this.withMutations(function(y){g.forEach(function(w){u.every(function(R){return R.includes(w)})||y.remove(w)})})},un.prototype.subtract=function(){var u=t.call(arguments,0);if(u.length===0)return this;u=u.map(function(y){return a(y)});var g=this;return this.withMutations(function(y){g.forEach(function(w){u.some(function(R){return R.includes(w)})&&y.remove(w)})})},un.prototype.merge=function(){return this.union.apply(this,arguments)},un.prototype.mergeWith=function(u){var g=t.call(arguments,1);return this.union.apply(this,g)},un.prototype.sort=function(u){return Ui(Na(this,u))},un.prototype.sortBy=function(u,g){return Ui(Na(this,g,u))},un.prototype.wasAltered=function(){return this._map.wasAltered()},un.prototype.__iterate=function(u,g){var y=this;return this._map.__iterate(function(w,R){return u(R,R,y)},g)},un.prototype.__iterator=function(u,g){return this._map.map(function(y,w){return w}).__iterator(u,g)},un.prototype.__ensureOwner=function(u){if(u===this.__ownerID)return this;var g=this._map.__ensureOwner(u);return u?this.__make(g,u):(this.__ownerID=u,this._map=g,this)};function bm(u){return!!(u&&u[E2])}un.isSet=bm;var E2="@@__IMMUTABLE_SET__@@",Pr=un.prototype;Pr[E2]=!0,Pr[_]=Pr.remove,Pr.mergeDeep=Pr.merge,Pr.mergeDeepWith=Pr.mergeWith,Pr.withMutations=P.withMutations,Pr.asMutable=P.asMutable,Pr.asImmutable=P.asImmutable,Pr.__empty=wm,Pr.__make=b2;function Mm(u,g){return u.__ownerID?(u.size=g.size,u._map=g,u):g===u._map?u:g.size===0?u.__empty():u.__make(g)}function b2(u,g){var y=Object.create(Pr);return y.size=u?u.size:0,y._map=u,y.__ownerID=g,y}var M2;function wm(){return M2||(M2=b2(rt()))}r(Ui,un);function Ui(u){return u==null?Tm():w2(u)?u:Tm().withMutations(function(g){var y=a(u);pt(y.size),y.forEach(function(w){return g.add(w)})})}Ui.of=function(){return this(arguments)},Ui.fromKeys=function(u){return this(s(u).keySeq())},Ui.prototype.toString=function(){return this.__toString("OrderedSet {","}")};function w2(u){return bm(u)&&p(u)}Ui.isOrderedSet=w2;var rh=Ui.prototype;rh[v]=!0,rh.__empty=Tm,rh.__make=T2;function T2(u,g){var y=Object.create(rh);return y.size=u?u.size:0,y._map=u,y.__ownerID=g,y}var A2;function Tm(){return A2||(A2=T2(eh()))}r(Mn,me);function Mn(u){return u==null?Am():C2(u)?u:Am().unshiftAll(u)}Mn.of=function(){return this(arguments)},Mn.prototype.toString=function(){return this.__toString("Stack [","]")},Mn.prototype.get=function(u,g){var y=this._head;for(u=Y(this,u);y&&u--;)y=y.next;return y?y.value:g},Mn.prototype.peek=function(){return this._head&&this._head.value},Mn.prototype.push=function(){if(arguments.length===0)return this;for(var u=this.size+arguments.length,g=this._head,y=arguments.length-1;y>=0;y--)g={value:arguments[y],next:g};return this.__ownerID?(this.size=u,this._head=g,this.__hash=void 0,this.__altered=!0,this):Yl(u,g)},Mn.prototype.pushAll=function(u){if(u=o(u),u.size===0)return this;pt(u.size);var g=this.size,y=this._head;return u.reverse().forEach(function(w){g++,y={value:w,next:y}}),this.__ownerID?(this.size=g,this._head=y,this.__hash=void 0,this.__altered=!0,this):Yl(g,y)},Mn.prototype.pop=function(){return this.slice(1)},Mn.prototype.unshift=function(){return this.push.apply(this,arguments)},Mn.prototype.unshiftAll=function(u){return this.pushAll(u)},Mn.prototype.shift=function(){return this.pop.apply(this,arguments)},Mn.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Am()},Mn.prototype.slice=function(u,g){if(ue(u,g,this.size))return this;var y=te(u,this.size),w=ae(g,this.size);if(w!==this.size)return me.prototype.slice.call(this,u,g);for(var R=this.size-y,D=this._head;y--;)D=D.next;return this.__ownerID?(this.size=R,this._head=D,this.__hash=void 0,this.__altered=!0,this):Yl(R,D)},Mn.prototype.__ensureOwner=function(u){return u===this.__ownerID?this:u?Yl(this.size,this._head,u,this.__hash):(this.__ownerID=u,this.__altered=!1,this)},Mn.prototype.__iterate=function(u,g){if(g)return this.reverse().__iterate(u);for(var y=0,w=this._head;w&&u(w.value,y++,this)!==!1;)w=w.next;return y},Mn.prototype.__iterator=function(u,g){if(g)return this.reverse().__iterator(u);var y=0,w=this._head;return new V(function(){if(w){var R=w.value;return w=w.next,ne(u,y++,R)}return X()})};function C2(u){return!!(u&&u[R2])}Mn.isStack=C2;var R2="@@__IMMUTABLE_STACK__@@",Ua=Mn.prototype;Ua[R2]=!0,Ua.withMutations=P.withMutations,Ua.asMutable=P.asMutable,Ua.asImmutable=P.asImmutable,Ua.wasAltered=P.wasAltered;function Yl(u,g,y,w){var R=Object.create(Ua);return R.size=u,R._head=g,R.__ownerID=y,R.__hash=w,R.__altered=!1,R}var P2;function Am(){return P2||(P2=Yl(0))}function Fi(u,g){var y=function(w){u.prototype[w]=g[w]};return Object.keys(g).forEach(y),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(g).forEach(y),u}i.Iterator=V,Fi(i,{toArray:function(){pt(this.size);var u=new Array(this.size||0);return this.valueSeq().__iterate(function(g,y){u[y]=g}),u},toIndexedSeq:function(){return new Oa(this)},toJS:function(){return this.toSeq().map(function(u){return u&&typeof u.toJS=="function"?u.toJS():u}).__toJS()},toJSON:function(){return this.toSeq().map(function(u){return u&&typeof u.toJSON=="function"?u.toJSON():u}).__toJS()},toKeyedSeq:function(){return new Hr(this,!0)},toMap:function(){return Xe(this.toKeyedSeq())},toObject:function(){pt(this.size);var u={};return this.__iterate(function(g,y){u[y]=g}),u},toOrderedMap:function(){return xn(this.toKeyedSeq())},toOrderedSet:function(){return Ui(c(this)?this.valueSeq():this)},toSet:function(){return un(c(this)?this.valueSeq():this)},toSetSeq:function(){return new qa(this)},toSeq:function(){return h(this)?this.toIndexedSeq():c(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Mn(c(this)?this.valueSeq():this)},toList:function(){return cn(c(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(u,g){return this.size===0?u+g:u+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+g},concat:function(){var u=t.call(arguments,0);return Zt(this,WC(this,u))},includes:function(u){return this.some(function(g){return We(g,u)})},entries:function(){return this.__iterator(oe)},every:function(u,g){pt(this.size);var y=!0;return this.__iterate(function(w,R,D){if(!u.call(g,w,R,D))return y=!1,!1}),y},filter:function(u,g){return Zt(this,f2(this,u,g,!0))},find:function(u,g,y){var w=this.findEntry(u,g);return w?w[1]:y},forEach:function(u,g){return pt(this.size),this.__iterate(g?u.bind(g):u)},join:function(u){pt(this.size),u=u!==void 0?""+u:",";var g="",y=!0;return this.__iterate(function(w){y?y=!1:g+=u,g+=w!=null?w.toString():""}),g},keys:function(){return this.__iterator(Se)},map:function(u,g){return Zt(this,h2(this,u,g))},reduce:function(u,g,y){pt(this.size);var w,R;return arguments.length<2?R=!0:w=g,this.__iterate(function(D,z,K){R?(R=!1,w=D):w=u.call(y,w,D,z,K)}),w},reduceRight:function(u,g,y){var w=this.toKeyedSeq().reverse();return w.reduce.apply(w,arguments)},reverse:function(){return Zt(this,xm(this,!0))},slice:function(u,g){return Zt(this,ym(this,u,g,!0))},some:function(u,g){return!this.every(sh(u),g)},sort:function(u){return Zt(this,Na(this,u))},values:function(){return this.__iterator($)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==void 0?this.size===0:!this.some(function(){return!0})},count:function(u,g){return Z(u?this.toSeq().filter(u,g):this)},countBy:function(u,g){return VC(this,u,g)},equals:function(u){return tt(this,u)},entrySeq:function(){var u=this;if(u._cache)return new Ue(u._cache);var g=u.toSeq().map(ZC).toIndexedSeq();return g.fromEntrySeq=function(){return u.toSeq()},g},filterNot:function(u,g){return this.filter(sh(u),g)},findEntry:function(u,g,y){var w=y;return this.__iterate(function(R,D,z){if(u.call(g,R,D,z))return w=[D,R],!1}),w},findKey:function(u,g){var y=this.findEntry(u,g);return y&&y[0]},findLast:function(u,g,y){return this.toKeyedSeq().reverse().find(u,g,y)},findLastEntry:function(u,g,y){return this.toKeyedSeq().reverse().findEntry(u,g,y)},findLastKey:function(u,g){return this.toKeyedSeq().reverse().findKey(u,g)},first:function(){return this.find(ee)},flatMap:function(u,g){return Zt(this,jC(this,u,g))},flatten:function(u){return Zt(this,p2(this,u,!0))},fromEntrySeq:function(){return new Da(this)},get:function(u,g){return this.find(function(y,w){return We(w,u)},void 0,g)},getIn:function(u,g){for(var y=this,w=y2(u),R;!(R=w.next()).done;){var D=R.value;if(y=y&&y.get?y.get(D,S):S,y===S)return g}return y},groupBy:function(u,g){return HC(this,u,g)},has:function(u){return this.get(u,S)!==S},hasIn:function(u){return this.getIn(u,S)!==S},isSubset:function(u){return u=typeof u.includes=="function"?u:i(u),this.every(function(g){return u.includes(g)})},isSuperset:function(u){return u=typeof u.isSubset=="function"?u:i(u),u.isSubset(this)},keyOf:function(u){return this.findKey(function(g){return We(g,u)})},keySeq:function(){return this.toSeq().map(KC).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(u){return this.toKeyedSeq().reverse().keyOf(u)},max:function(u){return th(this,u)},maxBy:function(u,g){return th(this,g,u)},min:function(u){return th(this,u?I2(u):O2)},minBy:function(u,g){return th(this,g?I2(g):O2,u)},rest:function(){return this.slice(1)},skip:function(u){return this.slice(Math.max(0,u))},skipLast:function(u){return Zt(this,this.toSeq().reverse().skip(u).reverse())},skipWhile:function(u,g){return Zt(this,d2(this,u,g,!0))},skipUntil:function(u,g){return this.skipWhile(sh(u),g)},sortBy:function(u,g){return Zt(this,Na(this,g,u))},take:function(u){return this.slice(0,Math.max(0,u))},takeLast:function(u){return Zt(this,this.toSeq().reverse().take(u).reverse())},takeWhile:function(u,g){return Zt(this,GC(this,u,g))},takeUntil:function(u,g){return this.takeWhile(sh(u),g)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=QC(this))}});var ir=i.prototype;ir[d]=!0,ir[Ce]=ir.values,ir.__toJS=ir.toArray,ir.__toStringMapper=L2,ir.inspect=ir.toSource=function(){return this.toString()},ir.chain=ir.flatMap,ir.contains=ir.includes,Fi(s,{flip:function(){return Zt(this,u2(this))},mapEntries:function(u,g){var y=this,w=0;return Zt(this,this.toSeq().map(function(R,D){return u.call(g,[D,R],w++,y)}).fromEntrySeq())},mapKeys:function(u,g){var y=this;return Zt(this,this.toSeq().flip().map(function(w,R){return u.call(g,w,R,y)}).flip())}});var ih=s.prototype;ih[m]=!0,ih[Ce]=ir.entries,ih.__toJS=ir.toObject,ih.__toStringMapper=function(u,g){return JSON.stringify(g)+": "+L2(u)},Fi(o,{toKeyedSeq:function(){return new Hr(this,!1)},filter:function(u,g){return Zt(this,f2(this,u,g,!1))},findIndex:function(u,g){var y=this.findEntry(u,g);return y?y[0]:-1},indexOf:function(u){var g=this.keyOf(u);return g===void 0?-1:g},lastIndexOf:function(u){var g=this.lastKeyOf(u);return g===void 0?-1:g},reverse:function(){return Zt(this,xm(this,!1))},slice:function(u,g){return Zt(this,ym(this,u,g,!1))},splice:function(u,g){var y=arguments.length;if(g=Math.max(g|0,0),y===0||y===2&&!g)return this;u=te(u,u<0?this.count():this.size);var w=this.slice(0,u);return Zt(this,y===1?w:w.concat(N(arguments,2),this.slice(u+g)))},findLastIndex:function(u,g){var y=this.findLastEntry(u,g);return y?y[0]:-1},first:function(){return this.get(0)},flatten:function(u){return Zt(this,p2(this,u,!1))},get:function(u,g){return u=Y(this,u),u<0||this.size===1/0||this.size!==void 0&&u>this.size?g:this.find(function(y,w){return w===u},void 0,g)},has:function(u){return u=Y(this,u),u>=0&&(this.size!==void 0?this.size===1/0||u<this.size:this.indexOf(u)!==-1)},interpose:function(u){return Zt(this,XC(this,u))},interleave:function(){var u=[this].concat(N(arguments)),g=Sm(this.toSeq(),Le.of,u),y=g.flatten(!0);return g.size&&(y.size=g.size*u.length),Zt(this,y)},keySeq:function(){return _e(0,this.size)},last:function(){return this.get(-1)},skipWhile:function(u,g){return Zt(this,d2(this,u,g,!1))},zip:function(){var u=[this].concat(N(arguments));return Zt(this,Sm(this,JC,u))},zipWith:function(u){var g=N(arguments);return g[0]=this,Zt(this,Sm(this,u,g))}}),o.prototype[x]=!0,o.prototype[v]=!0,Fi(a,{get:function(u,g){return this.has(u)?u:g},includes:function(u){return this.has(u)},keySeq:function(){return this.valueSeq()}}),a.prototype.has=ir.includes,a.prototype.contains=a.prototype.includes,Fi(lt,s.prototype),Fi(Le,o.prototype),Fi(Ge,a.prototype),Fi(we,s.prototype),Fi(me,o.prototype),Fi(Qe,a.prototype);function KC(u,g){return g}function ZC(u,g){return[g,u]}function sh(u){return function(){return!u.apply(this,arguments)}}function I2(u){return function(){return-u.apply(this,arguments)}}function L2(u){return typeof u=="string"?JSON.stringify(u):String(u)}function JC(){return N(arguments)}function O2(u,g){return u<g?1:u>g?-1:0}function QC(u){if(u.size===1/0)return 0;var g=p(u),y=c(u),w=g?1:0,R=u.__iterate(y?g?function(D,z){w=31*w+q2(_t(D),_t(z))|0}:function(D,z){w=w+q2(_t(D),_t(z))|0}:g?function(D){w=31*w+_t(D)|0}:function(D){w=w+_t(D)|0});return eR(R,w)}function eR(u,g){return g=ft(g,3432918353),g=ft(g<<15|g>>>-15,461845907),g=ft(g<<13|g>>>-13,5),g=(g+3864292196|0)^u,g=ft(g^g>>>16,2246822507),g=ft(g^g>>>13,3266489909),g=Ot(g^g>>>16),g}function q2(u,g){return u^g+2654435769+(u<<6)+(u>>2)|0}var tR={Iterable:i,Seq:F,Collection:Ve,Map:Xe,OrderedMap:xn,List:cn,Stack:Mn,Set:un,OrderedSet:Ui,Record:Rr,Range:_e,Repeat:Pe,is:We,fromJS:Ye};return tR})}(wc)),wc.exports}var Sf,hg;function E3(){if(hg)return Sf;hg=1;var n=yf(),e=function(i){return n.Iterable.isKeyed(i)},t=function(i){return n.Iterable.isIndexed(i)},r=function(i,s,o){return i==="remove"?{op:i,path:s}:{op:i,path:s,value:o}};return Sf={isMap:e,isIndexed:t,op:r},Sf}var Ef,fg;function b3(){if(fg)return Ef;fg=1;var n=yf(),e=function(c,h,f){for(var p=[],d=0;d<c;d++){p[d]=new Array(h);for(var m=0;m<h;m++)p[d][m]=f}return p},t=function(c,h){var f=a(c,h);return l(c,h,f)},r=n.Record({op:"=",val:null}),i=n.Record({op:"!=",val:null,newVal:null}),s=function(c,h){var f=a(c,h);return o(f,c,h,c.size||0,h.size||0)},o=function(c,h,f,p,d){for(var m=[],x=p-1,v=d-1;x>=0||v>=0;)x>=0&&v>=0&&n.is(h.get(x),f.get(v))?(m.push(new r({op:"=",val:h.get(x)})),x-=1,v-=1):x>=0&&v>=0&&x===v&&!n.is(h.get(x),f.get(v))?(m.push(new i({val:h.get(x),newVal:f.get(x)})),x-=1,v-=1):v>=0&&(x===-1||c[x+1][v]>=c[x][v+1])?(m.push(new r({op:"+",val:f.get(v)})),v-=1):x>=0&&(v===-1||c[x+1][v]<c[x][v+1])&&(m.push(new r({op:"-",val:h.get(x)})),x-=1);return m.reverse()};function a(c,h){for(var f=c.size||0,p=h.size||0,d=e(f+1,p+1,0),m=0;m<f;m++)for(var x=0;x<p;x++)n.is(c.get(m),h.get(x))?d[m+1][x+1]=d[m][x]+1:d[m+1][x+1]=Math.max(d[m+1][x],d[m][x+1]);return d}var l=function(c,h,f){for(var p=[],d=c.size,m=h.size;d!==0&&m!==0;)f[d][m]===f[d-1][m]?d--:f[d][m]===f[d][m-1]?m--:n.is(c.get(d-1),h.get(m-1))&&(p.push(c.get(d-1)),d--,m--);return p.reverse()};return Ef={lcs:t,computeLcsMatrix:a,diff:s},Ef}var bf,dg;function M3(){if(dg)return bf;dg=1;var n=new RegExp("/","g"),e=new RegExp("~1","g"),t=/~/g,r=/~0/g,i={escape:function(s){if(typeof s=="number")return s.toString();if(typeof s!="string")throw"param str ("+s+") is not a string";return s.replace(t,"~0").replace(n,"~1")},unescape:function(s){return typeof s=="string"?s.replace(e,"/").replace(r,"~"):s},concat:function(s,o){return s+"/"+o}};return bf=i,bf}var Mf,pg;function w3(){if(pg)return Mf;pg=1;var n=yf(),e=E3(),t=b3(),r=M3(),i=r.concat,s=r.escape,o=e.op,a=e.isMap,l=e.isIndexed,c=function(d,m,x){var v=[],_=x||"";if(n.is(d,m)||d==m==null)return v;var E=l(d)&&l(m),M=null,b=null;return d.forEach&&d.forEach(function(S,T){if(m.has(T))if(a(S)&&a(m.get(T)))v=v.concat(c(S,m.get(T),i(_,s(T))));else if(l(m.get(T))&&l(S))v=v.concat(h(S,m.get(T),i(_,s(T))));else{var q=m.get?m.get(T):m,O=S!==q;O&&v.push(o("replace",i(_,s(T)),q))}else E?(b=M!=null&&M+1===T?b:T,v.push(o("remove",i(_,s(b)))),M=T):v.push(o("remove",i(_,s(T))))}),m.forEach(function(S,T){d.has&&!d.has(T)&&v.push(o("add",i(_,s(T)),S))}),v},h=function(d,m,x){var v=[],_=x||"";if(n.is(d,m)||d==m==null)return v;if((d.count()+1)*(m.count()+1)>=1e4)return c(d,m,x);var E=t.diff(d,m),M=0;return E.forEach(function(b){if(b.op==="=")M++;else if(b.op==="!="){if(a(b.val)&&a(b.newVal)){var S=c(b.val,b.newVal,i(_,M));v=v.concat(S)}else v.push(o("replace",i(_,M),b.newVal));M++}else b.op==="+"?(v.push(o("add",i(_,M),b.val)),M++):b.op==="-"&&v.push(o("remove",i(_,M)))}),v},f=function(d,m,x){var v=x||"";return d===m?[]:[o("replace",i(v,""),m)]},p=function(d,m,x){return n.is(d,m)?n.List():d!=m&&(d==null||m==null)?n.fromJS([o("replace","/",m)]):l(d)&&l(m)?n.fromJS(h(d,m)):a(d)&&a(m)?n.fromJS(c(d,m)):n.fromJS(f(d,m,x))};return Mf=p,Mf}var T3=w3();const A3=mi(T3),C3=Cm(zy);var wf,mg;function R3(){if(mg)return wf;mg=1;var n=new RegExp("/","g"),e=new RegExp("~1","g"),t=/~/g,r=/~0/g,i={escape:function(s){if(typeof s!="string")throw"param str ("+s+") is not a string";return s.replace(t,"~0").replace(n,"~1")},unescape:function(s){return typeof s=="string"?s.replace(e,"/").replace(r,"~"):s}};return wf=i,wf}var Tf,gg;function P3(){if(gg)return Tf;gg=1;var n=C3,e=R3(),t=function(h){var f=parseInt(h);return isNaN(f)?h:f},r=function(h,f){if(h==="add"||h==="replace")return f;if(h==="remove")return null},i=function(h,f,p,d,m){if(d==="add")if(p.length>0&&h.get(f)===void 0){var x=p[0].match(/^\d+$/)?n.List():n.Map();return h.set(f,a(x,p,d,m))}else return h.set(f,a(h.get(f),p,d,m));else{if(d==="replace")return p.length>0?h.set(f,a(h.get(f),p,d,m)):h.set(f,m);if(d==="remove")return p.length>0?h.set(f,a(h.get(f),p,d,m)):h.remove(f);throw new Error("map patch Error, unknown op: "+d)}},s=function(h,f,p,d,m){if(f=t(f),d==="add")if(h.get(f)===void 0)if(p.length>0){var x=p[0].match(/^\d+$/)?n.List():n.Map();return h.set(f,a(x,p,d,m))}else return f==="-"?h.splice(h.size,0,m):h.splice(f,0,m);else return p.length>0?h.set(f,a(h.get(f),p,d,m)):h.splice(f,0,m);else{if(d==="replace")return p.length>0?h.set(f,a(h.get(f),p,d,m)):h.set(f,m);if(d==="remove")return p.length>0?h.set(f,a(h.get(f),p,d,m)):h.remove(f);throw new Error("sequence patch Error, unknown op: "+d)}},o=function(h){return h!=null&&typeof h.updateIn=="function"&&typeof h.set=="function"},a=function(h,f,p,d){var m,x;return n.Iterable.isIndexed(h)?f.length===0?h:(m=f[0],x=f.slice(1),s(h,m,x,p,d)):n.Iterable.isKeyed(h)||o(h)?f.length===0?h:(m=f[0],x=f.slice(1),i(h,m,x,p,d)):f.length===0?d:r(p,d)},l=function(h,f){for(;f.size;){var p=f.get(0),f=f.slice(1),d=p.get("path").split("/").slice(1).map(e.unescape);h=a(h,d,p.get("op"),p.get("value"))}return h},c=function(h,f){if(f.size===1){var p=f.get(0);if(p.get("op")==="replace"&&p.get("path")==="/")return p.get("value")}return l(h,f)};return c.default=c,Tf=c,Tf}var I3=P3();const _g=mi(I3),mn=(n,e)=>{if(n.last){if(n.last.hashCode()!==e.hashCode()){let t=qe({time:Date.now(),diff:A3(n.last,e)});n=n.set("last",e).set("list",n.list.push(t)).set("redoList",n.redoList.clear())}}else n=n.set("last",e);return n},L3=n=>{if(n.last&&n.redoList.size){const e=n.redoList.last(),t=_g(n.last,e.get("diff"));n=n.set("last",t).set("list",n.list.push(e)).set("redoList",n.redoList.pop())}return n},vg=n=>{var e;if(n.last&&n.list.size){const t=n.list.last();let r=n.first;for(let i=0;i<n.list.size-1;i++)r=_g(r,(e=n.list.get(i))==null?void 0:e.get("diff"));n=n.set("last",r).set("list",n.list.pop()).set("redoList",n.redoList.push(t))}return n};var Af={exports:{}},Cf,xg;function O3(){if(xg)return Cf;xg=1;var n=1;function e(){return n=(n*9301+49297)%233280,n/233280}function t(r){n=r}return Cf={nextValue:e,seed:t},Cf}var Rf,yg;function Tc(){if(yg)return Rf;yg=1;var n=O3(),e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-",t,r,i;function s(){i=!1}function o(d){if(!d){t!==e&&(t=e,s());return}if(d!==t){if(d.length!==e.length)throw new Error("Custom alphabet for shortid must be "+e.length+" unique characters. You submitted "+d.length+" characters: "+d);var m=d.split("").filter(function(x,v,_){return v!==_.lastIndexOf(x)});if(m.length)throw new Error("Custom alphabet for shortid must be "+e.length+" unique characters. These characters were not unique: "+m.join(", "));t=d,s()}}function a(d){return o(d),t}function l(d){n.seed(d),r!==d&&(s(),r=d)}function c(){t||o(e);for(var d=t.split(""),m=[],x=n.nextValue(),v;d.length>0;)x=n.nextValue(),v=Math.floor(x*d.length),m.push(d.splice(v,1)[0]);return m.join("")}function h(){return i||(i=c(),i)}function f(d){var m=h();return m[d]}function p(){return t||e}return Rf={get:p,characters:a,seed:l,lookup:f,shuffled:h},Rf}var Pf,Sg;function q3(){if(Sg)return Pf;Sg=1;var n=typeof window=="object"&&(window.crypto||window.msCrypto),e;return!n||!n.getRandomValues?e=function(t){for(var r=[],i=0;i<t;i++)r.push(Math.floor(Math.random()*256));return r}:e=function(t){return n.getRandomValues(new Uint8Array(t))},Pf=e,Pf}let D3="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Eg=n=>crypto.getRandomValues(new Uint8Array(n)),bg=(n,e,t)=>{let r=(2<<Math.log(n.length-1)/Math.LN2)-1,i=-~(1.6*r*e/n.length);return(s=e)=>{let o="";for(;;){let a=t(i),l=i|0;for(;l--;)if(o+=n[a[l]&r]||"",o.length===s)return o}}};const N3=Cm(Object.freeze(Object.defineProperty({__proto__:null,customAlphabet:(n,e=21)=>bg(n,e,Eg),customRandom:bg,nanoid:(n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),""),random:Eg,urlAlphabet:D3},Symbol.toStringTag,{value:"Module"})));var If,Mg;function U3(){if(Mg)return If;Mg=1;var n=Tc(),e=q3(),t=N3.customRandom;function r(i){for(var s=0,o,a="";!o;)a=a+t(n.get(),1,e)(),o=i<Math.pow(16,s+1),s++;return a}return If=r,If}var Lf,wg;function F3(){if(wg)return Lf;wg=1;var n=U3();Tc();var e=1567752802062,t=7,r,i;function s(o){var a="",l=Math.floor((Date.now()-e)*.001);return l===i?r++:(r=0,i=l),a=a+n(t),a=a+n(o),r>0&&(a=a+n(r)),a=a+n(l),a}return Lf=s,Lf}var Of,Tg;function z3(){if(Tg)return Of;Tg=1;var n=Tc();function e(t){if(!t||typeof t!="string"||t.length<6)return!1;var r=new RegExp("[^"+n.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]");return!r.test(t)}return Of=e,Of}var qf,Ag;function k3(){return Ag||(Ag=1,qf=0),qf}var Cg;function B3(){return Cg||(Cg=1,function(n){var e=Tc(),t=F3(),r=z3(),i=k3()||0;function s(c){return e.seed(c),n.exports}function o(c){return i=c,n.exports}function a(c){return c!==void 0&&e.characters(c),e.shuffled()}function l(){return t(i)}n.exports=l,n.exports.generate=l,n.exports.seed=s,n.exports.worker=o,n.exports.characters=a,n.exports.isValid=r}(Af)),Af.exports}var Df,Rg;function V3(){return Rg||(Rg=1,Df=B3()),Df}var H3=V3();const G3=mi(H3);class bi{static acquireID(){return G3.generate()}}class Ac{static generateName(e,t){return t.charAt(0).toUpperCase()+t.slice(1)}}class Sn{static create(e,t,r,i,s,o){let a=bi.acquireID(),l=e.catalog.factoryElement(r,{id:a,name:Ac.generateName("holes",e.catalog.getIn(["elements",r,"info","title"])),type:r,offset:s,line:i},o);return e=e.setIn(["scene","layers",t,"holes",a],l),e=e.updateIn(["scene","layers",t,"lines",i,"holes"],c=>c.push(a)),{updatedState:e,hole:l}}static select(e,t,r){return e=ht.select(e,t).updatedState,e=ht.selectElement(e,t,"holes",r).updatedState,{updatedState:e}}static remove(e,t,r){let i=e.getIn(["scene","layers",t,"holes",r]);return e=this.unselect(e,t,r).updatedState,e=ht.removeElement(e,t,"holes",r).updatedState,e=e.updateIn(["scene","layers",t,"lines",i.line,"holes"],s=>{let o=s.findIndex(a=>r===a);return o!==-1?s.remove(o):s}),e.getIn(["scene","groups"]).forEach(s=>e=En.removeElement(e,s.id,t,"holes",r).updatedState),{updatedState:e}}static unselect(e,t,r){return e=ht.unselect(e,t,"holes",r).updatedState,{updatedState:e}}static selectToolDrawingHole(e,t){let r=Je().withMutations(i=>{let{lines:s,vertices:o}=e.getIn(["scene","layers",e.scene.selectedLayer]);s.forEach(a=>{let{x:l,y:c}=o.get(a.vertices.get(0)),{x:h,y:f}=o.get(a.vertices.get(1));cl(i,l,c,h,f,20,1,a.id)})});return e=e.merge({mode:vr,snapElements:r,drawingSupport:qe({type:t})}),{updatedState:e}}static updateDrawingHole(e,t,r,i){let s=e.catalog,o=Ei(e.snapElements,r,i,e.snapMask.merge({SNAP_SEGMENT:!0}));o&&({x:r,y:i}=o.point);let a=e.getIn(["scene","layers",t,"selected","holes"]).first();if(o){let l=o.snap.related.get(0),c=e.getIn(["scene","layers",t,"lines",l,"vertices"]),{x:h,y:f}=e.getIn(["scene","layers",t,"vertices",c.get(0)]),{x:p,y:d}=e.getIn(["scene","layers",t,"vertices",c.get(1)]),m=gc({x:h,y:f},{x:p,y:d}),x=lf({x:h,y:f},{x:p,y:d}),v=s.factoryElement(e.drawingSupport.get("type")).properties.getIn(["width","length"]),_=Bn(h,f,p,d),E=$y(h,f,p,d),M=Ky(E,1e-7),b=Zy(E,1e-7),S={x:m.x+v/2*M,y:m.y+v/2*b},T={x:m.x+_*M-v/2*M,y:m.y+_*b-v/2*b},q;if(r<S.x?q=Vn(m.x,m.y,x.x,x.y,S.x,S.y):r>T.x?q=Vn(m.x,m.y,x.x,x.y,T.x,T.y):r===S.x&&r===T.x?i<S.y?(q=Vn(m.x,m.y,x.x,x.y,S.x,S.y),q=m.x===h&&m.y===f?q:1-q):i>T.y?(q=Vn(m.x,m.y,x.x,x.y,T.x,T.y),q=m.x===h&&m.y===f?q:1-q):q=Vn(h,f,p,d,r,i):q=Vn(h,f,p,d,r,i),a&&o){e=e.mergeIn(["scene","layers",t,"holes",a],{offset:q,line:l});let O=e.getIn(["scene","layers",t,"lines"]).findEntry(L=>L.id!==l&&L.get("holes").contains(a));if(O){let L=O[1].get("holes").filter(N=>N!==a);e=e.setIn(["scene","layers",t,"lines",O[0],"holes"],L)}let A=e.getIn(["scene","layers",t,"lines",l,"holes"]);A.contains(a)||(e=e.setIn(["scene","layers",t,"lines",l,"holes"],A.push(a)))}else if(!a&&o){let{updatedState:O,hole:A}=this.create(e,t,e.drawingSupport.get("type"),l,q);e=Sn.select(O,t,A.id).updatedState}}return{updatedState:e}}static endDrawingHole(e,t,r,i){return e=this.updateDrawingHole(e,t,r,i).updatedState,e=ht.unselectAll(e,t).updatedState,{updatedState:e}}static beginDraggingHole(e,t,r,i,s){let o=e.getIn(["scene","layers",t]),a=o.getIn(["holes",r]),l=o.getIn(["lines",a.line]),c=o.getIn(["vertices",l.vertices.get(0)]),h=o.getIn(["vertices",l.vertices.get(1)]),f=cl(Je(),c.x,c.y,h.x,h.y,9999999,1,null);return e=e.merge({mode:Kr,snapElements:f,draggingSupport:qe({layerID:t,holeID:r,startPointX:i,startPointY:s})}),{updatedState:e}}static updateDraggingHole(e,t,r){let i=Ei(e.snapElements,t,r,e.snapMask.merge({SNAP_SEGMENT:!0}));if(!i)return e;let{draggingSupport:s,scene:o}=e,a=s.get("layerID"),l=s.get("holeID"),c=e.getIn(["scene","layers",a]),h=c.getIn(["holes",l]),f=c.getIn(["lines",h.line]),p=c.getIn(["vertices",f.vertices.get(0)]),d=c.getIn(["vertices",f.vertices.get(1)]);({x:t,y:r}=i.point);let m=gc(p,d),x=lf(p,d),v=h.properties.get("width").get("length"),_=Bn(p.x,p.y,d.x,d.y),E=Math.atan2(Math.abs(d.y-p.y),Math.abs(d.x-p.x)),M=L=>{let N=Math.cos(L);return N<1e-7?0:N},b=L=>{let N=Math.sin(L);return N<1e-7?0:N},S=M(E),T=b(E),q={x:m.x+v/2*S,y:m.y+v/2*T},O={x:m.x+_*S-v/2*S,y:m.y+_*T-v/2*T},A;return t<q.x?A=Vn(m.x,m.y,x.x,x.y,q.x,q.y):t>O.x?A=Vn(m.x,m.y,x.x,x.y,O.x,O.y):t===q.x&&t===O.x?r<q.y?(A=Vn(m.x,m.y,x.x,x.y,q.x,q.y),A=m===p?A:1-A):r>O.y?(A=Vn(m.x,m.y,x.x,x.y,O.x,O.y),A=m===p?A:1-A):(A=Vn(m.x,m.y,x.x,x.y,t,r),A=m===p?A:1-A):A=Vn(m.x,m.y,x.x,x.y,t,r),h=h.set("offset",A),e=e.merge({scene:o.mergeIn(["layers",a,"holes",l],h)}),{updatedState:e}}static endDraggingHole(e,t,r){return e=this.updateDraggingHole(e,t,r).updatedState,e=e.merge({mode:fn}),{updatedState:e}}static setProperties(e,t,r,i){return e=e.setIn(["scene","layers",t,"holes",r,"properties"],i),{updatedState:e}}static setJsProperties(e,t,r,i){return this.setProperties(e,t,r,Dt(i))}static updateProperties(e,t,r,i){return i.forEach((s,o)=>{e.hasIn(["scene","layers",t,"holes",r,"properties",o])&&(e=e.mergeIn(["scene","layers",t,"holes",r,"properties",o],s))}),{updatedState:e}}static updateJsProperties(e,t,r,i){return this.updateProperties(e,t,r,Dt(i))}static setAttributes(e,t,r,i){let s=i.toJS(),{offsetA:o,offsetB:a,offset:l}=s;delete s.offsetA,delete s.offsetB,delete s.offset;let c=qe({_unitA:o._unit,_unitB:a._unit});return e=e.mergeIn(["scene","layers",t,"holes",r],Dt(s)).mergeDeepIn(["scene","layers",t,"holes",r],qe({offset:l,misc:c})),{updatedState:e}}}let Tn=class D2{static create(e,t,r,i,s,o,a,l){let c=bi.acquireID(),h=e.catalog.factoryElement(r,{id:c,name:Ac.generateName("items",e.catalog.getIn(["elements",r,"info","title"])),type:r,height:a,width:o,x:i,y:s,rotation:l});return e=e.setIn(["scene","layers",t,"items",c],h),{updatedState:e,item:h}}static select(e,t,r){return e=ht.select(e,t).updatedState,e=ht.selectElement(e,t,"items",r).updatedState,{updatedState:e}}static remove(e,t,r){return e=this.unselect(e,t,r).updatedState,e=ht.removeElement(e,t,"items",r).updatedState,e.getIn(["scene","groups"]).forEach(i=>e=En.removeElement(e,i.id,t,"items",r).updatedState),{updatedState:e}}static unselect(e,t,r){return e=ht.unselect(e,t,"items",r).updatedState,{updatedState:e}}static selectToolDrawingItem(e,t){return e=e.merge({mode:Dr,drawingSupport:qe({type:t})}),{updatedState:e}}static updateDrawingItem(e,t,r,i){if(e.hasIn(["drawingSupport","currentID"]))e=e.updateIn(["scene","layers",t,"items",e.getIn(["drawingSupport","currentID"])],s=>s.merge({x:r,y:i}));else{let{updatedState:s,item:o}=this.create(e,t,e.getIn(["drawingSupport","type"]),r,i,200,100,0);e=D2.select(s,t,o.id).updatedState,e=e.setIn(["drawingSupport","currentID"],o.id)}return{updatedState:e}}static endDrawingItem(e,t,r,i){return e=this.updateDrawingItem(e,t,r,i).updatedState,e=ht.unselectAll(e,t).updatedState,e=e.merge({drawingSupport:qe({type:e.drawingSupport.get("type")})}),{updatedState:e}}static beginDraggingItem(e,t,r,i,s){let o=e.getIn(["scene","layers",t,"items",r]);return e=e.merge({mode:Yr,draggingSupport:qe({layerID:t,itemID:r,startPointX:i,startPointY:s,originalX:o.x,originalY:o.y})}),{updatedState:e}}static updateDraggingItem(e,t,r){let{draggingSupport:i,scene:s}=e,o=i.get("layerID"),a=i.get("itemID"),l=i.get("startPointX"),c=i.get("startPointY"),h=i.get("originalX"),f=i.get("originalY"),p=l-t,d=c-r,m=s.getIn(["layers",o,"items",a]);return m=m.merge({x:h-p,y:f-d}),e=e.merge({scene:s.mergeIn(["layers",o,"items",a],m)}),{updatedState:e}}static endDraggingItem(e,t,r){return e=this.updateDraggingItem(e,t,r).updatedState,e=e.merge({mode:fn}),{updatedState:e}}static beginRotatingItem(e,t,r,i,s){return e=e.merge({mode:Vi,rotatingSupport:qe({layerID:t,itemID:r})}),{updatedState:e}}static updateRotatingItem(e,t,r){let{rotatingSupport:i,scene:s}=e,o=i.get("layerID"),a=i.get("itemID"),l=e.getIn(["scene","layers",o,"items",a]),c=t-l.x,h=r-l.y,f=Math.atan2(h,c)*180/Math.PI-90;return-5<f&&f<5&&(f=0),-95<f&&f<-85&&(f=-90),-185<f&&f<-175&&(f=-180),85<f&&f<90&&(f=90),-270<f&&f<-265&&(f=90),l=l.merge({rotation:f}),e=e.merge({scene:s.mergeIn(["layers",o,"items",a],l)}),{updatedState:e}}static endRotatingItem(e,t,r){return e=this.updateRotatingItem(e,t,r).updatedState,e=e.merge({mode:fn}),{updatedState:e}}static setProperties(e,t,r,i){return e=e.mergeIn(["scene","layers",t,"items",r,"properties"],i),{updatedState:e}}static setJsProperties(e,t,r,i){return this.setProperties(e,t,r,Dt(i))}static updateProperties(e,t,r,i){return i.forEach((s,o)=>{e.hasIn(["scene","layers",t,"items",r,"properties",o])&&(e=e.mergeIn(["scene","layers",t,"items",r,"properties",o],s))}),{updatedState:e}}static updateJsProperties(e,t,r,i){return this.updateProperties(e,t,r,Dt(i))}static setAttributes(e,t,r,i){return e=e.mergeIn(["scene","layers",t,"items",r],i),{updatedState:e}}static setJsAttributes(e,t,r,i){return i=Dt(i),this.setAttributes(e,t,r,i)}},En=class ah{static select(e,t){let r=e.getIn(["scene","groups",t,"elements"]);e=Yt.setAlterate(e).updatedState,r.entrySeq().forEach(([s,o])=>{e=ht.unselectAll(e,s).updatedState;let a=o.get("lines"),l=o.get("holes"),c=o.get("items"),h=o.get("areas");a&&a.forEach(f=>{e=On.select(e,s,f).updatedState}),l&&l.forEach(f=>{e=Sn.select(e,s,f).updatedState}),c&&c.forEach(f=>{e=Tn.select(e,s,f).updatedState}),h&&h.forEach(f=>{e=js.select(e,s,f).updatedState})}),e=Yt.setAlterate(e).updatedState;let i=e.getIn(["scene","groups"]).map(s=>s.set("selected",!1));return e=e.setIn(["scene","groups"],i).setIn(["scene","groups",t,"selected"],!0),{updatedState:e}}static unselect(e,t){return e=e.getIn(["scene","groups",t,"elements"]).reduce((s,o,a)=>ht.unselectAll(s,a).updatedState,e).setIn(["scene","groups",t,"selected"],!1),{updatedState:e}}static create(e){let t=bi.acquireID();return e=e.setIn(["scene","groups",t],new _f({id:t,name:t})),{updatedState:e}}static createFromSelectedElements(e){let t=bi.acquireID();return e=e.setIn(["scene","groups",t],new _f({id:t,name:t})),e.getIn(["scene","layers"]).forEach(r=>{let i=r.get("id"),s={lines:r.get("lines").filter(o=>o.get("selected")),items:r.get("items").filter(o=>o.get("selected")),holes:r.get("holes").filter(o=>o.get("selected")),areas:r.get("areas").filter(o=>o.get("selected"))};for(let o in s)s[o].forEach(a=>e=this.addElement(e,t,i,o,a.get("id")).updatedState)}),{updatedState:e}}static addElement(e,t,r,i,s){let o=e.getIn(["scene","groups",t,"elements",r,i])||Je();return o.contains(s)||(e=e.setIn(["scene","groups",t,"elements",r,i],o.push(s)),e=this.reloadBaricenter(e,t).updatedState),{updatedState:e}}static setBarycenter(e,t,r,i){return typeof r<"u"&&(e=e.setIn(["scene","groups",t,"x"],r)),typeof i<"u"&&(e=e.setIn(["scene","groups",t,"y"],i)),{updatedState:e}}static reloadBaricenter(e,t){let r=e.getIn(["scene","groups",t,"elements"]),i=0,s=0,o=0;return r.entrySeq().forEach(([a,l])=>{e=ht.unselectAll(e,a).updatedState;let c=l.get("lines"),h=l.get("holes"),f=l.get("items"),p=l.get("areas");c&&c.forEach(d=>{let m=e.getIn(["scene","layers",a,"lines",d,"vertices"]).map(S=>e.getIn(["scene","layers",a,"vertices",S])),{x,y:v}=m.get(0),{x:_,y:E}=m.get(1),{x:M,y:b}=Jy(x,v,_,E);i+=M,s+=b,o++}),h&&h.forEach(d=>{let m=e.getIn(["scene","layers",a,"holes",d]),x=e.getIn(["scene","layers",a,"lines",m.line,"vertices"]).map(T=>e.getIn(["scene","layers",a,"vertices",T])),{x:v,y:_}=x.get(0),{x:E,y:M}=x.get(1),{x:b,y:S}=yc(v,_,E,M,m.offset*Bn(v,_,E,M));i+=b,s+=S,o++}),f&&f.forEach(d=>{let{x:m,y:x}=e.getIn(["scene","layers",a,"items",d]);i+=m,s+=x,o++}),p&&p.forEach(d=>{let m=e.getIn(["scene","layers",a,"areas",d,"vertices"]).map(_=>e.getIn(["scene","layers",a,"vertices",_])).toJS(),{x,y:v}=Qy(m);i+=x,s+=v,o++})}),o&&(e=this.setBarycenter(e,t,i/o,s/o).updatedState),{updatedState:e}}static removeElement(e,t,r,i,s){let o=e.getIn(["scene","groups",t,"elements",r,i]);return!o||!o.contains(s)?{updatedState:e}:(e=e.setIn(["scene","groups",t,"elements",r,i],o.filterNot(a=>a===s)),{updatedState:e})}static setAttributes(e,t,r){return e=e.mergeIn(["scene","groups",t],r),{updatedState:e}}static setProperties(e,t,r){return e=e.mergeIn(["scene","groups",t,"properties"],r),{updatedState:e}}static remove(e,t){return e=e.removeIn(["scene","groups",t]),{updatedState:e}}static removeAndDeleteElements(e,t){return e.getIn(["scene","groups",t,"elements"]).entrySeq().forEach(([i,s])=>{e=ht.unselectAll(e,i).updatedState;let o=s.get("lines"),a=s.get("holes"),l=s.get("items");s.get("areas"),o&&o.forEach(c=>{e=On.remove(e,i,c).updatedState,e=ht.detectAndUpdateAreas(e,i).updatedState}),a&&a.forEach(c=>{e=Sn.remove(e,i,c).updatedState}),l&&l.forEach(c=>{e=Tn.remove(e,i,c).updatedState})}),e=e.deleteIn(["scene","groups",t]),{updatedState:e}}static translate(e,t,r,i){let s=r-e.getIn(["scene","groups",t,"x"]),o=i-e.getIn(["scene","groups",t,"y"]);return e.getIn(["scene","groups",t,"elements"]).entrySeq().forEach(([l,c])=>{let h=c.get("lines"),f=c.get("items");if(h){let p={};h.forEach(d=>{let m=e.getIn(["scene","layers",l,"lines",d]);p[m.vertices.get(0)]||(p[m.vertices.get(0)]=e.getIn(["scene","layers",l,"vertices",m.vertices.get(0)])),p[m.vertices.get(1)]||(p[m.vertices.get(1)]=e.getIn(["scene","layers",l,"vertices",m.vertices.get(1)]))});for(let d in p){let{x:m,y:x}=p[d];e=gn.setAttributes(e,l,d,qe({x:m+s,y:x+o})).updatedState}for(let d in p)e=gn.beginDraggingVertex(e,l,d).updatedState,e=gn.endDraggingVertex(e).updatedState}f&&(e=f.map(p=>e.getIn(["scene","layers",l,"items",p])).reduce((p,d)=>{let{x:m,y:x}=d;return Tn.setAttributes(p,l,d.id,qe({x:m+s,y:x+o})).updatedState},e)),e=ht.detectAndUpdateAreas(e,l).updatedState}),e=this.setBarycenter(e,t,r,i).updatedState,e=ah.select(e,t).updatedState,{updatedState:e}}static rotate(e,t,r){let{x:i,y:s,rotation:o}=e.getIn(["scene","groups",t]),a=r-o;return e=ah.setAttributes(e,t,qe({rotation:r})).updatedState,e.getIn(["scene","groups",t,"elements"]).entrySeq().forEach(([c,h])=>{let f=h.get("lines"),p=h.get("items");if(f){let d={};f.forEach(m=>{let x=e.getIn(["scene","layers",c,"lines",m]);d[x.vertices.get(0)]||(d[x.vertices.get(0)]=e.getIn(["scene","layers",c,"vertices",x.vertices.get(0)])),d[x.vertices.get(1)]||(d[x.vertices.get(1)]=e.getIn(["scene","layers",c,"vertices",x.vertices.get(1)]))});for(let m in d){let{x,y:v}=d[m],{x:_,y:E}=K0(x,v,i,s,a);e=gn.setAttributes(e,c,m,qe({x:_,y:E})).updatedState}for(let m in d)e=gn.beginDraggingVertex(e,c,m).updatedState,e=gn.endDraggingVertex(e).updatedState}p&&(e=p.map(d=>e.getIn(["scene","layers",c,"items",d])).reduce((d,m)=>{let{x,y:v,rotation:_}=m,{x:E,y:M}=K0(x,v,i,s,a);return Tn.setAttributes(d,c,m.id,qe({x:E,y:M,rotation:_+a})).updatedState},e)),e=ht.detectAndUpdateAreas(e,c).updatedState}),e=ah.select(e,t).updatedState,{updatedState:e}}},On=class Gr{static create(e,t,r,i,s,o,a,l){let c=bi.acquireID(),{updatedState:h,vertex:f}=gn.add(e,t,i,s,"lines",c),{updatedState:p,vertex:d}=gn.add(h,t,o,a,"lines",c);e=p;let m=e.catalog.factoryElement(r,{id:c,name:Ac.generateName("lines",e.catalog.getIn(["elements",r,"info","title"])),vertices:Je([f.id,d.id]),type:r},l);return e=e.setIn(["scene","layers",t,"lines",c],m),{updatedState:e,line:m}}static select(e,t,r){e=ht.select(e,t).updatedState;let i=e.getIn(["scene","layers",t,"lines",r]);return e=ht.selectElement(e,t,"lines",r).updatedState,e=ht.selectElement(e,t,"vertices",i.vertices.get(0)).updatedState,e=ht.selectElement(e,t,"vertices",i.vertices.get(1)).updatedState,{updatedState:e}}static remove(e,t,r){let i=e.getIn(["scene","layers",t,"lines",r]);return i&&(e=this.unselect(e,t,r).updatedState,i.holes.forEach(s=>e=Sn.remove(e,t,s).updatedState),e=ht.removeElement(e,t,"lines",r).updatedState,i.vertices.forEach(s=>e=gn.remove(e,t,s,"lines",r).updatedState),e.getIn(["scene","groups"]).forEach(s=>e=En.removeElement(e,s.id,t,"lines",r).updatedState)),{updatedState:e}}static unselect(e,t,r){let i=e.getIn(["scene","layers",t,"lines",r]);return i&&(e=ht.unselect(e,t,"vertices",i.vertices.get(0)).updatedState,e=ht.unselect(e,t,"vertices",i.vertices.get(1)).updatedState,e=ht.unselect(e,t,"lines",r).updatedState),{updatedState:e}}static split(e,t,r,i,s){let o=e.getIn(["scene","layers",t,"lines",r]),a=e.getIn(["scene","layers",t,"vertices",o.vertices.get(0)]),l=e.getIn(["scene","layers",t,"vertices",o.vertices.get(1)]),{x:c,y:h}=a,{x:f,y:p}=l,{updatedState:d,line:m}=Gr.create(e,t,o.type,c,h,i,s,o.get("properties")),{updatedState:x,line:v}=Gr.create(d,t,o.type,f,p,i,s,o.get("properties"));e=x;let _=Vn(c,h,f,p,i,s),E=gc(a,l);return o.holes.forEach(b=>{let S=e.getIn(["scene","layers",t,"holes",b]),T=S.offset;if(E.x===f&&E.y===p&&(_=1-_,T=1-S.offset),T<_){let q=T/_;E.x===f&&E.y===p&&(q=1-q),e=Sn.create(e,t,S.type,m.id,q,S.properties).updatedState}else{let q=(T-_)/(1-_);E.x===f&&E.y===p&&(q=1-q),e=Sn.create(e,t,S.type,v.id,q,S.properties).updatedState}}),e.getIn(["scene","groups"]).filter(b=>{const S=b.getIn(["elements",t,"lines"]);return S&&S.contains(r)}).forEach(b=>{e=En.addElement(e,b.id,t,"lines",m.id).updatedState,e=En.addElement(e,b.id,t,"lines",v.id).updatedState}),e=Gr.remove(e,t,r).updatedState,{updatedState:e,lines:Je([m,v])}}static addFromPoints(e,t,r,i,s,o){i=Je(i).sort(({x:c,y:h},{x:f,y:p})=>c===f?h-p:c-f);let a=i.zip(i.skip(1)).filterNot(([{x:c,y:h},{x:f,y:p}])=>c===f&&h===p),l=[];return a.forEach(([{x:c,y:h},{x:f,y:p}])=>{let{updatedState:d,line:m}=this.create(e,t,r,c,h,f,p,s);e=d,o&&o.forEach(x=>{let{x:v,y:_}=x.offsetPosition;if(Gy(c,h,f,p,v,_)){let E=Vn(c,h,f,p,v,_);E>=0&&E<=1&&(e=Sn.create(e,t,x.hole.type,m.id,E,x.hole.properties).updatedState)}}),l.push(m)}),{updatedState:e,lines:Je(l)}}static createAvoidingIntersections(e,t,r,i,s,o,a,l,c){let h=[{x:i,y:s},{x:o,y:a}];e=e.getIn(["scene","layers",t,"lines"]).reduce((d,m)=>{var M,b;let[x,v]=m.vertices.map(S=>d.getIn(["scene","layers",t,"vertices"]).get(S)).toArray(),_=Zr(x,h[0])||Zr(x,h[1])||Zr(v,h[0])||Zr(v,h[1]),E=Hy(h[0],h[1],x,v);if(E.type==="colinear"){c||(c=[]);const S=al(h);d.getIn(["scene","layers",t,"lines",m.id,"holes"]).forEach(T=>{let q=d.getIn(["scene","layers",t,"holes",T]),O=Bn(x.x,x.y,v.x,v.y),A=Zr(S[1],m.vertices.get(1))?1-q.offset:q.offset,L=yc(x.x,x.y,v.x,v.y,O*A);c.push({hole:q,offsetPosition:L})}),d=this.remove(d,t,m.id).updatedState,h.push(x,v)}return E.type==="intersecting"&&!_&&(d=this.split(d,t,m.id,((M=E.point)==null?void 0:M.x)??0,((b=E.point)==null?void 0:b.y)??0).updatedState,h.push(E.point??{x:0,y:0})),d},e);let{updatedState:f,lines:p}=Gr.addFromPoints(e,t,r,h,l,c);return{updatedState:f,lines:p}}static replaceVertex(e,t,r,i,s,o){let a=e.getIn(["scene","layers",t,"lines",r,"vertices",i]);e=gn.remove(e,t,a,"lines",r).updatedState;let{updatedState:l,vertex:c}=gn.add(e,t,s,o,"lines",r);return e=l,e=e.setIn(["scene","layers",t,"lines",r,"vertices",i],c.id),e=e.setIn(["scene","layers",t,"lines",r],e.getIn(["scene","layers",t,"lines",r])),{updatedState:e,line:e.getIn(["scene","layers",t,"lines",r]),vertex:c}}static selectToolDrawingLine(e,t){return e=e.merge({mode:jr,drawingSupport:qe({type:t})}),{updatedState:e}}static beginDrawingLine(e,t,r,i){let s=xf(e.scene,Je(),e.snapMask),o=null;e.snapMask&&!e.snapMask.isEmpty()&&(o=Ei(s,r,i,e.snapMask),o&&({x:r,y:i}=o.point),s=s.withMutations(h=>{let f,p,d;({a:f,b:p,c:d}=vc(i)),Sc(h,f,p,d,10,3,null),{a:f,b:p,c:d}=xc(r),Sc(h,f,p,d,10,3,null)}));let a=e.get("drawingSupport").set("layerID",t);e=ht.unselectAll(e,t).updatedState;let{updatedState:l,line:c}=Gr.create(e,t,a.get("type"),r,i,r,i);return e=Gr.select(l,t,c.id).updatedState,e=e.merge({mode:_r,snapElements:s,activeSnapElement:o?o.snap:null,drawingSupport:a}),{updatedState:e}}static updateDrawingLine(e,t,r){let i=null;e.snapMask&&!e.snapMask.isEmpty()&&(i=Ei(e.snapElements,t,r,e.snapMask),i&&({x:t,y:r}=i.point));let s=e.getIn(["drawingSupport","layerID"]),o=e.getIn(["scene","layers",s,"selected","lines"]).first(),{updatedState:a}=Gr.replaceVertex(e,s,o,1,t,r);return e=a,e=this.select(e,s,o).updatedState,e=e.merge({activeSnapElement:i?i.snap:null}),{updatedState:e}}static endDrawingLine(e,t,r){if(e.snapMask&&!e.snapMask.isEmpty()){let c=Ei(e.snapElements,t,r,e.snapMask);c&&({x:t,y:r}=c.point)}const i=e.getIn(["drawingSupport","layerID"]),s=e.getIn(["scene","layers",i]),o=e.getIn(["scene","layers",i,"selected","lines"]).first(),a=e.getIn(["scene","layers",i,"lines",o]),l=s.vertices.get(a.vertices.get(0));return e=Gr.remove(e,i,o).updatedState,e=Gr.createAvoidingIntersections(e,i,a.type,l.x,l.y,t,r).updatedState,e=ht.detectAndUpdateAreas(e,i).updatedState,e=e.merge({mode:jr,snapElements:Je(),activeSnapElement:null}),{updatedState:e}}static beginDraggingLine(e,t,r,i,s){let o=xf(e.scene,Je(),e.snapMask),a=e.scene.layers.get(t),l=a.lines.get(r),c=a.vertices.get(l.vertices.get(0)),h=a.vertices.get(l.vertices.get(1));return e=e.merge({mode:Xr,snapElements:o,draggingSupport:qe({layerID:t,lineID:r,startPointX:i,startPointY:s,startVertex0X:c.x,startVertex0Y:c.y,startVertex1X:h.x,startVertex1Y:h.y})}),{updatedState:e}}static updateDraggingLine(e,t,r){let i=e.draggingSupport,s=e.snapElements,o=i.get("layerID"),a=i.get("lineID"),l=t-i.get("startPointX"),c=r-i.get("startPointY"),h=i.get("startVertex0X")+l,f=i.get("startVertex0Y")+c,p=i.get("startVertex1X")+l,d=i.get("startVertex1Y")+c,m=null,x=null,v=null;e.snapMask&&!e.snapMask.isEmpty()&&(x=Ei(s,h,f,e.snapMask),v=Ei(s,p,d,e.snapMask));let _=0,E=0;return x&&v?x.point.distance<v.point.distance?(_=x.point.x-h,E=x.point.y-f,m=x.snap):(_=v.point.x-p,E=v.point.y-d,m=v.snap):(x&&(_=x.point.x-h,E=x.point.y-f,m=x.snap),v&&(_=v.point.x-p,E=v.point.y-d,m=v.snap)),h+=_,f+=E,p+=_,d+=E,e=e.merge({activeSnapElement:m,scene:e.scene.updateIn(["layers",o],M=>M.withMutations(b=>{let S=b.getIn(["lines",a,"vertices"]);return b.updateIn(["vertices",S.get(0)],T=>T.merge({x:h,y:f})),b.updateIn(["vertices",S.get(1)],T=>T.merge({x:p,y:d})),b}))}),{updatedState:e}}static endDraggingLine(e,t,r){let{draggingSupport:i}=e,s=i.get("layerID"),o=e.scene.layers.get(s),a=i.get("lineID"),l=o.lines.get(a),c=o.vertices.get(l.vertices.get(0)),h=o.vertices.get(l.vertices.get(1)),f=lf(c,h),p=gc(c,h),d=_c(p,f),m=Math.atan2(f.y-p.y,f.x-p.x),x=[];o.lines.get(a).holes.forEach(q=>{let O=o.holes.get(q),A=d*O.offset,L={x:A*Math.cos(m)+p.x,y:A*Math.sin(m)+p.y};x.push({hole:O,offsetPosition:L})});let v=t-i.get("startPointX"),_=r-i.get("startPointY"),E=i.get("startVertex0X")+v,M=i.get("startVertex0Y")+_,b=i.get("startVertex1X")+v,S=i.get("startVertex1Y")+_;if(e.snapMask&&!e.snapMask.isEmpty()){let q=Ei(e.snapElements,E,M,e.snapMask),O=Ei(e.snapElements,b,S,e.snapMask),A=0,L=0;q&&O?q.point.distance<O.point.distance?(A=q.point.x-E,L=q.point.y-M):(A=O.point.x-b,L=O.point.y-S):(q&&(A=q.point.x-E,L=q.point.y-M),O&&(A=O.point.x-b,L=O.point.y-S)),E+=A,M+=L,b+=A,S+=L}let T=e.getIn(["scene","groups"]).filter(q=>{const O=q.getIn(["elements",s,"lines"]);return O&&O.contains(a)});if(e=ht.mergeEqualsVertices(e,s,l.vertices.get(0)).updatedState,e=ht.mergeEqualsVertices(e,s,l.vertices.get(1)).updatedState,e=Gr.remove(e,s,a).updatedState,!Zr({x:E,y:M},{x:b,y:S})){let q=Gr.createAvoidingIntersections(e,s,l.type,E,M,b,S,l.properties,x);e=q.updatedState,q.lines.forEach(O=>{T.forEach(A=>{e=En.addElement(e,A.id,s,"lines",O.id).updatedState})})}return e=ht.detectAndUpdateAreas(e,s).updatedState,e=e.merge({mode:fn,draggingSupport:null,activeSnapElement:null,snapElements:Je()}),{updatedState:e}}static setProperties(e,t,r,i){return e=e.mergeIn(["scene","layers",t,"lines",r,"properties"],i),{updatedState:e}}static setJsProperties(e,t,r,i){return this.setProperties(e,t,r,Dt(i))}static updateProperties(e,t,r,i){return i.forEach((s,o)=>{e.hasIn(["scene","layers",t,"lines",r,"properties",o])&&(e=e.mergeIn(["scene","layers",t,"lines",r,"properties",o],s))}),{updatedState:e}}static updateJsProperties(e,t,r,i){return this.updateProperties(e,t,r,Dt(i))}static setAttributes(e,t,r,i){let s=i.toJS(),{vertexOne:o,vertexTwo:a,lineLength:l}=s;return delete s.vertexOne,delete s.vertexTwo,delete s.lineLength,e=e.mergeIn(["scene","layers",t,"lines",r],Dt(s)).mergeIn(["scene","layers",t,"vertices",o.id],{x:o.x,y:o.y}).mergeIn(["scene","layers",t,"vertices",a.id],{x:a.x,y:a.y}).mergeIn(["scene","layers",t,"lines",r,"misc"],qe({_unitLength:l._unit})),e=ht.mergeEqualsVertices(e,t,o.id).updatedState,o.x!=a.x&&o.y!=a.y&&(e=ht.mergeEqualsVertices(e,t,a.id).updatedState),e=ht.detectAndUpdateAreas(e,t).updatedState,{updatedState:e}}static setVerticesCoords(e,t,r,i,s,o,a){let l=e.getIn(["scene","layers",t,"lines",r]);return e=gn.setAttributes(e,t,l.vertices.get(0),qe({x:i,y:s})).updatedState,e=gn.setAttributes(e,t,l.vertices.get(1),qe({x:o,y:a})).updatedState,{updatedState:e}}},gn=class{static add(e,t,r,i,s,o){let a=e.getIn(["scene","layers",t,"vertices"]).find(l=>Zr(l,{x:r,y:i}));return a?a=a.update(s,l=>l.push(o)):a=new Q0({id:bi.acquireID(),name:"Vertex",x:r,y:i,[s]:Je([o])}),e=e.setIn(["scene","layers",t,"vertices",a.id],a),{updatedState:e,vertex:a}}static setAttributes(e,t,r,i){return e=e.mergeIn(["scene","layers",t,"vertices",r],i),{updatedState:e}}static addElement(e,t,r,i,s){return e=e.updateIn(["scene","layers",t,"vertices",r,i],o=>o.push(s)),{updatedState:e}}static removeElement(e,t,r,i,s){let o=e.getIn(["scene","layers",t,"vertices",r,i]).findIndex(a=>a===s);return o!==-1&&(e=e.updateIn(["scene","layers",t,"vertices",r,i],a=>a.remove(o))),{updatedState:e}}static select(e,t,r){return e=e.setIn(["scene","layers",t,"vertices",r,"selected"],!0),e=e.updateIn(["scene","layers",t,"selected","vertices"],i=>i.push(r)),{updatedState:e}}static unselect(e,t,r){return e=e.setIn(["scene","layers",t,"vertices",r,"selected"],!1),e=e.updateIn(["scene","layers",t,"selected","vertices"],i=>i.filter(s=>s.id!==r)),{updatedState:e}}static remove(e,t,r,i,s,o){let a=e.getIn(["scene","layers",t,"vertices",r]);return a&&(i&&s&&(a=a.update(i,c=>{let h=c.findIndex(f=>s===f);return c.delete(h)})),(a.areas.size||a.lines.size)&&!o?e=e.setIn(["scene","layers",t,"vertices",r],a):e=e.deleteIn(["scene","layers",t,"vertices",r])),{updatedState:e}}static beginDraggingVertex(e,t,r){let i=xf(e.scene,Je(),e.snapMask);return e=e.merge({mode:$r,snapElements:i,draggingSupport:qe({layerID:t,vertexID:r,previousMode:e.get("mode")})}),{updatedState:e}}static updateDraggingVertex(e,t,r){let{draggingSupport:i,snapElements:s,scene:o}=e,a=null;e.snapMask&&!e.snapMask.isEmpty()&&(a=Ei(s,t,r,e.snapMask),a&&({x:t,y:r}=a.point));let l=i.get("layerID"),c=i.get("vertexID");return e=e.merge({activeSnapElement:a?a.snap:null,scene:o.mergeIn(["layers",l,"vertices",c],{x:t,y:r})}),{updatedState:e}}static endDraggingVertex(e){let{draggingSupport:t}=e,r=t.get("layerID"),i=t.get("vertexID"),s=e.getIn(["scene","layers",r,"vertices",i,"lines"]);return s&&(e=s.reduce((o,a)=>{if(!o.getIn(["scene","layers",r,"lines",a]))return o;let l=o.getIn(["scene","layers",r,"lines",a,"vertices",0]),c=o.getIn(["scene","layers",r,"lines",a,"vertices",1]),h=l===i?c:l,f=o.getIn(["scene","layers",r,"vertices",h]),p=o.getIn(["scene","layers",r,"vertices",i]),d=[],m=al([f,p]);o.getIn(["scene","layers",r,"lines",a,"holes"]).forEach(E=>{let M=o.getIn(["scene","layers",r,"holes",E]),b=Bn(f.x,f.y,p.x,p.y),S=Zr(m[1],o.getIn(["scene","layers",r,"lines",a,"vertices",1]))?1-M.offset:M.offset,T=yc(f.x,f.y,p.x,p.y,b*S);d.push({hole:M,offsetPosition:T})});let x=o.getIn(["scene","layers",r,"lines",a,"type"]),v=o.getIn(["scene","layers",r,"lines",a,"properties"]),_=o.getIn(["scene","groups"]).filter(E=>{const M=E.getIn(["elements",r,"lines"]);return M&&M.contains(a)});if(o=ht.removeZeroLengthLines(o,r).updatedState,o=ht.mergeEqualsVertices(o,r,i).updatedState,o=On.remove(o,r,a).updatedState,!Zr(f,p)){let E=On.createAvoidingIntersections(o,r,x,f.x,f.y,p.x,p.y,v,d);o=E.updatedState,E.lines.forEach(M=>{_.forEach(b=>{o=En.addElement(o,b.id,r,"lines",M.id).updatedState})})}return o},e)),e=ht.detectAndUpdateAreas(e,r).updatedState,e=e.merge({mode:t.get("previousMode"),draggingSupport:null,activeSnapElement:null,snapElements:Je()}),{updatedState:e}}},js=class{static add(e,t,r,i,s){let o,a=e.getIn(["scene","layers",t]);return a=a.withMutations(l=>{const c=bi.acquireID(),h=i.map(f=>gn.add(e,t,f.x,f.y,"areas",c).vertex.id);o=s.factoryElement(r,{id:c,name:Ac.generateName("areas",s.getIn(["elements",r,"info","title"])),type:r,prototype:"areas",vertices:h}),l.setIn(["areas",c],o)}),e=e.setIn(["scene","layers",t],a),{updatedState:e,area:o}}static select(e,t,r){return e=ht.select(e,t).updatedState,e=ht.selectElement(e,t,"areas",r).updatedState,{updatedState:e}}static remove(e,t,r){let i=e.getIn(["scene","layers",t,"areas",r]);return i.get("selected")===!0&&(e=this.unselect(e,t,r).updatedState),i.vertices.forEach(s=>{e=gn.remove(e,t,s,"areas",r).updatedState}),e=e.deleteIn(["scene","layers",t,"areas",r]),e.getIn(["scene","groups"]).forEach(s=>e=En.removeElement(e,s.id,t,"areas",r).updatedState),{updatedState:e}}static unselect(e,t,r){return e=ht.unselect(e,t,"areas",r).updatedState,{updatedState:e}}static setProperties(e,t,r,i){return e=e.mergeIn(["scene","layers",t,"areas",r,"properties"],i),{updatedState:e}}static setJsProperties(e,t,r,i){return this.setProperties(e,t,r,Dt(i))}static updateProperties(e,t,r,i){return i.forEach((s,o)=>{e.hasIn(["scene","layers",t,"areas",r,"properties",o])&&(e=e.mergeIn(["scene","layers",t,"areas",r,"properties",o],s))}),{updatedState:e}}static updateJsProperties(e,t,r,i){return this.updateProperties(e,t,r,Dt(i))}static setAttributes(e){return{updatedState:e}}};const Pg=(n,e)=>n.size===e.size&&n.isSuperset(e)&&n.isSubset(e);let ht=class{static create(e,t,r){let i=bi.acquireID();t=t||`layer ${i}`,r=r||0;let s=new gf({id:i,name:t,altitude:r});return e=e.setIn(["scene","selectedLayer"],i),e=e.setIn(["scene","layers",i],s),{updatedState:e}}static select(e,t){return e.get("alterate")||(e=Yt.unselectAll(e).updatedState),e=e.setIn(["scene","selectedLayer"],t),{updatedState:e}}static selectElement(e,t,r,i){return e=e.setIn(["scene","layers",t,r,i,"selected"],!0),e=e.updateIn(["scene","layers",t,"selected",r],s=>s.push(i)),{updatedState:e}}static unselect(e,t,r,i){return e=e.setIn(["scene","layers",t,r,i,"selected"],!1),e=e.updateIn(["scene","layers",t,"selected",r],s=>s.filter(o=>o.id===i)),{updatedState:e}}static unselectAll(e,t){let{lines:r,holes:i,items:s,areas:o}=e.getIn(["scene","layers",t]);return r&&r.forEach(a=>{e=On.unselect(e,t,a.id).updatedState}),i&&i.forEach(a=>{e=Sn.unselect(e,t,a.id).updatedState}),s&&s.forEach(a=>{e=Tn.unselect(e,t,a.id).updatedState}),o&&o.forEach(a=>{e=js.unselect(e,t,a.id).updatedState}),{updatedState:e}}static setProperties(e,t,r){return e=e.mergeIn(["scene","layers",t],r),e=e.updateIn(["scene","layers"],i=>i.sort((s,o)=>s.altitude!==o.altitude?s.altitude-o.altitude:s.order-o.order)),{updatedState:e}}static remove(e,t){return e=e.removeIn(["scene","layers",t]),e=e.setIn(["scene","selectedLayer"],e.scene.selectedLayer!==t?e.scene.selectedLayer:e.scene.layers.first().id),{updatedState:e}}static removeElement(e,t,r,i){return e=e.deleteIn(["scene","layers",t,r,i]),{updatedState:e}}static detectAndUpdateAreas(e,t){let r=[],i,s={},o={};e.getIn(["scene","layers",t,"vertices"]).forEach(d=>{let x=r.push([d.x,d.y])-1;s[d.id]=x,o[x]=d.id}),i=e.getIn(["scene","layers",t,"lines"]).map(d=>d.vertices.map(m=>s[m]).toArray());const a=x3(r,i);let l=Je(a).map(d=>Je(d.map(m=>o[m])));l=l.map(d=>y3(d.map(m=>e.getIn(["scene","layers",t,"vertices",m])))?d.reverse():d);const c=[];e.getIn(["scene","layers",t,"areas"]).forEach(d=>{l.some(x=>Pg(x,d.vertices))||(e=js.remove(e,t,d.id).updatedState)}),l.forEach((d,m)=>{const x=e.getIn(["scene","layers",t,"areas"]).find(v=>Pg(v.vertices,d));if(x)c[m]=x.id,e=e.setIn(["scene","layers",t,"areas",c[m],"holes"],Je());else{const v=d.map(E=>e.getIn(["scene","layers",t,"vertices",E])),_=js.add(e,t,"area",v,e.catalog);c[m]=_.area.id,e=_.updatedState}});let h=c.map(d=>{let m=e.getIn(["scene","layers",t,"areas",d]).vertices.map(x=>{let{x:v,y:_}=e.getIn(["scene","layers",t,"vertices",x]);return Je([v,_])});return{id:d,vertices:m}}),f,p;for(f=0;f<h.length;f++){let d=Je(),m=h[f].vertices.flatten().toArray();for(p=0;p<h.length;p++)f!==p&&Yy(m,h[p].vertices.get(0).get(0),h[p].vertices.get(0).get(1))&&(d=d.push(h[p].id));e=e.setIn(["scene","layers",t,"areas",h[f].id,"holes"],d)}return c.forEach(d=>{let m=new Set,x=e.getIn(["scene","layers",t,"areas",d,"holes"]);x.forEach(v=>{e.getIn(["scene","layers",t,"areas",v,"holes"]).forEach(E=>{x.indexOf(E)!==-1&&m.add(E)})}),m.forEach(v=>{x=x.remove(x.indexOf(v))}),e=e.setIn(["scene","layers",t,"areas",d,"holes"],x)}),{updatedState:e}}static removeZeroLengthLines(e,t){return{updatedState:e.getIn(["scene","layers",t,"lines"]).reduce((i,s)=>{let o=s.getIn(["vertices",0]),a=s.getIn(["vertices",1]),l=i.getIn(["scene","layers",t,"vertices",o]),c=i.getIn(["scene","layers",t,"vertices",a]);return _c(l,c)===0&&(i=On.remove(i,t,s.id).updatedState),i},e)}}static mergeEqualsVertices(e,t,r){let i=e.getIn(["scene","layers",t,"vertices",r]),s=e.getIn(["scene","layers",t,"vertices"]).filter(o=>o.id!==r&&Zr(i,o));return s.isEmpty()?{updatedState:e}:(s.forEach(o=>{let a=o.lines.reduce((c,h)=>(c=c.updateIn(["scene","layers",t,"lines",h,"vertices"],f=>{if(f)return f.map(p=>p===o.id?r:p)}),c=gn.addElement(c,t,r,"lines",h).updatedState,c),e),l=o.areas.reduce((c,h)=>(c=c.updateIn(["scene","layers",t,"areas",h,"vertices"],f=>{if(f)return f.map(p=>p===o.id?r:p)}),c=gn.addElement(c,t,r,"areas",h).updatedState,c),a);e=gn.remove(l,t,o.id,null,null,!0).updatedState}),{updatedState:e})}static setPropertiesOnSelected(e,t,r){let i=e.getIn(["scene","layers",t,"selected"]);return i.lines.forEach(s=>e=On.setProperties(e,t,s,r).updatedState),i.holes.forEach(s=>e=Sn.setProperties(e,t,s,r).updatedState),i.areas.forEach(s=>e=js.setProperties(e,t,s,r).updatedState),i.items.forEach(s=>e=Tn.setProperties(e,t,s,r).updatedState),{updatedState:e}}static updatePropertiesOnSelected(e,t,r){let i=e.getIn(["scene","layers",t,"selected"]);return i.lines.forEach(s=>e=On.updateProperties(e,t,s,r).updatedState),i.holes.forEach(s=>e=Sn.updateProperties(e,t,s,r).updatedState),i.areas.forEach(s=>e=js.updateProperties(e,t,s,r).updatedState),i.items.forEach(s=>e=Tn.updateProperties(e,t,s,r).updatedState),{updatedState:e}}static setAttributesOnSelected(e,t,r){let i=e.getIn(["scene","layers",t,"selected"]);return i.lines.forEach(s=>e=On.setAttributes(e,t,s,r).updatedState),i.holes.forEach(s=>e=Sn.setAttributes(e,t,s,r).updatedState),i.items.forEach(s=>e=Tn.setAttributes(e,t,s,r).updatedState),{updatedState:e}}};class Cc{static create(e,t){let r=bi.acquireID();return e=e.setIn(["scene","guides","horizontal",r],t),{updatedState:e}}static remove(e,t){return e=e.deleteIn(["scene","guides","horizontal",t]),{updatedState:e}}}class Rc{static create(e,t){let r=bi.acquireID();return e=e.setIn(["scene","guides","vertical",r],t),{updatedState:e}}static remove(e,t){return e=e.deleteIn(["scene","guides","vertical",t]),{updatedState:e}}}class Yt{static setAlterate(e){return{updatedState:e.set("alterate",!e.alterate)}}static openCatalog(e){return e=this.setMode(e,sf).updatedState,{updatedState:e}}static newProject(e){return e=new bc({viewer2D:e.get("viewer2D")}),{updatedState:e}}static loadProject(e,t){return e=new bc({scene:t,catalog:e.catalog.toJS()}),{updatedState:e}}static setProperties(e,t,r){return e=ht.setPropertiesOnSelected(e,t,r).updatedState,{updatedState:e}}static updateProperties(e,t,r){return e=ht.updatePropertiesOnSelected(e,t,r).updatedState,{updatedState:e}}static setItemsAttributes(e,t){return e.getIn(["scene","layers"]).forEach(r=>{e=ht.setAttributesOnSelected(e,r.id,t).updatedState}),{updatedState:e}}static setLinesAttributes(e,t){return e.getIn(["scene","layers"]).forEach(r=>{e=ht.setAttributesOnSelected(e,r.id,t).updatedState}),{updatedState:e}}static setHolesAttributes(e,t){return e.getIn(["scene","layers"]).forEach(r=>{e=ht.setAttributesOnSelected(e,r.id,t).updatedState}),{updatedState:e}}static unselectAll(e){return e.getIn(["scene","layers"]).forEach(({id:t})=>{e=ht.unselectAll(e,t).updatedState}),e.getIn(["scene","groups"]).forEach(t=>{e=En.unselect(e,t.get("id")).updatedState}),{updatedState:e}}static remove(e){let t=e.getIn(["scene","selectedLayer"]),{lines:r,holes:i,items:s}=e.getIn(["scene","layers",t,"selected"]);return e=ht.unselectAll(e,t).updatedState,r.forEach(o=>{e=On.remove(e,t,o).updatedState}),i.forEach(o=>{e=Sn.remove(e,t,o).updatedState}),s.forEach(o=>{e=Tn.remove(e,t,o).updatedState}),e=ht.detectAndUpdateAreas(e,t).updatedState,{updatedState:e}}static undo(e){let t=e.sceneHistory;return e.scene===t.last&&t.list.size>1&&(t=vg(t)),e=e.merge({mode:fn,scene:t.last,sceneHistory:vg(t)}),{updatedState:e}}static redo(e){let t=e.sceneHistory;return e.scene===t.last&&t.redoList.size>0&&(t=L3(t)),e=e.merge({mode:fn,scene:t.last,sceneHistory:t}),{updatedState:e}}static rollback(e){let t=e.sceneHistory;return!t.last&&t.list.isEmpty()?{updatedState:e}:(e=this.unselectAll(e).updatedState,e=e.merge({mode:fn,scene:t.last,sceneHistory:mn(t,t.last),snapElements:Je(),activeSnapElement:null,drawingSupport:qe(),draggingSupport:qe(),rotatingSupport:qe()}),{updatedState:e})}static setProjectProperties(e,t){let r=e.scene.merge(t);return e=e.merge({mode:fn,scene:r}),{updatedState:e}}static openProjectConfigurator(e){return e=e.merge({mode:X0}),{updatedState:e}}static initCatalog(e,t){return e=e.set("catalog",new vf(t)),{updatedState:e}}static updateMouseCoord(e,t){return e=e.set("mouse",qe(t)),{updatedState:e}}static updateZoomScale(e,t){return e=e.set("zoom",t),{updatedState:e}}static toggleSnap(e,t){return e=e.set("snapMask",t),{updatedState:e}}static throwError(e,t){return e=e.set("errors",e.get("errors").push({date:Date.now(),error:t})),{updatedState:e}}static throwWarning(e,t){return e=e.set("warnings",e.get("warnings").push({date:Date.now(),warning:t})),{updatedState:e}}static copyProperties(e,t){return e=e.set("clipboardProperties",t),{updatedState:e}}static pasteProperties(e){return e=this.updateProperties(e,e.getIn(["scene","selectedLayer"]),e.get("clipboardProperties")).updatedState,{updatedState:e}}static pushLastSelectedCatalogElementToHistory(e,t){let r=e.selectedElementsHistory,i=r.findIndex(s=>s.name===t.name);return i!==-1&&(r=r.splice(i,1)),r=r.splice(0,0,t),e=e.set("selectedElementsHistory",r),{updatedState:e}}static changeCatalogPage(e,t,r){return e=e.setIn(["catalog","page"],r).updateIn(["catalog","path"],i=>i.push(t)),{updatedState:e}}static goBackToCatalogPage(e,t){let r=e.catalog.path.findIndex(i=>i===t);return e=e.setIn(["catalog","page"],t).updateIn(["catalog","path"],i=>i.take(r)),{updatedState:e}}static setMode(e,t){return e=e.set("mode",t),{updatedState:e}}static addHorizontalGuide(e,t){return e=Cc.create(e,t).updatedState,{updatedState:e}}static addVerticalGuide(e,t){return e=Rc.create(e,t).updatedState,{updatedState:e}}static addCircularGuide(e,t,r,i){return console.log("adding horizontal guide at",t,r,i),{updatedState:e}}static removeHorizontalGuide(e,t){return e=Cc.remove(e,t).updatedState,{updatedState:e}}static removeVerticalGuide(e,t){return e=Rc.remove(e,t).updatedState,{updatedState:e}}static removeCircularGuide(e,t){return console.log("removeing horizontal guide ",t),{updatedState:e}}}var Pc={exports:{}},Ic={exports:{}},Ft={};/** @license React v16.13.1
45
+ */var La="delete",zt=5,sr=1<<zt,kn=sr-1,Mt={};function lh(){return{value:!1}}function Sr(n){n&&(n.value=!0)}function ch(){}function lo(n){return n.size===void 0&&(n.size=n.__iterate(qm)),n.size}function ts(n,e){if(typeof e!="number"){var t=e>>>0;if(""+t!==e||t===4294967295)return NaN;e=t}return e<0?lo(n)+e:e}function qm(){return!0}function Oa(n,e,t){return(n===0&&!Nm(n)||t!==void 0&&n<=-t)&&(e===void 0||t!==void 0&&e>=t)}function co(n,e){return Dm(n,e,0)}function qa(n,e){return Dm(n,e,e)}function Dm(n,e,t){return n===void 0?t:Nm(n)?e===1/0?e:Math.max(0,e+n)|0:e===void 0||e===n?n:Math.min(e,n)|0}function Nm(n){return n<0||n===0&&1/n===-1/0}var Um="@@__IMMUTABLE_ITERABLE__@@";function Kn(n){return!!(n&&n[Um])}var jl="@@__IMMUTABLE_KEYED__@@";function kt(n){return!!(n&&n[jl])}var Xl="@@__IMMUTABLE_INDEXED__@@";function Bn(n){return!!(n&&n[Xl])}function $l(n){return kt(n)||Bn(n)}var bn=function(e){return Kn(e)?e:gn(e)},Er=(function(n){function e(t){return kt(t)?t:is(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e})(bn),Rs=(function(n){function e(t){return Bn(t)?t:Mr(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e})(bn),uo=(function(n){function e(t){return Kn(t)&&!$l(t)?t:po(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e})(bn);bn.Keyed=Er,bn.Indexed=Rs,bn.Set=uo;var Fm="@@__IMMUTABLE_SEQ__@@";function Yl(n){return!!(n&&n[Fm])}var zm="@@__IMMUTABLE_RECORD__@@";function ns(n){return!!(n&&n[zm])}function br(n){return Kn(n)||ns(n)}var rs="@@__IMMUTABLE_ORDERED__@@";function Nr(n){return!!(n&&n[rs])}var ho=0,or=1,ar=2,uh=typeof Symbol=="function"&&Symbol.iterator,km="@@iterator",Kl=uh||km,Tt=function(e){this.next=e};Tt.prototype.toString=function(){return"[Iterator]"},Tt.KEYS=ho,Tt.VALUES=or,Tt.ENTRIES=ar,Tt.prototype.inspect=Tt.prototype.toSource=function(){return this.toString()},Tt.prototype[Kl]=function(){return this};function Yt(n,e,t,r){var i=n===ho?e:n===or?t:[e,t];return r?r.value=i:r={value:i,done:!1},r}function Pn(){return{value:void 0,done:!0}}function hh(n){return Array.isArray(n)?!0:!!Zl(n)}function Bm(n){return n&&typeof n.next=="function"}function fh(n){var e=Zl(n);return e&&e.call(n)}function Zl(n){var e=n&&(uh&&n[uh]||n[km]);if(typeof e=="function")return e}function H2(n){var e=Zl(n);return e&&e===n.entries}function G2(n){var e=Zl(n);return e&&e===n.keys}var fo=Object.prototype.hasOwnProperty;function dh(n){return Array.isArray(n)||typeof n=="string"?!0:n&&typeof n=="object"&&Number.isInteger(n.length)&&n.length>=0&&(n.length===0?Object.keys(n).length===1:n.hasOwnProperty(n.length-1))}var gn=(function(n){function e(t){return t==null?mh():br(t)?t.toSeq():j2(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.toSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq {","}")},e.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},e.prototype.__iterate=function(r,i){var s=this._cache;if(s){for(var o=s.length,a=0;a!==o;){var l=s[i?o-++a:a++];if(r(l[1],l[0],this)===!1)break}return a}return this.__iterateUncached(r,i)},e.prototype.__iterator=function(r,i){var s=this._cache;if(s){var o=s.length,a=0;return new Tt(function(){if(a===o)return Pn();var l=s[i?o-++a:a++];return Yt(r,l[0],l[1])})}return this.__iteratorUncached(r,i)},e})(bn),is=(function(n){function e(t){return t==null?mh().toKeyedSeq():Kn(t)?kt(t)?t.toSeq():t.fromEntrySeq():ns(t)?t.toSeq():gh(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.toKeyedSeq=function(){return this},e})(gn),Mr=(function(n){function e(t){return t==null?mh():Kn(t)?kt(t)?t.entrySeq():t.toIndexedSeq():ns(t)?t.toSeq().entrySeq():Hm(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toIndexedSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq [","]")},e})(gn),po=(function(n){function e(t){return(Kn(t)&&!$l(t)?t:Mr(t)).toSetSeq()}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toSetSeq=function(){return this},e})(gn);gn.isSeq=Yl,gn.Keyed=is,gn.Set=po,gn.Indexed=Mr,gn.prototype[Fm]=!0;var mo=(function(n){function e(t){this._array=t,this.size=t.length}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.get=function(r,i){return this.has(r)?this._array[ts(this,r)]:i},e.prototype.__iterate=function(r,i){for(var s=this._array,o=s.length,a=0;a!==o;){var l=i?o-++a:a++;if(r(s[l],l,this)===!1)break}return a},e.prototype.__iterator=function(r,i){var s=this._array,o=s.length,a=0;return new Tt(function(){if(a===o)return Pn();var l=i?o-++a:a++;return Yt(r,l,s[l])})},e})(Mr),ph=(function(n){function e(t){var r=Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]);this._object=t,this._keys=r,this.size=r.length}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.get=function(r,i){return i!==void 0&&!this.has(r)?i:this._object[r]},e.prototype.has=function(r){return fo.call(this._object,r)},e.prototype.__iterate=function(r,i){for(var s=this._object,o=this._keys,a=o.length,l=0;l!==a;){var c=o[i?a-++l:l++];if(r(s[c],c,this)===!1)break}return l},e.prototype.__iterator=function(r,i){var s=this._object,o=this._keys,a=o.length,l=0;return new Tt(function(){if(l===a)return Pn();var c=o[i?a-++l:l++];return Yt(r,c,s[c])})},e})(is);ph.prototype[rs]=!0;var W2=(function(n){function e(t){this._collection=t,this.size=t.length||t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.__iterateUncached=function(r,i){if(i)return this.cacheResult().__iterate(r,i);var s=this._collection,o=fh(s),a=0;if(Bm(o))for(var l;!(l=o.next()).done&&r(l.value,a++,this)!==!1;);return a},e.prototype.__iteratorUncached=function(r,i){if(i)return this.cacheResult().__iterator(r,i);var s=this._collection,o=fh(s);if(!Bm(o))return new Tt(Pn);var a=0;return new Tt(function(){var l=o.next();return l.done?l:Yt(r,a++,l.value)})},e})(Mr),Vm;function mh(){return Vm||(Vm=new mo([]))}function gh(n){var e=_h(n);if(e)return e.fromEntrySeq();if(typeof n=="object")return new ph(n);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+n)}function Hm(n){var e=_h(n);if(e)return e;throw new TypeError("Expected Array or collection object of values: "+n)}function j2(n){var e=_h(n);if(e)return H2(n)?e.fromEntrySeq():G2(n)?e.toSetSeq():e;if(typeof n=="object")return new ph(n);throw new TypeError("Expected Array or collection object of values, or keyed object: "+n)}function _h(n){return dh(n)?new mo(n):hh(n)?new W2(n):void 0}var Gm="@@__IMMUTABLE_MAP__@@";function Jl(n){return!!(n&&n[Gm])}function vh(n){return Jl(n)&&Nr(n)}function xh(n){return!!(n&&typeof n.equals=="function"&&typeof n.hashCode=="function")}function Kt(n,e){if(n===e||n!==n&&e!==e)return!0;if(!n||!e)return!1;if(typeof n.valueOf=="function"&&typeof e.valueOf=="function"){if(n=n.valueOf(),e=e.valueOf(),n===e||n!==n&&e!==e)return!0;if(!n||!e)return!1}return!!(xh(n)&&xh(e)&&n.equals(e))}var Da=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(e,t){e|=0,t|=0;var r=e&65535,i=t&65535;return r*i+((e>>>16)*i+r*(t>>>16)<<16>>>0)|0};function Ql(n){return n>>>1&1073741824|n&3221225471}var X2=Object.prototype.valueOf;function Zn(n){if(n==null)return Wm(n);if(typeof n.hashCode=="function")return Ql(n.hashCode(n));var e=Q2(n);if(e==null)return Wm(e);switch(typeof e){case"boolean":return e?1108378657:1108378656;case"number":return $2(e);case"string":return e.length>ey?Y2(e):yh(e);case"object":case"function":return Z2(e);case"symbol":return K2(e);default:if(typeof e.toString=="function")return yh(e.toString());throw new Error("Value type "+typeof e+" cannot be hashed.")}}function Wm(n){return n===null?1108378658:1108378659}function $2(n){if(n!==n||n===1/0)return 0;var e=n|0;for(e!==n&&(e^=n*4294967295);n>4294967295;)n/=4294967295,e^=n;return Ql(e)}function Y2(n){var e=wh[n];return e===void 0&&(e=yh(n),Mh===ty&&(Mh=0,wh={}),Mh++,wh[n]=e),e}function yh(n){for(var e=0,t=0;t<n.length;t++)e=31*e+n.charCodeAt(t)|0;return Ql(e)}function K2(n){var e=Ym[n];return e!==void 0||(e=$m(),Ym[n]=e),e}function Z2(n){var e;if(Sh&&(e=Eh.get(n),e!==void 0)||(e=n[Ps],e!==void 0)||!Xm&&(e=n.propertyIsEnumerable&&n.propertyIsEnumerable[Ps],e!==void 0||(e=J2(n),e!==void 0)))return e;if(e=$m(),Sh)Eh.set(n,e);else{if(jm!==void 0&&jm(n)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(Xm)Object.defineProperty(n,Ps,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(n.propertyIsEnumerable!==void 0&&n.propertyIsEnumerable===n.constructor.prototype.propertyIsEnumerable)n.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},n.propertyIsEnumerable[Ps]=e;else if(n.nodeType!==void 0)n[Ps]=e;else throw new Error("Unable to set a non-enumerable property on object.")}return e}var jm=Object.isExtensible,Xm=(function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}})();function J2(n){if(n&&n.nodeType>0)switch(n.nodeType){case 1:return n.uniqueID;case 9:return n.documentElement&&n.documentElement.uniqueID}}function Q2(n){return n.valueOf!==X2&&typeof n.valueOf=="function"?n.valueOf(n):n}function $m(){var n=++bh;return bh&1073741824&&(bh=0),n}var Sh=typeof WeakMap=="function",Eh;Sh&&(Eh=new WeakMap);var Ym=Object.create(null),bh=0,Ps="__immutablehash__";typeof Symbol=="function"&&(Ps=Symbol(Ps));var ey=16,ty=255,Mh=0,wh={},ec=(function(n){function e(t,r){this._iter=t,this._useKeys=r,this.size=t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.get=function(r,i){return this._iter.get(r,i)},e.prototype.has=function(r){return this._iter.has(r)},e.prototype.valueSeq=function(){return this._iter.valueSeq()},e.prototype.reverse=function(){var r=this,i=Th(this,!0);return this._useKeys||(i.valueSeq=function(){return r._iter.toSeq().reverse()}),i},e.prototype.map=function(r,i){var s=this,o=e0(this,r,i);return this._useKeys||(o.valueSeq=function(){return s._iter.toSeq().map(r,i)}),o},e.prototype.__iterate=function(r,i){var s=this;return this._iter.__iterate(function(o,a){return r(o,a,s)},i)},e.prototype.__iterator=function(r,i){return this._iter.__iterator(r,i)},e})(is);ec.prototype[rs]=!0;var Km=(function(n){function e(t){this._iter=t,this.size=t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.includes=function(r){return this._iter.includes(r)},e.prototype.__iterate=function(r,i){var s=this,o=0;return i&&lo(this),this._iter.__iterate(function(a){return r(a,i?s.size-++o:o++,s)},i)},e.prototype.__iterator=function(r,i){var s=this,o=this._iter.__iterator(or,i),a=0;return i&&lo(this),new Tt(function(){var l=o.next();return l.done?l:Yt(r,i?s.size-++a:a++,l.value,l)})},e})(Mr),Zm=(function(n){function e(t){this._iter=t,this.size=t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.has=function(r){return this._iter.includes(r)},e.prototype.__iterate=function(r,i){var s=this;return this._iter.__iterate(function(o){return r(o,o,s)},i)},e.prototype.__iterator=function(r,i){var s=this._iter.__iterator(or,i);return new Tt(function(){var o=s.next();return o.done?o:Yt(r,o.value,o.value,o)})},e})(po),Jm=(function(n){function e(t){this._iter=t,this.size=t.size}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.entrySeq=function(){return this._iter.toSeq()},e.prototype.__iterate=function(r,i){var s=this;return this._iter.__iterate(function(o){if(o){s0(o);var a=Kn(o);return r(a?o.get(1):o[1],a?o.get(0):o[0],s)}},i)},e.prototype.__iterator=function(r,i){var s=this._iter.__iterator(or,i);return new Tt(function(){for(;;){var o=s.next();if(o.done)return o;var a=o.value;if(a){s0(a);var l=Kn(a);return Yt(r,l?a.get(0):a[0],l?a.get(1):a[1],o)}}})},e})(is);Km.prototype.cacheResult=ec.prototype.cacheResult=Zm.prototype.cacheResult=Jm.prototype.cacheResult=Rh;function Qm(n){var e=li(n);return e._iter=n,e.size=n.size,e.flip=function(){return n},e.reverse=function(){var t=n.reverse.apply(this);return t.flip=function(){return n.reverse()},t},e.has=function(t){return n.includes(t)},e.includes=function(t){return n.has(t)},e.cacheResult=Rh,e.__iterateUncached=function(t,r){var i=this;return n.__iterate(function(s,o){return t(o,s,i)!==!1},r)},e.__iteratorUncached=function(t,r){if(t===ar){var i=n.__iterator(t,r);return new Tt(function(){var s=i.next();if(!s.done){var o=s.value[0];s.value[0]=s.value[1],s.value[1]=o}return s})}return n.__iterator(t===or?ho:or,r)},e}function e0(n,e,t){var r=li(n);return r.size=n.size,r.has=function(i){return n.has(i)},r.get=function(i,s){var o=n.get(i,Mt);return o===Mt?s:e.call(t,o,i,n)},r.__iterateUncached=function(i,s){var o=this;return n.__iterate(function(a,l,c){return i(e.call(t,a,l,c),l,o)!==!1},s)},r.__iteratorUncached=function(i,s){var o=n.__iterator(ar,s);return new Tt(function(){var a=o.next();if(a.done)return a;var l=a.value,c=l[0];return Yt(i,c,e.call(t,l[1],c,n),a)})},r}function Th(n,e){var t=this,r=li(n);return r._iter=n,r.size=n.size,r.reverse=function(){return n},n.flip&&(r.flip=function(){var i=Qm(n);return i.reverse=function(){return n.flip()},i}),r.get=function(i,s){return n.get(e?i:-1-i,s)},r.has=function(i){return n.has(e?i:-1-i)},r.includes=function(i){return n.includes(i)},r.cacheResult=Rh,r.__iterate=function(i,s){var o=this,a=0;return s&&lo(n),n.__iterate(function(l,c){return i(l,e?c:s?o.size-++a:a++,o)},!s)},r.__iterator=function(i,s){var o=0;s&&lo(n);var a=n.__iterator(ar,!s);return new Tt(function(){var l=a.next();if(l.done)return l;var c=l.value;return Yt(i,e?c[0]:s?t.size-++o:o++,c[1],l)})},r}function t0(n,e,t,r){var i=li(n);return r&&(i.has=function(s){var o=n.get(s,Mt);return o!==Mt&&!!e.call(t,o,s,n)},i.get=function(s,o){var a=n.get(s,Mt);return a!==Mt&&e.call(t,a,s,n)?a:o}),i.__iterateUncached=function(s,o){var a=this,l=0;return n.__iterate(function(c,h,f){if(e.call(t,c,h,f))return l++,s(c,r?h:l-1,a)},o),l},i.__iteratorUncached=function(s,o){var a=n.__iterator(ar,o),l=0;return new Tt(function(){for(;;){var c=a.next();if(c.done)return c;var h=c.value,f=h[0],p=h[1];if(e.call(t,p,f,n))return Yt(s,r?f:l++,p,c)}})},i}function ny(n,e,t){var r=Pe().asMutable();return n.__iterate(function(i,s){r.update(e.call(t,i,s,n),0,function(o){return o+1})}),r.asImmutable()}function ry(n,e,t){var r=kt(n),i=(Nr(n)?hi():Pe()).asMutable();n.__iterate(function(o,a){i.update(e.call(t,o,a,n),function(l){return l=l||[],l.push(r?[a,o]:o),l})});var s=Ch(n);return i.map(function(o){return Bt(n,s(o))}).asImmutable()}function iy(n,e,t){var r=kt(n),i=[[],[]];n.__iterate(function(o,a){i[e.call(t,o,a,n)?1:0].push(r?[a,o]:o)});var s=Ch(n);return i.map(function(o){return Bt(n,s(o))})}function Ah(n,e,t,r){var i=n.size;if(Oa(e,t,i))return n;if(typeof i>"u"&&(e<0||t<0))return Ah(n.toSeq().cacheResult(),e,t,r);var s=co(e,i),o=qa(t,i),a=o-s,l;a===a&&(l=a<0?0:a);var c=li(n);return c.size=l===0?l:n.size&&l||void 0,!r&&Yl(n)&&l>=0&&(c.get=function(h,f){return h=ts(this,h),h>=0&&h<l?n.get(h+s,f):f}),c.__iterateUncached=function(h,f){var p=this;if(l===0)return 0;if(f)return this.cacheResult().__iterate(h,f);var d=0,m=!0,x=0;return n.__iterate(function(v,_){if(!(m&&(m=d++<s)))return x++,h(v,r?_:x-1,p)!==!1&&x!==l}),x},c.__iteratorUncached=function(h,f){if(l!==0&&f)return this.cacheResult().__iterator(h,f);if(l===0)return new Tt(Pn);var p=n.__iterator(h,f),d=0,m=0;return new Tt(function(){for(;d++<s;)p.next();if(++m>l)return Pn();var x=p.next();return r||h===or||x.done?x:h===ho?Yt(h,m-1,void 0,x):Yt(h,m-1,x.value[1],x)})},c}function sy(n,e,t){var r=li(n);return r.__iterateUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterate(i,s);var a=0;return n.__iterate(function(l,c,h){return e.call(t,l,c,h)&&++a&&i(l,c,o)}),a},r.__iteratorUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterator(i,s);var a=n.__iterator(ar,s),l=!0;return new Tt(function(){if(!l)return Pn();var c=a.next();if(c.done)return c;var h=c.value,f=h[0],p=h[1];return e.call(t,p,f,o)?i===ar?c:Yt(i,f,p,c):(l=!1,Pn())})},r}function n0(n,e,t,r){var i=li(n);return i.__iterateUncached=function(s,o){var a=this;if(o)return this.cacheResult().__iterate(s,o);var l=!0,c=0;return n.__iterate(function(h,f,p){if(!(l&&(l=e.call(t,h,f,p))))return c++,s(h,r?f:c-1,a)}),c},i.__iteratorUncached=function(s,o){var a=this;if(o)return this.cacheResult().__iterator(s,o);var l=n.__iterator(ar,o),c=!0,h=0;return new Tt(function(){var f,p,d;do{if(f=l.next(),f.done)return r||s===or?f:s===ho?Yt(s,h++,void 0,f):Yt(s,h++,f.value[1],f);var m=f.value;p=m[0],d=m[1],c&&(c=e.call(t,d,p,a))}while(c);return s===ar?f:Yt(s,p,d,f)})},i}var oy=(function(n){function e(t){this._wrappedIterables=t.flatMap(function(r){return r._wrappedIterables?r._wrappedIterables:[r]}),this.size=this._wrappedIterables.reduce(function(r,i){if(r!==void 0){var s=i.size;if(s!==void 0)return r+s}},0),this[jl]=this._wrappedIterables[0][jl],this[Xl]=this._wrappedIterables[0][Xl],this[rs]=this._wrappedIterables[0][rs]}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.__iterateUncached=function(r,i){if(this._wrappedIterables.length!==0){if(i)return this.cacheResult().__iterate(r,i);for(var s=0,o=kt(this),a=o?ar:or,l=this._wrappedIterables[s].__iterator(a,i),c=!0,h=0;c;){for(var f=l.next();f.done;){if(s++,s===this._wrappedIterables.length)return h;l=this._wrappedIterables[s].__iterator(a,i),f=l.next()}var p=o?r(f.value[1],f.value[0],this):r(f.value,h,this);c=p!==!1,h++}return h}},e.prototype.__iteratorUncached=function(r,i){var s=this;if(this._wrappedIterables.length===0)return new Tt(Pn);if(i)return this.cacheResult().__iterator(r,i);var o=0,a=this._wrappedIterables[o].__iterator(r,i);return new Tt(function(){for(var l=a.next();l.done;){if(o++,o===s._wrappedIterables.length)return l;a=s._wrappedIterables[o].__iterator(r,i),l=a.next()}return l})},e})(gn);function ay(n,e){var t=kt(n),r=[n].concat(e).map(function(s){return Kn(s)?t&&(s=Er(s)):s=t?gh(s):Hm(Array.isArray(s)?s:[s]),s}).filter(function(s){return s.size!==0});if(r.length===0)return n;if(r.length===1){var i=r[0];if(i===n||t&&kt(i)||Bn(n)&&Bn(i))return i}return new oy(r)}function r0(n,e,t){var r=li(n);return r.__iterateUncached=function(i,s){if(s)return this.cacheResult().__iterate(i,s);var o=0,a=!1;function l(c,h){c.__iterate(function(f,p){return(!e||h<e)&&Kn(f)?l(f,h+1):(o++,i(f,t?p:o-1,r)===!1&&(a=!0)),!a},s)}return l(n,0),o},r.__iteratorUncached=function(i,s){if(s)return this.cacheResult().__iterator(i,s);var o=n.__iterator(i,s),a=[],l=0;return new Tt(function(){for(;o;){var c=o.next();if(c.done!==!1){o=a.pop();continue}var h=c.value;if(i===ar&&(h=h[1]),(!e||a.length<e)&&Kn(h))a.push(o),o=h.__iterator(i,s);else return t?c:Yt(i,l++,h,c)}return Pn()})},r}function ly(n,e,t){var r=Ch(n);return n.toSeq().map(function(i,s){return r(e.call(t,i,s,n))}).flatten(!0)}function cy(n,e){var t=li(n);return t.size=n.size&&n.size*2-1,t.__iterateUncached=function(r,i){var s=this,o=0;return n.__iterate(function(a){return(!o||r(e,o++,s)!==!1)&&r(a,o++,s)!==!1},i),o},t.__iteratorUncached=function(r,i){var s=n.__iterator(or,i),o=0,a;return new Tt(function(){return(!a||o%2)&&(a=s.next(),a.done)?a:o%2?Yt(r,o++,e):Yt(r,o++,a.value,a)})},t}function go(n,e,t){e||(e=o0);var r=kt(n),i=0,s=n.toSeq().map(function(o,a){return[a,o,i++,t?t(o,a,n):o]}).valueSeq().toArray();return s.sort(function(o,a){return e(o[3],a[3])||o[2]-a[2]}).forEach(r?function(o,a){s[a].length=2}:function(o,a){s[a]=o[1]}),r?is(s):Bn(n)?Mr(s):po(s)}function tc(n,e,t){if(e||(e=o0),t){var r=n.toSeq().map(function(i,s){return[i,t(i,s,n)]}).reduce(function(i,s){return i0(e,i[1],s[1])?s:i});return r&&r[0]}return n.reduce(function(i,s){return i0(e,i,s)?s:i})}function i0(n,e,t){var r=n(t,e);return r===0&&t!==e&&(t==null||t!==t)||r>0}function nc(n,e,t,r){var i=li(n),s=new mo(t).map(function(o){return o.size});return i.size=r?s.max():s.min(),i.__iterate=function(o,a){for(var l=this.__iterator(or,a),c,h=0;!(c=l.next()).done&&o(c.value,h++,this)!==!1;);return h},i.__iteratorUncached=function(o,a){var l=t.map(function(f){return f=bn(f),fh(a?f.reverse():f)}),c=0,h=!1;return new Tt(function(){var f;return h||(f=l.map(function(p){return p.next()}),h=r?f.every(function(p){return p.done}):f.some(function(p){return p.done})),h?Pn():Yt(o,c++,e.apply(null,f.map(function(p){return p.value})))})},i}function Bt(n,e){return n===e?n:Yl(n)?e:n.constructor(e)}function s0(n){if(n!==Object(n))throw new TypeError("Expected [K, V] tuple: "+n)}function Ch(n){return kt(n)?Er:Bn(n)?Rs:uo}function li(n){return Object.create((kt(n)?is:Bn(n)?Mr:po).prototype)}function Rh(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):gn.prototype.cacheResult.call(this)}function o0(n,e){return n===void 0&&e===void 0?0:n===void 0?1:e===void 0?-1:n>e?1:n<e?-1:0}function ci(n,e){e=e||0;for(var t=Math.max(0,n.length-e),r=new Array(t),i=0;i<t;i++)r[i]=n[i+e];return r}function Na(n,e){if(!n)throw new Error(e)}function lr(n){Na(n!==1/0,"Cannot perform this action with an infinite size.")}function a0(n){if(dh(n)&&typeof n!="string")return n;if(Nr(n))return n.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+n)}var uy=Object.prototype.toString;function Ph(n){if(!n||typeof n!="object"||uy.call(n)!=="[object Object]")return!1;var e=Object.getPrototypeOf(n);if(e===null)return!0;for(var t=e,r=Object.getPrototypeOf(e);r!==null;)t=r,r=Object.getPrototypeOf(t);return t===e}function ss(n){return typeof n=="object"&&(br(n)||Array.isArray(n)||Ph(n))}function Ua(n){try{return typeof n=="string"?JSON.stringify(n):String(n)}catch{return JSON.stringify(n)}}function l0(n,e){return br(n)?n.has(e):ss(n)&&fo.call(n,e)}function Ih(n,e,t){return br(n)?n.get(e,t):l0(n,e)?typeof n.get=="function"?n.get(e):n[e]:t}function rc(n){if(Array.isArray(n))return ci(n);var e={};for(var t in n)fo.call(n,t)&&(e[t]=n[t]);return e}function c0(n,e){if(!ss(n))throw new TypeError("Cannot update non-data-structure value: "+n);if(br(n)){if(!n.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+n);return n.remove(e)}if(!fo.call(n,e))return n;var t=rc(n);return Array.isArray(t)?t.splice(e,1):delete t[e],t}function u0(n,e,t){if(!ss(n))throw new TypeError("Cannot update non-data-structure value: "+n);if(br(n)){if(!n.set)throw new TypeError("Cannot update immutable value without .set() method: "+n);return n.set(e,t)}if(fo.call(n,e)&&t===n[e])return n;var r=rc(n);return r[e]=t,r}function Is(n,e,t,r){r||(r=t,t=void 0);var i=h0(br(n),n,a0(e),0,t,r);return i===Mt?t:i}function h0(n,e,t,r,i,s){var o=e===Mt;if(r===t.length){var a=o?i:e,l=s(a);return l===a?e:l}if(!o&&!ss(e))throw new TypeError("Cannot update within non-data-structure value in path ["+Array.from(t).slice(0,r).map(Ua)+"]: "+e);var c=t[r],h=o?Mt:Ih(e,c,Mt),f=h0(h===Mt?n:br(h),h,t,r+1,i,s);return f===h?e:f===Mt?c0(e,c):u0(o?n?ui():{}:e,c,f)}function f0(n,e,t){return Is(n,e,Mt,function(){return t})}function Lh(n,e){return f0(this,n,e)}function d0(n,e){return Is(n,e,function(){return Mt})}function Oh(n){return d0(this,n)}function qh(n,e,t,r){return Is(n,[e],t,r)}function Dh(n,e,t){return arguments.length===1?n(this):qh(this,n,e,t)}function Nh(n,e,t){return Is(this,n,e,t)}function p0(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];return g0(this,n)}function m0(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];if(typeof n!="function")throw new TypeError("Invalid merger function: "+n);return g0(this,e,n)}function g0(n,e,t){for(var r=[],i=0;i<e.length;i++){var s=Er(e[i]);s.size!==0&&r.push(s)}return r.length===0?n:n.toSeq().size===0&&!n.__ownerID&&r.length===1?ns(n)?n:n.constructor(r[0]):n.withMutations(function(o){for(var a=t?function(c,h){qh(o,h,Mt,function(f){return f===Mt?c:t(f,c,h)})}:function(c,h){o.set(h,c)},l=0;l<r.length;l++)r[l].forEach(a)})}function hy(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return za(n,e)}function fy(n,e){for(var t=[],r=arguments.length-2;r-- >0;)t[r]=arguments[r+2];return za(e,t,n)}function dy(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return Fa(n,e)}function py(n,e){for(var t=[],r=arguments.length-2;r-- >0;)t[r]=arguments[r+2];return Fa(e,t,n)}function Fa(n,e,t){return za(n,e,my(t))}function za(n,e,t){if(!ss(n))throw new TypeError("Cannot merge into non-data-structure value: "+n);if(br(n))return typeof t=="function"&&n.mergeWith?n.mergeWith.apply(n,[t].concat(e)):n.merge?n.merge.apply(n,e):n.concat.apply(n,e);for(var r=Array.isArray(n),i=n,s=r?Rs:Er,o=r?function(l){i===n&&(i=rc(i)),i.push(l)}:function(l,c){var h=fo.call(i,c),f=h&&t?t(i[c],l,c):l;(!h||f!==i[c])&&(i===n&&(i=rc(i)),i[c]=f)},a=0;a<e.length;a++)s(e[a]).forEach(o);return i}function my(n){function e(t,r,i){return ss(t)&&ss(r)&&gy(t,r)?za(t,[r],e):n?n(t,r,i):r}return e}function gy(n,e){var t=gn(n),r=gn(e);return Bn(t)===Bn(r)&&kt(t)===kt(r)}function _0(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];return Fa(this,n)}function v0(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return Fa(this,e,n)}function Uh(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return Is(this,n,ui(),function(r){return za(r,e)})}function Fh(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return Is(this,n,ui(),function(r){return Fa(r,e)})}function ka(n){var e=this.asMutable();return n(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this}function Ba(){return this.__ownerID?this:this.__ensureOwner(new ch)}function Va(){return this.__ensureOwner()}function zh(){return this.__altered}var Pe=(function(n){function e(t){return t==null?ui():Jl(t)&&!Nr(t)?t:ui().withMutations(function(r){var i=n(t);lr(i.size),i.forEach(function(s,o){return r.set(o,s)})})}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return this.__toString("Map {","}")},e.prototype.get=function(r,i){return this._root?this._root.get(0,void 0,r,i):i},e.prototype.set=function(r,i){return S0(this,r,i)},e.prototype.remove=function(r){return S0(this,r,Mt)},e.prototype.deleteAll=function(r){var i=bn(r);return i.size===0?this:this.withMutations(function(s){i.forEach(function(o){return s.remove(o)})})},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):ui()},e.prototype.sort=function(r){return hi(go(this,r))},e.prototype.sortBy=function(r,i){return hi(go(this,i,r))},e.prototype.map=function(r,i){var s=this;return this.withMutations(function(o){o.forEach(function(a,l){o.set(l,r.call(i,a,l,s))})})},e.prototype.__iterator=function(r,i){return new _y(this,r,i)},e.prototype.__iterate=function(r,i){var s=this,o=0;return this._root&&this._root.iterate(function(a){return o++,r(a[1],a[0],s)},i),o},e.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?Bh(this.size,this._root,r,this.__hash):this.size===0?ui():(this.__ownerID=r,this.__altered=!1,this)},e})(Er);Pe.isMap=Jl;var Zt=Pe.prototype;Zt[Gm]=!0,Zt[La]=Zt.remove,Zt.removeAll=Zt.deleteAll,Zt.setIn=Lh,Zt.removeIn=Zt.deleteIn=Oh,Zt.update=Dh,Zt.updateIn=Nh,Zt.merge=Zt.concat=p0,Zt.mergeWith=m0,Zt.mergeDeep=_0,Zt.mergeDeepWith=v0,Zt.mergeIn=Uh,Zt.mergeDeepIn=Fh,Zt.withMutations=ka,Zt.wasAltered=zh,Zt.asImmutable=Va,Zt["@@transducer/init"]=Zt.asMutable=Ba,Zt["@@transducer/step"]=function(n,e){return n.set(e[0],e[1])},Zt["@@transducer/result"]=function(n){return n.asImmutable()};var Ha=function(e,t){this.ownerID=e,this.entries=t};Ha.prototype.get=function(e,t,r,i){for(var s=this.entries,o=0,a=s.length;o<a;o++)if(Kt(r,s[o][0]))return s[o][1];return i},Ha.prototype.update=function(e,t,r,i,s,o,a){for(var l=s===Mt,c=this.entries,h=0,f=c.length;h<f&&!Kt(i,c[h][0]);h++);var p=h<f;if(p?c[h][1]===s:l)return this;if(Sr(a),(l||!p)&&Sr(o),!(l&&c.length===1)){if(!p&&!l&&c.length>=by)return vy(e,c,i,s);var d=e&&e===this.ownerID,m=d?c:ci(c);return p?l?h===f-1?m.pop():m[h]=m.pop():m[h]=[i,s]:m.push([i,s]),d?(this.entries=m,this):new Ha(e,m)}};var _o=function(e,t,r){this.ownerID=e,this.bitmap=t,this.nodes=r};_o.prototype.get=function(e,t,r,i){t===void 0&&(t=Zn(r));var s=1<<((e===0?t:t>>>e)&kn),o=this.bitmap;return(o&s)===0?i:this.nodes[b0(o&s-1)].get(e+zt,t,r,i)},_o.prototype.update=function(e,t,r,i,s,o,a){r===void 0&&(r=Zn(i));var l=(t===0?r:r>>>t)&kn,c=1<<l,h=this.bitmap,f=(h&c)!==0;if(!f&&s===Mt)return this;var p=b0(h&c-1),d=this.nodes,m=f?d[p]:void 0,x=Vh(m,e,t+zt,r,i,s,o,a);if(x===m)return this;if(!f&&x&&d.length>=My)return yy(e,d,h,l,x);if(f&&!x&&d.length===2&&E0(d[p^1]))return d[p^1];if(f&&x&&d.length===1&&E0(x))return x;var v=e&&e===this.ownerID,_=f?x?h:h^c:h|c,b=f?x?M0(d,p,x,v):Ey(d,p,v):Sy(d,p,x,v);return v?(this.bitmap=_,this.nodes=b,this):new _o(e,_,b)};var Ga=function(e,t,r){this.ownerID=e,this.count=t,this.nodes=r};Ga.prototype.get=function(e,t,r,i){t===void 0&&(t=Zn(r));var s=(e===0?t:t>>>e)&kn,o=this.nodes[s];return o?o.get(e+zt,t,r,i):i},Ga.prototype.update=function(e,t,r,i,s,o,a){r===void 0&&(r=Zn(i));var l=(t===0?r:r>>>t)&kn,c=s===Mt,h=this.nodes,f=h[l];if(c&&!f)return this;var p=Vh(f,e,t+zt,r,i,s,o,a);if(p===f)return this;var d=this.count;if(!f)d++;else if(!p&&(d--,d<wy))return xy(e,h,d,l);var m=e&&e===this.ownerID,x=M0(h,l,p,m);return m?(this.count=d,this.nodes=x,this):new Ga(e,d,x)};var vo=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entries=r};vo.prototype.get=function(e,t,r,i){for(var s=this.entries,o=0,a=s.length;o<a;o++)if(Kt(r,s[o][0]))return s[o][1];return i},vo.prototype.update=function(e,t,r,i,s,o,a){r===void 0&&(r=Zn(i));var l=s===Mt;if(r!==this.keyHash)return l?this:(Sr(a),Sr(o),Hh(this,e,t,r,[i,s]));for(var c=this.entries,h=0,f=c.length;h<f&&!Kt(i,c[h][0]);h++);var p=h<f;if(p?c[h][1]===s:l)return this;if(Sr(a),(l||!p)&&Sr(o),l&&f===2)return new Li(e,this.keyHash,c[h^1]);var d=e&&e===this.ownerID,m=d?c:ci(c);return p?l?h===f-1?m.pop():m[h]=m.pop():m[h]=[i,s]:m.push([i,s]),d?(this.entries=m,this):new vo(e,this.keyHash,m)};var Li=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entry=r};Li.prototype.get=function(e,t,r,i){return Kt(r,this.entry[0])?this.entry[1]:i},Li.prototype.update=function(e,t,r,i,s,o,a){var l=s===Mt,c=Kt(i,this.entry[0]);if(c?s===this.entry[1]:l)return this;if(Sr(a),l){Sr(o);return}return c?e&&e===this.ownerID?(this.entry[1]=s,this):new Li(e,this.keyHash,[i,s]):(Sr(o),Hh(this,e,t,Zn(i),[i,s]))},Ha.prototype.iterate=vo.prototype.iterate=function(n,e){for(var t=this.entries,r=0,i=t.length-1;r<=i;r++)if(n(t[e?i-r:r])===!1)return!1},_o.prototype.iterate=Ga.prototype.iterate=function(n,e){for(var t=this.nodes,r=0,i=t.length-1;r<=i;r++){var s=t[e?i-r:r];if(s&&s.iterate(n,e)===!1)return!1}},Li.prototype.iterate=function(n,e){return n(this.entry)};var _y=(function(n){function e(t,r,i){this._type=r,this._reverse=i,this._stack=t._root&&x0(t._root)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.next=function(){for(var r=this._type,i=this._stack;i;){var s=i.node,o=i.index++,a=void 0;if(s.entry){if(o===0)return kh(r,s.entry)}else if(s.entries){if(a=s.entries.length-1,o<=a)return kh(r,s.entries[this._reverse?a-o:o])}else if(a=s.nodes.length-1,o<=a){var l=s.nodes[this._reverse?a-o:o];if(l){if(l.entry)return kh(r,l.entry);i=this._stack=x0(l,i)}continue}i=this._stack=this._stack.__prev}return Pn()},e})(Tt);function kh(n,e){return Yt(n,e[0],e[1])}function x0(n,e){return{node:n,index:0,__prev:e}}function Bh(n,e,t,r){var i=Object.create(Zt);return i.size=n,i._root=e,i.__ownerID=t,i.__hash=r,i.__altered=!1,i}var y0;function ui(){return y0||(y0=Bh(0))}function S0(n,e,t){var r,i;if(n._root){var s=lh(),o=lh();if(r=Vh(n._root,n.__ownerID,0,void 0,e,t,s,o),!o.value)return n;i=n.size+(s.value?t===Mt?-1:1:0)}else{if(t===Mt)return n;i=1,r=new Ha(n.__ownerID,[[e,t]])}return n.__ownerID?(n.size=i,n._root=r,n.__hash=void 0,n.__altered=!0,n):r?Bh(i,r):ui()}function Vh(n,e,t,r,i,s,o,a){return n?n.update(e,t,r,i,s,o,a):s===Mt?n:(Sr(a),Sr(o),new Li(e,r,[i,s]))}function E0(n){return n.constructor===Li||n.constructor===vo}function Hh(n,e,t,r,i){if(n.keyHash===r)return new vo(e,r,[n.entry,i]);var s=(t===0?n.keyHash:n.keyHash>>>t)&kn,o=(t===0?r:r>>>t)&kn,a,l=s===o?[Hh(n,e,t+zt,r,i)]:(a=new Li(e,r,i),s<o?[n,a]:[a,n]);return new _o(e,1<<s|1<<o,l)}function vy(n,e,t,r){n||(n=new ch);for(var i=new Li(n,Zn(t),[t,r]),s=0;s<e.length;s++){var o=e[s];i=i.update(n,0,void 0,o[0],o[1])}return i}function xy(n,e,t,r){for(var i=0,s=0,o=new Array(t),a=0,l=1,c=e.length;a<c;a++,l<<=1){var h=e[a];h!==void 0&&a!==r&&(i|=l,o[s++]=h)}return new _o(n,i,o)}function yy(n,e,t,r,i){for(var s=0,o=new Array(sr),a=0;t!==0;a++,t>>>=1)o[a]=t&1?e[s++]:void 0;return o[r]=i,new Ga(n,s+1,o)}function b0(n){return n-=n>>1&1431655765,n=(n&858993459)+(n>>2&858993459),n=n+(n>>4)&252645135,n+=n>>8,n+=n>>16,n&127}function M0(n,e,t,r){var i=r?n:ci(n);return i[e]=t,i}function Sy(n,e,t,r){var i=n.length+1;if(r&&e+1===i)return n[e]=t,n;for(var s=new Array(i),o=0,a=0;a<i;a++)a===e?(s[a]=t,o=-1):s[a]=n[a+o];return s}function Ey(n,e,t){var r=n.length-1;if(t&&e===r)return n.pop(),n;for(var i=new Array(r),s=0,o=0;o<r;o++)o===e&&(s=1),i[o]=n[o+s];return i}var by=sr/4,My=sr/2,wy=sr/4,w0="@@__IMMUTABLE_LIST__@@";function Gh(n){return!!(n&&n[w0])}var Xe=(function(n){function e(t){var r=ic();if(t==null)return r;if(Gh(t))return t;var i=n(t),s=i.size;return s===0?r:(lr(s),s>0&&s<sr?ja(0,s,zt,null,new os(i.toArray())):r.withMutations(function(o){o.setSize(s),i.forEach(function(a,l){return o.set(l,a)})}))}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("List [","]")},e.prototype.get=function(r,i){if(r=ts(this,r),r>=0&&r<this.size){r+=this._origin;var s=A0(this,r);return s&&s.array[r&kn]}return i},e.prototype.set=function(r,i){return Ty(this,r,i)},e.prototype.remove=function(r){return this.has(r)?r===0?this.shift():r===this.size-1?this.pop():this.splice(r,1):this},e.prototype.insert=function(r,i){return this.splice(r,0,i)},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=zt,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):ic()},e.prototype.push=function(){var r=arguments,i=this.size;return this.withMutations(function(s){as(s,0,i+r.length);for(var o=0;o<r.length;o++)s.set(i+o,r[o])})},e.prototype.pop=function(){return as(this,0,-1)},e.prototype.unshift=function(){var r=arguments;return this.withMutations(function(i){as(i,-r.length);for(var s=0;s<r.length;s++)i.set(s,r[s])})},e.prototype.shift=function(){return as(this,1)},e.prototype.shuffle=function(r){return r===void 0&&(r=Math.random),this.withMutations(function(i){for(var s=i.size,o,a;s;)o=Math.floor(r()*s--),a=i.get(o),i.set(o,i.get(s)),i.set(s,a)})},e.prototype.concat=function(){for(var r=arguments,i=[],s=0;s<arguments.length;s++){var o=r[s],a=n(typeof o!="string"&&hh(o)?o:[o]);a.size!==0&&i.push(a)}return i.length===0?this:this.size===0&&!this.__ownerID&&i.length===1?this.constructor(i[0]):this.withMutations(function(l){i.forEach(function(c){return c.forEach(function(h){return l.push(h)})})})},e.prototype.setSize=function(r){return as(this,0,r)},e.prototype.map=function(r,i){var s=this;return this.withMutations(function(o){for(var a=0;a<s.size;a++)o.set(a,r.call(i,o.get(a),a,s))})},e.prototype.slice=function(r,i){var s=this.size;return Oa(r,i,s)?this:as(this,co(r,s),qa(i,s))},e.prototype.__iterator=function(r,i){var s=i?this.size:0,o=T0(this,i);return new Tt(function(){var a=o();return a===Wa?Pn():Yt(r,i?--s:s++,a)})},e.prototype.__iterate=function(r,i){for(var s=i?this.size:0,o=T0(this,i),a;(a=o())!==Wa&&r(a,i?--s:s++,this)!==!1;);return s},e.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?ja(this._origin,this._capacity,this._level,this._root,this._tail,r,this.__hash):this.size===0?ic():(this.__ownerID=r,this.__altered=!1,this)},e})(Rs);Xe.isList=Gh;var hn=Xe.prototype;hn[w0]=!0,hn[La]=hn.remove,hn.merge=hn.concat,hn.setIn=Lh,hn.deleteIn=hn.removeIn=Oh,hn.update=Dh,hn.updateIn=Nh,hn.mergeIn=Uh,hn.mergeDeepIn=Fh,hn.withMutations=ka,hn.wasAltered=zh,hn.asImmutable=Va,hn["@@transducer/init"]=hn.asMutable=Ba,hn["@@transducer/step"]=function(n,e){return n.push(e)},hn["@@transducer/result"]=function(n){return n.asImmutable()};var os=function(e,t){this.array=e,this.ownerID=t};os.prototype.removeBefore=function(e,t,r){if((r&(1<<t+zt)-1)===0||this.array.length===0)return this;var i=r>>>t&kn;if(i>=this.array.length)return new os([],e);var s=i===0,o;if(t>0){var a=this.array[i];if(o=a&&a.removeBefore(e,t-zt,r),o===a&&s)return this}if(s&&!o)return this;var l=xo(this,e);if(!s)for(var c=0;c<i;c++)l.array[c]=void 0;return o&&(l.array[i]=o),l},os.prototype.removeAfter=function(e,t,r){if(r===(t?1<<t+zt:sr)||this.array.length===0)return this;var i=r-1>>>t&kn;if(i>=this.array.length)return this;var s;if(t>0){var o=this.array[i];if(s=o&&o.removeAfter(e,t-zt,r),s===o&&i===this.array.length-1)return this}var a=xo(this,e);return a.array.splice(i+1),s&&(a.array[i]=s),a};var Wa={};function T0(n,e){var t=n._origin,r=n._capacity,i=Xa(r),s=n._tail;return o(n._root,n._level,0);function o(c,h,f){return h===0?a(c,f):l(c,h,f)}function a(c,h){var f=h===i?s&&s.array:c&&c.array,p=h>t?0:t-h,d=r-h;return d>sr&&(d=sr),function(){if(p===d)return Wa;var m=e?--d:p++;return f&&f[m]}}function l(c,h,f){var p,d=c&&c.array,m=f>t?0:t-f>>h,x=(r-f>>h)+1;return x>sr&&(x=sr),function(){for(;;){if(p){var v=p();if(v!==Wa)return v;p=null}if(m===x)return Wa;var _=e?--x:m++;p=o(d&&d[_],h-zt,f+(_<<h))}}}}function ja(n,e,t,r,i,s,o){var a=Object.create(hn);return a.size=e-n,a._origin=n,a._capacity=e,a._level=t,a._root=r,a._tail=i,a.__ownerID=s,a.__hash=o,a.__altered=!1,a}function ic(){return ja(0,0,zt)}function Ty(n,e,t){if(e=ts(n,e),e!==e)return n;if(e>=n.size||e<0)return n.withMutations(function(o){e<0?as(o,e).set(0,t):as(o,0,e+1).set(e,t)});e+=n._origin;var r=n._tail,i=n._root,s=lh();return e>=Xa(n._capacity)?r=Wh(r,n.__ownerID,0,e,t,s):i=Wh(i,n.__ownerID,n._level,e,t,s),s.value?n.__ownerID?(n._root=i,n._tail=r,n.__hash=void 0,n.__altered=!0,n):ja(n._origin,n._capacity,n._level,i,r):n}function Wh(n,e,t,r,i,s){var o=r>>>t&kn,a=n&&o<n.array.length;if(!a&&i===void 0)return n;var l;if(t>0){var c=n&&n.array[o],h=Wh(c,e,t-zt,r,i,s);return h===c?n:(l=xo(n,e),l.array[o]=h,l)}return a&&n.array[o]===i?n:(s&&Sr(s),l=xo(n,e),i===void 0&&o===l.array.length-1?l.array.pop():l.array[o]=i,l)}function xo(n,e){return e&&n&&e===n.ownerID?n:new os(n?n.array.slice():[],e)}function A0(n,e){if(e>=Xa(n._capacity))return n._tail;if(e<1<<n._level+zt){for(var t=n._root,r=n._level;t&&r>0;)t=t.array[e>>>r&kn],r-=zt;return t}}function as(n,e,t){e!==void 0&&(e|=0),t!==void 0&&(t|=0);var r=n.__ownerID||new ch,i=n._origin,s=n._capacity,o=i+e,a=t===void 0?s:t<0?s+t:i+t;if(o===i&&a===s)return n;if(o>=a)return n.clear();for(var l=n._level,c=n._root,h=0;o+h<0;)c=new os(c&&c.array.length?[void 0,c]:[],r),l+=zt,h+=1<<l;h&&(o+=h,i+=h,a+=h,s+=h);for(var f=Xa(s),p=Xa(a);p>=1<<l+zt;)c=new os(c&&c.array.length?[c]:[],r),l+=zt;var d=n._tail,m=p<f?A0(n,a-1):p>f?new os([],r):d;if(d&&p>f&&o<s&&d.array.length){c=xo(c,r);for(var x=c,v=l;v>zt;v-=zt){var _=f>>>v&kn;x=x.array[_]=xo(x.array[_],r)}x.array[f>>>zt&kn]=d}if(a<s&&(m=m&&m.removeAfter(r,0,a)),o>=p)o-=p,a-=p,l=zt,c=null,m=m&&m.removeBefore(r,0,o);else if(o>i||p<f){for(h=0;c;){var b=o>>>l&kn;if(b!==p>>>l&kn)break;b&&(h+=(1<<l)*b),l-=zt,c=c.array[b]}c&&o>i&&(c=c.removeBefore(r,l,o-h)),c&&p<f&&(c=c.removeAfter(r,l,p-h)),h&&(o-=h,a-=h)}return n.__ownerID?(n.size=a-o,n._origin=o,n._capacity=a,n._level=l,n._root=c,n._tail=m,n.__hash=void 0,n.__altered=!0,n):ja(o,a,l,c,m)}function Xa(n){return n<sr?0:n-1>>>zt<<zt}var hi=(function(n){function e(t){return t==null?$a():vh(t)?t:$a().withMutations(function(r){var i=Er(t);lr(i.size),i.forEach(function(s,o){return r.set(o,s)})})}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("OrderedMap {","}")},e.prototype.get=function(r,i){var s=this._map.get(r);return s!==void 0?this._list.get(s)[1]:i},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this.__altered=!0,this):$a()},e.prototype.set=function(r,i){return R0(this,r,i)},e.prototype.remove=function(r){return R0(this,r,Mt)},e.prototype.__iterate=function(r,i){var s=this;return this._list.__iterate(function(o){return o&&r(o[1],o[0],s)},i)},e.prototype.__iterator=function(r,i){return this._list.fromEntrySeq().__iterator(r,i)},e.prototype.__ensureOwner=function(r){if(r===this.__ownerID)return this;var i=this._map.__ensureOwner(r),s=this._list.__ensureOwner(r);return r?jh(i,s,r,this.__hash):this.size===0?$a():(this.__ownerID=r,this.__altered=!1,this._map=i,this._list=s,this)},e})(Pe);hi.isOrderedMap=vh,hi.prototype[rs]=!0,hi.prototype[La]=hi.prototype.remove;function jh(n,e,t,r){var i=Object.create(hi.prototype);return i.size=n?n.size:0,i._map=n,i._list=e,i.__ownerID=t,i.__hash=r,i.__altered=!1,i}var C0;function $a(){return C0||(C0=jh(ui(),ic()))}function R0(n,e,t){var r=n._map,i=n._list,s=r.get(e),o=s!==void 0,a,l;if(t===Mt){if(!o)return n;i.size>=sr&&i.size>=r.size*2?(l=i.filter(function(c,h){return c!==void 0&&s!==h}),a=l.toKeyedSeq().map(function(c){return c[0]}).flip().toMap(),n.__ownerID&&(a.__ownerID=l.__ownerID=n.__ownerID)):(a=r.remove(e),l=s===i.size-1?i.pop():i.set(s,void 0))}else if(o){if(t===i.get(s)[1])return n;a=r,l=i.set(s,[e,t])}else a=r.set(e,i.size),l=i.set(i.size,[e,t]);return n.__ownerID?(n.size=a.size,n._map=a,n._list=l,n.__hash=void 0,n.__altered=!0,n):jh(a,l)}var P0="@@__IMMUTABLE_STACK__@@";function sc(n){return!!(n&&n[P0])}var oc=(function(n){function e(t){return t==null?ac():sc(t)?t:ac().pushAll(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("Stack [","]")},e.prototype.get=function(r,i){var s=this._head;for(r=ts(this,r);s&&r--;)s=s.next;return s?s.value:i},e.prototype.peek=function(){return this._head&&this._head.value},e.prototype.push=function(){var r=arguments;if(arguments.length===0)return this;for(var i=this.size+arguments.length,s=this._head,o=arguments.length-1;o>=0;o--)s={value:r[o],next:s};return this.__ownerID?(this.size=i,this._head=s,this.__hash=void 0,this.__altered=!0,this):Ya(i,s)},e.prototype.pushAll=function(r){if(r=n(r),r.size===0)return this;if(this.size===0&&sc(r))return r;lr(r.size);var i=this.size,s=this._head;return r.__iterate(function(o){i++,s={value:o,next:s}},!0),this.__ownerID?(this.size=i,this._head=s,this.__hash=void 0,this.__altered=!0,this):Ya(i,s)},e.prototype.pop=function(){return this.slice(1)},e.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):ac()},e.prototype.slice=function(r,i){if(Oa(r,i,this.size))return this;var s=co(r,this.size),o=qa(i,this.size);if(o!==this.size)return n.prototype.slice.call(this,r,i);for(var a=this.size-s,l=this._head;s--;)l=l.next;return this.__ownerID?(this.size=a,this._head=l,this.__hash=void 0,this.__altered=!0,this):Ya(a,l)},e.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?Ya(this.size,this._head,r,this.__hash):this.size===0?ac():(this.__ownerID=r,this.__altered=!1,this)},e.prototype.__iterate=function(r,i){var s=this;if(i)return new mo(this.toArray()).__iterate(function(l,c){return r(l,c,s)},i);for(var o=0,a=this._head;a&&r(a.value,o++,this)!==!1;)a=a.next;return o},e.prototype.__iterator=function(r,i){if(i)return new mo(this.toArray()).__iterator(r,i);var s=0,o=this._head;return new Tt(function(){if(o){var a=o.value;return o=o.next,Yt(r,s++,a)}return Pn()})},e})(Rs);oc.isStack=sc;var Vn=oc.prototype;Vn[P0]=!0,Vn.shift=Vn.pop,Vn.unshift=Vn.push,Vn.unshiftAll=Vn.pushAll,Vn.withMutations=ka,Vn.wasAltered=zh,Vn.asImmutable=Va,Vn["@@transducer/init"]=Vn.asMutable=Ba,Vn["@@transducer/step"]=function(n,e){return n.unshift(e)},Vn["@@transducer/result"]=function(n){return n.asImmutable()};function Ya(n,e,t,r){var i=Object.create(Vn);return i.size=n,i._head=e,i.__ownerID=t,i.__hash=r,i.__altered=!1,i}var I0;function ac(){return I0||(I0=Ya(0))}var L0="@@__IMMUTABLE_SET__@@";function lc(n){return!!(n&&n[L0])}function Xh(n){return lc(n)&&Nr(n)}function $h(n,e){if(n===e)return!0;if(!Kn(e)||n.size!==void 0&&e.size!==void 0&&n.size!==e.size||n.__hash!==void 0&&e.__hash!==void 0&&n.__hash!==e.__hash||kt(n)!==kt(e)||Bn(n)!==Bn(e)||Nr(n)!==Nr(e))return!1;if(n.size===0&&e.size===0)return!0;var t=!$l(n);if(Nr(n)){var r=n.entries();return e.every(function(l,c){var h=r.next().value;return h&&Kt(h[1],l)&&(t||Kt(h[0],c))})&&r.next().done}var i=!1;if(n.size===void 0)if(e.size===void 0)typeof n.cacheResult=="function"&&n.cacheResult();else{i=!0;var s=n;n=e,e=s}var o=!0,a=e.__iterate(function(l,c){if(t?!n.has(l):i?!Kt(l,n.get(c,Mt)):!Kt(n.get(c,Mt),l))return o=!1,!1});return o&&n.size===a}function Ls(n,e){var t=function(r){n.prototype[r]=e[r]};return Object.keys(e).forEach(t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(t),n}function cc(n){if(!n||typeof n!="object")return n;if(!Kn(n)){if(!ss(n))return n;n=gn(n)}if(kt(n)){var e={};return n.__iterate(function(r,i){e[i]=cc(r)}),e}var t=[];return n.__iterate(function(r){t.push(cc(r))}),t}var Ka=(function(n){function e(t){return t==null?Za():lc(t)&&!Nr(t)?t:Za().withMutations(function(r){var i=n(t);lr(i.size),i.forEach(function(s){return r.add(s)})})}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(r){return this(Er(r).keySeq())},e.intersect=function(r){return r=bn(r).toArray(),r.length?An.intersect.apply(e(r.pop()),r):Za()},e.union=function(r){return r=bn(r).toArray(),r.length?An.union.apply(e(r.pop()),r):Za()},e.prototype.toString=function(){return this.__toString("Set {","}")},e.prototype.has=function(r){return this._map.has(r)},e.prototype.add=function(r){return uc(this,this._map.set(r,r))},e.prototype.remove=function(r){return uc(this,this._map.remove(r))},e.prototype.clear=function(){return uc(this,this._map.clear())},e.prototype.map=function(r,i){var s=this,o=!1,a=uc(this,this._map.mapEntries(function(l){var c=l[1],h=r.call(i,c,c,s);return h!==c&&(o=!0),[h,h]},i));return o?a:this},e.prototype.union=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];return r=r.filter(function(s){return s.size!==0}),r.length===0?this:this.size===0&&!this.__ownerID&&r.length===1?this.constructor(r[0]):this.withMutations(function(s){for(var o=0;o<r.length;o++)typeof r[o]=="string"?s.add(r[o]):n(r[o]).forEach(function(a){return s.add(a)})})},e.prototype.intersect=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];if(r.length===0)return this;r=r.map(function(o){return n(o)});var s=[];return this.forEach(function(o){r.every(function(a){return a.includes(o)})||s.push(o)}),this.withMutations(function(o){s.forEach(function(a){o.remove(a)})})},e.prototype.subtract=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];if(r.length===0)return this;r=r.map(function(o){return n(o)});var s=[];return this.forEach(function(o){r.some(function(a){return a.includes(o)})&&s.push(o)}),this.withMutations(function(o){s.forEach(function(a){o.remove(a)})})},e.prototype.sort=function(r){return Eo(go(this,r))},e.prototype.sortBy=function(r,i){return Eo(go(this,i,r))},e.prototype.wasAltered=function(){return this._map.wasAltered()},e.prototype.__iterate=function(r,i){var s=this;return this._map.__iterate(function(o){return r(o,o,s)},i)},e.prototype.__iterator=function(r,i){return this._map.__iterator(r,i)},e.prototype.__ensureOwner=function(r){if(r===this.__ownerID)return this;var i=this._map.__ensureOwner(r);return r?this.__make(i,r):this.size===0?this.__empty():(this.__ownerID=r,this._map=i,this)},e})(uo);Ka.isSet=lc;var An=Ka.prototype;An[L0]=!0,An[La]=An.remove,An.merge=An.concat=An.union,An.withMutations=ka,An.asImmutable=Va,An["@@transducer/init"]=An.asMutable=Ba,An["@@transducer/step"]=function(n,e){return n.add(e)},An["@@transducer/result"]=function(n){return n.asImmutable()},An.__empty=Za,An.__make=O0;function uc(n,e){return n.__ownerID?(n.size=e.size,n._map=e,n):e===n._map?n:e.size===0?n.__empty():n.__make(e)}function O0(n,e){var t=Object.create(An);return t.size=n?n.size:0,t._map=n,t.__ownerID=e,t}var q0;function Za(){return q0||(q0=O0(ui()))}var D0=(function(n){function e(t,r,i){if(i===void 0&&(i=1),!(this instanceof e))return new e(t,r,i);if(Na(i!==0,"Cannot step a Range by 0"),Na(t!==void 0,"You must define a start value when using Range"),Na(r!==void 0,"You must define an end value when using Range"),i=Math.abs(i),r<t&&(i=-i),this._start=t,this._end=r,this._step=i,this.size=Math.max(0,Math.ceil((r-t)/i-1)+1),this.size===0){if(Yh)return Yh;Yh=this}}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return this.size===0?"Range []":"Range [ "+this._start+"..."+this._end+(this._step!==1?" by "+this._step:"")+" ]"},e.prototype.get=function(r,i){return this.has(r)?this._start+ts(this,r)*this._step:i},e.prototype.includes=function(r){var i=(r-this._start)/this._step;return i>=0&&i<this.size&&i===Math.floor(i)},e.prototype.slice=function(r,i){return Oa(r,i,this.size)?this:(r=co(r,this.size),i=qa(i,this.size),i<=r?new e(0,0):new e(this.get(r,this._end),this.get(i,this._end),this._step))},e.prototype.indexOf=function(r){var i=r-this._start;if(i%this._step===0){var s=i/this._step;if(s>=0&&s<this.size)return s}return-1},e.prototype.lastIndexOf=function(r){return this.indexOf(r)},e.prototype.__iterate=function(r,i){for(var s=this.size,o=this._step,a=i?this._start+(s-1)*o:this._start,l=0;l!==s&&r(a,i?s-++l:l++,this)!==!1;)a+=i?-o:o;return l},e.prototype.__iterator=function(r,i){var s=this.size,o=this._step,a=i?this._start+(s-1)*o:this._start,l=0;return new Tt(function(){if(l===s)return Pn();var c=a;return a+=i?-o:o,Yt(r,i?s-++l:l++,c)})},e.prototype.equals=function(r){return r instanceof e?this._start===r._start&&this._end===r._end&&this._step===r._step:$h(this,r)},e})(Mr),Yh;function Kh(n,e,t){for(var r=a0(e),i=0;i!==r.length;)if(n=Ih(n,r[i++],Mt),n===Mt)return t;return n}function N0(n,e){return Kh(this,n,e)}function U0(n,e){return Kh(n,e,Mt)!==Mt}function Ay(n){return U0(this,n)}function F0(){lr(this.size);var n={};return this.__iterate(function(e,t){n[t]=e}),n}bn.Iterator=Tt,Ls(bn,{toArray:function(){lr(this.size);var e=new Array(this.size||0),t=kt(this),r=0;return this.__iterate(function(i,s){e[r++]=t?[s,i]:i}),e},toIndexedSeq:function(){return new Km(this)},toJS:function(){return cc(this)},toKeyedSeq:function(){return new ec(this,!0)},toMap:function(){return Pe(this.toKeyedSeq())},toObject:F0,toOrderedMap:function(){return hi(this.toKeyedSeq())},toOrderedSet:function(){return Eo(kt(this)?this.valueSeq():this)},toSet:function(){return Ka(kt(this)?this.valueSeq():this)},toSetSeq:function(){return new Zm(this)},toSeq:function(){return Bn(this)?this.toIndexedSeq():kt(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return oc(kt(this)?this.valueSeq():this)},toList:function(){return Xe(kt(this)?this.valueSeq():this)},toString:function(){return"[Collection]"},__toString:function(e,t){return this.size===0?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return Bt(this,ay(this,e))},includes:function(e){return this.some(function(t){return Kt(t,e)})},entries:function(){return this.__iterator(ar)},every:function(e,t){lr(this.size);var r=!0;return this.__iterate(function(i,s,o){if(!e.call(t,i,s,o))return r=!1,!1}),r},filter:function(e,t){return Bt(this,t0(this,e,t,!0))},partition:function(e,t){return iy(this,e,t)},find:function(e,t,r){var i=this.findEntry(e,t);return i?i[1]:r},forEach:function(e,t){return lr(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){lr(this.size),e=e!==void 0?""+e:",";var t="",r=!0;return this.__iterate(function(i){r?r=!1:t+=e,t+=i!=null?i.toString():""}),t},keys:function(){return this.__iterator(ho)},map:function(e,t){return Bt(this,e0(this,e,t))},reduce:function(e,t,r){return z0(this,e,t,r,arguments.length<2,!1)},reduceRight:function(e,t,r){return z0(this,e,t,r,arguments.length<2,!0)},reverse:function(){return Bt(this,Th(this,!0))},slice:function(e,t){return Bt(this,Ah(this,e,t,!0))},some:function(e,t){lr(this.size);var r=!1;return this.__iterate(function(i,s,o){if(e.call(t,i,s,o))return r=!0,!1}),r},sort:function(e){return Bt(this,go(this,e))},values:function(){return this.__iterator(or)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==void 0?this.size===0:!this.some(function(){return!0})},count:function(e,t){return lo(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return ny(this,e,t)},equals:function(e){return $h(this,e)},entrySeq:function(){var e=this;if(e._cache)return new mo(e._cache);var t=e.toSeq().map(Ry).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Zh(e),t)},findEntry:function(e,t,r){var i=r;return this.__iterate(function(s,o,a){if(e.call(t,s,o,a))return i=[o,s],!1}),i},findKey:function(e,t){var r=this.findEntry(e,t);return r&&r[0]},findLast:function(e,t,r){return this.toKeyedSeq().reverse().find(e,t,r)},findLastEntry:function(e,t,r){return this.toKeyedSeq().reverse().findEntry(e,t,r)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(e){return this.find(qm,null,e)},flatMap:function(e,t){return Bt(this,ly(this,e,t))},flatten:function(e){return Bt(this,r0(this,e,!0))},fromEntrySeq:function(){return new Jm(this)},get:function(e,t){return this.find(function(r,i){return Kt(i,e)},void 0,t)},getIn:N0,groupBy:function(e,t){return ry(this,e,t)},has:function(e){return this.get(e,Mt)!==Mt},hasIn:Ay,isSubset:function(e){return e=typeof e.includes=="function"?e:bn(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return e=typeof e.isSubset=="function"?e:bn(e),e.isSubset(this)},keyOf:function(e){return this.findKey(function(t){return Kt(t,e)})},keySeq:function(){return this.toSeq().map(Cy).toIndexedSeq()},last:function(e){return this.toSeq().reverse().first(e)},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return tc(this,e)},maxBy:function(e,t){return tc(this,t,e)},min:function(e){return tc(this,e?k0(e):V0)},minBy:function(e,t){return tc(this,t?k0(t):V0,e)},rest:function(){return this.slice(1)},skip:function(e){return e===0?this:this.slice(Math.max(0,e))},skipLast:function(e){return e===0?this:this.slice(0,-Math.max(0,e))},skipWhile:function(e,t){return Bt(this,n0(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Zh(e),t)},sortBy:function(e,t){return Bt(this,go(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return this.slice(-Math.max(0,e))},takeWhile:function(e,t){return Bt(this,sy(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Zh(e),t)},update:function(e){return e(this)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=Py(this))}});var In=bn.prototype;In[Um]=!0,In[Kl]=In.values,In.toJSON=In.toArray,In.__toStringMapper=Ua,In.inspect=In.toSource=function(){return this.toString()},In.chain=In.flatMap,In.contains=In.includes,Ls(Er,{flip:function(){return Bt(this,Qm(this))},mapEntries:function(e,t){var r=this,i=0;return Bt(this,this.toSeq().map(function(s,o){return e.call(t,[o,s],i++,r)}).fromEntrySeq())},mapKeys:function(e,t){var r=this;return Bt(this,this.toSeq().flip().map(function(i,s){return e.call(t,i,s,r)}).flip())}});var Ja=Er.prototype;Ja[jl]=!0,Ja[Kl]=In.entries,Ja.toJSON=F0,Ja.__toStringMapper=function(n,e){return Ua(e)+": "+Ua(n)},Ls(Rs,{toKeyedSeq:function(){return new ec(this,!1)},filter:function(e,t){return Bt(this,t0(this,e,t,!1))},findIndex:function(e,t){var r=this.findEntry(e,t);return r?r[0]:-1},indexOf:function(e){var t=this.keyOf(e);return t===void 0?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return t===void 0?-1:t},reverse:function(){return Bt(this,Th(this,!1))},slice:function(e,t){return Bt(this,Ah(this,e,t,!1))},splice:function(e,t){var r=arguments.length;if(t=Math.max(t||0,0),r===0||r===2&&!t)return this;e=co(e,e<0?this.count():this.size);var i=this.slice(0,e);return Bt(this,r===1?i:i.concat(ci(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var r=this.findLastEntry(e,t);return r?r[0]:-1},first:function(e){return this.get(0,e)},flatten:function(e){return Bt(this,r0(this,e,!1))},get:function(e,t){return e=ts(this,e),e<0||this.size===1/0||this.size!==void 0&&e>this.size?t:this.find(function(r,i){return i===e},void 0,t)},has:function(e){return e=ts(this,e),e>=0&&(this.size!==void 0?this.size===1/0||e<this.size:this.indexOf(e)!==-1)},interpose:function(e){return Bt(this,cy(this,e))},interleave:function(){var e=[this].concat(ci(arguments)),t=nc(this.toSeq(),Mr.of,e),r=t.flatten(!0);return t.size&&(r.size=t.size*e.length),Bt(this,r)},keySeq:function(){return D0(0,this.size)},last:function(e){return this.get(-1,e)},skipWhile:function(e,t){return Bt(this,n0(this,e,t,!1))},zip:function(){var e=[this].concat(ci(arguments));return Bt(this,nc(this,B0,e))},zipAll:function(){var e=[this].concat(ci(arguments));return Bt(this,nc(this,B0,e,!0))},zipWith:function(e){var t=ci(arguments);return t[0]=this,Bt(this,nc(this,e,t))}});var yo=Rs.prototype;yo[Xl]=!0,yo[rs]=!0,Ls(uo,{get:function(e,t){return this.has(e)?e:t},includes:function(e){return this.has(e)},keySeq:function(){return this.valueSeq()}});var So=uo.prototype;So.has=In.includes,So.contains=So.includes,So.keys=So.values,Ls(is,Ja),Ls(Mr,yo),Ls(po,So);function z0(n,e,t,r,i,s){return lr(n.size),n.__iterate(function(o,a,l){i?(i=!1,t=o):t=e.call(r,t,o,a,l)},s),t}function Cy(n,e){return e}function Ry(n,e){return[e,n]}function Zh(n){return function(){return!n.apply(this,arguments)}}function k0(n){return function(){return-n.apply(this,arguments)}}function B0(){return ci(arguments)}function V0(n,e){return n<e?1:n>e?-1:0}function Py(n){if(n.size===1/0)return 0;var e=Nr(n),t=kt(n),r=e?1:0;return n.__iterate(t?e?function(i,s){r=31*r+H0(Zn(i),Zn(s))|0}:function(i,s){r=r+H0(Zn(i),Zn(s))|0}:e?function(i){r=31*r+Zn(i)|0}:function(i){r=r+Zn(i)|0}),Iy(n.size,r)}function Iy(n,e){return e=Da(e,3432918353),e=Da(e<<15|e>>>-15,461845907),e=Da(e<<13|e>>>-13,5),e=(e+3864292196|0)^n,e=Da(e^e>>>16,2246822507),e=Da(e^e>>>13,3266489909),e=Ql(e^e>>>16),e}function H0(n,e){return n^e+2654435769+(n<<6)+(n>>2)|0}var Eo=(function(n){function e(t){return t==null?Jh():Xh(t)?t:Jh().withMutations(function(r){var i=uo(t);lr(i.size),i.forEach(function(s){return r.add(s)})})}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(r){return this(Er(r).keySeq())},e.prototype.toString=function(){return this.__toString("OrderedSet {","}")},e})(Ka);Eo.isOrderedSet=Xh;var Os=Eo.prototype;Os[rs]=!0,Os.zip=yo.zip,Os.zipWith=yo.zipWith,Os.zipAll=yo.zipAll,Os.__empty=Jh,Os.__make=G0;function G0(n,e){var t=Object.create(Os);return t.size=n?n.size:0,t._map=n,t.__ownerID=e,t}var W0;function Jh(){return W0||(W0=G0($a()))}var Ly={LeftThenRight:-1,RightThenLeft:1};function Oy(n){if(ns(n))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(br(n))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(n===null||typeof n!="object")throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}var mt=function(e,t){var r;Oy(e);var i=function(a){var l=this;if(a instanceof i)return a;if(!(this instanceof i))return new i(a);if(!r){r=!0;var c=Object.keys(e),h=s._indices={};s._name=t,s._keys=c,s._defaultValues=e;for(var f=0;f<c.length;f++){var p=c[f];h[p]=f,s[p]?typeof console=="object"&&console.warn&&console.warn("Cannot define "+ef(this)+' with property "'+p+'" since that property name is part of the Record API.'):qy(s,p)}}return this.__ownerID=void 0,this._values=Xe().withMutations(function(d){d.setSize(l._keys.length),Er(a).forEach(function(m,x){d.set(l._indices[x],m===l._defaultValues[x]?void 0:m)})}),this},s=i.prototype=Object.create(Wt);return s.constructor=i,t&&(i.displayName=t),i};mt.prototype.toString=function(){for(var e=ef(this)+" { ",t=this._keys,r,i=0,s=t.length;i!==s;i++)r=t[i],e+=(i?", ":"")+r+": "+Ua(this.get(r));return e+" }"},mt.prototype.equals=function(e){return this===e||ns(e)&&bo(this).equals(bo(e))},mt.prototype.hashCode=function(){return bo(this).hashCode()},mt.prototype.has=function(e){return this._indices.hasOwnProperty(e)},mt.prototype.get=function(e,t){if(!this.has(e))return t;var r=this._indices[e],i=this._values.get(r);return i===void 0?this._defaultValues[e]:i},mt.prototype.set=function(e,t){if(this.has(e)){var r=this._values.set(this._indices[e],t===this._defaultValues[e]?void 0:t);if(r!==this._values&&!this.__ownerID)return Qh(this,r)}return this},mt.prototype.remove=function(e){return this.set(e)},mt.prototype.clear=function(){var e=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:Qh(this,e)},mt.prototype.wasAltered=function(){return this._values.wasAltered()},mt.prototype.toSeq=function(){return bo(this)},mt.prototype.toJS=function(){return cc(this)},mt.prototype.entries=function(){return this.__iterator(ar)},mt.prototype.__iterator=function(e,t){return bo(this).__iterator(e,t)},mt.prototype.__iterate=function(e,t){return bo(this).__iterate(e,t)},mt.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._values.__ensureOwner(e);return e?Qh(this,t,e):(this.__ownerID=e,this._values=t,this)},mt.isRecord=ns,mt.getDescriptiveName=ef;var Wt=mt.prototype;Wt[zm]=!0,Wt[La]=Wt.remove,Wt.deleteIn=Wt.removeIn=Oh,Wt.getIn=N0,Wt.hasIn=In.hasIn,Wt.merge=p0,Wt.mergeWith=m0,Wt.mergeIn=Uh,Wt.mergeDeep=_0,Wt.mergeDeepWith=v0,Wt.mergeDeepIn=Fh,Wt.setIn=Lh,Wt.update=Dh,Wt.updateIn=Nh,Wt.withMutations=ka,Wt.asMutable=Ba,Wt.asImmutable=Va,Wt[Kl]=Wt.entries,Wt.toJSON=Wt.toObject=In.toObject,Wt.inspect=Wt.toSource=function(){return this.toString()};function Qh(n,e,t){var r=Object.create(Object.getPrototypeOf(n));return r._values=e,r.__ownerID=t,r}function ef(n){return n.constructor.displayName||n.constructor.name||"Record"}function bo(n){return gh(n._keys.map(function(e){return[e,n.get(e)]}))}function qy(n,e){try{Object.defineProperty(n,e,{get:function(){return this.get(e)},set:function(t){Na(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}catch{}}var Dy=(function(n){function e(t,r){if(!(this instanceof e))return new e(t,r);if(this._value=t,this.size=r===void 0?1/0:Math.max(0,r),this.size===0){if(tf)return tf;tf=this}}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return this.size===0?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},e.prototype.get=function(r,i){return this.has(r)?this._value:i},e.prototype.includes=function(r){return Kt(this._value,r)},e.prototype.slice=function(r,i){var s=this.size;return Oa(r,i,s)?this:new e(this._value,qa(i,s)-co(r,s))},e.prototype.reverse=function(){return this},e.prototype.indexOf=function(r){return Kt(this._value,r)?0:-1},e.prototype.lastIndexOf=function(r){return Kt(this._value,r)?this.size:-1},e.prototype.__iterate=function(r,i){for(var s=this.size,o=0;o!==s&&r(this._value,i?s-++o:o++,this)!==!1;);return o},e.prototype.__iterator=function(r,i){var s=this,o=this.size,a=0;return new Tt(function(){return a===o?Pn():Yt(r,i?o-++a:a++,s._value)})},e.prototype.equals=function(r){return r instanceof e?Kt(this._value,r._value):$h(this,r)},e})(Mr),tf;function At(n,e){return j0([],e||Ny,n,"",e&&e.length>2?[]:void 0,{"":n})}function j0(n,e,t,r,i,s){if(typeof t!="string"&&!br(t)&&(dh(t)||hh(t)||Ph(t))){if(~n.indexOf(t))throw new TypeError("Cannot convert circular structure to Immutable");n.push(t),i&&r!==""&&i.push(r);var o=e.call(s,r,gn(t).map(function(a,l){return j0(n,e,a,l,i,t)}),i&&i.slice());return n.pop(),i&&i.pop(),o}return t}function Ny(n,e){return Bn(e)?e.toList():kt(e)?e.toMap():e.toSet()}var Uy="5.1.3",Fy=bn;const zy=Object.freeze(Object.defineProperty({__proto__:null,Collection:bn,Iterable:Fy,List:Xe,Map:Pe,OrderedMap:hi,OrderedSet:Eo,PairSorting:Ly,Range:D0,Record:mt,Repeat:Dy,Seq:gn,Set:Ka,Stack:oc,fromJS:At,get:Ih,getIn:Kh,has:l0,hasIn:U0,hash:Zn,is:Kt,isAssociative:$l,isCollection:Kn,isImmutable:br,isIndexed:Bn,isKeyed:kt,isList:Gh,isMap:Jl,isOrdered:Nr,isOrderedMap:vh,isOrderedSet:Xh,isPlainObject:Ph,isRecord:ns,isSeq:Yl,isSet:lc,isStack:sc,isValueObject:xh,merge:hy,mergeDeep:dy,mergeDeepWith:py,mergeWith:fy,remove:c0,removeIn:d0,set:u0,setIn:f0,update:qh,updateIn:Is,version:Uy},Symbol.toStringTag,{value:"Module"})),rn="MODE_IDLE",qs="MODE_2D_ZOOM_IN",Ds="MODE_2D_ZOOM_OUT",Ns="MODE_2D_PAN",Oi="MODE_3D_VIEW",Mo="MODE_3D_FIRST_PERSON",Ur="MODE_WAITING_DRAWING_LINE",Fr="MODE_DRAGGING_LINE",zr="MODE_DRAGGING_VERTEX",kr="MODE_DRAGGING_ITEM",Br="MODE_DRAGGING_HOLE",cr="MODE_DRAWING_LINE",ur="MODE_DRAWING_HOLE",wr="MODE_DRAWING_ITEM",qi="MODE_ROTATING_ITEM",nf="MODE_UPLOADING_IMAGE",rf="MODE_FITTING_IMAGE",sf="MODE_VIEWING_CATALOG",X0="MODE_CONFIGURING_PROJECT",of=[rn,qs,Ds,Ns,Ur,cr,ur,wr,Fr,zr,kr,Br,rf,nf,qi],ky="mm",fi="cm",$0=[ky,fi,"m","in","ft","mi"],di=1e-6,Tr={DELETE:46,BACKSPACE:8,ESC:27,Z:90,ALT:18,C:67,V:86,CTRL:17,ENTER:13,TAB:9},Jn=(n,e=6)=>n&&e?parseFloat(parseFloat(n.toString()).toFixed(e)):0,wo=n=>{let e=n;return e<0&&(e=~e+1),e};function af(n,e){return n.x===e.x?n.y-e.y:n.x-e.x}function hc(n,e){return af(n,e)>0?e:n}function lf(n,e){return af(n,e)>0?n:e}function Qa(n){return n.sort(af)}function Ln(n,e,t,r){let i=n-t,s=e-r;return Math.sqrt(i*i+s*s)}function fc(n,e){let{x:t,y:r}=n,{x:i,y:s}=e;return Ln(t,r,i,s)}function dc(n){return{a:0,b:1,c:-n}}function pc(n){return{a:1,b:0,c:-n}}function By(n,e,t,r,i){return wo(n*r+e*i+t)/Math.sqrt(n*n+e*e)}function Vy(n,e,t,r,i){let s=n*n+e*e;return{x:(e*(e*r-n*i)-n*t)/s,y:(n*-e*r+n*i-e*t)/s}}function el(n,e,t,r,i,s){let o=e*r-n*i;if(o===0)return;let a=(n*s-t*r)/o;return{x:(t*i-e*s)/o,y:a}}function Hy(n,e,t,r){let{x:i,y:s}=n,{x:o,y:a}=e,{x:l,y:c}=t,{x:h,y:f}=r,p=(f-c)*(o-i)-(h-l)*(a-s),d=(h-l)*(s-c)-(f-c)*(i-l),m=(o-i)*(s-c)-(a-s)*(i-l);if(wo(p)<=di){if(wo(d)<=di&&wo(m)<=di){let _=(T,q)=>T.x===q.x?T.y-q.y:T.x-q.x,b=[n,e].sort(_),M=[t.toJS(),r.toJS()].sort(_),[E,S]=[b,M].sort((T,q)=>_(T[0],q[0]));return E[1].x===S[0].x?{type:S[0].y<=E[1].y?"colinear":"none"}:{type:S[0].x<=E[1].x?"colinear":"none"}}return{type:"parallel"}}let x=d/p,v=m/p;return x>=0-di&&x<=1+di&&v>=0-di&&v<=1+di?{type:"intersecting",point:{x:i+x*(o-i),y:s+x*(a-s)}}:{type:"none"}}function Y0(n,e,t,r,i,s){let o=i-n,a=s-e,l=t-n,c=r-e,h=o*l+a*c,f=l*l+c*c,p=-1;f!=0&&(p=h/f);let d,m;p<0?(d=n,m=e):p>1?(d=t,m=r):(d=n+p*l,m=e+p*c);let x=i-d,v=s-m;return Math.sqrt(x*x+v*v)}function Gy(n,e,t,r,i,s,o=di){return Y0(n,e,t,r,i,s)<=o}function Wy(n,e,t,r,i,s){if(n===t)return{x:n,y:s};if(e===r)return{x:i,y:e};let o=(r-e)/(t-n),a=e-o*n,l=-1/o,h=(s-l*i-a)/(o-l),f=o*h+a;return{x:h,y:f}}function On(n,e,t,r,i,s){let o=Ln(n,e,t,r),l=Ln(n,e,i,s)/o;return n>t&&(l=jy(l,0,1,1,0)),l}function jy(n,e,t,r,i){return r+(i-r)*(n-e)/(t-e)}function Xy(n,e,t,r){return-Math.atan2(e-r,t-n)*180/Math.PI}function cf(n,e,t,r){return Math.atan2(r-e,t-n)}function $y(n,e,t,r){return Math.atan2(Math.abs(r-e),Math.abs(t-n))}function Vr({x:n,y:e},{x:t,y:r}){return wo(n-t)<=di&&wo(e-r)<=di}function mc(n,e,t,r,i,s=6){let o=cf(n,e,t,r);return{x:Jn(n+Math.cos(o)*i,s),y:Jn(e+Math.sin(o)*i,s)}}function Yy(n,e,t){let r=n.length>>1,i,s,o=n[2*r-3]-t,a=n[2*r-2]-e,l=n[2*r-1]-t;if(a===0&&l===0)return!1;for(let h=0;h<r;h++){if(i=a,o=l,a=n[2*h]-e,l=n[2*h+1]-t,a===0&&l===0)return!1;o!==l&&(s=l>o)}let c=0;for(let h=0;h<r;h++){if(i=a,o=l,a=n[2*h]-e,l=n[2*h+1]-t,o<0&&l<0||o>0&&l>0||i<0&&a<0)continue;if(o===l&&Math.min(i,a)<0)return!0;if(o===l)continue;let f=i+(a-i)*-o/(l-o);if(f===0)return!1;f>0&&c++,o===0&&s&&l>o&&c--,o===0&&!s&&l<o&&c--,s=l>o}return(c&1)===1}function Ky(n,e){let t=Math.cos(n);return t<e?0:t}function Zy(n,e){let t=Math.sin(n);return t<e?0:t}function Jy(n,e,t,r){return{x:(n+t)/2,y:(e+r)/2}}function Qy(n){let e=n.reduce((t,r)=>({x:t.x+r.x,y:t.y+r.y}),{x:0,y:0});return{x:e.x/n.length,y:e.y/n.length}}function K0(n,e,t,r,i){let s=i*Math.PI/180,o=Math.cos(s),a=Math.sin(s),l=n-t,c=e-r;return{x:o*l-a*c+t,y:a*l+o*c+r}}const uf="SNAP_POINT",hf="SNAP_LINE",ff="SNAP_SEGMENT",df="SNAP_GRID",Z0="SNAP_GUIDE",e3=Pe({SNAP_POINT:!0,SNAP_LINE:!0,SNAP_SEGMENT:!0,SNAP_GRID:!1,SNAP_GUIDE:!0});class t3 extends mt({type:"point",x:-1,y:-1,radius:1,priority:1,related:Xe()}){nearestPoint(e,t){return{x:this.x,y:this.y,distance:Ln(this.x,this.y,e,t)}}isNear(e,t,r){return~(this.x-e)+1<r&&~(this.y-t)+1<r}}class n3 extends mt({type:"line",a:-1,b:-1,c:-1,radius:1,priority:1,related:Xe()}){nearestPoint(e,t){return{...Vy(this.a,this.b,this.c,e,t),distance:By(this.a,this.b,this.c,e,t)}}isNear(e,t,r){return!0}}class r3 extends mt({type:"line-segment",x1:-1,y1:-1,x2:-1,y2:-1,radius:1,priority:1,related:Xe()}){nearestPoint(e,t){return{...Wy(this.x1,this.y1,this.x2,this.y2,e,t),distance:Y0(this.x1,this.y1,this.x2,this.y2,e,t)}}isNear(e,t,r){return!0}}class i3 extends mt({type:"grid",x:-1,y:-1,radius:1,priority:1,related:Xe()}){nearestPoint(e,t){return{x:this.x,y:this.y,distance:Ln(this.x,this.y,e,t)}}isNear(e,t,r){return~(this.x-e)+1<r&&~(this.y-t)+1<r}}function pi(n,e,t,r){let i={point:r.get(uf),line:r.get(hf),"line-segment":r.get(ff),grid:r.get(df)};return n.valueSeq().filter(s=>i[s.type]&&s.isNear(e,t,s.radius)).map(s=>({snap:s,point:s.nearestPoint(e,t)})).filter(({snap:{radius:s},point:{distance:o}})=>o<s).min(({snap:{priority:s},point:{distance:o}},{snap:{priority:a},point:{distance:l}})=>s===a?o<l?-1:1:s>a?-1:1)}function pf(n,e,t,r,i,s){return s=Xe([s]),n.push(new t3({x:e,y:t,radius:r,priority:i,related:s}))}function gc(n,e,t,r,i,s,o){return o=Xe([o]),n.withMutations(a=>{if(a.some(c=>c.type==="line"&&e===c.a&&t===c.b&&r===c.c))return a;a.valueSeq().filter(c=>c.type==="line").map(c=>el(c.a,c.b,c.c,e,t,r)).filter(c=>c!==void 0).forEach(({x:c,y:h})=>pf(a,c,h,20,40)),a.push(new n3({a:e,b:t,c:r,radius:i,priority:s,related:o}))})}function tl(n,e,t,r,i,s,o,a){return a=Xe([a]),n.push(new r3({x1:e,y1:t,x2:r,y2:i,radius:s,priority:o,related:a}))}function s3(n,e,t,r,i,s){return s=Xe([s]),n.push(new i3({x:e,y:t,radius:r,priority:i,related:s}))}let Di=(n,e,t)=>n?Pe(n).map(r=>new e(r)).toMap():t||Pe();class mf extends mt({id:"",type:"",properties:Pe()},"Grid"){constructor(e={}){super({...e,properties:At(e.properties||{})})}}const o3=Pe({h1:new mf({id:"h1",type:"horizontal-streak",properties:{step:20,colors:["#808080","#ddd","#ddd","#ddd","#ddd"]}}),v1:new mf({id:"v1",type:"vertical-streak",properties:{step:20,colors:["#808080","#ddd","#ddd","#ddd","#ddd"]}})});class J0 extends mt({vertices:Xe(),lines:Xe(),holes:Xe(),areas:Xe(),items:Xe()},"ElementsSet"){constructor(e={}){super({vertices:Xe(e.vertices||[]),lines:Xe(e.lines||[]),holes:Xe(e.holes||[]),areas:Xe(e.areas||[]),items:Xe(e.items||[])})}}const To={id:"",type:"",prototype:"",name:"",misc:Pe(),selected:!1,properties:Pe(),visible:!0};let Q0=class extends mt({...To,x:-1,y:-1,prototype:"vertices",lines:Xe(),areas:Xe()},"Vertex"){constructor(e={}){super({...e,lines:Xe(e.lines||[]),areas:Xe(e.areas||[])})}},eg=class extends mt({...To,prototype:"lines",vertices:Xe(),holes:Xe()},"Line"){constructor(e={}){super({...e,properties:At(e.properties||{}),vertices:Xe(e.vertices||[]),holes:Xe(e.holes||[])})}},tg=class extends mt({...To,prototype:"holes",offset:-1,line:""},"Hole"){constructor(e={}){super({...e,properties:At(e.properties||{})})}},ng=class extends mt({...To,prototype:"areas",vertices:Xe(),holes:Xe()},"Area"){constructor(e={}){super({...e,properties:At(e.properties||{}),vertices:Xe(e.vertices||[])})}},rg=class extends mt({...To,prototype:"items",x:0,y:0,rotation:0},"Item"){constructor(e={}){super({...e,properties:At(e.properties||{})})}},gf=class extends mt({id:"",altitude:0,order:0,opacity:1,name:"",visible:!0,vertices:Pe(),lines:Pe(),holes:Pe(),areas:Pe(),items:Pe(),selected:new J0},"Layer"){constructor(e={}){super({...e,vertices:Di(e.vertices,Q0),lines:Di(e.lines,eg),holes:Di(e.holes,tg),areas:Di(e.areas,ng),items:Di(e.items,rg),selected:new J0(e.selected)})}},_f=class extends mt({...To,prototype:"groups",x:0,y:0,rotation:0,elements:Pe()},"Group"){constructor(e={}){super({...e,properties:At(e.properties||{}),elements:At(e.elements||{})})}};const a3=Pe({"layer-1":new gf({id:"layer-1",name:"default"})});let _c=class extends mt({unit:"cm",layers:Pe(),grids:Pe(),selectedLayer:null,groups:Pe(),width:3e3,height:2e3,meta:Pe(),guides:Pe()},"Scene"){constructor(e={}){let t=Di(e.layers,gf,a3);super({...e,grids:Di(e.grids,mf,o3),layers:t,selectedLayer:t.first().id,groups:Di(e.groups||{},_f),meta:e.meta?At(e.meta):Pe(),guides:e.guides?At(e.guides):Pe({horizontal:Pe(),vertical:Pe(),circular:Pe()})})}};class l3 extends mt({name:"",prototype:"",info:Pe(),properties:Pe()},"CatalogElement"){constructor(e={}){super({...e,info:At(e.info),properties:At(e.properties)})}}let vf=class extends mt({ready:!1,page:"root",path:Xe(),elements:Pe()},"Catalog"){constructor(e={}){let t=Di(e.elements,l3);super({elements:t,ready:!t.isEmpty()})}factoryElement(e,t,r){if(!this.elements.has(e)){let o=this.elements.map(a=>a.name).toArray();throw new Error(`Element ${e} does not exist in catalog ${o}`)}const i=this.elements.get(e),s=i.properties.map((o,a)=>r&&r.has(a)?r.get(a):o.get("defaultValue"));switch(i.prototype){case"lines":return new eg(t).merge({properties:s});case"holes":return new tg(t).merge({properties:s});case"areas":return new ng(t).merge({properties:s});case"items":return new rg(t).merge({properties:s});default:throw new Error("prototype not valid")}}};class ig extends mt({list:Xe(),first:null,last:null,redoList:Xe()},"HistoryStructure"){constructor(e={}){super({list:At(e.list||[]),first:new _c(e.scene),last:new _c(e.last||e.scene)})}}let vc=class extends mt({mode:rn,scene:new _c,sceneHistory:new ig,catalog:new vf,viewer2D:Pe(),mouse:Pe({x:0,y:0}),zoom:0,snapMask:e3,snapElements:Xe(),activeSnapElement:null,drawingSupport:Pe(),draggingSupport:Pe(),rotatingSupport:Pe(),errors:Xe(),warnings:Xe(),clipboardProperties:Pe(),selectedElementsHistory:Xe(),misc:Pe(),alterate:!1},"State"){constructor(e={}){super({...e,scene:new _c(e.scene),sceneHistory:new ig(e),catalog:new vf(e.catalog||{}),viewer2D:Pe(e.viewer2D||{}),drawingSupport:Pe(e.drawingSupport||{}),draggingSupport:Pe(e.draggingSupport||{}),rotatingSupport:Pe(e.rotatingSupport||{}),misc:e.misc?At(e.misc):Pe()})}};function xc(n){let e=[];for(let t=0;t<n;++t)e.push([]);return e}class sg{constructor(e,t){ut(this,"u");ut(this,"v");this.u=e,this.v=t}}class c3{constructor(e){ut(this,"count");ut(this,"subgraphs");ut(this,"time");ut(this,"V");ut(this,"E");ut(this,"adj");ut(this,"children");this.count=0,this.subgraphs=[],this.time=0,this.children=0,this.V=e,this.E=0,this.adj=[],this.adj=xc(e)}addEdge(e,t){this.adj[e].push(t),this.E++}_BCCUtil(e,t,r,i,s){t[e]=r[e]=++this.time,this.children=0,this.adj[e].forEach(o=>{if(t[o]==-1){if(this.children++,s[o]=e,i.push(new sg(e,o)),this._BCCUtil(o,t,r,i,s),r[e]>r[o]&&(r[e]=r[o]),t[e]==1&&this.children>1||t[e]>1&&r[o]>=t[e]){let a=[];for(;i[i.length-1].u!=e||i[i.length-1].v!=o;)a.push(i[i.length-1]),i.splice(i.length-1,1);a.push(i[i.length-1]),this.subgraphs.push(a),a=[],i.splice(i.length-1,1),this.count++}}else o!=s[e]&&t[o]<r[e]&&(r[e]>t[o]&&(r[e]=t[o]),i.push(new sg(e,o)))})}BCC(){let e=this.V,t=xc(e),r=xc(e),i=xc(e),s=[];for(let o=0;o<e;o++)t[o]=-1,r[o]=-1,i[o]=-1;for(let o=0;o<e;o++){t[o]==-1&&this._BCCUtil(o,t,r,s,i);let a=0,l=[];for(;s.length>0;)a=1,l.push(s[s.length-1]),s.splice(s.length-1,1);a==1&&(this.subgraphs.push(l),l=[],this.count++)}}}const u3=(n,e)=>{let t=[];return n.forEach(r=>{t.push([]);let i=h3(r);i.forEach(s=>{e.adj[s].forEach(a=>{s<=a&&i.has(a)&&t[t.length-1].push([s,a])})})}),t},h3=n=>{let e=new Set;return n.forEach(t=>{e.add(t.u),e.add(t.v)}),e};function f3(n,e){return[n[0]-e[0],n[1]-e[1]]}function og(n,e){return(n%e+e)%e}function d3(n){return n.map(function(t){return{ev:t,color:0,direction:-1}})}function p3(n,e){let t=f3(e,n);return Math.atan2(t[1],t[0])}function m3(n,e){return n.map(function(t,r){let i=[];return e.forEach(function(s,o){let a,l;s[0]===r&&(a=s[1],l=1),s[1]===r&&(a=s[0],l=0),a!==void 0&&i.push({index:o,endpoint:a,angle:p3(t,n[a]),edge:s,position:l})}),i.sort(function(s,o){return o.angle-s.angle}),i})}function ag(n,e){let t,r;for(t=0;t<e.length;t+=1)if(e[t].color<2)return r=-1*e[t].direction,cg(e,t,r),{edge:t,direction:r,position:r===-1?0:1}}function lg(n,e,t,r){let i=n[r[e][t]],s=i.length,o,a,l;for(l=0;l<s;l+=1)if(o=i[l],o.index===e)return a=i[og(l+1,i.length)],{edge:a.index,vertex:a.endpoint,position:a.position,direction:a.position?1:-1}}function cg(n,e,t){n[e].color+=1,n[e].direction=t}function g3(n,e){let t=d3(e),r=m3(n,e),i=[],s=[],o=[],a,l,c,h,f=ag(r,t);for(;f!==void 0;){for(a=[e[f.edge][og(f.position+1,2)],e[f.edge][f.position]],l=[f.edge],c=[f.direction],h=lg(r,f.edge,f.position,e);h.edge!==f.edge;)a.push(h.vertex),l.push(h.edge),c.push(h.direction),cg(t,h.edge,h.direction),h=lg(r,h.edge,h.position,e);s.push(l),i.push(a),o.push(c),f=ag(r,t)}return{v_cycles:i,e_cycles:s,dir_e_cycles:o,ev_mapping:t}}function _3(n,e){let t=[],r,i,s;for(s=0;s<e.length;s+=1)r=e[s],i=n[s],(r.length<3||i[0]!==i[i.length-1])&&t.push(s);return t}function v3(n,e){let t=g3(n,e),r=t.v_cycles,i=t.e_cycles;_3(r,i).forEach(p=>{r.splice(p,1),i.splice(p,1)});let o=t.dir_e_cycles,l=t.e_cycles.map((p,d)=>p.map(function(m,x){let v,_;return o[d][x]>0?(v=e[m][0],_=e[m][1]):(v=e[m][1],_=e[m][0]),(n[_][0]-n[v][0])*(n[_][1]+n[v][1])})).map(p=>p.reduce((d,m)=>d+m)),c=l.filter(p=>p>0).length,h=l.length-c,f=c>=h?1:-1;return{v_cycles:t.v_cycles.filter((p,d)=>f*l[d]>0),e_cycles:t.e_cycles.filter((p,d)=>f*l[d]>0),ev_mapping:t.ev_mapping}}function x3(n,e){let t=Xe();const r=new c3(n.length);e.forEach(([l,c])=>{r.addEdge(l,c),r.addEdge(c,l)}),r.BCC();const i=r.subgraphs.filter(l=>l.length>=3),s=u3(i,r),o=[];return s.forEach(l=>{l.forEach(c=>o.push(c))}),v3(n,o).v_cycles.forEach(l=>{l.shift(),t=t.push(l)}),t}function y3(n){let e=0,t=0,r=n.size;for(e=0;e<r;e++){let{x:i,y:s}=n.get(e)||{x:0,y:0},{x:o,y:a}=n.get((e+1)%r)||{x:0,y:0};t+=(o-i)*(a+s)}return t>0}function xf(n,e=Xe(),t=Pe()){let{width:r,height:i}=n,s,o,a;return e.withMutations(l=>{if(n.layers.forEach(c=>{let{lines:h,vertices:f}=c;f.forEach(({id:p,x:d,y:m})=>{t.get(uf)&&pf(l,d,m,10,10,p),t.get(hf)&&({a:s,b:o,c:a}=dc(m),gc(l,s,o,a,10,1,p),{a:s,b:o,c:a}=pc(d),gc(l,s,o,a,10,1,p))}),t.get(ff)&&h.forEach(({id:p,vertices:[d,m]})=>{let{x,y:v}=f.get(d),{x:_,y:b}=f.get(m);tl(l,x,v,_,b,20,1,p)})}),t.get(df)){let c=5,h=100/c,f=r/h,p=i/h;for(let d=0;d<f;d++){let m=d*h;for(let x=0;x<p;x++){let v=x*h,_=!(d%c),b=!(x%c);s3(l,m,v,10,_&&b?15:10,null)}}}if(t.get(Z0)){let c=n.getIn(["guides","horizontal"]),h=n.getIn(["guides","vertical"]),f=c.valueSeq(),p=h.valueSeq();f.forEach(d=>{p.forEach(m=>{pf(l,m,d,10,10)})}),f.forEach(d=>tl(l,0,d,r,d,20,1)),p.forEach(d=>tl(l,d,0,d,i,20,1))}})}var yc={exports:{}},S3=yc.exports,ug;function yf(){return ug||(ug=1,(function(n,e){(function(t,r){n.exports=r()})(S3,function(){var t=Array.prototype.slice;function r(u,g){g&&(u.prototype=Object.create(g.prototype)),u.prototype.constructor=u}function i(u){return l(u)?u:z(u)}r(s,i);function s(u){return c(u)?u:it(u)}r(o,i);function o(u){return h(u)?u:Ie(u)}r(a,i);function a(u){return l(u)&&!f(u)?u:$e(u)}function l(u){return!!(u&&u[d])}function c(u){return!!(u&&u[m])}function h(u){return!!(u&&u[x])}function f(u){return c(u)||h(u)}function p(u){return!!(u&&u[v])}i.isIterable=l,i.isKeyed=c,i.isIndexed=h,i.isAssociative=f,i.isOrdered=p,i.Keyed=s,i.Indexed=o,i.Set=a;var d="@@__IMMUTABLE_ITERABLE__@@",m="@@__IMMUTABLE_KEYED__@@",x="@@__IMMUTABLE_INDEXED__@@",v="@@__IMMUTABLE_ORDERED__@@",_="delete",b=5,M=1<<b,E=M-1,S={},T={value:!1},q={value:!1};function O(u){return u.value=!1,u}function A(u){u&&(u.value=!0)}function L(){}function N(u,g){g=g||0;for(var y=Math.max(0,u.length-g),w=new Array(y),R=0;R<y;R++)w[R]=u[R+g];return w}function Z(u){return u.size===void 0&&(u.size=u.__iterate(ne)),u.size}function K(u,g){if(typeof g!="number"){var y=g>>>0;if(""+y!==g||y===4294967295)return NaN;g=y}return g<0?Z(u)+g:g}function ne(){return!0}function ce(u,g,y){return(u===0||y!==void 0&&u<=-y)&&(g===void 0||y!==void 0&&g>=y)}function J(u,g){return B(u,g,0)}function oe(u,g){return B(u,g,g)}function B(u,g,y){return u===void 0?y:u<0?Math.max(0,g+u):g===void 0?u:Math.min(g,u)}var xe=0,U=1,$=2,pe=typeof Symbol=="function"&&Symbol.iterator,Se="@@iterator",be=pe||Se;function V(u){this.next=u}V.prototype.toString=function(){return"[Iterator]"},V.KEYS=xe,V.VALUES=U,V.ENTRIES=$,V.prototype.inspect=V.prototype.toSource=function(){return this.toString()},V.prototype[be]=function(){return this};function te(u,g,y,w){var R=u===0?g:u===1?y:[g,y];return w?w.value=R:w={value:R,done:!1},w}function W(){return{value:void 0,done:!0}}function ue(u){return!!Le(u)}function ye(u){return u&&typeof u.next=="function"}function Q(u){var g=Le(u);return g&&g.call(u)}function Le(u){var g=u&&(pe&&u[pe]||u[Se]);if(typeof g=="function")return g}function le(u){return u&&typeof u.length=="number"}r(z,i);function z(u){return u==null?I():l(u)?u.toSeq():Me(u)}z.of=function(){return z(arguments)},z.prototype.toSeq=function(){return this},z.prototype.toString=function(){return this.__toString("Seq {","}")},z.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},z.prototype.__iterate=function(u,g){return Ue(this,u,g,!0)},z.prototype.__iterator=function(u,g){return Ae(this,u,g,!0)},r(it,z);function it(u){return u==null?I().toKeyedSeq():l(u)?c(u)?u.toSeq():u.fromEntrySeq():ee(u)}it.prototype.toKeyedSeq=function(){return this},r(Ie,z);function Ie(u){return u==null?I():l(u)?c(u)?u.entrySeq():u.toIndexedSeq():de(u)}Ie.of=function(){return Ie(arguments)},Ie.prototype.toIndexedSeq=function(){return this},Ie.prototype.toString=function(){return this.__toString("Seq [","]")},Ie.prototype.__iterate=function(u,g){return Ue(this,u,g,!1)},Ie.prototype.__iterator=function(u,g){return Ae(this,u,g,!1)},r($e,z);function $e(u){return(u==null?I():l(u)?c(u)?u.entrySeq():u:de(u)).toSetSeq()}$e.of=function(){return $e(arguments)},$e.prototype.toSetSeq=function(){return this},z.isSeq=wt,z.Keyed=it,z.Set=$e,z.Indexed=Ie;var qe="@@__IMMUTABLE_SEQ__@@";z.prototype[qe]=!0,r(De,Ie);function De(u){this._array=u,this.size=u.length}De.prototype.get=function(u,g){return this.has(u)?this._array[K(this,u)]:g},De.prototype.__iterate=function(u,g){for(var y=this._array,w=y.length-1,R=0;R<=w;R++)if(u(y[g?w-R:R],R,this)===!1)return R+1;return R},De.prototype.__iterator=function(u,g){var y=this._array,w=y.length-1,R=0;return new V(function(){return R>w?W():te(u,R,y[g?w-R++:R++])})},r(ve,it);function ve(u){var g=Object.keys(u);this._object=u,this._keys=g,this.size=g.length}ve.prototype.get=function(u,g){return g!==void 0&&!this.has(u)?g:this._object[u]},ve.prototype.has=function(u){return this._object.hasOwnProperty(u)},ve.prototype.__iterate=function(u,g){for(var y=this._object,w=this._keys,R=w.length-1,D=0;D<=R;D++){var k=w[g?R-D:D];if(u(y[k],k,this)===!1)return D+1}return D},ve.prototype.__iterator=function(u,g){var y=this._object,w=this._keys,R=w.length-1,D=0;return new V(function(){var k=w[g?R-D:D];return D++>R?W():te(u,k,y[k])})},ve.prototype[v]=!0,r(Ge,Ie);function Ge(u){this._iterable=u,this.size=u.length||u.size}Ge.prototype.__iterateUncached=function(u,g){if(g)return this.cacheResult().__iterate(u,g);var y=this._iterable,w=Q(y),R=0;if(ye(w))for(var D;!(D=w.next()).done&&u(D.value,R++,this)!==!1;);return R},Ge.prototype.__iteratorUncached=function(u,g){if(g)return this.cacheResult().__iterator(u,g);var y=this._iterable,w=Q(y);if(!ye(w))return new V(W);var R=0;return new V(function(){var D=w.next();return D.done?D:te(u,R++,D.value)})},r(rt,Ie);function rt(u){this._iterator=u,this._iteratorCache=[]}rt.prototype.__iterateUncached=function(u,g){if(g)return this.cacheResult().__iterate(u,g);for(var y=this._iterator,w=this._iteratorCache,R=0;R<w.length;)if(u(w[R],R++,this)===!1)return R;for(var D;!(D=y.next()).done;){var k=D.value;if(w[R]=k,u(k,R++,this)===!1)break}return R},rt.prototype.__iteratorUncached=function(u,g){if(g)return this.cacheResult().__iterator(u,g);var y=this._iterator,w=this._iteratorCache,R=0;return new V(function(){if(R>=w.length){var D=y.next();if(D.done)return D;w[R]=D.value}return te(u,R,w[R++])})};function wt(u){return!!(u&&u[qe])}var F;function I(){return F||(F=new De([]))}function ee(u){var g=Array.isArray(u)?new De(u).fromEntrySeq():ye(u)?new rt(u).fromEntrySeq():ue(u)?new Ge(u).fromEntrySeq():typeof u=="object"?new ve(u):void 0;if(!g)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+u);return g}function de(u){var g=fe(u);if(!g)throw new TypeError("Expected Array or iterable object of values: "+u);return g}function Me(u){var g=fe(u)||typeof u=="object"&&new ve(u);if(!g)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+u);return g}function fe(u){return le(u)?new De(u):ye(u)?new rt(u):ue(u)?new Ge(u):void 0}function Ue(u,g,y,w){var R=u._cache;if(R){for(var D=R.length-1,k=0;k<=D;k++){var j=R[y?D-k:k];if(g(j[1],w?j[0]:k,u)===!1)return k+1}return k}return u.__iterateUncached(g,y)}function Ae(u,g,y,w){var R=u._cache;if(R){var D=R.length-1,k=0;return new V(function(){var j=R[y?D-k:k];return k++>D?W():te(g,w?j[0]:k-1,j[1])})}return u.__iteratorUncached(g,y)}function We(u,g){return g?je(g,u,"",{"":u}):Ce(u)}function je(u,g,y,w){return Array.isArray(g)?u.call(w,y,Ie(g).map(function(R,D){return je(u,R,D,g)})):Ne(g)?u.call(w,y,it(g).map(function(R,D){return je(u,R,D,g)})):g}function Ce(u){return Array.isArray(u)?Ie(u).map(Ce).toList():Ne(u)?it(u).map(Ce).toMap():u}function Ne(u){return u&&(u.constructor===Object||u.constructor===void 0)}function Ve(u,g){if(u===g||u!==u&&g!==g)return!0;if(!u||!g)return!1;if(typeof u.valueOf=="function"&&typeof g.valueOf=="function"){if(u=u.valueOf(),g=g.valueOf(),u===g||u!==u&&g!==g)return!0;if(!u||!g)return!1}return!!(typeof u.equals=="function"&&typeof g.equals=="function"&&u.equals(g))}function Ke(u,g){if(u===g)return!0;if(!l(g)||u.size!==void 0&&g.size!==void 0&&u.size!==g.size||u.__hash!==void 0&&g.__hash!==void 0&&u.__hash!==g.__hash||c(u)!==c(g)||h(u)!==h(g)||p(u)!==p(g))return!1;if(u.size===0&&g.size===0)return!0;var y=!f(u);if(p(u)){var w=u.entries();return g.every(function(ae,he){var ge=w.next().value;return ge&&Ve(ge[1],ae)&&(y||Ve(ge[0],he))})&&w.next().done}var R=!1;if(u.size===void 0)if(g.size===void 0)typeof u.cacheResult=="function"&&u.cacheResult();else{R=!0;var D=u;u=g,g=D}var k=!0,j=g.__iterate(function(ae,he){if(y?!u.has(ae):R?!Ve(ae,u.get(he,S)):!Ve(u.get(he,S),ae))return k=!1,!1});return k&&u.size===j}r(Re,Ie);function Re(u,g){if(!(this instanceof Re))return new Re(u,g);if(this._value=u,this.size=g===void 0?1/0:Math.max(0,g),this.size===0){if(ht)return ht;ht=this}}Re.prototype.toString=function(){return this.size===0?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},Re.prototype.get=function(u,g){return this.has(u)?this._value:g},Re.prototype.includes=function(u){return Ve(this._value,u)},Re.prototype.slice=function(u,g){var y=this.size;return ce(u,g,y)?this:new Re(this._value,oe(g,y)-J(u,y))},Re.prototype.reverse=function(){return this},Re.prototype.indexOf=function(u){return Ve(this._value,u)?0:-1},Re.prototype.lastIndexOf=function(u){return Ve(this._value,u)?this.size:-1},Re.prototype.__iterate=function(u,g){for(var y=0;y<this.size;y++)if(u(this._value,y,this)===!1)return y+1;return y},Re.prototype.__iterator=function(u,g){var y=this,w=0;return new V(function(){return w<y.size?te(u,w++,y._value):W()})},Re.prototype.equals=function(u){return u instanceof Re?Ve(this._value,u._value):Ke(u)};var ht;function H(u,g){if(!u)throw new Error(g)}r(Ee,Ie);function Ee(u,g,y){if(!(this instanceof Ee))return new Ee(u,g,y);if(H(y!==0,"Cannot step a Range by 0"),u=u||0,g===void 0&&(g=1/0),y=y===void 0?1:Math.abs(y),g<u&&(y=-y),this._start=u,this._end=g,this._step=y,this.size=Math.max(0,Math.ceil((g-u)/y-1)+1),this.size===0){if(Oe)return Oe;Oe=this}}Ee.prototype.toString=function(){return this.size===0?"Range []":"Range [ "+this._start+"..."+this._end+(this._step!==1?" by "+this._step:"")+" ]"},Ee.prototype.get=function(u,g){return this.has(u)?this._start+K(this,u)*this._step:g},Ee.prototype.includes=function(u){var g=(u-this._start)/this._step;return g>=0&&g<this.size&&g===Math.floor(g)},Ee.prototype.slice=function(u,g){return ce(u,g,this.size)?this:(u=J(u,this.size),g=oe(g,this.size),g<=u?new Ee(0,0):new Ee(this.get(u,this._end),this.get(g,this._end),this._step))},Ee.prototype.indexOf=function(u){var g=u-this._start;if(g%this._step===0){var y=g/this._step;if(y>=0&&y<this.size)return y}return-1},Ee.prototype.lastIndexOf=function(u){return this.indexOf(u)},Ee.prototype.__iterate=function(u,g){for(var y=this.size-1,w=this._step,R=g?this._start+y*w:this._start,D=0;D<=y;D++){if(u(R,D,this)===!1)return D+1;R+=g?-w:w}return D},Ee.prototype.__iterator=function(u,g){var y=this.size-1,w=this._step,R=g?this._start+y*w:this._start,D=0;return new V(function(){var k=R;return R+=g?-w:w,D>y?W():te(u,D++,k)})},Ee.prototype.equals=function(u){return u instanceof Ee?this._start===u._start&&this._end===u._end&&this._step===u._step:Ke(this,u)};var Oe;r(Be,i);function Be(){throw TypeError("Abstract")}r(Te,Be);function Te(){}r(me,Be);function me(){}r(Ze,Be);function Ze(){}Be.Keyed=Te,Be.Indexed=me,Be.Set=Ze;var ct=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(g,y){g=g|0,y=y|0;var w=g&65535,R=y&65535;return w*R+((g>>>16)*R+w*(y>>>16)<<16>>>0)|0};function Lt(u){return u>>>1&1073741824|u&3221225471}function ft(u){if(u===!1||u===null||u===void 0||typeof u.valueOf=="function"&&(u=u.valueOf(),u===!1||u===null||u===void 0))return 0;if(u===!0)return 1;var g=typeof u;if(g==="number"){if(u!==u||u===1/0)return 0;var y=u|0;for(y!==u&&(y^=u*4294967295);u>4294967295;)u/=4294967295,y^=u;return Lt(y)}if(g==="string")return u.length>Ku?si(u):rr(u);if(typeof u.hashCode=="function")return u.hashCode();if(g==="object")return $u(u);if(typeof u.toString=="function")return rr(u.toString());throw new Error("Value type "+g+" cannot be hashed.")}function si(u){var g=Fl[u];return g===void 0&&(g=rr(u),Ul===Zu&&(Ul=0,Fl={}),Ul++,Fl[u]=g),g}function rr(u){for(var g=0,y=0;y<u.length;y++)g=31*g+u.charCodeAt(y)|0;return Lt(g)}function $u(u){var g;if(Ea&&(g=ws.get(u),g!==void 0)||(g=u[Or],g!==void 0)||!Sa&&(g=u.propertyIsEnumerable&&u.propertyIsEnumerable[Or],g!==void 0||(g=Yu(u),g!==void 0)))return g;if(g=++ba,ba&1073741824&&(ba=0),Ea)ws.set(u,g);else{if(Ai!==void 0&&Ai(u)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(Sa)Object.defineProperty(u,Or,{enumerable:!1,configurable:!1,writable:!1,value:g});else if(u.propertyIsEnumerable!==void 0&&u.propertyIsEnumerable===u.constructor.prototype.propertyIsEnumerable)u.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},u.propertyIsEnumerable[Or]=g;else if(u.nodeType!==void 0)u[Or]=g;else throw new Error("Unable to set a non-enumerable property on object.")}return g}var Ai=Object.isExtensible,Sa=(function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}})();function Yu(u){if(u&&u.nodeType>0)switch(u.nodeType){case 1:return u.uniqueID;case 9:return u.documentElement&&u.documentElement.uniqueID}}var Ea=typeof WeakMap=="function",ws;Ea&&(ws=new WeakMap);var ba=0,Or="__immutablehash__";typeof Symbol=="function"&&(Or=Symbol(Or));var Ku=16,Zu=255,Ul=0,Fl={};function jn(u){H(u!==1/0,"Cannot perform this action with an infinite size.")}r(bt,Te);function bt(u){return u==null?Qe():zl(u)&&!p(u)?u:Qe().withMutations(function(g){var y=s(u);jn(y.size),y.forEach(function(w,R){return g.set(R,w)})})}bt.of=function(){var u=t.call(arguments,0);return Qe().withMutations(function(g){for(var y=0;y<u.length;y+=2){if(y+1>=u.length)throw new Error("Missing value for key: "+u[y]);g.set(u[y],u[y+1])}})},bt.prototype.toString=function(){return this.__toString("Map {","}")},bt.prototype.get=function(u,g){return this._root?this._root.get(0,void 0,u,g):g},bt.prototype.set=function(u,g){return xt(this,u,g)},bt.prototype.setIn=function(u,g){return this.updateIn(u,S,function(){return g})},bt.prototype.remove=function(u){return xt(this,u,S)},bt.prototype.deleteIn=function(u){return this.updateIn(u,function(){return S})},bt.prototype.update=function(u,g,y){return arguments.length===1?u(this):this.updateIn([u],g,y)},bt.prototype.updateIn=function(u,g,y){y||(y=g,g=void 0);var w=Ts(this,y2(u),g,y);return w===S?void 0:w},bt.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Qe()},bt.prototype.merge=function(){return Et(this,void 0,arguments)},bt.prototype.mergeWith=function(u){var g=t.call(arguments,1);return Et(this,u,g)},bt.prototype.mergeIn=function(u){var g=t.call(arguments,1);return this.updateIn(u,Qe(),function(y){return typeof y.merge=="function"?y.merge.apply(y,g):g[g.length-1]})},bt.prototype.mergeDeep=function(){return Et(this,Un,arguments)},bt.prototype.mergeDeepWith=function(u){var g=t.call(arguments,1);return Et(this,Qi(u),g)},bt.prototype.mergeDeepIn=function(u){var g=t.call(arguments,1);return this.updateIn(u,Qe(),function(y){return typeof y.mergeDeep=="function"?y.mergeDeep.apply(y,g):g[g.length-1]})},bt.prototype.sort=function(u){return un(Ca(this,u))},bt.prototype.sortBy=function(u,g){return un(Ca(this,g,u))},bt.prototype.withMutations=function(u){var g=this.asMutable();return u(g),g.wasAltered()?g.__ensureOwner(this.__ownerID):this},bt.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new L)},bt.prototype.asImmutable=function(){return this.__ensureOwner()},bt.prototype.wasAltered=function(){return this.__altered},bt.prototype.__iterator=function(u,g){return new ze(this,u,g)},bt.prototype.__iterate=function(u,g){var y=this,w=0;return this._root&&this._root.iterate(function(R){return w++,u(R[1],R[0],y)},g),w},bt.prototype.__ensureOwner=function(u){return u===this.__ownerID?this:u?st(this.size,this._root,u,this.__hash):(this.__ownerID=u,this.__altered=!1,this)};function zl(u){return!!(u&&u[Ju])}bt.isMap=zl;var Ju="@@__IMMUTABLE_MAP__@@",P=bt.prototype;P[Ju]=!0,P[_]=P.remove,P.removeIn=P.deleteIn;function X(u,g){this.ownerID=u,this.entries=g}X.prototype.get=function(u,g,y,w){for(var R=this.entries,D=0,k=R.length;D<k;D++)if(Ve(y,R[D][0]))return R[D][1];return w},X.prototype.update=function(u,g,y,w,R,D,k){for(var j=R===S,ae=this.entries,he=0,ge=ae.length;he<ge&&!Ve(w,ae[he][0]);he++);var He=he<ge;if(He?ae[he][1]===R:j)return this;if(A(k),(j||!He)&&A(D),!(j&&ae.length===1)){if(!He&&!j&&ae.length>=zn)return Dt(u,ae,w,R);var nt=u&&u===this.ownerID,dt=nt?ae:N(ae);return He?j?he===ge-1?dt.pop():dt[he]=dt.pop():dt[he]=[w,R]:dt.push([w,R]),nt?(this.entries=dt,this):new X(u,dt)}};function re(u,g,y){this.ownerID=u,this.bitmap=g,this.nodes=y}re.prototype.get=function(u,g,y,w){g===void 0&&(g=ft(y));var R=1<<((u===0?g:g>>>u)&E),D=this.bitmap;return(D&R)===0?w:this.nodes[$t(D&R-1)].get(u+b,g,y,w)},re.prototype.update=function(u,g,y,w,R,D,k){y===void 0&&(y=ft(w));var j=(g===0?y:y>>>g)&E,ae=1<<j,he=this.bitmap,ge=(he&ae)!==0;if(!ge&&R===S)return this;var He=$t(he&ae-1),nt=this.nodes,dt=ge?nt[He]:void 0,yt=Rt(dt,u,g+b,y,w,R,D,k);if(yt===dt)return this;if(!ge&&yt&&nt.length>=kl)return Qt(u,nt,he,j,yt);if(ge&&!yt&&nt.length===2&&Jt(nt[He^1]))return nt[He^1];if(ge&&yt&&nt.length===1&&Jt(yt))return yt;var nn=u&&u===this.ownerID,oi=ge?yt?he:he^ae:he|ae,Ii=ge?yt?Xn(nt,He,yt,nn):Cn(nt,He,nn):ir(nt,He,yt,nn);return nn?(this.bitmap=oi,this.nodes=Ii,this):new re(u,oi,Ii)};function ie(u,g,y){this.ownerID=u,this.count=g,this.nodes=y}ie.prototype.get=function(u,g,y,w){g===void 0&&(g=ft(y));var R=(u===0?g:g>>>u)&E,D=this.nodes[R];return D?D.get(u+b,g,y,w):w},ie.prototype.update=function(u,g,y,w,R,D,k){y===void 0&&(y=ft(w));var j=(g===0?y:y>>>g)&E,ae=R===S,he=this.nodes,ge=he[j];if(ae&&!ge)return this;var He=Rt(ge,u,g+b,y,w,R,D,k);if(He===ge)return this;var nt=this.count;if(!ge)nt++;else if(!He&&(nt--,nt<es))return ot(u,he,nt,j);var dt=u&&u===this.ownerID,yt=Xn(he,j,He,dt);return dt?(this.count=nt,this.nodes=yt,this):new ie(u,nt,yt)};function Y(u,g,y){this.ownerID=u,this.keyHash=g,this.entries=y}Y.prototype.get=function(u,g,y,w){for(var R=this.entries,D=0,k=R.length;D<k;D++)if(Ve(y,R[D][0]))return R[D][1];return w},Y.prototype.update=function(u,g,y,w,R,D,k){y===void 0&&(y=ft(w));var j=R===S;if(y!==this.keyHash)return j?this:(A(k),A(D),qt(this,u,g,y,[w,R]));for(var ae=this.entries,he=0,ge=ae.length;he<ge&&!Ve(w,ae[he][0]);he++);var He=he<ge;if(He?ae[he][1]===R:j)return this;if(A(k),(j||!He)&&A(D),j&&ge===2)return new we(u,this.keyHash,ae[he^1]);var nt=u&&u===this.ownerID,dt=nt?ae:N(ae);return He?j?he===ge-1?dt.pop():dt[he]=dt.pop():dt[he]=[w,R]:dt.push([w,R]),nt?(this.entries=dt,this):new Y(u,this.keyHash,dt)};function we(u,g,y){this.ownerID=u,this.keyHash=g,this.entry=y}we.prototype.get=function(u,g,y,w){return Ve(y,this.entry[0])?this.entry[1]:w},we.prototype.update=function(u,g,y,w,R,D,k){var j=R===S,ae=Ve(w,this.entry[0]);if(ae?R===this.entry[1]:j)return this;if(A(k),j){A(D);return}return ae?u&&u===this.ownerID?(this.entry[1]=R,this):new we(u,this.keyHash,[w,R]):(A(D),qt(this,u,g,ft(w),[w,R]))},X.prototype.iterate=Y.prototype.iterate=function(u,g){for(var y=this.entries,w=0,R=y.length-1;w<=R;w++)if(u(y[g?R-w:w])===!1)return!1},re.prototype.iterate=ie.prototype.iterate=function(u,g){for(var y=this.nodes,w=0,R=y.length-1;w<=R;w++){var D=y[g?R-w:w];if(D&&D.iterate(u,g)===!1)return!1}},we.prototype.iterate=function(u,g){return u(this.entry)},r(ze,V);function ze(u,g,y){this._type=g,this._reverse=y,this._stack=u._root&&Ye(u._root)}ze.prototype.next=function(){for(var u=this._type,g=this._stack;g;){var y=g.node,w=g.index++,R;if(y.entry){if(w===0)return Je(u,y.entry)}else if(y.entries){if(R=y.entries.length-1,w<=R)return Je(u,y.entries[this._reverse?R-w:w])}else if(R=y.nodes.length-1,w<=R){var D=y.nodes[this._reverse?R-w:w];if(D){if(D.entry)return Je(u,D.entry);g=this._stack=Ye(D,g)}continue}g=this._stack=this._stack.__prev}return W()};function Je(u,g){return te(u,g[0],g[1])}function Ye(u,g){return{node:u,index:0,__prev:g}}function st(u,g,y,w){var R=Object.create(P);return R.size=u,R._root=g,R.__ownerID=y,R.__hash=w,R.__altered=!1,R}var lt;function Qe(){return lt||(lt=st(0))}function xt(u,g,y){var w,R;if(u._root){var D=O(T),k=O(q);if(w=Rt(u._root,u.__ownerID,0,void 0,g,y,D,k),!k.value)return u;R=u.size+(D.value?y===S?-1:1:0)}else{if(y===S)return u;R=1,w=new X(u.__ownerID,[[g,y]])}return u.__ownerID?(u.size=R,u._root=w,u.__hash=void 0,u.__altered=!0,u):w?st(R,w):Qe()}function Rt(u,g,y,w,R,D,k,j){return u?u.update(g,y,w,R,D,k,j):D===S?u:(A(j),A(k),new we(g,w,[R,D]))}function Jt(u){return u.constructor===we||u.constructor===Y}function qt(u,g,y,w,R){if(u.keyHash===w)return new Y(g,w,[u.entry,R]);var D=(y===0?u.keyHash:u.keyHash>>>y)&E,k=(y===0?w:w>>>y)&E,j,ae=D===k?[qt(u,g,y+b,w,R)]:(j=new we(g,w,R),D<k?[u,j]:[j,u]);return new re(g,1<<D|1<<k,ae)}function Dt(u,g,y,w){u||(u=new L);for(var R=new we(u,ft(y),[y,w]),D=0;D<g.length;D++){var k=g[D];R=R.update(u,0,void 0,k[0],k[1])}return R}function ot(u,g,y,w){for(var R=0,D=0,k=new Array(y),j=0,ae=1,he=g.length;j<he;j++,ae<<=1){var ge=g[j];ge!==void 0&&j!==w&&(R|=ae,k[D++]=ge)}return new re(u,R,k)}function Qt(u,g,y,w,R){for(var D=0,k=new Array(M),j=0;y!==0;j++,y>>>=1)k[j]=y&1?g[D++]:void 0;return k[w]=R,new ie(u,D+1,k)}function Et(u,g,y){for(var w=[],R=0;R<y.length;R++){var D=y[R],k=s(D);l(D)||(k=k.map(function(j){return We(j)})),w.push(k)}return Fn(u,g,w)}function Un(u,g,y){return u&&u.mergeDeep&&l(g)?u.mergeDeep(g):Ve(u,g)?u:g}function Qi(u){return function(g,y,w){if(g&&g.mergeDeepWith&&l(y))return g.mergeDeepWith(u,y);var R=u(g,y,w);return Ve(g,R)?g:R}}function Fn(u,g,y){return y=y.filter(function(w){return w.size!==0}),y.length===0?u:u.size===0&&!u.__ownerID&&y.length===1?u.constructor(y[0]):u.withMutations(function(w){for(var R=g?function(k,j){w.update(j,S,function(ae){return ae===S?k:g(ae,k,j)})}:function(k,j){w.set(j,k)},D=0;D<y.length;D++)y[D].forEach(R)})}function Ts(u,g,y,w){var R=u===S,D=g.next();if(D.done){var k=R?y:u,j=w(k);return j===k?u:j}H(R||u&&u.set,"invalid keyPath");var ae=D.value,he=R?S:u.get(ae,S),ge=Ts(he,g,y,w);return ge===he?u:ge===S?u.remove(ae):(R?Qe():u).set(ae,ge)}function $t(u){return u=u-(u>>1&1431655765),u=(u&858993459)+(u>>2&858993459),u=u+(u>>4)&252645135,u=u+(u>>8),u=u+(u>>16),u&127}function Xn(u,g,y,w){var R=w?u:N(u);return R[g]=y,R}function ir(u,g,y,w){var R=u.length+1;if(w&&g+1===R)return u[g]=y,u;for(var D=new Array(R),k=0,j=0;j<R;j++)j===g?(D[j]=y,k=-1):D[j]=u[j+k];return D}function Cn(u,g,y){var w=u.length-1;if(y&&g===w)return u.pop(),u;for(var R=new Array(w),D=0,k=0;k<w;k++)k===g&&(D=1),R[k]=u[k+D];return R}var zn=M/4,kl=M/2,es=M/4;r(en,me);function en(u){var g=gm();if(u==null)return g;if(n2(u))return u;var y=o(u),w=y.size;return w===0?g:(jn(w),w>0&&w<M?Vl(0,w,b,null,new As(y.toArray())):g.withMutations(function(R){R.setSize(w),y.forEach(function(D,k){return R.set(k,D)})}))}en.of=function(){return this(arguments)},en.prototype.toString=function(){return this.__toString("List [","]")},en.prototype.get=function(u,g){if(u=K(this,u),u>=0&&u<this.size){u+=this._origin;var y=o2(this,u);return y&&y.array[u&E]}return g},en.prototype.set=function(u,g){return BC(this,u,g)},en.prototype.remove=function(u){return this.has(u)?u===0?this.shift():u===this.size-1?this.pop():this.splice(u,1):this},en.prototype.insert=function(u,g){return this.splice(u,0,g)},en.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=b,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):gm()},en.prototype.push=function(){var u=arguments,g=this.size;return this.withMutations(function(y){Cs(y,0,g+u.length);for(var w=0;w<u.length;w++)y.set(g+w,u[w])})},en.prototype.pop=function(){return Cs(this,0,-1)},en.prototype.unshift=function(){var u=arguments;return this.withMutations(function(g){Cs(g,-u.length);for(var y=0;y<u.length;y++)g.set(y,u[y])})},en.prototype.shift=function(){return Cs(this,1)},en.prototype.merge=function(){return Qu(this,void 0,arguments)},en.prototype.mergeWith=function(u){var g=t.call(arguments,1);return Qu(this,u,g)},en.prototype.mergeDeep=function(){return Qu(this,Un,arguments)},en.prototype.mergeDeepWith=function(u){var g=t.call(arguments,1);return Qu(this,Qi(u),g)},en.prototype.setSize=function(u){return Cs(this,0,u)},en.prototype.slice=function(u,g){var y=this.size;return ce(u,g,y)?this:Cs(this,J(u,y),oe(g,y))},en.prototype.__iterator=function(u,g){var y=0,w=i2(this,g);return new V(function(){var R=w();return R===Bl?W():te(u,y++,R)})},en.prototype.__iterate=function(u,g){for(var y=0,w=i2(this,g),R;(R=w())!==Bl&&u(R,y++,this)!==!1;);return y},en.prototype.__ensureOwner=function(u){return u===this.__ownerID?this:u?Vl(this._origin,this._capacity,this._level,this._root,this._tail,u,this.__hash):(this.__ownerID=u,this)};function n2(u){return!!(u&&u[r2])}en.isList=n2;var r2="@@__IMMUTABLE_LIST__@@",$n=en.prototype;$n[r2]=!0,$n[_]=$n.remove,$n.setIn=P.setIn,$n.deleteIn=$n.removeIn=P.removeIn,$n.update=P.update,$n.updateIn=P.updateIn,$n.mergeIn=P.mergeIn,$n.mergeDeepIn=P.mergeDeepIn,$n.withMutations=P.withMutations,$n.asMutable=P.asMutable,$n.asImmutable=P.asImmutable,$n.wasAltered=P.wasAltered;function As(u,g){this.array=u,this.ownerID=g}As.prototype.removeBefore=function(u,g,y){if(y===g?1<<g:this.array.length===0)return this;var w=y>>>g&E;if(w>=this.array.length)return new As([],u);var R=w===0,D;if(g>0){var k=this.array[w];if(D=k&&k.removeBefore(u,g-b,y),D===k&&R)return this}if(R&&!D)return this;var j=Ma(this,u);if(!R)for(var ae=0;ae<w;ae++)j.array[ae]=void 0;return D&&(j.array[w]=D),j},As.prototype.removeAfter=function(u,g,y){if(y===(g?1<<g:0)||this.array.length===0)return this;var w=y-1>>>g&E;if(w>=this.array.length)return this;var R;if(g>0){var D=this.array[w];if(R=D&&D.removeAfter(u,g-b,y),R===D&&w===this.array.length-1)return this}var k=Ma(this,u);return k.array.splice(w+1),R&&(k.array[w]=R),k};var Bl={};function i2(u,g){var y=u._origin,w=u._capacity,R=Hl(w),D=u._tail;return k(u._root,u._level,0);function k(he,ge,He){return ge===0?j(he,He):ae(he,ge,He)}function j(he,ge){var He=ge===R?D&&D.array:he&&he.array,nt=ge>y?0:y-ge,dt=w-ge;return dt>M&&(dt=M),function(){if(nt===dt)return Bl;var yt=g?--dt:nt++;return He&&He[yt]}}function ae(he,ge,He){var nt,dt=he&&he.array,yt=He>y?0:y-He>>ge,nn=(w-He>>ge)+1;return nn>M&&(nn=M),function(){do{if(nt){var oi=nt();if(oi!==Bl)return oi;nt=null}if(yt===nn)return Bl;var Ii=g?--nn:yt++;nt=k(dt&&dt[Ii],ge-b,He+(Ii<<ge))}while(!0)}}}function Vl(u,g,y,w,R,D,k){var j=Object.create($n);return j.size=g-u,j._origin=u,j._capacity=g,j._level=y,j._root=w,j._tail=R,j.__ownerID=D,j.__hash=k,j.__altered=!1,j}var s2;function gm(){return s2||(s2=Vl(0,0,b))}function BC(u,g,y){if(g=K(u,g),g!==g)return u;if(g>=u.size||g<0)return u.withMutations(function(k){g<0?Cs(k,g).set(0,y):Cs(k,0,g+1).set(g,y)});g+=u._origin;var w=u._tail,R=u._root,D=O(q);return g>=Hl(u._capacity)?w=_m(w,u.__ownerID,0,g,y,D):R=_m(R,u.__ownerID,u._level,g,y,D),D.value?u.__ownerID?(u._root=R,u._tail=w,u.__hash=void 0,u.__altered=!0,u):Vl(u._origin,u._capacity,u._level,R,w):u}function _m(u,g,y,w,R,D){var k=w>>>y&E,j=u&&k<u.array.length;if(!j&&R===void 0)return u;var ae;if(y>0){var he=u&&u.array[k],ge=_m(he,g,y-b,w,R,D);return ge===he?u:(ae=Ma(u,g),ae.array[k]=ge,ae)}return j&&u.array[k]===R?u:(A(D),ae=Ma(u,g),R===void 0&&k===ae.array.length-1?ae.array.pop():ae.array[k]=R,ae)}function Ma(u,g){return g&&u&&g===u.ownerID?u:new As(u?u.array.slice():[],g)}function o2(u,g){if(g>=Hl(u._capacity))return u._tail;if(g<1<<u._level+b){for(var y=u._root,w=u._level;y&&w>0;)y=y.array[g>>>w&E],w-=b;return y}}function Cs(u,g,y){g!==void 0&&(g=g|0),y!==void 0&&(y=y|0);var w=u.__ownerID||new L,R=u._origin,D=u._capacity,k=R+g,j=y===void 0?D:y<0?D+y:R+y;if(k===R&&j===D)return u;if(k>=j)return u.clear();for(var ae=u._level,he=u._root,ge=0;k+ge<0;)he=new As(he&&he.array.length?[void 0,he]:[],w),ae+=b,ge+=1<<ae;ge&&(k+=ge,R+=ge,j+=ge,D+=ge);for(var He=Hl(D),nt=Hl(j);nt>=1<<ae+b;)he=new As(he&&he.array.length?[he]:[],w),ae+=b;var dt=u._tail,yt=nt<He?o2(u,j-1):nt>He?new As([],w):dt;if(dt&&nt>He&&k<D&&dt.array.length){he=Ma(he,w);for(var nn=he,oi=ae;oi>b;oi-=b){var Ii=He>>>oi&E;nn=nn.array[Ii]=Ma(nn.array[Ii],w)}nn.array[He>>>b&E]=dt}if(j<D&&(yt=yt&&yt.removeAfter(w,0,j)),k>=nt)k-=nt,j-=nt,ae=b,he=null,yt=yt&&yt.removeBefore(w,0,k);else if(k>R||nt<He){for(ge=0;he;){var oh=k>>>ae&E;if(oh!==nt>>>ae&E)break;oh&&(ge+=(1<<ae)*oh),ae-=b,he=he.array[oh]}he&&k>R&&(he=he.removeBefore(w,ae,k-ge)),he&&nt<He&&(he=he.removeAfter(w,ae,nt-ge)),ge&&(k-=ge,j-=ge)}return u.__ownerID?(u.size=j-k,u._origin=k,u._capacity=j,u._level=ae,u._root=he,u._tail=yt,u.__hash=void 0,u.__altered=!0,u):Vl(k,j,ae,he,yt)}function Qu(u,g,y){for(var w=[],R=0,D=0;D<y.length;D++){var k=y[D],j=o(k);j.size>R&&(R=j.size),l(k)||(j=j.map(function(ae){return We(ae)})),w.push(j)}return R>u.size&&(u=u.setSize(R)),Fn(u,g,w)}function Hl(u){return u<M?0:u-1>>>b<<b}r(un,bt);function un(u){return u==null?eh():a2(u)?u:eh().withMutations(function(g){var y=s(u);jn(y.size),y.forEach(function(w,R){return g.set(R,w)})})}un.of=function(){return this(arguments)},un.prototype.toString=function(){return this.__toString("OrderedMap {","}")},un.prototype.get=function(u,g){var y=this._map.get(u);return y!==void 0?this._list.get(y)[1]:g},un.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):eh()},un.prototype.set=function(u,g){return c2(this,u,g)},un.prototype.remove=function(u){return c2(this,u,S)},un.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},un.prototype.__iterate=function(u,g){var y=this;return this._list.__iterate(function(w){return w&&u(w[1],w[0],y)},g)},un.prototype.__iterator=function(u,g){return this._list.fromEntrySeq().__iterator(u,g)},un.prototype.__ensureOwner=function(u){if(u===this.__ownerID)return this;var g=this._map.__ensureOwner(u),y=this._list.__ensureOwner(u);return u?vm(g,y,u,this.__hash):(this.__ownerID=u,this._map=g,this._list=y,this)};function a2(u){return zl(u)&&p(u)}un.isOrderedMap=a2,un.prototype[v]=!0,un.prototype[_]=un.prototype.remove;function vm(u,g,y,w){var R=Object.create(un.prototype);return R.size=u?u.size:0,R._map=u,R._list=g,R.__ownerID=y,R.__hash=w,R}var l2;function eh(){return l2||(l2=vm(Qe(),gm()))}function c2(u,g,y){var w=u._map,R=u._list,D=w.get(g),k=D!==void 0,j,ae;if(y===S){if(!k)return u;R.size>=M&&R.size>=w.size*2?(ae=R.filter(function(he,ge){return he!==void 0&&D!==ge}),j=ae.toKeyedSeq().map(function(he){return he[0]}).flip().toMap(),u.__ownerID&&(j.__ownerID=ae.__ownerID=u.__ownerID)):(j=w.remove(g),ae=D===R.size-1?R.pop():R.set(D,void 0))}else if(k){if(y===R.get(D)[1])return u;j=w,ae=R.set(D,[g,y])}else j=w.set(g,R.size),ae=R.set(R.size,[g,y]);return u.__ownerID?(u.size=j.size,u._map=j,u._list=ae,u.__hash=void 0,u):vm(j,ae)}r(qr,it);function qr(u,g){this._iter=u,this._useKeys=g,this.size=u.size}qr.prototype.get=function(u,g){return this._iter.get(u,g)},qr.prototype.has=function(u){return this._iter.has(u)},qr.prototype.valueSeq=function(){return this._iter.valueSeq()},qr.prototype.reverse=function(){var u=this,g=xm(this,!0);return this._useKeys||(g.valueSeq=function(){return u._iter.toSeq().reverse()}),g},qr.prototype.map=function(u,g){var y=this,w=h2(this,u,g);return this._useKeys||(w.valueSeq=function(){return y._iter.toSeq().map(u,g)}),w},qr.prototype.__iterate=function(u,g){var y=this,w;return this._iter.__iterate(this._useKeys?function(R,D){return u(R,D,y)}:(w=g?_2(this):0,function(R){return u(R,g?--w:w++,y)}),g)},qr.prototype.__iterator=function(u,g){if(this._useKeys)return this._iter.__iterator(u,g);var y=this._iter.__iterator(U,g),w=g?_2(this):0;return new V(function(){var R=y.next();return R.done?R:te(u,g?--w:w++,R.value,R)})},qr.prototype[v]=!0,r(wa,Ie);function wa(u){this._iter=u,this.size=u.size}wa.prototype.includes=function(u){return this._iter.includes(u)},wa.prototype.__iterate=function(u,g){var y=this,w=0;return this._iter.__iterate(function(R){return u(R,w++,y)},g)},wa.prototype.__iterator=function(u,g){var y=this._iter.__iterator(U,g),w=0;return new V(function(){var R=y.next();return R.done?R:te(u,w++,R.value,R)})},r(Ta,$e);function Ta(u){this._iter=u,this.size=u.size}Ta.prototype.has=function(u){return this._iter.includes(u)},Ta.prototype.__iterate=function(u,g){var y=this;return this._iter.__iterate(function(w){return u(w,w,y)},g)},Ta.prototype.__iterator=function(u,g){var y=this._iter.__iterator(U,g);return new V(function(){var w=y.next();return w.done?w:te(u,w.value,w.value,w)})},r(Aa,it);function Aa(u){this._iter=u,this.size=u.size}Aa.prototype.entrySeq=function(){return this._iter.toSeq()},Aa.prototype.__iterate=function(u,g){var y=this;return this._iter.__iterate(function(w){if(w){g2(w);var R=l(w);return u(R?w.get(1):w[1],R?w.get(0):w[0],y)}},g)},Aa.prototype.__iterator=function(u,g){var y=this._iter.__iterator(U,g);return new V(function(){for(;;){var w=y.next();if(w.done)return w;var R=w.value;if(R){g2(R);var D=l(R);return te(u,D?R.get(0):R[0],D?R.get(1):R[1],w)}}})},wa.prototype.cacheResult=qr.prototype.cacheResult=Ta.prototype.cacheResult=Aa.prototype.cacheResult=Em;function u2(u){var g=Ci(u);return g._iter=u,g.size=u.size,g.flip=function(){return u},g.reverse=function(){var y=u.reverse.apply(this);return y.flip=function(){return u.reverse()},y},g.has=function(y){return u.includes(y)},g.includes=function(y){return u.has(y)},g.cacheResult=Em,g.__iterateUncached=function(y,w){var R=this;return u.__iterate(function(D,k){return y(k,D,R)!==!1},w)},g.__iteratorUncached=function(y,w){if(y===$){var R=u.__iterator(y,w);return new V(function(){var D=R.next();if(!D.done){var k=D.value[0];D.value[0]=D.value[1],D.value[1]=k}return D})}return u.__iterator(y===U?xe:U,w)},g}function h2(u,g,y){var w=Ci(u);return w.size=u.size,w.has=function(R){return u.has(R)},w.get=function(R,D){var k=u.get(R,S);return k===S?D:g.call(y,k,R,u)},w.__iterateUncached=function(R,D){var k=this;return u.__iterate(function(j,ae,he){return R(g.call(y,j,ae,he),ae,k)!==!1},D)},w.__iteratorUncached=function(R,D){var k=u.__iterator($,D);return new V(function(){var j=k.next();if(j.done)return j;var ae=j.value,he=ae[0];return te(R,he,g.call(y,ae[1],he,u),j)})},w}function xm(u,g){var y=Ci(u);return y._iter=u,y.size=u.size,y.reverse=function(){return u},u.flip&&(y.flip=function(){var w=u2(u);return w.reverse=function(){return u.flip()},w}),y.get=function(w,R){return u.get(g?w:-1-w,R)},y.has=function(w){return u.has(g?w:-1-w)},y.includes=function(w){return u.includes(w)},y.cacheResult=Em,y.__iterate=function(w,R){var D=this;return u.__iterate(function(k,j){return w(k,j,D)},!R)},y.__iterator=function(w,R){return u.__iterator(w,!R)},y}function f2(u,g,y,w){var R=Ci(u);return w&&(R.has=function(D){var k=u.get(D,S);return k!==S&&!!g.call(y,k,D,u)},R.get=function(D,k){var j=u.get(D,S);return j!==S&&g.call(y,j,D,u)?j:k}),R.__iterateUncached=function(D,k){var j=this,ae=0;return u.__iterate(function(he,ge,He){if(g.call(y,he,ge,He))return ae++,D(he,w?ge:ae-1,j)},k),ae},R.__iteratorUncached=function(D,k){var j=u.__iterator($,k),ae=0;return new V(function(){for(;;){var he=j.next();if(he.done)return he;var ge=he.value,He=ge[0],nt=ge[1];if(g.call(y,nt,He,u))return te(D,w?He:ae++,nt,he)}})},R}function VC(u,g,y){var w=bt().asMutable();return u.__iterate(function(R,D){w.update(g.call(y,R,D,u),0,function(k){return k+1})}),w.asImmutable()}function HC(u,g,y){var w=c(u),R=(p(u)?un():bt()).asMutable();u.__iterate(function(k,j){R.update(g.call(y,k,j,u),function(ae){return ae=ae||[],ae.push(w?[j,k]:k),ae})});var D=v2(u);return R.map(function(k){return Gt(u,D(k))})}function ym(u,g,y,w){var R=u.size;if(g!==void 0&&(g=g|0),y!==void 0&&(y===1/0?y=R:y=y|0),ce(g,y,R))return u;var D=J(g,R),k=oe(y,R);if(D!==D||k!==k)return ym(u.toSeq().cacheResult(),g,y,w);var j=k-D,ae;j===j&&(ae=j<0?0:j);var he=Ci(u);return he.size=ae===0?ae:u.size&&ae||void 0,!w&&wt(u)&&ae>=0&&(he.get=function(ge,He){return ge=K(this,ge),ge>=0&&ge<ae?u.get(ge+D,He):He}),he.__iterateUncached=function(ge,He){var nt=this;if(ae===0)return 0;if(He)return this.cacheResult().__iterate(ge,He);var dt=0,yt=!0,nn=0;return u.__iterate(function(oi,Ii){if(!(yt&&(yt=dt++<D)))return nn++,ge(oi,w?Ii:nn-1,nt)!==!1&&nn!==ae}),nn},he.__iteratorUncached=function(ge,He){if(ae!==0&&He)return this.cacheResult().__iterator(ge,He);var nt=ae!==0&&u.__iterator(ge,He),dt=0,yt=0;return new V(function(){for(;dt++<D;)nt.next();if(++yt>ae)return W();var nn=nt.next();return w||ge===U?nn:ge===xe?te(ge,yt-1,void 0,nn):te(ge,yt-1,nn.value[1],nn)})},he}function GC(u,g,y){var w=Ci(u);return w.__iterateUncached=function(R,D){var k=this;if(D)return this.cacheResult().__iterate(R,D);var j=0;return u.__iterate(function(ae,he,ge){return g.call(y,ae,he,ge)&&++j&&R(ae,he,k)}),j},w.__iteratorUncached=function(R,D){var k=this;if(D)return this.cacheResult().__iterator(R,D);var j=u.__iterator($,D),ae=!0;return new V(function(){if(!ae)return W();var he=j.next();if(he.done)return he;var ge=he.value,He=ge[0],nt=ge[1];return g.call(y,nt,He,k)?R===$?he:te(R,He,nt,he):(ae=!1,W())})},w}function d2(u,g,y,w){var R=Ci(u);return R.__iterateUncached=function(D,k){var j=this;if(k)return this.cacheResult().__iterate(D,k);var ae=!0,he=0;return u.__iterate(function(ge,He,nt){if(!(ae&&(ae=g.call(y,ge,He,nt))))return he++,D(ge,w?He:he-1,j)}),he},R.__iteratorUncached=function(D,k){var j=this;if(k)return this.cacheResult().__iterator(D,k);var ae=u.__iterator($,k),he=!0,ge=0;return new V(function(){var He,nt,dt;do{if(He=ae.next(),He.done)return w||D===U?He:D===xe?te(D,ge++,void 0,He):te(D,ge++,He.value[1],He);var yt=He.value;nt=yt[0],dt=yt[1],he&&(he=g.call(y,dt,nt,j))}while(he);return D===$?He:te(D,nt,dt,He)})},R}function WC(u,g){var y=c(u),w=[u].concat(g).map(function(k){return l(k)?y&&(k=s(k)):k=y?ee(k):de(Array.isArray(k)?k:[k]),k}).filter(function(k){return k.size!==0});if(w.length===0)return u;if(w.length===1){var R=w[0];if(R===u||y&&c(R)||h(u)&&h(R))return R}var D=new De(w);return y?D=D.toKeyedSeq():h(u)||(D=D.toSetSeq()),D=D.flatten(!0),D.size=w.reduce(function(k,j){if(k!==void 0){var ae=j.size;if(ae!==void 0)return k+ae}},0),D}function p2(u,g,y){var w=Ci(u);return w.__iterateUncached=function(R,D){var k=0,j=!1;function ae(he,ge){var He=this;he.__iterate(function(nt,dt){return(!g||ge<g)&&l(nt)?ae(nt,ge+1):R(nt,y?dt:k++,He)===!1&&(j=!0),!j},D)}return ae(u,0),k},w.__iteratorUncached=function(R,D){var k=u.__iterator(R,D),j=[],ae=0;return new V(function(){for(;k;){var he=k.next();if(he.done!==!1){k=j.pop();continue}var ge=he.value;if(R===$&&(ge=ge[1]),(!g||j.length<g)&&l(ge))j.push(k),k=ge.__iterator(R,D);else return y?he:te(R,ae++,ge,he)}return W()})},w}function jC(u,g,y){var w=v2(u);return u.toSeq().map(function(R,D){return w(g.call(y,R,D,u))}).flatten(!0)}function XC(u,g){var y=Ci(u);return y.size=u.size&&u.size*2-1,y.__iterateUncached=function(w,R){var D=this,k=0;return u.__iterate(function(j,ae){return(!k||w(g,k++,D)!==!1)&&w(j,k++,D)!==!1},R),k},y.__iteratorUncached=function(w,R){var D=u.__iterator(U,R),k=0,j;return new V(function(){return(!j||k%2)&&(j=D.next(),j.done)?j:k%2?te(w,k++,g):te(w,k++,j.value,j)})},y}function Ca(u,g,y){g||(g=x2);var w=c(u),R=0,D=u.toSeq().map(function(k,j){return[j,k,R++,y?y(k,j,u):k]}).toArray();return D.sort(function(k,j){return g(k[3],j[3])||k[2]-j[2]}).forEach(w?function(k,j){D[j].length=2}:function(k,j){D[j]=k[1]}),w?it(D):h(u)?Ie(D):$e(D)}function th(u,g,y){if(g||(g=x2),y){var w=u.toSeq().map(function(R,D){return[R,y(R,D,u)]}).reduce(function(R,D){return m2(g,R[1],D[1])?D:R});return w&&w[0]}else return u.reduce(function(R,D){return m2(g,R,D)?D:R})}function m2(u,g,y){var w=u(y,g);return w===0&&y!==g&&(y==null||y!==y)||w>0}function Sm(u,g,y){var w=Ci(u);return w.size=new De(y).map(function(R){return R.size}).min(),w.__iterate=function(R,D){for(var k=this.__iterator(U,D),j,ae=0;!(j=k.next()).done&&R(j.value,ae++,this)!==!1;);return ae},w.__iteratorUncached=function(R,D){var k=y.map(function(he){return he=i(he),Q(D?he.reverse():he)}),j=0,ae=!1;return new V(function(){var he;return ae||(he=k.map(function(ge){return ge.next()}),ae=he.some(function(ge){return ge.done})),ae?W():te(R,j++,g.apply(null,he.map(function(ge){return ge.value})))})},w}function Gt(u,g){return wt(u)?g:u.constructor(g)}function g2(u){if(u!==Object(u))throw new TypeError("Expected [K, V] tuple: "+u)}function _2(u){return jn(u.size),Z(u)}function v2(u){return c(u)?s:h(u)?o:a}function Ci(u){return Object.create((c(u)?it:h(u)?Ie:$e).prototype)}function Em(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):z.prototype.cacheResult.call(this)}function x2(u,g){return u>g?1:u<g?-1:0}function y2(u){var g=Q(u);if(!g){if(!le(u))throw new TypeError("Expected iterable or array-like: "+u);g=Q(i(u))}return g}r(xr,Te);function xr(u,g){var y,w=function(k){if(k instanceof w)return k;if(!(this instanceof w))return new w(k);if(!y){y=!0;var j=Object.keys(u);$C(R,j),R.size=j.length,R._name=g,R._keys=j,R._defaultValues=u}this._map=bt(k)},R=w.prototype=Object.create(Rn);return R.constructor=w,w}xr.prototype.toString=function(){return this.__toString(S2(this)+" {","}")},xr.prototype.has=function(u){return this._defaultValues.hasOwnProperty(u)},xr.prototype.get=function(u,g){if(!this.has(u))return g;var y=this._defaultValues[u];return this._map?this._map.get(u,y):y},xr.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var u=this.constructor;return u._empty||(u._empty=nh(this,Qe()))},xr.prototype.set=function(u,g){if(!this.has(u))throw new Error('Cannot set unknown key "'+u+'" on '+S2(this));if(this._map&&!this._map.has(u)){var y=this._defaultValues[u];if(g===y)return this}var w=this._map&&this._map.set(u,g);return this.__ownerID||w===this._map?this:nh(this,w)},xr.prototype.remove=function(u){if(!this.has(u))return this;var g=this._map&&this._map.remove(u);return this.__ownerID||g===this._map?this:nh(this,g)},xr.prototype.wasAltered=function(){return this._map.wasAltered()},xr.prototype.__iterator=function(u,g){var y=this;return s(this._defaultValues).map(function(w,R){return y.get(R)}).__iterator(u,g)},xr.prototype.__iterate=function(u,g){var y=this;return s(this._defaultValues).map(function(w,R){return y.get(R)}).__iterate(u,g)},xr.prototype.__ensureOwner=function(u){if(u===this.__ownerID)return this;var g=this._map&&this._map.__ensureOwner(u);return u?nh(this,g,u):(this.__ownerID=u,this._map=g,this)};var Rn=xr.prototype;Rn[_]=Rn.remove,Rn.deleteIn=Rn.removeIn=P.removeIn,Rn.merge=P.merge,Rn.mergeWith=P.mergeWith,Rn.mergeIn=P.mergeIn,Rn.mergeDeep=P.mergeDeep,Rn.mergeDeepWith=P.mergeDeepWith,Rn.mergeDeepIn=P.mergeDeepIn,Rn.setIn=P.setIn,Rn.update=P.update,Rn.updateIn=P.updateIn,Rn.withMutations=P.withMutations,Rn.asMutable=P.asMutable,Rn.asImmutable=P.asImmutable;function nh(u,g,y){var w=Object.create(Object.getPrototypeOf(u));return w._map=g,w.__ownerID=y,w}function S2(u){return u._name||u.constructor.name||"Record"}function $C(u,g){try{g.forEach(YC.bind(void 0,u))}catch{}}function YC(u,g){Object.defineProperty(u,g,{get:function(){return this.get(g)},set:function(y){H(this.__ownerID,"Cannot set on an immutable record."),this.set(g,y)}})}r(tn,Ze);function tn(u){return u==null?wm():bm(u)&&!p(u)?u:wm().withMutations(function(g){var y=a(u);jn(y.size),y.forEach(function(w){return g.add(w)})})}tn.of=function(){return this(arguments)},tn.fromKeys=function(u){return this(s(u).keySeq())},tn.prototype.toString=function(){return this.__toString("Set {","}")},tn.prototype.has=function(u){return this._map.has(u)},tn.prototype.add=function(u){return Mm(this,this._map.set(u,!0))},tn.prototype.remove=function(u){return Mm(this,this._map.remove(u))},tn.prototype.clear=function(){return Mm(this,this._map.clear())},tn.prototype.union=function(){var u=t.call(arguments,0);return u=u.filter(function(g){return g.size!==0}),u.length===0?this:this.size===0&&!this.__ownerID&&u.length===1?this.constructor(u[0]):this.withMutations(function(g){for(var y=0;y<u.length;y++)a(u[y]).forEach(function(w){return g.add(w)})})},tn.prototype.intersect=function(){var u=t.call(arguments,0);if(u.length===0)return this;u=u.map(function(y){return a(y)});var g=this;return this.withMutations(function(y){g.forEach(function(w){u.every(function(R){return R.includes(w)})||y.remove(w)})})},tn.prototype.subtract=function(){var u=t.call(arguments,0);if(u.length===0)return this;u=u.map(function(y){return a(y)});var g=this;return this.withMutations(function(y){g.forEach(function(w){u.some(function(R){return R.includes(w)})&&y.remove(w)})})},tn.prototype.merge=function(){return this.union.apply(this,arguments)},tn.prototype.mergeWith=function(u){var g=t.call(arguments,1);return this.union.apply(this,g)},tn.prototype.sort=function(u){return Ri(Ca(this,u))},tn.prototype.sortBy=function(u,g){return Ri(Ca(this,g,u))},tn.prototype.wasAltered=function(){return this._map.wasAltered()},tn.prototype.__iterate=function(u,g){var y=this;return this._map.__iterate(function(w,R){return u(R,R,y)},g)},tn.prototype.__iterator=function(u,g){return this._map.map(function(y,w){return w}).__iterator(u,g)},tn.prototype.__ensureOwner=function(u){if(u===this.__ownerID)return this;var g=this._map.__ensureOwner(u);return u?this.__make(g,u):(this.__ownerID=u,this._map=g,this)};function bm(u){return!!(u&&u[E2])}tn.isSet=bm;var E2="@@__IMMUTABLE_SET__@@",yr=tn.prototype;yr[E2]=!0,yr[_]=yr.remove,yr.mergeDeep=yr.merge,yr.mergeDeepWith=yr.mergeWith,yr.withMutations=P.withMutations,yr.asMutable=P.asMutable,yr.asImmutable=P.asImmutable,yr.__empty=wm,yr.__make=b2;function Mm(u,g){return u.__ownerID?(u.size=g.size,u._map=g,u):g===u._map?u:g.size===0?u.__empty():u.__make(g)}function b2(u,g){var y=Object.create(yr);return y.size=u?u.size:0,y._map=u,y.__ownerID=g,y}var M2;function wm(){return M2||(M2=b2(Qe()))}r(Ri,tn);function Ri(u){return u==null?Tm():w2(u)?u:Tm().withMutations(function(g){var y=a(u);jn(y.size),y.forEach(function(w){return g.add(w)})})}Ri.of=function(){return this(arguments)},Ri.fromKeys=function(u){return this(s(u).keySeq())},Ri.prototype.toString=function(){return this.__toString("OrderedSet {","}")};function w2(u){return bm(u)&&p(u)}Ri.isOrderedSet=w2;var rh=Ri.prototype;rh[v]=!0,rh.__empty=Tm,rh.__make=T2;function T2(u,g){var y=Object.create(rh);return y.size=u?u.size:0,y._map=u,y.__ownerID=g,y}var A2;function Tm(){return A2||(A2=T2(eh()))}r(mn,me);function mn(u){return u==null?Am():C2(u)?u:Am().unshiftAll(u)}mn.of=function(){return this(arguments)},mn.prototype.toString=function(){return this.__toString("Stack [","]")},mn.prototype.get=function(u,g){var y=this._head;for(u=K(this,u);y&&u--;)y=y.next;return y?y.value:g},mn.prototype.peek=function(){return this._head&&this._head.value},mn.prototype.push=function(){if(arguments.length===0)return this;for(var u=this.size+arguments.length,g=this._head,y=arguments.length-1;y>=0;y--)g={value:arguments[y],next:g};return this.__ownerID?(this.size=u,this._head=g,this.__hash=void 0,this.__altered=!0,this):Gl(u,g)},mn.prototype.pushAll=function(u){if(u=o(u),u.size===0)return this;jn(u.size);var g=this.size,y=this._head;return u.reverse().forEach(function(w){g++,y={value:w,next:y}}),this.__ownerID?(this.size=g,this._head=y,this.__hash=void 0,this.__altered=!0,this):Gl(g,y)},mn.prototype.pop=function(){return this.slice(1)},mn.prototype.unshift=function(){return this.push.apply(this,arguments)},mn.prototype.unshiftAll=function(u){return this.pushAll(u)},mn.prototype.shift=function(){return this.pop.apply(this,arguments)},mn.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Am()},mn.prototype.slice=function(u,g){if(ce(u,g,this.size))return this;var y=J(u,this.size),w=oe(g,this.size);if(w!==this.size)return me.prototype.slice.call(this,u,g);for(var R=this.size-y,D=this._head;y--;)D=D.next;return this.__ownerID?(this.size=R,this._head=D,this.__hash=void 0,this.__altered=!0,this):Gl(R,D)},mn.prototype.__ensureOwner=function(u){return u===this.__ownerID?this:u?Gl(this.size,this._head,u,this.__hash):(this.__ownerID=u,this.__altered=!1,this)},mn.prototype.__iterate=function(u,g){if(g)return this.reverse().__iterate(u);for(var y=0,w=this._head;w&&u(w.value,y++,this)!==!1;)w=w.next;return y},mn.prototype.__iterator=function(u,g){if(g)return this.reverse().__iterator(u);var y=0,w=this._head;return new V(function(){if(w){var R=w.value;return w=w.next,te(u,y++,R)}return W()})};function C2(u){return!!(u&&u[R2])}mn.isStack=C2;var R2="@@__IMMUTABLE_STACK__@@",Ra=mn.prototype;Ra[R2]=!0,Ra.withMutations=P.withMutations,Ra.asMutable=P.asMutable,Ra.asImmutable=P.asImmutable,Ra.wasAltered=P.wasAltered;function Gl(u,g,y,w){var R=Object.create(Ra);return R.size=u,R._head=g,R.__ownerID=y,R.__hash=w,R.__altered=!1,R}var P2;function Am(){return P2||(P2=Gl(0))}function Pi(u,g){var y=function(w){u.prototype[w]=g[w]};return Object.keys(g).forEach(y),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(g).forEach(y),u}i.Iterator=V,Pi(i,{toArray:function(){jn(this.size);var u=new Array(this.size||0);return this.valueSeq().__iterate(function(g,y){u[y]=g}),u},toIndexedSeq:function(){return new wa(this)},toJS:function(){return this.toSeq().map(function(u){return u&&typeof u.toJS=="function"?u.toJS():u}).__toJS()},toJSON:function(){return this.toSeq().map(function(u){return u&&typeof u.toJSON=="function"?u.toJSON():u}).__toJS()},toKeyedSeq:function(){return new qr(this,!0)},toMap:function(){return bt(this.toKeyedSeq())},toObject:function(){jn(this.size);var u={};return this.__iterate(function(g,y){u[y]=g}),u},toOrderedMap:function(){return un(this.toKeyedSeq())},toOrderedSet:function(){return Ri(c(this)?this.valueSeq():this)},toSet:function(){return tn(c(this)?this.valueSeq():this)},toSetSeq:function(){return new Ta(this)},toSeq:function(){return h(this)?this.toIndexedSeq():c(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return mn(c(this)?this.valueSeq():this)},toList:function(){return en(c(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(u,g){return this.size===0?u+g:u+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+g},concat:function(){var u=t.call(arguments,0);return Gt(this,WC(this,u))},includes:function(u){return this.some(function(g){return Ve(g,u)})},entries:function(){return this.__iterator($)},every:function(u,g){jn(this.size);var y=!0;return this.__iterate(function(w,R,D){if(!u.call(g,w,R,D))return y=!1,!1}),y},filter:function(u,g){return Gt(this,f2(this,u,g,!0))},find:function(u,g,y){var w=this.findEntry(u,g);return w?w[1]:y},forEach:function(u,g){return jn(this.size),this.__iterate(g?u.bind(g):u)},join:function(u){jn(this.size),u=u!==void 0?""+u:",";var g="",y=!0;return this.__iterate(function(w){y?y=!1:g+=u,g+=w!=null?w.toString():""}),g},keys:function(){return this.__iterator(xe)},map:function(u,g){return Gt(this,h2(this,u,g))},reduce:function(u,g,y){jn(this.size);var w,R;return arguments.length<2?R=!0:w=g,this.__iterate(function(D,k,j){R?(R=!1,w=D):w=u.call(y,w,D,k,j)}),w},reduceRight:function(u,g,y){var w=this.toKeyedSeq().reverse();return w.reduce.apply(w,arguments)},reverse:function(){return Gt(this,xm(this,!0))},slice:function(u,g){return Gt(this,ym(this,u,g,!0))},some:function(u,g){return!this.every(sh(u),g)},sort:function(u){return Gt(this,Ca(this,u))},values:function(){return this.__iterator(U)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==void 0?this.size===0:!this.some(function(){return!0})},count:function(u,g){return Z(u?this.toSeq().filter(u,g):this)},countBy:function(u,g){return VC(this,u,g)},equals:function(u){return Ke(this,u)},entrySeq:function(){var u=this;if(u._cache)return new De(u._cache);var g=u.toSeq().map(ZC).toIndexedSeq();return g.fromEntrySeq=function(){return u.toSeq()},g},filterNot:function(u,g){return this.filter(sh(u),g)},findEntry:function(u,g,y){var w=y;return this.__iterate(function(R,D,k){if(u.call(g,R,D,k))return w=[D,R],!1}),w},findKey:function(u,g){var y=this.findEntry(u,g);return y&&y[0]},findLast:function(u,g,y){return this.toKeyedSeq().reverse().find(u,g,y)},findLastEntry:function(u,g,y){return this.toKeyedSeq().reverse().findEntry(u,g,y)},findLastKey:function(u,g){return this.toKeyedSeq().reverse().findKey(u,g)},first:function(){return this.find(ne)},flatMap:function(u,g){return Gt(this,jC(this,u,g))},flatten:function(u){return Gt(this,p2(this,u,!0))},fromEntrySeq:function(){return new Aa(this)},get:function(u,g){return this.find(function(y,w){return Ve(w,u)},void 0,g)},getIn:function(u,g){for(var y=this,w=y2(u),R;!(R=w.next()).done;){var D=R.value;if(y=y&&y.get?y.get(D,S):S,y===S)return g}return y},groupBy:function(u,g){return HC(this,u,g)},has:function(u){return this.get(u,S)!==S},hasIn:function(u){return this.getIn(u,S)!==S},isSubset:function(u){return u=typeof u.includes=="function"?u:i(u),this.every(function(g){return u.includes(g)})},isSuperset:function(u){return u=typeof u.isSubset=="function"?u:i(u),u.isSubset(this)},keyOf:function(u){return this.findKey(function(g){return Ve(g,u)})},keySeq:function(){return this.toSeq().map(KC).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(u){return this.toKeyedSeq().reverse().keyOf(u)},max:function(u){return th(this,u)},maxBy:function(u,g){return th(this,g,u)},min:function(u){return th(this,u?I2(u):O2)},minBy:function(u,g){return th(this,g?I2(g):O2,u)},rest:function(){return this.slice(1)},skip:function(u){return this.slice(Math.max(0,u))},skipLast:function(u){return Gt(this,this.toSeq().reverse().skip(u).reverse())},skipWhile:function(u,g){return Gt(this,d2(this,u,g,!0))},skipUntil:function(u,g){return this.skipWhile(sh(u),g)},sortBy:function(u,g){return Gt(this,Ca(this,g,u))},take:function(u){return this.slice(0,Math.max(0,u))},takeLast:function(u){return Gt(this,this.toSeq().reverse().take(u).reverse())},takeWhile:function(u,g){return Gt(this,GC(this,u,g))},takeUntil:function(u,g){return this.takeWhile(sh(u),g)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=QC(this))}});var Yn=i.prototype;Yn[d]=!0,Yn[be]=Yn.values,Yn.__toJS=Yn.toArray,Yn.__toStringMapper=L2,Yn.inspect=Yn.toSource=function(){return this.toString()},Yn.chain=Yn.flatMap,Yn.contains=Yn.includes,Pi(s,{flip:function(){return Gt(this,u2(this))},mapEntries:function(u,g){var y=this,w=0;return Gt(this,this.toSeq().map(function(R,D){return u.call(g,[D,R],w++,y)}).fromEntrySeq())},mapKeys:function(u,g){var y=this;return Gt(this,this.toSeq().flip().map(function(w,R){return u.call(g,w,R,y)}).flip())}});var ih=s.prototype;ih[m]=!0,ih[be]=Yn.entries,ih.__toJS=Yn.toObject,ih.__toStringMapper=function(u,g){return JSON.stringify(g)+": "+L2(u)},Pi(o,{toKeyedSeq:function(){return new qr(this,!1)},filter:function(u,g){return Gt(this,f2(this,u,g,!1))},findIndex:function(u,g){var y=this.findEntry(u,g);return y?y[0]:-1},indexOf:function(u){var g=this.keyOf(u);return g===void 0?-1:g},lastIndexOf:function(u){var g=this.lastKeyOf(u);return g===void 0?-1:g},reverse:function(){return Gt(this,xm(this,!1))},slice:function(u,g){return Gt(this,ym(this,u,g,!1))},splice:function(u,g){var y=arguments.length;if(g=Math.max(g|0,0),y===0||y===2&&!g)return this;u=J(u,u<0?this.count():this.size);var w=this.slice(0,u);return Gt(this,y===1?w:w.concat(N(arguments,2),this.slice(u+g)))},findLastIndex:function(u,g){var y=this.findLastEntry(u,g);return y?y[0]:-1},first:function(){return this.get(0)},flatten:function(u){return Gt(this,p2(this,u,!1))},get:function(u,g){return u=K(this,u),u<0||this.size===1/0||this.size!==void 0&&u>this.size?g:this.find(function(y,w){return w===u},void 0,g)},has:function(u){return u=K(this,u),u>=0&&(this.size!==void 0?this.size===1/0||u<this.size:this.indexOf(u)!==-1)},interpose:function(u){return Gt(this,XC(this,u))},interleave:function(){var u=[this].concat(N(arguments)),g=Sm(this.toSeq(),Ie.of,u),y=g.flatten(!0);return g.size&&(y.size=g.size*u.length),Gt(this,y)},keySeq:function(){return Ee(0,this.size)},last:function(){return this.get(-1)},skipWhile:function(u,g){return Gt(this,d2(this,u,g,!1))},zip:function(){var u=[this].concat(N(arguments));return Gt(this,Sm(this,JC,u))},zipWith:function(u){var g=N(arguments);return g[0]=this,Gt(this,Sm(this,u,g))}}),o.prototype[x]=!0,o.prototype[v]=!0,Pi(a,{get:function(u,g){return this.has(u)?u:g},includes:function(u){return this.has(u)},keySeq:function(){return this.valueSeq()}}),a.prototype.has=Yn.includes,a.prototype.contains=a.prototype.includes,Pi(it,s.prototype),Pi(Ie,o.prototype),Pi($e,a.prototype),Pi(Te,s.prototype),Pi(me,o.prototype),Pi(Ze,a.prototype);function KC(u,g){return g}function ZC(u,g){return[g,u]}function sh(u){return function(){return!u.apply(this,arguments)}}function I2(u){return function(){return-u.apply(this,arguments)}}function L2(u){return typeof u=="string"?JSON.stringify(u):String(u)}function JC(){return N(arguments)}function O2(u,g){return u<g?1:u>g?-1:0}function QC(u){if(u.size===1/0)return 0;var g=p(u),y=c(u),w=g?1:0,R=u.__iterate(y?g?function(D,k){w=31*w+q2(ft(D),ft(k))|0}:function(D,k){w=w+q2(ft(D),ft(k))|0}:g?function(D){w=31*w+ft(D)|0}:function(D){w=w+ft(D)|0});return eR(R,w)}function eR(u,g){return g=ct(g,3432918353),g=ct(g<<15|g>>>-15,461845907),g=ct(g<<13|g>>>-13,5),g=(g+3864292196|0)^u,g=ct(g^g>>>16,2246822507),g=ct(g^g>>>13,3266489909),g=Lt(g^g>>>16),g}function q2(u,g){return u^g+2654435769+(u<<6)+(u>>2)|0}var tR={Iterable:i,Seq:z,Collection:Be,Map:bt,OrderedMap:un,List:en,Stack:mn,Set:tn,OrderedSet:Ri,Record:xr,Range:Ee,Repeat:Re,is:Ve,fromJS:We};return tR})})(yc)),yc.exports}var Sf,hg;function E3(){if(hg)return Sf;hg=1;var n=yf(),e=function(i){return n.Iterable.isKeyed(i)},t=function(i){return n.Iterable.isIndexed(i)},r=function(i,s,o){return i==="remove"?{op:i,path:s}:{op:i,path:s,value:o}};return Sf={isMap:e,isIndexed:t,op:r},Sf}var Ef,fg;function b3(){if(fg)return Ef;fg=1;var n=yf(),e=function(c,h,f){for(var p=[],d=0;d<c;d++){p[d]=new Array(h);for(var m=0;m<h;m++)p[d][m]=f}return p},t=function(c,h){var f=a(c,h);return l(c,h,f)},r=n.Record({op:"=",val:null}),i=n.Record({op:"!=",val:null,newVal:null}),s=function(c,h){var f=a(c,h);return o(f,c,h,c.size||0,h.size||0)},o=function(c,h,f,p,d){for(var m=[],x=p-1,v=d-1;x>=0||v>=0;)x>=0&&v>=0&&n.is(h.get(x),f.get(v))?(m.push(new r({op:"=",val:h.get(x)})),x-=1,v-=1):x>=0&&v>=0&&x===v&&!n.is(h.get(x),f.get(v))?(m.push(new i({val:h.get(x),newVal:f.get(x)})),x-=1,v-=1):v>=0&&(x===-1||c[x+1][v]>=c[x][v+1])?(m.push(new r({op:"+",val:f.get(v)})),v-=1):x>=0&&(v===-1||c[x+1][v]<c[x][v+1])&&(m.push(new r({op:"-",val:h.get(x)})),x-=1);return m.reverse()};function a(c,h){for(var f=c.size||0,p=h.size||0,d=e(f+1,p+1,0),m=0;m<f;m++)for(var x=0;x<p;x++)n.is(c.get(m),h.get(x))?d[m+1][x+1]=d[m][x]+1:d[m+1][x+1]=Math.max(d[m+1][x],d[m][x+1]);return d}var l=function(c,h,f){for(var p=[],d=c.size,m=h.size;d!==0&&m!==0;)f[d][m]===f[d-1][m]?d--:f[d][m]===f[d][m-1]?m--:n.is(c.get(d-1),h.get(m-1))&&(p.push(c.get(d-1)),d--,m--);return p.reverse()};return Ef={lcs:t,computeLcsMatrix:a,diff:s},Ef}var bf,dg;function M3(){if(dg)return bf;dg=1;var n=new RegExp("/","g"),e=new RegExp("~1","g"),t=/~/g,r=/~0/g,i={escape:function(s){if(typeof s=="number")return s.toString();if(typeof s!="string")throw"param str ("+s+") is not a string";return s.replace(t,"~0").replace(n,"~1")},unescape:function(s){return typeof s=="string"?s.replace(e,"/").replace(r,"~"):s},concat:function(s,o){return s+"/"+o}};return bf=i,bf}var Mf,pg;function w3(){if(pg)return Mf;pg=1;var n=yf(),e=E3(),t=b3(),r=M3(),i=r.concat,s=r.escape,o=e.op,a=e.isMap,l=e.isIndexed,c=function(d,m,x){var v=[],_=x||"";if(n.is(d,m)||d==m==null)return v;var b=l(d)&&l(m),M=null,E=null;return d.forEach&&d.forEach(function(S,T){if(m.has(T))if(a(S)&&a(m.get(T)))v=v.concat(c(S,m.get(T),i(_,s(T))));else if(l(m.get(T))&&l(S))v=v.concat(h(S,m.get(T),i(_,s(T))));else{var q=m.get?m.get(T):m,O=S!==q;O&&v.push(o("replace",i(_,s(T)),q))}else b?(E=M!=null&&M+1===T?E:T,v.push(o("remove",i(_,s(E)))),M=T):v.push(o("remove",i(_,s(T))))}),m.forEach(function(S,T){d.has&&!d.has(T)&&v.push(o("add",i(_,s(T)),S))}),v},h=function(d,m,x){var v=[],_=x||"";if(n.is(d,m)||d==m==null)return v;if((d.count()+1)*(m.count()+1)>=1e4)return c(d,m,x);var b=t.diff(d,m),M=0;return b.forEach(function(E){if(E.op==="=")M++;else if(E.op==="!="){if(a(E.val)&&a(E.newVal)){var S=c(E.val,E.newVal,i(_,M));v=v.concat(S)}else v.push(o("replace",i(_,M),E.newVal));M++}else E.op==="+"?(v.push(o("add",i(_,M),E.val)),M++):E.op==="-"&&v.push(o("remove",i(_,M)))}),v},f=function(d,m,x){var v=x||"";return d===m?[]:[o("replace",i(v,""),m)]},p=function(d,m,x){return n.is(d,m)?n.List():d!=m&&(d==null||m==null)?n.fromJS([o("replace","/",m)]):l(d)&&l(m)?n.fromJS(h(d,m)):a(d)&&a(m)?n.fromJS(c(d,m)):n.fromJS(f(d,m,x))};return Mf=p,Mf}var T3=w3();const A3=ai(T3),C3=Cm(zy);var wf,mg;function R3(){if(mg)return wf;mg=1;var n=new RegExp("/","g"),e=new RegExp("~1","g"),t=/~/g,r=/~0/g,i={escape:function(s){if(typeof s!="string")throw"param str ("+s+") is not a string";return s.replace(t,"~0").replace(n,"~1")},unescape:function(s){return typeof s=="string"?s.replace(e,"/").replace(r,"~"):s}};return wf=i,wf}var Tf,gg;function P3(){if(gg)return Tf;gg=1;var n=C3,e=R3(),t=function(h){var f=parseInt(h);return isNaN(f)?h:f},r=function(h,f){if(h==="add"||h==="replace")return f;if(h==="remove")return null},i=function(h,f,p,d,m){if(d==="add")if(p.length>0&&h.get(f)===void 0){var x=p[0].match(/^\d+$/)?n.List():n.Map();return h.set(f,a(x,p,d,m))}else return h.set(f,a(h.get(f),p,d,m));else{if(d==="replace")return p.length>0?h.set(f,a(h.get(f),p,d,m)):h.set(f,m);if(d==="remove")return p.length>0?h.set(f,a(h.get(f),p,d,m)):h.remove(f);throw new Error("map patch Error, unknown op: "+d)}},s=function(h,f,p,d,m){if(f=t(f),d==="add")if(h.get(f)===void 0)if(p.length>0){var x=p[0].match(/^\d+$/)?n.List():n.Map();return h.set(f,a(x,p,d,m))}else return f==="-"?h.splice(h.size,0,m):h.splice(f,0,m);else return p.length>0?h.set(f,a(h.get(f),p,d,m)):h.splice(f,0,m);else{if(d==="replace")return p.length>0?h.set(f,a(h.get(f),p,d,m)):h.set(f,m);if(d==="remove")return p.length>0?h.set(f,a(h.get(f),p,d,m)):h.remove(f);throw new Error("sequence patch Error, unknown op: "+d)}},o=function(h){return h!=null&&typeof h.updateIn=="function"&&typeof h.set=="function"},a=function(h,f,p,d){var m,x;return n.Iterable.isIndexed(h)?f.length===0?h:(m=f[0],x=f.slice(1),s(h,m,x,p,d)):n.Iterable.isKeyed(h)||o(h)?f.length===0?h:(m=f[0],x=f.slice(1),i(h,m,x,p,d)):f.length===0?d:r(p,d)},l=function(h,f){for(;f.size;){var p=f.get(0),f=f.slice(1),d=p.get("path").split("/").slice(1).map(e.unescape);h=a(h,d,p.get("op"),p.get("value"))}return h},c=function(h,f){if(f.size===1){var p=f.get(0);if(p.get("op")==="replace"&&p.get("path")==="/")return p.get("value")}return l(h,f)};return c.default=c,Tf=c,Tf}var I3=P3();const _g=ai(I3),an=(n,e)=>{if(n.last){if(n.last.hashCode()!==e.hashCode()){let t=Pe({time:Date.now(),diff:A3(n.last,e)});n=n.set("last",e).set("list",n.list.push(t)).set("redoList",n.redoList.clear())}}else n=n.set("last",e);return n},L3=n=>{if(n.last&&n.redoList.size){const e=n.redoList.last(),t=_g(n.last,e.get("diff"));n=n.set("last",t).set("list",n.list.push(e)).set("redoList",n.redoList.pop())}return n},vg=n=>{var e;if(n.last&&n.list.size){const t=n.list.last();let r=n.first;for(let i=0;i<n.list.size-1;i++)r=_g(r,(e=n.list.get(i))==null?void 0:e.get("diff"));n=n.set("last",r).set("list",n.list.pop()).set("redoList",n.redoList.push(t))}return n};var Af={exports:{}},Cf,xg;function O3(){if(xg)return Cf;xg=1;var n=1;function e(){return n=(n*9301+49297)%233280,n/233280}function t(r){n=r}return Cf={nextValue:e,seed:t},Cf}var Rf,yg;function Sc(){if(yg)return Rf;yg=1;var n=O3(),e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-",t,r,i;function s(){i=!1}function o(d){if(!d){t!==e&&(t=e,s());return}if(d!==t){if(d.length!==e.length)throw new Error("Custom alphabet for shortid must be "+e.length+" unique characters. You submitted "+d.length+" characters: "+d);var m=d.split("").filter(function(x,v,_){return v!==_.lastIndexOf(x)});if(m.length)throw new Error("Custom alphabet for shortid must be "+e.length+" unique characters. These characters were not unique: "+m.join(", "));t=d,s()}}function a(d){return o(d),t}function l(d){n.seed(d),r!==d&&(s(),r=d)}function c(){t||o(e);for(var d=t.split(""),m=[],x=n.nextValue(),v;d.length>0;)x=n.nextValue(),v=Math.floor(x*d.length),m.push(d.splice(v,1)[0]);return m.join("")}function h(){return i||(i=c(),i)}function f(d){var m=h();return m[d]}function p(){return t||e}return Rf={get:p,characters:a,seed:l,lookup:f,shuffled:h},Rf}var Pf,Sg;function q3(){if(Sg)return Pf;Sg=1;var n=typeof window=="object"&&(window.crypto||window.msCrypto),e;return!n||!n.getRandomValues?e=function(t){for(var r=[],i=0;i<t;i++)r.push(Math.floor(Math.random()*256));return r}:e=function(t){return n.getRandomValues(new Uint8Array(t))},Pf=e,Pf}let D3="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Eg=n=>crypto.getRandomValues(new Uint8Array(n)),bg=(n,e,t)=>{let r=(2<<Math.log(n.length-1)/Math.LN2)-1,i=-~(1.6*r*e/n.length);return(s=e)=>{let o="";for(;;){let a=t(i),l=i|0;for(;l--;)if(o+=n[a[l]&r]||"",o.length===s)return o}}};const N3=Cm(Object.freeze(Object.defineProperty({__proto__:null,customAlphabet:(n,e=21)=>bg(n,e,Eg),customRandom:bg,nanoid:(n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),""),random:Eg,urlAlphabet:D3},Symbol.toStringTag,{value:"Module"})));var If,Mg;function U3(){if(Mg)return If;Mg=1;var n=Sc(),e=q3(),t=N3.customRandom;function r(i){for(var s=0,o,a="";!o;)a=a+t(n.get(),1,e)(),o=i<Math.pow(16,s+1),s++;return a}return If=r,If}var Lf,wg;function F3(){if(wg)return Lf;wg=1;var n=U3();Sc();var e=1567752802062,t=7,r,i;function s(o){var a="",l=Math.floor((Date.now()-e)*.001);return l===i?r++:(r=0,i=l),a=a+n(t),a=a+n(o),r>0&&(a=a+n(r)),a=a+n(l),a}return Lf=s,Lf}var Of,Tg;function z3(){if(Tg)return Of;Tg=1;var n=Sc();function e(t){if(!t||typeof t!="string"||t.length<6)return!1;var r=new RegExp("[^"+n.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]");return!r.test(t)}return Of=e,Of}var qf,Ag;function k3(){return Ag||(Ag=1,qf=0),qf}var Cg;function B3(){return Cg||(Cg=1,(function(n){var e=Sc(),t=F3(),r=z3(),i=k3()||0;function s(c){return e.seed(c),n.exports}function o(c){return i=c,n.exports}function a(c){return c!==void 0&&e.characters(c),e.shuffled()}function l(){return t(i)}n.exports=l,n.exports.generate=l,n.exports.seed=s,n.exports.worker=o,n.exports.characters=a,n.exports.isValid=r})(Af)),Af.exports}var Df,Rg;function V3(){return Rg||(Rg=1,Df=B3()),Df}var H3=V3();const G3=ai(H3);class mi{static acquireID(){return G3.generate()}}class Ec{static generateName(e,t){return t.charAt(0).toUpperCase()+t.slice(1)}}class fn{static create(e,t,r,i,s,o){let a=mi.acquireID(),l=e.catalog.factoryElement(r,{id:a,name:Ec.generateName("holes",e.catalog.getIn(["elements",r,"info","title"])),type:r,offset:s,line:i},o);return e=e.setIn(["scene","layers",t,"holes",a],l),e=e.updateIn(["scene","layers",t,"lines",i,"holes"],c=>c.push(a)),{updatedState:e,hole:l}}static select(e,t,r){return e=at.select(e,t).updatedState,e=at.selectElement(e,t,"holes",r).updatedState,{updatedState:e}}static remove(e,t,r){let i=e.getIn(["scene","layers",t,"holes",r]);return e=this.unselect(e,t,r).updatedState,e=at.removeElement(e,t,"holes",r).updatedState,e=e.updateIn(["scene","layers",t,"lines",i.line,"holes"],s=>{let o=s.findIndex(a=>r===a);return o!==-1?s.remove(o):s}),e.getIn(["scene","groups"]).forEach(s=>e=dn.removeElement(e,s.id,t,"holes",r).updatedState),{updatedState:e}}static unselect(e,t,r){return e=at.unselect(e,t,"holes",r).updatedState,{updatedState:e}}static selectToolDrawingHole(e,t){let r=Xe().withMutations(i=>{let{lines:s,vertices:o}=e.getIn(["scene","layers",e.scene.selectedLayer]);s.forEach(a=>{let{x:l,y:c}=o.get(a.vertices.get(0)),{x:h,y:f}=o.get(a.vertices.get(1));tl(i,l,c,h,f,20,1,a.id)})});return e=e.merge({mode:ur,snapElements:r,drawingSupport:Pe({type:t})}),{updatedState:e}}static updateDrawingHole(e,t,r,i){let s=e.catalog,o=pi(e.snapElements,r,i,e.snapMask.merge({SNAP_SEGMENT:!0}));o&&({x:r,y:i}=o.point);let a=e.getIn(["scene","layers",t,"selected","holes"]).first();if(o){let l=o.snap.related.get(0),c=e.getIn(["scene","layers",t,"lines",l,"vertices"]),{x:h,y:f}=e.getIn(["scene","layers",t,"vertices",c.get(0)]),{x:p,y:d}=e.getIn(["scene","layers",t,"vertices",c.get(1)]),m=hc({x:h,y:f},{x:p,y:d}),x=lf({x:h,y:f},{x:p,y:d}),v=s.factoryElement(e.drawingSupport.get("type")).properties.getIn(["width","length"]),_=Ln(h,f,p,d),b=$y(h,f,p,d),M=Ky(b,1e-7),E=Zy(b,1e-7),S={x:m.x+v/2*M,y:m.y+v/2*E},T={x:m.x+_*M-v/2*M,y:m.y+_*E-v/2*E},q;if(r<S.x?q=On(m.x,m.y,x.x,x.y,S.x,S.y):r>T.x?q=On(m.x,m.y,x.x,x.y,T.x,T.y):r===S.x&&r===T.x?i<S.y?(q=On(m.x,m.y,x.x,x.y,S.x,S.y),q=m.x===h&&m.y===f?q:1-q):i>T.y?(q=On(m.x,m.y,x.x,x.y,T.x,T.y),q=m.x===h&&m.y===f?q:1-q):q=On(h,f,p,d,r,i):q=On(h,f,p,d,r,i),a&&o){e=e.mergeIn(["scene","layers",t,"holes",a],{offset:q,line:l});let O=e.getIn(["scene","layers",t,"lines"]).findEntry(L=>L.id!==l&&L.get("holes").contains(a));if(O){let L=O[1].get("holes").filter(N=>N!==a);e=e.setIn(["scene","layers",t,"lines",O[0],"holes"],L)}let A=e.getIn(["scene","layers",t,"lines",l,"holes"]);A.contains(a)||(e=e.setIn(["scene","layers",t,"lines",l,"holes"],A.push(a)))}else if(!a&&o){let{updatedState:O,hole:A}=this.create(e,t,e.drawingSupport.get("type"),l,q);e=fn.select(O,t,A.id).updatedState}}return{updatedState:e}}static endDrawingHole(e,t,r,i){return e=this.updateDrawingHole(e,t,r,i).updatedState,e=at.unselectAll(e,t).updatedState,{updatedState:e}}static beginDraggingHole(e,t,r,i,s){let o=e.getIn(["scene","layers",t]),a=o.getIn(["holes",r]),l=o.getIn(["lines",a.line]),c=o.getIn(["vertices",l.vertices.get(0)]),h=o.getIn(["vertices",l.vertices.get(1)]),f=tl(Xe(),c.x,c.y,h.x,h.y,9999999,1,null);return e=e.merge({mode:Br,snapElements:f,draggingSupport:Pe({layerID:t,holeID:r,startPointX:i,startPointY:s})}),{updatedState:e}}static updateDraggingHole(e,t,r){let i=pi(e.snapElements,t,r,e.snapMask.merge({SNAP_SEGMENT:!0}));if(!i)return e;let{draggingSupport:s,scene:o}=e,a=s.get("layerID"),l=s.get("holeID"),c=e.getIn(["scene","layers",a]),h=c.getIn(["holes",l]),f=c.getIn(["lines",h.line]),p=c.getIn(["vertices",f.vertices.get(0)]),d=c.getIn(["vertices",f.vertices.get(1)]);({x:t,y:r}=i.point);let m=hc(p,d),x=lf(p,d),v=h.properties.get("width").get("length"),_=Ln(p.x,p.y,d.x,d.y),b=Math.atan2(Math.abs(d.y-p.y),Math.abs(d.x-p.x)),M=L=>{let N=Math.cos(L);return N<1e-7?0:N},E=L=>{let N=Math.sin(L);return N<1e-7?0:N},S=M(b),T=E(b),q={x:m.x+v/2*S,y:m.y+v/2*T},O={x:m.x+_*S-v/2*S,y:m.y+_*T-v/2*T},A;return t<q.x?A=On(m.x,m.y,x.x,x.y,q.x,q.y):t>O.x?A=On(m.x,m.y,x.x,x.y,O.x,O.y):t===q.x&&t===O.x?r<q.y?(A=On(m.x,m.y,x.x,x.y,q.x,q.y),A=m===p?A:1-A):r>O.y?(A=On(m.x,m.y,x.x,x.y,O.x,O.y),A=m===p?A:1-A):(A=On(m.x,m.y,x.x,x.y,t,r),A=m===p?A:1-A):A=On(m.x,m.y,x.x,x.y,t,r),h=h.set("offset",A),e=e.merge({scene:o.mergeIn(["layers",a,"holes",l],h)}),{updatedState:e}}static endDraggingHole(e,t,r){return e=this.updateDraggingHole(e,t,r).updatedState,e=e.merge({mode:rn}),{updatedState:e}}static setProperties(e,t,r,i){return e=e.setIn(["scene","layers",t,"holes",r,"properties"],i),{updatedState:e}}static setJsProperties(e,t,r,i){return this.setProperties(e,t,r,At(i))}static updateProperties(e,t,r,i){return i.forEach((s,o)=>{e.hasIn(["scene","layers",t,"holes",r,"properties",o])&&(e=e.mergeIn(["scene","layers",t,"holes",r,"properties",o],s))}),{updatedState:e}}static updateJsProperties(e,t,r,i){return this.updateProperties(e,t,r,At(i))}static setAttributes(e,t,r,i){let s=i.toJS(),{offsetA:o,offsetB:a,offset:l}=s;delete s.offsetA,delete s.offsetB,delete s.offset;let c=Pe({_unitA:o._unit,_unitB:a._unit});return e=e.mergeIn(["scene","layers",t,"holes",r],At(s)).mergeDeepIn(["scene","layers",t,"holes",r],Pe({offset:l,misc:c})),{updatedState:e}}}let _n=class D2{static create(e,t,r,i,s,o,a,l){let c=mi.acquireID(),h=e.catalog.factoryElement(r,{id:c,name:Ec.generateName("items",e.catalog.getIn(["elements",r,"info","title"])),type:r,height:a,width:o,x:i,y:s,rotation:l});return e=e.setIn(["scene","layers",t,"items",c],h),{updatedState:e,item:h}}static select(e,t,r){return e=at.select(e,t).updatedState,e=at.selectElement(e,t,"items",r).updatedState,{updatedState:e}}static remove(e,t,r){return e=this.unselect(e,t,r).updatedState,e=at.removeElement(e,t,"items",r).updatedState,e.getIn(["scene","groups"]).forEach(i=>e=dn.removeElement(e,i.id,t,"items",r).updatedState),{updatedState:e}}static unselect(e,t,r){return e=at.unselect(e,t,"items",r).updatedState,{updatedState:e}}static selectToolDrawingItem(e,t){return e=e.merge({mode:wr,drawingSupport:Pe({type:t})}),{updatedState:e}}static updateDrawingItem(e,t,r,i){if(e.hasIn(["drawingSupport","currentID"]))e=e.updateIn(["scene","layers",t,"items",e.getIn(["drawingSupport","currentID"])],s=>s.merge({x:r,y:i}));else{let{updatedState:s,item:o}=this.create(e,t,e.getIn(["drawingSupport","type"]),r,i,200,100,0);e=D2.select(s,t,o.id).updatedState,e=e.setIn(["drawingSupport","currentID"],o.id)}return{updatedState:e}}static endDrawingItem(e,t,r,i){return e=this.updateDrawingItem(e,t,r,i).updatedState,e=at.unselectAll(e,t).updatedState,e=e.merge({drawingSupport:Pe({type:e.drawingSupport.get("type")})}),{updatedState:e}}static beginDraggingItem(e,t,r,i,s){let o=e.getIn(["scene","layers",t,"items",r]);return e=e.merge({mode:kr,draggingSupport:Pe({layerID:t,itemID:r,startPointX:i,startPointY:s,originalX:o.x,originalY:o.y})}),{updatedState:e}}static updateDraggingItem(e,t,r){let{draggingSupport:i,scene:s}=e,o=i.get("layerID"),a=i.get("itemID"),l=i.get("startPointX"),c=i.get("startPointY"),h=i.get("originalX"),f=i.get("originalY"),p=l-t,d=c-r,m=s.getIn(["layers",o,"items",a]);return m=m.merge({x:h-p,y:f-d}),e=e.merge({scene:s.mergeIn(["layers",o,"items",a],m)}),{updatedState:e}}static endDraggingItem(e,t,r){return e=this.updateDraggingItem(e,t,r).updatedState,e=e.merge({mode:rn}),{updatedState:e}}static beginRotatingItem(e,t,r,i,s){return e=e.merge({mode:qi,rotatingSupport:Pe({layerID:t,itemID:r})}),{updatedState:e}}static updateRotatingItem(e,t,r){let{rotatingSupport:i,scene:s}=e,o=i.get("layerID"),a=i.get("itemID"),l=e.getIn(["scene","layers",o,"items",a]),c=t-l.x,h=r-l.y,f=Math.atan2(h,c)*180/Math.PI-90;return-5<f&&f<5&&(f=0),-95<f&&f<-85&&(f=-90),-185<f&&f<-175&&(f=-180),85<f&&f<90&&(f=90),-270<f&&f<-265&&(f=90),l=l.merge({rotation:f}),e=e.merge({scene:s.mergeIn(["layers",o,"items",a],l)}),{updatedState:e}}static endRotatingItem(e,t,r){return e=this.updateRotatingItem(e,t,r).updatedState,e=e.merge({mode:rn}),{updatedState:e}}static setProperties(e,t,r,i){return e=e.mergeIn(["scene","layers",t,"items",r,"properties"],i),{updatedState:e}}static setJsProperties(e,t,r,i){return this.setProperties(e,t,r,At(i))}static updateProperties(e,t,r,i){return i.forEach((s,o)=>{e.hasIn(["scene","layers",t,"items",r,"properties",o])&&(e=e.mergeIn(["scene","layers",t,"items",r,"properties",o],s))}),{updatedState:e}}static updateJsProperties(e,t,r,i){return this.updateProperties(e,t,r,At(i))}static setAttributes(e,t,r,i){return e=e.mergeIn(["scene","layers",t,"items",r],i),{updatedState:e}}static setJsAttributes(e,t,r,i){return i=At(i),this.setAttributes(e,t,r,i)}},dn=class ah{static select(e,t){let r=e.getIn(["scene","groups",t,"elements"]);e=Vt.setAlterate(e).updatedState,r.entrySeq().forEach(([s,o])=>{e=at.unselectAll(e,s).updatedState;let a=o.get("lines"),l=o.get("holes"),c=o.get("items"),h=o.get("areas");a&&a.forEach(f=>{e=Mn.select(e,s,f).updatedState}),l&&l.forEach(f=>{e=fn.select(e,s,f).updatedState}),c&&c.forEach(f=>{e=_n.select(e,s,f).updatedState}),h&&h.forEach(f=>{e=Us.select(e,s,f).updatedState})}),e=Vt.setAlterate(e).updatedState;let i=e.getIn(["scene","groups"]).map(s=>s.set("selected",!1));return e=e.setIn(["scene","groups"],i).setIn(["scene","groups",t,"selected"],!0),{updatedState:e}}static unselect(e,t){return e=e.getIn(["scene","groups",t,"elements"]).reduce((s,o,a)=>at.unselectAll(s,a).updatedState,e).setIn(["scene","groups",t,"selected"],!1),{updatedState:e}}static create(e){let t=mi.acquireID();return e=e.setIn(["scene","groups",t],new _f({id:t,name:t})),{updatedState:e}}static createFromSelectedElements(e){let t=mi.acquireID();return e=e.setIn(["scene","groups",t],new _f({id:t,name:t})),e.getIn(["scene","layers"]).forEach(r=>{let i=r.get("id"),s={lines:r.get("lines").filter(o=>o.get("selected")),items:r.get("items").filter(o=>o.get("selected")),holes:r.get("holes").filter(o=>o.get("selected")),areas:r.get("areas").filter(o=>o.get("selected"))};for(let o in s)s[o].forEach(a=>e=this.addElement(e,t,i,o,a.get("id")).updatedState)}),{updatedState:e}}static addElement(e,t,r,i,s){let o=e.getIn(["scene","groups",t,"elements",r,i])||Xe();return o.contains(s)||(e=e.setIn(["scene","groups",t,"elements",r,i],o.push(s)),e=this.reloadBaricenter(e,t).updatedState),{updatedState:e}}static setBarycenter(e,t,r,i){return typeof r<"u"&&(e=e.setIn(["scene","groups",t,"x"],r)),typeof i<"u"&&(e=e.setIn(["scene","groups",t,"y"],i)),{updatedState:e}}static reloadBaricenter(e,t){let r=e.getIn(["scene","groups",t,"elements"]),i=0,s=0,o=0;return r.entrySeq().forEach(([a,l])=>{e=at.unselectAll(e,a).updatedState;let c=l.get("lines"),h=l.get("holes"),f=l.get("items"),p=l.get("areas");c&&c.forEach(d=>{let m=e.getIn(["scene","layers",a,"lines",d,"vertices"]).map(S=>e.getIn(["scene","layers",a,"vertices",S])),{x,y:v}=m.get(0),{x:_,y:b}=m.get(1),{x:M,y:E}=Jy(x,v,_,b);i+=M,s+=E,o++}),h&&h.forEach(d=>{let m=e.getIn(["scene","layers",a,"holes",d]),x=e.getIn(["scene","layers",a,"lines",m.line,"vertices"]).map(T=>e.getIn(["scene","layers",a,"vertices",T])),{x:v,y:_}=x.get(0),{x:b,y:M}=x.get(1),{x:E,y:S}=mc(v,_,b,M,m.offset*Ln(v,_,b,M));i+=E,s+=S,o++}),f&&f.forEach(d=>{let{x:m,y:x}=e.getIn(["scene","layers",a,"items",d]);i+=m,s+=x,o++}),p&&p.forEach(d=>{let m=e.getIn(["scene","layers",a,"areas",d,"vertices"]).map(_=>e.getIn(["scene","layers",a,"vertices",_])).toJS(),{x,y:v}=Qy(m);i+=x,s+=v,o++})}),o&&(e=this.setBarycenter(e,t,i/o,s/o).updatedState),{updatedState:e}}static removeElement(e,t,r,i,s){let o=e.getIn(["scene","groups",t,"elements",r,i]);return!o||!o.contains(s)?{updatedState:e}:(e=e.setIn(["scene","groups",t,"elements",r,i],o.filterNot(a=>a===s)),{updatedState:e})}static setAttributes(e,t,r){return e=e.mergeIn(["scene","groups",t],r),{updatedState:e}}static setProperties(e,t,r){return e=e.mergeIn(["scene","groups",t,"properties"],r),{updatedState:e}}static remove(e,t){return e=e.removeIn(["scene","groups",t]),{updatedState:e}}static removeAndDeleteElements(e,t){return e.getIn(["scene","groups",t,"elements"]).entrySeq().forEach(([i,s])=>{e=at.unselectAll(e,i).updatedState;let o=s.get("lines"),a=s.get("holes"),l=s.get("items");s.get("areas"),o&&o.forEach(c=>{e=Mn.remove(e,i,c).updatedState,e=at.detectAndUpdateAreas(e,i).updatedState}),a&&a.forEach(c=>{e=fn.remove(e,i,c).updatedState}),l&&l.forEach(c=>{e=_n.remove(e,i,c).updatedState})}),e=e.deleteIn(["scene","groups",t]),{updatedState:e}}static translate(e,t,r,i){let s=r-e.getIn(["scene","groups",t,"x"]),o=i-e.getIn(["scene","groups",t,"y"]);return e.getIn(["scene","groups",t,"elements"]).entrySeq().forEach(([l,c])=>{let h=c.get("lines"),f=c.get("items");if(h){let p={};h.forEach(d=>{let m=e.getIn(["scene","layers",l,"lines",d]);p[m.vertices.get(0)]||(p[m.vertices.get(0)]=e.getIn(["scene","layers",l,"vertices",m.vertices.get(0)])),p[m.vertices.get(1)]||(p[m.vertices.get(1)]=e.getIn(["scene","layers",l,"vertices",m.vertices.get(1)]))});for(let d in p){let{x:m,y:x}=p[d];e=ln.setAttributes(e,l,d,Pe({x:m+s,y:x+o})).updatedState}for(let d in p)e=ln.beginDraggingVertex(e,l,d).updatedState,e=ln.endDraggingVertex(e).updatedState}f&&(e=f.map(p=>e.getIn(["scene","layers",l,"items",p])).reduce((p,d)=>{let{x:m,y:x}=d;return _n.setAttributes(p,l,d.id,Pe({x:m+s,y:x+o})).updatedState},e)),e=at.detectAndUpdateAreas(e,l).updatedState}),e=this.setBarycenter(e,t,r,i).updatedState,e=ah.select(e,t).updatedState,{updatedState:e}}static rotate(e,t,r){let{x:i,y:s,rotation:o}=e.getIn(["scene","groups",t]),a=r-o;return e=ah.setAttributes(e,t,Pe({rotation:r})).updatedState,e.getIn(["scene","groups",t,"elements"]).entrySeq().forEach(([c,h])=>{let f=h.get("lines"),p=h.get("items");if(f){let d={};f.forEach(m=>{let x=e.getIn(["scene","layers",c,"lines",m]);d[x.vertices.get(0)]||(d[x.vertices.get(0)]=e.getIn(["scene","layers",c,"vertices",x.vertices.get(0)])),d[x.vertices.get(1)]||(d[x.vertices.get(1)]=e.getIn(["scene","layers",c,"vertices",x.vertices.get(1)]))});for(let m in d){let{x,y:v}=d[m],{x:_,y:b}=K0(x,v,i,s,a);e=ln.setAttributes(e,c,m,Pe({x:_,y:b})).updatedState}for(let m in d)e=ln.beginDraggingVertex(e,c,m).updatedState,e=ln.endDraggingVertex(e).updatedState}p&&(e=p.map(d=>e.getIn(["scene","layers",c,"items",d])).reduce((d,m)=>{let{x,y:v,rotation:_}=m,{x:b,y:M}=K0(x,v,i,s,a);return _n.setAttributes(d,c,m.id,Pe({x:b,y:M,rotation:_+a})).updatedState},e)),e=at.detectAndUpdateAreas(e,c).updatedState}),e=ah.select(e,t).updatedState,{updatedState:e}}},Mn=class Dr{static create(e,t,r,i,s,o,a,l){let c=mi.acquireID(),{updatedState:h,vertex:f}=ln.add(e,t,i,s,"lines",c),{updatedState:p,vertex:d}=ln.add(h,t,o,a,"lines",c);e=p;let m=e.catalog.factoryElement(r,{id:c,name:Ec.generateName("lines",e.catalog.getIn(["elements",r,"info","title"])),vertices:Xe([f.id,d.id]),type:r},l);return e=e.setIn(["scene","layers",t,"lines",c],m),{updatedState:e,line:m}}static select(e,t,r){e=at.select(e,t).updatedState;let i=e.getIn(["scene","layers",t,"lines",r]);return e=at.selectElement(e,t,"lines",r).updatedState,e=at.selectElement(e,t,"vertices",i.vertices.get(0)).updatedState,e=at.selectElement(e,t,"vertices",i.vertices.get(1)).updatedState,{updatedState:e}}static remove(e,t,r){let i=e.getIn(["scene","layers",t,"lines",r]);return i&&(e=this.unselect(e,t,r).updatedState,i.holes.forEach(s=>e=fn.remove(e,t,s).updatedState),e=at.removeElement(e,t,"lines",r).updatedState,i.vertices.forEach(s=>e=ln.remove(e,t,s,"lines",r).updatedState),e.getIn(["scene","groups"]).forEach(s=>e=dn.removeElement(e,s.id,t,"lines",r).updatedState)),{updatedState:e}}static unselect(e,t,r){let i=e.getIn(["scene","layers",t,"lines",r]);return i&&(e=at.unselect(e,t,"vertices",i.vertices.get(0)).updatedState,e=at.unselect(e,t,"vertices",i.vertices.get(1)).updatedState,e=at.unselect(e,t,"lines",r).updatedState),{updatedState:e}}static split(e,t,r,i,s){let o=e.getIn(["scene","layers",t,"lines",r]),a=e.getIn(["scene","layers",t,"vertices",o.vertices.get(0)]),l=e.getIn(["scene","layers",t,"vertices",o.vertices.get(1)]),{x:c,y:h}=a,{x:f,y:p}=l,{updatedState:d,line:m}=Dr.create(e,t,o.type,c,h,i,s,o.get("properties")),{updatedState:x,line:v}=Dr.create(d,t,o.type,f,p,i,s,o.get("properties"));e=x;let _=On(c,h,f,p,i,s),b=hc(a,l);return o.holes.forEach(E=>{let S=e.getIn(["scene","layers",t,"holes",E]),T=S.offset;if(b.x===f&&b.y===p&&(_=1-_,T=1-S.offset),T<_){let q=T/_;b.x===f&&b.y===p&&(q=1-q),e=fn.create(e,t,S.type,m.id,q,S.properties).updatedState}else{let q=(T-_)/(1-_);b.x===f&&b.y===p&&(q=1-q),e=fn.create(e,t,S.type,v.id,q,S.properties).updatedState}}),e.getIn(["scene","groups"]).filter(E=>{const S=E.getIn(["elements",t,"lines"]);return S&&S.contains(r)}).forEach(E=>{e=dn.addElement(e,E.id,t,"lines",m.id).updatedState,e=dn.addElement(e,E.id,t,"lines",v.id).updatedState}),e=Dr.remove(e,t,r).updatedState,{updatedState:e,lines:Xe([m,v])}}static addFromPoints(e,t,r,i,s,o){i=Xe(i).sort(({x:c,y:h},{x:f,y:p})=>c===f?h-p:c-f);let a=i.zip(i.skip(1)).filterNot(([{x:c,y:h},{x:f,y:p}])=>c===f&&h===p),l=[];return a.forEach(([{x:c,y:h},{x:f,y:p}])=>{let{updatedState:d,line:m}=this.create(e,t,r,c,h,f,p,s);e=d,o&&o.forEach(x=>{let{x:v,y:_}=x.offsetPosition;if(Gy(c,h,f,p,v,_)){let b=On(c,h,f,p,v,_);b>=0&&b<=1&&(e=fn.create(e,t,x.hole.type,m.id,b,x.hole.properties).updatedState)}}),l.push(m)}),{updatedState:e,lines:Xe(l)}}static createAvoidingIntersections(e,t,r,i,s,o,a,l,c){let h=[{x:i,y:s},{x:o,y:a}];e=e.getIn(["scene","layers",t,"lines"]).reduce((d,m)=>{var M,E;let[x,v]=m.vertices.map(S=>d.getIn(["scene","layers",t,"vertices"]).get(S)).toArray(),_=Vr(x,h[0])||Vr(x,h[1])||Vr(v,h[0])||Vr(v,h[1]),b=Hy(h[0],h[1],x,v);if(b.type==="colinear"){c||(c=[]);const S=Qa(h);d.getIn(["scene","layers",t,"lines",m.id,"holes"]).forEach(T=>{let q=d.getIn(["scene","layers",t,"holes",T]),O=Ln(x.x,x.y,v.x,v.y),A=Vr(S[1],m.vertices.get(1))?1-q.offset:q.offset,L=mc(x.x,x.y,v.x,v.y,O*A);c.push({hole:q,offsetPosition:L})}),d=this.remove(d,t,m.id).updatedState,h.push(x,v)}return b.type==="intersecting"&&!_&&(d=this.split(d,t,m.id,((M=b.point)==null?void 0:M.x)??0,((E=b.point)==null?void 0:E.y)??0).updatedState,h.push(b.point??{x:0,y:0})),d},e);let{updatedState:f,lines:p}=Dr.addFromPoints(e,t,r,h,l,c);return{updatedState:f,lines:p}}static replaceVertex(e,t,r,i,s,o){let a=e.getIn(["scene","layers",t,"lines",r,"vertices",i]);e=ln.remove(e,t,a,"lines",r).updatedState;let{updatedState:l,vertex:c}=ln.add(e,t,s,o,"lines",r);return e=l,e=e.setIn(["scene","layers",t,"lines",r,"vertices",i],c.id),e=e.setIn(["scene","layers",t,"lines",r],e.getIn(["scene","layers",t,"lines",r])),{updatedState:e,line:e.getIn(["scene","layers",t,"lines",r]),vertex:c}}static selectToolDrawingLine(e,t){return e=e.merge({mode:Ur,drawingSupport:Pe({type:t})}),{updatedState:e}}static beginDrawingLine(e,t,r,i){let s=xf(e.scene,Xe(),e.snapMask),o=null;e.snapMask&&!e.snapMask.isEmpty()&&(o=pi(s,r,i,e.snapMask),o&&({x:r,y:i}=o.point),s=s.withMutations(h=>{let f,p,d;({a:f,b:p,c:d}=dc(i)),gc(h,f,p,d,10,3,null),{a:f,b:p,c:d}=pc(r),gc(h,f,p,d,10,3,null)}));let a=e.get("drawingSupport").set("layerID",t);e=at.unselectAll(e,t).updatedState;let{updatedState:l,line:c}=Dr.create(e,t,a.get("type"),r,i,r,i);return e=Dr.select(l,t,c.id).updatedState,e=e.merge({mode:cr,snapElements:s,activeSnapElement:o?o.snap:null,drawingSupport:a}),{updatedState:e}}static updateDrawingLine(e,t,r){let i=null;e.snapMask&&!e.snapMask.isEmpty()&&(i=pi(e.snapElements,t,r,e.snapMask),i&&({x:t,y:r}=i.point));let s=e.getIn(["drawingSupport","layerID"]),o=e.getIn(["scene","layers",s,"selected","lines"]).first(),{updatedState:a}=Dr.replaceVertex(e,s,o,1,t,r);return e=a,e=this.select(e,s,o).updatedState,e=e.merge({activeSnapElement:i?i.snap:null}),{updatedState:e}}static endDrawingLine(e,t,r){if(e.snapMask&&!e.snapMask.isEmpty()){let c=pi(e.snapElements,t,r,e.snapMask);c&&({x:t,y:r}=c.point)}const i=e.getIn(["drawingSupport","layerID"]),s=e.getIn(["scene","layers",i]),o=e.getIn(["scene","layers",i,"selected","lines"]).first(),a=e.getIn(["scene","layers",i,"lines",o]),l=s.vertices.get(a.vertices.get(0));return e=Dr.remove(e,i,o).updatedState,e=Dr.createAvoidingIntersections(e,i,a.type,l.x,l.y,t,r).updatedState,e=at.detectAndUpdateAreas(e,i).updatedState,e=e.merge({mode:Ur,snapElements:Xe(),activeSnapElement:null}),{updatedState:e}}static beginDraggingLine(e,t,r,i,s){let o=xf(e.scene,Xe(),e.snapMask),a=e.scene.layers.get(t),l=a.lines.get(r),c=a.vertices.get(l.vertices.get(0)),h=a.vertices.get(l.vertices.get(1));return e=e.merge({mode:Fr,snapElements:o,draggingSupport:Pe({layerID:t,lineID:r,startPointX:i,startPointY:s,startVertex0X:c.x,startVertex0Y:c.y,startVertex1X:h.x,startVertex1Y:h.y})}),{updatedState:e}}static updateDraggingLine(e,t,r){let i=e.draggingSupport,s=e.snapElements,o=i.get("layerID"),a=i.get("lineID"),l=t-i.get("startPointX"),c=r-i.get("startPointY"),h=i.get("startVertex0X")+l,f=i.get("startVertex0Y")+c,p=i.get("startVertex1X")+l,d=i.get("startVertex1Y")+c,m=null,x=null,v=null;e.snapMask&&!e.snapMask.isEmpty()&&(x=pi(s,h,f,e.snapMask),v=pi(s,p,d,e.snapMask));let _=0,b=0;return x&&v?x.point.distance<v.point.distance?(_=x.point.x-h,b=x.point.y-f,m=x.snap):(_=v.point.x-p,b=v.point.y-d,m=v.snap):(x&&(_=x.point.x-h,b=x.point.y-f,m=x.snap),v&&(_=v.point.x-p,b=v.point.y-d,m=v.snap)),h+=_,f+=b,p+=_,d+=b,e=e.merge({activeSnapElement:m,scene:e.scene.updateIn(["layers",o],M=>M.withMutations(E=>{let S=E.getIn(["lines",a,"vertices"]);return E.updateIn(["vertices",S.get(0)],T=>T.merge({x:h,y:f})),E.updateIn(["vertices",S.get(1)],T=>T.merge({x:p,y:d})),E}))}),{updatedState:e}}static endDraggingLine(e,t,r){let{draggingSupport:i}=e,s=i.get("layerID"),o=e.scene.layers.get(s),a=i.get("lineID"),l=o.lines.get(a),c=o.vertices.get(l.vertices.get(0)),h=o.vertices.get(l.vertices.get(1)),f=lf(c,h),p=hc(c,h),d=fc(p,f),m=Math.atan2(f.y-p.y,f.x-p.x),x=[];o.lines.get(a).holes.forEach(q=>{let O=o.holes.get(q),A=d*O.offset,L={x:A*Math.cos(m)+p.x,y:A*Math.sin(m)+p.y};x.push({hole:O,offsetPosition:L})});let v=t-i.get("startPointX"),_=r-i.get("startPointY"),b=i.get("startVertex0X")+v,M=i.get("startVertex0Y")+_,E=i.get("startVertex1X")+v,S=i.get("startVertex1Y")+_;if(e.snapMask&&!e.snapMask.isEmpty()){let q=pi(e.snapElements,b,M,e.snapMask),O=pi(e.snapElements,E,S,e.snapMask),A=0,L=0;q&&O?q.point.distance<O.point.distance?(A=q.point.x-b,L=q.point.y-M):(A=O.point.x-E,L=O.point.y-S):(q&&(A=q.point.x-b,L=q.point.y-M),O&&(A=O.point.x-E,L=O.point.y-S)),b+=A,M+=L,E+=A,S+=L}let T=e.getIn(["scene","groups"]).filter(q=>{const O=q.getIn(["elements",s,"lines"]);return O&&O.contains(a)});if(e=at.mergeEqualsVertices(e,s,l.vertices.get(0)).updatedState,e=at.mergeEqualsVertices(e,s,l.vertices.get(1)).updatedState,e=Dr.remove(e,s,a).updatedState,!Vr({x:b,y:M},{x:E,y:S})){let q=Dr.createAvoidingIntersections(e,s,l.type,b,M,E,S,l.properties,x);e=q.updatedState,q.lines.forEach(O=>{T.forEach(A=>{e=dn.addElement(e,A.id,s,"lines",O.id).updatedState})})}return e=at.detectAndUpdateAreas(e,s).updatedState,e=e.merge({mode:rn,draggingSupport:null,activeSnapElement:null,snapElements:Xe()}),{updatedState:e}}static setProperties(e,t,r,i){return e=e.mergeIn(["scene","layers",t,"lines",r,"properties"],i),{updatedState:e}}static setJsProperties(e,t,r,i){return this.setProperties(e,t,r,At(i))}static updateProperties(e,t,r,i){return i.forEach((s,o)=>{e.hasIn(["scene","layers",t,"lines",r,"properties",o])&&(e=e.mergeIn(["scene","layers",t,"lines",r,"properties",o],s))}),{updatedState:e}}static updateJsProperties(e,t,r,i){return this.updateProperties(e,t,r,At(i))}static setAttributes(e,t,r,i){let s=i.toJS(),{vertexOne:o,vertexTwo:a,lineLength:l}=s;return delete s.vertexOne,delete s.vertexTwo,delete s.lineLength,e=e.mergeIn(["scene","layers",t,"lines",r],At(s)).mergeIn(["scene","layers",t,"vertices",o.id],{x:o.x,y:o.y}).mergeIn(["scene","layers",t,"vertices",a.id],{x:a.x,y:a.y}).mergeIn(["scene","layers",t,"lines",r,"misc"],Pe({_unitLength:l._unit})),e=at.mergeEqualsVertices(e,t,o.id).updatedState,o.x!=a.x&&o.y!=a.y&&(e=at.mergeEqualsVertices(e,t,a.id).updatedState),e=at.detectAndUpdateAreas(e,t).updatedState,{updatedState:e}}static setVerticesCoords(e,t,r,i,s,o,a){let l=e.getIn(["scene","layers",t,"lines",r]);return e=ln.setAttributes(e,t,l.vertices.get(0),Pe({x:i,y:s})).updatedState,e=ln.setAttributes(e,t,l.vertices.get(1),Pe({x:o,y:a})).updatedState,{updatedState:e}}},ln=class{static add(e,t,r,i,s,o){let a=e.getIn(["scene","layers",t,"vertices"]).find(l=>Vr(l,{x:r,y:i}));return a?a=a.update(s,l=>l.push(o)):a=new Q0({id:mi.acquireID(),name:"Vertex",x:r,y:i,[s]:Xe([o])}),e=e.setIn(["scene","layers",t,"vertices",a.id],a),{updatedState:e,vertex:a}}static setAttributes(e,t,r,i){return e=e.mergeIn(["scene","layers",t,"vertices",r],i),{updatedState:e}}static addElement(e,t,r,i,s){return e=e.updateIn(["scene","layers",t,"vertices",r,i],o=>o.push(s)),{updatedState:e}}static removeElement(e,t,r,i,s){let o=e.getIn(["scene","layers",t,"vertices",r,i]).findIndex(a=>a===s);return o!==-1&&(e=e.updateIn(["scene","layers",t,"vertices",r,i],a=>a.remove(o))),{updatedState:e}}static select(e,t,r){return e=e.setIn(["scene","layers",t,"vertices",r,"selected"],!0),e=e.updateIn(["scene","layers",t,"selected","vertices"],i=>i.push(r)),{updatedState:e}}static unselect(e,t,r){return e=e.setIn(["scene","layers",t,"vertices",r,"selected"],!1),e=e.updateIn(["scene","layers",t,"selected","vertices"],i=>i.filter(s=>s.id!==r)),{updatedState:e}}static remove(e,t,r,i,s,o){let a=e.getIn(["scene","layers",t,"vertices",r]);return a&&(i&&s&&(a=a.update(i,c=>{let h=c.findIndex(f=>s===f);return c.delete(h)})),(a.areas.size||a.lines.size)&&!o?e=e.setIn(["scene","layers",t,"vertices",r],a):e=e.deleteIn(["scene","layers",t,"vertices",r])),{updatedState:e}}static beginDraggingVertex(e,t,r){let i=xf(e.scene,Xe(),e.snapMask);return e=e.merge({mode:zr,snapElements:i,draggingSupport:Pe({layerID:t,vertexID:r,previousMode:e.get("mode")})}),{updatedState:e}}static updateDraggingVertex(e,t,r){let{draggingSupport:i,snapElements:s,scene:o}=e,a=null;e.snapMask&&!e.snapMask.isEmpty()&&(a=pi(s,t,r,e.snapMask),a&&({x:t,y:r}=a.point));let l=i.get("layerID"),c=i.get("vertexID");return e=e.merge({activeSnapElement:a?a.snap:null,scene:o.mergeIn(["layers",l,"vertices",c],{x:t,y:r})}),{updatedState:e}}static endDraggingVertex(e){let{draggingSupport:t}=e,r=t.get("layerID"),i=t.get("vertexID"),s=e.getIn(["scene","layers",r,"vertices",i,"lines"]);return s&&(e=s.reduce((o,a)=>{if(!o.getIn(["scene","layers",r,"lines",a]))return o;let l=o.getIn(["scene","layers",r,"lines",a,"vertices",0]),c=o.getIn(["scene","layers",r,"lines",a,"vertices",1]),h=l===i?c:l,f=o.getIn(["scene","layers",r,"vertices",h]),p=o.getIn(["scene","layers",r,"vertices",i]),d=[],m=Qa([f,p]);o.getIn(["scene","layers",r,"lines",a,"holes"]).forEach(b=>{let M=o.getIn(["scene","layers",r,"holes",b]),E=Ln(f.x,f.y,p.x,p.y),S=Vr(m[1],o.getIn(["scene","layers",r,"lines",a,"vertices",1]))?1-M.offset:M.offset,T=mc(f.x,f.y,p.x,p.y,E*S);d.push({hole:M,offsetPosition:T})});let x=o.getIn(["scene","layers",r,"lines",a,"type"]),v=o.getIn(["scene","layers",r,"lines",a,"properties"]),_=o.getIn(["scene","groups"]).filter(b=>{const M=b.getIn(["elements",r,"lines"]);return M&&M.contains(a)});if(o=at.removeZeroLengthLines(o,r).updatedState,o=at.mergeEqualsVertices(o,r,i).updatedState,o=Mn.remove(o,r,a).updatedState,!Vr(f,p)){let b=Mn.createAvoidingIntersections(o,r,x,f.x,f.y,p.x,p.y,v,d);o=b.updatedState,b.lines.forEach(M=>{_.forEach(E=>{o=dn.addElement(o,E.id,r,"lines",M.id).updatedState})})}return o},e)),e=at.detectAndUpdateAreas(e,r).updatedState,e=e.merge({mode:t.get("previousMode"),draggingSupport:null,activeSnapElement:null,snapElements:Xe()}),{updatedState:e}}},Us=class{static add(e,t,r,i,s){let o,a=e.getIn(["scene","layers",t]);return a=a.withMutations(l=>{const c=mi.acquireID(),h=i.map(f=>ln.add(e,t,f.x,f.y,"areas",c).vertex.id);o=s.factoryElement(r,{id:c,name:Ec.generateName("areas",s.getIn(["elements",r,"info","title"])),type:r,prototype:"areas",vertices:h}),l.setIn(["areas",c],o)}),e=e.setIn(["scene","layers",t],a),{updatedState:e,area:o}}static select(e,t,r){return e=at.select(e,t).updatedState,e=at.selectElement(e,t,"areas",r).updatedState,{updatedState:e}}static remove(e,t,r){let i=e.getIn(["scene","layers",t,"areas",r]);return i.get("selected")===!0&&(e=this.unselect(e,t,r).updatedState),i.vertices.forEach(s=>{e=ln.remove(e,t,s,"areas",r).updatedState}),e=e.deleteIn(["scene","layers",t,"areas",r]),e.getIn(["scene","groups"]).forEach(s=>e=dn.removeElement(e,s.id,t,"areas",r).updatedState),{updatedState:e}}static unselect(e,t,r){return e=at.unselect(e,t,"areas",r).updatedState,{updatedState:e}}static setProperties(e,t,r,i){return e=e.mergeIn(["scene","layers",t,"areas",r,"properties"],i),{updatedState:e}}static setJsProperties(e,t,r,i){return this.setProperties(e,t,r,At(i))}static updateProperties(e,t,r,i){return i.forEach((s,o)=>{e.hasIn(["scene","layers",t,"areas",r,"properties",o])&&(e=e.mergeIn(["scene","layers",t,"areas",r,"properties",o],s))}),{updatedState:e}}static updateJsProperties(e,t,r,i){return this.updateProperties(e,t,r,At(i))}static setAttributes(e){return{updatedState:e}}};const Pg=(n,e)=>n.size===e.size&&n.isSuperset(e)&&n.isSubset(e);let at=class{static create(e,t,r){let i=mi.acquireID();t=t||`layer ${i}`,r=r||0;let s=new gf({id:i,name:t,altitude:r});return e=e.setIn(["scene","selectedLayer"],i),e=e.setIn(["scene","layers",i],s),{updatedState:e}}static select(e,t){return e.get("alterate")||(e=Vt.unselectAll(e).updatedState),e=e.setIn(["scene","selectedLayer"],t),{updatedState:e}}static selectElement(e,t,r,i){return e=e.setIn(["scene","layers",t,r,i,"selected"],!0),e=e.updateIn(["scene","layers",t,"selected",r],s=>s.push(i)),{updatedState:e}}static unselect(e,t,r,i){return e=e.setIn(["scene","layers",t,r,i,"selected"],!1),e=e.updateIn(["scene","layers",t,"selected",r],s=>s.filter(o=>o.id===i)),{updatedState:e}}static unselectAll(e,t){let{lines:r,holes:i,items:s,areas:o}=e.getIn(["scene","layers",t]);return r&&r.forEach(a=>{e=Mn.unselect(e,t,a.id).updatedState}),i&&i.forEach(a=>{e=fn.unselect(e,t,a.id).updatedState}),s&&s.forEach(a=>{e=_n.unselect(e,t,a.id).updatedState}),o&&o.forEach(a=>{e=Us.unselect(e,t,a.id).updatedState}),{updatedState:e}}static setProperties(e,t,r){return e=e.mergeIn(["scene","layers",t],r),e=e.updateIn(["scene","layers"],i=>i.sort((s,o)=>s.altitude!==o.altitude?s.altitude-o.altitude:s.order-o.order)),{updatedState:e}}static remove(e,t){return e=e.removeIn(["scene","layers",t]),e=e.setIn(["scene","selectedLayer"],e.scene.selectedLayer!==t?e.scene.selectedLayer:e.scene.layers.first().id),{updatedState:e}}static removeElement(e,t,r,i){return e=e.deleteIn(["scene","layers",t,r,i]),{updatedState:e}}static detectAndUpdateAreas(e,t){let r=[],i,s={},o={};e.getIn(["scene","layers",t,"vertices"]).forEach(d=>{let x=r.push([d.x,d.y])-1;s[d.id]=x,o[x]=d.id}),i=e.getIn(["scene","layers",t,"lines"]).map(d=>d.vertices.map(m=>s[m]).toArray());const a=x3(r,i);let l=Xe(a).map(d=>Xe(d.map(m=>o[m])));l=l.map(d=>y3(d.map(m=>e.getIn(["scene","layers",t,"vertices",m])))?d.reverse():d);const c=[];e.getIn(["scene","layers",t,"areas"]).forEach(d=>{l.some(x=>Pg(x,d.vertices))||(e=Us.remove(e,t,d.id).updatedState)}),l.forEach((d,m)=>{const x=e.getIn(["scene","layers",t,"areas"]).find(v=>Pg(v.vertices,d));if(x)c[m]=x.id,e=e.setIn(["scene","layers",t,"areas",c[m],"holes"],Xe());else{const v=d.map(b=>e.getIn(["scene","layers",t,"vertices",b])),_=Us.add(e,t,"area",v,e.catalog);c[m]=_.area.id,e=_.updatedState}});let h=c.map(d=>{let m=e.getIn(["scene","layers",t,"areas",d]).vertices.map(x=>{let{x:v,y:_}=e.getIn(["scene","layers",t,"vertices",x]);return Xe([v,_])});return{id:d,vertices:m}}),f,p;for(f=0;f<h.length;f++){let d=Xe(),m=h[f].vertices.flatten().toArray();for(p=0;p<h.length;p++)f!==p&&Yy(m,h[p].vertices.get(0).get(0),h[p].vertices.get(0).get(1))&&(d=d.push(h[p].id));e=e.setIn(["scene","layers",t,"areas",h[f].id,"holes"],d)}return c.forEach(d=>{let m=new Set,x=e.getIn(["scene","layers",t,"areas",d,"holes"]);x.forEach(v=>{e.getIn(["scene","layers",t,"areas",v,"holes"]).forEach(b=>{x.indexOf(b)!==-1&&m.add(b)})}),m.forEach(v=>{x=x.remove(x.indexOf(v))}),e=e.setIn(["scene","layers",t,"areas",d,"holes"],x)}),{updatedState:e}}static removeZeroLengthLines(e,t){return{updatedState:e.getIn(["scene","layers",t,"lines"]).reduce((i,s)=>{let o=s.getIn(["vertices",0]),a=s.getIn(["vertices",1]),l=i.getIn(["scene","layers",t,"vertices",o]),c=i.getIn(["scene","layers",t,"vertices",a]);return fc(l,c)===0&&(i=Mn.remove(i,t,s.id).updatedState),i},e)}}static mergeEqualsVertices(e,t,r){let i=e.getIn(["scene","layers",t,"vertices",r]),s=e.getIn(["scene","layers",t,"vertices"]).filter(o=>o.id!==r&&Vr(i,o));return s.isEmpty()?{updatedState:e}:(s.forEach(o=>{let a=o.lines.reduce((c,h)=>(c=c.updateIn(["scene","layers",t,"lines",h,"vertices"],f=>{if(f)return f.map(p=>p===o.id?r:p)}),c=ln.addElement(c,t,r,"lines",h).updatedState,c),e),l=o.areas.reduce((c,h)=>(c=c.updateIn(["scene","layers",t,"areas",h,"vertices"],f=>{if(f)return f.map(p=>p===o.id?r:p)}),c=ln.addElement(c,t,r,"areas",h).updatedState,c),a);e=ln.remove(l,t,o.id,null,null,!0).updatedState}),{updatedState:e})}static setPropertiesOnSelected(e,t,r){let i=e.getIn(["scene","layers",t,"selected"]);return i.lines.forEach(s=>e=Mn.setProperties(e,t,s,r).updatedState),i.holes.forEach(s=>e=fn.setProperties(e,t,s,r).updatedState),i.areas.forEach(s=>e=Us.setProperties(e,t,s,r).updatedState),i.items.forEach(s=>e=_n.setProperties(e,t,s,r).updatedState),{updatedState:e}}static updatePropertiesOnSelected(e,t,r){let i=e.getIn(["scene","layers",t,"selected"]);return i.lines.forEach(s=>e=Mn.updateProperties(e,t,s,r).updatedState),i.holes.forEach(s=>e=fn.updateProperties(e,t,s,r).updatedState),i.areas.forEach(s=>e=Us.updateProperties(e,t,s,r).updatedState),i.items.forEach(s=>e=_n.updateProperties(e,t,s,r).updatedState),{updatedState:e}}static setAttributesOnSelected(e,t,r){let i=e.getIn(["scene","layers",t,"selected"]);return i.lines.forEach(s=>e=Mn.setAttributes(e,t,s,r).updatedState),i.holes.forEach(s=>e=fn.setAttributes(e,t,s,r).updatedState),i.items.forEach(s=>e=_n.setAttributes(e,t,s,r).updatedState),{updatedState:e}}};class bc{static create(e,t){let r=mi.acquireID();return e=e.setIn(["scene","guides","horizontal",r],t),{updatedState:e}}static remove(e,t){return e=e.deleteIn(["scene","guides","horizontal",t]),{updatedState:e}}}class Mc{static create(e,t){let r=mi.acquireID();return e=e.setIn(["scene","guides","vertical",r],t),{updatedState:e}}static remove(e,t){return e=e.deleteIn(["scene","guides","vertical",t]),{updatedState:e}}}class Vt{static setAlterate(e){return{updatedState:e.set("alterate",!e.alterate)}}static openCatalog(e){return e=this.setMode(e,sf).updatedState,{updatedState:e}}static newProject(e){return e=new vc({viewer2D:e.get("viewer2D")}),{updatedState:e}}static loadProject(e,t){return e=new vc({scene:t,catalog:e.catalog.toJS()}),{updatedState:e}}static setProperties(e,t,r){return e=at.setPropertiesOnSelected(e,t,r).updatedState,{updatedState:e}}static updateProperties(e,t,r){return e=at.updatePropertiesOnSelected(e,t,r).updatedState,{updatedState:e}}static setItemsAttributes(e,t){return e.getIn(["scene","layers"]).forEach(r=>{e=at.setAttributesOnSelected(e,r.id,t).updatedState}),{updatedState:e}}static setLinesAttributes(e,t){return e.getIn(["scene","layers"]).forEach(r=>{e=at.setAttributesOnSelected(e,r.id,t).updatedState}),{updatedState:e}}static setHolesAttributes(e,t){return e.getIn(["scene","layers"]).forEach(r=>{e=at.setAttributesOnSelected(e,r.id,t).updatedState}),{updatedState:e}}static unselectAll(e){return e.getIn(["scene","layers"]).forEach(({id:t})=>{e=at.unselectAll(e,t).updatedState}),e.getIn(["scene","groups"]).forEach(t=>{e=dn.unselect(e,t.get("id")).updatedState}),{updatedState:e}}static remove(e){let t=e.getIn(["scene","selectedLayer"]),{lines:r,holes:i,items:s}=e.getIn(["scene","layers",t,"selected"]);return e=at.unselectAll(e,t).updatedState,r.forEach(o=>{e=Mn.remove(e,t,o).updatedState}),i.forEach(o=>{e=fn.remove(e,t,o).updatedState}),s.forEach(o=>{e=_n.remove(e,t,o).updatedState}),e=at.detectAndUpdateAreas(e,t).updatedState,{updatedState:e}}static undo(e){let t=e.sceneHistory;return e.scene===t.last&&t.list.size>1&&(t=vg(t)),e=e.merge({mode:rn,scene:t.last,sceneHistory:vg(t)}),{updatedState:e}}static redo(e){let t=e.sceneHistory;return e.scene===t.last&&t.redoList.size>0&&(t=L3(t)),e=e.merge({mode:rn,scene:t.last,sceneHistory:t}),{updatedState:e}}static rollback(e){let t=e.sceneHistory;return!t.last&&t.list.isEmpty()?{updatedState:e}:(e=this.unselectAll(e).updatedState,e=e.merge({mode:rn,scene:t.last,sceneHistory:an(t,t.last),snapElements:Xe(),activeSnapElement:null,drawingSupport:Pe(),draggingSupport:Pe(),rotatingSupport:Pe()}),{updatedState:e})}static setProjectProperties(e,t){let r=e.scene.merge(t);return e=e.merge({mode:rn,scene:r}),{updatedState:e}}static openProjectConfigurator(e){return e=e.merge({mode:X0}),{updatedState:e}}static initCatalog(e,t){return e=e.set("catalog",new vf(t)),{updatedState:e}}static updateMouseCoord(e,t){return e=e.set("mouse",Pe(t)),{updatedState:e}}static updateZoomScale(e,t){return e=e.set("zoom",t),{updatedState:e}}static toggleSnap(e,t){return e=e.set("snapMask",t),{updatedState:e}}static throwError(e,t){return e=e.set("errors",e.get("errors").push({date:Date.now(),error:t})),{updatedState:e}}static throwWarning(e,t){return e=e.set("warnings",e.get("warnings").push({date:Date.now(),warning:t})),{updatedState:e}}static copyProperties(e,t){return e=e.set("clipboardProperties",t),{updatedState:e}}static pasteProperties(e){return e=this.updateProperties(e,e.getIn(["scene","selectedLayer"]),e.get("clipboardProperties")).updatedState,{updatedState:e}}static pushLastSelectedCatalogElementToHistory(e,t){let r=e.selectedElementsHistory,i=r.findIndex(s=>s.name===t.name);return i!==-1&&(r=r.splice(i,1)),r=r.splice(0,0,t),e=e.set("selectedElementsHistory",r),{updatedState:e}}static changeCatalogPage(e,t,r){return e=e.setIn(["catalog","page"],r).updateIn(["catalog","path"],i=>i.push(t)),{updatedState:e}}static goBackToCatalogPage(e,t){let r=e.catalog.path.findIndex(i=>i===t);return e=e.setIn(["catalog","page"],t).updateIn(["catalog","path"],i=>i.take(r)),{updatedState:e}}static setMode(e,t){return e=e.set("mode",t),{updatedState:e}}static addHorizontalGuide(e,t){return e=bc.create(e,t).updatedState,{updatedState:e}}static addVerticalGuide(e,t){return e=Mc.create(e,t).updatedState,{updatedState:e}}static addCircularGuide(e,t,r,i){return console.log("adding horizontal guide at",t,r,i),{updatedState:e}}static removeHorizontalGuide(e,t){return e=bc.remove(e,t).updatedState,{updatedState:e}}static removeVerticalGuide(e,t){return e=Mc.remove(e,t).updatedState,{updatedState:e}}static removeCircularGuide(e,t){return console.log("removeing horizontal guide ",t),{updatedState:e}}}var wc={exports:{}},Tc={exports:{}},Pt={};/** @license React v16.13.1
54
46
  * react-is.production.min.js
55
47
  *
56
48
  * Copyright (c) Facebook, Inc. and its affiliates.
57
49
  *
58
50
  * This source code is licensed under the MIT license found in the
59
51
  * LICENSE file in the root directory of this source tree.
60
- */var Ig;function W3(){if(Ig)return Ft;Ig=1;var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,o=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,h=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.suspense_list"):60120,d=n?Symbol.for("react.memo"):60115,m=n?Symbol.for("react.lazy"):60116,x=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,_=n?Symbol.for("react.responder"):60118,E=n?Symbol.for("react.scope"):60119;function M(S){if(typeof S=="object"&&S!==null){var T=S.$$typeof;switch(T){case e:switch(S=S.type,S){case l:case c:case r:case s:case i:case f:return S;default:switch(S=S&&S.$$typeof,S){case a:case h:case m:case d:case o:return S;default:return T}}case t:return T}}}function b(S){return M(S)===c}return Ft.AsyncMode=l,Ft.ConcurrentMode=c,Ft.ContextConsumer=a,Ft.ContextProvider=o,Ft.Element=e,Ft.ForwardRef=h,Ft.Fragment=r,Ft.Lazy=m,Ft.Memo=d,Ft.Portal=t,Ft.Profiler=s,Ft.StrictMode=i,Ft.Suspense=f,Ft.isAsyncMode=function(S){return b(S)||M(S)===l},Ft.isConcurrentMode=b,Ft.isContextConsumer=function(S){return M(S)===a},Ft.isContextProvider=function(S){return M(S)===o},Ft.isElement=function(S){return typeof S=="object"&&S!==null&&S.$$typeof===e},Ft.isForwardRef=function(S){return M(S)===h},Ft.isFragment=function(S){return M(S)===r},Ft.isLazy=function(S){return M(S)===m},Ft.isMemo=function(S){return M(S)===d},Ft.isPortal=function(S){return M(S)===t},Ft.isProfiler=function(S){return M(S)===s},Ft.isStrictMode=function(S){return M(S)===i},Ft.isSuspense=function(S){return M(S)===f},Ft.isValidElementType=function(S){return typeof S=="string"||typeof S=="function"||S===r||S===c||S===s||S===i||S===f||S===p||typeof S=="object"&&S!==null&&(S.$$typeof===m||S.$$typeof===d||S.$$typeof===o||S.$$typeof===a||S.$$typeof===h||S.$$typeof===v||S.$$typeof===_||S.$$typeof===E||S.$$typeof===x)},Ft.typeOf=M,Ft}var zt={};/** @license React v16.13.1
52
+ */var Ig;function W3(){if(Ig)return Pt;Ig=1;var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,o=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,h=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.suspense_list"):60120,d=n?Symbol.for("react.memo"):60115,m=n?Symbol.for("react.lazy"):60116,x=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,_=n?Symbol.for("react.responder"):60118,b=n?Symbol.for("react.scope"):60119;function M(S){if(typeof S=="object"&&S!==null){var T=S.$$typeof;switch(T){case e:switch(S=S.type,S){case l:case c:case r:case s:case i:case f:return S;default:switch(S=S&&S.$$typeof,S){case a:case h:case m:case d:case o:return S;default:return T}}case t:return T}}}function E(S){return M(S)===c}return Pt.AsyncMode=l,Pt.ConcurrentMode=c,Pt.ContextConsumer=a,Pt.ContextProvider=o,Pt.Element=e,Pt.ForwardRef=h,Pt.Fragment=r,Pt.Lazy=m,Pt.Memo=d,Pt.Portal=t,Pt.Profiler=s,Pt.StrictMode=i,Pt.Suspense=f,Pt.isAsyncMode=function(S){return E(S)||M(S)===l},Pt.isConcurrentMode=E,Pt.isContextConsumer=function(S){return M(S)===a},Pt.isContextProvider=function(S){return M(S)===o},Pt.isElement=function(S){return typeof S=="object"&&S!==null&&S.$$typeof===e},Pt.isForwardRef=function(S){return M(S)===h},Pt.isFragment=function(S){return M(S)===r},Pt.isLazy=function(S){return M(S)===m},Pt.isMemo=function(S){return M(S)===d},Pt.isPortal=function(S){return M(S)===t},Pt.isProfiler=function(S){return M(S)===s},Pt.isStrictMode=function(S){return M(S)===i},Pt.isSuspense=function(S){return M(S)===f},Pt.isValidElementType=function(S){return typeof S=="string"||typeof S=="function"||S===r||S===c||S===s||S===i||S===f||S===p||typeof S=="object"&&S!==null&&(S.$$typeof===m||S.$$typeof===d||S.$$typeof===o||S.$$typeof===a||S.$$typeof===h||S.$$typeof===v||S.$$typeof===_||S.$$typeof===b||S.$$typeof===x)},Pt.typeOf=M,Pt}var It={};/** @license React v16.13.1
61
53
  * react-is.development.js
62
54
  *
63
55
  * Copyright (c) Facebook, Inc. and its affiliates.
64
56
  *
65
57
  * This source code is licensed under the MIT license found in the
66
58
  * LICENSE file in the root directory of this source tree.
67
- */var Lg;function j3(){return Lg||(Lg=1,process.env.NODE_ENV!=="production"&&function(){var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,o=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,h=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.suspense_list"):60120,d=n?Symbol.for("react.memo"):60115,m=n?Symbol.for("react.lazy"):60116,x=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,_=n?Symbol.for("react.responder"):60118,E=n?Symbol.for("react.scope"):60119;function M(le){return typeof le=="string"||typeof le=="function"||le===r||le===c||le===s||le===i||le===f||le===p||typeof le=="object"&&le!==null&&(le.$$typeof===m||le.$$typeof===d||le.$$typeof===o||le.$$typeof===a||le.$$typeof===h||le.$$typeof===v||le.$$typeof===_||le.$$typeof===E||le.$$typeof===x)}function b(le){if(typeof le=="object"&&le!==null){var F=le.$$typeof;switch(F){case e:var lt=le.type;switch(lt){case l:case c:case r:case s:case i:case f:return lt;default:var Le=lt&&lt.$$typeof;switch(Le){case a:case h:case m:case d:case o:return Le;default:return F}}case t:return F}}}var S=l,T=c,q=a,O=o,A=e,L=h,N=r,Z=m,Y=d,ee=t,ue=s,te=i,ae=f,B=!1;function Se(le){return B||(B=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),$(le)||b(le)===l}function $(le){return b(le)===c}function oe(le){return b(le)===a}function Ae(le){return b(le)===o}function Ie(le){return typeof le=="object"&&le!==null&&le.$$typeof===e}function Ce(le){return b(le)===h}function V(le){return b(le)===r}function ne(le){return b(le)===m}function X(le){return b(le)===d}function pe(le){return b(le)===t}function Ee(le){return b(le)===s}function Q(le){return b(le)===i}function Ne(le){return b(le)===f}zt.AsyncMode=S,zt.ConcurrentMode=T,zt.ContextConsumer=q,zt.ContextProvider=O,zt.Element=A,zt.ForwardRef=L,zt.Fragment=N,zt.Lazy=Z,zt.Memo=Y,zt.Portal=ee,zt.Profiler=ue,zt.StrictMode=te,zt.Suspense=ae,zt.isAsyncMode=Se,zt.isConcurrentMode=$,zt.isContextConsumer=oe,zt.isContextProvider=Ae,zt.isElement=Ie,zt.isForwardRef=Ce,zt.isFragment=V,zt.isLazy=ne,zt.isMemo=X,zt.isPortal=pe,zt.isProfiler=Ee,zt.isStrictMode=Q,zt.isSuspense=Ne,zt.isValidElementType=M,zt.typeOf=b}()),zt}var Og;function qg(){return Og||(Og=1,process.env.NODE_ENV==="production"?Ic.exports=W3():Ic.exports=j3()),Ic.exports}/*
59
+ */var Lg;function j3(){return Lg||(Lg=1,process.env.NODE_ENV!=="production"&&(function(){var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,o=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,h=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.suspense_list"):60120,d=n?Symbol.for("react.memo"):60115,m=n?Symbol.for("react.lazy"):60116,x=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,_=n?Symbol.for("react.responder"):60118,b=n?Symbol.for("react.scope"):60119;function M(le){return typeof le=="string"||typeof le=="function"||le===r||le===c||le===s||le===i||le===f||le===p||typeof le=="object"&&le!==null&&(le.$$typeof===m||le.$$typeof===d||le.$$typeof===o||le.$$typeof===a||le.$$typeof===h||le.$$typeof===v||le.$$typeof===_||le.$$typeof===b||le.$$typeof===x)}function E(le){if(typeof le=="object"&&le!==null){var z=le.$$typeof;switch(z){case e:var it=le.type;switch(it){case l:case c:case r:case s:case i:case f:return it;default:var Ie=it&&it.$$typeof;switch(Ie){case a:case h:case m:case d:case o:return Ie;default:return z}}case t:return z}}}var S=l,T=c,q=a,O=o,A=e,L=h,N=r,Z=m,K=d,ne=t,ce=s,J=i,oe=f,B=!1;function xe(le){return B||(B=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),U(le)||E(le)===l}function U(le){return E(le)===c}function $(le){return E(le)===a}function pe(le){return E(le)===o}function Se(le){return typeof le=="object"&&le!==null&&le.$$typeof===e}function be(le){return E(le)===h}function V(le){return E(le)===r}function te(le){return E(le)===m}function W(le){return E(le)===d}function ue(le){return E(le)===t}function ye(le){return E(le)===s}function Q(le){return E(le)===i}function Le(le){return E(le)===f}It.AsyncMode=S,It.ConcurrentMode=T,It.ContextConsumer=q,It.ContextProvider=O,It.Element=A,It.ForwardRef=L,It.Fragment=N,It.Lazy=Z,It.Memo=K,It.Portal=ne,It.Profiler=ce,It.StrictMode=J,It.Suspense=oe,It.isAsyncMode=xe,It.isConcurrentMode=U,It.isContextConsumer=$,It.isContextProvider=pe,It.isElement=Se,It.isForwardRef=be,It.isFragment=V,It.isLazy=te,It.isMemo=W,It.isPortal=ue,It.isProfiler=ye,It.isStrictMode=Q,It.isSuspense=Le,It.isValidElementType=M,It.typeOf=E})()),It}var Og;function qg(){return Og||(Og=1,process.env.NODE_ENV==="production"?Tc.exports=W3():Tc.exports=j3()),Tc.exports}/*
68
60
  object-assign
69
61
  (c) Sindre Sorhus
70
62
  @license MIT
71
- */var Nf,Dg;function X3(){if(Dg)return Nf;Dg=1;var n=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function r(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function i(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var o={},a=0;a<10;a++)o["_"+String.fromCharCode(a)]=a;var l=Object.getOwnPropertyNames(o).map(function(h){return o[h]});if(l.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(h){c[h]=h}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Nf=i()?Object.assign:function(s,o){for(var a,l=r(s),c,h=1;h<arguments.length;h++){a=Object(arguments[h]);for(var f in a)e.call(a,f)&&(l[f]=a[f]);if(n){c=n(a);for(var p=0;p<c.length;p++)t.call(a,c[p])&&(l[c[p]]=a[c[p]])}}return l},Nf}var Uf,Ng;function Ff(){if(Ng)return Uf;Ng=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Uf=n,Uf}var zf,Ug;function Fg(){return Ug||(Ug=1,zf=Function.call.bind(Object.prototype.hasOwnProperty)),zf}var kf,zg;function $3(){if(zg)return kf;zg=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var e=Ff(),t={},r=Fg();n=function(s){var o="Warning: "+s;typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}}}function i(s,o,a,l,c){if(process.env.NODE_ENV!=="production"){for(var h in s)if(r(s,h)){var f;try{if(typeof s[h]!="function"){var p=Error((l||"React class")+": "+a+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}f=s[h](o,h,l,a,null,e)}catch(m){f=m}if(f&&!(f instanceof Error)&&n((l||"React class")+": type specification of "+a+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in t)){t[f.message]=!0;var d=c?c():"";n("Failed "+a+" type: "+f.message+(d??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(t={})},kf=i,kf}var Bf,kg;function Y3(){if(kg)return Bf;kg=1;var n=qg(),e=X3(),t=Ff(),r=Fg(),i=$3(),s=function(){};process.env.NODE_ENV!=="production"&&(s=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function o(){return null}return Bf=function(a,l){var c=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function f($){var oe=$&&(c&&$[c]||$[h]);if(typeof oe=="function")return oe}var p="<<anonymous>>",d={array:_("array"),bigint:_("bigint"),bool:_("boolean"),func:_("function"),number:_("number"),object:_("object"),string:_("string"),symbol:_("symbol"),any:E(),arrayOf:M,element:b(),elementType:S(),instanceOf:T,node:L(),objectOf:O,oneOf:q,oneOfType:A,shape:Z,exact:Y};function m($,oe){return $===oe?$!==0||1/$===1/oe:$!==$&&oe!==oe}function x($,oe){this.message=$,this.data=oe&&typeof oe=="object"?oe:{},this.stack=""}x.prototype=Error.prototype;function v($){if(process.env.NODE_ENV!=="production")var oe={},Ae=0;function Ie(V,ne,X,pe,Ee,Q,Ne){if(pe=pe||p,Q=Q||X,Ne!==t){if(l){var le=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw le.name="Invariant Violation",le}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var F=pe+":"+X;!oe[F]&&Ae<3&&(s("You are manually calling a React.PropTypes validation function for the `"+Q+"` prop on `"+pe+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),oe[F]=!0,Ae++)}}return ne[X]==null?V?ne[X]===null?new x("The "+Ee+" `"+Q+"` is marked as required "+("in `"+pe+"`, but its value is `null`.")):new x("The "+Ee+" `"+Q+"` is marked as required in "+("`"+pe+"`, but its value is `undefined`.")):null:$(ne,X,pe,Ee,Q)}var Ce=Ie.bind(null,!1);return Ce.isRequired=Ie.bind(null,!0),Ce}function _($){function oe(Ae,Ie,Ce,V,ne,X){var pe=Ae[Ie],Ee=te(pe);if(Ee!==$){var Q=ae(pe);return new x("Invalid "+V+" `"+ne+"` of type "+("`"+Q+"` supplied to `"+Ce+"`, expected ")+("`"+$+"`."),{expectedType:$})}return null}return v(oe)}function E(){return v(o)}function M($){function oe(Ae,Ie,Ce,V,ne){if(typeof $!="function")return new x("Property `"+ne+"` of component `"+Ce+"` has invalid PropType notation inside arrayOf.");var X=Ae[Ie];if(!Array.isArray(X)){var pe=te(X);return new x("Invalid "+V+" `"+ne+"` of type "+("`"+pe+"` supplied to `"+Ce+"`, expected an array."))}for(var Ee=0;Ee<X.length;Ee++){var Q=$(X,Ee,Ce,V,ne+"["+Ee+"]",t);if(Q instanceof Error)return Q}return null}return v(oe)}function b(){function $(oe,Ae,Ie,Ce,V){var ne=oe[Ae];if(!a(ne)){var X=te(ne);return new x("Invalid "+Ce+" `"+V+"` of type "+("`"+X+"` supplied to `"+Ie+"`, expected a single ReactElement."))}return null}return v($)}function S(){function $(oe,Ae,Ie,Ce,V){var ne=oe[Ae];if(!n.isValidElementType(ne)){var X=te(ne);return new x("Invalid "+Ce+" `"+V+"` of type "+("`"+X+"` supplied to `"+Ie+"`, expected a single ReactElement type."))}return null}return v($)}function T($){function oe(Ae,Ie,Ce,V,ne){if(!(Ae[Ie]instanceof $)){var X=$.name||p,pe=Se(Ae[Ie]);return new x("Invalid "+V+" `"+ne+"` of type "+("`"+pe+"` supplied to `"+Ce+"`, expected ")+("instance of `"+X+"`."))}return null}return v(oe)}function q($){if(!Array.isArray($))return process.env.NODE_ENV!=="production"&&(arguments.length>1?s("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):s("Invalid argument supplied to oneOf, expected an array.")),o;function oe(Ae,Ie,Ce,V,ne){for(var X=Ae[Ie],pe=0;pe<$.length;pe++)if(m(X,$[pe]))return null;var Ee=JSON.stringify($,function(Ne,le){var F=ae(le);return F==="symbol"?String(le):le});return new x("Invalid "+V+" `"+ne+"` of value `"+String(X)+"` "+("supplied to `"+Ce+"`, expected one of "+Ee+"."))}return v(oe)}function O($){function oe(Ae,Ie,Ce,V,ne){if(typeof $!="function")return new x("Property `"+ne+"` of component `"+Ce+"` has invalid PropType notation inside objectOf.");var X=Ae[Ie],pe=te(X);if(pe!=="object")return new x("Invalid "+V+" `"+ne+"` of type "+("`"+pe+"` supplied to `"+Ce+"`, expected an object."));for(var Ee in X)if(r(X,Ee)){var Q=$(X,Ee,Ce,V,ne+"."+Ee,t);if(Q instanceof Error)return Q}return null}return v(oe)}function A($){if(!Array.isArray($))return process.env.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var oe=0;oe<$.length;oe++){var Ae=$[oe];if(typeof Ae!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+B(Ae)+" at index "+oe+"."),o}function Ie(Ce,V,ne,X,pe){for(var Ee=[],Q=0;Q<$.length;Q++){var Ne=$[Q],le=Ne(Ce,V,ne,X,pe,t);if(le==null)return null;le.data&&r(le.data,"expectedType")&&Ee.push(le.data.expectedType)}var F=Ee.length>0?", expected one of type ["+Ee.join(", ")+"]":"";return new x("Invalid "+X+" `"+pe+"` supplied to "+("`"+ne+"`"+F+"."))}return v(Ie)}function L(){function $(oe,Ae,Ie,Ce,V){return ee(oe[Ae])?null:new x("Invalid "+Ce+" `"+V+"` supplied to "+("`"+Ie+"`, expected a ReactNode."))}return v($)}function N($,oe,Ae,Ie,Ce){return new x(($||"React class")+": "+oe+" type `"+Ae+"."+Ie+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+Ce+"`.")}function Z($){function oe(Ae,Ie,Ce,V,ne){var X=Ae[Ie],pe=te(X);if(pe!=="object")return new x("Invalid "+V+" `"+ne+"` of type `"+pe+"` "+("supplied to `"+Ce+"`, expected `object`."));for(var Ee in $){var Q=$[Ee];if(typeof Q!="function")return N(Ce,V,ne,Ee,ae(Q));var Ne=Q(X,Ee,Ce,V,ne+"."+Ee,t);if(Ne)return Ne}return null}return v(oe)}function Y($){function oe(Ae,Ie,Ce,V,ne){var X=Ae[Ie],pe=te(X);if(pe!=="object")return new x("Invalid "+V+" `"+ne+"` of type `"+pe+"` "+("supplied to `"+Ce+"`, expected `object`."));var Ee=e({},Ae[Ie],$);for(var Q in Ee){var Ne=$[Q];if(r($,Q)&&typeof Ne!="function")return N(Ce,V,ne,Q,ae(Ne));if(!Ne)return new x("Invalid "+V+" `"+ne+"` key `"+Q+"` supplied to `"+Ce+"`.\nBad object: "+JSON.stringify(Ae[Ie],null," ")+`
72
- Valid keys: `+JSON.stringify(Object.keys($),null," "));var le=Ne(X,Q,Ce,V,ne+"."+Q,t);if(le)return le}return null}return v(oe)}function ee($){switch(typeof $){case"number":case"string":case"undefined":return!0;case"boolean":return!$;case"object":if(Array.isArray($))return $.every(ee);if($===null||a($))return!0;var oe=f($);if(oe){var Ae=oe.call($),Ie;if(oe!==$.entries){for(;!(Ie=Ae.next()).done;)if(!ee(Ie.value))return!1}else for(;!(Ie=Ae.next()).done;){var Ce=Ie.value;if(Ce&&!ee(Ce[1]))return!1}}else return!1;return!0;default:return!1}}function ue($,oe){return $==="symbol"?!0:oe?oe["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&oe instanceof Symbol:!1}function te($){var oe=typeof $;return Array.isArray($)?"array":$ instanceof RegExp?"object":ue(oe,$)?"symbol":oe}function ae($){if(typeof $>"u"||$===null)return""+$;var oe=te($);if(oe==="object"){if($ instanceof Date)return"date";if($ instanceof RegExp)return"regexp"}return oe}function B($){var oe=ae($);switch(oe){case"array":case"object":return"an "+oe;case"boolean":case"date":case"regexp":return"a "+oe;default:return oe}}function Se($){return!$.constructor||!$.constructor.name?p:$.constructor.name}return d.checkPropTypes=i,d.resetWarningCache=i.resetWarningCache,d.PropTypes=d,d},Bf}var Vf,Bg;function K3(){if(Bg)return Vf;Bg=1;var n=Ff();function e(){}function t(){}return t.resetWarningCache=e,Vf=function(){function r(o,a,l,c,h,f){if(f!==n){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function i(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:t,resetWarningCache:e};return s.PropTypes=s,s},Vf}var Vg;function Z3(){if(Vg)return Pc.exports;if(Vg=1,process.env.NODE_ENV!=="production"){var n=qg(),e=!0;Pc.exports=Y3()(n.isElement,e)}else Pc.exports=K3()();return Pc.exports}var J3=Z3();const xe=mi(J3);function Hg(n,e){return Array.isArray(e)?[n.a*e[0]+n.c*e[1]+n.e,n.b*e[0]+n.d*e[1]+n.f]:{x:n.a*e.x+n.c*e.y+n.e,y:n.b*e.x+n.d*e.y+n.f}}function Gg(n,e){return e.map(t=>Hg(n,t))}function ul(n){return{a:parseFloat(n.a),b:parseFloat(n.b),c:parseFloat(n.c),d:parseFloat(n.d),e:parseFloat(n.e),f:parseFloat(n.f)}}function Wg(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function jg(n){const{a:e,b:t,c:r,d:i,e:s,f:o}=n,a=e*i-t*r;return{a:i/a,b:t/-a,c:r/-a,d:e/a,e:(i*s-r*o)/-a,f:(t*s-e*o)/a}}function Hf(n){return typeof n>"u"}function xr(n,e=0){return{a:1,c:0,e:n,b:0,d:1,f:e}}function Gi(...n){n=Array.isArray(n[0])?n[0]:n;const e=(t,r)=>({a:t.a*r.a+t.c*r.b,c:t.a*r.c+t.c*r.d,e:t.a*r.e+t.c*r.f+t.e,b:t.b*r.a+t.d*r.b,d:t.b*r.c+t.d*r.d,f:t.b*r.e+t.d*r.f+t.f});switch(n.length){case 0:throw new Error("no matrices provided");case 1:return n[0];case 2:return e(n[0],n[1]);default:{const[t,r,...i]=n,s=e(t,r);return Gi(s,...i)}}}function Xs(n,e=void 0,t=void 0,r=void 0){Hf(e)&&(e=n);const i={a:n,c:0,e:0,b:0,d:e,f:0};return Hf(t)||Hf(r)?i:Gi([xr(t,r),i,xr(-t,-r)])}function Q3(n){return eS(n)}function eS(n){return`matrix(${n.a},${n.b},${n.c},${n.d},${n.e},${n.f})`}function tS(n,e){function t(){this.constructor=n}t.prototype=e.prototype,n.prototype=new t}function Lc(n,e,t,r){var i=Error.call(this,n);return Object.setPrototypeOf&&Object.setPrototypeOf(i,Lc.prototype),i.expected=e,i.found=t,i.location=r,i.name="SyntaxError",i}tS(Lc,Error);function Gf(n,e,t){return t=t||" ",n.length>e?n:(e-=n.length,t+=t.repeat(e),n+t.slice(0,e))}Lc.prototype.format=function(n){var e="Error: "+this.message;if(this.location){var t=null,r;for(r=0;r<n.length;r++)if(n[r].source===this.location.source){t=n[r].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,s=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(i):i,o=this.location.source+":"+s.line+":"+s.column;if(t){var a=this.location.end,l=Gf("",s.line.toString().length," "),c=t[i.line-1],h=i.line===a.line?a.column:c.length+1,f=h-i.column||1;e+=`
63
+ */var Nf,Dg;function X3(){if(Dg)return Nf;Dg=1;var n=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function r(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function i(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var o={},a=0;a<10;a++)o["_"+String.fromCharCode(a)]=a;var l=Object.getOwnPropertyNames(o).map(function(h){return o[h]});if(l.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(h){c[h]=h}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Nf=i()?Object.assign:function(s,o){for(var a,l=r(s),c,h=1;h<arguments.length;h++){a=Object(arguments[h]);for(var f in a)e.call(a,f)&&(l[f]=a[f]);if(n){c=n(a);for(var p=0;p<c.length;p++)t.call(a,c[p])&&(l[c[p]]=a[c[p]])}}return l},Nf}var Uf,Ng;function Ff(){if(Ng)return Uf;Ng=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Uf=n,Uf}var zf,Ug;function Fg(){return Ug||(Ug=1,zf=Function.call.bind(Object.prototype.hasOwnProperty)),zf}var kf,zg;function $3(){if(zg)return kf;zg=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var e=Ff(),t={},r=Fg();n=function(s){var o="Warning: "+s;typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}}}function i(s,o,a,l,c){if(process.env.NODE_ENV!=="production"){for(var h in s)if(r(s,h)){var f;try{if(typeof s[h]!="function"){var p=Error((l||"React class")+": "+a+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}f=s[h](o,h,l,a,null,e)}catch(m){f=m}if(f&&!(f instanceof Error)&&n((l||"React class")+": type specification of "+a+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in t)){t[f.message]=!0;var d=c?c():"";n("Failed "+a+" type: "+f.message+(d??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(t={})},kf=i,kf}var Bf,kg;function Y3(){if(kg)return Bf;kg=1;var n=qg(),e=X3(),t=Ff(),r=Fg(),i=$3(),s=function(){};process.env.NODE_ENV!=="production"&&(s=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function o(){return null}return Bf=function(a,l){var c=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function f(U){var $=U&&(c&&U[c]||U[h]);if(typeof $=="function")return $}var p="<<anonymous>>",d={array:_("array"),bigint:_("bigint"),bool:_("boolean"),func:_("function"),number:_("number"),object:_("object"),string:_("string"),symbol:_("symbol"),any:b(),arrayOf:M,element:E(),elementType:S(),instanceOf:T,node:L(),objectOf:O,oneOf:q,oneOfType:A,shape:Z,exact:K};function m(U,$){return U===$?U!==0||1/U===1/$:U!==U&&$!==$}function x(U,$){this.message=U,this.data=$&&typeof $=="object"?$:{},this.stack=""}x.prototype=Error.prototype;function v(U){if(process.env.NODE_ENV!=="production")var $={},pe=0;function Se(V,te,W,ue,ye,Q,Le){if(ue=ue||p,Q=Q||W,Le!==t){if(l){var le=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw le.name="Invariant Violation",le}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var z=ue+":"+W;!$[z]&&pe<3&&(s("You are manually calling a React.PropTypes validation function for the `"+Q+"` prop on `"+ue+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),$[z]=!0,pe++)}}return te[W]==null?V?te[W]===null?new x("The "+ye+" `"+Q+"` is marked as required "+("in `"+ue+"`, but its value is `null`.")):new x("The "+ye+" `"+Q+"` is marked as required in "+("`"+ue+"`, but its value is `undefined`.")):null:U(te,W,ue,ye,Q)}var be=Se.bind(null,!1);return be.isRequired=Se.bind(null,!0),be}function _(U){function $(pe,Se,be,V,te,W){var ue=pe[Se],ye=J(ue);if(ye!==U){var Q=oe(ue);return new x("Invalid "+V+" `"+te+"` of type "+("`"+Q+"` supplied to `"+be+"`, expected ")+("`"+U+"`."),{expectedType:U})}return null}return v($)}function b(){return v(o)}function M(U){function $(pe,Se,be,V,te){if(typeof U!="function")return new x("Property `"+te+"` of component `"+be+"` has invalid PropType notation inside arrayOf.");var W=pe[Se];if(!Array.isArray(W)){var ue=J(W);return new x("Invalid "+V+" `"+te+"` of type "+("`"+ue+"` supplied to `"+be+"`, expected an array."))}for(var ye=0;ye<W.length;ye++){var Q=U(W,ye,be,V,te+"["+ye+"]",t);if(Q instanceof Error)return Q}return null}return v($)}function E(){function U($,pe,Se,be,V){var te=$[pe];if(!a(te)){var W=J(te);return new x("Invalid "+be+" `"+V+"` of type "+("`"+W+"` supplied to `"+Se+"`, expected a single ReactElement."))}return null}return v(U)}function S(){function U($,pe,Se,be,V){var te=$[pe];if(!n.isValidElementType(te)){var W=J(te);return new x("Invalid "+be+" `"+V+"` of type "+("`"+W+"` supplied to `"+Se+"`, expected a single ReactElement type."))}return null}return v(U)}function T(U){function $(pe,Se,be,V,te){if(!(pe[Se]instanceof U)){var W=U.name||p,ue=xe(pe[Se]);return new x("Invalid "+V+" `"+te+"` of type "+("`"+ue+"` supplied to `"+be+"`, expected ")+("instance of `"+W+"`."))}return null}return v($)}function q(U){if(!Array.isArray(U))return process.env.NODE_ENV!=="production"&&(arguments.length>1?s("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):s("Invalid argument supplied to oneOf, expected an array.")),o;function $(pe,Se,be,V,te){for(var W=pe[Se],ue=0;ue<U.length;ue++)if(m(W,U[ue]))return null;var ye=JSON.stringify(U,function(Le,le){var z=oe(le);return z==="symbol"?String(le):le});return new x("Invalid "+V+" `"+te+"` of value `"+String(W)+"` "+("supplied to `"+be+"`, expected one of "+ye+"."))}return v($)}function O(U){function $(pe,Se,be,V,te){if(typeof U!="function")return new x("Property `"+te+"` of component `"+be+"` has invalid PropType notation inside objectOf.");var W=pe[Se],ue=J(W);if(ue!=="object")return new x("Invalid "+V+" `"+te+"` of type "+("`"+ue+"` supplied to `"+be+"`, expected an object."));for(var ye in W)if(r(W,ye)){var Q=U(W,ye,be,V,te+"."+ye,t);if(Q instanceof Error)return Q}return null}return v($)}function A(U){if(!Array.isArray(U))return process.env.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var $=0;$<U.length;$++){var pe=U[$];if(typeof pe!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+B(pe)+" at index "+$+"."),o}function Se(be,V,te,W,ue){for(var ye=[],Q=0;Q<U.length;Q++){var Le=U[Q],le=Le(be,V,te,W,ue,t);if(le==null)return null;le.data&&r(le.data,"expectedType")&&ye.push(le.data.expectedType)}var z=ye.length>0?", expected one of type ["+ye.join(", ")+"]":"";return new x("Invalid "+W+" `"+ue+"` supplied to "+("`"+te+"`"+z+"."))}return v(Se)}function L(){function U($,pe,Se,be,V){return ne($[pe])?null:new x("Invalid "+be+" `"+V+"` supplied to "+("`"+Se+"`, expected a ReactNode."))}return v(U)}function N(U,$,pe,Se,be){return new x((U||"React class")+": "+$+" type `"+pe+"."+Se+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+be+"`.")}function Z(U){function $(pe,Se,be,V,te){var W=pe[Se],ue=J(W);if(ue!=="object")return new x("Invalid "+V+" `"+te+"` of type `"+ue+"` "+("supplied to `"+be+"`, expected `object`."));for(var ye in U){var Q=U[ye];if(typeof Q!="function")return N(be,V,te,ye,oe(Q));var Le=Q(W,ye,be,V,te+"."+ye,t);if(Le)return Le}return null}return v($)}function K(U){function $(pe,Se,be,V,te){var W=pe[Se],ue=J(W);if(ue!=="object")return new x("Invalid "+V+" `"+te+"` of type `"+ue+"` "+("supplied to `"+be+"`, expected `object`."));var ye=e({},pe[Se],U);for(var Q in ye){var Le=U[Q];if(r(U,Q)&&typeof Le!="function")return N(be,V,te,Q,oe(Le));if(!Le)return new x("Invalid "+V+" `"+te+"` key `"+Q+"` supplied to `"+be+"`.\nBad object: "+JSON.stringify(pe[Se],null," ")+`
64
+ Valid keys: `+JSON.stringify(Object.keys(U),null," "));var le=Le(W,Q,be,V,te+"."+Q,t);if(le)return le}return null}return v($)}function ne(U){switch(typeof U){case"number":case"string":case"undefined":return!0;case"boolean":return!U;case"object":if(Array.isArray(U))return U.every(ne);if(U===null||a(U))return!0;var $=f(U);if($){var pe=$.call(U),Se;if($!==U.entries){for(;!(Se=pe.next()).done;)if(!ne(Se.value))return!1}else for(;!(Se=pe.next()).done;){var be=Se.value;if(be&&!ne(be[1]))return!1}}else return!1;return!0;default:return!1}}function ce(U,$){return U==="symbol"?!0:$?$["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&$ instanceof Symbol:!1}function J(U){var $=typeof U;return Array.isArray(U)?"array":U instanceof RegExp?"object":ce($,U)?"symbol":$}function oe(U){if(typeof U>"u"||U===null)return""+U;var $=J(U);if($==="object"){if(U instanceof Date)return"date";if(U instanceof RegExp)return"regexp"}return $}function B(U){var $=oe(U);switch($){case"array":case"object":return"an "+$;case"boolean":case"date":case"regexp":return"a "+$;default:return $}}function xe(U){return!U.constructor||!U.constructor.name?p:U.constructor.name}return d.checkPropTypes=i,d.resetWarningCache=i.resetWarningCache,d.PropTypes=d,d},Bf}var Vf,Bg;function K3(){if(Bg)return Vf;Bg=1;var n=Ff();function e(){}function t(){}return t.resetWarningCache=e,Vf=function(){function r(o,a,l,c,h,f){if(f!==n){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function i(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:t,resetWarningCache:e};return s.PropTypes=s,s},Vf}var Vg;function Z3(){if(Vg)return wc.exports;if(Vg=1,process.env.NODE_ENV!=="production"){var n=qg(),e=!0;wc.exports=Y3()(n.isElement,e)}else wc.exports=K3()();return wc.exports}var J3=Z3();const _e=ai(J3);function Hg(n,e){return Array.isArray(e)?[n.a*e[0]+n.c*e[1]+n.e,n.b*e[0]+n.d*e[1]+n.f]:{x:n.a*e.x+n.c*e.y+n.e,y:n.b*e.x+n.d*e.y+n.f}}function Gg(n,e){return e.map(t=>Hg(n,t))}function nl(n){return{a:parseFloat(n.a),b:parseFloat(n.b),c:parseFloat(n.c),d:parseFloat(n.d),e:parseFloat(n.e),f:parseFloat(n.f)}}function Wg(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function jg(n){const{a:e,b:t,c:r,d:i,e:s,f:o}=n,a=e*i-t*r;return{a:i/a,b:t/-a,c:r/-a,d:e/a,e:(i*s-r*o)/-a,f:(t*s-e*o)/a}}function Hf(n){return typeof n>"u"}function hr(n,e=0){return{a:1,c:0,e:n,b:0,d:1,f:e}}function Ni(...n){n=Array.isArray(n[0])?n[0]:n;const e=(t,r)=>({a:t.a*r.a+t.c*r.b,c:t.a*r.c+t.c*r.d,e:t.a*r.e+t.c*r.f+t.e,b:t.b*r.a+t.d*r.b,d:t.b*r.c+t.d*r.d,f:t.b*r.e+t.d*r.f+t.f});switch(n.length){case 0:throw new Error("no matrices provided");case 1:return n[0];case 2:return e(n[0],n[1]);default:{const[t,r,...i]=n,s=e(t,r);return Ni(s,...i)}}}function Fs(n,e=void 0,t=void 0,r=void 0){Hf(e)&&(e=n);const i={a:n,c:0,e:0,b:0,d:e,f:0};return Hf(t)||Hf(r)?i:Ni([hr(t,r),i,hr(-t,-r)])}function Q3(n){return eS(n)}function eS(n){return`matrix(${n.a},${n.b},${n.c},${n.d},${n.e},${n.f})`}function tS(n,e){function t(){this.constructor=n}t.prototype=e.prototype,n.prototype=new t}function Ac(n,e,t,r){var i=Error.call(this,n);return Object.setPrototypeOf&&Object.setPrototypeOf(i,Ac.prototype),i.expected=e,i.found=t,i.location=r,i.name="SyntaxError",i}tS(Ac,Error);function Gf(n,e,t){return t=t||" ",n.length>e?n:(e-=n.length,t+=t.repeat(e),n+t.slice(0,e))}Ac.prototype.format=function(n){var e="Error: "+this.message;if(this.location){var t=null,r;for(r=0;r<n.length;r++)if(n[r].source===this.location.source){t=n[r].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,s=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(i):i,o=this.location.source+":"+s.line+":"+s.column;if(t){var a=this.location.end,l=Gf("",s.line.toString().length," "),c=t[i.line-1],h=i.line===a.line?a.column:c.length+1,f=h-i.column||1;e+=`
73
65
  --> `+o+`
74
66
  `+l+` |
75
67
  `+s.line+" | "+c+`
76
68
  `+l+" | "+Gf("",i.column-1," ")+Gf("",f,"^")}else e+=`
77
- at `+o}return e},Lc.buildMessage=function(n,e){var t={literal:function(c){return'"'+i(c.text)+'"'},class:function(c){var h=c.parts.map(function(f){return Array.isArray(f)?s(f[0])+"-"+s(f[1]):s(f)});return"["+(c.inverted?"^":"")+h.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(c){return c.description}};function r(c){return c.charCodeAt(0).toString(16).toUpperCase()}function i(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(h){return"\\x0"+r(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+r(h)})}function s(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(h){return"\\x0"+r(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+r(h)})}function o(c){return t[c.type](c)}function a(c){var h=c.map(o),f,p;if(h.sort(),h.length>0){for(f=1,p=1;f<h.length;f++)h[f-1]!==h[f]&&(h[p]=h[f],p++);h.length=p}switch(h.length){case 1:return h[0];case 2:return h[0]+" or "+h[1];default:return h.slice(0,-1).join(", ")+", or "+h[h.length-1]}}function l(c){return c?'"'+i(c)+'"':"end of input"}return"Expected "+a(n)+" but "+l(e)+" found."};const yr="idle",Jr="panning",Qr="zooming",Ur="auto",Mi="none",Fr="pan",ei="zoom-in",wi="zoom-out",Oc="none",Ti="top",Sr="right",Ai="bottom",Qn="left",qc="zoom",hl="pan",Uo="center",Fo="left",Wf="right",zo="top",jf="bottom",Xg="cover";function $g(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Dc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$g(Object(t),!0).forEach(function(r){nS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):$g(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function nS(n,e,t){return(e=rS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rS(n){var e=iS(n,"string");return typeof e=="symbol"?e:e+""}function iS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}const Yg=3,Kg=yr;function Zg(n,e,t,r,i,s){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,a=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null;return Qt({},Dc(Dc({},Wg()),{},{version:Yg,mode:Kg,focus:!1,pinchPointDistance:null,prePinchMode:null,viewerWidth:n,viewerHeight:e,SVGMinX:t,SVGMinY:r,SVGWidth:i,SVGHeight:s,scaleFactorMin:o,scaleFactorMax:a,startX:null,startY:null,endX:null,endY:null,miniatureOpen:!0,lastAction:null}))}function Qt(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;return n=Object.assign({},n,e,{lastAction:t}),Object.freeze(n)}function sS(n){return n!==null&&typeof n=="object"&&n.hasOwnProperty("version")&&n.version===Yg}function zr(n,e,t){let r=ul(n),i=jg(r);return Hg(i,{x:e,y:t})}function Nc(n){let e=ul(n);return{scaleFactor:e.a,translationX:e.e,translationY:e.f}}function oS(n,e){return Qt(n,{focus:e})}function aS(n,e,t){return Qt(n,{viewerWidth:e,viewerHeight:t})}function Jg(n,e,t,r,i){return Qt(n,{SVGMinX:e,SVGMinY:t,SVGWidth:r,SVGHeight:i})}function lS(n,e,t){return Qt(n,{scaleFactorMin:e,scaleFactorMax:t})}function cS(n,e,t,r){let{viewerWidth:i,viewerHeight:s}=n,o=Gi(xr(-e+i/2,-t+s/2),xr(e,t),Xs(r,r),xr(-e,-t));return Qt(n,Dc({mode:yr},o))}function uS(n){return Qt(n,Dc({mode:yr},Wg()))}function Qg(n){return Qt(n,{mode:Kg,startX:null,startY:null,endX:null,endY:null})}class e1{constructor(e,t,r){this.originalEvent=e,this.value=t,this.SVGViewer=r}get scaleFactor(){return this._cacheDecomposedValue=this._cacheDecomposedValue||Nc(this.value),this._cacheDecomposedValue.scaleFactor}get translationX(){return this._cacheDecomposedValue=this._cacheDecomposedValue||Nc(this.value),this._cacheDecomposedValue.translationX}get translationY(){return this._cacheDecomposedValue=this._cacheDecomposedValue||Nc(this.value),this._cacheDecomposedValue.translationY}preventDefault(){this.originalEvent.preventDefault()}stopPropagation(){this.originalEvent.stopPropagation()}}function t1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function hS(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?t1(Object(t),!0).forEach(function(r){fS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):t1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function fS(n,e,t){return(e=dS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dS(n){var e=pS(n,"string");return typeof e=="symbol"?e:e+""}function pS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Xf(n,e,t){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:void 0,i=Gi(ul(n),xr(e,t));if(r){let[{x:s,y:o},{x:a,y:l}]=Gg(i,[{x:n.SVGMinX+r,y:n.SVGMinY+r},{x:n.SVGMinX+n.SVGWidth-r,y:n.SVGMinY+n.SVGHeight-r}]),c=0;n.viewerWidth-s<0?c=n.viewerWidth-s:a<0&&(c=-a);let h=0;n.viewerHeight-o<0?h=n.viewerHeight-o:l<0&&(h=-l),i=Gi(xr(c,h),i)}return Qt(n,hS({mode:yr},i),hl)}function mS(n,e,t){return Qt(n,{mode:Jr,startX:e,startY:t,endX:e,endY:t},hl)}function gS(n,e,t,r){if(n.mode!==Jr)throw new Error("update pan not allowed in this mode "+n.mode);let{endX:i,endY:s}=n,o=zr(n,i,s),a=zr(n,e,t),l=a.x-o.x,c=a.y-o.y,h=Xf(n,l,c,r);return Qt(h,{mode:Jr,endX:e,endY:t},hl)}function n1(n){return Qt(n,{mode:yr,startX:null,startY:null,endX:null,endY:null},hl)}function _S(n,e,t){let r=0,i=0;return t<=20&&(i=2),n.viewerWidth-e<=20&&(r=-2),n.viewerHeight-t<=20&&(i=-2),e<=20&&(r=2),r=r/n.d,i=i/n.d,r===0&&i===0?n:Xf(n,r,i)}function r1(n,e){if(n.x<=e.x&&n.y<=e.y)return{x:n.x,y:n.y,width:e.x-n.x,height:e.y-n.y};if(n.x>=e.x&&n.y<=e.y)return{x:e.x,y:n.y,width:n.x-e.x,height:e.y-n.y};if(n.x>=e.x&&n.y>=e.y)return{x:e.x,y:e.y,width:n.x-e.x,height:n.y-e.y};if(n.x<=e.x&&n.y>=e.y)return{x:n.x,y:e.y,width:e.x-n.x,height:n.y-e.y}}function i1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ko(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?i1(Object(t),!0).forEach(function(r){vS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):i1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function vS(n,e,t){return(e=xS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xS(n){var e=yS(n,"string");return typeof e=="symbol"?e:e+""}function yS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Uc(n,e){const{scaleFactor:t}=Nc(n),r=n.scaleFactorMin&&t*e<n.scaleFactorMin,i=n.scaleFactorMax&&t*e>n.scaleFactorMax;return r&&e<1||i&&e>1}function $f(n,e){let t=e.a;return n.scaleFactorMin!=null&&(t=Math.max(t,n.scaleFactorMin)),n.scaleFactorMax!=null&&(t=Math.min(t,n.scaleFactorMax)),Qt(e,{a:t,d:t})}function Bo(n,e,t,r){if(Uc(n,r))return n;const i=Gi(ul(n),xr(e,t),Xs(r,r),xr(-e,-t));return Qt(n,ko(ko({mode:yr},i),{},{startX:null,startY:null,endX:null,endY:null}),qc)}function s1(n,e,t,r,i){let{viewerWidth:s,viewerHeight:o}=n,a=s/r,l=o/i,c=Math.min(a,l);const h=Gi(Xs(c,c),xr(-e,-t));return Uc(n,c/n.d)?Qt(n,{mode:yr,startX:null,startY:null,endX:null,endY:null}):Qt(n,ko(ko({mode:yr},$f(n,h)),{},{startX:null,startY:null,endX:null,endY:null}),qc)}function o1(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Fo,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:zo,{viewerWidth:r,viewerHeight:i,SVGMinX:s,SVGMinY:o,SVGWidth:a,SVGHeight:l}=n,c=r/a,h=i/l,f=Math.min(c,h),p=Xs(f,f),d=-s*c,m=-o*h;if(c<h){let _=i-c*l;switch(t){case zo:m=-o*f;break;case Uo:m=Math.round(_/2)-o*f;break;case jf:m=_-o*f;break;case Xg:p=Xs(h,h);let E=r-h*a;d=s+Math.round(E/2);break}}else{let _=r-h*a;switch(e){case Fo:d=-s*f;break;case Uo:d=Math.round(_/2)-s*f;break;case Wf:d=_-s*f;break;case Xg:p=Xs(c,c);let E=i-c*l;m=o+Math.round(E/2);break}}const x=xr(d,m),v=Gi(x,p);return Uc(n,f/n.d)?Qt(n,{mode:yr,startX:null,startY:null,endX:null,endY:null}):Qt(n,ko(ko({mode:yr},$f(n,v)),{},{startX:null,startY:null,endX:null,endY:null}),qc)}function SS(n,e){let{viewerWidth:t,viewerHeight:r}=n,i=zr(n,t/2,r/2);return Bo(n,i.x,i.y,e)}function ES(n,e,t){return Qt(n,{mode:Qr,startX:e,startY:t,endX:e,endY:t})}function bS(n,e,t){if(n.mode!==Qr)throw new Error("update selection not allowed in this mode "+n.mode);return Qt(n,{endX:e,endY:t})}function Yf(n,e,t,r){let{startX:s,startY:o}=n,a=zr(n,s,o),l=zr(n,e,t);if(Math.abs(s-e)>7&&Math.abs(o-t)>7){let c=r1(a,l);return s1(n,c.x,c.y,c.width,c.height)}else{let c=zr(n,e,t);return Bo(n,c.x,c.y,r)}}function MS(n,e,t,r,i){return r+(i-r)*(n-e)/(t-e)}function Vo(n,e){let{left:t,top:r}=e.getBoundingClientRect(),i=n.clientX-Math.round(t),s=n.clientY-Math.round(r);return{x:i,y:s}}function a1(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||Vo(n,e);let l=r;switch(t){case wi:let c=zr(r,o,a);l=Bo(r,c.x,c.y,1/i.scaleFactor);break;case ei:l=ES(r,o,a);break;case Ur:case Fr:l=mS(r,o,a);break;default:return r}return n.preventDefault(),l}function l1(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||Vo(n,e);let l=n.buttons===0,c=r;switch(t){case ei:r.mode===Qr&&(c=l?Yf(r,o,a,i.scaleFactor):bS(r,o,a));break;case Ur:case Fr:r.mode===Jr&&(c=l?n1(r):gS(r,o,a,i.preventPanOutside?20:void 0));break;default:return r}return n.preventDefault(),c}function c1(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||Vo(n,e);let l=r;switch(t){case wi:r.mode===Qr&&(l=Yf(r,o,a,1/i.scaleFactor));break;case ei:r.mode===Qr&&(l=Yf(r,o,a,i.scaleFactor));break;case Ur:case Fr:r.mode===Jr&&(l=n1(r));break;default:return r}return n.preventDefault(),l}function wS(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||Vo(n,e);let l=r;if(t===Ur&&!i.disableDoubleClickZoomWithToolAuto){const{modifierKeys:c=[]}=i;let h=zr(r,o,a),f=(m,x)=>m||n.getModifierState(x),d=c.reduce(f,!1)?1/i.scaleFactor:i.scaleFactor;l=Bo(r,h.x,h.y,d)}return n.preventDefault(),l}function TS(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||Vo(n,e);if(!i.detectWheel)return r;let l=Math.max(-1,Math.min(1,n.deltaY)),c=MS(l,-1,1,i.scaleFactorOnWheel,1/i.scaleFactorOnWheel),h=zr(r,o,a),f=Bo(r,h.x,h.y,c);return n.preventDefault(),f}function u1(n,e,t,r,i){let s=oS(r,n.type==="mouseenter");return n.preventDefault(),s}function AS(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,{x:o,y:a}=s;return!([Mi,Ur].indexOf(t)>=0)||!i.detectAutoPan||!r.focus?r:_S(r,o,a)}class CS extends e1{get point(){if(!this._cachePoint){const{originalEvent:e,SVGViewer:t,value:r}=this,i=Vo(e,t);this._cachePoint=zr(r,i.x,i.y)}return this._cachePoint}get x(){return this.point.x}get y(){return this.point.y}}function h1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function f1(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?h1(Object(t),!0).forEach(function(r){RS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):h1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function RS(n,e,t){return(e=PS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function PS(n){var e=IS(n,"string");return typeof e=="symbol"?e:e+""}function IS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Fc extends e1{get points(){return this._cachePoints||(this._cachePoints=Fc.touchesToPoints(this.originalEvent.touches,this.SVGViewer,this.value)),this._cachePoints}get changedPoints(){return this._cacheChangedPoints||(this._cacheChangedPoints=Fc.touchesToPoints(this.originalEvent.changedTouches,this.SVGViewer,this.value)),this._cacheChangedPoints}static touchesToPoints(e,t,r){let i=[];for(let s=0;s<e.length;s++){let o=e[s],a=t.getBoundingClientRect(),l=o.clientX-Math.round(a.left),c=o.clientY-Math.round(a.top),h=zr(r,l,c);i.push(f1(f1({},h),{},{identifier:o.identifier}))}return i}}function LS(n,e,t){let r=n.type;switch(r){case"mousemove":case"mouseup":case"mousedown":case"click":case"dblclick":return new CS(n,e,t);case"touchstart":case"touchmove":case"touchend":case"touchcancel":return new Fc(n,e,t);default:throw new Error(`${r} not supported`)}}function d1(n){return n.split(/[ ,]/).filter(Boolean).map(Number)}function p1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function m1(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?p1(Object(t),!0).forEach(function(r){OS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):p1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function OS(n,e,t){return(e=qS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qS(n){var e=DS(n,"string");return typeof e=="symbol"?e:e+""}function DS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function NS(n,e){let{left:t,top:r}=e.getBoundingClientRect(),i=n.clientX-Math.round(t),s=n.clientY-Math.round(r);return{x:i,y:s}}function US(n,e,t,r,i){if(_1(n,i))return v1(n,e,t,r);if(n.touches.length!==1){if([Jr,Qr].indexOf(r.mode)>=0)return Qg(r);if([yr].indexOf(r.mode)>=0)return r}return Kf(n,e,t,r,i,a1)}function FS(n,e,t,r,i){return _1(n,i)?v1(n,e,t,r):[Jr,Qr].indexOf(r.mode)>=0?Kf(n,e,t,r,i,l1):r}function zS(n,e,t,r,i){if(!([Jr,Qr].indexOf(r.mode)>=0))return r;let s=BS(n,r,i)?Qt(r,{pinchPointDistance:null}):r;return n.touches.length>0?s:Kf(n,e,t,s,i,c1)}function kS(n,e,t,r,i){return n.stopPropagation(),n.preventDefault(),Qg(r)}function g1(n){return typeof n.pinchPointDistance=="number"}function BS(n,e,t){return t.detectPinchGesture&&g1(e)&&n.touches.length<2}function _1(n,e){return e.detectPinchGesture&&n.touches.length>1}function Kf(n,e,t,r,i,s){let o=n.touches.length===0?Qt(r,{mode:r.prePinchMode?yr:r.mode,prePinchMode:null}):r,a=n.touches.length>0?n.touches[0]:n.changedTouches[0],l=NS(a,e);switch(t){case wi:case ei:case Ur:case Fr:return n.stopPropagation(),n.preventDefault(),s(n,e,t,o,i,l);default:return o}}function v1(n,e,t,r,i){const{left:s,top:o}=e.getBoundingClientRect(),a=n.touches[0].clientX-Math.round(s),l=n.touches[0].clientY-Math.round(o),c=n.touches[1].clientX-Math.round(s),h=n.touches[1].clientY-Math.round(o),f=Math.sqrt(Math.pow(c-a,2)+Math.pow(h-l,2)),p=g1(r)?r.pinchPointDistance:f,d=zr(r,(a+c)/2,(l+h)/2);let m=f/p;if(Uc(r,m))return r;n.cancelable&&n.preventDefault();let x=Gi(ul(r),xr(d.x,d.y),Xs(m,m),xr(-d.x,-d.y));return Qt(r,Qt(m1(m1({mode:Qr},$f(r,x)),{},{startX:null,startY:null,endX:null,endY:null,prePinchMode:r.prePinchMode?r.prePinchMode:r.mode,pinchPointDistance:f})))}function x1(n){return Qt(n,{miniatureOpen:!0})}function y1(n){return Qt(n,{miniatureOpen:!1})}let VS=n=>["zoom-in","zoom-out","grab","grabbing"].indexOf(n)>-1,S1=()=>navigator.userAgent.toLowerCase(),HS=()=>S1().indexOf("firefox")>-1,GS=()=>S1().indexOf("webkit")>-1;function zc(n){if(!VS(n))return n;if(HS())return`-moz-${n}`;if(GS())return`-webkit-${n}`}function WS(n){return n.displayName||n.name||"Component"}function Zf(){return Zf=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Zf.apply(null,arguments)}let jS=1;const XS=()=>`uid${jS++}`;function E1(n){class e extends se.Component{constructor(r){super(r),this.state={uid:XS()}}render(){return se.createElement(n,Zf({_uid:this.state.uid},this.props))}}return e.displayName=`RandomUID(${WS(n)})`,e}const b1="react-svg-pan-zoom_border_gradient";function M1(n){let{direction:e,width:t,height:r,_uid:i}=n,s;switch(e){case Ti:s=`translate(${t}, 0) rotate(90)`;break;case Sr:s=`translate(${t}, ${r}) rotate(180)`;break;case Ai:s=`translate(0, ${r}) rotate(270)`;break;case Qn:default:s=" ";break}let o=`${b1}_gradient_${i}`,a=`${b1}_mask_${i}`;return se.createElement("g",null,se.createElement("defs",null,se.createElement("linearGradient",{id:o,x1:"0%",y1:"0%",x2:"100%",y2:"0%",spreadMethod:"pad"},se.createElement("stop",{offset:"0%",stopColor:"#fff",stopOpacity:"0.8"}),se.createElement("stop",{offset:"100%",stopColor:"#000",stopOpacity:"0.5"})),se.createElement("mask",{id:a,x:"0",y:"0",width:"20",height:Math.max(t,r)},se.createElement("rect",{x:"0",y:"0",width:"20",height:Math.max(t,r),style:{stroke:"none",fill:`url(#${o})`}}))),se.createElement("rect",{x:"0",y:"0",width:"20",height:Math.max(t,r),style:{stroke:"none",fill:"#000",mask:`url(#${a})`},transform:s}))}M1.propTypes={direction:xe.oneOf([Ti,Sr,Ai,Qn]).isRequired,width:xe.number.isRequired,height:xe.number.isRequired};const kc=E1(M1);function w1(n){let{startX:e,startY:t,endX:r,endY:i}=n;if(!e||!t||!r||!i)return null;let s=r1({x:e,y:t},{x:r,y:i});return se.createElement("rect",{stroke:"#969FFF",strokeOpacity:.7,fill:"#F3F4FF",fillOpacity:.7,x:s.x,y:s.y,width:s.width,height:s.height,style:{pointerEvents:"none"}})}w1.propTypes={startX:xe.number,startY:xe.number,endX:xe.number,endY:xe.number};function $S(){return se.createElement("svg",{width:24,height:24,stroke:"currentColor"},se.createElement("path",{d:"M10.07,14.27C10.57,14.03 11.16,14.25 11.4,14.75L13.7,19.74L15.5,18.89L13.19,13.91C12.95,13.41 13.17,12.81 13.67,12.58L13.95,12.5L16.25,12.05L8,5.12V15.9L9.82,14.43L10.07,14.27M13.64,21.97C13.14,22.21 12.54,22 12.31,21.5L10.13,16.76L7.62,18.78C7.45,18.92 7.24,19 7,19A1,1 0 0,1 6,18V3A1,1 0 0,1 7,2C7.24,2 7.47,2.09 7.64,2.23L7.65,2.22L19.14,11.86C19.57,12.22 19.62,12.85 19.27,13.27C19.12,13.45 18.91,13.57 18.7,13.61L15.54,14.23L17.74,18.96C18,19.46 17.76,20.05 17.26,20.28L13.64,21.97Z"}))}function YS(){return se.createElement("svg",{width:24,height:24,stroke:"currentColor"},se.createElement("path",{d:"M13,6V11H18V7.75L22.25,12L18,16.25V13H13V18H16.25L12,22.25L7.75,18H11V13H6V16.25L1.75,12L6,7.75V11H11V6H7.75L12,1.75L16.25,6H13Z"}))}function KS(){return se.createElement("svg",{width:24,height:24,stroke:"currentColor"},se.createElement("g",null,se.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),se.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})))}function ZS(){return se.createElement("svg",{width:24,height:24,stroke:"currentColor"},se.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"}))}function JS(){return se.createElement("svg",{width:24,height:24,stroke:"currentColor"},se.createElement("path",{d:"M15 3l2.3 2.3-2.89 2.87 1.42 1.42L18.7 6.7 21 9V3zM3 9l2.3-2.3 2.87 2.89 1.42-1.42L6.7 5.3 9 3H3zm6 12l-2.3-2.3 2.89-2.87-1.42-1.42L5.3 17.3 3 15v6zm12-6l-2.3 2.3-2.87-2.89-1.42 1.42 2.89 2.87L15 21h6z"}))}let Ho=class extends se.Component{constructor(e){super(e),this.state={hover:!1}}change(e){switch(e.preventDefault(),e.stopPropagation(),e.type){case"mouseenter":case"touchstart":this.setState({hover:!0});break;case"mouseleave":case"touchend":case"touchcancel":this.setState({hover:!1});break}}render(){let e={display:"block",width:"24px",height:"24px",margin:[Ti,Ai].indexOf(this.props.toolbarPosition)>=0?"2px 1px":"1px 2px",color:this.props.active||this.state.hover?this.props.activeColor:"#FFF",transition:"color 200ms ease",background:"none",padding:"0px",border:"0px",outline:"0px",cursor:"pointer"};return se.createElement("button",{onMouseEnter:t=>this.change(t),onMouseLeave:t=>this.change(t),onTouchStart:t=>{this.change(t),this.props.onClick(t)},onTouchEnd:t=>this.change(t),onTouchCancel:t=>this.change(t),onClick:this.props.onClick,style:e,title:this.props.title,name:this.props.name,type:"button"},this.props.children)}};Ho.propTypes={title:xe.string.isRequired,name:xe.string.isRequired,toolbarPosition:xe.string.isRequired,activeColor:xe.string.isRequired,onClick:xe.func.isRequired,active:xe.bool.isRequired};const QS="#1CA6FC";function T1(n){let{tool:e,value:t,onChangeValue:r,onChangeTool:i,activeToolColor:s=QS,position:o=Sr,SVGAlignX:a=Fo,SVGAlignY:l=zo}=n,c=(d,m)=>{i(m),d.stopPropagation(),d.preventDefault()},h=d=>{r(o1(t,a,l)),d.stopPropagation(),d.preventDefault()},f=[Ti,Ai].indexOf(o)>=0,p={position:"absolute",transform:[Ti,Ai].indexOf(o)>=0?"translate(-50%, 0px)":"none",top:[Qn,Sr,Ti].indexOf(o)>=0?"5px":"unset",left:[Ti,Ai].indexOf(o)>=0?"50%":Qn===o?"5px":"unset",right:[Sr].indexOf(o)>=0?"5px":"unset",bottom:[Ai].indexOf(o)>=0?"5px":"unset",backgroundColor:"rgba(19, 20, 22, 0.90)",borderRadius:"2px",display:"flex",flexDirection:f?"row":"column",padding:f?"1px 2px":"2px 1px"};return se.createElement("div",{style:p,role:"toolbar"},se.createElement(Ho,{toolbarPosition:o,active:e===Mi,activeColor:s,name:"unselect-tools",title:"Selection",onClick:d=>c(d,Mi)},se.createElement($S,null)),se.createElement(Ho,{toolbarPosition:o,active:e===Fr,activeColor:s,name:"select-tool-pan",title:"Pan",onClick:d=>c(d,Fr)},se.createElement(YS,null)),se.createElement(Ho,{toolbarPosition:o,active:e===ei,activeColor:s,name:"select-tool-zoom-in",title:"Zoom in",onClick:d=>c(d,ei)},se.createElement(KS,null)),se.createElement(Ho,{toolbarPosition:o,active:e===wi,activeColor:s,name:"select-tool-zoom-out",title:"Zoom out",onClick:d=>c(d,wi)},se.createElement(ZS,null)),se.createElement(Ho,{toolbarPosition:o,active:!1,activeColor:s,name:"fit-to-viewer",title:"Fit to viewer",onClick:d=>h(d)},se.createElement(JS,null)))}T1.propTypes={tool:xe.string.isRequired,onChangeTool:xe.func.isRequired,value:xe.object.isRequired,onChangeValue:xe.func.isRequired,position:xe.oneOf([Ti,Sr,Ai,Qn]),SVGAlignX:xe.oneOf([Uo,Fo,Wf]),SVGAlignY:xe.oneOf([Uo,zo,jf]),activeToolColor:xe.string};function eE(){return"ontouchstart"in window||navigator.maxTouchPoints}function A1(n){let{open:e,position:t}=n,r=0;switch(t){case Qn:r=e?"rotate(225, 12, 13)":"rotate(45, 12, 13)";break;case Sr:r=r=e?"rotate(135, 12, 13)":"rotate(-45, 12, 13)";break}return se.createElement("svg",{width:24,height:24,stroke:"currentColor"},se.createElement("g",{transform:r},se.createElement("path",{fill:"#000000",d:"M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z"})))}A1.propTypes={open:xe.bool.isRequired,position:xe.oneOf([Sr,Qn]).isRequired};function C1(n){let{value:e,onChangeValue:t,position:r}=n,i={width:"24px",height:"24px",display:"block",position:"absolute",bottom:0,[r===Qn?"left":"right"]:"0px",background:"rgba(19, 20, 22, 0.901961)",border:0,padding:0,outline:0,color:"#fff"},s=e.miniatureOpen?y1:x1;return se.createElement("button",{type:"button",style:i,onClick:()=>t(s(e))},se.createElement(A1,{open:e.miniatureOpen,position:r}))}C1.propTypes={value:xe.object.isRequired,onChangeValue:xe.func.isRequired,position:xe.oneOf([Sr,Qn]).isRequired};const tE="react-svg-pan-zoom_miniature";function R1(n){let{SVGMinX:e,SVGMinY:t,SVGWidth:r,SVGHeight:i,x1:s,y1:o,x2:a,y2:l,zoomToFit:c,_uid:h}=n;const f=`${tE}_mask_${h}`;return se.createElement("g",null,se.createElement("defs",null,se.createElement("mask",{id:f},se.createElement("rect",{x:e,y:t,width:r,height:i,fill:"#ffffff"}),se.createElement("rect",{x:s,y:o,width:a-s,height:l-o}))),se.createElement("rect",{x:e,y:t,width:r,height:i,style:{stroke:"none",fill:"#000",mask:`url(#${f})`,opacity:.4}}))}R1.propTypes={SVGWidth:xe.number.isRequired,SVGHeight:xe.number.isRequired,SVGMinX:xe.number.isRequired,SVGMinY:xe.number.isRequired,x1:xe.number.isRequired,y1:xe.number.isRequired,x2:xe.number.isRequired,y2:xe.number.isRequired,zoomToFit:xe.number.isRequired};const nE=E1(R1),rE="#616264";function P1(n){let{value:e,onChangeValue:t,children:r,SVGBackground:i,background:s=rE,position:o=Qn,width:a=100,height:l=80}=n,{SVGMinX:c,SVGMinY:h,SVGWidth:f,SVGHeight:p,viewerWidth:d,viewerHeight:m}=e,x=p/f,v=x>=1?l/p:a/f,[{x:_,y:E},{x:M,y:b}]=Gg(jg(e),[{x:0,y:0},{x:d,y:m}]),S,T;e.miniatureOpen?(S=a,T=l):(S=24,T=24);let q={position:"absolute",overflow:"hidden",outline:"1px solid rgba(19, 20, 22, 0.90)",transition:"width 200ms ease, height 200ms ease, bottom 200ms ease",width:S+"px",height:T+"px",bottom:"6px",[o===Qn?"left":"right"]:"6px",background:s},O=x>=1?`translate(${(a-f*v)/2-c*v}, ${-h*v})`:`translate(${-c*v}, ${(l-p*v)/2-h*v})`;return se.createElement("div",{role:"navigation",style:q},se.createElement("svg",{width:a,height:l,style:{pointerEvents:"none"}},se.createElement("g",{transform:O},se.createElement("g",{transform:`scale(${v}, ${v})`},se.createElement("rect",{fill:i,x:c,y:h,width:f,height:p}),r,se.createElement(nE,{SVGWidth:f,SVGHeight:p,SVGMinX:c,SVGMinY:h,x1:_,y1:E,x2:M,y2:b,zoomToFit:v})))),se.createElement(C1,{value:e,onChangeValue:t,position:o}))}P1.propTypes={value:xe.object.isRequired,onChangeValue:xe.func.isRequired,SVGBackground:xe.string.isRequired,position:xe.oneOf([Sr,Qn]),background:xe.string,width:xe.number,height:xe.number};function $s(n){return typeof n>"u"||n===null}const Jf="https://github.com/chrvadala/react-svg-pan-zoom/blob/main"+"/docs/migrate-from-v2-to-v3.md";function iE(){console.error(`HEY! With ReactSVGPanZoom >= 3 you MUST specify value and tool props. Please read here ${Jf}`)}function sE(){console.error(`HEY! With ReactSVGPanZoom >= 3 the props miniaturePosition, miniatureBackground, miniatureWidth, miniatureHeight can be specified as key in the miniatureProps object. Please read here ${Jf}`)}function oE(){console.error(`HEY! With ReactSVGPanZoom >= 3 the prop toolbarPosition can be specified as key in the toolbarProps object. Please read here ${Jf}`)}function I1(n){($s(n.tool)||$s(n.value))&&iE(),(!$s(n.miniaturePosition)||!$s(n.miniatureBackground)||!$s(n.miniatureWidth)||!$s(n.miniatureHeight))&&sE(),$s(n.toolbarPosition)||oE()}function Bc(){return Bc=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Bc.apply(null,arguments)}function L1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function aE(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?L1(Object(t),!0).forEach(function(r){lE(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):L1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function lE(n,e,t){return(e=cE(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cE(n){var e=uE(n,"string");return typeof e=="symbol"?e:e+""}function uE(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Vc extends se.Component{constructor(e,t){const{width:r,height:i,scaleFactorMin:s,scaleFactorMax:o,children:a}=e,{viewBox:l}=a.props;let c;if(l){const[h,f,p,d]=d1(l);c=Zg(r,i,h,f,p,d,s,o)}else{const{width:h,height:f}=a.props;c=Zg(r,i,0,0,h,f,s,o)}super(e,t),this.ViewerDOM=null,this.state={pointerX:null,pointerY:null,defaultValue:c},this.autoPanLoop=this.autoPanLoop.bind(this),this.onWheel=this.onWheel.bind(this),process.env.NODE_ENV!=="production"&&I1(e)}componentDidUpdate(e){const t=this.getValue(),r=this.props;let i=t,s=!1;process.env.NODE_ENV!=="production"&&I1(r);const{viewBox:o}=r.children.props;if(o){const[a,l,c,h]=d1(o);(t.SVGMinX!==a||t.SVGMinY!==l||t.SVGWidth!==c||t.SVGHeight!==h)&&(i=Jg(i,a,l,c,h),s=!0)}else{const{width:a,height:l}=r.children.props;(t.SVGWidth!==a||t.SVGHeight!==l)&&(i=Jg(i,0,0,a,l),s=!0)}(e.width!==r.width||e.height!==r.height)&&(i=aS(i,r.width,r.height),s=!0),(e.scaleFactorMin!==r.scaleFactorMin||e.scaleFactorMax!==r.scaleFactorMax)&&(i=lS(i,r.scaleFactorMin,r.scaleFactorMax),s=!0),s&&this.setValue(i)}componentDidMount(){this.autoPanIsRunning=!0,requestAnimationFrame(this.autoPanLoop),this.ViewerDOM.addEventListener("wheel",this.onWheel,!1)}componentWillUnmount(){this.autoPanIsRunning=!1,this.ViewerDOM.removeEventListener("wheel",this.onWheel)}getValue(){return sS(this.props.value)?this.props.value:this.state.defaultValue}getTool(){return this.props.tool?this.props.tool:Mi}setValue(e){let{onChangeValue:t,onZoom:r,onPan:i}=this.props;t&&t(e),e.lastAction&&(r&&e.lastAction===qc&&r(e),i&&e.lastAction===hl&&i(e))}pan(e,t){let r=Xf(this.getValue(),e,t);this.setValue(r)}zoom(e,t,r){let i=Bo(this.getValue(),e,t,r);this.setValue(i)}fitSelection(e,t,r,i){let s=s1(this.getValue(),e,t,r,i);this.setValue(s)}fitToViewer(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fo,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zo,r=o1(this.getValue(),e,t);this.setValue(r)}zoomOnViewerCenter(e){let t=SS(this.getValue(),e);this.setValue(t)}setPointOnViewerCenter(e,t,r){let i=cS(this.getValue(),e,t,r);this.setValue(i)}reset(){let e=uS(this.getValue());this.setValue(e)}openMiniature(){let e=x1(this.getValue());this.setValue(e)}closeMiniature(){let e=y1(this.getValue());this.setValue(e)}handleViewerEvent(e){let{props:t,ViewerDOM:r}=this;if(!([Mi,Ur].indexOf(this.getTool())>=0)||e.target===r)return;let s={click:t.onClick,dblclick:t.onDoubleClick,mousemove:t.onMouseMove,mouseup:t.onMouseUp,mousedown:t.onMouseDown,touchstart:t.onTouchStart,touchmove:t.onTouchMove,touchend:t.onTouchEnd,touchcancel:t.onTouchCancel}[e.type];s&&s(LS(e,t.value,r))}autoPanLoop(){let e={x:this.state.pointerX,y:this.state.pointerY},t=AS(null,this.ViewerDOM,this.getTool(),this.getValue(),this.props,e);this.getValue()!==t&&this.setValue(t),this.autoPanIsRunning&&requestAnimationFrame(this.autoPanLoop)}onWheel(e){let t=TS(e,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==t&&this.setValue(t)}render(){let{props:e,state:{pointerX:t,pointerY:r}}=this,i=this.getTool(),s=this.getValue(),{customToolbar:o=T1,customMiniature:a=P1}=e,l=i===Ur&&s.mode===Jr&&s.startX!==s.endX&&s.startY!==s.endY,c;i===Fr&&(c=zc(s.mode===Jr?"grabbing":"grab")),i===ei&&(c=zc("zoom-in")),i===wi&&(c=zc("zoom-out")),l&&(c=zc("grabbing"));let h=[Fr,ei,wi].indexOf(i)>=0;h=h||l;const f=this.props.detectPinchGesture||[Fr,Ur].indexOf(this.getTool())!==-1?"none":void 0,p={display:"block",cursor:c,touchAction:f};return se.createElement("div",{style:aE({position:"relative",width:s.viewerWidth,height:s.viewerHeight},e.style),className:this.props.className},se.createElement("svg",{ref:d=>this.ViewerDOM=d,width:s.viewerWidth,height:s.viewerHeight,style:p,onMouseDown:d=>{let m=a1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onMouseMove:d=>{let{left:m,top:x}=this.ViewerDOM.getBoundingClientRect(),v=d.clientX-Math.round(m),_=d.clientY-Math.round(x),E=l1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props,{x:v,y:_});this.getValue()!==E&&this.setValue(E),this.setState({pointerX:v,pointerY:_}),this.handleViewerEvent(d)},onMouseUp:d=>{let m=c1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onClick:d=>{this.handleViewerEvent(d)},onDoubleClick:d=>{let m=wS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onMouseEnter:d=>{if(eE())return;let m=u1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m)},onMouseLeave:d=>{let m=u1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m)},onTouchStart:d=>{let m=US(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onTouchMove:d=>{let m=FS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onTouchEnd:d=>{let m=zS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onTouchCancel:d=>{let m=kS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)}},se.createElement("rect",{fill:e.background,x:0,y:0,width:s.viewerWidth,height:s.viewerHeight,style:{pointerEvents:"none"}}),se.createElement("g",{transform:Q3(s),style:h?{pointerEvents:"none"}:{}},se.createElement("rect",{fill:this.props.SVGBackground,style:this.props.SVGStyle,x:s.SVGMinX||0,y:s.SVGMinY||0,width:s.SVGWidth,height:s.SVGHeight}),se.createElement("g",null,e.children.props.children)),[Mi,Ur].indexOf(i)>=0&&e.detectAutoPan&&s.focus?se.createElement("g",{style:{pointerEvents:"none"}},r<=20?se.createElement(kc,{direction:Ti,width:s.viewerWidth,height:s.viewerHeight}):null,s.viewerWidth-t<=20?se.createElement(kc,{direction:Sr,width:s.viewerWidth,height:s.viewerHeight}):null,s.viewerHeight-r<=20?se.createElement(kc,{direction:Ai,width:s.viewerWidth,height:s.viewerHeight}):null,s.focus&&t<=20?se.createElement(kc,{direction:Qn,width:s.viewerWidth,height:s.viewerHeight}):null):null,s.mode!==Qr?null:se.createElement(w1,{startX:s.startX,startY:s.startY,endX:s.endX,endY:s.endY})),e.toolbarProps.position===Oc?null:se.createElement(o,Bc({},this.props.toolbarProps,{value:s,onChangeValue:d=>this.setValue(d),tool:i,onChangeTool:d=>this.props.onChangeTool(d)})),e.miniatureProps.position===Oc?null:se.createElement(a,Bc({},this.props.miniatureProps,{value:s,onChangeValue:d=>this.setValue(d),SVGBackground:this.props.SVGBackground}),e.children.props.children))}}Vc.propTypes={width:xe.number.isRequired,height:xe.number.isRequired,value:xe.oneOfType([xe.object,xe.shape({version:xe.oneOf([2]).isRequired,mode:xe.oneOf([yr,Jr,Qr]).isRequired,focus:xe.bool.isRequired,a:xe.number.isRequired,b:xe.number.isRequired,c:xe.number.isRequired,d:xe.number.isRequired,e:xe.number.isRequired,f:xe.number.isRequired,viewerWidth:xe.number.isRequired,viewerHeight:xe.number.isRequired,SVGMinX:xe.number.isRequired,SVGMinY:xe.number.isRequired,SVGWidth:xe.number.isRequired,SVGHeight:xe.number.isRequired,startX:xe.number,startY:xe.number,endX:xe.number,endY:xe.number,miniatureOpen:xe.bool.isRequired})]).isRequired,onChangeValue:xe.func.isRequired,tool:xe.oneOf([Ur,Mi,Fr,ei,wi]).isRequired,onChangeTool:xe.func.isRequired,background:xe.string,SVGBackground:xe.string,SVGStyle:xe.object,style:xe.object,className:xe.string,detectWheel:xe.bool,detectAutoPan:xe.bool,detectPinchGesture:xe.bool,onZoom:xe.func,onPan:xe.func,onClick:xe.func,onDoubleClick:xe.func,onMouseUp:xe.func,onMouseMove:xe.func,onMouseDown:xe.func,preventPanOutside:xe.bool,scaleFactor:xe.number,scaleFactorOnWheel:xe.number,scaleFactorMax:xe.number,scaleFactorMin:xe.number,modifierKeys:xe.array,disableDoubleClickZoomWithToolAuto:xe.bool,customMiniature:xe.oneOfType([xe.element,xe.func]),miniatureProps:xe.shape({position:xe.oneOf([Oc,Sr,Qn]),background:xe.string,width:xe.number,height:xe.number}),customToolbar:xe.oneOfType([xe.element,xe.func]),toolbarProps:xe.shape({position:xe.oneOf([Oc,Ti,Sr,Ai,Qn]),SVGAlignX:xe.oneOf([Uo,Fo,Wf]),SVGAlignY:xe.oneOf([Uo,zo,jf]),activeToolColor:xe.string}),children:function(n,e,t){let r=n[e],i=["svg"];if(se.Children.count(r)!==1||i.indexOf(r.type)===-1)return new Error("`"+t+"` should have a single child of the following types: `"+i.join("`, `")+"`.");if((!r.props.hasOwnProperty("width")||!r.props.hasOwnProperty("height"))&&!r.props.hasOwnProperty("viewBox"))return new Error("SVG should have props `width` and `height` or `viewBox`")}},Vc.defaultProps={style:{},background:"#616264",SVGBackground:"#fff",SVGStyle:{},detectWheel:!0,detectAutoPan:!0,detectPinchGesture:!0,modifierKeys:["Alt","Shift","Control"],preventPanOutside:!0,scaleFactor:1.1,scaleFactorOnWheel:1.06,disableZoomWithToolAuto:!1,onZoom:null,onPan:null,toolbarProps:{},miniatureProps:{}};const hE=["width","height","onChangeTool","onChangeValue"];function Qf(){return Qf=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Qf.apply(null,arguments)}function fE(n,e){if(n==null)return{};var t,r,i=dE(n,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r<s.length;r++)t=s[r],e.includes(t)||{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function dE(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.includes(r))continue;t[r]=n[r]}return t}class pE extends se.Component{constructor(e){super(e),this.state={value:e.defaultValue||{},tool:e.defaultTool||Mi},this.Viewer=null,this.changeTool=this.changeTool.bind(this),this.changeValue=this.changeValue.bind(this)}changeTool(e){this.setState({tool:e})}changeValue(e){this.setState({value:e})}pan(e,t){this.Viewer.pan(e,t)}zoom(e,t,r){this.Viewer.zoom(e,t,r)}fitSelection(e,t,r,i){this.Viewer.fitSelection(e,t,r,i)}fitToViewer(e,t){this.Viewer.fitToViewer(e,t)}zoomOnViewerCenter(e){this.Viewer.zoomOnViewerCenter(e)}setPointOnViewerCenter(e,t,r){this.Viewer.setPointOnViewerCenter(e,t,r)}reset(){this.Viewer.reset()}openMiniature(){this.Viewer.openMiniature()}closeMiniature(){this.Viewer.closeMiniature()}render(){const e=this.props,{width:t,height:r,onChangeTool:i,onChangeValue:s}=e,o=fE(e,hE),{tool:a,value:l}=this.state;return se.createElement(Vc,Qf({width:t,height:r,tool:a,onChangeTool:this.changeTool,value:l,onChangeValue:this.changeValue,ref:c=>this.Viewer=c},o))}}pE.propTypes={width:xe.number.isRequired,height:xe.number.isRequired,defaultValue:xe.object,defaultTool:xe.string};const en=V2(n=>({planner:new bc,viewer:null,plan:null,toast:null,activeFloor:0,setViewer:e=>{n(t=>({...t,viewer:e}))},setToast:e=>{n(t=>({...t,toast:e}))},setActiveFloor:e=>{n(t=>({...t,activeFloor:e}))},newProject:()=>{n(e=>({...e,planner:Yt.newProject(e.planner).updatedState}))},selectTool3DView:()=>{n(e=>{const r=Yt.rollback(e.planner).updatedState.set("mode",Bi);return{...e,planner:r}})},selectTool3DFirstPerson:()=>{n(e=>{const r=Yt.rollback(e.planner).updatedState.set("mode",qo);return{...e,planner:r}})},loadProject:e=>{n(t=>{const r=new bc({scene:e,catalog:t.planner.catalog.toJS()});return{...t,planner:r}})},undo:()=>{n(e=>{const t=Yt.undo(e.planner).updatedState;return{...e,planner:t}})},redo:()=>{n(e=>{const t=Yt.redo(e.planner).updatedState;return{...e,planner:t}})},addLayer:(e,t)=>{n(r=>{const i=ht.create(r.planner,e,t).updatedState;return{...r,planner:i}})},removeLayer:e=>{n(t=>{const r=ht.remove(t.planner,e).updatedState;return{...t,planner:r}})},addGroup:()=>{n(e=>{const t=En.create(e.planner).updatedState;return{...e,planner:t}})},selectGroup:e=>{n(t=>{const r=En.select(t.planner,e).updatedState;return{...t,planner:r}})},setGroupProperties:(e,t)=>{n(r=>{const i=En.setProperties(r.planner,e,t).updatedState;return{...r,planner:i}})},addToGroup:(e,t,r,i)=>{n(s=>{const o=En.addElement(s.planner,e,t,r,i).updatedState;return{...s,planner:o}})},removeGroup:e=>{n(t=>{const r=En.remove(t.planner,e).updatedState;return{...t,planner:r}})},setGroupAttributes:(e,t)=>{n(r=>{const i=En.setAttributes(r.planner,e,t).updatedState;return{...r,planner:i}})},groupTranslate:(e,t,r)=>{n(i=>{const s=En.translate(i.planner,e,t,r).updatedState;return{...i,planner:s}})},removeFromGroup:(e,t,r,i)=>{n(s=>{const o=En.removeElement(s.planner,e,t,r,i).updatedState;return{...s,planner:o}})},groupRotate:(e,t)=>{n(r=>{const i=En.rotate(r.planner,e,t).updatedState;return{...r,planner:i}})},removeGroupAndDeleteElements:e=>{n(t=>{const r=En.removeAndDeleteElements(t.planner,e).updatedState;return{...t,planner:r}})},addGroupFromSelected:()=>{n(e=>{const t=En.createFromSelectedElements(e.planner).updatedState;return{...e,planner:t}})},copyProperties:e=>{n(t=>({...t,planner:Yt.copyProperties(t.planner,e).updatedState}))},pasteProperties:()=>{n(e=>{const t=e.planner.merge({sceneHistory:mn(e.planner.sceneHistory,e.planner.scene)});return{...e,planner:Yt.pasteProperties(t).updatedState}})},setProperties:e=>{n(t=>{const r=t.planner.merge({sceneHistory:mn(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Yt.setProperties(r,r.getIn(["scene","selectedLayer"]),e).updatedState}})},setHolesAttributes:e=>{n(t=>{const r=e.set("offset",parseFloat(e.get("offset"))),i=t.planner.merge({sceneHistory:mn(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Yt.setHolesAttributes(i,r).updatedState}})},setLinesAttributes:e=>{n(t=>{const r=e.withMutations(s=>{s.setIn(["vertexOne","x"],parseFloat(e.getIn(["vertexOne","x"]))),s.setIn(["vertexOne","y"],parseFloat(e.getIn(["vertexOne","y"]))),s.setIn(["vertexTwo","x"],parseFloat(e.getIn(["vertexTwo","x"]))),s.setIn(["vertexTwo","y"],parseFloat(e.getIn(["vertexTwo","y"])))}),i=t.planner.merge({sceneHistory:mn(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Yt.setLinesAttributes(i,r).updatedState}})},setItemsAttributes:e=>{n(t=>{const r=e.set("rotation",parseFloat(e.get("rotation"))),i=t.planner.merge({sceneHistory:mn(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Yt.setItemsAttributes(i,r).updatedState}})},selectLine:(e,t)=>{n(r=>{const i=On.select(r.planner,e,t).updatedState;return{...r,planner:i}})},selectHole:(e,t)=>{n(r=>{const i=Sn.select(r.planner,e,t).updatedState;return{...r,planner:i}})},selectItem:(e,t)=>{n(r=>{const i=Tn.select(r.planner,e,t).updatedState;return{...r,planner:i}})},selectLayer:e=>{n(t=>{const r=ht.select(t.planner,e).updatedState;return{...t,planner:r}})},setLayerProperties:(e,t)=>{n(r=>{const i=ht.setProperties(r.planner,e,t).updatedState;return{...r,planner:i}})},addVerticalGuide:e=>{n(t=>{const r=Rc.create(t.planner,e).updatedState;return{...t,planner:r}})},addHorizontalGuide:e=>{n(t=>{const r=Cc.create(t.planner,e).updatedState;return{...t,planner:r}})},removeVerticalGuide:e=>{n(t=>{const r=Rc.remove(t.planner,e).updatedState;return{...t,planner:r}})},removeHorizontalGuide:e=>{n(t=>{const r=Cc.remove(t.planner,e).updatedState;return{...t,planner:r}})},toggleSnap:e=>{n(t=>{const r=Yt.toggleSnap(t.planner,e).updatedState;return{...t,planner:r}})},openProjectConfigurator:()=>{n(e=>{const t=Yt.openProjectConfigurator(e.planner).updatedState;return{...e,planner:t}})},setMode:e=>{n(t=>{const r=t.planner.set("mode",e);return{...t,planner:r}})},updateZoomScale:e=>{n(t=>({...t,planner:Yt.updateZoomScale(t.planner,e).updatedState}))},updateCameraView:e=>{n(t=>{const r=t.planner.update("viewer2D",i=>i.merge(Dt(e)));return{...t,planner:r}})},selectToolPan:()=>{n(e=>{const t=e.planner.set("mode",Ws);return{...e,planner:t}})},selectToolEdit:()=>{n(e=>({...e,planner:Yt.setMode(e.planner,fn).updatedState}))},selectToolZoomIn:()=>{n(e=>{const t=e.planner.set("mode",Hs);return{...e,planner:t}})},selectToolZoomOut:()=>{n(e=>{const t=e.planner.set("mode",Gs);return{...e,planner:t}})},updateDrawingLine:(e,t)=>{n(r=>({...r,planner:On.updateDrawingLine(r.planner,e,t).updatedState}))},updateMouseCoord:e=>{n(t=>({...t,planner:Yt.updateMouseCoord(t.planner,e).updatedState}))},openCatalog:()=>{n(e=>{const t=e.planner.set("mode",sf);return{...e,planner:t}})},updateDrawingHole:(e,t,r)=>{n(i=>({...i,planner:Sn.updateDrawingHole(i.planner,e,t,r).updatedState}))},updateDrawingItem:(e,t,r)=>{n(i=>({...i,planner:Tn.updateDrawingItem(i.planner,e,t,r).updatedState}))},blur:()=>{n(e=>{const t=e.planner.merge({mode:fn,activeSnapElement:null});return{...e,planner:t}})},updateDraggingHole:(e,t)=>{n(r=>({...r,planner:Sn.updateDraggingHole(r.planner,e,t).updatedState}))},updateDraggingLine:(e,t)=>{n(r=>({...r,planner:On.updateDraggingLine(r.planner,e,t).updatedState}))},updateDraggingVertex:(e,t)=>{n(r=>({...r,planner:gn.updateDraggingVertex(r.planner,e,t).updatedState}))},updateDraggingItem:(e,t)=>{n(r=>({...r,planner:Tn.updateDraggingItem(r.planner,e,t).updatedState}))},updateRotatingItem:(e,t)=>{n(r=>({...r,planner:Tn.updateRotatingItem(r.planner,e,t).updatedState}))},beginDraggingLine:(e,t,r,i)=>{n(s=>{const o=s.planner.merge({sceneHistory:mn(s.planner.sceneHistory,s.planner.scene)});return{...s,planner:On.beginDraggingLine(o,e,t,r,i).updatedState}})},endDraggingLine:(e,t)=>{n(r=>{const i=r.planner.merge({sceneHistory:mn(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:On.endDraggingLine(i,e,t).updatedState}})},beginDraggingVertex:(e,t)=>{n(r=>({...r,planner:gn.beginDraggingVertex(r.planner,e,t).updatedState}))},endDraggingVertex:()=>{n(e=>({...e,planner:gn.endDraggingVertex(e.planner).updatedState}))},beginRotatingItem:(e,t,r,i)=>{n(s=>{const o=s.planner.merge({sceneHistory:mn(s.planner.sceneHistory,s.planner.scene)});return{...s,planner:Tn.beginRotatingItem(o,e,t,r,i).updatedState}})},endRotatingItem:(e,t)=>{n(r=>{const i=r.planner.merge({sceneHistory:mn(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:Tn.endRotatingItem(i,e,t).updatedState}})},beginDraggingItem:(e,t,r,i)=>{n(s=>{const o=s.planner.merge({sceneHistory:mn(s.planner.sceneHistory,s.planner.scene)});return{...s,planner:Tn.beginDraggingItem(o,e,t,r,i).updatedState}})},endDraggingItem:(e,t)=>{n(r=>{const i=r.planner.merge({sceneHistory:mn(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:Tn.endDraggingItem(i,e,t).updatedState}})},beginDraggingHole:(e,t,r,i)=>{n(s=>{const o=s.planner.merge({sceneHistory:mn(s.planner.sceneHistory,s.planner.scene)});return{...s,planner:Sn.beginDraggingHole(o,e,t,r,i).updatedState}})},endDraggingHole:(e,t)=>{n(r=>{const i=r.planner.merge({sceneHistory:mn(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:Sn.endDraggingHole(i,e,t).updatedState}})},beginDrawingLine:(e,t,r)=>{n(i=>{const s=i.planner.merge({sceneHistory:mn(i.planner.sceneHistory,i.planner.scene)});return{...i,planner:On.beginDrawingLine(s,e,t,r).updatedState}})},endDrawingLine:(e,t)=>{n(r=>{const i=r.planner.merge({sceneHistory:mn(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:On.endDrawingLine(i,e,t).updatedState}})},endDrawingHole:(e,t,r)=>{n(i=>{const s=i.planner.merge({sceneHistory:mn(i.planner.sceneHistory,i.planner.scene)});return{...i,planner:Sn.endDrawingHole(s,e,t,r).updatedState}})},endDrawingItem:(e,t,r)=>{n(i=>{const s=i.planner.merge({sceneHistory:mn(i.planner.sceneHistory,i.planner.scene)});return{...i,planner:Tn.endDrawingItem(s,e,t,r).updatedState}})},selectArea:(e,t)=>{n(r=>({...r,planner:js.select(r.planner,e,t).updatedState}))},initCatalog:e=>{n(t=>({...t,planner:Yt.initCatalog(t.planner,e).updatedState}))},goBackToCatalogPage:e=>{n(t=>({...t,planner:Yt.goBackToCatalogPage(t.planner,e).updatedState}))},pushLastSelectedCatalogElementToHistory:e=>{n(t=>({...t,planner:Yt.pushLastSelectedCatalogElementToHistory(t.planner,e).updatedState}))},selectToolDrawingLine:e=>{n(t=>({...t,planner:On.selectToolDrawingLine(t.planner,e).updatedState}))},selectToolDrawingItem:e=>{n(t=>{const r=t.planner.merge({sceneHistory:mn(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Tn.selectToolDrawingItem(r,e).updatedState}})},selectToolDrawingHole:e=>{n(t=>{const r=t.planner.merge({sceneHistory:mn(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Sn.selectToolDrawingHole(r,e).updatedState}})},changeCatalogPage:(e,t)=>{n(r=>({...r,planner:Yt.changeCatalogPage(r.planner,t,e).updatedState}))},remove:()=>{n(e=>{const t=e.planner.merge({sceneHistory:mn(e.planner.sceneHistory,e.planner.scene)});return{...e,planner:Yt.remove(t).updatedState}})},rollback:()=>{n(e=>({...e,planner:Yt.rollback(e.planner).updatedState}))},setAlterateState:()=>{n(e=>({...e,planner:Yt.setAlterate(e.planner).updatedState}))},setPlan:e=>{n(t=>({...t,plan:e}))},unselectAll:()=>{n(e=>({...e,planner:Yt.unselectAll(e.planner).updatedState}))}})),fl={stroke:"#D32F2F",strokeWidth:"1px"};function mE({snap:n,width:e,height:t}){switch(n.type){case"point":return C.jsxs("g",{transform:`translate(${n.x} ${n.y})`,children:[C.jsx("line",{x1:"0",y1:"-70",x2:"0",y2:"70",style:fl}),C.jsx("line",{x1:"-70",y1:"0",x2:"70",y2:"0",style:fl})]});case"line":let r=vc(0),i=vc(t),s=ll(n.a,n.b,n.c,r.a,r.b,r.c),o=ll(n.a,n.b,n.c,i.a,i.b,i.c),a=xc(0),l=xc(e),c=ll(n.a,n.b,n.c,a.a,a.b,a.c),h=ll(n.a,n.b,n.c,l.a,l.b,l.c);return s&&o?C.jsx("line",{x1:s.x,y1:s.y,x2:o.x,y2:o.y,style:fl}):c&&h?C.jsx("line",{x1:c.x,y1:c.y,x2:h.x,y2:h.y,style:fl}):null;case"line-segment":return C.jsx("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,style:fl});default:return null}}const Hc={white:"#FFF",black:"#000"},O1={500:{orange:"#FF9800"}},gE={alt:"#2E2F33",text_main:Hc.white},_E={main:"#1CA6FC"},ed="#99C3FB",Ht={COLORS:Hc,PRIMARY_COLOR:gE,SECONDARY_COLOR:_E,MESH_SELECTED:ed,AREA_MESH_COLOR:{selected:ed,unselected:"#F5F4F4"},LINE_MESH_COLOR:{selected:ed}};function vE({width:n,height:e,grid:t}){let r=t.properties.get("step"),i;t.properties.has("color")?i=Je([t.properties.get("color")]):i=t.properties.get("colors");let s=[],o=0;for(let a=0;a<=e;a+=r){let l=i.get(o%i.size);o++,s.push(C.jsx("line",{x1:"0",y1:a,x2:n,y2:a,strokeWidth:"1",stroke:l},a))}return C.jsx("g",{children:s})}function xE({width:n,height:e,grid:t}){let r=t.properties.get("step"),i;t.properties.has("color")?i=Je([t.properties.get("color")]):i=t.properties.get("colors");let s=[],o=0;for(let a=0;a<=n;a+=r){let l=i.get(o%i.size);o++,s.push(C.jsx("line",{x1:a,y1:"0",x2:a,y2:e,strokeWidth:"1",stroke:l},a))}return C.jsx("g",{children:s})}function yE({scene:n}){let{width:e,height:t,grids:r}=n,i=r.entrySeq().map(([s,o])=>{switch(o.type){case"horizontal-streak":return C.jsx(vE,{width:e,height:t,grid:o},s);case"vertical-streak":return C.jsx(xE,{width:e,height:t,grid:o},s);default:console.warn(`grid ${o.type} not allowed`)}}).toList();return C.jsx("g",{children:i})}class SE{constructor(e=[],t=(r,i)=>r<i?-1:r>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:r}=this,i=t[e];for(;e>0;){const s=e-1>>1,o=t[s];if(r(i,o)>=0)break;t[e]=o,e=s}t[e]=i}_down(e){const{data:t,compare:r}=this,i=this.length>>1,s=t[e];for(;e<i;){let o=(e<<1)+1;const a=o+1;if(a<this.length&&r(t[a],t[o])<0&&(o=a),r(t[o],s)>=0)break;t[e]=t[o],e=o}t[e]=s}}function EE(n,e=1,t=!1){let r=1/0,i=1/0,s=-1/0,o=-1/0;for(const[_,E]of n[0])_<r&&(r=_),E<i&&(i=E),_>s&&(s=_),E>o&&(o=E);const a=s-r,l=o-i,c=Math.max(e,Math.min(a,l));if(c===e){const _=[r,i];return _.distance=0,_}const h=new SE([],(_,E)=>E.max-_.max);let f=ME(n);const p=new Gc(r+a/2,i+l/2,0,n);p.d>f.d&&(f=p);let d=2;function m(_,E,M){const b=new Gc(_,E,M,n);d++,b.max>f.d+e&&h.push(b),b.d>f.d&&(f=b,t&&console.log(`found best ${Math.round(1e4*b.d)/1e4} after ${d} probes`))}let x=c/2;for(let _=r;_<s;_+=c)for(let E=i;E<o;E+=c)m(_+x,E+x,x);for(;h.length;){const{max:_,x:E,y:M,h:b}=h.pop();if(_-f.d<=e)break;x=b/2,m(E-x,M-x,x),m(E+x,M-x,x),m(E-x,M+x,x),m(E+x,M+x,x)}t&&console.log(`num probes: ${d}
78
- best distance: ${f.d}`);const v=[f.x,f.y];return v.distance=f.d,v}function Gc(n,e,t,r){this.x=n,this.y=e,this.h=t,this.d=bE(n,e,r),this.max=this.d+this.h*Math.SQRT2}function bE(n,e,t){let r=!1,i=1/0;for(const s of t)for(let o=0,a=s.length,l=a-1;o<a;l=o++){const c=s[o],h=s[l];c[1]>e!=h[1]>e&&n<(h[0]-c[0])*(e-c[1])/(h[1]-c[1])+c[0]&&(r=!r),i=Math.min(i,wE(n,e,c,h))}return i===0?0:(r?1:-1)*Math.sqrt(i)}function ME(n){let e=0,t=0,r=0;const i=n[0];for(let o=0,a=i.length,l=a-1;o<a;l=o++){const c=i[o],h=i[l],f=c[0]*h[1]-h[0]*c[1];t+=(c[0]+h[0])*f,r+=(c[1]+h[1])*f,e+=f*3}const s=new Gc(t/e,r/e,0,n);return e===0||s.d<0?new Gc(i[0][0],i[0][1],0,n):s}function wE(n,e,t,r){let i=t[0],s=t[1],o=r[0]-i,a=r[1]-s;if(o!==0||a!==0){const l=((n-i)*o+(e-s)*a)/(o*o+a*a);l>1?(i=r[0],s=r[1]):l>0&&(i+=o*l,s+=a*l)}return o=n-i,a=e-s,o*o+a*a}function q1(n,e){var t=n.length,r=0;n=n.map(TE),n[0]!=n[n.length-1]&&(n=n.concat(n[0]));for(var i=0;i<t;i++)r+=n[i].x*n[i+1].y-n[i].y*n[i+1].x;return Math.abs(r)/2}function TE(n){return Array.isArray(n)?{x:n[0],y:n[1]}:n}const AE={textAnchor:"middle",fontSize:"12px",fontFamily:'"Courier New", Courier, monospace',pointerEvents:"none",fontWeight:"bold",WebkitTouchCallout:"none",WebkitUserSelect:"none",MozUserSelect:"none",userSelect:"none"};function CE({layer:n,area:e,catalog:t}){let r=t.getElement(e.type).render2D(e,n),i=null;if(e.selected){let s=e.vertices.toArray().map(c=>{let{x:h,y:f}=n.vertices.get(c);return[h,f]}),o=s;e.holes.forEach(c=>{let h=n.areas.get(c).vertices.toArray().map(f=>{let{x:p,y:d}=n.vertices.get(f);return[p,d]});o=o.concat(h.reverse())});let a=EE([o],1),l=q1(s);e.holes.forEach(c=>{let f=n.areas.get(c).vertices.toArray().map(p=>{let{x:d,y:m}=n.vertices.get(p);return[d,m]});l-=q1(f)}),i=C.jsxs("text",{x:"0",y:"0",transform:`translate(${a[0]} ${a[1]}) scale(1, -1)`,style:AE,children:[(l/1e4).toFixed(2)," m","²"]})}return C.jsxs("g",{"data-element-root":!0,"data-prototype":e.prototype,"data-id":e.id,"data-selected":e.selected,"data-layer":n.id,children:[r,i]})}const RE=0,PE=0,IE=5,LE={fill:O1[500].orange,stroke:O1[500].orange,cursor:"default"};function OE({layer:n,group:e}){return C.jsx("g",{"data-element-root":!0,"data-prototype":e.prototype,"data-id":e.id,"data-selected":e.selected,"data-layer":n.id,style:e.selected?{cursor:"move"}:{},transform:`translate(${e.x},${e.y}) rotate(${e.rotation})`,children:e.selected&&C.jsx("g",{"data-element-root":!0,"data-prototype":e.prototype,"data-id":e.id,"data-selected":e.selected,"data-layer":n.id,"data-part":"rotation-anchor",children:C.jsx("circle",{cx:RE,cy:PE,r:IE,style:LE,children:C.jsx("title",{children:"Group's Barycenter"})})})})}const qE={fill:"#0096fd",stroke:"#0096fd",cursor:"ew-resize"},DE={fill:"none",stroke:"#0096fd",cursor:"ew-resize"};function NE({layer:n,item:e,scene:t,catalog:r}){let{x:i,y:s,rotation:o}=e,a=r.getElement(e.type).render2D(e,n,t);return C.jsxs("g",{"data-element-root":!0,"data-prototype":e.prototype,"data-id":e.id,"data-selected":e.selected,"data-layer":n.id,style:e.selected?{cursor:"move"}:{},transform:`translate(${i},${s}) rotate(${o})`,children:[a,e.selected&&C.jsxs("g",{"data-element-root":!0,"data-prototype":e.prototype,"data-id":e.id,"data-selected":e.selected,"data-layer":n.id,"data-part":"rotation-anchor",children:[C.jsx("circle",{cx:"0",cy:"150",r:"10",style:qE}),C.jsx("circle",{cx:"0",cy:"0",r:"150",style:DE})]})]})}const td={stroke:"#0096fd",strokeWidth:"1px"},UE={textAnchor:"middle",fontSize:"12px",fontFamily:"'Courier New', Courier, monospace",pointerEvents:"none",fontWeight:"bold",WebkitTouchCallout:"none",WebkitUserSelect:"none",MozUserSelect:"none",userSelect:"none"};function FE({length:n,unit:e,transform:t}){let r=`${n.toFixed(2)} ${e}`;return C.jsxs("g",{transform:t,children:[C.jsx("text",{x:n/2,y:"-3",transform:"scale(1, -1)",style:UE,children:r}),C.jsx("line",{x1:"0",y1:"-5",x2:"0",y2:"5",style:td}),C.jsx("line",{x1:n,y1:"-5",x2:n,y2:"5",style:td}),C.jsx("line",{x1:"0",y1:"0",x2:n,y2:"0",style:td})]})}const zE=({line:n,layer:e,scene:t,catalog:r})=>{let i=e.vertices.get(n.vertices.get(0)),s=e.vertices.get(n.vertices.get(1));if(i.id===s.id||Zr(i,s))return null;let{x:o,y:a}=i,{x:l,y:c}=s;o>l&&({x:o,y:a}=s,{x:l,y:c}=i);let h=Bn(o,a,l,c),f=Xy(o,a,l,c),p=n.holes.map(_=>{let E=e.holes.get(_),M=h*E.offset,b=r.getElement(E.type).render2D(E,e,t);return C.jsx("g",{transform:`translate(${M}, 0)`,"data-element-root":!0,"data-prototype":E.prototype,"data-id":E.id,"data-selected":E.selected,"data-layer":e.id,children:b},_)}),m=n.getIn(["properties","thickness","length"])/2,x=r.getElement(n.type).render2D(n,e),v=n.selected?C.jsx(FE,{unit:t.unit,length:h,transform:`translate(0, ${m+10} )`}):null;return C.jsxs("g",{transform:`translate(${o}, ${a}) rotate(${f}, 0, 0)`,"data-element-root":!0,"data-prototype":n.prototype,"data-id":n.id,"data-selected":n.selected,"data-layer":e.id,style:n.selected?{cursor:"move"}:{},children:[v,x,p]})},kE={fill:"#0096fd",stroke:Ht.COLORS.white,cursor:"move"},BE=({vertex:n,layer:e})=>C.jsx("g",{transform:`translate(${n.x}, ${n.y})`,"data-element-root":!0,"data-prototype":n.prototype,"data-id":n.id,"data-selected":n.selected,"data-layer":e.id,children:C.jsx("circle",{cx:"0",cy:"0",r:"7",style:kE})});function D1({layer:n,scene:e,catalog:t}){const{groups:r}=e,{lines:i,areas:s,vertices:o,id:a,items:l,opacity:c}=n;return C.jsxs("g",{opacity:c,children:[s.valueSeq().map(h=>C.jsx(CE,{layer:n,area:h,catalog:t},h.id)),i.valueSeq().map(h=>C.jsx(zE,{layer:n,line:h,scene:e,catalog:t},h.id)),l.valueSeq().map(h=>C.jsx(NE,{layer:n,item:h,scene:e,catalog:t},h.id)),o.valueSeq().filter(h=>h.selected).map(h=>C.jsx(BE,{layer:n,vertex:h},h.id)),r.valueSeq().filter(h=>h.hasIn(["elements",a])&&h.get("selected")).map(h=>C.jsx(OE,{layer:n,group:h,scene:e,catalog:t},h.get("id")))]})}const VE=({scene:n,catalog:e})=>{const{layers:t}=n,r=t.get(n.selectedLayer);return C.jsxs("g",{children:[C.jsx(yE,{scene:n}),C.jsx("g",{style:{pointerEvents:"none"},children:t.entrySeq().filter(([i,s])=>i!==n.selectedLayer&&s.visible).map(([i,s])=>C.jsx(D1,{layer:s,scene:n,catalog:e},i))}),C.jsx(D1,{layer:r,scene:n,catalog:e},r.id)]})},HE=se.memo(VE,(n,e)=>n.scene.hashCode()===e.scene.hashCode()),N1={stroke:Ht.SECONDARY_COLOR.main,strokeWidth:"2.5px"},GE=({catalog:n})=>{const{planner:e}=en(),{activeSnapElement:t,snapElements:r,scene:i}=e,{width:s,height:o}=i;return C.jsxs("g",{children:[C.jsx("rect",{x:"0",y:"0",width:s,height:o,fill:Ht.COLORS.white}),C.jsxs("g",{transform:`translate(0, ${i.height}) scale(1, -1)`,id:"svg-drawing-paper",children:[C.jsx(HE,{scene:i,catalog:n}),i.getIn(["guides","horizontal"]).entrySeq().map(([a,l])=>C.jsx("line",{id:"hGuide"+a,x1:0,y1:l,x2:s,y2:l,style:N1},a)),i.getIn(["guides","vertical"]).entrySeq().map(([a,l])=>C.jsx("line",{x1:l,y1:0,x2:l,y2:o,style:N1},a)),t?C.jsx(mE,{snap:t,width:i.width,height:i.height}):null,r?null:C.jsx(C.Fragment,{})]})]})},nd=.25,U1=5,WE=.25,jE=5.25;function F1(n){return(Math.min(Math.max(n,nd),U1)-nd)/(U1-nd)*100}function XE(n){switch(n){case Ws:return Fr;case Hs:return ei;case Gs:return wi;case fn:return Ur;default:return Mi}}function $E(n){switch(n){case _r:case vr:case Dr:case Kr:case Yr:case Xr:case $r:return{pointerEvents:"none"};default:return{}}}function YE(n){switch(n){case Kr:case Xr:case $r:case Yr:return{cursor:"move"};case Vi:return{cursor:"ew-resize"};case jr:case _r:return{cursor:"crosshair"};default:return{cursor:"default"}}}function KE(n){switch(n){case _r:case Xr:case $r:case Kr:case Yr:case vr:case Dr:return!0;default:return!1}}function z1(n){for(;!n.attributes.getNamedItem("data-element-root")&&n.tagName!=="svg";)n=n.parentNode;return n.tagName==="svg"?null:{part:n.attributes.getNamedItem("data-part")?n.attributes.getNamedItem("data-part").value:void 0,layer:n.attributes.getNamedItem("data-layer").value,prototype:n.attributes.getNamedItem("data-prototype").value,selected:n.attributes.getNamedItem("data-selected").value==="true",id:n.attributes.getNamedItem("data-id").value}}const ZE=({width:n,height:e,catalog:t})=>{const r=se.useRef(null),{planner:i,selectToolZoomOut:s,selectToolZoomIn:o,selectToolPan:a,selectToolEdit:l,updateCameraView:c,updateZoomScale:h,updateMouseCoord:f,updateDrawingLine:p,updateDrawingHole:d,updateDrawingItem:m,updateDraggingHole:x,updateDraggingLine:v,updateDraggingVertex:_,updateDraggingItem:E,updateRotatingItem:M,beginDraggingLine:b,beginDraggingVertex:S,beginRotatingItem:T,beginDraggingItem:q,beginDraggingHole:O,selectArea:A,unselectAll:L,beginDrawingLine:N,endDrawingLine:Z,endDrawingHole:Y,endDrawingItem:ee,endDraggingLine:ue,endDraggingVertex:te,endDraggingItem:ae,endDraggingHole:B,endRotatingItem:Se,selectLine:$,selectHole:oe,selectItem:Ae,rollback:Ie,setViewer:Ce}=en(),{viewer2D:V,scene:ne,mode:X}=i,pe=ne.selectedLayer??"";se.useEffect(()=>{r.current&&(Ce(r.current),r.current.fitToViewer())},[]);const Ee=({x:Ge,y:De})=>({x:Ge,y:-De+ne.height}),Q=Ge=>{const De=new Event("mousemove-planner-event");De.viewerEvent=Ge,document.dispatchEvent(De);let{x:Ue,y:ge}=Ee(Ge);switch(f({x:Ue,y:ge}),X){case _r:p(Ue,ge,i.snapMask);break;case vr:d(pe,Ue,ge);break;case Dr:m(pe,Ue,ge);break;case Kr:x(Ue,ge);break;case Xr:v(Ue,ge,i.snapMask);break;case $r:_(Ue,ge,i.snapMask);break;case Yr:E(Ue,ge);break;case Vi:M(Ue,ge);break}Ge.originalEvent.stopPropagation()},Ne=Ge=>{const De=Ge.originalEvent,Ue=new Event("mousedown-planner-event");Ue.viewerEvent=Ge,document.dispatchEvent(Ue);let{x:ge,y:$e}=Ee(Ge);if(X===fn){let ot=z1(De.target);if(!ot||!ot.selected)return;switch(ot.prototype){case"lines":b(ot.layer,ot.id,ge,$e,i.snapMask);break;case"vertices":S(ot.layer,ot.id,ge,$e,i.snapMask);break;case"items":ot.part==="rotation-anchor"?T(ot.layer,ot.id,ge,$e):q(ot.layer,ot.id,ge,$e);break;case"holes":O(ot.layer,ot.id,ge,$e);break}}De.stopPropagation()},le=Ge=>{const De=Ge.originalEvent,Ue=new Event("mouseup-planner-event");Ue.viewerEvent=Ge,document.dispatchEvent(Ue);const{x:ge,y:$e}=Ee(Ge);switch(X){case fn:const ot=z1(De.target);if(ot&&ot.selected)return;switch(ot?ot.prototype:"none"){case"areas":A(ot.layer,ot.id);break;case"lines":$(ot.layer,ot.id);break;case"holes":oe(ot.layer,ot.id);break;case"items":Ae(ot.layer,ot.id);break;case"none":L();break}break;case jr:N(pe,ge,$e,i.snapMask);break;case _r:Z(ge,$e,i.snapMask),N(pe,ge,$e,i.snapMask);break;case vr:Y(pe,ge,$e);break;case Dr:ee(pe,ge,$e);break;case Xr:ue(ge,$e,i.snapMask);break;case $r:te(ge,$e,i.snapMask);break;case Yr:ae(ge,$e);break;case Kr:B(ge,$e);break;case Vi:Se(ge,$e);break}De.stopPropagation()},F=()=>{[jr,_r,vr,Dr].includes(X)&&Ie()},lt=Ge=>{h(Ge.a),c(Ge)},Le=Ge=>{switch(Ge){case Mi:l();break;case Fr:a();break;case ei:o();break;case wi:s();break}};return C.jsx("div",{className:"m-0 p-0 relative",children:C.jsx(Vc,{className:"floor_planner-svgPanZoom",ref:r,style:{gridColumn:2,gridRow:2},width:n,height:e,scaleFactorMin:WE,scaleFactorMax:jE,value:V.isEmpty()?{}:V.toJS(),onChangeValue:lt,tool:XE(X),onChangeTool:Le,detectAutoPan:KE(X),onMouseDown:Ne,onMouseMove:Q,onMouseUp:le,onDoubleClick:F,miniatureProps:{position:"none",width:0,height:0,background:""},toolbarProps:{position:"none"},children:C.jsxs("svg",{width:ne.width,height:ne.height,children:[C.jsx("defs",{children:C.jsxs("pattern",{id:"diagonalFill",patternUnits:"userSpaceOnUse",width:"4",height:"4",fill:"#FFF",children:[C.jsx("rect",{x:"0",y:"0",width:"4",height:"4",fill:"#FFF"}),C.jsx("path",{d:"M-1,1 l2,-2 M0,4 l4,-4 M3,5 l2,-2",style:{stroke:"#8E9BA2",strokeWidth:1}})]})}),C.jsx("g",{style:Object.assign(YE(X),$E(X)),children:C.jsx(GE,{catalog:t})})]})})})};/**
69
+ at `+o}return e},Ac.buildMessage=function(n,e){var t={literal:function(c){return'"'+i(c.text)+'"'},class:function(c){var h=c.parts.map(function(f){return Array.isArray(f)?s(f[0])+"-"+s(f[1]):s(f)});return"["+(c.inverted?"^":"")+h.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(c){return c.description}};function r(c){return c.charCodeAt(0).toString(16).toUpperCase()}function i(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(h){return"\\x0"+r(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+r(h)})}function s(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(h){return"\\x0"+r(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+r(h)})}function o(c){return t[c.type](c)}function a(c){var h=c.map(o),f,p;if(h.sort(),h.length>0){for(f=1,p=1;f<h.length;f++)h[f-1]!==h[f]&&(h[p]=h[f],p++);h.length=p}switch(h.length){case 1:return h[0];case 2:return h[0]+" or "+h[1];default:return h.slice(0,-1).join(", ")+", or "+h[h.length-1]}}function l(c){return c?'"'+i(c)+'"':"end of input"}return"Expected "+a(n)+" but "+l(e)+" found."};const fr="idle",Hr="panning",Gr="zooming",Ar="auto",gi="none",Cr="pan",Wr="zoom-in",_i="zoom-out",Cc="none",vi="top",dr="right",xi="bottom",Hn="left",Rc="zoom",rl="pan",Ao="center",Co="left",Wf="right",Ro="top",jf="bottom",Xg="cover";function $g(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Pc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$g(Object(t),!0).forEach(function(r){nS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):$g(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function nS(n,e,t){return(e=rS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rS(n){var e=iS(n,"string");return typeof e=="symbol"?e:e+""}function iS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}const Yg=3,Kg=fr;function Zg(n,e,t,r,i,s){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,a=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null;return jt({},Pc(Pc({},Wg()),{},{version:Yg,mode:Kg,focus:!1,pinchPointDistance:null,prePinchMode:null,viewerWidth:n,viewerHeight:e,SVGMinX:t,SVGMinY:r,SVGWidth:i,SVGHeight:s,scaleFactorMin:o,scaleFactorMax:a,startX:null,startY:null,endX:null,endY:null,miniatureOpen:!0,lastAction:null}))}function jt(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;return n=Object.assign({},n,e,{lastAction:t}),Object.freeze(n)}function sS(n){return n!==null&&typeof n=="object"&&n.hasOwnProperty("version")&&n.version===Yg}function Rr(n,e,t){let r=nl(n),i=jg(r);return Hg(i,{x:e,y:t})}function Ic(n){let e=nl(n);return{scaleFactor:e.a,translationX:e.e,translationY:e.f}}function oS(n,e){return jt(n,{focus:e})}function aS(n,e,t){return jt(n,{viewerWidth:e,viewerHeight:t})}function Jg(n,e,t,r,i){return jt(n,{SVGMinX:e,SVGMinY:t,SVGWidth:r,SVGHeight:i})}function lS(n,e,t){return jt(n,{scaleFactorMin:e,scaleFactorMax:t})}function cS(n,e,t,r){let{viewerWidth:i,viewerHeight:s}=n,o=Ni(hr(-e+i/2,-t+s/2),hr(e,t),Fs(r,r),hr(-e,-t));return jt(n,Pc({mode:fr},o))}function uS(n){return jt(n,Pc({mode:fr},Wg()))}function Qg(n){return jt(n,{mode:Kg,startX:null,startY:null,endX:null,endY:null})}class e1{constructor(e,t,r){this.originalEvent=e,this.value=t,this.SVGViewer=r}get scaleFactor(){return this._cacheDecomposedValue=this._cacheDecomposedValue||Ic(this.value),this._cacheDecomposedValue.scaleFactor}get translationX(){return this._cacheDecomposedValue=this._cacheDecomposedValue||Ic(this.value),this._cacheDecomposedValue.translationX}get translationY(){return this._cacheDecomposedValue=this._cacheDecomposedValue||Ic(this.value),this._cacheDecomposedValue.translationY}preventDefault(){this.originalEvent.preventDefault()}stopPropagation(){this.originalEvent.stopPropagation()}}function t1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function hS(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?t1(Object(t),!0).forEach(function(r){fS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):t1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function fS(n,e,t){return(e=dS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dS(n){var e=pS(n,"string");return typeof e=="symbol"?e:e+""}function pS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Xf(n,e,t){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:void 0,i=Ni(nl(n),hr(e,t));if(r){let[{x:s,y:o},{x:a,y:l}]=Gg(i,[{x:n.SVGMinX+r,y:n.SVGMinY+r},{x:n.SVGMinX+n.SVGWidth-r,y:n.SVGMinY+n.SVGHeight-r}]),c=0;n.viewerWidth-s<0?c=n.viewerWidth-s:a<0&&(c=-a);let h=0;n.viewerHeight-o<0?h=n.viewerHeight-o:l<0&&(h=-l),i=Ni(hr(c,h),i)}return jt(n,hS({mode:fr},i),rl)}function mS(n,e,t){return jt(n,{mode:Hr,startX:e,startY:t,endX:e,endY:t},rl)}function gS(n,e,t,r){if(n.mode!==Hr)throw new Error("update pan not allowed in this mode "+n.mode);let{endX:i,endY:s}=n,o=Rr(n,i,s),a=Rr(n,e,t),l=a.x-o.x,c=a.y-o.y,h=Xf(n,l,c,r);return jt(h,{mode:Hr,endX:e,endY:t},rl)}function n1(n){return jt(n,{mode:fr,startX:null,startY:null,endX:null,endY:null},rl)}function _S(n,e,t){let r=0,i=0;return t<=20&&(i=2),n.viewerWidth-e<=20&&(r=-2),n.viewerHeight-t<=20&&(i=-2),e<=20&&(r=2),r=r/n.d,i=i/n.d,r===0&&i===0?n:Xf(n,r,i)}function r1(n,e){if(n.x<=e.x&&n.y<=e.y)return{x:n.x,y:n.y,width:e.x-n.x,height:e.y-n.y};if(n.x>=e.x&&n.y<=e.y)return{x:e.x,y:n.y,width:n.x-e.x,height:e.y-n.y};if(n.x>=e.x&&n.y>=e.y)return{x:e.x,y:e.y,width:n.x-e.x,height:n.y-e.y};if(n.x<=e.x&&n.y>=e.y)return{x:n.x,y:e.y,width:e.x-n.x,height:n.y-e.y}}function i1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Po(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?i1(Object(t),!0).forEach(function(r){vS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):i1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function vS(n,e,t){return(e=xS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xS(n){var e=yS(n,"string");return typeof e=="symbol"?e:e+""}function yS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Lc(n,e){const{scaleFactor:t}=Ic(n),r=n.scaleFactorMin&&t*e<n.scaleFactorMin,i=n.scaleFactorMax&&t*e>n.scaleFactorMax;return r&&e<1||i&&e>1}function $f(n,e){let t=e.a;return n.scaleFactorMin!=null&&(t=Math.max(t,n.scaleFactorMin)),n.scaleFactorMax!=null&&(t=Math.min(t,n.scaleFactorMax)),jt(e,{a:t,d:t})}function Io(n,e,t,r){if(Lc(n,r))return n;const i=Ni(nl(n),hr(e,t),Fs(r,r),hr(-e,-t));return jt(n,Po(Po({mode:fr},i),{},{startX:null,startY:null,endX:null,endY:null}),Rc)}function s1(n,e,t,r,i){let{viewerWidth:s,viewerHeight:o}=n,a=s/r,l=o/i,c=Math.min(a,l);const h=Ni(Fs(c,c),hr(-e,-t));return Lc(n,c/n.d)?jt(n,{mode:fr,startX:null,startY:null,endX:null,endY:null}):jt(n,Po(Po({mode:fr},$f(n,h)),{},{startX:null,startY:null,endX:null,endY:null}),Rc)}function o1(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Co,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ro,{viewerWidth:r,viewerHeight:i,SVGMinX:s,SVGMinY:o,SVGWidth:a,SVGHeight:l}=n,c=r/a,h=i/l,f=Math.min(c,h),p=Fs(f,f),d=-s*c,m=-o*h;if(c<h){let _=i-c*l;switch(t){case Ro:m=-o*f;break;case Ao:m=Math.round(_/2)-o*f;break;case jf:m=_-o*f;break;case Xg:p=Fs(h,h);let b=r-h*a;d=s+Math.round(b/2);break}}else{let _=r-h*a;switch(e){case Co:d=-s*f;break;case Ao:d=Math.round(_/2)-s*f;break;case Wf:d=_-s*f;break;case Xg:p=Fs(c,c);let b=i-c*l;m=o+Math.round(b/2);break}}const x=hr(d,m),v=Ni(x,p);return Lc(n,f/n.d)?jt(n,{mode:fr,startX:null,startY:null,endX:null,endY:null}):jt(n,Po(Po({mode:fr},$f(n,v)),{},{startX:null,startY:null,endX:null,endY:null}),Rc)}function SS(n,e){let{viewerWidth:t,viewerHeight:r}=n,i=Rr(n,t/2,r/2);return Io(n,i.x,i.y,e)}function ES(n,e,t){return jt(n,{mode:Gr,startX:e,startY:t,endX:e,endY:t})}function bS(n,e,t){if(n.mode!==Gr)throw new Error("update selection not allowed in this mode "+n.mode);return jt(n,{endX:e,endY:t})}function Yf(n,e,t,r){let{startX:s,startY:o}=n,a=Rr(n,s,o),l=Rr(n,e,t);if(Math.abs(s-e)>7&&Math.abs(o-t)>7){let c=r1(a,l);return s1(n,c.x,c.y,c.width,c.height)}else{let c=Rr(n,e,t);return Io(n,c.x,c.y,r)}}function MS(n,e,t,r,i){return r+(i-r)*(n-e)/(t-e)}function Lo(n,e){let{left:t,top:r}=e.getBoundingClientRect(),i=n.clientX-Math.round(t),s=n.clientY-Math.round(r);return{x:i,y:s}}function a1(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||Lo(n,e);let l=r;switch(t){case _i:let c=Rr(r,o,a);l=Io(r,c.x,c.y,1/i.scaleFactor);break;case Wr:l=ES(r,o,a);break;case Ar:case Cr:l=mS(r,o,a);break;default:return r}return n.preventDefault(),l}function l1(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||Lo(n,e);let l=n.buttons===0,c=r;switch(t){case Wr:r.mode===Gr&&(c=l?Yf(r,o,a,i.scaleFactor):bS(r,o,a));break;case Ar:case Cr:r.mode===Hr&&(c=l?n1(r):gS(r,o,a,i.preventPanOutside?20:void 0));break;default:return r}return n.preventDefault(),c}function c1(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||Lo(n,e);let l=r;switch(t){case _i:r.mode===Gr&&(l=Yf(r,o,a,1/i.scaleFactor));break;case Wr:r.mode===Gr&&(l=Yf(r,o,a,i.scaleFactor));break;case Ar:case Cr:r.mode===Hr&&(l=n1(r));break;default:return r}return n.preventDefault(),l}function wS(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||Lo(n,e);let l=r;if(t===Ar&&!i.disableDoubleClickZoomWithToolAuto){const{modifierKeys:c=[]}=i;let h=Rr(r,o,a),f=(m,x)=>m||n.getModifierState(x),d=c.reduce(f,!1)?1/i.scaleFactor:i.scaleFactor;l=Io(r,h.x,h.y,d)}return n.preventDefault(),l}function TS(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||Lo(n,e);if(!i.detectWheel)return r;let l=Math.max(-1,Math.min(1,n.deltaY)),c=MS(l,-1,1,i.scaleFactorOnWheel,1/i.scaleFactorOnWheel),h=Rr(r,o,a),f=Io(r,h.x,h.y,c);return n.preventDefault(),f}function u1(n,e,t,r,i){let s=oS(r,n.type==="mouseenter");return n.preventDefault(),s}function AS(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,{x:o,y:a}=s;return!([gi,Ar].indexOf(t)>=0)||!i.detectAutoPan||!r.focus?r:_S(r,o,a)}class CS extends e1{get point(){if(!this._cachePoint){const{originalEvent:e,SVGViewer:t,value:r}=this,i=Lo(e,t);this._cachePoint=Rr(r,i.x,i.y)}return this._cachePoint}get x(){return this.point.x}get y(){return this.point.y}}function h1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function f1(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?h1(Object(t),!0).forEach(function(r){RS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):h1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function RS(n,e,t){return(e=PS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function PS(n){var e=IS(n,"string");return typeof e=="symbol"?e:e+""}function IS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Oc extends e1{get points(){return this._cachePoints||(this._cachePoints=Oc.touchesToPoints(this.originalEvent.touches,this.SVGViewer,this.value)),this._cachePoints}get changedPoints(){return this._cacheChangedPoints||(this._cacheChangedPoints=Oc.touchesToPoints(this.originalEvent.changedTouches,this.SVGViewer,this.value)),this._cacheChangedPoints}static touchesToPoints(e,t,r){let i=[];for(let s=0;s<e.length;s++){let o=e[s],a=t.getBoundingClientRect(),l=o.clientX-Math.round(a.left),c=o.clientY-Math.round(a.top),h=Rr(r,l,c);i.push(f1(f1({},h),{},{identifier:o.identifier}))}return i}}function LS(n,e,t){let r=n.type;switch(r){case"mousemove":case"mouseup":case"mousedown":case"click":case"dblclick":return new CS(n,e,t);case"touchstart":case"touchmove":case"touchend":case"touchcancel":return new Oc(n,e,t);default:throw new Error(`${r} not supported`)}}function d1(n){return n.split(/[ ,]/).filter(Boolean).map(Number)}function p1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function m1(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?p1(Object(t),!0).forEach(function(r){OS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):p1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function OS(n,e,t){return(e=qS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qS(n){var e=DS(n,"string");return typeof e=="symbol"?e:e+""}function DS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function NS(n,e){let{left:t,top:r}=e.getBoundingClientRect(),i=n.clientX-Math.round(t),s=n.clientY-Math.round(r);return{x:i,y:s}}function US(n,e,t,r,i){if(_1(n,i))return v1(n,e,t,r);if(n.touches.length!==1){if([Hr,Gr].indexOf(r.mode)>=0)return Qg(r);if([fr].indexOf(r.mode)>=0)return r}return Kf(n,e,t,r,i,a1)}function FS(n,e,t,r,i){return _1(n,i)?v1(n,e,t,r):[Hr,Gr].indexOf(r.mode)>=0?Kf(n,e,t,r,i,l1):r}function zS(n,e,t,r,i){if(!([Hr,Gr].indexOf(r.mode)>=0))return r;let s=BS(n,r,i)?jt(r,{pinchPointDistance:null}):r;return n.touches.length>0?s:Kf(n,e,t,s,i,c1)}function kS(n,e,t,r,i){return n.stopPropagation(),n.preventDefault(),Qg(r)}function g1(n){return typeof n.pinchPointDistance=="number"}function BS(n,e,t){return t.detectPinchGesture&&g1(e)&&n.touches.length<2}function _1(n,e){return e.detectPinchGesture&&n.touches.length>1}function Kf(n,e,t,r,i,s){let o=n.touches.length===0?jt(r,{mode:r.prePinchMode?fr:r.mode,prePinchMode:null}):r,a=n.touches.length>0?n.touches[0]:n.changedTouches[0],l=NS(a,e);switch(t){case _i:case Wr:case Ar:case Cr:return n.stopPropagation(),n.preventDefault(),s(n,e,t,o,i,l);default:return o}}function v1(n,e,t,r,i){const{left:s,top:o}=e.getBoundingClientRect(),a=n.touches[0].clientX-Math.round(s),l=n.touches[0].clientY-Math.round(o),c=n.touches[1].clientX-Math.round(s),h=n.touches[1].clientY-Math.round(o),f=Math.sqrt(Math.pow(c-a,2)+Math.pow(h-l,2)),p=g1(r)?r.pinchPointDistance:f,d=Rr(r,(a+c)/2,(l+h)/2);let m=f/p;if(Lc(r,m))return r;n.cancelable&&n.preventDefault();let x=Ni(nl(r),hr(d.x,d.y),Fs(m,m),hr(-d.x,-d.y));return jt(r,jt(m1(m1({mode:Gr},$f(r,x)),{},{startX:null,startY:null,endX:null,endY:null,prePinchMode:r.prePinchMode?r.prePinchMode:r.mode,pinchPointDistance:f})))}function x1(n){return jt(n,{miniatureOpen:!0})}function y1(n){return jt(n,{miniatureOpen:!1})}let VS=n=>["zoom-in","zoom-out","grab","grabbing"].indexOf(n)>-1,S1=()=>navigator.userAgent.toLowerCase(),HS=()=>S1().indexOf("firefox")>-1,GS=()=>S1().indexOf("webkit")>-1;function qc(n){if(!VS(n))return n;if(HS())return`-moz-${n}`;if(GS())return`-webkit-${n}`}function WS(n){return n.displayName||n.name||"Component"}function Zf(){return Zf=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Zf.apply(null,arguments)}let jS=1;const XS=()=>`uid${jS++}`;function E1(n){class e extends se.Component{constructor(r){super(r),this.state={uid:XS()}}render(){return se.createElement(n,Zf({_uid:this.state.uid},this.props))}}return e.displayName=`RandomUID(${WS(n)})`,e}const b1="react-svg-pan-zoom_border_gradient";function M1(n){let{direction:e,width:t,height:r,_uid:i}=n,s;switch(e){case vi:s=`translate(${t}, 0) rotate(90)`;break;case dr:s=`translate(${t}, ${r}) rotate(180)`;break;case xi:s=`translate(0, ${r}) rotate(270)`;break;case Hn:default:s=" ";break}let o=`${b1}_gradient_${i}`,a=`${b1}_mask_${i}`;return se.createElement("g",null,se.createElement("defs",null,se.createElement("linearGradient",{id:o,x1:"0%",y1:"0%",x2:"100%",y2:"0%",spreadMethod:"pad"},se.createElement("stop",{offset:"0%",stopColor:"#fff",stopOpacity:"0.8"}),se.createElement("stop",{offset:"100%",stopColor:"#000",stopOpacity:"0.5"})),se.createElement("mask",{id:a,x:"0",y:"0",width:"20",height:Math.max(t,r)},se.createElement("rect",{x:"0",y:"0",width:"20",height:Math.max(t,r),style:{stroke:"none",fill:`url(#${o})`}}))),se.createElement("rect",{x:"0",y:"0",width:"20",height:Math.max(t,r),style:{stroke:"none",fill:"#000",mask:`url(#${a})`},transform:s}))}M1.propTypes={direction:_e.oneOf([vi,dr,xi,Hn]).isRequired,width:_e.number.isRequired,height:_e.number.isRequired};const Dc=E1(M1);function w1(n){let{startX:e,startY:t,endX:r,endY:i}=n;if(!e||!t||!r||!i)return null;let s=r1({x:e,y:t},{x:r,y:i});return se.createElement("rect",{stroke:"#969FFF",strokeOpacity:.7,fill:"#F3F4FF",fillOpacity:.7,x:s.x,y:s.y,width:s.width,height:s.height,style:{pointerEvents:"none"}})}w1.propTypes={startX:_e.number,startY:_e.number,endX:_e.number,endY:_e.number};function $S(){return se.createElement("svg",{width:24,height:24,stroke:"currentColor"},se.createElement("path",{d:"M10.07,14.27C10.57,14.03 11.16,14.25 11.4,14.75L13.7,19.74L15.5,18.89L13.19,13.91C12.95,13.41 13.17,12.81 13.67,12.58L13.95,12.5L16.25,12.05L8,5.12V15.9L9.82,14.43L10.07,14.27M13.64,21.97C13.14,22.21 12.54,22 12.31,21.5L10.13,16.76L7.62,18.78C7.45,18.92 7.24,19 7,19A1,1 0 0,1 6,18V3A1,1 0 0,1 7,2C7.24,2 7.47,2.09 7.64,2.23L7.65,2.22L19.14,11.86C19.57,12.22 19.62,12.85 19.27,13.27C19.12,13.45 18.91,13.57 18.7,13.61L15.54,14.23L17.74,18.96C18,19.46 17.76,20.05 17.26,20.28L13.64,21.97Z"}))}function YS(){return se.createElement("svg",{width:24,height:24,stroke:"currentColor"},se.createElement("path",{d:"M13,6V11H18V7.75L22.25,12L18,16.25V13H13V18H16.25L12,22.25L7.75,18H11V13H6V16.25L1.75,12L6,7.75V11H11V6H7.75L12,1.75L16.25,6H13Z"}))}function KS(){return se.createElement("svg",{width:24,height:24,stroke:"currentColor"},se.createElement("g",null,se.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),se.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})))}function ZS(){return se.createElement("svg",{width:24,height:24,stroke:"currentColor"},se.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"}))}function JS(){return se.createElement("svg",{width:24,height:24,stroke:"currentColor"},se.createElement("path",{d:"M15 3l2.3 2.3-2.89 2.87 1.42 1.42L18.7 6.7 21 9V3zM3 9l2.3-2.3 2.87 2.89 1.42-1.42L6.7 5.3 9 3H3zm6 12l-2.3-2.3 2.89-2.87-1.42-1.42L5.3 17.3 3 15v6zm12-6l-2.3 2.3-2.87-2.89-1.42 1.42 2.89 2.87L15 21h6z"}))}let Oo=class extends se.Component{constructor(e){super(e),this.state={hover:!1}}change(e){switch(e.preventDefault(),e.stopPropagation(),e.type){case"mouseenter":case"touchstart":this.setState({hover:!0});break;case"mouseleave":case"touchend":case"touchcancel":this.setState({hover:!1});break}}render(){let e={display:"block",width:"24px",height:"24px",margin:[vi,xi].indexOf(this.props.toolbarPosition)>=0?"2px 1px":"1px 2px",color:this.props.active||this.state.hover?this.props.activeColor:"#FFF",transition:"color 200ms ease",background:"none",padding:"0px",border:"0px",outline:"0px",cursor:"pointer"};return se.createElement("button",{onMouseEnter:t=>this.change(t),onMouseLeave:t=>this.change(t),onTouchStart:t=>{this.change(t),this.props.onClick(t)},onTouchEnd:t=>this.change(t),onTouchCancel:t=>this.change(t),onClick:this.props.onClick,style:e,title:this.props.title,name:this.props.name,type:"button"},this.props.children)}};Oo.propTypes={title:_e.string.isRequired,name:_e.string.isRequired,toolbarPosition:_e.string.isRequired,activeColor:_e.string.isRequired,onClick:_e.func.isRequired,active:_e.bool.isRequired};const QS="#1CA6FC";function T1(n){let{tool:e,value:t,onChangeValue:r,onChangeTool:i,activeToolColor:s=QS,position:o=dr,SVGAlignX:a=Co,SVGAlignY:l=Ro}=n,c=(d,m)=>{i(m),d.stopPropagation(),d.preventDefault()},h=d=>{r(o1(t,a,l)),d.stopPropagation(),d.preventDefault()},f=[vi,xi].indexOf(o)>=0,p={position:"absolute",transform:[vi,xi].indexOf(o)>=0?"translate(-50%, 0px)":"none",top:[Hn,dr,vi].indexOf(o)>=0?"5px":"unset",left:[vi,xi].indexOf(o)>=0?"50%":Hn===o?"5px":"unset",right:[dr].indexOf(o)>=0?"5px":"unset",bottom:[xi].indexOf(o)>=0?"5px":"unset",backgroundColor:"rgba(19, 20, 22, 0.90)",borderRadius:"2px",display:"flex",flexDirection:f?"row":"column",padding:f?"1px 2px":"2px 1px"};return se.createElement("div",{style:p,role:"toolbar"},se.createElement(Oo,{toolbarPosition:o,active:e===gi,activeColor:s,name:"unselect-tools",title:"Selection",onClick:d=>c(d,gi)},se.createElement($S,null)),se.createElement(Oo,{toolbarPosition:o,active:e===Cr,activeColor:s,name:"select-tool-pan",title:"Pan",onClick:d=>c(d,Cr)},se.createElement(YS,null)),se.createElement(Oo,{toolbarPosition:o,active:e===Wr,activeColor:s,name:"select-tool-zoom-in",title:"Zoom in",onClick:d=>c(d,Wr)},se.createElement(KS,null)),se.createElement(Oo,{toolbarPosition:o,active:e===_i,activeColor:s,name:"select-tool-zoom-out",title:"Zoom out",onClick:d=>c(d,_i)},se.createElement(ZS,null)),se.createElement(Oo,{toolbarPosition:o,active:!1,activeColor:s,name:"fit-to-viewer",title:"Fit to viewer",onClick:d=>h(d)},se.createElement(JS,null)))}T1.propTypes={tool:_e.string.isRequired,onChangeTool:_e.func.isRequired,value:_e.object.isRequired,onChangeValue:_e.func.isRequired,position:_e.oneOf([vi,dr,xi,Hn]),SVGAlignX:_e.oneOf([Ao,Co,Wf]),SVGAlignY:_e.oneOf([Ao,Ro,jf]),activeToolColor:_e.string};function eE(){return"ontouchstart"in window||navigator.maxTouchPoints}function A1(n){let{open:e,position:t}=n,r=0;switch(t){case Hn:r=e?"rotate(225, 12, 13)":"rotate(45, 12, 13)";break;case dr:r=r=e?"rotate(135, 12, 13)":"rotate(-45, 12, 13)";break}return se.createElement("svg",{width:24,height:24,stroke:"currentColor"},se.createElement("g",{transform:r},se.createElement("path",{fill:"#000000",d:"M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z"})))}A1.propTypes={open:_e.bool.isRequired,position:_e.oneOf([dr,Hn]).isRequired};function C1(n){let{value:e,onChangeValue:t,position:r}=n,i={width:"24px",height:"24px",display:"block",position:"absolute",bottom:0,[r===Hn?"left":"right"]:"0px",background:"rgba(19, 20, 22, 0.901961)",border:0,padding:0,outline:0,color:"#fff"},s=e.miniatureOpen?y1:x1;return se.createElement("button",{type:"button",style:i,onClick:()=>t(s(e))},se.createElement(A1,{open:e.miniatureOpen,position:r}))}C1.propTypes={value:_e.object.isRequired,onChangeValue:_e.func.isRequired,position:_e.oneOf([dr,Hn]).isRequired};const tE="react-svg-pan-zoom_miniature";function R1(n){let{SVGMinX:e,SVGMinY:t,SVGWidth:r,SVGHeight:i,x1:s,y1:o,x2:a,y2:l,zoomToFit:c,_uid:h}=n;const f=`${tE}_mask_${h}`;return se.createElement("g",null,se.createElement("defs",null,se.createElement("mask",{id:f},se.createElement("rect",{x:e,y:t,width:r,height:i,fill:"#ffffff"}),se.createElement("rect",{x:s,y:o,width:a-s,height:l-o}))),se.createElement("rect",{x:e,y:t,width:r,height:i,style:{stroke:"none",fill:"#000",mask:`url(#${f})`,opacity:.4}}))}R1.propTypes={SVGWidth:_e.number.isRequired,SVGHeight:_e.number.isRequired,SVGMinX:_e.number.isRequired,SVGMinY:_e.number.isRequired,x1:_e.number.isRequired,y1:_e.number.isRequired,x2:_e.number.isRequired,y2:_e.number.isRequired,zoomToFit:_e.number.isRequired};const nE=E1(R1),rE="#616264";function P1(n){let{value:e,onChangeValue:t,children:r,SVGBackground:i,background:s=rE,position:o=Hn,width:a=100,height:l=80}=n,{SVGMinX:c,SVGMinY:h,SVGWidth:f,SVGHeight:p,viewerWidth:d,viewerHeight:m}=e,x=p/f,v=x>=1?l/p:a/f,[{x:_,y:b},{x:M,y:E}]=Gg(jg(e),[{x:0,y:0},{x:d,y:m}]),S,T;e.miniatureOpen?(S=a,T=l):(S=24,T=24);let q={position:"absolute",overflow:"hidden",outline:"1px solid rgba(19, 20, 22, 0.90)",transition:"width 200ms ease, height 200ms ease, bottom 200ms ease",width:S+"px",height:T+"px",bottom:"6px",[o===Hn?"left":"right"]:"6px",background:s},O=x>=1?`translate(${(a-f*v)/2-c*v}, ${-h*v})`:`translate(${-c*v}, ${(l-p*v)/2-h*v})`;return se.createElement("div",{role:"navigation",style:q},se.createElement("svg",{width:a,height:l,style:{pointerEvents:"none"}},se.createElement("g",{transform:O},se.createElement("g",{transform:`scale(${v}, ${v})`},se.createElement("rect",{fill:i,x:c,y:h,width:f,height:p}),r,se.createElement(nE,{SVGWidth:f,SVGHeight:p,SVGMinX:c,SVGMinY:h,x1:_,y1:b,x2:M,y2:E,zoomToFit:v})))),se.createElement(C1,{value:e,onChangeValue:t,position:o}))}P1.propTypes={value:_e.object.isRequired,onChangeValue:_e.func.isRequired,SVGBackground:_e.string.isRequired,position:_e.oneOf([dr,Hn]),background:_e.string,width:_e.number,height:_e.number};function zs(n){return typeof n>"u"||n===null}const Jf="https://github.com/chrvadala/react-svg-pan-zoom/blob/main"+"/docs/migrate-from-v2-to-v3.md";function iE(){console.error(`HEY! With ReactSVGPanZoom >= 3 you MUST specify value and tool props. Please read here ${Jf}`)}function sE(){console.error(`HEY! With ReactSVGPanZoom >= 3 the props miniaturePosition, miniatureBackground, miniatureWidth, miniatureHeight can be specified as key in the miniatureProps object. Please read here ${Jf}`)}function oE(){console.error(`HEY! With ReactSVGPanZoom >= 3 the prop toolbarPosition can be specified as key in the toolbarProps object. Please read here ${Jf}`)}function I1(n){(zs(n.tool)||zs(n.value))&&iE(),(!zs(n.miniaturePosition)||!zs(n.miniatureBackground)||!zs(n.miniatureWidth)||!zs(n.miniatureHeight))&&sE(),zs(n.toolbarPosition)||oE()}function Nc(){return Nc=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Nc.apply(null,arguments)}function L1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function aE(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?L1(Object(t),!0).forEach(function(r){lE(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):L1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function lE(n,e,t){return(e=cE(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cE(n){var e=uE(n,"string");return typeof e=="symbol"?e:e+""}function uE(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Uc extends se.Component{constructor(e,t){const{width:r,height:i,scaleFactorMin:s,scaleFactorMax:o,children:a}=e,{viewBox:l}=a.props;let c;if(l){const[h,f,p,d]=d1(l);c=Zg(r,i,h,f,p,d,s,o)}else{const{width:h,height:f}=a.props;c=Zg(r,i,0,0,h,f,s,o)}super(e,t),this.ViewerDOM=null,this.state={pointerX:null,pointerY:null,defaultValue:c},this.autoPanLoop=this.autoPanLoop.bind(this),this.onWheel=this.onWheel.bind(this),process.env.NODE_ENV!=="production"&&I1(e)}componentDidUpdate(e){const t=this.getValue(),r=this.props;let i=t,s=!1;process.env.NODE_ENV!=="production"&&I1(r);const{viewBox:o}=r.children.props;if(o){const[a,l,c,h]=d1(o);(t.SVGMinX!==a||t.SVGMinY!==l||t.SVGWidth!==c||t.SVGHeight!==h)&&(i=Jg(i,a,l,c,h),s=!0)}else{const{width:a,height:l}=r.children.props;(t.SVGWidth!==a||t.SVGHeight!==l)&&(i=Jg(i,0,0,a,l),s=!0)}(e.width!==r.width||e.height!==r.height)&&(i=aS(i,r.width,r.height),s=!0),(e.scaleFactorMin!==r.scaleFactorMin||e.scaleFactorMax!==r.scaleFactorMax)&&(i=lS(i,r.scaleFactorMin,r.scaleFactorMax),s=!0),s&&this.setValue(i)}componentDidMount(){this.autoPanIsRunning=!0,requestAnimationFrame(this.autoPanLoop),this.ViewerDOM.addEventListener("wheel",this.onWheel,!1)}componentWillUnmount(){this.autoPanIsRunning=!1,this.ViewerDOM.removeEventListener("wheel",this.onWheel)}getValue(){return sS(this.props.value)?this.props.value:this.state.defaultValue}getTool(){return this.props.tool?this.props.tool:gi}setValue(e){let{onChangeValue:t,onZoom:r,onPan:i}=this.props;t&&t(e),e.lastAction&&(r&&e.lastAction===Rc&&r(e),i&&e.lastAction===rl&&i(e))}pan(e,t){let r=Xf(this.getValue(),e,t);this.setValue(r)}zoom(e,t,r){let i=Io(this.getValue(),e,t,r);this.setValue(i)}fitSelection(e,t,r,i){let s=s1(this.getValue(),e,t,r,i);this.setValue(s)}fitToViewer(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Co,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ro,r=o1(this.getValue(),e,t);this.setValue(r)}zoomOnViewerCenter(e){let t=SS(this.getValue(),e);this.setValue(t)}setPointOnViewerCenter(e,t,r){let i=cS(this.getValue(),e,t,r);this.setValue(i)}reset(){let e=uS(this.getValue());this.setValue(e)}openMiniature(){let e=x1(this.getValue());this.setValue(e)}closeMiniature(){let e=y1(this.getValue());this.setValue(e)}handleViewerEvent(e){let{props:t,ViewerDOM:r}=this;if(!([gi,Ar].indexOf(this.getTool())>=0)||e.target===r)return;let s={click:t.onClick,dblclick:t.onDoubleClick,mousemove:t.onMouseMove,mouseup:t.onMouseUp,mousedown:t.onMouseDown,touchstart:t.onTouchStart,touchmove:t.onTouchMove,touchend:t.onTouchEnd,touchcancel:t.onTouchCancel}[e.type];s&&s(LS(e,t.value,r))}autoPanLoop(){let e={x:this.state.pointerX,y:this.state.pointerY},t=AS(null,this.ViewerDOM,this.getTool(),this.getValue(),this.props,e);this.getValue()!==t&&this.setValue(t),this.autoPanIsRunning&&requestAnimationFrame(this.autoPanLoop)}onWheel(e){let t=TS(e,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==t&&this.setValue(t)}render(){let{props:e,state:{pointerX:t,pointerY:r}}=this,i=this.getTool(),s=this.getValue(),{customToolbar:o=T1,customMiniature:a=P1}=e,l=i===Ar&&s.mode===Hr&&s.startX!==s.endX&&s.startY!==s.endY,c;i===Cr&&(c=qc(s.mode===Hr?"grabbing":"grab")),i===Wr&&(c=qc("zoom-in")),i===_i&&(c=qc("zoom-out")),l&&(c=qc("grabbing"));let h=[Cr,Wr,_i].indexOf(i)>=0;h=h||l;const f=this.props.detectPinchGesture||[Cr,Ar].indexOf(this.getTool())!==-1?"none":void 0,p={display:"block",cursor:c,touchAction:f};return se.createElement("div",{style:aE({position:"relative",width:s.viewerWidth,height:s.viewerHeight},e.style),className:this.props.className},se.createElement("svg",{ref:d=>this.ViewerDOM=d,width:s.viewerWidth,height:s.viewerHeight,style:p,onMouseDown:d=>{let m=a1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onMouseMove:d=>{let{left:m,top:x}=this.ViewerDOM.getBoundingClientRect(),v=d.clientX-Math.round(m),_=d.clientY-Math.round(x),b=l1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props,{x:v,y:_});this.getValue()!==b&&this.setValue(b),this.setState({pointerX:v,pointerY:_}),this.handleViewerEvent(d)},onMouseUp:d=>{let m=c1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onClick:d=>{this.handleViewerEvent(d)},onDoubleClick:d=>{let m=wS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onMouseEnter:d=>{if(eE())return;let m=u1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m)},onMouseLeave:d=>{let m=u1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m)},onTouchStart:d=>{let m=US(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onTouchMove:d=>{let m=FS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onTouchEnd:d=>{let m=zS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onTouchCancel:d=>{let m=kS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)}},se.createElement("rect",{fill:e.background,x:0,y:0,width:s.viewerWidth,height:s.viewerHeight,style:{pointerEvents:"none"}}),se.createElement("g",{transform:Q3(s),style:h?{pointerEvents:"none"}:{}},se.createElement("rect",{fill:this.props.SVGBackground,style:this.props.SVGStyle,x:s.SVGMinX||0,y:s.SVGMinY||0,width:s.SVGWidth,height:s.SVGHeight}),se.createElement("g",null,e.children.props.children)),[gi,Ar].indexOf(i)>=0&&e.detectAutoPan&&s.focus?se.createElement("g",{style:{pointerEvents:"none"}},r<=20?se.createElement(Dc,{direction:vi,width:s.viewerWidth,height:s.viewerHeight}):null,s.viewerWidth-t<=20?se.createElement(Dc,{direction:dr,width:s.viewerWidth,height:s.viewerHeight}):null,s.viewerHeight-r<=20?se.createElement(Dc,{direction:xi,width:s.viewerWidth,height:s.viewerHeight}):null,s.focus&&t<=20?se.createElement(Dc,{direction:Hn,width:s.viewerWidth,height:s.viewerHeight}):null):null,s.mode!==Gr?null:se.createElement(w1,{startX:s.startX,startY:s.startY,endX:s.endX,endY:s.endY})),e.toolbarProps.position===Cc?null:se.createElement(o,Nc({},this.props.toolbarProps,{value:s,onChangeValue:d=>this.setValue(d),tool:i,onChangeTool:d=>this.props.onChangeTool(d)})),e.miniatureProps.position===Cc?null:se.createElement(a,Nc({},this.props.miniatureProps,{value:s,onChangeValue:d=>this.setValue(d),SVGBackground:this.props.SVGBackground}),e.children.props.children))}}Uc.propTypes={width:_e.number.isRequired,height:_e.number.isRequired,value:_e.oneOfType([_e.object,_e.shape({version:_e.oneOf([2]).isRequired,mode:_e.oneOf([fr,Hr,Gr]).isRequired,focus:_e.bool.isRequired,a:_e.number.isRequired,b:_e.number.isRequired,c:_e.number.isRequired,d:_e.number.isRequired,e:_e.number.isRequired,f:_e.number.isRequired,viewerWidth:_e.number.isRequired,viewerHeight:_e.number.isRequired,SVGMinX:_e.number.isRequired,SVGMinY:_e.number.isRequired,SVGWidth:_e.number.isRequired,SVGHeight:_e.number.isRequired,startX:_e.number,startY:_e.number,endX:_e.number,endY:_e.number,miniatureOpen:_e.bool.isRequired})]).isRequired,onChangeValue:_e.func.isRequired,tool:_e.oneOf([Ar,gi,Cr,Wr,_i]).isRequired,onChangeTool:_e.func.isRequired,background:_e.string,SVGBackground:_e.string,SVGStyle:_e.object,style:_e.object,className:_e.string,detectWheel:_e.bool,detectAutoPan:_e.bool,detectPinchGesture:_e.bool,onZoom:_e.func,onPan:_e.func,onClick:_e.func,onDoubleClick:_e.func,onMouseUp:_e.func,onMouseMove:_e.func,onMouseDown:_e.func,preventPanOutside:_e.bool,scaleFactor:_e.number,scaleFactorOnWheel:_e.number,scaleFactorMax:_e.number,scaleFactorMin:_e.number,modifierKeys:_e.array,disableDoubleClickZoomWithToolAuto:_e.bool,customMiniature:_e.oneOfType([_e.element,_e.func]),miniatureProps:_e.shape({position:_e.oneOf([Cc,dr,Hn]),background:_e.string,width:_e.number,height:_e.number}),customToolbar:_e.oneOfType([_e.element,_e.func]),toolbarProps:_e.shape({position:_e.oneOf([Cc,vi,dr,xi,Hn]),SVGAlignX:_e.oneOf([Ao,Co,Wf]),SVGAlignY:_e.oneOf([Ao,Ro,jf]),activeToolColor:_e.string}),children:function(n,e,t){let r=n[e],i=["svg"];if(se.Children.count(r)!==1||i.indexOf(r.type)===-1)return new Error("`"+t+"` should have a single child of the following types: `"+i.join("`, `")+"`.");if((!r.props.hasOwnProperty("width")||!r.props.hasOwnProperty("height"))&&!r.props.hasOwnProperty("viewBox"))return new Error("SVG should have props `width` and `height` or `viewBox`")}},Uc.defaultProps={style:{},background:"#616264",SVGBackground:"#fff",SVGStyle:{},detectWheel:!0,detectAutoPan:!0,detectPinchGesture:!0,modifierKeys:["Alt","Shift","Control"],preventPanOutside:!0,scaleFactor:1.1,scaleFactorOnWheel:1.06,disableZoomWithToolAuto:!1,onZoom:null,onPan:null,toolbarProps:{},miniatureProps:{}};const hE=["width","height","onChangeTool","onChangeValue"];function Qf(){return Qf=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Qf.apply(null,arguments)}function fE(n,e){if(n==null)return{};var t,r,i=dE(n,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r<s.length;r++)t=s[r],e.includes(t)||{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function dE(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.includes(r))continue;t[r]=n[r]}return t}class pE extends se.Component{constructor(e){super(e),this.state={value:e.defaultValue||{},tool:e.defaultTool||gi},this.Viewer=null,this.changeTool=this.changeTool.bind(this),this.changeValue=this.changeValue.bind(this)}changeTool(e){this.setState({tool:e})}changeValue(e){this.setState({value:e})}pan(e,t){this.Viewer.pan(e,t)}zoom(e,t,r){this.Viewer.zoom(e,t,r)}fitSelection(e,t,r,i){this.Viewer.fitSelection(e,t,r,i)}fitToViewer(e,t){this.Viewer.fitToViewer(e,t)}zoomOnViewerCenter(e){this.Viewer.zoomOnViewerCenter(e)}setPointOnViewerCenter(e,t,r){this.Viewer.setPointOnViewerCenter(e,t,r)}reset(){this.Viewer.reset()}openMiniature(){this.Viewer.openMiniature()}closeMiniature(){this.Viewer.closeMiniature()}render(){const e=this.props,{width:t,height:r,onChangeTool:i,onChangeValue:s}=e,o=fE(e,hE),{tool:a,value:l}=this.state;return se.createElement(Uc,Qf({width:t,height:r,tool:a,onChangeTool:this.changeTool,value:l,onChangeValue:this.changeValue,ref:c=>this.Viewer=c},o))}}pE.propTypes={width:_e.number.isRequired,height:_e.number.isRequired,defaultValue:_e.object,defaultTool:_e.string};const Xt=V2(n=>({planner:new vc,viewer:null,plan:null,toast:null,activeFloor:0,setViewer:e=>{n(t=>({...t,viewer:e}))},setToast:e=>{n(t=>({...t,toast:e}))},setActiveFloor:e=>{n(t=>({...t,activeFloor:e}))},newProject:()=>{n(e=>({...e,planner:Vt.newProject(e.planner).updatedState}))},selectTool3DView:()=>{n(e=>{const r=Vt.rollback(e.planner).updatedState.set("mode",Oi);return{...e,planner:r}})},selectTool3DFirstPerson:()=>{n(e=>{const r=Vt.rollback(e.planner).updatedState.set("mode",Mo);return{...e,planner:r}})},loadProject:e=>{n(t=>{const r=new vc({scene:e,catalog:t.planner.catalog.toJS()});return{...t,planner:r}})},undo:()=>{n(e=>{const t=Vt.undo(e.planner).updatedState;return{...e,planner:t}})},redo:()=>{n(e=>{const t=Vt.redo(e.planner).updatedState;return{...e,planner:t}})},addLayer:(e,t)=>{n(r=>{const i=at.create(r.planner,e,t).updatedState;return{...r,planner:i}})},removeLayer:e=>{n(t=>{const r=at.remove(t.planner,e).updatedState;return{...t,planner:r}})},addGroup:()=>{n(e=>{const t=dn.create(e.planner).updatedState;return{...e,planner:t}})},selectGroup:e=>{n(t=>{const r=dn.select(t.planner,e).updatedState;return{...t,planner:r}})},setGroupProperties:(e,t)=>{n(r=>{const i=dn.setProperties(r.planner,e,t).updatedState;return{...r,planner:i}})},addToGroup:(e,t,r,i)=>{n(s=>{const o=dn.addElement(s.planner,e,t,r,i).updatedState;return{...s,planner:o}})},removeGroup:e=>{n(t=>{const r=dn.remove(t.planner,e).updatedState;return{...t,planner:r}})},setGroupAttributes:(e,t)=>{n(r=>{const i=dn.setAttributes(r.planner,e,t).updatedState;return{...r,planner:i}})},groupTranslate:(e,t,r)=>{n(i=>{const s=dn.translate(i.planner,e,t,r).updatedState;return{...i,planner:s}})},removeFromGroup:(e,t,r,i)=>{n(s=>{const o=dn.removeElement(s.planner,e,t,r,i).updatedState;return{...s,planner:o}})},groupRotate:(e,t)=>{n(r=>{const i=dn.rotate(r.planner,e,t).updatedState;return{...r,planner:i}})},removeGroupAndDeleteElements:e=>{n(t=>{const r=dn.removeAndDeleteElements(t.planner,e).updatedState;return{...t,planner:r}})},addGroupFromSelected:()=>{n(e=>{const t=dn.createFromSelectedElements(e.planner).updatedState;return{...e,planner:t}})},copyProperties:e=>{n(t=>({...t,planner:Vt.copyProperties(t.planner,e).updatedState}))},pasteProperties:()=>{n(e=>{const t=e.planner.merge({sceneHistory:an(e.planner.sceneHistory,e.planner.scene)});return{...e,planner:Vt.pasteProperties(t).updatedState}})},setProperties:e=>{n(t=>{const r=t.planner.merge({sceneHistory:an(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Vt.setProperties(r,r.getIn(["scene","selectedLayer"]),e).updatedState}})},setHolesAttributes:e=>{n(t=>{const r=e.set("offset",parseFloat(e.get("offset"))),i=t.planner.merge({sceneHistory:an(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Vt.setHolesAttributes(i,r).updatedState}})},setLinesAttributes:e=>{n(t=>{const r=e.withMutations(s=>{s.setIn(["vertexOne","x"],parseFloat(e.getIn(["vertexOne","x"]))),s.setIn(["vertexOne","y"],parseFloat(e.getIn(["vertexOne","y"]))),s.setIn(["vertexTwo","x"],parseFloat(e.getIn(["vertexTwo","x"]))),s.setIn(["vertexTwo","y"],parseFloat(e.getIn(["vertexTwo","y"])))}),i=t.planner.merge({sceneHistory:an(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Vt.setLinesAttributes(i,r).updatedState}})},setItemsAttributes:e=>{n(t=>{const r=e.set("rotation",parseFloat(e.get("rotation"))),i=t.planner.merge({sceneHistory:an(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Vt.setItemsAttributes(i,r).updatedState}})},selectLine:(e,t)=>{n(r=>{const i=Mn.select(r.planner,e,t).updatedState;return{...r,planner:i}})},selectHole:(e,t)=>{n(r=>{const i=fn.select(r.planner,e,t).updatedState;return{...r,planner:i}})},selectItem:(e,t)=>{n(r=>{const i=_n.select(r.planner,e,t).updatedState;return{...r,planner:i}})},selectLayer:e=>{n(t=>{const r=at.select(t.planner,e).updatedState;return{...t,planner:r}})},setLayerProperties:(e,t)=>{n(r=>{const i=at.setProperties(r.planner,e,t).updatedState;return{...r,planner:i}})},addVerticalGuide:e=>{n(t=>{const r=Mc.create(t.planner,e).updatedState;return{...t,planner:r}})},addHorizontalGuide:e=>{n(t=>{const r=bc.create(t.planner,e).updatedState;return{...t,planner:r}})},removeVerticalGuide:e=>{n(t=>{const r=Mc.remove(t.planner,e).updatedState;return{...t,planner:r}})},removeHorizontalGuide:e=>{n(t=>{const r=bc.remove(t.planner,e).updatedState;return{...t,planner:r}})},toggleSnap:e=>{n(t=>{const r=Vt.toggleSnap(t.planner,e).updatedState;return{...t,planner:r}})},openProjectConfigurator:()=>{n(e=>{const t=Vt.openProjectConfigurator(e.planner).updatedState;return{...e,planner:t}})},setMode:e=>{n(t=>{const r=t.planner.set("mode",e);return{...t,planner:r}})},updateZoomScale:e=>{n(t=>({...t,planner:Vt.updateZoomScale(t.planner,e).updatedState}))},updateCameraView:e=>{n(t=>{const r=t.planner.update("viewer2D",i=>i.merge(At(e)));return{...t,planner:r}})},selectToolPan:()=>{n(e=>{const t=e.planner.set("mode",Ns);return{...e,planner:t}})},selectToolEdit:()=>{n(e=>({...e,planner:Vt.setMode(e.planner,rn).updatedState}))},selectToolZoomIn:()=>{n(e=>{const t=e.planner.set("mode",qs);return{...e,planner:t}})},selectToolZoomOut:()=>{n(e=>{const t=e.planner.set("mode",Ds);return{...e,planner:t}})},updateDrawingLine:(e,t)=>{n(r=>({...r,planner:Mn.updateDrawingLine(r.planner,e,t).updatedState}))},updateMouseCoord:e=>{n(t=>({...t,planner:Vt.updateMouseCoord(t.planner,e).updatedState}))},openCatalog:()=>{n(e=>{const t=e.planner.set("mode",sf);return{...e,planner:t}})},updateDrawingHole:(e,t,r)=>{n(i=>({...i,planner:fn.updateDrawingHole(i.planner,e,t,r).updatedState}))},updateDrawingItem:(e,t,r)=>{n(i=>({...i,planner:_n.updateDrawingItem(i.planner,e,t,r).updatedState}))},blur:()=>{n(e=>{const t=e.planner.merge({mode:rn,activeSnapElement:null});return{...e,planner:t}})},updateDraggingHole:(e,t)=>{n(r=>({...r,planner:fn.updateDraggingHole(r.planner,e,t).updatedState}))},updateDraggingLine:(e,t)=>{n(r=>({...r,planner:Mn.updateDraggingLine(r.planner,e,t).updatedState}))},updateDraggingVertex:(e,t)=>{n(r=>({...r,planner:ln.updateDraggingVertex(r.planner,e,t).updatedState}))},updateDraggingItem:(e,t)=>{n(r=>({...r,planner:_n.updateDraggingItem(r.planner,e,t).updatedState}))},updateRotatingItem:(e,t)=>{n(r=>({...r,planner:_n.updateRotatingItem(r.planner,e,t).updatedState}))},beginDraggingLine:(e,t,r,i)=>{n(s=>{const o=s.planner.merge({sceneHistory:an(s.planner.sceneHistory,s.planner.scene)});return{...s,planner:Mn.beginDraggingLine(o,e,t,r,i).updatedState}})},endDraggingLine:(e,t)=>{n(r=>{const i=r.planner.merge({sceneHistory:an(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:Mn.endDraggingLine(i,e,t).updatedState}})},beginDraggingVertex:(e,t)=>{n(r=>({...r,planner:ln.beginDraggingVertex(r.planner,e,t).updatedState}))},endDraggingVertex:()=>{n(e=>({...e,planner:ln.endDraggingVertex(e.planner).updatedState}))},beginRotatingItem:(e,t,r,i)=>{n(s=>{const o=s.planner.merge({sceneHistory:an(s.planner.sceneHistory,s.planner.scene)});return{...s,planner:_n.beginRotatingItem(o,e,t,r,i).updatedState}})},endRotatingItem:(e,t)=>{n(r=>{const i=r.planner.merge({sceneHistory:an(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:_n.endRotatingItem(i,e,t).updatedState}})},beginDraggingItem:(e,t,r,i)=>{n(s=>{const o=s.planner.merge({sceneHistory:an(s.planner.sceneHistory,s.planner.scene)});return{...s,planner:_n.beginDraggingItem(o,e,t,r,i).updatedState}})},endDraggingItem:(e,t)=>{n(r=>{const i=r.planner.merge({sceneHistory:an(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:_n.endDraggingItem(i,e,t).updatedState}})},beginDraggingHole:(e,t,r,i)=>{n(s=>{const o=s.planner.merge({sceneHistory:an(s.planner.sceneHistory,s.planner.scene)});return{...s,planner:fn.beginDraggingHole(o,e,t,r,i).updatedState}})},endDraggingHole:(e,t)=>{n(r=>{const i=r.planner.merge({sceneHistory:an(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:fn.endDraggingHole(i,e,t).updatedState}})},beginDrawingLine:(e,t,r)=>{n(i=>{const s=i.planner.merge({sceneHistory:an(i.planner.sceneHistory,i.planner.scene)});return{...i,planner:Mn.beginDrawingLine(s,e,t,r).updatedState}})},endDrawingLine:(e,t)=>{n(r=>{const i=r.planner.merge({sceneHistory:an(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:Mn.endDrawingLine(i,e,t).updatedState}})},endDrawingHole:(e,t,r)=>{n(i=>{const s=i.planner.merge({sceneHistory:an(i.planner.sceneHistory,i.planner.scene)});return{...i,planner:fn.endDrawingHole(s,e,t,r).updatedState}})},endDrawingItem:(e,t,r)=>{n(i=>{const s=i.planner.merge({sceneHistory:an(i.planner.sceneHistory,i.planner.scene)});return{...i,planner:_n.endDrawingItem(s,e,t,r).updatedState}})},selectArea:(e,t)=>{n(r=>({...r,planner:Us.select(r.planner,e,t).updatedState}))},initCatalog:e=>{n(t=>({...t,planner:Vt.initCatalog(t.planner,e).updatedState}))},goBackToCatalogPage:e=>{n(t=>({...t,planner:Vt.goBackToCatalogPage(t.planner,e).updatedState}))},pushLastSelectedCatalogElementToHistory:e=>{n(t=>({...t,planner:Vt.pushLastSelectedCatalogElementToHistory(t.planner,e).updatedState}))},selectToolDrawingLine:e=>{n(t=>({...t,planner:Mn.selectToolDrawingLine(t.planner,e).updatedState}))},selectToolDrawingItem:e=>{n(t=>{const r=t.planner.merge({sceneHistory:an(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:_n.selectToolDrawingItem(r,e).updatedState}})},selectToolDrawingHole:e=>{n(t=>{const r=t.planner.merge({sceneHistory:an(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:fn.selectToolDrawingHole(r,e).updatedState}})},changeCatalogPage:(e,t)=>{n(r=>({...r,planner:Vt.changeCatalogPage(r.planner,t,e).updatedState}))},remove:()=>{n(e=>{const t=e.planner.merge({sceneHistory:an(e.planner.sceneHistory,e.planner.scene)});return{...e,planner:Vt.remove(t).updatedState}})},rollback:()=>{n(e=>({...e,planner:Vt.rollback(e.planner).updatedState}))},setAlterateState:()=>{n(e=>({...e,planner:Vt.setAlterate(e.planner).updatedState}))},setPlan:e=>{n(t=>({...t,plan:e}))},unselectAll:()=>{n(e=>({...e,planner:Vt.unselectAll(e.planner).updatedState}))}})),il={stroke:"#D32F2F",strokeWidth:"1px"};function mE({snap:n,width:e,height:t}){switch(n.type){case"point":return C.jsxs("g",{transform:`translate(${n.x} ${n.y})`,children:[C.jsx("line",{x1:"0",y1:"-70",x2:"0",y2:"70",style:il}),C.jsx("line",{x1:"-70",y1:"0",x2:"70",y2:"0",style:il})]});case"line":let r=dc(0),i=dc(t),s=el(n.a,n.b,n.c,r.a,r.b,r.c),o=el(n.a,n.b,n.c,i.a,i.b,i.c),a=pc(0),l=pc(e),c=el(n.a,n.b,n.c,a.a,a.b,a.c),h=el(n.a,n.b,n.c,l.a,l.b,l.c);return s&&o?C.jsx("line",{x1:s.x,y1:s.y,x2:o.x,y2:o.y,style:il}):c&&h?C.jsx("line",{x1:c.x,y1:c.y,x2:h.x,y2:h.y,style:il}):null;case"line-segment":return C.jsx("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,style:il});default:return null}}const Fc={white:"#FFF",black:"#000"},O1={500:{orange:"#FF9800"}},gE={alt:"#2E2F33",text_main:Fc.white},_E={main:"#1CA6FC"},ed="#99C3FB",Nt={COLORS:Fc,PRIMARY_COLOR:gE,SECONDARY_COLOR:_E,MESH_SELECTED:ed,AREA_MESH_COLOR:{selected:ed,unselected:"#F5F4F4"},LINE_MESH_COLOR:{selected:ed}};function vE({width:n,height:e,grid:t}){let r=t.properties.get("step"),i;t.properties.has("color")?i=Xe([t.properties.get("color")]):i=t.properties.get("colors");let s=[],o=0;for(let a=0;a<=e;a+=r){let l=i.get(o%i.size);o++,s.push(C.jsx("line",{x1:"0",y1:a,x2:n,y2:a,strokeWidth:"1",stroke:l},a))}return C.jsx("g",{children:s})}function xE({width:n,height:e,grid:t}){let r=t.properties.get("step"),i;t.properties.has("color")?i=Xe([t.properties.get("color")]):i=t.properties.get("colors");let s=[],o=0;for(let a=0;a<=n;a+=r){let l=i.get(o%i.size);o++,s.push(C.jsx("line",{x1:a,y1:"0",x2:a,y2:e,strokeWidth:"1",stroke:l},a))}return C.jsx("g",{children:s})}function yE({scene:n}){let{width:e,height:t,grids:r}=n,i=r.entrySeq().map(([s,o])=>{switch(o.type){case"horizontal-streak":return C.jsx(vE,{width:e,height:t,grid:o},s);case"vertical-streak":return C.jsx(xE,{width:e,height:t,grid:o},s);default:console.warn(`grid ${o.type} not allowed`)}}).toList();return C.jsx("g",{children:i})}class SE{constructor(e=[],t=(r,i)=>r<i?-1:r>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:r}=this,i=t[e];for(;e>0;){const s=e-1>>1,o=t[s];if(r(i,o)>=0)break;t[e]=o,e=s}t[e]=i}_down(e){const{data:t,compare:r}=this,i=this.length>>1,s=t[e];for(;e<i;){let o=(e<<1)+1;const a=o+1;if(a<this.length&&r(t[a],t[o])<0&&(o=a),r(t[o],s)>=0)break;t[e]=t[o],e=o}t[e]=s}}function EE(n,e=1,t=!1){let r=1/0,i=1/0,s=-1/0,o=-1/0;for(const[_,b]of n[0])_<r&&(r=_),b<i&&(i=b),_>s&&(s=_),b>o&&(o=b);const a=s-r,l=o-i,c=Math.max(e,Math.min(a,l));if(c===e){const _=[r,i];return _.distance=0,_}const h=new SE([],(_,b)=>b.max-_.max);let f=ME(n);const p=new zc(r+a/2,i+l/2,0,n);p.d>f.d&&(f=p);let d=2;function m(_,b,M){const E=new zc(_,b,M,n);d++,E.max>f.d+e&&h.push(E),E.d>f.d&&(f=E,t&&console.log(`found best ${Math.round(1e4*E.d)/1e4} after ${d} probes`))}let x=c/2;for(let _=r;_<s;_+=c)for(let b=i;b<o;b+=c)m(_+x,b+x,x);for(;h.length;){const{max:_,x:b,y:M,h:E}=h.pop();if(_-f.d<=e)break;x=E/2,m(b-x,M-x,x),m(b+x,M-x,x),m(b-x,M+x,x),m(b+x,M+x,x)}t&&console.log(`num probes: ${d}
70
+ best distance: ${f.d}`);const v=[f.x,f.y];return v.distance=f.d,v}function zc(n,e,t,r){this.x=n,this.y=e,this.h=t,this.d=bE(n,e,r),this.max=this.d+this.h*Math.SQRT2}function bE(n,e,t){let r=!1,i=1/0;for(const s of t)for(let o=0,a=s.length,l=a-1;o<a;l=o++){const c=s[o],h=s[l];c[1]>e!=h[1]>e&&n<(h[0]-c[0])*(e-c[1])/(h[1]-c[1])+c[0]&&(r=!r),i=Math.min(i,wE(n,e,c,h))}return i===0?0:(r?1:-1)*Math.sqrt(i)}function ME(n){let e=0,t=0,r=0;const i=n[0];for(let o=0,a=i.length,l=a-1;o<a;l=o++){const c=i[o],h=i[l],f=c[0]*h[1]-h[0]*c[1];t+=(c[0]+h[0])*f,r+=(c[1]+h[1])*f,e+=f*3}const s=new zc(t/e,r/e,0,n);return e===0||s.d<0?new zc(i[0][0],i[0][1],0,n):s}function wE(n,e,t,r){let i=t[0],s=t[1],o=r[0]-i,a=r[1]-s;if(o!==0||a!==0){const l=((n-i)*o+(e-s)*a)/(o*o+a*a);l>1?(i=r[0],s=r[1]):l>0&&(i+=o*l,s+=a*l)}return o=n-i,a=e-s,o*o+a*a}function q1(n,e){var t=n.length,r=0;n=n.map(TE),n[0]!=n[n.length-1]&&(n=n.concat(n[0]));for(var i=0;i<t;i++)r+=n[i].x*n[i+1].y-n[i].y*n[i+1].x;return Math.abs(r)/2}function TE(n){return Array.isArray(n)?{x:n[0],y:n[1]}:n}const AE={textAnchor:"middle",fontSize:"12px",fontFamily:'"Courier New", Courier, monospace',pointerEvents:"none",fontWeight:"bold",WebkitTouchCallout:"none",WebkitUserSelect:"none",MozUserSelect:"none",userSelect:"none"};function CE({layer:n,area:e,catalog:t}){let r=t.getElement(e.type).render2D(e,n),i=null;if(e.selected){let s=e.vertices.toArray().map(c=>{let{x:h,y:f}=n.vertices.get(c);return[h,f]}),o=s;e.holes.forEach(c=>{let h=n.areas.get(c).vertices.toArray().map(f=>{let{x:p,y:d}=n.vertices.get(f);return[p,d]});o=o.concat(h.reverse())});let a=EE([o],1),l=q1(s);e.holes.forEach(c=>{let f=n.areas.get(c).vertices.toArray().map(p=>{let{x:d,y:m}=n.vertices.get(p);return[d,m]});l-=q1(f)}),i=C.jsxs("text",{x:"0",y:"0",transform:`translate(${a[0]} ${a[1]}) scale(1, -1)`,style:AE,children:[(l/1e4).toFixed(2)," m","²"]})}return C.jsxs("g",{"data-element-root":!0,"data-prototype":e.prototype,"data-id":e.id,"data-selected":e.selected,"data-layer":n.id,children:[r,i]})}const RE=0,PE=0,IE=5,LE={fill:O1[500].orange,stroke:O1[500].orange,cursor:"default"};function OE({layer:n,group:e}){return C.jsx("g",{"data-element-root":!0,"data-prototype":e.prototype,"data-id":e.id,"data-selected":e.selected,"data-layer":n.id,style:e.selected?{cursor:"move"}:{},transform:`translate(${e.x},${e.y}) rotate(${e.rotation})`,children:e.selected&&C.jsx("g",{"data-element-root":!0,"data-prototype":e.prototype,"data-id":e.id,"data-selected":e.selected,"data-layer":n.id,"data-part":"rotation-anchor",children:C.jsx("circle",{cx:RE,cy:PE,r:IE,style:LE,children:C.jsx("title",{children:"Group's Barycenter"})})})})}const qE={fill:"#0096fd",stroke:"#0096fd",cursor:"ew-resize"},DE={fill:"none",stroke:"#0096fd",cursor:"ew-resize"};function NE({layer:n,item:e,scene:t,catalog:r}){let{x:i,y:s,rotation:o}=e,a=r.getElement(e.type).render2D(e,n,t);return C.jsxs("g",{"data-element-root":!0,"data-prototype":e.prototype,"data-id":e.id,"data-selected":e.selected,"data-layer":n.id,style:e.selected?{cursor:"move"}:{},transform:`translate(${i},${s}) rotate(${o})`,children:[a,e.selected&&C.jsxs("g",{"data-element-root":!0,"data-prototype":e.prototype,"data-id":e.id,"data-selected":e.selected,"data-layer":n.id,"data-part":"rotation-anchor",children:[C.jsx("circle",{cx:"0",cy:"150",r:"10",style:qE}),C.jsx("circle",{cx:"0",cy:"0",r:"150",style:DE})]})]})}const td={stroke:"#0096fd",strokeWidth:"1px"},UE={textAnchor:"middle",fontSize:"12px",fontFamily:"'Courier New', Courier, monospace",pointerEvents:"none",fontWeight:"bold",WebkitTouchCallout:"none",WebkitUserSelect:"none",MozUserSelect:"none",userSelect:"none"};function FE({length:n,unit:e,transform:t}){let r=`${n.toFixed(2)} ${e}`;return C.jsxs("g",{transform:t,children:[C.jsx("text",{x:n/2,y:"-3",transform:"scale(1, -1)",style:UE,children:r}),C.jsx("line",{x1:"0",y1:"-5",x2:"0",y2:"5",style:td}),C.jsx("line",{x1:n,y1:"-5",x2:n,y2:"5",style:td}),C.jsx("line",{x1:"0",y1:"0",x2:n,y2:"0",style:td})]})}const zE=({line:n,layer:e,scene:t,catalog:r})=>{let i=e.vertices.get(n.vertices.get(0)),s=e.vertices.get(n.vertices.get(1));if(i.id===s.id||Vr(i,s))return null;let{x:o,y:a}=i,{x:l,y:c}=s;o>l&&({x:o,y:a}=s,{x:l,y:c}=i);let h=Ln(o,a,l,c),f=Xy(o,a,l,c),p=n.holes.map(_=>{let b=e.holes.get(_),M=h*b.offset,E=r.getElement(b.type).render2D(b,e,t);return C.jsx("g",{transform:`translate(${M}, 0)`,"data-element-root":!0,"data-prototype":b.prototype,"data-id":b.id,"data-selected":b.selected,"data-layer":e.id,children:E},_)}),m=n.getIn(["properties","thickness","length"])/2,x=r.getElement(n.type).render2D(n,e),v=n.selected?C.jsx(FE,{unit:t.unit,length:h,transform:`translate(0, ${m+10} )`}):null;return C.jsxs("g",{transform:`translate(${o}, ${a}) rotate(${f}, 0, 0)`,"data-element-root":!0,"data-prototype":n.prototype,"data-id":n.id,"data-selected":n.selected,"data-layer":e.id,style:n.selected?{cursor:"move"}:{},children:[v,x,p]})},kE={fill:"#0096fd",stroke:Nt.COLORS.white,cursor:"move"},BE=({vertex:n,layer:e})=>C.jsx("g",{transform:`translate(${n.x}, ${n.y})`,"data-element-root":!0,"data-prototype":n.prototype,"data-id":n.id,"data-selected":n.selected,"data-layer":e.id,children:C.jsx("circle",{cx:"0",cy:"0",r:"7",style:kE})});function D1({layer:n,scene:e,catalog:t}){const{groups:r}=e,{lines:i,areas:s,vertices:o,id:a,items:l,opacity:c}=n;return C.jsxs("g",{opacity:c,children:[s.valueSeq().map(h=>C.jsx(CE,{layer:n,area:h,catalog:t},h.id)),i.valueSeq().map(h=>C.jsx(zE,{layer:n,line:h,scene:e,catalog:t},h.id)),l.valueSeq().map(h=>C.jsx(NE,{layer:n,item:h,scene:e,catalog:t},h.id)),o.valueSeq().filter(h=>h.selected).map(h=>C.jsx(BE,{layer:n,vertex:h},h.id)),r.valueSeq().filter(h=>h.hasIn(["elements",a])&&h.get("selected")).map(h=>C.jsx(OE,{layer:n,group:h,scene:e,catalog:t},h.get("id")))]})}const VE=({scene:n,catalog:e})=>{const{layers:t}=n,r=t.get(n.selectedLayer);return C.jsxs("g",{children:[C.jsx(yE,{scene:n}),C.jsx("g",{style:{pointerEvents:"none"},children:t.entrySeq().filter(([i,s])=>i!==n.selectedLayer&&s.visible).map(([i,s])=>C.jsx(D1,{layer:s,scene:n,catalog:e},i))}),C.jsx(D1,{layer:r,scene:n,catalog:e},r.id)]})},HE=se.memo(VE,(n,e)=>n.scene.hashCode()===e.scene.hashCode()),N1={stroke:Nt.SECONDARY_COLOR.main,strokeWidth:"2.5px"},GE=({catalog:n})=>{const{planner:e}=Xt(),{activeSnapElement:t,snapElements:r,scene:i}=e,{width:s,height:o}=i;return C.jsxs("g",{children:[C.jsx("rect",{x:"0",y:"0",width:s,height:o,fill:Nt.COLORS.white}),C.jsxs("g",{transform:`translate(0, ${i.height}) scale(1, -1)`,id:"svg-drawing-paper",children:[C.jsx(HE,{scene:i,catalog:n}),i.getIn(["guides","horizontal"]).entrySeq().map(([a,l])=>C.jsx("line",{id:"hGuide"+a,x1:0,y1:l,x2:s,y2:l,style:N1},a)),i.getIn(["guides","vertical"]).entrySeq().map(([a,l])=>C.jsx("line",{x1:l,y1:0,x2:l,y2:o,style:N1},a)),t?C.jsx(mE,{snap:t,width:i.width,height:i.height}):null,r?null:C.jsx(C.Fragment,{})]})]})},nd=.25,U1=5,WE=.25,jE=5.25;function F1(n){return(Math.min(Math.max(n,nd),U1)-nd)/(U1-nd)*100}function XE(n){switch(n){case Ns:return Cr;case qs:return Wr;case Ds:return _i;case rn:return Ar;default:return gi}}function $E(n){switch(n){case cr:case ur:case wr:case Br:case kr:case Fr:case zr:return{pointerEvents:"none"};default:return{}}}function YE(n){switch(n){case Br:case Fr:case zr:case kr:return{cursor:"move"};case qi:return{cursor:"ew-resize"};case Ur:case cr:return{cursor:"crosshair"};default:return{cursor:"default"}}}function KE(n){switch(n){case cr:case Fr:case zr:case Br:case kr:case ur:case wr:return!0;default:return!1}}function z1(n){for(;!n.attributes.getNamedItem("data-element-root")&&n.tagName!=="svg";)n=n.parentNode;return n.tagName==="svg"?null:{part:n.attributes.getNamedItem("data-part")?n.attributes.getNamedItem("data-part").value:void 0,layer:n.attributes.getNamedItem("data-layer").value,prototype:n.attributes.getNamedItem("data-prototype").value,selected:n.attributes.getNamedItem("data-selected").value==="true",id:n.attributes.getNamedItem("data-id").value}}const ZE=({width:n,height:e,catalog:t})=>{const r=se.useRef(null),{planner:i,selectToolZoomOut:s,selectToolZoomIn:o,selectToolPan:a,selectToolEdit:l,updateCameraView:c,updateZoomScale:h,updateMouseCoord:f,updateDrawingLine:p,updateDrawingHole:d,updateDrawingItem:m,updateDraggingHole:x,updateDraggingLine:v,updateDraggingVertex:_,updateDraggingItem:b,updateRotatingItem:M,beginDraggingLine:E,beginDraggingVertex:S,beginRotatingItem:T,beginDraggingItem:q,beginDraggingHole:O,selectArea:A,unselectAll:L,beginDrawingLine:N,endDrawingLine:Z,endDrawingHole:K,endDrawingItem:ne,endDraggingLine:ce,endDraggingVertex:J,endDraggingItem:oe,endDraggingHole:B,endRotatingItem:xe,selectLine:U,selectHole:$,selectItem:pe,rollback:Se,setViewer:be}=Xt(),{viewer2D:V,scene:te,mode:W}=i,ue=te.selectedLayer??"";se.useEffect(()=>{r.current&&(be(r.current),r.current.fitToViewer())},[]);const ye=({x:$e,y:qe})=>({x:$e,y:-qe+te.height}),Q=$e=>{const qe=new Event("mousemove-planner-event");qe.viewerEvent=$e,document.dispatchEvent(qe);let{x:De,y:ve}=ye($e);switch(f({x:De,y:ve}),W){case cr:p(De,ve,i.snapMask);break;case ur:d(ue,De,ve);break;case wr:m(ue,De,ve);break;case Br:x(De,ve);break;case Fr:v(De,ve,i.snapMask);break;case zr:_(De,ve,i.snapMask);break;case kr:b(De,ve);break;case qi:M(De,ve);break}$e.originalEvent.stopPropagation()},Le=$e=>{const qe=$e.originalEvent,De=new Event("mousedown-planner-event");De.viewerEvent=$e,document.dispatchEvent(De);let{x:ve,y:Ge}=ye($e);if(W===rn){let rt=z1(qe.target);if(!rt||!rt.selected)return;switch(rt.prototype){case"lines":E(rt.layer,rt.id,ve,Ge,i.snapMask);break;case"vertices":S(rt.layer,rt.id,ve,Ge,i.snapMask);break;case"items":rt.part==="rotation-anchor"?T(rt.layer,rt.id,ve,Ge):q(rt.layer,rt.id,ve,Ge);break;case"holes":O(rt.layer,rt.id,ve,Ge);break}}qe.stopPropagation()},le=$e=>{const qe=$e.originalEvent,De=new Event("mouseup-planner-event");De.viewerEvent=$e,document.dispatchEvent(De);const{x:ve,y:Ge}=ye($e);switch(W){case rn:const rt=z1(qe.target);if(rt&&rt.selected)return;switch(rt?rt.prototype:"none"){case"areas":A(rt.layer,rt.id);break;case"lines":U(rt.layer,rt.id);break;case"holes":$(rt.layer,rt.id);break;case"items":pe(rt.layer,rt.id);break;case"none":L();break}break;case Ur:N(ue,ve,Ge,i.snapMask);break;case cr:Z(ve,Ge,i.snapMask),N(ue,ve,Ge,i.snapMask);break;case ur:K(ue,ve,Ge);break;case wr:ne(ue,ve,Ge);break;case Fr:ce(ve,Ge,i.snapMask);break;case zr:J(ve,Ge,i.snapMask);break;case kr:oe(ve,Ge);break;case Br:B(ve,Ge);break;case qi:xe(ve,Ge);break}qe.stopPropagation()},z=()=>{[Ur,cr,ur,wr].includes(W)&&Se()},it=$e=>{h($e.a),c($e)},Ie=$e=>{switch($e){case gi:l();break;case Cr:a();break;case Wr:o();break;case _i:s();break}};return C.jsx("div",{className:"m-0 p-0 relative",children:C.jsx(Uc,{className:"floor_planner-svgPanZoom",ref:r,style:{gridColumn:2,gridRow:2},width:n,height:e,scaleFactorMin:WE,scaleFactorMax:jE,value:V.isEmpty()?{}:V.toJS(),onChangeValue:it,tool:XE(W),onChangeTool:Ie,detectAutoPan:KE(W),onMouseDown:Le,onMouseMove:Q,onMouseUp:le,onDoubleClick:z,miniatureProps:{position:"none",width:0,height:0,background:""},toolbarProps:{position:"none"},children:C.jsxs("svg",{width:te.width,height:te.height,children:[C.jsx("defs",{children:C.jsxs("pattern",{id:"diagonalFill",patternUnits:"userSpaceOnUse",width:"4",height:"4",fill:"#FFF",children:[C.jsx("rect",{x:"0",y:"0",width:"4",height:"4",fill:"#FFF"}),C.jsx("path",{d:"M-1,1 l2,-2 M0,4 l4,-4 M3,5 l2,-2",style:{stroke:"#8E9BA2",strokeWidth:1}})]})}),C.jsx("g",{style:Object.assign(YE(W),$E(W)),children:C.jsx(GE,{catalog:t})})]})})})};/**
79
71
  * @license
80
72
  * Copyright 2010-2025 Three.js Authors
81
73
  * SPDX-License-Identifier: MIT
82
- */const rd="179",Go={ROTATE:0,DOLLY:1,PAN:2},Wo={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},JE=0,k1=1,QE=2,B1=1,eb=2,Wi=3,gs=0,lr=1,Ci=2,_s=0,jo=1,V1=2,H1=3,G1=4,tb=5,Ys=100,nb=101,rb=102,ib=103,sb=104,ob=200,ab=201,lb=202,cb=203,id=204,sd=205,ub=206,hb=207,fb=208,db=209,pb=210,mb=211,gb=212,_b=213,vb=214,od=0,ad=1,ld=2,Xo=3,cd=4,ud=5,hd=6,fd=7,dd=0,xb=1,yb=2,vs=0,Sb=1,Eb=2,bb=3,Mb=4,wb=5,Tb=6,Ab=7,W1=300,$o=301,Yo=302,pd=303,md=304,Wc=306,ti=1e3,Ks=1001,gd=1002,ni=1003,Cb=1004,jc=1005,Ri=1006,_d=1007,Zs=1008,Pi=1009,j1=1010,X1=1011,dl=1012,vd=1013,Js=1014,ji=1015,pl=1016,xd=1017,yd=1018,ml=1020,$1=35902,Y1=1021,K1=1022,ri=1023,gl=1026,_l=1027,Z1=1028,Sd=1029,J1=1030,Ed=1031,bd=1033,Xc=33776,$c=33777,Yc=33778,Kc=33779,Md=35840,wd=35841,Td=35842,Ad=35843,Cd=36196,Rd=37492,Pd=37496,Id=37808,Ld=37809,Od=37810,qd=37811,Dd=37812,Nd=37813,Ud=37814,Fd=37815,zd=37816,kd=37817,Bd=37818,Vd=37819,Hd=37820,Gd=37821,Zc=36492,Wd=36494,jd=36495,Q1=36283,Xd=36284,$d=36285,Yd=36286,Rb=3200,Pb=3201,Kd=0,Ib=1,xs="",Er="srgb",Ko="srgb-linear",Jc="linear",Gt="srgb",Zo=7680,e_=519,Lb=512,Ob=513,qb=514,t_=515,Db=516,Nb=517,Ub=518,Fb=519,n_=35044,r_="300 es",Ii=2e3,Qc=2001;class Qs{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){const r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){const r=this._listeners;if(r===void 0)return;const i=r[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const r=t[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}const Hn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],eu=Math.PI/180,tu=180/Math.PI;function Jo(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Hn[n&255]+Hn[n>>8&255]+Hn[n>>16&255]+Hn[n>>24&255]+"-"+Hn[e&255]+Hn[e>>8&255]+"-"+Hn[e>>16&15|64]+Hn[e>>24&255]+"-"+Hn[t&63|128]+Hn[t>>8&255]+"-"+Hn[t>>16&255]+Hn[t>>24&255]+Hn[r&255]+Hn[r>>8&255]+Hn[r>>16&255]+Hn[r>>24&255]).toLowerCase()}function bt(n,e,t){return Math.max(e,Math.min(t,n))}function zb(n,e){return(n%e+e)%e}function Zd(n,e,t){return(1-t)*n+t*e}function vl(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function cr(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const kb={DEG2RAD:eu};class Be{constructor(e=0,t=0){Be.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=bt(this.x,e.x,t.x),this.y=bt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=bt(this.x,e,t),this.y=bt(this.y,e,t),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(bt(r,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(bt(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ys{constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}static slerpFlat(e,t,r,i,s,o,a){let l=r[i+0],c=r[i+1],h=r[i+2],f=r[i+3];const p=s[o+0],d=s[o+1],m=s[o+2],x=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=f;return}if(a===1){e[t+0]=p,e[t+1]=d,e[t+2]=m,e[t+3]=x;return}if(f!==x||l!==p||c!==d||h!==m){let v=1-a;const _=l*p+c*d+h*m+f*x,E=_>=0?1:-1,M=1-_*_;if(M>Number.EPSILON){const S=Math.sqrt(M),T=Math.atan2(S,_*E);v=Math.sin(v*T)/S,a=Math.sin(a*T)/S}const b=a*E;if(l=l*v+p*b,c=c*v+d*b,h=h*v+m*b,f=f*v+x*b,v===1-a){const S=1/Math.sqrt(l*l+c*c+h*h+f*f);l*=S,c*=S,h*=S,f*=S}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=f}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],h=r[i+3],f=s[o],p=s[o+1],d=s[o+2],m=s[o+3];return e[t]=a*m+h*f+l*d-c*p,e[t+1]=l*m+h*p+c*f-a*d,e[t+2]=c*m+h*d+a*p-l*f,e[t+3]=h*m-a*f-l*p-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),h=a(i/2),f=a(s/2),p=l(r/2),d=l(i/2),m=l(s/2);switch(o){case"XYZ":this._x=p*h*f+c*d*m,this._y=c*d*f-p*h*m,this._z=c*h*m+p*d*f,this._w=c*h*f-p*d*m;break;case"YXZ":this._x=p*h*f+c*d*m,this._y=c*d*f-p*h*m,this._z=c*h*m-p*d*f,this._w=c*h*f+p*d*m;break;case"ZXY":this._x=p*h*f-c*d*m,this._y=c*d*f+p*h*m,this._z=c*h*m+p*d*f,this._w=c*h*f-p*d*m;break;case"ZYX":this._x=p*h*f-c*d*m,this._y=c*d*f+p*h*m,this._z=c*h*m-p*d*f,this._w=c*h*f+p*d*m;break;case"YZX":this._x=p*h*f+c*d*m,this._y=c*d*f+p*h*m,this._z=c*h*m-p*d*f,this._w=c*h*f-p*d*m;break;case"XZY":this._x=p*h*f-c*d*m,this._y=c*d*f-p*h*m,this._z=c*h*m+p*d*f,this._w=c*h*f+p*d*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],h=t[6],f=t[10],p=r+a+f;if(p>0){const d=.5/Math.sqrt(p+1);this._w=.25/d,this._x=(h-l)*d,this._y=(s-c)*d,this._z=(o-i)*d}else if(r>a&&r>f){const d=2*Math.sqrt(1+r-a-f);this._w=(h-l)/d,this._x=.25*d,this._y=(i+o)/d,this._z=(s+c)/d}else if(a>f){const d=2*Math.sqrt(1+a-r-f);this._w=(s-c)/d,this._x=(i+o)/d,this._y=.25*d,this._z=(l+h)/d}else{const d=2*Math.sqrt(1+f-r-a);this._w=(o-i)/d,this._x=(s+c)/d,this._y=(l+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<1e-8?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(bt(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,h=t._w;return this._x=r*h+o*a+i*c-s*l,this._y=i*h+o*l+s*a-r*c,this._z=s*h+o*c+r*l-i*a,this._w=o*h-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const d=1-t;return this._w=d*o+t*this._w,this._x=d*r+t*this._x,this._y=d*i+t*this._y,this._z=d*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,a),f=Math.sin((1-t)*h)/c,p=Math.sin(t*h)/c;return this._w=o*f+this._w*p,this._x=r*f+this._x*p,this._y=i*f+this._y*p,this._z=s*f+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class j{constructor(e=0,t=0,r=0){j.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(i_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(i_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*i,this.y=s[1]*t+s[4]*r+s[7]*i,this.z=s[2]*t+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),h=2*(a*t-s*i),f=2*(s*r-o*t);return this.x=t+l*c+o*f-a*h,this.y=r+l*h+a*c-s*f,this.z=i+l*f+s*h-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i,this.y=s[1]*t+s[5]*r+s[9]*i,this.z=s[2]*t+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=bt(this.x,e.x,t.x),this.y=bt(this.y,e.y,t.y),this.z=bt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=bt(this.x,e,t),this.y=bt(this.y,e,t),this.z=bt(this.z,e,t),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(bt(r,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return Jd.copy(this).projectOnVector(e),this.sub(Jd)}reflect(e){return this.sub(Jd.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(bt(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,r=Math.sqrt(1-t*t);return this.x=r*Math.cos(e),this.y=t,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Jd=new j,i_=new ys;class yt{constructor(e,t,r,i,s,o,a,l,c){yt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c)}set(e,t,r,i,s,o,a,l,c){const h=this.elements;return h[0]=e,h[1]=i,h[2]=a,h[3]=t,h[4]=s,h[5]=l,h[6]=r,h[7]=o,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],h=r[4],f=r[7],p=r[2],d=r[5],m=r[8],x=i[0],v=i[3],_=i[6],E=i[1],M=i[4],b=i[7],S=i[2],T=i[5],q=i[8];return s[0]=o*x+a*E+l*S,s[3]=o*v+a*M+l*T,s[6]=o*_+a*b+l*q,s[1]=c*x+h*E+f*S,s[4]=c*v+h*M+f*T,s[7]=c*_+h*b+f*q,s[2]=p*x+d*E+m*S,s[5]=p*v+d*M+m*T,s[8]=p*_+d*b+m*q,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8];return t*o*h-t*a*c-r*s*h+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],f=h*o-a*c,p=a*l-h*s,d=c*s-o*l,m=t*f+r*p+i*d;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/m;return e[0]=f*x,e[1]=(i*c-h*r)*x,e[2]=(a*r-i*o)*x,e[3]=p*x,e[4]=(h*t-i*l)*x,e[5]=(i*s-a*t)*x,e[6]=d*x,e[7]=(r*l-c*t)*x,e[8]=(o*t-r*s)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Qd.makeScale(e,t)),this}rotate(e){return this.premultiply(Qd.makeRotation(-e)),this}translate(e,t){return this.premultiply(Qd.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Qd=new yt;function s_(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function xl(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Bb(){const n=xl("canvas");return n.style.display="block",n}const o_={};function Qo(n){n in o_||(o_[n]=!0,console.warn(n))}function Vb(n,e,t){return new Promise(function(r,i){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:i();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:r()}}setTimeout(s,t)})}const a_=new yt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),l_=new yt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Hb(){const n={enabled:!0,workingColorSpace:Ko,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Gt&&(i.r=Xi(i.r),i.g=Xi(i.g),i.b=Xi(i.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Gt&&(i.r=ea(i.r),i.g=ea(i.g),i.b=ea(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===xs?Jc:this.spaces[i].transfer},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,o){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return Qo("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Qo("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],r=[.3127,.329];return n.define({[Ko]:{primaries:e,whitePoint:r,transfer:Jc,toXYZ:a_,fromXYZ:l_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Er},outputColorSpaceConfig:{drawingBufferColorSpace:Er}},[Er]:{primaries:e,whitePoint:r,transfer:Gt,toXYZ:a_,fromXYZ:l_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Er}}}),n}const Nt=Hb();function Xi(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function ea(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let ta;class Gb{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{ta===void 0&&(ta=xl("canvas")),ta.width=e.width,ta.height=e.height;const i=ta.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),r=ta}return r.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=xl("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o<s.length;o++)s[o]=Xi(s[o]/255)*255;return r.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let r=0;r<t.length;r++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[r]=Math.floor(Xi(t[r]/255)*255):t[r]=Xi(t[r]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Wb=0;class ep{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Wb++}),this.uuid=Jo(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(tp(i[o].image)):s.push(tp(i[o]))}else s=tp(i);r.url=s}return t||(e.images[this.uuid]=r),r}}function tp(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Gb.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let jb=0;const np=new j;class Gn extends Qs{constructor(e=Gn.DEFAULT_IMAGE,t=Gn.DEFAULT_MAPPING,r=Ks,i=Ks,s=Ri,o=Zs,a=ri,l=Pi,c=Gn.DEFAULT_ANISOTROPY,h=xs){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:jb++}),this.uuid=Jo(),this.name="",this.source=new ep(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Be(0,0),this.repeat=new Be(1,1),this.center=new Be(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new yt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(np).x}get height(){return this.source.getSize(np).y}get depth(){return this.source.getSize(np).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const r=e[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}i&&r&&i.isVector2&&r.isVector2||i&&r&&i.isVector3&&r.isVector3||i&&r&&i.isMatrix3&&r.isMatrix3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==W1)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ti:e.x=e.x-Math.floor(e.x);break;case Ks:e.x=e.x<0?0:1;break;case gd:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ti:e.y=e.y-Math.floor(e.y);break;case Ks:e.y=e.y<0?0:1;break;case gd:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Gn.DEFAULT_IMAGE=null,Gn.DEFAULT_MAPPING=W1,Gn.DEFAULT_ANISOTROPY=1;class pn{constructor(e=0,t=0,r=0,i=1){pn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*r+o[11]*i+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,i,s;const l=e.elements,c=l[0],h=l[4],f=l[8],p=l[1],d=l[5],m=l[9],x=l[2],v=l[6],_=l[10];if(Math.abs(h-p)<.01&&Math.abs(f-x)<.01&&Math.abs(m-v)<.01){if(Math.abs(h+p)<.1&&Math.abs(f+x)<.1&&Math.abs(m+v)<.1&&Math.abs(c+d+_-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const M=(c+1)/2,b=(d+1)/2,S=(_+1)/2,T=(h+p)/4,q=(f+x)/4,O=(m+v)/4;return M>b&&M>S?M<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(M),i=T/r,s=q/r):b>S?b<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(b),r=T/i,s=O/i):S<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(S),r=q/s,i=O/s),this.set(r,i,s,t),this}let E=Math.sqrt((v-m)*(v-m)+(f-x)*(f-x)+(p-h)*(p-h));return Math.abs(E)<.001&&(E=1),this.x=(v-m)/E,this.y=(f-x)/E,this.z=(p-h)/E,this.w=Math.acos((c+d+_-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=bt(this.x,e.x,t.x),this.y=bt(this.y,e.y,t.y),this.z=bt(this.z,e.z,t.z),this.w=bt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=bt(this.x,e,t),this.y=bt(this.y,e,t),this.z=bt(this.z,e,t),this.w=bt(this.w,e,t),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(bt(r,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Xb extends Qs{constructor(e=1,t=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ri,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},r),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=r.depth,this.scissor=new pn(0,0,e,t),this.scissorTest=!1,this.viewport=new pn(0,0,e,t);const i={width:e,height:t,depth:r.depth},s=new Gn(i);this.textures=[];const o=r.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(r),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples,this.multiview=r.multiview}_setTextureOptions(e={}){const t={minFilter:Ri,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let r=0;r<this.textures.length;r++)this.textures[r].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,r=1){if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=r,this.textures[i].isArrayTexture=this.textures[i].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,r=e.textures.length;t<r;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new ep(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class eo extends Xb{constructor(e=1,t=1,r={}){super(e,t,r),this.isWebGLRenderTarget=!0}}class c_ extends Gn{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=ni,this.minFilter=ni,this.wrapR=Ks,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class $b extends Gn{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=ni,this.minFilter=ni,this.wrapR=Ks,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Li{constructor(e=new j(1/0,1/0,1/0),t=new j(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t+=3)this.expandByPoint(ii.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,r=e.count;t<r;t++)this.expandByPoint(ii.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const r=ii.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const r=e.geometry;if(r!==void 0){const s=r.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,ii):ii.fromBufferAttribute(s,o),ii.applyMatrix4(e.matrixWorld),this.expandByPoint(ii);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),nu.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),nu.copy(r.boundingBox)),nu.applyMatrix4(e.matrixWorld),this.union(nu)}const i=e.children;for(let s=0,o=i.length;s<o;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,ii),ii.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(yl),ru.subVectors(this.max,yl),na.subVectors(e.a,yl),ra.subVectors(e.b,yl),ia.subVectors(e.c,yl),Ss.subVectors(ra,na),Es.subVectors(ia,ra),to.subVectors(na,ia);let t=[0,-Ss.z,Ss.y,0,-Es.z,Es.y,0,-to.z,to.y,Ss.z,0,-Ss.x,Es.z,0,-Es.x,to.z,0,-to.x,-Ss.y,Ss.x,0,-Es.y,Es.x,0,-to.y,to.x,0];return!rp(t,na,ra,ia,ru)||(t=[1,0,0,0,1,0,0,0,1],!rp(t,na,ra,ia,ru))?!1:(iu.crossVectors(Ss,Es),t=[iu.x,iu.y,iu.z],rp(t,na,ra,ia,ru))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ii).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ii).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:($i[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),$i[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),$i[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),$i[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),$i[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),$i[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),$i[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),$i[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints($i),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const $i=[new j,new j,new j,new j,new j,new j,new j,new j],ii=new j,nu=new Li,na=new j,ra=new j,ia=new j,Ss=new j,Es=new j,to=new j,yl=new j,ru=new j,iu=new j,no=new j;function rp(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){no.fromArray(n,s);const a=i.x*Math.abs(no.x)+i.y*Math.abs(no.y)+i.z*Math.abs(no.z),l=e.dot(no),c=t.dot(no),h=r.dot(no);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}const Yb=new Li,Sl=new j,ip=new j;class su{constructor(e=new j,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):Yb.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Sl.subVectors(e,this.center);const t=Sl.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(Sl,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(ip.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Sl.copy(e.center).add(ip)),this.expandByPoint(Sl.copy(e.center).sub(ip))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const Yi=new j,sp=new j,ou=new j,bs=new j,op=new j,au=new j,ap=new j;class lu{constructor(e=new j,t=new j(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Yi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Yi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Yi.copy(this.origin).addScaledVector(this.direction,t),Yi.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){sp.copy(e).add(t).multiplyScalar(.5),ou.copy(t).sub(e).normalize(),bs.copy(this.origin).sub(sp);const s=e.distanceTo(t)*.5,o=-this.direction.dot(ou),a=bs.dot(this.direction),l=-bs.dot(ou),c=bs.lengthSq(),h=Math.abs(1-o*o);let f,p,d,m;if(h>0)if(f=o*l-a,p=o*a-l,m=s*h,f>=0)if(p>=-m)if(p<=m){const x=1/h;f*=x,p*=x,d=f*(f+o*p+2*a)+p*(o*f+p+2*l)+c}else p=s,f=Math.max(0,-(o*p+a)),d=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(o*p+a)),d=-f*f+p*(p+2*l)+c;else p<=-m?(f=Math.max(0,-(-o*s+a)),p=f>0?-s:Math.min(Math.max(-s,-l),s),d=-f*f+p*(p+2*l)+c):p<=m?(f=0,p=Math.min(Math.max(-s,-l),s),d=p*(p+2*l)+c):(f=Math.max(0,-(o*s+a)),p=f>0?s:Math.min(Math.max(-s,-l),s),d=-f*f+p*(p+2*l)+c);else p=o>0?-s:s,f=Math.max(0,-(o*p+a)),d=-f*f+p*(p+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(sp).addScaledVector(ou,p),d}intersectSphere(e,t){Yi.subVectors(e.center,this.origin);const r=Yi.dot(this.direction),i=Yi.dot(Yi)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,s,o,a,l;const c=1/this.direction.x,h=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(r=(e.min.x-p.x)*c,i=(e.max.x-p.x)*c):(r=(e.max.x-p.x)*c,i=(e.min.x-p.x)*c),h>=0?(s=(e.min.y-p.y)*h,o=(e.max.y-p.y)*h):(s=(e.max.y-p.y)*h,o=(e.min.y-p.y)*h),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o<i||isNaN(i))&&(i=o),f>=0?(a=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(a=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),r>l||a>i)||((a>r||r!==r)&&(r=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(r>=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,Yi)!==null}intersectTriangle(e,t,r,i,s){op.subVectors(t,e),au.subVectors(r,e),ap.crossVectors(op,au);let o=this.direction.dot(ap),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;bs.subVectors(this.origin,e);const l=a*this.direction.dot(au.crossVectors(bs,au));if(l<0)return null;const c=a*this.direction.dot(op.cross(bs));if(c<0||l+c>o)return null;const h=-a*bs.dot(ap);return h<0?null:this.at(h/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Kt{constructor(e,t,r,i,s,o,a,l,c,h,f,p,d,m,x,v){Kt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c,h,f,p,d,m,x,v)}set(e,t,r,i,s,o,a,l,c,h,f,p,d,m,x,v){const _=this.elements;return _[0]=e,_[4]=t,_[8]=r,_[12]=i,_[1]=s,_[5]=o,_[9]=a,_[13]=l,_[2]=c,_[6]=h,_[10]=f,_[14]=p,_[3]=d,_[7]=m,_[11]=x,_[15]=v,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Kt().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,i=1/sa.setFromMatrixColumn(e,0).length(),s=1/sa.setFromMatrixColumn(e,1).length(),o=1/sa.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),h=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const p=o*h,d=o*f,m=a*h,x=a*f;t[0]=l*h,t[4]=-l*f,t[8]=c,t[1]=d+m*c,t[5]=p-x*c,t[9]=-a*l,t[2]=x-p*c,t[6]=m+d*c,t[10]=o*l}else if(e.order==="YXZ"){const p=l*h,d=l*f,m=c*h,x=c*f;t[0]=p+x*a,t[4]=m*a-d,t[8]=o*c,t[1]=o*f,t[5]=o*h,t[9]=-a,t[2]=d*a-m,t[6]=x+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*h,d=l*f,m=c*h,x=c*f;t[0]=p-x*a,t[4]=-o*f,t[8]=m+d*a,t[1]=d+m*a,t[5]=o*h,t[9]=x-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*h,d=o*f,m=a*h,x=a*f;t[0]=l*h,t[4]=m*c-d,t[8]=p*c+x,t[1]=l*f,t[5]=x*c+p,t[9]=d*c-m,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,d=o*c,m=a*l,x=a*c;t[0]=l*h,t[4]=x-p*f,t[8]=m*f+d,t[1]=f,t[5]=o*h,t[9]=-a*h,t[2]=-c*h,t[6]=d*f+m,t[10]=p-x*f}else if(e.order==="XZY"){const p=o*l,d=o*c,m=a*l,x=a*c;t[0]=l*h,t[4]=-f,t[8]=c*h,t[1]=p*f+x,t[5]=o*h,t[9]=d*f-m,t[2]=m*f-d,t[6]=a*h,t[10]=x*f+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Kb,e,Zb)}lookAt(e,t,r){const i=this.elements;return br.subVectors(e,t),br.lengthSq()===0&&(br.z=1),br.normalize(),Ms.crossVectors(r,br),Ms.lengthSq()===0&&(Math.abs(r.z)===1?br.x+=1e-4:br.z+=1e-4,br.normalize(),Ms.crossVectors(r,br)),Ms.normalize(),cu.crossVectors(br,Ms),i[0]=Ms.x,i[4]=cu.x,i[8]=br.x,i[1]=Ms.y,i[5]=cu.y,i[9]=br.y,i[2]=Ms.z,i[6]=cu.z,i[10]=br.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],h=r[1],f=r[5],p=r[9],d=r[13],m=r[2],x=r[6],v=r[10],_=r[14],E=r[3],M=r[7],b=r[11],S=r[15],T=i[0],q=i[4],O=i[8],A=i[12],L=i[1],N=i[5],Z=i[9],Y=i[13],ee=i[2],ue=i[6],te=i[10],ae=i[14],B=i[3],Se=i[7],$=i[11],oe=i[15];return s[0]=o*T+a*L+l*ee+c*B,s[4]=o*q+a*N+l*ue+c*Se,s[8]=o*O+a*Z+l*te+c*$,s[12]=o*A+a*Y+l*ae+c*oe,s[1]=h*T+f*L+p*ee+d*B,s[5]=h*q+f*N+p*ue+d*Se,s[9]=h*O+f*Z+p*te+d*$,s[13]=h*A+f*Y+p*ae+d*oe,s[2]=m*T+x*L+v*ee+_*B,s[6]=m*q+x*N+v*ue+_*Se,s[10]=m*O+x*Z+v*te+_*$,s[14]=m*A+x*Y+v*ae+_*oe,s[3]=E*T+M*L+b*ee+S*B,s[7]=E*q+M*N+b*ue+S*Se,s[11]=E*O+M*Z+b*te+S*$,s[15]=E*A+M*Y+b*ae+S*oe,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],h=e[2],f=e[6],p=e[10],d=e[14],m=e[3],x=e[7],v=e[11],_=e[15];return m*(+s*l*f-i*c*f-s*a*p+r*c*p+i*a*d-r*l*d)+x*(+t*l*d-t*c*p+s*o*p-i*o*d+i*c*h-s*l*h)+v*(+t*c*f-t*a*d-s*o*f+r*o*d+s*a*h-r*c*h)+_*(-i*a*h-t*l*f+t*a*p+i*o*f-r*o*p+r*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],f=e[9],p=e[10],d=e[11],m=e[12],x=e[13],v=e[14],_=e[15],E=f*v*c-x*p*c+x*l*d-a*v*d-f*l*_+a*p*_,M=m*p*c-h*v*c-m*l*d+o*v*d+h*l*_-o*p*_,b=h*x*c-m*f*c+m*a*d-o*x*d-h*a*_+o*f*_,S=m*f*l-h*x*l-m*a*p+o*x*p+h*a*v-o*f*v,T=t*E+r*M+i*b+s*S;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const q=1/T;return e[0]=E*q,e[1]=(x*p*s-f*v*s-x*i*d+r*v*d+f*i*_-r*p*_)*q,e[2]=(a*v*s-x*l*s+x*i*c-r*v*c-a*i*_+r*l*_)*q,e[3]=(f*l*s-a*p*s-f*i*c+r*p*c+a*i*d-r*l*d)*q,e[4]=M*q,e[5]=(h*v*s-m*p*s+m*i*d-t*v*d-h*i*_+t*p*_)*q,e[6]=(m*l*s-o*v*s-m*i*c+t*v*c+o*i*_-t*l*_)*q,e[7]=(o*p*s-h*l*s+h*i*c-t*p*c-o*i*d+t*l*d)*q,e[8]=b*q,e[9]=(m*f*s-h*x*s-m*r*d+t*x*d+h*r*_-t*f*_)*q,e[10]=(o*x*s-m*a*s+m*r*c-t*x*c-o*r*_+t*a*_)*q,e[11]=(h*a*s-o*f*s-h*r*c+t*f*c+o*r*d-t*a*d)*q,e[12]=S*q,e[13]=(h*x*i-m*f*i+m*r*p-t*x*p-h*r*v+t*f*v)*q,e[14]=(m*a*i-o*x*i-m*r*l+t*x*l+o*r*v-t*a*v)*q,e[15]=(o*f*i-h*a*i+h*r*l-t*f*l-o*r*p+t*a*p)*q,this}scale(e){const t=this.elements,r=e.x,i=e.y,s=e.z;return t[0]*=r,t[4]*=i,t[8]*=s,t[1]*=r,t[5]*=i,t[9]*=s,t[2]*=r,t[6]*=i,t[10]*=s,t[3]*=r,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))}makeTranslation(e,t,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),i=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,h=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,h*a+r,h*l-i*o,0,c*l-i*a,h*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,h=o+o,f=a+a,p=s*c,d=s*h,m=s*f,x=o*h,v=o*f,_=a*f,E=l*c,M=l*h,b=l*f,S=r.x,T=r.y,q=r.z;return i[0]=(1-(x+_))*S,i[1]=(d+b)*S,i[2]=(m-M)*S,i[3]=0,i[4]=(d-b)*T,i[5]=(1-(p+_))*T,i[6]=(v+E)*T,i[7]=0,i[8]=(m+M)*q,i[9]=(v-E)*q,i[10]=(1-(p+x))*q,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){const i=this.elements;let s=sa.set(i[0],i[1],i[2]).length();const o=sa.set(i[4],i[5],i[6]).length(),a=sa.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],si.copy(this);const c=1/s,h=1/o,f=1/a;return si.elements[0]*=c,si.elements[1]*=c,si.elements[2]*=c,si.elements[4]*=h,si.elements[5]*=h,si.elements[6]*=h,si.elements[8]*=f,si.elements[9]*=f,si.elements[10]*=f,t.setFromRotationMatrix(si),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o,a=Ii,l=!1){const c=this.elements,h=2*s/(t-e),f=2*s/(r-i),p=(t+e)/(t-e),d=(r+i)/(r-i);let m,x;if(l)m=s/(o-s),x=o*s/(o-s);else if(a===Ii)m=-(o+s)/(o-s),x=-2*o*s/(o-s);else if(a===Qc)m=-o/(o-s),x=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=h,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=f,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,r,i,s,o,a=Ii,l=!1){const c=this.elements,h=2/(t-e),f=2/(r-i),p=-(t+e)/(t-e),d=-(r+i)/(r-i);let m,x;if(l)m=1/(o-s),x=o/(o-s);else if(a===Ii)m=-2/(o-s),x=-(o+s)/(o-s);else if(a===Qc)m=-1/(o-s),x=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=h,c[4]=0,c[8]=0,c[12]=p,c[1]=0,c[5]=f,c[9]=0,c[13]=d,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const sa=new j,si=new Kt,Kb=new j(0,0,0),Zb=new j(1,1,1),Ms=new j,cu=new j,br=new j,u_=new Kt,h_=new ys;class oi{constructor(e=0,t=0,r=0,i=oi.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,i=this._order){return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],h=i[9],f=i[2],p=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(bt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-bt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(bt(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-bt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(bt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-bt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return u_.makeRotationFromQuaternion(e),this.setFromRotationMatrix(u_,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return h_.setFromEuler(this),this.setFromQuaternion(h_,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}oi.DEFAULT_ORDER="XYZ";class lp{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Jb=0;const f_=new j,oa=new ys,Ki=new Kt,uu=new j,El=new j,Qb=new j,eM=new ys,d_=new j(1,0,0),p_=new j(0,1,0),m_=new j(0,0,1),g_={type:"added"},tM={type:"removed"},aa={type:"childadded",child:null},cp={type:"childremoved",child:null};class kt extends Qs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Jb++}),this.uuid=Jo(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=kt.DEFAULT_UP.clone();const e=new j,t=new oi,r=new ys,i=new j(1,1,1);function s(){r.setFromEuler(t,!1)}function o(){t.setFromQuaternion(r,void 0,!1)}t._onChange(s),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Kt},normalMatrix:{value:new yt}}),this.matrix=new Kt,this.matrixWorld=new Kt,this.matrixAutoUpdate=kt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=kt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new lp,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return oa.setFromAxisAngle(e,t),this.quaternion.multiply(oa),this}rotateOnWorldAxis(e,t){return oa.setFromAxisAngle(e,t),this.quaternion.premultiply(oa),this}rotateX(e){return this.rotateOnAxis(d_,e)}rotateY(e){return this.rotateOnAxis(p_,e)}rotateZ(e){return this.rotateOnAxis(m_,e)}translateOnAxis(e,t){return f_.copy(e).applyQuaternion(this.quaternion),this.position.add(f_.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(d_,e)}translateY(e){return this.translateOnAxis(p_,e)}translateZ(e){return this.translateOnAxis(m_,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ki.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?uu.copy(e):uu.set(e,t,r);const i=this.parent;this.updateWorldMatrix(!0,!1),El.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ki.lookAt(El,uu,this.up):Ki.lookAt(uu,El,this.up),this.quaternion.setFromRotationMatrix(Ki),i&&(Ki.extractRotation(i.matrixWorld),oa.setFromRotationMatrix(Ki),this.quaternion.premultiply(oa.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(g_),aa.child=e,this.dispatchEvent(aa),aa.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(tM),cp.child=e,this.dispatchEvent(cp),cp.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ki.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ki.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ki),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(g_),aa.child=e,this.dispatchEvent(aa),aa.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let r=0,i=this.children.length;r<i;r++){const o=this.children[r].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,r=[]){this[e]===t&&r.push(this);const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].getObjectsByProperty(e,t,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(El,e,Qb),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(El,eM,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let r=0,i=t.length;r<i;r++)t[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let r=0,i=t.length;r<i;r++)t[r].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let r=0,i=t.length;r<i;r++)t[r].updateMatrixWorld(e)}updateWorldMatrix(e,t){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(a=>({...a})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),h=o(e.images),f=o(e.shapes),p=o(e.skeletons),d=o(e.animations),m=o(e.nodes);a.length>0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),h.length>0&&(r.images=h),f.length>0&&(r.shapes=f),p.length>0&&(r.skeletons=p),d.length>0&&(r.animations=d),m.length>0&&(r.nodes=m)}return r.object=i,r;function o(a){const l=[];for(const c in a){const h=a[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r<e.children.length;r++){const i=e.children[r];this.add(i.clone())}return this}}kt.DEFAULT_UP=new j(0,1,0),kt.DEFAULT_MATRIX_AUTO_UPDATE=!0,kt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ai=new j,Zi=new j,up=new j,Ji=new j,la=new j,ca=new j,__=new j,hp=new j,fp=new j,dp=new j,pp=new pn,mp=new pn,gp=new pn;class li{constructor(e=new j,t=new j,r=new j){this.a=e,this.b=t,this.c=r}static getNormal(e,t,r,i){i.subVectors(r,t),ai.subVectors(e,t),i.cross(ai);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,r,i,s){ai.subVectors(i,t),Zi.subVectors(r,t),up.subVectors(e,t);const o=ai.dot(ai),a=ai.dot(Zi),l=ai.dot(up),c=Zi.dot(Zi),h=Zi.dot(up),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const p=1/f,d=(c*l-a*h)*p,m=(o*h-a*l)*p;return s.set(1-d-m,m,d)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,Ji)===null?!1:Ji.x>=0&&Ji.y>=0&&Ji.x+Ji.y<=1}static getInterpolation(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,Ji)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Ji.x),l.addScaledVector(o,Ji.y),l.addScaledVector(a,Ji.z),l)}static getInterpolatedAttribute(e,t,r,i,s,o){return pp.setScalar(0),mp.setScalar(0),gp.setScalar(0),pp.fromBufferAttribute(e,t),mp.fromBufferAttribute(e,r),gp.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(pp,s.x),o.addScaledVector(mp,s.y),o.addScaledVector(gp,s.z),o}static isFrontFacing(e,t,r,i){return ai.subVectors(r,t),Zi.subVectors(e,t),ai.cross(Zi).dot(i)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ai.subVectors(this.c,this.b),Zi.subVectors(this.a,this.b),ai.cross(Zi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return li.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return li.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,r,i,s){return li.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return li.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return li.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,i=this.b,s=this.c;let o,a;la.subVectors(i,r),ca.subVectors(s,r),hp.subVectors(e,r);const l=la.dot(hp),c=ca.dot(hp);if(l<=0&&c<=0)return t.copy(r);fp.subVectors(e,i);const h=la.dot(fp),f=ca.dot(fp);if(h>=0&&f<=h)return t.copy(i);const p=l*f-h*c;if(p<=0&&l>=0&&h<=0)return o=l/(l-h),t.copy(r).addScaledVector(la,o);dp.subVectors(e,s);const d=la.dot(dp),m=ca.dot(dp);if(m>=0&&d<=m)return t.copy(s);const x=d*c-l*m;if(x<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(r).addScaledVector(ca,a);const v=h*m-d*f;if(v<=0&&f-h>=0&&d-m>=0)return __.subVectors(s,i),a=(f-h)/(f-h+(d-m)),t.copy(i).addScaledVector(__,a);const _=1/(v+x+p);return o=x*_,a=p*_,t.copy(r).addScaledVector(la,o).addScaledVector(ca,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const v_={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ws={h:0,s:0,l:0},hu={h:0,s:0,l:0};function _p(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Ct{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Er){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Nt.colorSpaceToWorking(this,t),this}setRGB(e,t,r,i=Nt.workingColorSpace){return this.r=e,this.g=t,this.b=r,Nt.colorSpaceToWorking(this,i),this}setHSL(e,t,r,i=Nt.workingColorSpace){if(e=zb(e,1),t=bt(t,0,1),r=bt(r,0,1),t===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=_p(o,s,e+1/3),this.g=_p(o,s,e),this.b=_p(o,s,e-1/3)}return Nt.colorSpaceToWorking(this,i),this}setStyle(e,t=Er){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Er){const r=v_[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Xi(e.r),this.g=Xi(e.g),this.b=Xi(e.b),this}copyLinearToSRGB(e){return this.r=ea(e.r),this.g=ea(e.g),this.b=ea(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Er){return Nt.workingToColorSpace(Wn.copy(this),e),Math.round(bt(Wn.r*255,0,255))*65536+Math.round(bt(Wn.g*255,0,255))*256+Math.round(bt(Wn.b*255,0,255))}getHexString(e=Er){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Nt.workingColorSpace){Nt.workingToColorSpace(Wn.copy(this),t);const r=Wn.r,i=Wn.g,s=Wn.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const h=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=h<=.5?f/(o+a):f/(2-o-a),o){case r:l=(i-s)/f+(i<s?6:0);break;case i:l=(s-r)/f+2;break;case s:l=(r-i)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=Nt.workingColorSpace){return Nt.workingToColorSpace(Wn.copy(this),t),e.r=Wn.r,e.g=Wn.g,e.b=Wn.b,e}getStyle(e=Er){Nt.workingToColorSpace(Wn.copy(this),e);const t=Wn.r,r=Wn.g,i=Wn.b;return e!==Er?`color(${e} ${t.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,t,r){return this.getHSL(ws),this.setHSL(ws.h+e,ws.s+t,ws.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(ws),e.getHSL(hu);const r=Zd(ws.h,hu.h,t),i=Zd(ws.s,hu.s,t),s=Zd(ws.l,hu.l,t);return this.setHSL(r,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,r=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*r+s[6]*i,this.g=s[1]*t+s[4]*r+s[7]*i,this.b=s[2]*t+s[5]*r+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Wn=new Ct;Ct.NAMES=v_;let nM=0;class ro extends Qs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:nM++}),this.uuid=Jo(),this.name="",this.type="Material",this.blending=jo,this.side=gs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=id,this.blendDst=sd,this.blendEquation=Ys,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ct(0,0,0),this.blendAlpha=0,this.depthFunc=Xo,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=e_,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Zo,this.stencilZFail=Zo,this.stencilZPass=Zo,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const r=e[t];if(r===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==jo&&(r.blending=this.blending),this.side!==gs&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==id&&(r.blendSrc=this.blendSrc),this.blendDst!==sd&&(r.blendDst=this.blendDst),this.blendEquation!==Ys&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Xo&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==e_&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Zo&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Zo&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Zo&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let r=null;if(t!==null){const i=t.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class io extends ro{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ct(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new oi,this.combine=dd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const bn=new j,fu=new Be;let rM=0;class kr{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:rM++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=n_,this.updateRanges=[],this.gpuType=ji,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,r=this.count;t<r;t++)fu.fromBufferAttribute(this,t),fu.applyMatrix3(e),this.setXY(t,fu.x,fu.y);else if(this.itemSize===3)for(let t=0,r=this.count;t<r;t++)bn.fromBufferAttribute(this,t),bn.applyMatrix3(e),this.setXYZ(t,bn.x,bn.y,bn.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)bn.fromBufferAttribute(this,t),bn.applyMatrix4(e),this.setXYZ(t,bn.x,bn.y,bn.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)bn.fromBufferAttribute(this,t),bn.applyNormalMatrix(e),this.setXYZ(t,bn.x,bn.y,bn.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)bn.fromBufferAttribute(this,t),bn.transformDirection(e),this.setXYZ(t,bn.x,bn.y,bn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let r=this.array[e*this.itemSize+t];return this.normalized&&(r=vl(r,this.array)),r}setComponent(e,t,r){return this.normalized&&(r=cr(r,this.array)),this.array[e*this.itemSize+t]=r,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=vl(t,this.array)),t}setX(e,t){return this.normalized&&(t=cr(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=vl(t,this.array)),t}setY(e,t){return this.normalized&&(t=cr(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=vl(t,this.array)),t}setZ(e,t){return this.normalized&&(t=cr(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=vl(t,this.array)),t}setW(e,t){return this.normalized&&(t=cr(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=cr(t,this.array),r=cr(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,i){return e*=this.itemSize,this.normalized&&(t=cr(t,this.array),r=cr(r,this.array),i=cr(i,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,t,r,i,s){return e*=this.itemSize,this.normalized&&(t=cr(t,this.array),r=cr(r,this.array),i=cr(i,this.array),s=cr(s,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==n_&&(e.usage=this.usage),e}}class x_ extends kr{constructor(e,t,r){super(new Uint16Array(e),t,r)}}class y_ extends kr{constructor(e,t,r){super(new Uint32Array(e),t,r)}}class er extends kr{constructor(e,t,r){super(new Float32Array(e),t,r)}}let iM=0;const Br=new Kt,vp=new kt,ua=new j,Mr=new Li,bl=new Li,qn=new j;class ur extends Qs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:iM++}),this.uuid=Jo(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(s_(e)?y_:x_)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,r=0){this.groups.push({start:e,count:t,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const s=new yt().getNormalMatrix(e);r.applyNormalMatrix(s),r.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Br.makeRotationFromQuaternion(e),this.applyMatrix4(Br),this}rotateX(e){return Br.makeRotationX(e),this.applyMatrix4(Br),this}rotateY(e){return Br.makeRotationY(e),this.applyMatrix4(Br),this}rotateZ(e){return Br.makeRotationZ(e),this.applyMatrix4(Br),this}translate(e,t,r){return Br.makeTranslation(e,t,r),this.applyMatrix4(Br),this}scale(e,t,r){return Br.makeScale(e,t,r),this.applyMatrix4(Br),this}lookAt(e){return vp.lookAt(e),vp.updateMatrix(),this.applyMatrix4(vp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ua).negate(),this.translate(ua.x,ua.y,ua.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const r=[];for(let i=0,s=e.length;i<s;i++){const o=e[i];r.push(o.x,o.y,o.z||0)}this.setAttribute("position",new er(r,3))}else{const r=Math.min(e.length,t.count);for(let i=0;i<r;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Li);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new j(-1/0,-1/0,-1/0),new j(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let r=0,i=t.length;r<i;r++){const s=t[r];Mr.setFromBufferAttribute(s),this.morphTargetsRelative?(qn.addVectors(this.boundingBox.min,Mr.min),this.boundingBox.expandByPoint(qn),qn.addVectors(this.boundingBox.max,Mr.max),this.boundingBox.expandByPoint(qn)):(this.boundingBox.expandByPoint(Mr.min),this.boundingBox.expandByPoint(Mr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new su);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new j,1/0);return}if(e){const r=this.boundingSphere.center;if(Mr.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];bl.setFromBufferAttribute(a),this.morphTargetsRelative?(qn.addVectors(Mr.min,bl.min),Mr.expandByPoint(qn),qn.addVectors(Mr.max,bl.max),Mr.expandByPoint(qn)):(Mr.expandByPoint(bl.min),Mr.expandByPoint(bl.max))}Mr.getCenter(r);let i=0;for(let s=0,o=e.count;s<o;s++)qn.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(qn));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,h=a.count;c<h;c++)qn.fromBufferAttribute(a,c),l&&(ua.fromBufferAttribute(e,c),qn.add(ua)),i=Math.max(i,r.distanceToSquared(qn))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new kr(new Float32Array(4*r.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let O=0;O<r.count;O++)a[O]=new j,l[O]=new j;const c=new j,h=new j,f=new j,p=new Be,d=new Be,m=new Be,x=new j,v=new j;function _(O,A,L){c.fromBufferAttribute(r,O),h.fromBufferAttribute(r,A),f.fromBufferAttribute(r,L),p.fromBufferAttribute(s,O),d.fromBufferAttribute(s,A),m.fromBufferAttribute(s,L),h.sub(c),f.sub(c),d.sub(p),m.sub(p);const N=1/(d.x*m.y-m.x*d.y);isFinite(N)&&(x.copy(h).multiplyScalar(m.y).addScaledVector(f,-d.y).multiplyScalar(N),v.copy(f).multiplyScalar(d.x).addScaledVector(h,-m.x).multiplyScalar(N),a[O].add(x),a[A].add(x),a[L].add(x),l[O].add(v),l[A].add(v),l[L].add(v))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let O=0,A=E.length;O<A;++O){const L=E[O],N=L.start,Z=L.count;for(let Y=N,ee=N+Z;Y<ee;Y+=3)_(e.getX(Y+0),e.getX(Y+1),e.getX(Y+2))}const M=new j,b=new j,S=new j,T=new j;function q(O){S.fromBufferAttribute(i,O),T.copy(S);const A=a[O];M.copy(A),M.sub(S.multiplyScalar(S.dot(A))).normalize(),b.crossVectors(T,A);const N=b.dot(l[O])<0?-1:1;o.setXYZW(O,M.x,M.y,M.z,N)}for(let O=0,A=E.length;O<A;++O){const L=E[O],N=L.start,Z=L.count;for(let Y=N,ee=N+Z;Y<ee;Y+=3)q(e.getX(Y+0)),q(e.getX(Y+1)),q(e.getX(Y+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new kr(new Float32Array(t.count*3),3),this.setAttribute("normal",r);else for(let p=0,d=r.count;p<d;p++)r.setXYZ(p,0,0,0);const i=new j,s=new j,o=new j,a=new j,l=new j,c=new j,h=new j,f=new j;if(e)for(let p=0,d=e.count;p<d;p+=3){const m=e.getX(p+0),x=e.getX(p+1),v=e.getX(p+2);i.fromBufferAttribute(t,m),s.fromBufferAttribute(t,x),o.fromBufferAttribute(t,v),h.subVectors(o,s),f.subVectors(i,s),h.cross(f),a.fromBufferAttribute(r,m),l.fromBufferAttribute(r,x),c.fromBufferAttribute(r,v),a.add(h),l.add(h),c.add(h),r.setXYZ(m,a.x,a.y,a.z),r.setXYZ(x,l.x,l.y,l.z),r.setXYZ(v,c.x,c.y,c.z)}else for(let p=0,d=t.count;p<d;p+=3)i.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),o.fromBufferAttribute(t,p+2),h.subVectors(o,s),f.subVectors(i,s),h.cross(f),r.setXYZ(p+0,h.x,h.y,h.z),r.setXYZ(p+1,h.x,h.y,h.z),r.setXYZ(p+2,h.x,h.y,h.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,r=e.count;t<r;t++)qn.fromBufferAttribute(e,t),qn.normalize(),e.setXYZ(t,qn.x,qn.y,qn.z)}toNonIndexed(){function e(a,l){const c=a.array,h=a.itemSize,f=a.normalized,p=new c.constructor(l.length*h);let d=0,m=0;for(let x=0,v=l.length;x<v;x++){a.isInterleavedBufferAttribute?d=l[x]*a.data.stride+a.offset:d=l[x]*h;for(let _=0;_<h;_++)p[m++]=c[d++]}return new kr(p,h,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new ur,r=this.index.array,i=this.attributes;for(const a in i){const l=i[a],c=e(l,r);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let h=0,f=c.length;h<f;h++){const p=c[h],d=e(p,r);l.push(d)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let f=0,p=c.length;f<p;f++){const d=c[f];h.push(d.toJSON(e.data))}h.length>0&&(i[l]=h,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone());const i=e.attributes;for(const c in i){const h=i[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],f=s[c];for(let p=0,d=f.length;p<d;p++)h.push(f[p].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,h=o.length;c<h;c++){const f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const S_=new Kt,so=new lu,du=new su,E_=new j,pu=new j,mu=new j,gu=new j,xp=new j,_u=new j,b_=new j,vu=new j;class Dn extends kt{constructor(e=new ur,t=new io){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,o=r.morphTargetsRelative;t.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(s&&a){_u.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=a[l],f=s[l];h!==0&&(xp.fromBufferAttribute(f,e),o?_u.addScaledVector(xp,h):_u.addScaledVector(xp.sub(t),h))}t.add(_u)}return t}raycast(e,t){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),du.copy(r.boundingSphere),du.applyMatrix4(s),so.copy(e.ray).recast(e.near),!(du.containsPoint(so.origin)===!1&&(so.intersectSphere(du,E_)===null||so.origin.distanceToSquared(E_)>(e.far-e.near)**2))&&(S_.copy(s).invert(),so.copy(e.ray).applyMatrix4(S_),!(r.boundingBox!==null&&so.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,so)))}_computeIntersections(e,t,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,f=s.attributes.normal,p=s.groups,d=s.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,x=p.length;m<x;m++){const v=p[m],_=o[v.materialIndex],E=Math.max(v.start,d.start),M=Math.min(a.count,Math.min(v.start+v.count,d.start+d.count));for(let b=E,S=M;b<S;b+=3){const T=a.getX(b),q=a.getX(b+1),O=a.getX(b+2);i=xu(this,_,e,r,c,h,f,T,q,O),i&&(i.faceIndex=Math.floor(b/3),i.face.materialIndex=v.materialIndex,t.push(i))}}else{const m=Math.max(0,d.start),x=Math.min(a.count,d.start+d.count);for(let v=m,_=x;v<_;v+=3){const E=a.getX(v),M=a.getX(v+1),b=a.getX(v+2);i=xu(this,o,e,r,c,h,f,E,M,b),i&&(i.faceIndex=Math.floor(v/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(o))for(let m=0,x=p.length;m<x;m++){const v=p[m],_=o[v.materialIndex],E=Math.max(v.start,d.start),M=Math.min(l.count,Math.min(v.start+v.count,d.start+d.count));for(let b=E,S=M;b<S;b+=3){const T=b,q=b+1,O=b+2;i=xu(this,_,e,r,c,h,f,T,q,O),i&&(i.faceIndex=Math.floor(b/3),i.face.materialIndex=v.materialIndex,t.push(i))}}else{const m=Math.max(0,d.start),x=Math.min(l.count,d.start+d.count);for(let v=m,_=x;v<_;v+=3){const E=v,M=v+1,b=v+2;i=xu(this,o,e,r,c,h,f,E,M,b),i&&(i.faceIndex=Math.floor(v/3),t.push(i))}}}}function sM(n,e,t,r,i,s,o,a){let l;if(e.side===lr?l=r.intersectTriangle(o,s,i,!0,a):l=r.intersectTriangle(i,s,o,e.side===gs,a),l===null)return null;vu.copy(a),vu.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(vu);return c<t.near||c>t.far?null:{distance:c,point:vu.clone(),object:n}}function xu(n,e,t,r,i,s,o,a,l,c){n.getVertexPosition(a,pu),n.getVertexPosition(l,mu),n.getVertexPosition(c,gu);const h=sM(n,e,t,r,pu,mu,gu,b_);if(h){const f=new j;li.getBarycoord(b_,pu,mu,gu,f),i&&(h.uv=li.getInterpolatedAttribute(i,a,l,c,f,new Be)),s&&(h.uv1=li.getInterpolatedAttribute(s,a,l,c,f,new Be)),o&&(h.normal=li.getInterpolatedAttribute(o,a,l,c,f,new j),h.normal.dot(r.direction)>0&&h.normal.multiplyScalar(-1));const p={a,b:l,c,normal:new j,materialIndex:0};li.getNormal(pu,mu,gu,p.normal),h.face=p,h.barycoord=f}return h}class oo extends ur{constructor(e=1,t=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],h=[],f=[];let p=0,d=0;m("z","y","x",-1,-1,r,t,e,o,s,0),m("z","y","x",1,-1,r,t,-e,o,s,1),m("x","z","y",1,1,e,r,t,i,o,2),m("x","z","y",1,-1,e,r,-t,i,o,3),m("x","y","z",1,-1,e,t,r,i,s,4),m("x","y","z",-1,-1,e,t,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new er(c,3)),this.setAttribute("normal",new er(h,3)),this.setAttribute("uv",new er(f,2));function m(x,v,_,E,M,b,S,T,q,O,A){const L=b/q,N=S/O,Z=b/2,Y=S/2,ee=T/2,ue=q+1,te=O+1;let ae=0,B=0;const Se=new j;for(let $=0;$<te;$++){const oe=$*N-Y;for(let Ae=0;Ae<ue;Ae++){const Ie=Ae*L-Z;Se[x]=Ie*E,Se[v]=oe*M,Se[_]=ee,c.push(Se.x,Se.y,Se.z),Se[x]=0,Se[v]=0,Se[_]=T>0?1:-1,h.push(Se.x,Se.y,Se.z),f.push(Ae/q),f.push(1-$/O),ae+=1}}for(let $=0;$<O;$++)for(let oe=0;oe<q;oe++){const Ae=p+oe+ue*$,Ie=p+oe+ue*($+1),Ce=p+(oe+1)+ue*($+1),V=p+(oe+1)+ue*$;l.push(Ae,Ie,V),l.push(Ie,Ce,V),B+=6}a.addGroup(d,B,A),d+=B,p+=ae}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new oo(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ha(n){const e={};for(const t in n){e[t]={};for(const r in n[t]){const i=n[t][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][r]=null):e[t][r]=i.clone():Array.isArray(i)?e[t][r]=i.slice():e[t][r]=i}}return e}function tr(n){const e={};for(let t=0;t<n.length;t++){const r=ha(n[t]);for(const i in r)e[i]=r[i]}return e}function oM(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function M_(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Nt.workingColorSpace}const aM={clone:ha,merge:tr};var lM=`void main() {
74
+ */const rd="179",qo={ROTATE:0,DOLLY:1,PAN:2},Do={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},JE=0,k1=1,QE=2,B1=1,eb=2,Ui=3,ls=0,Qn=1,yi=2,cs=0,No=1,V1=2,H1=3,G1=4,tb=5,ks=100,nb=101,rb=102,ib=103,sb=104,ob=200,ab=201,lb=202,cb=203,id=204,sd=205,ub=206,hb=207,fb=208,db=209,pb=210,mb=211,gb=212,_b=213,vb=214,od=0,ad=1,ld=2,Uo=3,cd=4,ud=5,hd=6,fd=7,dd=0,xb=1,yb=2,us=0,Sb=1,Eb=2,bb=3,Mb=4,wb=5,Tb=6,Ab=7,W1=300,Fo=301,zo=302,pd=303,md=304,kc=306,jr=1e3,Bs=1001,gd=1002,Xr=1003,Cb=1004,Bc=1005,Si=1006,_d=1007,Vs=1008,Ei=1009,j1=1010,X1=1011,sl=1012,vd=1013,Hs=1014,Fi=1015,ol=1016,xd=1017,yd=1018,al=1020,$1=35902,Y1=1021,K1=1022,$r=1023,ll=1026,cl=1027,Z1=1028,Sd=1029,J1=1030,Ed=1031,bd=1033,Vc=33776,Hc=33777,Gc=33778,Wc=33779,Md=35840,wd=35841,Td=35842,Ad=35843,Cd=36196,Rd=37492,Pd=37496,Id=37808,Ld=37809,Od=37810,qd=37811,Dd=37812,Nd=37813,Ud=37814,Fd=37815,zd=37816,kd=37817,Bd=37818,Vd=37819,Hd=37820,Gd=37821,jc=36492,Wd=36494,jd=36495,Q1=36283,Xd=36284,$d=36285,Yd=36286,Rb=3200,Pb=3201,Kd=0,Ib=1,hs="",pr="srgb",ko="srgb-linear",Xc="linear",Ut="srgb",Bo=7680,e_=519,Lb=512,Ob=513,qb=514,t_=515,Db=516,Nb=517,Ub=518,Fb=519,n_=35044,r_="300 es",bi=2e3,$c=2001;class Gs{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){const r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){const r=this._listeners;if(r===void 0)return;const i=r[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const r=t[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}const qn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],Yc=Math.PI/180,Kc=180/Math.PI;function Vo(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(qn[n&255]+qn[n>>8&255]+qn[n>>16&255]+qn[n>>24&255]+"-"+qn[e&255]+qn[e>>8&255]+"-"+qn[e>>16&15|64]+qn[e>>24&255]+"-"+qn[t&63|128]+qn[t>>8&255]+"-"+qn[t>>16&255]+qn[t>>24&255]+qn[r&255]+qn[r>>8&255]+qn[r>>16&255]+qn[r>>24&255]).toLowerCase()}function _t(n,e,t){return Math.max(e,Math.min(t,n))}function zb(n,e){return(n%e+e)%e}function Zd(n,e,t){return(1-t)*n+t*e}function ul(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function er(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const kb={DEG2RAD:Yc};class Fe{constructor(e=0,t=0){Fe.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=_t(this.x,e.x,t.x),this.y=_t(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=_t(this.x,e,t),this.y=_t(this.y,e,t),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(_t(r,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(_t(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class fs{constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}static slerpFlat(e,t,r,i,s,o,a){let l=r[i+0],c=r[i+1],h=r[i+2],f=r[i+3];const p=s[o+0],d=s[o+1],m=s[o+2],x=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=f;return}if(a===1){e[t+0]=p,e[t+1]=d,e[t+2]=m,e[t+3]=x;return}if(f!==x||l!==p||c!==d||h!==m){let v=1-a;const _=l*p+c*d+h*m+f*x,b=_>=0?1:-1,M=1-_*_;if(M>Number.EPSILON){const S=Math.sqrt(M),T=Math.atan2(S,_*b);v=Math.sin(v*T)/S,a=Math.sin(a*T)/S}const E=a*b;if(l=l*v+p*E,c=c*v+d*E,h=h*v+m*E,f=f*v+x*E,v===1-a){const S=1/Math.sqrt(l*l+c*c+h*h+f*f);l*=S,c*=S,h*=S,f*=S}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=f}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],h=r[i+3],f=s[o],p=s[o+1],d=s[o+2],m=s[o+3];return e[t]=a*m+h*f+l*d-c*p,e[t+1]=l*m+h*p+c*f-a*d,e[t+2]=c*m+h*d+a*p-l*f,e[t+3]=h*m-a*f-l*p-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),h=a(i/2),f=a(s/2),p=l(r/2),d=l(i/2),m=l(s/2);switch(o){case"XYZ":this._x=p*h*f+c*d*m,this._y=c*d*f-p*h*m,this._z=c*h*m+p*d*f,this._w=c*h*f-p*d*m;break;case"YXZ":this._x=p*h*f+c*d*m,this._y=c*d*f-p*h*m,this._z=c*h*m-p*d*f,this._w=c*h*f+p*d*m;break;case"ZXY":this._x=p*h*f-c*d*m,this._y=c*d*f+p*h*m,this._z=c*h*m+p*d*f,this._w=c*h*f-p*d*m;break;case"ZYX":this._x=p*h*f-c*d*m,this._y=c*d*f+p*h*m,this._z=c*h*m-p*d*f,this._w=c*h*f+p*d*m;break;case"YZX":this._x=p*h*f+c*d*m,this._y=c*d*f+p*h*m,this._z=c*h*m-p*d*f,this._w=c*h*f-p*d*m;break;case"XZY":this._x=p*h*f-c*d*m,this._y=c*d*f-p*h*m,this._z=c*h*m+p*d*f,this._w=c*h*f+p*d*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],h=t[6],f=t[10],p=r+a+f;if(p>0){const d=.5/Math.sqrt(p+1);this._w=.25/d,this._x=(h-l)*d,this._y=(s-c)*d,this._z=(o-i)*d}else if(r>a&&r>f){const d=2*Math.sqrt(1+r-a-f);this._w=(h-l)/d,this._x=.25*d,this._y=(i+o)/d,this._z=(s+c)/d}else if(a>f){const d=2*Math.sqrt(1+a-r-f);this._w=(s-c)/d,this._x=(i+o)/d,this._y=.25*d,this._z=(l+h)/d}else{const d=2*Math.sqrt(1+f-r-a);this._w=(o-i)/d,this._x=(s+c)/d,this._y=(l+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<1e-8?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(_t(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,h=t._w;return this._x=r*h+o*a+i*c-s*l,this._y=i*h+o*l+s*a-r*c,this._z=s*h+o*c+r*l-i*a,this._w=o*h-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const d=1-t;return this._w=d*o+t*this._w,this._x=d*r+t*this._x,this._y=d*i+t*this._y,this._z=d*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,a),f=Math.sin((1-t)*h)/c,p=Math.sin(t*h)/c;return this._w=o*f+this._w*p,this._x=r*f+this._x*p,this._y=i*f+this._y*p,this._z=s*f+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class G{constructor(e=0,t=0,r=0){G.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(i_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(i_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*i,this.y=s[1]*t+s[4]*r+s[7]*i,this.z=s[2]*t+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),h=2*(a*t-s*i),f=2*(s*r-o*t);return this.x=t+l*c+o*f-a*h,this.y=r+l*h+a*c-s*f,this.z=i+l*f+s*h-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i,this.y=s[1]*t+s[5]*r+s[9]*i,this.z=s[2]*t+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=_t(this.x,e.x,t.x),this.y=_t(this.y,e.y,t.y),this.z=_t(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=_t(this.x,e,t),this.y=_t(this.y,e,t),this.z=_t(this.z,e,t),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(_t(r,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return Jd.copy(this).projectOnVector(e),this.sub(Jd)}reflect(e){return this.sub(Jd.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(_t(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,r=Math.sqrt(1-t*t);return this.x=r*Math.cos(e),this.y=t,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Jd=new G,i_=new fs;class pt{constructor(e,t,r,i,s,o,a,l,c){pt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c)}set(e,t,r,i,s,o,a,l,c){const h=this.elements;return h[0]=e,h[1]=i,h[2]=a,h[3]=t,h[4]=s,h[5]=l,h[6]=r,h[7]=o,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],h=r[4],f=r[7],p=r[2],d=r[5],m=r[8],x=i[0],v=i[3],_=i[6],b=i[1],M=i[4],E=i[7],S=i[2],T=i[5],q=i[8];return s[0]=o*x+a*b+l*S,s[3]=o*v+a*M+l*T,s[6]=o*_+a*E+l*q,s[1]=c*x+h*b+f*S,s[4]=c*v+h*M+f*T,s[7]=c*_+h*E+f*q,s[2]=p*x+d*b+m*S,s[5]=p*v+d*M+m*T,s[8]=p*_+d*E+m*q,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8];return t*o*h-t*a*c-r*s*h+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],f=h*o-a*c,p=a*l-h*s,d=c*s-o*l,m=t*f+r*p+i*d;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/m;return e[0]=f*x,e[1]=(i*c-h*r)*x,e[2]=(a*r-i*o)*x,e[3]=p*x,e[4]=(h*t-i*l)*x,e[5]=(i*s-a*t)*x,e[6]=d*x,e[7]=(r*l-c*t)*x,e[8]=(o*t-r*s)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Qd.makeScale(e,t)),this}rotate(e){return this.premultiply(Qd.makeRotation(-e)),this}translate(e,t){return this.premultiply(Qd.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Qd=new pt;function s_(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function hl(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Bb(){const n=hl("canvas");return n.style.display="block",n}const o_={};function Ho(n){n in o_||(o_[n]=!0,console.warn(n))}function Vb(n,e,t){return new Promise(function(r,i){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:i();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:r()}}setTimeout(s,t)})}const a_=new pt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),l_=new pt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Hb(){const n={enabled:!0,workingColorSpace:ko,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Ut&&(i.r=zi(i.r),i.g=zi(i.g),i.b=zi(i.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Ut&&(i.r=Go(i.r),i.g=Go(i.g),i.b=Go(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===hs?Xc:this.spaces[i].transfer},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,o){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return Ho("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Ho("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],r=[.3127,.329];return n.define({[ko]:{primaries:e,whitePoint:r,transfer:Xc,toXYZ:a_,fromXYZ:l_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:pr},outputColorSpaceConfig:{drawingBufferColorSpace:pr}},[pr]:{primaries:e,whitePoint:r,transfer:Ut,toXYZ:a_,fromXYZ:l_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:pr}}}),n}const Ct=Hb();function zi(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Go(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Wo;class Gb{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{Wo===void 0&&(Wo=hl("canvas")),Wo.width=e.width,Wo.height=e.height;const i=Wo.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),r=Wo}return r.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=hl("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o<s.length;o++)s[o]=zi(s[o]/255)*255;return r.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let r=0;r<t.length;r++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[r]=Math.floor(zi(t[r]/255)*255):t[r]=zi(t[r]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Wb=0;class ep{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Wb++}),this.uuid=Vo(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(tp(i[o].image)):s.push(tp(i[o]))}else s=tp(i);r.url=s}return t||(e.images[this.uuid]=r),r}}function tp(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Gb.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let jb=0;const np=new G;class Dn extends Gs{constructor(e=Dn.DEFAULT_IMAGE,t=Dn.DEFAULT_MAPPING,r=Bs,i=Bs,s=Si,o=Vs,a=$r,l=Ei,c=Dn.DEFAULT_ANISOTROPY,h=hs){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:jb++}),this.uuid=Vo(),this.name="",this.source=new ep(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Fe(0,0),this.repeat=new Fe(1,1),this.center=new Fe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new pt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(np).x}get height(){return this.source.getSize(np).y}get depth(){return this.source.getSize(np).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const r=e[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}i&&r&&i.isVector2&&r.isVector2||i&&r&&i.isVector3&&r.isVector3||i&&r&&i.isMatrix3&&r.isMatrix3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==W1)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case jr:e.x=e.x-Math.floor(e.x);break;case Bs:e.x=e.x<0?0:1;break;case gd:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case jr:e.y=e.y-Math.floor(e.y);break;case Bs:e.y=e.y<0?0:1;break;case gd:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Dn.DEFAULT_IMAGE=null,Dn.DEFAULT_MAPPING=W1,Dn.DEFAULT_ANISOTROPY=1;class on{constructor(e=0,t=0,r=0,i=1){on.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*r+o[11]*i+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,i,s;const l=e.elements,c=l[0],h=l[4],f=l[8],p=l[1],d=l[5],m=l[9],x=l[2],v=l[6],_=l[10];if(Math.abs(h-p)<.01&&Math.abs(f-x)<.01&&Math.abs(m-v)<.01){if(Math.abs(h+p)<.1&&Math.abs(f+x)<.1&&Math.abs(m+v)<.1&&Math.abs(c+d+_-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const M=(c+1)/2,E=(d+1)/2,S=(_+1)/2,T=(h+p)/4,q=(f+x)/4,O=(m+v)/4;return M>E&&M>S?M<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(M),i=T/r,s=q/r):E>S?E<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(E),r=T/i,s=O/i):S<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(S),r=q/s,i=O/s),this.set(r,i,s,t),this}let b=Math.sqrt((v-m)*(v-m)+(f-x)*(f-x)+(p-h)*(p-h));return Math.abs(b)<.001&&(b=1),this.x=(v-m)/b,this.y=(f-x)/b,this.z=(p-h)/b,this.w=Math.acos((c+d+_-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=_t(this.x,e.x,t.x),this.y=_t(this.y,e.y,t.y),this.z=_t(this.z,e.z,t.z),this.w=_t(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=_t(this.x,e,t),this.y=_t(this.y,e,t),this.z=_t(this.z,e,t),this.w=_t(this.w,e,t),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(_t(r,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Xb extends Gs{constructor(e=1,t=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Si,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},r),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=r.depth,this.scissor=new on(0,0,e,t),this.scissorTest=!1,this.viewport=new on(0,0,e,t);const i={width:e,height:t,depth:r.depth},s=new Dn(i);this.textures=[];const o=r.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(r),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples,this.multiview=r.multiview}_setTextureOptions(e={}){const t={minFilter:Si,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let r=0;r<this.textures.length;r++)this.textures[r].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,r=1){if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=r,this.textures[i].isArrayTexture=this.textures[i].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,r=e.textures.length;t<r;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new ep(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ws extends Xb{constructor(e=1,t=1,r={}){super(e,t,r),this.isWebGLRenderTarget=!0}}class c_ extends Dn{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=Xr,this.minFilter=Xr,this.wrapR=Bs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class $b extends Dn{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=Xr,this.minFilter=Xr,this.wrapR=Bs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Mi{constructor(e=new G(1/0,1/0,1/0),t=new G(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t+=3)this.expandByPoint(Yr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,r=e.count;t<r;t++)this.expandByPoint(Yr.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const r=Yr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const r=e.geometry;if(r!==void 0){const s=r.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Yr):Yr.fromBufferAttribute(s,o),Yr.applyMatrix4(e.matrixWorld),this.expandByPoint(Yr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Zc.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),Zc.copy(r.boundingBox)),Zc.applyMatrix4(e.matrixWorld),this.union(Zc)}const i=e.children;for(let s=0,o=i.length;s<o;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Yr),Yr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(fl),Jc.subVectors(this.max,fl),jo.subVectors(e.a,fl),Xo.subVectors(e.b,fl),$o.subVectors(e.c,fl),ds.subVectors(Xo,jo),ps.subVectors($o,Xo),js.subVectors(jo,$o);let t=[0,-ds.z,ds.y,0,-ps.z,ps.y,0,-js.z,js.y,ds.z,0,-ds.x,ps.z,0,-ps.x,js.z,0,-js.x,-ds.y,ds.x,0,-ps.y,ps.x,0,-js.y,js.x,0];return!rp(t,jo,Xo,$o,Jc)||(t=[1,0,0,0,1,0,0,0,1],!rp(t,jo,Xo,$o,Jc))?!1:(Qc.crossVectors(ds,ps),t=[Qc.x,Qc.y,Qc.z],rp(t,jo,Xo,$o,Jc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Yr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Yr).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(ki[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ki[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ki[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ki[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ki[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ki[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ki[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ki[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ki),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const ki=[new G,new G,new G,new G,new G,new G,new G,new G],Yr=new G,Zc=new Mi,jo=new G,Xo=new G,$o=new G,ds=new G,ps=new G,js=new G,fl=new G,Jc=new G,Qc=new G,Xs=new G;function rp(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){Xs.fromArray(n,s);const a=i.x*Math.abs(Xs.x)+i.y*Math.abs(Xs.y)+i.z*Math.abs(Xs.z),l=e.dot(Xs),c=t.dot(Xs),h=r.dot(Xs);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}const Yb=new Mi,dl=new G,ip=new G;class eu{constructor(e=new G,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):Yb.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;dl.subVectors(e,this.center);const t=dl.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(dl,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(ip.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(dl.copy(e.center).add(ip)),this.expandByPoint(dl.copy(e.center).sub(ip))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const Bi=new G,sp=new G,tu=new G,ms=new G,op=new G,nu=new G,ap=new G;class ru{constructor(e=new G,t=new G(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Bi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Bi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Bi.copy(this.origin).addScaledVector(this.direction,t),Bi.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){sp.copy(e).add(t).multiplyScalar(.5),tu.copy(t).sub(e).normalize(),ms.copy(this.origin).sub(sp);const s=e.distanceTo(t)*.5,o=-this.direction.dot(tu),a=ms.dot(this.direction),l=-ms.dot(tu),c=ms.lengthSq(),h=Math.abs(1-o*o);let f,p,d,m;if(h>0)if(f=o*l-a,p=o*a-l,m=s*h,f>=0)if(p>=-m)if(p<=m){const x=1/h;f*=x,p*=x,d=f*(f+o*p+2*a)+p*(o*f+p+2*l)+c}else p=s,f=Math.max(0,-(o*p+a)),d=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(o*p+a)),d=-f*f+p*(p+2*l)+c;else p<=-m?(f=Math.max(0,-(-o*s+a)),p=f>0?-s:Math.min(Math.max(-s,-l),s),d=-f*f+p*(p+2*l)+c):p<=m?(f=0,p=Math.min(Math.max(-s,-l),s),d=p*(p+2*l)+c):(f=Math.max(0,-(o*s+a)),p=f>0?s:Math.min(Math.max(-s,-l),s),d=-f*f+p*(p+2*l)+c);else p=o>0?-s:s,f=Math.max(0,-(o*p+a)),d=-f*f+p*(p+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(sp).addScaledVector(tu,p),d}intersectSphere(e,t){Bi.subVectors(e.center,this.origin);const r=Bi.dot(this.direction),i=Bi.dot(Bi)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,s,o,a,l;const c=1/this.direction.x,h=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(r=(e.min.x-p.x)*c,i=(e.max.x-p.x)*c):(r=(e.max.x-p.x)*c,i=(e.min.x-p.x)*c),h>=0?(s=(e.min.y-p.y)*h,o=(e.max.y-p.y)*h):(s=(e.max.y-p.y)*h,o=(e.min.y-p.y)*h),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o<i||isNaN(i))&&(i=o),f>=0?(a=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(a=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),r>l||a>i)||((a>r||r!==r)&&(r=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(r>=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,Bi)!==null}intersectTriangle(e,t,r,i,s){op.subVectors(t,e),nu.subVectors(r,e),ap.crossVectors(op,nu);let o=this.direction.dot(ap),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ms.subVectors(this.origin,e);const l=a*this.direction.dot(nu.crossVectors(ms,nu));if(l<0)return null;const c=a*this.direction.dot(op.cross(ms));if(c<0||l+c>o)return null;const h=-a*ms.dot(ap);return h<0?null:this.at(h/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ht{constructor(e,t,r,i,s,o,a,l,c,h,f,p,d,m,x,v){Ht.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c,h,f,p,d,m,x,v)}set(e,t,r,i,s,o,a,l,c,h,f,p,d,m,x,v){const _=this.elements;return _[0]=e,_[4]=t,_[8]=r,_[12]=i,_[1]=s,_[5]=o,_[9]=a,_[13]=l,_[2]=c,_[6]=h,_[10]=f,_[14]=p,_[3]=d,_[7]=m,_[11]=x,_[15]=v,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ht().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,i=1/Yo.setFromMatrixColumn(e,0).length(),s=1/Yo.setFromMatrixColumn(e,1).length(),o=1/Yo.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),h=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const p=o*h,d=o*f,m=a*h,x=a*f;t[0]=l*h,t[4]=-l*f,t[8]=c,t[1]=d+m*c,t[5]=p-x*c,t[9]=-a*l,t[2]=x-p*c,t[6]=m+d*c,t[10]=o*l}else if(e.order==="YXZ"){const p=l*h,d=l*f,m=c*h,x=c*f;t[0]=p+x*a,t[4]=m*a-d,t[8]=o*c,t[1]=o*f,t[5]=o*h,t[9]=-a,t[2]=d*a-m,t[6]=x+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*h,d=l*f,m=c*h,x=c*f;t[0]=p-x*a,t[4]=-o*f,t[8]=m+d*a,t[1]=d+m*a,t[5]=o*h,t[9]=x-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*h,d=o*f,m=a*h,x=a*f;t[0]=l*h,t[4]=m*c-d,t[8]=p*c+x,t[1]=l*f,t[5]=x*c+p,t[9]=d*c-m,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,d=o*c,m=a*l,x=a*c;t[0]=l*h,t[4]=x-p*f,t[8]=m*f+d,t[1]=f,t[5]=o*h,t[9]=-a*h,t[2]=-c*h,t[6]=d*f+m,t[10]=p-x*f}else if(e.order==="XZY"){const p=o*l,d=o*c,m=a*l,x=a*c;t[0]=l*h,t[4]=-f,t[8]=c*h,t[1]=p*f+x,t[5]=o*h,t[9]=d*f-m,t[2]=m*f-d,t[6]=a*h,t[10]=x*f+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Kb,e,Zb)}lookAt(e,t,r){const i=this.elements;return mr.subVectors(e,t),mr.lengthSq()===0&&(mr.z=1),mr.normalize(),gs.crossVectors(r,mr),gs.lengthSq()===0&&(Math.abs(r.z)===1?mr.x+=1e-4:mr.z+=1e-4,mr.normalize(),gs.crossVectors(r,mr)),gs.normalize(),iu.crossVectors(mr,gs),i[0]=gs.x,i[4]=iu.x,i[8]=mr.x,i[1]=gs.y,i[5]=iu.y,i[9]=mr.y,i[2]=gs.z,i[6]=iu.z,i[10]=mr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],h=r[1],f=r[5],p=r[9],d=r[13],m=r[2],x=r[6],v=r[10],_=r[14],b=r[3],M=r[7],E=r[11],S=r[15],T=i[0],q=i[4],O=i[8],A=i[12],L=i[1],N=i[5],Z=i[9],K=i[13],ne=i[2],ce=i[6],J=i[10],oe=i[14],B=i[3],xe=i[7],U=i[11],$=i[15];return s[0]=o*T+a*L+l*ne+c*B,s[4]=o*q+a*N+l*ce+c*xe,s[8]=o*O+a*Z+l*J+c*U,s[12]=o*A+a*K+l*oe+c*$,s[1]=h*T+f*L+p*ne+d*B,s[5]=h*q+f*N+p*ce+d*xe,s[9]=h*O+f*Z+p*J+d*U,s[13]=h*A+f*K+p*oe+d*$,s[2]=m*T+x*L+v*ne+_*B,s[6]=m*q+x*N+v*ce+_*xe,s[10]=m*O+x*Z+v*J+_*U,s[14]=m*A+x*K+v*oe+_*$,s[3]=b*T+M*L+E*ne+S*B,s[7]=b*q+M*N+E*ce+S*xe,s[11]=b*O+M*Z+E*J+S*U,s[15]=b*A+M*K+E*oe+S*$,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],h=e[2],f=e[6],p=e[10],d=e[14],m=e[3],x=e[7],v=e[11],_=e[15];return m*(+s*l*f-i*c*f-s*a*p+r*c*p+i*a*d-r*l*d)+x*(+t*l*d-t*c*p+s*o*p-i*o*d+i*c*h-s*l*h)+v*(+t*c*f-t*a*d-s*o*f+r*o*d+s*a*h-r*c*h)+_*(-i*a*h-t*l*f+t*a*p+i*o*f-r*o*p+r*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],f=e[9],p=e[10],d=e[11],m=e[12],x=e[13],v=e[14],_=e[15],b=f*v*c-x*p*c+x*l*d-a*v*d-f*l*_+a*p*_,M=m*p*c-h*v*c-m*l*d+o*v*d+h*l*_-o*p*_,E=h*x*c-m*f*c+m*a*d-o*x*d-h*a*_+o*f*_,S=m*f*l-h*x*l-m*a*p+o*x*p+h*a*v-o*f*v,T=t*b+r*M+i*E+s*S;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const q=1/T;return e[0]=b*q,e[1]=(x*p*s-f*v*s-x*i*d+r*v*d+f*i*_-r*p*_)*q,e[2]=(a*v*s-x*l*s+x*i*c-r*v*c-a*i*_+r*l*_)*q,e[3]=(f*l*s-a*p*s-f*i*c+r*p*c+a*i*d-r*l*d)*q,e[4]=M*q,e[5]=(h*v*s-m*p*s+m*i*d-t*v*d-h*i*_+t*p*_)*q,e[6]=(m*l*s-o*v*s-m*i*c+t*v*c+o*i*_-t*l*_)*q,e[7]=(o*p*s-h*l*s+h*i*c-t*p*c-o*i*d+t*l*d)*q,e[8]=E*q,e[9]=(m*f*s-h*x*s-m*r*d+t*x*d+h*r*_-t*f*_)*q,e[10]=(o*x*s-m*a*s+m*r*c-t*x*c-o*r*_+t*a*_)*q,e[11]=(h*a*s-o*f*s-h*r*c+t*f*c+o*r*d-t*a*d)*q,e[12]=S*q,e[13]=(h*x*i-m*f*i+m*r*p-t*x*p-h*r*v+t*f*v)*q,e[14]=(m*a*i-o*x*i-m*r*l+t*x*l+o*r*v-t*a*v)*q,e[15]=(o*f*i-h*a*i+h*r*l-t*f*l-o*r*p+t*a*p)*q,this}scale(e){const t=this.elements,r=e.x,i=e.y,s=e.z;return t[0]*=r,t[4]*=i,t[8]*=s,t[1]*=r,t[5]*=i,t[9]*=s,t[2]*=r,t[6]*=i,t[10]*=s,t[3]*=r,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))}makeTranslation(e,t,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),i=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,h=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,h*a+r,h*l-i*o,0,c*l-i*a,h*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,h=o+o,f=a+a,p=s*c,d=s*h,m=s*f,x=o*h,v=o*f,_=a*f,b=l*c,M=l*h,E=l*f,S=r.x,T=r.y,q=r.z;return i[0]=(1-(x+_))*S,i[1]=(d+E)*S,i[2]=(m-M)*S,i[3]=0,i[4]=(d-E)*T,i[5]=(1-(p+_))*T,i[6]=(v+b)*T,i[7]=0,i[8]=(m+M)*q,i[9]=(v-b)*q,i[10]=(1-(p+x))*q,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){const i=this.elements;let s=Yo.set(i[0],i[1],i[2]).length();const o=Yo.set(i[4],i[5],i[6]).length(),a=Yo.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Kr.copy(this);const c=1/s,h=1/o,f=1/a;return Kr.elements[0]*=c,Kr.elements[1]*=c,Kr.elements[2]*=c,Kr.elements[4]*=h,Kr.elements[5]*=h,Kr.elements[6]*=h,Kr.elements[8]*=f,Kr.elements[9]*=f,Kr.elements[10]*=f,t.setFromRotationMatrix(Kr),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o,a=bi,l=!1){const c=this.elements,h=2*s/(t-e),f=2*s/(r-i),p=(t+e)/(t-e),d=(r+i)/(r-i);let m,x;if(l)m=s/(o-s),x=o*s/(o-s);else if(a===bi)m=-(o+s)/(o-s),x=-2*o*s/(o-s);else if(a===$c)m=-o/(o-s),x=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=h,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=f,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,r,i,s,o,a=bi,l=!1){const c=this.elements,h=2/(t-e),f=2/(r-i),p=-(t+e)/(t-e),d=-(r+i)/(r-i);let m,x;if(l)m=1/(o-s),x=o/(o-s);else if(a===bi)m=-2/(o-s),x=-(o+s)/(o-s);else if(a===$c)m=-1/(o-s),x=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=h,c[4]=0,c[8]=0,c[12]=p,c[1]=0,c[5]=f,c[9]=0,c[13]=d,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const Yo=new G,Kr=new Ht,Kb=new G(0,0,0),Zb=new G(1,1,1),gs=new G,iu=new G,mr=new G,u_=new Ht,h_=new fs;class Zr{constructor(e=0,t=0,r=0,i=Zr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,i=this._order){return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],h=i[9],f=i[2],p=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(_t(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-_t(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(_t(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-_t(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(_t(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-_t(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return u_.makeRotationFromQuaternion(e),this.setFromRotationMatrix(u_,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return h_.setFromEuler(this),this.setFromQuaternion(h_,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Zr.DEFAULT_ORDER="XYZ";class lp{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Jb=0;const f_=new G,Ko=new fs,Vi=new Ht,su=new G,pl=new G,Qb=new G,eM=new fs,d_=new G(1,0,0),p_=new G(0,1,0),m_=new G(0,0,1),g_={type:"added"},tM={type:"removed"},Zo={type:"childadded",child:null},cp={type:"childremoved",child:null};class Ot extends Gs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Jb++}),this.uuid=Vo(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ot.DEFAULT_UP.clone();const e=new G,t=new Zr,r=new fs,i=new G(1,1,1);function s(){r.setFromEuler(t,!1)}function o(){t.setFromQuaternion(r,void 0,!1)}t._onChange(s),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ht},normalMatrix:{value:new pt}}),this.matrix=new Ht,this.matrixWorld=new Ht,this.matrixAutoUpdate=Ot.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new lp,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Ko.setFromAxisAngle(e,t),this.quaternion.multiply(Ko),this}rotateOnWorldAxis(e,t){return Ko.setFromAxisAngle(e,t),this.quaternion.premultiply(Ko),this}rotateX(e){return this.rotateOnAxis(d_,e)}rotateY(e){return this.rotateOnAxis(p_,e)}rotateZ(e){return this.rotateOnAxis(m_,e)}translateOnAxis(e,t){return f_.copy(e).applyQuaternion(this.quaternion),this.position.add(f_.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(d_,e)}translateY(e){return this.translateOnAxis(p_,e)}translateZ(e){return this.translateOnAxis(m_,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Vi.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?su.copy(e):su.set(e,t,r);const i=this.parent;this.updateWorldMatrix(!0,!1),pl.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Vi.lookAt(pl,su,this.up):Vi.lookAt(su,pl,this.up),this.quaternion.setFromRotationMatrix(Vi),i&&(Vi.extractRotation(i.matrixWorld),Ko.setFromRotationMatrix(Vi),this.quaternion.premultiply(Ko.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(g_),Zo.child=e,this.dispatchEvent(Zo),Zo.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(tM),cp.child=e,this.dispatchEvent(cp),cp.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Vi.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Vi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Vi),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(g_),Zo.child=e,this.dispatchEvent(Zo),Zo.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let r=0,i=this.children.length;r<i;r++){const o=this.children[r].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,r=[]){this[e]===t&&r.push(this);const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].getObjectsByProperty(e,t,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(pl,e,Qb),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(pl,eM,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let r=0,i=t.length;r<i;r++)t[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let r=0,i=t.length;r<i;r++)t[r].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let r=0,i=t.length;r<i;r++)t[r].updateMatrixWorld(e)}updateWorldMatrix(e,t){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(a=>({...a})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),h=o(e.images),f=o(e.shapes),p=o(e.skeletons),d=o(e.animations),m=o(e.nodes);a.length>0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),h.length>0&&(r.images=h),f.length>0&&(r.shapes=f),p.length>0&&(r.skeletons=p),d.length>0&&(r.animations=d),m.length>0&&(r.nodes=m)}return r.object=i,r;function o(a){const l=[];for(const c in a){const h=a[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r<e.children.length;r++){const i=e.children[r];this.add(i.clone())}return this}}Ot.DEFAULT_UP=new G(0,1,0),Ot.DEFAULT_MATRIX_AUTO_UPDATE=!0,Ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Jr=new G,Hi=new G,up=new G,Gi=new G,Jo=new G,Qo=new G,__=new G,hp=new G,fp=new G,dp=new G,pp=new on,mp=new on,gp=new on;class Qr{constructor(e=new G,t=new G,r=new G){this.a=e,this.b=t,this.c=r}static getNormal(e,t,r,i){i.subVectors(r,t),Jr.subVectors(e,t),i.cross(Jr);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,r,i,s){Jr.subVectors(i,t),Hi.subVectors(r,t),up.subVectors(e,t);const o=Jr.dot(Jr),a=Jr.dot(Hi),l=Jr.dot(up),c=Hi.dot(Hi),h=Hi.dot(up),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const p=1/f,d=(c*l-a*h)*p,m=(o*h-a*l)*p;return s.set(1-d-m,m,d)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,Gi)===null?!1:Gi.x>=0&&Gi.y>=0&&Gi.x+Gi.y<=1}static getInterpolation(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,Gi)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Gi.x),l.addScaledVector(o,Gi.y),l.addScaledVector(a,Gi.z),l)}static getInterpolatedAttribute(e,t,r,i,s,o){return pp.setScalar(0),mp.setScalar(0),gp.setScalar(0),pp.fromBufferAttribute(e,t),mp.fromBufferAttribute(e,r),gp.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(pp,s.x),o.addScaledVector(mp,s.y),o.addScaledVector(gp,s.z),o}static isFrontFacing(e,t,r,i){return Jr.subVectors(r,t),Hi.subVectors(e,t),Jr.cross(Hi).dot(i)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Jr.subVectors(this.c,this.b),Hi.subVectors(this.a,this.b),Jr.cross(Hi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Qr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Qr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,r,i,s){return Qr.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return Qr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Qr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,i=this.b,s=this.c;let o,a;Jo.subVectors(i,r),Qo.subVectors(s,r),hp.subVectors(e,r);const l=Jo.dot(hp),c=Qo.dot(hp);if(l<=0&&c<=0)return t.copy(r);fp.subVectors(e,i);const h=Jo.dot(fp),f=Qo.dot(fp);if(h>=0&&f<=h)return t.copy(i);const p=l*f-h*c;if(p<=0&&l>=0&&h<=0)return o=l/(l-h),t.copy(r).addScaledVector(Jo,o);dp.subVectors(e,s);const d=Jo.dot(dp),m=Qo.dot(dp);if(m>=0&&d<=m)return t.copy(s);const x=d*c-l*m;if(x<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(r).addScaledVector(Qo,a);const v=h*m-d*f;if(v<=0&&f-h>=0&&d-m>=0)return __.subVectors(s,i),a=(f-h)/(f-h+(d-m)),t.copy(i).addScaledVector(__,a);const _=1/(v+x+p);return o=x*_,a=p*_,t.copy(r).addScaledVector(Jo,o).addScaledVector(Qo,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const v_={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},_s={h:0,s:0,l:0},ou={h:0,s:0,l:0};function _p(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class St{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=pr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ct.colorSpaceToWorking(this,t),this}setRGB(e,t,r,i=Ct.workingColorSpace){return this.r=e,this.g=t,this.b=r,Ct.colorSpaceToWorking(this,i),this}setHSL(e,t,r,i=Ct.workingColorSpace){if(e=zb(e,1),t=_t(t,0,1),r=_t(r,0,1),t===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=_p(o,s,e+1/3),this.g=_p(o,s,e),this.b=_p(o,s,e-1/3)}return Ct.colorSpaceToWorking(this,i),this}setStyle(e,t=pr){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=pr){const r=v_[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=zi(e.r),this.g=zi(e.g),this.b=zi(e.b),this}copyLinearToSRGB(e){return this.r=Go(e.r),this.g=Go(e.g),this.b=Go(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=pr){return Ct.workingToColorSpace(Nn.copy(this),e),Math.round(_t(Nn.r*255,0,255))*65536+Math.round(_t(Nn.g*255,0,255))*256+Math.round(_t(Nn.b*255,0,255))}getHexString(e=pr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ct.workingColorSpace){Ct.workingToColorSpace(Nn.copy(this),t);const r=Nn.r,i=Nn.g,s=Nn.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const h=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=h<=.5?f/(o+a):f/(2-o-a),o){case r:l=(i-s)/f+(i<s?6:0);break;case i:l=(s-r)/f+2;break;case s:l=(r-i)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=Ct.workingColorSpace){return Ct.workingToColorSpace(Nn.copy(this),t),e.r=Nn.r,e.g=Nn.g,e.b=Nn.b,e}getStyle(e=pr){Ct.workingToColorSpace(Nn.copy(this),e);const t=Nn.r,r=Nn.g,i=Nn.b;return e!==pr?`color(${e} ${t.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,t,r){return this.getHSL(_s),this.setHSL(_s.h+e,_s.s+t,_s.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(_s),e.getHSL(ou);const r=Zd(_s.h,ou.h,t),i=Zd(_s.s,ou.s,t),s=Zd(_s.l,ou.l,t);return this.setHSL(r,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,r=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*r+s[6]*i,this.g=s[1]*t+s[4]*r+s[7]*i,this.b=s[2]*t+s[5]*r+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Nn=new St;St.NAMES=v_;let nM=0;class $s extends Gs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:nM++}),this.uuid=Vo(),this.name="",this.type="Material",this.blending=No,this.side=ls,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=id,this.blendDst=sd,this.blendEquation=ks,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new St(0,0,0),this.blendAlpha=0,this.depthFunc=Uo,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=e_,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Bo,this.stencilZFail=Bo,this.stencilZPass=Bo,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const r=e[t];if(r===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==No&&(r.blending=this.blending),this.side!==ls&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==id&&(r.blendSrc=this.blendSrc),this.blendDst!==sd&&(r.blendDst=this.blendDst),this.blendEquation!==ks&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Uo&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==e_&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Bo&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Bo&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Bo&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let r=null;if(t!==null){const i=t.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Ys extends $s{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new St(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Zr,this.combine=dd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const pn=new G,au=new Fe;let rM=0;class Pr{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:rM++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=n_,this.updateRanges=[],this.gpuType=Fi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,r=this.count;t<r;t++)au.fromBufferAttribute(this,t),au.applyMatrix3(e),this.setXY(t,au.x,au.y);else if(this.itemSize===3)for(let t=0,r=this.count;t<r;t++)pn.fromBufferAttribute(this,t),pn.applyMatrix3(e),this.setXYZ(t,pn.x,pn.y,pn.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)pn.fromBufferAttribute(this,t),pn.applyMatrix4(e),this.setXYZ(t,pn.x,pn.y,pn.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)pn.fromBufferAttribute(this,t),pn.applyNormalMatrix(e),this.setXYZ(t,pn.x,pn.y,pn.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)pn.fromBufferAttribute(this,t),pn.transformDirection(e),this.setXYZ(t,pn.x,pn.y,pn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let r=this.array[e*this.itemSize+t];return this.normalized&&(r=ul(r,this.array)),r}setComponent(e,t,r){return this.normalized&&(r=er(r,this.array)),this.array[e*this.itemSize+t]=r,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ul(t,this.array)),t}setX(e,t){return this.normalized&&(t=er(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ul(t,this.array)),t}setY(e,t){return this.normalized&&(t=er(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=ul(t,this.array)),t}setZ(e,t){return this.normalized&&(t=er(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=ul(t,this.array)),t}setW(e,t){return this.normalized&&(t=er(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=er(t,this.array),r=er(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,i){return e*=this.itemSize,this.normalized&&(t=er(t,this.array),r=er(r,this.array),i=er(i,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,t,r,i,s){return e*=this.itemSize,this.normalized&&(t=er(t,this.array),r=er(r,this.array),i=er(i,this.array),s=er(s,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==n_&&(e.usage=this.usage),e}}class x_ extends Pr{constructor(e,t,r){super(new Uint16Array(e),t,r)}}class y_ extends Pr{constructor(e,t,r){super(new Uint32Array(e),t,r)}}class Gn extends Pr{constructor(e,t,r){super(new Float32Array(e),t,r)}}let iM=0;const Ir=new Ht,vp=new Ot,ea=new G,gr=new Mi,ml=new Mi,wn=new G;class tr extends Gs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:iM++}),this.uuid=Vo(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(s_(e)?y_:x_)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,r=0){this.groups.push({start:e,count:t,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const s=new pt().getNormalMatrix(e);r.applyNormalMatrix(s),r.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ir.makeRotationFromQuaternion(e),this.applyMatrix4(Ir),this}rotateX(e){return Ir.makeRotationX(e),this.applyMatrix4(Ir),this}rotateY(e){return Ir.makeRotationY(e),this.applyMatrix4(Ir),this}rotateZ(e){return Ir.makeRotationZ(e),this.applyMatrix4(Ir),this}translate(e,t,r){return Ir.makeTranslation(e,t,r),this.applyMatrix4(Ir),this}scale(e,t,r){return Ir.makeScale(e,t,r),this.applyMatrix4(Ir),this}lookAt(e){return vp.lookAt(e),vp.updateMatrix(),this.applyMatrix4(vp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ea).negate(),this.translate(ea.x,ea.y,ea.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const r=[];for(let i=0,s=e.length;i<s;i++){const o=e[i];r.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Gn(r,3))}else{const r=Math.min(e.length,t.count);for(let i=0;i<r;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Mi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new G(-1/0,-1/0,-1/0),new G(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let r=0,i=t.length;r<i;r++){const s=t[r];gr.setFromBufferAttribute(s),this.morphTargetsRelative?(wn.addVectors(this.boundingBox.min,gr.min),this.boundingBox.expandByPoint(wn),wn.addVectors(this.boundingBox.max,gr.max),this.boundingBox.expandByPoint(wn)):(this.boundingBox.expandByPoint(gr.min),this.boundingBox.expandByPoint(gr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new eu);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new G,1/0);return}if(e){const r=this.boundingSphere.center;if(gr.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];ml.setFromBufferAttribute(a),this.morphTargetsRelative?(wn.addVectors(gr.min,ml.min),gr.expandByPoint(wn),wn.addVectors(gr.max,ml.max),gr.expandByPoint(wn)):(gr.expandByPoint(ml.min),gr.expandByPoint(ml.max))}gr.getCenter(r);let i=0;for(let s=0,o=e.count;s<o;s++)wn.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(wn));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,h=a.count;c<h;c++)wn.fromBufferAttribute(a,c),l&&(ea.fromBufferAttribute(e,c),wn.add(ea)),i=Math.max(i,r.distanceToSquared(wn))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Pr(new Float32Array(4*r.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let O=0;O<r.count;O++)a[O]=new G,l[O]=new G;const c=new G,h=new G,f=new G,p=new Fe,d=new Fe,m=new Fe,x=new G,v=new G;function _(O,A,L){c.fromBufferAttribute(r,O),h.fromBufferAttribute(r,A),f.fromBufferAttribute(r,L),p.fromBufferAttribute(s,O),d.fromBufferAttribute(s,A),m.fromBufferAttribute(s,L),h.sub(c),f.sub(c),d.sub(p),m.sub(p);const N=1/(d.x*m.y-m.x*d.y);isFinite(N)&&(x.copy(h).multiplyScalar(m.y).addScaledVector(f,-d.y).multiplyScalar(N),v.copy(f).multiplyScalar(d.x).addScaledVector(h,-m.x).multiplyScalar(N),a[O].add(x),a[A].add(x),a[L].add(x),l[O].add(v),l[A].add(v),l[L].add(v))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let O=0,A=b.length;O<A;++O){const L=b[O],N=L.start,Z=L.count;for(let K=N,ne=N+Z;K<ne;K+=3)_(e.getX(K+0),e.getX(K+1),e.getX(K+2))}const M=new G,E=new G,S=new G,T=new G;function q(O){S.fromBufferAttribute(i,O),T.copy(S);const A=a[O];M.copy(A),M.sub(S.multiplyScalar(S.dot(A))).normalize(),E.crossVectors(T,A);const N=E.dot(l[O])<0?-1:1;o.setXYZW(O,M.x,M.y,M.z,N)}for(let O=0,A=b.length;O<A;++O){const L=b[O],N=L.start,Z=L.count;for(let K=N,ne=N+Z;K<ne;K+=3)q(e.getX(K+0)),q(e.getX(K+1)),q(e.getX(K+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new Pr(new Float32Array(t.count*3),3),this.setAttribute("normal",r);else for(let p=0,d=r.count;p<d;p++)r.setXYZ(p,0,0,0);const i=new G,s=new G,o=new G,a=new G,l=new G,c=new G,h=new G,f=new G;if(e)for(let p=0,d=e.count;p<d;p+=3){const m=e.getX(p+0),x=e.getX(p+1),v=e.getX(p+2);i.fromBufferAttribute(t,m),s.fromBufferAttribute(t,x),o.fromBufferAttribute(t,v),h.subVectors(o,s),f.subVectors(i,s),h.cross(f),a.fromBufferAttribute(r,m),l.fromBufferAttribute(r,x),c.fromBufferAttribute(r,v),a.add(h),l.add(h),c.add(h),r.setXYZ(m,a.x,a.y,a.z),r.setXYZ(x,l.x,l.y,l.z),r.setXYZ(v,c.x,c.y,c.z)}else for(let p=0,d=t.count;p<d;p+=3)i.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),o.fromBufferAttribute(t,p+2),h.subVectors(o,s),f.subVectors(i,s),h.cross(f),r.setXYZ(p+0,h.x,h.y,h.z),r.setXYZ(p+1,h.x,h.y,h.z),r.setXYZ(p+2,h.x,h.y,h.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,r=e.count;t<r;t++)wn.fromBufferAttribute(e,t),wn.normalize(),e.setXYZ(t,wn.x,wn.y,wn.z)}toNonIndexed(){function e(a,l){const c=a.array,h=a.itemSize,f=a.normalized,p=new c.constructor(l.length*h);let d=0,m=0;for(let x=0,v=l.length;x<v;x++){a.isInterleavedBufferAttribute?d=l[x]*a.data.stride+a.offset:d=l[x]*h;for(let _=0;_<h;_++)p[m++]=c[d++]}return new Pr(p,h,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new tr,r=this.index.array,i=this.attributes;for(const a in i){const l=i[a],c=e(l,r);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let h=0,f=c.length;h<f;h++){const p=c[h],d=e(p,r);l.push(d)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let f=0,p=c.length;f<p;f++){const d=c[f];h.push(d.toJSON(e.data))}h.length>0&&(i[l]=h,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone());const i=e.attributes;for(const c in i){const h=i[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],f=s[c];for(let p=0,d=f.length;p<d;p++)h.push(f[p].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,h=o.length;c<h;c++){const f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const S_=new Ht,Ks=new ru,lu=new eu,E_=new G,cu=new G,uu=new G,hu=new G,xp=new G,fu=new G,b_=new G,du=new G;class Tn extends Ot{constructor(e=new tr,t=new Ys){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,o=r.morphTargetsRelative;t.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(s&&a){fu.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=a[l],f=s[l];h!==0&&(xp.fromBufferAttribute(f,e),o?fu.addScaledVector(xp,h):fu.addScaledVector(xp.sub(t),h))}t.add(fu)}return t}raycast(e,t){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),lu.copy(r.boundingSphere),lu.applyMatrix4(s),Ks.copy(e.ray).recast(e.near),!(lu.containsPoint(Ks.origin)===!1&&(Ks.intersectSphere(lu,E_)===null||Ks.origin.distanceToSquared(E_)>(e.far-e.near)**2))&&(S_.copy(s).invert(),Ks.copy(e.ray).applyMatrix4(S_),!(r.boundingBox!==null&&Ks.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,Ks)))}_computeIntersections(e,t,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,f=s.attributes.normal,p=s.groups,d=s.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,x=p.length;m<x;m++){const v=p[m],_=o[v.materialIndex],b=Math.max(v.start,d.start),M=Math.min(a.count,Math.min(v.start+v.count,d.start+d.count));for(let E=b,S=M;E<S;E+=3){const T=a.getX(E),q=a.getX(E+1),O=a.getX(E+2);i=pu(this,_,e,r,c,h,f,T,q,O),i&&(i.faceIndex=Math.floor(E/3),i.face.materialIndex=v.materialIndex,t.push(i))}}else{const m=Math.max(0,d.start),x=Math.min(a.count,d.start+d.count);for(let v=m,_=x;v<_;v+=3){const b=a.getX(v),M=a.getX(v+1),E=a.getX(v+2);i=pu(this,o,e,r,c,h,f,b,M,E),i&&(i.faceIndex=Math.floor(v/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(o))for(let m=0,x=p.length;m<x;m++){const v=p[m],_=o[v.materialIndex],b=Math.max(v.start,d.start),M=Math.min(l.count,Math.min(v.start+v.count,d.start+d.count));for(let E=b,S=M;E<S;E+=3){const T=E,q=E+1,O=E+2;i=pu(this,_,e,r,c,h,f,T,q,O),i&&(i.faceIndex=Math.floor(E/3),i.face.materialIndex=v.materialIndex,t.push(i))}}else{const m=Math.max(0,d.start),x=Math.min(l.count,d.start+d.count);for(let v=m,_=x;v<_;v+=3){const b=v,M=v+1,E=v+2;i=pu(this,o,e,r,c,h,f,b,M,E),i&&(i.faceIndex=Math.floor(v/3),t.push(i))}}}}function sM(n,e,t,r,i,s,o,a){let l;if(e.side===Qn?l=r.intersectTriangle(o,s,i,!0,a):l=r.intersectTriangle(i,s,o,e.side===ls,a),l===null)return null;du.copy(a),du.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(du);return c<t.near||c>t.far?null:{distance:c,point:du.clone(),object:n}}function pu(n,e,t,r,i,s,o,a,l,c){n.getVertexPosition(a,cu),n.getVertexPosition(l,uu),n.getVertexPosition(c,hu);const h=sM(n,e,t,r,cu,uu,hu,b_);if(h){const f=new G;Qr.getBarycoord(b_,cu,uu,hu,f),i&&(h.uv=Qr.getInterpolatedAttribute(i,a,l,c,f,new Fe)),s&&(h.uv1=Qr.getInterpolatedAttribute(s,a,l,c,f,new Fe)),o&&(h.normal=Qr.getInterpolatedAttribute(o,a,l,c,f,new G),h.normal.dot(r.direction)>0&&h.normal.multiplyScalar(-1));const p={a,b:l,c,normal:new G,materialIndex:0};Qr.getNormal(cu,uu,hu,p.normal),h.face=p,h.barycoord=f}return h}class Zs extends tr{constructor(e=1,t=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],h=[],f=[];let p=0,d=0;m("z","y","x",-1,-1,r,t,e,o,s,0),m("z","y","x",1,-1,r,t,-e,o,s,1),m("x","z","y",1,1,e,r,t,i,o,2),m("x","z","y",1,-1,e,r,-t,i,o,3),m("x","y","z",1,-1,e,t,r,i,s,4),m("x","y","z",-1,-1,e,t,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new Gn(c,3)),this.setAttribute("normal",new Gn(h,3)),this.setAttribute("uv",new Gn(f,2));function m(x,v,_,b,M,E,S,T,q,O,A){const L=E/q,N=S/O,Z=E/2,K=S/2,ne=T/2,ce=q+1,J=O+1;let oe=0,B=0;const xe=new G;for(let U=0;U<J;U++){const $=U*N-K;for(let pe=0;pe<ce;pe++){const Se=pe*L-Z;xe[x]=Se*b,xe[v]=$*M,xe[_]=ne,c.push(xe.x,xe.y,xe.z),xe[x]=0,xe[v]=0,xe[_]=T>0?1:-1,h.push(xe.x,xe.y,xe.z),f.push(pe/q),f.push(1-U/O),oe+=1}}for(let U=0;U<O;U++)for(let $=0;$<q;$++){const pe=p+$+ce*U,Se=p+$+ce*(U+1),be=p+($+1)+ce*(U+1),V=p+($+1)+ce*U;l.push(pe,Se,V),l.push(Se,be,V),B+=6}a.addGroup(d,B,A),d+=B,p+=oe}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ta(n){const e={};for(const t in n){e[t]={};for(const r in n[t]){const i=n[t][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][r]=null):e[t][r]=i.clone():Array.isArray(i)?e[t][r]=i.slice():e[t][r]=i}}return e}function Wn(n){const e={};for(let t=0;t<n.length;t++){const r=ta(n[t]);for(const i in r)e[i]=r[i]}return e}function oM(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function M_(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ct.workingColorSpace}const aM={clone:ta,merge:Wn};var lM=`void main() {
83
75
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
84
76
  }`,cM=`void main() {
85
77
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
86
- }`;class Ts extends ro{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=lM,this.fragmentShader=cM,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ha(e.uniforms),this.uniformsGroups=oM(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class w_ extends kt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Kt,this.projectionMatrix=new Kt,this.projectionMatrixInverse=new Kt,this.coordinateSystem=Ii,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const As=new j,T_=new Be,A_=new Be;class wr extends w_{constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=tu*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(eu*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return tu*2*Math.atan(Math.tan(eu*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,r){As.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(As.x,As.y).multiplyScalar(-e/As.z),As.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(As.x,As.y).multiplyScalar(-e/As.z)}getViewSize(e,t){return this.getViewBounds(e,T_,A_),t.subVectors(A_,T_)}setViewOffset(e,t,r,i,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(eu*.5*this.fov)/this.zoom,r=2*t,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-r,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const fa=-90,da=1;class uM extends kt{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new wr(fa,da,e,t);i.layers=this.layers,this.add(i);const s=new wr(fa,da,e,t);s.layers=this.layers,this.add(s);const o=new wr(fa,da,e,t);o.layers=this.layers,this.add(o);const a=new wr(fa,da,e,t);a.layers=this.layers,this.add(a);const l=new wr(fa,da,e,t);l.layers=this.layers,this.add(l);const c=new wr(fa,da,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[r,i,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Ii)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Qc)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,h]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;const x=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(t,s),e.setRenderTarget(r,1,i),e.render(t,o),e.setRenderTarget(r,2,i),e.render(t,a),e.setRenderTarget(r,3,i),e.render(t,l),e.setRenderTarget(r,4,i),e.render(t,c),r.texture.generateMipmaps=x,e.setRenderTarget(r,5,i),e.render(t,h),e.setRenderTarget(f,p,d),e.xr.enabled=m,r.texture.needsPMREMUpdate=!0}}class C_ extends Gn{constructor(e=[],t=$o,r,i,s,o,a,l,c,h){super(e,t,r,i,s,o,a,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class hM extends eo{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new C_(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:`
78
+ }`;class vs extends $s{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=lM,this.fragmentShader=cM,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ta(e.uniforms),this.uniformsGroups=oM(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class w_ extends Ot{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ht,this.projectionMatrix=new Ht,this.projectionMatrixInverse=new Ht,this.coordinateSystem=bi,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const xs=new G,T_=new Fe,A_=new Fe;class _r extends w_{constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Kc*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Yc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Kc*2*Math.atan(Math.tan(Yc*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,r){xs.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(xs.x,xs.y).multiplyScalar(-e/xs.z),xs.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(xs.x,xs.y).multiplyScalar(-e/xs.z)}getViewSize(e,t){return this.getViewBounds(e,T_,A_),t.subVectors(A_,T_)}setViewOffset(e,t,r,i,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Yc*.5*this.fov)/this.zoom,r=2*t,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-r,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const na=-90,ra=1;class uM extends Ot{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new _r(na,ra,e,t);i.layers=this.layers,this.add(i);const s=new _r(na,ra,e,t);s.layers=this.layers,this.add(s);const o=new _r(na,ra,e,t);o.layers=this.layers,this.add(o);const a=new _r(na,ra,e,t);a.layers=this.layers,this.add(a);const l=new _r(na,ra,e,t);l.layers=this.layers,this.add(l);const c=new _r(na,ra,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[r,i,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===bi)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===$c)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,h]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;const x=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(t,s),e.setRenderTarget(r,1,i),e.render(t,o),e.setRenderTarget(r,2,i),e.render(t,a),e.setRenderTarget(r,3,i),e.render(t,l),e.setRenderTarget(r,4,i),e.render(t,c),r.texture.generateMipmaps=x,e.setRenderTarget(r,5,i),e.render(t,h),e.setRenderTarget(f,p,d),e.xr.enabled=m,r.texture.needsPMREMUpdate=!0}}class C_ extends Dn{constructor(e=[],t=Fo,r,i,s,o,a,l,c,h){super(e,t,r,i,s,o,a,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class hM extends Ws{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new C_(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:`
87
79
 
88
80
  varying vec3 vWorldDirection;
89
81
 
@@ -118,7 +110,7 @@ best distance: ${f.d}`);const v=[f.x,f.y];return v.distance=f.d,v}function Gc(n,
118
110
  gl_FragColor = texture2D( tEquirect, sampleUV );
119
111
 
120
112
  }
121
- `},i=new oo(5,5,5),s=new Ts({name:"CubemapFromEquirect",uniforms:ha(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:lr,blending:_s});s.uniforms.tEquirect.value=t;const o=new Dn(i,s),a=t.minFilter;return t.minFilter===Zs&&(t.minFilter=Ri),new uM(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,r=!0,i=!0){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,r,i);e.setRenderTarget(s)}}class Ml extends kt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const fM={type:"move"};class yp{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ml,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Ml,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new j,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new j),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ml,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new j,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new j),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const x of e.hand.values()){const v=t.getJointPose(x,r),_=this._getHandJoint(c,x);v!==null&&(_.matrix.fromArray(v.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=v.radius),_.visible=v!==null}const h=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=h.position.distanceTo(f.position),d=.02,m=.005;c.inputState.pinching&&p>d+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=d-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(fM)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new Ml;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class dM extends kt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new oi,this.environmentIntensity=1,this.environmentRotation=new oi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const yu=new j,R_=new j;class Su extends kt{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let r=0,i=t.length;r<i;r++){const s=t[r];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,r=0){t=Math.abs(t);const i=this.levels;let s;for(s=0;s<i.length&&!(t<i[s].distance);s++);return i.splice(s,0,{distance:t,hysteresis:r,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let r=0;r<t.length;r++)if(t[r].distance===e){const i=t.splice(r,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let r,i;for(r=1,i=t.length;r<i;r++){let s=t[r].distance;if(t[r].object.visible&&(s-=s*t[r].hysteresis),e<s)break}return t[r-1].object}return null}raycast(e,t){if(this.levels.length>0){yu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(yu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){yu.setFromMatrixPosition(e.matrixWorld),R_.setFromMatrixPosition(this.matrixWorld);const r=yu.distanceTo(R_)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),r>=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const r=this.levels;for(let i=0,s=r.length;i<s;i++){const o=r[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const Sp=new j,pM=new j,mM=new yt;class Cs{constructor(e=new j(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){const i=Sp.subVectors(r,t).cross(pM.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const r=e.delta(Sp),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const r=t||mM.getNormalMatrix(e),i=this.coplanarPoint(Sp).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const ao=new su,gM=new Be(.5,.5),Eu=new j;class Ep{constructor(e=new Cs,t=new Cs,r=new Cs,i=new Cs,s=new Cs,o=new Cs){this.planes=[e,t,r,i,s,o]}set(e,t,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=Ii,r=!1){const i=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],h=s[4],f=s[5],p=s[6],d=s[7],m=s[8],x=s[9],v=s[10],_=s[11],E=s[12],M=s[13],b=s[14],S=s[15];if(i[0].setComponents(c-o,d-h,_-m,S-E).normalize(),i[1].setComponents(c+o,d+h,_+m,S+E).normalize(),i[2].setComponents(c+a,d+f,_+x,S+M).normalize(),i[3].setComponents(c-a,d-f,_-x,S-M).normalize(),r)i[4].setComponents(l,p,v,b).normalize(),i[5].setComponents(c-l,d-p,_-v,S-b).normalize();else if(i[4].setComponents(c-l,d-p,_-v,S-b).normalize(),t===Ii)i[5].setComponents(c+l,d+p,_+v,S+b).normalize();else if(t===Qc)i[5].setComponents(l,p,v,b).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),ao.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ao.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ao)}intersectsSprite(e){ao.center.set(0,0,0);const t=gM.distanceTo(e.center);return ao.radius=.7071067811865476+t,ao.applyMatrix4(e.matrixWorld),this.intersectsSphere(ao)}intersectsSphere(e){const t=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let r=0;r<6;r++){const i=t[r];if(Eu.x=i.normal.x>0?e.max.x:e.min.x,Eu.y=i.normal.y>0?e.max.y:e.min.y,Eu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Eu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class bu extends ro{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ct(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Mu=new j,wu=new j,P_=new Kt,wl=new lu,Tu=new su,bp=new j,I_=new j;class _M extends kt{constructor(e=new ur,t=new bu){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[0];for(let i=1,s=t.count;i<s;i++)Mu.fromBufferAttribute(t,i-1),wu.fromBufferAttribute(t,i),r[i]=r[i-1],r[i]+=Mu.distanceTo(wu);e.setAttribute("lineDistance",new er(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const r=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Tu.copy(r.boundingSphere),Tu.applyMatrix4(i),Tu.radius+=s,e.ray.intersectsSphere(Tu)===!1)return;P_.copy(i).invert(),wl.copy(e.ray).applyMatrix4(P_);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,h=r.index,p=r.attributes.position;if(h!==null){const d=Math.max(0,o.start),m=Math.min(h.count,o.start+o.count);for(let x=d,v=m-1;x<v;x+=c){const _=h.getX(x),E=h.getX(x+1),M=Au(this,e,wl,l,_,E,x);M&&t.push(M)}if(this.isLineLoop){const x=h.getX(m-1),v=h.getX(d),_=Au(this,e,wl,l,x,v,m-1);_&&t.push(_)}}else{const d=Math.max(0,o.start),m=Math.min(p.count,o.start+o.count);for(let x=d,v=m-1;x<v;x+=c){const _=Au(this,e,wl,l,x,x+1,x);_&&t.push(_)}if(this.isLineLoop){const x=Au(this,e,wl,l,m-1,d,m-1);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Au(n,e,t,r,i,s,o){const a=n.geometry.attributes.position;if(Mu.fromBufferAttribute(a,i),wu.fromBufferAttribute(a,s),t.distanceSqToSegment(Mu,wu,bp,I_)>r)return;bp.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(bp);if(!(c<e.near||c>e.far))return{distance:c,point:I_.clone().applyMatrix4(n.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:n}}const L_=new j,O_=new j;class Tl extends _M{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[];for(let i=0,s=t.count;i<s;i+=2)L_.fromBufferAttribute(t,i),O_.fromBufferAttribute(t,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+L_.distanceTo(O_);e.setAttribute("lineDistance",new er(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class q_ extends Gn{constructor(e,t,r=Js,i,s,o,a=ni,l=ni,c,h=gl,f=1){if(h!==gl&&h!==_l)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const p={width:e,height:t,depth:f};super(p,i,s,o,a,l,h,r,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ep(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Oi{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let r,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),t.push(s),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const r=this.getLengths();let i=0;const s=r.length;let o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const h=r[i],p=r[i+1]-h,d=(o-h)/p;return(i+d)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new Be:new j);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t=!1){const r=new j,i=[],s=[],o=[],a=new j,l=new Kt;for(let d=0;d<=e;d++){const m=d/e;i[d]=this.getTangentAt(m,new j)}s[0]=new j,o[0]=new j;let c=Number.MAX_VALUE;const h=Math.abs(i[0].x),f=Math.abs(i[0].y),p=Math.abs(i[0].z);h<=c&&(c=h,r.set(1,0,0)),f<=c&&(c=f,r.set(0,1,0)),p<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(bt(i[d-1].dot(i[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,m))}o[d].crossVectors(i[d],s[d])}if(t===!0){let d=Math.acos(bt(s[0].dot(s[e]),-1,1));d/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(i[m],d*m)),o[m].crossVectors(i[m],s[m])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Mp extends Oi{constructor(e=0,t=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Be){const r=t,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const h=Math.cos(this.aRotation),f=Math.sin(this.aRotation),p=l-this.aX,d=c-this.aY;l=p*h-d*f+this.aX,c=p*f+d*h+this.aY}return r.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class vM extends Mp{constructor(e,t,r,i,s,o){super(e,t,r,r,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function wp(){let n=0,e=0,t=0,r=0;function i(s,o,a,l){n=s,e=a,t=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,h,f){let p=(o-s)/c-(a-s)/(c+h)+(a-o)/h,d=(a-o)/h-(l-o)/(h+f)+(l-a)/f;p*=h,d*=h,i(o,a,p,d)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+r*a}}}const Cu=new j,Tp=new wp,Ap=new wp,Cp=new wp;class xM extends Oi{constructor(e=[],t=!1,r="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=i}getPoint(e,t=new j){const r=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,h;this.closed||a>0?c=i[(a-1)%s]:(Cu.subVectors(i[0],i[1]).add(i[0]),c=Cu);const f=i[a%s],p=i[(a+1)%s];if(this.closed||a+2<s?h=i[(a+2)%s]:(Cu.subVectors(i[s-1],i[s-2]).add(i[s-1]),h=Cu),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(f),d),x=Math.pow(f.distanceToSquared(p),d),v=Math.pow(p.distanceToSquared(h),d);x<1e-4&&(x=1),m<1e-4&&(m=x),v<1e-4&&(v=x),Tp.initNonuniformCatmullRom(c.x,f.x,p.x,h.x,m,x,v),Ap.initNonuniformCatmullRom(c.y,f.y,p.y,h.y,m,x,v),Cp.initNonuniformCatmullRom(c.z,f.z,p.z,h.z,m,x,v)}else this.curveType==="catmullrom"&&(Tp.initCatmullRom(c.x,f.x,p.x,h.x,this.tension),Ap.initCatmullRom(c.y,f.y,p.y,h.y,this.tension),Cp.initCatmullRom(c.z,f.z,p.z,h.z,this.tension));return r.set(Tp.calc(l),Ap.calc(l),Cp.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const i=e.points[t];this.points.push(new j().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function D_(n,e,t,r,i){const s=(r-e)*.5,o=(i-t)*.5,a=n*n,l=n*a;return(2*t-2*r+s+o)*l+(-3*t+3*r-2*s-o)*a+s*n+t}function yM(n,e){const t=1-n;return t*t*e}function SM(n,e){return 2*(1-n)*n*e}function EM(n,e){return n*n*e}function Al(n,e,t,r){return yM(n,e)+SM(n,t)+EM(n,r)}function bM(n,e){const t=1-n;return t*t*t*e}function MM(n,e){const t=1-n;return 3*t*t*n*e}function wM(n,e){return 3*(1-n)*n*n*e}function TM(n,e){return n*n*n*e}function Cl(n,e,t,r,i){return bM(n,e)+MM(n,t)+wM(n,r)+TM(n,i)}class N_ extends Oi{constructor(e=new Be,t=new Be,r=new Be,i=new Be){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=i}getPoint(e,t=new Be){const r=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Cl(e,i.x,s.x,o.x,a.x),Cl(e,i.y,s.y,o.y,a.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class AM extends Oi{constructor(e=new j,t=new j,r=new j,i=new j){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=i}getPoint(e,t=new j){const r=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Cl(e,i.x,s.x,o.x,a.x),Cl(e,i.y,s.y,o.y,a.y),Cl(e,i.z,s.z,o.z,a.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class U_ extends Oi{constructor(e=new Be,t=new Be){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Be){const r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Be){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class CM extends Oi{constructor(e=new j,t=new j){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new j){const r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new j){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class F_ extends Oi{constructor(e=new Be,t=new Be,r=new Be){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new Be){const r=t,i=this.v0,s=this.v1,o=this.v2;return r.set(Al(e,i.x,s.x,o.x),Al(e,i.y,s.y,o.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class RM extends Oi{constructor(e=new j,t=new j,r=new j){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new j){const r=t,i=this.v0,s=this.v1,o=this.v2;return r.set(Al(e,i.x,s.x,o.x),Al(e,i.y,s.y,o.y),Al(e,i.z,s.z,o.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class z_ extends Oi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Be){const r=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=i[o],h=i[o>i.length-2?i.length-1:o+1],f=i[o>i.length-3?i.length-1:o+2];return r.set(D_(a,l.x,c.x,h.x,f.x),D_(a,l.y,c.y,h.y,f.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const i=e.points[t];this.points.push(new Be().fromArray(i))}return this}}var k_=Object.freeze({__proto__:null,ArcCurve:vM,CatmullRomCurve3:xM,CubicBezierCurve:N_,CubicBezierCurve3:AM,EllipseCurve:Mp,LineCurve:U_,LineCurve3:CM,QuadraticBezierCurve:F_,QuadraticBezierCurve3:RM,SplineCurve:z_});class PM extends Oi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const r=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new k_[r](t,e))}return this}getPoint(e,t){const r=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=r){const o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let r=0,i=this.curves.length;r<i;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let r;for(let i=0,s=this.curves;i<s.length;i++){const o=s[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const h=l[c];r&&r.equals(h)||(t.push(h),r=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){const i=e.curves[t];this.curves.push(new k_[i.type]().fromJSON(i))}return this}}class Rp extends PM{constructor(e){super(),this.type="Path",this.currentPoint=new Be,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const r=new U_(this.currentPoint.clone(),new Be(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,i){const s=new F_(this.currentPoint.clone(),new Be(e,t),new Be(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(e,t,r,i,s,o){const a=new N_(this.currentPoint.clone(),new Be(e,t),new Be(r,i),new Be(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),r=new z_(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,i,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,r,i,s,o),this}absarc(e,t,r,i,s,o){return this.absellipse(e,t,r,r,i,s,o),this}ellipse(e,t,r,i,s,o,a,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+c,t+h,r,i,s,o,a,l),this}absellipse(e,t,r,i,s,o,a,l){const c=new Mp(e,t,r,i,s,o,a,l);if(this.curves.length>0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class pa extends Rp{constructor(e){super(e),this.uuid=Jo(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let r=0,i=this.holes.length;r<i;r++)t[r]=this.holes[r].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){const i=e.holes[t];this.holes.push(new Rp().fromJSON(i))}return this}}function IM(n,e,t=2){const r=e&&e.length,i=r?e[0]*t:n.length;let s=B_(n,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(r&&(s=NM(n,e,s,t)),n.length>80*t){a=1/0,l=1/0;let h=-1/0,f=-1/0;for(let p=t;p<i;p+=t){const d=n[p],m=n[p+1];d<a&&(a=d),m<l&&(l=m),d>h&&(h=d),m>f&&(f=m)}c=Math.max(h-a,f-l),c=c!==0?32767/c:0}return Rl(s,o,t,a,l,c,0),o}function B_(n,e,t,r,i){let s;if(i===XM(n,e,t,r)>0)for(let o=e;o<t;o+=r)s=W_(o/r|0,n[o],n[o+1],s);else for(let o=t-r;o>=e;o-=r)s=W_(o/r|0,n[o],n[o+1],s);return s&&ma(s,s.next)&&(Ll(s),s=s.next),s}function lo(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(ma(t,t.next)||dn(t.prev,t,t.next)===0)){if(Ll(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function Rl(n,e,t,r,i,s,o){if(!n)return;!o&&s&&BM(n,r,i,s);let a=n;for(;n.prev!==n.next;){const l=n.prev,c=n.next;if(s?OM(n,r,i,s):LM(n)){e.push(l.i,n.i,c.i),Ll(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=qM(lo(n),e),Rl(n,e,t,r,i,s,2)):o===2&&DM(n,e,t,r,i,s):Rl(lo(n),e,t,r,i,s,1);break}}}function LM(n){const e=n.prev,t=n,r=n.next;if(dn(e,t,r)>=0)return!1;const i=e.x,s=t.x,o=r.x,a=e.y,l=t.y,c=r.y,h=Math.min(i,s,o),f=Math.min(a,l,c),p=Math.max(i,s,o),d=Math.max(a,l,c);let m=r.next;for(;m!==e;){if(m.x>=h&&m.x<=p&&m.y>=f&&m.y<=d&&Pl(i,a,s,l,o,c,m.x,m.y)&&dn(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function OM(n,e,t,r){const i=n.prev,s=n,o=n.next;if(dn(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,h=i.y,f=s.y,p=o.y,d=Math.min(a,l,c),m=Math.min(h,f,p),x=Math.max(a,l,c),v=Math.max(h,f,p),_=Pp(d,m,e,t,r),E=Pp(x,v,e,t,r);let M=n.prevZ,b=n.nextZ;for(;M&&M.z>=_&&b&&b.z<=E;){if(M.x>=d&&M.x<=x&&M.y>=m&&M.y<=v&&M!==i&&M!==o&&Pl(a,h,l,f,c,p,M.x,M.y)&&dn(M.prev,M,M.next)>=0||(M=M.prevZ,b.x>=d&&b.x<=x&&b.y>=m&&b.y<=v&&b!==i&&b!==o&&Pl(a,h,l,f,c,p,b.x,b.y)&&dn(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;M&&M.z>=_;){if(M.x>=d&&M.x<=x&&M.y>=m&&M.y<=v&&M!==i&&M!==o&&Pl(a,h,l,f,c,p,M.x,M.y)&&dn(M.prev,M,M.next)>=0)return!1;M=M.prevZ}for(;b&&b.z<=E;){if(b.x>=d&&b.x<=x&&b.y>=m&&b.y<=v&&b!==i&&b!==o&&Pl(a,h,l,f,c,p,b.x,b.y)&&dn(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function qM(n,e){let t=n;do{const r=t.prev,i=t.next.next;!ma(r,i)&&H_(r,t,t.next,i)&&Il(r,i)&&Il(i,r)&&(e.push(r.i,t.i,i.i),Ll(t),Ll(t.next),t=n=i),t=t.next}while(t!==n);return lo(t)}function DM(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&GM(o,a)){let l=G_(o,a);o=lo(o,o.next),l=lo(l,l.next),Rl(o,e,t,r,i,s,0),Rl(l,e,t,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function NM(n,e,t,r){const i=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*r,l=s<o-1?e[s+1]*r:n.length,c=B_(n,a,l,r,!1);c===c.next&&(c.steiner=!0),i.push(HM(c))}i.sort(UM);for(let s=0;s<i.length;s++)t=FM(i[s],t);return t}function UM(n,e){let t=n.x-e.x;if(t===0&&(t=n.y-e.y,t===0)){const r=(n.next.y-n.y)/(n.next.x-n.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=r-i}return t}function FM(n,e){const t=zM(n,e);if(!t)return e;const r=G_(t,n);return lo(r,r.next),lo(t,t.next)}function zM(n,e){let t=e;const r=n.x,i=n.y;let s=-1/0,o;if(ma(n,t))return t;do{if(ma(n,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const f=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=r&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===r))return o}t=t.next}while(t!==e);if(!o)return null;const a=o,l=o.x,c=o.y;let h=1/0;t=o;do{if(r>=t.x&&t.x>=l&&r!==t.x&&V_(i<c?r:s,i,l,c,i<c?s:r,i,t.x,t.y)){const f=Math.abs(i-t.y)/(r-t.x);Il(t,n)&&(f<h||f===h&&(t.x>o.x||t.x===o.x&&kM(o,t)))&&(o=t,h=f)}t=t.next}while(t!==a);return o}function kM(n,e){return dn(n.prev,n,e.prev)<0&&dn(e.next,n,n.next)<0}function BM(n,e,t,r){let i=n;do i.z===0&&(i.z=Pp(i.x,i.y,e,t,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,VM(i)}function VM(n){let e,t=1;do{let r=n,i;n=null;let s=null;for(e=0;r;){e++;let o=r,a=0;for(let c=0;c<t&&(a++,o=o.nextZ,!!o);c++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,a--):(i=o,o=o.nextZ,l--),s?s.nextZ=i:n=i,i.prevZ=s,s=i;r=o}s.nextZ=null,t*=2}while(e>1);return n}function Pp(n,e,t,r,i){return n=(n-t)*i|0,e=(e-r)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function HM(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function V_(n,e,t,r,i,s,o,a){return(i-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(r-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(r-a)}function Pl(n,e,t,r,i,s,o,a){return!(n===o&&e===a)&&V_(n,e,t,r,i,s,o,a)}function GM(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!WM(n,e)&&(Il(n,e)&&Il(e,n)&&jM(n,e)&&(dn(n.prev,n,e.prev)||dn(n,e.prev,e))||ma(n,e)&&dn(n.prev,n,n.next)>0&&dn(e.prev,e,e.next)>0)}function dn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function ma(n,e){return n.x===e.x&&n.y===e.y}function H_(n,e,t,r){const i=Pu(dn(n,e,t)),s=Pu(dn(n,e,r)),o=Pu(dn(t,r,n)),a=Pu(dn(t,r,e));return!!(i!==s&&o!==a||i===0&&Ru(n,t,e)||s===0&&Ru(n,r,e)||o===0&&Ru(t,n,r)||a===0&&Ru(t,e,r))}function Ru(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Pu(n){return n>0?1:n<0?-1:0}function WM(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&H_(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Il(n,e){return dn(n.prev,n,n.next)<0?dn(n,e,n.next)>=0&&dn(n,n.prev,e)>=0:dn(n,e,n.prev)<0||dn(n,n.next,e)<0}function jM(n,e){let t=n,r=!1;const i=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==n);return r}function G_(n,e){const t=Ip(n.i,n.x,n.y),r=Ip(e.i,e.x,e.y),i=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=i,i.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function W_(n,e,t,r){const i=Ip(n,e,t);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Ll(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Ip(n,e,t){return{i:n,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function XM(n,e,t,r){let i=0;for(let s=e,o=t-r;s<t;s+=r)i+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return i}class $M{static triangulate(e,t,r=2){return IM(e,t,r)}}class ga{static area(e){const t=e.length;let r=0;for(let i=t-1,s=0;s<t;i=s++)r+=e[i].x*e[s].y-e[s].x*e[i].y;return r*.5}static isClockWise(e){return ga.area(e)<0}static triangulateShape(e,t){const r=[],i=[],s=[];j_(e),X_(r,e);let o=e.length;t.forEach(j_);for(let l=0;l<t.length;l++)i.push(o),o+=t[l].length,X_(r,t[l]);const a=$M.triangulate(r,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function j_(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function X_(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class Iu extends ur{constructor(e=1,t=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i};const s=e/2,o=t/2,a=Math.floor(r),l=Math.floor(i),c=a+1,h=l+1,f=e/a,p=t/l,d=[],m=[],x=[],v=[];for(let _=0;_<h;_++){const E=_*p-o;for(let M=0;M<c;M++){const b=M*f-s;m.push(b,-E,0),x.push(0,0,1),v.push(M/a),v.push(1-_/l)}}for(let _=0;_<l;_++)for(let E=0;E<a;E++){const M=E+c*_,b=E+c*(_+1),S=E+1+c*(_+1),T=E+1+c*_;d.push(M,b,T),d.push(b,S,T)}this.setIndex(d),this.setAttribute("position",new er(m,3)),this.setAttribute("normal",new er(x,3)),this.setAttribute("uv",new er(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Iu(e.width,e.height,e.widthSegments,e.heightSegments)}}class Lp extends ur{constructor(e=new pa([new Be(0,.5),new Be(-.5,-.5),new Be(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const r=[],i=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let h=0;h<e.length;h++)c(e[h]),this.addGroup(a,l,h),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new er(i,3)),this.setAttribute("normal",new er(s,3)),this.setAttribute("uv",new er(o,2));function c(h){const f=i.length/3,p=h.extractPoints(t);let d=p.shape;const m=p.holes;ga.isClockWise(d)===!1&&(d=d.reverse());for(let v=0,_=m.length;v<_;v++){const E=m[v];ga.isClockWise(E)===!0&&(m[v]=E.reverse())}const x=ga.triangulateShape(d,m);for(let v=0,_=m.length;v<_;v++){const E=m[v];d=d.concat(E)}for(let v=0,_=d.length;v<_;v++){const E=d[v];i.push(E.x,E.y,0),s.push(0,0,1),o.push(E.x,E.y)}for(let v=0,_=x.length;v<_;v++){const E=x[v],M=E[0]+f,b=E[1]+f,S=E[2]+f;r.push(M,b,S),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return YM(t,e)}static fromJSON(e,t){const r=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=t[e.shapes[i]];r.push(o)}return new Lp(r,e.curveSegments)}}function YM(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,r=n.length;t<r;t++){const i=n[t];e.shapes.push(i.uuid)}else e.shapes.push(n.uuid);return e}class KM extends ro{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ct(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ct(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kd,this.normalScale=new Be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new oi,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ZM extends ro{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ct(16777215),this.specular=new Ct(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ct(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kd,this.normalScale=new Be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new oi,this.combine=dd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class JM extends ro{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Rb,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class QM extends ro{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Ol={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class e4{constructor(e,t,r){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.abortController=new AbortController,this.itemStart=function(h){a++,s===!1&&i.onStart!==void 0&&i.onStart(h,o,a),s=!0},this.itemEnd=function(h){o++,i.onProgress!==void 0&&i.onProgress(h,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,f){return c.push(h,f),this},this.removeHandler=function(h){const f=c.indexOf(h);return f!==-1&&c.splice(f,2),this},this.getHandler=function(h){for(let f=0,p=c.length;f<p;f+=2){const d=c[f],m=c[f+1];if(d.global&&(d.lastIndex=0),d.test(h))return m}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}}const t4=new e4;class ql{constructor(e){this.manager=e!==void 0?e:t4,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const r=this;return new Promise(function(i,s){r.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}ql.DEFAULT_MATERIAL_NAME="__DEFAULT";const Qi={};class n4 extends Error{constructor(e,t){super(e),this.response=t}}class r4 extends ql{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Ol.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Qi[e]!==void 0){Qi[e].push({onLoad:t,onProgress:r,onError:i});return}Qi[e]=[],Qi[e].push({onLoad:t,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=Qi[e],f=c.body.getReader(),p=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),d=p?parseInt(p):0,m=d!==0;let x=0;const v=new ReadableStream({start(_){E();function E(){f.read().then(({done:M,value:b})=>{if(M)_.close();else{x+=b.byteLength;const S=new ProgressEvent("progress",{lengthComputable:m,loaded:x,total:d});for(let T=0,q=h.length;T<q;T++){const O=h[T];O.onProgress&&O.onProgress(S)}_.enqueue(b),E()}},M=>{_.error(M)})}}});return new Response(v)}else throw new n4(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,a));case"json":return c.json();default:if(a==="")return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),p=f&&f[1]?f[1].toLowerCase():void 0,d=new TextDecoder(p);return c.arrayBuffer().then(m=>d.decode(m))}}}).then(c=>{Ol.add(`file:${e}`,c);const h=Qi[e];delete Qi[e];for(let f=0,p=h.length;f<p;f++){const d=h[f];d.onLoad&&d.onLoad(c)}}).catch(c=>{const h=Qi[e];if(h===void 0)throw this.manager.itemError(e),c;delete Qi[e];for(let f=0,p=h.length;f<p;f++){const d=h[f];d.onError&&d.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const _a=new WeakMap;class i4 extends ql{constructor(e){super(e)}load(e,t,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Ol.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let f=_a.get(o);f===void 0&&(f=[],_a.set(o,f)),f.push({onLoad:t,onError:i})}return o}const a=xl("img");function l(){h(),t&&t(this);const f=_a.get(this)||[];for(let p=0;p<f.length;p++){const d=f[p];d.onLoad&&d.onLoad(this)}_a.delete(this),s.manager.itemEnd(e)}function c(f){h(),i&&i(f),Ol.remove(`image:${e}`);const p=_a.get(this)||[];for(let d=0;d<p.length;d++){const m=p[d];m.onError&&m.onError(f)}_a.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),Ol.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}}class $_ extends ql{constructor(e){super(e)}load(e,t,r,i){const s=new Gn,o=new i4(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},r,i),s}}class Op extends kt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ct(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const qp=new Kt,Y_=new j,K_=new j;class Z_{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Be(512,512),this.mapType=Pi,this.map=null,this.mapPass=null,this.matrix=new Kt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ep,this._frameExtents=new Be(1,1),this._viewportCount=1,this._viewports=[new pn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;Y_.setFromMatrixPosition(e.matrixWorld),t.position.copy(Y_),K_.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(K_),t.updateMatrixWorld(),qp.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(qp,t.coordinateSystem,t.reversedDepth),t.reversedDepth?r.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(qp)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class s4 extends Z_{constructor(){super(new wr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,r=tu*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(r!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class o4 extends Op{constructor(e,t,r=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(kt.DEFAULT_UP),this.updateMatrix(),this.target=new kt,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new s4}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class J_ extends w_{constructor(e=-1,t=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=h*this.view.offsetY,l=a-h*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class a4 extends Z_{constructor(){super(new J_(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class l4 extends Op{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(kt.DEFAULT_UP),this.updateMatrix(),this.target=new kt,this.shadow=new a4}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Q_ extends Op{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class c4 extends wr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const ev=new Kt;class u4{constructor(e,t,r=0,i=1/0){this.ray=new lu(e,t),this.near=r,this.far=i,this.camera=null,this.layers=new lp,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return ev.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(ev),this}intersectObject(e,t=!0,r=[]){return Dp(e,this,r,t),r.sort(tv),r}intersectObjects(e,t=!0,r=[]){for(let i=0,s=e.length;i<s;i++)Dp(e[i],this,r,t);return r.sort(tv),r}}function tv(n,e){return n.distance-e.distance}function Dp(n,e,t,r){let i=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(i=!1),i===!0&&r===!0){const s=n.children;for(let o=0,a=s.length;o<a;o++)Dp(s[o],e,t,!0)}}class nv{constructor(e=1,t=0,r=0){this.radius=e,this.phi=t,this.theta=r}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=bt(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(bt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const Lu=new Li;class h4 extends Tl{constructor(e,t=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),s=new ur;s.setIndex(new kr(r,1)),s.setAttribute("position",new kr(i,3)),super(s,new bu({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Lu.setFromObject(this.object),Lu.isEmpty())return;const e=Lu.min,t=Lu.max,r=this.geometry.attributes.position,i=r.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class f4{constructor(){this.type="ShapePath",this.color=new Ct,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Rp,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,i){return this.currentPath.quadraticCurveTo(e,t,r,i),this}bezierCurveTo(e,t,r,i,s,o){return this.currentPath.bezierCurveTo(e,t,r,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(_){const E=[];for(let M=0,b=_.length;M<b;M++){const S=_[M],T=new pa;T.curves=S.curves,E.push(T)}return E}function r(_,E){const M=E.length;let b=!1;for(let S=M-1,T=0;T<M;S=T++){let q=E[S],O=E[T],A=O.x-q.x,L=O.y-q.y;if(Math.abs(L)>Number.EPSILON){if(L<0&&(q=E[T],A=-A,O=E[S],L=-L),_.y<q.y||_.y>O.y)continue;if(_.y===q.y){if(_.x===q.x)return!0}else{const N=L*(_.x-q.x)-A*(_.y-q.y);if(N===0)return!0;if(N<0)continue;b=!b}}else{if(_.y!==q.y)continue;if(O.x<=_.x&&_.x<=q.x||q.x<=_.x&&_.x<=O.x)return!0}}return b}const i=ga.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new pa,l.curves=a.curves,c.push(l),c;let h=!i(s[0].getPoints());h=e?!h:h;const f=[],p=[];let d=[],m=0,x;p[m]=void 0,d[m]=[];for(let _=0,E=s.length;_<E;_++)a=s[_],x=a.getPoints(),o=i(x),o=e?!o:o,o?(!h&&p[m]&&m++,p[m]={s:new pa,p:x},p[m].s.curves=a.curves,h&&m++,d[m]=[]):d[m].push({h:a,p:x[0]});if(!p[0])return t(s);if(p.length>1){let _=!1,E=0;for(let M=0,b=p.length;M<b;M++)f[M]=[];for(let M=0,b=p.length;M<b;M++){const S=d[M];for(let T=0;T<S.length;T++){const q=S[T];let O=!0;for(let A=0;A<p.length;A++)r(q.p,p[A].p)&&(M!==A&&E++,O?(O=!1,f[A].push(q)):_=!0);O&&f[M].push(q)}}E>0&&_===!1&&(d=f)}let v;for(let _=0,E=p.length;_<E;_++){l=p[_].s,c.push(l),v=d[_];for(let M=0,b=v.length;M<b;M++)l.holes.push(v[M].h)}return c}}class d4 extends Qs{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function rv(n,e,t,r){const i=p4(r);switch(t){case Y1:return n*e;case Z1:return n*e/i.components*i.byteLength;case Sd:return n*e/i.components*i.byteLength;case J1:return n*e*2/i.components*i.byteLength;case Ed:return n*e*2/i.components*i.byteLength;case K1:return n*e*3/i.components*i.byteLength;case ri:return n*e*4/i.components*i.byteLength;case bd:return n*e*4/i.components*i.byteLength;case Xc:case $c:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Yc:case Kc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case wd:case Ad:return Math.max(n,16)*Math.max(e,8)/4;case Md:case Td:return Math.max(n,8)*Math.max(e,8)/2;case Cd:case Rd:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Pd:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Id:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Ld:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Od:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case qd:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Dd:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Nd:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Ud:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Fd:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case zd:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case kd:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Bd:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Vd:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case Hd:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Gd:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Zc:case Wd:case jd:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Q1:case Xd:return Math.ceil(n/4)*Math.ceil(e/4)*8;case $d:case Yd:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function p4(n){switch(n){case Pi:case j1:return{byteLength:1,components:1};case dl:case X1:case pl:return{byteLength:2,components:1};case xd:case yd:return{byteLength:2,components:4};case Js:case vd:case ji:return{byteLength:4,components:1};case $1:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:rd}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=rd);/**
113
+ `},i=new Zs(5,5,5),s=new vs({name:"CubemapFromEquirect",uniforms:ta(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Qn,blending:cs});s.uniforms.tEquirect.value=t;const o=new Tn(i,s),a=t.minFilter;return t.minFilter===Vs&&(t.minFilter=Si),new uM(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,r=!0,i=!0){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,r,i);e.setRenderTarget(s)}}class gl extends Ot{constructor(){super(),this.isGroup=!0,this.type="Group"}}const fM={type:"move"};class yp{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new gl,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new gl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new G,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new G),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new gl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new G,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new G),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const x of e.hand.values()){const v=t.getJointPose(x,r),_=this._getHandJoint(c,x);v!==null&&(_.matrix.fromArray(v.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=v.radius),_.visible=v!==null}const h=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=h.position.distanceTo(f.position),d=.02,m=.005;c.inputState.pinching&&p>d+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=d-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(fM)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new gl;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class dM extends Ot{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Zr,this.environmentIntensity=1,this.environmentRotation=new Zr,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const mu=new G,R_=new G;class gu extends Ot{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let r=0,i=t.length;r<i;r++){const s=t[r];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,r=0){t=Math.abs(t);const i=this.levels;let s;for(s=0;s<i.length&&!(t<i[s].distance);s++);return i.splice(s,0,{distance:t,hysteresis:r,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let r=0;r<t.length;r++)if(t[r].distance===e){const i=t.splice(r,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let r,i;for(r=1,i=t.length;r<i;r++){let s=t[r].distance;if(t[r].object.visible&&(s-=s*t[r].hysteresis),e<s)break}return t[r-1].object}return null}raycast(e,t){if(this.levels.length>0){mu.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(mu);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){mu.setFromMatrixPosition(e.matrixWorld),R_.setFromMatrixPosition(this.matrixWorld);const r=mu.distanceTo(R_)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),r>=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const r=this.levels;for(let i=0,s=r.length;i<s;i++){const o=r[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const Sp=new G,pM=new G,mM=new pt;class ys{constructor(e=new G(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){const i=Sp.subVectors(r,t).cross(pM.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const r=e.delta(Sp),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const r=t||mM.getNormalMatrix(e),i=this.coplanarPoint(Sp).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Js=new eu,gM=new Fe(.5,.5),_u=new G;class Ep{constructor(e=new ys,t=new ys,r=new ys,i=new ys,s=new ys,o=new ys){this.planes=[e,t,r,i,s,o]}set(e,t,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=bi,r=!1){const i=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],h=s[4],f=s[5],p=s[6],d=s[7],m=s[8],x=s[9],v=s[10],_=s[11],b=s[12],M=s[13],E=s[14],S=s[15];if(i[0].setComponents(c-o,d-h,_-m,S-b).normalize(),i[1].setComponents(c+o,d+h,_+m,S+b).normalize(),i[2].setComponents(c+a,d+f,_+x,S+M).normalize(),i[3].setComponents(c-a,d-f,_-x,S-M).normalize(),r)i[4].setComponents(l,p,v,E).normalize(),i[5].setComponents(c-l,d-p,_-v,S-E).normalize();else if(i[4].setComponents(c-l,d-p,_-v,S-E).normalize(),t===bi)i[5].setComponents(c+l,d+p,_+v,S+E).normalize();else if(t===$c)i[5].setComponents(l,p,v,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Js.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Js.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Js)}intersectsSprite(e){Js.center.set(0,0,0);const t=gM.distanceTo(e.center);return Js.radius=.7071067811865476+t,Js.applyMatrix4(e.matrixWorld),this.intersectsSphere(Js)}intersectsSphere(e){const t=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let r=0;r<6;r++){const i=t[r];if(_u.x=i.normal.x>0?e.max.x:e.min.x,_u.y=i.normal.y>0?e.max.y:e.min.y,_u.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(_u)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class vu extends $s{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new St(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const xu=new G,yu=new G,P_=new Ht,_l=new ru,Su=new eu,bp=new G,I_=new G;class _M extends Ot{constructor(e=new tr,t=new vu){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[0];for(let i=1,s=t.count;i<s;i++)xu.fromBufferAttribute(t,i-1),yu.fromBufferAttribute(t,i),r[i]=r[i-1],r[i]+=xu.distanceTo(yu);e.setAttribute("lineDistance",new Gn(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const r=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Su.copy(r.boundingSphere),Su.applyMatrix4(i),Su.radius+=s,e.ray.intersectsSphere(Su)===!1)return;P_.copy(i).invert(),_l.copy(e.ray).applyMatrix4(P_);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,h=r.index,p=r.attributes.position;if(h!==null){const d=Math.max(0,o.start),m=Math.min(h.count,o.start+o.count);for(let x=d,v=m-1;x<v;x+=c){const _=h.getX(x),b=h.getX(x+1),M=Eu(this,e,_l,l,_,b,x);M&&t.push(M)}if(this.isLineLoop){const x=h.getX(m-1),v=h.getX(d),_=Eu(this,e,_l,l,x,v,m-1);_&&t.push(_)}}else{const d=Math.max(0,o.start),m=Math.min(p.count,o.start+o.count);for(let x=d,v=m-1;x<v;x+=c){const _=Eu(this,e,_l,l,x,x+1,x);_&&t.push(_)}if(this.isLineLoop){const x=Eu(this,e,_l,l,m-1,d,m-1);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Eu(n,e,t,r,i,s,o){const a=n.geometry.attributes.position;if(xu.fromBufferAttribute(a,i),yu.fromBufferAttribute(a,s),t.distanceSqToSegment(xu,yu,bp,I_)>r)return;bp.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(bp);if(!(c<e.near||c>e.far))return{distance:c,point:I_.clone().applyMatrix4(n.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:n}}const L_=new G,O_=new G;class vl extends _M{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[];for(let i=0,s=t.count;i<s;i+=2)L_.fromBufferAttribute(t,i),O_.fromBufferAttribute(t,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+L_.distanceTo(O_);e.setAttribute("lineDistance",new Gn(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class q_ extends Dn{constructor(e,t,r=Hs,i,s,o,a=Xr,l=Xr,c,h=ll,f=1){if(h!==ll&&h!==cl)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const p={width:e,height:t,depth:f};super(p,i,s,o,a,l,h,r,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ep(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class wi{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let r,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),t.push(s),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const r=this.getLengths();let i=0;const s=r.length;let o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const h=r[i],p=r[i+1]-h,d=(o-h)/p;return(i+d)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new Fe:new G);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t=!1){const r=new G,i=[],s=[],o=[],a=new G,l=new Ht;for(let d=0;d<=e;d++){const m=d/e;i[d]=this.getTangentAt(m,new G)}s[0]=new G,o[0]=new G;let c=Number.MAX_VALUE;const h=Math.abs(i[0].x),f=Math.abs(i[0].y),p=Math.abs(i[0].z);h<=c&&(c=h,r.set(1,0,0)),f<=c&&(c=f,r.set(0,1,0)),p<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(_t(i[d-1].dot(i[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,m))}o[d].crossVectors(i[d],s[d])}if(t===!0){let d=Math.acos(_t(s[0].dot(s[e]),-1,1));d/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(i[m],d*m)),o[m].crossVectors(i[m],s[m])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Mp extends wi{constructor(e=0,t=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Fe){const r=t,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const h=Math.cos(this.aRotation),f=Math.sin(this.aRotation),p=l-this.aX,d=c-this.aY;l=p*h-d*f+this.aX,c=p*f+d*h+this.aY}return r.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class vM extends Mp{constructor(e,t,r,i,s,o){super(e,t,r,r,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function wp(){let n=0,e=0,t=0,r=0;function i(s,o,a,l){n=s,e=a,t=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,h,f){let p=(o-s)/c-(a-s)/(c+h)+(a-o)/h,d=(a-o)/h-(l-o)/(h+f)+(l-a)/f;p*=h,d*=h,i(o,a,p,d)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+r*a}}}const bu=new G,Tp=new wp,Ap=new wp,Cp=new wp;class xM extends wi{constructor(e=[],t=!1,r="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=i}getPoint(e,t=new G){const r=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,h;this.closed||a>0?c=i[(a-1)%s]:(bu.subVectors(i[0],i[1]).add(i[0]),c=bu);const f=i[a%s],p=i[(a+1)%s];if(this.closed||a+2<s?h=i[(a+2)%s]:(bu.subVectors(i[s-1],i[s-2]).add(i[s-1]),h=bu),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(f),d),x=Math.pow(f.distanceToSquared(p),d),v=Math.pow(p.distanceToSquared(h),d);x<1e-4&&(x=1),m<1e-4&&(m=x),v<1e-4&&(v=x),Tp.initNonuniformCatmullRom(c.x,f.x,p.x,h.x,m,x,v),Ap.initNonuniformCatmullRom(c.y,f.y,p.y,h.y,m,x,v),Cp.initNonuniformCatmullRom(c.z,f.z,p.z,h.z,m,x,v)}else this.curveType==="catmullrom"&&(Tp.initCatmullRom(c.x,f.x,p.x,h.x,this.tension),Ap.initCatmullRom(c.y,f.y,p.y,h.y,this.tension),Cp.initCatmullRom(c.z,f.z,p.z,h.z,this.tension));return r.set(Tp.calc(l),Ap.calc(l),Cp.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const i=e.points[t];this.points.push(new G().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function D_(n,e,t,r,i){const s=(r-e)*.5,o=(i-t)*.5,a=n*n,l=n*a;return(2*t-2*r+s+o)*l+(-3*t+3*r-2*s-o)*a+s*n+t}function yM(n,e){const t=1-n;return t*t*e}function SM(n,e){return 2*(1-n)*n*e}function EM(n,e){return n*n*e}function xl(n,e,t,r){return yM(n,e)+SM(n,t)+EM(n,r)}function bM(n,e){const t=1-n;return t*t*t*e}function MM(n,e){const t=1-n;return 3*t*t*n*e}function wM(n,e){return 3*(1-n)*n*n*e}function TM(n,e){return n*n*n*e}function yl(n,e,t,r,i){return bM(n,e)+MM(n,t)+wM(n,r)+TM(n,i)}class N_ extends wi{constructor(e=new Fe,t=new Fe,r=new Fe,i=new Fe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=i}getPoint(e,t=new Fe){const r=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(yl(e,i.x,s.x,o.x,a.x),yl(e,i.y,s.y,o.y,a.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class AM extends wi{constructor(e=new G,t=new G,r=new G,i=new G){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=i}getPoint(e,t=new G){const r=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(yl(e,i.x,s.x,o.x,a.x),yl(e,i.y,s.y,o.y,a.y),yl(e,i.z,s.z,o.z,a.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class U_ extends wi{constructor(e=new Fe,t=new Fe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Fe){const r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Fe){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class CM extends wi{constructor(e=new G,t=new G){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new G){const r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new G){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class F_ extends wi{constructor(e=new Fe,t=new Fe,r=new Fe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new Fe){const r=t,i=this.v0,s=this.v1,o=this.v2;return r.set(xl(e,i.x,s.x,o.x),xl(e,i.y,s.y,o.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class RM extends wi{constructor(e=new G,t=new G,r=new G){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new G){const r=t,i=this.v0,s=this.v1,o=this.v2;return r.set(xl(e,i.x,s.x,o.x),xl(e,i.y,s.y,o.y),xl(e,i.z,s.z,o.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class z_ extends wi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Fe){const r=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=i[o],h=i[o>i.length-2?i.length-1:o+1],f=i[o>i.length-3?i.length-1:o+2];return r.set(D_(a,l.x,c.x,h.x,f.x),D_(a,l.y,c.y,h.y,f.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const i=e.points[t];this.points.push(new Fe().fromArray(i))}return this}}var k_=Object.freeze({__proto__:null,ArcCurve:vM,CatmullRomCurve3:xM,CubicBezierCurve:N_,CubicBezierCurve3:AM,EllipseCurve:Mp,LineCurve:U_,LineCurve3:CM,QuadraticBezierCurve:F_,QuadraticBezierCurve3:RM,SplineCurve:z_});class PM extends wi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const r=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new k_[r](t,e))}return this}getPoint(e,t){const r=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=r){const o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let r=0,i=this.curves.length;r<i;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let r;for(let i=0,s=this.curves;i<s.length;i++){const o=s[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const h=l[c];r&&r.equals(h)||(t.push(h),r=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){const i=e.curves[t];this.curves.push(new k_[i.type]().fromJSON(i))}return this}}class Rp extends PM{constructor(e){super(),this.type="Path",this.currentPoint=new Fe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const r=new U_(this.currentPoint.clone(),new Fe(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,i){const s=new F_(this.currentPoint.clone(),new Fe(e,t),new Fe(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(e,t,r,i,s,o){const a=new N_(this.currentPoint.clone(),new Fe(e,t),new Fe(r,i),new Fe(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),r=new z_(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,i,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,r,i,s,o),this}absarc(e,t,r,i,s,o){return this.absellipse(e,t,r,r,i,s,o),this}ellipse(e,t,r,i,s,o,a,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+c,t+h,r,i,s,o,a,l),this}absellipse(e,t,r,i,s,o,a,l){const c=new Mp(e,t,r,i,s,o,a,l);if(this.curves.length>0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ia extends Rp{constructor(e){super(e),this.uuid=Vo(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let r=0,i=this.holes.length;r<i;r++)t[r]=this.holes[r].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){const i=e.holes[t];this.holes.push(new Rp().fromJSON(i))}return this}}function IM(n,e,t=2){const r=e&&e.length,i=r?e[0]*t:n.length;let s=B_(n,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(r&&(s=NM(n,e,s,t)),n.length>80*t){a=1/0,l=1/0;let h=-1/0,f=-1/0;for(let p=t;p<i;p+=t){const d=n[p],m=n[p+1];d<a&&(a=d),m<l&&(l=m),d>h&&(h=d),m>f&&(f=m)}c=Math.max(h-a,f-l),c=c!==0?32767/c:0}return Sl(s,o,t,a,l,c,0),o}function B_(n,e,t,r,i){let s;if(i===XM(n,e,t,r)>0)for(let o=e;o<t;o+=r)s=W_(o/r|0,n[o],n[o+1],s);else for(let o=t-r;o>=e;o-=r)s=W_(o/r|0,n[o],n[o+1],s);return s&&sa(s,s.next)&&(Ml(s),s=s.next),s}function Qs(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(sa(t,t.next)||sn(t.prev,t,t.next)===0)){if(Ml(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function Sl(n,e,t,r,i,s,o){if(!n)return;!o&&s&&BM(n,r,i,s);let a=n;for(;n.prev!==n.next;){const l=n.prev,c=n.next;if(s?OM(n,r,i,s):LM(n)){e.push(l.i,n.i,c.i),Ml(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=qM(Qs(n),e),Sl(n,e,t,r,i,s,2)):o===2&&DM(n,e,t,r,i,s):Sl(Qs(n),e,t,r,i,s,1);break}}}function LM(n){const e=n.prev,t=n,r=n.next;if(sn(e,t,r)>=0)return!1;const i=e.x,s=t.x,o=r.x,a=e.y,l=t.y,c=r.y,h=Math.min(i,s,o),f=Math.min(a,l,c),p=Math.max(i,s,o),d=Math.max(a,l,c);let m=r.next;for(;m!==e;){if(m.x>=h&&m.x<=p&&m.y>=f&&m.y<=d&&El(i,a,s,l,o,c,m.x,m.y)&&sn(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function OM(n,e,t,r){const i=n.prev,s=n,o=n.next;if(sn(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,h=i.y,f=s.y,p=o.y,d=Math.min(a,l,c),m=Math.min(h,f,p),x=Math.max(a,l,c),v=Math.max(h,f,p),_=Pp(d,m,e,t,r),b=Pp(x,v,e,t,r);let M=n.prevZ,E=n.nextZ;for(;M&&M.z>=_&&E&&E.z<=b;){if(M.x>=d&&M.x<=x&&M.y>=m&&M.y<=v&&M!==i&&M!==o&&El(a,h,l,f,c,p,M.x,M.y)&&sn(M.prev,M,M.next)>=0||(M=M.prevZ,E.x>=d&&E.x<=x&&E.y>=m&&E.y<=v&&E!==i&&E!==o&&El(a,h,l,f,c,p,E.x,E.y)&&sn(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;M&&M.z>=_;){if(M.x>=d&&M.x<=x&&M.y>=m&&M.y<=v&&M!==i&&M!==o&&El(a,h,l,f,c,p,M.x,M.y)&&sn(M.prev,M,M.next)>=0)return!1;M=M.prevZ}for(;E&&E.z<=b;){if(E.x>=d&&E.x<=x&&E.y>=m&&E.y<=v&&E!==i&&E!==o&&El(a,h,l,f,c,p,E.x,E.y)&&sn(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function qM(n,e){let t=n;do{const r=t.prev,i=t.next.next;!sa(r,i)&&H_(r,t,t.next,i)&&bl(r,i)&&bl(i,r)&&(e.push(r.i,t.i,i.i),Ml(t),Ml(t.next),t=n=i),t=t.next}while(t!==n);return Qs(t)}function DM(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&GM(o,a)){let l=G_(o,a);o=Qs(o,o.next),l=Qs(l,l.next),Sl(o,e,t,r,i,s,0),Sl(l,e,t,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function NM(n,e,t,r){const i=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*r,l=s<o-1?e[s+1]*r:n.length,c=B_(n,a,l,r,!1);c===c.next&&(c.steiner=!0),i.push(HM(c))}i.sort(UM);for(let s=0;s<i.length;s++)t=FM(i[s],t);return t}function UM(n,e){let t=n.x-e.x;if(t===0&&(t=n.y-e.y,t===0)){const r=(n.next.y-n.y)/(n.next.x-n.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=r-i}return t}function FM(n,e){const t=zM(n,e);if(!t)return e;const r=G_(t,n);return Qs(r,r.next),Qs(t,t.next)}function zM(n,e){let t=e;const r=n.x,i=n.y;let s=-1/0,o;if(sa(n,t))return t;do{if(sa(n,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const f=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=r&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===r))return o}t=t.next}while(t!==e);if(!o)return null;const a=o,l=o.x,c=o.y;let h=1/0;t=o;do{if(r>=t.x&&t.x>=l&&r!==t.x&&V_(i<c?r:s,i,l,c,i<c?s:r,i,t.x,t.y)){const f=Math.abs(i-t.y)/(r-t.x);bl(t,n)&&(f<h||f===h&&(t.x>o.x||t.x===o.x&&kM(o,t)))&&(o=t,h=f)}t=t.next}while(t!==a);return o}function kM(n,e){return sn(n.prev,n,e.prev)<0&&sn(e.next,n,n.next)<0}function BM(n,e,t,r){let i=n;do i.z===0&&(i.z=Pp(i.x,i.y,e,t,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,VM(i)}function VM(n){let e,t=1;do{let r=n,i;n=null;let s=null;for(e=0;r;){e++;let o=r,a=0;for(let c=0;c<t&&(a++,o=o.nextZ,!!o);c++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,a--):(i=o,o=o.nextZ,l--),s?s.nextZ=i:n=i,i.prevZ=s,s=i;r=o}s.nextZ=null,t*=2}while(e>1);return n}function Pp(n,e,t,r,i){return n=(n-t)*i|0,e=(e-r)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function HM(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function V_(n,e,t,r,i,s,o,a){return(i-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(r-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(r-a)}function El(n,e,t,r,i,s,o,a){return!(n===o&&e===a)&&V_(n,e,t,r,i,s,o,a)}function GM(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!WM(n,e)&&(bl(n,e)&&bl(e,n)&&jM(n,e)&&(sn(n.prev,n,e.prev)||sn(n,e.prev,e))||sa(n,e)&&sn(n.prev,n,n.next)>0&&sn(e.prev,e,e.next)>0)}function sn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function sa(n,e){return n.x===e.x&&n.y===e.y}function H_(n,e,t,r){const i=wu(sn(n,e,t)),s=wu(sn(n,e,r)),o=wu(sn(t,r,n)),a=wu(sn(t,r,e));return!!(i!==s&&o!==a||i===0&&Mu(n,t,e)||s===0&&Mu(n,r,e)||o===0&&Mu(t,n,r)||a===0&&Mu(t,e,r))}function Mu(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function wu(n){return n>0?1:n<0?-1:0}function WM(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&H_(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function bl(n,e){return sn(n.prev,n,n.next)<0?sn(n,e,n.next)>=0&&sn(n,n.prev,e)>=0:sn(n,e,n.prev)<0||sn(n,n.next,e)<0}function jM(n,e){let t=n,r=!1;const i=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==n);return r}function G_(n,e){const t=Ip(n.i,n.x,n.y),r=Ip(e.i,e.x,e.y),i=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=i,i.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function W_(n,e,t,r){const i=Ip(n,e,t);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Ml(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Ip(n,e,t){return{i:n,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function XM(n,e,t,r){let i=0;for(let s=e,o=t-r;s<t;s+=r)i+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return i}class $M{static triangulate(e,t,r=2){return IM(e,t,r)}}class oa{static area(e){const t=e.length;let r=0;for(let i=t-1,s=0;s<t;i=s++)r+=e[i].x*e[s].y-e[s].x*e[i].y;return r*.5}static isClockWise(e){return oa.area(e)<0}static triangulateShape(e,t){const r=[],i=[],s=[];j_(e),X_(r,e);let o=e.length;t.forEach(j_);for(let l=0;l<t.length;l++)i.push(o),o+=t[l].length,X_(r,t[l]);const a=$M.triangulate(r,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function j_(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function X_(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class Tu extends tr{constructor(e=1,t=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i};const s=e/2,o=t/2,a=Math.floor(r),l=Math.floor(i),c=a+1,h=l+1,f=e/a,p=t/l,d=[],m=[],x=[],v=[];for(let _=0;_<h;_++){const b=_*p-o;for(let M=0;M<c;M++){const E=M*f-s;m.push(E,-b,0),x.push(0,0,1),v.push(M/a),v.push(1-_/l)}}for(let _=0;_<l;_++)for(let b=0;b<a;b++){const M=b+c*_,E=b+c*(_+1),S=b+1+c*(_+1),T=b+1+c*_;d.push(M,E,T),d.push(E,S,T)}this.setIndex(d),this.setAttribute("position",new Gn(m,3)),this.setAttribute("normal",new Gn(x,3)),this.setAttribute("uv",new Gn(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Tu(e.width,e.height,e.widthSegments,e.heightSegments)}}class Lp extends tr{constructor(e=new ia([new Fe(0,.5),new Fe(-.5,-.5),new Fe(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const r=[],i=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let h=0;h<e.length;h++)c(e[h]),this.addGroup(a,l,h),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new Gn(i,3)),this.setAttribute("normal",new Gn(s,3)),this.setAttribute("uv",new Gn(o,2));function c(h){const f=i.length/3,p=h.extractPoints(t);let d=p.shape;const m=p.holes;oa.isClockWise(d)===!1&&(d=d.reverse());for(let v=0,_=m.length;v<_;v++){const b=m[v];oa.isClockWise(b)===!0&&(m[v]=b.reverse())}const x=oa.triangulateShape(d,m);for(let v=0,_=m.length;v<_;v++){const b=m[v];d=d.concat(b)}for(let v=0,_=d.length;v<_;v++){const b=d[v];i.push(b.x,b.y,0),s.push(0,0,1),o.push(b.x,b.y)}for(let v=0,_=x.length;v<_;v++){const b=x[v],M=b[0]+f,E=b[1]+f,S=b[2]+f;r.push(M,E,S),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return YM(t,e)}static fromJSON(e,t){const r=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=t[e.shapes[i]];r.push(o)}return new Lp(r,e.curveSegments)}}function YM(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,r=n.length;t<r;t++){const i=n[t];e.shapes.push(i.uuid)}else e.shapes.push(n.uuid);return e}class KM extends $s{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new St(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new St(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kd,this.normalScale=new Fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Zr,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ZM extends $s{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new St(16777215),this.specular=new St(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new St(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kd,this.normalScale=new Fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Zr,this.combine=dd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class JM extends $s{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Rb,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class QM extends $s{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const wl={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class e4{constructor(e,t,r){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.abortController=new AbortController,this.itemStart=function(h){a++,s===!1&&i.onStart!==void 0&&i.onStart(h,o,a),s=!0},this.itemEnd=function(h){o++,i.onProgress!==void 0&&i.onProgress(h,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,f){return c.push(h,f),this},this.removeHandler=function(h){const f=c.indexOf(h);return f!==-1&&c.splice(f,2),this},this.getHandler=function(h){for(let f=0,p=c.length;f<p;f+=2){const d=c[f],m=c[f+1];if(d.global&&(d.lastIndex=0),d.test(h))return m}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}}const t4=new e4;class Tl{constructor(e){this.manager=e!==void 0?e:t4,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const r=this;return new Promise(function(i,s){r.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Tl.DEFAULT_MATERIAL_NAME="__DEFAULT";const Wi={};class n4 extends Error{constructor(e,t){super(e),this.response=t}}class r4 extends Tl{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=wl.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Wi[e]!==void 0){Wi[e].push({onLoad:t,onProgress:r,onError:i});return}Wi[e]=[],Wi[e].push({onLoad:t,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=Wi[e],f=c.body.getReader(),p=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),d=p?parseInt(p):0,m=d!==0;let x=0;const v=new ReadableStream({start(_){b();function b(){f.read().then(({done:M,value:E})=>{if(M)_.close();else{x+=E.byteLength;const S=new ProgressEvent("progress",{lengthComputable:m,loaded:x,total:d});for(let T=0,q=h.length;T<q;T++){const O=h[T];O.onProgress&&O.onProgress(S)}_.enqueue(E),b()}},M=>{_.error(M)})}}});return new Response(v)}else throw new n4(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,a));case"json":return c.json();default:if(a==="")return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),p=f&&f[1]?f[1].toLowerCase():void 0,d=new TextDecoder(p);return c.arrayBuffer().then(m=>d.decode(m))}}}).then(c=>{wl.add(`file:${e}`,c);const h=Wi[e];delete Wi[e];for(let f=0,p=h.length;f<p;f++){const d=h[f];d.onLoad&&d.onLoad(c)}}).catch(c=>{const h=Wi[e];if(h===void 0)throw this.manager.itemError(e),c;delete Wi[e];for(let f=0,p=h.length;f<p;f++){const d=h[f];d.onError&&d.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const aa=new WeakMap;class i4 extends Tl{constructor(e){super(e)}load(e,t,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=wl.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let f=aa.get(o);f===void 0&&(f=[],aa.set(o,f)),f.push({onLoad:t,onError:i})}return o}const a=hl("img");function l(){h(),t&&t(this);const f=aa.get(this)||[];for(let p=0;p<f.length;p++){const d=f[p];d.onLoad&&d.onLoad(this)}aa.delete(this),s.manager.itemEnd(e)}function c(f){h(),i&&i(f),wl.remove(`image:${e}`);const p=aa.get(this)||[];for(let d=0;d<p.length;d++){const m=p[d];m.onError&&m.onError(f)}aa.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),wl.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}}class $_ extends Tl{constructor(e){super(e)}load(e,t,r,i){const s=new Dn,o=new i4(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},r,i),s}}class Op extends Ot{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new St(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const qp=new Ht,Y_=new G,K_=new G;class Z_{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Fe(512,512),this.mapType=Ei,this.map=null,this.mapPass=null,this.matrix=new Ht,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ep,this._frameExtents=new Fe(1,1),this._viewportCount=1,this._viewports=[new on(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;Y_.setFromMatrixPosition(e.matrixWorld),t.position.copy(Y_),K_.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(K_),t.updateMatrixWorld(),qp.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(qp,t.coordinateSystem,t.reversedDepth),t.reversedDepth?r.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(qp)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class s4 extends Z_{constructor(){super(new _r(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,r=Kc*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(r!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class o4 extends Op{constructor(e,t,r=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ot.DEFAULT_UP),this.updateMatrix(),this.target=new Ot,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new s4}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class J_ extends w_{constructor(e=-1,t=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=h*this.view.offsetY,l=a-h*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class a4 extends Z_{constructor(){super(new J_(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class l4 extends Op{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ot.DEFAULT_UP),this.updateMatrix(),this.target=new Ot,this.shadow=new a4}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Q_ extends Op{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class c4 extends _r{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const ev=new Ht;class u4{constructor(e,t,r=0,i=1/0){this.ray=new ru(e,t),this.near=r,this.far=i,this.camera=null,this.layers=new lp,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return ev.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(ev),this}intersectObject(e,t=!0,r=[]){return Dp(e,this,r,t),r.sort(tv),r}intersectObjects(e,t=!0,r=[]){for(let i=0,s=e.length;i<s;i++)Dp(e[i],this,r,t);return r.sort(tv),r}}function tv(n,e){return n.distance-e.distance}function Dp(n,e,t,r){let i=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(i=!1),i===!0&&r===!0){const s=n.children;for(let o=0,a=s.length;o<a;o++)Dp(s[o],e,t,!0)}}class nv{constructor(e=1,t=0,r=0){this.radius=e,this.phi=t,this.theta=r}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=_t(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(_t(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const Au=new Mi;class h4 extends vl{constructor(e,t=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),s=new tr;s.setIndex(new Pr(r,1)),s.setAttribute("position",new Pr(i,3)),super(s,new vu({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Au.setFromObject(this.object),Au.isEmpty())return;const e=Au.min,t=Au.max,r=this.geometry.attributes.position,i=r.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class f4{constructor(){this.type="ShapePath",this.color=new St,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Rp,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,i){return this.currentPath.quadraticCurveTo(e,t,r,i),this}bezierCurveTo(e,t,r,i,s,o){return this.currentPath.bezierCurveTo(e,t,r,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(_){const b=[];for(let M=0,E=_.length;M<E;M++){const S=_[M],T=new ia;T.curves=S.curves,b.push(T)}return b}function r(_,b){const M=b.length;let E=!1;for(let S=M-1,T=0;T<M;S=T++){let q=b[S],O=b[T],A=O.x-q.x,L=O.y-q.y;if(Math.abs(L)>Number.EPSILON){if(L<0&&(q=b[T],A=-A,O=b[S],L=-L),_.y<q.y||_.y>O.y)continue;if(_.y===q.y){if(_.x===q.x)return!0}else{const N=L*(_.x-q.x)-A*(_.y-q.y);if(N===0)return!0;if(N<0)continue;E=!E}}else{if(_.y!==q.y)continue;if(O.x<=_.x&&_.x<=q.x||q.x<=_.x&&_.x<=O.x)return!0}}return E}const i=oa.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new ia,l.curves=a.curves,c.push(l),c;let h=!i(s[0].getPoints());h=e?!h:h;const f=[],p=[];let d=[],m=0,x;p[m]=void 0,d[m]=[];for(let _=0,b=s.length;_<b;_++)a=s[_],x=a.getPoints(),o=i(x),o=e?!o:o,o?(!h&&p[m]&&m++,p[m]={s:new ia,p:x},p[m].s.curves=a.curves,h&&m++,d[m]=[]):d[m].push({h:a,p:x[0]});if(!p[0])return t(s);if(p.length>1){let _=!1,b=0;for(let M=0,E=p.length;M<E;M++)f[M]=[];for(let M=0,E=p.length;M<E;M++){const S=d[M];for(let T=0;T<S.length;T++){const q=S[T];let O=!0;for(let A=0;A<p.length;A++)r(q.p,p[A].p)&&(M!==A&&b++,O?(O=!1,f[A].push(q)):_=!0);O&&f[M].push(q)}}b>0&&_===!1&&(d=f)}let v;for(let _=0,b=p.length;_<b;_++){l=p[_].s,c.push(l),v=d[_];for(let M=0,E=v.length;M<E;M++)l.holes.push(v[M].h)}return c}}class d4 extends Gs{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function rv(n,e,t,r){const i=p4(r);switch(t){case Y1:return n*e;case Z1:return n*e/i.components*i.byteLength;case Sd:return n*e/i.components*i.byteLength;case J1:return n*e*2/i.components*i.byteLength;case Ed:return n*e*2/i.components*i.byteLength;case K1:return n*e*3/i.components*i.byteLength;case $r:return n*e*4/i.components*i.byteLength;case bd:return n*e*4/i.components*i.byteLength;case Vc:case Hc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Gc:case Wc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case wd:case Ad:return Math.max(n,16)*Math.max(e,8)/4;case Md:case Td:return Math.max(n,8)*Math.max(e,8)/2;case Cd:case Rd:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Pd:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Id:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Ld:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Od:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case qd:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Dd:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Nd:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Ud:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Fd:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case zd:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case kd:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Bd:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Vd:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case Hd:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Gd:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case jc:case Wd:case jd:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Q1:case Xd:return Math.ceil(n/4)*Math.ceil(e/4)*8;case $d:case Yd:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function p4(n){switch(n){case Ei:case j1:return{byteLength:1,components:1};case sl:case X1:case ol:return{byteLength:2,components:1};case xd:case yd:return{byteLength:2,components:4};case Hs:case vd:case Fi:return{byteLength:4,components:1};case $1:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:rd}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=rd);/**
122
114
  * @license
123
115
  * Copyright 2010-2025 Three.js Authors
124
116
  * SPDX-License-Identifier: MIT
@@ -2605,7 +2597,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,c5=`#ifdef USE_TRANSMISS
2605
2597
  worldPosition = instanceMatrix * worldPosition;
2606
2598
  #endif
2607
2599
  worldPosition = modelMatrix * worldPosition;
2608
- #endif`;const Et={alphahash_fragment:g4,alphahash_pars_fragment:_4,alphamap_fragment:v4,alphamap_pars_fragment:x4,alphatest_fragment:y4,alphatest_pars_fragment:S4,aomap_fragment:E4,aomap_pars_fragment:b4,batching_pars_vertex:M4,batching_vertex:w4,begin_vertex:T4,beginnormal_vertex:A4,bsdfs:C4,iridescence_fragment:R4,bumpmap_pars_fragment:P4,clipping_planes_fragment:I4,clipping_planes_pars_fragment:L4,clipping_planes_pars_vertex:O4,clipping_planes_vertex:q4,color_fragment:D4,color_pars_fragment:N4,color_pars_vertex:U4,color_vertex:F4,common:z4,cube_uv_reflection_fragment:k4,defaultnormal_vertex:B4,displacementmap_pars_vertex:V4,displacementmap_vertex:H4,emissivemap_fragment:G4,emissivemap_pars_fragment:W4,colorspace_fragment:j4,colorspace_pars_fragment:X4,envmap_fragment:$4,envmap_common_pars_fragment:Y4,envmap_pars_fragment:K4,envmap_pars_vertex:Z4,envmap_physical_pars_fragment:lw,envmap_vertex:J4,fog_vertex:Q4,fog_pars_vertex:ew,fog_fragment:tw,fog_pars_fragment:nw,gradientmap_pars_fragment:rw,lightmap_pars_fragment:iw,lights_lambert_fragment:sw,lights_lambert_pars_fragment:ow,lights_pars_begin:aw,lights_toon_fragment:cw,lights_toon_pars_fragment:uw,lights_phong_fragment:hw,lights_phong_pars_fragment:fw,lights_physical_fragment:dw,lights_physical_pars_fragment:pw,lights_fragment_begin:mw,lights_fragment_maps:gw,lights_fragment_end:_w,logdepthbuf_fragment:vw,logdepthbuf_pars_fragment:xw,logdepthbuf_pars_vertex:yw,logdepthbuf_vertex:Sw,map_fragment:Ew,map_pars_fragment:bw,map_particle_fragment:Mw,map_particle_pars_fragment:ww,metalnessmap_fragment:Tw,metalnessmap_pars_fragment:Aw,morphinstance_vertex:Cw,morphcolor_vertex:Rw,morphnormal_vertex:Pw,morphtarget_pars_vertex:Iw,morphtarget_vertex:Lw,normal_fragment_begin:Ow,normal_fragment_maps:qw,normal_pars_fragment:Dw,normal_pars_vertex:Nw,normal_vertex:Uw,normalmap_pars_fragment:Fw,clearcoat_normal_fragment_begin:zw,clearcoat_normal_fragment_maps:kw,clearcoat_pars_fragment:Bw,iridescence_pars_fragment:Vw,opaque_fragment:Hw,packing:Gw,premultiplied_alpha_fragment:Ww,project_vertex:jw,dithering_fragment:Xw,dithering_pars_fragment:$w,roughnessmap_fragment:Yw,roughnessmap_pars_fragment:Kw,shadowmap_pars_fragment:Zw,shadowmap_pars_vertex:Jw,shadowmap_vertex:Qw,shadowmask_pars_fragment:e5,skinbase_vertex:t5,skinning_pars_vertex:n5,skinning_vertex:r5,skinnormal_vertex:i5,specularmap_fragment:s5,specularmap_pars_fragment:o5,tonemapping_fragment:a5,tonemapping_pars_fragment:l5,transmission_fragment:c5,transmission_pars_fragment:u5,uv_pars_fragment:h5,uv_pars_vertex:f5,uv_vertex:d5,worldpos_vertex:p5,background_vert:`varying vec2 vUv;
2600
+ #endif`;const gt={alphahash_fragment:g4,alphahash_pars_fragment:_4,alphamap_fragment:v4,alphamap_pars_fragment:x4,alphatest_fragment:y4,alphatest_pars_fragment:S4,aomap_fragment:E4,aomap_pars_fragment:b4,batching_pars_vertex:M4,batching_vertex:w4,begin_vertex:T4,beginnormal_vertex:A4,bsdfs:C4,iridescence_fragment:R4,bumpmap_pars_fragment:P4,clipping_planes_fragment:I4,clipping_planes_pars_fragment:L4,clipping_planes_pars_vertex:O4,clipping_planes_vertex:q4,color_fragment:D4,color_pars_fragment:N4,color_pars_vertex:U4,color_vertex:F4,common:z4,cube_uv_reflection_fragment:k4,defaultnormal_vertex:B4,displacementmap_pars_vertex:V4,displacementmap_vertex:H4,emissivemap_fragment:G4,emissivemap_pars_fragment:W4,colorspace_fragment:j4,colorspace_pars_fragment:X4,envmap_fragment:$4,envmap_common_pars_fragment:Y4,envmap_pars_fragment:K4,envmap_pars_vertex:Z4,envmap_physical_pars_fragment:lw,envmap_vertex:J4,fog_vertex:Q4,fog_pars_vertex:ew,fog_fragment:tw,fog_pars_fragment:nw,gradientmap_pars_fragment:rw,lightmap_pars_fragment:iw,lights_lambert_fragment:sw,lights_lambert_pars_fragment:ow,lights_pars_begin:aw,lights_toon_fragment:cw,lights_toon_pars_fragment:uw,lights_phong_fragment:hw,lights_phong_pars_fragment:fw,lights_physical_fragment:dw,lights_physical_pars_fragment:pw,lights_fragment_begin:mw,lights_fragment_maps:gw,lights_fragment_end:_w,logdepthbuf_fragment:vw,logdepthbuf_pars_fragment:xw,logdepthbuf_pars_vertex:yw,logdepthbuf_vertex:Sw,map_fragment:Ew,map_pars_fragment:bw,map_particle_fragment:Mw,map_particle_pars_fragment:ww,metalnessmap_fragment:Tw,metalnessmap_pars_fragment:Aw,morphinstance_vertex:Cw,morphcolor_vertex:Rw,morphnormal_vertex:Pw,morphtarget_pars_vertex:Iw,morphtarget_vertex:Lw,normal_fragment_begin:Ow,normal_fragment_maps:qw,normal_pars_fragment:Dw,normal_pars_vertex:Nw,normal_vertex:Uw,normalmap_pars_fragment:Fw,clearcoat_normal_fragment_begin:zw,clearcoat_normal_fragment_maps:kw,clearcoat_pars_fragment:Bw,iridescence_pars_fragment:Vw,opaque_fragment:Hw,packing:Gw,premultiplied_alpha_fragment:Ww,project_vertex:jw,dithering_fragment:Xw,dithering_pars_fragment:$w,roughnessmap_fragment:Yw,roughnessmap_pars_fragment:Kw,shadowmap_pars_fragment:Zw,shadowmap_pars_vertex:Jw,shadowmap_vertex:Qw,shadowmask_pars_fragment:e5,skinbase_vertex:t5,skinning_pars_vertex:n5,skinning_vertex:r5,skinnormal_vertex:i5,specularmap_fragment:s5,specularmap_pars_fragment:o5,tonemapping_fragment:a5,tonemapping_pars_fragment:l5,transmission_fragment:c5,transmission_pars_fragment:u5,uv_pars_fragment:h5,uv_pars_vertex:f5,uv_vertex:d5,worldpos_vertex:p5,background_vert:`varying vec2 vUv;
2609
2601
  uniform mat3 uvTransform;
2610
2602
  void main() {
2611
2603
  vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
@@ -3661,7 +3653,7 @@ void main() {
3661
3653
  #include <tonemapping_fragment>
3662
3654
  #include <colorspace_fragment>
3663
3655
  #include <fog_fragment>
3664
- }`},He={common:{diffuse:{value:new Ct(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new yt},alphaMap:{value:null},alphaMapTransform:{value:new yt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new yt}},envmap:{envMap:{value:null},envMapRotation:{value:new yt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new yt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new yt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new yt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new yt},normalScale:{value:new Be(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new yt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new yt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new yt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new yt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ct(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ct(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new yt},alphaTest:{value:0},uvTransform:{value:new yt}},sprite:{diffuse:{value:new Ct(16777215)},opacity:{value:1},center:{value:new Be(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new yt},alphaMap:{value:null},alphaMapTransform:{value:new yt},alphaTest:{value:0}}},qi={basic:{uniforms:tr([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.fog]),vertexShader:Et.meshbasic_vert,fragmentShader:Et.meshbasic_frag},lambert:{uniforms:tr([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.fog,He.lights,{emissive:{value:new Ct(0)}}]),vertexShader:Et.meshlambert_vert,fragmentShader:Et.meshlambert_frag},phong:{uniforms:tr([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.fog,He.lights,{emissive:{value:new Ct(0)},specular:{value:new Ct(1118481)},shininess:{value:30}}]),vertexShader:Et.meshphong_vert,fragmentShader:Et.meshphong_frag},standard:{uniforms:tr([He.common,He.envmap,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.roughnessmap,He.metalnessmap,He.fog,He.lights,{emissive:{value:new Ct(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Et.meshphysical_vert,fragmentShader:Et.meshphysical_frag},toon:{uniforms:tr([He.common,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.gradientmap,He.fog,He.lights,{emissive:{value:new Ct(0)}}]),vertexShader:Et.meshtoon_vert,fragmentShader:Et.meshtoon_frag},matcap:{uniforms:tr([He.common,He.bumpmap,He.normalmap,He.displacementmap,He.fog,{matcap:{value:null}}]),vertexShader:Et.meshmatcap_vert,fragmentShader:Et.meshmatcap_frag},points:{uniforms:tr([He.points,He.fog]),vertexShader:Et.points_vert,fragmentShader:Et.points_frag},dashed:{uniforms:tr([He.common,He.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Et.linedashed_vert,fragmentShader:Et.linedashed_frag},depth:{uniforms:tr([He.common,He.displacementmap]),vertexShader:Et.depth_vert,fragmentShader:Et.depth_frag},normal:{uniforms:tr([He.common,He.bumpmap,He.normalmap,He.displacementmap,{opacity:{value:1}}]),vertexShader:Et.meshnormal_vert,fragmentShader:Et.meshnormal_frag},sprite:{uniforms:tr([He.sprite,He.fog]),vertexShader:Et.sprite_vert,fragmentShader:Et.sprite_frag},background:{uniforms:{uvTransform:{value:new yt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Et.background_vert,fragmentShader:Et.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new yt}},vertexShader:Et.backgroundCube_vert,fragmentShader:Et.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Et.cube_vert,fragmentShader:Et.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Et.equirect_vert,fragmentShader:Et.equirect_frag},distanceRGBA:{uniforms:tr([He.common,He.displacementmap,{referencePosition:{value:new j},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Et.distanceRGBA_vert,fragmentShader:Et.distanceRGBA_frag},shadow:{uniforms:tr([He.lights,He.fog,{color:{value:new Ct(0)},opacity:{value:1}}]),vertexShader:Et.shadow_vert,fragmentShader:Et.shadow_frag}};qi.physical={uniforms:tr([qi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new yt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new yt},clearcoatNormalScale:{value:new Be(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new yt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new yt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new yt},sheen:{value:0},sheenColor:{value:new Ct(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new yt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new yt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new yt},transmissionSamplerSize:{value:new Be},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new yt},attenuationDistance:{value:0},attenuationColor:{value:new Ct(0)},specularColor:{value:new Ct(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new yt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new yt},anisotropyVector:{value:new Be},anisotropyMap:{value:null},anisotropyMapTransform:{value:new yt}}]),vertexShader:Et.meshphysical_vert,fragmentShader:Et.meshphysical_frag};const Ou={r:0,b:0,g:0},co=new oi,m5=new Kt;function g5(n,e,t,r,i,s,o){const a=new Ct(0);let l=s===!0?0:1,c,h,f=null,p=0,d=null;function m(M){let b=M.isScene===!0?M.background:null;return b&&b.isTexture&&(b=(M.backgroundBlurriness>0?t:e).get(b)),b}function x(M){let b=!1;const S=m(M);S===null?_(a,l):S&&S.isColor&&(_(S,1),b=!0);const T=n.xr.getEnvironmentBlendMode();T==="additive"?r.buffers.color.setClear(0,0,0,1,o):T==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(n.autoClear||b)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function v(M,b){const S=m(b);S&&(S.isCubeTexture||S.mapping===Wc)?(h===void 0&&(h=new Dn(new oo(1,1,1),new Ts({name:"BackgroundCubeMaterial",uniforms:ha(qi.backgroundCube.uniforms),vertexShader:qi.backgroundCube.vertexShader,fragmentShader:qi.backgroundCube.fragmentShader,side:lr,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(T,q,O){this.matrixWorld.copyPosition(O.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),co.copy(b.backgroundRotation),co.x*=-1,co.y*=-1,co.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(co.y*=-1,co.z*=-1),h.material.uniforms.envMap.value=S,h.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=b.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(m5.makeRotationFromEuler(co)),h.material.toneMapped=Nt.getTransfer(S.colorSpace)!==Gt,(f!==S||p!==S.version||d!==n.toneMapping)&&(h.material.needsUpdate=!0,f=S,p=S.version,d=n.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null)):S&&S.isTexture&&(c===void 0&&(c=new Dn(new Iu(2,2),new Ts({name:"BackgroundMaterial",uniforms:ha(qi.background.uniforms),vertexShader:qi.background.vertexShader,fragmentShader:qi.background.fragmentShader,side:gs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=S,c.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,c.material.toneMapped=Nt.getTransfer(S.colorSpace)!==Gt,S.matrixAutoUpdate===!0&&S.updateMatrix(),c.material.uniforms.uvTransform.value.copy(S.matrix),(f!==S||p!==S.version||d!==n.toneMapping)&&(c.material.needsUpdate=!0,f=S,p=S.version,d=n.toneMapping),c.layers.enableAll(),M.unshift(c,c.geometry,c.material,0,0,null))}function _(M,b){M.getRGB(Ou,M_(n)),r.buffers.color.setClear(Ou.r,Ou.g,Ou.b,b,o)}function E(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(M,b=1){a.set(M),l=b,_(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(M){l=M,_(a,l)},render:x,addToRenderList:v,dispose:E}}function _5(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),r={},i=p(null);let s=i,o=!1;function a(L,N,Z,Y,ee){let ue=!1;const te=f(Y,Z,N);s!==te&&(s=te,c(s.object)),ue=d(L,Y,Z,ee),ue&&m(L,Y,Z,ee),ee!==null&&e.update(ee,n.ELEMENT_ARRAY_BUFFER),(ue||o)&&(o=!1,b(L,N,Z,Y),ee!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(ee).buffer))}function l(){return n.createVertexArray()}function c(L){return n.bindVertexArray(L)}function h(L){return n.deleteVertexArray(L)}function f(L,N,Z){const Y=Z.wireframe===!0;let ee=r[L.id];ee===void 0&&(ee={},r[L.id]=ee);let ue=ee[N.id];ue===void 0&&(ue={},ee[N.id]=ue);let te=ue[Y];return te===void 0&&(te=p(l()),ue[Y]=te),te}function p(L){const N=[],Z=[],Y=[];for(let ee=0;ee<t;ee++)N[ee]=0,Z[ee]=0,Y[ee]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:Z,attributeDivisors:Y,object:L,attributes:{},index:null}}function d(L,N,Z,Y){const ee=s.attributes,ue=N.attributes;let te=0;const ae=Z.getAttributes();for(const B in ae)if(ae[B].location>=0){const $=ee[B];let oe=ue[B];if(oe===void 0&&(B==="instanceMatrix"&&L.instanceMatrix&&(oe=L.instanceMatrix),B==="instanceColor"&&L.instanceColor&&(oe=L.instanceColor)),$===void 0||$.attribute!==oe||oe&&$.data!==oe.data)return!0;te++}return s.attributesNum!==te||s.index!==Y}function m(L,N,Z,Y){const ee={},ue=N.attributes;let te=0;const ae=Z.getAttributes();for(const B in ae)if(ae[B].location>=0){let $=ue[B];$===void 0&&(B==="instanceMatrix"&&L.instanceMatrix&&($=L.instanceMatrix),B==="instanceColor"&&L.instanceColor&&($=L.instanceColor));const oe={};oe.attribute=$,$&&$.data&&(oe.data=$.data),ee[B]=oe,te++}s.attributes=ee,s.attributesNum=te,s.index=Y}function x(){const L=s.newAttributes;for(let N=0,Z=L.length;N<Z;N++)L[N]=0}function v(L){_(L,0)}function _(L,N){const Z=s.newAttributes,Y=s.enabledAttributes,ee=s.attributeDivisors;Z[L]=1,Y[L]===0&&(n.enableVertexAttribArray(L),Y[L]=1),ee[L]!==N&&(n.vertexAttribDivisor(L,N),ee[L]=N)}function E(){const L=s.newAttributes,N=s.enabledAttributes;for(let Z=0,Y=N.length;Z<Y;Z++)N[Z]!==L[Z]&&(n.disableVertexAttribArray(Z),N[Z]=0)}function M(L,N,Z,Y,ee,ue,te){te===!0?n.vertexAttribIPointer(L,N,Z,ee,ue):n.vertexAttribPointer(L,N,Z,Y,ee,ue)}function b(L,N,Z,Y){x();const ee=Y.attributes,ue=Z.getAttributes(),te=N.defaultAttributeValues;for(const ae in ue){const B=ue[ae];if(B.location>=0){let Se=ee[ae];if(Se===void 0&&(ae==="instanceMatrix"&&L.instanceMatrix&&(Se=L.instanceMatrix),ae==="instanceColor"&&L.instanceColor&&(Se=L.instanceColor)),Se!==void 0){const $=Se.normalized,oe=Se.itemSize,Ae=e.get(Se);if(Ae===void 0)continue;const Ie=Ae.buffer,Ce=Ae.type,V=Ae.bytesPerElement,ne=Ce===n.INT||Ce===n.UNSIGNED_INT||Se.gpuType===vd;if(Se.isInterleavedBufferAttribute){const X=Se.data,pe=X.stride,Ee=Se.offset;if(X.isInstancedInterleavedBuffer){for(let Q=0;Q<B.locationSize;Q++)_(B.location+Q,X.meshPerAttribute);L.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=X.meshPerAttribute*X.count)}else for(let Q=0;Q<B.locationSize;Q++)v(B.location+Q);n.bindBuffer(n.ARRAY_BUFFER,Ie);for(let Q=0;Q<B.locationSize;Q++)M(B.location+Q,oe/B.locationSize,Ce,$,pe*V,(Ee+oe/B.locationSize*Q)*V,ne)}else{if(Se.isInstancedBufferAttribute){for(let X=0;X<B.locationSize;X++)_(B.location+X,Se.meshPerAttribute);L.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=Se.meshPerAttribute*Se.count)}else for(let X=0;X<B.locationSize;X++)v(B.location+X);n.bindBuffer(n.ARRAY_BUFFER,Ie);for(let X=0;X<B.locationSize;X++)M(B.location+X,oe/B.locationSize,Ce,$,oe*V,oe/B.locationSize*X*V,ne)}}else if(te!==void 0){const $=te[ae];if($!==void 0)switch($.length){case 2:n.vertexAttrib2fv(B.location,$);break;case 3:n.vertexAttrib3fv(B.location,$);break;case 4:n.vertexAttrib4fv(B.location,$);break;default:n.vertexAttrib1fv(B.location,$)}}}}E()}function S(){O();for(const L in r){const N=r[L];for(const Z in N){const Y=N[Z];for(const ee in Y)h(Y[ee].object),delete Y[ee];delete N[Z]}delete r[L]}}function T(L){if(r[L.id]===void 0)return;const N=r[L.id];for(const Z in N){const Y=N[Z];for(const ee in Y)h(Y[ee].object),delete Y[ee];delete N[Z]}delete r[L.id]}function q(L){for(const N in r){const Z=r[N];if(Z[L.id]===void 0)continue;const Y=Z[L.id];for(const ee in Y)h(Y[ee].object),delete Y[ee];delete Z[L.id]}}function O(){A(),o=!0,s!==i&&(s=i,c(s.object))}function A(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:O,resetDefaultState:A,dispose:S,releaseStatesOfGeometry:T,releaseStatesOfProgram:q,initAttributes:x,enableAttribute:v,disableUnusedAttributes:E}}function v5(n,e,t){let r;function i(c){r=c}function s(c,h){n.drawArrays(r,c,h),t.update(h,r,1)}function o(c,h,f){f!==0&&(n.drawArraysInstanced(r,c,h,f),t.update(h,r,f))}function a(c,h,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,c,0,h,0,f);let d=0;for(let m=0;m<f;m++)d+=h[m];t.update(d,r,1)}function l(c,h,f,p){if(f===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let m=0;m<c.length;m++)o(c[m],h[m],p[m]);else{d.multiDrawArraysInstancedWEBGL(r,c,0,h,0,p,0,f);let m=0;for(let x=0;x<f;x++)m+=h[x]*p[x];t.update(m,r,1)}}this.setMode=i,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function x5(n,e,t,r){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const q=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(q.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(q){return!(q!==ri&&r.convert(q)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(q){const O=q===pl&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(q!==Pi&&r.convert(q)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&q!==ji&&!O)}function l(q){if(q==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";q="mediump"}return q==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const f=t.logarithmicDepthBuffer===!0,p=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),d=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=n.getParameter(n.MAX_TEXTURE_SIZE),v=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),_=n.getParameter(n.MAX_VERTEX_ATTRIBS),E=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),M=n.getParameter(n.MAX_VARYING_VECTORS),b=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),S=m>0,T=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:p,maxTextures:d,maxVertexTextures:m,maxTextureSize:x,maxCubemapSize:v,maxAttributes:_,maxVertexUniforms:E,maxVaryings:M,maxFragmentUniforms:b,vertexTextures:S,maxSamples:T}}function y5(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new Cs,a=new yt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){const d=f.length!==0||p||r!==0||i;return i=p,r=f.length,d},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){t=h(f,p,0)},this.setState=function(f,p,d){const m=f.clippingPlanes,x=f.clipIntersection,v=f.clipShadows,_=n.get(f);if(!i||m===null||m.length===0||s&&!v)s?h(null):c();else{const E=s?0:r,M=E*4;let b=_.clippingState||null;l.value=b,b=h(m,p,M,d);for(let S=0;S!==M;++S)b[S]=t[S];_.clippingState=b,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function h(f,p,d,m){const x=f!==null?f.length:0;let v=null;if(x!==0){if(v=l.value,m!==!0||v===null){const _=d+x*4,E=p.matrixWorldInverse;a.getNormalMatrix(E),(v===null||v.length<_)&&(v=new Float32Array(_));for(let M=0,b=d;M!==x;++M,b+=4)o.copy(f[M]).applyMatrix4(E,a),o.normal.toArray(v,b),v[b+3]=o.constant}l.value=v,l.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,v}}function S5(n){let e=new WeakMap;function t(o,a){return a===pd?o.mapping=$o:a===md&&(o.mapping=Yo),o}function r(o){if(o&&o.isTexture){const a=o.mapping;if(a===pd||a===md)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new hM(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}const va=4,sv=[.125,.215,.35,.446,.526,.582],uo=20,Np=new J_,ov=new Ct;let Up=null,Fp=0,zp=0,kp=!1;const ho=(1+Math.sqrt(5))/2,xa=1/ho,av=[new j(-ho,xa,0),new j(ho,xa,0),new j(-xa,0,ho),new j(xa,0,ho),new j(0,ho,-xa),new j(0,ho,xa),new j(-1,1,-1),new j(1,1,-1),new j(-1,1,1),new j(1,1,1)],E5=new j;class lv{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,i=100,s={}){const{size:o=256,position:a=E5}=s;Up=this._renderer.getRenderTarget(),Fp=this._renderer.getActiveCubeFace(),zp=this._renderer.getActiveMipmapLevel(),kp=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,r,i,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=hv(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=uv(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Up,Fp,zp),this._renderer.xr.enabled=kp,e.scissorTest=!1,qu(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===$o||e.mapping===Yo?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Up=this._renderer.getRenderTarget(),Fp=this._renderer.getActiveCubeFace(),zp=this._renderer.getActiveMipmapLevel(),kp=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=t||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,r={magFilter:Ri,minFilter:Ri,generateMipmaps:!1,type:pl,format:ri,colorSpace:Ko,depthBuffer:!1},i=cv(e,t,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=cv(e,t,r);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=b5(s)),this._blurMaterial=M5(s,e,t)}return i}_compileMaterial(e){const t=new Dn(this._lodPlanes[0],e);this._renderer.compile(t,Np)}_sceneToCubeUV(e,t,r,i,s){const l=new wr(90,1,t,r),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],f=this._renderer,p=f.autoClear,d=f.toneMapping;f.getClearColor(ov),f.toneMapping=vs,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(i),f.clearDepth(),f.setRenderTarget(null));const x=new io({name:"PMREM.Background",side:lr,depthWrite:!1,depthTest:!1}),v=new Dn(new oo,x);let _=!1;const E=e.background;E?E.isColor&&(x.color.copy(E),e.background=null,_=!0):(x.color.copy(ov),_=!0);for(let M=0;M<6;M++){const b=M%3;b===0?(l.up.set(0,c[M],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+h[M],s.y,s.z)):b===1?(l.up.set(0,0,c[M]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+h[M],s.z)):(l.up.set(0,c[M],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+h[M]));const S=this._cubeSize;qu(i,b*S,M>2?S:0,S,S),f.setRenderTarget(i),_&&f.render(v,l),f.render(e,l)}v.geometry.dispose(),v.material.dispose(),f.toneMapping=d,f.autoClear=p,e.background=E}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===$o||e.mapping===Yo;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=hv()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=uv());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new Dn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;qu(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,Np)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=av[(i-s-1)%av.length];this._blur(e,s-1,s,o,a)}t.autoClear=r}_blur(e,t,r,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,r,i,"latitudinal",s),this._halfBlur(o,e,r,r,i,"longitudinal",s)}_halfBlur(e,t,r,i,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,f=new Dn(this._lodPlanes[i],c),p=c.uniforms,d=this._sizeLods[r]-1,m=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*uo-1),x=s/m,v=isFinite(s)?1+Math.floor(h*x):uo;v>uo&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${uo}`);const _=[];let E=0;for(let q=0;q<uo;++q){const O=q/x,A=Math.exp(-O*O/2);_.push(A),q===0?E+=A:q<v&&(E+=2*A)}for(let q=0;q<_.length;q++)_[q]=_[q]/E;p.envMap.value=e.texture,p.samples.value=v,p.weights.value=_,p.latitudinal.value=o==="latitudinal",a&&(p.poleAxis.value=a);const{_lodMax:M}=this;p.dTheta.value=m,p.mipInt.value=M-r;const b=this._sizeLods[i],S=3*b*(i>M-va?i-M+va:0),T=4*(this._cubeSize-b);qu(t,S,T,3*b,2*b),l.setRenderTarget(t),l.render(f,Np)}}function b5(n){const e=[],t=[],r=[];let i=n;const s=n-va+1+sv.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);t.push(a);let l=1/a;o>n-va?l=sv[o-n+va-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),h=-c,f=1+c,p=[h,h,f,h,f,f,h,h,f,f,h,f],d=6,m=6,x=3,v=2,_=1,E=new Float32Array(x*m*d),M=new Float32Array(v*m*d),b=new Float32Array(_*m*d);for(let T=0;T<d;T++){const q=T%3*2/3-1,O=T>2?0:-1,A=[q,O,0,q+2/3,O,0,q+2/3,O+1,0,q,O,0,q+2/3,O+1,0,q,O+1,0];E.set(A,x*m*T),M.set(p,v*m*T);const L=[T,T,T,T,T,T];b.set(L,_*m*T)}const S=new ur;S.setAttribute("position",new kr(E,x)),S.setAttribute("uv",new kr(M,v)),S.setAttribute("faceIndex",new kr(b,_)),e.push(S),i>va&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function cv(n,e,t){const r=new eo(n,e,t);return r.texture.mapping=Wc,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function qu(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function M5(n,e,t){const r=new Float32Array(uo),i=new j(0,1,0);return new Ts({name:"SphericalGaussianBlur",defines:{n:uo,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Bp(),fragmentShader:`
3656
+ }`},ke={common:{diffuse:{value:new St(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new pt},alphaMap:{value:null},alphaMapTransform:{value:new pt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new pt}},envmap:{envMap:{value:null},envMapRotation:{value:new pt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new pt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new pt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new pt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new pt},normalScale:{value:new Fe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new pt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new pt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new pt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new pt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new St(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new St(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new pt},alphaTest:{value:0},uvTransform:{value:new pt}},sprite:{diffuse:{value:new St(16777215)},opacity:{value:1},center:{value:new Fe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new pt},alphaMap:{value:null},alphaMapTransform:{value:new pt},alphaTest:{value:0}}},Ti={basic:{uniforms:Wn([ke.common,ke.specularmap,ke.envmap,ke.aomap,ke.lightmap,ke.fog]),vertexShader:gt.meshbasic_vert,fragmentShader:gt.meshbasic_frag},lambert:{uniforms:Wn([ke.common,ke.specularmap,ke.envmap,ke.aomap,ke.lightmap,ke.emissivemap,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.fog,ke.lights,{emissive:{value:new St(0)}}]),vertexShader:gt.meshlambert_vert,fragmentShader:gt.meshlambert_frag},phong:{uniforms:Wn([ke.common,ke.specularmap,ke.envmap,ke.aomap,ke.lightmap,ke.emissivemap,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.fog,ke.lights,{emissive:{value:new St(0)},specular:{value:new St(1118481)},shininess:{value:30}}]),vertexShader:gt.meshphong_vert,fragmentShader:gt.meshphong_frag},standard:{uniforms:Wn([ke.common,ke.envmap,ke.aomap,ke.lightmap,ke.emissivemap,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.roughnessmap,ke.metalnessmap,ke.fog,ke.lights,{emissive:{value:new St(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:gt.meshphysical_vert,fragmentShader:gt.meshphysical_frag},toon:{uniforms:Wn([ke.common,ke.aomap,ke.lightmap,ke.emissivemap,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.gradientmap,ke.fog,ke.lights,{emissive:{value:new St(0)}}]),vertexShader:gt.meshtoon_vert,fragmentShader:gt.meshtoon_frag},matcap:{uniforms:Wn([ke.common,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.fog,{matcap:{value:null}}]),vertexShader:gt.meshmatcap_vert,fragmentShader:gt.meshmatcap_frag},points:{uniforms:Wn([ke.points,ke.fog]),vertexShader:gt.points_vert,fragmentShader:gt.points_frag},dashed:{uniforms:Wn([ke.common,ke.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:gt.linedashed_vert,fragmentShader:gt.linedashed_frag},depth:{uniforms:Wn([ke.common,ke.displacementmap]),vertexShader:gt.depth_vert,fragmentShader:gt.depth_frag},normal:{uniforms:Wn([ke.common,ke.bumpmap,ke.normalmap,ke.displacementmap,{opacity:{value:1}}]),vertexShader:gt.meshnormal_vert,fragmentShader:gt.meshnormal_frag},sprite:{uniforms:Wn([ke.sprite,ke.fog]),vertexShader:gt.sprite_vert,fragmentShader:gt.sprite_frag},background:{uniforms:{uvTransform:{value:new pt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:gt.background_vert,fragmentShader:gt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new pt}},vertexShader:gt.backgroundCube_vert,fragmentShader:gt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:gt.cube_vert,fragmentShader:gt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:gt.equirect_vert,fragmentShader:gt.equirect_frag},distanceRGBA:{uniforms:Wn([ke.common,ke.displacementmap,{referencePosition:{value:new G},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:gt.distanceRGBA_vert,fragmentShader:gt.distanceRGBA_frag},shadow:{uniforms:Wn([ke.lights,ke.fog,{color:{value:new St(0)},opacity:{value:1}}]),vertexShader:gt.shadow_vert,fragmentShader:gt.shadow_frag}};Ti.physical={uniforms:Wn([Ti.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new pt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new pt},clearcoatNormalScale:{value:new Fe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new pt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new pt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new pt},sheen:{value:0},sheenColor:{value:new St(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new pt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new pt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new pt},transmissionSamplerSize:{value:new Fe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new pt},attenuationDistance:{value:0},attenuationColor:{value:new St(0)},specularColor:{value:new St(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new pt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new pt},anisotropyVector:{value:new Fe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new pt}}]),vertexShader:gt.meshphysical_vert,fragmentShader:gt.meshphysical_frag};const Cu={r:0,b:0,g:0},eo=new Zr,m5=new Ht;function g5(n,e,t,r,i,s,o){const a=new St(0);let l=s===!0?0:1,c,h,f=null,p=0,d=null;function m(M){let E=M.isScene===!0?M.background:null;return E&&E.isTexture&&(E=(M.backgroundBlurriness>0?t:e).get(E)),E}function x(M){let E=!1;const S=m(M);S===null?_(a,l):S&&S.isColor&&(_(S,1),E=!0);const T=n.xr.getEnvironmentBlendMode();T==="additive"?r.buffers.color.setClear(0,0,0,1,o):T==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(n.autoClear||E)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function v(M,E){const S=m(E);S&&(S.isCubeTexture||S.mapping===kc)?(h===void 0&&(h=new Tn(new Zs(1,1,1),new vs({name:"BackgroundCubeMaterial",uniforms:ta(Ti.backgroundCube.uniforms),vertexShader:Ti.backgroundCube.vertexShader,fragmentShader:Ti.backgroundCube.fragmentShader,side:Qn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(T,q,O){this.matrixWorld.copyPosition(O.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),eo.copy(E.backgroundRotation),eo.x*=-1,eo.y*=-1,eo.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(eo.y*=-1,eo.z*=-1),h.material.uniforms.envMap.value=S,h.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(m5.makeRotationFromEuler(eo)),h.material.toneMapped=Ct.getTransfer(S.colorSpace)!==Ut,(f!==S||p!==S.version||d!==n.toneMapping)&&(h.material.needsUpdate=!0,f=S,p=S.version,d=n.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null)):S&&S.isTexture&&(c===void 0&&(c=new Tn(new Tu(2,2),new vs({name:"BackgroundMaterial",uniforms:ta(Ti.background.uniforms),vertexShader:Ti.background.vertexShader,fragmentShader:Ti.background.fragmentShader,side:ls,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=S,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.toneMapped=Ct.getTransfer(S.colorSpace)!==Ut,S.matrixAutoUpdate===!0&&S.updateMatrix(),c.material.uniforms.uvTransform.value.copy(S.matrix),(f!==S||p!==S.version||d!==n.toneMapping)&&(c.material.needsUpdate=!0,f=S,p=S.version,d=n.toneMapping),c.layers.enableAll(),M.unshift(c,c.geometry,c.material,0,0,null))}function _(M,E){M.getRGB(Cu,M_(n)),r.buffers.color.setClear(Cu.r,Cu.g,Cu.b,E,o)}function b(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(M,E=1){a.set(M),l=E,_(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(M){l=M,_(a,l)},render:x,addToRenderList:v,dispose:b}}function _5(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),r={},i=p(null);let s=i,o=!1;function a(L,N,Z,K,ne){let ce=!1;const J=f(K,Z,N);s!==J&&(s=J,c(s.object)),ce=d(L,K,Z,ne),ce&&m(L,K,Z,ne),ne!==null&&e.update(ne,n.ELEMENT_ARRAY_BUFFER),(ce||o)&&(o=!1,E(L,N,Z,K),ne!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(ne).buffer))}function l(){return n.createVertexArray()}function c(L){return n.bindVertexArray(L)}function h(L){return n.deleteVertexArray(L)}function f(L,N,Z){const K=Z.wireframe===!0;let ne=r[L.id];ne===void 0&&(ne={},r[L.id]=ne);let ce=ne[N.id];ce===void 0&&(ce={},ne[N.id]=ce);let J=ce[K];return J===void 0&&(J=p(l()),ce[K]=J),J}function p(L){const N=[],Z=[],K=[];for(let ne=0;ne<t;ne++)N[ne]=0,Z[ne]=0,K[ne]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:Z,attributeDivisors:K,object:L,attributes:{},index:null}}function d(L,N,Z,K){const ne=s.attributes,ce=N.attributes;let J=0;const oe=Z.getAttributes();for(const B in oe)if(oe[B].location>=0){const U=ne[B];let $=ce[B];if($===void 0&&(B==="instanceMatrix"&&L.instanceMatrix&&($=L.instanceMatrix),B==="instanceColor"&&L.instanceColor&&($=L.instanceColor)),U===void 0||U.attribute!==$||$&&U.data!==$.data)return!0;J++}return s.attributesNum!==J||s.index!==K}function m(L,N,Z,K){const ne={},ce=N.attributes;let J=0;const oe=Z.getAttributes();for(const B in oe)if(oe[B].location>=0){let U=ce[B];U===void 0&&(B==="instanceMatrix"&&L.instanceMatrix&&(U=L.instanceMatrix),B==="instanceColor"&&L.instanceColor&&(U=L.instanceColor));const $={};$.attribute=U,U&&U.data&&($.data=U.data),ne[B]=$,J++}s.attributes=ne,s.attributesNum=J,s.index=K}function x(){const L=s.newAttributes;for(let N=0,Z=L.length;N<Z;N++)L[N]=0}function v(L){_(L,0)}function _(L,N){const Z=s.newAttributes,K=s.enabledAttributes,ne=s.attributeDivisors;Z[L]=1,K[L]===0&&(n.enableVertexAttribArray(L),K[L]=1),ne[L]!==N&&(n.vertexAttribDivisor(L,N),ne[L]=N)}function b(){const L=s.newAttributes,N=s.enabledAttributes;for(let Z=0,K=N.length;Z<K;Z++)N[Z]!==L[Z]&&(n.disableVertexAttribArray(Z),N[Z]=0)}function M(L,N,Z,K,ne,ce,J){J===!0?n.vertexAttribIPointer(L,N,Z,ne,ce):n.vertexAttribPointer(L,N,Z,K,ne,ce)}function E(L,N,Z,K){x();const ne=K.attributes,ce=Z.getAttributes(),J=N.defaultAttributeValues;for(const oe in ce){const B=ce[oe];if(B.location>=0){let xe=ne[oe];if(xe===void 0&&(oe==="instanceMatrix"&&L.instanceMatrix&&(xe=L.instanceMatrix),oe==="instanceColor"&&L.instanceColor&&(xe=L.instanceColor)),xe!==void 0){const U=xe.normalized,$=xe.itemSize,pe=e.get(xe);if(pe===void 0)continue;const Se=pe.buffer,be=pe.type,V=pe.bytesPerElement,te=be===n.INT||be===n.UNSIGNED_INT||xe.gpuType===vd;if(xe.isInterleavedBufferAttribute){const W=xe.data,ue=W.stride,ye=xe.offset;if(W.isInstancedInterleavedBuffer){for(let Q=0;Q<B.locationSize;Q++)_(B.location+Q,W.meshPerAttribute);L.isInstancedMesh!==!0&&K._maxInstanceCount===void 0&&(K._maxInstanceCount=W.meshPerAttribute*W.count)}else for(let Q=0;Q<B.locationSize;Q++)v(B.location+Q);n.bindBuffer(n.ARRAY_BUFFER,Se);for(let Q=0;Q<B.locationSize;Q++)M(B.location+Q,$/B.locationSize,be,U,ue*V,(ye+$/B.locationSize*Q)*V,te)}else{if(xe.isInstancedBufferAttribute){for(let W=0;W<B.locationSize;W++)_(B.location+W,xe.meshPerAttribute);L.isInstancedMesh!==!0&&K._maxInstanceCount===void 0&&(K._maxInstanceCount=xe.meshPerAttribute*xe.count)}else for(let W=0;W<B.locationSize;W++)v(B.location+W);n.bindBuffer(n.ARRAY_BUFFER,Se);for(let W=0;W<B.locationSize;W++)M(B.location+W,$/B.locationSize,be,U,$*V,$/B.locationSize*W*V,te)}}else if(J!==void 0){const U=J[oe];if(U!==void 0)switch(U.length){case 2:n.vertexAttrib2fv(B.location,U);break;case 3:n.vertexAttrib3fv(B.location,U);break;case 4:n.vertexAttrib4fv(B.location,U);break;default:n.vertexAttrib1fv(B.location,U)}}}}b()}function S(){O();for(const L in r){const N=r[L];for(const Z in N){const K=N[Z];for(const ne in K)h(K[ne].object),delete K[ne];delete N[Z]}delete r[L]}}function T(L){if(r[L.id]===void 0)return;const N=r[L.id];for(const Z in N){const K=N[Z];for(const ne in K)h(K[ne].object),delete K[ne];delete N[Z]}delete r[L.id]}function q(L){for(const N in r){const Z=r[N];if(Z[L.id]===void 0)continue;const K=Z[L.id];for(const ne in K)h(K[ne].object),delete K[ne];delete Z[L.id]}}function O(){A(),o=!0,s!==i&&(s=i,c(s.object))}function A(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:O,resetDefaultState:A,dispose:S,releaseStatesOfGeometry:T,releaseStatesOfProgram:q,initAttributes:x,enableAttribute:v,disableUnusedAttributes:b}}function v5(n,e,t){let r;function i(c){r=c}function s(c,h){n.drawArrays(r,c,h),t.update(h,r,1)}function o(c,h,f){f!==0&&(n.drawArraysInstanced(r,c,h,f),t.update(h,r,f))}function a(c,h,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,c,0,h,0,f);let d=0;for(let m=0;m<f;m++)d+=h[m];t.update(d,r,1)}function l(c,h,f,p){if(f===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let m=0;m<c.length;m++)o(c[m],h[m],p[m]);else{d.multiDrawArraysInstancedWEBGL(r,c,0,h,0,p,0,f);let m=0;for(let x=0;x<f;x++)m+=h[x]*p[x];t.update(m,r,1)}}this.setMode=i,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function x5(n,e,t,r){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const q=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(q.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(q){return!(q!==$r&&r.convert(q)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(q){const O=q===ol&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(q!==Ei&&r.convert(q)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&q!==Fi&&!O)}function l(q){if(q==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";q="mediump"}return q==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const f=t.logarithmicDepthBuffer===!0,p=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),d=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=n.getParameter(n.MAX_TEXTURE_SIZE),v=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),_=n.getParameter(n.MAX_VERTEX_ATTRIBS),b=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),M=n.getParameter(n.MAX_VARYING_VECTORS),E=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),S=m>0,T=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:p,maxTextures:d,maxVertexTextures:m,maxTextureSize:x,maxCubemapSize:v,maxAttributes:_,maxVertexUniforms:b,maxVaryings:M,maxFragmentUniforms:E,vertexTextures:S,maxSamples:T}}function y5(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new ys,a=new pt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){const d=f.length!==0||p||r!==0||i;return i=p,r=f.length,d},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){t=h(f,p,0)},this.setState=function(f,p,d){const m=f.clippingPlanes,x=f.clipIntersection,v=f.clipShadows,_=n.get(f);if(!i||m===null||m.length===0||s&&!v)s?h(null):c();else{const b=s?0:r,M=b*4;let E=_.clippingState||null;l.value=E,E=h(m,p,M,d);for(let S=0;S!==M;++S)E[S]=t[S];_.clippingState=E,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function h(f,p,d,m){const x=f!==null?f.length:0;let v=null;if(x!==0){if(v=l.value,m!==!0||v===null){const _=d+x*4,b=p.matrixWorldInverse;a.getNormalMatrix(b),(v===null||v.length<_)&&(v=new Float32Array(_));for(let M=0,E=d;M!==x;++M,E+=4)o.copy(f[M]).applyMatrix4(b,a),o.normal.toArray(v,E),v[E+3]=o.constant}l.value=v,l.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,v}}function S5(n){let e=new WeakMap;function t(o,a){return a===pd?o.mapping=Fo:a===md&&(o.mapping=zo),o}function r(o){if(o&&o.isTexture){const a=o.mapping;if(a===pd||a===md)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new hM(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}const la=4,sv=[.125,.215,.35,.446,.526,.582],to=20,Np=new J_,ov=new St;let Up=null,Fp=0,zp=0,kp=!1;const no=(1+Math.sqrt(5))/2,ca=1/no,av=[new G(-no,ca,0),new G(no,ca,0),new G(-ca,0,no),new G(ca,0,no),new G(0,no,-ca),new G(0,no,ca),new G(-1,1,-1),new G(1,1,-1),new G(-1,1,1),new G(1,1,1)],E5=new G;class lv{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,i=100,s={}){const{size:o=256,position:a=E5}=s;Up=this._renderer.getRenderTarget(),Fp=this._renderer.getActiveCubeFace(),zp=this._renderer.getActiveMipmapLevel(),kp=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,r,i,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=hv(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=uv(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Up,Fp,zp),this._renderer.xr.enabled=kp,e.scissorTest=!1,Ru(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Fo||e.mapping===zo?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Up=this._renderer.getRenderTarget(),Fp=this._renderer.getActiveCubeFace(),zp=this._renderer.getActiveMipmapLevel(),kp=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=t||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,r={magFilter:Si,minFilter:Si,generateMipmaps:!1,type:ol,format:$r,colorSpace:ko,depthBuffer:!1},i=cv(e,t,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=cv(e,t,r);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=b5(s)),this._blurMaterial=M5(s,e,t)}return i}_compileMaterial(e){const t=new Tn(this._lodPlanes[0],e);this._renderer.compile(t,Np)}_sceneToCubeUV(e,t,r,i,s){const l=new _r(90,1,t,r),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],f=this._renderer,p=f.autoClear,d=f.toneMapping;f.getClearColor(ov),f.toneMapping=us,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(i),f.clearDepth(),f.setRenderTarget(null));const x=new Ys({name:"PMREM.Background",side:Qn,depthWrite:!1,depthTest:!1}),v=new Tn(new Zs,x);let _=!1;const b=e.background;b?b.isColor&&(x.color.copy(b),e.background=null,_=!0):(x.color.copy(ov),_=!0);for(let M=0;M<6;M++){const E=M%3;E===0?(l.up.set(0,c[M],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+h[M],s.y,s.z)):E===1?(l.up.set(0,0,c[M]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+h[M],s.z)):(l.up.set(0,c[M],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+h[M]));const S=this._cubeSize;Ru(i,E*S,M>2?S:0,S,S),f.setRenderTarget(i),_&&f.render(v,l),f.render(e,l)}v.geometry.dispose(),v.material.dispose(),f.toneMapping=d,f.autoClear=p,e.background=b}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===Fo||e.mapping===zo;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=hv()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=uv());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new Tn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Ru(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,Np)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=av[(i-s-1)%av.length];this._blur(e,s-1,s,o,a)}t.autoClear=r}_blur(e,t,r,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,r,i,"latitudinal",s),this._halfBlur(o,e,r,r,i,"longitudinal",s)}_halfBlur(e,t,r,i,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,f=new Tn(this._lodPlanes[i],c),p=c.uniforms,d=this._sizeLods[r]-1,m=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*to-1),x=s/m,v=isFinite(s)?1+Math.floor(h*x):to;v>to&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${to}`);const _=[];let b=0;for(let q=0;q<to;++q){const O=q/x,A=Math.exp(-O*O/2);_.push(A),q===0?b+=A:q<v&&(b+=2*A)}for(let q=0;q<_.length;q++)_[q]=_[q]/b;p.envMap.value=e.texture,p.samples.value=v,p.weights.value=_,p.latitudinal.value=o==="latitudinal",a&&(p.poleAxis.value=a);const{_lodMax:M}=this;p.dTheta.value=m,p.mipInt.value=M-r;const E=this._sizeLods[i],S=3*E*(i>M-la?i-M+la:0),T=4*(this._cubeSize-E);Ru(t,S,T,3*E,2*E),l.setRenderTarget(t),l.render(f,Np)}}function b5(n){const e=[],t=[],r=[];let i=n;const s=n-la+1+sv.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);t.push(a);let l=1/a;o>n-la?l=sv[o-n+la-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),h=-c,f=1+c,p=[h,h,f,h,f,f,h,h,f,f,h,f],d=6,m=6,x=3,v=2,_=1,b=new Float32Array(x*m*d),M=new Float32Array(v*m*d),E=new Float32Array(_*m*d);for(let T=0;T<d;T++){const q=T%3*2/3-1,O=T>2?0:-1,A=[q,O,0,q+2/3,O,0,q+2/3,O+1,0,q,O,0,q+2/3,O+1,0,q,O+1,0];b.set(A,x*m*T),M.set(p,v*m*T);const L=[T,T,T,T,T,T];E.set(L,_*m*T)}const S=new tr;S.setAttribute("position",new Pr(b,x)),S.setAttribute("uv",new Pr(M,v)),S.setAttribute("faceIndex",new Pr(E,_)),e.push(S),i>la&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function cv(n,e,t){const r=new Ws(n,e,t);return r.texture.mapping=kc,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Ru(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function M5(n,e,t){const r=new Float32Array(to),i=new G(0,1,0);return new vs({name:"SphericalGaussianBlur",defines:{n:to,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Bp(),fragmentShader:`
3665
3657
 
3666
3658
  precision mediump float;
3667
3659
  precision mediump int;
@@ -3721,7 +3713,7 @@ void main() {
3721
3713
  }
3722
3714
 
3723
3715
  }
3724
- `,blending:_s,depthTest:!1,depthWrite:!1})}function uv(){return new Ts({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Bp(),fragmentShader:`
3716
+ `,blending:cs,depthTest:!1,depthWrite:!1})}function uv(){return new vs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Bp(),fragmentShader:`
3725
3717
 
3726
3718
  precision mediump float;
3727
3719
  precision mediump int;
@@ -3740,7 +3732,7 @@ void main() {
3740
3732
  gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3741
3733
 
3742
3734
  }
3743
- `,blending:_s,depthTest:!1,depthWrite:!1})}function hv(){return new Ts({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Bp(),fragmentShader:`
3735
+ `,blending:cs,depthTest:!1,depthWrite:!1})}function hv(){return new vs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Bp(),fragmentShader:`
3744
3736
 
3745
3737
  precision mediump float;
3746
3738
  precision mediump int;
@@ -3756,7 +3748,7 @@ void main() {
3756
3748
  gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3757
3749
 
3758
3750
  }
3759
- `,blending:_s,depthTest:!1,depthWrite:!1})}function Bp(){return`
3751
+ `,blending:cs,depthTest:!1,depthWrite:!1})}function Bp(){return`
3760
3752
 
3761
3753
  precision mediump float;
3762
3754
  precision mediump int;
@@ -3811,17 +3803,17 @@ void main() {
3811
3803
  gl_Position = vec4( position, 1.0 );
3812
3804
 
3813
3805
  }
3814
- `}function w5(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===pd||l===md,h=l===$o||l===Yo;if(c||h){let f=e.get(a);const p=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==p)return t===null&&(t=new lv(n)),f=c?t.fromEquirectangular(a,f):t.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const d=a.image;return c&&d&&d.height>0||h&&d&&i(d)?(t===null&&(t=new lv(n)),f=c?t.fromEquirectangular(a):t.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function i(a){let l=0;const c=6;for(let h=0;h<c;h++)a[h]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:r,dispose:o}}function T5(n){const e={};function t(r){if(e[r]!==void 0)return e[r];let i;switch(r){case"WEBGL_depth_texture":i=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=n.getExtension(r)}return e[r]=i,i}return{has:function(r){return t(r)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(r){const i=t(r);return i===null&&Qo("THREE.WebGLRenderer: "+r+" extension not supported."),i}}}function A5(n,e,t,r){const i={},s=new WeakMap;function o(f){const p=f.target;p.index!==null&&e.remove(p.index);for(const m in p.attributes)e.remove(p.attributes[m]);p.removeEventListener("dispose",o),delete i[p.id];const d=s.get(p);d&&(e.remove(d),s.delete(p)),r.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function a(f,p){return i[p.id]===!0||(p.addEventListener("dispose",o),i[p.id]=!0,t.memory.geometries++),p}function l(f){const p=f.attributes;for(const d in p)e.update(p[d],n.ARRAY_BUFFER)}function c(f){const p=[],d=f.index,m=f.attributes.position;let x=0;if(d!==null){const E=d.array;x=d.version;for(let M=0,b=E.length;M<b;M+=3){const S=E[M+0],T=E[M+1],q=E[M+2];p.push(S,T,T,q,q,S)}}else if(m!==void 0){const E=m.array;x=m.version;for(let M=0,b=E.length/3-1;M<b;M+=3){const S=M+0,T=M+1,q=M+2;p.push(S,T,T,q,q,S)}}else return;const v=new(s_(p)?y_:x_)(p,1);v.version=x;const _=s.get(f);_&&e.remove(_),s.set(f,v)}function h(f){const p=s.get(f);if(p){const d=f.index;d!==null&&p.version<d.version&&c(f)}else c(f);return s.get(f)}return{get:a,update:l,getWireframeAttribute:h}}function C5(n,e,t){let r;function i(p){r=p}let s,o;function a(p){s=p.type,o=p.bytesPerElement}function l(p,d){n.drawElements(r,d,s,p*o),t.update(d,r,1)}function c(p,d,m){m!==0&&(n.drawElementsInstanced(r,d,s,p*o,m),t.update(d,r,m))}function h(p,d,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,d,0,s,p,0,m);let v=0;for(let _=0;_<m;_++)v+=d[_];t.update(v,r,1)}function f(p,d,m,x){if(m===0)return;const v=e.get("WEBGL_multi_draw");if(v===null)for(let _=0;_<p.length;_++)c(p[_]/o,d[_],x[_]);else{v.multiDrawElementsInstancedWEBGL(r,d,0,s,p,0,x,0,m);let _=0;for(let E=0;E<m;E++)_+=d[E]*x[E];t.update(_,r,1)}}this.setMode=i,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=f}function R5(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,o,a){switch(t.calls++,o){case n.TRIANGLES:t.triangles+=a*(s/3);break;case n.LINES:t.lines+=a*(s/2);break;case n.LINE_STRIP:t.lines+=a*(s-1);break;case n.LINE_LOOP:t.lines+=a*s;break;case n.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:r}}function P5(n,e,t){const r=new WeakMap,i=new pn;function s(o,a,l){const c=o.morphTargetInfluences,h=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=h!==void 0?h.length:0;let p=r.get(a);if(p===void 0||p.count!==f){let A=function(){q.dispose(),r.delete(a),a.removeEventListener("dispose",A)};p!==void 0&&p.texture.dispose();const d=a.morphAttributes.position!==void 0,m=a.morphAttributes.normal!==void 0,x=a.morphAttributes.color!==void 0,v=a.morphAttributes.position||[],_=a.morphAttributes.normal||[],E=a.morphAttributes.color||[];let M=0;d===!0&&(M=1),m===!0&&(M=2),x===!0&&(M=3);let b=a.attributes.position.count*M,S=1;b>e.maxTextureSize&&(S=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);const T=new Float32Array(b*S*4*f),q=new c_(T,b,S,f);q.type=ji,q.needsUpdate=!0;const O=M*4;for(let L=0;L<f;L++){const N=v[L],Z=_[L],Y=E[L],ee=b*S*4*L;for(let ue=0;ue<N.count;ue++){const te=ue*O;d===!0&&(i.fromBufferAttribute(N,ue),T[ee+te+0]=i.x,T[ee+te+1]=i.y,T[ee+te+2]=i.z,T[ee+te+3]=0),m===!0&&(i.fromBufferAttribute(Z,ue),T[ee+te+4]=i.x,T[ee+te+5]=i.y,T[ee+te+6]=i.z,T[ee+te+7]=0),x===!0&&(i.fromBufferAttribute(Y,ue),T[ee+te+8]=i.x,T[ee+te+9]=i.y,T[ee+te+10]=i.z,T[ee+te+11]=Y.itemSize===4?i.w:1)}}p={count:f,texture:q,size:new Be(b,S)},r.set(a,p),a.addEventListener("dispose",A)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",o.morphTexture,t);else{let d=0;for(let x=0;x<c.length;x++)d+=c[x];const m=a.morphTargetsRelative?1:1-d;l.getUniforms().setValue(n,"morphTargetBaseInfluence",m),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",p.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",p.size)}return{update:s}}function I5(n,e,t,r){let i=new WeakMap;function s(l){const c=r.render.frame,h=l.geometry,f=e.get(l,h);if(i.get(f)!==c&&(e.update(f),i.set(f,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),i.get(l)!==c&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const p=l.skeleton;i.get(p)!==c&&(p.update(),i.set(p,c))}return f}function o(){i=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}const fv=new Gn,dv=new q_(1,1),pv=new c_,mv=new $b,gv=new C_,_v=[],vv=[],xv=new Float32Array(16),yv=new Float32Array(9),Sv=new Float32Array(4);function ya(n,e,t){const r=n[0];if(r<=0||r>0)return n;const i=e*t;let s=_v[i];if(s===void 0&&(s=new Float32Array(i),_v[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function An(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t<r;t++)if(n[t]!==e[t])return!1;return!0}function Cn(n,e){for(let t=0,r=e.length;t<r;t++)n[t]=e[t]}function Du(n,e){let t=vv[e];t===void 0&&(t=new Int32Array(e),vv[e]=t);for(let r=0;r!==e;++r)t[r]=n.allocateTextureUnit();return t}function L5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function O5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(An(t,e))return;n.uniform2fv(this.addr,e),Cn(t,e)}}function q5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(An(t,e))return;n.uniform3fv(this.addr,e),Cn(t,e)}}function D5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(An(t,e))return;n.uniform4fv(this.addr,e),Cn(t,e)}}function N5(n,e){const t=this.cache,r=e.elements;if(r===void 0){if(An(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),Cn(t,e)}else{if(An(t,r))return;Sv.set(r),n.uniformMatrix2fv(this.addr,!1,Sv),Cn(t,r)}}function U5(n,e){const t=this.cache,r=e.elements;if(r===void 0){if(An(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),Cn(t,e)}else{if(An(t,r))return;yv.set(r),n.uniformMatrix3fv(this.addr,!1,yv),Cn(t,r)}}function F5(n,e){const t=this.cache,r=e.elements;if(r===void 0){if(An(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),Cn(t,e)}else{if(An(t,r))return;xv.set(r),n.uniformMatrix4fv(this.addr,!1,xv),Cn(t,r)}}function z5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function k5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(An(t,e))return;n.uniform2iv(this.addr,e),Cn(t,e)}}function B5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(An(t,e))return;n.uniform3iv(this.addr,e),Cn(t,e)}}function V5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(An(t,e))return;n.uniform4iv(this.addr,e),Cn(t,e)}}function H5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function G5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(An(t,e))return;n.uniform2uiv(this.addr,e),Cn(t,e)}}function W5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(An(t,e))return;n.uniform3uiv(this.addr,e),Cn(t,e)}}function j5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(An(t,e))return;n.uniform4uiv(this.addr,e),Cn(t,e)}}function X5(n,e,t){const r=this.cache,i=t.allocateTextureUnit();r[0]!==i&&(n.uniform1i(this.addr,i),r[0]=i);let s;this.type===n.SAMPLER_2D_SHADOW?(dv.compareFunction=t_,s=dv):s=fv,t.setTexture2D(e||s,i)}function $5(n,e,t){const r=this.cache,i=t.allocateTextureUnit();r[0]!==i&&(n.uniform1i(this.addr,i),r[0]=i),t.setTexture3D(e||mv,i)}function Y5(n,e,t){const r=this.cache,i=t.allocateTextureUnit();r[0]!==i&&(n.uniform1i(this.addr,i),r[0]=i),t.setTextureCube(e||gv,i)}function K5(n,e,t){const r=this.cache,i=t.allocateTextureUnit();r[0]!==i&&(n.uniform1i(this.addr,i),r[0]=i),t.setTexture2DArray(e||pv,i)}function Z5(n){switch(n){case 5126:return L5;case 35664:return O5;case 35665:return q5;case 35666:return D5;case 35674:return N5;case 35675:return U5;case 35676:return F5;case 5124:case 35670:return z5;case 35667:case 35671:return k5;case 35668:case 35672:return B5;case 35669:case 35673:return V5;case 5125:return H5;case 36294:return G5;case 36295:return W5;case 36296:return j5;case 35678:case 36198:case 36298:case 36306:case 35682:return X5;case 35679:case 36299:case 36307:return $5;case 35680:case 36300:case 36308:case 36293:return Y5;case 36289:case 36303:case 36311:case 36292:return K5}}function J5(n,e){n.uniform1fv(this.addr,e)}function Q5(n,e){const t=ya(e,this.size,2);n.uniform2fv(this.addr,t)}function eT(n,e){const t=ya(e,this.size,3);n.uniform3fv(this.addr,t)}function tT(n,e){const t=ya(e,this.size,4);n.uniform4fv(this.addr,t)}function nT(n,e){const t=ya(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function rT(n,e){const t=ya(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function iT(n,e){const t=ya(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function sT(n,e){n.uniform1iv(this.addr,e)}function oT(n,e){n.uniform2iv(this.addr,e)}function aT(n,e){n.uniform3iv(this.addr,e)}function lT(n,e){n.uniform4iv(this.addr,e)}function cT(n,e){n.uniform1uiv(this.addr,e)}function uT(n,e){n.uniform2uiv(this.addr,e)}function hT(n,e){n.uniform3uiv(this.addr,e)}function fT(n,e){n.uniform4uiv(this.addr,e)}function dT(n,e,t){const r=this.cache,i=e.length,s=Du(t,i);An(r,s)||(n.uniform1iv(this.addr,s),Cn(r,s));for(let o=0;o!==i;++o)t.setTexture2D(e[o]||fv,s[o])}function pT(n,e,t){const r=this.cache,i=e.length,s=Du(t,i);An(r,s)||(n.uniform1iv(this.addr,s),Cn(r,s));for(let o=0;o!==i;++o)t.setTexture3D(e[o]||mv,s[o])}function mT(n,e,t){const r=this.cache,i=e.length,s=Du(t,i);An(r,s)||(n.uniform1iv(this.addr,s),Cn(r,s));for(let o=0;o!==i;++o)t.setTextureCube(e[o]||gv,s[o])}function gT(n,e,t){const r=this.cache,i=e.length,s=Du(t,i);An(r,s)||(n.uniform1iv(this.addr,s),Cn(r,s));for(let o=0;o!==i;++o)t.setTexture2DArray(e[o]||pv,s[o])}function _T(n){switch(n){case 5126:return J5;case 35664:return Q5;case 35665:return eT;case 35666:return tT;case 35674:return nT;case 35675:return rT;case 35676:return iT;case 5124:case 35670:return sT;case 35667:case 35671:return oT;case 35668:case 35672:return aT;case 35669:case 35673:return lT;case 5125:return cT;case 36294:return uT;case 36295:return hT;case 36296:return fT;case 35678:case 36198:case 36298:case 36306:case 35682:return dT;case 35679:case 36299:case 36307:return pT;case 35680:case 36300:case 36308:case 36293:return mT;case 36289:case 36303:case 36311:case 36292:return gT}}class vT{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.setValue=Z5(t.type)}}class xT{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=_T(t.type)}}class yT{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,r){const i=this.seq;for(let s=0,o=i.length;s!==o;++s){const a=i[s];a.setValue(e,t[a.id],r)}}}const Vp=/(\w+)(\])?(\[|\.)?/g;function Ev(n,e){n.seq.push(e),n.map[e.id]=e}function ST(n,e,t){const r=n.name,i=r.length;for(Vp.lastIndex=0;;){const s=Vp.exec(r),o=Vp.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){Ev(t,c===void 0?new vT(a,n,e):new xT(a,n,e));break}else{let f=t.map[a];f===void 0&&(f=new yT(a),Ev(t,f)),t=f}}}class Nu{constructor(e,t){this.seq=[],this.map={};const r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<r;++i){const s=e.getActiveUniform(t,i),o=e.getUniformLocation(t,s.name);ST(s,o,this)}}setValue(e,t,r,i){const s=this.map[t];s!==void 0&&s.setValue(e,r,i)}setOptional(e,t,r){const i=t[r];i!==void 0&&this.setValue(e,r,i)}static upload(e,t,r,i){for(let s=0,o=t.length;s!==o;++s){const a=t[s],l=r[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,i)}}static seqWithValue(e,t){const r=[];for(let i=0,s=e.length;i!==s;++i){const o=e[i];o.id in t&&r.push(o)}return r}}function bv(n,e,t){const r=n.createShader(e);return n.shaderSource(r,t),n.compileShader(r),r}const ET=37297;let bT=0;function MT(n,e){const t=n.split(`
3806
+ `}function w5(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===pd||l===md,h=l===Fo||l===zo;if(c||h){let f=e.get(a);const p=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==p)return t===null&&(t=new lv(n)),f=c?t.fromEquirectangular(a,f):t.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const d=a.image;return c&&d&&d.height>0||h&&d&&i(d)?(t===null&&(t=new lv(n)),f=c?t.fromEquirectangular(a):t.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function i(a){let l=0;const c=6;for(let h=0;h<c;h++)a[h]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:r,dispose:o}}function T5(n){const e={};function t(r){if(e[r]!==void 0)return e[r];let i;switch(r){case"WEBGL_depth_texture":i=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=n.getExtension(r)}return e[r]=i,i}return{has:function(r){return t(r)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(r){const i=t(r);return i===null&&Ho("THREE.WebGLRenderer: "+r+" extension not supported."),i}}}function A5(n,e,t,r){const i={},s=new WeakMap;function o(f){const p=f.target;p.index!==null&&e.remove(p.index);for(const m in p.attributes)e.remove(p.attributes[m]);p.removeEventListener("dispose",o),delete i[p.id];const d=s.get(p);d&&(e.remove(d),s.delete(p)),r.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function a(f,p){return i[p.id]===!0||(p.addEventListener("dispose",o),i[p.id]=!0,t.memory.geometries++),p}function l(f){const p=f.attributes;for(const d in p)e.update(p[d],n.ARRAY_BUFFER)}function c(f){const p=[],d=f.index,m=f.attributes.position;let x=0;if(d!==null){const b=d.array;x=d.version;for(let M=0,E=b.length;M<E;M+=3){const S=b[M+0],T=b[M+1],q=b[M+2];p.push(S,T,T,q,q,S)}}else if(m!==void 0){const b=m.array;x=m.version;for(let M=0,E=b.length/3-1;M<E;M+=3){const S=M+0,T=M+1,q=M+2;p.push(S,T,T,q,q,S)}}else return;const v=new(s_(p)?y_:x_)(p,1);v.version=x;const _=s.get(f);_&&e.remove(_),s.set(f,v)}function h(f){const p=s.get(f);if(p){const d=f.index;d!==null&&p.version<d.version&&c(f)}else c(f);return s.get(f)}return{get:a,update:l,getWireframeAttribute:h}}function C5(n,e,t){let r;function i(p){r=p}let s,o;function a(p){s=p.type,o=p.bytesPerElement}function l(p,d){n.drawElements(r,d,s,p*o),t.update(d,r,1)}function c(p,d,m){m!==0&&(n.drawElementsInstanced(r,d,s,p*o,m),t.update(d,r,m))}function h(p,d,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,d,0,s,p,0,m);let v=0;for(let _=0;_<m;_++)v+=d[_];t.update(v,r,1)}function f(p,d,m,x){if(m===0)return;const v=e.get("WEBGL_multi_draw");if(v===null)for(let _=0;_<p.length;_++)c(p[_]/o,d[_],x[_]);else{v.multiDrawElementsInstancedWEBGL(r,d,0,s,p,0,x,0,m);let _=0;for(let b=0;b<m;b++)_+=d[b]*x[b];t.update(_,r,1)}}this.setMode=i,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=f}function R5(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,o,a){switch(t.calls++,o){case n.TRIANGLES:t.triangles+=a*(s/3);break;case n.LINES:t.lines+=a*(s/2);break;case n.LINE_STRIP:t.lines+=a*(s-1);break;case n.LINE_LOOP:t.lines+=a*s;break;case n.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:r}}function P5(n,e,t){const r=new WeakMap,i=new on;function s(o,a,l){const c=o.morphTargetInfluences,h=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=h!==void 0?h.length:0;let p=r.get(a);if(p===void 0||p.count!==f){let A=function(){q.dispose(),r.delete(a),a.removeEventListener("dispose",A)};p!==void 0&&p.texture.dispose();const d=a.morphAttributes.position!==void 0,m=a.morphAttributes.normal!==void 0,x=a.morphAttributes.color!==void 0,v=a.morphAttributes.position||[],_=a.morphAttributes.normal||[],b=a.morphAttributes.color||[];let M=0;d===!0&&(M=1),m===!0&&(M=2),x===!0&&(M=3);let E=a.attributes.position.count*M,S=1;E>e.maxTextureSize&&(S=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const T=new Float32Array(E*S*4*f),q=new c_(T,E,S,f);q.type=Fi,q.needsUpdate=!0;const O=M*4;for(let L=0;L<f;L++){const N=v[L],Z=_[L],K=b[L],ne=E*S*4*L;for(let ce=0;ce<N.count;ce++){const J=ce*O;d===!0&&(i.fromBufferAttribute(N,ce),T[ne+J+0]=i.x,T[ne+J+1]=i.y,T[ne+J+2]=i.z,T[ne+J+3]=0),m===!0&&(i.fromBufferAttribute(Z,ce),T[ne+J+4]=i.x,T[ne+J+5]=i.y,T[ne+J+6]=i.z,T[ne+J+7]=0),x===!0&&(i.fromBufferAttribute(K,ce),T[ne+J+8]=i.x,T[ne+J+9]=i.y,T[ne+J+10]=i.z,T[ne+J+11]=K.itemSize===4?i.w:1)}}p={count:f,texture:q,size:new Fe(E,S)},r.set(a,p),a.addEventListener("dispose",A)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",o.morphTexture,t);else{let d=0;for(let x=0;x<c.length;x++)d+=c[x];const m=a.morphTargetsRelative?1:1-d;l.getUniforms().setValue(n,"morphTargetBaseInfluence",m),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",p.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",p.size)}return{update:s}}function I5(n,e,t,r){let i=new WeakMap;function s(l){const c=r.render.frame,h=l.geometry,f=e.get(l,h);if(i.get(f)!==c&&(e.update(f),i.set(f,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),i.get(l)!==c&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const p=l.skeleton;i.get(p)!==c&&(p.update(),i.set(p,c))}return f}function o(){i=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}const fv=new Dn,dv=new q_(1,1),pv=new c_,mv=new $b,gv=new C_,_v=[],vv=[],xv=new Float32Array(16),yv=new Float32Array(9),Sv=new Float32Array(4);function ua(n,e,t){const r=n[0];if(r<=0||r>0)return n;const i=e*t;let s=_v[i];if(s===void 0&&(s=new Float32Array(i),_v[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function vn(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t<r;t++)if(n[t]!==e[t])return!1;return!0}function xn(n,e){for(let t=0,r=e.length;t<r;t++)n[t]=e[t]}function Pu(n,e){let t=vv[e];t===void 0&&(t=new Int32Array(e),vv[e]=t);for(let r=0;r!==e;++r)t[r]=n.allocateTextureUnit();return t}function L5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function O5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(vn(t,e))return;n.uniform2fv(this.addr,e),xn(t,e)}}function q5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(vn(t,e))return;n.uniform3fv(this.addr,e),xn(t,e)}}function D5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(vn(t,e))return;n.uniform4fv(this.addr,e),xn(t,e)}}function N5(n,e){const t=this.cache,r=e.elements;if(r===void 0){if(vn(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),xn(t,e)}else{if(vn(t,r))return;Sv.set(r),n.uniformMatrix2fv(this.addr,!1,Sv),xn(t,r)}}function U5(n,e){const t=this.cache,r=e.elements;if(r===void 0){if(vn(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),xn(t,e)}else{if(vn(t,r))return;yv.set(r),n.uniformMatrix3fv(this.addr,!1,yv),xn(t,r)}}function F5(n,e){const t=this.cache,r=e.elements;if(r===void 0){if(vn(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),xn(t,e)}else{if(vn(t,r))return;xv.set(r),n.uniformMatrix4fv(this.addr,!1,xv),xn(t,r)}}function z5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function k5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(vn(t,e))return;n.uniform2iv(this.addr,e),xn(t,e)}}function B5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(vn(t,e))return;n.uniform3iv(this.addr,e),xn(t,e)}}function V5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(vn(t,e))return;n.uniform4iv(this.addr,e),xn(t,e)}}function H5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function G5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(vn(t,e))return;n.uniform2uiv(this.addr,e),xn(t,e)}}function W5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(vn(t,e))return;n.uniform3uiv(this.addr,e),xn(t,e)}}function j5(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(vn(t,e))return;n.uniform4uiv(this.addr,e),xn(t,e)}}function X5(n,e,t){const r=this.cache,i=t.allocateTextureUnit();r[0]!==i&&(n.uniform1i(this.addr,i),r[0]=i);let s;this.type===n.SAMPLER_2D_SHADOW?(dv.compareFunction=t_,s=dv):s=fv,t.setTexture2D(e||s,i)}function $5(n,e,t){const r=this.cache,i=t.allocateTextureUnit();r[0]!==i&&(n.uniform1i(this.addr,i),r[0]=i),t.setTexture3D(e||mv,i)}function Y5(n,e,t){const r=this.cache,i=t.allocateTextureUnit();r[0]!==i&&(n.uniform1i(this.addr,i),r[0]=i),t.setTextureCube(e||gv,i)}function K5(n,e,t){const r=this.cache,i=t.allocateTextureUnit();r[0]!==i&&(n.uniform1i(this.addr,i),r[0]=i),t.setTexture2DArray(e||pv,i)}function Z5(n){switch(n){case 5126:return L5;case 35664:return O5;case 35665:return q5;case 35666:return D5;case 35674:return N5;case 35675:return U5;case 35676:return F5;case 5124:case 35670:return z5;case 35667:case 35671:return k5;case 35668:case 35672:return B5;case 35669:case 35673:return V5;case 5125:return H5;case 36294:return G5;case 36295:return W5;case 36296:return j5;case 35678:case 36198:case 36298:case 36306:case 35682:return X5;case 35679:case 36299:case 36307:return $5;case 35680:case 36300:case 36308:case 36293:return Y5;case 36289:case 36303:case 36311:case 36292:return K5}}function J5(n,e){n.uniform1fv(this.addr,e)}function Q5(n,e){const t=ua(e,this.size,2);n.uniform2fv(this.addr,t)}function eT(n,e){const t=ua(e,this.size,3);n.uniform3fv(this.addr,t)}function tT(n,e){const t=ua(e,this.size,4);n.uniform4fv(this.addr,t)}function nT(n,e){const t=ua(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function rT(n,e){const t=ua(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function iT(n,e){const t=ua(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function sT(n,e){n.uniform1iv(this.addr,e)}function oT(n,e){n.uniform2iv(this.addr,e)}function aT(n,e){n.uniform3iv(this.addr,e)}function lT(n,e){n.uniform4iv(this.addr,e)}function cT(n,e){n.uniform1uiv(this.addr,e)}function uT(n,e){n.uniform2uiv(this.addr,e)}function hT(n,e){n.uniform3uiv(this.addr,e)}function fT(n,e){n.uniform4uiv(this.addr,e)}function dT(n,e,t){const r=this.cache,i=e.length,s=Pu(t,i);vn(r,s)||(n.uniform1iv(this.addr,s),xn(r,s));for(let o=0;o!==i;++o)t.setTexture2D(e[o]||fv,s[o])}function pT(n,e,t){const r=this.cache,i=e.length,s=Pu(t,i);vn(r,s)||(n.uniform1iv(this.addr,s),xn(r,s));for(let o=0;o!==i;++o)t.setTexture3D(e[o]||mv,s[o])}function mT(n,e,t){const r=this.cache,i=e.length,s=Pu(t,i);vn(r,s)||(n.uniform1iv(this.addr,s),xn(r,s));for(let o=0;o!==i;++o)t.setTextureCube(e[o]||gv,s[o])}function gT(n,e,t){const r=this.cache,i=e.length,s=Pu(t,i);vn(r,s)||(n.uniform1iv(this.addr,s),xn(r,s));for(let o=0;o!==i;++o)t.setTexture2DArray(e[o]||pv,s[o])}function _T(n){switch(n){case 5126:return J5;case 35664:return Q5;case 35665:return eT;case 35666:return tT;case 35674:return nT;case 35675:return rT;case 35676:return iT;case 5124:case 35670:return sT;case 35667:case 35671:return oT;case 35668:case 35672:return aT;case 35669:case 35673:return lT;case 5125:return cT;case 36294:return uT;case 36295:return hT;case 36296:return fT;case 35678:case 36198:case 36298:case 36306:case 35682:return dT;case 35679:case 36299:case 36307:return pT;case 35680:case 36300:case 36308:case 36293:return mT;case 36289:case 36303:case 36311:case 36292:return gT}}class vT{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.setValue=Z5(t.type)}}class xT{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=_T(t.type)}}class yT{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,r){const i=this.seq;for(let s=0,o=i.length;s!==o;++s){const a=i[s];a.setValue(e,t[a.id],r)}}}const Vp=/(\w+)(\])?(\[|\.)?/g;function Ev(n,e){n.seq.push(e),n.map[e.id]=e}function ST(n,e,t){const r=n.name,i=r.length;for(Vp.lastIndex=0;;){const s=Vp.exec(r),o=Vp.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){Ev(t,c===void 0?new vT(a,n,e):new xT(a,n,e));break}else{let f=t.map[a];f===void 0&&(f=new yT(a),Ev(t,f)),t=f}}}class Iu{constructor(e,t){this.seq=[],this.map={};const r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<r;++i){const s=e.getActiveUniform(t,i),o=e.getUniformLocation(t,s.name);ST(s,o,this)}}setValue(e,t,r,i){const s=this.map[t];s!==void 0&&s.setValue(e,r,i)}setOptional(e,t,r){const i=t[r];i!==void 0&&this.setValue(e,r,i)}static upload(e,t,r,i){for(let s=0,o=t.length;s!==o;++s){const a=t[s],l=r[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,i)}}static seqWithValue(e,t){const r=[];for(let i=0,s=e.length;i!==s;++i){const o=e[i];o.id in t&&r.push(o)}return r}}function bv(n,e,t){const r=n.createShader(e);return n.shaderSource(r,t),n.compileShader(r),r}const ET=37297;let bT=0;function MT(n,e){const t=n.split(`
3815
3807
  `),r=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=i;o<s;o++){const a=o+1;r.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return r.join(`
3816
- `)}const Mv=new yt;function wT(n){Nt._getMatrix(Mv,Nt.workingColorSpace,n);const e=`mat3( ${Mv.elements.map(t=>t.toFixed(4))} )`;switch(Nt.getTransfer(n)){case Jc:return[e,"LinearTransferOETF"];case Gt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function wv(n,e,t){const r=n.getShaderParameter(e,n.COMPILE_STATUS),s=(n.getShaderInfoLog(e)||"").trim();if(r&&s==="")return"";const o=/ERROR: 0:(\d+)/.exec(s);if(o){const a=parseInt(o[1]);return t.toUpperCase()+`
3808
+ `)}const Mv=new pt;function wT(n){Ct._getMatrix(Mv,Ct.workingColorSpace,n);const e=`mat3( ${Mv.elements.map(t=>t.toFixed(4))} )`;switch(Ct.getTransfer(n)){case Xc:return[e,"LinearTransferOETF"];case Ut:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function wv(n,e,t){const r=n.getShaderParameter(e,n.COMPILE_STATUS),s=(n.getShaderInfoLog(e)||"").trim();if(r&&s==="")return"";const o=/ERROR: 0:(\d+)/.exec(s);if(o){const a=parseInt(o[1]);return t.toUpperCase()+`
3817
3809
 
3818
3810
  `+s+`
3819
3811
 
3820
3812
  `+MT(n.getShaderSource(e),a)}else return s}function TT(n,e){const t=wT(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
3821
- `)}function AT(n,e){let t;switch(e){case Sb:t="Linear";break;case Eb:t="Reinhard";break;case bb:t="Cineon";break;case Mb:t="ACESFilmic";break;case Tb:t="AgX";break;case Ab:t="Neutral";break;case wb:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Uu=new j;function CT(){Nt.getLuminanceCoefficients(Uu);const n=Uu.x.toFixed(4),e=Uu.y.toFixed(4),t=Uu.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
3822
- `)}function RT(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Dl).join(`
3813
+ `)}function AT(n,e){let t;switch(e){case Sb:t="Linear";break;case Eb:t="Reinhard";break;case bb:t="Cineon";break;case Mb:t="ACESFilmic";break;case Tb:t="AgX";break;case Ab:t="Neutral";break;case wb:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Lu=new G;function CT(){Ct.getLuminanceCoefficients(Lu);const n=Lu.x.toFixed(4),e=Lu.y.toFixed(4),t=Lu.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
3814
+ `)}function RT(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Al).join(`
3823
3815
  `)}function PT(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(`
3824
- `)}function IT(n,e){const t={},r=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const s=n.getActiveAttrib(e,i),o=s.name;let a=1;s.type===n.FLOAT_MAT2&&(a=2),s.type===n.FLOAT_MAT3&&(a=3),s.type===n.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function Dl(n){return n!==""}function Tv(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Av(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const LT=/^[ \t]*#include +<([\w\d./]+)>/gm;function Hp(n){return n.replace(LT,qT)}const OT=new Map;function qT(n,e){let t=Et[e];if(t===void 0){const r=OT.get(e);if(r!==void 0)t=Et[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return Hp(t)}const DT=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Cv(n){return n.replace(DT,NT)}function NT(n,e,t,r){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Rv(n){let e=`precision ${n.precision} float;
3816
+ `)}function IT(n,e){const t={},r=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const s=n.getActiveAttrib(e,i),o=s.name;let a=1;s.type===n.FLOAT_MAT2&&(a=2),s.type===n.FLOAT_MAT3&&(a=3),s.type===n.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function Al(n){return n!==""}function Tv(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Av(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const LT=/^[ \t]*#include +<([\w\d./]+)>/gm;function Hp(n){return n.replace(LT,qT)}const OT=new Map;function qT(n,e){let t=gt[e];if(t===void 0){const r=OT.get(e);if(r!==void 0)t=gt[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return Hp(t)}const DT=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Cv(n){return n.replace(DT,NT)}function NT(n,e,t,r){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Rv(n){let e=`precision ${n.precision} float;
3825
3817
  precision ${n.precision} int;
3826
3818
  precision ${n.precision} sampler2D;
3827
3819
  precision ${n.precision} samplerCube;
@@ -3841,28 +3833,28 @@ void main() {
3841
3833
  `;return n.precision==="highp"?e+=`
3842
3834
  #define HIGH_PRECISION`:n.precision==="mediump"?e+=`
3843
3835
  #define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
3844
- #define LOW_PRECISION`),e}function UT(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===B1?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===eb?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===Wi&&(e="SHADOWMAP_TYPE_VSM"),e}function FT(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case $o:case Yo:e="ENVMAP_TYPE_CUBE";break;case Wc:e="ENVMAP_TYPE_CUBE_UV";break}return e}function zT(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case Yo:e="ENVMAP_MODE_REFRACTION";break}return e}function kT(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case dd:e="ENVMAP_BLENDING_MULTIPLY";break;case xb:e="ENVMAP_BLENDING_MIX";break;case yb:e="ENVMAP_BLENDING_ADD";break}return e}function BT(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:r,maxMip:t}}function VT(n,e,t,r){const i=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=UT(t),c=FT(t),h=zT(t),f=kT(t),p=BT(t),d=RT(t),m=PT(s),x=i.createProgram();let v,_,E=t.glslVersion?"#version "+t.glslVersion+`
3845
- `:"";t.isRawShaderMaterial?(v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Dl).join(`
3836
+ #define LOW_PRECISION`),e}function UT(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===B1?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===eb?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===Ui&&(e="SHADOWMAP_TYPE_VSM"),e}function FT(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case Fo:case zo:e="ENVMAP_TYPE_CUBE";break;case kc:e="ENVMAP_TYPE_CUBE_UV";break}return e}function zT(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case zo:e="ENVMAP_MODE_REFRACTION";break}return e}function kT(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case dd:e="ENVMAP_BLENDING_MULTIPLY";break;case xb:e="ENVMAP_BLENDING_MIX";break;case yb:e="ENVMAP_BLENDING_ADD";break}return e}function BT(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:r,maxMip:t}}function VT(n,e,t,r){const i=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=UT(t),c=FT(t),h=zT(t),f=kT(t),p=BT(t),d=RT(t),m=PT(s),x=i.createProgram();let v,_,b=t.glslVersion?"#version "+t.glslVersion+`
3837
+ `:"";t.isRawShaderMaterial?(v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Al).join(`
3846
3838
  `),v.length>0&&(v+=`
3847
- `),_=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Dl).join(`
3839
+ `),_=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Al).join(`
3848
3840
  `),_.length>0&&(_+=`
3849
3841
  `)):(v=[Rv(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reversedDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
3850
- `].filter(Dl).join(`
3851
- `),_=[Rv(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reversedDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==vs?"#define TONE_MAPPING":"",t.toneMapping!==vs?Et.tonemapping_pars_fragment:"",t.toneMapping!==vs?AT("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Et.colorspace_pars_fragment,TT("linearToOutputTexel",t.outputColorSpace),CT(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3852
- `].filter(Dl).join(`
3853
- `)),o=Hp(o),o=Tv(o,t),o=Av(o,t),a=Hp(a),a=Tv(a,t),a=Av(a,t),o=Cv(o),a=Cv(a),t.isRawShaderMaterial!==!0&&(E=`#version 300 es
3842
+ `].filter(Al).join(`
3843
+ `),_=[Rv(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reversedDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==us?"#define TONE_MAPPING":"",t.toneMapping!==us?gt.tonemapping_pars_fragment:"",t.toneMapping!==us?AT("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",gt.colorspace_pars_fragment,TT("linearToOutputTexel",t.outputColorSpace),CT(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3844
+ `].filter(Al).join(`
3845
+ `)),o=Hp(o),o=Tv(o,t),o=Av(o,t),a=Hp(a),a=Tv(a,t),a=Av(a,t),o=Cv(o),a=Cv(a),t.isRawShaderMaterial!==!0&&(b=`#version 300 es
3854
3846
  `,v=[d,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3855
3847
  `)+`
3856
3848
  `+v,_=["#define varying in",t.glslVersion===r_?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===r_?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
3857
3849
  `)+`
3858
- `+_);const M=E+v+o,b=E+_+a,S=bv(i,i.VERTEX_SHADER,M),T=bv(i,i.FRAGMENT_SHADER,b);i.attachShader(x,S),i.attachShader(x,T),t.index0AttributeName!==void 0?i.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(x,0,"position"),i.linkProgram(x);function q(N){if(n.debug.checkShaderErrors){const Z=i.getProgramInfoLog(x)||"",Y=i.getShaderInfoLog(S)||"",ee=i.getShaderInfoLog(T)||"",ue=Z.trim(),te=Y.trim(),ae=ee.trim();let B=!0,Se=!0;if(i.getProgramParameter(x,i.LINK_STATUS)===!1)if(B=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,x,S,T);else{const $=wv(i,S,"vertex"),oe=wv(i,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(x,i.VALIDATE_STATUS)+`
3850
+ `+_);const M=b+v+o,E=b+_+a,S=bv(i,i.VERTEX_SHADER,M),T=bv(i,i.FRAGMENT_SHADER,E);i.attachShader(x,S),i.attachShader(x,T),t.index0AttributeName!==void 0?i.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(x,0,"position"),i.linkProgram(x);function q(N){if(n.debug.checkShaderErrors){const Z=i.getProgramInfoLog(x)||"",K=i.getShaderInfoLog(S)||"",ne=i.getShaderInfoLog(T)||"",ce=Z.trim(),J=K.trim(),oe=ne.trim();let B=!0,xe=!0;if(i.getProgramParameter(x,i.LINK_STATUS)===!1)if(B=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,x,S,T);else{const U=wv(i,S,"vertex"),$=wv(i,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(x,i.VALIDATE_STATUS)+`
3859
3851
 
3860
3852
  Material Name: `+N.name+`
3861
3853
  Material Type: `+N.type+`
3862
3854
 
3863
- Program Info Log: `+ue+`
3864
- `+$+`
3865
- `+oe)}else ue!==""?console.warn("THREE.WebGLProgram: Program Info Log:",ue):(te===""||ae==="")&&(Se=!1);Se&&(N.diagnostics={runnable:B,programLog:ue,vertexShader:{log:te,prefix:v},fragmentShader:{log:ae,prefix:_}})}i.deleteShader(S),i.deleteShader(T),O=new Nu(i,x),A=IT(i,x)}let O;this.getUniforms=function(){return O===void 0&&q(this),O};let A;this.getAttributes=function(){return A===void 0&&q(this),A};let L=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return L===!1&&(L=i.getProgramParameter(x,ET)),L},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=bT++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=S,this.fragmentShader=T,this}let HT=0;class GT{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new WT(e),t.set(e,r)),r}}class WT{constructor(e){this.id=HT++,this.code=e,this.usedTimes=0}}function jT(n,e,t,r,i,s,o){const a=new lp,l=new GT,c=new Set,h=[],f=i.logarithmicDepthBuffer,p=i.vertexTextures;let d=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function x(A){return c.add(A),A===0?"uv":`uv${A}`}function v(A,L,N,Z,Y){const ee=Z.fog,ue=Y.geometry,te=A.isMeshStandardMaterial?Z.environment:null,ae=(A.isMeshStandardMaterial?t:e).get(A.envMap||te),B=ae&&ae.mapping===Wc?ae.image.height:null,Se=m[A.type];A.precision!==null&&(d=i.getMaxPrecision(A.precision),d!==A.precision&&console.warn("THREE.WebGLProgram.getParameters:",A.precision,"not supported, using",d,"instead."));const $=ue.morphAttributes.position||ue.morphAttributes.normal||ue.morphAttributes.color,oe=$!==void 0?$.length:0;let Ae=0;ue.morphAttributes.position!==void 0&&(Ae=1),ue.morphAttributes.normal!==void 0&&(Ae=2),ue.morphAttributes.color!==void 0&&(Ae=3);let Ie,Ce,V,ne;if(Se){const _t=qi[Se];Ie=_t.vertexShader,Ce=_t.fragmentShader}else Ie=A.vertexShader,Ce=A.fragmentShader,l.update(A),V=l.getVertexShaderID(A),ne=l.getFragmentShaderID(A);const X=n.getRenderTarget(),pe=n.state.buffers.depth.getReversed(),Ee=Y.isInstancedMesh===!0,Q=Y.isBatchedMesh===!0,Ne=!!A.map,le=!!A.matcap,F=!!ae,lt=!!A.aoMap,Le=!!A.lightMap,Ge=!!A.bumpMap,De=!!A.normalMap,Ue=!!A.displacementMap,ge=!!A.emissiveMap,$e=!!A.metalnessMap,ot=!!A.roughnessMap,wt=A.anisotropy>0,U=A.clearcoat>0,I=A.dispersion>0,J=A.iridescence>0,de=A.sheen>0,be=A.transmission>0,fe=wt&&!!A.anisotropyMap,Fe=U&&!!A.clearcoatMap,Te=U&&!!A.clearcoatNormalMap,Ye=U&&!!A.clearcoatRoughnessMap,Ke=J&&!!A.iridescenceMap,Re=J&&!!A.iridescenceThicknessMap,ze=de&&!!A.sheenColorMap,We=de&&!!A.sheenRoughnessMap,tt=!!A.specularMap,Pe=!!A.specularColorMap,gt=!!A.specularIntensityMap,H=be&&!!A.transmissionMap,_e=be&&!!A.thicknessMap,Oe=!!A.gradientMap,Ve=!!A.alphaMap,we=A.alphaTest>0,me=!!A.alphaHash,Qe=!!A.extensions;let ft=vs;A.toneMapped&&(X===null||X.isXRRenderTarget===!0)&&(ft=n.toneMapping);const Ot={shaderID:Se,shaderType:A.type,shaderName:A.name,vertexShader:Ie,fragmentShader:Ce,defines:A.defines,customVertexShaderID:V,customFragmentShaderID:ne,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:d,batching:Q,batchingColor:Q&&Y._colorsTexture!==null,instancing:Ee,instancingColor:Ee&&Y.instanceColor!==null,instancingMorph:Ee&&Y.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:X===null?n.outputColorSpace:X.isXRRenderTarget===!0?X.texture.colorSpace:Ko,alphaToCoverage:!!A.alphaToCoverage,map:Ne,matcap:le,envMap:F,envMapMode:F&&ae.mapping,envMapCubeUVHeight:B,aoMap:lt,lightMap:Le,bumpMap:Ge,normalMap:De,displacementMap:p&&Ue,emissiveMap:ge,normalMapObjectSpace:De&&A.normalMapType===Ib,normalMapTangentSpace:De&&A.normalMapType===Kd,metalnessMap:$e,roughnessMap:ot,anisotropy:wt,anisotropyMap:fe,clearcoat:U,clearcoatMap:Fe,clearcoatNormalMap:Te,clearcoatRoughnessMap:Ye,dispersion:I,iridescence:J,iridescenceMap:Ke,iridescenceThicknessMap:Re,sheen:de,sheenColorMap:ze,sheenRoughnessMap:We,specularMap:tt,specularColorMap:Pe,specularIntensityMap:gt,transmission:be,transmissionMap:H,thicknessMap:_e,gradientMap:Oe,opaque:A.transparent===!1&&A.blending===jo&&A.alphaToCoverage===!1,alphaMap:Ve,alphaTest:we,alphaHash:me,combine:A.combine,mapUv:Ne&&x(A.map.channel),aoMapUv:lt&&x(A.aoMap.channel),lightMapUv:Le&&x(A.lightMap.channel),bumpMapUv:Ge&&x(A.bumpMap.channel),normalMapUv:De&&x(A.normalMap.channel),displacementMapUv:Ue&&x(A.displacementMap.channel),emissiveMapUv:ge&&x(A.emissiveMap.channel),metalnessMapUv:$e&&x(A.metalnessMap.channel),roughnessMapUv:ot&&x(A.roughnessMap.channel),anisotropyMapUv:fe&&x(A.anisotropyMap.channel),clearcoatMapUv:Fe&&x(A.clearcoatMap.channel),clearcoatNormalMapUv:Te&&x(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ye&&x(A.clearcoatRoughnessMap.channel),iridescenceMapUv:Ke&&x(A.iridescenceMap.channel),iridescenceThicknessMapUv:Re&&x(A.iridescenceThicknessMap.channel),sheenColorMapUv:ze&&x(A.sheenColorMap.channel),sheenRoughnessMapUv:We&&x(A.sheenRoughnessMap.channel),specularMapUv:tt&&x(A.specularMap.channel),specularColorMapUv:Pe&&x(A.specularColorMap.channel),specularIntensityMapUv:gt&&x(A.specularIntensityMap.channel),transmissionMapUv:H&&x(A.transmissionMap.channel),thicknessMapUv:_e&&x(A.thicknessMap.channel),alphaMapUv:Ve&&x(A.alphaMap.channel),vertexTangents:!!ue.attributes.tangent&&(De||wt),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!ue.attributes.color&&ue.attributes.color.itemSize===4,pointsUvs:Y.isPoints===!0&&!!ue.attributes.uv&&(Ne||Ve),fog:!!ee,useFog:A.fog===!0,fogExp2:!!ee&&ee.isFogExp2,flatShading:A.flatShading===!0&&A.wireframe===!1,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:pe,skinning:Y.isSkinnedMesh===!0,morphTargets:ue.morphAttributes.position!==void 0,morphNormals:ue.morphAttributes.normal!==void 0,morphColors:ue.morphAttributes.color!==void 0,morphTargetsCount:oe,morphTextureStride:Ae,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numLightProbes:L.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:n.shadowMap.enabled&&N.length>0,shadowMapType:n.shadowMap.type,toneMapping:ft,decodeVideoTexture:Ne&&A.map.isVideoTexture===!0&&Nt.getTransfer(A.map.colorSpace)===Gt,decodeVideoTextureEmissive:ge&&A.emissiveMap.isVideoTexture===!0&&Nt.getTransfer(A.emissiveMap.colorSpace)===Gt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===Ci,flipSided:A.side===lr,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:Qe&&A.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Qe&&A.extensions.multiDraw===!0||Q)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Ot.vertexUv1s=c.has(1),Ot.vertexUv2s=c.has(2),Ot.vertexUv3s=c.has(3),c.clear(),Ot}function _(A){const L=[];if(A.shaderID?L.push(A.shaderID):(L.push(A.customVertexShaderID),L.push(A.customFragmentShaderID)),A.defines!==void 0)for(const N in A.defines)L.push(N),L.push(A.defines[N]);return A.isRawShaderMaterial===!1&&(E(L,A),M(L,A),L.push(n.outputColorSpace)),L.push(A.customProgramCacheKey),L.join()}function E(A,L){A.push(L.precision),A.push(L.outputColorSpace),A.push(L.envMapMode),A.push(L.envMapCubeUVHeight),A.push(L.mapUv),A.push(L.alphaMapUv),A.push(L.lightMapUv),A.push(L.aoMapUv),A.push(L.bumpMapUv),A.push(L.normalMapUv),A.push(L.displacementMapUv),A.push(L.emissiveMapUv),A.push(L.metalnessMapUv),A.push(L.roughnessMapUv),A.push(L.anisotropyMapUv),A.push(L.clearcoatMapUv),A.push(L.clearcoatNormalMapUv),A.push(L.clearcoatRoughnessMapUv),A.push(L.iridescenceMapUv),A.push(L.iridescenceThicknessMapUv),A.push(L.sheenColorMapUv),A.push(L.sheenRoughnessMapUv),A.push(L.specularMapUv),A.push(L.specularColorMapUv),A.push(L.specularIntensityMapUv),A.push(L.transmissionMapUv),A.push(L.thicknessMapUv),A.push(L.combine),A.push(L.fogExp2),A.push(L.sizeAttenuation),A.push(L.morphTargetsCount),A.push(L.morphAttributeCount),A.push(L.numDirLights),A.push(L.numPointLights),A.push(L.numSpotLights),A.push(L.numSpotLightMaps),A.push(L.numHemiLights),A.push(L.numRectAreaLights),A.push(L.numDirLightShadows),A.push(L.numPointLightShadows),A.push(L.numSpotLightShadows),A.push(L.numSpotLightShadowsWithMaps),A.push(L.numLightProbes),A.push(L.shadowMapType),A.push(L.toneMapping),A.push(L.numClippingPlanes),A.push(L.numClipIntersection),A.push(L.depthPacking)}function M(A,L){a.disableAll(),L.supportsVertexTextures&&a.enable(0),L.instancing&&a.enable(1),L.instancingColor&&a.enable(2),L.instancingMorph&&a.enable(3),L.matcap&&a.enable(4),L.envMap&&a.enable(5),L.normalMapObjectSpace&&a.enable(6),L.normalMapTangentSpace&&a.enable(7),L.clearcoat&&a.enable(8),L.iridescence&&a.enable(9),L.alphaTest&&a.enable(10),L.vertexColors&&a.enable(11),L.vertexAlphas&&a.enable(12),L.vertexUv1s&&a.enable(13),L.vertexUv2s&&a.enable(14),L.vertexUv3s&&a.enable(15),L.vertexTangents&&a.enable(16),L.anisotropy&&a.enable(17),L.alphaHash&&a.enable(18),L.batching&&a.enable(19),L.dispersion&&a.enable(20),L.batchingColor&&a.enable(21),L.gradientMap&&a.enable(22),A.push(a.mask),a.disableAll(),L.fog&&a.enable(0),L.useFog&&a.enable(1),L.flatShading&&a.enable(2),L.logarithmicDepthBuffer&&a.enable(3),L.reversedDepthBuffer&&a.enable(4),L.skinning&&a.enable(5),L.morphTargets&&a.enable(6),L.morphNormals&&a.enable(7),L.morphColors&&a.enable(8),L.premultipliedAlpha&&a.enable(9),L.shadowMapEnabled&&a.enable(10),L.doubleSided&&a.enable(11),L.flipSided&&a.enable(12),L.useDepthPacking&&a.enable(13),L.dithering&&a.enable(14),L.transmission&&a.enable(15),L.sheen&&a.enable(16),L.opaque&&a.enable(17),L.pointsUvs&&a.enable(18),L.decodeVideoTexture&&a.enable(19),L.decodeVideoTextureEmissive&&a.enable(20),L.alphaToCoverage&&a.enable(21),A.push(a.mask)}function b(A){const L=m[A.type];let N;if(L){const Z=qi[L];N=aM.clone(Z.uniforms)}else N=A.uniforms;return N}function S(A,L){let N;for(let Z=0,Y=h.length;Z<Y;Z++){const ee=h[Z];if(ee.cacheKey===L){N=ee,++N.usedTimes;break}}return N===void 0&&(N=new VT(n,L,A,s),h.push(N)),N}function T(A){if(--A.usedTimes===0){const L=h.indexOf(A);h[L]=h[h.length-1],h.pop(),A.destroy()}}function q(A){l.remove(A)}function O(){l.dispose()}return{getParameters:v,getProgramCacheKey:_,getUniforms:b,acquireProgram:S,releaseProgram:T,releaseShaderCache:q,programs:h,dispose:O}}function XT(){let n=new WeakMap;function e(o){return n.has(o)}function t(o){let a=n.get(o);return a===void 0&&(a={},n.set(o,a)),a}function r(o){n.delete(o)}function i(o,a,l){n.get(o)[a]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:r,update:i,dispose:s}}function $T(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function Pv(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function Iv(){const n=[];let e=0;const t=[],r=[],i=[];function s(){e=0,t.length=0,r.length=0,i.length=0}function o(f,p,d,m,x,v){let _=n[e];return _===void 0?(_={id:f.id,object:f,geometry:p,material:d,groupOrder:m,renderOrder:f.renderOrder,z:x,group:v},n[e]=_):(_.id=f.id,_.object=f,_.geometry=p,_.material=d,_.groupOrder=m,_.renderOrder=f.renderOrder,_.z=x,_.group=v),e++,_}function a(f,p,d,m,x,v){const _=o(f,p,d,m,x,v);d.transmission>0?r.push(_):d.transparent===!0?i.push(_):t.push(_)}function l(f,p,d,m,x,v){const _=o(f,p,d,m,x,v);d.transmission>0?r.unshift(_):d.transparent===!0?i.unshift(_):t.unshift(_)}function c(f,p){t.length>1&&t.sort(f||$T),r.length>1&&r.sort(p||Pv),i.length>1&&i.sort(p||Pv)}function h(){for(let f=e,p=n.length;f<p;f++){const d=n[f];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.group=null}}return{opaque:t,transmissive:r,transparent:i,init:s,push:a,unshift:l,finish:h,sort:c}}function YT(){let n=new WeakMap;function e(r,i){const s=n.get(r);let o;return s===void 0?(o=new Iv,n.set(r,[o])):i>=s.length?(o=new Iv,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function KT(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new j,color:new Ct};break;case"SpotLight":t={position:new j,direction:new j,color:new Ct,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new j,color:new Ct,distance:0,decay:0};break;case"HemisphereLight":t={direction:new j,skyColor:new Ct,groundColor:new Ct};break;case"RectAreaLight":t={color:new Ct,position:new j,halfWidth:new j,halfHeight:new j};break}return n[e.id]=t,t}}}function ZT(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let JT=0;function QT(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function e6(n){const e=new KT,t=ZT(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new j);const i=new j,s=new Kt,o=new Kt;function a(c){let h=0,f=0,p=0;for(let A=0;A<9;A++)r.probe[A].set(0,0,0);let d=0,m=0,x=0,v=0,_=0,E=0,M=0,b=0,S=0,T=0,q=0;c.sort(QT);for(let A=0,L=c.length;A<L;A++){const N=c[A],Z=N.color,Y=N.intensity,ee=N.distance,ue=N.shadow&&N.shadow.map?N.shadow.map.texture:null;if(N.isAmbientLight)h+=Z.r*Y,f+=Z.g*Y,p+=Z.b*Y;else if(N.isLightProbe){for(let te=0;te<9;te++)r.probe[te].addScaledVector(N.sh.coefficients[te],Y);q++}else if(N.isDirectionalLight){const te=e.get(N);if(te.color.copy(N.color).multiplyScalar(N.intensity),N.castShadow){const ae=N.shadow,B=t.get(N);B.shadowIntensity=ae.intensity,B.shadowBias=ae.bias,B.shadowNormalBias=ae.normalBias,B.shadowRadius=ae.radius,B.shadowMapSize=ae.mapSize,r.directionalShadow[d]=B,r.directionalShadowMap[d]=ue,r.directionalShadowMatrix[d]=N.shadow.matrix,E++}r.directional[d]=te,d++}else if(N.isSpotLight){const te=e.get(N);te.position.setFromMatrixPosition(N.matrixWorld),te.color.copy(Z).multiplyScalar(Y),te.distance=ee,te.coneCos=Math.cos(N.angle),te.penumbraCos=Math.cos(N.angle*(1-N.penumbra)),te.decay=N.decay,r.spot[x]=te;const ae=N.shadow;if(N.map&&(r.spotLightMap[S]=N.map,S++,ae.updateMatrices(N),N.castShadow&&T++),r.spotLightMatrix[x]=ae.matrix,N.castShadow){const B=t.get(N);B.shadowIntensity=ae.intensity,B.shadowBias=ae.bias,B.shadowNormalBias=ae.normalBias,B.shadowRadius=ae.radius,B.shadowMapSize=ae.mapSize,r.spotShadow[x]=B,r.spotShadowMap[x]=ue,b++}x++}else if(N.isRectAreaLight){const te=e.get(N);te.color.copy(Z).multiplyScalar(Y),te.halfWidth.set(N.width*.5,0,0),te.halfHeight.set(0,N.height*.5,0),r.rectArea[v]=te,v++}else if(N.isPointLight){const te=e.get(N);if(te.color.copy(N.color).multiplyScalar(N.intensity),te.distance=N.distance,te.decay=N.decay,N.castShadow){const ae=N.shadow,B=t.get(N);B.shadowIntensity=ae.intensity,B.shadowBias=ae.bias,B.shadowNormalBias=ae.normalBias,B.shadowRadius=ae.radius,B.shadowMapSize=ae.mapSize,B.shadowCameraNear=ae.camera.near,B.shadowCameraFar=ae.camera.far,r.pointShadow[m]=B,r.pointShadowMap[m]=ue,r.pointShadowMatrix[m]=N.shadow.matrix,M++}r.point[m]=te,m++}else if(N.isHemisphereLight){const te=e.get(N);te.skyColor.copy(N.color).multiplyScalar(Y),te.groundColor.copy(N.groundColor).multiplyScalar(Y),r.hemi[_]=te,_++}}v>0&&(n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=He.LTC_FLOAT_1,r.rectAreaLTC2=He.LTC_FLOAT_2):(r.rectAreaLTC1=He.LTC_HALF_1,r.rectAreaLTC2=He.LTC_HALF_2)),r.ambient[0]=h,r.ambient[1]=f,r.ambient[2]=p;const O=r.hash;(O.directionalLength!==d||O.pointLength!==m||O.spotLength!==x||O.rectAreaLength!==v||O.hemiLength!==_||O.numDirectionalShadows!==E||O.numPointShadows!==M||O.numSpotShadows!==b||O.numSpotMaps!==S||O.numLightProbes!==q)&&(r.directional.length=d,r.spot.length=x,r.rectArea.length=v,r.point.length=m,r.hemi.length=_,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=M,r.pointShadowMap.length=M,r.spotShadow.length=b,r.spotShadowMap.length=b,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=M,r.spotLightMatrix.length=b+S-T,r.spotLightMap.length=S,r.numSpotLightShadowsWithMaps=T,r.numLightProbes=q,O.directionalLength=d,O.pointLength=m,O.spotLength=x,O.rectAreaLength=v,O.hemiLength=_,O.numDirectionalShadows=E,O.numPointShadows=M,O.numSpotShadows=b,O.numSpotMaps=S,O.numLightProbes=q,r.version=JT++)}function l(c,h){let f=0,p=0,d=0,m=0,x=0;const v=h.matrixWorldInverse;for(let _=0,E=c.length;_<E;_++){const M=c[_];if(M.isDirectionalLight){const b=r.directional[f];b.direction.setFromMatrixPosition(M.matrixWorld),i.setFromMatrixPosition(M.target.matrixWorld),b.direction.sub(i),b.direction.transformDirection(v),f++}else if(M.isSpotLight){const b=r.spot[d];b.position.setFromMatrixPosition(M.matrixWorld),b.position.applyMatrix4(v),b.direction.setFromMatrixPosition(M.matrixWorld),i.setFromMatrixPosition(M.target.matrixWorld),b.direction.sub(i),b.direction.transformDirection(v),d++}else if(M.isRectAreaLight){const b=r.rectArea[m];b.position.setFromMatrixPosition(M.matrixWorld),b.position.applyMatrix4(v),o.identity(),s.copy(M.matrixWorld),s.premultiply(v),o.extractRotation(s),b.halfWidth.set(M.width*.5,0,0),b.halfHeight.set(0,M.height*.5,0),b.halfWidth.applyMatrix4(o),b.halfHeight.applyMatrix4(o),m++}else if(M.isPointLight){const b=r.point[p];b.position.setFromMatrixPosition(M.matrixWorld),b.position.applyMatrix4(v),p++}else if(M.isHemisphereLight){const b=r.hemi[x];b.direction.setFromMatrixPosition(M.matrixWorld),b.direction.transformDirection(v),x++}}}return{setup:a,setupView:l,state:r}}function Lv(n){const e=new e6(n),t=[],r=[];function i(h){c.camera=h,t.length=0,r.length=0}function s(h){t.push(h)}function o(h){r.push(h)}function a(){e.setup(t)}function l(h){e.setupView(t,h)}const c={lightsArray:t,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function t6(n){let e=new WeakMap;function t(i,s=0){const o=e.get(i);let a;return o===void 0?(a=new Lv(n),e.set(i,[a])):s>=o.length?(a=new Lv(n),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:t,dispose:r}}const n6=`void main() {
3855
+ Program Info Log: `+ce+`
3856
+ `+U+`
3857
+ `+$)}else ce!==""?console.warn("THREE.WebGLProgram: Program Info Log:",ce):(J===""||oe==="")&&(xe=!1);xe&&(N.diagnostics={runnable:B,programLog:ce,vertexShader:{log:J,prefix:v},fragmentShader:{log:oe,prefix:_}})}i.deleteShader(S),i.deleteShader(T),O=new Iu(i,x),A=IT(i,x)}let O;this.getUniforms=function(){return O===void 0&&q(this),O};let A;this.getAttributes=function(){return A===void 0&&q(this),A};let L=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return L===!1&&(L=i.getProgramParameter(x,ET)),L},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=bT++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=S,this.fragmentShader=T,this}let HT=0;class GT{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new WT(e),t.set(e,r)),r}}class WT{constructor(e){this.id=HT++,this.code=e,this.usedTimes=0}}function jT(n,e,t,r,i,s,o){const a=new lp,l=new GT,c=new Set,h=[],f=i.logarithmicDepthBuffer,p=i.vertexTextures;let d=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function x(A){return c.add(A),A===0?"uv":`uv${A}`}function v(A,L,N,Z,K){const ne=Z.fog,ce=K.geometry,J=A.isMeshStandardMaterial?Z.environment:null,oe=(A.isMeshStandardMaterial?t:e).get(A.envMap||J),B=oe&&oe.mapping===kc?oe.image.height:null,xe=m[A.type];A.precision!==null&&(d=i.getMaxPrecision(A.precision),d!==A.precision&&console.warn("THREE.WebGLProgram.getParameters:",A.precision,"not supported, using",d,"instead."));const U=ce.morphAttributes.position||ce.morphAttributes.normal||ce.morphAttributes.color,$=U!==void 0?U.length:0;let pe=0;ce.morphAttributes.position!==void 0&&(pe=1),ce.morphAttributes.normal!==void 0&&(pe=2),ce.morphAttributes.color!==void 0&&(pe=3);let Se,be,V,te;if(xe){const ft=Ti[xe];Se=ft.vertexShader,be=ft.fragmentShader}else Se=A.vertexShader,be=A.fragmentShader,l.update(A),V=l.getVertexShaderID(A),te=l.getFragmentShaderID(A);const W=n.getRenderTarget(),ue=n.state.buffers.depth.getReversed(),ye=K.isInstancedMesh===!0,Q=K.isBatchedMesh===!0,Le=!!A.map,le=!!A.matcap,z=!!oe,it=!!A.aoMap,Ie=!!A.lightMap,$e=!!A.bumpMap,qe=!!A.normalMap,De=!!A.displacementMap,ve=!!A.emissiveMap,Ge=!!A.metalnessMap,rt=!!A.roughnessMap,wt=A.anisotropy>0,F=A.clearcoat>0,I=A.dispersion>0,ee=A.iridescence>0,de=A.sheen>0,Me=A.transmission>0,fe=wt&&!!A.anisotropyMap,Ue=F&&!!A.clearcoatMap,Ae=F&&!!A.clearcoatNormalMap,We=F&&!!A.clearcoatRoughnessMap,je=ee&&!!A.iridescenceMap,Ce=ee&&!!A.iridescenceThicknessMap,Ne=de&&!!A.sheenColorMap,Ve=de&&!!A.sheenRoughnessMap,Ke=!!A.specularMap,Re=!!A.specularColorMap,ht=!!A.specularIntensityMap,H=Me&&!!A.transmissionMap,Ee=Me&&!!A.thicknessMap,Oe=!!A.gradientMap,Be=!!A.alphaMap,Te=A.alphaTest>0,me=!!A.alphaHash,Ze=!!A.extensions;let ct=us;A.toneMapped&&(W===null||W.isXRRenderTarget===!0)&&(ct=n.toneMapping);const Lt={shaderID:xe,shaderType:A.type,shaderName:A.name,vertexShader:Se,fragmentShader:be,defines:A.defines,customVertexShaderID:V,customFragmentShaderID:te,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:d,batching:Q,batchingColor:Q&&K._colorsTexture!==null,instancing:ye,instancingColor:ye&&K.instanceColor!==null,instancingMorph:ye&&K.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:W===null?n.outputColorSpace:W.isXRRenderTarget===!0?W.texture.colorSpace:ko,alphaToCoverage:!!A.alphaToCoverage,map:Le,matcap:le,envMap:z,envMapMode:z&&oe.mapping,envMapCubeUVHeight:B,aoMap:it,lightMap:Ie,bumpMap:$e,normalMap:qe,displacementMap:p&&De,emissiveMap:ve,normalMapObjectSpace:qe&&A.normalMapType===Ib,normalMapTangentSpace:qe&&A.normalMapType===Kd,metalnessMap:Ge,roughnessMap:rt,anisotropy:wt,anisotropyMap:fe,clearcoat:F,clearcoatMap:Ue,clearcoatNormalMap:Ae,clearcoatRoughnessMap:We,dispersion:I,iridescence:ee,iridescenceMap:je,iridescenceThicknessMap:Ce,sheen:de,sheenColorMap:Ne,sheenRoughnessMap:Ve,specularMap:Ke,specularColorMap:Re,specularIntensityMap:ht,transmission:Me,transmissionMap:H,thicknessMap:Ee,gradientMap:Oe,opaque:A.transparent===!1&&A.blending===No&&A.alphaToCoverage===!1,alphaMap:Be,alphaTest:Te,alphaHash:me,combine:A.combine,mapUv:Le&&x(A.map.channel),aoMapUv:it&&x(A.aoMap.channel),lightMapUv:Ie&&x(A.lightMap.channel),bumpMapUv:$e&&x(A.bumpMap.channel),normalMapUv:qe&&x(A.normalMap.channel),displacementMapUv:De&&x(A.displacementMap.channel),emissiveMapUv:ve&&x(A.emissiveMap.channel),metalnessMapUv:Ge&&x(A.metalnessMap.channel),roughnessMapUv:rt&&x(A.roughnessMap.channel),anisotropyMapUv:fe&&x(A.anisotropyMap.channel),clearcoatMapUv:Ue&&x(A.clearcoatMap.channel),clearcoatNormalMapUv:Ae&&x(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:We&&x(A.clearcoatRoughnessMap.channel),iridescenceMapUv:je&&x(A.iridescenceMap.channel),iridescenceThicknessMapUv:Ce&&x(A.iridescenceThicknessMap.channel),sheenColorMapUv:Ne&&x(A.sheenColorMap.channel),sheenRoughnessMapUv:Ve&&x(A.sheenRoughnessMap.channel),specularMapUv:Ke&&x(A.specularMap.channel),specularColorMapUv:Re&&x(A.specularColorMap.channel),specularIntensityMapUv:ht&&x(A.specularIntensityMap.channel),transmissionMapUv:H&&x(A.transmissionMap.channel),thicknessMapUv:Ee&&x(A.thicknessMap.channel),alphaMapUv:Be&&x(A.alphaMap.channel),vertexTangents:!!ce.attributes.tangent&&(qe||wt),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!ce.attributes.color&&ce.attributes.color.itemSize===4,pointsUvs:K.isPoints===!0&&!!ce.attributes.uv&&(Le||Be),fog:!!ne,useFog:A.fog===!0,fogExp2:!!ne&&ne.isFogExp2,flatShading:A.flatShading===!0&&A.wireframe===!1,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:ue,skinning:K.isSkinnedMesh===!0,morphTargets:ce.morphAttributes.position!==void 0,morphNormals:ce.morphAttributes.normal!==void 0,morphColors:ce.morphAttributes.color!==void 0,morphTargetsCount:$,morphTextureStride:pe,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numLightProbes:L.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:n.shadowMap.enabled&&N.length>0,shadowMapType:n.shadowMap.type,toneMapping:ct,decodeVideoTexture:Le&&A.map.isVideoTexture===!0&&Ct.getTransfer(A.map.colorSpace)===Ut,decodeVideoTextureEmissive:ve&&A.emissiveMap.isVideoTexture===!0&&Ct.getTransfer(A.emissiveMap.colorSpace)===Ut,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===yi,flipSided:A.side===Qn,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:Ze&&A.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ze&&A.extensions.multiDraw===!0||Q)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Lt.vertexUv1s=c.has(1),Lt.vertexUv2s=c.has(2),Lt.vertexUv3s=c.has(3),c.clear(),Lt}function _(A){const L=[];if(A.shaderID?L.push(A.shaderID):(L.push(A.customVertexShaderID),L.push(A.customFragmentShaderID)),A.defines!==void 0)for(const N in A.defines)L.push(N),L.push(A.defines[N]);return A.isRawShaderMaterial===!1&&(b(L,A),M(L,A),L.push(n.outputColorSpace)),L.push(A.customProgramCacheKey),L.join()}function b(A,L){A.push(L.precision),A.push(L.outputColorSpace),A.push(L.envMapMode),A.push(L.envMapCubeUVHeight),A.push(L.mapUv),A.push(L.alphaMapUv),A.push(L.lightMapUv),A.push(L.aoMapUv),A.push(L.bumpMapUv),A.push(L.normalMapUv),A.push(L.displacementMapUv),A.push(L.emissiveMapUv),A.push(L.metalnessMapUv),A.push(L.roughnessMapUv),A.push(L.anisotropyMapUv),A.push(L.clearcoatMapUv),A.push(L.clearcoatNormalMapUv),A.push(L.clearcoatRoughnessMapUv),A.push(L.iridescenceMapUv),A.push(L.iridescenceThicknessMapUv),A.push(L.sheenColorMapUv),A.push(L.sheenRoughnessMapUv),A.push(L.specularMapUv),A.push(L.specularColorMapUv),A.push(L.specularIntensityMapUv),A.push(L.transmissionMapUv),A.push(L.thicknessMapUv),A.push(L.combine),A.push(L.fogExp2),A.push(L.sizeAttenuation),A.push(L.morphTargetsCount),A.push(L.morphAttributeCount),A.push(L.numDirLights),A.push(L.numPointLights),A.push(L.numSpotLights),A.push(L.numSpotLightMaps),A.push(L.numHemiLights),A.push(L.numRectAreaLights),A.push(L.numDirLightShadows),A.push(L.numPointLightShadows),A.push(L.numSpotLightShadows),A.push(L.numSpotLightShadowsWithMaps),A.push(L.numLightProbes),A.push(L.shadowMapType),A.push(L.toneMapping),A.push(L.numClippingPlanes),A.push(L.numClipIntersection),A.push(L.depthPacking)}function M(A,L){a.disableAll(),L.supportsVertexTextures&&a.enable(0),L.instancing&&a.enable(1),L.instancingColor&&a.enable(2),L.instancingMorph&&a.enable(3),L.matcap&&a.enable(4),L.envMap&&a.enable(5),L.normalMapObjectSpace&&a.enable(6),L.normalMapTangentSpace&&a.enable(7),L.clearcoat&&a.enable(8),L.iridescence&&a.enable(9),L.alphaTest&&a.enable(10),L.vertexColors&&a.enable(11),L.vertexAlphas&&a.enable(12),L.vertexUv1s&&a.enable(13),L.vertexUv2s&&a.enable(14),L.vertexUv3s&&a.enable(15),L.vertexTangents&&a.enable(16),L.anisotropy&&a.enable(17),L.alphaHash&&a.enable(18),L.batching&&a.enable(19),L.dispersion&&a.enable(20),L.batchingColor&&a.enable(21),L.gradientMap&&a.enable(22),A.push(a.mask),a.disableAll(),L.fog&&a.enable(0),L.useFog&&a.enable(1),L.flatShading&&a.enable(2),L.logarithmicDepthBuffer&&a.enable(3),L.reversedDepthBuffer&&a.enable(4),L.skinning&&a.enable(5),L.morphTargets&&a.enable(6),L.morphNormals&&a.enable(7),L.morphColors&&a.enable(8),L.premultipliedAlpha&&a.enable(9),L.shadowMapEnabled&&a.enable(10),L.doubleSided&&a.enable(11),L.flipSided&&a.enable(12),L.useDepthPacking&&a.enable(13),L.dithering&&a.enable(14),L.transmission&&a.enable(15),L.sheen&&a.enable(16),L.opaque&&a.enable(17),L.pointsUvs&&a.enable(18),L.decodeVideoTexture&&a.enable(19),L.decodeVideoTextureEmissive&&a.enable(20),L.alphaToCoverage&&a.enable(21),A.push(a.mask)}function E(A){const L=m[A.type];let N;if(L){const Z=Ti[L];N=aM.clone(Z.uniforms)}else N=A.uniforms;return N}function S(A,L){let N;for(let Z=0,K=h.length;Z<K;Z++){const ne=h[Z];if(ne.cacheKey===L){N=ne,++N.usedTimes;break}}return N===void 0&&(N=new VT(n,L,A,s),h.push(N)),N}function T(A){if(--A.usedTimes===0){const L=h.indexOf(A);h[L]=h[h.length-1],h.pop(),A.destroy()}}function q(A){l.remove(A)}function O(){l.dispose()}return{getParameters:v,getProgramCacheKey:_,getUniforms:E,acquireProgram:S,releaseProgram:T,releaseShaderCache:q,programs:h,dispose:O}}function XT(){let n=new WeakMap;function e(o){return n.has(o)}function t(o){let a=n.get(o);return a===void 0&&(a={},n.set(o,a)),a}function r(o){n.delete(o)}function i(o,a,l){n.get(o)[a]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:r,update:i,dispose:s}}function $T(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function Pv(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function Iv(){const n=[];let e=0;const t=[],r=[],i=[];function s(){e=0,t.length=0,r.length=0,i.length=0}function o(f,p,d,m,x,v){let _=n[e];return _===void 0?(_={id:f.id,object:f,geometry:p,material:d,groupOrder:m,renderOrder:f.renderOrder,z:x,group:v},n[e]=_):(_.id=f.id,_.object=f,_.geometry=p,_.material=d,_.groupOrder=m,_.renderOrder=f.renderOrder,_.z=x,_.group=v),e++,_}function a(f,p,d,m,x,v){const _=o(f,p,d,m,x,v);d.transmission>0?r.push(_):d.transparent===!0?i.push(_):t.push(_)}function l(f,p,d,m,x,v){const _=o(f,p,d,m,x,v);d.transmission>0?r.unshift(_):d.transparent===!0?i.unshift(_):t.unshift(_)}function c(f,p){t.length>1&&t.sort(f||$T),r.length>1&&r.sort(p||Pv),i.length>1&&i.sort(p||Pv)}function h(){for(let f=e,p=n.length;f<p;f++){const d=n[f];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.group=null}}return{opaque:t,transmissive:r,transparent:i,init:s,push:a,unshift:l,finish:h,sort:c}}function YT(){let n=new WeakMap;function e(r,i){const s=n.get(r);let o;return s===void 0?(o=new Iv,n.set(r,[o])):i>=s.length?(o=new Iv,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function KT(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new G,color:new St};break;case"SpotLight":t={position:new G,direction:new G,color:new St,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new G,color:new St,distance:0,decay:0};break;case"HemisphereLight":t={direction:new G,skyColor:new St,groundColor:new St};break;case"RectAreaLight":t={color:new St,position:new G,halfWidth:new G,halfHeight:new G};break}return n[e.id]=t,t}}}function ZT(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fe,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let JT=0;function QT(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function e6(n){const e=new KT,t=ZT(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new G);const i=new G,s=new Ht,o=new Ht;function a(c){let h=0,f=0,p=0;for(let A=0;A<9;A++)r.probe[A].set(0,0,0);let d=0,m=0,x=0,v=0,_=0,b=0,M=0,E=0,S=0,T=0,q=0;c.sort(QT);for(let A=0,L=c.length;A<L;A++){const N=c[A],Z=N.color,K=N.intensity,ne=N.distance,ce=N.shadow&&N.shadow.map?N.shadow.map.texture:null;if(N.isAmbientLight)h+=Z.r*K,f+=Z.g*K,p+=Z.b*K;else if(N.isLightProbe){for(let J=0;J<9;J++)r.probe[J].addScaledVector(N.sh.coefficients[J],K);q++}else if(N.isDirectionalLight){const J=e.get(N);if(J.color.copy(N.color).multiplyScalar(N.intensity),N.castShadow){const oe=N.shadow,B=t.get(N);B.shadowIntensity=oe.intensity,B.shadowBias=oe.bias,B.shadowNormalBias=oe.normalBias,B.shadowRadius=oe.radius,B.shadowMapSize=oe.mapSize,r.directionalShadow[d]=B,r.directionalShadowMap[d]=ce,r.directionalShadowMatrix[d]=N.shadow.matrix,b++}r.directional[d]=J,d++}else if(N.isSpotLight){const J=e.get(N);J.position.setFromMatrixPosition(N.matrixWorld),J.color.copy(Z).multiplyScalar(K),J.distance=ne,J.coneCos=Math.cos(N.angle),J.penumbraCos=Math.cos(N.angle*(1-N.penumbra)),J.decay=N.decay,r.spot[x]=J;const oe=N.shadow;if(N.map&&(r.spotLightMap[S]=N.map,S++,oe.updateMatrices(N),N.castShadow&&T++),r.spotLightMatrix[x]=oe.matrix,N.castShadow){const B=t.get(N);B.shadowIntensity=oe.intensity,B.shadowBias=oe.bias,B.shadowNormalBias=oe.normalBias,B.shadowRadius=oe.radius,B.shadowMapSize=oe.mapSize,r.spotShadow[x]=B,r.spotShadowMap[x]=ce,E++}x++}else if(N.isRectAreaLight){const J=e.get(N);J.color.copy(Z).multiplyScalar(K),J.halfWidth.set(N.width*.5,0,0),J.halfHeight.set(0,N.height*.5,0),r.rectArea[v]=J,v++}else if(N.isPointLight){const J=e.get(N);if(J.color.copy(N.color).multiplyScalar(N.intensity),J.distance=N.distance,J.decay=N.decay,N.castShadow){const oe=N.shadow,B=t.get(N);B.shadowIntensity=oe.intensity,B.shadowBias=oe.bias,B.shadowNormalBias=oe.normalBias,B.shadowRadius=oe.radius,B.shadowMapSize=oe.mapSize,B.shadowCameraNear=oe.camera.near,B.shadowCameraFar=oe.camera.far,r.pointShadow[m]=B,r.pointShadowMap[m]=ce,r.pointShadowMatrix[m]=N.shadow.matrix,M++}r.point[m]=J,m++}else if(N.isHemisphereLight){const J=e.get(N);J.skyColor.copy(N.color).multiplyScalar(K),J.groundColor.copy(N.groundColor).multiplyScalar(K),r.hemi[_]=J,_++}}v>0&&(n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ke.LTC_FLOAT_1,r.rectAreaLTC2=ke.LTC_FLOAT_2):(r.rectAreaLTC1=ke.LTC_HALF_1,r.rectAreaLTC2=ke.LTC_HALF_2)),r.ambient[0]=h,r.ambient[1]=f,r.ambient[2]=p;const O=r.hash;(O.directionalLength!==d||O.pointLength!==m||O.spotLength!==x||O.rectAreaLength!==v||O.hemiLength!==_||O.numDirectionalShadows!==b||O.numPointShadows!==M||O.numSpotShadows!==E||O.numSpotMaps!==S||O.numLightProbes!==q)&&(r.directional.length=d,r.spot.length=x,r.rectArea.length=v,r.point.length=m,r.hemi.length=_,r.directionalShadow.length=b,r.directionalShadowMap.length=b,r.pointShadow.length=M,r.pointShadowMap.length=M,r.spotShadow.length=E,r.spotShadowMap.length=E,r.directionalShadowMatrix.length=b,r.pointShadowMatrix.length=M,r.spotLightMatrix.length=E+S-T,r.spotLightMap.length=S,r.numSpotLightShadowsWithMaps=T,r.numLightProbes=q,O.directionalLength=d,O.pointLength=m,O.spotLength=x,O.rectAreaLength=v,O.hemiLength=_,O.numDirectionalShadows=b,O.numPointShadows=M,O.numSpotShadows=E,O.numSpotMaps=S,O.numLightProbes=q,r.version=JT++)}function l(c,h){let f=0,p=0,d=0,m=0,x=0;const v=h.matrixWorldInverse;for(let _=0,b=c.length;_<b;_++){const M=c[_];if(M.isDirectionalLight){const E=r.directional[f];E.direction.setFromMatrixPosition(M.matrixWorld),i.setFromMatrixPosition(M.target.matrixWorld),E.direction.sub(i),E.direction.transformDirection(v),f++}else if(M.isSpotLight){const E=r.spot[d];E.position.setFromMatrixPosition(M.matrixWorld),E.position.applyMatrix4(v),E.direction.setFromMatrixPosition(M.matrixWorld),i.setFromMatrixPosition(M.target.matrixWorld),E.direction.sub(i),E.direction.transformDirection(v),d++}else if(M.isRectAreaLight){const E=r.rectArea[m];E.position.setFromMatrixPosition(M.matrixWorld),E.position.applyMatrix4(v),o.identity(),s.copy(M.matrixWorld),s.premultiply(v),o.extractRotation(s),E.halfWidth.set(M.width*.5,0,0),E.halfHeight.set(0,M.height*.5,0),E.halfWidth.applyMatrix4(o),E.halfHeight.applyMatrix4(o),m++}else if(M.isPointLight){const E=r.point[p];E.position.setFromMatrixPosition(M.matrixWorld),E.position.applyMatrix4(v),p++}else if(M.isHemisphereLight){const E=r.hemi[x];E.direction.setFromMatrixPosition(M.matrixWorld),E.direction.transformDirection(v),x++}}}return{setup:a,setupView:l,state:r}}function Lv(n){const e=new e6(n),t=[],r=[];function i(h){c.camera=h,t.length=0,r.length=0}function s(h){t.push(h)}function o(h){r.push(h)}function a(){e.setup(t)}function l(h){e.setupView(t,h)}const c={lightsArray:t,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function t6(n){let e=new WeakMap;function t(i,s=0){const o=e.get(i);let a;return o===void 0?(a=new Lv(n),e.set(i,[a])):s>=o.length?(a=new Lv(n),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:t,dispose:r}}const n6=`void main() {
3866
3858
  gl_Position = vec4( position, 1.0 );
3867
3859
  }`,r6=`uniform sampler2D shadow_pass;
3868
3860
  uniform vec2 resolution;
@@ -3890,7 +3882,7 @@ void main() {
3890
3882
  squared_mean = squared_mean / samples;
3891
3883
  float std_dev = sqrt( squared_mean - mean * mean );
3892
3884
  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3893
- }`;function i6(n,e,t){let r=new Ep;const i=new Be,s=new Be,o=new pn,a=new JM({depthPacking:Pb}),l=new QM,c={},h=t.maxTextureSize,f={[gs]:lr,[lr]:gs,[Ci]:Ci},p=new Ts({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Be},radius:{value:4}},vertexShader:n6,fragmentShader:r6}),d=p.clone();d.defines.HORIZONTAL_PASS=1;const m=new ur;m.setAttribute("position",new kr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Dn(m,p),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=B1;let _=this.type;this.render=function(T,q,O){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||T.length===0)return;const A=n.getRenderTarget(),L=n.getActiveCubeFace(),N=n.getActiveMipmapLevel(),Z=n.state;Z.setBlending(_s),Z.buffers.depth.getReversed()?Z.buffers.color.setClear(0,0,0,0):Z.buffers.color.setClear(1,1,1,1),Z.buffers.depth.setTest(!0),Z.setScissorTest(!1);const Y=_!==Wi&&this.type===Wi,ee=_===Wi&&this.type!==Wi;for(let ue=0,te=T.length;ue<te;ue++){const ae=T[ue],B=ae.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",ae,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;i.copy(B.mapSize);const Se=B.getFrameExtents();if(i.multiply(Se),s.copy(B.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/Se.x),i.x=s.x*Se.x,B.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/Se.y),i.y=s.y*Se.y,B.mapSize.y=s.y)),B.map===null||Y===!0||ee===!0){const oe=this.type!==Wi?{minFilter:ni,magFilter:ni}:{};B.map!==null&&B.map.dispose(),B.map=new eo(i.x,i.y,oe),B.map.texture.name=ae.name+".shadowMap",B.camera.updateProjectionMatrix()}n.setRenderTarget(B.map),n.clear();const $=B.getViewportCount();for(let oe=0;oe<$;oe++){const Ae=B.getViewport(oe);o.set(s.x*Ae.x,s.y*Ae.y,s.x*Ae.z,s.y*Ae.w),Z.viewport(o),B.updateMatrices(ae,oe),r=B.getFrustum(),b(q,O,B.camera,ae,this.type)}B.isPointLightShadow!==!0&&this.type===Wi&&E(B,O),B.needsUpdate=!1}_=this.type,v.needsUpdate=!1,n.setRenderTarget(A,L,N)};function E(T,q){const O=e.update(x);p.defines.VSM_SAMPLES!==T.blurSamples&&(p.defines.VSM_SAMPLES=T.blurSamples,d.defines.VSM_SAMPLES=T.blurSamples,p.needsUpdate=!0,d.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new eo(i.x,i.y)),p.uniforms.shadow_pass.value=T.map.texture,p.uniforms.resolution.value=T.mapSize,p.uniforms.radius.value=T.radius,n.setRenderTarget(T.mapPass),n.clear(),n.renderBufferDirect(q,null,O,p,x,null),d.uniforms.shadow_pass.value=T.mapPass.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radius,n.setRenderTarget(T.map),n.clear(),n.renderBufferDirect(q,null,O,d,x,null)}function M(T,q,O,A){let L=null;const N=O.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(N!==void 0)L=N;else if(L=O.isPointLight===!0?l:a,n.localClippingEnabled&&q.clipShadows===!0&&Array.isArray(q.clippingPlanes)&&q.clippingPlanes.length!==0||q.displacementMap&&q.displacementScale!==0||q.alphaMap&&q.alphaTest>0||q.map&&q.alphaTest>0||q.alphaToCoverage===!0){const Z=L.uuid,Y=q.uuid;let ee=c[Z];ee===void 0&&(ee={},c[Z]=ee);let ue=ee[Y];ue===void 0&&(ue=L.clone(),ee[Y]=ue,q.addEventListener("dispose",S)),L=ue}if(L.visible=q.visible,L.wireframe=q.wireframe,A===Wi?L.side=q.shadowSide!==null?q.shadowSide:q.side:L.side=q.shadowSide!==null?q.shadowSide:f[q.side],L.alphaMap=q.alphaMap,L.alphaTest=q.alphaToCoverage===!0?.5:q.alphaTest,L.map=q.map,L.clipShadows=q.clipShadows,L.clippingPlanes=q.clippingPlanes,L.clipIntersection=q.clipIntersection,L.displacementMap=q.displacementMap,L.displacementScale=q.displacementScale,L.displacementBias=q.displacementBias,L.wireframeLinewidth=q.wireframeLinewidth,L.linewidth=q.linewidth,O.isPointLight===!0&&L.isMeshDistanceMaterial===!0){const Z=n.properties.get(L);Z.light=O}return L}function b(T,q,O,A,L){if(T.visible===!1)return;if(T.layers.test(q.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&L===Wi)&&(!T.frustumCulled||r.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,T.matrixWorld);const Y=e.update(T),ee=T.material;if(Array.isArray(ee)){const ue=Y.groups;for(let te=0,ae=ue.length;te<ae;te++){const B=ue[te],Se=ee[B.materialIndex];if(Se&&Se.visible){const $=M(T,Se,A,L);T.onBeforeShadow(n,T,q,O,Y,$,B),n.renderBufferDirect(O,null,Y,$,T,B),T.onAfterShadow(n,T,q,O,Y,$,B)}}}else if(ee.visible){const ue=M(T,ee,A,L);T.onBeforeShadow(n,T,q,O,Y,ue,null),n.renderBufferDirect(O,null,Y,ue,T,null),T.onAfterShadow(n,T,q,O,Y,ue,null)}}const Z=T.children;for(let Y=0,ee=Z.length;Y<ee;Y++)b(Z[Y],q,O,A,L)}function S(T){T.target.removeEventListener("dispose",S);for(const O in c){const A=c[O],L=T.target.uuid;L in A&&(A[L].dispose(),delete A[L])}}}const s6={[od]:ad,[ld]:hd,[cd]:fd,[Xo]:ud,[ad]:od,[hd]:ld,[fd]:cd,[ud]:Xo};function o6(n,e){function t(){let H=!1;const _e=new pn;let Oe=null;const Ve=new pn(0,0,0,0);return{setMask:function(we){Oe!==we&&!H&&(n.colorMask(we,we,we,we),Oe=we)},setLocked:function(we){H=we},setClear:function(we,me,Qe,ft,Ot){Ot===!0&&(we*=ft,me*=ft,Qe*=ft),_e.set(we,me,Qe,ft),Ve.equals(_e)===!1&&(n.clearColor(we,me,Qe,ft),Ve.copy(_e))},reset:function(){H=!1,Oe=null,Ve.set(-1,0,0,0)}}}function r(){let H=!1,_e=!1,Oe=null,Ve=null,we=null;return{setReversed:function(me){if(_e!==me){const Qe=e.get("EXT_clip_control");me?Qe.clipControlEXT(Qe.LOWER_LEFT_EXT,Qe.ZERO_TO_ONE_EXT):Qe.clipControlEXT(Qe.LOWER_LEFT_EXT,Qe.NEGATIVE_ONE_TO_ONE_EXT),_e=me;const ft=we;we=null,this.setClear(ft)}},getReversed:function(){return _e},setTest:function(me){me?X(n.DEPTH_TEST):pe(n.DEPTH_TEST)},setMask:function(me){Oe!==me&&!H&&(n.depthMask(me),Oe=me)},setFunc:function(me){if(_e&&(me=s6[me]),Ve!==me){switch(me){case od:n.depthFunc(n.NEVER);break;case ad:n.depthFunc(n.ALWAYS);break;case ld:n.depthFunc(n.LESS);break;case Xo:n.depthFunc(n.LEQUAL);break;case cd:n.depthFunc(n.EQUAL);break;case ud:n.depthFunc(n.GEQUAL);break;case hd:n.depthFunc(n.GREATER);break;case fd:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}Ve=me}},setLocked:function(me){H=me},setClear:function(me){we!==me&&(_e&&(me=1-me),n.clearDepth(me),we=me)},reset:function(){H=!1,Oe=null,Ve=null,we=null,_e=!1}}}function i(){let H=!1,_e=null,Oe=null,Ve=null,we=null,me=null,Qe=null,ft=null,Ot=null;return{setTest:function(_t){H||(_t?X(n.STENCIL_TEST):pe(n.STENCIL_TEST))},setMask:function(_t){_e!==_t&&!H&&(n.stencilMask(_t),_e=_t)},setFunc:function(_t,Ar,jn){(Oe!==_t||Ve!==Ar||we!==jn)&&(n.stencilFunc(_t,Ar,jn),Oe=_t,Ve=Ar,we=jn)},setOp:function(_t,Ar,jn){(me!==_t||Qe!==Ar||ft!==jn)&&(n.stencilOp(_t,Ar,jn),me=_t,Qe=Ar,ft=jn)},setLocked:function(_t){H=_t},setClear:function(_t){Ot!==_t&&(n.clearStencil(_t),Ot=_t)},reset:function(){H=!1,_e=null,Oe=null,Ve=null,we=null,me=null,Qe=null,ft=null,Ot=null}}}const s=new t,o=new r,a=new i,l=new WeakMap,c=new WeakMap;let h={},f={},p=new WeakMap,d=[],m=null,x=!1,v=null,_=null,E=null,M=null,b=null,S=null,T=null,q=new Ct(0,0,0),O=0,A=!1,L=null,N=null,Z=null,Y=null,ee=null;const ue=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let te=!1,ae=0;const B=n.getParameter(n.VERSION);B.indexOf("WebGL")!==-1?(ae=parseFloat(/^WebGL (\d)/.exec(B)[1]),te=ae>=1):B.indexOf("OpenGL ES")!==-1&&(ae=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),te=ae>=2);let Se=null,$={};const oe=n.getParameter(n.SCISSOR_BOX),Ae=n.getParameter(n.VIEWPORT),Ie=new pn().fromArray(oe),Ce=new pn().fromArray(Ae);function V(H,_e,Oe,Ve){const we=new Uint8Array(4),me=n.createTexture();n.bindTexture(H,me),n.texParameteri(H,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(H,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Qe=0;Qe<Oe;Qe++)H===n.TEXTURE_3D||H===n.TEXTURE_2D_ARRAY?n.texImage3D(_e,0,n.RGBA,1,1,Ve,0,n.RGBA,n.UNSIGNED_BYTE,we):n.texImage2D(_e+Qe,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,we);return me}const ne={};ne[n.TEXTURE_2D]=V(n.TEXTURE_2D,n.TEXTURE_2D,1),ne[n.TEXTURE_CUBE_MAP]=V(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),ne[n.TEXTURE_2D_ARRAY]=V(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),ne[n.TEXTURE_3D]=V(n.TEXTURE_3D,n.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),X(n.DEPTH_TEST),o.setFunc(Xo),Ge(!1),De(k1),X(n.CULL_FACE),lt(_s);function X(H){h[H]!==!0&&(n.enable(H),h[H]=!0)}function pe(H){h[H]!==!1&&(n.disable(H),h[H]=!1)}function Ee(H,_e){return f[H]!==_e?(n.bindFramebuffer(H,_e),f[H]=_e,H===n.DRAW_FRAMEBUFFER&&(f[n.FRAMEBUFFER]=_e),H===n.FRAMEBUFFER&&(f[n.DRAW_FRAMEBUFFER]=_e),!0):!1}function Q(H,_e){let Oe=d,Ve=!1;if(H){Oe=p.get(_e),Oe===void 0&&(Oe=[],p.set(_e,Oe));const we=H.textures;if(Oe.length!==we.length||Oe[0]!==n.COLOR_ATTACHMENT0){for(let me=0,Qe=we.length;me<Qe;me++)Oe[me]=n.COLOR_ATTACHMENT0+me;Oe.length=we.length,Ve=!0}}else Oe[0]!==n.BACK&&(Oe[0]=n.BACK,Ve=!0);Ve&&n.drawBuffers(Oe)}function Ne(H){return m!==H?(n.useProgram(H),m=H,!0):!1}const le={[Ys]:n.FUNC_ADD,[nb]:n.FUNC_SUBTRACT,[rb]:n.FUNC_REVERSE_SUBTRACT};le[ib]=n.MIN,le[sb]=n.MAX;const F={[ob]:n.ZERO,[ab]:n.ONE,[lb]:n.SRC_COLOR,[id]:n.SRC_ALPHA,[pb]:n.SRC_ALPHA_SATURATE,[fb]:n.DST_COLOR,[ub]:n.DST_ALPHA,[cb]:n.ONE_MINUS_SRC_COLOR,[sd]:n.ONE_MINUS_SRC_ALPHA,[db]:n.ONE_MINUS_DST_COLOR,[hb]:n.ONE_MINUS_DST_ALPHA,[mb]:n.CONSTANT_COLOR,[gb]:n.ONE_MINUS_CONSTANT_COLOR,[_b]:n.CONSTANT_ALPHA,[vb]:n.ONE_MINUS_CONSTANT_ALPHA};function lt(H,_e,Oe,Ve,we,me,Qe,ft,Ot,_t){if(H===_s){x===!0&&(pe(n.BLEND),x=!1);return}if(x===!1&&(X(n.BLEND),x=!0),H!==tb){if(H!==v||_t!==A){if((_!==Ys||b!==Ys)&&(n.blendEquation(n.FUNC_ADD),_=Ys,b=Ys),_t)switch(H){case jo:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case V1:n.blendFunc(n.ONE,n.ONE);break;case H1:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case G1:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:console.error("THREE.WebGLState: Invalid blending: ",H);break}else switch(H){case jo:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case V1:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case H1:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case G1:console.error("THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:console.error("THREE.WebGLState: Invalid blending: ",H);break}E=null,M=null,S=null,T=null,q.set(0,0,0),O=0,v=H,A=_t}return}we=we||_e,me=me||Oe,Qe=Qe||Ve,(_e!==_||we!==b)&&(n.blendEquationSeparate(le[_e],le[we]),_=_e,b=we),(Oe!==E||Ve!==M||me!==S||Qe!==T)&&(n.blendFuncSeparate(F[Oe],F[Ve],F[me],F[Qe]),E=Oe,M=Ve,S=me,T=Qe),(ft.equals(q)===!1||Ot!==O)&&(n.blendColor(ft.r,ft.g,ft.b,Ot),q.copy(ft),O=Ot),v=H,A=!1}function Le(H,_e){H.side===Ci?pe(n.CULL_FACE):X(n.CULL_FACE);let Oe=H.side===lr;_e&&(Oe=!Oe),Ge(Oe),H.blending===jo&&H.transparent===!1?lt(_s):lt(H.blending,H.blendEquation,H.blendSrc,H.blendDst,H.blendEquationAlpha,H.blendSrcAlpha,H.blendDstAlpha,H.blendColor,H.blendAlpha,H.premultipliedAlpha),o.setFunc(H.depthFunc),o.setTest(H.depthTest),o.setMask(H.depthWrite),s.setMask(H.colorWrite);const Ve=H.stencilWrite;a.setTest(Ve),Ve&&(a.setMask(H.stencilWriteMask),a.setFunc(H.stencilFunc,H.stencilRef,H.stencilFuncMask),a.setOp(H.stencilFail,H.stencilZFail,H.stencilZPass)),ge(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),H.alphaToCoverage===!0?X(n.SAMPLE_ALPHA_TO_COVERAGE):pe(n.SAMPLE_ALPHA_TO_COVERAGE)}function Ge(H){L!==H&&(H?n.frontFace(n.CW):n.frontFace(n.CCW),L=H)}function De(H){H!==JE?(X(n.CULL_FACE),H!==N&&(H===k1?n.cullFace(n.BACK):H===QE?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):pe(n.CULL_FACE),N=H}function Ue(H){H!==Z&&(te&&n.lineWidth(H),Z=H)}function ge(H,_e,Oe){H?(X(n.POLYGON_OFFSET_FILL),(Y!==_e||ee!==Oe)&&(n.polygonOffset(_e,Oe),Y=_e,ee=Oe)):pe(n.POLYGON_OFFSET_FILL)}function $e(H){H?X(n.SCISSOR_TEST):pe(n.SCISSOR_TEST)}function ot(H){H===void 0&&(H=n.TEXTURE0+ue-1),Se!==H&&(n.activeTexture(H),Se=H)}function wt(H,_e,Oe){Oe===void 0&&(Se===null?Oe=n.TEXTURE0+ue-1:Oe=Se);let Ve=$[Oe];Ve===void 0&&(Ve={type:void 0,texture:void 0},$[Oe]=Ve),(Ve.type!==H||Ve.texture!==_e)&&(Se!==Oe&&(n.activeTexture(Oe),Se=Oe),n.bindTexture(H,_e||ne[H]),Ve.type=H,Ve.texture=_e)}function U(){const H=$[Se];H!==void 0&&H.type!==void 0&&(n.bindTexture(H.type,null),H.type=void 0,H.texture=void 0)}function I(){try{n.compressedTexImage2D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function J(){try{n.compressedTexImage3D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function de(){try{n.texSubImage2D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function be(){try{n.texSubImage3D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function fe(){try{n.compressedTexSubImage2D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function Fe(){try{n.compressedTexSubImage3D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function Te(){try{n.texStorage2D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function Ye(){try{n.texStorage3D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function Ke(){try{n.texImage2D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function Re(){try{n.texImage3D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function ze(H){Ie.equals(H)===!1&&(n.scissor(H.x,H.y,H.z,H.w),Ie.copy(H))}function We(H){Ce.equals(H)===!1&&(n.viewport(H.x,H.y,H.z,H.w),Ce.copy(H))}function tt(H,_e){let Oe=c.get(_e);Oe===void 0&&(Oe=new WeakMap,c.set(_e,Oe));let Ve=Oe.get(H);Ve===void 0&&(Ve=n.getUniformBlockIndex(_e,H.name),Oe.set(H,Ve))}function Pe(H,_e){const Ve=c.get(_e).get(H);l.get(_e)!==Ve&&(n.uniformBlockBinding(_e,Ve,H.__bindingPointIndex),l.set(_e,Ve))}function gt(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),o.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),h={},Se=null,$={},f={},p=new WeakMap,d=[],m=null,x=!1,v=null,_=null,E=null,M=null,b=null,S=null,T=null,q=new Ct(0,0,0),O=0,A=!1,L=null,N=null,Z=null,Y=null,ee=null,Ie.set(0,0,n.canvas.width,n.canvas.height),Ce.set(0,0,n.canvas.width,n.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:X,disable:pe,bindFramebuffer:Ee,drawBuffers:Q,useProgram:Ne,setBlending:lt,setMaterial:Le,setFlipSided:Ge,setCullFace:De,setLineWidth:Ue,setPolygonOffset:ge,setScissorTest:$e,activeTexture:ot,bindTexture:wt,unbindTexture:U,compressedTexImage2D:I,compressedTexImage3D:J,texImage2D:Ke,texImage3D:Re,updateUBOMapping:tt,uniformBlockBinding:Pe,texStorage2D:Te,texStorage3D:Ye,texSubImage2D:de,texSubImage3D:be,compressedTexSubImage2D:fe,compressedTexSubImage3D:Fe,scissor:ze,viewport:We,reset:gt}}function a6(n,e,t,r,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Be,h=new WeakMap;let f;const p=new WeakMap;let d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(U,I){return d?new OffscreenCanvas(U,I):xl("canvas")}function x(U,I,J){let de=1;const be=wt(U);if((be.width>J||be.height>J)&&(de=J/Math.max(be.width,be.height)),de<1)if(typeof HTMLImageElement<"u"&&U instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&U instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&U instanceof ImageBitmap||typeof VideoFrame<"u"&&U instanceof VideoFrame){const fe=Math.floor(de*be.width),Fe=Math.floor(de*be.height);f===void 0&&(f=m(fe,Fe));const Te=I?m(fe,Fe):f;return Te.width=fe,Te.height=Fe,Te.getContext("2d").drawImage(U,0,0,fe,Fe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+be.width+"x"+be.height+") to ("+fe+"x"+Fe+")."),Te}else return"data"in U&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+be.width+"x"+be.height+")."),U;return U}function v(U){return U.generateMipmaps}function _(U){n.generateMipmap(U)}function E(U){return U.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:U.isWebGL3DRenderTarget?n.TEXTURE_3D:U.isWebGLArrayRenderTarget||U.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function M(U,I,J,de,be=!1){if(U!==null){if(n[U]!==void 0)return n[U];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+U+"'")}let fe=I;if(I===n.RED&&(J===n.FLOAT&&(fe=n.R32F),J===n.HALF_FLOAT&&(fe=n.R16F),J===n.UNSIGNED_BYTE&&(fe=n.R8)),I===n.RED_INTEGER&&(J===n.UNSIGNED_BYTE&&(fe=n.R8UI),J===n.UNSIGNED_SHORT&&(fe=n.R16UI),J===n.UNSIGNED_INT&&(fe=n.R32UI),J===n.BYTE&&(fe=n.R8I),J===n.SHORT&&(fe=n.R16I),J===n.INT&&(fe=n.R32I)),I===n.RG&&(J===n.FLOAT&&(fe=n.RG32F),J===n.HALF_FLOAT&&(fe=n.RG16F),J===n.UNSIGNED_BYTE&&(fe=n.RG8)),I===n.RG_INTEGER&&(J===n.UNSIGNED_BYTE&&(fe=n.RG8UI),J===n.UNSIGNED_SHORT&&(fe=n.RG16UI),J===n.UNSIGNED_INT&&(fe=n.RG32UI),J===n.BYTE&&(fe=n.RG8I),J===n.SHORT&&(fe=n.RG16I),J===n.INT&&(fe=n.RG32I)),I===n.RGB_INTEGER&&(J===n.UNSIGNED_BYTE&&(fe=n.RGB8UI),J===n.UNSIGNED_SHORT&&(fe=n.RGB16UI),J===n.UNSIGNED_INT&&(fe=n.RGB32UI),J===n.BYTE&&(fe=n.RGB8I),J===n.SHORT&&(fe=n.RGB16I),J===n.INT&&(fe=n.RGB32I)),I===n.RGBA_INTEGER&&(J===n.UNSIGNED_BYTE&&(fe=n.RGBA8UI),J===n.UNSIGNED_SHORT&&(fe=n.RGBA16UI),J===n.UNSIGNED_INT&&(fe=n.RGBA32UI),J===n.BYTE&&(fe=n.RGBA8I),J===n.SHORT&&(fe=n.RGBA16I),J===n.INT&&(fe=n.RGBA32I)),I===n.RGB&&J===n.UNSIGNED_INT_5_9_9_9_REV&&(fe=n.RGB9_E5),I===n.RGBA){const Fe=be?Jc:Nt.getTransfer(de);J===n.FLOAT&&(fe=n.RGBA32F),J===n.HALF_FLOAT&&(fe=n.RGBA16F),J===n.UNSIGNED_BYTE&&(fe=Fe===Gt?n.SRGB8_ALPHA8:n.RGBA8),J===n.UNSIGNED_SHORT_4_4_4_4&&(fe=n.RGBA4),J===n.UNSIGNED_SHORT_5_5_5_1&&(fe=n.RGB5_A1)}return(fe===n.R16F||fe===n.R32F||fe===n.RG16F||fe===n.RG32F||fe===n.RGBA16F||fe===n.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function b(U,I){let J;return U?I===null||I===Js||I===ml?J=n.DEPTH24_STENCIL8:I===ji?J=n.DEPTH32F_STENCIL8:I===dl&&(J=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):I===null||I===Js||I===ml?J=n.DEPTH_COMPONENT24:I===ji?J=n.DEPTH_COMPONENT32F:I===dl&&(J=n.DEPTH_COMPONENT16),J}function S(U,I){return v(U)===!0||U.isFramebufferTexture&&U.minFilter!==ni&&U.minFilter!==Ri?Math.log2(Math.max(I.width,I.height))+1:U.mipmaps!==void 0&&U.mipmaps.length>0?U.mipmaps.length:U.isCompressedTexture&&Array.isArray(U.image)?I.mipmaps.length:1}function T(U){const I=U.target;I.removeEventListener("dispose",T),O(I),I.isVideoTexture&&h.delete(I)}function q(U){const I=U.target;I.removeEventListener("dispose",q),L(I)}function O(U){const I=r.get(U);if(I.__webglInit===void 0)return;const J=U.source,de=p.get(J);if(de){const be=de[I.__cacheKey];be.usedTimes--,be.usedTimes===0&&A(U),Object.keys(de).length===0&&p.delete(J)}r.remove(U)}function A(U){const I=r.get(U);n.deleteTexture(I.__webglTexture);const J=U.source,de=p.get(J);delete de[I.__cacheKey],o.memory.textures--}function L(U){const I=r.get(U);if(U.depthTexture&&(U.depthTexture.dispose(),r.remove(U.depthTexture)),U.isWebGLCubeRenderTarget)for(let de=0;de<6;de++){if(Array.isArray(I.__webglFramebuffer[de]))for(let be=0;be<I.__webglFramebuffer[de].length;be++)n.deleteFramebuffer(I.__webglFramebuffer[de][be]);else n.deleteFramebuffer(I.__webglFramebuffer[de]);I.__webglDepthbuffer&&n.deleteRenderbuffer(I.__webglDepthbuffer[de])}else{if(Array.isArray(I.__webglFramebuffer))for(let de=0;de<I.__webglFramebuffer.length;de++)n.deleteFramebuffer(I.__webglFramebuffer[de]);else n.deleteFramebuffer(I.__webglFramebuffer);if(I.__webglDepthbuffer&&n.deleteRenderbuffer(I.__webglDepthbuffer),I.__webglMultisampledFramebuffer&&n.deleteFramebuffer(I.__webglMultisampledFramebuffer),I.__webglColorRenderbuffer)for(let de=0;de<I.__webglColorRenderbuffer.length;de++)I.__webglColorRenderbuffer[de]&&n.deleteRenderbuffer(I.__webglColorRenderbuffer[de]);I.__webglDepthRenderbuffer&&n.deleteRenderbuffer(I.__webglDepthRenderbuffer)}const J=U.textures;for(let de=0,be=J.length;de<be;de++){const fe=r.get(J[de]);fe.__webglTexture&&(n.deleteTexture(fe.__webglTexture),o.memory.textures--),r.remove(J[de])}r.remove(U)}let N=0;function Z(){N=0}function Y(){const U=N;return U>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+U+" texture units while this GPU supports only "+i.maxTextures),N+=1,U}function ee(U){const I=[];return I.push(U.wrapS),I.push(U.wrapT),I.push(U.wrapR||0),I.push(U.magFilter),I.push(U.minFilter),I.push(U.anisotropy),I.push(U.internalFormat),I.push(U.format),I.push(U.type),I.push(U.generateMipmaps),I.push(U.premultiplyAlpha),I.push(U.flipY),I.push(U.unpackAlignment),I.push(U.colorSpace),I.join()}function ue(U,I){const J=r.get(U);if(U.isVideoTexture&&$e(U),U.isRenderTargetTexture===!1&&U.isExternalTexture!==!0&&U.version>0&&J.__version!==U.version){const de=U.image;if(de===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(de.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ne(J,U,I);return}}else U.isExternalTexture&&(J.__webglTexture=U.sourceTexture?U.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,J.__webglTexture,n.TEXTURE0+I)}function te(U,I){const J=r.get(U);if(U.isRenderTargetTexture===!1&&U.version>0&&J.__version!==U.version){ne(J,U,I);return}t.bindTexture(n.TEXTURE_2D_ARRAY,J.__webglTexture,n.TEXTURE0+I)}function ae(U,I){const J=r.get(U);if(U.isRenderTargetTexture===!1&&U.version>0&&J.__version!==U.version){ne(J,U,I);return}t.bindTexture(n.TEXTURE_3D,J.__webglTexture,n.TEXTURE0+I)}function B(U,I){const J=r.get(U);if(U.version>0&&J.__version!==U.version){X(J,U,I);return}t.bindTexture(n.TEXTURE_CUBE_MAP,J.__webglTexture,n.TEXTURE0+I)}const Se={[ti]:n.REPEAT,[Ks]:n.CLAMP_TO_EDGE,[gd]:n.MIRRORED_REPEAT},$={[ni]:n.NEAREST,[Cb]:n.NEAREST_MIPMAP_NEAREST,[jc]:n.NEAREST_MIPMAP_LINEAR,[Ri]:n.LINEAR,[_d]:n.LINEAR_MIPMAP_NEAREST,[Zs]:n.LINEAR_MIPMAP_LINEAR},oe={[Lb]:n.NEVER,[Fb]:n.ALWAYS,[Ob]:n.LESS,[t_]:n.LEQUAL,[qb]:n.EQUAL,[Ub]:n.GEQUAL,[Db]:n.GREATER,[Nb]:n.NOTEQUAL};function Ae(U,I){if(I.type===ji&&e.has("OES_texture_float_linear")===!1&&(I.magFilter===Ri||I.magFilter===_d||I.magFilter===jc||I.magFilter===Zs||I.minFilter===Ri||I.minFilter===_d||I.minFilter===jc||I.minFilter===Zs)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(U,n.TEXTURE_WRAP_S,Se[I.wrapS]),n.texParameteri(U,n.TEXTURE_WRAP_T,Se[I.wrapT]),(U===n.TEXTURE_3D||U===n.TEXTURE_2D_ARRAY)&&n.texParameteri(U,n.TEXTURE_WRAP_R,Se[I.wrapR]),n.texParameteri(U,n.TEXTURE_MAG_FILTER,$[I.magFilter]),n.texParameteri(U,n.TEXTURE_MIN_FILTER,$[I.minFilter]),I.compareFunction&&(n.texParameteri(U,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(U,n.TEXTURE_COMPARE_FUNC,oe[I.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(I.magFilter===ni||I.minFilter!==jc&&I.minFilter!==Zs||I.type===ji&&e.has("OES_texture_float_linear")===!1)return;if(I.anisotropy>1||r.get(I).__currentAnisotropy){const J=e.get("EXT_texture_filter_anisotropic");n.texParameterf(U,J.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,i.getMaxAnisotropy())),r.get(I).__currentAnisotropy=I.anisotropy}}}function Ie(U,I){let J=!1;U.__webglInit===void 0&&(U.__webglInit=!0,I.addEventListener("dispose",T));const de=I.source;let be=p.get(de);be===void 0&&(be={},p.set(de,be));const fe=ee(I);if(fe!==U.__cacheKey){be[fe]===void 0&&(be[fe]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,J=!0),be[fe].usedTimes++;const Fe=be[U.__cacheKey];Fe!==void 0&&(be[U.__cacheKey].usedTimes--,Fe.usedTimes===0&&A(I)),U.__cacheKey=fe,U.__webglTexture=be[fe].texture}return J}function Ce(U,I,J){return Math.floor(Math.floor(U/J)/I)}function V(U,I,J,de){const fe=U.updateRanges;if(fe.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,I.width,I.height,J,de,I.data);else{fe.sort((Re,ze)=>Re.start-ze.start);let Fe=0;for(let Re=1;Re<fe.length;Re++){const ze=fe[Fe],We=fe[Re],tt=ze.start+ze.count,Pe=Ce(We.start,I.width,4),gt=Ce(ze.start,I.width,4);We.start<=tt+1&&Pe===gt&&Ce(We.start+We.count-1,I.width,4)===Pe?ze.count=Math.max(ze.count,We.start+We.count-ze.start):(++Fe,fe[Fe]=We)}fe.length=Fe+1;const Te=n.getParameter(n.UNPACK_ROW_LENGTH),Ye=n.getParameter(n.UNPACK_SKIP_PIXELS),Ke=n.getParameter(n.UNPACK_SKIP_ROWS);n.pixelStorei(n.UNPACK_ROW_LENGTH,I.width);for(let Re=0,ze=fe.length;Re<ze;Re++){const We=fe[Re],tt=Math.floor(We.start/4),Pe=Math.ceil(We.count/4),gt=tt%I.width,H=Math.floor(tt/I.width),_e=Pe,Oe=1;n.pixelStorei(n.UNPACK_SKIP_PIXELS,gt),n.pixelStorei(n.UNPACK_SKIP_ROWS,H),t.texSubImage2D(n.TEXTURE_2D,0,gt,H,_e,Oe,J,de,I.data)}U.clearUpdateRanges(),n.pixelStorei(n.UNPACK_ROW_LENGTH,Te),n.pixelStorei(n.UNPACK_SKIP_PIXELS,Ye),n.pixelStorei(n.UNPACK_SKIP_ROWS,Ke)}}function ne(U,I,J){let de=n.TEXTURE_2D;(I.isDataArrayTexture||I.isCompressedArrayTexture)&&(de=n.TEXTURE_2D_ARRAY),I.isData3DTexture&&(de=n.TEXTURE_3D);const be=Ie(U,I),fe=I.source;t.bindTexture(de,U.__webglTexture,n.TEXTURE0+J);const Fe=r.get(fe);if(fe.version!==Fe.__version||be===!0){t.activeTexture(n.TEXTURE0+J);const Te=Nt.getPrimaries(Nt.workingColorSpace),Ye=I.colorSpace===xs?null:Nt.getPrimaries(I.colorSpace),Ke=I.colorSpace===xs||Te===Ye?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,I.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,I.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ke);let Re=x(I.image,!1,i.maxTextureSize);Re=ot(I,Re);const ze=s.convert(I.format,I.colorSpace),We=s.convert(I.type);let tt=M(I.internalFormat,ze,We,I.colorSpace,I.isVideoTexture);Ae(de,I);let Pe;const gt=I.mipmaps,H=I.isVideoTexture!==!0,_e=Fe.__version===void 0||be===!0,Oe=fe.dataReady,Ve=S(I,Re);if(I.isDepthTexture)tt=b(I.format===_l,I.type),_e&&(H?t.texStorage2D(n.TEXTURE_2D,1,tt,Re.width,Re.height):t.texImage2D(n.TEXTURE_2D,0,tt,Re.width,Re.height,0,ze,We,null));else if(I.isDataTexture)if(gt.length>0){H&&_e&&t.texStorage2D(n.TEXTURE_2D,Ve,tt,gt[0].width,gt[0].height);for(let we=0,me=gt.length;we<me;we++)Pe=gt[we],H?Oe&&t.texSubImage2D(n.TEXTURE_2D,we,0,0,Pe.width,Pe.height,ze,We,Pe.data):t.texImage2D(n.TEXTURE_2D,we,tt,Pe.width,Pe.height,0,ze,We,Pe.data);I.generateMipmaps=!1}else H?(_e&&t.texStorage2D(n.TEXTURE_2D,Ve,tt,Re.width,Re.height),Oe&&V(I,Re,ze,We)):t.texImage2D(n.TEXTURE_2D,0,tt,Re.width,Re.height,0,ze,We,Re.data);else if(I.isCompressedTexture)if(I.isCompressedArrayTexture){H&&_e&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ve,tt,gt[0].width,gt[0].height,Re.depth);for(let we=0,me=gt.length;we<me;we++)if(Pe=gt[we],I.format!==ri)if(ze!==null)if(H){if(Oe)if(I.layerUpdates.size>0){const Qe=rv(Pe.width,Pe.height,I.format,I.type);for(const ft of I.layerUpdates){const Ot=Pe.data.subarray(ft*Qe/Pe.data.BYTES_PER_ELEMENT,(ft+1)*Qe/Pe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,we,0,0,ft,Pe.width,Pe.height,1,ze,Ot)}I.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,we,0,0,0,Pe.width,Pe.height,Re.depth,ze,Pe.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,we,tt,Pe.width,Pe.height,Re.depth,0,Pe.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else H?Oe&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,we,0,0,0,Pe.width,Pe.height,Re.depth,ze,We,Pe.data):t.texImage3D(n.TEXTURE_2D_ARRAY,we,tt,Pe.width,Pe.height,Re.depth,0,ze,We,Pe.data)}else{H&&_e&&t.texStorage2D(n.TEXTURE_2D,Ve,tt,gt[0].width,gt[0].height);for(let we=0,me=gt.length;we<me;we++)Pe=gt[we],I.format!==ri?ze!==null?H?Oe&&t.compressedTexSubImage2D(n.TEXTURE_2D,we,0,0,Pe.width,Pe.height,ze,Pe.data):t.compressedTexImage2D(n.TEXTURE_2D,we,tt,Pe.width,Pe.height,0,Pe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):H?Oe&&t.texSubImage2D(n.TEXTURE_2D,we,0,0,Pe.width,Pe.height,ze,We,Pe.data):t.texImage2D(n.TEXTURE_2D,we,tt,Pe.width,Pe.height,0,ze,We,Pe.data)}else if(I.isDataArrayTexture)if(H){if(_e&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ve,tt,Re.width,Re.height,Re.depth),Oe)if(I.layerUpdates.size>0){const we=rv(Re.width,Re.height,I.format,I.type);for(const me of I.layerUpdates){const Qe=Re.data.subarray(me*we/Re.data.BYTES_PER_ELEMENT,(me+1)*we/Re.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,me,Re.width,Re.height,1,ze,We,Qe)}I.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Re.width,Re.height,Re.depth,ze,We,Re.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,tt,Re.width,Re.height,Re.depth,0,ze,We,Re.data);else if(I.isData3DTexture)H?(_e&&t.texStorage3D(n.TEXTURE_3D,Ve,tt,Re.width,Re.height,Re.depth),Oe&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Re.width,Re.height,Re.depth,ze,We,Re.data)):t.texImage3D(n.TEXTURE_3D,0,tt,Re.width,Re.height,Re.depth,0,ze,We,Re.data);else if(I.isFramebufferTexture){if(_e)if(H)t.texStorage2D(n.TEXTURE_2D,Ve,tt,Re.width,Re.height);else{let we=Re.width,me=Re.height;for(let Qe=0;Qe<Ve;Qe++)t.texImage2D(n.TEXTURE_2D,Qe,tt,we,me,0,ze,We,null),we>>=1,me>>=1}}else if(gt.length>0){if(H&&_e){const we=wt(gt[0]);t.texStorage2D(n.TEXTURE_2D,Ve,tt,we.width,we.height)}for(let we=0,me=gt.length;we<me;we++)Pe=gt[we],H?Oe&&t.texSubImage2D(n.TEXTURE_2D,we,0,0,ze,We,Pe):t.texImage2D(n.TEXTURE_2D,we,tt,ze,We,Pe);I.generateMipmaps=!1}else if(H){if(_e){const we=wt(Re);t.texStorage2D(n.TEXTURE_2D,Ve,tt,we.width,we.height)}Oe&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,ze,We,Re)}else t.texImage2D(n.TEXTURE_2D,0,tt,ze,We,Re);v(I)&&_(de),Fe.__version=fe.version,I.onUpdate&&I.onUpdate(I)}U.__version=I.version}function X(U,I,J){if(I.image.length!==6)return;const de=Ie(U,I),be=I.source;t.bindTexture(n.TEXTURE_CUBE_MAP,U.__webglTexture,n.TEXTURE0+J);const fe=r.get(be);if(be.version!==fe.__version||de===!0){t.activeTexture(n.TEXTURE0+J);const Fe=Nt.getPrimaries(Nt.workingColorSpace),Te=I.colorSpace===xs?null:Nt.getPrimaries(I.colorSpace),Ye=I.colorSpace===xs||Fe===Te?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,I.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,I.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ye);const Ke=I.isCompressedTexture||I.image[0].isCompressedTexture,Re=I.image[0]&&I.image[0].isDataTexture,ze=[];for(let me=0;me<6;me++)!Ke&&!Re?ze[me]=x(I.image[me],!0,i.maxCubemapSize):ze[me]=Re?I.image[me].image:I.image[me],ze[me]=ot(I,ze[me]);const We=ze[0],tt=s.convert(I.format,I.colorSpace),Pe=s.convert(I.type),gt=M(I.internalFormat,tt,Pe,I.colorSpace),H=I.isVideoTexture!==!0,_e=fe.__version===void 0||de===!0,Oe=be.dataReady;let Ve=S(I,We);Ae(n.TEXTURE_CUBE_MAP,I);let we;if(Ke){H&&_e&&t.texStorage2D(n.TEXTURE_CUBE_MAP,Ve,gt,We.width,We.height);for(let me=0;me<6;me++){we=ze[me].mipmaps;for(let Qe=0;Qe<we.length;Qe++){const ft=we[Qe];I.format!==ri?tt!==null?H?Oe&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe,0,0,ft.width,ft.height,tt,ft.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe,gt,ft.width,ft.height,0,ft.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):H?Oe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe,0,0,ft.width,ft.height,tt,Pe,ft.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe,gt,ft.width,ft.height,0,tt,Pe,ft.data)}}}else{if(we=I.mipmaps,H&&_e){we.length>0&&Ve++;const me=wt(ze[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Ve,gt,me.width,me.height)}for(let me=0;me<6;me++)if(Re){H?Oe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,ze[me].width,ze[me].height,tt,Pe,ze[me].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,gt,ze[me].width,ze[me].height,0,tt,Pe,ze[me].data);for(let Qe=0;Qe<we.length;Qe++){const Ot=we[Qe].image[me].image;H?Oe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe+1,0,0,Ot.width,Ot.height,tt,Pe,Ot.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe+1,gt,Ot.width,Ot.height,0,tt,Pe,Ot.data)}}else{H?Oe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,tt,Pe,ze[me]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,gt,tt,Pe,ze[me]);for(let Qe=0;Qe<we.length;Qe++){const ft=we[Qe];H?Oe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe+1,0,0,tt,Pe,ft.image[me]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Qe+1,gt,tt,Pe,ft.image[me])}}}v(I)&&_(n.TEXTURE_CUBE_MAP),fe.__version=be.version,I.onUpdate&&I.onUpdate(I)}U.__version=I.version}function pe(U,I,J,de,be,fe){const Fe=s.convert(J.format,J.colorSpace),Te=s.convert(J.type),Ye=M(J.internalFormat,Fe,Te,J.colorSpace),Ke=r.get(I),Re=r.get(J);if(Re.__renderTarget=I,!Ke.__hasExternalTextures){const ze=Math.max(1,I.width>>fe),We=Math.max(1,I.height>>fe);be===n.TEXTURE_3D||be===n.TEXTURE_2D_ARRAY?t.texImage3D(be,fe,Ye,ze,We,I.depth,0,Fe,Te,null):t.texImage2D(be,fe,Ye,ze,We,0,Fe,Te,null)}t.bindFramebuffer(n.FRAMEBUFFER,U),ge(I)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,de,be,Re.__webglTexture,0,Ue(I)):(be===n.TEXTURE_2D||be>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&be<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,de,be,Re.__webglTexture,fe),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Ee(U,I,J){if(n.bindRenderbuffer(n.RENDERBUFFER,U),I.depthBuffer){const de=I.depthTexture,be=de&&de.isDepthTexture?de.type:null,fe=b(I.stencilBuffer,be),Fe=I.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Te=Ue(I);ge(I)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Te,fe,I.width,I.height):J?n.renderbufferStorageMultisample(n.RENDERBUFFER,Te,fe,I.width,I.height):n.renderbufferStorage(n.RENDERBUFFER,fe,I.width,I.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Fe,n.RENDERBUFFER,U)}else{const de=I.textures;for(let be=0;be<de.length;be++){const fe=de[be],Fe=s.convert(fe.format,fe.colorSpace),Te=s.convert(fe.type),Ye=M(fe.internalFormat,Fe,Te,fe.colorSpace),Ke=Ue(I);J&&ge(I)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ke,Ye,I.width,I.height):ge(I)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ke,Ye,I.width,I.height):n.renderbufferStorage(n.RENDERBUFFER,Ye,I.width,I.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Q(U,I){if(I&&I.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,U),!(I.depthTexture&&I.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const de=r.get(I.depthTexture);de.__renderTarget=I,(!de.__webglTexture||I.depthTexture.image.width!==I.width||I.depthTexture.image.height!==I.height)&&(I.depthTexture.image.width=I.width,I.depthTexture.image.height=I.height,I.depthTexture.needsUpdate=!0),ue(I.depthTexture,0);const be=de.__webglTexture,fe=Ue(I);if(I.depthTexture.format===gl)ge(I)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,be,0,fe):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,be,0);else if(I.depthTexture.format===_l)ge(I)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,be,0,fe):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,be,0);else throw new Error("Unknown depthTexture format")}function Ne(U){const I=r.get(U),J=U.isWebGLCubeRenderTarget===!0;if(I.__boundDepthTexture!==U.depthTexture){const de=U.depthTexture;if(I.__depthDisposeCallback&&I.__depthDisposeCallback(),de){const be=()=>{delete I.__boundDepthTexture,delete I.__depthDisposeCallback,de.removeEventListener("dispose",be)};de.addEventListener("dispose",be),I.__depthDisposeCallback=be}I.__boundDepthTexture=de}if(U.depthTexture&&!I.__autoAllocateDepthBuffer){if(J)throw new Error("target.depthTexture not supported in Cube render targets");const de=U.texture.mipmaps;de&&de.length>0?Q(I.__webglFramebuffer[0],U):Q(I.__webglFramebuffer,U)}else if(J){I.__webglDepthbuffer=[];for(let de=0;de<6;de++)if(t.bindFramebuffer(n.FRAMEBUFFER,I.__webglFramebuffer[de]),I.__webglDepthbuffer[de]===void 0)I.__webglDepthbuffer[de]=n.createRenderbuffer(),Ee(I.__webglDepthbuffer[de],U,!1);else{const be=U.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,fe=I.__webglDepthbuffer[de];n.bindRenderbuffer(n.RENDERBUFFER,fe),n.framebufferRenderbuffer(n.FRAMEBUFFER,be,n.RENDERBUFFER,fe)}}else{const de=U.texture.mipmaps;if(de&&de.length>0?t.bindFramebuffer(n.FRAMEBUFFER,I.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,I.__webglFramebuffer),I.__webglDepthbuffer===void 0)I.__webglDepthbuffer=n.createRenderbuffer(),Ee(I.__webglDepthbuffer,U,!1);else{const be=U.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,fe=I.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,fe),n.framebufferRenderbuffer(n.FRAMEBUFFER,be,n.RENDERBUFFER,fe)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function le(U,I,J){const de=r.get(U);I!==void 0&&pe(de.__webglFramebuffer,U,U.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),J!==void 0&&Ne(U)}function F(U){const I=U.texture,J=r.get(U),de=r.get(I);U.addEventListener("dispose",q);const be=U.textures,fe=U.isWebGLCubeRenderTarget===!0,Fe=be.length>1;if(Fe||(de.__webglTexture===void 0&&(de.__webglTexture=n.createTexture()),de.__version=I.version,o.memory.textures++),fe){J.__webglFramebuffer=[];for(let Te=0;Te<6;Te++)if(I.mipmaps&&I.mipmaps.length>0){J.__webglFramebuffer[Te]=[];for(let Ye=0;Ye<I.mipmaps.length;Ye++)J.__webglFramebuffer[Te][Ye]=n.createFramebuffer()}else J.__webglFramebuffer[Te]=n.createFramebuffer()}else{if(I.mipmaps&&I.mipmaps.length>0){J.__webglFramebuffer=[];for(let Te=0;Te<I.mipmaps.length;Te++)J.__webglFramebuffer[Te]=n.createFramebuffer()}else J.__webglFramebuffer=n.createFramebuffer();if(Fe)for(let Te=0,Ye=be.length;Te<Ye;Te++){const Ke=r.get(be[Te]);Ke.__webglTexture===void 0&&(Ke.__webglTexture=n.createTexture(),o.memory.textures++)}if(U.samples>0&&ge(U)===!1){J.__webglMultisampledFramebuffer=n.createFramebuffer(),J.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,J.__webglMultisampledFramebuffer);for(let Te=0;Te<be.length;Te++){const Ye=be[Te];J.__webglColorRenderbuffer[Te]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,J.__webglColorRenderbuffer[Te]);const Ke=s.convert(Ye.format,Ye.colorSpace),Re=s.convert(Ye.type),ze=M(Ye.internalFormat,Ke,Re,Ye.colorSpace,U.isXRRenderTarget===!0),We=Ue(U);n.renderbufferStorageMultisample(n.RENDERBUFFER,We,ze,U.width,U.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Te,n.RENDERBUFFER,J.__webglColorRenderbuffer[Te])}n.bindRenderbuffer(n.RENDERBUFFER,null),U.depthBuffer&&(J.__webglDepthRenderbuffer=n.createRenderbuffer(),Ee(J.__webglDepthRenderbuffer,U,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(fe){t.bindTexture(n.TEXTURE_CUBE_MAP,de.__webglTexture),Ae(n.TEXTURE_CUBE_MAP,I);for(let Te=0;Te<6;Te++)if(I.mipmaps&&I.mipmaps.length>0)for(let Ye=0;Ye<I.mipmaps.length;Ye++)pe(J.__webglFramebuffer[Te][Ye],U,I,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Te,Ye);else pe(J.__webglFramebuffer[Te],U,I,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Te,0);v(I)&&_(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Fe){for(let Te=0,Ye=be.length;Te<Ye;Te++){const Ke=be[Te],Re=r.get(Ke);let ze=n.TEXTURE_2D;(U.isWebGL3DRenderTarget||U.isWebGLArrayRenderTarget)&&(ze=U.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(ze,Re.__webglTexture),Ae(ze,Ke),pe(J.__webglFramebuffer,U,Ke,n.COLOR_ATTACHMENT0+Te,ze,0),v(Ke)&&_(ze)}t.unbindTexture()}else{let Te=n.TEXTURE_2D;if((U.isWebGL3DRenderTarget||U.isWebGLArrayRenderTarget)&&(Te=U.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(Te,de.__webglTexture),Ae(Te,I),I.mipmaps&&I.mipmaps.length>0)for(let Ye=0;Ye<I.mipmaps.length;Ye++)pe(J.__webglFramebuffer[Ye],U,I,n.COLOR_ATTACHMENT0,Te,Ye);else pe(J.__webglFramebuffer,U,I,n.COLOR_ATTACHMENT0,Te,0);v(I)&&_(Te),t.unbindTexture()}U.depthBuffer&&Ne(U)}function lt(U){const I=U.textures;for(let J=0,de=I.length;J<de;J++){const be=I[J];if(v(be)){const fe=E(U),Fe=r.get(be).__webglTexture;t.bindTexture(fe,Fe),_(fe),t.unbindTexture()}}}const Le=[],Ge=[];function De(U){if(U.samples>0){if(ge(U)===!1){const I=U.textures,J=U.width,de=U.height;let be=n.COLOR_BUFFER_BIT;const fe=U.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Fe=r.get(U),Te=I.length>1;if(Te)for(let Ke=0;Ke<I.length;Ke++)t.bindFramebuffer(n.FRAMEBUFFER,Fe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ke,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Fe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ke,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Fe.__webglMultisampledFramebuffer);const Ye=U.texture.mipmaps;Ye&&Ye.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Fe.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Fe.__webglFramebuffer);for(let Ke=0;Ke<I.length;Ke++){if(U.resolveDepthBuffer&&(U.depthBuffer&&(be|=n.DEPTH_BUFFER_BIT),U.stencilBuffer&&U.resolveStencilBuffer&&(be|=n.STENCIL_BUFFER_BIT)),Te){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Fe.__webglColorRenderbuffer[Ke]);const Re=r.get(I[Ke]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Re,0)}n.blitFramebuffer(0,0,J,de,0,0,J,de,be,n.NEAREST),l===!0&&(Le.length=0,Ge.length=0,Le.push(n.COLOR_ATTACHMENT0+Ke),U.depthBuffer&&U.resolveDepthBuffer===!1&&(Le.push(fe),Ge.push(fe),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,Ge)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Le))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),Te)for(let Ke=0;Ke<I.length;Ke++){t.bindFramebuffer(n.FRAMEBUFFER,Fe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ke,n.RENDERBUFFER,Fe.__webglColorRenderbuffer[Ke]);const Re=r.get(I[Ke]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Fe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ke,n.TEXTURE_2D,Re,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Fe.__webglMultisampledFramebuffer)}else if(U.depthBuffer&&U.resolveDepthBuffer===!1&&l){const I=U.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[I])}}}function Ue(U){return Math.min(i.maxSamples,U.samples)}function ge(U){const I=r.get(U);return U.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function $e(U){const I=o.render.frame;h.get(U)!==I&&(h.set(U,I),U.update())}function ot(U,I){const J=U.colorSpace,de=U.format,be=U.type;return U.isCompressedTexture===!0||U.isVideoTexture===!0||J!==Ko&&J!==xs&&(Nt.getTransfer(J)===Gt?(de!==ri||be!==Pi)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",J)),I}function wt(U){return typeof HTMLImageElement<"u"&&U instanceof HTMLImageElement?(c.width=U.naturalWidth||U.width,c.height=U.naturalHeight||U.height):typeof VideoFrame<"u"&&U instanceof VideoFrame?(c.width=U.displayWidth,c.height=U.displayHeight):(c.width=U.width,c.height=U.height),c}this.allocateTextureUnit=Y,this.resetTextureUnits=Z,this.setTexture2D=ue,this.setTexture2DArray=te,this.setTexture3D=ae,this.setTextureCube=B,this.rebindTextures=le,this.setupRenderTarget=F,this.updateRenderTargetMipmap=lt,this.updateMultisampleRenderTarget=De,this.setupDepthRenderbuffer=Ne,this.setupFrameBufferTexture=pe,this.useMultisampledRTT=ge}function l6(n,e){function t(r,i=xs){let s;const o=Nt.getTransfer(i);if(r===Pi)return n.UNSIGNED_BYTE;if(r===xd)return n.UNSIGNED_SHORT_4_4_4_4;if(r===yd)return n.UNSIGNED_SHORT_5_5_5_1;if(r===$1)return n.UNSIGNED_INT_5_9_9_9_REV;if(r===j1)return n.BYTE;if(r===X1)return n.SHORT;if(r===dl)return n.UNSIGNED_SHORT;if(r===vd)return n.INT;if(r===Js)return n.UNSIGNED_INT;if(r===ji)return n.FLOAT;if(r===pl)return n.HALF_FLOAT;if(r===Y1)return n.ALPHA;if(r===K1)return n.RGB;if(r===ri)return n.RGBA;if(r===gl)return n.DEPTH_COMPONENT;if(r===_l)return n.DEPTH_STENCIL;if(r===Z1)return n.RED;if(r===Sd)return n.RED_INTEGER;if(r===J1)return n.RG;if(r===Ed)return n.RG_INTEGER;if(r===bd)return n.RGBA_INTEGER;if(r===Xc||r===$c||r===Yc||r===Kc)if(o===Gt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===Xc)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===$c)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Yc)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Kc)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===Xc)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===$c)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Yc)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Kc)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===Md||r===wd||r===Td||r===Ad)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===Md)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===wd)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===Td)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===Ad)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===Cd||r===Rd||r===Pd)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===Cd||r===Rd)return o===Gt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===Pd)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===Id||r===Ld||r===Od||r===qd||r===Dd||r===Nd||r===Ud||r===Fd||r===zd||r===kd||r===Bd||r===Vd||r===Hd||r===Gd)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===Id)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Ld)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Od)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===qd)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===Dd)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Nd)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===Ud)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===Fd)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===zd)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===kd)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===Bd)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Vd)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===Hd)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===Gd)return o===Gt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Zc||r===Wd||r===jd)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===Zc)return o===Gt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===Wd)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===jd)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===Q1||r===Xd||r===$d||r===Yd)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===Zc)return s.COMPRESSED_RED_RGTC1_EXT;if(r===Xd)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===$d)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===Yd)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===ml?n.UNSIGNED_INT_24_8:n[r]!==void 0?n[r]:null}return{convert:t}}class Ov extends Gn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}}const c6=`
3885
+ }`;function i6(n,e,t){let r=new Ep;const i=new Fe,s=new Fe,o=new on,a=new JM({depthPacking:Pb}),l=new QM,c={},h=t.maxTextureSize,f={[ls]:Qn,[Qn]:ls,[yi]:yi},p=new vs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Fe},radius:{value:4}},vertexShader:n6,fragmentShader:r6}),d=p.clone();d.defines.HORIZONTAL_PASS=1;const m=new tr;m.setAttribute("position",new Pr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Tn(m,p),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=B1;let _=this.type;this.render=function(T,q,O){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||T.length===0)return;const A=n.getRenderTarget(),L=n.getActiveCubeFace(),N=n.getActiveMipmapLevel(),Z=n.state;Z.setBlending(cs),Z.buffers.depth.getReversed()?Z.buffers.color.setClear(0,0,0,0):Z.buffers.color.setClear(1,1,1,1),Z.buffers.depth.setTest(!0),Z.setScissorTest(!1);const K=_!==Ui&&this.type===Ui,ne=_===Ui&&this.type!==Ui;for(let ce=0,J=T.length;ce<J;ce++){const oe=T[ce],B=oe.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",oe,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;i.copy(B.mapSize);const xe=B.getFrameExtents();if(i.multiply(xe),s.copy(B.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/xe.x),i.x=s.x*xe.x,B.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/xe.y),i.y=s.y*xe.y,B.mapSize.y=s.y)),B.map===null||K===!0||ne===!0){const $=this.type!==Ui?{minFilter:Xr,magFilter:Xr}:{};B.map!==null&&B.map.dispose(),B.map=new Ws(i.x,i.y,$),B.map.texture.name=oe.name+".shadowMap",B.camera.updateProjectionMatrix()}n.setRenderTarget(B.map),n.clear();const U=B.getViewportCount();for(let $=0;$<U;$++){const pe=B.getViewport($);o.set(s.x*pe.x,s.y*pe.y,s.x*pe.z,s.y*pe.w),Z.viewport(o),B.updateMatrices(oe,$),r=B.getFrustum(),E(q,O,B.camera,oe,this.type)}B.isPointLightShadow!==!0&&this.type===Ui&&b(B,O),B.needsUpdate=!1}_=this.type,v.needsUpdate=!1,n.setRenderTarget(A,L,N)};function b(T,q){const O=e.update(x);p.defines.VSM_SAMPLES!==T.blurSamples&&(p.defines.VSM_SAMPLES=T.blurSamples,d.defines.VSM_SAMPLES=T.blurSamples,p.needsUpdate=!0,d.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Ws(i.x,i.y)),p.uniforms.shadow_pass.value=T.map.texture,p.uniforms.resolution.value=T.mapSize,p.uniforms.radius.value=T.radius,n.setRenderTarget(T.mapPass),n.clear(),n.renderBufferDirect(q,null,O,p,x,null),d.uniforms.shadow_pass.value=T.mapPass.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radius,n.setRenderTarget(T.map),n.clear(),n.renderBufferDirect(q,null,O,d,x,null)}function M(T,q,O,A){let L=null;const N=O.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(N!==void 0)L=N;else if(L=O.isPointLight===!0?l:a,n.localClippingEnabled&&q.clipShadows===!0&&Array.isArray(q.clippingPlanes)&&q.clippingPlanes.length!==0||q.displacementMap&&q.displacementScale!==0||q.alphaMap&&q.alphaTest>0||q.map&&q.alphaTest>0||q.alphaToCoverage===!0){const Z=L.uuid,K=q.uuid;let ne=c[Z];ne===void 0&&(ne={},c[Z]=ne);let ce=ne[K];ce===void 0&&(ce=L.clone(),ne[K]=ce,q.addEventListener("dispose",S)),L=ce}if(L.visible=q.visible,L.wireframe=q.wireframe,A===Ui?L.side=q.shadowSide!==null?q.shadowSide:q.side:L.side=q.shadowSide!==null?q.shadowSide:f[q.side],L.alphaMap=q.alphaMap,L.alphaTest=q.alphaToCoverage===!0?.5:q.alphaTest,L.map=q.map,L.clipShadows=q.clipShadows,L.clippingPlanes=q.clippingPlanes,L.clipIntersection=q.clipIntersection,L.displacementMap=q.displacementMap,L.displacementScale=q.displacementScale,L.displacementBias=q.displacementBias,L.wireframeLinewidth=q.wireframeLinewidth,L.linewidth=q.linewidth,O.isPointLight===!0&&L.isMeshDistanceMaterial===!0){const Z=n.properties.get(L);Z.light=O}return L}function E(T,q,O,A,L){if(T.visible===!1)return;if(T.layers.test(q.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&L===Ui)&&(!T.frustumCulled||r.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,T.matrixWorld);const K=e.update(T),ne=T.material;if(Array.isArray(ne)){const ce=K.groups;for(let J=0,oe=ce.length;J<oe;J++){const B=ce[J],xe=ne[B.materialIndex];if(xe&&xe.visible){const U=M(T,xe,A,L);T.onBeforeShadow(n,T,q,O,K,U,B),n.renderBufferDirect(O,null,K,U,T,B),T.onAfterShadow(n,T,q,O,K,U,B)}}}else if(ne.visible){const ce=M(T,ne,A,L);T.onBeforeShadow(n,T,q,O,K,ce,null),n.renderBufferDirect(O,null,K,ce,T,null),T.onAfterShadow(n,T,q,O,K,ce,null)}}const Z=T.children;for(let K=0,ne=Z.length;K<ne;K++)E(Z[K],q,O,A,L)}function S(T){T.target.removeEventListener("dispose",S);for(const O in c){const A=c[O],L=T.target.uuid;L in A&&(A[L].dispose(),delete A[L])}}}const s6={[od]:ad,[ld]:hd,[cd]:fd,[Uo]:ud,[ad]:od,[hd]:ld,[fd]:cd,[ud]:Uo};function o6(n,e){function t(){let H=!1;const Ee=new on;let Oe=null;const Be=new on(0,0,0,0);return{setMask:function(Te){Oe!==Te&&!H&&(n.colorMask(Te,Te,Te,Te),Oe=Te)},setLocked:function(Te){H=Te},setClear:function(Te,me,Ze,ct,Lt){Lt===!0&&(Te*=ct,me*=ct,Ze*=ct),Ee.set(Te,me,Ze,ct),Be.equals(Ee)===!1&&(n.clearColor(Te,me,Ze,ct),Be.copy(Ee))},reset:function(){H=!1,Oe=null,Be.set(-1,0,0,0)}}}function r(){let H=!1,Ee=!1,Oe=null,Be=null,Te=null;return{setReversed:function(me){if(Ee!==me){const Ze=e.get("EXT_clip_control");me?Ze.clipControlEXT(Ze.LOWER_LEFT_EXT,Ze.ZERO_TO_ONE_EXT):Ze.clipControlEXT(Ze.LOWER_LEFT_EXT,Ze.NEGATIVE_ONE_TO_ONE_EXT),Ee=me;const ct=Te;Te=null,this.setClear(ct)}},getReversed:function(){return Ee},setTest:function(me){me?W(n.DEPTH_TEST):ue(n.DEPTH_TEST)},setMask:function(me){Oe!==me&&!H&&(n.depthMask(me),Oe=me)},setFunc:function(me){if(Ee&&(me=s6[me]),Be!==me){switch(me){case od:n.depthFunc(n.NEVER);break;case ad:n.depthFunc(n.ALWAYS);break;case ld:n.depthFunc(n.LESS);break;case Uo:n.depthFunc(n.LEQUAL);break;case cd:n.depthFunc(n.EQUAL);break;case ud:n.depthFunc(n.GEQUAL);break;case hd:n.depthFunc(n.GREATER);break;case fd:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}Be=me}},setLocked:function(me){H=me},setClear:function(me){Te!==me&&(Ee&&(me=1-me),n.clearDepth(me),Te=me)},reset:function(){H=!1,Oe=null,Be=null,Te=null,Ee=!1}}}function i(){let H=!1,Ee=null,Oe=null,Be=null,Te=null,me=null,Ze=null,ct=null,Lt=null;return{setTest:function(ft){H||(ft?W(n.STENCIL_TEST):ue(n.STENCIL_TEST))},setMask:function(ft){Ee!==ft&&!H&&(n.stencilMask(ft),Ee=ft)},setFunc:function(ft,si,rr){(Oe!==ft||Be!==si||Te!==rr)&&(n.stencilFunc(ft,si,rr),Oe=ft,Be=si,Te=rr)},setOp:function(ft,si,rr){(me!==ft||Ze!==si||ct!==rr)&&(n.stencilOp(ft,si,rr),me=ft,Ze=si,ct=rr)},setLocked:function(ft){H=ft},setClear:function(ft){Lt!==ft&&(n.clearStencil(ft),Lt=ft)},reset:function(){H=!1,Ee=null,Oe=null,Be=null,Te=null,me=null,Ze=null,ct=null,Lt=null}}}const s=new t,o=new r,a=new i,l=new WeakMap,c=new WeakMap;let h={},f={},p=new WeakMap,d=[],m=null,x=!1,v=null,_=null,b=null,M=null,E=null,S=null,T=null,q=new St(0,0,0),O=0,A=!1,L=null,N=null,Z=null,K=null,ne=null;const ce=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let J=!1,oe=0;const B=n.getParameter(n.VERSION);B.indexOf("WebGL")!==-1?(oe=parseFloat(/^WebGL (\d)/.exec(B)[1]),J=oe>=1):B.indexOf("OpenGL ES")!==-1&&(oe=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),J=oe>=2);let xe=null,U={};const $=n.getParameter(n.SCISSOR_BOX),pe=n.getParameter(n.VIEWPORT),Se=new on().fromArray($),be=new on().fromArray(pe);function V(H,Ee,Oe,Be){const Te=new Uint8Array(4),me=n.createTexture();n.bindTexture(H,me),n.texParameteri(H,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(H,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ze=0;Ze<Oe;Ze++)H===n.TEXTURE_3D||H===n.TEXTURE_2D_ARRAY?n.texImage3D(Ee,0,n.RGBA,1,1,Be,0,n.RGBA,n.UNSIGNED_BYTE,Te):n.texImage2D(Ee+Ze,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Te);return me}const te={};te[n.TEXTURE_2D]=V(n.TEXTURE_2D,n.TEXTURE_2D,1),te[n.TEXTURE_CUBE_MAP]=V(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),te[n.TEXTURE_2D_ARRAY]=V(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),te[n.TEXTURE_3D]=V(n.TEXTURE_3D,n.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),W(n.DEPTH_TEST),o.setFunc(Uo),$e(!1),qe(k1),W(n.CULL_FACE),it(cs);function W(H){h[H]!==!0&&(n.enable(H),h[H]=!0)}function ue(H){h[H]!==!1&&(n.disable(H),h[H]=!1)}function ye(H,Ee){return f[H]!==Ee?(n.bindFramebuffer(H,Ee),f[H]=Ee,H===n.DRAW_FRAMEBUFFER&&(f[n.FRAMEBUFFER]=Ee),H===n.FRAMEBUFFER&&(f[n.DRAW_FRAMEBUFFER]=Ee),!0):!1}function Q(H,Ee){let Oe=d,Be=!1;if(H){Oe=p.get(Ee),Oe===void 0&&(Oe=[],p.set(Ee,Oe));const Te=H.textures;if(Oe.length!==Te.length||Oe[0]!==n.COLOR_ATTACHMENT0){for(let me=0,Ze=Te.length;me<Ze;me++)Oe[me]=n.COLOR_ATTACHMENT0+me;Oe.length=Te.length,Be=!0}}else Oe[0]!==n.BACK&&(Oe[0]=n.BACK,Be=!0);Be&&n.drawBuffers(Oe)}function Le(H){return m!==H?(n.useProgram(H),m=H,!0):!1}const le={[ks]:n.FUNC_ADD,[nb]:n.FUNC_SUBTRACT,[rb]:n.FUNC_REVERSE_SUBTRACT};le[ib]=n.MIN,le[sb]=n.MAX;const z={[ob]:n.ZERO,[ab]:n.ONE,[lb]:n.SRC_COLOR,[id]:n.SRC_ALPHA,[pb]:n.SRC_ALPHA_SATURATE,[fb]:n.DST_COLOR,[ub]:n.DST_ALPHA,[cb]:n.ONE_MINUS_SRC_COLOR,[sd]:n.ONE_MINUS_SRC_ALPHA,[db]:n.ONE_MINUS_DST_COLOR,[hb]:n.ONE_MINUS_DST_ALPHA,[mb]:n.CONSTANT_COLOR,[gb]:n.ONE_MINUS_CONSTANT_COLOR,[_b]:n.CONSTANT_ALPHA,[vb]:n.ONE_MINUS_CONSTANT_ALPHA};function it(H,Ee,Oe,Be,Te,me,Ze,ct,Lt,ft){if(H===cs){x===!0&&(ue(n.BLEND),x=!1);return}if(x===!1&&(W(n.BLEND),x=!0),H!==tb){if(H!==v||ft!==A){if((_!==ks||E!==ks)&&(n.blendEquation(n.FUNC_ADD),_=ks,E=ks),ft)switch(H){case No:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case V1:n.blendFunc(n.ONE,n.ONE);break;case H1:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case G1:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:console.error("THREE.WebGLState: Invalid blending: ",H);break}else switch(H){case No:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case V1:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case H1:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case G1:console.error("THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:console.error("THREE.WebGLState: Invalid blending: ",H);break}b=null,M=null,S=null,T=null,q.set(0,0,0),O=0,v=H,A=ft}return}Te=Te||Ee,me=me||Oe,Ze=Ze||Be,(Ee!==_||Te!==E)&&(n.blendEquationSeparate(le[Ee],le[Te]),_=Ee,E=Te),(Oe!==b||Be!==M||me!==S||Ze!==T)&&(n.blendFuncSeparate(z[Oe],z[Be],z[me],z[Ze]),b=Oe,M=Be,S=me,T=Ze),(ct.equals(q)===!1||Lt!==O)&&(n.blendColor(ct.r,ct.g,ct.b,Lt),q.copy(ct),O=Lt),v=H,A=!1}function Ie(H,Ee){H.side===yi?ue(n.CULL_FACE):W(n.CULL_FACE);let Oe=H.side===Qn;Ee&&(Oe=!Oe),$e(Oe),H.blending===No&&H.transparent===!1?it(cs):it(H.blending,H.blendEquation,H.blendSrc,H.blendDst,H.blendEquationAlpha,H.blendSrcAlpha,H.blendDstAlpha,H.blendColor,H.blendAlpha,H.premultipliedAlpha),o.setFunc(H.depthFunc),o.setTest(H.depthTest),o.setMask(H.depthWrite),s.setMask(H.colorWrite);const Be=H.stencilWrite;a.setTest(Be),Be&&(a.setMask(H.stencilWriteMask),a.setFunc(H.stencilFunc,H.stencilRef,H.stencilFuncMask),a.setOp(H.stencilFail,H.stencilZFail,H.stencilZPass)),ve(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),H.alphaToCoverage===!0?W(n.SAMPLE_ALPHA_TO_COVERAGE):ue(n.SAMPLE_ALPHA_TO_COVERAGE)}function $e(H){L!==H&&(H?n.frontFace(n.CW):n.frontFace(n.CCW),L=H)}function qe(H){H!==JE?(W(n.CULL_FACE),H!==N&&(H===k1?n.cullFace(n.BACK):H===QE?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):ue(n.CULL_FACE),N=H}function De(H){H!==Z&&(J&&n.lineWidth(H),Z=H)}function ve(H,Ee,Oe){H?(W(n.POLYGON_OFFSET_FILL),(K!==Ee||ne!==Oe)&&(n.polygonOffset(Ee,Oe),K=Ee,ne=Oe)):ue(n.POLYGON_OFFSET_FILL)}function Ge(H){H?W(n.SCISSOR_TEST):ue(n.SCISSOR_TEST)}function rt(H){H===void 0&&(H=n.TEXTURE0+ce-1),xe!==H&&(n.activeTexture(H),xe=H)}function wt(H,Ee,Oe){Oe===void 0&&(xe===null?Oe=n.TEXTURE0+ce-1:Oe=xe);let Be=U[Oe];Be===void 0&&(Be={type:void 0,texture:void 0},U[Oe]=Be),(Be.type!==H||Be.texture!==Ee)&&(xe!==Oe&&(n.activeTexture(Oe),xe=Oe),n.bindTexture(H,Ee||te[H]),Be.type=H,Be.texture=Ee)}function F(){const H=U[xe];H!==void 0&&H.type!==void 0&&(n.bindTexture(H.type,null),H.type=void 0,H.texture=void 0)}function I(){try{n.compressedTexImage2D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function ee(){try{n.compressedTexImage3D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function de(){try{n.texSubImage2D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function Me(){try{n.texSubImage3D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function fe(){try{n.compressedTexSubImage2D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function Ue(){try{n.compressedTexSubImage3D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function Ae(){try{n.texStorage2D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function We(){try{n.texStorage3D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function je(){try{n.texImage2D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function Ce(){try{n.texImage3D(...arguments)}catch(H){console.error("THREE.WebGLState:",H)}}function Ne(H){Se.equals(H)===!1&&(n.scissor(H.x,H.y,H.z,H.w),Se.copy(H))}function Ve(H){be.equals(H)===!1&&(n.viewport(H.x,H.y,H.z,H.w),be.copy(H))}function Ke(H,Ee){let Oe=c.get(Ee);Oe===void 0&&(Oe=new WeakMap,c.set(Ee,Oe));let Be=Oe.get(H);Be===void 0&&(Be=n.getUniformBlockIndex(Ee,H.name),Oe.set(H,Be))}function Re(H,Ee){const Be=c.get(Ee).get(H);l.get(Ee)!==Be&&(n.uniformBlockBinding(Ee,Be,H.__bindingPointIndex),l.set(Ee,Be))}function ht(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),o.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),h={},xe=null,U={},f={},p=new WeakMap,d=[],m=null,x=!1,v=null,_=null,b=null,M=null,E=null,S=null,T=null,q=new St(0,0,0),O=0,A=!1,L=null,N=null,Z=null,K=null,ne=null,Se.set(0,0,n.canvas.width,n.canvas.height),be.set(0,0,n.canvas.width,n.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:W,disable:ue,bindFramebuffer:ye,drawBuffers:Q,useProgram:Le,setBlending:it,setMaterial:Ie,setFlipSided:$e,setCullFace:qe,setLineWidth:De,setPolygonOffset:ve,setScissorTest:Ge,activeTexture:rt,bindTexture:wt,unbindTexture:F,compressedTexImage2D:I,compressedTexImage3D:ee,texImage2D:je,texImage3D:Ce,updateUBOMapping:Ke,uniformBlockBinding:Re,texStorage2D:Ae,texStorage3D:We,texSubImage2D:de,texSubImage3D:Me,compressedTexSubImage2D:fe,compressedTexSubImage3D:Ue,scissor:Ne,viewport:Ve,reset:ht}}function a6(n,e,t,r,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Fe,h=new WeakMap;let f;const p=new WeakMap;let d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(F,I){return d?new OffscreenCanvas(F,I):hl("canvas")}function x(F,I,ee){let de=1;const Me=wt(F);if((Me.width>ee||Me.height>ee)&&(de=ee/Math.max(Me.width,Me.height)),de<1)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap||typeof VideoFrame<"u"&&F instanceof VideoFrame){const fe=Math.floor(de*Me.width),Ue=Math.floor(de*Me.height);f===void 0&&(f=m(fe,Ue));const Ae=I?m(fe,Ue):f;return Ae.width=fe,Ae.height=Ue,Ae.getContext("2d").drawImage(F,0,0,fe,Ue),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Me.width+"x"+Me.height+") to ("+fe+"x"+Ue+")."),Ae}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Me.width+"x"+Me.height+")."),F;return F}function v(F){return F.generateMipmaps}function _(F){n.generateMipmap(F)}function b(F){return F.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:F.isWebGL3DRenderTarget?n.TEXTURE_3D:F.isWebGLArrayRenderTarget||F.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function M(F,I,ee,de,Me=!1){if(F!==null){if(n[F]!==void 0)return n[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}let fe=I;if(I===n.RED&&(ee===n.FLOAT&&(fe=n.R32F),ee===n.HALF_FLOAT&&(fe=n.R16F),ee===n.UNSIGNED_BYTE&&(fe=n.R8)),I===n.RED_INTEGER&&(ee===n.UNSIGNED_BYTE&&(fe=n.R8UI),ee===n.UNSIGNED_SHORT&&(fe=n.R16UI),ee===n.UNSIGNED_INT&&(fe=n.R32UI),ee===n.BYTE&&(fe=n.R8I),ee===n.SHORT&&(fe=n.R16I),ee===n.INT&&(fe=n.R32I)),I===n.RG&&(ee===n.FLOAT&&(fe=n.RG32F),ee===n.HALF_FLOAT&&(fe=n.RG16F),ee===n.UNSIGNED_BYTE&&(fe=n.RG8)),I===n.RG_INTEGER&&(ee===n.UNSIGNED_BYTE&&(fe=n.RG8UI),ee===n.UNSIGNED_SHORT&&(fe=n.RG16UI),ee===n.UNSIGNED_INT&&(fe=n.RG32UI),ee===n.BYTE&&(fe=n.RG8I),ee===n.SHORT&&(fe=n.RG16I),ee===n.INT&&(fe=n.RG32I)),I===n.RGB_INTEGER&&(ee===n.UNSIGNED_BYTE&&(fe=n.RGB8UI),ee===n.UNSIGNED_SHORT&&(fe=n.RGB16UI),ee===n.UNSIGNED_INT&&(fe=n.RGB32UI),ee===n.BYTE&&(fe=n.RGB8I),ee===n.SHORT&&(fe=n.RGB16I),ee===n.INT&&(fe=n.RGB32I)),I===n.RGBA_INTEGER&&(ee===n.UNSIGNED_BYTE&&(fe=n.RGBA8UI),ee===n.UNSIGNED_SHORT&&(fe=n.RGBA16UI),ee===n.UNSIGNED_INT&&(fe=n.RGBA32UI),ee===n.BYTE&&(fe=n.RGBA8I),ee===n.SHORT&&(fe=n.RGBA16I),ee===n.INT&&(fe=n.RGBA32I)),I===n.RGB&&ee===n.UNSIGNED_INT_5_9_9_9_REV&&(fe=n.RGB9_E5),I===n.RGBA){const Ue=Me?Xc:Ct.getTransfer(de);ee===n.FLOAT&&(fe=n.RGBA32F),ee===n.HALF_FLOAT&&(fe=n.RGBA16F),ee===n.UNSIGNED_BYTE&&(fe=Ue===Ut?n.SRGB8_ALPHA8:n.RGBA8),ee===n.UNSIGNED_SHORT_4_4_4_4&&(fe=n.RGBA4),ee===n.UNSIGNED_SHORT_5_5_5_1&&(fe=n.RGB5_A1)}return(fe===n.R16F||fe===n.R32F||fe===n.RG16F||fe===n.RG32F||fe===n.RGBA16F||fe===n.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function E(F,I){let ee;return F?I===null||I===Hs||I===al?ee=n.DEPTH24_STENCIL8:I===Fi?ee=n.DEPTH32F_STENCIL8:I===sl&&(ee=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):I===null||I===Hs||I===al?ee=n.DEPTH_COMPONENT24:I===Fi?ee=n.DEPTH_COMPONENT32F:I===sl&&(ee=n.DEPTH_COMPONENT16),ee}function S(F,I){return v(F)===!0||F.isFramebufferTexture&&F.minFilter!==Xr&&F.minFilter!==Si?Math.log2(Math.max(I.width,I.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?I.mipmaps.length:1}function T(F){const I=F.target;I.removeEventListener("dispose",T),O(I),I.isVideoTexture&&h.delete(I)}function q(F){const I=F.target;I.removeEventListener("dispose",q),L(I)}function O(F){const I=r.get(F);if(I.__webglInit===void 0)return;const ee=F.source,de=p.get(ee);if(de){const Me=de[I.__cacheKey];Me.usedTimes--,Me.usedTimes===0&&A(F),Object.keys(de).length===0&&p.delete(ee)}r.remove(F)}function A(F){const I=r.get(F);n.deleteTexture(I.__webglTexture);const ee=F.source,de=p.get(ee);delete de[I.__cacheKey],o.memory.textures--}function L(F){const I=r.get(F);if(F.depthTexture&&(F.depthTexture.dispose(),r.remove(F.depthTexture)),F.isWebGLCubeRenderTarget)for(let de=0;de<6;de++){if(Array.isArray(I.__webglFramebuffer[de]))for(let Me=0;Me<I.__webglFramebuffer[de].length;Me++)n.deleteFramebuffer(I.__webglFramebuffer[de][Me]);else n.deleteFramebuffer(I.__webglFramebuffer[de]);I.__webglDepthbuffer&&n.deleteRenderbuffer(I.__webglDepthbuffer[de])}else{if(Array.isArray(I.__webglFramebuffer))for(let de=0;de<I.__webglFramebuffer.length;de++)n.deleteFramebuffer(I.__webglFramebuffer[de]);else n.deleteFramebuffer(I.__webglFramebuffer);if(I.__webglDepthbuffer&&n.deleteRenderbuffer(I.__webglDepthbuffer),I.__webglMultisampledFramebuffer&&n.deleteFramebuffer(I.__webglMultisampledFramebuffer),I.__webglColorRenderbuffer)for(let de=0;de<I.__webglColorRenderbuffer.length;de++)I.__webglColorRenderbuffer[de]&&n.deleteRenderbuffer(I.__webglColorRenderbuffer[de]);I.__webglDepthRenderbuffer&&n.deleteRenderbuffer(I.__webglDepthRenderbuffer)}const ee=F.textures;for(let de=0,Me=ee.length;de<Me;de++){const fe=r.get(ee[de]);fe.__webglTexture&&(n.deleteTexture(fe.__webglTexture),o.memory.textures--),r.remove(ee[de])}r.remove(F)}let N=0;function Z(){N=0}function K(){const F=N;return F>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+i.maxTextures),N+=1,F}function ne(F){const I=[];return I.push(F.wrapS),I.push(F.wrapT),I.push(F.wrapR||0),I.push(F.magFilter),I.push(F.minFilter),I.push(F.anisotropy),I.push(F.internalFormat),I.push(F.format),I.push(F.type),I.push(F.generateMipmaps),I.push(F.premultiplyAlpha),I.push(F.flipY),I.push(F.unpackAlignment),I.push(F.colorSpace),I.join()}function ce(F,I){const ee=r.get(F);if(F.isVideoTexture&&Ge(F),F.isRenderTargetTexture===!1&&F.isExternalTexture!==!0&&F.version>0&&ee.__version!==F.version){const de=F.image;if(de===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(de.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{te(ee,F,I);return}}else F.isExternalTexture&&(ee.__webglTexture=F.sourceTexture?F.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,ee.__webglTexture,n.TEXTURE0+I)}function J(F,I){const ee=r.get(F);if(F.isRenderTargetTexture===!1&&F.version>0&&ee.__version!==F.version){te(ee,F,I);return}t.bindTexture(n.TEXTURE_2D_ARRAY,ee.__webglTexture,n.TEXTURE0+I)}function oe(F,I){const ee=r.get(F);if(F.isRenderTargetTexture===!1&&F.version>0&&ee.__version!==F.version){te(ee,F,I);return}t.bindTexture(n.TEXTURE_3D,ee.__webglTexture,n.TEXTURE0+I)}function B(F,I){const ee=r.get(F);if(F.version>0&&ee.__version!==F.version){W(ee,F,I);return}t.bindTexture(n.TEXTURE_CUBE_MAP,ee.__webglTexture,n.TEXTURE0+I)}const xe={[jr]:n.REPEAT,[Bs]:n.CLAMP_TO_EDGE,[gd]:n.MIRRORED_REPEAT},U={[Xr]:n.NEAREST,[Cb]:n.NEAREST_MIPMAP_NEAREST,[Bc]:n.NEAREST_MIPMAP_LINEAR,[Si]:n.LINEAR,[_d]:n.LINEAR_MIPMAP_NEAREST,[Vs]:n.LINEAR_MIPMAP_LINEAR},$={[Lb]:n.NEVER,[Fb]:n.ALWAYS,[Ob]:n.LESS,[t_]:n.LEQUAL,[qb]:n.EQUAL,[Ub]:n.GEQUAL,[Db]:n.GREATER,[Nb]:n.NOTEQUAL};function pe(F,I){if(I.type===Fi&&e.has("OES_texture_float_linear")===!1&&(I.magFilter===Si||I.magFilter===_d||I.magFilter===Bc||I.magFilter===Vs||I.minFilter===Si||I.minFilter===_d||I.minFilter===Bc||I.minFilter===Vs)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(F,n.TEXTURE_WRAP_S,xe[I.wrapS]),n.texParameteri(F,n.TEXTURE_WRAP_T,xe[I.wrapT]),(F===n.TEXTURE_3D||F===n.TEXTURE_2D_ARRAY)&&n.texParameteri(F,n.TEXTURE_WRAP_R,xe[I.wrapR]),n.texParameteri(F,n.TEXTURE_MAG_FILTER,U[I.magFilter]),n.texParameteri(F,n.TEXTURE_MIN_FILTER,U[I.minFilter]),I.compareFunction&&(n.texParameteri(F,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(F,n.TEXTURE_COMPARE_FUNC,$[I.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(I.magFilter===Xr||I.minFilter!==Bc&&I.minFilter!==Vs||I.type===Fi&&e.has("OES_texture_float_linear")===!1)return;if(I.anisotropy>1||r.get(I).__currentAnisotropy){const ee=e.get("EXT_texture_filter_anisotropic");n.texParameterf(F,ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,i.getMaxAnisotropy())),r.get(I).__currentAnisotropy=I.anisotropy}}}function Se(F,I){let ee=!1;F.__webglInit===void 0&&(F.__webglInit=!0,I.addEventListener("dispose",T));const de=I.source;let Me=p.get(de);Me===void 0&&(Me={},p.set(de,Me));const fe=ne(I);if(fe!==F.__cacheKey){Me[fe]===void 0&&(Me[fe]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ee=!0),Me[fe].usedTimes++;const Ue=Me[F.__cacheKey];Ue!==void 0&&(Me[F.__cacheKey].usedTimes--,Ue.usedTimes===0&&A(I)),F.__cacheKey=fe,F.__webglTexture=Me[fe].texture}return ee}function be(F,I,ee){return Math.floor(Math.floor(F/ee)/I)}function V(F,I,ee,de){const fe=F.updateRanges;if(fe.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,I.width,I.height,ee,de,I.data);else{fe.sort((Ce,Ne)=>Ce.start-Ne.start);let Ue=0;for(let Ce=1;Ce<fe.length;Ce++){const Ne=fe[Ue],Ve=fe[Ce],Ke=Ne.start+Ne.count,Re=be(Ve.start,I.width,4),ht=be(Ne.start,I.width,4);Ve.start<=Ke+1&&Re===ht&&be(Ve.start+Ve.count-1,I.width,4)===Re?Ne.count=Math.max(Ne.count,Ve.start+Ve.count-Ne.start):(++Ue,fe[Ue]=Ve)}fe.length=Ue+1;const Ae=n.getParameter(n.UNPACK_ROW_LENGTH),We=n.getParameter(n.UNPACK_SKIP_PIXELS),je=n.getParameter(n.UNPACK_SKIP_ROWS);n.pixelStorei(n.UNPACK_ROW_LENGTH,I.width);for(let Ce=0,Ne=fe.length;Ce<Ne;Ce++){const Ve=fe[Ce],Ke=Math.floor(Ve.start/4),Re=Math.ceil(Ve.count/4),ht=Ke%I.width,H=Math.floor(Ke/I.width),Ee=Re,Oe=1;n.pixelStorei(n.UNPACK_SKIP_PIXELS,ht),n.pixelStorei(n.UNPACK_SKIP_ROWS,H),t.texSubImage2D(n.TEXTURE_2D,0,ht,H,Ee,Oe,ee,de,I.data)}F.clearUpdateRanges(),n.pixelStorei(n.UNPACK_ROW_LENGTH,Ae),n.pixelStorei(n.UNPACK_SKIP_PIXELS,We),n.pixelStorei(n.UNPACK_SKIP_ROWS,je)}}function te(F,I,ee){let de=n.TEXTURE_2D;(I.isDataArrayTexture||I.isCompressedArrayTexture)&&(de=n.TEXTURE_2D_ARRAY),I.isData3DTexture&&(de=n.TEXTURE_3D);const Me=Se(F,I),fe=I.source;t.bindTexture(de,F.__webglTexture,n.TEXTURE0+ee);const Ue=r.get(fe);if(fe.version!==Ue.__version||Me===!0){t.activeTexture(n.TEXTURE0+ee);const Ae=Ct.getPrimaries(Ct.workingColorSpace),We=I.colorSpace===hs?null:Ct.getPrimaries(I.colorSpace),je=I.colorSpace===hs||Ae===We?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,I.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,I.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,je);let Ce=x(I.image,!1,i.maxTextureSize);Ce=rt(I,Ce);const Ne=s.convert(I.format,I.colorSpace),Ve=s.convert(I.type);let Ke=M(I.internalFormat,Ne,Ve,I.colorSpace,I.isVideoTexture);pe(de,I);let Re;const ht=I.mipmaps,H=I.isVideoTexture!==!0,Ee=Ue.__version===void 0||Me===!0,Oe=fe.dataReady,Be=S(I,Ce);if(I.isDepthTexture)Ke=E(I.format===cl,I.type),Ee&&(H?t.texStorage2D(n.TEXTURE_2D,1,Ke,Ce.width,Ce.height):t.texImage2D(n.TEXTURE_2D,0,Ke,Ce.width,Ce.height,0,Ne,Ve,null));else if(I.isDataTexture)if(ht.length>0){H&&Ee&&t.texStorage2D(n.TEXTURE_2D,Be,Ke,ht[0].width,ht[0].height);for(let Te=0,me=ht.length;Te<me;Te++)Re=ht[Te],H?Oe&&t.texSubImage2D(n.TEXTURE_2D,Te,0,0,Re.width,Re.height,Ne,Ve,Re.data):t.texImage2D(n.TEXTURE_2D,Te,Ke,Re.width,Re.height,0,Ne,Ve,Re.data);I.generateMipmaps=!1}else H?(Ee&&t.texStorage2D(n.TEXTURE_2D,Be,Ke,Ce.width,Ce.height),Oe&&V(I,Ce,Ne,Ve)):t.texImage2D(n.TEXTURE_2D,0,Ke,Ce.width,Ce.height,0,Ne,Ve,Ce.data);else if(I.isCompressedTexture)if(I.isCompressedArrayTexture){H&&Ee&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Be,Ke,ht[0].width,ht[0].height,Ce.depth);for(let Te=0,me=ht.length;Te<me;Te++)if(Re=ht[Te],I.format!==$r)if(Ne!==null)if(H){if(Oe)if(I.layerUpdates.size>0){const Ze=rv(Re.width,Re.height,I.format,I.type);for(const ct of I.layerUpdates){const Lt=Re.data.subarray(ct*Ze/Re.data.BYTES_PER_ELEMENT,(ct+1)*Ze/Re.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Te,0,0,ct,Re.width,Re.height,1,Ne,Lt)}I.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Te,0,0,0,Re.width,Re.height,Ce.depth,Ne,Re.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,Te,Ke,Re.width,Re.height,Ce.depth,0,Re.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else H?Oe&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,Te,0,0,0,Re.width,Re.height,Ce.depth,Ne,Ve,Re.data):t.texImage3D(n.TEXTURE_2D_ARRAY,Te,Ke,Re.width,Re.height,Ce.depth,0,Ne,Ve,Re.data)}else{H&&Ee&&t.texStorage2D(n.TEXTURE_2D,Be,Ke,ht[0].width,ht[0].height);for(let Te=0,me=ht.length;Te<me;Te++)Re=ht[Te],I.format!==$r?Ne!==null?H?Oe&&t.compressedTexSubImage2D(n.TEXTURE_2D,Te,0,0,Re.width,Re.height,Ne,Re.data):t.compressedTexImage2D(n.TEXTURE_2D,Te,Ke,Re.width,Re.height,0,Re.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):H?Oe&&t.texSubImage2D(n.TEXTURE_2D,Te,0,0,Re.width,Re.height,Ne,Ve,Re.data):t.texImage2D(n.TEXTURE_2D,Te,Ke,Re.width,Re.height,0,Ne,Ve,Re.data)}else if(I.isDataArrayTexture)if(H){if(Ee&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Be,Ke,Ce.width,Ce.height,Ce.depth),Oe)if(I.layerUpdates.size>0){const Te=rv(Ce.width,Ce.height,I.format,I.type);for(const me of I.layerUpdates){const Ze=Ce.data.subarray(me*Te/Ce.data.BYTES_PER_ELEMENT,(me+1)*Te/Ce.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,me,Ce.width,Ce.height,1,Ne,Ve,Ze)}I.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Ce.width,Ce.height,Ce.depth,Ne,Ve,Ce.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Ke,Ce.width,Ce.height,Ce.depth,0,Ne,Ve,Ce.data);else if(I.isData3DTexture)H?(Ee&&t.texStorage3D(n.TEXTURE_3D,Be,Ke,Ce.width,Ce.height,Ce.depth),Oe&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Ce.width,Ce.height,Ce.depth,Ne,Ve,Ce.data)):t.texImage3D(n.TEXTURE_3D,0,Ke,Ce.width,Ce.height,Ce.depth,0,Ne,Ve,Ce.data);else if(I.isFramebufferTexture){if(Ee)if(H)t.texStorage2D(n.TEXTURE_2D,Be,Ke,Ce.width,Ce.height);else{let Te=Ce.width,me=Ce.height;for(let Ze=0;Ze<Be;Ze++)t.texImage2D(n.TEXTURE_2D,Ze,Ke,Te,me,0,Ne,Ve,null),Te>>=1,me>>=1}}else if(ht.length>0){if(H&&Ee){const Te=wt(ht[0]);t.texStorage2D(n.TEXTURE_2D,Be,Ke,Te.width,Te.height)}for(let Te=0,me=ht.length;Te<me;Te++)Re=ht[Te],H?Oe&&t.texSubImage2D(n.TEXTURE_2D,Te,0,0,Ne,Ve,Re):t.texImage2D(n.TEXTURE_2D,Te,Ke,Ne,Ve,Re);I.generateMipmaps=!1}else if(H){if(Ee){const Te=wt(Ce);t.texStorage2D(n.TEXTURE_2D,Be,Ke,Te.width,Te.height)}Oe&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,Ne,Ve,Ce)}else t.texImage2D(n.TEXTURE_2D,0,Ke,Ne,Ve,Ce);v(I)&&_(de),Ue.__version=fe.version,I.onUpdate&&I.onUpdate(I)}F.__version=I.version}function W(F,I,ee){if(I.image.length!==6)return;const de=Se(F,I),Me=I.source;t.bindTexture(n.TEXTURE_CUBE_MAP,F.__webglTexture,n.TEXTURE0+ee);const fe=r.get(Me);if(Me.version!==fe.__version||de===!0){t.activeTexture(n.TEXTURE0+ee);const Ue=Ct.getPrimaries(Ct.workingColorSpace),Ae=I.colorSpace===hs?null:Ct.getPrimaries(I.colorSpace),We=I.colorSpace===hs||Ue===Ae?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,I.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,I.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,We);const je=I.isCompressedTexture||I.image[0].isCompressedTexture,Ce=I.image[0]&&I.image[0].isDataTexture,Ne=[];for(let me=0;me<6;me++)!je&&!Ce?Ne[me]=x(I.image[me],!0,i.maxCubemapSize):Ne[me]=Ce?I.image[me].image:I.image[me],Ne[me]=rt(I,Ne[me]);const Ve=Ne[0],Ke=s.convert(I.format,I.colorSpace),Re=s.convert(I.type),ht=M(I.internalFormat,Ke,Re,I.colorSpace),H=I.isVideoTexture!==!0,Ee=fe.__version===void 0||de===!0,Oe=Me.dataReady;let Be=S(I,Ve);pe(n.TEXTURE_CUBE_MAP,I);let Te;if(je){H&&Ee&&t.texStorage2D(n.TEXTURE_CUBE_MAP,Be,ht,Ve.width,Ve.height);for(let me=0;me<6;me++){Te=Ne[me].mipmaps;for(let Ze=0;Ze<Te.length;Ze++){const ct=Te[Ze];I.format!==$r?Ke!==null?H?Oe&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ze,0,0,ct.width,ct.height,Ke,ct.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ze,ht,ct.width,ct.height,0,ct.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):H?Oe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ze,0,0,ct.width,ct.height,Ke,Re,ct.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ze,ht,ct.width,ct.height,0,Ke,Re,ct.data)}}}else{if(Te=I.mipmaps,H&&Ee){Te.length>0&&Be++;const me=wt(Ne[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Be,ht,me.width,me.height)}for(let me=0;me<6;me++)if(Ce){H?Oe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,Ne[me].width,Ne[me].height,Ke,Re,Ne[me].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,ht,Ne[me].width,Ne[me].height,0,Ke,Re,Ne[me].data);for(let Ze=0;Ze<Te.length;Ze++){const Lt=Te[Ze].image[me].image;H?Oe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ze+1,0,0,Lt.width,Lt.height,Ke,Re,Lt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ze+1,ht,Lt.width,Lt.height,0,Ke,Re,Lt.data)}}else{H?Oe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,Ke,Re,Ne[me]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,ht,Ke,Re,Ne[me]);for(let Ze=0;Ze<Te.length;Ze++){const ct=Te[Ze];H?Oe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ze+1,0,0,Ke,Re,ct.image[me]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ze+1,ht,Ke,Re,ct.image[me])}}}v(I)&&_(n.TEXTURE_CUBE_MAP),fe.__version=Me.version,I.onUpdate&&I.onUpdate(I)}F.__version=I.version}function ue(F,I,ee,de,Me,fe){const Ue=s.convert(ee.format,ee.colorSpace),Ae=s.convert(ee.type),We=M(ee.internalFormat,Ue,Ae,ee.colorSpace),je=r.get(I),Ce=r.get(ee);if(Ce.__renderTarget=I,!je.__hasExternalTextures){const Ne=Math.max(1,I.width>>fe),Ve=Math.max(1,I.height>>fe);Me===n.TEXTURE_3D||Me===n.TEXTURE_2D_ARRAY?t.texImage3D(Me,fe,We,Ne,Ve,I.depth,0,Ue,Ae,null):t.texImage2D(Me,fe,We,Ne,Ve,0,Ue,Ae,null)}t.bindFramebuffer(n.FRAMEBUFFER,F),ve(I)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,de,Me,Ce.__webglTexture,0,De(I)):(Me===n.TEXTURE_2D||Me>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Me<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,de,Me,Ce.__webglTexture,fe),t.bindFramebuffer(n.FRAMEBUFFER,null)}function ye(F,I,ee){if(n.bindRenderbuffer(n.RENDERBUFFER,F),I.depthBuffer){const de=I.depthTexture,Me=de&&de.isDepthTexture?de.type:null,fe=E(I.stencilBuffer,Me),Ue=I.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ae=De(I);ve(I)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ae,fe,I.width,I.height):ee?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ae,fe,I.width,I.height):n.renderbufferStorage(n.RENDERBUFFER,fe,I.width,I.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Ue,n.RENDERBUFFER,F)}else{const de=I.textures;for(let Me=0;Me<de.length;Me++){const fe=de[Me],Ue=s.convert(fe.format,fe.colorSpace),Ae=s.convert(fe.type),We=M(fe.internalFormat,Ue,Ae,fe.colorSpace),je=De(I);ee&&ve(I)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,je,We,I.width,I.height):ve(I)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,je,We,I.width,I.height):n.renderbufferStorage(n.RENDERBUFFER,We,I.width,I.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Q(F,I){if(I&&I.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,F),!(I.depthTexture&&I.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const de=r.get(I.depthTexture);de.__renderTarget=I,(!de.__webglTexture||I.depthTexture.image.width!==I.width||I.depthTexture.image.height!==I.height)&&(I.depthTexture.image.width=I.width,I.depthTexture.image.height=I.height,I.depthTexture.needsUpdate=!0),ce(I.depthTexture,0);const Me=de.__webglTexture,fe=De(I);if(I.depthTexture.format===ll)ve(I)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,Me,0,fe):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,Me,0);else if(I.depthTexture.format===cl)ve(I)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,Me,0,fe):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,Me,0);else throw new Error("Unknown depthTexture format")}function Le(F){const I=r.get(F),ee=F.isWebGLCubeRenderTarget===!0;if(I.__boundDepthTexture!==F.depthTexture){const de=F.depthTexture;if(I.__depthDisposeCallback&&I.__depthDisposeCallback(),de){const Me=()=>{delete I.__boundDepthTexture,delete I.__depthDisposeCallback,de.removeEventListener("dispose",Me)};de.addEventListener("dispose",Me),I.__depthDisposeCallback=Me}I.__boundDepthTexture=de}if(F.depthTexture&&!I.__autoAllocateDepthBuffer){if(ee)throw new Error("target.depthTexture not supported in Cube render targets");const de=F.texture.mipmaps;de&&de.length>0?Q(I.__webglFramebuffer[0],F):Q(I.__webglFramebuffer,F)}else if(ee){I.__webglDepthbuffer=[];for(let de=0;de<6;de++)if(t.bindFramebuffer(n.FRAMEBUFFER,I.__webglFramebuffer[de]),I.__webglDepthbuffer[de]===void 0)I.__webglDepthbuffer[de]=n.createRenderbuffer(),ye(I.__webglDepthbuffer[de],F,!1);else{const Me=F.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,fe=I.__webglDepthbuffer[de];n.bindRenderbuffer(n.RENDERBUFFER,fe),n.framebufferRenderbuffer(n.FRAMEBUFFER,Me,n.RENDERBUFFER,fe)}}else{const de=F.texture.mipmaps;if(de&&de.length>0?t.bindFramebuffer(n.FRAMEBUFFER,I.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,I.__webglFramebuffer),I.__webglDepthbuffer===void 0)I.__webglDepthbuffer=n.createRenderbuffer(),ye(I.__webglDepthbuffer,F,!1);else{const Me=F.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,fe=I.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,fe),n.framebufferRenderbuffer(n.FRAMEBUFFER,Me,n.RENDERBUFFER,fe)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function le(F,I,ee){const de=r.get(F);I!==void 0&&ue(de.__webglFramebuffer,F,F.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),ee!==void 0&&Le(F)}function z(F){const I=F.texture,ee=r.get(F),de=r.get(I);F.addEventListener("dispose",q);const Me=F.textures,fe=F.isWebGLCubeRenderTarget===!0,Ue=Me.length>1;if(Ue||(de.__webglTexture===void 0&&(de.__webglTexture=n.createTexture()),de.__version=I.version,o.memory.textures++),fe){ee.__webglFramebuffer=[];for(let Ae=0;Ae<6;Ae++)if(I.mipmaps&&I.mipmaps.length>0){ee.__webglFramebuffer[Ae]=[];for(let We=0;We<I.mipmaps.length;We++)ee.__webglFramebuffer[Ae][We]=n.createFramebuffer()}else ee.__webglFramebuffer[Ae]=n.createFramebuffer()}else{if(I.mipmaps&&I.mipmaps.length>0){ee.__webglFramebuffer=[];for(let Ae=0;Ae<I.mipmaps.length;Ae++)ee.__webglFramebuffer[Ae]=n.createFramebuffer()}else ee.__webglFramebuffer=n.createFramebuffer();if(Ue)for(let Ae=0,We=Me.length;Ae<We;Ae++){const je=r.get(Me[Ae]);je.__webglTexture===void 0&&(je.__webglTexture=n.createTexture(),o.memory.textures++)}if(F.samples>0&&ve(F)===!1){ee.__webglMultisampledFramebuffer=n.createFramebuffer(),ee.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,ee.__webglMultisampledFramebuffer);for(let Ae=0;Ae<Me.length;Ae++){const We=Me[Ae];ee.__webglColorRenderbuffer[Ae]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,ee.__webglColorRenderbuffer[Ae]);const je=s.convert(We.format,We.colorSpace),Ce=s.convert(We.type),Ne=M(We.internalFormat,je,Ce,We.colorSpace,F.isXRRenderTarget===!0),Ve=De(F);n.renderbufferStorageMultisample(n.RENDERBUFFER,Ve,Ne,F.width,F.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ae,n.RENDERBUFFER,ee.__webglColorRenderbuffer[Ae])}n.bindRenderbuffer(n.RENDERBUFFER,null),F.depthBuffer&&(ee.__webglDepthRenderbuffer=n.createRenderbuffer(),ye(ee.__webglDepthRenderbuffer,F,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(fe){t.bindTexture(n.TEXTURE_CUBE_MAP,de.__webglTexture),pe(n.TEXTURE_CUBE_MAP,I);for(let Ae=0;Ae<6;Ae++)if(I.mipmaps&&I.mipmaps.length>0)for(let We=0;We<I.mipmaps.length;We++)ue(ee.__webglFramebuffer[Ae][We],F,I,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,We);else ue(ee.__webglFramebuffer[Ae],F,I,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,0);v(I)&&_(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Ue){for(let Ae=0,We=Me.length;Ae<We;Ae++){const je=Me[Ae],Ce=r.get(je);let Ne=n.TEXTURE_2D;(F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(Ne=F.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(Ne,Ce.__webglTexture),pe(Ne,je),ue(ee.__webglFramebuffer,F,je,n.COLOR_ATTACHMENT0+Ae,Ne,0),v(je)&&_(Ne)}t.unbindTexture()}else{let Ae=n.TEXTURE_2D;if((F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(Ae=F.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(Ae,de.__webglTexture),pe(Ae,I),I.mipmaps&&I.mipmaps.length>0)for(let We=0;We<I.mipmaps.length;We++)ue(ee.__webglFramebuffer[We],F,I,n.COLOR_ATTACHMENT0,Ae,We);else ue(ee.__webglFramebuffer,F,I,n.COLOR_ATTACHMENT0,Ae,0);v(I)&&_(Ae),t.unbindTexture()}F.depthBuffer&&Le(F)}function it(F){const I=F.textures;for(let ee=0,de=I.length;ee<de;ee++){const Me=I[ee];if(v(Me)){const fe=b(F),Ue=r.get(Me).__webglTexture;t.bindTexture(fe,Ue),_(fe),t.unbindTexture()}}}const Ie=[],$e=[];function qe(F){if(F.samples>0){if(ve(F)===!1){const I=F.textures,ee=F.width,de=F.height;let Me=n.COLOR_BUFFER_BIT;const fe=F.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ue=r.get(F),Ae=I.length>1;if(Ae)for(let je=0;je<I.length;je++)t.bindFramebuffer(n.FRAMEBUFFER,Ue.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+je,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Ue.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+je,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Ue.__webglMultisampledFramebuffer);const We=F.texture.mipmaps;We&&We.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ue.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ue.__webglFramebuffer);for(let je=0;je<I.length;je++){if(F.resolveDepthBuffer&&(F.depthBuffer&&(Me|=n.DEPTH_BUFFER_BIT),F.stencilBuffer&&F.resolveStencilBuffer&&(Me|=n.STENCIL_BUFFER_BIT)),Ae){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Ue.__webglColorRenderbuffer[je]);const Ce=r.get(I[je]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Ce,0)}n.blitFramebuffer(0,0,ee,de,0,0,ee,de,Me,n.NEAREST),l===!0&&(Ie.length=0,$e.length=0,Ie.push(n.COLOR_ATTACHMENT0+je),F.depthBuffer&&F.resolveDepthBuffer===!1&&(Ie.push(fe),$e.push(fe),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,$e)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Ie))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),Ae)for(let je=0;je<I.length;je++){t.bindFramebuffer(n.FRAMEBUFFER,Ue.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+je,n.RENDERBUFFER,Ue.__webglColorRenderbuffer[je]);const Ce=r.get(I[je]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Ue.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+je,n.TEXTURE_2D,Ce,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ue.__webglMultisampledFramebuffer)}else if(F.depthBuffer&&F.resolveDepthBuffer===!1&&l){const I=F.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[I])}}}function De(F){return Math.min(i.maxSamples,F.samples)}function ve(F){const I=r.get(F);return F.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function Ge(F){const I=o.render.frame;h.get(F)!==I&&(h.set(F,I),F.update())}function rt(F,I){const ee=F.colorSpace,de=F.format,Me=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||ee!==ko&&ee!==hs&&(Ct.getTransfer(ee)===Ut?(de!==$r||Me!==Ei)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ee)),I}function wt(F){return typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement?(c.width=F.naturalWidth||F.width,c.height=F.naturalHeight||F.height):typeof VideoFrame<"u"&&F instanceof VideoFrame?(c.width=F.displayWidth,c.height=F.displayHeight):(c.width=F.width,c.height=F.height),c}this.allocateTextureUnit=K,this.resetTextureUnits=Z,this.setTexture2D=ce,this.setTexture2DArray=J,this.setTexture3D=oe,this.setTextureCube=B,this.rebindTextures=le,this.setupRenderTarget=z,this.updateRenderTargetMipmap=it,this.updateMultisampleRenderTarget=qe,this.setupDepthRenderbuffer=Le,this.setupFrameBufferTexture=ue,this.useMultisampledRTT=ve}function l6(n,e){function t(r,i=hs){let s;const o=Ct.getTransfer(i);if(r===Ei)return n.UNSIGNED_BYTE;if(r===xd)return n.UNSIGNED_SHORT_4_4_4_4;if(r===yd)return n.UNSIGNED_SHORT_5_5_5_1;if(r===$1)return n.UNSIGNED_INT_5_9_9_9_REV;if(r===j1)return n.BYTE;if(r===X1)return n.SHORT;if(r===sl)return n.UNSIGNED_SHORT;if(r===vd)return n.INT;if(r===Hs)return n.UNSIGNED_INT;if(r===Fi)return n.FLOAT;if(r===ol)return n.HALF_FLOAT;if(r===Y1)return n.ALPHA;if(r===K1)return n.RGB;if(r===$r)return n.RGBA;if(r===ll)return n.DEPTH_COMPONENT;if(r===cl)return n.DEPTH_STENCIL;if(r===Z1)return n.RED;if(r===Sd)return n.RED_INTEGER;if(r===J1)return n.RG;if(r===Ed)return n.RG_INTEGER;if(r===bd)return n.RGBA_INTEGER;if(r===Vc||r===Hc||r===Gc||r===Wc)if(o===Ut)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===Vc)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Hc)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Gc)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Wc)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===Vc)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Hc)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Gc)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Wc)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===Md||r===wd||r===Td||r===Ad)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===Md)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===wd)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===Td)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===Ad)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===Cd||r===Rd||r===Pd)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===Cd||r===Rd)return o===Ut?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===Pd)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===Id||r===Ld||r===Od||r===qd||r===Dd||r===Nd||r===Ud||r===Fd||r===zd||r===kd||r===Bd||r===Vd||r===Hd||r===Gd)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===Id)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Ld)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Od)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===qd)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===Dd)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Nd)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===Ud)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===Fd)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===zd)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===kd)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===Bd)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Vd)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===Hd)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===Gd)return o===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===jc||r===Wd||r===jd)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===jc)return o===Ut?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===Wd)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===jd)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===Q1||r===Xd||r===$d||r===Yd)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===jc)return s.COMPRESSED_RED_RGTC1_EXT;if(r===Xd)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===$d)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===Yd)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===al?n.UNSIGNED_INT_24_8:n[r]!==void 0?n[r]:null}return{convert:t}}class Ov extends Dn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}}const c6=`
3894
3886
  void main() {
3895
3887
 
3896
3888
  gl_Position = vec4( position, 1.0 );
@@ -3914,7 +3906,7 @@ void main() {
3914
3906
 
3915
3907
  }
3916
3908
 
3917
- }`;class h6{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const r=new Ov(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,r=new Ts({vertexShader:c6,fragmentShader:u6,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Dn(new Iu(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class f6 extends Qs{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,h=null,f=null,p=null,d=null,m=null;const x=new h6,v={},_=t.getContextAttributes();let E=null,M=null;const b=[],S=[],T=new Be;let q=null;const O=new wr;O.viewport=new pn;const A=new wr;A.viewport=new pn;const L=[O,A],N=new c4;let Z=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let ne=b[V];return ne===void 0&&(ne=new yp,b[V]=ne),ne.getTargetRaySpace()},this.getControllerGrip=function(V){let ne=b[V];return ne===void 0&&(ne=new yp,b[V]=ne),ne.getGripSpace()},this.getHand=function(V){let ne=b[V];return ne===void 0&&(ne=new yp,b[V]=ne),ne.getHandSpace()};function ee(V){const ne=S.indexOf(V.inputSource);if(ne===-1)return;const X=b[ne];X!==void 0&&(X.update(V.inputSource,V.frame,c||o),X.dispatchEvent({type:V.type,data:V.inputSource}))}function ue(){i.removeEventListener("select",ee),i.removeEventListener("selectstart",ee),i.removeEventListener("selectend",ee),i.removeEventListener("squeeze",ee),i.removeEventListener("squeezestart",ee),i.removeEventListener("squeezeend",ee),i.removeEventListener("end",ue),i.removeEventListener("inputsourceschange",te);for(let V=0;V<b.length;V++){const ne=S[V];ne!==null&&(S[V]=null,b[V].disconnect(ne))}Z=null,Y=null,x.reset();for(const V in v)delete v[V];e.setRenderTarget(E),d=null,p=null,f=null,i=null,M=null,Ce.stop(),r.isPresenting=!1,e.setPixelRatio(q),e.setSize(T.width,T.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(V){s=V,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(V){a=V,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(V){c=V},this.getBaseLayer=function(){return p!==null?p:d},this.getBinding=function(){return f},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(V){if(i=V,i!==null){if(E=e.getRenderTarget(),i.addEventListener("select",ee),i.addEventListener("selectstart",ee),i.addEventListener("selectend",ee),i.addEventListener("squeeze",ee),i.addEventListener("squeezestart",ee),i.addEventListener("squeezeend",ee),i.addEventListener("end",ue),i.addEventListener("inputsourceschange",te),_.xrCompatible!==!0&&await t.makeXRCompatible(),q=e.getPixelRatio(),e.getSize(T),typeof XRWebGLBinding<"u"&&(f=new XRWebGLBinding(i,t)),f!==null&&"createProjectionLayer"in XRWebGLBinding.prototype){let X=null,pe=null,Ee=null;_.depth&&(Ee=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,X=_.stencil?_l:gl,pe=_.stencil?ml:Js);const Q={colorFormat:t.RGBA8,depthFormat:Ee,scaleFactor:s};p=f.createProjectionLayer(Q),i.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),M=new eo(p.textureWidth,p.textureHeight,{format:ri,type:Pi,depthTexture:new q_(p.textureWidth,p.textureHeight,pe,void 0,void 0,void 0,void 0,void 0,void 0,X),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{const X={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(i,t,X),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),M=new eo(d.framebufferWidth,d.framebufferHeight,{format:ri,type:Pi,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await i.requestReferenceSpace(a),Ce.setContext(i),Ce.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function te(V){for(let ne=0;ne<V.removed.length;ne++){const X=V.removed[ne],pe=S.indexOf(X);pe>=0&&(S[pe]=null,b[pe].disconnect(X))}for(let ne=0;ne<V.added.length;ne++){const X=V.added[ne];let pe=S.indexOf(X);if(pe===-1){for(let Q=0;Q<b.length;Q++)if(Q>=S.length){S.push(X),pe=Q;break}else if(S[Q]===null){S[Q]=X,pe=Q;break}if(pe===-1)break}const Ee=b[pe];Ee&&Ee.connect(X)}}const ae=new j,B=new j;function Se(V,ne,X){ae.setFromMatrixPosition(ne.matrixWorld),B.setFromMatrixPosition(X.matrixWorld);const pe=ae.distanceTo(B),Ee=ne.projectionMatrix.elements,Q=X.projectionMatrix.elements,Ne=Ee[14]/(Ee[10]-1),le=Ee[14]/(Ee[10]+1),F=(Ee[9]+1)/Ee[5],lt=(Ee[9]-1)/Ee[5],Le=(Ee[8]-1)/Ee[0],Ge=(Q[8]+1)/Q[0],De=Ne*Le,Ue=Ne*Ge,ge=pe/(-Le+Ge),$e=ge*-Le;if(ne.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX($e),V.translateZ(ge),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert(),Ee[10]===-1)V.projectionMatrix.copy(ne.projectionMatrix),V.projectionMatrixInverse.copy(ne.projectionMatrixInverse);else{const ot=Ne+ge,wt=le+ge,U=De-$e,I=Ue+(pe-$e),J=F*le/wt*ot,de=lt*le/wt*ot;V.projectionMatrix.makePerspective(U,I,J,de,ot,wt),V.projectionMatrixInverse.copy(V.projectionMatrix).invert()}}function $(V,ne){ne===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(ne.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(i===null)return;let ne=V.near,X=V.far;x.texture!==null&&(x.depthNear>0&&(ne=x.depthNear),x.depthFar>0&&(X=x.depthFar)),N.near=A.near=O.near=ne,N.far=A.far=O.far=X,(Z!==N.near||Y!==N.far)&&(i.updateRenderState({depthNear:N.near,depthFar:N.far}),Z=N.near,Y=N.far),N.layers.mask=V.layers.mask|6,O.layers.mask=N.layers.mask&3,A.layers.mask=N.layers.mask&5;const pe=V.parent,Ee=N.cameras;$(N,pe);for(let Q=0;Q<Ee.length;Q++)$(Ee[Q],pe);Ee.length===2?Se(N,O,A):N.projectionMatrix.copy(O.projectionMatrix),oe(V,N,pe)};function oe(V,ne,X){X===null?V.matrix.copy(ne.matrixWorld):(V.matrix.copy(X.matrixWorld),V.matrix.invert(),V.matrix.multiply(ne.matrixWorld)),V.matrix.decompose(V.position,V.quaternion,V.scale),V.updateMatrixWorld(!0),V.projectionMatrix.copy(ne.projectionMatrix),V.projectionMatrixInverse.copy(ne.projectionMatrixInverse),V.isPerspectiveCamera&&(V.fov=tu*2*Math.atan(1/V.projectionMatrix.elements[5]),V.zoom=1)}this.getCamera=function(){return N},this.getFoveation=function(){if(!(p===null&&d===null))return l},this.setFoveation=function(V){l=V,p!==null&&(p.fixedFoveation=V),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=V)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(N)},this.getCameraTexture=function(V){return v[V]};let Ae=null;function Ie(V,ne){if(h=ne.getViewerPose(c||o),m=ne,h!==null){const X=h.views;d!==null&&(e.setRenderTargetFramebuffer(M,d.framebuffer),e.setRenderTarget(M));let pe=!1;X.length!==N.cameras.length&&(N.cameras.length=0,pe=!0);for(let le=0;le<X.length;le++){const F=X[le];let lt=null;if(d!==null)lt=d.getViewport(F);else{const Ge=f.getViewSubImage(p,F);lt=Ge.viewport,le===0&&(e.setRenderTargetTextures(M,Ge.colorTexture,Ge.depthStencilTexture),e.setRenderTarget(M))}let Le=L[le];Le===void 0&&(Le=new wr,Le.layers.enable(le),Le.viewport=new pn,L[le]=Le),Le.matrix.fromArray(F.transform.matrix),Le.matrix.decompose(Le.position,Le.quaternion,Le.scale),Le.projectionMatrix.fromArray(F.projectionMatrix),Le.projectionMatrixInverse.copy(Le.projectionMatrix).invert(),Le.viewport.set(lt.x,lt.y,lt.width,lt.height),le===0&&(N.matrix.copy(Le.matrix),N.matrix.decompose(N.position,N.quaternion,N.scale)),pe===!0&&N.cameras.push(Le)}const Ee=i.enabledFeatures;if(Ee&&Ee.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&f){const le=f.getDepthInformation(X[0]);le&&le.isValid&&le.texture&&x.init(le,i.renderState)}if(Ee&&Ee.includes("camera-access")&&(e.state.unbindTexture(),f))for(let le=0;le<X.length;le++){const F=X[le].camera;if(F){let lt=v[F];lt||(lt=new Ov,v[F]=lt);const Le=f.getCameraImage(F);lt.sourceTexture=Le}}}for(let X=0;X<b.length;X++){const pe=S[X],Ee=b[X];pe!==null&&Ee!==void 0&&Ee.update(pe,ne,c||o)}Ae&&Ae(V,ne),ne.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:ne}),m=null}const Ce=new iv;Ce.setAnimationLoop(Ie),this.setAnimationLoop=function(V){Ae=V},this.dispose=function(){}}}const fo=new oi,d6=new Kt;function p6(n,e){function t(v,_){v.matrixAutoUpdate===!0&&v.updateMatrix(),_.value.copy(v.matrix)}function r(v,_){_.color.getRGB(v.fogColor.value,M_(n)),_.isFog?(v.fogNear.value=_.near,v.fogFar.value=_.far):_.isFogExp2&&(v.fogDensity.value=_.density)}function i(v,_,E,M,b){_.isMeshBasicMaterial||_.isMeshLambertMaterial?s(v,_):_.isMeshToonMaterial?(s(v,_),f(v,_)):_.isMeshPhongMaterial?(s(v,_),h(v,_)):_.isMeshStandardMaterial?(s(v,_),p(v,_),_.isMeshPhysicalMaterial&&d(v,_,b)):_.isMeshMatcapMaterial?(s(v,_),m(v,_)):_.isMeshDepthMaterial?s(v,_):_.isMeshDistanceMaterial?(s(v,_),x(v,_)):_.isMeshNormalMaterial?s(v,_):_.isLineBasicMaterial?(o(v,_),_.isLineDashedMaterial&&a(v,_)):_.isPointsMaterial?l(v,_,E,M):_.isSpriteMaterial?c(v,_):_.isShadowMaterial?(v.color.value.copy(_.color),v.opacity.value=_.opacity):_.isShaderMaterial&&(_.uniformsNeedUpdate=!1)}function s(v,_){v.opacity.value=_.opacity,_.color&&v.diffuse.value.copy(_.color),_.emissive&&v.emissive.value.copy(_.emissive).multiplyScalar(_.emissiveIntensity),_.map&&(v.map.value=_.map,t(_.map,v.mapTransform)),_.alphaMap&&(v.alphaMap.value=_.alphaMap,t(_.alphaMap,v.alphaMapTransform)),_.bumpMap&&(v.bumpMap.value=_.bumpMap,t(_.bumpMap,v.bumpMapTransform),v.bumpScale.value=_.bumpScale,_.side===lr&&(v.bumpScale.value*=-1)),_.normalMap&&(v.normalMap.value=_.normalMap,t(_.normalMap,v.normalMapTransform),v.normalScale.value.copy(_.normalScale),_.side===lr&&v.normalScale.value.negate()),_.displacementMap&&(v.displacementMap.value=_.displacementMap,t(_.displacementMap,v.displacementMapTransform),v.displacementScale.value=_.displacementScale,v.displacementBias.value=_.displacementBias),_.emissiveMap&&(v.emissiveMap.value=_.emissiveMap,t(_.emissiveMap,v.emissiveMapTransform)),_.specularMap&&(v.specularMap.value=_.specularMap,t(_.specularMap,v.specularMapTransform)),_.alphaTest>0&&(v.alphaTest.value=_.alphaTest);const E=e.get(_),M=E.envMap,b=E.envMapRotation;M&&(v.envMap.value=M,fo.copy(b),fo.x*=-1,fo.y*=-1,fo.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(fo.y*=-1,fo.z*=-1),v.envMapRotation.value.setFromMatrix4(d6.makeRotationFromEuler(fo)),v.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,v.reflectivity.value=_.reflectivity,v.ior.value=_.ior,v.refractionRatio.value=_.refractionRatio),_.lightMap&&(v.lightMap.value=_.lightMap,v.lightMapIntensity.value=_.lightMapIntensity,t(_.lightMap,v.lightMapTransform)),_.aoMap&&(v.aoMap.value=_.aoMap,v.aoMapIntensity.value=_.aoMapIntensity,t(_.aoMap,v.aoMapTransform))}function o(v,_){v.diffuse.value.copy(_.color),v.opacity.value=_.opacity,_.map&&(v.map.value=_.map,t(_.map,v.mapTransform))}function a(v,_){v.dashSize.value=_.dashSize,v.totalSize.value=_.dashSize+_.gapSize,v.scale.value=_.scale}function l(v,_,E,M){v.diffuse.value.copy(_.color),v.opacity.value=_.opacity,v.size.value=_.size*E,v.scale.value=M*.5,_.map&&(v.map.value=_.map,t(_.map,v.uvTransform)),_.alphaMap&&(v.alphaMap.value=_.alphaMap,t(_.alphaMap,v.alphaMapTransform)),_.alphaTest>0&&(v.alphaTest.value=_.alphaTest)}function c(v,_){v.diffuse.value.copy(_.color),v.opacity.value=_.opacity,v.rotation.value=_.rotation,_.map&&(v.map.value=_.map,t(_.map,v.mapTransform)),_.alphaMap&&(v.alphaMap.value=_.alphaMap,t(_.alphaMap,v.alphaMapTransform)),_.alphaTest>0&&(v.alphaTest.value=_.alphaTest)}function h(v,_){v.specular.value.copy(_.specular),v.shininess.value=Math.max(_.shininess,1e-4)}function f(v,_){_.gradientMap&&(v.gradientMap.value=_.gradientMap)}function p(v,_){v.metalness.value=_.metalness,_.metalnessMap&&(v.metalnessMap.value=_.metalnessMap,t(_.metalnessMap,v.metalnessMapTransform)),v.roughness.value=_.roughness,_.roughnessMap&&(v.roughnessMap.value=_.roughnessMap,t(_.roughnessMap,v.roughnessMapTransform)),_.envMap&&(v.envMapIntensity.value=_.envMapIntensity)}function d(v,_,E){v.ior.value=_.ior,_.sheen>0&&(v.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),v.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(v.sheenColorMap.value=_.sheenColorMap,t(_.sheenColorMap,v.sheenColorMapTransform)),_.sheenRoughnessMap&&(v.sheenRoughnessMap.value=_.sheenRoughnessMap,t(_.sheenRoughnessMap,v.sheenRoughnessMapTransform))),_.clearcoat>0&&(v.clearcoat.value=_.clearcoat,v.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(v.clearcoatMap.value=_.clearcoatMap,t(_.clearcoatMap,v.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(v.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,t(_.clearcoatRoughnessMap,v.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(v.clearcoatNormalMap.value=_.clearcoatNormalMap,t(_.clearcoatNormalMap,v.clearcoatNormalMapTransform),v.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===lr&&v.clearcoatNormalScale.value.negate())),_.dispersion>0&&(v.dispersion.value=_.dispersion),_.iridescence>0&&(v.iridescence.value=_.iridescence,v.iridescenceIOR.value=_.iridescenceIOR,v.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],v.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(v.iridescenceMap.value=_.iridescenceMap,t(_.iridescenceMap,v.iridescenceMapTransform)),_.iridescenceThicknessMap&&(v.iridescenceThicknessMap.value=_.iridescenceThicknessMap,t(_.iridescenceThicknessMap,v.iridescenceThicknessMapTransform))),_.transmission>0&&(v.transmission.value=_.transmission,v.transmissionSamplerMap.value=E.texture,v.transmissionSamplerSize.value.set(E.width,E.height),_.transmissionMap&&(v.transmissionMap.value=_.transmissionMap,t(_.transmissionMap,v.transmissionMapTransform)),v.thickness.value=_.thickness,_.thicknessMap&&(v.thicknessMap.value=_.thicknessMap,t(_.thicknessMap,v.thicknessMapTransform)),v.attenuationDistance.value=_.attenuationDistance,v.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(v.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(v.anisotropyMap.value=_.anisotropyMap,t(_.anisotropyMap,v.anisotropyMapTransform))),v.specularIntensity.value=_.specularIntensity,v.specularColor.value.copy(_.specularColor),_.specularColorMap&&(v.specularColorMap.value=_.specularColorMap,t(_.specularColorMap,v.specularColorMapTransform)),_.specularIntensityMap&&(v.specularIntensityMap.value=_.specularIntensityMap,t(_.specularIntensityMap,v.specularIntensityMapTransform))}function m(v,_){_.matcap&&(v.matcap.value=_.matcap)}function x(v,_){const E=e.get(_).light;v.referencePosition.value.setFromMatrixPosition(E.matrixWorld),v.nearDistance.value=E.shadow.camera.near,v.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function m6(n,e,t,r){let i={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,M){const b=M.program;r.uniformBlockBinding(E,b)}function c(E,M){let b=i[E.id];b===void 0&&(m(E),b=h(E),i[E.id]=b,E.addEventListener("dispose",v));const S=M.program;r.updateUBOMapping(E,S);const T=e.render.frame;s[E.id]!==T&&(p(E),s[E.id]=T)}function h(E){const M=f();E.__bindingPointIndex=M;const b=n.createBuffer(),S=E.__size,T=E.usage;return n.bindBuffer(n.UNIFORM_BUFFER,b),n.bufferData(n.UNIFORM_BUFFER,S,T),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,M,b),b}function f(){for(let E=0;E<a;E++)if(o.indexOf(E)===-1)return o.push(E),E;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(E){const M=i[E.id],b=E.uniforms,S=E.__cache;n.bindBuffer(n.UNIFORM_BUFFER,M);for(let T=0,q=b.length;T<q;T++){const O=Array.isArray(b[T])?b[T]:[b[T]];for(let A=0,L=O.length;A<L;A++){const N=O[A];if(d(N,T,A,S)===!0){const Z=N.__offset,Y=Array.isArray(N.value)?N.value:[N.value];let ee=0;for(let ue=0;ue<Y.length;ue++){const te=Y[ue],ae=x(te);typeof te=="number"||typeof te=="boolean"?(N.__data[0]=te,n.bufferSubData(n.UNIFORM_BUFFER,Z+ee,N.__data)):te.isMatrix3?(N.__data[0]=te.elements[0],N.__data[1]=te.elements[1],N.__data[2]=te.elements[2],N.__data[3]=0,N.__data[4]=te.elements[3],N.__data[5]=te.elements[4],N.__data[6]=te.elements[5],N.__data[7]=0,N.__data[8]=te.elements[6],N.__data[9]=te.elements[7],N.__data[10]=te.elements[8],N.__data[11]=0):(te.toArray(N.__data,ee),ee+=ae.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,Z,N.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function d(E,M,b,S){const T=E.value,q=M+"_"+b;if(S[q]===void 0)return typeof T=="number"||typeof T=="boolean"?S[q]=T:S[q]=T.clone(),!0;{const O=S[q];if(typeof T=="number"||typeof T=="boolean"){if(O!==T)return S[q]=T,!0}else if(O.equals(T)===!1)return O.copy(T),!0}return!1}function m(E){const M=E.uniforms;let b=0;const S=16;for(let q=0,O=M.length;q<O;q++){const A=Array.isArray(M[q])?M[q]:[M[q]];for(let L=0,N=A.length;L<N;L++){const Z=A[L],Y=Array.isArray(Z.value)?Z.value:[Z.value];for(let ee=0,ue=Y.length;ee<ue;ee++){const te=Y[ee],ae=x(te),B=b%S,Se=B%ae.boundary,$=B+Se;b+=Se,$!==0&&S-$<ae.storage&&(b+=S-$),Z.__data=new Float32Array(ae.storage/Float32Array.BYTES_PER_ELEMENT),Z.__offset=b,b+=ae.storage}}}const T=b%S;return T>0&&(b+=S-T),E.__size=b,E.__cache={},this}function x(E){const M={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(M.boundary=4,M.storage=4):E.isVector2?(M.boundary=8,M.storage=8):E.isVector3||E.isColor?(M.boundary=16,M.storage=12):E.isVector4?(M.boundary=16,M.storage=16):E.isMatrix3?(M.boundary=48,M.storage=48):E.isMatrix4?(M.boundary=64,M.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),M}function v(E){const M=E.target;M.removeEventListener("dispose",v);const b=o.indexOf(M.__bindingPointIndex);o.splice(b,1),n.deleteBuffer(i[M.id]),delete i[M.id],delete s[M.id]}function _(){for(const E in i)n.deleteBuffer(i[E]);o=[],i={},s={}}return{bind:l,update:c,dispose:_}}class g6{constructor(e={}){const{canvas:t=Bb(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:p=!1}=e;this.isWebGLRenderer=!0;let d;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=r.getContextAttributes().alpha}else d=o;const m=new Uint32Array(4),x=new Int32Array(4);let v=null,_=null;const E=[],M=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=vs,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const b=this;let S=!1;this._outputColorSpace=Er;let T=0,q=0,O=null,A=-1,L=null;const N=new pn,Z=new pn;let Y=null;const ee=new Ct(0);let ue=0,te=t.width,ae=t.height,B=1,Se=null,$=null;const oe=new pn(0,0,te,ae),Ae=new pn(0,0,te,ae);let Ie=!1;const Ce=new Ep;let V=!1,ne=!1;const X=new Kt,pe=new j,Ee=new pn,Q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ne=!1;function le(){return O===null?B:1}let F=r;function lt(P,G){return t.getContext(P,G)}try{const P={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${rd}`),t.addEventListener("webglcontextlost",Oe,!1),t.addEventListener("webglcontextrestored",Ve,!1),t.addEventListener("webglcontextcreationerror",we,!1),F===null){const G="webgl2";if(F=lt(G,P),F===null)throw lt(G)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(P){throw console.error("THREE.WebGLRenderer: "+P.message),P}let Le,Ge,De,Ue,ge,$e,ot,wt,U,I,J,de,be,fe,Fe,Te,Ye,Ke,Re,ze,We,tt,Pe,gt;function H(){Le=new T5(F),Le.init(),tt=new l6(F,Le),Ge=new x5(F,Le,e,tt),De=new o6(F,Le),Ge.reversedDepthBuffer&&p&&De.buffers.depth.setReversed(!0),Ue=new R5(F),ge=new XT,$e=new a6(F,Le,De,ge,Ge,tt,Ue),ot=new S5(b),wt=new w5(b),U=new m4(F),Pe=new _5(F,U),I=new A5(F,U,Ue,Pe),J=new I5(F,I,U,Ue),Re=new P5(F,Ge,$e),Te=new y5(ge),de=new jT(b,ot,wt,Le,Ge,Pe,Te),be=new p6(b,ge),fe=new YT,Fe=new t6(Le),Ke=new g5(b,ot,wt,De,J,d,l),Ye=new i6(b,J,Ge),gt=new m6(F,Ue,Ge,De),ze=new v5(F,Le,Ue),We=new C5(F,Le,Ue),Ue.programs=de.programs,b.capabilities=Ge,b.extensions=Le,b.properties=ge,b.renderLists=fe,b.shadowMap=Ye,b.state=De,b.info=Ue}H();const _e=new f6(b,F);this.xr=_e,this.getContext=function(){return F},this.getContextAttributes=function(){return F.getContextAttributes()},this.forceContextLoss=function(){const P=Le.get("WEBGL_lose_context");P&&P.loseContext()},this.forceContextRestore=function(){const P=Le.get("WEBGL_lose_context");P&&P.restoreContext()},this.getPixelRatio=function(){return B},this.setPixelRatio=function(P){P!==void 0&&(B=P,this.setSize(te,ae,!1))},this.getSize=function(P){return P.set(te,ae)},this.setSize=function(P,G,re=!0){if(_e.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}te=P,ae=G,t.width=Math.floor(P*B),t.height=Math.floor(G*B),re===!0&&(t.style.width=P+"px",t.style.height=G+"px"),this.setViewport(0,0,P,G)},this.getDrawingBufferSize=function(P){return P.set(te*B,ae*B).floor()},this.setDrawingBufferSize=function(P,G,re){te=P,ae=G,B=re,t.width=Math.floor(P*re),t.height=Math.floor(G*re),this.setViewport(0,0,P,G)},this.getCurrentViewport=function(P){return P.copy(N)},this.getViewport=function(P){return P.copy(oe)},this.setViewport=function(P,G,re,ie){P.isVector4?oe.set(P.x,P.y,P.z,P.w):oe.set(P,G,re,ie),De.viewport(N.copy(oe).multiplyScalar(B).round())},this.getScissor=function(P){return P.copy(Ae)},this.setScissor=function(P,G,re,ie){P.isVector4?Ae.set(P.x,P.y,P.z,P.w):Ae.set(P,G,re,ie),De.scissor(Z.copy(Ae).multiplyScalar(B).round())},this.getScissorTest=function(){return Ie},this.setScissorTest=function(P){De.setScissorTest(Ie=P)},this.setOpaqueSort=function(P){Se=P},this.setTransparentSort=function(P){$=P},this.getClearColor=function(P){return P.copy(Ke.getClearColor())},this.setClearColor=function(){Ke.setClearColor(...arguments)},this.getClearAlpha=function(){return Ke.getClearAlpha()},this.setClearAlpha=function(){Ke.setClearAlpha(...arguments)},this.clear=function(P=!0,G=!0,re=!0){let ie=0;if(P){let W=!1;if(O!==null){const Me=O.texture.format;W=Me===bd||Me===Ed||Me===Sd}if(W){const Me=O.texture.type,ke=Me===Pi||Me===Js||Me===dl||Me===ml||Me===xd||Me===yd,nt=Ke.getClearColor(),et=Ke.getClearAlpha(),ct=nt.r,mt=nt.g,rt=nt.b;ke?(m[0]=ct,m[1]=mt,m[2]=rt,m[3]=et,F.clearBufferuiv(F.COLOR,0,m)):(x[0]=ct,x[1]=mt,x[2]=rt,x[3]=et,F.clearBufferiv(F.COLOR,0,x))}else ie|=F.COLOR_BUFFER_BIT}G&&(ie|=F.DEPTH_BUFFER_BIT),re&&(ie|=F.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),F.clear(ie)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Oe,!1),t.removeEventListener("webglcontextrestored",Ve,!1),t.removeEventListener("webglcontextcreationerror",we,!1),Ke.dispose(),fe.dispose(),Fe.dispose(),ge.dispose(),ot.dispose(),wt.dispose(),J.dispose(),Pe.dispose(),gt.dispose(),de.dispose(),_e.dispose(),_e.removeEventListener("sessionstart",jn),_e.removeEventListener("sessionend",vo),Cr.stop()};function Oe(P){P.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),S=!0}function Ve(){console.log("THREE.WebGLRenderer: Context Restored."),S=!1;const P=Ue.autoReset,G=Ye.enabled,re=Ye.autoUpdate,ie=Ye.needsUpdate,W=Ye.type;H(),Ue.autoReset=P,Ye.enabled=G,Ye.autoUpdate=re,Ye.needsUpdate=ie,Ye.type=W}function we(P){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",P.statusMessage)}function me(P){const G=P.target;G.removeEventListener("dispose",me),Qe(G)}function Qe(P){ft(P),ge.remove(P)}function ft(P){const G=ge.get(P).programs;G!==void 0&&(G.forEach(function(re){de.releaseProgram(re)}),P.isShaderMaterial&&de.releaseShaderCache(P))}this.renderBufferDirect=function(P,G,re,ie,W,Me){G===null&&(G=Q);const ke=W.isMesh&&W.matrixWorld.determinant()<0,nt=Pt(P,G,re,ie,W);De.setMaterial(ie,ke);let et=re.index,ct=1;if(ie.wireframe===!0){if(et=I.getWireframeAttribute(re),et===void 0)return;ct=2}const mt=re.drawRange,rt=re.attributes.position;let Tt=mt.start*ct,Ut=(mt.start+mt.count)*ct;Me!==null&&(Tt=Math.max(Tt,Me.start*ct),Ut=Math.min(Ut,(Me.start+Me.count)*ct)),et!==null?(Tt=Math.max(Tt,0),Ut=Math.min(Ut,et.count)):rt!=null&&(Tt=Math.max(Tt,0),Ut=Math.min(Ut,rt.count));const an=Ut-Tt;if(an<0||an===1/0)return;Pe.setup(W,ie,nt,re,et);let Bt,Vt=ze;if(et!==null&&(Bt=U.get(et),Vt=We,Vt.setIndex(Bt)),W.isMesh)ie.wireframe===!0?(De.setLineWidth(ie.wireframeLinewidth*le()),Vt.setMode(F.LINES)):Vt.setMode(F.TRIANGLES);else if(W.isLine){let ut=ie.linewidth;ut===void 0&&(ut=1),De.setLineWidth(ut*le()),W.isLineSegments?Vt.setMode(F.LINES):W.isLineLoop?Vt.setMode(F.LINE_LOOP):Vt.setMode(F.LINE_STRIP)}else W.isPoints?Vt.setMode(F.POINTS):W.isSprite&&Vt.setMode(F.TRIANGLES);if(W.isBatchedMesh)if(W._multiDrawInstances!==null)Qo("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Vt.renderMultiDrawInstances(W._multiDrawStarts,W._multiDrawCounts,W._multiDrawCount,W._multiDrawInstances);else if(Le.get("WEBGL_multi_draw"))Vt.renderMultiDraw(W._multiDrawStarts,W._multiDrawCounts,W._multiDrawCount);else{const ut=W._multiDrawStarts,ln=W._multiDrawCounts,Rt=W._multiDrawCount,Xn=et?U.get(et).bytesPerElement:1,as=ge.get(ie).currentProgram.getUniforms();for(let $n=0;$n<Rt;$n++)as.setValue(F,"_gl_DrawID",$n),Vt.render(ut[$n]/Xn,ln[$n])}else if(W.isInstancedMesh)Vt.renderInstances(Tt,an,W.count);else if(re.isInstancedBufferGeometry){const ut=re._maxInstanceCount!==void 0?re._maxInstanceCount:1/0,ln=Math.min(re.instanceCount,ut);Vt.renderInstances(Tt,an,ln)}else Vt.render(Tt,an)};function Ot(P,G,re){P.transparent===!0&&P.side===Ci&&P.forceSinglePass===!1?(P.side=lr,P.needsUpdate=!0,ye(P,G,re),P.side=gs,P.needsUpdate=!0,ye(P,G,re),P.side=Ci):ye(P,G,re)}this.compile=function(P,G,re=null){re===null&&(re=P),_=Fe.get(re),_.init(G),M.push(_),re.traverseVisible(function(W){W.isLight&&W.layers.test(G.layers)&&(_.pushLight(W),W.castShadow&&_.pushShadow(W))}),P!==re&&P.traverseVisible(function(W){W.isLight&&W.layers.test(G.layers)&&(_.pushLight(W),W.castShadow&&_.pushShadow(W))}),_.setupLights();const ie=new Set;return P.traverse(function(W){if(!(W.isMesh||W.isPoints||W.isLine||W.isSprite))return;const Me=W.material;if(Me)if(Array.isArray(Me))for(let ke=0;ke<Me.length;ke++){const nt=Me[ke];Ot(nt,re,W),ie.add(nt)}else Ot(Me,re,W),ie.add(Me)}),_=M.pop(),ie},this.compileAsync=function(P,G,re=null){const ie=this.compile(P,G,re);return new Promise(W=>{function Me(){if(ie.forEach(function(ke){ge.get(ke).currentProgram.isReady()&&ie.delete(ke)}),ie.size===0){W(P);return}setTimeout(Me,10)}Le.get("KHR_parallel_shader_compile")!==null?Me():setTimeout(Me,10)})};let _t=null;function Ar(P){_t&&_t(P)}function jn(){Cr.stop()}function vo(){Cr.start()}const Cr=new iv;Cr.setAnimationLoop(Ar),typeof self<"u"&&Cr.setContext(self),this.setAnimationLoop=function(P){_t=P,_e.setAnimationLoop(P),P===null?Cr.stop():Cr.start()},_e.addEventListener("sessionstart",jn),_e.addEventListener("sessionend",vo),this.render=function(P,G){if(G!==void 0&&G.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(S===!0)return;if(P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),G.parent===null&&G.matrixWorldAutoUpdate===!0&&G.updateMatrixWorld(),_e.enabled===!0&&_e.isPresenting===!0&&(_e.cameraAutoUpdate===!0&&_e.updateCamera(G),G=_e.getCamera()),P.isScene===!0&&P.onBeforeRender(b,P,G,O),_=Fe.get(P,M.length),_.init(G),M.push(_),X.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse),Ce.setFromProjectionMatrix(X,Ii,G.reversedDepth),ne=this.localClippingEnabled,V=Te.init(this.clippingPlanes,ne),v=fe.get(P,E.length),v.init(),E.push(v),_e.enabled===!0&&_e.isPresenting===!0){const Me=b.xr.getDepthSensingMesh();Me!==null&&Os(Me,G,-1/0,b.sortObjects)}Os(P,G,0,b.sortObjects),v.finish(),b.sortObjects===!0&&v.sort(Se,$),Ne=_e.enabled===!1||_e.isPresenting===!1||_e.hasDepthSensing()===!1,Ne&&Ke.addToRenderList(v,P),this.info.render.frame++,V===!0&&Te.beginShadows();const re=_.state.shadowsArray;Ye.render(re,P,G),V===!0&&Te.endShadows(),this.info.autoReset===!0&&this.info.reset();const ie=v.opaque,W=v.transmissive;if(_.setupLights(),G.isArrayCamera){const Me=G.cameras;if(W.length>0)for(let ke=0,nt=Me.length;ke<nt;ke++){const et=Me[ke];qs(ie,W,P,et)}Ne&&Ke.render(P);for(let ke=0,nt=Me.length;ke<nt;ke++){const et=Me[ke];Ia(v,P,et,et.viewport)}}else W.length>0&&qs(ie,W,P,G),Ne&&Ke.render(P),Ia(v,P,G);O!==null&&q===0&&($e.updateMultisampleRenderTarget(O),$e.updateRenderTargetMipmap(O)),P.isScene===!0&&P.onAfterRender(b,P,G),Pe.resetDefaultState(),A=-1,L=null,M.pop(),M.length>0?(_=M[M.length-1],V===!0&&Te.setGlobalState(b.clippingPlanes,_.state.camera)):_=null,E.pop(),E.length>0?v=E[E.length-1]:v=null};function Os(P,G,re,ie){if(P.visible===!1)return;if(P.layers.test(G.layers)){if(P.isGroup)re=P.renderOrder;else if(P.isLOD)P.autoUpdate===!0&&P.update(G);else if(P.isLight)_.pushLight(P),P.castShadow&&_.pushShadow(P);else if(P.isSprite){if(!P.frustumCulled||Ce.intersectsSprite(P)){ie&&Ee.setFromMatrixPosition(P.matrixWorld).applyMatrix4(X);const ke=J.update(P),nt=P.material;nt.visible&&v.push(P,ke,nt,re,Ee.z,null)}}else if((P.isMesh||P.isLine||P.isPoints)&&(!P.frustumCulled||Ce.intersectsObject(P))){const ke=J.update(P),nt=P.material;if(ie&&(P.boundingSphere!==void 0?(P.boundingSphere===null&&P.computeBoundingSphere(),Ee.copy(P.boundingSphere.center)):(ke.boundingSphere===null&&ke.computeBoundingSphere(),Ee.copy(ke.boundingSphere.center)),Ee.applyMatrix4(P.matrixWorld).applyMatrix4(X)),Array.isArray(nt)){const et=ke.groups;for(let ct=0,mt=et.length;ct<mt;ct++){const rt=et[ct],Tt=nt[rt.materialIndex];Tt&&Tt.visible&&v.push(P,ke,Tt,re,Ee.z,rt)}}else nt.visible&&v.push(P,ke,nt,re,Ee.z,null)}}const Me=P.children;for(let ke=0,nt=Me.length;ke<nt;ke++)Os(Me[ke],G,re,ie)}function Ia(P,G,re,ie){const W=P.opaque,Me=P.transmissive,ke=P.transparent;_.setupLightsView(re),V===!0&&Te.setGlobalState(b.clippingPlanes,re),ie&&De.viewport(N.copy(ie)),W.length>0&&Di(W,G,re),Me.length>0&&Di(Me,G,re),ke.length>0&&Di(ke,G,re),De.buffers.depth.setTest(!0),De.buffers.depth.setMask(!0),De.buffers.color.setMask(!0),De.setPolygonOffset(!1)}function qs(P,G,re,ie){if((re.isScene===!0?re.overrideMaterial:null)!==null)return;_.state.transmissionRenderTarget[ie.id]===void 0&&(_.state.transmissionRenderTarget[ie.id]=new eo(1,1,{generateMipmaps:!0,type:Le.has("EXT_color_buffer_half_float")||Le.has("EXT_color_buffer_float")?pl:Pi,minFilter:Zs,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Nt.workingColorSpace}));const Me=_.state.transmissionRenderTarget[ie.id],ke=ie.viewport||N;Me.setSize(ke.z*b.transmissionResolutionScale,ke.w*b.transmissionResolutionScale);const nt=b.getRenderTarget(),et=b.getActiveCubeFace(),ct=b.getActiveMipmapLevel();b.setRenderTarget(Me),b.getClearColor(ee),ue=b.getClearAlpha(),ue<1&&b.setClearColor(16777215,.5),b.clear(),Ne&&Ke.render(re);const mt=b.toneMapping;b.toneMapping=vs;const rt=ie.viewport;if(ie.viewport!==void 0&&(ie.viewport=void 0),_.setupLightsView(ie),V===!0&&Te.setGlobalState(b.clippingPlanes,ie),Di(P,re,ie),$e.updateMultisampleRenderTarget(Me),$e.updateRenderTargetMipmap(Me),Le.has("WEBGL_multisampled_render_to_texture")===!1){let Tt=!1;for(let Ut=0,an=G.length;Ut<an;Ut++){const Bt=G[Ut],Vt=Bt.object,ut=Bt.geometry,ln=Bt.material,Rt=Bt.group;if(ln.side===Ci&&Vt.layers.test(ie.layers)){const Xn=ln.side;ln.side=lr,ln.needsUpdate=!0,k(Vt,re,ie,ut,ln,Rt),ln.side=Xn,ln.needsUpdate=!0,Tt=!0}}Tt===!0&&($e.updateMultisampleRenderTarget(Me),$e.updateRenderTargetMipmap(Me))}b.setRenderTarget(nt,et,ct),b.setClearColor(ee,ue),rt!==void 0&&(ie.viewport=rt),b.toneMapping=mt}function Di(P,G,re){const ie=G.isScene===!0?G.overrideMaterial:null;for(let W=0,Me=P.length;W<Me;W++){const ke=P[W],nt=ke.object,et=ke.geometry,ct=ke.group;let mt=ke.material;mt.allowOverride===!0&&ie!==null&&(mt=ie),nt.layers.test(re.layers)&&k(nt,G,re,et,mt,ct)}}function k(P,G,re,ie,W,Me){P.onBeforeRender(b,G,re,ie,W,Me),P.modelViewMatrix.multiplyMatrices(re.matrixWorldInverse,P.matrixWorld),P.normalMatrix.getNormalMatrix(P.modelViewMatrix),W.onBeforeRender(b,G,re,ie,P,Me),W.transparent===!0&&W.side===Ci&&W.forceSinglePass===!1?(W.side=lr,W.needsUpdate=!0,b.renderBufferDirect(re,G,ie,W,P,Me),W.side=gs,W.needsUpdate=!0,b.renderBufferDirect(re,G,ie,W,P,Me),W.side=Ci):b.renderBufferDirect(re,G,ie,W,P,Me),P.onAfterRender(b,G,re,ie,W,Me)}function ye(P,G,re){G.isScene!==!0&&(G=Q);const ie=ge.get(P),W=_.state.lights,Me=_.state.shadowsArray,ke=W.state.version,nt=de.getParameters(P,W.state,Me,G,re),et=de.getProgramCacheKey(nt);let ct=ie.programs;ie.environment=P.isMeshStandardMaterial?G.environment:null,ie.fog=G.fog,ie.envMap=(P.isMeshStandardMaterial?wt:ot).get(P.envMap||ie.environment),ie.envMapRotation=ie.environment!==null&&P.envMap===null?G.environmentRotation:P.envMapRotation,ct===void 0&&(P.addEventListener("dispose",me),ct=new Map,ie.programs=ct);let mt=ct.get(et);if(mt!==void 0){if(ie.currentProgram===mt&&ie.lightsStateVersion===ke)return dt(P,nt),mt}else nt.uniforms=de.getUniforms(P),P.onBeforeCompile(nt,b),mt=de.acquireProgram(nt,et),ct.set(et,mt),ie.uniforms=nt.uniforms;const rt=ie.uniforms;return(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)&&(rt.clippingPlanes=Te.uniform),dt(P,nt),ie.needsLights=pt(P),ie.lightsStateVersion=ke,ie.needsLights&&(rt.ambientLightColor.value=W.state.ambient,rt.lightProbe.value=W.state.probe,rt.directionalLights.value=W.state.directional,rt.directionalLightShadows.value=W.state.directionalShadow,rt.spotLights.value=W.state.spot,rt.spotLightShadows.value=W.state.spotShadow,rt.rectAreaLights.value=W.state.rectArea,rt.ltc_1.value=W.state.rectAreaLTC1,rt.ltc_2.value=W.state.rectAreaLTC2,rt.pointLights.value=W.state.point,rt.pointLightShadows.value=W.state.pointShadow,rt.hemisphereLights.value=W.state.hemi,rt.directionalShadowMap.value=W.state.directionalShadowMap,rt.directionalShadowMatrix.value=W.state.directionalShadowMatrix,rt.spotShadowMap.value=W.state.spotShadowMap,rt.spotLightMatrix.value=W.state.spotLightMatrix,rt.spotLightMap.value=W.state.spotLightMap,rt.pointShadowMap.value=W.state.pointShadowMap,rt.pointShadowMatrix.value=W.state.pointShadowMatrix),ie.currentProgram=mt,ie.uniformsList=null,mt}function je(P){if(P.uniformsList===null){const G=P.currentProgram.getUniforms();P.uniformsList=Nu.seqWithValue(G.seq,P.uniforms)}return P.uniformsList}function dt(P,G){const re=ge.get(P);re.outputColorSpace=G.outputColorSpace,re.batching=G.batching,re.batchingColor=G.batchingColor,re.instancing=G.instancing,re.instancingColor=G.instancingColor,re.instancingMorph=G.instancingMorph,re.skinning=G.skinning,re.morphTargets=G.morphTargets,re.morphNormals=G.morphNormals,re.morphColors=G.morphColors,re.morphTargetsCount=G.morphTargetsCount,re.numClippingPlanes=G.numClippingPlanes,re.numIntersection=G.numClipIntersection,re.vertexAlphas=G.vertexAlphas,re.vertexTangents=G.vertexTangents,re.toneMapping=G.toneMapping}function Pt(P,G,re,ie,W){G.isScene!==!0&&(G=Q),$e.resetTextureUnits();const Me=G.fog,ke=ie.isMeshStandardMaterial?G.environment:null,nt=O===null?b.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:Ko,et=(ie.isMeshStandardMaterial?wt:ot).get(ie.envMap||ke),ct=ie.vertexColors===!0&&!!re.attributes.color&&re.attributes.color.itemSize===4,mt=!!re.attributes.tangent&&(!!ie.normalMap||ie.anisotropy>0),rt=!!re.morphAttributes.position,Tt=!!re.morphAttributes.normal,Ut=!!re.morphAttributes.color;let an=vs;ie.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(an=b.toneMapping);const Bt=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,Vt=Bt!==void 0?Bt.length:0,ut=ge.get(ie),ln=_.state.lights;if(V===!0&&(ne===!0||P!==L)){const Un=P===L&&ie.id===A;Te.setState(ie,P,Un)}let Rt=!1;ie.version===ut.__version?(ut.needsLights&&ut.lightsStateVersion!==ln.state.version||ut.outputColorSpace!==nt||W.isBatchedMesh&&ut.batching===!1||!W.isBatchedMesh&&ut.batching===!0||W.isBatchedMesh&&ut.batchingColor===!0&&W.colorTexture===null||W.isBatchedMesh&&ut.batchingColor===!1&&W.colorTexture!==null||W.isInstancedMesh&&ut.instancing===!1||!W.isInstancedMesh&&ut.instancing===!0||W.isSkinnedMesh&&ut.skinning===!1||!W.isSkinnedMesh&&ut.skinning===!0||W.isInstancedMesh&&ut.instancingColor===!0&&W.instanceColor===null||W.isInstancedMesh&&ut.instancingColor===!1&&W.instanceColor!==null||W.isInstancedMesh&&ut.instancingMorph===!0&&W.morphTexture===null||W.isInstancedMesh&&ut.instancingMorph===!1&&W.morphTexture!==null||ut.envMap!==et||ie.fog===!0&&ut.fog!==Me||ut.numClippingPlanes!==void 0&&(ut.numClippingPlanes!==Te.numPlanes||ut.numIntersection!==Te.numIntersection)||ut.vertexAlphas!==ct||ut.vertexTangents!==mt||ut.morphTargets!==rt||ut.morphNormals!==Tt||ut.morphColors!==Ut||ut.toneMapping!==an||ut.morphTargetsCount!==Vt)&&(Rt=!0):(Rt=!0,ut.__version=ie.version);let Xn=ut.currentProgram;Rt===!0&&(Xn=ye(ie,G,W));let as=!1,$n=!1,Ds=!1;const nn=Xn.getUniforms(),nr=ut.uniforms;if(De.useProgram(Xn.program)&&(as=!0,$n=!0,Ds=!0),ie.id!==A&&(A=ie.id,$n=!0),as||L!==P){De.buffers.depth.getReversed()&&P.reversedDepth!==!0&&(P._reversedDepth=!0,P.updateProjectionMatrix()),nn.setValue(F,"projectionMatrix",P.projectionMatrix),nn.setValue(F,"viewMatrix",P.matrixWorldInverse);const Yn=nn.map.cameraPosition;Yn!==void 0&&Yn.setValue(F,pe.setFromMatrixPosition(P.matrixWorld)),Ge.logarithmicDepthBuffer&&nn.setValue(F,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&nn.setValue(F,"isOrthographic",P.isOrthographicCamera===!0),L!==P&&(L=P,$n=!0,Ds=!0)}if(W.isSkinnedMesh){nn.setOptional(F,W,"bindMatrix"),nn.setOptional(F,W,"bindMatrixInverse");const Un=W.skeleton;Un&&(Un.boneTexture===null&&Un.computeBoneTexture(),nn.setValue(F,"boneTexture",Un.boneTexture,$e))}W.isBatchedMesh&&(nn.setOptional(F,W,"batchingTexture"),nn.setValue(F,"batchingTexture",W._matricesTexture,$e),nn.setOptional(F,W,"batchingIdTexture"),nn.setValue(F,"batchingIdTexture",W._indirectTexture,$e),nn.setOptional(F,W,"batchingColorTexture"),W._colorsTexture!==null&&nn.setValue(F,"batchingColorTexture",W._colorsTexture,$e));const fr=re.morphAttributes;if((fr.position!==void 0||fr.normal!==void 0||fr.color!==void 0)&&Re.update(W,re,Xn),($n||ut.receiveShadow!==W.receiveShadow)&&(ut.receiveShadow=W.receiveShadow,nn.setValue(F,"receiveShadow",W.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(nr.envMap.value=et,nr.flipEnvMap.value=et.isCubeTexture&&et.isRenderTargetTexture===!1?-1:1),ie.isMeshStandardMaterial&&ie.envMap===null&&G.environment!==null&&(nr.envMapIntensity.value=G.environmentIntensity),$n&&(nn.setValue(F,"toneMappingExposure",b.toneMappingExposure),ut.needsLights&&qt(nr,Ds),Me&&ie.fog===!0&&be.refreshFogUniforms(nr,Me),be.refreshMaterialUniforms(nr,ie,B,ae,_.state.transmissionRenderTarget[P.id]),Nu.upload(F,je(ut),nr,$e)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(Nu.upload(F,je(ut),nr,$e),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&nn.setValue(F,"center",W.center),nn.setValue(F,"modelViewMatrix",W.modelViewMatrix),nn.setValue(F,"normalMatrix",W.normalMatrix),nn.setValue(F,"modelMatrix",W.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){const Un=ie.uniformsGroups;for(let Yn=0,Wl=Un.length;Yn<Wl;Yn++){const ls=Un[Yn];gt.update(ls,Xn),gt.bind(ls,Xn)}}return Xn}function qt(P,G){P.ambientLightColor.needsUpdate=G,P.lightProbe.needsUpdate=G,P.directionalLights.needsUpdate=G,P.directionalLightShadows.needsUpdate=G,P.pointLights.needsUpdate=G,P.pointLightShadows.needsUpdate=G,P.spotLights.needsUpdate=G,P.spotLightShadows.needsUpdate=G,P.rectAreaLights.needsUpdate=G,P.hemisphereLights.needsUpdate=G}function pt(P){return P.isMeshLambertMaterial||P.isMeshToonMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isShadowMaterial||P.isShaderMaterial&&P.lights===!0}this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return q},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(P,G,re){const ie=ge.get(P);ie.__autoAllocateDepthBuffer=P.resolveDepthBuffer===!1,ie.__autoAllocateDepthBuffer===!1&&(ie.__useRenderToTexture=!1),ge.get(P.texture).__webglTexture=G,ge.get(P.depthTexture).__webglTexture=ie.__autoAllocateDepthBuffer?void 0:re,ie.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(P,G){const re=ge.get(P);re.__webglFramebuffer=G,re.__useDefaultFramebuffer=G===void 0};const Xe=F.createFramebuffer();this.setRenderTarget=function(P,G=0,re=0){O=P,T=G,q=re;let ie=!0,W=null,Me=!1,ke=!1;if(P){const et=ge.get(P);if(et.__useDefaultFramebuffer!==void 0)De.bindFramebuffer(F.FRAMEBUFFER,null),ie=!1;else if(et.__webglFramebuffer===void 0)$e.setupRenderTarget(P);else if(et.__hasExternalTextures)$e.rebindTextures(P,ge.get(P.texture).__webglTexture,ge.get(P.depthTexture).__webglTexture);else if(P.depthBuffer){const rt=P.depthTexture;if(et.__boundDepthTexture!==rt){if(rt!==null&&ge.has(rt)&&(P.width!==rt.image.width||P.height!==rt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");$e.setupDepthRenderbuffer(P)}}const ct=P.texture;(ct.isData3DTexture||ct.isDataArrayTexture||ct.isCompressedArrayTexture)&&(ke=!0);const mt=ge.get(P).__webglFramebuffer;P.isWebGLCubeRenderTarget?(Array.isArray(mt[G])?W=mt[G][re]:W=mt[G],Me=!0):P.samples>0&&$e.useMultisampledRTT(P)===!1?W=ge.get(P).__webglMultisampledFramebuffer:Array.isArray(mt)?W=mt[re]:W=mt,N.copy(P.viewport),Z.copy(P.scissor),Y=P.scissorTest}else N.copy(oe).multiplyScalar(B).floor(),Z.copy(Ae).multiplyScalar(B).floor(),Y=Ie;if(re!==0&&(W=Xe),De.bindFramebuffer(F.FRAMEBUFFER,W)&&ie&&De.drawBuffers(P,W),De.viewport(N),De.scissor(Z),De.setScissorTest(Y),Me){const et=ge.get(P.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_CUBE_MAP_POSITIVE_X+G,et.__webglTexture,re)}else if(ke){const et=G;for(let ct=0;ct<P.textures.length;ct++){const mt=ge.get(P.textures[ct]);F.framebufferTextureLayer(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0+ct,mt.__webglTexture,re,et)}}else if(P!==null&&re!==0){const et=ge.get(P.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,et.__webglTexture,re)}A=-1},this.readRenderTargetPixels=function(P,G,re,ie,W,Me,ke,nt=0){if(!(P&&P.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let et=ge.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&ke!==void 0&&(et=et[ke]),et){De.bindFramebuffer(F.FRAMEBUFFER,et);try{const ct=P.textures[nt],mt=ct.format,rt=ct.type;if(!Ge.textureFormatReadable(mt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ge.textureTypeReadable(rt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}G>=0&&G<=P.width-ie&&re>=0&&re<=P.height-W&&(P.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+nt),F.readPixels(G,re,ie,W,tt.convert(mt),tt.convert(rt),Me))}finally{const ct=O!==null?ge.get(O).__webglFramebuffer:null;De.bindFramebuffer(F.FRAMEBUFFER,ct)}}},this.readRenderTargetPixelsAsync=async function(P,G,re,ie,W,Me,ke,nt=0){if(!(P&&P.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let et=ge.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&ke!==void 0&&(et=et[ke]),et)if(G>=0&&G<=P.width-ie&&re>=0&&re<=P.height-W){De.bindFramebuffer(F.FRAMEBUFFER,et);const ct=P.textures[nt],mt=ct.format,rt=ct.type;if(!Ge.textureFormatReadable(mt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ge.textureTypeReadable(rt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Tt=F.createBuffer();F.bindBuffer(F.PIXEL_PACK_BUFFER,Tt),F.bufferData(F.PIXEL_PACK_BUFFER,Me.byteLength,F.STREAM_READ),P.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+nt),F.readPixels(G,re,ie,W,tt.convert(mt),tt.convert(rt),0);const Ut=O!==null?ge.get(O).__webglFramebuffer:null;De.bindFramebuffer(F.FRAMEBUFFER,Ut);const an=F.fenceSync(F.SYNC_GPU_COMMANDS_COMPLETE,0);return F.flush(),await Vb(F,an,4),F.bindBuffer(F.PIXEL_PACK_BUFFER,Tt),F.getBufferSubData(F.PIXEL_PACK_BUFFER,0,Me),F.deleteBuffer(Tt),F.deleteSync(an),Me}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(P,G=null,re=0){const ie=Math.pow(2,-re),W=Math.floor(P.image.width*ie),Me=Math.floor(P.image.height*ie),ke=G!==null?G.x:0,nt=G!==null?G.y:0;$e.setTexture2D(P,0),F.copyTexSubImage2D(F.TEXTURE_2D,re,0,0,ke,nt,W,Me),De.unbindTexture()};const vn=F.createFramebuffer(),tn=F.createFramebuffer();this.copyTextureToTexture=function(P,G,re=null,ie=null,W=0,Me=null){Me===null&&(W!==0?(Qo("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Me=W,W=0):Me=0);let ke,nt,et,ct,mt,rt,Tt,Ut,an;const Bt=P.isCompressedTexture?P.mipmaps[Me]:P.image;if(re!==null)ke=re.max.x-re.min.x,nt=re.max.y-re.min.y,et=re.isBox3?re.max.z-re.min.z:1,ct=re.min.x,mt=re.min.y,rt=re.isBox3?re.min.z:0;else{const fr=Math.pow(2,-W);ke=Math.floor(Bt.width*fr),nt=Math.floor(Bt.height*fr),P.isDataArrayTexture?et=Bt.depth:P.isData3DTexture?et=Math.floor(Bt.depth*fr):et=1,ct=0,mt=0,rt=0}ie!==null?(Tt=ie.x,Ut=ie.y,an=ie.z):(Tt=0,Ut=0,an=0);const Vt=tt.convert(G.format),ut=tt.convert(G.type);let ln;G.isData3DTexture?($e.setTexture3D(G,0),ln=F.TEXTURE_3D):G.isDataArrayTexture||G.isCompressedArrayTexture?($e.setTexture2DArray(G,0),ln=F.TEXTURE_2D_ARRAY):($e.setTexture2D(G,0),ln=F.TEXTURE_2D),F.pixelStorei(F.UNPACK_FLIP_Y_WEBGL,G.flipY),F.pixelStorei(F.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),F.pixelStorei(F.UNPACK_ALIGNMENT,G.unpackAlignment);const Rt=F.getParameter(F.UNPACK_ROW_LENGTH),Xn=F.getParameter(F.UNPACK_IMAGE_HEIGHT),as=F.getParameter(F.UNPACK_SKIP_PIXELS),$n=F.getParameter(F.UNPACK_SKIP_ROWS),Ds=F.getParameter(F.UNPACK_SKIP_IMAGES);F.pixelStorei(F.UNPACK_ROW_LENGTH,Bt.width),F.pixelStorei(F.UNPACK_IMAGE_HEIGHT,Bt.height),F.pixelStorei(F.UNPACK_SKIP_PIXELS,ct),F.pixelStorei(F.UNPACK_SKIP_ROWS,mt),F.pixelStorei(F.UNPACK_SKIP_IMAGES,rt);const nn=P.isDataArrayTexture||P.isData3DTexture,nr=G.isDataArrayTexture||G.isData3DTexture;if(P.isDepthTexture){const fr=ge.get(P),Un=ge.get(G),Yn=ge.get(fr.__renderTarget),Wl=ge.get(Un.__renderTarget);De.bindFramebuffer(F.READ_FRAMEBUFFER,Yn.__webglFramebuffer),De.bindFramebuffer(F.DRAW_FRAMEBUFFER,Wl.__webglFramebuffer);for(let ls=0;ls<et;ls++)nn&&(F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,ge.get(P).__webglTexture,W,rt+ls),F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,ge.get(G).__webglTexture,Me,an+ls)),F.blitFramebuffer(ct,mt,ke,nt,Tt,Ut,ke,nt,F.DEPTH_BUFFER_BIT,F.NEAREST);De.bindFramebuffer(F.READ_FRAMEBUFFER,null),De.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else if(W!==0||P.isRenderTargetTexture||ge.has(P)){const fr=ge.get(P),Un=ge.get(G);De.bindFramebuffer(F.READ_FRAMEBUFFER,vn),De.bindFramebuffer(F.DRAW_FRAMEBUFFER,tn);for(let Yn=0;Yn<et;Yn++)nn?F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,fr.__webglTexture,W,rt+Yn):F.framebufferTexture2D(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,fr.__webglTexture,W),nr?F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,Un.__webglTexture,Me,an+Yn):F.framebufferTexture2D(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,Un.__webglTexture,Me),W!==0?F.blitFramebuffer(ct,mt,ke,nt,Tt,Ut,ke,nt,F.COLOR_BUFFER_BIT,F.NEAREST):nr?F.copyTexSubImage3D(ln,Me,Tt,Ut,an+Yn,ct,mt,ke,nt):F.copyTexSubImage2D(ln,Me,Tt,Ut,ct,mt,ke,nt);De.bindFramebuffer(F.READ_FRAMEBUFFER,null),De.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else nr?P.isDataTexture||P.isData3DTexture?F.texSubImage3D(ln,Me,Tt,Ut,an,ke,nt,et,Vt,ut,Bt.data):G.isCompressedArrayTexture?F.compressedTexSubImage3D(ln,Me,Tt,Ut,an,ke,nt,et,Vt,Bt.data):F.texSubImage3D(ln,Me,Tt,Ut,an,ke,nt,et,Vt,ut,Bt):P.isDataTexture?F.texSubImage2D(F.TEXTURE_2D,Me,Tt,Ut,ke,nt,Vt,ut,Bt.data):P.isCompressedTexture?F.compressedTexSubImage2D(F.TEXTURE_2D,Me,Tt,Ut,Bt.width,Bt.height,Vt,Bt.data):F.texSubImage2D(F.TEXTURE_2D,Me,Tt,Ut,ke,nt,Vt,ut,Bt);F.pixelStorei(F.UNPACK_ROW_LENGTH,Rt),F.pixelStorei(F.UNPACK_IMAGE_HEIGHT,Xn),F.pixelStorei(F.UNPACK_SKIP_PIXELS,as),F.pixelStorei(F.UNPACK_SKIP_ROWS,$n),F.pixelStorei(F.UNPACK_SKIP_IMAGES,Ds),Me===0&&G.generateMipmaps&&F.generateMipmap(ln),De.unbindTexture()},this.copyTextureToTexture3D=function(P,G,re=null,ie=null,W=0){return Qo('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(P,G,re,ie,W)},this.initRenderTarget=function(P){ge.get(P).__webglFramebuffer===void 0&&$e.setupRenderTarget(P)},this.initTexture=function(P){P.isCubeTexture?$e.setTextureCube(P,0):P.isData3DTexture?$e.setTexture3D(P,0):P.isDataArrayTexture||P.isCompressedArrayTexture?$e.setTexture2DArray(P,0):$e.setTexture2D(P,0),De.unbindTexture()},this.resetState=function(){T=0,q=0,O=null,De.reset(),Pe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ii}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Nt._getDrawingBufferColorSpace(e),t.unpackColorSpace=Nt._getUnpackColorSpace()}}class _6 extends ql{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new r4(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){const l=s.parse(JSON.parse(a));t&&t(l)},r,i)}parse(e){return new v6(e)}}class v6{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){const r=[],i=x6(e,t,this.data);for(let s=0,o=i.length;s<o;s++)r.push(...i[s].toShapes());return r}}function x6(n,e,t){const r=Array.from(n),i=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*i,o=[];let a=0,l=0;for(let c=0;c<r.length;c++){const h=r[c];if(h===`
3909
+ }`;class h6{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const r=new Ov(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,r=new vs({vertexShader:c6,fragmentShader:u6,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Tn(new Tu(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class f6 extends Gs{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,h=null,f=null,p=null,d=null,m=null;const x=new h6,v={},_=t.getContextAttributes();let b=null,M=null;const E=[],S=[],T=new Fe;let q=null;const O=new _r;O.viewport=new on;const A=new _r;A.viewport=new on;const L=[O,A],N=new c4;let Z=null,K=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let te=E[V];return te===void 0&&(te=new yp,E[V]=te),te.getTargetRaySpace()},this.getControllerGrip=function(V){let te=E[V];return te===void 0&&(te=new yp,E[V]=te),te.getGripSpace()},this.getHand=function(V){let te=E[V];return te===void 0&&(te=new yp,E[V]=te),te.getHandSpace()};function ne(V){const te=S.indexOf(V.inputSource);if(te===-1)return;const W=E[te];W!==void 0&&(W.update(V.inputSource,V.frame,c||o),W.dispatchEvent({type:V.type,data:V.inputSource}))}function ce(){i.removeEventListener("select",ne),i.removeEventListener("selectstart",ne),i.removeEventListener("selectend",ne),i.removeEventListener("squeeze",ne),i.removeEventListener("squeezestart",ne),i.removeEventListener("squeezeend",ne),i.removeEventListener("end",ce),i.removeEventListener("inputsourceschange",J);for(let V=0;V<E.length;V++){const te=S[V];te!==null&&(S[V]=null,E[V].disconnect(te))}Z=null,K=null,x.reset();for(const V in v)delete v[V];e.setRenderTarget(b),d=null,p=null,f=null,i=null,M=null,be.stop(),r.isPresenting=!1,e.setPixelRatio(q),e.setSize(T.width,T.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(V){s=V,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(V){a=V,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(V){c=V},this.getBaseLayer=function(){return p!==null?p:d},this.getBinding=function(){return f},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(V){if(i=V,i!==null){if(b=e.getRenderTarget(),i.addEventListener("select",ne),i.addEventListener("selectstart",ne),i.addEventListener("selectend",ne),i.addEventListener("squeeze",ne),i.addEventListener("squeezestart",ne),i.addEventListener("squeezeend",ne),i.addEventListener("end",ce),i.addEventListener("inputsourceschange",J),_.xrCompatible!==!0&&await t.makeXRCompatible(),q=e.getPixelRatio(),e.getSize(T),typeof XRWebGLBinding<"u"&&(f=new XRWebGLBinding(i,t)),f!==null&&"createProjectionLayer"in XRWebGLBinding.prototype){let W=null,ue=null,ye=null;_.depth&&(ye=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,W=_.stencil?cl:ll,ue=_.stencil?al:Hs);const Q={colorFormat:t.RGBA8,depthFormat:ye,scaleFactor:s};p=f.createProjectionLayer(Q),i.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),M=new Ws(p.textureWidth,p.textureHeight,{format:$r,type:Ei,depthTexture:new q_(p.textureWidth,p.textureHeight,ue,void 0,void 0,void 0,void 0,void 0,void 0,W),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{const W={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(i,t,W),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),M=new Ws(d.framebufferWidth,d.framebufferHeight,{format:$r,type:Ei,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await i.requestReferenceSpace(a),be.setContext(i),be.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function J(V){for(let te=0;te<V.removed.length;te++){const W=V.removed[te],ue=S.indexOf(W);ue>=0&&(S[ue]=null,E[ue].disconnect(W))}for(let te=0;te<V.added.length;te++){const W=V.added[te];let ue=S.indexOf(W);if(ue===-1){for(let Q=0;Q<E.length;Q++)if(Q>=S.length){S.push(W),ue=Q;break}else if(S[Q]===null){S[Q]=W,ue=Q;break}if(ue===-1)break}const ye=E[ue];ye&&ye.connect(W)}}const oe=new G,B=new G;function xe(V,te,W){oe.setFromMatrixPosition(te.matrixWorld),B.setFromMatrixPosition(W.matrixWorld);const ue=oe.distanceTo(B),ye=te.projectionMatrix.elements,Q=W.projectionMatrix.elements,Le=ye[14]/(ye[10]-1),le=ye[14]/(ye[10]+1),z=(ye[9]+1)/ye[5],it=(ye[9]-1)/ye[5],Ie=(ye[8]-1)/ye[0],$e=(Q[8]+1)/Q[0],qe=Le*Ie,De=Le*$e,ve=ue/(-Ie+$e),Ge=ve*-Ie;if(te.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(Ge),V.translateZ(ve),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert(),ye[10]===-1)V.projectionMatrix.copy(te.projectionMatrix),V.projectionMatrixInverse.copy(te.projectionMatrixInverse);else{const rt=Le+ve,wt=le+ve,F=qe-Ge,I=De+(ue-Ge),ee=z*le/wt*rt,de=it*le/wt*rt;V.projectionMatrix.makePerspective(F,I,ee,de,rt,wt),V.projectionMatrixInverse.copy(V.projectionMatrix).invert()}}function U(V,te){te===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(te.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(i===null)return;let te=V.near,W=V.far;x.texture!==null&&(x.depthNear>0&&(te=x.depthNear),x.depthFar>0&&(W=x.depthFar)),N.near=A.near=O.near=te,N.far=A.far=O.far=W,(Z!==N.near||K!==N.far)&&(i.updateRenderState({depthNear:N.near,depthFar:N.far}),Z=N.near,K=N.far),N.layers.mask=V.layers.mask|6,O.layers.mask=N.layers.mask&3,A.layers.mask=N.layers.mask&5;const ue=V.parent,ye=N.cameras;U(N,ue);for(let Q=0;Q<ye.length;Q++)U(ye[Q],ue);ye.length===2?xe(N,O,A):N.projectionMatrix.copy(O.projectionMatrix),$(V,N,ue)};function $(V,te,W){W===null?V.matrix.copy(te.matrixWorld):(V.matrix.copy(W.matrixWorld),V.matrix.invert(),V.matrix.multiply(te.matrixWorld)),V.matrix.decompose(V.position,V.quaternion,V.scale),V.updateMatrixWorld(!0),V.projectionMatrix.copy(te.projectionMatrix),V.projectionMatrixInverse.copy(te.projectionMatrixInverse),V.isPerspectiveCamera&&(V.fov=Kc*2*Math.atan(1/V.projectionMatrix.elements[5]),V.zoom=1)}this.getCamera=function(){return N},this.getFoveation=function(){if(!(p===null&&d===null))return l},this.setFoveation=function(V){l=V,p!==null&&(p.fixedFoveation=V),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=V)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(N)},this.getCameraTexture=function(V){return v[V]};let pe=null;function Se(V,te){if(h=te.getViewerPose(c||o),m=te,h!==null){const W=h.views;d!==null&&(e.setRenderTargetFramebuffer(M,d.framebuffer),e.setRenderTarget(M));let ue=!1;W.length!==N.cameras.length&&(N.cameras.length=0,ue=!0);for(let le=0;le<W.length;le++){const z=W[le];let it=null;if(d!==null)it=d.getViewport(z);else{const $e=f.getViewSubImage(p,z);it=$e.viewport,le===0&&(e.setRenderTargetTextures(M,$e.colorTexture,$e.depthStencilTexture),e.setRenderTarget(M))}let Ie=L[le];Ie===void 0&&(Ie=new _r,Ie.layers.enable(le),Ie.viewport=new on,L[le]=Ie),Ie.matrix.fromArray(z.transform.matrix),Ie.matrix.decompose(Ie.position,Ie.quaternion,Ie.scale),Ie.projectionMatrix.fromArray(z.projectionMatrix),Ie.projectionMatrixInverse.copy(Ie.projectionMatrix).invert(),Ie.viewport.set(it.x,it.y,it.width,it.height),le===0&&(N.matrix.copy(Ie.matrix),N.matrix.decompose(N.position,N.quaternion,N.scale)),ue===!0&&N.cameras.push(Ie)}const ye=i.enabledFeatures;if(ye&&ye.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&f){const le=f.getDepthInformation(W[0]);le&&le.isValid&&le.texture&&x.init(le,i.renderState)}if(ye&&ye.includes("camera-access")&&(e.state.unbindTexture(),f))for(let le=0;le<W.length;le++){const z=W[le].camera;if(z){let it=v[z];it||(it=new Ov,v[z]=it);const Ie=f.getCameraImage(z);it.sourceTexture=Ie}}}for(let W=0;W<E.length;W++){const ue=S[W],ye=E[W];ue!==null&&ye!==void 0&&ye.update(ue,te,c||o)}pe&&pe(V,te),te.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:te}),m=null}const be=new iv;be.setAnimationLoop(Se),this.setAnimationLoop=function(V){pe=V},this.dispose=function(){}}}const ro=new Zr,d6=new Ht;function p6(n,e){function t(v,_){v.matrixAutoUpdate===!0&&v.updateMatrix(),_.value.copy(v.matrix)}function r(v,_){_.color.getRGB(v.fogColor.value,M_(n)),_.isFog?(v.fogNear.value=_.near,v.fogFar.value=_.far):_.isFogExp2&&(v.fogDensity.value=_.density)}function i(v,_,b,M,E){_.isMeshBasicMaterial||_.isMeshLambertMaterial?s(v,_):_.isMeshToonMaterial?(s(v,_),f(v,_)):_.isMeshPhongMaterial?(s(v,_),h(v,_)):_.isMeshStandardMaterial?(s(v,_),p(v,_),_.isMeshPhysicalMaterial&&d(v,_,E)):_.isMeshMatcapMaterial?(s(v,_),m(v,_)):_.isMeshDepthMaterial?s(v,_):_.isMeshDistanceMaterial?(s(v,_),x(v,_)):_.isMeshNormalMaterial?s(v,_):_.isLineBasicMaterial?(o(v,_),_.isLineDashedMaterial&&a(v,_)):_.isPointsMaterial?l(v,_,b,M):_.isSpriteMaterial?c(v,_):_.isShadowMaterial?(v.color.value.copy(_.color),v.opacity.value=_.opacity):_.isShaderMaterial&&(_.uniformsNeedUpdate=!1)}function s(v,_){v.opacity.value=_.opacity,_.color&&v.diffuse.value.copy(_.color),_.emissive&&v.emissive.value.copy(_.emissive).multiplyScalar(_.emissiveIntensity),_.map&&(v.map.value=_.map,t(_.map,v.mapTransform)),_.alphaMap&&(v.alphaMap.value=_.alphaMap,t(_.alphaMap,v.alphaMapTransform)),_.bumpMap&&(v.bumpMap.value=_.bumpMap,t(_.bumpMap,v.bumpMapTransform),v.bumpScale.value=_.bumpScale,_.side===Qn&&(v.bumpScale.value*=-1)),_.normalMap&&(v.normalMap.value=_.normalMap,t(_.normalMap,v.normalMapTransform),v.normalScale.value.copy(_.normalScale),_.side===Qn&&v.normalScale.value.negate()),_.displacementMap&&(v.displacementMap.value=_.displacementMap,t(_.displacementMap,v.displacementMapTransform),v.displacementScale.value=_.displacementScale,v.displacementBias.value=_.displacementBias),_.emissiveMap&&(v.emissiveMap.value=_.emissiveMap,t(_.emissiveMap,v.emissiveMapTransform)),_.specularMap&&(v.specularMap.value=_.specularMap,t(_.specularMap,v.specularMapTransform)),_.alphaTest>0&&(v.alphaTest.value=_.alphaTest);const b=e.get(_),M=b.envMap,E=b.envMapRotation;M&&(v.envMap.value=M,ro.copy(E),ro.x*=-1,ro.y*=-1,ro.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(ro.y*=-1,ro.z*=-1),v.envMapRotation.value.setFromMatrix4(d6.makeRotationFromEuler(ro)),v.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,v.reflectivity.value=_.reflectivity,v.ior.value=_.ior,v.refractionRatio.value=_.refractionRatio),_.lightMap&&(v.lightMap.value=_.lightMap,v.lightMapIntensity.value=_.lightMapIntensity,t(_.lightMap,v.lightMapTransform)),_.aoMap&&(v.aoMap.value=_.aoMap,v.aoMapIntensity.value=_.aoMapIntensity,t(_.aoMap,v.aoMapTransform))}function o(v,_){v.diffuse.value.copy(_.color),v.opacity.value=_.opacity,_.map&&(v.map.value=_.map,t(_.map,v.mapTransform))}function a(v,_){v.dashSize.value=_.dashSize,v.totalSize.value=_.dashSize+_.gapSize,v.scale.value=_.scale}function l(v,_,b,M){v.diffuse.value.copy(_.color),v.opacity.value=_.opacity,v.size.value=_.size*b,v.scale.value=M*.5,_.map&&(v.map.value=_.map,t(_.map,v.uvTransform)),_.alphaMap&&(v.alphaMap.value=_.alphaMap,t(_.alphaMap,v.alphaMapTransform)),_.alphaTest>0&&(v.alphaTest.value=_.alphaTest)}function c(v,_){v.diffuse.value.copy(_.color),v.opacity.value=_.opacity,v.rotation.value=_.rotation,_.map&&(v.map.value=_.map,t(_.map,v.mapTransform)),_.alphaMap&&(v.alphaMap.value=_.alphaMap,t(_.alphaMap,v.alphaMapTransform)),_.alphaTest>0&&(v.alphaTest.value=_.alphaTest)}function h(v,_){v.specular.value.copy(_.specular),v.shininess.value=Math.max(_.shininess,1e-4)}function f(v,_){_.gradientMap&&(v.gradientMap.value=_.gradientMap)}function p(v,_){v.metalness.value=_.metalness,_.metalnessMap&&(v.metalnessMap.value=_.metalnessMap,t(_.metalnessMap,v.metalnessMapTransform)),v.roughness.value=_.roughness,_.roughnessMap&&(v.roughnessMap.value=_.roughnessMap,t(_.roughnessMap,v.roughnessMapTransform)),_.envMap&&(v.envMapIntensity.value=_.envMapIntensity)}function d(v,_,b){v.ior.value=_.ior,_.sheen>0&&(v.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),v.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(v.sheenColorMap.value=_.sheenColorMap,t(_.sheenColorMap,v.sheenColorMapTransform)),_.sheenRoughnessMap&&(v.sheenRoughnessMap.value=_.sheenRoughnessMap,t(_.sheenRoughnessMap,v.sheenRoughnessMapTransform))),_.clearcoat>0&&(v.clearcoat.value=_.clearcoat,v.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(v.clearcoatMap.value=_.clearcoatMap,t(_.clearcoatMap,v.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(v.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,t(_.clearcoatRoughnessMap,v.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(v.clearcoatNormalMap.value=_.clearcoatNormalMap,t(_.clearcoatNormalMap,v.clearcoatNormalMapTransform),v.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===Qn&&v.clearcoatNormalScale.value.negate())),_.dispersion>0&&(v.dispersion.value=_.dispersion),_.iridescence>0&&(v.iridescence.value=_.iridescence,v.iridescenceIOR.value=_.iridescenceIOR,v.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],v.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(v.iridescenceMap.value=_.iridescenceMap,t(_.iridescenceMap,v.iridescenceMapTransform)),_.iridescenceThicknessMap&&(v.iridescenceThicknessMap.value=_.iridescenceThicknessMap,t(_.iridescenceThicknessMap,v.iridescenceThicknessMapTransform))),_.transmission>0&&(v.transmission.value=_.transmission,v.transmissionSamplerMap.value=b.texture,v.transmissionSamplerSize.value.set(b.width,b.height),_.transmissionMap&&(v.transmissionMap.value=_.transmissionMap,t(_.transmissionMap,v.transmissionMapTransform)),v.thickness.value=_.thickness,_.thicknessMap&&(v.thicknessMap.value=_.thicknessMap,t(_.thicknessMap,v.thicknessMapTransform)),v.attenuationDistance.value=_.attenuationDistance,v.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(v.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(v.anisotropyMap.value=_.anisotropyMap,t(_.anisotropyMap,v.anisotropyMapTransform))),v.specularIntensity.value=_.specularIntensity,v.specularColor.value.copy(_.specularColor),_.specularColorMap&&(v.specularColorMap.value=_.specularColorMap,t(_.specularColorMap,v.specularColorMapTransform)),_.specularIntensityMap&&(v.specularIntensityMap.value=_.specularIntensityMap,t(_.specularIntensityMap,v.specularIntensityMapTransform))}function m(v,_){_.matcap&&(v.matcap.value=_.matcap)}function x(v,_){const b=e.get(_).light;v.referencePosition.value.setFromMatrixPosition(b.matrixWorld),v.nearDistance.value=b.shadow.camera.near,v.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function m6(n,e,t,r){let i={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,M){const E=M.program;r.uniformBlockBinding(b,E)}function c(b,M){let E=i[b.id];E===void 0&&(m(b),E=h(b),i[b.id]=E,b.addEventListener("dispose",v));const S=M.program;r.updateUBOMapping(b,S);const T=e.render.frame;s[b.id]!==T&&(p(b),s[b.id]=T)}function h(b){const M=f();b.__bindingPointIndex=M;const E=n.createBuffer(),S=b.__size,T=b.usage;return n.bindBuffer(n.UNIFORM_BUFFER,E),n.bufferData(n.UNIFORM_BUFFER,S,T),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,M,E),E}function f(){for(let b=0;b<a;b++)if(o.indexOf(b)===-1)return o.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(b){const M=i[b.id],E=b.uniforms,S=b.__cache;n.bindBuffer(n.UNIFORM_BUFFER,M);for(let T=0,q=E.length;T<q;T++){const O=Array.isArray(E[T])?E[T]:[E[T]];for(let A=0,L=O.length;A<L;A++){const N=O[A];if(d(N,T,A,S)===!0){const Z=N.__offset,K=Array.isArray(N.value)?N.value:[N.value];let ne=0;for(let ce=0;ce<K.length;ce++){const J=K[ce],oe=x(J);typeof J=="number"||typeof J=="boolean"?(N.__data[0]=J,n.bufferSubData(n.UNIFORM_BUFFER,Z+ne,N.__data)):J.isMatrix3?(N.__data[0]=J.elements[0],N.__data[1]=J.elements[1],N.__data[2]=J.elements[2],N.__data[3]=0,N.__data[4]=J.elements[3],N.__data[5]=J.elements[4],N.__data[6]=J.elements[5],N.__data[7]=0,N.__data[8]=J.elements[6],N.__data[9]=J.elements[7],N.__data[10]=J.elements[8],N.__data[11]=0):(J.toArray(N.__data,ne),ne+=oe.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,Z,N.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function d(b,M,E,S){const T=b.value,q=M+"_"+E;if(S[q]===void 0)return typeof T=="number"||typeof T=="boolean"?S[q]=T:S[q]=T.clone(),!0;{const O=S[q];if(typeof T=="number"||typeof T=="boolean"){if(O!==T)return S[q]=T,!0}else if(O.equals(T)===!1)return O.copy(T),!0}return!1}function m(b){const M=b.uniforms;let E=0;const S=16;for(let q=0,O=M.length;q<O;q++){const A=Array.isArray(M[q])?M[q]:[M[q]];for(let L=0,N=A.length;L<N;L++){const Z=A[L],K=Array.isArray(Z.value)?Z.value:[Z.value];for(let ne=0,ce=K.length;ne<ce;ne++){const J=K[ne],oe=x(J),B=E%S,xe=B%oe.boundary,U=B+xe;E+=xe,U!==0&&S-U<oe.storage&&(E+=S-U),Z.__data=new Float32Array(oe.storage/Float32Array.BYTES_PER_ELEMENT),Z.__offset=E,E+=oe.storage}}}const T=E%S;return T>0&&(E+=S-T),b.__size=E,b.__cache={},this}function x(b){const M={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(M.boundary=4,M.storage=4):b.isVector2?(M.boundary=8,M.storage=8):b.isVector3||b.isColor?(M.boundary=16,M.storage=12):b.isVector4?(M.boundary=16,M.storage=16):b.isMatrix3?(M.boundary=48,M.storage=48):b.isMatrix4?(M.boundary=64,M.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),M}function v(b){const M=b.target;M.removeEventListener("dispose",v);const E=o.indexOf(M.__bindingPointIndex);o.splice(E,1),n.deleteBuffer(i[M.id]),delete i[M.id],delete s[M.id]}function _(){for(const b in i)n.deleteBuffer(i[b]);o=[],i={},s={}}return{bind:l,update:c,dispose:_}}class g6{constructor(e={}){const{canvas:t=Bb(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:p=!1}=e;this.isWebGLRenderer=!0;let d;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=r.getContextAttributes().alpha}else d=o;const m=new Uint32Array(4),x=new Int32Array(4);let v=null,_=null;const b=[],M=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=us,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const E=this;let S=!1;this._outputColorSpace=pr;let T=0,q=0,O=null,A=-1,L=null;const N=new on,Z=new on;let K=null;const ne=new St(0);let ce=0,J=t.width,oe=t.height,B=1,xe=null,U=null;const $=new on(0,0,J,oe),pe=new on(0,0,J,oe);let Se=!1;const be=new Ep;let V=!1,te=!1;const W=new Ht,ue=new G,ye=new on,Q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Le=!1;function le(){return O===null?B:1}let z=r;function it(P,X){return t.getContext(P,X)}try{const P={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${rd}`),t.addEventListener("webglcontextlost",Oe,!1),t.addEventListener("webglcontextrestored",Be,!1),t.addEventListener("webglcontextcreationerror",Te,!1),z===null){const X="webgl2";if(z=it(X,P),z===null)throw it(X)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(P){throw console.error("THREE.WebGLRenderer: "+P.message),P}let Ie,$e,qe,De,ve,Ge,rt,wt,F,I,ee,de,Me,fe,Ue,Ae,We,je,Ce,Ne,Ve,Ke,Re,ht;function H(){Ie=new T5(z),Ie.init(),Ke=new l6(z,Ie),$e=new x5(z,Ie,e,Ke),qe=new o6(z,Ie),$e.reversedDepthBuffer&&p&&qe.buffers.depth.setReversed(!0),De=new R5(z),ve=new XT,Ge=new a6(z,Ie,qe,ve,$e,Ke,De),rt=new S5(E),wt=new w5(E),F=new m4(z),Re=new _5(z,F),I=new A5(z,F,De,Re),ee=new I5(z,I,F,De),Ce=new P5(z,$e,Ge),Ae=new y5(ve),de=new jT(E,rt,wt,Ie,$e,Re,Ae),Me=new p6(E,ve),fe=new YT,Ue=new t6(Ie),je=new g5(E,rt,wt,qe,ee,d,l),We=new i6(E,ee,$e),ht=new m6(z,De,$e,qe),Ne=new v5(z,Ie,De),Ve=new C5(z,Ie,De),De.programs=de.programs,E.capabilities=$e,E.extensions=Ie,E.properties=ve,E.renderLists=fe,E.shadowMap=We,E.state=qe,E.info=De}H();const Ee=new f6(E,z);this.xr=Ee,this.getContext=function(){return z},this.getContextAttributes=function(){return z.getContextAttributes()},this.forceContextLoss=function(){const P=Ie.get("WEBGL_lose_context");P&&P.loseContext()},this.forceContextRestore=function(){const P=Ie.get("WEBGL_lose_context");P&&P.restoreContext()},this.getPixelRatio=function(){return B},this.setPixelRatio=function(P){P!==void 0&&(B=P,this.setSize(J,oe,!1))},this.getSize=function(P){return P.set(J,oe)},this.setSize=function(P,X,re=!0){if(Ee.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}J=P,oe=X,t.width=Math.floor(P*B),t.height=Math.floor(X*B),re===!0&&(t.style.width=P+"px",t.style.height=X+"px"),this.setViewport(0,0,P,X)},this.getDrawingBufferSize=function(P){return P.set(J*B,oe*B).floor()},this.setDrawingBufferSize=function(P,X,re){J=P,oe=X,B=re,t.width=Math.floor(P*re),t.height=Math.floor(X*re),this.setViewport(0,0,P,X)},this.getCurrentViewport=function(P){return P.copy(N)},this.getViewport=function(P){return P.copy($)},this.setViewport=function(P,X,re,ie){P.isVector4?$.set(P.x,P.y,P.z,P.w):$.set(P,X,re,ie),qe.viewport(N.copy($).multiplyScalar(B).round())},this.getScissor=function(P){return P.copy(pe)},this.setScissor=function(P,X,re,ie){P.isVector4?pe.set(P.x,P.y,P.z,P.w):pe.set(P,X,re,ie),qe.scissor(Z.copy(pe).multiplyScalar(B).round())},this.getScissorTest=function(){return Se},this.setScissorTest=function(P){qe.setScissorTest(Se=P)},this.setOpaqueSort=function(P){xe=P},this.setTransparentSort=function(P){U=P},this.getClearColor=function(P){return P.copy(je.getClearColor())},this.setClearColor=function(){je.setClearColor(...arguments)},this.getClearAlpha=function(){return je.getClearAlpha()},this.setClearAlpha=function(){je.setClearAlpha(...arguments)},this.clear=function(P=!0,X=!0,re=!0){let ie=0;if(P){let Y=!1;if(O!==null){const we=O.texture.format;Y=we===bd||we===Ed||we===Sd}if(Y){const we=O.texture.type,ze=we===Ei||we===Hs||we===sl||we===al||we===xd||we===yd,Je=je.getClearColor(),Ye=je.getClearAlpha(),st=Je.r,lt=Je.g,Qe=Je.b;ze?(m[0]=st,m[1]=lt,m[2]=Qe,m[3]=Ye,z.clearBufferuiv(z.COLOR,0,m)):(x[0]=st,x[1]=lt,x[2]=Qe,x[3]=Ye,z.clearBufferiv(z.COLOR,0,x))}else ie|=z.COLOR_BUFFER_BIT}X&&(ie|=z.DEPTH_BUFFER_BIT),re&&(ie|=z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),z.clear(ie)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Oe,!1),t.removeEventListener("webglcontextrestored",Be,!1),t.removeEventListener("webglcontextcreationerror",Te,!1),je.dispose(),fe.dispose(),Ue.dispose(),ve.dispose(),rt.dispose(),wt.dispose(),ee.dispose(),Re.dispose(),ht.dispose(),de.dispose(),Ee.dispose(),Ee.removeEventListener("sessionstart",rr),Ee.removeEventListener("sessionend",$u),Ai.stop()};function Oe(P){P.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),S=!0}function Be(){console.log("THREE.WebGLRenderer: Context Restored."),S=!1;const P=De.autoReset,X=We.enabled,re=We.autoUpdate,ie=We.needsUpdate,Y=We.type;H(),De.autoReset=P,We.enabled=X,We.autoUpdate=re,We.needsUpdate=ie,We.type=Y}function Te(P){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",P.statusMessage)}function me(P){const X=P.target;X.removeEventListener("dispose",me),Ze(X)}function Ze(P){ct(P),ve.remove(P)}function ct(P){const X=ve.get(P).programs;X!==void 0&&(X.forEach(function(re){de.releaseProgram(re)}),P.isShaderMaterial&&de.releaseShaderCache(P))}this.renderBufferDirect=function(P,X,re,ie,Y,we){X===null&&(X=Q);const ze=Y.isMesh&&Y.matrixWorld.determinant()<0,Je=Ul(P,X,re,ie,Y);qe.setMaterial(ie,ze);let Ye=re.index,st=1;if(ie.wireframe===!0){if(Ye=I.getWireframeAttribute(re),Ye===void 0)return;st=2}const lt=re.drawRange,Qe=re.attributes.position;let xt=lt.start*st,Rt=(lt.start+lt.count)*st;we!==null&&(xt=Math.max(xt,we.start*st),Rt=Math.min(Rt,(we.start+we.count)*st)),Ye!==null?(xt=Math.max(xt,0),Rt=Math.min(Rt,Ye.count)):Qe!=null&&(xt=Math.max(xt,0),Rt=Math.min(Rt,Qe.count));const Jt=Rt-xt;if(Jt<0||Jt===1/0)return;Re.setup(Y,ie,Je,re,Ye);let qt,Dt=Ne;if(Ye!==null&&(qt=F.get(Ye),Dt=Ve,Dt.setIndex(qt)),Y.isMesh)ie.wireframe===!0?(qe.setLineWidth(ie.wireframeLinewidth*le()),Dt.setMode(z.LINES)):Dt.setMode(z.TRIANGLES);else if(Y.isLine){let ot=ie.linewidth;ot===void 0&&(ot=1),qe.setLineWidth(ot*le()),Y.isLineSegments?Dt.setMode(z.LINES):Y.isLineLoop?Dt.setMode(z.LINE_LOOP):Dt.setMode(z.LINE_STRIP)}else Y.isPoints?Dt.setMode(z.POINTS):Y.isSprite&&Dt.setMode(z.TRIANGLES);if(Y.isBatchedMesh)if(Y._multiDrawInstances!==null)Ho("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Dt.renderMultiDrawInstances(Y._multiDrawStarts,Y._multiDrawCounts,Y._multiDrawCount,Y._multiDrawInstances);else if(Ie.get("WEBGL_multi_draw"))Dt.renderMultiDraw(Y._multiDrawStarts,Y._multiDrawCounts,Y._multiDrawCount);else{const ot=Y._multiDrawStarts,Qt=Y._multiDrawCounts,Et=Y._multiDrawCount,Un=Ye?F.get(Ye).bytesPerElement:1,Qi=ve.get(ie).currentProgram.getUniforms();for(let Fn=0;Fn<Et;Fn++)Qi.setValue(z,"_gl_DrawID",Fn),Dt.render(ot[Fn]/Un,Qt[Fn])}else if(Y.isInstancedMesh)Dt.renderInstances(xt,Jt,Y.count);else if(re.isInstancedBufferGeometry){const ot=re._maxInstanceCount!==void 0?re._maxInstanceCount:1/0,Qt=Math.min(re.instanceCount,ot);Dt.renderInstances(xt,Jt,Qt)}else Dt.render(xt,Jt)};function Lt(P,X,re){P.transparent===!0&&P.side===yi&&P.forceSinglePass===!1?(P.side=Qn,P.needsUpdate=!0,Or(P,X,re),P.side=ls,P.needsUpdate=!0,Or(P,X,re),P.side=yi):Or(P,X,re)}this.compile=function(P,X,re=null){re===null&&(re=P),_=Ue.get(re),_.init(X),M.push(_),re.traverseVisible(function(Y){Y.isLight&&Y.layers.test(X.layers)&&(_.pushLight(Y),Y.castShadow&&_.pushShadow(Y))}),P!==re&&P.traverseVisible(function(Y){Y.isLight&&Y.layers.test(X.layers)&&(_.pushLight(Y),Y.castShadow&&_.pushShadow(Y))}),_.setupLights();const ie=new Set;return P.traverse(function(Y){if(!(Y.isMesh||Y.isPoints||Y.isLine||Y.isSprite))return;const we=Y.material;if(we)if(Array.isArray(we))for(let ze=0;ze<we.length;ze++){const Je=we[ze];Lt(Je,re,Y),ie.add(Je)}else Lt(we,re,Y),ie.add(we)}),_=M.pop(),ie},this.compileAsync=function(P,X,re=null){const ie=this.compile(P,X,re);return new Promise(Y=>{function we(){if(ie.forEach(function(ze){ve.get(ze).currentProgram.isReady()&&ie.delete(ze)}),ie.size===0){Y(P);return}setTimeout(we,10)}Ie.get("KHR_parallel_shader_compile")!==null?we():setTimeout(we,10)})};let ft=null;function si(P){ft&&ft(P)}function rr(){Ai.stop()}function $u(){Ai.start()}const Ai=new iv;Ai.setAnimationLoop(si),typeof self<"u"&&Ai.setContext(self),this.setAnimationLoop=function(P){ft=P,Ee.setAnimationLoop(P),P===null?Ai.stop():Ai.start()},Ee.addEventListener("sessionstart",rr),Ee.addEventListener("sessionend",$u),this.render=function(P,X){if(X!==void 0&&X.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(S===!0)return;if(P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),X.parent===null&&X.matrixWorldAutoUpdate===!0&&X.updateMatrixWorld(),Ee.enabled===!0&&Ee.isPresenting===!0&&(Ee.cameraAutoUpdate===!0&&Ee.updateCamera(X),X=Ee.getCamera()),P.isScene===!0&&P.onBeforeRender(E,P,X,O),_=Ue.get(P,M.length),_.init(X),M.push(_),W.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),be.setFromProjectionMatrix(W,bi,X.reversedDepth),te=this.localClippingEnabled,V=Ae.init(this.clippingPlanes,te),v=fe.get(P,b.length),v.init(),b.push(v),Ee.enabled===!0&&Ee.isPresenting===!0){const we=E.xr.getDepthSensingMesh();we!==null&&Sa(we,X,-1/0,E.sortObjects)}Sa(P,X,0,E.sortObjects),v.finish(),E.sortObjects===!0&&v.sort(xe,U),Le=Ee.enabled===!1||Ee.isPresenting===!1||Ee.hasDepthSensing()===!1,Le&&je.addToRenderList(v,P),this.info.render.frame++,V===!0&&Ae.beginShadows();const re=_.state.shadowsArray;We.render(re,P,X),V===!0&&Ae.endShadows(),this.info.autoReset===!0&&this.info.reset();const ie=v.opaque,Y=v.transmissive;if(_.setupLights(),X.isArrayCamera){const we=X.cameras;if(Y.length>0)for(let ze=0,Je=we.length;ze<Je;ze++){const Ye=we[ze];Ea(ie,Y,P,Ye)}Le&&je.render(P);for(let ze=0,Je=we.length;ze<Je;ze++){const Ye=we[ze];Yu(v,P,Ye,Ye.viewport)}}else Y.length>0&&Ea(ie,Y,P,X),Le&&je.render(P),Yu(v,P,X);O!==null&&q===0&&(Ge.updateMultisampleRenderTarget(O),Ge.updateRenderTargetMipmap(O)),P.isScene===!0&&P.onAfterRender(E,P,X),Re.resetDefaultState(),A=-1,L=null,M.pop(),M.length>0?(_=M[M.length-1],V===!0&&Ae.setGlobalState(E.clippingPlanes,_.state.camera)):_=null,b.pop(),b.length>0?v=b[b.length-1]:v=null};function Sa(P,X,re,ie){if(P.visible===!1)return;if(P.layers.test(X.layers)){if(P.isGroup)re=P.renderOrder;else if(P.isLOD)P.autoUpdate===!0&&P.update(X);else if(P.isLight)_.pushLight(P),P.castShadow&&_.pushShadow(P);else if(P.isSprite){if(!P.frustumCulled||be.intersectsSprite(P)){ie&&ye.setFromMatrixPosition(P.matrixWorld).applyMatrix4(W);const ze=ee.update(P),Je=P.material;Je.visible&&v.push(P,ze,Je,re,ye.z,null)}}else if((P.isMesh||P.isLine||P.isPoints)&&(!P.frustumCulled||be.intersectsObject(P))){const ze=ee.update(P),Je=P.material;if(ie&&(P.boundingSphere!==void 0?(P.boundingSphere===null&&P.computeBoundingSphere(),ye.copy(P.boundingSphere.center)):(ze.boundingSphere===null&&ze.computeBoundingSphere(),ye.copy(ze.boundingSphere.center)),ye.applyMatrix4(P.matrixWorld).applyMatrix4(W)),Array.isArray(Je)){const Ye=ze.groups;for(let st=0,lt=Ye.length;st<lt;st++){const Qe=Ye[st],xt=Je[Qe.materialIndex];xt&&xt.visible&&v.push(P,ze,xt,re,ye.z,Qe)}}else Je.visible&&v.push(P,ze,Je,re,ye.z,null)}}const we=P.children;for(let ze=0,Je=we.length;ze<Je;ze++)Sa(we[ze],X,re,ie)}function Yu(P,X,re,ie){const Y=P.opaque,we=P.transmissive,ze=P.transparent;_.setupLightsView(re),V===!0&&Ae.setGlobalState(E.clippingPlanes,re),ie&&qe.viewport(N.copy(ie)),Y.length>0&&ws(Y,X,re),we.length>0&&ws(we,X,re),ze.length>0&&ws(ze,X,re),qe.buffers.depth.setTest(!0),qe.buffers.depth.setMask(!0),qe.buffers.color.setMask(!0),qe.setPolygonOffset(!1)}function Ea(P,X,re,ie){if((re.isScene===!0?re.overrideMaterial:null)!==null)return;_.state.transmissionRenderTarget[ie.id]===void 0&&(_.state.transmissionRenderTarget[ie.id]=new Ws(1,1,{generateMipmaps:!0,type:Ie.has("EXT_color_buffer_half_float")||Ie.has("EXT_color_buffer_float")?ol:Ei,minFilter:Vs,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ct.workingColorSpace}));const we=_.state.transmissionRenderTarget[ie.id],ze=ie.viewport||N;we.setSize(ze.z*E.transmissionResolutionScale,ze.w*E.transmissionResolutionScale);const Je=E.getRenderTarget(),Ye=E.getActiveCubeFace(),st=E.getActiveMipmapLevel();E.setRenderTarget(we),E.getClearColor(ne),ce=E.getClearAlpha(),ce<1&&E.setClearColor(16777215,.5),E.clear(),Le&&je.render(re);const lt=E.toneMapping;E.toneMapping=us;const Qe=ie.viewport;if(ie.viewport!==void 0&&(ie.viewport=void 0),_.setupLightsView(ie),V===!0&&Ae.setGlobalState(E.clippingPlanes,ie),ws(P,re,ie),Ge.updateMultisampleRenderTarget(we),Ge.updateRenderTargetMipmap(we),Ie.has("WEBGL_multisampled_render_to_texture")===!1){let xt=!1;for(let Rt=0,Jt=X.length;Rt<Jt;Rt++){const qt=X[Rt],Dt=qt.object,ot=qt.geometry,Qt=qt.material,Et=qt.group;if(Qt.side===yi&&Dt.layers.test(ie.layers)){const Un=Qt.side;Qt.side=Qn,Qt.needsUpdate=!0,ba(Dt,re,ie,ot,Qt,Et),Qt.side=Un,Qt.needsUpdate=!0,xt=!0}}xt===!0&&(Ge.updateMultisampleRenderTarget(we),Ge.updateRenderTargetMipmap(we))}E.setRenderTarget(Je,Ye,st),E.setClearColor(ne,ce),Qe!==void 0&&(ie.viewport=Qe),E.toneMapping=lt}function ws(P,X,re){const ie=X.isScene===!0?X.overrideMaterial:null;for(let Y=0,we=P.length;Y<we;Y++){const ze=P[Y],Je=ze.object,Ye=ze.geometry,st=ze.group;let lt=ze.material;lt.allowOverride===!0&&ie!==null&&(lt=ie),Je.layers.test(re.layers)&&ba(Je,X,re,Ye,lt,st)}}function ba(P,X,re,ie,Y,we){P.onBeforeRender(E,X,re,ie,Y,we),P.modelViewMatrix.multiplyMatrices(re.matrixWorldInverse,P.matrixWorld),P.normalMatrix.getNormalMatrix(P.modelViewMatrix),Y.onBeforeRender(E,X,re,ie,P,we),Y.transparent===!0&&Y.side===yi&&Y.forceSinglePass===!1?(Y.side=Qn,Y.needsUpdate=!0,E.renderBufferDirect(re,X,ie,Y,P,we),Y.side=ls,Y.needsUpdate=!0,E.renderBufferDirect(re,X,ie,Y,P,we),Y.side=yi):E.renderBufferDirect(re,X,ie,Y,P,we),P.onAfterRender(E,X,re,ie,Y,we)}function Or(P,X,re){X.isScene!==!0&&(X=Q);const ie=ve.get(P),Y=_.state.lights,we=_.state.shadowsArray,ze=Y.state.version,Je=de.getParameters(P,Y.state,we,X,re),Ye=de.getProgramCacheKey(Je);let st=ie.programs;ie.environment=P.isMeshStandardMaterial?X.environment:null,ie.fog=X.fog,ie.envMap=(P.isMeshStandardMaterial?wt:rt).get(P.envMap||ie.environment),ie.envMapRotation=ie.environment!==null&&P.envMap===null?X.environmentRotation:P.envMapRotation,st===void 0&&(P.addEventListener("dispose",me),st=new Map,ie.programs=st);let lt=st.get(Ye);if(lt!==void 0){if(ie.currentProgram===lt&&ie.lightsStateVersion===ze)return Zu(P,Je),lt}else Je.uniforms=de.getUniforms(P),P.onBeforeCompile(Je,E),lt=de.acquireProgram(Je,Ye),st.set(Ye,lt),ie.uniforms=Je.uniforms;const Qe=ie.uniforms;return(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)&&(Qe.clippingPlanes=Ae.uniform),Zu(P,Je),ie.needsLights=jn(P),ie.lightsStateVersion=ze,ie.needsLights&&(Qe.ambientLightColor.value=Y.state.ambient,Qe.lightProbe.value=Y.state.probe,Qe.directionalLights.value=Y.state.directional,Qe.directionalLightShadows.value=Y.state.directionalShadow,Qe.spotLights.value=Y.state.spot,Qe.spotLightShadows.value=Y.state.spotShadow,Qe.rectAreaLights.value=Y.state.rectArea,Qe.ltc_1.value=Y.state.rectAreaLTC1,Qe.ltc_2.value=Y.state.rectAreaLTC2,Qe.pointLights.value=Y.state.point,Qe.pointLightShadows.value=Y.state.pointShadow,Qe.hemisphereLights.value=Y.state.hemi,Qe.directionalShadowMap.value=Y.state.directionalShadowMap,Qe.directionalShadowMatrix.value=Y.state.directionalShadowMatrix,Qe.spotShadowMap.value=Y.state.spotShadowMap,Qe.spotLightMatrix.value=Y.state.spotLightMatrix,Qe.spotLightMap.value=Y.state.spotLightMap,Qe.pointShadowMap.value=Y.state.pointShadowMap,Qe.pointShadowMatrix.value=Y.state.pointShadowMatrix),ie.currentProgram=lt,ie.uniformsList=null,lt}function Ku(P){if(P.uniformsList===null){const X=P.currentProgram.getUniforms();P.uniformsList=Iu.seqWithValue(X.seq,P.uniforms)}return P.uniformsList}function Zu(P,X){const re=ve.get(P);re.outputColorSpace=X.outputColorSpace,re.batching=X.batching,re.batchingColor=X.batchingColor,re.instancing=X.instancing,re.instancingColor=X.instancingColor,re.instancingMorph=X.instancingMorph,re.skinning=X.skinning,re.morphTargets=X.morphTargets,re.morphNormals=X.morphNormals,re.morphColors=X.morphColors,re.morphTargetsCount=X.morphTargetsCount,re.numClippingPlanes=X.numClippingPlanes,re.numIntersection=X.numClipIntersection,re.vertexAlphas=X.vertexAlphas,re.vertexTangents=X.vertexTangents,re.toneMapping=X.toneMapping}function Ul(P,X,re,ie,Y){X.isScene!==!0&&(X=Q),Ge.resetTextureUnits();const we=X.fog,ze=ie.isMeshStandardMaterial?X.environment:null,Je=O===null?E.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:ko,Ye=(ie.isMeshStandardMaterial?wt:rt).get(ie.envMap||ze),st=ie.vertexColors===!0&&!!re.attributes.color&&re.attributes.color.itemSize===4,lt=!!re.attributes.tangent&&(!!ie.normalMap||ie.anisotropy>0),Qe=!!re.morphAttributes.position,xt=!!re.morphAttributes.normal,Rt=!!re.morphAttributes.color;let Jt=us;ie.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(Jt=E.toneMapping);const qt=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,Dt=qt!==void 0?qt.length:0,ot=ve.get(ie),Qt=_.state.lights;if(V===!0&&(te===!0||P!==L)){const Cn=P===L&&ie.id===A;Ae.setState(ie,P,Cn)}let Et=!1;ie.version===ot.__version?(ot.needsLights&&ot.lightsStateVersion!==Qt.state.version||ot.outputColorSpace!==Je||Y.isBatchedMesh&&ot.batching===!1||!Y.isBatchedMesh&&ot.batching===!0||Y.isBatchedMesh&&ot.batchingColor===!0&&Y.colorTexture===null||Y.isBatchedMesh&&ot.batchingColor===!1&&Y.colorTexture!==null||Y.isInstancedMesh&&ot.instancing===!1||!Y.isInstancedMesh&&ot.instancing===!0||Y.isSkinnedMesh&&ot.skinning===!1||!Y.isSkinnedMesh&&ot.skinning===!0||Y.isInstancedMesh&&ot.instancingColor===!0&&Y.instanceColor===null||Y.isInstancedMesh&&ot.instancingColor===!1&&Y.instanceColor!==null||Y.isInstancedMesh&&ot.instancingMorph===!0&&Y.morphTexture===null||Y.isInstancedMesh&&ot.instancingMorph===!1&&Y.morphTexture!==null||ot.envMap!==Ye||ie.fog===!0&&ot.fog!==we||ot.numClippingPlanes!==void 0&&(ot.numClippingPlanes!==Ae.numPlanes||ot.numIntersection!==Ae.numIntersection)||ot.vertexAlphas!==st||ot.vertexTangents!==lt||ot.morphTargets!==Qe||ot.morphNormals!==xt||ot.morphColors!==Rt||ot.toneMapping!==Jt||ot.morphTargetsCount!==Dt)&&(Et=!0):(Et=!0,ot.__version=ie.version);let Un=ot.currentProgram;Et===!0&&(Un=Or(ie,X,Y));let Qi=!1,Fn=!1,Ts=!1;const $t=Un.getUniforms(),Xn=ot.uniforms;if(qe.useProgram(Un.program)&&(Qi=!0,Fn=!0,Ts=!0),ie.id!==A&&(A=ie.id,Fn=!0),Qi||L!==P){qe.buffers.depth.getReversed()&&P.reversedDepth!==!0&&(P._reversedDepth=!0,P.updateProjectionMatrix()),$t.setValue(z,"projectionMatrix",P.projectionMatrix),$t.setValue(z,"viewMatrix",P.matrixWorldInverse);const zn=$t.map.cameraPosition;zn!==void 0&&zn.setValue(z,ue.setFromMatrixPosition(P.matrixWorld)),$e.logarithmicDepthBuffer&&$t.setValue(z,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&$t.setValue(z,"isOrthographic",P.isOrthographicCamera===!0),L!==P&&(L=P,Fn=!0,Ts=!0)}if(Y.isSkinnedMesh){$t.setOptional(z,Y,"bindMatrix"),$t.setOptional(z,Y,"bindMatrixInverse");const Cn=Y.skeleton;Cn&&(Cn.boneTexture===null&&Cn.computeBoneTexture(),$t.setValue(z,"boneTexture",Cn.boneTexture,Ge))}Y.isBatchedMesh&&($t.setOptional(z,Y,"batchingTexture"),$t.setValue(z,"batchingTexture",Y._matricesTexture,Ge),$t.setOptional(z,Y,"batchingIdTexture"),$t.setValue(z,"batchingIdTexture",Y._indirectTexture,Ge),$t.setOptional(z,Y,"batchingColorTexture"),Y._colorsTexture!==null&&$t.setValue(z,"batchingColorTexture",Y._colorsTexture,Ge));const ir=re.morphAttributes;if((ir.position!==void 0||ir.normal!==void 0||ir.color!==void 0)&&Ce.update(Y,re,Un),(Fn||ot.receiveShadow!==Y.receiveShadow)&&(ot.receiveShadow=Y.receiveShadow,$t.setValue(z,"receiveShadow",Y.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(Xn.envMap.value=Ye,Xn.flipEnvMap.value=Ye.isCubeTexture&&Ye.isRenderTargetTexture===!1?-1:1),ie.isMeshStandardMaterial&&ie.envMap===null&&X.environment!==null&&(Xn.envMapIntensity.value=X.environmentIntensity),Fn&&($t.setValue(z,"toneMappingExposure",E.toneMappingExposure),ot.needsLights&&Fl(Xn,Ts),we&&ie.fog===!0&&Me.refreshFogUniforms(Xn,we),Me.refreshMaterialUniforms(Xn,ie,B,oe,_.state.transmissionRenderTarget[P.id]),Iu.upload(z,Ku(ot),Xn,Ge)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(Iu.upload(z,Ku(ot),Xn,Ge),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&$t.setValue(z,"center",Y.center),$t.setValue(z,"modelViewMatrix",Y.modelViewMatrix),$t.setValue(z,"normalMatrix",Y.normalMatrix),$t.setValue(z,"modelMatrix",Y.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){const Cn=ie.uniformsGroups;for(let zn=0,kl=Cn.length;zn<kl;zn++){const es=Cn[zn];ht.update(es,Un),ht.bind(es,Un)}}return Un}function Fl(P,X){P.ambientLightColor.needsUpdate=X,P.lightProbe.needsUpdate=X,P.directionalLights.needsUpdate=X,P.directionalLightShadows.needsUpdate=X,P.pointLights.needsUpdate=X,P.pointLightShadows.needsUpdate=X,P.spotLights.needsUpdate=X,P.spotLightShadows.needsUpdate=X,P.rectAreaLights.needsUpdate=X,P.hemisphereLights.needsUpdate=X}function jn(P){return P.isMeshLambertMaterial||P.isMeshToonMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isShadowMaterial||P.isShaderMaterial&&P.lights===!0}this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return q},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(P,X,re){const ie=ve.get(P);ie.__autoAllocateDepthBuffer=P.resolveDepthBuffer===!1,ie.__autoAllocateDepthBuffer===!1&&(ie.__useRenderToTexture=!1),ve.get(P.texture).__webglTexture=X,ve.get(P.depthTexture).__webglTexture=ie.__autoAllocateDepthBuffer?void 0:re,ie.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(P,X){const re=ve.get(P);re.__webglFramebuffer=X,re.__useDefaultFramebuffer=X===void 0};const bt=z.createFramebuffer();this.setRenderTarget=function(P,X=0,re=0){O=P,T=X,q=re;let ie=!0,Y=null,we=!1,ze=!1;if(P){const Ye=ve.get(P);if(Ye.__useDefaultFramebuffer!==void 0)qe.bindFramebuffer(z.FRAMEBUFFER,null),ie=!1;else if(Ye.__webglFramebuffer===void 0)Ge.setupRenderTarget(P);else if(Ye.__hasExternalTextures)Ge.rebindTextures(P,ve.get(P.texture).__webglTexture,ve.get(P.depthTexture).__webglTexture);else if(P.depthBuffer){const Qe=P.depthTexture;if(Ye.__boundDepthTexture!==Qe){if(Qe!==null&&ve.has(Qe)&&(P.width!==Qe.image.width||P.height!==Qe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Ge.setupDepthRenderbuffer(P)}}const st=P.texture;(st.isData3DTexture||st.isDataArrayTexture||st.isCompressedArrayTexture)&&(ze=!0);const lt=ve.get(P).__webglFramebuffer;P.isWebGLCubeRenderTarget?(Array.isArray(lt[X])?Y=lt[X][re]:Y=lt[X],we=!0):P.samples>0&&Ge.useMultisampledRTT(P)===!1?Y=ve.get(P).__webglMultisampledFramebuffer:Array.isArray(lt)?Y=lt[re]:Y=lt,N.copy(P.viewport),Z.copy(P.scissor),K=P.scissorTest}else N.copy($).multiplyScalar(B).floor(),Z.copy(pe).multiplyScalar(B).floor(),K=Se;if(re!==0&&(Y=bt),qe.bindFramebuffer(z.FRAMEBUFFER,Y)&&ie&&qe.drawBuffers(P,Y),qe.viewport(N),qe.scissor(Z),qe.setScissorTest(K),we){const Ye=ve.get(P.texture);z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_CUBE_MAP_POSITIVE_X+X,Ye.__webglTexture,re)}else if(ze){const Ye=X;for(let st=0;st<P.textures.length;st++){const lt=ve.get(P.textures[st]);z.framebufferTextureLayer(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0+st,lt.__webglTexture,re,Ye)}}else if(P!==null&&re!==0){const Ye=ve.get(P.texture);z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,Ye.__webglTexture,re)}A=-1},this.readRenderTargetPixels=function(P,X,re,ie,Y,we,ze,Je=0){if(!(P&&P.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ye=ve.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&ze!==void 0&&(Ye=Ye[ze]),Ye){qe.bindFramebuffer(z.FRAMEBUFFER,Ye);try{const st=P.textures[Je],lt=st.format,Qe=st.type;if(!$e.textureFormatReadable(lt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!$e.textureTypeReadable(Qe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}X>=0&&X<=P.width-ie&&re>=0&&re<=P.height-Y&&(P.textures.length>1&&z.readBuffer(z.COLOR_ATTACHMENT0+Je),z.readPixels(X,re,ie,Y,Ke.convert(lt),Ke.convert(Qe),we))}finally{const st=O!==null?ve.get(O).__webglFramebuffer:null;qe.bindFramebuffer(z.FRAMEBUFFER,st)}}},this.readRenderTargetPixelsAsync=async function(P,X,re,ie,Y,we,ze,Je=0){if(!(P&&P.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ye=ve.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&ze!==void 0&&(Ye=Ye[ze]),Ye)if(X>=0&&X<=P.width-ie&&re>=0&&re<=P.height-Y){qe.bindFramebuffer(z.FRAMEBUFFER,Ye);const st=P.textures[Je],lt=st.format,Qe=st.type;if(!$e.textureFormatReadable(lt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!$e.textureTypeReadable(Qe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const xt=z.createBuffer();z.bindBuffer(z.PIXEL_PACK_BUFFER,xt),z.bufferData(z.PIXEL_PACK_BUFFER,we.byteLength,z.STREAM_READ),P.textures.length>1&&z.readBuffer(z.COLOR_ATTACHMENT0+Je),z.readPixels(X,re,ie,Y,Ke.convert(lt),Ke.convert(Qe),0);const Rt=O!==null?ve.get(O).__webglFramebuffer:null;qe.bindFramebuffer(z.FRAMEBUFFER,Rt);const Jt=z.fenceSync(z.SYNC_GPU_COMMANDS_COMPLETE,0);return z.flush(),await Vb(z,Jt,4),z.bindBuffer(z.PIXEL_PACK_BUFFER,xt),z.getBufferSubData(z.PIXEL_PACK_BUFFER,0,we),z.deleteBuffer(xt),z.deleteSync(Jt),we}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(P,X=null,re=0){const ie=Math.pow(2,-re),Y=Math.floor(P.image.width*ie),we=Math.floor(P.image.height*ie),ze=X!==null?X.x:0,Je=X!==null?X.y:0;Ge.setTexture2D(P,0),z.copyTexSubImage2D(z.TEXTURE_2D,re,0,0,ze,Je,Y,we),qe.unbindTexture()};const zl=z.createFramebuffer(),Ju=z.createFramebuffer();this.copyTextureToTexture=function(P,X,re=null,ie=null,Y=0,we=null){we===null&&(Y!==0?(Ho("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),we=Y,Y=0):we=0);let ze,Je,Ye,st,lt,Qe,xt,Rt,Jt;const qt=P.isCompressedTexture?P.mipmaps[we]:P.image;if(re!==null)ze=re.max.x-re.min.x,Je=re.max.y-re.min.y,Ye=re.isBox3?re.max.z-re.min.z:1,st=re.min.x,lt=re.min.y,Qe=re.isBox3?re.min.z:0;else{const ir=Math.pow(2,-Y);ze=Math.floor(qt.width*ir),Je=Math.floor(qt.height*ir),P.isDataArrayTexture?Ye=qt.depth:P.isData3DTexture?Ye=Math.floor(qt.depth*ir):Ye=1,st=0,lt=0,Qe=0}ie!==null?(xt=ie.x,Rt=ie.y,Jt=ie.z):(xt=0,Rt=0,Jt=0);const Dt=Ke.convert(X.format),ot=Ke.convert(X.type);let Qt;X.isData3DTexture?(Ge.setTexture3D(X,0),Qt=z.TEXTURE_3D):X.isDataArrayTexture||X.isCompressedArrayTexture?(Ge.setTexture2DArray(X,0),Qt=z.TEXTURE_2D_ARRAY):(Ge.setTexture2D(X,0),Qt=z.TEXTURE_2D),z.pixelStorei(z.UNPACK_FLIP_Y_WEBGL,X.flipY),z.pixelStorei(z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),z.pixelStorei(z.UNPACK_ALIGNMENT,X.unpackAlignment);const Et=z.getParameter(z.UNPACK_ROW_LENGTH),Un=z.getParameter(z.UNPACK_IMAGE_HEIGHT),Qi=z.getParameter(z.UNPACK_SKIP_PIXELS),Fn=z.getParameter(z.UNPACK_SKIP_ROWS),Ts=z.getParameter(z.UNPACK_SKIP_IMAGES);z.pixelStorei(z.UNPACK_ROW_LENGTH,qt.width),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,qt.height),z.pixelStorei(z.UNPACK_SKIP_PIXELS,st),z.pixelStorei(z.UNPACK_SKIP_ROWS,lt),z.pixelStorei(z.UNPACK_SKIP_IMAGES,Qe);const $t=P.isDataArrayTexture||P.isData3DTexture,Xn=X.isDataArrayTexture||X.isData3DTexture;if(P.isDepthTexture){const ir=ve.get(P),Cn=ve.get(X),zn=ve.get(ir.__renderTarget),kl=ve.get(Cn.__renderTarget);qe.bindFramebuffer(z.READ_FRAMEBUFFER,zn.__webglFramebuffer),qe.bindFramebuffer(z.DRAW_FRAMEBUFFER,kl.__webglFramebuffer);for(let es=0;es<Ye;es++)$t&&(z.framebufferTextureLayer(z.READ_FRAMEBUFFER,z.COLOR_ATTACHMENT0,ve.get(P).__webglTexture,Y,Qe+es),z.framebufferTextureLayer(z.DRAW_FRAMEBUFFER,z.COLOR_ATTACHMENT0,ve.get(X).__webglTexture,we,Jt+es)),z.blitFramebuffer(st,lt,ze,Je,xt,Rt,ze,Je,z.DEPTH_BUFFER_BIT,z.NEAREST);qe.bindFramebuffer(z.READ_FRAMEBUFFER,null),qe.bindFramebuffer(z.DRAW_FRAMEBUFFER,null)}else if(Y!==0||P.isRenderTargetTexture||ve.has(P)){const ir=ve.get(P),Cn=ve.get(X);qe.bindFramebuffer(z.READ_FRAMEBUFFER,zl),qe.bindFramebuffer(z.DRAW_FRAMEBUFFER,Ju);for(let zn=0;zn<Ye;zn++)$t?z.framebufferTextureLayer(z.READ_FRAMEBUFFER,z.COLOR_ATTACHMENT0,ir.__webglTexture,Y,Qe+zn):z.framebufferTexture2D(z.READ_FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,ir.__webglTexture,Y),Xn?z.framebufferTextureLayer(z.DRAW_FRAMEBUFFER,z.COLOR_ATTACHMENT0,Cn.__webglTexture,we,Jt+zn):z.framebufferTexture2D(z.DRAW_FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,Cn.__webglTexture,we),Y!==0?z.blitFramebuffer(st,lt,ze,Je,xt,Rt,ze,Je,z.COLOR_BUFFER_BIT,z.NEAREST):Xn?z.copyTexSubImage3D(Qt,we,xt,Rt,Jt+zn,st,lt,ze,Je):z.copyTexSubImage2D(Qt,we,xt,Rt,st,lt,ze,Je);qe.bindFramebuffer(z.READ_FRAMEBUFFER,null),qe.bindFramebuffer(z.DRAW_FRAMEBUFFER,null)}else Xn?P.isDataTexture||P.isData3DTexture?z.texSubImage3D(Qt,we,xt,Rt,Jt,ze,Je,Ye,Dt,ot,qt.data):X.isCompressedArrayTexture?z.compressedTexSubImage3D(Qt,we,xt,Rt,Jt,ze,Je,Ye,Dt,qt.data):z.texSubImage3D(Qt,we,xt,Rt,Jt,ze,Je,Ye,Dt,ot,qt):P.isDataTexture?z.texSubImage2D(z.TEXTURE_2D,we,xt,Rt,ze,Je,Dt,ot,qt.data):P.isCompressedTexture?z.compressedTexSubImage2D(z.TEXTURE_2D,we,xt,Rt,qt.width,qt.height,Dt,qt.data):z.texSubImage2D(z.TEXTURE_2D,we,xt,Rt,ze,Je,Dt,ot,qt);z.pixelStorei(z.UNPACK_ROW_LENGTH,Et),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,Un),z.pixelStorei(z.UNPACK_SKIP_PIXELS,Qi),z.pixelStorei(z.UNPACK_SKIP_ROWS,Fn),z.pixelStorei(z.UNPACK_SKIP_IMAGES,Ts),we===0&&X.generateMipmaps&&z.generateMipmap(Qt),qe.unbindTexture()},this.copyTextureToTexture3D=function(P,X,re=null,ie=null,Y=0){return Ho('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(P,X,re,ie,Y)},this.initRenderTarget=function(P){ve.get(P).__webglFramebuffer===void 0&&Ge.setupRenderTarget(P)},this.initTexture=function(P){P.isCubeTexture?Ge.setTextureCube(P,0):P.isData3DTexture?Ge.setTexture3D(P,0):P.isDataArrayTexture||P.isCompressedArrayTexture?Ge.setTexture2DArray(P,0):Ge.setTexture2D(P,0),qe.unbindTexture()},this.resetState=function(){T=0,q=0,O=null,qe.reset(),Re.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return bi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Ct._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ct._getUnpackColorSpace()}}class _6 extends Tl{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new r4(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){const l=s.parse(JSON.parse(a));t&&t(l)},r,i)}parse(e){return new v6(e)}}class v6{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){const r=[],i=x6(e,t,this.data);for(let s=0,o=i.length;s<o;s++)r.push(...i[s].toShapes());return r}}function x6(n,e,t){const r=Array.from(n),i=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*i,o=[];let a=0,l=0;for(let c=0;c<r.length;c++){const h=r[c];if(h===`
3918
3910
  `)a=0,l-=s;else{const f=y6(h,i,a,l,t);a+=f.offsetX,o.push(f.path)}}return o}function y6(n,e,t,r,i){const s=i.glyphs[n]||i.glyphs["?"];if(!s){console.error('THREE.Font: character "'+n+'" does not exists in font family '+i.familyName+".");return}const o=new f4;let a,l,c,h,f,p,d,m;if(s.o){const x=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let v=0,_=x.length;v<_;)switch(x[v++]){case"m":a=x[v++]*e+t,l=x[v++]*e+r,o.moveTo(a,l);break;case"l":a=x[v++]*e+t,l=x[v++]*e+r,o.lineTo(a,l);break;case"q":c=x[v++]*e+t,h=x[v++]*e+r,f=x[v++]*e+t,p=x[v++]*e+r,o.quadraticCurveTo(f,p,c,h);break;case"b":c=x[v++]*e+t,h=x[v++]*e+r,f=x[v++]*e+t,p=x[v++]*e+r,d=x[v++]*e+t,m=x[v++]*e+r,o.bezierCurveTo(f,p,d,m,c,h);break}}return{offsetX:s.ha*e,path:o}}const S6={glyphs:{ο:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"¦":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},Τ:{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},Π:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},ΐ:{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"²":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"–":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},Κ:{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},ƒ:{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},ό:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"»":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"©":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},ώ:{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"«":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"∙":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},ÿ:{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},µ:{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},Ι:{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},Ύ:{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"’":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},Ν:{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},ς:{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},Ψ:{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},ι:{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},Ά:{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},ε:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},Δ:{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"‰":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"—":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},ρ:{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},"¯":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},Η:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},Α:{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"…":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},ν:{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"¶":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},β:{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},Μ:{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},Ό:{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},Ή:{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"•":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"¥":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},γ:{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},α:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"­":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},Χ:{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"†":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"°":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},Ξ:{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "}," ":{x_min:0,x_max:0,ha:853},Ϋ:{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},"”":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},Ί:{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},Β:{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},υ:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},χ:{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},ί:{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},Ζ:{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"¨":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"‹":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"„":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},δ:{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},έ:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},ω:{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"´":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"±":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},ϋ:{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"§":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},Ω:{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},ύ:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"™":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},ή:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},Θ:{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"®":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},Ε:{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"³":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},σ:{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},ζ:{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},θ:{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},Ο:{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},Γ:{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},Έ:{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},Ώ:{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},Ϊ:{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"½":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},Ρ:{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},ª:{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"΅":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},Φ:{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"⁋":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},Σ:{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},"›":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"£":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"¬":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},λ:{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},τ:{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},ξ:{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},Λ:{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},ΰ:{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"·":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},Υ:{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},μ:{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},φ:{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"“":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},"‘":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},ϊ:{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},π:{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},ά:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"¤":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},κ:{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"‡":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},ψ:{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},η:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},cssFontWeight:"normal",ascender:1189,underlinePosition:-100,cssFontStyle:"normal",boundingBox:{yMin:-334,xMin:-111,yMax:1189,xMax:1672},resolution:1e3,original_font_information:{postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) Μagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"Μagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:`Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r
3919
3911
  \r
3920
3912
  Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r
@@ -3927,11 +3919,11 @@ This License becomes null and void to the extent applicable to Fonts or Font Sof
3927
3919
  \r
3928
3920
  The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r
3929
3921
  \r
3930
- THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"Μagenta ltd",font_sub_family_name:"Regular"},descender:-334,familyName:"Helvetiker",lineHeight:1522,underlineThickness:50};function E6(n,e,t,r){const i=t.properties.get("step"),s=t.properties.has("color")?Je([t.properties.get("color")]):t.properties.get("colors"),o=new kt;o.name="streak";let a=0;for(let l=0;l<=e;l+=i){const c=[new j(0,0,-l),new j(n,0,-l)],h=new ur().setFromPoints(c),f=s.get(a%s.size),p=new bu({color:f}),d=new Tl(h,p);o.add(d),o.add(new Tl(h,p)),a++}return o}function b6(n,e,t,r){const i=t.properties.get("step"),s=t.properties.has("color")?Je([t.properties.get("color")]):t.properties.get("colors"),o=new kt;o.name="streak";let a=0;for(let l=0;l<=n;l+=i){const c=[new j(l,0,0),new j(l,0,-e)],h=new ur().setFromPoints(c),f=s.get(a%s.size),p=new bu({color:f});o.add(new Tl(h,p)),a++}return o}function M6(n){const e=new kt;e.name="grid",new _6().parse(S6);const{grids:r,width:i,height:s}=n;return r.forEach(o=>{switch(o.type){case"horizontal-streak":e.add(E6(i,s,o));break;case"vertical-streak":e.add(b6(i,s,o));break}}),e.position.y=-1,e}function w6(n){n&&n.dispose&&n.dispose()}function T6(n){n&&n.dispose&&n.dispose()}function qv(n){if(n){if(Array.isArray(n)){n.forEach(e=>qv(e));return}for(const e in n){const t=n[e];t instanceof Gn&&T6(t)}n.dispose()}}function Dv(n){(n instanceof Dn||n instanceof h4||n instanceof Tl)&&(w6(n.geometry),qv(n.material),n.geometry=null,n.material=null)}function A6(n){n.traverse(e=>{Dv(e)})}function Fu(n){n.traverse(e=>{Dv(e)})}function C6(n,e,t){const r={sceneGraph:{unit:n.unit,layers:{},busyResources:{layers:{}},width:n.width,height:n.height,LODs:{}},plan:new kt,grid:M6(n),boundingBox:new Li};r.plan.name="plan",r.grid.name="grid",r.boundingBox.setFromObject(r.grid);let i=[];return n.layers.forEach(s=>{(s.id===n.selectedLayer||s.visible)&&(i=i.concat(zu(s,r,n,e,t)))}),Promise.all(i).then(()=>ns(r)),r}function zu(n,e,t,r,i){const s=[];return e.sceneGraph.layers[n.id]={id:n.id,lines:{},holes:{},areas:{},items:{},visible:n.visible,altitude:n.altitude},e.sceneGraph.busyResources.layers[n.id]={id:n.id,lines:{},holes:{},areas:{},items:{}},n.lines.forEach(o=>{s.push(po(t,e,n,o.id,i,r.linesActions)),o.holes.forEach(a=>{s.push(Sa(t,e,n,a,i,r.holesActions))})}),n.areas.forEach(o=>{s.push(Ul(t,e,n,o.id,i,r.areaActions))}),n.items.forEach(o=>{s.push(ku(t,e,n,o.id,i,r.itemsActions))}),s}function R6(n,e,t,r,i,s){const o=r.map(l=>({op:l.op,path:l.path.split("/"),value:l.value}));let a=U6(o,e,t);return a=a.filter(({path:l})=>l[3]!=="selected"),a=a.filter(({path:l})=>l[1]!=="groups"),a.forEach(({op:l,path:c,value:h})=>{if(c[1]==="layers"){const f=e.getIn(["layers",c[2]]);if(c.length===3&&l==="remove")I6(c[2],n);else if(c.length>3)switch(l){case"replace":Nl(c,f,n,i,e,t,s);break;case"add":L6(c,f,n,i,e,t,s);break;case"remove":P6(c,f,n,i,e,t,s);break}}else if(c[1]==="selectedLayer"){const f=h,p=e.getIn(["layers",f]);if(!p.visible){const m=zu(p,n,e,i,s);Promise.all(m).then(()=>ns(n))}const d=n.sceneGraph.layers[(t==null?void 0:t.selectedLayer)??""];if(d&&!d.visible){for(let m in d.lines)ts(n,d.id,m);for(let m in d.areas)Rs(n,d.id,m);for(let m in d.items)Ps(n,d.id,m);for(let m in d.holes)es(n,d.id,m)}}}),n}function Nl(n,e,t,r,i,s,o){let a=[];switch(n[3]){case"vertices":if(n[5]!=="selected"){const d=e.getIn(["vertices",n[4]]);if((n[5]==="x"||n[5]==="y")&&(d.lines.forEach(m=>{const x=s.getIn(["layers",e.id,"lines",m,"holes"]);return x&&x.forEach(v=>{Nl([0,0,0,"holes",v,"selected"],e,t,r,i,s,o)}),Nl([0,0,0,"lines",m],e,t,r,i,s,o)}),d.areas.forEach(m=>Nl([0,0,0,"areas",m],e,t,r,i,s,o))),n[5]==="areas"){let m=d.getIn(["areas",~~n[6]]);Nl([0,0,0,"areas",m],e,t,r,i,s,o)}}break;case"holes":const l=e.getIn(["holes",n[4]]);if(o.getElement(l.type).updateRender3D)a.push(O6(i,s,t,e,n[4],n.slice(5),o,r.holesActions,()=>es(t,e.id,l.id),()=>Sa(i,t,e,l.id,o,r.holesActions)));else{let d=l.line;n[5]==="selected"?(es(t,e.id,l.id),a.push(Sa(i,t,e,l.id,o,r.holesActions))):(e.getIn(["lines",d,"holes"]).forEach(m=>{es(t,e.id,m)}),ts(t,e.id,d),a.push(po(i,t,e,d,o,r.linesActions)),e.getIn(["lines",d,"holes"]).forEach(m=>{a.push(Sa(i,t,e,m,o,r.holesActions))}))}break;case"lines":const c=e.getIn(["lines",n[4]]);o.getElement(c.type).updateRender3D?a.push(q6(i,s,t,e,n[4],n.slice(5),o,r.linesActions,()=>ts(t,e.id,n[4]),()=>po(i,t,e,n[4],o,r.linesActions))):(ts(t,e.id,n[4]),a.push(po(i,t,e,n[4],o,r.linesActions)));break;case"areas":const h=e.getIn(["areas",n[4]]);o.getElement(h.type).updateRender3D?a.push(D6(i,s,t,e,n[4],n.slice(5),o,r.areaActions,()=>Rs(t,e.id,n[4]),()=>Ul(i,t,e,n[4],o,r.areaActions))):(t.sceneGraph.layers[e.id].areas[n[4]]&&Rs(t,e.id,n[4]),a.push(Ul(i,t,e,n[4],o,r.areaActions)));break;case"items":const f=e.getIn(["items",n[4]]);o.getElement(f.type).updateRender3D?a.push(N6(i,s,t,e,n[4],n.slice(5),o,r.itemsActions,()=>Ps(t,e.id,n[4]),()=>ku(i,t,e,n[4],o,r.itemsActions))):(Ps(t,e.id,n[4]),a.push(ku(i,t,e,n[4],o,r.itemsActions)));break;case"visible":if(e.visible)a=a.concat(zu(e,t,i,r,o));else{let d=t.sceneGraph.layers[e.id];for(let m in d.lines)ts(t,e.id,m);for(let m in d.areas)Rs(t,e.id,m);for(let m in d.items)Ps(t,e.id,m);for(let m in d.holes)es(t,e.id,m)}break;case"opacity":case"altitude":let p=t.sceneGraph.layers[e.id];for(let d in p.lines)ts(t,e.id,d);for(let d in p.areas)Rs(t,e.id,d);for(let d in p.items)Ps(t,e.id,d);for(let d in p.holes)es(t,e.id,d);a=a.concat(zu(e,t,i,r,o))}Promise.all(a).then(()=>ns(t))}function P6(n,e,t,r,i,s,o){let a=[];switch(n[3]){case"lines":const l=n[4];s.getIn(["layers",e.id,"lines",l,"holes"]).forEach(c=>{es(t,e.id,c)}),ts(t,e.id,l),n.length>5&&(a.push(po(i,t,e,l,o,r.linesActions)),e.getIn(["lines",l,"holes"]).forEach(c=>{a.push(Sa(i,t,e,c,o,r.holesActions))}));break;case"areas":n.length===5&&Rs(t,e.id,n[4]);break;case"items":n.length===5&&Ps(t,e.id,n[4]);break}Promise.all(a).then(()=>ns(t))}function I6(n,e){let t=e.sceneGraph.layers[n];for(let r in t.lines)ts(e,n,r);for(let r in t.areas)Rs(e,n,r);for(let r in t.items)Ps(e,n,r);for(let r in t.holes)es(e,n,r);delete e.sceneGraph.layers[n]}function es(n,e,t){if(n.sceneGraph.busyResources.layers[e].holes[t]){setTimeout(()=>es(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].holes[t]=!0;let r=n.sceneGraph.layers[e].holes[t];r&&(n.plan.remove(r),Fu(r),delete n.sceneGraph.layers[e].holes[t],delete n.sceneGraph.LODs[t],r=null,ns(n)),n.sceneGraph.busyResources.layers[e].holes[t]=!1}function ts(n,e,t){if(n.sceneGraph.busyResources.layers[e].lines[t]){setTimeout(()=>ts(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].lines[t]=!0;let r=n.sceneGraph.layers[e].lines[t];r&&(n.plan.remove(r),Fu(r),delete n.sceneGraph.layers[e].lines[t],delete n.sceneGraph.LODs[t],r=null,ns(n)),n.sceneGraph.busyResources.layers[e].lines[t]=!1}function Rs(n,e,t){if(n.sceneGraph.busyResources.layers[e].areas[t]){setTimeout(()=>Rs(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].areas[t]=!0;let r=n.sceneGraph.layers[e].areas[t];r&&(n.plan.remove(r),Fu(r),delete n.sceneGraph.layers[e].areas[t],delete n.sceneGraph.LODs[t],r=null,ns(n)),n.sceneGraph.busyResources.layers[e].areas[t]=!1}function Ps(n,e,t){if(n.sceneGraph.busyResources.layers[e].items[t]){setTimeout(()=>Ps(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].items[t]=!0;let r=n.sceneGraph.layers[e].items[t];r&&(n.plan.remove(r),Fu(r),delete n.sceneGraph.layers[e].items[t],delete n.sceneGraph.LODs[t],r=null,ns(n)),n.sceneGraph.busyResources.layers[e].items[t]=!1}function L6(n,e,t,r,i,s,o){if(n.length===5){let a=null,l=null;switch(n[3]){case"lines":a=po,l=r.linesActions;break;case"areas":a=Ul,l=r.areaActions;break;case"items":a=ku,l=r.itemsActions;break;case"holes":a=Sa,l=r.holesActions;break}a&&a(i,t,e,n[4],o,l).then(()=>ns(t))}}function Sa(n,e,t,r,i,s){const o=t.getIn(["holes",r]);return i.getElement(o.type).render3D(o,t,n).then(a=>{a instanceof Su&&(e.sceneGraph.LODs[r]=a);const l=new kt;l.name="pivot",l.add(a);const c=t.getIn(["lines",o.line]);let h=t.vertices.get(c.vertices.get(0)),f=t.vertices.get(c.vertices.get(1)),p=o.offset;if(h.x>f.x){const b=h;h=f,f=b,p=1-p}let d=Math.sqrt(Math.pow(h.x-f.x,2)+Math.pow(h.y-f.y,2)),m=Math.asin((f.y-h.y)/d),x=new Li().setFromObject(l),v=[(x.max.x-x.min.x)/2+x.min.x,(x.max.y-x.min.y)/2+x.min.y,(x.max.z-x.min.z)/2+x.min.z],_=o.properties.getIn(["altitude","length"]),E=o.properties.getIn(["height","length"]);l.rotation.y=m,l.position.x=h.x+d*p*Math.cos(m)-v[2]*Math.sin(m),l.position.y=_+E/2-v[1]+t.altitude,l.position.z=-h.y-d*p*Math.sin(m)-v[2]*Math.cos(m),e.plan.add(l),e.sceneGraph.layers[t.id].holes[o.id]=l,Bu(l,()=>s.selectHole(t.id,o.id));let M=t.opacity;o.selected&&(M=1),Vu(l,M)})}function O6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["holes",i]),f=e.getIn(["layers",r.id,"holes",i]),p=t.sceneGraph.layers[r.id].holes[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function po(n,e,t,r,i,s){if(e.sceneGraph.busyResources.layers[t.id].lines[r]){setTimeout(()=>po(n,e,t,r,i,s),100);return}e.sceneGraph.busyResources.layers[t.id].lines[r]=!0;const o=t.getIn(["lines",r]);let a=t.vertices.get(o.vertices.get(0)),l=t.vertices.get(o.vertices.get(1));if(a.x>l.x){let c=a;a=l,l=c}return i.getElement(o.type).render3D(o,t,n).then(c=>{c instanceof Su&&(e.sceneGraph.LODs[o.id]=c);let h=new kt;h.name="pivot",h.add(c),h.position.x=a.x,h.position.y=t.altitude,h.position.z=-a.y,e.plan.add(h),e.sceneGraph.layers[t.id].lines[r]=h,Bu(h,()=>s.selectLine(t.id,o.id));let f=t.opacity;o.selected&&(f=1),Vu(h,f),e.sceneGraph.busyResources.layers[t.id].lines[r]=!1})}function q6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["lines",i]),f=e.getIn(["layers",r.id,"lines",i]),p=t.sceneGraph.layers[r.id].lines[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function Ul(n,e,t,r,i,s){if(e.sceneGraph.busyResources.layers[t.id].areas[r]){setTimeout(()=>Ul(n,e,t,r,i,s),100);return}e.sceneGraph.busyResources.layers[t.id].areas[r]=!0;const o=t.getIn(["areas",r]),a=()=>s.selectArea(t.id,r);return i.getElement(o.type).render3D(o,t,n).then(l=>{l instanceof Su&&(e.sceneGraph.LODs[r]=l);let c=new kt;c.name="pivot",c.add(l),c.position.y=t.altitude,e.plan.add(c),e.sceneGraph.layers[t.id].areas[r]=c,Bu(c,a);let h=t.opacity;o.selected&&(h=1),Vu(c,h),e.sceneGraph.busyResources.layers[t.id].areas[r]=!1})}function D6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["areas",i]),f=e.getIn(["layers",r.id,"areas",i]),p=t.sceneGraph.layers[r.id].areas[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function ku(n,e,t,r,i,s){const o=t.getIn(["items",r]);return i.getElement(o.type).render3D(o,t,n).then(a=>{a instanceof Su&&(e.sceneGraph.LODs[r]=a);const l=new kt;l.name="pivot",l.add(a),l.rotation.y=o.rotation*Math.PI/180,l.position.x=o.x,l.position.y=t.altitude,l.position.z=-o.y,Bu(a,()=>{s.selectItem(t.id,o.id)});let c=t.opacity;o.selected&&(c=1),Vu(l,c),e.plan.add(l),e.sceneGraph.layers[t.id].items[o.id]=l})}function N6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["items",i]),f=e.getIn(["layers",r.id,"items",i]),p=t.sceneGraph.layers[r.id].items[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function Bu(n,e){n.traverse(t=>{t instanceof Dn&&(t.interact=e)})}function Vu(n,e){n.traverse(t=>{t instanceof Dn&&(t.material instanceof Array?t.material.forEach(r=>{r.transparent=!0,r.maxOpacity?r.opacity=Math.min(r.maxOpacity,e):r.opacity&&r.opacity>e&&(r.maxOpacity=r.opacity,r.opacity=e)}):(t.material.transparent=!0,t.material.maxOpacity?t.material.opacity=Math.min(t.material.maxOpacity,e):t.material.opacity&&t.material.opacity>e&&(t.material.maxOpacity=t.material.opacity,t.material.opacity=e)))})}function ns(n){let e=new Li().setFromObject(n.plan);if(isFinite(e.max.x)&&isFinite(e.min.x)&&isFinite(e.max.y)&&isFinite(e.min.y)&&isFinite(e.max.z)&&isFinite(e.min.z)){let t=new j((e.max.x-e.min.x)/2+e.min.x,(e.max.y-e.min.y)/2+e.min.y,(e.max.z-e.min.z)/2+e.min.z);n.plan.position.sub(t),n.grid.position.sub(t),e.min.sub(t),e.max.sub(t),n.boundingBox=e}}function U6(n,e,t){return F6(z6(k6(n)),e,t)}function F6(n,e,t){let r,i;for(i=0;i<n.length&&!r;i++)n[i].path[1]==="selectedLayer"&&(r=n[i]);return r&&!e.getIn(["layers",t.selectedLayer,"visible"])?n.filter(({op:s,path:o})=>!(o[o.length-1]==="selected"&&o[1]==="layers"&&o[2]===t.selectedLayer)&&!(s==="remove"&&o.indexOf(t.selectedLayer)!==-1)):n}function z6(n,e,t){const r={};return n.forEach(({path:i})=>{i[5]==="selected"&&(r[i[4]]=i[4])}),n.filter(({path:i})=>i[5]==="properties"?!r[i[4]]:!0)}function k6(n,e,t){const r={};return n.filter(({path:i})=>i[5]==="properties"?r[i[4]]?!1:r[i[4]]=!0:i[5]!=="misc")}const Nv={type:"change"},Gp={type:"start"},Uv={type:"end"},Hu=new lu,Fv=new Cs,B6=Math.cos(70*kb.DEG2RAD),Rn=new j,hr=2*Math.PI,Wt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Wp=1e-6;class V6 extends d4{constructor(e,t=null){super(e,t),this.state=Wt.NONE,this.target=new j,this.cursor=new j,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Go.ROTATE,MIDDLE:Go.DOLLY,RIGHT:Go.PAN},this.touches={ONE:Wo.ROTATE,TWO:Wo.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new j,this._lastQuaternion=new ys,this._lastTargetPosition=new j,this._quat=new ys().setFromUnitVectors(e.up,new j(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new nv,this._sphericalDelta=new nv,this._scale=1,this._panOffset=new j,this._rotateStart=new Be,this._rotateEnd=new Be,this._rotateDelta=new Be,this._panStart=new Be,this._panEnd=new Be,this._panDelta=new Be,this._dollyStart=new Be,this._dollyEnd=new Be,this._dollyDelta=new Be,this._dollyDirection=new j,this._mouse=new Be,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=G6.bind(this),this._onPointerDown=H6.bind(this),this._onPointerUp=W6.bind(this),this._onContextMenu=J6.bind(this),this._onMouseWheel=$6.bind(this),this._onKeyDown=Y6.bind(this),this._onTouchStart=K6.bind(this),this._onTouchMove=Z6.bind(this),this._onMouseDown=j6.bind(this),this._onMouseMove=X6.bind(this),this._interceptControlDown=Q6.bind(this),this._interceptControlUp=e8.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Nv),this.update(),this.state=Wt.NONE}update(e=null){const t=this.object.position;Rn.copy(t).sub(this.target),Rn.applyQuaternion(this._quat),this._spherical.setFromVector3(Rn),this.autoRotate&&this.state===Wt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let r=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(r)&&isFinite(i)&&(r<-Math.PI?r+=hr:r>Math.PI&&(r-=hr),i<-Math.PI?i+=hr:i>Math.PI&&(i-=hr),r<=i?this._spherical.theta=Math.max(r,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(r+i)/2?Math.max(r,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(Rn.setFromSpherical(this._spherical),Rn.applyQuaternion(this._quatInverse),t.copy(this.target).add(Rn),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=Rn.length();o=this._clampDistance(a*this._scale);const l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const a=new j(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new j(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=Rn.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(Hu.origin.copy(this.object.position),Hu.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Hu.direction))<B6?this.object.lookAt(this.target):(Fv.setFromNormalAndCoplanarPoint(this.object.up,this.target),Hu.intersectPlane(Fv,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Wp||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Wp||this._lastTargetPosition.distanceToSquared(this.target)>Wp?(this.dispatchEvent(Nv),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?hr/60*this.autoRotateSpeed*e:hr/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Rn.setFromMatrixColumn(t,0),Rn.multiplyScalar(-e),this._panOffset.add(Rn)}_panUp(e,t){this.screenSpacePanning===!0?Rn.setFromMatrixColumn(t,1):(Rn.setFromMatrixColumn(t,0),Rn.crossVectors(this.object.up,Rn)),Rn.multiplyScalar(e),this._panOffset.add(Rn)}_pan(e,t){const r=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;Rn.copy(i).sub(this.target);let s=Rn.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/r.clientHeight,this.object.matrix),this._panUp(2*t*s/r.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/r.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const r=this.domElement.getBoundingClientRect(),i=e-r.left,s=t-r.top,o=r.width,a=r.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(hr*this._rotateDelta.x/t.clientHeight),this._rotateUp(hr*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(hr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-hr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(hr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-hr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(r,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(r,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),i=.5*(e.pageX+r.x),s=.5*(e.pageY+r.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(hr*this._rotateDelta.x/t.clientHeight),this._rotateUp(hr*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(r,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Be,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,r={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:r.deltaY*=16;break;case 2:r.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(r.deltaY*=10),r}}function H6(n){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(n.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(n)&&(this._addPointer(n),n.pointerType==="touch"?this._onTouchStart(n):this._onMouseDown(n)))}function G6(n){this.enabled!==!1&&(n.pointerType==="touch"?this._onTouchMove(n):this._onMouseMove(n))}function W6(n){switch(this._removePointer(n),this._pointers.length){case 0:this.domElement.releasePointerCapture(n.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Uv),this.state=Wt.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function j6(n){let e;switch(n.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Go.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(n),this.state=Wt.DOLLY;break;case Go.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=Wt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=Wt.ROTATE}break;case Go.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=Wt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=Wt.PAN}break;default:this.state=Wt.NONE}this.state!==Wt.NONE&&this.dispatchEvent(Gp)}function X6(n){switch(this.state){case Wt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(n);break;case Wt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(n);break;case Wt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(n);break}}function $6(n){this.enabled===!1||this.enableZoom===!1||this.state!==Wt.NONE||(n.preventDefault(),this.dispatchEvent(Gp),this._handleMouseWheel(this._customWheelEvent(n)),this.dispatchEvent(Uv))}function Y6(n){this.enabled!==!1&&this._handleKeyDown(n)}function K6(n){switch(this._trackPointer(n),this._pointers.length){case 1:switch(this.touches.ONE){case Wo.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(n),this.state=Wt.TOUCH_ROTATE;break;case Wo.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(n),this.state=Wt.TOUCH_PAN;break;default:this.state=Wt.NONE}break;case 2:switch(this.touches.TWO){case Wo.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(n),this.state=Wt.TOUCH_DOLLY_PAN;break;case Wo.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(n),this.state=Wt.TOUCH_DOLLY_ROTATE;break;default:this.state=Wt.NONE}break;default:this.state=Wt.NONE}this.state!==Wt.NONE&&this.dispatchEvent(Gp)}function Z6(n){switch(this._trackPointer(n),this.state){case Wt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(n),this.update();break;case Wt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(n),this.update();break;case Wt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(n),this.update();break;case Wt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(n),this.update();break;default:this.state=Wt.NONE}}function J6(n){this.enabled!==!1&&n.preventDefault()}function Q6(n){n.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function e8(n){n.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const Ea=n=>Xt(n),ba=n=>Zn(n),Ma=n=>St.isRecord(n),rs=(n,e,t)=>n==="remove"?{op:n,path:e}:{op:n,path:e,value:t},t8=(n,e,t)=>{const r=[];for(let i=0;i<n;i++){r[i]=new Array(e);for(let s=0;s<e;s++)r[i][s]=t}return r},jp=St({op:"=",val:null}),n8=St({op:"!=",val:null,newVal:null}),r8=(n,e)=>{const t=i8(n,e);return s8(t,n,e,n.size??0,e.size??0)},i8=(n,e)=>{const t=n.size??0,r=e.size??0,i=t8(t+1,r+1,0);for(let s=0;s<t;s++)for(let o=0;o<r;o++)sn(n.get(s),e.get(o))?i[s+1][o+1]=i[s][o]+1:i[s+1][o+1]=Math.max(i[s+1][o],i[s][o+1]);return i},s8=(n,e,t,r,i)=>{const s=[];let o=r-1,a=i-1;for(;o>=0||a>=0;)o>=0&&a>=0&&sn(e.get(o),t.get(a))?(s.push(new jp({op:"=",val:e.get(o)})),o--,a--):o>=0&&a>=0&&o===a&&!sn(e.get(o),t.get(a))?(s.push(new n8({val:e.get(o),newVal:t.get(o)})),o--,a--):a>=0&&(o===-1||n[o+1][a]>=n[o][a+1])?(s.push(new jp({op:"+",val:t.get(a)})),a--):o>=0&&(a===-1||n[o+1][a]<n[o][a+1])&&(s.push(new jp({op:"-",val:e.get(o)})),o--);return s.reverse()},o8=/\//g,a8=/~/g,mo=n=>{if(typeof n=="number")return n.toString();if(typeof n!="string")throw new Error(`param str (${String(n)}) is not a string`);return n.replace(a8,"~0").replace(o8,"~1")},Tr=(n,e)=>`${n}/${e}`,Fl=(n,e,t="")=>{let r=[];if(sn(n,e)||n==e&&n==null)return r;const i=ba(n)&&ba(e);let s=null,o=null;return n.forEach&&n.forEach((a,l)=>{if(e.has(l))if(Ma(a)&&Ma(e.get(l)))r=r.concat(Xp(a,e.get(l),Tr(t,mo(l))));else if(Ea(a)&&Ea(e.get(l)))r=r.concat(Fl(a,e.get(l),Tr(t,mo(l))));else if(ba(a)&&ba(e.get(l)))r=r.concat(zv(a,e.get(l),Tr(t,mo(l))));else{const c=e.get?e.get(l):e;a!==c&&r.push(rs("replace",Tr(t,mo(l)),c))}else i?(o=s!=null&&Number(s)+1===l?o:l,r.push(rs("remove",Tr(t,mo(o)))),s=l):r.push(rs("remove",Tr(t,mo(l))))}),e.forEach((a,l)=>{n.has&&!n.has(l)&&r.push(rs("add",Tr(t,mo(l)),a))}),r},Xp=(n,e,t="")=>{let r=[];if(sn(n,e)||n==e&&n==null)return r;const i=n.toSeq().toMap(),s=e.toSeq().toMap();return r=r.concat(Fl(i,s,t)),r},zv=(n,e,t="")=>{let r=[];if(sn(n,e)||n==e&&n==null)return r;if((n.count()+1)*(e.count()+1)>=1e4)return Fl(n,e,t);const i=r8(n,e);let s=0;return i.forEach(o=>{if(o.op==="=")s++;else if(o.op==="!="){if(Ma(o.val)&&Ma(o.newVal)){const a=Xp(o.val,o.newVal,Tr(t,String(s)));r=r.concat(a)}else if(Ea(o.val)&&Ea(o.newVal)){const a=Fl(o.val,o.newVal,Tr(t,String(s)));r=r.concat(a)}else r.push(rs("replace",Tr(t,String(s)),o.newVal));s++}else o.op==="+"?(r.push(rs("add",Tr(t,String(s)),o.val)),s++):o.op==="-"&&r.push(rs("remove",Tr(t,String(s))))}),r},l8=(n,e,t="")=>n===e?[]:[rs("replace",Tr(t,""),e)],c8=(n,e,t="")=>sn(n,e)?Je():n!=e&&(n==null||e==null)?Dt([rs("replace","/",e)]):ba(n)&&ba(e)?Dt(zv(n,e)):Ma(n)&&Ma(e)?Dt(Xp(n,e)):Ea(n)&&Ea(e)?Dt(Fl(n,e)):Dt(l8(n,e,t));class u8 extends se.Component{constructor(t){super(t);vt(this,"canvasWrapperRef",se.createRef());vt(this,"renderer");vt(this,"scene3D",null);vt(this,"camera",null);vt(this,"orbitControls");vt(this,"planData");vt(this,"renderingID",0);vt(this,"width");vt(this,"height");vt(this,"lastMousePosition",{});vt(this,"mouseDownEvent");vt(this,"mouseUpEvent");this.lastMousePosition={},this.width=t.width,this.height=t.height,this.renderingID=0,this.renderer=window.__threeRenderer||new g6({preserveDrawingBuffer:!0,antialias:!0}),window.__threeRenderer=this.renderer}componentDidMount(){const{state:t,actions:r}=this.props,i={areaActions:r.areaActions,holesActions:r.holesActions,itemsActions:r.itemsActions,linesActions:r.linesActions,projectActions:r.projectActions},s=t.scene,o=this.canvasWrapperRef.current,a=new dM;this.renderer.setSize(this.width,this.height),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.outputColorSpace=Er,this.renderer.physicallyCorrectLights=!0,this.renderer.setClearColor(new Ct(Hc.white));const l=C6(s,i,this.props.catalog);a.add(l.plan),a.add(l.grid);const c=this.width/this.height,h=new wr(45,c,1,3e5);a.add(h);const f=-(l.boundingBox.max.x-l.boundingBox.min.x)/2,p=(l.boundingBox.max.y-l.boundingBox.min.y)/2*10,d=(l.boundingBox.max.z-l.boundingBox.min.z)/2;h.position.set(f,p,d),h.up=new j(0,1,0);const m=new Q_(11513775);a.add(m);const x=new o4(Hc.white,.3);x.position.set(f,p,d),a.add(x);const v=new Q_(16777215,.6);a.add(v);const _=new l4(16777215,.6);_.position.set(100,200,100),_.castShadow=!0,a.add(_);const E=[l.plan],M=new Be,b=new u4;this.mouseDownEvent=O=>{this.lastMousePosition.x=O.offsetX/this.width*2-1,this.lastMousePosition.y=-O.offsetY/this.height*2+1},this.mouseUpEvent=O=>{if(O.preventDefault(),M.x=O.offsetX/this.width*2-1,M.y=-(O.offsetY/this.height)*2+1,Math.abs(M.x-(this.lastMousePosition.x??0))<=.02&&Math.abs(M.y-(this.lastMousePosition.y??0))<=.02){b.setFromCamera(M,h);const A=b.intersectObjects(E,!0);A.length>0&&!isNaN(A[0].distance)?A[0].object.interact&&A[0].object.interact():this.props.actions.projectActions.unselectAll()}},this.renderer.domElement.addEventListener("mousedown",this.mouseDownEvent),this.renderer.domElement.addEventListener("mouseup",this.mouseUpEvent),this.renderer.domElement.style.display="block",o&&o.appendChild(this.renderer.domElement);const S=new V6(h,this.renderer.domElement),T=new kt;T.name="spotLightTarget",T.position.set(S.target.x,S.target.y,S.target.z),a.add(T),x.target=T;const q=()=>{S.update(),x.position.set(h.position.x,h.position.y,h.position.z),T.position.set(S.target.x,S.target.y,S.target.z),h.updateMatrix(),h.updateMatrixWorld();for(let O in l.sceneGraph.LODs)l.sceneGraph.LODs[O].update(h);this.renderer.render(a,h),this.renderingID=requestAnimationFrame(q)};q(),this.orbitControls=S,this.camera=h,this.scene3D=a,this.planData=l}componentWillUnmount(){cancelAnimationFrame(this.renderingID),this.orbitControls.dispose(),this.renderer.domElement.removeEventListener("mousedown",this.mouseDownEvent),this.renderer.domElement.removeEventListener("mouseup",this.mouseUpEvent),this.scene3D&&(A6(this.scene3D),this.scene3D.remove(this.planData.plan),this.scene3D.remove(this.planData.grid)),this.scene3D=null,this.planData=null,this.camera=null,this.orbitControls=null,this.renderer.renderLists.dispose()}componentWillReceiveProps(t){const{width:r,height:i,actions:s}=t,o={areaActions:s.areaActions,holesActions:s.holesActions,itemsActions:s.itemsActions,linesActions:s.linesActions,projectActions:s.projectActions};if(this.width=r,this.height=i,this.camera&&(this.camera.aspect=r/i,this.camera.updateProjectionMatrix()),t.state.scene!==this.props.state.scene){const a=c8(this.props.state.scene,t.state.scene);R6(this.planData,t.state.scene,this.props.state.scene,a.toJS(),o,this.props.catalog)}this.renderer.setSize(r,i)}render(){return se.createElement("div",{ref:this.canvasWrapperRef})}}const h8={color:Ht.PRIMARY_COLOR.alt,fontWeight:300};function f8({children:n,style:e={},...t}){return C.jsx("h1",{style:{...h8,...e},...t,children:n})}const d8={padding:"0 20px",overflowY:"auto"};function p8({children:n,width:e,height:t,style:r={}}){return C.jsx("div",{style:{width:e,height:t,...d8,...r},onWheel:i=>i.stopPropagation(),children:n})}var kv={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Bv=se.createContext&&se.createContext(kv),m8=["attr","size","title"];function g8(n,e){if(n==null)return{};var t=_8(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function _8(n,e){if(n==null)return{};var t={};for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){if(e.indexOf(r)>=0)continue;t[r]=n[r]}return t}function Gu(){return Gu=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Gu.apply(this,arguments)}function Vv(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Wu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vv(Object(t),!0).forEach(function(r){v8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Vv(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function v8(n,e,t){return e=x8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function x8(n){var e=y8(n,"string");return typeof e=="symbol"?e:e+""}function y8(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Hv(n){return n&&n.map((e,t)=>se.createElement(e.tag,Wu({key:t},e.attr),Hv(e.child)))}function _n(n){return e=>se.createElement(S8,Gu({attr:Wu({},n.attr)},e),Hv(n.child))}function S8(n){var e=t=>{var{attr:r,size:i,title:s}=n,o=g8(n,m8),a=i||t.size||"1em",l;return t.className&&(l=t.className),n.className&&(l=(l?l+" ":"")+n.className),se.createElement("svg",Gu({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,r,o,{className:l,style:Wu(Wu({color:n.color||t.color},t.style),n.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&se.createElement("title",null,s),n.children)};return Bv!==void 0?se.createElement(Bv.Consumer,null,t=>e(t)):e(kv)}function E8(n){return _n({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"},child:[]}]})(n)}function b8(n){return _n({attr:{viewBox:"0 0 192 512"},child:[{tag:"path",attr:{d:"M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"},child:[]}]})(n)}function M8(n){return _n({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"},child:[]}]})(n)}function w8(n){return _n({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41z"},child:[]}]})(n)}function T8(n){return _n({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(n)}function A8(n){return _n({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304.083 405.907c4.686 4.686 4.686 12.284 0 16.971l-44.674 44.674c-59.263 59.262-155.693 59.266-214.961 0-59.264-59.265-59.264-155.696 0-214.96l44.675-44.675c4.686-4.686 12.284-4.686 16.971 0l39.598 39.598c4.686 4.686 4.686 12.284 0 16.971l-44.675 44.674c-28.072 28.073-28.072 73.75 0 101.823 28.072 28.072 73.75 28.073 101.824 0l44.674-44.674c4.686-4.686 12.284-4.686 16.971 0l39.597 39.598zm-56.568-260.216c4.686 4.686 12.284 4.686 16.971 0l44.674-44.674c28.072-28.075 73.75-28.073 101.824 0 28.072 28.073 28.072 73.75 0 101.823l-44.675 44.674c-4.686 4.686-4.686 12.284 0 16.971l39.598 39.598c4.686 4.686 12.284 4.686 16.971 0l44.675-44.675c59.265-59.265 59.265-155.695 0-214.96-59.266-59.264-155.695-59.264-214.961 0l-44.674 44.674c-4.686 4.686-4.686 12.284 0 16.971l39.597 39.598zm234.828 359.28l22.627-22.627c9.373-9.373 9.373-24.569 0-33.941L63.598 7.029c-9.373-9.373-24.569-9.373-33.941 0L7.029 29.657c-9.373 9.373-9.373 24.569 0 33.941l441.373 441.373c9.373 9.372 24.569 9.372 33.941 0z"},child:[]}]})(n)}const Gv={width:"14em",height:"14em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .15s ease-in-out",WebkitTransition:"all .15s ease-in-out",alignSelf:"center",justifySelf:"center"},C8={...Gv,background:Ht.SECONDARY_COLOR.main},Wv={width:"100%",textAlign:"center",display:"block",marginBottom:".5em",textTransform:"capitalize"},R8={...Wv,color:Ht.COLORS.white},P8={width:"100%",height:"8em",position:"relative",overflow:"hidden",border:"solid 1px #e6e6e6",padding:0,margin:0,marginBottom:"5px"},jv={position:"absolute",background:"#222",width:"100%",height:"100%",backgroundSize:"contain",backgroundPosition:"50% 50%",backgroundColor:Ht.COLORS.white,backgroundRepeat:"no-repeat",transition:"all .2s ease-in-out"},I8={...jv,transform:"scale(1.2)"},L8={marginTop:"1.5em",color:Ht.SECONDARY_COLOR.main,fontSize:"2em",opacity:"0.7",width:"100%"},O8={display:"block",height:"2em",margin:"0 auto",fontSize:"0.75em",fontStyle:"italic",lineHeight:"1em",WebkitLineClamp:"2",WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"},q8={listStyle:"none",margin:"0px",padding:"0px",fontSize:"11px",marginBottom:"3px"},D8={display:"inline-block",background:"#337ab7",color:Ht.COLORS.white,padding:"1px 4px",marginRight:"3px",borderRadius:"3px"},Xv=({element:n})=>{const[e,t]=se.useState(!1),{selectToolDrawingLine:r,selectToolDrawingItem:i,selectToolDrawingHole:s,pushLastSelectedCatalogElementToHistory:o}=en(),a=()=>{switch(n.prototype){case"lines":r(n.name);break;case"items":i(n.name);break;case"holes":s(n.name);break}o(n)};return C.jsxs("div",{style:e?C8:Gv,onClick:a,onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),children:[C.jsx("b",{style:e?R8:Wv,children:n.info.title}),C.jsx("div",{style:P8,children:C.jsx("div",{style:{...e?I8:jv,backgroundImage:"url("+n.info.image+")"},children:e?C.jsx(M8,{style:L8}):null})}),C.jsx("ul",{style:q8,children:n.info.tag.map((l,c)=>C.jsx("li",{style:D8,children:l},c))}),C.jsx("div",{style:O8,children:n.info.description})]})};function N8(n){return _n({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3v7.12zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8h1.5z"},child:[]}]})(n)}function U8(n){return _n({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"},child:[]}]})(n)}function F8(n){return _n({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"},child:[]}]})(n)}function z8(n){return _n({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 0 1 7.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"},child:[]}]})(n)}function k8(n){return _n({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"},child:[]}]})(n)}function B8(n){return _n({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"},child:[]}]})(n)}function $v(n){return _n({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"},child:[]}]})(n)}function V8(n){return _n({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 8h-6V5h6v6zm-8-6v6H5V5h6zm-6 8h6v6H5v-6zm8 6v-6h6v6h-6z"},child:[]}]})(n)}const H8={margin:"1.5em",display:"flex"},Yv={fontSize:"20px",cursor:"pointer"},G8={...Yv,fontWeight:"bolder",color:Ht.SECONDARY_COLOR.main},W8={fill:Ht.COLORS.black,fontSize:"24px",marginLeft:"10px",marginRight:"10px"},j8=({names:n})=>{let e=n.map((t,r)=>{let i=r===n.length-1;return C.jsxs("div",{style:{display:"flex"},children:[C.jsx("div",{style:i?G8:Yv,onClick:t.action||null,children:t.name}),i?null:C.jsx($v,{style:W8})]},r)});return C.jsx("div",{style:H8,children:e})},Kv={width:"14em",height:"14em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",margin:"0.3em",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .2s ease-in-out",WebkitTransition:"all .2s ease-in-out"},X8={...Kv,background:Ht.SECONDARY_COLOR.main},Zv={position:"absolute",color:Ht.COLORS.black,fontSize:"5em",width:"100%"},$8={...Zv,color:Ht.SECONDARY_COLOR.main},Y8={background:Ht.COLORS.white,marginBottom:"5px",border:"solid 1px #e6e6e6",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},K8=({page:n})=>{const[e,t]=se.useState(!1),{goBackToCatalogPage:r}=en(),i=s=>{r(s)};return C.jsx("div",{style:e?X8:Kv,onClick:()=>i(n.name),onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),children:C.jsx("div",{style:Y8,children:C.jsx(B8,{style:e?$8:Zv})})})},Z8={position:"fixed",width:"calc( 100% - 51px)",height:"calc( 100% - 20px)",backgroundColor:"#FFF",padding:"1em",left:50,overflowY:"auto",overflowX:"hidden",zIndex:10},J8={display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(14em, 1fr))",gridGap:"10px",marginTop:"1em"},Jv={width:"100%",height:"3em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .2s ease-in-out",WebkitTransition:"all .2s ease-in-out",marginBottom:"1em"},Q8={width:"8em",display:"inline-block"},eA={width:"calc( 100% - 10em )",height:"2em",margin:"0",padding:"0 1em",border:"1px solid #EEE"},tA={...Jv,padding:"0.2em 0.625em"},nA={width:"auto",height:"2em",lineHeight:"2em",textAlign:"center",borderRadius:"1em",display:"inline-block",cursor:"pointer",backgroundColor:Ht.PRIMARY_COLOR.alt,color:Ht.PRIMARY_COLOR.text_main,textTransform:"capitalize",margin:"0.25em",padding:"0 1em"},rA=({width:n,height:e,style:t,catalog:r})=>{const{planner:i,goBackToCatalogPage:s,selectToolDrawingHole:o,selectToolDrawingItem:a,selectToolDrawingLine:l,pushLastSelectedCatalogElementToHistory:c}=en();let h=i.catalog.page;const f=r.getCategory(h);let p=f.elements.filter(A=>A.info.visibility?A.info.visibility.catalog:!0);const[d,m]=se.useState(""),[x,v]=se.useState([]);let _=null;if(h!=="root"){let A=[];i.catalog.path.forEach(L=>{A.push({name:r.getCategory(L).label,action:()=>s(L)})}),A.push({name:f.label,action:""}),_=C.jsx(j8,{names:A})}let E=i.catalog.path.size,M=E>0?C.jsx(K8,{page:r.categories[i.catalog.path.get(E-1)]},E):null,b=i.get("selectedElementsHistory"),S=b.map((A,L)=>C.jsx("div",{style:nA,title:A.name,onClick:()=>O(A),children:A.name},L));const T=A=>{let L=[];for(let N=0;N<A.length;N++){let Z=A[N];L=L.concat(Z.elements),Z.categories.length&&(L=L.concat(T(Z.categories)))}return L},q=A=>{let L=p.concat(T(f.categories)),N=[];if(A!=""){let Z=new RegExp(A,"i");for(let Y=0;Y<L.length;Y++)Z.test(L[Y].info.title)&&N.push(L[Y])}m(A),v(N)},O=A=>{switch(A.prototype){case"lines":l(A.name);break;case"items":a(A.name);break;case"holes":o(A.name);break}c(A)};return C.jsxs(p8,{width:n,height:e,style:{...Z8,...t},children:[C.jsx(f8,{children:"Catalog"}),_,C.jsxs("div",{style:Jv,children:[C.jsx("span",{style:Q8,children:"Search Element"}),C.jsx("input",{type:"text",style:eA,onChange:A=>{q(A.target.value)}})]}),b.size?C.jsxs("div",{style:tA,children:[C.jsx("span",{children:"Last Selected"}),S]}):null,C.jsx("div",{style:J8,children:d===""?[M,p.map(A=>C.jsx(Xv,{element:A},A.name))]:x.map(A=>C.jsx(Xv,{element:A},A.name))})]})},iA={MODE_IDLE:fn,MODE_2D_ZOOM_IN:Hs,MODE_2D_ZOOM_OUT:Gs,MODE_2D_PAN:Ws,MODE_WAITING_DRAWING_LINE:jr,MODE_DRAGGING_LINE:Xr,MODE_DRAGGING_VERTEX:$r,MODE_DRAGGING_ITEM:Yr,MODE_DRAWING_LINE:_r,MODE_DRAWING_HOLE:vr,MODE_DRAWING_ITEM:Dr,MODE_DRAGGING_HOLE:Kr,MODE_ROTATING_ITEM:Vi};function sA({width:n,height:e,catalog:t}){const r=en(),{planner:i}=r,{mode:s}=i;return s===Bi?C.jsx(u8,{width:n,height:e,state:i,catalog:t,actions:{areaActions:{selectArea:r.selectArea},holesActions:{selectHole:r.selectHole,selectToolDrawingHole:r.selectToolDrawingHole,updateDrawingHole:r.updateDrawingHole,endDrawingHole:r.endDrawingHole,beginDraggingHole:r.beginDraggingHole,updateDraggingHole:r.updateDraggingHole,endDraggingHole:r.endDraggingHole},itemsActions:{selectItem:r.selectItem,selectToolDrawingItem:r.selectToolDrawingItem,updateDrawingItem:r.updateDrawingItem,endDrawingItem:r.endDrawingItem,beginDraggingItem:r.beginDraggingItem,updateDraggingItem:r.updateDraggingItem,endDraggingItem:r.endDraggingItem,beginRotatingItem:r.beginRotatingItem,updateRotatingItem:r.updateRotatingItem,endRotatingItem:r.endRotatingItem},linesActions:{selectLine:r.selectLine,selectToolDrawingLine:r.selectToolDrawingLine,beginDrawingLine:r.beginDrawingLine,updateDrawingLine:r.updateDrawingLine,endDrawingLine:r.endDrawingLine,beginDraggingLine:r.beginDraggingLine,updateDraggingLine:r.updateDraggingLine,endDraggingLine:r.endDraggingLine},projectActions:{loadProject:r.loadProject,newProject:r.newProject,openCatalog:r.openCatalog,changeCatalogPage:r.changeCatalogPage,goBackToCatalogPage:r.goBackToCatalogPage,selectToolEdit:r.selectToolEdit,unselectAll:r.unselectAll,setProperties:r.setProperties,setItemsAttributes:r.setItemsAttributes,setLinesAttributes:r.setLinesAttributes,setHolesAttributes:r.setHolesAttributes,remove:r.remove,undo:r.undo,rollback:r.rollback,openProjectConfigurator:r.openProjectConfigurator,initCatalog:r.initCatalog,updateMouseCoord:r.updateMouseCoord,updateZoomScale:r.updateZoomScale,toggleSnap:r.toggleSnap,copyProperties:r.copyProperties,pasteProperties:r.pasteProperties,pushLastSelectedCatalogElementToHistory:r.pushLastSelectedCatalogElementToHistory,setAlterateState:r.setAlterateState,setMode:r.setMode,addHorizontalGuide:r.addHorizontalGuide,addVerticalGuide:r.addVerticalGuide,removeHorizontalGuide:r.removeHorizontalGuide,removeVerticalGuide:r.removeVerticalGuide}}}):s===qo?C.jsx(C.Fragment,{}):s===sf?C.jsx(rA,{width:n,height:e,catalog:t}):iA[s]?C.jsx(ZE,{width:n,height:e,catalog:t}):s===X0?C.jsx(C.Fragment,{}):null}function Qv(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=Qv(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function oA(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=Qv(n))&&(r&&(r+=" "),r+=e);return r}const $p="-",aA=n=>{const e=cA(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:o=>{const a=o.split($p);return a[0]===""&&a.length!==1&&a.shift(),ex(a,e)||lA(o)},getConflictingClassGroupIds:(o,a)=>{const l=t[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},ex=(n,e)=>{var o;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?ex(n.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=n.join($p);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},tx=/^\[(.+)\]$/,lA=n=>{if(tx.test(n)){const e=tx.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},cA=n=>{const{theme:e,classGroups:t}=n,r={nextPart:new Map,validators:[]};for(const i in t)Yp(t[i],r,i,e);return r},Yp=(n,e,t,r)=>{n.forEach(i=>{if(typeof i=="string"){const s=i===""?e:nx(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(uA(i)){Yp(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{Yp(o,nx(e,s),t,r)})})},nx=(n,e)=>{let t=n;return e.split($p).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},uA=n=>n.isThemeGetter,hA=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const i=(s,o)=>{t.set(s,o),e++,e>n&&(e=0,r=t,t=new Map)};return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){t.has(s)?t.set(s,o):i(s,o)}}},Kp="!",Zp=":",fA=Zp.length,dA=n=>{const{prefix:e,experimentalParseClassName:t}=n;let r=i=>{const s=[];let o=0,a=0,l=0,c;for(let m=0;m<i.length;m++){let x=i[m];if(o===0&&a===0){if(x===Zp){s.push(i.slice(l,m)),l=m+fA;continue}if(x==="/"){c=m;continue}}x==="["?o++:x==="]"?o--:x==="("?a++:x===")"&&a--}const h=s.length===0?i:i.substring(l),f=pA(h),p=f!==h,d=c&&c>l?c-l:void 0;return{modifiers:s,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:d}};if(e){const i=e+Zp,s=r;r=o=>o.startsWith(i)?s(o.substring(i.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(t){const i=r;r=s=>t({className:s,parseClassName:i})}return r},pA=n=>n.endsWith(Kp)?n.substring(0,n.length-1):n.startsWith(Kp)?n.substring(1):n,mA=n=>{const e=Object.fromEntries(n.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const i=[];let s=[];return r.forEach(o=>{o[0]==="["||e[o]?(i.push(...s.sort(),o),s=[]):s.push(o)}),i.push(...s.sort()),i}},gA=n=>({cache:hA(n.cacheSize),parseClassName:dA(n),sortModifiers:mA(n),...aA(n)}),_A=/\s+/,vA=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=n.trim().split(_A);let l="";for(let c=a.length-1;c>=0;c-=1){const h=a[c],{isExternal:f,modifiers:p,hasImportantModifier:d,baseClassName:m,maybePostfixModifierPosition:x}=t(h);if(f){l=h+(l.length>0?" "+l:l);continue}let v=!!x,_=r(v?m.substring(0,x):m);if(!_){if(!v){l=h+(l.length>0?" "+l:l);continue}if(_=r(m),!_){l=h+(l.length>0?" "+l:l);continue}v=!1}const E=s(p).join(":"),M=d?E+Kp:E,b=M+_;if(o.includes(b))continue;o.push(b);const S=i(_,v);for(let T=0;T<S.length;++T){const q=S[T];o.push(M+q)}l=h+(l.length>0?" "+l:l)}return l};function xA(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=rx(e))&&(r&&(r+=" "),r+=t);return r}const rx=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=rx(n[r]))&&(t&&(t+=" "),t+=e);return t};function yA(n,...e){let t,r,i,s=o;function o(l){const c=e.reduce((h,f)=>f(h),n());return t=gA(c),r=t.cache.get,i=t.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const h=vA(l,t);return i(l,h),h}return function(){return s(xA.apply(null,arguments))}}const Pn=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},ix=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,sx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,SA=/^\d+\/\d+$/,EA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bA=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,MA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wa=n=>SA.test(n),Mt=n=>!!n&&!Number.isNaN(Number(n)),Is=n=>!!n&&Number.isInteger(Number(n)),Jp=n=>n.endsWith("%")&&Mt(n.slice(0,-1)),is=n=>EA.test(n),AA=()=>!0,CA=n=>bA.test(n)&&!MA.test(n),ox=()=>!1,RA=n=>wA.test(n),PA=n=>TA.test(n),IA=n=>!it(n)&&!st(n),LA=n=>Ta(n,hx,ox),it=n=>ix.test(n),go=n=>Ta(n,fx,CA),Qp=n=>Ta(n,UA,Mt),ax=n=>Ta(n,cx,ox),OA=n=>Ta(n,ux,PA),ju=n=>Ta(n,dx,RA),st=n=>sx.test(n),zl=n=>Aa(n,fx),qA=n=>Aa(n,FA),lx=n=>Aa(n,cx),DA=n=>Aa(n,hx),NA=n=>Aa(n,ux),Xu=n=>Aa(n,dx,!0),Ta=(n,e,t)=>{const r=ix.exec(n);return r?r[1]?e(r[1]):t(r[2]):!1},Aa=(n,e,t=!1)=>{const r=sx.exec(n);return r?r[1]?e(r[1]):t:!1},cx=n=>n==="position"||n==="percentage",ux=n=>n==="image"||n==="url",hx=n=>n==="length"||n==="size"||n==="bg-size",fx=n=>n==="length",UA=n=>n==="number",FA=n=>n==="family-name",dx=n=>n==="shadow",zA=yA(()=>{const n=Pn("color"),e=Pn("font"),t=Pn("text"),r=Pn("font-weight"),i=Pn("tracking"),s=Pn("leading"),o=Pn("breakpoint"),a=Pn("container"),l=Pn("spacing"),c=Pn("radius"),h=Pn("shadow"),f=Pn("inset-shadow"),p=Pn("text-shadow"),d=Pn("drop-shadow"),m=Pn("blur"),x=Pn("perspective"),v=Pn("aspect"),_=Pn("ease"),E=Pn("animate"),M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...b(),st,it],T=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto","contain","none"],O=()=>[st,it,l],A=()=>[wa,"full","auto",...O()],L=()=>[Is,"none","subgrid",st,it],N=()=>["auto",{span:["full",Is,st,it]},Is,st,it],Z=()=>[Is,"auto",st,it],Y=()=>["auto","min","max","fr",st,it],ee=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ue=()=>["start","end","center","stretch","center-safe","end-safe"],te=()=>["auto",...O()],ae=()=>[wa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],B=()=>[n,st,it],Se=()=>[...b(),lx,ax,{position:[st,it]}],$=()=>["no-repeat",{repeat:["","x","y","space","round"]}],oe=()=>["auto","cover","contain",DA,LA,{size:[st,it]}],Ae=()=>[Jp,zl,go],Ie=()=>["","none","full",c,st,it],Ce=()=>["",Mt,zl,go],V=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[Mt,Jp,lx,ax],pe=()=>["","none",m,st,it],Ee=()=>["none",Mt,st,it],Q=()=>["none",Mt,st,it],Ne=()=>[Mt,st,it],le=()=>[wa,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[is],breakpoint:[is],color:[AA],container:[is],"drop-shadow":[is],ease:["in","out","in-out"],font:[IA],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[is],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[is],shadow:[is],spacing:["px",Mt],text:[is],"text-shadow":[is],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wa,it,st,v]}],container:["container"],columns:[{columns:[Mt,it,st,a]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:q()}],"overscroll-x":[{"overscroll-x":q()}],"overscroll-y":[{"overscroll-y":q()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Is,"auto",st,it]}],basis:[{basis:[wa,"full","auto",a,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Mt,wa,"auto","initial","none",it]}],grow:[{grow:["",Mt,st,it]}],shrink:[{shrink:["",Mt,st,it]}],order:[{order:[Is,"first","last","none",st,it]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:N()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:N()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Y()}],"auto-rows":[{"auto-rows":Y()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...ee(),"normal"]}],"justify-items":[{"justify-items":[...ue(),"normal"]}],"justify-self":[{"justify-self":["auto",...ue()]}],"align-content":[{content:["normal",...ee()]}],"align-items":[{items:[...ue(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ue(),{baseline:["","last"]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...ue(),"baseline"]}],"place-self":[{"place-self":["auto",...ue()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:te()}],mx:[{mx:te()}],my:[{my:te()}],ms:[{ms:te()}],me:[{me:te()}],mt:[{mt:te()}],mr:[{mr:te()}],mb:[{mb:te()}],ml:[{ml:te()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],w:[{w:[a,"screen",...ae()]}],"min-w":[{"min-w":[a,"screen","none",...ae()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",t,zl,go]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,st,Qp]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Jp,it]}],"font-family":[{font:[qA,it,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,st,it]}],"line-clamp":[{"line-clamp":[Mt,"none",st,Qp]}],leading:[{leading:[s,...O()]}],"list-image":[{"list-image":["none",st,it]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",st,it]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[Mt,"from-font","auto",st,go]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[Mt,"auto",st,it]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",st,it]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",st,it]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Se()}],"bg-repeat":[{bg:$()}],"bg-size":[{bg:oe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Is,st,it],radial:["",st,it],conic:[Is,st,it]},NA,OA]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:Ae()}],"gradient-via-pos":[{via:Ae()}],"gradient-to-pos":[{to:Ae()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:Ie()}],"rounded-s":[{"rounded-s":Ie()}],"rounded-e":[{"rounded-e":Ie()}],"rounded-t":[{"rounded-t":Ie()}],"rounded-r":[{"rounded-r":Ie()}],"rounded-b":[{"rounded-b":Ie()}],"rounded-l":[{"rounded-l":Ie()}],"rounded-ss":[{"rounded-ss":Ie()}],"rounded-se":[{"rounded-se":Ie()}],"rounded-ee":[{"rounded-ee":Ie()}],"rounded-es":[{"rounded-es":Ie()}],"rounded-tl":[{"rounded-tl":Ie()}],"rounded-tr":[{"rounded-tr":Ie()}],"rounded-br":[{"rounded-br":Ie()}],"rounded-bl":[{"rounded-bl":Ie()}],"border-w":[{border:Ce()}],"border-w-x":[{"border-x":Ce()}],"border-w-y":[{"border-y":Ce()}],"border-w-s":[{"border-s":Ce()}],"border-w-e":[{"border-e":Ce()}],"border-w-t":[{"border-t":Ce()}],"border-w-r":[{"border-r":Ce()}],"border-w-b":[{"border-b":Ce()}],"border-w-l":[{"border-l":Ce()}],"divide-x":[{"divide-x":Ce()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Ce()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Mt,st,it]}],"outline-w":[{outline:["",Mt,zl,go]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",h,Xu,ju]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",f,Xu,ju]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:Ce()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[Mt,go]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":Ce()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",p,Xu,ju]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[Mt,st,it]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Mt]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[st,it]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Mt]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Se()}],"mask-repeat":[{mask:$()}],"mask-size":[{mask:oe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",st,it]}],filter:[{filter:["","none",st,it]}],blur:[{blur:pe()}],brightness:[{brightness:[Mt,st,it]}],contrast:[{contrast:[Mt,st,it]}],"drop-shadow":[{"drop-shadow":["","none",d,Xu,ju]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",Mt,st,it]}],"hue-rotate":[{"hue-rotate":[Mt,st,it]}],invert:[{invert:["",Mt,st,it]}],saturate:[{saturate:[Mt,st,it]}],sepia:[{sepia:["",Mt,st,it]}],"backdrop-filter":[{"backdrop-filter":["","none",st,it]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[Mt,st,it]}],"backdrop-contrast":[{"backdrop-contrast":[Mt,st,it]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Mt,st,it]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Mt,st,it]}],"backdrop-invert":[{"backdrop-invert":["",Mt,st,it]}],"backdrop-opacity":[{"backdrop-opacity":[Mt,st,it]}],"backdrop-saturate":[{"backdrop-saturate":[Mt,st,it]}],"backdrop-sepia":[{"backdrop-sepia":["",Mt,st,it]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",st,it]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Mt,"initial",st,it]}],ease:[{ease:["linear","initial",_,st,it]}],delay:[{delay:[Mt,st,it]}],animate:[{animate:["none",E,st,it]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,st,it]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:Q()}],"scale-x":[{"scale-x":Q()}],"scale-y":[{"scale-y":Q()}],"scale-z":[{"scale-z":Q()}],"scale-3d":["scale-3d"],skew:[{skew:Ne()}],"skew-x":[{"skew-x":Ne()}],"skew-y":[{"skew-y":Ne()}],transform:[{transform:[st,it,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",st,it]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",st,it]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[Mt,zl,go,Qp]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function ci(...n){return zA(oA(n))}const kl=({text:n,title:e,toggleState:t,toggleOn:r,toggleOff:i})=>{const[s,o]=se.useState(!1),[a,l]=se.useState(t||!1),c=()=>{l(!a),a?i():r()};return C.jsx("div",{className:ci("w-[5.5em] text-center cursor-pointer select-none rounded-sm - mt-px mr-[5px] mb-0 ml-[5px] inline-block",s||a?"bg-[#5e5e5e] text-white border border-[#FFFFFF]":"text-[#CCCCCC] border border-[transparent]"),onMouseOver:()=>o(!0),onMouseOut:()=>o(!1),onClick:c,title:e,children:n})},px=({title:n,icon:e,textStyle:t,text:r,titleStyle:i,content:s})=>{const[o,a]=se.useState(!1),[l,c]=se.useState(!1);return C.jsxs("div",{className:"w-auto inline-block m-0 pr-1.5",children:[C.jsxs("div",{className:ci("flex items-center cursor-pointer text-center select-none",o?"text-white":"text-[#CCCCCC]"),onClick:()=>a(!o),title:n,children:[e&&e(),C.jsx("span",{className:"relative",style:t,children:r})]}),C.jsxs("div",{className:ci("fixed left-0 w-[calc(100%_-_2px)] transition-all duration-300 ease-in-out z-0 bottom-5 p-0 m-0 bg-[#2E2F33] border-t border-t-[#555]",o?"h-[40%]":"invisible h-0"),children:[C.jsxs("div",{className:"relative w-full h-[2em] top-0 left-0 border-b border-b-[#555]",children:[C.jsx("b",{className:"relative h-[2em] ml-[1em] leading-[2em]",style:i,children:n}),C.jsx(T8,{className:ci("absolute w-[2em] h-[2em] right-0 top-0 cursor-pointer p-2 border-l border-l-[#555]",l?"text-white bg-[#005FAF]":""),onMouseOver:()=>c(!0),onMouseOut:()=>c(!1),onClick:()=>a(!o)})]}),C.jsx("div",{className:"relative w-full p-[1em] overflow-y-auto h-[calc(100%_-_2em)]",children:s})]})]})};function kA(n){return _n({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM13.5 10.5h-6"},child:[]}]})(n)}function BA(n){return _n({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM10.5 7.5v6m3-3h-6"},child:[]}]})(n)}function VA(n,e,t,r,i){return r+(i-r)*(n-e)/(t-e)}const HA=()=>{const{planner:n,toggleSnap:e,viewer:t}=en(),{mode:r,mouse:i,zoom:s,snapMask:o}=n,a=n.get("warnings").toArray(),l=n.get("errors").toArray(),c=f=>e(o.merge(f)),h=f=>{const p=parseInt(F1(s).toFixed());if(p===0&&f==="out"||p===100&&f==="in"||!t)return;const d=t==null?void 0:t.getValue(),m=d.viewerWidth/2,x=d.viewerHeight/2,v=f==="in"?-1:1,_=1.06,E=Math.max(-1,Math.min(1,v)),M=VA(E,-1,1,_,1/_);t.zoom(m,x,M)};return C.jsxs("div",{className:"floor_planner-footerbar absolute z-[9001] py-[3px] px-[1em] text-xs bg-[#424242] h-5 w-full select-none cursor-default bottom-0 leading-[14px] text-white m-0",children:[of.includes(r)&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"relative float-left px-[1em] inline-block border-r border-r-white",title:"Scene Zoom Level",children:C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{children:"Zoom:"})," ",C.jsx(kA,{className:"inline-block cursor-pointer",size:16,onClick:()=>h("out")})," ",C.jsxs("span",{children:[F1(s).toFixed(),"%"]})," ",C.jsx(BA,{className:"inline-block cursor-pointer",size:16,onClick:()=>h("in")})]})}),C.jsxs("div",{className:"relative float-left px-[1em] inline-block border-r border-r-white",children:[C.jsx(kl,{toggleOn:()=>{c({SNAP_POINT:!0})},toggleOff:()=>{c({SNAP_POINT:!1})},text:"Snap PT",toggleState:o.get(uf),title:"Snap to Point"}),C.jsx(kl,{toggleOn:()=>{c({SNAP_LINE:!0})},toggleOff:()=>{c({SNAP_LINE:!1})},text:"Snap LN",toggleState:o.get(hf),title:"Snap to Line"}),C.jsx(kl,{toggleOn:()=>{c({SNAP_SEGMENT:!0})},toggleOff:()=>{c({SNAP_SEGMENT:!1})},text:"Snap SEG",toggleState:o.get(ff),title:"Snap to Segment"}),C.jsx(kl,{toggleOn:()=>{c({SNAP_GRID:!0})},toggleOff:()=>{c({SNAP_GRID:!1})},text:"Snap GRD",toggleState:o.get(df),title:"Snap to Grid"}),C.jsx(kl,{toggleOn:()=>{c({SNAP_GUIDE:!0})},toggleOff:()=>{c({SNAP_GUIDE:!1})},text:"Snap GDE",toggleState:o.get(Z0),title:"Snap to Guide"})]})]}),C.jsxs("div",{className:"relative float-right inline-block px-[1em] border-l border-l-white",children:[C.jsx(px,{icon:()=>C.jsx(F8,{style:{width:"15px",height:"15px",marginTop:"-2px",marginRight:"2px",...l.length?{transform:"rotate(45deg)",color:"#F44336"}:{transform:"rotate(45deg)"}}}),text:l.length.toString(),textStyle:l.length?{color:"#F44336"}:{},title:`Errors [ ${l.length} ]`,titleStyle:l.length?{color:"#F44336"}:{},content:C.jsx(C.Fragment,{children:l.map((f,p)=>C.jsxs("div",{style:{borderBottom:"1px solid #555",lineHeight:"1.5em"},children:["[ ",new Date(f.date).toLocaleString()," ] ",f.error]},p))})}),C.jsx(px,{icon:()=>C.jsx(U8,{style:{width:"15px",height:"15px",marginTop:"-2px",marginRight:"2px",...a.length?{color:"#FFEB3B"}:{}}}),text:a.length.toString(),textStyle:a.length?{color:"#FFEB3B"}:{},title:`Warnings [ ${a.length} ]`,titleStyle:a.length?{color:"#FFEB3B"}:{},content:C.jsx(C.Fragment,{children:a.map((f,p)=>C.jsxs("div",{className:"leading-6 border-b border-b-[#555555]",children:["[ ",new Date(f.date).toLocaleString()," ] ",f.warning]},p))})})]})]})},mx=({children:n,name:e,...t})=>{const[r,i]=se.useState(t.opened||!1);return C.jsxs("div",{className:"select-none",style:{borderBottom:"1px solid #5e5e5e"},children:[C.jsxs("div",{className:"flex px-4 pt-2.5 pb-3 items-center gap-1 bg-[#2b2b2b] text-white cursor-pointer",onClick:()=>i(!r),children:[r?C.jsx(E8,{size:16}):C.jsx(b8,{size:16}),C.jsx("span",{className:"text-sm leading-none",children:e})]}),C.jsx("div",{className:ci("text-[11px] text-[#EBEBEB] border border-[#222222] bg-[#424242]",r?"block":"hidden"),children:n})]})};function ui({children:n,style:e,className:t,...r}){return C.jsx("label",{className:ci("mb-1 text-xs capitalize font-bold text-white block",t),style:e,...r,children:n})}const ss=({value:n,min:e,max:t,precision:r,onChange:i,onValid:s,onInvalid:o,style:a,placeholder:l})=>{const[c,h]=se.useState(!0),[f,p]=se.useState(n);let d=new RegExp(`^-?([0-9]+)?\\.?([0-9]{0,${r}})?$`);se.useEffect(()=>{e!==void 0&&!isNaN(e)&&isFinite(e)&&Number(f)<e&&p(e),t&&!isNaN(t)&&isFinite(t)&&Number(f)>t&&p(t)},[e,t,f]);const m=se.useMemo(()=>parseFloat(String(n)).toFixed(r)!==parseFloat(String(f)).toFixed(r),[n,f,r]),x=v=>{if(v.stopPropagation(),c){let _=f!==""&&f!=="-"?parseFloat(String(f)):0;p(_),i({target:{value:_}})}};return C.jsxs("div",{className:"relative w-full",children:[C.jsx("input",{type:"text",value:d.test(String(f))?f:parseFloat(String(f)).toFixed(r),className:"block text-[13px] text-white h-[35px] w-full px-2 leading-5 rounded border border-[#5e5e5e] bg-[#2b2b2b] outline-none focus:outline-none",style:{...a},onChange:v=>{let _=d.test(v.target.value);_?(p(v.target.value),s&&s(v.nativeEvent)):o&&o(v.nativeEvent),h(_)},onKeyDown:v=>{var _=v.keyCode||v.which;(_==Nr.ENTER||_==Nr.TAB)&&m&&x(v)},placeholder:l}),C.jsx("div",{onClick:v=>{m&&x(v)},title:"Confirm",className:"absolute cursor-pointer w-[2em] h-[2em] text-white top-[0.35em] right-[0.35em] bg-[#1CA6FC]",style:{transition:"all 0.1s linear",visibility:m?"visible":"hidden",opacity:m?"1":"0"},children:C.jsx(N8,{style:{width:"100%",height:"100%",padding:"0.2em",color:"#FFF"}})})]})},GA={mm:{name:{singular:"Millimeter",plural:"Millimeters"},to_anchor:1/1e3},cm:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/100},m:{name:{singular:"Meter",plural:"Meters"},to_anchor:1},km:{name:{singular:"Kilometer",plural:"Kilometers"},to_anchor:1e3}},WA={in:{name:{singular:"Inch",plural:"Inches"},to_anchor:1/12},yd:{name:{singular:"Yard",plural:"Yards"},to_anchor:3},"ft-us":{name:{singular:"US Survey Foot",plural:"US Survey Feet"},to_anchor:1.000002},ft:{name:{singular:"Foot",plural:"Feet"},to_anchor:1},mi:{name:{singular:"Mile",plural:"Miles"},to_anchor:5280}},jA={metric:GA,imperial:WA,_anchors:{metric:{unit:"m",ratio:3.28084},imperial:{unit:"ft",ratio:1/3.28084}}},XA={mm2:{name:{singular:"Square Millimeter",plural:"Square Millimeters"},to_anchor:1/1e6},cm2:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/1e4},m2:{name:{singular:"Square Meter",plural:"Square Meters"},to_anchor:1},ha:{name:{singular:"Hectare",plural:"Hectares"},to_anchor:1e4},km2:{name:{singular:"Square Kilometer",plural:"Square Kilometers"},to_anchor:1e6}},$A={in2:{name:{singular:"Square Inch",plural:"Square Inches"},to_anchor:1/144},yd2:{name:{singular:"Square Yard",plural:"Square Yards"},to_anchor:9},ft2:{name:{singular:"Square Foot",plural:"Square Feet"},to_anchor:1},ac:{name:{singular:"Acre",plural:"Acres"},to_anchor:43560},mi2:{name:{singular:"Square Mile",plural:"Square Miles"},to_anchor:27878400}},YA={metric:XA,imperial:$A,_anchors:{metric:{unit:"m2",ratio:10.7639},imperial:{unit:"ft2",ratio:1/10.7639}}},KA={mcg:{name:{singular:"Microgram",plural:"Micrograms"},to_anchor:1/1e6},mg:{name:{singular:"Milligram",plural:"Milligrams"},to_anchor:1/1e3},g:{name:{singular:"Gram",plural:"Grams"},to_anchor:1},kg:{name:{singular:"Kilogram",plural:"Kilograms"},to_anchor:1e3},mt:{name:{singular:"Metric Tonne",plural:"Metric Tonnes"},to_anchor:1e6}},ZA={oz:{name:{singular:"Ounce",plural:"Ounces"},to_anchor:1/16},lb:{name:{singular:"Pound",plural:"Pounds"},to_anchor:1},t:{name:{singular:"Ton",plural:"Tons"},to_anchor:2e3}},JA={metric:KA,imperial:ZA,_anchors:{metric:{unit:"g",ratio:1/453.592},imperial:{unit:"lb",ratio:453.592}}},QA={mm3:{name:{singular:"Cubic Millimeter",plural:"Cubic Millimeters"},to_anchor:1/1e6},cm3:{name:{singular:"Cubic Centimeter",plural:"Cubic Centimeters"},to_anchor:1/1e3},ml:{name:{singular:"Millilitre",plural:"Millilitres"},to_anchor:1/1e3},cl:{name:{singular:"Centilitre",plural:"Centilitres"},to_anchor:1/100},dl:{name:{singular:"Decilitre",plural:"Decilitres"},to_anchor:1/10},l:{name:{singular:"Litre",plural:"Litres"},to_anchor:1},kl:{name:{singular:"Kilolitre",plural:"Kilolitres"},to_anchor:1e3},m3:{name:{singular:"Cubic meter",plural:"Cubic meters"},to_anchor:1e3},km3:{name:{singular:"Cubic kilometer",plural:"Cubic kilometers"},to_anchor:1e12},krm:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:1/1e3},tsk:{name:{singular:"Tesked",plural:"Teskedar"},to_anchor:5/1e3},msk:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:15/1e3},kkp:{name:{singular:"Kaffekopp",plural:"Kaffekoppar"},to_anchor:150/1e3},glas:{name:{singular:"Glas",plural:"Glas"},to_anchor:200/1e3},kanna:{name:{singular:"Kanna",plural:"Kannor"},to_anchor:2.617}},e7={tsp:{name:{singular:"Teaspoon",plural:"Teaspoons"},to_anchor:1/6},Tbs:{name:{singular:"Tablespoon",plural:"Tablespoons"},to_anchor:1/2},in3:{name:{singular:"Cubic inch",plural:"Cubic inches"},to_anchor:.55411},"fl-oz":{name:{singular:"Fluid Ounce",plural:"Fluid Ounces"},to_anchor:1},cup:{name:{singular:"Cup",plural:"Cups"},to_anchor:8},pnt:{name:{singular:"Pint",plural:"Pints"},to_anchor:16},qt:{name:{singular:"Quart",plural:"Quarts"},to_anchor:32},gal:{name:{singular:"Gallon",plural:"Gallons"},to_anchor:128},ft3:{name:{singular:"Cubic foot",plural:"Cubic feet"},to_anchor:957.506},yd3:{name:{singular:"Cubic yard",plural:"Cubic yards"},to_anchor:25852.7}},t7={metric:QA,imperial:e7,_anchors:{metric:{unit:"l",ratio:33.8140226},imperial:{unit:"fl-oz",ratio:1/33.8140226}}},n7={metric:{ea:{name:{singular:"Each",plural:"Each"},to_anchor:1},dz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12}},imperial:{},_anchors:{metric:{unit:"ea",ratio:1}}},r7={metric:{C:{name:{singular:"degree Celsius",plural:"degrees Celsius"},to_anchor:1,anchor_shift:0},K:{name:{singular:"degree Kelvin",plural:"degrees Kelvin"},to_anchor:1,anchor_shift:273.15}},imperial:{F:{name:{singular:"degree Fahrenheit",plural:"degrees Fahrenheit"},to_anchor:1},R:{name:{singular:"degree Rankine",plural:"degrees Rankine"},to_anchor:1,anchor_shift:459.67}},_anchors:{metric:{unit:"C",transform:function(n){return n/(5/9)+32}},imperial:{unit:"F",transform:function(n){return(n-32)*(5/9)}}}},gx=365.25,i7={metric:{ns:{name:{singular:"Nanosecond",plural:"Nanoseconds"},to_anchor:1/1e9},mu:{name:{singular:"Microsecond",plural:"Microseconds"},to_anchor:1/1e6},ms:{name:{singular:"Millisecond",plural:"Milliseconds"},to_anchor:1/1e3},s:{name:{singular:"Second",plural:"Seconds"},to_anchor:1},min:{name:{singular:"Minute",plural:"Minutes"},to_anchor:60},h:{name:{singular:"Hour",plural:"Hours"},to_anchor:3600},d:{name:{singular:"Day",plural:"Days"},to_anchor:3600*24},week:{name:{singular:"Week",plural:"Weeks"},to_anchor:3600*24*7},month:{name:{singular:"Month",plural:"Months"},to_anchor:3600*24*gx/12},year:{name:{singular:"Year",plural:"Years"},to_anchor:3600*24*gx}},_anchors:{metric:{unit:"s",ratio:1}}},s7={bits:{b:{name:{singular:"Bit",plural:"Bits"},to_anchor:1},Kb:{name:{singular:"Kilobit",plural:"Kilobits"},to_anchor:1024},Mb:{name:{singular:"Megabit",plural:"Megabits"},to_anchor:1048576},Gb:{name:{singular:"Gigabit",plural:"Gigabits"},to_anchor:1073741824},Tb:{name:{singular:"Terabit",plural:"Terabits"},to_anchor:1099511627776}},bytes:{B:{name:{singular:"Byte",plural:"Bytes"},to_anchor:1},KB:{name:{singular:"Kilobyte",plural:"Kilobytes"},to_anchor:1024},MB:{name:{singular:"Megabyte",plural:"Megabytes"},to_anchor:1048576},GB:{name:{singular:"Gigabyte",plural:"Gigabytes"},to_anchor:1073741824},TB:{name:{singular:"Terabyte",plural:"Terabytes"},to_anchor:1099511627776}},_anchors:{bits:{unit:"b",ratio:1/8},bytes:{unit:"B",ratio:8}}},o7={metric:{ppm:{name:{singular:"Part-per Million",plural:"Parts-per Million"},to_anchor:1},ppb:{name:{singular:"Part-per Billion",plural:"Parts-per Billion"},to_anchor:.001},ppt:{name:{singular:"Part-per Trillion",plural:"Parts-per Trillion"},to_anchor:1e-6},ppq:{name:{singular:"Part-per Quadrillion",plural:"Parts-per Quadrillion"},to_anchor:1e-9}},imperial:{},_anchors:{metric:{unit:"ppm",ratio:1e-6}}},a7={metric:{"m/s":{name:{singular:"Metre per second",plural:"Metres per second"},to_anchor:3.6},"km/h":{name:{singular:"Kilometre per hour",plural:"Kilometres per hour"},to_anchor:1}},imperial:{"m/h":{name:{singular:"Mile per hour",plural:"Miles per hour"},to_anchor:1},knot:{name:{singular:"Knot",plural:"Knots"},to_anchor:1.150779},"ft/s":{name:{singular:"Foot per second",plural:"Feet per second"},to_anchor:.681818}},_anchors:{metric:{unit:"km/h",ratio:1/1.609344},imperial:{unit:"m/h",ratio:1.609344}}},l7={Pa:{name:{singular:"pascal",plural:"pascals"},to_anchor:1/1e3},kPa:{name:{singular:"kilopascal",plural:"kilopascals"},to_anchor:1},MPa:{name:{singular:"megapascal",plural:"megapascals"},to_anchor:1e3},hPa:{name:{singular:"hectopascal",plural:"hectopascals"},to_anchor:1/10},bar:{name:{singular:"bar",plural:"bar"},to_anchor:100},torr:{name:{singular:"torr",plural:"torr"},to_anchor:101325/76e4}},c7={psi:{name:{singular:"pound per square inch",plural:"pounds per square inch"},to_anchor:1/1e3},ksi:{name:{singular:"kilopound per square inch",plural:"kilopound per square inch"},to_anchor:1}},u7={metric:l7,imperial:c7,_anchors:{metric:{unit:"kPa",ratio:.00014503768078},imperial:{unit:"psi",ratio:1/.00014503768078}}},h7={metric:{A:{name:{singular:"Ampere",plural:"Amperes"},to_anchor:1},mA:{name:{singular:"Milliampere",plural:"Milliamperes"},to_anchor:.001},kA:{name:{singular:"Kiloampere",plural:"Kiloamperes"},to_anchor:1e3}},_anchors:{metric:{unit:"A",ratio:1}}},f7={metric:{V:{name:{singular:"Volt",plural:"Volts"},to_anchor:1},mV:{name:{singular:"Millivolt",plural:"Millivolts"},to_anchor:.001},kV:{name:{singular:"Kilovolt",plural:"Kilovolts"},to_anchor:1e3}},_anchors:{metric:{unit:"V",ratio:1}}},d7={metric:{W:{name:{singular:"Watt",plural:"Watts"},to_anchor:1},mW:{name:{singular:"Milliwatt",plural:"Milliwatts"},to_anchor:.001},kW:{name:{singular:"Kilowatt",plural:"Kilowatts"},to_anchor:1e3},MW:{name:{singular:"Megawatt",plural:"Megawatts"},to_anchor:1e6},GW:{name:{singular:"Gigawatt",plural:"Gigawatts"},to_anchor:1e9}},_anchors:{metric:{unit:"W",ratio:1}}},p7={metric:{VAR:{name:{singular:"Volt-Ampere Reactive",plural:"Volt-Amperes Reactive"},to_anchor:1},mVAR:{name:{singular:"Millivolt-Ampere Reactive",plural:"Millivolt-Amperes Reactive"},to_anchor:.001},kVAR:{name:{singular:"Kilovolt-Ampere Reactive",plural:"Kilovolt-Amperes Reactive"},to_anchor:1e3},MVAR:{name:{singular:"Megavolt-Ampere Reactive",plural:"Megavolt-Amperes Reactive"},to_anchor:1e6},GVAR:{name:{singular:"Gigavolt-Ampere Reactive",plural:"Gigavolt-Amperes Reactive"},to_anchor:1e9}},_anchors:{metric:{unit:"VAR",ratio:1}}},m7={metric:{VA:{name:{singular:"Volt-Ampere",plural:"Volt-Amperes"},to_anchor:1},mVA:{name:{singular:"Millivolt-Ampere",plural:"Millivolt-Amperes"},to_anchor:.001},kVA:{name:{singular:"Kilovolt-Ampere",plural:"Kilovolt-Amperes"},to_anchor:1e3},MVA:{name:{singular:"Megavolt-Ampere",plural:"Megavolt-Amperes"},to_anchor:1e6},GVA:{name:{singular:"Gigavolt-Ampere",plural:"Gigavolt-Amperes"},to_anchor:1e9}},_anchors:{metric:{unit:"VA",ratio:1}}},g7={metric:{Wh:{name:{singular:"Watt-hour",plural:"Watt-hours"},to_anchor:3600},mWh:{name:{singular:"Milliwatt-hour",plural:"Milliwatt-hours"},to_anchor:3.6},kWh:{name:{singular:"Kilowatt-hour",plural:"Kilowatt-hours"},to_anchor:36e5},MWh:{name:{singular:"Megawatt-hour",plural:"Megawatt-hours"},to_anchor:36e8},GWh:{name:{singular:"Gigawatt-hour",plural:"Gigawatt-hours"},to_anchor:36e11},J:{name:{singular:"Joule",plural:"Joules"},to_anchor:1},kJ:{name:{singular:"Kilojoule",plural:"Kilojoules"},to_anchor:1e3}},_anchors:{metric:{unit:"J",ratio:1}}},_7={metric:{VARh:{name:{singular:"Volt-Ampere Reactive Hour",plural:"Volt-Amperes Reactive Hour"},to_anchor:1},mVARh:{name:{singular:"Millivolt-Ampere Reactive Hour",plural:"Millivolt-Amperes Reactive Hour"},to_anchor:.001},kVARh:{name:{singular:"Kilovolt-Ampere Reactive Hour",plural:"Kilovolt-Amperes Reactive Hour"},to_anchor:1e3},MVARh:{name:{singular:"Megavolt-Ampere Reactive Hour",plural:"Megavolt-Amperes Reactive Hour"},to_anchor:1e6},GVARh:{name:{singular:"Gigavolt-Ampere Reactive Hour",plural:"Gigavolt-Amperes Reactive Hour"},to_anchor:1e9}},_anchors:{metric:{unit:"VARh",ratio:1}}},v7={"mm3/s":{name:{singular:"Cubic Millimeter per second",plural:"Cubic Millimeters per second"},to_anchor:1/1e6},"cm3/s":{name:{singular:"Cubic Centimeter per second",plural:"Cubic Centimeters per second"},to_anchor:1/1e3},"ml/s":{name:{singular:"Millilitre per second",plural:"Millilitres per second"},to_anchor:1/1e3},"cl/s":{name:{singular:"Centilitre per second",plural:"Centilitres per second"},to_anchor:1/100},"dl/s":{name:{singular:"Decilitre per second",plural:"Decilitres per second"},to_anchor:1/10},"l/s":{name:{singular:"Litre per second",plural:"Litres per second"},to_anchor:1},"l/min":{name:{singular:"Litre per minute",plural:"Litres per minute"},to_anchor:1/60},"l/h":{name:{singular:"Litre per hour",plural:"Litres per hour"},to_anchor:1/3600},"kl/s":{name:{singular:"Kilolitre per second",plural:"Kilolitres per second"},to_anchor:1e3},"kl/min":{name:{singular:"Kilolitre per minute",plural:"Kilolitres per minute"},to_anchor:50/3},"kl/h":{name:{singular:"Kilolitre per hour",plural:"Kilolitres per hour"},to_anchor:5/18},"m3/s":{name:{singular:"Cubic meter per second",plural:"Cubic meters per second"},to_anchor:1e3},"m3/min":{name:{singular:"Cubic meter per minute",plural:"Cubic meters per minute"},to_anchor:50/3},"m3/h":{name:{singular:"Cubic meter per hour",plural:"Cubic meters per hour"},to_anchor:5/18},"km3/s":{name:{singular:"Cubic kilometer per second",plural:"Cubic kilometers per second"},to_anchor:1e12}},x7={"tsp/s":{name:{singular:"Teaspoon per second",plural:"Teaspoons per second"},to_anchor:1/6},"Tbs/s":{name:{singular:"Tablespoon per second",plural:"Tablespoons per second"},to_anchor:1/2},"in3/s":{name:{singular:"Cubic inch per second",plural:"Cubic inches per second"},to_anchor:.55411},"in3/min":{name:{singular:"Cubic inch per minute",plural:"Cubic inches per minute"},to_anchor:.55411/60},"in3/h":{name:{singular:"Cubic inch per hour",plural:"Cubic inches per hour"},to_anchor:.55411/3600},"fl-oz/s":{name:{singular:"Fluid Ounce per second",plural:"Fluid Ounces per second"},to_anchor:1},"fl-oz/min":{name:{singular:"Fluid Ounce per minute",plural:"Fluid Ounces per minute"},to_anchor:1/60},"fl-oz/h":{name:{singular:"Fluid Ounce per hour",plural:"Fluid Ounces per hour"},to_anchor:1/3600},"cup/s":{name:{singular:"Cup per second",plural:"Cups per second"},to_anchor:8},"pnt/s":{name:{singular:"Pint per second",plural:"Pints per second"},to_anchor:16},"pnt/min":{name:{singular:"Pint per minute",plural:"Pints per minute"},to_anchor:4/15},"pnt/h":{name:{singular:"Pint per hour",plural:"Pints per hour"},to_anchor:1/225},"qt/s":{name:{singular:"Quart per second",plural:"Quarts per second"},to_anchor:32},"gal/s":{name:{singular:"Gallon per second",plural:"Gallons per second"},to_anchor:128},"gal/min":{name:{singular:"Gallon per minute",plural:"Gallons per minute"},to_anchor:32/15},"gal/h":{name:{singular:"Gallon per hour",plural:"Gallons per hour"},to_anchor:8/225},"ft3/s":{name:{singular:"Cubic foot per second",plural:"Cubic feet per second"},to_anchor:957.506},"ft3/min":{name:{singular:"Cubic foot per minute",plural:"Cubic feet per minute"},to_anchor:957.506/60},"ft3/h":{name:{singular:"Cubic foot per hour",plural:"Cubic feet per hour"},to_anchor:957.506/3600},"yd3/s":{name:{singular:"Cubic yard per second",plural:"Cubic yards per second"},to_anchor:25852.7},"yd3/min":{name:{singular:"Cubic yard per minute",plural:"Cubic yards per minute"},to_anchor:25852.7/60},"yd3/h":{name:{singular:"Cubic yard per hour",plural:"Cubic yards per hour"},to_anchor:25852.7/3600}},y7={metric:v7,imperial:x7,_anchors:{metric:{unit:"l/s",ratio:33.8140227},imperial:{unit:"fl-oz/s",ratio:1/33.8140227}}},S7={metric:{lx:{name:{singular:"Lux",plural:"Lux"},to_anchor:1}},imperial:{"ft-cd":{name:{singular:"Foot-candle",plural:"Foot-candles"},to_anchor:1}},_anchors:{metric:{unit:"lx",ratio:1/10.76391},imperial:{unit:"ft-cd",ratio:10.76391}}},E7={metric:{mHz:{name:{singular:"millihertz",plural:"millihertz"},to_anchor:1/1e3},Hz:{name:{singular:"hertz",plural:"hertz"},to_anchor:1},kHz:{name:{singular:"kilohertz",plural:"kilohertz"},to_anchor:1e3},MHz:{name:{singular:"megahertz",plural:"megahertz"},to_anchor:1e3*1e3},GHz:{name:{singular:"gigahertz",plural:"gigahertz"},to_anchor:1e3*1e3*1e3},THz:{name:{singular:"terahertz",plural:"terahertz"},to_anchor:1e3*1e3*1e3*1e3},rpm:{name:{singular:"rotation per minute",plural:"rotations per minute"},to_anchor:1/60},"deg/s":{name:{singular:"degree per second",plural:"degrees per second"},to_anchor:1/360},"rad/s":{name:{singular:"radian per second",plural:"radians per second"},to_anchor:1/(Math.PI*2)}},_anchors:{frequency:{unit:"hz",ratio:1}}},Ls={length:jA,area:YA,mass:JA,volume:t7,each:n7,temperature:r7,time:i7,digital:s7,partsPer:o7,speed:a7,pressure:u7,current:h7,voltage:f7,power:d7,reactivePower:p7,apparentPower:m7,energy:g7,reactiveEnergy:_7,volumeFlowRate:y7,illuminance:S7,frequency:E7};function Bl(n){return Object.keys(n)}function _x(n){return{abbr:n.abbr,measure:n.measure,system:n.system,singular:n.unit.name.singular,plural:n.unit.name.plural}}function Vr(n,e){if(Array.isArray(n))for(let t=0;t<n.length;t++)e(n[t],t,n);else if(n&&typeof n=="object")for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(n[t],t,n)}class b7{constructor(e,t){vt(this,"val");vt(this,"destination");vt(this,"origin");this.val=t?e/t:e}from(e){if(this.destination)throw new Error(".from must be called before .to");return this.origin=this.getUnit(e),this.origin||this.throwUnsupportedUnitError(e),this}to(e){if(!this.origin)throw new Error(".to must be called after .from");if(this.destination=this.getUnit(e),this.destination||this.throwUnsupportedUnitError(e),this.origin.abbr===this.destination.abbr)return this.val;if(this.destination.measure!==this.origin.measure)throw new Error(`Cannot convert incompatible measures of ${this.destination.measure} and ${this.origin.measure}`);let t=this.val*this.origin.unit.to_anchor;if(this.origin.unit.anchor_shift&&(t-=this.origin.unit.anchor_shift),this.origin.system!==this.destination.system){const r=Ls[this.origin.measure]._anchors[this.origin.system];t=typeof r.transform=="function"?r.transform(t):t*r.ratio}return this.destination.unit.anchor_shift&&(t+=this.destination.unit.anchor_shift),t/this.destination.unit.to_anchor}toBest(e){if(!this.origin)throw new Error(".toBest must be called after .from");const t={exclude:[],cutOffNumber:1,...e};let r=null;return Vr(this.possibilities(),i=>{if(t.exclude.includes(i))return;const s=this.describe(i);if(s.system!==this.origin.system)return;const o=this.to(i);(!r||o>=t.cutOffNumber&&o<r.val)&&(r={val:o,unit:i,singular:s.singular,plural:s.plural})}),r}getUnit(e){let t=null;return Vr(Ls,(r,i)=>{Vr(r,(s,o)=>{o!=="_anchors"&&Vr(s,(a,l)=>{l===e&&(t={abbr:e,measure:i,system:o,unit:a})})})}),t}describe(e){const t=this.getUnit(e);return t||this.throwUnsupportedUnitError(e),_x(t)}list(e){const t=[];return Vr(Ls,(r,i)=>{e&&e!==i||Vr(r,(s,o)=>{o!=="_anchors"&&Vr(s,(a,l)=>{t.push(_x({abbr:l,measure:i,system:o,unit:a}))})})}),t}throwUnsupportedUnitError(e){const t=[];throw Vr(Ls,r=>{Vr(r,(i,s)=>{s!=="_anchors"&&t.push(...Bl(i))})}),new Error(`Unsupported unit ${e}, use one of: ${t.join(", ")}`)}possibilities(e){const t=[];if(!this.origin&&!e)Vr(Bl(Ls),r=>{Vr(Ls[r],(i,s)=>{s!=="_anchors"&&t.push(...Bl(i))})});else{const r=e||this.origin.measure;Vr(Ls[r],(i,s)=>{s!=="_anchors"&&t.push(...Bl(i))})}return t}measures(){return Bl(Ls)}}function hi(n){return new b7(n)}const M7={fontSize:"13px",WebkitAppearance:"none"};function em({children:n,style:e,...t}){return C.jsx("select",{className:"w-full cursor-pointer block px-2 outline-none rounded h-[35px] text-white bg-[#5e5e5e]",style:{...M7,...e},...t,children:n})}const tm=({value:n,onUpdate:e,onValid:t,configs:r,sourceElement:i,internalState:s})=>{const{planner:o}=en(),a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||yi,{hook:h,label:f,...p}=r,d=(m,x)=>{let v=ar(m),_=n.merge({length:x!==yi?hi(v).from(x).to(yi):v,_length:m,_unit:x});return h?h(_,i,s,o).then(E=>e(E)):e(_)};return C.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[C.jsx(ui,{children:f}),C.jsxs("div",{className:"w-full flex",children:[C.jsx(ss,{value:l,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},onChange:m=>d(m.target.value,c),onValid:t,...p}),C.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:C.jsx(em,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>d(l,m.target.value),children:$0.map(m=>C.jsx("option",{value:m,children:m},m))})})]})]})},Vl=({style:n,...e})=>C.jsx("input",{className:"block w-full px-2 text-sm leading-5 bg-[#2b2b2b] rounded border border-[#5e5e5e] outline-none h-[35px] text-white",style:{...n},type:"text",...e}),w7=({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i})=>{const{planner:s}=en(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return C.jsxs("div",{className:"PropertyString w-full mb-2",children:[C.jsx(ui,{children:t.label}),C.jsx(Vl,{value:n,onChange:a=>o(a.target.value)})]})},T7=({element:n,attributeFormData:e,onUpdate:t,...r})=>{let i=e.has("name")?e.get("name"):n.name,s=e.has("offsetA")?e.get("offsetA"):n.offsetA,o=e.has("offsetB")?e.get("offsetB"):n.offsetA;return C.jsxs("div",{children:[C.jsx(w7,{value:i,onUpdate:a=>t("name",a),configs:{label:"Nome"},...r}),C.jsx(tm,{value:s,onUpdate:a=>t("offsetA",a),configs:{label:"Offset 1",min:0,max:1/0,precision:2},...r}),C.jsx(tm,{value:o,onUpdate:a=>t("offsetB",a),configs:{label:"Offset 2",min:0,max:1/0,precision:2},...r})]})},A7=({element:n,onUpdate:e,attributeFormData:t,...r})=>{let i=t.has("name")?t.get("name"):n.name,s=t.has("x")?t.get("x"):n.x,o=t.has("y")?t.get("y"):n.y,a=t.has("rotation")?t.get("rotation"):n.rotation;return C.jsx("table",{className:"w-full",children:C.jsxs("tbody",{children:[C.jsxs("tr",{children:[C.jsx("td",{className:"w-[6em]",children:"Name"}),C.jsx("td",{children:C.jsx(Vl,{value:i,onChange:l=>e("name",l.target.value),style:{textAlign:"left"}})})]}),C.jsxs("tr",{children:[C.jsx("td",{className:"w-[6em]",children:"X"}),C.jsx("td",{children:C.jsx(ss,{value:s,onChange:l=>e("x",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),C.jsxs("tr",{children:[C.jsx("td",{className:"w-[6em]",children:"Y"}),C.jsx("td",{children:C.jsx(ss,{value:o,onChange:l=>e("y",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),C.jsxs("tr",{children:[C.jsx("td",{className:"w-[6em]",children:"Rotation"}),C.jsx("td",{children:C.jsx(ss,{value:a,onChange:l=>e("rotation",l.target.value),style:{textAlign:"left"},precision:2,...r})})]})]})})},C7=({element:n,onUpdate:e,attributeFormData:t})=>{let r=t.has("name")?t.get("name"):n.name,i=t.has("lineLength")?t.get("lineLength"):null;return C.jsxs("div",{children:[C.jsxs("div",{className:"w-full mb-2",children:[C.jsx(ui,{children:"Name"}),C.jsx(Vl,{value:r,onChange:s=>e("name",s.target.value),style:{textAlign:"left"}})]}),C.jsx(tm,{value:i,onUpdate:s=>e("lineLength",s),configs:{label:"Length",min:0,max:1/0,precision:2}})]})},R7=({element:n,onUpdate:e,onValid:t,attributeFormData:r,...i})=>n.prototype==="items"?C.jsx(A7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):n.prototype==="lines"?C.jsx(C7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):n.prototype==="holes"?C.jsx(T7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):null,fi=2,P7=(n,e,t)=>{switch(n=typeof n.misc=="object"?n.set("misc",qe(n.misc)):n,n.prototype){case"items":return qe(n);case"lines":{let r=e.vertices.get(n.vertices.get(0)),i=e.vertices.get(n.vertices.get(1)),s=Bn(r.x,r.y,i.x,i.y),o=n.misc.get("_unitLength")||t.unit,a=hi(s).from(t.unit).to(o);return qe({vertexOne:r,vertexTwo:i,lineLength:qe({length:s,_length:a,_unit:o})})}case"holes":{let r=e.lines.get(n.line),{x:i,y:s}=e.vertices.get(r.vertices.get(0)),{x:o,y:a}=e.vertices.get(r.vertices.get(1)),l=Bn(i,s,o,a),c=l*n.offset-n.properties.get("width").get("length")/2,h=n.misc.get("_unitA")||t.unit,f=hi(c).from(t.unit).to(h),p=l-l*n.offset-n.properties.get("width").get("length")/2,d=n.misc.get("_unitB")||t.unit,m=hi(p).from(t.unit).to(d);return qe({offset:n.offset,offsetA:qe({length:ar(c,fi),_length:ar(f,fi),_unit:h}),offsetB:qe({length:ar(p,fi),_length:ar(m,fi),_unit:d})})}case"areas":return qe({});default:return null}},I7=(n,e)=>{const t=e.getElement(n.type),r={};for(const i in t.properties)r[i]=qe({currentValue:n.properties.has(i)?n.properties.get(i):Dt(t.properties[i].defaultValue),configs:t.properties[i]});return qe(r)},L7=({element:n,layer:e,catalog:t})=>{const{planner:r,setItemsAttributes:i,setProperties:s,setLinesAttributes:o,setHolesAttributes:a}=en(),[l,c]=se.useState(P7(n,e,t)),[h,f]=se.useState(I7(n,t)),p=({propertiesFormData:x,attributesFormData:v})=>{if(x){let _=x.map(E=>E.get("currentValue"));s(_)}if(v)switch(n.prototype){case"items":{i(v);break}case"lines":{o(v);break}case"holes":{a(v);break}}},d=(x,v)=>{if(!l)return;let _;switch(n.prototype){case"items":{_=l.set(x,v);break}case"lines":{switch(x){case"lineLength":{let E=l.get("vertexOne"),M=l.get("vertexTwo"),[b,S]=al([E,M]),T=yc(b.x,b.y,S.x,S.y,v.get("length"),fi);_=l.withMutations(q=>{q.set(E===b?"vertexTwo":"vertexOne",S.merge(T)),q.set("lineLength",v)});break}case"vertexOne":case"vertexTwo":{_=l.withMutations(E=>{E.set(x,E.get(x).merge(v));let M=_c(E.get("vertexOne"),E.get("vertexTwo"));E.mergeIn(["lineLength"],E.get("lineLength").merge({length:M,_length:hi(M).from(t.unit).to(E.get("lineLength").get("_unit"))}))});break}default:{_=l.set(x,v);break}}break}case"holes":{switch(x){case"offsetA":{let E=e.lines.get(n.line),M=al([e.vertices.get(E.vertices.get(0)),e.vertices.get(E.vertices.get(1))]),[{x:b,y:S},{x:T,y:q}]=M,O=cf(b,S,T,q),A=Bn(b,S,T,q),L=n.properties.get("width").get("length"),N=L/2,Z=v.get("length");Z=Math.max(Z,0),Z=Math.min(Z,A-L);let Y=(Z+N)*Math.cos(O)+b,ee=(Z+N)*Math.sin(O)+S,ue=Vn(b,S,T,q,Y,ee),te=ar(A-A*ue-N,fi),ae=l.getIn(["offsetB","_unit"]),B=qe({length:te,_length:hi(te).from(t.unit).to(ae),_unit:ae});_=l.set("offsetB",B).set("offset",ue);let Se=qe({length:ar(Z,fi),_unit:v.get("_unit"),_length:ar(hi(Z).from(t.unit).to(v.get("_unit")),fi)});_=l.set(x,Se);break}case"offsetB":{let E=e.lines.get(n.line),M=al([e.vertices.get(E.vertices.get(0)),e.vertices.get(E.vertices.get(1))]),[{x:b,y:S},{x:T,y:q}]=M,O=cf(b,S,T,q),A=Bn(b,S,T,q),L=n.properties.get("width").get("length"),N=L/2,Z=v.get("length");Z=Math.max(Z,0),Z=Math.min(Z,A-L);let Y=T-(Z+N)*Math.cos(O),ee=q-(Z+N)*Math.sin(O),ue=Vn(b,S,T,q,Y,ee),te=ar(A*ue-N,fi),ae=l.getIn(["offsetA","_unit"]),B=qe({length:te,_length:hi(te).from(t.unit).to(ae),_unit:ae});_=l.set("offsetA",B).set("offset",ue);let Se=qe({length:ar(Z,fi),_unit:v.get("_unit"),_length:ar(hi(Z).from(t.unit).to(v.get("_unit")),fi)});_=l.set(x,Se);break}default:{_=l.set(x,v);break}}break}}_&&(c(_),p({attributesFormData:_,propertiesFormData:h}))},m=(x,v)=>{const _=h.setIn([x,"currentValue"],v);f(_),p({propertiesFormData:_,attributesFormData:l})};return C.jsxs("div",{children:[C.jsx(R7,{element:n,onValid:()=>{},onUpdate:d,attributeFormData:l}),h.entrySeq().map(([x,v])=>{let _=v.get("currentValue"),E=v.get("configs"),{Editor:M}=t.getPropertyType(E.type);return C.jsx(M,{propertyName:x,value:_,configs:E,onUpdate:b=>m(x,b),state:r,sourceElement:n,internalState:{attributesFormData:l,propertiesFormData:h}},x)})]})},O7=()=>C.jsxs("div",{className:"h-full flex flex-col gap-4 justify-center items-center",children:[C.jsx("div",{className:"text-3xl text-white",children:C.jsx("img",{src:"/assets/icons/bullseye-arrow.svg",alt:"bullseye-arrow",width:34,height:34})}),C.jsx("p",{className:"mx-4 text-white text-sm text-center",children:"Select an element on the canvas to edit its properties."})]}),q7=[fn,Hs,Gs,Ws,Bi,qo,jr,_r,vr,Dr,Xr,$r,Yr,Kr,Vi,nf,rf],D7=({catalog:n})=>{const{planner:e}=en(),{scene:t,mode:r}=e;return q7.includes(r)?t.layers.valueSeq().flatMap(s=>wn().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>({element:o,layer:s}))).toArray().length===0?C.jsx(O7,{}):C.jsx("div",{children:t.layers.valueSeq().map(s=>wn().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>C.jsx(mx,{name:"Properties",opened:!0,children:C.jsx("div",{style:{padding:"5px 15px"},children:C.jsx(L7,{element:o,layer:s,catalog:n})})},o.id)).valueSeq())}):null},N7={MODE_IDLE:fn,MODE_2D_ZOOM_IN:Hs,MODE_2D_ZOOM_OUT:Gs,MODE_2D_PAN:Ws,MODE_3D_VIEW:Bi,MODE_3D_FIRST_PERSON:qo,MODE_WAITING_DRAWING_LINE:jr,MODE_DRAWING_LINE:_r,MODE_DRAWING_HOLE:vr,MODE_DRAWING_ITEM:Dr,MODE_DRAGGING_LINE:Xr,MODE_DRAGGING_VERTEX:$r,MODE_DRAGGING_ITEM:Yr,MODE_DRAGGING_HOLE:Kr,MODE_FITTING_IMAGE:rf,MODE_UPLOADING_IMAGE:nf,MODE_ROTATING_ITEM:Vi},U7={width:"100%"},$u={width:"6em"},Yu={textAlign:"left"},F7={marginLeft:"5px",border:"0px",background:"none",color:"#FFFFFF",fontSize:"14px",outline:"0px"},z7={width:"100%",cursor:"pointer",maxHeight:"20em",marginLeft:"1px",marginTop:"1em"},vx={width:"2em"},k7=({groupID:n})=>{const{planner:e,setGroupAttributes:t,groupTranslate:r,groupRotate:i,removeFromGroup:s}=en(),{mode:o}=e;if(!n||!N7[o])return null;const a=e.getIn(["scene","groups",n]),l=a.get("elements");return C.jsx(mx,{name:`Group [${a.get("name")}]`,opened:!0,children:C.jsxs("div",{style:{padding:"5px 15px"},children:[C.jsx("table",{style:U7,children:C.jsxs("tbody",{children:[C.jsxs("tr",{children:[C.jsx("td",{style:$u,children:"Name"}),C.jsx("td",{children:C.jsx(Vl,{value:a.get("name"),onChange:c=>t(n,qe({name:c.target.value})),style:Yu})})]}),C.jsxs("tr",{children:[C.jsx("td",{style:$u,children:"X"}),C.jsx("td",{children:C.jsx(ss,{value:a.get("x"),onChange:c=>r(n,c.target.value,a.get("y")),style:Yu,precision:2})})]}),C.jsxs("tr",{children:[C.jsx("td",{style:$u,children:"Y"}),C.jsx("td",{children:C.jsx(ss,{value:a.get("y"),onChange:c=>r(n,a.get("x"),c.target.value),style:Yu,precision:2})})]}),C.jsxs("tr",{children:[C.jsx("td",{style:$u,children:"Rotation"}),C.jsx("td",{children:C.jsx(ss,{value:a.get("rotation"),onChange:c=>i(n,c.target.value),style:Yu,precision:2})})]})]})}),l.size?C.jsxs("div",{children:[C.jsx("p",{style:{textAlign:"center",borderBottom:"1px solid #555",paddingBottom:"1em"},children:"Group's Elements"}),C.jsxs("table",{style:z7,children:[C.jsx("thead",{children:C.jsxs("tr",{children:[C.jsx("th",{style:vx}),C.jsx("th",{children:"Layer"}),C.jsx("th",{children:"Prototype"}),C.jsx("th",{children:"Name"})]})}),C.jsx("tbody",{children:l.entrySeq().map(([c,h])=>h.entrySeq().map(([f,p])=>p.valueSeq().map(d=>{let m=e.getIn(["scene","layers",c,f,d]);return C.jsxs("tr",{children:[C.jsx("td",{style:vx,title:"Un-chain Element from Group",children:C.jsx(A8,{onClick:()=>s(n,c,f,d),style:F7})}),C.jsx("td",{style:{textAlign:"center"},children:c}),C.jsx("td",{style:{textAlign:"center",textTransform:"capitalize"},children:f}),C.jsx("td",{style:{textAlign:"center"},children:m.name})]},d)})))})]})]}):null]})})},B7=({catalog:n})=>{const{planner:e}=en(),t=e.getIn(["scene","selectedLayer"]),r=e.getIn(["scene","layers",t,"selected"]),i=e.getIn(["scene","groups"]).findEntry(o=>o.get("selected")),s=r.lines.size>1||r.items.size>1||r.holes.size>1||r.areas.size>1||r.lines.size+r.items.size+r.holes.size+r.areas.size>1;return C.jsxs("aside",{onKeyDown:o=>o.stopPropagation(),onKeyUp:o=>o.stopPropagation(),className:"floor_planner-sidebar w-[300px] bg-[#424242] h-[calc(100%_-_20px)] block overflow-y-auto overflow-x-hidden pb-5",children:[!s&&C.jsx(D7,{catalog:n}),!!i&&C.jsx(k7,{groupID:i?i[0]:null})]})},di=({active:n,tooltip:e,onClick:t,children:r,className:i})=>{const[s,o]=se.useState(!1),a=n||s?"text-[#1CA6FC]":"text-[#C2C2C2]";return C.jsxs("div",{className:ci("w-[30px] h-[30px] flex items-center justify-center text-[25px] relative cursor-pointer",i),onMouseOver:()=>o(!0),onMouseOut:()=>o(!1),children:[C.jsx("div",{className:a,onClick:t,children:r}),s&&C.jsxs("div",{className:"absolute w-[140px] text-white bg-black h-[30px] leading-[30px] text-center rounded-md opacity-80 left-full top-1/2 -mt-[15px] ml-[15px] z-[999] text-[12px]",children:[C.jsx("span",{className:"absolute top-1/2 right-full -mt-[8px] w-0 h-0 border-r-[8px] border-r-black border-t-[8px] border-t-transparent border-b-[8px] border-b-transparent"}),e]})]})},xx=()=>new Promise(async n=>{const e=document.getElementsByTagName("svg");if(!e.length)return;let t=e[0];for(let p=1;p<e.length;p++)e[p].width.baseVal.value>t.width.baseVal.value&&(t=e[p]);const r=t.cloneNode(!0),i=r.querySelectorAll("image");await Promise.all(Array.from(i).map(async p=>{const d=p.getAttribute("href")||p.getAttribute("xlink:href");if(d)try{const x=await(await fetch(d)).blob(),v=new FileReader;await new Promise(_=>{v.onloadend=()=>{p.setAttribute("href",v.result),_()},v.readAsDataURL(x)})}catch(m){console.warn("⚠️ Could not inline image:",d,m)}}));const o=new XMLSerializer().serializeToString(r),a=t.width.baseVal.value,l=t.height.baseVal.value,c=document.createElement("canvas");c.width=a,c.height=l;const h=c.getContext("2d");h.fillStyle="white",h.fillRect(0,0,a,l);const f=new Image;f.src=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(o)))}`,f.onload=()=>{h.drawImage(f,0,0,a,l),n(c.toDataURL("image/png"))}});function yx(n){return _n({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 19a2 2 0 0 1 -2 -2"},child:[]},{tag:"path",attr:{d:"M5 13v-2"},child:[]},{tag:"path",attr:{d:"M5 7a2 2 0 0 1 2 -2"},child:[]},{tag:"path",attr:{d:"M11 5h2"},child:[]},{tag:"path",attr:{d:"M17 5a2 2 0 0 1 2 2"},child:[]},{tag:"path",attr:{d:"M19 11v2"},child:[]},{tag:"path",attr:{d:"M19 17v4"},child:[]},{tag:"path",attr:{d:"M21 19h-4"},child:[]},{tag:"path",attr:{d:"M13 19h-2"},child:[]}]})(n)}const Sx=n=>{let e=document.createElement("a"),t="output"+Date.now()+".png";t=window.prompt("Insert output filename",t),t&&(e.setAttribute("download",t),e.href=n,e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e))};function V7({mode:n}){const e=r=>{r.preventDefault();const i=document.getElementsByTagName("canvas")[0];Sx(i.toDataURL())},t=async r=>{r.preventDefault(),xx().then(Sx)};return[qo,Bi].includes(n)?C.jsx(di,{active:!1,tooltip:"Get Screenshot",onClick:e,children:C.jsx(yx,{size:28})}):[fn,Hs,Gs,Ws,jr,Xr,$r,Yr,_r,vr,Dr,Kr,Vi].includes(n)?C.jsx(di,{active:!1,tooltip:"Get Screenshot",onClick:t,children:C.jsx(yx,{size:28})}):null}function H7(n){return _n({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M12 9v6"},child:[]},{tag:"path",attr:{d:"M16 15v6"},child:[]},{tag:"path",attr:{d:"M16 3v6"},child:[]},{tag:"path",attr:{d:"M3 15h18"},child:[]},{tag:"path",attr:{d:"M3 9h18"},child:[]},{tag:"path",attr:{d:"M8 15v6"},child:[]},{tag:"path",attr:{d:"M8 3v6"},child:[]}]})(n)}const G7=/^.*$/;function W7({onChange:n,...e}){const[t,r]=se.useState(""),i=se.useRef(null);se.useEffect(()=>{r(e.value)},[e.value]);const s=a=>{if(!a)return;const l=a.target.value;G7.test(l)&&n&&n(a)},o=a=>{(!a.key||a.key==="Enter")&&s({target:{value:t}})};return C.jsxs("div",{className:"color-field flex-1 flex pr-3 mt-1 cursor-pointer",children:[C.jsx("div",{className:"colorBox relative w-[22px] h-[22px]",style:{background:e.value},onClick:()=>{i.current&&i.current.click()},children:C.jsx("input",{ref:i,type:"color",onChange:s,value:e.value,className:"absolute invisible h-full w-full"})}),C.jsx("div",{className:"flex-1 pl-2",children:C.jsx("input",{className:"colorFieldInput min-w-[90px] cursor-pointer",type:"text",value:t,onKeyDown:o,onChange:a=>r(a.target.value),onBlur:o})})]})}function Ex({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=en(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return C.jsxs("div",{className:"PropertyColor w-full mb-2",children:[C.jsx(ui,{children:t.label}),C.jsx(W7,{value:n,onChange:a=>o(a.target.value)})]})}function bx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=en(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return C.jsxs("div",{className:"PropertyEnum w-full mb-2",children:[C.jsx(ui,{children:t.label}),C.jsx(em,{value:n,onChange:a=>o(a.target.value),children:wn(t.values).entrySeq().map(([a,l])=>C.jsx("option",{value:a,children:l},a))})]})}function Mx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=en();let o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return C.jsxs("div",{className:"PropertyString w-full mb-2",children:[C.jsx(ui,{children:t.label}),C.jsx(Vl,{value:n,onChange:a=>o(a.target.value)})]})}function wx({value:n,onUpdate:e,onValid:t,configs:r,sourceElement:i,internalState:s}){const{planner:o}=en(),a=l=>{let c=parseFloat(l);return isNaN(c)&&(c=0),r.hook?r.hook(c,i,s,o).then(h=>e(h)):e(c)};return C.jsxs("div",{className:"PropertyNumber w-full mb-2",children:[C.jsx(ui,{children:r.label}),C.jsx(ss,{value:n,onChange:l=>a(l.target.value),onValid:t,min:r.min,max:r.max})]})}function Tx({value:n,onUpdate:e,onValid:t,configs:r,sourceElement:i,internalState:s}){const{planner:o}=en();let a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||yi,{hook:h,label:f,...p}=r;const d=(m,x)=>{let v=ar(m),_=n.merge({length:x!==yi?hi(v).from(x).to(yi):v,_length:m,_unit:x});return h?h(_,i,s,o).then(E=>e(E)):e(_)};return C.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[C.jsx(ui,{children:f}),C.jsxs("div",{className:"w-full flex",children:[C.jsx(ss,{value:l,onChange:m=>d(m.target.value,c),onValid:t,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},...p}),C.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:C.jsx(em,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>d(l,m.target.value),children:$0.map(m=>C.jsx("option",{value:m,children:m},m))})})]})]})}function j7({type:n="button",size:e="normal",style:t,styleHover:r,children:i,...s}){const[o,a]=se.useState(!1),l="inline-block font-normal leading-[1.25] text-center whitespace-nowrap align-middle cursor-pointer select-none outline-none border border-solid w-full transition-colors duration-175 ease-linear rounded-[2px]",c=e==="small"?"text-[12px] px-2 py-[3px]":e==="large"?"px-5 py-2":"text-[14px] px-3 py-[5px]",h={backgroundColor:"#e6e6e6",borderColor:"#adadad"},f={backgroundColor:"#d4d4d4",borderColor:"#8c8c8c"};return C.jsx("button",{type:n,className:`${l} ${c}`,style:{...o?{...f,...r}:{...h,...t}},onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),...s,children:i})}const Ku={tableStyle:{width:"100%",borderSpacing:"2px 0",marginBottom:"2px"},firstTdStyle:{width:"6em",textTransform:"capitalize"}};function Ax({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=en(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return C.jsx("table",{className:"PropertyToggle",style:Ku.tableStyle,children:C.jsx("tbody",{children:C.jsxs("tr",{children:[C.jsx("td",{style:Ku.firstTdStyle,children:C.jsx(ui,{children:t.label})}),C.jsx("td",{children:C.jsx(j7,{onClick:()=>o(!n),size:"small",children:t.actionName})})]})})})}function Cx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=en(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return C.jsxs("div",{className:"PropertyCheckbox w-full flex items-center gap-2 mb-2",children:[C.jsx("input",{className:"m-0 mt-0.5",type:"checkbox",checked:n,onChange:()=>o(!n)}),C.jsx(ui,{className:"mb-0",children:t.label})]})}function Rx(){return null}function Px({value:n,configs:e}){return C.jsx("table",{className:"PropertyReadOnly",style:Ku.tableStyle,children:C.jsx("tbody",{children:C.jsxs("tr",{children:[C.jsx("td",{style:Ku.firstTdStyle,children:C.jsx(ui,{children:e.label})}),C.jsx("td",{children:C.jsx("div",{children:n})})]})})})}class X7{constructor(e=yi){vt(this,"elements");vt(this,"categories");vt(this,"propertyTypes");vt(this,"unit");this.elements={},this.categories={root:{name:"root",label:"/",elements:[],categories:[]}},this.propertyTypes={},this.unit=e,this.registerMultiplePropertyType([["color",Ex,Ex],["enum",bx,bx],["string",Mx,Mx],["number",wx,wx],["length-measure",Tx,Tx],["toggle",Ax,Ax],["checkbox",Cx,Cx],["hidden",Rx,Rx],["read-only",Px,Px]])}getElement(e){if(this.hasElement(e))return this.elements[e];throw new Error(`Element ${e} does not exist in catalog`)}getCategory(e){if(this.hasCategory(e))return this.categories[e];throw new Error(`Category ${e} does not exist in catalog`)}getPropertyType(e){if(this.propertyTypes.hasOwnProperty(e))return this.propertyTypes[e];throw new Error(`Element ${e} does not exist in catalog`)}registerElement(e){e.properties=e.properties||{},this.validateElement(e)&&(this.elements[e.name]=e,this.categories.root.elements.push(this.elements[e.name]))}registerMultipleElements(e){e.forEach(t=>this.registerElement(t))}registerPropertyType(e,t,r){this.propertyTypes[e]={type:e,Viewer:t,Editor:r}}registerMultiplePropertyType(e){e.forEach(t=>this.registerPropertyType(...t))}validateElement(e){if(!e.hasOwnProperty("name"))throw new Error("Element not valid");let t=e.name;if(!e.hasOwnProperty("prototype"))throw new Error(`Element ${t} doesn't have prototype`);if(!e.hasOwnProperty("info"))throw new Error(`Element ${t} doesn't have info`);if(!e.info.hasOwnProperty("tag"))throw new Error(`Element ${t} doesn't have tag`);if(!e.info.hasOwnProperty("description"))throw new Error(`Element ${t} doesn't have description`);if(!e.info.hasOwnProperty("image"))throw new Error(`Element ${t} doesn't have image`);if(!e.hasOwnProperty("render2D"))throw new Error(`Element ${t} doesn't have render2D handler`);if(!e.hasOwnProperty("render3D"))throw new Error(`Element ${t} doesn't have render3D handler`);if(!e.hasOwnProperty("properties"))throw new Error(`Element ${t} doesn't have properties`);for(let r in e.properties){let i=e.properties[r];if(!i.hasOwnProperty("type"))throw new Error(`Element ${t}, Property ${r} doesn't have type`);if(!i.hasOwnProperty("defaultValue"))throw new Error(`Element ${t}, Property ${r} doesn't have defaultValue`)}return!0}hasElement(e){return this.elements.hasOwnProperty(e)}registerCategory(e,t,r){return this.validateCategory(e,t)?(this.categories[e]={name:e,label:t,categories:[],elements:[]},this.categories.root.categories.push(this.categories[e]),r&&r.length&&r.forEach(i=>this.addToCategory(e,i)),this.categories[e]):null}addToCategory(e,t){if(this.hasElement(t.name))this.categories[e].elements.push(t),this.categories.root.elements.splice(this.categories.root.elements.indexOf(t),1);else if(this.hasCategory(t.name))this.categories[e].categories.push(t),this.categories.root.categories.splice(this.categories.root.categories.indexOf(t),1);else throw new Error(`child ${t} is either category nor element`)}categoryHasElement(e,t){return this.hasCategory(e)&&this.categories[e].elements.some(r=>r.name===t)}validateCategory(e,t){if(!e)throw new Error("Category has undefined name");if(e==="")throw new Error("Category has empty name");if(this.hasCategory(e))throw new Error("Category has already been registered");return!0}hasCategory(e){return this.categories.hasOwnProperty(e)}}function $7(n){return _n({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"},child:[]}]})(n)}const Y7=({term:n="",placeholder:e="Search",noSpacing:t=!1,onClick:r=()=>!1,isStatic:i=!1,hasDropDown:s=!1,onSearch:o,className:a})=>{const[l,c]=se.useState("");return C.jsxs("div",{className:ci(`relative w-full ${t?"mt-1":"mt-2"}`,a),onClick:r??(()=>!1),children:[C.jsx("span",{className:`absolute left-0 top-2 text-[#637381] ${t?"":"ml-2"}`,style:{zIndex:2},children:C.jsx($7,{size:18})}),i?C.jsx("div",{className:"w-full rounded border border-gray-300 bg-white px-3 py-1.5 text-xs font-normal cursor-pointer",style:{marginTop:3},children:n}):C.jsx("input",{className:"w-full rounded pl-[30px] focus:outline-none border border-gray-300 bg-white pr-3 py-1.5 text-sm text-gray-900",type:"text",placeholder:e,onChange:h=>{o(h.target.value,h),c(h.target.value)},value:l,onClick:r??(()=>!1)}),r!==null&&s&&C.jsx("span",{className:`absolute right-2 top-1/2 -translate-y-1/2 ${t?"":"ml-2"}`,style:{zIndex:1},children:C.jsx(w8,{className:"-mb-1"})})]})},Ix=8,Lx=40,K7=n=>{const e=[{label:"All Categories",value:"all"}],t=n.map(r=>r.info.tag);for(const r of t){let i=e;for(let s=0;s<r.length;s++){const o=r[s];let a=i.find(l=>l.label===o);a||(a={label:o,value:o},s<r.length-1&&(a.options=[{label:"All Categories",value:"all"}]),i.push(a)),s<r.length-1&&a.options&&(i=a.options)}}return e},Ox=({options:n,selections:e,level:t,onChange:r})=>{var i,s;return C.jsxs(C.Fragment,{children:[C.jsx("select",{className:"w-full rounded capitalize cursor-pointer focus:outline-none border border-gray-300 bg-white pr-3 pl-1.5 py-1.5 text-sm text-gray-900",value:e[t]||"all",onChange:o=>r(t,o.target.value),children:n.map(o=>C.jsx("option",{className:"capitalize",value:o.value,children:o.label},o.value))}),e[t]&&e[t]!=="all"&&((i=n.find(o=>o.value===e[t]))==null?void 0:i.options)&&C.jsx(Ox,{options:((s=n.find(o=>o.value===e[t]))==null?void 0:s.options)||[],level:t+1,selections:e,onChange:r})]})},Z7=({catalog:n,popupEvent:e,onClose:t})=>{const{setToast:r,selectToolDrawingLine:i,selectToolDrawingItem:s,selectToolDrawingHole:o,pushLastSelectedCatalogElementToHistory:a}=en(),[l,c]=se.useState([]),[h,f]=se.useState(["all"]),[p,d]=se.useState([]),[m,x]=se.useState(""),v=se.useRef(null),_=se.useRef(null);se.useEffect(()=>{if(e){const T=n.getCategory(e.page).elements.filter(A=>A.info.visibility?A.info.visibility.catalog:!0);v.current=e.page,d(T);const{x:q,y:O}=e.rect;_.current={top:O+Ix,left:q+Lx},e.page==="objects"&&c(K7(T))}},[e]);const E=()=>{t()},M=S=>{E(),e&&r({text:`Cancel placing ${e.page}`}),setTimeout(()=>{switch(S.prototype){case"lines":i(S.name);break;case"items":s(S.name);break;case"holes":o(S.name);break}a(S)},0)},b=(S,T)=>{const q=[...h.slice(0,S),T];f(q)};return C.jsxs(C.Fragment,{children:[e&&C.jsx("div",{className:"fixed inset-0 bg-black/30 z-10",onClick:E}),C.jsxs("div",{style:e&&e.rect?{top:e.rect.y+Ix,left:e.rect.x+Lx}:_.current?_.current:{},className:ci("fixed select-none z-10 shadow-md !gap-0 rounded-lg pt-5 fp_side-bar !min-h-[250px] !max-h-[510px] transition-all duration-200 ease-out transform",e?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),children:[C.jsxs("header",{className:"px-[18px] sticky top-0 left-0 gap-3 flex flex-col",children:[C.jsx("div",{className:"flex items-center gap-1",children:C.jsx("span",{className:ci("flex flex-col gap-0.5"),children:C.jsx("span",{className:"fp-sidebar-label capitalize",children:(e==null?void 0:e.page)??v.current})})}),C.jsxs("div",{className:ci("fp-highlight"),children:[C.jsx(Ox,{options:l,level:0,selections:h,onChange:b}),C.jsx(Y7,{className:"mt-0",placeholder:"Search",onSearch:(S,T)=>{T.preventDefault(),T.stopPropagation(),x(S)}})]})]}),p.filter(S=>S.info.title.toLowerCase().includes(m.toLowerCase())&&h.every(T=>T==="all"||S.info.tag.includes(T))).length>0?C.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 pb-5 overflow-auto w-full pt-[18px] px-4",onWheel:S=>S.stopPropagation(),children:p.filter(S=>S.info.title.toLowerCase().includes(m.toLowerCase())&&h.every(T=>T==="all"||S.info.tag.includes(T))).map(S=>C.jsxs("div",{className:"w-full space-y-1.5",children:[C.jsx("div",{className:"fp-aspect-ratio-container",children:C.jsx("div",{className:"fp-aspect-ratio-content",onMouseDown:()=>M(S),children:C.jsx("img",{draggable:!1,className:"fp-item-image",alt:S.info.title,src:S.info.image})})}),C.jsx("p",{className:"text-xs font-semibold capitalize",children:S.info.description})]},S.name.replace(/\s+/g,"_")))}):C.jsx("div",{className:"min-h-28 w-full flex items-center justify-center",children:C.jsx("p",{className:"text-sm font-medium text-gray-400 text-center",children:"No records found"})})]})]})};function J7(n){return _n({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M320 32c0-9.9-4.5-19.2-12.3-25.2S289.8-1.4 280.2 1l-179.9 45C79 51.3 64 70.5 64 92.5L64 448l-32 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 192 0 32 0 0-32 0-448zM256 256c0 17.7-10.7 32-24 32s-24-14.3-24-32s10.7-32 24-32s24 14.3 24 32zm96-128l96 0 0 352c0 17.7 14.3 32 32 32l64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0 0-320c0-35.3-28.7-64-64-64l-96 0 0 64z"},child:[]}]})(n)}function Q7(n){return _n({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M112 73c-13.75 0-24.214 4.87-33.047 13.271-8.832 8.402-15.755 20.6-20.414 34.575-5.887 17.661-7.953 38.064-6.887 56.111a57.246 57.246 0 0 1 2.461-.187c8.38-.405 16.317 1.094 23.494 4.234 14.355 6.28 25.436 18.27 34.057 32.28 15.104 24.543 23.187 55.746 24.96 80.585 114.097-14.223 124.655-14.223 238.753 0 1.772-24.84 9.855-56.042 24.959-80.586 8.62-14.009 19.702-25.999 34.057-32.28 7.875-3.444 16.67-4.898 25.955-4.046 1.066-18.047-1-38.45-6.887-56.111-4.659-13.976-11.582-26.173-20.414-34.575C424.214 77.87 413.75 73 400 73zM56.969 194.502c-.686-.008-1.38.006-2.082.04-5.621.284-11.8 1.978-18.862 5.509-23.413 11.707-26.349 65.687 14.82 79.41l4.505 1.502L86.79 391h338.42l31.44-110.037 4.504-1.502c41.17-13.723 38.234-67.703 14.82-79.41-14.121-7.061-24.722-6.775-34.367-2.555-9.645 4.22-18.564 13.23-25.943 25.22C400.906 246.7 393 282 393 304v10.195l-10.117-1.265c-128-16-125.766-16-253.766 0L119 314.195V304c0-22-7.906-57.3-22.664-81.283-7.38-11.991-16.298-21.001-25.943-25.22-4.22-1.847-8.624-2.94-13.424-2.995zM83.727 409l-23.272 23.271c11.994 3.239 33.75 3.763 42.545-1.666 3.272-4.695 6.903-14.536 10.438-21.605zm314.836 0c1.494 6.017 6.952 19.12 10.437 21.605 13.2 5.463 29.904 5.774 42.545 1.666L428.273 409z"},child:[]}]})(n)}const qx={fontSize:"19px",textDecoration:"none",fontWeight:"bold",margin:"0px",userSelect:"none"},eC=({style:n})=>C.jsx("p",{style:{...qx,...n},children:"2D"}),tC=({style:n})=>C.jsx("p",{style:{...qx,...n},children:"3D"});function nC({catalog:n,has3dView:e}){const{planner:t,setMode:r,setToast:i,selectTool3DView:s,selectToolDrawingLine:o}=en(),{mode:a,alterate:l}=t,[c,h]=se.useState(null);return C.jsxs(C.Fragment,{children:[C.jsxs("aside",{className:"floor_planner-toolbar max-h-full max-w-[50px] p-2.5 space-y-4 bg-[#2b2b2b]",children:[C.jsx(di,{active:[jr,_r].includes(a),tooltip:"Draw wall",onClick:()=>{i({text:"Cancel drawing"}),o("wall")},children:C.jsx(H7,{})}),C.jsx(di,{active:!!([vr].includes(a)&&c&&c.page==="windows"),tooltip:"Place windows",onClick:f=>{h({rect:f.currentTarget.getBoundingClientRect(),page:"windows"})},children:C.jsx(V8,{size:26})}),C.jsx(di,{active:!!([vr].includes(a)&&c&&c.page==="doors"),tooltip:"Place doors",onClick:f=>{h({rect:f.currentTarget.getBoundingClientRect(),page:"doors"})},children:C.jsx(J7,{size:26})}),C.jsx(di,{active:!!([Dr].includes(a)&&c&&c.page==="objects"),tooltip:"Place objects",onClick:f=>{h({rect:f.currentTarget.getBoundingClientRect(),page:"objects"})},children:C.jsx(Q7,{size:26})}),e?[Bi].includes(a)?C.jsx(di,{active:[fn].includes(a),tooltip:"2D View",onClick:()=>r(fn),children:C.jsx(eC,{style:{color:l?"#FF9800":""}})}):C.jsx(di,{active:[Bi].includes(a),tooltip:"3D View",onClick:s,children:C.jsx(tC,{})}):null,C.jsx(V7,{mode:a})]}),C.jsx(Z7,{catalog:n,popupEvent:c,onClose:()=>h(null)})]})}const Hl=window.hasOwnProperty("localStorage")?window.localStorage:!1,rC=500;let nm=null;function iC(n,e){return(t,r,i)=>{let s;if(e=e||rC,!!n&&Hl){if(r){t.setPlan(r);const o=r.floors[0].floorDesign;s=JSON.parse(o)}else if(Hl.getItem(n)!==null){const o=Hl.getItem(n);s=JSON.parse(o)}s&&t.loadProject(s),en.subscribe(o=>{nm&&clearTimeout(nm),nm=setTimeout(()=>{const a=Hl.getItem(n),l=JSON.stringify(o.planner.scene.toJS());if(a!==l&&(Hl.setItem(n,l),o.plan))try{const c=o.plan.floors[o.activeFloor];i&&i({floor:{floorID:c.floorID,title:c.floorTitle,description:c.floorDescription,design:l}})}catch{}},e)})}}}function sC(){return n=>{window.addEventListener("keydown",e=>{const t=n.planner,r=t.get("mode");switch(e.keyCode){case Nr.BACKSPACE:case Nr.DELETE:{[fn,qo,Bi].includes(r)&&n.remove();break}case Nr.ESC:{n.rollback();break}case Nr.Z:{(e.getModifierState("Control")||e.getModifierState("Meta"))&&(e.getModifierState("Shift")?n.redo():n.undo());break}case Nr.ALT:{of.includes(r)&&n.toggleSnap(t.snapMask.merge({SNAP_POINT:!1,SNAP_LINE:!1,SNAP_SEGMENT:!1,SNAP_GRID:!1,SNAP_GUIDE:!1,tempSnapConfiguartion:t.snapMask.toJS()}));break}case Nr.C:{let i=t.getIn(["scene","selectedLayer"]),s=t.getIn(["scene","layers",i,"selected"]);if((r===fn||r===Bi)&&(s.holes.size||s.areas.size||s.items.size||s.lines.size)){if(s.holes.size){let o=t.getIn(["scene","layers",i,"holes",s.holes.get(0)]);n.copyProperties(o.get("properties"))}else if(s.areas.size){const o=t.getIn(["scene","layers",i,"areas",s.areas.get(0)]);n.copyProperties(o.properties)}else if(s.items.size){const o=t.getIn(["scene","layers",i,"items",s.items.get(0)]);n.copyProperties(o.properties)}else if(s.lines.size){const o=t.getIn(["scene","layers",i,"lines",s.lines.get(0)]);n.copyProperties(o.properties)}}break}case Nr.V:{n.pasteProperties();break}case Nr.CTRL:{n.setAlterateState();break}}}),window.addEventListener("keyup",e=>{const t=n.planner,r=t.get("mode");switch(e.keyCode){case Nr.ALT:{of.includes(r)&&n.toggleSnap(t.snapMask.merge(t.snapMask.get("tempSnapConfiguartion")));break}case Nr.CTRL:{n.setAlterateState();break}}})}}const oC=({onBack:n,onSave:e})=>{const{undo:t,redo:r,plan:i,setPlan:s}=en(),[o,a]=se.useState(!1),l=()=>{a(!0)},c=h=>{if(!i)return;a(!1);const f=h.target.value.trim();if(f&&f!==(i==null?void 0:i.planTitle)){s({...i,planTitle:f});try{e&&e({title:f,description:""})}catch{}}};return C.jsxs("div",{className:"floor_planner-headerbar border-b border-b-[#5e5e5e] absolute flex items-center justify-between z-[9001] py-[3px] px-[1em] text-xs bg-[#2b2b2b] w-full select-none cursor-default top-0 leading-[14px] text-white m-0",children:[C.jsx(di,{className:"border border-white rounded -ml-1",active:!1,tooltip:"Go Back",onClick:()=>{n&&n()},children:C.jsx($v,{})}),C.jsx("div",{className:"flex flex-col items-center justify-center",children:o?C.jsx("input",{autoFocus:!0,type:"text",defaultValue:i==null?void 0:i.planTitle,onBlur:c,onKeyDown:h=>{(h.key==="Enter"||h.key==="Escape")&&c(h)},className:"bg-transparent border-b border-gray-400 outline-none text-lg text-center"}):C.jsx("span",{onDoubleClick:l,className:"projectName__fp text-lg",title:(i==null?void 0:i.planTitle)??"Example House",children:(i==null?void 0:i.planTitle)??"Example House"})}),C.jsxs("div",{className:"flex items-center gap-2 relative right-40",children:[C.jsx(di,{active:!1,tooltip:"Undo (CTRL-Z)",onClick:t,children:C.jsx(k8,{})}),C.jsx(di,{active:!1,tooltip:"Redo (CTRL-SHIFT-Z)",onClick:r,children:C.jsx(z8,{})})]})]})};var rm={exports:{}},Dx;function Nx(){if(Dx)return rm.exports;Dx=1;var n=rm.exports={};return n.forEach=function(e,t){for(var r=0;r<e.length;r++){var i=t(e[r]);if(i)return i}},rm.exports}var im,Ux;function aC(){return Ux||(Ux=1,im=function(n){var e=n.stateHandler.getState;function t(o){var a=e(o);return a&&!!a.isDetectable}function r(o){e(o).isDetectable=!0}function i(o){return!!e(o).busy}function s(o,a){e(o).busy=!!a}return{isDetectable:t,markAsDetectable:r,isBusy:i,markBusy:s}}),im}var sm,Fx;function lC(){return Fx||(Fx=1,sm=function(n){var e={};function t(o){var a=n.get(o);return a===void 0?[]:e[a]||[]}function r(o,a){var l=n.get(o);e[l]||(e[l]=[]),e[l].push(a)}function i(o,a){for(var l=t(o),c=0,h=l.length;c<h;++c)if(l[c]===a){l.splice(c,1);break}}function s(o){var a=t(o);a&&(a.length=0)}return{get:t,add:r,removeListener:i,removeAllListeners:s}}),sm}var om,zx;function cC(){return zx||(zx=1,om=function(){var n=1;function e(){return n++}return{generate:e}}),om}var am,kx;function uC(){return kx||(kx=1,am=function(n){var e=n.idGenerator,t=n.stateHandler.getState;function r(s){var o=t(s);return o&&o.id!==void 0?o.id:null}function i(s){var o=t(s);if(!o)throw new Error("setId required the element to have a resize detection state.");var a=e.generate();return o.id=a,a}return{get:r,set:i}}),am}var lm,Bx;function hC(){return Bx||(Bx=1,lm=function(n){function e(){}var t={log:e,warn:e,error:e};if(!n&&window.console){var r=function(i,s){i[s]=function(){var a=console[s];if(a.apply)a.apply(console,arguments);else for(var l=0;l<arguments.length;l++)a(arguments[l])}};r(t,"log"),r(t,"warn"),r(t,"error")}return t}),lm}var cm={exports:{}},Vx;function Hx(){if(Vx)return cm.exports;Vx=1;var n=cm.exports={};return n.isIE=function(e){function t(){var i=navigator.userAgent.toLowerCase();return i.indexOf("msie")!==-1||i.indexOf("trident")!==-1||i.indexOf(" edge/")!==-1}if(!t())return!1;if(!e)return!0;var r=function(){var i,s=3,o=document.createElement("div"),a=o.getElementsByTagName("i");do o.innerHTML="<!--[if gt IE "+ ++s+"]><i></i><![endif]-->";while(a[0]);return s>4?s:i}();return e===r},n.isLegacyOpera=function(){return!!window.opera},cm.exports}var um={exports:{}},Gx;function fC(){if(Gx)return um.exports;Gx=1;var n=um.exports={};n.getOption=e;function e(t,r,i){var s=t[r];return s==null&&i!==void 0?i:s}return um.exports}var hm,Wx;function dC(){if(Wx)return hm;Wx=1;var n=fC();hm=function(r){r=r||{};var i=r.reporter,s=n.getOption(r,"async",!0),o=n.getOption(r,"auto",!0);o&&!s&&(i&&i.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."),s=!0);var a=e(),l,c=!1;function h(v,_){!c&&o&&s&&a.size()===0&&d(),a.add(v,_)}function f(){for(c=!0;a.size();){var v=a;a=e(),v.process()}c=!1}function p(v){c||(v===void 0&&(v=s),l&&(m(l),l=null),v?d():f())}function d(){l=x(f)}function m(v){var _=clearTimeout;return _(v)}function x(v){var _=function(E){return setTimeout(E,0)};return _(v)}return{add:h,force:p}};function e(){var t={},r=0,i=0,s=0;function o(c,h){h||(h=c,c=0),c>i?i=c:c<s&&(s=c),t[c]||(t[c]=[]),t[c].push(h),r++}function a(){for(var c=s;c<=i;c++)for(var h=t[c],f=0;f<h.length;f++){var p=h[f];p()}}function l(){return r}return{add:o,process:a,size:l}}return hm}var fm,jx;function pC(){if(jx)return fm;jx=1;var n="_erd";function e(i){return i[n]={},t(i)}function t(i){return i[n]}function r(i){delete i[n]}return fm={initState:e,getState:t,cleanState:r},fm}var dm,Xx;function mC(){if(Xx)return dm;Xx=1;var n=Hx();return dm=function(e){e=e||{};var t=e.reporter,r=e.batchProcessor,i=e.stateHandler.getState;if(!t)throw new Error("Missing required dependency: reporter.");function s(h,f){function p(){f(h)}if(n.isIE(8))i(h).object={proxy:p},h.attachEvent("onresize",p);else{var d=l(h);if(!d)throw new Error("Element is not detectable by this strategy.");d.contentDocument.defaultView.addEventListener("resize",p)}}function o(h){var f=e.important?" !important; ":"; ";return(h.join(f)+f).trim()}function a(h,f,p){p||(p=f,f=h,h=null),h=h||{},h.debug;function d(m,x){var v=o(["display: block","position: absolute","top: 0","left: 0","width: 100%","height: 100%","border: none","padding: 0","margin: 0","opacity: 0","z-index: -1000","pointer-events: none"]),_=!1,E=window.getComputedStyle(m),M=m.offsetWidth,b=m.offsetHeight;i(m).startSize={width:M,height:b};function S(){function T(){if(E.position==="static"){m.style.setProperty("position","relative",h.important?"important":"");var A=function(L,N,Z,Y){function ee(te){return te.replace(/[^-\d\.]/g,"")}var ue=Z[Y];ue!=="auto"&&ee(ue)!=="0"&&(L.warn("An element that is positioned static has style."+Y+"="+ue+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+Y+" will be set to 0. Element: ",N),N.style.setProperty(Y,"0",h.important?"important":""))};A(t,m,E,"top"),A(t,m,E,"right"),A(t,m,E,"bottom"),A(t,m,E,"left")}}function q(){_||T();function A(N,Z){if(!N.contentDocument){var Y=i(N);Y.checkForObjectDocumentTimeoutId&&window.clearTimeout(Y.checkForObjectDocumentTimeoutId),Y.checkForObjectDocumentTimeoutId=setTimeout(function(){Y.checkForObjectDocumentTimeoutId=0,A(N,Z)},100);return}Z(N.contentDocument)}var L=this;A(L,function(Z){x(m)})}E.position!==""&&(T(),_=!0);var O=document.createElement("object");O.style.cssText=v,O.tabIndex=-1,O.type="text/html",O.setAttribute("aria-hidden","true"),O.onload=q,n.isIE()||(O.data="about:blank"),i(m)&&(m.appendChild(O),i(m).object=O,n.isIE()&&(O.data="about:blank"))}r?r.add(S):S()}n.isIE(8)?p(f):d(f,p)}function l(h){return i(h).object}function c(h){if(i(h)){var f=l(h);f&&(n.isIE(8)?h.detachEvent("onresize",f.proxy):h.removeChild(f),i(h).checkForObjectDocumentTimeoutId&&window.clearTimeout(i(h).checkForObjectDocumentTimeoutId),delete i(h).object)}}return{makeDetectable:a,addListener:s,uninstall:c}},dm}var pm,$x;function gC(){if($x)return pm;$x=1;var n=Nx().forEach;return pm=function(e){e=e||{};var t=e.reporter,r=e.batchProcessor,i=e.stateHandler.getState;e.stateHandler.hasState;var s=e.idHandler;if(!r)throw new Error("Missing required dependency: batchProcessor");if(!t)throw new Error("Missing required dependency: reporter.");var o=f(),a="erd_scroll_detection_scrollbar_style",l="erd_scroll_detection_container";function c(S){p(S,a,l)}c(window.document);function h(S){var T=e.important?" !important; ":"; ";return(S.join(T)+T).trim()}function f(){var S=500,T=500,q=document.createElement("div");q.style.cssText=h(["position: absolute","width: "+S*2+"px","height: "+T*2+"px","visibility: hidden","margin: 0","padding: 0"]);var O=document.createElement("div");O.style.cssText=h(["position: absolute","width: "+S+"px","height: "+T+"px","overflow: scroll","visibility: none","top: "+-S*3+"px","left: "+-T*3+"px","visibility: hidden","margin: 0","padding: 0"]),O.appendChild(q),document.body.insertBefore(O,document.body.firstChild);var A=S-O.clientWidth,L=T-O.clientHeight;return document.body.removeChild(O),{width:A,height:L}}function p(S,T,q){function O(Z,Y){Y=Y||function(ue){S.head.appendChild(ue)};var ee=S.createElement("style");return ee.innerHTML=Z,ee.id=T,Y(ee),ee}if(!S.getElementById(T)){var A=q+"_animation",L=q+"_animation_active",N=`/* Created by the element-resize-detector library. */
3922
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"Μagenta ltd",font_sub_family_name:"Regular"},descender:-334,familyName:"Helvetiker",lineHeight:1522,underlineThickness:50};function E6(n,e,t,r){const i=t.properties.get("step"),s=t.properties.has("color")?Xe([t.properties.get("color")]):t.properties.get("colors"),o=new Ot;o.name="streak";let a=0;for(let l=0;l<=e;l+=i){const c=[new G(0,0,-l),new G(n,0,-l)],h=new tr().setFromPoints(c),f=s.get(a%s.size),p=new vu({color:f}),d=new vl(h,p);o.add(d),o.add(new vl(h,p)),a++}return o}function b6(n,e,t,r){const i=t.properties.get("step"),s=t.properties.has("color")?Xe([t.properties.get("color")]):t.properties.get("colors"),o=new Ot;o.name="streak";let a=0;for(let l=0;l<=n;l+=i){const c=[new G(l,0,0),new G(l,0,-e)],h=new tr().setFromPoints(c),f=s.get(a%s.size),p=new vu({color:f});o.add(new vl(h,p)),a++}return o}function M6(n){const e=new Ot;e.name="grid",new _6().parse(S6);const{grids:r,width:i,height:s}=n;return r.forEach(o=>{switch(o.type){case"horizontal-streak":e.add(E6(i,s,o));break;case"vertical-streak":e.add(b6(i,s,o));break}}),e.position.y=-1,e}function w6(n){n&&n.dispose&&n.dispose()}function T6(n){n&&n.dispose&&n.dispose()}function qv(n){if(n){if(Array.isArray(n)){n.forEach(e=>qv(e));return}for(const e in n){const t=n[e];t instanceof Dn&&T6(t)}n.dispose()}}function Dv(n){(n instanceof Tn||n instanceof h4||n instanceof vl)&&(w6(n.geometry),qv(n.material),n.geometry=null,n.material=null)}function A6(n){n.traverse(e=>{Dv(e)})}function Ou(n){n.traverse(e=>{Dv(e)})}function C6(n,e,t){const r={sceneGraph:{unit:n.unit,layers:{},busyResources:{layers:{}},width:n.width,height:n.height,LODs:{}},plan:new Ot,grid:M6(n),boundingBox:new Mi};r.plan.name="plan",r.grid.name="grid",r.boundingBox.setFromObject(r.grid);let i=[];return n.layers.forEach(s=>{(s.id===n.selectedLayer||s.visible)&&(i=i.concat(qu(s,r,n,e,t)))}),Promise.all(i).then(()=>$i(r)),r}function qu(n,e,t,r,i){const s=[];return e.sceneGraph.layers[n.id]={id:n.id,lines:{},holes:{},areas:{},items:{},visible:n.visible,altitude:n.altitude},e.sceneGraph.busyResources.layers[n.id]={id:n.id,lines:{},holes:{},areas:{},items:{}},n.lines.forEach(o=>{s.push(io(t,e,n,o.id,i,r.linesActions)),o.holes.forEach(a=>{s.push(ha(t,e,n,a,i,r.holesActions))})}),n.areas.forEach(o=>{s.push(Rl(t,e,n,o.id,i,r.areaActions))}),n.items.forEach(o=>{s.push(Du(t,e,n,o.id,i,r.itemsActions))}),s}function R6(n,e,t,r,i,s){const o=r.map(l=>({op:l.op,path:l.path.split("/"),value:l.value}));let a=U6(o,e,t);return a=a.filter(({path:l})=>l[3]!=="selected"),a=a.filter(({path:l})=>l[1]!=="groups"),a.forEach(({op:l,path:c,value:h})=>{if(c[1]==="layers"){const f=e.getIn(["layers",c[2]]);if(c.length===3&&l==="remove")I6(c[2],n);else if(c.length>3)switch(l){case"replace":Cl(c,f,n,i,e,t,s);break;case"add":L6(c,f,n,i,e,t,s);break;case"remove":P6(c,f,n,i,e,t,s);break}}else if(c[1]==="selectedLayer"){const f=h,p=e.getIn(["layers",f]);if(!p.visible){const m=qu(p,n,e,i,s);Promise.all(m).then(()=>$i(n))}const d=n.sceneGraph.layers[(t==null?void 0:t.selectedLayer)??""];if(d&&!d.visible){for(let m in d.lines)Xi(n,d.id,m);for(let m in d.areas)Ss(n,d.id,m);for(let m in d.items)Es(n,d.id,m);for(let m in d.holes)ji(n,d.id,m)}}}),n}function Cl(n,e,t,r,i,s,o){let a=[];switch(n[3]){case"vertices":if(n[5]!=="selected"){const d=e.getIn(["vertices",n[4]]);if((n[5]==="x"||n[5]==="y")&&(d.lines.forEach(m=>{const x=s.getIn(["layers",e.id,"lines",m,"holes"]);return x&&x.forEach(v=>{Cl([0,0,0,"holes",v,"selected"],e,t,r,i,s,o)}),Cl([0,0,0,"lines",m],e,t,r,i,s,o)}),d.areas.forEach(m=>Cl([0,0,0,"areas",m],e,t,r,i,s,o))),n[5]==="areas"){let m=d.getIn(["areas",~~n[6]]);Cl([0,0,0,"areas",m],e,t,r,i,s,o)}}break;case"holes":const l=e.getIn(["holes",n[4]]);if(o.getElement(l.type).updateRender3D)a.push(O6(i,s,t,e,n[4],n.slice(5),o,r.holesActions,()=>ji(t,e.id,l.id),()=>ha(i,t,e,l.id,o,r.holesActions)));else{let d=l.line;n[5]==="selected"?(ji(t,e.id,l.id),a.push(ha(i,t,e,l.id,o,r.holesActions))):(e.getIn(["lines",d,"holes"]).forEach(m=>{ji(t,e.id,m)}),Xi(t,e.id,d),a.push(io(i,t,e,d,o,r.linesActions)),e.getIn(["lines",d,"holes"]).forEach(m=>{a.push(ha(i,t,e,m,o,r.holesActions))}))}break;case"lines":const c=e.getIn(["lines",n[4]]);o.getElement(c.type).updateRender3D?a.push(q6(i,s,t,e,n[4],n.slice(5),o,r.linesActions,()=>Xi(t,e.id,n[4]),()=>io(i,t,e,n[4],o,r.linesActions))):(Xi(t,e.id,n[4]),a.push(io(i,t,e,n[4],o,r.linesActions)));break;case"areas":const h=e.getIn(["areas",n[4]]);o.getElement(h.type).updateRender3D?a.push(D6(i,s,t,e,n[4],n.slice(5),o,r.areaActions,()=>Ss(t,e.id,n[4]),()=>Rl(i,t,e,n[4],o,r.areaActions))):(t.sceneGraph.layers[e.id].areas[n[4]]&&Ss(t,e.id,n[4]),a.push(Rl(i,t,e,n[4],o,r.areaActions)));break;case"items":const f=e.getIn(["items",n[4]]);o.getElement(f.type).updateRender3D?a.push(N6(i,s,t,e,n[4],n.slice(5),o,r.itemsActions,()=>Es(t,e.id,n[4]),()=>Du(i,t,e,n[4],o,r.itemsActions))):(Es(t,e.id,n[4]),a.push(Du(i,t,e,n[4],o,r.itemsActions)));break;case"visible":if(e.visible)a=a.concat(qu(e,t,i,r,o));else{let d=t.sceneGraph.layers[e.id];for(let m in d.lines)Xi(t,e.id,m);for(let m in d.areas)Ss(t,e.id,m);for(let m in d.items)Es(t,e.id,m);for(let m in d.holes)ji(t,e.id,m)}break;case"opacity":case"altitude":let p=t.sceneGraph.layers[e.id];for(let d in p.lines)Xi(t,e.id,d);for(let d in p.areas)Ss(t,e.id,d);for(let d in p.items)Es(t,e.id,d);for(let d in p.holes)ji(t,e.id,d);a=a.concat(qu(e,t,i,r,o))}Promise.all(a).then(()=>$i(t))}function P6(n,e,t,r,i,s,o){let a=[];switch(n[3]){case"lines":const l=n[4];s.getIn(["layers",e.id,"lines",l,"holes"]).forEach(c=>{ji(t,e.id,c)}),Xi(t,e.id,l),n.length>5&&(a.push(io(i,t,e,l,o,r.linesActions)),e.getIn(["lines",l,"holes"]).forEach(c=>{a.push(ha(i,t,e,c,o,r.holesActions))}));break;case"areas":n.length===5&&Ss(t,e.id,n[4]);break;case"items":n.length===5&&Es(t,e.id,n[4]);break}Promise.all(a).then(()=>$i(t))}function I6(n,e){let t=e.sceneGraph.layers[n];for(let r in t.lines)Xi(e,n,r);for(let r in t.areas)Ss(e,n,r);for(let r in t.items)Es(e,n,r);for(let r in t.holes)ji(e,n,r);delete e.sceneGraph.layers[n]}function ji(n,e,t){if(n.sceneGraph.busyResources.layers[e].holes[t]){setTimeout(()=>ji(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].holes[t]=!0;let r=n.sceneGraph.layers[e].holes[t];r&&(n.plan.remove(r),Ou(r),delete n.sceneGraph.layers[e].holes[t],delete n.sceneGraph.LODs[t],r=null,$i(n)),n.sceneGraph.busyResources.layers[e].holes[t]=!1}function Xi(n,e,t){if(n.sceneGraph.busyResources.layers[e].lines[t]){setTimeout(()=>Xi(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].lines[t]=!0;let r=n.sceneGraph.layers[e].lines[t];r&&(n.plan.remove(r),Ou(r),delete n.sceneGraph.layers[e].lines[t],delete n.sceneGraph.LODs[t],r=null,$i(n)),n.sceneGraph.busyResources.layers[e].lines[t]=!1}function Ss(n,e,t){if(n.sceneGraph.busyResources.layers[e].areas[t]){setTimeout(()=>Ss(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].areas[t]=!0;let r=n.sceneGraph.layers[e].areas[t];r&&(n.plan.remove(r),Ou(r),delete n.sceneGraph.layers[e].areas[t],delete n.sceneGraph.LODs[t],r=null,$i(n)),n.sceneGraph.busyResources.layers[e].areas[t]=!1}function Es(n,e,t){if(n.sceneGraph.busyResources.layers[e].items[t]){setTimeout(()=>Es(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].items[t]=!0;let r=n.sceneGraph.layers[e].items[t];r&&(n.plan.remove(r),Ou(r),delete n.sceneGraph.layers[e].items[t],delete n.sceneGraph.LODs[t],r=null,$i(n)),n.sceneGraph.busyResources.layers[e].items[t]=!1}function L6(n,e,t,r,i,s,o){if(n.length===5){let a=null,l=null;switch(n[3]){case"lines":a=io,l=r.linesActions;break;case"areas":a=Rl,l=r.areaActions;break;case"items":a=Du,l=r.itemsActions;break;case"holes":a=ha,l=r.holesActions;break}a&&a(i,t,e,n[4],o,l).then(()=>$i(t))}}function ha(n,e,t,r,i,s){const o=t.getIn(["holes",r]);return i.getElement(o.type).render3D(o,t,n).then(a=>{a instanceof gu&&(e.sceneGraph.LODs[r]=a);const l=new Ot;l.name="pivot",l.add(a);const c=t.getIn(["lines",o.line]);let h=t.vertices.get(c.vertices.get(0)),f=t.vertices.get(c.vertices.get(1)),p=o.offset;if(h.x>f.x){const E=h;h=f,f=E,p=1-p}let d=Math.sqrt(Math.pow(h.x-f.x,2)+Math.pow(h.y-f.y,2)),m=Math.asin((f.y-h.y)/d),x=new Mi().setFromObject(l),v=[(x.max.x-x.min.x)/2+x.min.x,(x.max.y-x.min.y)/2+x.min.y,(x.max.z-x.min.z)/2+x.min.z],_=o.properties.getIn(["altitude","length"]),b=o.properties.getIn(["height","length"]);l.rotation.y=m,l.position.x=h.x+d*p*Math.cos(m)-v[2]*Math.sin(m),l.position.y=_+b/2-v[1]+t.altitude,l.position.z=-h.y-d*p*Math.sin(m)-v[2]*Math.cos(m),e.plan.add(l),e.sceneGraph.layers[t.id].holes[o.id]=l,Nu(l,()=>s.selectHole(t.id,o.id));let M=t.opacity;o.selected&&(M=1),Uu(l,M)})}function O6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["holes",i]),f=e.getIn(["layers",r.id,"holes",i]),p=t.sceneGraph.layers[r.id].holes[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function io(n,e,t,r,i,s){if(e.sceneGraph.busyResources.layers[t.id].lines[r]){setTimeout(()=>io(n,e,t,r,i,s),100);return}e.sceneGraph.busyResources.layers[t.id].lines[r]=!0;const o=t.getIn(["lines",r]);let a=t.vertices.get(o.vertices.get(0)),l=t.vertices.get(o.vertices.get(1));if(a.x>l.x){let c=a;a=l,l=c}return i.getElement(o.type).render3D(o,t,n).then(c=>{c instanceof gu&&(e.sceneGraph.LODs[o.id]=c);let h=new Ot;h.name="pivot",h.add(c),h.position.x=a.x,h.position.y=t.altitude,h.position.z=-a.y,e.plan.add(h),e.sceneGraph.layers[t.id].lines[r]=h,Nu(h,()=>s.selectLine(t.id,o.id));let f=t.opacity;o.selected&&(f=1),Uu(h,f),e.sceneGraph.busyResources.layers[t.id].lines[r]=!1})}function q6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["lines",i]),f=e.getIn(["layers",r.id,"lines",i]),p=t.sceneGraph.layers[r.id].lines[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function Rl(n,e,t,r,i,s){if(e.sceneGraph.busyResources.layers[t.id].areas[r]){setTimeout(()=>Rl(n,e,t,r,i,s),100);return}e.sceneGraph.busyResources.layers[t.id].areas[r]=!0;const o=t.getIn(["areas",r]),a=()=>s.selectArea(t.id,r);return i.getElement(o.type).render3D(o,t,n).then(l=>{l instanceof gu&&(e.sceneGraph.LODs[r]=l);let c=new Ot;c.name="pivot",c.add(l),c.position.y=t.altitude,e.plan.add(c),e.sceneGraph.layers[t.id].areas[r]=c,Nu(c,a);let h=t.opacity;o.selected&&(h=1),Uu(c,h),e.sceneGraph.busyResources.layers[t.id].areas[r]=!1})}function D6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["areas",i]),f=e.getIn(["layers",r.id,"areas",i]),p=t.sceneGraph.layers[r.id].areas[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function Du(n,e,t,r,i,s){const o=t.getIn(["items",r]);return i.getElement(o.type).render3D(o,t,n).then(a=>{a instanceof gu&&(e.sceneGraph.LODs[r]=a);const l=new Ot;l.name="pivot",l.add(a),l.rotation.y=o.rotation*Math.PI/180,l.position.x=o.x,l.position.y=t.altitude,l.position.z=-o.y,Nu(a,()=>{s.selectItem(t.id,o.id)});let c=t.opacity;o.selected&&(c=1),Uu(l,c),e.plan.add(l),e.sceneGraph.layers[t.id].items[o.id]=l})}function N6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["items",i]),f=e.getIn(["layers",r.id,"items",i]),p=t.sceneGraph.layers[r.id].items[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function Nu(n,e){n.traverse(t=>{t instanceof Tn&&(t.interact=e)})}function Uu(n,e){n.traverse(t=>{t instanceof Tn&&(t.material instanceof Array?t.material.forEach(r=>{r.transparent=!0,r.maxOpacity?r.opacity=Math.min(r.maxOpacity,e):r.opacity&&r.opacity>e&&(r.maxOpacity=r.opacity,r.opacity=e)}):(t.material.transparent=!0,t.material.maxOpacity?t.material.opacity=Math.min(t.material.maxOpacity,e):t.material.opacity&&t.material.opacity>e&&(t.material.maxOpacity=t.material.opacity,t.material.opacity=e)))})}function $i(n){let e=new Mi().setFromObject(n.plan);if(isFinite(e.max.x)&&isFinite(e.min.x)&&isFinite(e.max.y)&&isFinite(e.min.y)&&isFinite(e.max.z)&&isFinite(e.min.z)){let t=new G((e.max.x-e.min.x)/2+e.min.x,(e.max.y-e.min.y)/2+e.min.y,(e.max.z-e.min.z)/2+e.min.z);n.plan.position.sub(t),n.grid.position.sub(t),e.min.sub(t),e.max.sub(t),n.boundingBox=e}}function U6(n,e,t){return F6(z6(k6(n)),e,t)}function F6(n,e,t){let r,i;for(i=0;i<n.length&&!r;i++)n[i].path[1]==="selectedLayer"&&(r=n[i]);return r&&!e.getIn(["layers",t.selectedLayer,"visible"])?n.filter(({op:s,path:o})=>!(o[o.length-1]==="selected"&&o[1]==="layers"&&o[2]===t.selectedLayer)&&!(s==="remove"&&o.indexOf(t.selectedLayer)!==-1)):n}function z6(n,e,t){const r={};return n.forEach(({path:i})=>{i[5]==="selected"&&(r[i[4]]=i[4])}),n.filter(({path:i})=>i[5]==="properties"?!r[i[4]]:!0)}function k6(n,e,t){const r={};return n.filter(({path:i})=>i[5]==="properties"?r[i[4]]?!1:r[i[4]]=!0:i[5]!=="misc")}const Nv={type:"change"},Gp={type:"start"},Uv={type:"end"},Fu=new ru,Fv=new ys,B6=Math.cos(70*kb.DEG2RAD),yn=new G,nr=2*Math.PI,Ft={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Wp=1e-6;class V6 extends d4{constructor(e,t=null){super(e,t),this.state=Ft.NONE,this.target=new G,this.cursor=new G,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:qo.ROTATE,MIDDLE:qo.DOLLY,RIGHT:qo.PAN},this.touches={ONE:Do.ROTATE,TWO:Do.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new G,this._lastQuaternion=new fs,this._lastTargetPosition=new G,this._quat=new fs().setFromUnitVectors(e.up,new G(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new nv,this._sphericalDelta=new nv,this._scale=1,this._panOffset=new G,this._rotateStart=new Fe,this._rotateEnd=new Fe,this._rotateDelta=new Fe,this._panStart=new Fe,this._panEnd=new Fe,this._panDelta=new Fe,this._dollyStart=new Fe,this._dollyEnd=new Fe,this._dollyDelta=new Fe,this._dollyDirection=new G,this._mouse=new Fe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=G6.bind(this),this._onPointerDown=H6.bind(this),this._onPointerUp=W6.bind(this),this._onContextMenu=J6.bind(this),this._onMouseWheel=$6.bind(this),this._onKeyDown=Y6.bind(this),this._onTouchStart=K6.bind(this),this._onTouchMove=Z6.bind(this),this._onMouseDown=j6.bind(this),this._onMouseMove=X6.bind(this),this._interceptControlDown=Q6.bind(this),this._interceptControlUp=e8.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Nv),this.update(),this.state=Ft.NONE}update(e=null){const t=this.object.position;yn.copy(t).sub(this.target),yn.applyQuaternion(this._quat),this._spherical.setFromVector3(yn),this.autoRotate&&this.state===Ft.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let r=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(r)&&isFinite(i)&&(r<-Math.PI?r+=nr:r>Math.PI&&(r-=nr),i<-Math.PI?i+=nr:i>Math.PI&&(i-=nr),r<=i?this._spherical.theta=Math.max(r,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(r+i)/2?Math.max(r,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(yn.setFromSpherical(this._spherical),yn.applyQuaternion(this._quatInverse),t.copy(this.target).add(yn),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=yn.length();o=this._clampDistance(a*this._scale);const l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const a=new G(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new G(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=yn.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(Fu.origin.copy(this.object.position),Fu.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Fu.direction))<B6?this.object.lookAt(this.target):(Fv.setFromNormalAndCoplanarPoint(this.object.up,this.target),Fu.intersectPlane(Fv,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Wp||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Wp||this._lastTargetPosition.distanceToSquared(this.target)>Wp?(this.dispatchEvent(Nv),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?nr/60*this.autoRotateSpeed*e:nr/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){yn.setFromMatrixColumn(t,0),yn.multiplyScalar(-e),this._panOffset.add(yn)}_panUp(e,t){this.screenSpacePanning===!0?yn.setFromMatrixColumn(t,1):(yn.setFromMatrixColumn(t,0),yn.crossVectors(this.object.up,yn)),yn.multiplyScalar(e),this._panOffset.add(yn)}_pan(e,t){const r=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;yn.copy(i).sub(this.target);let s=yn.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/r.clientHeight,this.object.matrix),this._panUp(2*t*s/r.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/r.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const r=this.domElement.getBoundingClientRect(),i=e-r.left,s=t-r.top,o=r.width,a=r.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(nr*this._rotateDelta.x/t.clientHeight),this._rotateUp(nr*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(nr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-nr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(nr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-nr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(r,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(r,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),i=.5*(e.pageX+r.x),s=.5*(e.pageY+r.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(nr*this._rotateDelta.x/t.clientHeight),this._rotateUp(nr*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(r,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Fe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,r={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:r.deltaY*=16;break;case 2:r.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(r.deltaY*=10),r}}function H6(n){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(n.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(n)&&(this._addPointer(n),n.pointerType==="touch"?this._onTouchStart(n):this._onMouseDown(n)))}function G6(n){this.enabled!==!1&&(n.pointerType==="touch"?this._onTouchMove(n):this._onMouseMove(n))}function W6(n){switch(this._removePointer(n),this._pointers.length){case 0:this.domElement.releasePointerCapture(n.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Uv),this.state=Ft.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function j6(n){let e;switch(n.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case qo.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(n),this.state=Ft.DOLLY;break;case qo.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=Ft.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=Ft.ROTATE}break;case qo.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=Ft.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=Ft.PAN}break;default:this.state=Ft.NONE}this.state!==Ft.NONE&&this.dispatchEvent(Gp)}function X6(n){switch(this.state){case Ft.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(n);break;case Ft.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(n);break;case Ft.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(n);break}}function $6(n){this.enabled===!1||this.enableZoom===!1||this.state!==Ft.NONE||(n.preventDefault(),this.dispatchEvent(Gp),this._handleMouseWheel(this._customWheelEvent(n)),this.dispatchEvent(Uv))}function Y6(n){this.enabled!==!1&&this._handleKeyDown(n)}function K6(n){switch(this._trackPointer(n),this._pointers.length){case 1:switch(this.touches.ONE){case Do.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(n),this.state=Ft.TOUCH_ROTATE;break;case Do.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(n),this.state=Ft.TOUCH_PAN;break;default:this.state=Ft.NONE}break;case 2:switch(this.touches.TWO){case Do.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(n),this.state=Ft.TOUCH_DOLLY_PAN;break;case Do.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(n),this.state=Ft.TOUCH_DOLLY_ROTATE;break;default:this.state=Ft.NONE}break;default:this.state=Ft.NONE}this.state!==Ft.NONE&&this.dispatchEvent(Gp)}function Z6(n){switch(this._trackPointer(n),this.state){case Ft.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(n),this.update();break;case Ft.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(n),this.update();break;case Ft.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(n),this.update();break;case Ft.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(n),this.update();break;default:this.state=Ft.NONE}}function J6(n){this.enabled!==!1&&n.preventDefault()}function Q6(n){n.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function e8(n){n.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const fa=n=>kt(n),da=n=>Bn(n),pa=n=>mt.isRecord(n),Yi=(n,e,t)=>n==="remove"?{op:n,path:e}:{op:n,path:e,value:t},t8=(n,e,t)=>{const r=[];for(let i=0;i<n;i++){r[i]=new Array(e);for(let s=0;s<e;s++)r[i][s]=t}return r},jp=mt({op:"=",val:null}),n8=mt({op:"!=",val:null,newVal:null}),r8=(n,e)=>{const t=i8(n,e);return s8(t,n,e,n.size??0,e.size??0)},i8=(n,e)=>{const t=n.size??0,r=e.size??0,i=t8(t+1,r+1,0);for(let s=0;s<t;s++)for(let o=0;o<r;o++)Kt(n.get(s),e.get(o))?i[s+1][o+1]=i[s][o]+1:i[s+1][o+1]=Math.max(i[s+1][o],i[s][o+1]);return i},s8=(n,e,t,r,i)=>{const s=[];let o=r-1,a=i-1;for(;o>=0||a>=0;)o>=0&&a>=0&&Kt(e.get(o),t.get(a))?(s.push(new jp({op:"=",val:e.get(o)})),o--,a--):o>=0&&a>=0&&o===a&&!Kt(e.get(o),t.get(a))?(s.push(new n8({val:e.get(o),newVal:t.get(o)})),o--,a--):a>=0&&(o===-1||n[o+1][a]>=n[o][a+1])?(s.push(new jp({op:"+",val:t.get(a)})),a--):o>=0&&(a===-1||n[o+1][a]<n[o][a+1])&&(s.push(new jp({op:"-",val:e.get(o)})),o--);return s.reverse()},o8=/\//g,a8=/~/g,so=n=>{if(typeof n=="number")return n.toString();if(typeof n!="string")throw new Error(`param str (${String(n)}) is not a string`);return n.replace(a8,"~0").replace(o8,"~1")},vr=(n,e)=>`${n}/${e}`,Pl=(n,e,t="")=>{let r=[];if(Kt(n,e)||n==e&&n==null)return r;const i=da(n)&&da(e);let s=null,o=null;return n.forEach&&n.forEach((a,l)=>{if(e.has(l))if(pa(a)&&pa(e.get(l)))r=r.concat(Xp(a,e.get(l),vr(t,so(l))));else if(fa(a)&&fa(e.get(l)))r=r.concat(Pl(a,e.get(l),vr(t,so(l))));else if(da(a)&&da(e.get(l)))r=r.concat(zv(a,e.get(l),vr(t,so(l))));else{const c=e.get?e.get(l):e;a!==c&&r.push(Yi("replace",vr(t,so(l)),c))}else i?(o=s!=null&&Number(s)+1===l?o:l,r.push(Yi("remove",vr(t,so(o)))),s=l):r.push(Yi("remove",vr(t,so(l))))}),e.forEach((a,l)=>{n.has&&!n.has(l)&&r.push(Yi("add",vr(t,so(l)),a))}),r},Xp=(n,e,t="")=>{let r=[];if(Kt(n,e)||n==e&&n==null)return r;const i=n.toSeq().toMap(),s=e.toSeq().toMap();return r=r.concat(Pl(i,s,t)),r},zv=(n,e,t="")=>{let r=[];if(Kt(n,e)||n==e&&n==null)return r;if((n.count()+1)*(e.count()+1)>=1e4)return Pl(n,e,t);const i=r8(n,e);let s=0;return i.forEach(o=>{if(o.op==="=")s++;else if(o.op==="!="){if(pa(o.val)&&pa(o.newVal)){const a=Xp(o.val,o.newVal,vr(t,String(s)));r=r.concat(a)}else if(fa(o.val)&&fa(o.newVal)){const a=Pl(o.val,o.newVal,vr(t,String(s)));r=r.concat(a)}else r.push(Yi("replace",vr(t,String(s)),o.newVal));s++}else o.op==="+"?(r.push(Yi("add",vr(t,String(s)),o.val)),s++):o.op==="-"&&r.push(Yi("remove",vr(t,String(s))))}),r},l8=(n,e,t="")=>n===e?[]:[Yi("replace",vr(t,""),e)],c8=(n,e,t="")=>Kt(n,e)?Xe():n!=e&&(n==null||e==null)?At([Yi("replace","/",e)]):da(n)&&da(e)?At(zv(n,e)):pa(n)&&pa(e)?At(Xp(n,e)):fa(n)&&fa(e)?At(Pl(n,e)):At(l8(n,e,t));class u8 extends se.Component{constructor(t){super(t);ut(this,"canvasWrapperRef",se.createRef());ut(this,"renderer");ut(this,"scene3D",null);ut(this,"camera",null);ut(this,"orbitControls");ut(this,"planData");ut(this,"renderingID",0);ut(this,"width");ut(this,"height");ut(this,"lastMousePosition",{});ut(this,"mouseDownEvent");ut(this,"mouseUpEvent");this.lastMousePosition={},this.width=t.width,this.height=t.height,this.renderingID=0,this.renderer=window.__threeRenderer||new g6({preserveDrawingBuffer:!0,antialias:!0}),window.__threeRenderer=this.renderer}componentDidMount(){const{state:t,actions:r}=this.props,i={areaActions:r.areaActions,holesActions:r.holesActions,itemsActions:r.itemsActions,linesActions:r.linesActions,projectActions:r.projectActions},s=t.scene,o=this.canvasWrapperRef.current,a=new dM;this.renderer.setSize(this.width,this.height),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.outputColorSpace=pr,this.renderer.physicallyCorrectLights=!0,this.renderer.setClearColor(new St(Fc.white));const l=C6(s,i,this.props.catalog);a.add(l.plan),a.add(l.grid);const c=this.width/this.height,h=new _r(45,c,1,3e5);a.add(h);const f=-(l.boundingBox.max.x-l.boundingBox.min.x)/2,p=(l.boundingBox.max.y-l.boundingBox.min.y)/2*10,d=(l.boundingBox.max.z-l.boundingBox.min.z)/2;h.position.set(f,p,d),h.up=new G(0,1,0);const m=new Q_(11513775);a.add(m);const x=new o4(Fc.white,.3);x.position.set(f,p,d),a.add(x);const v=new Q_(16777215,.6);a.add(v);const _=new l4(16777215,.6);_.position.set(100,200,100),_.castShadow=!0,a.add(_);const b=[l.plan],M=new Fe,E=new u4;this.mouseDownEvent=O=>{this.lastMousePosition.x=O.offsetX/this.width*2-1,this.lastMousePosition.y=-O.offsetY/this.height*2+1},this.mouseUpEvent=O=>{if(O.preventDefault(),M.x=O.offsetX/this.width*2-1,M.y=-(O.offsetY/this.height)*2+1,Math.abs(M.x-(this.lastMousePosition.x??0))<=.02&&Math.abs(M.y-(this.lastMousePosition.y??0))<=.02){E.setFromCamera(M,h);const A=E.intersectObjects(b,!0);A.length>0&&!isNaN(A[0].distance)?A[0].object.interact&&A[0].object.interact():this.props.actions.projectActions.unselectAll()}},this.renderer.domElement.addEventListener("mousedown",this.mouseDownEvent),this.renderer.domElement.addEventListener("mouseup",this.mouseUpEvent),this.renderer.domElement.style.display="block",o&&o.appendChild(this.renderer.domElement);const S=new V6(h,this.renderer.domElement),T=new Ot;T.name="spotLightTarget",T.position.set(S.target.x,S.target.y,S.target.z),a.add(T),x.target=T;const q=()=>{S.update(),x.position.set(h.position.x,h.position.y,h.position.z),T.position.set(S.target.x,S.target.y,S.target.z),h.updateMatrix(),h.updateMatrixWorld();for(let O in l.sceneGraph.LODs)l.sceneGraph.LODs[O].update(h);this.renderer.render(a,h),this.renderingID=requestAnimationFrame(q)};q(),this.orbitControls=S,this.camera=h,this.scene3D=a,this.planData=l}componentWillUnmount(){cancelAnimationFrame(this.renderingID),this.orbitControls.dispose(),this.renderer.domElement.removeEventListener("mousedown",this.mouseDownEvent),this.renderer.domElement.removeEventListener("mouseup",this.mouseUpEvent),this.scene3D&&(A6(this.scene3D),this.scene3D.remove(this.planData.plan),this.scene3D.remove(this.planData.grid)),this.scene3D=null,this.planData=null,this.camera=null,this.orbitControls=null,this.renderer.renderLists.dispose()}componentWillReceiveProps(t){const{width:r,height:i,actions:s}=t,o={areaActions:s.areaActions,holesActions:s.holesActions,itemsActions:s.itemsActions,linesActions:s.linesActions,projectActions:s.projectActions};if(this.width=r,this.height=i,this.camera&&(this.camera.aspect=r/i,this.camera.updateProjectionMatrix()),t.state.scene!==this.props.state.scene){const a=c8(this.props.state.scene,t.state.scene);R6(this.planData,t.state.scene,this.props.state.scene,a.toJS(),o,this.props.catalog)}this.renderer.setSize(r,i)}render(){return se.createElement("div",{ref:this.canvasWrapperRef})}}const h8={color:Nt.PRIMARY_COLOR.alt,fontWeight:300};function f8({children:n,style:e={},...t}){return C.jsx("h1",{style:{...h8,...e},...t,children:n})}const d8={padding:"0 20px",overflowY:"auto"};function p8({children:n,width:e,height:t,style:r={}}){return C.jsx("div",{style:{width:e,height:t,...d8,...r},onWheel:i=>i.stopPropagation(),children:n})}var kv={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Bv=se.createContext&&se.createContext(kv),m8=["attr","size","title"];function g8(n,e){if(n==null)return{};var t=_8(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function _8(n,e){if(n==null)return{};var t={};for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){if(e.indexOf(r)>=0)continue;t[r]=n[r]}return t}function zu(){return zu=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},zu.apply(this,arguments)}function Vv(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ku(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vv(Object(t),!0).forEach(function(r){v8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Vv(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function v8(n,e,t){return e=x8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function x8(n){var e=y8(n,"string");return typeof e=="symbol"?e:e+""}function y8(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Hv(n){return n&&n.map((e,t)=>se.createElement(e.tag,ku({key:t},e.attr),Hv(e.child)))}function cn(n){return e=>se.createElement(S8,zu({attr:ku({},n.attr)},e),Hv(n.child))}function S8(n){var e=t=>{var{attr:r,size:i,title:s}=n,o=g8(n,m8),a=i||t.size||"1em",l;return t.className&&(l=t.className),n.className&&(l=(l?l+" ":"")+n.className),se.createElement("svg",zu({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,r,o,{className:l,style:ku(ku({color:n.color||t.color},t.style),n.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&se.createElement("title",null,s),n.children)};return Bv!==void 0?se.createElement(Bv.Consumer,null,t=>e(t)):e(kv)}function E8(n){return cn({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"},child:[]}]})(n)}function b8(n){return cn({attr:{viewBox:"0 0 192 512"},child:[{tag:"path",attr:{d:"M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"},child:[]}]})(n)}function M8(n){return cn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"},child:[]}]})(n)}function w8(n){return cn({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41z"},child:[]}]})(n)}function T8(n){return cn({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(n)}function A8(n){return cn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304.083 405.907c4.686 4.686 4.686 12.284 0 16.971l-44.674 44.674c-59.263 59.262-155.693 59.266-214.961 0-59.264-59.265-59.264-155.696 0-214.96l44.675-44.675c4.686-4.686 12.284-4.686 16.971 0l39.598 39.598c4.686 4.686 4.686 12.284 0 16.971l-44.675 44.674c-28.072 28.073-28.072 73.75 0 101.823 28.072 28.072 73.75 28.073 101.824 0l44.674-44.674c4.686-4.686 12.284-4.686 16.971 0l39.597 39.598zm-56.568-260.216c4.686 4.686 12.284 4.686 16.971 0l44.674-44.674c28.072-28.075 73.75-28.073 101.824 0 28.072 28.073 28.072 73.75 0 101.823l-44.675 44.674c-4.686 4.686-4.686 12.284 0 16.971l39.598 39.598c4.686 4.686 12.284 4.686 16.971 0l44.675-44.675c59.265-59.265 59.265-155.695 0-214.96-59.266-59.264-155.695-59.264-214.961 0l-44.674 44.674c-4.686 4.686-4.686 12.284 0 16.971l39.597 39.598zm234.828 359.28l22.627-22.627c9.373-9.373 9.373-24.569 0-33.941L63.598 7.029c-9.373-9.373-24.569-9.373-33.941 0L7.029 29.657c-9.373 9.373-9.373 24.569 0 33.941l441.373 441.373c9.373 9.372 24.569 9.372 33.941 0z"},child:[]}]})(n)}const Gv={width:"14em",height:"14em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .15s ease-in-out",WebkitTransition:"all .15s ease-in-out",alignSelf:"center",justifySelf:"center"},C8={...Gv,background:Nt.SECONDARY_COLOR.main},Wv={width:"100%",textAlign:"center",display:"block",marginBottom:".5em",textTransform:"capitalize"},R8={...Wv,color:Nt.COLORS.white},P8={width:"100%",height:"8em",position:"relative",overflow:"hidden",border:"solid 1px #e6e6e6",padding:0,margin:0,marginBottom:"5px"},jv={position:"absolute",background:"#222",width:"100%",height:"100%",backgroundSize:"contain",backgroundPosition:"50% 50%",backgroundColor:Nt.COLORS.white,backgroundRepeat:"no-repeat",transition:"all .2s ease-in-out"},I8={...jv,transform:"scale(1.2)"},L8={marginTop:"1.5em",color:Nt.SECONDARY_COLOR.main,fontSize:"2em",opacity:"0.7",width:"100%"},O8={display:"block",height:"2em",margin:"0 auto",fontSize:"0.75em",fontStyle:"italic",lineHeight:"1em",WebkitLineClamp:"2",WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"},q8={listStyle:"none",margin:"0px",padding:"0px",fontSize:"11px",marginBottom:"3px"},D8={display:"inline-block",background:"#337ab7",color:Nt.COLORS.white,padding:"1px 4px",marginRight:"3px",borderRadius:"3px"},Xv=({element:n})=>{const[e,t]=se.useState(!1),{selectToolDrawingLine:r,selectToolDrawingItem:i,selectToolDrawingHole:s,pushLastSelectedCatalogElementToHistory:o}=Xt(),a=()=>{switch(n.prototype){case"lines":r(n.name);break;case"items":i(n.name);break;case"holes":s(n.name);break}o(n)};return C.jsxs("div",{style:e?C8:Gv,onClick:a,onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),children:[C.jsx("b",{style:e?R8:Wv,children:n.info.title}),C.jsx("div",{style:P8,children:C.jsx("div",{style:{...e?I8:jv,backgroundImage:"url("+n.info.image+")"},children:e?C.jsx(M8,{style:L8}):null})}),C.jsx("ul",{style:q8,children:n.info.tag.map((l,c)=>C.jsx("li",{style:D8,children:l},c))}),C.jsx("div",{style:O8,children:n.info.description})]})};function N8(n){return cn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3v7.12zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8h1.5z"},child:[]}]})(n)}function U8(n){return cn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"},child:[]}]})(n)}function F8(n){return cn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"},child:[]}]})(n)}function z8(n){return cn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 0 1 7.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"},child:[]}]})(n)}function k8(n){return cn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"},child:[]}]})(n)}function B8(n){return cn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"},child:[]}]})(n)}function $v(n){return cn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"},child:[]}]})(n)}function V8(n){return cn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 8h-6V5h6v6zm-8-6v6H5V5h6zm-6 8h6v6H5v-6zm8 6v-6h6v6h-6z"},child:[]}]})(n)}const H8={margin:"1.5em",display:"flex"},Yv={fontSize:"20px",cursor:"pointer"},G8={...Yv,fontWeight:"bolder",color:Nt.SECONDARY_COLOR.main},W8={fill:Nt.COLORS.black,fontSize:"24px",marginLeft:"10px",marginRight:"10px"},j8=({names:n})=>{let e=n.map((t,r)=>{let i=r===n.length-1;return C.jsxs("div",{style:{display:"flex"},children:[C.jsx("div",{style:i?G8:Yv,onClick:t.action||null,children:t.name}),i?null:C.jsx($v,{style:W8})]},r)});return C.jsx("div",{style:H8,children:e})},Kv={width:"14em",height:"14em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",margin:"0.3em",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .2s ease-in-out",WebkitTransition:"all .2s ease-in-out"},X8={...Kv,background:Nt.SECONDARY_COLOR.main},Zv={position:"absolute",color:Nt.COLORS.black,fontSize:"5em",width:"100%"},$8={...Zv,color:Nt.SECONDARY_COLOR.main},Y8={background:Nt.COLORS.white,marginBottom:"5px",border:"solid 1px #e6e6e6",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},K8=({page:n})=>{const[e,t]=se.useState(!1),{goBackToCatalogPage:r}=Xt(),i=s=>{r(s)};return C.jsx("div",{style:e?X8:Kv,onClick:()=>i(n.name),onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),children:C.jsx("div",{style:Y8,children:C.jsx(B8,{style:e?$8:Zv})})})},Z8={position:"fixed",width:"calc( 100% - 51px)",height:"calc( 100% - 20px)",backgroundColor:"#FFF",padding:"1em",left:50,overflowY:"auto",overflowX:"hidden",zIndex:10},J8={display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(14em, 1fr))",gridGap:"10px",marginTop:"1em"},Jv={width:"100%",height:"3em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .2s ease-in-out",WebkitTransition:"all .2s ease-in-out",marginBottom:"1em"},Q8={width:"8em",display:"inline-block"},eA={width:"calc( 100% - 10em )",height:"2em",margin:"0",padding:"0 1em",border:"1px solid #EEE"},tA={...Jv,padding:"0.2em 0.625em"},nA={width:"auto",height:"2em",lineHeight:"2em",textAlign:"center",borderRadius:"1em",display:"inline-block",cursor:"pointer",backgroundColor:Nt.PRIMARY_COLOR.alt,color:Nt.PRIMARY_COLOR.text_main,textTransform:"capitalize",margin:"0.25em",padding:"0 1em"},rA=({width:n,height:e,style:t,catalog:r})=>{const{planner:i,goBackToCatalogPage:s,selectToolDrawingHole:o,selectToolDrawingItem:a,selectToolDrawingLine:l,pushLastSelectedCatalogElementToHistory:c}=Xt();let h=i.catalog.page;const f=r.getCategory(h);let p=f.elements.filter(A=>A.info.visibility?A.info.visibility.catalog:!0);const[d,m]=se.useState(""),[x,v]=se.useState([]);let _=null;if(h!=="root"){let A=[];i.catalog.path.forEach(L=>{A.push({name:r.getCategory(L).label,action:()=>s(L)})}),A.push({name:f.label,action:""}),_=C.jsx(j8,{names:A})}let b=i.catalog.path.size,M=b>0?C.jsx(K8,{page:r.categories[i.catalog.path.get(b-1)]},b):null,E=i.get("selectedElementsHistory"),S=E.map((A,L)=>C.jsx("div",{style:nA,title:A.name,onClick:()=>O(A),children:A.name},L));const T=A=>{let L=[];for(let N=0;N<A.length;N++){let Z=A[N];L=L.concat(Z.elements),Z.categories.length&&(L=L.concat(T(Z.categories)))}return L},q=A=>{let L=p.concat(T(f.categories)),N=[];if(A!=""){let Z=new RegExp(A,"i");for(let K=0;K<L.length;K++)Z.test(L[K].info.title)&&N.push(L[K])}m(A),v(N)},O=A=>{switch(A.prototype){case"lines":l(A.name);break;case"items":a(A.name);break;case"holes":o(A.name);break}c(A)};return C.jsxs(p8,{width:n,height:e,style:{...Z8,...t},children:[C.jsx(f8,{children:"Catalog"}),_,C.jsxs("div",{style:Jv,children:[C.jsx("span",{style:Q8,children:"Search Element"}),C.jsx("input",{type:"text",style:eA,onChange:A=>{q(A.target.value)}})]}),E.size?C.jsxs("div",{style:tA,children:[C.jsx("span",{children:"Last Selected"}),S]}):null,C.jsx("div",{style:J8,children:d===""?[M,p.map(A=>C.jsx(Xv,{element:A},A.name))]:x.map(A=>C.jsx(Xv,{element:A},A.name))})]})},iA={MODE_IDLE:rn,MODE_2D_ZOOM_IN:qs,MODE_2D_ZOOM_OUT:Ds,MODE_2D_PAN:Ns,MODE_WAITING_DRAWING_LINE:Ur,MODE_DRAGGING_LINE:Fr,MODE_DRAGGING_VERTEX:zr,MODE_DRAGGING_ITEM:kr,MODE_DRAWING_LINE:cr,MODE_DRAWING_HOLE:ur,MODE_DRAWING_ITEM:wr,MODE_DRAGGING_HOLE:Br,MODE_ROTATING_ITEM:qi};function sA({width:n,height:e,catalog:t}){const r=Xt(),{planner:i}=r,{mode:s}=i;return s===Oi?C.jsx(u8,{width:n,height:e,state:i,catalog:t,actions:{areaActions:{selectArea:r.selectArea},holesActions:{selectHole:r.selectHole,selectToolDrawingHole:r.selectToolDrawingHole,updateDrawingHole:r.updateDrawingHole,endDrawingHole:r.endDrawingHole,beginDraggingHole:r.beginDraggingHole,updateDraggingHole:r.updateDraggingHole,endDraggingHole:r.endDraggingHole},itemsActions:{selectItem:r.selectItem,selectToolDrawingItem:r.selectToolDrawingItem,updateDrawingItem:r.updateDrawingItem,endDrawingItem:r.endDrawingItem,beginDraggingItem:r.beginDraggingItem,updateDraggingItem:r.updateDraggingItem,endDraggingItem:r.endDraggingItem,beginRotatingItem:r.beginRotatingItem,updateRotatingItem:r.updateRotatingItem,endRotatingItem:r.endRotatingItem},linesActions:{selectLine:r.selectLine,selectToolDrawingLine:r.selectToolDrawingLine,beginDrawingLine:r.beginDrawingLine,updateDrawingLine:r.updateDrawingLine,endDrawingLine:r.endDrawingLine,beginDraggingLine:r.beginDraggingLine,updateDraggingLine:r.updateDraggingLine,endDraggingLine:r.endDraggingLine},projectActions:{loadProject:r.loadProject,newProject:r.newProject,openCatalog:r.openCatalog,changeCatalogPage:r.changeCatalogPage,goBackToCatalogPage:r.goBackToCatalogPage,selectToolEdit:r.selectToolEdit,unselectAll:r.unselectAll,setProperties:r.setProperties,setItemsAttributes:r.setItemsAttributes,setLinesAttributes:r.setLinesAttributes,setHolesAttributes:r.setHolesAttributes,remove:r.remove,undo:r.undo,rollback:r.rollback,openProjectConfigurator:r.openProjectConfigurator,initCatalog:r.initCatalog,updateMouseCoord:r.updateMouseCoord,updateZoomScale:r.updateZoomScale,toggleSnap:r.toggleSnap,copyProperties:r.copyProperties,pasteProperties:r.pasteProperties,pushLastSelectedCatalogElementToHistory:r.pushLastSelectedCatalogElementToHistory,setAlterateState:r.setAlterateState,setMode:r.setMode,addHorizontalGuide:r.addHorizontalGuide,addVerticalGuide:r.addVerticalGuide,removeHorizontalGuide:r.removeHorizontalGuide,removeVerticalGuide:r.removeVerticalGuide}}}):s===Mo?C.jsx(C.Fragment,{}):s===sf?C.jsx(rA,{width:n,height:e,catalog:t}):iA[s]?C.jsx(ZE,{width:n,height:e,catalog:t}):s===X0?C.jsx(C.Fragment,{}):null}function Qv(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=Qv(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function oA(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=Qv(n))&&(r&&(r+=" "),r+=e);return r}const $p="-",aA=n=>{const e=cA(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:o=>{const a=o.split($p);return a[0]===""&&a.length!==1&&a.shift(),ex(a,e)||lA(o)},getConflictingClassGroupIds:(o,a)=>{const l=t[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},ex=(n,e)=>{var o;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?ex(n.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=n.join($p);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},tx=/^\[(.+)\]$/,lA=n=>{if(tx.test(n)){const e=tx.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},cA=n=>{const{theme:e,classGroups:t}=n,r={nextPart:new Map,validators:[]};for(const i in t)Yp(t[i],r,i,e);return r},Yp=(n,e,t,r)=>{n.forEach(i=>{if(typeof i=="string"){const s=i===""?e:nx(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(uA(i)){Yp(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{Yp(o,nx(e,s),t,r)})})},nx=(n,e)=>{let t=n;return e.split($p).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},uA=n=>n.isThemeGetter,hA=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const i=(s,o)=>{t.set(s,o),e++,e>n&&(e=0,r=t,t=new Map)};return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){t.has(s)?t.set(s,o):i(s,o)}}},Kp="!",Zp=":",fA=Zp.length,dA=n=>{const{prefix:e,experimentalParseClassName:t}=n;let r=i=>{const s=[];let o=0,a=0,l=0,c;for(let m=0;m<i.length;m++){let x=i[m];if(o===0&&a===0){if(x===Zp){s.push(i.slice(l,m)),l=m+fA;continue}if(x==="/"){c=m;continue}}x==="["?o++:x==="]"?o--:x==="("?a++:x===")"&&a--}const h=s.length===0?i:i.substring(l),f=pA(h),p=f!==h,d=c&&c>l?c-l:void 0;return{modifiers:s,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:d}};if(e){const i=e+Zp,s=r;r=o=>o.startsWith(i)?s(o.substring(i.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(t){const i=r;r=s=>t({className:s,parseClassName:i})}return r},pA=n=>n.endsWith(Kp)?n.substring(0,n.length-1):n.startsWith(Kp)?n.substring(1):n,mA=n=>{const e=Object.fromEntries(n.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const i=[];let s=[];return r.forEach(o=>{o[0]==="["||e[o]?(i.push(...s.sort(),o),s=[]):s.push(o)}),i.push(...s.sort()),i}},gA=n=>({cache:hA(n.cacheSize),parseClassName:dA(n),sortModifiers:mA(n),...aA(n)}),_A=/\s+/,vA=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=n.trim().split(_A);let l="";for(let c=a.length-1;c>=0;c-=1){const h=a[c],{isExternal:f,modifiers:p,hasImportantModifier:d,baseClassName:m,maybePostfixModifierPosition:x}=t(h);if(f){l=h+(l.length>0?" "+l:l);continue}let v=!!x,_=r(v?m.substring(0,x):m);if(!_){if(!v){l=h+(l.length>0?" "+l:l);continue}if(_=r(m),!_){l=h+(l.length>0?" "+l:l);continue}v=!1}const b=s(p).join(":"),M=d?b+Kp:b,E=M+_;if(o.includes(E))continue;o.push(E);const S=i(_,v);for(let T=0;T<S.length;++T){const q=S[T];o.push(M+q)}l=h+(l.length>0?" "+l:l)}return l};function xA(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=rx(e))&&(r&&(r+=" "),r+=t);return r}const rx=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=rx(n[r]))&&(t&&(t+=" "),t+=e);return t};function yA(n,...e){let t,r,i,s=o;function o(l){const c=e.reduce((h,f)=>f(h),n());return t=gA(c),r=t.cache.get,i=t.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const h=vA(l,t);return i(l,h),h}return function(){return s(xA.apply(null,arguments))}}const Sn=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},ix=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,sx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,SA=/^\d+\/\d+$/,EA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bA=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,MA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ma=n=>SA.test(n),vt=n=>!!n&&!Number.isNaN(Number(n)),bs=n=>!!n&&Number.isInteger(Number(n)),Jp=n=>n.endsWith("%")&&vt(n.slice(0,-1)),Ki=n=>EA.test(n),AA=()=>!0,CA=n=>bA.test(n)&&!MA.test(n),ox=()=>!1,RA=n=>wA.test(n),PA=n=>TA.test(n),IA=n=>!et(n)&&!tt(n),LA=n=>ga(n,hx,ox),et=n=>ix.test(n),oo=n=>ga(n,fx,CA),Qp=n=>ga(n,UA,vt),ax=n=>ga(n,cx,ox),OA=n=>ga(n,ux,PA),Bu=n=>ga(n,dx,RA),tt=n=>sx.test(n),Il=n=>_a(n,fx),qA=n=>_a(n,FA),lx=n=>_a(n,cx),DA=n=>_a(n,hx),NA=n=>_a(n,ux),Vu=n=>_a(n,dx,!0),ga=(n,e,t)=>{const r=ix.exec(n);return r?r[1]?e(r[1]):t(r[2]):!1},_a=(n,e,t=!1)=>{const r=sx.exec(n);return r?r[1]?e(r[1]):t:!1},cx=n=>n==="position"||n==="percentage",ux=n=>n==="image"||n==="url",hx=n=>n==="length"||n==="size"||n==="bg-size",fx=n=>n==="length",UA=n=>n==="number",FA=n=>n==="family-name",dx=n=>n==="shadow",zA=yA(()=>{const n=Sn("color"),e=Sn("font"),t=Sn("text"),r=Sn("font-weight"),i=Sn("tracking"),s=Sn("leading"),o=Sn("breakpoint"),a=Sn("container"),l=Sn("spacing"),c=Sn("radius"),h=Sn("shadow"),f=Sn("inset-shadow"),p=Sn("text-shadow"),d=Sn("drop-shadow"),m=Sn("blur"),x=Sn("perspective"),v=Sn("aspect"),_=Sn("ease"),b=Sn("animate"),M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...E(),tt,et],T=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto","contain","none"],O=()=>[tt,et,l],A=()=>[ma,"full","auto",...O()],L=()=>[bs,"none","subgrid",tt,et],N=()=>["auto",{span:["full",bs,tt,et]},bs,tt,et],Z=()=>[bs,"auto",tt,et],K=()=>["auto","min","max","fr",tt,et],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ce=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...O()],oe=()=>[ma,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],B=()=>[n,tt,et],xe=()=>[...E(),lx,ax,{position:[tt,et]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",DA,LA,{size:[tt,et]}],pe=()=>[Jp,Il,oo],Se=()=>["","none","full",c,tt,et],be=()=>["",vt,Il,oo],V=()=>["solid","dashed","dotted","double"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[vt,Jp,lx,ax],ue=()=>["","none",m,tt,et],ye=()=>["none",vt,tt,et],Q=()=>["none",vt,tt,et],Le=()=>[vt,tt,et],le=()=>[ma,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ki],breakpoint:[Ki],color:[AA],container:[Ki],"drop-shadow":[Ki],ease:["in","out","in-out"],font:[IA],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ki],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ki],shadow:[Ki],spacing:["px",vt],text:[Ki],"text-shadow":[Ki],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ma,et,tt,v]}],container:["container"],columns:[{columns:[vt,et,tt,a]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:q()}],"overscroll-x":[{"overscroll-x":q()}],"overscroll-y":[{"overscroll-y":q()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[bs,"auto",tt,et]}],basis:[{basis:[ma,"full","auto",a,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[vt,ma,"auto","initial","none",et]}],grow:[{grow:["",vt,tt,et]}],shrink:[{shrink:["",vt,tt,et]}],order:[{order:[bs,"first","last","none",tt,et]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:N()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:N()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":K()}],"auto-rows":[{"auto-rows":K()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...ce(),"normal"]}],"justify-self":[{"justify-self":["auto",...ce()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...ce(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ce(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...ce(),"baseline"]}],"place-self":[{"place-self":["auto",...ce()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:oe()}],w:[{w:[a,"screen",...oe()]}],"min-w":[{"min-w":[a,"screen","none",...oe()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...oe()]}],h:[{h:["screen","lh",...oe()]}],"min-h":[{"min-h":["screen","lh","none",...oe()]}],"max-h":[{"max-h":["screen","lh",...oe()]}],"font-size":[{text:["base",t,Il,oo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,tt,Qp]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Jp,et]}],"font-family":[{font:[qA,et,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,tt,et]}],"line-clamp":[{"line-clamp":[vt,"none",tt,Qp]}],leading:[{leading:[s,...O()]}],"list-image":[{"list-image":["none",tt,et]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",tt,et]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[vt,"from-font","auto",tt,oo]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[vt,"auto",tt,et]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",tt,et]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",tt,et]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:xe()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},bs,tt,et],radial:["",tt,et],conic:[bs,tt,et]},NA,OA]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:Se()}],"rounded-s":[{"rounded-s":Se()}],"rounded-e":[{"rounded-e":Se()}],"rounded-t":[{"rounded-t":Se()}],"rounded-r":[{"rounded-r":Se()}],"rounded-b":[{"rounded-b":Se()}],"rounded-l":[{"rounded-l":Se()}],"rounded-ss":[{"rounded-ss":Se()}],"rounded-se":[{"rounded-se":Se()}],"rounded-ee":[{"rounded-ee":Se()}],"rounded-es":[{"rounded-es":Se()}],"rounded-tl":[{"rounded-tl":Se()}],"rounded-tr":[{"rounded-tr":Se()}],"rounded-br":[{"rounded-br":Se()}],"rounded-bl":[{"rounded-bl":Se()}],"border-w":[{border:be()}],"border-w-x":[{"border-x":be()}],"border-w-y":[{"border-y":be()}],"border-w-s":[{"border-s":be()}],"border-w-e":[{"border-e":be()}],"border-w-t":[{"border-t":be()}],"border-w-r":[{"border-r":be()}],"border-w-b":[{"border-b":be()}],"border-w-l":[{"border-l":be()}],"divide-x":[{"divide-x":be()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":be()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[vt,tt,et]}],"outline-w":[{outline:["",vt,Il,oo]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",h,Vu,Bu]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",f,Vu,Bu]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[vt,oo]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":be()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",p,Vu,Bu]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[vt,tt,et]}],"mix-blend":[{"mix-blend":[...te(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[vt]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[tt,et]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":E()}],"mask-image-conic-pos":[{"mask-conic":[vt]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:xe()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",tt,et]}],filter:[{filter:["","none",tt,et]}],blur:[{blur:ue()}],brightness:[{brightness:[vt,tt,et]}],contrast:[{contrast:[vt,tt,et]}],"drop-shadow":[{"drop-shadow":["","none",d,Vu,Bu]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",vt,tt,et]}],"hue-rotate":[{"hue-rotate":[vt,tt,et]}],invert:[{invert:["",vt,tt,et]}],saturate:[{saturate:[vt,tt,et]}],sepia:[{sepia:["",vt,tt,et]}],"backdrop-filter":[{"backdrop-filter":["","none",tt,et]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[vt,tt,et]}],"backdrop-contrast":[{"backdrop-contrast":[vt,tt,et]}],"backdrop-grayscale":[{"backdrop-grayscale":["",vt,tt,et]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[vt,tt,et]}],"backdrop-invert":[{"backdrop-invert":["",vt,tt,et]}],"backdrop-opacity":[{"backdrop-opacity":[vt,tt,et]}],"backdrop-saturate":[{"backdrop-saturate":[vt,tt,et]}],"backdrop-sepia":[{"backdrop-sepia":["",vt,tt,et]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",tt,et]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[vt,"initial",tt,et]}],ease:[{ease:["linear","initial",_,tt,et]}],delay:[{delay:[vt,tt,et]}],animate:[{animate:["none",b,tt,et]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,tt,et]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:Q()}],"scale-x":[{"scale-x":Q()}],"scale-y":[{"scale-y":Q()}],"scale-z":[{"scale-z":Q()}],"scale-3d":["scale-3d"],skew:[{skew:Le()}],"skew-x":[{"skew-x":Le()}],"skew-y":[{"skew-y":Le()}],transform:[{transform:[tt,et,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",tt,et]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",tt,et]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[vt,Il,oo,Qp]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function ei(...n){return zA(oA(n))}const Ll=({text:n,title:e,toggleState:t,toggleOn:r,toggleOff:i})=>{const[s,o]=se.useState(!1),[a,l]=se.useState(t||!1),c=()=>{l(!a),a?i():r()};return C.jsx("div",{className:ei("w-[5.5em] text-center cursor-pointer select-none rounded-sm - mt-px mr-[5px] mb-0 ml-[5px] inline-block",s||a?"bg-[#5e5e5e] text-white border border-[#FFFFFF]":"text-[#CCCCCC] border border-[transparent]"),onMouseOver:()=>o(!0),onMouseOut:()=>o(!1),onClick:c,title:e,children:n})},px=({title:n,icon:e,textStyle:t,text:r,titleStyle:i,content:s})=>{const[o,a]=se.useState(!1),[l,c]=se.useState(!1);return C.jsxs("div",{className:"w-auto inline-block m-0 pr-1.5",children:[C.jsxs("div",{className:ei("flex items-center cursor-pointer text-center select-none",o?"text-white":"text-[#CCCCCC]"),onClick:()=>a(!o),title:n,children:[e&&e(),C.jsx("span",{className:"relative",style:t,children:r})]}),C.jsxs("div",{className:ei("fixed left-0 w-[calc(100%_-_2px)] transition-all duration-300 ease-in-out z-0 bottom-5 p-0 m-0 bg-[#2E2F33] border-t border-t-[#555]",o?"h-[40%]":"invisible h-0"),children:[C.jsxs("div",{className:"relative w-full h-[2em] top-0 left-0 border-b border-b-[#555]",children:[C.jsx("b",{className:"relative h-[2em] ml-[1em] leading-[2em]",style:i,children:n}),C.jsx(T8,{className:ei("absolute w-[2em] h-[2em] right-0 top-0 cursor-pointer p-2 border-l border-l-[#555]",l?"text-white bg-[#005FAF]":""),onMouseOver:()=>c(!0),onMouseOut:()=>c(!1),onClick:()=>a(!o)})]}),C.jsx("div",{className:"relative w-full p-[1em] overflow-y-auto h-[calc(100%_-_2em)]",children:s})]})]})};function kA(n){return cn({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM13.5 10.5h-6"},child:[]}]})(n)}function BA(n){return cn({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM10.5 7.5v6m3-3h-6"},child:[]}]})(n)}function VA(n,e,t,r,i){return r+(i-r)*(n-e)/(t-e)}const HA=()=>{const{planner:n,toggleSnap:e,viewer:t}=Xt(),{mode:r,mouse:i,zoom:s,snapMask:o}=n,a=n.get("warnings").toArray(),l=n.get("errors").toArray(),c=f=>e(o.merge(f)),h=f=>{const p=parseInt(F1(s).toFixed());if(p===0&&f==="out"||p===100&&f==="in"||!t)return;const d=t==null?void 0:t.getValue(),m=d.viewerWidth/2,x=d.viewerHeight/2,v=f==="in"?-1:1,_=1.06,b=Math.max(-1,Math.min(1,v)),M=VA(b,-1,1,_,1/_);t.zoom(m,x,M)};return C.jsxs("div",{className:"floor_planner-footerbar absolute z-[9001] py-[3px] px-[1em] text-xs bg-[#424242] h-5 w-full select-none cursor-default bottom-0 leading-[14px] text-white m-0",children:[of.includes(r)&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"relative float-left px-[1em] inline-block border-r border-r-white",title:"Scene Zoom Level",children:C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{children:"Zoom:"})," ",C.jsx(kA,{className:"inline-block cursor-pointer",size:16,onClick:()=>h("out")})," ",C.jsxs("span",{children:[F1(s).toFixed(),"%"]})," ",C.jsx(BA,{className:"inline-block cursor-pointer",size:16,onClick:()=>h("in")})]})}),C.jsxs("div",{className:"relative float-left px-[1em] inline-block border-r border-r-white",children:[C.jsx(Ll,{toggleOn:()=>{c({SNAP_POINT:!0})},toggleOff:()=>{c({SNAP_POINT:!1})},text:"Snap PT",toggleState:o.get(uf),title:"Snap to Point"}),C.jsx(Ll,{toggleOn:()=>{c({SNAP_LINE:!0})},toggleOff:()=>{c({SNAP_LINE:!1})},text:"Snap LN",toggleState:o.get(hf),title:"Snap to Line"}),C.jsx(Ll,{toggleOn:()=>{c({SNAP_SEGMENT:!0})},toggleOff:()=>{c({SNAP_SEGMENT:!1})},text:"Snap SEG",toggleState:o.get(ff),title:"Snap to Segment"}),C.jsx(Ll,{toggleOn:()=>{c({SNAP_GRID:!0})},toggleOff:()=>{c({SNAP_GRID:!1})},text:"Snap GRD",toggleState:o.get(df),title:"Snap to Grid"}),C.jsx(Ll,{toggleOn:()=>{c({SNAP_GUIDE:!0})},toggleOff:()=>{c({SNAP_GUIDE:!1})},text:"Snap GDE",toggleState:o.get(Z0),title:"Snap to Guide"})]})]}),C.jsxs("div",{className:"relative float-right inline-block px-[1em] border-l border-l-white",children:[C.jsx(px,{icon:()=>C.jsx(F8,{style:{width:"15px",height:"15px",marginTop:"-2px",marginRight:"2px",...l.length?{transform:"rotate(45deg)",color:"#F44336"}:{transform:"rotate(45deg)"}}}),text:l.length.toString(),textStyle:l.length?{color:"#F44336"}:{},title:`Errors [ ${l.length} ]`,titleStyle:l.length?{color:"#F44336"}:{},content:C.jsx(C.Fragment,{children:l.map((f,p)=>C.jsxs("div",{style:{borderBottom:"1px solid #555",lineHeight:"1.5em"},children:["[ ",new Date(f.date).toLocaleString()," ] ",f.error]},p))})}),C.jsx(px,{icon:()=>C.jsx(U8,{style:{width:"15px",height:"15px",marginTop:"-2px",marginRight:"2px",...a.length?{color:"#FFEB3B"}:{}}}),text:a.length.toString(),textStyle:a.length?{color:"#FFEB3B"}:{},title:`Warnings [ ${a.length} ]`,titleStyle:a.length?{color:"#FFEB3B"}:{},content:C.jsx(C.Fragment,{children:a.map((f,p)=>C.jsxs("div",{className:"leading-6 border-b border-b-[#555555]",children:["[ ",new Date(f.date).toLocaleString()," ] ",f.warning]},p))})})]})]})},mx=({children:n,name:e,...t})=>{const[r,i]=se.useState(t.opened||!1);return C.jsxs("div",{className:"select-none",style:{borderBottom:"1px solid #5e5e5e"},children:[C.jsxs("div",{className:"flex px-4 pt-2.5 pb-3 items-center gap-1 bg-[#2b2b2b] text-white cursor-pointer",onClick:()=>i(!r),children:[r?C.jsx(E8,{size:16}):C.jsx(b8,{size:16}),C.jsx("span",{className:"text-sm leading-none",children:e})]}),C.jsx("div",{className:ei("text-[11px] text-[#EBEBEB] border border-[#222222] bg-[#424242]",r?"block":"hidden"),children:n})]})};function ti({children:n,style:e,className:t,...r}){return C.jsx("label",{className:ei("mb-1 text-xs capitalize font-bold text-white block",t),style:e,...r,children:n})}const Zi=({value:n,min:e,max:t,precision:r,onChange:i,onValid:s,onInvalid:o,style:a,placeholder:l})=>{const[c,h]=se.useState(!0),[f,p]=se.useState(n);let d=new RegExp(`^-?([0-9]+)?\\.?([0-9]{0,${r}})?$`);se.useEffect(()=>{e!==void 0&&!isNaN(e)&&isFinite(e)&&Number(f)<e&&p(e),t&&!isNaN(t)&&isFinite(t)&&Number(f)>t&&p(t)},[e,t,f]);const m=se.useMemo(()=>parseFloat(String(n)).toFixed(r)!==parseFloat(String(f)).toFixed(r),[n,f,r]),x=v=>{if(v.stopPropagation(),c){let _=f!==""&&f!=="-"?parseFloat(String(f)):0;p(_),i({target:{value:_}})}};return C.jsxs("div",{className:"relative w-full",children:[C.jsx("input",{type:"text",value:d.test(String(f))?f:parseFloat(String(f)).toFixed(r),className:"block text-[13px] text-white h-[35px] w-full px-2 leading-5 rounded border border-[#5e5e5e] bg-[#2b2b2b] outline-none focus:outline-none",style:{...a},onChange:v=>{let _=d.test(v.target.value);_?(p(v.target.value),s&&s(v.nativeEvent)):o&&o(v.nativeEvent),h(_)},onKeyDown:v=>{var _=v.keyCode||v.which;(_==Tr.ENTER||_==Tr.TAB)&&m&&x(v)},placeholder:l}),C.jsx("div",{onClick:v=>{m&&x(v)},title:"Confirm",className:"absolute cursor-pointer w-[2em] h-[2em] text-white top-[0.35em] right-[0.35em] bg-[#1CA6FC]",style:{transition:"all 0.1s linear",visibility:m?"visible":"hidden",opacity:m?"1":"0"},children:C.jsx(N8,{style:{width:"100%",height:"100%",padding:"0.2em",color:"#FFF"}})})]})},GA={mm:{name:{singular:"Millimeter",plural:"Millimeters"},to_anchor:1/1e3},cm:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/100},m:{name:{singular:"Meter",plural:"Meters"},to_anchor:1},km:{name:{singular:"Kilometer",plural:"Kilometers"},to_anchor:1e3}},WA={in:{name:{singular:"Inch",plural:"Inches"},to_anchor:1/12},yd:{name:{singular:"Yard",plural:"Yards"},to_anchor:3},"ft-us":{name:{singular:"US Survey Foot",plural:"US Survey Feet"},to_anchor:1.000002},ft:{name:{singular:"Foot",plural:"Feet"},to_anchor:1},mi:{name:{singular:"Mile",plural:"Miles"},to_anchor:5280}},jA={metric:GA,imperial:WA,_anchors:{metric:{unit:"m",ratio:3.28084},imperial:{unit:"ft",ratio:1/3.28084}}},XA={mm2:{name:{singular:"Square Millimeter",plural:"Square Millimeters"},to_anchor:1/1e6},cm2:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/1e4},m2:{name:{singular:"Square Meter",plural:"Square Meters"},to_anchor:1},ha:{name:{singular:"Hectare",plural:"Hectares"},to_anchor:1e4},km2:{name:{singular:"Square Kilometer",plural:"Square Kilometers"},to_anchor:1e6}},$A={in2:{name:{singular:"Square Inch",plural:"Square Inches"},to_anchor:1/144},yd2:{name:{singular:"Square Yard",plural:"Square Yards"},to_anchor:9},ft2:{name:{singular:"Square Foot",plural:"Square Feet"},to_anchor:1},ac:{name:{singular:"Acre",plural:"Acres"},to_anchor:43560},mi2:{name:{singular:"Square Mile",plural:"Square Miles"},to_anchor:27878400}},YA={metric:XA,imperial:$A,_anchors:{metric:{unit:"m2",ratio:10.7639},imperial:{unit:"ft2",ratio:1/10.7639}}},KA={mcg:{name:{singular:"Microgram",plural:"Micrograms"},to_anchor:1/1e6},mg:{name:{singular:"Milligram",plural:"Milligrams"},to_anchor:1/1e3},g:{name:{singular:"Gram",plural:"Grams"},to_anchor:1},kg:{name:{singular:"Kilogram",plural:"Kilograms"},to_anchor:1e3},mt:{name:{singular:"Metric Tonne",plural:"Metric Tonnes"},to_anchor:1e6}},ZA={oz:{name:{singular:"Ounce",plural:"Ounces"},to_anchor:1/16},lb:{name:{singular:"Pound",plural:"Pounds"},to_anchor:1},t:{name:{singular:"Ton",plural:"Tons"},to_anchor:2e3}},JA={metric:KA,imperial:ZA,_anchors:{metric:{unit:"g",ratio:1/453.592},imperial:{unit:"lb",ratio:453.592}}},QA={mm3:{name:{singular:"Cubic Millimeter",plural:"Cubic Millimeters"},to_anchor:1/1e6},cm3:{name:{singular:"Cubic Centimeter",plural:"Cubic Centimeters"},to_anchor:1/1e3},ml:{name:{singular:"Millilitre",plural:"Millilitres"},to_anchor:1/1e3},cl:{name:{singular:"Centilitre",plural:"Centilitres"},to_anchor:1/100},dl:{name:{singular:"Decilitre",plural:"Decilitres"},to_anchor:1/10},l:{name:{singular:"Litre",plural:"Litres"},to_anchor:1},kl:{name:{singular:"Kilolitre",plural:"Kilolitres"},to_anchor:1e3},m3:{name:{singular:"Cubic meter",plural:"Cubic meters"},to_anchor:1e3},km3:{name:{singular:"Cubic kilometer",plural:"Cubic kilometers"},to_anchor:1e12},krm:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:1/1e3},tsk:{name:{singular:"Tesked",plural:"Teskedar"},to_anchor:5/1e3},msk:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:15/1e3},kkp:{name:{singular:"Kaffekopp",plural:"Kaffekoppar"},to_anchor:150/1e3},glas:{name:{singular:"Glas",plural:"Glas"},to_anchor:200/1e3},kanna:{name:{singular:"Kanna",plural:"Kannor"},to_anchor:2.617}},e7={tsp:{name:{singular:"Teaspoon",plural:"Teaspoons"},to_anchor:1/6},Tbs:{name:{singular:"Tablespoon",plural:"Tablespoons"},to_anchor:1/2},in3:{name:{singular:"Cubic inch",plural:"Cubic inches"},to_anchor:.55411},"fl-oz":{name:{singular:"Fluid Ounce",plural:"Fluid Ounces"},to_anchor:1},cup:{name:{singular:"Cup",plural:"Cups"},to_anchor:8},pnt:{name:{singular:"Pint",plural:"Pints"},to_anchor:16},qt:{name:{singular:"Quart",plural:"Quarts"},to_anchor:32},gal:{name:{singular:"Gallon",plural:"Gallons"},to_anchor:128},ft3:{name:{singular:"Cubic foot",plural:"Cubic feet"},to_anchor:957.506},yd3:{name:{singular:"Cubic yard",plural:"Cubic yards"},to_anchor:25852.7}},t7={metric:QA,imperial:e7,_anchors:{metric:{unit:"l",ratio:33.8140226},imperial:{unit:"fl-oz",ratio:1/33.8140226}}},n7={metric:{ea:{name:{singular:"Each",plural:"Each"},to_anchor:1},dz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12}},imperial:{},_anchors:{metric:{unit:"ea",ratio:1}}},r7={metric:{C:{name:{singular:"degree Celsius",plural:"degrees Celsius"},to_anchor:1,anchor_shift:0},K:{name:{singular:"degree Kelvin",plural:"degrees Kelvin"},to_anchor:1,anchor_shift:273.15}},imperial:{F:{name:{singular:"degree Fahrenheit",plural:"degrees Fahrenheit"},to_anchor:1},R:{name:{singular:"degree Rankine",plural:"degrees Rankine"},to_anchor:1,anchor_shift:459.67}},_anchors:{metric:{unit:"C",transform:function(n){return n/(5/9)+32}},imperial:{unit:"F",transform:function(n){return(n-32)*(5/9)}}}},gx=365.25,i7={metric:{ns:{name:{singular:"Nanosecond",plural:"Nanoseconds"},to_anchor:1/1e9},mu:{name:{singular:"Microsecond",plural:"Microseconds"},to_anchor:1/1e6},ms:{name:{singular:"Millisecond",plural:"Milliseconds"},to_anchor:1/1e3},s:{name:{singular:"Second",plural:"Seconds"},to_anchor:1},min:{name:{singular:"Minute",plural:"Minutes"},to_anchor:60},h:{name:{singular:"Hour",plural:"Hours"},to_anchor:3600},d:{name:{singular:"Day",plural:"Days"},to_anchor:3600*24},week:{name:{singular:"Week",plural:"Weeks"},to_anchor:3600*24*7},month:{name:{singular:"Month",plural:"Months"},to_anchor:3600*24*gx/12},year:{name:{singular:"Year",plural:"Years"},to_anchor:3600*24*gx}},_anchors:{metric:{unit:"s",ratio:1}}},s7={bits:{b:{name:{singular:"Bit",plural:"Bits"},to_anchor:1},Kb:{name:{singular:"Kilobit",plural:"Kilobits"},to_anchor:1024},Mb:{name:{singular:"Megabit",plural:"Megabits"},to_anchor:1048576},Gb:{name:{singular:"Gigabit",plural:"Gigabits"},to_anchor:1073741824},Tb:{name:{singular:"Terabit",plural:"Terabits"},to_anchor:1099511627776}},bytes:{B:{name:{singular:"Byte",plural:"Bytes"},to_anchor:1},KB:{name:{singular:"Kilobyte",plural:"Kilobytes"},to_anchor:1024},MB:{name:{singular:"Megabyte",plural:"Megabytes"},to_anchor:1048576},GB:{name:{singular:"Gigabyte",plural:"Gigabytes"},to_anchor:1073741824},TB:{name:{singular:"Terabyte",plural:"Terabytes"},to_anchor:1099511627776}},_anchors:{bits:{unit:"b",ratio:1/8},bytes:{unit:"B",ratio:8}}},o7={metric:{ppm:{name:{singular:"Part-per Million",plural:"Parts-per Million"},to_anchor:1},ppb:{name:{singular:"Part-per Billion",plural:"Parts-per Billion"},to_anchor:.001},ppt:{name:{singular:"Part-per Trillion",plural:"Parts-per Trillion"},to_anchor:1e-6},ppq:{name:{singular:"Part-per Quadrillion",plural:"Parts-per Quadrillion"},to_anchor:1e-9}},imperial:{},_anchors:{metric:{unit:"ppm",ratio:1e-6}}},a7={metric:{"m/s":{name:{singular:"Metre per second",plural:"Metres per second"},to_anchor:3.6},"km/h":{name:{singular:"Kilometre per hour",plural:"Kilometres per hour"},to_anchor:1}},imperial:{"m/h":{name:{singular:"Mile per hour",plural:"Miles per hour"},to_anchor:1},knot:{name:{singular:"Knot",plural:"Knots"},to_anchor:1.150779},"ft/s":{name:{singular:"Foot per second",plural:"Feet per second"},to_anchor:.681818}},_anchors:{metric:{unit:"km/h",ratio:1/1.609344},imperial:{unit:"m/h",ratio:1.609344}}},l7={Pa:{name:{singular:"pascal",plural:"pascals"},to_anchor:1/1e3},kPa:{name:{singular:"kilopascal",plural:"kilopascals"},to_anchor:1},MPa:{name:{singular:"megapascal",plural:"megapascals"},to_anchor:1e3},hPa:{name:{singular:"hectopascal",plural:"hectopascals"},to_anchor:1/10},bar:{name:{singular:"bar",plural:"bar"},to_anchor:100},torr:{name:{singular:"torr",plural:"torr"},to_anchor:101325/76e4}},c7={psi:{name:{singular:"pound per square inch",plural:"pounds per square inch"},to_anchor:1/1e3},ksi:{name:{singular:"kilopound per square inch",plural:"kilopound per square inch"},to_anchor:1}},u7={metric:l7,imperial:c7,_anchors:{metric:{unit:"kPa",ratio:.00014503768078},imperial:{unit:"psi",ratio:1/.00014503768078}}},h7={metric:{A:{name:{singular:"Ampere",plural:"Amperes"},to_anchor:1},mA:{name:{singular:"Milliampere",plural:"Milliamperes"},to_anchor:.001},kA:{name:{singular:"Kiloampere",plural:"Kiloamperes"},to_anchor:1e3}},_anchors:{metric:{unit:"A",ratio:1}}},f7={metric:{V:{name:{singular:"Volt",plural:"Volts"},to_anchor:1},mV:{name:{singular:"Millivolt",plural:"Millivolts"},to_anchor:.001},kV:{name:{singular:"Kilovolt",plural:"Kilovolts"},to_anchor:1e3}},_anchors:{metric:{unit:"V",ratio:1}}},d7={metric:{W:{name:{singular:"Watt",plural:"Watts"},to_anchor:1},mW:{name:{singular:"Milliwatt",plural:"Milliwatts"},to_anchor:.001},kW:{name:{singular:"Kilowatt",plural:"Kilowatts"},to_anchor:1e3},MW:{name:{singular:"Megawatt",plural:"Megawatts"},to_anchor:1e6},GW:{name:{singular:"Gigawatt",plural:"Gigawatts"},to_anchor:1e9}},_anchors:{metric:{unit:"W",ratio:1}}},p7={metric:{VAR:{name:{singular:"Volt-Ampere Reactive",plural:"Volt-Amperes Reactive"},to_anchor:1},mVAR:{name:{singular:"Millivolt-Ampere Reactive",plural:"Millivolt-Amperes Reactive"},to_anchor:.001},kVAR:{name:{singular:"Kilovolt-Ampere Reactive",plural:"Kilovolt-Amperes Reactive"},to_anchor:1e3},MVAR:{name:{singular:"Megavolt-Ampere Reactive",plural:"Megavolt-Amperes Reactive"},to_anchor:1e6},GVAR:{name:{singular:"Gigavolt-Ampere Reactive",plural:"Gigavolt-Amperes Reactive"},to_anchor:1e9}},_anchors:{metric:{unit:"VAR",ratio:1}}},m7={metric:{VA:{name:{singular:"Volt-Ampere",plural:"Volt-Amperes"},to_anchor:1},mVA:{name:{singular:"Millivolt-Ampere",plural:"Millivolt-Amperes"},to_anchor:.001},kVA:{name:{singular:"Kilovolt-Ampere",plural:"Kilovolt-Amperes"},to_anchor:1e3},MVA:{name:{singular:"Megavolt-Ampere",plural:"Megavolt-Amperes"},to_anchor:1e6},GVA:{name:{singular:"Gigavolt-Ampere",plural:"Gigavolt-Amperes"},to_anchor:1e9}},_anchors:{metric:{unit:"VA",ratio:1}}},g7={metric:{Wh:{name:{singular:"Watt-hour",plural:"Watt-hours"},to_anchor:3600},mWh:{name:{singular:"Milliwatt-hour",plural:"Milliwatt-hours"},to_anchor:3.6},kWh:{name:{singular:"Kilowatt-hour",plural:"Kilowatt-hours"},to_anchor:36e5},MWh:{name:{singular:"Megawatt-hour",plural:"Megawatt-hours"},to_anchor:36e8},GWh:{name:{singular:"Gigawatt-hour",plural:"Gigawatt-hours"},to_anchor:36e11},J:{name:{singular:"Joule",plural:"Joules"},to_anchor:1},kJ:{name:{singular:"Kilojoule",plural:"Kilojoules"},to_anchor:1e3}},_anchors:{metric:{unit:"J",ratio:1}}},_7={metric:{VARh:{name:{singular:"Volt-Ampere Reactive Hour",plural:"Volt-Amperes Reactive Hour"},to_anchor:1},mVARh:{name:{singular:"Millivolt-Ampere Reactive Hour",plural:"Millivolt-Amperes Reactive Hour"},to_anchor:.001},kVARh:{name:{singular:"Kilovolt-Ampere Reactive Hour",plural:"Kilovolt-Amperes Reactive Hour"},to_anchor:1e3},MVARh:{name:{singular:"Megavolt-Ampere Reactive Hour",plural:"Megavolt-Amperes Reactive Hour"},to_anchor:1e6},GVARh:{name:{singular:"Gigavolt-Ampere Reactive Hour",plural:"Gigavolt-Amperes Reactive Hour"},to_anchor:1e9}},_anchors:{metric:{unit:"VARh",ratio:1}}},v7={"mm3/s":{name:{singular:"Cubic Millimeter per second",plural:"Cubic Millimeters per second"},to_anchor:1/1e6},"cm3/s":{name:{singular:"Cubic Centimeter per second",plural:"Cubic Centimeters per second"},to_anchor:1/1e3},"ml/s":{name:{singular:"Millilitre per second",plural:"Millilitres per second"},to_anchor:1/1e3},"cl/s":{name:{singular:"Centilitre per second",plural:"Centilitres per second"},to_anchor:1/100},"dl/s":{name:{singular:"Decilitre per second",plural:"Decilitres per second"},to_anchor:1/10},"l/s":{name:{singular:"Litre per second",plural:"Litres per second"},to_anchor:1},"l/min":{name:{singular:"Litre per minute",plural:"Litres per minute"},to_anchor:1/60},"l/h":{name:{singular:"Litre per hour",plural:"Litres per hour"},to_anchor:1/3600},"kl/s":{name:{singular:"Kilolitre per second",plural:"Kilolitres per second"},to_anchor:1e3},"kl/min":{name:{singular:"Kilolitre per minute",plural:"Kilolitres per minute"},to_anchor:50/3},"kl/h":{name:{singular:"Kilolitre per hour",plural:"Kilolitres per hour"},to_anchor:5/18},"m3/s":{name:{singular:"Cubic meter per second",plural:"Cubic meters per second"},to_anchor:1e3},"m3/min":{name:{singular:"Cubic meter per minute",plural:"Cubic meters per minute"},to_anchor:50/3},"m3/h":{name:{singular:"Cubic meter per hour",plural:"Cubic meters per hour"},to_anchor:5/18},"km3/s":{name:{singular:"Cubic kilometer per second",plural:"Cubic kilometers per second"},to_anchor:1e12}},x7={"tsp/s":{name:{singular:"Teaspoon per second",plural:"Teaspoons per second"},to_anchor:1/6},"Tbs/s":{name:{singular:"Tablespoon per second",plural:"Tablespoons per second"},to_anchor:1/2},"in3/s":{name:{singular:"Cubic inch per second",plural:"Cubic inches per second"},to_anchor:.55411},"in3/min":{name:{singular:"Cubic inch per minute",plural:"Cubic inches per minute"},to_anchor:.55411/60},"in3/h":{name:{singular:"Cubic inch per hour",plural:"Cubic inches per hour"},to_anchor:.55411/3600},"fl-oz/s":{name:{singular:"Fluid Ounce per second",plural:"Fluid Ounces per second"},to_anchor:1},"fl-oz/min":{name:{singular:"Fluid Ounce per minute",plural:"Fluid Ounces per minute"},to_anchor:1/60},"fl-oz/h":{name:{singular:"Fluid Ounce per hour",plural:"Fluid Ounces per hour"},to_anchor:1/3600},"cup/s":{name:{singular:"Cup per second",plural:"Cups per second"},to_anchor:8},"pnt/s":{name:{singular:"Pint per second",plural:"Pints per second"},to_anchor:16},"pnt/min":{name:{singular:"Pint per minute",plural:"Pints per minute"},to_anchor:4/15},"pnt/h":{name:{singular:"Pint per hour",plural:"Pints per hour"},to_anchor:1/225},"qt/s":{name:{singular:"Quart per second",plural:"Quarts per second"},to_anchor:32},"gal/s":{name:{singular:"Gallon per second",plural:"Gallons per second"},to_anchor:128},"gal/min":{name:{singular:"Gallon per minute",plural:"Gallons per minute"},to_anchor:32/15},"gal/h":{name:{singular:"Gallon per hour",plural:"Gallons per hour"},to_anchor:8/225},"ft3/s":{name:{singular:"Cubic foot per second",plural:"Cubic feet per second"},to_anchor:957.506},"ft3/min":{name:{singular:"Cubic foot per minute",plural:"Cubic feet per minute"},to_anchor:957.506/60},"ft3/h":{name:{singular:"Cubic foot per hour",plural:"Cubic feet per hour"},to_anchor:957.506/3600},"yd3/s":{name:{singular:"Cubic yard per second",plural:"Cubic yards per second"},to_anchor:25852.7},"yd3/min":{name:{singular:"Cubic yard per minute",plural:"Cubic yards per minute"},to_anchor:25852.7/60},"yd3/h":{name:{singular:"Cubic yard per hour",plural:"Cubic yards per hour"},to_anchor:25852.7/3600}},y7={metric:v7,imperial:x7,_anchors:{metric:{unit:"l/s",ratio:33.8140227},imperial:{unit:"fl-oz/s",ratio:1/33.8140227}}},S7={metric:{lx:{name:{singular:"Lux",plural:"Lux"},to_anchor:1}},imperial:{"ft-cd":{name:{singular:"Foot-candle",plural:"Foot-candles"},to_anchor:1}},_anchors:{metric:{unit:"lx",ratio:1/10.76391},imperial:{unit:"ft-cd",ratio:10.76391}}},E7={metric:{mHz:{name:{singular:"millihertz",plural:"millihertz"},to_anchor:1/1e3},Hz:{name:{singular:"hertz",plural:"hertz"},to_anchor:1},kHz:{name:{singular:"kilohertz",plural:"kilohertz"},to_anchor:1e3},MHz:{name:{singular:"megahertz",plural:"megahertz"},to_anchor:1e3*1e3},GHz:{name:{singular:"gigahertz",plural:"gigahertz"},to_anchor:1e3*1e3*1e3},THz:{name:{singular:"terahertz",plural:"terahertz"},to_anchor:1e3*1e3*1e3*1e3},rpm:{name:{singular:"rotation per minute",plural:"rotations per minute"},to_anchor:1/60},"deg/s":{name:{singular:"degree per second",plural:"degrees per second"},to_anchor:1/360},"rad/s":{name:{singular:"radian per second",plural:"radians per second"},to_anchor:1/(Math.PI*2)}},_anchors:{frequency:{unit:"hz",ratio:1}}},Ms={length:jA,area:YA,mass:JA,volume:t7,each:n7,temperature:r7,time:i7,digital:s7,partsPer:o7,speed:a7,pressure:u7,current:h7,voltage:f7,power:d7,reactivePower:p7,apparentPower:m7,energy:g7,reactiveEnergy:_7,volumeFlowRate:y7,illuminance:S7,frequency:E7};function Ol(n){return Object.keys(n)}function _x(n){return{abbr:n.abbr,measure:n.measure,system:n.system,singular:n.unit.name.singular,plural:n.unit.name.plural}}function Lr(n,e){if(Array.isArray(n))for(let t=0;t<n.length;t++)e(n[t],t,n);else if(n&&typeof n=="object")for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(n[t],t,n)}class b7{constructor(e,t){ut(this,"val");ut(this,"destination");ut(this,"origin");this.val=t?e/t:e}from(e){if(this.destination)throw new Error(".from must be called before .to");return this.origin=this.getUnit(e),this.origin||this.throwUnsupportedUnitError(e),this}to(e){if(!this.origin)throw new Error(".to must be called after .from");if(this.destination=this.getUnit(e),this.destination||this.throwUnsupportedUnitError(e),this.origin.abbr===this.destination.abbr)return this.val;if(this.destination.measure!==this.origin.measure)throw new Error(`Cannot convert incompatible measures of ${this.destination.measure} and ${this.origin.measure}`);let t=this.val*this.origin.unit.to_anchor;if(this.origin.unit.anchor_shift&&(t-=this.origin.unit.anchor_shift),this.origin.system!==this.destination.system){const r=Ms[this.origin.measure]._anchors[this.origin.system];t=typeof r.transform=="function"?r.transform(t):t*r.ratio}return this.destination.unit.anchor_shift&&(t+=this.destination.unit.anchor_shift),t/this.destination.unit.to_anchor}toBest(e){if(!this.origin)throw new Error(".toBest must be called after .from");const t={exclude:[],cutOffNumber:1,...e};let r=null;return Lr(this.possibilities(),i=>{if(t.exclude.includes(i))return;const s=this.describe(i);if(s.system!==this.origin.system)return;const o=this.to(i);(!r||o>=t.cutOffNumber&&o<r.val)&&(r={val:o,unit:i,singular:s.singular,plural:s.plural})}),r}getUnit(e){let t=null;return Lr(Ms,(r,i)=>{Lr(r,(s,o)=>{o!=="_anchors"&&Lr(s,(a,l)=>{l===e&&(t={abbr:e,measure:i,system:o,unit:a})})})}),t}describe(e){const t=this.getUnit(e);return t||this.throwUnsupportedUnitError(e),_x(t)}list(e){const t=[];return Lr(Ms,(r,i)=>{e&&e!==i||Lr(r,(s,o)=>{o!=="_anchors"&&Lr(s,(a,l)=>{t.push(_x({abbr:l,measure:i,system:o,unit:a}))})})}),t}throwUnsupportedUnitError(e){const t=[];throw Lr(Ms,r=>{Lr(r,(i,s)=>{s!=="_anchors"&&t.push(...Ol(i))})}),new Error(`Unsupported unit ${e}, use one of: ${t.join(", ")}`)}possibilities(e){const t=[];if(!this.origin&&!e)Lr(Ol(Ms),r=>{Lr(Ms[r],(i,s)=>{s!=="_anchors"&&t.push(...Ol(i))})});else{const r=e||this.origin.measure;Lr(Ms[r],(i,s)=>{s!=="_anchors"&&t.push(...Ol(i))})}return t}measures(){return Ol(Ms)}}function ni(n){return new b7(n)}const M7={fontSize:"13px",WebkitAppearance:"none"};function em({children:n,style:e,...t}){return C.jsx("select",{className:"w-full cursor-pointer block px-2 outline-none rounded h-[35px] text-white bg-[#5e5e5e]",style:{...M7,...e},...t,children:n})}const tm=({value:n,onUpdate:e,onValid:t,configs:r,sourceElement:i,internalState:s})=>{const{planner:o}=Xt(),a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||fi,{hook:h,label:f,...p}=r,d=(m,x)=>{let v=Jn(m),_=n.merge({length:x!==fi?ni(v).from(x).to(fi):v,_length:m,_unit:x});return h?h(_,i,s,o).then(b=>e(b)):e(_)};return C.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[C.jsx(ti,{children:f}),C.jsxs("div",{className:"w-full flex",children:[C.jsx(Zi,{value:l,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},onChange:m=>d(m.target.value,c),onValid:t,...p}),C.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:C.jsx(em,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>d(l,m.target.value),children:$0.map(m=>C.jsx("option",{value:m,children:m},m))})})]})]})},ql=({style:n,...e})=>C.jsx("input",{className:"block w-full px-2 text-sm leading-5 bg-[#2b2b2b] rounded border border-[#5e5e5e] outline-none h-[35px] text-white",style:{...n},type:"text",...e}),w7=({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i})=>{const{planner:s}=Xt(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return C.jsxs("div",{className:"PropertyString w-full mb-2",children:[C.jsx(ti,{children:t.label}),C.jsx(ql,{value:n,onChange:a=>o(a.target.value)})]})},T7=({element:n,attributeFormData:e,onUpdate:t,...r})=>{let i=e.has("name")?e.get("name"):n.name,s=e.has("offsetA")?e.get("offsetA"):n.offsetA,o=e.has("offsetB")?e.get("offsetB"):n.offsetA;return C.jsxs("div",{children:[C.jsx(w7,{value:i,onUpdate:a=>t("name",a),configs:{label:"Nome"},...r}),C.jsx(tm,{value:s,onUpdate:a=>t("offsetA",a),configs:{label:"Offset 1",min:0,max:1/0,precision:2},...r}),C.jsx(tm,{value:o,onUpdate:a=>t("offsetB",a),configs:{label:"Offset 2",min:0,max:1/0,precision:2},...r})]})},A7=({element:n,onUpdate:e,attributeFormData:t,...r})=>{let i=t.has("name")?t.get("name"):n.name,s=t.has("x")?t.get("x"):n.x,o=t.has("y")?t.get("y"):n.y,a=t.has("rotation")?t.get("rotation"):n.rotation;return C.jsx("table",{className:"w-full",children:C.jsxs("tbody",{children:[C.jsxs("tr",{children:[C.jsx("td",{className:"w-[6em]",children:"Name"}),C.jsx("td",{children:C.jsx(ql,{value:i,onChange:l=>e("name",l.target.value),style:{textAlign:"left"}})})]}),C.jsxs("tr",{children:[C.jsx("td",{className:"w-[6em]",children:"X"}),C.jsx("td",{children:C.jsx(Zi,{value:s,onChange:l=>e("x",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),C.jsxs("tr",{children:[C.jsx("td",{className:"w-[6em]",children:"Y"}),C.jsx("td",{children:C.jsx(Zi,{value:o,onChange:l=>e("y",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),C.jsxs("tr",{children:[C.jsx("td",{className:"w-[6em]",children:"Rotation"}),C.jsx("td",{children:C.jsx(Zi,{value:a,onChange:l=>e("rotation",l.target.value),style:{textAlign:"left"},precision:2,...r})})]})]})})},C7=({element:n,onUpdate:e,attributeFormData:t})=>{let r=t.has("name")?t.get("name"):n.name,i=t.has("lineLength")?t.get("lineLength"):null;return C.jsxs("div",{children:[C.jsxs("div",{className:"w-full mb-2",children:[C.jsx(ti,{children:"Name"}),C.jsx(ql,{value:r,onChange:s=>e("name",s.target.value),style:{textAlign:"left"}})]}),C.jsx(tm,{value:i,onUpdate:s=>e("lineLength",s),configs:{label:"Length",min:0,max:1/0,precision:2}})]})},R7=({element:n,onUpdate:e,onValid:t,attributeFormData:r,...i})=>n.prototype==="items"?C.jsx(A7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):n.prototype==="lines"?C.jsx(C7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):n.prototype==="holes"?C.jsx(T7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):null,ri=2,P7=(n,e,t)=>{switch(n=typeof n.misc=="object"?n.set("misc",Pe(n.misc)):n,n.prototype){case"items":return Pe(n);case"lines":{let r=e.vertices.get(n.vertices.get(0)),i=e.vertices.get(n.vertices.get(1)),s=Ln(r.x,r.y,i.x,i.y),o=n.misc.get("_unitLength")||t.unit,a=ni(s).from(t.unit).to(o);return Pe({vertexOne:r,vertexTwo:i,lineLength:Pe({length:s,_length:a,_unit:o})})}case"holes":{let r=e.lines.get(n.line),{x:i,y:s}=e.vertices.get(r.vertices.get(0)),{x:o,y:a}=e.vertices.get(r.vertices.get(1)),l=Ln(i,s,o,a),c=l*n.offset-n.properties.get("width").get("length")/2,h=n.misc.get("_unitA")||t.unit,f=ni(c).from(t.unit).to(h),p=l-l*n.offset-n.properties.get("width").get("length")/2,d=n.misc.get("_unitB")||t.unit,m=ni(p).from(t.unit).to(d);return Pe({offset:n.offset,offsetA:Pe({length:Jn(c,ri),_length:Jn(f,ri),_unit:h}),offsetB:Pe({length:Jn(p,ri),_length:Jn(m,ri),_unit:d})})}case"areas":return Pe({});default:return null}},I7=(n,e)=>{const t=e.getElement(n.type),r={};for(const i in t.properties)r[i]=Pe({currentValue:n.properties.has(i)?n.properties.get(i):At(t.properties[i].defaultValue),configs:t.properties[i]});return Pe(r)},L7=({element:n,layer:e,catalog:t})=>{const{planner:r,setItemsAttributes:i,setProperties:s,setLinesAttributes:o,setHolesAttributes:a}=Xt(),[l,c]=se.useState(P7(n,e,t)),[h,f]=se.useState(I7(n,t)),p=({propertiesFormData:x,attributesFormData:v})=>{if(x){let _=x.map(b=>b.get("currentValue"));s(_)}if(v)switch(n.prototype){case"items":{i(v);break}case"lines":{o(v);break}case"holes":{a(v);break}}},d=(x,v)=>{if(!l)return;let _;switch(n.prototype){case"items":{_=l.set(x,v);break}case"lines":{switch(x){case"lineLength":{let b=l.get("vertexOne"),M=l.get("vertexTwo"),[E,S]=Qa([b,M]),T=mc(E.x,E.y,S.x,S.y,v.get("length"),ri);_=l.withMutations(q=>{q.set(b===E?"vertexTwo":"vertexOne",S.merge(T)),q.set("lineLength",v)});break}case"vertexOne":case"vertexTwo":{_=l.withMutations(b=>{b.set(x,b.get(x).merge(v));let M=fc(b.get("vertexOne"),b.get("vertexTwo"));b.mergeIn(["lineLength"],b.get("lineLength").merge({length:M,_length:ni(M).from(t.unit).to(b.get("lineLength").get("_unit"))}))});break}default:{_=l.set(x,v);break}}break}case"holes":{switch(x){case"offsetA":{let b=e.lines.get(n.line),M=Qa([e.vertices.get(b.vertices.get(0)),e.vertices.get(b.vertices.get(1))]),[{x:E,y:S},{x:T,y:q}]=M,O=cf(E,S,T,q),A=Ln(E,S,T,q),L=n.properties.get("width").get("length"),N=L/2,Z=v.get("length");Z=Math.max(Z,0),Z=Math.min(Z,A-L);let K=(Z+N)*Math.cos(O)+E,ne=(Z+N)*Math.sin(O)+S,ce=On(E,S,T,q,K,ne),J=Jn(A-A*ce-N,ri),oe=l.getIn(["offsetB","_unit"]),B=Pe({length:J,_length:ni(J).from(t.unit).to(oe),_unit:oe});_=l.set("offsetB",B).set("offset",ce);let xe=Pe({length:Jn(Z,ri),_unit:v.get("_unit"),_length:Jn(ni(Z).from(t.unit).to(v.get("_unit")),ri)});_=l.set(x,xe);break}case"offsetB":{let b=e.lines.get(n.line),M=Qa([e.vertices.get(b.vertices.get(0)),e.vertices.get(b.vertices.get(1))]),[{x:E,y:S},{x:T,y:q}]=M,O=cf(E,S,T,q),A=Ln(E,S,T,q),L=n.properties.get("width").get("length"),N=L/2,Z=v.get("length");Z=Math.max(Z,0),Z=Math.min(Z,A-L);let K=T-(Z+N)*Math.cos(O),ne=q-(Z+N)*Math.sin(O),ce=On(E,S,T,q,K,ne),J=Jn(A*ce-N,ri),oe=l.getIn(["offsetA","_unit"]),B=Pe({length:J,_length:ni(J).from(t.unit).to(oe),_unit:oe});_=l.set("offsetA",B).set("offset",ce);let xe=Pe({length:Jn(Z,ri),_unit:v.get("_unit"),_length:Jn(ni(Z).from(t.unit).to(v.get("_unit")),ri)});_=l.set(x,xe);break}default:{_=l.set(x,v);break}}break}}_&&(c(_),p({attributesFormData:_,propertiesFormData:h}))},m=(x,v)=>{const _=h.setIn([x,"currentValue"],v);f(_),p({propertiesFormData:_,attributesFormData:l})};return C.jsxs("div",{children:[C.jsx(R7,{element:n,onValid:()=>{},onUpdate:d,attributeFormData:l}),h.entrySeq().map(([x,v])=>{let _=v.get("currentValue"),b=v.get("configs"),{Editor:M}=t.getPropertyType(b.type);return C.jsx(M,{propertyName:x,value:_,configs:b,onUpdate:E=>m(x,E),state:r,sourceElement:n,internalState:{attributesFormData:l,propertiesFormData:h}},x)})]})},O7=()=>C.jsxs("div",{className:"h-full flex flex-col gap-4 justify-center items-center",children:[C.jsx("div",{className:"text-3xl text-white",children:C.jsx("img",{src:"/assets/icons/bullseye-arrow.svg",alt:"bullseye-arrow",width:34,height:34})}),C.jsx("p",{className:"mx-4 text-white text-sm text-center",children:"Select an element on the canvas to edit its properties."})]}),q7=[rn,qs,Ds,Ns,Oi,Mo,Ur,cr,ur,wr,Fr,zr,kr,Br,qi,nf,rf],D7=({catalog:n})=>{const{planner:e}=Xt(),{scene:t,mode:r}=e;return q7.includes(r)?t.layers.valueSeq().flatMap(s=>gn().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>({element:o,layer:s}))).toArray().length===0?C.jsx(O7,{}):C.jsx("div",{children:t.layers.valueSeq().map(s=>gn().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>C.jsx(mx,{name:"Properties",opened:!0,children:C.jsx("div",{style:{padding:"5px 15px"},children:C.jsx(L7,{element:o,layer:s,catalog:n})})},o.id)).valueSeq())}):null},N7={MODE_IDLE:rn,MODE_2D_ZOOM_IN:qs,MODE_2D_ZOOM_OUT:Ds,MODE_2D_PAN:Ns,MODE_3D_VIEW:Oi,MODE_3D_FIRST_PERSON:Mo,MODE_WAITING_DRAWING_LINE:Ur,MODE_DRAWING_LINE:cr,MODE_DRAWING_HOLE:ur,MODE_DRAWING_ITEM:wr,MODE_DRAGGING_LINE:Fr,MODE_DRAGGING_VERTEX:zr,MODE_DRAGGING_ITEM:kr,MODE_DRAGGING_HOLE:Br,MODE_FITTING_IMAGE:rf,MODE_UPLOADING_IMAGE:nf,MODE_ROTATING_ITEM:qi},U7={width:"100%"},Hu={width:"6em"},Gu={textAlign:"left"},F7={marginLeft:"5px",border:"0px",background:"none",color:"#FFFFFF",fontSize:"14px",outline:"0px"},z7={width:"100%",cursor:"pointer",maxHeight:"20em",marginLeft:"1px",marginTop:"1em"},vx={width:"2em"},k7=({groupID:n})=>{const{planner:e,setGroupAttributes:t,groupTranslate:r,groupRotate:i,removeFromGroup:s}=Xt(),{mode:o}=e;if(!n||!N7[o])return null;const a=e.getIn(["scene","groups",n]),l=a.get("elements");return C.jsx(mx,{name:`Group [${a.get("name")}]`,opened:!0,children:C.jsxs("div",{style:{padding:"5px 15px"},children:[C.jsx("table",{style:U7,children:C.jsxs("tbody",{children:[C.jsxs("tr",{children:[C.jsx("td",{style:Hu,children:"Name"}),C.jsx("td",{children:C.jsx(ql,{value:a.get("name"),onChange:c=>t(n,Pe({name:c.target.value})),style:Gu})})]}),C.jsxs("tr",{children:[C.jsx("td",{style:Hu,children:"X"}),C.jsx("td",{children:C.jsx(Zi,{value:a.get("x"),onChange:c=>r(n,c.target.value,a.get("y")),style:Gu,precision:2})})]}),C.jsxs("tr",{children:[C.jsx("td",{style:Hu,children:"Y"}),C.jsx("td",{children:C.jsx(Zi,{value:a.get("y"),onChange:c=>r(n,a.get("x"),c.target.value),style:Gu,precision:2})})]}),C.jsxs("tr",{children:[C.jsx("td",{style:Hu,children:"Rotation"}),C.jsx("td",{children:C.jsx(Zi,{value:a.get("rotation"),onChange:c=>i(n,c.target.value),style:Gu,precision:2})})]})]})}),l.size?C.jsxs("div",{children:[C.jsx("p",{style:{textAlign:"center",borderBottom:"1px solid #555",paddingBottom:"1em"},children:"Group's Elements"}),C.jsxs("table",{style:z7,children:[C.jsx("thead",{children:C.jsxs("tr",{children:[C.jsx("th",{style:vx}),C.jsx("th",{children:"Layer"}),C.jsx("th",{children:"Prototype"}),C.jsx("th",{children:"Name"})]})}),C.jsx("tbody",{children:l.entrySeq().map(([c,h])=>h.entrySeq().map(([f,p])=>p.valueSeq().map(d=>{let m=e.getIn(["scene","layers",c,f,d]);return C.jsxs("tr",{children:[C.jsx("td",{style:vx,title:"Un-chain Element from Group",children:C.jsx(A8,{onClick:()=>s(n,c,f,d),style:F7})}),C.jsx("td",{style:{textAlign:"center"},children:c}),C.jsx("td",{style:{textAlign:"center",textTransform:"capitalize"},children:f}),C.jsx("td",{style:{textAlign:"center"},children:m.name})]},d)})))})]})]}):null]})})},B7=({catalog:n})=>{const{planner:e}=Xt(),t=e.getIn(["scene","selectedLayer"]),r=e.getIn(["scene","layers",t,"selected"]),i=e.getIn(["scene","groups"]).findEntry(o=>o.get("selected")),s=r.lines.size>1||r.items.size>1||r.holes.size>1||r.areas.size>1||r.lines.size+r.items.size+r.holes.size+r.areas.size>1;return C.jsxs("aside",{onKeyDown:o=>o.stopPropagation(),onKeyUp:o=>o.stopPropagation(),className:"floor_planner-sidebar w-[300px] bg-[#424242] h-[calc(100%_-_20px)] block overflow-y-auto overflow-x-hidden pb-5",children:[!s&&C.jsx(D7,{catalog:n}),!!i&&C.jsx(k7,{groupID:i?i[0]:null})]})},ii=({active:n,tooltip:e,onClick:t,children:r,className:i})=>{const[s,o]=se.useState(!1),a=n||s?"text-[#1CA6FC]":"text-[#C2C2C2]";return C.jsxs("div",{className:ei("w-[30px] h-[30px] flex items-center justify-center text-[25px] relative cursor-pointer",i),onMouseOver:()=>o(!0),onMouseOut:()=>o(!1),children:[C.jsx("div",{className:a,onClick:t,children:r}),s&&C.jsxs("div",{className:"absolute w-[140px] text-white bg-black h-[30px] leading-[30px] text-center rounded-md opacity-80 left-full top-1/2 -mt-[15px] ml-[15px] z-[999] text-[12px]",children:[C.jsx("span",{className:"absolute top-1/2 right-full -mt-[8px] w-0 h-0 border-r-[8px] border-r-black border-t-[8px] border-t-transparent border-b-[8px] border-b-transparent"}),e]})]})},xx=()=>new Promise(async n=>{const e=document.getElementsByTagName("svg");if(!e.length)return;let t=e[0];for(let p=1;p<e.length;p++)e[p].width.baseVal.value>t.width.baseVal.value&&(t=e[p]);const r=t.cloneNode(!0),i=r.querySelectorAll("image");await Promise.all(Array.from(i).map(async p=>{const d=p.getAttribute("href")||p.getAttribute("xlink:href");if(d)try{const x=await(await fetch(d)).blob(),v=new FileReader;await new Promise(_=>{v.onloadend=()=>{p.setAttribute("href",v.result),_()},v.readAsDataURL(x)})}catch(m){console.warn("⚠️ Could not inline image:",d,m)}}));const o=new XMLSerializer().serializeToString(r),a=t.width.baseVal.value,l=t.height.baseVal.value,c=document.createElement("canvas");c.width=a,c.height=l;const h=c.getContext("2d");h.fillStyle="white",h.fillRect(0,0,a,l);const f=new Image;f.src=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(o)))}`,f.onload=()=>{h.drawImage(f,0,0,a,l),n(c.toDataURL("image/png"))}});function yx(n){return cn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 19a2 2 0 0 1 -2 -2"},child:[]},{tag:"path",attr:{d:"M5 13v-2"},child:[]},{tag:"path",attr:{d:"M5 7a2 2 0 0 1 2 -2"},child:[]},{tag:"path",attr:{d:"M11 5h2"},child:[]},{tag:"path",attr:{d:"M17 5a2 2 0 0 1 2 2"},child:[]},{tag:"path",attr:{d:"M19 11v2"},child:[]},{tag:"path",attr:{d:"M19 17v4"},child:[]},{tag:"path",attr:{d:"M21 19h-4"},child:[]},{tag:"path",attr:{d:"M13 19h-2"},child:[]}]})(n)}const Sx=n=>{let e=document.createElement("a"),t="output"+Date.now()+".png";t=window.prompt("Insert output filename",t),t&&(e.setAttribute("download",t),e.href=n,e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e))};function V7({mode:n}){const e=r=>{r.preventDefault();const i=document.getElementsByTagName("canvas")[0];Sx(i.toDataURL())},t=async r=>{r.preventDefault(),xx().then(Sx)};return[Mo,Oi].includes(n)?C.jsx(ii,{active:!1,tooltip:"Get Screenshot",onClick:e,children:C.jsx(yx,{size:28})}):[rn,qs,Ds,Ns,Ur,Fr,zr,kr,cr,ur,wr,Br,qi].includes(n)?C.jsx(ii,{active:!1,tooltip:"Get Screenshot",onClick:t,children:C.jsx(yx,{size:28})}):null}function H7(n){return cn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M12 9v6"},child:[]},{tag:"path",attr:{d:"M16 15v6"},child:[]},{tag:"path",attr:{d:"M16 3v6"},child:[]},{tag:"path",attr:{d:"M3 15h18"},child:[]},{tag:"path",attr:{d:"M3 9h18"},child:[]},{tag:"path",attr:{d:"M8 15v6"},child:[]},{tag:"path",attr:{d:"M8 3v6"},child:[]}]})(n)}const G7=/^.*$/;function W7({onChange:n,...e}){const[t,r]=se.useState(""),i=se.useRef(null);se.useEffect(()=>{r(e.value)},[e.value]);const s=a=>{if(!a)return;const l=a.target.value;G7.test(l)&&n&&n(a)},o=a=>{(!a.key||a.key==="Enter")&&s({target:{value:t}})};return C.jsxs("div",{className:"color-field flex-1 flex pr-3 mt-1 cursor-pointer",children:[C.jsx("div",{className:"colorBox relative w-[22px] h-[22px]",style:{background:e.value},onClick:()=>{i.current&&i.current.click()},children:C.jsx("input",{ref:i,type:"color",onChange:s,value:e.value,className:"absolute invisible h-full w-full"})}),C.jsx("div",{className:"flex-1 pl-2",children:C.jsx("input",{className:"colorFieldInput min-w-[90px] cursor-pointer",type:"text",value:t,onKeyDown:o,onChange:a=>r(a.target.value),onBlur:o})})]})}function Ex({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Xt(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return C.jsxs("div",{className:"PropertyColor w-full mb-2",children:[C.jsx(ti,{children:t.label}),C.jsx(W7,{value:n,onChange:a=>o(a.target.value)})]})}function bx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Xt(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return C.jsxs("div",{className:"PropertyEnum w-full mb-2",children:[C.jsx(ti,{children:t.label}),C.jsx(em,{value:n,onChange:a=>o(a.target.value),children:gn(t.values).entrySeq().map(([a,l])=>C.jsx("option",{value:a,children:l},a))})]})}function Mx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Xt();let o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return C.jsxs("div",{className:"PropertyString w-full mb-2",children:[C.jsx(ti,{children:t.label}),C.jsx(ql,{value:n,onChange:a=>o(a.target.value)})]})}function wx({value:n,onUpdate:e,onValid:t,configs:r,sourceElement:i,internalState:s}){const{planner:o}=Xt(),a=l=>{let c=parseFloat(l);return isNaN(c)&&(c=0),r.hook?r.hook(c,i,s,o).then(h=>e(h)):e(c)};return C.jsxs("div",{className:"PropertyNumber w-full mb-2",children:[C.jsx(ti,{children:r.label}),C.jsx(Zi,{value:n,onChange:l=>a(l.target.value),onValid:t,min:r.min,max:r.max})]})}function Tx({value:n,onUpdate:e,onValid:t,configs:r,sourceElement:i,internalState:s}){const{planner:o}=Xt();let a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||fi,{hook:h,label:f,...p}=r;const d=(m,x)=>{let v=Jn(m),_=n.merge({length:x!==fi?ni(v).from(x).to(fi):v,_length:m,_unit:x});return h?h(_,i,s,o).then(b=>e(b)):e(_)};return C.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[C.jsx(ti,{children:f}),C.jsxs("div",{className:"w-full flex",children:[C.jsx(Zi,{value:l,onChange:m=>d(m.target.value,c),onValid:t,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},...p}),C.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:C.jsx(em,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>d(l,m.target.value),children:$0.map(m=>C.jsx("option",{value:m,children:m},m))})})]})]})}function j7({type:n="button",size:e="normal",style:t,styleHover:r,children:i,...s}){const[o,a]=se.useState(!1),l="inline-block font-normal leading-[1.25] text-center whitespace-nowrap align-middle cursor-pointer select-none outline-none border border-solid w-full transition-colors duration-175 ease-linear rounded-[2px]",c=e==="small"?"text-[12px] px-2 py-[3px]":e==="large"?"px-5 py-2":"text-[14px] px-3 py-[5px]",h={backgroundColor:"#e6e6e6",borderColor:"#adadad"},f={backgroundColor:"#d4d4d4",borderColor:"#8c8c8c"};return C.jsx("button",{type:n,className:`${l} ${c}`,style:{...o?{...f,...r}:{...h,...t}},onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),...s,children:i})}const Wu={tableStyle:{width:"100%",borderSpacing:"2px 0",marginBottom:"2px"},firstTdStyle:{width:"6em",textTransform:"capitalize"}};function Ax({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Xt(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return C.jsx("table",{className:"PropertyToggle",style:Wu.tableStyle,children:C.jsx("tbody",{children:C.jsxs("tr",{children:[C.jsx("td",{style:Wu.firstTdStyle,children:C.jsx(ti,{children:t.label})}),C.jsx("td",{children:C.jsx(j7,{onClick:()=>o(!n),size:"small",children:t.actionName})})]})})})}function Cx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Xt(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return C.jsxs("div",{className:"PropertyCheckbox w-full flex items-center gap-2 mb-2",children:[C.jsx("input",{className:"m-0 mt-0.5",type:"checkbox",checked:n,onChange:()=>o(!n)}),C.jsx(ti,{className:"mb-0",children:t.label})]})}function Rx(){return null}function Px({value:n,configs:e}){return C.jsx("table",{className:"PropertyReadOnly",style:Wu.tableStyle,children:C.jsx("tbody",{children:C.jsxs("tr",{children:[C.jsx("td",{style:Wu.firstTdStyle,children:C.jsx(ti,{children:e.label})}),C.jsx("td",{children:C.jsx("div",{children:n})})]})})})}class X7{constructor(e=fi){ut(this,"elements");ut(this,"categories");ut(this,"propertyTypes");ut(this,"unit");this.elements={},this.categories={root:{name:"root",label:"/",elements:[],categories:[]}},this.propertyTypes={},this.unit=e,this.registerMultiplePropertyType([["color",Ex,Ex],["enum",bx,bx],["string",Mx,Mx],["number",wx,wx],["length-measure",Tx,Tx],["toggle",Ax,Ax],["checkbox",Cx,Cx],["hidden",Rx,Rx],["read-only",Px,Px]])}getElement(e){if(this.hasElement(e))return this.elements[e];throw new Error(`Element ${e} does not exist in catalog`)}getCategory(e){if(this.hasCategory(e))return this.categories[e];throw new Error(`Category ${e} does not exist in catalog`)}getPropertyType(e){if(this.propertyTypes.hasOwnProperty(e))return this.propertyTypes[e];throw new Error(`Element ${e} does not exist in catalog`)}registerElement(e){e.properties=e.properties||{},this.validateElement(e)&&(this.elements[e.name]=e,this.categories.root.elements.push(this.elements[e.name]))}registerMultipleElements(e){e.forEach(t=>this.registerElement(t))}registerPropertyType(e,t,r){this.propertyTypes[e]={type:e,Viewer:t,Editor:r}}registerMultiplePropertyType(e){e.forEach(t=>this.registerPropertyType(...t))}validateElement(e){if(!e.hasOwnProperty("name"))throw new Error("Element not valid");let t=e.name;if(!e.hasOwnProperty("prototype"))throw new Error(`Element ${t} doesn't have prototype`);if(!e.hasOwnProperty("info"))throw new Error(`Element ${t} doesn't have info`);if(!e.info.hasOwnProperty("tag"))throw new Error(`Element ${t} doesn't have tag`);if(!e.info.hasOwnProperty("description"))throw new Error(`Element ${t} doesn't have description`);if(!e.info.hasOwnProperty("image"))throw new Error(`Element ${t} doesn't have image`);if(!e.hasOwnProperty("render2D"))throw new Error(`Element ${t} doesn't have render2D handler`);if(!e.hasOwnProperty("render3D"))throw new Error(`Element ${t} doesn't have render3D handler`);if(!e.hasOwnProperty("properties"))throw new Error(`Element ${t} doesn't have properties`);for(let r in e.properties){let i=e.properties[r];if(!i.hasOwnProperty("type"))throw new Error(`Element ${t}, Property ${r} doesn't have type`);if(!i.hasOwnProperty("defaultValue"))throw new Error(`Element ${t}, Property ${r} doesn't have defaultValue`)}return!0}hasElement(e){return this.elements.hasOwnProperty(e)}registerCategory(e,t,r){return this.validateCategory(e,t)?(this.categories[e]={name:e,label:t,categories:[],elements:[]},this.categories.root.categories.push(this.categories[e]),r&&r.length&&r.forEach(i=>this.addToCategory(e,i)),this.categories[e]):null}addToCategory(e,t){if(this.hasElement(t.name))this.categories[e].elements.push(t),this.categories.root.elements.splice(this.categories.root.elements.indexOf(t),1);else if(this.hasCategory(t.name))this.categories[e].categories.push(t),this.categories.root.categories.splice(this.categories.root.categories.indexOf(t),1);else throw new Error(`child ${t} is either category nor element`)}categoryHasElement(e,t){return this.hasCategory(e)&&this.categories[e].elements.some(r=>r.name===t)}validateCategory(e,t){if(!e)throw new Error("Category has undefined name");if(e==="")throw new Error("Category has empty name");if(this.hasCategory(e))throw new Error("Category has already been registered");return!0}hasCategory(e){return this.categories.hasOwnProperty(e)}}function $7(n){return cn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"},child:[]}]})(n)}const Y7=({term:n="",placeholder:e="Search",noSpacing:t=!1,onClick:r=()=>!1,isStatic:i=!1,hasDropDown:s=!1,onSearch:o,className:a})=>{const[l,c]=se.useState("");return C.jsxs("div",{className:ei(`relative w-full ${t?"mt-1":"mt-2"}`,a),onClick:r??(()=>!1),children:[C.jsx("span",{className:`absolute left-0 top-2 text-[#637381] ${t?"":"ml-2"}`,style:{zIndex:2},children:C.jsx($7,{size:18})}),i?C.jsx("div",{className:"w-full rounded border border-gray-300 bg-white px-3 py-1.5 text-xs font-normal cursor-pointer",style:{marginTop:3},children:n}):C.jsx("input",{className:"w-full rounded pl-[30px] focus:outline-none border border-gray-300 bg-white pr-3 py-1.5 text-sm text-gray-900",type:"text",placeholder:e,onChange:h=>{o(h.target.value,h),c(h.target.value)},value:l,onClick:r??(()=>!1)}),r!==null&&s&&C.jsx("span",{className:`absolute right-2 top-1/2 -translate-y-1/2 ${t?"":"ml-2"}`,style:{zIndex:1},children:C.jsx(w8,{className:"-mb-1"})})]})},Ix=8,Lx=40,K7=n=>{const e=[{label:"All Categories",value:"all"}],t=n.map(r=>r.info.tag);for(const r of t){let i=e;for(let s=0;s<r.length;s++){const o=r[s];let a=i.find(l=>l.label===o);a||(a={label:o,value:o},s<r.length-1&&(a.options=[{label:"All Categories",value:"all"}]),i.push(a)),s<r.length-1&&a.options&&(i=a.options)}}return e},Ox=({options:n,selections:e,level:t,onChange:r})=>{var i,s;return C.jsxs(C.Fragment,{children:[C.jsx("select",{className:"w-full rounded capitalize cursor-pointer focus:outline-none border border-gray-300 bg-white pr-3 pl-1.5 py-1.5 text-sm text-gray-900",value:e[t]||"all",onChange:o=>r(t,o.target.value),children:n.map(o=>C.jsx("option",{className:"capitalize",value:o.value,children:o.label},o.value))}),e[t]&&e[t]!=="all"&&((i=n.find(o=>o.value===e[t]))==null?void 0:i.options)&&C.jsx(Ox,{options:((s=n.find(o=>o.value===e[t]))==null?void 0:s.options)||[],level:t+1,selections:e,onChange:r})]})},Z7=({catalog:n,popupEvent:e,onClose:t})=>{const{setToast:r,selectToolDrawingLine:i,selectToolDrawingItem:s,selectToolDrawingHole:o,pushLastSelectedCatalogElementToHistory:a}=Xt(),[l,c]=se.useState([]),[h,f]=se.useState(["all"]),[p,d]=se.useState([]),[m,x]=se.useState(""),v=se.useRef(null),_=se.useRef(null);se.useEffect(()=>{if(e){const T=n.getCategory(e.page).elements.filter(A=>A.info.visibility?A.info.visibility.catalog:!0);v.current=e.page,d(T);const{x:q,y:O}=e.rect;_.current={top:O+Ix,left:q+Lx},e.page==="objects"&&c(K7(T))}},[e]);const b=()=>{t()},M=S=>{b(),e&&r({text:`Cancel placing ${e.page}`}),setTimeout(()=>{switch(S.prototype){case"lines":i(S.name);break;case"items":s(S.name);break;case"holes":o(S.name);break}a(S)},0)},E=(S,T)=>{const q=[...h.slice(0,S),T];f(q)};return C.jsxs(C.Fragment,{children:[e&&C.jsx("div",{className:"fixed inset-0 bg-black/30 z-10",onClick:b}),C.jsxs("div",{style:e&&e.rect?{top:e.rect.y+Ix,left:e.rect.x+Lx}:_.current?_.current:{},className:ei("fixed select-none z-10 shadow-md !gap-0 rounded-lg pt-5 fp_side-bar !min-h-[250px] !max-h-[510px] transition-all duration-200 ease-out transform",e?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),children:[C.jsxs("header",{className:"px-[18px] sticky top-0 left-0 gap-3 flex flex-col",children:[C.jsx("div",{className:"flex items-center gap-1",children:C.jsx("span",{className:ei("flex flex-col gap-0.5"),children:C.jsx("span",{className:"fp-sidebar-label capitalize",children:(e==null?void 0:e.page)??v.current})})}),C.jsxs("div",{className:ei("fp-highlight"),children:[C.jsx(Ox,{options:l,level:0,selections:h,onChange:E}),C.jsx(Y7,{className:"mt-0",placeholder:"Search",onSearch:(S,T)=>{T.preventDefault(),T.stopPropagation(),x(S)}})]})]}),p.filter(S=>S.info.title.toLowerCase().includes(m.toLowerCase())&&h.every(T=>T==="all"||S.info.tag.includes(T))).length>0?C.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 pb-5 overflow-auto w-full pt-[18px] px-4",onWheel:S=>S.stopPropagation(),children:p.filter(S=>S.info.title.toLowerCase().includes(m.toLowerCase())&&h.every(T=>T==="all"||S.info.tag.includes(T))).map(S=>C.jsxs("div",{className:"w-full space-y-1.5",children:[C.jsx("div",{className:"fp-aspect-ratio-container",children:C.jsx("div",{className:"fp-aspect-ratio-content",onMouseDown:()=>M(S),children:C.jsx("img",{draggable:!1,className:"fp-item-image",alt:S.info.title,src:S.info.image})})}),C.jsx("p",{className:"text-xs font-semibold capitalize",children:S.info.description})]},S.name.replace(/\s+/g,"_")))}):C.jsx("div",{className:"min-h-28 w-full flex items-center justify-center",children:C.jsx("p",{className:"text-sm font-medium text-gray-400 text-center",children:"No records found"})})]})]})};function J7(n){return cn({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M320 32c0-9.9-4.5-19.2-12.3-25.2S289.8-1.4 280.2 1l-179.9 45C79 51.3 64 70.5 64 92.5L64 448l-32 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 192 0 32 0 0-32 0-448zM256 256c0 17.7-10.7 32-24 32s-24-14.3-24-32s10.7-32 24-32s24 14.3 24 32zm96-128l96 0 0 352c0 17.7 14.3 32 32 32l64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0 0-320c0-35.3-28.7-64-64-64l-96 0 0 64z"},child:[]}]})(n)}function Q7(n){return cn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M112 73c-13.75 0-24.214 4.87-33.047 13.271-8.832 8.402-15.755 20.6-20.414 34.575-5.887 17.661-7.953 38.064-6.887 56.111a57.246 57.246 0 0 1 2.461-.187c8.38-.405 16.317 1.094 23.494 4.234 14.355 6.28 25.436 18.27 34.057 32.28 15.104 24.543 23.187 55.746 24.96 80.585 114.097-14.223 124.655-14.223 238.753 0 1.772-24.84 9.855-56.042 24.959-80.586 8.62-14.009 19.702-25.999 34.057-32.28 7.875-3.444 16.67-4.898 25.955-4.046 1.066-18.047-1-38.45-6.887-56.111-4.659-13.976-11.582-26.173-20.414-34.575C424.214 77.87 413.75 73 400 73zM56.969 194.502c-.686-.008-1.38.006-2.082.04-5.621.284-11.8 1.978-18.862 5.509-23.413 11.707-26.349 65.687 14.82 79.41l4.505 1.502L86.79 391h338.42l31.44-110.037 4.504-1.502c41.17-13.723 38.234-67.703 14.82-79.41-14.121-7.061-24.722-6.775-34.367-2.555-9.645 4.22-18.564 13.23-25.943 25.22C400.906 246.7 393 282 393 304v10.195l-10.117-1.265c-128-16-125.766-16-253.766 0L119 314.195V304c0-22-7.906-57.3-22.664-81.283-7.38-11.991-16.298-21.001-25.943-25.22-4.22-1.847-8.624-2.94-13.424-2.995zM83.727 409l-23.272 23.271c11.994 3.239 33.75 3.763 42.545-1.666 3.272-4.695 6.903-14.536 10.438-21.605zm314.836 0c1.494 6.017 6.952 19.12 10.437 21.605 13.2 5.463 29.904 5.774 42.545 1.666L428.273 409z"},child:[]}]})(n)}const qx={fontSize:"19px",textDecoration:"none",fontWeight:"bold",margin:"0px",userSelect:"none"},eC=({style:n})=>C.jsx("p",{style:{...qx,...n},children:"2D"}),tC=({style:n})=>C.jsx("p",{style:{...qx,...n},children:"3D"});function nC({catalog:n,has3dView:e}){const{planner:t,setMode:r,setToast:i,selectTool3DView:s,selectToolDrawingLine:o}=Xt(),{mode:a,alterate:l}=t,[c,h]=se.useState(null);return C.jsxs(C.Fragment,{children:[C.jsxs("aside",{className:"floor_planner-toolbar max-h-full max-w-[50px] p-2.5 space-y-4 bg-[#2b2b2b]",children:[C.jsx(ii,{active:[Ur,cr].includes(a),tooltip:"Draw wall",onClick:()=>{i({text:"Cancel drawing"}),o("wall")},children:C.jsx(H7,{})}),C.jsx(ii,{active:!!([ur].includes(a)&&c&&c.page==="windows"),tooltip:"Place windows",onClick:f=>{h({rect:f.currentTarget.getBoundingClientRect(),page:"windows"})},children:C.jsx(V8,{size:26})}),C.jsx(ii,{active:!!([ur].includes(a)&&c&&c.page==="doors"),tooltip:"Place doors",onClick:f=>{h({rect:f.currentTarget.getBoundingClientRect(),page:"doors"})},children:C.jsx(J7,{size:26})}),C.jsx(ii,{active:!!([wr].includes(a)&&c&&c.page==="objects"),tooltip:"Place objects",onClick:f=>{h({rect:f.currentTarget.getBoundingClientRect(),page:"objects"})},children:C.jsx(Q7,{size:26})}),e?[Oi].includes(a)?C.jsx(ii,{active:[rn].includes(a),tooltip:"2D View",onClick:()=>r(rn),children:C.jsx(eC,{style:{color:l?"#FF9800":""}})}):C.jsx(ii,{active:[Oi].includes(a),tooltip:"3D View",onClick:s,children:C.jsx(tC,{})}):null,C.jsx(V7,{mode:a})]}),C.jsx(Z7,{catalog:n,popupEvent:c,onClose:()=>h(null)})]})}const Dl=window.hasOwnProperty("localStorage")?window.localStorage:!1,rC=500;let nm=null;function iC(n,e){return(t,r,i)=>{let s;if(e=e||rC,!!n&&Dl){if(r){t.setPlan(r);const o=r.floors[0].floorDesign;s=JSON.parse(o)}else if(Dl.getItem(n)!==null){const o=Dl.getItem(n);s=JSON.parse(o)}s&&t.loadProject(s),Xt.subscribe(o=>{nm&&clearTimeout(nm),nm=setTimeout(()=>{const a=Dl.getItem(n),l=JSON.stringify(o.planner.scene.toJS());if(a!==l&&(Dl.setItem(n,l),o.plan))try{const c=o.plan.floors[o.activeFloor];i&&i({floor:{floorID:c.floorID,title:c.floorTitle,description:c.floorDescription,design:l}})}catch{}},e)})}}}function sC(){return n=>{window.addEventListener("keydown",e=>{const t=n.planner,r=t.get("mode");switch(e.keyCode){case Tr.BACKSPACE:case Tr.DELETE:{[rn,Mo,Oi].includes(r)&&n.remove();break}case Tr.ESC:{n.rollback();break}case Tr.Z:{(e.getModifierState("Control")||e.getModifierState("Meta"))&&(e.getModifierState("Shift")?n.redo():n.undo());break}case Tr.ALT:{of.includes(r)&&n.toggleSnap(t.snapMask.merge({SNAP_POINT:!1,SNAP_LINE:!1,SNAP_SEGMENT:!1,SNAP_GRID:!1,SNAP_GUIDE:!1,tempSnapConfiguartion:t.snapMask.toJS()}));break}case Tr.C:{let i=t.getIn(["scene","selectedLayer"]),s=t.getIn(["scene","layers",i,"selected"]);if((r===rn||r===Oi)&&(s.holes.size||s.areas.size||s.items.size||s.lines.size)){if(s.holes.size){let o=t.getIn(["scene","layers",i,"holes",s.holes.get(0)]);n.copyProperties(o.get("properties"))}else if(s.areas.size){const o=t.getIn(["scene","layers",i,"areas",s.areas.get(0)]);n.copyProperties(o.properties)}else if(s.items.size){const o=t.getIn(["scene","layers",i,"items",s.items.get(0)]);n.copyProperties(o.properties)}else if(s.lines.size){const o=t.getIn(["scene","layers",i,"lines",s.lines.get(0)]);n.copyProperties(o.properties)}}break}case Tr.V:{n.pasteProperties();break}case Tr.CTRL:{n.setAlterateState();break}}}),window.addEventListener("keyup",e=>{const t=n.planner,r=t.get("mode");switch(e.keyCode){case Tr.ALT:{of.includes(r)&&n.toggleSnap(t.snapMask.merge(t.snapMask.get("tempSnapConfiguartion")));break}case Tr.CTRL:{n.setAlterateState();break}}})}}const oC=({onBack:n,onSave:e})=>{const{undo:t,redo:r,plan:i,setPlan:s}=Xt(),[o,a]=se.useState(!1),l=()=>{a(!0)},c=h=>{if(!i)return;a(!1);const f=h.target.value.trim();if(f&&f!==(i==null?void 0:i.planTitle)){s({...i,planTitle:f});try{e&&e({title:f,description:""})}catch{}}};return C.jsxs("div",{className:"floor_planner-headerbar border-b border-b-[#5e5e5e] absolute flex items-center justify-between z-[9001] py-[3px] px-[1em] text-xs bg-[#2b2b2b] w-full select-none cursor-default top-0 leading-[14px] text-white m-0",children:[C.jsx(ii,{className:"border border-white rounded -ml-1",active:!1,tooltip:"Go Back",onClick:()=>{n&&n()},children:C.jsx($v,{})}),C.jsx("div",{className:"flex flex-col items-center justify-center",children:o?C.jsx("input",{autoFocus:!0,type:"text",defaultValue:i==null?void 0:i.planTitle,onBlur:c,onKeyDown:h=>{(h.key==="Enter"||h.key==="Escape")&&c(h)},className:"bg-transparent border-b border-gray-400 outline-none text-lg text-center"}):C.jsx("span",{onDoubleClick:l,className:"projectName__fp text-lg",title:(i==null?void 0:i.planTitle)??"Example House",children:(i==null?void 0:i.planTitle)??"Example House"})}),C.jsxs("div",{className:"flex items-center gap-2 relative right-40",children:[C.jsx(ii,{active:!1,tooltip:"Undo (CTRL-Z)",onClick:t,children:C.jsx(k8,{})}),C.jsx(ii,{active:!1,tooltip:"Redo (CTRL-SHIFT-Z)",onClick:r,children:C.jsx(z8,{})})]})]})};var rm={exports:{}},Dx;function Nx(){if(Dx)return rm.exports;Dx=1;var n=rm.exports={};return n.forEach=function(e,t){for(var r=0;r<e.length;r++){var i=t(e[r]);if(i)return i}},rm.exports}var im,Ux;function aC(){return Ux||(Ux=1,im=function(n){var e=n.stateHandler.getState;function t(o){var a=e(o);return a&&!!a.isDetectable}function r(o){e(o).isDetectable=!0}function i(o){return!!e(o).busy}function s(o,a){e(o).busy=!!a}return{isDetectable:t,markAsDetectable:r,isBusy:i,markBusy:s}}),im}var sm,Fx;function lC(){return Fx||(Fx=1,sm=function(n){var e={};function t(o){var a=n.get(o);return a===void 0?[]:e[a]||[]}function r(o,a){var l=n.get(o);e[l]||(e[l]=[]),e[l].push(a)}function i(o,a){for(var l=t(o),c=0,h=l.length;c<h;++c)if(l[c]===a){l.splice(c,1);break}}function s(o){var a=t(o);a&&(a.length=0)}return{get:t,add:r,removeListener:i,removeAllListeners:s}}),sm}var om,zx;function cC(){return zx||(zx=1,om=function(){var n=1;function e(){return n++}return{generate:e}}),om}var am,kx;function uC(){return kx||(kx=1,am=function(n){var e=n.idGenerator,t=n.stateHandler.getState;function r(s){var o=t(s);return o&&o.id!==void 0?o.id:null}function i(s){var o=t(s);if(!o)throw new Error("setId required the element to have a resize detection state.");var a=e.generate();return o.id=a,a}return{get:r,set:i}}),am}var lm,Bx;function hC(){return Bx||(Bx=1,lm=function(n){function e(){}var t={log:e,warn:e,error:e};if(!n&&window.console){var r=function(i,s){i[s]=function(){var a=console[s];if(a.apply)a.apply(console,arguments);else for(var l=0;l<arguments.length;l++)a(arguments[l])}};r(t,"log"),r(t,"warn"),r(t,"error")}return t}),lm}var cm={exports:{}},Vx;function Hx(){if(Vx)return cm.exports;Vx=1;var n=cm.exports={};return n.isIE=function(e){function t(){var i=navigator.userAgent.toLowerCase();return i.indexOf("msie")!==-1||i.indexOf("trident")!==-1||i.indexOf(" edge/")!==-1}if(!t())return!1;if(!e)return!0;var r=(function(){var i,s=3,o=document.createElement("div"),a=o.getElementsByTagName("i");do o.innerHTML="<!--[if gt IE "+ ++s+"]><i></i><![endif]-->";while(a[0]);return s>4?s:i})();return e===r},n.isLegacyOpera=function(){return!!window.opera},cm.exports}var um={exports:{}},Gx;function fC(){if(Gx)return um.exports;Gx=1;var n=um.exports={};n.getOption=e;function e(t,r,i){var s=t[r];return s==null&&i!==void 0?i:s}return um.exports}var hm,Wx;function dC(){if(Wx)return hm;Wx=1;var n=fC();hm=function(r){r=r||{};var i=r.reporter,s=n.getOption(r,"async",!0),o=n.getOption(r,"auto",!0);o&&!s&&(i&&i.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."),s=!0);var a=e(),l,c=!1;function h(v,_){!c&&o&&s&&a.size()===0&&d(),a.add(v,_)}function f(){for(c=!0;a.size();){var v=a;a=e(),v.process()}c=!1}function p(v){c||(v===void 0&&(v=s),l&&(m(l),l=null),v?d():f())}function d(){l=x(f)}function m(v){var _=clearTimeout;return _(v)}function x(v){var _=function(b){return setTimeout(b,0)};return _(v)}return{add:h,force:p}};function e(){var t={},r=0,i=0,s=0;function o(c,h){h||(h=c,c=0),c>i?i=c:c<s&&(s=c),t[c]||(t[c]=[]),t[c].push(h),r++}function a(){for(var c=s;c<=i;c++)for(var h=t[c],f=0;f<h.length;f++){var p=h[f];p()}}function l(){return r}return{add:o,process:a,size:l}}return hm}var fm,jx;function pC(){if(jx)return fm;jx=1;var n="_erd";function e(i){return i[n]={},t(i)}function t(i){return i[n]}function r(i){delete i[n]}return fm={initState:e,getState:t,cleanState:r},fm}var dm,Xx;function mC(){if(Xx)return dm;Xx=1;var n=Hx();return dm=function(e){e=e||{};var t=e.reporter,r=e.batchProcessor,i=e.stateHandler.getState;if(!t)throw new Error("Missing required dependency: reporter.");function s(h,f){function p(){f(h)}if(n.isIE(8))i(h).object={proxy:p},h.attachEvent("onresize",p);else{var d=l(h);if(!d)throw new Error("Element is not detectable by this strategy.");d.contentDocument.defaultView.addEventListener("resize",p)}}function o(h){var f=e.important?" !important; ":"; ";return(h.join(f)+f).trim()}function a(h,f,p){p||(p=f,f=h,h=null),h=h||{},h.debug;function d(m,x){var v=o(["display: block","position: absolute","top: 0","left: 0","width: 100%","height: 100%","border: none","padding: 0","margin: 0","opacity: 0","z-index: -1000","pointer-events: none"]),_=!1,b=window.getComputedStyle(m),M=m.offsetWidth,E=m.offsetHeight;i(m).startSize={width:M,height:E};function S(){function T(){if(b.position==="static"){m.style.setProperty("position","relative",h.important?"important":"");var A=function(L,N,Z,K){function ne(J){return J.replace(/[^-\d\.]/g,"")}var ce=Z[K];ce!=="auto"&&ne(ce)!=="0"&&(L.warn("An element that is positioned static has style."+K+"="+ce+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+K+" will be set to 0. Element: ",N),N.style.setProperty(K,"0",h.important?"important":""))};A(t,m,b,"top"),A(t,m,b,"right"),A(t,m,b,"bottom"),A(t,m,b,"left")}}function q(){_||T();function A(N,Z){if(!N.contentDocument){var K=i(N);K.checkForObjectDocumentTimeoutId&&window.clearTimeout(K.checkForObjectDocumentTimeoutId),K.checkForObjectDocumentTimeoutId=setTimeout(function(){K.checkForObjectDocumentTimeoutId=0,A(N,Z)},100);return}Z(N.contentDocument)}var L=this;A(L,function(Z){x(m)})}b.position!==""&&(T(),_=!0);var O=document.createElement("object");O.style.cssText=v,O.tabIndex=-1,O.type="text/html",O.setAttribute("aria-hidden","true"),O.onload=q,n.isIE()||(O.data="about:blank"),i(m)&&(m.appendChild(O),i(m).object=O,n.isIE()&&(O.data="about:blank"))}r?r.add(S):S()}n.isIE(8)?p(f):d(f,p)}function l(h){return i(h).object}function c(h){if(i(h)){var f=l(h);f&&(n.isIE(8)?h.detachEvent("onresize",f.proxy):h.removeChild(f),i(h).checkForObjectDocumentTimeoutId&&window.clearTimeout(i(h).checkForObjectDocumentTimeoutId),delete i(h).object)}}return{makeDetectable:a,addListener:s,uninstall:c}},dm}var pm,$x;function gC(){if($x)return pm;$x=1;var n=Nx().forEach;return pm=function(e){e=e||{};var t=e.reporter,r=e.batchProcessor,i=e.stateHandler.getState;e.stateHandler.hasState;var s=e.idHandler;if(!r)throw new Error("Missing required dependency: batchProcessor");if(!t)throw new Error("Missing required dependency: reporter.");var o=f(),a="erd_scroll_detection_scrollbar_style",l="erd_scroll_detection_container";function c(S){p(S,a,l)}c(window.document);function h(S){var T=e.important?" !important; ":"; ";return(S.join(T)+T).trim()}function f(){var S=500,T=500,q=document.createElement("div");q.style.cssText=h(["position: absolute","width: "+S*2+"px","height: "+T*2+"px","visibility: hidden","margin: 0","padding: 0"]);var O=document.createElement("div");O.style.cssText=h(["position: absolute","width: "+S+"px","height: "+T+"px","overflow: scroll","visibility: none","top: "+-S*3+"px","left: "+-T*3+"px","visibility: hidden","margin: 0","padding: 0"]),O.appendChild(q),document.body.insertBefore(O,document.body.firstChild);var A=S-O.clientWidth,L=T-O.clientHeight;return document.body.removeChild(O),{width:A,height:L}}function p(S,T,q){function O(Z,K){K=K||function(ce){S.head.appendChild(ce)};var ne=S.createElement("style");return ne.innerHTML=Z,ne.id=T,K(ne),ne}if(!S.getElementById(T)){var A=q+"_animation",L=q+"_animation_active",N=`/* Created by the element-resize-detector library. */
3931
3923
  `;N+="."+q+" > div::-webkit-scrollbar { "+h(["display: none"])+` }
3932
3924
 
3933
3925
  `,N+="."+L+" { "+h(["-webkit-animation-duration: 0.1s","animation-duration: 0.1s","-webkit-animation-name: "+A,"animation-name: "+A])+` }
3934
3926
  `,N+="@-webkit-keyframes "+A+` { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }
3935
- `,N+="@keyframes "+A+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }",O(N)}}function d(S){S.className+=" "+l+"_animation_active"}function m(S,T,q){if(S.addEventListener)S.addEventListener(T,q);else if(S.attachEvent)S.attachEvent("on"+T,q);else return t.error("[scroll] Don't know how to add event listeners.")}function x(S,T,q){if(S.removeEventListener)S.removeEventListener(T,q);else if(S.detachEvent)S.detachEvent("on"+T,q);else return t.error("[scroll] Don't know how to remove event listeners.")}function v(S){return i(S).container.childNodes[0].childNodes[0].childNodes[0]}function _(S){return i(S).container.childNodes[0].childNodes[0].childNodes[1]}function E(S,T){var q=i(S).listeners;if(!q.push)throw new Error("Cannot add listener to an element that is not detectable.");i(S).listeners.push(T)}function M(S,T,q){q||(q=T,T=S,S=null),S=S||{};function O(){if(S.debug){var Q=Array.prototype.slice.call(arguments);if(Q.unshift(s.get(T),"Scroll: "),t.log.apply)t.log.apply(null,Q);else for(var Ne=0;Ne<Q.length;Ne++)t.log(Q[Ne])}}function A(Q){function Ne(le){var F=le.getRootNode&&le.getRootNode().contains(le);return le===le.ownerDocument.body||le.ownerDocument.body.contains(le)||F}return!Ne(Q)||window.getComputedStyle(Q)===null}function L(Q){var Ne=i(Q).container.childNodes[0],le=window.getComputedStyle(Ne);return!le.width||le.width.indexOf("px")===-1}function N(){var Q=window.getComputedStyle(T),Ne={};return Ne.position=Q.position,Ne.width=T.offsetWidth,Ne.height=T.offsetHeight,Ne.top=Q.top,Ne.right=Q.right,Ne.bottom=Q.bottom,Ne.left=Q.left,Ne.widthCSS=Q.width,Ne.heightCSS=Q.height,Ne}function Z(){var Q=N();i(T).startSize={width:Q.width,height:Q.height},O("Element start size",i(T).startSize)}function Y(){i(T).listeners=[]}function ee(){if(O("storeStyle invoked."),!i(T)){O("Aborting because element has been uninstalled");return}var Q=N();i(T).style=Q}function ue(Q,Ne,le){i(Q).lastWidth=Ne,i(Q).lastHeight=le}function te(Q){return v(Q).childNodes[0]}function ae(){return 2*o.width+1}function B(){return 2*o.height+1}function Se(Q){return Q+10+ae()}function $(Q){return Q+10+B()}function oe(Q){return Q*2+ae()}function Ae(Q){return Q*2+B()}function Ie(Q,Ne,le){var F=v(Q),lt=_(Q),Le=Se(Ne),Ge=$(le),De=oe(Ne),Ue=Ae(le);F.scrollLeft=Le,F.scrollTop=Ge,lt.scrollLeft=De,lt.scrollTop=Ue}function Ce(){var Q=i(T).container;if(!Q){Q=document.createElement("div"),Q.className=l,Q.style.cssText=h(["visibility: hidden","display: inline","width: 0px","height: 0px","z-index: -1","overflow: hidden","margin: 0","padding: 0"]),i(T).container=Q,d(Q),T.appendChild(Q);var Ne=function(){i(T).onRendered&&i(T).onRendered()};m(Q,"animationstart",Ne),i(T).onAnimationStart=Ne}return Q}function V(){function Q(){var Fe=i(T).style;if(Fe.position==="static"){T.style.setProperty("position","relative",S.important?"important":"");var Te=function(Ye,Ke,Re,ze){function We(Pe){return Pe.replace(/[^-\d\.]/g,"")}var tt=Re[ze];tt!=="auto"&&We(tt)!=="0"&&(Ye.warn("An element that is positioned static has style."+ze+"="+tt+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+ze+" will be set to 0. Element: ",Ke),Ke.style[ze]=0)};Te(t,T,Fe,"top"),Te(t,T,Fe,"right"),Te(t,T,Fe,"bottom"),Te(t,T,Fe,"left")}}function Ne(Fe,Te,Ye,Ke){return Fe=Fe?Fe+"px":"0",Te=Te?Te+"px":"0",Ye=Ye?Ye+"px":"0",Ke=Ke?Ke+"px":"0",["left: "+Fe,"top: "+Te,"right: "+Ke,"bottom: "+Ye]}if(O("Injecting elements"),!i(T)){O("Aborting because element has been uninstalled");return}Q();var le=i(T).container;le||(le=Ce());var F=o.width,lt=o.height,Le=h(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden","width: 100%","height: 100%","left: 0px","top: 0px"]),Ge=h(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden"].concat(Ne(-(1+F),-(1+lt),-lt,-F))),De=h(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),Ue=h(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),ge=h(["position: absolute","left: 0","top: 0"]),$e=h(["position: absolute","width: 200%","height: 200%"]),ot=document.createElement("div"),wt=document.createElement("div"),U=document.createElement("div"),I=document.createElement("div"),J=document.createElement("div"),de=document.createElement("div");ot.dir="ltr",ot.style.cssText=Le,ot.className=l,wt.className=l,wt.style.cssText=Ge,U.style.cssText=De,I.style.cssText=ge,J.style.cssText=Ue,de.style.cssText=$e,U.appendChild(I),J.appendChild(de),wt.appendChild(U),wt.appendChild(J),ot.appendChild(wt),le.appendChild(ot);function be(){var Fe=i(T);Fe&&Fe.onExpand?Fe.onExpand():O("Aborting expand scroll handler: element has been uninstalled")}function fe(){var Fe=i(T);Fe&&Fe.onShrink?Fe.onShrink():O("Aborting shrink scroll handler: element has been uninstalled")}m(U,"scroll",be),m(J,"scroll",fe),i(T).onExpandScroll=be,i(T).onShrinkScroll=fe}function ne(){function Q(De,Ue,ge){var $e=te(De),ot=Se(Ue),wt=$(ge);$e.style.setProperty("width",ot+"px",S.important?"important":""),$e.style.setProperty("height",wt+"px",S.important?"important":"")}function Ne(De){var Ue=T.offsetWidth,ge=T.offsetHeight,$e=Ue!==i(T).lastWidth||ge!==i(T).lastHeight;O("Storing current size",Ue,ge),ue(T,Ue,ge),r.add(0,function(){if($e){if(!i(T)){O("Aborting because element has been uninstalled");return}if(!le()){O("Aborting because element container has not been initialized");return}if(S.debug){var wt=T.offsetWidth,U=T.offsetHeight;(wt!==Ue||U!==ge)&&t.warn(s.get(T),"Scroll: Size changed before updating detector elements.")}Q(T,Ue,ge)}}),r.add(1,function(){if(!i(T)){O("Aborting because element has been uninstalled");return}if(!le()){O("Aborting because element container has not been initialized");return}Ie(T,Ue,ge)}),$e&&De&&r.add(2,function(){if(!i(T)){O("Aborting because element has been uninstalled");return}if(!le()){O("Aborting because element container has not been initialized");return}De()})}function le(){return!!i(T).container}function F(){function De(){return i(T).lastNotifiedWidth===void 0}O("notifyListenersIfNeeded invoked");var Ue=i(T);if(De()&&Ue.lastWidth===Ue.startSize.width&&Ue.lastHeight===Ue.startSize.height)return O("Not notifying: Size is the same as the start size, and there has been no notification yet.");if(Ue.lastWidth===Ue.lastNotifiedWidth&&Ue.lastHeight===Ue.lastNotifiedHeight)return O("Not notifying: Size already notified");O("Current size not notified, notifying..."),Ue.lastNotifiedWidth=Ue.lastWidth,Ue.lastNotifiedHeight=Ue.lastHeight,n(i(T).listeners,function(ge){ge(T)})}function lt(){if(O("startanimation triggered."),L(T)){O("Ignoring since element is still unrendered...");return}O("Element rendered.");var De=v(T),Ue=_(T);(De.scrollLeft===0||De.scrollTop===0||Ue.scrollLeft===0||Ue.scrollTop===0)&&(O("Scrollbars out of sync. Updating detector elements..."),Ne(F))}function Le(){if(O("Scroll detected."),L(T)){O("Scroll event fired while unrendered. Ignoring...");return}Ne(F)}if(O("registerListenersAndPositionElements invoked."),!i(T)){O("Aborting because element has been uninstalled");return}i(T).onRendered=lt,i(T).onExpand=Le,i(T).onShrink=Le;var Ge=i(T).style;Q(T,Ge.width,Ge.height)}function X(){if(O("finalizeDomMutation invoked."),!i(T)){O("Aborting because element has been uninstalled");return}var Q=i(T).style;ue(T,Q.width,Q.height),Ie(T,Q.width,Q.height)}function pe(){q(T)}function Ee(){O("Installing..."),Y(),Z(),r.add(0,ee),r.add(1,V),r.add(2,ne),r.add(3,X),r.add(4,pe)}O("Making detectable..."),A(T)?(O("Element is detached"),Ce(),O("Waiting until element is attached..."),i(T).onRendered=function(){O("Element is now attached"),Ee()}):Ee()}function b(S){var T=i(S);T&&(T.onExpandScroll&&x(v(S),"scroll",T.onExpandScroll),T.onShrinkScroll&&x(_(S),"scroll",T.onShrinkScroll),T.onAnimationStart&&x(T.container,"animationstart",T.onAnimationStart),T.container&&S.removeChild(T.container))}return{makeDetectable:M,addListener:E,uninstall:b,initDocument:c}},pm}var mm,Yx;function _C(){if(Yx)return mm;Yx=1;var n=Nx().forEach,e=aC(),t=lC(),r=cC(),i=uC(),s=hC(),o=Hx(),a=dC(),l=pC(),c=mC(),h=gC();function f(x){return Array.isArray(x)||x.length!==void 0}function p(x){if(Array.isArray(x))return x;var v=[];return n(x,function(_){v.push(_)}),v}function d(x){return x&&x.nodeType===1}mm=function(x){x=x||{};var v;if(x.idHandler)v={get:function(ae){return x.idHandler.get(ae,!0)},set:x.idHandler.set};else{var _=r(),E=i({idGenerator:_,stateHandler:l});v=E}var M=x.reporter;if(!M){var b=M===!1;M=s(b)}var S=m(x,"batchProcessor",a({reporter:M})),T={};T.callOnAdd=!!m(x,"callOnAdd",!0),T.debug=!!m(x,"debug",!1);var q=t(v),O=e({stateHandler:l}),A,L=m(x,"strategy","object"),N=m(x,"important",!1),Z={reporter:M,batchProcessor:S,stateHandler:l,idHandler:v,important:N};if(L==="scroll"&&(o.isLegacyOpera()?(M.warn("Scroll strategy is not supported on legacy Opera. Changing to object strategy."),L="object"):o.isIE(9)&&(M.warn("Scroll strategy is not supported on IE9. Changing to object strategy."),L="object")),L==="scroll")A=h(Z);else if(L==="object")A=c(Z);else throw new Error("Invalid strategy name: "+L);var Y={};function ee(ae,B,Se){function $(ne){var X=q.get(ne);n(X,function(Ee){Ee(ne)})}function oe(ne,X,pe){q.add(X,pe),ne&&pe(X)}if(Se||(Se=B,B=ae,ae={}),!B)throw new Error("At least one element required.");if(!Se)throw new Error("Listener required.");if(d(B))B=[B];else if(f(B))B=p(B);else return M.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");var Ae=0,Ie=m(ae,"callOnAdd",T.callOnAdd),Ce=m(ae,"onReady",function(){}),V=m(ae,"debug",T.debug);n(B,function(X){l.getState(X)||(l.initState(X),v.set(X));var pe=v.get(X);if(V&&M.log("Attaching listener to element",pe,X),!O.isDetectable(X)){if(V&&M.log(pe,"Not detectable."),O.isBusy(X)){V&&M.log(pe,"System busy making it detectable"),oe(Ie,X,Se),Y[pe]=Y[pe]||[],Y[pe].push(function(){Ae++,Ae===B.length&&Ce()});return}return V&&M.log(pe,"Making detectable..."),O.markBusy(X,!0),A.makeDetectable({debug:V,important:N},X,function(Q){if(V&&M.log(pe,"onElementDetectable"),l.getState(Q)){O.markAsDetectable(Q),O.markBusy(Q,!1),A.addListener(Q,$),oe(Ie,Q,Se);var Ne=l.getState(Q);if(Ne&&Ne.startSize){var le=Q.offsetWidth,F=Q.offsetHeight;(Ne.startSize.width!==le||Ne.startSize.height!==F)&&$(Q)}Y[pe]&&n(Y[pe],function(lt){lt()})}else V&&M.log(pe,"Element uninstalled before being detectable.");delete Y[pe],Ae++,Ae===B.length&&Ce()})}V&&M.log(pe,"Already detecable, adding listener."),oe(Ie,X,Se),Ae++}),Ae===B.length&&Ce()}function ue(ae){if(!ae)return M.error("At least one element is required.");if(d(ae))ae=[ae];else if(f(ae))ae=p(ae);else return M.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");n(ae,function(B){q.removeAllListeners(B),A.uninstall(B),l.cleanState(B)})}function te(ae){A.initDocument&&A.initDocument(ae)}return{listenTo:ee,removeListener:q.removeListener,removeAllListeners:q.removeAllListeners,uninstall:ue,initDocument:te}};function m(x,v,_){var E=x[v];return E==null&&_!==void 0?_:E}return mm}var vC=_C();const xC=mi(vC);function yC(n){const{top:e,right:t,bottom:r,left:i,width:s,height:o}=n.getBoundingClientRect();return{top:e,right:t,bottom:r,left:i,width:s,height:o}}const SC=({children:n})=>{const[e,t]=se.useState(null),r=se.useRef(null),i=se.useRef(null);return se.useEffect(()=>{if(!r.current)return;const s=r.current.parentElement;if(!s)return;i.current=xC({strategy:"scroll",callOnAdd:!1});const o=()=>{const a=yC(s);t(a)};return i.current.listenTo(s,o),o(),()=>{i.current&&s&&i.current.uninstall(s)}},[]),e?typeof n=="function"?n(e):se.cloneElement(n,e):C.jsx("div",{ref:r})};function EC(n){const e=se.useRef(!1),t=se.useRef(!1),r=se.useCallback(async()=>{if(!(t.current||e.current)){t.current=!0;try{const i=await xx();e.current=!0,n&&n(i)}catch{}finally{t.current=!1}}},[n]);return se.useEffect(()=>{const i=s=>{if(!e.current)return r(),s.preventDefault(),s.returnValue="",""};return window.addEventListener("beforeunload",i),()=>{window.removeEventListener("beforeunload",i)}},[r]),{ensureScreenshot:r,screenshotDone:e}}const bC=()=>{const{toast:n,setToast:e}=en(),[t,r]=se.useState(!1);return se.useEffect(()=>{let i;return n&&(r(!0),i=setTimeout(()=>{r(!1),setTimeout(()=>e(null),300)},2500)),()=>clearTimeout(i)},[n,e]),n?C.jsx("div",{className:`absolute top-6 left-1/2 -translate-x-1/2 z-[9999] transition-all duration-300 ease-in-out
3927
+ `,N+="@keyframes "+A+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }",O(N)}}function d(S){S.className+=" "+l+"_animation_active"}function m(S,T,q){if(S.addEventListener)S.addEventListener(T,q);else if(S.attachEvent)S.attachEvent("on"+T,q);else return t.error("[scroll] Don't know how to add event listeners.")}function x(S,T,q){if(S.removeEventListener)S.removeEventListener(T,q);else if(S.detachEvent)S.detachEvent("on"+T,q);else return t.error("[scroll] Don't know how to remove event listeners.")}function v(S){return i(S).container.childNodes[0].childNodes[0].childNodes[0]}function _(S){return i(S).container.childNodes[0].childNodes[0].childNodes[1]}function b(S,T){var q=i(S).listeners;if(!q.push)throw new Error("Cannot add listener to an element that is not detectable.");i(S).listeners.push(T)}function M(S,T,q){q||(q=T,T=S,S=null),S=S||{};function O(){if(S.debug){var Q=Array.prototype.slice.call(arguments);if(Q.unshift(s.get(T),"Scroll: "),t.log.apply)t.log.apply(null,Q);else for(var Le=0;Le<Q.length;Le++)t.log(Q[Le])}}function A(Q){function Le(le){var z=le.getRootNode&&le.getRootNode().contains(le);return le===le.ownerDocument.body||le.ownerDocument.body.contains(le)||z}return!Le(Q)||window.getComputedStyle(Q)===null}function L(Q){var Le=i(Q).container.childNodes[0],le=window.getComputedStyle(Le);return!le.width||le.width.indexOf("px")===-1}function N(){var Q=window.getComputedStyle(T),Le={};return Le.position=Q.position,Le.width=T.offsetWidth,Le.height=T.offsetHeight,Le.top=Q.top,Le.right=Q.right,Le.bottom=Q.bottom,Le.left=Q.left,Le.widthCSS=Q.width,Le.heightCSS=Q.height,Le}function Z(){var Q=N();i(T).startSize={width:Q.width,height:Q.height},O("Element start size",i(T).startSize)}function K(){i(T).listeners=[]}function ne(){if(O("storeStyle invoked."),!i(T)){O("Aborting because element has been uninstalled");return}var Q=N();i(T).style=Q}function ce(Q,Le,le){i(Q).lastWidth=Le,i(Q).lastHeight=le}function J(Q){return v(Q).childNodes[0]}function oe(){return 2*o.width+1}function B(){return 2*o.height+1}function xe(Q){return Q+10+oe()}function U(Q){return Q+10+B()}function $(Q){return Q*2+oe()}function pe(Q){return Q*2+B()}function Se(Q,Le,le){var z=v(Q),it=_(Q),Ie=xe(Le),$e=U(le),qe=$(Le),De=pe(le);z.scrollLeft=Ie,z.scrollTop=$e,it.scrollLeft=qe,it.scrollTop=De}function be(){var Q=i(T).container;if(!Q){Q=document.createElement("div"),Q.className=l,Q.style.cssText=h(["visibility: hidden","display: inline","width: 0px","height: 0px","z-index: -1","overflow: hidden","margin: 0","padding: 0"]),i(T).container=Q,d(Q),T.appendChild(Q);var Le=function(){i(T).onRendered&&i(T).onRendered()};m(Q,"animationstart",Le),i(T).onAnimationStart=Le}return Q}function V(){function Q(){var Ue=i(T).style;if(Ue.position==="static"){T.style.setProperty("position","relative",S.important?"important":"");var Ae=function(We,je,Ce,Ne){function Ve(Re){return Re.replace(/[^-\d\.]/g,"")}var Ke=Ce[Ne];Ke!=="auto"&&Ve(Ke)!=="0"&&(We.warn("An element that is positioned static has style."+Ne+"="+Ke+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+Ne+" will be set to 0. Element: ",je),je.style[Ne]=0)};Ae(t,T,Ue,"top"),Ae(t,T,Ue,"right"),Ae(t,T,Ue,"bottom"),Ae(t,T,Ue,"left")}}function Le(Ue,Ae,We,je){return Ue=Ue?Ue+"px":"0",Ae=Ae?Ae+"px":"0",We=We?We+"px":"0",je=je?je+"px":"0",["left: "+Ue,"top: "+Ae,"right: "+je,"bottom: "+We]}if(O("Injecting elements"),!i(T)){O("Aborting because element has been uninstalled");return}Q();var le=i(T).container;le||(le=be());var z=o.width,it=o.height,Ie=h(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden","width: 100%","height: 100%","left: 0px","top: 0px"]),$e=h(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden"].concat(Le(-(1+z),-(1+it),-it,-z))),qe=h(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),De=h(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),ve=h(["position: absolute","left: 0","top: 0"]),Ge=h(["position: absolute","width: 200%","height: 200%"]),rt=document.createElement("div"),wt=document.createElement("div"),F=document.createElement("div"),I=document.createElement("div"),ee=document.createElement("div"),de=document.createElement("div");rt.dir="ltr",rt.style.cssText=Ie,rt.className=l,wt.className=l,wt.style.cssText=$e,F.style.cssText=qe,I.style.cssText=ve,ee.style.cssText=De,de.style.cssText=Ge,F.appendChild(I),ee.appendChild(de),wt.appendChild(F),wt.appendChild(ee),rt.appendChild(wt),le.appendChild(rt);function Me(){var Ue=i(T);Ue&&Ue.onExpand?Ue.onExpand():O("Aborting expand scroll handler: element has been uninstalled")}function fe(){var Ue=i(T);Ue&&Ue.onShrink?Ue.onShrink():O("Aborting shrink scroll handler: element has been uninstalled")}m(F,"scroll",Me),m(ee,"scroll",fe),i(T).onExpandScroll=Me,i(T).onShrinkScroll=fe}function te(){function Q(qe,De,ve){var Ge=J(qe),rt=xe(De),wt=U(ve);Ge.style.setProperty("width",rt+"px",S.important?"important":""),Ge.style.setProperty("height",wt+"px",S.important?"important":"")}function Le(qe){var De=T.offsetWidth,ve=T.offsetHeight,Ge=De!==i(T).lastWidth||ve!==i(T).lastHeight;O("Storing current size",De,ve),ce(T,De,ve),r.add(0,function(){if(Ge){if(!i(T)){O("Aborting because element has been uninstalled");return}if(!le()){O("Aborting because element container has not been initialized");return}if(S.debug){var wt=T.offsetWidth,F=T.offsetHeight;(wt!==De||F!==ve)&&t.warn(s.get(T),"Scroll: Size changed before updating detector elements.")}Q(T,De,ve)}}),r.add(1,function(){if(!i(T)){O("Aborting because element has been uninstalled");return}if(!le()){O("Aborting because element container has not been initialized");return}Se(T,De,ve)}),Ge&&qe&&r.add(2,function(){if(!i(T)){O("Aborting because element has been uninstalled");return}if(!le()){O("Aborting because element container has not been initialized");return}qe()})}function le(){return!!i(T).container}function z(){function qe(){return i(T).lastNotifiedWidth===void 0}O("notifyListenersIfNeeded invoked");var De=i(T);if(qe()&&De.lastWidth===De.startSize.width&&De.lastHeight===De.startSize.height)return O("Not notifying: Size is the same as the start size, and there has been no notification yet.");if(De.lastWidth===De.lastNotifiedWidth&&De.lastHeight===De.lastNotifiedHeight)return O("Not notifying: Size already notified");O("Current size not notified, notifying..."),De.lastNotifiedWidth=De.lastWidth,De.lastNotifiedHeight=De.lastHeight,n(i(T).listeners,function(ve){ve(T)})}function it(){if(O("startanimation triggered."),L(T)){O("Ignoring since element is still unrendered...");return}O("Element rendered.");var qe=v(T),De=_(T);(qe.scrollLeft===0||qe.scrollTop===0||De.scrollLeft===0||De.scrollTop===0)&&(O("Scrollbars out of sync. Updating detector elements..."),Le(z))}function Ie(){if(O("Scroll detected."),L(T)){O("Scroll event fired while unrendered. Ignoring...");return}Le(z)}if(O("registerListenersAndPositionElements invoked."),!i(T)){O("Aborting because element has been uninstalled");return}i(T).onRendered=it,i(T).onExpand=Ie,i(T).onShrink=Ie;var $e=i(T).style;Q(T,$e.width,$e.height)}function W(){if(O("finalizeDomMutation invoked."),!i(T)){O("Aborting because element has been uninstalled");return}var Q=i(T).style;ce(T,Q.width,Q.height),Se(T,Q.width,Q.height)}function ue(){q(T)}function ye(){O("Installing..."),K(),Z(),r.add(0,ne),r.add(1,V),r.add(2,te),r.add(3,W),r.add(4,ue)}O("Making detectable..."),A(T)?(O("Element is detached"),be(),O("Waiting until element is attached..."),i(T).onRendered=function(){O("Element is now attached"),ye()}):ye()}function E(S){var T=i(S);T&&(T.onExpandScroll&&x(v(S),"scroll",T.onExpandScroll),T.onShrinkScroll&&x(_(S),"scroll",T.onShrinkScroll),T.onAnimationStart&&x(T.container,"animationstart",T.onAnimationStart),T.container&&S.removeChild(T.container))}return{makeDetectable:M,addListener:b,uninstall:E,initDocument:c}},pm}var mm,Yx;function _C(){if(Yx)return mm;Yx=1;var n=Nx().forEach,e=aC(),t=lC(),r=cC(),i=uC(),s=hC(),o=Hx(),a=dC(),l=pC(),c=mC(),h=gC();function f(x){return Array.isArray(x)||x.length!==void 0}function p(x){if(Array.isArray(x))return x;var v=[];return n(x,function(_){v.push(_)}),v}function d(x){return x&&x.nodeType===1}mm=function(x){x=x||{};var v;if(x.idHandler)v={get:function(oe){return x.idHandler.get(oe,!0)},set:x.idHandler.set};else{var _=r(),b=i({idGenerator:_,stateHandler:l});v=b}var M=x.reporter;if(!M){var E=M===!1;M=s(E)}var S=m(x,"batchProcessor",a({reporter:M})),T={};T.callOnAdd=!!m(x,"callOnAdd",!0),T.debug=!!m(x,"debug",!1);var q=t(v),O=e({stateHandler:l}),A,L=m(x,"strategy","object"),N=m(x,"important",!1),Z={reporter:M,batchProcessor:S,stateHandler:l,idHandler:v,important:N};if(L==="scroll"&&(o.isLegacyOpera()?(M.warn("Scroll strategy is not supported on legacy Opera. Changing to object strategy."),L="object"):o.isIE(9)&&(M.warn("Scroll strategy is not supported on IE9. Changing to object strategy."),L="object")),L==="scroll")A=h(Z);else if(L==="object")A=c(Z);else throw new Error("Invalid strategy name: "+L);var K={};function ne(oe,B,xe){function U(te){var W=q.get(te);n(W,function(ye){ye(te)})}function $(te,W,ue){q.add(W,ue),te&&ue(W)}if(xe||(xe=B,B=oe,oe={}),!B)throw new Error("At least one element required.");if(!xe)throw new Error("Listener required.");if(d(B))B=[B];else if(f(B))B=p(B);else return M.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");var pe=0,Se=m(oe,"callOnAdd",T.callOnAdd),be=m(oe,"onReady",function(){}),V=m(oe,"debug",T.debug);n(B,function(W){l.getState(W)||(l.initState(W),v.set(W));var ue=v.get(W);if(V&&M.log("Attaching listener to element",ue,W),!O.isDetectable(W)){if(V&&M.log(ue,"Not detectable."),O.isBusy(W)){V&&M.log(ue,"System busy making it detectable"),$(Se,W,xe),K[ue]=K[ue]||[],K[ue].push(function(){pe++,pe===B.length&&be()});return}return V&&M.log(ue,"Making detectable..."),O.markBusy(W,!0),A.makeDetectable({debug:V,important:N},W,function(Q){if(V&&M.log(ue,"onElementDetectable"),l.getState(Q)){O.markAsDetectable(Q),O.markBusy(Q,!1),A.addListener(Q,U),$(Se,Q,xe);var Le=l.getState(Q);if(Le&&Le.startSize){var le=Q.offsetWidth,z=Q.offsetHeight;(Le.startSize.width!==le||Le.startSize.height!==z)&&U(Q)}K[ue]&&n(K[ue],function(it){it()})}else V&&M.log(ue,"Element uninstalled before being detectable.");delete K[ue],pe++,pe===B.length&&be()})}V&&M.log(ue,"Already detecable, adding listener."),$(Se,W,xe),pe++}),pe===B.length&&be()}function ce(oe){if(!oe)return M.error("At least one element is required.");if(d(oe))oe=[oe];else if(f(oe))oe=p(oe);else return M.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");n(oe,function(B){q.removeAllListeners(B),A.uninstall(B),l.cleanState(B)})}function J(oe){A.initDocument&&A.initDocument(oe)}return{listenTo:ne,removeListener:q.removeListener,removeAllListeners:q.removeAllListeners,uninstall:ce,initDocument:J}};function m(x,v,_){var b=x[v];return b==null&&_!==void 0?_:b}return mm}var vC=_C();const xC=ai(vC);function yC(n){const{top:e,right:t,bottom:r,left:i,width:s,height:o}=n.getBoundingClientRect();return{top:e,right:t,bottom:r,left:i,width:s,height:o}}const SC=({children:n})=>{const[e,t]=se.useState(null),r=se.useRef(null),i=se.useRef(null);return se.useEffect(()=>{if(!r.current)return;const s=r.current.parentElement;if(!s)return;i.current=xC({strategy:"scroll",callOnAdd:!1});const o=()=>{const a=yC(s);t(a)};return i.current.listenTo(s,o),o(),()=>{i.current&&s&&i.current.uninstall(s)}},[]),e?typeof n=="function"?n(e):se.cloneElement(n,e):C.jsx("div",{ref:r})};function EC(n){const e=se.useRef(!1),t=se.useRef(!1),r=se.useCallback(async()=>{if(!(t.current||e.current)){t.current=!0;try{const i=await xx();e.current=!0,n&&n(i)}catch{}finally{t.current=!1}}},[n]);return se.useEffect(()=>{const i=s=>{if(!e.current)return r(),s.preventDefault(),s.returnValue="",""};return window.addEventListener("beforeunload",i),()=>{window.removeEventListener("beforeunload",i)}},[r]),{ensureScreenshot:r,screenshotDone:e}}const bC=()=>{const{toast:n,setToast:e}=Xt(),[t,r]=se.useState(!1);return se.useEffect(()=>{let i;return n&&(r(!0),i=setTimeout(()=>{r(!1),setTimeout(()=>e(null),300)},2500)),()=>clearTimeout(i)},[n,e]),n?C.jsx("div",{className:`absolute top-6 left-1/2 -translate-x-1/2 z-[9999] transition-all duration-300 ease-in-out
3936
3928
  ${t?"opacity-100 translate-y-0":"opacity-0 -translate-y-2"}
3937
- `,children:C.jsx("div",{className:"p-1 px-3 shadow-md rounded-md bg-white text-slate-600",children:C.jsxs("div",{className:"flex gap-1 justify-center items-center h-8 rounded",children:[C.jsx("span",{className:"text-xs",children:n.text}),C.jsx("div",{className:"text-xs bg-gray-50 border rounded-md px-1 py-0.5 font-medium",children:"ESC"})]})})}):null},MC=50,wC=300,TC=20,AC=[iC("pub_planner_v0"),sC()],CC=({plan:n,catalog:e,onSave:t,onBack:r,has3dView:i})=>{const s=en();return se.useEffect(()=>{s.initCatalog(e),AC.forEach(o=>o(s,n,t))},[]),se.useEffect(()=>{s.planner.getIn(["catalog","ready"])||s.initCatalog(e)},[e]),EC(o=>{t&&t({imageURI:o})}),C.jsx(SC,{children:({width:o,height:a})=>{const l=o-MC-wC,c=a-TC;return C.jsxs("div",{className:"flex flex-nowrap flex-row h-full floor_planner",children:[C.jsx(bC,{}),C.jsx(oC,{onSave:t,onBack:r}),C.jsx(nC,{catalog:e,has3dView:i}),C.jsx(sA,{width:l,height:c,catalog:e}),C.jsx(B7,{catalog:e}),C.jsx(HA,{})]})}})},RC=()=>C.jsxs("div",{className:"fixed inset-0 z-[100] flex flex-col bg-[#2b2d35] overflow-hidden",children:[C.jsxs("div",{className:"flex h-[45px] items-center justify-between border border-[#424242] bg-[#2b2d35] px-2",children:[C.jsx("div",{className:"flex flex-1 items-center",children:C.jsx("div",{className:"h-[30px] w-[30px] rounded bg-[#424242] animate-pulse"})}),C.jsx("div",{className:"flex items-center",children:C.jsx("div",{className:"h-[18px] w-[175px] bg-[#424242] animate-pulse"})}),C.jsx("div",{className:"flex flex-1 items-center justify-end",children:C.jsx("div",{className:"mr-40 flex flex-row gap-3",children:[...Array(2)].map((n,e)=>C.jsx("div",{className:"h-[24px] w-[24px] rounded bg-[#424242] animate-pulse"},`${e}`))})})]}),C.jsxs("div",{className:"flex flex-1",children:[C.jsx("div",{className:"block w-[50px] border-r border-[#424242] bg-[#2b2d35]"}),C.jsx("div",{className:"flex flex-1 items-center justify-center bg-[#2b2d35]",children:C.jsx("div",{className:"h-[90%] w-[90%] bg-[#424242] animate-pulse"})}),C.jsx("div",{className:"w-[300px] border-l border-[#424242] bg-[#2b2d35] flex justify-center items-center",children:C.jsxs("div",{className:"flex w-full flex-col gap-2 justify-center items-center p-6",children:[C.jsx("div",{className:"h-[15px] w-[200px] bg-[#424242] animate-pulse"}),C.jsx("div",{className:"h-[15px] w-[150px] bg-[#424242] animate-pulse"})]})})]}),C.jsxs("div",{className:"py-[3px] px-[1em] text-xs border-t border-[#424242] bg-[#2b2d35] h-5 w-full select-none cursor-default bottom-0 leading-[14px] text-white m-0",children:[C.jsx("div",{className:"relative float-left px-[1em] inline-block border-r border-r-white",children:C.jsx("div",{className:"flex items-center gap-2",children:C.jsx("div",{className:"h-[13px] w-[110px] rounded-sm bg-[#424242] animate-pulse"})})}),C.jsxs("div",{className:"flex flex-1 items-center",children:[[...Array(5)].map((n,e)=>C.jsx("div",{className:"ml-5 h-[13px] w-[30px] rounded-sm bg-[#424242] animate-pulse"},e)),C.jsx("div",{className:"flex flex-1 items-center justify-end",children:C.jsx("div",{className:"mr-5 flex flex-row gap-3",children:[...Array(2)].map((n,e)=>C.jsx("div",{className:"h-[13px] w-[13px] rounded-full bg-[#424242] animate-pulse"},`${e}`))})})]})]})]}),Kx=1e-5,Zu=0,Gl=1,Ca=2,Zx=3;class _o{constructor(e){vt(this,"Polygon");vt(this,"Vertex");vt(this,"Node");vt(this,"matrix");vt(this,"tree");if(this.Polygon=Ra,this.Vertex=Ju,this.Node=os,e instanceof Dn)e.updateMatrixWorld(),this.matrix=e.matrixWorld.clone(),e=e.geometry;else if(e instanceof ur)this.matrix=new Kt;else{if(e instanceof os)return this.tree=e,this.matrix=new Kt,this;throw new Error("ThreeBSP: Given geometry is unsupported")}const t=[],r=e.getAttribute("position"),i=e.getAttribute("uv"),s=e.getIndex(),o=l=>{const c=r.getX(l),h=r.getY(l),f=r.getZ(l),p=i?new Be(i.getX(l),i.getY(l)):null,d=new Ju(c,h,f,new j,p);return d.applyMatrix4(this.matrix),d},a=s?s.array:[...Array(r.count).keys()];for(let l=0;l<a.length;l+=3){const c=o(a[l]),h=o(a[l+1]),f=o(a[l+2]),p=new Ra([c,h,f]);p.calculateProperties(),t.push(p)}this.tree=new os(t)}subtract(e){let t=this.tree.clone(),r=e.tree.clone();return t.invert(),t.clipTo(r),r.clipTo(t),r.invert(),r.clipTo(t),r.invert(),t.build(r.allPolygons()),t.invert(),t=new _o(t),t.matrix=this.matrix,t}union(e){let t=this.tree.clone(),r=e.tree.clone();return t.clipTo(r),r.clipTo(t),r.invert(),r.clipTo(t),r.invert(),t.build(r.allPolygons()),t=new _o(t),t.matrix=this.matrix,t}intersect(e){let t=this.tree.clone(),r=e.tree.clone();return t.invert(),r.clipTo(t),r.invert(),t.clipTo(r),r.clipTo(t),t.build(r.allPolygons()),t.invert(),t=new _o(t),t.matrix=this.matrix,t}toGeometry(){const e=new Kt().copy(this.matrix).invert(),t=[],r=[];this.tree.allPolygons().forEach(o=>{for(let a=2;a<o.vertices.length;a++)[o.vertices[0],o.vertices[a-1],o.vertices[a]].forEach(c=>{const h=new j(c.x,c.y,c.z).applyMatrix4(e);t.push(h.x,h.y,h.z),c.uv?r.push(c.uv.x,c.uv.y):r.push(0,0)})});const s=new ur;return s.setAttribute("position",new er(t,3)),s.setAttribute("uv",new er(r,2)),s.computeVertexNormals(),s}toMesh(e){const t=this.toGeometry(),r=new Dn(t,e),i=new j,s=new ys,o=new j;return this.matrix.decompose(i,s,o),r.position.copy(i),r.quaternion.copy(s),r.scale.copy(o),r}}class Ra{constructor(e,t,r){vt(this,"vertices");vt(this,"normal");vt(this,"w");e instanceof Array||(e=[]),this.vertices=e,e.length>0?this.calculateProperties():this.normal=this.w=void 0}calculateProperties(){var e=this.vertices[0],t=this.vertices[1],r=this.vertices[2];return this.normal=t.clone().subtract(e).cross(r.clone().subtract(e)).normalize(),this.normal&&(this.w=this.normal.clone().dot(e)),this}clone(){var e,t,r=new Ra;for(e=0,t=this.vertices.length;e<t;e++)r.vertices.push(this.vertices[e].clone());return r.calculateProperties(),r}flip(){var e,t=[];for(this.normal&&this.normal.multiplyScalar(-1),this.w&&(this.w*=-1),e=this.vertices.length-1;e>=0;e--)t.push(this.vertices[e]);return this.vertices=t,this}classifyVertex(e){if(!this.normal||!this.w)return Zu;var t=this.normal.dot(e)-this.w;return t<-Kx?Ca:t>Kx?Gl:Zu}classifySide(e){var t,r,i,s=0,o=0,a=e.vertices.length;for(t=0;t<a;t++)r=e.vertices[t],i=this.classifyVertex(r),i===Gl?s++:i===Ca&&o++;return s>0&&o===0?Gl:s===0&&o>0?Ca:s===0&&o===0?Zu:Zx}splitPolygon(e,t,r,i,s){var o=this.classifySide(e);if(o===Zu)(this.normal&&e.normal&&this.normal.dot(e.normal)>0?t:r).push(e);else if(o===Gl)i.push(e);else if(o===Ca)s.push(e);else{var a,l,c,h,f,p,d,m,x,v=[],_=[];for(l=0,a=e.vertices.length;l<a;l++)c=(l+1)%a,p=e.vertices[l],d=e.vertices[c],h=this.classifyVertex(p),f=this.classifyVertex(d),h!=Ca&&v.push(p),h!=Gl&&_.push(p),(h|f)===Zx&&this.w&&this.normal&&(m=(this.w-this.normal.dot(p))/this.normal.dot(d.clone().subtract(p)),x=p.interpolate(d,m),v.push(x),_.push(x));v.length>=3&&i.push(new Ra(v).calculateProperties()),_.length>=3&&s.push(new Ra(_).calculateProperties())}}}class Ju{constructor(e,t,r,i,s){vt(this,"x");vt(this,"y");vt(this,"z");vt(this,"normal");vt(this,"uv");this.x=e,this.y=t,this.z=r,this.normal=i||new j,this.uv=s||new Be}clone(){return new Ju(this.x,this.y,this.z,this.normal.clone(),this.uv?this.uv.clone():null)}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}subtract(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}cross(e){var t=this.x,r=this.y,i=this.z;return this.x=r*e.z-i*e.y,this.y=i*e.x-t*e.z,this.z=t*e.y-r*e.x,this}normalize(){var e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return this.x/=e,this.y/=e,this.z/=e,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lerp(e,t){return this.add(e.clone().subtract(this).multiplyScalar(t)),this.normal.add(e.normal.clone().sub(this.normal).multiplyScalar(t)),this.uv&&e.uv&&this.uv.add(e.uv.clone().sub(this.uv).multiplyScalar(t)),this}interpolate(e,t){return this.clone().lerp(e,t)}applyMatrix4(e){var t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i+s[12],this.y=s[1]*t+s[5]*r+s[9]*i+s[13],this.z=s[2]*t+s[6]*r+s[10]*i+s[14],this}}class os{constructor(e){vt(this,"polygons");vt(this,"front");vt(this,"back");vt(this,"divider");var t,r,i=[],s=[];if(this.polygons=[],this.front=this.back=void 0,!(!(e instanceof Array)||e.length===0)){for(this.divider=e[0].clone(),t=0,r=e.length;t<r;t++)this.divider.splitPolygon(e[t],this.polygons,this.polygons,i,s);i.length>0&&(this.front=new os(i)),s.length>0&&(this.back=new os(s))}}isConvex(e){var t,r;for(t=0;t<e.length;t++)for(r=0;r<e.length;r++)if(t!==r&&e[t].classifySide(e[r])!==Ca)return!1;return!0}build(e){var t,r,i=[],s=[];for(this.divider||(this.divider=e[0].clone()),t=0,r=e.length;t<r;t++)this.divider.splitPolygon(e[t],this.polygons,this.polygons,i,s);i.length>0&&(this.front||(this.front=new os),this.front.build(i)),s.length>0&&(this.back||(this.back=new os),this.back.build(s))}allPolygons(){var e=this.polygons.slice();return this.front&&(e=e.concat(this.front.allPolygons())),this.back&&(e=e.concat(this.back.allPolygons())),e}clone(){var e=new os;return e.divider=this.divider?this.divider.clone():void 0,e.polygons=this.polygons.map(function(t){return t.clone()}),e.front=this.front&&this.front.clone(),e.back=this.back&&this.back.clone(),e}invert(){var e,t,r;for(e=0,t=this.polygons.length;e<t;e++)this.polygons[e].flip();return this.divider&&this.divider.flip(),this.front&&this.front.invert(),this.back&&this.back.invert(),r=this.front,this.front=this.back,this.back=r,this}clipPolygons(e){var t,r,i,s;if(!this.divider)return e.slice();for(i=[],s=[],t=0,r=e.length;t<r;t++)this.divider.splitPolygon(e[t],i,s,i,s);return this.front&&(i=this.front.clipPolygons(i)),this.back?s=this.back.clipPolygons(s):s=[],i.concat(s)}clipTo(e){this.polygons=e.clipPolygons(this.polygons),this.front&&this.front.clipTo(e),this.back&&this.back.clipTo(e)}}window.ThreeBSP=_o;const Pa=Math.PI/2,Jx=(n,e,t,r)=>{if(!e)return;const i=new $_;n.map=i.load(e.uri),n.needsUpdate=!0,n.map.wrapS=ti,n.map.wrapT=ti,n.map.repeat.set(t*(e.lengthRepeatScale??1),r*(e.heightRepeatScale??1)),e.normal&&n instanceof KM&&(n.normalMap=i.load(e.normal.uri),n.normalScale=new Be(e.normal.normalScaleX,e.normal.normalScaleY),n.normalMap.wrapS=ti,n.normalMap.wrapT=ti,n.normalMap.repeat.set(t*(e.normal.lengthRepeatScale??1),r*(e.normal.heightRepeatScale??1)))};function PC(n,e,t,r){let i=e.vertices.get(n.vertices.get(0)),s=e.vertices.get(n.vertices.get(1)),o=!1;if(i.x>s.x){const L=i;i=s,s=L,o=!0}const a=n.properties.getIn(["height","length"]),l=n.properties.getIn(["thickness","length"]),c=.2,h=1,f=_c(i,s),p=f/2,d=l/2,m=new io({color:n.selected?Ht.MESH_SELECTED:13882323});let x=new Dn(new oo(f,a,l),m);const v=Math.asin((s.y-i.y)/f),_=Math.sin(v),E=Math.cos(v);x.position.y+=a/2,x.position.x+=p*E,x.position.z-=p*_,x.rotation.y=v,n.holes.forEach(L=>{const N=e.holes.get(L),Z=N.properties.getIn(["width","length"]),Y=N.properties.getIn(["height","length"]),ee=N.properties.getIn(["altitude","length"]),te=(o?1-N.offset:N.offset)*f,ae=new oo(Z,Y,l),B=new Dn(ae);B.position.y+=Y/2+ee,B.position.x+=te*E,B.position.z-=te*_,B.rotation.y=v;const Se=new _o(x),$=new _o(B);x=Se.subtract($).toMesh(m)}),x.name="soul";const M=new io,b=new io;Jx(M,r[n.properties.get("textureB")],f,a),Jx(b,r[n.properties.get("textureA")],f,a);const S=c/l,T=d+h,q=x.clone();q.material=M,q.scale.set(1,1,S),q.position.x+=T*Math.cos(v-Pa),q.position.z-=T*Math.sin(v-Pa),q.name="frontFace";const O=x.clone();O.material=b,O.scale.set(1,1,S),O.position.x+=T*Math.cos(v+Pa),O.position.z-=T*Math.sin(v+Pa),O.name="backFace";const A=new Ml;return A.add(x,q,O),Promise.resolve(A)}function IC(n,e,t,r,i,s,o,a,l){let c=()=>(a(),l()),h=i.getObjectByName("soul"),f=i.getObjectByName("frontFace"),p=i.getObjectByName("backFace");if(o[0]=="selected")h.material=new io({color:n.selected?Ht.MESH_SELECTED:13882323});else if(o[0]=="properties")if(o[1]=="thickness"){let d=n.getIn(["properties","thickness","length"]),m=s.getIn(["properties","thickness","length"]),v=d/2+1,_=m/h.scale.z,E=h.rotation.y,M=v*Math.cos(E-Pa),b=v*Math.sin(E-Pa);h.scale.set(1,1,d/_),f.position.x=h.position.x+M,f.position.z=h.position.z+b,p.position.x=h.position.x-M,p.position.z=h.position.z-b}else return c();else return c();return Promise.resolve(i)}const Qx=20,e2={textAnchor:"middle"},LC={stroke:Ht.LINE_MESH_COLOR.selected},t2={strokeWidth:1,stroke:Ht.COLORS.black},OC={...t2,stroke:Ht.LINE_MESH_COLOR.selected};function qC(n,e,t){let r={name:n,prototype:"lines",info:e,properties:{height:{label:"height",type:"length-measure",defaultValue:{length:300}},thickness:{label:"thickness",type:"length-measure",defaultValue:{length:15,_length:15,_unit:yi}}},render2D:function(i,s,o){let{x:a,y:l}=s.vertices.get(i.vertices.get(0)),{x:c,y:h}=s.vertices.get(i.vertices.get(1)),f=Bn(a,l,c,h),p=f/5,d=i.getIn(["properties","thickness","length"]),m=d/2,x=m+Qx,v=11,E=m+Qx+5;return i.selected?C.jsxs("g",{children:[C.jsx("rect",{x:"0",y:-m,width:f,height:d,style:OC}),C.jsx("line",{x1:p,y1:-x,x2:p,y2:x,style:LC}),C.jsx("text",{x:p,y:E+v,style:e2,children:"A"}),C.jsx("text",{x:p,y:-E,style:e2,children:"B"})]}):C.jsx("rect",{x:"0",y:-m,width:f,height:d,style:t2})},render3D:function(i,s,o){return PC(i,s,o,t)},updateRender3D:(i,s,o,a,l,c,h,f)=>IC(i,s,o,t,a,l,c,h,f)};if(t&&Object.keys(t).length>0){let i={none:"None"};for(let s in t)i[s]=t[s].name;r.properties.textureA={label:"texture A",type:"enum",defaultValue:i.bricks?"bricks":"none",values:i},r.properties.textureB={label:"texture B",type:"enum",defaultValue:i.bricks?"bricks":"none",values:i}}return r}const DC=(n,e,t,r)=>{if(!e)return;const i=new $_;n.map=i.load(e.uri),n.needsUpdate=!0,n.map.wrapS=ti,n.map.wrapT=ti,n.map.repeat.set(t*e.lengthRepeatScale,r*e.heightRepeatScale),e.normal&&(n.normalMap=i.load(e.normal.uri),n.normalScale=new Be(e.normal.normalScaleX,e.normal.normalScaleY),n.normalMap.wrapS=ti,n.normalMap.wrapT=ti,n.normalMap.repeat.set(t*e.normal.lengthRepeatScale,r*e.normal.heightRepeatScale))},NC=n=>{n.computeBoundingBox();const e=n.boundingBox;if(!e)return;const t=e.min,r=e.max,i=new Be(0-t.x,0-t.y),s=new Be(r.x-t.x,r.y-t.y),o=n.getAttribute("position");new Float32Array(o.count/3*2*3);const a=[];for(let l=0;l<o.count;l++){const c=o.getX(l),h=o.getY(l),f=(c+i.x)/s.x,p=(h+i.y)/s.y;a.push(f,p)}n.setAttribute("uv",new er(a,2))};function UC(n,e,t,r){let i=[];n.vertices.forEach(x=>{i.push(e.vertices.get(x))});let s=n.properties.get("patternColor");const o=n.properties.get("texture");n.selected?s=Ht.AREA_MESH_COLOR.selected:o&&o!=="none"&&(s=Ht.AREA_MESH_COLOR.unselected);const a=new pa;a.moveTo(i[0].x,i[0].y);for(let x=1;x<i.length;x++)a.lineTo(i[x].x,i[x].y);const l=new ZM({side:Ci,color:s});n.holes.forEach(x=>{let v=[];e.getIn(["areas",x,"vertices"]).forEach(E=>{const{x:M,y:b}=e.getIn(["vertices",E]);v.push([M,b])}),v=v.reverse();let _=zC(v);a.holes.push(_)});const c=new Lp(a);NC(c);const h=new Li().setFromObject(new Dn(c,new io)),f=h.max.x-h.min.x,p=h.max.y-h.min.y,d=r[o];DC(l,d,f,p);const m=new Dn(c,l);return m.rotation.x-=Math.PI/2,m.name="floor",Promise.resolve(m)}async function FC(n,e,t,r,i,s,o,a,l){const c=async()=>(a(),await l()),h=i.getObjectByName("floor");if(!h)return i;if(o[0]=="selected"){const f=n.selected?Ht.AREA_MESH_COLOR.selected:n.properties.get("patternColor")||Ht.AREA_MESH_COLOR.unselected;h.material.color.set(f)}else if(o[0]=="properties"){if(o[1]==="texture")return await c()}else return await c();return Promise.resolve(i)}const zC=n=>{const e=new pa;e.moveTo(n[0][0],n[0][1]);for(let t=1;t<n.length;t++)e.lineTo(n[t][0],n[t][1]);return e};function kC(n,e,t){let r={name:n,prototype:"areas",info:{...e,visibility:{catalog:!1,layerElementsVisible:!1}},properties:{patternColor:{label:"color",type:"color",defaultValue:Ht.AREA_MESH_COLOR.unselected},thickness:{label:"thickness",type:"length-measure",defaultValue:{length:0,_length:0,_unit:yi}}},render2D:function(i,s,o){let a="";const l=i.properties.get("texture"),c=t[l],h=[];i.vertices.forEach((M,b)=>{const S=s.vertices.get(M);h.push(S),a+=(b?"L":"M")+S.x+" "+S.y+" "}),i.holes.forEach(M=>{s.areas.get(M).vertices.reverse().forEach((S,T)=>{const q=s.vertices.get(S);a+=(T?"L":"M")+q.x+" "+q.y+" "})});const f=Math.min(...h.map(M=>M.x)),p=Math.max(...h.map(M=>M.x)),d=Math.min(...h.map(M=>M.y)),m=Math.max(...h.map(M=>M.y)),x=p-f,v=m-d;i.properties.get("patternColor"),i.selected;const _=i.selected?Ht.AREA_MESH_COLOR.selected:i.properties.get("patternColor"),E=`pattern-${i.id}`;return C.jsxs("g",{children:[C.jsx("defs",{children:c&&C.jsx("pattern",{id:E,patternUnits:"userSpaceOnUse",width:x/(x*c.lengthRepeatScale),height:v/(v*c.heightRepeatScale),x:f,y:d,children:C.jsx("image",{href:c.uri,width:x,height:v,preserveAspectRatio:"none"})})}),C.jsx("path",{d:a,fill:c?`url(#${E})`:_,stroke:i.selected?"#0096fd":"#000",strokeWidth:"2"})]})},render3D:function(i,s,o){return UC(i,s,o,t)},updateRender3D:(i,s,o,a,l,c,h,f)=>FC(i,s,o,t,a,l,c,h,f)};if(t&&Object.keys(t).length>0){let i={none:"None"};for(let s in t)i[s]=t[s].name;r.properties.texture={label:"texture",type:"enum",defaultValue:"none",values:i}}return r}In.AreaFactory=kC,In.Catalog=X7,In.ReactPlannerLoader=RC,In.WallFactory=qC,In.convertUnits=hi,In.default=CC,Object.defineProperties(In,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
3929
+ `,children:C.jsx("div",{className:"p-1 px-3 shadow-md rounded-md bg-white text-slate-600",children:C.jsxs("div",{className:"flex gap-1 justify-center items-center h-8 rounded",children:[C.jsx("span",{className:"text-xs",children:n.text}),C.jsx("div",{className:"text-xs bg-gray-50 border rounded-md px-1 py-0.5 font-medium",children:"ESC"})]})})}):null},MC=50,wC=300,TC=20,AC=[iC("pub_planner_v0"),sC()],CC=({plan:n,catalog:e,onSave:t,onBack:r,has3dView:i})=>{const s=Xt();return se.useEffect(()=>{s.initCatalog(e),AC.forEach(o=>o(s,n,t))},[]),se.useEffect(()=>{s.planner.getIn(["catalog","ready"])||s.initCatalog(e)},[e]),EC(o=>{t&&t({imageURI:o})}),C.jsx(SC,{children:({width:o,height:a})=>{const l=o-MC-wC,c=a-TC;return C.jsxs("div",{className:"flex flex-nowrap flex-row h-full floor_planner",children:[C.jsx(bC,{}),C.jsx(oC,{onSave:t,onBack:r}),C.jsx(nC,{catalog:e,has3dView:i}),C.jsx(sA,{width:l,height:c,catalog:e}),C.jsx(B7,{catalog:e}),C.jsx(HA,{})]})}})},RC=()=>C.jsxs("div",{className:"fixed inset-0 z-[100] flex flex-col bg-[#2b2d35] overflow-hidden",children:[C.jsxs("div",{className:"flex h-[45px] items-center justify-between border border-[#424242] bg-[#2b2d35] px-2",children:[C.jsx("div",{className:"flex flex-1 items-center",children:C.jsx("div",{className:"h-[30px] w-[30px] rounded bg-[#424242] animate-pulse"})}),C.jsx("div",{className:"flex items-center",children:C.jsx("div",{className:"h-[18px] w-[175px] bg-[#424242] animate-pulse"})}),C.jsx("div",{className:"flex flex-1 items-center justify-end",children:C.jsx("div",{className:"mr-40 flex flex-row gap-3",children:[...Array(2)].map((n,e)=>C.jsx("div",{className:"h-[24px] w-[24px] rounded bg-[#424242] animate-pulse"},`${e}`))})})]}),C.jsxs("div",{className:"flex flex-1",children:[C.jsx("div",{className:"block w-[50px] border-r border-[#424242] bg-[#2b2d35]"}),C.jsx("div",{className:"flex flex-1 items-center justify-center bg-[#2b2d35]",children:C.jsx("div",{className:"h-[90%] w-[90%] bg-[#424242] animate-pulse"})}),C.jsx("div",{className:"w-[300px] border-l border-[#424242] bg-[#2b2d35] flex justify-center items-center",children:C.jsxs("div",{className:"flex w-full flex-col gap-2 justify-center items-center p-6",children:[C.jsx("div",{className:"h-[15px] w-[200px] bg-[#424242] animate-pulse"}),C.jsx("div",{className:"h-[15px] w-[150px] bg-[#424242] animate-pulse"})]})})]}),C.jsxs("div",{className:"py-[3px] px-[1em] text-xs border-t border-[#424242] bg-[#2b2d35] h-5 w-full select-none cursor-default bottom-0 leading-[14px] text-white m-0",children:[C.jsx("div",{className:"relative float-left px-[1em] inline-block border-r border-r-white",children:C.jsx("div",{className:"flex items-center gap-2",children:C.jsx("div",{className:"h-[13px] w-[110px] rounded-sm bg-[#424242] animate-pulse"})})}),C.jsxs("div",{className:"flex flex-1 items-center",children:[[...Array(5)].map((n,e)=>C.jsx("div",{className:"ml-5 h-[13px] w-[30px] rounded-sm bg-[#424242] animate-pulse"},e)),C.jsx("div",{className:"flex flex-1 items-center justify-end",children:C.jsx("div",{className:"mr-5 flex flex-row gap-3",children:[...Array(2)].map((n,e)=>C.jsx("div",{className:"h-[13px] w-[13px] rounded-full bg-[#424242] animate-pulse"},`${e}`))})})]})]})]}),Kx=1e-5,ju=0,Nl=1,va=2,Zx=3;class ao{constructor(e){ut(this,"Polygon");ut(this,"Vertex");ut(this,"Node");ut(this,"matrix");ut(this,"tree");if(this.Polygon=xa,this.Vertex=Xu,this.Node=Ji,e instanceof Tn)e.updateMatrixWorld(),this.matrix=e.matrixWorld.clone(),e=e.geometry;else if(e instanceof tr)this.matrix=new Ht;else{if(e instanceof Ji)return this.tree=e,this.matrix=new Ht,this;throw new Error("ThreeBSP: Given geometry is unsupported")}const t=[],r=e.getAttribute("position"),i=e.getAttribute("uv"),s=e.getIndex(),o=l=>{const c=r.getX(l),h=r.getY(l),f=r.getZ(l),p=i?new Fe(i.getX(l),i.getY(l)):null,d=new Xu(c,h,f,new G,p);return d.applyMatrix4(this.matrix),d},a=s?s.array:[...Array(r.count).keys()];for(let l=0;l<a.length;l+=3){const c=o(a[l]),h=o(a[l+1]),f=o(a[l+2]),p=new xa([c,h,f]);p.calculateProperties(),t.push(p)}this.tree=new Ji(t)}subtract(e){let t=this.tree.clone(),r=e.tree.clone();return t.invert(),t.clipTo(r),r.clipTo(t),r.invert(),r.clipTo(t),r.invert(),t.build(r.allPolygons()),t.invert(),t=new ao(t),t.matrix=this.matrix,t}union(e){let t=this.tree.clone(),r=e.tree.clone();return t.clipTo(r),r.clipTo(t),r.invert(),r.clipTo(t),r.invert(),t.build(r.allPolygons()),t=new ao(t),t.matrix=this.matrix,t}intersect(e){let t=this.tree.clone(),r=e.tree.clone();return t.invert(),r.clipTo(t),r.invert(),t.clipTo(r),r.clipTo(t),t.build(r.allPolygons()),t.invert(),t=new ao(t),t.matrix=this.matrix,t}toGeometry(){const e=new Ht().copy(this.matrix).invert(),t=[],r=[];this.tree.allPolygons().forEach(o=>{for(let a=2;a<o.vertices.length;a++)[o.vertices[0],o.vertices[a-1],o.vertices[a]].forEach(c=>{const h=new G(c.x,c.y,c.z).applyMatrix4(e);t.push(h.x,h.y,h.z),c.uv?r.push(c.uv.x,c.uv.y):r.push(0,0)})});const s=new tr;return s.setAttribute("position",new Gn(t,3)),s.setAttribute("uv",new Gn(r,2)),s.computeVertexNormals(),s}toMesh(e){const t=this.toGeometry(),r=new Tn(t,e),i=new G,s=new fs,o=new G;return this.matrix.decompose(i,s,o),r.position.copy(i),r.quaternion.copy(s),r.scale.copy(o),r}}class xa{constructor(e,t,r){ut(this,"vertices");ut(this,"normal");ut(this,"w");e instanceof Array||(e=[]),this.vertices=e,e.length>0?this.calculateProperties():this.normal=this.w=void 0}calculateProperties(){var e=this.vertices[0],t=this.vertices[1],r=this.vertices[2];return this.normal=t.clone().subtract(e).cross(r.clone().subtract(e)).normalize(),this.normal&&(this.w=this.normal.clone().dot(e)),this}clone(){var e,t,r=new xa;for(e=0,t=this.vertices.length;e<t;e++)r.vertices.push(this.vertices[e].clone());return r.calculateProperties(),r}flip(){var e,t=[];for(this.normal&&this.normal.multiplyScalar(-1),this.w&&(this.w*=-1),e=this.vertices.length-1;e>=0;e--)t.push(this.vertices[e]);return this.vertices=t,this}classifyVertex(e){if(!this.normal||!this.w)return ju;var t=this.normal.dot(e)-this.w;return t<-Kx?va:t>Kx?Nl:ju}classifySide(e){var t,r,i,s=0,o=0,a=e.vertices.length;for(t=0;t<a;t++)r=e.vertices[t],i=this.classifyVertex(r),i===Nl?s++:i===va&&o++;return s>0&&o===0?Nl:s===0&&o>0?va:s===0&&o===0?ju:Zx}splitPolygon(e,t,r,i,s){var o=this.classifySide(e);if(o===ju)(this.normal&&e.normal&&this.normal.dot(e.normal)>0?t:r).push(e);else if(o===Nl)i.push(e);else if(o===va)s.push(e);else{var a,l,c,h,f,p,d,m,x,v=[],_=[];for(l=0,a=e.vertices.length;l<a;l++)c=(l+1)%a,p=e.vertices[l],d=e.vertices[c],h=this.classifyVertex(p),f=this.classifyVertex(d),h!=va&&v.push(p),h!=Nl&&_.push(p),(h|f)===Zx&&this.w&&this.normal&&(m=(this.w-this.normal.dot(p))/this.normal.dot(d.clone().subtract(p)),x=p.interpolate(d,m),v.push(x),_.push(x));v.length>=3&&i.push(new xa(v).calculateProperties()),_.length>=3&&s.push(new xa(_).calculateProperties())}}}class Xu{constructor(e,t,r,i,s){ut(this,"x");ut(this,"y");ut(this,"z");ut(this,"normal");ut(this,"uv");this.x=e,this.y=t,this.z=r,this.normal=i||new G,this.uv=s||new Fe}clone(){return new Xu(this.x,this.y,this.z,this.normal.clone(),this.uv?this.uv.clone():null)}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}subtract(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}cross(e){var t=this.x,r=this.y,i=this.z;return this.x=r*e.z-i*e.y,this.y=i*e.x-t*e.z,this.z=t*e.y-r*e.x,this}normalize(){var e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return this.x/=e,this.y/=e,this.z/=e,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lerp(e,t){return this.add(e.clone().subtract(this).multiplyScalar(t)),this.normal.add(e.normal.clone().sub(this.normal).multiplyScalar(t)),this.uv&&e.uv&&this.uv.add(e.uv.clone().sub(this.uv).multiplyScalar(t)),this}interpolate(e,t){return this.clone().lerp(e,t)}applyMatrix4(e){var t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i+s[12],this.y=s[1]*t+s[5]*r+s[9]*i+s[13],this.z=s[2]*t+s[6]*r+s[10]*i+s[14],this}}class Ji{constructor(e){ut(this,"polygons");ut(this,"front");ut(this,"back");ut(this,"divider");var t,r,i=[],s=[];if(this.polygons=[],this.front=this.back=void 0,!(!(e instanceof Array)||e.length===0)){for(this.divider=e[0].clone(),t=0,r=e.length;t<r;t++)this.divider.splitPolygon(e[t],this.polygons,this.polygons,i,s);i.length>0&&(this.front=new Ji(i)),s.length>0&&(this.back=new Ji(s))}}isConvex(e){var t,r;for(t=0;t<e.length;t++)for(r=0;r<e.length;r++)if(t!==r&&e[t].classifySide(e[r])!==va)return!1;return!0}build(e){var t,r,i=[],s=[];for(this.divider||(this.divider=e[0].clone()),t=0,r=e.length;t<r;t++)this.divider.splitPolygon(e[t],this.polygons,this.polygons,i,s);i.length>0&&(this.front||(this.front=new Ji),this.front.build(i)),s.length>0&&(this.back||(this.back=new Ji),this.back.build(s))}allPolygons(){var e=this.polygons.slice();return this.front&&(e=e.concat(this.front.allPolygons())),this.back&&(e=e.concat(this.back.allPolygons())),e}clone(){var e=new Ji;return e.divider=this.divider?this.divider.clone():void 0,e.polygons=this.polygons.map(function(t){return t.clone()}),e.front=this.front&&this.front.clone(),e.back=this.back&&this.back.clone(),e}invert(){var e,t,r;for(e=0,t=this.polygons.length;e<t;e++)this.polygons[e].flip();return this.divider&&this.divider.flip(),this.front&&this.front.invert(),this.back&&this.back.invert(),r=this.front,this.front=this.back,this.back=r,this}clipPolygons(e){var t,r,i,s;if(!this.divider)return e.slice();for(i=[],s=[],t=0,r=e.length;t<r;t++)this.divider.splitPolygon(e[t],i,s,i,s);return this.front&&(i=this.front.clipPolygons(i)),this.back?s=this.back.clipPolygons(s):s=[],i.concat(s)}clipTo(e){this.polygons=e.clipPolygons(this.polygons),this.front&&this.front.clipTo(e),this.back&&this.back.clipTo(e)}}window.ThreeBSP=ao;const ya=Math.PI/2,Jx=(n,e,t,r)=>{if(!e)return;const i=new $_;n.map=i.load(e.uri),n.needsUpdate=!0,n.map.wrapS=jr,n.map.wrapT=jr,n.map.repeat.set(t*(e.lengthRepeatScale??1),r*(e.heightRepeatScale??1)),e.normal&&n instanceof KM&&(n.normalMap=i.load(e.normal.uri),n.normalScale=new Fe(e.normal.normalScaleX,e.normal.normalScaleY),n.normalMap.wrapS=jr,n.normalMap.wrapT=jr,n.normalMap.repeat.set(t*(e.normal.lengthRepeatScale??1),r*(e.normal.heightRepeatScale??1)))};function PC(n,e,t,r){let i=e.vertices.get(n.vertices.get(0)),s=e.vertices.get(n.vertices.get(1)),o=!1;if(i.x>s.x){const L=i;i=s,s=L,o=!0}const a=n.properties.getIn(["height","length"]),l=n.properties.getIn(["thickness","length"]),c=.2,h=1,f=fc(i,s),p=f/2,d=l/2,m=new Ys({color:n.selected?Nt.MESH_SELECTED:13882323});let x=new Tn(new Zs(f,a,l),m);const v=Math.asin((s.y-i.y)/f),_=Math.sin(v),b=Math.cos(v);x.position.y+=a/2,x.position.x+=p*b,x.position.z-=p*_,x.rotation.y=v,n.holes.forEach(L=>{const N=e.holes.get(L),Z=N.properties.getIn(["width","length"]),K=N.properties.getIn(["height","length"]),ne=N.properties.getIn(["altitude","length"]),J=(o?1-N.offset:N.offset)*f,oe=new Zs(Z,K,l),B=new Tn(oe);B.position.y+=K/2+ne,B.position.x+=J*b,B.position.z-=J*_,B.rotation.y=v;const xe=new ao(x),U=new ao(B);x=xe.subtract(U).toMesh(m)}),x.name="soul";const M=new Ys,E=new Ys;Jx(M,r[n.properties.get("textureB")],f,a),Jx(E,r[n.properties.get("textureA")],f,a);const S=c/l,T=d+h,q=x.clone();q.material=M,q.scale.set(1,1,S),q.position.x+=T*Math.cos(v-ya),q.position.z-=T*Math.sin(v-ya),q.name="frontFace";const O=x.clone();O.material=E,O.scale.set(1,1,S),O.position.x+=T*Math.cos(v+ya),O.position.z-=T*Math.sin(v+ya),O.name="backFace";const A=new gl;return A.add(x,q,O),Promise.resolve(A)}function IC(n,e,t,r,i,s,o,a,l){let c=()=>(a(),l()),h=i.getObjectByName("soul"),f=i.getObjectByName("frontFace"),p=i.getObjectByName("backFace");if(o[0]=="selected")h.material=new Ys({color:n.selected?Nt.MESH_SELECTED:13882323});else if(o[0]=="properties")if(o[1]=="thickness"){let d=n.getIn(["properties","thickness","length"]),m=s.getIn(["properties","thickness","length"]),v=d/2+1,_=m/h.scale.z,b=h.rotation.y,M=v*Math.cos(b-ya),E=v*Math.sin(b-ya);h.scale.set(1,1,d/_),f.position.x=h.position.x+M,f.position.z=h.position.z+E,p.position.x=h.position.x-M,p.position.z=h.position.z-E}else return c();else return c();return Promise.resolve(i)}const Qx=20,e2={textAnchor:"middle"},LC={stroke:Nt.LINE_MESH_COLOR.selected},t2={strokeWidth:1,stroke:Nt.COLORS.black},OC={...t2,stroke:Nt.LINE_MESH_COLOR.selected};function qC(n,e,t){let r={name:n,prototype:"lines",info:e,properties:{height:{label:"height",type:"length-measure",defaultValue:{length:300}},thickness:{label:"thickness",type:"length-measure",defaultValue:{length:15,_length:15,_unit:fi}}},render2D:function(i,s,o){let{x:a,y:l}=s.vertices.get(i.vertices.get(0)),{x:c,y:h}=s.vertices.get(i.vertices.get(1)),f=Ln(a,l,c,h),p=f/5,d=i.getIn(["properties","thickness","length"]),m=d/2,x=m+Qx,v=11,b=m+Qx+5;return i.selected?C.jsxs("g",{children:[C.jsx("rect",{x:"0",y:-m,width:f,height:d,style:OC}),C.jsx("line",{x1:p,y1:-x,x2:p,y2:x,style:LC}),C.jsx("text",{x:p,y:b+v,style:e2,children:"A"}),C.jsx("text",{x:p,y:-b,style:e2,children:"B"})]}):C.jsx("rect",{x:"0",y:-m,width:f,height:d,style:t2})},render3D:function(i,s,o){return PC(i,s,o,t)},updateRender3D:(i,s,o,a,l,c,h,f)=>IC(i,s,o,t,a,l,c,h,f)};if(t&&Object.keys(t).length>0){let i={none:"None"};for(let s in t)i[s]=t[s].name;r.properties.textureA={label:"texture A",type:"enum",defaultValue:i.bricks?"bricks":"none",values:i},r.properties.textureB={label:"texture B",type:"enum",defaultValue:i.bricks?"bricks":"none",values:i}}return r}const DC=(n,e,t,r)=>{if(!e)return;const i=new $_;n.map=i.load(e.uri),n.needsUpdate=!0,n.map.wrapS=jr,n.map.wrapT=jr,n.map.repeat.set(t*e.lengthRepeatScale,r*e.heightRepeatScale),e.normal&&(n.normalMap=i.load(e.normal.uri),n.normalScale=new Fe(e.normal.normalScaleX,e.normal.normalScaleY),n.normalMap.wrapS=jr,n.normalMap.wrapT=jr,n.normalMap.repeat.set(t*e.normal.lengthRepeatScale,r*e.normal.heightRepeatScale))},NC=n=>{n.computeBoundingBox();const e=n.boundingBox;if(!e)return;const t=e.min,r=e.max,i=new Fe(0-t.x,0-t.y),s=new Fe(r.x-t.x,r.y-t.y),o=n.getAttribute("position");new Float32Array(o.count/3*2*3);const a=[];for(let l=0;l<o.count;l++){const c=o.getX(l),h=o.getY(l),f=(c+i.x)/s.x,p=(h+i.y)/s.y;a.push(f,p)}n.setAttribute("uv",new Gn(a,2))};function UC(n,e,t,r){let i=[];n.vertices.forEach(x=>{i.push(e.vertices.get(x))});let s=n.properties.get("patternColor");const o=n.properties.get("texture");n.selected?s=Nt.AREA_MESH_COLOR.selected:o&&o!=="none"&&(s=Nt.AREA_MESH_COLOR.unselected);const a=new ia;a.moveTo(i[0].x,i[0].y);for(let x=1;x<i.length;x++)a.lineTo(i[x].x,i[x].y);const l=new ZM({side:yi,color:s});n.holes.forEach(x=>{let v=[];e.getIn(["areas",x,"vertices"]).forEach(b=>{const{x:M,y:E}=e.getIn(["vertices",b]);v.push([M,E])}),v=v.reverse();let _=zC(v);a.holes.push(_)});const c=new Lp(a);NC(c);const h=new Mi().setFromObject(new Tn(c,new Ys)),f=h.max.x-h.min.x,p=h.max.y-h.min.y,d=r[o];DC(l,d,f,p);const m=new Tn(c,l);return m.rotation.x-=Math.PI/2,m.name="floor",Promise.resolve(m)}async function FC(n,e,t,r,i,s,o,a,l){const c=async()=>(a(),await l()),h=i.getObjectByName("floor");if(!h)return i;if(o[0]=="selected"){const f=n.selected?Nt.AREA_MESH_COLOR.selected:n.properties.get("patternColor")||Nt.AREA_MESH_COLOR.unselected;h.material.color.set(f)}else if(o[0]=="properties"){if(o[1]==="texture")return await c()}else return await c();return Promise.resolve(i)}const zC=n=>{const e=new ia;e.moveTo(n[0][0],n[0][1]);for(let t=1;t<n.length;t++)e.lineTo(n[t][0],n[t][1]);return e};function kC(n,e,t){let r={name:n,prototype:"areas",info:{...e,visibility:{catalog:!1,layerElementsVisible:!1}},properties:{patternColor:{label:"color",type:"color",defaultValue:Nt.AREA_MESH_COLOR.unselected},thickness:{label:"thickness",type:"length-measure",defaultValue:{length:0,_length:0,_unit:fi}}},render2D:function(i,s,o){let a="";const l=i.properties.get("texture"),c=t[l],h=[];i.vertices.forEach((M,E)=>{const S=s.vertices.get(M);h.push(S),a+=(E?"L":"M")+S.x+" "+S.y+" "}),i.holes.forEach(M=>{s.areas.get(M).vertices.reverse().forEach((S,T)=>{const q=s.vertices.get(S);a+=(T?"L":"M")+q.x+" "+q.y+" "})});const f=Math.min(...h.map(M=>M.x)),p=Math.max(...h.map(M=>M.x)),d=Math.min(...h.map(M=>M.y)),m=Math.max(...h.map(M=>M.y)),x=p-f,v=m-d;i.properties.get("patternColor"),i.selected;const _=i.selected?Nt.AREA_MESH_COLOR.selected:i.properties.get("patternColor"),b=`pattern-${i.id}`;return C.jsxs("g",{children:[C.jsx("defs",{children:c&&C.jsx("pattern",{id:b,patternUnits:"userSpaceOnUse",width:x/(x*c.lengthRepeatScale),height:v/(v*c.heightRepeatScale),x:f,y:d,children:C.jsx("image",{href:c.uri,width:x,height:v,preserveAspectRatio:"none"})})}),C.jsx("path",{d:a,fill:c?`url(#${b})`:_,stroke:i.selected?"#0096fd":"#000",strokeWidth:"2"})]})},render3D:function(i,s,o){return UC(i,s,o,t)},updateRender3D:(i,s,o,a,l,c,h,f)=>FC(i,s,o,t,a,l,c,h,f)};if(t&&Object.keys(t).length>0){let i={none:"None"};for(let s in t)i[s]=t[s].name;r.properties.texture={label:"texture",type:"enum",defaultValue:"none",values:i}}return r}En.AreaFactory=kC,En.Catalog=X7,En.ReactPlannerLoader=RC,En.WallFactory=qC,En.convertUnits=ni,En.default=CC,Object.defineProperties(En,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));