@osamash/floor-planner 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floor-planner.es.js +124 -120
- package/dist/floor-planner.umd.js +11 -11
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(bn,se){typeof exports=="object"&&typeof module<"u"?se(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],se):(bn=typeof globalThis<"u"?globalThis:bn||self,se(bn.FloorPlanner={},bn.React))})(this,(function(bn,se){"use strict";var eR=Object.defineProperty;var tR=(bn,se,oi)=>se in bn?eR(bn,se,{enumerable:!0,configurable:!0,writable:!0,value:oi}):bn[se]=oi;var ut=(bn,se,oi)=>tR(bn,typeof se!="symbol"?se+"":se,oi);function oi(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Rm(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
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -42,7 +42,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
42
42
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
43
43
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
44
44
|
* SOFTWARE.
|
|
45
|
-
*/var La="delete",kt=5,sr=1<<kt,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(Dm)),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 Dm(){return!0}function Oa(n,e,t){return(n===0&&!Um(n)||t!==void 0&&n<=-t)&&(e===void 0||t!==void 0&&e>=t)}function co(n,e){return Nm(n,e,0)}function qa(n,e){return Nm(n,e,e)}function Nm(n,e,t){return n===void 0?t:Um(n)?e===1/0?e:Math.max(0,e+n)|0:e===void 0||e===n?n:Math.min(e,n)|0}function Um(n){return n<0||n===0&&1/n===-1/0}var Fm="@@__IMMUTABLE_ITERABLE__@@";function Kn(n){return!!(n&&n[Fm])}var jl="@@__IMMUTABLE_KEYED__@@";function Bt(n){return!!(n&&n[jl])}var Xl="@@__IMMUTABLE_INDEXED__@@";function Bn(n){return!!(n&&n[Xl])}function $l(n){return Bt(n)||Bn(n)}var bn=function(e){return Kn(e)?e:mn(e)},Er=(function(n){function e(t){return Bt(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 zm="@@__IMMUTABLE_SEQ__@@";function Yl(n){return!!(n&&n[zm])}var km="@@__IMMUTABLE_RECORD__@@";function ns(n){return!!(n&&n[km])}function br(n){return Kn(n)||ns(n)}var rs="@@__IMMUTABLE_ORDERED__@@";function Ur(n){return!!(n&&n[rs])}var ho=0,or=1,ar=2,uh=typeof Symbol=="function"&&Symbol.iterator,Bm="@@iterator",Kl=uh||Bm,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 Vm(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[Bm]);if(typeof e=="function")return e}function W2(n){var e=Zl(n);return e&&e===n.entries}function j2(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 mn=(function(n){function e(t){return t==null?mh():br(t)?t.toSeq():$2(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)?Bt(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})(mn),Mr=(function(n){function e(t){return t==null?mh():Kn(t)?Bt(t)?t.entrySeq():t.toIndexedSeq():ns(t)?t.toSeq().entrySeq():Gm(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})(mn),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})(mn);mn.isSeq=Yl,mn.Keyed=is,mn.Set=po,mn.Indexed=Mr,mn.prototype[zm]=!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 X2=(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(Vm(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(!Vm(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),Hm;function mh(){return Hm||(Hm=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 Gm(n){var e=_h(n);if(e)return e;throw new TypeError("Expected Array or collection object of values: "+n)}function $2(n){var e=_h(n);if(e)return W2(n)?e.fromEntrySeq():j2(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 X2(n):void 0}var Wm="@@__IMMUTABLE_MAP__@@";function Jl(n){return!!(n&&n[Wm])}function vh(n){return Jl(n)&&Ur(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 Y2=Object.prototype.valueOf;function Zn(n){if(n==null)return jm(n);if(typeof n.hashCode=="function")return Ql(n.hashCode(n));var e=ty(n);if(e==null)return jm(e);switch(typeof e){case"boolean":return e?1108378657:1108378656;case"number":return K2(e);case"string":return e.length>ny?Z2(e):yh(e);case"object":case"function":return Q2(e);case"symbol":return J2(e);default:if(typeof e.toString=="function")return yh(e.toString());throw new Error("Value type "+typeof e+" cannot be hashed.")}}function jm(n){return n===null?1108378658:1108378659}function K2(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 Z2(n){var e=wh[n];return e===void 0&&(e=yh(n),Mh===ry&&(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 J2(n){var e=Km[n];return e!==void 0||(e=Ym(),Km[n]=e),e}function Q2(n){var e;if(Sh&&(e=Eh.get(n),e!==void 0)||(e=n[Ps],e!==void 0)||!$m&&(e=n.propertyIsEnumerable&&n.propertyIsEnumerable[Ps],e!==void 0||(e=ey(n),e!==void 0)))return e;if(e=Ym(),Sh)Eh.set(n,e);else{if(Xm!==void 0&&Xm(n)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if($m)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 Xm=Object.isExtensible,$m=(function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}})();function ey(n){if(n&&n.nodeType>0)switch(n.nodeType){case 1:return n.uniqueID;case 9:return n.documentElement&&n.documentElement.uniqueID}}function ty(n){return n.valueOf!==Y2&&typeof n.valueOf=="function"?n.valueOf(n):n}function Ym(){var n=++bh;return bh&1073741824&&(bh=0),n}var Sh=typeof WeakMap=="function",Eh;Sh&&(Eh=new WeakMap);var Km=Object.create(null),bh=0,Ps="__immutablehash__";typeof Symbol=="function"&&(Ps=Symbol(Ps));var ny=16,ry=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=t0(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 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.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),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.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),Qm=(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){o0(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){o0(a);var l=Kn(a);return Yt(r,l?a.get(0):a[0],l?a.get(1):a[1],o)}}})},e})(is);Zm.prototype.cacheResult=ec.prototype.cacheResult=Jm.prototype.cacheResult=Qm.prototype.cacheResult=Rh;function e0(n){var e=ai(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 t0(n,e,t){var r=ai(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=ai(n);return r._iter=n,r.size=n.size,r.reverse=function(){return n},n.flip&&(r.flip=function(){var i=e0(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 n0(n,e,t,r){var i=ai(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 iy(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 sy(n,e,t){var r=Bt(n),i=(Ur(n)?ui():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 Vt(n,s(o))}).asImmutable()}function oy(n,e,t){var r=Bt(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 Vt(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=ai(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 ay(n,e,t){var r=ai(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 r0(n,e,t,r){var i=ai(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 ly=(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=Bt(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})(mn);function cy(n,e){var t=Bt(n),r=[n].concat(e).map(function(s){return Kn(s)?t&&(s=Er(s)):s=t?gh(s):Gm(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&&Bt(i)||Bn(n)&&Bn(i))return i}return new ly(r)}function i0(n,e,t){var r=ai(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 uy(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 hy(n,e){var t=ai(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=a0);var r=Bt(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=a0),t){var r=n.toSeq().map(function(i,s){return[i,t(i,s,n)]}).reduce(function(i,s){return s0(e,i[1],s[1])?s:i});return r&&r[0]}return n.reduce(function(i,s){return s0(e,i,s)?s:i})}function s0(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=ai(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 Vt(n,e){return n===e?n:Yl(n)?e:n.constructor(e)}function o0(n){if(n!==Object(n))throw new TypeError("Expected [K, V] tuple: "+n)}function Ch(n){return Bt(n)?Er:Bn(n)?Rs:uo}function ai(n){return Object.create((Bt(n)?is:Bn(n)?Mr:po).prototype)}function Rh(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):mn.prototype.cacheResult.call(this)}function a0(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 li(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 l0(n){if(dh(n)&&typeof n!="string")return n;if(Ur(n))return n.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+n)}var fy=Object.prototype.toString;function Ph(n){if(!n||typeof n!="object"||fy.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 c0(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):c0(n,e)?typeof n.get=="function"?n.get(e):n[e]:t}function rc(n){if(Array.isArray(n))return li(n);var e={};for(var t in n)fo.call(n,t)&&(e[t]=n[t]);return e}function u0(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 h0(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=f0(br(n),n,l0(e),0,t,r);return i===Mt?t:i}function f0(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=f0(h===Mt?n:br(h),h,t,r+1,i,s);return f===h?e:f===Mt?u0(e,c):h0(o?n?ci():{}:e,c,f)}function d0(n,e,t){return Is(n,e,Mt,function(){return t})}function Lh(n,e){return d0(this,n,e)}function p0(n,e){return Is(n,e,function(){return Mt})}function Oh(n){return p0(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 m0(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];return _0(this,n)}function g0(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 _0(this,e,n)}function _0(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 dy(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return za(n,e)}function py(n,e){for(var t=[],r=arguments.length-2;r-- >0;)t[r]=arguments[r+2];return za(e,t,n)}function my(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return Fa(n,e)}function gy(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,_y(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 _y(n){function e(t,r,i){return ss(t)&&ss(r)&&vy(t,r)?za(t,[r],e):n?n(t,r,i):r}return e}function vy(n,e){var t=mn(n),r=mn(e);return Bn(t)===Bn(r)&&Bt(t)===Bt(r)}function v0(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];return Fa(this,n)}function x0(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,ci(),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,ci(),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?ci():Jl(t)&&!Ur(t)?t:ci().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 E0(this,r,i)},e.prototype.remove=function(r){return E0(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):ci()},e.prototype.sort=function(r){return ui(go(this,r))},e.prototype.sortBy=function(r,i){return ui(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 xy(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?ci():(this.__ownerID=r,this.__altered=!1,this)},e})(Er);Pe.isMap=Jl;var Zt=Pe.prototype;Zt[Wm]=!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=m0,Zt.mergeWith=g0,Zt.mergeDeep=v0,Zt.mergeDeepWith=x0,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>=wy)return yy(e,c,i,s);var d=e&&e===this.ownerID,m=d?c:li(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[M0(o&s-1)].get(e+kt,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=M0(h&c-1),d=this.nodes,m=f?d[p]:void 0,x=Vh(m,e,t+kt,r,i,s,o,a);if(x===m)return this;if(!f&&x&&d.length>=Ty)return Ey(e,d,h,l,x);if(f&&!x&&d.length===2&&b0(d[p^1]))return d[p^1];if(f&&x&&d.length===1&&b0(x))return x;var v=e&&e===this.ownerID,_=f?x?h:h^c:h|c,b=f?x?w0(d,p,x,v):My(d,p,v):by(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+kt,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+kt,r,i,s,o,a);if(p===f)return this;var d=this.count;if(!f)d++;else if(!p&&(d--,d<Ay))return Sy(e,h,d,l);var m=e&&e===this.ownerID,x=w0(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:li(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 xy=(function(n){function e(t,r,i){this._type=r,this._reverse=i,this._stack=t._root&&y0(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=y0(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 y0(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 S0;function ci(){return S0||(S0=Bh(0))}function E0(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):ci()}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 b0(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+kt,r,i)]:(a=new Li(e,r,i),s<o?[n,a]:[a,n]);return new _o(e,1<<s|1<<o,l)}function yy(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 Sy(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 Ey(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 M0(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 w0(n,e,t,r){var i=r?n:li(n);return i[e]=t,i}function by(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 My(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 wy=sr/4,Ty=sr/2,Ay=sr/4,T0="@@__IMMUTABLE_LIST__@@";function Gh(n){return!!(n&&n[T0])}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,kt,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=C0(this,r);return s&&s.array[r&kn]}return i},e.prototype.set=function(r,i){return Cy(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=kt,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=A0(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=A0(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 un=Xe.prototype;un[T0]=!0,un[La]=un.remove,un.merge=un.concat,un.setIn=Lh,un.deleteIn=un.removeIn=Oh,un.update=Dh,un.updateIn=Nh,un.mergeIn=Uh,un.mergeDeepIn=Fh,un.withMutations=ka,un.wasAltered=zh,un.asImmutable=Va,un["@@transducer/init"]=un.asMutable=Ba,un["@@transducer/step"]=function(n,e){return n.push(e)},un["@@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+kt)-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-kt,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+kt: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-kt,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 A0(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-kt,f+(_<<h))}}}}function ja(n,e,t,r,i,s,o){var a=Object.create(un);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,kt)}function Cy(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-kt,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 C0(n,e){if(e>=Xa(n._capacity))return n._tail;if(e<1<<n._level+kt){for(var t=n._root,r=n._level;t&&r>0;)t=t.array[e>>>r&kn],r-=kt;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+=kt,h+=1<<l;h&&(o+=h,i+=h,a+=h,s+=h);for(var f=Xa(s),p=Xa(a);p>=1<<l+kt;)c=new os(c&&c.array.length?[c]:[],r),l+=kt;var d=n._tail,m=p<f?C0(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>kt;v-=kt){var _=f>>>v&kn;x=x.array[_]=xo(x.array[_],r)}x.array[f>>>kt&kn]=d}if(a<s&&(m=m&&m.removeAfter(r,0,a)),o>=p)o-=p,a-=p,l=kt,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-=kt,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>>>kt<<kt}var ui=(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 P0(this,r,i)},e.prototype.remove=function(r){return P0(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);ui.isOrderedMap=vh,ui.prototype[rs]=!0,ui.prototype[La]=ui.prototype.remove;function jh(n,e,t,r){var i=Object.create(ui.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 R0;function $a(){return R0||(R0=jh(ci(),ic()))}function P0(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 I0="@@__IMMUTABLE_STACK__@@";function sc(n){return!!(n&&n[I0])}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[I0]=!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 L0;function ac(){return L0||(L0=Ya(0))}var O0="@@__IMMUTABLE_SET__@@";function lc(n){return!!(n&&n[O0])}function Xh(n){return lc(n)&&Ur(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||Bt(n)!==Bt(e)||Bn(n)!==Bn(e)||Ur(n)!==Ur(e))return!1;if(n.size===0&&e.size===0)return!0;var t=!$l(n);if(Ur(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=mn(n)}if(Bt(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)&&!Ur(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[O0]=!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=q0;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 q0(n,e){var t=Object.create(An);return t.size=n?n.size:0,t._map=n,t.__ownerID=e,t}var D0;function Za(){return D0||(D0=q0(ci()))}var N0=(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=l0(e),i=0;i!==r.length;)if(n=Ih(n,r[i++],Mt),n===Mt)return t;return n}function U0(n,e){return Kh(this,n,e)}function F0(n,e){return Kh(n,e,Mt)!==Mt}function Ry(n){return F0(this,n)}function z0(){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=Bt(this),r=0;return this.__iterate(function(i,s){e[r++]=t?[s,i]:i}),e},toIndexedSeq:function(){return new Zm(this)},toJS:function(){return cc(this)},toKeyedSeq:function(){return new ec(this,!0)},toMap:function(){return Pe(this.toKeyedSeq())},toObject:z0,toOrderedMap:function(){return ui(this.toKeyedSeq())},toOrderedSet:function(){return Eo(Bt(this)?this.valueSeq():this)},toSet:function(){return Ka(Bt(this)?this.valueSeq():this)},toSetSeq:function(){return new Jm(this)},toSeq:function(){return Bn(this)?this.toIndexedSeq():Bt(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return oc(Bt(this)?this.valueSeq():this)},toList:function(){return Xe(Bt(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 Vt(this,cy(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 Vt(this,n0(this,e,t,!0))},partition:function(e,t){return oy(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 Vt(this,t0(this,e,t))},reduce:function(e,t,r){return k0(this,e,t,r,arguments.length<2,!1)},reduceRight:function(e,t,r){return k0(this,e,t,r,arguments.length<2,!0)},reverse:function(){return Vt(this,Th(this,!0))},slice:function(e,t){return Vt(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 Vt(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 iy(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(Iy).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(Dm,null,e)},flatMap:function(e,t){return Vt(this,uy(this,e,t))},flatten:function(e){return Vt(this,i0(this,e,!0))},fromEntrySeq:function(){return new Qm(this)},get:function(e,t){return this.find(function(r,i){return Kt(i,e)},void 0,t)},getIn:U0,groupBy:function(e,t){return sy(this,e,t)},has:function(e){return this.get(e,Mt)!==Mt},hasIn:Ry,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(Py).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?B0(e):H0)},minBy:function(e,t){return tc(this,t?B0(t):H0,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 Vt(this,r0(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Zh(e),t)},sortBy:function(e,t){return Vt(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 Vt(this,ay(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=Ly(this))}});var In=bn.prototype;In[Fm]=!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 Vt(this,e0(this))},mapEntries:function(e,t){var r=this,i=0;return Vt(this,this.toSeq().map(function(s,o){return e.call(t,[o,s],i++,r)}).fromEntrySeq())},mapKeys:function(e,t){var r=this;return Vt(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=z0,Ja.__toStringMapper=function(n,e){return Ua(e)+": "+Ua(n)},Ls(Rs,{toKeyedSeq:function(){return new ec(this,!1)},filter:function(e,t){return Vt(this,n0(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 Vt(this,Th(this,!1))},slice:function(e,t){return Vt(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 Vt(this,r===1?i:i.concat(li(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 Vt(this,i0(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 Vt(this,hy(this,e))},interleave:function(){var e=[this].concat(li(arguments)),t=nc(this.toSeq(),Mr.of,e),r=t.flatten(!0);return t.size&&(r.size=t.size*e.length),Vt(this,r)},keySeq:function(){return N0(0,this.size)},last:function(e){return this.get(-1,e)},skipWhile:function(e,t){return Vt(this,r0(this,e,t,!1))},zip:function(){var e=[this].concat(li(arguments));return Vt(this,nc(this,V0,e))},zipAll:function(){var e=[this].concat(li(arguments));return Vt(this,nc(this,V0,e,!0))},zipWith:function(e){var t=li(arguments);return t[0]=this,Vt(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 k0(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 Py(n,e){return e}function Iy(n,e){return[e,n]}function Zh(n){return function(){return!n.apply(this,arguments)}}function B0(n){return function(){return-n.apply(this,arguments)}}function V0(){return li(arguments)}function H0(n,e){return n<e?1:n>e?-1:0}function Ly(n){if(n.size===1/0)return 0;var e=Ur(n),t=Bt(n),r=e?1:0;return n.__iterate(t?e?function(i,s){r=31*r+G0(Zn(i),Zn(s))|0}:function(i,s){r=r+G0(Zn(i),Zn(s))|0}:e?function(i){r=31*r+Zn(i)|0}:function(i){r=r+Zn(i)|0}),Oy(n.size,r)}function Oy(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 G0(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=W0;function W0(n,e){var t=Object.create(Os);return t.size=n?n.size:0,t._map=n,t.__ownerID=e,t}var j0;function Jh(){return j0||(j0=W0($a()))}var qy={LeftThenRight:-1,RightThenLeft:1};function Dy(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;Dy(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.'):Ny(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(jt);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 jt=mt.prototype;jt[km]=!0,jt[La]=jt.remove,jt.deleteIn=jt.removeIn=Oh,jt.getIn=U0,jt.hasIn=In.hasIn,jt.merge=m0,jt.mergeWith=g0,jt.mergeIn=Uh,jt.mergeDeep=v0,jt.mergeDeepWith=x0,jt.mergeDeepIn=Fh,jt.setIn=Lh,jt.update=Dh,jt.updateIn=Nh,jt.withMutations=ka,jt.asMutable=Ba,jt.asImmutable=Va,jt[Kl]=jt.entries,jt.toJSON=jt.toObject=In.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 bo(n){return gh(n._keys.map(function(e){return[e,n.get(e)]}))}function Ny(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 Uy=(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 X0([],e||Fy,n,"",e&&e.length>2?[]:void 0,{"":n})}function X0(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,mn(t).map(function(a,l){return X0(n,e,a,l,i,t)}),i&&i.slice());return n.pop(),i&&i.pop(),o}return t}function Fy(n,e){return Bn(e)?e.toList():Bt(e)?e.toMap():e.toSet()}var zy="5.1.3",ky=bn;const By=Object.freeze(Object.defineProperty({__proto__:null,Collection:bn,Iterable:ky,List:Xe,Map:Pe,OrderedMap:ui,OrderedSet:Eo,PairSorting:qy,Range:N0,Record:mt,Repeat:Uy,Seq:mn,Set:Ka,Stack:oc,fromJS:At,get:Ih,getIn:Kh,has:c0,hasIn:F0,hash:Zn,is:Kt,isAssociative:$l,isCollection:Kn,isImmutable:br,isIndexed:Bn,isKeyed:Bt,isList:Gh,isMap:Jl,isOrdered:Ur,isOrderedMap:vh,isOrderedSet:Xh,isPlainObject:Ph,isRecord:ns,isSeq:Yl,isSet:lc,isStack:sc,isValueObject:xh,merge:dy,mergeDeep:my,mergeDeepWith:gy,mergeWith:py,remove:u0,removeIn:p0,set:h0,setIn:d0,update:qh,updateIn:Is,version:zy},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",Fr="MODE_WAITING_DRAWING_LINE",zr="MODE_DRAGGING_LINE",kr="MODE_DRAGGING_VERTEX",Br="MODE_DRAGGING_ITEM",Vr="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",$0="MODE_CONFIGURING_PROJECT",of=[rn,qs,Ds,Ns,Fr,cr,ur,wr,zr,kr,Br,Vr,rf,nf,qi],Vy="mm",hi="cm",Y0=[Vy,hi,"m","in","ft","mi"],fi=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 Hy(n,e,t,r,i){return wo(n*r+e*i+t)/Math.sqrt(n*n+e*e)}function Gy(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 Wy(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)<=fi){if(wo(d)<=fi&&wo(m)<=fi){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-fi&&x<=1+fi&&v>=0-fi&&v<=1+fi?{type:"intersecting",point:{x:i+x*(o-i),y:s+x*(a-s)}}:{type:"none"}}function K0(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 jy(n,e,t,r,i,s,o=fi){return K0(n,e,t,r,i,s)<=o}function Xy(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=$y(l,0,1,1,0)),l}function $y(n,e,t,r,i){return r+(i-r)*(n-e)/(t-e)}function Yy(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 Ky(n,e,t,r){return Math.atan2(Math.abs(r-e),Math.abs(t-n))}function Hr({x:n,y:e},{x:t,y:r}){return wo(n-t)<=fi&&wo(e-r)<=fi}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 Zy(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 Jy(n,e){let t=Math.cos(n);return t<e?0:t}function Qy(n,e){let t=Math.sin(n);return t<e?0:t}function e3(n,e,t,r){return{x:(n+t)/2,y:(e+r)/2}}function t3(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 Z0(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",J0="SNAP_GUIDE",n3=Pe({SNAP_POINT:!0,SNAP_LINE:!0,SNAP_SEGMENT:!0,SNAP_GRID:!1,SNAP_GUIDE:!0});class r3 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 i3 extends mt({type:"line",a:-1,b:-1,c:-1,radius:1,priority:1,related:Xe()}){nearestPoint(e,t){return{...Gy(this.a,this.b,this.c,e,t),distance:Hy(this.a,this.b,this.c,e,t)}}isNear(e,t,r){return!0}}class s3 extends mt({type:"line-segment",x1:-1,y1:-1,x2:-1,y2:-1,radius:1,priority:1,related:Xe()}){nearestPoint(e,t){return{...Xy(this.x1,this.y1,this.x2,this.y2,e,t),distance:K0(this.x1,this.y1,this.x2,this.y2,e,t)}}isNear(e,t,r){return!0}}class o3 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 di(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 r3({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 i3({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 s3({x1:e,y1:t,x2:r,y2:i,radius:s,priority:o,related:a}))}function a3(n,e,t,r,i,s){return s=Xe([s]),n.push(new o3({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 l3=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 Q0 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 eg=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||[])})}},tg=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||[])})}},ng=class extends mt({...To,prototype:"holes",offset:-1,line:""},"Hole"){constructor(e={}){super({...e,properties:At(e.properties||{})})}},rg=class extends mt({...To,prototype:"areas",vertices:Xe(),holes:Xe()},"Area"){constructor(e={}){super({...e,properties:At(e.properties||{}),vertices:Xe(e.vertices||[])})}},ig=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 Q0},"Layer"){constructor(e={}){super({...e,vertices:Di(e.vertices,eg),lines:Di(e.lines,tg),holes:Di(e.holes,ng),areas:Di(e.areas,rg),items:Di(e.items,ig),selected:new Q0(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 c3=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,c3);super({...e,grids:Di(e.grids,mf,l3),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 u3 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,u3);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 tg(t).merge({properties:s});case"holes":return new ng(t).merge({properties:s});case"areas":return new rg(t).merge({properties:s});case"items":return new ig(t).merge({properties:s});default:throw new Error("prototype not valid")}}};class sg 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 sg,catalog:new vf,viewer2D:Pe(),mouse:Pe({x:0,y:0}),zoom:0,snapMask:n3,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 sg(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 og{constructor(e,t){ut(this,"u");ut(this,"v");this.u=e,this.v=t}}class h3{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 og(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 og(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 f3=(n,e)=>{let t=[];return n.forEach(r=>{t.push([]);let i=d3(r);i.forEach(s=>{e.adj[s].forEach(a=>{s<=a&&i.has(a)&&t[t.length-1].push([s,a])})})}),t},d3=n=>{let e=new Set;return n.forEach(t=>{e.add(t.u),e.add(t.v)}),e};function p3(n,e){return[n[0]-e[0],n[1]-e[1]]}function ag(n,e){return(n%e+e)%e}function m3(n){return n.map(function(t){return{ev:t,color:0,direction:-1}})}function g3(n,e){let t=p3(e,n);return Math.atan2(t[1],t[0])}function _3(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:g3(t,n[a]),edge:s,position:l})}),i.sort(function(s,o){return o.angle-s.angle}),i})}function lg(n,e){let t,r;for(t=0;t<e.length;t+=1)if(e[t].color<2)return r=-1*e[t].direction,ug(e,t,r),{edge:t,direction:r,position:r===-1?0:1}}function cg(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[ag(l+1,i.length)],{edge:a.index,vertex:a.endpoint,position:a.position,direction:a.position?1:-1}}function ug(n,e,t){n[e].color+=1,n[e].direction=t}function v3(n,e){let t=m3(e),r=_3(n,e),i=[],s=[],o=[],a,l,c,h,f=lg(r,t);for(;f!==void 0;){for(a=[e[f.edge][ag(f.position+1,2)],e[f.edge][f.position]],l=[f.edge],c=[f.direction],h=cg(r,f.edge,f.position,e);h.edge!==f.edge;)a.push(h.vertex),l.push(h.edge),c.push(h.direction),ug(t,h.edge,h.direction),h=cg(r,h.edge,h.position,e);s.push(l),i.push(a),o.push(c),f=lg(r,t)}return{v_cycles:i,e_cycles:s,dir_e_cycles:o,ev_mapping:t}}function x3(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 y3(n,e){let t=v3(n,e),r=t.v_cycles,i=t.e_cycles;x3(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 S3(n,e){let t=Xe();const r=new h3(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=f3(i,r),o=[];return s.forEach(l=>{l.forEach(c=>o.push(c))}),y3(n,o).v_cycles.forEach(l=>{l.shift(),t=t.push(l)}),t}function E3(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);a3(l,m,v,10,_&&b?15:10,null)}}}if(t.get(J0)){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:{}},b3=yc.exports,hg;function yf(){return hg||(hg=1,(function(n,e){(function(t,r){n.exports=r()})(b3,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),C=0;C<y;C++)w[C]=u[C+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 C=u===0?g:u===1?y:[g,y];return w?w.value=C:w={value:C,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,C=0;C<=w;C++)if(u(y[g?w-C:C],C,this)===!1)return C+1;return C},De.prototype.__iterator=function(u,g){var y=this._array,w=y.length-1,C=0;return new V(function(){return C>w?W():te(u,C,y[g?w-C++:C++])})},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,C=w.length-1,D=0;D<=C;D++){var k=w[g?C-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,C=w.length-1,D=0;return new V(function(){var k=w[g?C-D:D];return D++>C?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),C=0;if(ye(w))for(var D;!(D=w.next()).done&&u(D.value,C++,this)!==!1;);return C},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 C=0;return new V(function(){var D=w.next();return D.done?D:te(u,C++,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,C=0;C<w.length;)if(u(w[C],C++,this)===!1)return C;for(var D;!(D=y.next()).done;){var k=D.value;if(w[C]=k,u(k,C++,this)===!1)break}return C},rt.prototype.__iteratorUncached=function(u,g){if(g)return this.cacheResult().__iterator(u,g);var y=this._iterator,w=this._iteratorCache,C=0;return new V(function(){if(C>=w.length){var D=y.next();if(D.done)return D;w[C]=D.value}return te(u,C,w[C++])})};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 C=u._cache;if(C){for(var D=C.length-1,k=0;k<=D;k++){var j=C[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 C=u._cache;if(C){var D=C.length-1,k=0;return new V(function(){var j=C[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(C,D){return je(u,C,D,g)})):Ne(g)?u.call(w,y,it(g).map(function(C,D){return je(u,C,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 C=!1;if(u.size===void 0)if(g.size===void 0)typeof u.cacheResult=="function"&&u.cacheResult();else{C=!0;var D=u;u=g,g=D}var k=!0,j=g.__iterate(function(ae,he){if(y?!u.has(ae):C?!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,C=g?this._start+y*w:this._start,D=0;D<=y;D++){if(u(C,D,this)===!1)return D+1;C+=g?-w:w}return D},Ee.prototype.__iterator=function(u,g){var y=this.size-1,w=this._step,C=g?this._start+y*w:this._start,D=0;return new V(function(){var k=C;return C+=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,C=y&65535;return w*C+((g>>>16)*C+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?ii(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 ii(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[qr],g!==void 0)||!Sa&&(g=u.propertyIsEnumerable&&u.propertyIsEnumerable[qr],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,qr,{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[qr]=g;else if(u.nodeType!==void 0)u[qr]=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,qr="__immutablehash__";typeof Symbol=="function"&&(qr=Symbol(qr));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,C){return g.set(C,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,E2(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 cn(Ca(this,u))},bt.prototype.sortBy=function(u,g){return cn(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(C){return w++,u(C[1],C[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 C=this.entries,D=0,k=C.length;D<k;D++)if(Ve(y,C[D][0]))return C[D][1];return w},X.prototype.update=function(u,g,y,w,C,D,k){for(var j=C===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]===C:j)return this;if(A(k),(j||!He)&&A(D),!(j&&ae.length===1)){if(!He&&!j&&ae.length>=zn)return Nt(u,ae,w,C);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,C]:dt.push([w,C]),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 C=1<<((u===0?g:g>>>u)&E),D=this.bitmap;return(D&C)===0?w:this.nodes[$t(D&C-1)].get(u+b,g,y,w)},re.prototype.update=function(u,g,y,w,C,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&&C===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,C,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,si=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=si,this.nodes=Ii,this):new re(u,si,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 C=(u===0?g:g>>>u)&E,D=this.nodes[C];return D?D.get(u+b,g,y,w):w},ie.prototype.update=function(u,g,y,w,C,D,k){y===void 0&&(y=ft(w));var j=(g===0?y:y>>>g)&E,ae=C===S,he=this.nodes,ge=he[j];if(ae&&!ge)return this;var He=Rt(ge,u,g+b,y,w,C,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 C=this.entries,D=0,k=C.length;D<k;D++)if(Ve(y,C[D][0]))return C[D][1];return w},Y.prototype.update=function(u,g,y,w,C,D,k){y===void 0&&(y=ft(w));var j=C===S;if(y!==this.keyHash)return j?this:(A(k),A(D),Dt(this,u,g,y,[w,C]));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]===C: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,C]:dt.push([w,C]),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,C,D,k){var j=C===S,ae=Ve(w,this.entry[0]);if(ae?C===this.entry[1]:j)return this;if(A(k),j){A(D);return}return ae?u&&u===this.ownerID?(this.entry[1]=C,this):new we(u,this.keyHash,[w,C]):(A(D),Dt(this,u,g,ft(w),[w,C]))},X.prototype.iterate=Y.prototype.iterate=function(u,g){for(var y=this.entries,w=0,C=y.length-1;w<=C;w++)if(u(y[g?C-w:w])===!1)return!1},re.prototype.iterate=ie.prototype.iterate=function(u,g){for(var y=this.nodes,w=0,C=y.length-1;w<=C;w++){var D=y[g?C-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++,C;if(y.entry){if(w===0)return Je(u,y.entry)}else if(y.entries){if(C=y.entries.length-1,w<=C)return Je(u,y.entries[this._reverse?C-w:w])}else if(C=y.nodes.length-1,w<=C){var D=y.nodes[this._reverse?C-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 C=Object.create(P);return C.size=u,C._root=g,C.__ownerID=y,C.__hash=w,C.__altered=!1,C}var lt;function Qe(){return lt||(lt=st(0))}function xt(u,g,y){var w,C;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;C=u.size+(D.value?y===S?-1:1:0)}else{if(y===S)return u;C=1,w=new X(u.__ownerID,[[g,y]])}return u.__ownerID?(u.size=C,u._root=w,u.__hash=void 0,u.__altered=!0,u):w?st(C,w):Qe()}function Rt(u,g,y,w,C,D,k,j){return u?u.update(g,y,w,C,D,k,j):D===S?u:(A(j),A(k),new we(g,w,[C,D]))}function Jt(u){return u.constructor===we||u.constructor===Y}function Dt(u,g,y,w,C){if(u.keyHash===w)return new Y(g,w,[u.entry,C]);var D=(y===0?u.keyHash:u.keyHash>>>y)&E,k=(y===0?w:w>>>y)&E,j,ae=D===k?[Dt(u,g,y+b,w,C)]:(j=new we(g,w,C),D<k?[u,j]:[j,u]);return new re(g,1<<D|1<<k,ae)}function Nt(u,g,y,w){u||(u=new L);for(var C=new we(u,ft(y),[y,w]),D=0;D<g.length;D++){var k=g[D];C=C.update(u,0,void 0,k[0],k[1])}return C}function ot(u,g,y,w){for(var C=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&&(C|=ae,k[D++]=ge)}return new re(u,C,k)}function Qt(u,g,y,w,C){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]=C,new ie(u,D+1,k)}function Et(u,g,y){for(var w=[],C=0;C<y.length;C++){var D=y[C],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 C=u(g,y,w);return Ve(g,C)?g:C}}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 C=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(C)})}function Ts(u,g,y,w){var C=u===S,D=g.next();if(D.done){var k=C?y:u,j=w(k);return j===k?u:j}H(C||u&&u.set,"invalid keyPath");var ae=D.value,he=C?S:u.get(ae,S),ge=Ts(he,g,y,w);return ge===he?u:ge===S?u.remove(ae):(C?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 C=w?u:N(u);return C[g]=y,C}function ir(u,g,y,w){var C=u.length+1;if(w&&g+1===C)return u[g]=y,u;for(var D=new Array(C),k=0,j=0;j<C;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 C=new Array(w),D=0,k=0;k<w;k++)k===g&&(D=1),C[k]=u[k+D];return C}var zn=M/4,kl=M/2,es=M/4;r(en,me);function en(u){var g=_m();if(u==null)return g;if(i2(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(C){C.setSize(w),y.forEach(function(D,k){return C.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=l2(this,u);return y&&y.array[u&E]}return g},en.prototype.set=function(u,g){return zC(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):_m()},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=o2(this,g);return new V(function(){var C=w();return C===Bl?W():te(u,y++,C)})},en.prototype.__iterate=function(u,g){for(var y=0,w=o2(this,g),C;(C=w())!==Bl&&u(C,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 i2(u){return!!(u&&u[s2])}en.isList=i2;var s2="@@__IMMUTABLE_LIST__@@",$n=en.prototype;$n[s2]=!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 C=w===0,D;if(g>0){var k=this.array[w];if(D=k&&k.removeBefore(u,g-b,y),D===k&&C)return this}if(C&&!D)return this;var j=Ma(this,u);if(!C)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 C;if(g>0){var D=this.array[w];if(C=D&&D.removeAfter(u,g-b,y),C===D&&w===this.array.length-1)return this}var k=Ma(this,u);return k.array.splice(w+1),C&&(k.array[w]=C),k};var Bl={};function o2(u,g){var y=u._origin,w=u._capacity,C=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===C?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 si=nt();if(si!==Bl)return si;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,C,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=C,j.__ownerID=D,j.__hash=k,j.__altered=!1,j}var a2;function _m(){return a2||(a2=Vl(0,0,b))}function zC(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,C=u._root,D=O(q);return g>=Hl(u._capacity)?w=vm(w,u.__ownerID,0,g,y,D):C=vm(C,u.__ownerID,u._level,g,y,D),D.value?u.__ownerID?(u._root=C,u._tail=w,u.__hash=void 0,u.__altered=!0,u):Vl(u._origin,u._capacity,u._level,C,w):u}function vm(u,g,y,w,C,D){var k=w>>>y&E,j=u&&k<u.array.length;if(!j&&C===void 0)return u;var ae;if(y>0){var he=u&&u.array[k],ge=vm(he,g,y-b,w,C,D);return ge===he?u:(ae=Ma(u,g),ae.array[k]=ge,ae)}return j&&u.array[k]===C?u:(A(D),ae=Ma(u,g),C===void 0&&k===ae.array.length-1?ae.array.pop():ae.array[k]=C,ae)}function Ma(u,g){return g&&u&&g===u.ownerID?u:new As(u?u.array.slice():[],g)}function l2(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,C=u._origin,D=u._capacity,k=C+g,j=y===void 0?D:y<0?D+y:C+y;if(k===C&&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,C+=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?l2(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,si=ae;si>b;si-=b){var Ii=He>>>si&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>C||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>C&&(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=[],C=0,D=0;D<y.length;D++){var k=y[D],j=o(k);j.size>C&&(C=j.size),l(k)||(j=j.map(function(ae){return We(ae)})),w.push(j)}return C>u.size&&(u=u.setSize(C)),Fn(u,g,w)}function Hl(u){return u<M?0:u-1>>>b<<b}r(cn,bt);function cn(u){return u==null?eh():c2(u)?u:eh().withMutations(function(g){var y=s(u);jn(y.size),y.forEach(function(w,C){return g.set(C,w)})})}cn.of=function(){return this(arguments)},cn.prototype.toString=function(){return this.__toString("OrderedMap {","}")},cn.prototype.get=function(u,g){var y=this._map.get(u);return y!==void 0?this._list.get(y)[1]:g},cn.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):eh()},cn.prototype.set=function(u,g){return h2(this,u,g)},cn.prototype.remove=function(u){return h2(this,u,S)},cn.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},cn.prototype.__iterate=function(u,g){var y=this;return this._list.__iterate(function(w){return w&&u(w[1],w[0],y)},g)},cn.prototype.__iterator=function(u,g){return this._list.fromEntrySeq().__iterator(u,g)},cn.prototype.__ensureOwner=function(u){if(u===this.__ownerID)return this;var g=this._map.__ensureOwner(u),y=this._list.__ensureOwner(u);return u?xm(g,y,u,this.__hash):(this.__ownerID=u,this._map=g,this._list=y,this)};function c2(u){return zl(u)&&p(u)}cn.isOrderedMap=c2,cn.prototype[v]=!0,cn.prototype[_]=cn.prototype.remove;function xm(u,g,y,w){var C=Object.create(cn.prototype);return C.size=u?u.size:0,C._map=u,C._list=g,C.__ownerID=y,C.__hash=w,C}var u2;function eh(){return u2||(u2=xm(Qe(),_m()))}function h2(u,g,y){var w=u._map,C=u._list,D=w.get(g),k=D!==void 0,j,ae;if(y===S){if(!k)return u;C.size>=M&&C.size>=w.size*2?(ae=C.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===C.size-1?C.pop():C.set(D,void 0))}else if(k){if(y===C.get(D)[1])return u;j=w,ae=C.set(D,[g,y])}else j=w.set(g,C.size),ae=C.set(C.size,[g,y]);return u.__ownerID?(u.size=j.size,u._map=j,u._list=ae,u.__hash=void 0,u):xm(j,ae)}r(Dr,it);function Dr(u,g){this._iter=u,this._useKeys=g,this.size=u.size}Dr.prototype.get=function(u,g){return this._iter.get(u,g)},Dr.prototype.has=function(u){return this._iter.has(u)},Dr.prototype.valueSeq=function(){return this._iter.valueSeq()},Dr.prototype.reverse=function(){var u=this,g=ym(this,!0);return this._useKeys||(g.valueSeq=function(){return u._iter.toSeq().reverse()}),g},Dr.prototype.map=function(u,g){var y=this,w=d2(this,u,g);return this._useKeys||(w.valueSeq=function(){return y._iter.toSeq().map(u,g)}),w},Dr.prototype.__iterate=function(u,g){var y=this,w;return this._iter.__iterate(this._useKeys?function(C,D){return u(C,D,y)}:(w=g?x2(this):0,function(C){return u(C,g?--w:w++,y)}),g)},Dr.prototype.__iterator=function(u,g){if(this._useKeys)return this._iter.__iterator(u,g);var y=this._iter.__iterator(U,g),w=g?x2(this):0;return new V(function(){var C=y.next();return C.done?C:te(u,g?--w:w++,C.value,C)})},Dr.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(C){return u(C,w++,y)},g)},wa.prototype.__iterator=function(u,g){var y=this._iter.__iterator(U,g),w=0;return new V(function(){var C=y.next();return C.done?C:te(u,w++,C.value,C)})},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){v2(w);var C=l(w);return u(C?w.get(1):w[1],C?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 C=w.value;if(C){v2(C);var D=l(C);return te(u,D?C.get(0):C[0],D?C.get(1):C[1],w)}}})},wa.prototype.cacheResult=Dr.prototype.cacheResult=Ta.prototype.cacheResult=Aa.prototype.cacheResult=bm;function f2(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=bm,g.__iterateUncached=function(y,w){var C=this;return u.__iterate(function(D,k){return y(k,D,C)!==!1},w)},g.__iteratorUncached=function(y,w){if(y===$){var C=u.__iterator(y,w);return new V(function(){var D=C.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 d2(u,g,y){var w=Ci(u);return w.size=u.size,w.has=function(C){return u.has(C)},w.get=function(C,D){var k=u.get(C,S);return k===S?D:g.call(y,k,C,u)},w.__iterateUncached=function(C,D){var k=this;return u.__iterate(function(j,ae,he){return C(g.call(y,j,ae,he),ae,k)!==!1},D)},w.__iteratorUncached=function(C,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(C,he,g.call(y,ae[1],he,u),j)})},w}function ym(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=f2(u);return w.reverse=function(){return u.flip()},w}),y.get=function(w,C){return u.get(g?w:-1-w,C)},y.has=function(w){return u.has(g?w:-1-w)},y.includes=function(w){return u.includes(w)},y.cacheResult=bm,y.__iterate=function(w,C){var D=this;return u.__iterate(function(k,j){return w(k,j,D)},!C)},y.__iterator=function(w,C){return u.__iterator(w,!C)},y}function p2(u,g,y,w){var C=Ci(u);return w&&(C.has=function(D){var k=u.get(D,S);return k!==S&&!!g.call(y,k,D,u)},C.get=function(D,k){var j=u.get(D,S);return j!==S&&g.call(y,j,D,u)?j:k}),C.__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},C.__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)}})},C}function kC(u,g,y){var w=bt().asMutable();return u.__iterate(function(C,D){w.update(g.call(y,C,D,u),0,function(k){return k+1})}),w.asImmutable()}function BC(u,g,y){var w=c(u),C=(p(u)?cn():bt()).asMutable();u.__iterate(function(k,j){C.update(g.call(y,k,j,u),function(ae){return ae=ae||[],ae.push(w?[j,k]:k),ae})});var D=y2(u);return C.map(function(k){return Wt(u,D(k))})}function Sm(u,g,y,w){var C=u.size;if(g!==void 0&&(g=g|0),y!==void 0&&(y===1/0?y=C:y=y|0),ce(g,y,C))return u;var D=J(g,C),k=oe(y,C);if(D!==D||k!==k)return Sm(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(si,Ii){if(!(yt&&(yt=dt++<D)))return nn++,ge(si,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 VC(u,g,y){var w=Ci(u);return w.__iterateUncached=function(C,D){var k=this;if(D)return this.cacheResult().__iterate(C,D);var j=0;return u.__iterate(function(ae,he,ge){return g.call(y,ae,he,ge)&&++j&&C(ae,he,k)}),j},w.__iteratorUncached=function(C,D){var k=this;if(D)return this.cacheResult().__iterator(C,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)?C===$?he:te(C,He,nt,he):(ae=!1,W())})},w}function m2(u,g,y,w){var C=Ci(u);return C.__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},C.__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)})},C}function HC(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 C=w[0];if(C===u||y&&c(C)||h(u)&&h(C))return C}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 g2(u,g,y){var w=Ci(u);return w.__iterateUncached=function(C,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):C(nt,y?dt:k++,He)===!1&&(j=!0),!j},D)}return ae(u,0),k},w.__iteratorUncached=function(C,D){var k=u.__iterator(C,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(C===$&&(ge=ge[1]),(!g||j.length<g)&&l(ge))j.push(k),k=ge.__iterator(C,D);else return y?he:te(C,ae++,ge,he)}return W()})},w}function GC(u,g,y){var w=y2(u);return u.toSeq().map(function(C,D){return w(g.call(y,C,D,u))}).flatten(!0)}function WC(u,g){var y=Ci(u);return y.size=u.size&&u.size*2-1,y.__iterateUncached=function(w,C){var D=this,k=0;return u.__iterate(function(j,ae){return(!k||w(g,k++,D)!==!1)&&w(j,k++,D)!==!1},C),k},y.__iteratorUncached=function(w,C){var D=u.__iterator(U,C),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=S2);var w=c(u),C=0,D=u.toSeq().map(function(k,j){return[j,k,C++,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=S2),y){var w=u.toSeq().map(function(C,D){return[C,y(C,D,u)]}).reduce(function(C,D){return _2(g,C[1],D[1])?D:C});return w&&w[0]}else return u.reduce(function(C,D){return _2(g,C,D)?D:C})}function _2(u,g,y){var w=u(y,g);return w===0&&y!==g&&(y==null||y!==y)||w>0}function Em(u,g,y){var w=Ci(u);return w.size=new De(y).map(function(C){return C.size}).min(),w.__iterate=function(C,D){for(var k=this.__iterator(U,D),j,ae=0;!(j=k.next()).done&&C(j.value,ae++,this)!==!1;);return ae},w.__iteratorUncached=function(C,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(C,j++,g.apply(null,he.map(function(ge){return ge.value})))})},w}function Wt(u,g){return wt(u)?g:u.constructor(g)}function v2(u){if(u!==Object(u))throw new TypeError("Expected [K, V] tuple: "+u)}function x2(u){return jn(u.size),Z(u)}function y2(u){return c(u)?s:h(u)?o:a}function Ci(u){return Object.create((c(u)?it:h(u)?Ie:$e).prototype)}function bm(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):z.prototype.cacheResult.call(this)}function S2(u,g){return u>g?1:u<g?-1:0}function E2(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);jC(C,j),C.size=j.length,C._name=g,C._keys=j,C._defaultValues=u}this._map=bt(k)},C=w.prototype=Object.create(Rn);return C.constructor=w,w}xr.prototype.toString=function(){return this.__toString(b2(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 '+b2(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,C){return y.get(C)}).__iterator(u,g)},xr.prototype.__iterate=function(u,g){var y=this;return s(this._defaultValues).map(function(w,C){return y.get(C)}).__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 b2(u){return u._name||u.constructor.name||"Record"}function jC(u,g){try{g.forEach(XC.bind(void 0,u))}catch{}}function XC(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?Tm():Mm(u)&&!p(u)?u:Tm().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 wm(this,this._map.set(u,!0))},tn.prototype.remove=function(u){return wm(this,this._map.remove(u))},tn.prototype.clear=function(){return wm(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(C){return C.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(C){return C.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,C){return u(C,C,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 Mm(u){return!!(u&&u[M2])}tn.isSet=Mm;var M2="@@__IMMUTABLE_SET__@@",yr=tn.prototype;yr[M2]=!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=Tm,yr.__make=w2;function wm(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 w2(u,g){var y=Object.create(yr);return y.size=u?u.size:0,y._map=u,y.__ownerID=g,y}var T2;function Tm(){return T2||(T2=w2(Qe()))}r(Ri,tn);function Ri(u){return u==null?Am():A2(u)?u:Am().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 A2(u){return Mm(u)&&p(u)}Ri.isOrderedSet=A2;var rh=Ri.prototype;rh[v]=!0,rh.__empty=Am,rh.__make=C2;function C2(u,g){var y=Object.create(rh);return y.size=u?u.size:0,y._map=u,y.__ownerID=g,y}var R2;function Am(){return R2||(R2=C2(eh()))}r(pn,me);function pn(u){return u==null?Cm():P2(u)?u:Cm().unshiftAll(u)}pn.of=function(){return this(arguments)},pn.prototype.toString=function(){return this.__toString("Stack [","]")},pn.prototype.get=function(u,g){var y=this._head;for(u=K(this,u);y&&u--;)y=y.next;return y?y.value:g},pn.prototype.peek=function(){return this._head&&this._head.value},pn.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)},pn.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)},pn.prototype.pop=function(){return this.slice(1)},pn.prototype.unshift=function(){return this.push.apply(this,arguments)},pn.prototype.unshiftAll=function(u){return this.pushAll(u)},pn.prototype.shift=function(){return this.pop.apply(this,arguments)},pn.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):Cm()},pn.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 C=this.size-y,D=this._head;y--;)D=D.next;return this.__ownerID?(this.size=C,this._head=D,this.__hash=void 0,this.__altered=!0,this):Gl(C,D)},pn.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)},pn.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},pn.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 C=w.value;return w=w.next,te(u,y++,C)}return W()})};function P2(u){return!!(u&&u[I2])}pn.isStack=P2;var I2="@@__IMMUTABLE_STACK__@@",Ra=pn.prototype;Ra[I2]=!0,Ra.withMutations=P.withMutations,Ra.asMutable=P.asMutable,Ra.asImmutable=P.asImmutable,Ra.wasAltered=P.wasAltered;function Gl(u,g,y,w){var C=Object.create(Ra);return C.size=u,C._head=g,C.__ownerID=y,C.__hash=w,C.__altered=!1,C}var L2;function Cm(){return L2||(L2=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 Dr(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 cn(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 pn(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 Wt(this,HC(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,C,D){if(!u.call(g,w,C,D))return y=!1,!1}),y},filter:function(u,g){return Wt(this,p2(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 Wt(this,d2(this,u,g))},reduce:function(u,g,y){jn(this.size);var w,C;return arguments.length<2?C=!0:w=g,this.__iterate(function(D,k,j){C?(C=!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 Wt(this,ym(this,!0))},slice:function(u,g){return Wt(this,Sm(this,u,g,!0))},some:function(u,g){return!this.every(sh(u),g)},sort:function(u){return Wt(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 kC(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(YC).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(C,D,k){if(u.call(g,C,D,k))return w=[D,C],!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 Wt(this,GC(this,u,g))},flatten:function(u){return Wt(this,g2(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=E2(u),C;!(C=w.next()).done;){var D=C.value;if(y=y&&y.get?y.get(D,S):S,y===S)return g}return y},groupBy:function(u,g){return BC(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($C).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?O2(u):D2)},minBy:function(u,g){return th(this,g?O2(g):D2,u)},rest:function(){return this.slice(1)},skip:function(u){return this.slice(Math.max(0,u))},skipLast:function(u){return Wt(this,this.toSeq().reverse().skip(u).reverse())},skipWhile:function(u,g){return Wt(this,m2(this,u,g,!0))},skipUntil:function(u,g){return this.skipWhile(sh(u),g)},sortBy:function(u,g){return Wt(this,Ca(this,g,u))},take:function(u){return this.slice(0,Math.max(0,u))},takeLast:function(u){return Wt(this,this.toSeq().reverse().take(u).reverse())},takeWhile:function(u,g){return Wt(this,VC(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=ZC(this))}});var Yn=i.prototype;Yn[d]=!0,Yn[be]=Yn.values,Yn.__toJS=Yn.toArray,Yn.__toStringMapper=q2,Yn.inspect=Yn.toSource=function(){return this.toString()},Yn.chain=Yn.flatMap,Yn.contains=Yn.includes,Pi(s,{flip:function(){return Wt(this,f2(this))},mapEntries:function(u,g){var y=this,w=0;return Wt(this,this.toSeq().map(function(C,D){return u.call(g,[D,C],w++,y)}).fromEntrySeq())},mapKeys:function(u,g){var y=this;return Wt(this,this.toSeq().flip().map(function(w,C){return u.call(g,w,C,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)+": "+q2(u)},Pi(o,{toKeyedSeq:function(){return new Dr(this,!1)},filter:function(u,g){return Wt(this,p2(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 Wt(this,ym(this,!1))},slice:function(u,g){return Wt(this,Sm(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 Wt(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 Wt(this,g2(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 Wt(this,WC(this,u))},interleave:function(){var u=[this].concat(N(arguments)),g=Em(this.toSeq(),Ie.of,u),y=g.flatten(!0);return g.size&&(y.size=g.size*u.length),Wt(this,y)},keySeq:function(){return Ee(0,this.size)},last:function(){return this.get(-1)},skipWhile:function(u,g){return Wt(this,m2(this,u,g,!1))},zip:function(){var u=[this].concat(N(arguments));return Wt(this,Em(this,KC,u))},zipWith:function(u){var g=N(arguments);return g[0]=this,Wt(this,Em(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 $C(u,g){return g}function YC(u,g){return[g,u]}function sh(u){return function(){return!u.apply(this,arguments)}}function O2(u){return function(){return-u.apply(this,arguments)}}function q2(u){return typeof u=="string"?JSON.stringify(u):String(u)}function KC(){return N(arguments)}function D2(u,g){return u<g?1:u>g?-1:0}function ZC(u){if(u.size===1/0)return 0;var g=p(u),y=c(u),w=g?1:0,C=u.__iterate(y?g?function(D,k){w=31*w+N2(ft(D),ft(k))|0}:function(D,k){w=w+N2(ft(D),ft(k))|0}:g?function(D){w=31*w+ft(D)|0}:function(D){w=w+ft(D)|0});return JC(C,w)}function JC(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 N2(u,g){return u^g+2654435769+(u<<6)+(u>>2)|0}var QC={Iterable:i,Seq:z,Collection:Be,Map:bt,OrderedMap:cn,List:en,Stack:pn,Set:tn,OrderedSet:Ri,Record:xr,Range:Ee,Repeat:Re,is:Ve,fromJS:We};return QC})})(yc)),yc.exports}var Sf,fg;function M3(){if(fg)return Sf;fg=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,dg;function w3(){if(dg)return Ef;dg=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,pg;function T3(){if(pg)return bf;pg=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,mg;function A3(){if(mg)return Mf;mg=1;var n=yf(),e=M3(),t=w3(),r=T3(),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 C3=A3();const R3=oi(C3),P3=Rm(By);var wf,gg;function I3(){if(gg)return wf;gg=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,_g;function L3(){if(_g)return Tf;_g=1;var n=P3,e=I3(),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 O3=L3();const vg=oi(O3),an=(n,e)=>{if(n.last){if(n.last.hashCode()!==e.hashCode()){let t=Pe({time:Date.now(),diff:R3(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},q3=n=>{if(n.last&&n.redoList.size){const e=n.redoList.last(),t=vg(n.last,e.get("diff"));n=n.set("last",t).set("list",n.list.push(e)).set("redoList",n.redoList.pop())}return n},xg=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=vg(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,yg;function D3(){if(yg)return Cf;yg=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,Sg;function Sc(){if(Sg)return Rf;Sg=1;var n=D3(),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,Eg;function N3(){if(Eg)return Pf;Eg=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 U3="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",bg=n=>crypto.getRandomValues(new Uint8Array(n)),Mg=(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 F3=Rm(Object.freeze(Object.defineProperty({__proto__:null,customAlphabet:(n,e=21)=>Mg(n,e,bg),customRandom:Mg,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:bg,urlAlphabet:U3},Symbol.toStringTag,{value:"Module"})));var If,wg;function z3(){if(wg)return If;wg=1;var n=Sc(),e=N3(),t=F3.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,Tg;function k3(){if(Tg)return Lf;Tg=1;var n=z3();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,Ag;function B3(){if(Ag)return Of;Ag=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,Cg;function V3(){return Cg||(Cg=1,qf=0),qf}var Rg;function H3(){return Rg||(Rg=1,(function(n){var e=Sc(),t=k3(),r=B3(),i=V3()||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,Pg;function G3(){return Pg||(Pg=1,Df=H3()),Df}var W3=G3();const j3=oi(W3);class pi{static acquireID(){return j3.generate()}}class Ec{static generateName(e,t){return t.charAt(0).toUpperCase()+t.slice(1)}}class hn{static create(e,t,r,i,s,o){let a=pi.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=fn.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=di(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=Ky(h,f,p,d),M=Jy(b,1e-7),E=Qy(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=hn.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:Vr,snapElements:f,draggingSupport:Pe({layerID:t,holeID:r,startPointX:i,startPointY:s})}),{updatedState:e}}static updateDraggingHole(e,t,r){let i=di(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 gn=class U2{static create(e,t,r,i,s,o,a,l){let c=pi.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=fn.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=U2.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:Br,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)}},fn=class ah{static select(e,t){let r=e.getIn(["scene","groups",t,"elements"]);e=Ot.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=hn.select(e,s,f).updatedState}),c&&c.forEach(f=>{e=gn.select(e,s,f).updatedState}),h&&h.forEach(f=>{e=Us.select(e,s,f).updatedState})}),e=Ot.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=pi.acquireID();return e=e.setIn(["scene","groups",t],new _f({id:t,name:t})),{updatedState:e}}static createFromSelectedElements(e){let t=pi.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}=e3(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}=t3(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=hn.remove(e,i,c).updatedState}),l&&l.forEach(c=>{e=gn.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 gn.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}=Z0(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}=Z0(x,v,i,s,a);return gn.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 Nr{static create(e,t,r,i,s,o,a,l){let c=pi.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=hn.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=fn.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}=Nr.create(e,t,o.type,c,h,i,s,o.get("properties")),{updatedState:x,line:v}=Nr.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=hn.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=hn.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=fn.addElement(e,E.id,t,"lines",m.id).updatedState,e=fn.addElement(e,E.id,t,"lines",v.id).updatedState}),e=Nr.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(jy(c,h,f,p,v,_)){let b=On(c,h,f,p,v,_);b>=0&&b<=1&&(e=hn.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(),_=Hr(x,h[0])||Hr(x,h[1])||Hr(v,h[0])||Hr(v,h[1]),b=Wy(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=Hr(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}=Nr.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:Fr,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=di(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}=Nr.create(e,t,a.get("type"),r,i,r,i);return e=Nr.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=di(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}=Nr.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=di(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=Nr.remove(e,i,o).updatedState,e=Nr.createAvoidingIntersections(e,i,a.type,l.x,l.y,t,r).updatedState,e=at.detectAndUpdateAreas(e,i).updatedState,e=e.merge({mode:Fr,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:zr,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=di(s,h,f,e.snapMask),v=di(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=di(e.snapElements,b,M,e.snapMask),O=di(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=Nr.remove(e,s,a).updatedState,!Hr({x:b,y:M},{x:E,y:S})){let q=Nr.createAvoidingIntersections(e,s,l.type,b,M,E,S,l.properties,x);e=q.updatedState,q.lines.forEach(O=>{T.forEach(A=>{e=fn.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=>Hr(l,{x:r,y:i}));return a?a=a.update(s,l=>l.push(o)):a=new eg({id:pi.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:kr,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=di(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=Hr(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,!Hr(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=fn.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=pi.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=fn.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 Ig=(n,e)=>n.size===e.size&&n.isSuperset(e)&&n.isSubset(e);let at=class{static create(e,t,r){let i=pi.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=Ot.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=hn.unselect(e,t,a.id).updatedState}),s&&s.forEach(a=>{e=gn.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=S3(r,i);let l=Xe(a).map(d=>Xe(d.map(m=>o[m])));l=l.map(d=>E3(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=>Ig(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=>Ig(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&&Zy(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&&Hr(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=hn.setProperties(e,t,s,r).updatedState),i.areas.forEach(s=>e=Us.setProperties(e,t,s,r).updatedState),i.items.forEach(s=>e=gn.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=hn.updateProperties(e,t,s,r).updatedState),i.areas.forEach(s=>e=Us.updateProperties(e,t,s,r).updatedState),i.items.forEach(s=>e=gn.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=hn.setAttributes(e,t,s,r).updatedState),i.items.forEach(s=>e=gn.setAttributes(e,t,s,r).updatedState),{updatedState:e}}};class bc{static create(e,t){let r=pi.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=pi.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 Ot{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=fn.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=hn.remove(e,t,o).updatedState}),s.forEach(o=>{e=gn.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=xg(t)),e=e.merge({mode:rn,scene:t.last,sceneHistory:xg(t)}),{updatedState:e}}static redo(e){let t=e.sceneHistory;return e.scene===t.last&&t.redoList.size>0&&(t=q3(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:$0}),{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
|
|
45
|
+
*/var La="delete",kt=5,sr=1<<kt,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(Dm)),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 Dm(){return!0}function Oa(n,e,t){return(n===0&&!Um(n)||t!==void 0&&n<=-t)&&(e===void 0||t!==void 0&&e>=t)}function co(n,e){return Nm(n,e,0)}function qa(n,e){return Nm(n,e,e)}function Nm(n,e,t){return n===void 0?t:Um(n)?e===1/0?e:Math.max(0,e+n)|0:e===void 0||e===n?n:Math.min(e,n)|0}function Um(n){return n<0||n===0&&1/n===-1/0}var Fm="@@__IMMUTABLE_ITERABLE__@@";function Kn(n){return!!(n&&n[Fm])}var jl="@@__IMMUTABLE_KEYED__@@";function Bt(n){return!!(n&&n[jl])}var Xl="@@__IMMUTABLE_INDEXED__@@";function Bn(n){return!!(n&&n[Xl])}function $l(n){return Bt(n)||Bn(n)}var Mn=function(e){return Kn(e)?e:mn(e)},Er=(function(n){function e(t){return Bt(t)?t:is(t)}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e})(Mn),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})(Mn),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})(Mn);Mn.Keyed=Er,Mn.Indexed=Rs,Mn.Set=uo;var zm="@@__IMMUTABLE_SEQ__@@";function Yl(n){return!!(n&&n[zm])}var km="@@__IMMUTABLE_RECORD__@@";function ns(n){return!!(n&&n[km])}function br(n){return Kn(n)||ns(n)}var rs="@@__IMMUTABLE_ORDERED__@@";function Ur(n){return!!(n&&n[rs])}var ho=0,or=1,ar=2,uh=typeof Symbol=="function"&&Symbol.iterator,Bm="@@iterator",Kl=uh||Bm,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 Vm(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[Bm]);if(typeof e=="function")return e}function W2(n){var e=Zl(n);return e&&e===n.entries}function j2(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 mn=(function(n){function e(t){return t==null?mh():br(t)?t.toSeq():$2(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})(Mn),is=(function(n){function e(t){return t==null?mh().toKeyedSeq():Kn(t)?Bt(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})(mn),Mr=(function(n){function e(t){return t==null?mh():Kn(t)?Bt(t)?t.entrySeq():t.toIndexedSeq():ns(t)?t.toSeq().entrySeq():Gm(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})(mn),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})(mn);mn.isSeq=Yl,mn.Keyed=is,mn.Set=po,mn.Indexed=Mr,mn.prototype[zm]=!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 X2=(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(Vm(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(!Vm(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),Hm;function mh(){return Hm||(Hm=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 Gm(n){var e=_h(n);if(e)return e;throw new TypeError("Expected Array or collection object of values: "+n)}function $2(n){var e=_h(n);if(e)return W2(n)?e.fromEntrySeq():j2(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 X2(n):void 0}var Wm="@@__IMMUTABLE_MAP__@@";function Jl(n){return!!(n&&n[Wm])}function vh(n){return Jl(n)&&Ur(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 Y2=Object.prototype.valueOf;function Zn(n){if(n==null)return jm(n);if(typeof n.hashCode=="function")return Ql(n.hashCode(n));var e=ty(n);if(e==null)return jm(e);switch(typeof e){case"boolean":return e?1108378657:1108378656;case"number":return K2(e);case"string":return e.length>ny?Z2(e):yh(e);case"object":case"function":return Q2(e);case"symbol":return J2(e);default:if(typeof e.toString=="function")return yh(e.toString());throw new Error("Value type "+typeof e+" cannot be hashed.")}}function jm(n){return n===null?1108378658:1108378659}function K2(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 Z2(n){var e=wh[n];return e===void 0&&(e=yh(n),Mh===ry&&(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 J2(n){var e=Km[n];return e!==void 0||(e=Ym(),Km[n]=e),e}function Q2(n){var e;if(Sh&&(e=Eh.get(n),e!==void 0)||(e=n[Ps],e!==void 0)||!$m&&(e=n.propertyIsEnumerable&&n.propertyIsEnumerable[Ps],e!==void 0||(e=ey(n),e!==void 0)))return e;if(e=Ym(),Sh)Eh.set(n,e);else{if(Xm!==void 0&&Xm(n)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if($m)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 Xm=Object.isExtensible,$m=(function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}})();function ey(n){if(n&&n.nodeType>0)switch(n.nodeType){case 1:return n.uniqueID;case 9:return n.documentElement&&n.documentElement.uniqueID}}function ty(n){return n.valueOf!==Y2&&typeof n.valueOf=="function"?n.valueOf(n):n}function Ym(){var n=++bh;return bh&1073741824&&(bh=0),n}var Sh=typeof WeakMap=="function",Eh;Sh&&(Eh=new WeakMap);var Km=Object.create(null),bh=0,Ps="__immutablehash__";typeof Symbol=="function"&&(Ps=Symbol(Ps));var ny=16,ry=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=t0(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 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.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),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.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),Qm=(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){o0(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){o0(a);var l=Kn(a);return Yt(r,l?a.get(0):a[0],l?a.get(1):a[1],o)}}})},e})(is);Zm.prototype.cacheResult=ec.prototype.cacheResult=Jm.prototype.cacheResult=Qm.prototype.cacheResult=Rh;function e0(n){var e=ai(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 t0(n,e,t){var r=ai(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=ai(n);return r._iter=n,r.size=n.size,r.reverse=function(){return n},n.flip&&(r.flip=function(){var i=e0(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 n0(n,e,t,r){var i=ai(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 iy(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 sy(n,e,t){var r=Bt(n),i=(Ur(n)?ui():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 Vt(n,s(o))}).asImmutable()}function oy(n,e,t){var r=Bt(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 Vt(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=ai(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 ay(n,e,t){var r=ai(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 r0(n,e,t,r){var i=ai(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 ly=(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=Bt(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})(mn);function cy(n,e){var t=Bt(n),r=[n].concat(e).map(function(s){return Kn(s)?t&&(s=Er(s)):s=t?gh(s):Gm(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&&Bt(i)||Bn(n)&&Bn(i))return i}return new ly(r)}function i0(n,e,t){var r=ai(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 uy(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 hy(n,e){var t=ai(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=a0);var r=Bt(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=a0),t){var r=n.toSeq().map(function(i,s){return[i,t(i,s,n)]}).reduce(function(i,s){return s0(e,i[1],s[1])?s:i});return r&&r[0]}return n.reduce(function(i,s){return s0(e,i,s)?s:i})}function s0(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=ai(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=Mn(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 Vt(n,e){return n===e?n:Yl(n)?e:n.constructor(e)}function o0(n){if(n!==Object(n))throw new TypeError("Expected [K, V] tuple: "+n)}function Ch(n){return Bt(n)?Er:Bn(n)?Rs:uo}function ai(n){return Object.create((Bt(n)?is:Bn(n)?Mr:po).prototype)}function Rh(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):mn.prototype.cacheResult.call(this)}function a0(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 li(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 l0(n){if(dh(n)&&typeof n!="string")return n;if(Ur(n))return n.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+n)}var fy=Object.prototype.toString;function Ph(n){if(!n||typeof n!="object"||fy.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 c0(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):c0(n,e)?typeof n.get=="function"?n.get(e):n[e]:t}function rc(n){if(Array.isArray(n))return li(n);var e={};for(var t in n)fo.call(n,t)&&(e[t]=n[t]);return e}function u0(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 h0(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=f0(br(n),n,l0(e),0,t,r);return i===Mt?t:i}function f0(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=f0(h===Mt?n:br(h),h,t,r+1,i,s);return f===h?e:f===Mt?u0(e,c):h0(o?n?ci():{}:e,c,f)}function d0(n,e,t){return Is(n,e,Mt,function(){return t})}function Lh(n,e){return d0(this,n,e)}function p0(n,e){return Is(n,e,function(){return Mt})}function Oh(n){return p0(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 m0(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];return _0(this,n)}function g0(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 _0(this,e,n)}function _0(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 dy(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return za(n,e)}function py(n,e){for(var t=[],r=arguments.length-2;r-- >0;)t[r]=arguments[r+2];return za(e,t,n)}function my(n){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return Fa(n,e)}function gy(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,_y(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 _y(n){function e(t,r,i){return ss(t)&&ss(r)&&vy(t,r)?za(t,[r],e):n?n(t,r,i):r}return e}function vy(n,e){var t=mn(n),r=mn(e);return Bn(t)===Bn(r)&&Bt(t)===Bt(r)}function v0(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];return Fa(this,n)}function x0(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,ci(),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,ci(),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?ci():Jl(t)&&!Ur(t)?t:ci().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 E0(this,r,i)},e.prototype.remove=function(r){return E0(this,r,Mt)},e.prototype.deleteAll=function(r){var i=Mn(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):ci()},e.prototype.sort=function(r){return ui(go(this,r))},e.prototype.sortBy=function(r,i){return ui(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 xy(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?ci():(this.__ownerID=r,this.__altered=!1,this)},e})(Er);Pe.isMap=Jl;var Zt=Pe.prototype;Zt[Wm]=!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=m0,Zt.mergeWith=g0,Zt.mergeDeep=v0,Zt.mergeDeepWith=x0,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>=wy)return yy(e,c,i,s);var d=e&&e===this.ownerID,m=d?c:li(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[M0(o&s-1)].get(e+kt,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=M0(h&c-1),d=this.nodes,m=f?d[p]:void 0,x=Vh(m,e,t+kt,r,i,s,o,a);if(x===m)return this;if(!f&&x&&d.length>=Ty)return Ey(e,d,h,l,x);if(f&&!x&&d.length===2&&b0(d[p^1]))return d[p^1];if(f&&x&&d.length===1&&b0(x))return x;var v=e&&e===this.ownerID,_=f?x?h:h^c:h|c,b=f?x?w0(d,p,x,v):My(d,p,v):by(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+kt,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+kt,r,i,s,o,a);if(p===f)return this;var d=this.count;if(!f)d++;else if(!p&&(d--,d<Ay))return Sy(e,h,d,l);var m=e&&e===this.ownerID,x=w0(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:li(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 xy=(function(n){function e(t,r,i){this._type=r,this._reverse=i,this._stack=t._root&&y0(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=y0(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 y0(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 S0;function ci(){return S0||(S0=Bh(0))}function E0(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):ci()}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 b0(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+kt,r,i)]:(a=new Li(e,r,i),s<o?[n,a]:[a,n]);return new _o(e,1<<s|1<<o,l)}function yy(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 Sy(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 Ey(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 M0(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 w0(n,e,t,r){var i=r?n:li(n);return i[e]=t,i}function by(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 My(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 wy=sr/4,Ty=sr/2,Ay=sr/4,T0="@@__IMMUTABLE_LIST__@@";function Gh(n){return!!(n&&n[T0])}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,kt,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=C0(this,r);return s&&s.array[r&kn]}return i},e.prototype.set=function(r,i){return Cy(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=kt,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=A0(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=A0(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 un=Xe.prototype;un[T0]=!0,un[La]=un.remove,un.merge=un.concat,un.setIn=Lh,un.deleteIn=un.removeIn=Oh,un.update=Dh,un.updateIn=Nh,un.mergeIn=Uh,un.mergeDeepIn=Fh,un.withMutations=ka,un.wasAltered=zh,un.asImmutable=Va,un["@@transducer/init"]=un.asMutable=Ba,un["@@transducer/step"]=function(n,e){return n.push(e)},un["@@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+kt)-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-kt,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+kt: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-kt,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 A0(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-kt,f+(_<<h))}}}}function ja(n,e,t,r,i,s,o){var a=Object.create(un);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,kt)}function Cy(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-kt,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 C0(n,e){if(e>=Xa(n._capacity))return n._tail;if(e<1<<n._level+kt){for(var t=n._root,r=n._level;t&&r>0;)t=t.array[e>>>r&kn],r-=kt;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+=kt,h+=1<<l;h&&(o+=h,i+=h,a+=h,s+=h);for(var f=Xa(s),p=Xa(a);p>=1<<l+kt;)c=new os(c&&c.array.length?[c]:[],r),l+=kt;var d=n._tail,m=p<f?C0(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>kt;v-=kt){var _=f>>>v&kn;x=x.array[_]=xo(x.array[_],r)}x.array[f>>>kt&kn]=d}if(a<s&&(m=m&&m.removeAfter(r,0,a)),o>=p)o-=p,a-=p,l=kt,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-=kt,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>>>kt<<kt}var ui=(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 P0(this,r,i)},e.prototype.remove=function(r){return P0(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);ui.isOrderedMap=vh,ui.prototype[rs]=!0,ui.prototype[La]=ui.prototype.remove;function jh(n,e,t,r){var i=Object.create(ui.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 R0;function $a(){return R0||(R0=jh(ci(),ic()))}function P0(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 I0="@@__IMMUTABLE_STACK__@@";function sc(n){return!!(n&&n[I0])}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[I0]=!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 L0;function ac(){return L0||(L0=Ya(0))}var O0="@@__IMMUTABLE_SET__@@";function lc(n){return!!(n&&n[O0])}function Xh(n){return lc(n)&&Ur(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||Bt(n)!==Bt(e)||Bn(n)!==Bn(e)||Ur(n)!==Ur(e))return!1;if(n.size===0&&e.size===0)return!0;var t=!$l(n);if(Ur(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=mn(n)}if(Bt(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)&&!Ur(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=Mn(r).toArray(),r.length?An.intersect.apply(e(r.pop()),r):Za()},e.union=function(r){return r=Mn(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[O0]=!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=q0;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 q0(n,e){var t=Object.create(An);return t.size=n?n.size:0,t._map=n,t.__ownerID=e,t}var D0;function Za(){return D0||(D0=q0(ci()))}var N0=(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=l0(e),i=0;i!==r.length;)if(n=Ih(n,r[i++],Mt),n===Mt)return t;return n}function U0(n,e){return Kh(this,n,e)}function F0(n,e){return Kh(n,e,Mt)!==Mt}function Ry(n){return F0(this,n)}function z0(){lr(this.size);var n={};return this.__iterate(function(e,t){n[t]=e}),n}Mn.Iterator=Tt,Ls(Mn,{toArray:function(){lr(this.size);var e=new Array(this.size||0),t=Bt(this),r=0;return this.__iterate(function(i,s){e[r++]=t?[s,i]:i}),e},toIndexedSeq:function(){return new Zm(this)},toJS:function(){return cc(this)},toKeyedSeq:function(){return new ec(this,!0)},toMap:function(){return Pe(this.toKeyedSeq())},toObject:z0,toOrderedMap:function(){return ui(this.toKeyedSeq())},toOrderedSet:function(){return Eo(Bt(this)?this.valueSeq():this)},toSet:function(){return Ka(Bt(this)?this.valueSeq():this)},toSetSeq:function(){return new Jm(this)},toSeq:function(){return Bn(this)?this.toIndexedSeq():Bt(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return oc(Bt(this)?this.valueSeq():this)},toList:function(){return Xe(Bt(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 Vt(this,cy(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 Vt(this,n0(this,e,t,!0))},partition:function(e,t){return oy(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 Vt(this,t0(this,e,t))},reduce:function(e,t,r){return k0(this,e,t,r,arguments.length<2,!1)},reduceRight:function(e,t,r){return k0(this,e,t,r,arguments.length<2,!0)},reverse:function(){return Vt(this,Th(this,!0))},slice:function(e,t){return Vt(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 Vt(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 iy(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(Iy).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(Dm,null,e)},flatMap:function(e,t){return Vt(this,uy(this,e,t))},flatten:function(e){return Vt(this,i0(this,e,!0))},fromEntrySeq:function(){return new Qm(this)},get:function(e,t){return this.find(function(r,i){return Kt(i,e)},void 0,t)},getIn:U0,groupBy:function(e,t){return sy(this,e,t)},has:function(e){return this.get(e,Mt)!==Mt},hasIn:Ry,isSubset:function(e){return e=typeof e.includes=="function"?e:Mn(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return e=typeof e.isSubset=="function"?e:Mn(e),e.isSubset(this)},keyOf:function(e){return this.findKey(function(t){return Kt(t,e)})},keySeq:function(){return this.toSeq().map(Py).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?B0(e):H0)},minBy:function(e,t){return tc(this,t?B0(t):H0,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 Vt(this,r0(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Zh(e),t)},sortBy:function(e,t){return Vt(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 Vt(this,ay(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=Ly(this))}});var In=Mn.prototype;In[Fm]=!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 Vt(this,e0(this))},mapEntries:function(e,t){var r=this,i=0;return Vt(this,this.toSeq().map(function(s,o){return e.call(t,[o,s],i++,r)}).fromEntrySeq())},mapKeys:function(e,t){var r=this;return Vt(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=z0,Ja.__toStringMapper=function(n,e){return Ua(e)+": "+Ua(n)},Ls(Rs,{toKeyedSeq:function(){return new ec(this,!1)},filter:function(e,t){return Vt(this,n0(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 Vt(this,Th(this,!1))},slice:function(e,t){return Vt(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 Vt(this,r===1?i:i.concat(li(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 Vt(this,i0(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 Vt(this,hy(this,e))},interleave:function(){var e=[this].concat(li(arguments)),t=nc(this.toSeq(),Mr.of,e),r=t.flatten(!0);return t.size&&(r.size=t.size*e.length),Vt(this,r)},keySeq:function(){return N0(0,this.size)},last:function(e){return this.get(-1,e)},skipWhile:function(e,t){return Vt(this,r0(this,e,t,!1))},zip:function(){var e=[this].concat(li(arguments));return Vt(this,nc(this,V0,e))},zipAll:function(){var e=[this].concat(li(arguments));return Vt(this,nc(this,V0,e,!0))},zipWith:function(e){var t=li(arguments);return t[0]=this,Vt(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 k0(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 Py(n,e){return e}function Iy(n,e){return[e,n]}function Zh(n){return function(){return!n.apply(this,arguments)}}function B0(n){return function(){return-n.apply(this,arguments)}}function V0(){return li(arguments)}function H0(n,e){return n<e?1:n>e?-1:0}function Ly(n){if(n.size===1/0)return 0;var e=Ur(n),t=Bt(n),r=e?1:0;return n.__iterate(t?e?function(i,s){r=31*r+G0(Zn(i),Zn(s))|0}:function(i,s){r=r+G0(Zn(i),Zn(s))|0}:e?function(i){r=31*r+Zn(i)|0}:function(i){r=r+Zn(i)|0}),Oy(n.size,r)}function Oy(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 G0(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=W0;function W0(n,e){var t=Object.create(Os);return t.size=n?n.size:0,t._map=n,t.__ownerID=e,t}var j0;function Jh(){return j0||(j0=W0($a()))}var qy={LeftThenRight:-1,RightThenLeft:1};function Dy(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;Dy(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.'):Ny(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(jt);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 jt=mt.prototype;jt[km]=!0,jt[La]=jt.remove,jt.deleteIn=jt.removeIn=Oh,jt.getIn=U0,jt.hasIn=In.hasIn,jt.merge=m0,jt.mergeWith=g0,jt.mergeIn=Uh,jt.mergeDeep=v0,jt.mergeDeepWith=x0,jt.mergeDeepIn=Fh,jt.setIn=Lh,jt.update=Dh,jt.updateIn=Nh,jt.withMutations=ka,jt.asMutable=Ba,jt.asImmutable=Va,jt[Kl]=jt.entries,jt.toJSON=jt.toObject=In.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 bo(n){return gh(n._keys.map(function(e){return[e,n.get(e)]}))}function Ny(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 Uy=(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 X0([],e||Fy,n,"",e&&e.length>2?[]:void 0,{"":n})}function X0(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,mn(t).map(function(a,l){return X0(n,e,a,l,i,t)}),i&&i.slice());return n.pop(),i&&i.pop(),o}return t}function Fy(n,e){return Bn(e)?e.toList():Bt(e)?e.toMap():e.toSet()}var zy="5.1.3",ky=Mn;const By=Object.freeze(Object.defineProperty({__proto__:null,Collection:Mn,Iterable:ky,List:Xe,Map:Pe,OrderedMap:ui,OrderedSet:Eo,PairSorting:qy,Range:N0,Record:mt,Repeat:Uy,Seq:mn,Set:Ka,Stack:oc,fromJS:At,get:Ih,getIn:Kh,has:c0,hasIn:F0,hash:Zn,is:Kt,isAssociative:$l,isCollection:Kn,isImmutable:br,isIndexed:Bn,isKeyed:Bt,isList:Gh,isMap:Jl,isOrdered:Ur,isOrderedMap:vh,isOrderedSet:Xh,isPlainObject:Ph,isRecord:ns,isSeq:Yl,isSet:lc,isStack:sc,isValueObject:xh,merge:dy,mergeDeep:my,mergeDeepWith:gy,mergeWith:py,remove:u0,removeIn:p0,set:h0,setIn:d0,update:qh,updateIn:Is,version:zy},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",Fr="MODE_WAITING_DRAWING_LINE",zr="MODE_DRAGGING_LINE",kr="MODE_DRAGGING_VERTEX",Br="MODE_DRAGGING_ITEM",Vr="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",$0="MODE_CONFIGURING_PROJECT",of=[rn,qs,Ds,Ns,Fr,cr,ur,wr,zr,kr,Br,Vr,rf,nf,qi],Vy="mm",hi="cm",Y0=[Vy,hi,"m","in","ft","mi"],fi=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 Hy(n,e,t,r,i){return wo(n*r+e*i+t)/Math.sqrt(n*n+e*e)}function Gy(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 Wy(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)<=fi){if(wo(d)<=fi&&wo(m)<=fi){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-fi&&x<=1+fi&&v>=0-fi&&v<=1+fi?{type:"intersecting",point:{x:i+x*(o-i),y:s+x*(a-s)}}:{type:"none"}}function K0(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 jy(n,e,t,r,i,s,o=fi){return K0(n,e,t,r,i,s)<=o}function Xy(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=$y(l,0,1,1,0)),l}function $y(n,e,t,r,i){return r+(i-r)*(n-e)/(t-e)}function Yy(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 Ky(n,e,t,r){return Math.atan2(Math.abs(r-e),Math.abs(t-n))}function Hr({x:n,y:e},{x:t,y:r}){return wo(n-t)<=fi&&wo(e-r)<=fi}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 Zy(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 Jy(n,e){let t=Math.cos(n);return t<e?0:t}function Qy(n,e){let t=Math.sin(n);return t<e?0:t}function e3(n,e,t,r){return{x:(n+t)/2,y:(e+r)/2}}function t3(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 Z0(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",J0="SNAP_GUIDE",n3=Pe({SNAP_POINT:!0,SNAP_LINE:!0,SNAP_SEGMENT:!0,SNAP_GRID:!1,SNAP_GUIDE:!0});class r3 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 i3 extends mt({type:"line",a:-1,b:-1,c:-1,radius:1,priority:1,related:Xe()}){nearestPoint(e,t){return{...Gy(this.a,this.b,this.c,e,t),distance:Hy(this.a,this.b,this.c,e,t)}}isNear(e,t,r){return!0}}class s3 extends mt({type:"line-segment",x1:-1,y1:-1,x2:-1,y2:-1,radius:1,priority:1,related:Xe()}){nearestPoint(e,t){return{...Xy(this.x1,this.y1,this.x2,this.y2,e,t),distance:K0(this.x1,this.y1,this.x2,this.y2,e,t)}}isNear(e,t,r){return!0}}class o3 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 di(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 r3({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 i3({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 s3({x1:e,y1:t,x2:r,y2:i,radius:s,priority:o,related:a}))}function a3(n,e,t,r,i,s){return s=Xe([s]),n.push(new o3({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 l3=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 Q0 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 eg=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||[])})}},tg=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||[])})}},ng=class extends mt({...To,prototype:"holes",offset:-1,line:""},"Hole"){constructor(e={}){super({...e,properties:At(e.properties||{})})}},rg=class extends mt({...To,prototype:"areas",vertices:Xe(),holes:Xe()},"Area"){constructor(e={}){super({...e,properties:At(e.properties||{}),vertices:Xe(e.vertices||[])})}},ig=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 Q0},"Layer"){constructor(e={}){super({...e,vertices:Di(e.vertices,eg),lines:Di(e.lines,tg),holes:Di(e.holes,ng),areas:Di(e.areas,rg),items:Di(e.items,ig),selected:new Q0(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 c3=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,c3);super({...e,grids:Di(e.grids,mf,l3),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 u3 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,u3);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 tg(t).merge({properties:s});case"holes":return new ng(t).merge({properties:s});case"areas":return new rg(t).merge({properties:s});case"items":return new ig(t).merge({properties:s});default:throw new Error("prototype not valid")}}};class sg 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 sg,catalog:new vf,viewer2D:Pe(),mouse:Pe({x:0,y:0}),zoom:0,snapMask:n3,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 sg(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 og{constructor(e,t){ut(this,"u");ut(this,"v");this.u=e,this.v=t}}class h3{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 og(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 og(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 f3=(n,e)=>{let t=[];return n.forEach(r=>{t.push([]);let i=d3(r);i.forEach(s=>{e.adj[s].forEach(a=>{s<=a&&i.has(a)&&t[t.length-1].push([s,a])})})}),t},d3=n=>{let e=new Set;return n.forEach(t=>{e.add(t.u),e.add(t.v)}),e};function p3(n,e){return[n[0]-e[0],n[1]-e[1]]}function ag(n,e){return(n%e+e)%e}function m3(n){return n.map(function(t){return{ev:t,color:0,direction:-1}})}function g3(n,e){let t=p3(e,n);return Math.atan2(t[1],t[0])}function _3(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:g3(t,n[a]),edge:s,position:l})}),i.sort(function(s,o){return o.angle-s.angle}),i})}function lg(n,e){let t,r;for(t=0;t<e.length;t+=1)if(e[t].color<2)return r=-1*e[t].direction,ug(e,t,r),{edge:t,direction:r,position:r===-1?0:1}}function cg(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[ag(l+1,i.length)],{edge:a.index,vertex:a.endpoint,position:a.position,direction:a.position?1:-1}}function ug(n,e,t){n[e].color+=1,n[e].direction=t}function v3(n,e){let t=m3(e),r=_3(n,e),i=[],s=[],o=[],a,l,c,h,f=lg(r,t);for(;f!==void 0;){for(a=[e[f.edge][ag(f.position+1,2)],e[f.edge][f.position]],l=[f.edge],c=[f.direction],h=cg(r,f.edge,f.position,e);h.edge!==f.edge;)a.push(h.vertex),l.push(h.edge),c.push(h.direction),ug(t,h.edge,h.direction),h=cg(r,h.edge,h.position,e);s.push(l),i.push(a),o.push(c),f=lg(r,t)}return{v_cycles:i,e_cycles:s,dir_e_cycles:o,ev_mapping:t}}function x3(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 y3(n,e){let t=v3(n,e),r=t.v_cycles,i=t.e_cycles;x3(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 S3(n,e){let t=Xe();const r=new h3(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=f3(i,r),o=[];return s.forEach(l=>{l.forEach(c=>o.push(c))}),y3(n,o).v_cycles.forEach(l=>{l.shift(),t=t.push(l)}),t}function E3(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);a3(l,m,v,10,_&&b?15:10,null)}}}if(t.get(J0)){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:{}},b3=yc.exports,hg;function yf(){return hg||(hg=1,(function(n,e){(function(t,r){n.exports=r()})(b3,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),C=0;C<y;C++)w[C]=u[C+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 C=u===0?g:u===1?y:[g,y];return w?w.value=C:w={value:C,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,C=0;C<=w;C++)if(u(y[g?w-C:C],C,this)===!1)return C+1;return C},De.prototype.__iterator=function(u,g){var y=this._array,w=y.length-1,C=0;return new V(function(){return C>w?W():te(u,C,y[g?w-C++:C++])})},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,C=w.length-1,D=0;D<=C;D++){var k=w[g?C-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,C=w.length-1,D=0;return new V(function(){var k=w[g?C-D:D];return D++>C?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),C=0;if(ye(w))for(var D;!(D=w.next()).done&&u(D.value,C++,this)!==!1;);return C},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 C=0;return new V(function(){var D=w.next();return D.done?D:te(u,C++,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,C=0;C<w.length;)if(u(w[C],C++,this)===!1)return C;for(var D;!(D=y.next()).done;){var k=D.value;if(w[C]=k,u(k,C++,this)===!1)break}return C},rt.prototype.__iteratorUncached=function(u,g){if(g)return this.cacheResult().__iterator(u,g);var y=this._iterator,w=this._iteratorCache,C=0;return new V(function(){if(C>=w.length){var D=y.next();if(D.done)return D;w[C]=D.value}return te(u,C,w[C++])})};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 C=u._cache;if(C){for(var D=C.length-1,k=0;k<=D;k++){var j=C[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 C=u._cache;if(C){var D=C.length-1,k=0;return new V(function(){var j=C[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(C,D){return je(u,C,D,g)})):Ne(g)?u.call(w,y,it(g).map(function(C,D){return je(u,C,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 C=!1;if(u.size===void 0)if(g.size===void 0)typeof u.cacheResult=="function"&&u.cacheResult();else{C=!0;var D=u;u=g,g=D}var k=!0,j=g.__iterate(function(ae,he){if(y?!u.has(ae):C?!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,C=g?this._start+y*w:this._start,D=0;D<=y;D++){if(u(C,D,this)===!1)return D+1;C+=g?-w:w}return D},Ee.prototype.__iterator=function(u,g){var y=this.size-1,w=this._step,C=g?this._start+y*w:this._start,D=0;return new V(function(){var k=C;return C+=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,C=y&65535;return w*C+((g>>>16)*C+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?ii(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 ii(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[qr],g!==void 0)||!Sa&&(g=u.propertyIsEnumerable&&u.propertyIsEnumerable[qr],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,qr,{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[qr]=g;else if(u.nodeType!==void 0)u[qr]=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,qr="__immutablehash__";typeof Symbol=="function"&&(qr=Symbol(qr));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,C){return g.set(C,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,E2(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 cn(Ca(this,u))},bt.prototype.sortBy=function(u,g){return cn(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(C){return w++,u(C[1],C[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 C=this.entries,D=0,k=C.length;D<k;D++)if(Ve(y,C[D][0]))return C[D][1];return w},X.prototype.update=function(u,g,y,w,C,D,k){for(var j=C===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]===C:j)return this;if(A(k),(j||!He)&&A(D),!(j&&ae.length===1)){if(!He&&!j&&ae.length>=zn)return Nt(u,ae,w,C);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,C]:dt.push([w,C]),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 C=1<<((u===0?g:g>>>u)&E),D=this.bitmap;return(D&C)===0?w:this.nodes[$t(D&C-1)].get(u+b,g,y,w)},re.prototype.update=function(u,g,y,w,C,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&&C===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,C,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,si=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=si,this.nodes=Ii,this):new re(u,si,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 C=(u===0?g:g>>>u)&E,D=this.nodes[C];return D?D.get(u+b,g,y,w):w},ie.prototype.update=function(u,g,y,w,C,D,k){y===void 0&&(y=ft(w));var j=(g===0?y:y>>>g)&E,ae=C===S,he=this.nodes,ge=he[j];if(ae&&!ge)return this;var He=Rt(ge,u,g+b,y,w,C,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 C=this.entries,D=0,k=C.length;D<k;D++)if(Ve(y,C[D][0]))return C[D][1];return w},Y.prototype.update=function(u,g,y,w,C,D,k){y===void 0&&(y=ft(w));var j=C===S;if(y!==this.keyHash)return j?this:(A(k),A(D),Dt(this,u,g,y,[w,C]));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]===C: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,C]:dt.push([w,C]),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,C,D,k){var j=C===S,ae=Ve(w,this.entry[0]);if(ae?C===this.entry[1]:j)return this;if(A(k),j){A(D);return}return ae?u&&u===this.ownerID?(this.entry[1]=C,this):new we(u,this.keyHash,[w,C]):(A(D),Dt(this,u,g,ft(w),[w,C]))},X.prototype.iterate=Y.prototype.iterate=function(u,g){for(var y=this.entries,w=0,C=y.length-1;w<=C;w++)if(u(y[g?C-w:w])===!1)return!1},re.prototype.iterate=ie.prototype.iterate=function(u,g){for(var y=this.nodes,w=0,C=y.length-1;w<=C;w++){var D=y[g?C-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++,C;if(y.entry){if(w===0)return Je(u,y.entry)}else if(y.entries){if(C=y.entries.length-1,w<=C)return Je(u,y.entries[this._reverse?C-w:w])}else if(C=y.nodes.length-1,w<=C){var D=y.nodes[this._reverse?C-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 C=Object.create(P);return C.size=u,C._root=g,C.__ownerID=y,C.__hash=w,C.__altered=!1,C}var lt;function Qe(){return lt||(lt=st(0))}function xt(u,g,y){var w,C;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;C=u.size+(D.value?y===S?-1:1:0)}else{if(y===S)return u;C=1,w=new X(u.__ownerID,[[g,y]])}return u.__ownerID?(u.size=C,u._root=w,u.__hash=void 0,u.__altered=!0,u):w?st(C,w):Qe()}function Rt(u,g,y,w,C,D,k,j){return u?u.update(g,y,w,C,D,k,j):D===S?u:(A(j),A(k),new we(g,w,[C,D]))}function Jt(u){return u.constructor===we||u.constructor===Y}function Dt(u,g,y,w,C){if(u.keyHash===w)return new Y(g,w,[u.entry,C]);var D=(y===0?u.keyHash:u.keyHash>>>y)&E,k=(y===0?w:w>>>y)&E,j,ae=D===k?[Dt(u,g,y+b,w,C)]:(j=new we(g,w,C),D<k?[u,j]:[j,u]);return new re(g,1<<D|1<<k,ae)}function Nt(u,g,y,w){u||(u=new L);for(var C=new we(u,ft(y),[y,w]),D=0;D<g.length;D++){var k=g[D];C=C.update(u,0,void 0,k[0],k[1])}return C}function ot(u,g,y,w){for(var C=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&&(C|=ae,k[D++]=ge)}return new re(u,C,k)}function Qt(u,g,y,w,C){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]=C,new ie(u,D+1,k)}function Et(u,g,y){for(var w=[],C=0;C<y.length;C++){var D=y[C],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 C=u(g,y,w);return Ve(g,C)?g:C}}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 C=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(C)})}function Ts(u,g,y,w){var C=u===S,D=g.next();if(D.done){var k=C?y:u,j=w(k);return j===k?u:j}H(C||u&&u.set,"invalid keyPath");var ae=D.value,he=C?S:u.get(ae,S),ge=Ts(he,g,y,w);return ge===he?u:ge===S?u.remove(ae):(C?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 C=w?u:N(u);return C[g]=y,C}function ir(u,g,y,w){var C=u.length+1;if(w&&g+1===C)return u[g]=y,u;for(var D=new Array(C),k=0,j=0;j<C;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 C=new Array(w),D=0,k=0;k<w;k++)k===g&&(D=1),C[k]=u[k+D];return C}var zn=M/4,kl=M/2,es=M/4;r(en,me);function en(u){var g=_m();if(u==null)return g;if(i2(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(C){C.setSize(w),y.forEach(function(D,k){return C.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=l2(this,u);return y&&y.array[u&E]}return g},en.prototype.set=function(u,g){return zC(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):_m()},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=o2(this,g);return new V(function(){var C=w();return C===Bl?W():te(u,y++,C)})},en.prototype.__iterate=function(u,g){for(var y=0,w=o2(this,g),C;(C=w())!==Bl&&u(C,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 i2(u){return!!(u&&u[s2])}en.isList=i2;var s2="@@__IMMUTABLE_LIST__@@",$n=en.prototype;$n[s2]=!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 C=w===0,D;if(g>0){var k=this.array[w];if(D=k&&k.removeBefore(u,g-b,y),D===k&&C)return this}if(C&&!D)return this;var j=Ma(this,u);if(!C)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 C;if(g>0){var D=this.array[w];if(C=D&&D.removeAfter(u,g-b,y),C===D&&w===this.array.length-1)return this}var k=Ma(this,u);return k.array.splice(w+1),C&&(k.array[w]=C),k};var Bl={};function o2(u,g){var y=u._origin,w=u._capacity,C=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===C?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 si=nt();if(si!==Bl)return si;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,C,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=C,j.__ownerID=D,j.__hash=k,j.__altered=!1,j}var a2;function _m(){return a2||(a2=Vl(0,0,b))}function zC(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,C=u._root,D=O(q);return g>=Hl(u._capacity)?w=vm(w,u.__ownerID,0,g,y,D):C=vm(C,u.__ownerID,u._level,g,y,D),D.value?u.__ownerID?(u._root=C,u._tail=w,u.__hash=void 0,u.__altered=!0,u):Vl(u._origin,u._capacity,u._level,C,w):u}function vm(u,g,y,w,C,D){var k=w>>>y&E,j=u&&k<u.array.length;if(!j&&C===void 0)return u;var ae;if(y>0){var he=u&&u.array[k],ge=vm(he,g,y-b,w,C,D);return ge===he?u:(ae=Ma(u,g),ae.array[k]=ge,ae)}return j&&u.array[k]===C?u:(A(D),ae=Ma(u,g),C===void 0&&k===ae.array.length-1?ae.array.pop():ae.array[k]=C,ae)}function Ma(u,g){return g&&u&&g===u.ownerID?u:new As(u?u.array.slice():[],g)}function l2(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,C=u._origin,D=u._capacity,k=C+g,j=y===void 0?D:y<0?D+y:C+y;if(k===C&&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,C+=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?l2(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,si=ae;si>b;si-=b){var Ii=He>>>si&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>C||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>C&&(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=[],C=0,D=0;D<y.length;D++){var k=y[D],j=o(k);j.size>C&&(C=j.size),l(k)||(j=j.map(function(ae){return We(ae)})),w.push(j)}return C>u.size&&(u=u.setSize(C)),Fn(u,g,w)}function Hl(u){return u<M?0:u-1>>>b<<b}r(cn,bt);function cn(u){return u==null?eh():c2(u)?u:eh().withMutations(function(g){var y=s(u);jn(y.size),y.forEach(function(w,C){return g.set(C,w)})})}cn.of=function(){return this(arguments)},cn.prototype.toString=function(){return this.__toString("OrderedMap {","}")},cn.prototype.get=function(u,g){var y=this._map.get(u);return y!==void 0?this._list.get(y)[1]:g},cn.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):eh()},cn.prototype.set=function(u,g){return h2(this,u,g)},cn.prototype.remove=function(u){return h2(this,u,S)},cn.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},cn.prototype.__iterate=function(u,g){var y=this;return this._list.__iterate(function(w){return w&&u(w[1],w[0],y)},g)},cn.prototype.__iterator=function(u,g){return this._list.fromEntrySeq().__iterator(u,g)},cn.prototype.__ensureOwner=function(u){if(u===this.__ownerID)return this;var g=this._map.__ensureOwner(u),y=this._list.__ensureOwner(u);return u?xm(g,y,u,this.__hash):(this.__ownerID=u,this._map=g,this._list=y,this)};function c2(u){return zl(u)&&p(u)}cn.isOrderedMap=c2,cn.prototype[v]=!0,cn.prototype[_]=cn.prototype.remove;function xm(u,g,y,w){var C=Object.create(cn.prototype);return C.size=u?u.size:0,C._map=u,C._list=g,C.__ownerID=y,C.__hash=w,C}var u2;function eh(){return u2||(u2=xm(Qe(),_m()))}function h2(u,g,y){var w=u._map,C=u._list,D=w.get(g),k=D!==void 0,j,ae;if(y===S){if(!k)return u;C.size>=M&&C.size>=w.size*2?(ae=C.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===C.size-1?C.pop():C.set(D,void 0))}else if(k){if(y===C.get(D)[1])return u;j=w,ae=C.set(D,[g,y])}else j=w.set(g,C.size),ae=C.set(C.size,[g,y]);return u.__ownerID?(u.size=j.size,u._map=j,u._list=ae,u.__hash=void 0,u):xm(j,ae)}r(Dr,it);function Dr(u,g){this._iter=u,this._useKeys=g,this.size=u.size}Dr.prototype.get=function(u,g){return this._iter.get(u,g)},Dr.prototype.has=function(u){return this._iter.has(u)},Dr.prototype.valueSeq=function(){return this._iter.valueSeq()},Dr.prototype.reverse=function(){var u=this,g=ym(this,!0);return this._useKeys||(g.valueSeq=function(){return u._iter.toSeq().reverse()}),g},Dr.prototype.map=function(u,g){var y=this,w=d2(this,u,g);return this._useKeys||(w.valueSeq=function(){return y._iter.toSeq().map(u,g)}),w},Dr.prototype.__iterate=function(u,g){var y=this,w;return this._iter.__iterate(this._useKeys?function(C,D){return u(C,D,y)}:(w=g?x2(this):0,function(C){return u(C,g?--w:w++,y)}),g)},Dr.prototype.__iterator=function(u,g){if(this._useKeys)return this._iter.__iterator(u,g);var y=this._iter.__iterator(U,g),w=g?x2(this):0;return new V(function(){var C=y.next();return C.done?C:te(u,g?--w:w++,C.value,C)})},Dr.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(C){return u(C,w++,y)},g)},wa.prototype.__iterator=function(u,g){var y=this._iter.__iterator(U,g),w=0;return new V(function(){var C=y.next();return C.done?C:te(u,w++,C.value,C)})},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){v2(w);var C=l(w);return u(C?w.get(1):w[1],C?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 C=w.value;if(C){v2(C);var D=l(C);return te(u,D?C.get(0):C[0],D?C.get(1):C[1],w)}}})},wa.prototype.cacheResult=Dr.prototype.cacheResult=Ta.prototype.cacheResult=Aa.prototype.cacheResult=bm;function f2(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=bm,g.__iterateUncached=function(y,w){var C=this;return u.__iterate(function(D,k){return y(k,D,C)!==!1},w)},g.__iteratorUncached=function(y,w){if(y===$){var C=u.__iterator(y,w);return new V(function(){var D=C.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 d2(u,g,y){var w=Ci(u);return w.size=u.size,w.has=function(C){return u.has(C)},w.get=function(C,D){var k=u.get(C,S);return k===S?D:g.call(y,k,C,u)},w.__iterateUncached=function(C,D){var k=this;return u.__iterate(function(j,ae,he){return C(g.call(y,j,ae,he),ae,k)!==!1},D)},w.__iteratorUncached=function(C,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(C,he,g.call(y,ae[1],he,u),j)})},w}function ym(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=f2(u);return w.reverse=function(){return u.flip()},w}),y.get=function(w,C){return u.get(g?w:-1-w,C)},y.has=function(w){return u.has(g?w:-1-w)},y.includes=function(w){return u.includes(w)},y.cacheResult=bm,y.__iterate=function(w,C){var D=this;return u.__iterate(function(k,j){return w(k,j,D)},!C)},y.__iterator=function(w,C){return u.__iterator(w,!C)},y}function p2(u,g,y,w){var C=Ci(u);return w&&(C.has=function(D){var k=u.get(D,S);return k!==S&&!!g.call(y,k,D,u)},C.get=function(D,k){var j=u.get(D,S);return j!==S&&g.call(y,j,D,u)?j:k}),C.__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},C.__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)}})},C}function kC(u,g,y){var w=bt().asMutable();return u.__iterate(function(C,D){w.update(g.call(y,C,D,u),0,function(k){return k+1})}),w.asImmutable()}function BC(u,g,y){var w=c(u),C=(p(u)?cn():bt()).asMutable();u.__iterate(function(k,j){C.update(g.call(y,k,j,u),function(ae){return ae=ae||[],ae.push(w?[j,k]:k),ae})});var D=y2(u);return C.map(function(k){return Wt(u,D(k))})}function Sm(u,g,y,w){var C=u.size;if(g!==void 0&&(g=g|0),y!==void 0&&(y===1/0?y=C:y=y|0),ce(g,y,C))return u;var D=J(g,C),k=oe(y,C);if(D!==D||k!==k)return Sm(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(si,Ii){if(!(yt&&(yt=dt++<D)))return nn++,ge(si,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 VC(u,g,y){var w=Ci(u);return w.__iterateUncached=function(C,D){var k=this;if(D)return this.cacheResult().__iterate(C,D);var j=0;return u.__iterate(function(ae,he,ge){return g.call(y,ae,he,ge)&&++j&&C(ae,he,k)}),j},w.__iteratorUncached=function(C,D){var k=this;if(D)return this.cacheResult().__iterator(C,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)?C===$?he:te(C,He,nt,he):(ae=!1,W())})},w}function m2(u,g,y,w){var C=Ci(u);return C.__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},C.__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)})},C}function HC(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 C=w[0];if(C===u||y&&c(C)||h(u)&&h(C))return C}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 g2(u,g,y){var w=Ci(u);return w.__iterateUncached=function(C,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):C(nt,y?dt:k++,He)===!1&&(j=!0),!j},D)}return ae(u,0),k},w.__iteratorUncached=function(C,D){var k=u.__iterator(C,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(C===$&&(ge=ge[1]),(!g||j.length<g)&&l(ge))j.push(k),k=ge.__iterator(C,D);else return y?he:te(C,ae++,ge,he)}return W()})},w}function GC(u,g,y){var w=y2(u);return u.toSeq().map(function(C,D){return w(g.call(y,C,D,u))}).flatten(!0)}function WC(u,g){var y=Ci(u);return y.size=u.size&&u.size*2-1,y.__iterateUncached=function(w,C){var D=this,k=0;return u.__iterate(function(j,ae){return(!k||w(g,k++,D)!==!1)&&w(j,k++,D)!==!1},C),k},y.__iteratorUncached=function(w,C){var D=u.__iterator(U,C),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=S2);var w=c(u),C=0,D=u.toSeq().map(function(k,j){return[j,k,C++,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=S2),y){var w=u.toSeq().map(function(C,D){return[C,y(C,D,u)]}).reduce(function(C,D){return _2(g,C[1],D[1])?D:C});return w&&w[0]}else return u.reduce(function(C,D){return _2(g,C,D)?D:C})}function _2(u,g,y){var w=u(y,g);return w===0&&y!==g&&(y==null||y!==y)||w>0}function Em(u,g,y){var w=Ci(u);return w.size=new De(y).map(function(C){return C.size}).min(),w.__iterate=function(C,D){for(var k=this.__iterator(U,D),j,ae=0;!(j=k.next()).done&&C(j.value,ae++,this)!==!1;);return ae},w.__iteratorUncached=function(C,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(C,j++,g.apply(null,he.map(function(ge){return ge.value})))})},w}function Wt(u,g){return wt(u)?g:u.constructor(g)}function v2(u){if(u!==Object(u))throw new TypeError("Expected [K, V] tuple: "+u)}function x2(u){return jn(u.size),Z(u)}function y2(u){return c(u)?s:h(u)?o:a}function Ci(u){return Object.create((c(u)?it:h(u)?Ie:$e).prototype)}function bm(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):z.prototype.cacheResult.call(this)}function S2(u,g){return u>g?1:u<g?-1:0}function E2(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);jC(C,j),C.size=j.length,C._name=g,C._keys=j,C._defaultValues=u}this._map=bt(k)},C=w.prototype=Object.create(Rn);return C.constructor=w,w}xr.prototype.toString=function(){return this.__toString(b2(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 '+b2(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,C){return y.get(C)}).__iterator(u,g)},xr.prototype.__iterate=function(u,g){var y=this;return s(this._defaultValues).map(function(w,C){return y.get(C)}).__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 b2(u){return u._name||u.constructor.name||"Record"}function jC(u,g){try{g.forEach(XC.bind(void 0,u))}catch{}}function XC(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?Tm():Mm(u)&&!p(u)?u:Tm().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 wm(this,this._map.set(u,!0))},tn.prototype.remove=function(u){return wm(this,this._map.remove(u))},tn.prototype.clear=function(){return wm(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(C){return C.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(C){return C.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,C){return u(C,C,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 Mm(u){return!!(u&&u[M2])}tn.isSet=Mm;var M2="@@__IMMUTABLE_SET__@@",yr=tn.prototype;yr[M2]=!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=Tm,yr.__make=w2;function wm(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 w2(u,g){var y=Object.create(yr);return y.size=u?u.size:0,y._map=u,y.__ownerID=g,y}var T2;function Tm(){return T2||(T2=w2(Qe()))}r(Ri,tn);function Ri(u){return u==null?Am():A2(u)?u:Am().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 A2(u){return Mm(u)&&p(u)}Ri.isOrderedSet=A2;var rh=Ri.prototype;rh[v]=!0,rh.__empty=Am,rh.__make=C2;function C2(u,g){var y=Object.create(rh);return y.size=u?u.size:0,y._map=u,y.__ownerID=g,y}var R2;function Am(){return R2||(R2=C2(eh()))}r(pn,me);function pn(u){return u==null?Cm():P2(u)?u:Cm().unshiftAll(u)}pn.of=function(){return this(arguments)},pn.prototype.toString=function(){return this.__toString("Stack [","]")},pn.prototype.get=function(u,g){var y=this._head;for(u=K(this,u);y&&u--;)y=y.next;return y?y.value:g},pn.prototype.peek=function(){return this._head&&this._head.value},pn.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)},pn.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)},pn.prototype.pop=function(){return this.slice(1)},pn.prototype.unshift=function(){return this.push.apply(this,arguments)},pn.prototype.unshiftAll=function(u){return this.pushAll(u)},pn.prototype.shift=function(){return this.pop.apply(this,arguments)},pn.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):Cm()},pn.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 C=this.size-y,D=this._head;y--;)D=D.next;return this.__ownerID?(this.size=C,this._head=D,this.__hash=void 0,this.__altered=!0,this):Gl(C,D)},pn.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)},pn.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},pn.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 C=w.value;return w=w.next,te(u,y++,C)}return W()})};function P2(u){return!!(u&&u[I2])}pn.isStack=P2;var I2="@@__IMMUTABLE_STACK__@@",Ra=pn.prototype;Ra[I2]=!0,Ra.withMutations=P.withMutations,Ra.asMutable=P.asMutable,Ra.asImmutable=P.asImmutable,Ra.wasAltered=P.wasAltered;function Gl(u,g,y,w){var C=Object.create(Ra);return C.size=u,C._head=g,C.__ownerID=y,C.__hash=w,C.__altered=!1,C}var L2;function Cm(){return L2||(L2=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 Dr(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 cn(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 pn(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 Wt(this,HC(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,C,D){if(!u.call(g,w,C,D))return y=!1,!1}),y},filter:function(u,g){return Wt(this,p2(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 Wt(this,d2(this,u,g))},reduce:function(u,g,y){jn(this.size);var w,C;return arguments.length<2?C=!0:w=g,this.__iterate(function(D,k,j){C?(C=!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 Wt(this,ym(this,!0))},slice:function(u,g){return Wt(this,Sm(this,u,g,!0))},some:function(u,g){return!this.every(sh(u),g)},sort:function(u){return Wt(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 kC(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(YC).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(C,D,k){if(u.call(g,C,D,k))return w=[D,C],!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 Wt(this,GC(this,u,g))},flatten:function(u){return Wt(this,g2(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=E2(u),C;!(C=w.next()).done;){var D=C.value;if(y=y&&y.get?y.get(D,S):S,y===S)return g}return y},groupBy:function(u,g){return BC(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($C).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?O2(u):D2)},minBy:function(u,g){return th(this,g?O2(g):D2,u)},rest:function(){return this.slice(1)},skip:function(u){return this.slice(Math.max(0,u))},skipLast:function(u){return Wt(this,this.toSeq().reverse().skip(u).reverse())},skipWhile:function(u,g){return Wt(this,m2(this,u,g,!0))},skipUntil:function(u,g){return this.skipWhile(sh(u),g)},sortBy:function(u,g){return Wt(this,Ca(this,g,u))},take:function(u){return this.slice(0,Math.max(0,u))},takeLast:function(u){return Wt(this,this.toSeq().reverse().take(u).reverse())},takeWhile:function(u,g){return Wt(this,VC(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=ZC(this))}});var Yn=i.prototype;Yn[d]=!0,Yn[be]=Yn.values,Yn.__toJS=Yn.toArray,Yn.__toStringMapper=q2,Yn.inspect=Yn.toSource=function(){return this.toString()},Yn.chain=Yn.flatMap,Yn.contains=Yn.includes,Pi(s,{flip:function(){return Wt(this,f2(this))},mapEntries:function(u,g){var y=this,w=0;return Wt(this,this.toSeq().map(function(C,D){return u.call(g,[D,C],w++,y)}).fromEntrySeq())},mapKeys:function(u,g){var y=this;return Wt(this,this.toSeq().flip().map(function(w,C){return u.call(g,w,C,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)+": "+q2(u)},Pi(o,{toKeyedSeq:function(){return new Dr(this,!1)},filter:function(u,g){return Wt(this,p2(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 Wt(this,ym(this,!1))},slice:function(u,g){return Wt(this,Sm(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 Wt(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 Wt(this,g2(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 Wt(this,WC(this,u))},interleave:function(){var u=[this].concat(N(arguments)),g=Em(this.toSeq(),Ie.of,u),y=g.flatten(!0);return g.size&&(y.size=g.size*u.length),Wt(this,y)},keySeq:function(){return Ee(0,this.size)},last:function(){return this.get(-1)},skipWhile:function(u,g){return Wt(this,m2(this,u,g,!1))},zip:function(){var u=[this].concat(N(arguments));return Wt(this,Em(this,KC,u))},zipWith:function(u){var g=N(arguments);return g[0]=this,Wt(this,Em(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 $C(u,g){return g}function YC(u,g){return[g,u]}function sh(u){return function(){return!u.apply(this,arguments)}}function O2(u){return function(){return-u.apply(this,arguments)}}function q2(u){return typeof u=="string"?JSON.stringify(u):String(u)}function KC(){return N(arguments)}function D2(u,g){return u<g?1:u>g?-1:0}function ZC(u){if(u.size===1/0)return 0;var g=p(u),y=c(u),w=g?1:0,C=u.__iterate(y?g?function(D,k){w=31*w+N2(ft(D),ft(k))|0}:function(D,k){w=w+N2(ft(D),ft(k))|0}:g?function(D){w=31*w+ft(D)|0}:function(D){w=w+ft(D)|0});return JC(C,w)}function JC(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 N2(u,g){return u^g+2654435769+(u<<6)+(u>>2)|0}var QC={Iterable:i,Seq:z,Collection:Be,Map:bt,OrderedMap:cn,List:en,Stack:pn,Set:tn,OrderedSet:Ri,Record:xr,Range:Ee,Repeat:Re,is:Ve,fromJS:We};return QC})})(yc)),yc.exports}var Sf,fg;function M3(){if(fg)return Sf;fg=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,dg;function w3(){if(dg)return Ef;dg=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,pg;function T3(){if(pg)return bf;pg=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,mg;function A3(){if(mg)return Mf;mg=1;var n=yf(),e=M3(),t=w3(),r=T3(),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 C3=A3();const R3=oi(C3),P3=Rm(By);var wf,gg;function I3(){if(gg)return wf;gg=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,_g;function L3(){if(_g)return Tf;_g=1;var n=P3,e=I3(),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 O3=L3();const vg=oi(O3),an=(n,e)=>{if(n.last){if(n.last.hashCode()!==e.hashCode()){let t=Pe({time:Date.now(),diff:R3(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},q3=n=>{if(n.last&&n.redoList.size){const e=n.redoList.last(),t=vg(n.last,e.get("diff"));n=n.set("last",t).set("list",n.list.push(e)).set("redoList",n.redoList.pop())}return n},xg=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=vg(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,yg;function D3(){if(yg)return Cf;yg=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,Sg;function Sc(){if(Sg)return Rf;Sg=1;var n=D3(),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,Eg;function N3(){if(Eg)return Pf;Eg=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 U3="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",bg=n=>crypto.getRandomValues(new Uint8Array(n)),Mg=(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 F3=Rm(Object.freeze(Object.defineProperty({__proto__:null,customAlphabet:(n,e=21)=>Mg(n,e,bg),customRandom:Mg,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:bg,urlAlphabet:U3},Symbol.toStringTag,{value:"Module"})));var If,wg;function z3(){if(wg)return If;wg=1;var n=Sc(),e=N3(),t=F3.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,Tg;function k3(){if(Tg)return Lf;Tg=1;var n=z3();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,Ag;function B3(){if(Ag)return Of;Ag=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,Cg;function V3(){return Cg||(Cg=1,qf=0),qf}var Rg;function H3(){return Rg||(Rg=1,(function(n){var e=Sc(),t=k3(),r=B3(),i=V3()||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,Pg;function G3(){return Pg||(Pg=1,Df=H3()),Df}var W3=G3();const j3=oi(W3);class pi{static acquireID(){return j3.generate()}}class Ec{static generateName(e,t){return t.charAt(0).toUpperCase()+t.slice(1)}}class hn{static create(e,t,r,i,s,o){let a=pi.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=fn.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=di(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=Ky(h,f,p,d),M=Jy(b,1e-7),E=Qy(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=hn.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:Vr,snapElements:f,draggingSupport:Pe({layerID:t,holeID:r,startPointX:i,startPointY:s})}),{updatedState:e}}static updateDraggingHole(e,t,r){let i=di(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 gn=class U2{static create(e,t,r,i,s,o,a,l){let c=pi.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=fn.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=U2.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:Br,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)}},fn=class ah{static select(e,t){let r=e.getIn(["scene","groups",t,"elements"]);e=Ot.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=wn.select(e,s,f).updatedState}),l&&l.forEach(f=>{e=hn.select(e,s,f).updatedState}),c&&c.forEach(f=>{e=gn.select(e,s,f).updatedState}),h&&h.forEach(f=>{e=Us.select(e,s,f).updatedState})}),e=Ot.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=pi.acquireID();return e=e.setIn(["scene","groups",t],new _f({id:t,name:t})),{updatedState:e}}static createFromSelectedElements(e){let t=pi.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}=e3(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}=t3(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=wn.remove(e,i,c).updatedState,e=at.detectAndUpdateAreas(e,i).updatedState}),a&&a.forEach(c=>{e=hn.remove(e,i,c).updatedState}),l&&l.forEach(c=>{e=gn.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 gn.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}=Z0(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}=Z0(x,v,i,s,a);return gn.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}}},wn=class Nr{static create(e,t,r,i,s,o,a,l){let c=pi.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=hn.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=fn.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}=Nr.create(e,t,o.type,c,h,i,s,o.get("properties")),{updatedState:x,line:v}=Nr.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=hn.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=hn.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=fn.addElement(e,E.id,t,"lines",m.id).updatedState,e=fn.addElement(e,E.id,t,"lines",v.id).updatedState}),e=Nr.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(jy(c,h,f,p,v,_)){let b=On(c,h,f,p,v,_);b>=0&&b<=1&&(e=hn.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(),_=Hr(x,h[0])||Hr(x,h[1])||Hr(v,h[0])||Hr(v,h[1]),b=Wy(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=Hr(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}=Nr.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:Fr,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=di(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}=Nr.create(e,t,a.get("type"),r,i,r,i);return e=Nr.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=di(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}=Nr.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=di(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=Nr.remove(e,i,o).updatedState,e=Nr.createAvoidingIntersections(e,i,a.type,l.x,l.y,t,r).updatedState,e=at.detectAndUpdateAreas(e,i).updatedState,e=e.merge({mode:Fr,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:zr,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=di(s,h,f,e.snapMask),v=di(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=di(e.snapElements,b,M,e.snapMask),O=di(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=Nr.remove(e,s,a).updatedState,!Hr({x:b,y:M},{x:E,y:S})){let q=Nr.createAvoidingIntersections(e,s,l.type,b,M,E,S,l.properties,x);e=q.updatedState,q.lines.forEach(O=>{T.forEach(A=>{e=fn.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=>Hr(l,{x:r,y:i}));return a?a=a.update(s,l=>l.push(o)):a=new eg({id:pi.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:kr,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=di(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=Hr(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=wn.remove(o,r,a).updatedState,!Hr(f,p)){let b=wn.createAvoidingIntersections(o,r,x,f.x,f.y,p.x,p.y,v,d);o=b.updatedState,b.lines.forEach(M=>{_.forEach(E=>{o=fn.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=pi.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=fn.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 Ig=(n,e)=>n.size===e.size&&n.isSuperset(e)&&n.isSubset(e);let at=class{static create(e,t,r){let i=pi.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=Ot.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=wn.unselect(e,t,a.id).updatedState}),i&&i.forEach(a=>{e=hn.unselect(e,t,a.id).updatedState}),s&&s.forEach(a=>{e=gn.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=S3(r,i);let l=Xe(a).map(d=>Xe(d.map(m=>o[m])));l=l.map(d=>E3(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=>Ig(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=>Ig(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&&Zy(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=wn.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&&Hr(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=wn.setProperties(e,t,s,r).updatedState),i.holes.forEach(s=>e=hn.setProperties(e,t,s,r).updatedState),i.areas.forEach(s=>e=Us.setProperties(e,t,s,r).updatedState),i.items.forEach(s=>e=gn.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=wn.updateProperties(e,t,s,r).updatedState),i.holes.forEach(s=>e=hn.updateProperties(e,t,s,r).updatedState),i.areas.forEach(s=>e=Us.updateProperties(e,t,s,r).updatedState),i.items.forEach(s=>e=gn.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=wn.setAttributes(e,t,s,r).updatedState),i.holes.forEach(s=>e=hn.setAttributes(e,t,s,r).updatedState),i.items.forEach(s=>e=gn.setAttributes(e,t,s,r).updatedState),{updatedState:e}}};class bc{static create(e,t){let r=pi.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=pi.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 Ot{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=fn.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=wn.remove(e,t,o).updatedState}),i.forEach(o=>{e=hn.remove(e,t,o).updatedState}),s.forEach(o=>{e=gn.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=xg(t)),e=e.merge({mode:rn,scene:t.last,sceneHistory:xg(t)}),{updatedState:e}}static redo(e){let t=e.sceneHistory;return e.scene===t.last&&t.redoList.size>0&&(t=q3(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:$0}),{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
|
|
46
46
|
* react-is.production.min.js
|
|
47
47
|
*
|
|
48
48
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -66,12 +66,12 @@ Valid keys: `+JSON.stringify(Object.keys(U),null," "));var le=Le(W,Q,be,V,te+".
|
|
|
66
66
|
`+l+` |
|
|
67
67
|
`+s.line+" | "+c+`
|
|
68
68
|
`+l+" | "+Gf("",i.column-1," ")+Gf("",f,"^")}else e+=`
|
|
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",Gr="panning",Wr="zooming",Ar="auto",mi="none",Cr="pan",jr="zoom-in",gi="zoom-out",Cc="none",_i="top",dr="right",vi="bottom",Hn="left",Rc="zoom",rl="pan",Ao="center",Co="left",Wf="right",Ro="top",jf="bottom",$g="cover";function Yg(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?Yg(Object(t),!0).forEach(function(r){iS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Yg(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function iS(n,e,t){return(e=sS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sS(n){var e=oS(n,"string");return typeof e=="symbol"?e:e+""}function oS(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 Kg=3,Zg=fr;function Jg(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 Xt({},Pc(Pc({},jg()),{},{version:Kg,mode:Zg,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 Xt(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 aS(n){return n!==null&&typeof n=="object"&&n.hasOwnProperty("version")&&n.version===Kg}function Rr(n,e,t){let r=nl(n),i=Xg(r);return Gg(i,{x:e,y:t})}function Ic(n){let e=nl(n);return{scaleFactor:e.a,translationX:e.e,translationY:e.f}}function lS(n,e){return Xt(n,{focus:e})}function cS(n,e,t){return Xt(n,{viewerWidth:e,viewerHeight:t})}function Qg(n,e,t,r,i){return Xt(n,{SVGMinX:e,SVGMinY:t,SVGWidth:r,SVGHeight:i})}function uS(n,e,t){return Xt(n,{scaleFactorMin:e,scaleFactorMax:t})}function hS(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 Xt(n,Pc({mode:fr},o))}function fS(n){return Xt(n,Pc({mode:fr},jg()))}function e1(n){return Xt(n,{mode:Zg,startX:null,startY:null,endX:null,endY:null})}class t1{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 n1(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 dS(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?n1(Object(t),!0).forEach(function(r){pS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):n1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function pS(n,e,t){return(e=mS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mS(n){var e=gS(n,"string");return typeof e=="symbol"?e:e+""}function gS(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}]=Wg(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 Xt(n,dS({mode:fr},i),rl)}function _S(n,e,t){return Xt(n,{mode:Gr,startX:e,startY:t,endX:e,endY:t},rl)}function vS(n,e,t,r){if(n.mode!==Gr)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 Xt(h,{mode:Gr,endX:e,endY:t},rl)}function r1(n){return Xt(n,{mode:fr,startX:null,startY:null,endX:null,endY:null},rl)}function xS(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 i1(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 s1(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?s1(Object(t),!0).forEach(function(r){yS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):s1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function yS(n,e,t){return(e=SS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function SS(n){var e=ES(n,"string");return typeof e=="symbol"?e:e+""}function ES(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)),Xt(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 Xt(n,Po(Po({mode:fr},i),{},{startX:null,startY:null,endX:null,endY:null}),Rc)}function o1(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)?Xt(n,{mode:fr,startX:null,startY:null,endX:null,endY:null}):Xt(n,Po(Po({mode:fr},$f(n,h)),{},{startX:null,startY:null,endX:null,endY:null}),Rc)}function a1(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 $g: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 $g: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)?Xt(n,{mode:fr,startX:null,startY:null,endX:null,endY:null}):Xt(n,Po(Po({mode:fr},$f(n,v)),{},{startX:null,startY:null,endX:null,endY:null}),Rc)}function bS(n,e){let{viewerWidth:t,viewerHeight:r}=n,i=Rr(n,t/2,r/2);return Io(n,i.x,i.y,e)}function MS(n,e,t){return Xt(n,{mode:Wr,startX:e,startY:t,endX:e,endY:t})}function wS(n,e,t){if(n.mode!==Wr)throw new Error("update selection not allowed in this mode "+n.mode);return Xt(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=i1(a,l);return o1(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 TS(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 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=r;switch(t){case gi:let c=Rr(r,o,a);l=Io(r,c.x,c.y,1/i.scaleFactor);break;case jr:l=MS(r,o,a);break;case Ar:case Cr:l=_S(r,o,a);break;default:return r}return n.preventDefault(),l}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=n.buttons===0,c=r;switch(t){case jr:r.mode===Wr&&(c=l?Yf(r,o,a,i.scaleFactor):wS(r,o,a));break;case Ar:case Cr:r.mode===Gr&&(c=l?r1(r):vS(r,o,a,i.preventPanOutside?20:void 0));break;default:return r}return n.preventDefault(),c}function u1(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 gi:r.mode===Wr&&(l=Yf(r,o,a,1/i.scaleFactor));break;case jr:r.mode===Wr&&(l=Yf(r,o,a,i.scaleFactor));break;case Ar:case Cr:r.mode===Gr&&(l=r1(r));break;default:return r}return n.preventDefault(),l}function AS(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 CS(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=TS(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 h1(n,e,t,r,i){let s=lS(r,n.type==="mouseenter");return n.preventDefault(),s}function RS(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,{x:o,y:a}=s;return!([mi,Ar].indexOf(t)>=0)||!i.detectAutoPan||!r.focus?r:xS(r,o,a)}class PS extends t1{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 f1(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 d1(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?f1(Object(t),!0).forEach(function(r){IS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):f1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function IS(n,e,t){return(e=LS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function LS(n){var e=OS(n,"string");return typeof e=="symbol"?e:e+""}function OS(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 t1{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(d1(d1({},h),{},{identifier:o.identifier}))}return i}}function qS(n,e,t){let r=n.type;switch(r){case"mousemove":case"mouseup":case"mousedown":case"click":case"dblclick":return new PS(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 p1(n){return n.split(/[ ,]/).filter(Boolean).map(Number)}function m1(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 g1(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?m1(Object(t),!0).forEach(function(r){DS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):m1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function DS(n,e,t){return(e=NS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function NS(n){var e=US(n,"string");return typeof e=="symbol"?e:e+""}function US(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 FS(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 zS(n,e,t,r,i){if(v1(n,i))return x1(n,e,t,r);if(n.touches.length!==1){if([Gr,Wr].indexOf(r.mode)>=0)return e1(r);if([fr].indexOf(r.mode)>=0)return r}return Kf(n,e,t,r,i,l1)}function kS(n,e,t,r,i){return v1(n,i)?x1(n,e,t,r):[Gr,Wr].indexOf(r.mode)>=0?Kf(n,e,t,r,i,c1):r}function BS(n,e,t,r,i){if(!([Gr,Wr].indexOf(r.mode)>=0))return r;let s=HS(n,r,i)?Xt(r,{pinchPointDistance:null}):r;return n.touches.length>0?s:Kf(n,e,t,s,i,u1)}function VS(n,e,t,r,i){return n.stopPropagation(),n.preventDefault(),e1(r)}function _1(n){return typeof n.pinchPointDistance=="number"}function HS(n,e,t){return t.detectPinchGesture&&_1(e)&&n.touches.length<2}function v1(n,e){return e.detectPinchGesture&&n.touches.length>1}function Kf(n,e,t,r,i,s){let o=n.touches.length===0?Xt(r,{mode:r.prePinchMode?fr:r.mode,prePinchMode:null}):r,a=n.touches.length>0?n.touches[0]:n.changedTouches[0],l=FS(a,e);switch(t){case gi:case jr:case Ar:case Cr:return n.stopPropagation(),n.preventDefault(),s(n,e,t,o,i,l);default:return o}}function x1(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=_1(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 Xt(r,Xt(g1(g1({mode:Wr},$f(r,x)),{},{startX:null,startY:null,endX:null,endY:null,prePinchMode:r.prePinchMode?r.prePinchMode:r.mode,pinchPointDistance:f})))}function y1(n){return Xt(n,{miniatureOpen:!0})}function S1(n){return Xt(n,{miniatureOpen:!1})}let GS=n=>["zoom-in","zoom-out","grab","grabbing"].indexOf(n)>-1,E1=()=>navigator.userAgent.toLowerCase(),WS=()=>E1().indexOf("firefox")>-1,jS=()=>E1().indexOf("webkit")>-1;function qc(n){if(!GS(n))return n;if(WS())return`-moz-${n}`;if(jS())return`-webkit-${n}`}function XS(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 $S=1;const YS=()=>`uid${$S++}`;function b1(n){class e extends se.Component{constructor(r){super(r),this.state={uid:YS()}}render(){return se.createElement(n,Zf({_uid:this.state.uid},this.props))}}return e.displayName=`RandomUID(${XS(n)})`,e}const M1="react-svg-pan-zoom_border_gradient";function w1(n){let{direction:e,width:t,height:r,_uid:i}=n,s;switch(e){case _i:s=`translate(${t}, 0) rotate(90)`;break;case dr:s=`translate(${t}, ${r}) rotate(180)`;break;case vi:s=`translate(0, ${r}) rotate(270)`;break;case Hn:default:s=" ";break}let o=`${M1}_gradient_${i}`,a=`${M1}_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}))}w1.propTypes={direction:_e.oneOf([_i,dr,vi,Hn]).isRequired,width:_e.number.isRequired,height:_e.number.isRequired};const Dc=b1(w1);function T1(n){let{startX:e,startY:t,endX:r,endY:i}=n;if(!e||!t||!r||!i)return null;let s=i1({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"}})}T1.propTypes={startX:_e.number,startY:_e.number,endX:_e.number,endY:_e.number};function KS(){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 ZS(){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 JS(){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 QS(){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 eE(){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:[_i,vi].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 tE="#1CA6FC";function A1(n){let{tool:e,value:t,onChangeValue:r,onChangeTool:i,activeToolColor:s=tE,position:o=dr,SVGAlignX:a=Co,SVGAlignY:l=Ro}=n,c=(d,m)=>{i(m),d.stopPropagation(),d.preventDefault()},h=d=>{r(a1(t,a,l)),d.stopPropagation(),d.preventDefault()},f=[_i,vi].indexOf(o)>=0,p={position:"absolute",transform:[_i,vi].indexOf(o)>=0?"translate(-50%, 0px)":"none",top:[Hn,dr,_i].indexOf(o)>=0?"5px":"unset",left:[_i,vi].indexOf(o)>=0?"50%":Hn===o?"5px":"unset",right:[dr].indexOf(o)>=0?"5px":"unset",bottom:[vi].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===mi,activeColor:s,name:"unselect-tools",title:"Selection",onClick:d=>c(d,mi)},se.createElement(KS,null)),se.createElement(Oo,{toolbarPosition:o,active:e===Cr,activeColor:s,name:"select-tool-pan",title:"Pan",onClick:d=>c(d,Cr)},se.createElement(ZS,null)),se.createElement(Oo,{toolbarPosition:o,active:e===jr,activeColor:s,name:"select-tool-zoom-in",title:"Zoom in",onClick:d=>c(d,jr)},se.createElement(JS,null)),se.createElement(Oo,{toolbarPosition:o,active:e===gi,activeColor:s,name:"select-tool-zoom-out",title:"Zoom out",onClick:d=>c(d,gi)},se.createElement(QS,null)),se.createElement(Oo,{toolbarPosition:o,active:!1,activeColor:s,name:"fit-to-viewer",title:"Fit to viewer",onClick:d=>h(d)},se.createElement(eE,null)))}A1.propTypes={tool:_e.string.isRequired,onChangeTool:_e.func.isRequired,value:_e.object.isRequired,onChangeValue:_e.func.isRequired,position:_e.oneOf([_i,dr,vi,Hn]),SVGAlignX:_e.oneOf([Ao,Co,Wf]),SVGAlignY:_e.oneOf([Ao,Ro,jf]),activeToolColor:_e.string};function nE(){return"ontouchstart"in window||navigator.maxTouchPoints}function C1(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"})))}C1.propTypes={open:_e.bool.isRequired,position:_e.oneOf([dr,Hn]).isRequired};function R1(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?S1:y1;return se.createElement("button",{type:"button",style:i,onClick:()=>t(s(e))},se.createElement(C1,{open:e.miniatureOpen,position:r}))}R1.propTypes={value:_e.object.isRequired,onChangeValue:_e.func.isRequired,position:_e.oneOf([dr,Hn]).isRequired};const rE="react-svg-pan-zoom_miniature";function P1(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=`${rE}_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}}))}P1.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 iE=b1(P1),sE="#616264";function I1(n){let{value:e,onChangeValue:t,children:r,SVGBackground:i,background:s=sE,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}]=Wg(Xg(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(iE,{SVGWidth:f,SVGHeight:p,SVGMinX:c,SVGMinY:h,x1:_,y1:b,x2:M,y2:E,zoomToFit:v})))),se.createElement(R1,{value:e,onChangeValue:t,position:o}))}I1.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 oE(){console.error(`HEY! With ReactSVGPanZoom >= 3 you MUST specify value and tool props. Please read here ${Jf}`)}function aE(){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 lE(){console.error(`HEY! With ReactSVGPanZoom >= 3 the prop toolbarPosition can be specified as key in the toolbarProps object. Please read here ${Jf}`)}function L1(n){(zs(n.tool)||zs(n.value))&&oE(),(!zs(n.miniaturePosition)||!zs(n.miniatureBackground)||!zs(n.miniatureWidth)||!zs(n.miniatureHeight))&&aE(),zs(n.toolbarPosition)||lE()}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 O1(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 cE(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?O1(Object(t),!0).forEach(function(r){uE(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):O1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function uE(n,e,t){return(e=hE(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hE(n){var e=fE(n,"string");return typeof e=="symbol"?e:e+""}function fE(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]=p1(l);c=Jg(r,i,h,f,p,d,s,o)}else{const{width:h,height:f}=a.props;c=Jg(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"&&L1(e)}componentDidUpdate(e){const t=this.getValue(),r=this.props;let i=t,s=!1;process.env.NODE_ENV!=="production"&&L1(r);const{viewBox:o}=r.children.props;if(o){const[a,l,c,h]=p1(o);(t.SVGMinX!==a||t.SVGMinY!==l||t.SVGWidth!==c||t.SVGHeight!==h)&&(i=Qg(i,a,l,c,h),s=!0)}else{const{width:a,height:l}=r.children.props;(t.SVGWidth!==a||t.SVGHeight!==l)&&(i=Qg(i,0,0,a,l),s=!0)}(e.width!==r.width||e.height!==r.height)&&(i=cS(i,r.width,r.height),s=!0),(e.scaleFactorMin!==r.scaleFactorMin||e.scaleFactorMax!==r.scaleFactorMax)&&(i=uS(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 aS(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===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=o1(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=a1(this.getValue(),e,t);this.setValue(r)}zoomOnViewerCenter(e){let t=bS(this.getValue(),e);this.setValue(t)}setPointOnViewerCenter(e,t,r){let i=hS(this.getValue(),e,t,r);this.setValue(i)}reset(){let e=fS(this.getValue());this.setValue(e)}openMiniature(){let e=y1(this.getValue());this.setValue(e)}closeMiniature(){let e=S1(this.getValue());this.setValue(e)}handleViewerEvent(e){let{props:t,ViewerDOM:r}=this;if(!([mi,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(qS(e,t.value,r))}autoPanLoop(){let e={x:this.state.pointerX,y:this.state.pointerY},t=RS(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=CS(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=A1,customMiniature:a=I1}=e,l=i===Ar&&s.mode===Gr&&s.startX!==s.endX&&s.startY!==s.endY,c;i===Cr&&(c=qc(s.mode===Gr?"grabbing":"grab")),i===jr&&(c=qc("zoom-in")),i===gi&&(c=qc("zoom-out")),l&&(c=qc("grabbing"));let h=[Cr,jr,gi].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:cE({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=l1(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=c1(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=u1(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=AS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onMouseEnter:d=>{if(nE())return;let m=h1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m)},onMouseLeave:d=>{let m=h1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m)},onTouchStart:d=>{let m=zS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onTouchMove:d=>{let m=kS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onTouchEnd:d=>{let m=BS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onTouchCancel:d=>{let m=VS(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:tS(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,Ar].indexOf(i)>=0&&e.detectAutoPan&&s.focus?se.createElement("g",{style:{pointerEvents:"none"}},r<=20?se.createElement(Dc,{direction:_i,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:vi,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!==Wr?null:se.createElement(T1,{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,Gr,Wr]).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,mi,Cr,jr,gi]).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,_i,dr,vi,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 dE=["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 pE(n,e){if(n==null)return{};var t,r,i=mE(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 mE(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 gE 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=pE(e,dE),{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))}}gE.propTypes={width:_e.number.isRequired,height:_e.number.isRequired,defaultValue:_e.object,defaultTool:_e.string};const Ht=G2(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:Ot.newProject(e.planner).updatedState}))},selectTool3DView:()=>{n(e=>{const r=Ot.unselectAll(e.planner).updatedState.set("mode",Oi);return{...e,planner:r}})},selectTool3DFirstPerson:()=>{n(e=>{const r=Ot.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=Ot.undo(e.planner).updatedState;return{...e,planner:t}})},redo:()=>{n(e=>{const t=Ot.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=fn.create(e.planner).updatedState;return{...e,planner:t}})},selectGroup:e=>{n(t=>{const r=fn.select(t.planner,e).updatedState;return{...t,planner:r}})},setGroupProperties:(e,t)=>{n(r=>{const i=fn.setProperties(r.planner,e,t).updatedState;return{...r,planner:i}})},addToGroup:(e,t,r,i)=>{n(s=>{const o=fn.addElement(s.planner,e,t,r,i).updatedState;return{...s,planner:o}})},removeGroup:e=>{n(t=>{const r=fn.remove(t.planner,e).updatedState;return{...t,planner:r}})},setGroupAttributes:(e,t)=>{n(r=>{const i=fn.setAttributes(r.planner,e,t).updatedState;return{...r,planner:i}})},groupTranslate:(e,t,r)=>{n(i=>{const s=fn.translate(i.planner,e,t,r).updatedState;return{...i,planner:s}})},removeFromGroup:(e,t,r,i)=>{n(s=>{const o=fn.removeElement(s.planner,e,t,r,i).updatedState;return{...s,planner:o}})},groupRotate:(e,t)=>{n(r=>{const i=fn.rotate(r.planner,e,t).updatedState;return{...r,planner:i}})},removeGroupAndDeleteElements:e=>{n(t=>{const r=fn.removeAndDeleteElements(t.planner,e).updatedState;return{...t,planner:r}})},addGroupFromSelected:()=>{n(e=>{const t=fn.createFromSelectedElements(e.planner).updatedState;return{...e,planner:t}})},copyProperties:e=>{n(t=>({...t,planner:Ot.copyProperties(t.planner,e).updatedState}))},setProjectProperties:e=>{n(t=>({...t,planner:Ot.setProjectProperties(t.planner,e).updatedState}))},pasteProperties:()=>{n(e=>{const t=e.planner.merge({sceneHistory:an(e.planner.sceneHistory,e.planner.scene)});return{...e,planner:Ot.pasteProperties(t).updatedState}})},setProperties:e=>{n(t=>{const r=t.planner.merge({sceneHistory:an(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Ot.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:Ot.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:Ot.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:Ot.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=hn.select(r.planner,e,t).updatedState;return{...r,planner:i}})},selectItem:(e,t)=>{n(r=>{const i=gn.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=Ot.toggleSnap(t.planner,e).updatedState;return{...t,planner:r}})},openProjectConfigurator:()=>{n(e=>{const t=Ot.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:Ot.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:Ot.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:Ot.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:hn.updateDrawingHole(i.planner,e,t,r).updatedState}))},updateDrawingItem:(e,t,r)=>{n(i=>({...i,planner:gn.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:hn.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:gn.updateDraggingItem(r.planner,e,t).updatedState}))},updateRotatingItem:(e,t)=>{n(r=>({...r,planner:gn.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:gn.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:gn.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:gn.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:gn.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:hn.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:hn.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:hn.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:gn.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:Ot.initCatalog(t.planner,e).updatedState}))},goBackToCatalogPage:e=>{n(t=>({...t,planner:Ot.goBackToCatalogPage(t.planner,e).updatedState}))},pushLastSelectedCatalogElementToHistory:e=>{n(t=>({...t,planner:Ot.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:gn.selectToolDrawingItem(r,e).updatedState}})},selectToolDrawingHole:e=>{n(t=>{const r=t.planner.merge({sceneHistory:an(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:hn.selectToolDrawingHole(r,e).updatedState}})},changeCatalogPage:(e,t)=>{n(r=>({...r,planner:Ot.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:Ot.remove(t).updatedState}})},rollback:()=>{n(e=>({...e,planner:Ot.rollback(e.planner).updatedState}))},setAlterateState:()=>{n(e=>({...e,planner:Ot.setAlterate(e.planner).updatedState}))},setPlan:e=>{n(t=>({...t,plan:e}))},unselectAll:()=>{n(e=>({...e,planner:Ot.unselectAll(e.planner).updatedState}))}})),il={stroke:"#D32F2F",strokeWidth:"1px"};function _E({snap:n,width:e,height:t}){switch(n.type){case"point":return R.jsxs("g",{transform:`translate(${n.x} ${n.y})`,children:[R.jsx("line",{x1:"0",y1:"-70",x2:"0",y2:"70",style:il}),R.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?R.jsx("line",{x1:s.x,y1:s.y,x2:o.x,y2:o.y,style:il}):c&&h?R.jsx("line",{x1:c.x,y1:c.y,x2:h.x,y2:h.y,style:il}):null;case"line-segment":return R.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"},q1={500:{orange:"#FF9800"}},vE={alt:"#2E2F33",text_main:Fc.white},xE={main:"#1CA6FC"},ed="#99C3FB",Ut={COLORS:Fc,PRIMARY_COLOR:vE,SECONDARY_COLOR:xE,MESH_SELECTED:ed,AREA_MESH_COLOR:{selected:ed,unselected:"#F5F4F4"},LINE_MESH_COLOR:{selected:ed}};function yE({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(R.jsx("line",{x1:"0",y1:a,x2:n,y2:a,strokeWidth:"1",stroke:l},a))}return R.jsx("g",{children:s})}function SE({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(R.jsx("line",{x1:a,y1:"0",x2:a,y2:e,strokeWidth:"1",stroke:l},a))}return R.jsx("g",{children:s})}function EE({scene:n}){let{width:e,height:t,grids:r}=n,i=r.entrySeq().map(([s,o])=>{switch(o.type){case"horizontal-streak":return R.jsx(yE,{width:e,height:t,grid:o},s);case"vertical-streak":return R.jsx(SE,{width:e,height:t,grid:o},s);default:console.warn(`grid ${o.type} not allowed`)}}).toList();return R.jsx("g",{children:i})}class bE{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 ME(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 bE([],(_,b)=>b.max-_.max);let f=TE(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}
|
|
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",Gr="panning",Wr="zooming",Ar="auto",mi="none",Cr="pan",jr="zoom-in",gi="zoom-out",Cc="none",_i="top",dr="right",vi="bottom",Hn="left",Rc="zoom",rl="pan",Ao="center",Co="left",Wf="right",Ro="top",jf="bottom",$g="cover";function Yg(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?Yg(Object(t),!0).forEach(function(r){iS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Yg(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function iS(n,e,t){return(e=sS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sS(n){var e=oS(n,"string");return typeof e=="symbol"?e:e+""}function oS(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 Kg=3,Zg=fr;function Jg(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 Xt({},Pc(Pc({},jg()),{},{version:Kg,mode:Zg,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 Xt(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 aS(n){return n!==null&&typeof n=="object"&&n.hasOwnProperty("version")&&n.version===Kg}function Rr(n,e,t){let r=nl(n),i=Xg(r);return Gg(i,{x:e,y:t})}function Ic(n){let e=nl(n);return{scaleFactor:e.a,translationX:e.e,translationY:e.f}}function lS(n,e){return Xt(n,{focus:e})}function cS(n,e,t){return Xt(n,{viewerWidth:e,viewerHeight:t})}function Qg(n,e,t,r,i){return Xt(n,{SVGMinX:e,SVGMinY:t,SVGWidth:r,SVGHeight:i})}function uS(n,e,t){return Xt(n,{scaleFactorMin:e,scaleFactorMax:t})}function hS(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 Xt(n,Pc({mode:fr},o))}function fS(n){return Xt(n,Pc({mode:fr},jg()))}function e1(n){return Xt(n,{mode:Zg,startX:null,startY:null,endX:null,endY:null})}class t1{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 n1(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 dS(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?n1(Object(t),!0).forEach(function(r){pS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):n1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function pS(n,e,t){return(e=mS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mS(n){var e=gS(n,"string");return typeof e=="symbol"?e:e+""}function gS(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}]=Wg(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 Xt(n,dS({mode:fr},i),rl)}function _S(n,e,t){return Xt(n,{mode:Gr,startX:e,startY:t,endX:e,endY:t},rl)}function vS(n,e,t,r){if(n.mode!==Gr)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 Xt(h,{mode:Gr,endX:e,endY:t},rl)}function r1(n){return Xt(n,{mode:fr,startX:null,startY:null,endX:null,endY:null},rl)}function xS(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 i1(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 s1(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?s1(Object(t),!0).forEach(function(r){yS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):s1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function yS(n,e,t){return(e=SS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function SS(n){var e=ES(n,"string");return typeof e=="symbol"?e:e+""}function ES(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)),Xt(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 Xt(n,Po(Po({mode:fr},i),{},{startX:null,startY:null,endX:null,endY:null}),Rc)}function o1(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)?Xt(n,{mode:fr,startX:null,startY:null,endX:null,endY:null}):Xt(n,Po(Po({mode:fr},$f(n,h)),{},{startX:null,startY:null,endX:null,endY:null}),Rc)}function a1(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 $g: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 $g: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)?Xt(n,{mode:fr,startX:null,startY:null,endX:null,endY:null}):Xt(n,Po(Po({mode:fr},$f(n,v)),{},{startX:null,startY:null,endX:null,endY:null}),Rc)}function bS(n,e){let{viewerWidth:t,viewerHeight:r}=n,i=Rr(n,t/2,r/2);return Io(n,i.x,i.y,e)}function MS(n,e,t){return Xt(n,{mode:Wr,startX:e,startY:t,endX:e,endY:t})}function wS(n,e,t){if(n.mode!==Wr)throw new Error("update selection not allowed in this mode "+n.mode);return Xt(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=i1(a,l);return o1(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 TS(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 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=r;switch(t){case gi:let c=Rr(r,o,a);l=Io(r,c.x,c.y,1/i.scaleFactor);break;case jr:l=MS(r,o,a);break;case Ar:case Cr:l=_S(r,o,a);break;default:return r}return n.preventDefault(),l}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=n.buttons===0,c=r;switch(t){case jr:r.mode===Wr&&(c=l?Yf(r,o,a,i.scaleFactor):wS(r,o,a));break;case Ar:case Cr:r.mode===Gr&&(c=l?r1(r):vS(r,o,a,i.preventPanOutside?20:void 0));break;default:return r}return n.preventDefault(),c}function u1(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 gi:r.mode===Wr&&(l=Yf(r,o,a,1/i.scaleFactor));break;case jr:r.mode===Wr&&(l=Yf(r,o,a,i.scaleFactor));break;case Ar:case Cr:r.mode===Gr&&(l=r1(r));break;default:return r}return n.preventDefault(),l}function AS(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 CS(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=TS(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 h1(n,e,t,r,i){let s=lS(r,n.type==="mouseenter");return n.preventDefault(),s}function RS(n,e,t,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,{x:o,y:a}=s;return!([mi,Ar].indexOf(t)>=0)||!i.detectAutoPan||!r.focus?r:xS(r,o,a)}class PS extends t1{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 f1(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 d1(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?f1(Object(t),!0).forEach(function(r){IS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):f1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function IS(n,e,t){return(e=LS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function LS(n){var e=OS(n,"string");return typeof e=="symbol"?e:e+""}function OS(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 t1{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(d1(d1({},h),{},{identifier:o.identifier}))}return i}}function qS(n,e,t){let r=n.type;switch(r){case"mousemove":case"mouseup":case"mousedown":case"click":case"dblclick":return new PS(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 p1(n){return n.split(/[ ,]/).filter(Boolean).map(Number)}function m1(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 g1(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?m1(Object(t),!0).forEach(function(r){DS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):m1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function DS(n,e,t){return(e=NS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function NS(n){var e=US(n,"string");return typeof e=="symbol"?e:e+""}function US(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 FS(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 zS(n,e,t,r,i){if(v1(n,i))return x1(n,e,t,r);if(n.touches.length!==1){if([Gr,Wr].indexOf(r.mode)>=0)return e1(r);if([fr].indexOf(r.mode)>=0)return r}return Kf(n,e,t,r,i,l1)}function kS(n,e,t,r,i){return v1(n,i)?x1(n,e,t,r):[Gr,Wr].indexOf(r.mode)>=0?Kf(n,e,t,r,i,c1):r}function BS(n,e,t,r,i){if(!([Gr,Wr].indexOf(r.mode)>=0))return r;let s=HS(n,r,i)?Xt(r,{pinchPointDistance:null}):r;return n.touches.length>0?s:Kf(n,e,t,s,i,u1)}function VS(n,e,t,r,i){return n.stopPropagation(),n.preventDefault(),e1(r)}function _1(n){return typeof n.pinchPointDistance=="number"}function HS(n,e,t){return t.detectPinchGesture&&_1(e)&&n.touches.length<2}function v1(n,e){return e.detectPinchGesture&&n.touches.length>1}function Kf(n,e,t,r,i,s){let o=n.touches.length===0?Xt(r,{mode:r.prePinchMode?fr:r.mode,prePinchMode:null}):r,a=n.touches.length>0?n.touches[0]:n.changedTouches[0],l=FS(a,e);switch(t){case gi:case jr:case Ar:case Cr:return n.stopPropagation(),n.preventDefault(),s(n,e,t,o,i,l);default:return o}}function x1(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=_1(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 Xt(r,Xt(g1(g1({mode:Wr},$f(r,x)),{},{startX:null,startY:null,endX:null,endY:null,prePinchMode:r.prePinchMode?r.prePinchMode:r.mode,pinchPointDistance:f})))}function y1(n){return Xt(n,{miniatureOpen:!0})}function S1(n){return Xt(n,{miniatureOpen:!1})}let GS=n=>["zoom-in","zoom-out","grab","grabbing"].indexOf(n)>-1,E1=()=>navigator.userAgent.toLowerCase(),WS=()=>E1().indexOf("firefox")>-1,jS=()=>E1().indexOf("webkit")>-1;function qc(n){if(!GS(n))return n;if(WS())return`-moz-${n}`;if(jS())return`-webkit-${n}`}function XS(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 $S=1;const YS=()=>`uid${$S++}`;function b1(n){class e extends se.Component{constructor(r){super(r),this.state={uid:YS()}}render(){return se.createElement(n,Zf({_uid:this.state.uid},this.props))}}return e.displayName=`RandomUID(${XS(n)})`,e}const M1="react-svg-pan-zoom_border_gradient";function w1(n){let{direction:e,width:t,height:r,_uid:i}=n,s;switch(e){case _i:s=`translate(${t}, 0) rotate(90)`;break;case dr:s=`translate(${t}, ${r}) rotate(180)`;break;case vi:s=`translate(0, ${r}) rotate(270)`;break;case Hn:default:s=" ";break}let o=`${M1}_gradient_${i}`,a=`${M1}_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}))}w1.propTypes={direction:_e.oneOf([_i,dr,vi,Hn]).isRequired,width:_e.number.isRequired,height:_e.number.isRequired};const Dc=b1(w1);function T1(n){let{startX:e,startY:t,endX:r,endY:i}=n;if(!e||!t||!r||!i)return null;let s=i1({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"}})}T1.propTypes={startX:_e.number,startY:_e.number,endX:_e.number,endY:_e.number};function KS(){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 ZS(){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 JS(){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 QS(){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 eE(){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:[_i,vi].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 tE="#1CA6FC";function A1(n){let{tool:e,value:t,onChangeValue:r,onChangeTool:i,activeToolColor:s=tE,position:o=dr,SVGAlignX:a=Co,SVGAlignY:l=Ro}=n,c=(d,m)=>{i(m),d.stopPropagation(),d.preventDefault()},h=d=>{r(a1(t,a,l)),d.stopPropagation(),d.preventDefault()},f=[_i,vi].indexOf(o)>=0,p={position:"absolute",transform:[_i,vi].indexOf(o)>=0?"translate(-50%, 0px)":"none",top:[Hn,dr,_i].indexOf(o)>=0?"5px":"unset",left:[_i,vi].indexOf(o)>=0?"50%":Hn===o?"5px":"unset",right:[dr].indexOf(o)>=0?"5px":"unset",bottom:[vi].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===mi,activeColor:s,name:"unselect-tools",title:"Selection",onClick:d=>c(d,mi)},se.createElement(KS,null)),se.createElement(Oo,{toolbarPosition:o,active:e===Cr,activeColor:s,name:"select-tool-pan",title:"Pan",onClick:d=>c(d,Cr)},se.createElement(ZS,null)),se.createElement(Oo,{toolbarPosition:o,active:e===jr,activeColor:s,name:"select-tool-zoom-in",title:"Zoom in",onClick:d=>c(d,jr)},se.createElement(JS,null)),se.createElement(Oo,{toolbarPosition:o,active:e===gi,activeColor:s,name:"select-tool-zoom-out",title:"Zoom out",onClick:d=>c(d,gi)},se.createElement(QS,null)),se.createElement(Oo,{toolbarPosition:o,active:!1,activeColor:s,name:"fit-to-viewer",title:"Fit to viewer",onClick:d=>h(d)},se.createElement(eE,null)))}A1.propTypes={tool:_e.string.isRequired,onChangeTool:_e.func.isRequired,value:_e.object.isRequired,onChangeValue:_e.func.isRequired,position:_e.oneOf([_i,dr,vi,Hn]),SVGAlignX:_e.oneOf([Ao,Co,Wf]),SVGAlignY:_e.oneOf([Ao,Ro,jf]),activeToolColor:_e.string};function nE(){return"ontouchstart"in window||navigator.maxTouchPoints}function C1(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"})))}C1.propTypes={open:_e.bool.isRequired,position:_e.oneOf([dr,Hn]).isRequired};function R1(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?S1:y1;return se.createElement("button",{type:"button",style:i,onClick:()=>t(s(e))},se.createElement(C1,{open:e.miniatureOpen,position:r}))}R1.propTypes={value:_e.object.isRequired,onChangeValue:_e.func.isRequired,position:_e.oneOf([dr,Hn]).isRequired};const rE="react-svg-pan-zoom_miniature";function P1(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=`${rE}_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}}))}P1.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 iE=b1(P1),sE="#616264";function I1(n){let{value:e,onChangeValue:t,children:r,SVGBackground:i,background:s=sE,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}]=Wg(Xg(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(iE,{SVGWidth:f,SVGHeight:p,SVGMinX:c,SVGMinY:h,x1:_,y1:b,x2:M,y2:E,zoomToFit:v})))),se.createElement(R1,{value:e,onChangeValue:t,position:o}))}I1.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 oE(){console.error(`HEY! With ReactSVGPanZoom >= 3 you MUST specify value and tool props. Please read here ${Jf}`)}function aE(){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 lE(){console.error(`HEY! With ReactSVGPanZoom >= 3 the prop toolbarPosition can be specified as key in the toolbarProps object. Please read here ${Jf}`)}function L1(n){(zs(n.tool)||zs(n.value))&&oE(),(!zs(n.miniaturePosition)||!zs(n.miniatureBackground)||!zs(n.miniatureWidth)||!zs(n.miniatureHeight))&&aE(),zs(n.toolbarPosition)||lE()}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 O1(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 cE(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?O1(Object(t),!0).forEach(function(r){uE(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):O1(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function uE(n,e,t){return(e=hE(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hE(n){var e=fE(n,"string");return typeof e=="symbol"?e:e+""}function fE(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]=p1(l);c=Jg(r,i,h,f,p,d,s,o)}else{const{width:h,height:f}=a.props;c=Jg(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"&&L1(e)}componentDidUpdate(e){const t=this.getValue(),r=this.props;let i=t,s=!1;process.env.NODE_ENV!=="production"&&L1(r);const{viewBox:o}=r.children.props;if(o){const[a,l,c,h]=p1(o);(t.SVGMinX!==a||t.SVGMinY!==l||t.SVGWidth!==c||t.SVGHeight!==h)&&(i=Qg(i,a,l,c,h),s=!0)}else{const{width:a,height:l}=r.children.props;(t.SVGWidth!==a||t.SVGHeight!==l)&&(i=Qg(i,0,0,a,l),s=!0)}(e.width!==r.width||e.height!==r.height)&&(i=cS(i,r.width,r.height),s=!0),(e.scaleFactorMin!==r.scaleFactorMin||e.scaleFactorMax!==r.scaleFactorMax)&&(i=uS(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 aS(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===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=o1(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=a1(this.getValue(),e,t);this.setValue(r)}zoomOnViewerCenter(e){let t=bS(this.getValue(),e);this.setValue(t)}setPointOnViewerCenter(e,t,r){let i=hS(this.getValue(),e,t,r);this.setValue(i)}reset(){let e=fS(this.getValue());this.setValue(e)}openMiniature(){let e=y1(this.getValue());this.setValue(e)}closeMiniature(){let e=S1(this.getValue());this.setValue(e)}handleViewerEvent(e){let{props:t,ViewerDOM:r}=this;if(!([mi,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(qS(e,t.value,r))}autoPanLoop(){let e={x:this.state.pointerX,y:this.state.pointerY},t=RS(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=CS(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=A1,customMiniature:a=I1}=e,l=i===Ar&&s.mode===Gr&&s.startX!==s.endX&&s.startY!==s.endY,c;i===Cr&&(c=qc(s.mode===Gr?"grabbing":"grab")),i===jr&&(c=qc("zoom-in")),i===gi&&(c=qc("zoom-out")),l&&(c=qc("grabbing"));let h=[Cr,jr,gi].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:cE({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=l1(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=c1(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=u1(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=AS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onMouseEnter:d=>{if(nE())return;let m=h1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m)},onMouseLeave:d=>{let m=h1(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m)},onTouchStart:d=>{let m=zS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onTouchMove:d=>{let m=kS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onTouchEnd:d=>{let m=BS(d,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(d)},onTouchCancel:d=>{let m=VS(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:tS(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,Ar].indexOf(i)>=0&&e.detectAutoPan&&s.focus?se.createElement("g",{style:{pointerEvents:"none"}},r<=20?se.createElement(Dc,{direction:_i,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:vi,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!==Wr?null:se.createElement(T1,{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,Gr,Wr]).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,mi,Cr,jr,gi]).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,_i,dr,vi,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 dE=["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 pE(n,e){if(n==null)return{};var t,r,i=mE(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 mE(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 gE 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=pE(e,dE),{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))}}gE.propTypes={width:_e.number.isRequired,height:_e.number.isRequired,defaultValue:_e.object,defaultTool:_e.string};const Ht=G2(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:Ot.newProject(e.planner).updatedState}))},selectTool3DView:()=>{n(e=>{const r=Ot.unselectAll(e.planner).updatedState.set("mode",Oi);return{...e,planner:r}})},selectTool3DFirstPerson:()=>{n(e=>{const r=Ot.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=Ot.undo(e.planner).updatedState;return{...e,planner:t}})},redo:()=>{n(e=>{const t=Ot.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=fn.create(e.planner).updatedState;return{...e,planner:t}})},selectGroup:e=>{n(t=>{const r=fn.select(t.planner,e).updatedState;return{...t,planner:r}})},setGroupProperties:(e,t)=>{n(r=>{const i=fn.setProperties(r.planner,e,t).updatedState;return{...r,planner:i}})},addToGroup:(e,t,r,i)=>{n(s=>{const o=fn.addElement(s.planner,e,t,r,i).updatedState;return{...s,planner:o}})},removeGroup:e=>{n(t=>{const r=fn.remove(t.planner,e).updatedState;return{...t,planner:r}})},setGroupAttributes:(e,t)=>{n(r=>{const i=fn.setAttributes(r.planner,e,t).updatedState;return{...r,planner:i}})},groupTranslate:(e,t,r)=>{n(i=>{const s=fn.translate(i.planner,e,t,r).updatedState;return{...i,planner:s}})},removeFromGroup:(e,t,r,i)=>{n(s=>{const o=fn.removeElement(s.planner,e,t,r,i).updatedState;return{...s,planner:o}})},groupRotate:(e,t)=>{n(r=>{const i=fn.rotate(r.planner,e,t).updatedState;return{...r,planner:i}})},removeGroupAndDeleteElements:e=>{n(t=>{const r=fn.removeAndDeleteElements(t.planner,e).updatedState;return{...t,planner:r}})},addGroupFromSelected:()=>{n(e=>{const t=fn.createFromSelectedElements(e.planner).updatedState;return{...e,planner:t}})},copyProperties:e=>{n(t=>({...t,planner:Ot.copyProperties(t.planner,e).updatedState}))},setProjectProperties:e=>{n(t=>({...t,planner:Ot.setProjectProperties(t.planner,e).updatedState}))},pasteProperties:()=>{n(e=>{const t=e.planner.merge({sceneHistory:an(e.planner.sceneHistory,e.planner.scene)});return{...e,planner:Ot.pasteProperties(t).updatedState}})},setProperties:e=>{n(t=>{const r=t.planner.merge({sceneHistory:an(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Ot.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:Ot.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:Ot.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:Ot.setItemsAttributes(i,r).updatedState}})},selectLine:(e,t)=>{n(r=>{const i=wn.select(r.planner,e,t).updatedState;return{...r,planner:i}})},selectHole:(e,t)=>{n(r=>{const i=hn.select(r.planner,e,t).updatedState;return{...r,planner:i}})},selectItem:(e,t)=>{n(r=>{const i=gn.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=Ot.toggleSnap(t.planner,e).updatedState;return{...t,planner:r}})},openProjectConfigurator:()=>{n(e=>{const t=Ot.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:Ot.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:Ot.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:wn.updateDrawingLine(r.planner,e,t).updatedState}))},updateMouseCoord:e=>{n(t=>({...t,planner:Ot.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:hn.updateDrawingHole(i.planner,e,t,r).updatedState}))},updateDrawingItem:(e,t,r)=>{n(i=>({...i,planner:gn.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:hn.updateDraggingHole(r.planner,e,t).updatedState}))},updateDraggingLine:(e,t)=>{n(r=>({...r,planner:wn.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:gn.updateDraggingItem(r.planner,e,t).updatedState}))},updateRotatingItem:(e,t)=>{n(r=>({...r,planner:gn.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:wn.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:wn.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:gn.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:gn.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:gn.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:gn.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:hn.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:hn.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:wn.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:wn.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:hn.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:gn.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:Ot.initCatalog(t.planner,e).updatedState}))},goBackToCatalogPage:e=>{n(t=>({...t,planner:Ot.goBackToCatalogPage(t.planner,e).updatedState}))},pushLastSelectedCatalogElementToHistory:e=>{n(t=>({...t,planner:Ot.pushLastSelectedCatalogElementToHistory(t.planner,e).updatedState}))},selectToolDrawingLine:e=>{n(t=>({...t,planner:wn.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:gn.selectToolDrawingItem(r,e).updatedState}})},selectToolDrawingHole:e=>{n(t=>{const r=t.planner.merge({sceneHistory:an(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:hn.selectToolDrawingHole(r,e).updatedState}})},changeCatalogPage:(e,t)=>{n(r=>({...r,planner:Ot.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:Ot.remove(t).updatedState}})},rollback:()=>{n(e=>({...e,planner:Ot.rollback(e.planner).updatedState}))},setAlterateState:()=>{n(e=>({...e,planner:Ot.setAlterate(e.planner).updatedState}))},setPlan:e=>{n(t=>({...t,plan:e}))},unselectAll:()=>{n(e=>({...e,planner:Ot.unselectAll(e.planner).updatedState}))}})),il={stroke:"#D32F2F",strokeWidth:"1px"};function _E({snap:n,width:e,height:t}){switch(n.type){case"point":return R.jsxs("g",{transform:`translate(${n.x} ${n.y})`,children:[R.jsx("line",{x1:"0",y1:"-70",x2:"0",y2:"70",style:il}),R.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?R.jsx("line",{x1:s.x,y1:s.y,x2:o.x,y2:o.y,style:il}):c&&h?R.jsx("line",{x1:c.x,y1:c.y,x2:h.x,y2:h.y,style:il}):null;case"line-segment":return R.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"},q1={500:{orange:"#FF9800"}},vE={alt:"#2E2F33",text_main:Fc.white},xE={main:"#1CA6FC"},ed="#99C3FB",Ut={COLORS:Fc,PRIMARY_COLOR:vE,SECONDARY_COLOR:xE,MESH_SELECTED:ed,AREA_MESH_COLOR:{selected:ed,unselected:"#F5F4F4"},LINE_MESH_COLOR:{selected:ed}};function yE({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(R.jsx("line",{x1:"0",y1:a,x2:n,y2:a,strokeWidth:"1",stroke:l},a))}return R.jsx("g",{children:s})}function SE({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(R.jsx("line",{x1:a,y1:"0",x2:a,y2:e,strokeWidth:"1",stroke:l},a))}return R.jsx("g",{children:s})}function EE({scene:n}){let{width:e,height:t,grids:r}=n,i=r.entrySeq().map(([s,o])=>{switch(o.type){case"horizontal-streak":return R.jsx(yE,{width:e,height:t,grid:o},s);case"vertical-streak":return R.jsx(SE,{width:e,height:t,grid:o},s);default:console.warn(`grid ${o.type} not allowed`)}}).toList();return R.jsx("g",{children:i})}class bE{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 ME(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 bE([],(_,b)=>b.max-_.max);let f=TE(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
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=wE(n,e,r),this.max=this.d+this.h*Math.SQRT2}function wE(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,AE(n,e,c,h))}return i===0?0:(r?1:-1)*Math.sqrt(i)}function TE(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 AE(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 D1(n,e){var t=n.length,r=0;n=n.map(CE),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 CE(n){return Array.isArray(n)?{x:n[0],y:n[1]}:n}const RE={textAnchor:"middle",fontSize:"12px",fontFamily:'"Courier New", Courier, monospace',pointerEvents:"none",fontWeight:"bold",WebkitTouchCallout:"none",WebkitUserSelect:"none",MozUserSelect:"none",userSelect:"none"};function PE({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=ME([o],1),l=D1(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-=D1(f)}),i=R.jsxs("text",{x:"0",y:"0",transform:`translate(${a[0]} ${a[1]}) scale(1, -1)`,style:RE,children:[(l/1e4).toFixed(2)," m","²"]})}return R.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 IE=0,LE=0,OE=5,qE={fill:q1[500].orange,stroke:q1[500].orange,cursor:"default"};function DE({layer:n,group:e}){return R.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&&R.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:R.jsx("circle",{cx:IE,cy:LE,r:OE,style:qE,children:R.jsx("title",{children:"Group's Barycenter"})})})})}const NE={fill:"#0096fd",stroke:"#0096fd",cursor:"ew-resize"},UE={fill:"none",stroke:"#0096fd",cursor:"ew-resize"};function FE({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 R.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&&R.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:[R.jsx("circle",{cx:"0",cy:"150",r:"10",style:NE}),R.jsx("circle",{cx:"0",cy:"0",r:"150",style:UE})]})]})}const td={stroke:"#0096fd",strokeWidth:"1px"},zE={textAnchor:"middle",fontSize:"12px",fontFamily:"'Courier New', Courier, monospace",pointerEvents:"none",fontWeight:"bold",WebkitTouchCallout:"none",WebkitUserSelect:"none",MozUserSelect:"none",userSelect:"none"};function kE({length:n,unit:e,transform:t}){let r=`${n.toFixed(2)} ${e}`;return R.jsxs("g",{transform:t,children:[R.jsx("text",{x:n/2,y:"-3",transform:"scale(1, -1)",style:zE,children:r}),R.jsx("line",{x1:"0",y1:"-5",x2:"0",y2:"5",style:td}),R.jsx("line",{x1:n,y1:"-5",x2:n,y2:"5",style:td}),R.jsx("line",{x1:"0",y1:"0",x2:n,y2:"0",style:td})]})}const BE=({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||Hr(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=Yy(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 R.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?R.jsx(kE,{unit:t.unit,length:h,transform:`translate(0, ${m+10} )`}):null;return R.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]})},VE={fill:"#0096fd",stroke:Ut.COLORS.white,cursor:"move"},HE=({vertex:n,layer:e})=>R.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:R.jsx("circle",{cx:"0",cy:"0",r:"7",style:VE})});function N1({layer:n,scene:e,catalog:t}){const{groups:r}=e,{lines:i,areas:s,vertices:o,id:a,items:l,opacity:c}=n;return R.jsxs("g",{opacity:c,children:[s.valueSeq().map(h=>R.jsx(PE,{layer:n,area:h,catalog:t},h.id)),i.valueSeq().map(h=>R.jsx(BE,{layer:n,line:h,scene:e,catalog:t},h.id)),l.valueSeq().map(h=>R.jsx(FE,{layer:n,item:h,scene:e,catalog:t},h.id)),o.valueSeq().filter(h=>h.selected).map(h=>R.jsx(HE,{layer:n,vertex:h},h.id)),r.valueSeq().filter(h=>h.hasIn(["elements",a])&&h.get("selected")).map(h=>R.jsx(DE,{layer:n,group:h,scene:e,catalog:t},h.get("id")))]})}const GE=({scene:n,catalog:e})=>{const{layers:t}=n,r=t.get(n.selectedLayer);return R.jsxs("g",{children:[R.jsx(EE,{scene:n}),R.jsx("g",{style:{pointerEvents:"none"},children:t.entrySeq().filter(([i,s])=>i!==n.selectedLayer&&s.visible).map(([i,s])=>R.jsx(N1,{layer:s,scene:n,catalog:e},i))}),R.jsx(N1,{layer:r,scene:n,catalog:e},r.id)]})},WE=se.memo(GE,(n,e)=>n.scene.hashCode()===e.scene.hashCode()),U1={stroke:Ut.SECONDARY_COLOR.main,strokeWidth:"2.5px"},jE=({catalog:n})=>{const{planner:e}=Ht(),{activeSnapElement:t,snapElements:r,scene:i}=e,{width:s,height:o}=i;return R.jsxs("g",{children:[R.jsx("rect",{x:"0",y:"0",width:s,height:o,fill:Ut.COLORS.white}),R.jsxs("g",{transform:`translate(0, ${i.height}) scale(1, -1)`,id:"svg-drawing-paper",children:[R.jsx(WE,{scene:i,catalog:n}),i.getIn(["guides","horizontal"]).entrySeq().map(([a,l])=>R.jsx("line",{id:"hGuide"+a,x1:0,y1:l,x2:s,y2:l,style:U1},a)),i.getIn(["guides","vertical"]).entrySeq().map(([a,l])=>R.jsx("line",{x1:l,y1:0,x2:l,y2:o,style:U1},a)),t?R.jsx(_E,{snap:t,width:i.width,height:i.height}):null,r?null:R.jsx(R.Fragment,{})]})]})},nd=.25,F1=5,XE=.1,$E=5.5;function z1(n){return(Math.min(Math.max(n,nd),F1)-nd)/(F1-nd)*100}function YE(n){switch(n){case Ns:return Cr;case qs:return jr;case Ds:return gi;case rn:return Ar;default:return mi}}function KE(n){switch(n){case cr:case ur:case wr:case Vr:case Br:case zr:case kr:return{pointerEvents:"none"};default:return{}}}function ZE(n){switch(n){case Vr:case zr:case kr:case Br:return{cursor:"move"};case qi:return{cursor:"ew-resize"};case Fr:case cr:return{cursor:"crosshair"};default:return{cursor:"default"}}}function JE(n){switch(n){case cr:case zr:case kr:case Vr:case Br:case ur:case wr:return!0;default:return!1}}function k1(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 QE=({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}=Ht(),{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 Vr:x(De,ve);break;case zr:v(De,ve,i.snapMask);break;case kr:_(De,ve,i.snapMask);break;case Br: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=k1(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=k1(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 Fr: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 zr:ce(ve,Ge,i.snapMask);break;case kr:J(ve,Ge,i.snapMask);break;case Br:oe(ve,Ge);break;case Vr:B(ve,Ge);break;case qi:xe(ve,Ge);break}qe.stopPropagation()},z=()=>{[Fr,cr,ur,wr].includes(W)&&Se()},it=$e=>{h($e.a),c($e)},Ie=$e=>{switch($e){case mi:l();break;case Cr:a();break;case jr:o();break;case gi:s();break}};return R.jsx("div",{className:"m-0 p-0 relative",children:R.jsx(Uc,{className:"floor_planner-svgPanZoom",ref:r,style:{gridColumn:2,gridRow:2},width:n,height:e,scaleFactorMin:XE,scaleFactorMax:$E,value:V.isEmpty()?{}:V.toJS(),onChangeValue:it,tool:YE(W),onChangeTool:Ie,detectAutoPan:JE(W),onMouseDown:Le,onMouseMove:Q,onMouseUp:le,onDoubleClick:z,miniatureProps:{position:"none",width:0,height:0,background:""},toolbarProps:{position:"none"},children:R.jsxs("svg",{width:te.width,height:te.height,children:[R.jsx("defs",{children:R.jsxs("pattern",{id:"diagonalFill",patternUnits:"userSpaceOnUse",width:"4",height:"4",fill:"#FFF",children:[R.jsx("rect",{x:"0",y:"0",width:"4",height:"4",fill:"#FFF"}),R.jsx("path",{d:"M-1,1 l2,-2 M0,4 l4,-4 M3,5 l2,-2",style:{stroke:"#8E9BA2",strokeWidth:1}})]})}),R.jsx("g",{style:Object.assign(ZE(W),KE(W)),children:R.jsx(jE,{catalog:t})})]})})})};/**
|
|
71
71
|
* @license
|
|
72
72
|
* Copyright 2010-2025 Three.js Authors
|
|
73
73
|
* SPDX-License-Identifier: MIT
|
|
74
|
-
*/const rd="179",qo={ROTATE:0,DOLLY:1,PAN:2},Do={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},eb=0,B1=1,tb=2,V1=1,nb=2,Ui=3,ls=0,Qn=1,xi=2,cs=0,No=1,H1=2,G1=3,W1=4,rb=5,ks=100,ib=101,sb=102,ob=103,ab=104,lb=200,cb=201,ub=202,hb=203,id=204,sd=205,fb=206,db=207,pb=208,mb=209,gb=210,_b=211,vb=212,xb=213,yb=214,od=0,ad=1,ld=2,Uo=3,cd=4,ud=5,hd=6,fd=7,dd=0,Sb=1,Eb=2,us=0,bb=1,Mb=2,wb=3,Tb=4,Ab=5,Cb=6,Rb=7,j1=300,Fo=301,zo=302,pd=303,md=304,kc=306,Xr=1e3,Bs=1001,gd=1002,$r=1003,Pb=1004,Bc=1005,yi=1006,_d=1007,Vs=1008,Si=1009,X1=1010,$1=1011,sl=1012,vd=1013,Hs=1014,Fi=1015,ol=1016,xd=1017,yd=1018,al=1020,Y1=35902,K1=1021,Z1=1022,Yr=1023,ll=1026,cl=1027,J1=1028,Sd=1029,Q1=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,e_=36283,Xd=36284,$d=36285,Yd=36286,Ib=3200,Lb=3201,Kd=0,Ob=1,hs="",pr="srgb",ko="srgb-linear",Xc="linear",Ft="srgb",Bo=7680,t_=519,qb=512,Db=513,Nb=514,n_=515,Ub=516,Fb=517,zb=518,kb=519,r_=35044,i_="300 es",Ei=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 Bb(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 Vb={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(s_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s_.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,s_=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 o_(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 Hb(){const n=hl("canvas");return n.style.display="block",n}const a_={};function Ho(n){n in a_||(a_[n]=!0,console.warn(n))}function Gb(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 l_=new pt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),c_=new pt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Wb(){const n={enabled:!0,workingColorSpace:ko,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Ft&&(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===Ft&&(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:l_,fromXYZ:c_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:pr},outputColorSpaceConfig:{drawingBufferColorSpace:pr}},[pr]:{primaries:e,whitePoint:r,transfer:Ft,toXYZ:l_,fromXYZ:c_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:pr}}}),n}const Ct=Wb();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 jb{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 Xb=0;class ep{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Xb++}),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?jb.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 $b=0;const np=new G;class Dn extends Gs{constructor(e=Dn.DEFAULT_IMAGE,t=Dn.DEFAULT_MAPPING,r=Bs,i=Bs,s=yi,o=Vs,a=Yr,l=Si,c=Dn.DEFAULT_ANISOTROPY,h=hs){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:$b++}),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!==j1)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Xr: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 Xr: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=j1,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 Yb extends Gs{constructor(e=1,t=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:yi,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:yi,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 Yb{constructor(e=1,t=1,r={}){super(e,t,r),this.isWebGLRenderTarget=!0}}class u_ 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=$r,this.minFilter=$r,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 Kb 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=$r,this.minFilter=$r,this.wrapR=Bs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class bi{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(Kr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,r=e.count;t<r;t++)this.expandByPoint(Kr.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=Kr.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,Kr):Kr.fromBufferAttribute(s,o),Kr.applyMatrix4(e.matrixWorld),this.expandByPoint(Kr);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,Kr),Kr.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,Kr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Kr).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],Kr=new G,Zc=new bi,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 Zb=new bi,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):Zb.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 Gt{constructor(e,t,r,i,s,o,a,l,c,h,f,p,d,m,x,v){Gt.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 Gt().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(Jb,e,Qb)}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],Zr.copy(this);const c=1/s,h=1/o,f=1/a;return Zr.elements[0]*=c,Zr.elements[1]*=c,Zr.elements[2]*=c,Zr.elements[4]*=h,Zr.elements[5]*=h,Zr.elements[6]*=h,Zr.elements[8]*=f,Zr.elements[9]*=f,Zr.elements[10]*=f,t.setFromRotationMatrix(Zr),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o,a=Ei,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===Ei)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=Ei,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===Ei)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,Zr=new Gt,Jb=new G(0,0,0),Qb=new G(1,1,1),gs=new G,iu=new G,mr=new G,h_=new Gt,f_=new fs;class Jr{constructor(e=0,t=0,r=0,i=Jr.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 h_.makeRotationFromQuaternion(e),this.setFromRotationMatrix(h_,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return f_.setFromEuler(this),this.setFromQuaternion(f_,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}}Jr.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 eM=0;const d_=new G,Ko=new fs,Vi=new Gt,su=new G,pl=new G,tM=new G,nM=new fs,p_=new G(1,0,0),m_=new G(0,1,0),g_=new G(0,0,1),__={type:"added"},rM={type:"removed"},Zo={type:"childadded",child:null},cp={type:"childremoved",child:null};class qt extends Gs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:eM++}),this.uuid=Vo(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=qt.DEFAULT_UP.clone();const e=new G,t=new Jr,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 Gt},normalMatrix:{value:new pt}}),this.matrix=new Gt,this.matrixWorld=new Gt,this.matrixAutoUpdate=qt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=qt.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(p_,e)}rotateY(e){return this.rotateOnAxis(m_,e)}rotateZ(e){return this.rotateOnAxis(g_,e)}translateOnAxis(e,t){return d_.copy(e).applyQuaternion(this.quaternion),this.position.add(d_.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(p_,e)}translateY(e){return this.translateOnAxis(m_,e)}translateZ(e){return this.translateOnAxis(g_,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(__),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(rM),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(__),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,tM),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(pl,nM,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}}qt.DEFAULT_UP=new G(0,1,0),qt.DEFAULT_MATRIX_AUTO_UPDATE=!0,qt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Qr=new G,Hi=new G,up=new G,Gi=new G,Jo=new G,Qo=new G,v_=new G,hp=new G,fp=new G,dp=new G,pp=new on,mp=new on,gp=new on;class ei{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),Qr.subVectors(e,t),i.cross(Qr);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){Qr.subVectors(i,t),Hi.subVectors(r,t),up.subVectors(e,t);const o=Qr.dot(Qr),a=Qr.dot(Hi),l=Qr.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 Qr.subVectors(r,t),Hi.subVectors(e,t),Qr.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 Qr.subVectors(this.c,this.b),Hi.subVectors(this.a,this.b),Qr.cross(Hi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ei.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ei.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,r,i,s){return ei.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return ei.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ei.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 v_.subVectors(s,i),a=(f-h)/(f-h+(d-m)),t.copy(i).addScaledVector(v_,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 x_={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=Bb(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=x_[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=x_;let iM=0;class $s extends Gs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:iM++}),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=t_,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!==t_&&(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 Jr,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 dn=new G,au=new Fe;let sM=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:sM++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=r_,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++)dn.fromBufferAttribute(this,t),dn.applyMatrix3(e),this.setXYZ(t,dn.x,dn.y,dn.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)dn.fromBufferAttribute(this,t),dn.applyMatrix4(e),this.setXYZ(t,dn.x,dn.y,dn.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)dn.fromBufferAttribute(this,t),dn.applyNormalMatrix(e),this.setXYZ(t,dn.x,dn.y,dn.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)dn.fromBufferAttribute(this,t),dn.transformDirection(e),this.setXYZ(t,dn.x,dn.y,dn.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!==r_&&(e.usage=this.usage),e}}class y_ extends Pr{constructor(e,t,r){super(new Uint16Array(e),t,r)}}class S_ 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 oM=0;const Ir=new Gt,vp=new qt,ea=new G,gr=new bi,ml=new bi,wn=new G;class tr extends Gs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:oM++}),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(o_(e)?S_:y_)(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 bi);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 E_=new Gt,Ks=new ru,lu=new eu,b_=new G,cu=new G,uu=new G,hu=new G,xp=new G,fu=new G,M_=new G,du=new G;class Tn extends qt{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,b_)===null||Ks.origin.distanceToSquared(b_)>(e.far-e.near)**2))&&(E_.copy(s).invert(),Ks.copy(e.ray).applyMatrix4(E_),!(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 aM(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=aM(n,e,t,r,cu,uu,hu,M_);if(h){const f=new G;ei.getBarycoord(M_,cu,uu,hu,f),i&&(h.uv=ei.getInterpolatedAttribute(i,a,l,c,f,new Fe)),s&&(h.uv1=ei.getInterpolatedAttribute(s,a,l,c,f,new Fe)),o&&(h.normal=ei.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};ei.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 lM(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function w_(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ct.workingColorSpace}const cM={clone:ta,merge:Wn};var uM=`void main() {
|
|
74
|
+
*/const rd="179",qo={ROTATE:0,DOLLY:1,PAN:2},Do={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},eb=0,B1=1,tb=2,V1=1,nb=2,Ui=3,ls=0,Qn=1,xi=2,cs=0,No=1,H1=2,G1=3,W1=4,rb=5,ks=100,ib=101,sb=102,ob=103,ab=104,lb=200,cb=201,ub=202,hb=203,id=204,sd=205,fb=206,db=207,pb=208,mb=209,gb=210,_b=211,vb=212,xb=213,yb=214,od=0,ad=1,ld=2,Uo=3,cd=4,ud=5,hd=6,fd=7,dd=0,Sb=1,Eb=2,us=0,bb=1,Mb=2,wb=3,Tb=4,Ab=5,Cb=6,Rb=7,j1=300,Fo=301,zo=302,pd=303,md=304,kc=306,Xr=1e3,Bs=1001,gd=1002,$r=1003,Pb=1004,Bc=1005,yi=1006,_d=1007,Vs=1008,Si=1009,X1=1010,$1=1011,sl=1012,vd=1013,Hs=1014,Fi=1015,ol=1016,xd=1017,yd=1018,al=1020,Y1=35902,K1=1021,Z1=1022,Yr=1023,ll=1026,cl=1027,J1=1028,Sd=1029,Q1=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,e_=36283,Xd=36284,$d=36285,Yd=36286,Ib=3200,Lb=3201,Kd=0,Ob=1,hs="",pr="srgb",ko="srgb-linear",Xc="linear",Ft="srgb",Bo=7680,t_=519,qb=512,Db=513,Nb=514,n_=515,Ub=516,Fb=517,zb=518,kb=519,r_=35044,i_="300 es",Ei=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 Bb(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 Vb={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(s_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s_.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,s_=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 o_(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 Hb(){const n=hl("canvas");return n.style.display="block",n}const a_={};function Ho(n){n in a_||(a_[n]=!0,console.warn(n))}function Gb(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 l_=new pt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),c_=new pt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Wb(){const n={enabled:!0,workingColorSpace:ko,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Ft&&(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===Ft&&(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:l_,fromXYZ:c_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:pr},outputColorSpaceConfig:{drawingBufferColorSpace:pr}},[pr]:{primaries:e,whitePoint:r,transfer:Ft,toXYZ:l_,fromXYZ:c_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:pr}}}),n}const Ct=Wb();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 jb{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 Xb=0;class ep{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Xb++}),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?jb.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 $b=0;const np=new G;class Dn extends Gs{constructor(e=Dn.DEFAULT_IMAGE,t=Dn.DEFAULT_MAPPING,r=Bs,i=Bs,s=yi,o=Vs,a=Yr,l=Si,c=Dn.DEFAULT_ANISOTROPY,h=hs){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:$b++}),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!==j1)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Xr: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 Xr: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=j1,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 Yb extends Gs{constructor(e=1,t=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:yi,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:yi,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 Yb{constructor(e=1,t=1,r={}){super(e,t,r),this.isWebGLRenderTarget=!0}}class u_ 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=$r,this.minFilter=$r,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 Kb 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=$r,this.minFilter=$r,this.wrapR=Bs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class bi{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(Kr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,r=e.count;t<r;t++)this.expandByPoint(Kr.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=Kr.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,Kr):Kr.fromBufferAttribute(s,o),Kr.applyMatrix4(e.matrixWorld),this.expandByPoint(Kr);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,Kr),Kr.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,Kr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Kr).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],Kr=new G,Zc=new bi,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 Zb=new bi,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):Zb.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 Gt{constructor(e,t,r,i,s,o,a,l,c,h,f,p,d,m,x,v){Gt.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 Gt().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(Jb,e,Qb)}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],Zr.copy(this);const c=1/s,h=1/o,f=1/a;return Zr.elements[0]*=c,Zr.elements[1]*=c,Zr.elements[2]*=c,Zr.elements[4]*=h,Zr.elements[5]*=h,Zr.elements[6]*=h,Zr.elements[8]*=f,Zr.elements[9]*=f,Zr.elements[10]*=f,t.setFromRotationMatrix(Zr),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o,a=Ei,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===Ei)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=Ei,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===Ei)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,Zr=new Gt,Jb=new G(0,0,0),Qb=new G(1,1,1),gs=new G,iu=new G,mr=new G,h_=new Gt,f_=new fs;class Jr{constructor(e=0,t=0,r=0,i=Jr.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 h_.makeRotationFromQuaternion(e),this.setFromRotationMatrix(h_,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return f_.setFromEuler(this),this.setFromQuaternion(f_,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}}Jr.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 eM=0;const d_=new G,Ko=new fs,Vi=new Gt,su=new G,pl=new G,tM=new G,nM=new fs,p_=new G(1,0,0),m_=new G(0,1,0),g_=new G(0,0,1),__={type:"added"},rM={type:"removed"},Zo={type:"childadded",child:null},cp={type:"childremoved",child:null};class qt extends Gs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:eM++}),this.uuid=Vo(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=qt.DEFAULT_UP.clone();const e=new G,t=new Jr,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 Gt},normalMatrix:{value:new pt}}),this.matrix=new Gt,this.matrixWorld=new Gt,this.matrixAutoUpdate=qt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=qt.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(p_,e)}rotateY(e){return this.rotateOnAxis(m_,e)}rotateZ(e){return this.rotateOnAxis(g_,e)}translateOnAxis(e,t){return d_.copy(e).applyQuaternion(this.quaternion),this.position.add(d_.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(p_,e)}translateY(e){return this.translateOnAxis(m_,e)}translateZ(e){return this.translateOnAxis(g_,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(__),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(rM),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(__),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,tM),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(pl,nM,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}}qt.DEFAULT_UP=new G(0,1,0),qt.DEFAULT_MATRIX_AUTO_UPDATE=!0,qt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Qr=new G,Hi=new G,up=new G,Gi=new G,Jo=new G,Qo=new G,v_=new G,hp=new G,fp=new G,dp=new G,pp=new on,mp=new on,gp=new on;class ei{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),Qr.subVectors(e,t),i.cross(Qr);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){Qr.subVectors(i,t),Hi.subVectors(r,t),up.subVectors(e,t);const o=Qr.dot(Qr),a=Qr.dot(Hi),l=Qr.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 Qr.subVectors(r,t),Hi.subVectors(e,t),Qr.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 Qr.subVectors(this.c,this.b),Hi.subVectors(this.a,this.b),Qr.cross(Hi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ei.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ei.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,r,i,s){return ei.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return ei.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ei.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 v_.subVectors(s,i),a=(f-h)/(f-h+(d-m)),t.copy(i).addScaledVector(v_,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 x_={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=Bb(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=x_[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=x_;let iM=0;class $s extends Gs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:iM++}),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=t_,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!==t_&&(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 Jr,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 dn=new G,au=new Fe;let sM=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:sM++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=r_,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++)dn.fromBufferAttribute(this,t),dn.applyMatrix3(e),this.setXYZ(t,dn.x,dn.y,dn.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)dn.fromBufferAttribute(this,t),dn.applyMatrix4(e),this.setXYZ(t,dn.x,dn.y,dn.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)dn.fromBufferAttribute(this,t),dn.applyNormalMatrix(e),this.setXYZ(t,dn.x,dn.y,dn.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)dn.fromBufferAttribute(this,t),dn.transformDirection(e),this.setXYZ(t,dn.x,dn.y,dn.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!==r_&&(e.usage=this.usage),e}}class y_ extends Pr{constructor(e,t,r){super(new Uint16Array(e),t,r)}}class S_ 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 oM=0;const Ir=new Gt,vp=new qt,ea=new G,gr=new bi,ml=new bi,Tn=new G;class tr extends Gs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:oM++}),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(o_(e)?S_:y_)(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 bi);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?(Tn.addVectors(this.boundingBox.min,gr.min),this.boundingBox.expandByPoint(Tn),Tn.addVectors(this.boundingBox.max,gr.max),this.boundingBox.expandByPoint(Tn)):(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?(Tn.addVectors(gr.min,ml.min),gr.expandByPoint(Tn),Tn.addVectors(gr.max,ml.max),gr.expandByPoint(Tn)):(gr.expandByPoint(ml.min),gr.expandByPoint(ml.max))}gr.getCenter(r);let i=0;for(let s=0,o=e.count;s<o;s++)Tn.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(Tn));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++)Tn.fromBufferAttribute(a,c),l&&(ea.fromBufferAttribute(e,c),Tn.add(ea)),i=Math.max(i,r.distanceToSquared(Tn))}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++)Tn.fromBufferAttribute(e,t),Tn.normalize(),e.setXYZ(t,Tn.x,Tn.y,Tn.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 E_=new Gt,Ks=new ru,lu=new eu,b_=new G,cu=new G,uu=new G,hu=new G,xp=new G,fu=new G,M_=new G,du=new G;class _n extends qt{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,b_)===null||Ks.origin.distanceToSquared(b_)>(e.far-e.near)**2))&&(E_.copy(s).invert(),Ks.copy(e.ray).applyMatrix4(E_),!(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 aM(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=aM(n,e,t,r,cu,uu,hu,M_);if(h){const f=new G;ei.getBarycoord(M_,cu,uu,hu,f),i&&(h.uv=ei.getInterpolatedAttribute(i,a,l,c,f,new Fe)),s&&(h.uv1=ei.getInterpolatedAttribute(s,a,l,c,f,new Fe)),o&&(h.normal=ei.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};ei.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 lM(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function w_(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ct.workingColorSpace}const cM={clone:ta,merge:Wn};var uM=`void main() {
|
|
75
75
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
76
76
|
}`,hM=`void main() {
|
|
77
77
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
@@ -110,7 +110,7 @@ best distance: ${f.d}`);const v=[f.x,f.y];return v.distance=f.d,v}function zc(n,
|
|
|
110
110
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
111
111
|
|
|
112
112
|
}
|
|
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=yi),new fM(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 qt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const pM={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(pM)))}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 mM extends qt{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 Jr,this.environmentIntensity=1,this.environmentRotation=new Jr,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,P_=new G;class gu extends qt{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),P_.setFromMatrixPosition(this.matrixWorld);const r=mu.distanceTo(P_)/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,gM=new G,_M=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(gM.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||_M.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,vM=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=Ei,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===Ei)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=vM.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,I_=new Gt,_l=new ru,Su=new eu,bp=new G,L_=new G;class xM extends qt{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;I_.copy(i).invert(),_l.copy(e.ray).applyMatrix4(I_);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,L_)>r)return;bp.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(bp);if(!(c<e.near||c>e.far))return{distance:c,point:L_.clone().applyMatrix4(n.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:n}}const O_=new G,q_=new G;class vl extends xM{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)O_.fromBufferAttribute(t,i),q_.fromBufferAttribute(t,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+O_.distanceTo(q_);e.setAttribute("lineDistance",new Gn(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class D_ extends Dn{constructor(e,t,r=Hs,i,s,o,a=$r,l=$r,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 Mi{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 Gt;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 Mi{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 yM 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 SM extends Mi{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 N_(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 EM(n,e){const t=1-n;return t*t*e}function bM(n,e){return 2*(1-n)*n*e}function MM(n,e){return n*n*e}function xl(n,e,t,r){return EM(n,e)+bM(n,t)+MM(n,r)}function wM(n,e){const t=1-n;return t*t*t*e}function TM(n,e){const t=1-n;return 3*t*t*n*e}function AM(n,e){return 3*(1-n)*n*n*e}function CM(n,e){return n*n*n*e}function yl(n,e,t,r,i){return wM(n,e)+TM(n,t)+AM(n,r)+CM(n,i)}class U_ extends Mi{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 RM extends Mi{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 F_ extends Mi{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 PM extends Mi{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 z_ extends Mi{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 IM extends Mi{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 k_ extends Mi{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(N_(a,l.x,c.x,h.x,f.x),N_(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 B_=Object.freeze({__proto__:null,ArcCurve:yM,CatmullRomCurve3:SM,CubicBezierCurve:U_,CubicBezierCurve3:RM,EllipseCurve:Mp,LineCurve:F_,LineCurve3:PM,QuadraticBezierCurve:z_,QuadraticBezierCurve3:IM,SplineCurve:k_});class LM extends Mi{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 B_[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 B_[i.type]().fromJSON(i))}return this}}class Rp extends LM{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 F_(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 z_(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 U_(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 k_(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 OM(n,e,t=2){const r=e&&e.length,i=r?e[0]*t:n.length;let s=V_(n,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(r&&(s=FM(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 V_(n,e,t,r,i){let s;if(i===YM(n,e,t,r)>0)for(let o=e;o<t;o+=r)s=j_(o/r|0,n[o],n[o+1],s);else for(let o=t-r;o>=e;o-=r)s=j_(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&&HM(n,r,i,s);let a=n;for(;n.prev!==n.next;){const l=n.prev,c=n.next;if(s?DM(n,r,i,s):qM(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=NM(Qs(n),e),Sl(n,e,t,r,i,s,2)):o===2&&UM(n,e,t,r,i,s):Sl(Qs(n),e,t,r,i,s,1);break}}}function qM(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 DM(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 NM(n,e){let t=n;do{const r=t.prev,i=t.next.next;!sa(r,i)&&G_(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 UM(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&jM(o,a)){let l=W_(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 FM(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=V_(n,a,l,r,!1);c===c.next&&(c.steiner=!0),i.push(WM(c))}i.sort(zM);for(let s=0;s<i.length;s++)t=kM(i[s],t);return t}function zM(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 kM(n,e){const t=BM(n,e);if(!t)return e;const r=W_(t,n);return Qs(r,r.next),Qs(t,t.next)}function BM(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&&H_(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&&VM(o,t)))&&(o=t,h=f)}t=t.next}while(t!==a);return o}function VM(n,e){return sn(n.prev,n,e.prev)<0&&sn(e.next,n,n.next)<0}function HM(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,GM(i)}function GM(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 WM(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 H_(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)&&H_(n,e,t,r,i,s,o,a)}function jM(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!XM(n,e)&&(bl(n,e)&&bl(e,n)&&$M(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 G_(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 XM(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&&G_(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 $M(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 W_(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 j_(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 YM(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 KM{static triangulate(e,t,r=2){return OM(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=[];X_(e),$_(r,e);let o=e.length;t.forEach(X_);for(let l=0;l<t.length;l++)i.push(o),o+=t[l].length,$_(r,t[l]);const a=KM.triangulate(r,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function X_(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function $_(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 ZM(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 ZM(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 JM 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 Jr,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 QM 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 Jr,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 e4 extends $s{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ib,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 t4 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 n4{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 r4=new n4;class Tl{constructor(e){this.manager=e!==void 0?e:r4,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 i4 extends Error{constructor(e,t){super(e),this.response=t}}class s4 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 i4(`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 o4 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 Y_ extends Tl{constructor(e){super(e)}load(e,t,r,i){const s=new Dn,o=new o4(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 qt{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 Gt,K_=new G,Z_=new G;class J_{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=Si,this.map=null,this.mapPass=null,this.matrix=new Gt,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;K_.setFromMatrixPosition(e.matrixWorld),t.position.copy(K_),Z_.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Z_),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 a4 extends J_{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 l4 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(qt.DEFAULT_UP),this.updateMatrix(),this.target=new qt,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new a4}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 Q_ extends T_{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 c4 extends J_{constructor(){super(new Q_(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class u4 extends Op{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(qt.DEFAULT_UP),this.updateMatrix(),this.target=new qt,this.shadow=new c4}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class ev extends Op{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class h4 extends _r{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const tv=new Gt;class f4{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 tv.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(tv),this}intersectObject(e,t=!0,r=[]){return Dp(e,this,r,t),r.sort(nv),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(nv),r}}function nv(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 rv{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 bi;class d4 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 p4{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 m4 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 iv(n,e,t,r){const i=g4(r);switch(t){case K1:return n*e;case J1:return n*e/i.components*i.byteLength;case Sd:return n*e/i.components*i.byteLength;case Q1:return n*e*2/i.components*i.byteLength;case Ed:return n*e*2/i.components*i.byteLength;case Z1:return n*e*3/i.components*i.byteLength;case Yr: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 e_: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 g4(n){switch(n){case Si:case X1:return{byteLength:1,components:1};case sl:case $1: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 Y1: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 _n(i,s),a=t.minFilter;return t.minFilter===Vs&&(t.minFilter=yi),new fM(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 qt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const pM={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(pM)))}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 mM extends qt{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 Jr,this.environmentIntensity=1,this.environmentRotation=new Jr,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,P_=new G;class gu extends qt{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),P_.setFromMatrixPosition(this.matrixWorld);const r=mu.distanceTo(P_)/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,gM=new G,_M=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(gM.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||_M.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,vM=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=Ei,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===Ei)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=vM.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,I_=new Gt,_l=new ru,Su=new eu,bp=new G,L_=new G;class xM extends qt{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;I_.copy(i).invert(),_l.copy(e.ray).applyMatrix4(I_);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,L_)>r)return;bp.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(bp);if(!(c<e.near||c>e.far))return{distance:c,point:L_.clone().applyMatrix4(n.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:n}}const O_=new G,q_=new G;class vl extends xM{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)O_.fromBufferAttribute(t,i),q_.fromBufferAttribute(t,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+O_.distanceTo(q_);e.setAttribute("lineDistance",new Gn(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class D_ extends Dn{constructor(e,t,r=Hs,i,s,o,a=$r,l=$r,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 Mi{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 Gt;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 Mi{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 yM 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 SM extends Mi{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 N_(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 EM(n,e){const t=1-n;return t*t*e}function bM(n,e){return 2*(1-n)*n*e}function MM(n,e){return n*n*e}function xl(n,e,t,r){return EM(n,e)+bM(n,t)+MM(n,r)}function wM(n,e){const t=1-n;return t*t*t*e}function TM(n,e){const t=1-n;return 3*t*t*n*e}function AM(n,e){return 3*(1-n)*n*n*e}function CM(n,e){return n*n*n*e}function yl(n,e,t,r,i){return wM(n,e)+TM(n,t)+AM(n,r)+CM(n,i)}class U_ extends Mi{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 RM extends Mi{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 F_ extends Mi{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 PM extends Mi{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 z_ extends Mi{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 IM extends Mi{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 k_ extends Mi{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(N_(a,l.x,c.x,h.x,f.x),N_(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 B_=Object.freeze({__proto__:null,ArcCurve:yM,CatmullRomCurve3:SM,CubicBezierCurve:U_,CubicBezierCurve3:RM,EllipseCurve:Mp,LineCurve:F_,LineCurve3:PM,QuadraticBezierCurve:z_,QuadraticBezierCurve3:IM,SplineCurve:k_});class LM extends Mi{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 B_[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 B_[i.type]().fromJSON(i))}return this}}class Rp extends LM{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 F_(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 z_(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 U_(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 k_(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 OM(n,e,t=2){const r=e&&e.length,i=r?e[0]*t:n.length;let s=V_(n,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(r&&(s=FM(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 V_(n,e,t,r,i){let s;if(i===YM(n,e,t,r)>0)for(let o=e;o<t;o+=r)s=j_(o/r|0,n[o],n[o+1],s);else for(let o=t-r;o>=e;o-=r)s=j_(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&&HM(n,r,i,s);let a=n;for(;n.prev!==n.next;){const l=n.prev,c=n.next;if(s?DM(n,r,i,s):qM(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=NM(Qs(n),e),Sl(n,e,t,r,i,s,2)):o===2&&UM(n,e,t,r,i,s):Sl(Qs(n),e,t,r,i,s,1);break}}}function qM(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 DM(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 NM(n,e){let t=n;do{const r=t.prev,i=t.next.next;!sa(r,i)&&G_(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 UM(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&jM(o,a)){let l=W_(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 FM(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=V_(n,a,l,r,!1);c===c.next&&(c.steiner=!0),i.push(WM(c))}i.sort(zM);for(let s=0;s<i.length;s++)t=kM(i[s],t);return t}function zM(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 kM(n,e){const t=BM(n,e);if(!t)return e;const r=W_(t,n);return Qs(r,r.next),Qs(t,t.next)}function BM(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&&H_(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&&VM(o,t)))&&(o=t,h=f)}t=t.next}while(t!==a);return o}function VM(n,e){return sn(n.prev,n,e.prev)<0&&sn(e.next,n,n.next)<0}function HM(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,GM(i)}function GM(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 WM(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 H_(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)&&H_(n,e,t,r,i,s,o,a)}function jM(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!XM(n,e)&&(bl(n,e)&&bl(e,n)&&$M(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 G_(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 XM(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&&G_(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 $M(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 W_(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 j_(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 YM(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 KM{static triangulate(e,t,r=2){return OM(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=[];X_(e),$_(r,e);let o=e.length;t.forEach(X_);for(let l=0;l<t.length;l++)i.push(o),o+=t[l].length,$_(r,t[l]);const a=KM.triangulate(r,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function X_(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function $_(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 ZM(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 ZM(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 JM 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 Jr,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 QM 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 Jr,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 e4 extends $s{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ib,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 t4 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 n4{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 r4=new n4;class Tl{constructor(e){this.manager=e!==void 0?e:r4,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 i4 extends Error{constructor(e,t){super(e),this.response=t}}class s4 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 i4(`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 o4 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 Y_ extends Tl{constructor(e){super(e)}load(e,t,r,i){const s=new Dn,o=new o4(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 qt{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 Gt,K_=new G,Z_=new G;class J_{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=Si,this.map=null,this.mapPass=null,this.matrix=new Gt,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;K_.setFromMatrixPosition(e.matrixWorld),t.position.copy(K_),Z_.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Z_),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 a4 extends J_{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 l4 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(qt.DEFAULT_UP),this.updateMatrix(),this.target=new qt,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new a4}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 Q_ extends T_{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 c4 extends J_{constructor(){super(new Q_(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class u4 extends Op{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(qt.DEFAULT_UP),this.updateMatrix(),this.target=new qt,this.shadow=new c4}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class ev extends Op{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class h4 extends _r{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const tv=new Gt;class f4{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 tv.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(tv),this}intersectObject(e,t=!0,r=[]){return Dp(e,this,r,t),r.sort(nv),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(nv),r}}function nv(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 rv{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 bi;class d4 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 p4{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 m4 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 iv(n,e,t,r){const i=g4(r);switch(t){case K1:return n*e;case J1:return n*e/i.components*i.byteLength;case Sd:return n*e/i.components*i.byteLength;case Q1:return n*e*2/i.components*i.byteLength;case Ed:return n*e*2/i.components*i.byteLength;case Z1:return n*e*3/i.components*i.byteLength;case Yr: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 e_: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 g4(n){switch(n){case Si:case X1:return{byteLength:1,components:1};case sl:case $1: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 Y1: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);/**
|
|
114
114
|
* @license
|
|
115
115
|
* Copyright 2010-2025 Three.js Authors
|
|
116
116
|
* SPDX-License-Identifier: MIT
|
|
@@ -3653,7 +3653,7 @@ void main() {
|
|
|
3653
3653
|
#include <tonemapping_fragment>
|
|
3654
3654
|
#include <colorspace_fragment>
|
|
3655
3655
|
#include <fog_fragment>
|
|
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}}},wi={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}};wi.physical={uniforms:Wn([wi.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 Jr,_5=new Gt;function v5(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(wi.backgroundCube.uniforms),vertexShader:wi.backgroundCube.vertexShader,fragmentShader:wi.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(_5.makeRotationFromEuler(eo)),h.material.toneMapped=Ct.getTransfer(S.colorSpace)!==Ft,(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(wi.background.uniforms),vertexShader:wi.background.vertexShader,fragmentShader:wi.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)!==Ft,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,w_(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 x5(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 y5(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 S5(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!==Yr&&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!==Si&&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 E5(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 b5(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 dM(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,ov=[.125,.215,.35,.446,.526,.582],to=20,Np=new Q_,av=new St;let Up=null,Fp=0,zp=0,kp=!1;const no=(1+Math.sqrt(5))/2,ca=1/no,lv=[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)],M5=new G;class cv{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=M5}=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=fv(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=hv(),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:yi,minFilter:yi,generateMipmaps:!1,type:ol,format:Yr,colorSpace:ko,depthBuffer:!1},i=uv(e,t,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=uv(e,t,r);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=w5(s)),this._blurMaterial=T5(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(av),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(av),_=!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=fv()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=hv());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=lv[(i-s-1)%lv.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 w5(n){const e=[],t=[],r=[];let i=n;const s=n-la+1+ov.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=ov[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 uv(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 T5(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:`
|
|
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}}},wi={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}};wi.physical={uniforms:Wn([wi.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 Jr,_5=new Gt;function v5(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 _n(new Zs(1,1,1),new vs({name:"BackgroundCubeMaterial",uniforms:ta(wi.backgroundCube.uniforms),vertexShader:wi.backgroundCube.vertexShader,fragmentShader:wi.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(_5.makeRotationFromEuler(eo)),h.material.toneMapped=Ct.getTransfer(S.colorSpace)!==Ft,(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 _n(new Tu(2,2),new vs({name:"BackgroundMaterial",uniforms:ta(wi.background.uniforms),vertexShader:wi.background.vertexShader,fragmentShader:wi.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)!==Ft,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,w_(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 x5(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 y5(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 S5(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!==Yr&&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!==Si&&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 E5(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 b5(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 dM(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,ov=[.125,.215,.35,.446,.526,.582],to=20,Np=new Q_,av=new St;let Up=null,Fp=0,zp=0,kp=!1;const no=(1+Math.sqrt(5))/2,ca=1/no,lv=[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)],M5=new G;class cv{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=M5}=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=fv(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=hv(),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:yi,minFilter:yi,generateMipmaps:!1,type:ol,format:Yr,colorSpace:ko,depthBuffer:!1},i=uv(e,t,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=uv(e,t,r);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=w5(s)),this._blurMaterial=T5(s,e,t)}return i}_compileMaterial(e){const t=new _n(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(av),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 _n(new Zs,x);let _=!1;const b=e.background;b?b.isColor&&(x.color.copy(b),e.background=null,_=!0):(x.color.copy(av),_=!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=fv()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=hv());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new _n(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=lv[(i-s-1)%lv.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 _n(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 w5(n){const e=[],t=[],r=[];let i=n;const s=n-la+1+ov.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=ov[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 uv(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 T5(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:`
|
|
3657
3657
|
|
|
3658
3658
|
precision mediump float;
|
|
3659
3659
|
precision mediump int;
|
|
@@ -3803,7 +3803,7 @@ void main() {
|
|
|
3803
3803
|
gl_Position = vec4( position, 1.0 );
|
|
3804
3804
|
|
|
3805
3805
|
}
|
|
3806
|
-
`}function A5(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 cv(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 cv(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 C5(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 R5(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(o_(p)?S_:y_)(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 P5(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 I5(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 L5(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 u_(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 O5(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 dv=new Dn,pv=new D_(1,1),mv=new u_,gv=new Kb,_v=new R_,vv=[],xv=[],yv=new Float32Array(16),Sv=new Float32Array(9),Ev=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=vv[i];if(s===void 0&&(s=new Float32Array(i),vv[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 _n(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 vn(n,e){for(let t=0,r=e.length;t<r;t++)n[t]=e[t]}function Pu(n,e){let t=xv[e];t===void 0&&(t=new Int32Array(e),xv[e]=t);for(let r=0;r!==e;++r)t[r]=n.allocateTextureUnit();return t}function q5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function D5(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(_n(t,e))return;n.uniform2fv(this.addr,e),vn(t,e)}}function N5(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(_n(t,e))return;n.uniform3fv(this.addr,e),vn(t,e)}}function U5(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(_n(t,e))return;n.uniform4fv(this.addr,e),vn(t,e)}}function F5(n,e){const t=this.cache,r=e.elements;if(r===void 0){if(_n(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),vn(t,e)}else{if(_n(t,r))return;Ev.set(r),n.uniformMatrix2fv(this.addr,!1,Ev),vn(t,r)}}function z5(n,e){const t=this.cache,r=e.elements;if(r===void 0){if(_n(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),vn(t,e)}else{if(_n(t,r))return;Sv.set(r),n.uniformMatrix3fv(this.addr,!1,Sv),vn(t,r)}}function k5(n,e){const t=this.cache,r=e.elements;if(r===void 0){if(_n(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),vn(t,e)}else{if(_n(t,r))return;yv.set(r),n.uniformMatrix4fv(this.addr,!1,yv),vn(t,r)}}function B5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function V5(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(_n(t,e))return;n.uniform2iv(this.addr,e),vn(t,e)}}function H5(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(_n(t,e))return;n.uniform3iv(this.addr,e),vn(t,e)}}function G5(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(_n(t,e))return;n.uniform4iv(this.addr,e),vn(t,e)}}function W5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function j5(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(_n(t,e))return;n.uniform2uiv(this.addr,e),vn(t,e)}}function X5(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(_n(t,e))return;n.uniform3uiv(this.addr,e),vn(t,e)}}function $5(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(_n(t,e))return;n.uniform4uiv(this.addr,e),vn(t,e)}}function Y5(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?(pv.compareFunction=n_,s=pv):s=dv,t.setTexture2D(e||s,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.setTexture3D(e||gv,i)}function Z5(n,e,t){const r=this.cache,i=t.allocateTextureUnit();r[0]!==i&&(n.uniform1i(this.addr,i),r[0]=i),t.setTextureCube(e||_v,i)}function J5(n,e,t){const r=this.cache,i=t.allocateTextureUnit();r[0]!==i&&(n.uniform1i(this.addr,i),r[0]=i),t.setTexture2DArray(e||mv,i)}function Q5(n){switch(n){case 5126:return q5;case 35664:return D5;case 35665:return N5;case 35666:return U5;case 35674:return F5;case 35675:return z5;case 35676:return k5;case 5124:case 35670:return B5;case 35667:case 35671:return V5;case 35668:case 35672:return H5;case 35669:case 35673:return G5;case 5125:return W5;case 36294:return j5;case 36295:return X5;case 36296:return $5;case 35678:case 36198:case 36298:case 36306:case 35682:return Y5;case 35679:case 36299:case 36307:return K5;case 35680:case 36300:case 36308:case 36293:return Z5;case 36289:case 36303:case 36311:case 36292:return J5}}function eT(n,e){n.uniform1fv(this.addr,e)}function tT(n,e){const t=ua(e,this.size,2);n.uniform2fv(this.addr,t)}function nT(n,e){const t=ua(e,this.size,3);n.uniform3fv(this.addr,t)}function rT(n,e){const t=ua(e,this.size,4);n.uniform4fv(this.addr,t)}function iT(n,e){const t=ua(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function sT(n,e){const t=ua(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function oT(n,e){const t=ua(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function aT(n,e){n.uniform1iv(this.addr,e)}function lT(n,e){n.uniform2iv(this.addr,e)}function cT(n,e){n.uniform3iv(this.addr,e)}function uT(n,e){n.uniform4iv(this.addr,e)}function hT(n,e){n.uniform1uiv(this.addr,e)}function fT(n,e){n.uniform2uiv(this.addr,e)}function dT(n,e){n.uniform3uiv(this.addr,e)}function pT(n,e){n.uniform4uiv(this.addr,e)}function mT(n,e,t){const r=this.cache,i=e.length,s=Pu(t,i);_n(r,s)||(n.uniform1iv(this.addr,s),vn(r,s));for(let o=0;o!==i;++o)t.setTexture2D(e[o]||dv,s[o])}function gT(n,e,t){const r=this.cache,i=e.length,s=Pu(t,i);_n(r,s)||(n.uniform1iv(this.addr,s),vn(r,s));for(let o=0;o!==i;++o)t.setTexture3D(e[o]||gv,s[o])}function _T(n,e,t){const r=this.cache,i=e.length,s=Pu(t,i);_n(r,s)||(n.uniform1iv(this.addr,s),vn(r,s));for(let o=0;o!==i;++o)t.setTextureCube(e[o]||_v,s[o])}function vT(n,e,t){const r=this.cache,i=e.length,s=Pu(t,i);_n(r,s)||(n.uniform1iv(this.addr,s),vn(r,s));for(let o=0;o!==i;++o)t.setTexture2DArray(e[o]||mv,s[o])}function xT(n){switch(n){case 5126:return eT;case 35664:return tT;case 35665:return nT;case 35666:return rT;case 35674:return iT;case 35675:return sT;case 35676:return oT;case 5124:case 35670:return aT;case 35667:case 35671:return lT;case 35668:case 35672:return cT;case 35669:case 35673:return uT;case 5125:return hT;case 36294:return fT;case 36295:return dT;case 36296:return pT;case 35678:case 36198:case 36298:case 36306:case 35682:return mT;case 35679:case 36299:case 36307:return gT;case 35680:case 36300:case 36308:case 36293:return _T;case 36289:case 36303:case 36311:case 36292:return vT}}class yT{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.setValue=Q5(t.type)}}class ST{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=xT(t.type)}}class ET{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 bv(n,e){n.seq.push(e),n.map[e.id]=e}function bT(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){bv(t,c===void 0?new yT(a,n,e):new ST(a,n,e));break}else{let f=t.map[a];f===void 0&&(f=new ET(a),bv(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);bT(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 Mv(n,e,t){const r=n.createShader(e);return n.shaderSource(r,t),n.compileShader(r),r}const MT=37297;let wT=0;function TT(n,e){const t=n.split(`
|
|
3806
|
+
`}function A5(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 cv(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 cv(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 C5(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 R5(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(o_(p)?S_:y_)(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 P5(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 I5(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 L5(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 u_(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 O5(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 dv=new Dn,pv=new D_(1,1),mv=new u_,gv=new Kb,_v=new R_,vv=[],xv=[],yv=new Float32Array(16),Sv=new Float32Array(9),Ev=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=vv[i];if(s===void 0&&(s=new Float32Array(i),vv[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=xv[e];t===void 0&&(t=new Int32Array(e),xv[e]=t);for(let r=0;r!==e;++r)t[r]=n.allocateTextureUnit();return t}function q5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function D5(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 N5(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 U5(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 F5(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;Ev.set(r),n.uniformMatrix2fv(this.addr,!1,Ev),xn(t,r)}}function z5(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;Sv.set(r),n.uniformMatrix3fv(this.addr,!1,Sv),xn(t,r)}}function k5(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;yv.set(r),n.uniformMatrix4fv(this.addr,!1,yv),xn(t,r)}}function B5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function V5(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 H5(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 G5(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 W5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function j5(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 X5(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 $5(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 Y5(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?(pv.compareFunction=n_,s=pv):s=dv,t.setTexture2D(e||s,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.setTexture3D(e||gv,i)}function Z5(n,e,t){const r=this.cache,i=t.allocateTextureUnit();r[0]!==i&&(n.uniform1i(this.addr,i),r[0]=i),t.setTextureCube(e||_v,i)}function J5(n,e,t){const r=this.cache,i=t.allocateTextureUnit();r[0]!==i&&(n.uniform1i(this.addr,i),r[0]=i),t.setTexture2DArray(e||mv,i)}function Q5(n){switch(n){case 5126:return q5;case 35664:return D5;case 35665:return N5;case 35666:return U5;case 35674:return F5;case 35675:return z5;case 35676:return k5;case 5124:case 35670:return B5;case 35667:case 35671:return V5;case 35668:case 35672:return H5;case 35669:case 35673:return G5;case 5125:return W5;case 36294:return j5;case 36295:return X5;case 36296:return $5;case 35678:case 36198:case 36298:case 36306:case 35682:return Y5;case 35679:case 36299:case 36307:return K5;case 35680:case 36300:case 36308:case 36293:return Z5;case 36289:case 36303:case 36311:case 36292:return J5}}function eT(n,e){n.uniform1fv(this.addr,e)}function tT(n,e){const t=ua(e,this.size,2);n.uniform2fv(this.addr,t)}function nT(n,e){const t=ua(e,this.size,3);n.uniform3fv(this.addr,t)}function rT(n,e){const t=ua(e,this.size,4);n.uniform4fv(this.addr,t)}function iT(n,e){const t=ua(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function sT(n,e){const t=ua(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function oT(n,e){const t=ua(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function aT(n,e){n.uniform1iv(this.addr,e)}function lT(n,e){n.uniform2iv(this.addr,e)}function cT(n,e){n.uniform3iv(this.addr,e)}function uT(n,e){n.uniform4iv(this.addr,e)}function hT(n,e){n.uniform1uiv(this.addr,e)}function fT(n,e){n.uniform2uiv(this.addr,e)}function dT(n,e){n.uniform3uiv(this.addr,e)}function pT(n,e){n.uniform4uiv(this.addr,e)}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.setTexture2D(e[o]||dv,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.setTexture3D(e[o]||gv,s[o])}function _T(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]||_v,s[o])}function vT(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]||mv,s[o])}function xT(n){switch(n){case 5126:return eT;case 35664:return tT;case 35665:return nT;case 35666:return rT;case 35674:return iT;case 35675:return sT;case 35676:return oT;case 5124:case 35670:return aT;case 35667:case 35671:return lT;case 35668:case 35672:return cT;case 35669:case 35673:return uT;case 5125:return hT;case 36294:return fT;case 36295:return dT;case 36296:return pT;case 35678:case 36198:case 36298:case 36306:case 35682:return mT;case 35679:case 36299:case 36307:return gT;case 35680:case 36300:case 36308:case 36293:return _T;case 36289:case 36303:case 36311:case 36292:return vT}}class yT{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.setValue=Q5(t.type)}}class ST{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=xT(t.type)}}class ET{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 bv(n,e){n.seq.push(e),n.map[e.id]=e}function bT(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){bv(t,c===void 0?new yT(a,n,e):new ST(a,n,e));break}else{let f=t.map[a];f===void 0&&(f=new ET(a),bv(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);bT(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 Mv(n,e,t){const r=n.createShader(e);return n.shaderSource(r,t),n.compileShader(r),r}const MT=37297;let wT=0;function TT(n,e){const t=n.split(`
|
|
3807
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(`
|
|
3808
3808
|
`)}const wv=new pt;function AT(n){Ct._getMatrix(wv,Ct.workingColorSpace,n);const e=`mat3( ${wv.elements.map(t=>t.toFixed(4))} )`;switch(Ct.getTransfer(n)){case Xc:return[e,"LinearTransferOETF"];case Ft:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function Tv(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()+`
|
|
3809
3809
|
|
|
@@ -3882,7 +3882,7 @@ void main() {
|
|
|
3882
3882
|
squared_mean = squared_mean / samples;
|
|
3883
3883
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3884
3884
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3885
|
-
}`;function o6(n,e,t){let r=new Ep;const i=new Fe,s=new Fe,o=new on,a=new e4({depthPacking:Lb}),l=new t4,c={},h=t.maxTextureSize,f={[ls]:Qn,[Qn]:ls,[xi]:xi},p=new vs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Fe},radius:{value:4}},vertexShader:i6,fragmentShader:s6}),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=V1;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:$r,magFilter:$r}:{};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 a6={[od]:ad,[ld]:hd,[cd]:fd,[Uo]:ud,[ad]:od,[hd]:ld,[fd]:cd,[ud]:Uo};function l6(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=a6[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,ii,rr){(Oe!==ft||Be!==ii||Te!==rr)&&(n.stencilFunc(ft,ii,rr),Oe=ft,Be=ii,Te=rr)},setOp:function(ft,ii,rr){(me!==ft||Ze!==ii||ct!==rr)&&(n.stencilOp(ft,ii,rr),me=ft,Ze=ii,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(B1),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,[ib]:n.FUNC_SUBTRACT,[sb]:n.FUNC_REVERSE_SUBTRACT};le[ob]=n.MIN,le[ab]=n.MAX;const z={[lb]:n.ZERO,[cb]:n.ONE,[ub]:n.SRC_COLOR,[id]:n.SRC_ALPHA,[gb]:n.SRC_ALPHA_SATURATE,[pb]:n.DST_COLOR,[fb]:n.DST_ALPHA,[hb]:n.ONE_MINUS_SRC_COLOR,[sd]:n.ONE_MINUS_SRC_ALPHA,[mb]:n.ONE_MINUS_DST_COLOR,[db]:n.ONE_MINUS_DST_ALPHA,[_b]:n.CONSTANT_COLOR,[vb]:n.ONE_MINUS_CONSTANT_COLOR,[xb]:n.CONSTANT_ALPHA,[yb]: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!==rb){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 H1:n.blendFunc(n.ONE,n.ONE);break;case G1:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case W1: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 H1:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case G1:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case W1: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===xi?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!==eb?(W(n.CULL_FACE),H!==N&&(H===B1?n.cullFace(n.BACK):H===tb?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 c6(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===Ft?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!==$r&&F.minFilter!==yi?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={[Xr]:n.REPEAT,[Bs]:n.CLAMP_TO_EDGE,[gd]:n.MIRRORED_REPEAT},U={[$r]:n.NEAREST,[Pb]:n.NEAREST_MIPMAP_NEAREST,[Bc]:n.NEAREST_MIPMAP_LINEAR,[yi]:n.LINEAR,[_d]:n.LINEAR_MIPMAP_NEAREST,[Vs]:n.LINEAR_MIPMAP_LINEAR},$={[qb]:n.NEVER,[kb]:n.ALWAYS,[Db]:n.LESS,[n_]:n.LEQUAL,[Nb]:n.EQUAL,[zb]:n.GEQUAL,[Ub]:n.GREATER,[Fb]:n.NOTEQUAL};function pe(F,I){if(I.type===Fi&&e.has("OES_texture_float_linear")===!1&&(I.magFilter===yi||I.magFilter===_d||I.magFilter===Bc||I.magFilter===Vs||I.minFilter===yi||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===$r||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!==Yr)if(Ne!==null)if(H){if(Oe)if(I.layerUpdates.size>0){const Ze=iv(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!==Yr?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=iv(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!==Yr?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)===Ft?(de!==Yr||Me!==Si)&&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 u6(n,e){function t(r,i=hs){let s;const o=Ct.getTransfer(i);if(r===Si)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===Y1)return n.UNSIGNED_INT_5_9_9_9_REV;if(r===X1)return n.BYTE;if(r===$1)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===K1)return n.ALPHA;if(r===Z1)return n.RGB;if(r===Yr)return n.RGBA;if(r===ll)return n.DEPTH_COMPONENT;if(r===cl)return n.DEPTH_STENCIL;if(r===J1)return n.RED;if(r===Sd)return n.RED_INTEGER;if(r===Q1)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===Ft)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===Ft?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===Pd)return o===Ft?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===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Ld)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Od)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===qd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===Dd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Nd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===Ud)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===Fd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===zd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===kd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===Bd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Vd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===Hd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===Gd)return o===Ft?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===Ft?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===e_||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 qv extends Dn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}}const h6=`
|
|
3885
|
+
}`;function o6(n,e,t){let r=new Ep;const i=new Fe,s=new Fe,o=new on,a=new e4({depthPacking:Lb}),l=new t4,c={},h=t.maxTextureSize,f={[ls]:Qn,[Qn]:ls,[xi]:xi},p=new vs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Fe},radius:{value:4}},vertexShader:i6,fragmentShader:s6}),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 _n(m,p),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=V1;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:$r,magFilter:$r}:{};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 a6={[od]:ad,[ld]:hd,[cd]:fd,[Uo]:ud,[ad]:od,[hd]:ld,[fd]:cd,[ud]:Uo};function l6(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=a6[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,ii,rr){(Oe!==ft||Be!==ii||Te!==rr)&&(n.stencilFunc(ft,ii,rr),Oe=ft,Be=ii,Te=rr)},setOp:function(ft,ii,rr){(me!==ft||Ze!==ii||ct!==rr)&&(n.stencilOp(ft,ii,rr),me=ft,Ze=ii,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(B1),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,[ib]:n.FUNC_SUBTRACT,[sb]:n.FUNC_REVERSE_SUBTRACT};le[ob]=n.MIN,le[ab]=n.MAX;const z={[lb]:n.ZERO,[cb]:n.ONE,[ub]:n.SRC_COLOR,[id]:n.SRC_ALPHA,[gb]:n.SRC_ALPHA_SATURATE,[pb]:n.DST_COLOR,[fb]:n.DST_ALPHA,[hb]:n.ONE_MINUS_SRC_COLOR,[sd]:n.ONE_MINUS_SRC_ALPHA,[mb]:n.ONE_MINUS_DST_COLOR,[db]:n.ONE_MINUS_DST_ALPHA,[_b]:n.CONSTANT_COLOR,[vb]:n.ONE_MINUS_CONSTANT_COLOR,[xb]:n.CONSTANT_ALPHA,[yb]: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!==rb){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 H1:n.blendFunc(n.ONE,n.ONE);break;case G1:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case W1: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 H1:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case G1:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case W1: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===xi?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!==eb?(W(n.CULL_FACE),H!==N&&(H===B1?n.cullFace(n.BACK):H===tb?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 c6(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===Ft?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!==$r&&F.minFilter!==yi?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={[Xr]:n.REPEAT,[Bs]:n.CLAMP_TO_EDGE,[gd]:n.MIRRORED_REPEAT},U={[$r]:n.NEAREST,[Pb]:n.NEAREST_MIPMAP_NEAREST,[Bc]:n.NEAREST_MIPMAP_LINEAR,[yi]:n.LINEAR,[_d]:n.LINEAR_MIPMAP_NEAREST,[Vs]:n.LINEAR_MIPMAP_LINEAR},$={[qb]:n.NEVER,[kb]:n.ALWAYS,[Db]:n.LESS,[n_]:n.LEQUAL,[Nb]:n.EQUAL,[zb]:n.GEQUAL,[Ub]:n.GREATER,[Fb]:n.NOTEQUAL};function pe(F,I){if(I.type===Fi&&e.has("OES_texture_float_linear")===!1&&(I.magFilter===yi||I.magFilter===_d||I.magFilter===Bc||I.magFilter===Vs||I.minFilter===yi||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===$r||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!==Yr)if(Ne!==null)if(H){if(Oe)if(I.layerUpdates.size>0){const Ze=iv(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!==Yr?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=iv(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!==Yr?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)===Ft?(de!==Yr||Me!==Si)&&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 u6(n,e){function t(r,i=hs){let s;const o=Ct.getTransfer(i);if(r===Si)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===Y1)return n.UNSIGNED_INT_5_9_9_9_REV;if(r===X1)return n.BYTE;if(r===$1)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===K1)return n.ALPHA;if(r===Z1)return n.RGB;if(r===Yr)return n.RGBA;if(r===ll)return n.DEPTH_COMPONENT;if(r===cl)return n.DEPTH_STENCIL;if(r===J1)return n.RED;if(r===Sd)return n.RED_INTEGER;if(r===Q1)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===Ft)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===Ft?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===Pd)return o===Ft?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===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Ld)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Od)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===qd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===Dd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Nd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===Ud)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===Fd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===zd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===kd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===Bd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Vd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===Hd)return o===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===Gd)return o===Ft?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===Ft?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===e_||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 qv extends Dn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}}const h6=`
|
|
3886
3886
|
void main() {
|
|
3887
3887
|
|
|
3888
3888
|
gl_Position = vec4( position, 1.0 );
|
|
@@ -3906,7 +3906,7 @@ void main() {
|
|
|
3906
3906
|
|
|
3907
3907
|
}
|
|
3908
3908
|
|
|
3909
|
-
}`;class d6{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const r=new qv(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:h6,fragmentShader:f6,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 p6 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 d6,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 h4;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:Yr,type:Si,depthTexture:new D_(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:Yr,type:Si,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 qv,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 sv;be.setAnimationLoop(Se),this.setAnimationLoop=function(V){pe=V},this.dispose=function(){}}}const ro=new Jr,m6=new Gt;function g6(n,e){function t(v,_){v.matrixAutoUpdate===!0&&v.updateMatrix(),_.value.copy(v.matrix)}function r(v,_){_.color.getRGB(v.fogColor.value,w_(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(m6.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 _6(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 v6{constructor(e={}){const{canvas:t=Hb(),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 Gt,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 C5(z),Ie.init(),Ke=new u6(z,Ie),$e=new S5(z,Ie,e,Ke),qe=new l6(z,Ie),$e.reversedDepthBuffer&&p&&qe.buffers.depth.setReversed(!0),De=new I5(z),ve=new YT,Ge=new c6(z,Ie,qe,ve,$e,Ke,De),rt=new b5(E),wt=new A5(E),F=new _4(z),Re=new x5(z,F),I=new R5(z,F,De,Re),ee=new O5(z,I,F,De),Ce=new L5(z,$e,Ge),Ae=new E5(ve),de=new $T(E,rt,wt,Ie,$e,Re,Ae),Me=new g6(E,ve),fe=new ZT,Ue=new r6(Ie),je=new v5(E,rt,wt,qe,ee,d,l),We=new o6(E,ee,$e),ht=new _6(z,De,$e,qe),Ne=new y5(z,Ie,De),Ve=new P5(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 p6(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===Si||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 Dt,Nt=Ne;if(Ye!==null&&(Dt=F.get(Ye),Nt=Ve,Nt.setIndex(Dt)),Y.isMesh)ie.wireframe===!0?(qe.setLineWidth(ie.wireframeLinewidth*le()),Nt.setMode(z.LINES)):Nt.setMode(z.TRIANGLES);else if(Y.isLine){let ot=ie.linewidth;ot===void 0&&(ot=1),qe.setLineWidth(ot*le()),Y.isLineSegments?Nt.setMode(z.LINES):Y.isLineLoop?Nt.setMode(z.LINE_LOOP):Nt.setMode(z.LINE_STRIP)}else Y.isPoints?Nt.setMode(z.POINTS):Y.isSprite&&Nt.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."),Nt.renderMultiDrawInstances(Y._multiDrawStarts,Y._multiDrawCounts,Y._multiDrawCount,Y._multiDrawInstances);else if(Ie.get("WEBGL_multi_draw"))Nt.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),Nt.render(ot[Fn]/Un,Qt[Fn])}else if(Y.isInstancedMesh)Nt.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);Nt.renderInstances(xt,Jt,Qt)}else Nt.render(xt,Jt)};function Lt(P,X,re){P.transparent===!0&&P.side===xi&&P.forceSinglePass===!1?(P.side=Qn,P.needsUpdate=!0,qr(P,X,re),P.side=ls,P.needsUpdate=!0,qr(P,X,re),P.side=xi):qr(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 ii(P){ft&&ft(P)}function rr(){Ai.stop()}function $u(){Ai.start()}const Ai=new sv;Ai.setAnimationLoop(ii),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,Ei,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:Si,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 Dt=X[Rt],Nt=Dt.object,ot=Dt.geometry,Qt=Dt.material,Et=Dt.group;if(Qt.side===xi&&Nt.layers.test(ie.layers)){const Un=Qt.side;Qt.side=Qn,Qt.needsUpdate=!0,ba(Nt,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===xi&&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=xi):E.renderBufferDirect(re,X,ie,Y,P,we),P.onAfterRender(E,X,re,ie,Y,we)}function qr(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 Dt=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,Nt=Dt!==void 0?Dt.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!==Nt)&&(Et=!0):(Et=!0,ot.__version=ie.version);let Un=ot.currentProgram;Et===!0&&(Un=qr(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 Gb(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 Dt=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(Dt.width*ir),Je=Math.floor(Dt.height*ir),P.isDataArrayTexture?Ye=Dt.depth:P.isData3DTexture?Ye=Math.floor(Dt.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 Nt=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,Dt.width),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,Dt.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,Nt,ot,Dt.data):X.isCompressedArrayTexture?z.compressedTexSubImage3D(Qt,we,xt,Rt,Jt,ze,Je,Ye,Nt,Dt.data):z.texSubImage3D(Qt,we,xt,Rt,Jt,ze,Je,Ye,Nt,ot,Dt):P.isDataTexture?z.texSubImage2D(z.TEXTURE_2D,we,xt,Rt,ze,Je,Nt,ot,Dt.data):P.isCompressedTexture?z.compressedTexSubImage2D(z.TEXTURE_2D,we,xt,Rt,Dt.width,Dt.height,Nt,Dt.data):z.texSubImage2D(z.TEXTURE_2D,we,xt,Rt,ze,Je,Nt,ot,Dt);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 Ei}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 x6 extends Tl{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new s4(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 y6(e)}}class y6{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){const r=[],i=S6(e,t,this.data);for(let s=0,o=i.length;s<o;s++)r.push(...i[s].toShapes());return r}}function S6(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 d6{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const r=new qv(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:h6,fragmentShader:f6,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new _n(new Tu(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class p6 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 d6,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 h4;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:Yr,type:Si,depthTexture:new D_(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:Yr,type:Si,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 qv,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 sv;be.setAnimationLoop(Se),this.setAnimationLoop=function(V){pe=V},this.dispose=function(){}}}const ro=new Jr,m6=new Gt;function g6(n,e){function t(v,_){v.matrixAutoUpdate===!0&&v.updateMatrix(),_.value.copy(v.matrix)}function r(v,_){_.color.getRGB(v.fogColor.value,w_(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(m6.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 _6(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 v6{constructor(e={}){const{canvas:t=Hb(),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 Gt,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 C5(z),Ie.init(),Ke=new u6(z,Ie),$e=new S5(z,Ie,e,Ke),qe=new l6(z,Ie),$e.reversedDepthBuffer&&p&&qe.buffers.depth.setReversed(!0),De=new I5(z),ve=new YT,Ge=new c6(z,Ie,qe,ve,$e,Ke,De),rt=new b5(E),wt=new A5(E),F=new _4(z),Re=new x5(z,F),I=new R5(z,F,De,Re),ee=new O5(z,I,F,De),Ce=new L5(z,$e,Ge),Ae=new E5(ve),de=new $T(E,rt,wt,Ie,$e,Re,Ae),Me=new g6(E,ve),fe=new ZT,Ue=new r6(Ie),je=new v5(E,rt,wt,qe,ee,d,l),We=new o6(E,ee,$e),ht=new _6(z,De,$e,qe),Ne=new y5(z,Ie,De),Ve=new P5(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 p6(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===Si||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 Dt,Nt=Ne;if(Ye!==null&&(Dt=F.get(Ye),Nt=Ve,Nt.setIndex(Dt)),Y.isMesh)ie.wireframe===!0?(qe.setLineWidth(ie.wireframeLinewidth*le()),Nt.setMode(z.LINES)):Nt.setMode(z.TRIANGLES);else if(Y.isLine){let ot=ie.linewidth;ot===void 0&&(ot=1),qe.setLineWidth(ot*le()),Y.isLineSegments?Nt.setMode(z.LINES):Y.isLineLoop?Nt.setMode(z.LINE_LOOP):Nt.setMode(z.LINE_STRIP)}else Y.isPoints?Nt.setMode(z.POINTS):Y.isSprite&&Nt.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."),Nt.renderMultiDrawInstances(Y._multiDrawStarts,Y._multiDrawCounts,Y._multiDrawCount,Y._multiDrawInstances);else if(Ie.get("WEBGL_multi_draw"))Nt.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),Nt.render(ot[Fn]/Un,Qt[Fn])}else if(Y.isInstancedMesh)Nt.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);Nt.renderInstances(xt,Jt,Qt)}else Nt.render(xt,Jt)};function Lt(P,X,re){P.transparent===!0&&P.side===xi&&P.forceSinglePass===!1?(P.side=Qn,P.needsUpdate=!0,qr(P,X,re),P.side=ls,P.needsUpdate=!0,qr(P,X,re),P.side=xi):qr(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 ii(P){ft&&ft(P)}function rr(){Ai.stop()}function $u(){Ai.start()}const Ai=new sv;Ai.setAnimationLoop(ii),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,Ei,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:Si,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 Dt=X[Rt],Nt=Dt.object,ot=Dt.geometry,Qt=Dt.material,Et=Dt.group;if(Qt.side===xi&&Nt.layers.test(ie.layers)){const Un=Qt.side;Qt.side=Qn,Qt.needsUpdate=!0,ba(Nt,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===xi&&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=xi):E.renderBufferDirect(re,X,ie,Y,P,we),P.onAfterRender(E,X,re,ie,Y,we)}function qr(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 Dt=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,Nt=Dt!==void 0?Dt.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!==Nt)&&(Et=!0):(Et=!0,ot.__version=ie.version);let Un=ot.currentProgram;Et===!0&&(Un=qr(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 Gb(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 Dt=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(Dt.width*ir),Je=Math.floor(Dt.height*ir),P.isDataArrayTexture?Ye=Dt.depth:P.isData3DTexture?Ye=Math.floor(Dt.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 Nt=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,Dt.width),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,Dt.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,Nt,ot,Dt.data):X.isCompressedArrayTexture?z.compressedTexSubImage3D(Qt,we,xt,Rt,Jt,ze,Je,Ye,Nt,Dt.data):z.texSubImage3D(Qt,we,xt,Rt,Jt,ze,Je,Ye,Nt,ot,Dt):P.isDataTexture?z.texSubImage2D(z.TEXTURE_2D,we,xt,Rt,ze,Je,Nt,ot,Dt.data):P.isCompressedTexture?z.compressedTexSubImage2D(z.TEXTURE_2D,we,xt,Rt,Dt.width,Dt.height,Nt,Dt.data):z.texSubImage2D(z.TEXTURE_2D,we,xt,Rt,ze,Je,Nt,ot,Dt);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 Ei}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 x6 extends Tl{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new s4(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 y6(e)}}class y6{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){const r=[],i=S6(e,t,this.data);for(let s=0,o=i.length;s<o;s++)r.push(...i[s].toShapes());return r}}function S6(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===`
|
|
3910
3910
|
`)a=0,l-=s;else{const f=E6(h,i,a,l,t);a+=f.offsetX,o.push(f.path)}}return o}function E6(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 p4;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 b6={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
|
|
3911
3911
|
\r
|
|
3912
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
|
|
@@ -3919,11 +3919,11 @@ This License becomes null and void to the extent applicable to Fonts or Font Sof
|
|
|
3919
3919
|
\r
|
|
3920
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
|
|
3921
3921
|
\r
|
|
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 M6(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 qt;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 w6(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 qt;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 T6(n){const e=new qt;e.name="grid",new x6().parse(b6);const{grids:r,width:i,height:s}=n;return r.forEach(o=>{switch(o.type){case"horizontal-streak":e.add(M6(i,s,o));break;case"vertical-streak":e.add(w6(i,s,o));break}}),e.position.y=-1,e}function A6(n){n&&n.dispose&&n.dispose()}function C6(n){n&&n.dispose&&n.dispose()}function Dv(n){if(n){if(Array.isArray(n)){n.forEach(e=>Dv(e));return}for(const e in n){const t=n[e];t instanceof Dn&&C6(t)}n.dispose()}}function Nv(n){(n instanceof Tn||n instanceof d4||n instanceof vl)&&(A6(n.geometry),Dv(n.material),n.geometry=null,n.material=null)}function R6(n){n.traverse(e=>{Nv(e)})}function Ou(n){n.traverse(e=>{Nv(e)})}function P6(n,e,t){const r={sceneGraph:{unit:n.unit,layers:{},busyResources:{layers:{}},width:n.width,height:n.height,LODs:{}},plan:new qt,grid:T6(n),boundingBox:new bi};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 I6(n,e,t,r,i,s){const o=r.map(l=>({op:l.op,path:l.path.split("/"),value:l.value}));let a=z6(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")O6(c[2],n);else if(c.length>3)switch(l){case"replace":Cl(c,f,n,i,e,t,s);break;case"add":q6(c,f,n,i,e,t,s);break;case"remove":L6(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(D6(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(N6(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(U6(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(F6(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 L6(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 O6(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 q6(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 qt;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 bi().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 D6(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 qt;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 N6(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 qt;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 U6(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 qt;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 F6(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 bi().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 z6(n,e,t){return k6(B6(V6(n)),e,t)}function k6(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 B6(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 V6(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 Uv={type:"change"},Gp={type:"start"},Fv={type:"end"},Fu=new ru,zv=new ys,H6=Math.cos(70*Vb.DEG2RAD),xn=new G,nr=2*Math.PI,zt={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 G6 extends m4{constructor(e,t=null){super(e,t),this.state=zt.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 rv,this._sphericalDelta=new rv,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=j6.bind(this),this._onPointerDown=W6.bind(this),this._onPointerUp=X6.bind(this),this._onContextMenu=e8.bind(this),this._onMouseWheel=K6.bind(this),this._onKeyDown=Z6.bind(this),this._onTouchStart=J6.bind(this),this._onTouchMove=Q6.bind(this),this._onMouseDown=$6.bind(this),this._onMouseMove=Y6.bind(this),this._interceptControlDown=t8.bind(this),this._interceptControlUp=n8.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(Uv),this.update(),this.state=zt.NONE}update(e=null){const t=this.object.position;xn.copy(t).sub(this.target),xn.applyQuaternion(this._quat),this._spherical.setFromVector3(xn),this.autoRotate&&this.state===zt.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(xn.setFromSpherical(this._spherical),xn.applyQuaternion(this._quatInverse),t.copy(this.target).add(xn),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=xn.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=xn.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))<H6?this.object.lookAt(this.target):(zv.setFromNormalAndCoplanarPoint(this.object.up,this.target),Fu.intersectPlane(zv,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(Uv),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){xn.setFromMatrixColumn(t,0),xn.multiplyScalar(-e),this._panOffset.add(xn)}_panUp(e,t){this.screenSpacePanning===!0?xn.setFromMatrixColumn(t,1):(xn.setFromMatrixColumn(t,0),xn.crossVectors(this.object.up,xn)),xn.multiplyScalar(e),this._panOffset.add(xn)}_pan(e,t){const r=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;xn.copy(i).sub(this.target);let s=xn.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 W6(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 j6(n){this.enabled!==!1&&(n.pointerType==="touch"?this._onTouchMove(n):this._onMouseMove(n))}function X6(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(Fv),this.state=zt.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 $6(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=zt.DOLLY;break;case qo.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=zt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=zt.ROTATE}break;case qo.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=zt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=zt.PAN}break;default:this.state=zt.NONE}this.state!==zt.NONE&&this.dispatchEvent(Gp)}function Y6(n){switch(this.state){case zt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(n);break;case zt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(n);break;case zt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(n);break}}function K6(n){this.enabled===!1||this.enableZoom===!1||this.state!==zt.NONE||(n.preventDefault(),this.dispatchEvent(Gp),this._handleMouseWheel(this._customWheelEvent(n)),this.dispatchEvent(Fv))}function Z6(n){this.enabled!==!1&&this._handleKeyDown(n)}function J6(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=zt.TOUCH_ROTATE;break;case Do.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(n),this.state=zt.TOUCH_PAN;break;default:this.state=zt.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=zt.TOUCH_DOLLY_PAN;break;case Do.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(n),this.state=zt.TOUCH_DOLLY_ROTATE;break;default:this.state=zt.NONE}break;default:this.state=zt.NONE}this.state!==zt.NONE&&this.dispatchEvent(Gp)}function Q6(n){switch(this._trackPointer(n),this.state){case zt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(n),this.update();break;case zt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(n),this.update();break;case zt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(n),this.update();break;case zt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(n),this.update();break;default:this.state=zt.NONE}}function e8(n){this.enabled!==!1&&n.preventDefault()}function t8(n){n.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function n8(n){n.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const fa=n=>Bt(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},r8=(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}),i8=mt({op:"!=",val:null,newVal:null}),s8=(n,e)=>{const t=o8(n,e);return a8(t,n,e,n.size??0,e.size??0)},o8=(n,e)=>{const t=n.size??0,r=e.size??0,i=r8(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},a8=(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 i8({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()},l8=/\//g,c8=/~/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(c8,"~0").replace(l8,"~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(kv(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},kv=(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=s8(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},u8=(n,e,t="")=>n===e?[]:[Yi("replace",vr(t,""),e)],h8=(n,e,t="")=>Kt(n,e)?Xe():n!=e&&(n==null||e==null)?At([Yi("replace","/",e)]):da(n)&&da(e)?At(kv(n,e)):pa(n)&&pa(e)?At(Xp(n,e)):fa(n)&&fa(e)?At(Pl(n,e)):At(u8(n,e,t));class f8 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",null);ut(this,"planData");ut(this,"renderingID",0);ut(this,"width");ut(this,"height");ut(this,"lastMousePosition",{});ut(this,"mouseDownEvent");ut(this,"mouseUpEvent");this.width=t.width,this.height=t.height,this.renderer=new v6({preserveDrawingBuffer:!0,antialias:!0})}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 mM;this.renderer.setSize(this.width,this.height),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.outputColorSpace=pr,this.renderer.useLegacyLights=!1,this.renderer.setClearColor(new St(Fc.white));const l=P6(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.set(0,1,0);const m=new l4(Fc.white,.3);m.position.set(f,p,d),a.add(m),a.add(new ev(11513775)),a.add(new ev(16777215,.7));const x=new u4(16777215,.6);x.position.set(100,200,100),x.castShadow=!0,a.add(x);const v=[l.plan],_=new Fe,b=new f4;this.mouseDownEvent=T=>{this.lastMousePosition.x=T.offsetX/this.width*2-1,this.lastMousePosition.y=-T.offsetY/this.height*2+1},this.mouseUpEvent=T=>{var q,O;if(T.preventDefault(),_.x=T.offsetX/this.width*2-1,_.y=-(T.offsetY/this.height)*2+1,Math.abs(_.x-(this.lastMousePosition.x??0))<=.02&&Math.abs(_.y-(this.lastMousePosition.y??0))<=.02){b.setFromCamera(_,h);const A=b.intersectObjects(v,!0);A.length>0&&!isNaN(A[0].distance)?(O=(q=A[0].object).interact)==null||O.call(q):this.props.actions.projectActions.unselectAll()}},this.renderer.domElement.addEventListener("mousedown",this.mouseDownEvent),this.renderer.domElement.addEventListener("mouseup",this.mouseUpEvent),o&&o.appendChild(this.renderer.domElement);const M=new G6(h,this.renderer.domElement);M.enableDamping=!0,M.dampingFactor=.05;const E=new qt;E.name="spotLightTarget",E.position.copy(M.target),a.add(E),m.target=E;const S=()=>{M.update(),m.position.copy(h.position),E.position.copy(M.target);for(const T in l.sceneGraph.LODs)l.sceneGraph.LODs[T].update(h);this.renderer.render(a,h),this.renderingID=requestAnimationFrame(S)};S(),this.orbitControls=M,this.camera=h,this.scene3D=a,this.planData=l}componentWillUnmount(){var t;cancelAnimationFrame(this.renderingID),(t=this.orbitControls)==null||t.dispose(),this.renderer.domElement.removeEventListener("mousedown",this.mouseDownEvent),this.renderer.domElement.removeEventListener("mouseup",this.mouseUpEvent),this.scene3D&&(R6(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()}componentDidUpdate(t){const{width:r,height:i}=this.props;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 s=h8(t.state.scene,this.props.state.scene),o={areaActions:this.props.actions.areaActions,holesActions:this.props.actions.holesActions,itemsActions:this.props.actions.itemsActions,linesActions:this.props.actions.linesActions,projectActions:this.props.actions.projectActions};I6(this.planData,this.props.state.scene,t.state.scene,s.toJS(),o,this.props.catalog)}this.renderer.setSize(r,i)}render(){return se.createElement("div",{ref:this.canvasWrapperRef})}}const d8={color:Ut.PRIMARY_COLOR.alt,fontWeight:300};function p8({children:n,style:e={},...t}){return R.jsx("h1",{style:{...d8,...e},...t,children:n})}const m8={padding:"0 20px",overflowY:"auto"};function g8({children:n,width:e,height:t,style:r={}}){return R.jsx("div",{style:{width:e,height:t,...m8,...r},onWheel:i=>i.stopPropagation(),children:n})}var Bv={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Vv=se.createContext&&se.createContext(Bv),_8=["attr","size","title"];function v8(n,e){if(n==null)return{};var t=x8(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 x8(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 Hv(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?Hv(Object(t),!0).forEach(function(r){y8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Hv(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function y8(n,e,t){return e=S8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function S8(n){var e=E8(n,"string");return typeof e=="symbol"?e:e+""}function E8(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 Gv(n){return n&&n.map((e,t)=>se.createElement(e.tag,ku({key:t},e.attr),Gv(e.child)))}function yn(n){return e=>se.createElement(b8,zu({attr:ku({},n.attr)},e),Gv(n.child))}function b8(n){var e=t=>{var{attr:r,size:i,title:s}=n,o=v8(n,_8),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 Vv!==void 0?se.createElement(Vv.Consumer,null,t=>e(t)):e(Bv)}function M8(n){return yn({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 w8(n){return yn({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 T8(n){return yn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"},child:[]}]})(n)}function A8(n){return yn({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 C8(n){return yn({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 R8(n){return yn({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 Wv={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"},P8={...Wv,background:Ut.SECONDARY_COLOR.main},jv={width:"100%",textAlign:"center",display:"block",marginBottom:".5em",textTransform:"capitalize"},I8={...jv,color:Ut.COLORS.white},L8={width:"100%",height:"8em",position:"relative",overflow:"hidden",border:"solid 1px #e6e6e6",padding:0,margin:0,marginBottom:"5px"},Xv={position:"absolute",background:"#222",width:"100%",height:"100%",backgroundSize:"contain",backgroundPosition:"50% 50%",backgroundColor:Ut.COLORS.white,backgroundRepeat:"no-repeat",transition:"all .2s ease-in-out"},O8={...Xv,transform:"scale(1.2)"},q8={marginTop:"1.5em",color:Ut.SECONDARY_COLOR.main,fontSize:"2em",opacity:"0.7",width:"100%"},D8={display:"block",height:"2em",margin:"0 auto",fontSize:"0.75em",fontStyle:"italic",lineHeight:"1em",WebkitLineClamp:"2",WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"},N8={listStyle:"none",margin:"0px",padding:"0px",fontSize:"11px",marginBottom:"3px"},U8={display:"inline-block",background:"#337ab7",color:Ut.COLORS.white,padding:"1px 4px",marginRight:"3px",borderRadius:"3px"},$v=({element:n})=>{const[e,t]=se.useState(!1),{selectToolDrawingLine:r,selectToolDrawingItem:i,selectToolDrawingHole:s,pushLastSelectedCatalogElementToHistory:o}=Ht(),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 R.jsxs("div",{style:e?P8:Wv,onClick:a,onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),children:[R.jsx("b",{style:e?I8:jv,children:n.info.title}),R.jsx("div",{style:L8,children:R.jsx("div",{style:{...e?O8:Xv,backgroundImage:"url("+n.info.image+")"},children:e?R.jsx(A8,{style:q8}):null})}),R.jsx("ul",{style:N8,children:n.info.tag.map((l,c)=>R.jsx("li",{style:U8,children:l},c))}),R.jsx("div",{style:D8,children:n.info.description})]})};function F8(n){return yn({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 z8(n){return yn({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 yn({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 yn({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 Yv(n){return yn({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 yn({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"},Kv={fontSize:"20px",cursor:"pointer"},G8={...Kv,fontWeight:"bolder",color:Ut.SECONDARY_COLOR.main},W8={fill:Ut.COLORS.black,fontSize:"24px",marginLeft:"10px",marginRight:"10px"},j8=({names:n})=>{let e=n.map((t,r)=>{let i=r===n.length-1;return R.jsxs("div",{style:{display:"flex"},children:[R.jsx("div",{style:i?G8:Kv,onClick:t.action||null,children:t.name}),i?null:R.jsx(Yv,{style:W8})]},r)});return R.jsx("div",{style:H8,children:e})},Zv={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={...Zv,background:Ut.SECONDARY_COLOR.main},Jv={position:"absolute",color:Ut.COLORS.black,fontSize:"5em",width:"100%"},$8={...Jv,color:Ut.SECONDARY_COLOR.main},Y8={background:Ut.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}=Ht(),i=s=>{r(s)};return R.jsx("div",{style:e?X8:Zv,onClick:()=>i(n.name),onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),children:R.jsx("div",{style:Y8,children:R.jsx(B8,{style:e?$8:Jv})})})},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"},Qv={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={...Qv,padding:"0.2em 0.625em"},nA={width:"auto",height:"2em",lineHeight:"2em",textAlign:"center",borderRadius:"1em",display:"inline-block",cursor:"pointer",backgroundColor:Ut.PRIMARY_COLOR.alt,color:Ut.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}=Ht();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:""}),_=R.jsx(j8,{names:A})}let b=i.catalog.path.size,M=b>0?R.jsx(K8,{page:r.categories[i.catalog.path.get(b-1)]},b):null,E=i.get("selectedElementsHistory"),S=E.map((A,L)=>R.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 R.jsxs(g8,{width:n,height:e,style:{...Z8,...t},children:[R.jsx(p8,{children:"Catalog"}),_,R.jsxs("div",{style:Qv,children:[R.jsx("span",{style:Q8,children:"Search Element"}),R.jsx("input",{type:"text",style:eA,onChange:A=>{q(A.target.value)}})]}),E.size?R.jsxs("div",{style:tA,children:[R.jsx("span",{children:"Last Selected"}),S]}):null,R.jsx("div",{style:J8,children:d===""?[M,p.map(A=>R.jsx($v,{element:A},A.name))]:x.map(A=>R.jsx($v,{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:Fr,MODE_DRAGGING_LINE:zr,MODE_DRAGGING_VERTEX:kr,MODE_DRAGGING_ITEM:Br,MODE_DRAWING_LINE:cr,MODE_DRAWING_HOLE:ur,MODE_DRAWING_ITEM:wr,MODE_DRAGGING_HOLE:Vr,MODE_ROTATING_ITEM:qi};function sA({width:n,height:e,catalog:t}){const r=Ht(),{planner:i}=r,{mode:s}=i;return s===Oi?R.jsx(f8,{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?R.jsx(R.Fragment,{}):s===sf?R.jsx(rA,{width:n,height:e,catalog:t}):iA[s]?R.jsx(QE,{width:n,height:e,catalog:t}):s===$0?R.jsx(R.Fragment,{}):null}function oA(n){return yn({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 aA(n){return yn({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)}const lA=(n,e,t,r,i)=>r+(i-r)*(n-e)/(t-e),cA=({sidebarWidth:n})=>{const{planner:e,viewer:t}=Ht(),{mode:r,mouse:i,zoom:s}=e,o=a=>{const l=parseInt(z1(s).toFixed());if(l===0&&a==="out"||l===100&&a==="in"||!t)return;const c=t==null?void 0:t.getValue(),h=c.viewerWidth/2,f=c.viewerHeight/2,p=a==="in"?-1:1,d=1.06,m=Math.max(-1,Math.min(1,p)),x=lA(m,-1,1,d,1/d);t.zoom(h,f,x)};if(of.includes(r))return R.jsx("div",{className:"floor_planner-footerbar absolute rounded-tl w-auto z-[9001] py-[3px] px-[1em] text-xs bg-[#2b2b2b] h-5 select-none cursor-default bottom-0 leading-[14px] text-white m-0",style:{right:n},children:R.jsx("div",{className:"relative float-left inline-block",title:"Scene Zoom Level",children:R.jsxs("div",{className:"flex items-center gap-2",children:[R.jsx(oA,{className:"inline-block cursor-pointer",size:16,onClick:()=>o("out")})," ",R.jsxs("span",{children:[z1(s).toFixed(),"%"]})," ",R.jsx(aA,{className:"inline-block cursor-pointer",size:16,onClick:()=>o("in")})]})})})};function ex(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=ex(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function uA(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=ex(n))&&(r&&(r+=" "),r+=e);return r}const $p="-",hA=n=>{const e=dA(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:o=>{const a=o.split($p);return a[0]===""&&a.length!==1&&a.shift(),tx(a,e)||fA(o)},getConflictingClassGroupIds:(o,a)=>{const l=t[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},tx=(n,e)=>{var o;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?tx(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},nx=/^\[(.+)\]$/,fA=n=>{if(nx.test(n)){const e=nx.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},dA=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:rx(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(pA(i)){Yp(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{Yp(o,rx(e,s),t,r)})})},rx=(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},pA=n=>n.isThemeGetter,mA=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=":",gA=Zp.length,_A=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+gA;continue}if(x==="/"){c=m;continue}}x==="["?o++:x==="]"?o--:x==="("?a++:x===")"&&a--}const h=s.length===0?i:i.substring(l),f=vA(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},vA=n=>n.endsWith(Kp)?n.substring(0,n.length-1):n.startsWith(Kp)?n.substring(1):n,xA=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}},yA=n=>({cache:mA(n.cacheSize),parseClassName:_A(n),sortModifiers:xA(n),...hA(n)}),SA=/\s+/,EA=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=n.trim().split(SA);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 bA(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=ix(e))&&(r&&(r+=" "),r+=t);return r}const ix=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=ix(n[r]))&&(t&&(t+=" "),t+=e);return t};function MA(n,...e){let t,r,i,s=o;function o(l){const c=e.reduce((h,f)=>f(h),n());return t=yA(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=EA(l,t);return i(l,h),h}return function(){return s(bA.apply(null,arguments))}}const Sn=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},sx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ox=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wA=/^\d+\/\d+$/,TA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,AA=/\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$/,CA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,RA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,PA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ma=n=>wA.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=>TA.test(n),IA=()=>!0,LA=n=>AA.test(n)&&!CA.test(n),ax=()=>!1,OA=n=>RA.test(n),qA=n=>PA.test(n),DA=n=>!et(n)&&!tt(n),NA=n=>ga(n,fx,ax),et=n=>sx.test(n),oo=n=>ga(n,dx,LA),Qp=n=>ga(n,BA,vt),lx=n=>ga(n,ux,ax),UA=n=>ga(n,hx,qA),Bu=n=>ga(n,px,OA),tt=n=>ox.test(n),Il=n=>_a(n,dx),FA=n=>_a(n,VA),cx=n=>_a(n,ux),zA=n=>_a(n,fx),kA=n=>_a(n,hx),Vu=n=>_a(n,px,!0),ga=(n,e,t)=>{const r=sx.exec(n);return r?r[1]?e(r[1]):t(r[2]):!1},_a=(n,e,t=!1)=>{const r=ox.exec(n);return r?r[1]?e(r[1]):t:!1},ux=n=>n==="position"||n==="percentage",hx=n=>n==="image"||n==="url",fx=n=>n==="length"||n==="size"||n==="bg-size",dx=n=>n==="length",BA=n=>n==="number",VA=n=>n==="family-name",px=n=>n==="shadow",HA=MA(()=>{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(),cx,lx,{position:[tt,et]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",zA,NA,{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,cx,lx],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:[IA],container:[Ki],"drop-shadow":[Ki],ease:["in","out","in-out"],font:[DA],"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:[FA,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]},kA,UA]}],"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 Ti(...n){return HA(uA(n))}const mx=({children:n,name:e,...t})=>{const[r,i]=se.useState(t.opened||!1);return R.jsxs("div",{className:"select-none",style:{borderBottom:"1px solid #5e5e5e"},children:[R.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?R.jsx(M8,{size:16}):R.jsx(w8,{size:16}),R.jsx("span",{className:"text-sm leading-none",children:e})]}),R.jsx("div",{className:Ti("text-[11px] text-[#EBEBEB] border border-[#222222] bg-[#424242]",r?"block":"hidden"),children:n})]})};function ti({children:n,style:e,className:t,...r}){return R.jsx("label",{className:Ti("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 R.jsxs("div",{className:"relative w-full",children:[R.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}),R.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-dark-blue",style:{transition:"all 0.1s linear",visibility:m?"visible":"hidden",opacity:m?"1":"0"},children:R.jsx(F8,{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 Ll(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(...Ll(i))})}),new Error(`Unsupported unit ${e}, use one of: ${t.join(", ")}`)}possibilities(e){const t=[];if(!this.origin&&!e)Lr(Ll(Ms),r=>{Lr(Ms[r],(i,s)=>{s!=="_anchors"&&t.push(...Ll(i))})});else{const r=e||this.origin.measure;Lr(Ms[r],(i,s)=>{s!=="_anchors"&&t.push(...Ll(i))})}return t}measures(){return Ll(Ms)}}function ni(n){return new b7(n)}const M7={fontSize:"13px",WebkitAppearance:"none"};function em({children:n,style:e,...t}){return R.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}=Ht(),a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||hi,{hook:h,label:f,...p}=r,d=(m,x)=>{let v=Jn(m),_=n.merge({length:x!==hi?ni(v).from(x).to(hi):v,_length:m,_unit:x});return h?h(_,i,s,o).then(b=>e(b)):e(_)};return R.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[R.jsx(ti,{children:f}),R.jsxs("div",{className:"w-full flex",children:[R.jsx(Zi,{value:l,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},onChange:m=>d(m.target.value,c),onValid:t,...p}),R.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:R.jsx(em,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>d(l,m.target.value),children:Y0.map(m=>R.jsx("option",{value:m,children:m},m))})})]})]})},Ol=({style:n,...e})=>R.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}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyString w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(Ol,{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 R.jsxs("div",{children:[R.jsx(w7,{value:i,onUpdate:a=>t("name",a),configs:{label:"Nome"},...r}),R.jsx(tm,{value:s,onUpdate:a=>t("offsetA",a),configs:{label:"Offset 1",min:0,max:1/0,precision:2},...r}),R.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 R.jsx("table",{className:"w-full",children:R.jsxs("tbody",{children:[R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"Name"}),R.jsx("td",{children:R.jsx(Ol,{value:i,onChange:l=>e("name",l.target.value),style:{textAlign:"left"}})})]}),R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"X"}),R.jsx("td",{children:R.jsx(Zi,{value:s,onChange:l=>e("x",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"Y"}),R.jsx("td",{children:R.jsx(Zi,{value:o,onChange:l=>e("y",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"Rotation"}),R.jsx("td",{children:R.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 R.jsxs("div",{children:[R.jsxs("div",{className:"w-full mb-2",children:[R.jsx(ti,{children:"Name"}),R.jsx(Ol,{value:r,onChange:s=>e("name",s.target.value),style:{textAlign:"left"}})]}),R.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"?R.jsx(A7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):n.prototype==="lines"?R.jsx(C7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):n.prototype==="holes"?R.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}=Ht(),[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 R.jsxs("div",{children:[R.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 R.jsx(M,{propertyName:x,value:_,configs:b,onUpdate:E=>m(x,E),state:r,sourceElement:n,internalState:{attributesFormData:l,propertiesFormData:h}},x)})]})},O7=()=>R.jsx("div",{className:"h-full flex flex-col gap-4 justify-center items-center",children:R.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,Fr,cr,ur,wr,zr,kr,Br,Vr,qi,nf,rf],D7=({catalog:n})=>{const{planner:e}=Ht(),{scene:t,mode:r}=e;return q7.includes(r)?t.layers.valueSeq().flatMap(s=>mn().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>({element:o,layer:s}))).toArray().length===0?R.jsx(O7,{}):R.jsx("div",{children:t.layers.valueSeq().map(s=>mn().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>R.jsx(mx,{name:"Properties",opened:!0,children:R.jsx("div",{style:{padding:"5px 15px"},children:R.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:Fr,MODE_DRAWING_LINE:cr,MODE_DRAWING_HOLE:ur,MODE_DRAWING_ITEM:wr,MODE_DRAGGING_LINE:zr,MODE_DRAGGING_VERTEX:kr,MODE_DRAGGING_ITEM:Br,MODE_DRAGGING_HOLE:Vr,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}=Ht(),{mode:o}=e;if(!n||!N7[o])return null;const a=e.getIn(["scene","groups",n]),l=a.get("elements");return R.jsx(mx,{name:`Group [${a.get("name")}]`,opened:!0,children:R.jsxs("div",{style:{padding:"5px 15px"},children:[R.jsx("table",{style:U7,children:R.jsxs("tbody",{children:[R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"Name"}),R.jsx("td",{children:R.jsx(Ol,{value:a.get("name"),onChange:c=>t(n,Pe({name:c.target.value})),style:Gu})})]}),R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"X"}),R.jsx("td",{children:R.jsx(Zi,{value:a.get("x"),onChange:c=>r(n,c.target.value,a.get("y")),style:Gu,precision:2})})]}),R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"Y"}),R.jsx("td",{children:R.jsx(Zi,{value:a.get("y"),onChange:c=>r(n,a.get("x"),c.target.value),style:Gu,precision:2})})]}),R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"Rotation"}),R.jsx("td",{children:R.jsx(Zi,{value:a.get("rotation"),onChange:c=>i(n,c.target.value),style:Gu,precision:2})})]})]})}),l.size?R.jsxs("div",{children:[R.jsx("p",{style:{textAlign:"center",borderBottom:"1px solid #555",paddingBottom:"1em"},children:"Group's Elements"}),R.jsxs("table",{style:z7,children:[R.jsx("thead",{children:R.jsxs("tr",{children:[R.jsx("th",{style:vx}),R.jsx("th",{children:"Layer"}),R.jsx("th",{children:"Prototype"}),R.jsx("th",{children:"Name"})]})}),R.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 R.jsxs("tr",{children:[R.jsx("td",{style:vx,title:"Un-chain Element from Group",children:R.jsx(R8,{onClick:()=>s(n,c,f,d),style:F7})}),R.jsx("td",{style:{textAlign:"center"},children:c}),R.jsx("td",{style:{textAlign:"center",textTransform:"capitalize"},children:f}),R.jsx("td",{style:{textAlign:"center"},children:m.name})]},d)})))})]})]}):null]})})},B7=({catalog:n,width:e=280})=>{const{planner:t}=Ht(),r=t.getIn(["scene","selectedLayer"]),i=t.getIn(["scene","layers",r,"selected"]),s=t.getIn(["scene","groups"]).findEntry(a=>a.get("selected")),o=i.lines.size>1||i.items.size>1||i.holes.size>1||i.areas.size>1||i.lines.size+i.items.size+i.holes.size+i.areas.size>1;return R.jsxs("aside",{onKeyDown:a=>a.stopPropagation(),onKeyUp:a=>a.stopPropagation(),className:"floor_planner-sidebar bg-[#424242] h-full block overflow-y-auto overflow-x-hidden pb-5",style:{width:e},children:[!o&&R.jsx(D7,{catalog:n}),!!s&&R.jsx(k7,{groupID:s?s[0]:null})]})},Or=({active:n,tooltip:e,onClick:t,children:r,className:i})=>{const[s,o]=se.useState(!1),a=n||s?"text-dark-blue":"text-[#C2C2C2]",l=c=>{t(c),o(!1)};return R.jsxs("div",{className:Ti("w-[30px] h-[30px] flex items-center justify-center text-[25px] relative cursor-pointer",i),onClick:l,onMouseOver:()=>o(!0),onMouseOut:()=>o(!1),children:[R.jsx("div",{className:a,onClick:l,children:r}),s&&R.jsxs("div",{onClick:c=>{c.preventDefault(),c.stopPropagation()},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:[R.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 yn({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)?R.jsx(Or,{active:!1,tooltip:"Get Screenshot",onClick:e,children:R.jsx(yx,{size:28})}):[rn,qs,Ds,Ns,Fr,zr,kr,Br,cr,ur,wr,Vr,qi].includes(n)?R.jsx(Or,{active:!1,tooltip:"Get Screenshot",onClick:t,children:R.jsx(yx,{size:28})}):null}function H7(n){return yn({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 R.jsxs("div",{className:"color-field flex-1 flex pr-3 mt-1 cursor-pointer",children:[R.jsx("div",{className:"colorBox relative w-[22px] h-[22px]",style:{background:e.value},onClick:()=>{i.current&&i.current.click()},children:R.jsx("input",{ref:i,type:"color",onChange:s,value:e.value,className:"absolute invisible h-full w-full"})}),R.jsx("div",{className:"flex-1 pl-2",children:R.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}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyColor w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.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}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyEnum w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(em,{value:n,onChange:a=>o(a.target.value),children:mn(t.values).entrySeq().map(([a,l])=>R.jsx("option",{value:a,children:l},a))})]})}function Mx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Ht();let o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyString w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(Ol,{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}=Ht(),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 R.jsxs("div",{className:"PropertyNumber w-full mb-2",children:[R.jsx(ti,{children:r.label}),R.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}=Ht();let a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||hi,{hook:h,label:f,...p}=r;const d=(m,x)=>{let v=Jn(m),_=n.merge({length:x!==hi?ni(v).from(x).to(hi):v,_length:m,_unit:x});return h?h(_,i,s,o).then(b=>e(b)):e(_)};return R.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[R.jsx(ti,{children:f}),R.jsxs("div",{className:"w-full flex",children:[R.jsx(Zi,{value:l,onChange:m=>d(m.target.value,c),onValid:t,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},...p}),R.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:R.jsx(em,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>d(l,m.target.value),children:Y0.map(m=>R.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 R.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}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsx("table",{className:"PropertyToggle",style:Wu.tableStyle,children:R.jsx("tbody",{children:R.jsxs("tr",{children:[R.jsx("td",{style:Wu.firstTdStyle,children:R.jsx(ti,{children:t.label})}),R.jsx("td",{children:R.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}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyCheckbox w-full flex items-center gap-2 mb-2",children:[R.jsx("input",{className:"m-0 mt-0.5",type:"checkbox",checked:n,onChange:()=>o(!n)}),R.jsx(ti,{className:"mb-0",children:t.label})]})}function Rx(){return null}function Px({value:n,configs:e}){return R.jsx("table",{className:"PropertyReadOnly",style:Wu.tableStyle,children:R.jsx("tbody",{children:R.jsxs("tr",{children:[R.jsx("td",{style:Wu.firstTdStyle,children:R.jsx(ti,{children:e.label})}),R.jsx("td",{children:R.jsx("div",{children:n})})]})})})}class X7{constructor(e=hi){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 yn({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 R.jsxs("div",{className:Ti(`relative w-full ${t?"mt-1":"mt-2"}`,a),onClick:r??(()=>!1),children:[R.jsx("span",{className:`absolute left-0 top-2 text-[#637381] ${t?"":"ml-2"}`,style:{zIndex:2},children:R.jsx($7,{size:18})}),i?R.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}):R.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&&R.jsx("span",{className:`absolute right-2 top-1/2 -translate-y-1/2 ${t?"":"ml-2"}`,style:{zIndex:1},children:R.jsx(C8,{className:"-mb-1"})})]})},Ix=0,Lx=58,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 R.jsxs(R.Fragment,{children:[R.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=>R.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)&&R.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}=Ht(),[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 R.jsxs(R.Fragment,{children:[e&&R.jsx("div",{className:"fixed inset-0 bg-black/30 z-10",onClick:b}),R.jsxs("div",{style:e&&e.rect?{top:e.rect.y+Ix,left:e.rect.x+Lx}:_.current?_.current:{},className:Ti("fixed select-none z-10 shadow-md !gap-0 rounded-lg pt-4 fp_side-bar !min-h-[250px] !min-w-[330px] max-w-[330px] !max-h-[510px] transition-all duration-200 ease-out transform",e?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),children:[R.jsxs("header",{className:"px-[18px] sticky top-0 left-0 gap-3 flex flex-col",children:[R.jsx("div",{className:"flex items-center gap-1",children:R.jsx("span",{className:Ti("flex flex-col gap-0.5"),children:R.jsx("span",{className:"fp-sidebar-label capitalize",children:(e==null?void 0:e.page)??v.current})})}),R.jsxs("div",{className:Ti("fp-highlight"),children:[R.jsx(Ox,{options:l,level:0,selections:h,onChange:E}),R.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?R.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=>R.jsxs("div",{className:"w-full space-y-1.5",children:[R.jsx("div",{className:"fp-aspect-ratio-container",children:R.jsx("div",{className:"fp-aspect-ratio-content",onMouseDown:()=>M(S),children:R.jsx("img",{draggable:!1,className:"fp-item-image",alt:S.info.title,src:S.info.image})})}),R.jsx("p",{className:"text-xs font-semibold capitalize",children:S.info.description})]},S.name.replace(/\s+/g,"_")))}):R.jsx("div",{className:"min-h-28 w-full flex items-center justify-center",children:R.jsx("p",{className:"text-sm font-medium text-gray-400 text-center",children:"No records found"})})]})]})};function J7(n){return yn({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 yn({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})=>R.jsx("p",{style:{...qx,...n},children:"2D"}),tC=({style:n})=>R.jsx("p",{style:{...qx,...n},children:"3D"});function nC({catalog:n,has3dView:e}){const{planner:t,setMode:r,setToast:i,selectTool3DView:s,unselectAll:o,selectToolDrawingLine:a}=Ht(),{mode:l,alterate:c}=t,[h,f]=se.useState(null);return R.jsxs(R.Fragment,{children:[R.jsxs("aside",{className:"floor_planner-toolbar -mt-[30px] absolute left-2 !pt-3 top-1/2 -translate-y-1/2 z-[1] rounded max-h-full max-w-[50px] p-2.5 space-y-4 bg-[#2b2b2b]",children:[R.jsx(Or,{active:[Fr,cr].includes(l),tooltip:"Draw wall",onClick:()=>{i({text:"Cancel drawing"}),a("wall")},children:R.jsx(H7,{})}),R.jsx(Or,{active:!!([ur].includes(l)&&h&&h.page==="windows"),tooltip:"Place windows",onClick:p=>{f({rect:(p.currentTarget.parentElement??p.currentTarget).getBoundingClientRect(),page:"windows"})},children:R.jsx(V8,{size:26})}),R.jsx(Or,{active:!!([ur].includes(l)&&h&&h.page==="doors"),tooltip:"Place doors",onClick:p=>{f({rect:(p.currentTarget.parentElement??p.currentTarget).getBoundingClientRect(),page:"doors"})},children:R.jsx(J7,{size:26})}),R.jsx(Or,{active:!!([wr].includes(l)&&h&&h.page==="objects"),tooltip:"Place objects",onClick:p=>{f({rect:(p.currentTarget.parentElement??p.currentTarget).getBoundingClientRect(),page:"objects"})},children:R.jsx(Q7,{size:26})}),e?[Oi].includes(l)?R.jsx(Or,{active:[rn].includes(l),tooltip:"2D View",onClick:()=>{o(),setTimeout(()=>{r(rn)},0)},children:R.jsx(eC,{style:{color:c?"#FF9800":""}})}):R.jsx(Or,{active:[Oi].includes(l),tooltip:"3D View",onClick:s,children:R.jsx(tC,{})}):null,R.jsx(V7,{mode:l})]}),R.jsx(Z7,{catalog:n,popupEvent:h,onClose:()=>f(null)})]})}const ql=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&&ql){if(r){t.setPlan(r);const o=r.floors[0].floorDesign;s=JSON.parse(o)}else if(ql.getItem(n)!==null){const o=ql.getItem(n);s=JSON.parse(o)}s&&t.loadProject(s),Ht.subscribe(o=>{nm&&clearTimeout(nm),nm=setTimeout(()=>{const a=ql.getItem(n),l=Ot.unselectAll(o.planner).updatedState,c=JSON.stringify(l.scene.toJS());if(a!==c&&(ql.setItem(n,c),o.plan))try{const h=o.plan.floors[o.activeFloor];i&&i({floor:{floorID:h.floorID,title:h.floorTitle,description:h.floorDescription,design:c}})}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 Dx=38,Nx=-220,Dl=({title:n,toggleState:e,toggleOn:t,toggleOff:r})=>{const[i,s]=se.useState(e||!1),o=()=>{s(!i),i?r():t()};return R.jsxs("div",{className:"flex items-center",children:[R.jsx("div",{className:"fp__onoffswitch",onClick:o,children:R.jsxs("div",{className:Ti("fp__onoffswitch_label",i?"fp__onoffswitch_label-checked":""),children:[R.jsx("span",{className:"fp__onoffswitch_inner"}),R.jsx("span",{className:"fp__onoffswitch_switch"})]})}),R.jsx("div",{className:"fp__onoffswitch_caption",children:n})]})},oC=({popupEvent:n,onClose:e})=>{const{planner:t,toggleSnap:r}=Ht(),{snapMask:i}=t,s=se.useRef(null);se.useEffect(()=>{if(n){const{x:l,y:c}=n.rect;s.current={top:c+Dx,left:l+Nx}}},[n]);const o=()=>{e()},a=l=>r(i.merge(l));return R.jsxs(R.Fragment,{children:[n&&R.jsx("div",{className:"fixed inset-0 bg-black/30 z-10",onClick:o}),R.jsxs("div",{style:n&&n.rect?{top:n.rect.y+Dx,left:n.rect.x+Nx}:s.current?s.current:{},id:"headerbar-popup",className:Ti("fixed select-none z-10 shadow-md !gap-0 rounded-lg pt-4 fp_side-bar !min-h-[200px] !min-w-[250px] max-w-[250px] !max-h-[300px] transition-all duration-200 ease-out transform",n?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),children:[R.jsx("header",{className:"px-[18px] sticky top-0 left-0 gap-3 flex flex-col",children:R.jsx("div",{className:"flex items-center gap-1",children:R.jsx("span",{className:Ti("flex flex-col gap-0.5"),children:R.jsx("span",{className:"fp-sidebar-label capitalize",children:"Settings"})})})}),R.jsxs("div",{className:"min-h-28 w-full space-y-2.5 px-2 py-4",children:[R.jsx(Dl,{title:"Snap to Point",toggleState:i.get(uf),toggleOn:()=>{a({SNAP_POINT:!0})},toggleOff:()=>{a({SNAP_POINT:!1})}}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_LINE:!0})},toggleOff:()=>{a({SNAP_LINE:!1})},toggleState:i.get(hf),title:"Snap to Line"}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_SEGMENT:!0})},toggleOff:()=>{a({SNAP_SEGMENT:!1})},toggleState:i.get(ff),title:"Snap to Segment"}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_GRID:!0})},toggleOff:()=>{a({SNAP_GRID:!1})},toggleState:i.get(df),title:"Snap to Grid"}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_GUIDE:!0})},toggleOff:()=>{a({SNAP_GUIDE:!1})},toggleState:i.get(J0),title:"Snap to Guide"})]})]})]})},aC=({onBack:n,onSave:e})=>{const{undo:t,redo:r,plan:i,setPlan:s}=Ht(),[o,a]=se.useState(!1),[l,c]=se.useState(null),h=()=>{a(!0)},f=p=>{if(!i)return;a(!1);const d=p.target.value.trim();if(d&&d!==(i==null?void 0:i.planTitle)){s({...i,planTitle:d});try{e&&e({title:d,description:""})}catch{}}};return R.jsxs(R.Fragment,{children:[R.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:[R.jsx(Or,{className:"border border-white rounded -ml-1",active:!1,tooltip:"Go Back",onClick:()=>{n&&n()},children:R.jsx(Yv,{})}),R.jsx("div",{className:"flex flex-col items-center justify-center",children:o?R.jsx("input",{autoFocus:!0,type:"text",defaultValue:i==null?void 0:i.planTitle,onBlur:f,onKeyDown:p=>{(p.key==="Enter"||p.key==="Escape")&&f(p)},className:"bg-transparent border-b border-gray-400 outline-none text-lg text-center"}):R.jsx("span",{onDoubleClick:h,className:"projectName__fp text-lg",title:(i==null?void 0:i.planTitle)??"Example House",children:(i==null?void 0:i.planTitle)??"Example House"})}),R.jsxs("div",{className:"flex items-center gap-2 relative",children:[R.jsx(Or,{active:!1,tooltip:"Undo (CTRL-Z)",onClick:t,children:R.jsx(k8,{})}),R.jsx(Or,{active:!1,tooltip:"Redo (CTRL-SHIFT-Z)",onClick:r,children:R.jsx(z8,{})}),R.jsx("div",{className:"ml-8",children:R.jsx(Or,{active:!1,tooltip:"Settings",onClick:p=>{c({rect:p.currentTarget.getBoundingClientRect()})},children:R.jsx(T8,{size:17})})})]})]}),R.jsx(oC,{popupEvent:l,onClose:()=>c(null)})]})};var rm={exports:{}},Ux;function Fx(){if(Ux)return rm.exports;Ux=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,zx;function lC(){return zx||(zx=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,kx;function cC(){return kx||(kx=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,Bx;function uC(){return Bx||(Bx=1,om=function(){var n=1;function e(){return n++}return{generate:e}}),om}var am,Vx;function hC(){return Vx||(Vx=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,Hx;function fC(){return Hx||(Hx=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:{}},Gx;function Wx(){if(Gx)return cm.exports;Gx=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:{}},jx;function dC(){if(jx)return um.exports;jx=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,Xx;function pC(){if(Xx)return hm;Xx=1;var n=dC();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,$x;function mC(){if($x)return fm;$x=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,Yx;function gC(){if(Yx)return dm;Yx=1;var n=Wx();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,Kx;function _C(){if(Kx)return pm;Kx=1;var n=Fx().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. */
|
|
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 M6(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 qt;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 w6(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 qt;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 T6(n){const e=new qt;e.name="grid",new x6().parse(b6);const{grids:r,width:i,height:s}=n;return r.forEach(o=>{switch(o.type){case"horizontal-streak":e.add(M6(i,s,o));break;case"vertical-streak":e.add(w6(i,s,o));break}}),e.position.y=-1,e}function A6(n){n&&n.dispose&&n.dispose()}function C6(n){n&&n.dispose&&n.dispose()}function Dv(n){if(n){if(Array.isArray(n)){n.forEach(e=>Dv(e));return}for(const e in n){const t=n[e];t instanceof Dn&&C6(t)}n.dispose()}}function Nv(n){(n instanceof _n||n instanceof d4||n instanceof vl)&&(A6(n.geometry),Dv(n.material),n.geometry=null,n.material=null)}function R6(n){n.traverse(e=>{Nv(e)})}function Ou(n){n.traverse(e=>{Nv(e)})}function P6(n,e,t){const r={sceneGraph:{unit:n.unit,layers:{},busyResources:{layers:{}},width:n.width,height:n.height,LODs:{}},plan:new qt,grid:T6(n),boundingBox:new bi};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 I6(n,e,t,r,i,s){const o=r.map(l=>({op:l.op,path:l.path.split("/"),value:l.value}));let a=z6(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")O6(c[2],n);else if(c.length>3)switch(l){case"replace":Cl(c,f,n,i,e,t,s);break;case"add":q6(c,f,n,i,e,t,s);break;case"remove":L6(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(D6(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(N6(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(U6(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(F6(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 L6(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 O6(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 q6(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 qt;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 bi().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 D6(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 qt;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 N6(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 qt;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 U6(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 qt;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 F6(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=>{console.log({child:t,instance:t instanceof _n,an:t.isMesh}),t instanceof _n&&(t.interact=e)})}function Uu(n,e){n.traverse(t=>{t instanceof _n&&(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 bi().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 z6(n,e,t){return k6(B6(V6(n)),e,t)}function k6(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 B6(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 V6(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 Uv={type:"change"},Gp={type:"start"},Fv={type:"end"},Fu=new ru,zv=new ys,H6=Math.cos(70*Vb.DEG2RAD),yn=new G,nr=2*Math.PI,zt={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 G6 extends m4{constructor(e,t=null){super(e,t),this.state=zt.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 rv,this._sphericalDelta=new rv,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=j6.bind(this),this._onPointerDown=W6.bind(this),this._onPointerUp=X6.bind(this),this._onContextMenu=e8.bind(this),this._onMouseWheel=K6.bind(this),this._onKeyDown=Z6.bind(this),this._onTouchStart=J6.bind(this),this._onTouchMove=Q6.bind(this),this._onMouseDown=$6.bind(this),this._onMouseMove=Y6.bind(this),this._interceptControlDown=t8.bind(this),this._interceptControlUp=n8.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(Uv),this.update(),this.state=zt.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===zt.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))<H6?this.object.lookAt(this.target):(zv.setFromNormalAndCoplanarPoint(this.object.up,this.target),Fu.intersectPlane(zv,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(Uv),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 W6(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 j6(n){this.enabled!==!1&&(n.pointerType==="touch"?this._onTouchMove(n):this._onMouseMove(n))}function X6(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(Fv),this.state=zt.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 $6(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=zt.DOLLY;break;case qo.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=zt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=zt.ROTATE}break;case qo.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=zt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=zt.PAN}break;default:this.state=zt.NONE}this.state!==zt.NONE&&this.dispatchEvent(Gp)}function Y6(n){switch(this.state){case zt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(n);break;case zt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(n);break;case zt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(n);break}}function K6(n){this.enabled===!1||this.enableZoom===!1||this.state!==zt.NONE||(n.preventDefault(),this.dispatchEvent(Gp),this._handleMouseWheel(this._customWheelEvent(n)),this.dispatchEvent(Fv))}function Z6(n){this.enabled!==!1&&this._handleKeyDown(n)}function J6(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=zt.TOUCH_ROTATE;break;case Do.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(n),this.state=zt.TOUCH_PAN;break;default:this.state=zt.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=zt.TOUCH_DOLLY_PAN;break;case Do.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(n),this.state=zt.TOUCH_DOLLY_ROTATE;break;default:this.state=zt.NONE}break;default:this.state=zt.NONE}this.state!==zt.NONE&&this.dispatchEvent(Gp)}function Q6(n){switch(this._trackPointer(n),this.state){case zt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(n),this.update();break;case zt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(n),this.update();break;case zt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(n),this.update();break;case zt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(n),this.update();break;default:this.state=zt.NONE}}function e8(n){this.enabled!==!1&&n.preventDefault()}function t8(n){n.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function n8(n){n.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const fa=n=>Bt(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},r8=(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}),i8=mt({op:"!=",val:null,newVal:null}),s8=(n,e)=>{const t=o8(n,e);return a8(t,n,e,n.size??0,e.size??0)},o8=(n,e)=>{const t=n.size??0,r=e.size??0,i=r8(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},a8=(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 i8({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()},l8=/\//g,c8=/~/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(c8,"~0").replace(l8,"~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(kv(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},kv=(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=s8(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},u8=(n,e,t="")=>n===e?[]:[Yi("replace",vr(t,""),e)],h8=(n,e,t="")=>Kt(n,e)?Xe():n!=e&&(n==null||e==null)?At([Yi("replace","/",e)]):da(n)&&da(e)?At(kv(n,e)):pa(n)&&pa(e)?At(Xp(n,e)):fa(n)&&fa(e)?At(Pl(n,e)):At(u8(n,e,t));class f8 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",null);ut(this,"planData");ut(this,"renderingID",0);ut(this,"width");ut(this,"height");ut(this,"lastMousePosition",{});ut(this,"mouseDownEvent");ut(this,"mouseUpEvent");this.width=t.width,this.height=t.height,this.renderer=new v6({preserveDrawingBuffer:!0,antialias:!0})}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 mM;this.renderer.setSize(this.width,this.height),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.outputColorSpace=pr,this.renderer.useLegacyLights=!1,this.renderer.setClearColor(new St(Fc.white));const l=P6(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.set(0,1,0);const m=new l4(Fc.white,.3);m.position.set(f,p,d),a.add(m),a.add(new ev(11513775)),a.add(new ev(16777215,.7));const x=new u4(16777215,.6);x.position.set(100,200,100),x.castShadow=!0,a.add(x);const v=[l.plan],_=new Fe,b=new f4;this.mouseDownEvent=T=>{this.lastMousePosition.x=T.offsetX/this.width*2-1,this.lastMousePosition.y=-T.offsetY/this.height*2+1},this.mouseUpEvent=T=>{var q,O;if(T.preventDefault(),_.x=T.offsetX/this.width*2-1,_.y=-(T.offsetY/this.height)*2+1,Math.abs(_.x-(this.lastMousePosition.x??0))<=.02&&Math.abs(_.y-(this.lastMousePosition.y??0))<=.02){b.setFromCamera(_,h);const A=b.intersectObjects(v,!0);A.length>0&&!isNaN(A[0].distance)?(O=(q=A[0].object).interact)==null||O.call(q):this.props.actions.projectActions.unselectAll()}},this.renderer.domElement.addEventListener("mousedown",this.mouseDownEvent),this.renderer.domElement.addEventListener("mouseup",this.mouseUpEvent),o&&o.appendChild(this.renderer.domElement);const M=new G6(h,this.renderer.domElement);M.enableDamping=!0,M.dampingFactor=.05;const E=new qt;E.name="spotLightTarget",E.position.copy(M.target),a.add(E),m.target=E;const S=()=>{M.update(),m.position.copy(h.position),E.position.copy(M.target);for(const T in l.sceneGraph.LODs)l.sceneGraph.LODs[T].update(h);this.renderer.render(a,h),this.renderingID=requestAnimationFrame(S)};S(),this.orbitControls=M,this.camera=h,this.scene3D=a,this.planData=l}componentWillUnmount(){var t;cancelAnimationFrame(this.renderingID),(t=this.orbitControls)==null||t.dispose(),this.renderer.domElement.removeEventListener("mousedown",this.mouseDownEvent),this.renderer.domElement.removeEventListener("mouseup",this.mouseUpEvent),this.scene3D&&(R6(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()}componentDidUpdate(t){const{width:r,height:i}=this.props;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 s=h8(t.state.scene,this.props.state.scene),o={areaActions:this.props.actions.areaActions,holesActions:this.props.actions.holesActions,itemsActions:this.props.actions.itemsActions,linesActions:this.props.actions.linesActions,projectActions:this.props.actions.projectActions};I6(this.planData,this.props.state.scene,t.state.scene,s.toJS(),o,this.props.catalog)}this.renderer.setSize(r,i)}render(){return se.createElement("div",{ref:this.canvasWrapperRef})}}const d8={color:Ut.PRIMARY_COLOR.alt,fontWeight:300};function p8({children:n,style:e={},...t}){return R.jsx("h1",{style:{...d8,...e},...t,children:n})}const m8={padding:"0 20px",overflowY:"auto"};function g8({children:n,width:e,height:t,style:r={}}){return R.jsx("div",{style:{width:e,height:t,...m8,...r},onWheel:i=>i.stopPropagation(),children:n})}var Bv={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Vv=se.createContext&&se.createContext(Bv),_8=["attr","size","title"];function v8(n,e){if(n==null)return{};var t=x8(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 x8(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 Hv(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?Hv(Object(t),!0).forEach(function(r){y8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Hv(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function y8(n,e,t){return e=S8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function S8(n){var e=E8(n,"string");return typeof e=="symbol"?e:e+""}function E8(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 Gv(n){return n&&n.map((e,t)=>se.createElement(e.tag,ku({key:t},e.attr),Gv(e.child)))}function Sn(n){return e=>se.createElement(b8,zu({attr:ku({},n.attr)},e),Gv(n.child))}function b8(n){var e=t=>{var{attr:r,size:i,title:s}=n,o=v8(n,_8),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 Vv!==void 0?se.createElement(Vv.Consumer,null,t=>e(t)):e(Bv)}function M8(n){return Sn({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 w8(n){return Sn({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 T8(n){return Sn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"},child:[]}]})(n)}function A8(n){return Sn({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 C8(n){return Sn({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 R8(n){return Sn({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 Wv={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"},P8={...Wv,background:Ut.SECONDARY_COLOR.main},jv={width:"100%",textAlign:"center",display:"block",marginBottom:".5em",textTransform:"capitalize"},I8={...jv,color:Ut.COLORS.white},L8={width:"100%",height:"8em",position:"relative",overflow:"hidden",border:"solid 1px #e6e6e6",padding:0,margin:0,marginBottom:"5px"},Xv={position:"absolute",background:"#222",width:"100%",height:"100%",backgroundSize:"contain",backgroundPosition:"50% 50%",backgroundColor:Ut.COLORS.white,backgroundRepeat:"no-repeat",transition:"all .2s ease-in-out"},O8={...Xv,transform:"scale(1.2)"},q8={marginTop:"1.5em",color:Ut.SECONDARY_COLOR.main,fontSize:"2em",opacity:"0.7",width:"100%"},D8={display:"block",height:"2em",margin:"0 auto",fontSize:"0.75em",fontStyle:"italic",lineHeight:"1em",WebkitLineClamp:"2",WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"},N8={listStyle:"none",margin:"0px",padding:"0px",fontSize:"11px",marginBottom:"3px"},U8={display:"inline-block",background:"#337ab7",color:Ut.COLORS.white,padding:"1px 4px",marginRight:"3px",borderRadius:"3px"},$v=({element:n})=>{const[e,t]=se.useState(!1),{selectToolDrawingLine:r,selectToolDrawingItem:i,selectToolDrawingHole:s,pushLastSelectedCatalogElementToHistory:o}=Ht(),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 R.jsxs("div",{style:e?P8:Wv,onClick:a,onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),children:[R.jsx("b",{style:e?I8:jv,children:n.info.title}),R.jsx("div",{style:L8,children:R.jsx("div",{style:{...e?O8:Xv,backgroundImage:"url("+n.info.image+")"},children:e?R.jsx(A8,{style:q8}):null})}),R.jsx("ul",{style:N8,children:n.info.tag.map((l,c)=>R.jsx("li",{style:U8,children:l},c))}),R.jsx("div",{style:D8,children:n.info.description})]})};function F8(n){return Sn({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 z8(n){return Sn({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 Sn({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 Sn({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 Yv(n){return Sn({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 Sn({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"},Kv={fontSize:"20px",cursor:"pointer"},G8={...Kv,fontWeight:"bolder",color:Ut.SECONDARY_COLOR.main},W8={fill:Ut.COLORS.black,fontSize:"24px",marginLeft:"10px",marginRight:"10px"},j8=({names:n})=>{let e=n.map((t,r)=>{let i=r===n.length-1;return R.jsxs("div",{style:{display:"flex"},children:[R.jsx("div",{style:i?G8:Kv,onClick:t.action||null,children:t.name}),i?null:R.jsx(Yv,{style:W8})]},r)});return R.jsx("div",{style:H8,children:e})},Zv={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={...Zv,background:Ut.SECONDARY_COLOR.main},Jv={position:"absolute",color:Ut.COLORS.black,fontSize:"5em",width:"100%"},$8={...Jv,color:Ut.SECONDARY_COLOR.main},Y8={background:Ut.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}=Ht(),i=s=>{r(s)};return R.jsx("div",{style:e?X8:Zv,onClick:()=>i(n.name),onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),children:R.jsx("div",{style:Y8,children:R.jsx(B8,{style:e?$8:Jv})})})},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"},Qv={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={...Qv,padding:"0.2em 0.625em"},nA={width:"auto",height:"2em",lineHeight:"2em",textAlign:"center",borderRadius:"1em",display:"inline-block",cursor:"pointer",backgroundColor:Ut.PRIMARY_COLOR.alt,color:Ut.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}=Ht();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:""}),_=R.jsx(j8,{names:A})}let b=i.catalog.path.size,M=b>0?R.jsx(K8,{page:r.categories[i.catalog.path.get(b-1)]},b):null,E=i.get("selectedElementsHistory"),S=E.map((A,L)=>R.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 R.jsxs(g8,{width:n,height:e,style:{...Z8,...t},children:[R.jsx(p8,{children:"Catalog"}),_,R.jsxs("div",{style:Qv,children:[R.jsx("span",{style:Q8,children:"Search Element"}),R.jsx("input",{type:"text",style:eA,onChange:A=>{q(A.target.value)}})]}),E.size?R.jsxs("div",{style:tA,children:[R.jsx("span",{children:"Last Selected"}),S]}):null,R.jsx("div",{style:J8,children:d===""?[M,p.map(A=>R.jsx($v,{element:A},A.name))]:x.map(A=>R.jsx($v,{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:Fr,MODE_DRAGGING_LINE:zr,MODE_DRAGGING_VERTEX:kr,MODE_DRAGGING_ITEM:Br,MODE_DRAWING_LINE:cr,MODE_DRAWING_HOLE:ur,MODE_DRAWING_ITEM:wr,MODE_DRAGGING_HOLE:Vr,MODE_ROTATING_ITEM:qi};function sA({width:n,height:e,catalog:t}){const r=Ht(),{planner:i}=r,{mode:s}=i;return s===Oi?R.jsx(f8,{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?R.jsx(R.Fragment,{}):s===sf?R.jsx(rA,{width:n,height:e,catalog:t}):iA[s]?R.jsx(QE,{width:n,height:e,catalog:t}):s===$0?R.jsx(R.Fragment,{}):null}function oA(n){return Sn({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 aA(n){return Sn({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)}const lA=(n,e,t,r,i)=>r+(i-r)*(n-e)/(t-e),cA=({sidebarWidth:n})=>{const{planner:e,viewer:t}=Ht(),{mode:r,mouse:i,zoom:s}=e,o=a=>{const l=parseInt(z1(s).toFixed());if(l===0&&a==="out"||l===100&&a==="in"||!t)return;const c=t==null?void 0:t.getValue(),h=c.viewerWidth/2,f=c.viewerHeight/2,p=a==="in"?-1:1,d=1.06,m=Math.max(-1,Math.min(1,p)),x=lA(m,-1,1,d,1/d);t.zoom(h,f,x)};if(of.includes(r))return R.jsx("div",{className:"floor_planner-footerbar absolute rounded-tl w-auto z-[9001] py-[3px] px-[1em] text-xs bg-[#2b2b2b] h-5 select-none cursor-default bottom-0 leading-[14px] text-white m-0",style:{right:n},children:R.jsx("div",{className:"relative float-left inline-block",title:"Scene Zoom Level",children:R.jsxs("div",{className:"flex items-center gap-2",children:[R.jsx(oA,{className:"inline-block cursor-pointer",size:16,onClick:()=>o("out")})," ",R.jsxs("span",{children:[z1(s).toFixed(),"%"]})," ",R.jsx(aA,{className:"inline-block cursor-pointer",size:16,onClick:()=>o("in")})]})})})};function ex(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=ex(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function uA(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=ex(n))&&(r&&(r+=" "),r+=e);return r}const $p="-",hA=n=>{const e=dA(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:o=>{const a=o.split($p);return a[0]===""&&a.length!==1&&a.shift(),tx(a,e)||fA(o)},getConflictingClassGroupIds:(o,a)=>{const l=t[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},tx=(n,e)=>{var o;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?tx(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},nx=/^\[(.+)\]$/,fA=n=>{if(nx.test(n)){const e=nx.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},dA=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:rx(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(pA(i)){Yp(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{Yp(o,rx(e,s),t,r)})})},rx=(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},pA=n=>n.isThemeGetter,mA=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=":",gA=Zp.length,_A=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+gA;continue}if(x==="/"){c=m;continue}}x==="["?o++:x==="]"?o--:x==="("?a++:x===")"&&a--}const h=s.length===0?i:i.substring(l),f=vA(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},vA=n=>n.endsWith(Kp)?n.substring(0,n.length-1):n.startsWith(Kp)?n.substring(1):n,xA=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}},yA=n=>({cache:mA(n.cacheSize),parseClassName:_A(n),sortModifiers:xA(n),...hA(n)}),SA=/\s+/,EA=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=n.trim().split(SA);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 bA(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=ix(e))&&(r&&(r+=" "),r+=t);return r}const ix=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=ix(n[r]))&&(t&&(t+=" "),t+=e);return t};function MA(n,...e){let t,r,i,s=o;function o(l){const c=e.reduce((h,f)=>f(h),n());return t=yA(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=EA(l,t);return i(l,h),h}return function(){return s(bA.apply(null,arguments))}}const En=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},sx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ox=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wA=/^\d+\/\d+$/,TA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,AA=/\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$/,CA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,RA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,PA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ma=n=>wA.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=>TA.test(n),IA=()=>!0,LA=n=>AA.test(n)&&!CA.test(n),ax=()=>!1,OA=n=>RA.test(n),qA=n=>PA.test(n),DA=n=>!et(n)&&!tt(n),NA=n=>ga(n,fx,ax),et=n=>sx.test(n),oo=n=>ga(n,dx,LA),Qp=n=>ga(n,BA,vt),lx=n=>ga(n,ux,ax),UA=n=>ga(n,hx,qA),Bu=n=>ga(n,px,OA),tt=n=>ox.test(n),Il=n=>_a(n,dx),FA=n=>_a(n,VA),cx=n=>_a(n,ux),zA=n=>_a(n,fx),kA=n=>_a(n,hx),Vu=n=>_a(n,px,!0),ga=(n,e,t)=>{const r=sx.exec(n);return r?r[1]?e(r[1]):t(r[2]):!1},_a=(n,e,t=!1)=>{const r=ox.exec(n);return r?r[1]?e(r[1]):t:!1},ux=n=>n==="position"||n==="percentage",hx=n=>n==="image"||n==="url",fx=n=>n==="length"||n==="size"||n==="bg-size",dx=n=>n==="length",BA=n=>n==="number",VA=n=>n==="family-name",px=n=>n==="shadow",HA=MA(()=>{const n=En("color"),e=En("font"),t=En("text"),r=En("font-weight"),i=En("tracking"),s=En("leading"),o=En("breakpoint"),a=En("container"),l=En("spacing"),c=En("radius"),h=En("shadow"),f=En("inset-shadow"),p=En("text-shadow"),d=En("drop-shadow"),m=En("blur"),x=En("perspective"),v=En("aspect"),_=En("ease"),b=En("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(),cx,lx,{position:[tt,et]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",zA,NA,{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,cx,lx],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:[IA],container:[Ki],"drop-shadow":[Ki],ease:["in","out","in-out"],font:[DA],"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:[FA,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]},kA,UA]}],"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 Ti(...n){return HA(uA(n))}const mx=({children:n,name:e,...t})=>{const[r,i]=se.useState(t.opened||!1);return R.jsxs("div",{className:"select-none",style:{borderBottom:"1px solid #5e5e5e"},children:[R.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?R.jsx(M8,{size:16}):R.jsx(w8,{size:16}),R.jsx("span",{className:"text-sm leading-none",children:e})]}),R.jsx("div",{className:Ti("text-[11px] text-[#EBEBEB] border border-[#222222] bg-[#424242]",r?"block":"hidden"),children:n})]})};function ti({children:n,style:e,className:t,...r}){return R.jsx("label",{className:Ti("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 R.jsxs("div",{className:"relative w-full",children:[R.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}),R.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-dark-blue",style:{transition:"all 0.1s linear",visibility:m?"visible":"hidden",opacity:m?"1":"0"},children:R.jsx(F8,{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 Ll(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(...Ll(i))})}),new Error(`Unsupported unit ${e}, use one of: ${t.join(", ")}`)}possibilities(e){const t=[];if(!this.origin&&!e)Lr(Ll(Ms),r=>{Lr(Ms[r],(i,s)=>{s!=="_anchors"&&t.push(...Ll(i))})});else{const r=e||this.origin.measure;Lr(Ms[r],(i,s)=>{s!=="_anchors"&&t.push(...Ll(i))})}return t}measures(){return Ll(Ms)}}function ni(n){return new b7(n)}const M7={fontSize:"13px",WebkitAppearance:"none"};function em({children:n,style:e,...t}){return R.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}=Ht(),a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||hi,{hook:h,label:f,...p}=r,d=(m,x)=>{let v=Jn(m),_=n.merge({length:x!==hi?ni(v).from(x).to(hi):v,_length:m,_unit:x});return h?h(_,i,s,o).then(b=>e(b)):e(_)};return R.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[R.jsx(ti,{children:f}),R.jsxs("div",{className:"w-full flex",children:[R.jsx(Zi,{value:l,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},onChange:m=>d(m.target.value,c),onValid:t,...p}),R.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:R.jsx(em,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>d(l,m.target.value),children:Y0.map(m=>R.jsx("option",{value:m,children:m},m))})})]})]})},Ol=({style:n,...e})=>R.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}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyString w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(Ol,{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 R.jsxs("div",{children:[R.jsx(w7,{value:i,onUpdate:a=>t("name",a),configs:{label:"Nome"},...r}),R.jsx(tm,{value:s,onUpdate:a=>t("offsetA",a),configs:{label:"Offset 1",min:0,max:1/0,precision:2},...r}),R.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 R.jsx("table",{className:"w-full",children:R.jsxs("tbody",{children:[R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"Name"}),R.jsx("td",{children:R.jsx(Ol,{value:i,onChange:l=>e("name",l.target.value),style:{textAlign:"left"}})})]}),R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"X"}),R.jsx("td",{children:R.jsx(Zi,{value:s,onChange:l=>e("x",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"Y"}),R.jsx("td",{children:R.jsx(Zi,{value:o,onChange:l=>e("y",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"Rotation"}),R.jsx("td",{children:R.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 R.jsxs("div",{children:[R.jsxs("div",{className:"w-full mb-2",children:[R.jsx(ti,{children:"Name"}),R.jsx(Ol,{value:r,onChange:s=>e("name",s.target.value),style:{textAlign:"left"}})]}),R.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"?R.jsx(A7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):n.prototype==="lines"?R.jsx(C7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):n.prototype==="holes"?R.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}=Ht(),[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 R.jsxs("div",{children:[R.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 R.jsx(M,{propertyName:x,value:_,configs:b,onUpdate:E=>m(x,E),state:r,sourceElement:n,internalState:{attributesFormData:l,propertiesFormData:h}},x)})]})},O7=()=>R.jsx("div",{className:"h-full flex flex-col gap-4 justify-center items-center",children:R.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,Fr,cr,ur,wr,zr,kr,Br,Vr,qi,nf,rf],D7=({catalog:n})=>{const{planner:e}=Ht(),{scene:t,mode:r}=e;return q7.includes(r)?t.layers.valueSeq().flatMap(s=>mn().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>({element:o,layer:s}))).toArray().length===0?R.jsx(O7,{}):R.jsx("div",{children:t.layers.valueSeq().map(s=>mn().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>R.jsx(mx,{name:"Properties",opened:!0,children:R.jsx("div",{style:{padding:"5px 15px"},children:R.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:Fr,MODE_DRAWING_LINE:cr,MODE_DRAWING_HOLE:ur,MODE_DRAWING_ITEM:wr,MODE_DRAGGING_LINE:zr,MODE_DRAGGING_VERTEX:kr,MODE_DRAGGING_ITEM:Br,MODE_DRAGGING_HOLE:Vr,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}=Ht(),{mode:o}=e;if(!n||!N7[o])return null;const a=e.getIn(["scene","groups",n]),l=a.get("elements");return R.jsx(mx,{name:`Group [${a.get("name")}]`,opened:!0,children:R.jsxs("div",{style:{padding:"5px 15px"},children:[R.jsx("table",{style:U7,children:R.jsxs("tbody",{children:[R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"Name"}),R.jsx("td",{children:R.jsx(Ol,{value:a.get("name"),onChange:c=>t(n,Pe({name:c.target.value})),style:Gu})})]}),R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"X"}),R.jsx("td",{children:R.jsx(Zi,{value:a.get("x"),onChange:c=>r(n,c.target.value,a.get("y")),style:Gu,precision:2})})]}),R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"Y"}),R.jsx("td",{children:R.jsx(Zi,{value:a.get("y"),onChange:c=>r(n,a.get("x"),c.target.value),style:Gu,precision:2})})]}),R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"Rotation"}),R.jsx("td",{children:R.jsx(Zi,{value:a.get("rotation"),onChange:c=>i(n,c.target.value),style:Gu,precision:2})})]})]})}),l.size?R.jsxs("div",{children:[R.jsx("p",{style:{textAlign:"center",borderBottom:"1px solid #555",paddingBottom:"1em"},children:"Group's Elements"}),R.jsxs("table",{style:z7,children:[R.jsx("thead",{children:R.jsxs("tr",{children:[R.jsx("th",{style:vx}),R.jsx("th",{children:"Layer"}),R.jsx("th",{children:"Prototype"}),R.jsx("th",{children:"Name"})]})}),R.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 R.jsxs("tr",{children:[R.jsx("td",{style:vx,title:"Un-chain Element from Group",children:R.jsx(R8,{onClick:()=>s(n,c,f,d),style:F7})}),R.jsx("td",{style:{textAlign:"center"},children:c}),R.jsx("td",{style:{textAlign:"center",textTransform:"capitalize"},children:f}),R.jsx("td",{style:{textAlign:"center"},children:m.name})]},d)})))})]})]}):null]})})},B7=({catalog:n,width:e=280})=>{const{planner:t}=Ht(),r=t.getIn(["scene","selectedLayer"]),i=t.getIn(["scene","layers",r,"selected"]),s=t.getIn(["scene","groups"]).findEntry(a=>a.get("selected")),o=i.lines.size>1||i.items.size>1||i.holes.size>1||i.areas.size>1||i.lines.size+i.items.size+i.holes.size+i.areas.size>1;return R.jsxs("aside",{onKeyDown:a=>a.stopPropagation(),onKeyUp:a=>a.stopPropagation(),className:"floor_planner-sidebar bg-[#424242] h-full block overflow-y-auto overflow-x-hidden pb-5",style:{width:e},children:[!o&&R.jsx(D7,{catalog:n}),!!s&&R.jsx(k7,{groupID:s?s[0]:null})]})},Or=({active:n,tooltip:e,onClick:t,children:r,className:i})=>{const[s,o]=se.useState(!1),a=n||s?"text-dark-blue":"text-[#C2C2C2]",l=c=>{t(c),o(!1)};return R.jsxs("div",{className:Ti("w-[30px] h-[30px] flex items-center justify-center text-[25px] relative cursor-pointer",i),onClick:l,onMouseOver:()=>o(!0),onMouseOut:()=>o(!1),children:[R.jsx("div",{className:a,onClick:l,children:r}),s&&R.jsxs("div",{onClick:c=>{c.preventDefault(),c.stopPropagation()},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:[R.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 Sn({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)?R.jsx(Or,{active:!1,tooltip:"Get Screenshot",onClick:e,children:R.jsx(yx,{size:28})}):[rn,qs,Ds,Ns,Fr,zr,kr,Br,cr,ur,wr,Vr,qi].includes(n)?R.jsx(Or,{active:!1,tooltip:"Get Screenshot",onClick:t,children:R.jsx(yx,{size:28})}):null}function H7(n){return Sn({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 R.jsxs("div",{className:"color-field flex-1 flex pr-3 mt-1 cursor-pointer",children:[R.jsx("div",{className:"colorBox relative w-[22px] h-[22px]",style:{background:e.value},onClick:()=>{i.current&&i.current.click()},children:R.jsx("input",{ref:i,type:"color",onChange:s,value:e.value,className:"absolute invisible h-full w-full"})}),R.jsx("div",{className:"flex-1 pl-2",children:R.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}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyColor w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.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}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyEnum w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(em,{value:n,onChange:a=>o(a.target.value),children:mn(t.values).entrySeq().map(([a,l])=>R.jsx("option",{value:a,children:l},a))})]})}function Mx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Ht();let o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyString w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(Ol,{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}=Ht(),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 R.jsxs("div",{className:"PropertyNumber w-full mb-2",children:[R.jsx(ti,{children:r.label}),R.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}=Ht();let a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||hi,{hook:h,label:f,...p}=r;const d=(m,x)=>{let v=Jn(m),_=n.merge({length:x!==hi?ni(v).from(x).to(hi):v,_length:m,_unit:x});return h?h(_,i,s,o).then(b=>e(b)):e(_)};return R.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[R.jsx(ti,{children:f}),R.jsxs("div",{className:"w-full flex",children:[R.jsx(Zi,{value:l,onChange:m=>d(m.target.value,c),onValid:t,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},...p}),R.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:R.jsx(em,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>d(l,m.target.value),children:Y0.map(m=>R.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 R.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}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsx("table",{className:"PropertyToggle",style:Wu.tableStyle,children:R.jsx("tbody",{children:R.jsxs("tr",{children:[R.jsx("td",{style:Wu.firstTdStyle,children:R.jsx(ti,{children:t.label})}),R.jsx("td",{children:R.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}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyCheckbox w-full flex items-center gap-2 mb-2",children:[R.jsx("input",{className:"m-0 mt-0.5",type:"checkbox",checked:n,onChange:()=>o(!n)}),R.jsx(ti,{className:"mb-0",children:t.label})]})}function Rx(){return null}function Px({value:n,configs:e}){return R.jsx("table",{className:"PropertyReadOnly",style:Wu.tableStyle,children:R.jsx("tbody",{children:R.jsxs("tr",{children:[R.jsx("td",{style:Wu.firstTdStyle,children:R.jsx(ti,{children:e.label})}),R.jsx("td",{children:R.jsx("div",{children:n})})]})})})}class X7{constructor(e=hi){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 Sn({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 R.jsxs("div",{className:Ti(`relative w-full ${t?"mt-1":"mt-2"}`,a),onClick:r??(()=>!1),children:[R.jsx("span",{className:`absolute left-0 top-2 text-[#637381] ${t?"":"ml-2"}`,style:{zIndex:2},children:R.jsx($7,{size:18})}),i?R.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}):R.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&&R.jsx("span",{className:`absolute right-2 top-1/2 -translate-y-1/2 ${t?"":"ml-2"}`,style:{zIndex:1},children:R.jsx(C8,{className:"-mb-1"})})]})},Ix=0,Lx=58,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 R.jsxs(R.Fragment,{children:[R.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=>R.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)&&R.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}=Ht(),[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 R.jsxs(R.Fragment,{children:[e&&R.jsx("div",{className:"fixed inset-0 bg-black/30 z-10",onClick:b}),R.jsxs("div",{style:e&&e.rect?{top:e.rect.y+Ix,left:e.rect.x+Lx}:_.current?_.current:{},className:Ti("fixed select-none z-10 shadow-md !gap-0 rounded-lg pt-4 fp_side-bar !min-h-[250px] !min-w-[330px] max-w-[330px] !max-h-[510px] transition-all duration-200 ease-out transform",e?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),children:[R.jsxs("header",{className:"px-[18px] sticky top-0 left-0 gap-3 flex flex-col",children:[R.jsx("div",{className:"flex items-center gap-1",children:R.jsx("span",{className:Ti("flex flex-col gap-0.5"),children:R.jsx("span",{className:"fp-sidebar-label capitalize",children:(e==null?void 0:e.page)??v.current})})}),R.jsxs("div",{className:Ti("fp-highlight"),children:[R.jsx(Ox,{options:l,level:0,selections:h,onChange:E}),R.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?R.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=>R.jsxs("div",{className:"w-full space-y-1.5",children:[R.jsx("div",{className:"fp-aspect-ratio-container",children:R.jsx("div",{className:"fp-aspect-ratio-content",onMouseDown:()=>M(S),children:R.jsx("img",{draggable:!1,className:"fp-item-image",alt:S.info.title,src:S.info.image})})}),R.jsx("p",{className:"text-xs font-semibold capitalize",children:S.info.description})]},S.name.replace(/\s+/g,"_")))}):R.jsx("div",{className:"min-h-28 w-full flex items-center justify-center",children:R.jsx("p",{className:"text-sm font-medium text-gray-400 text-center",children:"No records found"})})]})]})};function J7(n){return Sn({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 Sn({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})=>R.jsx("p",{style:{...qx,...n},children:"2D"}),tC=({style:n})=>R.jsx("p",{style:{...qx,...n},children:"3D"});function nC({catalog:n,has3dView:e}){const{planner:t,setMode:r,setToast:i,selectTool3DView:s,unselectAll:o,selectToolDrawingLine:a}=Ht(),{mode:l,alterate:c}=t,[h,f]=se.useState(null);return R.jsxs(R.Fragment,{children:[R.jsxs("aside",{className:"floor_planner-toolbar -mt-[20px] absolute left-2 !pt-3 top-1/2 -translate-y-1/2 z-[1] rounded max-h-full max-w-[50px] p-2.5 space-y-4 bg-[#2b2b2b]",children:[R.jsx(Or,{active:[Fr,cr].includes(l),tooltip:"Draw wall",onClick:()=>{i({text:"Cancel drawing"}),a("wall")},children:R.jsx(H7,{})}),R.jsx(Or,{active:!!([ur].includes(l)&&h&&h.page==="windows"),tooltip:"Place windows",onClick:p=>{f({rect:(p.currentTarget.parentElement??p.currentTarget).getBoundingClientRect(),page:"windows"})},children:R.jsx(V8,{size:26})}),R.jsx(Or,{active:!!([ur].includes(l)&&h&&h.page==="doors"),tooltip:"Place doors",onClick:p=>{f({rect:(p.currentTarget.parentElement??p.currentTarget).getBoundingClientRect(),page:"doors"})},children:R.jsx(J7,{size:26})}),R.jsx(Or,{active:!!([wr].includes(l)&&h&&h.page==="objects"),tooltip:"Place objects",onClick:p=>{f({rect:(p.currentTarget.parentElement??p.currentTarget).getBoundingClientRect(),page:"objects"})},children:R.jsx(Q7,{size:26})}),e?[Oi].includes(l)?R.jsx(Or,{active:[rn].includes(l),tooltip:"2D View",onClick:()=>{o(),setTimeout(()=>{r(rn)},0)},children:R.jsx(eC,{style:{color:c?"#FF9800":""}})}):R.jsx(Or,{active:[Oi].includes(l),tooltip:"3D View",onClick:s,children:R.jsx(tC,{})}):null,R.jsx(V7,{mode:l})]}),R.jsx(Z7,{catalog:n,popupEvent:h,onClose:()=>f(null)})]})}const ql=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&&ql){if(r){t.setPlan(r);const o=r.floors[0].floorDesign;s=JSON.parse(o)}else if(ql.getItem(n)!==null){const o=ql.getItem(n);s=JSON.parse(o)}s&&t.loadProject(s),Ht.subscribe(o=>{nm&&clearTimeout(nm),nm=setTimeout(()=>{const a=ql.getItem(n),l=Ot.unselectAll(o.planner).updatedState,c=JSON.stringify(l.scene.toJS());if(a!==c&&(ql.setItem(n,c),o.plan))try{const h=o.plan.floors[o.activeFloor];i&&i({floor:{floorID:h.floorID,title:h.floorTitle,description:h.floorDescription,design:c}})}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 Dx=38,Nx=-220,Dl=({title:n,toggleState:e,toggleOn:t,toggleOff:r})=>{const[i,s]=se.useState(e||!1),o=()=>{s(!i),i?r():t()};return R.jsxs("div",{className:"flex items-center",children:[R.jsx("div",{className:"fp__onoffswitch",onClick:o,children:R.jsxs("div",{className:Ti("fp__onoffswitch_label",i?"fp__onoffswitch_label-checked":""),children:[R.jsx("span",{className:"fp__onoffswitch_inner"}),R.jsx("span",{className:"fp__onoffswitch_switch"})]})}),R.jsx("div",{className:"fp__onoffswitch_caption",children:n})]})},oC=({popupEvent:n,onClose:e})=>{const{planner:t,toggleSnap:r}=Ht(),{snapMask:i}=t,s=se.useRef(null);se.useEffect(()=>{if(n){const{x:l,y:c}=n.rect;s.current={top:c+Dx,left:l+Nx}}},[n]);const o=()=>{e()},a=l=>r(i.merge(l));return R.jsxs(R.Fragment,{children:[n&&R.jsx("div",{className:"fixed inset-0 bg-black/30 z-10",onClick:o}),R.jsxs("div",{style:n&&n.rect?{top:n.rect.y+Dx,left:n.rect.x+Nx}:s.current?s.current:{},id:"headerbar-popup",className:Ti("fixed select-none z-10 shadow-md !gap-0 rounded-lg pt-4 fp_side-bar !min-h-[200px] !min-w-[250px] max-w-[250px] !max-h-[300px] transition-all duration-200 ease-out transform",n?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),children:[R.jsx("header",{className:"px-[18px] sticky top-0 left-0 gap-3 flex flex-col",children:R.jsx("div",{className:"flex items-center gap-1",children:R.jsx("span",{className:Ti("flex flex-col gap-0.5"),children:R.jsx("span",{className:"fp-sidebar-label capitalize",children:"Settings"})})})}),R.jsxs("div",{className:"min-h-28 w-full space-y-2.5 px-2 py-4",children:[R.jsx(Dl,{title:"Snap to Point",toggleState:i.get(uf),toggleOn:()=>{a({SNAP_POINT:!0})},toggleOff:()=>{a({SNAP_POINT:!1})}}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_LINE:!0})},toggleOff:()=>{a({SNAP_LINE:!1})},toggleState:i.get(hf),title:"Snap to Line"}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_SEGMENT:!0})},toggleOff:()=>{a({SNAP_SEGMENT:!1})},toggleState:i.get(ff),title:"Snap to Segment"}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_GRID:!0})},toggleOff:()=>{a({SNAP_GRID:!1})},toggleState:i.get(df),title:"Snap to Grid"}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_GUIDE:!0})},toggleOff:()=>{a({SNAP_GUIDE:!1})},toggleState:i.get(J0),title:"Snap to Guide"})]})]})]})},aC=({onBack:n,onSave:e})=>{const{undo:t,redo:r,plan:i,setPlan:s}=Ht(),[o,a]=se.useState(!1),[l,c]=se.useState(null),h=()=>{a(!0)},f=p=>{if(!i)return;a(!1);const d=p.target.value.trim();if(d&&d!==(i==null?void 0:i.planTitle)){s({...i,planTitle:d});try{e&&e({title:d,description:""})}catch{}}};return R.jsxs(R.Fragment,{children:[R.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:[R.jsx(Or,{className:"border border-white rounded -ml-1",active:!1,tooltip:"Go Back",onClick:()=>{n&&n()},children:R.jsx(Yv,{})}),R.jsx("div",{className:"flex flex-col items-center justify-center",children:o?R.jsx("input",{autoFocus:!0,type:"text",defaultValue:i==null?void 0:i.planTitle,onBlur:f,onKeyDown:p=>{(p.key==="Enter"||p.key==="Escape")&&f(p)},className:"bg-transparent border-b border-gray-400 outline-none text-lg text-center"}):R.jsx("span",{onDoubleClick:h,className:"projectName__fp text-lg",title:(i==null?void 0:i.planTitle)??"Example House",children:(i==null?void 0:i.planTitle)??"Example House"})}),R.jsxs("div",{className:"flex items-center gap-2 relative",children:[R.jsx(Or,{active:!1,tooltip:"Undo (CTRL-Z)",onClick:t,children:R.jsx(k8,{})}),R.jsx(Or,{active:!1,tooltip:"Redo (CTRL-SHIFT-Z)",onClick:r,children:R.jsx(z8,{})}),R.jsx("div",{className:"ml-8",children:R.jsx(Or,{active:!1,tooltip:"Settings",onClick:p=>{c({rect:p.currentTarget.getBoundingClientRect()})},children:R.jsx(T8,{size:17})})})]})]}),R.jsx(oC,{popupEvent:l,onClose:()=>c(null)})]})};var rm={exports:{}},Ux;function Fx(){if(Ux)return rm.exports;Ux=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,zx;function lC(){return zx||(zx=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,kx;function cC(){return kx||(kx=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,Bx;function uC(){return Bx||(Bx=1,om=function(){var n=1;function e(){return n++}return{generate:e}}),om}var am,Vx;function hC(){return Vx||(Vx=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,Hx;function fC(){return Hx||(Hx=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:{}},Gx;function Wx(){if(Gx)return cm.exports;Gx=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:{}},jx;function dC(){if(jx)return um.exports;jx=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,Xx;function pC(){if(Xx)return hm;Xx=1;var n=dC();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,$x;function mC(){if($x)return fm;$x=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,Yx;function gC(){if(Yx)return dm;Yx=1;var n=Wx();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,Kx;function _C(){if(Kx)return pm;Kx=1;var n=Fx().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. */
|
|
3923
3923
|
`;N+="."+q+" > div::-webkit-scrollbar { "+h(["display: none"])+` }
|
|
3924
3924
|
|
|
3925
3925
|
`,N+="."+L+" { "+h(["-webkit-animation-duration: 0.1s","animation-duration: 0.1s","-webkit-animation-name: "+A,"animation-name: "+A])+` }
|
|
3926
3926
|
`,N+="@-webkit-keyframes "+A+` { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }
|
|
3927
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,Zx;function vC(){if(Zx)return mm;Zx=1;var n=Fx().forEach,e=lC(),t=cC(),r=uC(),i=hC(),s=fC(),o=Wx(),a=pC(),l=mC(),c=gC(),h=_C();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 xC=vC();const yC=oi(xC);function SC(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 EC=({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=yC({strategy:"scroll",callOnAdd:!1});const o=()=>{const a=SC(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):R.jsx("div",{ref:r})};function bC(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 MC=()=>{const{toast:n,setToast:e}=Ht(),[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?R.jsx("div",{className:`absolute top-6 left-1/2 -translate-x-1/2 z-[9999] transition-all duration-300 ease-in-out
|
|
3928
3928
|
${t?"opacity-100 translate-y-0":"opacity-0 -translate-y-2"}
|
|
3929
|
-
`,children:R.jsx("div",{className:"p-1 px-3 shadow-md rounded-md bg-white text-slate-600",children:R.jsxs("div",{className:"flex gap-1 justify-center items-center h-8 rounded",children:[R.jsx("span",{className:"text-xs",children:n.text}),R.jsx("div",{className:"text-xs bg-gray-50 border rounded-md px-1 py-0.5 font-medium",children:"ESC"})]})})}):null},gm=280,wC=[iC("pub_planner_v0"),sC()],TC=({plan:n,catalog:e,onSave:t,onBack:r,has3dView:i})=>{const s=Ht();return se.useEffect(()=>{s.initCatalog(e),wC.forEach(o=>o(s,n,t))},[]),se.useEffect(()=>{s.planner.getIn(["catalog","ready"])||s.initCatalog(e)},[e]),bC(o=>{t&&t({imageURI:o})}),R.jsx(EC,{children:({width:o,height:a})=>{const l=o-gm,c=a;return R.jsxs("div",{className:"flex flex-nowrap flex-row h-full floor_planner",children:[R.jsx(MC,{}),R.jsx(aC,{onSave:t,onBack:r}),R.jsx(nC,{catalog:e,has3dView:i}),R.jsx(sA,{width:l,height:c,catalog:e}),R.jsx(B7,{catalog:e,width:gm}),R.jsx(cA,{sidebarWidth:gm})]})}})},AC=()=>R.jsxs("div",{className:"fixed inset-0 z-[100] flex flex-col bg-[#2b2d35] overflow-hidden",children:[R.jsxs("div",{className:"flex h-[45px] items-center justify-between border border-[#424242] bg-[#2b2d35] px-2",children:[R.jsx("div",{className:"flex flex-1 items-center",children:R.jsx("div",{className:"h-[30px] w-[30px] rounded bg-[#424242] animate-pulse"})}),R.jsx("div",{className:"flex items-center",children:R.jsx("div",{className:"h-[18px] w-[175px] bg-[#424242] animate-pulse"})}),R.jsx("div",{className:"flex flex-1 items-center justify-end",children:R.jsx("div",{className:"mr-20 flex flex-row gap-3",children:[...Array(2)].map((n,e)=>R.jsx("div",{className:"h-[24px] w-[24px] rounded bg-[#424242] animate-pulse"},`${e}`))})})]}),R.jsxs("div",{className:"flex flex-1",children:[R.jsx("div",{className:"flex flex-1 items-center justify-center bg-[#2b2d35]",children:R.jsx("div",{className:"h-[90%] w-[90%] bg-[#424242] animate-pulse"})}),R.jsx("div",{className:"w-[280px] border-l border-[#424242] bg-[#2b2d35] flex justify-center items-center",children:R.jsxs("div",{className:"flex w-full flex-col gap-2 justify-center items-center p-6",children:[R.jsx("div",{className:"h-[15px] w-[200px] bg-[#424242] animate-pulse"}),R.jsx("div",{className:"h-[15px] w-[150px] bg-[#424242] animate-pulse"})]})})]})]}),Jx=1e-5,ju=0,Nl=1,va=2,Qx=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 Gt;else{if(e instanceof Ji)return this.tree=e,this.matrix=new Gt,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 Gt().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<-Jx?va:t>Jx?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:Qx}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)===Qx&&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,e2=(n,e,t,r)=>{if(!e)return;const i=new Y_;n.map=i.load(e.uri),n.needsUpdate=!0,n.map.wrapS=Xr,n.map.wrapT=Xr,n.map.repeat.set(t*(e.lengthRepeatScale??1),r*(e.heightRepeatScale??1)),e.normal&&n instanceof JM&&(n.normalMap=i.load(e.normal.uri),n.normalScale=new Fe(e.normal.normalScaleX,e.normal.normalScaleY),n.normalMap.wrapS=Xr,n.normalMap.wrapT=Xr,n.normalMap.repeat.set(t*(e.normal.lengthRepeatScale??1),r*(e.normal.heightRepeatScale??1)))};function CC(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?Ut.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;e2(M,r[n.properties.get("textureB")],f,a),e2(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 RC(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?Ut.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 t2=20,n2={textAnchor:"middle"},PC={stroke:Ut.LINE_MESH_COLOR.selected},r2={strokeWidth:1,stroke:Ut.COLORS.black},IC={...r2,stroke:Ut.LINE_MESH_COLOR.selected};function LC(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:hi}}},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+t2,v=11,b=m+t2+5;return i.selected?R.jsxs("g",{children:[R.jsx("rect",{x:"0",y:-m,width:f,height:d,style:IC}),R.jsx("line",{x1:p,y1:-x,x2:p,y2:x,style:PC}),R.jsx("text",{x:p,y:b+v,style:n2,children:"A"}),R.jsx("text",{x:p,y:-b,style:n2,children:"B"})]}):R.jsx("rect",{x:"0",y:-m,width:f,height:d,style:r2})},render3D:function(i,s,o){return CC(i,s,o,t)},updateRender3D:(i,s,o,a,l,c,h,f)=>RC(i,s,o,t,a,l,c,h,f)};if(t&&Object.keys(t).length>0){const i={none:"None"};for(let s in t)i[s]=t[s].name;r.properties.textureA={label:"texture A",type:"enum",defaultValue:i.painted?"painted":"none",values:i},r.properties.textureB={label:"texture B",type:"enum",defaultValue:i.painted?"painted":"none",values:i}}return r}const OC=(n,e,t,r)=>{if(!e)return;const i=new Y_;n.map=i.load(e.uri),n.needsUpdate=!0,n.map.wrapS=Xr,n.map.wrapT=Xr,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=Xr,n.normalMap.wrapT=Xr,n.normalMap.repeat.set(t*e.normal.lengthRepeatScale,r*e.normal.heightRepeatScale))},qC=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 DC(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=Ut.AREA_MESH_COLOR.selected:o&&o!=="none"&&(s=Ut.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 QM({side:xi,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 _=UC(v);a.holes.push(_)});const c=new Lp(a);qC(c);const h=new bi().setFromObject(new Tn(c,new Ys)),f=h.max.x-h.min.x,p=h.max.y-h.min.y,d=r[o];OC(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 NC(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?Ut.AREA_MESH_COLOR.selected:n.properties.get("patternColor")||Ut.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 UC=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 FC(n,e,t){let r={name:n,prototype:"areas",info:{...e,visibility:{catalog:!1,layerElementsVisible:!1}},properties:{patternColor:{label:"color",type:"color",defaultValue:Ut.AREA_MESH_COLOR.unselected},thickness:{label:"thickness",type:"length-measure",defaultValue:{length:0,_length:0,_unit:hi}}},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?Ut.AREA_MESH_COLOR.selected:i.properties.get("patternColor"),b=`pattern-${i.id}`;return R.jsxs("g",{children:[R.jsx("defs",{children:c&&R.jsx("pattern",{id:b,patternUnits:"userSpaceOnUse",width:x/(x*c.lengthRepeatScale),height:v/(v*c.heightRepeatScale),x:f,y:d,children:R.jsx("image",{href:c.uri,width:x,height:v,preserveAspectRatio:"none"})})}),R.jsx("path",{d:a,fill:c?`url(#${b})`:_,stroke:i.selected?"#0096fd":"#000",strokeWidth:"2"})]})},render3D:function(i,s,o){return DC(i,s,o,t)},updateRender3D:(i,s,o,a,l,c,h,f)=>NC(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=FC,En.Catalog=X7,En.ReactPlannerLoader=AC,En.WallFactory=LC,En.convertUnits=ni,En.default=TC,Object.defineProperties(En,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
3929
|
+
`,children:R.jsx("div",{className:"p-1 px-3 shadow-md rounded-md bg-white text-slate-600",children:R.jsxs("div",{className:"flex gap-1 justify-center items-center h-8 rounded",children:[R.jsx("span",{className:"text-xs",children:n.text}),R.jsx("div",{className:"text-xs bg-gray-50 border rounded-md px-1 py-0.5 font-medium",children:"ESC"})]})})}):null},gm=280,wC=[iC("pub_planner_v0"),sC()],TC=({plan:n,catalog:e,onSave:t,onBack:r,has3dView:i})=>{const s=Ht();return se.useEffect(()=>{s.initCatalog(e),wC.forEach(o=>o(s,n,t))},[]),se.useEffect(()=>{s.planner.getIn(["catalog","ready"])||s.initCatalog(e)},[e]),bC(o=>{t&&t({imageURI:o})}),R.jsx(EC,{children:({width:o,height:a})=>{const l=o-gm,c=a;return R.jsxs("div",{className:"flex flex-nowrap flex-row h-full floor_planner",children:[R.jsx(MC,{}),R.jsx(aC,{onSave:t,onBack:r}),R.jsx(nC,{catalog:e,has3dView:i}),R.jsx(sA,{width:l,height:c,catalog:e}),R.jsx(B7,{catalog:e,width:gm}),R.jsx(cA,{sidebarWidth:gm})]})}})},AC=()=>R.jsxs("div",{className:"fixed inset-0 z-[100] flex flex-col bg-[#2b2d35] overflow-hidden",children:[R.jsxs("div",{className:"flex h-[45px] items-center justify-between border border-[#424242] bg-[#2b2d35] px-2",children:[R.jsx("div",{className:"flex flex-1 items-center",children:R.jsx("div",{className:"h-[30px] w-[30px] rounded bg-[#424242] animate-pulse"})}),R.jsx("div",{className:"flex items-center",children:R.jsx("div",{className:"h-[18px] w-[175px] bg-[#424242] animate-pulse"})}),R.jsx("div",{className:"flex flex-1 items-center justify-end",children:R.jsx("div",{className:"mr-20 flex flex-row gap-3",children:[...Array(2)].map((n,e)=>R.jsx("div",{className:"h-[24px] w-[24px] rounded bg-[#424242] animate-pulse"},`${e}`))})})]}),R.jsxs("div",{className:"flex flex-1",children:[R.jsx("div",{className:"flex flex-1 items-center justify-center bg-[#2b2d35]",children:R.jsx("div",{className:"h-[90%] w-[90%] bg-[#424242] animate-pulse"})}),R.jsx("div",{className:"w-[280px] border-l border-[#424242] bg-[#2b2d35] flex justify-center items-center",children:R.jsxs("div",{className:"flex w-full flex-col gap-2 justify-center items-center p-6",children:[R.jsx("div",{className:"h-[15px] w-[200px] bg-[#424242] animate-pulse"}),R.jsx("div",{className:"h-[15px] w-[150px] bg-[#424242] animate-pulse"})]})})]})]}),Jx=1e-5,ju=0,Nl=1,va=2,Qx=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 _n)e.updateMatrixWorld(),this.matrix=e.matrixWorld.clone(),e=e.geometry;else if(e instanceof tr)this.matrix=new Gt;else{if(e instanceof Ji)return this.tree=e,this.matrix=new Gt,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 Gt().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 _n(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<-Jx?va:t>Jx?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:Qx}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)===Qx&&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,e2=(n,e,t,r)=>{if(!e)return;const i=new Y_;n.map=i.load(e.uri),n.needsUpdate=!0,n.map.wrapS=Xr,n.map.wrapT=Xr,n.map.repeat.set(t*(e.lengthRepeatScale??1),r*(e.heightRepeatScale??1)),e.normal&&n instanceof JM&&(n.normalMap=i.load(e.normal.uri),n.normalScale=new Fe(e.normal.normalScaleX,e.normal.normalScaleY),n.normalMap.wrapS=Xr,n.normalMap.wrapT=Xr,n.normalMap.repeat.set(t*(e.normal.lengthRepeatScale??1),r*(e.normal.heightRepeatScale??1)))};function CC(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?Ut.MESH_SELECTED:13882323});let x=new _n(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 _n(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;e2(M,r[n.properties.get("textureB")],f,a),e2(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 RC(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?Ut.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 t2=20,n2={textAnchor:"middle"},PC={stroke:Ut.LINE_MESH_COLOR.selected},r2={strokeWidth:1,stroke:Ut.COLORS.black},IC={...r2,stroke:Ut.LINE_MESH_COLOR.selected};function LC(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:hi}}},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+t2,v=11,b=m+t2+5;return i.selected?R.jsxs("g",{children:[R.jsx("rect",{x:"0",y:-m,width:f,height:d,style:IC}),R.jsx("line",{x1:p,y1:-x,x2:p,y2:x,style:PC}),R.jsx("text",{x:p,y:b+v,style:n2,children:"A"}),R.jsx("text",{x:p,y:-b,style:n2,children:"B"})]}):R.jsx("rect",{x:"0",y:-m,width:f,height:d,style:r2})},render3D:function(i,s,o){return CC(i,s,o,t)},updateRender3D:(i,s,o,a,l,c,h,f)=>RC(i,s,o,t,a,l,c,h,f)};if(t&&Object.keys(t).length>0){const i={none:"None"};for(let s in t)i[s]=t[s].name;r.properties.textureA={label:"texture A",type:"enum",defaultValue:i.painted?"painted":"none",values:i},r.properties.textureB={label:"texture B",type:"enum",defaultValue:i.painted?"painted":"none",values:i}}return r}const OC=(n,e,t,r)=>{if(!e)return;const i=new Y_;n.map=i.load(e.uri),n.needsUpdate=!0,n.map.wrapS=Xr,n.map.wrapT=Xr,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=Xr,n.normalMap.wrapT=Xr,n.normalMap.repeat.set(t*e.normal.lengthRepeatScale,r*e.normal.heightRepeatScale))},qC=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 DC(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=Ut.AREA_MESH_COLOR.selected:o&&o!=="none"&&(s=Ut.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 QM({side:xi,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 _=UC(v);a.holes.push(_)});const c=new Lp(a);qC(c);const h=new bi().setFromObject(new _n(c,new Ys)),f=h.max.x-h.min.x,p=h.max.y-h.min.y,d=r[o];OC(l,d,f,p);const m=new _n(c,l);return m.rotation.x-=Math.PI/2,m.name="floor",Promise.resolve(m)}async function NC(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?Ut.AREA_MESH_COLOR.selected:n.properties.get("patternColor")||Ut.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 UC=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 FC(n,e,t){let r={name:n,prototype:"areas",info:{...e,visibility:{catalog:!1,layerElementsVisible:!1}},properties:{patternColor:{label:"color",type:"color",defaultValue:Ut.AREA_MESH_COLOR.unselected},thickness:{label:"thickness",type:"length-measure",defaultValue:{length:0,_length:0,_unit:hi}}},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?Ut.AREA_MESH_COLOR.selected:i.properties.get("patternColor"),b=`pattern-${i.id}`;return R.jsxs("g",{children:[R.jsx("defs",{children:c&&R.jsx("pattern",{id:b,patternUnits:"userSpaceOnUse",width:x/(x*c.lengthRepeatScale),height:v/(v*c.heightRepeatScale),x:f,y:d,children:R.jsx("image",{href:c.uri,width:x,height:v,preserveAspectRatio:"none"})})}),R.jsx("path",{d:a,fill:c?`url(#${b})`:_,stroke:i.selected?"#0096fd":"#000",strokeWidth:"2"})]})},render3D:function(i,s,o){return DC(i,s,o,t)},updateRender3D:(i,s,o,a,l,c,h,f)=>NC(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}bn.AreaFactory=FC,bn.Catalog=X7,bn.ReactPlannerLoader=AC,bn.WallFactory=LC,bn.convertUnits=ni,bn.default=TC,Object.defineProperties(bn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|