archgine 2.0.11 → 2.0.12
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/lib/index.mjs +4 -4
- package/lib/index.umd.js +1 -1
- package/lib/renderer2.worker.js +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var t,e,i=Object.defineProperty,n=Object.defineProperties,s=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,h=(t,e,n)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,l=(t,e)=>{for(var i in e||(e={}))a.call(e,i)&&h(t,i,e[i]);if(r)for(var i of r(e))o.call(e,i)&&h(t,i,e[i]);return t},u=(t,e)=>n(t,s(e)),c=(t,e,i)=>h(t,"symbol"!=typeof e?e+"":e,i),d=(t,e,i)=>new Promise(((n,s)=>{var r=t=>{try{o(i.next(t))}catch(t){s(t)}},a=t=>{try{o(i.throw(t))}catch(t){s(t)}},o=t=>t.done?n(t.value):Promise.resolve(t.value).then(r,a);o((i=i.apply(t,e)).next())}));function p(t,e){const i=t.x*Math.cos(e)-t.y*Math.sin(e),n=t.y*Math.cos(e)+t.x*Math.sin(e);t.x=i,t.y=n}function f(t,e){t.x*=e,t.y*=e}let m=class t{constructor(e){c(this,"commands"),this.commands=[],e&&e instanceof t?this.commands.push(...e.commands):e&&(this.commands=function(t){const e=[],i=String(t).trim();if("M"!==i[0]&&"m"!==i[0])return e;return i.replace(v,((t,i,n)=>{const s=function(t){const e=t.match(x);return e?e.map(Number):[]}(n);let r=i.toLowerCase(),a=i;if("m"===r&&s.length>2&&(e.push([a,...s.splice(0,2)]),r="l",a="m"===a?"l":"L"),s.length<y[r])return"";for(e.push([a,...s.splice(0,y[r])]);s.length>=y[r]&&s.length&&y[r];)e.push([a,...s.splice(0,y[r])]);return""})),e}(e))}addPath(e){e&&e instanceof t&&this.commands.push(...e.commands)}moveTo(t,e){this.commands.push(["M",t,e])}lineTo(t,e){this.commands.push(["L",t,e])}arc(t,e,i,n,s,r){this.commands.push(["AC",t,e,i,n,s,!!r])}arcTo(t,e,i,n,s){this.commands.push(["AT",t,e,i,n,s])}ellipse(t,e,i,n,s,r,a,o){this.commands.push(["E",t,e,i,n,s,r,a,!!o])}closePath(){this.commands.push(["Z"])}bezierCurveTo(t,e,i,n,s,r){this.commands.push(["C",t,e,i,n,s,r])}quadraticCurveTo(t,e,i,n){this.commands.push(["Q",t,e,i,n])}rect(t,e,i,n){this.commands.push(["R",t,e,i,n])}roundRect(t,e,i,n,s){void 0===s?this.commands.push(["RR",t,e,i,n,0]):this.commands.push(["RR",t,e,i,n,s])}};function g(t,e){let i,n,s,r,a,o,h,l,u,c,d,m,g,y,v,x,b,w,_,S,E,M=0,A=0,T=null,C=null,I=null,D=null,L=null,B=null;t.beginPath();for(let O=0;O<e.length;++O){let R;switch(w=e[O][0],"S"!==w&&"s"!==w&&"C"!==w&&"c"!==w&&(T=null,C=null),"T"!==w&&"t"!==w&&"Q"!==w&&"q"!==w&&(I=null,D=null),w){case"m":case"M":R=e[O],"m"===w?(M+=R[1],A+=R[2]):(M=R[1],A=R[2]),"M"!==w&&L||(L={x:M,y:A}),t.moveTo(M,A);break;case"l":R=e[O],M+=R[1],A+=R[2],t.lineTo(M,A);break;case"L":R=e[O],M=R[1],A=R[2],t.lineTo(M,A);break;case"H":R=e[O],M=R[1],t.lineTo(M,A);break;case"h":R=e[O],M+=R[1],t.lineTo(M,A);break;case"V":R=e[O],A=R[1],t.lineTo(M,A);break;case"v":R=e[O],A+=R[1],t.lineTo(M,A);break;case"a":case"A":if(R=e[O],null===B)throw new Error("This should never happen");"a"===w?(M+=R[6],A+=R[7]):(M=R[6],A=R[7]),y=R[1],v=R[2],h=R[3]*Math.PI/180,s=!!R[4],r=!!R[5],a={x:M,y:A},o={x:(B.x-a.x)/2,y:(B.y-a.y)/2},p(o,-h),l=o.x*o.x/(y*y)+o.y*o.y/(v*v),l>1&&(l=Math.sqrt(l),y*=l,v*=l),_={x:y*o.y/v,y:-v*o.x/y},u=y*y*v*v,c=y*y*o.y*o.y+v*v*o.x*o.x,f(_,r!==s?Math.sqrt((u-c)/c)||0:-Math.sqrt((u-c)/c)||0),n=Math.atan2((o.y-_.y)/v,(o.x-_.x)/y),i=Math.atan2(-(o.y+_.y)/v,-(o.x+_.x)/y),p(_,h),P=_,k=(a.x+B.x)/2,N=(a.y+B.y)/2,P.x+=k,P.y+=N,t.save(),t.translate(_.x,_.y),t.rotate(h),t.scale(y,v),t.arc(0,0,1,n,i,!r),t.restore();break;case"C":R=e[O],T=R[3],C=R[4],M=R[5],A=R[6],t.bezierCurveTo(R[1],R[2],T,C,M,A);break;case"c":R=e[O],t.bezierCurveTo(R[1]+M,R[2]+A,R[3]+M,R[4]+A,R[5]+M,R[6]+A),T=R[3]+M,C=R[4]+A,M+=R[5],A+=R[6];break;case"S":R=e[O],null!==T&&null!==C||(T=M,C=A),t.bezierCurveTo(2*M-T,2*A-C,R[1],R[2],R[3],R[4]),T=R[1],C=R[2],M=R[3],A=R[4];break;case"s":R=e[O],null!==T&&null!==C||(T=M,C=A),t.bezierCurveTo(2*M-T,2*A-C,R[1]+M,R[2]+A,R[3]+M,R[4]+A),T=R[1]+M,C=R[2]+A,M+=R[3],A+=R[4];break;case"Q":R=e[O],I=R[1],D=R[2],M=R[3],A=R[4],t.quadraticCurveTo(I,D,M,A);break;case"q":R=e[O],I=R[1]+M,D=R[2]+A,M+=R[3],A+=R[4],t.quadraticCurveTo(I,D,M,A);break;case"T":R=e[O],null!==I&&null!==D||(I=M,D=A),I=2*M-I,D=2*A-D,M=R[1],A=R[2],t.quadraticCurveTo(I,D,M,A);break;case"t":R=e[O],null!==I&&null!==D||(I=M,D=A),I=2*M-I,D=2*A-D,M+=R[1],A+=R[2],t.quadraticCurveTo(I,D,M,A);break;case"z":case"Z":L&&(M=L.x,A=L.y),L=null,t.closePath();break;case"AC":R=e[O],M=R[1],A=R[2],g=R[3],n=R[4],i=R[5],S=R[6],t.arc(M,A,g,n,i,S);break;case"AT":R=e[O],d=R[1],m=R[2],M=R[3],A=R[4],g=R[5],t.arcTo(d,m,M,A,g);break;case"E":R=e[O],M=R[1],A=R[2],y=R[3],v=R[4],h=R[5],n=R[6],i=R[7],S=R[8],t.save(),t.translate(M,A),t.rotate(h),t.scale(y,v),t.arc(0,0,1,n,i,S),t.restore();break;case"R":R=e[O],M=R[1],A=R[2],x=R[3],b=R[4],L={x:M,y:A},t.rect(M,A,x,b);break;case"RR":R=e[O],M=R[1],A=R[2],x=R[3],b=R[4],E=R[5],L={x:M,y:A},t.roundRect(M,A,x,b,E)}B?(B.x=M,B.y=A):B={x:M,y:A}}var P,k,N}const y={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},v=/([astvzqmhlc])([^astvzqmhlc]*)/gi,x=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;const b={name:"TinyEngine",containerId:"tinyEngine",canvas:"tinyEngine",width:0,height:0,aspect:1,dpr:1,alpha:!0,color:"#232323",fps:60,syncDelay:1500,animateDuration:500,fnEnable:!1,pointerPosition:!0,mergeRendering:!1,sliceRendering:!0,sliceDuration:15,usedCache:!1,separateCache:!1,debounceCache:!0,dynamicLoading:!0,svgLoadingType:0,instancedMesh:!0,showPoints:!1,wireframe:!1,castShadow:!1,workerRender:!1,monitorDuration:1e4,light:{color:"#ffffff",intensity:.8,position:[-6,6,0],castShadow:!0,shadowBlur:16,helperSize:100,helperColor:16776960,helperEnable:!1},camera:{type:0,left:-1,right:1,top:1,bottom:-1,aspect:1,near:1,far:2e3,eye:[0,0,0],up:[0,0,1],helperEnable:!1},controls:{target:[0,0,0],minDistance:.1,maxDistance:1e3,enableHover:!0,enablePan:!0,enableRotate:!1,enableZoom:!0,focusMode:!0,autoRotate:!1,autoRotateSpeed:.5,enableDamping:!0,dampingFactor:.2},gridHelper:{fill:"#e3e3e3"},axesHelper:{},displayUnits:"",tooltip:!0,assetType:"rm",zoomToSelectEnable:!1,selectEnable:!1,multiSelectEnable:!1,socialDistanceEnable:!1,socialDistance:{radius:3},editorMode:0,editor:{fill:"#F26666",stroke:"#D95970",strokeWidth:5,fontSize:25},dummy:{radius:15}};var w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function _(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var S={},E={};function M(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.freeze?e.freeze(t):t}var A=M({HTML:"text/html",isHTML:function(t){return t===A.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),T=M({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===T.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});E.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},E.find=function(t,e,i){if(void 0===i&&(i=Array.prototype),t&&"function"==typeof i.find)return i.find.call(t,e);for(var n=0;n<t.length;n++)if(Object.prototype.hasOwnProperty.call(t,n)){var s=t[n];if(e.call(void 0,s,n,t))return s}},E.freeze=M,E.MIME_TYPE=A,E.NAMESPACE=T;var C=E,I=C.find,D=C.NAMESPACE;function L(t){return""!==t}function B(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function P(t){if(!t)return[];var e=function(t){return t?t.split(/[\t\n\f\r ]+/).filter(L):[]}(t);return Object.keys(e.reduce(B,{}))}function k(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}function N(t,e){var i=t.prototype;if(!(i instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,k(i,n),t.prototype=i=n}i.constructor!=t&&(i.constructor=t)}var O={},R=O.ELEMENT_NODE=1,z=O.ATTRIBUTE_NODE=2,H=O.TEXT_NODE=3,W=O.CDATA_SECTION_NODE=4,F=O.ENTITY_REFERENCE_NODE=5,U=O.ENTITY_NODE=6,V=O.PROCESSING_INSTRUCTION_NODE=7,q=O.COMMENT_NODE=8,j=O.DOCUMENT_NODE=9,Y=O.DOCUMENT_TYPE_NODE=10,G=O.DOCUMENT_FRAGMENT_NODE=11,$=O.NOTATION_NODE=12,X={},Z={};X.INDEX_SIZE_ERR=(Z[1]="Index size error",1),X.DOMSTRING_SIZE_ERR=(Z[2]="DOMString size error",2);var J=X.HIERARCHY_REQUEST_ERR=(Z[3]="Hierarchy request error",3);X.WRONG_DOCUMENT_ERR=(Z[4]="Wrong document",4),X.INVALID_CHARACTER_ERR=(Z[5]="Invalid character",5),X.NO_DATA_ALLOWED_ERR=(Z[6]="No data allowed",6),X.NO_MODIFICATION_ALLOWED_ERR=(Z[7]="No modification allowed",7);var Q=X.NOT_FOUND_ERR=(Z[8]="Not found",8);X.NOT_SUPPORTED_ERR=(Z[9]="Not supported",9);var K=X.INUSE_ATTRIBUTE_ERR=(Z[10]="Attribute in use",10);function tt(t,e){if(e instanceof Error)var i=e;else i=this,Error.call(this,Z[t]),this.message=Z[t],Error.captureStackTrace&&Error.captureStackTrace(this,tt);return i.code=t,e&&(this.message=this.message+": "+e),i}function et(){}function it(t,e){this._node=t,this._refresh=e,nt(this)}function nt(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var i=t._refresh(t._node);if(qt(t,"length",i.length),!t.$$length||i.length<t.$$length)for(var n=i.length;n in t;n++)Object.prototype.hasOwnProperty.call(t,n)&&delete t[n];k(i,t),t._inc=e}}function st(){}function rt(t,e){for(var i=t.length;i--;)if(t[i]===e)return i}function at(t,e,i,n){if(n?e[rt(e,n)]=i:e[e.length++]=i,t){i.ownerElement=t;var s=t.ownerDocument;s&&(n&&pt(s,t,n),function(t,e,i){t&&t._inc++;var n=i.namespaceURI;n===D.XMLNS&&(e._nsMap[i.prefix?i.localName:""]=i.value)}(s,t,i))}}function ot(t,e,i){var n=rt(e,i);if(!(n>=0))throw new tt(Q,new Error(t.tagName+"@"+i));for(var s=e.length-1;n<s;)e[n]=e[++n];if(e.length=s,t){var r=t.ownerDocument;r&&(pt(r,t,i),i.ownerElement=null)}}function ht(){}function lt(){}function ut(t){return("<"==t?"<":">"==t&&">")||"&"==t&&"&"||'"'==t&&"""||"&#"+t.charCodeAt()+";"}function ct(t,e){if(e(t))return!0;if(t=t.firstChild)do{if(ct(t,e))return!0}while(t=t.nextSibling)}function dt(){this.ownerDocument=this}function pt(t,e,i,n){t&&t._inc++,i.namespaceURI===D.XMLNS&&delete e._nsMap[i.prefix?i.localName:""]}function ft(t,e,i){if(t&&t._inc){t._inc++;var n=e.childNodes;if(i)n[n.length++]=i;else{for(var s=e.firstChild,r=0;s;)n[r++]=s,s=s.nextSibling;n.length=r,delete n[n.length]}}}function mt(t,e){var i=e.previousSibling,n=e.nextSibling;return i?i.nextSibling=n:t.firstChild=n,n?n.previousSibling=i:t.lastChild=i,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,ft(t.ownerDocument,t),e}function gt(t){return t&&t.nodeType===lt.DOCUMENT_TYPE_NODE}function yt(t){return t&&t.nodeType===lt.ELEMENT_NODE}function vt(t){return t&&t.nodeType===lt.TEXT_NODE}function xt(t,e){var i=t.childNodes||[];if(I(i,yt)||gt(e))return!1;var n=I(i,gt);return!(e&&n&&i.indexOf(n)>i.indexOf(e))}function bt(t,e){var i=t.childNodes||[];if(I(i,(function(t){return yt(t)&&t!==e})))return!1;var n=I(i,gt);return!(e&&n&&i.indexOf(n)>i.indexOf(e))}function wt(t,e,i){if(!function(t){return t&&(t.nodeType===lt.DOCUMENT_NODE||t.nodeType===lt.DOCUMENT_FRAGMENT_NODE||t.nodeType===lt.ELEMENT_NODE)}(t))throw new tt(J,"Unexpected parent node type "+t.nodeType);if(i&&i.parentNode!==t)throw new tt(Q,"child not in parent");if(!function(t){return t&&(yt(t)||vt(t)||gt(t)||t.nodeType===lt.DOCUMENT_FRAGMENT_NODE||t.nodeType===lt.COMMENT_NODE||t.nodeType===lt.PROCESSING_INSTRUCTION_NODE)}(e)||gt(e)&&t.nodeType!==lt.DOCUMENT_NODE)throw new tt(J,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function _t(t,e,i){var n=t.childNodes||[],s=e.childNodes||[];if(e.nodeType===lt.DOCUMENT_FRAGMENT_NODE){var r=s.filter(yt);if(r.length>1||I(s,vt))throw new tt(J,"More than one element or text in fragment");if(1===r.length&&!xt(t,i))throw new tt(J,"Element in fragment can not be inserted before doctype")}if(yt(e)&&!xt(t,i))throw new tt(J,"Only one element can be added and only after doctype");if(gt(e)){if(I(n,gt))throw new tt(J,"Only one doctype is allowed");var a=I(n,yt);if(i&&n.indexOf(a)<n.indexOf(i))throw new tt(J,"Doctype can only be inserted before an element");if(!i&&a)throw new tt(J,"Doctype can not be appended since element is present")}}function St(t,e,i){var n=t.childNodes||[],s=e.childNodes||[];if(e.nodeType===lt.DOCUMENT_FRAGMENT_NODE){var r=s.filter(yt);if(r.length>1||I(s,vt))throw new tt(J,"More than one element or text in fragment");if(1===r.length&&!bt(t,i))throw new tt(J,"Element in fragment can not be inserted before doctype")}if(yt(e)&&!bt(t,i))throw new tt(J,"Only one element can be added and only after doctype");if(gt(e)){if(I(n,(function(t){return gt(t)&&t!==i})))throw new tt(J,"Only one doctype is allowed");var a=I(n,yt);if(i&&n.indexOf(a)<n.indexOf(i))throw new tt(J,"Doctype can only be inserted before an element")}}function Et(t,e,i,n){wt(t,e,i),t.nodeType===lt.DOCUMENT_NODE&&(n||_t)(t,e,i);var s=e.parentNode;if(s&&s.removeChild(e),e.nodeType===G){var r=e.firstChild;if(null==r)return e;var a=e.lastChild}else r=a=e;var o=i?i.previousSibling:t.lastChild;r.previousSibling=o,a.nextSibling=i,o?o.nextSibling=r:t.firstChild=r,null==i?t.lastChild=a:i.previousSibling=a;do{r.parentNode=t}while(r!==a&&(r=r.nextSibling));return ft(t.ownerDocument||t,t),e.nodeType==G&&(e.firstChild=e.lastChild=null),e}function Mt(){this._nsMap={}}function At(){}function Tt(){}function Ct(){}function It(){}function Dt(){}function Lt(){}function Bt(){}function Pt(){}function kt(){}function Nt(){}function Ot(){}function Rt(){}function zt(t,e){var i=[],n=9==this.nodeType&&this.documentElement||this,s=n.prefix,r=n.namespaceURI;if(r&&null==s&&null==(s=n.lookupPrefix(r)))var a=[{namespace:r,prefix:null}];return Ft(this,i,t,e,a),i.join("")}function Ht(t,e,i){var n=t.prefix||"",s=t.namespaceURI;if(!s)return!1;if("xml"===n&&s===D.XML||s===D.XMLNS)return!1;for(var r=i.length;r--;){var a=i[r];if(a.prefix===n)return a.namespace!==s}return!0}function Wt(t,e,i){t.push(" ",e,'="',i.replace(/[<>&"\t\n\r]/g,ut),'"')}function Ft(t,e,i,n,s){if(s||(s=[]),n){if(!(t=n(t)))return;if("string"==typeof t)return void e.push(t)}switch(t.nodeType){case R:var r=t.attributes,a=r.length,o=t.firstChild,h=t.tagName,l=h;if(!(i=D.isHTML(t.namespaceURI)||i)&&!t.prefix&&t.namespaceURI){for(var u,c=0;c<r.length;c++)if("xmlns"===r.item(c).name){u=r.item(c).value;break}if(!u)for(var d=s.length-1;d>=0;d--){if(""===(p=s[d]).prefix&&p.namespace===t.namespaceURI){u=p.namespace;break}}if(u!==t.namespaceURI)for(d=s.length-1;d>=0;d--){var p;if((p=s[d]).namespace===t.namespaceURI){p.prefix&&(l=p.prefix+":"+h);break}}}e.push("<",l);for(var f=0;f<a;f++){"xmlns"==(m=r.item(f)).prefix?s.push({prefix:m.localName,namespace:m.value}):"xmlns"==m.nodeName&&s.push({prefix:"",namespace:m.value})}for(f=0;f<a;f++){var m,g,y;if(Ht(m=r.item(f),0,s))Wt(e,(g=m.prefix||"")?"xmlns:"+g:"xmlns",y=m.namespaceURI),s.push({prefix:g,namespace:y});Ft(m,e,i,n,s)}if(h===l&&Ht(t,0,s))Wt(e,(g=t.prefix||"")?"xmlns:"+g:"xmlns",y=t.namespaceURI),s.push({prefix:g,namespace:y});if(o||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(h)){if(e.push(">"),i&&/^script$/i.test(h))for(;o;)o.data?e.push(o.data):Ft(o,e,i,n,s.slice()),o=o.nextSibling;else for(;o;)Ft(o,e,i,n,s.slice()),o=o.nextSibling;e.push("</",l,">")}else e.push("/>");return;case j:case G:for(o=t.firstChild;o;)Ft(o,e,i,n,s.slice()),o=o.nextSibling;return;case z:return Wt(e,t.name,t.value);case H:return e.push(t.data.replace(/[<&>]/g,ut));case W:return e.push("<![CDATA[",t.data,"]]>");case q:return e.push("\x3c!--",t.data,"--\x3e");case Y:var v=t.publicId,x=t.systemId;if(e.push("<!DOCTYPE ",t.name),v)e.push(" PUBLIC ",v),x&&"."!=x&&e.push(" ",x),e.push(">");else if(x&&"."!=x)e.push(" SYSTEM ",x,">");else{var b=t.internalSubset;b&&e.push(" [",b,"]"),e.push(">")}return;case V:return e.push("<?",t.target," ",t.data,"?>");case F:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function Ut(t,e,i){var n;switch(e.nodeType){case R:(n=e.cloneNode(!1)).ownerDocument=t;case G:break;case z:i=!0}if(n||(n=e.cloneNode(!1)),n.ownerDocument=t,n.parentNode=null,i)for(var s=e.firstChild;s;)n.appendChild(Ut(t,s,i)),s=s.nextSibling;return n}function Vt(t,e,i){var n=new e.constructor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var r=e[s];"object"!=typeof r&&r!=n[s]&&(n[s]=r)}switch(e.childNodes&&(n.childNodes=new et),n.ownerDocument=t,n.nodeType){case R:var a=e.attributes,o=n.attributes=new st,h=a.length;o._ownerElement=n;for(var l=0;l<h;l++)n.setAttributeNode(Vt(t,a.item(l),!0));break;case z:i=!0}if(i)for(var u=e.firstChild;u;)n.appendChild(Vt(t,u,i)),u=u.nextSibling;return n}function qt(t,e,i){t[e]=i}X.INVALID_STATE_ERR=(Z[11]="Invalid state",11),X.SYNTAX_ERR=(Z[12]="Syntax error",12),X.INVALID_MODIFICATION_ERR=(Z[13]="Invalid modification",13),X.NAMESPACE_ERR=(Z[14]="Invalid namespace",14),X.INVALID_ACCESS_ERR=(Z[15]="Invalid access",15),tt.prototype=Error.prototype,k(X,tt),et.prototype={length:0,item:function(t){return t>=0&&t<this.length?this[t]:null},toString:function(t,e){for(var i=[],n=0;n<this.length;n++)Ft(this[n],i,t,e);return i.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}},it.prototype.item=function(t){return nt(this),this[t]||null},N(it,et),st.prototype={length:0,item:et.prototype.item,getNamedItem:function(t){for(var e=this.length;e--;){var i=this[e];if(i.nodeName==t)return i}},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!=this._ownerElement)throw new tt(K);var i=this.getNamedItem(t.nodeName);return at(this._ownerElement,this,t,i),i},setNamedItemNS:function(t){var e,i=t.ownerElement;if(i&&i!=this._ownerElement)throw new tt(K);return e=this.getNamedItemNS(t.namespaceURI,t.localName),at(this._ownerElement,this,t,e),e},removeNamedItem:function(t){var e=this.getNamedItem(t);return ot(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var i=this.getNamedItemNS(t,e);return ot(this._ownerElement,this,i),i},getNamedItemNS:function(t,e){for(var i=this.length;i--;){var n=this[i];if(n.localName==e&&n.namespaceURI==t)return n}return null}},ht.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,i){var n=new dt;if(n.implementation=this,n.childNodes=new et,n.doctype=i||null,i&&n.appendChild(i),e){var s=n.createElementNS(t,e);n.appendChild(s)}return n},createDocumentType:function(t,e,i){var n=new Lt;return n.name=t,n.nodeName=t,n.publicId=e||"",n.systemId=i||"",n}},lt.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(t,e){return Et(this,t,e)},replaceChild:function(t,e){Et(this,t,e,St),e&&this.removeChild(e)},removeChild:function(t){return mt(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return Vt(this.ownerDocument||this,this,t)},normalize:function(){for(var t=this.firstChild;t;){var e=t.nextSibling;e&&e.nodeType==H&&t.nodeType==H?(this.removeChild(e),t.appendData(e.data)):(t.normalize(),t=e)}},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(t){for(var e=this;e;){var i=e._nsMap;if(i)for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&i[n]===t)return n;e=e.nodeType==z?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var i=e._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,t))return i[t];e=e.nodeType==z?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)}},k(O,lt),k(O,lt.prototype),dt.prototype={nodeName:"#document",nodeType:j,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==G){for(var i=t.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,e),i=n}return t}return Et(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===R&&(this.documentElement=t),t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),mt(this,t)},replaceChild:function(t,e){Et(this,t,e,St),t.ownerDocument=this,e&&this.removeChild(e),yt(t)&&(this.documentElement=t)},importNode:function(t,e){return Ut(this,t,e)},getElementById:function(t){var e=null;return ct(this.documentElement,(function(i){if(i.nodeType==R&&i.getAttribute("id")==t)return e=i,!0})),e},getElementsByClassName:function(t){var e=P(t);return new it(this,(function(i){var n=[];return e.length>0&&ct(i.documentElement,(function(s){if(s!==i&&s.nodeType===R){var r=s.getAttribute("class");if(r){var a=t===r;if(!a){var o=P(r);a=e.every((h=o,function(t){return h&&-1!==h.indexOf(t)}))}a&&n.push(s)}}var h})),n}))},createElement:function(t){var e=new Mt;return e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new et,(e.attributes=new st)._ownerElement=e,e},createDocumentFragment:function(){var t=new Nt;return t.ownerDocument=this,t.childNodes=new et,t},createTextNode:function(t){var e=new Ct;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new It;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new Dt;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var i=new Ot;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=t,i.nodeValue=i.data=e,i},createAttribute:function(t){var e=new At;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new kt;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var i=new Mt,n=e.split(":"),s=i.attributes=new st;return i.childNodes=new et,i.ownerDocument=this,i.nodeName=e,i.tagName=e,i.namespaceURI=t,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=e,s._ownerElement=i,i},createAttributeNS:function(t,e){var i=new At,n=e.split(":");return i.ownerDocument=this,i.nodeName=e,i.name=e,i.namespaceURI=t,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=e,i}},N(dt,lt),Mt.prototype={nodeType:R,hasAttribute:function(t){return null!=this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var i=this.ownerDocument.createAttribute(t);i.value=i.nodeValue=""+e,this.setAttributeNode(i)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===G?this.insertBefore(t,null):function(t,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=t,e.previousSibling=t.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,t.lastChild=e,ft(t.ownerDocument,t,e),e}(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);i&&this.removeAttributeNode(i)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);return i&&i.value||""},setAttributeNS:function(t,e,i){var n=this.ownerDocument.createAttributeNS(t,e);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new it(this,(function(e){var i=[];return ct(e,(function(n){n===e||n.nodeType!=R||"*"!==t&&n.tagName!=t||i.push(n)})),i}))},getElementsByTagNameNS:function(t,e){return new it(this,(function(i){var n=[];return ct(i,(function(s){s===i||s.nodeType!==R||"*"!==t&&s.namespaceURI!==t||"*"!==e&&s.localName!=e||n.push(s)})),n}))}},dt.prototype.getElementsByTagName=Mt.prototype.getElementsByTagName,dt.prototype.getElementsByTagNameNS=Mt.prototype.getElementsByTagNameNS,N(Mt,lt),At.prototype.nodeType=z,N(At,lt),Tt.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error(Z[J])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,i){i=this.data.substring(0,t)+i+this.data.substring(t+e),this.nodeValue=this.data=i,this.length=i.length}},N(Tt,lt),Ct.prototype={nodeName:"#text",nodeType:H,splitText:function(t){var e=this.data,i=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},N(Ct,Tt),It.prototype={nodeName:"#comment",nodeType:q},N(It,Tt),Dt.prototype={nodeName:"#cdata-section",nodeType:W},N(Dt,Tt),Lt.prototype.nodeType=Y,N(Lt,lt),Bt.prototype.nodeType=$,N(Bt,lt),Pt.prototype.nodeType=U,N(Pt,lt),kt.prototype.nodeType=F,N(kt,lt),Nt.prototype.nodeName="#document-fragment",Nt.prototype.nodeType=G,N(Nt,lt),Ot.prototype.nodeType=V,N(Ot,lt),Rt.prototype.serializeToString=function(t,e,i){return zt.call(t,e,i)},lt.prototype.toString=zt;try{if(Object.defineProperty){let t=function(e){switch(e.nodeType){case R:case G:var i=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&i.push(t(e)),e=e.nextSibling;return i.join("");default:return e.nodeValue}};Object.defineProperty(it.prototype,"length",{get:function(){return nt(this),this.$$length}}),Object.defineProperty(lt.prototype,"textContent",{get:function(){return t(this)},set:function(t){switch(this.nodeType){case R:case G:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),qt=function(t,e,i){t["$$"+e]=i}}}catch(t){}S.DocumentType=Lt,S.DOMException=tt,S.DOMImplementation=ht,S.Element=Mt,S.Node=lt,S.NodeList=et,S.XMLSerializer=Rt;var jt,Yt,Gt={},$t={};jt=$t,Yt=E.freeze,jt.XML_ENTITIES=Yt({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),jt.HTML_ENTITIES=Yt({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),jt.entityMap=jt.HTML_ENTITIES;var Xt={},Zt=E.NAMESPACE,Jt=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Qt=new RegExp("[\\-\\.0-9"+Jt.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Kt=new RegExp("^"+Jt.source+Qt.source+"*(?::"+Jt.source+Qt.source+"*)?$");function te(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,te)}function ee(){}function ie(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function ne(t,e,i,n,s,r){function a(t,e,n){i.attributeNames.hasOwnProperty(t)&&r.fatalError("Attribute "+t+" redefined"),i.addValue(t,e.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,s),n)}for(var o,h=++e,l=0;;){var u=t.charAt(h);switch(u){case"=":if(1===l)o=t.slice(e,h),l=3;else{if(2!==l)throw new Error("attribute equal must after attrName");l=3}break;case"'":case'"':if(3===l||1===l){if(1===l&&(r.warning('attribute value must after "="'),o=t.slice(e,h)),e=h+1,!((h=t.indexOf(u,e))>0))throw new Error("attribute value no end '"+u+"' match");a(o,c=t.slice(e,h),e-1),l=5}else{if(4!=l)throw new Error('attribute value must after "="');a(o,c=t.slice(e,h),e),r.warning('attribute "'+o+'" missed start quot('+u+")!!"),e=h+1,l=5}break;case"/":switch(l){case 0:i.setTagName(t.slice(e,h));case 5:case 6:case 7:l=7,i.closed=!0;case 4:case 1:break;case 2:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return r.error("unexpected end of input"),0==l&&i.setTagName(t.slice(e,h)),h;case">":switch(l){case 0:i.setTagName(t.slice(e,h));case 5:case 6:case 7:break;case 4:case 1:"/"===(c=t.slice(e,h)).slice(-1)&&(i.closed=!0,c=c.slice(0,-1));case 2:2===l&&(c=o),4==l?(r.warning('attribute "'+c+'" missed quot(")!'),a(o,c,e)):(Zt.isHTML(n[""])&&c.match(/^(?:disabled|checked|selected)$/i)||r.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),a(c,c,e));break;case 3:throw new Error("attribute value missed!!")}return h;case"":u=" ";default:if(u<=" ")switch(l){case 0:i.setTagName(t.slice(e,h)),l=6;break;case 1:o=t.slice(e,h),l=2;break;case 4:var c=t.slice(e,h);r.warning('attribute "'+c+'" missed quot(")!!'),a(o,c,e);case 5:l=6}else switch(l){case 2:i.tagName,Zt.isHTML(n[""])&&o.match(/^(?:disabled|checked|selected)$/i)||r.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=h,l=1;break;case 5:r.warning('attribute space is required"'+o+'"!!');case 6:l=1,e=h;break;case 3:l=4,e=h;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function se(t,e,i){for(var n=t.tagName,s=null,r=t.length;r--;){var a=t[r],o=a.qName,h=a.value;if((d=o.indexOf(":"))>0)var l=a.prefix=o.slice(0,d),u=o.slice(d+1),c="xmlns"===l&&u;else u=o,l=null,c="xmlns"===o&&"";a.localName=u,!1!==c&&(null==s&&(s={},oe(i,i={})),i[c]=s[c]=h,a.uri=Zt.XMLNS,e.startPrefixMapping(c,h))}for(r=t.length;r--;){(l=(a=t[r]).prefix)&&("xml"===l&&(a.uri=Zt.XML),"xmlns"!==l&&(a.uri=i[l||""]))}var d;(d=n.indexOf(":"))>0?(l=t.prefix=n.slice(0,d),u=t.localName=n.slice(d+1)):(l=null,u=t.localName=n);var p=t.uri=i[l||""];if(e.startElement(p,u,n,t),!t.closed)return t.currentNSMap=i,t.localNSMap=s,!0;if(e.endElement(p,u,n),s)for(l in s)Object.prototype.hasOwnProperty.call(s,l)&&e.endPrefixMapping(l)}function re(t,e,i,n,s){if(/^(?:script|textarea)$/i.test(i)){var r=t.indexOf("</"+i+">",e),a=t.substring(e+1,r);if(/[&<]/.test(a))return/^script$/i.test(i)?(s.characters(a,0,a.length),r):(a=a.replace(/&#?\w+;/g,n),s.characters(a,0,a.length),r)}return e+1}function ae(t,e,i,n){var s=n[i];return null==s&&((s=t.lastIndexOf("</"+i+">"))<e&&(s=t.lastIndexOf("</"+i)),n[i]=s),s<e}function oe(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}function he(t,e,i,n){if("-"===t.charAt(e+2))return"-"===t.charAt(e+3)?(s=t.indexOf("--\x3e",e+4))>e?(i.comment(t,e+4,s-e-4),s+3):(n.error("Unclosed comment"),-1):-1;if("CDATA["==t.substr(e+3,6)){var s=t.indexOf("]]>",e+9);return i.startCDATA(),i.characters(t,e+9,s-e-9),i.endCDATA(),s+3}var r=function(t,e){var i,n=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;s.lastIndex=e,s.exec(t);for(;i=s.exec(t);)if(n.push(i),i[1])return n}(t,e),a=r.length;if(a>1&&/!doctype/i.test(r[0][0])){var o=r[1][0],h=!1,l=!1;a>3&&(/^public$/i.test(r[2][0])?(h=r[3][0],l=a>4&&r[4][0]):/^system$/i.test(r[2][0])&&(l=r[3][0]));var u=r[a-1];return i.startDTD(o,h,l),i.endDTD(),u.index+u[0].length}return-1}function le(t,e,i){var n=t.indexOf("?>",e);if(n){var s=t.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return s?(s[0].length,i.processingInstruction(s[1],s[2]),n+2):-1}return-1}function ue(){this.attributeNames={}}te.prototype=new Error,te.prototype.name=te.name,ee.prototype={parse:function(t,e,i){var n=this.domBuilder;n.startDocument(),oe(e,e={}),function(t,e,i,n,s){function r(t){if(t>65535){var e=55296+((t-=65536)>>10),i=56320+(1023&t);return String.fromCharCode(e,i)}return String.fromCharCode(t)}function a(t){var e=t.slice(1,-1);return Object.hasOwnProperty.call(i,e)?i[e]:"#"===e.charAt(0)?r(parseInt(e.substr(1).replace("x","0x"))):(s.error("entity not found:"+t),t)}function o(e){if(e>m){var i=t.substring(m,e).replace(/&#?\w+;/g,a);d&&h(m),n.characters(i,0,e-m),m=e}}function h(e,i){for(;e>=u&&(i=c.exec(t));)l=i.index,u=l+i[0].length,d.lineNumber++;d.columnNumber=e-l+1}var l=0,u=0,c=/.*(?:\r\n?|\n)|.*$/g,d=n.locator,p=[{currentNSMap:e}],f={},m=0;for(;;){try{var g=t.indexOf("<",m);if(g<0){if(!t.substr(m).match(/^\s*$/)){var y=n.doc,v=y.createTextNode(t.substr(m));y.appendChild(v),n.currentElement=v}return}switch(g>m&&o(g),t.charAt(g+1)){case"/":var x=t.indexOf(">",g+3),b=t.substring(g+2,x).replace(/[ \t\n\r]+$/g,""),w=p.pop();x<0?(b=t.substring(g+2).replace(/[\s<].*/,""),s.error("end tag name: "+b+" is not complete:"+w.tagName),x=g+1+b.length):b.match(/\s</)&&(b=b.replace(/[\s<].*/,""),s.error("end tag name: "+b+" maybe not complete"),x=g+1+b.length);var _=w.localNSMap,S=w.tagName==b;if(S||w.tagName&&w.tagName.toLowerCase()==b.toLowerCase()){if(n.endElement(w.uri,w.localName,b),_)for(var E in _)Object.prototype.hasOwnProperty.call(_,E)&&n.endPrefixMapping(E);S||s.fatalError("end tag name: "+b+" is not match the current start tagName:"+w.tagName)}else p.push(w);x++;break;case"?":d&&h(g),x=le(t,g,n);break;case"!":d&&h(g),x=he(t,g,n,s);break;default:d&&h(g);var M=new ue,A=p[p.length-1].currentNSMap,T=(x=ne(t,g,M,A,a,s),M.length);if(!M.closed&&ae(t,x,M.tagName,f)&&(M.closed=!0,i.nbsp||s.warning("unclosed xml attribute")),d&&T){for(var C=ie(d,{}),I=0;I<T;I++){var D=M[I];h(D.offset),D.locator=ie(d,{})}n.locator=C,se(M,n,A)&&p.push(M),n.locator=d}else se(M,n,A)&&p.push(M);Zt.isHTML(M.uri)&&!M.closed?x=re(t,x,M.tagName,a,n):x++}}catch(t){if(t instanceof te)throw t;s.error("element parse error: "+t),x=-1}x>m?m=x:o(Math.max(g,m)+1)}}(t,e,i,n,this.errorHandler),n.endDocument()}},ue.prototype={setTagName:function(t){if(!Kt.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,i){if(!Kt.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:i}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},Xt.XMLReader=ee,Xt.ParseError=te;var ce=E,de=$t,pe=Xt,fe=S.DOMImplementation,me=ce.NAMESPACE,ge=pe.ParseError,ye=pe.XMLReader;function ve(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function xe(t){this.options=t||{locator:{}}}function be(){this.cdata=!1}function we(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function _e(t,e,i){return"string"==typeof t?t.substr(e,i):t.length>=e+i||e?new java.lang.String(t,e,i)+"":t}function Se(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}xe.prototype.parseFromString=function(t,e){var i=this.options,n=new ye,s=i.domBuilder||new be,r=i.errorHandler,a=i.locator,o=i.xmlns||{},h=/\/x?html?$/.test(e),l=h?de.HTML_ENTITIES:de.XML_ENTITIES;a&&s.setDocumentLocator(a),n.errorHandler=function(t,e,i){if(!t){if(e instanceof be)return e;t=e}var n={},s=t instanceof Function;function r(e){var r=t[e];!r&&s&&(r=2==t.length?function(i){t(e,i)}:t),n[e]=r&&function(t){r("[xmldom "+e+"]\t"+t+function(t){if(t)return"\n@"+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}(i))}||function(){}}return i=i||{},r("warning"),r("error"),r("fatalError"),n}(r,s,a),n.domBuilder=i.domBuilder||s,h&&(o[""]=me.HTML),o.xml=o.xml||me.XML;var u=i.normalizeLineEndings||ve;return t&&"string"==typeof t?n.parse(u(t),o,l):n.errorHandler.error("invalid doc source"),s.doc},be.prototype={startDocument:function(){this.doc=(new fe).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,i,n){var s=this.doc,r=s.createElementNS(t,i||e),a=n.length;Se(this,r),this.currentElement=r,this.locator&&we(this.locator,r);for(var o=0;o<a;o++){t=n.getURI(o);var h=n.getValue(o),l=(i=n.getQName(o),s.createAttributeNS(t,i));this.locator&&we(n.getLocator(o),l),l.value=l.nodeValue=h,r.setAttributeNode(l)}},endElement:function(t,e,i){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var i=this.doc.createProcessingInstruction(t,e);this.locator&&we(this.locator,i),Se(this,i)},ignorableWhitespace:function(t,e,i){},characters:function(t,e,i){if(t=_e.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(t);else n=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(t)&&this.doc.appendChild(n),this.locator&&we(this.locator,n)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,e,i){t=_e.apply(this,arguments);var n=this.doc.createComment(t);this.locator&&we(this.locator,n),Se(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,i){var n=this.doc.implementation;if(n&&n.createDocumentType){var s=n.createDocumentType(t,e,i);this.locator&&we(this.locator,s),Se(this,s),this.doc.doctype=s}},warning:function(t){},error:function(t){},fatalError:function(t){throw new ge(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(t){be.prototype[t]=function(){return null}})),Gt.__DOMHandler=be,Gt.normalizeLineEndings=ve,Gt.DOMParser=xe;var Ee=Gt.DOMParser;const Me="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{document:void 0,tinyEngine:void 0};Me.Path2D||function(t){if(!t||!t.CanvasRenderingContext2D||t.Path2D)return;const{CanvasRenderingContext2D:e}=t,i=null==e?void 0:e.prototype.fill,n=null==e?void 0:e.prototype.stroke,s=null==e?void 0:e.prototype.isPointInPath;e.prototype.fill=function(...t){if(!(t[0]instanceof m)){const e=t[0]||"nonzero";return i.apply(this,[e])}{const e=t[0],n=t[1]||"nonzero";g(this,e.commands),i.apply(this,[n])}},e.prototype.stroke=function(t){t&&g(this,t.commands),n.apply(this)},e.prototype.isPointInPath=function(...t){if(t[0]instanceof m){const e=t[0],i=t[1],n=t[2],r=t[3]||"nonzero";return g(this,e.commands),s.apply(this,[i,n,r])}return s.apply(this,t)},t.Path2D=m}(Me),Me.DOMParser||(Me.DOMParser=Ee);const Ae={window:Me,version:"2.0.11",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),dpr:1,document:Me.document,time:0,deltaTime:0,config:b},Te=(t,e,i)=>Math.max(e,Math.min(i,t)),Ce=(t,e=1e-6)=>Math.abs(t)<e?0:t<0?-1:1,Ie=t=>t*(Math.PI/180),De=(t,e,i)=>(1-i)*t+i*e,Le={transparent:"rgba(1, 1, 1, 0)",green:"#45b787",darkGreen:"#21532fff",blue:"#6e9bc5",darkBlue:"#2775b6",red:"#F26666",darkRed:"#D95970",brown:"#ECD2B9",darkBrown:"#BF9D8A",yellow:"#ECDEC0",darkYellow:"#D0AC57",lightGray:"#e0e0e0",gray:"#beb6b6",darkGray:"#918883",white:"#F2F2F2",darkWhite:"#ececec",lightBlack:"#2E3032",black:"#182327",blackAlpha5:"rgba(0, 0, 0, 0.5)"},Be={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},Pe={h:0,s:0,l:0},ke={h:0,s:0,l:0};function Ne(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}const Oe=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$|rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)|rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*[\d.]+\s*\)/;let Re=class t{constructor(t,e,i,n){return c(this,"isColor",!0),c(this,"r",1),c(this,"g",1),c(this,"b",1),c(this,"a",1),void 0===e&&void 0===i?this.set(t):this.setRGBA(t,e,i,n)}static isColor(t){return"string"==typeof t?Oe.test(t):"number"==typeof t&&(Number.isInteger(t)&&t>=0&&t<=16777215&&6===t.toString(6).length)}static getRandomStyle(t){return t?ze.random().setA(t).getStyle():ze.random().getStyle()}static getDarken(t,e=.8){return ze.set(t).getHSL(He),ze.setHSL(He.h,He.s,He.l*e).getStyle()}static getLighten(t,e=1.2){return this.getDarken(t,e)}static getContrast(t){return ze.set(t),ze.getContrastString()}static getArray(t){return ze.set(t).toArray()}static getComplementary(t){return ze.set(t),ze.getComplementaryString()}static getMoreTransparent(t,e){return ze.set(t).setA(e).getStyle()}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}random(){return this.setHex(Math.floor(Math.random()*(1<<24)))}setScalar(t){return this.r=t,this.g=t,this.b=t,this.a=1,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this.a=1,this}setR(t){return this.r=t,this}setG(t){return this.g=t,this}setB(t){return this.b=t,this}setA(t){return this.a=t,this}setRGB(t,e,i){return this.setRGBA(t,e,i,this.a)}setRGBA(t,e,i,n=1){return this.r=t,this.g=e,this.b=i,this.a=n,this}setHSL(t,e,i,n=1){var s;if(t=(t%(s=1)+s)%s,e=Te(e,0,1),i=Te(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,s=2*i-n;this.r=Ne(s,n,t+1/3),this.g=Ne(s,n,t),this.b=Ne(s,n,t-1/3)}return this.a=n,this}setStyle(t){let e;if(e=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const i=e[1],n=e[2];switch(i){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,this.a=Math.max(Math.min(1,void 0!==t[4]?parseFloat(t[4]):1),0),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,this.a=Math.max(Math.min(1,void 0!==t[4]?parseFloat(t[4]):1),0),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n)){const e=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,n=parseInt(t[3],10)/100,s=Math.max(Math.min(1,void 0!==t[4]?parseFloat(t[4]):1),0);return this.setHSL(e,i,n,s)}}}else if(e=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=e[1],i=t.length;if(3===i)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this.a=1,this;if(6===i)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this.a=1,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=Be[t.toLowerCase()];return void 0!==e&&this.setHex(e),this}clone(){return new t(this.r,this.g,this.b,this.a)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}getRGB(e=new t){return e.setRGB(this.r,this.g,this.b)}getRGBByBg(e=new t){const i=this.a,n=i*this.r+(1-i)*e.r,s=i*this.g+(1-i)*e.g,r=i*this.b+(1-i)*e.b;return new t(n,s,r)}getHex(){return Te(255*this.r,0,255)<<16^Te(255*this.g,0,255)<<8^Te(255*this.b,0,255)}getHSL(t){const e=this.r,i=this.g,n=this.b,s=Math.max(e,i,n),r=Math.min(e,i,n);let a,o=0;const h=(r+s)/2;if(r===s)o=0,a=0;else{const t=s-r;switch(a=h<=.5?t/(s+r):t/(2-s-r),s){case e:o=(i-n)/t+(i<n?6:0);break;case i:o=(n-e)/t+2;break;case n:o=(e-i)/t+4}o/=6}return t.h=o,t.s=a,t.l=h,t}getStyle(){return 1===this.a?`rgb(${255*this.r|0},${255*this.g|0},${255*this.b|0})`:`rgba(${255*this.r|0},${255*this.g|0},${255*this.b|0},${this.a||1})`}getHexString(){return"#"+("000000"+this.getHex().toString(16)).slice(-6)}getBrightness(){let t=(255*this.r*299+255*this.g*587+255*this.b*144)/1e3;return t+=(255-t)*(255-255*this.a)/255,t}getContrastString(){return this.getBrightness()>125?"#2f2f2f":"#f2f2f2"}getComplementary(e=new t){const i=this.toArray(),n=[0,0,0,1];for(let t=0;t<i.length;t++)if(t<3)n[t]=1-i[t];else{if(3!==t)continue;i[t]>1||i[t]<=0?n[t]=1:n[t]=Math.max(Math.min(parseFloat(i[t].toFixed(2)),1),0)}return e.setRGBA(n[0],n[1],n[2],parseFloat(n[3].toFixed(2)))}getComplementaryString(){return this.getComplementary().getStyle()}getLightenOrDarken(e){if(void 0===e||e>=1)return this.getHexString();const i=this.getRGBByBg(),n=i.r*e+(1-e),s=i.g*e+(1-e),r=i.b*e+(1-e);return new t(n,s,r).getHexString()}getNormalized(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.a,1),0).toFixed(2))]}getNormalized3(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2))]}offsetHSL(t,e,i){return this.getHSL(Pe),Pe.h+=t,Pe.s+=e,Pe.l+=i,this.setHSL(Pe.h,Pe.s,Pe.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Pe),t.getHSL(ke);const i=De(Pe.h,ke.h,e),n=De(Pe.s,ke.s,e),s=De(Pe.l,ke.l,e);return this.setHSL(i,n,s),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this.a=t[e+3],this}toArray(t=[0,0,0,0],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const ze=new Re,He={h:0,s:0,l:0};let We=class t{constructor(t=0,e=0,i){c(this,"isVector2",!0),c(this,"x",0),c(this,"y",0),c(this,"z"),this.x=t,this.y=e,this.z=i||0}static isZero(t){return 0===t.x&&0===t.y}static isEmpty(t){return!Number.isFinite(t.x)&&!Number.isFinite(t.y)}static equals(t,e,i=!0){return i?t.x===e.x&&t.y===e.y:Math.abs(t.x-e.x)<Ue&&Math.abs(t.y-e.y)<Ue}static getInt32Array(t,e=2){const i=new ArrayBuffer(t.length*e*4),n=new Int32Array(i);for(let e=0,i=t.length;e<i;e++)n[2*e]=t[e].x,n[2*e+1]=t[e].y;return n}static getFloat64Array(t,e=2){const i=new ArrayBuffer(t.length*e*8),n=new Float64Array(i);for(let e=0,i=t.length;e<i;e++)n[2*e]=t[e].x,n[2*e+1]=t[e].y;return n}static getVectors(e){const i=[];for(let n=0,s=e.length;n<s;n++)i.push(new t(e[n].x,e[n].y));return i}static getStrings(e){const i=[];if(!e||!e.length)return"";for(let n=0,s=e.length;n<s;n++)i.push(t.getString(e[n]));return i.join(",")}static getString(t){return`${t.x},${t.y}`}static getLength(t){return Math.sqrt(t.x*t.x+t.y*t.y)}static getDistance(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}static distanceToPolygon(t,e){let i=1/0;for(let n=0,s=e.length-1;n<e.length;s=n++){const r=e[n].x,a=e[n].y,o=e[s].x-r,h=e[s].y-a,l=Math.sqrt(o*o+h*h);if(l>0){const e=Math.max(0,Math.min(1,((t.x-r)*o+(t.y-a)*h)/(l*l))),n=r+e*o,s=a+e*h,u=Math.sqrt((t.x-n)*(t.x-n)+(t.y-s)*(t.y-s));i=Math.min(i,u)}}return i}static dot(t,e){return t.x*e.x+t.y*e.y}static cross(t,e){return t.x*e.y-t.y*e.x}static sub(e,i){return(new t).subVectors(e,i)}static isPointOnSegment(t,e,i){return 0===Ce(this.sub(t,i).cross(this.sub(e,i)))&&Ce(this.sub(t,i).dot(this.sub(e,i)))<=0}static angle(t,e,i){return i?Math.atan2(t.y-e.y,t.x-e.x):(t=>{let e=t*(180/Math.PI);return e<0&&(e+=360),e>360&&(e-=360),e})(Math.atan2(t.y-e.y,t.x-e.x))}static getSamplingPoints(t,e=100){let i=this.getClothoidPoints(t,e),n=0;for(let t=0,e=i.length;t<e;t++){let e=Math.max(0,t-1);t>0?n+=this.getDistance(i[e],i[e+1]):n=0,i[t].l=Math.round(n);let s=this.angle(i[e+1],i[e]);i[t].a=Math.round(100*s)/100}return i}static getClothoidPoints(e,i=100){let n=[],s=e.concat([]);if(!s||s.length<2)return n;2===s.length?(s.push(s[1]),s.unshift(s[0])):3===s.length&&s.splice(2,0,s[1]);for(let e=0;e<s.length-3;e+=3){let r=new t(s[e].x,s[e].y),a=new t(s[e+1].x,s[e+1].y),o=new t(s[e+2].x,s[e+2].y),h=new t(s[e+3].x,s[e+3].y),l=0;l+=r.distanceTo(a),l+=a.distanceTo(o),l+=o.distanceTo(h);let u=Math.min(.5,1/(l/i));for(let t=u;t<1;t+=u){let e=3*(a.x-r.x),i=3*(o.x-a.x)-e,s=h.x-r.x-e-i,l=3*(a.y-r.y),u=3*(o.y-a.y)-l,c=h.y-r.y-l-u,d=s*Math.pow(t,3)+i*Math.pow(t,2)+e*t+r.x,p=c*Math.pow(t,3)+u*Math.pow(t,2)+l*t+r.y;n.push({x:Math.round(d),y:Math.round(p),a:0,l:0})}}return n.unshift({x:s[0].x,y:s[0].y,a:0,l:0}),n.push({x:s[s.length-1].x,y:s[s.length-1].y,a:0,l:0}),n}static getClothoidLength(t){let e=0;if(t.length>2)for(let i=0;i<t.length;i++){let n=Math.max(0,i-1);i>0&&(e+=this.getDistance(t[n],t[n+1]))}return e}static getCircleCenterByChord(e,i,n,s=!0,r=new t){const a=this.getDistance(e,i);if(0===a)return r.x=1/0,r.y=1/0,r;Fe.set((e.x+i.x)/2,(e.y+i.y)/2);const o=Math.sqrt(n*n-a*a/4),h=s?-1:1;return r.x=Fe.x+h*o*(i.y-e.y)/a,r.y=Fe.y-h*o*(i.x-e.x)/a,r}static isPointInCircle(t,e,i){return this.getDistance(i,t)<e}static isPointInConvexHull(t,e){let i=!1;const n=e.length;for(let s=0,r=n-1;s<n;r=s++){const n=e[s],a=e[r];if(Math.min(n.x,a.x)<=t.x&&t.x<=Math.max(n.x,a.x)&&Math.min(n.y,a.y)<=t.y&&t.y<=Math.max(n.y,a.y)){const e=(a.x-n.x)*(t.y-n.y)-(a.y-n.y)*(t.x-n.x);if(Math.abs(e)<1e-12)return!0}n.y>t.y!=a.y>t.y&&t.x<(a.x-n.x)*(t.y-n.y)/(a.y-n.y)+n.x&&(i=!i)}return i}static isPointInPolygon(t,e){let i=!1;for(let n=0,s=e.length-1;n<e.length;s=n++){const r=e[n].x,a=e[n].y,o=e[s].x,h=e[s].y;a>t.y!=h>t.y&&t.x<(o-r)*(t.y-a)/(h-a)+r&&(i=!i)}return i}static isPointInPolygonByRay(e,i){let n=0;const s=(new t).copy(e),r=new t,a=new t;for(let t=0;t<i.length;t++){t===i.length-1?(r.copy(i[t]),a.copy(i[0])):(r.copy(i[t]),a.copy(i[t+1]));let e=[r.y,a.y].sort(((t,e)=>t-e));e[0]<s.y&&e[1]>s.y&&(r.x<s.x||a.x<s.x)&&n++}return n%2==1}static getIntersectionOfSegments(e,i,n,s,r=!1,a=new t){const o=(s.y-n.y)*(i.x-e.x)-(s.x-n.x)*(i.y-e.y);if(0===o)return a.makeEmpty();const h=((s.x-n.x)*(e.y-n.y)-(s.y-n.y)*(e.x-n.x))/o,l=((i.x-e.x)*(e.y-n.y)-(i.y-e.y)*(e.x-n.x))/o;return r&&(h<0||h>1||l<0||l>1)?a.makeEmpty():(a.x=e.x+h*(i.x-e.x),a.y=e.y+h*(i.y-e.y),a)}static getConvexHullByGrahamScan(t,e=!1,i=[]){if(!t||!t.length)return i;const n=t.length;let s=0;for(let e=0;e<n;e++)t[e].x<t[s].x&&(s=e);let r,a=s;do{i.push(t[a]),r=(a+1)%n;for(let e=0;e<n;e++)this.whichSideOfSegment(t[a],t[e],t[r])>0&&(r=e);a=r}while(a!==s);return e&&i.push(t[s]),i}static whichSideOfSegment(t,e,i){return(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}static getPointsWithMatrix3(t,e){const i=[];if(!t)return i;for(let n=0,s=t.length;n<s;n++)i.push({x:e.elements[0]*t[n].x+e.elements[3]*t[n].y+e.elements[6],y:e.elements[1]*t[n].x+e.elements[4]*t[n].y+e.elements[7]});return i}static getPointsApplyMatrix3(t,e=[]){for(let i=0,n=e.length;i<n;i++){const n=t.elements[0]*e[i].x+t.elements[3]*e[i].y+t.elements[6],s=t.elements[1]*e[i].x+t.elements[4]*e[i].y+t.elements[7];e[i].x=n,e[i].y=s}return e}static getCentral(e,i=new t){let n=0,s=0;for(let t=0,i=e.length;t<i;t++)n+=e[t].x,s+=e[t].y;return i.set(n/e.length,s/e.length)}static getCentralByNumbers2(e,i=new t){let n=0,s=0;for(let t=0,i=e.length;t<i;t+=2)n+=e[t],s+=e[t+1];const r=e.length/2;return i.set(n/r,s/r)}static getCentroidByNumbers2(e,i=new t){if(!e||0===e.length)return i.set(0,0);if(e.length<6)return this.getCentralByNumbers2(e,i);let n=0,s=0,r=0;for(let t=0;t<e.length;t+=2){const i=(t+2)%e.length,a=e[t]*e[i+1]-e[i]*e[t+1];n+=a,s+=(e[t]+e[i])*a,r+=(e[t+1]+e[i+1])*a}return n/=2,Math.abs(n)<1e-10?this.getCentralByNumbers2(e,i):(s/=6*n,r/=6*n,i.set(s,r))}static getPoleOfInaccessibility(e,i=new t,n=1){const s=new t;t.getCentroidByNumbers2(e,s);const r=[];for(let t=0;t<e.length;t+=2)r.push({x:e[t],y:e[t+1]});let a={x:s.x,y:s.y},o=this.distanceToPolygon(a,r);for(let t=0;t<20;t++){const e=2*Math.PI*t/20,i=20*Math.random(),n={x:s.x+i*Math.cos(e),y:s.y+i*Math.sin(e)};if(this.isPointInPolygon(n,r)){const t=this.distanceToPolygon(n,r);t>o&&(o=t,a=n)}}return i.set(a.x,a.y),i.z=o,i}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t,e){return this.x+=t,this.y+=e||t,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clone(){return new t(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}cross(t){return this.x*t.y-this.y*t.x}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}dot(t){return this.x*t.x+this.y*t.y}equals(t,e=!0){return e?t.x===this.x&&t.y===this.y:Math.abs(t.x-this.x)<Ue&&Math.abs(t.y-this.y)<Ue}equalsXY(){return Math.abs(this.x-this.y)<Ue}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}floorToZero(){return this.roundToZero()}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("out of range: "+t)}}identity(){return this.set(0,0)}isEmpty(){return!Number.isFinite(this.x)&&!Number.isFinite(this.y)}isZero(){return 0===this.x&&0===this.y}length(){return Math.sqrt(this.dot(this))}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}makeEmpty(){return this.x=1/0,this.y=1/0,this}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}maxXY(t,e){return this.x=Math.max(this.x,t),this.y=Math.max(this.y,e),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}minXY(t,e){return this.x=Math.min(this.x,t),this.y=Math.min(this.y,e),this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t,e){return this.x*=t,this.y*=e||t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){return this.divideScalar(this.length()||1)}project(t){return this.applyMatrix3(t.matrixWorldInverse).applyMatrix3(t.projectionMatrix)}random(){return this.x=Math.random(),this.y=Math.random(),this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.x,s=this.y;return this.x=n*e-s*i,this.y=n*i+s*e,this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*i-r*n+t.x,this.y=s*n+r*i+t.y,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}set(t,e,i){return this.x=t,this.y=e,i&&(this.z=i),this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("out of range: "+t)}return this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,3*e)}setLength(t){return this.normalize().multiplyScalar(t)}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}toString(){return`{"x":${this.x},"y":${this.y}}`}unproject(t,e=!1){return this.applyMatrix3(t.projectionMatrixInverse).applyMatrix3(t.matrixWorld)}validate(){return!(isNaN(this.x)||isNaN(this.y))}*[Symbol.iterator](){yield this.x,yield this.y}};const Fe=new We,Ue=1e-8;function Ve(t){return t>-1e-8&&t<1e-8}function qe(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function je(t,e,i,n,s){const r=6*i-12*e+6*t,a=9*e+3*n-3*t-9*i,o=3*e-3*t;let h=0;if(Ve(a)){if((l=r)>1e-8||l<-1e-8){const t=-o/r;t>=0&&t<=1&&(s[h++]=t)}}else{const t=r*r-4*a*o;if(Ve(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[h++]=i),n>=0&&n<=1&&(s[h++]=n)}}var l;return h}function Ye(t,e,i,n,s,r,a,o,h){let l=t,u=e,c=0;const d=1/h;for(let p=1;p<=h;p++){let h=p*d;const f=qe(t,i,s,a,h),m=qe(e,n,r,o,h),g=f-l,y=m-u;c+=Math.sqrt(g*g+y*y),l=f,u=m}return c}function Ge(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,h=(n-i)*s+i,l=(o-a)*s+a,u=(h-o)*s+o,c=(u-l)*s+l;r[0]=t,r[1]=a,r[2]=l,r[3]=c,r[4]=c,r[5]=u,r[6]=h,r[7]=n}function $e(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}function Xe(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function Ze(t,e,i,n,s,r,a){let o=t,h=e,l=0;const u=1/a;for(let c=1;c<=a;c++){let a=c*u;const d=Xe(t,i,s,a),p=Xe(e,n,r,a),f=d-o,m=p-h;l+=Math.sqrt(f*f+m*m),o=d,h=p}return l}function Je(t,e,i,n,s){const r=(e-t)*n+t,a=(i-e)*n+e,o=(a-r)*n+r;s[0]=t,s[1]=r,s[2]=o,s[3]=o,s[4]=a,s[5]=i}const Qe=Math.PI,Ke=2*Qe;function ti(t){return(t%=Ke)<0&&(t+=Ke),t}function ei(t,e){let i=ti(t[0]),n=ti(t[1]);e?i<n&&(i+=Ke):n<i&&(n+=Ke),t[0]=i,t[1]=n}function ii(t,e,i,n){if(Ve(e-i))return!0;const s=1e-8;return t=ti(t),e=ti(e),i=ti(i),n?i<=e?t-s>=i&&t+s<=e:t-s>=i||t+s<=e:e<=i?t+s>=e&&t-s<=i:t+s>=e||t-s<=i}var ni={exports:{}};
|
|
1
|
+
var t,e,i=Object.defineProperty,n=Object.defineProperties,s=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,h=(t,e,n)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,l=(t,e)=>{for(var i in e||(e={}))a.call(e,i)&&h(t,i,e[i]);if(r)for(var i of r(e))o.call(e,i)&&h(t,i,e[i]);return t},u=(t,e)=>n(t,s(e)),c=(t,e,i)=>h(t,"symbol"!=typeof e?e+"":e,i),d=(t,e,i)=>new Promise(((n,s)=>{var r=t=>{try{o(i.next(t))}catch(t){s(t)}},a=t=>{try{o(i.throw(t))}catch(t){s(t)}},o=t=>t.done?n(t.value):Promise.resolve(t.value).then(r,a);o((i=i.apply(t,e)).next())}));function p(t,e){const i=t.x*Math.cos(e)-t.y*Math.sin(e),n=t.y*Math.cos(e)+t.x*Math.sin(e);t.x=i,t.y=n}function f(t,e){t.x*=e,t.y*=e}let m=class t{constructor(e){c(this,"commands"),this.commands=[],e&&e instanceof t?this.commands.push(...e.commands):e&&(this.commands=function(t){const e=[],i=String(t).trim();if("M"!==i[0]&&"m"!==i[0])return e;return i.replace(v,((t,i,n)=>{const s=function(t){const e=t.match(x);return e?e.map(Number):[]}(n);let r=i.toLowerCase(),a=i;if("m"===r&&s.length>2&&(e.push([a,...s.splice(0,2)]),r="l",a="m"===a?"l":"L"),s.length<y[r])return"";for(e.push([a,...s.splice(0,y[r])]);s.length>=y[r]&&s.length&&y[r];)e.push([a,...s.splice(0,y[r])]);return""})),e}(e))}addPath(e){e&&e instanceof t&&this.commands.push(...e.commands)}moveTo(t,e){this.commands.push(["M",t,e])}lineTo(t,e){this.commands.push(["L",t,e])}arc(t,e,i,n,s,r){this.commands.push(["AC",t,e,i,n,s,!!r])}arcTo(t,e,i,n,s){this.commands.push(["AT",t,e,i,n,s])}ellipse(t,e,i,n,s,r,a,o){this.commands.push(["E",t,e,i,n,s,r,a,!!o])}closePath(){this.commands.push(["Z"])}bezierCurveTo(t,e,i,n,s,r){this.commands.push(["C",t,e,i,n,s,r])}quadraticCurveTo(t,e,i,n){this.commands.push(["Q",t,e,i,n])}rect(t,e,i,n){this.commands.push(["R",t,e,i,n])}roundRect(t,e,i,n,s){void 0===s?this.commands.push(["RR",t,e,i,n,0]):this.commands.push(["RR",t,e,i,n,s])}};function g(t,e){let i,n,s,r,a,o,h,l,u,c,d,m,g,y,v,x,b,w,_,S,E,M=0,A=0,T=null,C=null,I=null,D=null,L=null,B=null;t.beginPath();for(let O=0;O<e.length;++O){let R;switch(w=e[O][0],"S"!==w&&"s"!==w&&"C"!==w&&"c"!==w&&(T=null,C=null),"T"!==w&&"t"!==w&&"Q"!==w&&"q"!==w&&(I=null,D=null),w){case"m":case"M":R=e[O],"m"===w?(M+=R[1],A+=R[2]):(M=R[1],A=R[2]),"M"!==w&&L||(L={x:M,y:A}),t.moveTo(M,A);break;case"l":R=e[O],M+=R[1],A+=R[2],t.lineTo(M,A);break;case"L":R=e[O],M=R[1],A=R[2],t.lineTo(M,A);break;case"H":R=e[O],M=R[1],t.lineTo(M,A);break;case"h":R=e[O],M+=R[1],t.lineTo(M,A);break;case"V":R=e[O],A=R[1],t.lineTo(M,A);break;case"v":R=e[O],A+=R[1],t.lineTo(M,A);break;case"a":case"A":if(R=e[O],null===B)throw new Error("This should never happen");"a"===w?(M+=R[6],A+=R[7]):(M=R[6],A=R[7]),y=R[1],v=R[2],h=R[3]*Math.PI/180,s=!!R[4],r=!!R[5],a={x:M,y:A},o={x:(B.x-a.x)/2,y:(B.y-a.y)/2},p(o,-h),l=o.x*o.x/(y*y)+o.y*o.y/(v*v),l>1&&(l=Math.sqrt(l),y*=l,v*=l),_={x:y*o.y/v,y:-v*o.x/y},u=y*y*v*v,c=y*y*o.y*o.y+v*v*o.x*o.x,f(_,r!==s?Math.sqrt((u-c)/c)||0:-Math.sqrt((u-c)/c)||0),n=Math.atan2((o.y-_.y)/v,(o.x-_.x)/y),i=Math.atan2(-(o.y+_.y)/v,-(o.x+_.x)/y),p(_,h),P=_,k=(a.x+B.x)/2,N=(a.y+B.y)/2,P.x+=k,P.y+=N,t.save(),t.translate(_.x,_.y),t.rotate(h),t.scale(y,v),t.arc(0,0,1,n,i,!r),t.restore();break;case"C":R=e[O],T=R[3],C=R[4],M=R[5],A=R[6],t.bezierCurveTo(R[1],R[2],T,C,M,A);break;case"c":R=e[O],t.bezierCurveTo(R[1]+M,R[2]+A,R[3]+M,R[4]+A,R[5]+M,R[6]+A),T=R[3]+M,C=R[4]+A,M+=R[5],A+=R[6];break;case"S":R=e[O],null!==T&&null!==C||(T=M,C=A),t.bezierCurveTo(2*M-T,2*A-C,R[1],R[2],R[3],R[4]),T=R[1],C=R[2],M=R[3],A=R[4];break;case"s":R=e[O],null!==T&&null!==C||(T=M,C=A),t.bezierCurveTo(2*M-T,2*A-C,R[1]+M,R[2]+A,R[3]+M,R[4]+A),T=R[1]+M,C=R[2]+A,M+=R[3],A+=R[4];break;case"Q":R=e[O],I=R[1],D=R[2],M=R[3],A=R[4],t.quadraticCurveTo(I,D,M,A);break;case"q":R=e[O],I=R[1]+M,D=R[2]+A,M+=R[3],A+=R[4],t.quadraticCurveTo(I,D,M,A);break;case"T":R=e[O],null!==I&&null!==D||(I=M,D=A),I=2*M-I,D=2*A-D,M=R[1],A=R[2],t.quadraticCurveTo(I,D,M,A);break;case"t":R=e[O],null!==I&&null!==D||(I=M,D=A),I=2*M-I,D=2*A-D,M+=R[1],A+=R[2],t.quadraticCurveTo(I,D,M,A);break;case"z":case"Z":L&&(M=L.x,A=L.y),L=null,t.closePath();break;case"AC":R=e[O],M=R[1],A=R[2],g=R[3],n=R[4],i=R[5],S=R[6],t.arc(M,A,g,n,i,S);break;case"AT":R=e[O],d=R[1],m=R[2],M=R[3],A=R[4],g=R[5],t.arcTo(d,m,M,A,g);break;case"E":R=e[O],M=R[1],A=R[2],y=R[3],v=R[4],h=R[5],n=R[6],i=R[7],S=R[8],t.save(),t.translate(M,A),t.rotate(h),t.scale(y,v),t.arc(0,0,1,n,i,S),t.restore();break;case"R":R=e[O],M=R[1],A=R[2],x=R[3],b=R[4],L={x:M,y:A},t.rect(M,A,x,b);break;case"RR":R=e[O],M=R[1],A=R[2],x=R[3],b=R[4],E=R[5],L={x:M,y:A},t.roundRect(M,A,x,b,E)}B?(B.x=M,B.y=A):B={x:M,y:A}}var P,k,N}const y={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},v=/([astvzqmhlc])([^astvzqmhlc]*)/gi,x=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;const b={name:"TinyEngine",containerId:"tinyEngine",canvas:"tinyEngine",width:0,height:0,aspect:1,dpr:1,alpha:!0,color:"#232323",fps:60,syncDelay:1500,animateDuration:500,fnEnable:!1,pointerPosition:!0,mergeRendering:!1,sliceRendering:!0,sliceDuration:15,usedCache:!1,separateCache:!1,debounceCache:!0,dynamicLoading:!0,svgLoadingType:0,instancedMesh:!0,showPoints:!1,wireframe:!1,castShadow:!1,workerRender:!1,monitorDuration:1e4,light:{color:"#ffffff",intensity:.8,position:[-6,6,0],castShadow:!0,shadowBlur:16,helperSize:100,helperColor:16776960,helperEnable:!1},camera:{type:0,left:-1,right:1,top:1,bottom:-1,aspect:1,near:1,far:2e3,eye:[0,0,0],up:[0,0,1],helperEnable:!1},controls:{target:[0,0,0],minDistance:.1,maxDistance:1e3,enableHover:!0,enablePan:!0,enableRotate:!1,enableZoom:!0,focusMode:!0,autoRotate:!1,autoRotateSpeed:.5,enableDamping:!0,dampingFactor:.2},gridHelper:{fill:"#e3e3e3"},axesHelper:{},displayUnits:"",tooltip:!0,assetType:"rm",zoomToSelectEnable:!1,selectEnable:!1,multiSelectEnable:!1,socialDistanceEnable:!1,socialDistance:{radius:3},editorMode:0,editor:{fill:"#F26666",stroke:"#D95970",strokeWidth:5,fontSize:25},dummy:{radius:15}};var w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function _(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var S={},E={};function M(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.freeze?e.freeze(t):t}var A=M({HTML:"text/html",isHTML:function(t){return t===A.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),T=M({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===T.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});E.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},E.find=function(t,e,i){if(void 0===i&&(i=Array.prototype),t&&"function"==typeof i.find)return i.find.call(t,e);for(var n=0;n<t.length;n++)if(Object.prototype.hasOwnProperty.call(t,n)){var s=t[n];if(e.call(void 0,s,n,t))return s}},E.freeze=M,E.MIME_TYPE=A,E.NAMESPACE=T;var C=E,I=C.find,D=C.NAMESPACE;function L(t){return""!==t}function B(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function P(t){if(!t)return[];var e=function(t){return t?t.split(/[\t\n\f\r ]+/).filter(L):[]}(t);return Object.keys(e.reduce(B,{}))}function k(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}function N(t,e){var i=t.prototype;if(!(i instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,k(i,n),t.prototype=i=n}i.constructor!=t&&(i.constructor=t)}var O={},R=O.ELEMENT_NODE=1,z=O.ATTRIBUTE_NODE=2,H=O.TEXT_NODE=3,W=O.CDATA_SECTION_NODE=4,F=O.ENTITY_REFERENCE_NODE=5,U=O.ENTITY_NODE=6,V=O.PROCESSING_INSTRUCTION_NODE=7,q=O.COMMENT_NODE=8,j=O.DOCUMENT_NODE=9,Y=O.DOCUMENT_TYPE_NODE=10,G=O.DOCUMENT_FRAGMENT_NODE=11,$=O.NOTATION_NODE=12,X={},Z={};X.INDEX_SIZE_ERR=(Z[1]="Index size error",1),X.DOMSTRING_SIZE_ERR=(Z[2]="DOMString size error",2);var J=X.HIERARCHY_REQUEST_ERR=(Z[3]="Hierarchy request error",3);X.WRONG_DOCUMENT_ERR=(Z[4]="Wrong document",4),X.INVALID_CHARACTER_ERR=(Z[5]="Invalid character",5),X.NO_DATA_ALLOWED_ERR=(Z[6]="No data allowed",6),X.NO_MODIFICATION_ALLOWED_ERR=(Z[7]="No modification allowed",7);var Q=X.NOT_FOUND_ERR=(Z[8]="Not found",8);X.NOT_SUPPORTED_ERR=(Z[9]="Not supported",9);var K=X.INUSE_ATTRIBUTE_ERR=(Z[10]="Attribute in use",10);function tt(t,e){if(e instanceof Error)var i=e;else i=this,Error.call(this,Z[t]),this.message=Z[t],Error.captureStackTrace&&Error.captureStackTrace(this,tt);return i.code=t,e&&(this.message=this.message+": "+e),i}function et(){}function it(t,e){this._node=t,this._refresh=e,nt(this)}function nt(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var i=t._refresh(t._node);if(qt(t,"length",i.length),!t.$$length||i.length<t.$$length)for(var n=i.length;n in t;n++)Object.prototype.hasOwnProperty.call(t,n)&&delete t[n];k(i,t),t._inc=e}}function st(){}function rt(t,e){for(var i=t.length;i--;)if(t[i]===e)return i}function at(t,e,i,n){if(n?e[rt(e,n)]=i:e[e.length++]=i,t){i.ownerElement=t;var s=t.ownerDocument;s&&(n&&pt(s,t,n),function(t,e,i){t&&t._inc++;var n=i.namespaceURI;n===D.XMLNS&&(e._nsMap[i.prefix?i.localName:""]=i.value)}(s,t,i))}}function ot(t,e,i){var n=rt(e,i);if(!(n>=0))throw new tt(Q,new Error(t.tagName+"@"+i));for(var s=e.length-1;n<s;)e[n]=e[++n];if(e.length=s,t){var r=t.ownerDocument;r&&(pt(r,t,i),i.ownerElement=null)}}function ht(){}function lt(){}function ut(t){return("<"==t?"<":">"==t&&">")||"&"==t&&"&"||'"'==t&&"""||"&#"+t.charCodeAt()+";"}function ct(t,e){if(e(t))return!0;if(t=t.firstChild)do{if(ct(t,e))return!0}while(t=t.nextSibling)}function dt(){this.ownerDocument=this}function pt(t,e,i,n){t&&t._inc++,i.namespaceURI===D.XMLNS&&delete e._nsMap[i.prefix?i.localName:""]}function ft(t,e,i){if(t&&t._inc){t._inc++;var n=e.childNodes;if(i)n[n.length++]=i;else{for(var s=e.firstChild,r=0;s;)n[r++]=s,s=s.nextSibling;n.length=r,delete n[n.length]}}}function mt(t,e){var i=e.previousSibling,n=e.nextSibling;return i?i.nextSibling=n:t.firstChild=n,n?n.previousSibling=i:t.lastChild=i,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,ft(t.ownerDocument,t),e}function gt(t){return t&&t.nodeType===lt.DOCUMENT_TYPE_NODE}function yt(t){return t&&t.nodeType===lt.ELEMENT_NODE}function vt(t){return t&&t.nodeType===lt.TEXT_NODE}function xt(t,e){var i=t.childNodes||[];if(I(i,yt)||gt(e))return!1;var n=I(i,gt);return!(e&&n&&i.indexOf(n)>i.indexOf(e))}function bt(t,e){var i=t.childNodes||[];if(I(i,(function(t){return yt(t)&&t!==e})))return!1;var n=I(i,gt);return!(e&&n&&i.indexOf(n)>i.indexOf(e))}function wt(t,e,i){if(!function(t){return t&&(t.nodeType===lt.DOCUMENT_NODE||t.nodeType===lt.DOCUMENT_FRAGMENT_NODE||t.nodeType===lt.ELEMENT_NODE)}(t))throw new tt(J,"Unexpected parent node type "+t.nodeType);if(i&&i.parentNode!==t)throw new tt(Q,"child not in parent");if(!function(t){return t&&(yt(t)||vt(t)||gt(t)||t.nodeType===lt.DOCUMENT_FRAGMENT_NODE||t.nodeType===lt.COMMENT_NODE||t.nodeType===lt.PROCESSING_INSTRUCTION_NODE)}(e)||gt(e)&&t.nodeType!==lt.DOCUMENT_NODE)throw new tt(J,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function _t(t,e,i){var n=t.childNodes||[],s=e.childNodes||[];if(e.nodeType===lt.DOCUMENT_FRAGMENT_NODE){var r=s.filter(yt);if(r.length>1||I(s,vt))throw new tt(J,"More than one element or text in fragment");if(1===r.length&&!xt(t,i))throw new tt(J,"Element in fragment can not be inserted before doctype")}if(yt(e)&&!xt(t,i))throw new tt(J,"Only one element can be added and only after doctype");if(gt(e)){if(I(n,gt))throw new tt(J,"Only one doctype is allowed");var a=I(n,yt);if(i&&n.indexOf(a)<n.indexOf(i))throw new tt(J,"Doctype can only be inserted before an element");if(!i&&a)throw new tt(J,"Doctype can not be appended since element is present")}}function St(t,e,i){var n=t.childNodes||[],s=e.childNodes||[];if(e.nodeType===lt.DOCUMENT_FRAGMENT_NODE){var r=s.filter(yt);if(r.length>1||I(s,vt))throw new tt(J,"More than one element or text in fragment");if(1===r.length&&!bt(t,i))throw new tt(J,"Element in fragment can not be inserted before doctype")}if(yt(e)&&!bt(t,i))throw new tt(J,"Only one element can be added and only after doctype");if(gt(e)){if(I(n,(function(t){return gt(t)&&t!==i})))throw new tt(J,"Only one doctype is allowed");var a=I(n,yt);if(i&&n.indexOf(a)<n.indexOf(i))throw new tt(J,"Doctype can only be inserted before an element")}}function Et(t,e,i,n){wt(t,e,i),t.nodeType===lt.DOCUMENT_NODE&&(n||_t)(t,e,i);var s=e.parentNode;if(s&&s.removeChild(e),e.nodeType===G){var r=e.firstChild;if(null==r)return e;var a=e.lastChild}else r=a=e;var o=i?i.previousSibling:t.lastChild;r.previousSibling=o,a.nextSibling=i,o?o.nextSibling=r:t.firstChild=r,null==i?t.lastChild=a:i.previousSibling=a;do{r.parentNode=t}while(r!==a&&(r=r.nextSibling));return ft(t.ownerDocument||t,t),e.nodeType==G&&(e.firstChild=e.lastChild=null),e}function Mt(){this._nsMap={}}function At(){}function Tt(){}function Ct(){}function It(){}function Dt(){}function Lt(){}function Bt(){}function Pt(){}function kt(){}function Nt(){}function Ot(){}function Rt(){}function zt(t,e){var i=[],n=9==this.nodeType&&this.documentElement||this,s=n.prefix,r=n.namespaceURI;if(r&&null==s&&null==(s=n.lookupPrefix(r)))var a=[{namespace:r,prefix:null}];return Ft(this,i,t,e,a),i.join("")}function Ht(t,e,i){var n=t.prefix||"",s=t.namespaceURI;if(!s)return!1;if("xml"===n&&s===D.XML||s===D.XMLNS)return!1;for(var r=i.length;r--;){var a=i[r];if(a.prefix===n)return a.namespace!==s}return!0}function Wt(t,e,i){t.push(" ",e,'="',i.replace(/[<>&"\t\n\r]/g,ut),'"')}function Ft(t,e,i,n,s){if(s||(s=[]),n){if(!(t=n(t)))return;if("string"==typeof t)return void e.push(t)}switch(t.nodeType){case R:var r=t.attributes,a=r.length,o=t.firstChild,h=t.tagName,l=h;if(!(i=D.isHTML(t.namespaceURI)||i)&&!t.prefix&&t.namespaceURI){for(var u,c=0;c<r.length;c++)if("xmlns"===r.item(c).name){u=r.item(c).value;break}if(!u)for(var d=s.length-1;d>=0;d--){if(""===(p=s[d]).prefix&&p.namespace===t.namespaceURI){u=p.namespace;break}}if(u!==t.namespaceURI)for(d=s.length-1;d>=0;d--){var p;if((p=s[d]).namespace===t.namespaceURI){p.prefix&&(l=p.prefix+":"+h);break}}}e.push("<",l);for(var f=0;f<a;f++){"xmlns"==(m=r.item(f)).prefix?s.push({prefix:m.localName,namespace:m.value}):"xmlns"==m.nodeName&&s.push({prefix:"",namespace:m.value})}for(f=0;f<a;f++){var m,g,y;if(Ht(m=r.item(f),0,s))Wt(e,(g=m.prefix||"")?"xmlns:"+g:"xmlns",y=m.namespaceURI),s.push({prefix:g,namespace:y});Ft(m,e,i,n,s)}if(h===l&&Ht(t,0,s))Wt(e,(g=t.prefix||"")?"xmlns:"+g:"xmlns",y=t.namespaceURI),s.push({prefix:g,namespace:y});if(o||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(h)){if(e.push(">"),i&&/^script$/i.test(h))for(;o;)o.data?e.push(o.data):Ft(o,e,i,n,s.slice()),o=o.nextSibling;else for(;o;)Ft(o,e,i,n,s.slice()),o=o.nextSibling;e.push("</",l,">")}else e.push("/>");return;case j:case G:for(o=t.firstChild;o;)Ft(o,e,i,n,s.slice()),o=o.nextSibling;return;case z:return Wt(e,t.name,t.value);case H:return e.push(t.data.replace(/[<&>]/g,ut));case W:return e.push("<![CDATA[",t.data,"]]>");case q:return e.push("\x3c!--",t.data,"--\x3e");case Y:var v=t.publicId,x=t.systemId;if(e.push("<!DOCTYPE ",t.name),v)e.push(" PUBLIC ",v),x&&"."!=x&&e.push(" ",x),e.push(">");else if(x&&"."!=x)e.push(" SYSTEM ",x,">");else{var b=t.internalSubset;b&&e.push(" [",b,"]"),e.push(">")}return;case V:return e.push("<?",t.target," ",t.data,"?>");case F:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function Ut(t,e,i){var n;switch(e.nodeType){case R:(n=e.cloneNode(!1)).ownerDocument=t;case G:break;case z:i=!0}if(n||(n=e.cloneNode(!1)),n.ownerDocument=t,n.parentNode=null,i)for(var s=e.firstChild;s;)n.appendChild(Ut(t,s,i)),s=s.nextSibling;return n}function Vt(t,e,i){var n=new e.constructor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var r=e[s];"object"!=typeof r&&r!=n[s]&&(n[s]=r)}switch(e.childNodes&&(n.childNodes=new et),n.ownerDocument=t,n.nodeType){case R:var a=e.attributes,o=n.attributes=new st,h=a.length;o._ownerElement=n;for(var l=0;l<h;l++)n.setAttributeNode(Vt(t,a.item(l),!0));break;case z:i=!0}if(i)for(var u=e.firstChild;u;)n.appendChild(Vt(t,u,i)),u=u.nextSibling;return n}function qt(t,e,i){t[e]=i}X.INVALID_STATE_ERR=(Z[11]="Invalid state",11),X.SYNTAX_ERR=(Z[12]="Syntax error",12),X.INVALID_MODIFICATION_ERR=(Z[13]="Invalid modification",13),X.NAMESPACE_ERR=(Z[14]="Invalid namespace",14),X.INVALID_ACCESS_ERR=(Z[15]="Invalid access",15),tt.prototype=Error.prototype,k(X,tt),et.prototype={length:0,item:function(t){return t>=0&&t<this.length?this[t]:null},toString:function(t,e){for(var i=[],n=0;n<this.length;n++)Ft(this[n],i,t,e);return i.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}},it.prototype.item=function(t){return nt(this),this[t]||null},N(it,et),st.prototype={length:0,item:et.prototype.item,getNamedItem:function(t){for(var e=this.length;e--;){var i=this[e];if(i.nodeName==t)return i}},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!=this._ownerElement)throw new tt(K);var i=this.getNamedItem(t.nodeName);return at(this._ownerElement,this,t,i),i},setNamedItemNS:function(t){var e,i=t.ownerElement;if(i&&i!=this._ownerElement)throw new tt(K);return e=this.getNamedItemNS(t.namespaceURI,t.localName),at(this._ownerElement,this,t,e),e},removeNamedItem:function(t){var e=this.getNamedItem(t);return ot(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var i=this.getNamedItemNS(t,e);return ot(this._ownerElement,this,i),i},getNamedItemNS:function(t,e){for(var i=this.length;i--;){var n=this[i];if(n.localName==e&&n.namespaceURI==t)return n}return null}},ht.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,i){var n=new dt;if(n.implementation=this,n.childNodes=new et,n.doctype=i||null,i&&n.appendChild(i),e){var s=n.createElementNS(t,e);n.appendChild(s)}return n},createDocumentType:function(t,e,i){var n=new Lt;return n.name=t,n.nodeName=t,n.publicId=e||"",n.systemId=i||"",n}},lt.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(t,e){return Et(this,t,e)},replaceChild:function(t,e){Et(this,t,e,St),e&&this.removeChild(e)},removeChild:function(t){return mt(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return Vt(this.ownerDocument||this,this,t)},normalize:function(){for(var t=this.firstChild;t;){var e=t.nextSibling;e&&e.nodeType==H&&t.nodeType==H?(this.removeChild(e),t.appendData(e.data)):(t.normalize(),t=e)}},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(t){for(var e=this;e;){var i=e._nsMap;if(i)for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&i[n]===t)return n;e=e.nodeType==z?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var i=e._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,t))return i[t];e=e.nodeType==z?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)}},k(O,lt),k(O,lt.prototype),dt.prototype={nodeName:"#document",nodeType:j,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==G){for(var i=t.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,e),i=n}return t}return Et(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===R&&(this.documentElement=t),t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),mt(this,t)},replaceChild:function(t,e){Et(this,t,e,St),t.ownerDocument=this,e&&this.removeChild(e),yt(t)&&(this.documentElement=t)},importNode:function(t,e){return Ut(this,t,e)},getElementById:function(t){var e=null;return ct(this.documentElement,(function(i){if(i.nodeType==R&&i.getAttribute("id")==t)return e=i,!0})),e},getElementsByClassName:function(t){var e=P(t);return new it(this,(function(i){var n=[];return e.length>0&&ct(i.documentElement,(function(s){if(s!==i&&s.nodeType===R){var r=s.getAttribute("class");if(r){var a=t===r;if(!a){var o=P(r);a=e.every((h=o,function(t){return h&&-1!==h.indexOf(t)}))}a&&n.push(s)}}var h})),n}))},createElement:function(t){var e=new Mt;return e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new et,(e.attributes=new st)._ownerElement=e,e},createDocumentFragment:function(){var t=new Nt;return t.ownerDocument=this,t.childNodes=new et,t},createTextNode:function(t){var e=new Ct;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new It;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new Dt;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var i=new Ot;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=t,i.nodeValue=i.data=e,i},createAttribute:function(t){var e=new At;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new kt;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var i=new Mt,n=e.split(":"),s=i.attributes=new st;return i.childNodes=new et,i.ownerDocument=this,i.nodeName=e,i.tagName=e,i.namespaceURI=t,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=e,s._ownerElement=i,i},createAttributeNS:function(t,e){var i=new At,n=e.split(":");return i.ownerDocument=this,i.nodeName=e,i.name=e,i.namespaceURI=t,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=e,i}},N(dt,lt),Mt.prototype={nodeType:R,hasAttribute:function(t){return null!=this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var i=this.ownerDocument.createAttribute(t);i.value=i.nodeValue=""+e,this.setAttributeNode(i)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===G?this.insertBefore(t,null):function(t,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=t,e.previousSibling=t.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,t.lastChild=e,ft(t.ownerDocument,t,e),e}(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);i&&this.removeAttributeNode(i)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);return i&&i.value||""},setAttributeNS:function(t,e,i){var n=this.ownerDocument.createAttributeNS(t,e);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new it(this,(function(e){var i=[];return ct(e,(function(n){n===e||n.nodeType!=R||"*"!==t&&n.tagName!=t||i.push(n)})),i}))},getElementsByTagNameNS:function(t,e){return new it(this,(function(i){var n=[];return ct(i,(function(s){s===i||s.nodeType!==R||"*"!==t&&s.namespaceURI!==t||"*"!==e&&s.localName!=e||n.push(s)})),n}))}},dt.prototype.getElementsByTagName=Mt.prototype.getElementsByTagName,dt.prototype.getElementsByTagNameNS=Mt.prototype.getElementsByTagNameNS,N(Mt,lt),At.prototype.nodeType=z,N(At,lt),Tt.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error(Z[J])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,i){i=this.data.substring(0,t)+i+this.data.substring(t+e),this.nodeValue=this.data=i,this.length=i.length}},N(Tt,lt),Ct.prototype={nodeName:"#text",nodeType:H,splitText:function(t){var e=this.data,i=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},N(Ct,Tt),It.prototype={nodeName:"#comment",nodeType:q},N(It,Tt),Dt.prototype={nodeName:"#cdata-section",nodeType:W},N(Dt,Tt),Lt.prototype.nodeType=Y,N(Lt,lt),Bt.prototype.nodeType=$,N(Bt,lt),Pt.prototype.nodeType=U,N(Pt,lt),kt.prototype.nodeType=F,N(kt,lt),Nt.prototype.nodeName="#document-fragment",Nt.prototype.nodeType=G,N(Nt,lt),Ot.prototype.nodeType=V,N(Ot,lt),Rt.prototype.serializeToString=function(t,e,i){return zt.call(t,e,i)},lt.prototype.toString=zt;try{if(Object.defineProperty){let t=function(e){switch(e.nodeType){case R:case G:var i=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&i.push(t(e)),e=e.nextSibling;return i.join("");default:return e.nodeValue}};Object.defineProperty(it.prototype,"length",{get:function(){return nt(this),this.$$length}}),Object.defineProperty(lt.prototype,"textContent",{get:function(){return t(this)},set:function(t){switch(this.nodeType){case R:case G:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),qt=function(t,e,i){t["$$"+e]=i}}}catch(t){}S.DocumentType=Lt,S.DOMException=tt,S.DOMImplementation=ht,S.Element=Mt,S.Node=lt,S.NodeList=et,S.XMLSerializer=Rt;var jt,Yt,Gt={},$t={};jt=$t,Yt=E.freeze,jt.XML_ENTITIES=Yt({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),jt.HTML_ENTITIES=Yt({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),jt.entityMap=jt.HTML_ENTITIES;var Xt={},Zt=E.NAMESPACE,Jt=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Qt=new RegExp("[\\-\\.0-9"+Jt.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Kt=new RegExp("^"+Jt.source+Qt.source+"*(?::"+Jt.source+Qt.source+"*)?$");function te(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,te)}function ee(){}function ie(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function ne(t,e,i,n,s,r){function a(t,e,n){i.attributeNames.hasOwnProperty(t)&&r.fatalError("Attribute "+t+" redefined"),i.addValue(t,e.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,s),n)}for(var o,h=++e,l=0;;){var u=t.charAt(h);switch(u){case"=":if(1===l)o=t.slice(e,h),l=3;else{if(2!==l)throw new Error("attribute equal must after attrName");l=3}break;case"'":case'"':if(3===l||1===l){if(1===l&&(r.warning('attribute value must after "="'),o=t.slice(e,h)),e=h+1,!((h=t.indexOf(u,e))>0))throw new Error("attribute value no end '"+u+"' match");a(o,c=t.slice(e,h),e-1),l=5}else{if(4!=l)throw new Error('attribute value must after "="');a(o,c=t.slice(e,h),e),r.warning('attribute "'+o+'" missed start quot('+u+")!!"),e=h+1,l=5}break;case"/":switch(l){case 0:i.setTagName(t.slice(e,h));case 5:case 6:case 7:l=7,i.closed=!0;case 4:case 1:break;case 2:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return r.error("unexpected end of input"),0==l&&i.setTagName(t.slice(e,h)),h;case">":switch(l){case 0:i.setTagName(t.slice(e,h));case 5:case 6:case 7:break;case 4:case 1:"/"===(c=t.slice(e,h)).slice(-1)&&(i.closed=!0,c=c.slice(0,-1));case 2:2===l&&(c=o),4==l?(r.warning('attribute "'+c+'" missed quot(")!'),a(o,c,e)):(Zt.isHTML(n[""])&&c.match(/^(?:disabled|checked|selected)$/i)||r.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),a(c,c,e));break;case 3:throw new Error("attribute value missed!!")}return h;case"":u=" ";default:if(u<=" ")switch(l){case 0:i.setTagName(t.slice(e,h)),l=6;break;case 1:o=t.slice(e,h),l=2;break;case 4:var c=t.slice(e,h);r.warning('attribute "'+c+'" missed quot(")!!'),a(o,c,e);case 5:l=6}else switch(l){case 2:i.tagName,Zt.isHTML(n[""])&&o.match(/^(?:disabled|checked|selected)$/i)||r.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=h,l=1;break;case 5:r.warning('attribute space is required"'+o+'"!!');case 6:l=1,e=h;break;case 3:l=4,e=h;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function se(t,e,i){for(var n=t.tagName,s=null,r=t.length;r--;){var a=t[r],o=a.qName,h=a.value;if((d=o.indexOf(":"))>0)var l=a.prefix=o.slice(0,d),u=o.slice(d+1),c="xmlns"===l&&u;else u=o,l=null,c="xmlns"===o&&"";a.localName=u,!1!==c&&(null==s&&(s={},oe(i,i={})),i[c]=s[c]=h,a.uri=Zt.XMLNS,e.startPrefixMapping(c,h))}for(r=t.length;r--;){(l=(a=t[r]).prefix)&&("xml"===l&&(a.uri=Zt.XML),"xmlns"!==l&&(a.uri=i[l||""]))}var d;(d=n.indexOf(":"))>0?(l=t.prefix=n.slice(0,d),u=t.localName=n.slice(d+1)):(l=null,u=t.localName=n);var p=t.uri=i[l||""];if(e.startElement(p,u,n,t),!t.closed)return t.currentNSMap=i,t.localNSMap=s,!0;if(e.endElement(p,u,n),s)for(l in s)Object.prototype.hasOwnProperty.call(s,l)&&e.endPrefixMapping(l)}function re(t,e,i,n,s){if(/^(?:script|textarea)$/i.test(i)){var r=t.indexOf("</"+i+">",e),a=t.substring(e+1,r);if(/[&<]/.test(a))return/^script$/i.test(i)?(s.characters(a,0,a.length),r):(a=a.replace(/&#?\w+;/g,n),s.characters(a,0,a.length),r)}return e+1}function ae(t,e,i,n){var s=n[i];return null==s&&((s=t.lastIndexOf("</"+i+">"))<e&&(s=t.lastIndexOf("</"+i)),n[i]=s),s<e}function oe(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}function he(t,e,i,n){if("-"===t.charAt(e+2))return"-"===t.charAt(e+3)?(s=t.indexOf("--\x3e",e+4))>e?(i.comment(t,e+4,s-e-4),s+3):(n.error("Unclosed comment"),-1):-1;if("CDATA["==t.substr(e+3,6)){var s=t.indexOf("]]>",e+9);return i.startCDATA(),i.characters(t,e+9,s-e-9),i.endCDATA(),s+3}var r=function(t,e){var i,n=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;s.lastIndex=e,s.exec(t);for(;i=s.exec(t);)if(n.push(i),i[1])return n}(t,e),a=r.length;if(a>1&&/!doctype/i.test(r[0][0])){var o=r[1][0],h=!1,l=!1;a>3&&(/^public$/i.test(r[2][0])?(h=r[3][0],l=a>4&&r[4][0]):/^system$/i.test(r[2][0])&&(l=r[3][0]));var u=r[a-1];return i.startDTD(o,h,l),i.endDTD(),u.index+u[0].length}return-1}function le(t,e,i){var n=t.indexOf("?>",e);if(n){var s=t.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return s?(s[0].length,i.processingInstruction(s[1],s[2]),n+2):-1}return-1}function ue(){this.attributeNames={}}te.prototype=new Error,te.prototype.name=te.name,ee.prototype={parse:function(t,e,i){var n=this.domBuilder;n.startDocument(),oe(e,e={}),function(t,e,i,n,s){function r(t){if(t>65535){var e=55296+((t-=65536)>>10),i=56320+(1023&t);return String.fromCharCode(e,i)}return String.fromCharCode(t)}function a(t){var e=t.slice(1,-1);return Object.hasOwnProperty.call(i,e)?i[e]:"#"===e.charAt(0)?r(parseInt(e.substr(1).replace("x","0x"))):(s.error("entity not found:"+t),t)}function o(e){if(e>m){var i=t.substring(m,e).replace(/&#?\w+;/g,a);d&&h(m),n.characters(i,0,e-m),m=e}}function h(e,i){for(;e>=u&&(i=c.exec(t));)l=i.index,u=l+i[0].length,d.lineNumber++;d.columnNumber=e-l+1}var l=0,u=0,c=/.*(?:\r\n?|\n)|.*$/g,d=n.locator,p=[{currentNSMap:e}],f={},m=0;for(;;){try{var g=t.indexOf("<",m);if(g<0){if(!t.substr(m).match(/^\s*$/)){var y=n.doc,v=y.createTextNode(t.substr(m));y.appendChild(v),n.currentElement=v}return}switch(g>m&&o(g),t.charAt(g+1)){case"/":var x=t.indexOf(">",g+3),b=t.substring(g+2,x).replace(/[ \t\n\r]+$/g,""),w=p.pop();x<0?(b=t.substring(g+2).replace(/[\s<].*/,""),s.error("end tag name: "+b+" is not complete:"+w.tagName),x=g+1+b.length):b.match(/\s</)&&(b=b.replace(/[\s<].*/,""),s.error("end tag name: "+b+" maybe not complete"),x=g+1+b.length);var _=w.localNSMap,S=w.tagName==b;if(S||w.tagName&&w.tagName.toLowerCase()==b.toLowerCase()){if(n.endElement(w.uri,w.localName,b),_)for(var E in _)Object.prototype.hasOwnProperty.call(_,E)&&n.endPrefixMapping(E);S||s.fatalError("end tag name: "+b+" is not match the current start tagName:"+w.tagName)}else p.push(w);x++;break;case"?":d&&h(g),x=le(t,g,n);break;case"!":d&&h(g),x=he(t,g,n,s);break;default:d&&h(g);var M=new ue,A=p[p.length-1].currentNSMap,T=(x=ne(t,g,M,A,a,s),M.length);if(!M.closed&&ae(t,x,M.tagName,f)&&(M.closed=!0,i.nbsp||s.warning("unclosed xml attribute")),d&&T){for(var C=ie(d,{}),I=0;I<T;I++){var D=M[I];h(D.offset),D.locator=ie(d,{})}n.locator=C,se(M,n,A)&&p.push(M),n.locator=d}else se(M,n,A)&&p.push(M);Zt.isHTML(M.uri)&&!M.closed?x=re(t,x,M.tagName,a,n):x++}}catch(t){if(t instanceof te)throw t;s.error("element parse error: "+t),x=-1}x>m?m=x:o(Math.max(g,m)+1)}}(t,e,i,n,this.errorHandler),n.endDocument()}},ue.prototype={setTagName:function(t){if(!Kt.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,i){if(!Kt.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:i}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},Xt.XMLReader=ee,Xt.ParseError=te;var ce=E,de=$t,pe=Xt,fe=S.DOMImplementation,me=ce.NAMESPACE,ge=pe.ParseError,ye=pe.XMLReader;function ve(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function xe(t){this.options=t||{locator:{}}}function be(){this.cdata=!1}function we(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function _e(t,e,i){return"string"==typeof t?t.substr(e,i):t.length>=e+i||e?new java.lang.String(t,e,i)+"":t}function Se(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}xe.prototype.parseFromString=function(t,e){var i=this.options,n=new ye,s=i.domBuilder||new be,r=i.errorHandler,a=i.locator,o=i.xmlns||{},h=/\/x?html?$/.test(e),l=h?de.HTML_ENTITIES:de.XML_ENTITIES;a&&s.setDocumentLocator(a),n.errorHandler=function(t,e,i){if(!t){if(e instanceof be)return e;t=e}var n={},s=t instanceof Function;function r(e){var r=t[e];!r&&s&&(r=2==t.length?function(i){t(e,i)}:t),n[e]=r&&function(t){r("[xmldom "+e+"]\t"+t+function(t){if(t)return"\n@"+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}(i))}||function(){}}return i=i||{},r("warning"),r("error"),r("fatalError"),n}(r,s,a),n.domBuilder=i.domBuilder||s,h&&(o[""]=me.HTML),o.xml=o.xml||me.XML;var u=i.normalizeLineEndings||ve;return t&&"string"==typeof t?n.parse(u(t),o,l):n.errorHandler.error("invalid doc source"),s.doc},be.prototype={startDocument:function(){this.doc=(new fe).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,i,n){var s=this.doc,r=s.createElementNS(t,i||e),a=n.length;Se(this,r),this.currentElement=r,this.locator&&we(this.locator,r);for(var o=0;o<a;o++){t=n.getURI(o);var h=n.getValue(o),l=(i=n.getQName(o),s.createAttributeNS(t,i));this.locator&&we(n.getLocator(o),l),l.value=l.nodeValue=h,r.setAttributeNode(l)}},endElement:function(t,e,i){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var i=this.doc.createProcessingInstruction(t,e);this.locator&&we(this.locator,i),Se(this,i)},ignorableWhitespace:function(t,e,i){},characters:function(t,e,i){if(t=_e.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(t);else n=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(t)&&this.doc.appendChild(n),this.locator&&we(this.locator,n)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,e,i){t=_e.apply(this,arguments);var n=this.doc.createComment(t);this.locator&&we(this.locator,n),Se(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,i){var n=this.doc.implementation;if(n&&n.createDocumentType){var s=n.createDocumentType(t,e,i);this.locator&&we(this.locator,s),Se(this,s),this.doc.doctype=s}},warning:function(t){},error:function(t){},fatalError:function(t){throw new ge(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(t){be.prototype[t]=function(){return null}})),Gt.__DOMHandler=be,Gt.normalizeLineEndings=ve,Gt.DOMParser=xe;var Ee=Gt.DOMParser;const Me="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{document:void 0,tinyEngine:void 0};Me.Path2D||function(t){if(!t||!t.CanvasRenderingContext2D||t.Path2D)return;const{CanvasRenderingContext2D:e}=t,i=null==e?void 0:e.prototype.fill,n=null==e?void 0:e.prototype.stroke,s=null==e?void 0:e.prototype.isPointInPath;e.prototype.fill=function(...t){if(!(t[0]instanceof m)){const e=t[0]||"nonzero";return i.apply(this,[e])}{const e=t[0],n=t[1]||"nonzero";g(this,e.commands),i.apply(this,[n])}},e.prototype.stroke=function(t){t&&g(this,t.commands),n.apply(this)},e.prototype.isPointInPath=function(...t){if(t[0]instanceof m){const e=t[0],i=t[1],n=t[2],r=t[3]||"nonzero";return g(this,e.commands),s.apply(this,[i,n,r])}return s.apply(this,t)},t.Path2D=m}(Me),Me.DOMParser||(Me.DOMParser=Ee);const Ae={window:Me,version:"2.0.12",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),dpr:1,document:Me.document,time:0,deltaTime:0,config:b},Te=(t,e,i)=>Math.max(e,Math.min(i,t)),Ce=(t,e=1e-6)=>Math.abs(t)<e?0:t<0?-1:1,Ie=t=>t*(Math.PI/180),De=(t,e,i)=>(1-i)*t+i*e,Le={transparent:"rgba(1, 1, 1, 0)",green:"#45b787",darkGreen:"#21532fff",blue:"#6e9bc5",darkBlue:"#2775b6",red:"#F26666",darkRed:"#D95970",brown:"#ECD2B9",darkBrown:"#BF9D8A",yellow:"#ECDEC0",darkYellow:"#D0AC57",lightGray:"#e0e0e0",gray:"#beb6b6",darkGray:"#918883",white:"#F2F2F2",darkWhite:"#ececec",lightBlack:"#2E3032",black:"#182327",blackAlpha5:"rgba(0, 0, 0, 0.5)"},Be={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},Pe={h:0,s:0,l:0},ke={h:0,s:0,l:0};function Ne(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}const Oe=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$|rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)|rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*[\d.]+\s*\)/;let Re=class t{constructor(t,e,i,n){return c(this,"isColor",!0),c(this,"r",1),c(this,"g",1),c(this,"b",1),c(this,"a",1),void 0===e&&void 0===i?this.set(t):this.setRGBA(t,e,i,n)}static isColor(t){return"string"==typeof t?Oe.test(t):"number"==typeof t&&(Number.isInteger(t)&&t>=0&&t<=16777215&&6===t.toString(6).length)}static getRandomStyle(t){return t?ze.random().setA(t).getStyle():ze.random().getStyle()}static getDarken(t,e=.8){return ze.set(t).getHSL(He),ze.setHSL(He.h,He.s,He.l*e).getStyle()}static getLighten(t,e=1.2){return this.getDarken(t,e)}static getContrast(t){return ze.set(t),ze.getContrastString()}static getArray(t){return ze.set(t).toArray()}static getComplementary(t){return ze.set(t),ze.getComplementaryString()}static getMoreTransparent(t,e){return ze.set(t).setA(e).getStyle()}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}random(){return this.setHex(Math.floor(Math.random()*(1<<24)))}setScalar(t){return this.r=t,this.g=t,this.b=t,this.a=1,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this.a=1,this}setR(t){return this.r=t,this}setG(t){return this.g=t,this}setB(t){return this.b=t,this}setA(t){return this.a=t,this}setRGB(t,e,i){return this.setRGBA(t,e,i,this.a)}setRGBA(t,e,i,n=1){return this.r=t,this.g=e,this.b=i,this.a=n,this}setHSL(t,e,i,n=1){var s;if(t=(t%(s=1)+s)%s,e=Te(e,0,1),i=Te(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,s=2*i-n;this.r=Ne(s,n,t+1/3),this.g=Ne(s,n,t),this.b=Ne(s,n,t-1/3)}return this.a=n,this}setStyle(t){let e;if(e=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const i=e[1],n=e[2];switch(i){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,this.a=Math.max(Math.min(1,void 0!==t[4]?parseFloat(t[4]):1),0),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,this.a=Math.max(Math.min(1,void 0!==t[4]?parseFloat(t[4]):1),0),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n)){const e=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,n=parseInt(t[3],10)/100,s=Math.max(Math.min(1,void 0!==t[4]?parseFloat(t[4]):1),0);return this.setHSL(e,i,n,s)}}}else if(e=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=e[1],i=t.length;if(3===i)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this.a=1,this;if(6===i)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this.a=1,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=Be[t.toLowerCase()];return void 0!==e&&this.setHex(e),this}clone(){return new t(this.r,this.g,this.b,this.a)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}getRGB(e=new t){return e.setRGB(this.r,this.g,this.b)}getRGBByBg(e=new t){const i=this.a,n=i*this.r+(1-i)*e.r,s=i*this.g+(1-i)*e.g,r=i*this.b+(1-i)*e.b;return new t(n,s,r)}getHex(){return Te(255*this.r,0,255)<<16^Te(255*this.g,0,255)<<8^Te(255*this.b,0,255)}getHSL(t){const e=this.r,i=this.g,n=this.b,s=Math.max(e,i,n),r=Math.min(e,i,n);let a,o=0;const h=(r+s)/2;if(r===s)o=0,a=0;else{const t=s-r;switch(a=h<=.5?t/(s+r):t/(2-s-r),s){case e:o=(i-n)/t+(i<n?6:0);break;case i:o=(n-e)/t+2;break;case n:o=(e-i)/t+4}o/=6}return t.h=o,t.s=a,t.l=h,t}getStyle(){return 1===this.a?`rgb(${255*this.r|0},${255*this.g|0},${255*this.b|0})`:`rgba(${255*this.r|0},${255*this.g|0},${255*this.b|0},${this.a||1})`}getHexString(){return"#"+("000000"+this.getHex().toString(16)).slice(-6)}getBrightness(){let t=(255*this.r*299+255*this.g*587+255*this.b*144)/1e3;return t+=(255-t)*(255-255*this.a)/255,t}getContrastString(){return this.getBrightness()>125?"#2f2f2f":"#f2f2f2"}getComplementary(e=new t){const i=this.toArray(),n=[0,0,0,1];for(let t=0;t<i.length;t++)if(t<3)n[t]=1-i[t];else{if(3!==t)continue;i[t]>1||i[t]<=0?n[t]=1:n[t]=Math.max(Math.min(parseFloat(i[t].toFixed(2)),1),0)}return e.setRGBA(n[0],n[1],n[2],parseFloat(n[3].toFixed(2)))}getComplementaryString(){return this.getComplementary().getStyle()}getLightenOrDarken(e){if(void 0===e||e>=1)return this.getHexString();const i=this.getRGBByBg(),n=i.r*e+(1-e),s=i.g*e+(1-e),r=i.b*e+(1-e);return new t(n,s,r).getHexString()}getNormalized(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.a,1),0).toFixed(2))]}getNormalized3(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2))]}offsetHSL(t,e,i){return this.getHSL(Pe),Pe.h+=t,Pe.s+=e,Pe.l+=i,this.setHSL(Pe.h,Pe.s,Pe.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Pe),t.getHSL(ke);const i=De(Pe.h,ke.h,e),n=De(Pe.s,ke.s,e),s=De(Pe.l,ke.l,e);return this.setHSL(i,n,s),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this.a=t[e+3],this}toArray(t=[0,0,0,0],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const ze=new Re,He={h:0,s:0,l:0};let We=class t{constructor(t=0,e=0,i){c(this,"isVector2",!0),c(this,"x",0),c(this,"y",0),c(this,"z"),this.x=t,this.y=e,this.z=i||0}static isZero(t){return 0===t.x&&0===t.y}static isEmpty(t){return!Number.isFinite(t.x)&&!Number.isFinite(t.y)}static equals(t,e,i=!0){return i?t.x===e.x&&t.y===e.y:Math.abs(t.x-e.x)<Ue&&Math.abs(t.y-e.y)<Ue}static getInt32Array(t,e=2){const i=new ArrayBuffer(t.length*e*4),n=new Int32Array(i);for(let e=0,i=t.length;e<i;e++)n[2*e]=t[e].x,n[2*e+1]=t[e].y;return n}static getFloat64Array(t,e=2){const i=new ArrayBuffer(t.length*e*8),n=new Float64Array(i);for(let e=0,i=t.length;e<i;e++)n[2*e]=t[e].x,n[2*e+1]=t[e].y;return n}static getVectors(e){const i=[];for(let n=0,s=e.length;n<s;n++)i.push(new t(e[n].x,e[n].y));return i}static getStrings(e){const i=[];if(!e||!e.length)return"";for(let n=0,s=e.length;n<s;n++)i.push(t.getString(e[n]));return i.join(",")}static getString(t){return`${t.x},${t.y}`}static getLength(t){return Math.sqrt(t.x*t.x+t.y*t.y)}static getDistance(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}static distanceToPolygon(t,e){let i=1/0;for(let n=0,s=e.length-1;n<e.length;s=n++){const r=e[n].x,a=e[n].y,o=e[s].x-r,h=e[s].y-a,l=Math.sqrt(o*o+h*h);if(l>0){const e=Math.max(0,Math.min(1,((t.x-r)*o+(t.y-a)*h)/(l*l))),n=r+e*o,s=a+e*h,u=Math.sqrt((t.x-n)*(t.x-n)+(t.y-s)*(t.y-s));i=Math.min(i,u)}}return i}static dot(t,e){return t.x*e.x+t.y*e.y}static cross(t,e){return t.x*e.y-t.y*e.x}static sub(e,i){return(new t).subVectors(e,i)}static isPointOnSegment(t,e,i){return 0===Ce(this.sub(t,i).cross(this.sub(e,i)))&&Ce(this.sub(t,i).dot(this.sub(e,i)))<=0}static angle(t,e,i){return i?Math.atan2(t.y-e.y,t.x-e.x):(t=>{let e=t*(180/Math.PI);return e<0&&(e+=360),e>360&&(e-=360),e})(Math.atan2(t.y-e.y,t.x-e.x))}static getSamplingPoints(t,e=100){let i=this.getClothoidPoints(t,e),n=0;for(let t=0,e=i.length;t<e;t++){let e=Math.max(0,t-1);t>0?n+=this.getDistance(i[e],i[e+1]):n=0,i[t].l=Math.round(n);let s=this.angle(i[e+1],i[e]);i[t].a=Math.round(100*s)/100}return i}static getClothoidPoints(e,i=100){let n=[],s=e.concat([]);if(!s||s.length<2)return n;2===s.length?(s.push(s[1]),s.unshift(s[0])):3===s.length&&s.splice(2,0,s[1]);for(let e=0;e<s.length-3;e+=3){let r=new t(s[e].x,s[e].y),a=new t(s[e+1].x,s[e+1].y),o=new t(s[e+2].x,s[e+2].y),h=new t(s[e+3].x,s[e+3].y),l=0;l+=r.distanceTo(a),l+=a.distanceTo(o),l+=o.distanceTo(h);let u=Math.min(.5,1/(l/i));for(let t=u;t<1;t+=u){let e=3*(a.x-r.x),i=3*(o.x-a.x)-e,s=h.x-r.x-e-i,l=3*(a.y-r.y),u=3*(o.y-a.y)-l,c=h.y-r.y-l-u,d=s*Math.pow(t,3)+i*Math.pow(t,2)+e*t+r.x,p=c*Math.pow(t,3)+u*Math.pow(t,2)+l*t+r.y;n.push({x:Math.round(d),y:Math.round(p),a:0,l:0})}}return n.unshift({x:s[0].x,y:s[0].y,a:0,l:0}),n.push({x:s[s.length-1].x,y:s[s.length-1].y,a:0,l:0}),n}static getClothoidLength(t){let e=0;if(t.length>2)for(let i=0;i<t.length;i++){let n=Math.max(0,i-1);i>0&&(e+=this.getDistance(t[n],t[n+1]))}return e}static getCircleCenterByChord(e,i,n,s=!0,r=new t){const a=this.getDistance(e,i);if(0===a)return r.x=1/0,r.y=1/0,r;Fe.set((e.x+i.x)/2,(e.y+i.y)/2);const o=Math.sqrt(n*n-a*a/4),h=s?-1:1;return r.x=Fe.x+h*o*(i.y-e.y)/a,r.y=Fe.y-h*o*(i.x-e.x)/a,r}static isPointInCircle(t,e,i){return this.getDistance(i,t)<e}static isPointInConvexHull(t,e){let i=!1;const n=e.length;for(let s=0,r=n-1;s<n;r=s++){const n=e[s],a=e[r];if(Math.min(n.x,a.x)<=t.x&&t.x<=Math.max(n.x,a.x)&&Math.min(n.y,a.y)<=t.y&&t.y<=Math.max(n.y,a.y)){const e=(a.x-n.x)*(t.y-n.y)-(a.y-n.y)*(t.x-n.x);if(Math.abs(e)<1e-12)return!0}n.y>t.y!=a.y>t.y&&t.x<(a.x-n.x)*(t.y-n.y)/(a.y-n.y)+n.x&&(i=!i)}return i}static isPointInPolygon(t,e){let i=!1;for(let n=0,s=e.length-1;n<e.length;s=n++){const r=e[n].x,a=e[n].y,o=e[s].x,h=e[s].y;a>t.y!=h>t.y&&t.x<(o-r)*(t.y-a)/(h-a)+r&&(i=!i)}return i}static isPointInPolygonByRay(e,i){let n=0;const s=(new t).copy(e),r=new t,a=new t;for(let t=0;t<i.length;t++){t===i.length-1?(r.copy(i[t]),a.copy(i[0])):(r.copy(i[t]),a.copy(i[t+1]));let e=[r.y,a.y].sort(((t,e)=>t-e));e[0]<s.y&&e[1]>s.y&&(r.x<s.x||a.x<s.x)&&n++}return n%2==1}static getIntersectionOfSegments(e,i,n,s,r=!1,a=new t){const o=(s.y-n.y)*(i.x-e.x)-(s.x-n.x)*(i.y-e.y);if(0===o)return a.makeEmpty();const h=((s.x-n.x)*(e.y-n.y)-(s.y-n.y)*(e.x-n.x))/o,l=((i.x-e.x)*(e.y-n.y)-(i.y-e.y)*(e.x-n.x))/o;return r&&(h<0||h>1||l<0||l>1)?a.makeEmpty():(a.x=e.x+h*(i.x-e.x),a.y=e.y+h*(i.y-e.y),a)}static getConvexHullByGrahamScan(t,e=!1,i=[]){if(!t||!t.length)return i;const n=t.length;let s=0;for(let e=0;e<n;e++)t[e].x<t[s].x&&(s=e);let r,a=s;do{i.push(t[a]),r=(a+1)%n;for(let e=0;e<n;e++)this.whichSideOfSegment(t[a],t[e],t[r])>0&&(r=e);a=r}while(a!==s);return e&&i.push(t[s]),i}static whichSideOfSegment(t,e,i){return(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}static getPointsWithMatrix3(t,e){const i=[];if(!t)return i;for(let n=0,s=t.length;n<s;n++)i.push({x:e.elements[0]*t[n].x+e.elements[3]*t[n].y+e.elements[6],y:e.elements[1]*t[n].x+e.elements[4]*t[n].y+e.elements[7]});return i}static getPointsApplyMatrix3(t,e=[]){for(let i=0,n=e.length;i<n;i++){const n=t.elements[0]*e[i].x+t.elements[3]*e[i].y+t.elements[6],s=t.elements[1]*e[i].x+t.elements[4]*e[i].y+t.elements[7];e[i].x=n,e[i].y=s}return e}static getCentral(e,i=new t){let n=0,s=0;for(let t=0,i=e.length;t<i;t++)n+=e[t].x,s+=e[t].y;return i.set(n/e.length,s/e.length)}static getCentralByNumbers2(e,i=new t){let n=0,s=0;for(let t=0,i=e.length;t<i;t+=2)n+=e[t],s+=e[t+1];const r=e.length/2;return i.set(n/r,s/r)}static getCentroidByNumbers2(e,i=new t){if(!e||0===e.length)return i.set(0,0);if(e.length<6)return this.getCentralByNumbers2(e,i);let n=0,s=0,r=0;for(let t=0;t<e.length;t+=2){const i=(t+2)%e.length,a=e[t]*e[i+1]-e[i]*e[t+1];n+=a,s+=(e[t]+e[i])*a,r+=(e[t+1]+e[i+1])*a}return n/=2,Math.abs(n)<1e-10?this.getCentralByNumbers2(e,i):(s/=6*n,r/=6*n,i.set(s,r))}static getPoleOfInaccessibility(e,i=new t,n=1){const s=new t;t.getCentroidByNumbers2(e,s);const r=[];for(let t=0;t<e.length;t+=2)r.push({x:e[t],y:e[t+1]});let a={x:s.x,y:s.y},o=this.distanceToPolygon(a,r);for(let t=0;t<20;t++){const e=2*Math.PI*t/20,i=20*Math.random(),n={x:s.x+i*Math.cos(e),y:s.y+i*Math.sin(e)};if(this.isPointInPolygon(n,r)){const t=this.distanceToPolygon(n,r);t>o&&(o=t,a=n)}}return i.set(a.x,a.y),i.z=o,i}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t,e){return this.x+=t,this.y+=e||t,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clone(){return new t(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}cross(t){return this.x*t.y-this.y*t.x}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}dot(t){return this.x*t.x+this.y*t.y}equals(t,e=!0){return e?t.x===this.x&&t.y===this.y:Math.abs(t.x-this.x)<Ue&&Math.abs(t.y-this.y)<Ue}equalsXY(){return Math.abs(this.x-this.y)<Ue}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}floorToZero(){return this.roundToZero()}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("out of range: "+t)}}identity(){return this.set(0,0)}isEmpty(){return!Number.isFinite(this.x)&&!Number.isFinite(this.y)}isZero(){return 0===this.x&&0===this.y}length(){return Math.sqrt(this.dot(this))}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}makeEmpty(){return this.x=1/0,this.y=1/0,this}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}maxXY(t,e){return this.x=Math.max(this.x,t),this.y=Math.max(this.y,e),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}minXY(t,e){return this.x=Math.min(this.x,t),this.y=Math.min(this.y,e),this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t,e){return this.x*=t,this.y*=e||t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){return this.divideScalar(this.length()||1)}project(t){return this.applyMatrix3(t.matrixWorldInverse).applyMatrix3(t.projectionMatrix)}random(){return this.x=Math.random(),this.y=Math.random(),this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.x,s=this.y;return this.x=n*e-s*i,this.y=n*i+s*e,this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*i-r*n+t.x,this.y=s*n+r*i+t.y,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}set(t,e,i){return this.x=t,this.y=e,i&&(this.z=i),this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("out of range: "+t)}return this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,3*e)}setLength(t){return this.normalize().multiplyScalar(t)}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}toString(){return`{"x":${this.x},"y":${this.y}}`}unproject(t,e=!1){return this.applyMatrix3(t.projectionMatrixInverse).applyMatrix3(t.matrixWorld)}validate(){return!(isNaN(this.x)||isNaN(this.y))}*[Symbol.iterator](){yield this.x,yield this.y}};const Fe=new We,Ue=1e-8;function Ve(t){return t>-1e-8&&t<1e-8}function qe(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function je(t,e,i,n,s){const r=6*i-12*e+6*t,a=9*e+3*n-3*t-9*i,o=3*e-3*t;let h=0;if(Ve(a)){if((l=r)>1e-8||l<-1e-8){const t=-o/r;t>=0&&t<=1&&(s[h++]=t)}}else{const t=r*r-4*a*o;if(Ve(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[h++]=i),n>=0&&n<=1&&(s[h++]=n)}}var l;return h}function Ye(t,e,i,n,s,r,a,o,h){let l=t,u=e,c=0;const d=1/h;for(let p=1;p<=h;p++){let h=p*d;const f=qe(t,i,s,a,h),m=qe(e,n,r,o,h),g=f-l,y=m-u;c+=Math.sqrt(g*g+y*y),l=f,u=m}return c}function Ge(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,h=(n-i)*s+i,l=(o-a)*s+a,u=(h-o)*s+o,c=(u-l)*s+l;r[0]=t,r[1]=a,r[2]=l,r[3]=c,r[4]=c,r[5]=u,r[6]=h,r[7]=n}function $e(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}function Xe(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function Ze(t,e,i,n,s,r,a){let o=t,h=e,l=0;const u=1/a;for(let c=1;c<=a;c++){let a=c*u;const d=Xe(t,i,s,a),p=Xe(e,n,r,a),f=d-o,m=p-h;l+=Math.sqrt(f*f+m*m),o=d,h=p}return l}function Je(t,e,i,n,s){const r=(e-t)*n+t,a=(i-e)*n+e,o=(a-r)*n+r;s[0]=t,s[1]=r,s[2]=o,s[3]=o,s[4]=a,s[5]=i}const Qe=Math.PI,Ke=2*Qe;function ti(t){return(t%=Ke)<0&&(t+=Ke),t}function ei(t,e){let i=ti(t[0]),n=ti(t[1]);e?i<n&&(i+=Ke):n<i&&(n+=Ke),t[0]=i,t[1]=n}function ii(t,e,i,n){if(Ve(e-i))return!0;const s=1e-8;return t=ti(t),e=ti(e),i=ti(i),n?i<=e?t-s>=i&&t+s<=e:t-s>=i||t+s<=e:e<=i?t+s>=e&&t-s<=i:t+s>=e||t-s<=i}var ni={exports:{}};
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Lodash <https://lodash.com/>
|
|
@@ -6,14 +6,14 @@ var t,e,i=Object.defineProperty,n=Object.defineProperties,s=Object.getOwnPropert
|
|
|
6
6
|
* Released under MIT license <https://lodash.com/license>
|
|
7
7
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
8
8
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
9
|
-
*/!function(t,e){(function(){var i,n="Expected a function",s="__lodash_hash_undefined__",r="__lodash_placeholder__",a=32,o=128,h=256,l=1/0,u=9007199254740991,c=NaN,d=4294967295,p=[["ary",o],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",a],["partialRight",64],["rearg",h]],f="[object Arguments]",m="[object Array]",g="[object Boolean]",y="[object Date]",v="[object Error]",x="[object Function]",b="[object GeneratorFunction]",_="[object Map]",S="[object Number]",E="[object Object]",M="[object Promise]",A="[object RegExp]",T="[object Set]",C="[object String]",I="[object Symbol]",D="[object WeakMap]",L="[object ArrayBuffer]",B="[object DataView]",P="[object Float32Array]",k="[object Float64Array]",N="[object Int8Array]",O="[object Int16Array]",R="[object Int32Array]",z="[object Uint8Array]",H="[object Uint8ClampedArray]",W="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,Y=/[&<>"']/g,G=RegExp(j.source),$=RegExp(Y.source),X=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,K=/^\w*$/,tt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/[\\^$.*+?()[\]{}|]/g,it=RegExp(et.source),nt=/^\s+/,st=/\s/,rt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,at=/\{\n\/\* \[wrapped with (.+)\] \*/,ot=/,? & /,ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,lt=/[()=,{}\[\]\/\s]/,ut=/\\(\\)?/g,ct=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,pt=/^[-+]0x[0-9a-f]+$/i,ft=/^0b[01]+$/i,mt=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,yt=/^(?:0|[1-9]\d*)$/,vt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,xt=/($^)/,bt=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",_t="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",St="\\u2700-\\u27bf",Et="a-z\\xdf-\\xf6\\xf8-\\xff",Mt="A-Z\\xc0-\\xd6\\xd8-\\xde",At="\\ufe0e\\ufe0f",Tt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ct="['’]",It="["+wt+"]",Dt="["+Tt+"]",Lt="["+_t+"]",Bt="\\d+",Pt="["+St+"]",kt="["+Et+"]",Nt="[^"+wt+Tt+Bt+St+Et+Mt+"]",Ot="\\ud83c[\\udffb-\\udfff]",Rt="[^"+wt+"]",zt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ht="[\\ud800-\\udbff][\\udc00-\\udfff]",Wt="["+Mt+"]",Ft="\\u200d",Ut="(?:"+kt+"|"+Nt+")",Vt="(?:"+Wt+"|"+Nt+")",qt="(?:['’](?:d|ll|m|re|s|t|ve))?",jt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Yt="(?:"+Lt+"|"+Ot+")"+"?",Gt="["+At+"]?",$t=Gt+Yt+("(?:"+Ft+"(?:"+[Rt,zt,Ht].join("|")+")"+Gt+Yt+")*"),Xt="(?:"+[Pt,zt,Ht].join("|")+")"+$t,Zt="(?:"+[Rt+Lt+"?",Lt,zt,Ht,It].join("|")+")",Jt=RegExp(Ct,"g"),Qt=RegExp(Lt,"g"),Kt=RegExp(Ot+"(?="+Ot+")|"+Zt+$t,"g"),te=RegExp([Wt+"?"+kt+"+"+qt+"(?="+[Dt,Wt,"$"].join("|")+")",Vt+"+"+jt+"(?="+[Dt,Wt+Ut,"$"].join("|")+")",Wt+"?"+Ut+"+"+qt,Wt+"+"+jt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Bt,Xt].join("|"),"g"),ee=RegExp("["+Ft+wt+_t+At+"]"),ie=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ne=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],se=-1,re={};re[P]=re[k]=re[N]=re[O]=re[R]=re[z]=re[H]=re[W]=re[F]=!0,re[f]=re[m]=re[L]=re[g]=re[B]=re[y]=re[v]=re[x]=re[_]=re[S]=re[E]=re[A]=re[T]=re[C]=re[D]=!1;var ae={};ae[f]=ae[m]=ae[L]=ae[B]=ae[g]=ae[y]=ae[P]=ae[k]=ae[N]=ae[O]=ae[R]=ae[_]=ae[S]=ae[E]=ae[A]=ae[T]=ae[C]=ae[I]=ae[z]=ae[H]=ae[W]=ae[F]=!0,ae[v]=ae[x]=ae[D]=!1;var oe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},he=parseFloat,le=parseInt,ue="object"==typeof w&&w&&w.Object===Object&&w,ce="object"==typeof self&&self&&self.Object===Object&&self,de=ue||ce||Function("return this")(),pe=e&&!e.nodeType&&e,fe=pe&&t&&!t.nodeType&&t,me=fe&&fe.exports===pe,ge=me&&ue.process,ye=function(){try{var t=fe&&fe.require&&fe.require("util").types;return t||ge&&ge.binding&&ge.binding("util")}catch(t){}}(),ve=ye&&ye.isArrayBuffer,xe=ye&&ye.isDate,be=ye&&ye.isMap,we=ye&&ye.isRegExp,_e=ye&&ye.isSet,Se=ye&&ye.isTypedArray;function Ee(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function Me(t,e,i,n){for(var s=-1,r=null==t?0:t.length;++s<r;){var a=t[s];e(n,a,i(a),t)}return n}function Ae(t,e){for(var i=-1,n=null==t?0:t.length;++i<n&&!1!==e(t[i],i,t););return t}function Te(t,e){for(var i=null==t?0:t.length;i--&&!1!==e(t[i],i,t););return t}function Ce(t,e){for(var i=-1,n=null==t?0:t.length;++i<n;)if(!e(t[i],i,t))return!1;return!0}function Ie(t,e){for(var i=-1,n=null==t?0:t.length,s=0,r=[];++i<n;){var a=t[i];e(a,i,t)&&(r[s++]=a)}return r}function De(t,e){return!!(null==t?0:t.length)&&We(t,e,0)>-1}function Le(t,e,i){for(var n=-1,s=null==t?0:t.length;++n<s;)if(i(e,t[n]))return!0;return!1}function Be(t,e){for(var i=-1,n=null==t?0:t.length,s=Array(n);++i<n;)s[i]=e(t[i],i,t);return s}function Pe(t,e){for(var i=-1,n=e.length,s=t.length;++i<n;)t[s+i]=e[i];return t}function ke(t,e,i,n){var s=-1,r=null==t?0:t.length;for(n&&r&&(i=t[++s]);++s<r;)i=e(i,t[s],s,t);return i}function Ne(t,e,i,n){var s=null==t?0:t.length;for(n&&s&&(i=t[--s]);s--;)i=e(i,t[s],s,t);return i}function Oe(t,e){for(var i=-1,n=null==t?0:t.length;++i<n;)if(e(t[i],i,t))return!0;return!1}var Re=qe("length");function ze(t,e,i){var n;return i(t,(function(t,i,s){if(e(t,i,s))return n=i,!1})),n}function He(t,e,i,n){for(var s=t.length,r=i+(n?1:-1);n?r--:++r<s;)if(e(t[r],r,t))return r;return-1}function We(t,e,i){return e==e?function(t,e,i){var n=i-1,s=t.length;for(;++n<s;)if(t[n]===e)return n;return-1}(t,e,i):He(t,Ue,i)}function Fe(t,e,i,n){for(var s=i-1,r=t.length;++s<r;)if(n(t[s],e))return s;return-1}function Ue(t){return t!=t}function Ve(t,e){var i=null==t?0:t.length;return i?Ge(t,e)/i:c}function qe(t){return function(e){return null==e?i:e[t]}}function je(t){return function(e){return null==t?i:t[e]}}function Ye(t,e,i,n,s){return s(t,(function(t,s,r){i=n?(n=!1,t):e(i,t,s,r)})),i}function Ge(t,e){for(var n,s=-1,r=t.length;++s<r;){var a=e(t[s]);a!==i&&(n=n===i?a:n+a)}return n}function $e(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n}function Xe(t){return t?t.slice(0,ci(t)+1).replace(nt,""):t}function Ze(t){return function(e){return t(e)}}function Je(t,e){return Be(e,(function(e){return t[e]}))}function Qe(t,e){return t.has(e)}function Ke(t,e){for(var i=-1,n=t.length;++i<n&&We(e,t[i],0)>-1;);return i}function ti(t,e){for(var i=t.length;i--&&We(e,t[i],0)>-1;);return i}var ei=je({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ii=je({"&":"&","<":"<",">":">",'"':""","'":"'"});function ni(t){return"\\"+oe[t]}function si(t){return ee.test(t)}function ri(t){var e=-1,i=Array(t.size);return t.forEach((function(t,n){i[++e]=[n,t]})),i}function ai(t,e){return function(i){return t(e(i))}}function oi(t,e){for(var i=-1,n=t.length,s=0,a=[];++i<n;){var o=t[i];o!==e&&o!==r||(t[i]=r,a[s++]=i)}return a}function hi(t){var e=-1,i=Array(t.size);return t.forEach((function(t){i[++e]=t})),i}function li(t){return si(t)?function(t){var e=Kt.lastIndex=0;for(;Kt.test(t);)++e;return e}(t):Re(t)}function ui(t){return si(t)?function(t){return t.match(Kt)||[]}(t):function(t){return t.split("")}(t)}function ci(t){for(var e=t.length;e--&&st.test(t.charAt(e)););return e}var di=je({"&":"&","<":"<",">":">",""":'"',"'":"'"});var pi=function t(e){var w,st=(e=null==e?de:pi.defaults(de.Object(),e,pi.pick(de,ne))).Array,wt=e.Date,_t=e.Error,St=e.Function,Et=e.Math,Mt=e.Object,At=e.RegExp,Tt=e.String,Ct=e.TypeError,It=st.prototype,Dt=St.prototype,Lt=Mt.prototype,Bt=e["__core-js_shared__"],Pt=Dt.toString,kt=Lt.hasOwnProperty,Nt=0,Ot=(w=/[^.]+$/.exec(Bt&&Bt.keys&&Bt.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",Rt=Lt.toString,zt=Pt.call(Mt),Ht=de._,Wt=At("^"+Pt.call(kt).replace(et,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ft=me?e.Buffer:i,Ut=e.Symbol,Vt=e.Uint8Array,qt=Ft?Ft.allocUnsafe:i,jt=ai(Mt.getPrototypeOf,Mt),Yt=Mt.create,Gt=Lt.propertyIsEnumerable,$t=It.splice,Xt=Ut?Ut.isConcatSpreadable:i,Zt=Ut?Ut.iterator:i,Kt=Ut?Ut.toStringTag:i,ee=function(){try{var t=lr(Mt,"defineProperty");return t({},"",{}),t}catch(t){}}(),oe=e.clearTimeout!==de.clearTimeout&&e.clearTimeout,ue=wt&&wt.now!==de.Date.now&&wt.now,ce=e.setTimeout!==de.setTimeout&&e.setTimeout,pe=Et.ceil,fe=Et.floor,ge=Mt.getOwnPropertySymbols,ye=Ft?Ft.isBuffer:i,Re=e.isFinite,je=It.join,fi=ai(Mt.keys,Mt),mi=Et.max,gi=Et.min,yi=wt.now,vi=e.parseInt,xi=Et.random,bi=It.reverse,wi=lr(e,"DataView"),_i=lr(e,"Map"),Si=lr(e,"Promise"),Ei=lr(e,"Set"),Mi=lr(e,"WeakMap"),Ai=lr(Mt,"create"),Ti=Mi&&new Mi,Ci={},Ii=zr(wi),Di=zr(_i),Li=zr(Si),Bi=zr(Ei),Pi=zr(Mi),ki=Ut?Ut.prototype:i,Ni=ki?ki.valueOf:i,Oi=ki?ki.toString:i;function Ri(t){if(eo(t)&&!qa(t)&&!(t instanceof Fi)){if(t instanceof Wi)return t;if(kt.call(t,"__wrapped__"))return Hr(t)}return new Wi(t)}var zi=function(){function t(){}return function(e){if(!to(e))return{};if(Yt)return Yt(e);t.prototype=e;var n=new t;return t.prototype=i,n}}();function Hi(){}function Wi(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function Fi(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Ui(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function Vi(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function qi(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function ji(t){var e=-1,i=null==t?0:t.length;for(this.__data__=new qi;++e<i;)this.add(t[e])}function Yi(t){var e=this.__data__=new Vi(t);this.size=e.size}function Gi(t,e){var i=qa(t),n=!i&&Va(t),s=!i&&!n&&$a(t),r=!i&&!n&&!s&&lo(t),a=i||n||s||r,o=a?$e(t.length,Tt):[],h=o.length;for(var l in t)!e&&!kt.call(t,l)||a&&("length"==l||s&&("offset"==l||"parent"==l)||r&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||gr(l,h))||o.push(l);return o}function $i(t){var e=t.length;return e?t[Yn(0,e-1)]:i}function Xi(t,e){return Br(Ts(t),rn(e,0,t.length))}function Zi(t){return Br(Ts(t))}function Ji(t,e,n){(n!==i&&!Wa(t[e],n)||n===i&&!(e in t))&&nn(t,e,n)}function Qi(t,e,n){var s=t[e];kt.call(t,e)&&Wa(s,n)&&(n!==i||e in t)||nn(t,e,n)}function Ki(t,e){for(var i=t.length;i--;)if(Wa(t[i][0],e))return i;return-1}function tn(t,e,i,n){return un(t,(function(t,s,r){e(n,t,i(t),r)})),n}function en(t,e){return t&&Cs(e,Bo(e),t)}function nn(t,e,i){"__proto__"==e&&ee?ee(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}function sn(t,e){for(var n=-1,s=e.length,r=st(s),a=null==t;++n<s;)r[n]=a?i:To(t,e[n]);return r}function rn(t,e,n){return t==t&&(n!==i&&(t=t<=n?t:n),e!==i&&(t=t>=e?t:e)),t}function an(t,e,n,s,r,a){var o,h=1&e,l=2&e,u=4&e;if(n&&(o=r?n(t,s,r,a):n(t)),o!==i)return o;if(!to(t))return t;var c=qa(t);if(c){if(o=function(t){var e=t.length,i=new t.constructor(e);e&&"string"==typeof t[0]&&kt.call(t,"index")&&(i.index=t.index,i.input=t.input);return i}(t),!h)return Ts(t,o)}else{var d=dr(t),p=d==x||d==b;if($a(t))return ws(t,h);if(d==E||d==f||p&&!r){if(o=l||p?{}:fr(t),!h)return l?function(t,e){return Cs(t,cr(t),e)}(t,function(t,e){return t&&Cs(e,Po(e),t)}(o,t)):function(t,e){return Cs(t,ur(t),e)}(t,en(o,t))}else{if(!ae[d])return r?t:{};o=function(t,e,i){var n=t.constructor;switch(e){case L:return _s(t);case g:case y:return new n(+t);case B:return function(t,e){var i=e?_s(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}(t,i);case P:case k:case N:case O:case R:case z:case H:case W:case F:return Ss(t,i);case _:return new n;case S:case C:return new n(t);case A:return function(t){var e=new t.constructor(t.source,dt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case T:return new n;case I:return s=t,Ni?Mt(Ni.call(s)):{}}var s}(t,d,h)}}a||(a=new Yi);var m=a.get(t);if(m)return m;a.set(t,o),ao(t)?t.forEach((function(i){o.add(an(i,e,n,i,t,a))})):io(t)&&t.forEach((function(i,s){o.set(s,an(i,e,n,s,t,a))}));var v=c?i:(u?l?ir:er:l?Po:Bo)(t);return Ae(v||t,(function(i,s){v&&(i=t[s=i]),Qi(o,s,an(i,e,n,s,t,a))})),o}function on(t,e,n){var s=n.length;if(null==t)return!s;for(t=Mt(t);s--;){var r=n[s],a=e[r],o=t[r];if(o===i&&!(r in t)||!a(o))return!1}return!0}function hn(t,e,s){if("function"!=typeof t)throw new Ct(n);return Cr((function(){t.apply(i,s)}),e)}function ln(t,e,i,n){var s=-1,r=De,a=!0,o=t.length,h=[],l=e.length;if(!o)return h;i&&(e=Be(e,Ze(i))),n?(r=Le,a=!1):e.length>=200&&(r=Qe,a=!1,e=new ji(e));t:for(;++s<o;){var u=t[s],c=null==i?u:i(u);if(u=n||0!==u?u:0,a&&c==c){for(var d=l;d--;)if(e[d]===c)continue t;h.push(u)}else r(e,c,n)||h.push(u)}return h}Ri.templateSettings={escape:X,evaluate:Z,interpolate:J,variable:"",imports:{_:Ri}},Ri.prototype=Hi.prototype,Ri.prototype.constructor=Ri,Wi.prototype=zi(Hi.prototype),Wi.prototype.constructor=Wi,Fi.prototype=zi(Hi.prototype),Fi.prototype.constructor=Fi,Ui.prototype.clear=function(){this.__data__=Ai?Ai(null):{},this.size=0},Ui.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Ui.prototype.get=function(t){var e=this.__data__;if(Ai){var n=e[t];return n===s?i:n}return kt.call(e,t)?e[t]:i},Ui.prototype.has=function(t){var e=this.__data__;return Ai?e[t]!==i:kt.call(e,t)},Ui.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ai&&e===i?s:e,this},Vi.prototype.clear=function(){this.__data__=[],this.size=0},Vi.prototype.delete=function(t){var e=this.__data__,i=Ki(e,t);return!(i<0)&&(i==e.length-1?e.pop():$t.call(e,i,1),--this.size,!0)},Vi.prototype.get=function(t){var e=this.__data__,n=Ki(e,t);return n<0?i:e[n][1]},Vi.prototype.has=function(t){return Ki(this.__data__,t)>-1},Vi.prototype.set=function(t,e){var i=this.__data__,n=Ki(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this},qi.prototype.clear=function(){this.size=0,this.__data__={hash:new Ui,map:new(_i||Vi),string:new Ui}},qi.prototype.delete=function(t){var e=or(this,t).delete(t);return this.size-=e?1:0,e},qi.prototype.get=function(t){return or(this,t).get(t)},qi.prototype.has=function(t){return or(this,t).has(t)},qi.prototype.set=function(t,e){var i=or(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this},ji.prototype.add=ji.prototype.push=function(t){return this.__data__.set(t,s),this},ji.prototype.has=function(t){return this.__data__.has(t)},Yi.prototype.clear=function(){this.__data__=new Vi,this.size=0},Yi.prototype.delete=function(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i},Yi.prototype.get=function(t){return this.__data__.get(t)},Yi.prototype.has=function(t){return this.__data__.has(t)},Yi.prototype.set=function(t,e){var i=this.__data__;if(i instanceof Vi){var n=i.__data__;if(!_i||n.length<199)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new qi(n)}return i.set(t,e),this.size=i.size,this};var un=Ls(vn),cn=Ls(xn,!0);function dn(t,e){var i=!0;return un(t,(function(t,n,s){return i=!!e(t,n,s)})),i}function pn(t,e,n){for(var s=-1,r=t.length;++s<r;){var a=t[s],o=e(a);if(null!=o&&(h===i?o==o&&!ho(o):n(o,h)))var h=o,l=a}return l}function fn(t,e){var i=[];return un(t,(function(t,n,s){e(t,n,s)&&i.push(t)})),i}function mn(t,e,i,n,s){var r=-1,a=t.length;for(i||(i=mr),s||(s=[]);++r<a;){var o=t[r];e>0&&i(o)?e>1?mn(o,e-1,i,n,s):Pe(s,o):n||(s[s.length]=o)}return s}var gn=Bs(),yn=Bs(!0);function vn(t,e){return t&&gn(t,e,Bo)}function xn(t,e){return t&&yn(t,e,Bo)}function bn(t,e){return Ie(e,(function(e){return Ja(t[e])}))}function wn(t,e){for(var n=0,s=(e=ys(e,t)).length;null!=t&&n<s;)t=t[Rr(e[n++])];return n&&n==s?t:i}function _n(t,e,i){var n=e(t);return qa(t)?n:Pe(n,i(t))}function Sn(t){return null==t?t===i?"[object Undefined]":"[object Null]":Kt&&Kt in Mt(t)?function(t){var e=kt.call(t,Kt),n=t[Kt];try{t[Kt]=i;var s=!0}catch(t){}var r=Rt.call(t);s&&(e?t[Kt]=n:delete t[Kt]);return r}(t):function(t){return Rt.call(t)}(t)}function En(t,e){return t>e}function Mn(t,e){return null!=t&&kt.call(t,e)}function An(t,e){return null!=t&&e in Mt(t)}function Tn(t,e,n){for(var s=n?Le:De,r=t[0].length,a=t.length,o=a,h=st(a),l=1/0,u=[];o--;){var c=t[o];o&&e&&(c=Be(c,Ze(e))),l=gi(c.length,l),h[o]=!n&&(e||r>=120&&c.length>=120)?new ji(o&&c):i}c=t[0];var d=-1,p=h[0];t:for(;++d<r&&u.length<l;){var f=c[d],m=e?e(f):f;if(f=n||0!==f?f:0,!(p?Qe(p,m):s(u,m,n))){for(o=a;--o;){var g=h[o];if(!(g?Qe(g,m):s(t[o],m,n)))continue t}p&&p.push(m),u.push(f)}}return u}function Cn(t,e,n){var s=null==(t=Mr(t,e=ys(e,t)))?t:t[Rr(Zr(e))];return null==s?i:Ee(s,t,n)}function In(t){return eo(t)&&Sn(t)==f}function Dn(t,e,n,s,r){return t===e||(null==t||null==e||!eo(t)&&!eo(e)?t!=t&&e!=e:function(t,e,n,s,r,a){var o=qa(t),h=qa(e),l=o?m:dr(t),u=h?m:dr(e),c=(l=l==f?E:l)==E,d=(u=u==f?E:u)==E,p=l==u;if(p&&$a(t)){if(!$a(e))return!1;o=!0,c=!1}if(p&&!c)return a||(a=new Yi),o||lo(t)?Ks(t,e,n,s,r,a):function(t,e,i,n,s,r,a){switch(i){case B:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case L:return!(t.byteLength!=e.byteLength||!r(new Vt(t),new Vt(e)));case g:case y:case S:return Wa(+t,+e);case v:return t.name==e.name&&t.message==e.message;case A:case C:return t==e+"";case _:var o=ri;case T:var h=1&n;if(o||(o=hi),t.size!=e.size&&!h)return!1;var l=a.get(t);if(l)return l==e;n|=2,a.set(t,e);var u=Ks(o(t),o(e),n,s,r,a);return a.delete(t),u;case I:if(Ni)return Ni.call(t)==Ni.call(e)}return!1}(t,e,l,n,s,r,a);if(!(1&n)){var x=c&&kt.call(t,"__wrapped__"),b=d&&kt.call(e,"__wrapped__");if(x||b){var w=x?t.value():t,M=b?e.value():e;return a||(a=new Yi),r(w,M,n,s,a)}}if(!p)return!1;return a||(a=new Yi),function(t,e,n,s,r,a){var o=1&n,h=er(t),l=h.length,u=er(e),c=u.length;if(l!=c&&!o)return!1;var d=l;for(;d--;){var p=h[d];if(!(o?p in e:kt.call(e,p)))return!1}var f=a.get(t),m=a.get(e);if(f&&m)return f==e&&m==t;var g=!0;a.set(t,e),a.set(e,t);var y=o;for(;++d<l;){var v=t[p=h[d]],x=e[p];if(s)var b=o?s(x,v,p,e,t,a):s(v,x,p,t,e,a);if(!(b===i?v===x||r(v,x,n,s,a):b)){g=!1;break}y||(y="constructor"==p)}if(g&&!y){var w=t.constructor,_=e.constructor;w==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof w&&w instanceof w&&"function"==typeof _&&_ instanceof _||(g=!1)}return a.delete(t),a.delete(e),g}(t,e,n,s,r,a)}(t,e,n,s,Dn,r))}function Ln(t,e,n,s){var r=n.length,a=r,o=!s;if(null==t)return!a;for(t=Mt(t);r--;){var h=n[r];if(o&&h[2]?h[1]!==t[h[0]]:!(h[0]in t))return!1}for(;++r<a;){var l=(h=n[r])[0],u=t[l],c=h[1];if(o&&h[2]){if(u===i&&!(l in t))return!1}else{var d=new Yi;if(s)var p=s(u,c,l,t,e,d);if(!(p===i?Dn(c,u,3,s,d):p))return!1}}return!0}function Bn(t){return!(!to(t)||(e=t,Ot&&Ot in e))&&(Ja(t)?Wt:mt).test(zr(t));var e}function Pn(t){return"function"==typeof t?t:null==t?sh:"object"==typeof t?qa(t)?Hn(t[0],t[1]):zn(t):ph(t)}function kn(t){if(!wr(t))return fi(t);var e=[];for(var i in Mt(t))kt.call(t,i)&&"constructor"!=i&&e.push(i);return e}function Nn(t){if(!to(t))return function(t){var e=[];if(null!=t)for(var i in Mt(t))e.push(i);return e}(t);var e=wr(t),i=[];for(var n in t)("constructor"!=n||!e&&kt.call(t,n))&&i.push(n);return i}function On(t,e){return t<e}function Rn(t,e){var i=-1,n=Ya(t)?st(t.length):[];return un(t,(function(t,s,r){n[++i]=e(t,s,r)})),n}function zn(t){var e=hr(t);return 1==e.length&&e[0][2]?Sr(e[0][0],e[0][1]):function(i){return i===t||Ln(i,t,e)}}function Hn(t,e){return vr(t)&&_r(e)?Sr(Rr(t),e):function(n){var s=To(n,t);return s===i&&s===e?Co(n,t):Dn(e,s,3)}}function Wn(t,e,n,s,r){t!==e&&gn(e,(function(a,o){if(r||(r=new Yi),to(a))!function(t,e,n,s,r,a,o){var h=Ar(t,n),l=Ar(e,n),u=o.get(l);if(u)return void Ji(t,n,u);var c=a?a(h,l,n+"",t,e,o):i,d=c===i;if(d){var p=qa(l),f=!p&&$a(l),m=!p&&!f&&lo(l);c=l,p||f||m?qa(h)?c=h:Ga(h)?c=Ts(h):f?(d=!1,c=ws(l,!0)):m?(d=!1,c=Ss(l,!0)):c=[]:so(l)||Va(l)?(c=h,Va(h)?c=vo(h):to(h)&&!Ja(h)||(c=fr(l))):d=!1}d&&(o.set(l,c),r(c,l,s,a,o),o.delete(l));Ji(t,n,c)}(t,e,o,n,Wn,s,r);else{var h=s?s(Ar(t,o),a,o+"",t,e,r):i;h===i&&(h=a),Ji(t,o,h)}}),Po)}function Fn(t,e){var n=t.length;if(n)return gr(e+=e<0?n:0,n)?t[e]:i}function Un(t,e,i){e=e.length?Be(e,(function(t){return qa(t)?function(e){return wn(e,1===t.length?t[0]:t)}:t})):[sh];var n=-1;return e=Be(e,Ze(ar())),function(t,e){var i=t.length;for(t.sort(e);i--;)t[i]=t[i].value;return t}(Rn(t,(function(t,i,s){return{criteria:Be(e,(function(e){return e(t)})),index:++n,value:t}})),(function(t,e){return function(t,e,i){var n=-1,s=t.criteria,r=e.criteria,a=s.length,o=i.length;for(;++n<a;){var h=Es(s[n],r[n]);if(h)return n>=o?h:h*("desc"==i[n]?-1:1)}return t.index-e.index}(t,e,i)}))}function Vn(t,e,i){for(var n=-1,s=e.length,r={};++n<s;){var a=e[n],o=wn(t,a);i(o,a)&&Jn(r,ys(a,t),o)}return r}function qn(t,e,i,n){var s=n?Fe:We,r=-1,a=e.length,o=t;for(t===e&&(e=Ts(e)),i&&(o=Be(t,Ze(i)));++r<a;)for(var h=0,l=e[r],u=i?i(l):l;(h=s(o,u,h,n))>-1;)o!==t&&$t.call(o,h,1),$t.call(t,h,1);return t}function jn(t,e){for(var i=t?e.length:0,n=i-1;i--;){var s=e[i];if(i==n||s!==r){var r=s;gr(s)?$t.call(t,s,1):ls(t,s)}}return t}function Yn(t,e){return t+fe(xi()*(e-t+1))}function Gn(t,e){var i="";if(!t||e<1||e>u)return i;do{e%2&&(i+=t),(e=fe(e/2))&&(t+=t)}while(e);return i}function $n(t,e){return Ir(Er(t,e,sh),t+"")}function Xn(t){return $i(Fo(t))}function Zn(t,e){var i=Fo(t);return Br(i,rn(e,0,i.length))}function Jn(t,e,n,s){if(!to(t))return t;for(var r=-1,a=(e=ys(e,t)).length,o=a-1,h=t;null!=h&&++r<a;){var l=Rr(e[r]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(r!=o){var c=h[l];(u=s?s(c,l,h):i)===i&&(u=to(c)?c:gr(e[r+1])?[]:{})}Qi(h,l,u),h=h[l]}return t}var Qn=Ti?function(t,e){return Ti.set(t,e),t}:sh,Kn=ee?function(t,e){return ee(t,"toString",{configurable:!0,enumerable:!1,value:eh(e),writable:!0})}:sh;function ts(t){return Br(Fo(t))}function es(t,e,i){var n=-1,s=t.length;e<0&&(e=-e>s?0:s+e),(i=i>s?s:i)<0&&(i+=s),s=e>i?0:i-e>>>0,e>>>=0;for(var r=st(s);++n<s;)r[n]=t[n+e];return r}function is(t,e){var i;return un(t,(function(t,n,s){return!(i=e(t,n,s))})),!!i}function ns(t,e,i){var n=0,s=null==t?n:t.length;if("number"==typeof e&&e==e&&s<=2147483647){for(;n<s;){var r=n+s>>>1,a=t[r];null!==a&&!ho(a)&&(i?a<=e:a<e)?n=r+1:s=r}return s}return ss(t,e,sh,i)}function ss(t,e,n,s){var r=0,a=null==t?0:t.length;if(0===a)return 0;for(var o=(e=n(e))!=e,h=null===e,l=ho(e),u=e===i;r<a;){var c=fe((r+a)/2),d=n(t[c]),p=d!==i,f=null===d,m=d==d,g=ho(d);if(o)var y=s||m;else y=u?m&&(s||p):h?m&&p&&(s||!f):l?m&&p&&!f&&(s||!g):!f&&!g&&(s?d<=e:d<e);y?r=c+1:a=c}return gi(a,4294967294)}function rs(t,e){for(var i=-1,n=t.length,s=0,r=[];++i<n;){var a=t[i],o=e?e(a):a;if(!i||!Wa(o,h)){var h=o;r[s++]=0===a?0:a}}return r}function as(t){return"number"==typeof t?t:ho(t)?c:+t}function os(t){if("string"==typeof t)return t;if(qa(t))return Be(t,os)+"";if(ho(t))return Oi?Oi.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function hs(t,e,i){var n=-1,s=De,r=t.length,a=!0,o=[],h=o;if(i)a=!1,s=Le;else if(r>=200){var l=e?null:Gs(t);if(l)return hi(l);a=!1,s=Qe,h=new ji}else h=e?[]:o;t:for(;++n<r;){var u=t[n],c=e?e(u):u;if(u=i||0!==u?u:0,a&&c==c){for(var d=h.length;d--;)if(h[d]===c)continue t;e&&h.push(c),o.push(u)}else s(h,c,i)||(h!==o&&h.push(c),o.push(u))}return o}function ls(t,e){return null==(t=Mr(t,e=ys(e,t)))||delete t[Rr(Zr(e))]}function us(t,e,i,n){return Jn(t,e,i(wn(t,e)),n)}function cs(t,e,i,n){for(var s=t.length,r=n?s:-1;(n?r--:++r<s)&&e(t[r],r,t););return i?es(t,n?0:r,n?r+1:s):es(t,n?r+1:0,n?s:r)}function ds(t,e){var i=t;return i instanceof Fi&&(i=i.value()),ke(e,(function(t,e){return e.func.apply(e.thisArg,Pe([t],e.args))}),i)}function ps(t,e,i){var n=t.length;if(n<2)return n?hs(t[0]):[];for(var s=-1,r=st(n);++s<n;)for(var a=t[s],o=-1;++o<n;)o!=s&&(r[s]=ln(r[s]||a,t[o],e,i));return hs(mn(r,1),e,i)}function fs(t,e,n){for(var s=-1,r=t.length,a=e.length,o={};++s<r;){var h=s<a?e[s]:i;n(o,t[s],h)}return o}function ms(t){return Ga(t)?t:[]}function gs(t){return"function"==typeof t?t:sh}function ys(t,e){return qa(t)?t:vr(t,e)?[t]:Or(xo(t))}var vs=$n;function xs(t,e,n){var s=t.length;return n=n===i?s:n,!e&&n>=s?t:es(t,e,n)}var bs=oe||function(t){return de.clearTimeout(t)};function ws(t,e){if(e)return t.slice();var i=t.length,n=qt?qt(i):new t.constructor(i);return t.copy(n),n}function _s(t){var e=new t.constructor(t.byteLength);return new Vt(e).set(new Vt(t)),e}function Ss(t,e){var i=e?_s(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}function Es(t,e){if(t!==e){var n=t!==i,s=null===t,r=t==t,a=ho(t),o=e!==i,h=null===e,l=e==e,u=ho(e);if(!h&&!u&&!a&&t>e||a&&o&&l&&!h&&!u||s&&o&&l||!n&&l||!r)return 1;if(!s&&!a&&!u&&t<e||u&&n&&r&&!s&&!a||h&&n&&r||!o&&r||!l)return-1}return 0}function Ms(t,e,i,n){for(var s=-1,r=t.length,a=i.length,o=-1,h=e.length,l=mi(r-a,0),u=st(h+l),c=!n;++o<h;)u[o]=e[o];for(;++s<a;)(c||s<r)&&(u[i[s]]=t[s]);for(;l--;)u[o++]=t[s++];return u}function As(t,e,i,n){for(var s=-1,r=t.length,a=-1,o=i.length,h=-1,l=e.length,u=mi(r-o,0),c=st(u+l),d=!n;++s<u;)c[s]=t[s];for(var p=s;++h<l;)c[p+h]=e[h];for(;++a<o;)(d||s<r)&&(c[p+i[a]]=t[s++]);return c}function Ts(t,e){var i=-1,n=t.length;for(e||(e=st(n));++i<n;)e[i]=t[i];return e}function Cs(t,e,n,s){var r=!n;n||(n={});for(var a=-1,o=e.length;++a<o;){var h=e[a],l=s?s(n[h],t[h],h,n,t):i;l===i&&(l=t[h]),r?nn(n,h,l):Qi(n,h,l)}return n}function Is(t,e){return function(i,n){var s=qa(i)?Me:tn,r=e?e():{};return s(i,t,ar(n,2),r)}}function Ds(t){return $n((function(e,n){var s=-1,r=n.length,a=r>1?n[r-1]:i,o=r>2?n[2]:i;for(a=t.length>3&&"function"==typeof a?(r--,a):i,o&&yr(n[0],n[1],o)&&(a=r<3?i:a,r=1),e=Mt(e);++s<r;){var h=n[s];h&&t(e,h,s,a)}return e}))}function Ls(t,e){return function(i,n){if(null==i)return i;if(!Ya(i))return t(i,n);for(var s=i.length,r=e?s:-1,a=Mt(i);(e?r--:++r<s)&&!1!==n(a[r],r,a););return i}}function Bs(t){return function(e,i,n){for(var s=-1,r=Mt(e),a=n(e),o=a.length;o--;){var h=a[t?o:++s];if(!1===i(r[h],h,r))break}return e}}function Ps(t){return function(e){var n=si(e=xo(e))?ui(e):i,s=n?n[0]:e.charAt(0),r=n?xs(n,1).join(""):e.slice(1);return s[t]()+r}}function ks(t){return function(e){return ke(Qo(qo(e).replace(Jt,"")),t,"")}}function Ns(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var i=zi(t.prototype),n=t.apply(i,e);return to(n)?n:i}}function Os(t){return function(e,n,s){var r=Mt(e);if(!Ya(e)){var a=ar(n,3);e=Bo(e),n=function(t){return a(r[t],t,r)}}var o=t(e,n,s);return o>-1?r[a?e[o]:o]:i}}function Rs(t){return tr((function(e){var s=e.length,r=s,a=Wi.prototype.thru;for(t&&e.reverse();r--;){var o=e[r];if("function"!=typeof o)throw new Ct(n);if(a&&!h&&"wrapper"==sr(o))var h=new Wi([],!0)}for(r=h?r:s;++r<s;){var l=sr(o=e[r]),u="wrapper"==l?nr(o):i;h=u&&xr(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?h[sr(u[0])].apply(h,u[3]):1==o.length&&xr(o)?h[l]():h.thru(o)}return function(){var t=arguments,i=t[0];if(h&&1==t.length&&qa(i))return h.plant(i).value();for(var n=0,r=s?e[n].apply(this,t):i;++n<s;)r=e[n].call(this,r);return r}}))}function zs(t,e,n,s,r,a,h,l,u,c){var d=e&o,p=1&e,f=2&e,m=24&e,g=512&e,y=f?i:Ns(t);return function o(){for(var v=arguments.length,x=st(v),b=v;b--;)x[b]=arguments[b];if(m)var w=rr(o),_=function(t,e){for(var i=t.length,n=0;i--;)t[i]===e&&++n;return n}(x,w);if(s&&(x=Ms(x,s,r,m)),a&&(x=As(x,a,h,m)),v-=_,m&&v<c){var S=oi(x,w);return js(t,e,zs,o.placeholder,n,x,S,l,u,c-v)}var E=p?n:this,M=f?E[t]:t;return v=x.length,l?x=function(t,e){var n=t.length,s=gi(e.length,n),r=Ts(t);for(;s--;){var a=e[s];t[s]=gr(a,n)?r[a]:i}return t}(x,l):g&&v>1&&x.reverse(),d&&u<v&&(x.length=u),this&&this!==de&&this instanceof o&&(M=y||Ns(M)),M.apply(E,x)}}function Hs(t,e){return function(i,n){return function(t,e,i,n){return vn(t,(function(t,s,r){e(n,i(t),s,r)})),n}(i,t,e(n),{})}}function Ws(t,e){return function(n,s){var r;if(n===i&&s===i)return e;if(n!==i&&(r=n),s!==i){if(r===i)return s;"string"==typeof n||"string"==typeof s?(n=os(n),s=os(s)):(n=as(n),s=as(s)),r=t(n,s)}return r}}function Fs(t){return tr((function(e){return e=Be(e,Ze(ar())),$n((function(i){var n=this;return t(e,(function(t){return Ee(t,n,i)}))}))}))}function Us(t,e){var n=(e=e===i?" ":os(e)).length;if(n<2)return n?Gn(e,t):e;var s=Gn(e,pe(t/li(e)));return si(e)?xs(ui(s),0,t).join(""):s.slice(0,t)}function Vs(t){return function(e,n,s){return s&&"number"!=typeof s&&yr(e,n,s)&&(n=s=i),e=fo(e),n===i?(n=e,e=0):n=fo(n),function(t,e,i,n){for(var s=-1,r=mi(pe((e-t)/(i||1)),0),a=st(r);r--;)a[n?r:++s]=t,t+=i;return a}(e,n,s=s===i?e<n?1:-1:fo(s),t)}}function qs(t){return function(e,i){return"string"==typeof e&&"string"==typeof i||(e=yo(e),i=yo(i)),t(e,i)}}function js(t,e,n,s,r,o,h,l,u,c){var d=8&e;e|=d?a:64,4&(e&=~(d?64:a))||(e&=-4);var p=[t,e,r,d?o:i,d?h:i,d?i:o,d?i:h,l,u,c],f=n.apply(i,p);return xr(t)&&Tr(f,p),f.placeholder=s,Dr(f,t,e)}function Ys(t){var e=Et[t];return function(t,i){if(t=yo(t),(i=null==i?0:gi(mo(i),292))&&Re(t)){var n=(xo(t)+"e").split("e");return+((n=(xo(e(n[0]+"e"+(+n[1]+i)))+"e").split("e"))[0]+"e"+(+n[1]-i))}return e(t)}}var Gs=Ei&&1/hi(new Ei([,-0]))[1]==l?function(t){return new Ei(t)}:lh;function $s(t){return function(e){var i=dr(e);return i==_?ri(e):i==T?function(t){var e=-1,i=Array(t.size);return t.forEach((function(t){i[++e]=[t,t]})),i}(e):function(t,e){return Be(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Xs(t,e,s,l,u,c,d,p){var f=2&e;if(!f&&"function"!=typeof t)throw new Ct(n);var m=l?l.length:0;if(m||(e&=-97,l=u=i),d=d===i?d:mi(mo(d),0),p=p===i?p:mo(p),m-=u?u.length:0,64&e){var g=l,y=u;l=u=i}var v=f?i:nr(t),x=[t,e,s,l,u,g,y,c,d,p];if(v&&function(t,e){var i=t[1],n=e[1],s=i|n,a=s<131,l=n==o&&8==i||n==o&&i==h&&t[7].length<=e[8]||384==n&&e[7].length<=e[8]&&8==i;if(!a&&!l)return t;1&n&&(t[2]=e[2],s|=1&i?0:4);var u=e[3];if(u){var c=t[3];t[3]=c?Ms(c,u,e[4]):u,t[4]=c?oi(t[3],r):e[4]}(u=e[5])&&(c=t[5],t[5]=c?As(c,u,e[6]):u,t[6]=c?oi(t[5],r):e[6]);(u=e[7])&&(t[7]=u);n&o&&(t[8]=null==t[8]?e[8]:gi(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=s}(x,v),t=x[0],e=x[1],s=x[2],l=x[3],u=x[4],!(p=x[9]=x[9]===i?f?0:t.length:mi(x[9]-m,0))&&24&e&&(e&=-25),e&&1!=e)b=8==e||16==e?function(t,e,n){var s=Ns(t);return function r(){for(var a=arguments.length,o=st(a),h=a,l=rr(r);h--;)o[h]=arguments[h];var u=a<3&&o[0]!==l&&o[a-1]!==l?[]:oi(o,l);return(a-=u.length)<n?js(t,e,zs,r.placeholder,i,o,u,i,i,n-a):Ee(this&&this!==de&&this instanceof r?s:t,this,o)}}(t,e,p):e!=a&&33!=e||u.length?zs.apply(i,x):function(t,e,i,n){var s=1&e,r=Ns(t);return function e(){for(var a=-1,o=arguments.length,h=-1,l=n.length,u=st(l+o),c=this&&this!==de&&this instanceof e?r:t;++h<l;)u[h]=n[h];for(;o--;)u[h++]=arguments[++a];return Ee(c,s?i:this,u)}}(t,e,s,l);else var b=function(t,e,i){var n=1&e,s=Ns(t);return function e(){return(this&&this!==de&&this instanceof e?s:t).apply(n?i:this,arguments)}}(t,e,s);return Dr((v?Qn:Tr)(b,x),t,e)}function Zs(t,e,n,s){return t===i||Wa(t,Lt[n])&&!kt.call(s,n)?e:t}function Js(t,e,n,s,r,a){return to(t)&&to(e)&&(a.set(e,t),Wn(t,e,i,Js,a),a.delete(e)),t}function Qs(t){return so(t)?i:t}function Ks(t,e,n,s,r,a){var o=1&n,h=t.length,l=e.length;if(h!=l&&!(o&&l>h))return!1;var u=a.get(t),c=a.get(e);if(u&&c)return u==e&&c==t;var d=-1,p=!0,f=2&n?new ji:i;for(a.set(t,e),a.set(e,t);++d<h;){var m=t[d],g=e[d];if(s)var y=o?s(g,m,d,e,t,a):s(m,g,d,t,e,a);if(y!==i){if(y)continue;p=!1;break}if(f){if(!Oe(e,(function(t,e){if(!Qe(f,e)&&(m===t||r(m,t,n,s,a)))return f.push(e)}))){p=!1;break}}else if(m!==g&&!r(m,g,n,s,a)){p=!1;break}}return a.delete(t),a.delete(e),p}function tr(t){return Ir(Er(t,i,jr),t+"")}function er(t){return _n(t,Bo,ur)}function ir(t){return _n(t,Po,cr)}var nr=Ti?function(t){return Ti.get(t)}:lh;function sr(t){for(var e=t.name+"",i=Ci[e],n=kt.call(Ci,e)?i.length:0;n--;){var s=i[n],r=s.func;if(null==r||r==t)return s.name}return e}function rr(t){return(kt.call(Ri,"placeholder")?Ri:t).placeholder}function ar(){var t=Ri.iteratee||rh;return t=t===rh?Pn:t,arguments.length?t(arguments[0],arguments[1]):t}function or(t,e){var i,n,s=t.__data__;return("string"==(n=typeof(i=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==i:null===i)?s["string"==typeof e?"string":"hash"]:s.map}function hr(t){for(var e=Bo(t),i=e.length;i--;){var n=e[i],s=t[n];e[i]=[n,s,_r(s)]}return e}function lr(t,e){var n=function(t,e){return null==t?i:t[e]}(t,e);return Bn(n)?n:i}var ur=ge?function(t){return null==t?[]:(t=Mt(t),Ie(ge(t),(function(e){return Gt.call(t,e)})))}:gh,cr=ge?function(t){for(var e=[];t;)Pe(e,ur(t)),t=jt(t);return e}:gh,dr=Sn;function pr(t,e,i){for(var n=-1,s=(e=ys(e,t)).length,r=!1;++n<s;){var a=Rr(e[n]);if(!(r=null!=t&&i(t,a)))break;t=t[a]}return r||++n!=s?r:!!(s=null==t?0:t.length)&&Ka(s)&&gr(a,s)&&(qa(t)||Va(t))}function fr(t){return"function"!=typeof t.constructor||wr(t)?{}:zi(jt(t))}function mr(t){return qa(t)||Va(t)||!!(Xt&&t&&t[Xt])}function gr(t,e){var i=typeof t;return!!(e=null==e?u:e)&&("number"==i||"symbol"!=i&&yt.test(t))&&t>-1&&t%1==0&&t<e}function yr(t,e,i){if(!to(i))return!1;var n=typeof e;return!!("number"==n?Ya(i)&&gr(e,i.length):"string"==n&&e in i)&&Wa(i[e],t)}function vr(t,e){if(qa(t))return!1;var i=typeof t;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=t&&!ho(t))||(K.test(t)||!Q.test(t)||null!=e&&t in Mt(e))}function xr(t){var e=sr(t),i=Ri[e];if("function"!=typeof i||!(e in Fi.prototype))return!1;if(t===i)return!0;var n=nr(i);return!!n&&t===n[0]}(wi&&dr(new wi(new ArrayBuffer(1)))!=B||_i&&dr(new _i)!=_||Si&&dr(Si.resolve())!=M||Ei&&dr(new Ei)!=T||Mi&&dr(new Mi)!=D)&&(dr=function(t){var e=Sn(t),n=e==E?t.constructor:i,s=n?zr(n):"";if(s)switch(s){case Ii:return B;case Di:return _;case Li:return M;case Bi:return T;case Pi:return D}return e});var br=Bt?Ja:yh;function wr(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Lt)}function _r(t){return t==t&&!to(t)}function Sr(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==i||t in Mt(n)))}}function Er(t,e,n){return e=mi(e===i?t.length-1:e,0),function(){for(var i=arguments,s=-1,r=mi(i.length-e,0),a=st(r);++s<r;)a[s]=i[e+s];s=-1;for(var o=st(e+1);++s<e;)o[s]=i[s];return o[e]=n(a),Ee(t,this,o)}}function Mr(t,e){return e.length<2?t:wn(t,es(e,0,-1))}function Ar(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Tr=Lr(Qn),Cr=ce||function(t,e){return de.setTimeout(t,e)},Ir=Lr(Kn);function Dr(t,e,i){var n=e+"";return Ir(t,function(t,e){var i=e.length;if(!i)return t;var n=i-1;return e[n]=(i>1?"& ":"")+e[n],e=e.join(i>2?", ":" "),t.replace(rt,"{\n/* [wrapped with "+e+"] */\n")}(n,function(t,e){return Ae(p,(function(i){var n="_."+i[0];e&i[1]&&!De(t,n)&&t.push(n)})),t.sort()}(function(t){var e=t.match(at);return e?e[1].split(ot):[]}(n),i)))}function Lr(t){var e=0,n=0;return function(){var s=yi(),r=16-(s-n);if(n=s,r>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function Br(t,e){var n=-1,s=t.length,r=s-1;for(e=e===i?s:e;++n<e;){var a=Yn(n,r),o=t[a];t[a]=t[n],t[n]=o}return t.length=e,t}var Pr,kr,Nr,Or=(Pr=function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(tt,(function(t,i,n,s){e.push(n?s.replace(ut,"$1"):i||t)})),e},kr=ka(Pr,(function(t){return 500===Nr.size&&Nr.clear(),t})),Nr=kr.cache,kr);function Rr(t){if("string"==typeof t||ho(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function zr(t){if(null!=t){try{return Pt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Hr(t){if(t instanceof Fi)return t.clone();var e=new Wi(t.__wrapped__,t.__chain__);return e.__actions__=Ts(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Wr=$n((function(t,e){return Ga(t)?ln(t,mn(e,1,Ga,!0)):[]})),Fr=$n((function(t,e){var n=Zr(e);return Ga(n)&&(n=i),Ga(t)?ln(t,mn(e,1,Ga,!0),ar(n,2)):[]})),Ur=$n((function(t,e){var n=Zr(e);return Ga(n)&&(n=i),Ga(t)?ln(t,mn(e,1,Ga,!0),i,n):[]}));function Vr(t,e,i){var n=null==t?0:t.length;if(!n)return-1;var s=null==i?0:mo(i);return s<0&&(s=mi(n+s,0)),He(t,ar(e,3),s)}function qr(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var r=s-1;return n!==i&&(r=mo(n),r=n<0?mi(s+r,0):gi(r,s-1)),He(t,ar(e,3),r,!0)}function jr(t){return(null==t?0:t.length)?mn(t,1):[]}function Yr(t){return t&&t.length?t[0]:i}var Gr=$n((function(t){var e=Be(t,ms);return e.length&&e[0]===t[0]?Tn(e):[]})),$r=$n((function(t){var e=Zr(t),n=Be(t,ms);return e===Zr(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Tn(n,ar(e,2)):[]})),Xr=$n((function(t){var e=Zr(t),n=Be(t,ms);return(e="function"==typeof e?e:i)&&n.pop(),n.length&&n[0]===t[0]?Tn(n,i,e):[]}));function Zr(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Jr=$n(Qr);function Qr(t,e){return t&&t.length&&e&&e.length?qn(t,e):t}var Kr=tr((function(t,e){var i=null==t?0:t.length,n=sn(t,e);return jn(t,Be(e,(function(t){return gr(t,i)?+t:t})).sort(Es)),n}));function ta(t){return null==t?t:bi.call(t)}var ea=$n((function(t){return hs(mn(t,1,Ga,!0))})),ia=$n((function(t){var e=Zr(t);return Ga(e)&&(e=i),hs(mn(t,1,Ga,!0),ar(e,2))})),na=$n((function(t){var e=Zr(t);return e="function"==typeof e?e:i,hs(mn(t,1,Ga,!0),i,e)}));function sa(t){if(!t||!t.length)return[];var e=0;return t=Ie(t,(function(t){if(Ga(t))return e=mi(t.length,e),!0})),$e(e,(function(e){return Be(t,qe(e))}))}function ra(t,e){if(!t||!t.length)return[];var n=sa(t);return null==e?n:Be(n,(function(t){return Ee(e,i,t)}))}var aa=$n((function(t,e){return Ga(t)?ln(t,e):[]})),oa=$n((function(t){return ps(Ie(t,Ga))})),ha=$n((function(t){var e=Zr(t);return Ga(e)&&(e=i),ps(Ie(t,Ga),ar(e,2))})),la=$n((function(t){var e=Zr(t);return e="function"==typeof e?e:i,ps(Ie(t,Ga),i,e)})),ua=$n(sa);var ca=$n((function(t){var e=t.length,n=e>1?t[e-1]:i;return n="function"==typeof n?(t.pop(),n):i,ra(t,n)}));function da(t){var e=Ri(t);return e.__chain__=!0,e}function pa(t,e){return e(t)}var fa=tr((function(t){var e=t.length,n=e?t[0]:0,s=this.__wrapped__,r=function(e){return sn(e,t)};return!(e>1||this.__actions__.length)&&s instanceof Fi&&gr(n)?((s=s.slice(n,+n+(e?1:0))).__actions__.push({func:pa,args:[r],thisArg:i}),new Wi(s,this.__chain__).thru((function(t){return e&&!t.length&&t.push(i),t}))):this.thru(r)}));var ma=Is((function(t,e,i){kt.call(t,i)?++t[i]:nn(t,i,1)}));var ga=Os(Vr),ya=Os(qr);function va(t,e){return(qa(t)?Ae:un)(t,ar(e,3))}function xa(t,e){return(qa(t)?Te:cn)(t,ar(e,3))}var ba=Is((function(t,e,i){kt.call(t,i)?t[i].push(e):nn(t,i,[e])}));var wa=$n((function(t,e,i){var n=-1,s="function"==typeof e,r=Ya(t)?st(t.length):[];return un(t,(function(t){r[++n]=s?Ee(e,t,i):Cn(t,e,i)})),r})),_a=Is((function(t,e,i){nn(t,i,e)}));function Sa(t,e){return(qa(t)?Be:Rn)(t,ar(e,3))}var Ea=Is((function(t,e,i){t[i?0:1].push(e)}),(function(){return[[],[]]}));var Ma=$n((function(t,e){if(null==t)return[];var i=e.length;return i>1&&yr(t,e[0],e[1])?e=[]:i>2&&yr(e[0],e[1],e[2])&&(e=[e[0]]),Un(t,mn(e,1),[])})),Aa=ue||function(){return de.Date.now()};function Ta(t,e,n){return e=n?i:e,e=t&&null==e?t.length:e,Xs(t,o,i,i,i,i,e)}function Ca(t,e){var s;if("function"!=typeof e)throw new Ct(n);return t=mo(t),function(){return--t>0&&(s=e.apply(this,arguments)),t<=1&&(e=i),s}}var Ia=$n((function(t,e,i){var n=1;if(i.length){var s=oi(i,rr(Ia));n|=a}return Xs(t,n,e,i,s)})),Da=$n((function(t,e,i){var n=3;if(i.length){var s=oi(i,rr(Da));n|=a}return Xs(e,n,t,i,s)}));function La(t,e,s){var r,a,o,h,l,u,c=0,d=!1,p=!1,f=!0;if("function"!=typeof t)throw new Ct(n);function m(e){var n=r,s=a;return r=a=i,c=e,h=t.apply(s,n)}function g(t){var n=t-u;return u===i||n>=e||n<0||p&&t-c>=o}function y(){var t=Aa();if(g(t))return v(t);l=Cr(y,function(t){var i=e-(t-u);return p?gi(i,o-(t-c)):i}(t))}function v(t){return l=i,f&&r?m(t):(r=a=i,h)}function x(){var t=Aa(),n=g(t);if(r=arguments,a=this,u=t,n){if(l===i)return function(t){return c=t,l=Cr(y,e),d?m(t):h}(u);if(p)return bs(l),l=Cr(y,e),m(u)}return l===i&&(l=Cr(y,e)),h}return e=yo(e)||0,to(s)&&(d=!!s.leading,o=(p="maxWait"in s)?mi(yo(s.maxWait)||0,e):o,f="trailing"in s?!!s.trailing:f),x.cancel=function(){l!==i&&bs(l),c=0,r=u=a=l=i},x.flush=function(){return l===i?h:v(Aa())},x}var Ba=$n((function(t,e){return hn(t,1,e)})),Pa=$n((function(t,e,i){return hn(t,yo(e)||0,i)}));function ka(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Ct(n);var i=function(){var n=arguments,s=e?e.apply(this,n):n[0],r=i.cache;if(r.has(s))return r.get(s);var a=t.apply(this,n);return i.cache=r.set(s,a)||r,a};return i.cache=new(ka.Cache||qi),i}function Na(t){if("function"!=typeof t)throw new Ct(n);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}ka.Cache=qi;var Oa=vs((function(t,e){var i=(e=1==e.length&&qa(e[0])?Be(e[0],Ze(ar())):Be(mn(e,1),Ze(ar()))).length;return $n((function(n){for(var s=-1,r=gi(n.length,i);++s<r;)n[s]=e[s].call(this,n[s]);return Ee(t,this,n)}))})),Ra=$n((function(t,e){var n=oi(e,rr(Ra));return Xs(t,a,i,e,n)})),za=$n((function(t,e){var n=oi(e,rr(za));return Xs(t,64,i,e,n)})),Ha=tr((function(t,e){return Xs(t,h,i,i,i,e)}));function Wa(t,e){return t===e||t!=t&&e!=e}var Fa=qs(En),Ua=qs((function(t,e){return t>=e})),Va=In(function(){return arguments}())?In:function(t){return eo(t)&&kt.call(t,"callee")&&!Gt.call(t,"callee")},qa=st.isArray,ja=ve?Ze(ve):function(t){return eo(t)&&Sn(t)==L};function Ya(t){return null!=t&&Ka(t.length)&&!Ja(t)}function Ga(t){return eo(t)&&Ya(t)}var $a=ye||yh,Xa=xe?Ze(xe):function(t){return eo(t)&&Sn(t)==y};function Za(t){if(!eo(t))return!1;var e=Sn(t);return e==v||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!so(t)}function Ja(t){if(!to(t))return!1;var e=Sn(t);return e==x||e==b||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Qa(t){return"number"==typeof t&&t==mo(t)}function Ka(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=u}function to(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function eo(t){return null!=t&&"object"==typeof t}var io=be?Ze(be):function(t){return eo(t)&&dr(t)==_};function no(t){return"number"==typeof t||eo(t)&&Sn(t)==S}function so(t){if(!eo(t)||Sn(t)!=E)return!1;var e=jt(t);if(null===e)return!0;var i=kt.call(e,"constructor")&&e.constructor;return"function"==typeof i&&i instanceof i&&Pt.call(i)==zt}var ro=we?Ze(we):function(t){return eo(t)&&Sn(t)==A};var ao=_e?Ze(_e):function(t){return eo(t)&&dr(t)==T};function oo(t){return"string"==typeof t||!qa(t)&&eo(t)&&Sn(t)==C}function ho(t){return"symbol"==typeof t||eo(t)&&Sn(t)==I}var lo=Se?Ze(Se):function(t){return eo(t)&&Ka(t.length)&&!!re[Sn(t)]};var uo=qs(On),co=qs((function(t,e){return t<=e}));function po(t){if(!t)return[];if(Ya(t))return oo(t)?ui(t):Ts(t);if(Zt&&t[Zt])return function(t){for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}(t[Zt]());var e=dr(t);return(e==_?ri:e==T?hi:Fo)(t)}function fo(t){return t?(t=yo(t))===l||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function mo(t){var e=fo(t),i=e%1;return e==e?i?e-i:e:0}function go(t){return t?rn(mo(t),0,d):0}function yo(t){if("number"==typeof t)return t;if(ho(t))return c;if(to(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=to(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Xe(t);var i=ft.test(t);return i||gt.test(t)?le(t.slice(2),i?2:8):pt.test(t)?c:+t}function vo(t){return Cs(t,Po(t))}function xo(t){return null==t?"":os(t)}var bo=Ds((function(t,e){if(wr(e)||Ya(e))Cs(e,Bo(e),t);else for(var i in e)kt.call(e,i)&&Qi(t,i,e[i])})),wo=Ds((function(t,e){Cs(e,Po(e),t)})),_o=Ds((function(t,e,i,n){Cs(e,Po(e),t,n)})),So=Ds((function(t,e,i,n){Cs(e,Bo(e),t,n)})),Eo=tr(sn);var Mo=$n((function(t,e){t=Mt(t);var n=-1,s=e.length,r=s>2?e[2]:i;for(r&&yr(e[0],e[1],r)&&(s=1);++n<s;)for(var a=e[n],o=Po(a),h=-1,l=o.length;++h<l;){var u=o[h],c=t[u];(c===i||Wa(c,Lt[u])&&!kt.call(t,u))&&(t[u]=a[u])}return t})),Ao=$n((function(t){return t.push(i,Js),Ee(No,i,t)}));function To(t,e,n){var s=null==t?i:wn(t,e);return s===i?n:s}function Co(t,e){return null!=t&&pr(t,e,An)}var Io=Hs((function(t,e,i){null!=e&&"function"!=typeof e.toString&&(e=Rt.call(e)),t[e]=i}),eh(sh)),Do=Hs((function(t,e,i){null!=e&&"function"!=typeof e.toString&&(e=Rt.call(e)),kt.call(t,e)?t[e].push(i):t[e]=[i]}),ar),Lo=$n(Cn);function Bo(t){return Ya(t)?Gi(t):kn(t)}function Po(t){return Ya(t)?Gi(t,!0):Nn(t)}var ko=Ds((function(t,e,i){Wn(t,e,i)})),No=Ds((function(t,e,i,n){Wn(t,e,i,n)})),Oo=tr((function(t,e){var i={};if(null==t)return i;var n=!1;e=Be(e,(function(e){return e=ys(e,t),n||(n=e.length>1),e})),Cs(t,ir(t),i),n&&(i=an(i,7,Qs));for(var s=e.length;s--;)ls(i,e[s]);return i}));var Ro=tr((function(t,e){return null==t?{}:function(t,e){return Vn(t,e,(function(e,i){return Co(t,i)}))}(t,e)}));function zo(t,e){if(null==t)return{};var i=Be(ir(t),(function(t){return[t]}));return e=ar(e),Vn(t,i,(function(t,i){return e(t,i[0])}))}var Ho=$s(Bo),Wo=$s(Po);function Fo(t){return null==t?[]:Je(t,Bo(t))}var Uo=ks((function(t,e,i){return e=e.toLowerCase(),t+(i?Vo(e):e)}));function Vo(t){return Jo(xo(t).toLowerCase())}function qo(t){return(t=xo(t))&&t.replace(vt,ei).replace(Qt,"")}var jo=ks((function(t,e,i){return t+(i?"-":"")+e.toLowerCase()})),Yo=ks((function(t,e,i){return t+(i?" ":"")+e.toLowerCase()})),Go=Ps("toLowerCase");var $o=ks((function(t,e,i){return t+(i?"_":"")+e.toLowerCase()}));var Xo=ks((function(t,e,i){return t+(i?" ":"")+Jo(e)}));var Zo=ks((function(t,e,i){return t+(i?" ":"")+e.toUpperCase()})),Jo=Ps("toUpperCase");function Qo(t,e,n){return t=xo(t),(e=n?i:e)===i?function(t){return ie.test(t)}(t)?function(t){return t.match(te)||[]}(t):function(t){return t.match(ht)||[]}(t):t.match(e)||[]}var Ko=$n((function(t,e){try{return Ee(t,i,e)}catch(t){return Za(t)?t:new _t(t)}})),th=tr((function(t,e){return Ae(e,(function(e){e=Rr(e),nn(t,e,Ia(t[e],t))})),t}));function eh(t){return function(){return t}}var ih=Rs(),nh=Rs(!0);function sh(t){return t}function rh(t){return Pn("function"==typeof t?t:an(t,1))}var ah=$n((function(t,e){return function(i){return Cn(i,t,e)}})),oh=$n((function(t,e){return function(i){return Cn(t,i,e)}}));function hh(t,e,i){var n=Bo(e),s=bn(e,n);null!=i||to(e)&&(s.length||!n.length)||(i=e,e=t,t=this,s=bn(e,Bo(e)));var r=!(to(i)&&"chain"in i&&!i.chain),a=Ja(t);return Ae(s,(function(i){var n=e[i];t[i]=n,a&&(t.prototype[i]=function(){var e=this.__chain__;if(r||e){var i=t(this.__wrapped__);return(i.__actions__=Ts(this.__actions__)).push({func:n,args:arguments,thisArg:t}),i.__chain__=e,i}return n.apply(t,Pe([this.value()],arguments))})})),t}function lh(){}var uh=Fs(Be),ch=Fs(Ce),dh=Fs(Oe);function ph(t){return vr(t)?qe(Rr(t)):function(t){return function(e){return wn(e,t)}}(t)}var fh=Vs(),mh=Vs(!0);function gh(){return[]}function yh(){return!1}var vh=Ws((function(t,e){return t+e}),0),xh=Ys("ceil"),bh=Ws((function(t,e){return t/e}),1),wh=Ys("floor");var _h,Sh=Ws((function(t,e){return t*e}),1),Eh=Ys("round"),Mh=Ws((function(t,e){return t-e}),0);return Ri.after=function(t,e){if("function"!=typeof e)throw new Ct(n);return t=mo(t),function(){if(--t<1)return e.apply(this,arguments)}},Ri.ary=Ta,Ri.assign=bo,Ri.assignIn=wo,Ri.assignInWith=_o,Ri.assignWith=So,Ri.at=Eo,Ri.before=Ca,Ri.bind=Ia,Ri.bindAll=th,Ri.bindKey=Da,Ri.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return qa(t)?t:[t]},Ri.chain=da,Ri.chunk=function(t,e,n){e=(n?yr(t,e,n):e===i)?1:mi(mo(e),0);var s=null==t?0:t.length;if(!s||e<1)return[];for(var r=0,a=0,o=st(pe(s/e));r<s;)o[a++]=es(t,r,r+=e);return o},Ri.compact=function(t){for(var e=-1,i=null==t?0:t.length,n=0,s=[];++e<i;){var r=t[e];r&&(s[n++]=r)}return s},Ri.concat=function(){var t=arguments.length;if(!t)return[];for(var e=st(t-1),i=arguments[0],n=t;n--;)e[n-1]=arguments[n];return Pe(qa(i)?Ts(i):[i],mn(e,1))},Ri.cond=function(t){var e=null==t?0:t.length,i=ar();return t=e?Be(t,(function(t){if("function"!=typeof t[1])throw new Ct(n);return[i(t[0]),t[1]]})):[],$n((function(i){for(var n=-1;++n<e;){var s=t[n];if(Ee(s[0],this,i))return Ee(s[1],this,i)}}))},Ri.conforms=function(t){return function(t){var e=Bo(t);return function(i){return on(i,t,e)}}(an(t,1))},Ri.constant=eh,Ri.countBy=ma,Ri.create=function(t,e){var i=zi(t);return null==e?i:en(i,e)},Ri.curry=function t(e,n,s){var r=Xs(e,8,i,i,i,i,i,n=s?i:n);return r.placeholder=t.placeholder,r},Ri.curryRight=function t(e,n,s){var r=Xs(e,16,i,i,i,i,i,n=s?i:n);return r.placeholder=t.placeholder,r},Ri.debounce=La,Ri.defaults=Mo,Ri.defaultsDeep=Ao,Ri.defer=Ba,Ri.delay=Pa,Ri.difference=Wr,Ri.differenceBy=Fr,Ri.differenceWith=Ur,Ri.drop=function(t,e,n){var s=null==t?0:t.length;return s?es(t,(e=n||e===i?1:mo(e))<0?0:e,s):[]},Ri.dropRight=function(t,e,n){var s=null==t?0:t.length;return s?es(t,0,(e=s-(e=n||e===i?1:mo(e)))<0?0:e):[]},Ri.dropRightWhile=function(t,e){return t&&t.length?cs(t,ar(e,3),!0,!0):[]},Ri.dropWhile=function(t,e){return t&&t.length?cs(t,ar(e,3),!0):[]},Ri.fill=function(t,e,n,s){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&yr(t,e,n)&&(n=0,s=r),function(t,e,n,s){var r=t.length;for((n=mo(n))<0&&(n=-n>r?0:r+n),(s=s===i||s>r?r:mo(s))<0&&(s+=r),s=n>s?0:go(s);n<s;)t[n++]=e;return t}(t,e,n,s)):[]},Ri.filter=function(t,e){return(qa(t)?Ie:fn)(t,ar(e,3))},Ri.flatMap=function(t,e){return mn(Sa(t,e),1)},Ri.flatMapDeep=function(t,e){return mn(Sa(t,e),l)},Ri.flatMapDepth=function(t,e,n){return n=n===i?1:mo(n),mn(Sa(t,e),n)},Ri.flatten=jr,Ri.flattenDeep=function(t){return(null==t?0:t.length)?mn(t,l):[]},Ri.flattenDepth=function(t,e){return(null==t?0:t.length)?mn(t,e=e===i?1:mo(e)):[]},Ri.flip=function(t){return Xs(t,512)},Ri.flow=ih,Ri.flowRight=nh,Ri.fromPairs=function(t){for(var e=-1,i=null==t?0:t.length,n={};++e<i;){var s=t[e];n[s[0]]=s[1]}return n},Ri.functions=function(t){return null==t?[]:bn(t,Bo(t))},Ri.functionsIn=function(t){return null==t?[]:bn(t,Po(t))},Ri.groupBy=ba,Ri.initial=function(t){return(null==t?0:t.length)?es(t,0,-1):[]},Ri.intersection=Gr,Ri.intersectionBy=$r,Ri.intersectionWith=Xr,Ri.invert=Io,Ri.invertBy=Do,Ri.invokeMap=wa,Ri.iteratee=rh,Ri.keyBy=_a,Ri.keys=Bo,Ri.keysIn=Po,Ri.map=Sa,Ri.mapKeys=function(t,e){var i={};return e=ar(e,3),vn(t,(function(t,n,s){nn(i,e(t,n,s),t)})),i},Ri.mapValues=function(t,e){var i={};return e=ar(e,3),vn(t,(function(t,n,s){nn(i,n,e(t,n,s))})),i},Ri.matches=function(t){return zn(an(t,1))},Ri.matchesProperty=function(t,e){return Hn(t,an(e,1))},Ri.memoize=ka,Ri.merge=ko,Ri.mergeWith=No,Ri.method=ah,Ri.methodOf=oh,Ri.mixin=hh,Ri.negate=Na,Ri.nthArg=function(t){return t=mo(t),$n((function(e){return Fn(e,t)}))},Ri.omit=Oo,Ri.omitBy=function(t,e){return zo(t,Na(ar(e)))},Ri.once=function(t){return Ca(2,t)},Ri.orderBy=function(t,e,n,s){return null==t?[]:(qa(e)||(e=null==e?[]:[e]),qa(n=s?i:n)||(n=null==n?[]:[n]),Un(t,e,n))},Ri.over=uh,Ri.overArgs=Oa,Ri.overEvery=ch,Ri.overSome=dh,Ri.partial=Ra,Ri.partialRight=za,Ri.partition=Ea,Ri.pick=Ro,Ri.pickBy=zo,Ri.property=ph,Ri.propertyOf=function(t){return function(e){return null==t?i:wn(t,e)}},Ri.pull=Jr,Ri.pullAll=Qr,Ri.pullAllBy=function(t,e,i){return t&&t.length&&e&&e.length?qn(t,e,ar(i,2)):t},Ri.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?qn(t,e,i,n):t},Ri.pullAt=Kr,Ri.range=fh,Ri.rangeRight=mh,Ri.rearg=Ha,Ri.reject=function(t,e){return(qa(t)?Ie:fn)(t,Na(ar(e,3)))},Ri.remove=function(t,e){var i=[];if(!t||!t.length)return i;var n=-1,s=[],r=t.length;for(e=ar(e,3);++n<r;){var a=t[n];e(a,n,t)&&(i.push(a),s.push(n))}return jn(t,s),i},Ri.rest=function(t,e){if("function"!=typeof t)throw new Ct(n);return $n(t,e=e===i?e:mo(e))},Ri.reverse=ta,Ri.sampleSize=function(t,e,n){return e=(n?yr(t,e,n):e===i)?1:mo(e),(qa(t)?Xi:Zn)(t,e)},Ri.set=function(t,e,i){return null==t?t:Jn(t,e,i)},Ri.setWith=function(t,e,n,s){return s="function"==typeof s?s:i,null==t?t:Jn(t,e,n,s)},Ri.shuffle=function(t){return(qa(t)?Zi:ts)(t)},Ri.slice=function(t,e,n){var s=null==t?0:t.length;return s?(n&&"number"!=typeof n&&yr(t,e,n)?(e=0,n=s):(e=null==e?0:mo(e),n=n===i?s:mo(n)),es(t,e,n)):[]},Ri.sortBy=Ma,Ri.sortedUniq=function(t){return t&&t.length?rs(t):[]},Ri.sortedUniqBy=function(t,e){return t&&t.length?rs(t,ar(e,2)):[]},Ri.split=function(t,e,n){return n&&"number"!=typeof n&&yr(t,e,n)&&(e=n=i),(n=n===i?d:n>>>0)?(t=xo(t))&&("string"==typeof e||null!=e&&!ro(e))&&!(e=os(e))&&si(t)?xs(ui(t),0,n):t.split(e,n):[]},Ri.spread=function(t,e){if("function"!=typeof t)throw new Ct(n);return e=null==e?0:mi(mo(e),0),$n((function(i){var n=i[e],s=xs(i,0,e);return n&&Pe(s,n),Ee(t,this,s)}))},Ri.tail=function(t){var e=null==t?0:t.length;return e?es(t,1,e):[]},Ri.take=function(t,e,n){return t&&t.length?es(t,0,(e=n||e===i?1:mo(e))<0?0:e):[]},Ri.takeRight=function(t,e,n){var s=null==t?0:t.length;return s?es(t,(e=s-(e=n||e===i?1:mo(e)))<0?0:e,s):[]},Ri.takeRightWhile=function(t,e){return t&&t.length?cs(t,ar(e,3),!1,!0):[]},Ri.takeWhile=function(t,e){return t&&t.length?cs(t,ar(e,3)):[]},Ri.tap=function(t,e){return e(t),t},Ri.throttle=function(t,e,i){var s=!0,r=!0;if("function"!=typeof t)throw new Ct(n);return to(i)&&(s="leading"in i?!!i.leading:s,r="trailing"in i?!!i.trailing:r),La(t,e,{leading:s,maxWait:e,trailing:r})},Ri.thru=pa,Ri.toArray=po,Ri.toPairs=Ho,Ri.toPairsIn=Wo,Ri.toPath=function(t){return qa(t)?Be(t,Rr):ho(t)?[t]:Ts(Or(xo(t)))},Ri.toPlainObject=vo,Ri.transform=function(t,e,i){var n=qa(t),s=n||$a(t)||lo(t);if(e=ar(e,4),null==i){var r=t&&t.constructor;i=s?n?new r:[]:to(t)&&Ja(r)?zi(jt(t)):{}}return(s?Ae:vn)(t,(function(t,n,s){return e(i,t,n,s)})),i},Ri.unary=function(t){return Ta(t,1)},Ri.union=ea,Ri.unionBy=ia,Ri.unionWith=na,Ri.uniq=function(t){return t&&t.length?hs(t):[]},Ri.uniqBy=function(t,e){return t&&t.length?hs(t,ar(e,2)):[]},Ri.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?hs(t,i,e):[]},Ri.unset=function(t,e){return null==t||ls(t,e)},Ri.unzip=sa,Ri.unzipWith=ra,Ri.update=function(t,e,i){return null==t?t:us(t,e,gs(i))},Ri.updateWith=function(t,e,n,s){return s="function"==typeof s?s:i,null==t?t:us(t,e,gs(n),s)},Ri.values=Fo,Ri.valuesIn=function(t){return null==t?[]:Je(t,Po(t))},Ri.without=aa,Ri.words=Qo,Ri.wrap=function(t,e){return Ra(gs(e),t)},Ri.xor=oa,Ri.xorBy=ha,Ri.xorWith=la,Ri.zip=ua,Ri.zipObject=function(t,e){return fs(t||[],e||[],Qi)},Ri.zipObjectDeep=function(t,e){return fs(t||[],e||[],Jn)},Ri.zipWith=ca,Ri.entries=Ho,Ri.entriesIn=Wo,Ri.extend=wo,Ri.extendWith=_o,hh(Ri,Ri),Ri.add=vh,Ri.attempt=Ko,Ri.camelCase=Uo,Ri.capitalize=Vo,Ri.ceil=xh,Ri.clamp=function(t,e,n){return n===i&&(n=e,e=i),n!==i&&(n=(n=yo(n))==n?n:0),e!==i&&(e=(e=yo(e))==e?e:0),rn(yo(t),e,n)},Ri.clone=function(t){return an(t,4)},Ri.cloneDeep=function(t){return an(t,5)},Ri.cloneDeepWith=function(t,e){return an(t,5,e="function"==typeof e?e:i)},Ri.cloneWith=function(t,e){return an(t,4,e="function"==typeof e?e:i)},Ri.conformsTo=function(t,e){return null==e||on(t,e,Bo(e))},Ri.deburr=qo,Ri.defaultTo=function(t,e){return null==t||t!=t?e:t},Ri.divide=bh,Ri.endsWith=function(t,e,n){t=xo(t),e=os(e);var s=t.length,r=n=n===i?s:rn(mo(n),0,s);return(n-=e.length)>=0&&t.slice(n,r)==e},Ri.eq=Wa,Ri.escape=function(t){return(t=xo(t))&&$.test(t)?t.replace(Y,ii):t},Ri.escapeRegExp=function(t){return(t=xo(t))&&it.test(t)?t.replace(et,"\\$&"):t},Ri.every=function(t,e,n){var s=qa(t)?Ce:dn;return n&&yr(t,e,n)&&(e=i),s(t,ar(e,3))},Ri.find=ga,Ri.findIndex=Vr,Ri.findKey=function(t,e){return ze(t,ar(e,3),vn)},Ri.findLast=ya,Ri.findLastIndex=qr,Ri.findLastKey=function(t,e){return ze(t,ar(e,3),xn)},Ri.floor=wh,Ri.forEach=va,Ri.forEachRight=xa,Ri.forIn=function(t,e){return null==t?t:gn(t,ar(e,3),Po)},Ri.forInRight=function(t,e){return null==t?t:yn(t,ar(e,3),Po)},Ri.forOwn=function(t,e){return t&&vn(t,ar(e,3))},Ri.forOwnRight=function(t,e){return t&&xn(t,ar(e,3))},Ri.get=To,Ri.gt=Fa,Ri.gte=Ua,Ri.has=function(t,e){return null!=t&&pr(t,e,Mn)},Ri.hasIn=Co,Ri.head=Yr,Ri.identity=sh,Ri.includes=function(t,e,i,n){t=Ya(t)?t:Fo(t),i=i&&!n?mo(i):0;var s=t.length;return i<0&&(i=mi(s+i,0)),oo(t)?i<=s&&t.indexOf(e,i)>-1:!!s&&We(t,e,i)>-1},Ri.indexOf=function(t,e,i){var n=null==t?0:t.length;if(!n)return-1;var s=null==i?0:mo(i);return s<0&&(s=mi(n+s,0)),We(t,e,s)},Ri.inRange=function(t,e,n){return e=fo(e),n===i?(n=e,e=0):n=fo(n),function(t,e,i){return t>=gi(e,i)&&t<mi(e,i)}(t=yo(t),e,n)},Ri.invoke=Lo,Ri.isArguments=Va,Ri.isArray=qa,Ri.isArrayBuffer=ja,Ri.isArrayLike=Ya,Ri.isArrayLikeObject=Ga,Ri.isBoolean=function(t){return!0===t||!1===t||eo(t)&&Sn(t)==g},Ri.isBuffer=$a,Ri.isDate=Xa,Ri.isElement=function(t){return eo(t)&&1===t.nodeType&&!so(t)},Ri.isEmpty=function(t){if(null==t)return!0;if(Ya(t)&&(qa(t)||"string"==typeof t||"function"==typeof t.splice||$a(t)||lo(t)||Va(t)))return!t.length;var e=dr(t);if(e==_||e==T)return!t.size;if(wr(t))return!kn(t).length;for(var i in t)if(kt.call(t,i))return!1;return!0},Ri.isEqual=function(t,e){return Dn(t,e)},Ri.isEqualWith=function(t,e,n){var s=(n="function"==typeof n?n:i)?n(t,e):i;return s===i?Dn(t,e,i,n):!!s},Ri.isError=Za,Ri.isFinite=function(t){return"number"==typeof t&&Re(t)},Ri.isFunction=Ja,Ri.isInteger=Qa,Ri.isLength=Ka,Ri.isMap=io,Ri.isMatch=function(t,e){return t===e||Ln(t,e,hr(e))},Ri.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,Ln(t,e,hr(e),n)},Ri.isNaN=function(t){return no(t)&&t!=+t},Ri.isNative=function(t){if(br(t))throw new _t("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Bn(t)},Ri.isNil=function(t){return null==t},Ri.isNull=function(t){return null===t},Ri.isNumber=no,Ri.isObject=to,Ri.isObjectLike=eo,Ri.isPlainObject=so,Ri.isRegExp=ro,Ri.isSafeInteger=function(t){return Qa(t)&&t>=-9007199254740991&&t<=u},Ri.isSet=ao,Ri.isString=oo,Ri.isSymbol=ho,Ri.isTypedArray=lo,Ri.isUndefined=function(t){return t===i},Ri.isWeakMap=function(t){return eo(t)&&dr(t)==D},Ri.isWeakSet=function(t){return eo(t)&&"[object WeakSet]"==Sn(t)},Ri.join=function(t,e){return null==t?"":je.call(t,e)},Ri.kebabCase=jo,Ri.last=Zr,Ri.lastIndexOf=function(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var r=s;return n!==i&&(r=(r=mo(n))<0?mi(s+r,0):gi(r,s-1)),e==e?function(t,e,i){for(var n=i+1;n--;)if(t[n]===e)return n;return n}(t,e,r):He(t,Ue,r,!0)},Ri.lowerCase=Yo,Ri.lowerFirst=Go,Ri.lt=uo,Ri.lte=co,Ri.max=function(t){return t&&t.length?pn(t,sh,En):i},Ri.maxBy=function(t,e){return t&&t.length?pn(t,ar(e,2),En):i},Ri.mean=function(t){return Ve(t,sh)},Ri.meanBy=function(t,e){return Ve(t,ar(e,2))},Ri.min=function(t){return t&&t.length?pn(t,sh,On):i},Ri.minBy=function(t,e){return t&&t.length?pn(t,ar(e,2),On):i},Ri.stubArray=gh,Ri.stubFalse=yh,Ri.stubObject=function(){return{}},Ri.stubString=function(){return""},Ri.stubTrue=function(){return!0},Ri.multiply=Sh,Ri.nth=function(t,e){return t&&t.length?Fn(t,mo(e)):i},Ri.noConflict=function(){return de._===this&&(de._=Ht),this},Ri.noop=lh,Ri.now=Aa,Ri.pad=function(t,e,i){t=xo(t);var n=(e=mo(e))?li(t):0;if(!e||n>=e)return t;var s=(e-n)/2;return Us(fe(s),i)+t+Us(pe(s),i)},Ri.padEnd=function(t,e,i){t=xo(t);var n=(e=mo(e))?li(t):0;return e&&n<e?t+Us(e-n,i):t},Ri.padStart=function(t,e,i){t=xo(t);var n=(e=mo(e))?li(t):0;return e&&n<e?Us(e-n,i)+t:t},Ri.parseInt=function(t,e,i){return i||null==e?e=0:e&&(e=+e),vi(xo(t).replace(nt,""),e||0)},Ri.random=function(t,e,n){if(n&&"boolean"!=typeof n&&yr(t,e,n)&&(e=n=i),n===i&&("boolean"==typeof e?(n=e,e=i):"boolean"==typeof t&&(n=t,t=i)),t===i&&e===i?(t=0,e=1):(t=fo(t),e===i?(e=t,t=0):e=fo(e)),t>e){var s=t;t=e,e=s}if(n||t%1||e%1){var r=xi();return gi(t+r*(e-t+he("1e-"+((r+"").length-1))),e)}return Yn(t,e)},Ri.reduce=function(t,e,i){var n=qa(t)?ke:Ye,s=arguments.length<3;return n(t,ar(e,4),i,s,un)},Ri.reduceRight=function(t,e,i){var n=qa(t)?Ne:Ye,s=arguments.length<3;return n(t,ar(e,4),i,s,cn)},Ri.repeat=function(t,e,n){return e=(n?yr(t,e,n):e===i)?1:mo(e),Gn(xo(t),e)},Ri.replace=function(){var t=arguments,e=xo(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Ri.result=function(t,e,n){var s=-1,r=(e=ys(e,t)).length;for(r||(r=1,t=i);++s<r;){var a=null==t?i:t[Rr(e[s])];a===i&&(s=r,a=n),t=Ja(a)?a.call(t):a}return t},Ri.round=Eh,Ri.runInContext=t,Ri.sample=function(t){return(qa(t)?$i:Xn)(t)},Ri.size=function(t){if(null==t)return 0;if(Ya(t))return oo(t)?li(t):t.length;var e=dr(t);return e==_||e==T?t.size:kn(t).length},Ri.snakeCase=$o,Ri.some=function(t,e,n){var s=qa(t)?Oe:is;return n&&yr(t,e,n)&&(e=i),s(t,ar(e,3))},Ri.sortedIndex=function(t,e){return ns(t,e)},Ri.sortedIndexBy=function(t,e,i){return ss(t,e,ar(i,2))},Ri.sortedIndexOf=function(t,e){var i=null==t?0:t.length;if(i){var n=ns(t,e);if(n<i&&Wa(t[n],e))return n}return-1},Ri.sortedLastIndex=function(t,e){return ns(t,e,!0)},Ri.sortedLastIndexBy=function(t,e,i){return ss(t,e,ar(i,2),!0)},Ri.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var i=ns(t,e,!0)-1;if(Wa(t[i],e))return i}return-1},Ri.startCase=Xo,Ri.startsWith=function(t,e,i){return t=xo(t),i=null==i?0:rn(mo(i),0,t.length),e=os(e),t.slice(i,i+e.length)==e},Ri.subtract=Mh,Ri.sum=function(t){return t&&t.length?Ge(t,sh):0},Ri.sumBy=function(t,e){return t&&t.length?Ge(t,ar(e,2)):0},Ri.template=function(t,e,n){var s=Ri.templateSettings;n&&yr(t,e,n)&&(e=i),t=xo(t),e=_o({},e,s,Zs);var r,a,o=_o({},e.imports,s.imports,Zs),h=Bo(o),l=Je(o,h),u=0,c=e.interpolate||xt,d="__p += '",p=At((e.escape||xt).source+"|"+c.source+"|"+(c===J?ct:xt).source+"|"+(e.evaluate||xt).source+"|$","g"),f="//# sourceURL="+(kt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++se+"]")+"\n";t.replace(p,(function(e,i,n,s,o,h){return n||(n=s),d+=t.slice(u,h).replace(bt,ni),i&&(r=!0,d+="' +\n__e("+i+") +\n'"),o&&(a=!0,d+="';\n"+o+";\n__p += '"),n&&(d+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),u=h+e.length,e})),d+="';\n";var m=kt.call(e,"variable")&&e.variable;if(m){if(lt.test(m))throw new _t("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(a?d.replace(U,""):d).replace(V,"$1").replace(q,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(r?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Ko((function(){return St(h,f+"return "+d).apply(i,l)}));if(g.source=d,Za(g))throw g;return g},Ri.times=function(t,e){if((t=mo(t))<1||t>u)return[];var i=d,n=gi(t,d);e=ar(e),t-=d;for(var s=$e(n,e);++i<t;)e(i);return s},Ri.toFinite=fo,Ri.toInteger=mo,Ri.toLength=go,Ri.toLower=function(t){return xo(t).toLowerCase()},Ri.toNumber=yo,Ri.toSafeInteger=function(t){return t?rn(mo(t),-9007199254740991,u):0===t?t:0},Ri.toString=xo,Ri.toUpper=function(t){return xo(t).toUpperCase()},Ri.trim=function(t,e,n){if((t=xo(t))&&(n||e===i))return Xe(t);if(!t||!(e=os(e)))return t;var s=ui(t),r=ui(e);return xs(s,Ke(s,r),ti(s,r)+1).join("")},Ri.trimEnd=function(t,e,n){if((t=xo(t))&&(n||e===i))return t.slice(0,ci(t)+1);if(!t||!(e=os(e)))return t;var s=ui(t);return xs(s,0,ti(s,ui(e))+1).join("")},Ri.trimStart=function(t,e,n){if((t=xo(t))&&(n||e===i))return t.replace(nt,"");if(!t||!(e=os(e)))return t;var s=ui(t);return xs(s,Ke(s,ui(e))).join("")},Ri.truncate=function(t,e){var n=30,s="...";if(to(e)){var r="separator"in e?e.separator:r;n="length"in e?mo(e.length):n,s="omission"in e?os(e.omission):s}var a=(t=xo(t)).length;if(si(t)){var o=ui(t);a=o.length}if(n>=a)return t;var h=n-li(s);if(h<1)return s;var l=o?xs(o,0,h).join(""):t.slice(0,h);if(r===i)return l+s;if(o&&(h+=l.length-h),ro(r)){if(t.slice(h).search(r)){var u,c=l;for(r.global||(r=At(r.source,xo(dt.exec(r))+"g")),r.lastIndex=0;u=r.exec(c);)var d=u.index;l=l.slice(0,d===i?h:d)}}else if(t.indexOf(os(r),h)!=h){var p=l.lastIndexOf(r);p>-1&&(l=l.slice(0,p))}return l+s},Ri.unescape=function(t){return(t=xo(t))&&G.test(t)?t.replace(j,di):t},Ri.uniqueId=function(t){var e=++Nt;return xo(t)+e},Ri.upperCase=Zo,Ri.upperFirst=Jo,Ri.each=va,Ri.eachRight=xa,Ri.first=Yr,hh(Ri,(_h={},vn(Ri,(function(t,e){kt.call(Ri.prototype,e)||(_h[e]=t)})),_h),{chain:!1}),Ri.VERSION="4.17.21",Ae(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Ri[t].placeholder=Ri})),Ae(["drop","take"],(function(t,e){Fi.prototype[t]=function(n){n=n===i?1:mi(mo(n),0);var s=this.__filtered__&&!e?new Fi(this):this.clone();return s.__filtered__?s.__takeCount__=gi(n,s.__takeCount__):s.__views__.push({size:gi(n,d),type:t+(s.__dir__<0?"Right":"")}),s},Fi.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Ae(["filter","map","takeWhile"],(function(t,e){var i=e+1,n=1==i||3==i;Fi.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:ar(t,3),type:i}),e.__filtered__=e.__filtered__||n,e}})),Ae(["head","last"],(function(t,e){var i="take"+(e?"Right":"");Fi.prototype[t]=function(){return this[i](1).value()[0]}})),Ae(["initial","tail"],(function(t,e){var i="drop"+(e?"":"Right");Fi.prototype[t]=function(){return this.__filtered__?new Fi(this):this[i](1)}})),Fi.prototype.compact=function(){return this.filter(sh)},Fi.prototype.find=function(t){return this.filter(t).head()},Fi.prototype.findLast=function(t){return this.reverse().find(t)},Fi.prototype.invokeMap=$n((function(t,e){return"function"==typeof t?new Fi(this):this.map((function(i){return Cn(i,t,e)}))})),Fi.prototype.reject=function(t){return this.filter(Na(ar(t)))},Fi.prototype.slice=function(t,e){t=mo(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Fi(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==i&&(n=(e=mo(e))<0?n.dropRight(-e):n.take(e-t)),n)},Fi.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Fi.prototype.toArray=function(){return this.take(d)},vn(Fi.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),s=/^(?:head|last)$/.test(e),r=Ri[s?"take"+("last"==e?"Right":""):e],a=s||/^find/.test(e);r&&(Ri.prototype[e]=function(){var e=this.__wrapped__,o=s?[1]:arguments,h=e instanceof Fi,l=o[0],u=h||qa(e),c=function(t){var e=r.apply(Ri,Pe([t],o));return s&&d?e[0]:e};u&&n&&"function"==typeof l&&1!=l.length&&(h=u=!1);var d=this.__chain__,p=!!this.__actions__.length,f=a&&!d,m=h&&!p;if(!a&&u){e=m?e:new Fi(this);var g=t.apply(e,o);return g.__actions__.push({func:pa,args:[c],thisArg:i}),new Wi(g,d)}return f&&m?t.apply(this,o):(g=this.thru(c),f?s?g.value()[0]:g.value():g)})})),Ae(["pop","push","shift","sort","splice","unshift"],(function(t){var e=It[t],i=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);Ri.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var s=this.value();return e.apply(qa(s)?s:[],t)}return this[i]((function(i){return e.apply(qa(i)?i:[],t)}))}})),vn(Fi.prototype,(function(t,e){var i=Ri[e];if(i){var n=i.name+"";kt.call(Ci,n)||(Ci[n]=[]),Ci[n].push({name:e,func:i})}})),Ci[zs(i,2).name]=[{name:"wrapper",func:i}],Fi.prototype.clone=function(){var t=new Fi(this.__wrapped__);return t.__actions__=Ts(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ts(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ts(this.__views__),t},Fi.prototype.reverse=function(){if(this.__filtered__){var t=new Fi(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Fi.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,i=qa(t),n=e<0,s=i?t.length:0,r=function(t,e,i){var n=-1,s=i.length;for(;++n<s;){var r=i[n],a=r.size;switch(r.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=gi(e,t+a);break;case"takeRight":t=mi(t,e-a)}}return{start:t,end:e}}(0,s,this.__views__),a=r.start,o=r.end,h=o-a,l=n?o:a-1,u=this.__iteratees__,c=u.length,d=0,p=gi(h,this.__takeCount__);if(!i||!n&&s==h&&p==h)return ds(t,this.__actions__);var f=[];t:for(;h--&&d<p;){for(var m=-1,g=t[l+=e];++m<c;){var y=u[m],v=y.iteratee,x=y.type,b=v(g);if(2==x)g=b;else if(!b){if(1==x)continue t;break t}}f[d++]=g}return f},Ri.prototype.at=fa,Ri.prototype.chain=function(){return da(this)},Ri.prototype.commit=function(){return new Wi(this.value(),this.__chain__)},Ri.prototype.next=function(){this.__values__===i&&(this.__values__=po(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},Ri.prototype.plant=function(t){for(var e,n=this;n instanceof Hi;){var s=Hr(n);s.__index__=0,s.__values__=i,e?r.__wrapped__=s:e=s;var r=s;n=n.__wrapped__}return r.__wrapped__=t,e},Ri.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Fi){var e=t;return this.__actions__.length&&(e=new Fi(this)),(e=e.reverse()).__actions__.push({func:pa,args:[ta],thisArg:i}),new Wi(e,this.__chain__)}return this.thru(ta)},Ri.prototype.toJSON=Ri.prototype.valueOf=Ri.prototype.value=function(){return ds(this.__wrapped__,this.__actions__)},Ri.prototype.first=Ri.prototype.head,Zt&&(Ri.prototype[Zt]=function(){return this}),Ri}();fe?((fe.exports=pi)._=pi,pe._=pi):de._=pi}).call(w)}(ni,ni.exports);var si=ni.exports;const ri=_(si);let ai=class t{constructor(t=new We(1/0,1/0),e=new We(-1/0,-1/0)){c(this,"isBox2",!0),c(this,"min"),c(this,"max"),this.min=t,this.max=e}applyMatrix3(t){return this.isEmpty()||(oi[0].set(this.min.x,this.min.y).applyMatrix3(t),oi[1].set(this.min.x,this.max.y).applyMatrix3(t),oi[3].set(this.max.x,this.max.y).applyMatrix3(t),oi[2].set(this.max.x,this.min.y).applyMatrix3(t),this.setFromPoints(oi)),this}clone(){return(new t).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}ceil(){return this.min.ceilToZero(),this.max.ceilToZero(),this}distanceToPoint(t){return hi.copy(t).clamp(this.min,this.max).sub(t).length()}expandByXY(t,e){return this.min.minXY(t,e),this.max.maxXY(t,e),this}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByPoints(t){if(!t||!t.length)return this;for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){var e;this.union(t.boundingBoxWorld);for(let i=0,n=(null==(e=t.children)?void 0:e.length)||0;i<n;i++)this.expandByObject(t.children[i]);return this}expandByObjects(t){for(let e=0,i=t.length;e<i;e++)this.expandByObject(t[e]);return this}expandByBox(t){t.isEmpty()||(this.expandByPoint(t.min),this.expandByPoint(t.max))}expandByCubic(t,e,i,n,s,r,a,o){this.makeEmpty();let h=je(t,i,s,a,ui);for(let e=0;e<h;e++){const n=qe(t,i,s,a,ui[e]);this.min.x=Math.min(n,this.min.x),this.max.x=Math.max(n,this.max.x)}h=je(e,n,r,o,ci);for(let t=0;t<h;t++){const i=qe(e,n,r,o,ci[t]);this.min.y=Math.min(i,this.min.y),this.max.y=Math.max(i,this.max.y)}return this.expandByXY(t,e),this.expandByXY(a,o),this}expandByQuadratic(t,e,i,n,s,r){const a=Math.max(0,Math.min(1,$e(t,i,s))),o=Math.max(0,Math.min(1,$e(e,n,r))),h=Xe(t,i,s,a),l=Xe(e,n,r,o);return this.expandByXY(t,e),this.expandByXY(s,r),this.expandByXY(h,l),this}expandByArc(t,e,i,n,s,r,a){let o=s%(2*Math.PI);o<0&&(o+=2*Math.PI);let h=r%(2*Math.PI);if(h<0&&(h+=2*Math.PI),o===h)return this.expandByXY(t-i,e-n),this.expandByXY(t+i,e+n),this;if(a){const t=o;o=h,h=t}return h<o&&(h+=2*Math.PI),this.expandByXY(t+i*Math.cos(o),e+n*Math.sin(o)),this.expandByXY(t+i*Math.cos(h),e+n*Math.sin(h)),o>.5*Math.PI&&h<2*Math.PI+.5*Math.PI&&this.expandByXY(t,e+n),o>Math.PI&&h<2*Math.PI+Math.PI&&this.expandByXY(t-i,e),o>1.5*Math.PI&&h<2*Math.PI+1.5*Math.PI&&this.expandByXY(t,e-n),o>0&&h<2*Math.PI&&this.expandByXY(t+i,e),this}expandByEllipse(t,e,i,n,s,r,a,o){di[0]=r,di[1]=a,ei(di,o),r=di[0],a=di[1];const h=t+i*Math.cos(r),l=e+n*Math.sin(r),u=t+i*Math.cos(a),c=e+n*Math.sin(a);this.expandByXY(h,l),this.expandByXY(u,c);const d=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const h of d)if(ii(h,r,a,o)){const r=t+i*Math.cos(h),a=e+n*Math.sin(h),o=t+(r-t)*Math.cos(s)-(a-e)*Math.sin(s),l=e+(r-t)*Math.sin(s)+(a-e)*Math.cos(s);this.expandByXY(o,l)}return this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}floor(){return this.min.floorToZero(),this.max.floorToZero(),this}getCenter(t=new We){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t=new We){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}getPoints(t=[]){return t.length=0,t[0]={x:this.min.x,y:this.min.y},t[1]={x:this.min.x,y:this.max.y},t[2]={x:this.max.x,y:this.max.y},t[3]={x:this.max.x,y:this.min.y},t}getNumbersArray(t=[]){return[this.min.x,this.min.y,this.min.x,this.max.y,this.max.x,this.max.y,this.max.x,this.min.y]}getArea(){return this.getSize(hi),hi.x*hi.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}intersectsBox(t){return!!t&&!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}intersectsObject(t){return!(!t||!t.geometry)&&this.intersectsBox(t.geometry.boundingBox)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}round(){return this.min.roundToZero(),this.max.roundToZero(),this}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(hi.fromArray(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=hi.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromProjectionMatrix(t){return this.min.set(t.elements[6],t.elements[7]),this.max.set(t.elements[6],t.elements[7]),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}setFromMinMaxString(t,e=" "){if(this.makeEmpty(),!(null==t?void 0:t.length))return this;let i=t.split(e),n=ri.map(i,(t=>parseFloat(t)));for(let t=0,e=n.length;t<e;t+=2)this.expandByPoint(hi.fromArray(n,t));return this}setFromXYXY(t,e,i,n){return this.makeEmpty(),this.expandByXY(t,e),this.expandByXY(i,n),this}translate(t){return this.min.add(t),this.max.add(t),this}toString(){return`{"min":${this.min.toString()},"max":${this.max.toString()}}`}fromString(t){return t?(this.copy(JSON.parse(t)),this):this}union(t){return t.validate()?(this.min.min(t.min),this.max.max(t.max),this):this}validate(){return this.min.validate()&&this.max.validate()}unproject(t){return this.applyMatrix3(t.projectionMatrixInverse).applyMatrix3(t.matrixWorld)}centralArrange(t=1,e=20,i=10,n){const s=e+i;n?hi.copy(n):this.getCenter(hi),this.getSize(li),li.subScalar(e);const r=Math.floor(li.x/s),a=r*s,o=Math.ceil(t/r)*s;if(li.x<s||li.y<s||a>=li.x||o>=li.y)return hi.clone();let h=[],l=0,u=0;for(let e=0;e<t;e++){const e=r>t?t*s:a,i=hi.x-e/2+u*s+s/2,n=hi.y-o/2+l*s+s/2;h.push(new We(i,n)),u++,u>=r&&(u=0,l++)}return h}flipY(){return hi.copy(this.min).multiplyScalar(1,-1),li.copy(this.max).multiplyScalar(1,-1),this.min.set(hi.x,li.y),this.max.set(li.x,hi.y),this}};const oi=[new We,new We,new We,new We],hi=new We,li=new We,ui=[],ci=[],di=[],pi=Ae.window.requestAnimationFrame,fi=Ae.window.performance?()=>Ae.window.performance.now():()=>(new Date).getTime(),mi=pi,gi=class t{constructor(){c(this,"id",t.idCounter++),c(this,"timers",new Map),c(this,"timersDuration",new Map),c(this,"counters",new Map),c(this,"countersAmount",new Map),c(this,"out",[])}static active(e){t.actived=!!e,t.duration=e||0}static add(t){this.children.push(t),this.handleStart()}static remove(e){for(let i=0,n=t.children.length;i<n;i++)if(t.children[i].id===e.id){this.children.splice(i,1);break}}static handleStart(){this.isRunning||(this.isRunning=!0,mi(this.runLoop))}static runLoop(){t.children.length?(t.runFrames(),mi(t.runLoop)):t.isRunning=!1}static runFrames(){let e,i=fi();if(!(i-t.lastTime<t.duration)){t.lastTime=i;for(let i=0,n=this.children.length;i<n;i++)e=this.children[i],e.calculateTimers(),e.calculateCounters(),t.messages=t.messages.concat(e.out),e.out.length=0;if(t.messages.length){if(t.actived){let t=[];t.push(bi),t.push(wi),t.push(_i),this.messages.forEach((e=>t.push(function(t,e=20){let i="│";i+=" ".repeat(Math.max(e-t.name.length,0)),i+=t.name,i+="│";const n="string"==typeof t.avg?xi-t.avg.length:xi-t.avg.toString().length;return i+=" ".repeat(Math.max(n,0)),i+=t.avg+" ",i+=" ".repeat(Math.max(xi-t.min.toString().length,0)),i+=t.min+" ",i+=" ".repeat(Math.max(xi-t.max.toString().length,0)),i+=t.max+" ",i+=" ".repeat(Math.max(xi-t.stdDev.toString().length,0)),i+=t.stdDev+" ",i+=" ".repeat(Math.max(xi-t.count.toString().length,0)),i+=t.count+" ",i+=" ".repeat(Math.max(xi-t.FPS.toString().length,0)),i+=t.FPS,i}(e,this.maxLetters)))),t.push(Si)}t.messages.length=0}}}destroy(){t.remove(this)}addTimer(t,e=fi(),i=fi()-(this.timersDuration.get(t)||fi())){this.addTimerDuration(t,i),this.timersDuration.set(t,e)}addTimerDuration(t,e){var i;this.timers.has(t)||this.timers.set(t,[]),null==(i=this.timers.get(t))||i.push(e)}calculateTimers(){this.timers.forEach(((t,e)=>{t&&t.length&&(this.out.push(this.calculateDurations(e,t)),t.length=0)}))}addCounterAmount(t,e){var i;this.counters.has(t)||this.counters.set(t,[]),null==(i=this.counters.get(t))||i.push(e)}calculateCounters(){this.counters.forEach(((t,e)=>{t&&t.length&&(this.out.push(this.calculateAmounts(e,t)),t.length=0)}))}start(){return this.stop(),t.add(this),this}stop(){return t.remove(this),this}calculateDurations(e,i){const n={name:e,avg:0,min:0,max:0,stdDev:0,count:0,FPS:0};if(!i||!i.length)return n;const s=i.length,{min:r,max:a,avg:o}=this.minMaxAvg(i),h=parseFloat(this.stdDev(i,o).toFixed(2));return{name:e,avg:this.fd(o),min:this.fd(r),max:this.fd(a),stdDev:h,count:s,FPS:Math.ceil(s/t.duration*1e3)}}calculateAmounts(e,i){const n={name:e,avg:0,min:0,max:0,stdDev:0,count:0,FPS:0};if(!i||!i.length)return n;const s=i.length,{min:r,max:a,avg:o}=this.minMaxAvg(i);return{name:e,avg:o,min:r,max:a,stdDev:this.stdDev(i,o),count:s,FPS:Math.ceil(s/t.duration*1e3)}}minMaxAvg(t){let e=t[0],i=t[0],n=t.length,s=0;for(let n=0;n<t.length;n++){const r=t[n];s+=r,r<e&&(e=r),r>i&&(i=r)}const r=s/n;return{min:this.fx(e),max:this.fx(i),avg:this.fx(r)}}stdDev(t,e){let i=0;for(let n=0;n<t.length;n++){const s=t[n];i+=(s-e)*(s-e)}const n=t.length;return this.fx(Math.sqrt(i/n))}fd(t){return t>1e3?(t/1e3).toFixed(1)+"s":t.toFixed(1)+"ms"}fx(t,e=1){return 1===e?Math.round(10*t)/10:2===e?Math.round(100*t)/100:3===e?Math.round(1e3*t)/1e3:t}};c(gi,"idCounter",0),c(gi,"children",[]),c(gi,"isRunning",!1),c(gi,"actived",!1),c(gi,"duration",0),c(gi,"lastTime",fi()),c(gi,"messages",[]),c(gi,"maxLetters",20);let yi=gi;const vi=["avg","min","max","stdDev","count","FPS"],xi=function(t,e=0){let i=0;for(let e=0,n=t.length;e<n;e++)i=Math.max(i,t[e].length);return i+e}(vi,1),bi=function(t,e=20){let i="┌";i+="─".repeat(e),i+="┬";for(let e=0,n=t.length;e<n;e++)i+="─".repeat(xi),i+=e<n-1?"┬":"┐";return i}(vi,20),wi=function(t,e=20){let i="│";i+=" ".repeat(e),i+="│";for(let e=0,n=t.length;e<n;e++)i+=" ".repeat(Math.max(xi-t[e].length-1,0)),i+=t[e],i+=" │";return i}(vi,20),_i=function(t,e=20){let i="├";i+="─".repeat(e),i+="┼";for(let e=0,n=t.length;e<n;e++)i+="─".repeat(xi),i+=e<n-1?"┴":"┘";return i}(vi,20),Si=function(t=20){let e="└";for(let i=0;i<t;i++)e+="─";return e+="┘",e}(20);var Ei=(t=>(t.MM="mm",t.CM="cm",t.M="m",t.INCH="inch",t.INCHES="inches",t.FOOT="foot",t.FEET="feet",t))(Ei||{}),Mi=(t=>(t.INIT="init",t.LOAD="load",t.LOADED="loaded",t.RESIZE="resize",t.SET_SIZE="setSize",t.GET_LAYERS="getLayers",t.GET_ASSET_IDS_BY_TYPE="getAssetIdsByType",t.SET_FILL_BY_IDS="setFillByIds",t.CLEAR_FILL_BY_IDS="clearFillByIds",t.CLEAR_FILL="clearFill",t.SET_STROKE_BY_IDS="setStrokeByIds",t.CLEAR_STROKE="clearStroke",t.TERMINATE="terminate",t.CAMERA_SYNC="cameraSync",t.SLICE_DURATION_CHANGED="sliceDurationChanged",t.ASSET_TYPE_CHANGED="assetTypeChanged",t.FN_ENABLE_CHANGED="fnEnableChanged",t.SVG_LOADING_TYPE_CHANGED="svgLoadingTypeChanged",t.USED_CACHE_CHANGED="usedCacheChanged",t.DEBOUNCE_CACHE_CHANGED="debounceCacheChanged",t.WIREFRAME_CHANGED="wireframeChanged",t.BG_PASS_CHANGED="bgPass",t.SELECT_ENABLE_CHANGED="selectEnableChanged",t.MULTI_SELECT_ENABLE_CHANGED="multiSelectEnableChanged",t.MULTI_SELECT_BY_RANGE="multiSelectByRange",t.ZOOM_TO_SELECT_ENABLE_CHANGED="zoomToSelectEnableChanged",t.SOCIAL_DISTANCE_ENABLE_CHANGED="socialDistanceEnableChanged",t.ENABLE_HOVER_CHANGED="enableHover",t.FONT_ZOOM_IN="fontZoomIn",t.FONT_ZOOM_OUT="fontZoomOut",t.UNPROJECT="unproject",t.STROKE_MORE="strokeMore",t.STROKE_LESS="strokeLess",t.CAMERA_CHANGED="cameraChanged",t.SCENES_CHANGED="scenesChanged",t.UPDATE_LAYERS_VISIBILITY="updateLayersVisibility",t.DYNAMIC_LOADED="dynamicLoaded",t.SYNC_TEXTURE_HELPER_CACHED="syncTextureHelperCached",t.INIT_FONT="initFont",t.INIT_LOADING_FONT="initLoadingFont",t.REFRESH="refresh",t.FULLSCREEN="fullscreen",t.GET_CAMERA_POSITION="getCameraPosition",t.SET_CAMERA_POSITION="setCameraPosition",t.SAVE_CAMERA_POSITION="saveCameraPosition",t.RESTORE_CAMERA_POSITION="restoreCameraPosition",t.FOCUS_AT_IDS="focusAtIds",t.GET_LEGEND="getLegend",t.GET_ASSET_LABELS="getAssetLabels",t.SET_ASSET_LABELS="setAssetLabels",t.CLEAR_ASSET_LABELS="clearAssetLabels",t.CLEAR_DUMMIES="clearDummies",t.SET_DUMMIES="setDummies",t.FOCUS_AT_DUMMY="focusAtDummy",t.HIGHLIGHT_DUMMIES="highlightDummies",t.RESET_HIGHLIGHT_DUMMIES="resetHighlightDummies",t.SET_EDITOR_MODE="setEditorMode",t.BIND_EDITOR_DRAG="bindEditorDrag",t.SET_EDITOR_DRAGGING_OBJECT="setEditorDraggingObject",t.HANDLE_EXTERNAL_EVENT="handleExternalEvent",t.GET_DUMMIES="getDummies",t.ZOOM_IN="zoomIn",t.ZOOM_OUT="zoomOut",t.INITIALIZATION_START="INITIALIZATION_START",t.INITIALIZATION_COMPLETE="INITIALIZATION_COMPLETE",t.POINTER_OVER="pointerover",t.POINTER_OUT="pointerout",t.POINTER_LEAVE="pointerleave",t.SELECTED="selected",t.SELECT_BY_IDS="selectByIds",t.GET_ASSET_BOUNDING_BOX="getAssetBoundingBox",t.SET_ASSET_TYPE="setAssetType",t.LINK_ASSETS_BY_TREE="linkAssetsByTree",t.CLEAR_SELECTED="clearSelected",t.TARGET_BY_IDS="targetByIds",t.SHOW_ASSETS_LABEL="showAssetsLabel",t.HIDE_ASSETS_LABEL="hideAssetsLabel",t.TAP="tap",t.SINGLE_TAP="singletap",t.DOUBLE_TAP="doubletap",t.PRESS="press",t.PAN="pan",t.PAN_START="panstart",t.PAN_MOVE="panmove",t.PAN_END="panend",t.ROTATE="rotate",t.ROTATE_START="rotatestart",t.ROTATE_MOVE="rotatemove",t.ROTATE_END="rotateend",t.PINCH="pinch",t.PINCH_START="pinchstart",t.PINCH_MOVE="pinchmove",t.PINCH_END="pinchend",t.PINCH_IN="pinchin",t.PINCH_OUT="pinchout",t.SWIPE="swipe",t.SET_CURSOR="setCursor",t.DRAG_END="dragEnd",t))(Mi||{});function Ai(t,e="http://www.w3.org/2000/svg"){var i,n;return null==(n=null==(i=Ae.window)?void 0:i.document)?void 0:n.createElementNS(e,t)}function Ti(t=2e3){return d(this,null,(function*(){return new Promise((e=>setTimeout(e,(Math.random()+.5)*t)))}))}function Ci(t=8){let e=[];for(let i=0;i<t;i++)e.push(String.fromCharCode(97+Math.round(25*Math.random())));return e.join("")}function Ii(t,e=[]){var i,n;return t&&t.value?(e.push(t.value),(null==(i=t.children)?void 0:i.length)&&(null==(n=t.children)||n.forEach((t=>Ii(t,e)))),e):e}function Di(t,e=Ei.MM,i=Ei.M,n=!1){let s=t||0;if(e===i)return s;const r={[Ei.MM]:1,[Ei.CM]:10,[Ei.M]:1e3,[Ei.INCH]:25.4,[Ei.INCHES]:25.4,[Ei.FOOT]:304.8,[Ei.FEET]:304.8};if(n){s=s*(r[e]||1)*(r[e]||1)/((r[i]||1)*(r[i]||1))}else{s=s*(r[e]||1)/(r[i]||1)}return s}var Li=(t=>(t.GROS="gros",t.RM="rm",t.WS="ws",t.SU="su",t.EQ="eq",t.FN="fn",t.GL="gl",t.IP="ip",t))(Li||{});const Bi="dummy";var Pi=(t=>(t.BACKGROUND="background",t.BACKGROUND_LABELS="background-labels",t.ASSETS="assets",t.ANNOTATIONS="annotations",t.TEXT="text",t.ASSET_LABELS="asset-labels",t.LABELS="labels",t))(Pi||{});const ki="ae",Ni="rm-assets",Oi="ws-assets",Ri="ws-labels";function zi(t){return t+"-"+Pi.ASSETS}function Hi(t){return t+"-"+Pi.LABELS}const Wi={rm:["su-assets","su-labels","eq-assets","eq-labels","fn-assets","fn-labels"],ws:["su-assets","su-labels","eq-assets","eq-labels","fn-assets","fn-labels"],su:[Ni,"rm-labels",Oi,Ri,"eq-assets","eq-labels","fn-assets","fn-labels"],eq:[Oi,Ri,"su-assets","su-labels","fn-assets","fn-labels"]};let Fi=class{constructor(){c(this,"_listeners",new Map)}destroy(){this._listeners.clear()}addEventListener(t,e){let i=this._listeners.get(t);i||(i=[],this._listeners.set(t,i)),i.includes(e)||i.push(e)}addEventListeners(t,e){const i=t.split(","),n=i.length;for(let t=0;t<n;t++)this.addEventListener(i[t].trim(),e)}isListening(t){var e;return this._listeners.has(t)&&!!(null==(e=this._listeners.get(t))?void 0:e.length)}hasEventListener(t,e){var i;return 0!==this._listeners.size&&(this._listeners.has(t)&&!!(null==(i=this._listeners.get(t))?void 0:i.includes(e)))}removeEventListener(t,e){const i=this._listeners.get(t);if(i){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}dispatchEvent(t){const e=this._listeners.get(t.type);if(e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t);t.target=void 0}}dispatchEventAsync(t){const e=this._listeners.get(t.type);e&&setTimeout((()=>{for(const i of e)i.call(this,t)}))}},Ui=class t{constructor(){c(this,"isMatrix3",!0),c(this,"elements",[1,0,0,0,1,0,0,0,1])}static equals(t,e,i=1e-6){if(t.elements.length!=e.elements.length)return!1;for(let n=0,s=t.elements.length;n<s;n++){const s=t.elements[n]-e.elements[n];if(Math.abs(s)>i)return!1}return!0}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}clone(){return(new t).fromArray(this.elements)}compose(t,e,i){const n=Math.sin(e.x),s=Math.cos(e.x);return this.set(i.x*s,i.y*n*-1,t.x,i.x*n,i.y*s,t.y,0,0,1)}composeWithCenter(t,e,i,n){return Gi.identity(),$i.makeTranslation(t.x,t.y),Xi.makeRotation(e.x),Zi.makeScale(i.x,i.y),ji.copy(n).applyMatrix3(Zi),Gi.multiply(Ji.makeTranslation(-ji.x,-ji.y)).multiply($i).multiply(Ji.makeTranslation(ji.x,ji.y)).multiply(Xi).multiply(Ji.makeTranslation(-ji.x,-ji.y)).multiply(Zi),this.copy(Gi)}decompose(t,e,i){const n=Gi.copy(this).elements,s=Math.sqrt(n[0]*n[0]+n[3]*n[3]),r=Math.sqrt(n[1]*n[1]+n[4]*n[4]),a=n[0]*n[4]-n[3]*n[1];n[0]||n[3]?i.set(s,a/s):n[1]||n[4]?i.set(a/r,r):i.set(0,0);let o=0;o=n[0]||n[3]?n[3]>0?-Math.acos(n[0]/s):Math.acos(n[0]/s):n[1]||n[4]?Math.PI/2-(n[4]>0?Math.acos(-n[1]/r):-Math.acos(n[1]/r)):0,0!==o&&i.y<0&&(o*=-1),e.set(o,o),t.set(n[6],n[7])}compose2(t,e,i){return this.identity().translate(t.x,t.y).rotate(e.x).scale(i.x,i.y),this}decompose2(t,e,i){const n=this.clone();n.scale(-1,1);const s=n.elements[0],r=n.elements[1],a=n.elements[3],o=n.elements[4];let h=0,l=0,u=0;if(0!==s||0!==a){const t=Math.hypot(s,a);h=t,l=(s*o-r*a)/t;const e=Math.acos(s/t);u=a>0?-e:e}else if(0!==r||0!==o){const t=Math.hypot(r,o);h=(s*o-r*a)/t,l=t;const e=Math.acos(r/t);u=Math.PI/2+(o>0?-e:e)}else h=0,l=0,u=0;h=-h,t.x=n.elements[6],t.y=n.elements[7],e.x=e.y=u/Math.PI/180,i.x=h,i.y=l}composeSvgTransform(t=0,e=0,i,n=!1){if(!i&&!t&&!e)return this;this.identity(),Gi.identity();let s=null==i?void 0:i.split(") ").map((t=>t.trim()+")")).filter((t=>")"!==t));return s||(s=[]),(t||e)&&s.push(`translate(${t},${e})`),s.forEach((t=>{const e=/scale\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(t),i=/rotate\(\s*(-?\d*\.?\d+)(?:[ ,](-?\d*\.?\d+)(?:[ ,](-?\d*\.?\d+))?)?\s*\)/.exec(t),n=/translate\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(t);if(e){const t=Number(e[1])||1,i=Number(e[2])||t;Gi.multiply(Zi.makeScale(t,i))}else if(i){const t=Ie(Number(i[1])||0);Number(i[2])||Number(i[3])?(qi.set(Number(i[2]||"0"),Number(i[3]||"0")),Gi.multiply(Xi.makeRotationByPoint(t,qi))):Gi.multiply(Xi.makeRotation(t))}else n&&Gi.multiply($i.makeTranslation(Number(n[1])||0,Number(n[2])||0))})),this.copy(Gi),n&&this.premultiply(Zi.makeScale(1,-1)),this}decomposeSvgMatrix(t,e,i){const n=Gi.copy(this).elements;qi.set(n[0],n[1]),ji.set(n[3],n[4]);let s=qi.length();qi.normalize();let r=qi.dot(ji);Yi.copy(qi).multiplyScalar(-r),ji.add(Yi);const a=ji.length()||0;ji.normalize(),qi.x*ji.y<ji.x*qi.y&&(qi.x=-qi.x,qi.y=-qi.y,s=-s,r=-r);const o=s?Math.atan2(qi.y,qi.x):Math.atan2(-qi.x,ji.y);t.set(n[6],n[7]),e.set(o,o),i.set(s,a)}determinant(){const t=this.elements,e=t[0],i=t[3],n=t[6],s=t[1],r=t[4],a=t[7],o=t[2],h=t[5],l=t[8];return e*r*l-e*h*a-s*i*l+s*h*n+o*i*a-o*r*n}equals(t,e=0){const i=this.elements,n=t.elements;for(let t=0;t<9;t++)if(Math.abs(i[t]-n[t])>e)return!1;return!0}extractBasis2(t,e){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),this}flipY(){return this.premultiply(Zi.makeScale(1,-1))}flipSvgY(){return this.elements[1]*=-1,this.elements[3]*=-1,this.elements[7]*=-1,this}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}getComponents(t=[1,0,0,1,0,0]){return t[0]=this.elements[0],t[1]=this.elements[1],t[2]=this.elements[3],t[3]=this.elements[4],t[4]=this.elements[6],t[5]=this.elements[7],t}fromComponents(t){return this}getNormalMatrix(t){return this.setFromMatrix(t).invert().transpose()}getRotation(t){let e=this.elements;const i=Math.sqrt(e[0]*e[0]+e[3]*e[3]),n=Math.sqrt(e[1]*e[1]+e[4]*e[4]);let s=0;s=e[0]||e[3]?e[3]>0?-Math.acos(e[0]/i):Math.acos(e[0]/i):e[1]||e[4]?Math.PI/2-(e[4]>0?Math.acos(-e[1]/n):-Math.acos(e[1]/n)):0,this.getScale(ji),0!==s&&ji.x<0&&(s*=-1),t.set(s,s)}getScale(t){let e=this.elements,i=Math.sqrt(e[0]*e[0]+e[1]*e[1]),n=Math.sqrt(e[3]*e[3]+e[4]*e[4]),s=e[0]*e[4]-e[3]*e[1];e[0]||e[1]?t.set(s/n,n):e[3]||e[4]?t.set(i,s/i):t.set(0,0)}getTransition(t){t.set(this.elements[6],this.elements[7])}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}hasChange(){for(let t=0,e=this.elements.length;t<e;t++)if(Math.abs(this.elements[t]-Vi[t])>Number.EPSILON)return!0;return!1}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=l*r-a*h,c=a*o-l*s,d=h*s-r*o,p=e*u+i*c+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(n*h-l*i)*f,t[2]=(a*i-n*r)*f,t[3]=c*f,t[4]=(l*e-n*o)*f,t[5]=(n*s-a*e)*f,t[6]=d*f,t[7]=(i*o-h*e)*f,t[8]=(r*e-i*s)*f,this}lookAt(t,e,i){return this.identity().rotate(e.angle()-t.angle()+i.angle())}makeProjection(t,e,i,n,s,r){const a=s/(e-t),o=r/(i-n),h=s/2-(e+t)*a,l=r/2+(i+n)*o;return this.elements[0]=a,this.elements[3]=0,this.elements[6]=h,this.elements[1]=0,this.elements[4]=-o,this.elements[7]=l,this.elements[2]=0,this.elements[5]=0,this.elements[8]=1,this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeRotationByPoint(t,e){const i=Math.cos(t),n=Math.sin(t),s=-e.x*i+e.y*n+e.x,r=-e.x*n-e.y*i+e.y;return this.set(i,-n,s,n,i,r,0,0,1),this}makeRotationFromQuaternion(t){return this.compose(Qi,t,Ki)}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}multiply(t){return this.multiplyMatrices(this,t)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[3],o=i[6],h=i[1],l=i[4],u=i[7],c=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],y=n[1],v=n[4],x=n[7],b=n[2],w=n[5],_=n[8];return s[0]=r*f+a*y+o*b,s[3]=r*m+a*v+o*w,s[6]=r*g+a*x+o*_,s[1]=h*f+l*y+u*b,s[4]=h*m+l*v+u*w,s[7]=h*g+l*x+u*_,s[2]=c*f+d*y+p*b,s[5]=c*m+d*v+p*w,s[8]=c*g+d*x+p*_,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}premultiply(t){return this.multiplyMatrices(t,this)}rotate(t){return this.premultiply(Xi.makeRotation(-t))}scale(t,e){return this.premultiply(Zi.makeScale(t,e))}set(t,e,i,n,s,r,a,o,h){return this.elements[0]=t,this.elements[3]=e,this.elements[6]=i,this.elements[1]=n,this.elements[4]=s,this.elements[7]=r,this.elements[2]=a,this.elements[5]=o,this.elements[8]=h,this}setFromDomMatrix(t){return void 0!==t.m11&&void 0!==t.m21&&void 0!==t.m41&&void 0!==t.m12&&void 0!==t.m22&&void 0!==t.m42&&void 0!==t.m14&&void 0!==t.m24&&void 0!==t.m44?this.set(t.m11,t.m21,t.m41,t.m12,t.m22,t.m42,t.m14,t.m24,t.m44):void 0!==t.a&&void 0!==t.b&&void 0!==t.c&&void 0!==t.d&&void 0!==t.e&&void 0!==t.f&&this.set(t.a,t.c,t.e,t.b,t.d,t.f,0,0,1),this}setFromMatrix(t){const e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this}setUvTransform(t,e,i,n,s,r,a){const o=Math.cos(s),h=Math.sin(s);return this.set(i*o,i*h,-i*(o*r+h*a)+r+t,-n*h,n*o,-n*(-h*r+o*a)+a+e,0,0,1),this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}toString(){return`[${this.elements[0]},${this.elements[1]}, ${this.elements[3]},${this.elements[4]}, ${this.elements[6]},${this.elements[7]}]`}translate(t,e){return this.premultiply($i.makeTranslation(t,e))}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}getTransformScaleX(){return Math.sqrt(this.elements[0]*this.elements[0]+this.elements[1]*this.elements[1])}getTransformScaleY(){return Math.sqrt(this.elements[3]*this.elements[3]+this.elements[4]*this.elements[4])}isTransformSkewed(){const t=this.elements[0]*this.elements[3]+this.elements[1]*this.elements[4];return 0!==t&&Math.abs(t/(this.getTransformScaleX()*this.getTransformScaleY()))>Number.EPSILON}isTransformFlipped(){return this.elements[0]*this.elements[4]-this.elements[1]*this.elements[3]<0}hasMirror(){return this.elements[0]*this.elements[4]-this.elements[1]*this.elements[3]<0}hasMirrorY(){return this.elements[0]<0&&this.elements[4]>0}hasMirrorX(){return this.elements[4]<0&&this.elements[0]>0}getTransformString(){this.decompose(qi.identity(),ji.identity(),Yi.identity());const t=180*ji.x/Math.PI;return`translate(${qi.x}, ${qi.y}) rotate(${t}) scale(${Yi.x}, ${Yi.y})`}};const Vi=[1,0,0,0,1,0,0,0,1],qi=new We,ji=new We,Yi=new We,Gi=new Ui,$i=new Ui,Xi=new Ui,Zi=new Ui,Ji=new Ui,Qi=new We(0,0,0),Ki=new We(1,1,1);const tn=["view"],en=["viewer","mirror"];function nn(t,e){var i;if(t.tagName&&!tn.includes(t.tagName)&&("g"!==t.tagName||0!==(null==(i=t.childNodes)?void 0:i.length))){en.includes(t.id)||e(t);for(let i=0,n=t.childNodes.length;i<n;i++)nn(t.childNodes[i],e)}}let sn=0;function rn(t,e=0,i=0,n=[]){var s,r;if(!t)return n;const a=hn(t,"id","");if(tn.includes(t.nodeName)||"defs"===t.nodeName)return sn--,n;if(e&&sn>e)return n;let o;a&&!en.includes(a)&&(o={label:a,value:a,children:[]},n.push(o)),sn++;for(let i=0,r=null==(s=t.childNodes)?void 0:s.length;i<r;i++)rn(t.childNodes[i],e,sn,o?o.children:n);return 0===(null==(r=null==o?void 0:o.children)?void 0:r.length)&&delete o.children,sn=i,n}function an(t,e){var i;if(Array.isArray(t))for(let i=0,n=t.length||0;i<n;i++)an(t[i],e);else if(e(t),null==(i=t.children)?void 0:i.length)for(let i=0,n=t.children.length;i<n;i++)an(t.children[i],e)}function on(t){var e,i,n;const s=[];if(!(null==(e=null==t?void 0:t.children)?void 0:e.length))return s;for(let e,r=0,a=(null==(i=null==t?void 0:t.children)?void 0:i.length)||0;r<a;r++)e=t.children[r],s.push(e),(null==(n=e.children)?void 0:n.length)&&s.push(...on(e));return s}function hn(t,e,i){if(!t)return i;let n=i;if("function"==typeof t.getAttribute?n=null==t?void 0:t.getAttribute(e):Object.hasOwnProperty.call(t,"attributes")&&(n=t.attributes[e]),!n)return i;if(void 0!==i){if("string"==typeof i)return n;if("number"==typeof i)return Number(n)}return n}const ln=1,un=2,cn=3,dn=4,pn=5,fn=-1,mn=51,gn=52;class yn{constructor(t=!0){c(this,"dpr",1),c(this,"data"),c(this,"userData",{}),c(this,"autoClose",!1),c(this,"_saveData",!0),c(this,"_len",0),c(this,"_x0",0),c(this,"_y0",0),c(this,"_xi",0),c(this,"_yi",0),c(this,"_version",0),c(this,"_ctx"),c(this,"_ppx",0),c(this,"_ppy",0),c(this,"_ppl",0),c(this,"_ux",0),c(this,"_uy",0),c(this,"_pathSegLen"),c(this,"_pathLen",0),this._saveData=!!t,this._saveData&&(this.data=[])}dispose(){return this.reset(),this.data=[],this._len=0,this.userData={},this._ctx=void 0,this._version=0,this._ppx=0,this._ppy=0,this._ppl=0,this._ux=0,this._uy=0,this}reset(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=void 0,this._pathLen=0),this.needsUpdate=!0}set needsUpdate(t){!0===t&&this._version++}get version(){return this._version}clone(){const t=new yn(this._saveData),e=this.data;return t.data=(null==e?void 0:e.slice)?e.slice():Array.prototype.slice.call(e),t._len=this._len,t._ux=this._ux,t._uy=this._uy,t._ppx=this._ppx,t._ppy=this._ppy,t._ppl=this._ppl,t.autoClose=this.autoClose,t.userData=ri.cloneDeep(this.userData),t}setDpr(t){return this.dpr=t||1,this}setScale(t,e,i){return i&&(this._ux=Math.abs(i/(Ae.config.dpr||1)/(t||1)),this._uy=Math.abs(i/(Ae.config.dpr||1)/(e||1))),this}setContext(t){return this._ctx=t,this}getContext(){return this._ctx}len(){return this._len}setData(t){if(!this._saveData)return;const e=(null==t?void 0:t.length)||0;this.data&&this.data.length===e||(this.data=new Float32Array(e));for(let i=0;i<e;i++)this.data[i]=t[i];this._len=e}addData(...t){if(!this._saveData)return;let e=this.data;this._len+(null==t?void 0:t.length)>((null==e?void 0:e.length)||0)&&(this._expandData(),e=this.data);for(let i=0,n=(null==t?void 0:t.length)||0;i<n;i++)e[this._len++]=t[i]}insertData(t,...e){if(!this._saveData||!e||0===e.length)return;const i=this.getCmds();t<0&&(t=0),t>i.length&&(t=i.length),e.length>0&&i.splice(t,0,[...e]);const n=ri.flatten(i);this.setData(n),this.needsUpdate=!0}removeData(t){if(!this._saveData||!this.data||this._len<=0)return;const e=this.getCmds();if(t<0||t>=e.length)return;e.splice(t,1);const i=ri.flatten(e);this.setData(i),this.needsUpdate=!0}_expandData(){if(!(this.data instanceof Array)){const t=[];for(let e=0;e<this._len;e++)t[e]=this.data[e];this.data=t}}appendPath(t){if(!this._saveData||!t)return;t instanceof Array||(t=[t]);const e=t.length;let i=0,n=this._len;for(let n=0;n<e;n++)i+=t[n].len()||0;const s=this.data;if((s instanceof Float32Array||!s)&&(this.data=new Float32Array(n+i),n>0&&s))for(let t=0;t<n;t++)this.data[t]=s[t];for(let i=0;i<e;i++){const e=t[i].data;for(let i=0,s=(null==t?void 0:t.length)||0;i<s;i++)this.data[n++]=e[i]}this._len=n}toStatic(){this._saveData&&(this._pendingLine(),this.data instanceof Array&&(this.data.length=this._len,this._len>11&&(this.data=new Float32Array(this.data))))}rebuildPath(t,e){if(!this.data||!this._len||e<=0)return;const i=this.data,n=this._ux,s=this._uy,r=this._len;let a=0,o=0,h=0,l=0,u=0,c=0;const d=e<1;let p,f,m,g,y=0,v=0,x=0,b=0;if(!d||(this._pathSegLen||this._calculateLength(),p=this._pathSegLen,f=this._pathLen,x=f*e,x))t:for(let e=0;e<r;){const r=i[e++],f=1===e;switch(f&&(a=h=i[e],o=l=i[e+1]),r!==un&&b>0&&(t.lineTo(m,g),b=0),r){case ln:a=h=i[e++],o=l=i[e++],t.moveTo(h,l);break;case un:{u=i[e++],c=i[e++];const r=Math.abs(u-h),a=Math.abs(c-l);if(r>n||a>s){if(d){const e=p[v++];if(y+e>x){const i=(x-y)/e;t.lineTo(h*(1-i)+u*i,l*(1-i)+c*i);break t}y+=e}t.lineTo(u,c),h=u,l=c,b=0}else{const t=r*r+a*a;t>b&&(m=u,g=c,b=t)}break}case cn:{const n=i[e++],s=i[e++],r=i[e++],a=i[e++],o=i[e++],u=i[e++];if(d){const e=p[v++];if(y+e>x){const i=(x-y)/e;Ge(h,n,r,o,i,xn),Ge(l,s,a,u,i,bn),t.bezierCurveTo(xn[1],bn[1],xn[2],bn[2],xn[3],bn[3]);break t}y+=e}t.bezierCurveTo(n,s,r,a,o,u),h=o,l=u;break}case dn:{const n=i[e++],s=i[e++],r=i[e++],a=i[e++];if(d){const e=p[v++];if(y+e>x){const i=(x-y)/e;Je(h,n,r,i,xn),Je(l,s,a,i,bn),t.quadraticCurveTo(xn[1],bn[1],xn[2],bn[2]);break t}y+=e}t.quadraticCurveTo(n,s,r,a),h=r,l=a;break}case pn:const r=i[e++],w=i[e++],_=i[e++],S=i[e++];let E=i[e++],M=i[e++];const A=i[e++],T=!i[e++],C=_>S?_:S,I=Math.abs(_-S)>.001;let D=E+M,L=!1;if(d){const t=p[v++];y+t>x&&(D=E+M*(x-y)/t,L=!0),y+=t}if(I&&"function"==typeof t.ellipse?t.ellipse(r,w,_,S,A,E,D,T):t.arc(r,w,C,E,D,T),L)break t;f&&(a=r+Math.cos(E)*_,o=w+Math.sin(E)*S),h=Math.cos(D)*_+r,l=Math.sin(D)*S+w;break;case mn:a=h=i[e],o=l=i[e+1],u=i[e++],c=i[e++];const B=i[e++],P=i[e++];if(d){const e=p[v++];if(y+e>x){let e=x-y;t.moveTo(u,c),t.lineTo(u+Math.min(B,e),c),e-=B,e>0&&t.lineTo(u+B,c+Math.min(P,e)),e-=P,e>0&&t.lineTo(u+Math.max(B-e,0),c+P),e-=B,e>0&&t.lineTo(u,c+Math.max(P-e,0));break t}y+=e}t.rect(u,c,B,P);break;case fn:if(d){const e=p[v++];if(y+e>x){const i=(x-y)/e;t.lineTo(h*(1-i)+a*i,l*(1-i)+o*i);break t}y+=e}t.closePath(),h=a,l=o}}}_calculateLength(){let t=0;if(!this.data||!this._len)return t;const e=this.data,i=this._len,n=this._ux,s=this._uy;let r=0,a=0,o=0,h=0;this._pathSegLen||(this._pathSegLen=[]);const l=this._pathSegLen;let u=0;for(let c=0;c<i;){const d=e[c++],p=1===c;p&&(r=o=e[c],a=h=e[c+1]);let f=-1;switch(d){case ln:r=o=e[c++],a=h=e[c++];break;case un:{const t=e[c++],r=e[c++],a=t-o,l=r-h;(Math.abs(a)>n||Math.abs(l)>s||c==i-1)&&(f=Math.sqrt(a*a+l*l),o=t,h=r);break}case cn:{const t=e[c++],i=e[c++],n=e[c++],s=e[c++],r=e[c++],a=e[c++];f=Ye(o,h,t,i,n,s,r,a,10),o=r,h=a;break}case dn:{const t=e[c++],i=e[c++],n=e[c++],s=e[c++];f=Ze(o,h,t,i,n,s,10),o=n,h=s;break}case pn:{const t=e[c++],i=e[c++],n=e[c++],s=e[c++],l=e[c++];let u=e[c++];const d=l+u;c+=1,p&&(r=t+Math.cos(l)*n,a=i+Math.sin(l)*s),f=Math.max(n,s)*Math.min(Math.abs(u),2*Qe),o=Math.cos(d)*n+t,h=Math.sin(d)*s+i;break}case mn:r=o=e[c++],a=h=e[c++];f=2*(e[c++]+e[c++]);break;case fn:{const t=r-o,e=a-h;f=Math.sqrt(t*t+e*e),o=r,h=a;break}}f>=0&&(l[u++]=f,t+=f)}return this._pathLen=t,t}computeBoundingBox(t=new ai){if(t.makeEmpty(),vn.makeEmpty(),!this.data||!this._len)return t;const e=this.data;let i=0,n=0,s=0,r=0,a=0;for(a=0;a<this._len;){const o=e[a++],h=1===a;switch(h&&(i=s=e[a],n=r=e[a+1]),o){case ln:i=s=e[a++],n=r=e[a++],vn.setFromXYXY(i,n,i,n);break;case un:t.expandByXY(s,r),t.expandByXY(e[a],e[a+1]),s=e[a++],r=e[a++];break;case cn:t.expandByCubic(s,r,e[a++],e[a++],e[a++],e[a++],e[a],e[a+1]),s=e[a++],r=e[a++];break;case dn:t.expandByQuadratic(s,r,e[a++],e[a++],e[a],e[a+1]),s=e[a++],r=e[a++];break;case pn:const o=e[a++],l=e[a++],u=Math.abs(e[a++]),c=Math.abs(e[a++]);let d=e[a++],p=e[a++]+d;a+=1;const f=!e[a++];h&&(i=o+Math.cos(d)*u,n=l+Math.sin(d)*c),t.expandByArc(o,l,u,c,d,p,f),s=Math.cos(p)*u+o,r=Math.sin(p)*c+l;break;case mn:i=s=e[a++],n=r=e[a++];const m=e[a++],g=e[a++];t.expandByXY(i,n),t.expandByXY(i+m,n+g);break;case gn:{const i=e[a++],n=e[a++],s=Math.abs(e[a++]),r=Math.abs(e[a++]),o=e[a++];let h=e[a++],l=e[a++];const u=!!e[a++];t.expandByEllipse(i,n,s,r,o,h,l,u);break}case fn:s=i,r=n}t.expandByBox(vn)}return t}applyMatrix3(t){if(!this.data||!this._len)return this;const e=this.data,i=this._len;let n=0;for(t.getScale(Mn);n<i;){switch(e[n++]){case ln:case un:En.set(e[n],e[n+1]).applyMatrix3(t),e[n]=En.x,e[n+1]=En.y,n+=2;break;case cn:for(let i=0;i<3;i++)En.set(e[n+2*i],e[n+2*i+1]).applyMatrix3(t),e[n+2*i]=En.x,e[n+2*i+1]=En.y;n+=6;break;case dn:for(let i=0;i<2;i++)En.set(e[n+2*i],e[n+2*i+1]).applyMatrix3(t),e[n+2*i]=En.x,e[n+2*i+1]=En.y;n+=4;break;case pn:En.set(e[n],e[n+1]).applyMatrix3(t),e[n+5]=En.x,e[n+6]=En.y,e[n]*=Mn.x,e[n+1]*=Mn.y,n+=7;break;case mn:En.set(e[n],e[n+1]).applyMatrix3(t),e[n]=En.x,e[n+1]=En.y,e[n+2]*=Mn.x,e[n+3]*=Mn.y,n+=4;break;case gn:En.set(e[n],e[n+1]).applyMatrix3(t);let i=[e[n],e[n+1],e[n+2],e[n+3],e[n+4],e[n+5],e[n+6],e[n+7]];t.isTransformSkewed()?Ln([e[n],e[n+1],e[n+2],e[n+3],e[n+4],e[n+5],e[n+6],e[n+7]],t,i):Bn([e[n],e[n+1],e[n+2],e[n+3],e[n+4],e[n+5],e[n+6],e[n+7]],t,i),e[n]=En.x,e[n+1]=En.y,e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],n+=8}}return this.needsUpdate=!0,this}_pendingLine(){var t;this._ppl>0&&(null==(t=this._ctx)||t.lineTo(this._ppx,this._ppy),this._ppl=0)}beginPath(){var t;return null==(t=this._ctx)||t.beginPath(),this.reset(),this}moveTo(t,e){var i;return this._pendingLine(),this.addData(ln,t,e),null==(i=this._ctx)||i.moveTo(t,e),this._x0=this._xi=t,this._y0=this._yi=e,this}lineTo(t,e){var i;const n=Math.abs(t-this._xi),s=Math.abs(e-this._yi);this.addData(un,t,e);if(n>this._ux||s>this._uy)null==(i=this._ctx)||i.lineTo(t,e),this._xi=t,this._yi=e,this._ppl=0;else{const i=n*n+s*s;i>this._ppl&&(this._ppx=t,this._ppy=e,this._ppl=i)}return this}bezierCurveTo(t,e,i,n,s,r){var a;return this._pendingLine(),this.addData(cn,t,e,i,n,s,r),null==(a=this._ctx)||a.bezierCurveTo(t,e,i,n,s,r),this._xi=s,this._yi=r,this}quadraticCurveTo(t,e,i,n){var s;return this._pendingLine(),this.addData(dn,t,e,i,n),null==(s=this._ctx)||s.quadraticCurveTo(t,e,i,n),this._xi=i,this._yi=n,this}arc(t,e,i,n,s,r){var a;this._pendingLine(),wn[0]=n,wn[1]=s,ei(wn,!!r),n=wn[0];const o=(s=wn[1])-n;return this.addData(pn,t,e,i,i,n,o,0,r?0:1),null==(a=this._ctx)||a.arc(t,e,i,n,s,r),this._xi=t+Math.cos(s)*i,this._yi=e+Math.sin(s)*i,this}arcTo(t,e,i,n,s){var r;return this._pendingLine(),null==(r=this._ctx)||r.arcTo(t,e,i,n,s),this}rect(t,e,i,n){var s;return this._pendingLine(),this.addData(mn,t,e,i,n),null==(s=this._ctx)||s.rect(t,e,i,n),this}closePath(){var t;return this._pendingLine(),this.addData(fn),null==(t=this._ctx)||t.closePath(),this._xi=this._x0,this._yi=this._y0,this}ellipse(t,e,i,n,s,r,a,o){var h;return this._pendingLine(),this.addData(gn,t,e,i,n,s,r,a,o?1:0),null==(h=this._ctx)||h.ellipse(t,e,i,n,s,r,a,o),this}absellipse(t,e,i,n,s,r,a,o=!1){return this._pendingLine(),this.addData(gn,t,e,i,n,s,r,a,o?1:0),this}absarc(t,e,i,n,s,r=!1){return this.absellipse(t,e,i,i,0,n,s,r),this}fill(t){t.fill(),this.toStatic()}stroke(t){this._pendingLine(),t.stroke(),this.toStatic()}addArrow(t,e,i=30){if(!t||!e)return this;const n=this.getVertices();return!(null==n?void 0:n.length)||n.length<4||(t>0?(_n.set(n[2],n[3]),En.set(n[0],n[1]),Sn.subVectors(_n,En),Mn.lerpVectors(En,_n,e/Sn.length()),An.copy(Mn).rotateAround(En,Ie(i)),Tn.copy(Mn).rotateAround(En,-Ie(i)),this.moveTo(An.x,An.y),this.lineTo(En.x,En.y),this.lineTo(Tn.x,Tn.y)):(_n.set(n[n.length-4],n[n.length-3]),En.set(n[n.length-2],n[n.length-1]),Sn.subVectors(_n,En),Mn.lerpVectors(En,_n,e/Sn.length()),An.copy(Mn).rotateAround(En,Ie(i)),Tn.copy(Mn).rotateAround(En,-Ie(i)),this.moveTo(An.x,An.y),this.lineTo(En.x,En.y),this.lineTo(Tn.x,Tn.y))),this}getVertices(t=[]){if(!this.data||!this._len)return t;const e=this.data;for(let i=0;i<this._len;){const n=e[i++];switch(n){case ln:case un:t.push(e[i++],e[i++]);break;case cn:i+=4,t.push(e[i++],e[i++]);break;case dn:i+=2,t.push(e[i++],e[i++]);break;case pn:const s=e[i++],r=e[i++],a=e[i++],o=e[i++],h=e[i++],l=e[i++]+h;i+=2;const u=s+Math.cos(h)*a,c=r+Math.sin(h)*o;t.push(u,c);const d=s+Math.cos(l)*a,p=r+Math.sin(l)*o;t.push(d,p);break;case mn:const f=e[i++],m=e[i++],g=e[i++],y=e[i++];t.push(f,m,f+g,m,f+g,m+y,f,m+y);break;case gn:const v=e[i++],x=e[i++],b=e[i++],w=e[i++];e[i++];const _=e[i++],S=e[i++];e[i++];const E=v+b*Math.cos(_),M=x+w*Math.sin(_);t.push(E,M);const A=v+b*Math.cos(S),T=x+w*Math.sin(S);t.push(A,T);break;case fn:break;default:throw new Error("Invalid command "+n)}}return t}getCmds(){var t;if(!(null==(t=this.data)?void 0:t.length))throw new Error("PathProxy.getCmds: empty path.data.");const e=this.data,i=[];let n=0;for(n=0;n<e.length;){switch(e[n++]){case ln:i.push([ln,e[n++],e[n++]]);break;case un:i.push([un,e[n++],e[n++]]);break;case cn:i.push([cn,e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]]);break;case dn:i.push([dn,e[n++],e[n++],e[n++],e[n++]]);break;case pn:i.push([pn,e[n++],e[n++],e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]]);break;case mn:i.push([mn,e[n++],e[n++],e[n++],e[n++]]);break;case gn:i.push([gn,e[n++],e[n++],e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]]);break;case fn:i.push([fn])}}return i}getControlPoints(t=[]){if(t.length=0,!this.data||!this._len)return t;const e=this.data;let i=0,n=0,s=0;for(i=0;i<this._len;){switch(e[i++]){case ln:n=e[i],s=e[i+1],i+=2,t.push(new We(n,s));break;case un:{const r=e[i++],a=e[i++];t.push(new We(r,a)),n=r,s=a;break}case cn:{const r=n,a=s,o=e[i++],h=e[i++],l=e[i++],u=e[i++],c=e[i++],d=e[i++];t.push(new We(r,a)),t.push(new We(o,h)),t.push(new We(l,u)),t.push(new We(c,d)),n=c,s=d;break}case dn:{const r=n,a=s,o=e[i++],h=e[i++],l=e[i++],u=e[i++];t.push(new We(r,a)),t.push(new We(o,h)),t.push(new We(l,u)),n=l,s=u;break}case pn:{const r=e[i++],a=e[i++],o=e[i++],h=e[i++],l=e[i++],u=e[i++];e[i++],e[i++];const c=l+u,d=r+Math.cos(l)*o,p=a+Math.sin(l)*h;t.push(new We(d,p));const f=r+Math.cos(c)*o,m=a+Math.sin(c)*h;t.push(new We(f,m)),t.push(new We(r,a)),n=f,s=m;break}case mn:{const r=e[i++],a=e[i++],o=e[i++],h=e[i++];t.push(new We(r,a)),t.push(new We(r+o,a)),t.push(new We(r+o,a+h)),t.push(new We(r,a+h)),n=r,s=a;break}case gn:{const r=e[i++],a=e[i++],o=e[i++],h=e[i++];t.push(new We(r,a)),o>h?(t.push(new We(r+o,a)),t.push(new We(r,a+h)),o!==h&&(t.push(new We(r-o,a)),t.push(new We(r,a-h)))):h>o?(t.push(new We(r+o,a)),t.push(new We(r,a+h)),t.push(new We(r-o,a)),t.push(new We(r,a-h))):t.push(new We(r+o,a)),n=r,s=a;break}}}return t}getStartPoint(t=new We){return t.set(this._x0,this._y0)}getEndPoint(t=new We){return t.set(this._xi,this._yi)}getLength(){return this._pathSegLen||this._calculateLength(),this._pathLen}getArea(){if(!this.data||!this._len)return 0;const t=this.data,e=this._len;let i=0,n=0,s=0,r=0,a=0,o=0,h=0,l=!1;for(let u=0;u<e;){switch(t[u++]){case ln:o=r=n=t[u++],h=a=s=t[u++],l=!0;break;case un:const e=t[u++],c=t[u++];i+=(r-e)*(a+c)/2,r=e,a=c;break;case cn:{const e=t[u++],n=t[u++],s=t[u++],o=t[u++],h=t[u++],l=t[u++],c=10;let d=r,p=a;for(let t=1;t<=c;t++){const u=t/c,f=1-u,m=f*f*f*r+3*f*f*u*e+3*f*u*u*s+u*u*u*h,g=f*f*f*a+3*f*f*u*n+3*f*u*u*o+u*u*u*l;i+=(d-m)*(p+g)/2,d=m,p=g}r=h,a=l;break}case dn:{const e=t[u++],n=t[u++],s=t[u++],o=t[u++],h=8;let l=r,c=a;for(let t=1;t<=h;t++){const u=t/h,d=1-u,p=d*d*r+2*d*u*e+u*u*s,f=d*d*a+2*d*u*n+u*u*o;i+=(l-p)*(c+f)/2,l=p,c=f}r=s,a=o;break}case pn:{const e=t[u++],n=t[u++],s=t[u++],o=t[u++],h=t[u++],l=t[u++],c=t[u++];t[u++];const d=Math.max(10,Math.floor(10*Math.abs(l))),p=l/d;let f=r,m=a;for(let t=1;t<=d;t++){const r=h+t*p,a=e+Math.cos(r)*s,l=n+Math.sin(r)*o;if(0!==c){const t=Math.cos(c),s=Math.sin(c),r=(a-e)*t-(l-n)*s+e,o=(a-e)*s+(l-n)*s+n;i+=(f-r)*(m+o)/2,f=r,m=o}else i+=(f-a)*(m+l)/2,f=a,m=l}const g=h+l;r=e+Math.cos(g)*s,a=n+Math.sin(g)*o;break}case mn:const d=t[u++],p=t[u++];i+=t[u++]*t[u++],r=d,a=p;break;case fn:l&&(i+=(r-o)*(a+h)/2),r=n,a=s}}return Math.abs(i)}}const vn=new ai,xn=[],bn=[],wn=[],_n=new We,Sn=new We,En=new We,Mn=new We,An=new We,Tn=new We,Cn=new Ui,In=new Ui,Dn=new Ui;function Ln(t,e,i=[0,0,0,0,0,0,0,0]){const[n,s,r,a,o,h,l,u]=t;i[0]=n,i[1]=s;const c=Math.cos(o),d=Math.sin(o);En.set(r*c,r*d).applyMatrix3(e),Mn.set(-a*d,a*c).applyMatrix3(e);const p=Cn.set(En.x,Mn.x,0,En.y,Mn.y,0,0,0,1),f=In.copy(p).invert(),m=Dn.copy(f).transpose().multiply(f).elements,g=function(t,e,i){let n,s,r,a,o=0;const h=t+i,l=t-i,u=Math.sqrt(l*l+4*e*e);h>0?(o=.5*(h+u),a=1/o,n=t*a*i-e*a*e):h<0?n=.5*(h-u):(o=.5*u,n=-.5*u);s=l>0?l+u:l-u;Math.abs(s)>2*Math.abs(e)?(a=-2*e/s,r=1/Math.sqrt(1+a*a),s=a*r):0===Math.abs(e)?(s=1,r=0):(a=-.5*s/e,s=1/Math.sqrt(1+a*a),r=a*s);l>0&&(a=s,s=-r,r=a);return{rt1:o,rt2:n,cs:s,sn:r}}(m[0],m[1],m[4]),y=Math.sqrt(g.rt1),v=Math.sqrt(g.rt2);i[2]=1/y,i[3]=1/v,i[4]=Math.atan2(g.sn,g.cs);if(!((l-h)%(2*Math.PI)<Number.EPSILON)){const t=In.set(y,0,0,0,v,0,0,0,1),n=Dn.set(g.cs,g.sn,0,-g.sn,g.cs,0,0,0,1),s=t.multiply(n).multiply(p),r=t=>{const{x:e,y:i}=new We(Math.cos(t),Math.sin(t)).applyMatrix3(s);return Math.atan2(i,e)};i[5]=r(h),i[6]=r(l),e.isTransformFlipped()&&(i[7]=u?0:1)}return i}function Bn(t,e,i=[0,0,0,0,0,0,0,0]){const[n,s,r,a,o,h,l,u]=t;i[0]=n,i[1]=s;const c=e.getTransformScaleX(),d=e.getTransformScaleY();i[2]=r*c,i[3]=a*d;const p=c>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);return i[4]=o+p,e.isTransformFlipped()&&(i[5]=-1*h,i[6]=-1*l,i[7]=u?0:1),i}class Pn{static destroy(){this.cached.clear(),this.cachedCanvas.clear()}static createCanvas(t){var e;if(!(null==(e=Ae.window)?void 0:e.document))throw new Error("environment not support");let i,n;if(t.containerId&&(i=Ae.window.document.getElementById(t.containerId)),i||(i=Ae.window.document.getElementsByTagName("body")[0]),t.canvasId&&(n=Ae.window.document.getElementById(t.canvasId)||void 0),t.width||(t.width=(null==i?void 0:i.offsetWidth)||100),t.height||(t.height=(null==i?void 0:i.offsetHeight)||100),t.dpr||(t.dpr=Ae.config.dpr),n)this.resizeCanvas(n,t.width,t.height,t.dpr);else{if(n=this.createHtmlCanvas(t.width,t.height,t.dpr),!n)throw new Error("error environment");t.canvasId&&n.setAttribute("id",t.canvasId),null==i||i.appendChild(n)}return n.style.background=t.background||"transparent",n}static getContext2D(t,e={}){const i={alpha:!0,willReadFrequently:!!e.willReadFrequently},n=t.getContext("2d",i);if(!n)throw new Error("getContext2D error");return n.scale(e.dpr||1,e.dpr||1),n}static resizeCanvas(t,e,i,n=1){t instanceof OffscreenCanvas?(t.width=e,t.height=i):t instanceof HTMLCanvasElement&&(t.setAttribute("width",(e*n).toString()),t.setAttribute("height",(i*n).toString()),t.style.width=e+"px",t.style.height=i+"px",t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.imageRendering="pixelated",t.style.transform="translateZ(0)")}static getImageBitmapByCanvasAsync(t){return d(this,null,(function*(){if(t)return t instanceof OffscreenCanvas?t.transferToImageBitmap():t instanceof HTMLCanvasElement?yield createImageBitmap(t):void 0}))}static get(t,e,i,n=1){let s=this.cached.get(t);return s||(s=this.create(e,i,n),this.set(t,s)),this.resizeCanvas(s,e,i,n),s}static set(t,e){if(!t||!e)throw new Error("error input");return this.cached.set(t,e)}static remove(t){this.cached.has(t)&&this.cached.delete(t)}static create(t,e,i=1){var n;if(null==(n=Ae.window)?void 0:n.OffscreenCanvas)return new OffscreenCanvas(t,e);throw new Error("environment does not support")}static createHtmlCanvas(t,e,i=1){if(!Ae.window.document)throw new Error("environment does not support");const n=Ae.window.document.createElement("canvas");return this.resizeCanvas(n,t,e,i),n}static measureText(t,e,i=new We){if(!t)throw new Error("input error");const n=this.get("measureText",1,1).getContext("2d");if(!n)throw new Error("bufferCtx not found");e.render(n);const s=n.measureText(t);if(!s)throw new Error("measureText error");const r=s.actualBoundingBoxRight+s.actualBoundingBoxLeft,a=s.actualBoundingBoxAscent+s.actualBoundingBoxDescent;return i.set(r,a),i}static measureText2(t,e=12,i=new We){if(!t)throw new Error("input error");const n=this.get("measureText",1,1).getContext("2d");if(!n)throw new Error("bufferCtx not found");n.font=`${e}px sans-serif`;const s=n.measureText(t);if(!s)throw new Error("measureText error");const r=s.actualBoundingBoxRight+s.actualBoundingBoxLeft,a=s.actualBoundingBoxAscent+s.actualBoundingBoxDescent;return i.set(r,a),i}static getCtx(t,e,i,n=1){if(!kn[t]){const s=this.create(e,i,n);kn[t]={cvs:s,ctx:s.getContext("2d")},this.resizeCanvas(s,e,i,n)}return kn[t].ctx}}c(Pn,"cached",new Map),c(Pn,"cachedCanvas",new Map);const kn={};class Nn{constructor(){c(this,"instancedMesh",!1),c(this,"_xml"),c(this,"_symbolsNodeMap",{}),c(this,"paths",[]),c(this,"labels",[]),c(this,"symbolsMap",{}),c(this,"instances",[]),c(this,"_viewBox",new ai),c(this,"_isInDefs",!1),c(this,"_transformStack",[]),c(this,"_currentTransform",new Ui),c(this,"centralInitialized",!1),c(this,"centralPoint",new We),c(this,"defaultUnit","px"),c(this,"defaultDPI",90),c(this,"stylesheets",{}),c(this,"float2Int",!0),c(this,"scaleFactor",1),c(this,"ASSET_TYPES",[])}static createSVG(t,e){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");return i.setAttribute("width",t.toString()),i.setAttribute("height",e.toString()),i}static createSVGPath(t){const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d",t),e}static createSVGText(t,e,i){const n=document.createElementNS("http://www.w3.org/2000/svg","text");return n.setAttribute("x",e.toString()),n.setAttribute("y",i.toString()),n.textContent=t,n}static getInstance(){return On}static setInstancedMesh(t){return this.getInstance().setInstancedMesh(t)}static parse(t,e={}){return this.getInstance().parse(t,e)}static getBoundingBoxByNode(t,e=new ai){if(e.makeEmpty(),!t)return e;if("text"===t.nodeName){if("function"==typeof t.getBBox){const i=t.getBBox();e.min.set(i.x,i.y),e.max.set(i.x+i.width,i.y+i.height)}const i=t.textContent||"",n=parseInt(t.getAttribute("font-size")||"12");return Pn.measureText2(i,n,Yn),Yn.validate()&&(e.getCenter(Gn),e.min.setY(Gn.y-Yn.y/2),e.max.setY(Gn.y+Yn.y/2)),this.parseNodeTransform(t,Fn),parseInt(t.getAttribute("stroke-width")||"0"),e.applyMatrix3(Fn),e}const i=Nn.getInstance().parseNode(t);if(!i.length)return e;for(let t=0,n=i.length;t<n;t++)i[t].computeBoundingBox($n),e.union($n);return e}static parseNodeTransform(t,e){return Nn.getInstance().parseNodeTransform(t,void 0,e)}static getSvgPathDByData(t){if(!t||0===t.length)return"";const e=Array.isArray(t)?t:Array.from(t);let i="",n=0;for(;n<e.length;){switch(e[n++]){case ln:i+=`M${e[n++]} ${e[n++]}`;break;case un:i+=`L${e[n++]} ${e[n++]}`;break;case cn:i+=`C${e[n++]} ${e[n++]} ${e[n++]} ${e[n++]} ${e[n++]} ${e[n++]}`;break;case dn:i+=`Q${e[n++]} ${e[n++]} ${e[n++]} ${e[n++]}`;break;case pn:const t=e[n++],s=e[n++],r=e[n++],a=e[n++],o=e[n++],h=e[n++],l=e[n++],u=e[n++],c=t+Math.cos(o+h)*r,d=s+Math.sin(o+h)*a;i+=`A${r} ${a} ${l} ${Math.abs(h)>Math.PI?1:0} ${u?0:1} ${c} ${d}`;break;case mn:const p=e[n++],f=e[n++],m=e[n++],g=e[n++];i+=`M${p} ${f} L${p+m} ${f} L${p+m} ${f+g} L${p} ${f+g} Z`;break;case gn:const y=e[n++],v=e[n++],x=e[n++],b=e[n++],w=e[n++],_=e[n++],S=e[n++],E=e[n++],M=y+Math.cos(_)*x,A=v+Math.sin(_)*b,T=y+Math.cos(S)*x,C=v+Math.sin(S)*b;i+=`M${M} ${A} A${x} ${b} ${w} ${Math.abs(S-_)>Math.PI?1:0} ${E?0:1} ${T} ${C}`;break;case fn:i+="Z"}}return i}static getPathProxyBySvgPathD(t,e){return Nn.getInstance().getPathProxyBySvgPathD(t,e)}setInstancedMesh(t){return this.instancedMesh=t,this}dispose(){this._xml=void 0,this._symbolsNodeMap={},this.paths=[],this.labels=[],this.symbolsMap={},this.instances=[],this._viewBox.makeEmpty(),this._isInDefs=!1,this._transformStack=[],this._currentTransform.identity(),this.centralPoint.identity(),this.centralInitialized=!1,this.stylesheets={},this.ASSET_TYPES=[]}parse(t,e={}){var i;this.dispose();const n=(new DOMParser).parseFromString(t,"image/svg+xml");this._xml=n.documentElement,Zn((null==(i=this._xml)?void 0:i.getAttribute("viewBox"))||"",this._viewBox),this._viewBox.getCenter(this.centralPoint);const s=rn(this._xml),r=function(t,e=[]){return e.length=0,an(t||[],(t=>{var i;if("assets"===t.label&&(null==(i=t.children)?void 0:i.length))for(let i,n=0,s=t.children.length;n<s;n++)i=t.children[n],i.label&&e.push(ri.head(ri.split(i.label,"-"))||"")})),e=ri.uniq(ri.compact(e)),e}(s);this.ASSET_TYPES=ri.uniq(ri.compact([...r,...Object.values(Li)])),this.parseNode(this._xml,e,this.paths);const a={xml:this._xml,viewBox:this._viewBox.clone(),idsTree:s,assetTypes:r,paths:this.paths,labels:this.labels};return this.instancedMesh&&(a.symbolsMap=this.symbolsMap,a.instances=this.instances),a}getViewBox(t,e=new ai){let i=((null==t?void 0:t.getAttribute("viewBox"))||"").split(" "),n=ri.map(i,(t=>parseFloat(t)));return 4!==(null==n?void 0:n.length)||(e.min.set(n[0],n[1]),e.max.set(n[0]+n[2],n[1]+n[3])),e}parseNode(t,e={},i=[],n,s){var r,a,o;if(1!==t.nodeType)return i;let h=!1;const l="function"==typeof t.getAttribute?t.getAttribute("id"):null,u=this.getNodeTransform(t,e);let c;const d=(t={},e,i)=>{if(!t)return;const s=(null==i?void 0:i.assetType)||this.getAssetType(e),r=(null==i?void 0:i.layerType)||this.getAssetType(e,"layer");return ri.set(t,"userData",{pid:n,id:l||n,nodeName:e.nodeName,layerType:r,assetType:s,style:Object.assign({},i)}),t};switch(t.nodeName){case"svg":case"g":e=this.parseStyle(t,e);break;case"defs":h=!0,this._isInDefs=!0;break;case"style":this.parseCSSStylesheetByTextContent(t);break;case"symbol":if(!l||!this._isInDefs&&this.symbolsMap[l]){if(!this._isInDefs&&l){const t=this.symbolsMap[l],e=(null==t?void 0:t.paths)||[];for(let n=0,s=(null==e?void 0:e.length)||0;n<s;n++)c=e[n],c&&(c=c.clone(),ri.set(c,"userData",Object.assign({},t.userData)),this.transformPath(c,this._currentTransform),i.push(c));return u&&(this._transformStack.pop(),this._transformStack.length>0?this._currentTransform.copy(this._transformStack[this._transformStack.length-1]):this._currentTransform.identity()),i}}else e=this.parseStyle(t,e),this._symbolsNodeMap[l]=t,ri.set(this.symbolsMap,`[${l}].symbolId`,l),ri.set(this.symbolsMap,`[${l}].style`,e);break;case"use":const p=(t.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),f=this._symbolsNodeMap[p],m=this.symbolsMap[p];if(f&&(e=this.parseStyle(f,e)),void 0===(e=this.parseStyle(t,e)).assetType&&(e.assetType=this.getAssetType(t)),void 0===e.layerType&&(e.layerType=this.getAssetType(t,"layer")),!this._isInDefs&&this.instancedMesh&&m){const i={symbolId:p,transform:this._currentTransform.clone(),userData:{}};d(i,t,e),this.instances.push(i)}else f&&(d(m,t,e),this.parseNode(f,e,i,l||n,s));break;case"path":e=this.parseStyle(t,e),t.hasAttribute("d")&&(c=this.parsePathNode(t,s));break;case"rect":e=this.parseStyle(t,e),c=this.parseRectNode(t,s);break;case"polygon":e=this.parseStyle(t,e),c=this.parsePolygonNode(t,s);break;case"polyline":e=this.parseStyle(t,e),c=this.parsePolylineNode(t,s);break;case"circle":e=this.parseStyle(t,e),c=this.parseCircleNode(t,s);break;case"ellipse":e=this.parseStyle(t,e),c=this.parseEllipseNode(t,s);break;case"line":e=this.parseStyle(t,e),c=this.parseLineNode(t,s);break;case"text":e=this.parseStyle(t,e);const g=this.parseTextNode(t,e,s);if(!g)return i;d(g,t,e),n||ri.set(g,"userData.pid",this.getId(t)),ri.set(g,"userData.textContent",t.textContent),ri.set(g,"transform",this._currentTransform.clone()),ri.set(g,"userData.id",ri.get(g,"userData.id")),ri.set(g,"userData.pid",this.getParentId(t,n));const y=this.getLabelAssetId(t);if(y?ri.set(g,"userData.aid",y):ri.set(g,"userData.aid",ri.split((null==(r=null==g?void 0:g.userData)?void 0:r.id)||"","-").splice(2).join("-")),this._isInDefs&&this.symbolsMap[null==(a=g.userData)?void 0:a.pid]){const t=g.userData.pid,e=(null==(o=this.symbolsMap[t])?void 0:o.labels)||[];e.push(g),ri.set(this.symbolsMap,`[${t}].labels`,e)}else this.labels.push(g)}c&&(d(c,t,e),this.transformPath(c,this._currentTransform),i.push(c));const p=t.childNodes;for(let t,n=0,r=p.length;n<r;n++)if(t=p[n],!h||"style"===t.nodeName||"symbol"===t.nodeName)if(this._isInDefs&&"symbol"===t.nodeName){const i=t.getAttribute("id");if(i){const n=this.parseNode(t,e);ri.set(this.symbolsMap,`[${i}].paths`,n)}}else this.parseNode(t,e,i,l,s);return u&&(this._transformStack.pop(),this._transformStack.length>0?this._currentTransform.copy(this._transformStack[this._transformStack.length-1]):this._currentTransform.identity()),h&&(this._isInDefs=!1),i}transformPath(t,e){t.applyMatrix3(e)}getNodeTransform(t,e){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))||"text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))))return null;const i=this.parseNodeTransform(t,e);return this._transformStack.length>0&&i.premultiply(this._transformStack[this._transformStack.length-1]),this._currentTransform.copy(i),this._transformStack.push(i),i}parseNodeTransform(t,e,i=new Ui){var n;if(i.identity(),!t)return i;this.centralInitialized&&(i.translate(-this.centralPoint.x,-this.centralPoint.y),this.centralInitialized=!0);const s=Un;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){const e=this.parseFloatWithUnits(t.getAttribute("x")),n=this.parseFloatWithUnits(t.getAttribute("y"));i.translate(e,n)}else if("text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))){const n=t.hasAttribute("dx")?this.parseFloatWithUnits(t.getAttribute("dx")||0,{fontSize:null==e?void 0:e.fontSize}):0,s=t.hasAttribute("dy")?this.parseFloatWithUnits(t.getAttribute("dy")||0,{fontSize:null==e?void 0:e.fontSize}):0;i.translate(n,s)}if(t.hasAttribute("transform")){const e=null==(n=t.getAttribute("transform"))?void 0:n.split(")");if(!(null==e?void 0:e.length))return i;for(let t=((null==e?void 0:e.length)||0)-1;t>=0;t--){const n=e[t].trim();if(""===n)continue;const r=n.indexOf("("),a=n.length;if(r>0&&r<a){const t=n.slice(0,r),e=this.parseFloats(n.slice(r+1));switch(s.identity(),t){case"translate":if(e.length>=1){const t=e[0];let i=0;e.length>=2&&(i=e[1]),s.translate(t,i)}break;case"rotate":if(e.length>=1){let t=0,i=0,n=0;t=e[0]*Math.PI/180,e.length>=3&&(i=e[1],n=e[2]),Vn.makeTranslation(-i,-n),qn.makeRotation(t),jn.multiplyMatrices(qn,Vn),Vn.makeTranslation(i,n),s.multiplyMatrices(Vn,jn)}break;case"scale":if(e.length>=1){const t=e[0];let i=t;e.length>=2&&(i=e[1]),s.scale(t,i)}break;case"skewX":1===e.length&&s.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&s.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&s.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}i.premultiply(s)}}return i}parseStyle(t,e){var i;e=Object.assign({},e);let n={};if(t.hasAttribute("class")){const e=null==(i=t.getAttribute("class"))?void 0:i.split(/\s/).filter(Boolean).map((t=>t.trim())).map((t=>t.startsWith(".")?t.substring(1):t));for(let t=0,i=(null==e?void 0:e.length)||0;t<i;t++)n=Object.assign(n,this.stylesheets["."+e[t]])}function s(i,s,r){void 0===r&&(r=function(t){return t.startsWith("url"),t}),t.hasAttribute(i)&&(e[s]=r(t.getAttribute(i))),n[i]&&(e[s]=r(n[i])),t.style&&""!==t.style[i]&&(e[s]=r(t.style[i]))}t.hasAttribute("id")&&(n=Object.assign(n,this.stylesheets["#"+t.getAttribute("id")]));const{fontSize:r,strokeWidth:a}=e,o=this;function h(t){return Math.max(0,Math.min(1,o.parseFloatWithUnits(t)))}function l(t){return Math.max(0,o.parseFloatWithUnits(t,{fontSize:r}))}s("font-size","fontSize",l),s("fill","fill"),s("fill-opacity","fillOpacity",h),s("fill-rule","fillRule"),s("opacity","opacity",h),s("stroke","stroke"),s("stroke-opacity","strokeOpacity",h),s("stroke-width","strokeWidth",(function(t){return Math.max(0,o.parseFloatWithUnits(t,{strokeWidth:a,noDef:!0}))})),s("stroke-linejoin","strokeLineJoin"),s("stroke-linecap","strokeLineCap"),s("stroke-miterlimit","strokeMiterLimit",l),s("visibility","visibility");const u=t.getAttribute("stroke-width")||e.strokeWidth;return ri.endsWith(u,"%")&&(e.thinLine=!0),"none"!==e.fill&&"transparent"!==e.fill||delete e.fill,"none"!==e.stroke&&"transparent"!==e.stroke||delete e.stroke,e}parseCSSStylesheetByTextContent(t){const e=t.textContent.replace(/\/\*[\s\S]*?\*\//g,"").replace(/([^;])}/g,"$1;}"),i=[];let n="",s=0;for(const t of e)"{"===t?s++:"}"===t&&s--,n+=t,"}"===t&&0===s&&(i.push(n.trim()),n="");for(const t of i){if(!t.includes("{"))continue;const[e,i]=t.split(/\s*\{\s*/);if(!e||!i)continue;const n=e.split(",").map((t=>t.trim())).filter(Boolean),s={};i.replace(/}\s*$/,"").split(";").map((t=>t.trim())).filter(Boolean).forEach((t=>{const[e,i]=t.split(/:\s*/);if(e&&i){const t=i.replace(/\s*!important\s*$/,"").trim();s[e.trim()]=t}})),n.forEach((t=>{t&&(this.stylesheets[t]=l(l({},this.stylesheets[t]||{}),s))}))}}parsePathNode(t,e=!1){const i=t.getAttribute("d");if(i&&""!==i&&"none"!==i)return this.getPathProxyBySvgPathD(i,void 0,e)}getPathProxyBySvgPathD(t,e=new yn,i=!1){if(!t)return;const n=new We,s=new We,r=new We;let a=!0,o=!1;const h=t.match(/[a-df-z][^a-df-z]*/gi);if(null==h?void 0:h.length){for(let t=0,l=(null==h?void 0:h.length)||0;t<l;t++){const l=h[t],u=l.charAt(0),c=l.slice(1).trim();let d;switch(!0===a&&(o=!0,a=!1),u){case"M":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t+=2)n.x=i?d[t]:this.normalizeX(d[t]),n.y=i?d[t+1]:this.normalizeY(d[t+1]),s.x=n.x,s.y=n.y,0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y),0===t&&r.copy(n);break;case"H":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t++)n.x=i?d[t]:this.normalizeX(d[t]),s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===o&&r.copy(n);break;case"V":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t++)n.y=i?d[t]:this.normalizeY(d[t]),s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===o&&r.copy(n);break;case"L":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t+=2)n.x=i?d[t]:this.normalizeX(d[t]),n.y=i?d[t+1]:this.normalizeY(d[t+1]),s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===o&&r.copy(n);break;case"C":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=6)t=i?[d[a],d[a+1],d[a+2],d[a+3],d[a+4],d[a+5]]:[this.normalizeX(d[a]),this.normalizeY(d[a+1]),this.normalizeX(d[a+2]),this.normalizeY(d[a+3]),this.normalizeX(d[a+4]),this.normalizeY(d[a+5])],e.bezierCurveTo(...t),s.x=t[2],s.y=t[3],n.x=t[4],n.y=t[5],0===a&&!0===o&&r.copy(n);break;case"S":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=4)t=i?[d[a],d[a+1],d[a+2],d[a+3]]:[this.normalizeX(d[a]),this.normalizeY(d[a+1]),this.normalizeX(d[a+2]),this.normalizeY(d[a+3])],e.bezierCurveTo(this.getReflection(n.x,s.x),this.getReflection(n.y,s.y),t[0],t[1],t[2],t[3]),s.x=t[0],s.y=t[1],n.x=t[2],n.y=t[3],0===a&&!0===o&&r.copy(n);break;case"Q":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=4)t=i?[d[a],d[a+1],d[a+2],d[a+3]]:[this.normalizeX(d[a]),this.normalizeY(d[a+1]),this.normalizeX(d[a+2]),this.normalizeY(d[a+3])],e.quadraticCurveTo(t[0],t[1],t[2],t[3]),s.x=t[0],s.y=t[1],n.x=t[2],n.y=t[3],0===a&&!0===o&&r.copy(n);break;case"T":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=2){const h=this.getReflection(n.x,s.x),l=this.getReflection(n.y,s.y);t=i?[d[a],d[a+1]]:[this.normalizeX(d[a]),this.normalizeY(d[a+1])],e.quadraticCurveTo(h,l,t[0],t[1]),s.x=h,s.y=l,n.x=t[0],n.y=t[1],0===a&&!0===o&&r.copy(n)}break;case"A":d=this.parseFloats(c,[3,4],7);for(let t,a=0,h=d.length;a<h;a+=7){if(t=i?[d[a],d[a+1],d[a+2],d[a+3],d[a+4],d[a+5],d[a+6]]:[this.normalizeX(d[a]),this.normalizeY(d[a+1]),d[a+2],d[a+3],d[a+4],this.normalizeW(d[a+5]),this.normalizeH(d[a+6])],t[5]==n.x&&t[6]==n.y)continue;const h=n.clone();n.x=t[5],n.y=t[6],s.x=n.x,s.y=n.y,this.parseArcCommand(e,t[a],t[1],t[2],t[3],t[4],h,n),0===a&&!0===o&&r.copy(n)}break;case"m":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t+=2)n.x+=i?d[t]:this.normalizeW(d[t]),n.y+=i?d[t+1]:this.normalizeH(d[t+1]),s.x=n.x,s.y=n.y,0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y),0===t&&r.copy(n);break;case"h":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t++)n.x+=i?d[t]:this.normalizeW(d[t]),s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===o&&r.copy(n);break;case"v":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t++)n.y+=i?d[t]:this.normalizeH(d[t]),s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===o&&r.copy(n);break;case"l":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t+=2)n.x+=i?d[t]:this.normalizeW(d[t]),n.y+=i?d[t+1]:this.normalizeH(d[t+1]),s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===o&&r.copy(n);break;case"c":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=6)t=i?[d[a],d[a+1],d[a+2],d[a+3],d[a+4],d[a+5]]:[this.normalizeW(d[a]),this.normalizeH(d[a+1]),this.normalizeW(d[a+2]),this.normalizeH(d[a+3]),this.normalizeW(d[a+4]),this.normalizeH(d[a+5])],e.bezierCurveTo(n.x+t[0],n.y+t[1],n.x+t[2],n.y+t[3],n.x+t[4],n.y+t[5]),s.x=n.x+t[2],s.y=n.y+t[3],n.x+=t[4],n.y+=t[5],0===a&&!0===o&&r.copy(n);break;case"s":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=4)t=i?[d[a],d[a+1],d[a+2],d[a+3]]:[this.normalizeW(d[a]),this.normalizeH(d[a+1]),this.normalizeW(d[a+2]),this.normalizeH(d[a+3])],e.bezierCurveTo(this.getReflection(n.x,s.x),this.getReflection(n.y,s.y),n.x+t[0],n.y+t[1],n.x+t[2],n.y+t[3]),s.x=n.x+t[0],s.y=n.y+t[1],n.x+=t[2],n.y+=t[3],0===a&&!0===o&&r.copy(n);break;case"q":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=4)t=i?[d[a],d[a+1],d[a+2],d[a+3]]:[this.normalizeW(d[a]),this.normalizeH(d[a+1]),this.normalizeW(d[a+2]),this.normalizeH(d[a+3])],e.quadraticCurveTo(n.x+t[0],n.y+t[1],n.x+t[2],n.y+t[3]),s.x=n.x+t[0],s.y=n.y+t[1],n.x+=t[2],n.y+=t[3],0===a&&!0===o&&r.copy(n);break;case"t":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=2){const h=this.getReflection(n.x,s.x),l=this.getReflection(n.y,s.y);t=i?[d[a],d[a+1]]:[this.normalizeW(d[a]),this.normalizeH(d[a+1])],e.quadraticCurveTo(h,l,n.x+t[0],n.y+t[1]),s.x=h,s.y=l,n.x=n.x+t[0],n.y=n.y+t[1],0===a&&!0===o&&r.copy(n)}break;case"a":d=this.parseFloats(c,[3,4],7);for(let t,a=0,h=d.length;a<h;a+=7){if(t=i?[d[a],d[a+1],d[a+2],d[a+3],d[a+4],d[a+5],d[a+6]]:[this.normalizeW(d[a]),this.normalizeH(d[a+1]),d[a+2],d[a+3],d[a+4],this.normalizeW(d[a+5]),this.normalizeH(d[a+6])],0==t[5]&&0==t[6])continue;const h=n.clone();n.x+=t[5],n.y+=t[6],s.x=n.x,s.y=n.y,this.parseArcCommand(e,t[0],t[1],t[2],t[3],t[4],h,n),0===a&&!0===o&&r.copy(n)}break;case"Z":case"z":e.closePath()}o=!1}return e}}parseArcCommand(t,e,i,n,s,r,a,o){if(0==e||0==i)return void t.lineTo(o.x,o.y);n=n*Math.PI/180,e=Math.abs(e),i=Math.abs(i);const h=(a.x-o.x)/2,l=(a.y-o.y)/2,u=Math.cos(n)*h+Math.sin(n)*l,c=-Math.sin(n)*h+Math.cos(n)*l;let d=e*e,p=i*i;const f=u*u,m=c*c,g=f/d+m/p;if(g>1){const t=Math.sqrt(g);d=(e*=t)*e,p=(i*=t)*i}const y=d*m+p*f,v=(d*p-y)/y;let x=Math.sqrt(Math.max(0,v));s===r&&(x=-x);const b=x*e*c/i,w=-x*i*u/e,_=Math.cos(n)*b-Math.sin(n)*w+(a.x+o.x)/2,S=Math.sin(n)*b+Math.cos(n)*w+(a.y+o.y)/2,E=this.svgAngle(1,0,(u-b)/e,(c-w)/i),M=this.svgAngle((u-b)/e,(c-w)/i,(-u-b)/e,(-c-w)/i)%(2*Math.PI);t.absellipse(_,S,e,i,n,E,E+M,0===r)}svgAngle(t,e,i,n){const s=t*i+e*n,r=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+n*n);let a=Math.acos(Math.max(-1,Math.min(1,s/r)));return t*n-e*i<0&&(a=-a),a}parseRectNode(t,e=!1){let i=this.parseFloatWithUnits(t.getAttribute("x")||0),n=this.parseFloatWithUnits(t.getAttribute("y")||0),s=this.parseFloatWithUnits(t.getAttribute("rx")||t.getAttribute("ry")||0),r=this.parseFloatWithUnits(t.getAttribute("ry")||t.getAttribute("rx")||0),a=this.parseFloatWithUnits(t.getAttribute("width")),o=this.parseFloatWithUnits(t.getAttribute("height"));e||(i=this.normalizeX(i),n=this.normalizeY(n),s=this.normalizeW(s),r=this.normalizeH(r),a=this.normalizeW(a),o=this.normalizeH(o));const h=.448084975506,l=new yn;return l.moveTo(i+s,n),l.lineTo(i+a-s,n),0===s&&0===r||l.bezierCurveTo(i+a-s*h,n,i+a,n+r*h,i+a,n+r),l.lineTo(i+a,n+o-r),0===s&&0===r||l.bezierCurveTo(i+a,n+o-r*h,i+a-s*h,n+o,i+a-s,n+o),l.lineTo(i+s,n+o),0===s&&0===r||l.bezierCurveTo(i+s*h,n+o,i,n+o-r*h,i,n+o-r),l.lineTo(i,n+r),0===s&&0===r||l.bezierCurveTo(i,n+r*h,i+s*h,n,i+s,n),l}parsePolygonNode(t,e=!1){var i;const n=this;const s=new yn;let r=0;return null==(i=t.getAttribute("points"))||i.replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,(function(t,i,a){const o=e?n.parseFloatWithUnits(i):n.normalizeX(n.parseFloatWithUnits(i)),h=e?n.parseFloatWithUnits(a):n.normalizeY(n.parseFloatWithUnits(a));return 0===r?s.moveTo(o,h):s.lineTo(o,h),r++,t})),s.autoClose=!0,s}parsePolylineNode(t,e=!1){var i;const n=this;const s=new yn;let r=0;return null==(i=t.getAttribute("points"))||i.replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,(function(t,i,a){const o=e?n.parseFloatWithUnits(i):n.normalizeX(n.parseFloatWithUnits(i)),h=e?n.parseFloatWithUnits(a):n.normalizeY(n.parseFloatWithUnits(a));return 0===r?s.moveTo(o,h):s.lineTo(o,h),r++,t})),s.autoClose=!1,s}parseCircleNode(t,e=!1){let i=this.parseFloatWithUnits(t.getAttribute("cx")||0),n=this.parseFloatWithUnits(t.getAttribute("cy")||0),s=this.parseFloatWithUnits(t.getAttribute("r")||0);e||(i=this.normalizeX(i),n=this.normalizeY(n),s=this.normalizeW(s));const r=new yn;return r.absarc(i,n,s,0,2*Math.PI),r}parseEllipseNode(t,e=!1){let i=this.parseFloatWithUnits(t.getAttribute("cx")||0),n=this.parseFloatWithUnits(t.getAttribute("cy")||0),s=this.parseFloatWithUnits(t.getAttribute("rx")||0),r=this.parseFloatWithUnits(t.getAttribute("ry")||0);e||(i=this.normalizeX(i),n=this.normalizeY(n),s=this.normalizeW(s),r=this.normalizeH(r));const a=new yn;return a.absellipse(i,n,s,r,0,0,2*Math.PI,!1),a}parseLineNode(t,e=!1){let i=this.parseFloatWithUnits(t.getAttribute("x1")||0),n=this.parseFloatWithUnits(t.getAttribute("y1")||0),s=this.parseFloatWithUnits(t.getAttribute("x2")||0),r=this.parseFloatWithUnits(t.getAttribute("y2")||0);e||(i=this.normalizeX(i),n=this.normalizeY(n),s=this.normalizeX(s),r=this.normalizeY(r));const a=new yn;return a.moveTo(i,n),a.lineTo(s,r),a}parseTextNode(t,e,i=!1){let n=parseFloat(t.getAttribute("x")||"0"),s=parseFloat(t.getAttribute("y")||"0");i||(n=this.normalizeX(n),s=this.normalizeY(s));const r=t.textContent;if(!r||!e.fontSize)return;const a=Object.assign({},e);return a.fill=t.getAttribute("fill")||e.fill||"#000",a.fontSize=parseFloat(t.getAttribute("font-size")||"0")||parseFloat(e.fontSize)||72,a.fontFamily=t.getAttribute("font-family")||e.fontFamily||"Arial",{textContent:r,style:a,userData:{}}}parseFloatWithUnits(t,e){let i,n="px";if("string"==typeof t||t instanceof String){t=null==t?void 0:t.trim();for(let e=0,i=Rn.length;e<i;e++){const i=Rn[e];if(t.endsWith(i)){n=i,t=t.substring(0,t.length-i.length);break}}}if("px"===n&&"px"!==this.defaultUnit)i=zn.in[this.defaultUnit]/this.defaultDPI;else if("%"===n){this._viewBox.getSize(Yn),jn.copy(this._currentTransform).getScale(Gn);const t=Math.abs(Gn.x||1);i=Yn.x/100*t}else"em"===n?i=(null==e?void 0:e.fontSize)||Hn:(i=zn[n][this.defaultUnit],i<0&&(i=zn[n].in*this.defaultDPI));return i*parseFloat(t)}getReflection(t,e){return t-(e-t)}parseFloats(t,e,i){if("string"!=typeof t)throw new TypeError("Invalid input: "+typeof t);const n={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let s=0,r=!0,a="",o="";const h=[];function l(t,e,i){const n=new SyntaxError('Unexpected character "'+t+'" at index '+e+".");throw n.partial=i,n}function u(){""!==a&&(""===o?h.push(Number(a)):h.push(Number(a)*Math.pow(10,Number(o)))),a="",o=""}let c;const d=t.length;for(let p=0;p<d;p++)if(c=t[p],Array.isArray(e)&&e.includes(h.length%(i||0))&&n.FLAGS.test(c))s=1,a=c,u();else{if(0===s){if(n.WHITESPACE.test(c))continue;if(n.DIGIT.test(c)||n.SIGN.test(c)){s=1,a=c;continue}if(n.POINT.test(c)){s=2,a=c;continue}n.COMMA.test(c)&&(r&&l(c,p,h),r=!0)}if(1===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.POINT.test(c)){a+=c,s=2;continue}if(n.EXP.test(c)){s=3;continue}n.SIGN.test(c)&&1===a.length&&n.SIGN.test(a[0])&&l(c,p,h)}if(2===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.EXP.test(c)){s=3;continue}n.POINT.test(c)&&"."===a[a.length-1]&&l(c,p,h)}if(3===s){if(n.DIGIT.test(c)){o+=c;continue}if(n.SIGN.test(c)){if(""===o){o+=c;continue}1===o.length&&n.SIGN.test(o)&&l(c,p,h)}}n.WHITESPACE.test(c)?(u(),s=0,r=!1):n.COMMA.test(c)?(u(),s=0,r=!0):n.SIGN.test(c)?(u(),s=1,a=c):n.POINT.test(c)?(u(),s=2,a=c):l(c,p,h)}return u(),h}normalizeX(t){return this.float2Int?Math.round(t*this.scaleFactor*100)/100:t*this.scaleFactor}normalizeY(t){return this.float2Int?Math.round(t*this.scaleFactor*100)/100:t*this.scaleFactor}normalizeW(t){return this.float2Int?Math.round(t*this.scaleFactor*100)/100:t*this.scaleFactor}normalizeH(t){return this.float2Int?Math.round(t*this.scaleFactor*100)/100:t*this.scaleFactor}getAssetType(t,e="asset"){let i;const n="function"==typeof t.getAttribute?t.getAttribute("id"):"";if(!n&&t.parentNode)return this.getAssetType(t.parentNode,e);if(!n)return i;if("layer"===e)i=Wn.find((t=>n===t));else{const t=null==n?void 0:n.replace(/-assets/g,"");i=this.ASSET_TYPES.find((e=>t===e))}return!i&&t.parentNode&&(i=this.getAssetType(t.parentNode,e)),i}getId(t){let e;const i="function"==typeof t.getAttribute?t.getAttribute("id"):"";return e=!i&&t.parentNode?this.getId(t.parentNode):i,e}getParentId(t,e){let i;const n=this.getId(t);return i=t.parentNode&&this.getId(t.parentNode),i&&n!==e||(i=this.getParentId(t.parentNode,e)),i||(n||"")}getLabelAssetId(t){let e;return this.getId(t),e="function"==typeof t.getAttribute?t.getAttribute("aid"):"",!e&&t.parentNode&&(e=this.getLabelAssetId(t.parentNode)),e}}const On=new Nn,Rn=["mm","cm","in","pt","pc","px","em","%"],zn={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1},"%":{"%":1,px:-1}},Hn=16,Wn=Object.values(Pi),Fn=new Ui,Un=new Ui,Vn=new Ui,qn=new Ui,jn=new Ui,Yn=new We,Gn=new We,$n=new ai;function Xn(t){if(!t)return"inches";let e=t.querySelector("#defaultView"),i=null==e?void 0:e.getAttribute("units");return i||"inches"}function Zn(t,e=new ai){if(!t)return e;let i=t.split(" "),n=ri.map(i,(t=>parseFloat(t)));return 4!==(null==n?void 0:n.length)||(e.min.set(n[0],n[1]),e.max.set(n[0]+n[2],n[1]+n[3])),e}function Jn(t){var e;if(null==(e=null==t?void 0:t.children)?void 0:e.length)for(let e=0,i=t.children.length;e<i;e++)if("g"===t.children[e].nodeName)return t.children[e]}function Qn(t){const e=document.createElementNS("http://www.w3.org/2000/svg","circle");return(null==t?void 0:t.id)&&e.setAttribute("id",t.id),e.setAttribute("cx",((null==t?void 0:t.x)||0).toString()),e.setAttribute("cy",((null==t?void 0:t.y)||0).toString()),e.setAttribute("r",((null==t?void 0:t.r)||1).toString()),(null==t?void 0:t.fill)&&e.setAttribute("fill",t.fill),(null==t?void 0:t.stroke)&&(e.setAttribute("stroke",t.stroke),e.setAttribute("stroke-width",(t.strokeWidth||1).toString())),e}function Kn(t){const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("stroke-linecap","round"),(null==t?void 0:t.id)&&e.setAttribute("id",t.id),(null==t?void 0:t.d)&&e.setAttribute("d",Nn.getSvgPathDByData(t.d)),(null==t?void 0:t.fill)&&e.setAttribute("fill",t.fill),(null==t?void 0:t.stroke)&&(e.setAttribute("stroke",t.stroke),e.setAttribute("stroke-width",(t.strokeWidth||1).toString())),(null==t?void 0:t.strokeDasharray)&&e.setAttribute("stroke-dasharray",t.strokeDasharray),e}function ts(t){var e;const i=document.createElementNS("http://www.w3.org/2000/svg","text");return(null==t?void 0:t.id)&&i.setAttribute("id",t.id),(null==t?void 0:t.fill)&&i.setAttribute("fill",t.fill),(null==t?void 0:t.stroke)&&(i.setAttribute("stroke",t.stroke),i.setAttribute("stroke-width",(t.strokeWidth||1).toString())),i.textContent=t.textContent,(null==t?void 0:t.fontSize)&&i.setAttribute("font-size",null==(e=null==t?void 0:t.fontSize)?void 0:e.toString()),i.setAttribute("text-anchor",(null==t?void 0:t.textAnchor)||"middle"),i.setAttribute("text-baseline",(null==t?void 0:t.textBaseline)||"middle"),i}function es(t,e,i,n){t&&(e||i||n)&&(Nn.parseNodeTransform(t,hs),hs.decompose(ss,rs,as),os.compose(e||ss,i||rs,n||as),null==t||t.setAttribute("transform",os.getTransformString()))}function is(t){const e=document.createElementNS("http://www.w3.org/2000/svg","g");return t&&e.setAttribute("id",t),e}function ns(t,e){t&&e&&es(t,e)}const ss=new We,rs=new We,as=new We,os=new Ui,hs=new Ui,ls=(new yi).start();class us extends Fi{constructor(t){super(),c(this,"isSvgRenderer",!0),c(this,"id"),c(this,"params"),c(this,"container",Ae.window.document.getElementsByTagName("body")[0]),c(this,"cameraVersion",-1),c(this,"viewAreaLimit",-1),c(this,"autoClear"),this.id="SvgRenderer@"+Date.now(),this.params=t,Ae.config=t,this.initSvg(),yi.active(this.params.monitorDuration)}destroy(){yi.active(0)}initSvg(){if(this.params.containerId&&(this.container=Ae.window.document.getElementById(this.params.containerId)),this.container||(this.container=Ae.window.document.getElementsByTagName("body")[0]),!this.params.width||!this.params.height){const t=this.container.getBoundingClientRect();this.params.width=t.width,this.params.height=t.height}this.container.style.overflow="hidden",this.container.style.transform="translateZ(0)",this.setSize(this.params.width,this.params.height)}resize(){var t,e;const i=(null==(t=this.container)?void 0:t.parentElement)||document.body,n=i.getBoundingClientRect();if(!n)return;const s=window.getComputedStyle(i),r=n.width-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight),a=n.height-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom),o=null==(e=this.container)?void 0:e.getBoundingClientRect();if(!o)return;const h=r-o.left+n.left,l=a-o.top+n.top;this.setSize(h,l)}setSize(t,e){this.container.style.width=t+"px",this.container.style.height=e+"px",this.params.width=t,this.params.height=e,this.params.camera||(this.params.camera={}),this.params.camera.width=this.params.width,this.params.camera.height=this.params.height,this.params.aspect=this.params.width/this.params.height,this.params.camera.aspect=this.params.aspect,this.params.camera.left=-.5*this.params.width,this.params.camera.right=.5*this.params.width,this.params.camera.top=.5*this.params.height,this.params.camera.bottom=-.5*this.params.height}getSize(t){return t.set(this.params.width,this.params.height)}clean(){}render(t,e){return d(this,null,(function*(){var i;if(!t||!e)return;if(this.cameraVersion===(null==e?void 0:e.version))return;e.updateMatrixWorld(),ds.set(0,0).unproject(e),ps.set(this.params.width,this.params.height).unproject(e),cs.setFromPoints([ds,ps]);let n=function(t=new ai){let e="";const i=[];return i.push(t.min.x),i.push(t.min.y),i.push(Math.abs(t.max.x-t.min.x)),i.push(Math.abs(t.max.y-t.min.y)),e=i.join(" "),e}(cs);null==(i=t.svg)||i.setAttribute("viewBox",n),this.cameraVersion=e.version||-1,ls.addTimer("render cycle")}))}getRenderTarget(){}setRenderTarget(t){}renderTexture(t,e){}}const cs=new ai,ds=new We,ps=new We,fs=["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"],ms=()=>{const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(fs[255&t]+fs[t>>8&255]+fs[t>>16&255]+fs[t>>24&255]+"-"+fs[255&e]+fs[e>>8&255]+"-"+fs[e>>16&15|64]+fs[e>>24&255]+"-"+fs[63&i|128]+fs[i>>8&255]+"-"+fs[i>>16&255]+fs[i>>24&255]+fs[255&n]+fs[n>>8&255]+fs[n>>16&255]+fs[n>>24&255]).toLowerCase()};class gs extends Fi{constructor(t={}){super(),c(this,"isObject2",!0),c(this,"id",ys++),c(this,"uuid",ms()),c(this,"name"),c(this,"type","Object2"),c(this,"featureKey","Object2_"+this.id),c(this,"parent"),c(this,"children",[]),c(this,"up",new We(0,1)),c(this,"position",new We),c(this,"rotation",new We),c(this,"scaled",new We(1,1)),c(this,"flipY",!1),c(this,"selectable",!1),c(this,"matrix",new Ui),c(this,"matrixWorld",new Ui),c(this,"matrixWorldInverse",new Ui),c(this,"modelViewMatrix",new Ui),c(this,"normalMatrix",new Ui),c(this,"fixed",!1),c(this,"dynamically",!1),c(this,"matrixAutoUpdate",!1),c(this,"matrixWorldNeedsUpdate",!1),c(this,"matrixWorldAutoUpdate",!1),c(this,"composeNode",!1),c(this,"isInComposeNode",!1),c(this,"alignCenter",!1),c(this,"boundingBox",new ai),c(this,"boundingBoxWorld",new ai),c(this,"boundingBoxNeedsUpdate",!1),c(this,"centerPoint",new We),c(this,"visible",!0),c(this,"castShadow",!1),c(this,"receiveShadow",!1),c(this,"renderOrder",0),c(this,"animations",[]),c(this,"finalSize"),c(this,"userData",{}),c(this,"DefaultUp",new We(0,1)),c(this,"_autoSort",!0),c(this,"_version",0),void 0!==t.name?this.name=t.name:this.name="Object2",void 0!==t.flipY&&(this.flipY=t.flipY),void 0!==t.selectable&&(this.selectable=t.selectable),void 0!==t.finalSize&&(this.finalSize=t.finalSize),this.setAttrs(t)}get version(){return this._version}set version(t){this._version=t}set needsUpdate(t){t&&this._version++}destroy(){super.destroy(),this.clear(),this.removeFromParent(),this.dispatchEvent(Ts)}setVisible(t){return this.visible=t,this}setPosition(t){return this.position.set(t.x,t.y),this}translate(t,e){this.position.x+=t,this.position.y+=e}setScale(t,e){return this.scaled.set(t,e),this}setRotationFromMatrix(t){t.decompose(_s,this.rotation,Ss)}setRotation(t){return this.rotation.set(t,t),this}rotate(t){this.rotation.x+=t}scale(t,e){e?(this.scaled.x*=t,this.scaled.y*=e):this.scaled.multiplyScalar(t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix3(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix3(xs.copy(this.matrixWorld).invert())}lookAt(t){bs.copy(t),this.updateWorldMatrix(!0,!1),this.matrixWorld.getTransition(_s),xs.lookAt(_s,bs,Ms),xs.getRotation(Es),this.rotation.set(Es.x,Es.x),this.parent&&(this.parent.matrixWorld.getRotation(Es),this.rotate(Es.x))}applyMatrix3(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.rotation,this.scaled)}updateMatrix(){vs.copy(this.scaled),this.flipY&&(vs.y*=-1),this.matrix.compose(this.position,this.rotation,vs),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent?this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldInverse.copy(this.matrixWorld).invert(),this.matrixWorldNeedsUpdate=!1,t=!0,this.boundingBoxNeedsUpdate=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t);this.boundingBoxNeedsUpdate&&(this.updateBoundingBox(),this.boundingBoxNeedsUpdate=!1)}updateWorldMatrix(t=!1,e=!1){const i=this.parent;if(t&&i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent?this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldInverse.copy(this.matrixWorld).invert(),e){const t=this.children;for(let e=0,i=t.length;e<i;e++)t[e].updateWorldMatrix(!1,!0)}}updateModelViewMatrix(t){xs.copy(this.matrixWorld),t&&this.fixed?this.modelViewMatrix.copy(t.projectionMatrix):t?this.modelViewMatrix.multiplyMatrices(t.viewMatrix,xs):this.modelViewMatrix.copy(xs);for(let e=0,i=this.children.length;e<i;e++)this.children[e].updateModelViewMatrix(t)}computeBoundingBox(){this.boundingBox.makeEmpty(),this.centerPoint.set(0,0);for(let t=0,e=this.children.length;t<e;t++)this.children[t].updateMatrixWorld(),ws.copy(this.children[t].computeBoundingBox()),ws.applyMatrix3(xs.copy(this.children[t].matrixWorld)),this.boundingBox.union(ws);return this.boundingBox.applyMatrix3(this.matrixWorldInverse),this.boundingBox}updateBoundingBox(){this.boundingBox.isEmpty()||this.boundingBoxWorld.copy(this.boundingBox).applyMatrix3(this.matrixWorld)}setAttrs(t){if(!t)return this;for(const e in t)"children"!==e&&void 0!==t[e]&&("userData"===e&&t[e]?Object.keys(t[e]).forEach((i=>this.userData[i]=t[e][i])):this.userData[e]=t[e]);return this}add(t){return t&&t.isObject2&&t!==this?(t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.isInComposeNode=this.composeNode||this.isInComposeNode,t.selectable&&t.parent.setSelectable(t.selectable),this._autoSort&&this.children.sort(((t,e)=>t.renderOrder-e.renderOrder)),t.dispatchEvent(As),this.matrixAutoUpdate||(this.matrixWorldNeedsUpdate=!0),this.visible&&(this.needsUpdate=!0),this):this}adds(t){if(!t||!t.length)return this;this._autoSort=!1;for(let e=0,i=t.length;e<i;e++)e===t.length-1&&(this._autoSort=!0),this.add(t[e]);return this}remove(t){const e=this.children.indexOf(t);return-1!==e&&(t.parent=void 0,this.children.splice(e,1),t.dispatchEvent(Ts)),this}removes(t){for(let e=0,i=t.length;e<i;e++)this.remove(t[e]);return this}removeFromParent(){const t=this.parent;return t&&t.remove(this),this.parent=void 0,this}moveToLast(){const t=this.parent;t&&(this.removeFromParent(),t.add(this))}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=void 0,e.destroy(),e.dispatchEvent(Ts)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),xs.copy(this.matrixWorld).invert(),t.parent&&(t.parent.updateWorldMatrix(!0,!1),xs.multiply(t.parent.matrixWorld)),t.applyMatrix3(xs),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(t,Es,Ss),t}getWorldRotation(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_s,t,Ss),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_s,Es,t),t}getWorldDirection(t){return this.updateWorldMatrix(!0,!1),t.set(this.matrixWorld.elements[6],this.matrixWorld.elements[7]).normalize()}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;e&&(t(e),e.traverseAncestors(t))}traverseSome(t){if(t(this))return!0;const e=this.children;for(let i=0,n=e.length;i<n;i++)if(e[i].traverseSome(t))return!0;return!1}onBeforeRender(t,e,i,n){}render(t){}onAfterRender(t,e,i){}setSelectable(t){this.selectable=t,this.parent&&this.parent.setSelectable(t)}raycast(t,e=[]){}getByRange(t,e=!1,i=[]){if(ws.copy(t),ws.containsBox(this.boundingBoxWorld)&&i.push(this),!e||this.composeNode)return i;for(let n=0,s=this.children.length;n<s;n++)this.children[n].getByRange(t,e,i);return i}clone(t=!0,e=!1){return new(0,this.constructor)(this.userData).copy(this,t,e)}copy(t,e=!0,i=!1){if(this.name=t.name,this.type=t.type,this.featureKey=t.featureKey,this._version=0,this.parent=t.parent,this.up.copy(t.up),this.position.copy(t.position),this.rotation.copy(t.rotation),this.scaled.copy(t.scaled),this.flipY=t.flipY,this.selectable=t.selectable,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.modelViewMatrix.copy(t.modelViewMatrix),this.normalMatrix.copy(t.normalMatrix),this.fixed=t.fixed,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.composeNode=t.composeNode,this.alignCenter=t.alignCenter,this.boundingBox.copy(t.boundingBox),this.boundingBoxWorld.copy(t.boundingBoxWorld),this.boundingBoxNeedsUpdate=t.boundingBoxNeedsUpdate,this.centerPoint.copy(t.centerPoint),this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e)for(let n=0;n<t.children.length;n++){const s=t.children[n];this.add(s.clone(e,i))}return this}}let ys=0;const vs=new We,xs=new Ui,bs=new We,ws=new ai,_s=new We,Ss=new We,Es=new We,Ms=new We(0,1),As={type:"added"},Ts={type:"removed"};class Cs extends gs{constructor(){super(),c(this,"name","Scene"),c(this,"type","Scene"),c(this,"isScene",!0),c(this,"view"),c(this,"background"),c(this,"featureKey","Scene_"+this.id),c(this,"matrixAutoUpdate",!1)}destroy(){super.destroy(),this.boundingBox.makeEmpty()}setup(t){this.view=t}render(t){var e;this.visible&&(null==(e=this.children)||e.forEach((function(e){e.isShape&&e.render(t)})))}getIntersectObjects(t,e=Li.RM,i=[]){throw new Error("must be implemented in derived")}getByIds(t,e=[]){return e.length=0,t?(this.traverse((function(i){var n,s;(null==(n=i.userData)?void 0:n.id)&&(Array.isArray(t)&&t.includes(null==(s=i.userData)?void 0:s.id)||i.userData.id===t)&&e.push(i)})),e):e}}const Is={enabled:!1,files:{},add:function(t,e){this.enabled&&(this.files[t]=e)},get:function(t){if(this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},Ds=new class{constructor(t,e,i){c(this,"isLoading",!1),c(this,"itemsLoaded",0),c(this,"itemsTotal",0),c(this,"urlModifier"),c(this,"handlers",[]),c(this,"onStart"),c(this,"onLoad"),c(this,"onProgress"),c(this,"onError"),this.onLoad=t,this.onProgress=e,this.onError=i}itemStart(t){this.itemsTotal++,this.isLoading||void 0!==this.onStart&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(t){this.itemsLoaded++,void 0!==this.onProgress&&this.onProgress(t,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,void 0!==this.onLoad&&this.onLoad())}itemError(t){void 0!==this.onError&&this.onError(t)}resolveURL(t){return void 0!==this.urlModifier?this.urlModifier(t):t}setURLModifier(t){return this.urlModifier=t,this}addHandler(t,e){return this.handlers.push(t,e),this}removeHandler(t){const e=this.handlers.indexOf(t);return-1!==e&&this.handlers.splice(e,2),this}getHandler(t){for(let e=0,i=this.handlers.length;e<i;e+=2){const i=this.handlers[e],n=this.handlers[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}};let Ls=class{constructor(t=Ds){c(this,"manager"),c(this,"crossOrigin","anonymous"),c(this,"withCredentials",!1),c(this,"path",""),c(this,"resourcePath",""),c(this,"requestHeader",{}),this.manager=t}loadAsync(t,e){const i=this;return new Promise((function(n,s){i.load(t,n,e,s)}))}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};const Bs={};let Ps=class extends Error{constructor(t,e){super(t),c(this,"response"),this.response=e}},ks=class extends Ls{constructor(t){super(t),c(this,"mimeType"),c(this,"responseType")}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const s=Is.get(t);if(void 0!==s)return this.manager.itemStart(t),setTimeout((()=>{e&&e(s),this.manager.itemEnd(t)}),0),s;if(void 0!==Bs[t])return void Bs[t].push({onLoad:e,onProgress:i,onError:n});Bs[t]=[],Bs[t].push({onLoad:e,onProgress:i,onError:n});const r=new Ae.window.Request(t,{headers:new Ae.window.Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(r).then((e=>{if(200===e.status||0===e.status){if(e.status,"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=Bs[t],n=e.body.getReader(),s=e.headers.get("Content-Length")||e.headers.get("X-File-Size"),r=s?parseInt(s):0,a=0!==r;let o=0;const h=new ReadableStream({start(t){!function e(){n.read().then((({done:n,value:s})=>{if(n)t.close();else{o+=s.byteLength;const n=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:r});for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onProgress&&e.onProgress(n)}t.enqueue(s),e()}}))}()}});return new Response(h)}throw new Ps(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(void 0===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),i=e&&e[1]?e[1].toLowerCase():void 0,n=new TextDecoder(i);return t.arrayBuffer().then((t=>n.decode(t)))}}})).then((e=>{Is.add(t,e);const i=Bs[t];delete Bs[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onLoad&&n.onLoad(e)}})).catch((e=>{const i=Bs[t];if(void 0===i)throw this.manager.itemError(t),e;delete Bs[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setMimeType(t){return this.mimeType=t,this}setResponseType(t){return this.responseType=t,this}};class Ns extends Ls{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new ks(s.manager);r.setPath(s.path),r.setRequestHeader(s.requestHeader),r.setWithCredentials(s.withCredentials),r.load(t,(function(i){try{e&&e(i)}catch(e){n&&n(e),s.manager.itemError(t)}}),i,n)}}class Os{constructor(){c(this,"svg"),c(this,"offset",new We),c(this,"svgRoot"),c(this,"layers",[]),c(this,"elementsMap",{}),c(this,"boundingBoxMap",{}),c(this,"boundingBox",new ai),c(this,"svgSkeletons",[]),c(this,"_exceptTypes",["view"]),c(this,"_exceptIds",["viewer","mirror"]),c(this,"_lvi",0),c(this,"_lastLinked",[])}bindSvg(t){return this.svg=t,this.svgRoot=Jn(this.svg),this.layers=this.getLayers(2),this.elementsMap={},this.boundingBoxMap={},this.boundingBox.makeEmpty(),this.getElementsMap(this.svg,this.elementsMap),this}getLayers(t){var e;if(!this.svg)throw new Error("please bind svg first");return 2===t&&(null==(e=this.layers)?void 0:e.length)||(this.layers=this._getSvgLayer(this.svg,t)),this.layers}_getSvgLayer(t,e=0,i=0,n=[]){var s;let r,a=t.id;if(this._exceptTypes.includes(t.tagName)||"defs"===t.tagName)return this._lvi--,n;if(e&&this._lvi>e)return n;a&&!this._exceptIds.includes(a)&&(r={value:a,label:a,children:[]},n.push(r)),this._lvi++;for(let i=0,s=t.children.length;i<s;i++)r?this._getSvgLayer(t.children[i],e,this._lvi,r.children):this._getSvgLayer(t.children[i],e,this._lvi,n);return 0===(null==(s=null==r?void 0:r.children)?void 0:s.length)&&delete r.children,this._lvi=i,n}getElementsMap(t,e={}){return this.traverseSvg(t,(i=>{i!==t&&i.id&&(e[i.id]=i)})),e}computeBoundingBoxMap(){var t;if(Object.keys(this.boundingBoxMap).length)return this.boundingBoxMap;let e=null==(t=this.svg)?void 0:t.getBoundingClientRect();return e&&this.offset.set(e.left,e.top),this.traverseSvg(this.svg,(t=>{if(!t.id)return;if("use"===t.tagName){const e=this.getUseSymbolId(t);if(!e)return;const i=this.boundingBoxMap[e];if(i&&!i.isEmpty()){zs.set(Number(t.getAttribute("x")||"0"),Number(t.getAttribute("y")||"0")),Hs.composeSvgTransform(zs.x,zs.y,t.getAttribute("transform"));const e=(new ai).copy(i).applyMatrix3(Hs);return void(this.boundingBoxMap[t.id]=e)}const n=this.getUseElementBoundingBoxWithSymbol(t);if(!n)return;this.boundingBoxMap[e]=n,zs.set(Number(t.getAttribute("x")||"0"),Number(t.getAttribute("y")||"0")),Hs.composeSvgTransform(zs.x,zs.y,t.getAttribute("transform"));const s=(new ai).copy(n).applyMatrix3(Hs);return this.boundingBoxMap[t.id]=s,void this.boundingBox.expandByBox(s)}if("function"!=typeof t.getBBox)return;const e=t.getBBox();if(e.width&&e.height||"path"!==t.tagName||(Nn.getBoundingBoxByNode(t,Rs),Rs.isEmpty()||(Rs.getSize(zs),e.x=Rs.min.x,e.y=Rs.max.y,e.width=zs.x,e.height=zs.y)),!e.width||!e.height)return;const i=new ai(new We(e.x,e.y),new We(e.x+e.width,e.y+e.height));this.boundingBoxMap[t.id]=i.round(),this.boundingBox.expandByBox(i)})),this.boundingBoxMap}getLayerVisible(t){var e;const i=this.getElementById(t);if(i)return"none"!==(null==(e=i.style)?void 0:e.display)}updateLayersVisibility(t,e=!1,i=!0){if(!this.elementsMap)throw new Error("please bind svg first");i&&this._updateAllLayersVisibility(!e),(null==t?void 0:t.length)||(t=["background"]);for(let i=0,n=t.length;i<n;i++){const n=this.getElementById(t[i]);n&&this._updateLayersVisibility(n,e,!0,!0)}}_updateAllLayersVisibility(t=!1){Object.values(this.elementsMap).forEach((e=>{"svg"!==e.tagName&&"symbol"!==e.tagName&&e.getAttribute("id")&&(e.style.display=t?"block":"none")}))}_updateLayersVisibility(t,e=!1,i=!1,n=!1){var s,r;if(t&&"svg"!==t.tagName&&t.getAttribute("id")){if(t.style.display=e?"block":"none",i&&e){let i=t.parentElement;for(;i&&"svg"!==i.tagName;)i.style.display=e?"block":"none",i=i.parentElement}if(n&&(null==(s=t.children)?void 0:s.length)>0)for(let i=0,n=null==(r=t.children)?void 0:r.length;i<n;i++)this._updateLayersVisibility(t.children[i],e,!1,!0)}}updateVisibilityByAssetType(t,e=!1,i){i||(i=Wi[t]),this.updateLayersVisibility(i,!e)}updateVisibilityByAssetTypes(t,e=!1,i){if(Array.isArray(t)||(t=[t]),null==t?void 0:t.length)for(let n=0,s=t.length;n<s;n++)this.updateVisibilityByAssetType(t[n],e,i)}getElementById(t){if(!this.elementsMap)throw new Error("please bind svg first");return this.elementsMap[t]}getElementBoundingBox(t){return this.boundingBoxMap[t]}findSkeletonByPath(t=[]){let e,i=0;const n=Object.keys(this.elementsMap);for(let t=0,s=n.length;t<s;t++){const s=this.elementsMap[n[t]];if(!s)continue;const r=s.getAttribute("d");r&&(r.length<i||(i=r.length,e=s.id?s:s.parent))}return e?(t.push(e),t):t}setTextInChildren2(t,e){var i;let n;(null==(i=null==t?void 0:t.children)?void 0:i.length)<2?(n=Ai("text"),n.setAttribute("dy","1em"),t.appendChild(n)):n=t.children[t.children.length-1],n.innerHTML=e}traverseSvg(t,e){var i;if(!this._exceptTypes.includes(t.tagName)&&("svg"===t.tagName||"defs"===t.tagName||t.id)&&("g"!==t.tagName||0!==(null==(i=t.children)?void 0:i.length))){this._exceptIds.includes(t.id)||e(t);for(let i=0,n=t.children.length;i<n;i++)this.traverseSvg(t.children[i],e)}}traverseSvgTLayers(t,e){var i;if(Array.isArray(t))for(let i=0,n=t.length;i<n;i++)this.traverseSvgTLayers(t[i],e);else if(e(t),null==(i=t.children)?void 0:i.length)for(let i=0,n=t.children.length;i<n;i++)this.traverseSvgTLayers(t.children[i],e)}getLabelElementsByType(t,e={}){const i=this.getElementById(Hi(t));return i?(this.getElementsMap(i,e),e):e}getLabelElementById(t,e="rm"){if(!t)return;const i=this.getElementById(t);if(!i)return;let n=i.getAttribute("aid");return n||(n="l-"+e+"-"+t),this.getElementById(n)}setLabelsById(t,e,i="rm"){var n,s;const r=this.getLabelElementById(t,i);if(!r)return;const a=(null==(n=r.children)?void 0:n.length)||0;for(let t=0,i=((null==e?void 0:e.length)||0)-(a-1);t<i;t++){const e=Ai("text");e.setAttribute("x","0"),e.setAttribute("y",a+t+"em"),r.appendChild(e)}for(let t=1,i=null==(s=r.children)?void 0:s.length;t<i;t++)r.children[t].textContent=e&&t<=e.length?e[t-1]:""}clearAssetLabelsByType(t="rm"){var e;const i=this.getLabelElementsByType(t),n=ri.keys(i);for(let t=0,s=n.length;t<s;t++){const s=i[n[t]];for(let t=1,i=(null==(e=s.children)?void 0:e.length)||0;t<i;t++)s.children[t].textContent=""}}getUseSymbolId(t){var e;if(t&&"use"===t.tagName)return null==(e=t.getAttribute("xlink:href"))?void 0:e.substring(1)}getUseSymbol(t){if(!t||"use"!==t.tagName)return;const e=this.getUseSymbolId(t);return e?this.getElementById(e):void 0}setElementState2selected(t,e=!1){var i;if(!t)return;if("use"===t.tagName){const n=this._getSymbolBox(t);if(!n)return;return void(e?null==(i=t.parentNode)||i.insertBefore(n,t):t.parentNode&&t.parentNode.contains(n)&&t.parentNode.removeChild(n))}let n=t.getAttribute("class");n||(n=""),n=e?"danger":ri.replace(n,"danger","").trim(),t.setAttribute("class",n)}_getSymbolBox(t){if(!t)return;const e=t.id+"-boundingBox";let i=this.getElementById(e);if(i)return i;const n=this.getUseSymbol(t);if(!n)return;let s=this.getElementBoundingBox(t.id);if(!s||s.isEmpty())return;i=document.createElementNS("http://www.w3.org/2000/svg","rect"),i.setAttribute("id",e),i.setAttribute("class","danger"),i.setAttribute("x",s.min.x.toString()),i.setAttribute("y",s.min.y.toString());const r=new We;return s.getSize(r),i.setAttribute("width",r.x.toString()),i.setAttribute("height",r.y.toString()),n.getAttribute("transform")&&i.setAttribute("transform",n.getAttribute("transform")||""),n.getAttribute("style")&&i.setAttribute("style",n.getAttribute("style")||""),this.elementsMap[e]=i,i}getUseElementBoundingBoxWithSymbol(t){var e;if(!t)return;const i=null==(e=t.getAttribute("xlink:href"))?void 0:e.substring(1);if(!i)return;let n=this.getElementById(i);if(!n)return;const s=document.createElementNS("http://www.w3.org/2000/svg","svg");let r;if(s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px","symbol"===ri.lowerCase(n.tagName)){r=document.createElementNS("http://www.w3.org/2000/svg","g");for(let t=0,e=n.childNodes.length;t<e;t++){const e=n.childNodes[t].cloneNode(!0);r.appendChild(e)}}else r=n.cloneNode(!0);s.appendChild(r),r.setAttribute("style","stroke: #333333;"),document.body.appendChild(s);const a=s.getBBox();if(document.body.removeChild(s),!a)return;const o=new ai;return o.set(new We(a.x,a.y),new We(a.x+a.width,a.y+a.height)),o}fontZoom(t,e=1){const i=this.getElementById(t);if(!i)return;let n=i.getAttribute("font-size");n||(n="12");const s=/(\d+)([a-zA-Z%]+)/.exec(n),r=s&&(null==s?void 0:s.length)>2?s[2]:"";let a=Math.round(parseFloat(n)*e*100)/100;i.setAttribute("font-size",a+r)}strokeWidthChanged(t=1){var e,i;const n=null==(e=this.svg)?void 0:e.querySelector("#mirror");if(!n)return;let s=null!=(i=hn(n,"stroke-width"))?i:"1em";const r=String(s).match(/^([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(%|[a-z]*)$/i);if(!r)return;const a=parseFloat(r[1]),o=r[2]||"em",h=a*t,l=Number.isInteger(h)?h.toFixed(0):h.toString().replace(/\.?0+$/,"");n.setAttribute("stroke-width",`${l}${o}`),"em"===o&&(this.fontZoom("background-labels",1),this.fontZoom("asset-labels",1),n.style.fontSize=`${l}${o}`)}getCentroid(t,e=new We){const i=t.getAttribute("insX"),n=t.getAttribute("insY");return i||n?e.set(Number(i||"0"),Number(n||"0")):this.getCentroidByDom(t,e)}getCentroidByDom(t,e=new We){const i=Number(t.getAttribute("x")||"0"),n=Number(t.getAttribute("y")||"0"),s=t.getBBox();let r=1,a=1,o=t.getAttribute("transform");if(!o)return e.set(i,n);const h=/scale\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(o);if(void 0===h||null==h){const i=t.transform.baseVal;if(!(o&&i.numberOfItems>0))return e.set((s.x+s.width/2)*r,(s.y+s.height/2)*a);{let t=i.getItem(0);t&&t.type===SVGTransform.SVG_TRANSFORM_SCALE&&(r=0!==t.matrix.a?t.matrix.a:1,a=0!==t.matrix.d?t.matrix.d:r)}}else r=h[1]&&Number(h[1])>0?Number(h[1]):1,a=h[2]&&Number(h[2])>0?Number(h[2]):r;return i&&n?e.set(i*r,n*a):e.set((s.x+s.width/2)*r,(s.y+s.height/2)*a),e}linkAssetsByTree(t,e){if(t||(t=Li.RM),this.clearLinkedLines(t),!e||!e.value)return;const i=this.getLinesByTree(e);this.drawLinkedLines(t,i)}clearLinkedLines(t){var e;const i=zi(t);if(this.getElementById(i)){for(let t=(null==(e=this._lastLinked)?void 0:e.length)-1;t>=0;t--){const e=this._lastLinked[t];e.parentNode&&e.parentNode.removeChild(e),this._lastLinked.splice(t,1)}this._lastLinked.length=0}}drawLinkedLines(t,e){var i;if(!(null==e?void 0:e.length))return;const n=zi(t),s=this.getElementById(n);if(s)for(let t=0,n=e.length;t<n;t++){const n=e[t][0],r=e[t][(null==(i=e[t])?void 0:i.length)-1],a=Ai("line");a.setAttribute("x1",n.x.toString()),a.setAttribute("y1",n.y.toString()),a.setAttribute("x2",r.x.toString()),a.setAttribute("y2",r.y.toString()),a.setAttribute("class","danger"),a.setAttribute("style","stroke-width: 2;"),s.appendChild(a),this._lastLinked.push(a)}}getLinesByTree(t,e=[]){var i;if(!(null==t?void 0:t.value))return e;const n=this.getElementBoundingBox(t.value);if(!n)return e;const s=n.getCenter();return null==(i=t.children)||i.forEach((t=>{var i;const n=this.getElementBoundingBox(null==t?void 0:t.value);if(!n)return;const r=n.getCenter();e.push([s,r]),(null==(i=t.children)?void 0:i.length)&&this.getLinesByTree(t,e)})),e}}const Rs=new ai,zs=new We,Hs=new Ui;class Ws{constructor(t={},e){c(this,"name","SvgPainter"),c(this,"params"),c(this,"chef"),this.params=t,this.chef=e}drawSocialDistanceCircles(t,e="http://www.w3.org/2000/svg"){var i,n,s;if(!t)return;const r=function(t){if(!t)return 1;let e=1;switch(Xn(t)){case"mm":e=500/39.3701;break;case"cm":e=50/39.3701;break;case"Metres":case"m":e=.5/39.3701;break;default:e=1}return e}(t),a=Xn(t),o=2*r,h=(null==(n=null==(i=this.params.socialDistance)?void 0:i.colors)?void 0:n.length)?null==(s=this.params.socialDistance)?void 0:s.colors:[Le.green,Le.red],l=this.getRadius(a),u=t.querySelector(`#${Ni}`),c=null==u?void 0:u.querySelectorAll("path");if(!u||!(null==c?void 0:c.length))return;let d,p;const f=new Array;for(let t=0,e=(null==c?void 0:c.length)||0;t<e;t++){if(d=c[t],p=d.getAttribute("id"),!p)continue;const e=this.chef.getElementBoundingBox(p);if(!e)continue;const i=new We;e.getCenter(i),f.push({id:p,cp:i})}for(let t=0,e=f.length;t<e;t++){f[t].color=h[0];for(let i=0,n=e;i<n;i++)f[t]!==f[i]&&We.getDistance(f[t].cp,f[i].cp)<2*l&&(f[t].color=h[1])}for(let t=0,i=f.length;t<i;t++){let i=this.createCircle(f[t],l,o,e);u.appendChild(i)}}clearSocialDistanceCircles(t){if(!t)return;const e=t.querySelector(`#${Ni}`),i=null==e?void 0:e.querySelectorAll("circle");if(e&&(null==i?void 0:i.length))for(let t=0,n=(null==i?void 0:i.length)||0;t<n;t++){const n=i[t].getAttribute("id");n&&((null==n?void 0:n.indexOf("_circle"))>-1&&e.removeChild(i[t]))}}getRadius(t){var e,i,n;let s=(null==(i=null==(e=this.params)?void 0:e.socialDistance)?void 0:i.radius)||3;return"imperial"===(null==(n=this.params)?void 0:n.displayUnits)?"Metres"===t||"m"===t?s/=3.28084:"cm"===t?s=s/3.28084*100:"mm"===t?s=s/3.28084*1e3:"INCH"!==t&&"inches"!==t||(s*=12):"INCH"===t||"inches"===t?s=3.28084*s*12:"cm"===t?s*=100:"mm"===t&&(s*=1e3),s}createCircle(t,e,i,n){const s=document.createElementNS(n,"circle");return s.setAttributeNS(null,"id",t.id+"_circle"),s.setAttributeNS(null,"cx",t.cp.x),s.setAttributeNS(null,"cy",t.cp.y),s.setAttributeNS(null,"r",String(e)),s.setAttributeNS(null,"style",`pointer-events:none;fill-opacity:0.1;stroke:${t.color};stroke-width:${i}px;`),s}}function Fs(t,e){if(!t||!e)return!1;if(-1!==e.indexOf(" "))throw new Error("className should not contain space.");return t.classList?t.classList.contains(e):(" "+t.className+" ").indexOf(" "+e+" ")>-1}function Us(t,e){if(!t)return;let i=t.className;const n=(e||"").split(" ");for(let e=0,s=n.length;e<s;e++){const s=n[e];s&&(t.classList?t.classList.add(s):Fs(t,s)||(i+=" "+s))}t.classList||(t.className=i)}function Vs(t,e){if(!t||!e)return;const i=e.split(" ");let n=" "+t.className+" ";for(let e=0,s=i.length;e<s;e++){const s=i[e];s&&(t.classList?t.classList.remove(s):Fs(t,s)&&(n=n.replace(" "+s+" "," ")))}t.classList||(t.className=(n||"").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,""))}class qs extends Cs{constructor(t={}){super(),c(this,"isSvgScene",!0),c(this,"name","SvgScene"),c(this,"dynamically",!0),c(this,"params"),c(this,"socialDistanceEnable",!1),c(this,"container"),c(this,"svg"),c(this,"svgStr",""),c(this,"svgRoot"),c(this,"viewBox",new ai),c(this,"viewUnits"),c(this,"chef"),c(this,"defaultLayers",[]),c(this,"skeletonLayers",[]),c(this,"currentLayers",[]),c(this,"assetType"),c(this,"assetsMap",{}),c(this,"legend",[]),c(this,"selectedList",[]),c(this,"painter"),c(this,"_lastHighlightType",""),c(this,"_lastHighlightIds",[]),c(this,"clickSvgElementHandler",this.handleClickSvgElement.bind(this)),c(this,"_lastLinkedIds",[]),this.params=t,this.assetType=t.assetType||Li.RM,this.params.socialDistanceEnable&&(this.socialDistanceEnable=!0),this.container=this.params.containerId?document.getElementById(this.params.containerId):Ae.window.document.getElementsByTagName("body")[0],this.chef=new Os,this.painter=new Ws(t,this.chef)}get isMounted(){var t;return(null==(t=this.container.querySelectorAll("svg"))?void 0:t.length)>0}destroy(){var t;super.destroy(),this.unmount(),null==(t=this.camera)||t.destroy()}mount(){this.svg&&(this.container.contains(this.svg)||this.container.appendChild(this.svg),this.chef.computeBoundingBoxMap())}unmount(){this.svg&&this.svg.parentNode&&this.container.contains(this.svg)&&this.container.removeChild(this.svg)}computeBoundingBox(){return this.boundingBox.makeEmpty(),this.chef&&this.svg?(this.chef.computeBoundingBoxMap(),this.boundingBox.copy(this.chef.boundingBox),this.boundingBox):this.boundingBox}load(t){return d(this,null,(function*(){return(new Ns).loadAsync(t)}))}bind(t){this.svgStr=t;const e=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;return this.bindSvg(e),!0}bindSvg(t){var e;if(this.svg=t,!this.svg)throw new Error("svg load failed");let i=this.svg.getAttribute("viewBox");i&&(Zn(i,this.viewBox),this.chef.bindSvg(this.svg),this.svgRoot=Jn(this.svg),this.svg.setAttribute("viewBox",`0 0 ${this.params.width} ${this.params.height}`),this.svg.setAttribute("style","transform: translateZ(0);"),this.viewUnits=ri.lowerCase(hn(null==(e=this.svg)?void 0:e.querySelector("view"),"units")||Ei.M),this.appendStyles(),this.setAssetsMap(this.assetType,this.assetsMap))}recompute(t){t&&(this.bindSvg(t),this.computeBoundingBox(),this.viewBox.copy(this.boundingBox))}appendStyles(){var t;let e=null==(t=this.svg)?void 0:t.querySelector("style");e&&(e.appendChild(document.createTextNode(".centered-texts { text-anchor:middle; dominant-baseline:middle; }")),e.appendChild(document.createTextNode(`.default { stroke: ${this.params.defaultStroke}; fill: ${this.params.defaultFill}; }`)),e.appendChild(document.createTextNode(`.info { stroke: ${this.params.infoStroke}; fill: ${this.params.infoFill}; }`)),e.appendChild(document.createTextNode(`.primary { stroke: ${this.params.primaryStroke}; fill: ${this.params.primaryFill}; }`)),e.appendChild(document.createTextNode(`.success { stroke: ${this.params.successStroke}; fill: ${this.params.successFill}; }`)),e.appendChild(document.createTextNode(`.warning { stroke: ${this.params.warningStroke}; fill: ${this.params.warningFill}; }`)),e.appendChild(document.createTextNode(`.danger { stroke: ${this.params.dangerStroke}; fill: ${this.params.dangerFill}; }`)),e.appendChild(document.createTextNode(`.active { stroke: ${this.params.activeStroke}; fill: ${this.params.activeFill}; }`)),e.appendChild(document.createTextNode(`text { font-family: ${this.params.fontFamily||"simhei"}; }`)),nn(this.svg,(t=>{"asset-labels"===hn(t,"id")&&Us(t,"centered-texts")})),e.appendChild(document.createTextNode("@keyframes fillAnimate {\n 100% { fill-opacity: 0.3; }\n 30% { fill-opacity: 1; }\n 0% { fill-opacity: 0.3; }\n }")),e.appendChild(document.createTextNode("@keyframes dashedAnimate {\n 100% { stroke-dashoffset: -850; }\n 0% { stroke-dashoffset: -0; }\n }")),e.appendChild(document.createTextNode(".cursor { cursor: pointer; }")),e.appendChild(document.createTextNode(".hover { fill: rgba(185, 28, 28, 0.5); animation: fillAnimate 1s infinite; cursor: pointer; }")))}getLayers(t=2){return this.svg?this.chef.getLayers(t):[]}setDefaultLayers(t){(null==t?void 0:t.length)&&(this.defaultLayers=t)}setSkeletonLayers(t){(null==t?void 0:t.length)&&(this.skeletonLayers=t)}setCurrentLayers(t){(null==t?void 0:t.length)&&(this.currentLayers=t)}showDefaultLayers(t,e=!1){this.setDefaultLayers(t),this.chef.updateLayersVisibility(t,e)}getLayerVisible(t){return this.chef.getLayerVisible(t)}updateLayersVisibility(t,e=!1,i=!0){this.chef.updateLayersVisibility(t,e,i)}setAssetType(t,e){this.assetsMap={},this.assetType=t,this.setAssetsMap(this.assetType,this.assetsMap),e||(e=[zi(t)],t!==Li.RM&&e.unshift(zi(Li.RM))),this.setDefaultLayers(e),this.updateLayersVisibility(this.defaultLayers,!0)}isBelongsToAssetType(t,e){e||(e=this.assetType);const i=this.getAssetsByType(e);return!!i&&!!(null==i?void 0:i.hasOwnProperty(t))}setAssetsMap(t,e={}){const i=this.chef.getElementById(zi(t));if(!i)return e;e[t]=this.chef.getElementsMap(i);const n=Hi(t),s=this.chef.getElementById(n);if(!s)return e;const r=this.chef.getElementsMap(s),a=ri.keys(r);if(!(null==a?void 0:a.length))return e;if(ri.startsWith(a[0],`l-${t}-`)){const e=`l-${t}-`.length;for(let t=0,i=a.length;t<i;t++){r[a[t].slice(e)]=r[a[t]],delete r[a[t]]}}return e[n]=r,e}getAssetsByType(t){return this.assetsMap.hasOwnProperty(t)||this.setAssetsMap(t,this.assetsMap),this.assetsMap[t]}getElementById(t){if(!t)return;const e=this.getAssetsByType(this.assetType);return e&&Object.hasOwnProperty.call(e,t)?e[t]:void 0}getAssetIdsByType(t){const e=this.getAssetsByType(t);return e?ri.keys(e):[]}clearFillOrStroke(t="fill"){const e=this.getAssetsByType(this.assetType);if(!e)return;const i=ri.keys(e);let n;for(let s=0,r=i.length;s<r;s++)n=e[i[s]],n&&(n.hasAttribute(t)&&n.removeAttribute(t),"stroke"===t&&n.removeAttribute("stroke-width"));this.clearLegendBy(t)}clearFillOrStrokeByIds(t,e="fill"){const i=this.getAssetsByType(this.assetType);if(!i)return;const n=ri.keys(i);let s;for(let r=0,a=n.length;r<a;r++)(null==t?void 0:t.length)&&!t.includes(n[r])||(s=i[n[r]],s&&s.hasAttribute(e)&&(s.removeAttribute(e),"stroke"===e&&s.removeAttribute("stroke-width")));this.clearLegendBy(e)}setFillOrStrokeByIds(t,e,i="fill",n="7em"){const s=this.getAssetsByType(this.assetType);if(!s)return;const r=ri.keys(s);let a;for(let o=0,h=r.length;o<h;o++)t.includes(r[o])&&(a=s[r[o]],a&&(a.setAttribute(i,e),"stroke"===i&&a.setAttribute("stroke-width",n),this.addLegend(i,e,r[o])))}addLegend(t,e,i){let n=this.legend.find((t=>t.color===e));n||(n={type:t,color:e,ids:[]},this.legend.push(n)),n.ids.push(i)}clearLegendBy(t){var e;t||(this.legend.length=0);for(let i=(null==(e=this.legend)?void 0:e.length)-1;i>=0;i--)this.legend[i].type===t&&this.legend.splice(i,i)}getLegend(){return this.legend}showSkeleton(){var t;(null==(t=this.skeletonLayers)?void 0:t.length)&&(this.chef.updateLayersVisibility(this.defaultLayers,!1),this.chef.updateLayersVisibility(this.skeletonLayers,!0))}hideSkeleton(){var t;(null==(t=this.skeletonLayers)?void 0:t.length)&&(this.chef.updateLayersVisibility(this.skeletonLayers,!1),this.chef.updateLayersVisibility(this.defaultLayers,!0))}setAssetLabels(t,e){this.chef.setLabelsById(t,e,this.assetType)}getAssetLabelsMap(t){var e,i;if(!t)return;const n=Hi(t);let s=this.getAssetsByType(n);if(!s||!(null==(e=Object.keys(s))?void 0:e.length)){let e=this.chef.getElementById(n);if(e||(e=this.chef.getElementById(t+"-txt-label")),!e)return;s=this.chef.getElementsMap(e),this.assetsMap[n]=s}return s&&(null==(i=Object.keys(s))?void 0:i.length)?s:void 0}getAssetLabelById(t,e){var i,n;const s=this.getAssetLabelsMap(t);if(!s)return;let r=s[e];if(r&&(null==(i=null==r?void 0:r.childNodes)?void 0:i.length))return r.childNodes[0].textContent||"";return r=s["l-"+t+"-"+e],r&&(null==(n=null==r?void 0:r.children)?void 0:n.length)?r.children[0].textContent||"":void 0}clearAssetLabels(){this.chef.clearAssetLabelsByType(this.assetType)}bindAssetsEvents(t){var e;const i=null==(e=this.svg)?void 0:e.querySelector("#"+t);if(!i)return;i.querySelectorAll("[id]").forEach((t=>{t instanceof SVGElement&&t.addEventListener("click",this.clickSvgElementHandler)}))}handleClickSvgElement(t){"function"==typeof t.preventDefault&&t.preventDefault(),this.dispatchEvent({type:"click",data:t})}socialDistanceEnableChanged(t){this.socialDistanceEnable=!!t,t?this.painter.drawSocialDistanceCircles(this.svg):this.painter.clearSocialDistanceCircles(this.svg)}highlightAssets(t,e){var i;this.resetHighlightAssets(t);const n=this.getAssetsByType(t);n&&(null==(i=Object.keys(n))?void 0:i.length)&&(this._lastHighlightType=t,this._lastHighlightIds=Array.isArray(e)?e:[e],this._lastHighlightIds.forEach((t=>{t&&n[t]&&Us(n[t],"active")})))}resetHighlightAssets(t){var e;const i=this.getAssetsByType(t||this._lastHighlightType);i&&(null==(e=Object.keys(i))?void 0:e.length)&&(this._lastHighlightIds.forEach((t=>{t&&i[t]&&Vs(i[t],"active")})),this._lastHighlightIds.length=0)}getIntersectObjects(t,e=Li.RM,i=[]){i.length=0;const n=[],s=this.getAssetsByType(e);if(!s)return i;const r=ri.keys(s);for(let e=0,i=r.length;e<i;e++){const i=this.chef.getElementBoundingBox(s[r[e]].id);i&&(i.containsPoint(t.worldCoords)&&n.push(s[r[e]]))}const a=ri.sortBy(n,(t=>{var e;return null==(e=this.chef.getElementBoundingBox(t.id))?void 0:e.getArea()}));return i.push(...a),i}clearSelected(){var t,e;if(null==(t=this.selectedList)?void 0:t.length)for(let t=(null==(e=this.selectedList)?void 0:e.length)-1;t>=0;t--){let e=this.selectedList[t];this.selectedList.splice(t,1),this.chef.setElementState2selected(e,!1)}}clearSelectedById(t){var e,i;let n=null==(e=this.selectedList)?void 0:e.findIndex((e=>e.getAttribute("id")===t));n>-1&&(this.chef.setElementState2selected(this.selectedList[n],!1),null==(i=this.selectedList)||i.splice(n||0,1))}selectByIds(t,e=!1){Array.isArray(t)||(t=[t]),e||this.clearSelected();const i=ri.uniq(ri.map(this.selectedList,(t=>t.getAttribute("id")||""))),n=this.getAssetsByType(this.assetType);if(n){for(let e=t.length-1;e>=0;e--)i.includes(t[e])?(this.clearSelectedById(t[e]),t.splice(e,1)):Object.hasOwnProperty.call(n,t[e])&&this.selectedList.push(n[t[e]]);this.selectedList.forEach((t=>{this.chef.setElementState2selected(t,!0)}))}}getSelectedIds(){var t;if(!(null==(t=this.selectedList)?void 0:t.length))return;const e=[];for(let t=0,i=this.selectedList.length;t<i;t++)this.selectedList[t].id&&e.push(this.selectedList[t].id);return e}getSelectedBoundingBox(){var t;const e=new ai;return(null==(t=this.selectedList)?void 0:t.length)?(this.selectedList.forEach((t=>{const i=this.chef.boundingBoxMap[t.id];i&&e.expandByBox(i)})),e):e.copy(this.boundingBox)}getElementsByBox(t){const e=[],i=Object.keys(this.chef.boundingBoxMap),n=this.getAssetsByType(this.assetType);if(!n)return e;for(let s=0,r=i.length;s<r;s++)if(n.hasOwnProperty(i[s])&&!(i[s].indexOf("-assets")>-1)&&t.intersectsBox(this.chef.boundingBoxMap[i[s]])){const t=n[i[s]];t&&e.push(t)}return e}getBoundingBoxByIds(t){var e,i;if(!t||Array.isArray(t)&&!t.length)return;Array.isArray(t)||(t=[t]);const n=new ai;for(let s=0,r=null==t?void 0:t.length;s<r;s++)(null==(i=null==(e=this.chef)?void 0:e.boundingBoxMap)?void 0:i.hasOwnProperty(t[s]))&&n.expandByBox(this.chef.boundingBoxMap[t[s]]);return n}getBoundingBoxById(t){if(this.chef.boundingBoxMap.hasOwnProperty(t))return(new ai).copy(this.chef.boundingBoxMap[t])}linkAssetsByTree(t){this.chef.linkAssetsByTree(this.assetType,t);const e=this.chef.getElementById(Pi.ASSET_LABELS);e&&(e.style.display="block");const i=Hi(this.assetType),n=this.chef.getElementById(i);n&&(n.style.display="block");const s=this.assetsMap[i];s&&(this._lastLinkedIds.forEach((t=>{s[t]&&(s[t].style.display="none")})),this._lastLinkedIds=Ii(t),this._lastLinkedIds.forEach((t=>{s[t]&&(s[t].style.display="block")})))}onBeforeRender(){}fullscreen(t=1e3,e=!1){}update(){}}class js extends qs{constructor(t){super(t),c(this,"name","SvgLoadingScene"),this.bind('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-200 -200 500 500">\n <view id="defaultView" viewBox="-200 -200 500 500" />\n <style>\n /*#svg-loading-fast circle {animation: svg-loading-fast 2s ease infinite;}*/\n /*@keyframes svg-loading-fast {*/\n /* 0% {stroke-dasharray: 250; stroke-dashoffset: 250;}*/\n /* 50% {stroke-dasharray: 0; stroke-dashoffset: 0; opacity: 0.5;}*/\n /*}*/\n #svg-loading-fast .line {animation: svg-loading-fast 3s ease infinite;}\n @keyframes svg-loading-fast {\n 0% {stroke-dasharray: 250; stroke-dashoffset: 250; opacity: 1;}\n 50% {stroke-dasharray: 250; stroke-dashoffset: 0; opacity: 0.5;}\n }\n #svg-loading-fast path {animation: pathFrames 6s ease infinite;}\n @keyframes pathFrames {\n 0% {opacity: 1;}\n 50% {opacity: 0.5;}\n }\n #svg-loading-fast .triangle {animation: triangleFrames 1s ease infinite;}\n @keyframes triangleFrames {\n 0% {opacity: 1;}\n 50% {opacity: 0.3;}\n }\n #svg-loading-fast {fill: #525252}\n .line {stroke: #525252; stroke-width: 4px}\n .triangle {fill: #F26666}\n </style>\n <g id="svg-loading-fast">\n\x3c!-- <text x="50" y="55" style="text-anchor: middle; fill: #5CC9F5; font-size: 15px;">loading</text>--\x3e\n\x3c!-- <circle cx="103" cy="25" r="103" style="fill: none; stroke: #5CC9F5; stroke-width: 1px;" />--\x3e\n <path d="M14 35.7L14 15L21.27 15L21.27 33L34.59 33L33.08 35.7L14 35.7Z" />\n <path d="M44.78 17.77L44.78 32.93L55.4 32.93L55.4 15L62.71 15L62.71 35.7L37.47 35.7L37.47 15L55.4 15L52.88 17.77L44.78 17.77Z" />\n <path d="M76.39 27.92L85.03 27.92L82.9 30.77L75.2 30.77L73.29 35.7L65.59 35.7L73.94 15L87.19 15L95.58 35.7L87.94 35.7L85.03 27.92L81.14 17.77L79.99 17.77L76.39 27.92Z" />\n <path d="M123.73 32.78L120.88 35.7L98.46 35.7L98.46 15L116.53 15L113.97 17.84L105.66 17.84L105.66 32.93L116.53 32.93L116.53 15L121.14 15L123.73 17.7L123.73 32.78Z" />\n <path d="M133.63 35.7L126.61 35.7L126.61 15L133.63 15L133.63 35.7Z" />\n <path d="M153.75 35.7L143.78 21.3L143.78 35.7L136.51 35.7L136.51 15L144.64 15L154.58 29.65L154.58 15L161.78 15L161.78 35.7L153.75 35.7Z" />\n <path d="M182.73 33L182.73 25.73L177.37 25.73L177.37 22.99L189.93 22.99L189.93 35.7L182.73 35.7L182.73 33.5L180.57 35.7L164.66 35.7L164.66 15L190.04 15L188.46 17.7L172.04 17.7L172.04 33L182.73 33Z" />\n\x3c!-- <rect class="line" width="207" height="5" x="0" y="43" />--\x3e\n\x3c!-- <path class="line" d="M0 43L207 43" />--\x3e\n <path class="line" d="M103.5 46L0 46" />\n <path class="line" d="M103.5 46L207 46" />\n <path class="triangle" d="M103.5 56L133.5 90L73.5 90Z" />\n </g>\n </svg>')}}var Ys,Gs={exports:{}};
|
|
9
|
+
*/!function(t,e){(function(){var i,n="Expected a function",s="__lodash_hash_undefined__",r="__lodash_placeholder__",a=32,o=128,h=256,l=1/0,u=9007199254740991,c=NaN,d=4294967295,p=[["ary",o],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",a],["partialRight",64],["rearg",h]],f="[object Arguments]",m="[object Array]",g="[object Boolean]",y="[object Date]",v="[object Error]",x="[object Function]",b="[object GeneratorFunction]",_="[object Map]",S="[object Number]",E="[object Object]",M="[object Promise]",A="[object RegExp]",T="[object Set]",C="[object String]",I="[object Symbol]",D="[object WeakMap]",L="[object ArrayBuffer]",B="[object DataView]",P="[object Float32Array]",k="[object Float64Array]",N="[object Int8Array]",O="[object Int16Array]",R="[object Int32Array]",z="[object Uint8Array]",H="[object Uint8ClampedArray]",W="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,Y=/[&<>"']/g,G=RegExp(j.source),$=RegExp(Y.source),X=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,K=/^\w*$/,tt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/[\\^$.*+?()[\]{}|]/g,it=RegExp(et.source),nt=/^\s+/,st=/\s/,rt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,at=/\{\n\/\* \[wrapped with (.+)\] \*/,ot=/,? & /,ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,lt=/[()=,{}\[\]\/\s]/,ut=/\\(\\)?/g,ct=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,pt=/^[-+]0x[0-9a-f]+$/i,ft=/^0b[01]+$/i,mt=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,yt=/^(?:0|[1-9]\d*)$/,vt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,xt=/($^)/,bt=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",_t="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",St="\\u2700-\\u27bf",Et="a-z\\xdf-\\xf6\\xf8-\\xff",Mt="A-Z\\xc0-\\xd6\\xd8-\\xde",At="\\ufe0e\\ufe0f",Tt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ct="['’]",It="["+wt+"]",Dt="["+Tt+"]",Lt="["+_t+"]",Bt="\\d+",Pt="["+St+"]",kt="["+Et+"]",Nt="[^"+wt+Tt+Bt+St+Et+Mt+"]",Ot="\\ud83c[\\udffb-\\udfff]",Rt="[^"+wt+"]",zt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ht="[\\ud800-\\udbff][\\udc00-\\udfff]",Wt="["+Mt+"]",Ft="\\u200d",Ut="(?:"+kt+"|"+Nt+")",Vt="(?:"+Wt+"|"+Nt+")",qt="(?:['’](?:d|ll|m|re|s|t|ve))?",jt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Yt="(?:"+Lt+"|"+Ot+")"+"?",Gt="["+At+"]?",$t=Gt+Yt+("(?:"+Ft+"(?:"+[Rt,zt,Ht].join("|")+")"+Gt+Yt+")*"),Xt="(?:"+[Pt,zt,Ht].join("|")+")"+$t,Zt="(?:"+[Rt+Lt+"?",Lt,zt,Ht,It].join("|")+")",Jt=RegExp(Ct,"g"),Qt=RegExp(Lt,"g"),Kt=RegExp(Ot+"(?="+Ot+")|"+Zt+$t,"g"),te=RegExp([Wt+"?"+kt+"+"+qt+"(?="+[Dt,Wt,"$"].join("|")+")",Vt+"+"+jt+"(?="+[Dt,Wt+Ut,"$"].join("|")+")",Wt+"?"+Ut+"+"+qt,Wt+"+"+jt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Bt,Xt].join("|"),"g"),ee=RegExp("["+Ft+wt+_t+At+"]"),ie=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ne=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],se=-1,re={};re[P]=re[k]=re[N]=re[O]=re[R]=re[z]=re[H]=re[W]=re[F]=!0,re[f]=re[m]=re[L]=re[g]=re[B]=re[y]=re[v]=re[x]=re[_]=re[S]=re[E]=re[A]=re[T]=re[C]=re[D]=!1;var ae={};ae[f]=ae[m]=ae[L]=ae[B]=ae[g]=ae[y]=ae[P]=ae[k]=ae[N]=ae[O]=ae[R]=ae[_]=ae[S]=ae[E]=ae[A]=ae[T]=ae[C]=ae[I]=ae[z]=ae[H]=ae[W]=ae[F]=!0,ae[v]=ae[x]=ae[D]=!1;var oe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},he=parseFloat,le=parseInt,ue="object"==typeof w&&w&&w.Object===Object&&w,ce="object"==typeof self&&self&&self.Object===Object&&self,de=ue||ce||Function("return this")(),pe=e&&!e.nodeType&&e,fe=pe&&t&&!t.nodeType&&t,me=fe&&fe.exports===pe,ge=me&&ue.process,ye=function(){try{var t=fe&&fe.require&&fe.require("util").types;return t||ge&&ge.binding&&ge.binding("util")}catch(t){}}(),ve=ye&&ye.isArrayBuffer,xe=ye&&ye.isDate,be=ye&&ye.isMap,we=ye&&ye.isRegExp,_e=ye&&ye.isSet,Se=ye&&ye.isTypedArray;function Ee(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function Me(t,e,i,n){for(var s=-1,r=null==t?0:t.length;++s<r;){var a=t[s];e(n,a,i(a),t)}return n}function Ae(t,e){for(var i=-1,n=null==t?0:t.length;++i<n&&!1!==e(t[i],i,t););return t}function Te(t,e){for(var i=null==t?0:t.length;i--&&!1!==e(t[i],i,t););return t}function Ce(t,e){for(var i=-1,n=null==t?0:t.length;++i<n;)if(!e(t[i],i,t))return!1;return!0}function Ie(t,e){for(var i=-1,n=null==t?0:t.length,s=0,r=[];++i<n;){var a=t[i];e(a,i,t)&&(r[s++]=a)}return r}function De(t,e){return!!(null==t?0:t.length)&&We(t,e,0)>-1}function Le(t,e,i){for(var n=-1,s=null==t?0:t.length;++n<s;)if(i(e,t[n]))return!0;return!1}function Be(t,e){for(var i=-1,n=null==t?0:t.length,s=Array(n);++i<n;)s[i]=e(t[i],i,t);return s}function Pe(t,e){for(var i=-1,n=e.length,s=t.length;++i<n;)t[s+i]=e[i];return t}function ke(t,e,i,n){var s=-1,r=null==t?0:t.length;for(n&&r&&(i=t[++s]);++s<r;)i=e(i,t[s],s,t);return i}function Ne(t,e,i,n){var s=null==t?0:t.length;for(n&&s&&(i=t[--s]);s--;)i=e(i,t[s],s,t);return i}function Oe(t,e){for(var i=-1,n=null==t?0:t.length;++i<n;)if(e(t[i],i,t))return!0;return!1}var Re=qe("length");function ze(t,e,i){var n;return i(t,(function(t,i,s){if(e(t,i,s))return n=i,!1})),n}function He(t,e,i,n){for(var s=t.length,r=i+(n?1:-1);n?r--:++r<s;)if(e(t[r],r,t))return r;return-1}function We(t,e,i){return e==e?function(t,e,i){var n=i-1,s=t.length;for(;++n<s;)if(t[n]===e)return n;return-1}(t,e,i):He(t,Ue,i)}function Fe(t,e,i,n){for(var s=i-1,r=t.length;++s<r;)if(n(t[s],e))return s;return-1}function Ue(t){return t!=t}function Ve(t,e){var i=null==t?0:t.length;return i?Ge(t,e)/i:c}function qe(t){return function(e){return null==e?i:e[t]}}function je(t){return function(e){return null==t?i:t[e]}}function Ye(t,e,i,n,s){return s(t,(function(t,s,r){i=n?(n=!1,t):e(i,t,s,r)})),i}function Ge(t,e){for(var n,s=-1,r=t.length;++s<r;){var a=e(t[s]);a!==i&&(n=n===i?a:n+a)}return n}function $e(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n}function Xe(t){return t?t.slice(0,ci(t)+1).replace(nt,""):t}function Ze(t){return function(e){return t(e)}}function Je(t,e){return Be(e,(function(e){return t[e]}))}function Qe(t,e){return t.has(e)}function Ke(t,e){for(var i=-1,n=t.length;++i<n&&We(e,t[i],0)>-1;);return i}function ti(t,e){for(var i=t.length;i--&&We(e,t[i],0)>-1;);return i}var ei=je({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ii=je({"&":"&","<":"<",">":">",'"':""","'":"'"});function ni(t){return"\\"+oe[t]}function si(t){return ee.test(t)}function ri(t){var e=-1,i=Array(t.size);return t.forEach((function(t,n){i[++e]=[n,t]})),i}function ai(t,e){return function(i){return t(e(i))}}function oi(t,e){for(var i=-1,n=t.length,s=0,a=[];++i<n;){var o=t[i];o!==e&&o!==r||(t[i]=r,a[s++]=i)}return a}function hi(t){var e=-1,i=Array(t.size);return t.forEach((function(t){i[++e]=t})),i}function li(t){return si(t)?function(t){var e=Kt.lastIndex=0;for(;Kt.test(t);)++e;return e}(t):Re(t)}function ui(t){return si(t)?function(t){return t.match(Kt)||[]}(t):function(t){return t.split("")}(t)}function ci(t){for(var e=t.length;e--&&st.test(t.charAt(e)););return e}var di=je({"&":"&","<":"<",">":">",""":'"',"'":"'"});var pi=function t(e){var w,st=(e=null==e?de:pi.defaults(de.Object(),e,pi.pick(de,ne))).Array,wt=e.Date,_t=e.Error,St=e.Function,Et=e.Math,Mt=e.Object,At=e.RegExp,Tt=e.String,Ct=e.TypeError,It=st.prototype,Dt=St.prototype,Lt=Mt.prototype,Bt=e["__core-js_shared__"],Pt=Dt.toString,kt=Lt.hasOwnProperty,Nt=0,Ot=(w=/[^.]+$/.exec(Bt&&Bt.keys&&Bt.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",Rt=Lt.toString,zt=Pt.call(Mt),Ht=de._,Wt=At("^"+Pt.call(kt).replace(et,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ft=me?e.Buffer:i,Ut=e.Symbol,Vt=e.Uint8Array,qt=Ft?Ft.allocUnsafe:i,jt=ai(Mt.getPrototypeOf,Mt),Yt=Mt.create,Gt=Lt.propertyIsEnumerable,$t=It.splice,Xt=Ut?Ut.isConcatSpreadable:i,Zt=Ut?Ut.iterator:i,Kt=Ut?Ut.toStringTag:i,ee=function(){try{var t=lr(Mt,"defineProperty");return t({},"",{}),t}catch(t){}}(),oe=e.clearTimeout!==de.clearTimeout&&e.clearTimeout,ue=wt&&wt.now!==de.Date.now&&wt.now,ce=e.setTimeout!==de.setTimeout&&e.setTimeout,pe=Et.ceil,fe=Et.floor,ge=Mt.getOwnPropertySymbols,ye=Ft?Ft.isBuffer:i,Re=e.isFinite,je=It.join,fi=ai(Mt.keys,Mt),mi=Et.max,gi=Et.min,yi=wt.now,vi=e.parseInt,xi=Et.random,bi=It.reverse,wi=lr(e,"DataView"),_i=lr(e,"Map"),Si=lr(e,"Promise"),Ei=lr(e,"Set"),Mi=lr(e,"WeakMap"),Ai=lr(Mt,"create"),Ti=Mi&&new Mi,Ci={},Ii=zr(wi),Di=zr(_i),Li=zr(Si),Bi=zr(Ei),Pi=zr(Mi),ki=Ut?Ut.prototype:i,Ni=ki?ki.valueOf:i,Oi=ki?ki.toString:i;function Ri(t){if(eo(t)&&!qa(t)&&!(t instanceof Fi)){if(t instanceof Wi)return t;if(kt.call(t,"__wrapped__"))return Hr(t)}return new Wi(t)}var zi=function(){function t(){}return function(e){if(!to(e))return{};if(Yt)return Yt(e);t.prototype=e;var n=new t;return t.prototype=i,n}}();function Hi(){}function Wi(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function Fi(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Ui(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function Vi(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function qi(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function ji(t){var e=-1,i=null==t?0:t.length;for(this.__data__=new qi;++e<i;)this.add(t[e])}function Yi(t){var e=this.__data__=new Vi(t);this.size=e.size}function Gi(t,e){var i=qa(t),n=!i&&Va(t),s=!i&&!n&&$a(t),r=!i&&!n&&!s&&lo(t),a=i||n||s||r,o=a?$e(t.length,Tt):[],h=o.length;for(var l in t)!e&&!kt.call(t,l)||a&&("length"==l||s&&("offset"==l||"parent"==l)||r&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||gr(l,h))||o.push(l);return o}function $i(t){var e=t.length;return e?t[Yn(0,e-1)]:i}function Xi(t,e){return Br(Ts(t),rn(e,0,t.length))}function Zi(t){return Br(Ts(t))}function Ji(t,e,n){(n!==i&&!Wa(t[e],n)||n===i&&!(e in t))&&nn(t,e,n)}function Qi(t,e,n){var s=t[e];kt.call(t,e)&&Wa(s,n)&&(n!==i||e in t)||nn(t,e,n)}function Ki(t,e){for(var i=t.length;i--;)if(Wa(t[i][0],e))return i;return-1}function tn(t,e,i,n){return un(t,(function(t,s,r){e(n,t,i(t),r)})),n}function en(t,e){return t&&Cs(e,Bo(e),t)}function nn(t,e,i){"__proto__"==e&&ee?ee(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}function sn(t,e){for(var n=-1,s=e.length,r=st(s),a=null==t;++n<s;)r[n]=a?i:To(t,e[n]);return r}function rn(t,e,n){return t==t&&(n!==i&&(t=t<=n?t:n),e!==i&&(t=t>=e?t:e)),t}function an(t,e,n,s,r,a){var o,h=1&e,l=2&e,u=4&e;if(n&&(o=r?n(t,s,r,a):n(t)),o!==i)return o;if(!to(t))return t;var c=qa(t);if(c){if(o=function(t){var e=t.length,i=new t.constructor(e);e&&"string"==typeof t[0]&&kt.call(t,"index")&&(i.index=t.index,i.input=t.input);return i}(t),!h)return Ts(t,o)}else{var d=dr(t),p=d==x||d==b;if($a(t))return ws(t,h);if(d==E||d==f||p&&!r){if(o=l||p?{}:fr(t),!h)return l?function(t,e){return Cs(t,cr(t),e)}(t,function(t,e){return t&&Cs(e,Po(e),t)}(o,t)):function(t,e){return Cs(t,ur(t),e)}(t,en(o,t))}else{if(!ae[d])return r?t:{};o=function(t,e,i){var n=t.constructor;switch(e){case L:return _s(t);case g:case y:return new n(+t);case B:return function(t,e){var i=e?_s(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}(t,i);case P:case k:case N:case O:case R:case z:case H:case W:case F:return Ss(t,i);case _:return new n;case S:case C:return new n(t);case A:return function(t){var e=new t.constructor(t.source,dt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case T:return new n;case I:return s=t,Ni?Mt(Ni.call(s)):{}}var s}(t,d,h)}}a||(a=new Yi);var m=a.get(t);if(m)return m;a.set(t,o),ao(t)?t.forEach((function(i){o.add(an(i,e,n,i,t,a))})):io(t)&&t.forEach((function(i,s){o.set(s,an(i,e,n,s,t,a))}));var v=c?i:(u?l?ir:er:l?Po:Bo)(t);return Ae(v||t,(function(i,s){v&&(i=t[s=i]),Qi(o,s,an(i,e,n,s,t,a))})),o}function on(t,e,n){var s=n.length;if(null==t)return!s;for(t=Mt(t);s--;){var r=n[s],a=e[r],o=t[r];if(o===i&&!(r in t)||!a(o))return!1}return!0}function hn(t,e,s){if("function"!=typeof t)throw new Ct(n);return Cr((function(){t.apply(i,s)}),e)}function ln(t,e,i,n){var s=-1,r=De,a=!0,o=t.length,h=[],l=e.length;if(!o)return h;i&&(e=Be(e,Ze(i))),n?(r=Le,a=!1):e.length>=200&&(r=Qe,a=!1,e=new ji(e));t:for(;++s<o;){var u=t[s],c=null==i?u:i(u);if(u=n||0!==u?u:0,a&&c==c){for(var d=l;d--;)if(e[d]===c)continue t;h.push(u)}else r(e,c,n)||h.push(u)}return h}Ri.templateSettings={escape:X,evaluate:Z,interpolate:J,variable:"",imports:{_:Ri}},Ri.prototype=Hi.prototype,Ri.prototype.constructor=Ri,Wi.prototype=zi(Hi.prototype),Wi.prototype.constructor=Wi,Fi.prototype=zi(Hi.prototype),Fi.prototype.constructor=Fi,Ui.prototype.clear=function(){this.__data__=Ai?Ai(null):{},this.size=0},Ui.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Ui.prototype.get=function(t){var e=this.__data__;if(Ai){var n=e[t];return n===s?i:n}return kt.call(e,t)?e[t]:i},Ui.prototype.has=function(t){var e=this.__data__;return Ai?e[t]!==i:kt.call(e,t)},Ui.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ai&&e===i?s:e,this},Vi.prototype.clear=function(){this.__data__=[],this.size=0},Vi.prototype.delete=function(t){var e=this.__data__,i=Ki(e,t);return!(i<0)&&(i==e.length-1?e.pop():$t.call(e,i,1),--this.size,!0)},Vi.prototype.get=function(t){var e=this.__data__,n=Ki(e,t);return n<0?i:e[n][1]},Vi.prototype.has=function(t){return Ki(this.__data__,t)>-1},Vi.prototype.set=function(t,e){var i=this.__data__,n=Ki(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this},qi.prototype.clear=function(){this.size=0,this.__data__={hash:new Ui,map:new(_i||Vi),string:new Ui}},qi.prototype.delete=function(t){var e=or(this,t).delete(t);return this.size-=e?1:0,e},qi.prototype.get=function(t){return or(this,t).get(t)},qi.prototype.has=function(t){return or(this,t).has(t)},qi.prototype.set=function(t,e){var i=or(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this},ji.prototype.add=ji.prototype.push=function(t){return this.__data__.set(t,s),this},ji.prototype.has=function(t){return this.__data__.has(t)},Yi.prototype.clear=function(){this.__data__=new Vi,this.size=0},Yi.prototype.delete=function(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i},Yi.prototype.get=function(t){return this.__data__.get(t)},Yi.prototype.has=function(t){return this.__data__.has(t)},Yi.prototype.set=function(t,e){var i=this.__data__;if(i instanceof Vi){var n=i.__data__;if(!_i||n.length<199)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new qi(n)}return i.set(t,e),this.size=i.size,this};var un=Ls(vn),cn=Ls(xn,!0);function dn(t,e){var i=!0;return un(t,(function(t,n,s){return i=!!e(t,n,s)})),i}function pn(t,e,n){for(var s=-1,r=t.length;++s<r;){var a=t[s],o=e(a);if(null!=o&&(h===i?o==o&&!ho(o):n(o,h)))var h=o,l=a}return l}function fn(t,e){var i=[];return un(t,(function(t,n,s){e(t,n,s)&&i.push(t)})),i}function mn(t,e,i,n,s){var r=-1,a=t.length;for(i||(i=mr),s||(s=[]);++r<a;){var o=t[r];e>0&&i(o)?e>1?mn(o,e-1,i,n,s):Pe(s,o):n||(s[s.length]=o)}return s}var gn=Bs(),yn=Bs(!0);function vn(t,e){return t&&gn(t,e,Bo)}function xn(t,e){return t&&yn(t,e,Bo)}function bn(t,e){return Ie(e,(function(e){return Ja(t[e])}))}function wn(t,e){for(var n=0,s=(e=ys(e,t)).length;null!=t&&n<s;)t=t[Rr(e[n++])];return n&&n==s?t:i}function _n(t,e,i){var n=e(t);return qa(t)?n:Pe(n,i(t))}function Sn(t){return null==t?t===i?"[object Undefined]":"[object Null]":Kt&&Kt in Mt(t)?function(t){var e=kt.call(t,Kt),n=t[Kt];try{t[Kt]=i;var s=!0}catch(t){}var r=Rt.call(t);s&&(e?t[Kt]=n:delete t[Kt]);return r}(t):function(t){return Rt.call(t)}(t)}function En(t,e){return t>e}function Mn(t,e){return null!=t&&kt.call(t,e)}function An(t,e){return null!=t&&e in Mt(t)}function Tn(t,e,n){for(var s=n?Le:De,r=t[0].length,a=t.length,o=a,h=st(a),l=1/0,u=[];o--;){var c=t[o];o&&e&&(c=Be(c,Ze(e))),l=gi(c.length,l),h[o]=!n&&(e||r>=120&&c.length>=120)?new ji(o&&c):i}c=t[0];var d=-1,p=h[0];t:for(;++d<r&&u.length<l;){var f=c[d],m=e?e(f):f;if(f=n||0!==f?f:0,!(p?Qe(p,m):s(u,m,n))){for(o=a;--o;){var g=h[o];if(!(g?Qe(g,m):s(t[o],m,n)))continue t}p&&p.push(m),u.push(f)}}return u}function Cn(t,e,n){var s=null==(t=Mr(t,e=ys(e,t)))?t:t[Rr(Zr(e))];return null==s?i:Ee(s,t,n)}function In(t){return eo(t)&&Sn(t)==f}function Dn(t,e,n,s,r){return t===e||(null==t||null==e||!eo(t)&&!eo(e)?t!=t&&e!=e:function(t,e,n,s,r,a){var o=qa(t),h=qa(e),l=o?m:dr(t),u=h?m:dr(e),c=(l=l==f?E:l)==E,d=(u=u==f?E:u)==E,p=l==u;if(p&&$a(t)){if(!$a(e))return!1;o=!0,c=!1}if(p&&!c)return a||(a=new Yi),o||lo(t)?Ks(t,e,n,s,r,a):function(t,e,i,n,s,r,a){switch(i){case B:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case L:return!(t.byteLength!=e.byteLength||!r(new Vt(t),new Vt(e)));case g:case y:case S:return Wa(+t,+e);case v:return t.name==e.name&&t.message==e.message;case A:case C:return t==e+"";case _:var o=ri;case T:var h=1&n;if(o||(o=hi),t.size!=e.size&&!h)return!1;var l=a.get(t);if(l)return l==e;n|=2,a.set(t,e);var u=Ks(o(t),o(e),n,s,r,a);return a.delete(t),u;case I:if(Ni)return Ni.call(t)==Ni.call(e)}return!1}(t,e,l,n,s,r,a);if(!(1&n)){var x=c&&kt.call(t,"__wrapped__"),b=d&&kt.call(e,"__wrapped__");if(x||b){var w=x?t.value():t,M=b?e.value():e;return a||(a=new Yi),r(w,M,n,s,a)}}if(!p)return!1;return a||(a=new Yi),function(t,e,n,s,r,a){var o=1&n,h=er(t),l=h.length,u=er(e),c=u.length;if(l!=c&&!o)return!1;var d=l;for(;d--;){var p=h[d];if(!(o?p in e:kt.call(e,p)))return!1}var f=a.get(t),m=a.get(e);if(f&&m)return f==e&&m==t;var g=!0;a.set(t,e),a.set(e,t);var y=o;for(;++d<l;){var v=t[p=h[d]],x=e[p];if(s)var b=o?s(x,v,p,e,t,a):s(v,x,p,t,e,a);if(!(b===i?v===x||r(v,x,n,s,a):b)){g=!1;break}y||(y="constructor"==p)}if(g&&!y){var w=t.constructor,_=e.constructor;w==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof w&&w instanceof w&&"function"==typeof _&&_ instanceof _||(g=!1)}return a.delete(t),a.delete(e),g}(t,e,n,s,r,a)}(t,e,n,s,Dn,r))}function Ln(t,e,n,s){var r=n.length,a=r,o=!s;if(null==t)return!a;for(t=Mt(t);r--;){var h=n[r];if(o&&h[2]?h[1]!==t[h[0]]:!(h[0]in t))return!1}for(;++r<a;){var l=(h=n[r])[0],u=t[l],c=h[1];if(o&&h[2]){if(u===i&&!(l in t))return!1}else{var d=new Yi;if(s)var p=s(u,c,l,t,e,d);if(!(p===i?Dn(c,u,3,s,d):p))return!1}}return!0}function Bn(t){return!(!to(t)||(e=t,Ot&&Ot in e))&&(Ja(t)?Wt:mt).test(zr(t));var e}function Pn(t){return"function"==typeof t?t:null==t?sh:"object"==typeof t?qa(t)?Hn(t[0],t[1]):zn(t):ph(t)}function kn(t){if(!wr(t))return fi(t);var e=[];for(var i in Mt(t))kt.call(t,i)&&"constructor"!=i&&e.push(i);return e}function Nn(t){if(!to(t))return function(t){var e=[];if(null!=t)for(var i in Mt(t))e.push(i);return e}(t);var e=wr(t),i=[];for(var n in t)("constructor"!=n||!e&&kt.call(t,n))&&i.push(n);return i}function On(t,e){return t<e}function Rn(t,e){var i=-1,n=Ya(t)?st(t.length):[];return un(t,(function(t,s,r){n[++i]=e(t,s,r)})),n}function zn(t){var e=hr(t);return 1==e.length&&e[0][2]?Sr(e[0][0],e[0][1]):function(i){return i===t||Ln(i,t,e)}}function Hn(t,e){return vr(t)&&_r(e)?Sr(Rr(t),e):function(n){var s=To(n,t);return s===i&&s===e?Co(n,t):Dn(e,s,3)}}function Wn(t,e,n,s,r){t!==e&&gn(e,(function(a,o){if(r||(r=new Yi),to(a))!function(t,e,n,s,r,a,o){var h=Ar(t,n),l=Ar(e,n),u=o.get(l);if(u)return void Ji(t,n,u);var c=a?a(h,l,n+"",t,e,o):i,d=c===i;if(d){var p=qa(l),f=!p&&$a(l),m=!p&&!f&&lo(l);c=l,p||f||m?qa(h)?c=h:Ga(h)?c=Ts(h):f?(d=!1,c=ws(l,!0)):m?(d=!1,c=Ss(l,!0)):c=[]:so(l)||Va(l)?(c=h,Va(h)?c=vo(h):to(h)&&!Ja(h)||(c=fr(l))):d=!1}d&&(o.set(l,c),r(c,l,s,a,o),o.delete(l));Ji(t,n,c)}(t,e,o,n,Wn,s,r);else{var h=s?s(Ar(t,o),a,o+"",t,e,r):i;h===i&&(h=a),Ji(t,o,h)}}),Po)}function Fn(t,e){var n=t.length;if(n)return gr(e+=e<0?n:0,n)?t[e]:i}function Un(t,e,i){e=e.length?Be(e,(function(t){return qa(t)?function(e){return wn(e,1===t.length?t[0]:t)}:t})):[sh];var n=-1;return e=Be(e,Ze(ar())),function(t,e){var i=t.length;for(t.sort(e);i--;)t[i]=t[i].value;return t}(Rn(t,(function(t,i,s){return{criteria:Be(e,(function(e){return e(t)})),index:++n,value:t}})),(function(t,e){return function(t,e,i){var n=-1,s=t.criteria,r=e.criteria,a=s.length,o=i.length;for(;++n<a;){var h=Es(s[n],r[n]);if(h)return n>=o?h:h*("desc"==i[n]?-1:1)}return t.index-e.index}(t,e,i)}))}function Vn(t,e,i){for(var n=-1,s=e.length,r={};++n<s;){var a=e[n],o=wn(t,a);i(o,a)&&Jn(r,ys(a,t),o)}return r}function qn(t,e,i,n){var s=n?Fe:We,r=-1,a=e.length,o=t;for(t===e&&(e=Ts(e)),i&&(o=Be(t,Ze(i)));++r<a;)for(var h=0,l=e[r],u=i?i(l):l;(h=s(o,u,h,n))>-1;)o!==t&&$t.call(o,h,1),$t.call(t,h,1);return t}function jn(t,e){for(var i=t?e.length:0,n=i-1;i--;){var s=e[i];if(i==n||s!==r){var r=s;gr(s)?$t.call(t,s,1):ls(t,s)}}return t}function Yn(t,e){return t+fe(xi()*(e-t+1))}function Gn(t,e){var i="";if(!t||e<1||e>u)return i;do{e%2&&(i+=t),(e=fe(e/2))&&(t+=t)}while(e);return i}function $n(t,e){return Ir(Er(t,e,sh),t+"")}function Xn(t){return $i(Fo(t))}function Zn(t,e){var i=Fo(t);return Br(i,rn(e,0,i.length))}function Jn(t,e,n,s){if(!to(t))return t;for(var r=-1,a=(e=ys(e,t)).length,o=a-1,h=t;null!=h&&++r<a;){var l=Rr(e[r]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(r!=o){var c=h[l];(u=s?s(c,l,h):i)===i&&(u=to(c)?c:gr(e[r+1])?[]:{})}Qi(h,l,u),h=h[l]}return t}var Qn=Ti?function(t,e){return Ti.set(t,e),t}:sh,Kn=ee?function(t,e){return ee(t,"toString",{configurable:!0,enumerable:!1,value:eh(e),writable:!0})}:sh;function ts(t){return Br(Fo(t))}function es(t,e,i){var n=-1,s=t.length;e<0&&(e=-e>s?0:s+e),(i=i>s?s:i)<0&&(i+=s),s=e>i?0:i-e>>>0,e>>>=0;for(var r=st(s);++n<s;)r[n]=t[n+e];return r}function is(t,e){var i;return un(t,(function(t,n,s){return!(i=e(t,n,s))})),!!i}function ns(t,e,i){var n=0,s=null==t?n:t.length;if("number"==typeof e&&e==e&&s<=2147483647){for(;n<s;){var r=n+s>>>1,a=t[r];null!==a&&!ho(a)&&(i?a<=e:a<e)?n=r+1:s=r}return s}return ss(t,e,sh,i)}function ss(t,e,n,s){var r=0,a=null==t?0:t.length;if(0===a)return 0;for(var o=(e=n(e))!=e,h=null===e,l=ho(e),u=e===i;r<a;){var c=fe((r+a)/2),d=n(t[c]),p=d!==i,f=null===d,m=d==d,g=ho(d);if(o)var y=s||m;else y=u?m&&(s||p):h?m&&p&&(s||!f):l?m&&p&&!f&&(s||!g):!f&&!g&&(s?d<=e:d<e);y?r=c+1:a=c}return gi(a,4294967294)}function rs(t,e){for(var i=-1,n=t.length,s=0,r=[];++i<n;){var a=t[i],o=e?e(a):a;if(!i||!Wa(o,h)){var h=o;r[s++]=0===a?0:a}}return r}function as(t){return"number"==typeof t?t:ho(t)?c:+t}function os(t){if("string"==typeof t)return t;if(qa(t))return Be(t,os)+"";if(ho(t))return Oi?Oi.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function hs(t,e,i){var n=-1,s=De,r=t.length,a=!0,o=[],h=o;if(i)a=!1,s=Le;else if(r>=200){var l=e?null:Gs(t);if(l)return hi(l);a=!1,s=Qe,h=new ji}else h=e?[]:o;t:for(;++n<r;){var u=t[n],c=e?e(u):u;if(u=i||0!==u?u:0,a&&c==c){for(var d=h.length;d--;)if(h[d]===c)continue t;e&&h.push(c),o.push(u)}else s(h,c,i)||(h!==o&&h.push(c),o.push(u))}return o}function ls(t,e){return null==(t=Mr(t,e=ys(e,t)))||delete t[Rr(Zr(e))]}function us(t,e,i,n){return Jn(t,e,i(wn(t,e)),n)}function cs(t,e,i,n){for(var s=t.length,r=n?s:-1;(n?r--:++r<s)&&e(t[r],r,t););return i?es(t,n?0:r,n?r+1:s):es(t,n?r+1:0,n?s:r)}function ds(t,e){var i=t;return i instanceof Fi&&(i=i.value()),ke(e,(function(t,e){return e.func.apply(e.thisArg,Pe([t],e.args))}),i)}function ps(t,e,i){var n=t.length;if(n<2)return n?hs(t[0]):[];for(var s=-1,r=st(n);++s<n;)for(var a=t[s],o=-1;++o<n;)o!=s&&(r[s]=ln(r[s]||a,t[o],e,i));return hs(mn(r,1),e,i)}function fs(t,e,n){for(var s=-1,r=t.length,a=e.length,o={};++s<r;){var h=s<a?e[s]:i;n(o,t[s],h)}return o}function ms(t){return Ga(t)?t:[]}function gs(t){return"function"==typeof t?t:sh}function ys(t,e){return qa(t)?t:vr(t,e)?[t]:Or(xo(t))}var vs=$n;function xs(t,e,n){var s=t.length;return n=n===i?s:n,!e&&n>=s?t:es(t,e,n)}var bs=oe||function(t){return de.clearTimeout(t)};function ws(t,e){if(e)return t.slice();var i=t.length,n=qt?qt(i):new t.constructor(i);return t.copy(n),n}function _s(t){var e=new t.constructor(t.byteLength);return new Vt(e).set(new Vt(t)),e}function Ss(t,e){var i=e?_s(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}function Es(t,e){if(t!==e){var n=t!==i,s=null===t,r=t==t,a=ho(t),o=e!==i,h=null===e,l=e==e,u=ho(e);if(!h&&!u&&!a&&t>e||a&&o&&l&&!h&&!u||s&&o&&l||!n&&l||!r)return 1;if(!s&&!a&&!u&&t<e||u&&n&&r&&!s&&!a||h&&n&&r||!o&&r||!l)return-1}return 0}function Ms(t,e,i,n){for(var s=-1,r=t.length,a=i.length,o=-1,h=e.length,l=mi(r-a,0),u=st(h+l),c=!n;++o<h;)u[o]=e[o];for(;++s<a;)(c||s<r)&&(u[i[s]]=t[s]);for(;l--;)u[o++]=t[s++];return u}function As(t,e,i,n){for(var s=-1,r=t.length,a=-1,o=i.length,h=-1,l=e.length,u=mi(r-o,0),c=st(u+l),d=!n;++s<u;)c[s]=t[s];for(var p=s;++h<l;)c[p+h]=e[h];for(;++a<o;)(d||s<r)&&(c[p+i[a]]=t[s++]);return c}function Ts(t,e){var i=-1,n=t.length;for(e||(e=st(n));++i<n;)e[i]=t[i];return e}function Cs(t,e,n,s){var r=!n;n||(n={});for(var a=-1,o=e.length;++a<o;){var h=e[a],l=s?s(n[h],t[h],h,n,t):i;l===i&&(l=t[h]),r?nn(n,h,l):Qi(n,h,l)}return n}function Is(t,e){return function(i,n){var s=qa(i)?Me:tn,r=e?e():{};return s(i,t,ar(n,2),r)}}function Ds(t){return $n((function(e,n){var s=-1,r=n.length,a=r>1?n[r-1]:i,o=r>2?n[2]:i;for(a=t.length>3&&"function"==typeof a?(r--,a):i,o&&yr(n[0],n[1],o)&&(a=r<3?i:a,r=1),e=Mt(e);++s<r;){var h=n[s];h&&t(e,h,s,a)}return e}))}function Ls(t,e){return function(i,n){if(null==i)return i;if(!Ya(i))return t(i,n);for(var s=i.length,r=e?s:-1,a=Mt(i);(e?r--:++r<s)&&!1!==n(a[r],r,a););return i}}function Bs(t){return function(e,i,n){for(var s=-1,r=Mt(e),a=n(e),o=a.length;o--;){var h=a[t?o:++s];if(!1===i(r[h],h,r))break}return e}}function Ps(t){return function(e){var n=si(e=xo(e))?ui(e):i,s=n?n[0]:e.charAt(0),r=n?xs(n,1).join(""):e.slice(1);return s[t]()+r}}function ks(t){return function(e){return ke(Qo(qo(e).replace(Jt,"")),t,"")}}function Ns(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var i=zi(t.prototype),n=t.apply(i,e);return to(n)?n:i}}function Os(t){return function(e,n,s){var r=Mt(e);if(!Ya(e)){var a=ar(n,3);e=Bo(e),n=function(t){return a(r[t],t,r)}}var o=t(e,n,s);return o>-1?r[a?e[o]:o]:i}}function Rs(t){return tr((function(e){var s=e.length,r=s,a=Wi.prototype.thru;for(t&&e.reverse();r--;){var o=e[r];if("function"!=typeof o)throw new Ct(n);if(a&&!h&&"wrapper"==sr(o))var h=new Wi([],!0)}for(r=h?r:s;++r<s;){var l=sr(o=e[r]),u="wrapper"==l?nr(o):i;h=u&&xr(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?h[sr(u[0])].apply(h,u[3]):1==o.length&&xr(o)?h[l]():h.thru(o)}return function(){var t=arguments,i=t[0];if(h&&1==t.length&&qa(i))return h.plant(i).value();for(var n=0,r=s?e[n].apply(this,t):i;++n<s;)r=e[n].call(this,r);return r}}))}function zs(t,e,n,s,r,a,h,l,u,c){var d=e&o,p=1&e,f=2&e,m=24&e,g=512&e,y=f?i:Ns(t);return function o(){for(var v=arguments.length,x=st(v),b=v;b--;)x[b]=arguments[b];if(m)var w=rr(o),_=function(t,e){for(var i=t.length,n=0;i--;)t[i]===e&&++n;return n}(x,w);if(s&&(x=Ms(x,s,r,m)),a&&(x=As(x,a,h,m)),v-=_,m&&v<c){var S=oi(x,w);return js(t,e,zs,o.placeholder,n,x,S,l,u,c-v)}var E=p?n:this,M=f?E[t]:t;return v=x.length,l?x=function(t,e){var n=t.length,s=gi(e.length,n),r=Ts(t);for(;s--;){var a=e[s];t[s]=gr(a,n)?r[a]:i}return t}(x,l):g&&v>1&&x.reverse(),d&&u<v&&(x.length=u),this&&this!==de&&this instanceof o&&(M=y||Ns(M)),M.apply(E,x)}}function Hs(t,e){return function(i,n){return function(t,e,i,n){return vn(t,(function(t,s,r){e(n,i(t),s,r)})),n}(i,t,e(n),{})}}function Ws(t,e){return function(n,s){var r;if(n===i&&s===i)return e;if(n!==i&&(r=n),s!==i){if(r===i)return s;"string"==typeof n||"string"==typeof s?(n=os(n),s=os(s)):(n=as(n),s=as(s)),r=t(n,s)}return r}}function Fs(t){return tr((function(e){return e=Be(e,Ze(ar())),$n((function(i){var n=this;return t(e,(function(t){return Ee(t,n,i)}))}))}))}function Us(t,e){var n=(e=e===i?" ":os(e)).length;if(n<2)return n?Gn(e,t):e;var s=Gn(e,pe(t/li(e)));return si(e)?xs(ui(s),0,t).join(""):s.slice(0,t)}function Vs(t){return function(e,n,s){return s&&"number"!=typeof s&&yr(e,n,s)&&(n=s=i),e=fo(e),n===i?(n=e,e=0):n=fo(n),function(t,e,i,n){for(var s=-1,r=mi(pe((e-t)/(i||1)),0),a=st(r);r--;)a[n?r:++s]=t,t+=i;return a}(e,n,s=s===i?e<n?1:-1:fo(s),t)}}function qs(t){return function(e,i){return"string"==typeof e&&"string"==typeof i||(e=yo(e),i=yo(i)),t(e,i)}}function js(t,e,n,s,r,o,h,l,u,c){var d=8&e;e|=d?a:64,4&(e&=~(d?64:a))||(e&=-4);var p=[t,e,r,d?o:i,d?h:i,d?i:o,d?i:h,l,u,c],f=n.apply(i,p);return xr(t)&&Tr(f,p),f.placeholder=s,Dr(f,t,e)}function Ys(t){var e=Et[t];return function(t,i){if(t=yo(t),(i=null==i?0:gi(mo(i),292))&&Re(t)){var n=(xo(t)+"e").split("e");return+((n=(xo(e(n[0]+"e"+(+n[1]+i)))+"e").split("e"))[0]+"e"+(+n[1]-i))}return e(t)}}var Gs=Ei&&1/hi(new Ei([,-0]))[1]==l?function(t){return new Ei(t)}:lh;function $s(t){return function(e){var i=dr(e);return i==_?ri(e):i==T?function(t){var e=-1,i=Array(t.size);return t.forEach((function(t){i[++e]=[t,t]})),i}(e):function(t,e){return Be(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Xs(t,e,s,l,u,c,d,p){var f=2&e;if(!f&&"function"!=typeof t)throw new Ct(n);var m=l?l.length:0;if(m||(e&=-97,l=u=i),d=d===i?d:mi(mo(d),0),p=p===i?p:mo(p),m-=u?u.length:0,64&e){var g=l,y=u;l=u=i}var v=f?i:nr(t),x=[t,e,s,l,u,g,y,c,d,p];if(v&&function(t,e){var i=t[1],n=e[1],s=i|n,a=s<131,l=n==o&&8==i||n==o&&i==h&&t[7].length<=e[8]||384==n&&e[7].length<=e[8]&&8==i;if(!a&&!l)return t;1&n&&(t[2]=e[2],s|=1&i?0:4);var u=e[3];if(u){var c=t[3];t[3]=c?Ms(c,u,e[4]):u,t[4]=c?oi(t[3],r):e[4]}(u=e[5])&&(c=t[5],t[5]=c?As(c,u,e[6]):u,t[6]=c?oi(t[5],r):e[6]);(u=e[7])&&(t[7]=u);n&o&&(t[8]=null==t[8]?e[8]:gi(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=s}(x,v),t=x[0],e=x[1],s=x[2],l=x[3],u=x[4],!(p=x[9]=x[9]===i?f?0:t.length:mi(x[9]-m,0))&&24&e&&(e&=-25),e&&1!=e)b=8==e||16==e?function(t,e,n){var s=Ns(t);return function r(){for(var a=arguments.length,o=st(a),h=a,l=rr(r);h--;)o[h]=arguments[h];var u=a<3&&o[0]!==l&&o[a-1]!==l?[]:oi(o,l);return(a-=u.length)<n?js(t,e,zs,r.placeholder,i,o,u,i,i,n-a):Ee(this&&this!==de&&this instanceof r?s:t,this,o)}}(t,e,p):e!=a&&33!=e||u.length?zs.apply(i,x):function(t,e,i,n){var s=1&e,r=Ns(t);return function e(){for(var a=-1,o=arguments.length,h=-1,l=n.length,u=st(l+o),c=this&&this!==de&&this instanceof e?r:t;++h<l;)u[h]=n[h];for(;o--;)u[h++]=arguments[++a];return Ee(c,s?i:this,u)}}(t,e,s,l);else var b=function(t,e,i){var n=1&e,s=Ns(t);return function e(){return(this&&this!==de&&this instanceof e?s:t).apply(n?i:this,arguments)}}(t,e,s);return Dr((v?Qn:Tr)(b,x),t,e)}function Zs(t,e,n,s){return t===i||Wa(t,Lt[n])&&!kt.call(s,n)?e:t}function Js(t,e,n,s,r,a){return to(t)&&to(e)&&(a.set(e,t),Wn(t,e,i,Js,a),a.delete(e)),t}function Qs(t){return so(t)?i:t}function Ks(t,e,n,s,r,a){var o=1&n,h=t.length,l=e.length;if(h!=l&&!(o&&l>h))return!1;var u=a.get(t),c=a.get(e);if(u&&c)return u==e&&c==t;var d=-1,p=!0,f=2&n?new ji:i;for(a.set(t,e),a.set(e,t);++d<h;){var m=t[d],g=e[d];if(s)var y=o?s(g,m,d,e,t,a):s(m,g,d,t,e,a);if(y!==i){if(y)continue;p=!1;break}if(f){if(!Oe(e,(function(t,e){if(!Qe(f,e)&&(m===t||r(m,t,n,s,a)))return f.push(e)}))){p=!1;break}}else if(m!==g&&!r(m,g,n,s,a)){p=!1;break}}return a.delete(t),a.delete(e),p}function tr(t){return Ir(Er(t,i,jr),t+"")}function er(t){return _n(t,Bo,ur)}function ir(t){return _n(t,Po,cr)}var nr=Ti?function(t){return Ti.get(t)}:lh;function sr(t){for(var e=t.name+"",i=Ci[e],n=kt.call(Ci,e)?i.length:0;n--;){var s=i[n],r=s.func;if(null==r||r==t)return s.name}return e}function rr(t){return(kt.call(Ri,"placeholder")?Ri:t).placeholder}function ar(){var t=Ri.iteratee||rh;return t=t===rh?Pn:t,arguments.length?t(arguments[0],arguments[1]):t}function or(t,e){var i,n,s=t.__data__;return("string"==(n=typeof(i=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==i:null===i)?s["string"==typeof e?"string":"hash"]:s.map}function hr(t){for(var e=Bo(t),i=e.length;i--;){var n=e[i],s=t[n];e[i]=[n,s,_r(s)]}return e}function lr(t,e){var n=function(t,e){return null==t?i:t[e]}(t,e);return Bn(n)?n:i}var ur=ge?function(t){return null==t?[]:(t=Mt(t),Ie(ge(t),(function(e){return Gt.call(t,e)})))}:gh,cr=ge?function(t){for(var e=[];t;)Pe(e,ur(t)),t=jt(t);return e}:gh,dr=Sn;function pr(t,e,i){for(var n=-1,s=(e=ys(e,t)).length,r=!1;++n<s;){var a=Rr(e[n]);if(!(r=null!=t&&i(t,a)))break;t=t[a]}return r||++n!=s?r:!!(s=null==t?0:t.length)&&Ka(s)&&gr(a,s)&&(qa(t)||Va(t))}function fr(t){return"function"!=typeof t.constructor||wr(t)?{}:zi(jt(t))}function mr(t){return qa(t)||Va(t)||!!(Xt&&t&&t[Xt])}function gr(t,e){var i=typeof t;return!!(e=null==e?u:e)&&("number"==i||"symbol"!=i&&yt.test(t))&&t>-1&&t%1==0&&t<e}function yr(t,e,i){if(!to(i))return!1;var n=typeof e;return!!("number"==n?Ya(i)&&gr(e,i.length):"string"==n&&e in i)&&Wa(i[e],t)}function vr(t,e){if(qa(t))return!1;var i=typeof t;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=t&&!ho(t))||(K.test(t)||!Q.test(t)||null!=e&&t in Mt(e))}function xr(t){var e=sr(t),i=Ri[e];if("function"!=typeof i||!(e in Fi.prototype))return!1;if(t===i)return!0;var n=nr(i);return!!n&&t===n[0]}(wi&&dr(new wi(new ArrayBuffer(1)))!=B||_i&&dr(new _i)!=_||Si&&dr(Si.resolve())!=M||Ei&&dr(new Ei)!=T||Mi&&dr(new Mi)!=D)&&(dr=function(t){var e=Sn(t),n=e==E?t.constructor:i,s=n?zr(n):"";if(s)switch(s){case Ii:return B;case Di:return _;case Li:return M;case Bi:return T;case Pi:return D}return e});var br=Bt?Ja:yh;function wr(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Lt)}function _r(t){return t==t&&!to(t)}function Sr(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==i||t in Mt(n)))}}function Er(t,e,n){return e=mi(e===i?t.length-1:e,0),function(){for(var i=arguments,s=-1,r=mi(i.length-e,0),a=st(r);++s<r;)a[s]=i[e+s];s=-1;for(var o=st(e+1);++s<e;)o[s]=i[s];return o[e]=n(a),Ee(t,this,o)}}function Mr(t,e){return e.length<2?t:wn(t,es(e,0,-1))}function Ar(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Tr=Lr(Qn),Cr=ce||function(t,e){return de.setTimeout(t,e)},Ir=Lr(Kn);function Dr(t,e,i){var n=e+"";return Ir(t,function(t,e){var i=e.length;if(!i)return t;var n=i-1;return e[n]=(i>1?"& ":"")+e[n],e=e.join(i>2?", ":" "),t.replace(rt,"{\n/* [wrapped with "+e+"] */\n")}(n,function(t,e){return Ae(p,(function(i){var n="_."+i[0];e&i[1]&&!De(t,n)&&t.push(n)})),t.sort()}(function(t){var e=t.match(at);return e?e[1].split(ot):[]}(n),i)))}function Lr(t){var e=0,n=0;return function(){var s=yi(),r=16-(s-n);if(n=s,r>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function Br(t,e){var n=-1,s=t.length,r=s-1;for(e=e===i?s:e;++n<e;){var a=Yn(n,r),o=t[a];t[a]=t[n],t[n]=o}return t.length=e,t}var Pr,kr,Nr,Or=(Pr=function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(tt,(function(t,i,n,s){e.push(n?s.replace(ut,"$1"):i||t)})),e},kr=ka(Pr,(function(t){return 500===Nr.size&&Nr.clear(),t})),Nr=kr.cache,kr);function Rr(t){if("string"==typeof t||ho(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function zr(t){if(null!=t){try{return Pt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Hr(t){if(t instanceof Fi)return t.clone();var e=new Wi(t.__wrapped__,t.__chain__);return e.__actions__=Ts(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Wr=$n((function(t,e){return Ga(t)?ln(t,mn(e,1,Ga,!0)):[]})),Fr=$n((function(t,e){var n=Zr(e);return Ga(n)&&(n=i),Ga(t)?ln(t,mn(e,1,Ga,!0),ar(n,2)):[]})),Ur=$n((function(t,e){var n=Zr(e);return Ga(n)&&(n=i),Ga(t)?ln(t,mn(e,1,Ga,!0),i,n):[]}));function Vr(t,e,i){var n=null==t?0:t.length;if(!n)return-1;var s=null==i?0:mo(i);return s<0&&(s=mi(n+s,0)),He(t,ar(e,3),s)}function qr(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var r=s-1;return n!==i&&(r=mo(n),r=n<0?mi(s+r,0):gi(r,s-1)),He(t,ar(e,3),r,!0)}function jr(t){return(null==t?0:t.length)?mn(t,1):[]}function Yr(t){return t&&t.length?t[0]:i}var Gr=$n((function(t){var e=Be(t,ms);return e.length&&e[0]===t[0]?Tn(e):[]})),$r=$n((function(t){var e=Zr(t),n=Be(t,ms);return e===Zr(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Tn(n,ar(e,2)):[]})),Xr=$n((function(t){var e=Zr(t),n=Be(t,ms);return(e="function"==typeof e?e:i)&&n.pop(),n.length&&n[0]===t[0]?Tn(n,i,e):[]}));function Zr(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Jr=$n(Qr);function Qr(t,e){return t&&t.length&&e&&e.length?qn(t,e):t}var Kr=tr((function(t,e){var i=null==t?0:t.length,n=sn(t,e);return jn(t,Be(e,(function(t){return gr(t,i)?+t:t})).sort(Es)),n}));function ta(t){return null==t?t:bi.call(t)}var ea=$n((function(t){return hs(mn(t,1,Ga,!0))})),ia=$n((function(t){var e=Zr(t);return Ga(e)&&(e=i),hs(mn(t,1,Ga,!0),ar(e,2))})),na=$n((function(t){var e=Zr(t);return e="function"==typeof e?e:i,hs(mn(t,1,Ga,!0),i,e)}));function sa(t){if(!t||!t.length)return[];var e=0;return t=Ie(t,(function(t){if(Ga(t))return e=mi(t.length,e),!0})),$e(e,(function(e){return Be(t,qe(e))}))}function ra(t,e){if(!t||!t.length)return[];var n=sa(t);return null==e?n:Be(n,(function(t){return Ee(e,i,t)}))}var aa=$n((function(t,e){return Ga(t)?ln(t,e):[]})),oa=$n((function(t){return ps(Ie(t,Ga))})),ha=$n((function(t){var e=Zr(t);return Ga(e)&&(e=i),ps(Ie(t,Ga),ar(e,2))})),la=$n((function(t){var e=Zr(t);return e="function"==typeof e?e:i,ps(Ie(t,Ga),i,e)})),ua=$n(sa);var ca=$n((function(t){var e=t.length,n=e>1?t[e-1]:i;return n="function"==typeof n?(t.pop(),n):i,ra(t,n)}));function da(t){var e=Ri(t);return e.__chain__=!0,e}function pa(t,e){return e(t)}var fa=tr((function(t){var e=t.length,n=e?t[0]:0,s=this.__wrapped__,r=function(e){return sn(e,t)};return!(e>1||this.__actions__.length)&&s instanceof Fi&&gr(n)?((s=s.slice(n,+n+(e?1:0))).__actions__.push({func:pa,args:[r],thisArg:i}),new Wi(s,this.__chain__).thru((function(t){return e&&!t.length&&t.push(i),t}))):this.thru(r)}));var ma=Is((function(t,e,i){kt.call(t,i)?++t[i]:nn(t,i,1)}));var ga=Os(Vr),ya=Os(qr);function va(t,e){return(qa(t)?Ae:un)(t,ar(e,3))}function xa(t,e){return(qa(t)?Te:cn)(t,ar(e,3))}var ba=Is((function(t,e,i){kt.call(t,i)?t[i].push(e):nn(t,i,[e])}));var wa=$n((function(t,e,i){var n=-1,s="function"==typeof e,r=Ya(t)?st(t.length):[];return un(t,(function(t){r[++n]=s?Ee(e,t,i):Cn(t,e,i)})),r})),_a=Is((function(t,e,i){nn(t,i,e)}));function Sa(t,e){return(qa(t)?Be:Rn)(t,ar(e,3))}var Ea=Is((function(t,e,i){t[i?0:1].push(e)}),(function(){return[[],[]]}));var Ma=$n((function(t,e){if(null==t)return[];var i=e.length;return i>1&&yr(t,e[0],e[1])?e=[]:i>2&&yr(e[0],e[1],e[2])&&(e=[e[0]]),Un(t,mn(e,1),[])})),Aa=ue||function(){return de.Date.now()};function Ta(t,e,n){return e=n?i:e,e=t&&null==e?t.length:e,Xs(t,o,i,i,i,i,e)}function Ca(t,e){var s;if("function"!=typeof e)throw new Ct(n);return t=mo(t),function(){return--t>0&&(s=e.apply(this,arguments)),t<=1&&(e=i),s}}var Ia=$n((function(t,e,i){var n=1;if(i.length){var s=oi(i,rr(Ia));n|=a}return Xs(t,n,e,i,s)})),Da=$n((function(t,e,i){var n=3;if(i.length){var s=oi(i,rr(Da));n|=a}return Xs(e,n,t,i,s)}));function La(t,e,s){var r,a,o,h,l,u,c=0,d=!1,p=!1,f=!0;if("function"!=typeof t)throw new Ct(n);function m(e){var n=r,s=a;return r=a=i,c=e,h=t.apply(s,n)}function g(t){var n=t-u;return u===i||n>=e||n<0||p&&t-c>=o}function y(){var t=Aa();if(g(t))return v(t);l=Cr(y,function(t){var i=e-(t-u);return p?gi(i,o-(t-c)):i}(t))}function v(t){return l=i,f&&r?m(t):(r=a=i,h)}function x(){var t=Aa(),n=g(t);if(r=arguments,a=this,u=t,n){if(l===i)return function(t){return c=t,l=Cr(y,e),d?m(t):h}(u);if(p)return bs(l),l=Cr(y,e),m(u)}return l===i&&(l=Cr(y,e)),h}return e=yo(e)||0,to(s)&&(d=!!s.leading,o=(p="maxWait"in s)?mi(yo(s.maxWait)||0,e):o,f="trailing"in s?!!s.trailing:f),x.cancel=function(){l!==i&&bs(l),c=0,r=u=a=l=i},x.flush=function(){return l===i?h:v(Aa())},x}var Ba=$n((function(t,e){return hn(t,1,e)})),Pa=$n((function(t,e,i){return hn(t,yo(e)||0,i)}));function ka(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Ct(n);var i=function(){var n=arguments,s=e?e.apply(this,n):n[0],r=i.cache;if(r.has(s))return r.get(s);var a=t.apply(this,n);return i.cache=r.set(s,a)||r,a};return i.cache=new(ka.Cache||qi),i}function Na(t){if("function"!=typeof t)throw new Ct(n);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}ka.Cache=qi;var Oa=vs((function(t,e){var i=(e=1==e.length&&qa(e[0])?Be(e[0],Ze(ar())):Be(mn(e,1),Ze(ar()))).length;return $n((function(n){for(var s=-1,r=gi(n.length,i);++s<r;)n[s]=e[s].call(this,n[s]);return Ee(t,this,n)}))})),Ra=$n((function(t,e){var n=oi(e,rr(Ra));return Xs(t,a,i,e,n)})),za=$n((function(t,e){var n=oi(e,rr(za));return Xs(t,64,i,e,n)})),Ha=tr((function(t,e){return Xs(t,h,i,i,i,e)}));function Wa(t,e){return t===e||t!=t&&e!=e}var Fa=qs(En),Ua=qs((function(t,e){return t>=e})),Va=In(function(){return arguments}())?In:function(t){return eo(t)&&kt.call(t,"callee")&&!Gt.call(t,"callee")},qa=st.isArray,ja=ve?Ze(ve):function(t){return eo(t)&&Sn(t)==L};function Ya(t){return null!=t&&Ka(t.length)&&!Ja(t)}function Ga(t){return eo(t)&&Ya(t)}var $a=ye||yh,Xa=xe?Ze(xe):function(t){return eo(t)&&Sn(t)==y};function Za(t){if(!eo(t))return!1;var e=Sn(t);return e==v||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!so(t)}function Ja(t){if(!to(t))return!1;var e=Sn(t);return e==x||e==b||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Qa(t){return"number"==typeof t&&t==mo(t)}function Ka(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=u}function to(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function eo(t){return null!=t&&"object"==typeof t}var io=be?Ze(be):function(t){return eo(t)&&dr(t)==_};function no(t){return"number"==typeof t||eo(t)&&Sn(t)==S}function so(t){if(!eo(t)||Sn(t)!=E)return!1;var e=jt(t);if(null===e)return!0;var i=kt.call(e,"constructor")&&e.constructor;return"function"==typeof i&&i instanceof i&&Pt.call(i)==zt}var ro=we?Ze(we):function(t){return eo(t)&&Sn(t)==A};var ao=_e?Ze(_e):function(t){return eo(t)&&dr(t)==T};function oo(t){return"string"==typeof t||!qa(t)&&eo(t)&&Sn(t)==C}function ho(t){return"symbol"==typeof t||eo(t)&&Sn(t)==I}var lo=Se?Ze(Se):function(t){return eo(t)&&Ka(t.length)&&!!re[Sn(t)]};var uo=qs(On),co=qs((function(t,e){return t<=e}));function po(t){if(!t)return[];if(Ya(t))return oo(t)?ui(t):Ts(t);if(Zt&&t[Zt])return function(t){for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}(t[Zt]());var e=dr(t);return(e==_?ri:e==T?hi:Fo)(t)}function fo(t){return t?(t=yo(t))===l||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function mo(t){var e=fo(t),i=e%1;return e==e?i?e-i:e:0}function go(t){return t?rn(mo(t),0,d):0}function yo(t){if("number"==typeof t)return t;if(ho(t))return c;if(to(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=to(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Xe(t);var i=ft.test(t);return i||gt.test(t)?le(t.slice(2),i?2:8):pt.test(t)?c:+t}function vo(t){return Cs(t,Po(t))}function xo(t){return null==t?"":os(t)}var bo=Ds((function(t,e){if(wr(e)||Ya(e))Cs(e,Bo(e),t);else for(var i in e)kt.call(e,i)&&Qi(t,i,e[i])})),wo=Ds((function(t,e){Cs(e,Po(e),t)})),_o=Ds((function(t,e,i,n){Cs(e,Po(e),t,n)})),So=Ds((function(t,e,i,n){Cs(e,Bo(e),t,n)})),Eo=tr(sn);var Mo=$n((function(t,e){t=Mt(t);var n=-1,s=e.length,r=s>2?e[2]:i;for(r&&yr(e[0],e[1],r)&&(s=1);++n<s;)for(var a=e[n],o=Po(a),h=-1,l=o.length;++h<l;){var u=o[h],c=t[u];(c===i||Wa(c,Lt[u])&&!kt.call(t,u))&&(t[u]=a[u])}return t})),Ao=$n((function(t){return t.push(i,Js),Ee(No,i,t)}));function To(t,e,n){var s=null==t?i:wn(t,e);return s===i?n:s}function Co(t,e){return null!=t&&pr(t,e,An)}var Io=Hs((function(t,e,i){null!=e&&"function"!=typeof e.toString&&(e=Rt.call(e)),t[e]=i}),eh(sh)),Do=Hs((function(t,e,i){null!=e&&"function"!=typeof e.toString&&(e=Rt.call(e)),kt.call(t,e)?t[e].push(i):t[e]=[i]}),ar),Lo=$n(Cn);function Bo(t){return Ya(t)?Gi(t):kn(t)}function Po(t){return Ya(t)?Gi(t,!0):Nn(t)}var ko=Ds((function(t,e,i){Wn(t,e,i)})),No=Ds((function(t,e,i,n){Wn(t,e,i,n)})),Oo=tr((function(t,e){var i={};if(null==t)return i;var n=!1;e=Be(e,(function(e){return e=ys(e,t),n||(n=e.length>1),e})),Cs(t,ir(t),i),n&&(i=an(i,7,Qs));for(var s=e.length;s--;)ls(i,e[s]);return i}));var Ro=tr((function(t,e){return null==t?{}:function(t,e){return Vn(t,e,(function(e,i){return Co(t,i)}))}(t,e)}));function zo(t,e){if(null==t)return{};var i=Be(ir(t),(function(t){return[t]}));return e=ar(e),Vn(t,i,(function(t,i){return e(t,i[0])}))}var Ho=$s(Bo),Wo=$s(Po);function Fo(t){return null==t?[]:Je(t,Bo(t))}var Uo=ks((function(t,e,i){return e=e.toLowerCase(),t+(i?Vo(e):e)}));function Vo(t){return Jo(xo(t).toLowerCase())}function qo(t){return(t=xo(t))&&t.replace(vt,ei).replace(Qt,"")}var jo=ks((function(t,e,i){return t+(i?"-":"")+e.toLowerCase()})),Yo=ks((function(t,e,i){return t+(i?" ":"")+e.toLowerCase()})),Go=Ps("toLowerCase");var $o=ks((function(t,e,i){return t+(i?"_":"")+e.toLowerCase()}));var Xo=ks((function(t,e,i){return t+(i?" ":"")+Jo(e)}));var Zo=ks((function(t,e,i){return t+(i?" ":"")+e.toUpperCase()})),Jo=Ps("toUpperCase");function Qo(t,e,n){return t=xo(t),(e=n?i:e)===i?function(t){return ie.test(t)}(t)?function(t){return t.match(te)||[]}(t):function(t){return t.match(ht)||[]}(t):t.match(e)||[]}var Ko=$n((function(t,e){try{return Ee(t,i,e)}catch(t){return Za(t)?t:new _t(t)}})),th=tr((function(t,e){return Ae(e,(function(e){e=Rr(e),nn(t,e,Ia(t[e],t))})),t}));function eh(t){return function(){return t}}var ih=Rs(),nh=Rs(!0);function sh(t){return t}function rh(t){return Pn("function"==typeof t?t:an(t,1))}var ah=$n((function(t,e){return function(i){return Cn(i,t,e)}})),oh=$n((function(t,e){return function(i){return Cn(t,i,e)}}));function hh(t,e,i){var n=Bo(e),s=bn(e,n);null!=i||to(e)&&(s.length||!n.length)||(i=e,e=t,t=this,s=bn(e,Bo(e)));var r=!(to(i)&&"chain"in i&&!i.chain),a=Ja(t);return Ae(s,(function(i){var n=e[i];t[i]=n,a&&(t.prototype[i]=function(){var e=this.__chain__;if(r||e){var i=t(this.__wrapped__);return(i.__actions__=Ts(this.__actions__)).push({func:n,args:arguments,thisArg:t}),i.__chain__=e,i}return n.apply(t,Pe([this.value()],arguments))})})),t}function lh(){}var uh=Fs(Be),ch=Fs(Ce),dh=Fs(Oe);function ph(t){return vr(t)?qe(Rr(t)):function(t){return function(e){return wn(e,t)}}(t)}var fh=Vs(),mh=Vs(!0);function gh(){return[]}function yh(){return!1}var vh=Ws((function(t,e){return t+e}),0),xh=Ys("ceil"),bh=Ws((function(t,e){return t/e}),1),wh=Ys("floor");var _h,Sh=Ws((function(t,e){return t*e}),1),Eh=Ys("round"),Mh=Ws((function(t,e){return t-e}),0);return Ri.after=function(t,e){if("function"!=typeof e)throw new Ct(n);return t=mo(t),function(){if(--t<1)return e.apply(this,arguments)}},Ri.ary=Ta,Ri.assign=bo,Ri.assignIn=wo,Ri.assignInWith=_o,Ri.assignWith=So,Ri.at=Eo,Ri.before=Ca,Ri.bind=Ia,Ri.bindAll=th,Ri.bindKey=Da,Ri.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return qa(t)?t:[t]},Ri.chain=da,Ri.chunk=function(t,e,n){e=(n?yr(t,e,n):e===i)?1:mi(mo(e),0);var s=null==t?0:t.length;if(!s||e<1)return[];for(var r=0,a=0,o=st(pe(s/e));r<s;)o[a++]=es(t,r,r+=e);return o},Ri.compact=function(t){for(var e=-1,i=null==t?0:t.length,n=0,s=[];++e<i;){var r=t[e];r&&(s[n++]=r)}return s},Ri.concat=function(){var t=arguments.length;if(!t)return[];for(var e=st(t-1),i=arguments[0],n=t;n--;)e[n-1]=arguments[n];return Pe(qa(i)?Ts(i):[i],mn(e,1))},Ri.cond=function(t){var e=null==t?0:t.length,i=ar();return t=e?Be(t,(function(t){if("function"!=typeof t[1])throw new Ct(n);return[i(t[0]),t[1]]})):[],$n((function(i){for(var n=-1;++n<e;){var s=t[n];if(Ee(s[0],this,i))return Ee(s[1],this,i)}}))},Ri.conforms=function(t){return function(t){var e=Bo(t);return function(i){return on(i,t,e)}}(an(t,1))},Ri.constant=eh,Ri.countBy=ma,Ri.create=function(t,e){var i=zi(t);return null==e?i:en(i,e)},Ri.curry=function t(e,n,s){var r=Xs(e,8,i,i,i,i,i,n=s?i:n);return r.placeholder=t.placeholder,r},Ri.curryRight=function t(e,n,s){var r=Xs(e,16,i,i,i,i,i,n=s?i:n);return r.placeholder=t.placeholder,r},Ri.debounce=La,Ri.defaults=Mo,Ri.defaultsDeep=Ao,Ri.defer=Ba,Ri.delay=Pa,Ri.difference=Wr,Ri.differenceBy=Fr,Ri.differenceWith=Ur,Ri.drop=function(t,e,n){var s=null==t?0:t.length;return s?es(t,(e=n||e===i?1:mo(e))<0?0:e,s):[]},Ri.dropRight=function(t,e,n){var s=null==t?0:t.length;return s?es(t,0,(e=s-(e=n||e===i?1:mo(e)))<0?0:e):[]},Ri.dropRightWhile=function(t,e){return t&&t.length?cs(t,ar(e,3),!0,!0):[]},Ri.dropWhile=function(t,e){return t&&t.length?cs(t,ar(e,3),!0):[]},Ri.fill=function(t,e,n,s){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&yr(t,e,n)&&(n=0,s=r),function(t,e,n,s){var r=t.length;for((n=mo(n))<0&&(n=-n>r?0:r+n),(s=s===i||s>r?r:mo(s))<0&&(s+=r),s=n>s?0:go(s);n<s;)t[n++]=e;return t}(t,e,n,s)):[]},Ri.filter=function(t,e){return(qa(t)?Ie:fn)(t,ar(e,3))},Ri.flatMap=function(t,e){return mn(Sa(t,e),1)},Ri.flatMapDeep=function(t,e){return mn(Sa(t,e),l)},Ri.flatMapDepth=function(t,e,n){return n=n===i?1:mo(n),mn(Sa(t,e),n)},Ri.flatten=jr,Ri.flattenDeep=function(t){return(null==t?0:t.length)?mn(t,l):[]},Ri.flattenDepth=function(t,e){return(null==t?0:t.length)?mn(t,e=e===i?1:mo(e)):[]},Ri.flip=function(t){return Xs(t,512)},Ri.flow=ih,Ri.flowRight=nh,Ri.fromPairs=function(t){for(var e=-1,i=null==t?0:t.length,n={};++e<i;){var s=t[e];n[s[0]]=s[1]}return n},Ri.functions=function(t){return null==t?[]:bn(t,Bo(t))},Ri.functionsIn=function(t){return null==t?[]:bn(t,Po(t))},Ri.groupBy=ba,Ri.initial=function(t){return(null==t?0:t.length)?es(t,0,-1):[]},Ri.intersection=Gr,Ri.intersectionBy=$r,Ri.intersectionWith=Xr,Ri.invert=Io,Ri.invertBy=Do,Ri.invokeMap=wa,Ri.iteratee=rh,Ri.keyBy=_a,Ri.keys=Bo,Ri.keysIn=Po,Ri.map=Sa,Ri.mapKeys=function(t,e){var i={};return e=ar(e,3),vn(t,(function(t,n,s){nn(i,e(t,n,s),t)})),i},Ri.mapValues=function(t,e){var i={};return e=ar(e,3),vn(t,(function(t,n,s){nn(i,n,e(t,n,s))})),i},Ri.matches=function(t){return zn(an(t,1))},Ri.matchesProperty=function(t,e){return Hn(t,an(e,1))},Ri.memoize=ka,Ri.merge=ko,Ri.mergeWith=No,Ri.method=ah,Ri.methodOf=oh,Ri.mixin=hh,Ri.negate=Na,Ri.nthArg=function(t){return t=mo(t),$n((function(e){return Fn(e,t)}))},Ri.omit=Oo,Ri.omitBy=function(t,e){return zo(t,Na(ar(e)))},Ri.once=function(t){return Ca(2,t)},Ri.orderBy=function(t,e,n,s){return null==t?[]:(qa(e)||(e=null==e?[]:[e]),qa(n=s?i:n)||(n=null==n?[]:[n]),Un(t,e,n))},Ri.over=uh,Ri.overArgs=Oa,Ri.overEvery=ch,Ri.overSome=dh,Ri.partial=Ra,Ri.partialRight=za,Ri.partition=Ea,Ri.pick=Ro,Ri.pickBy=zo,Ri.property=ph,Ri.propertyOf=function(t){return function(e){return null==t?i:wn(t,e)}},Ri.pull=Jr,Ri.pullAll=Qr,Ri.pullAllBy=function(t,e,i){return t&&t.length&&e&&e.length?qn(t,e,ar(i,2)):t},Ri.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?qn(t,e,i,n):t},Ri.pullAt=Kr,Ri.range=fh,Ri.rangeRight=mh,Ri.rearg=Ha,Ri.reject=function(t,e){return(qa(t)?Ie:fn)(t,Na(ar(e,3)))},Ri.remove=function(t,e){var i=[];if(!t||!t.length)return i;var n=-1,s=[],r=t.length;for(e=ar(e,3);++n<r;){var a=t[n];e(a,n,t)&&(i.push(a),s.push(n))}return jn(t,s),i},Ri.rest=function(t,e){if("function"!=typeof t)throw new Ct(n);return $n(t,e=e===i?e:mo(e))},Ri.reverse=ta,Ri.sampleSize=function(t,e,n){return e=(n?yr(t,e,n):e===i)?1:mo(e),(qa(t)?Xi:Zn)(t,e)},Ri.set=function(t,e,i){return null==t?t:Jn(t,e,i)},Ri.setWith=function(t,e,n,s){return s="function"==typeof s?s:i,null==t?t:Jn(t,e,n,s)},Ri.shuffle=function(t){return(qa(t)?Zi:ts)(t)},Ri.slice=function(t,e,n){var s=null==t?0:t.length;return s?(n&&"number"!=typeof n&&yr(t,e,n)?(e=0,n=s):(e=null==e?0:mo(e),n=n===i?s:mo(n)),es(t,e,n)):[]},Ri.sortBy=Ma,Ri.sortedUniq=function(t){return t&&t.length?rs(t):[]},Ri.sortedUniqBy=function(t,e){return t&&t.length?rs(t,ar(e,2)):[]},Ri.split=function(t,e,n){return n&&"number"!=typeof n&&yr(t,e,n)&&(e=n=i),(n=n===i?d:n>>>0)?(t=xo(t))&&("string"==typeof e||null!=e&&!ro(e))&&!(e=os(e))&&si(t)?xs(ui(t),0,n):t.split(e,n):[]},Ri.spread=function(t,e){if("function"!=typeof t)throw new Ct(n);return e=null==e?0:mi(mo(e),0),$n((function(i){var n=i[e],s=xs(i,0,e);return n&&Pe(s,n),Ee(t,this,s)}))},Ri.tail=function(t){var e=null==t?0:t.length;return e?es(t,1,e):[]},Ri.take=function(t,e,n){return t&&t.length?es(t,0,(e=n||e===i?1:mo(e))<0?0:e):[]},Ri.takeRight=function(t,e,n){var s=null==t?0:t.length;return s?es(t,(e=s-(e=n||e===i?1:mo(e)))<0?0:e,s):[]},Ri.takeRightWhile=function(t,e){return t&&t.length?cs(t,ar(e,3),!1,!0):[]},Ri.takeWhile=function(t,e){return t&&t.length?cs(t,ar(e,3)):[]},Ri.tap=function(t,e){return e(t),t},Ri.throttle=function(t,e,i){var s=!0,r=!0;if("function"!=typeof t)throw new Ct(n);return to(i)&&(s="leading"in i?!!i.leading:s,r="trailing"in i?!!i.trailing:r),La(t,e,{leading:s,maxWait:e,trailing:r})},Ri.thru=pa,Ri.toArray=po,Ri.toPairs=Ho,Ri.toPairsIn=Wo,Ri.toPath=function(t){return qa(t)?Be(t,Rr):ho(t)?[t]:Ts(Or(xo(t)))},Ri.toPlainObject=vo,Ri.transform=function(t,e,i){var n=qa(t),s=n||$a(t)||lo(t);if(e=ar(e,4),null==i){var r=t&&t.constructor;i=s?n?new r:[]:to(t)&&Ja(r)?zi(jt(t)):{}}return(s?Ae:vn)(t,(function(t,n,s){return e(i,t,n,s)})),i},Ri.unary=function(t){return Ta(t,1)},Ri.union=ea,Ri.unionBy=ia,Ri.unionWith=na,Ri.uniq=function(t){return t&&t.length?hs(t):[]},Ri.uniqBy=function(t,e){return t&&t.length?hs(t,ar(e,2)):[]},Ri.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?hs(t,i,e):[]},Ri.unset=function(t,e){return null==t||ls(t,e)},Ri.unzip=sa,Ri.unzipWith=ra,Ri.update=function(t,e,i){return null==t?t:us(t,e,gs(i))},Ri.updateWith=function(t,e,n,s){return s="function"==typeof s?s:i,null==t?t:us(t,e,gs(n),s)},Ri.values=Fo,Ri.valuesIn=function(t){return null==t?[]:Je(t,Po(t))},Ri.without=aa,Ri.words=Qo,Ri.wrap=function(t,e){return Ra(gs(e),t)},Ri.xor=oa,Ri.xorBy=ha,Ri.xorWith=la,Ri.zip=ua,Ri.zipObject=function(t,e){return fs(t||[],e||[],Qi)},Ri.zipObjectDeep=function(t,e){return fs(t||[],e||[],Jn)},Ri.zipWith=ca,Ri.entries=Ho,Ri.entriesIn=Wo,Ri.extend=wo,Ri.extendWith=_o,hh(Ri,Ri),Ri.add=vh,Ri.attempt=Ko,Ri.camelCase=Uo,Ri.capitalize=Vo,Ri.ceil=xh,Ri.clamp=function(t,e,n){return n===i&&(n=e,e=i),n!==i&&(n=(n=yo(n))==n?n:0),e!==i&&(e=(e=yo(e))==e?e:0),rn(yo(t),e,n)},Ri.clone=function(t){return an(t,4)},Ri.cloneDeep=function(t){return an(t,5)},Ri.cloneDeepWith=function(t,e){return an(t,5,e="function"==typeof e?e:i)},Ri.cloneWith=function(t,e){return an(t,4,e="function"==typeof e?e:i)},Ri.conformsTo=function(t,e){return null==e||on(t,e,Bo(e))},Ri.deburr=qo,Ri.defaultTo=function(t,e){return null==t||t!=t?e:t},Ri.divide=bh,Ri.endsWith=function(t,e,n){t=xo(t),e=os(e);var s=t.length,r=n=n===i?s:rn(mo(n),0,s);return(n-=e.length)>=0&&t.slice(n,r)==e},Ri.eq=Wa,Ri.escape=function(t){return(t=xo(t))&&$.test(t)?t.replace(Y,ii):t},Ri.escapeRegExp=function(t){return(t=xo(t))&&it.test(t)?t.replace(et,"\\$&"):t},Ri.every=function(t,e,n){var s=qa(t)?Ce:dn;return n&&yr(t,e,n)&&(e=i),s(t,ar(e,3))},Ri.find=ga,Ri.findIndex=Vr,Ri.findKey=function(t,e){return ze(t,ar(e,3),vn)},Ri.findLast=ya,Ri.findLastIndex=qr,Ri.findLastKey=function(t,e){return ze(t,ar(e,3),xn)},Ri.floor=wh,Ri.forEach=va,Ri.forEachRight=xa,Ri.forIn=function(t,e){return null==t?t:gn(t,ar(e,3),Po)},Ri.forInRight=function(t,e){return null==t?t:yn(t,ar(e,3),Po)},Ri.forOwn=function(t,e){return t&&vn(t,ar(e,3))},Ri.forOwnRight=function(t,e){return t&&xn(t,ar(e,3))},Ri.get=To,Ri.gt=Fa,Ri.gte=Ua,Ri.has=function(t,e){return null!=t&&pr(t,e,Mn)},Ri.hasIn=Co,Ri.head=Yr,Ri.identity=sh,Ri.includes=function(t,e,i,n){t=Ya(t)?t:Fo(t),i=i&&!n?mo(i):0;var s=t.length;return i<0&&(i=mi(s+i,0)),oo(t)?i<=s&&t.indexOf(e,i)>-1:!!s&&We(t,e,i)>-1},Ri.indexOf=function(t,e,i){var n=null==t?0:t.length;if(!n)return-1;var s=null==i?0:mo(i);return s<0&&(s=mi(n+s,0)),We(t,e,s)},Ri.inRange=function(t,e,n){return e=fo(e),n===i?(n=e,e=0):n=fo(n),function(t,e,i){return t>=gi(e,i)&&t<mi(e,i)}(t=yo(t),e,n)},Ri.invoke=Lo,Ri.isArguments=Va,Ri.isArray=qa,Ri.isArrayBuffer=ja,Ri.isArrayLike=Ya,Ri.isArrayLikeObject=Ga,Ri.isBoolean=function(t){return!0===t||!1===t||eo(t)&&Sn(t)==g},Ri.isBuffer=$a,Ri.isDate=Xa,Ri.isElement=function(t){return eo(t)&&1===t.nodeType&&!so(t)},Ri.isEmpty=function(t){if(null==t)return!0;if(Ya(t)&&(qa(t)||"string"==typeof t||"function"==typeof t.splice||$a(t)||lo(t)||Va(t)))return!t.length;var e=dr(t);if(e==_||e==T)return!t.size;if(wr(t))return!kn(t).length;for(var i in t)if(kt.call(t,i))return!1;return!0},Ri.isEqual=function(t,e){return Dn(t,e)},Ri.isEqualWith=function(t,e,n){var s=(n="function"==typeof n?n:i)?n(t,e):i;return s===i?Dn(t,e,i,n):!!s},Ri.isError=Za,Ri.isFinite=function(t){return"number"==typeof t&&Re(t)},Ri.isFunction=Ja,Ri.isInteger=Qa,Ri.isLength=Ka,Ri.isMap=io,Ri.isMatch=function(t,e){return t===e||Ln(t,e,hr(e))},Ri.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,Ln(t,e,hr(e),n)},Ri.isNaN=function(t){return no(t)&&t!=+t},Ri.isNative=function(t){if(br(t))throw new _t("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Bn(t)},Ri.isNil=function(t){return null==t},Ri.isNull=function(t){return null===t},Ri.isNumber=no,Ri.isObject=to,Ri.isObjectLike=eo,Ri.isPlainObject=so,Ri.isRegExp=ro,Ri.isSafeInteger=function(t){return Qa(t)&&t>=-9007199254740991&&t<=u},Ri.isSet=ao,Ri.isString=oo,Ri.isSymbol=ho,Ri.isTypedArray=lo,Ri.isUndefined=function(t){return t===i},Ri.isWeakMap=function(t){return eo(t)&&dr(t)==D},Ri.isWeakSet=function(t){return eo(t)&&"[object WeakSet]"==Sn(t)},Ri.join=function(t,e){return null==t?"":je.call(t,e)},Ri.kebabCase=jo,Ri.last=Zr,Ri.lastIndexOf=function(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var r=s;return n!==i&&(r=(r=mo(n))<0?mi(s+r,0):gi(r,s-1)),e==e?function(t,e,i){for(var n=i+1;n--;)if(t[n]===e)return n;return n}(t,e,r):He(t,Ue,r,!0)},Ri.lowerCase=Yo,Ri.lowerFirst=Go,Ri.lt=uo,Ri.lte=co,Ri.max=function(t){return t&&t.length?pn(t,sh,En):i},Ri.maxBy=function(t,e){return t&&t.length?pn(t,ar(e,2),En):i},Ri.mean=function(t){return Ve(t,sh)},Ri.meanBy=function(t,e){return Ve(t,ar(e,2))},Ri.min=function(t){return t&&t.length?pn(t,sh,On):i},Ri.minBy=function(t,e){return t&&t.length?pn(t,ar(e,2),On):i},Ri.stubArray=gh,Ri.stubFalse=yh,Ri.stubObject=function(){return{}},Ri.stubString=function(){return""},Ri.stubTrue=function(){return!0},Ri.multiply=Sh,Ri.nth=function(t,e){return t&&t.length?Fn(t,mo(e)):i},Ri.noConflict=function(){return de._===this&&(de._=Ht),this},Ri.noop=lh,Ri.now=Aa,Ri.pad=function(t,e,i){t=xo(t);var n=(e=mo(e))?li(t):0;if(!e||n>=e)return t;var s=(e-n)/2;return Us(fe(s),i)+t+Us(pe(s),i)},Ri.padEnd=function(t,e,i){t=xo(t);var n=(e=mo(e))?li(t):0;return e&&n<e?t+Us(e-n,i):t},Ri.padStart=function(t,e,i){t=xo(t);var n=(e=mo(e))?li(t):0;return e&&n<e?Us(e-n,i)+t:t},Ri.parseInt=function(t,e,i){return i||null==e?e=0:e&&(e=+e),vi(xo(t).replace(nt,""),e||0)},Ri.random=function(t,e,n){if(n&&"boolean"!=typeof n&&yr(t,e,n)&&(e=n=i),n===i&&("boolean"==typeof e?(n=e,e=i):"boolean"==typeof t&&(n=t,t=i)),t===i&&e===i?(t=0,e=1):(t=fo(t),e===i?(e=t,t=0):e=fo(e)),t>e){var s=t;t=e,e=s}if(n||t%1||e%1){var r=xi();return gi(t+r*(e-t+he("1e-"+((r+"").length-1))),e)}return Yn(t,e)},Ri.reduce=function(t,e,i){var n=qa(t)?ke:Ye,s=arguments.length<3;return n(t,ar(e,4),i,s,un)},Ri.reduceRight=function(t,e,i){var n=qa(t)?Ne:Ye,s=arguments.length<3;return n(t,ar(e,4),i,s,cn)},Ri.repeat=function(t,e,n){return e=(n?yr(t,e,n):e===i)?1:mo(e),Gn(xo(t),e)},Ri.replace=function(){var t=arguments,e=xo(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Ri.result=function(t,e,n){var s=-1,r=(e=ys(e,t)).length;for(r||(r=1,t=i);++s<r;){var a=null==t?i:t[Rr(e[s])];a===i&&(s=r,a=n),t=Ja(a)?a.call(t):a}return t},Ri.round=Eh,Ri.runInContext=t,Ri.sample=function(t){return(qa(t)?$i:Xn)(t)},Ri.size=function(t){if(null==t)return 0;if(Ya(t))return oo(t)?li(t):t.length;var e=dr(t);return e==_||e==T?t.size:kn(t).length},Ri.snakeCase=$o,Ri.some=function(t,e,n){var s=qa(t)?Oe:is;return n&&yr(t,e,n)&&(e=i),s(t,ar(e,3))},Ri.sortedIndex=function(t,e){return ns(t,e)},Ri.sortedIndexBy=function(t,e,i){return ss(t,e,ar(i,2))},Ri.sortedIndexOf=function(t,e){var i=null==t?0:t.length;if(i){var n=ns(t,e);if(n<i&&Wa(t[n],e))return n}return-1},Ri.sortedLastIndex=function(t,e){return ns(t,e,!0)},Ri.sortedLastIndexBy=function(t,e,i){return ss(t,e,ar(i,2),!0)},Ri.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var i=ns(t,e,!0)-1;if(Wa(t[i],e))return i}return-1},Ri.startCase=Xo,Ri.startsWith=function(t,e,i){return t=xo(t),i=null==i?0:rn(mo(i),0,t.length),e=os(e),t.slice(i,i+e.length)==e},Ri.subtract=Mh,Ri.sum=function(t){return t&&t.length?Ge(t,sh):0},Ri.sumBy=function(t,e){return t&&t.length?Ge(t,ar(e,2)):0},Ri.template=function(t,e,n){var s=Ri.templateSettings;n&&yr(t,e,n)&&(e=i),t=xo(t),e=_o({},e,s,Zs);var r,a,o=_o({},e.imports,s.imports,Zs),h=Bo(o),l=Je(o,h),u=0,c=e.interpolate||xt,d="__p += '",p=At((e.escape||xt).source+"|"+c.source+"|"+(c===J?ct:xt).source+"|"+(e.evaluate||xt).source+"|$","g"),f="//# sourceURL="+(kt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++se+"]")+"\n";t.replace(p,(function(e,i,n,s,o,h){return n||(n=s),d+=t.slice(u,h).replace(bt,ni),i&&(r=!0,d+="' +\n__e("+i+") +\n'"),o&&(a=!0,d+="';\n"+o+";\n__p += '"),n&&(d+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),u=h+e.length,e})),d+="';\n";var m=kt.call(e,"variable")&&e.variable;if(m){if(lt.test(m))throw new _t("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(a?d.replace(U,""):d).replace(V,"$1").replace(q,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(r?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Ko((function(){return St(h,f+"return "+d).apply(i,l)}));if(g.source=d,Za(g))throw g;return g},Ri.times=function(t,e){if((t=mo(t))<1||t>u)return[];var i=d,n=gi(t,d);e=ar(e),t-=d;for(var s=$e(n,e);++i<t;)e(i);return s},Ri.toFinite=fo,Ri.toInteger=mo,Ri.toLength=go,Ri.toLower=function(t){return xo(t).toLowerCase()},Ri.toNumber=yo,Ri.toSafeInteger=function(t){return t?rn(mo(t),-9007199254740991,u):0===t?t:0},Ri.toString=xo,Ri.toUpper=function(t){return xo(t).toUpperCase()},Ri.trim=function(t,e,n){if((t=xo(t))&&(n||e===i))return Xe(t);if(!t||!(e=os(e)))return t;var s=ui(t),r=ui(e);return xs(s,Ke(s,r),ti(s,r)+1).join("")},Ri.trimEnd=function(t,e,n){if((t=xo(t))&&(n||e===i))return t.slice(0,ci(t)+1);if(!t||!(e=os(e)))return t;var s=ui(t);return xs(s,0,ti(s,ui(e))+1).join("")},Ri.trimStart=function(t,e,n){if((t=xo(t))&&(n||e===i))return t.replace(nt,"");if(!t||!(e=os(e)))return t;var s=ui(t);return xs(s,Ke(s,ui(e))).join("")},Ri.truncate=function(t,e){var n=30,s="...";if(to(e)){var r="separator"in e?e.separator:r;n="length"in e?mo(e.length):n,s="omission"in e?os(e.omission):s}var a=(t=xo(t)).length;if(si(t)){var o=ui(t);a=o.length}if(n>=a)return t;var h=n-li(s);if(h<1)return s;var l=o?xs(o,0,h).join(""):t.slice(0,h);if(r===i)return l+s;if(o&&(h+=l.length-h),ro(r)){if(t.slice(h).search(r)){var u,c=l;for(r.global||(r=At(r.source,xo(dt.exec(r))+"g")),r.lastIndex=0;u=r.exec(c);)var d=u.index;l=l.slice(0,d===i?h:d)}}else if(t.indexOf(os(r),h)!=h){var p=l.lastIndexOf(r);p>-1&&(l=l.slice(0,p))}return l+s},Ri.unescape=function(t){return(t=xo(t))&&G.test(t)?t.replace(j,di):t},Ri.uniqueId=function(t){var e=++Nt;return xo(t)+e},Ri.upperCase=Zo,Ri.upperFirst=Jo,Ri.each=va,Ri.eachRight=xa,Ri.first=Yr,hh(Ri,(_h={},vn(Ri,(function(t,e){kt.call(Ri.prototype,e)||(_h[e]=t)})),_h),{chain:!1}),Ri.VERSION="4.17.21",Ae(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Ri[t].placeholder=Ri})),Ae(["drop","take"],(function(t,e){Fi.prototype[t]=function(n){n=n===i?1:mi(mo(n),0);var s=this.__filtered__&&!e?new Fi(this):this.clone();return s.__filtered__?s.__takeCount__=gi(n,s.__takeCount__):s.__views__.push({size:gi(n,d),type:t+(s.__dir__<0?"Right":"")}),s},Fi.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Ae(["filter","map","takeWhile"],(function(t,e){var i=e+1,n=1==i||3==i;Fi.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:ar(t,3),type:i}),e.__filtered__=e.__filtered__||n,e}})),Ae(["head","last"],(function(t,e){var i="take"+(e?"Right":"");Fi.prototype[t]=function(){return this[i](1).value()[0]}})),Ae(["initial","tail"],(function(t,e){var i="drop"+(e?"":"Right");Fi.prototype[t]=function(){return this.__filtered__?new Fi(this):this[i](1)}})),Fi.prototype.compact=function(){return this.filter(sh)},Fi.prototype.find=function(t){return this.filter(t).head()},Fi.prototype.findLast=function(t){return this.reverse().find(t)},Fi.prototype.invokeMap=$n((function(t,e){return"function"==typeof t?new Fi(this):this.map((function(i){return Cn(i,t,e)}))})),Fi.prototype.reject=function(t){return this.filter(Na(ar(t)))},Fi.prototype.slice=function(t,e){t=mo(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Fi(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==i&&(n=(e=mo(e))<0?n.dropRight(-e):n.take(e-t)),n)},Fi.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Fi.prototype.toArray=function(){return this.take(d)},vn(Fi.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),s=/^(?:head|last)$/.test(e),r=Ri[s?"take"+("last"==e?"Right":""):e],a=s||/^find/.test(e);r&&(Ri.prototype[e]=function(){var e=this.__wrapped__,o=s?[1]:arguments,h=e instanceof Fi,l=o[0],u=h||qa(e),c=function(t){var e=r.apply(Ri,Pe([t],o));return s&&d?e[0]:e};u&&n&&"function"==typeof l&&1!=l.length&&(h=u=!1);var d=this.__chain__,p=!!this.__actions__.length,f=a&&!d,m=h&&!p;if(!a&&u){e=m?e:new Fi(this);var g=t.apply(e,o);return g.__actions__.push({func:pa,args:[c],thisArg:i}),new Wi(g,d)}return f&&m?t.apply(this,o):(g=this.thru(c),f?s?g.value()[0]:g.value():g)})})),Ae(["pop","push","shift","sort","splice","unshift"],(function(t){var e=It[t],i=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);Ri.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var s=this.value();return e.apply(qa(s)?s:[],t)}return this[i]((function(i){return e.apply(qa(i)?i:[],t)}))}})),vn(Fi.prototype,(function(t,e){var i=Ri[e];if(i){var n=i.name+"";kt.call(Ci,n)||(Ci[n]=[]),Ci[n].push({name:e,func:i})}})),Ci[zs(i,2).name]=[{name:"wrapper",func:i}],Fi.prototype.clone=function(){var t=new Fi(this.__wrapped__);return t.__actions__=Ts(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ts(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ts(this.__views__),t},Fi.prototype.reverse=function(){if(this.__filtered__){var t=new Fi(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Fi.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,i=qa(t),n=e<0,s=i?t.length:0,r=function(t,e,i){var n=-1,s=i.length;for(;++n<s;){var r=i[n],a=r.size;switch(r.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=gi(e,t+a);break;case"takeRight":t=mi(t,e-a)}}return{start:t,end:e}}(0,s,this.__views__),a=r.start,o=r.end,h=o-a,l=n?o:a-1,u=this.__iteratees__,c=u.length,d=0,p=gi(h,this.__takeCount__);if(!i||!n&&s==h&&p==h)return ds(t,this.__actions__);var f=[];t:for(;h--&&d<p;){for(var m=-1,g=t[l+=e];++m<c;){var y=u[m],v=y.iteratee,x=y.type,b=v(g);if(2==x)g=b;else if(!b){if(1==x)continue t;break t}}f[d++]=g}return f},Ri.prototype.at=fa,Ri.prototype.chain=function(){return da(this)},Ri.prototype.commit=function(){return new Wi(this.value(),this.__chain__)},Ri.prototype.next=function(){this.__values__===i&&(this.__values__=po(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},Ri.prototype.plant=function(t){for(var e,n=this;n instanceof Hi;){var s=Hr(n);s.__index__=0,s.__values__=i,e?r.__wrapped__=s:e=s;var r=s;n=n.__wrapped__}return r.__wrapped__=t,e},Ri.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Fi){var e=t;return this.__actions__.length&&(e=new Fi(this)),(e=e.reverse()).__actions__.push({func:pa,args:[ta],thisArg:i}),new Wi(e,this.__chain__)}return this.thru(ta)},Ri.prototype.toJSON=Ri.prototype.valueOf=Ri.prototype.value=function(){return ds(this.__wrapped__,this.__actions__)},Ri.prototype.first=Ri.prototype.head,Zt&&(Ri.prototype[Zt]=function(){return this}),Ri}();fe?((fe.exports=pi)._=pi,pe._=pi):de._=pi}).call(w)}(ni,ni.exports);var si=ni.exports;const ri=_(si);let ai=class t{constructor(t=new We(1/0,1/0),e=new We(-1/0,-1/0)){c(this,"isBox2",!0),c(this,"min"),c(this,"max"),this.min=t,this.max=e}applyMatrix3(t){return this.isEmpty()||(oi[0].set(this.min.x,this.min.y).applyMatrix3(t),oi[1].set(this.min.x,this.max.y).applyMatrix3(t),oi[3].set(this.max.x,this.max.y).applyMatrix3(t),oi[2].set(this.max.x,this.min.y).applyMatrix3(t),this.setFromPoints(oi)),this}clone(){return(new t).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}ceil(){return this.min.ceilToZero(),this.max.ceilToZero(),this}distanceToPoint(t){return hi.copy(t).clamp(this.min,this.max).sub(t).length()}expandByXY(t,e){return this.min.minXY(t,e),this.max.maxXY(t,e),this}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByPoints(t){if(!t||!t.length)return this;for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){var e;this.union(t.boundingBoxWorld);for(let i=0,n=(null==(e=t.children)?void 0:e.length)||0;i<n;i++)this.expandByObject(t.children[i]);return this}expandByObjects(t){for(let e=0,i=t.length;e<i;e++)this.expandByObject(t[e]);return this}expandByBox(t){t.isEmpty()||(this.expandByPoint(t.min),this.expandByPoint(t.max))}expandByCubic(t,e,i,n,s,r,a,o){this.makeEmpty();let h=je(t,i,s,a,ui);for(let e=0;e<h;e++){const n=qe(t,i,s,a,ui[e]);this.min.x=Math.min(n,this.min.x),this.max.x=Math.max(n,this.max.x)}h=je(e,n,r,o,ci);for(let t=0;t<h;t++){const i=qe(e,n,r,o,ci[t]);this.min.y=Math.min(i,this.min.y),this.max.y=Math.max(i,this.max.y)}return this.expandByXY(t,e),this.expandByXY(a,o),this}expandByQuadratic(t,e,i,n,s,r){const a=Math.max(0,Math.min(1,$e(t,i,s))),o=Math.max(0,Math.min(1,$e(e,n,r))),h=Xe(t,i,s,a),l=Xe(e,n,r,o);return this.expandByXY(t,e),this.expandByXY(s,r),this.expandByXY(h,l),this}expandByArc(t,e,i,n,s,r,a){let o=s%(2*Math.PI);o<0&&(o+=2*Math.PI);let h=r%(2*Math.PI);if(h<0&&(h+=2*Math.PI),o===h)return this.expandByXY(t-i,e-n),this.expandByXY(t+i,e+n),this;if(a){const t=o;o=h,h=t}return h<o&&(h+=2*Math.PI),this.expandByXY(t+i*Math.cos(o),e+n*Math.sin(o)),this.expandByXY(t+i*Math.cos(h),e+n*Math.sin(h)),o>.5*Math.PI&&h<2*Math.PI+.5*Math.PI&&this.expandByXY(t,e+n),o>Math.PI&&h<2*Math.PI+Math.PI&&this.expandByXY(t-i,e),o>1.5*Math.PI&&h<2*Math.PI+1.5*Math.PI&&this.expandByXY(t,e-n),o>0&&h<2*Math.PI&&this.expandByXY(t+i,e),this}expandByEllipse(t,e,i,n,s,r,a,o){di[0]=r,di[1]=a,ei(di,o),r=di[0],a=di[1];const h=t+i*Math.cos(r),l=e+n*Math.sin(r),u=t+i*Math.cos(a),c=e+n*Math.sin(a);this.expandByXY(h,l),this.expandByXY(u,c);const d=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const h of d)if(ii(h,r,a,o)){const r=t+i*Math.cos(h),a=e+n*Math.sin(h),o=t+(r-t)*Math.cos(s)-(a-e)*Math.sin(s),l=e+(r-t)*Math.sin(s)+(a-e)*Math.cos(s);this.expandByXY(o,l)}return this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}floor(){return this.min.floorToZero(),this.max.floorToZero(),this}getCenter(t=new We){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t=new We){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}getPoints(t=[]){return t.length=0,t[0]={x:this.min.x,y:this.min.y},t[1]={x:this.min.x,y:this.max.y},t[2]={x:this.max.x,y:this.max.y},t[3]={x:this.max.x,y:this.min.y},t}getNumbersArray(t=[]){return[this.min.x,this.min.y,this.min.x,this.max.y,this.max.x,this.max.y,this.max.x,this.min.y]}getArea(){return this.getSize(hi),hi.x*hi.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}intersectsBox(t){return!!t&&!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}intersectsObject(t){return!(!t||!t.geometry)&&this.intersectsBox(t.geometry.boundingBox)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}round(){return this.min.roundToZero(),this.max.roundToZero(),this}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(hi.fromArray(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=hi.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromProjectionMatrix(t){return this.min.set(t.elements[6],t.elements[7]),this.max.set(t.elements[6],t.elements[7]),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}setFromMinMaxString(t,e=" "){if(this.makeEmpty(),!(null==t?void 0:t.length))return this;let i=t.split(e),n=ri.map(i,(t=>parseFloat(t)));for(let t=0,e=n.length;t<e;t+=2)this.expandByPoint(hi.fromArray(n,t));return this}setFromXYXY(t,e,i,n){return this.makeEmpty(),this.expandByXY(t,e),this.expandByXY(i,n),this}translate(t){return this.min.add(t),this.max.add(t),this}toString(){return`{"min":${this.min.toString()},"max":${this.max.toString()}}`}fromString(t){return t?(this.copy(JSON.parse(t)),this):this}union(t){return t.validate()?(this.min.min(t.min),this.max.max(t.max),this):this}validate(){return this.min.validate()&&this.max.validate()}unproject(t){return this.applyMatrix3(t.projectionMatrixInverse).applyMatrix3(t.matrixWorld)}centralArrange(t=1,e=20,i=10,n){const s=e+i;n?hi.copy(n):this.getCenter(hi),this.getSize(li),li.subScalar(e);const r=Math.floor(li.x/s),a=r*s,o=Math.ceil(t/r)*s;if(li.x<s||li.y<s||a>=li.x||o>=li.y)return hi.clone();let h=[],l=0,u=0;for(let e=0;e<t;e++){const e=r>t?t*s:a,i=hi.x-e/2+u*s+s/2,n=hi.y-o/2+l*s+s/2;h.push(new We(i,n)),u++,u>=r&&(u=0,l++)}return h}flipY(){return hi.copy(this.min).multiplyScalar(1,-1),li.copy(this.max).multiplyScalar(1,-1),this.min.set(hi.x,li.y),this.max.set(li.x,hi.y),this}};const oi=[new We,new We,new We,new We],hi=new We,li=new We,ui=[],ci=[],di=[],pi=Ae.window.requestAnimationFrame,fi=Ae.window.performance?()=>Ae.window.performance.now():()=>(new Date).getTime(),mi=pi,gi=class t{constructor(){c(this,"id",t.idCounter++),c(this,"timers",new Map),c(this,"timersDuration",new Map),c(this,"counters",new Map),c(this,"countersAmount",new Map),c(this,"out",[])}static active(e){t.actived=!!e,t.duration=e||0}static add(t){this.children.push(t),this.handleStart()}static remove(e){for(let i=0,n=t.children.length;i<n;i++)if(t.children[i].id===e.id){this.children.splice(i,1);break}}static handleStart(){this.isRunning||(this.isRunning=!0,mi(this.runLoop))}static runLoop(){t.children.length?(t.runFrames(),mi(t.runLoop)):t.isRunning=!1}static runFrames(){let e,i=fi();if(!(i-t.lastTime<t.duration)){t.lastTime=i;for(let i=0,n=this.children.length;i<n;i++)e=this.children[i],e.calculateTimers(),e.calculateCounters(),t.messages=t.messages.concat(e.out),e.out.length=0;if(t.messages.length){if(t.actived){let t=[];t.push(bi),t.push(wi),t.push(_i),this.messages.forEach((e=>t.push(function(t,e=20){let i="│";i+=" ".repeat(Math.max(e-t.name.length,0)),i+=t.name,i+="│";const n="string"==typeof t.avg?xi-t.avg.length:xi-t.avg.toString().length;return i+=" ".repeat(Math.max(n,0)),i+=t.avg+" ",i+=" ".repeat(Math.max(xi-t.min.toString().length,0)),i+=t.min+" ",i+=" ".repeat(Math.max(xi-t.max.toString().length,0)),i+=t.max+" ",i+=" ".repeat(Math.max(xi-t.stdDev.toString().length,0)),i+=t.stdDev+" ",i+=" ".repeat(Math.max(xi-t.count.toString().length,0)),i+=t.count+" ",i+=" ".repeat(Math.max(xi-t.FPS.toString().length,0)),i+=t.FPS,i}(e,this.maxLetters)))),t.push(Si)}t.messages.length=0}}}destroy(){t.remove(this)}addTimer(t,e=fi(),i=fi()-(this.timersDuration.get(t)||fi())){this.addTimerDuration(t,i),this.timersDuration.set(t,e)}addTimerDuration(t,e){var i;this.timers.has(t)||this.timers.set(t,[]),null==(i=this.timers.get(t))||i.push(e)}calculateTimers(){this.timers.forEach(((t,e)=>{t&&t.length&&(this.out.push(this.calculateDurations(e,t)),t.length=0)}))}addCounterAmount(t,e){var i;this.counters.has(t)||this.counters.set(t,[]),null==(i=this.counters.get(t))||i.push(e)}calculateCounters(){this.counters.forEach(((t,e)=>{t&&t.length&&(this.out.push(this.calculateAmounts(e,t)),t.length=0)}))}start(){return this.stop(),t.add(this),this}stop(){return t.remove(this),this}calculateDurations(e,i){const n={name:e,avg:0,min:0,max:0,stdDev:0,count:0,FPS:0};if(!i||!i.length)return n;const s=i.length,{min:r,max:a,avg:o}=this.minMaxAvg(i),h=parseFloat(this.stdDev(i,o).toFixed(2));return{name:e,avg:this.fd(o),min:this.fd(r),max:this.fd(a),stdDev:h,count:s,FPS:Math.ceil(s/t.duration*1e3)}}calculateAmounts(e,i){const n={name:e,avg:0,min:0,max:0,stdDev:0,count:0,FPS:0};if(!i||!i.length)return n;const s=i.length,{min:r,max:a,avg:o}=this.minMaxAvg(i);return{name:e,avg:o,min:r,max:a,stdDev:this.stdDev(i,o),count:s,FPS:Math.ceil(s/t.duration*1e3)}}minMaxAvg(t){let e=t[0],i=t[0],n=t.length,s=0;for(let n=0;n<t.length;n++){const r=t[n];s+=r,r<e&&(e=r),r>i&&(i=r)}const r=s/n;return{min:this.fx(e),max:this.fx(i),avg:this.fx(r)}}stdDev(t,e){let i=0;for(let n=0;n<t.length;n++){const s=t[n];i+=(s-e)*(s-e)}const n=t.length;return this.fx(Math.sqrt(i/n))}fd(t){return t>1e3?(t/1e3).toFixed(1)+"s":t.toFixed(1)+"ms"}fx(t,e=1){return 1===e?Math.round(10*t)/10:2===e?Math.round(100*t)/100:3===e?Math.round(1e3*t)/1e3:t}};c(gi,"idCounter",0),c(gi,"children",[]),c(gi,"isRunning",!1),c(gi,"actived",!1),c(gi,"duration",0),c(gi,"lastTime",fi()),c(gi,"messages",[]),c(gi,"maxLetters",20);let yi=gi;const vi=["avg","min","max","stdDev","count","FPS"],xi=function(t,e=0){let i=0;for(let e=0,n=t.length;e<n;e++)i=Math.max(i,t[e].length);return i+e}(vi,1),bi=function(t,e=20){let i="┌";i+="─".repeat(e),i+="┬";for(let e=0,n=t.length;e<n;e++)i+="─".repeat(xi),i+=e<n-1?"┬":"┐";return i}(vi,20),wi=function(t,e=20){let i="│";i+=" ".repeat(e),i+="│";for(let e=0,n=t.length;e<n;e++)i+=" ".repeat(Math.max(xi-t[e].length-1,0)),i+=t[e],i+=" │";return i}(vi,20),_i=function(t,e=20){let i="├";i+="─".repeat(e),i+="┼";for(let e=0,n=t.length;e<n;e++)i+="─".repeat(xi),i+=e<n-1?"┴":"┘";return i}(vi,20),Si=function(t=20){let e="└";for(let i=0;i<t;i++)e+="─";return e+="┘",e}(20);var Ei=(t=>(t.MM="mm",t.CM="cm",t.M="m",t.INCH="inch",t.INCHES="inches",t.FOOT="foot",t.FEET="feet",t))(Ei||{}),Mi=(t=>(t.INIT="init",t.LOAD="load",t.LOADED="loaded",t.RESIZE="resize",t.SET_SIZE="setSize",t.GET_LAYERS="getLayers",t.GET_ASSET_IDS_BY_TYPE="getAssetIdsByType",t.SET_FILL_BY_IDS="setFillByIds",t.CLEAR_FILL_BY_IDS="clearFillByIds",t.CLEAR_FILL="clearFill",t.SET_STROKE_BY_IDS="setStrokeByIds",t.CLEAR_STROKE="clearStroke",t.TERMINATE="terminate",t.CAMERA_SYNC="cameraSync",t.SLICE_DURATION_CHANGED="sliceDurationChanged",t.ASSET_TYPE_CHANGED="assetTypeChanged",t.FN_ENABLE_CHANGED="fnEnableChanged",t.SVG_LOADING_TYPE_CHANGED="svgLoadingTypeChanged",t.USED_CACHE_CHANGED="usedCacheChanged",t.DEBOUNCE_CACHE_CHANGED="debounceCacheChanged",t.WIREFRAME_CHANGED="wireframeChanged",t.BG_PASS_CHANGED="bgPass",t.SELECT_ENABLE_CHANGED="selectEnableChanged",t.MULTI_SELECT_ENABLE_CHANGED="multiSelectEnableChanged",t.MULTI_SELECT_BY_RANGE="multiSelectByRange",t.ZOOM_TO_SELECT_ENABLE_CHANGED="zoomToSelectEnableChanged",t.SOCIAL_DISTANCE_ENABLE_CHANGED="socialDistanceEnableChanged",t.ENABLE_HOVER_CHANGED="enableHover",t.FONT_ZOOM_IN="fontZoomIn",t.FONT_ZOOM_OUT="fontZoomOut",t.UNPROJECT="unproject",t.STROKE_MORE="strokeMore",t.STROKE_LESS="strokeLess",t.CAMERA_CHANGED="cameraChanged",t.SCENES_CHANGED="scenesChanged",t.UPDATE_LAYERS_VISIBILITY="updateLayersVisibility",t.DYNAMIC_LOADED="dynamicLoaded",t.SYNC_TEXTURE_HELPER_CACHED="syncTextureHelperCached",t.INIT_FONT="initFont",t.INIT_LOADING_FONT="initLoadingFont",t.REFRESH="refresh",t.FULLSCREEN="fullscreen",t.GET_CAMERA_POSITION="getCameraPosition",t.SET_CAMERA_POSITION="setCameraPosition",t.SAVE_CAMERA_POSITION="saveCameraPosition",t.RESTORE_CAMERA_POSITION="restoreCameraPosition",t.FOCUS_AT_IDS="focusAtIds",t.GET_LEGEND="getLegend",t.GET_ASSET_LABELS="getAssetLabels",t.SET_ASSET_LABELS="setAssetLabels",t.CLEAR_ASSET_LABELS="clearAssetLabels",t.CLEAR_DUMMIES="clearDummies",t.SET_DUMMIES="setDummies",t.FOCUS_AT_DUMMY="focusAtDummy",t.HIGHLIGHT_DUMMIES="highlightDummies",t.RESET_HIGHLIGHT_DUMMIES="resetHighlightDummies",t.SET_EDITOR_MODE="setEditorMode",t.BIND_EDITOR_DRAG="bindEditorDrag",t.SET_EDITOR_DRAGGING_OBJECT="setEditorDraggingObject",t.HANDLE_EXTERNAL_EVENT="handleExternalEvent",t.GET_DUMMIES="getDummies",t.ZOOM_IN="zoomIn",t.ZOOM_OUT="zoomOut",t.INITIALIZATION_START="INITIALIZATION_START",t.INITIALIZATION_COMPLETE="INITIALIZATION_COMPLETE",t.POINTER_OVER="pointerover",t.POINTER_OUT="pointerout",t.POINTER_LEAVE="pointerleave",t.SELECTED="selected",t.SELECT_BY_IDS="selectByIds",t.GET_ASSET_BOUNDING_BOX="getAssetBoundingBox",t.SET_ASSET_TYPE="setAssetType",t.LINK_ASSETS_BY_TREE="linkAssetsByTree",t.CLEAR_SELECTED="clearSelected",t.TARGET_BY_IDS="targetByIds",t.SHOW_ASSETS_LABEL="showAssetsLabel",t.HIDE_ASSETS_LABEL="hideAssetsLabel",t.TAP="tap",t.SINGLE_TAP="singletap",t.DOUBLE_TAP="doubletap",t.PRESS="press",t.PAN="pan",t.PAN_START="panstart",t.PAN_MOVE="panmove",t.PAN_END="panend",t.ROTATE="rotate",t.ROTATE_START="rotatestart",t.ROTATE_MOVE="rotatemove",t.ROTATE_END="rotateend",t.PINCH="pinch",t.PINCH_START="pinchstart",t.PINCH_MOVE="pinchmove",t.PINCH_END="pinchend",t.PINCH_IN="pinchin",t.PINCH_OUT="pinchout",t.SWIPE="swipe",t.SET_CURSOR="setCursor",t.DRAG_END="dragEnd",t))(Mi||{});function Ai(t,e="http://www.w3.org/2000/svg"){var i,n;return null==(n=null==(i=Ae.window)?void 0:i.document)?void 0:n.createElementNS(e,t)}function Ti(t=2e3){return d(this,null,(function*(){return new Promise((e=>setTimeout(e,(Math.random()+.5)*t)))}))}function Ci(t=8){let e=[];for(let i=0;i<t;i++)e.push(String.fromCharCode(97+Math.round(25*Math.random())));return e.join("")}function Ii(t,e=[]){var i,n;return t&&t.value?(e.push(t.value),(null==(i=t.children)?void 0:i.length)&&(null==(n=t.children)||n.forEach((t=>Ii(t,e)))),e):e}function Di(t,e=Ei.MM,i=Ei.M,n=!1){let s=t||0;if(e===i)return s;const r={[Ei.MM]:1,[Ei.CM]:10,[Ei.M]:1e3,[Ei.INCH]:25.4,[Ei.INCHES]:25.4,[Ei.FOOT]:304.8,[Ei.FEET]:304.8};if(n){s=s*(r[e]||1)*(r[e]||1)/((r[i]||1)*(r[i]||1))}else{s=s*(r[e]||1)/(r[i]||1)}return s}var Li=(t=>(t.GROS="gros",t.RM="rm",t.WS="ws",t.SU="su",t.EQ="eq",t.FN="fn",t.GL="gl",t.IP="ip",t))(Li||{});const Bi="dummy";var Pi=(t=>(t.BACKGROUND="background",t.BACKGROUND_LABELS="background-labels",t.ASSETS="assets",t.ANNOTATIONS="annotations",t.TEXT="text",t.ASSET_LABELS="asset-labels",t.LABELS="labels",t))(Pi||{});const ki="ae",Ni="rm-assets",Oi="ws-assets",Ri="ws-labels";function zi(t){return t+"-"+Pi.ASSETS}function Hi(t){return t+"-"+Pi.LABELS}const Wi={rm:["su-assets","su-labels","eq-assets","eq-labels","fn-assets","fn-labels"],ws:["su-assets","su-labels","eq-assets","eq-labels","fn-assets","fn-labels"],su:[Ni,"rm-labels",Oi,Ri,"eq-assets","eq-labels","fn-assets","fn-labels"],eq:[Oi,Ri,"su-assets","su-labels","fn-assets","fn-labels"]};let Fi=class{constructor(){c(this,"_listeners",new Map)}destroy(){this._listeners.clear()}addEventListener(t,e){let i=this._listeners.get(t);i||(i=[],this._listeners.set(t,i)),i.includes(e)||i.push(e)}addEventListeners(t,e){const i=t.split(","),n=i.length;for(let t=0;t<n;t++)this.addEventListener(i[t].trim(),e)}isListening(t){var e;return this._listeners.has(t)&&!!(null==(e=this._listeners.get(t))?void 0:e.length)}hasEventListener(t,e){var i;return 0!==this._listeners.size&&(this._listeners.has(t)&&!!(null==(i=this._listeners.get(t))?void 0:i.includes(e)))}removeEventListener(t,e){const i=this._listeners.get(t);if(i){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}dispatchEvent(t){const e=this._listeners.get(t.type);if(e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t);t.target=void 0}}dispatchEventAsync(t){const e=this._listeners.get(t.type);e&&setTimeout((()=>{for(const i of e)i.call(this,t)}))}},Ui=class t{constructor(){c(this,"isMatrix3",!0),c(this,"elements",[1,0,0,0,1,0,0,0,1])}static equals(t,e,i=1e-6){if(t.elements.length!=e.elements.length)return!1;for(let n=0,s=t.elements.length;n<s;n++){const s=t.elements[n]-e.elements[n];if(Math.abs(s)>i)return!1}return!0}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}clone(){return(new t).fromArray(this.elements)}compose(t,e,i){const n=Math.sin(e.x),s=Math.cos(e.x);return this.set(i.x*s,i.y*n*-1,t.x,i.x*n,i.y*s,t.y,0,0,1)}composeWithCenter(t,e,i,n){return Gi.identity(),$i.makeTranslation(t.x,t.y),Xi.makeRotation(e.x),Zi.makeScale(i.x,i.y),ji.copy(n).applyMatrix3(Zi),Gi.multiply(Ji.makeTranslation(-ji.x,-ji.y)).multiply($i).multiply(Ji.makeTranslation(ji.x,ji.y)).multiply(Xi).multiply(Ji.makeTranslation(-ji.x,-ji.y)).multiply(Zi),this.copy(Gi)}decompose(t,e,i){const n=Gi.copy(this).elements,s=Math.sqrt(n[0]*n[0]+n[3]*n[3]),r=Math.sqrt(n[1]*n[1]+n[4]*n[4]),a=n[0]*n[4]-n[3]*n[1];n[0]||n[3]?i.set(s,a/s):n[1]||n[4]?i.set(a/r,r):i.set(0,0);let o=0;o=n[0]||n[3]?n[3]>0?-Math.acos(n[0]/s):Math.acos(n[0]/s):n[1]||n[4]?Math.PI/2-(n[4]>0?Math.acos(-n[1]/r):-Math.acos(n[1]/r)):0,0!==o&&i.y<0&&(o*=-1),e.set(o,o),t.set(n[6],n[7])}compose2(t,e,i){return this.identity().translate(t.x,t.y).rotate(e.x).scale(i.x,i.y),this}decompose2(t,e,i){const n=this.clone();n.scale(-1,1);const s=n.elements[0],r=n.elements[1],a=n.elements[3],o=n.elements[4];let h=0,l=0,u=0;if(0!==s||0!==a){const t=Math.hypot(s,a);h=t,l=(s*o-r*a)/t;const e=Math.acos(s/t);u=a>0?-e:e}else if(0!==r||0!==o){const t=Math.hypot(r,o);h=(s*o-r*a)/t,l=t;const e=Math.acos(r/t);u=Math.PI/2+(o>0?-e:e)}else h=0,l=0,u=0;h=-h,t.x=n.elements[6],t.y=n.elements[7],e.x=e.y=u/Math.PI/180,i.x=h,i.y=l}composeSvgTransform(t=0,e=0,i,n=!1){if(!i&&!t&&!e)return this;this.identity(),Gi.identity();let s=null==i?void 0:i.split(") ").map((t=>t.trim()+")")).filter((t=>")"!==t));return s||(s=[]),(t||e)&&s.push(`translate(${t},${e})`),s.forEach((t=>{const e=/scale\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(t),i=/rotate\(\s*(-?\d*\.?\d+)(?:[ ,](-?\d*\.?\d+)(?:[ ,](-?\d*\.?\d+))?)?\s*\)/.exec(t),n=/translate\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(t);if(e){const t=Number(e[1])||1,i=Number(e[2])||t;Gi.multiply(Zi.makeScale(t,i))}else if(i){const t=Ie(Number(i[1])||0);Number(i[2])||Number(i[3])?(qi.set(Number(i[2]||"0"),Number(i[3]||"0")),Gi.multiply(Xi.makeRotationByPoint(t,qi))):Gi.multiply(Xi.makeRotation(t))}else n&&Gi.multiply($i.makeTranslation(Number(n[1])||0,Number(n[2])||0))})),this.copy(Gi),n&&this.premultiply(Zi.makeScale(1,-1)),this}decomposeSvgMatrix(t,e,i){const n=Gi.copy(this).elements;qi.set(n[0],n[1]),ji.set(n[3],n[4]);let s=qi.length();qi.normalize();let r=qi.dot(ji);Yi.copy(qi).multiplyScalar(-r),ji.add(Yi);const a=ji.length()||0;ji.normalize(),qi.x*ji.y<ji.x*qi.y&&(qi.x=-qi.x,qi.y=-qi.y,s=-s,r=-r);const o=s?Math.atan2(qi.y,qi.x):Math.atan2(-qi.x,ji.y);t.set(n[6],n[7]),e.set(o,o),i.set(s,a)}determinant(){const t=this.elements,e=t[0],i=t[3],n=t[6],s=t[1],r=t[4],a=t[7],o=t[2],h=t[5],l=t[8];return e*r*l-e*h*a-s*i*l+s*h*n+o*i*a-o*r*n}equals(t,e=0){const i=this.elements,n=t.elements;for(let t=0;t<9;t++)if(Math.abs(i[t]-n[t])>e)return!1;return!0}extractBasis2(t,e){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),this}flipY(){return this.premultiply(Zi.makeScale(1,-1))}flipSvgY(){return this.elements[1]*=-1,this.elements[3]*=-1,this.elements[7]*=-1,this}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}getComponents(t=[1,0,0,1,0,0]){return t[0]=this.elements[0],t[1]=this.elements[1],t[2]=this.elements[3],t[3]=this.elements[4],t[4]=this.elements[6],t[5]=this.elements[7],t}fromComponents(t){return this}getNormalMatrix(t){return this.setFromMatrix(t).invert().transpose()}getRotation(t){let e=this.elements;const i=Math.sqrt(e[0]*e[0]+e[3]*e[3]),n=Math.sqrt(e[1]*e[1]+e[4]*e[4]);let s=0;s=e[0]||e[3]?e[3]>0?-Math.acos(e[0]/i):Math.acos(e[0]/i):e[1]||e[4]?Math.PI/2-(e[4]>0?Math.acos(-e[1]/n):-Math.acos(e[1]/n)):0,this.getScale(ji),0!==s&&ji.x<0&&(s*=-1),t.set(s,s)}getScale(t){let e=this.elements,i=Math.sqrt(e[0]*e[0]+e[1]*e[1]),n=Math.sqrt(e[3]*e[3]+e[4]*e[4]),s=e[0]*e[4]-e[3]*e[1];e[0]||e[1]?t.set(s/n,n):e[3]||e[4]?t.set(i,s/i):t.set(0,0)}getTransition(t){t.set(this.elements[6],this.elements[7])}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}hasChange(){for(let t=0,e=this.elements.length;t<e;t++)if(Math.abs(this.elements[t]-Vi[t])>Number.EPSILON)return!0;return!1}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=l*r-a*h,c=a*o-l*s,d=h*s-r*o,p=e*u+i*c+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(n*h-l*i)*f,t[2]=(a*i-n*r)*f,t[3]=c*f,t[4]=(l*e-n*o)*f,t[5]=(n*s-a*e)*f,t[6]=d*f,t[7]=(i*o-h*e)*f,t[8]=(r*e-i*s)*f,this}lookAt(t,e,i){return this.identity().rotate(e.angle()-t.angle()+i.angle())}makeProjection(t,e,i,n,s,r){const a=s/(e-t),o=r/(i-n),h=s/2-(e+t)*a,l=r/2+(i+n)*o;return this.elements[0]=a,this.elements[3]=0,this.elements[6]=h,this.elements[1]=0,this.elements[4]=-o,this.elements[7]=l,this.elements[2]=0,this.elements[5]=0,this.elements[8]=1,this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeRotationByPoint(t,e){const i=Math.cos(t),n=Math.sin(t),s=-e.x*i+e.y*n+e.x,r=-e.x*n-e.y*i+e.y;return this.set(i,-n,s,n,i,r,0,0,1),this}makeRotationFromQuaternion(t){return this.compose(Qi,t,Ki)}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}multiply(t){return this.multiplyMatrices(this,t)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[3],o=i[6],h=i[1],l=i[4],u=i[7],c=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],y=n[1],v=n[4],x=n[7],b=n[2],w=n[5],_=n[8];return s[0]=r*f+a*y+o*b,s[3]=r*m+a*v+o*w,s[6]=r*g+a*x+o*_,s[1]=h*f+l*y+u*b,s[4]=h*m+l*v+u*w,s[7]=h*g+l*x+u*_,s[2]=c*f+d*y+p*b,s[5]=c*m+d*v+p*w,s[8]=c*g+d*x+p*_,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}premultiply(t){return this.multiplyMatrices(t,this)}rotate(t){return this.premultiply(Xi.makeRotation(-t))}scale(t,e){return this.premultiply(Zi.makeScale(t,e))}set(t,e,i,n,s,r,a,o,h){return this.elements[0]=t,this.elements[3]=e,this.elements[6]=i,this.elements[1]=n,this.elements[4]=s,this.elements[7]=r,this.elements[2]=a,this.elements[5]=o,this.elements[8]=h,this}setFromDomMatrix(t){return void 0!==t.m11&&void 0!==t.m21&&void 0!==t.m41&&void 0!==t.m12&&void 0!==t.m22&&void 0!==t.m42&&void 0!==t.m14&&void 0!==t.m24&&void 0!==t.m44?this.set(t.m11,t.m21,t.m41,t.m12,t.m22,t.m42,t.m14,t.m24,t.m44):void 0!==t.a&&void 0!==t.b&&void 0!==t.c&&void 0!==t.d&&void 0!==t.e&&void 0!==t.f&&this.set(t.a,t.c,t.e,t.b,t.d,t.f,0,0,1),this}setFromMatrix(t){const e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this}setUvTransform(t,e,i,n,s,r,a){const o=Math.cos(s),h=Math.sin(s);return this.set(i*o,i*h,-i*(o*r+h*a)+r+t,-n*h,n*o,-n*(-h*r+o*a)+a+e,0,0,1),this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}toString(){return`[${this.elements[0]},${this.elements[1]}, ${this.elements[3]},${this.elements[4]}, ${this.elements[6]},${this.elements[7]}]`}translate(t,e){return this.premultiply($i.makeTranslation(t,e))}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}getTransformScaleX(){return Math.sqrt(this.elements[0]*this.elements[0]+this.elements[1]*this.elements[1])}getTransformScaleY(){return Math.sqrt(this.elements[3]*this.elements[3]+this.elements[4]*this.elements[4])}isTransformSkewed(){const t=this.elements[0]*this.elements[3]+this.elements[1]*this.elements[4];return 0!==t&&Math.abs(t/(this.getTransformScaleX()*this.getTransformScaleY()))>Number.EPSILON}isTransformFlipped(){return this.elements[0]*this.elements[4]-this.elements[1]*this.elements[3]<0}hasMirror(){return this.elements[0]*this.elements[4]-this.elements[1]*this.elements[3]<0}hasMirrorY(){return this.elements[0]<0&&this.elements[4]>0}hasMirrorX(){return this.elements[4]<0&&this.elements[0]>0}getTransformString(){this.decompose(qi.identity(),ji.identity(),Yi.identity());const t=180*ji.x/Math.PI;return`translate(${qi.x}, ${qi.y}) rotate(${t}) scale(${Yi.x}, ${Yi.y})`}};const Vi=[1,0,0,0,1,0,0,0,1],qi=new We,ji=new We,Yi=new We,Gi=new Ui,$i=new Ui,Xi=new Ui,Zi=new Ui,Ji=new Ui,Qi=new We(0,0,0),Ki=new We(1,1,1);const tn=["view"],en=["viewer","mirror"];function nn(t,e){var i;if(t.tagName&&!tn.includes(t.tagName)&&("g"!==t.tagName||0!==(null==(i=t.childNodes)?void 0:i.length))){en.includes(t.id)||e(t);for(let i=0,n=t.childNodes.length;i<n;i++)nn(t.childNodes[i],e)}}let sn=0;function rn(t,e=0,i=0,n=[]){var s,r;if(!t)return n;const a=hn(t,"id","");if(tn.includes(t.nodeName)||"defs"===t.nodeName)return sn--,n;if(e&&sn>e)return n;let o;a&&!en.includes(a)&&(o={label:a,value:a,children:[]},n.push(o)),sn++;for(let i=0,r=null==(s=t.childNodes)?void 0:s.length;i<r;i++)rn(t.childNodes[i],e,sn,o?o.children:n);return 0===(null==(r=null==o?void 0:o.children)?void 0:r.length)&&delete o.children,sn=i,n}function an(t,e){var i;if(Array.isArray(t))for(let i=0,n=t.length||0;i<n;i++)an(t[i],e);else if(e(t),null==(i=t.children)?void 0:i.length)for(let i=0,n=t.children.length;i<n;i++)an(t.children[i],e)}function on(t){var e,i,n;const s=[];if(!(null==(e=null==t?void 0:t.children)?void 0:e.length))return s;for(let e,r=0,a=(null==(i=null==t?void 0:t.children)?void 0:i.length)||0;r<a;r++)e=t.children[r],s.push(e),(null==(n=e.children)?void 0:n.length)&&s.push(...on(e));return s}function hn(t,e,i){if(!t)return i;let n=i;if("function"==typeof t.getAttribute?n=null==t?void 0:t.getAttribute(e):Object.hasOwnProperty.call(t,"attributes")&&(n=t.attributes[e]),!n)return i;if(void 0!==i){if("string"==typeof i)return n;if("number"==typeof i)return Number(n)}return n}const ln=1,un=2,cn=3,dn=4,pn=5,fn=-1,mn=51,gn=52;class yn{constructor(t=!0){c(this,"dpr",1),c(this,"data"),c(this,"userData",{}),c(this,"autoClose",!1),c(this,"_saveData",!0),c(this,"_len",0),c(this,"_x0",0),c(this,"_y0",0),c(this,"_xi",0),c(this,"_yi",0),c(this,"_version",0),c(this,"_ctx"),c(this,"_ppx",0),c(this,"_ppy",0),c(this,"_ppl",0),c(this,"_ux",0),c(this,"_uy",0),c(this,"_pathSegLen"),c(this,"_pathLen",0),this._saveData=!!t,this._saveData&&(this.data=[])}dispose(){return this.reset(),this.data=[],this._len=0,this.userData={},this._ctx=void 0,this._version=0,this._ppx=0,this._ppy=0,this._ppl=0,this._ux=0,this._uy=0,this}reset(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=void 0,this._pathLen=0),this.needsUpdate=!0}set needsUpdate(t){!0===t&&this._version++}get version(){return this._version}clone(){const t=new yn(this._saveData),e=this.data;return t.data=(null==e?void 0:e.slice)?e.slice():Array.prototype.slice.call(e),t._len=this._len,t._ux=this._ux,t._uy=this._uy,t._ppx=this._ppx,t._ppy=this._ppy,t._ppl=this._ppl,t.autoClose=this.autoClose,t.userData=ri.cloneDeep(this.userData),t}setDpr(t){return this.dpr=t||1,this}setScale(t,e,i){return i&&(this._ux=Math.abs(i/(Ae.config.dpr||1)/(t||1)),this._uy=Math.abs(i/(Ae.config.dpr||1)/(e||1))),this}setContext(t){return this._ctx=t,this}getContext(){return this._ctx}len(){return this._len}setData(t){if(!this._saveData)return;const e=(null==t?void 0:t.length)||0;this.data&&this.data.length===e||(this.data=new Float32Array(e));for(let i=0;i<e;i++)this.data[i]=t[i];this._len=e}addData(...t){if(!this._saveData)return;let e=this.data;this._len+(null==t?void 0:t.length)>((null==e?void 0:e.length)||0)&&(this._expandData(),e=this.data);for(let i=0,n=(null==t?void 0:t.length)||0;i<n;i++)e[this._len++]=t[i]}insertData(t,...e){if(!this._saveData||!e||0===e.length)return;const i=this.getCmds();t<0&&(t=0),t>i.length&&(t=i.length),e.length>0&&i.splice(t,0,[...e]);const n=ri.flatten(i);this.setData(n),this.needsUpdate=!0}removeData(t){if(!this._saveData||!this.data||this._len<=0)return;const e=this.getCmds();if(t<0||t>=e.length)return;e.splice(t,1);const i=ri.flatten(e);this.setData(i),this.needsUpdate=!0}_expandData(){if(!(this.data instanceof Array)){const t=[];for(let e=0;e<this._len;e++)t[e]=this.data[e];this.data=t}}appendPath(t){if(!this._saveData||!t)return;t instanceof Array||(t=[t]);const e=t.length;let i=0,n=this._len;for(let n=0;n<e;n++)i+=t[n].len()||0;const s=this.data;if((s instanceof Float32Array||!s)&&(this.data=new Float32Array(n+i),n>0&&s))for(let t=0;t<n;t++)this.data[t]=s[t];for(let i=0;i<e;i++){const e=t[i].data;for(let i=0,s=(null==t?void 0:t.length)||0;i<s;i++)this.data[n++]=e[i]}this._len=n}toStatic(){this._saveData&&(this._pendingLine(),this.data instanceof Array&&(this.data.length=this._len,this._len>11&&(this.data=new Float32Array(this.data))))}rebuildPath(t,e){if(!this.data||!this._len||e<=0)return;const i=this.data,n=this._ux,s=this._uy,r=this._len;let a=0,o=0,h=0,l=0,u=0,c=0;const d=e<1;let p,f,m,g,y=0,v=0,x=0,b=0;if(!d||(this._pathSegLen||this._calculateLength(),p=this._pathSegLen,f=this._pathLen,x=f*e,x))t:for(let e=0;e<r;){const r=i[e++],f=1===e;switch(f&&(a=h=i[e],o=l=i[e+1]),r!==un&&b>0&&(t.lineTo(m,g),b=0),r){case ln:a=h=i[e++],o=l=i[e++],t.moveTo(h,l);break;case un:{u=i[e++],c=i[e++];const r=Math.abs(u-h),a=Math.abs(c-l);if(r>n||a>s){if(d){const e=p[v++];if(y+e>x){const i=(x-y)/e;t.lineTo(h*(1-i)+u*i,l*(1-i)+c*i);break t}y+=e}t.lineTo(u,c),h=u,l=c,b=0}else{const t=r*r+a*a;t>b&&(m=u,g=c,b=t)}break}case cn:{const n=i[e++],s=i[e++],r=i[e++],a=i[e++],o=i[e++],u=i[e++];if(d){const e=p[v++];if(y+e>x){const i=(x-y)/e;Ge(h,n,r,o,i,xn),Ge(l,s,a,u,i,bn),t.bezierCurveTo(xn[1],bn[1],xn[2],bn[2],xn[3],bn[3]);break t}y+=e}t.bezierCurveTo(n,s,r,a,o,u),h=o,l=u;break}case dn:{const n=i[e++],s=i[e++],r=i[e++],a=i[e++];if(d){const e=p[v++];if(y+e>x){const i=(x-y)/e;Je(h,n,r,i,xn),Je(l,s,a,i,bn),t.quadraticCurveTo(xn[1],bn[1],xn[2],bn[2]);break t}y+=e}t.quadraticCurveTo(n,s,r,a),h=r,l=a;break}case pn:const r=i[e++],w=i[e++],_=i[e++],S=i[e++];let E=i[e++],M=i[e++];const A=i[e++],T=!i[e++],C=_>S?_:S,I=Math.abs(_-S)>.001;let D=E+M,L=!1;if(d){const t=p[v++];y+t>x&&(D=E+M*(x-y)/t,L=!0),y+=t}if(I&&"function"==typeof t.ellipse?t.ellipse(r,w,_,S,A,E,D,T):t.arc(r,w,C,E,D,T),L)break t;f&&(a=r+Math.cos(E)*_,o=w+Math.sin(E)*S),h=Math.cos(D)*_+r,l=Math.sin(D)*S+w;break;case mn:a=h=i[e],o=l=i[e+1],u=i[e++],c=i[e++];const B=i[e++],P=i[e++];if(d){const e=p[v++];if(y+e>x){let e=x-y;t.moveTo(u,c),t.lineTo(u+Math.min(B,e),c),e-=B,e>0&&t.lineTo(u+B,c+Math.min(P,e)),e-=P,e>0&&t.lineTo(u+Math.max(B-e,0),c+P),e-=B,e>0&&t.lineTo(u,c+Math.max(P-e,0));break t}y+=e}t.rect(u,c,B,P);break;case fn:if(d){const e=p[v++];if(y+e>x){const i=(x-y)/e;t.lineTo(h*(1-i)+a*i,l*(1-i)+o*i);break t}y+=e}t.closePath(),h=a,l=o}}}_calculateLength(){let t=0;if(!this.data||!this._len)return t;const e=this.data,i=this._len,n=this._ux,s=this._uy;let r=0,a=0,o=0,h=0;this._pathSegLen||(this._pathSegLen=[]);const l=this._pathSegLen;let u=0;for(let c=0;c<i;){const d=e[c++],p=1===c;p&&(r=o=e[c],a=h=e[c+1]);let f=-1;switch(d){case ln:r=o=e[c++],a=h=e[c++];break;case un:{const t=e[c++],r=e[c++],a=t-o,l=r-h;(Math.abs(a)>n||Math.abs(l)>s||c==i-1)&&(f=Math.sqrt(a*a+l*l),o=t,h=r);break}case cn:{const t=e[c++],i=e[c++],n=e[c++],s=e[c++],r=e[c++],a=e[c++];f=Ye(o,h,t,i,n,s,r,a,10),o=r,h=a;break}case dn:{const t=e[c++],i=e[c++],n=e[c++],s=e[c++];f=Ze(o,h,t,i,n,s,10),o=n,h=s;break}case pn:{const t=e[c++],i=e[c++],n=e[c++],s=e[c++],l=e[c++];let u=e[c++];const d=l+u;c+=1,p&&(r=t+Math.cos(l)*n,a=i+Math.sin(l)*s),f=Math.max(n,s)*Math.min(Math.abs(u),2*Qe),o=Math.cos(d)*n+t,h=Math.sin(d)*s+i;break}case mn:r=o=e[c++],a=h=e[c++];f=2*(e[c++]+e[c++]);break;case fn:{const t=r-o,e=a-h;f=Math.sqrt(t*t+e*e),o=r,h=a;break}}f>=0&&(l[u++]=f,t+=f)}return this._pathLen=t,t}computeBoundingBox(t=new ai){if(t.makeEmpty(),vn.makeEmpty(),!this.data||!this._len)return t;const e=this.data;let i=0,n=0,s=0,r=0,a=0;for(a=0;a<this._len;){const o=e[a++],h=1===a;switch(h&&(i=s=e[a],n=r=e[a+1]),o){case ln:i=s=e[a++],n=r=e[a++],vn.setFromXYXY(i,n,i,n);break;case un:t.expandByXY(s,r),t.expandByXY(e[a],e[a+1]),s=e[a++],r=e[a++];break;case cn:t.expandByCubic(s,r,e[a++],e[a++],e[a++],e[a++],e[a],e[a+1]),s=e[a++],r=e[a++];break;case dn:t.expandByQuadratic(s,r,e[a++],e[a++],e[a],e[a+1]),s=e[a++],r=e[a++];break;case pn:const o=e[a++],l=e[a++],u=Math.abs(e[a++]),c=Math.abs(e[a++]);let d=e[a++],p=e[a++]+d;a+=1;const f=!e[a++];h&&(i=o+Math.cos(d)*u,n=l+Math.sin(d)*c),t.expandByArc(o,l,u,c,d,p,f),s=Math.cos(p)*u+o,r=Math.sin(p)*c+l;break;case mn:i=s=e[a++],n=r=e[a++];const m=e[a++],g=e[a++];t.expandByXY(i,n),t.expandByXY(i+m,n+g);break;case gn:{const i=e[a++],n=e[a++],s=Math.abs(e[a++]),r=Math.abs(e[a++]),o=e[a++];let h=e[a++],l=e[a++];const u=!!e[a++];t.expandByEllipse(i,n,s,r,o,h,l,u);break}case fn:s=i,r=n}t.expandByBox(vn)}return t}applyMatrix3(t){if(!this.data||!this._len)return this;const e=this.data,i=this._len;let n=0;for(t.getScale(Mn);n<i;){switch(e[n++]){case ln:case un:En.set(e[n],e[n+1]).applyMatrix3(t),e[n]=En.x,e[n+1]=En.y,n+=2;break;case cn:for(let i=0;i<3;i++)En.set(e[n+2*i],e[n+2*i+1]).applyMatrix3(t),e[n+2*i]=En.x,e[n+2*i+1]=En.y;n+=6;break;case dn:for(let i=0;i<2;i++)En.set(e[n+2*i],e[n+2*i+1]).applyMatrix3(t),e[n+2*i]=En.x,e[n+2*i+1]=En.y;n+=4;break;case pn:En.set(e[n],e[n+1]).applyMatrix3(t),e[n+5]=En.x,e[n+6]=En.y,e[n]*=Mn.x,e[n+1]*=Mn.y,n+=7;break;case mn:En.set(e[n],e[n+1]).applyMatrix3(t),e[n]=En.x,e[n+1]=En.y,e[n+2]*=Mn.x,e[n+3]*=Mn.y,n+=4;break;case gn:En.set(e[n],e[n+1]).applyMatrix3(t);let i=[e[n],e[n+1],e[n+2],e[n+3],e[n+4],e[n+5],e[n+6],e[n+7]];t.isTransformSkewed()?Ln([e[n],e[n+1],e[n+2],e[n+3],e[n+4],e[n+5],e[n+6],e[n+7]],t,i):Bn([e[n],e[n+1],e[n+2],e[n+3],e[n+4],e[n+5],e[n+6],e[n+7]],t,i),e[n]=En.x,e[n+1]=En.y,e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],n+=8}}return this.needsUpdate=!0,this}_pendingLine(){var t;this._ppl>0&&(null==(t=this._ctx)||t.lineTo(this._ppx,this._ppy),this._ppl=0)}beginPath(){var t;return null==(t=this._ctx)||t.beginPath(),this.reset(),this}moveTo(t,e){var i;return this._pendingLine(),this.addData(ln,t,e),null==(i=this._ctx)||i.moveTo(t,e),this._x0=this._xi=t,this._y0=this._yi=e,this}lineTo(t,e){var i;const n=Math.abs(t-this._xi),s=Math.abs(e-this._yi);this.addData(un,t,e);if(n>this._ux||s>this._uy)null==(i=this._ctx)||i.lineTo(t,e),this._xi=t,this._yi=e,this._ppl=0;else{const i=n*n+s*s;i>this._ppl&&(this._ppx=t,this._ppy=e,this._ppl=i)}return this}bezierCurveTo(t,e,i,n,s,r){var a;return this._pendingLine(),this.addData(cn,t,e,i,n,s,r),null==(a=this._ctx)||a.bezierCurveTo(t,e,i,n,s,r),this._xi=s,this._yi=r,this}quadraticCurveTo(t,e,i,n){var s;return this._pendingLine(),this.addData(dn,t,e,i,n),null==(s=this._ctx)||s.quadraticCurveTo(t,e,i,n),this._xi=i,this._yi=n,this}arc(t,e,i,n,s,r){var a;this._pendingLine(),wn[0]=n,wn[1]=s,ei(wn,!!r),n=wn[0];const o=(s=wn[1])-n;return this.addData(pn,t,e,i,i,n,o,0,r?0:1),null==(a=this._ctx)||a.arc(t,e,i,n,s,r),this._xi=t+Math.cos(s)*i,this._yi=e+Math.sin(s)*i,this}arcTo(t,e,i,n,s){var r;return this._pendingLine(),null==(r=this._ctx)||r.arcTo(t,e,i,n,s),this}rect(t,e,i,n){var s;return this._pendingLine(),this.addData(mn,t,e,i,n),null==(s=this._ctx)||s.rect(t,e,i,n),this}closePath(){var t;return this._pendingLine(),this.addData(fn),null==(t=this._ctx)||t.closePath(),this._xi=this._x0,this._yi=this._y0,this}ellipse(t,e,i,n,s,r,a,o){var h;return this._pendingLine(),this.addData(gn,t,e,i,n,s,r,a,o?1:0),null==(h=this._ctx)||h.ellipse(t,e,i,n,s,r,a,o),this}absellipse(t,e,i,n,s,r,a,o=!1){return this._pendingLine(),this.addData(gn,t,e,i,n,s,r,a,o?1:0),this}absarc(t,e,i,n,s,r=!1){return this.absellipse(t,e,i,i,0,n,s,r),this}fill(t){t.fill(),this.toStatic()}stroke(t){this._pendingLine(),t.stroke(),this.toStatic()}addArrow(t,e,i=30){if(!t||!e)return this;const n=this.getVertices();return!(null==n?void 0:n.length)||n.length<4||(t>0?(_n.set(n[2],n[3]),En.set(n[0],n[1]),Sn.subVectors(_n,En),Mn.lerpVectors(En,_n,e/Sn.length()),An.copy(Mn).rotateAround(En,Ie(i)),Tn.copy(Mn).rotateAround(En,-Ie(i)),this.moveTo(An.x,An.y),this.lineTo(En.x,En.y),this.lineTo(Tn.x,Tn.y)):(_n.set(n[n.length-4],n[n.length-3]),En.set(n[n.length-2],n[n.length-1]),Sn.subVectors(_n,En),Mn.lerpVectors(En,_n,e/Sn.length()),An.copy(Mn).rotateAround(En,Ie(i)),Tn.copy(Mn).rotateAround(En,-Ie(i)),this.moveTo(An.x,An.y),this.lineTo(En.x,En.y),this.lineTo(Tn.x,Tn.y))),this}getVertices(t=[]){if(!this.data||!this._len)return t;const e=this.data;for(let i=0;i<this._len;){const n=e[i++];switch(n){case ln:case un:t.push(e[i++],e[i++]);break;case cn:i+=4,t.push(e[i++],e[i++]);break;case dn:i+=2,t.push(e[i++],e[i++]);break;case pn:const s=e[i++],r=e[i++],a=e[i++],o=e[i++],h=e[i++],l=e[i++]+h;i+=2;const u=s+Math.cos(h)*a,c=r+Math.sin(h)*o;t.push(u,c);const d=s+Math.cos(l)*a,p=r+Math.sin(l)*o;t.push(d,p);break;case mn:const f=e[i++],m=e[i++],g=e[i++],y=e[i++];t.push(f,m,f+g,m,f+g,m+y,f,m+y);break;case gn:const v=e[i++],x=e[i++],b=e[i++],w=e[i++];e[i++];const _=e[i++],S=e[i++];e[i++];const E=v+b*Math.cos(_),M=x+w*Math.sin(_);t.push(E,M);const A=v+b*Math.cos(S),T=x+w*Math.sin(S);t.push(A,T);break;case fn:break;default:throw new Error("Invalid command "+n)}}return t}getCmds(){var t;if(!(null==(t=this.data)?void 0:t.length))throw new Error("PathProxy.getCmds: empty path.data.");const e=this.data,i=[];let n=0;for(n=0;n<e.length;){switch(e[n++]){case ln:i.push([ln,e[n++],e[n++]]);break;case un:i.push([un,e[n++],e[n++]]);break;case cn:i.push([cn,e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]]);break;case dn:i.push([dn,e[n++],e[n++],e[n++],e[n++]]);break;case pn:i.push([pn,e[n++],e[n++],e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]]);break;case mn:i.push([mn,e[n++],e[n++],e[n++],e[n++]]);break;case gn:i.push([gn,e[n++],e[n++],e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]]);break;case fn:i.push([fn])}}return i}getControlPoints(t=[]){if(t.length=0,!this.data||!this._len)return t;const e=this.data;let i=0,n=0,s=0;for(i=0;i<this._len;){switch(e[i++]){case ln:n=e[i],s=e[i+1],i+=2,t.push(new We(n,s));break;case un:{const r=e[i++],a=e[i++];t.push(new We(r,a)),n=r,s=a;break}case cn:{const r=n,a=s,o=e[i++],h=e[i++],l=e[i++],u=e[i++],c=e[i++],d=e[i++];t.push(new We(r,a)),t.push(new We(o,h)),t.push(new We(l,u)),t.push(new We(c,d)),n=c,s=d;break}case dn:{const r=n,a=s,o=e[i++],h=e[i++],l=e[i++],u=e[i++];t.push(new We(r,a)),t.push(new We(o,h)),t.push(new We(l,u)),n=l,s=u;break}case pn:{const r=e[i++],a=e[i++],o=e[i++],h=e[i++],l=e[i++],u=e[i++];e[i++],e[i++];const c=l+u,d=r+Math.cos(l)*o,p=a+Math.sin(l)*h;t.push(new We(d,p));const f=r+Math.cos(c)*o,m=a+Math.sin(c)*h;t.push(new We(f,m)),t.push(new We(r,a)),n=f,s=m;break}case mn:{const r=e[i++],a=e[i++],o=e[i++],h=e[i++];t.push(new We(r,a)),t.push(new We(r+o,a)),t.push(new We(r+o,a+h)),t.push(new We(r,a+h)),n=r,s=a;break}case gn:{const r=e[i++],a=e[i++],o=e[i++],h=e[i++];t.push(new We(r,a)),o>h?(t.push(new We(r+o,a)),t.push(new We(r,a+h)),o!==h&&(t.push(new We(r-o,a)),t.push(new We(r,a-h)))):h>o?(t.push(new We(r+o,a)),t.push(new We(r,a+h)),t.push(new We(r-o,a)),t.push(new We(r,a-h))):t.push(new We(r+o,a)),n=r,s=a;break}}}return t}getStartPoint(t=new We){return t.set(this._x0,this._y0)}getEndPoint(t=new We){return t.set(this._xi,this._yi)}getLength(){return this._pathSegLen||this._calculateLength(),this._pathLen}getArea(){if(!this.data||!this._len)return 0;const t=this.data,e=this._len;let i=0,n=0,s=0,r=0,a=0,o=0,h=0,l=!1;for(let u=0;u<e;){switch(t[u++]){case ln:o=r=n=t[u++],h=a=s=t[u++],l=!0;break;case un:const e=t[u++],c=t[u++];i+=(r-e)*(a+c)/2,r=e,a=c;break;case cn:{const e=t[u++],n=t[u++],s=t[u++],o=t[u++],h=t[u++],l=t[u++],c=10;let d=r,p=a;for(let t=1;t<=c;t++){const u=t/c,f=1-u,m=f*f*f*r+3*f*f*u*e+3*f*u*u*s+u*u*u*h,g=f*f*f*a+3*f*f*u*n+3*f*u*u*o+u*u*u*l;i+=(d-m)*(p+g)/2,d=m,p=g}r=h,a=l;break}case dn:{const e=t[u++],n=t[u++],s=t[u++],o=t[u++],h=8;let l=r,c=a;for(let t=1;t<=h;t++){const u=t/h,d=1-u,p=d*d*r+2*d*u*e+u*u*s,f=d*d*a+2*d*u*n+u*u*o;i+=(l-p)*(c+f)/2,l=p,c=f}r=s,a=o;break}case pn:{const e=t[u++],n=t[u++],s=t[u++],o=t[u++],h=t[u++],l=t[u++],c=t[u++];t[u++];const d=Math.max(10,Math.floor(10*Math.abs(l))),p=l/d;let f=r,m=a;for(let t=1;t<=d;t++){const r=h+t*p,a=e+Math.cos(r)*s,l=n+Math.sin(r)*o;if(0!==c){const t=Math.cos(c),s=Math.sin(c),r=(a-e)*t-(l-n)*s+e,o=(a-e)*s+(l-n)*s+n;i+=(f-r)*(m+o)/2,f=r,m=o}else i+=(f-a)*(m+l)/2,f=a,m=l}const g=h+l;r=e+Math.cos(g)*s,a=n+Math.sin(g)*o;break}case mn:const d=t[u++],p=t[u++];i+=t[u++]*t[u++],r=d,a=p;break;case fn:l&&(i+=(r-o)*(a+h)/2),r=n,a=s}}return Math.abs(i)}}const vn=new ai,xn=[],bn=[],wn=[],_n=new We,Sn=new We,En=new We,Mn=new We,An=new We,Tn=new We,Cn=new Ui,In=new Ui,Dn=new Ui;function Ln(t,e,i=[0,0,0,0,0,0,0,0]){const[n,s,r,a,o,h,l,u]=t;i[0]=n,i[1]=s;const c=Math.cos(o),d=Math.sin(o);En.set(r*c,r*d).applyMatrix3(e),Mn.set(-a*d,a*c).applyMatrix3(e);const p=Cn.set(En.x,Mn.x,0,En.y,Mn.y,0,0,0,1),f=In.copy(p).invert(),m=Dn.copy(f).transpose().multiply(f).elements,g=function(t,e,i){let n,s,r,a,o=0;const h=t+i,l=t-i,u=Math.sqrt(l*l+4*e*e);h>0?(o=.5*(h+u),a=1/o,n=t*a*i-e*a*e):h<0?n=.5*(h-u):(o=.5*u,n=-.5*u);s=l>0?l+u:l-u;Math.abs(s)>2*Math.abs(e)?(a=-2*e/s,r=1/Math.sqrt(1+a*a),s=a*r):0===Math.abs(e)?(s=1,r=0):(a=-.5*s/e,s=1/Math.sqrt(1+a*a),r=a*s);l>0&&(a=s,s=-r,r=a);return{rt1:o,rt2:n,cs:s,sn:r}}(m[0],m[1],m[4]),y=Math.sqrt(g.rt1),v=Math.sqrt(g.rt2);i[2]=1/y,i[3]=1/v,i[4]=Math.atan2(g.sn,g.cs);if(!((l-h)%(2*Math.PI)<Number.EPSILON)){const t=In.set(y,0,0,0,v,0,0,0,1),n=Dn.set(g.cs,g.sn,0,-g.sn,g.cs,0,0,0,1),s=t.multiply(n).multiply(p),r=t=>{const{x:e,y:i}=new We(Math.cos(t),Math.sin(t)).applyMatrix3(s);return Math.atan2(i,e)};i[5]=r(h),i[6]=r(l),e.isTransformFlipped()&&(i[7]=u?0:1)}return i}function Bn(t,e,i=[0,0,0,0,0,0,0,0]){const[n,s,r,a,o,h,l,u]=t;i[0]=n,i[1]=s;const c=e.getTransformScaleX(),d=e.getTransformScaleY();i[2]=r*c,i[3]=a*d;const p=c>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);return i[4]=o+p,e.isTransformFlipped()&&(i[5]=-1*h,i[6]=-1*l,i[7]=u?0:1),i}class Pn{static destroy(){this.cached.clear(),this.cachedCanvas.clear()}static createCanvas(t){var e;if(!(null==(e=Ae.window)?void 0:e.document))throw new Error("environment not support");let i,n;if(t.containerId&&(i=Ae.window.document.getElementById(t.containerId)),i||(i=Ae.window.document.getElementsByTagName("body")[0]),t.canvasId&&(n=Ae.window.document.getElementById(t.canvasId)||void 0),t.width||(t.width=(null==i?void 0:i.offsetWidth)||100),t.height||(t.height=(null==i?void 0:i.offsetHeight)||100),t.dpr||(t.dpr=Ae.config.dpr),n)this.resizeCanvas(n,t.width,t.height,t.dpr);else{if(n=this.createHtmlCanvas(t.width,t.height,t.dpr),!n)throw new Error("error environment");t.canvasId&&n.setAttribute("id",t.canvasId),null==i||i.appendChild(n)}return n.style.background=t.background||"transparent",n}static getContext2D(t,e={}){const i={alpha:!0,willReadFrequently:!!e.willReadFrequently},n=t.getContext("2d",i);if(!n)throw new Error("getContext2D error");return n.scale(e.dpr||1,e.dpr||1),n}static resizeCanvas(t,e,i,n=1){t instanceof OffscreenCanvas?(t.width=e,t.height=i):t instanceof HTMLCanvasElement&&(t.setAttribute("width",(e*n).toString()),t.setAttribute("height",(i*n).toString()),t.style.width=e+"px",t.style.height=i+"px",t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.imageRendering="pixelated",t.style.transform="translateZ(0)")}static getImageBitmapByCanvasAsync(t){return d(this,null,(function*(){if(t)return t instanceof OffscreenCanvas?t.transferToImageBitmap():t instanceof HTMLCanvasElement?yield createImageBitmap(t):void 0}))}static get(t,e,i,n=1){let s=this.cached.get(t);return s||(s=this.create(e,i,n),this.set(t,s)),this.resizeCanvas(s,e,i,n),s}static set(t,e){if(!t||!e)throw new Error("error input");return this.cached.set(t,e)}static remove(t){this.cached.has(t)&&this.cached.delete(t)}static create(t,e,i=1){var n;if(null==(n=Ae.window)?void 0:n.OffscreenCanvas)return new OffscreenCanvas(t,e);throw new Error("environment does not support")}static createHtmlCanvas(t,e,i=1){if(!Ae.window.document)throw new Error("environment does not support");const n=Ae.window.document.createElement("canvas");return this.resizeCanvas(n,t,e,i),n}static measureText(t,e,i=new We){if(!t)throw new Error("input error");const n=this.get("measureText",1,1).getContext("2d");if(!n)throw new Error("bufferCtx not found");e.render(n);const s=n.measureText(t);if(!s)throw new Error("measureText error");const r=s.actualBoundingBoxRight+s.actualBoundingBoxLeft,a=s.actualBoundingBoxAscent+s.actualBoundingBoxDescent;return i.set(r,a),i}static measureText2(t,e=12,i=new We){if(!t)throw new Error("input error");const n=this.get("measureText",1,1).getContext("2d");if(!n)throw new Error("bufferCtx not found");n.font=`${e}px sans-serif`;const s=n.measureText(t);if(!s)throw new Error("measureText error");const r=s.actualBoundingBoxRight+s.actualBoundingBoxLeft,a=s.actualBoundingBoxAscent+s.actualBoundingBoxDescent;return i.set(r,a),i}static getCtx(t,e,i,n=1){if(!kn[t]){const s=this.create(e,i,n);kn[t]={cvs:s,ctx:s.getContext("2d")},this.resizeCanvas(s,e,i,n)}return kn[t].ctx}}c(Pn,"cached",new Map),c(Pn,"cachedCanvas",new Map);const kn={};class Nn{constructor(){c(this,"instancedMesh",!1),c(this,"_xml"),c(this,"_symbolsNodeMap",{}),c(this,"paths",[]),c(this,"labels",[]),c(this,"symbolsMap",{}),c(this,"instances",[]),c(this,"_viewBox",new ai),c(this,"_isInDefs",!1),c(this,"_transformStack",[]),c(this,"_currentTransform",new Ui),c(this,"centralInitialized",!1),c(this,"centralPoint",new We),c(this,"defaultUnit","px"),c(this,"defaultDPI",90),c(this,"stylesheets",{}),c(this,"float2Int",!0),c(this,"scaleFactor",1),c(this,"ASSET_TYPES",[])}static createSVG(t,e){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");return i.setAttribute("width",t.toString()),i.setAttribute("height",e.toString()),i}static createSVGPath(t){const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d",t),e}static createSVGText(t,e,i){const n=document.createElementNS("http://www.w3.org/2000/svg","text");return n.setAttribute("x",e.toString()),n.setAttribute("y",i.toString()),n.textContent=t,n}static getInstance(){return On}static setInstancedMesh(t){return this.getInstance().setInstancedMesh(t)}static parse(t,e={}){return this.getInstance().parse(t,e)}static getBoundingBoxByNode(t,e=new ai){if(e.makeEmpty(),!t)return e;if("text"===t.nodeName){if("function"==typeof t.getBBox){const i=t.getBBox();e.min.set(i.x,i.y),e.max.set(i.x+i.width,i.y+i.height)}const i=t.textContent||"",n=parseInt(t.getAttribute("font-size")||"12");return Pn.measureText2(i,n,Yn),Yn.validate()&&(e.getCenter(Gn),e.min.setY(Gn.y-Yn.y/2),e.max.setY(Gn.y+Yn.y/2)),this.parseNodeTransform(t,Fn),parseInt(t.getAttribute("stroke-width")||"0"),e.applyMatrix3(Fn),e}const i=Nn.getInstance().parseNode(t);if(!i.length)return e;for(let t=0,n=i.length;t<n;t++)i[t].computeBoundingBox($n),e.union($n);return e}static parseNodeTransform(t,e){return Nn.getInstance().parseNodeTransform(t,void 0,e)}static getSvgPathDByData(t){if(!t||0===t.length)return"";const e=Array.isArray(t)?t:Array.from(t);let i="",n=0;for(;n<e.length;){switch(e[n++]){case ln:i+=`M${e[n++]} ${e[n++]}`;break;case un:i+=`L${e[n++]} ${e[n++]}`;break;case cn:i+=`C${e[n++]} ${e[n++]} ${e[n++]} ${e[n++]} ${e[n++]} ${e[n++]}`;break;case dn:i+=`Q${e[n++]} ${e[n++]} ${e[n++]} ${e[n++]}`;break;case pn:const t=e[n++],s=e[n++],r=e[n++],a=e[n++],o=e[n++],h=e[n++],l=e[n++],u=e[n++],c=t+Math.cos(o+h)*r,d=s+Math.sin(o+h)*a;i+=`A${r} ${a} ${l} ${Math.abs(h)>Math.PI?1:0} ${u?0:1} ${c} ${d}`;break;case mn:const p=e[n++],f=e[n++],m=e[n++],g=e[n++];i+=`M${p} ${f} L${p+m} ${f} L${p+m} ${f+g} L${p} ${f+g} Z`;break;case gn:const y=e[n++],v=e[n++],x=e[n++],b=e[n++],w=e[n++],_=e[n++],S=e[n++],E=e[n++],M=y+Math.cos(_)*x,A=v+Math.sin(_)*b,T=y+Math.cos(S)*x,C=v+Math.sin(S)*b;i+=`M${M} ${A} A${x} ${b} ${w} ${Math.abs(S-_)>Math.PI?1:0} ${E?0:1} ${T} ${C}`;break;case fn:i+="Z"}}return i}static getPathProxyBySvgPathD(t,e){return Nn.getInstance().getPathProxyBySvgPathD(t,e)}setInstancedMesh(t){return this.instancedMesh=t,this}dispose(){this._xml=void 0,this._symbolsNodeMap={},this.paths=[],this.labels=[],this.symbolsMap={},this.instances=[],this._viewBox.makeEmpty(),this._isInDefs=!1,this._transformStack=[],this._currentTransform.identity(),this.centralPoint.identity(),this.centralInitialized=!1,this.stylesheets={},this.ASSET_TYPES=[]}parse(t,e={}){var i;this.dispose();const n=(new DOMParser).parseFromString(t,"image/svg+xml");this._xml=n.documentElement,Zn((null==(i=this._xml)?void 0:i.getAttribute("viewBox"))||"",this._viewBox),this._viewBox.getCenter(this.centralPoint);const s=rn(this._xml),r=function(t,e=[]){return e.length=0,an(t||[],(t=>{var i;if("assets"===t.label&&(null==(i=t.children)?void 0:i.length))for(let i,n=0,s=t.children.length;n<s;n++)i=t.children[n],i.label&&e.push(ri.head(ri.split(i.label,"-"))||"")})),e=ri.uniq(ri.compact(e)),e}(s);this.ASSET_TYPES=ri.uniq(ri.compact([...r,...Object.values(Li)])),this.parseNode(this._xml,e,this.paths);const a={xml:this._xml,viewBox:this._viewBox.clone(),idsTree:s,assetTypes:r,paths:this.paths,labels:this.labels};return this.instancedMesh&&(a.symbolsMap=this.symbolsMap,a.instances=this.instances),a}getViewBox(t,e=new ai){let i=((null==t?void 0:t.getAttribute("viewBox"))||"").split(" "),n=ri.map(i,(t=>parseFloat(t)));return 4!==(null==n?void 0:n.length)||(e.min.set(n[0],n[1]),e.max.set(n[0]+n[2],n[1]+n[3])),e}parseNode(t,e={},i=[],n,s){var r,a,o;if(1!==t.nodeType)return i;let h=!1;const l="function"==typeof t.getAttribute?t.getAttribute("id"):null,u=this.getNodeTransform(t,e);let c;const d=(t={},e,i)=>{if(!t)return;const s=(null==i?void 0:i.assetType)||this.getAssetType(e),r=(null==i?void 0:i.layerType)||this.getAssetType(e,"layer");return ri.set(t,"userData",{pid:n,id:l||n,nodeName:e.nodeName,layerType:r,assetType:s,style:Object.assign({},i)}),t};switch(t.nodeName){case"svg":case"g":e=this.parseStyle(t,e);break;case"defs":h=!0,this._isInDefs=!0;break;case"style":this.parseCSSStylesheetByTextContent(t);break;case"symbol":if(!l||!this._isInDefs&&this.symbolsMap[l]){if(!this._isInDefs&&l){const t=this.symbolsMap[l],e=(null==t?void 0:t.paths)||[];for(let n=0,s=(null==e?void 0:e.length)||0;n<s;n++)c=e[n],c&&(c=c.clone(),ri.set(c,"userData",Object.assign({},t.userData)),this.transformPath(c,this._currentTransform),i.push(c));return u&&(this._transformStack.pop(),this._transformStack.length>0?this._currentTransform.copy(this._transformStack[this._transformStack.length-1]):this._currentTransform.identity()),i}}else e=this.parseStyle(t,e),this._symbolsNodeMap[l]=t,ri.set(this.symbolsMap,`[${l}].symbolId`,l),ri.set(this.symbolsMap,`[${l}].style`,e);break;case"use":const p=(t.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),f=this._symbolsNodeMap[p],m=this.symbolsMap[p];if(f&&(e=this.parseStyle(f,e)),void 0===(e=this.parseStyle(t,e)).assetType&&(e.assetType=this.getAssetType(t)),void 0===e.layerType&&(e.layerType=this.getAssetType(t,"layer")),!this._isInDefs&&this.instancedMesh&&m){const i={symbolId:p,transform:this._currentTransform.clone(),userData:{}};d(i,t,e),this.instances.push(i)}else f&&(d(m,t,e),this.parseNode(f,e,i,l||n,s));break;case"path":e=this.parseStyle(t,e),t.hasAttribute("d")&&(c=this.parsePathNode(t,s));break;case"rect":e=this.parseStyle(t,e),c=this.parseRectNode(t,s);break;case"polygon":e=this.parseStyle(t,e),c=this.parsePolygonNode(t,s);break;case"polyline":e=this.parseStyle(t,e),c=this.parsePolylineNode(t,s);break;case"circle":e=this.parseStyle(t,e),c=this.parseCircleNode(t,s);break;case"ellipse":e=this.parseStyle(t,e),c=this.parseEllipseNode(t,s);break;case"line":e=this.parseStyle(t,e),c=this.parseLineNode(t,s);break;case"text":e=this.parseStyle(t,e);const g=this.parseTextNode(t,e,s);if(!g)return i;d(g,t,e),n||ri.set(g,"userData.pid",this.getId(t)),ri.set(g,"userData.textContent",t.textContent),ri.set(g,"transform",this._currentTransform.clone()),ri.set(g,"userData.id",ri.get(g,"userData.id")),ri.set(g,"userData.pid",this.getParentId(t,n));const y=this.getLabelAssetId(t);if(y?ri.set(g,"userData.aid",y):ri.set(g,"userData.aid",ri.split((null==(r=null==g?void 0:g.userData)?void 0:r.id)||"","-").splice(2).join("-")),this._isInDefs&&this.symbolsMap[null==(a=g.userData)?void 0:a.pid]){const t=g.userData.pid,e=(null==(o=this.symbolsMap[t])?void 0:o.labels)||[];e.push(g),ri.set(this.symbolsMap,`[${t}].labels`,e)}else this.labels.push(g)}c&&(d(c,t,e),this.transformPath(c,this._currentTransform),i.push(c));const p=t.childNodes;for(let t,n=0,r=p.length;n<r;n++)if(t=p[n],!h||"style"===t.nodeName||"symbol"===t.nodeName)if(this._isInDefs&&"symbol"===t.nodeName){const i=t.getAttribute("id");if(i){const n=this.parseNode(t,e);ri.set(this.symbolsMap,`[${i}].paths`,n)}}else this.parseNode(t,e,i,l,s);return u&&(this._transformStack.pop(),this._transformStack.length>0?this._currentTransform.copy(this._transformStack[this._transformStack.length-1]):this._currentTransform.identity()),h&&(this._isInDefs=!1),i}transformPath(t,e){t.applyMatrix3(e)}getNodeTransform(t,e){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))||"text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))))return null;const i=this.parseNodeTransform(t,e);return this._transformStack.length>0&&i.premultiply(this._transformStack[this._transformStack.length-1]),this._currentTransform.copy(i),this._transformStack.push(i),i}parseNodeTransform(t,e,i=new Ui){var n;if(i.identity(),!t)return i;this.centralInitialized&&(i.translate(-this.centralPoint.x,-this.centralPoint.y),this.centralInitialized=!0);const s=Un;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){const e=this.parseFloatWithUnits(t.getAttribute("x")),n=this.parseFloatWithUnits(t.getAttribute("y"));i.translate(e,n)}else if("text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))){const n=t.hasAttribute("dx")?this.parseFloatWithUnits(t.getAttribute("dx")||0,{fontSize:null==e?void 0:e.fontSize}):0,s=t.hasAttribute("dy")?this.parseFloatWithUnits(t.getAttribute("dy")||0,{fontSize:null==e?void 0:e.fontSize}):0;i.translate(n,s)}if(t.hasAttribute("transform")){const e=null==(n=t.getAttribute("transform"))?void 0:n.split(")");if(!(null==e?void 0:e.length))return i;for(let t=((null==e?void 0:e.length)||0)-1;t>=0;t--){const n=e[t].trim();if(""===n)continue;const r=n.indexOf("("),a=n.length;if(r>0&&r<a){const t=n.slice(0,r),e=this.parseFloats(n.slice(r+1));switch(s.identity(),t){case"translate":if(e.length>=1){const t=e[0];let i=0;e.length>=2&&(i=e[1]),s.translate(t,i)}break;case"rotate":if(e.length>=1){let t=0,i=0,n=0;t=e[0]*Math.PI/180,e.length>=3&&(i=e[1],n=e[2]),Vn.makeTranslation(-i,-n),qn.makeRotation(t),jn.multiplyMatrices(qn,Vn),Vn.makeTranslation(i,n),s.multiplyMatrices(Vn,jn)}break;case"scale":if(e.length>=1){const t=e[0];let i=t;e.length>=2&&(i=e[1]),s.scale(t,i)}break;case"skewX":1===e.length&&s.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&s.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&s.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}i.premultiply(s)}}return i}parseStyle(t,e){var i;e=Object.assign({},e);let n={};if(t.hasAttribute("class")){const e=null==(i=t.getAttribute("class"))?void 0:i.split(/\s/).filter(Boolean).map((t=>t.trim())).map((t=>t.startsWith(".")?t.substring(1):t));for(let t=0,i=(null==e?void 0:e.length)||0;t<i;t++)n=Object.assign(n,this.stylesheets["."+e[t]])}function s(i,s,r){void 0===r&&(r=function(t){return t.startsWith("url"),t}),t.hasAttribute(i)&&(e[s]=r(t.getAttribute(i))),n[i]&&(e[s]=r(n[i])),t.style&&""!==t.style[i]&&(e[s]=r(t.style[i]))}t.hasAttribute("id")&&(n=Object.assign(n,this.stylesheets["#"+t.getAttribute("id")]));const{fontSize:r,strokeWidth:a}=e,o=this;function h(t){return Math.max(0,Math.min(1,o.parseFloatWithUnits(t)))}function l(t){return Math.max(0,o.parseFloatWithUnits(t,{fontSize:r}))}s("font-size","fontSize",l),s("fill","fill"),s("fill-opacity","fillOpacity",h),s("fill-rule","fillRule"),s("opacity","opacity",h),s("stroke","stroke"),s("stroke-opacity","strokeOpacity",h),s("stroke-width","strokeWidth",(function(t){return Math.max(0,o.parseFloatWithUnits(t,{strokeWidth:a,noDef:!0}))})),s("stroke-linejoin","strokeLineJoin"),s("stroke-linecap","strokeLineCap"),s("stroke-miterlimit","strokeMiterLimit",l),s("visibility","visibility");const u=t.getAttribute("stroke-width")||e.strokeWidth;return ri.endsWith(u,"%")&&(e.thinLine=!0),"none"!==e.fill&&"transparent"!==e.fill||delete e.fill,"none"!==e.stroke&&"transparent"!==e.stroke||delete e.stroke,e}parseCSSStylesheetByTextContent(t){const e=t.textContent.replace(/\/\*[\s\S]*?\*\//g,"").replace(/([^;])}/g,"$1;}"),i=[];let n="",s=0;for(const t of e)"{"===t?s++:"}"===t&&s--,n+=t,"}"===t&&0===s&&(i.push(n.trim()),n="");for(const t of i){if(!t.includes("{"))continue;const[e,i]=t.split(/\s*\{\s*/);if(!e||!i)continue;const n=e.split(",").map((t=>t.trim())).filter(Boolean),s={};i.replace(/}\s*$/,"").split(";").map((t=>t.trim())).filter(Boolean).forEach((t=>{const[e,i]=t.split(/:\s*/);if(e&&i){const t=i.replace(/\s*!important\s*$/,"").trim();s[e.trim()]=t}})),n.forEach((t=>{t&&(this.stylesheets[t]=l(l({},this.stylesheets[t]||{}),s))}))}}parsePathNode(t,e=!1){const i=t.getAttribute("d");if(i&&""!==i&&"none"!==i)return this.getPathProxyBySvgPathD(i,void 0,e)}getPathProxyBySvgPathD(t,e=new yn,i=!1){if(!t)return;const n=new We,s=new We,r=new We;let a=!0,o=!1;const h=t.match(/[a-df-z][^a-df-z]*/gi);if(null==h?void 0:h.length){for(let t=0,l=(null==h?void 0:h.length)||0;t<l;t++){const l=h[t],u=l.charAt(0),c=l.slice(1).trim();let d;switch(!0===a&&(o=!0,a=!1),u){case"M":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t+=2)n.x=i?d[t]:this.normalizeX(d[t]),n.y=i?d[t+1]:this.normalizeY(d[t+1]),s.x=n.x,s.y=n.y,0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y),0===t&&r.copy(n);break;case"H":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t++)n.x=i?d[t]:this.normalizeX(d[t]),s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===o&&r.copy(n);break;case"V":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t++)n.y=i?d[t]:this.normalizeY(d[t]),s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===o&&r.copy(n);break;case"L":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t+=2)n.x=i?d[t]:this.normalizeX(d[t]),n.y=i?d[t+1]:this.normalizeY(d[t+1]),s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===o&&r.copy(n);break;case"C":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=6)t=i?[d[a],d[a+1],d[a+2],d[a+3],d[a+4],d[a+5]]:[this.normalizeX(d[a]),this.normalizeY(d[a+1]),this.normalizeX(d[a+2]),this.normalizeY(d[a+3]),this.normalizeX(d[a+4]),this.normalizeY(d[a+5])],e.bezierCurveTo(...t),s.x=t[2],s.y=t[3],n.x=t[4],n.y=t[5],0===a&&!0===o&&r.copy(n);break;case"S":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=4)t=i?[d[a],d[a+1],d[a+2],d[a+3]]:[this.normalizeX(d[a]),this.normalizeY(d[a+1]),this.normalizeX(d[a+2]),this.normalizeY(d[a+3])],e.bezierCurveTo(this.getReflection(n.x,s.x),this.getReflection(n.y,s.y),t[0],t[1],t[2],t[3]),s.x=t[0],s.y=t[1],n.x=t[2],n.y=t[3],0===a&&!0===o&&r.copy(n);break;case"Q":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=4)t=i?[d[a],d[a+1],d[a+2],d[a+3]]:[this.normalizeX(d[a]),this.normalizeY(d[a+1]),this.normalizeX(d[a+2]),this.normalizeY(d[a+3])],e.quadraticCurveTo(t[0],t[1],t[2],t[3]),s.x=t[0],s.y=t[1],n.x=t[2],n.y=t[3],0===a&&!0===o&&r.copy(n);break;case"T":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=2){const h=this.getReflection(n.x,s.x),l=this.getReflection(n.y,s.y);t=i?[d[a],d[a+1]]:[this.normalizeX(d[a]),this.normalizeY(d[a+1])],e.quadraticCurveTo(h,l,t[0],t[1]),s.x=h,s.y=l,n.x=t[0],n.y=t[1],0===a&&!0===o&&r.copy(n)}break;case"A":d=this.parseFloats(c,[3,4],7);for(let t,a=0,h=d.length;a<h;a+=7){if(t=i?[d[a],d[a+1],d[a+2],d[a+3],d[a+4],d[a+5],d[a+6]]:[this.normalizeX(d[a]),this.normalizeY(d[a+1]),d[a+2],d[a+3],d[a+4],this.normalizeW(d[a+5]),this.normalizeH(d[a+6])],t[5]==n.x&&t[6]==n.y)continue;const h=n.clone();n.x=t[5],n.y=t[6],s.x=n.x,s.y=n.y,this.parseArcCommand(e,t[a],t[1],t[2],t[3],t[4],h,n),0===a&&!0===o&&r.copy(n)}break;case"m":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t+=2)n.x+=i?d[t]:this.normalizeW(d[t]),n.y+=i?d[t+1]:this.normalizeH(d[t+1]),s.x=n.x,s.y=n.y,0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y),0===t&&r.copy(n);break;case"h":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t++)n.x+=i?d[t]:this.normalizeW(d[t]),s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===o&&r.copy(n);break;case"v":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t++)n.y+=i?d[t]:this.normalizeH(d[t]),s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===o&&r.copy(n);break;case"l":d=this.parseFloats(c);for(let t=0,a=d.length;t<a;t+=2)n.x+=i?d[t]:this.normalizeW(d[t]),n.y+=i?d[t+1]:this.normalizeH(d[t+1]),s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===o&&r.copy(n);break;case"c":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=6)t=i?[d[a],d[a+1],d[a+2],d[a+3],d[a+4],d[a+5]]:[this.normalizeW(d[a]),this.normalizeH(d[a+1]),this.normalizeW(d[a+2]),this.normalizeH(d[a+3]),this.normalizeW(d[a+4]),this.normalizeH(d[a+5])],e.bezierCurveTo(n.x+t[0],n.y+t[1],n.x+t[2],n.y+t[3],n.x+t[4],n.y+t[5]),s.x=n.x+t[2],s.y=n.y+t[3],n.x+=t[4],n.y+=t[5],0===a&&!0===o&&r.copy(n);break;case"s":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=4)t=i?[d[a],d[a+1],d[a+2],d[a+3]]:[this.normalizeW(d[a]),this.normalizeH(d[a+1]),this.normalizeW(d[a+2]),this.normalizeH(d[a+3])],e.bezierCurveTo(this.getReflection(n.x,s.x),this.getReflection(n.y,s.y),n.x+t[0],n.y+t[1],n.x+t[2],n.y+t[3]),s.x=n.x+t[0],s.y=n.y+t[1],n.x+=t[2],n.y+=t[3],0===a&&!0===o&&r.copy(n);break;case"q":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=4)t=i?[d[a],d[a+1],d[a+2],d[a+3]]:[this.normalizeW(d[a]),this.normalizeH(d[a+1]),this.normalizeW(d[a+2]),this.normalizeH(d[a+3])],e.quadraticCurveTo(n.x+t[0],n.y+t[1],n.x+t[2],n.y+t[3]),s.x=n.x+t[0],s.y=n.y+t[1],n.x+=t[2],n.y+=t[3],0===a&&!0===o&&r.copy(n);break;case"t":d=this.parseFloats(c);for(let t,a=0,h=d.length;a<h;a+=2){const h=this.getReflection(n.x,s.x),l=this.getReflection(n.y,s.y);t=i?[d[a],d[a+1]]:[this.normalizeW(d[a]),this.normalizeH(d[a+1])],e.quadraticCurveTo(h,l,n.x+t[0],n.y+t[1]),s.x=h,s.y=l,n.x=n.x+t[0],n.y=n.y+t[1],0===a&&!0===o&&r.copy(n)}break;case"a":d=this.parseFloats(c,[3,4],7);for(let t,a=0,h=d.length;a<h;a+=7){if(t=i?[d[a],d[a+1],d[a+2],d[a+3],d[a+4],d[a+5],d[a+6]]:[this.normalizeW(d[a]),this.normalizeH(d[a+1]),d[a+2],d[a+3],d[a+4],this.normalizeW(d[a+5]),this.normalizeH(d[a+6])],0==t[5]&&0==t[6])continue;const h=n.clone();n.x+=t[5],n.y+=t[6],s.x=n.x,s.y=n.y,this.parseArcCommand(e,t[0],t[1],t[2],t[3],t[4],h,n),0===a&&!0===o&&r.copy(n)}break;case"Z":case"z":e.closePath()}o=!1}return e}}parseArcCommand(t,e,i,n,s,r,a,o){if(0==e||0==i)return void t.lineTo(o.x,o.y);n=n*Math.PI/180,e=Math.abs(e),i=Math.abs(i);const h=(a.x-o.x)/2,l=(a.y-o.y)/2,u=Math.cos(n)*h+Math.sin(n)*l,c=-Math.sin(n)*h+Math.cos(n)*l;let d=e*e,p=i*i;const f=u*u,m=c*c,g=f/d+m/p;if(g>1){const t=Math.sqrt(g);d=(e*=t)*e,p=(i*=t)*i}const y=d*m+p*f,v=(d*p-y)/y;let x=Math.sqrt(Math.max(0,v));s===r&&(x=-x);const b=x*e*c/i,w=-x*i*u/e,_=Math.cos(n)*b-Math.sin(n)*w+(a.x+o.x)/2,S=Math.sin(n)*b+Math.cos(n)*w+(a.y+o.y)/2,E=this.svgAngle(1,0,(u-b)/e,(c-w)/i),M=this.svgAngle((u-b)/e,(c-w)/i,(-u-b)/e,(-c-w)/i)%(2*Math.PI);t.absellipse(_,S,e,i,n,E,E+M,0===r)}svgAngle(t,e,i,n){const s=t*i+e*n,r=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+n*n);let a=Math.acos(Math.max(-1,Math.min(1,s/r)));return t*n-e*i<0&&(a=-a),a}parseRectNode(t,e=!1){let i=this.parseFloatWithUnits(t.getAttribute("x")||0),n=this.parseFloatWithUnits(t.getAttribute("y")||0),s=this.parseFloatWithUnits(t.getAttribute("rx")||t.getAttribute("ry")||0),r=this.parseFloatWithUnits(t.getAttribute("ry")||t.getAttribute("rx")||0),a=this.parseFloatWithUnits(t.getAttribute("width")),o=this.parseFloatWithUnits(t.getAttribute("height"));e||(i=this.normalizeX(i),n=this.normalizeY(n),s=this.normalizeW(s),r=this.normalizeH(r),a=this.normalizeW(a),o=this.normalizeH(o));const h=.448084975506,l=new yn;return l.moveTo(i+s,n),l.lineTo(i+a-s,n),0===s&&0===r||l.bezierCurveTo(i+a-s*h,n,i+a,n+r*h,i+a,n+r),l.lineTo(i+a,n+o-r),0===s&&0===r||l.bezierCurveTo(i+a,n+o-r*h,i+a-s*h,n+o,i+a-s,n+o),l.lineTo(i+s,n+o),0===s&&0===r||l.bezierCurveTo(i+s*h,n+o,i,n+o-r*h,i,n+o-r),l.lineTo(i,n+r),0===s&&0===r||l.bezierCurveTo(i,n+r*h,i+s*h,n,i+s,n),l}parsePolygonNode(t,e=!1){var i;const n=this;const s=new yn;let r=0;return null==(i=t.getAttribute("points"))||i.replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,(function(t,i,a){const o=e?n.parseFloatWithUnits(i):n.normalizeX(n.parseFloatWithUnits(i)),h=e?n.parseFloatWithUnits(a):n.normalizeY(n.parseFloatWithUnits(a));return 0===r?s.moveTo(o,h):s.lineTo(o,h),r++,t})),s.autoClose=!0,s}parsePolylineNode(t,e=!1){var i;const n=this;const s=new yn;let r=0;return null==(i=t.getAttribute("points"))||i.replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,(function(t,i,a){const o=e?n.parseFloatWithUnits(i):n.normalizeX(n.parseFloatWithUnits(i)),h=e?n.parseFloatWithUnits(a):n.normalizeY(n.parseFloatWithUnits(a));return 0===r?s.moveTo(o,h):s.lineTo(o,h),r++,t})),s.autoClose=!1,s}parseCircleNode(t,e=!1){let i=this.parseFloatWithUnits(t.getAttribute("cx")||0),n=this.parseFloatWithUnits(t.getAttribute("cy")||0),s=this.parseFloatWithUnits(t.getAttribute("r")||0);e||(i=this.normalizeX(i),n=this.normalizeY(n),s=this.normalizeW(s));const r=new yn;return r.absarc(i,n,s,0,2*Math.PI),r}parseEllipseNode(t,e=!1){let i=this.parseFloatWithUnits(t.getAttribute("cx")||0),n=this.parseFloatWithUnits(t.getAttribute("cy")||0),s=this.parseFloatWithUnits(t.getAttribute("rx")||0),r=this.parseFloatWithUnits(t.getAttribute("ry")||0);e||(i=this.normalizeX(i),n=this.normalizeY(n),s=this.normalizeW(s),r=this.normalizeH(r));const a=new yn;return a.absellipse(i,n,s,r,0,0,2*Math.PI,!1),a}parseLineNode(t,e=!1){let i=this.parseFloatWithUnits(t.getAttribute("x1")||0),n=this.parseFloatWithUnits(t.getAttribute("y1")||0),s=this.parseFloatWithUnits(t.getAttribute("x2")||0),r=this.parseFloatWithUnits(t.getAttribute("y2")||0);e||(i=this.normalizeX(i),n=this.normalizeY(n),s=this.normalizeX(s),r=this.normalizeY(r));const a=new yn;return a.moveTo(i,n),a.lineTo(s,r),a}parseTextNode(t,e,i=!1){let n=parseFloat(t.getAttribute("x")||"0"),s=parseFloat(t.getAttribute("y")||"0");i||(n=this.normalizeX(n),s=this.normalizeY(s));const r=t.textContent;if(!r||!e.fontSize)return;const a=Object.assign({},e);return a.fill=t.getAttribute("fill")||e.fill||"#000",a.fontSize=parseFloat(t.getAttribute("font-size")||"0")||parseFloat(e.fontSize)||72,a.fontFamily=t.getAttribute("font-family")||e.fontFamily||"Arial",{textContent:r,style:a,userData:{}}}parseFloatWithUnits(t,e){let i,n="px";if("string"==typeof t||t instanceof String){t=null==t?void 0:t.trim();for(let e=0,i=Rn.length;e<i;e++){const i=Rn[e];if(t.endsWith(i)){n=i,t=t.substring(0,t.length-i.length);break}}}if("px"===n&&"px"!==this.defaultUnit)i=zn.in[this.defaultUnit]/this.defaultDPI;else if("%"===n){this._viewBox.getSize(Yn),jn.copy(this._currentTransform).getScale(Gn);const t=Math.abs(Gn.x||1);i=Yn.x/100*t}else"em"===n?i=(null==e?void 0:e.fontSize)||Hn:(i=zn[n][this.defaultUnit],i<0&&(i=zn[n].in*this.defaultDPI));return i*parseFloat(t)}getReflection(t,e){return t-(e-t)}parseFloats(t,e,i){if("string"!=typeof t)throw new TypeError("Invalid input: "+typeof t);const n={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let s=0,r=!0,a="",o="";const h=[];function l(t,e,i){const n=new SyntaxError('Unexpected character "'+t+'" at index '+e+".");throw n.partial=i,n}function u(){""!==a&&(""===o?h.push(Number(a)):h.push(Number(a)*Math.pow(10,Number(o)))),a="",o=""}let c;const d=t.length;for(let p=0;p<d;p++)if(c=t[p],Array.isArray(e)&&e.includes(h.length%(i||0))&&n.FLAGS.test(c))s=1,a=c,u();else{if(0===s){if(n.WHITESPACE.test(c))continue;if(n.DIGIT.test(c)||n.SIGN.test(c)){s=1,a=c;continue}if(n.POINT.test(c)){s=2,a=c;continue}n.COMMA.test(c)&&(r&&l(c,p,h),r=!0)}if(1===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.POINT.test(c)){a+=c,s=2;continue}if(n.EXP.test(c)){s=3;continue}n.SIGN.test(c)&&1===a.length&&n.SIGN.test(a[0])&&l(c,p,h)}if(2===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.EXP.test(c)){s=3;continue}n.POINT.test(c)&&"."===a[a.length-1]&&l(c,p,h)}if(3===s){if(n.DIGIT.test(c)){o+=c;continue}if(n.SIGN.test(c)){if(""===o){o+=c;continue}1===o.length&&n.SIGN.test(o)&&l(c,p,h)}}n.WHITESPACE.test(c)?(u(),s=0,r=!1):n.COMMA.test(c)?(u(),s=0,r=!0):n.SIGN.test(c)?(u(),s=1,a=c):n.POINT.test(c)?(u(),s=2,a=c):l(c,p,h)}return u(),h}normalizeX(t){return this.float2Int?Math.round(t*this.scaleFactor*100)/100:t*this.scaleFactor}normalizeY(t){return this.float2Int?Math.round(t*this.scaleFactor*100)/100:t*this.scaleFactor}normalizeW(t){return this.float2Int?Math.round(t*this.scaleFactor*100)/100:t*this.scaleFactor}normalizeH(t){return this.float2Int?Math.round(t*this.scaleFactor*100)/100:t*this.scaleFactor}getAssetType(t,e="asset"){let i;const n="function"==typeof t.getAttribute?t.getAttribute("id"):"";if(!n&&t.parentNode)return this.getAssetType(t.parentNode,e);if(!n)return i;if("layer"===e)i=Wn.find((t=>n===t));else{const t=null==n?void 0:n.replace(/-assets/g,"");i=this.ASSET_TYPES.find((e=>t===e))}return!i&&t.parentNode&&(i=this.getAssetType(t.parentNode,e)),i}getId(t){let e;const i="function"==typeof t.getAttribute?t.getAttribute("id"):"";return e=!i&&t.parentNode?this.getId(t.parentNode):i,e}getParentId(t,e){let i;const n=this.getId(t);return i=t.parentNode&&this.getId(t.parentNode),i&&n!==e||(i=this.getParentId(t.parentNode,e)),i||(n||"")}getLabelAssetId(t){let e;return this.getId(t),e="function"==typeof t.getAttribute?t.getAttribute("aid"):"",!e&&t.parentNode&&(e=this.getLabelAssetId(t.parentNode)),e}}const On=new Nn,Rn=["mm","cm","in","pt","pc","px","em","%"],zn={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1},"%":{"%":1,px:-1}},Hn=16,Wn=Object.values(Pi),Fn=new Ui,Un=new Ui,Vn=new Ui,qn=new Ui,jn=new Ui,Yn=new We,Gn=new We,$n=new ai;function Xn(t){if(!t)return"inches";let e=t.querySelector("#defaultView"),i=null==e?void 0:e.getAttribute("units");return i||"inches"}function Zn(t,e=new ai){if(!t)return e;let i=t.split(" "),n=ri.map(i,(t=>parseFloat(t)));return 4!==(null==n?void 0:n.length)||(e.min.set(n[0],n[1]),e.max.set(n[0]+n[2],n[1]+n[3])),e}function Jn(t){var e;if(null==(e=null==t?void 0:t.children)?void 0:e.length)for(let e=0,i=t.children.length;e<i;e++)if("g"===t.children[e].nodeName)return t.children[e]}function Qn(t){const e=document.createElementNS("http://www.w3.org/2000/svg","circle");return(null==t?void 0:t.id)&&e.setAttribute("id",t.id),e.setAttribute("cx",((null==t?void 0:t.x)||0).toString()),e.setAttribute("cy",((null==t?void 0:t.y)||0).toString()),e.setAttribute("r",((null==t?void 0:t.r)||1).toString()),(null==t?void 0:t.fill)&&e.setAttribute("fill",t.fill),(null==t?void 0:t.stroke)&&(e.setAttribute("stroke",t.stroke),e.setAttribute("stroke-width",(t.strokeWidth||1).toString())),e}function Kn(t){const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("stroke-linecap","round"),(null==t?void 0:t.id)&&e.setAttribute("id",t.id),(null==t?void 0:t.d)&&e.setAttribute("d",Nn.getSvgPathDByData(t.d)),(null==t?void 0:t.fill)&&e.setAttribute("fill",t.fill),(null==t?void 0:t.stroke)&&(e.setAttribute("stroke",t.stroke),e.setAttribute("stroke-width",(t.strokeWidth||1).toString())),(null==t?void 0:t.strokeDasharray)&&e.setAttribute("stroke-dasharray",t.strokeDasharray),e}function ts(t){var e;const i=document.createElementNS("http://www.w3.org/2000/svg","text");return(null==t?void 0:t.id)&&i.setAttribute("id",t.id),(null==t?void 0:t.fill)&&i.setAttribute("fill",t.fill),(null==t?void 0:t.stroke)&&(i.setAttribute("stroke",t.stroke),i.setAttribute("stroke-width",(t.strokeWidth||1).toString())),i.textContent=t.textContent,(null==t?void 0:t.fontSize)&&i.setAttribute("font-size",null==(e=null==t?void 0:t.fontSize)?void 0:e.toString()),i.setAttribute("text-anchor",(null==t?void 0:t.textAnchor)||"middle"),i.setAttribute("text-baseline",(null==t?void 0:t.textBaseline)||"middle"),i}function es(t,e,i,n){t&&(e||i||n)&&(Nn.parseNodeTransform(t,hs),hs.decompose(ss,rs,as),os.compose(e||ss,i||rs,n||as),null==t||t.setAttribute("transform",os.getTransformString()))}function is(t){const e=document.createElementNS("http://www.w3.org/2000/svg","g");return t&&e.setAttribute("id",t),e}function ns(t,e){t&&e&&es(t,e)}const ss=new We,rs=new We,as=new We,os=new Ui,hs=new Ui;class ls extends Fi{constructor(t){super(),c(this,"isSvgRenderer",!0),c(this,"id"),c(this,"params"),c(this,"container",Ae.window.document.getElementsByTagName("body")[0]),c(this,"cameraVersion",-1),c(this,"viewAreaLimit",-1),c(this,"autoClear"),this.id="SvgRenderer@"+Date.now(),this.params=t,Ae.config=t,this.initSvg()}destroy(){}initSvg(){if(this.params.containerId&&(this.container=Ae.window.document.getElementById(this.params.containerId)),this.container||(this.container=Ae.window.document.getElementsByTagName("body")[0]),!this.params.width||!this.params.height){const t=this.container.getBoundingClientRect();this.params.width=t.width,this.params.height=t.height}this.container.style.overflow="hidden",this.container.style.transform="translateZ(0)",this.setSize(this.params.width,this.params.height)}resize(){var t,e;const i=(null==(t=this.container)?void 0:t.parentElement)||document.body,n=i.getBoundingClientRect();if(!n)return;const s=window.getComputedStyle(i),r=n.width-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight),a=n.height-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom),o=null==(e=this.container)?void 0:e.getBoundingClientRect();if(!o)return;const h=r-o.left+n.left,l=a-o.top+n.top;this.setSize(h,l)}setSize(t,e){this.container.style.width=t+"px",this.container.style.height=e+"px",this.params.width=t,this.params.height=e,this.params.camera||(this.params.camera={}),this.params.camera.width=this.params.width,this.params.camera.height=this.params.height,this.params.aspect=this.params.width/this.params.height,this.params.camera.aspect=this.params.aspect,this.params.camera.left=-.5*this.params.width,this.params.camera.right=.5*this.params.width,this.params.camera.top=.5*this.params.height,this.params.camera.bottom=-.5*this.params.height}getSize(t){return t.set(this.params.width,this.params.height)}clean(){}render(t,e){return d(this,null,(function*(){var i;if(!t||!e)return;if(this.cameraVersion===(null==e?void 0:e.version))return;e.updateMatrixWorld(),cs.set(0,0).unproject(e),ds.set(this.params.width,this.params.height).unproject(e),us.setFromPoints([cs,ds]);let n=function(t=new ai){let e="";const i=[];return i.push(t.min.x),i.push(t.min.y),i.push(Math.abs(t.max.x-t.min.x)),i.push(Math.abs(t.max.y-t.min.y)),e=i.join(" "),e}(us);null==(i=t.svg)||i.setAttribute("viewBox",n),this.cameraVersion=e.version||-1}))}getRenderTarget(){}setRenderTarget(t){}renderTexture(t,e){}}const us=new ai,cs=new We,ds=new We,ps=["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"],fs=()=>{const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(ps[255&t]+ps[t>>8&255]+ps[t>>16&255]+ps[t>>24&255]+"-"+ps[255&e]+ps[e>>8&255]+"-"+ps[e>>16&15|64]+ps[e>>24&255]+"-"+ps[63&i|128]+ps[i>>8&255]+"-"+ps[i>>16&255]+ps[i>>24&255]+ps[255&n]+ps[n>>8&255]+ps[n>>16&255]+ps[n>>24&255]).toLowerCase()};class ms extends Fi{constructor(t={}){super(),c(this,"isObject2",!0),c(this,"id",gs++),c(this,"uuid",fs()),c(this,"name"),c(this,"type","Object2"),c(this,"featureKey","Object2_"+this.id),c(this,"parent"),c(this,"children",[]),c(this,"up",new We(0,1)),c(this,"position",new We),c(this,"rotation",new We),c(this,"scaled",new We(1,1)),c(this,"flipY",!1),c(this,"selectable",!1),c(this,"matrix",new Ui),c(this,"matrixWorld",new Ui),c(this,"matrixWorldInverse",new Ui),c(this,"modelViewMatrix",new Ui),c(this,"normalMatrix",new Ui),c(this,"fixed",!1),c(this,"dynamically",!1),c(this,"matrixAutoUpdate",!1),c(this,"matrixWorldNeedsUpdate",!1),c(this,"matrixWorldAutoUpdate",!1),c(this,"composeNode",!1),c(this,"isInComposeNode",!1),c(this,"alignCenter",!1),c(this,"boundingBox",new ai),c(this,"boundingBoxWorld",new ai),c(this,"boundingBoxNeedsUpdate",!1),c(this,"centerPoint",new We),c(this,"visible",!0),c(this,"castShadow",!1),c(this,"receiveShadow",!1),c(this,"renderOrder",0),c(this,"animations",[]),c(this,"finalSize"),c(this,"userData",{}),c(this,"DefaultUp",new We(0,1)),c(this,"_autoSort",!0),c(this,"_version",0),void 0!==t.name?this.name=t.name:this.name="Object2",void 0!==t.flipY&&(this.flipY=t.flipY),void 0!==t.selectable&&(this.selectable=t.selectable),void 0!==t.finalSize&&(this.finalSize=t.finalSize),this.setAttrs(t)}get version(){return this._version}set version(t){this._version=t}set needsUpdate(t){t&&this._version++}destroy(){super.destroy(),this.clear(),this.removeFromParent(),this.dispatchEvent(As)}setVisible(t){return this.visible=t,this}setPosition(t){return this.position.set(t.x,t.y),this}translate(t,e){this.position.x+=t,this.position.y+=e}setScale(t,e){return this.scaled.set(t,e),this}setRotationFromMatrix(t){t.decompose(ws,this.rotation,_s)}setRotation(t){return this.rotation.set(t,t),this}rotate(t){this.rotation.x+=t}scale(t,e){e?(this.scaled.x*=t,this.scaled.y*=e):this.scaled.multiplyScalar(t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix3(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix3(vs.copy(this.matrixWorld).invert())}lookAt(t){xs.copy(t),this.updateWorldMatrix(!0,!1),this.matrixWorld.getTransition(ws),vs.lookAt(ws,xs,Es),vs.getRotation(Ss),this.rotation.set(Ss.x,Ss.x),this.parent&&(this.parent.matrixWorld.getRotation(Ss),this.rotate(Ss.x))}applyMatrix3(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.rotation,this.scaled)}updateMatrix(){ys.copy(this.scaled),this.flipY&&(ys.y*=-1),this.matrix.compose(this.position,this.rotation,ys),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent?this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldInverse.copy(this.matrixWorld).invert(),this.matrixWorldNeedsUpdate=!1,t=!0,this.boundingBoxNeedsUpdate=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t);this.boundingBoxNeedsUpdate&&(this.updateBoundingBox(),this.boundingBoxNeedsUpdate=!1)}updateWorldMatrix(t=!1,e=!1){const i=this.parent;if(t&&i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent?this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldInverse.copy(this.matrixWorld).invert(),e){const t=this.children;for(let e=0,i=t.length;e<i;e++)t[e].updateWorldMatrix(!1,!0)}}updateModelViewMatrix(t){vs.copy(this.matrixWorld),t&&this.fixed?this.modelViewMatrix.copy(t.projectionMatrix):t?this.modelViewMatrix.multiplyMatrices(t.viewMatrix,vs):this.modelViewMatrix.copy(vs);for(let e=0,i=this.children.length;e<i;e++)this.children[e].updateModelViewMatrix(t)}computeBoundingBox(){this.boundingBox.makeEmpty(),this.centerPoint.set(0,0);for(let t=0,e=this.children.length;t<e;t++)this.children[t].updateMatrixWorld(),bs.copy(this.children[t].computeBoundingBox()),bs.applyMatrix3(vs.copy(this.children[t].matrixWorld)),this.boundingBox.union(bs);return this.boundingBox.applyMatrix3(this.matrixWorldInverse),this.boundingBox}updateBoundingBox(){this.boundingBox.isEmpty()||this.boundingBoxWorld.copy(this.boundingBox).applyMatrix3(this.matrixWorld)}setAttrs(t){if(!t)return this;for(const e in t)"children"!==e&&void 0!==t[e]&&("userData"===e&&t[e]?Object.keys(t[e]).forEach((i=>this.userData[i]=t[e][i])):this.userData[e]=t[e]);return this}add(t){return t&&t.isObject2&&t!==this?(t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.isInComposeNode=this.composeNode||this.isInComposeNode,t.selectable&&t.parent.setSelectable(t.selectable),this._autoSort&&this.children.sort(((t,e)=>t.renderOrder-e.renderOrder)),t.dispatchEvent(Ms),this.matrixAutoUpdate||(this.matrixWorldNeedsUpdate=!0),this.visible&&(this.needsUpdate=!0),this):this}adds(t){if(!t||!t.length)return this;this._autoSort=!1;for(let e=0,i=t.length;e<i;e++)e===t.length-1&&(this._autoSort=!0),this.add(t[e]);return this}remove(t){const e=this.children.indexOf(t);return-1!==e&&(t.parent=void 0,this.children.splice(e,1),t.dispatchEvent(As)),this}removes(t){for(let e=0,i=t.length;e<i;e++)this.remove(t[e]);return this}removeFromParent(){const t=this.parent;return t&&t.remove(this),this.parent=void 0,this}moveToLast(){const t=this.parent;t&&(this.removeFromParent(),t.add(this))}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=void 0,e.destroy(),e.dispatchEvent(As)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),vs.copy(this.matrixWorld).invert(),t.parent&&(t.parent.updateWorldMatrix(!0,!1),vs.multiply(t.parent.matrixWorld)),t.applyMatrix3(vs),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(t,Ss,_s),t}getWorldRotation(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ws,t,_s),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ws,Ss,t),t}getWorldDirection(t){return this.updateWorldMatrix(!0,!1),t.set(this.matrixWorld.elements[6],this.matrixWorld.elements[7]).normalize()}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;e&&(t(e),e.traverseAncestors(t))}traverseSome(t){if(t(this))return!0;const e=this.children;for(let i=0,n=e.length;i<n;i++)if(e[i].traverseSome(t))return!0;return!1}onBeforeRender(t,e,i,n){}render(t){}onAfterRender(t,e,i){}setSelectable(t){this.selectable=t,this.parent&&this.parent.setSelectable(t)}raycast(t,e=[]){}getByRange(t,e=!1,i=[]){if(bs.copy(t),bs.containsBox(this.boundingBoxWorld)&&i.push(this),!e||this.composeNode)return i;for(let n=0,s=this.children.length;n<s;n++)this.children[n].getByRange(t,e,i);return i}clone(t=!0,e=!1){return new(0,this.constructor)(this.userData).copy(this,t,e)}copy(t,e=!0,i=!1){if(this.name=t.name,this.type=t.type,this.featureKey=t.featureKey,this._version=0,this.parent=t.parent,this.up.copy(t.up),this.position.copy(t.position),this.rotation.copy(t.rotation),this.scaled.copy(t.scaled),this.flipY=t.flipY,this.selectable=t.selectable,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.modelViewMatrix.copy(t.modelViewMatrix),this.normalMatrix.copy(t.normalMatrix),this.fixed=t.fixed,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.composeNode=t.composeNode,this.alignCenter=t.alignCenter,this.boundingBox.copy(t.boundingBox),this.boundingBoxWorld.copy(t.boundingBoxWorld),this.boundingBoxNeedsUpdate=t.boundingBoxNeedsUpdate,this.centerPoint.copy(t.centerPoint),this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e)for(let n=0;n<t.children.length;n++){const s=t.children[n];this.add(s.clone(e,i))}return this}}let gs=0;const ys=new We,vs=new Ui,xs=new We,bs=new ai,ws=new We,_s=new We,Ss=new We,Es=new We(0,1),Ms={type:"added"},As={type:"removed"};class Ts extends ms{constructor(){super(),c(this,"name","Scene"),c(this,"type","Scene"),c(this,"isScene",!0),c(this,"view"),c(this,"background"),c(this,"featureKey","Scene_"+this.id),c(this,"matrixAutoUpdate",!1)}destroy(){super.destroy(),this.boundingBox.makeEmpty()}setup(t){this.view=t}render(t){var e;this.visible&&(null==(e=this.children)||e.forEach((function(e){e.isShape&&e.render(t)})))}getIntersectObjects(t,e=Li.RM,i=[]){throw new Error("must be implemented in derived")}getByIds(t,e=[]){return e.length=0,t?(this.traverse((function(i){var n,s;(null==(n=i.userData)?void 0:n.id)&&(Array.isArray(t)&&t.includes(null==(s=i.userData)?void 0:s.id)||i.userData.id===t)&&e.push(i)})),e):e}}const Cs={enabled:!1,files:{},add:function(t,e){this.enabled&&(this.files[t]=e)},get:function(t){if(this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},Is=new class{constructor(t,e,i){c(this,"isLoading",!1),c(this,"itemsLoaded",0),c(this,"itemsTotal",0),c(this,"urlModifier"),c(this,"handlers",[]),c(this,"onStart"),c(this,"onLoad"),c(this,"onProgress"),c(this,"onError"),this.onLoad=t,this.onProgress=e,this.onError=i}itemStart(t){this.itemsTotal++,this.isLoading||void 0!==this.onStart&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(t){this.itemsLoaded++,void 0!==this.onProgress&&this.onProgress(t,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,void 0!==this.onLoad&&this.onLoad())}itemError(t){void 0!==this.onError&&this.onError(t)}resolveURL(t){return void 0!==this.urlModifier?this.urlModifier(t):t}setURLModifier(t){return this.urlModifier=t,this}addHandler(t,e){return this.handlers.push(t,e),this}removeHandler(t){const e=this.handlers.indexOf(t);return-1!==e&&this.handlers.splice(e,2),this}getHandler(t){for(let e=0,i=this.handlers.length;e<i;e+=2){const i=this.handlers[e],n=this.handlers[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}};let Ds=class{constructor(t=Is){c(this,"manager"),c(this,"crossOrigin","anonymous"),c(this,"withCredentials",!1),c(this,"path",""),c(this,"resourcePath",""),c(this,"requestHeader",{}),this.manager=t}loadAsync(t,e){const i=this;return new Promise((function(n,s){i.load(t,n,e,s)}))}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};const Ls={};let Bs=class extends Error{constructor(t,e){super(t),c(this,"response"),this.response=e}},Ps=class extends Ds{constructor(t){super(t),c(this,"mimeType"),c(this,"responseType")}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const s=Cs.get(t);if(void 0!==s)return this.manager.itemStart(t),setTimeout((()=>{e&&e(s),this.manager.itemEnd(t)}),0),s;if(void 0!==Ls[t])return void Ls[t].push({onLoad:e,onProgress:i,onError:n});Ls[t]=[],Ls[t].push({onLoad:e,onProgress:i,onError:n});const r=new Ae.window.Request(t,{headers:new Ae.window.Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(r).then((e=>{if(200===e.status||0===e.status){if(e.status,"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=Ls[t],n=e.body.getReader(),s=e.headers.get("Content-Length")||e.headers.get("X-File-Size"),r=s?parseInt(s):0,a=0!==r;let o=0;const h=new ReadableStream({start(t){!function e(){n.read().then((({done:n,value:s})=>{if(n)t.close();else{o+=s.byteLength;const n=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:r});for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onProgress&&e.onProgress(n)}t.enqueue(s),e()}}))}()}});return new Response(h)}throw new Bs(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(void 0===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),i=e&&e[1]?e[1].toLowerCase():void 0,n=new TextDecoder(i);return t.arrayBuffer().then((t=>n.decode(t)))}}})).then((e=>{Cs.add(t,e);const i=Ls[t];delete Ls[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onLoad&&n.onLoad(e)}})).catch((e=>{const i=Ls[t];if(void 0===i)throw this.manager.itemError(t),e;delete Ls[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setMimeType(t){return this.mimeType=t,this}setResponseType(t){return this.responseType=t,this}};class ks extends Ds{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new Ps(s.manager);r.setPath(s.path),r.setRequestHeader(s.requestHeader),r.setWithCredentials(s.withCredentials),r.load(t,(function(i){try{e&&e(i)}catch(e){n&&n(e),s.manager.itemError(t)}}),i,n)}}class Ns{constructor(){c(this,"svg"),c(this,"offset",new We),c(this,"svgRoot"),c(this,"layers",[]),c(this,"elementsMap",{}),c(this,"boundingBoxMap",{}),c(this,"boundingBox",new ai),c(this,"svgSkeletons",[]),c(this,"_exceptTypes",["view"]),c(this,"_exceptIds",["viewer","mirror"]),c(this,"_lvi",0),c(this,"_lastLinked",[])}bindSvg(t){return this.svg=t,this.svgRoot=Jn(this.svg),this.layers=this.getLayers(2),this.elementsMap={},this.boundingBoxMap={},this.boundingBox.makeEmpty(),this.getElementsMap(this.svg,this.elementsMap),this}getLayers(t){var e;if(!this.svg)throw new Error("please bind svg first");return 2===t&&(null==(e=this.layers)?void 0:e.length)||(this.layers=this._getSvgLayer(this.svg,t)),this.layers}_getSvgLayer(t,e=0,i=0,n=[]){var s;let r,a=t.id;if(this._exceptTypes.includes(t.tagName)||"defs"===t.tagName)return this._lvi--,n;if(e&&this._lvi>e)return n;a&&!this._exceptIds.includes(a)&&(r={value:a,label:a,children:[]},n.push(r)),this._lvi++;for(let i=0,s=t.children.length;i<s;i++)r?this._getSvgLayer(t.children[i],e,this._lvi,r.children):this._getSvgLayer(t.children[i],e,this._lvi,n);return 0===(null==(s=null==r?void 0:r.children)?void 0:s.length)&&delete r.children,this._lvi=i,n}getElementsMap(t,e={}){return this.traverseSvg(t,(i=>{i!==t&&i.id&&(e[i.id]=i)})),e}computeBoundingBoxMap(){var t;if(Object.keys(this.boundingBoxMap).length)return this.boundingBoxMap;let e=null==(t=this.svg)?void 0:t.getBoundingClientRect();return e&&this.offset.set(e.left,e.top),this.traverseSvg(this.svg,(t=>{if(!t.id)return;if("use"===t.tagName){const e=this.getUseSymbolId(t);if(!e)return;const i=this.boundingBoxMap[e];if(i&&!i.isEmpty()){Rs.set(Number(t.getAttribute("x")||"0"),Number(t.getAttribute("y")||"0")),zs.composeSvgTransform(Rs.x,Rs.y,t.getAttribute("transform"));const e=(new ai).copy(i).applyMatrix3(zs);return void(this.boundingBoxMap[t.id]=e)}const n=this.getUseElementBoundingBoxWithSymbol(t);if(!n)return;this.boundingBoxMap[e]=n,Rs.set(Number(t.getAttribute("x")||"0"),Number(t.getAttribute("y")||"0")),zs.composeSvgTransform(Rs.x,Rs.y,t.getAttribute("transform"));const s=(new ai).copy(n).applyMatrix3(zs);return this.boundingBoxMap[t.id]=s,void this.boundingBox.expandByBox(s)}if("function"!=typeof t.getBBox)return;const e=t.getBBox();if(e.width&&e.height||"path"!==t.tagName||(Nn.getBoundingBoxByNode(t,Os),Os.isEmpty()||(Os.getSize(Rs),e.x=Os.min.x,e.y=Os.max.y,e.width=Rs.x,e.height=Rs.y)),!e.width||!e.height)return;const i=new ai(new We(e.x,e.y),new We(e.x+e.width,e.y+e.height));this.boundingBoxMap[t.id]=i.round(),this.boundingBox.expandByBox(i)})),this.boundingBoxMap}getLayerVisible(t){var e;const i=this.getElementById(t);if(i)return"none"!==(null==(e=i.style)?void 0:e.display)}updateLayersVisibility(t,e=!1,i=!0){if(!this.elementsMap)throw new Error("please bind svg first");i&&this._updateAllLayersVisibility(!e),(null==t?void 0:t.length)||(t=["background"]);for(let i=0,n=t.length;i<n;i++){const n=this.getElementById(t[i]);n&&this._updateLayersVisibility(n,e,!0,!0)}}_updateAllLayersVisibility(t=!1){Object.values(this.elementsMap).forEach((e=>{"svg"!==e.tagName&&"symbol"!==e.tagName&&e.getAttribute("id")&&(e.style.display=t?"block":"none")}))}_updateLayersVisibility(t,e=!1,i=!1,n=!1){var s,r;if(t&&"svg"!==t.tagName&&t.getAttribute("id")){if(t.style.display=e?"block":"none",i&&e){let i=t.parentElement;for(;i&&"svg"!==i.tagName;)i.style.display=e?"block":"none",i=i.parentElement}if(n&&(null==(s=t.children)?void 0:s.length)>0)for(let i=0,n=null==(r=t.children)?void 0:r.length;i<n;i++)this._updateLayersVisibility(t.children[i],e,!1,!0)}}updateVisibilityByAssetType(t,e=!1,i){i||(i=Wi[t]),this.updateLayersVisibility(i,!e)}updateVisibilityByAssetTypes(t,e=!1,i){if(Array.isArray(t)||(t=[t]),null==t?void 0:t.length)for(let n=0,s=t.length;n<s;n++)this.updateVisibilityByAssetType(t[n],e,i)}getElementById(t){if(!this.elementsMap)throw new Error("please bind svg first");return this.elementsMap[t]}getElementBoundingBox(t){return this.boundingBoxMap[t]}findSkeletonByPath(t=[]){let e,i=0;const n=Object.keys(this.elementsMap);for(let t=0,s=n.length;t<s;t++){const s=this.elementsMap[n[t]];if(!s)continue;const r=s.getAttribute("d");r&&(r.length<i||(i=r.length,e=s.id?s:s.parent))}return e?(t.push(e),t):t}setTextInChildren2(t,e){var i;let n;(null==(i=null==t?void 0:t.children)?void 0:i.length)<2?(n=Ai("text"),n.setAttribute("dy","1em"),t.appendChild(n)):n=t.children[t.children.length-1],n.innerHTML=e}traverseSvg(t,e){var i;if(!this._exceptTypes.includes(t.tagName)&&("svg"===t.tagName||"defs"===t.tagName||t.id)&&("g"!==t.tagName||0!==(null==(i=t.children)?void 0:i.length))){this._exceptIds.includes(t.id)||e(t);for(let i=0,n=t.children.length;i<n;i++)this.traverseSvg(t.children[i],e)}}traverseSvgTLayers(t,e){var i;if(Array.isArray(t))for(let i=0,n=t.length;i<n;i++)this.traverseSvgTLayers(t[i],e);else if(e(t),null==(i=t.children)?void 0:i.length)for(let i=0,n=t.children.length;i<n;i++)this.traverseSvgTLayers(t.children[i],e)}getLabelElementsByType(t,e={}){const i=this.getElementById(Hi(t));return i?(this.getElementsMap(i,e),e):e}getLabelElementById(t,e="rm"){if(!t)return;const i=this.getElementById(t);if(!i)return;let n=i.getAttribute("aid");return n||(n="l-"+e+"-"+t),this.getElementById(n)}setLabelsById(t,e,i="rm"){var n,s;const r=this.getLabelElementById(t,i);if(!r)return;const a=(null==(n=r.children)?void 0:n.length)||0;for(let t=0,i=((null==e?void 0:e.length)||0)-(a-1);t<i;t++){const e=Ai("text");e.setAttribute("x","0"),e.setAttribute("y",a+t+"em"),r.appendChild(e)}for(let t=1,i=null==(s=r.children)?void 0:s.length;t<i;t++)r.children[t].textContent=e&&t<=e.length?e[t-1]:""}clearAssetLabelsByType(t="rm"){var e;const i=this.getLabelElementsByType(t),n=ri.keys(i);for(let t=0,s=n.length;t<s;t++){const s=i[n[t]];for(let t=1,i=(null==(e=s.children)?void 0:e.length)||0;t<i;t++)s.children[t].textContent=""}}getUseSymbolId(t){var e;if(t&&"use"===t.tagName)return null==(e=t.getAttribute("xlink:href"))?void 0:e.substring(1)}getUseSymbol(t){if(!t||"use"!==t.tagName)return;const e=this.getUseSymbolId(t);return e?this.getElementById(e):void 0}setElementState2selected(t,e=!1){var i;if(!t)return;if("use"===t.tagName){const n=this._getSymbolBox(t);if(!n)return;return void(e?null==(i=t.parentNode)||i.insertBefore(n,t):t.parentNode&&t.parentNode.contains(n)&&t.parentNode.removeChild(n))}let n=t.getAttribute("class");n||(n=""),n=e?"danger":ri.replace(n,"danger","").trim(),t.setAttribute("class",n)}_getSymbolBox(t){if(!t)return;const e=t.id+"-boundingBox";let i=this.getElementById(e);if(i)return i;const n=this.getUseSymbol(t);if(!n)return;let s=this.getElementBoundingBox(t.id);if(!s||s.isEmpty())return;i=document.createElementNS("http://www.w3.org/2000/svg","rect"),i.setAttribute("id",e),i.setAttribute("class","danger"),i.setAttribute("x",s.min.x.toString()),i.setAttribute("y",s.min.y.toString());const r=new We;return s.getSize(r),i.setAttribute("width",r.x.toString()),i.setAttribute("height",r.y.toString()),n.getAttribute("transform")&&i.setAttribute("transform",n.getAttribute("transform")||""),n.getAttribute("style")&&i.setAttribute("style",n.getAttribute("style")||""),this.elementsMap[e]=i,i}getUseElementBoundingBoxWithSymbol(t){var e;if(!t)return;const i=null==(e=t.getAttribute("xlink:href"))?void 0:e.substring(1);if(!i)return;let n=this.getElementById(i);if(!n)return;const s=document.createElementNS("http://www.w3.org/2000/svg","svg");let r;if(s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px","symbol"===ri.lowerCase(n.tagName)){r=document.createElementNS("http://www.w3.org/2000/svg","g");for(let t=0,e=n.childNodes.length;t<e;t++){const e=n.childNodes[t].cloneNode(!0);r.appendChild(e)}}else r=n.cloneNode(!0);s.appendChild(r),r.setAttribute("style","stroke: #333333;"),document.body.appendChild(s);const a=s.getBBox();if(document.body.removeChild(s),!a)return;const o=new ai;return o.set(new We(a.x,a.y),new We(a.x+a.width,a.y+a.height)),o}fontZoom(t,e=1){const i=this.getElementById(t);if(!i)return;let n=i.getAttribute("font-size");n||(n="12");const s=/(\d+)([a-zA-Z%]+)/.exec(n),r=s&&(null==s?void 0:s.length)>2?s[2]:"";let a=Math.round(parseFloat(n)*e*100)/100;i.setAttribute("font-size",a+r)}strokeWidthChanged(t=1){var e,i;const n=null==(e=this.svg)?void 0:e.querySelector("#mirror");if(!n)return;let s=null!=(i=hn(n,"stroke-width"))?i:"1em";const r=String(s).match(/^([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(%|[a-z]*)$/i);if(!r)return;const a=parseFloat(r[1]),o=r[2]||"em",h=a*t,l=Number.isInteger(h)?h.toFixed(0):h.toString().replace(/\.?0+$/,"");n.setAttribute("stroke-width",`${l}${o}`),"em"===o&&(this.fontZoom("background-labels",1),this.fontZoom("asset-labels",1),n.style.fontSize=`${l}${o}`)}getCentroid(t,e=new We){const i=t.getAttribute("insX"),n=t.getAttribute("insY");return i||n?e.set(Number(i||"0"),Number(n||"0")):this.getCentroidByDom(t,e)}getCentroidByDom(t,e=new We){const i=Number(t.getAttribute("x")||"0"),n=Number(t.getAttribute("y")||"0"),s=t.getBBox();let r=1,a=1,o=t.getAttribute("transform");if(!o)return e.set(i,n);const h=/scale\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(o);if(void 0===h||null==h){const i=t.transform.baseVal;if(!(o&&i.numberOfItems>0))return e.set((s.x+s.width/2)*r,(s.y+s.height/2)*a);{let t=i.getItem(0);t&&t.type===SVGTransform.SVG_TRANSFORM_SCALE&&(r=0!==t.matrix.a?t.matrix.a:1,a=0!==t.matrix.d?t.matrix.d:r)}}else r=h[1]&&Number(h[1])>0?Number(h[1]):1,a=h[2]&&Number(h[2])>0?Number(h[2]):r;return i&&n?e.set(i*r,n*a):e.set((s.x+s.width/2)*r,(s.y+s.height/2)*a),e}linkAssetsByTree(t,e){if(t||(t=Li.RM),this.clearLinkedLines(t),!e||!e.value)return;const i=this.getLinesByTree(e);this.drawLinkedLines(t,i)}clearLinkedLines(t){var e;const i=zi(t);if(this.getElementById(i)){for(let t=(null==(e=this._lastLinked)?void 0:e.length)-1;t>=0;t--){const e=this._lastLinked[t];e.parentNode&&e.parentNode.removeChild(e),this._lastLinked.splice(t,1)}this._lastLinked.length=0}}drawLinkedLines(t,e){var i;if(!(null==e?void 0:e.length))return;const n=zi(t),s=this.getElementById(n);if(s)for(let t=0,n=e.length;t<n;t++){const n=e[t][0],r=e[t][(null==(i=e[t])?void 0:i.length)-1],a=Ai("line");a.setAttribute("x1",n.x.toString()),a.setAttribute("y1",n.y.toString()),a.setAttribute("x2",r.x.toString()),a.setAttribute("y2",r.y.toString()),a.setAttribute("class","danger"),a.setAttribute("style","stroke-width: 2;"),s.appendChild(a),this._lastLinked.push(a)}}getLinesByTree(t,e=[]){var i;if(!(null==t?void 0:t.value))return e;const n=this.getElementBoundingBox(t.value);if(!n)return e;const s=n.getCenter();return null==(i=t.children)||i.forEach((t=>{var i;const n=this.getElementBoundingBox(null==t?void 0:t.value);if(!n)return;const r=n.getCenter();e.push([s,r]),(null==(i=t.children)?void 0:i.length)&&this.getLinesByTree(t,e)})),e}}const Os=new ai,Rs=new We,zs=new Ui;class Hs{constructor(t={},e){c(this,"name","SvgPainter"),c(this,"params"),c(this,"chef"),this.params=t,this.chef=e}drawSocialDistanceCircles(t,e="http://www.w3.org/2000/svg"){var i,n,s;if(!t)return;const r=function(t){if(!t)return 1;let e=1;switch(Xn(t)){case"mm":e=500/39.3701;break;case"cm":e=50/39.3701;break;case"Metres":case"m":e=.5/39.3701;break;default:e=1}return e}(t),a=Xn(t),o=2*r,h=(null==(n=null==(i=this.params.socialDistance)?void 0:i.colors)?void 0:n.length)?null==(s=this.params.socialDistance)?void 0:s.colors:[Le.green,Le.red],l=this.getRadius(a),u=t.querySelector(`#${Ni}`),c=null==u?void 0:u.querySelectorAll("path");if(!u||!(null==c?void 0:c.length))return;let d,p;const f=new Array;for(let t=0,e=(null==c?void 0:c.length)||0;t<e;t++){if(d=c[t],p=d.getAttribute("id"),!p)continue;const e=this.chef.getElementBoundingBox(p);if(!e)continue;const i=new We;e.getCenter(i),f.push({id:p,cp:i})}for(let t=0,e=f.length;t<e;t++){f[t].color=h[0];for(let i=0,n=e;i<n;i++)f[t]!==f[i]&&We.getDistance(f[t].cp,f[i].cp)<2*l&&(f[t].color=h[1])}for(let t=0,i=f.length;t<i;t++){let i=this.createCircle(f[t],l,o,e);u.appendChild(i)}}clearSocialDistanceCircles(t){if(!t)return;const e=t.querySelector(`#${Ni}`),i=null==e?void 0:e.querySelectorAll("circle");if(e&&(null==i?void 0:i.length))for(let t=0,n=(null==i?void 0:i.length)||0;t<n;t++){const n=i[t].getAttribute("id");n&&((null==n?void 0:n.indexOf("_circle"))>-1&&e.removeChild(i[t]))}}getRadius(t){var e,i,n;let s=(null==(i=null==(e=this.params)?void 0:e.socialDistance)?void 0:i.radius)||3;return"imperial"===(null==(n=this.params)?void 0:n.displayUnits)?"Metres"===t||"m"===t?s/=3.28084:"cm"===t?s=s/3.28084*100:"mm"===t?s=s/3.28084*1e3:"INCH"!==t&&"inches"!==t||(s*=12):"INCH"===t||"inches"===t?s=3.28084*s*12:"cm"===t?s*=100:"mm"===t&&(s*=1e3),s}createCircle(t,e,i,n){const s=document.createElementNS(n,"circle");return s.setAttributeNS(null,"id",t.id+"_circle"),s.setAttributeNS(null,"cx",t.cp.x),s.setAttributeNS(null,"cy",t.cp.y),s.setAttributeNS(null,"r",String(e)),s.setAttributeNS(null,"style",`pointer-events:none;fill-opacity:0.1;stroke:${t.color};stroke-width:${i}px;`),s}}function Ws(t,e){if(!t||!e)return!1;if(-1!==e.indexOf(" "))throw new Error("className should not contain space.");return t.classList?t.classList.contains(e):(" "+t.className+" ").indexOf(" "+e+" ")>-1}function Fs(t,e){if(!t)return;let i=t.className;const n=(e||"").split(" ");for(let e=0,s=n.length;e<s;e++){const s=n[e];s&&(t.classList?t.classList.add(s):Ws(t,s)||(i+=" "+s))}t.classList||(t.className=i)}function Us(t,e){if(!t||!e)return;const i=e.split(" ");let n=" "+t.className+" ";for(let e=0,s=i.length;e<s;e++){const s=i[e];s&&(t.classList?t.classList.remove(s):Ws(t,s)&&(n=n.replace(" "+s+" "," ")))}t.classList||(t.className=(n||"").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,""))}class Vs extends Ts{constructor(t={}){super(),c(this,"isSvgScene",!0),c(this,"name","SvgScene"),c(this,"dynamically",!0),c(this,"params"),c(this,"socialDistanceEnable",!1),c(this,"container"),c(this,"svg"),c(this,"svgStr",""),c(this,"svgRoot"),c(this,"viewBox",new ai),c(this,"viewUnits"),c(this,"chef"),c(this,"defaultLayers",[]),c(this,"skeletonLayers",[]),c(this,"currentLayers",[]),c(this,"assetType"),c(this,"assetsMap",{}),c(this,"legend",[]),c(this,"selectedList",[]),c(this,"painter"),c(this,"_lastHighlightType",""),c(this,"_lastHighlightIds",[]),c(this,"clickSvgElementHandler",this.handleClickSvgElement.bind(this)),c(this,"_lastLinkedIds",[]),this.params=t,this.assetType=t.assetType||Li.RM,this.params.socialDistanceEnable&&(this.socialDistanceEnable=!0),this.container=this.params.containerId?document.getElementById(this.params.containerId):Ae.window.document.getElementsByTagName("body")[0],this.chef=new Ns,this.painter=new Hs(t,this.chef)}get isMounted(){var t;return(null==(t=this.container.querySelectorAll("svg"))?void 0:t.length)>0}destroy(){var t;super.destroy(),this.unmount(),null==(t=this.camera)||t.destroy()}mount(){this.svg&&(this.container.contains(this.svg)||this.container.appendChild(this.svg),this.chef.computeBoundingBoxMap())}unmount(){this.svg&&this.svg.parentNode&&this.container.contains(this.svg)&&this.container.removeChild(this.svg)}computeBoundingBox(){return this.boundingBox.makeEmpty(),this.chef&&this.svg?(this.chef.computeBoundingBoxMap(),this.boundingBox.copy(this.chef.boundingBox),this.boundingBox):this.boundingBox}load(t){return d(this,null,(function*(){return(new ks).loadAsync(t)}))}bind(t){this.svgStr=t;const e=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;return this.bindSvg(e),!0}bindSvg(t){var e;if(this.svg=t,!this.svg)throw new Error("svg load failed");let i=this.svg.getAttribute("viewBox");i&&(Zn(i,this.viewBox),this.chef.bindSvg(this.svg),this.svgRoot=Jn(this.svg),this.svg.setAttribute("viewBox",`0 0 ${this.params.width} ${this.params.height}`),this.svg.setAttribute("style","transform: translateZ(0);"),this.viewUnits=ri.lowerCase(hn(null==(e=this.svg)?void 0:e.querySelector("view"),"units")||Ei.M),this.appendStyles(),this.setAssetsMap(this.assetType,this.assetsMap))}recompute(t){t&&(this.bindSvg(t),this.computeBoundingBox(),this.viewBox.copy(this.boundingBox))}appendStyles(){var t;let e=null==(t=this.svg)?void 0:t.querySelector("style");e&&(e.appendChild(document.createTextNode(".centered-texts { text-anchor:middle; dominant-baseline:middle; }")),e.appendChild(document.createTextNode(`.default { stroke: ${this.params.defaultStroke}; fill: ${this.params.defaultFill}; }`)),e.appendChild(document.createTextNode(`.info { stroke: ${this.params.infoStroke}; fill: ${this.params.infoFill}; }`)),e.appendChild(document.createTextNode(`.primary { stroke: ${this.params.primaryStroke}; fill: ${this.params.primaryFill}; }`)),e.appendChild(document.createTextNode(`.success { stroke: ${this.params.successStroke}; fill: ${this.params.successFill}; }`)),e.appendChild(document.createTextNode(`.warning { stroke: ${this.params.warningStroke}; fill: ${this.params.warningFill}; }`)),e.appendChild(document.createTextNode(`.danger { stroke: ${this.params.dangerStroke}; fill: ${this.params.dangerFill}; }`)),e.appendChild(document.createTextNode(`.active { stroke: ${this.params.activeStroke}; fill: ${this.params.activeFill}; }`)),e.appendChild(document.createTextNode(`text { font-family: ${this.params.fontFamily||"simhei"}; }`)),nn(this.svg,(t=>{"asset-labels"===hn(t,"id")&&Fs(t,"centered-texts")})),e.appendChild(document.createTextNode("@keyframes fillAnimate {\n 100% { fill-opacity: 0.3; }\n 30% { fill-opacity: 1; }\n 0% { fill-opacity: 0.3; }\n }")),e.appendChild(document.createTextNode("@keyframes dashedAnimate {\n 100% { stroke-dashoffset: -850; }\n 0% { stroke-dashoffset: -0; }\n }")),e.appendChild(document.createTextNode(".cursor { cursor: pointer; }")),e.appendChild(document.createTextNode(".hover { fill: rgba(185, 28, 28, 0.5); animation: fillAnimate 1s infinite; cursor: pointer; }")))}getLayers(t=2){return this.svg?this.chef.getLayers(t):[]}setDefaultLayers(t){(null==t?void 0:t.length)&&(this.defaultLayers=t)}setSkeletonLayers(t){(null==t?void 0:t.length)&&(this.skeletonLayers=t)}setCurrentLayers(t){(null==t?void 0:t.length)&&(this.currentLayers=t)}showDefaultLayers(t,e=!1){this.setDefaultLayers(t),this.chef.updateLayersVisibility(t,e)}getLayerVisible(t){return this.chef.getLayerVisible(t)}updateLayersVisibility(t,e=!1,i=!0){this.chef.updateLayersVisibility(t,e,i)}setAssetType(t,e){this.assetsMap={},this.assetType=t,this.setAssetsMap(this.assetType,this.assetsMap),e||(e=[zi(t)],t!==Li.RM&&e.unshift(zi(Li.RM))),this.setDefaultLayers(e),this.updateLayersVisibility(this.defaultLayers,!0)}isBelongsToAssetType(t,e){e||(e=this.assetType);const i=this.getAssetsByType(e);return!!i&&!!(null==i?void 0:i.hasOwnProperty(t))}setAssetsMap(t,e={}){const i=this.chef.getElementById(zi(t));if(!i)return e;e[t]=this.chef.getElementsMap(i);const n=Hi(t),s=this.chef.getElementById(n);if(!s)return e;const r=this.chef.getElementsMap(s),a=ri.keys(r);if(!(null==a?void 0:a.length))return e;if(ri.startsWith(a[0],`l-${t}-`)){const e=`l-${t}-`.length;for(let t=0,i=a.length;t<i;t++){r[a[t].slice(e)]=r[a[t]],delete r[a[t]]}}return e[n]=r,e}getAssetsByType(t){return this.assetsMap.hasOwnProperty(t)||this.setAssetsMap(t,this.assetsMap),this.assetsMap[t]}getElementById(t){if(!t)return;const e=this.getAssetsByType(this.assetType);return e&&Object.hasOwnProperty.call(e,t)?e[t]:void 0}getAssetIdsByType(t){const e=this.getAssetsByType(t);return e?ri.keys(e):[]}clearFillOrStroke(t="fill"){const e=this.getAssetsByType(this.assetType);if(!e)return;const i=ri.keys(e);let n;for(let s=0,r=i.length;s<r;s++)n=e[i[s]],n&&(n.hasAttribute(t)&&n.removeAttribute(t),"stroke"===t&&n.removeAttribute("stroke-width"));this.clearLegendBy(t)}clearFillOrStrokeByIds(t,e="fill"){const i=this.getAssetsByType(this.assetType);if(!i)return;const n=ri.keys(i);let s;for(let r=0,a=n.length;r<a;r++)(null==t?void 0:t.length)&&!t.includes(n[r])||(s=i[n[r]],s&&s.hasAttribute(e)&&(s.removeAttribute(e),"stroke"===e&&s.removeAttribute("stroke-width")));this.clearLegendBy(e)}setFillOrStrokeByIds(t,e,i="fill",n="7em"){const s=this.getAssetsByType(this.assetType);if(!s)return;const r=ri.keys(s);let a;for(let o=0,h=r.length;o<h;o++)t.includes(r[o])&&(a=s[r[o]],a&&(a.setAttribute(i,e),"stroke"===i&&a.setAttribute("stroke-width",n),this.addLegend(i,e,r[o])))}addLegend(t,e,i){let n=this.legend.find((t=>t.color===e));n||(n={type:t,color:e,ids:[]},this.legend.push(n)),n.ids.push(i)}clearLegendBy(t){var e;t||(this.legend.length=0);for(let i=(null==(e=this.legend)?void 0:e.length)-1;i>=0;i--)this.legend[i].type===t&&this.legend.splice(i,i)}getLegend(){return this.legend}showSkeleton(){var t;(null==(t=this.skeletonLayers)?void 0:t.length)&&(this.chef.updateLayersVisibility(this.defaultLayers,!1),this.chef.updateLayersVisibility(this.skeletonLayers,!0))}hideSkeleton(){var t;(null==(t=this.skeletonLayers)?void 0:t.length)&&(this.chef.updateLayersVisibility(this.skeletonLayers,!1),this.chef.updateLayersVisibility(this.defaultLayers,!0))}setAssetLabels(t,e){this.chef.setLabelsById(t,e,this.assetType)}getAssetLabelsMap(t){var e,i;if(!t)return;const n=Hi(t);let s=this.getAssetsByType(n);if(!s||!(null==(e=Object.keys(s))?void 0:e.length)){let e=this.chef.getElementById(n);if(e||(e=this.chef.getElementById(t+"-txt-label")),!e)return;s=this.chef.getElementsMap(e),this.assetsMap[n]=s}return s&&(null==(i=Object.keys(s))?void 0:i.length)?s:void 0}getAssetLabelById(t,e){var i,n;const s=this.getAssetLabelsMap(t);if(!s)return;let r=s[e];if(r&&(null==(i=null==r?void 0:r.childNodes)?void 0:i.length))return r.childNodes[0].textContent||"";return r=s["l-"+t+"-"+e],r&&(null==(n=null==r?void 0:r.children)?void 0:n.length)?r.children[0].textContent||"":void 0}clearAssetLabels(){this.chef.clearAssetLabelsByType(this.assetType)}bindAssetsEvents(t){var e;const i=null==(e=this.svg)?void 0:e.querySelector("#"+t);if(!i)return;i.querySelectorAll("[id]").forEach((t=>{t instanceof SVGElement&&t.addEventListener("click",this.clickSvgElementHandler)}))}handleClickSvgElement(t){"function"==typeof t.preventDefault&&t.preventDefault(),this.dispatchEvent({type:"click",data:t})}socialDistanceEnableChanged(t){this.socialDistanceEnable=!!t,t?this.painter.drawSocialDistanceCircles(this.svg):this.painter.clearSocialDistanceCircles(this.svg)}highlightAssets(t,e){var i;this.resetHighlightAssets(t);const n=this.getAssetsByType(t);n&&(null==(i=Object.keys(n))?void 0:i.length)&&(this._lastHighlightType=t,this._lastHighlightIds=Array.isArray(e)?e:[e],this._lastHighlightIds.forEach((t=>{t&&n[t]&&Fs(n[t],"active")})))}resetHighlightAssets(t){var e;const i=this.getAssetsByType(t||this._lastHighlightType);i&&(null==(e=Object.keys(i))?void 0:e.length)&&(this._lastHighlightIds.forEach((t=>{t&&i[t]&&Us(i[t],"active")})),this._lastHighlightIds.length=0)}getIntersectObjects(t,e=Li.RM,i=[]){i.length=0;const n=[],s=this.getAssetsByType(e);if(!s)return i;const r=ri.keys(s);for(let e=0,i=r.length;e<i;e++){const i=this.chef.getElementBoundingBox(s[r[e]].id);i&&(i.containsPoint(t.worldCoords)&&n.push(s[r[e]]))}const a=ri.sortBy(n,(t=>{var e;return null==(e=this.chef.getElementBoundingBox(t.id))?void 0:e.getArea()}));return i.push(...a),i}clearSelected(){var t,e;if(null==(t=this.selectedList)?void 0:t.length)for(let t=(null==(e=this.selectedList)?void 0:e.length)-1;t>=0;t--){let e=this.selectedList[t];this.selectedList.splice(t,1),this.chef.setElementState2selected(e,!1)}}clearSelectedById(t){var e,i;let n=null==(e=this.selectedList)?void 0:e.findIndex((e=>e.getAttribute("id")===t));n>-1&&(this.chef.setElementState2selected(this.selectedList[n],!1),null==(i=this.selectedList)||i.splice(n||0,1))}selectByIds(t,e=!1){Array.isArray(t)||(t=[t]),e||this.clearSelected();const i=ri.uniq(ri.map(this.selectedList,(t=>t.getAttribute("id")||""))),n=this.getAssetsByType(this.assetType);if(n){for(let e=t.length-1;e>=0;e--)i.includes(t[e])?(this.clearSelectedById(t[e]),t.splice(e,1)):Object.hasOwnProperty.call(n,t[e])&&this.selectedList.push(n[t[e]]);this.selectedList.forEach((t=>{this.chef.setElementState2selected(t,!0)}))}}getSelectedIds(){var t;if(!(null==(t=this.selectedList)?void 0:t.length))return;const e=[];for(let t=0,i=this.selectedList.length;t<i;t++)this.selectedList[t].id&&e.push(this.selectedList[t].id);return e}getSelectedBoundingBox(){var t;const e=new ai;return(null==(t=this.selectedList)?void 0:t.length)?(this.selectedList.forEach((t=>{const i=this.chef.boundingBoxMap[t.id];i&&e.expandByBox(i)})),e):e.copy(this.boundingBox)}getElementsByBox(t){const e=[],i=Object.keys(this.chef.boundingBoxMap),n=this.getAssetsByType(this.assetType);if(!n)return e;for(let s=0,r=i.length;s<r;s++)if(n.hasOwnProperty(i[s])&&!(i[s].indexOf("-assets")>-1)&&t.intersectsBox(this.chef.boundingBoxMap[i[s]])){const t=n[i[s]];t&&e.push(t)}return e}getBoundingBoxByIds(t){var e,i;if(!t||Array.isArray(t)&&!t.length)return;Array.isArray(t)||(t=[t]);const n=new ai;for(let s=0,r=null==t?void 0:t.length;s<r;s++)(null==(i=null==(e=this.chef)?void 0:e.boundingBoxMap)?void 0:i.hasOwnProperty(t[s]))&&n.expandByBox(this.chef.boundingBoxMap[t[s]]);return n}getBoundingBoxById(t){if(this.chef.boundingBoxMap.hasOwnProperty(t))return(new ai).copy(this.chef.boundingBoxMap[t])}linkAssetsByTree(t){this.chef.linkAssetsByTree(this.assetType,t);const e=this.chef.getElementById(Pi.ASSET_LABELS);e&&(e.style.display="block");const i=Hi(this.assetType),n=this.chef.getElementById(i);n&&(n.style.display="block");const s=this.assetsMap[i];s&&(this._lastLinkedIds.forEach((t=>{s[t]&&(s[t].style.display="none")})),this._lastLinkedIds=Ii(t),this._lastLinkedIds.forEach((t=>{s[t]&&(s[t].style.display="block")})))}onBeforeRender(){}fullscreen(t=1e3,e=!1){}update(){}}class qs extends Vs{constructor(t){super(t),c(this,"name","SvgLoadingScene"),this.bind('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-200 -200 500 500">\n <view id="defaultView" viewBox="-200 -200 500 500" />\n <style>\n /*#svg-loading-fast circle {animation: svg-loading-fast 2s ease infinite;}*/\n /*@keyframes svg-loading-fast {*/\n /* 0% {stroke-dasharray: 250; stroke-dashoffset: 250;}*/\n /* 50% {stroke-dasharray: 0; stroke-dashoffset: 0; opacity: 0.5;}*/\n /*}*/\n #svg-loading-fast .line {animation: svg-loading-fast 3s ease infinite;}\n @keyframes svg-loading-fast {\n 0% {stroke-dasharray: 250; stroke-dashoffset: 250; opacity: 1;}\n 50% {stroke-dasharray: 250; stroke-dashoffset: 0; opacity: 0.5;}\n }\n #svg-loading-fast path {animation: pathFrames 6s ease infinite;}\n @keyframes pathFrames {\n 0% {opacity: 1;}\n 50% {opacity: 0.5;}\n }\n #svg-loading-fast .triangle {animation: triangleFrames 1s ease infinite;}\n @keyframes triangleFrames {\n 0% {opacity: 1;}\n 50% {opacity: 0.3;}\n }\n #svg-loading-fast {fill: #525252}\n .line {stroke: #525252; stroke-width: 4px}\n .triangle {fill: #F26666}\n </style>\n <g id="svg-loading-fast">\n\x3c!-- <text x="50" y="55" style="text-anchor: middle; fill: #5CC9F5; font-size: 15px;">loading</text>--\x3e\n\x3c!-- <circle cx="103" cy="25" r="103" style="fill: none; stroke: #5CC9F5; stroke-width: 1px;" />--\x3e\n <path d="M14 35.7L14 15L21.27 15L21.27 33L34.59 33L33.08 35.7L14 35.7Z" />\n <path d="M44.78 17.77L44.78 32.93L55.4 32.93L55.4 15L62.71 15L62.71 35.7L37.47 35.7L37.47 15L55.4 15L52.88 17.77L44.78 17.77Z" />\n <path d="M76.39 27.92L85.03 27.92L82.9 30.77L75.2 30.77L73.29 35.7L65.59 35.7L73.94 15L87.19 15L95.58 35.7L87.94 35.7L85.03 27.92L81.14 17.77L79.99 17.77L76.39 27.92Z" />\n <path d="M123.73 32.78L120.88 35.7L98.46 35.7L98.46 15L116.53 15L113.97 17.84L105.66 17.84L105.66 32.93L116.53 32.93L116.53 15L121.14 15L123.73 17.7L123.73 32.78Z" />\n <path d="M133.63 35.7L126.61 35.7L126.61 15L133.63 15L133.63 35.7Z" />\n <path d="M153.75 35.7L143.78 21.3L143.78 35.7L136.51 35.7L136.51 15L144.64 15L154.58 29.65L154.58 15L161.78 15L161.78 35.7L153.75 35.7Z" />\n <path d="M182.73 33L182.73 25.73L177.37 25.73L177.37 22.99L189.93 22.99L189.93 35.7L182.73 35.7L182.73 33.5L180.57 35.7L164.66 35.7L164.66 15L190.04 15L188.46 17.7L172.04 17.7L172.04 33L182.73 33Z" />\n\x3c!-- <rect class="line" width="207" height="5" x="0" y="43" />--\x3e\n\x3c!-- <path class="line" d="M0 43L207 43" />--\x3e\n <path class="line" d="M103.5 46L0 46" />\n <path class="line" d="M103.5 46L207 46" />\n <path class="triangle" d="M103.5 56L133.5 90L73.5 90Z" />\n </g>\n </svg>')}}var js,Ys={exports:{}};
|
|
10
10
|
/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
11
11
|
* http://hammerjs.github.io/
|
|
12
12
|
*
|
|
13
13
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
14
|
-
* Licensed under the MIT license */Ys=Gs,function(t,e,i,n){var s,r=["","webkit","Moz","MS","ms","o"],a=e.createElement("div"),o=Math.round,h=Math.abs,l=Date.now;function u(t,e,i){return setTimeout(y(t,i),e)}function c(t,e,i){return!!Array.isArray(t)&&(d(t,i[e],i),!0)}function d(t,e,i){var s;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==n)for(s=0;s<t.length;)e.call(i,t[s],s,t),s++;else for(s in t)t.hasOwnProperty(s)&&e.call(i,t[s],s,t)}function p(e,i,n){var s="DEPRECATED METHOD: "+i+"\n"+n+" AT \n";return function(){var i=new Error("get-stack-trace"),n=i&&i.stack?i.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=t.console&&(t.console.warn||t.console.log);return r&&r.call(t.console,s,n),e.apply(this,arguments)}}s="function"!=typeof Object.assign?function(t){if(t===n||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var s=arguments[i];if(s!==n&&null!==s)for(var r in s)s.hasOwnProperty(r)&&(e[r]=s[r])}return e}:Object.assign;var f=p((function(t,e,i){for(var s=Object.keys(e),r=0;r<s.length;)(!i||i&&t[s[r]]===n)&&(t[s[r]]=e[s[r]]),r++;return t}),"extend","Use `assign`."),m=p((function(t,e){return f(t,e,!0)}),"merge","Use `assign`.");function g(t,e,i){var n,r=e.prototype;(n=t.prototype=Object.create(r)).constructor=t,n._super=r,i&&s(n,i)}function y(t,e){return function(){return t.apply(e,arguments)}}function v(t,e){return"function"==typeof t?t.apply(e&&e[0]||n,e):t}function x(t,e){return t===n?e:t}function b(t,e,i){d(E(e),(function(e){t.addEventListener(e,i,!1)}))}function w(t,e,i){d(E(e),(function(e){t.removeEventListener(e,i,!1)}))}function _(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function S(t,e){return t.indexOf(e)>-1}function E(t){return t.trim().split(/\s+/g)}function M(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var n=0;n<t.length;){if(i&&t[n][i]==e||!i&&t[n]===e)return n;n++}return-1}function A(t){return Array.prototype.slice.call(t,0)}function T(t,e,i){for(var n=[],s=[],r=0;r<t.length;){var a=t[r][e];M(s,a)<0&&n.push(t[r]),s[r]=a,r++}return n=n.sort((function(t,i){return t[e]>i[e]}))}function C(t,e){for(var i,s,a=e[0].toUpperCase()+e.slice(1),o=0;o<r.length;){if((s=(i=r[o])?i+a:e)in t)return s;o++}return n}var I=1;function D(e){var i=e.ownerDocument||e;return i.defaultView||i.parentWindow||t}var L="ontouchstart"in t,B=C(t,"PointerEvent")!==n,P=L&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),k="touch",N="mouse",O=24,R=["x","y"],z=["clientX","clientY"];function H(t,e){var i=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){v(t.options.enable,[t])&&i.handler(e)},this.init()}function W(t,e,i){var s=i.pointers.length,r=i.changedPointers.length,a=1&e&&s-r==0,o=12&e&&s-r==0;i.isFirst=!!a,i.isFinal=!!o,a&&(t.session={}),i.eventType=e,function(t,e){var i=t.session,s=e.pointers,r=s.length;i.firstInput||(i.firstInput=F(e)),r>1&&!i.firstMultiple?i.firstMultiple=F(e):1===r&&(i.firstMultiple=!1);var a=i.firstInput,o=i.firstMultiple,u=o?o.center:a.center,c=e.center=U(s);e.timeStamp=l(),e.deltaTime=e.timeStamp-a.timeStamp,e.angle=Y(u,c),e.distance=j(u,c),function(t,e){var i=e.center,n=t.offsetDelta||{},s=t.prevDelta||{},r=t.prevInput||{};1!==e.eventType&&4!==r.eventType||(s=t.prevDelta={x:r.deltaX||0,y:r.deltaY||0},n=t.offsetDelta={x:i.x,y:i.y}),e.deltaX=s.x+(i.x-n.x),e.deltaY=s.y+(i.y-n.y)}(i,e),e.offsetDirection=q(e.deltaX,e.deltaY);var d,p,f=V(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=f.x,e.overallVelocityY=f.y,e.overallVelocity=h(f.x)>h(f.y)?f.x:f.y,e.scale=o?(d=o.pointers,j((p=s)[0],p[1],z)/j(d[0],d[1],z)):1,e.rotation=o?function(t,e){return Y(e[1],e[0],z)+Y(t[1],t[0],z)}(o.pointers,s):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,function(t,e){var i,s,r,a,o=t.lastInterval||e,l=e.timeStamp-o.timeStamp;if(8!=e.eventType&&(l>25||o.velocity===n)){var u=e.deltaX-o.deltaX,c=e.deltaY-o.deltaY,d=V(l,u,c);s=d.x,r=d.y,i=h(d.x)>h(d.y)?d.x:d.y,a=q(u,c),t.lastInterval=e}else i=o.velocity,s=o.velocityX,r=o.velocityY,a=o.direction;e.velocity=i,e.velocityX=s,e.velocityY=r,e.direction=a}(i,e);var m=t.element;_(e.srcEvent.target,m)&&(m=e.srcEvent.target),e.target=m}(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function F(t){for(var e=[],i=0;i<t.pointers.length;)e[i]={clientX:o(t.pointers[i].clientX),clientY:o(t.pointers[i].clientY)},i++;return{timeStamp:l(),pointers:e,center:U(e),deltaX:t.deltaX,deltaY:t.deltaY}}function U(t){var e=t.length;if(1===e)return{x:o(t[0].clientX),y:o(t[0].clientY)};for(var i=0,n=0,s=0;s<e;)i+=t[s].clientX,n+=t[s].clientY,s++;return{x:o(i/e),y:o(n/e)}}function V(t,e,i){return{x:e/t||0,y:i/t||0}}function q(t,e){return t===e?1:h(t)>=h(e)?t<0?2:4:e<0?8:16}function j(t,e,i){i||(i=R);var n=e[i[0]]-t[i[0]],s=e[i[1]]-t[i[1]];return Math.sqrt(n*n+s*s)}function Y(t,e,i){i||(i=R);var n=e[i[0]]-t[i[0]],s=e[i[1]]-t[i[1]];return 180*Math.atan2(s,n)/Math.PI}H.prototype={handler:function(){},init:function(){this.evEl&&b(this.element,this.evEl,this.domHandler),this.evTarget&&b(this.target,this.evTarget,this.domHandler),this.evWin&&b(D(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(D(this.element),this.evWin,this.domHandler)}};var G={mousedown:1,mousemove:2,mouseup:4},$="mousedown",X="mousemove mouseup";function Z(){this.evEl=$,this.evWin=X,this.pressed=!1,H.apply(this,arguments)}g(Z,H,{handler:function(t){var e=G[t.type];1&e&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:N,srcEvent:t}))}});var J={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},Q={2:k,3:"pen",4:N,5:"kinect"},K="pointerdown",tt="pointermove pointerup pointercancel";function et(){this.evEl=K,this.evWin=tt,H.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}t.MSPointerEvent&&!t.PointerEvent&&(K="MSPointerDown",tt="MSPointerMove MSPointerUp MSPointerCancel"),g(et,H,{handler:function(t){var e=this.store,i=!1,n=t.type.toLowerCase().replace("ms",""),s=J[n],r=Q[t.pointerType]||t.pointerType,a=r==k,o=M(e,t.pointerId,"pointerId");1&s&&(0===t.button||a)?o<0&&(e.push(t),o=e.length-1):12&s&&(i=!0),o<0||(e[o]=t,this.callback(this.manager,s,{pointers:e,changedPointers:[t],pointerType:r,srcEvent:t}),i&&e.splice(o,1))}});var it={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function nt(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,H.apply(this,arguments)}function st(t,e){var i=A(t.touches),n=A(t.changedTouches);return 12&e&&(i=T(i.concat(n),"identifier")),[i,n]}g(nt,H,{handler:function(t){var e=it[t.type];if(1===e&&(this.started=!0),this.started){var i=st.call(this,t,e);12&e&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:k,srcEvent:t})}}});var rt={touchstart:1,touchmove:2,touchend:4,touchcancel:8},at="touchstart touchmove touchend touchcancel";function ot(){this.evTarget=at,this.targetIds={},H.apply(this,arguments)}function ht(t,e){var i=A(t.touches),n=this.targetIds;if(3&e&&1===i.length)return n[i[0].identifier]=!0,[i,i];var s,r,a=A(t.changedTouches),o=[],h=this.target;if(r=i.filter((function(t){return _(t.target,h)})),1===e)for(s=0;s<r.length;)n[r[s].identifier]=!0,s++;for(s=0;s<a.length;)n[a[s].identifier]&&o.push(a[s]),12&e&&delete n[a[s].identifier],s++;return o.length?[T(r.concat(o),"identifier"),o]:void 0}function lt(){H.apply(this,arguments);var t=y(this.handler,this);this.touch=new ot(this.manager,t),this.mouse=new Z(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function ut(t,e){1&t?(this.primaryTouch=e.changedPointers[0].identifier,ct.call(this,e)):12&t&&ct.call(this,e)}function ct(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var i={x:e.clientX,y:e.clientY};this.lastTouches.push(i);var n=this.lastTouches;setTimeout((function(){var t=n.indexOf(i);t>-1&&n.splice(t,1)}),2500)}}function dt(t){for(var e=t.srcEvent.clientX,i=t.srcEvent.clientY,n=0;n<this.lastTouches.length;n++){var s=this.lastTouches[n],r=Math.abs(e-s.x),a=Math.abs(i-s.y);if(r<=25&&a<=25)return!0}return!1}g(ot,H,{handler:function(t){var e=rt[t.type],i=ht.call(this,t,e);i&&this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:k,srcEvent:t})}}),g(lt,H,{handler:function(t,e,i){var n=i.pointerType==k,s=i.pointerType==N;if(!(s&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(n)ut.call(this,e,i);else if(s&&dt.call(this,i))return;this.callback(t,e,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var pt=C(a.style,"touchAction"),ft=pt!==n,mt="compute",gt="auto",yt="manipulation",vt="none",xt="pan-x",bt="pan-y",wt=function(){if(!ft)return!1;var e={},i=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(n){e[n]=!i||t.CSS.supports("touch-action",n)})),e}();function _t(t,e){this.manager=t,this.set(e)}_t.prototype={set:function(t){t==mt&&(t=this.compute()),ft&&this.manager.element.style&&wt[t]&&(this.manager.element.style[pt]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return d(this.manager.recognizers,(function(e){v(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))})),function(t){if(S(t,vt))return vt;var e=S(t,xt),i=S(t,bt);return e&&i?vt:e||i?e?xt:bt:S(t,yt)?yt:gt}(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,i=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var n=this.actions,s=S(n,vt)&&!wt[vt],r=S(n,bt)&&!wt[bt],a=S(n,xt)&&!wt[xt];if(s){var o=1===t.pointers.length,h=t.distance<2,l=t.deltaTime<250;if(o&&h&&l)return}if(!a||!r)return s||r&&6&i||a&&i&O?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var St=32;function Et(t){this.options=s({},this.defaults,t||{}),this.id=I++,this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function Mt(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}function At(t){return 16==t?"down":8==t?"up":2==t?"left":4==t?"right":""}function Tt(t,e){var i=e.manager;return i?i.get(t):t}function Ct(){Et.apply(this,arguments)}function It(){Ct.apply(this,arguments),this.pX=null,this.pY=null}function Dt(){Ct.apply(this,arguments)}function Lt(){Et.apply(this,arguments),this._timer=null,this._input=null}function Bt(){Ct.apply(this,arguments)}function Pt(){Ct.apply(this,arguments)}function kt(){Et.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Nt(t,e){return(e=e||{}).recognizers=x(e.recognizers,Nt.defaults.preset),new Ot(t,e)}function Ot(t,e){var i;this.options=s({},Nt.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((i=this).options.inputClass||(B?et:P?ot:L?lt:Z))(i,W),this.touchAction=new _t(this,this.options.touchAction),Rt(this,!0),d(this.options.recognizers,(function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])}),this)}function Rt(t,e){var i,n=t.element;n.style&&(d(t.options.cssProps,(function(s,r){i=C(n.style,r),e?(t.oldCssProps[i]=n.style[i],n.style[i]=s):n.style[i]=t.oldCssProps[i]||""})),e||(t.oldCssProps={}))}Et.prototype={defaults:{},set:function(t){return s(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(c(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=Tt(t,this)).id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return c(t,"dropRecognizeWith",this)||(t=Tt(t,this),delete this.simultaneous[t.id]),this},requireFailure:function(t){if(c(t,"requireFailure",this))return this;var e=this.requireFail;return-1===M(e,t=Tt(t,this))&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(c(t,"dropRequireFailure",this))return this;t=Tt(t,this);var e=M(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,i=this.state;function n(i){e.manager.emit(i,t)}i<8&&n(e.options.event+Mt(i)),n(e.options.event),t.additionalEvent&&n(t.additionalEvent),i>=8&&n(e.options.event+Mt(i))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=St},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},recognize:function(t){var e=s({},t);if(!v(this.options.enable,[this,e]))return this.reset(),void(this.state=St);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},process:function(t){},getTouchAction:function(){},reset:function(){}},g(Ct,Et,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,i=t.eventType,n=6&e,s=this.attrTest(t);return n&&(8&i||!s)?16|e:n||s?4&i?8|e:2&e?4|e:2:St}}),g(It,Ct,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var t=this.options.direction,e=[];return 6&t&&e.push(bt),t&O&&e.push(xt),e},directionTest:function(t){var e=this.options,i=!0,n=t.distance,s=t.direction,r=t.deltaX,a=t.deltaY;return s&e.direction||(6&e.direction?(s=0===r?1:r<0?2:4,i=r!=this.pX,n=Math.abs(t.deltaX)):(s=0===a?1:a<0?8:16,i=a!=this.pY,n=Math.abs(t.deltaY))),t.direction=s,i&&n>e.threshold&&s&e.direction},attrTest:function(t){return Ct.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=At(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),g(Dt,Ct,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[vt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),g(Lt,Et,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[gt]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distance<e.threshold,s=t.deltaTime>e.time;if(this._input=t,!n||!i||12&t.eventType&&!s)this.reset();else if(1&t.eventType)this.reset(),this._timer=u((function(){this.state=8,this.tryEmit()}),e.time,this);else if(4&t.eventType)return 8;return St},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&4&t.eventType?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}}),g(Bt,Ct,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[vt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),g(Pt,Ct,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return It.prototype.getTouchAction.call(this)},attrTest:function(t){var e,i=this.options.direction;return 30&i?e=t.overallVelocity:6&i?e=t.overallVelocityX:i&O&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&i&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&h(e)>this.options.velocity&&4&t.eventType},emit:function(t){var e=At(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),g(kt,Et,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[yt]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distance<e.threshold,s=t.deltaTime<e.time;if(this.reset(),1&t.eventType&&0===this.count)return this.failTimeout();if(n&&s&&i){if(4!=t.eventType)return this.failTimeout();var r=!this.pTime||t.timeStamp-this.pTime<e.interval,a=!this.pCenter||j(this.pCenter,t.center)<e.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,a&&r?this.count+=1:this.count=1,this._input=t,0==this.count%e.taps)return this.hasRequireFailures()?(this._timer=u((function(){this.state=8,this.tryEmit()}),e.interval,this),2):8}return St},failTimeout:function(){return this._timer=u((function(){this.state=St}),this.options.interval,this),St},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Nt.VERSION="2.0.7",Nt.defaults={domEvents:!1,touchAction:mt,enable:!0,inputTarget:null,inputClass:null,preset:[[Bt,{enable:!1}],[Dt,{enable:!1},["rotate"]],[Pt,{direction:6}],[It,{direction:6},["swipe"]],[kt],[kt,{event:"doubletap",taps:2},["tap"]],[Lt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},Ot.prototype={set:function(t){return s(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?2:1},recognize:function(t){var e=this.session;if(!e.stopped){var i;this.touchAction.preventDefaults(t);var n=this.recognizers,s=e.curRecognizer;(!s||s&&8&s.state)&&(s=e.curRecognizer=null);for(var r=0;r<n.length;)i=n[r],2===e.stopped||s&&i!=s&&!i.canRecognizeWith(s)?i.reset():i.recognize(t),!s&&14&i.state&&(s=e.curRecognizer=i),r++}},get:function(t){if(t instanceof Et)return t;for(var e=this.recognizers,i=0;i<e.length;i++)if(e[i].options.event==t)return e[i];return null},add:function(t){if(c(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(c(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,i=M(e,t);-1!==i&&(e.splice(i,1),this.touchAction.update())}return this},on:function(t,e){if(t!==n&&e!==n){var i=this.handlers;return d(E(t),(function(t){i[t]=i[t]||[],i[t].push(e)})),this}},off:function(t,e){if(t!==n){var i=this.handlers;return d(E(t),(function(t){e?i[t]&&i[t].splice(M(i[t],e),1):delete i[t]})),this}},emit:function(t,i){this.options.domEvents&&function(t,i){var n=e.createEvent("Event");n.initEvent(t,!0,!0),n.gesture=i,i.target.dispatchEvent(n)}(t,i);var n=this.handlers[t]&&this.handlers[t].slice();if(n&&n.length){i.type=t,i.preventDefault=function(){i.srcEvent.preventDefault()};for(var s=0;s<n.length;)n[s](i),s++}},destroy:function(){this.element&&Rt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},s(Nt,{INPUT_START:1,INPUT_MOVE:2,INPUT_END:4,INPUT_CANCEL:8,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:St,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:O,DIRECTION_ALL:30,Manager:Ot,Input:H,TouchAction:_t,TouchInput:ot,MouseInput:Z,PointerEventInput:et,TouchMouseInput:lt,SingleTouchInput:nt,Recognizer:Et,AttrRecognizer:Ct,Tap:kt,Pan:It,Swipe:Pt,Pinch:Dt,Rotate:Bt,Press:Lt,on:b,off:w,each:d,merge:m,extend:f,assign:s,inherit:g,bindFn:y,prefixed:C}),(void 0!==t?t:"undefined"!=typeof self?self:{}).Hammer=Nt,Ys.exports?Ys.exports=Nt:t.Hammer=Nt}(window,document);const $s=_(Gs.exports),Xs=new We,Zs=new We;class Js extends Fi{constructor(t,e,i=!1){super(),c(this,"name","orbit-controller.ts"),c(this,"isSvg",!1),c(this,"dom"),c(this,"domOffset",new We),c(this,"camera"),c(this,"hammer"),c(this,"enabled",!0),c(this,"enablePan",!0),c(this,"enableRotate",!0),c(this,"rotateSpeed",1),c(this,"enableZoom",!0),c(this,"minZoom",0),c(this,"maxZoom",1/0),c(this,"zoomSpeed",1),c(this,"zoomChanged",!1),c(this,"distanceStart",1),c(this,"distanceEnd",1),c(this,"state",-1),c(this,"EPS",1e-6),c(this,"focus",new We),c(this,"target",new We),c(this,"scaled",1),c(this,"rotateTheta",0),c(this,"enableDamping",!1),c(this,"dampingFactor",.05),c(this,"mouseButtons",{LEFT:2,MIDDLE:1,RIGHT:0}),c(this,"isWheeling",!1),c(this,"finalTimer"),c(this,"rotateStart",new We),c(this,"rotateEnd",new We),c(this,"rotateDelta",new We),c(this,"panStart",new We),c(this,"panEnd",new We),c(this,"panOffset",new We),c(this,"dollyStart",0),c(this,"dollyOffset",new We),c(this,"contextMenuHandler",this.handleContextMenu.bind(this)),c(this,"wheelHandler",this.handleWheel.bind(this)),c(this,"pointerDownHandler",this.handlePointerDown.bind(this)),c(this,"pointerUpHandler",this.handlePointerUp.bind(this)),c(this,"pointerMoveHandler",this.handlePointerMove.bind(this)),c(this,"pointerOverHandler",ri.debounce(this.handlePointerOver.bind(this),50)),c(this,"pointerLeaveHandler",this.handlePointerLeave.bind(this)),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"doubleTapHandler",this.handleDoubleTap.bind(this)),c(this,"panHandler",this.handlePan.bind(this)),c(this,"pinchHandler",this.handlePinch.bind(this)),c(this,"pressHandler",this.handlePress.bind(this)),c(this,"swipeHandler",this.handleSwipe.bind(this)),c(this,"hammerInputHandler",this.handleHammerInput.bind(this)),this.isSvg=i,this.dom=t,this.camera=e,this.scaled=e.scaled.x,this.resize(),this.dom.style.touchAction="none",this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}resize(){let t=this.dom.getBoundingClientRect();this.domOffset.set(t.left,t.top)}update(){this.camera.position.add(this.panOffset).add(this.dollyOffset),this.camera.scaled.set(this.scaled,this.scaled),this.rotateTheta&&(this.camera.rotation.x-=this.rotateTheta,Xs.copy(this.camera.position).rotateAround(this.focus,-this.rotateTheta),this.camera.position.copy(Xs)),this.camera.update(),this.panOffset.set(0,0),this.dollyOffset.set(0,0),this.scaled=this.camera.scaled.x,this.rotateTheta=0,this.dispatchEvent({type:"cameraChanged",data:{t:this.camera.position,r:this.camera.rotation.x,s:this.camera.scaled.x}})}bindEvents(){this.unbindEvents(),this.hammer=new $s.Manager(this.dom,{domEvents:!0});const t=new $s.Pan({threshold:0,pointers:0}),e=new $s.Pinch({threshold:0}),i=new $s.Tap({event:"singletap",taps:1}),n=new $s.Tap({event:"doubletap",taps:2}),s=new $s.Press({});this.hammer.add([t,n,i,s,e]),e.recognizeWith(t),n.recognizeWith(i),i.requireFailure(n),this.hammer.on(["panstart","panmove","panend"].join(" "),this.panHandler),this.hammer.on(["pinchstart","pinchmove","pinchend"].join(" "),this.pinchHandler),this.hammer.on("singletap",this.tapHandler),this.hammer.on("doubletap",this.doubleTapHandler),this.hammer.on("press",this.pressHandler),this.hammer.on("swipe",this.swipeHandler),this.hammer.on("hammer.input",this.hammerInputHandler),this.dom.addEventListener("contextmenu",this.contextMenuHandler),this.dom.addEventListener("wheel",this.wheelHandler,{passive:!1}),this.dom.addEventListener("mousemove",this.pointerOverHandler),this.isSvg||(this.dom.addEventListener("pointerdown",this.pointerDownHandler),this.dom.addEventListener("pointerleave",this.pointerLeaveHandler))}unbindEvents(){var t,e,i,n,s,r,a,o,h;null==(t=this.hammer)||t.off(["panstart","panmove","panend"].join(" "),this.panHandler),null==(e=this.hammer)||e.off(["pinchstart","pinchmove","pinchend"].join(" "),this.pinchHandler),null==(i=this.hammer)||i.off("singletap",this.tapHandler),null==(n=this.hammer)||n.off("doubletap",this.doubleTapHandler),null==(s=this.hammer)||s.off("press",this.pressHandler),null==(r=this.hammer)||r.off("swipe",this.swipeHandler),null==(a=this.hammer)||a.off("hammer.input",this.hammerInputHandler),this.dom.removeEventListener("contextmenu",this.contextMenuHandler),this.dom.removeEventListener("wheel",this.wheelHandler),this.dom.removeEventListener("mousemove",this.pointerOverHandler),this.isSvg||(this.dom.removeEventListener("pointerdown",this.pointerDownHandler),this.dom.removeEventListener("pointerleave",this.pointerLeaveHandler)),null==(o=this.hammer)||o.stop(!0),null==(h=this.hammer)||h.destroy()}setFocus(t,e){this.focus.set(t,e).sub(this.domOffset).unproject(this.camera)}handleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),Zs.set(t.center.x,t.center.y).sub(this.domOffset);const e={x:Zs.x,y:Zs.y};this.camera&&Zs.unproject(this.camera);const i={x:Zs.x,y:Zs.y};this.dispatchEvent({type:"tap",data:{screenCoords:e,worldCoords:i},e:t})}handleDoubleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),Zs.set(t.center.x,t.center.y).sub(this.domOffset);const e={x:Zs.x,y:Zs.y};this.camera&&Zs.unproject(this.camera);const i={x:Zs.x,y:Zs.y};this.dispatchEvent({type:"doubletap",data:{screenCoords:e,worldCoords:i}})}handlePress(t){"function"==typeof t.preventDefault&&t.preventDefault()}handlePan(t){var e;if(this.scaled=this.camera.scaled.x,1!==(null==(e=t.pointers)?void 0:e.length))return;"function"==typeof t.preventDefault&&t.preventDefault();const i={type:"panmove",data:{}};(t.isFirst||"panstart"===t.type)&&(this.state=2,this.panStart.set(t.center.x,t.center.y),i.type="panstart"),(t.isFinal||"panend"===t.type)&&(this.state=-1,i.type="panend"),this.panEnd.set(t.center.x,t.center.y),this.panOffset.subVectors(this.panEnd,this.panStart).multiplyScalar(-this.camera.scaled.x,-this.camera.scaled.y*(this.camera.flipY?1:-1)).rotate(this.camera.rotation.x),this.panStart.copy(this.panEnd),Zs.set(t.center.x,t.center.y).sub(this.domOffset),i.data.screenCoords=Zs.clone(),this.dispatchEvent(i),this.enablePan&&this.update()}handlePinch(t){"function"==typeof t.preventDefault&&t.preventDefault(),"pinchstart"===t.type&&(this.dollyStart=this.camera.scaled.x,this.state=1),(t.isFinal||"pinchend"===t.type)&&(this.state=-1),this.scaled=this.dollyStart*(1/t.scale);let e=(this.scaled-this.camera.scaled.x)/this.camera.scaled.x;this.setFocus(t.center.x,t.center.y),this.dollyOffset.copy(this.camera.position).lerp(this.focus,-e).sub(this.camera.position),this.update()}handleRotate(t){"function"==typeof t.preventDefault&&t.preventDefault()}handleSwipe(t){"function"==typeof t.preventDefault&&t.preventDefault()}handleHammerInput(t){t.isFirst&&(this.state=9),t.isFinal&&(this.state=-1)}handleContextMenu(t){this.enabled&&"function"==typeof t.preventDefault&&t.preventDefault()}handleWheel(t){if("function"==typeof t.preventDefault&&t.preventDefault(),!this.enabled||!this.enableZoom||-1!==this.state)return;this.isWheeling||(this.dispatchEvent({type:"wheelstart"}),this.isWheeling=!0),"function"==typeof t.preventDefault&&t.preventDefault(),"function"==typeof t.stopPropagation&&t.stopPropagation();let e=t.deltaY;1===(null==t?void 0:t.deltaMode)?e*=16:2===(null==t?void 0:t.deltaMode)&&(e*=100),(null==t?void 0:t.ctrlKey)&&(e*=10),this.setFocus(t.clientX,t.clientY);let i=this.getZoomScale(e);e<0?this.onDollyIn(i):e>0?this.onDollyOut(i):(this.scaled=this.camera.scaled.x,this.dollyOffset.set(0,0)),this.update(),clearTimeout(this.finalTimer),this.finalTimer=setTimeout((()=>{this.isWheeling&&(this.dispatchEvent({type:"wheelend"}),this.isWheeling=!1)}),500)}onDollyIn(t){this.scaled=Math.max(this.minZoom,Math.min(this.maxZoom,this.camera.scaled.x*t)),this.dollyOffset.copy(this.camera.position).lerp(this.focus,1-t).sub(this.camera.position)}onDollyOut(t){this.scaled=Math.max(this.minZoom,Math.min(this.maxZoom,this.camera.scaled.x/t)),this.dollyOffset.copy(this.camera.position).lerp(this.focus,-1+t).sub(this.camera.position)}getZoomScale(t){return Math.pow(.95,this.zoomSpeed*Math.abs(.03*t))}handlePointerDown(t){if(this.scaled=this.camera.scaled.x,!this.enabled)return;if(2!==t.button)return;this.dom.addEventListener("pointermove",this.pointerMoveHandler),this.dom.addEventListener("pointerup",this.pointerUpHandler);let e=-1;0===t.button?e=this.mouseButtons.LEFT:1===t.button?e=this.mouseButtons.MIDDLE:2===t.button&&(e=this.mouseButtons.RIGHT),0===e&&(this.rotateStart.set(t.clientX,t.clientY),this.setFocus(this.rotateStart.x,this.rotateStart.y),this.state=0)}handlePointerUp(){this.dom.removeEventListener("pointermove",this.pointerMoveHandler),this.dom.removeEventListener("pointerup",this.pointerUpHandler),this.state=-1}handlePointerLeave(){this.state=-1}handlePointerMove(t){if(this.enabled&&0===this.state){if(!this.enableRotate)return;this.onRotate(t.clientX,t.clientY)}}handlePointerOver(t){if(t.buttons>0)return;Zs.set(t.clientX,t.clientY).sub(this.domOffset);const e={x:Zs.x,y:Zs.y};Zs.unproject(this.camera);const i={x:Zs.x,y:Zs.y};this.dispatchEvent({type:"pointerover",data:{screenCoords:e,worldCoords:i},e:t})}onRotate(t,e){this.rotateEnd.set(t,e),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);const i=this.rotateDelta.x*Math.PI*2/this.dom.clientHeight;this.rotateTheta-=i,this.rotateStart.copy(this.rotateEnd),this.update()}}var Qs=(t=>(t.CONTEXTMENU="contextmenu",t.LOSTPOINTERCAPTURE="lostpointercapture",t.MOUSEOVER="mouseover",t.MOUSEOUT="mouseout",t.MOUSELEAVE="mouseleave",t.MOUSEENTER="mouseenter",t.MOUSEMOVE="mousemove",t.MOUSEDOWN="mousedown",t.MOUSEUP="mouseup",t.POINTERMOVE="pointermove",t.POINTERDOWN="pointerdown",t.POINTERUP="pointerup",t.POINTERCANCEL="pointercancel",t.POINTEROUT="pointerout",t.POINTERLEAVE="pointerleave",t.POINTEROVER="pointerover",t.POINTERENTER="pointerenter",t.TOUCHSTART="touchstart",t.TOUCHEND="touchend",t.TOUCHMOVE="touchmove",t.TOUCHCANCEL="touchcancel",t.WHEEL="wheel",t.WHEEL_START="wheelstart",t.WHEEL_END="wheelend",t.MOUSEWHEEL="mousewheel",t.CLICK="click",t.DBLCLICK="dblclick",t.CONTEXT_LOST="contextlost",t.CONTEXT_RESTORED="contextrestored",t.CONTROLS_CHANGED="controlschanged",t.TAP="tap",t.SINGLE_TAP="singletap",t.DOUBLE_TAP="doubletap",t.PRESS="press",t.PAN="pan",t.PAN_START="panstart",t.PAN_MOVE="panmove",t.PAN_END="panend",t.ROTATE="rotate",t.ROTATE_START="rotatestart",t.ROTATE_MOVE="rotatemove",t.ROTATE_END="rotateend",t.PINCH="pinch",t.PINCH_START="pinchstart",t.PINCH_MOVE="pinchmove",t.PINCH_END="pinchend",t.PINCH_IN="pinchin",t.PINCH_OUT="pinchout",t.SWIPE="swipe",t.CHANGE_START="change_start",t.CHANGE_END="change_end",t.CAMERA_CHANGED="cameraChanged",t))(Qs||{});const Ks=new We;class tr extends gs{constructor(t){super(),c(this,"isCamera",!0),c(this,"type","Camera2"),c(this,"name","Camera2"),c(this,"params"),c(this,"matrixAutoUpdate",!1),c(this,"matrixWorldAutoUpdate",!1),c(this,"projectionMatrix",new Ui),c(this,"projectionMatrixInverse",new Ui),c(this,"viewMatrix",new Ui),c(this,"viewMatrixNeedsUpdate",!0),c(this,"viewArea",0),c(this,"left",-1),c(this,"right",1),c(this,"top",1),c(this,"bottom",-1),c(this,"width",2),c(this,"height",2),c(this,"aspect",1),c(this,"view"),this.params=t,this.width=void 0!==(null==t?void 0:t.width)?t.width:2,this.height=void 0!==(null==t?void 0:t.height)?t.height:2,this.aspect=void 0!==(null==t?void 0:t.aspect)?t.aspect:1,void 0!==(null==t?void 0:t.left)&&(this.left=t.left),void 0!==(null==t?void 0:t.right)&&(this.right=t.right),void 0!==(null==t?void 0:t.top)&&(this.top=t.top),void 0!==(null==t?void 0:t.bottom)&&(this.bottom=t.bottom);const e=(this.right+this.left)/2,i=(this.top+this.bottom)/2;if(this.aspect>1){const t=Math.round((this.right-this.left)/2/this.aspect);this.top=i+t,this.bottom=i-t}else if(this.aspect<1){const t=Math.round((this.top-this.bottom)/2*this.aspect);this.left=e-t,this.right=e+t}this.flipY=!0===(null==t?void 0:t.flipY),this.updateProjectionMatrix(),(null==t?void 0:t.eye)&&this.position.fromArray(t.eye),(null==t?void 0:t.up)&&this.up.fromArray(t.up),this.computeBoundingBox(),this.update()}destroy(){super.destroy()}get pixelWidth(){return this.scaled.x}set(t=-1,e=1,i=1,n=-1){Ks.set(t+e,n+i).multiplyScalar(.5);const s=Math.max((e-t)/this.width,(i-n)/this.height);this.setTRS(Ks,0,s)}setByBox(t){t&&!t.isEmpty()&&this.set(t.min.x,t.max.x,t.max.y,t.min.y)}setTRS(t={x:0,y:0},e=0,i=0){this.position.set(t.x||0,t.y||0),this.rotation.set(e,e),this.scaled.set(i,i),this.update()}resize(){this.setSize(this.params.width,this.params.height)}setSize(t,e){this.width=t||2,this.height=e||2,this.left=this.params.left||-1,this.right=this.params.right||1,this.top=this.params.top||1,this.bottom=this.params.bottom||-1,this.aspect=t/e;const i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;if(this.aspect>1){const t=Math.round((this.right-this.left)/2/this.aspect);this.top=n+t,this.bottom=n-t}else if(this.aspect<1){const t=Math.round((this.top-this.bottom)/2*this.aspect);this.left=i-t,this.right=i+t}this.updateProjectionMatrix(),this.boundingBox.min.set(this.left,this.bottom),this.boundingBox.max.set(this.right,this.top),this.update(),this.matrix.decompose(this.position,this.rotation,this.scaled)}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[6],-e[7]).normalize()}getCameraPosition(){return{x:this.position.x,y:this.position.y,z:this.position.z,s:this.scaled.x,r:this.rotation.x}}updateMatrixWorld(t=!1){super.updateMatrixWorld(t),this.updateViewMatrix()}updateProjectionMatrix(){void 0===this.parent&&this.matrixWorldAutoUpdate&&this.updateMatrixWorld(),this.projectionMatrix.makeProjection(this.left,this.right,this.top,this.bottom,this.width,this.height),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}updateViewMatrix(){this.matrixWorldInverse.copy(this.matrixWorld).invert(),this.viewMatrix.multiplyMatrices(this.projectionMatrix,this.matrixWorldInverse)}update(t=!0){this.matrixAutoUpdate||this.updateMatrix(),this.updateMatrixWorld(),this.needsUpdate=!0,this.updateBoundingBox(),t&&this.dispatchEvent({type:"update",data:{t:this.position,r:this.rotation.x,s:this.scaled.x}})}computeBoundingBox(){return this.boundingBox.min.set(this.left,this.bottom),this.boundingBox.max.set(this.right,this.top),this.boundingBox}updateBoundingBox(){super.updateBoundingBox(),this.viewArea=this.boundingBoxWorld.getArea()}toJSON(){const t={};return t.left=this.left,t.right=this.right,t.top=this.top,t.bottom=this.bottom,t.width=this.width,t.height=this.height,t.aspect=this.aspect,t.position=this.position.toArray(),t.rotation=this.rotation.toArray(),t.scaled=this.scaled.toArray(),t}fromJSON(t){this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.width=t.width,this.height=t.height,this.aspect=t.aspect,this.position.fromArray(t.position),this.rotation.fromArray(t.rotation),this.scaled.fromArray(t.scaled),this.updateProjectionMatrix(),this.update(!1)}clone(){return(new this.constructor.prototype.constructor).copy(this)}copy(t,e=!0,i=!1){return super.copy(t,e,i),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.width=t.width,this.height=t.height,this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this}}var er=(t=>(t.UPDATE="update",t))(er||{});class ir extends Fi{constructor(t){super(),c(this,"name","SvgSelectRect"),c(this,"container"),c(this,"el"),this.container=t||document.getElementsByTagName("body")[0],this.el=document.createElement("div"),this.el.setAttribute("id","aeSvgSelectRect"),this.el.setAttribute("class","ae-svg-select-rect"),this.el.style.display="none",this.container.appendChild(this.el)}destroy(){super.destroy(),this.el&&this.el.remove()}draw(t){nr.copy(t).getSize(rr),sr.copy(nr.min),this.el.style.display="none",this.el.style.position="absolute",this.el.style.left=sr.x+"px",this.el.style.top=sr.y+"px",this.el.style.width=rr.x+"px",this.el.style.height=rr.y+"px",this.el.style.display="block",this.el.style.background=new Re(Le.darkBlue).setA(.1).getStyle(),this.el.style.border=Le.darkBlue+" 1px dashed"}hide(){this.el.style.display="none"}}const nr=new ai,sr=new We,rr=new We;class ar extends Fi{constructor(t,e){super(),c(this,"name","SvgMultiSelector"),c(this,"controller"),c(this,"scene"),c(this,"container"),c(this,"p1",new We),c(this,"p2",new We),c(this,"graph"),c(this,"selectEnable",!1),c(this,"multiSelectEnable",!1),c(this,"fnEnable",!1),c(this,"controllerTapHandler",this.handleControllerTap.bind(this)),c(this,"controllerPanStartHandler",this.handleControllerPanStart.bind(this)),c(this,"controllerPanMoveHandler",this.handleControllerPanMove.bind(this)),c(this,"controllerPanEndHandler",this.handleControllerPanEnd.bind(this)),this.container=t,this.controller=e,this.graph=new ir(t),this.bindControllerEvents()}destroy(){this.unbindControllerEvents(),super.destroy()}bindScene(t){this.scene=t}selectEnableChanged(t){var e;null==(e=this.scene)||e.clearSelected(),this.selectEnable=!!t}multiSelectEnableChanged(t){var e;null==(e=this.scene)||e.clearSelected(),this.multiSelectEnable=!!t,this.controller.enablePan=!this.multiSelectEnable||this.multiSelectEnable&&!this.fnEnable}fnEnableChanged(t){this.fnEnable=!!t,this.controller.enablePan=!this.multiSelectEnable||this.multiSelectEnable&&!this.fnEnable}bindControllerEvents(){this.controller.addEventListener(Qs.TAP,this.controllerTapHandler),this.controller.addEventListener(Qs.PAN_START,this.controllerPanStartHandler),this.controller.addEventListener(Qs.PAN_MOVE,this.controllerPanMoveHandler),this.controller.addEventListener(Qs.PAN_END,this.controllerPanEndHandler)}unbindControllerEvents(){this.controller.removeEventListener(Qs.TAP,this.controllerTapHandler),this.controller.removeEventListener(Qs.PAN_START,this.controllerPanStartHandler),this.controller.removeEventListener(Qs.PAN_MOVE,this.controllerPanMoveHandler),this.controller.removeEventListener(Qs.PAN_END,this.controllerPanEndHandler)}handleControllerTap(t){var e,i,n,s,r,a;if((null==t?void 0:t.type)!==Qs.TAP)return;if(!this.selectEnable&&!this.multiSelectEnable)return;const o=(null==(e=null==t?void 0:t.e)?void 0:e.target)||(null==(n=null==(i=null==t?void 0:t.e)?void 0:i.srcEvent)?void 0:n.target)||(null==(r=null==(s=null==t?void 0:t.e)?void 0:s.srcEvent)?void 0:r.srcElement);(null==o?void 0:o.id)&&(null==(a=this.scene)?void 0:a.isBelongsToAssetType(null==o?void 0:o.id))&&this.dispatchEvent({type:"SELECTED",data:u(l({},t.data),{target:[o],selected:[null==o?void 0:o.id]})})}handleControllerPanStart(t){(null==t?void 0:t.type)===Qs.PAN_START&&this.multiSelectEnable&&(this.controller.enablePan||(this.p1.copy(t.data.screenCoords),hr.makeEmpty().expandByPoint(this.p1),this.graph.draw(hr)))}handleControllerPanMove(t){(null==t?void 0:t.type)===Qs.PAN_MOVE&&this.multiSelectEnable&&(this.controller.enablePan||(this.p2.copy(t.data.screenCoords),hr.makeEmpty().expandByPoint(this.p1).expandByPoint(this.p2),this.graph.draw(hr)))}handleControllerPanEnd(t){var e;if((null==t?void 0:t.type)!==Qs.PAN_END)return;if(!this.multiSelectEnable)return;if(this.controller.enablePan)return;this.p2.copy(t.data.screenCoords),hr.makeEmpty().expandByPoint(this.p1).expandByPoint(this.p2).unproject(this.controller.camera);const i=null==(e=this.scene)?void 0:e.getElementsByBox(hr),n=[];(i||[]).forEach((t=>n.push(t.id))),this.graph.hide(),hr.makeEmpty(),this.dispatchEvent({type:"SELECTED",data:{target:i,selected:n}})}}var or=(t=>(t.SELECTED="SELECTED",t))(or||{});const hr=new ai;var lr=(t=>(t.DEFAULT="default",t.INFO="info",t.PRIMARY="primary",t.SUCCESS="success",t.WARNING="warning",t.DANGER="danger",t))(lr||{});class ur{constructor(){c(this,"camera"),c(this,"screenCoords",new We),c(this,"worldCoords",new We),c(this,"worldBox",new ai),c(this,"intersectType",0),c(this,"params",{Shape:{},Line:{threshold:1},Points:{threshold:1},Sprite:{}})}setFromCamera(t,e){return this.camera=e,this.screenCoords.set(t.x,t.y),this.worldCoords.copy(this.screenCoords).unproject(e),this}init(t,e){return this.camera=e,(null==t?void 0:t.screenCoords)&&this.screenCoords.set(t.screenCoords.x,t.screenCoords.y),(null==t?void 0:t.worldCoords)?this.worldCoords.set(t.worldCoords.x,t.worldCoords.y):e&&this.worldCoords.copy(this.screenCoords).unproject(e),(null==t?void 0:t.worldBox)&&this.worldBox.copy(t.worldBox),this.intersectType=void 0!==(null==t?void 0:t.worldBox)?1:0,this}intersectObjects(t,e=!0,i=[]){for(let n=0,s=t.length;n<s;n++)this.intersectObject(t[n],e,i)}intersectObject(t,e=!1,i=[]){if(!t.selectable||!t.visible)return i;if(t.raycast(this,i),!e||t.composeNode)return i;for(let n=0,s=t.children.length;n<s;n++)this.intersectObject(t.children[n],e,i);return i}intersectObjectBy(t,e,i=!0,n=[]){if(!t.selectable||!t.visible)return n;if("function"==typeof e&&e(t)&&t.raycast(this,n),!i||t.composeNode)return n;for(let s=0,r=t.children.length;s<r;s++)this.intersectObjectBy(t.children[s],e,i,n);return n}}var cr="top",dr="bottom",pr="right",fr="left",mr="auto",gr=[cr,dr,pr,fr],yr="start",vr="end",xr="viewport",br="popper",wr=gr.reduce((function(t,e){return t.concat([e+"-"+yr,e+"-"+vr])}),[]),_r=[].concat(gr,[mr]).reduce((function(t,e){return t.concat([e,e+"-"+yr,e+"-"+vr])}),[]),Sr=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Er(t){return t?(t.nodeName||"").toLowerCase():null}function Mr(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Ar(t){return t instanceof Mr(t).Element||t instanceof Element}function Tr(t){return t instanceof Mr(t).HTMLElement||t instanceof HTMLElement}function Cr(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Mr(t).ShadowRoot||t instanceof ShadowRoot)}const Ir={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];Tr(s)&&Er(s)&&(Object.assign(s.style,i),Object.keys(n).forEach((function(t){var e=n[t];!1===e?s.removeAttribute(t):s.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],s=e.attributes[t]||{},r=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});Tr(n)&&Er(n)&&(Object.assign(n.style,r),Object.keys(s).forEach((function(t){n.removeAttribute(t)})))}))}},requires:["computeStyles"]};function Dr(t){return t.split("-")[0]}var Lr=Math.max,Br=Math.min,Pr=Math.round;function kr(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function Nr(){return!/^((?!chrome|android).)*safari/i.test(kr())}function Or(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=t.getBoundingClientRect(),s=1,r=1;e&&Tr(t)&&(s=t.offsetWidth>0&&Pr(n.width)/t.offsetWidth||1,r=t.offsetHeight>0&&Pr(n.height)/t.offsetHeight||1);var a=(Ar(t)?Mr(t):window).visualViewport,o=!Nr()&&i,h=(n.left+(o&&a?a.offsetLeft:0))/s,l=(n.top+(o&&a?a.offsetTop:0))/r,u=n.width/s,c=n.height/r;return{width:u,height:c,top:l,right:h+u,bottom:l+c,left:h,x:h,y:l}}function Rr(t){var e=Or(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function zr(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&Cr(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Hr(t){return Mr(t).getComputedStyle(t)}function Wr(t){return["table","td","th"].indexOf(Er(t))>=0}function Fr(t){return((Ar(t)?t.ownerDocument:t.document)||window.document).documentElement}function Ur(t){return"html"===Er(t)?t:t.assignedSlot||t.parentNode||(Cr(t)?t.host:null)||Fr(t)}function Vr(t){return Tr(t)&&"fixed"!==Hr(t).position?t.offsetParent:null}function qr(t){for(var e=Mr(t),i=Vr(t);i&&Wr(i)&&"static"===Hr(i).position;)i=Vr(i);return i&&("html"===Er(i)||"body"===Er(i)&&"static"===Hr(i).position)?e:i||function(t){var e=/firefox/i.test(kr());if(/Trident/i.test(kr())&&Tr(t)&&"fixed"===Hr(t).position)return null;var i=Ur(t);for(Cr(i)&&(i=i.host);Tr(i)&&["html","body"].indexOf(Er(i))<0;){var n=Hr(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(t)||e}function jr(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Yr(t,e,i){return Lr(t,Br(e,i))}function Gr(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function $r(t,e){return e.reduce((function(e,i){return e[i]=t,e}),{})}function Xr(t){return t.split("-")[1]}var Zr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Jr(t){var e,i=t.popper,n=t.popperRect,s=t.placement,r=t.variation,a=t.offsets,o=t.position,h=t.gpuAcceleration,l=t.adaptive,u=t.roundOffsets,c=t.isFixed,d=a.x,p=void 0===d?0:d,f=a.y,m=void 0===f?0:f,g="function"==typeof u?u({x:p,y:m}):{x:p,y:m};p=g.x,m=g.y;var y=a.hasOwnProperty("x"),v=a.hasOwnProperty("y"),x=fr,b=cr,w=window;if(l){var _=qr(i),S="clientHeight",E="clientWidth";if(_===Mr(i)&&"static"!==Hr(_=Fr(i)).position&&"absolute"===o&&(S="scrollHeight",E="scrollWidth"),s===cr||(s===fr||s===pr)&&r===vr)b=dr,m-=(c&&_===w&&w.visualViewport?w.visualViewport.height:_[S])-n.height,m*=h?1:-1;if(s===fr||(s===cr||s===dr)&&r===vr)x=pr,p-=(c&&_===w&&w.visualViewport?w.visualViewport.width:_[E])-n.width,p*=h?1:-1}var M,A=Object.assign({position:o},l&&Zr),T=!0===u?function(t,e){var i=t.x,n=t.y,s=e.devicePixelRatio||1;return{x:Pr(i*s)/s||0,y:Pr(n*s)/s||0}}({x:p,y:m},Mr(i)):{x:p,y:m};return p=T.x,m=T.y,h?Object.assign({},A,((M={})[b]=v?"0":"",M[x]=y?"0":"",M.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",M)):Object.assign({},A,((e={})[b]=v?m+"px":"",e[x]=y?p+"px":"",e.transform="",e))}var Qr={passive:!0};var Kr={left:"right",right:"left",bottom:"top",top:"bottom"};function ta(t){return t.replace(/left|right|bottom|top/g,(function(t){return Kr[t]}))}var ea={start:"end",end:"start"};function ia(t){return t.replace(/start|end/g,(function(t){return ea[t]}))}function na(t){var e=Mr(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function sa(t){return Or(Fr(t)).left+na(t).scrollLeft}function ra(t){var e=Hr(t),i=e.overflow,n=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(i+s+n)}function aa(t){return["html","body","#document"].indexOf(Er(t))>=0?t.ownerDocument.body:Tr(t)&&ra(t)?t:aa(Ur(t))}function oa(t,e){var i;void 0===e&&(e=[]);var n=aa(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),r=Mr(n),a=s?[r].concat(r.visualViewport||[],ra(n)?n:[]):n,o=e.concat(a);return s?o:o.concat(oa(Ur(a)))}function ha(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function la(t,e,i){return e===xr?ha(function(t,e){var i=Mr(t),n=Fr(t),s=i.visualViewport,r=n.clientWidth,a=n.clientHeight,o=0,h=0;if(s){r=s.width,a=s.height;var l=Nr();(l||!l&&"fixed"===e)&&(o=s.offsetLeft,h=s.offsetTop)}return{width:r,height:a,x:o+sa(t),y:h}}(t,i)):Ar(e)?function(t,e){var i=Or(t,!1,"fixed"===e);return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}(e,i):ha(function(t){var e,i=Fr(t),n=na(t),s=null==(e=t.ownerDocument)?void 0:e.body,r=Lr(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),a=Lr(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),o=-n.scrollLeft+sa(t),h=-n.scrollTop;return"rtl"===Hr(s||i).direction&&(o+=Lr(i.clientWidth,s?s.clientWidth:0)-r),{width:r,height:a,x:o,y:h}}(Fr(t)))}function ua(t,e,i,n){var s="clippingParents"===e?function(t){var e=oa(Ur(t)),i=["absolute","fixed"].indexOf(Hr(t).position)>=0&&Tr(t)?qr(t):t;return Ar(i)?e.filter((function(t){return Ar(t)&&zr(t,i)&&"body"!==Er(t)})):[]}(t):[].concat(e),r=[].concat(s,[i]),a=r[0],o=r.reduce((function(e,i){var s=la(t,i,n);return e.top=Lr(s.top,e.top),e.right=Br(s.right,e.right),e.bottom=Br(s.bottom,e.bottom),e.left=Lr(s.left,e.left),e}),la(t,a,n));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function ca(t){var e,i=t.reference,n=t.element,s=t.placement,r=s?Dr(s):null,a=s?Xr(s):null,o=i.x+i.width/2-n.width/2,h=i.y+i.height/2-n.height/2;switch(r){case cr:e={x:o,y:i.y-n.height};break;case dr:e={x:o,y:i.y+i.height};break;case pr:e={x:i.x+i.width,y:h};break;case fr:e={x:i.x-n.width,y:h};break;default:e={x:i.x,y:i.y}}var l=r?jr(r):null;if(null!=l){var u="y"===l?"height":"width";switch(a){case yr:e[l]=e[l]-(i[u]/2-n[u]/2);break;case vr:e[l]=e[l]+(i[u]/2-n[u]/2)}}return e}function da(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=void 0===n?t.placement:n,r=i.strategy,a=void 0===r?t.strategy:r,o=i.boundary,h=void 0===o?"clippingParents":o,l=i.rootBoundary,u=void 0===l?xr:l,c=i.elementContext,d=void 0===c?br:c,p=i.altBoundary,f=void 0!==p&&p,m=i.padding,g=void 0===m?0:m,y=Gr("number"!=typeof g?g:$r(g,gr)),v=d===br?"reference":br,x=t.rects.popper,b=t.elements[f?v:d],w=ua(Ar(b)?b:b.contextElement||Fr(t.elements.popper),h,u,a),_=Or(t.elements.reference),S=ca({reference:_,element:x,placement:s}),E=ha(Object.assign({},x,S)),M=d===br?E:_,A={top:w.top-M.top+y.top,bottom:M.bottom-w.bottom+y.bottom,left:w.left-M.left+y.left,right:M.right-w.right+y.right},T=t.modifiersData.offset;if(d===br&&T){var C=T[s];Object.keys(A).forEach((function(t){var e=[pr,dr].indexOf(t)>=0?1:-1,i=[cr,dr].indexOf(t)>=0?"y":"x";A[t]+=C[i]*e}))}return A}function pa(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function fa(t){return[cr,pr,dr,fr].some((function(e){return t[e]>=0}))}function ma(t,e,i){void 0===i&&(i=!1);var n,s,r=Tr(e),a=Tr(e)&&function(t){var e=t.getBoundingClientRect(),i=Pr(e.width)/t.offsetWidth||1,n=Pr(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),o=Fr(e),h=Or(t,a,i),l={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(r||!r&&!i)&&(("body"!==Er(e)||ra(o))&&(l=(n=e)!==Mr(n)&&Tr(n)?{scrollLeft:(s=n).scrollLeft,scrollTop:s.scrollTop}:na(n)),Tr(e)?((u=Or(e,!0)).x+=e.clientLeft,u.y+=e.clientTop):o&&(u.x=sa(o))),{x:h.left+l.scrollLeft-u.x,y:h.top+l.scrollTop-u.y,width:h.width,height:h.height}}function ga(t){var e=new Map,i=new Set,n=[];function s(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!i.has(t)){var n=e.get(t);n&&s(n)}})),n.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){i.has(t.name)||s(t)})),n}var ya={placement:"bottom",modifiers:[],strategy:"absolute"};function va(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return!e.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function xa(t){void 0===t&&(t={});var e=t,i=e.defaultModifiers,n=void 0===i?[]:i,s=e.defaultOptions,r=void 0===s?ya:s;return function(t,e,i){void 0===i&&(i=r);var s,a,o={placement:"bottom",orderedModifiers:[],options:Object.assign({},ya,r),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},h=[],l=!1,u={state:o,setOptions:function(i){var s="function"==typeof i?i(o.options):i;c(),o.options=Object.assign({},r,o.options,s),o.scrollParents={reference:Ar(t)?oa(t):t.contextElement?oa(t.contextElement):[],popper:oa(e)};var a,l,d=function(t){var e=ga(t);return Sr.reduce((function(t,i){return t.concat(e.filter((function(t){return t.phase===i})))}),[])}((a=[].concat(n,o.options.modifiers),l=a.reduce((function(t,e){var i=t[e.name];return t[e.name]=i?Object.assign({},i,e,{options:Object.assign({},i.options,e.options),data:Object.assign({},i.data,e.data)}):e,t}),{}),Object.keys(l).map((function(t){return l[t]}))));return o.orderedModifiers=d.filter((function(t){return t.enabled})),o.orderedModifiers.forEach((function(t){var e=t.name,i=t.options,n=void 0===i?{}:i,s=t.effect;if("function"==typeof s){var r=s({state:o,name:e,instance:u,options:n}),a=function(){};h.push(r||a)}})),u.update()},forceUpdate:function(){if(!l){var t=o.elements,e=t.reference,i=t.popper;if(va(e,i)){o.rects={reference:ma(e,qr(i),"fixed"===o.options.strategy),popper:Rr(i)},o.reset=!1,o.placement=o.options.placement,o.orderedModifiers.forEach((function(t){return o.modifiersData[t.name]=Object.assign({},t.data)}));for(var n=0;n<o.orderedModifiers.length;n++)if(!0!==o.reset){var s=o.orderedModifiers[n],r=s.fn,a=s.options,h=void 0===a?{}:a,c=s.name;"function"==typeof r&&(o=r({state:o,options:h,name:c,instance:u})||o)}else o.reset=!1,n=-1}}},update:(s=function(){return new Promise((function(t){u.forceUpdate(),t(o)}))},function(){return a||(a=new Promise((function(t){Promise.resolve().then((function(){a=void 0,t(s())}))}))),a}),destroy:function(){c(),l=!0}};if(!va(t,e))return u;function c(){h.forEach((function(t){return t()})),h=[]}return u.setOptions(i).then((function(t){!l&&i.onFirstUpdate&&i.onFirstUpdate(t)})),u}}var ba=xa({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,s=n.scroll,r=void 0===s||s,a=n.resize,o=void 0===a||a,h=Mr(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&l.forEach((function(t){t.addEventListener("scroll",i.update,Qr)})),o&&h.addEventListener("resize",i.update,Qr),function(){r&&l.forEach((function(t){t.removeEventListener("scroll",i.update,Qr)})),o&&h.removeEventListener("resize",i.update,Qr)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,i=t.name;e.modifiersData[i]=ca({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,s=void 0===n||n,r=i.adaptive,a=void 0===r||r,o=i.roundOffsets,h=void 0===o||o,l={placement:Dr(e.placement),variation:Xr(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,Jr(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:h})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,Jr(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:h})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},Ir,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.offset,r=void 0===s?[0,0]:s,a=_r.reduce((function(t,i){return t[i]=function(t,e,i){var n=Dr(t),s=[fr,cr].indexOf(n)>=0?-1:1,r="function"==typeof i?i(Object.assign({},e,{placement:t})):i,a=r[0],o=r[1];return a=a||0,o=(o||0)*s,[fr,pr].indexOf(n)>=0?{x:o,y:a}:{x:a,y:o}}(i,e.rects,r),t}),{}),o=a[e.placement],h=o.x,l=o.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=h,e.modifiersData.popperOffsets.y+=l),e.modifiersData[n]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var s=i.mainAxis,r=void 0===s||s,a=i.altAxis,o=void 0===a||a,h=i.fallbackPlacements,l=i.padding,u=i.boundary,c=i.rootBoundary,d=i.altBoundary,p=i.flipVariations,f=void 0===p||p,m=i.allowedAutoPlacements,g=e.options.placement,y=Dr(g),v=h||(y===g||!f?[ta(g)]:function(t){if(Dr(t)===mr)return[];var e=ta(t);return[ia(t),e,ia(e)]}(g)),x=[g].concat(v).reduce((function(t,i){return t.concat(Dr(i)===mr?function(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=i.boundary,r=i.rootBoundary,a=i.padding,o=i.flipVariations,h=i.allowedAutoPlacements,l=void 0===h?_r:h,u=Xr(n),c=u?o?wr:wr.filter((function(t){return Xr(t)===u})):gr,d=c.filter((function(t){return l.indexOf(t)>=0}));0===d.length&&(d=c);var p=d.reduce((function(e,i){return e[i]=da(t,{placement:i,boundary:s,rootBoundary:r,padding:a})[Dr(i)],e}),{});return Object.keys(p).sort((function(t,e){return p[t]-p[e]}))}(e,{placement:i,boundary:u,rootBoundary:c,padding:l,flipVariations:f,allowedAutoPlacements:m}):i)}),[]),b=e.rects.reference,w=e.rects.popper,_=new Map,S=!0,E=x[0],M=0;M<x.length;M++){var A=x[M],T=Dr(A),C=Xr(A)===yr,I=[cr,dr].indexOf(T)>=0,D=I?"width":"height",L=da(e,{placement:A,boundary:u,rootBoundary:c,altBoundary:d,padding:l}),B=I?C?pr:fr:C?dr:cr;b[D]>w[D]&&(B=ta(B));var P=ta(B),k=[];if(r&&k.push(L[T]<=0),o&&k.push(L[B]<=0,L[P]<=0),k.every((function(t){return t}))){E=A,S=!1;break}_.set(A,k)}if(S)for(var N=function(t){var e=x.find((function(e){var i=_.get(e);if(i)return i.slice(0,t).every((function(t){return t}))}));if(e)return E=e,"break"},O=f?3:1;O>0;O--){if("break"===N(O))break}e.placement!==E&&(e.modifiersData[n]._skip=!0,e.placement=E,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.mainAxis,r=void 0===s||s,a=i.altAxis,o=void 0!==a&&a,h=i.boundary,l=i.rootBoundary,u=i.altBoundary,c=i.padding,d=i.tether,p=void 0===d||d,f=i.tetherOffset,m=void 0===f?0:f,g=da(e,{boundary:h,rootBoundary:l,padding:c,altBoundary:u}),y=Dr(e.placement),v=Xr(e.placement),x=!v,b=jr(y),w="x"===b?"y":"x",_=e.modifiersData.popperOffsets,S=e.rects.reference,E=e.rects.popper,M="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,A="number"==typeof M?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),T=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,C={x:0,y:0};if(_){if(r){var I,D="y"===b?cr:fr,L="y"===b?dr:pr,B="y"===b?"height":"width",P=_[b],k=P+g[D],N=P-g[L],O=p?-E[B]/2:0,R=v===yr?S[B]:E[B],z=v===yr?-E[B]:-S[B],H=e.elements.arrow,W=p&&H?Rr(H):{width:0,height:0},F=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},U=F[D],V=F[L],q=Yr(0,S[B],W[B]),j=x?S[B]/2-O-q-U-A.mainAxis:R-q-U-A.mainAxis,Y=x?-S[B]/2+O+q+V+A.mainAxis:z+q+V+A.mainAxis,G=e.elements.arrow&&qr(e.elements.arrow),$=G?"y"===b?G.clientTop||0:G.clientLeft||0:0,X=null!=(I=null==T?void 0:T[b])?I:0,Z=P+Y-X,J=Yr(p?Br(k,P+j-X-$):k,P,p?Lr(N,Z):N);_[b]=J,C[b]=J-P}if(o){var Q,K="x"===b?cr:fr,tt="x"===b?dr:pr,et=_[w],it="y"===w?"height":"width",nt=et+g[K],st=et-g[tt],rt=-1!==[cr,fr].indexOf(y),at=null!=(Q=null==T?void 0:T[w])?Q:0,ot=rt?nt:et-S[it]-E[it]-at+A.altAxis,ht=rt?et+S[it]+E[it]-at-A.altAxis:st,lt=p&&rt?(ct=Yr(ot,et,ut=ht))>ut?ut:ct:Yr(p?ot:nt,et,p?ht:st);_[w]=lt,C[w]=lt-et}var ut,ct;e.modifiersData[n]=C}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,s=t.options,r=i.elements.arrow,a=i.modifiersData.popperOffsets,o=Dr(i.placement),h=jr(o),l=[fr,pr].indexOf(o)>=0?"height":"width";if(r&&a){var u=function(t,e){return Gr("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:$r(t,gr))}(s.padding,i),c=Rr(r),d="y"===h?cr:fr,p="y"===h?dr:pr,f=i.rects.reference[l]+i.rects.reference[h]-a[h]-i.rects.popper[l],m=a[h]-i.rects.reference[h],g=qr(r),y=g?"y"===h?g.clientHeight||0:g.clientWidth||0:0,v=f/2-m/2,x=u[d],b=y-c[l]-u[p],w=y/2-c[l]/2+v,_=Yr(x,w,b),S=h;i.modifiersData[n]=((e={})[S]=_,e.centerOffset=_-w,e)}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&zr(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,s=e.rects.popper,r=e.modifiersData.preventOverflow,a=da(e,{elementContext:"reference"}),o=da(e,{altBoundary:!0}),h=pa(a,n),l=pa(o,s,r),u=fa(h),c=fa(l);e.modifiersData[i]={referenceClippingOffsets:h,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:c},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":c})}}]}),wa="tippy-content",_a="tippy-arrow",Sa="tippy-svg-arrow",Ea={passive:!0,capture:!0},Ma=function(){return document.body};function Aa(t,e,i){if(Array.isArray(t)){var n=t[e];return null==n?Array.isArray(i)?i[e]:i:n}return t}function Ta(t,e){var i={}.toString.call(t);return 0===i.indexOf("[object")&&i.indexOf(e+"]")>-1}function Ca(t,e){return"function"==typeof t?t.apply(void 0,e):t}function Ia(t,e){return 0===e?t:function(n){clearTimeout(i),i=setTimeout((function(){t(n)}),e)};var i}function Da(t){return[].concat(t)}function La(t,e){-1===t.indexOf(e)&&t.push(e)}function Ba(t){return[].slice.call(t)}function Pa(t){return Object.keys(t).reduce((function(e,i){return void 0!==t[i]&&(e[i]=t[i]),e}),{})}function ka(){return document.createElement("div")}function Na(t){return["Element","Fragment"].some((function(e){return Ta(t,e)}))}function Oa(t){return Na(t)?[t]:function(t){return Ta(t,"NodeList")}(t)?Ba(t):Array.isArray(t)?t:Ba(document.querySelectorAll(t))}function Ra(t,e){t.forEach((function(t){t&&(t.style.transitionDuration=e+"ms")}))}function za(t,e){t.forEach((function(t){t&&t.setAttribute("data-state",e)}))}function Ha(t,e,i){var n=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(e){t[n](e,i)}))}function Wa(t,e){for(var i=e;i;){var n;if(t.contains(i))return!0;i=null==i.getRootNode||null==(n=i.getRootNode())?void 0:n.host}return!1}var Fa={isTouch:!1},Ua=0;function Va(){Fa.isTouch||(Fa.isTouch=!0,window.performance&&document.addEventListener("mousemove",qa))}function qa(){var t=performance.now();t-Ua<20&&(Fa.isTouch=!1,document.removeEventListener("mousemove",qa)),Ua=t}function ja(){var t,e=document.activeElement;if((t=e)&&t._tippy&&t._tippy.reference===t){var i=e._tippy;e.blur&&!i.state.isVisible&&e.blur()}}var Ya,Ga=!!("undefined"!=typeof window&&"undefined"!=typeof document)&&!!window.msCrypto;function $a(t){return[t+"() was called on a"+("destroy"===t?"n already-":" ")+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Xa(t){return t.replace(/[ \t]{2,}/g," ").replace(/^[ \t]*/gm,"").trim()}function Za(t){return Xa("\n %ctippy.js\n\n %c"+Xa(t)+"\n\n %c👷 This is a development-only message. It will be removed in production.\n ")}function Ja(t){return[Za(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}function Qa(t,e){var i;t&&!Ya.has(e)&&(Ya.add(e),(i=console).warn.apply(i,Ja(e)))}function Ka(t,e){var i;t&&!Ya.has(e)&&(Ya.add(e),(i=console).error.apply(i,Ja(e)))}"production"!==process.env.NODE_ENV&&(Ya=new Set);var to={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},eo=Object.assign({appendTo:Ma,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},to,{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),io=Object.keys(eo);function no(t){var e=(t.plugins||[]).reduce((function(e,i){var n,s=i.name,r=i.defaultValue;s&&(e[s]=void 0!==t[s]?t[s]:null!=(n=eo[s])?n:r);return e}),{});return Object.assign({},t,e)}function so(t,e){var i=Object.assign({},e,{content:Ca(e.content,[t])},e.ignoreAttributes?{}:function(t,e){return(e?Object.keys(no(Object.assign({},eo,{plugins:e}))):io).reduce((function(e,i){var n=(t.getAttribute("data-tippy-"+i)||"").trim();if(!n)return e;if("content"===i)e[i]=n;else try{e[i]=JSON.parse(n)}catch(t){e[i]=n}return e}),{})}(t,e.plugins));return i.aria=Object.assign({},eo.aria,i.aria),i.aria={expanded:"auto"===i.aria.expanded?e.interactive:i.aria.expanded,content:"auto"===i.aria.content?e.interactive?null:"describedby":i.aria.content},i}function ro(t,e){void 0===t&&(t={}),void 0===e&&(e=[]),Object.keys(t).forEach((function(t){var i,n,s=function(t,e){var i=Object.assign({},t);return e.forEach((function(t){delete i[t]})),i}(eo,Object.keys(to)),r=(i=s,n=t,!{}.hasOwnProperty.call(i,n));r&&(r=0===e.filter((function(e){return e.name===t})).length),Qa(r,["`"+t+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.","\n\n","All props: https://atomiks.github.io/tippyjs/v6/all-props/\n","Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))}))}function ao(t,e){t.innerHTML=e}function oo(t){var e=ka();return!0===t?e.className=_a:(e.className=Sa,Na(t)?e.appendChild(t):ao(e,t)),e}function ho(t,e){Na(e.content)?(ao(t,""),t.appendChild(e.content)):"function"!=typeof e.content&&(e.allowHTML?ao(t,e.content):t.textContent=e.content)}function lo(t){var e=t.firstElementChild,i=Ba(e.children);return{box:e,content:i.find((function(t){return t.classList.contains(wa)})),arrow:i.find((function(t){return t.classList.contains(_a)||t.classList.contains(Sa)})),backdrop:i.find((function(t){return t.classList.contains("tippy-backdrop")}))}}function uo(t){var e=ka(),i=ka();i.className="tippy-box",i.setAttribute("data-state","hidden"),i.setAttribute("tabindex","-1");var n=ka();function s(i,n){var s=lo(e),r=s.box,a=s.content,o=s.arrow;n.theme?r.setAttribute("data-theme",n.theme):r.removeAttribute("data-theme"),"string"==typeof n.animation?r.setAttribute("data-animation",n.animation):r.removeAttribute("data-animation"),n.inertia?r.setAttribute("data-inertia",""):r.removeAttribute("data-inertia"),r.style.maxWidth="number"==typeof n.maxWidth?n.maxWidth+"px":n.maxWidth,n.role?r.setAttribute("role",n.role):r.removeAttribute("role"),i.content===n.content&&i.allowHTML===n.allowHTML||ho(a,t.props),n.arrow?o?i.arrow!==n.arrow&&(r.removeChild(o),r.appendChild(oo(n.arrow))):r.appendChild(oo(n.arrow)):o&&r.removeChild(o)}return n.className=wa,n.setAttribute("data-state","hidden"),ho(n,t.props),e.appendChild(i),i.appendChild(n),s(t.props,t.props),{popper:e,onUpdate:s}}uo.$$tippy=!0;var co=1,po=[],fo=[];function mo(t,e){var i,n,s,r,a,o,h,l,u=so(t,Object.assign({},eo,no(Pa(e)))),c=!1,d=!1,p=!1,f=!1,m=[],g=Ia(G,u.interactiveDebounce),y=co++,v=(l=u.plugins).filter((function(t,e){return l.indexOf(t)===e})),x={id:y,reference:t,popper:ka(),popperInstance:null,props:u,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:v,clearDelayTimeouts:function(){clearTimeout(i),clearTimeout(n),cancelAnimationFrame(s)},setProps:function(e){"production"!==process.env.NODE_ENV&&Qa(x.state.isDestroyed,$a("setProps"));if(x.state.isDestroyed)return;P("onBeforeUpdate",[x,e]),j();var i=x.props,n=so(t,Object.assign({},i,Pa(e),{ignoreAttributes:!0}));x.props=n,q(),i.interactiveDebounce!==n.interactiveDebounce&&(O(),g=Ia(G,n.interactiveDebounce));i.triggerTarget&&!n.triggerTarget?Da(i.triggerTarget).forEach((function(t){t.removeAttribute("aria-expanded")})):n.triggerTarget&&t.removeAttribute("aria-expanded");N(),B(),_&&_(i,n);x.popperInstance&&(J(),K().forEach((function(t){requestAnimationFrame(t._tippy.popperInstance.forceUpdate)})));P("onAfterUpdate",[x,e])},setContent:function(t){x.setProps({content:t})},show:function(){"production"!==process.env.NODE_ENV&&Qa(x.state.isDestroyed,$a("show"));var t=x.state.isVisible,e=x.state.isDestroyed,i=!x.state.isEnabled,n=Fa.isTouch&&!x.props.touch,s=Aa(x.props.duration,0,eo.duration);if(t||e||i||n)return;if(C().hasAttribute("disabled"))return;if(P("onShow",[x],!1),!1===x.props.onShow(x))return;x.state.isVisible=!0,T()&&(w.style.visibility="visible");B(),W(),x.state.isMounted||(w.style.transition="none");if(T()){var r=D();Ra([r.box,r.content],0)}o=function(){var t;if(x.state.isVisible&&!f){if(f=!0,w.offsetHeight,w.style.transition=x.props.moveTransition,T()&&x.props.animation){var e=D(),i=e.box,n=e.content;Ra([i,n],s),za([i,n],"visible")}k(),N(),La(fo,x),null==(t=x.popperInstance)||t.forceUpdate(),P("onMount",[x]),x.props.animation&&T()&&function(t,e){U(t,e)}(s,(function(){x.state.isShown=!0,P("onShown",[x])}))}},function(){var t,e=x.props.appendTo,i=C();t=x.props.interactive&&e===Ma||"parent"===e?i.parentNode:Ca(e,[i]);t.contains(w)||t.appendChild(w);x.state.isMounted=!0,J(),"production"!==process.env.NODE_ENV&&Qa(x.props.interactive&&e===eo.appendTo&&i.nextElementSibling!==w,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.","\n\n","Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.","\n\n","Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.","\n\n","See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}()},hide:function(){"production"!==process.env.NODE_ENV&&Qa(x.state.isDestroyed,$a("hide"));var t=!x.state.isVisible,e=x.state.isDestroyed,i=!x.state.isEnabled,n=Aa(x.props.duration,1,eo.duration);if(t||e||i)return;if(P("onHide",[x],!1),!1===x.props.onHide(x))return;x.state.isVisible=!1,x.state.isShown=!1,f=!1,c=!1,T()&&(w.style.visibility="hidden");if(O(),F(),B(!0),T()){var s=D(),r=s.box,a=s.content;x.props.animation&&(Ra([r,a],n),za([r,a],"hidden"))}k(),N(),x.props.animation?T()&&function(t,e){U(t,(function(){!x.state.isVisible&&w.parentNode&&w.parentNode.contains(w)&&e()}))}(n,x.unmount):x.unmount()},hideWithInteractivity:function(t){"production"!==process.env.NODE_ENV&&Qa(x.state.isDestroyed,$a("hideWithInteractivity"));I().addEventListener("mousemove",g),La(po,g),g(t)},enable:function(){x.state.isEnabled=!0},disable:function(){x.hide(),x.state.isEnabled=!1},unmount:function(){"production"!==process.env.NODE_ENV&&Qa(x.state.isDestroyed,$a("unmount"));x.state.isVisible&&x.hide();if(!x.state.isMounted)return;Q(),K().forEach((function(t){t._tippy.unmount()})),w.parentNode&&w.parentNode.removeChild(w);fo=fo.filter((function(t){return t!==x})),x.state.isMounted=!1,P("onHidden",[x])},destroy:function(){"production"!==process.env.NODE_ENV&&Qa(x.state.isDestroyed,$a("destroy"));if(x.state.isDestroyed)return;x.clearDelayTimeouts(),x.unmount(),j(),delete t._tippy,x.state.isDestroyed=!0,P("onDestroy",[x])}};if(!u.render)return"production"!==process.env.NODE_ENV&&Ka(!0,"render() function has not been supplied."),x;var b=u.render(x),w=b.popper,_=b.onUpdate;w.setAttribute("data-tippy-root",""),w.id="tippy-"+x.id,x.popper=w,t._tippy=x,w._tippy=x;var S=v.map((function(t){return t.fn(x)})),E=t.hasAttribute("aria-expanded");return q(),N(),B(),P("onCreate",[x]),u.showOnCreate&&tt(),w.addEventListener("mouseenter",(function(){x.props.interactive&&x.state.isVisible&&x.clearDelayTimeouts()})),w.addEventListener("mouseleave",(function(){x.props.interactive&&x.props.trigger.indexOf("mouseenter")>=0&&I().addEventListener("mousemove",g)})),x;function M(){var t=x.props.touch;return Array.isArray(t)?t:[t,0]}function A(){return"hold"===M()[0]}function T(){var t;return!(null==(t=x.props.render)||!t.$$tippy)}function C(){return h||t}function I(){var t,e,i=C().parentNode;return i?null!=(e=Da(i)[0])&&null!=(t=e.ownerDocument)&&t.body?e.ownerDocument:document:document}function D(){return lo(w)}function L(t){return x.state.isMounted&&!x.state.isVisible||Fa.isTouch||r&&"focus"===r.type?0:Aa(x.props.delay,t?0:1,eo.delay)}function B(t){void 0===t&&(t=!1),w.style.pointerEvents=x.props.interactive&&!t?"":"none",w.style.zIndex=""+x.props.zIndex}function P(t,e,i){var n;(void 0===i&&(i=!0),S.forEach((function(i){i[t]&&i[t].apply(i,e)})),i)&&(n=x.props)[t].apply(n,e)}function k(){var e=x.props.aria;if(e.content){var i="aria-"+e.content,n=w.id;Da(x.props.triggerTarget||t).forEach((function(t){var e=t.getAttribute(i);if(x.state.isVisible)t.setAttribute(i,e?e+" "+n:n);else{var s=e&&e.replace(n,"").trim();s?t.setAttribute(i,s):t.removeAttribute(i)}}))}}function N(){!E&&x.props.aria.expanded&&Da(x.props.triggerTarget||t).forEach((function(t){x.props.interactive?t.setAttribute("aria-expanded",x.state.isVisible&&t===C()?"true":"false"):t.removeAttribute("aria-expanded")}))}function O(){I().removeEventListener("mousemove",g),po=po.filter((function(t){return t!==g}))}function R(e){if(!Fa.isTouch||!p&&"mousedown"!==e.type){var i=e.composedPath&&e.composedPath()[0]||e.target;if(!x.props.interactive||!Wa(w,i)){if(Da(x.props.triggerTarget||t).some((function(t){return Wa(t,i)}))){if(Fa.isTouch)return;if(x.state.isVisible&&x.props.trigger.indexOf("click")>=0)return}else P("onClickOutside",[x,e]);!0===x.props.hideOnClick&&(x.clearDelayTimeouts(),x.hide(),d=!0,setTimeout((function(){d=!1})),x.state.isMounted||F())}}}function z(){p=!0}function H(){p=!1}function W(){var t=I();t.addEventListener("mousedown",R,!0),t.addEventListener("touchend",R,Ea),t.addEventListener("touchstart",H,Ea),t.addEventListener("touchmove",z,Ea)}function F(){var t=I();t.removeEventListener("mousedown",R,!0),t.removeEventListener("touchend",R,Ea),t.removeEventListener("touchstart",H,Ea),t.removeEventListener("touchmove",z,Ea)}function U(t,e){var i=D().box;function n(t){t.target===i&&(Ha(i,"remove",n),e())}if(0===t)return e();Ha(i,"remove",a),Ha(i,"add",n),a=n}function V(e,i,n){void 0===n&&(n=!1),Da(x.props.triggerTarget||t).forEach((function(t){t.addEventListener(e,i,n),m.push({node:t,eventType:e,handler:i,options:n})}))}function q(){var t;A()&&(V("touchstart",Y,{passive:!0}),V("touchend",$,{passive:!0})),(t=x.props.trigger,t.split(/\s+/).filter(Boolean)).forEach((function(t){if("manual"!==t)switch(V(t,Y),t){case"mouseenter":V("mouseleave",$);break;case"focus":V(Ga?"focusout":"blur",X);break;case"focusin":V("focusout",X)}}))}function j(){m.forEach((function(t){var e=t.node,i=t.eventType,n=t.handler,s=t.options;e.removeEventListener(i,n,s)})),m=[]}function Y(t){var e,i=!1;if(x.state.isEnabled&&!Z(t)&&!d){var n="focus"===(null==(e=r)?void 0:e.type);r=t,h=t.currentTarget,N(),!x.state.isVisible&&Ta(t,"MouseEvent")&&po.forEach((function(e){return e(t)})),"click"===t.type&&(x.props.trigger.indexOf("mouseenter")<0||c)&&!1!==x.props.hideOnClick&&x.state.isVisible?i=!0:tt(t),"click"===t.type&&(c=!i),i&&!n&&et(t)}}function G(t){var e=t.target,i=C().contains(e)||w.contains(e);"mousemove"===t.type&&i||function(t,e){var i=e.clientX,n=e.clientY;return t.every((function(t){var e=t.popperRect,s=t.popperState,r=t.props.interactiveBorder,a=s.placement.split("-")[0],o=s.modifiersData.offset;if(!o)return!0;var h="bottom"===a?o.top.y:0,l="top"===a?o.bottom.y:0,u="right"===a?o.left.x:0,c="left"===a?o.right.x:0,d=e.top-n+h>r,p=n-e.bottom-l>r,f=e.left-i+u>r,m=i-e.right-c>r;return d||p||f||m}))}(K().concat(w).map((function(t){var e,i=null==(e=t._tippy.popperInstance)?void 0:e.state;return i?{popperRect:t.getBoundingClientRect(),popperState:i,props:u}:null})).filter(Boolean),t)&&(O(),et(t))}function $(t){Z(t)||x.props.trigger.indexOf("click")>=0&&c||(x.props.interactive?x.hideWithInteractivity(t):et(t))}function X(t){x.props.trigger.indexOf("focusin")<0&&t.target!==C()||x.props.interactive&&t.relatedTarget&&w.contains(t.relatedTarget)||et(t)}function Z(t){return!!Fa.isTouch&&A()!==t.type.indexOf("touch")>=0}function J(){Q();var e=x.props,i=e.popperOptions,n=e.placement,s=e.offset,r=e.getReferenceClientRect,a=e.moveTransition,h=T()?lo(w).arrow:null,l=r?{getBoundingClientRect:r,contextElement:r.contextElement||C()}:t,u=[{name:"offset",options:{offset:s}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!a}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(t){var e=t.state;if(T()){var i=D().box;["placement","reference-hidden","escaped"].forEach((function(t){"placement"===t?i.setAttribute("data-placement",e.placement):e.attributes.popper["data-popper-"+t]?i.setAttribute("data-"+t,""):i.removeAttribute("data-"+t)})),e.attributes.popper={}}}}];T()&&h&&u.push({name:"arrow",options:{element:h,padding:3}}),u.push.apply(u,(null==i?void 0:i.modifiers)||[]),x.popperInstance=ba(l,w,Object.assign({},i,{placement:n,onFirstUpdate:o,modifiers:u}))}function Q(){x.popperInstance&&(x.popperInstance.destroy(),x.popperInstance=null)}function K(){return Ba(w.querySelectorAll("[data-tippy-root]"))}function tt(t){x.clearDelayTimeouts(),t&&P("onTrigger",[x,t]),W();var e=L(!0),n=M(),s=n[0],r=n[1];Fa.isTouch&&"hold"===s&&r&&(e=r),e?i=setTimeout((function(){x.show()}),e):x.show()}function et(t){if(x.clearDelayTimeouts(),P("onUntrigger",[x,t]),x.state.isVisible){if(!(x.props.trigger.indexOf("mouseenter")>=0&&x.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(t.type)>=0&&c)){var e=L(!1);e?n=setTimeout((function(){x.state.isVisible&&x.hide()}),e):s=requestAnimationFrame((function(){x.hide()}))}}else F()}}function go(t,e){void 0===e&&(e={});var i=eo.plugins.concat(e.plugins||[]);"production"!==process.env.NODE_ENV&&(!function(t){var e=!t,i="[object Object]"===Object.prototype.toString.call(t)&&!t.addEventListener;Ka(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Ka(i,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}(t),ro(e,i)),document.addEventListener("touchstart",Va,Ea),window.addEventListener("blur",ja);var n=Object.assign({},e,{plugins:i}),s=Oa(t);if("production"!==process.env.NODE_ENV){var r=Na(n.content),a=s.length>1;Qa(r&&a,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.","\n\n","Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.","\n\n","1) content: element.innerHTML\n","2) content: () => element.cloneNode(true)"].join(" "))}var o=s.reduce((function(t,e){var i=e&&mo(e,n);return i&&t.push(i),t}),[]);return Na(t)?o[0]:o}go.defaultProps=eo,go.setDefaultProps=function(t){"production"!==process.env.NODE_ENV&&ro(t,[]),Object.keys(t).forEach((function(e){eo[e]=t[e]}))},go.currentInput=Fa,Object.assign({},Ir,{effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow)}}),go.setDefaultProps({render:uo});let yo=0;const vo=go(document.body,{theme:"translucent",animation:"scale",inertia:!0,delay:[200,100],content:"",allowHTML:!0,placement:"left-start",trigger:"manual",arrow:!0});class xo{constructor(t,e){c(this,"name","Label"),c(this,"id","Label"+yo++),c(this,"el"),c(this,"position",new We),this.container=t,this.text=e,this.container=t||document.getElementsByTagName("body")[0],this.text=e}get isMounted(){return vo.state.isMounted}get isShown(){return vo.state.isShown}destroy(){this.text="",this.position.identity()}setHtml(t=""){return this.text=t,this}update(t){t&&(this.position.copy(t),vo.show())}show(t){return d(this,null,(function*(){if(t)return yield this.hide(),this.position.copy(t),vo.setContent(this.text),vo.setProps({getReferenceClientRect:()=>({width:0,height:0,right:this.position.x,left:this.position.x,bottom:this.position.y,top:this.position.y,x:this.position.x,y:this.position.y,toJSON(){}})}),vo.clearDelayTimeouts(),vo.show(),new Promise((t=>{ri.delay((function(){t()}),300)}))}))}hide(){return d(this,null,(function*(){return vo.hide(),new Promise((t=>{ri.delay((function(){t()}),100)}))}))}}let bo=0;class wo extends Fi{constructor(t,e){var i,n;super(),c(this,"name","DummyPoint"),c(this,"id","dummyPoint"+bo++),c(this,"container"),c(this,"offset",new We),c(this,"el"),c(this,"label"),c(this,"radius",10),c(this,"position",new We),c(this,"worldPosition",new We),c(this,"userData"),this.container=t||document.getElementsByTagName("body")[0];let s=this.container.getBoundingClientRect();this.offset.set(s.left,s.top),this.userData=e,(null==(i=this.userData)?void 0:i.type)||ri.set(this,"userData.type",lr.DEFAULT),this.initDom(),this.setType(null==(n=this.userData)?void 0:n.type),this.mount(),this.initLabel()}destroy(){var t;super.destroy(),this.unmount(),null==(t=this.label)||t.destroy()}get isMounted(){var t;return!!(null==(t=this.el)?void 0:t.parentNode)}mount(){var t;this.el&&((null==(t=this.el)?void 0:t.parentNode)||this.container.appendChild(this.el))}unmount(){var t,e,i,n;null==(e=null==(t=this.el)?void 0:t.parentNode)||e.removeChild(this.el),null==(i=this.el)||i.remove(),null==(n=this.label)||n.hide()}setText(t=""){return this.el?(this.el.innerText=t,this):this}initDom(){var t;this.el=document.createElement("div"),this.el.setAttribute("id",this.id),this.el.setAttribute("class","dummy-point"),this.el.setAttribute("ae-id",null==(t=this.userData)?void 0:t.value)}initLabel(){var t;(null==(t=this.userData)?void 0:t.label)&&(this.label=new xo(this.container,this.userData.label))}setActive(t){return t?(Us(this.el,"active"),this.showLabel()):(Vs(this.el,"active"),this.hideLabel()),this}showLabel(){var t;null==(t=this.label)||t.show(_o.copy(this.position).add(this.offset).subScalar(this.radius))}hideLabel(){var t;null==(t=this.label)||t.hide()}setType(t){var e;if(!this.userData)return this;const i=null==(e=this.userData)?void 0:e.type;return t||(t=lr.DEFAULT),i&&Fs(this.el,i)&&Vs(this.el,i),this.userData.type=t,Us(this.el,this.userData.type),this}update(t,e=!1){t&&this.isMounted&&(e||t.subScalar(this.radius).round(),this.position.copy(t),this.el.style.transform=`translate3D(${this.position.x}px, ${this.position.y}px, 0)`)}}const _o=new We;let So=0;class Eo extends Fi{constructor(t,e){super(),c(this,"name","DummyRect"),c(this,"id","dummyRect"+So++),c(this,"container"),c(this,"offset",new We),c(this,"el"),c(this,"radius",10),c(this,"position",new We),c(this,"worldPosition",new We),c(this,"label"),c(this,"userData"),this.container=t||document.getElementsByTagName("body")[0];let i=this.container.getBoundingClientRect();this.offset.set(i.left,i.top),this.userData=e,this.initDom(),this.mount(),this.initLabel()}destroy(){var t;super.destroy(),this.unmount(),null==(t=this.label)||t.destroy()}get isMounted(){var t;return!!(null==(t=this.el)?void 0:t.parentNode)}mount(){this.container.appendChild(this.el)}unmount(){var t,e,i,n;this.setText(""),null==(e=null==(t=this.el)?void 0:t.parentNode)||e.removeChild(this.el),null==(i=this.el)||i.remove(),null==(n=this.label)||n.hide()}initDom(){var t;this.el=document.createElement("div"),this.el.setAttribute("id",this.id),this.el.setAttribute("class","dummy-rect"),this.el.setAttribute("ae-id",(null==(t=this.userData)?void 0:t.rmId)||"undefined")}initLabel(){this.label=new xo(this.container,"")}setText(t=""){return this.el.innerText=t,this}setActive(t){return t?Us(this.el,"active"):Vs(this.el,"active"),this}showLabel(){var t;null==(t=this.label)||t.show(Mo.copy(this.position).add(this.offset).subScalar(this.radius))}hideLabel(){var t;null==(t=this.label)||t.hide()}setType(t){var e;if(!this.userData)return this;const i=null==(e=this.userData)?void 0:e.type;return t=lr.DEFAULT,i&&Fs(this.el,i)&&Vs(this.el,i),this.userData.type=t,Us(this.el,this.userData.type),this}update(t,e=!1){t&&this.isMounted&&(e||t.subScalar(this.radius).round(),this.position.copy(t),this.el.style.transform=`translate3D(${this.position.x}px, ${this.position.y}px, 0)`)}}const Mo=new We;class Ao extends Fi{constructor(t,e){super(),c(this,"name","Dummies"),c(this,"container"),c(this,"controller"),c(this,"scene"),c(this,"viewMatrix",new Ui),c(this,"dummies",[]),c(this,"rmMap",new Map),c(this,"mergedMap",new Map),c(this,"cameraUpdateHandler",this.handleCameraUpdate.bind(this)),c(this,"controllerTapHandler",this.handleControllerTap.bind(this)),this.container=t,this.controller=e,this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.clearDummies()}bindEvents(){this.controller.camera.addEventListener(er.UPDATE,this.cameraUpdateHandler),this.controller.addEventListener(Qs.TAP,this.controllerTapHandler)}unbindEvents(){this.controller.camera.removeEventListener(er.UPDATE,this.cameraUpdateHandler),this.controller.removeEventListener(Qs.TAP,this.controllerTapHandler)}bindScene(t){this.scene=t}update(t){var e,i,n;if(t){this.viewMatrix.copy(t);for(let t=0,s=(this.dummies||[]).length;t<s;t++){const s=this.dummies[t],r=null==(i=this.scene)?void 0:i.getElementById(null==(e=s.userData)?void 0:e.rmId);if(r){const t=null==(n=this.scene)?void 0:n.chef.getElementBoundingBox(r.id);null==t||t.getCenter(To),To.applyMatrix3(this.viewMatrix).round(),s.position.copy(To)}else To.copy(s.worldPosition).applyMatrix3(this.viewMatrix).round(),s.update(To)}this.mergeDummies()}}setDummies(t){this.clearDummies();for(let e=0,i=(t||[]).length;e<i;e++)this.addDummy(t[e])}addDummy(t){var e,i;const n=new wo(this.container,t);this.dummies.push(n);const s=null==(e=n.userData)?void 0:e.rmId;return s&&(this.rmMap.has(s)||this.rmMap.set(s,[]),null==(i=this.rmMap.get(s))||i.push(n)),n}removeDummy(t){var e;const i=this.dummies.indexOf(t);i>-1&&this.dummies.splice(i,1);const n=null==(e=t.userData)?void 0:e.rmId;if(n){const e=this.mergedMap.get(n);null==e||e.destroy(),this.mergedMap.delete(n);const i=this.rmMap.get(n);if(!i)return;if(1===i.length)this.rmMap.delete(n);else{const e=i.indexOf(t);e>-1&&(i.splice(e,1),this.rmMap.set(n,i))}}t.destroy()}clearDummies(t){var e,i,n;for(let s=((null==(e=this.dummies)?void 0:e.length)||0)-1;s>=0;s--){const e=this.dummies[s];(!t||(null==(i=null==e?void 0:e.userData)?void 0:i.type)&&(null==t?void 0:t.includes(null==(n=e.userData)?void 0:n.type)))&&this.removeDummy(e)}t||(this.dummies.length=0,this.mergedMap.clear(),this.rmMap.clear())}mergeDummies(){this.rmMap.forEach(((t,e)=>{var i,n,s,r;if(null==(i=this.scene)?void 0:i.getElementById(e)){const i=null==(n=this.scene)?void 0:n.chef.getElementBoundingBox(e);if(!i)return;Co.copy(i).applyMatrix3(this.viewMatrix).round(),Co.getSize(To);const a=t[0].radius,o=Co.centralArrange(t.length,2*a,2*a);if(To.x<3*a||To.y<3*a){t.forEach((t=>t.unmount()));const i=this.mergedMap.get(e);null==i||i.unmount()}else if(Array.isArray(o))this.mergedMap.has(e)&&(null==(s=this.mergedMap.get(e))||s.unmount()),t.forEach(((t,e)=>{t.isMounted||t.mount(),t.update(o[e])}));else{t.forEach((t=>t.unmount()));let i=this.mergedMap.get(e);if(i)i.isMounted||i.mount();else{const n=ri.cloneDeep(t[0].userData)||{},s=ri.reduce(t,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.label)&&t.push(null==(n=e.userData)?void 0:n.label),t}),[]);n.label=s.join(", ");const r=ri.reduce(t,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.value)&&t.push(null==(n=e.userData)?void 0:n.value),t}),[]);n.value=r.join(","),n.rmId=e,i=new Eo(this.container,n),this.mergedMap.set(e,i)}i.setText(t.length.toString());const n=ri.reduce(t,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.label)&&t.push(null==(n=e.userData)?void 0:n.label),t}),[]);null==(r=i.label)||r.setHtml(n.join(", <br />")),i.update(t[0].position)}}}))}getDummyById(t){return this.dummies.find((e=>{var i;return(null==(i=e.userData)?void 0:i.value)===t}))}setActiveByIds(t){var e,i;if(this.resetActives(),t&&(Array.isArray(t)||(t=[t]),null==t?void 0:t.length))for(let n=0,s=t.length;n<s;n++){const s=this.getDummyById(t[n]);if(s&&s.setActive(!0),s&&(null==(e=s.userData)?void 0:e.rmId)){const t=this.mergedMap.get(null==(i=s.userData)?void 0:i.rmId);t&&t.setActive(!0)}}}resetActives(){this.dummies.forEach((t=>t.setActive(!1))),this.mergedMap.forEach((t=>t.setActive(!1)))}showDummyLabel(t){if(!t)return;const e=this.getDummyById(t);e&&e.showLabel();const i=this.mergedMap.get(t);i&&i.showLabel()}hideDummyLabel(){return d(this,null,(function*(){this.dummies.forEach((t=>t.hideLabel())),this.mergedMap.forEach((t=>t.hideLabel()))}))}handleCameraUpdate(){this.update(this.controller.camera.viewMatrix)}handleControllerTap(t){var e,i,n,s,r;if((null==t?void 0:t.type)!==Qs.TAP)return;const a=(null==(e=null==t?void 0:t.e)?void 0:e.target)||(null==(n=null==(i=null==t?void 0:t.e)?void 0:i.srcEvent)?void 0:n.target)||(null==(r=null==(s=null==t?void 0:t.e)?void 0:s.srcEvent)?void 0:r.srcElement);null==a||a.getAttribute("ae-id")}}const To=new We,Co=new ai;window[$s.prefixed(window,"requestAnimationFrame")];class Io extends Fi{constructor(t,e,i=!0){super(),c(this,"name","DragController"),c(this,"dragFake",!1),c(this,"container"),c(this,"offset",new We),c(this,"controller"),c(this,"scene"),c(this,"raycaster"),c(this,"dummies"),c(this,"_els",[]),c(this,"_hms",new Map),c(this,"_vos",new Map),c(this,"_elMap",new Map),c(this,"_panType",lr.SUCCESS),c(this,"onPanHandler",this.handleOnPan.bind(this)),c(this,"panEndHandler",ri.debounce(this.handlePanEnd.bind(this),500)),this.container=t;let n=this.container.getBoundingClientRect();this.offset.set(n.left,n.top),this.controller=e,this.dummies=new Ao(t,e),this.raycaster=new ur,this.dragFake=i}destroy(){var t;super.destroy();for(let e=((null==(t=this._els)?void 0:t.length)||0)-1;e>=0;e--)this.drop(this._els[e]);this.dummies.destroy()}bindScene(t){var e;this.scene=t,null==(e=this.dummies)||e.bindScene(t)}drag(t,e){t&&(this._els.includes(t)||(this.bindEvent(t),this._els.push(t),this._vos.set(t,e)))}drop(t){if(!t)return;this.unbindEvent(t),this._vos.delete(t),this._elMap.delete(t);const e=this._els.findIndex((e=>e===t));e>-1&&this._els.splice(e,1)}bindEvent(t){if(!t)return;const e=new $s.Manager(t,{domEvents:!0});e.add(new $s.Pan({threshold:0,pointers:0})),e.on(["panstart","panmove","panend"].join(" "),this.onPanHandler),this._hms.set(t,e)}unbindEvent(t){if(!t)return;const e=this._hms.get(t);e&&(e.off(["panstart","panmove","panend"].join(" "),this.onPanHandler),e.destroy(),this._hms.delete(t))}handleOnPan(t){if("function"==typeof t.preventDefault&&t.preventDefault(),"function"==typeof t.srcEvent.stopPropagation&&t.srcEvent.stopPropagation(),"function"==typeof t.srcEvent.stopImmediatePropagation&&t.srcEvent.stopImmediatePropagation(),!this.controller)return;"panstart"===t.type||t.isFirst?this.controller.enablePan=!1:"panmove"===t.type||"panend"===t.type&&(this.controller.enablePan=!0);const e=this._vos.get(t.target);if(!e)return;const i=ri.cloneDeep(e);i.type=this._panType;const n=this._getDummy(t.target,i);Do.set(t.center.x,t.center.y).sub(this.offset),n.worldPosition.copy(Do).unproject(this.controller.camera),n.update(Do),this.panEndHandler({type:"panend",e:t})}handlePanEnd(t){if("panend"!==(null==t?void 0:t.type))return;const e=this.getDummies(!0);this.dispatchEvent({type:"panend",data:e})}getDummies(t=!0){const e=[];return this._els.forEach((i=>{var n;let s=this._vos.get(i);if(s&&s.type===lr.SUCCESS){if(t){const t=this._elMap.get(i);if(!t)return;if(!this.controller.camera)return;Do.copy(t.position),this.raycaster.setFromCamera(Do,this.controller.camera);const e=[];if(null==(n=this.scene)||n.getIntersectObjects(this.raycaster,Li.RM,e),!(null==e?void 0:e.length))return;s=ri.cloneDeep(s),s.rmId=e[0].id}e.push(s)}})),e}setDummiesByVos(t){var e,i;for(let i=0,n=(t||[]).length;i<n;i++){const n=null==(e=this.dummies)?void 0:e.addDummy(t[i]);if(!n)continue;const s=ri.cloneDeep(t[i]);delete s.rmId,delete s.wsId,this.drag(n.el,s)}null==(i=this.dummies)||i.update(this.controller.camera.viewMatrix)}clearDummies(t){var e,i;for(let i=((null==(e=this._els)?void 0:e.length)||0)-1;i>=0;i--){const e=this._vos.get(this._els[i]);(!t||t&&(null==e?void 0:e.type)&&t.includes(e.type))&&this.drop(this._els[i])}null==(i=this.dummies)||i.clearDummies(t)}getDummyById(t){return this.dummies.getDummyById(t)}highlightDummies(t){var e;null==(e=this.dummies)||e.setActiveByIds(t)}resetHighlightDummies(){var t;null==(t=this.dummies)||t.resetActives()}showDummyLabel(t){var e;null==(e=this.dummies)||e.showDummyLabel(t)}start(){}_getDummy(t,e){let i=this._elMap.get(t);if(i||(i=this.dummies.addDummy(e).setType(lr.SUCCESS),this._elMap.set(t,i)),i.isMounted||i.mount(),this.dummies.dummies.includes(i)||this.dummies.dummies.push(i),!this._elMap.get(i.el)){this._elMap.set(i.el,i);const t=ri.cloneDeep(e);delete t.rmId,delete t.wsId,this.drag(i.el,t)}return i}}const Do=new We;var Lo=Object.freeze({Linear:Object.freeze({None:function(t){return t},In:function(t){return t},Out:function(t){return t},InOut:function(t){return t}}),Quadratic:Object.freeze({In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}}),Cubic:Object.freeze({In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}}),Quartic:Object.freeze({In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}}),Quintic:Object.freeze({In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}}),Sinusoidal:Object.freeze({In:function(t){return 1-Math.sin((1-t)*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.sin(Math.PI*(.5-t)))}}),Exponential:Object.freeze({In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}}),Circular:Object.freeze({In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}}),Elastic:Object.freeze({In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}}),Back:Object.freeze({In:function(t){var e=1.70158;return 1===t?1:t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return 0===t?0:--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}}),Bounce:Object.freeze({In:function(t){return 1-Lo.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*Lo.Bounce.In(2*t):.5*Lo.Bounce.Out(2*t-1)+.5}}),generatePow:function(t){return void 0===t&&(t=4),t=(t=t<Number.EPSILON?Number.EPSILON:t)>1e4?1e4:t,{In:function(e){return Math.pow(e,t)},Out:function(e){return 1-Math.pow(1-e,t)},InOut:function(e){return e<.5?Math.pow(2*e,t)/2:(1-Math.pow(2-2*e,t))/2+.5}}}}),Bo=function(){return performance.now()},Po=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return t.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map((function(e){return t._tweens[e]}))},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];for(var n=0,s=e;n<s.length;n++){var r=s[n];null===(t=r._group)||void 0===t||t.remove(r),r._group=this,this._tweens[r.getId()]=r,this._tweensAddedDuringUpdate[r.getId()]=r}},t.prototype.remove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=0,n=t;i<n.length;i++){var s=n[i];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},t.prototype.allStopped=function(){return this.getAll().every((function(t){return!t.isPlaying()}))},t.prototype.update=function(t,e){void 0===t&&(t=Bo()),void 0===e&&(e=!0);var i=Object.keys(this._tweens);if(0!==i.length)for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<i.length;n++){var s=this._tweens[i[n]],r=!e;s&&!1===s.update(t,r)&&!e&&this.remove(s)}i=Object.keys(this._tweensAddedDuringUpdate)}},t}(),ko={Linear:function(t,e){var i=t.length-1,n=i*e,s=Math.floor(n),r=ko.Utils.Linear;return e<0?r(t[0],t[1],n):e>1?r(t[i],t[i-1],i-n):r(t[s],t[s+1>i?i:s+1],n-s)},Utils:{Linear:function(t,e,i){return(e-t)*i+t}}},No=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),Oo=new Po,Ro=function(){function t(t,e){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Lo.Linear.None,this._interpolationFunction=ko.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=No.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,"object"==typeof e?(this._group=e,e.add(this)):!0===e&&(this._group=Oo,Oo.add(this))}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.getDuration=function(){return this._duration},t.prototype.to=function(t,e){if(void 0===e&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e<0?0:e,this},t.prototype.duration=function(t){return void 0===t&&(t=1e3),this._duration=t<0?0:t,this},t.prototype.dynamic=function(t){return void 0===t&&(t=!1),this._isDynamic=t,this},t.prototype.start=function(t,e){if(void 0===t&&(t=Bo()),void 0===e&&(e=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed)for(var i in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var s in this._valuesEnd)n[s]=this._valuesEnd[s];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},t.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},t.prototype._setupProperties=function(t,e,i,n,s){for(var r in i){var a=t[r],o=Array.isArray(a),h=o?"array":typeof a,l=!o&&Array.isArray(i[r]);if("undefined"!==h&&"function"!==h){if(l){if(0===(g=i[r]).length)continue;for(var u=[a],c=0,d=g.length;c<d;c+=1){var p=this._handleRelativeValue(a,g[c]);if(isNaN(p)){l=!1;break}u.push(p)}l&&(i[r]=u)}if("object"!==h&&!o||!a||l)(void 0===e[r]||s)&&(e[r]=a),o||(e[r]*=1),n[r]=l?i[r].slice().reverse():e[r]||0;else{e[r]=o?[]:{};var f=a;for(var m in f)e[r][m]=f[m];n[r]=o?[]:{};var g=i[r];if(!this._isDynamic){var y={};for(var m in g)y[m]=g[m];i[r]=g=y}this._setupProperties(f,e[r],g,n[r],s)}}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},t.prototype.pause=function(t){return void 0===t&&(t=Bo()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=t),this},t.prototype.resume=function(t){return void 0===t&&(t=Bo()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this):this},t.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},t.prototype.group=function(t){return t?(t.add(this),this):this},t.prototype.remove=function(){var t;return null===(t=this._group)||void 0===t||t.remove(this),this},t.prototype.delay=function(t){return void 0===t&&(t=0),this._delayTime=t,this},t.prototype.repeat=function(t){return void 0===t&&(t=0),this._initialRepeat=t,this._repeat=t,this},t.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},t.prototype.yoyo=function(t){return void 0===t&&(t=!1),this._yoyo=t,this},t.prototype.easing=function(t){return void 0===t&&(t=Lo.Linear.None),this._easingFunction=t,this},t.prototype.interpolation=function(t){return void 0===t&&(t=ko.Linear),this._interpolationFunction=t,this},t.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},t.prototype.onStart=function(t){return this._onStartCallback=t,this},t.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},t.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},t.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},t.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},t.prototype.onStop=function(t){return this._onStopCallback=t,this},t.prototype.update=function(e,i){var n,s,r=this;if(void 0===e&&(e=Bo()),void 0===i&&(i=t.autoStartOnUpdate),this._isPaused)return!0;if(!this._goToEnd&&!this._isPlaying){if(!i)return!1;this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),!1===this._onEveryStartCallbackFired&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=e-this._startTime,o=this._duration+(null!==(n=this._repeatDelayTime)&&void 0!==n?n:this._delayTime),h=this._duration+this._repeat*o,l=function(){if(0===r._duration)return 1;if(a>h)return 1;var t=Math.trunc(a/o),e=a-t*o,i=Math.min(e/r._duration,1);return 0===i&&a===r._duration?1:i}(),u=this._easingFunction(l);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,u),this._onUpdateCallback&&this._onUpdateCallback(this._object,l),0===this._duration||a>=this._duration){if(this._repeat>0){var c=Math.min(Math.trunc((a-this._duration)/o)+1,this._repeat);for(s in isFinite(this._repeat)&&(this._repeat-=c),this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[s]||(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=o*c,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var d=0,p=this._chainedTweens.length;d<p;d++)this._chainedTweens[d].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(t,e,i,n){for(var s in i)if(void 0!==e[s]){var r=e[s]||0,a=i[s],o=Array.isArray(t[s]),h=Array.isArray(a);!o&&h?t[s]=this._interpolationFunction(a,n):"object"==typeof a&&a?this._updateProperties(t[s],r,a,n):"number"==typeof(a=this._handleRelativeValue(r,a))&&(t[s]=r+(a-r)*n)}},t.prototype._handleRelativeValue=function(t,e){return"string"!=typeof e?e:"+"===e.charAt(0)||"-"===e.charAt(0)?t+parseFloat(e):parseFloat(e)},t.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],i=this._valuesEnd[t];this._valuesStartRepeat[t]="string"==typeof i?this._valuesStartRepeat[t]+parseFloat(i):this._valuesEnd[t],this._valuesEnd[t]=e},t.autoStartOnUpdate=!1,t}();No.nextId;var zo=Oo;zo.getAll.bind(zo),zo.removeAll.bind(zo),zo.add.bind(zo),zo.remove.bind(zo),zo.update.bind(zo);var Ho={Easing:Lo,Tween:Ro};class Wo extends Fi{constructor(t={}){super(),c(this,"name","SvgView"),c(this,"params"),c(this,"container"),c(this,"offset",new We),c(this,"camera"),c(this,"controller"),c(this,"scene"),c(this,"p1",new We),c(this,"p2",new We),c(this,"graph"),c(this,"multiSelector"),c(this,"dummiesController"),c(this,"zoomToSelectEnable",!1),c(this,"zoomBox",new ai),c(this,"selectEnable",!1),c(this,"multiSelectEnable",!1),c(this,"fnEnable",!1),c(this,"tween"),c(this,"animateDuration"),c(this,"label"),c(this,"controllerPanStartHandler",this.handlePanStart.bind(this)),c(this,"controllerPanEndHandler",this.handlePanEnd.bind(this)),c(this,"controllerPanMoveHandler",this.handleControllerPanMove.bind(this)),c(this,"controllerPointerOverHandler",this.handleControllerPointerOver.bind(this)),c(this,"multiSelectorSelectedHandler",this.handleMultiSelectorSelected.bind(this)),c(this,"_currentAssetId"),this.params=t,this.params.zoomToSelectEnable&&(this.zoomToSelectEnable=!0),this.params.selectEnable&&(this.selectEnable=!0),this.params.multiSelectEnable&&(this.multiSelectEnable=!0),this.params.camera||(this.params.camera={}),this.params.camera.flipY=!0,this.animateDuration=this.params.animateDuration||300,this.camera=new tr(this.params.camera),this.container=this.params.containerId?document.getElementById(this.params.containerId):Ae.window.document.getElementsByTagName("body")[0];let e=this.container.getBoundingClientRect();this.offset.set(e.left,e.top),this.controller=new Js(this.container,this.camera,!0),this.graph=new ir(this.container),this.multiSelector=new ar(this.container,this.controller),this.dummiesController=new Io(this.container,this.controller),this.bindControllerEvents(),this.initLabel()}destroy(){var t;this.unbindControllerEvents(),super.destroy(),null==(t=this.label)||t.destroy()}initLabel(){this.label=new xo(this.container,"")}showAssetsLabel(t,e,i){var n,s,r,a,o;if(!e)return;t||(t=null==(n=this.scene)?void 0:n.assetType);const h=null==(s=this.scene)?void 0:s.chef.getElementBoundingBox(e);h&&!h.isEmpty()&&(i||(i=null==(r=this.scene)?void 0:r.getAssetLabelById(t,e))||(i=e),null==(a=this.label)||a.setHtml(i),Uo.copy(h.min).applyMatrix3(this.camera.viewMatrix).add(this.offset).round(),null==(o=this.label)||o.show(Uo))}hideAssetsLabel(){return d(this,null,(function*(){var t;return null==(t=this.label)?void 0:t.hide()}))}bindScene(t){var e;this.scene=t,this.multiSelector.bindScene(this.scene),null==(e=this.dummiesController)||e.bindScene(this.scene)}resize(){var t,e;null==(t=this.camera)||t.resize(),null==(e=this.controller)||e.resize()}setEnablePan(t){this.controller&&(this.controller.enablePan=!!t)}setByBox(t,e=!0){return d(this,null,(function*(){yield this.resetCameraByBoundingBox(t,e)}))}zoomIn(){this.controller.scaled=.9*this.camera.scaled.x,this.controller.update()}zoomOut(){this.controller.scaled=1.1*this.camera.scaled.x,this.controller.update()}zoomToSelectEnableChanged(t){this.zoomToSelectEnable=t,this.controller.enablePan=!this.zoomToSelectEnable}selectEnableChanged(t){this.selectEnable=!!t,this.multiSelector.selectEnableChanged(t)}multiSelectEnableChanged(t){this.multiSelectEnable=!!t,this.multiSelector.multiSelectEnableChanged(t)}fnEnableChanged(t){this.fnEnable=!!t,this.multiSelector.fnEnableChanged(t)}getIntersectObjects(t,e,i=[]){return this.scene?this.scene.getIntersectObjects(t,e,i):i}focusAt(t,e=500){return d(this,null,(function*(){return this.camera?(Fo.setFromCenterAndSize(t,Uo.set(2*e,2*e)),this.resetCameraByBoundingBox(Fo,!0)):Promise.resolve()}))}focusAtById(t,e=500){return d(this,null,(function*(){var i;const n=null==(i=this.scene)?void 0:i.getBoundingBoxById(t);if(n)return n.expandByScalar(e),Fo.copy(this.camera.boundingBoxWorld),void(Fo.containsBox(n)||(yield this.resetCameraByBoundingBox(n,!0)))}))}focusAtDummy(t,e=500){return d(this,null,(function*(){var i,n;const s=this.dummiesController.getDummyById(t),r=null==(i=null==s?void 0:s.userData)?void 0:i.rmId;if(r){const t=null==(n=this.scene)?void 0:n.getBoundingBoxById(r);if(t)return t.expandByScalar(e),Fo.copy(this.camera.boundingBoxWorld),void(Fo.containsBox(t)||(yield this.resetCameraByBoundingBox(t,!0)))}if((null==s?void 0:s.position)&&!(null==s?void 0:s.position.isEmpty()))return Fo.setFromCenterAndSize(s.worldPosition,Uo.set(2*e,2*e)),void(this.camera.boundingBoxWorld.containsBox(Fo)||(yield this.resetCameraByBoundingBox(Fo,!0)))}))}resetCameraByBoundingBox(t,e=!1){return d(this,null,(function*(){if(!this.camera)return Promise.resolve();if(!t||t.isEmpty())throw new Error("BoundingBox empty");if(!e)return this.camera.setByBox(t),Promise.resolve();const i=this.camera.getCameraPosition();t.getCenter(Uo),t.getSize(Vo);const n=Math.max(Vo.x/this.camera.width,Vo.y/this.camera.height),s={x:Uo.x,y:Uo.y,z:0,s:n,r:0};yield this.animateCamera(i,s)}))}animateCamera(t,e){return d(this,null,(function*(){return this.controller&&(this.controller.enabled=!1),this.tween&&this.tween.stop(),new Promise((i=>{this.tween=new Ho.Tween(t).to(e,this.animateDuration).easing(Ho.Easing.Exponential.Out).onUpdate((t=>{this.camera.position.set(t.x,t.y),this.camera.scaled.set(t.s,t.s),this.camera.rotation.set(t.r,t.r),this.camera.update()})).onComplete((()=>{this.controller&&(this.controller.enabled=!0),i()})).start()}))}))}fullscreen(){this.scene&&(this.scene&&!this.scene.viewBox.isEmpty()?Fo.copy(this.scene.viewBox):(this.scene.updateMatrixWorld(!0),this.scene.computeBoundingBox(),Fo.copy(this.scene.boundingBox)),this.resetCameraByBoundingBox(Fo,!0))}saveCameraPosition(t){Fo.copy(this.camera.boundingBoxWorld);const e=t?jo+t:jo;sessionStorage.setItem(e,JSON.stringify(Fo))}restoreCameraPosition(t){const e=t?jo+t:jo,i=sessionStorage.getItem(e);if(!i)return this.fullscreen();Fo.copy(JSON.parse(i)),this.resetCameraByBoundingBox(Fo,!0)}clearCameraPosition(t){const e=t?jo+t:jo;sessionStorage.setItem(e,"")}bindControllerEvents(){this.controller.addEventListener(Qs.PAN_START,this.controllerPanStartHandler),this.controller.addEventListener(Qs.PAN_END,this.controllerPanEndHandler),this.controller.addEventListener(Qs.PAN_MOVE,this.controllerPanMoveHandler),this.controller.addEventListener(Qs.POINTEROVER,this.controllerPointerOverHandler),this.multiSelector.addEventListener(or.SELECTED,this.multiSelectorSelectedHandler)}unbindControllerEvents(){this.controller.removeEventListener(Qs.PAN_START,this.controllerPanStartHandler),this.controller.removeEventListener(Qs.PAN_END,this.controllerPanEndHandler),this.controller.removeEventListener(Qs.PAN_MOVE,this.controllerPanMoveHandler),this.controller.removeEventListener(Qs.POINTEROVER,this.controllerPointerOverHandler),this.multiSelector.removeEventListener(or.SELECTED,this.multiSelectorSelectedHandler)}handlePanStart(t){if((null==t?void 0:t.type)===Qs.PAN_START||(null==t?void 0:t.type)===Qs.WHEEL_START)return this.zoomToSelectEnable?(this.p1.copy(t.data.screenCoords),Fo.makeEmpty().expandByPoint(this.p1),void this.graph.draw(Fo)):void 0}handlePanEnd(t){if((null==t?void 0:t.type)===Qs.PAN_END||(null==t?void 0:t.type)===Qs.WHEEL_END)return this.zoomToSelectEnable?(this.p2.copy(t.data.screenCoords),Fo.makeEmpty().expandByPoint(this.p1).expandByPoint(this.p2).unproject(this.controller.camera),this.setByBox(Fo),this.graph.hide(),void Fo.makeEmpty()):void 0}handleControllerPanMove(t){(null==t?void 0:t.type)===Qs.PAN_MOVE&&this.zoomToSelectEnable&&(this.p2.copy(t.data.screenCoords),Fo.makeEmpty().expandByPoint(this.p1).expandByPoint(this.p2),this.graph.draw(Fo))}handleControllerPointerOver(t){var e,i,n,s,r;const a=(null==(e=null==t?void 0:t.e)?void 0:e.target)||(null==(n=null==(i=null==t?void 0:t.e)?void 0:i.srcEvent)?void 0:n.target);let o=null==a?void 0:a.id;(null==o?void 0:o.indexOf("dummy"))>-1?(o=a.getAttribute("ae-id"),o&&this._currentAssetId!==o&&this.dispatchEvent({type:"POINTEROVER",data:{id:o,assetType:"dummy"},e:t.e})):o&&(null==(s=this.scene)?void 0:s.isBelongsToAssetType(o,Li.WS))?this._currentAssetId!==o&&this.dispatchEvent({type:"POINTEROVER",data:{id:o,assetType:Li.WS},e:t.e}):o&&(null==(r=this.scene)?void 0:r.isBelongsToAssetType(o,Li.RM))?this._currentAssetId!==o&&this.dispatchEvent({type:"POINTEROVER",data:{id:o,assetType:Li.RM},e:t.e}):(this._currentAssetId=void 0,this.dispatchEvent({type:"POINTERLEAVE",e:t.e})),this._currentAssetId=o}handleMultiSelectorSelected(t){this.dispatchEvent({type:"SELECTED",data:t.data})}setDummies(t){this.dummiesController.setDummiesByVos(t)}clearDummies(t){this.dummiesController.clearDummies(t)}update(t){this.tween&&this.tween.update(t)}}const Fo=new ai,Uo=new We,Vo=new We;var qo=(t=>(t.SELECTED="SELECTED",t.POINTEROVER="POINTEROVER",t.POINTERLEAVE="POINTERLEAVE",t))(qo||{});const jo="svg_camera_position_";class Yo extends qs{constructor(t){super(t),c(this,"name","SvgEmptyScene"),this.bind('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-200 -200 500 500">\n <view id="defaultView" viewBox="-200 -200 500 500" />\n <style>\n /*#svg-loading-fast path {*/\n /* fill: #2E3032;*/\n /* animation: svg-loading-fast 2s ease infinite;*/\n /*}*/\n /*@keyframes svg-loading-fast {*/\n /* 0%, 100% {stroke-dasharray: 250; stroke-dashoffset: 250;}*/\n /* 68% {stroke-dasharray: 0; stroke-dashoffset: 0; opacity: 0.5;}*/\n /*}*/\n /*#svg-loading-fast .line {animation: svg-loading-fast 6s ease infinite;}*/\n /*@keyframes svg-loading-fast {*/\n /* 0% {stroke-dasharray: 250; stroke-dashoffset: 250; opacity: 1;}*/\n /* 50% {stroke-dasharray: 250; stroke-dashoffset: 0; opacity: 0.5;}*/\n /*}*/\n #svg-loading-fast path {animation: pathFrames 6s ease infinite;}\n @keyframes pathFrames {\n 0% {opacity: 1;}\n 50% {opacity: 0.5;}\n }\n #svg-loading-fast .triangle {animation: triangleFrames 3s ease infinite;}\n @keyframes triangleFrames {\n 0% {opacity: 1;}\n 50% {opacity: 0.3;}\n }\n #svg-loading-fast {fill: #525252}\n .line {stroke: #525252; stroke-width: 4px}\n .triangle {fill: #F26666}\n </style>\n <g id="svg-loading-fast">\n <g transform="scale(2, 2) translate(12, 0)">\n\x3c!-- <path d="M17.7 14L16.82 15.5L5 15.5L5 4L17.66 4L16.76 5.5L9.04 5.5L9.04 8.86L17.32 8.86L16.44 10.38L9.04 10.38L9.04 14L17.7 14Z" />--\x3e\n\x3c!-- <path d="M22.98 15.44L19.3 15.44L19.3 7.38L31.38 7.38L30.18 8.82L29.02 8.82L29.02 15.44L25.3 15.44L25.3 8.82L22.98 8.82L22.98 15.44ZM35.06 15.44L31.38 15.44L31.38 7.38L35.06 7.38L35.06 15.44Z" />--\x3e\n\x3c!-- <path d="M40.44 14.02L44.12 14.02L44.12 7.42L47.96 7.42L47.96 15.48L40.44 15.48L40.44 18.56L36.66 18.56L36.66 7.42L44.12 7.42L42.9 8.86L40.44 8.86L40.44 14.02Z" />--\x3e\n\x3c!-- <path d="M51.62 7.42L51.62 4.78L55.48 4.78L55.48 7.42L59 7.42L58.02 8.86L55.48 8.86L55.48 14.08L58.82 14.08L57.98 15.48L51.62 15.48L51.62 8.86L49.56 8.86L49.56 7.42L51.62 7.42Z" />--\x3e\n\x3c!-- <path d="M67.08 11.8L69.66 7.42L73.66 7.42L67.08 18.58L63.06 18.58L65.06 15.42L60.6 7.42L64.66 7.42L67.08 11.8Z" />--\x3e\n\n <path d="M13.5 15.8L12.62 17.3L0.799999 17.3L0.799999 5.8L13.46 5.8L12.56 7.3L4.84 7.3L4.84 10.66L13.12 10.66L12.24 12.18L4.84 12.18L4.84 15.8L13.5 15.8Z" />\n <path d="M32.12 17.3L28.52 17.3L28.52 9.9L25.18 17.3L22.1 17.3L18.8 10L18.8 17.3L15.1 17.3L15.1 5.8L20.06 5.8L23.68 13.68L27.32 5.8L32.12 5.8L32.12 17.3Z" />\n <path d="M37.72 12.8L37.72 17.3L33.72 17.3L33.72 5.8L42.22 5.8L41.06 7.34L37.72 7.34L37.72 11.3L42.22 11.3L42.22 5.8L46.28 5.8L46.28 12.8L37.72 12.8Z" />\n <path d="M57 17.3L53 17.3L53 7.34L47.88 7.34L47.88 5.8L62.48 5.8L61.6 7.34L57 7.34L57 17.3Z" />\n <path d="M69.92 13.52L64.08 5.78L68.62 5.78L71.92 10.58L75.14 5.78L79.64 5.78L73.92 13.56L73.92 17.28L69.92 17.28L69.92 13.52Z" />\n </g>\n\n <path class="line" d="M103.5 46L20 46" />\n <path class="line" d="M103.5 46L187 46" />\n <path class="triangle" d="M103.5 56L133.5 90L73.5 90Z" />\n </g>\n </svg>')}}var Go=(t=>(t[t.TIPS=1]="TIPS",t[t.HOVER=2]="HOVER",t[t.SELECT=4]="SELECT",t[t.SELECTOR_RECT=8]="SELECTOR_RECT",t[t.DISTRIBUTION=16]="DISTRIBUTION",t[t.DRAG=32]="DRAG",t[t.DUMMY=64]="DUMMY",t[t.LINKER=128]="LINKER",t[t.DRAW_POINT=1024]="DRAW_POINT",t[t.DRAW_POLYLINE=2048]="DRAW_POLYLINE",t[t.DRAW_POLYGON=4096]="DRAW_POLYGON",t[t.DRAW_TEXT=8192]="DRAW_TEXT",t))(Go||{}),$o=(t=>(t[t.DEFAULT=1]="DEFAULT",t[t.HOVER=3]="HOVER",t[t.PICKER=15]="PICKER",t[t.DISTRIBUTION=31]="DISTRIBUTION",t[t.DUMMY=119]="DUMMY",t[t.LINKER=135]="LINKER",t[t.DRAWING=15399]="DRAWING",t))($o||{}),Xo=(t=>(t[t.HOVER=1]="HOVER",t[t.SELECT=2]="SELECT",t[t.HILIGHT=4]="HILIGHT",t[t.DYNAMIC_LINE=8]="DYNAMIC_LINE",t))(Xo||{}),Zo=(t=>(t[t.KEEP_ORIGIN=1]="KEEP_ORIGIN",t[t.MAKE_COPY=2]="MAKE_COPY",t))(Zo||{}),Jo=(t=>(t[t.NONE=0]="NONE",t[t.DEFAULT=1]="DEFAULT",t[t.MODIFIED=2]="MODIFIED",t[t.NEW=3]="NEW",t))(Jo||{});class Qo{constructor(e,i){c(this,"parent"),c(this,"_fnEnable",null==(t=Ae.config)?void 0:t.fnEnable),c(this,"view"),c(this,"offset",new We),c(this,"scene"),c(this,"raycaster"),c(this,"boundingBoxPadding",15),c(this,"boundingBoxMap",new WeakMap),this.parent=e,this.view=i;const{container:n}=this.view||{};let s=n.getBoundingClientRect();this.offset.set(s.left,s.top),this.raycaster=new ur}activate(){}deactivate(){this.scene=void 0}fnEnableChanged(t){this._fnEnable=!!t}bindScene(...t){return this.scene=t[0],this}mountShape(t,e){const{svgRoot:i}=this.scene||{};i&&(i.contains(t)||(e?i.insertBefore(t,e):i.appendChild(t)))}unmountShape(t){const{svgRoot:e}=this.scene||{};e&&e.removeChild(t)}showShape(t){t&&(t.style.display="")}hideShape(t){t&&(t.style.display="none")}getDynamicObjectsByIds(t){var e;const i=[];Array.isArray(t)||(t=[t]);for(let n=0,s=t.length;n<s;n++)(null==(e=this.scene)?void 0:e.getElementById(t[n]))&&i.push(this.scene.getElementById(t[n]));return i}_getIntersectObject(t){var e,i;this.raycaster.init(t.data,null==(e=this.view)?void 0:e.camera);const n=[];return null==(i=this.scene)||i.getIntersectObjects(this.raycaster,this.scene.assetType,n),n}_getIntersect(t,e,i=this.boundingBoxPadding){var n,s,r;this.raycaster.init({worldCoords:e},null==(n=this.view)?void 0:n.camera);for(let e=0,n=t.length;e<n;e++){let n=null==(r=null==(s=this.scene)?void 0:s.chef)?void 0:r.getElementBoundingBox(t[e].id);if(n||(this.getBoundingBoxByNode(t[e],Ko),Ko.isEmpty()||(n=Ko.clone())),n&&(n.expandByScalar(i),n.containsPoint(this.raycaster.worldCoords)))return t[e]}}getBoundingBoxByNode(t,e=new ai){return e.makeEmpty(),Nn.getBoundingBoxByNode(t,e),e}}const Ko=new ai;class th extends Qo{constructor(t,e){super(t,e),c(this,"_locals",[]),c(this,"currentShape"),c(this,"_dragMap",new Map),c(this,"_bindedShape"),c(this,"_bindedControlPoint"),c(this,"_cpOffset",new We),c(this,"_cpFill",Le.darkRed),c(this,"_cpStroke",Le.darkBlue),c(this,"_mpFill",Le.white),c(this,"_mpStroke",Le.darkBlue),c(this,"_bbox"),c(this,"_boundingBoxLine"),c(this,"_tips"),c(this,"_sp"),c(this,"_rp"),c(this,"_rpLast",null),c(this,"_dp"),c(this,"_oprWidth",10),c(this,"unit"),c(this,"_boundingBox",null)}activate(){super.activate(),this.parent.enableHover(!1),this.mountControlPoints(),this._boundingBoxLine&&this.mountShape(this._boundingBoxLine),this._tips&&this.mountShape(this._tips)}deactivate(){super.deactivate(),this._dragMap.size>0&&(this._dragMap.forEach((t=>{this.unmountShape(t),this.parent.drop(t)})),this._dragMap.clear()),this.unmountShape(this._controlPoints),this._boundingBoxLine&&this.unmountShape(this._boundingBoxLine),this._tips&&this.unmountShape(this._tips),this.unbindShape()}initShapes(t){if(!t)return;Array.isArray(t)||(t=[t]);const e=this.type===Go.DRAW_POINT,i=this.type===Go.DRAW_POLYLINE,n=this.type===Go.DRAW_POLYGON,s=this.type===Go.DRAW_TEXT;for(let r=0,a=(null==t?void 0:t.length)||0;r<a;r++){const{nodeName:a}=t[r];if(e&&"circle"!==a||s&&"text"!==a)continue;const o=ih.test((t[r].getAttribute("d")||"").trim());if(i&&"path"!==a||i&&"path"===a&&o)continue;if(n&&"path"!==a||n&&"path"===a&&!o)continue;const h=document.createElementNS("http://www.w3.org/2000/svg",a);Array.from(t[r].attributes).forEach((t=>h.setAttribute(t.name,t.value))),t[r].children.length>0?h.innerHTML=t[r].innerHTML:t[r].textContent&&(h.textContent=t[r].textContent),this.mountShape(h),this._locals.push(h);const l=h.id||ms();this.parent.drag(h,{id:l,type:this.type})}}fnEnableChanged(t){super.fnEnableChanged(t)}editorFillChanged(t){this._bindedShape&&(t?this._bindedShape.setAttribute("fill",t.toString()):this._bindedShape.removeAttribute("fill"))}editorStrokeChanged(t){this._bindedShape&&(t?this._bindedShape.setAttribute("stroke",t.toString()):this._bindedShape.removeAttribute("stroke"))}editorStrokeWidthChanged(t){var e,i;if(this._bindedShape){this._bindedShape.setAttribute("stroke-width",t.toString());for(let n,s=0,r=(null==(i=null==(e=this._controlPoints)?void 0:e.children)?void 0:i.length)||0;s<r;s++)n=this._controlPoints.children[s],n.setAttribute("r",t.toString())}}editorStrokeDasharrayChanged(t){this._bindedShape&&(t?this._bindedShape.setAttribute("stroke-dasharray",t):this._bindedShape.removeAttribute("stroke-dasharray"))}editorFontSizeChanged(t){var e;this._bindedShape&&"text"===(null==(e=this._bindedShape)?void 0:e.nodeName)&&(this._bindedShape.setAttribute("font-size",t.toString()),this.updateControlPoints())}editorTextContentChanged(t){var e,i;this._bindedShape&&"text"===(null==(e=this._bindedShape)?void 0:e.nodeName)&&(this._bindedShape.textContent=t,null==(i=this._bindedShape)||i.getBBox())}deleteCurrentShape(){if(!this._bindedShape)return;const t=ri.findIndex(this._locals,(t=>t===this._bindedShape));t>-1&&this._locals.splice(t,1),this.unmountShape(this._bindedShape),this.unbindControlPoint(),this.unbindShape(),this.currentShape=void 0}clearAllShapes(){this.deleteCurrentShape();for(let t=0,e=this._locals.length;t<e;t++)this.unmountShape(this._locals[t]);this._locals=[]}editorUnitsChanged(t){this.unit=t||Ei.M}bindEditorDrag(t){}getDraggingObject(t){}beforeDragStart(t){}handleDragStart(t){var e,i,n;if((null==t?void 0:t.type)!==Qs.PAN_START||(null==(e=null==t?void 0:t.targetVo)?void 0:e.type)!==this.type)return;const{target:s,targetVo:r,center:a}=t||{},o=(null==r?void 0:r.id)||ms(),h=this.isControlPoints(s);if(nh.set(a.x,a.y).sub(this.offset),(null==(i=this.view)?void 0:i.camera)&&nh.unproject(null==(n=this.view)?void 0:n.camera),this._boundingBox=Nn.getBoundingBoxByNode(this._bindedShape),h)this.bindControlPoint(s),this.currentShape=s,this.beforeDragStart(t),this.updateControlPoints(this.currentShape,nh),this.updateByControlPoints(nh);else if(this._spId&&ri.startsWith(null==s?void 0:s.id,this._spId)||this._rpId&&ri.startsWith(null==s?void 0:s.id,this._rpId))this.currentShape=s;else if(!ri.startsWith(null==s?void 0:s.id,this._cpsId)){this.bindShape(t);const e=this.hasShape(o);this.currentShape=this.getShape(o),e?(Nn.parseNodeTransform(this.currentShape,ph).getTransition(hh),this._cpOffset.copy(nh).sub(hh)):this._cpOffset.identity(),nh.sub(this._cpOffset),es(this.currentShape,nh),this.updateControlPoints(this._controlPoints,nh)}this.updateOperations(s,nh),this.updateBoundingBoxLine(),this.updateTips()}handleDragMove(t){var e,i;if((null==t?void 0:t.type)!==Qs.PAN_MOVE)return;if(!this.currentShape)return;const{target:n,center:s}=t||{};nh.set(s.x,s.y).sub(this.offset),(null==(e=this.view)?void 0:e.camera)&&nh.unproject(null==(i=this.view)?void 0:i.camera),this.isControlPoints(n)?(this.updateControlPoints(this.currentShape,nh),this.updateByControlPoints(nh)):this._spId&&ri.startsWith(null==n?void 0:n.id,this._spId)||this._rpId&&ri.startsWith(null==n?void 0:n.id,this._rpId)||ri.startsWith(null==n?void 0:n.id,this._cpsId)||(nh.sub(this._cpOffset),es(this.currentShape,nh),this.updateControlPoints(this._controlPoints,nh)),this.updateOperations(n,nh),this.updateBoundingBoxLine(),this.updateTips()}handleDragEnd(t){var e,i,n;if((null==t?void 0:t.type)!==Qs.PAN_END)return;if(!this.currentShape)return;const{target:s,center:r}=t||{};nh.set(r.x,r.y).sub(this.offset),(null==(e=this.view)?void 0:e.camera)&&nh.unproject(null==(i=this.view)?void 0:i.camera),this.isControlPoints(s)?(this.updateControlPoints(this.currentShape,nh),this.updateByControlPoints(nh),this.unbindControlPoint()):this._spId&&ri.startsWith(null==s?void 0:s.id,this._spId)||this._rpId&&ri.startsWith(null==s?void 0:s.id,this._rpId)||ri.startsWith(null==s?void 0:s.id,this._cpsId)||(nh.sub(this._cpOffset),es(this.currentShape,nh),this.updateControlPoints(this._controlPoints,nh));const a=null==(n=this.currentShape)?void 0:n.id;a&&!this._dragMap.has(a)&&(this.parent.drag(this.currentShape,{id:a,type:this.type}),this._dragMap.set(a,this.currentShape)),this.updateOperations(s,nh),this.updateBoundingBoxLine(),this.updateTips(),this.currentShape=void 0,this._cpOffset.identity(),this._boundingBox=null,this._rpLast=null}handleTap(t){var e,i,n,s;if((null==t?void 0:t.type)!==Qs.TAP)return;const r=(null==(e=null==t?void 0:t.e)?void 0:e.target)||(null==(n=null==(i=null==t?void 0:t.e)?void 0:i.srcEvent)?void 0:n.target),a=null==r?void 0:r.id;if(a&&ri.startsWith(a,this._dpId))return void this.deleteCurrentShape();const o=this._getIntersect(this._locals,null==(s=null==t?void 0:t.data)?void 0:s.worldCoords);this._boundingBox=Nn.getBoundingBoxByNode(o),this.bindShape(t),Nn.parseNodeTransform(this._bindedShape,ph).getTransition(hh),this.updateOperations(this._controlPoints,hh),this._boundingBox=null}hasShape(t){return void 0!==ri.find(this._locals,(e=>e.id===t))}getShape(t){throw new Error("Method not implemented.")}bindShape(t){var e;const i=this._getIntersect(this._locals,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this._bindedShape=i,this._bindedShape?(this.resetControlPoints(),Nn.parseNodeTransform(this._bindedShape,ph).getTransition(hh),this.updateControlPoints(this._controlPoints,hh),this.showShape(this._controlPoints),this.updateBoundingBoxLine(),this.showShape(this._boundingBoxLine),this.updateTips(),this.showShape(this._tips)):this.unbindShape()}unbindShape(){this._bindedShape=void 0,this.hideShape(this._controlPoints),this.hideShape(this._boundingBoxLine),this.hideShape(this._tips)}handleWheelEnd(t){this.updateControlPointsRadius()}updateControlPointsRadius(){var t,e,i,n,s;const r=ri.filter(this._controlPoints.children,(t=>"circle"===t.nodeName));if(!(null==r?void 0:r.length))return;const a=Math.max((null==(i=null==(e=null==(t=this.parent)?void 0:t.view)?void 0:e.camera)?void 0:i.pixelWidth)||1,1),o=Math.ceil(a*((null==(s=null==(n=Ae.config)?void 0:n.editor)?void 0:s.strokeWidth)||10));for(let t,e=0,i=(null==r?void 0:r.length)||0;e<i;e++)t=r[e],t.setAttribute("r",o.toString())}getControlPoints(){const t=is(this._cpsId),e=new Re(this._cpFill).setA(.1).getStyle(),i=this._cpStroke,n=Kn({id:`${this._spId}`,fill:e,stroke:i,strokeWidth:2});n.setAttribute(`${ki}-type`,(this.type|Go.DRAG).toString()),n.setAttribute("d","\n M75 25L25 75 \n M50 27.9412L80 20L72.0588 50\n M27.9412 50L20 80L50 72.0588\n M99 50C99 23 77 1 50 1C23 1 1 23 1 50C1 77 23 99 50 99C77 99 99 77 99 50 \n "),Nn.getBoundingBoxByNode(n,ch).getSize(sh);const s=this._oprWidth/sh.x;n.setAttribute("stroke-width",(2/s).toFixed(2)),es(n,void 0,void 0,sh.set(s,s)),t.appendChild(n),this._sp=n;const r=Kn({id:`${this._rpId}`,fill:e,stroke:i,strokeWidth:2/s});r.setAttribute(`${ki}-type`,(this.type|Go.DRAG).toString()),r.setAttribute("d","\n M49 25.5C79 25.5 87 58 69 72C51 86 24.5 76 24.5 49.5\n M56.5003 52.4994L47.725 23.1994L78.5098 19.2823\n M99 50C99 23 77 1 50 1C23 1 1 23 1 50C1 77 23 99 50 99C77 99 99 77 99 50Z\n "),es(r,void 0,void 0,sh.set(s,s)),t.appendChild(r),this._rp=r;const a=Kn({id:`${this._dpId}`,fill:e,stroke:i,strokeWidth:2/s});return a.setAttribute(`${ki}-type`,(this.type|Go.DRAG).toString()),a.setAttribute("d","\n M25.5 26L75.5 75.5\n M75.5 26L25.5 75.5\n M99 50C99 23 77 1 50 1C23 1 1 23 1 50C1 77 23 99 50 99C77 99 99 77 99 50Z\n "),es(a,void 0,void 0,sh.set(s,s)),t.appendChild(a),this._dp=a,t}updateControlPoints(t,e){throw new Error("Method not implemented.")}updateOperations(t,e){if(!this._sp||!this._rp)return;if(Nn.getBoundingBoxByNode(this._sp,dh).getSize(sh),t&&e&&ri.startsWith(t.id,this._spId)&&this._boundingBox){Nn.getBoundingBoxByNode(this._bindedShape,ch).getCenter(rh);const t=We.getDistance(ch.max,rh),i=We.getDistance(e,rh)/t;Nn.parseNodeTransform(this._bindedShape,ph).decompose(hh,lh,uh),hh.sub(rh).multiplyScalar(i).add(rh),uh.multiplyScalar(i),es(this._bindedShape,hh,lh,uh),this.updateControlPoints(this._controlPoints,hh)}else if(t&&e&&ri.startsWith(t.id,this._rpId)){Nn.getBoundingBoxByNode(this._bindedShape,ch).getCenter(rh);const t=We.angle(e,rh,!0);null===this._rpLast&&(this._rpLast=t);const i=t-this._rpLast;Nn.parseNodeTransform(this._bindedShape,ph).decompose(hh,lh,uh),hh.sub(rh).rotate(i).add(rh),lh.addScalar(i),es(this._bindedShape,hh,lh,uh),this._rpLast=t,this.updateControlPoints(this._controlPoints,hh)}if(Nn.getBoundingBoxByNode(this._bindedShape,ch),ch.isEmpty())return;const i=(sh.x||10)/2;ah.set(ch.max.x,ch.min.y).add(oh.set(i,-i)),ns(this._sp,ah),ah.set(ch.max.x,ch.min.y).add(oh.set(2*(sh.x+i),-i)),ns(this._rp,ah),ah.set(ch.max.x,ch.min.y).add(oh.set(4*(sh.x+i),-i)),ns(this._dp,ah)}updateByControlPoints(t){throw new Error("Method not implemented.")}isControlPoints(t){return!!t&&(!!this._cpId&&ri.startsWith(null==t?void 0:t.id,this._cpId)||!!this._mpId&&ri.startsWith(null==t?void 0:t.id,this._mpId))}bindControlPoint(t){this._bindedControlPoint=t}unbindControlPoint(){this._bindedControlPoint=void 0}resetControlPoints(){this._controlPoints&&(this.unmountShape(this._controlPoints),this._controlPoints=this.getControlPoints(),this.mountControlPoints())}mountControlPoints(){var t,e,i;if(this._controlPoints){this.hideShape(this._controlPoints),this.mountShape(this._controlPoints);for(let n,s=0,r=(null==(e=null==(t=this._controlPoints)?void 0:t.children)?void 0:e.length)||0;s<r;s++){n=null==(i=this._controlPoints)?void 0:i.children[s];const t=n.id;if(!t)continue;const e=parseInt(n.getAttribute(`${ki}-type`)||"0");e&&e&Go.DRAG&&(this.parent.drag(n,{id:t,type:this.type}),this._dragMap.set(t,n))}}}splitByControlPoint(t,e){var i;if(!this._bindedShape||!t||!e)return;if(!ri.startsWith(null==t?void 0:t.id,this._mpId))return;const n=null==t?void 0:t.id,s=this.getCpIdx(n);Nn.getPathProxyBySvgPathD(null==(i=this._bindedShape)?void 0:i.getAttribute("d"),fh.dispose()),fh.insertData(s,un,sh.x,sh.y);const r=Nn.getSvgPathDByData(fh.data);this._bindedShape.setAttribute("d",r),this.resetControlPoints();const a=ri.find(this._controlPoints.children,(t=>t.id===`${this._cpId}${s+1}`));this.bindControlPoint(a),this.currentShape=a,this.showShape(this._controlPoints),Nn.parseNodeTransform(this._bindedShape,ph).getTransition(sh),this.updateControlPoints(this._controlPoints,sh)}mergeByControlPoint(t,e){var i;if(!this._bindedShape||!t||!e)return;const n=null==t?void 0:t.id;if(!ri.startsWith(n,this._cpId))return;const s=this.getCpIdx(n);if(!s)return;if(ri.filter(this._controlPoints.children,(t=>t.id.startsWith(this._cpId))).length<=this._cpsLimit)return;Nn.getPathProxyBySvgPathD(null==(i=this._bindedShape)?void 0:i.getAttribute("d"),fh.dispose()),fh.removeData(s);const r=Nn.getSvgPathDByData(fh.data);this._bindedShape.setAttribute("d",r),this.resetControlPoints(),this.showShape(this._controlPoints),Nn.parseNodeTransform(this._bindedShape,ph).getTransition(sh),this.updateControlPoints(this._controlPoints,sh)}getCpIdx(t){return parseInt(t.slice(t.lastIndexOf("-")+1))-1}getBoundingBoxLine(){return Kn({id:this._bblId,fill:"none",stroke:this._cpStroke,strokeWidth:1,strokeDasharray:"5",d:[]})}updateBoundingBoxLine(){if(!this._boundingBoxLine||!this._bindedShape)return;Nn.getBoundingBoxByNode(this._bindedShape,ch.makeEmpty()),fh.dispose().moveTo(ch.min.x,ch.min.y).lineTo(ch.max.x,ch.min.y).lineTo(ch.max.x,ch.max.y).lineTo(ch.min.x,ch.max.y).lineTo(ch.min.x,ch.min.y).closePath();const t=Nn.getSvgPathDByData(fh.data);this._boundingBoxLine.setAttribute("d",t)}getTips(){const t=this._cpStroke;return ts({id:this._tipsId,textContent:"tips",fill:t,fontSize:Ae.config.editor.fontSize||eh,textAnchor:"start",textBaseline:"middle"})}updateTips(){this._boundingBoxLine&&this._bindedShape&&this._tips&&(Nn.getBoundingBoxByNode(this._bindedShape,ch.makeEmpty()),hh.set(ch.max.x+this._oprWidth,ch.min.y+this._oprWidth+1.5*eh),es(this._tips,hh),this.recomputeTips())}recomputeTips(){var t,e,i,n;if(!this._bindedShape||!this._tips)return;let s;Nn.getPathProxyBySvgPathD(null==(t=this._bindedShape)?void 0:t.getAttribute("d"),fh.dispose()),Nn.parseNodeTransform(this._bindedShape,ph).decompose(hh,lh,uh),this.type&Go.DRAW_POLYLINE?(s||(s=fh.getLength()),s||"function"!=typeof this._bindedShape.getTotalLength||(s=null==(e=this._bindedShape)?void 0:e.getTotalLength()),s*=(uh.x+uh.y)/2,s=Di(s,null==(i=this.scene)?void 0:i.viewUnits,Ei.M),this._tips.textContent=function(t,e=Ei.M){let i=t||0;return t?(i=e===Ei.MM?ri.round(t):e===Ei.CM?ri.round(t,1):ri.round(t,2),`${i} ${e}`):""}(s,Ei.M)):this.type&Go.DRAW_POLYGON&&(s=fh.getArea(),s*=uh.x*uh.y,s=Di(s,null==(n=this.scene)?void 0:n.viewUnits,Ei.M,!0),this._tips.textContent=function(t,e=Ei.M){let i=t||0;return t?(i=e===Ei.MM?ri.round(t):e===Ei.CM?ri.round(t,1):ri.round(t,2),`${i} ${e}²`):""}(s,Ei.M))}}const eh=20,ih=/z\s*$/i,nh=new We,sh=new We,rh=new We,ah=new We,oh=new We,hh=new We,lh=new We,uh=new We,ch=new ai,dh=new ai,ph=new Ui,fh=new yn;class mh extends th{constructor(t,e){super(t,e),c(this,"type",Go.DRAW_POINT),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),this._controlPoints=this.getControlPoints()}activate(){super.activate()}deactivate(){super.deactivate()}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i=new Re(Ae.config.editor.fill||Le.green).setA(.6).getStyle(),n=new Re(Ae.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),s=Ae.config.editor.strokeWidth||5;e=Qn({id:t,r:3*s,x:0,y:0,fill:i,stroke:n,strokeWidth:s}),e.setAttribute(`${ki}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints)}return e}getControlPoints(){const t=is(`${this._cpsId}`),e=Ae.config.editor.strokeWidth,i=Qn({id:`${this._cpId}1`,x:0,y:0,r:e,fill:this._cpFill,stroke:this._cpStroke});return i.setAttribute(`${ki}-type`,(Go.DRAW_POINT|Go.DRAG).toString()),t.appendChild(i),t}updateControlPoints(t,e){if(t&&e){if(this.getBoundingBoxByNode(this._bindedShape,xh),xh.getCenter(gh),xh.getSize(yh),t===this._controlPoints){vh.set(e.x+yh.x/2,e.y);const t=ri.filter(this._controlPoints.children,(t=>"circle"===t.nodeName));for(let e=0,i=t.length;e<i;e++)ns(t[e],vh)}else vh.set(gh.x+yh.x/2,gh.y),ns(t,vh);this.updateControlPointsRadius()}}updateByControlPoints(t){this._bindedShape&&(Nn.getBoundingBoxByNode(this._bindedShape,xh),xh.getCenter(gh),yh.copy(t).sub(gh),this._bindedShape.setAttribute("r",Math.abs(yh.x).toString()))}}const gh=new We,yh=new We,vh=new We,xh=new ai;class bh extends Qo{constructor(t,e){super(t,e),c(this,"type",Go.DRAG),c(this,"_els",[]),c(this,"_hms",new Map),c(this,"_vos",new Map),c(this,"onPanHandler",this._handleOnPan.bind(this)),c(this,"panMoveHandler",ri.throttle(this._handlePanMove.bind(this),100)),c(this,"panEndHandler",this._handlePanEnd.bind(this))}activate(){super.activate()}deactivate(){var t;super.deactivate();for(let e=((null==(t=this._els)?void 0:t.length)||0)-1;e>=0;e--)this.drop(this._els[e])}drag(t,e){this._els.includes(t)||(this.bindEvent(t),this._els.push(t),this._vos.set(t,e))}drop(t){if(!t)return;this.unbindEvent(t),this._vos.delete(t);const e=this._els.findIndex((e=>e===t));e>-1&&this._els.splice(e,1)}bindEvent(t){if(!t)return;const e=new Hammer.Manager(t,{domEvents:!0});e.add(new Hammer.Pan({threshold:0,pointers:0})),e.on("panstart",this.onPanHandler),e.on("panmove",this.panMoveHandler),e.on("panend",this.panEndHandler),this._hms.set(t,e)}unbindEvent(t){if(!t)return;const e=this._hms.get(t);e&&(e.off("panstart",this.onPanHandler),e.off("panmove",this.panMoveHandler),e.off("panend",this.panEndHandler),e.destroy(),this._hms.delete(t))}_handleOnPan(t){var e;if((null==t?void 0:t.type)!==Qs.PAN_START)return;"function"==typeof t.preventDefault&&t.preventDefault();const{target:i,center:n}=t||{};if(!i)return;ri.set(t,"targetVo",this._vos.get(i)),this.parent.setEnablePan(!1),wh.copy(n).sub(this.offset);const s={x:wh.x,y:wh.y};(null==(e=this.view)?void 0:e.camera)&&wh.unproject(this.view.camera);const r={x:wh.x,y:wh.y};ri.set(t,"data",{screenCoords:s,worldCoords:r}),this.parent.handleDragStart(t)}_handlePanMove(t){var e;(null==t?void 0:t.type)===Qs.PAN_MOVE&&((null==(e=this.parent)?void 0:e.isEnablePan())||(ri.set(t,"targetVo",this._vos.get(t.target)),this.parent.handleDragMove(t)))}_handlePanEnd(t){var e;this.parent.setEnablePan(!0),(null==t?void 0:t.type)===Qs.PAN_END&&(ri.set(t,"targetVo",this._vos.get(t.target)),this.parent.handleDragEnd(t),null==(e=this.view.camera)||e.update())}}const wh=new We;class _h extends Qo{constructor(t,e){super(t,e),c(this,"type",Go.HOVER),c(this,"_hoverEnabled",!1),c(this,"_hovered"),c(this,"_hoverId")}activate(){var t;super.activate(),this.enableHover(null==(t=Ae.config.controls)?void 0:t.enableHover)}deactivate(){super.deactivate(),this._hoverId=void 0,this._hovered=void 0}enableHover(t){return this._hoverEnabled=t,this}_handlePointerOver(t){var e,i,n,s,r;if((null==(e=null==t?void 0:t.e)?void 0:e.buttons)>0)return;let a=(null==(i=null==t?void 0:t.e)?void 0:i.target)||(null==(s=null==(n=null==t?void 0:t.e)?void 0:n.srcEvent)?void 0:s.target);null==(r=this.scene)||r.assetType;let o=null==a?void 0:a.id;if(!o){const e=this._getIntersectObject(t);o=(null==e?void 0:e.length)&&"function"==typeof e[0].getAttribute?e[0].getAttribute("id"):void 0,a=(null==e?void 0:e.length)?e[0]:void 0}o&&o!==this._hoverId&&(this.parent.handlePointerOver(t),this._hoverEnabled&&this._hover(a)),this._hoverId&&o!==this._hoverId&&(this._clearHover(this._hovered),this.parent.handlePointerOut(t)),this.parent.handlePointerMove(t),this._hoverId=o,this._hovered=a}_hover(t){t&&Us(t,"hover")}_clearHover(t){t&&Vs(t,"hover")}}let Sh=0;class Eh{constructor(t,e,i){var n;c(this,"id",Sh++),c(this,"worker"),this.worker=i;let s=t=>{var e;return null==(e=this.worker)?void 0:e.postMessage({type:"event",id:this.id,data:t})};this.worker||(s=t=>{Th.instance().handleEvent({id:this.id,data:t})}),null==(n=this.worker)||n.postMessage({type:"makeProxy",id:this.id}),this.worker||Th.instance().makeProxy({id:this.id}),r();for(const[i,n]of Object.entries(e))t.addEventListener(i,(function(t){n(t,s)}));function r(){const e=t.getBoundingClientRect();s({type:"size",left:e.left,top:e.top,width:t.clientWidth,height:t.clientHeight})}window.addEventListener("resize",r)}}function Mh(){}class Ah extends Fi{constructor(){super(),c(this,"isProxy",!0),c(this,"width"),c(this,"height"),c(this,"left"),c(this,"right"),c(this,"top"),c(this,"bottom"),c(this,"style",{})}get clientWidth(){return this.width}get clientHeight(){return this.height}setPointerCapture(){}releasePointerCapture(){}getBoundingClientRect(){return{left:this.left,top:this.top,width:this.width,height:this.height,right:(this.left||0)+(this.width||0),bottom:(this.top||0)+(this.height||0)}}handleEvent(t){if("size"===t.type)return this.left=t.left,this.top=t.top,this.width=t.width,void(this.height=t.height);t.preventDefault=Mh,t.stopPropagation=Mh,this.dispatchEvent(t)}focus(){}getRootNode(){return{addEventListener:Mh,removeEventListener:Mh}}}class Th{constructor(){c(this,"targets",{}),this.handleEvent=this.handleEvent.bind(this)}makeProxy(t){const{id:e}=t,i=new Ah;this.targets[e]=i}getProxy(t){return this.targets[t]}handleEvent(t){var e;null==(e=this.targets[t.id])||e.handleEvent(t.data)}static instance(){return Ch}}const Ch=new Th;const Ih=Dh(["ctrlKey","metaKey","shiftKey","button","pointerType","clientX","clientY","pointerId","pageX","pageY"]);function Dh(t){return function(e,i){const n={type:e.type};!function(t,e,i){for(const n of e)i[n]=t[n]}(e,t,n),i(n)}}function Lh(t,e){t.preventDefault();const i=[],n={type:t.type,touches:i};for(let e=0;e<t.touches.length;++e){const n=t.touches[e];i.push({pageX:n.pageX,pageY:n.pageY,clientX:n.clientX,clientY:n.clientY})}e(n)}const Bh=Dh(["deltaMode","deltaX","deltaY","clientX","clientY"]),Ph={37:!0,38:!0,39:!0,40:!0},kh=Dh(["ctrlKey","metaKey","shiftKey","keyCode"]);const Nh={contextmenu:function(t){t.preventDefault()},mousedown:Ih,mousemove:Ih,mouseup:Ih,pointerdown:Ih,pointermove:Ih,pointerup:Ih,touchstart:Lh,touchmove:Lh,touchend:Lh,wheel:function(t,e){t.preventDefault(),Bh(t,e)},keydown:function(t,e){const{keyCode:i}=t;Ph[i]&&(t.preventDefault(),kh(t,e))}};class Oh extends Fi{constructor(t,e){super(),c(this,"name","Handler"),c(this,"dom"),c(this,"camera"),c(this,"domOffset",new We),c(this,"enabled",!0),c(this,"_hoverEnabled",!1),c(this,"scenes",[]),c(this,"rayCaster",new ur),c(this,"contextMenuHandler",this.handleContextMenu.bind(this)),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"pointerOverHandler",ri.debounce(this.handlePointerOver.bind(this),20)),c(this,"panHandler",this.handlePan.bind(this)),c(this,"_hovered"),this.dom=t,this.camera=e,this.resize(),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.dispose()}dispose(){this.scenes=[]}enableHover(t){return this._hoverEnabled=t,this}resize(){let t=this.dom.getBoundingClientRect();this.domOffset.set(t.left,t.top)}bindScene(...t){return this.scenes.length=0,this.scenes.push(...t),this}bindEvents(){this.unbindEvents(),this.dom.addEventListener("contextmenu",this.contextMenuHandler),this.dom.addEventListener("singletap",this.tapHandler),this.dom.addEventListener("panstart",this.panHandler),this.dom.addEventListener("panmove",this.panHandler),this.dom.addEventListener("panend",this.panHandler),this.dom.addEventListener("mousemove",this.pointerOverHandler)}unbindEvents(){this.dom.removeEventListener("contextmenu",this.contextMenuHandler),this.dom.removeEventListener("singletap",this.tapHandler),this.dom.removeEventListener("panstart",this.panHandler),this.dom.removeEventListener("panmove",this.panHandler),this.dom.removeEventListener("panend",this.panHandler),this.dom.removeEventListener("mousemove",this.pointerOverHandler)}handleContextMenu(t){this.enabled&&"function"==typeof t.preventDefault&&t.preventDefault()}handlePointerDown(t){}handlePointerMove(t){}handlePointerUp(t){}handleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),Hh.set(t.center.x,t.center.y).sub(this.domOffset),Wh.copy(Hh).unproject(this.camera),this.dispatchEvent({type:"tap",data:{screenCoords:{x:Hh.x,y:Hh.y},worldCoords:{x:Wh.x,y:Wh.y}},e:t})}handlePan(t){var e,i;"function"==typeof t.preventDefault&&t.preventDefault(),Hh.set(null==(e=t.center)?void 0:e.x,null==(i=t.center)?void 0:i.y).sub(this.domOffset),Wh.copy(Hh).unproject(this.camera);const n={screenCoords:{x:Hh.x,y:Hh.y},worldCoords:{x:Wh.x,y:Wh.y}},s={type:"panmove",data:n};(t.isFirst||"panstart"===t.type)&&(s.type="panstart"),(t.isLast||"panend"===t.type)&&(s.type="panend");const{id:r,target:a}=this.getHover(n);r&&ri.set(s,"data.id",r),a&&ri.set(s,"data.target",a),this.dispatchEvent(s)}handlePointerOver(t){if(!this._hoverEnabled||t.buttons>0)return;const e=this._hovered;Hh.set(t.clientX,t.clientY).sub(this.domOffset),Wh.copy(Hh).unproject(this.camera);let i={screenCoords:{x:Hh.x,y:Hh.y},worldCoords:{x:Wh.x,y:Wh.y}};const n=this._hovered=this.getHover(i),s=l(l({},i),n);this.setCursor((null==n?void 0:n.target)?"pointer":"default"),(null==n?void 0:n.id)!==(null==e?void 0:e.id)&&(null==e?void 0:e.target)&&this.dispatchEventByTarget(e.target,{type:"pointerout",data:l(l({},i),e)}),(null==n?void 0:n.target)&&this.dispatchEventByTarget(n.target,{type:"pointermove",data:s}),(null==n?void 0:n.target)&&(null==n?void 0:n.target)!==(null==e?void 0:e.target)&&this.dispatchEventByTarget(n.target,{type:"pointerover",data:s}),this.dispatchEvent({type:"pointermove",data:s})}getHover(t){var e;const{screenCoords:i,worldCoords:n}=t||{},s={id:void 0,target:void 0},r=[],a=this.scenes.find((t=>t.isDynamic));if(a&&(this.rayCaster.init(t,this.camera).intersectObjectBy(a,Rh,!0,r),r.length))return s.isDynamic=!0,zh(r,s),s;for(let i,n=0,s=(null==(e=this.scenes)?void 0:e.length)||0;n<s;n++)i=this.scenes[n],i.isDynamic||this.rayCaster.init(t,this.camera).intersectObjectBy(i,Rh,!0,r);return r.length&&(s.isStatic=!0,zh(r,s)),s}dispatchEventByTarget(t,e){var i;if(!(null==t?void 0:t.visible))return;let n=!1;for(;t&&(n=null==(i=t.userData)?void 0:i.cancelBubble,"function"==typeof t.dispatchEvent&&t.dispatchEvent(e),t=t.parent,!n););n||this.dispatchEvent(e)}setCursor(t){this.dom instanceof Ah&&"function"==typeof self.postMessage?self.postMessage({type:"setCursor",cursorStyle:t}):this.dom.style&&(this.dom.style.cursor=t||"default")}}function Rh(t){return t.visible}function zh(t,e={}){var i,n,s;let r=t.find((t=>{var e,i;return t.visible&&t.selectable&&(null==(e=t.userData)?void 0:e.assetType)===(null==(i=Ae.config)?void 0:i.assetType)}));return r?(e.id=(null==(i=r.userData)?void 0:i.id)||r.name,e.target=r,(null==(n=r.userData)?void 0:n.assetType)&&(e.assetType=null==(s=r.userData)?void 0:s.assetType),r.isDummy&&(e.isDummy=!0),e):e}const Hh=new We,Wh=new We;var Fh=(t=>(t.CONTEXTMENU="contextmenu",t.MOUSEDOWN="mousedown",t.MOUSEMOVE="mousemove",t.MOUSEUP="mouseup",t.POINTERDOWN="pointerdown",t.POINTERMOVE="pointermove",t.POINTERUP="pointerup",t.POINTEROUT="pointerout",t.POINTEROVER="pointerover",t.TOUCHSTART="touchstart",t.TOUCHMOVE="touchmove",t.TOUCHEND="touchend",t.WHEEL="wheel",t.WHEEL_END="wheelend",t.KEYDOWN="keydown",t.TAP="tap",t.SINGLE_TAP="singletap",t.DOUBLE_TAP="doubletap",t.PRESS="press",t.HOVER="hover",t.PAN_START="panstart",t.PAN_MOVE="panmove",t.PAN_END="panend",t))(Fh||{});class Uh extends Fi{constructor(t,e){super(),c(this,"name","OrbitControls2"),c(this,"isSvg",!1),c(this,"dom"),c(this,"domOffset",new We),c(this,"camera"),c(this,"enabled",!0),c(this,"enablePan",!0),c(this,"enableRotate",!0),c(this,"rotateSpeed",1),c(this,"enableZoom",!0),c(this,"minZoom",0),c(this,"maxZoom",1/0),c(this,"zoomSpeed",1),c(this,"zoomChanged",!1),c(this,"distanceStart",1),c(this,"distanceEnd",1),c(this,"state",-1),c(this,"EPS",1e-6),c(this,"focus",new We),c(this,"target",new We),c(this,"scaled",1),c(this,"rotateTheta",0),c(this,"enableDamping",!1),c(this,"dampingFactor",.05),c(this,"mouseButtons",{LEFT:2,MIDDLE:1,RIGHT:0}),c(this,"isWheeling",!1),c(this,"finalTimer"),c(this,"rotateStart",new We),c(this,"rotateEnd",new We),c(this,"rotateDelta",new We),c(this,"panStart",new We),c(this,"panEnd",new We),c(this,"panOffset",new We),c(this,"dollyStart",0),c(this,"dollyOffset",new We),c(this,"contextMenuHandler",this.handleContextMenu.bind(this)),c(this,"wheelHandler",this.handleWheel.bind(this)),c(this,"pointerDownHandler",this.handlePointerDown.bind(this)),c(this,"pointerUpHandler",this.handlePointerUp.bind(this)),c(this,"pointerMoveHandler",this.handlePointerMove.bind(this)),c(this,"pointerOverHandler",ri.debounce(this.handlePointerOver.bind(this),100)),c(this,"pointerLeaveHandler",this.handlePointerLeave.bind(this)),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"panHandler",this.handlePan.bind(this)),c(this,"pinchHandler",this.handlePinch.bind(this)),c(this,"pressHandler",this.handlePress.bind(this)),c(this,"swipeHandler",this.handleSwipe.bind(this)),c(this,"hammerInputHandler",this.handleHammerInput.bind(this)),this.dom=t,this.camera=e,this.scaled=e.scaled.x,this.resize(),this.dom.style.touchAction="none",this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}resize(){let t=this.dom.getBoundingClientRect();this.domOffset.set(t.left,t.top)}update(){this.camera.position.add(this.panOffset).add(this.dollyOffset),this.camera.scaled.set(this.scaled,this.scaled),this.rotateTheta&&(this.camera.rotation.x-=this.rotateTheta,Vh.copy(this.camera.position).rotateAround(this.focus,-this.rotateTheta),this.camera.position.copy(Vh)),this.camera.update(),this.panOffset.set(0,0),this.dollyOffset.set(0,0),this.scaled=this.camera.scaled.x,this.rotateTheta=0,this.dispatchEvent({type:"cameraChanged",data:{t:this.camera.position,r:this.camera.rotation.x,s:this.camera.scaled.x}})}bindEvents(){this.unbindEvents(),this.dom.addEventListener("panstart",this.panHandler),this.dom.addEventListener("panmove",this.panHandler),this.dom.addEventListener("panend",this.panHandler),this.dom.addEventListener("pinchstart",this.pinchHandler),this.dom.addEventListener("pinchmove",this.pinchHandler),this.dom.addEventListener("pinchend",this.pinchHandler),this.dom.addEventListener("singletap",this.tapHandler),this.dom.addEventListener("press",this.pressHandler),this.dom.addEventListener("hammer.input",this.hammerInputHandler),this.dom.addEventListener("contextmenu",this.contextMenuHandler),this.dom.addEventListener("wheel",this.wheelHandler,{passive:!1}),this.dom.addEventListener("mousemove",this.pointerOverHandler)}unbindEvents(){this.dom.removeEventListener("panstart",this.panHandler),this.dom.removeEventListener("panmove",this.panHandler),this.dom.removeEventListener("panend",this.panHandler),this.dom.removeEventListener("pinchstart",this.pinchHandler),this.dom.removeEventListener("pinchmove",this.pinchHandler),this.dom.removeEventListener("pinchend",this.pinchHandler),this.dom.removeEventListener("singletap",this.tapHandler),this.dom.removeEventListener("press",this.pressHandler),this.dom.removeEventListener("hammer.input",this.hammerInputHandler),this.dom.removeEventListener("contextmenu",this.contextMenuHandler),this.dom.removeEventListener("wheel",this.wheelHandler),this.dom.removeEventListener("mousemove",this.pointerOverHandler)}setFocus(t,e){this.focus.set(t,e).sub(this.domOffset).unproject(this.camera)}handleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),qh.set(t.center.x,t.center.y).sub(this.domOffset),this.dispatchEvent({type:"tap",data:{screenCoords:{x:qh.x,y:qh.y}},e:t})}handleDoubleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),qh.set(t.center.x,t.center.y).sub(this.domOffset),this.dispatchEvent({type:"doubletap",data:{screenCoords:{x:qh.x,y:qh.y}}})}handlePress(t){"function"==typeof t.preventDefault&&t.preventDefault()}handlePan(t){var e;if(this.scaled=this.camera.scaled.x,1!==(null==(e=t.pointers)?void 0:e.length))return;"function"==typeof t.preventDefault&&t.preventDefault();const i={type:"panmove",data:{}};(t.isFirst||"panstart"===t.type)&&(this.state=2,this.panStart.set(t.center.x,t.center.y),i.type="panstart"),(t.isFinal||"panend"===t.type)&&(this.state=-1,i.type="panend"),this.panEnd.set(t.center.x,t.center.y),this.panOffset.subVectors(this.panEnd,this.panStart).multiplyScalar(-this.camera.scaled.x,-this.camera.scaled.y*(this.camera.flipY?1:-1)).rotate(this.camera.rotation.x),this.panStart.copy(this.panEnd),qh.set(t.center.x,t.center.y).sub(this.domOffset),i.data.screenCoords=qh.clone(),this.dispatchEvent(i),this.enablePan&&this.update()}handlePinch(t){"function"==typeof t.preventDefault&&t.preventDefault(),"pinchstart"===t.type&&(this.dollyStart=this.camera.scaled.x,this.state=1),(t.isFinal||"pinchend"===t.type)&&(this.state=-1),this.scaled=this.dollyStart*(1/t.scale);let e=(this.scaled-this.camera.scaled.x)/this.camera.scaled.x;this.setFocus(t.center.x,t.center.y),this.dollyOffset.copy(this.camera.position).lerp(this.focus,-e).sub(this.camera.position),this.update()}handleRotate(t){"function"==typeof t.preventDefault&&t.preventDefault()}handleSwipe(t){"function"==typeof t.preventDefault&&t.preventDefault()}handleHammerInput(t){t.isFirst&&(this.state=9),t.isFinal&&(this.state=-1)}handleContextMenu(t){this.enabled&&"function"==typeof t.preventDefault&&t.preventDefault()}handleWheel(t){if("function"==typeof t.preventDefault&&t.preventDefault(),!this.enabled||!this.enableZoom||-1!==this.state)return;this.isWheeling||(this.dispatchEvent({type:"wheelstart"}),this.isWheeling=!0),"function"==typeof t.preventDefault&&t.preventDefault(),"function"==typeof t.stopPropagation&&t.stopPropagation();let e=t.deltaY;1===(null==t?void 0:t.deltaMode)?e*=16:2===(null==t?void 0:t.deltaMode)&&(e*=100),(null==t?void 0:t.ctrlKey)&&(e*=10),this.setFocus(t.clientX,t.clientY);let i=this.getZoomScale(e);e<0?this.onDollyIn(i):e>0?this.onDollyOut(i):(this.scaled=this.camera.scaled.x,this.dollyOffset.set(0,0)),this.update(),clearTimeout(this.finalTimer),this.finalTimer=setTimeout((()=>{this.isWheeling&&(this.dispatchEvent({type:"wheelend"}),this.isWheeling=!1)}),500)}onDollyIn(t){this.scaled=Math.max(this.minZoom,Math.min(this.maxZoom,this.camera.scaled.x*t)),this.dollyOffset.copy(this.camera.position).lerp(this.focus,1-t).sub(this.camera.position)}onDollyOut(t){this.scaled=Math.max(this.minZoom,Math.min(this.maxZoom,this.camera.scaled.x/t)),this.dollyOffset.copy(this.camera.position).lerp(this.focus,-1+t).sub(this.camera.position)}getZoomScale(t){return Math.pow(.95,this.zoomSpeed*Math.abs(.03*t))}handlePointerDown(t){if(this.scaled=this.camera.scaled.x,!this.enabled)return;if(2!==t.button)return;this.dom.addEventListener("pointermove",this.pointerMoveHandler),this.dom.addEventListener("pointerup",this.pointerUpHandler);let e=-1;0===t.button?e=this.mouseButtons.LEFT:1===t.button?e=this.mouseButtons.MIDDLE:2===t.button&&(e=this.mouseButtons.RIGHT),0===e&&(this.rotateStart.set(t.clientX,t.clientY),this.setFocus(this.rotateStart.x,this.rotateStart.y),this.state=0)}handlePointerUp(){this.dom.removeEventListener("pointermove",this.pointerMoveHandler),this.dom.removeEventListener("pointerup",this.pointerUpHandler),this.state=-1}handlePointerLeave(){this.state=-1}handlePointerMove(t){if(this.enabled&&0===this.state){if(!this.enableRotate)return;this.onRotate(t.clientX,t.clientY)}}handlePointerOver(t){t.buttons>0||(qh.set(t.clientX,t.clientY).sub(this.domOffset),this.dispatchEvent({type:"pointerover",data:{screenCoords:{x:qh.x,y:qh.y}},e:t}))}onRotate(t,e){this.rotateEnd.set(t,e),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);const i=this.rotateDelta.x*Math.PI*2/this.dom.clientHeight;this.rotateTheta-=i,this.rotateStart.copy(this.rotateEnd),this.update()}}const Vh=new We,qh=new We;var jh=(t=>(t.CONTEXTMENU="contextmenu",t.LOSTPOINTERCAPTURE="lostpointercapture",t.MOUSEOVER="mouseover",t.MOUSEOUT="mouseout",t.MOUSELEAVE="mouseleave",t.MOUSEENTER="mouseenter",t.MOUSEMOVE="mousemove",t.MOUSEDOWN="mousedown",t.MOUSEUP="mouseup",t.POINTERMOVE="pointermove",t.POINTERDOWN="pointerdown",t.POINTERUP="pointerup",t.POINTERCANCEL="pointercancel",t.POINTEROUT="pointerout",t.POINTERLEAVE="pointerleave",t.POINTEROVER="pointerover",t.POINTERENTER="pointerenter",t.TOUCHSTART="touchstart",t.TOUCHEND="touchend",t.TOUCHMOVE="touchmove",t.TOUCHCANCEL="touchcancel",t.WHEEL="wheel",t.WHEEL_START="wheelstart",t.WHEEL_END="wheelend",t.MOUSEWHEEL="mousewheel",t.CLICK="click",t.DBLCLICK="dblclick",t.CONTEXT_LOST="contextlost",t.CONTEXT_RESTORED="contextrestored",t.CONTROLS_CHANGED="controlschanged",t.TAP="tap",t.SINGLE_TAP="singletap",t.DOUBLE_TAP="doubletap",t.PRESS="press",t.PAN="pan",t.PAN_START="panstart",t.PAN_MOVE="panmove",t.PAN_END="panend",t.ROTATE="rotate",t.ROTATE_START="rotatestart",t.ROTATE_MOVE="rotatemove",t.ROTATE_END="rotateend",t.PINCH="pinch",t.PINCH_START="pinchstart",t.PINCH_MOVE="pinchmove",t.PINCH_END="pinchend",t.PINCH_IN="pinchin",t.PINCH_OUT="pinchout",t.SWIPE="swipe",t.CHANGE_START="change_start",t.CHANGE_END="change_end",t.CAMERA_CHANGED="cameraChanged",t))(jh||{});class Yh{constructor(t){c(this,"params"),c(this,"percent"),c(this,"path"),c(this,"boundingBox",new ai),this.params=t,this.percent=null==t?void 0:t.percent}_init(t){return this.attr(t),this}attr(t,e){if(!t)return this;if("string"==typeof t)this.attrKV(t,e);else if("object"==typeof t){let e=Object.keys(t);for(let i,n=0,s=e.length;n<s;n++)i=e[n],this.attrKV(i,t[i])}return this}attrKV(t,e){return this[t]=e,this}buildPath(t,e,i){}setPoints(t){return t&&t.length?(this.points=t,this):this}computeBoundingBox(t=new ai){return this.boundingBox.makeEmpty(),this.path||(this.path=new yn),this.path.reset(),this.buildPath(this.path,this),this.path.computeBoundingBox(this.boundingBox),t.copy(this.boundingBox),t}isPointInBoundingBox(t){return!!this.boundingBox&&this.boundingBox.containsPoint(t)}isPointInPath(t){return!!this.isPointInBoundingBox(t)&&("function"==typeof Path2D?this.isPointInPathByPath2D(t):this.isPointInPathByCtx(t))}isPointInPathByCtx(t){let e=!1;return Gh.save(),this.buildPath(Gh,this),e=Gh.isPointInPath(t.x,t.y),Gh.restore(),e}isPointInPathByPath2D(t){if(!Path2D)return!1;const e=new Path2D;return this.buildPath(e,this),Gh.isPointInPath(e,t.x,t.y)}isBoxIntersectsBoundingBox(t){return!!this.boundingBox&&this.boundingBox.intersectsBox(t)}isBoxIntersectsPath(t){return!!this.isBoxIntersectsBoundingBox(t)}}const Gh=Pn.get("RAY_CASTER",10,10).getContext("2d");class $h extends Yh{constructor(t){super(t),this._init(t),this.flipY&&this.scale(1,-1)}initByPathProxy(t){var e;if(!t||!(null==(e=t.data)?void 0:e.length))throw new Error("GeoShape.initByPathProxy: path is required.");this.path=t;const i=t.data,n=[];let s=0;for(s=0;s<i.length;){switch(i[s++]){case ln:n.push([ln,i[s++],i[s++]]);break;case un:n.push([un,i[s++],i[s++]]);break;case cn:n.push([cn,i[s++],i[s++],i[s++],i[s++],i[s++],i[s++]]);break;case dn:n.push([dn,i[s++],i[s++],i[s++],i[s++]]);break;case pn:n.push([pn,i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++]]);break;case mn:n.push([mn,i[s++],i[s++],i[s++],i[s++]]);break;case gn:n.push([gn,i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++]]);break;case fn:n.push([fn])}}return this.cmds=n,this}computeBoundingBox(t=new ai){return super.computeBoundingBox(t),this.boundingBox}buildPath(t,e,i){if(0===this.percent)return;const{cmds:n}=this;for(let e=0,i=(null==n?void 0:n.length)||0;e<i;e++){const[i,...s]=n[e];switch(i){case ln:t.moveTo(...s);break;case un:t.lineTo(...s);break;case cn:t.bezierCurveTo(...s);break;case dn:t.quadraticCurveTo(...s);break;case pn:t.arc(s[0],s[1],s[2],s[3],s[4],!!s[5]);break;case fn:t.closePath();break;case mn:t.rect(...s);break;case gn:t.ellipse(s[0],s[1],s[2],s[3],s[4],s[5],s[6],!!s[7])}}}scale(t,e){this.transform(Xh.makeScale(t,e))}transform(t){const e=[],{cmds:i}=this;for(let n=0,s=(null==i?void 0:i.length)||0;n<s;n++){const[s,...r]=i[n];switch(s){case ln:case un:case mn:Zh.set(r[0],r[1]).applyMatrix3(t),e[n]=[s,Zh.x,Zh.y];break;case cn:Zh.set(r[0],r[1]).applyMatrix3(t),Jh.set(r[2],r[3]).applyMatrix3(t),Qh.set(r[4],r[5]).applyMatrix3(t),e[n]=[s,Zh.x,Zh.y,Jh.x,Jh.y,Qh.x,Qh.y];break;case dn:Zh.set(r[0],r[1]).applyMatrix3(t),Jh.set(r[2],r[3]).applyMatrix3(t),e[n]=[s,Zh.x,Zh.y,Jh.x,Jh.y];break;case pn:Zh.set(r[0],r[1]).applyMatrix3(t),e[n]=[s,Zh.x,Zh.y,r[2],r[3],r[4],r[5],r[6]];break;case gn:{Zh.set(r[0],r[1]).applyMatrix3(t);const[i,a,o,h,l,u,c,d]=r,p=-l,f=-u,m=-c,g=!d;e[n]=[s,Zh.x,Zh.y,o,h,p,f,m,g?1:0];break}case fn:e[n]=[s]}}this.cmds=e}}const Xh=new Ui,Zh=new We,Jh=new We,Qh=new We;class Kh{static getPathProxyByNode(t){if(!t)return;return Nn.getInstance().parseNode(t)}static mergeGeoShapes(t,e){var i,n,s;if(!(null==t?void 0:t.length))throw new Error("empty geos");const r={cmds:ri.flatMap(t,(t=>t.cmds||[]))};(null==(i=t[0])?void 0:i.lineWidth)&&(r.lineWidth=t[0].lineWidth),(null==(n=t[0])?void 0:n.thinLine)&&(r.thinLine=t[0].thinLine),(null==(s=t[0])?void 0:s.closed)&&(r.closed=t[0].closed);return new $h(r)}static getArrowByPathProxy(t,e={},i=new yn){i.dispose();const{arrowType:n=0,arrowLength:s=10,arrowDeg:r=30}=e||{};if(!t||!n)return i;const a=t.getVertices();if(!(null==a?void 0:a.length)||a.length<4)return i;if(n>0){if(il.set(a[2],a[3]),sl.set(a[0],a[1]),il.equals(sl))return i;nl.subVectors(il,sl),rl.lerpVectors(sl,il,s/nl.length()),al.copy(rl).rotateAround(sl,Ie(r)),ol.copy(rl).rotateAround(sl,-Ie(r))}else{const t=a.length;if(il.set(a[t-4],a[t-3]),sl.set(a[t-2],a[t-1]),il.equals(sl))return i;nl.subVectors(il,sl),rl.lerpVectors(sl,il,s/nl.length()),al.copy(rl).rotateAround(sl,Ie(r)),ol.copy(rl).rotateAround(sl,-Ie(r))}return rl.lerpVectors(sl,rl,.6),el.subVectors(sl,rl),tl.makeTranslation(el.x,el.y),sl.applyMatrix3(tl),rl.applyMatrix3(tl),al.applyMatrix3(tl),ol.applyMatrix3(tl),i.moveTo(rl.x,rl.y),i.lineTo(al.x,al.y),i.lineTo(sl.x,sl.y),i.lineTo(ol.x,ol.y),i.lineTo(rl.x,rl.y),i}}const tl=new Ui,el=new We,il=new We,nl=new We,sl=new We,rl=new We,al=new We,ol=new We;class hl extends th{constructor(t,e){super(t,e),c(this,"type",Go.DRAW_POLYLINE),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),c(this,"_mpId",`${this._cpsId}-m-`),c(this,"_bblId",`${this._cpsId}-bbl`),c(this,"_spId",`${this._cpsId}-scale`),c(this,"_rpId",`${this._cpsId}-rotate`),c(this,"_dpId",`${this._cpsId}-del`),c(this,"_tipsId",`${this.type}-tips`),c(this,"_cpsLimit",2),c(this,"strokeArrow",0),c(this,"arrowShape"),this._controlPoints=this.getControlPoints(),this._boundingBoxLine=this.getBoundingBoxLine(),this._tips=this.getTips()}activate(){super.activate()}deactivate(){super.deactivate()}editorStrokeWidthChanged(t){super.editorStrokeWidthChanged(t),this.updateArrowShape()}editorStrokeArrowChanged(t){this._bindedShape&&(this.strokeArrow=t,this.updateArrowShape())}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i="none",n=new Re(Ae.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),s=Ae.config.editor.strokeWidth||5,r=ll/2,a=(new yn).moveTo(-50,-50).lineTo(r,r);e=Kn({id:t,fill:i,stroke:n,strokeWidth:s,d:a.data}),t&&(e.setAttribute(`${ki}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints))}return e}getControlPoints(){const t=super.getControlPoints();this._bindedShape?Nn.getPathProxyBySvgPathD(this._bindedShape.getAttribute("d"),wl.dispose()):Nn.getPathProxyBySvgPathD(this.getShape().getAttribute("d"),wl.dispose());const e=wl.getControlPoints(),i=Ae.config.editor.strokeWidth;for(let n=0,s=e.length;n<s;n++){const s=n?this._cpFill:this._cpStroke,r=Qn({id:`${this._cpId}${n+1}`,x:0,y:0,r:i,fill:s,stroke:this._cpStroke});if(r.setAttribute(`${ki}-type`,(Go.DRAW_POLYGON|Go.DRAG).toString()),t.appendChild(r),!n)continue;cl.copy(e[n-1]),ul.copy(e[n]).add(cl).multiplyScalar(.5);const a=Qn({id:`${this._mpId}${n+1}`,x:0,y:0,r:i,fill:this._mpFill,stroke:this._mpStroke});a.setAttribute(`${ki}-type`,(Go.DRAW_POLYGON|Go.DRAG).toString()),t.appendChild(a)}return t}getArrowShape(t){if(!t)return;if(!this._bindedShape)return;const e=new Re(Ae.config.editor.stroke||Le.darkGreen).setA(1).getStyle(),i=new Re(Ae.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),n=Ae.config.editor.strokeWidth||5;if(!this.arrowShape){const i=`${this.type}-${t>0?"st":"ed"}-arrow`;this.arrowShape=Kn({id:i,fill:e})}this.arrowShape.setAttribute("fill",e),this.arrowShape.setAttribute("stroke",i),Kh.getArrowByPathProxy(wl,{arrowType:this.strokeArrow,arrowLength:3*n},_l.dispose());const s=Nn.getSvgPathDByData(_l.data);return this.arrowShape.setAttribute("d",s),this.arrowShape}beforeDragStart(t){this.splitByControlPoint(null==t?void 0:t.target,null==t?void 0:t.center)}handleDragStart(t){super.handleDragStart(t),this.updateArrowShape()}handleDragMove(t){super.handleDragMove(t),this.updateArrowShape()}handleDragEnd(t){super.handleDragEnd(t),this.updateArrowShape()}handleDoubleTap(t){var e,i;if((null==t?void 0:t.type)!==jh.DOUBLE_TAP)return;const n=this._getIntersect(this._controlPoints.children,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this.mergeByControlPoint(n,null==(i=null==t?void 0:t.data)?void 0:i.worldCoords),this.updateControlPoints(this._controlPoints),this.updateBoundingBoxLine(),this.updateOperations(),this.updateTips()}updateControlPoints(t,e){var i;if(!t)return;if(!this._bindedShape)return;if(Nn.getPathProxyBySvgPathD(null==(i=this._bindedShape)?void 0:i.getAttribute("d"),wl.dispose()),wl.getControlPoints(Sl),!(null==Sl?void 0:Sl.length))return;const n=t.id;if(Nn.parseNodeTransform(this._bindedShape,vl).decompose(fl,ml,gl),e||(e=fl.clone()),xl.makeScale(gl.x,gl.y).premultiply(bl.makeRotation(ml.x)),t===this._controlPoints)for(let t=0,i=Sl.length;t<i;t++){cl.copy(Sl[t]).applyMatrix3(xl),dl.copy(Sl[t?t-1:i-1]).applyMatrix3(xl),pl.copy(e).add(cl);es(ri.find(this._controlPoints.children,(e=>e.id===`${this._cpId}${t+1}`)),pl),pl.addVectors(dl,cl).multiplyScalar(.5).add(e);es(ri.find(this._controlPoints.children,(e=>e.id===`${this._mpId}${t+1}`)),pl)}else if(ri.startsWith(n,this._cpId)){pl.copy(e),es(t,pl);const i=this.getCpIdx(n),s=i?i-1:Sl.length-1,r=i===Sl.length-1?0:i+1;Sl[i].copy(pl.copy(e).applyMatrix3(vl.invert()));const a=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i+1}`));cl.copy(Sl[s]).applyMatrix3(xl),dl.copy(Sl[i]).applyMatrix3(xl),pl.addVectors(cl,dl).multiplyScalar(.5).sub(dl).add(e),es(a,pl);const o=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i===Sl.length-1?1:i+2}`));cl.copy(Sl[i]).applyMatrix3(xl),dl.copy(Sl[r]).applyMatrix3(xl),pl.addVectors(cl,dl).multiplyScalar(.5).sub(cl).add(e),es(o,pl)}else ri.startsWith(n,this._mpId)&&es(t,e);this.updateControlPointsRadius()}updateByControlPoints(t){var e;if(!this._bindedShape||!this._bindedControlPoint||!(null==(e=wl.data)?void 0:e.length))return;const i=this._bindedControlPoint.id;if(ri.startsWith(i,this._mpId))return;if(ri.startsWith(i,this._spId)||ri.startsWith(i,this._rpId))return;Nn.getBoundingBoxByNode(this._controlPoints,yl).getCenter(cl),Nn.parseNodeTransform(this._bindedShape,vl),cl.copy(t).applyMatrix3(vl.invert()),wl.getControlPoints(Sl);const n=this.getCpIdx(i);Sl[n].copy(cl),wl.dispose();for(let t=0,e=Sl.length;t<e;t++)t?wl.lineTo(Sl[t].x,Sl[t].y):wl.moveTo(Sl[t].x,Sl[t].y);const s=Nn.getSvgPathDByData(wl.data);this._bindedShape.setAttribute("d",s)}updateArrowShape(){var t,e,i;if(!this._bindedShape||!(null==(t=wl.data)?void 0:t.length))return;this.arrowShape&&this.unmountShape(this.arrowShape),this.arrowShape=this.getArrowShape(this.strokeArrow),this.arrowShape&&this.mountShape(this.arrowShape,this._controlPoints);const n=this._bindedShape.getAttribute("transform");n?null==(e=this.arrowShape)||e.setAttribute("transform",n):null==(i=this.arrowShape)||i.removeAttribute("transform")}}const ll=100,ul=new We,cl=new We,dl=new We,pl=new We,fl=new We,ml=new We,gl=new We,yl=new ai,vl=new Ui,xl=new Ui,bl=new Ui,wl=new yn,_l=new yn,Sl=[];class El extends th{constructor(t,e){super(t,e),c(this,"type",Go.DRAW_POLYGON),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),c(this,"_mpId",`${this._cpsId}-m-`),c(this,"_bblId",`${this._cpsId}-bbl`),c(this,"_spId",`${this._cpsId}-scale`),c(this,"_rpId",`${this._cpsId}-rotate`),c(this,"_dpId",`${this._cpsId}-del`),c(this,"_tipsId",`${this.type}-tips`),c(this,"_cpsLimit",3),this._controlPoints=this.getControlPoints(),this._boundingBoxLine=this.getBoundingBoxLine(),this._tips=this.getTips()}activate(){super.activate()}deactivate(){super.deactivate()}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i=new Re(Ae.config.editor.fill||Le.green).setA(.6).getStyle(),n=new Re(Ae.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),s=Ae.config.editor.strokeWidth||5,r=Ml/2,a=(new yn).moveTo(-50,r).lineTo(r,r).lineTo(r,-50).lineTo(-50,-50).closePath();e=Kn({id:t,fill:i,stroke:n,strokeWidth:s,d:a.data}),t&&(e.setAttribute(`${ki}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints))}return e}getControlPoints(){const t=super.getControlPoints();this._bindedShape?Nn.getPathProxyBySvgPathD(this._bindedShape.getAttribute("d"),Ol.dispose()):Nn.getPathProxyBySvgPathD(this.getShape().getAttribute("d"),Ol.dispose());const e=Ol.getControlPoints(),i=Ae.config.editor.strokeWidth;for(let n=0,s=e.length;n<s;n++){const r=n?this._cpFill:this._cpStroke,a=Qn({id:`${this._cpId}${n+1}`,x:0,y:0,r:i,fill:r,stroke:this._cpStroke});a.setAttribute(`${ki}-type`,(Go.DRAW_POLYGON|Go.DRAG).toString()),t.appendChild(a),n?Tl.copy(e[n-1]):Tl.copy(e[s-1]),Al.copy(e[n]).add(Tl).multiplyScalar(.5);const o=Qn({id:`${this._mpId}${n+1}`,x:0,y:0,r:i,fill:this._mpFill,stroke:this._mpStroke});o.setAttribute(`${ki}-type`,(Go.DRAW_POLYGON|Go.DRAG).toString()),t.appendChild(o)}return t}beforeDragStart(t){this.splitByControlPoint(null==t?void 0:t.target,null==t?void 0:t.center)}handleDoubleTap(t){var e,i;if((null==t?void 0:t.type)!==jh.DOUBLE_TAP)return;const n=this._getIntersect(this._controlPoints.children,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this.mergeByControlPoint(n,null==(i=null==t?void 0:t.data)?void 0:i.worldCoords),this.updateControlPoints(this._controlPoints),this.updateBoundingBoxLine(),this.updateOperations(),this.updateTips()}updateControlPoints(t,e){var i;if(!t)return;if(!this._bindedShape)return;if(Nn.getPathProxyBySvgPathD(null==(i=this._bindedShape)?void 0:i.getAttribute("d"),Ol.dispose()),Ol.getControlPoints(Rl),!(null==Rl?void 0:Rl.length))return;const n=t.id;if(Nn.parseNodeTransform(this._bindedShape,Pl).decompose(Dl,Ll,Bl),e||(e=Dl.clone()),kl.makeScale(Bl.x,Bl.y).premultiply(Nl.makeRotation(Ll.x)),t===this._controlPoints)for(let t=0,i=Rl.length;t<i;t++){Tl.copy(Rl[t]).applyMatrix3(kl),Cl.copy(Rl[t?t-1:i-1]).applyMatrix3(kl),Il.copy(e).add(Tl);es(ri.find(this._controlPoints.children,(e=>e.id===`${this._cpId}${t+1}`)),Il),Il.addVectors(Cl,Tl).multiplyScalar(.5).add(e);es(ri.find(this._controlPoints.children,(e=>e.id===`${this._mpId}${t+1}`)),Il)}else if(ri.startsWith(n,this._cpId)){Il.copy(e),es(t,Il);const i=this.getCpIdx(n),s=i?i-1:Rl.length-1,r=i===Rl.length-1?0:i+1;Rl[i].copy(Il.copy(e).applyMatrix3(Pl.invert()));const a=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i+1}`));Tl.copy(Rl[s]).applyMatrix3(kl),Cl.copy(Rl[i]).applyMatrix3(kl),Il.addVectors(Tl,Cl).multiplyScalar(.5).sub(Cl).add(e),es(a,Il);const o=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i===Rl.length-1?1:i+2}`));Tl.copy(Rl[i]).applyMatrix3(kl),Cl.copy(Rl[r]).applyMatrix3(kl),Il.addVectors(Tl,Cl).multiplyScalar(.5).sub(Tl).add(e),es(o,Il)}else ri.startsWith(n,this._mpId)&&es(t,e);this.updateControlPointsRadius()}updateByControlPoints(t){var e;if(!this._bindedShape||!this._bindedControlPoint||!(null==(e=Ol.data)?void 0:e.length))return;const i=this._bindedControlPoint.id;if(ri.startsWith(i,this._mpId))return;if(ri.startsWith(i,this._spId)||ri.startsWith(i,this._rpId))return;Nn.parseNodeTransform(this._bindedShape,Pl),Tl.copy(t).applyMatrix3(Pl.invert()),Ol.getControlPoints(Rl);const n=this.getCpIdx(i);Rl[n].copy(Tl),Ol.dispose();for(let t=0,e=Rl.length;t<e;t++)t?Ol.lineTo(Rl[t].x,Rl[t].y):Ol.moveTo(Rl[t].x,Rl[t].y);Ol.closePath();const s=Nn.getSvgPathDByData(Ol.data);this._bindedShape.setAttribute("d",s)}}const Ml=100,Al=new We,Tl=new We,Cl=new We,Il=new We,Dl=new We,Ll=new We,Bl=new We,Pl=new Ui,kl=new Ui,Nl=new Ui,Ol=new yn,Rl=[];class zl extends th{constructor(t,e){super(t,e),c(this,"type",Go.DRAW_TEXT),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),c(this,"_clId",`${this._cpsId}-cl-`),c(this,"_cpsLimit",3),c(this,"_fspl",1),this._controlPoints=this.getControlPoints()}activate(){super.activate()}deactivate(){super.deactivate()}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i=new Re(Ae.config.editor.fill||Le.green).getStyle();e=ts({id:`${this.type}-text`,textContent:"Text",fontSize:Ae.config.editor.fontSize||Hl,fill:i,textAnchor:"middle",textBaseline:"middle"}),t&&(e.setAttribute(`${ki}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints))}return e}getControlPoints(){const t=is(this._cpsId),e=Kn({id:`${this._clId}1`,fill:"none",stroke:this._cpStroke,strokeWidth:1,d:[],strokeDasharray:"5"});t.appendChild(e);const i=Ae.config.editor.strokeWidth,n=this._cpFill,s=Qn({id:`${this._cpId}1`,x:0,y:0,r:i,fill:n,stroke:this._cpStroke});return s.setAttribute(`${ki}-type`,(Go.DRAW_POLYGON|Go.DRAG).toString()),t.appendChild(s),t}beforeDragStart(t){this.splitByControlPoint(null==t?void 0:t.target,null==t?void 0:t.center)}handleDoubleTap(t){var e,i;if((null==t?void 0:t.type)!==jh.DOUBLE_TAP)return;const n=this._getIntersect(this._controlPoints.children,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this.mergeByControlPoint(n,null==(i=null==t?void 0:t.data)?void 0:i.worldCoords)}updateControlPoints(t,e){if(!this._bindedShape)return;const i=ri.find(this._controlPoints.children,(t=>t.id===`${this._cpId}1`));if(!i)return;Nn.getBoundingBoxByNode(this._bindedShape,ql).getSize(Fl),ql.getCenter(Wl),Vl.copy(Wl).add(Ul.set(Fl.x/2,-Fl.y/2)),ns(i,Vl);const n=parseInt(this._bindedShape.getAttribute("font-size")||"12")/10;i.setAttribute("r",n.toString());const s=ri.find(this._controlPoints.children,(t=>t.id===`${this._clId}1`));jl.dispose().moveTo(ql.min.x,ql.min.y).lineTo(ql.max.x,ql.min.y).lineTo(ql.max.x,ql.max.y).lineTo(ql.min.x,ql.max.y).lineTo(ql.min.x,ql.min.y).closePath();const r=Nn.getSvgPathDByData(jl.data);s.setAttribute("d",r),this.updateControlPointsRadius()}updateByControlPoints(t){if(!this._bindedShape||!this._bindedControlPoint)return;this._bindedControlPoint.id,Nn.getBoundingBoxByNode(this._bindedShape,ql).getCenter(Fl);const e=We.getDistance(Fl,t),i=Math.abs(Math.round(e*this._fspl));this._bindedShape.setAttribute("font-size",i.toString())}}const Hl=20,Wl=new We,Fl=new We,Ul=new We,Vl=new We,ql=new ai,jl=new yn;class Yl extends Fi{constructor(t){super(),c(this,"mode",$o.DEFAULT),c(this,"view"),c(this,"scene"),c(this,"tools",new Map),c(this,"activedTools",new Map),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"doubleTapHandler",this.handleDoubleTap.bind(this)),c(this,"panStartHandler",this.handlePanStart.bind(this)),c(this,"panMoveHandler",this.handlePanMove.bind(this)),c(this,"panEndHandler",this.handlePanEnd.bind(this)),c(this,"_pointerOverHandler",this._handlePointerOver.bind(this)),c(this,"_wheelEndHandler",this.handleWheelEnd.bind(this)),this.view=t,this.register([Go.HOVER,Go.DRAG,Go.DRAW_POINT,Go.DRAW_POLYLINE,Go.DRAW_POLYGON,Go.DRAW_TEXT]),this.setMode(this.mode)}destroy(){this.dispose(),this.unbindEvents(),this.tools.clear()}dispose(){this.tools.forEach((t=>{t.deactivate&&t.deactivate()})),this.scene=void 0}register(t){Array.isArray(t)||(t=[t]),this.deactiveAll();for(let e,i=0,n=(null==t?void 0:t.length)||0;i<n;i++){e=t[i];let n=this.tools.get(e);if(!n){switch(e){case Go.HOVER:n=new _h(this,this.view);break;case Go.DRAG:n=new bh(this,this.view);break;case Go.DRAW_POINT:n=new mh(this,this.view);break;case Go.DRAW_POLYLINE:n=new hl(this,this.view);break;case Go.DRAW_POLYGON:n=new El(this,this.view);break;case Go.DRAW_TEXT:n=new zl(this,this.view)}n&&this.tools.set(e,n)}}return this}setMode(t){if(t){this.mode=t,Ae.config.editorMode=$o.PICKER,this.deactiveAll();for(let e=1;e<=t;e<<=1)if(t&e){const t=e;this.tools.has(t)&&this.activateTool(t)}}}deactiveAll(t){const e=[];this.activedTools.forEach((i=>{(null==t?void 0:t.includes(i.type))||e.push(i.type)})),e.forEach((t=>{var e;null==(e=this.activedTools.get(t))||e.deactivate(),this.activedTools.delete(t)}))}activateTool(t){const e=this.tools.get(t);e&&(null==e||e.deactivate(),this.activedTools.set(e.type,e),this.scene&&e.bindScene&&e.bindScene(this.scene),e.activate())}bindScene(...t){return this.scene=t[0],this.bindEvents(),this}get(t){return this.tools.get(t)}getActiveTool(t){return this.activedTools.get(t)}fnEnableChanged(t=!1){this.activedTools.forEach((e=>{e.fnEnableChanged&&e.fnEnableChanged(t)}))}editorFillChanged(t){this.activedTools.forEach((e=>{e.editorFillChanged&&e.editorFillChanged(t)}))}editorStrokeChanged(t){this.activedTools.forEach((e=>{e.editorStrokeChanged&&e.editorStrokeChanged(t)}))}editorStrokeWidthChanged(t){this.activedTools.forEach((e=>{e.editorStrokeWidthChanged&&e.editorStrokeWidthChanged(t)}))}editorStrokeDasharrayChanged(t){this.activedTools.forEach((e=>{e.editorStrokeDasharrayChanged&&e.editorStrokeDasharrayChanged(t)}))}editorStrokeArrowChanged(t){this.activedTools.forEach((e=>{e.editorStrokeArrowChanged&&e.editorStrokeArrowChanged(t)}))}editorFontSizeChanged(t){this.activedTools.forEach((e=>{e.editorFontSizeChanged&&e.editorFontSizeChanged(t)}))}editorTextContentChanged(t){this.activedTools.forEach((e=>{e.editorTextContentChanged&&e.editorTextContentChanged(t)}))}editorDeleteCurrentShape(){this.activedTools.forEach((t=>{t.deleteCurrentShape&&t.deleteCurrentShape()}))}editorClearAllShapes(){this.activedTools.forEach((t=>{t.clearAllShapes&&t.clearAllShapes()}))}getEditorCurrentShapes(){const t=[],e=new XMLSerializer;return this.activedTools.forEach((i=>{var n;null==(n=i._locals)||n.forEach((i=>{let n=e.serializeToString(i);n=n.replace(/\s*xmlns="http:\/\/www\.w3\.org\/2000\/svg"/gi,""),n=n.replace(/\s*xmlns:xlink="[^"]*"/gi,""),n=n.replace(/\sstyle\s*=\s*(['"])(.*?)\1/g,""),t.push(n)}))})),t}editorInitShapes(t){if(!t)return;Array.isArray(t)||(t=[t]);const e=t.map((t=>{var e;return null==(e=(new DOMParser).parseFromString(t,"image/svg+xml"))?void 0:e.documentElement}));this.activedTools.forEach((t=>t.initShapes&&t.initShapes(e)))}editorUnitsChanged(t){this.activedTools.forEach((e=>{e.editorUnitsChanged&&e.editorUnitsChanged(t)}))}bindEvents(){var t,e,i,n,s,r,a,o,h,l,u,c,d,p;this.unbindEvents(),null==(e=null==(t=this.view)?void 0:t.controller)||e.addEventListener(Fh.TAP,this.tapHandler),null==(n=null==(i=this.view)?void 0:i.controller)||n.addEventListener(Fh.DOUBLE_TAP,this.doubleTapHandler),null==(r=null==(s=this.view)?void 0:s.controller)||r.addEventListener(Fh.PAN_START,this.panStartHandler),null==(o=null==(a=this.view)?void 0:a.controller)||o.addEventListener(Fh.PAN_MOVE,this.panMoveHandler),null==(l=null==(h=this.view)?void 0:h.controller)||l.addEventListener(Fh.PAN_END,this.panEndHandler),null==(c=null==(u=this.view)?void 0:u.controller)||c.addEventListener(Fh.POINTEROVER,this._pointerOverHandler),null==(p=null==(d=this.view)?void 0:d.controller)||p.addEventListener(Fh.WHEEL_END,this._wheelEndHandler)}unbindEvents(){var t,e,i,n,s,r,a,o,h,l,u,c;null==(e=null==(t=this.view)?void 0:t.controller)||e.removeEventListener(Fh.TAP,this.tapHandler),null==(n=null==(i=this.view)?void 0:i.controller)||n.removeEventListener(Fh.DOUBLE_TAP,this.doubleTapHandler),null==(r=null==(s=this.view)?void 0:s.controller)||r.removeEventListener(Fh.PAN_START,this.panStartHandler),null==(o=null==(a=this.view)?void 0:a.controller)||o.removeEventListener(Fh.PAN_MOVE,this.panMoveHandler),null==(l=null==(h=this.view)?void 0:h.controller)||l.removeEventListener(Fh.PAN_END,this.panEndHandler),null==(c=null==(u=this.view)?void 0:u.controller)||c.removeEventListener(Fh.POINTEROVER,this._pointerOverHandler)}handleTap(t){this.activedTools.forEach((e=>{e.handleTap&&e.handleTap(t)}))}handleDoubleTap(t){this.activedTools.forEach((e=>{e.handleDoubleTap&&e.handleDoubleTap(t)}))}handlePanStart(t){this.activedTools.forEach((e=>{e.handlePanStart&&e.handlePanStart(t)}))}handlePanMove(t){this.activedTools.forEach((e=>{e.handlePanMove&&e.handlePanMove(t)}))}handlePanEnd(t){this.activedTools.forEach((e=>{e.handlePanEnd&&e.handlePanEnd(t)}))}enableHover(t){var e;null==(e=this.get(Go.HOVER))||e.enableHover(t)}_handlePointerOver(t){var e;null==(e=this.get(Go.HOVER))||e._handlePointerOver(t)}handlePointerOver(t){this.activedTools.forEach((e=>{e.handlePointerOver&&e.handlePointerOver(t)}))}handlePointerOut(t){this.activedTools.forEach((e=>{e.handlePointerOut&&e.handlePointerOut(t)}))}handlePointerMove(t){this.activedTools.forEach((e=>{e.handlePointerMove&&e.handlePointerMove(t)}))}handleWheelEnd(t){this.activedTools.forEach((e=>{"function"==typeof e.handleWheelEnd&&e.handleWheelEnd(t)}))}drag(t,e){var i;this.mode===$o.DRAWING&&(null==(i=this.get(Go.DRAG))||i.drag(t,e))}drop(t){var e;this.mode===$o.DRAWING&&(null==(e=this.get(Go.DRAG))||e.drop(t))}setEnablePan(t=!1){this.view&&this.view.setEnablePan&&this.view.setEnablePan(t)}isEnablePan(){var t,e;return null==(e=null==(t=this.view)?void 0:t.controller)?void 0:e.enablePan}handleDragStart(t){this.activedTools.forEach((e=>{e.handleDragStart&&e.handleDragStart(t)}))}handleDragMove(t){this.activedTools.forEach((e=>{e.handleDragMove&&e.handleDragMove(t)}))}handleDragEnd(t){this.activedTools.forEach((e=>{e.handleDragEnd&&e.handleDragEnd(t)}))}}class Gl extends Fi{constructor(t={}){super(),c(this,"name","SvgApp"),c(this,"params"),c(this,"renderer"),c(this,"view"),c(this,"scene"),c(this,"loadingScene"),c(this,"emptyScene"),c(this,"mainScene"),c(this,"zoomToSelectEnable",!1),c(this,"zoomBox",new ai),c(this,"selectEnable",!1),c(this,"multiSelectEnable",!1),c(this,"fnEnable",!1),c(this,"requestHeader",{}),c(this,"runningHandler",this.running.bind(this)),c(this,"pointerOverHandler",this.handlePointerOver.bind(this)),c(this,"pointerLeaveHandler",this.handlePointerLeave.bind(this)),c(this,"multiSelectorSelectedHandler",this.handleMultiSelectorSelected.bind(this)),c(this,"dragEndHandler",this.handleDragEnd.bind(this)),this.params=t,this.params.zoomToSelectEnable&&(this.zoomToSelectEnable=!0),this.params.selectEnable&&(this.selectEnable=!0),this.params.multiSelectEnable&&(this.multiSelectEnable=!0),this.params.defaultFill||(this.params.defaultFill=Re.getMoreTransparent(Le.white,.3)),this.params.defaultStroke||(this.params.defaultStroke=Re.getMoreTransparent(Le.darkWhite,.8)),this.params.infoFill||(this.params.infoFill=Re.getMoreTransparent(Le.gray,.3)),this.params.infoStroke||(this.params.infoStroke=Re.getMoreTransparent(Le.darkGray,.8)),this.params.primaryFill||(this.params.primaryFill=Re.getMoreTransparent(Le.blue,.3)),this.params.primaryStroke||(this.params.primaryStroke=Re.getMoreTransparent(Le.darkBlue,.8)),this.params.successFill||(this.params.successFill=Re.getMoreTransparent(Le.green,.3)),this.params.successStroke||(this.params.successStroke=Re.getMoreTransparent(Le.darkGreen,.8)),this.params.warningFill||(this.params.warningFill=Re.getMoreTransparent(Le.yellow,.3)),this.params.warningStroke||(this.params.warningStroke=Re.getMoreTransparent(Le.darkYellow,.8)),this.params.dangerFill||(this.params.dangerFill=Re.getMoreTransparent(Le.red,.3)),this.params.dangerStroke||(this.params.dangerStroke=Re.getMoreTransparent(Le.darkRed,.8)),this.params.activeFill||(this.params.activeFill=Re.getMoreTransparent(Le.brown,.3)),this.params.activeStroke||(this.params.activeStroke=Re.getMoreTransparent(Le.darkBrown,.8)),this.renderer=new us(t),this.view=new Wo(t),this.editor=new Yl(this.view),this.trans2LoadingScene()}get isLoadingScene(){var t;return"SvgLoadingScene"===(null==(t=this.scene)?void 0:t.name)}destroy(){var t,e;this.unbindEvents(),this.unbindAssetsEvents(),super.destroy(),null==(t=this.view)||t.destroy(),null==(e=this.renderer)||e.destroy()}bindEvents(){this.unbindEvents()}unbindEvents(){}resize(){var t,e;null==(t=this.renderer)||t.resize(),null==(e=this.view)||e.resize()}isScene(t){var e;return(null==(e=this.scene)?void 0:e.uuid)===t.uuid}removeScene(t){this.scene=void 0,null==t||t.destroy()}trans2MainScene(){var t,e,i,n;null==(t=this.scene)||t.unmount(),this.scene=this.mainScene,this.scene.isMounted||this.scene.mount(),this.view.bindScene(this.scene),null==(e=this.editor)||e.setMode($o.DEFAULT),null==(i=this.editor)||i.bindScene(this.scene),null==(n=this.loadingScene)||n.destroy()}trans2LoadingScene(){var t,e,i;null==(t=this.editor)||t.dispose(),this.loadingScene=new js(this.params),null==(e=this.scene)||e.unmount(),this.scene=this.loadingScene,this.scene.isMounted||this.scene.mount();const n=(new ai).copy(this.loadingScene.viewBox).expandByVector(new We(1,1).multiplyScalar(150));this.view.setByBox(n,!1),null==(i=this.mainScene)||i.destroy()}trans2EmptyScene(){var t,e,i;null==(t=this.editor)||t.dispose(),this.emptyScene=new Yo(this.params),null==(e=this.scene)||e.unmount(),this.scene=this.emptyScene,this.scene.isMounted||this.scene.mount();const n=(new ai).copy(this.emptyScene.viewBox).expandByVector(new We(1,1).multiplyScalar(150));this.view.setByBox(n,!1),null==(i=this.mainScene)||i.destroy()}start(){requestAnimationFrame(this.runningHandler)}running(t){this.scene&&(this.scene.update(),this.renderer.render(this.scene,this.view.camera),this.view.update(t),requestAnimationFrame(this.runningHandler))}setRequestHeader(t){return this.requestHeader=t,this}load(t,e,i=2,n){return d(this,null,(function*(){this.isLoadingScene||this.trans2LoadingScene(),yield Ti(this.params.syncDelay);const n=yield(new Ns).setRequestHeader(this.requestHeader).loadAsync(t).catch((()=>{this.trans2EmptyScene()}));return this.loadByString(n,e,i)}))}loadByString(t,e,i=2){return d(this,null,(function*(){this.mainScene=new qs(this.params);if(!this.mainScene.bind(t))return this.trans2EmptyScene(),[];this.view.setByBox(this.mainScene.viewBox);const n=this.mainScene.getLayers(i);return(null==e?void 0:e.length)||(e=ri.map(n,"label")),this.mainScene.showDefaultLayers(e,!0),this.trans2MainScene(),this.bindAssetsEvents(),n}))}recompute(t){var e;null==(e=this.scene)||e.recompute(t),this.fullscreen()}setSkeletons(t){var e;null==(e=this.scene)||e.setSkeletonLayers(t)}getLayers(t=2){var e;return null==(e=this.scene)?void 0:e.getLayers(t)}getLayerVisible(t){var e;return null==(e=this.scene)?void 0:e.getLayerVisible(t)}updateLayersVisibility(t,e=!1,i=!0){var n;null==(n=this.scene)||n.updateLayersVisibility(t,e,i)}selectByIds(t){var e;null==(e=this.scene)||e.selectByIds(t,this.multiSelectEnable)}clearSelectedByIds(t){var e;Array.isArray(t)?t.forEach((t=>{var e;return null==(e=this.scene)?void 0:e.clearSelectedById(t)})):null==(e=this.scene)||e.clearSelectedById(t)}clearSelected(){var t;null==(t=this.scene)||t.clearSelected()}getSelectedIds(){var t;return null==(t=this.scene)?void 0:t.getSelectedIds()}targetByIds(t,e=100){return d(this,null,(function*(){var i;this.scene&&(null==(i=this.scene)||i.selectByIds(t,!1),$l.copy(this.scene.getSelectedBoundingBox()).expandByVector(new We(1,1).multiplyScalar(e)),yield Ti(100),$l.isEmpty()||(yield this.view.setByBox($l)))}))}linkAssetsByTree(t){var e;null==(e=this.scene)||e.linkAssetsByTree(t)}setViewAreaLimit(t){this.renderer.viewAreaLimit=t}setAssetType(t,e){var i;null==(i=this.scene)||i.setAssetType(t,e)}getAssetIdsByType(t){var e;return null==(e=this.scene)?void 0:e.getAssetIdsByType(t)}clearFill(){var t;null==(t=this.scene)||t.clearFillOrStroke("fill")}clearFillByIds(t){var e;null==(e=this.scene)||e.clearFillOrStrokeByIds(t,"fill")}setFillByIds(t,e){var i;null==(i=this.scene)||i.setFillOrStrokeByIds(t,e,"fill")}clearStroke(){var t;null==(t=this.scene)||t.clearFillOrStroke("stroke")}clearStrokeByIds(t){var e;null==(e=this.scene)||e.clearFillOrStrokeByIds(t,"stroke")}setStrokeByIds(t,e,i){var n;null==(n=this.scene)||n.setFillOrStrokeByIds(t,e,"stroke",i)}getLegend(){var t;return null==(t=this.scene)?void 0:t.getLegend()}setAssetLabels(t,e){var i;null==(i=this.scene)||i.setAssetLabels(t,e)}clearAssetLabels(){var t;null==(t=this.scene)||t.clearAssetLabels()}fullscreen(){this.view.fullscreen()}saveCameraPosition(t){this.view.saveCameraPosition(t)}restoreCameraPosition(t){this.view.restoreCameraPosition(t)}clearCameraPosition(t){this.view.clearCameraPosition(t)}zoomIn(){this.view.zoomIn()}zoomOut(){this.view.zoomOut()}focusAt(t,e=1e3){var i;null==(i=this.view)||i.focusAt(t,e)}focusAtIds(t,e=100){return d(this,null,(function*(){if(!this.scene)return;const i=this.scene.getBoundingBoxByIds(t);i&&(i.expandByVector(new We(1,1).multiplyScalar(e)),yield Ti(100),i.isEmpty()||(yield this.view.setByBox(i)))}))}focusAtById(t,e=1e3){return d(this,null,(function*(){var i;return null==(i=this.view)?void 0:i.focusAtById(t,e)}))}focusAtDummy(t,e=1e3){return d(this,null,(function*(){var i;return null==(i=this.view)?void 0:i.focusAtDummy(t,e)}))}showAssetsLabel(t,e,i){var n,s,r,a;e?"dummy"===t?null==(r=null==(s=null==(n=this.view)?void 0:n.dummiesController)?void 0:s.dummies)||r.showDummyLabel(e):null==(a=this.view)||a.showAssetsLabel(t,e,i):this.hideAssetsLabel()}hideAssetsLabel(){var t,e,i,n;null==(i=null==(e=null==(t=this.view)?void 0:t.dummiesController)?void 0:e.dummies)||i.hideDummyLabel(),null==(n=this.view)||n.hideAssetsLabel()}highlightAssets(t,e){var i;null==(i=this.scene)||i.highlightAssets(t,e)}resetHighlightAssets(t){var e;null==(e=this.scene)||e.resetHighlightAssets(t)}fontZoomIn(){var t;null==(t=this.scene)||t.chef.fontZoom("asset-labels",1.1)}fontZoomOut(){var t;null==(t=this.scene)||t.chef.fontZoom("asset-labels",.9)}strokeMore(){var t;null==(t=this.scene)||t.chef.strokeWidthChanged(1.1)}strokeLess(){var t;null==(t=this.scene)||t.chef.strokeWidthChanged(.9)}zoomToSelectEnableChanged(t){this.view.zoomToSelectEnableChanged(t)}selectEnableChanged(t){this.selectEnable=!!t,this.view.selectEnableChanged(t)}multiSelectEnableChanged(t){this.multiSelectEnable=!!t,this.view.multiSelectEnableChanged(t)}socialDistanceEnableChanged(t){var e;null==(e=this.scene)||e.socialDistanceEnableChanged(t)}fnEnableChanged(t){var e;this.fnEnable=!!t,this.view.fnEnableChanged(t),null==(e=this.editor)||e.fnEnableChanged(t)}getBoundingBoxById(t,e=!0){var i;if(!t)return;const n=null==(i=this.scene)?void 0:i.getBoundingBoxById(t);return n&&e&&n.applyMatrix3(this.view.camera.viewMatrix).round(),n}setDummies(t){var e;null==(e=this.view)||e.setDummies(t)}clearDummies(t){var e;null==(e=this.view)||e.clearDummies(t)}highlightDummies(t){var e,i;null==(i=null==(e=this.view)?void 0:e.dummiesController)||i.highlightDummies(t)}resetHighlightDummies(){var t,e;null==(e=null==(t=this.view)?void 0:t.dummiesController)||e.resetHighlightDummies()}bindAssetsEvents(){var t,e;this.view.addEventListener(qo.POINTEROVER,this.pointerOverHandler),this.view.addEventListener(qo.POINTERLEAVE,this.pointerLeaveHandler),this.view.addEventListener(qo.SELECTED,this.multiSelectorSelectedHandler),null==(e=null==(t=this.view)?void 0:t.dummiesController)||e.addEventListener("panend",this.dragEndHandler)}unbindAssetsEvents(){var t,e;this.view.removeEventListener(qo.POINTEROVER,this.pointerOverHandler),this.view.removeEventListener(qo.POINTERLEAVE,this.pointerLeaveHandler),this.view.removeEventListener(qo.SELECTED,this.multiSelectorSelectedHandler),null==(e=null==(t=this.view)?void 0:t.dummiesController)||e.removeEventListener("panend",this.dragEndHandler)}handleMultiSelectorSelected(t){this.dispatchEvent({type:"SELECTED",data:t.data})}handlePointerOver(t){this.dispatchEvent({type:"pointerover",data:t.data,e:t.e})}handlePointerLeave(t){this.dispatchEvent({type:"pointerleave",data:t.data,e:t.e})}handleInitializeStart(){}handleInitializeComplete(t){return d(this,null,(function*(){(null==t?void 0:t.data)&&this.launch()}))}handleDragEnd(t){this.dispatchEvent(t)}launch(){}drag(t,e){return d(this,null,(function*(){var i;null==(i=this.editor)||i.drag(t,e)}))}setEditorMode(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setMode(t)}))}editorFillChanged(t){return d(this,null,(function*(){var e;this.params.editor.fill=t,null==(e=this.editor)||e.editorFillChanged(t)}))}editorStrokeChanged(t){return d(this,null,(function*(){var e;this.params.editor.stroke=t,null==(e=this.editor)||e.editorStrokeChanged(t)}))}editorStrokeWidthChanged(t){return d(this,null,(function*(){var e;this.params.editor.strokeWidth=t,null==(e=this.editor)||e.editorStrokeWidthChanged(t)}))}editorStrokeDasharrayChanged(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.editorStrokeDasharrayChanged(t)}))}editorStrokeArrowChanged(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.editorStrokeArrowChanged(t)}))}editorFontSizeChanged(t){return d(this,null,(function*(){var e;this.params.editor.fontSize=t,null==(e=this.editor)||e.editorFontSizeChanged(t)}))}editorTextContentChanged(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.editorTextContentChanged(t)}))}editorDeleteCurrentShape(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.editorDeleteCurrentShape()}))}editorClearAll(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.editorClearAllShapes()}))}getEditorCurrentShapes(){return d(this,null,(function*(){var t;return null==(t=this.editor)?void 0:t.getEditorCurrentShapes()}))}editorInitShapes(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.editorInitShapes(t)}))}editorUnitsChanged(t){return d(this,null,(function*(){var e;this.params.editor.units=t,null==(e=this.editor)||e.editorUnitsChanged(t)}))}}const $l=new ai;var Xl=(t=>(t.SELECTED="SELECTED",t.POINTEROVER="pointerover",t.POINTERLEAVE="pointerleave",t.DRAG_END="panend",t))(Xl||{});
|
|
14
|
+
* Licensed under the MIT license */js=Ys,function(t,e,i,n){var s,r=["","webkit","Moz","MS","ms","o"],a=e.createElement("div"),o=Math.round,h=Math.abs,l=Date.now;function u(t,e,i){return setTimeout(y(t,i),e)}function c(t,e,i){return!!Array.isArray(t)&&(d(t,i[e],i),!0)}function d(t,e,i){var s;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==n)for(s=0;s<t.length;)e.call(i,t[s],s,t),s++;else for(s in t)t.hasOwnProperty(s)&&e.call(i,t[s],s,t)}function p(e,i,n){var s="DEPRECATED METHOD: "+i+"\n"+n+" AT \n";return function(){var i=new Error("get-stack-trace"),n=i&&i.stack?i.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=t.console&&(t.console.warn||t.console.log);return r&&r.call(t.console,s,n),e.apply(this,arguments)}}s="function"!=typeof Object.assign?function(t){if(t===n||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var s=arguments[i];if(s!==n&&null!==s)for(var r in s)s.hasOwnProperty(r)&&(e[r]=s[r])}return e}:Object.assign;var f=p((function(t,e,i){for(var s=Object.keys(e),r=0;r<s.length;)(!i||i&&t[s[r]]===n)&&(t[s[r]]=e[s[r]]),r++;return t}),"extend","Use `assign`."),m=p((function(t,e){return f(t,e,!0)}),"merge","Use `assign`.");function g(t,e,i){var n,r=e.prototype;(n=t.prototype=Object.create(r)).constructor=t,n._super=r,i&&s(n,i)}function y(t,e){return function(){return t.apply(e,arguments)}}function v(t,e){return"function"==typeof t?t.apply(e&&e[0]||n,e):t}function x(t,e){return t===n?e:t}function b(t,e,i){d(E(e),(function(e){t.addEventListener(e,i,!1)}))}function w(t,e,i){d(E(e),(function(e){t.removeEventListener(e,i,!1)}))}function _(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function S(t,e){return t.indexOf(e)>-1}function E(t){return t.trim().split(/\s+/g)}function M(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var n=0;n<t.length;){if(i&&t[n][i]==e||!i&&t[n]===e)return n;n++}return-1}function A(t){return Array.prototype.slice.call(t,0)}function T(t,e,i){for(var n=[],s=[],r=0;r<t.length;){var a=t[r][e];M(s,a)<0&&n.push(t[r]),s[r]=a,r++}return n=n.sort((function(t,i){return t[e]>i[e]}))}function C(t,e){for(var i,s,a=e[0].toUpperCase()+e.slice(1),o=0;o<r.length;){if((s=(i=r[o])?i+a:e)in t)return s;o++}return n}var I=1;function D(e){var i=e.ownerDocument||e;return i.defaultView||i.parentWindow||t}var L="ontouchstart"in t,B=C(t,"PointerEvent")!==n,P=L&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),k="touch",N="mouse",O=24,R=["x","y"],z=["clientX","clientY"];function H(t,e){var i=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){v(t.options.enable,[t])&&i.handler(e)},this.init()}function W(t,e,i){var s=i.pointers.length,r=i.changedPointers.length,a=1&e&&s-r==0,o=12&e&&s-r==0;i.isFirst=!!a,i.isFinal=!!o,a&&(t.session={}),i.eventType=e,function(t,e){var i=t.session,s=e.pointers,r=s.length;i.firstInput||(i.firstInput=F(e)),r>1&&!i.firstMultiple?i.firstMultiple=F(e):1===r&&(i.firstMultiple=!1);var a=i.firstInput,o=i.firstMultiple,u=o?o.center:a.center,c=e.center=U(s);e.timeStamp=l(),e.deltaTime=e.timeStamp-a.timeStamp,e.angle=Y(u,c),e.distance=j(u,c),function(t,e){var i=e.center,n=t.offsetDelta||{},s=t.prevDelta||{},r=t.prevInput||{};1!==e.eventType&&4!==r.eventType||(s=t.prevDelta={x:r.deltaX||0,y:r.deltaY||0},n=t.offsetDelta={x:i.x,y:i.y}),e.deltaX=s.x+(i.x-n.x),e.deltaY=s.y+(i.y-n.y)}(i,e),e.offsetDirection=q(e.deltaX,e.deltaY);var d,p,f=V(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=f.x,e.overallVelocityY=f.y,e.overallVelocity=h(f.x)>h(f.y)?f.x:f.y,e.scale=o?(d=o.pointers,j((p=s)[0],p[1],z)/j(d[0],d[1],z)):1,e.rotation=o?function(t,e){return Y(e[1],e[0],z)+Y(t[1],t[0],z)}(o.pointers,s):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,function(t,e){var i,s,r,a,o=t.lastInterval||e,l=e.timeStamp-o.timeStamp;if(8!=e.eventType&&(l>25||o.velocity===n)){var u=e.deltaX-o.deltaX,c=e.deltaY-o.deltaY,d=V(l,u,c);s=d.x,r=d.y,i=h(d.x)>h(d.y)?d.x:d.y,a=q(u,c),t.lastInterval=e}else i=o.velocity,s=o.velocityX,r=o.velocityY,a=o.direction;e.velocity=i,e.velocityX=s,e.velocityY=r,e.direction=a}(i,e);var m=t.element;_(e.srcEvent.target,m)&&(m=e.srcEvent.target),e.target=m}(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function F(t){for(var e=[],i=0;i<t.pointers.length;)e[i]={clientX:o(t.pointers[i].clientX),clientY:o(t.pointers[i].clientY)},i++;return{timeStamp:l(),pointers:e,center:U(e),deltaX:t.deltaX,deltaY:t.deltaY}}function U(t){var e=t.length;if(1===e)return{x:o(t[0].clientX),y:o(t[0].clientY)};for(var i=0,n=0,s=0;s<e;)i+=t[s].clientX,n+=t[s].clientY,s++;return{x:o(i/e),y:o(n/e)}}function V(t,e,i){return{x:e/t||0,y:i/t||0}}function q(t,e){return t===e?1:h(t)>=h(e)?t<0?2:4:e<0?8:16}function j(t,e,i){i||(i=R);var n=e[i[0]]-t[i[0]],s=e[i[1]]-t[i[1]];return Math.sqrt(n*n+s*s)}function Y(t,e,i){i||(i=R);var n=e[i[0]]-t[i[0]],s=e[i[1]]-t[i[1]];return 180*Math.atan2(s,n)/Math.PI}H.prototype={handler:function(){},init:function(){this.evEl&&b(this.element,this.evEl,this.domHandler),this.evTarget&&b(this.target,this.evTarget,this.domHandler),this.evWin&&b(D(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(D(this.element),this.evWin,this.domHandler)}};var G={mousedown:1,mousemove:2,mouseup:4},$="mousedown",X="mousemove mouseup";function Z(){this.evEl=$,this.evWin=X,this.pressed=!1,H.apply(this,arguments)}g(Z,H,{handler:function(t){var e=G[t.type];1&e&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:N,srcEvent:t}))}});var J={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},Q={2:k,3:"pen",4:N,5:"kinect"},K="pointerdown",tt="pointermove pointerup pointercancel";function et(){this.evEl=K,this.evWin=tt,H.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}t.MSPointerEvent&&!t.PointerEvent&&(K="MSPointerDown",tt="MSPointerMove MSPointerUp MSPointerCancel"),g(et,H,{handler:function(t){var e=this.store,i=!1,n=t.type.toLowerCase().replace("ms",""),s=J[n],r=Q[t.pointerType]||t.pointerType,a=r==k,o=M(e,t.pointerId,"pointerId");1&s&&(0===t.button||a)?o<0&&(e.push(t),o=e.length-1):12&s&&(i=!0),o<0||(e[o]=t,this.callback(this.manager,s,{pointers:e,changedPointers:[t],pointerType:r,srcEvent:t}),i&&e.splice(o,1))}});var it={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function nt(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,H.apply(this,arguments)}function st(t,e){var i=A(t.touches),n=A(t.changedTouches);return 12&e&&(i=T(i.concat(n),"identifier")),[i,n]}g(nt,H,{handler:function(t){var e=it[t.type];if(1===e&&(this.started=!0),this.started){var i=st.call(this,t,e);12&e&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:k,srcEvent:t})}}});var rt={touchstart:1,touchmove:2,touchend:4,touchcancel:8},at="touchstart touchmove touchend touchcancel";function ot(){this.evTarget=at,this.targetIds={},H.apply(this,arguments)}function ht(t,e){var i=A(t.touches),n=this.targetIds;if(3&e&&1===i.length)return n[i[0].identifier]=!0,[i,i];var s,r,a=A(t.changedTouches),o=[],h=this.target;if(r=i.filter((function(t){return _(t.target,h)})),1===e)for(s=0;s<r.length;)n[r[s].identifier]=!0,s++;for(s=0;s<a.length;)n[a[s].identifier]&&o.push(a[s]),12&e&&delete n[a[s].identifier],s++;return o.length?[T(r.concat(o),"identifier"),o]:void 0}function lt(){H.apply(this,arguments);var t=y(this.handler,this);this.touch=new ot(this.manager,t),this.mouse=new Z(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function ut(t,e){1&t?(this.primaryTouch=e.changedPointers[0].identifier,ct.call(this,e)):12&t&&ct.call(this,e)}function ct(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var i={x:e.clientX,y:e.clientY};this.lastTouches.push(i);var n=this.lastTouches;setTimeout((function(){var t=n.indexOf(i);t>-1&&n.splice(t,1)}),2500)}}function dt(t){for(var e=t.srcEvent.clientX,i=t.srcEvent.clientY,n=0;n<this.lastTouches.length;n++){var s=this.lastTouches[n],r=Math.abs(e-s.x),a=Math.abs(i-s.y);if(r<=25&&a<=25)return!0}return!1}g(ot,H,{handler:function(t){var e=rt[t.type],i=ht.call(this,t,e);i&&this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:k,srcEvent:t})}}),g(lt,H,{handler:function(t,e,i){var n=i.pointerType==k,s=i.pointerType==N;if(!(s&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(n)ut.call(this,e,i);else if(s&&dt.call(this,i))return;this.callback(t,e,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var pt=C(a.style,"touchAction"),ft=pt!==n,mt="compute",gt="auto",yt="manipulation",vt="none",xt="pan-x",bt="pan-y",wt=function(){if(!ft)return!1;var e={},i=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(n){e[n]=!i||t.CSS.supports("touch-action",n)})),e}();function _t(t,e){this.manager=t,this.set(e)}_t.prototype={set:function(t){t==mt&&(t=this.compute()),ft&&this.manager.element.style&&wt[t]&&(this.manager.element.style[pt]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return d(this.manager.recognizers,(function(e){v(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))})),function(t){if(S(t,vt))return vt;var e=S(t,xt),i=S(t,bt);return e&&i?vt:e||i?e?xt:bt:S(t,yt)?yt:gt}(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,i=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var n=this.actions,s=S(n,vt)&&!wt[vt],r=S(n,bt)&&!wt[bt],a=S(n,xt)&&!wt[xt];if(s){var o=1===t.pointers.length,h=t.distance<2,l=t.deltaTime<250;if(o&&h&&l)return}if(!a||!r)return s||r&&6&i||a&&i&O?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var St=32;function Et(t){this.options=s({},this.defaults,t||{}),this.id=I++,this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function Mt(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}function At(t){return 16==t?"down":8==t?"up":2==t?"left":4==t?"right":""}function Tt(t,e){var i=e.manager;return i?i.get(t):t}function Ct(){Et.apply(this,arguments)}function It(){Ct.apply(this,arguments),this.pX=null,this.pY=null}function Dt(){Ct.apply(this,arguments)}function Lt(){Et.apply(this,arguments),this._timer=null,this._input=null}function Bt(){Ct.apply(this,arguments)}function Pt(){Ct.apply(this,arguments)}function kt(){Et.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Nt(t,e){return(e=e||{}).recognizers=x(e.recognizers,Nt.defaults.preset),new Ot(t,e)}function Ot(t,e){var i;this.options=s({},Nt.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((i=this).options.inputClass||(B?et:P?ot:L?lt:Z))(i,W),this.touchAction=new _t(this,this.options.touchAction),Rt(this,!0),d(this.options.recognizers,(function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])}),this)}function Rt(t,e){var i,n=t.element;n.style&&(d(t.options.cssProps,(function(s,r){i=C(n.style,r),e?(t.oldCssProps[i]=n.style[i],n.style[i]=s):n.style[i]=t.oldCssProps[i]||""})),e||(t.oldCssProps={}))}Et.prototype={defaults:{},set:function(t){return s(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(c(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=Tt(t,this)).id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return c(t,"dropRecognizeWith",this)||(t=Tt(t,this),delete this.simultaneous[t.id]),this},requireFailure:function(t){if(c(t,"requireFailure",this))return this;var e=this.requireFail;return-1===M(e,t=Tt(t,this))&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(c(t,"dropRequireFailure",this))return this;t=Tt(t,this);var e=M(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,i=this.state;function n(i){e.manager.emit(i,t)}i<8&&n(e.options.event+Mt(i)),n(e.options.event),t.additionalEvent&&n(t.additionalEvent),i>=8&&n(e.options.event+Mt(i))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=St},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},recognize:function(t){var e=s({},t);if(!v(this.options.enable,[this,e]))return this.reset(),void(this.state=St);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},process:function(t){},getTouchAction:function(){},reset:function(){}},g(Ct,Et,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,i=t.eventType,n=6&e,s=this.attrTest(t);return n&&(8&i||!s)?16|e:n||s?4&i?8|e:2&e?4|e:2:St}}),g(It,Ct,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var t=this.options.direction,e=[];return 6&t&&e.push(bt),t&O&&e.push(xt),e},directionTest:function(t){var e=this.options,i=!0,n=t.distance,s=t.direction,r=t.deltaX,a=t.deltaY;return s&e.direction||(6&e.direction?(s=0===r?1:r<0?2:4,i=r!=this.pX,n=Math.abs(t.deltaX)):(s=0===a?1:a<0?8:16,i=a!=this.pY,n=Math.abs(t.deltaY))),t.direction=s,i&&n>e.threshold&&s&e.direction},attrTest:function(t){return Ct.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=At(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),g(Dt,Ct,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[vt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),g(Lt,Et,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[gt]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distance<e.threshold,s=t.deltaTime>e.time;if(this._input=t,!n||!i||12&t.eventType&&!s)this.reset();else if(1&t.eventType)this.reset(),this._timer=u((function(){this.state=8,this.tryEmit()}),e.time,this);else if(4&t.eventType)return 8;return St},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&4&t.eventType?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}}),g(Bt,Ct,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[vt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),g(Pt,Ct,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return It.prototype.getTouchAction.call(this)},attrTest:function(t){var e,i=this.options.direction;return 30&i?e=t.overallVelocity:6&i?e=t.overallVelocityX:i&O&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&i&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&h(e)>this.options.velocity&&4&t.eventType},emit:function(t){var e=At(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),g(kt,Et,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[yt]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distance<e.threshold,s=t.deltaTime<e.time;if(this.reset(),1&t.eventType&&0===this.count)return this.failTimeout();if(n&&s&&i){if(4!=t.eventType)return this.failTimeout();var r=!this.pTime||t.timeStamp-this.pTime<e.interval,a=!this.pCenter||j(this.pCenter,t.center)<e.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,a&&r?this.count+=1:this.count=1,this._input=t,0==this.count%e.taps)return this.hasRequireFailures()?(this._timer=u((function(){this.state=8,this.tryEmit()}),e.interval,this),2):8}return St},failTimeout:function(){return this._timer=u((function(){this.state=St}),this.options.interval,this),St},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Nt.VERSION="2.0.7",Nt.defaults={domEvents:!1,touchAction:mt,enable:!0,inputTarget:null,inputClass:null,preset:[[Bt,{enable:!1}],[Dt,{enable:!1},["rotate"]],[Pt,{direction:6}],[It,{direction:6},["swipe"]],[kt],[kt,{event:"doubletap",taps:2},["tap"]],[Lt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},Ot.prototype={set:function(t){return s(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?2:1},recognize:function(t){var e=this.session;if(!e.stopped){var i;this.touchAction.preventDefaults(t);var n=this.recognizers,s=e.curRecognizer;(!s||s&&8&s.state)&&(s=e.curRecognizer=null);for(var r=0;r<n.length;)i=n[r],2===e.stopped||s&&i!=s&&!i.canRecognizeWith(s)?i.reset():i.recognize(t),!s&&14&i.state&&(s=e.curRecognizer=i),r++}},get:function(t){if(t instanceof Et)return t;for(var e=this.recognizers,i=0;i<e.length;i++)if(e[i].options.event==t)return e[i];return null},add:function(t){if(c(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(c(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,i=M(e,t);-1!==i&&(e.splice(i,1),this.touchAction.update())}return this},on:function(t,e){if(t!==n&&e!==n){var i=this.handlers;return d(E(t),(function(t){i[t]=i[t]||[],i[t].push(e)})),this}},off:function(t,e){if(t!==n){var i=this.handlers;return d(E(t),(function(t){e?i[t]&&i[t].splice(M(i[t],e),1):delete i[t]})),this}},emit:function(t,i){this.options.domEvents&&function(t,i){var n=e.createEvent("Event");n.initEvent(t,!0,!0),n.gesture=i,i.target.dispatchEvent(n)}(t,i);var n=this.handlers[t]&&this.handlers[t].slice();if(n&&n.length){i.type=t,i.preventDefault=function(){i.srcEvent.preventDefault()};for(var s=0;s<n.length;)n[s](i),s++}},destroy:function(){this.element&&Rt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},s(Nt,{INPUT_START:1,INPUT_MOVE:2,INPUT_END:4,INPUT_CANCEL:8,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:St,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:O,DIRECTION_ALL:30,Manager:Ot,Input:H,TouchAction:_t,TouchInput:ot,MouseInput:Z,PointerEventInput:et,TouchMouseInput:lt,SingleTouchInput:nt,Recognizer:Et,AttrRecognizer:Ct,Tap:kt,Pan:It,Swipe:Pt,Pinch:Dt,Rotate:Bt,Press:Lt,on:b,off:w,each:d,merge:m,extend:f,assign:s,inherit:g,bindFn:y,prefixed:C}),(void 0!==t?t:"undefined"!=typeof self?self:{}).Hammer=Nt,js.exports?js.exports=Nt:t.Hammer=Nt}(window,document);const Gs=_(Ys.exports),$s=new We,Xs=new We;class Zs extends Fi{constructor(t,e,i=!1){super(),c(this,"name","orbit-controller.ts"),c(this,"isSvg",!1),c(this,"dom"),c(this,"domOffset",new We),c(this,"camera"),c(this,"hammer"),c(this,"enabled",!0),c(this,"enablePan",!0),c(this,"enableRotate",!0),c(this,"rotateSpeed",1),c(this,"enableZoom",!0),c(this,"minZoom",0),c(this,"maxZoom",1/0),c(this,"zoomSpeed",1),c(this,"zoomChanged",!1),c(this,"distanceStart",1),c(this,"distanceEnd",1),c(this,"state",-1),c(this,"EPS",1e-6),c(this,"focus",new We),c(this,"target",new We),c(this,"scaled",1),c(this,"rotateTheta",0),c(this,"enableDamping",!1),c(this,"dampingFactor",.05),c(this,"mouseButtons",{LEFT:2,MIDDLE:1,RIGHT:0}),c(this,"isWheeling",!1),c(this,"finalTimer"),c(this,"rotateStart",new We),c(this,"rotateEnd",new We),c(this,"rotateDelta",new We),c(this,"panStart",new We),c(this,"panEnd",new We),c(this,"panOffset",new We),c(this,"dollyStart",0),c(this,"dollyOffset",new We),c(this,"contextMenuHandler",this.handleContextMenu.bind(this)),c(this,"wheelHandler",this.handleWheel.bind(this)),c(this,"pointerDownHandler",this.handlePointerDown.bind(this)),c(this,"pointerUpHandler",this.handlePointerUp.bind(this)),c(this,"pointerMoveHandler",this.handlePointerMove.bind(this)),c(this,"pointerOverHandler",ri.debounce(this.handlePointerOver.bind(this),50)),c(this,"pointerLeaveHandler",this.handlePointerLeave.bind(this)),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"doubleTapHandler",this.handleDoubleTap.bind(this)),c(this,"panHandler",this.handlePan.bind(this)),c(this,"pinchHandler",this.handlePinch.bind(this)),c(this,"pressHandler",this.handlePress.bind(this)),c(this,"swipeHandler",this.handleSwipe.bind(this)),c(this,"hammerInputHandler",this.handleHammerInput.bind(this)),this.isSvg=i,this.dom=t,this.camera=e,this.scaled=e.scaled.x,this.resize(),this.dom.style.touchAction="none",this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}resize(){let t=this.dom.getBoundingClientRect();this.domOffset.set(t.left,t.top)}update(){this.camera.position.add(this.panOffset).add(this.dollyOffset),this.camera.scaled.set(this.scaled,this.scaled),this.rotateTheta&&(this.camera.rotation.x-=this.rotateTheta,$s.copy(this.camera.position).rotateAround(this.focus,-this.rotateTheta),this.camera.position.copy($s)),this.camera.update(),this.panOffset.set(0,0),this.dollyOffset.set(0,0),this.scaled=this.camera.scaled.x,this.rotateTheta=0,this.dispatchEvent({type:"cameraChanged",data:{t:this.camera.position,r:this.camera.rotation.x,s:this.camera.scaled.x}})}bindEvents(){this.unbindEvents(),this.hammer=new Gs.Manager(this.dom,{domEvents:!0});const t=new Gs.Pan({threshold:0,pointers:0}),e=new Gs.Pinch({threshold:0}),i=new Gs.Tap({event:"singletap",taps:1}),n=new Gs.Tap({event:"doubletap",taps:2}),s=new Gs.Press({});this.hammer.add([t,n,i,s,e]),e.recognizeWith(t),n.recognizeWith(i),i.requireFailure(n),this.hammer.on(["panstart","panmove","panend"].join(" "),this.panHandler),this.hammer.on(["pinchstart","pinchmove","pinchend"].join(" "),this.pinchHandler),this.hammer.on("singletap",this.tapHandler),this.hammer.on("doubletap",this.doubleTapHandler),this.hammer.on("press",this.pressHandler),this.hammer.on("swipe",this.swipeHandler),this.hammer.on("hammer.input",this.hammerInputHandler),this.dom.addEventListener("contextmenu",this.contextMenuHandler),this.dom.addEventListener("wheel",this.wheelHandler,{passive:!1}),this.dom.addEventListener("mousemove",this.pointerOverHandler),this.isSvg||(this.dom.addEventListener("pointerdown",this.pointerDownHandler),this.dom.addEventListener("pointerleave",this.pointerLeaveHandler))}unbindEvents(){var t,e,i,n,s,r,a,o,h;null==(t=this.hammer)||t.off(["panstart","panmove","panend"].join(" "),this.panHandler),null==(e=this.hammer)||e.off(["pinchstart","pinchmove","pinchend"].join(" "),this.pinchHandler),null==(i=this.hammer)||i.off("singletap",this.tapHandler),null==(n=this.hammer)||n.off("doubletap",this.doubleTapHandler),null==(s=this.hammer)||s.off("press",this.pressHandler),null==(r=this.hammer)||r.off("swipe",this.swipeHandler),null==(a=this.hammer)||a.off("hammer.input",this.hammerInputHandler),this.dom.removeEventListener("contextmenu",this.contextMenuHandler),this.dom.removeEventListener("wheel",this.wheelHandler),this.dom.removeEventListener("mousemove",this.pointerOverHandler),this.isSvg||(this.dom.removeEventListener("pointerdown",this.pointerDownHandler),this.dom.removeEventListener("pointerleave",this.pointerLeaveHandler)),null==(o=this.hammer)||o.stop(!0),null==(h=this.hammer)||h.destroy()}setFocus(t,e){this.focus.set(t,e).sub(this.domOffset).unproject(this.camera)}handleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),Xs.set(t.center.x,t.center.y).sub(this.domOffset);const e={x:Xs.x,y:Xs.y};this.camera&&Xs.unproject(this.camera);const i={x:Xs.x,y:Xs.y};this.dispatchEvent({type:"tap",data:{screenCoords:e,worldCoords:i},e:t})}handleDoubleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),Xs.set(t.center.x,t.center.y).sub(this.domOffset);const e={x:Xs.x,y:Xs.y};this.camera&&Xs.unproject(this.camera);const i={x:Xs.x,y:Xs.y};this.dispatchEvent({type:"doubletap",data:{screenCoords:e,worldCoords:i}})}handlePress(t){"function"==typeof t.preventDefault&&t.preventDefault()}handlePan(t){var e;if(this.scaled=this.camera.scaled.x,1!==(null==(e=t.pointers)?void 0:e.length))return;"function"==typeof t.preventDefault&&t.preventDefault();const i={type:"panmove",data:{}};(t.isFirst||"panstart"===t.type)&&(this.state=2,this.panStart.set(t.center.x,t.center.y),i.type="panstart"),(t.isFinal||"panend"===t.type)&&(this.state=-1,i.type="panend"),this.panEnd.set(t.center.x,t.center.y),this.panOffset.subVectors(this.panEnd,this.panStart).multiplyScalar(-this.camera.scaled.x,-this.camera.scaled.y*(this.camera.flipY?1:-1)).rotate(this.camera.rotation.x),this.panStart.copy(this.panEnd),Xs.set(t.center.x,t.center.y).sub(this.domOffset),i.data.screenCoords=Xs.clone(),this.dispatchEvent(i),this.enablePan&&this.update()}handlePinch(t){"function"==typeof t.preventDefault&&t.preventDefault(),"pinchstart"===t.type&&(this.dollyStart=this.camera.scaled.x,this.state=1),(t.isFinal||"pinchend"===t.type)&&(this.state=-1),this.scaled=this.dollyStart*(1/t.scale);let e=(this.scaled-this.camera.scaled.x)/this.camera.scaled.x;this.setFocus(t.center.x,t.center.y),this.dollyOffset.copy(this.camera.position).lerp(this.focus,-e).sub(this.camera.position),this.update()}handleRotate(t){"function"==typeof t.preventDefault&&t.preventDefault()}handleSwipe(t){"function"==typeof t.preventDefault&&t.preventDefault()}handleHammerInput(t){t.isFirst&&(this.state=9),t.isFinal&&(this.state=-1)}handleContextMenu(t){this.enabled&&"function"==typeof t.preventDefault&&t.preventDefault()}handleWheel(t){if("function"==typeof t.preventDefault&&t.preventDefault(),!this.enabled||!this.enableZoom||-1!==this.state)return;this.isWheeling||(this.dispatchEvent({type:"wheelstart"}),this.isWheeling=!0),"function"==typeof t.preventDefault&&t.preventDefault(),"function"==typeof t.stopPropagation&&t.stopPropagation();let e=t.deltaY;1===(null==t?void 0:t.deltaMode)?e*=16:2===(null==t?void 0:t.deltaMode)&&(e*=100),(null==t?void 0:t.ctrlKey)&&(e*=10),this.setFocus(t.clientX,t.clientY);let i=this.getZoomScale(e);e<0?this.onDollyIn(i):e>0?this.onDollyOut(i):(this.scaled=this.camera.scaled.x,this.dollyOffset.set(0,0)),this.update(),clearTimeout(this.finalTimer),this.finalTimer=setTimeout((()=>{this.isWheeling&&(this.dispatchEvent({type:"wheelend"}),this.isWheeling=!1)}),500)}onDollyIn(t){this.scaled=Math.max(this.minZoom,Math.min(this.maxZoom,this.camera.scaled.x*t)),this.dollyOffset.copy(this.camera.position).lerp(this.focus,1-t).sub(this.camera.position)}onDollyOut(t){this.scaled=Math.max(this.minZoom,Math.min(this.maxZoom,this.camera.scaled.x/t)),this.dollyOffset.copy(this.camera.position).lerp(this.focus,-1+t).sub(this.camera.position)}getZoomScale(t){return Math.pow(.95,this.zoomSpeed*Math.abs(.03*t))}handlePointerDown(t){if(this.scaled=this.camera.scaled.x,!this.enabled)return;if(2!==t.button)return;this.dom.addEventListener("pointermove",this.pointerMoveHandler),this.dom.addEventListener("pointerup",this.pointerUpHandler);let e=-1;0===t.button?e=this.mouseButtons.LEFT:1===t.button?e=this.mouseButtons.MIDDLE:2===t.button&&(e=this.mouseButtons.RIGHT),0===e&&(this.rotateStart.set(t.clientX,t.clientY),this.setFocus(this.rotateStart.x,this.rotateStart.y),this.state=0)}handlePointerUp(){this.dom.removeEventListener("pointermove",this.pointerMoveHandler),this.dom.removeEventListener("pointerup",this.pointerUpHandler),this.state=-1}handlePointerLeave(){this.state=-1}handlePointerMove(t){if(this.enabled&&0===this.state){if(!this.enableRotate)return;this.onRotate(t.clientX,t.clientY)}}handlePointerOver(t){if(t.buttons>0)return;Xs.set(t.clientX,t.clientY).sub(this.domOffset);const e={x:Xs.x,y:Xs.y};Xs.unproject(this.camera);const i={x:Xs.x,y:Xs.y};this.dispatchEvent({type:"pointerover",data:{screenCoords:e,worldCoords:i},e:t})}onRotate(t,e){this.rotateEnd.set(t,e),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);const i=this.rotateDelta.x*Math.PI*2/this.dom.clientHeight;this.rotateTheta-=i,this.rotateStart.copy(this.rotateEnd),this.update()}}var Js=(t=>(t.CONTEXTMENU="contextmenu",t.LOSTPOINTERCAPTURE="lostpointercapture",t.MOUSEOVER="mouseover",t.MOUSEOUT="mouseout",t.MOUSELEAVE="mouseleave",t.MOUSEENTER="mouseenter",t.MOUSEMOVE="mousemove",t.MOUSEDOWN="mousedown",t.MOUSEUP="mouseup",t.POINTERMOVE="pointermove",t.POINTERDOWN="pointerdown",t.POINTERUP="pointerup",t.POINTERCANCEL="pointercancel",t.POINTEROUT="pointerout",t.POINTERLEAVE="pointerleave",t.POINTEROVER="pointerover",t.POINTERENTER="pointerenter",t.TOUCHSTART="touchstart",t.TOUCHEND="touchend",t.TOUCHMOVE="touchmove",t.TOUCHCANCEL="touchcancel",t.WHEEL="wheel",t.WHEEL_START="wheelstart",t.WHEEL_END="wheelend",t.MOUSEWHEEL="mousewheel",t.CLICK="click",t.DBLCLICK="dblclick",t.CONTEXT_LOST="contextlost",t.CONTEXT_RESTORED="contextrestored",t.CONTROLS_CHANGED="controlschanged",t.TAP="tap",t.SINGLE_TAP="singletap",t.DOUBLE_TAP="doubletap",t.PRESS="press",t.PAN="pan",t.PAN_START="panstart",t.PAN_MOVE="panmove",t.PAN_END="panend",t.ROTATE="rotate",t.ROTATE_START="rotatestart",t.ROTATE_MOVE="rotatemove",t.ROTATE_END="rotateend",t.PINCH="pinch",t.PINCH_START="pinchstart",t.PINCH_MOVE="pinchmove",t.PINCH_END="pinchend",t.PINCH_IN="pinchin",t.PINCH_OUT="pinchout",t.SWIPE="swipe",t.CHANGE_START="change_start",t.CHANGE_END="change_end",t.CAMERA_CHANGED="cameraChanged",t))(Js||{});const Qs=new We;class Ks extends ms{constructor(t){super(),c(this,"isCamera",!0),c(this,"type","Camera2"),c(this,"name","Camera2"),c(this,"params"),c(this,"matrixAutoUpdate",!1),c(this,"matrixWorldAutoUpdate",!1),c(this,"projectionMatrix",new Ui),c(this,"projectionMatrixInverse",new Ui),c(this,"viewMatrix",new Ui),c(this,"viewMatrixNeedsUpdate",!0),c(this,"viewArea",0),c(this,"left",-1),c(this,"right",1),c(this,"top",1),c(this,"bottom",-1),c(this,"width",2),c(this,"height",2),c(this,"aspect",1),c(this,"view"),this.params=t,this.width=void 0!==(null==t?void 0:t.width)?t.width:2,this.height=void 0!==(null==t?void 0:t.height)?t.height:2,this.aspect=void 0!==(null==t?void 0:t.aspect)?t.aspect:1,void 0!==(null==t?void 0:t.left)&&(this.left=t.left),void 0!==(null==t?void 0:t.right)&&(this.right=t.right),void 0!==(null==t?void 0:t.top)&&(this.top=t.top),void 0!==(null==t?void 0:t.bottom)&&(this.bottom=t.bottom);const e=(this.right+this.left)/2,i=(this.top+this.bottom)/2;if(this.aspect>1){const t=Math.round((this.right-this.left)/2/this.aspect);this.top=i+t,this.bottom=i-t}else if(this.aspect<1){const t=Math.round((this.top-this.bottom)/2*this.aspect);this.left=e-t,this.right=e+t}this.flipY=!0===(null==t?void 0:t.flipY),this.updateProjectionMatrix(),(null==t?void 0:t.eye)&&this.position.fromArray(t.eye),(null==t?void 0:t.up)&&this.up.fromArray(t.up),this.computeBoundingBox(),this.update()}destroy(){super.destroy()}get pixelWidth(){return this.scaled.x}set(t=-1,e=1,i=1,n=-1){Qs.set(t+e,n+i).multiplyScalar(.5);const s=Math.max((e-t)/this.width,(i-n)/this.height);this.setTRS(Qs,0,s)}setByBox(t){t&&!t.isEmpty()&&this.set(t.min.x,t.max.x,t.max.y,t.min.y)}setTRS(t={x:0,y:0},e=0,i=0){this.position.set(t.x||0,t.y||0),this.rotation.set(e,e),this.scaled.set(i,i),this.update()}resize(){this.setSize(this.params.width,this.params.height)}setSize(t,e){this.width=t||2,this.height=e||2,this.left=this.params.left||-1,this.right=this.params.right||1,this.top=this.params.top||1,this.bottom=this.params.bottom||-1,this.aspect=t/e;const i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;if(this.aspect>1){const t=Math.round((this.right-this.left)/2/this.aspect);this.top=n+t,this.bottom=n-t}else if(this.aspect<1){const t=Math.round((this.top-this.bottom)/2*this.aspect);this.left=i-t,this.right=i+t}this.updateProjectionMatrix(),this.boundingBox.min.set(this.left,this.bottom),this.boundingBox.max.set(this.right,this.top),this.update(),this.matrix.decompose(this.position,this.rotation,this.scaled)}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[6],-e[7]).normalize()}getCameraPosition(){return{x:this.position.x,y:this.position.y,z:this.position.z,s:this.scaled.x,r:this.rotation.x}}updateMatrixWorld(t=!1){super.updateMatrixWorld(t),this.updateViewMatrix()}updateProjectionMatrix(){void 0===this.parent&&this.matrixWorldAutoUpdate&&this.updateMatrixWorld(),this.projectionMatrix.makeProjection(this.left,this.right,this.top,this.bottom,this.width,this.height),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}updateViewMatrix(){this.matrixWorldInverse.copy(this.matrixWorld).invert(),this.viewMatrix.multiplyMatrices(this.projectionMatrix,this.matrixWorldInverse)}update(t=!0){this.matrixAutoUpdate||this.updateMatrix(),this.updateMatrixWorld(),this.needsUpdate=!0,this.updateBoundingBox(),t&&this.dispatchEvent({type:"update",data:{t:this.position,r:this.rotation.x,s:this.scaled.x}})}computeBoundingBox(){return this.boundingBox.min.set(this.left,this.bottom),this.boundingBox.max.set(this.right,this.top),this.boundingBox}updateBoundingBox(){super.updateBoundingBox(),this.viewArea=this.boundingBoxWorld.getArea()}toJSON(){const t={};return t.left=this.left,t.right=this.right,t.top=this.top,t.bottom=this.bottom,t.width=this.width,t.height=this.height,t.aspect=this.aspect,t.position=this.position.toArray(),t.rotation=this.rotation.toArray(),t.scaled=this.scaled.toArray(),t}fromJSON(t){this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.width=t.width,this.height=t.height,this.aspect=t.aspect,this.position.fromArray(t.position),this.rotation.fromArray(t.rotation),this.scaled.fromArray(t.scaled),this.updateProjectionMatrix(),this.update(!1)}clone(){return(new this.constructor.prototype.constructor).copy(this)}copy(t,e=!0,i=!1){return super.copy(t,e,i),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.width=t.width,this.height=t.height,this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this}}var tr=(t=>(t.UPDATE="update",t))(tr||{});class er extends Fi{constructor(t){super(),c(this,"name","SvgSelectRect"),c(this,"container"),c(this,"el"),this.container=t||document.getElementsByTagName("body")[0],this.el=document.createElement("div"),this.el.setAttribute("id","aeSvgSelectRect"),this.el.setAttribute("class","ae-svg-select-rect"),this.el.style.display="none",this.container.appendChild(this.el)}destroy(){super.destroy(),this.el&&this.el.remove()}draw(t){ir.copy(t).getSize(sr),nr.copy(ir.min),this.el.style.display="none",this.el.style.position="absolute",this.el.style.left=nr.x+"px",this.el.style.top=nr.y+"px",this.el.style.width=sr.x+"px",this.el.style.height=sr.y+"px",this.el.style.display="block",this.el.style.background=new Re(Le.darkBlue).setA(.1).getStyle(),this.el.style.border=Le.darkBlue+" 1px dashed"}hide(){this.el.style.display="none"}}const ir=new ai,nr=new We,sr=new We;class rr extends Fi{constructor(t,e){super(),c(this,"name","SvgMultiSelector"),c(this,"controller"),c(this,"scene"),c(this,"container"),c(this,"p1",new We),c(this,"p2",new We),c(this,"graph"),c(this,"selectEnable",!1),c(this,"multiSelectEnable",!1),c(this,"fnEnable",!1),c(this,"controllerTapHandler",this.handleControllerTap.bind(this)),c(this,"controllerPanStartHandler",this.handleControllerPanStart.bind(this)),c(this,"controllerPanMoveHandler",this.handleControllerPanMove.bind(this)),c(this,"controllerPanEndHandler",this.handleControllerPanEnd.bind(this)),this.container=t,this.controller=e,this.graph=new er(t),this.bindControllerEvents()}destroy(){this.unbindControllerEvents(),super.destroy()}bindScene(t){this.scene=t}selectEnableChanged(t){var e;null==(e=this.scene)||e.clearSelected(),this.selectEnable=!!t}multiSelectEnableChanged(t){var e;null==(e=this.scene)||e.clearSelected(),this.multiSelectEnable=!!t,this.controller.enablePan=!this.multiSelectEnable||this.multiSelectEnable&&!this.fnEnable}fnEnableChanged(t){this.fnEnable=!!t,this.controller.enablePan=!this.multiSelectEnable||this.multiSelectEnable&&!this.fnEnable}bindControllerEvents(){this.controller.addEventListener(Js.TAP,this.controllerTapHandler),this.controller.addEventListener(Js.PAN_START,this.controllerPanStartHandler),this.controller.addEventListener(Js.PAN_MOVE,this.controllerPanMoveHandler),this.controller.addEventListener(Js.PAN_END,this.controllerPanEndHandler)}unbindControllerEvents(){this.controller.removeEventListener(Js.TAP,this.controllerTapHandler),this.controller.removeEventListener(Js.PAN_START,this.controllerPanStartHandler),this.controller.removeEventListener(Js.PAN_MOVE,this.controllerPanMoveHandler),this.controller.removeEventListener(Js.PAN_END,this.controllerPanEndHandler)}handleControllerTap(t){var e,i,n,s,r,a;if((null==t?void 0:t.type)!==Js.TAP)return;if(!this.selectEnable&&!this.multiSelectEnable)return;const o=(null==(e=null==t?void 0:t.e)?void 0:e.target)||(null==(n=null==(i=null==t?void 0:t.e)?void 0:i.srcEvent)?void 0:n.target)||(null==(r=null==(s=null==t?void 0:t.e)?void 0:s.srcEvent)?void 0:r.srcElement);(null==o?void 0:o.id)&&(null==(a=this.scene)?void 0:a.isBelongsToAssetType(null==o?void 0:o.id))&&this.dispatchEvent({type:"SELECTED",data:u(l({},t.data),{target:[o],selected:[null==o?void 0:o.id]})})}handleControllerPanStart(t){(null==t?void 0:t.type)===Js.PAN_START&&this.multiSelectEnable&&(this.controller.enablePan||(this.p1.copy(t.data.screenCoords),or.makeEmpty().expandByPoint(this.p1),this.graph.draw(or)))}handleControllerPanMove(t){(null==t?void 0:t.type)===Js.PAN_MOVE&&this.multiSelectEnable&&(this.controller.enablePan||(this.p2.copy(t.data.screenCoords),or.makeEmpty().expandByPoint(this.p1).expandByPoint(this.p2),this.graph.draw(or)))}handleControllerPanEnd(t){var e;if((null==t?void 0:t.type)!==Js.PAN_END)return;if(!this.multiSelectEnable)return;if(this.controller.enablePan)return;this.p2.copy(t.data.screenCoords),or.makeEmpty().expandByPoint(this.p1).expandByPoint(this.p2).unproject(this.controller.camera);const i=null==(e=this.scene)?void 0:e.getElementsByBox(or),n=[];(i||[]).forEach((t=>n.push(t.id))),this.graph.hide(),or.makeEmpty(),this.dispatchEvent({type:"SELECTED",data:{target:i,selected:n}})}}var ar=(t=>(t.SELECTED="SELECTED",t))(ar||{});const or=new ai;var hr=(t=>(t.DEFAULT="default",t.INFO="info",t.PRIMARY="primary",t.SUCCESS="success",t.WARNING="warning",t.DANGER="danger",t))(hr||{});class lr{constructor(){c(this,"camera"),c(this,"screenCoords",new We),c(this,"worldCoords",new We),c(this,"worldBox",new ai),c(this,"intersectType",0),c(this,"params",{Shape:{},Line:{threshold:1},Points:{threshold:1},Sprite:{}})}setFromCamera(t,e){return this.camera=e,this.screenCoords.set(t.x,t.y),this.worldCoords.copy(this.screenCoords).unproject(e),this}init(t,e){return this.camera=e,(null==t?void 0:t.screenCoords)&&this.screenCoords.set(t.screenCoords.x,t.screenCoords.y),(null==t?void 0:t.worldCoords)?this.worldCoords.set(t.worldCoords.x,t.worldCoords.y):e&&this.worldCoords.copy(this.screenCoords).unproject(e),(null==t?void 0:t.worldBox)&&this.worldBox.copy(t.worldBox),this.intersectType=void 0!==(null==t?void 0:t.worldBox)?1:0,this}intersectObjects(t,e=!0,i=[]){for(let n=0,s=t.length;n<s;n++)this.intersectObject(t[n],e,i)}intersectObject(t,e=!1,i=[]){if(!t.selectable||!t.visible)return i;if(t.raycast(this,i),!e||t.composeNode)return i;for(let n=0,s=t.children.length;n<s;n++)this.intersectObject(t.children[n],e,i);return i}intersectObjectBy(t,e,i=!0,n=[]){if(!t.selectable||!t.visible)return n;if("function"==typeof e&&e(t)&&t.raycast(this,n),!i||t.composeNode)return n;for(let s=0,r=t.children.length;s<r;s++)this.intersectObjectBy(t.children[s],e,i,n);return n}}var ur="top",cr="bottom",dr="right",pr="left",fr="auto",mr=[ur,cr,dr,pr],gr="start",yr="end",vr="viewport",xr="popper",br=mr.reduce((function(t,e){return t.concat([e+"-"+gr,e+"-"+yr])}),[]),wr=[].concat(mr,[fr]).reduce((function(t,e){return t.concat([e,e+"-"+gr,e+"-"+yr])}),[]),_r=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Sr(t){return t?(t.nodeName||"").toLowerCase():null}function Er(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Mr(t){return t instanceof Er(t).Element||t instanceof Element}function Ar(t){return t instanceof Er(t).HTMLElement||t instanceof HTMLElement}function Tr(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Er(t).ShadowRoot||t instanceof ShadowRoot)}const Cr={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];Ar(s)&&Sr(s)&&(Object.assign(s.style,i),Object.keys(n).forEach((function(t){var e=n[t];!1===e?s.removeAttribute(t):s.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],s=e.attributes[t]||{},r=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});Ar(n)&&Sr(n)&&(Object.assign(n.style,r),Object.keys(s).forEach((function(t){n.removeAttribute(t)})))}))}},requires:["computeStyles"]};function Ir(t){return t.split("-")[0]}var Dr=Math.max,Lr=Math.min,Br=Math.round;function Pr(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function kr(){return!/^((?!chrome|android).)*safari/i.test(Pr())}function Nr(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=t.getBoundingClientRect(),s=1,r=1;e&&Ar(t)&&(s=t.offsetWidth>0&&Br(n.width)/t.offsetWidth||1,r=t.offsetHeight>0&&Br(n.height)/t.offsetHeight||1);var a=(Mr(t)?Er(t):window).visualViewport,o=!kr()&&i,h=(n.left+(o&&a?a.offsetLeft:0))/s,l=(n.top+(o&&a?a.offsetTop:0))/r,u=n.width/s,c=n.height/r;return{width:u,height:c,top:l,right:h+u,bottom:l+c,left:h,x:h,y:l}}function Or(t){var e=Nr(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function Rr(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&Tr(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function zr(t){return Er(t).getComputedStyle(t)}function Hr(t){return["table","td","th"].indexOf(Sr(t))>=0}function Wr(t){return((Mr(t)?t.ownerDocument:t.document)||window.document).documentElement}function Fr(t){return"html"===Sr(t)?t:t.assignedSlot||t.parentNode||(Tr(t)?t.host:null)||Wr(t)}function Ur(t){return Ar(t)&&"fixed"!==zr(t).position?t.offsetParent:null}function Vr(t){for(var e=Er(t),i=Ur(t);i&&Hr(i)&&"static"===zr(i).position;)i=Ur(i);return i&&("html"===Sr(i)||"body"===Sr(i)&&"static"===zr(i).position)?e:i||function(t){var e=/firefox/i.test(Pr());if(/Trident/i.test(Pr())&&Ar(t)&&"fixed"===zr(t).position)return null;var i=Fr(t);for(Tr(i)&&(i=i.host);Ar(i)&&["html","body"].indexOf(Sr(i))<0;){var n=zr(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(t)||e}function qr(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function jr(t,e,i){return Dr(t,Lr(e,i))}function Yr(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Gr(t,e){return e.reduce((function(e,i){return e[i]=t,e}),{})}function $r(t){return t.split("-")[1]}var Xr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Zr(t){var e,i=t.popper,n=t.popperRect,s=t.placement,r=t.variation,a=t.offsets,o=t.position,h=t.gpuAcceleration,l=t.adaptive,u=t.roundOffsets,c=t.isFixed,d=a.x,p=void 0===d?0:d,f=a.y,m=void 0===f?0:f,g="function"==typeof u?u({x:p,y:m}):{x:p,y:m};p=g.x,m=g.y;var y=a.hasOwnProperty("x"),v=a.hasOwnProperty("y"),x=pr,b=ur,w=window;if(l){var _=Vr(i),S="clientHeight",E="clientWidth";if(_===Er(i)&&"static"!==zr(_=Wr(i)).position&&"absolute"===o&&(S="scrollHeight",E="scrollWidth"),s===ur||(s===pr||s===dr)&&r===yr)b=cr,m-=(c&&_===w&&w.visualViewport?w.visualViewport.height:_[S])-n.height,m*=h?1:-1;if(s===pr||(s===ur||s===cr)&&r===yr)x=dr,p-=(c&&_===w&&w.visualViewport?w.visualViewport.width:_[E])-n.width,p*=h?1:-1}var M,A=Object.assign({position:o},l&&Xr),T=!0===u?function(t,e){var i=t.x,n=t.y,s=e.devicePixelRatio||1;return{x:Br(i*s)/s||0,y:Br(n*s)/s||0}}({x:p,y:m},Er(i)):{x:p,y:m};return p=T.x,m=T.y,h?Object.assign({},A,((M={})[b]=v?"0":"",M[x]=y?"0":"",M.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",M)):Object.assign({},A,((e={})[b]=v?m+"px":"",e[x]=y?p+"px":"",e.transform="",e))}var Jr={passive:!0};var Qr={left:"right",right:"left",bottom:"top",top:"bottom"};function Kr(t){return t.replace(/left|right|bottom|top/g,(function(t){return Qr[t]}))}var ta={start:"end",end:"start"};function ea(t){return t.replace(/start|end/g,(function(t){return ta[t]}))}function ia(t){var e=Er(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function na(t){return Nr(Wr(t)).left+ia(t).scrollLeft}function sa(t){var e=zr(t),i=e.overflow,n=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(i+s+n)}function ra(t){return["html","body","#document"].indexOf(Sr(t))>=0?t.ownerDocument.body:Ar(t)&&sa(t)?t:ra(Fr(t))}function aa(t,e){var i;void 0===e&&(e=[]);var n=ra(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),r=Er(n),a=s?[r].concat(r.visualViewport||[],sa(n)?n:[]):n,o=e.concat(a);return s?o:o.concat(aa(Fr(a)))}function oa(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function ha(t,e,i){return e===vr?oa(function(t,e){var i=Er(t),n=Wr(t),s=i.visualViewport,r=n.clientWidth,a=n.clientHeight,o=0,h=0;if(s){r=s.width,a=s.height;var l=kr();(l||!l&&"fixed"===e)&&(o=s.offsetLeft,h=s.offsetTop)}return{width:r,height:a,x:o+na(t),y:h}}(t,i)):Mr(e)?function(t,e){var i=Nr(t,!1,"fixed"===e);return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}(e,i):oa(function(t){var e,i=Wr(t),n=ia(t),s=null==(e=t.ownerDocument)?void 0:e.body,r=Dr(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),a=Dr(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),o=-n.scrollLeft+na(t),h=-n.scrollTop;return"rtl"===zr(s||i).direction&&(o+=Dr(i.clientWidth,s?s.clientWidth:0)-r),{width:r,height:a,x:o,y:h}}(Wr(t)))}function la(t,e,i,n){var s="clippingParents"===e?function(t){var e=aa(Fr(t)),i=["absolute","fixed"].indexOf(zr(t).position)>=0&&Ar(t)?Vr(t):t;return Mr(i)?e.filter((function(t){return Mr(t)&&Rr(t,i)&&"body"!==Sr(t)})):[]}(t):[].concat(e),r=[].concat(s,[i]),a=r[0],o=r.reduce((function(e,i){var s=ha(t,i,n);return e.top=Dr(s.top,e.top),e.right=Lr(s.right,e.right),e.bottom=Lr(s.bottom,e.bottom),e.left=Dr(s.left,e.left),e}),ha(t,a,n));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function ua(t){var e,i=t.reference,n=t.element,s=t.placement,r=s?Ir(s):null,a=s?$r(s):null,o=i.x+i.width/2-n.width/2,h=i.y+i.height/2-n.height/2;switch(r){case ur:e={x:o,y:i.y-n.height};break;case cr:e={x:o,y:i.y+i.height};break;case dr:e={x:i.x+i.width,y:h};break;case pr:e={x:i.x-n.width,y:h};break;default:e={x:i.x,y:i.y}}var l=r?qr(r):null;if(null!=l){var u="y"===l?"height":"width";switch(a){case gr:e[l]=e[l]-(i[u]/2-n[u]/2);break;case yr:e[l]=e[l]+(i[u]/2-n[u]/2)}}return e}function ca(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=void 0===n?t.placement:n,r=i.strategy,a=void 0===r?t.strategy:r,o=i.boundary,h=void 0===o?"clippingParents":o,l=i.rootBoundary,u=void 0===l?vr:l,c=i.elementContext,d=void 0===c?xr:c,p=i.altBoundary,f=void 0!==p&&p,m=i.padding,g=void 0===m?0:m,y=Yr("number"!=typeof g?g:Gr(g,mr)),v=d===xr?"reference":xr,x=t.rects.popper,b=t.elements[f?v:d],w=la(Mr(b)?b:b.contextElement||Wr(t.elements.popper),h,u,a),_=Nr(t.elements.reference),S=ua({reference:_,element:x,placement:s}),E=oa(Object.assign({},x,S)),M=d===xr?E:_,A={top:w.top-M.top+y.top,bottom:M.bottom-w.bottom+y.bottom,left:w.left-M.left+y.left,right:M.right-w.right+y.right},T=t.modifiersData.offset;if(d===xr&&T){var C=T[s];Object.keys(A).forEach((function(t){var e=[dr,cr].indexOf(t)>=0?1:-1,i=[ur,cr].indexOf(t)>=0?"y":"x";A[t]+=C[i]*e}))}return A}function da(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function pa(t){return[ur,dr,cr,pr].some((function(e){return t[e]>=0}))}function fa(t,e,i){void 0===i&&(i=!1);var n,s,r=Ar(e),a=Ar(e)&&function(t){var e=t.getBoundingClientRect(),i=Br(e.width)/t.offsetWidth||1,n=Br(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),o=Wr(e),h=Nr(t,a,i),l={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(r||!r&&!i)&&(("body"!==Sr(e)||sa(o))&&(l=(n=e)!==Er(n)&&Ar(n)?{scrollLeft:(s=n).scrollLeft,scrollTop:s.scrollTop}:ia(n)),Ar(e)?((u=Nr(e,!0)).x+=e.clientLeft,u.y+=e.clientTop):o&&(u.x=na(o))),{x:h.left+l.scrollLeft-u.x,y:h.top+l.scrollTop-u.y,width:h.width,height:h.height}}function ma(t){var e=new Map,i=new Set,n=[];function s(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!i.has(t)){var n=e.get(t);n&&s(n)}})),n.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){i.has(t.name)||s(t)})),n}var ga={placement:"bottom",modifiers:[],strategy:"absolute"};function ya(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return!e.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function va(t){void 0===t&&(t={});var e=t,i=e.defaultModifiers,n=void 0===i?[]:i,s=e.defaultOptions,r=void 0===s?ga:s;return function(t,e,i){void 0===i&&(i=r);var s,a,o={placement:"bottom",orderedModifiers:[],options:Object.assign({},ga,r),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},h=[],l=!1,u={state:o,setOptions:function(i){var s="function"==typeof i?i(o.options):i;c(),o.options=Object.assign({},r,o.options,s),o.scrollParents={reference:Mr(t)?aa(t):t.contextElement?aa(t.contextElement):[],popper:aa(e)};var a,l,d=function(t){var e=ma(t);return _r.reduce((function(t,i){return t.concat(e.filter((function(t){return t.phase===i})))}),[])}((a=[].concat(n,o.options.modifiers),l=a.reduce((function(t,e){var i=t[e.name];return t[e.name]=i?Object.assign({},i,e,{options:Object.assign({},i.options,e.options),data:Object.assign({},i.data,e.data)}):e,t}),{}),Object.keys(l).map((function(t){return l[t]}))));return o.orderedModifiers=d.filter((function(t){return t.enabled})),o.orderedModifiers.forEach((function(t){var e=t.name,i=t.options,n=void 0===i?{}:i,s=t.effect;if("function"==typeof s){var r=s({state:o,name:e,instance:u,options:n}),a=function(){};h.push(r||a)}})),u.update()},forceUpdate:function(){if(!l){var t=o.elements,e=t.reference,i=t.popper;if(ya(e,i)){o.rects={reference:fa(e,Vr(i),"fixed"===o.options.strategy),popper:Or(i)},o.reset=!1,o.placement=o.options.placement,o.orderedModifiers.forEach((function(t){return o.modifiersData[t.name]=Object.assign({},t.data)}));for(var n=0;n<o.orderedModifiers.length;n++)if(!0!==o.reset){var s=o.orderedModifiers[n],r=s.fn,a=s.options,h=void 0===a?{}:a,c=s.name;"function"==typeof r&&(o=r({state:o,options:h,name:c,instance:u})||o)}else o.reset=!1,n=-1}}},update:(s=function(){return new Promise((function(t){u.forceUpdate(),t(o)}))},function(){return a||(a=new Promise((function(t){Promise.resolve().then((function(){a=void 0,t(s())}))}))),a}),destroy:function(){c(),l=!0}};if(!ya(t,e))return u;function c(){h.forEach((function(t){return t()})),h=[]}return u.setOptions(i).then((function(t){!l&&i.onFirstUpdate&&i.onFirstUpdate(t)})),u}}var xa=va({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,s=n.scroll,r=void 0===s||s,a=n.resize,o=void 0===a||a,h=Er(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&l.forEach((function(t){t.addEventListener("scroll",i.update,Jr)})),o&&h.addEventListener("resize",i.update,Jr),function(){r&&l.forEach((function(t){t.removeEventListener("scroll",i.update,Jr)})),o&&h.removeEventListener("resize",i.update,Jr)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,i=t.name;e.modifiersData[i]=ua({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,s=void 0===n||n,r=i.adaptive,a=void 0===r||r,o=i.roundOffsets,h=void 0===o||o,l={placement:Ir(e.placement),variation:$r(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,Zr(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:h})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,Zr(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:h})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},Cr,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.offset,r=void 0===s?[0,0]:s,a=wr.reduce((function(t,i){return t[i]=function(t,e,i){var n=Ir(t),s=[pr,ur].indexOf(n)>=0?-1:1,r="function"==typeof i?i(Object.assign({},e,{placement:t})):i,a=r[0],o=r[1];return a=a||0,o=(o||0)*s,[pr,dr].indexOf(n)>=0?{x:o,y:a}:{x:a,y:o}}(i,e.rects,r),t}),{}),o=a[e.placement],h=o.x,l=o.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=h,e.modifiersData.popperOffsets.y+=l),e.modifiersData[n]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var s=i.mainAxis,r=void 0===s||s,a=i.altAxis,o=void 0===a||a,h=i.fallbackPlacements,l=i.padding,u=i.boundary,c=i.rootBoundary,d=i.altBoundary,p=i.flipVariations,f=void 0===p||p,m=i.allowedAutoPlacements,g=e.options.placement,y=Ir(g),v=h||(y===g||!f?[Kr(g)]:function(t){if(Ir(t)===fr)return[];var e=Kr(t);return[ea(t),e,ea(e)]}(g)),x=[g].concat(v).reduce((function(t,i){return t.concat(Ir(i)===fr?function(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=i.boundary,r=i.rootBoundary,a=i.padding,o=i.flipVariations,h=i.allowedAutoPlacements,l=void 0===h?wr:h,u=$r(n),c=u?o?br:br.filter((function(t){return $r(t)===u})):mr,d=c.filter((function(t){return l.indexOf(t)>=0}));0===d.length&&(d=c);var p=d.reduce((function(e,i){return e[i]=ca(t,{placement:i,boundary:s,rootBoundary:r,padding:a})[Ir(i)],e}),{});return Object.keys(p).sort((function(t,e){return p[t]-p[e]}))}(e,{placement:i,boundary:u,rootBoundary:c,padding:l,flipVariations:f,allowedAutoPlacements:m}):i)}),[]),b=e.rects.reference,w=e.rects.popper,_=new Map,S=!0,E=x[0],M=0;M<x.length;M++){var A=x[M],T=Ir(A),C=$r(A)===gr,I=[ur,cr].indexOf(T)>=0,D=I?"width":"height",L=ca(e,{placement:A,boundary:u,rootBoundary:c,altBoundary:d,padding:l}),B=I?C?dr:pr:C?cr:ur;b[D]>w[D]&&(B=Kr(B));var P=Kr(B),k=[];if(r&&k.push(L[T]<=0),o&&k.push(L[B]<=0,L[P]<=0),k.every((function(t){return t}))){E=A,S=!1;break}_.set(A,k)}if(S)for(var N=function(t){var e=x.find((function(e){var i=_.get(e);if(i)return i.slice(0,t).every((function(t){return t}))}));if(e)return E=e,"break"},O=f?3:1;O>0;O--){if("break"===N(O))break}e.placement!==E&&(e.modifiersData[n]._skip=!0,e.placement=E,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.mainAxis,r=void 0===s||s,a=i.altAxis,o=void 0!==a&&a,h=i.boundary,l=i.rootBoundary,u=i.altBoundary,c=i.padding,d=i.tether,p=void 0===d||d,f=i.tetherOffset,m=void 0===f?0:f,g=ca(e,{boundary:h,rootBoundary:l,padding:c,altBoundary:u}),y=Ir(e.placement),v=$r(e.placement),x=!v,b=qr(y),w="x"===b?"y":"x",_=e.modifiersData.popperOffsets,S=e.rects.reference,E=e.rects.popper,M="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,A="number"==typeof M?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),T=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,C={x:0,y:0};if(_){if(r){var I,D="y"===b?ur:pr,L="y"===b?cr:dr,B="y"===b?"height":"width",P=_[b],k=P+g[D],N=P-g[L],O=p?-E[B]/2:0,R=v===gr?S[B]:E[B],z=v===gr?-E[B]:-S[B],H=e.elements.arrow,W=p&&H?Or(H):{width:0,height:0},F=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},U=F[D],V=F[L],q=jr(0,S[B],W[B]),j=x?S[B]/2-O-q-U-A.mainAxis:R-q-U-A.mainAxis,Y=x?-S[B]/2+O+q+V+A.mainAxis:z+q+V+A.mainAxis,G=e.elements.arrow&&Vr(e.elements.arrow),$=G?"y"===b?G.clientTop||0:G.clientLeft||0:0,X=null!=(I=null==T?void 0:T[b])?I:0,Z=P+Y-X,J=jr(p?Lr(k,P+j-X-$):k,P,p?Dr(N,Z):N);_[b]=J,C[b]=J-P}if(o){var Q,K="x"===b?ur:pr,tt="x"===b?cr:dr,et=_[w],it="y"===w?"height":"width",nt=et+g[K],st=et-g[tt],rt=-1!==[ur,pr].indexOf(y),at=null!=(Q=null==T?void 0:T[w])?Q:0,ot=rt?nt:et-S[it]-E[it]-at+A.altAxis,ht=rt?et+S[it]+E[it]-at-A.altAxis:st,lt=p&&rt?(ct=jr(ot,et,ut=ht))>ut?ut:ct:jr(p?ot:nt,et,p?ht:st);_[w]=lt,C[w]=lt-et}var ut,ct;e.modifiersData[n]=C}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,s=t.options,r=i.elements.arrow,a=i.modifiersData.popperOffsets,o=Ir(i.placement),h=qr(o),l=[pr,dr].indexOf(o)>=0?"height":"width";if(r&&a){var u=function(t,e){return Yr("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Gr(t,mr))}(s.padding,i),c=Or(r),d="y"===h?ur:pr,p="y"===h?cr:dr,f=i.rects.reference[l]+i.rects.reference[h]-a[h]-i.rects.popper[l],m=a[h]-i.rects.reference[h],g=Vr(r),y=g?"y"===h?g.clientHeight||0:g.clientWidth||0:0,v=f/2-m/2,x=u[d],b=y-c[l]-u[p],w=y/2-c[l]/2+v,_=jr(x,w,b),S=h;i.modifiersData[n]=((e={})[S]=_,e.centerOffset=_-w,e)}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&Rr(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,s=e.rects.popper,r=e.modifiersData.preventOverflow,a=ca(e,{elementContext:"reference"}),o=ca(e,{altBoundary:!0}),h=da(a,n),l=da(o,s,r),u=pa(h),c=pa(l);e.modifiersData[i]={referenceClippingOffsets:h,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:c},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":c})}}]}),ba="tippy-content",wa="tippy-arrow",_a="tippy-svg-arrow",Sa={passive:!0,capture:!0},Ea=function(){return document.body};function Ma(t,e,i){if(Array.isArray(t)){var n=t[e];return null==n?Array.isArray(i)?i[e]:i:n}return t}function Aa(t,e){var i={}.toString.call(t);return 0===i.indexOf("[object")&&i.indexOf(e+"]")>-1}function Ta(t,e){return"function"==typeof t?t.apply(void 0,e):t}function Ca(t,e){return 0===e?t:function(n){clearTimeout(i),i=setTimeout((function(){t(n)}),e)};var i}function Ia(t){return[].concat(t)}function Da(t,e){-1===t.indexOf(e)&&t.push(e)}function La(t){return[].slice.call(t)}function Ba(t){return Object.keys(t).reduce((function(e,i){return void 0!==t[i]&&(e[i]=t[i]),e}),{})}function Pa(){return document.createElement("div")}function ka(t){return["Element","Fragment"].some((function(e){return Aa(t,e)}))}function Na(t){return ka(t)?[t]:function(t){return Aa(t,"NodeList")}(t)?La(t):Array.isArray(t)?t:La(document.querySelectorAll(t))}function Oa(t,e){t.forEach((function(t){t&&(t.style.transitionDuration=e+"ms")}))}function Ra(t,e){t.forEach((function(t){t&&t.setAttribute("data-state",e)}))}function za(t,e,i){var n=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(e){t[n](e,i)}))}function Ha(t,e){for(var i=e;i;){var n;if(t.contains(i))return!0;i=null==i.getRootNode||null==(n=i.getRootNode())?void 0:n.host}return!1}var Wa={isTouch:!1},Fa=0;function Ua(){Wa.isTouch||(Wa.isTouch=!0,window.performance&&document.addEventListener("mousemove",Va))}function Va(){var t=performance.now();t-Fa<20&&(Wa.isTouch=!1,document.removeEventListener("mousemove",Va)),Fa=t}function qa(){var t,e=document.activeElement;if((t=e)&&t._tippy&&t._tippy.reference===t){var i=e._tippy;e.blur&&!i.state.isVisible&&e.blur()}}var ja,Ya=!!("undefined"!=typeof window&&"undefined"!=typeof document)&&!!window.msCrypto;function Ga(t){return[t+"() was called on a"+("destroy"===t?"n already-":" ")+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function $a(t){return t.replace(/[ \t]{2,}/g," ").replace(/^[ \t]*/gm,"").trim()}function Xa(t){return $a("\n %ctippy.js\n\n %c"+$a(t)+"\n\n %c👷 This is a development-only message. It will be removed in production.\n ")}function Za(t){return[Xa(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}function Ja(t,e){var i;t&&!ja.has(e)&&(ja.add(e),(i=console).warn.apply(i,Za(e)))}function Qa(t,e){var i;t&&!ja.has(e)&&(ja.add(e),(i=console).error.apply(i,Za(e)))}"production"!==process.env.NODE_ENV&&(ja=new Set);var Ka={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},to=Object.assign({appendTo:Ea,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},Ka,{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),eo=Object.keys(to);function io(t){var e=(t.plugins||[]).reduce((function(e,i){var n,s=i.name,r=i.defaultValue;s&&(e[s]=void 0!==t[s]?t[s]:null!=(n=to[s])?n:r);return e}),{});return Object.assign({},t,e)}function no(t,e){var i=Object.assign({},e,{content:Ta(e.content,[t])},e.ignoreAttributes?{}:function(t,e){return(e?Object.keys(io(Object.assign({},to,{plugins:e}))):eo).reduce((function(e,i){var n=(t.getAttribute("data-tippy-"+i)||"").trim();if(!n)return e;if("content"===i)e[i]=n;else try{e[i]=JSON.parse(n)}catch(t){e[i]=n}return e}),{})}(t,e.plugins));return i.aria=Object.assign({},to.aria,i.aria),i.aria={expanded:"auto"===i.aria.expanded?e.interactive:i.aria.expanded,content:"auto"===i.aria.content?e.interactive?null:"describedby":i.aria.content},i}function so(t,e){void 0===t&&(t={}),void 0===e&&(e=[]),Object.keys(t).forEach((function(t){var i,n,s=function(t,e){var i=Object.assign({},t);return e.forEach((function(t){delete i[t]})),i}(to,Object.keys(Ka)),r=(i=s,n=t,!{}.hasOwnProperty.call(i,n));r&&(r=0===e.filter((function(e){return e.name===t})).length),Ja(r,["`"+t+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.","\n\n","All props: https://atomiks.github.io/tippyjs/v6/all-props/\n","Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))}))}function ro(t,e){t.innerHTML=e}function ao(t){var e=Pa();return!0===t?e.className=wa:(e.className=_a,ka(t)?e.appendChild(t):ro(e,t)),e}function oo(t,e){ka(e.content)?(ro(t,""),t.appendChild(e.content)):"function"!=typeof e.content&&(e.allowHTML?ro(t,e.content):t.textContent=e.content)}function ho(t){var e=t.firstElementChild,i=La(e.children);return{box:e,content:i.find((function(t){return t.classList.contains(ba)})),arrow:i.find((function(t){return t.classList.contains(wa)||t.classList.contains(_a)})),backdrop:i.find((function(t){return t.classList.contains("tippy-backdrop")}))}}function lo(t){var e=Pa(),i=Pa();i.className="tippy-box",i.setAttribute("data-state","hidden"),i.setAttribute("tabindex","-1");var n=Pa();function s(i,n){var s=ho(e),r=s.box,a=s.content,o=s.arrow;n.theme?r.setAttribute("data-theme",n.theme):r.removeAttribute("data-theme"),"string"==typeof n.animation?r.setAttribute("data-animation",n.animation):r.removeAttribute("data-animation"),n.inertia?r.setAttribute("data-inertia",""):r.removeAttribute("data-inertia"),r.style.maxWidth="number"==typeof n.maxWidth?n.maxWidth+"px":n.maxWidth,n.role?r.setAttribute("role",n.role):r.removeAttribute("role"),i.content===n.content&&i.allowHTML===n.allowHTML||oo(a,t.props),n.arrow?o?i.arrow!==n.arrow&&(r.removeChild(o),r.appendChild(ao(n.arrow))):r.appendChild(ao(n.arrow)):o&&r.removeChild(o)}return n.className=ba,n.setAttribute("data-state","hidden"),oo(n,t.props),e.appendChild(i),i.appendChild(n),s(t.props,t.props),{popper:e,onUpdate:s}}lo.$$tippy=!0;var uo=1,co=[],po=[];function fo(t,e){var i,n,s,r,a,o,h,l,u=no(t,Object.assign({},to,io(Ba(e)))),c=!1,d=!1,p=!1,f=!1,m=[],g=Ca(G,u.interactiveDebounce),y=uo++,v=(l=u.plugins).filter((function(t,e){return l.indexOf(t)===e})),x={id:y,reference:t,popper:Pa(),popperInstance:null,props:u,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:v,clearDelayTimeouts:function(){clearTimeout(i),clearTimeout(n),cancelAnimationFrame(s)},setProps:function(e){"production"!==process.env.NODE_ENV&&Ja(x.state.isDestroyed,Ga("setProps"));if(x.state.isDestroyed)return;P("onBeforeUpdate",[x,e]),j();var i=x.props,n=no(t,Object.assign({},i,Ba(e),{ignoreAttributes:!0}));x.props=n,q(),i.interactiveDebounce!==n.interactiveDebounce&&(O(),g=Ca(G,n.interactiveDebounce));i.triggerTarget&&!n.triggerTarget?Ia(i.triggerTarget).forEach((function(t){t.removeAttribute("aria-expanded")})):n.triggerTarget&&t.removeAttribute("aria-expanded");N(),B(),_&&_(i,n);x.popperInstance&&(J(),K().forEach((function(t){requestAnimationFrame(t._tippy.popperInstance.forceUpdate)})));P("onAfterUpdate",[x,e])},setContent:function(t){x.setProps({content:t})},show:function(){"production"!==process.env.NODE_ENV&&Ja(x.state.isDestroyed,Ga("show"));var t=x.state.isVisible,e=x.state.isDestroyed,i=!x.state.isEnabled,n=Wa.isTouch&&!x.props.touch,s=Ma(x.props.duration,0,to.duration);if(t||e||i||n)return;if(C().hasAttribute("disabled"))return;if(P("onShow",[x],!1),!1===x.props.onShow(x))return;x.state.isVisible=!0,T()&&(w.style.visibility="visible");B(),W(),x.state.isMounted||(w.style.transition="none");if(T()){var r=D();Oa([r.box,r.content],0)}o=function(){var t;if(x.state.isVisible&&!f){if(f=!0,w.offsetHeight,w.style.transition=x.props.moveTransition,T()&&x.props.animation){var e=D(),i=e.box,n=e.content;Oa([i,n],s),Ra([i,n],"visible")}k(),N(),Da(po,x),null==(t=x.popperInstance)||t.forceUpdate(),P("onMount",[x]),x.props.animation&&T()&&function(t,e){U(t,e)}(s,(function(){x.state.isShown=!0,P("onShown",[x])}))}},function(){var t,e=x.props.appendTo,i=C();t=x.props.interactive&&e===Ea||"parent"===e?i.parentNode:Ta(e,[i]);t.contains(w)||t.appendChild(w);x.state.isMounted=!0,J(),"production"!==process.env.NODE_ENV&&Ja(x.props.interactive&&e===to.appendTo&&i.nextElementSibling!==w,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.","\n\n","Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.","\n\n","Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.","\n\n","See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}()},hide:function(){"production"!==process.env.NODE_ENV&&Ja(x.state.isDestroyed,Ga("hide"));var t=!x.state.isVisible,e=x.state.isDestroyed,i=!x.state.isEnabled,n=Ma(x.props.duration,1,to.duration);if(t||e||i)return;if(P("onHide",[x],!1),!1===x.props.onHide(x))return;x.state.isVisible=!1,x.state.isShown=!1,f=!1,c=!1,T()&&(w.style.visibility="hidden");if(O(),F(),B(!0),T()){var s=D(),r=s.box,a=s.content;x.props.animation&&(Oa([r,a],n),Ra([r,a],"hidden"))}k(),N(),x.props.animation?T()&&function(t,e){U(t,(function(){!x.state.isVisible&&w.parentNode&&w.parentNode.contains(w)&&e()}))}(n,x.unmount):x.unmount()},hideWithInteractivity:function(t){"production"!==process.env.NODE_ENV&&Ja(x.state.isDestroyed,Ga("hideWithInteractivity"));I().addEventListener("mousemove",g),Da(co,g),g(t)},enable:function(){x.state.isEnabled=!0},disable:function(){x.hide(),x.state.isEnabled=!1},unmount:function(){"production"!==process.env.NODE_ENV&&Ja(x.state.isDestroyed,Ga("unmount"));x.state.isVisible&&x.hide();if(!x.state.isMounted)return;Q(),K().forEach((function(t){t._tippy.unmount()})),w.parentNode&&w.parentNode.removeChild(w);po=po.filter((function(t){return t!==x})),x.state.isMounted=!1,P("onHidden",[x])},destroy:function(){"production"!==process.env.NODE_ENV&&Ja(x.state.isDestroyed,Ga("destroy"));if(x.state.isDestroyed)return;x.clearDelayTimeouts(),x.unmount(),j(),delete t._tippy,x.state.isDestroyed=!0,P("onDestroy",[x])}};if(!u.render)return"production"!==process.env.NODE_ENV&&Qa(!0,"render() function has not been supplied."),x;var b=u.render(x),w=b.popper,_=b.onUpdate;w.setAttribute("data-tippy-root",""),w.id="tippy-"+x.id,x.popper=w,t._tippy=x,w._tippy=x;var S=v.map((function(t){return t.fn(x)})),E=t.hasAttribute("aria-expanded");return q(),N(),B(),P("onCreate",[x]),u.showOnCreate&&tt(),w.addEventListener("mouseenter",(function(){x.props.interactive&&x.state.isVisible&&x.clearDelayTimeouts()})),w.addEventListener("mouseleave",(function(){x.props.interactive&&x.props.trigger.indexOf("mouseenter")>=0&&I().addEventListener("mousemove",g)})),x;function M(){var t=x.props.touch;return Array.isArray(t)?t:[t,0]}function A(){return"hold"===M()[0]}function T(){var t;return!(null==(t=x.props.render)||!t.$$tippy)}function C(){return h||t}function I(){var t,e,i=C().parentNode;return i?null!=(e=Ia(i)[0])&&null!=(t=e.ownerDocument)&&t.body?e.ownerDocument:document:document}function D(){return ho(w)}function L(t){return x.state.isMounted&&!x.state.isVisible||Wa.isTouch||r&&"focus"===r.type?0:Ma(x.props.delay,t?0:1,to.delay)}function B(t){void 0===t&&(t=!1),w.style.pointerEvents=x.props.interactive&&!t?"":"none",w.style.zIndex=""+x.props.zIndex}function P(t,e,i){var n;(void 0===i&&(i=!0),S.forEach((function(i){i[t]&&i[t].apply(i,e)})),i)&&(n=x.props)[t].apply(n,e)}function k(){var e=x.props.aria;if(e.content){var i="aria-"+e.content,n=w.id;Ia(x.props.triggerTarget||t).forEach((function(t){var e=t.getAttribute(i);if(x.state.isVisible)t.setAttribute(i,e?e+" "+n:n);else{var s=e&&e.replace(n,"").trim();s?t.setAttribute(i,s):t.removeAttribute(i)}}))}}function N(){!E&&x.props.aria.expanded&&Ia(x.props.triggerTarget||t).forEach((function(t){x.props.interactive?t.setAttribute("aria-expanded",x.state.isVisible&&t===C()?"true":"false"):t.removeAttribute("aria-expanded")}))}function O(){I().removeEventListener("mousemove",g),co=co.filter((function(t){return t!==g}))}function R(e){if(!Wa.isTouch||!p&&"mousedown"!==e.type){var i=e.composedPath&&e.composedPath()[0]||e.target;if(!x.props.interactive||!Ha(w,i)){if(Ia(x.props.triggerTarget||t).some((function(t){return Ha(t,i)}))){if(Wa.isTouch)return;if(x.state.isVisible&&x.props.trigger.indexOf("click")>=0)return}else P("onClickOutside",[x,e]);!0===x.props.hideOnClick&&(x.clearDelayTimeouts(),x.hide(),d=!0,setTimeout((function(){d=!1})),x.state.isMounted||F())}}}function z(){p=!0}function H(){p=!1}function W(){var t=I();t.addEventListener("mousedown",R,!0),t.addEventListener("touchend",R,Sa),t.addEventListener("touchstart",H,Sa),t.addEventListener("touchmove",z,Sa)}function F(){var t=I();t.removeEventListener("mousedown",R,!0),t.removeEventListener("touchend",R,Sa),t.removeEventListener("touchstart",H,Sa),t.removeEventListener("touchmove",z,Sa)}function U(t,e){var i=D().box;function n(t){t.target===i&&(za(i,"remove",n),e())}if(0===t)return e();za(i,"remove",a),za(i,"add",n),a=n}function V(e,i,n){void 0===n&&(n=!1),Ia(x.props.triggerTarget||t).forEach((function(t){t.addEventListener(e,i,n),m.push({node:t,eventType:e,handler:i,options:n})}))}function q(){var t;A()&&(V("touchstart",Y,{passive:!0}),V("touchend",$,{passive:!0})),(t=x.props.trigger,t.split(/\s+/).filter(Boolean)).forEach((function(t){if("manual"!==t)switch(V(t,Y),t){case"mouseenter":V("mouseleave",$);break;case"focus":V(Ya?"focusout":"blur",X);break;case"focusin":V("focusout",X)}}))}function j(){m.forEach((function(t){var e=t.node,i=t.eventType,n=t.handler,s=t.options;e.removeEventListener(i,n,s)})),m=[]}function Y(t){var e,i=!1;if(x.state.isEnabled&&!Z(t)&&!d){var n="focus"===(null==(e=r)?void 0:e.type);r=t,h=t.currentTarget,N(),!x.state.isVisible&&Aa(t,"MouseEvent")&&co.forEach((function(e){return e(t)})),"click"===t.type&&(x.props.trigger.indexOf("mouseenter")<0||c)&&!1!==x.props.hideOnClick&&x.state.isVisible?i=!0:tt(t),"click"===t.type&&(c=!i),i&&!n&&et(t)}}function G(t){var e=t.target,i=C().contains(e)||w.contains(e);"mousemove"===t.type&&i||function(t,e){var i=e.clientX,n=e.clientY;return t.every((function(t){var e=t.popperRect,s=t.popperState,r=t.props.interactiveBorder,a=s.placement.split("-")[0],o=s.modifiersData.offset;if(!o)return!0;var h="bottom"===a?o.top.y:0,l="top"===a?o.bottom.y:0,u="right"===a?o.left.x:0,c="left"===a?o.right.x:0,d=e.top-n+h>r,p=n-e.bottom-l>r,f=e.left-i+u>r,m=i-e.right-c>r;return d||p||f||m}))}(K().concat(w).map((function(t){var e,i=null==(e=t._tippy.popperInstance)?void 0:e.state;return i?{popperRect:t.getBoundingClientRect(),popperState:i,props:u}:null})).filter(Boolean),t)&&(O(),et(t))}function $(t){Z(t)||x.props.trigger.indexOf("click")>=0&&c||(x.props.interactive?x.hideWithInteractivity(t):et(t))}function X(t){x.props.trigger.indexOf("focusin")<0&&t.target!==C()||x.props.interactive&&t.relatedTarget&&w.contains(t.relatedTarget)||et(t)}function Z(t){return!!Wa.isTouch&&A()!==t.type.indexOf("touch")>=0}function J(){Q();var e=x.props,i=e.popperOptions,n=e.placement,s=e.offset,r=e.getReferenceClientRect,a=e.moveTransition,h=T()?ho(w).arrow:null,l=r?{getBoundingClientRect:r,contextElement:r.contextElement||C()}:t,u=[{name:"offset",options:{offset:s}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!a}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(t){var e=t.state;if(T()){var i=D().box;["placement","reference-hidden","escaped"].forEach((function(t){"placement"===t?i.setAttribute("data-placement",e.placement):e.attributes.popper["data-popper-"+t]?i.setAttribute("data-"+t,""):i.removeAttribute("data-"+t)})),e.attributes.popper={}}}}];T()&&h&&u.push({name:"arrow",options:{element:h,padding:3}}),u.push.apply(u,(null==i?void 0:i.modifiers)||[]),x.popperInstance=xa(l,w,Object.assign({},i,{placement:n,onFirstUpdate:o,modifiers:u}))}function Q(){x.popperInstance&&(x.popperInstance.destroy(),x.popperInstance=null)}function K(){return La(w.querySelectorAll("[data-tippy-root]"))}function tt(t){x.clearDelayTimeouts(),t&&P("onTrigger",[x,t]),W();var e=L(!0),n=M(),s=n[0],r=n[1];Wa.isTouch&&"hold"===s&&r&&(e=r),e?i=setTimeout((function(){x.show()}),e):x.show()}function et(t){if(x.clearDelayTimeouts(),P("onUntrigger",[x,t]),x.state.isVisible){if(!(x.props.trigger.indexOf("mouseenter")>=0&&x.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(t.type)>=0&&c)){var e=L(!1);e?n=setTimeout((function(){x.state.isVisible&&x.hide()}),e):s=requestAnimationFrame((function(){x.hide()}))}}else F()}}function mo(t,e){void 0===e&&(e={});var i=to.plugins.concat(e.plugins||[]);"production"!==process.env.NODE_ENV&&(!function(t){var e=!t,i="[object Object]"===Object.prototype.toString.call(t)&&!t.addEventListener;Qa(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Qa(i,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}(t),so(e,i)),document.addEventListener("touchstart",Ua,Sa),window.addEventListener("blur",qa);var n=Object.assign({},e,{plugins:i}),s=Na(t);if("production"!==process.env.NODE_ENV){var r=ka(n.content),a=s.length>1;Ja(r&&a,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.","\n\n","Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.","\n\n","1) content: element.innerHTML\n","2) content: () => element.cloneNode(true)"].join(" "))}var o=s.reduce((function(t,e){var i=e&&fo(e,n);return i&&t.push(i),t}),[]);return ka(t)?o[0]:o}mo.defaultProps=to,mo.setDefaultProps=function(t){"production"!==process.env.NODE_ENV&&so(t,[]),Object.keys(t).forEach((function(e){to[e]=t[e]}))},mo.currentInput=Wa,Object.assign({},Cr,{effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow)}}),mo.setDefaultProps({render:lo});let go=0;const yo=mo(document.body,{theme:"translucent",animation:"scale",inertia:!0,delay:[200,100],content:"",allowHTML:!0,placement:"left-start",trigger:"manual",arrow:!0});class vo{constructor(t,e){c(this,"name","Label"),c(this,"id","Label"+go++),c(this,"el"),c(this,"position",new We),this.container=t,this.text=e,this.container=t||document.getElementsByTagName("body")[0],this.text=e}get isMounted(){return yo.state.isMounted}get isShown(){return yo.state.isShown}destroy(){this.text="",this.position.identity()}setHtml(t=""){return this.text=t,this}update(t){t&&(this.position.copy(t),yo.show())}show(t){return d(this,null,(function*(){if(t)return yield this.hide(),this.position.copy(t),yo.setContent(this.text),yo.setProps({getReferenceClientRect:()=>({width:0,height:0,right:this.position.x,left:this.position.x,bottom:this.position.y,top:this.position.y,x:this.position.x,y:this.position.y,toJSON(){}})}),yo.clearDelayTimeouts(),yo.show(),new Promise((t=>{ri.delay((function(){t()}),300)}))}))}hide(){return d(this,null,(function*(){return yo.hide(),new Promise((t=>{ri.delay((function(){t()}),100)}))}))}}let xo=0;class bo extends Fi{constructor(t,e){var i,n;super(),c(this,"name","DummyPoint"),c(this,"id","dummyPoint"+xo++),c(this,"container"),c(this,"offset",new We),c(this,"el"),c(this,"label"),c(this,"radius",10),c(this,"position",new We),c(this,"worldPosition",new We),c(this,"userData"),this.container=t||document.getElementsByTagName("body")[0];let s=this.container.getBoundingClientRect();this.offset.set(s.left,s.top),this.userData=e,(null==(i=this.userData)?void 0:i.type)||ri.set(this,"userData.type",hr.DEFAULT),this.initDom(),this.setType(null==(n=this.userData)?void 0:n.type),this.mount(),this.initLabel()}destroy(){var t;super.destroy(),this.unmount(),null==(t=this.label)||t.destroy()}get isMounted(){var t;return!!(null==(t=this.el)?void 0:t.parentNode)}mount(){var t;this.el&&((null==(t=this.el)?void 0:t.parentNode)||this.container.appendChild(this.el))}unmount(){var t,e,i,n;null==(e=null==(t=this.el)?void 0:t.parentNode)||e.removeChild(this.el),null==(i=this.el)||i.remove(),null==(n=this.label)||n.hide()}setText(t=""){return this.el?(this.el.innerText=t,this):this}initDom(){var t;this.el=document.createElement("div"),this.el.setAttribute("id",this.id),this.el.setAttribute("class","dummy-point"),this.el.setAttribute("ae-id",null==(t=this.userData)?void 0:t.value)}initLabel(){var t;(null==(t=this.userData)?void 0:t.label)&&(this.label=new vo(this.container,this.userData.label))}setActive(t){return t?(Fs(this.el,"active"),this.showLabel()):(Us(this.el,"active"),this.hideLabel()),this}showLabel(){var t;null==(t=this.label)||t.show(wo.copy(this.position).add(this.offset).subScalar(this.radius))}hideLabel(){var t;null==(t=this.label)||t.hide()}setType(t){var e;if(!this.userData)return this;const i=null==(e=this.userData)?void 0:e.type;return t||(t=hr.DEFAULT),i&&Ws(this.el,i)&&Us(this.el,i),this.userData.type=t,Fs(this.el,this.userData.type),this}update(t,e=!1){t&&this.isMounted&&(e||t.subScalar(this.radius).round(),this.position.copy(t),this.el.style.transform=`translate3D(${this.position.x}px, ${this.position.y}px, 0)`)}}const wo=new We;let _o=0;class So extends Fi{constructor(t,e){super(),c(this,"name","DummyRect"),c(this,"id","dummyRect"+_o++),c(this,"container"),c(this,"offset",new We),c(this,"el"),c(this,"radius",10),c(this,"position",new We),c(this,"worldPosition",new We),c(this,"label"),c(this,"userData"),this.container=t||document.getElementsByTagName("body")[0];let i=this.container.getBoundingClientRect();this.offset.set(i.left,i.top),this.userData=e,this.initDom(),this.mount(),this.initLabel()}destroy(){var t;super.destroy(),this.unmount(),null==(t=this.label)||t.destroy()}get isMounted(){var t;return!!(null==(t=this.el)?void 0:t.parentNode)}mount(){this.container.appendChild(this.el)}unmount(){var t,e,i,n;this.setText(""),null==(e=null==(t=this.el)?void 0:t.parentNode)||e.removeChild(this.el),null==(i=this.el)||i.remove(),null==(n=this.label)||n.hide()}initDom(){var t;this.el=document.createElement("div"),this.el.setAttribute("id",this.id),this.el.setAttribute("class","dummy-rect"),this.el.setAttribute("ae-id",(null==(t=this.userData)?void 0:t.rmId)||"undefined")}initLabel(){this.label=new vo(this.container,"")}setText(t=""){return this.el.innerText=t,this}setActive(t){return t?Fs(this.el,"active"):Us(this.el,"active"),this}showLabel(){var t;null==(t=this.label)||t.show(Eo.copy(this.position).add(this.offset).subScalar(this.radius))}hideLabel(){var t;null==(t=this.label)||t.hide()}setType(t){var e;if(!this.userData)return this;const i=null==(e=this.userData)?void 0:e.type;return t=hr.DEFAULT,i&&Ws(this.el,i)&&Us(this.el,i),this.userData.type=t,Fs(this.el,this.userData.type),this}update(t,e=!1){t&&this.isMounted&&(e||t.subScalar(this.radius).round(),this.position.copy(t),this.el.style.transform=`translate3D(${this.position.x}px, ${this.position.y}px, 0)`)}}const Eo=new We;class Mo extends Fi{constructor(t,e){super(),c(this,"name","Dummies"),c(this,"container"),c(this,"controller"),c(this,"scene"),c(this,"viewMatrix",new Ui),c(this,"dummies",[]),c(this,"rmMap",new Map),c(this,"mergedMap",new Map),c(this,"cameraUpdateHandler",this.handleCameraUpdate.bind(this)),c(this,"controllerTapHandler",this.handleControllerTap.bind(this)),this.container=t,this.controller=e,this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.clearDummies()}bindEvents(){this.controller.camera.addEventListener(tr.UPDATE,this.cameraUpdateHandler),this.controller.addEventListener(Js.TAP,this.controllerTapHandler)}unbindEvents(){this.controller.camera.removeEventListener(tr.UPDATE,this.cameraUpdateHandler),this.controller.removeEventListener(Js.TAP,this.controllerTapHandler)}bindScene(t){this.scene=t}update(t){var e,i,n;if(t){this.viewMatrix.copy(t);for(let t=0,s=(this.dummies||[]).length;t<s;t++){const s=this.dummies[t],r=null==(i=this.scene)?void 0:i.getElementById(null==(e=s.userData)?void 0:e.rmId);if(r){const t=null==(n=this.scene)?void 0:n.chef.getElementBoundingBox(r.id);null==t||t.getCenter(Ao),Ao.applyMatrix3(this.viewMatrix).round(),s.position.copy(Ao)}else Ao.copy(s.worldPosition).applyMatrix3(this.viewMatrix).round(),s.update(Ao)}this.mergeDummies()}}setDummies(t){this.clearDummies();for(let e=0,i=(t||[]).length;e<i;e++)this.addDummy(t[e])}addDummy(t){var e,i;const n=new bo(this.container,t);this.dummies.push(n);const s=null==(e=n.userData)?void 0:e.rmId;return s&&(this.rmMap.has(s)||this.rmMap.set(s,[]),null==(i=this.rmMap.get(s))||i.push(n)),n}removeDummy(t){var e;const i=this.dummies.indexOf(t);i>-1&&this.dummies.splice(i,1);const n=null==(e=t.userData)?void 0:e.rmId;if(n){const e=this.mergedMap.get(n);null==e||e.destroy(),this.mergedMap.delete(n);const i=this.rmMap.get(n);if(!i)return;if(1===i.length)this.rmMap.delete(n);else{const e=i.indexOf(t);e>-1&&(i.splice(e,1),this.rmMap.set(n,i))}}t.destroy()}clearDummies(t){var e,i,n;for(let s=((null==(e=this.dummies)?void 0:e.length)||0)-1;s>=0;s--){const e=this.dummies[s];(!t||(null==(i=null==e?void 0:e.userData)?void 0:i.type)&&(null==t?void 0:t.includes(null==(n=e.userData)?void 0:n.type)))&&this.removeDummy(e)}t||(this.dummies.length=0,this.mergedMap.clear(),this.rmMap.clear())}mergeDummies(){this.rmMap.forEach(((t,e)=>{var i,n,s,r;if(null==(i=this.scene)?void 0:i.getElementById(e)){const i=null==(n=this.scene)?void 0:n.chef.getElementBoundingBox(e);if(!i)return;To.copy(i).applyMatrix3(this.viewMatrix).round(),To.getSize(Ao);const a=t[0].radius,o=To.centralArrange(t.length,2*a,2*a);if(Ao.x<3*a||Ao.y<3*a){t.forEach((t=>t.unmount()));const i=this.mergedMap.get(e);null==i||i.unmount()}else if(Array.isArray(o))this.mergedMap.has(e)&&(null==(s=this.mergedMap.get(e))||s.unmount()),t.forEach(((t,e)=>{t.isMounted||t.mount(),t.update(o[e])}));else{t.forEach((t=>t.unmount()));let i=this.mergedMap.get(e);if(i)i.isMounted||i.mount();else{const n=ri.cloneDeep(t[0].userData)||{},s=ri.reduce(t,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.label)&&t.push(null==(n=e.userData)?void 0:n.label),t}),[]);n.label=s.join(", ");const r=ri.reduce(t,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.value)&&t.push(null==(n=e.userData)?void 0:n.value),t}),[]);n.value=r.join(","),n.rmId=e,i=new So(this.container,n),this.mergedMap.set(e,i)}i.setText(t.length.toString());const n=ri.reduce(t,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.label)&&t.push(null==(n=e.userData)?void 0:n.label),t}),[]);null==(r=i.label)||r.setHtml(n.join(", <br />")),i.update(t[0].position)}}}))}getDummyById(t){return this.dummies.find((e=>{var i;return(null==(i=e.userData)?void 0:i.value)===t}))}setActiveByIds(t){var e,i;if(this.resetActives(),t&&(Array.isArray(t)||(t=[t]),null==t?void 0:t.length))for(let n=0,s=t.length;n<s;n++){const s=this.getDummyById(t[n]);if(s&&s.setActive(!0),s&&(null==(e=s.userData)?void 0:e.rmId)){const t=this.mergedMap.get(null==(i=s.userData)?void 0:i.rmId);t&&t.setActive(!0)}}}resetActives(){this.dummies.forEach((t=>t.setActive(!1))),this.mergedMap.forEach((t=>t.setActive(!1)))}showDummyLabel(t){if(!t)return;const e=this.getDummyById(t);e&&e.showLabel();const i=this.mergedMap.get(t);i&&i.showLabel()}hideDummyLabel(){return d(this,null,(function*(){this.dummies.forEach((t=>t.hideLabel())),this.mergedMap.forEach((t=>t.hideLabel()))}))}handleCameraUpdate(){this.update(this.controller.camera.viewMatrix)}handleControllerTap(t){var e,i,n,s,r;if((null==t?void 0:t.type)!==Js.TAP)return;const a=(null==(e=null==t?void 0:t.e)?void 0:e.target)||(null==(n=null==(i=null==t?void 0:t.e)?void 0:i.srcEvent)?void 0:n.target)||(null==(r=null==(s=null==t?void 0:t.e)?void 0:s.srcEvent)?void 0:r.srcElement);null==a||a.getAttribute("ae-id")}}const Ao=new We,To=new ai;window[Gs.prefixed(window,"requestAnimationFrame")];class Co extends Fi{constructor(t,e,i=!0){super(),c(this,"name","DragController"),c(this,"dragFake",!1),c(this,"container"),c(this,"offset",new We),c(this,"controller"),c(this,"scene"),c(this,"raycaster"),c(this,"dummies"),c(this,"_els",[]),c(this,"_hms",new Map),c(this,"_vos",new Map),c(this,"_elMap",new Map),c(this,"_panType",hr.SUCCESS),c(this,"onPanHandler",this.handleOnPan.bind(this)),c(this,"panEndHandler",ri.debounce(this.handlePanEnd.bind(this),500)),this.container=t;let n=this.container.getBoundingClientRect();this.offset.set(n.left,n.top),this.controller=e,this.dummies=new Mo(t,e),this.raycaster=new lr,this.dragFake=i}destroy(){var t;super.destroy();for(let e=((null==(t=this._els)?void 0:t.length)||0)-1;e>=0;e--)this.drop(this._els[e]);this.dummies.destroy()}bindScene(t){var e;this.scene=t,null==(e=this.dummies)||e.bindScene(t)}drag(t,e){t&&(this._els.includes(t)||(this.bindEvent(t),this._els.push(t),this._vos.set(t,e)))}drop(t){if(!t)return;this.unbindEvent(t),this._vos.delete(t),this._elMap.delete(t);const e=this._els.findIndex((e=>e===t));e>-1&&this._els.splice(e,1)}bindEvent(t){if(!t)return;const e=new Gs.Manager(t,{domEvents:!0});e.add(new Gs.Pan({threshold:0,pointers:0})),e.on(["panstart","panmove","panend"].join(" "),this.onPanHandler),this._hms.set(t,e)}unbindEvent(t){if(!t)return;const e=this._hms.get(t);e&&(e.off(["panstart","panmove","panend"].join(" "),this.onPanHandler),e.destroy(),this._hms.delete(t))}handleOnPan(t){if("function"==typeof t.preventDefault&&t.preventDefault(),"function"==typeof t.srcEvent.stopPropagation&&t.srcEvent.stopPropagation(),"function"==typeof t.srcEvent.stopImmediatePropagation&&t.srcEvent.stopImmediatePropagation(),!this.controller)return;"panstart"===t.type||t.isFirst?this.controller.enablePan=!1:"panmove"===t.type||"panend"===t.type&&(this.controller.enablePan=!0);const e=this._vos.get(t.target);if(!e)return;const i=ri.cloneDeep(e);i.type=this._panType;const n=this._getDummy(t.target,i);Io.set(t.center.x,t.center.y).sub(this.offset),n.worldPosition.copy(Io).unproject(this.controller.camera),n.update(Io),this.panEndHandler({type:"panend",e:t})}handlePanEnd(t){if("panend"!==(null==t?void 0:t.type))return;const e=this.getDummies(!0);this.dispatchEvent({type:"panend",data:e})}getDummies(t=!0){const e=[];return this._els.forEach((i=>{var n;let s=this._vos.get(i);if(s&&s.type===hr.SUCCESS){if(t){const t=this._elMap.get(i);if(!t)return;if(!this.controller.camera)return;Io.copy(t.position),this.raycaster.setFromCamera(Io,this.controller.camera);const e=[];if(null==(n=this.scene)||n.getIntersectObjects(this.raycaster,Li.RM,e),!(null==e?void 0:e.length))return;s=ri.cloneDeep(s),s.rmId=e[0].id}e.push(s)}})),e}setDummiesByVos(t){var e,i;for(let i=0,n=(t||[]).length;i<n;i++){const n=null==(e=this.dummies)?void 0:e.addDummy(t[i]);if(!n)continue;const s=ri.cloneDeep(t[i]);delete s.rmId,delete s.wsId,this.drag(n.el,s)}null==(i=this.dummies)||i.update(this.controller.camera.viewMatrix)}clearDummies(t){var e,i;for(let i=((null==(e=this._els)?void 0:e.length)||0)-1;i>=0;i--){const e=this._vos.get(this._els[i]);(!t||t&&(null==e?void 0:e.type)&&t.includes(e.type))&&this.drop(this._els[i])}null==(i=this.dummies)||i.clearDummies(t)}getDummyById(t){return this.dummies.getDummyById(t)}highlightDummies(t){var e;null==(e=this.dummies)||e.setActiveByIds(t)}resetHighlightDummies(){var t;null==(t=this.dummies)||t.resetActives()}showDummyLabel(t){var e;null==(e=this.dummies)||e.showDummyLabel(t)}start(){}_getDummy(t,e){let i=this._elMap.get(t);if(i||(i=this.dummies.addDummy(e).setType(hr.SUCCESS),this._elMap.set(t,i)),i.isMounted||i.mount(),this.dummies.dummies.includes(i)||this.dummies.dummies.push(i),!this._elMap.get(i.el)){this._elMap.set(i.el,i);const t=ri.cloneDeep(e);delete t.rmId,delete t.wsId,this.drag(i.el,t)}return i}}const Io=new We;var Do=Object.freeze({Linear:Object.freeze({None:function(t){return t},In:function(t){return t},Out:function(t){return t},InOut:function(t){return t}}),Quadratic:Object.freeze({In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}}),Cubic:Object.freeze({In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}}),Quartic:Object.freeze({In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}}),Quintic:Object.freeze({In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}}),Sinusoidal:Object.freeze({In:function(t){return 1-Math.sin((1-t)*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.sin(Math.PI*(.5-t)))}}),Exponential:Object.freeze({In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}}),Circular:Object.freeze({In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}}),Elastic:Object.freeze({In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}}),Back:Object.freeze({In:function(t){var e=1.70158;return 1===t?1:t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return 0===t?0:--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}}),Bounce:Object.freeze({In:function(t){return 1-Do.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*Do.Bounce.In(2*t):.5*Do.Bounce.Out(2*t-1)+.5}}),generatePow:function(t){return void 0===t&&(t=4),t=(t=t<Number.EPSILON?Number.EPSILON:t)>1e4?1e4:t,{In:function(e){return Math.pow(e,t)},Out:function(e){return 1-Math.pow(1-e,t)},InOut:function(e){return e<.5?Math.pow(2*e,t)/2:(1-Math.pow(2-2*e,t))/2+.5}}}}),Lo=function(){return performance.now()},Bo=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return t.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map((function(e){return t._tweens[e]}))},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];for(var n=0,s=e;n<s.length;n++){var r=s[n];null===(t=r._group)||void 0===t||t.remove(r),r._group=this,this._tweens[r.getId()]=r,this._tweensAddedDuringUpdate[r.getId()]=r}},t.prototype.remove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=0,n=t;i<n.length;i++){var s=n[i];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},t.prototype.allStopped=function(){return this.getAll().every((function(t){return!t.isPlaying()}))},t.prototype.update=function(t,e){void 0===t&&(t=Lo()),void 0===e&&(e=!0);var i=Object.keys(this._tweens);if(0!==i.length)for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<i.length;n++){var s=this._tweens[i[n]],r=!e;s&&!1===s.update(t,r)&&!e&&this.remove(s)}i=Object.keys(this._tweensAddedDuringUpdate)}},t}(),Po={Linear:function(t,e){var i=t.length-1,n=i*e,s=Math.floor(n),r=Po.Utils.Linear;return e<0?r(t[0],t[1],n):e>1?r(t[i],t[i-1],i-n):r(t[s],t[s+1>i?i:s+1],n-s)},Utils:{Linear:function(t,e,i){return(e-t)*i+t}}},ko=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),No=new Bo,Oo=function(){function t(t,e){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Do.Linear.None,this._interpolationFunction=Po.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=ko.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,"object"==typeof e?(this._group=e,e.add(this)):!0===e&&(this._group=No,No.add(this))}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.getDuration=function(){return this._duration},t.prototype.to=function(t,e){if(void 0===e&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e<0?0:e,this},t.prototype.duration=function(t){return void 0===t&&(t=1e3),this._duration=t<0?0:t,this},t.prototype.dynamic=function(t){return void 0===t&&(t=!1),this._isDynamic=t,this},t.prototype.start=function(t,e){if(void 0===t&&(t=Lo()),void 0===e&&(e=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed)for(var i in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var s in this._valuesEnd)n[s]=this._valuesEnd[s];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},t.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},t.prototype._setupProperties=function(t,e,i,n,s){for(var r in i){var a=t[r],o=Array.isArray(a),h=o?"array":typeof a,l=!o&&Array.isArray(i[r]);if("undefined"!==h&&"function"!==h){if(l){if(0===(g=i[r]).length)continue;for(var u=[a],c=0,d=g.length;c<d;c+=1){var p=this._handleRelativeValue(a,g[c]);if(isNaN(p)){l=!1;break}u.push(p)}l&&(i[r]=u)}if("object"!==h&&!o||!a||l)(void 0===e[r]||s)&&(e[r]=a),o||(e[r]*=1),n[r]=l?i[r].slice().reverse():e[r]||0;else{e[r]=o?[]:{};var f=a;for(var m in f)e[r][m]=f[m];n[r]=o?[]:{};var g=i[r];if(!this._isDynamic){var y={};for(var m in g)y[m]=g[m];i[r]=g=y}this._setupProperties(f,e[r],g,n[r],s)}}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},t.prototype.pause=function(t){return void 0===t&&(t=Lo()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=t),this},t.prototype.resume=function(t){return void 0===t&&(t=Lo()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this):this},t.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},t.prototype.group=function(t){return t?(t.add(this),this):this},t.prototype.remove=function(){var t;return null===(t=this._group)||void 0===t||t.remove(this),this},t.prototype.delay=function(t){return void 0===t&&(t=0),this._delayTime=t,this},t.prototype.repeat=function(t){return void 0===t&&(t=0),this._initialRepeat=t,this._repeat=t,this},t.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},t.prototype.yoyo=function(t){return void 0===t&&(t=!1),this._yoyo=t,this},t.prototype.easing=function(t){return void 0===t&&(t=Do.Linear.None),this._easingFunction=t,this},t.prototype.interpolation=function(t){return void 0===t&&(t=Po.Linear),this._interpolationFunction=t,this},t.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},t.prototype.onStart=function(t){return this._onStartCallback=t,this},t.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},t.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},t.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},t.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},t.prototype.onStop=function(t){return this._onStopCallback=t,this},t.prototype.update=function(e,i){var n,s,r=this;if(void 0===e&&(e=Lo()),void 0===i&&(i=t.autoStartOnUpdate),this._isPaused)return!0;if(!this._goToEnd&&!this._isPlaying){if(!i)return!1;this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),!1===this._onEveryStartCallbackFired&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=e-this._startTime,o=this._duration+(null!==(n=this._repeatDelayTime)&&void 0!==n?n:this._delayTime),h=this._duration+this._repeat*o,l=function(){if(0===r._duration)return 1;if(a>h)return 1;var t=Math.trunc(a/o),e=a-t*o,i=Math.min(e/r._duration,1);return 0===i&&a===r._duration?1:i}(),u=this._easingFunction(l);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,u),this._onUpdateCallback&&this._onUpdateCallback(this._object,l),0===this._duration||a>=this._duration){if(this._repeat>0){var c=Math.min(Math.trunc((a-this._duration)/o)+1,this._repeat);for(s in isFinite(this._repeat)&&(this._repeat-=c),this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[s]||(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=o*c,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var d=0,p=this._chainedTweens.length;d<p;d++)this._chainedTweens[d].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(t,e,i,n){for(var s in i)if(void 0!==e[s]){var r=e[s]||0,a=i[s],o=Array.isArray(t[s]),h=Array.isArray(a);!o&&h?t[s]=this._interpolationFunction(a,n):"object"==typeof a&&a?this._updateProperties(t[s],r,a,n):"number"==typeof(a=this._handleRelativeValue(r,a))&&(t[s]=r+(a-r)*n)}},t.prototype._handleRelativeValue=function(t,e){return"string"!=typeof e?e:"+"===e.charAt(0)||"-"===e.charAt(0)?t+parseFloat(e):parseFloat(e)},t.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],i=this._valuesEnd[t];this._valuesStartRepeat[t]="string"==typeof i?this._valuesStartRepeat[t]+parseFloat(i):this._valuesEnd[t],this._valuesEnd[t]=e},t.autoStartOnUpdate=!1,t}();ko.nextId;var Ro=No;Ro.getAll.bind(Ro),Ro.removeAll.bind(Ro),Ro.add.bind(Ro),Ro.remove.bind(Ro),Ro.update.bind(Ro);var zo={Easing:Do,Tween:Oo};class Ho extends Fi{constructor(t={}){super(),c(this,"name","SvgView"),c(this,"params"),c(this,"container"),c(this,"offset",new We),c(this,"camera"),c(this,"controller"),c(this,"scene"),c(this,"p1",new We),c(this,"p2",new We),c(this,"graph"),c(this,"multiSelector"),c(this,"dummiesController"),c(this,"zoomToSelectEnable",!1),c(this,"zoomBox",new ai),c(this,"selectEnable",!1),c(this,"multiSelectEnable",!1),c(this,"fnEnable",!1),c(this,"tween"),c(this,"animateDuration"),c(this,"label"),c(this,"controllerPanStartHandler",this.handlePanStart.bind(this)),c(this,"controllerPanEndHandler",this.handlePanEnd.bind(this)),c(this,"controllerPanMoveHandler",this.handleControllerPanMove.bind(this)),c(this,"controllerPointerOverHandler",this.handleControllerPointerOver.bind(this)),c(this,"multiSelectorSelectedHandler",this.handleMultiSelectorSelected.bind(this)),c(this,"_currentAssetId"),this.params=t,this.params.zoomToSelectEnable&&(this.zoomToSelectEnable=!0),this.params.selectEnable&&(this.selectEnable=!0),this.params.multiSelectEnable&&(this.multiSelectEnable=!0),this.params.camera||(this.params.camera={}),this.params.camera.flipY=!0,this.animateDuration=this.params.animateDuration||300,this.camera=new Ks(this.params.camera),this.container=this.params.containerId?document.getElementById(this.params.containerId):Ae.window.document.getElementsByTagName("body")[0];let e=this.container.getBoundingClientRect();this.offset.set(e.left,e.top),this.controller=new Zs(this.container,this.camera,!0),this.graph=new er(this.container),this.multiSelector=new rr(this.container,this.controller),this.dummiesController=new Co(this.container,this.controller),this.bindControllerEvents(),this.initLabel()}destroy(){var t;this.unbindControllerEvents(),super.destroy(),null==(t=this.label)||t.destroy()}initLabel(){this.label=new vo(this.container,"")}showAssetsLabel(t,e,i){var n,s,r,a,o;if(!e)return;t||(t=null==(n=this.scene)?void 0:n.assetType);const h=null==(s=this.scene)?void 0:s.chef.getElementBoundingBox(e);h&&!h.isEmpty()&&(i||(i=null==(r=this.scene)?void 0:r.getAssetLabelById(t,e))||(i=e),null==(a=this.label)||a.setHtml(i),Fo.copy(h.min).applyMatrix3(this.camera.viewMatrix).add(this.offset).round(),null==(o=this.label)||o.show(Fo))}hideAssetsLabel(){return d(this,null,(function*(){var t;return null==(t=this.label)?void 0:t.hide()}))}bindScene(t){var e;this.scene=t,this.multiSelector.bindScene(this.scene),null==(e=this.dummiesController)||e.bindScene(this.scene)}resize(){var t,e;null==(t=this.camera)||t.resize(),null==(e=this.controller)||e.resize()}setEnablePan(t){this.controller&&(this.controller.enablePan=!!t)}setByBox(t,e=!0){return d(this,null,(function*(){yield this.resetCameraByBoundingBox(t,e)}))}zoomIn(){this.controller.scaled=.9*this.camera.scaled.x,this.controller.update()}zoomOut(){this.controller.scaled=1.1*this.camera.scaled.x,this.controller.update()}zoomToSelectEnableChanged(t){this.zoomToSelectEnable=t,this.controller.enablePan=!this.zoomToSelectEnable}selectEnableChanged(t){this.selectEnable=!!t,this.multiSelector.selectEnableChanged(t)}multiSelectEnableChanged(t){this.multiSelectEnable=!!t,this.multiSelector.multiSelectEnableChanged(t)}fnEnableChanged(t){this.fnEnable=!!t,this.multiSelector.fnEnableChanged(t)}getIntersectObjects(t,e,i=[]){return this.scene?this.scene.getIntersectObjects(t,e,i):i}focusAt(t,e=500){return d(this,null,(function*(){return this.camera?(Wo.setFromCenterAndSize(t,Fo.set(2*e,2*e)),this.resetCameraByBoundingBox(Wo,!0)):Promise.resolve()}))}focusAtById(t,e=500){return d(this,null,(function*(){var i;const n=null==(i=this.scene)?void 0:i.getBoundingBoxById(t);if(n)return n.expandByScalar(e),Wo.copy(this.camera.boundingBoxWorld),void(Wo.containsBox(n)||(yield this.resetCameraByBoundingBox(n,!0)))}))}focusAtDummy(t,e=500){return d(this,null,(function*(){var i,n;const s=this.dummiesController.getDummyById(t),r=null==(i=null==s?void 0:s.userData)?void 0:i.rmId;if(r){const t=null==(n=this.scene)?void 0:n.getBoundingBoxById(r);if(t)return t.expandByScalar(e),Wo.copy(this.camera.boundingBoxWorld),void(Wo.containsBox(t)||(yield this.resetCameraByBoundingBox(t,!0)))}if((null==s?void 0:s.position)&&!(null==s?void 0:s.position.isEmpty()))return Wo.setFromCenterAndSize(s.worldPosition,Fo.set(2*e,2*e)),void(this.camera.boundingBoxWorld.containsBox(Wo)||(yield this.resetCameraByBoundingBox(Wo,!0)))}))}resetCameraByBoundingBox(t,e=!1){return d(this,null,(function*(){if(!this.camera)return Promise.resolve();if(!t||t.isEmpty())throw new Error("BoundingBox empty");if(!e)return this.camera.setByBox(t),Promise.resolve();const i=this.camera.getCameraPosition();t.getCenter(Fo),t.getSize(Uo);const n=Math.max(Uo.x/this.camera.width,Uo.y/this.camera.height),s={x:Fo.x,y:Fo.y,z:0,s:n,r:0};yield this.animateCamera(i,s)}))}animateCamera(t,e){return d(this,null,(function*(){return this.controller&&(this.controller.enabled=!1),this.tween&&this.tween.stop(),new Promise((i=>{this.tween=new zo.Tween(t).to(e,this.animateDuration).easing(zo.Easing.Exponential.Out).onUpdate((t=>{this.camera.position.set(t.x,t.y),this.camera.scaled.set(t.s,t.s),this.camera.rotation.set(t.r,t.r),this.camera.update()})).onComplete((()=>{this.controller&&(this.controller.enabled=!0),i()})).start()}))}))}fullscreen(){this.scene&&(this.scene&&!this.scene.viewBox.isEmpty()?Wo.copy(this.scene.viewBox):(this.scene.updateMatrixWorld(!0),this.scene.computeBoundingBox(),Wo.copy(this.scene.boundingBox)),this.resetCameraByBoundingBox(Wo,!0))}saveCameraPosition(t){Wo.copy(this.camera.boundingBoxWorld);const e=t?qo+t:qo;sessionStorage.setItem(e,JSON.stringify(Wo))}restoreCameraPosition(t){const e=t?qo+t:qo,i=sessionStorage.getItem(e);if(!i)return this.fullscreen();Wo.copy(JSON.parse(i)),this.resetCameraByBoundingBox(Wo,!0)}clearCameraPosition(t){const e=t?qo+t:qo;sessionStorage.setItem(e,"")}bindControllerEvents(){this.controller.addEventListener(Js.PAN_START,this.controllerPanStartHandler),this.controller.addEventListener(Js.PAN_END,this.controllerPanEndHandler),this.controller.addEventListener(Js.PAN_MOVE,this.controllerPanMoveHandler),this.controller.addEventListener(Js.POINTEROVER,this.controllerPointerOverHandler),this.multiSelector.addEventListener(ar.SELECTED,this.multiSelectorSelectedHandler)}unbindControllerEvents(){this.controller.removeEventListener(Js.PAN_START,this.controllerPanStartHandler),this.controller.removeEventListener(Js.PAN_END,this.controllerPanEndHandler),this.controller.removeEventListener(Js.PAN_MOVE,this.controllerPanMoveHandler),this.controller.removeEventListener(Js.POINTEROVER,this.controllerPointerOverHandler),this.multiSelector.removeEventListener(ar.SELECTED,this.multiSelectorSelectedHandler)}handlePanStart(t){if((null==t?void 0:t.type)===Js.PAN_START||(null==t?void 0:t.type)===Js.WHEEL_START)return this.zoomToSelectEnable?(this.p1.copy(t.data.screenCoords),Wo.makeEmpty().expandByPoint(this.p1),void this.graph.draw(Wo)):void 0}handlePanEnd(t){if((null==t?void 0:t.type)===Js.PAN_END||(null==t?void 0:t.type)===Js.WHEEL_END)return this.zoomToSelectEnable?(this.p2.copy(t.data.screenCoords),Wo.makeEmpty().expandByPoint(this.p1).expandByPoint(this.p2).unproject(this.controller.camera),this.setByBox(Wo),this.graph.hide(),void Wo.makeEmpty()):void 0}handleControllerPanMove(t){(null==t?void 0:t.type)===Js.PAN_MOVE&&this.zoomToSelectEnable&&(this.p2.copy(t.data.screenCoords),Wo.makeEmpty().expandByPoint(this.p1).expandByPoint(this.p2),this.graph.draw(Wo))}handleControllerPointerOver(t){var e,i,n,s,r;const a=(null==(e=null==t?void 0:t.e)?void 0:e.target)||(null==(n=null==(i=null==t?void 0:t.e)?void 0:i.srcEvent)?void 0:n.target);let o=null==a?void 0:a.id;(null==o?void 0:o.indexOf("dummy"))>-1?(o=a.getAttribute("ae-id"),o&&this._currentAssetId!==o&&this.dispatchEvent({type:"POINTEROVER",data:{id:o,assetType:"dummy"},e:t.e})):o&&(null==(s=this.scene)?void 0:s.isBelongsToAssetType(o,Li.WS))?this._currentAssetId!==o&&this.dispatchEvent({type:"POINTEROVER",data:{id:o,assetType:Li.WS},e:t.e}):o&&(null==(r=this.scene)?void 0:r.isBelongsToAssetType(o,Li.RM))?this._currentAssetId!==o&&this.dispatchEvent({type:"POINTEROVER",data:{id:o,assetType:Li.RM},e:t.e}):(this._currentAssetId=void 0,this.dispatchEvent({type:"POINTERLEAVE",e:t.e})),this._currentAssetId=o}handleMultiSelectorSelected(t){this.dispatchEvent({type:"SELECTED",data:t.data})}setDummies(t){this.dummiesController.setDummiesByVos(t)}clearDummies(t){this.dummiesController.clearDummies(t)}update(t){this.tween&&this.tween.update(t)}}const Wo=new ai,Fo=new We,Uo=new We;var Vo=(t=>(t.SELECTED="SELECTED",t.POINTEROVER="POINTEROVER",t.POINTERLEAVE="POINTERLEAVE",t))(Vo||{});const qo="svg_camera_position_";class jo extends Vs{constructor(t){super(t),c(this,"name","SvgEmptyScene"),this.bind('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-200 -200 500 500">\n <view id="defaultView" viewBox="-200 -200 500 500" />\n <style>\n /*#svg-loading-fast path {*/\n /* fill: #2E3032;*/\n /* animation: svg-loading-fast 2s ease infinite;*/\n /*}*/\n /*@keyframes svg-loading-fast {*/\n /* 0%, 100% {stroke-dasharray: 250; stroke-dashoffset: 250;}*/\n /* 68% {stroke-dasharray: 0; stroke-dashoffset: 0; opacity: 0.5;}*/\n /*}*/\n /*#svg-loading-fast .line {animation: svg-loading-fast 6s ease infinite;}*/\n /*@keyframes svg-loading-fast {*/\n /* 0% {stroke-dasharray: 250; stroke-dashoffset: 250; opacity: 1;}*/\n /* 50% {stroke-dasharray: 250; stroke-dashoffset: 0; opacity: 0.5;}*/\n /*}*/\n #svg-loading-fast path {animation: pathFrames 6s ease infinite;}\n @keyframes pathFrames {\n 0% {opacity: 1;}\n 50% {opacity: 0.5;}\n }\n #svg-loading-fast .triangle {animation: triangleFrames 3s ease infinite;}\n @keyframes triangleFrames {\n 0% {opacity: 1;}\n 50% {opacity: 0.3;}\n }\n #svg-loading-fast {fill: #525252}\n .line {stroke: #525252; stroke-width: 4px}\n .triangle {fill: #F26666}\n </style>\n <g id="svg-loading-fast">\n <g transform="scale(2, 2) translate(12, 0)">\n\x3c!-- <path d="M17.7 14L16.82 15.5L5 15.5L5 4L17.66 4L16.76 5.5L9.04 5.5L9.04 8.86L17.32 8.86L16.44 10.38L9.04 10.38L9.04 14L17.7 14Z" />--\x3e\n\x3c!-- <path d="M22.98 15.44L19.3 15.44L19.3 7.38L31.38 7.38L30.18 8.82L29.02 8.82L29.02 15.44L25.3 15.44L25.3 8.82L22.98 8.82L22.98 15.44ZM35.06 15.44L31.38 15.44L31.38 7.38L35.06 7.38L35.06 15.44Z" />--\x3e\n\x3c!-- <path d="M40.44 14.02L44.12 14.02L44.12 7.42L47.96 7.42L47.96 15.48L40.44 15.48L40.44 18.56L36.66 18.56L36.66 7.42L44.12 7.42L42.9 8.86L40.44 8.86L40.44 14.02Z" />--\x3e\n\x3c!-- <path d="M51.62 7.42L51.62 4.78L55.48 4.78L55.48 7.42L59 7.42L58.02 8.86L55.48 8.86L55.48 14.08L58.82 14.08L57.98 15.48L51.62 15.48L51.62 8.86L49.56 8.86L49.56 7.42L51.62 7.42Z" />--\x3e\n\x3c!-- <path d="M67.08 11.8L69.66 7.42L73.66 7.42L67.08 18.58L63.06 18.58L65.06 15.42L60.6 7.42L64.66 7.42L67.08 11.8Z" />--\x3e\n\n <path d="M13.5 15.8L12.62 17.3L0.799999 17.3L0.799999 5.8L13.46 5.8L12.56 7.3L4.84 7.3L4.84 10.66L13.12 10.66L12.24 12.18L4.84 12.18L4.84 15.8L13.5 15.8Z" />\n <path d="M32.12 17.3L28.52 17.3L28.52 9.9L25.18 17.3L22.1 17.3L18.8 10L18.8 17.3L15.1 17.3L15.1 5.8L20.06 5.8L23.68 13.68L27.32 5.8L32.12 5.8L32.12 17.3Z" />\n <path d="M37.72 12.8L37.72 17.3L33.72 17.3L33.72 5.8L42.22 5.8L41.06 7.34L37.72 7.34L37.72 11.3L42.22 11.3L42.22 5.8L46.28 5.8L46.28 12.8L37.72 12.8Z" />\n <path d="M57 17.3L53 17.3L53 7.34L47.88 7.34L47.88 5.8L62.48 5.8L61.6 7.34L57 7.34L57 17.3Z" />\n <path d="M69.92 13.52L64.08 5.78L68.62 5.78L71.92 10.58L75.14 5.78L79.64 5.78L73.92 13.56L73.92 17.28L69.92 17.28L69.92 13.52Z" />\n </g>\n\n <path class="line" d="M103.5 46L20 46" />\n <path class="line" d="M103.5 46L187 46" />\n <path class="triangle" d="M103.5 56L133.5 90L73.5 90Z" />\n </g>\n </svg>')}}var Yo=(t=>(t[t.TIPS=1]="TIPS",t[t.HOVER=2]="HOVER",t[t.SELECT=4]="SELECT",t[t.SELECTOR_RECT=8]="SELECTOR_RECT",t[t.DISTRIBUTION=16]="DISTRIBUTION",t[t.DRAG=32]="DRAG",t[t.DUMMY=64]="DUMMY",t[t.LINKER=128]="LINKER",t[t.DRAW_POINT=1024]="DRAW_POINT",t[t.DRAW_POLYLINE=2048]="DRAW_POLYLINE",t[t.DRAW_POLYGON=4096]="DRAW_POLYGON",t[t.DRAW_TEXT=8192]="DRAW_TEXT",t))(Yo||{}),Go=(t=>(t[t.DEFAULT=1]="DEFAULT",t[t.HOVER=3]="HOVER",t[t.PICKER=15]="PICKER",t[t.DISTRIBUTION=31]="DISTRIBUTION",t[t.DUMMY=119]="DUMMY",t[t.LINKER=135]="LINKER",t[t.DRAWING=15399]="DRAWING",t))(Go||{}),$o=(t=>(t[t.HOVER=1]="HOVER",t[t.SELECT=2]="SELECT",t[t.HILIGHT=4]="HILIGHT",t[t.DYNAMIC_LINE=8]="DYNAMIC_LINE",t))($o||{}),Xo=(t=>(t[t.KEEP_ORIGIN=1]="KEEP_ORIGIN",t[t.MAKE_COPY=2]="MAKE_COPY",t))(Xo||{}),Zo=(t=>(t[t.NONE=0]="NONE",t[t.DEFAULT=1]="DEFAULT",t[t.MODIFIED=2]="MODIFIED",t[t.NEW=3]="NEW",t))(Zo||{});class Jo{constructor(e,i){c(this,"parent"),c(this,"_fnEnable",null==(t=Ae.config)?void 0:t.fnEnable),c(this,"view"),c(this,"offset",new We),c(this,"scene"),c(this,"raycaster"),c(this,"boundingBoxPadding",15),c(this,"boundingBoxMap",new WeakMap),this.parent=e,this.view=i;const{container:n}=this.view||{};let s=n.getBoundingClientRect();this.offset.set(s.left,s.top),this.raycaster=new lr}activate(){}deactivate(){this.scene=void 0}fnEnableChanged(t){this._fnEnable=!!t}bindScene(...t){return this.scene=t[0],this}mountShape(t,e){const{svgRoot:i}=this.scene||{};i&&(i.contains(t)||(e?i.insertBefore(t,e):i.appendChild(t)))}unmountShape(t){const{svgRoot:e}=this.scene||{};e&&e.removeChild(t)}showShape(t){t&&(t.style.display="")}hideShape(t){t&&(t.style.display="none")}getDynamicObjectsByIds(t){var e;const i=[];Array.isArray(t)||(t=[t]);for(let n=0,s=t.length;n<s;n++)(null==(e=this.scene)?void 0:e.getElementById(t[n]))&&i.push(this.scene.getElementById(t[n]));return i}_getIntersectObject(t){var e,i;this.raycaster.init(t.data,null==(e=this.view)?void 0:e.camera);const n=[];return null==(i=this.scene)||i.getIntersectObjects(this.raycaster,this.scene.assetType,n),n}_getIntersect(t,e,i=this.boundingBoxPadding){var n,s,r;this.raycaster.init({worldCoords:e},null==(n=this.view)?void 0:n.camera);for(let e=0,n=t.length;e<n;e++){let n=null==(r=null==(s=this.scene)?void 0:s.chef)?void 0:r.getElementBoundingBox(t[e].id);if(n||(this.getBoundingBoxByNode(t[e],Qo),Qo.isEmpty()||(n=Qo.clone())),n&&(n.expandByScalar(i),n.containsPoint(this.raycaster.worldCoords)))return t[e]}}getBoundingBoxByNode(t,e=new ai){return e.makeEmpty(),Nn.getBoundingBoxByNode(t,e),e}}const Qo=new ai;class Ko extends Jo{constructor(t,e){super(t,e),c(this,"_locals",[]),c(this,"currentShape"),c(this,"_dragMap",new Map),c(this,"_bindedShape"),c(this,"_bindedControlPoint"),c(this,"_cpOffset",new We),c(this,"_cpFill",Le.darkRed),c(this,"_cpStroke",Le.darkBlue),c(this,"_mpFill",Le.white),c(this,"_mpStroke",Le.darkBlue),c(this,"_bbox"),c(this,"_boundingBoxLine"),c(this,"_tips"),c(this,"_sp"),c(this,"_rp"),c(this,"_rpLast",null),c(this,"_dp"),c(this,"_oprWidth",10),c(this,"unit"),c(this,"_boundingBox",null)}activate(){super.activate(),this.parent.enableHover(!1),this.mountControlPoints(),this._boundingBoxLine&&this.mountShape(this._boundingBoxLine),this._tips&&this.mountShape(this._tips)}deactivate(){super.deactivate(),this._dragMap.size>0&&(this._dragMap.forEach((t=>{this.unmountShape(t),this.parent.drop(t)})),this._dragMap.clear()),this.unmountShape(this._controlPoints),this._boundingBoxLine&&this.unmountShape(this._boundingBoxLine),this._tips&&this.unmountShape(this._tips),this.unbindShape()}initShapes(t){if(!t)return;Array.isArray(t)||(t=[t]);const e=this.type===Yo.DRAW_POINT,i=this.type===Yo.DRAW_POLYLINE,n=this.type===Yo.DRAW_POLYGON,s=this.type===Yo.DRAW_TEXT;for(let r=0,a=(null==t?void 0:t.length)||0;r<a;r++){const{nodeName:a}=t[r];if(e&&"circle"!==a||s&&"text"!==a)continue;const o=eh.test((t[r].getAttribute("d")||"").trim());if(i&&"path"!==a||i&&"path"===a&&o)continue;if(n&&"path"!==a||n&&"path"===a&&!o)continue;const h=document.createElementNS("http://www.w3.org/2000/svg",a);Array.from(t[r].attributes).forEach((t=>h.setAttribute(t.name,t.value))),t[r].children.length>0?h.innerHTML=t[r].innerHTML:t[r].textContent&&(h.textContent=t[r].textContent),this.mountShape(h),this._locals.push(h);const l=h.id||fs();this.parent.drag(h,{id:l,type:this.type})}}fnEnableChanged(t){super.fnEnableChanged(t)}editorFillChanged(t){this._bindedShape&&(t?this._bindedShape.setAttribute("fill",t.toString()):this._bindedShape.removeAttribute("fill"))}editorStrokeChanged(t){this._bindedShape&&(t?this._bindedShape.setAttribute("stroke",t.toString()):this._bindedShape.removeAttribute("stroke"))}editorStrokeWidthChanged(t){var e,i;if(this._bindedShape){this._bindedShape.setAttribute("stroke-width",t.toString());for(let n,s=0,r=(null==(i=null==(e=this._controlPoints)?void 0:e.children)?void 0:i.length)||0;s<r;s++)n=this._controlPoints.children[s],n.setAttribute("r",t.toString())}}editorStrokeDasharrayChanged(t){this._bindedShape&&(t?this._bindedShape.setAttribute("stroke-dasharray",t):this._bindedShape.removeAttribute("stroke-dasharray"))}editorFontSizeChanged(t){var e;this._bindedShape&&"text"===(null==(e=this._bindedShape)?void 0:e.nodeName)&&(this._bindedShape.setAttribute("font-size",t.toString()),this.updateControlPoints())}editorTextContentChanged(t){var e,i;this._bindedShape&&"text"===(null==(e=this._bindedShape)?void 0:e.nodeName)&&(this._bindedShape.textContent=t,null==(i=this._bindedShape)||i.getBBox())}deleteCurrentShape(){if(!this._bindedShape)return;const t=ri.findIndex(this._locals,(t=>t===this._bindedShape));t>-1&&this._locals.splice(t,1),this.unmountShape(this._bindedShape),this.unbindControlPoint(),this.unbindShape(),this.currentShape=void 0}clearAllShapes(){this.deleteCurrentShape();for(let t=0,e=this._locals.length;t<e;t++)this.unmountShape(this._locals[t]);this._locals=[]}editorUnitsChanged(t){this.unit=t||Ei.M}bindEditorDrag(t){}getDraggingObject(t){}beforeDragStart(t){}handleDragStart(t){var e,i,n;if((null==t?void 0:t.type)!==Js.PAN_START||(null==(e=null==t?void 0:t.targetVo)?void 0:e.type)!==this.type)return;const{target:s,targetVo:r,center:a}=t||{},o=(null==r?void 0:r.id)||fs(),h=this.isControlPoints(s);if(ih.set(a.x,a.y).sub(this.offset),(null==(i=this.view)?void 0:i.camera)&&ih.unproject(null==(n=this.view)?void 0:n.camera),this._boundingBox=Nn.getBoundingBoxByNode(this._bindedShape),h)this.bindControlPoint(s),this.currentShape=s,this.beforeDragStart(t),this.updateControlPoints(this.currentShape,ih),this.updateByControlPoints(ih);else if(this._spId&&ri.startsWith(null==s?void 0:s.id,this._spId)||this._rpId&&ri.startsWith(null==s?void 0:s.id,this._rpId))this.currentShape=s;else if(!ri.startsWith(null==s?void 0:s.id,this._cpsId)){this.bindShape(t);const e=this.hasShape(o);this.currentShape=this.getShape(o),e?(Nn.parseNodeTransform(this.currentShape,dh).getTransition(oh),this._cpOffset.copy(ih).sub(oh)):this._cpOffset.identity(),ih.sub(this._cpOffset),es(this.currentShape,ih),this.updateControlPoints(this._controlPoints,ih)}this.updateOperations(s,ih),this.updateBoundingBoxLine(),this.updateTips()}handleDragMove(t){var e,i;if((null==t?void 0:t.type)!==Js.PAN_MOVE)return;if(!this.currentShape)return;const{target:n,center:s}=t||{};ih.set(s.x,s.y).sub(this.offset),(null==(e=this.view)?void 0:e.camera)&&ih.unproject(null==(i=this.view)?void 0:i.camera),this.isControlPoints(n)?(this.updateControlPoints(this.currentShape,ih),this.updateByControlPoints(ih)):this._spId&&ri.startsWith(null==n?void 0:n.id,this._spId)||this._rpId&&ri.startsWith(null==n?void 0:n.id,this._rpId)||ri.startsWith(null==n?void 0:n.id,this._cpsId)||(ih.sub(this._cpOffset),es(this.currentShape,ih),this.updateControlPoints(this._controlPoints,ih)),this.updateOperations(n,ih),this.updateBoundingBoxLine(),this.updateTips()}handleDragEnd(t){var e,i,n;if((null==t?void 0:t.type)!==Js.PAN_END)return;if(!this.currentShape)return;const{target:s,center:r}=t||{};ih.set(r.x,r.y).sub(this.offset),(null==(e=this.view)?void 0:e.camera)&&ih.unproject(null==(i=this.view)?void 0:i.camera),this.isControlPoints(s)?(this.updateControlPoints(this.currentShape,ih),this.updateByControlPoints(ih),this.unbindControlPoint()):this._spId&&ri.startsWith(null==s?void 0:s.id,this._spId)||this._rpId&&ri.startsWith(null==s?void 0:s.id,this._rpId)||ri.startsWith(null==s?void 0:s.id,this._cpsId)||(ih.sub(this._cpOffset),es(this.currentShape,ih),this.updateControlPoints(this._controlPoints,ih));const a=null==(n=this.currentShape)?void 0:n.id;a&&!this._dragMap.has(a)&&(this.parent.drag(this.currentShape,{id:a,type:this.type}),this._dragMap.set(a,this.currentShape)),this.updateOperations(s,ih),this.updateBoundingBoxLine(),this.updateTips(),this.currentShape=void 0,this._cpOffset.identity(),this._boundingBox=null,this._rpLast=null}handleTap(t){var e,i,n,s;if((null==t?void 0:t.type)!==Js.TAP)return;const r=(null==(e=null==t?void 0:t.e)?void 0:e.target)||(null==(n=null==(i=null==t?void 0:t.e)?void 0:i.srcEvent)?void 0:n.target),a=null==r?void 0:r.id;if(a&&ri.startsWith(a,this._dpId))return void this.deleteCurrentShape();const o=this._getIntersect(this._locals,null==(s=null==t?void 0:t.data)?void 0:s.worldCoords);this._boundingBox=Nn.getBoundingBoxByNode(o),this.bindShape(t),Nn.parseNodeTransform(this._bindedShape,dh).getTransition(oh),this.updateOperations(this._controlPoints,oh),this._boundingBox=null}hasShape(t){return void 0!==ri.find(this._locals,(e=>e.id===t))}getShape(t){throw new Error("Method not implemented.")}bindShape(t){var e;const i=this._getIntersect(this._locals,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this._bindedShape=i,this._bindedShape?(this.resetControlPoints(),Nn.parseNodeTransform(this._bindedShape,dh).getTransition(oh),this.updateControlPoints(this._controlPoints,oh),this.showShape(this._controlPoints),this.updateBoundingBoxLine(),this.showShape(this._boundingBoxLine),this.updateTips(),this.showShape(this._tips)):this.unbindShape()}unbindShape(){this._bindedShape=void 0,this.hideShape(this._controlPoints),this.hideShape(this._boundingBoxLine),this.hideShape(this._tips)}handleWheelEnd(t){this.updateControlPointsRadius()}updateControlPointsRadius(){var t,e,i,n,s;const r=ri.filter(this._controlPoints.children,(t=>"circle"===t.nodeName));if(!(null==r?void 0:r.length))return;const a=Math.max((null==(i=null==(e=null==(t=this.parent)?void 0:t.view)?void 0:e.camera)?void 0:i.pixelWidth)||1,1),o=Math.ceil(a*((null==(s=null==(n=Ae.config)?void 0:n.editor)?void 0:s.strokeWidth)||10));for(let t,e=0,i=(null==r?void 0:r.length)||0;e<i;e++)t=r[e],t.setAttribute("r",o.toString())}getControlPoints(){const t=is(this._cpsId),e=new Re(this._cpFill).setA(.1).getStyle(),i=this._cpStroke,n=Kn({id:`${this._spId}`,fill:e,stroke:i,strokeWidth:2});n.setAttribute(`${ki}-type`,(this.type|Yo.DRAG).toString()),n.setAttribute("d","\n M75 25L25 75 \n M50 27.9412L80 20L72.0588 50\n M27.9412 50L20 80L50 72.0588\n M99 50C99 23 77 1 50 1C23 1 1 23 1 50C1 77 23 99 50 99C77 99 99 77 99 50 \n "),Nn.getBoundingBoxByNode(n,uh).getSize(nh);const s=this._oprWidth/nh.x;n.setAttribute("stroke-width",(2/s).toFixed(2)),es(n,void 0,void 0,nh.set(s,s)),t.appendChild(n),this._sp=n;const r=Kn({id:`${this._rpId}`,fill:e,stroke:i,strokeWidth:2/s});r.setAttribute(`${ki}-type`,(this.type|Yo.DRAG).toString()),r.setAttribute("d","\n M49 25.5C79 25.5 87 58 69 72C51 86 24.5 76 24.5 49.5\n M56.5003 52.4994L47.725 23.1994L78.5098 19.2823\n M99 50C99 23 77 1 50 1C23 1 1 23 1 50C1 77 23 99 50 99C77 99 99 77 99 50Z\n "),es(r,void 0,void 0,nh.set(s,s)),t.appendChild(r),this._rp=r;const a=Kn({id:`${this._dpId}`,fill:e,stroke:i,strokeWidth:2/s});return a.setAttribute(`${ki}-type`,(this.type|Yo.DRAG).toString()),a.setAttribute("d","\n M25.5 26L75.5 75.5\n M75.5 26L25.5 75.5\n M99 50C99 23 77 1 50 1C23 1 1 23 1 50C1 77 23 99 50 99C77 99 99 77 99 50Z\n "),es(a,void 0,void 0,nh.set(s,s)),t.appendChild(a),this._dp=a,t}updateControlPoints(t,e){throw new Error("Method not implemented.")}updateOperations(t,e){if(!this._sp||!this._rp)return;if(Nn.getBoundingBoxByNode(this._sp,ch).getSize(nh),t&&e&&ri.startsWith(t.id,this._spId)&&this._boundingBox){Nn.getBoundingBoxByNode(this._bindedShape,uh).getCenter(sh);const t=We.getDistance(uh.max,sh),i=We.getDistance(e,sh)/t;Nn.parseNodeTransform(this._bindedShape,dh).decompose(oh,hh,lh),oh.sub(sh).multiplyScalar(i).add(sh),lh.multiplyScalar(i),es(this._bindedShape,oh,hh,lh),this.updateControlPoints(this._controlPoints,oh)}else if(t&&e&&ri.startsWith(t.id,this._rpId)){Nn.getBoundingBoxByNode(this._bindedShape,uh).getCenter(sh);const t=We.angle(e,sh,!0);null===this._rpLast&&(this._rpLast=t);const i=t-this._rpLast;Nn.parseNodeTransform(this._bindedShape,dh).decompose(oh,hh,lh),oh.sub(sh).rotate(i).add(sh),hh.addScalar(i),es(this._bindedShape,oh,hh,lh),this._rpLast=t,this.updateControlPoints(this._controlPoints,oh)}if(Nn.getBoundingBoxByNode(this._bindedShape,uh),uh.isEmpty())return;const i=(nh.x||10)/2;rh.set(uh.max.x,uh.min.y).add(ah.set(i,-i)),ns(this._sp,rh),rh.set(uh.max.x,uh.min.y).add(ah.set(2*(nh.x+i),-i)),ns(this._rp,rh),rh.set(uh.max.x,uh.min.y).add(ah.set(4*(nh.x+i),-i)),ns(this._dp,rh)}updateByControlPoints(t){throw new Error("Method not implemented.")}isControlPoints(t){return!!t&&(!!this._cpId&&ri.startsWith(null==t?void 0:t.id,this._cpId)||!!this._mpId&&ri.startsWith(null==t?void 0:t.id,this._mpId))}bindControlPoint(t){this._bindedControlPoint=t}unbindControlPoint(){this._bindedControlPoint=void 0}resetControlPoints(){this._controlPoints&&(this.unmountShape(this._controlPoints),this._controlPoints=this.getControlPoints(),this.mountControlPoints())}mountControlPoints(){var t,e,i;if(this._controlPoints){this.hideShape(this._controlPoints),this.mountShape(this._controlPoints);for(let n,s=0,r=(null==(e=null==(t=this._controlPoints)?void 0:t.children)?void 0:e.length)||0;s<r;s++){n=null==(i=this._controlPoints)?void 0:i.children[s];const t=n.id;if(!t)continue;const e=parseInt(n.getAttribute(`${ki}-type`)||"0");e&&e&Yo.DRAG&&(this.parent.drag(n,{id:t,type:this.type}),this._dragMap.set(t,n))}}}splitByControlPoint(t,e){var i;if(!this._bindedShape||!t||!e)return;if(!ri.startsWith(null==t?void 0:t.id,this._mpId))return;const n=null==t?void 0:t.id,s=this.getCpIdx(n);Nn.getPathProxyBySvgPathD(null==(i=this._bindedShape)?void 0:i.getAttribute("d"),ph.dispose()),ph.insertData(s,un,nh.x,nh.y);const r=Nn.getSvgPathDByData(ph.data);this._bindedShape.setAttribute("d",r),this.resetControlPoints();const a=ri.find(this._controlPoints.children,(t=>t.id===`${this._cpId}${s+1}`));this.bindControlPoint(a),this.currentShape=a,this.showShape(this._controlPoints),Nn.parseNodeTransform(this._bindedShape,dh).getTransition(nh),this.updateControlPoints(this._controlPoints,nh)}mergeByControlPoint(t,e){var i;if(!this._bindedShape||!t||!e)return;const n=null==t?void 0:t.id;if(!ri.startsWith(n,this._cpId))return;const s=this.getCpIdx(n);if(!s)return;if(ri.filter(this._controlPoints.children,(t=>t.id.startsWith(this._cpId))).length<=this._cpsLimit)return;Nn.getPathProxyBySvgPathD(null==(i=this._bindedShape)?void 0:i.getAttribute("d"),ph.dispose()),ph.removeData(s);const r=Nn.getSvgPathDByData(ph.data);this._bindedShape.setAttribute("d",r),this.resetControlPoints(),this.showShape(this._controlPoints),Nn.parseNodeTransform(this._bindedShape,dh).getTransition(nh),this.updateControlPoints(this._controlPoints,nh)}getCpIdx(t){return parseInt(t.slice(t.lastIndexOf("-")+1))-1}getBoundingBoxLine(){return Kn({id:this._bblId,fill:"none",stroke:this._cpStroke,strokeWidth:1,strokeDasharray:"5",d:[]})}updateBoundingBoxLine(){if(!this._boundingBoxLine||!this._bindedShape)return;Nn.getBoundingBoxByNode(this._bindedShape,uh.makeEmpty()),ph.dispose().moveTo(uh.min.x,uh.min.y).lineTo(uh.max.x,uh.min.y).lineTo(uh.max.x,uh.max.y).lineTo(uh.min.x,uh.max.y).lineTo(uh.min.x,uh.min.y).closePath();const t=Nn.getSvgPathDByData(ph.data);this._boundingBoxLine.setAttribute("d",t)}getTips(){const t=this._cpStroke;return ts({id:this._tipsId,textContent:"tips",fill:t,fontSize:Ae.config.editor.fontSize||th,textAnchor:"start",textBaseline:"middle"})}updateTips(){this._boundingBoxLine&&this._bindedShape&&this._tips&&(Nn.getBoundingBoxByNode(this._bindedShape,uh.makeEmpty()),oh.set(uh.max.x+this._oprWidth,uh.min.y+this._oprWidth+1.5*th),es(this._tips,oh),this.recomputeTips())}recomputeTips(){var t,e,i,n;if(!this._bindedShape||!this._tips)return;let s;Nn.getPathProxyBySvgPathD(null==(t=this._bindedShape)?void 0:t.getAttribute("d"),ph.dispose()),Nn.parseNodeTransform(this._bindedShape,dh).decompose(oh,hh,lh),this.type&Yo.DRAW_POLYLINE?(s||(s=ph.getLength()),s||"function"!=typeof this._bindedShape.getTotalLength||(s=null==(e=this._bindedShape)?void 0:e.getTotalLength()),s*=(lh.x+lh.y)/2,s=Di(s,null==(i=this.scene)?void 0:i.viewUnits,Ei.M),this._tips.textContent=function(t,e=Ei.M){let i=t||0;return t?(i=e===Ei.MM?ri.round(t):e===Ei.CM?ri.round(t,1):ri.round(t,2),`${i} ${e}`):""}(s,Ei.M)):this.type&Yo.DRAW_POLYGON&&(s=ph.getArea(),s*=lh.x*lh.y,s=Di(s,null==(n=this.scene)?void 0:n.viewUnits,Ei.M,!0),this._tips.textContent=function(t,e=Ei.M){let i=t||0;return t?(i=e===Ei.MM?ri.round(t):e===Ei.CM?ri.round(t,1):ri.round(t,2),`${i} ${e}²`):""}(s,Ei.M))}}const th=20,eh=/z\s*$/i,ih=new We,nh=new We,sh=new We,rh=new We,ah=new We,oh=new We,hh=new We,lh=new We,uh=new ai,ch=new ai,dh=new Ui,ph=new yn;class fh extends Ko{constructor(t,e){super(t,e),c(this,"type",Yo.DRAW_POINT),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),this._controlPoints=this.getControlPoints()}activate(){super.activate()}deactivate(){super.deactivate()}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i=new Re(Ae.config.editor.fill||Le.green).setA(.6).getStyle(),n=new Re(Ae.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),s=Ae.config.editor.strokeWidth||5;e=Qn({id:t,r:3*s,x:0,y:0,fill:i,stroke:n,strokeWidth:s}),e.setAttribute(`${ki}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints)}return e}getControlPoints(){const t=is(`${this._cpsId}`),e=Ae.config.editor.strokeWidth,i=Qn({id:`${this._cpId}1`,x:0,y:0,r:e,fill:this._cpFill,stroke:this._cpStroke});return i.setAttribute(`${ki}-type`,(Yo.DRAW_POINT|Yo.DRAG).toString()),t.appendChild(i),t}updateControlPoints(t,e){if(t&&e){if(this.getBoundingBoxByNode(this._bindedShape,vh),vh.getCenter(mh),vh.getSize(gh),t===this._controlPoints){yh.set(e.x+gh.x/2,e.y);const t=ri.filter(this._controlPoints.children,(t=>"circle"===t.nodeName));for(let e=0,i=t.length;e<i;e++)ns(t[e],yh)}else yh.set(mh.x+gh.x/2,mh.y),ns(t,yh);this.updateControlPointsRadius()}}updateByControlPoints(t){this._bindedShape&&(Nn.getBoundingBoxByNode(this._bindedShape,vh),vh.getCenter(mh),gh.copy(t).sub(mh),this._bindedShape.setAttribute("r",Math.abs(gh.x).toString()))}}const mh=new We,gh=new We,yh=new We,vh=new ai;class xh extends Jo{constructor(t,e){super(t,e),c(this,"type",Yo.DRAG),c(this,"_els",[]),c(this,"_hms",new Map),c(this,"_vos",new Map),c(this,"onPanHandler",this._handleOnPan.bind(this)),c(this,"panMoveHandler",ri.throttle(this._handlePanMove.bind(this),100)),c(this,"panEndHandler",this._handlePanEnd.bind(this))}activate(){super.activate()}deactivate(){var t;super.deactivate();for(let e=((null==(t=this._els)?void 0:t.length)||0)-1;e>=0;e--)this.drop(this._els[e])}drag(t,e){this._els.includes(t)||(this.bindEvent(t),this._els.push(t),this._vos.set(t,e))}drop(t){if(!t)return;this.unbindEvent(t),this._vos.delete(t);const e=this._els.findIndex((e=>e===t));e>-1&&this._els.splice(e,1)}bindEvent(t){if(!t)return;const e=new Hammer.Manager(t,{domEvents:!0});e.add(new Hammer.Pan({threshold:0,pointers:0})),e.on("panstart",this.onPanHandler),e.on("panmove",this.panMoveHandler),e.on("panend",this.panEndHandler),this._hms.set(t,e)}unbindEvent(t){if(!t)return;const e=this._hms.get(t);e&&(e.off("panstart",this.onPanHandler),e.off("panmove",this.panMoveHandler),e.off("panend",this.panEndHandler),e.destroy(),this._hms.delete(t))}_handleOnPan(t){var e;if((null==t?void 0:t.type)!==Js.PAN_START)return;"function"==typeof t.preventDefault&&t.preventDefault();const{target:i,center:n}=t||{};if(!i)return;ri.set(t,"targetVo",this._vos.get(i)),this.parent.setEnablePan(!1),bh.copy(n).sub(this.offset);const s={x:bh.x,y:bh.y};(null==(e=this.view)?void 0:e.camera)&&bh.unproject(this.view.camera);const r={x:bh.x,y:bh.y};ri.set(t,"data",{screenCoords:s,worldCoords:r}),this.parent.handleDragStart(t)}_handlePanMove(t){var e;(null==t?void 0:t.type)===Js.PAN_MOVE&&((null==(e=this.parent)?void 0:e.isEnablePan())||(ri.set(t,"targetVo",this._vos.get(t.target)),this.parent.handleDragMove(t)))}_handlePanEnd(t){var e;this.parent.setEnablePan(!0),(null==t?void 0:t.type)===Js.PAN_END&&(ri.set(t,"targetVo",this._vos.get(t.target)),this.parent.handleDragEnd(t),null==(e=this.view.camera)||e.update())}}const bh=new We;class wh extends Jo{constructor(t,e){super(t,e),c(this,"type",Yo.HOVER),c(this,"_hoverEnabled",!1),c(this,"_hovered"),c(this,"_hoverId")}activate(){var t;super.activate(),this.enableHover(null==(t=Ae.config.controls)?void 0:t.enableHover)}deactivate(){super.deactivate(),this._hoverId=void 0,this._hovered=void 0}enableHover(t){return this._hoverEnabled=t,this}_handlePointerOver(t){var e,i,n,s,r;if((null==(e=null==t?void 0:t.e)?void 0:e.buttons)>0)return;let a=(null==(i=null==t?void 0:t.e)?void 0:i.target)||(null==(s=null==(n=null==t?void 0:t.e)?void 0:n.srcEvent)?void 0:s.target);null==(r=this.scene)||r.assetType;let o=null==a?void 0:a.id;if(!o){const e=this._getIntersectObject(t);o=(null==e?void 0:e.length)&&"function"==typeof e[0].getAttribute?e[0].getAttribute("id"):void 0,a=(null==e?void 0:e.length)?e[0]:void 0}o&&o!==this._hoverId&&(this.parent.handlePointerOver(t),this._hoverEnabled&&this._hover(a)),this._hoverId&&o!==this._hoverId&&(this._clearHover(this._hovered),this.parent.handlePointerOut(t)),this.parent.handlePointerMove(t),this._hoverId=o,this._hovered=a}_hover(t){t&&Fs(t,"hover")}_clearHover(t){t&&Us(t,"hover")}}let _h=0;class Sh{constructor(t,e,i){var n;c(this,"id",_h++),c(this,"worker"),this.worker=i;let s=t=>{var e;return null==(e=this.worker)?void 0:e.postMessage({type:"event",id:this.id,data:t})};this.worker||(s=t=>{Ah.instance().handleEvent({id:this.id,data:t})}),null==(n=this.worker)||n.postMessage({type:"makeProxy",id:this.id}),this.worker||Ah.instance().makeProxy({id:this.id}),r();for(const[i,n]of Object.entries(e))t.addEventListener(i,(function(t){n(t,s)}));function r(){const e=t.getBoundingClientRect();s({type:"size",left:e.left,top:e.top,width:t.clientWidth,height:t.clientHeight})}window.addEventListener("resize",r)}}function Eh(){}class Mh extends Fi{constructor(){super(),c(this,"isProxy",!0),c(this,"width"),c(this,"height"),c(this,"left"),c(this,"right"),c(this,"top"),c(this,"bottom"),c(this,"style",{})}get clientWidth(){return this.width}get clientHeight(){return this.height}setPointerCapture(){}releasePointerCapture(){}getBoundingClientRect(){return{left:this.left,top:this.top,width:this.width,height:this.height,right:(this.left||0)+(this.width||0),bottom:(this.top||0)+(this.height||0)}}handleEvent(t){if("size"===t.type)return this.left=t.left,this.top=t.top,this.width=t.width,void(this.height=t.height);t.preventDefault=Eh,t.stopPropagation=Eh,this.dispatchEvent(t)}focus(){}getRootNode(){return{addEventListener:Eh,removeEventListener:Eh}}}class Ah{constructor(){c(this,"targets",{}),this.handleEvent=this.handleEvent.bind(this)}makeProxy(t){const{id:e}=t,i=new Mh;this.targets[e]=i}getProxy(t){return this.targets[t]}handleEvent(t){var e;null==(e=this.targets[t.id])||e.handleEvent(t.data)}static instance(){return Th}}const Th=new Ah;const Ch=Ih(["ctrlKey","metaKey","shiftKey","button","pointerType","clientX","clientY","pointerId","pageX","pageY"]);function Ih(t){return function(e,i){const n={type:e.type};!function(t,e,i){for(const n of e)i[n]=t[n]}(e,t,n),i(n)}}function Dh(t,e){t.preventDefault();const i=[],n={type:t.type,touches:i};for(let e=0;e<t.touches.length;++e){const n=t.touches[e];i.push({pageX:n.pageX,pageY:n.pageY,clientX:n.clientX,clientY:n.clientY})}e(n)}const Lh=Ih(["deltaMode","deltaX","deltaY","clientX","clientY"]),Bh={37:!0,38:!0,39:!0,40:!0},Ph=Ih(["ctrlKey","metaKey","shiftKey","keyCode"]);const kh={contextmenu:function(t){t.preventDefault()},mousedown:Ch,mousemove:Ch,mouseup:Ch,pointerdown:Ch,pointermove:Ch,pointerup:Ch,touchstart:Dh,touchmove:Dh,touchend:Dh,wheel:function(t,e){t.preventDefault(),Lh(t,e)},keydown:function(t,e){const{keyCode:i}=t;Bh[i]&&(t.preventDefault(),Ph(t,e))}};class Nh extends Fi{constructor(t,e){super(),c(this,"name","Handler"),c(this,"dom"),c(this,"camera"),c(this,"domOffset",new We),c(this,"enabled",!0),c(this,"_hoverEnabled",!1),c(this,"scenes",[]),c(this,"rayCaster",new lr),c(this,"contextMenuHandler",this.handleContextMenu.bind(this)),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"pointerOverHandler",ri.debounce(this.handlePointerOver.bind(this),20)),c(this,"panHandler",this.handlePan.bind(this)),c(this,"_hovered"),this.dom=t,this.camera=e,this.resize(),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.dispose()}dispose(){this.scenes=[]}enableHover(t){return this._hoverEnabled=t,this}resize(){let t=this.dom.getBoundingClientRect();this.domOffset.set(t.left,t.top)}bindScene(...t){return this.scenes.length=0,this.scenes.push(...t),this}bindEvents(){this.unbindEvents(),this.dom.addEventListener("contextmenu",this.contextMenuHandler),this.dom.addEventListener("singletap",this.tapHandler),this.dom.addEventListener("panstart",this.panHandler),this.dom.addEventListener("panmove",this.panHandler),this.dom.addEventListener("panend",this.panHandler),this.dom.addEventListener("mousemove",this.pointerOverHandler)}unbindEvents(){this.dom.removeEventListener("contextmenu",this.contextMenuHandler),this.dom.removeEventListener("singletap",this.tapHandler),this.dom.removeEventListener("panstart",this.panHandler),this.dom.removeEventListener("panmove",this.panHandler),this.dom.removeEventListener("panend",this.panHandler),this.dom.removeEventListener("mousemove",this.pointerOverHandler)}handleContextMenu(t){this.enabled&&"function"==typeof t.preventDefault&&t.preventDefault()}handlePointerDown(t){}handlePointerMove(t){}handlePointerUp(t){}handleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),zh.set(t.center.x,t.center.y).sub(this.domOffset),Hh.copy(zh).unproject(this.camera),this.dispatchEvent({type:"tap",data:{screenCoords:{x:zh.x,y:zh.y},worldCoords:{x:Hh.x,y:Hh.y}},e:t})}handlePan(t){var e,i;"function"==typeof t.preventDefault&&t.preventDefault(),zh.set(null==(e=t.center)?void 0:e.x,null==(i=t.center)?void 0:i.y).sub(this.domOffset),Hh.copy(zh).unproject(this.camera);const n={screenCoords:{x:zh.x,y:zh.y},worldCoords:{x:Hh.x,y:Hh.y}},s={type:"panmove",data:n};(t.isFirst||"panstart"===t.type)&&(s.type="panstart"),(t.isLast||"panend"===t.type)&&(s.type="panend");const{id:r,target:a}=this.getHover(n);r&&ri.set(s,"data.id",r),a&&ri.set(s,"data.target",a),this.dispatchEvent(s)}handlePointerOver(t){if(!this._hoverEnabled||t.buttons>0)return;const e=this._hovered;zh.set(t.clientX,t.clientY).sub(this.domOffset),Hh.copy(zh).unproject(this.camera);let i={screenCoords:{x:zh.x,y:zh.y},worldCoords:{x:Hh.x,y:Hh.y}};const n=this._hovered=this.getHover(i),s=l(l({},i),n);this.setCursor((null==n?void 0:n.target)?"pointer":"default"),(null==n?void 0:n.id)!==(null==e?void 0:e.id)&&(null==e?void 0:e.target)&&this.dispatchEventByTarget(e.target,{type:"pointerout",data:l(l({},i),e)}),(null==n?void 0:n.target)&&this.dispatchEventByTarget(n.target,{type:"pointermove",data:s}),(null==n?void 0:n.target)&&(null==n?void 0:n.target)!==(null==e?void 0:e.target)&&this.dispatchEventByTarget(n.target,{type:"pointerover",data:s}),this.dispatchEvent({type:"pointermove",data:s})}getHover(t){var e;const{screenCoords:i,worldCoords:n}=t||{},s={id:void 0,target:void 0},r=[],a=this.scenes.find((t=>t.isDynamic));if(a&&(this.rayCaster.init(t,this.camera).intersectObjectBy(a,Oh,!0,r),r.length))return s.isDynamic=!0,Rh(r,s),s;for(let i,n=0,s=(null==(e=this.scenes)?void 0:e.length)||0;n<s;n++)i=this.scenes[n],i.isDynamic||this.rayCaster.init(t,this.camera).intersectObjectBy(i,Oh,!0,r);return r.length&&(s.isStatic=!0,Rh(r,s)),s}dispatchEventByTarget(t,e){var i;if(!(null==t?void 0:t.visible))return;let n=!1;for(;t&&(n=null==(i=t.userData)?void 0:i.cancelBubble,"function"==typeof t.dispatchEvent&&t.dispatchEvent(e),t=t.parent,!n););n||this.dispatchEvent(e)}setCursor(t){this.dom instanceof Mh&&"function"==typeof self.postMessage?self.postMessage({type:"setCursor",cursorStyle:t}):this.dom.style&&(this.dom.style.cursor=t||"default")}}function Oh(t){return t.visible}function Rh(t,e={}){var i,n,s;let r=t.find((t=>{var e,i;return t.visible&&t.selectable&&(null==(e=t.userData)?void 0:e.assetType)===(null==(i=Ae.config)?void 0:i.assetType)}));return r?(e.id=(null==(i=r.userData)?void 0:i.id)||r.name,e.target=r,(null==(n=r.userData)?void 0:n.assetType)&&(e.assetType=null==(s=r.userData)?void 0:s.assetType),r.isDummy&&(e.isDummy=!0),e):e}const zh=new We,Hh=new We;var Wh=(t=>(t.CONTEXTMENU="contextmenu",t.MOUSEDOWN="mousedown",t.MOUSEMOVE="mousemove",t.MOUSEUP="mouseup",t.POINTERDOWN="pointerdown",t.POINTERMOVE="pointermove",t.POINTERUP="pointerup",t.POINTEROUT="pointerout",t.POINTEROVER="pointerover",t.TOUCHSTART="touchstart",t.TOUCHMOVE="touchmove",t.TOUCHEND="touchend",t.WHEEL="wheel",t.WHEEL_END="wheelend",t.KEYDOWN="keydown",t.TAP="tap",t.SINGLE_TAP="singletap",t.DOUBLE_TAP="doubletap",t.PRESS="press",t.HOVER="hover",t.PAN_START="panstart",t.PAN_MOVE="panmove",t.PAN_END="panend",t))(Wh||{});class Fh extends Fi{constructor(t,e){super(),c(this,"name","OrbitControls2"),c(this,"isSvg",!1),c(this,"dom"),c(this,"domOffset",new We),c(this,"camera"),c(this,"enabled",!0),c(this,"enablePan",!0),c(this,"enableRotate",!0),c(this,"rotateSpeed",1),c(this,"enableZoom",!0),c(this,"minZoom",0),c(this,"maxZoom",1/0),c(this,"zoomSpeed",1),c(this,"zoomChanged",!1),c(this,"distanceStart",1),c(this,"distanceEnd",1),c(this,"state",-1),c(this,"EPS",1e-6),c(this,"focus",new We),c(this,"target",new We),c(this,"scaled",1),c(this,"rotateTheta",0),c(this,"enableDamping",!1),c(this,"dampingFactor",.05),c(this,"mouseButtons",{LEFT:2,MIDDLE:1,RIGHT:0}),c(this,"isWheeling",!1),c(this,"finalTimer"),c(this,"rotateStart",new We),c(this,"rotateEnd",new We),c(this,"rotateDelta",new We),c(this,"panStart",new We),c(this,"panEnd",new We),c(this,"panOffset",new We),c(this,"dollyStart",0),c(this,"dollyOffset",new We),c(this,"contextMenuHandler",this.handleContextMenu.bind(this)),c(this,"wheelHandler",this.handleWheel.bind(this)),c(this,"pointerDownHandler",this.handlePointerDown.bind(this)),c(this,"pointerUpHandler",this.handlePointerUp.bind(this)),c(this,"pointerMoveHandler",this.handlePointerMove.bind(this)),c(this,"pointerOverHandler",ri.debounce(this.handlePointerOver.bind(this),100)),c(this,"pointerLeaveHandler",this.handlePointerLeave.bind(this)),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"panHandler",this.handlePan.bind(this)),c(this,"pinchHandler",this.handlePinch.bind(this)),c(this,"pressHandler",this.handlePress.bind(this)),c(this,"swipeHandler",this.handleSwipe.bind(this)),c(this,"hammerInputHandler",this.handleHammerInput.bind(this)),this.dom=t,this.camera=e,this.scaled=e.scaled.x,this.resize(),this.dom.style.touchAction="none",this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}resize(){let t=this.dom.getBoundingClientRect();this.domOffset.set(t.left,t.top)}update(){this.camera.position.add(this.panOffset).add(this.dollyOffset),this.camera.scaled.set(this.scaled,this.scaled),this.rotateTheta&&(this.camera.rotation.x-=this.rotateTheta,Uh.copy(this.camera.position).rotateAround(this.focus,-this.rotateTheta),this.camera.position.copy(Uh)),this.camera.update(),this.panOffset.set(0,0),this.dollyOffset.set(0,0),this.scaled=this.camera.scaled.x,this.rotateTheta=0,this.dispatchEvent({type:"cameraChanged",data:{t:this.camera.position,r:this.camera.rotation.x,s:this.camera.scaled.x}})}bindEvents(){this.unbindEvents(),this.dom.addEventListener("panstart",this.panHandler),this.dom.addEventListener("panmove",this.panHandler),this.dom.addEventListener("panend",this.panHandler),this.dom.addEventListener("pinchstart",this.pinchHandler),this.dom.addEventListener("pinchmove",this.pinchHandler),this.dom.addEventListener("pinchend",this.pinchHandler),this.dom.addEventListener("singletap",this.tapHandler),this.dom.addEventListener("press",this.pressHandler),this.dom.addEventListener("hammer.input",this.hammerInputHandler),this.dom.addEventListener("contextmenu",this.contextMenuHandler),this.dom.addEventListener("wheel",this.wheelHandler,{passive:!1}),this.dom.addEventListener("mousemove",this.pointerOverHandler)}unbindEvents(){this.dom.removeEventListener("panstart",this.panHandler),this.dom.removeEventListener("panmove",this.panHandler),this.dom.removeEventListener("panend",this.panHandler),this.dom.removeEventListener("pinchstart",this.pinchHandler),this.dom.removeEventListener("pinchmove",this.pinchHandler),this.dom.removeEventListener("pinchend",this.pinchHandler),this.dom.removeEventListener("singletap",this.tapHandler),this.dom.removeEventListener("press",this.pressHandler),this.dom.removeEventListener("hammer.input",this.hammerInputHandler),this.dom.removeEventListener("contextmenu",this.contextMenuHandler),this.dom.removeEventListener("wheel",this.wheelHandler),this.dom.removeEventListener("mousemove",this.pointerOverHandler)}setFocus(t,e){this.focus.set(t,e).sub(this.domOffset).unproject(this.camera)}handleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),Vh.set(t.center.x,t.center.y).sub(this.domOffset),this.dispatchEvent({type:"tap",data:{screenCoords:{x:Vh.x,y:Vh.y}},e:t})}handleDoubleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),Vh.set(t.center.x,t.center.y).sub(this.domOffset),this.dispatchEvent({type:"doubletap",data:{screenCoords:{x:Vh.x,y:Vh.y}}})}handlePress(t){"function"==typeof t.preventDefault&&t.preventDefault()}handlePan(t){var e;if(this.scaled=this.camera.scaled.x,1!==(null==(e=t.pointers)?void 0:e.length))return;"function"==typeof t.preventDefault&&t.preventDefault();const i={type:"panmove",data:{}};(t.isFirst||"panstart"===t.type)&&(this.state=2,this.panStart.set(t.center.x,t.center.y),i.type="panstart"),(t.isFinal||"panend"===t.type)&&(this.state=-1,i.type="panend"),this.panEnd.set(t.center.x,t.center.y),this.panOffset.subVectors(this.panEnd,this.panStart).multiplyScalar(-this.camera.scaled.x,-this.camera.scaled.y*(this.camera.flipY?1:-1)).rotate(this.camera.rotation.x),this.panStart.copy(this.panEnd),Vh.set(t.center.x,t.center.y).sub(this.domOffset),i.data.screenCoords=Vh.clone(),this.dispatchEvent(i),this.enablePan&&this.update()}handlePinch(t){"function"==typeof t.preventDefault&&t.preventDefault(),"pinchstart"===t.type&&(this.dollyStart=this.camera.scaled.x,this.state=1),(t.isFinal||"pinchend"===t.type)&&(this.state=-1),this.scaled=this.dollyStart*(1/t.scale);let e=(this.scaled-this.camera.scaled.x)/this.camera.scaled.x;this.setFocus(t.center.x,t.center.y),this.dollyOffset.copy(this.camera.position).lerp(this.focus,-e).sub(this.camera.position),this.update()}handleRotate(t){"function"==typeof t.preventDefault&&t.preventDefault()}handleSwipe(t){"function"==typeof t.preventDefault&&t.preventDefault()}handleHammerInput(t){t.isFirst&&(this.state=9),t.isFinal&&(this.state=-1)}handleContextMenu(t){this.enabled&&"function"==typeof t.preventDefault&&t.preventDefault()}handleWheel(t){if("function"==typeof t.preventDefault&&t.preventDefault(),!this.enabled||!this.enableZoom||-1!==this.state)return;this.isWheeling||(this.dispatchEvent({type:"wheelstart"}),this.isWheeling=!0),"function"==typeof t.preventDefault&&t.preventDefault(),"function"==typeof t.stopPropagation&&t.stopPropagation();let e=t.deltaY;1===(null==t?void 0:t.deltaMode)?e*=16:2===(null==t?void 0:t.deltaMode)&&(e*=100),(null==t?void 0:t.ctrlKey)&&(e*=10),this.setFocus(t.clientX,t.clientY);let i=this.getZoomScale(e);e<0?this.onDollyIn(i):e>0?this.onDollyOut(i):(this.scaled=this.camera.scaled.x,this.dollyOffset.set(0,0)),this.update(),clearTimeout(this.finalTimer),this.finalTimer=setTimeout((()=>{this.isWheeling&&(this.dispatchEvent({type:"wheelend"}),this.isWheeling=!1)}),500)}onDollyIn(t){this.scaled=Math.max(this.minZoom,Math.min(this.maxZoom,this.camera.scaled.x*t)),this.dollyOffset.copy(this.camera.position).lerp(this.focus,1-t).sub(this.camera.position)}onDollyOut(t){this.scaled=Math.max(this.minZoom,Math.min(this.maxZoom,this.camera.scaled.x/t)),this.dollyOffset.copy(this.camera.position).lerp(this.focus,-1+t).sub(this.camera.position)}getZoomScale(t){return Math.pow(.95,this.zoomSpeed*Math.abs(.03*t))}handlePointerDown(t){if(this.scaled=this.camera.scaled.x,!this.enabled)return;if(2!==t.button)return;this.dom.addEventListener("pointermove",this.pointerMoveHandler),this.dom.addEventListener("pointerup",this.pointerUpHandler);let e=-1;0===t.button?e=this.mouseButtons.LEFT:1===t.button?e=this.mouseButtons.MIDDLE:2===t.button&&(e=this.mouseButtons.RIGHT),0===e&&(this.rotateStart.set(t.clientX,t.clientY),this.setFocus(this.rotateStart.x,this.rotateStart.y),this.state=0)}handlePointerUp(){this.dom.removeEventListener("pointermove",this.pointerMoveHandler),this.dom.removeEventListener("pointerup",this.pointerUpHandler),this.state=-1}handlePointerLeave(){this.state=-1}handlePointerMove(t){if(this.enabled&&0===this.state){if(!this.enableRotate)return;this.onRotate(t.clientX,t.clientY)}}handlePointerOver(t){t.buttons>0||(Vh.set(t.clientX,t.clientY).sub(this.domOffset),this.dispatchEvent({type:"pointerover",data:{screenCoords:{x:Vh.x,y:Vh.y}},e:t}))}onRotate(t,e){this.rotateEnd.set(t,e),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);const i=this.rotateDelta.x*Math.PI*2/this.dom.clientHeight;this.rotateTheta-=i,this.rotateStart.copy(this.rotateEnd),this.update()}}const Uh=new We,Vh=new We;var qh=(t=>(t.CONTEXTMENU="contextmenu",t.LOSTPOINTERCAPTURE="lostpointercapture",t.MOUSEOVER="mouseover",t.MOUSEOUT="mouseout",t.MOUSELEAVE="mouseleave",t.MOUSEENTER="mouseenter",t.MOUSEMOVE="mousemove",t.MOUSEDOWN="mousedown",t.MOUSEUP="mouseup",t.POINTERMOVE="pointermove",t.POINTERDOWN="pointerdown",t.POINTERUP="pointerup",t.POINTERCANCEL="pointercancel",t.POINTEROUT="pointerout",t.POINTERLEAVE="pointerleave",t.POINTEROVER="pointerover",t.POINTERENTER="pointerenter",t.TOUCHSTART="touchstart",t.TOUCHEND="touchend",t.TOUCHMOVE="touchmove",t.TOUCHCANCEL="touchcancel",t.WHEEL="wheel",t.WHEEL_START="wheelstart",t.WHEEL_END="wheelend",t.MOUSEWHEEL="mousewheel",t.CLICK="click",t.DBLCLICK="dblclick",t.CONTEXT_LOST="contextlost",t.CONTEXT_RESTORED="contextrestored",t.CONTROLS_CHANGED="controlschanged",t.TAP="tap",t.SINGLE_TAP="singletap",t.DOUBLE_TAP="doubletap",t.PRESS="press",t.PAN="pan",t.PAN_START="panstart",t.PAN_MOVE="panmove",t.PAN_END="panend",t.ROTATE="rotate",t.ROTATE_START="rotatestart",t.ROTATE_MOVE="rotatemove",t.ROTATE_END="rotateend",t.PINCH="pinch",t.PINCH_START="pinchstart",t.PINCH_MOVE="pinchmove",t.PINCH_END="pinchend",t.PINCH_IN="pinchin",t.PINCH_OUT="pinchout",t.SWIPE="swipe",t.CHANGE_START="change_start",t.CHANGE_END="change_end",t.CAMERA_CHANGED="cameraChanged",t))(qh||{});class jh{constructor(t){c(this,"params"),c(this,"percent"),c(this,"path"),c(this,"boundingBox",new ai),this.params=t,this.percent=null==t?void 0:t.percent}_init(t){return this.attr(t),this}attr(t,e){if(!t)return this;if("string"==typeof t)this.attrKV(t,e);else if("object"==typeof t){let e=Object.keys(t);for(let i,n=0,s=e.length;n<s;n++)i=e[n],this.attrKV(i,t[i])}return this}attrKV(t,e){return this[t]=e,this}buildPath(t,e,i){}setPoints(t){return t&&t.length?(this.points=t,this):this}computeBoundingBox(t=new ai){return this.boundingBox.makeEmpty(),this.path||(this.path=new yn),this.path.reset(),this.buildPath(this.path,this),this.path.computeBoundingBox(this.boundingBox),t.copy(this.boundingBox),t}isPointInBoundingBox(t){return!!this.boundingBox&&this.boundingBox.containsPoint(t)}isPointInPath(t){return!!this.isPointInBoundingBox(t)&&("function"==typeof Path2D?this.isPointInPathByPath2D(t):this.isPointInPathByCtx(t))}isPointInPathByCtx(t){let e=!1;return Yh.save(),this.buildPath(Yh,this),e=Yh.isPointInPath(t.x,t.y),Yh.restore(),e}isPointInPathByPath2D(t){if(!Path2D)return!1;const e=new Path2D;return this.buildPath(e,this),Yh.isPointInPath(e,t.x,t.y)}isBoxIntersectsBoundingBox(t){return!!this.boundingBox&&this.boundingBox.intersectsBox(t)}isBoxIntersectsPath(t){return!!this.isBoxIntersectsBoundingBox(t)}}const Yh=Pn.get("RAY_CASTER",10,10).getContext("2d");class Gh extends jh{constructor(t){super(t),this._init(t),this.flipY&&this.scale(1,-1)}initByPathProxy(t){var e;if(!t||!(null==(e=t.data)?void 0:e.length))throw new Error("GeoShape.initByPathProxy: path is required.");this.path=t;const i=t.data,n=[];let s=0;for(s=0;s<i.length;){switch(i[s++]){case ln:n.push([ln,i[s++],i[s++]]);break;case un:n.push([un,i[s++],i[s++]]);break;case cn:n.push([cn,i[s++],i[s++],i[s++],i[s++],i[s++],i[s++]]);break;case dn:n.push([dn,i[s++],i[s++],i[s++],i[s++]]);break;case pn:n.push([pn,i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++]]);break;case mn:n.push([mn,i[s++],i[s++],i[s++],i[s++]]);break;case gn:n.push([gn,i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++]]);break;case fn:n.push([fn])}}return this.cmds=n,this}computeBoundingBox(t=new ai){return super.computeBoundingBox(t),this.boundingBox}buildPath(t,e,i){if(0===this.percent)return;const{cmds:n}=this;for(let e=0,i=(null==n?void 0:n.length)||0;e<i;e++){const[i,...s]=n[e];switch(i){case ln:t.moveTo(...s);break;case un:t.lineTo(...s);break;case cn:t.bezierCurveTo(...s);break;case dn:t.quadraticCurveTo(...s);break;case pn:t.arc(s[0],s[1],s[2],s[3],s[4],!!s[5]);break;case fn:t.closePath();break;case mn:t.rect(...s);break;case gn:t.ellipse(s[0],s[1],s[2],s[3],s[4],s[5],s[6],!!s[7])}}}scale(t,e){this.transform($h.makeScale(t,e))}transform(t){const e=[],{cmds:i}=this;for(let n=0,s=(null==i?void 0:i.length)||0;n<s;n++){const[s,...r]=i[n];switch(s){case ln:case un:case mn:Xh.set(r[0],r[1]).applyMatrix3(t),e[n]=[s,Xh.x,Xh.y];break;case cn:Xh.set(r[0],r[1]).applyMatrix3(t),Zh.set(r[2],r[3]).applyMatrix3(t),Jh.set(r[4],r[5]).applyMatrix3(t),e[n]=[s,Xh.x,Xh.y,Zh.x,Zh.y,Jh.x,Jh.y];break;case dn:Xh.set(r[0],r[1]).applyMatrix3(t),Zh.set(r[2],r[3]).applyMatrix3(t),e[n]=[s,Xh.x,Xh.y,Zh.x,Zh.y];break;case pn:Xh.set(r[0],r[1]).applyMatrix3(t),e[n]=[s,Xh.x,Xh.y,r[2],r[3],r[4],r[5],r[6]];break;case gn:{Xh.set(r[0],r[1]).applyMatrix3(t);const[i,a,o,h,l,u,c,d]=r,p=-l,f=-u,m=-c,g=!d;e[n]=[s,Xh.x,Xh.y,o,h,p,f,m,g?1:0];break}case fn:e[n]=[s]}}this.cmds=e}}const $h=new Ui,Xh=new We,Zh=new We,Jh=new We;class Qh{static getPathProxyByNode(t){if(!t)return;return Nn.getInstance().parseNode(t)}static mergeGeoShapes(t,e){var i,n,s;if(!(null==t?void 0:t.length))throw new Error("empty geos");const r={cmds:ri.flatMap(t,(t=>t.cmds||[]))};(null==(i=t[0])?void 0:i.lineWidth)&&(r.lineWidth=t[0].lineWidth),(null==(n=t[0])?void 0:n.thinLine)&&(r.thinLine=t[0].thinLine),(null==(s=t[0])?void 0:s.closed)&&(r.closed=t[0].closed);return new Gh(r)}static getArrowByPathProxy(t,e={},i=new yn){i.dispose();const{arrowType:n=0,arrowLength:s=10,arrowDeg:r=30}=e||{};if(!t||!n)return i;const a=t.getVertices();if(!(null==a?void 0:a.length)||a.length<4)return i;if(n>0){if(el.set(a[2],a[3]),nl.set(a[0],a[1]),el.equals(nl))return i;il.subVectors(el,nl),sl.lerpVectors(nl,el,s/il.length()),rl.copy(sl).rotateAround(nl,Ie(r)),al.copy(sl).rotateAround(nl,-Ie(r))}else{const t=a.length;if(el.set(a[t-4],a[t-3]),nl.set(a[t-2],a[t-1]),el.equals(nl))return i;il.subVectors(el,nl),sl.lerpVectors(nl,el,s/il.length()),rl.copy(sl).rotateAround(nl,Ie(r)),al.copy(sl).rotateAround(nl,-Ie(r))}return sl.lerpVectors(nl,sl,.6),tl.subVectors(nl,sl),Kh.makeTranslation(tl.x,tl.y),nl.applyMatrix3(Kh),sl.applyMatrix3(Kh),rl.applyMatrix3(Kh),al.applyMatrix3(Kh),i.moveTo(sl.x,sl.y),i.lineTo(rl.x,rl.y),i.lineTo(nl.x,nl.y),i.lineTo(al.x,al.y),i.lineTo(sl.x,sl.y),i}}const Kh=new Ui,tl=new We,el=new We,il=new We,nl=new We,sl=new We,rl=new We,al=new We;class ol extends Ko{constructor(t,e){super(t,e),c(this,"type",Yo.DRAW_POLYLINE),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),c(this,"_mpId",`${this._cpsId}-m-`),c(this,"_bblId",`${this._cpsId}-bbl`),c(this,"_spId",`${this._cpsId}-scale`),c(this,"_rpId",`${this._cpsId}-rotate`),c(this,"_dpId",`${this._cpsId}-del`),c(this,"_tipsId",`${this.type}-tips`),c(this,"_cpsLimit",2),c(this,"strokeArrow",0),c(this,"arrowShape"),this._controlPoints=this.getControlPoints(),this._boundingBoxLine=this.getBoundingBoxLine(),this._tips=this.getTips()}activate(){super.activate()}deactivate(){super.deactivate()}editorStrokeWidthChanged(t){super.editorStrokeWidthChanged(t),this.updateArrowShape()}editorStrokeArrowChanged(t){this._bindedShape&&(this.strokeArrow=t,this.updateArrowShape())}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i="none",n=new Re(Ae.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),s=Ae.config.editor.strokeWidth||5,r=hl/2,a=(new yn).moveTo(-50,-50).lineTo(r,r);e=Kn({id:t,fill:i,stroke:n,strokeWidth:s,d:a.data}),t&&(e.setAttribute(`${ki}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints))}return e}getControlPoints(){const t=super.getControlPoints();this._bindedShape?Nn.getPathProxyBySvgPathD(this._bindedShape.getAttribute("d"),bl.dispose()):Nn.getPathProxyBySvgPathD(this.getShape().getAttribute("d"),bl.dispose());const e=bl.getControlPoints(),i=Ae.config.editor.strokeWidth;for(let n=0,s=e.length;n<s;n++){const s=n?this._cpFill:this._cpStroke,r=Qn({id:`${this._cpId}${n+1}`,x:0,y:0,r:i,fill:s,stroke:this._cpStroke});if(r.setAttribute(`${ki}-type`,(Yo.DRAW_POLYGON|Yo.DRAG).toString()),t.appendChild(r),!n)continue;ul.copy(e[n-1]),ll.copy(e[n]).add(ul).multiplyScalar(.5);const a=Qn({id:`${this._mpId}${n+1}`,x:0,y:0,r:i,fill:this._mpFill,stroke:this._mpStroke});a.setAttribute(`${ki}-type`,(Yo.DRAW_POLYGON|Yo.DRAG).toString()),t.appendChild(a)}return t}getArrowShape(t){if(!t)return;if(!this._bindedShape)return;const e=new Re(Ae.config.editor.stroke||Le.darkGreen).setA(1).getStyle(),i=new Re(Ae.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),n=Ae.config.editor.strokeWidth||5;if(!this.arrowShape){const i=`${this.type}-${t>0?"st":"ed"}-arrow`;this.arrowShape=Kn({id:i,fill:e})}this.arrowShape.setAttribute("fill",e),this.arrowShape.setAttribute("stroke",i),Qh.getArrowByPathProxy(bl,{arrowType:this.strokeArrow,arrowLength:3*n},wl.dispose());const s=Nn.getSvgPathDByData(wl.data);return this.arrowShape.setAttribute("d",s),this.arrowShape}beforeDragStart(t){this.splitByControlPoint(null==t?void 0:t.target,null==t?void 0:t.center)}handleDragStart(t){super.handleDragStart(t),this.updateArrowShape()}handleDragMove(t){super.handleDragMove(t),this.updateArrowShape()}handleDragEnd(t){super.handleDragEnd(t),this.updateArrowShape()}handleDoubleTap(t){var e,i;if((null==t?void 0:t.type)!==qh.DOUBLE_TAP)return;const n=this._getIntersect(this._controlPoints.children,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this.mergeByControlPoint(n,null==(i=null==t?void 0:t.data)?void 0:i.worldCoords),this.updateControlPoints(this._controlPoints),this.updateBoundingBoxLine(),this.updateOperations(),this.updateTips()}updateControlPoints(t,e){var i;if(!t)return;if(!this._bindedShape)return;if(Nn.getPathProxyBySvgPathD(null==(i=this._bindedShape)?void 0:i.getAttribute("d"),bl.dispose()),bl.getControlPoints(_l),!(null==_l?void 0:_l.length))return;const n=t.id;if(Nn.parseNodeTransform(this._bindedShape,yl).decompose(pl,fl,ml),e||(e=pl.clone()),vl.makeScale(ml.x,ml.y).premultiply(xl.makeRotation(fl.x)),t===this._controlPoints)for(let t=0,i=_l.length;t<i;t++){ul.copy(_l[t]).applyMatrix3(vl),cl.copy(_l[t?t-1:i-1]).applyMatrix3(vl),dl.copy(e).add(ul);es(ri.find(this._controlPoints.children,(e=>e.id===`${this._cpId}${t+1}`)),dl),dl.addVectors(cl,ul).multiplyScalar(.5).add(e);es(ri.find(this._controlPoints.children,(e=>e.id===`${this._mpId}${t+1}`)),dl)}else if(ri.startsWith(n,this._cpId)){dl.copy(e),es(t,dl);const i=this.getCpIdx(n),s=i?i-1:_l.length-1,r=i===_l.length-1?0:i+1;_l[i].copy(dl.copy(e).applyMatrix3(yl.invert()));const a=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i+1}`));ul.copy(_l[s]).applyMatrix3(vl),cl.copy(_l[i]).applyMatrix3(vl),dl.addVectors(ul,cl).multiplyScalar(.5).sub(cl).add(e),es(a,dl);const o=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i===_l.length-1?1:i+2}`));ul.copy(_l[i]).applyMatrix3(vl),cl.copy(_l[r]).applyMatrix3(vl),dl.addVectors(ul,cl).multiplyScalar(.5).sub(ul).add(e),es(o,dl)}else ri.startsWith(n,this._mpId)&&es(t,e);this.updateControlPointsRadius()}updateByControlPoints(t){var e;if(!this._bindedShape||!this._bindedControlPoint||!(null==(e=bl.data)?void 0:e.length))return;const i=this._bindedControlPoint.id;if(ri.startsWith(i,this._mpId))return;if(ri.startsWith(i,this._spId)||ri.startsWith(i,this._rpId))return;Nn.getBoundingBoxByNode(this._controlPoints,gl).getCenter(ul),Nn.parseNodeTransform(this._bindedShape,yl),ul.copy(t).applyMatrix3(yl.invert()),bl.getControlPoints(_l);const n=this.getCpIdx(i);_l[n].copy(ul),bl.dispose();for(let t=0,e=_l.length;t<e;t++)t?bl.lineTo(_l[t].x,_l[t].y):bl.moveTo(_l[t].x,_l[t].y);const s=Nn.getSvgPathDByData(bl.data);this._bindedShape.setAttribute("d",s)}updateArrowShape(){var t,e,i;if(!this._bindedShape||!(null==(t=bl.data)?void 0:t.length))return;this.arrowShape&&this.unmountShape(this.arrowShape),this.arrowShape=this.getArrowShape(this.strokeArrow),this.arrowShape&&this.mountShape(this.arrowShape,this._controlPoints);const n=this._bindedShape.getAttribute("transform");n?null==(e=this.arrowShape)||e.setAttribute("transform",n):null==(i=this.arrowShape)||i.removeAttribute("transform")}}const hl=100,ll=new We,ul=new We,cl=new We,dl=new We,pl=new We,fl=new We,ml=new We,gl=new ai,yl=new Ui,vl=new Ui,xl=new Ui,bl=new yn,wl=new yn,_l=[];class Sl extends Ko{constructor(t,e){super(t,e),c(this,"type",Yo.DRAW_POLYGON),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),c(this,"_mpId",`${this._cpsId}-m-`),c(this,"_bblId",`${this._cpsId}-bbl`),c(this,"_spId",`${this._cpsId}-scale`),c(this,"_rpId",`${this._cpsId}-rotate`),c(this,"_dpId",`${this._cpsId}-del`),c(this,"_tipsId",`${this.type}-tips`),c(this,"_cpsLimit",3),this._controlPoints=this.getControlPoints(),this._boundingBoxLine=this.getBoundingBoxLine(),this._tips=this.getTips()}activate(){super.activate()}deactivate(){super.deactivate()}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i=new Re(Ae.config.editor.fill||Le.green).setA(.6).getStyle(),n=new Re(Ae.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),s=Ae.config.editor.strokeWidth||5,r=El/2,a=(new yn).moveTo(-50,r).lineTo(r,r).lineTo(r,-50).lineTo(-50,-50).closePath();e=Kn({id:t,fill:i,stroke:n,strokeWidth:s,d:a.data}),t&&(e.setAttribute(`${ki}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints))}return e}getControlPoints(){const t=super.getControlPoints();this._bindedShape?Nn.getPathProxyBySvgPathD(this._bindedShape.getAttribute("d"),Nl.dispose()):Nn.getPathProxyBySvgPathD(this.getShape().getAttribute("d"),Nl.dispose());const e=Nl.getControlPoints(),i=Ae.config.editor.strokeWidth;for(let n=0,s=e.length;n<s;n++){const r=n?this._cpFill:this._cpStroke,a=Qn({id:`${this._cpId}${n+1}`,x:0,y:0,r:i,fill:r,stroke:this._cpStroke});a.setAttribute(`${ki}-type`,(Yo.DRAW_POLYGON|Yo.DRAG).toString()),t.appendChild(a),n?Al.copy(e[n-1]):Al.copy(e[s-1]),Ml.copy(e[n]).add(Al).multiplyScalar(.5);const o=Qn({id:`${this._mpId}${n+1}`,x:0,y:0,r:i,fill:this._mpFill,stroke:this._mpStroke});o.setAttribute(`${ki}-type`,(Yo.DRAW_POLYGON|Yo.DRAG).toString()),t.appendChild(o)}return t}beforeDragStart(t){this.splitByControlPoint(null==t?void 0:t.target,null==t?void 0:t.center)}handleDoubleTap(t){var e,i;if((null==t?void 0:t.type)!==qh.DOUBLE_TAP)return;const n=this._getIntersect(this._controlPoints.children,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this.mergeByControlPoint(n,null==(i=null==t?void 0:t.data)?void 0:i.worldCoords),this.updateControlPoints(this._controlPoints),this.updateBoundingBoxLine(),this.updateOperations(),this.updateTips()}updateControlPoints(t,e){var i;if(!t)return;if(!this._bindedShape)return;if(Nn.getPathProxyBySvgPathD(null==(i=this._bindedShape)?void 0:i.getAttribute("d"),Nl.dispose()),Nl.getControlPoints(Ol),!(null==Ol?void 0:Ol.length))return;const n=t.id;if(Nn.parseNodeTransform(this._bindedShape,Bl).decompose(Il,Dl,Ll),e||(e=Il.clone()),Pl.makeScale(Ll.x,Ll.y).premultiply(kl.makeRotation(Dl.x)),t===this._controlPoints)for(let t=0,i=Ol.length;t<i;t++){Al.copy(Ol[t]).applyMatrix3(Pl),Tl.copy(Ol[t?t-1:i-1]).applyMatrix3(Pl),Cl.copy(e).add(Al);es(ri.find(this._controlPoints.children,(e=>e.id===`${this._cpId}${t+1}`)),Cl),Cl.addVectors(Tl,Al).multiplyScalar(.5).add(e);es(ri.find(this._controlPoints.children,(e=>e.id===`${this._mpId}${t+1}`)),Cl)}else if(ri.startsWith(n,this._cpId)){Cl.copy(e),es(t,Cl);const i=this.getCpIdx(n),s=i?i-1:Ol.length-1,r=i===Ol.length-1?0:i+1;Ol[i].copy(Cl.copy(e).applyMatrix3(Bl.invert()));const a=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i+1}`));Al.copy(Ol[s]).applyMatrix3(Pl),Tl.copy(Ol[i]).applyMatrix3(Pl),Cl.addVectors(Al,Tl).multiplyScalar(.5).sub(Tl).add(e),es(a,Cl);const o=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i===Ol.length-1?1:i+2}`));Al.copy(Ol[i]).applyMatrix3(Pl),Tl.copy(Ol[r]).applyMatrix3(Pl),Cl.addVectors(Al,Tl).multiplyScalar(.5).sub(Al).add(e),es(o,Cl)}else ri.startsWith(n,this._mpId)&&es(t,e);this.updateControlPointsRadius()}updateByControlPoints(t){var e;if(!this._bindedShape||!this._bindedControlPoint||!(null==(e=Nl.data)?void 0:e.length))return;const i=this._bindedControlPoint.id;if(ri.startsWith(i,this._mpId))return;if(ri.startsWith(i,this._spId)||ri.startsWith(i,this._rpId))return;Nn.parseNodeTransform(this._bindedShape,Bl),Al.copy(t).applyMatrix3(Bl.invert()),Nl.getControlPoints(Ol);const n=this.getCpIdx(i);Ol[n].copy(Al),Nl.dispose();for(let t=0,e=Ol.length;t<e;t++)t?Nl.lineTo(Ol[t].x,Ol[t].y):Nl.moveTo(Ol[t].x,Ol[t].y);Nl.closePath();const s=Nn.getSvgPathDByData(Nl.data);this._bindedShape.setAttribute("d",s)}}const El=100,Ml=new We,Al=new We,Tl=new We,Cl=new We,Il=new We,Dl=new We,Ll=new We,Bl=new Ui,Pl=new Ui,kl=new Ui,Nl=new yn,Ol=[];class Rl extends Ko{constructor(t,e){super(t,e),c(this,"type",Yo.DRAW_TEXT),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),c(this,"_clId",`${this._cpsId}-cl-`),c(this,"_cpsLimit",3),c(this,"_fspl",1),this._controlPoints=this.getControlPoints()}activate(){super.activate()}deactivate(){super.deactivate()}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i=new Re(Ae.config.editor.fill||Le.green).getStyle();e=ts({id:`${this.type}-text`,textContent:"Text",fontSize:Ae.config.editor.fontSize||zl,fill:i,textAnchor:"middle",textBaseline:"middle"}),t&&(e.setAttribute(`${ki}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints))}return e}getControlPoints(){const t=is(this._cpsId),e=Kn({id:`${this._clId}1`,fill:"none",stroke:this._cpStroke,strokeWidth:1,d:[],strokeDasharray:"5"});t.appendChild(e);const i=Ae.config.editor.strokeWidth,n=this._cpFill,s=Qn({id:`${this._cpId}1`,x:0,y:0,r:i,fill:n,stroke:this._cpStroke});return s.setAttribute(`${ki}-type`,(Yo.DRAW_POLYGON|Yo.DRAG).toString()),t.appendChild(s),t}beforeDragStart(t){this.splitByControlPoint(null==t?void 0:t.target,null==t?void 0:t.center)}handleDoubleTap(t){var e,i;if((null==t?void 0:t.type)!==qh.DOUBLE_TAP)return;const n=this._getIntersect(this._controlPoints.children,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this.mergeByControlPoint(n,null==(i=null==t?void 0:t.data)?void 0:i.worldCoords)}updateControlPoints(t,e){if(!this._bindedShape)return;const i=ri.find(this._controlPoints.children,(t=>t.id===`${this._cpId}1`));if(!i)return;Nn.getBoundingBoxByNode(this._bindedShape,Vl).getSize(Wl),Vl.getCenter(Hl),Ul.copy(Hl).add(Fl.set(Wl.x/2,-Wl.y/2)),ns(i,Ul);const n=parseInt(this._bindedShape.getAttribute("font-size")||"12")/10;i.setAttribute("r",n.toString());const s=ri.find(this._controlPoints.children,(t=>t.id===`${this._clId}1`));ql.dispose().moveTo(Vl.min.x,Vl.min.y).lineTo(Vl.max.x,Vl.min.y).lineTo(Vl.max.x,Vl.max.y).lineTo(Vl.min.x,Vl.max.y).lineTo(Vl.min.x,Vl.min.y).closePath();const r=Nn.getSvgPathDByData(ql.data);s.setAttribute("d",r),this.updateControlPointsRadius()}updateByControlPoints(t){if(!this._bindedShape||!this._bindedControlPoint)return;this._bindedControlPoint.id,Nn.getBoundingBoxByNode(this._bindedShape,Vl).getCenter(Wl);const e=We.getDistance(Wl,t),i=Math.abs(Math.round(e*this._fspl));this._bindedShape.setAttribute("font-size",i.toString())}}const zl=20,Hl=new We,Wl=new We,Fl=new We,Ul=new We,Vl=new ai,ql=new yn;class jl extends Fi{constructor(t){super(),c(this,"mode",Go.DEFAULT),c(this,"view"),c(this,"scene"),c(this,"tools",new Map),c(this,"activedTools",new Map),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"doubleTapHandler",this.handleDoubleTap.bind(this)),c(this,"panStartHandler",this.handlePanStart.bind(this)),c(this,"panMoveHandler",this.handlePanMove.bind(this)),c(this,"panEndHandler",this.handlePanEnd.bind(this)),c(this,"_pointerOverHandler",this._handlePointerOver.bind(this)),c(this,"_wheelEndHandler",this.handleWheelEnd.bind(this)),this.view=t,this.register([Yo.HOVER,Yo.DRAG,Yo.DRAW_POINT,Yo.DRAW_POLYLINE,Yo.DRAW_POLYGON,Yo.DRAW_TEXT]),this.setMode(this.mode)}destroy(){this.dispose(),this.unbindEvents(),this.tools.clear()}dispose(){this.tools.forEach((t=>{t.deactivate&&t.deactivate()})),this.scene=void 0}register(t){Array.isArray(t)||(t=[t]),this.deactiveAll();for(let e,i=0,n=(null==t?void 0:t.length)||0;i<n;i++){e=t[i];let n=this.tools.get(e);if(!n){switch(e){case Yo.HOVER:n=new wh(this,this.view);break;case Yo.DRAG:n=new xh(this,this.view);break;case Yo.DRAW_POINT:n=new fh(this,this.view);break;case Yo.DRAW_POLYLINE:n=new ol(this,this.view);break;case Yo.DRAW_POLYGON:n=new Sl(this,this.view);break;case Yo.DRAW_TEXT:n=new Rl(this,this.view)}n&&this.tools.set(e,n)}}return this}setMode(t){if(t){this.mode=t,Ae.config.editorMode=Go.PICKER,this.deactiveAll();for(let e=1;e<=t;e<<=1)if(t&e){const t=e;this.tools.has(t)&&this.activateTool(t)}}}deactiveAll(t){const e=[];this.activedTools.forEach((i=>{(null==t?void 0:t.includes(i.type))||e.push(i.type)})),e.forEach((t=>{var e;null==(e=this.activedTools.get(t))||e.deactivate(),this.activedTools.delete(t)}))}activateTool(t){const e=this.tools.get(t);e&&(null==e||e.deactivate(),this.activedTools.set(e.type,e),this.scene&&e.bindScene&&e.bindScene(this.scene),e.activate())}bindScene(...t){return this.scene=t[0],this.bindEvents(),this}get(t){return this.tools.get(t)}getActiveTool(t){return this.activedTools.get(t)}fnEnableChanged(t=!1){this.activedTools.forEach((e=>{e.fnEnableChanged&&e.fnEnableChanged(t)}))}editorFillChanged(t){this.activedTools.forEach((e=>{e.editorFillChanged&&e.editorFillChanged(t)}))}editorStrokeChanged(t){this.activedTools.forEach((e=>{e.editorStrokeChanged&&e.editorStrokeChanged(t)}))}editorStrokeWidthChanged(t){this.activedTools.forEach((e=>{e.editorStrokeWidthChanged&&e.editorStrokeWidthChanged(t)}))}editorStrokeDasharrayChanged(t){this.activedTools.forEach((e=>{e.editorStrokeDasharrayChanged&&e.editorStrokeDasharrayChanged(t)}))}editorStrokeArrowChanged(t){this.activedTools.forEach((e=>{e.editorStrokeArrowChanged&&e.editorStrokeArrowChanged(t)}))}editorFontSizeChanged(t){this.activedTools.forEach((e=>{e.editorFontSizeChanged&&e.editorFontSizeChanged(t)}))}editorTextContentChanged(t){this.activedTools.forEach((e=>{e.editorTextContentChanged&&e.editorTextContentChanged(t)}))}editorDeleteCurrentShape(){this.activedTools.forEach((t=>{t.deleteCurrentShape&&t.deleteCurrentShape()}))}editorClearAllShapes(){this.activedTools.forEach((t=>{t.clearAllShapes&&t.clearAllShapes()}))}getEditorCurrentShapes(){const t=[],e=new XMLSerializer;return this.activedTools.forEach((i=>{var n;null==(n=i._locals)||n.forEach((i=>{let n=e.serializeToString(i);n=n.replace(/\s*xmlns="http:\/\/www\.w3\.org\/2000\/svg"/gi,""),n=n.replace(/\s*xmlns:xlink="[^"]*"/gi,""),n=n.replace(/\sstyle\s*=\s*(['"])(.*?)\1/g,""),t.push(n)}))})),t}editorInitShapes(t){if(!t)return;Array.isArray(t)||(t=[t]);const e=t.map((t=>{var e;return null==(e=(new DOMParser).parseFromString(t,"image/svg+xml"))?void 0:e.documentElement}));this.activedTools.forEach((t=>t.initShapes&&t.initShapes(e)))}editorUnitsChanged(t){this.activedTools.forEach((e=>{e.editorUnitsChanged&&e.editorUnitsChanged(t)}))}bindEvents(){var t,e,i,n,s,r,a,o,h,l,u,c,d,p;this.unbindEvents(),null==(e=null==(t=this.view)?void 0:t.controller)||e.addEventListener(Wh.TAP,this.tapHandler),null==(n=null==(i=this.view)?void 0:i.controller)||n.addEventListener(Wh.DOUBLE_TAP,this.doubleTapHandler),null==(r=null==(s=this.view)?void 0:s.controller)||r.addEventListener(Wh.PAN_START,this.panStartHandler),null==(o=null==(a=this.view)?void 0:a.controller)||o.addEventListener(Wh.PAN_MOVE,this.panMoveHandler),null==(l=null==(h=this.view)?void 0:h.controller)||l.addEventListener(Wh.PAN_END,this.panEndHandler),null==(c=null==(u=this.view)?void 0:u.controller)||c.addEventListener(Wh.POINTEROVER,this._pointerOverHandler),null==(p=null==(d=this.view)?void 0:d.controller)||p.addEventListener(Wh.WHEEL_END,this._wheelEndHandler)}unbindEvents(){var t,e,i,n,s,r,a,o,h,l,u,c;null==(e=null==(t=this.view)?void 0:t.controller)||e.removeEventListener(Wh.TAP,this.tapHandler),null==(n=null==(i=this.view)?void 0:i.controller)||n.removeEventListener(Wh.DOUBLE_TAP,this.doubleTapHandler),null==(r=null==(s=this.view)?void 0:s.controller)||r.removeEventListener(Wh.PAN_START,this.panStartHandler),null==(o=null==(a=this.view)?void 0:a.controller)||o.removeEventListener(Wh.PAN_MOVE,this.panMoveHandler),null==(l=null==(h=this.view)?void 0:h.controller)||l.removeEventListener(Wh.PAN_END,this.panEndHandler),null==(c=null==(u=this.view)?void 0:u.controller)||c.removeEventListener(Wh.POINTEROVER,this._pointerOverHandler)}handleTap(t){this.activedTools.forEach((e=>{e.handleTap&&e.handleTap(t)}))}handleDoubleTap(t){this.activedTools.forEach((e=>{e.handleDoubleTap&&e.handleDoubleTap(t)}))}handlePanStart(t){this.activedTools.forEach((e=>{e.handlePanStart&&e.handlePanStart(t)}))}handlePanMove(t){this.activedTools.forEach((e=>{e.handlePanMove&&e.handlePanMove(t)}))}handlePanEnd(t){this.activedTools.forEach((e=>{e.handlePanEnd&&e.handlePanEnd(t)}))}enableHover(t){var e;null==(e=this.get(Yo.HOVER))||e.enableHover(t)}_handlePointerOver(t){var e;null==(e=this.get(Yo.HOVER))||e._handlePointerOver(t)}handlePointerOver(t){this.activedTools.forEach((e=>{e.handlePointerOver&&e.handlePointerOver(t)}))}handlePointerOut(t){this.activedTools.forEach((e=>{e.handlePointerOut&&e.handlePointerOut(t)}))}handlePointerMove(t){this.activedTools.forEach((e=>{e.handlePointerMove&&e.handlePointerMove(t)}))}handleWheelEnd(t){this.activedTools.forEach((e=>{"function"==typeof e.handleWheelEnd&&e.handleWheelEnd(t)}))}drag(t,e){var i;this.mode===Go.DRAWING&&(null==(i=this.get(Yo.DRAG))||i.drag(t,e))}drop(t){var e;this.mode===Go.DRAWING&&(null==(e=this.get(Yo.DRAG))||e.drop(t))}setEnablePan(t=!1){this.view&&this.view.setEnablePan&&this.view.setEnablePan(t)}isEnablePan(){var t,e;return null==(e=null==(t=this.view)?void 0:t.controller)?void 0:e.enablePan}handleDragStart(t){this.activedTools.forEach((e=>{e.handleDragStart&&e.handleDragStart(t)}))}handleDragMove(t){this.activedTools.forEach((e=>{e.handleDragMove&&e.handleDragMove(t)}))}handleDragEnd(t){this.activedTools.forEach((e=>{e.handleDragEnd&&e.handleDragEnd(t)}))}}class Yl extends Fi{constructor(t={}){super(),c(this,"name","SvgApp"),c(this,"params"),c(this,"renderer"),c(this,"view"),c(this,"scene"),c(this,"loadingScene"),c(this,"emptyScene"),c(this,"mainScene"),c(this,"zoomToSelectEnable",!1),c(this,"zoomBox",new ai),c(this,"selectEnable",!1),c(this,"multiSelectEnable",!1),c(this,"fnEnable",!1),c(this,"requestHeader",{}),c(this,"runningHandler",this.running.bind(this)),c(this,"pointerOverHandler",this.handlePointerOver.bind(this)),c(this,"pointerLeaveHandler",this.handlePointerLeave.bind(this)),c(this,"multiSelectorSelectedHandler",this.handleMultiSelectorSelected.bind(this)),c(this,"dragEndHandler",this.handleDragEnd.bind(this)),this.params=t,this.params.zoomToSelectEnable&&(this.zoomToSelectEnable=!0),this.params.selectEnable&&(this.selectEnable=!0),this.params.multiSelectEnable&&(this.multiSelectEnable=!0),this.params.defaultFill||(this.params.defaultFill=Re.getMoreTransparent(Le.white,.3)),this.params.defaultStroke||(this.params.defaultStroke=Re.getMoreTransparent(Le.darkWhite,.8)),this.params.infoFill||(this.params.infoFill=Re.getMoreTransparent(Le.gray,.3)),this.params.infoStroke||(this.params.infoStroke=Re.getMoreTransparent(Le.darkGray,.8)),this.params.primaryFill||(this.params.primaryFill=Re.getMoreTransparent(Le.blue,.3)),this.params.primaryStroke||(this.params.primaryStroke=Re.getMoreTransparent(Le.darkBlue,.8)),this.params.successFill||(this.params.successFill=Re.getMoreTransparent(Le.green,.3)),this.params.successStroke||(this.params.successStroke=Re.getMoreTransparent(Le.darkGreen,.8)),this.params.warningFill||(this.params.warningFill=Re.getMoreTransparent(Le.yellow,.3)),this.params.warningStroke||(this.params.warningStroke=Re.getMoreTransparent(Le.darkYellow,.8)),this.params.dangerFill||(this.params.dangerFill=Re.getMoreTransparent(Le.red,.3)),this.params.dangerStroke||(this.params.dangerStroke=Re.getMoreTransparent(Le.darkRed,.8)),this.params.activeFill||(this.params.activeFill=Re.getMoreTransparent(Le.brown,.3)),this.params.activeStroke||(this.params.activeStroke=Re.getMoreTransparent(Le.darkBrown,.8)),this.renderer=new ls(t),this.view=new Ho(t),this.editor=new jl(this.view),this.trans2LoadingScene()}get isLoadingScene(){var t;return"SvgLoadingScene"===(null==(t=this.scene)?void 0:t.name)}destroy(){var t,e;this.unbindEvents(),this.unbindAssetsEvents(),super.destroy(),null==(t=this.view)||t.destroy(),null==(e=this.renderer)||e.destroy()}bindEvents(){this.unbindEvents()}unbindEvents(){}resize(){var t,e;null==(t=this.renderer)||t.resize(),null==(e=this.view)||e.resize()}isScene(t){var e;return(null==(e=this.scene)?void 0:e.uuid)===t.uuid}removeScene(t){this.scene=void 0,null==t||t.destroy()}trans2MainScene(){var t,e,i,n;null==(t=this.scene)||t.unmount(),this.scene=this.mainScene,this.scene.isMounted||this.scene.mount(),this.view.bindScene(this.scene),null==(e=this.editor)||e.setMode(Go.DEFAULT),null==(i=this.editor)||i.bindScene(this.scene),null==(n=this.loadingScene)||n.destroy()}trans2LoadingScene(){var t,e,i;null==(t=this.editor)||t.dispose(),this.loadingScene=new qs(this.params),null==(e=this.scene)||e.unmount(),this.scene=this.loadingScene,this.scene.isMounted||this.scene.mount();const n=(new ai).copy(this.loadingScene.viewBox).expandByVector(new We(1,1).multiplyScalar(150));this.view.setByBox(n,!1),null==(i=this.mainScene)||i.destroy()}trans2EmptyScene(){var t,e,i;null==(t=this.editor)||t.dispose(),this.emptyScene=new jo(this.params),null==(e=this.scene)||e.unmount(),this.scene=this.emptyScene,this.scene.isMounted||this.scene.mount();const n=(new ai).copy(this.emptyScene.viewBox).expandByVector(new We(1,1).multiplyScalar(150));this.view.setByBox(n,!1),null==(i=this.mainScene)||i.destroy()}start(){requestAnimationFrame(this.runningHandler)}running(t){this.scene&&(this.scene.update(),this.renderer.render(this.scene,this.view.camera),this.view.update(t),requestAnimationFrame(this.runningHandler))}setRequestHeader(t){return this.requestHeader=t,this}load(t,e,i=2,n){return d(this,null,(function*(){this.isLoadingScene||this.trans2LoadingScene(),yield Ti(this.params.syncDelay);const n=yield(new ks).setRequestHeader(this.requestHeader).loadAsync(t).catch((()=>{this.trans2EmptyScene()}));return this.loadByString(n,e,i)}))}loadByString(t,e,i=2){return d(this,null,(function*(){this.mainScene=new Vs(this.params);if(!this.mainScene.bind(t))return this.trans2EmptyScene(),[];this.view.setByBox(this.mainScene.viewBox);const n=this.mainScene.getLayers(i);return(null==e?void 0:e.length)||(e=ri.map(n,"label")),this.mainScene.showDefaultLayers(e,!0),this.trans2MainScene(),this.bindAssetsEvents(),n}))}recompute(t){var e;null==(e=this.scene)||e.recompute(t),this.fullscreen()}setSkeletons(t){var e;null==(e=this.scene)||e.setSkeletonLayers(t)}getLayers(t=2){var e;return null==(e=this.scene)?void 0:e.getLayers(t)}getLayerVisible(t){var e;return null==(e=this.scene)?void 0:e.getLayerVisible(t)}updateLayersVisibility(t,e=!1,i=!0){var n;null==(n=this.scene)||n.updateLayersVisibility(t,e,i)}selectByIds(t){var e;null==(e=this.scene)||e.selectByIds(t,this.multiSelectEnable)}clearSelectedByIds(t){var e;Array.isArray(t)?t.forEach((t=>{var e;return null==(e=this.scene)?void 0:e.clearSelectedById(t)})):null==(e=this.scene)||e.clearSelectedById(t)}clearSelected(){var t;null==(t=this.scene)||t.clearSelected()}getSelectedIds(){var t;return null==(t=this.scene)?void 0:t.getSelectedIds()}targetByIds(t,e=100){return d(this,null,(function*(){var i;this.scene&&(null==(i=this.scene)||i.selectByIds(t,!1),Gl.copy(this.scene.getSelectedBoundingBox()).expandByVector(new We(1,1).multiplyScalar(e)),yield Ti(100),Gl.isEmpty()||(yield this.view.setByBox(Gl)))}))}linkAssetsByTree(t){var e;null==(e=this.scene)||e.linkAssetsByTree(t)}setViewAreaLimit(t){this.renderer.viewAreaLimit=t}setAssetType(t,e){var i;null==(i=this.scene)||i.setAssetType(t,e)}getAssetIdsByType(t){var e;return null==(e=this.scene)?void 0:e.getAssetIdsByType(t)}clearFill(){var t;null==(t=this.scene)||t.clearFillOrStroke("fill")}clearFillByIds(t){var e;null==(e=this.scene)||e.clearFillOrStrokeByIds(t,"fill")}setFillByIds(t,e){var i;null==(i=this.scene)||i.setFillOrStrokeByIds(t,e,"fill")}clearStroke(){var t;null==(t=this.scene)||t.clearFillOrStroke("stroke")}clearStrokeByIds(t){var e;null==(e=this.scene)||e.clearFillOrStrokeByIds(t,"stroke")}setStrokeByIds(t,e,i){var n;null==(n=this.scene)||n.setFillOrStrokeByIds(t,e,"stroke",i)}getLegend(){var t;return null==(t=this.scene)?void 0:t.getLegend()}setAssetLabels(t,e){var i;null==(i=this.scene)||i.setAssetLabels(t,e)}clearAssetLabels(){var t;null==(t=this.scene)||t.clearAssetLabels()}fullscreen(){this.view.fullscreen()}saveCameraPosition(t){this.view.saveCameraPosition(t)}restoreCameraPosition(t){this.view.restoreCameraPosition(t)}clearCameraPosition(t){this.view.clearCameraPosition(t)}zoomIn(){this.view.zoomIn()}zoomOut(){this.view.zoomOut()}focusAt(t,e=1e3){var i;null==(i=this.view)||i.focusAt(t,e)}focusAtIds(t,e=100){return d(this,null,(function*(){if(!this.scene)return;const i=this.scene.getBoundingBoxByIds(t);i&&(i.expandByVector(new We(1,1).multiplyScalar(e)),yield Ti(100),i.isEmpty()||(yield this.view.setByBox(i)))}))}focusAtById(t,e=1e3){return d(this,null,(function*(){var i;return null==(i=this.view)?void 0:i.focusAtById(t,e)}))}focusAtDummy(t,e=1e3){return d(this,null,(function*(){var i;return null==(i=this.view)?void 0:i.focusAtDummy(t,e)}))}showAssetsLabel(t,e,i){var n,s,r,a;e?"dummy"===t?null==(r=null==(s=null==(n=this.view)?void 0:n.dummiesController)?void 0:s.dummies)||r.showDummyLabel(e):null==(a=this.view)||a.showAssetsLabel(t,e,i):this.hideAssetsLabel()}hideAssetsLabel(){var t,e,i,n;null==(i=null==(e=null==(t=this.view)?void 0:t.dummiesController)?void 0:e.dummies)||i.hideDummyLabel(),null==(n=this.view)||n.hideAssetsLabel()}highlightAssets(t,e){var i;null==(i=this.scene)||i.highlightAssets(t,e)}resetHighlightAssets(t){var e;null==(e=this.scene)||e.resetHighlightAssets(t)}fontZoomIn(){var t;null==(t=this.scene)||t.chef.fontZoom("asset-labels",1.1)}fontZoomOut(){var t;null==(t=this.scene)||t.chef.fontZoom("asset-labels",.9)}strokeMore(){var t;null==(t=this.scene)||t.chef.strokeWidthChanged(1.1)}strokeLess(){var t;null==(t=this.scene)||t.chef.strokeWidthChanged(.9)}zoomToSelectEnableChanged(t){this.view.zoomToSelectEnableChanged(t)}selectEnableChanged(t){this.selectEnable=!!t,this.view.selectEnableChanged(t)}multiSelectEnableChanged(t){this.multiSelectEnable=!!t,this.view.multiSelectEnableChanged(t)}socialDistanceEnableChanged(t){var e;null==(e=this.scene)||e.socialDistanceEnableChanged(t)}fnEnableChanged(t){var e;this.fnEnable=!!t,this.view.fnEnableChanged(t),null==(e=this.editor)||e.fnEnableChanged(t)}getBoundingBoxById(t,e=!0){var i;if(!t)return;const n=null==(i=this.scene)?void 0:i.getBoundingBoxById(t);return n&&e&&n.applyMatrix3(this.view.camera.viewMatrix).round(),n}setDummies(t){var e;null==(e=this.view)||e.setDummies(t)}clearDummies(t){var e;null==(e=this.view)||e.clearDummies(t)}highlightDummies(t){var e,i;null==(i=null==(e=this.view)?void 0:e.dummiesController)||i.highlightDummies(t)}resetHighlightDummies(){var t,e;null==(e=null==(t=this.view)?void 0:t.dummiesController)||e.resetHighlightDummies()}bindAssetsEvents(){var t,e;this.view.addEventListener(Vo.POINTEROVER,this.pointerOverHandler),this.view.addEventListener(Vo.POINTERLEAVE,this.pointerLeaveHandler),this.view.addEventListener(Vo.SELECTED,this.multiSelectorSelectedHandler),null==(e=null==(t=this.view)?void 0:t.dummiesController)||e.addEventListener("panend",this.dragEndHandler)}unbindAssetsEvents(){var t,e;this.view.removeEventListener(Vo.POINTEROVER,this.pointerOverHandler),this.view.removeEventListener(Vo.POINTERLEAVE,this.pointerLeaveHandler),this.view.removeEventListener(Vo.SELECTED,this.multiSelectorSelectedHandler),null==(e=null==(t=this.view)?void 0:t.dummiesController)||e.removeEventListener("panend",this.dragEndHandler)}handleMultiSelectorSelected(t){this.dispatchEvent({type:"SELECTED",data:t.data})}handlePointerOver(t){this.dispatchEvent({type:"pointerover",data:t.data,e:t.e})}handlePointerLeave(t){this.dispatchEvent({type:"pointerleave",data:t.data,e:t.e})}handleInitializeStart(){}handleInitializeComplete(t){return d(this,null,(function*(){(null==t?void 0:t.data)&&this.launch()}))}handleDragEnd(t){this.dispatchEvent(t)}launch(){}drag(t,e){return d(this,null,(function*(){var i;null==(i=this.editor)||i.drag(t,e)}))}setEditorMode(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setMode(t)}))}editorFillChanged(t){return d(this,null,(function*(){var e;this.params.editor.fill=t,null==(e=this.editor)||e.editorFillChanged(t)}))}editorStrokeChanged(t){return d(this,null,(function*(){var e;this.params.editor.stroke=t,null==(e=this.editor)||e.editorStrokeChanged(t)}))}editorStrokeWidthChanged(t){return d(this,null,(function*(){var e;this.params.editor.strokeWidth=t,null==(e=this.editor)||e.editorStrokeWidthChanged(t)}))}editorStrokeDasharrayChanged(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.editorStrokeDasharrayChanged(t)}))}editorStrokeArrowChanged(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.editorStrokeArrowChanged(t)}))}editorFontSizeChanged(t){return d(this,null,(function*(){var e;this.params.editor.fontSize=t,null==(e=this.editor)||e.editorFontSizeChanged(t)}))}editorTextContentChanged(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.editorTextContentChanged(t)}))}editorDeleteCurrentShape(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.editorDeleteCurrentShape()}))}editorClearAll(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.editorClearAllShapes()}))}getEditorCurrentShapes(){return d(this,null,(function*(){var t;return null==(t=this.editor)?void 0:t.getEditorCurrentShapes()}))}editorInitShapes(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.editorInitShapes(t)}))}editorUnitsChanged(t){return d(this,null,(function*(){var e;this.params.editor.units=t,null==(e=this.editor)||e.editorUnitsChanged(t)}))}}const Gl=new ai;var $l=(t=>(t.SELECTED="SELECTED",t.POINTEROVER="pointerover",t.POINTERLEAVE="pointerleave",t.DRAG_END="panend",t))($l||{});
|
|
15
15
|
/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2010-2025 Three.js Authors
|
|
18
18
|
* SPDX-License-Identifier: MIT
|
|
19
|
-
*/const Zl=1001,Jl="srgb",Ql="srgb-linear",Kl="linear",tu="srgb",eu=2e3;class iu{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){const i=this._listeners;return void 0!==i&&(void 0!==i[t]&&-1!==i[t].indexOf(e))}removeEventListener(t,e){const i=this._listeners;if(void 0===i)return;const n=i[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const i=e[t.type];if(void 0!==i){t.target=this;const e=i.slice(0);for(let i=0,n=e.length;i<n;i++)e[i].call(this,t);t.target=null}}}const nu=["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"];function su(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(nu[255&t]+nu[t>>8&255]+nu[t>>16&255]+nu[t>>24&255]+"-"+nu[255&e]+nu[e>>8&255]+"-"+nu[e>>16&15|64]+nu[e>>24&255]+"-"+nu[63&i|128]+nu[i>>8&255]+"-"+nu[i>>16&255]+nu[i>>24&255]+nu[255&n]+nu[n>>8&255]+nu[n>>16&255]+nu[n>>24&255]).toLowerCase()}function ru(t,e,i){return Math.max(e,Math.min(i,t))}function au(t,e,i){return(1-i)*t+i*e}function ou(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function hu(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}class lu{constructor(t=0,e=0){lu.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=ru(this.x,t.x,e.x),this.y=ru(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=ru(this.x,t,e),this.y=ru(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ru(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(ru(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*i-r*n+t.x,this.y=s*n+r*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class uu{constructor(t,e,i,n,s,r,a,o,h){uu.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,n,s,r,a,o,h)}set(t,e,i,n,s,r,a,o,h){const l=this.elements;return l[0]=t,l[1]=n,l[2]=a,l[3]=e,l[4]=s,l[5]=o,l[6]=i,l[7]=r,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[3],o=i[6],h=i[1],l=i[4],u=i[7],c=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],y=n[1],v=n[4],x=n[7],b=n[2],w=n[5],_=n[8];return s[0]=r*f+a*y+o*b,s[3]=r*m+a*v+o*w,s[6]=r*g+a*x+o*_,s[1]=h*f+l*y+u*b,s[4]=h*m+l*v+u*w,s[7]=h*g+l*x+u*_,s[2]=c*f+d*y+p*b,s[5]=c*m+d*v+p*w,s[8]=c*g+d*x+p*_,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8];return e*r*l-e*a*h-i*s*l+i*a*o+n*s*h-n*r*o}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=l*r-a*h,c=a*o-l*s,d=h*s-r*o,p=e*u+i*c+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(n*h-l*i)*f,t[2]=(a*i-n*r)*f,t[3]=c*f,t[4]=(l*e-n*o)*f,t[5]=(n*s-a*e)*f,t[6]=d*f,t[7]=(i*o-h*e)*f,t[8]=(r*e-i*s)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,s,r,a){const o=Math.cos(s),h=Math.sin(s);return this.set(i*o,i*h,-i*(o*r+h*a)+r+t,-n*h,n*o,-n*(-h*r+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(cu.makeScale(t,e)),this}rotate(t){return this.premultiply(cu.makeRotation(-t)),this}translate(t,e){return this.premultiply(cu.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const cu=new uu;function du(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}const pu=(new uu).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),fu=(new uu).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function mu(){const t={enabled:!0,workingColorSpace:Ql,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i?(this.spaces[e].transfer===tu&&(t.r=yu(t.r),t.g=yu(t.g),t.b=yu(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===tu&&(t.r=vu(t.r),t.g=vu(t.g),t.b=vu(t.b)),t):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?Kl:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],n=[.3127,.329];return t.define({[Ql]:{primaries:e,whitePoint:n,transfer:Kl,toXYZ:pu,fromXYZ:fu,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:Jl},outputColorSpaceConfig:{drawingBufferColorSpace:Jl}},[Jl]:{primaries:e,whitePoint:n,transfer:tu,toXYZ:pu,fromXYZ:fu,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:Jl}}}),t}const gu=mu();function yu(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function vu(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let xu;class bu{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{void 0===xu&&(xu=du("canvas")),xu.width=t.width,xu.height=t.height;const e=xu.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),i=xu}return i.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=du("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const n=i.getImageData(0,0,t.width,t.height),s=n.data;for(let t=0;t<s.length;t++)s[t]=255*yu(s[t]/255);return i.putImageData(n,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*yu(e[t]/255)):e[t]=yu(e[t]);return{data:e,width:t.width,height:t.height}}return t}}let wu=0;class _u{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:wu++}),this.uuid=su(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let t;if(Array.isArray(n)){t=[];for(let e=0,i=n.length;e<i;e++)n[e].isDataTexture?t.push(Su(n[e].image)):t.push(Su(n[e]))}else t=Su(n);i.url=t}return e||(t.images[this.uuid]=i),i}}function Su(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?bu.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:{}}let Eu=0,Mu=class t extends iu{constructor(e=t.DEFAULT_IMAGE,i=t.DEFAULT_MAPPING,n=1001,s=1001,r=1006,a=1008,o=1023,h=1009,l=t.DEFAULT_ANISOTROPY,u=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Eu++}),this.uuid=su(),this.name="",this.source=new _u(e),this.mipmaps=[],this.mapping=i,this.channel=0,this.wrapS=n,this.wrapT=s,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=h,this.offset=new lu(0,0),this.repeat=new lu(1,1),this.center=new lu(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new uu,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isTextureArray=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isTextureArray=t.isTextureArray,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,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&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case Zl:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case Zl:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}};Mu.DEFAULT_IMAGE=null,Mu.DEFAULT_MAPPING=300,Mu.DEFAULT_ANISOTROPY=1;class Au{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,s,r,a){let o=i[n+0],h=i[n+1],l=i[n+2],u=i[n+3];const c=s[r+0],d=s[r+1],p=s[r+2],f=s[r+3];if(0===a)return t[e+0]=o,t[e+1]=h,t[e+2]=l,void(t[e+3]=u);if(1===a)return t[e+0]=c,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(u!==f||o!==c||h!==d||l!==p){let t=1-a;const e=o*c+h*d+l*p+u*f,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const s=Math.sqrt(n),r=Math.atan2(s,e*i);t=Math.sin(t*r)/s,a=Math.sin(a*r)/s}const s=a*i;if(o=o*t+c*s,h=h*t+d*s,l=l*t+p*s,u=u*t+f*s,t===1-a){const t=1/Math.sqrt(o*o+h*h+l*l+u*u);o*=t,h*=t,l*=t,u*=t}}t[e]=o,t[e+1]=h,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,n,s,r){const a=i[n],o=i[n+1],h=i[n+2],l=i[n+3],u=s[r],c=s[r+1],d=s[r+2],p=s[r+3];return t[e]=a*p+l*u+o*d-h*c,t[e+1]=o*p+l*c+h*u-a*d,t[e+2]=h*p+l*d+a*c-o*u,t[e+3]=l*p-a*u-o*c-h*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,n=t._y,s=t._z,r=t._order,a=Math.cos,o=Math.sin,h=a(i/2),l=a(n/2),u=a(s/2),c=o(i/2),d=o(n/2),p=o(s/2);switch(r){case"XYZ":this._x=c*l*u+h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u-c*d*p;break;case"YXZ":this._x=c*l*u+h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u+c*d*p;break;case"ZXY":this._x=c*l*u-h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u-c*d*p;break;case"ZYX":this._x=c*l*u-h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u+c*d*p;break;case"YZX":this._x=c*l*u+h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u-c*d*p;break;case"XZY":this._x=c*l*u-h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u+c*d*p}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],s=e[8],r=e[1],a=e[5],o=e[9],h=e[2],l=e[6],u=e[10],c=i+a+u;if(c>0){const t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(l-o)*t,this._y=(s-h)*t,this._z=(r-n)*t}else if(i>a&&i>u){const t=2*Math.sqrt(1+i-a-u);this._w=(l-o)/t,this._x=.25*t,this._y=(n+r)/t,this._z=(s+h)/t}else if(a>u){const t=2*Math.sqrt(1+a-i-u);this._w=(s-h)/t,this._x=(n+r)/t,this._y=.25*t,this._z=(o+l)/t}else{const t=2*Math.sqrt(1+u-i-a);this._w=(r-n)/t,this._x=(s+h)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ru(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,s=t._z,r=t._w,a=e._x,o=e._y,h=e._z,l=e._w;return this._x=i*l+r*a+n*h-s*o,this._y=n*l+r*o+s*a-i*h,this._z=s*l+r*h+i*o-n*a,this._w=r*l-i*a-n*o-s*h,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,s=this._z,r=this._w;let a=r*t._w+i*t._x+n*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=r,this._x=i,this._y=n,this._z=s,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*r+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*s+e*this._z,this.normalize(),this}const h=Math.sqrt(o),l=Math.atan2(h,a),u=Math.sin((1-e)*l)/h,c=Math.sin(e*l)/h;return this._w=r*u+this._w*c,this._x=i*u+this._x*c,this._y=n*u+this._y*c,this._z=s*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(n*Math.sin(t),n*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}let Tu=class t{constructor(e=0,i=0,n=0){t.prototype.isVector3=!0,this.x=e,this.y=i,this.z=n}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Iu.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Iu.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*n,this.y=s[1]*e+s[4]*i+s[7]*n,this.z=s[2]*e+s[5]*i+s[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,s=t.elements,r=1/(s[3]*e+s[7]*i+s[11]*n+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*n+s[12])*r,this.y=(s[1]*e+s[5]*i+s[9]*n+s[13])*r,this.z=(s[2]*e+s[6]*i+s[10]*n+s[14])*r,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,a=t.z,o=t.w,h=2*(r*n-a*i),l=2*(a*e-s*n),u=2*(s*i-r*e);return this.x=e+o*h+r*u-a*l,this.y=i+o*l+a*h-s*u,this.z=n+o*u+s*l-r*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n,this.y=s[1]*e+s[5]*i+s[9]*n,this.z=s[2]*e+s[6]*i+s[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=ru(this.x,t.x,e.x),this.y=ru(this.y,t.y,e.y),this.z=ru(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=ru(this.x,t,e),this.y=ru(this.y,t,e),this.z=ru(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ru(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,s=t.z,r=e.x,a=e.y,o=e.z;return this.x=n*o-s*a,this.y=s*r-i*o,this.z=i*a-n*r,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Cu.copy(this).projectOnVector(t),this.sub(Cu)}reflect(t){return this.sub(Cu.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(ru(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};const Cu=new Tu,Iu=new Au;class Du{constructor(t=new Tu(1/0,1/0,1/0),e=new Tu(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Bu.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Bu.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Bu.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const n=i.getAttribute("position");if(!0===e&&void 0!==n&&!0!==t.isInstancedMesh)for(let e=0,i=n.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,Bu):Bu.fromBufferAttribute(n,e),Bu.applyMatrix4(t.matrixWorld),this.expandByPoint(Bu);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),Pu.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),Pu.copy(i.boundingBox)),Pu.applyMatrix4(t.matrixWorld),this.union(Pu)}const n=t.children;for(let t=0,i=n.length;t<i;t++)this.expandByObject(n[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Bu),Bu.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Wu),Fu.subVectors(this.max,Wu),ku.subVectors(t.a,Wu),Nu.subVectors(t.b,Wu),Ou.subVectors(t.c,Wu),Ru.subVectors(Nu,ku),zu.subVectors(Ou,Nu),Hu.subVectors(ku,Ou);let e=[0,-Ru.z,Ru.y,0,-zu.z,zu.y,0,-Hu.z,Hu.y,Ru.z,0,-Ru.x,zu.z,0,-zu.x,Hu.z,0,-Hu.x,-Ru.y,Ru.x,0,-zu.y,zu.x,0,-Hu.y,Hu.x,0];return!!qu(e,ku,Nu,Ou,Fu)&&(e=[1,0,0,0,1,0,0,0,1],!!qu(e,ku,Nu,Ou,Fu)&&(Uu.crossVectors(Ru,zu),e=[Uu.x,Uu.y,Uu.z],qu(e,ku,Nu,Ou,Fu)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Bu).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Bu).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Lu[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Lu[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Lu[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Lu[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Lu[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Lu[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Lu[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Lu[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Lu)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Lu=[new Tu,new Tu,new Tu,new Tu,new Tu,new Tu,new Tu,new Tu],Bu=new Tu,Pu=new Du,ku=new Tu,Nu=new Tu,Ou=new Tu,Ru=new Tu,zu=new Tu,Hu=new Tu,Wu=new Tu,Fu=new Tu,Uu=new Tu,Vu=new Tu;function qu(t,e,i,n,s){for(let r=0,a=t.length-3;r<=a;r+=3){Vu.fromArray(t,r);const a=s.x*Math.abs(Vu.x)+s.y*Math.abs(Vu.y)+s.z*Math.abs(Vu.z),o=e.dot(Vu),h=i.dot(Vu),l=n.dot(Vu);if(Math.max(-Math.max(o,h,l),Math.min(o,h,l))>a)return!1}return!0}const ju=new Du,Yu=new Tu,Gu=new Tu;class $u{constructor(t=new Tu,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):ju.setFromPoints(t).getCenter(i);let n=0;for(let e=0,s=t.length;e<s;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Yu.subVectors(t,this.center);const e=Yu.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(Yu,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Gu.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Yu.copy(t.center).add(Gu)),this.expandByPoint(Yu.copy(t.center).sub(Gu))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}let Xu=class t{constructor(e,i,n,s,r,a,o,h,l,u,c,d,p,f,m,g){t.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,i,n,s,r,a,o,h,l,u,c,d,p,f,m,g)}set(t,e,i,n,s,r,a,o,h,l,u,c,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=s,g[5]=r,g[9]=a,g[13]=o,g[2]=h,g[6]=l,g[10]=u,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,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 t).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/Zu.setFromMatrixColumn(t,0).length(),s=1/Zu.setFromMatrixColumn(t,1).length(),r=1/Zu.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*s,e[5]=i[5]*s,e[6]=i[6]*s,e[7]=0,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,n=t.y,s=t.z,r=Math.cos(i),a=Math.sin(i),o=Math.cos(n),h=Math.sin(n),l=Math.cos(s),u=Math.sin(s);if("XYZ"===t.order){const t=r*l,i=r*u,n=a*l,s=a*u;e[0]=o*l,e[4]=-o*u,e[8]=h,e[1]=i+n*h,e[5]=t-s*h,e[9]=-a*o,e[2]=s-t*h,e[6]=n+i*h,e[10]=r*o}else if("YXZ"===t.order){const t=o*l,i=o*u,n=h*l,s=h*u;e[0]=t+s*a,e[4]=n*a-i,e[8]=r*h,e[1]=r*u,e[5]=r*l,e[9]=-a,e[2]=i*a-n,e[6]=s+t*a,e[10]=r*o}else if("ZXY"===t.order){const t=o*l,i=o*u,n=h*l,s=h*u;e[0]=t-s*a,e[4]=-r*u,e[8]=n+i*a,e[1]=i+n*a,e[5]=r*l,e[9]=s-t*a,e[2]=-r*h,e[6]=a,e[10]=r*o}else if("ZYX"===t.order){const t=r*l,i=r*u,n=a*l,s=a*u;e[0]=o*l,e[4]=n*h-i,e[8]=t*h+s,e[1]=o*u,e[5]=s*h+t,e[9]=i*h-n,e[2]=-h,e[6]=a*o,e[10]=r*o}else if("YZX"===t.order){const t=r*o,i=r*h,n=a*o,s=a*h;e[0]=o*l,e[4]=s-t*u,e[8]=n*u+i,e[1]=u,e[5]=r*l,e[9]=-a*l,e[2]=-h*l,e[6]=i*u+n,e[10]=t-s*u}else if("XZY"===t.order){const t=r*o,i=r*h,n=a*o,s=a*h;e[0]=o*l,e[4]=-u,e[8]=h*l,e[1]=t*u+s,e[5]=r*l,e[9]=i*u-n,e[2]=n*u-i,e[6]=a*l,e[10]=s*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Qu,t,Ku)}lookAt(t,e,i){const n=this.elements;return ic.subVectors(t,e),0===ic.lengthSq()&&(ic.z=1),ic.normalize(),tc.crossVectors(i,ic),0===tc.lengthSq()&&(1===Math.abs(i.z)?ic.x+=1e-4:ic.z+=1e-4,ic.normalize(),tc.crossVectors(i,ic)),tc.normalize(),ec.crossVectors(ic,tc),n[0]=tc.x,n[4]=ec.x,n[8]=ic.x,n[1]=tc.y,n[5]=ec.y,n[9]=ic.y,n[2]=tc.z,n[6]=ec.z,n[10]=ic.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[4],o=i[8],h=i[12],l=i[1],u=i[5],c=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],y=i[3],v=i[7],x=i[11],b=i[15],w=n[0],_=n[4],S=n[8],E=n[12],M=n[1],A=n[5],T=n[9],C=n[13],I=n[2],D=n[6],L=n[10],B=n[14],P=n[3],k=n[7],N=n[11],O=n[15];return s[0]=r*w+a*M+o*I+h*P,s[4]=r*_+a*A+o*D+h*k,s[8]=r*S+a*T+o*L+h*N,s[12]=r*E+a*C+o*B+h*O,s[1]=l*w+u*M+c*I+d*P,s[5]=l*_+u*A+c*D+d*k,s[9]=l*S+u*T+c*L+d*N,s[13]=l*E+u*C+c*B+d*O,s[2]=p*w+f*M+m*I+g*P,s[6]=p*_+f*A+m*D+g*k,s[10]=p*S+f*T+m*L+g*N,s[14]=p*E+f*C+m*B+g*O,s[3]=y*w+v*M+x*I+b*P,s[7]=y*_+v*A+x*D+b*k,s[11]=y*S+v*T+x*L+b*N,s[15]=y*E+v*C+x*B+b*O,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],s=t[12],r=t[1],a=t[5],o=t[9],h=t[13],l=t[2],u=t[6],c=t[10],d=t[14];return t[3]*(+s*o*u-n*h*u-s*a*c+i*h*c+n*a*d-i*o*d)+t[7]*(+e*o*d-e*h*c+s*r*c-n*r*d+n*h*l-s*o*l)+t[11]*(+e*h*u-e*a*d-s*r*u+i*r*d+s*a*l-i*h*l)+t[15]*(-n*a*l-e*o*u+e*a*c+n*r*u-i*r*c+i*o*l)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],y=u*m*h-f*c*h+f*o*d-a*m*d-u*o*g+a*c*g,v=p*c*h-l*m*h-p*o*d+r*m*d+l*o*g-r*c*g,x=l*f*h-p*u*h+p*a*d-r*f*d-l*a*g+r*u*g,b=p*u*o-l*f*o-p*a*c+r*f*c+l*a*m-r*u*m,w=e*y+i*v+n*x+s*b;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/w;return t[0]=y*_,t[1]=(f*c*s-u*m*s-f*n*d+i*m*d+u*n*g-i*c*g)*_,t[2]=(a*m*s-f*o*s+f*n*h-i*m*h-a*n*g+i*o*g)*_,t[3]=(u*o*s-a*c*s-u*n*h+i*c*h+a*n*d-i*o*d)*_,t[4]=v*_,t[5]=(l*m*s-p*c*s+p*n*d-e*m*d-l*n*g+e*c*g)*_,t[6]=(p*o*s-r*m*s-p*n*h+e*m*h+r*n*g-e*o*g)*_,t[7]=(r*c*s-l*o*s+l*n*h-e*c*h-r*n*d+e*o*d)*_,t[8]=x*_,t[9]=(p*u*s-l*f*s-p*i*d+e*f*d+l*i*g-e*u*g)*_,t[10]=(r*f*s-p*a*s+p*i*h-e*f*h-r*i*g+e*a*g)*_,t[11]=(l*a*s-r*u*s-l*i*h+e*u*h+r*i*d-e*a*d)*_,t[12]=b*_,t[13]=(l*f*n-p*u*n+p*i*c-e*f*c-l*i*m+e*u*m)*_,t[14]=(p*a*n-r*f*n-p*i*o+e*f*o+r*i*m-e*a*m)*_,t[15]=(r*u*n-l*a*n+l*i*o-e*u*o-r*i*c+e*a*c)*_,this}scale(t){const e=this.elements,i=t.x,n=t.y,s=t.z;return e[0]*=i,e[4]*=n,e[8]*=s,e[1]*=i,e[5]*=n,e[9]*=s,e[2]*=i,e[6]*=n,e[10]*=s,e[3]*=i,e[7]*=n,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),s=1-i,r=t.x,a=t.y,o=t.z,h=s*r,l=s*a;return this.set(h*r+i,h*a-n*o,h*o+n*a,0,h*a+n*o,l*a+i,l*o-n*r,0,h*o-n*a,l*o+n*r,s*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,s,r){return this.set(1,i,s,0,t,1,r,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,s=e._x,r=e._y,a=e._z,o=e._w,h=s+s,l=r+r,u=a+a,c=s*h,d=s*l,p=s*u,f=r*l,m=r*u,g=a*u,y=o*h,v=o*l,x=o*u,b=i.x,w=i.y,_=i.z;return n[0]=(1-(f+g))*b,n[1]=(d+x)*b,n[2]=(p-v)*b,n[3]=0,n[4]=(d-x)*w,n[5]=(1-(c+g))*w,n[6]=(m+y)*w,n[7]=0,n[8]=(p+v)*_,n[9]=(m-y)*_,n[10]=(1-(c+f))*_,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let s=Zu.set(n[0],n[1],n[2]).length();const r=Zu.set(n[4],n[5],n[6]).length(),a=Zu.set(n[8],n[9],n[10]).length();this.determinant()<0&&(s=-s),t.x=n[12],t.y=n[13],t.z=n[14],Ju.copy(this);const o=1/s,h=1/r,l=1/a;return Ju.elements[0]*=o,Ju.elements[1]*=o,Ju.elements[2]*=o,Ju.elements[4]*=h,Ju.elements[5]*=h,Ju.elements[6]*=h,Ju.elements[8]*=l,Ju.elements[9]*=l,Ju.elements[10]*=l,e.setFromRotationMatrix(Ju),i.x=s,i.y=r,i.z=a,this}makePerspective(t,e,i,n,s,r,a=2e3){const o=this.elements,h=2*s/(e-t),l=2*s/(i-n),u=(e+t)/(e-t),c=(i+n)/(i-n);let d,p;if(a===eu)d=-(r+s)/(r-s),p=-2*r*s/(r-s);else{if(2001!==a)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-r/(r-s),p=-r*s/(r-s)}return o[0]=h,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,i,n,s,r,a=2e3){const o=this.elements,h=1/(e-t),l=1/(i-n),u=1/(r-s),c=(e+t)*h,d=(i+n)*l;let p,f;if(a===eu)p=(r+s)*u,f=-2*u;else{if(2001!==a)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=s*u,f=-1*u}return o[0]=2*h,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=f,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}};const Zu=new Tu,Ju=new Xu,Qu=new Tu(0,0,0),Ku=new Tu(1,1,1),tc=new Tu,ec=new Tu,ic=new Tu,nc=new Xu,sc=new Au;class rc{constructor(t=0,e=0,i=0,n=rc.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,s=n[0],r=n[4],a=n[8],o=n[1],h=n[5],l=n[9],u=n[2],c=n[6],d=n[10];switch(e){case"XYZ":this._y=Math.asin(ru(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(c,h),this._z=0);break;case"YXZ":this._x=Math.asin(-ru(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,h)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(ru(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-r,h)):(this._y=0,this._z=Math.atan2(o,s));break;case"ZYX":this._y=Math.asin(-ru(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(c,d),this._z=Math.atan2(o,s)):(this._x=0,this._z=Math.atan2(-r,h));break;case"YZX":this._z=Math.asin(ru(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-ru(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(c,h),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-l,d),this._y=0)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return nc.makeRotationFromQuaternion(t),this.setFromRotationMatrix(nc,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return sc.setFromEuler(this),this.setFromQuaternion(sc,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}rc.DEFAULT_ORDER="XYZ";class ac{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return!!(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let oc=0;const hc=new Tu,lc=new Au,uc=new Xu,cc=new Tu,dc=new Tu,pc=new Tu,fc=new Au,mc=new Tu(1,0,0),gc=new Tu(0,1,0),yc=new Tu(0,0,1),vc={type:"added"},xc={type:"removed"},bc={type:"childadded",child:null},wc={type:"childremoved",child:null};class _c extends iu{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:oc++}),this.uuid=su(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=_c.DEFAULT_UP.clone();const t=new Tu,e=new rc,i=new Au,n=new Tu(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Xu},normalMatrix:{value:new uu}}),this.matrix=new Xu,this.matrixWorld=new Xu,this.matrixAutoUpdate=_c.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=_c.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ac,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(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return lc.setFromAxisAngle(t,e),this.quaternion.multiply(lc),this}rotateOnWorldAxis(t,e){return lc.setFromAxisAngle(t,e),this.quaternion.premultiply(lc),this}rotateX(t){return this.rotateOnAxis(mc,t)}rotateY(t){return this.rotateOnAxis(gc,t)}rotateZ(t){return this.rotateOnAxis(yc,t)}translateOnAxis(t,e){return hc.copy(t).applyQuaternion(this.quaternion),this.position.add(hc.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(mc,t)}translateY(t){return this.translateOnAxis(gc,t)}translateZ(t){return this.translateOnAxis(yc,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(uc.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?cc.copy(t):cc.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),dc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?uc.lookAt(dc,cc,this.up):uc.lookAt(cc,dc,this.up),this.quaternion.setFromRotationMatrix(uc),n&&(uc.extractRotation(n.matrixWorld),lc.setFromRotationMatrix(uc),this.quaternion.premultiply(lc.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this||t&&t.isObject3D&&(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(vc),bc.child=t,this.dispatchEvent(bc),bc.child=null),this}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(xc),wc.child=t,this.dispatchEvent(wc),wc.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),uc.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),uc.multiply(t.parent.matrixWorld)),t.applyMatrix4(uc),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(vc),bc.child=t,this.dispatchEvent(bc),bc.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(dc,t,pc),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(dc,fc,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++){e[i].updateMatrixWorld(t)}}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++){t[e].updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const n={};function s(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.geometryInfo=this._geometryInfo.map((t=>u(l({},t),{boundingBox:t.boundingBox?{min:t.boundingBox.min.toArray(),max:t.boundingBox.max.toArray()}:void 0,boundingSphere:t.boundingSphere?{radius:t.boundingSphere.radius,center:t.boundingSphere.center.toArray()}:void 0}))),n.instanceInfo=this._instanceInfo.map((t=>l({},t))),n.availableInstanceIds=this._availableInstanceIds.slice(),n.availableGeometryIds=this._availableGeometryIds.slice(),n.nextIndexStart=this._nextIndexStart,n.nextVertexStart=this._nextVertexStart,n.geometryCount=this._geometryCount,n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.matricesTexture=this._matricesTexture.toJSON(t),n.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(n.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(n.boundingSphere={center:this.boundingSphere.center.toArray(),radius:this.boundingSphere.radius}),null!==this.boundingBox&&(n.boundingBox={min:this.boundingBox.min.toArray(),max:this.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=s(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];s(t.shapes,n)}else s(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(s(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(s(t.materials,this.material[i]));n.material=e}else n.material=s(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(s(t.animations,i))}}if(e){const e=r(t.geometries),n=r(t.materials),s=r(t.textures),a=r(t.images),o=r(t.shapes),h=r(t.skeletons),l=r(t.animations),u=r(t.nodes);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),s.length>0&&(i.textures=s),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),h.length>0&&(i.skeletons=h),l.length>0&&(i.animations=l),u.length>0&&(i.nodes=u)}return i.object=n,i;function r(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}_c.DEFAULT_UP=new Tu(0,1,0),_c.DEFAULT_MATRIX_AUTO_UPDATE=!0,_c.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Sc={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},Ec={h:0,s:0,l:0},Mc={h:0,s:0,l:0};function Ac(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class Tc{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Jl){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,gu.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n=gu.workingColorSpace){return this.r=t,this.g=e,this.b=i,gu.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n=gu.workingColorSpace){var s;if(t=(t%(s=1)+s)%s,e=ru(e,0,1),i=ru(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,s=2*i-n;this.r=Ac(s,n,t+1/3),this.g=Ac(s,n,t),this.b=Ac(s,n,t-1/3)}return gu.toWorkingColorSpace(this,n),this}setStyle(t,e=Jl){function i(t){void 0!==t&&parseFloat(t)}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(t)){let t;const s=n[1],r=n[2];switch(s){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return i(t[4]),this.setRGB(Math.min(255,parseInt(t[1],10))/255,Math.min(255,parseInt(t[2],10))/255,Math.min(255,parseInt(t[3],10))/255,e);if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return i(t[4]),this.setRGB(Math.min(100,parseInt(t[1],10))/100,Math.min(100,parseInt(t[2],10))/100,Math.min(100,parseInt(t[3],10))/100,e);break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return i(t[4]),this.setHSL(parseFloat(t[1])/360,parseFloat(t[2])/100,parseFloat(t[3])/100,e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],i=t.length;if(3===i)return this.setRGB(parseInt(t.charAt(0),16)/15,parseInt(t.charAt(1),16)/15,parseInt(t.charAt(2),16)/15,e);if(6===i)return this.setHex(parseInt(t,16),e)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Jl){const i=Sc[t.toLowerCase()];return void 0!==i&&this.setHex(i,e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=yu(t.r),this.g=yu(t.g),this.b=yu(t.b),this}copyLinearToSRGB(t){return this.r=vu(t.r),this.g=vu(t.g),this.b=vu(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Jl){return gu.fromWorkingColorSpace(Cc.copy(this),t),65536*Math.round(ru(255*Cc.r,0,255))+256*Math.round(ru(255*Cc.g,0,255))+Math.round(ru(255*Cc.b,0,255))}getHexString(t=Jl){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=gu.workingColorSpace){gu.fromWorkingColorSpace(Cc.copy(this),e);const i=Cc.r,n=Cc.g,s=Cc.b,r=Math.max(i,n,s),a=Math.min(i,n,s);let o,h;const l=(a+r)/2;if(a===r)o=0,h=0;else{const t=r-a;switch(h=l<=.5?t/(r+a):t/(2-r-a),r){case i:o=(n-s)/t+(n<s?6:0);break;case n:o=(s-i)/t+2;break;case s:o=(i-n)/t+4}o/=6}return t.h=o,t.s=h,t.l=l,t}getRGB(t,e=gu.workingColorSpace){return gu.fromWorkingColorSpace(Cc.copy(this),e),t.r=Cc.r,t.g=Cc.g,t.b=Cc.b,t}getStyle(t=Jl){gu.fromWorkingColorSpace(Cc.copy(this),t);const e=Cc.r,i=Cc.g,n=Cc.b;return t!==Jl?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(t,e,i){return this.getHSL(Ec),this.setHSL(Ec.h+t,Ec.s+e,Ec.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Ec),t.getHSL(Mc);const i=au(Ec.h,Mc.h,e),n=au(Ec.s,Mc.s,e),s=au(Ec.l,Mc.l,e);return this.setHSL(i,n,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,n=this.b,s=t.elements;return this.r=s[0]*e+s[3]*i+s[6]*n,this.g=s[1]*e+s[4]*i+s[7]*n,this.b=s[2]*e+s[5]*i+s[8]*n,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Cc=new Tc;Tc.NAMES=Sc;const Ic=new Tu,Dc=new lu;let Lc=0;class Bc{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Lc++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,s=this.itemSize;n<s;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Dc.fromBufferAttribute(this,e),Dc.applyMatrix3(t),this.setXY(e,Dc.x,Dc.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Ic.fromBufferAttribute(this,e),Ic.applyMatrix3(t),this.setXYZ(e,Ic.x,Ic.y,Ic.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Ic.fromBufferAttribute(this,e),Ic.applyMatrix4(t),this.setXYZ(e,Ic.x,Ic.y,Ic.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Ic.fromBufferAttribute(this,e),Ic.applyNormalMatrix(t),this.setXYZ(e,Ic.x,Ic.y,Ic.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Ic.fromBufferAttribute(this,e),Ic.transformDirection(t),this.setXYZ(e,Ic.x,Ic.y,Ic.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=ou(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=hu(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=ou(e,this.array)),e}setX(t,e){return this.normalized&&(e=hu(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=ou(e,this.array)),e}setY(t,e){return this.normalized&&(e=hu(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=ou(e,this.array)),e}setZ(t,e){return this.normalized&&(e=hu(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=ou(e,this.array)),e}setW(t,e){return this.normalized&&(e=hu(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=hu(e,this.array),i=hu(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=hu(e,this.array),i=hu(i,this.array),n=hu(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,s){return t*=this.itemSize,this.normalized&&(e=hu(e,this.array),i=hu(i,this.array),n=hu(n,this.array),s=hu(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),t}}class Pc extends Bc{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class kc extends Bc{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class Nc extends Bc{constructor(t,e,i){super(new Float32Array(t),e,i)}}let Oc=0;const Rc=new Xu,zc=new _c,Hc=new Tu,Wc=new Du,Fc=new Du,Uc=new Tu;class Vc extends iu{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Oc++}),this.uuid=su(),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(t){return Array.isArray(t)?this.index=new(function(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}(t)?kc:Pc)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new uu).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Rc.makeRotationFromQuaternion(t),this.applyMatrix4(Rc),this}rotateX(t){return Rc.makeRotationX(t),this.applyMatrix4(Rc),this}rotateY(t){return Rc.makeRotationY(t),this.applyMatrix4(Rc),this}rotateZ(t){return Rc.makeRotationZ(t),this.applyMatrix4(Rc),this}translate(t,e,i){return Rc.makeTranslation(t,e,i),this.applyMatrix4(Rc),this}scale(t,e,i){return Rc.makeScale(t,e,i),this.applyMatrix4(Rc),this}lookAt(t){return zc.lookAt(t),zc.updateMatrix(),this.applyMatrix4(zc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Hc).negate(),this.translate(Hc.x,Hc.y,Hc.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}this.setAttribute("position",new Nc(e,3))}else{const i=Math.min(t.length,e.count);for(let n=0;n<i;n++){const i=t[n];e.setXYZ(n,i.x,i.y,i.z||0)}t.length,e.count,e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Du);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingBox.set(new Tu(-1/0,-1/0,-1/0),new Tu(1/0,1/0,1/0));else{if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Wc.setFromBufferAttribute(i),this.morphTargetsRelative?(Uc.addVectors(this.boundingBox.min,Wc.min),this.boundingBox.expandByPoint(Uc),Uc.addVectors(this.boundingBox.max,Wc.max),this.boundingBox.expandByPoint(Uc)):(this.boundingBox.expandByPoint(Wc.min),this.boundingBox.expandByPoint(Wc.max))}}else this.boundingBox.makeEmpty();isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new $u);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingSphere.set(new Tu,1/0);else if(t){const i=this.boundingSphere.center;if(Wc.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Fc.setFromBufferAttribute(i),this.morphTargetsRelative?(Uc.addVectors(Wc.min,Fc.min),Wc.expandByPoint(Uc),Uc.addVectors(Wc.max,Fc.max),Wc.expandByPoint(Uc)):(Wc.expandByPoint(Fc.min),Wc.expandByPoint(Fc.max))}Wc.getCenter(i);let n=0;for(let e=0,s=t.count;e<s;e++)Uc.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(Uc));if(e)for(let s=0,r=e.length;s<r;s++){const r=e[s],a=this.morphTargetsRelative;for(let e=0,s=r.count;e<s;e++)Uc.fromBufferAttribute(r,e),a&&(Hc.fromBufferAttribute(t,e),Uc.add(Hc)),n=Math.max(n,i.distanceToSquared(Uc))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return;const i=e.position,n=e.normal,s=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Bc(new Float32Array(4*i.count),4));const r=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<i.count;t++)a[t]=new Tu,o[t]=new Tu;const h=new Tu,l=new Tu,u=new Tu,c=new lu,d=new lu,p=new lu,f=new Tu,m=new Tu;function g(t,e,n){h.fromBufferAttribute(i,t),l.fromBufferAttribute(i,e),u.fromBufferAttribute(i,n),c.fromBufferAttribute(s,t),d.fromBufferAttribute(s,e),p.fromBufferAttribute(s,n),l.sub(h),u.sub(h),d.sub(c),p.sub(c);const r=1/(d.x*p.y-p.x*d.y);isFinite(r)&&(f.copy(l).multiplyScalar(p.y).addScaledVector(u,-d.y).multiplyScalar(r),m.copy(u).multiplyScalar(d.x).addScaledVector(l,-p.x).multiplyScalar(r),a[t].add(f),a[e].add(f),a[n].add(f),o[t].add(m),o[e].add(m),o[n].add(m))}let y=this.groups;0===y.length&&(y=[{start:0,count:t.count}]);for(let e=0,i=y.length;e<i;++e){const i=y[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)g(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const v=new Tu,x=new Tu,b=new Tu,w=new Tu;function _(t){b.fromBufferAttribute(n,t),w.copy(b);const e=a[t];v.copy(e),v.sub(b.multiplyScalar(b.dot(e))).normalize(),x.crossVectors(w,e);const i=x.dot(o[t])<0?-1:1;r.setXYZW(t,v.x,v.y,v.z,i)}for(let e=0,i=y.length;e<i;++e){const i=y[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)_(t.getX(e+0)),_(t.getX(e+1)),_(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new Bc(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new Tu,s=new Tu,r=new Tu,a=new Tu,o=new Tu,h=new Tu,l=new Tu,u=new Tu;if(t)for(let c=0,d=t.count;c<d;c+=3){const d=t.getX(c+0),p=t.getX(c+1),f=t.getX(c+2);n.fromBufferAttribute(e,d),s.fromBufferAttribute(e,p),r.fromBufferAttribute(e,f),l.subVectors(r,s),u.subVectors(n,s),l.cross(u),a.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),h.fromBufferAttribute(i,f),a.add(l),o.add(l),h.add(l),i.setXYZ(d,a.x,a.y,a.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(f,h.x,h.y,h.z)}else for(let t=0,a=e.count;t<a;t+=3)n.fromBufferAttribute(e,t+0),s.fromBufferAttribute(e,t+1),r.fromBufferAttribute(e,t+2),l.subVectors(r,s),u.subVectors(n,s),l.cross(u),i.setXYZ(t+0,l.x,l.y,l.z),i.setXYZ(t+1,l.x,l.y,l.z),i.setXYZ(t+2,l.x,l.y,l.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Uc.fromBufferAttribute(t,e),Uc.normalize(),t.setXYZ(e,Uc.x,Uc.y,Uc.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,s=t.normalized,r=new i.constructor(e.length*n);let a=0,o=0;for(let s=0,h=e.length;s<h;s++){a=t.isInterleavedBufferAttribute?e[s]*t.data.stride+t.offset:e[s]*n;for(let t=0;t<n;t++)r[o++]=i[a++]}return new Bc(r,n,s)}if(null===this.index)return this;const e=new Vc,i=this.index.array,n=this.attributes;for(const s in n){const r=t(n[s],i);e.setAttribute(s,r)}const s=this.morphAttributes;for(const n in s){const r=[],a=s[n];for(let e=0,n=a.length;e<n;e++){const n=t(a[e],i);r.push(n)}e.morphAttributes[n]=r}e.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let t=0,i=r.length;t<i;t++){const i=r[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let s=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],r=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];r.push(n.toJSON(t.data))}r.length>0&&(n[e]=r,s=!0)}s&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(t.data.groups=JSON.parse(JSON.stringify(r)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone());const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const s=t.morphAttributes;for(const t in s){const i=[],n=s[t];for(let t=0,s=n.length;t<s;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const r=t.groups;for(let t=0,e=r.length;t<e;t++){const e=r[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class qc{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),s=0;e.push(0);for(let r=1;r<=t;r++)i=this.getPoint(r/t),s+=i.distanceTo(n),e.push(s),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){const i=this.getLengths();let n=0;const s=i.length;let r;r=e||t*i[s-1];let a,o=0,h=s-1;for(;o<=h;)if(n=Math.floor(o+(h-o)/2),a=i[n]-r,a<0)o=n+1;else{if(!(a>0)){h=n;break}h=n-1}if(n=h,i[n]===r)return n/(s-1);const l=i[n];return(n+(r-l)/(i[n+1]-l))/(s-1)}getTangent(t,e){const i=1e-4;let n=t-i,s=t+i;n<0&&(n=0),s>1&&(s=1);const r=this.getPoint(n),a=this.getPoint(s),o=e||(r.isVector2?new lu:new Tu);return o.copy(a).sub(r).normalize(),o}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){const i=new Tu,n=[],s=[],r=[],a=new Tu,o=new Xu;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new Tu)}s[0]=new Tu,r[0]=new Tu;let h=Number.MAX_VALUE;const l=Math.abs(n[0].x),u=Math.abs(n[0].y),c=Math.abs(n[0].z);l<=h&&(h=l,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),c<=h&&i.set(0,0,1),a.crossVectors(n[0],i).normalize(),s[0].crossVectors(n[0],a),r[0].crossVectors(n[0],s[0]);for(let e=1;e<=t;e++){if(s[e]=s[e-1].clone(),r[e]=r[e-1].clone(),a.crossVectors(n[e-1],n[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(ru(n[e-1].dot(n[e]),-1,1));s[e].applyMatrix4(o.makeRotationAxis(a,t))}r[e].crossVectors(n[e],s[e])}if(!0===e){let e=Math.acos(ru(s[0].dot(s[t]),-1,1));e/=t,n[0].dot(a.crossVectors(s[0],s[t]))>0&&(e=-e);for(let i=1;i<=t;i++)s[i].applyMatrix4(o.makeRotationAxis(n[i],e*i)),r[i].crossVectors(n[i],s[i])}return{tangents:n,normals:s,binormals:r}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class jc extends qc{constructor(t=0,e=0,i=1,n=1,s=0,r=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=s,this.aEndAngle=r,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new lu){const i=e,n=2*Math.PI;let s=this.aEndAngle-this.aStartAngle;const r=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=n;for(;s>n;)s-=n;s<Number.EPSILON&&(s=r?0:n),!0!==this.aClockwise||r||(s===n?s=-n:s-=n);const a=this.aStartAngle+t*s;let o=this.aX+this.xRadius*Math.cos(a),h=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=o-this.aX,n=h-this.aY;o=i*t-n*e+this.aX,h=i*e+n*t+this.aY}return i.set(o,h)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}function Yc(){let t=0,e=0,i=0,n=0;function s(s,r,a,o){t=s,e=a,i=-3*s+3*r-2*a-o,n=2*s-2*r+a+o}return{initCatmullRom:function(t,e,i,n,r){s(e,i,r*(i-t),r*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,r,a,o){let h=(e-t)/r-(i-t)/(r+a)+(i-e)/a,l=(i-e)/a-(n-e)/(a+o)+(n-i)/o;h*=a,l*=a,s(e,i,h,l)},calc:function(s){const r=s*s;return t+e*s+i*r+n*(r*s)}}}const Gc=new Tu,$c=new Yc,Xc=new Yc,Zc=new Yc;function Jc(t,e,i,n,s){const r=.5*(n-e),a=.5*(s-i),o=t*t;return(2*i-2*n+r+a)*(t*o)+(-3*i+3*n-2*r-a)*o+r*t+i}function Qc(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function Kc(t,e,i,n,s){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,s)}class td extends qc{constructor(t=new lu,e=new lu,i=new lu,n=new lu){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new lu){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(Kc(t,n.x,s.x,r.x,a.x),Kc(t,n.y,s.y,r.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class ed extends qc{constructor(t=new lu,e=new lu){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new lu){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new lu){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class id extends qc{constructor(t=new lu,e=new lu,i=new lu){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new lu){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(Qc(t,n.x,s.x,r.x),Qc(t,n.y,s.y,r.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class nd extends qc{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new lu){const i=e,n=this.points,s=(n.length-1)*t,r=Math.floor(s),a=s-r,o=n[0===r?r:r-1],h=n[r],l=n[r>n.length-2?n.length-1:r+1],u=n[r>n.length-3?n.length-1:r+2];return i.set(Jc(a,o.x,h.x,l.x,u.x),Jc(a,o.y,h.y,l.y,u.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new lu).fromArray(i))}return this}}var sd=Object.freeze({__proto__:null,ArcCurve:class extends jc{constructor(t,e,i,n,s,r){super(t,e,i,i,n,s,r),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends qc{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new Tu){const i=e,n=this.points,s=n.length,r=(s-(this.closed?0:1))*t;let a,o,h=Math.floor(r),l=r-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/s)+1)*s:0===l&&h===s-1&&(h=s-2,l=1),this.closed||h>0?a=n[(h-1)%s]:(Gc.subVectors(n[0],n[1]).add(n[0]),a=Gc);const u=n[h%s],c=n[(h+1)%s];if(this.closed||h+2<s?o=n[(h+2)%s]:(Gc.subVectors(n[s-1],n[s-2]).add(n[s-1]),o=Gc),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(c),t),n=Math.pow(c.distanceToSquared(o),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),$c.initNonuniformCatmullRom(a.x,u.x,c.x,o.x,e,i,n),Xc.initNonuniformCatmullRom(a.y,u.y,c.y,o.y,e,i,n),Zc.initNonuniformCatmullRom(a.z,u.z,c.z,o.z,e,i,n)}else"catmullrom"===this.curveType&&($c.initCatmullRom(a.x,u.x,c.x,o.x,this.tension),Xc.initCatmullRom(a.y,u.y,c.y,o.y,this.tension),Zc.initCatmullRom(a.z,u.z,c.z,o.z,this.tension));return i.set($c.calc(l),Xc.calc(l),Zc.calc(l)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new Tu).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},CubicBezierCurve:td,CubicBezierCurve3:class extends qc{constructor(t=new Tu,e=new Tu,i=new Tu,n=new Tu){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new Tu){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(Kc(t,n.x,s.x,r.x,a.x),Kc(t,n.y,s.y,r.y,a.y),Kc(t,n.z,s.z,r.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},EllipseCurve:jc,LineCurve:ed,LineCurve3:class extends qc{constructor(t=new Tu,e=new Tu){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new Tu){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Tu){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:id,QuadraticBezierCurve3:class extends qc{constructor(t=new Tu,e=new Tu,i=new Tu){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Tu){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(Qc(t,n.x,s.x,r.x),Qc(t,n.y,s.y,r.y),Qc(t,n.z,s.z,r.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},SplineCurve:nd});class rd extends qc{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const i=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new sd[i](e,t))}return this}getPoint(t,e){const i=t*this.getLength(),n=this.getCurveLengths();let s=0;for(;s<n.length;){if(n[s]>=i){const t=n[s]-i,r=this.curves[s],a=r.getLength(),o=0===a?0:1-t/a;return r.getPointAt(o,e)}s++}return null}getLength(){const t=this.getCurveLengths();return t[t.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 t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let n=0,s=this.curves;n<s.length;n++){const r=s[n],a=r.isEllipseCurve?2*t:r.isLineCurve||r.isLineCurve3?1:r.isSplineCurve?t*r.points.length:t,o=r.getPoints(a);for(let t=0;t<o.length;t++){const n=o[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new sd[i.type]).fromJSON(i))}return this}}class ad extends rd{constructor(t){super(),this.type="Path",this.currentPoint=new lu,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new ed(this.currentPoint.clone(),new lu(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const s=new id(this.currentPoint.clone(),new lu(t,e),new lu(i,n));return this.curves.push(s),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,s,r){const a=new td(this.currentPoint.clone(),new lu(t,e),new lu(i,n),new lu(s,r));return this.curves.push(a),this.currentPoint.set(s,r),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new nd(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,s,r){const a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,i,n,s,r),this}absarc(t,e,i,n,s,r){return this.absellipse(t,e,i,i,n,s,r),this}ellipse(t,e,i,n,s,r,a,o){const h=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+h,e+l,i,n,s,r,a,o),this}absellipse(t,e,i,n,s,r,a,o){const h=new jc(t,e,i,n,s,r,a,o);if(this.curves.length>0){const t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);const l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}let od=class extends ad{constructor(t){super(t),this.uuid=su(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new ad).fromJSON(i))}return this}};function hd(t,e,i=2){const n=e&&e.length,s=n?e[0]*i:t.length;let r=ld(t,0,s,i,!0);const a=[];if(!r||r.next===r.prev)return a;let o,h,l;if(n&&(r=function(t,e,i,n){const s=[];for(let i=0,r=e.length;i<r;i++){const a=ld(t,e[i]*n,i<r-1?e[i+1]*n:t.length,n,!1);a===a.next&&(a.steiner=!0),s.push(bd(a))}s.sort(gd);for(let t=0;t<s.length;t++)i=yd(s[t],i);return i}(t,e,r,i)),t.length>80*i){o=1/0,h=1/0;let e=-1/0,n=-1/0;for(let r=i;r<s;r+=i){const i=t[r],s=t[r+1];i<o&&(o=i),s<h&&(h=s),i>e&&(e=i),s>n&&(n=s)}l=Math.max(e-o,n-h),l=0!==l?32767/l:0}return cd(r,a,i,o,h,l,0),a}function ld(t,e,i,n,s){let r;if(s===function(t,e,i,n){let s=0;for(let r=e,a=i-n;r<i;r+=n)s+=(t[a]-t[r])*(t[r+1]+t[a+1]),a=r;return s}(t,e,i,n)>0)for(let s=e;s<i;s+=n)r=Ld(s/n|0,t[s],t[s+1],r);else for(let s=i-n;s>=e;s-=n)r=Ld(s/n|0,t[s],t[s+1],r);return r&&Md(r,r.next)&&(Bd(r),r=r.next),r}function ud(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!Md(n,n.next)&&0!==Ed(n.prev,n,n.next))n=n.next;else{if(Bd(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function cd(t,e,i,n,s,r,a){if(!t)return;!a&&r&&function(t,e,i,n){let s=t;do{0===s.z&&(s.z=xd(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){let e,i=1;do{let n,s=t;t=null;let r=null;for(e=0;s;){e++;let a=s,o=0;for(let t=0;t<i&&(o++,a=a.nextZ,a);t++);let h=i;for(;o>0||h>0&&a;)0!==o&&(0===h||!a||s.z<=a.z)?(n=s,s=s.nextZ,o--):(n=a,a=a.nextZ,h--),r?r.nextZ=n:t=n,n.prevZ=r,r=n;s=a}r.nextZ=null,i*=2}while(e>1)}(s)}(t,n,s,r);let o=t;for(;t.prev!==t.next;){const h=t.prev,l=t.next;if(r?pd(t,n,s,r):dd(t))e.push(h.i,t.i,l.i),Bd(t),t=l.next,o=l.next;else if((t=l)===o){a?1===a?cd(t=fd(ud(t),e),e,i,n,s,r,2):2===a&&md(t,e,i,n,s,r):cd(ud(t),e,i,n,s,r,1);break}}}function dd(t){const e=t.prev,i=t,n=t.next;if(Ed(e,i,n)>=0)return!1;const s=e.x,r=i.x,a=n.x,o=e.y,h=i.y,l=n.y,u=Math.min(s,r,a),c=Math.min(o,h,l),d=Math.max(s,r,a),p=Math.max(o,h,l);let f=n.next;for(;f!==e;){if(f.x>=u&&f.x<=d&&f.y>=c&&f.y<=p&&_d(s,o,r,h,a,l,f.x,f.y)&&Ed(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function pd(t,e,i,n){const s=t.prev,r=t,a=t.next;if(Ed(s,r,a)>=0)return!1;const o=s.x,h=r.x,l=a.x,u=s.y,c=r.y,d=a.y,p=Math.min(o,h,l),f=Math.min(u,c,d),m=Math.max(o,h,l),g=Math.max(u,c,d),y=xd(p,f,e,i,n),v=xd(m,g,e,i,n);let x=t.prevZ,b=t.nextZ;for(;x&&x.z>=y&&b&&b.z<=v;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==s&&x!==a&&_d(o,u,h,c,l,d,x.x,x.y)&&Ed(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==s&&b!==a&&_d(o,u,h,c,l,d,b.x,b.y)&&Ed(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;x&&x.z>=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==s&&x!==a&&_d(o,u,h,c,l,d,x.x,x.y)&&Ed(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==s&&b!==a&&_d(o,u,h,c,l,d,b.x,b.y)&&Ed(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function fd(t,e){let i=t;do{const n=i.prev,s=i.next.next;!Md(n,s)&&Ad(n,i,i.next,s)&&Id(n,s)&&Id(s,n)&&(e.push(n.i,i.i,s.i),Bd(i),Bd(i.next),i=t=s),i=i.next}while(i!==t);return ud(i)}function md(t,e,i,n,s,r){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Sd(a,t)){let o=Dd(a,t);return a=ud(a,a.next),o=ud(o,o.next),cd(a,e,i,n,s,r,0),void cd(o,e,i,n,s,r,0)}t=t.next}a=a.next}while(a!==t)}function gd(t,e){let i=t.x-e.x;if(0===i&&(i=t.y-e.y,0===i)){i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return i}function yd(t,e){const i=function(t,e){let i=e;const n=t.x,s=t.y;let r,a=-1/0;if(Md(t,i))return i;do{if(Md(t,i.next))return i.next;if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){const t=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>a&&(a=t,r=i.x<i.next.x?i:i.next,t===n))return r}i=i.next}while(i!==e);if(!r)return null;const o=r,h=r.x,l=r.y;let u=1/0;i=r;do{if(n>=i.x&&i.x>=h&&n!==i.x&&wd(s<l?n:a,s,h,l,s<l?a:n,s,i.x,i.y)){const e=Math.abs(s-i.y)/(n-i.x);Id(i,t)&&(e<u||e===u&&(i.x>r.x||i.x===r.x&&vd(r,i)))&&(r=i,u=e)}i=i.next}while(i!==o);return r}(t,e);if(!i)return e;const n=Dd(i,t);return ud(n,n.next),ud(i,i.next)}function vd(t,e){return Ed(t.prev,t,e.prev)<0&&Ed(e.next,t,t.next)<0}function xd(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*s|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function bd(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function wd(t,e,i,n,s,r,a,o){return(s-a)*(e-o)>=(t-a)*(r-o)&&(t-a)*(n-o)>=(i-a)*(e-o)&&(i-a)*(r-o)>=(s-a)*(n-o)}function _d(t,e,i,n,s,r,a,o){return!(t===a&&e===o)&&wd(t,e,i,n,s,r,a,o)}function Sd(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Ad(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Id(t,e)&&Id(e,t)&&function(t,e){let i=t,n=!1;const s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(Ed(t.prev,t,e.prev)||Ed(t,e.prev,e))||Md(t,e)&&Ed(t.prev,t,t.next)>0&&Ed(e.prev,e,e.next)>0)}function Ed(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Md(t,e){return t.x===e.x&&t.y===e.y}function Ad(t,e,i,n){const s=Cd(Ed(t,e,i)),r=Cd(Ed(t,e,n)),a=Cd(Ed(i,n,t)),o=Cd(Ed(i,n,e));return s!==r&&a!==o||(!(0!==s||!Td(t,i,e))||(!(0!==r||!Td(t,n,e))||(!(0!==a||!Td(i,t,n))||!(0!==o||!Td(i,e,n)))))}function Td(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Cd(t){return t>0?1:t<0?-1:0}function Id(t,e){return Ed(t.prev,t,t.next)<0?Ed(t,e,t.next)>=0&&Ed(t,t.prev,e)>=0:Ed(t,e,t.prev)<0||Ed(t,t.next,e)<0}function Dd(t,e){const i=Pd(t.i,t.x,t.y),n=Pd(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function Ld(t,e,i,n){const s=Pd(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Bd(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Pd(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class kd{static triangulate(t,e,i=2){return hd(t,e,i)}}class Nd{static area(t){const e=t.length;let i=0;for(let n=e-1,s=0;s<e;n=s++)i+=t[n].x*t[s].y-t[s].x*t[n].y;return.5*i}static isClockWise(t){return Nd.area(t)<0}static triangulateShape(t,e){const i=[],n=[],s=[];Od(t),Rd(i,t);let r=t.length;e.forEach(Od);for(let t=0;t<e.length;t++)n.push(r),r+=e[t].length,Rd(i,e[t]);const a=kd.triangulate(i,n);for(let t=0;t<a.length;t+=3)s.push(a.slice(t,t+3));return s}}function Od(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Rd(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}const zd={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Hd{constructor(t,e,i){const n=this;let s,r=!1,a=0,o=0;const h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===r&&void 0!==n.onStart&&n.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return h.push(t,e),this},this.removeHandler=function(t){const e=h.indexOf(t);return-1!==e&&h.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=h.length;e<i;e+=2){const i=h[e],n=h[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}}const Wd=new Hd;class Fd{constructor(t){this.manager=void 0!==t?t:Wd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise((function(n,s){i.load(t,n,e,s)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}Fd.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ud={};class Vd extends Error{constructor(t,e){super(t),this.response=e}}class qd extends Fd{constructor(t){super(t),this.mimeType="",this.responseType=""}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const s=zd.get(t);if(void 0!==s)return this.manager.itemStart(t),setTimeout((()=>{e&&e(s),this.manager.itemEnd(t)}),0),s;if(void 0!==Ud[t])return void Ud[t].push({onLoad:e,onProgress:i,onError:n});Ud[t]=[],Ud[t].push({onLoad:e,onProgress:i,onError:n});const r=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(r).then((e=>{if(200===e.status||0===e.status){if(e.status,"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=Ud[t],n=e.body.getReader(),s=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),r=s?parseInt(s):0,a=0!==r;let o=0;const h=new ReadableStream({start(t){!function e(){n.read().then((({done:n,value:s})=>{if(n)t.close();else{o+=s.byteLength;const n=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:r});for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onProgress&&e.onProgress(n)}t.enqueue(s),e()}}),(e=>{t.error(e)}))}()}});return new Response(h)}throw new Vd(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(""===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),i=e&&e[1]?e[1].toLowerCase():void 0,n=new TextDecoder(i);return t.arrayBuffer().then((t=>n.decode(t)))}}})).then((e=>{zd.add(t,e);const i=Ud[t];delete Ud[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onLoad&&n.onLoad(e)}})).catch((e=>{const i=Ud[t];if(void 0===i)throw this.manager.itemError(t),e;delete Ud[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}const jd=new lu;class Yd{constructor(t=new lu(1/0,1/0),e=new lu(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=jd.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,jd).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}class Gd{constructor(){this.type="ShapePath",this.color=new Tc,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new ad,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.currentPath.bezierCurveTo(t,e,i,n,s,r),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const i=e.length;let n=!1;for(let s=i-1,r=0;r<i;s=r++){let i=e[s],a=e[r],o=a.x-i.x,h=a.y-i.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(i=e[r],o=-o,a=e[s],h=-h),t.y<i.y||t.y>a.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=h*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return n}const i=Nd.isClockWise,n=this.subPaths;if(0===n.length)return[];let s,r,a;const o=[];if(1===n.length)return r=n[0],a=new od,a.curves=r.curves,o.push(a),o;let h=!i(n[0].getPoints());h=t?!h:h;const l=[],u=[];let c,d,p=[],f=0;u[f]=void 0,p[f]=[];for(let e=0,a=n.length;e<a;e++)r=n[e],c=r.getPoints(),s=i(c),s=t?!s:s,s?(!h&&u[f]&&f++,u[f]={s:new od,p:c},u[f].s.curves=r.curves,h&&f++,p[f]=[]):p[f].push({h:r,p:c[0]});if(!u[0])return function(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i],s=new od;s.curves=n.curves,e.push(s)}return e}(n);if(u.length>1){let t=!1,i=0;for(let t=0,e=u.length;t<e;t++)l[t]=[];for(let n=0,s=u.length;n<s;n++){const s=p[n];for(let r=0;r<s.length;r++){const a=s[r];let o=!0;for(let s=0;s<u.length;s++)e(a.p,u[s].p)&&(n!==s&&i++,o?(o=!1,l[s].push(a)):t=!0);o&&l[n].push(a)}}i>0&&!1===t&&(p=l)}for(let t=0,e=u.length;t<e;t++){a=u[t].s,o.push(a),d=p[t];for(let t=0,e=d.length;t<e;t++)a.holes.push(d[t].h)}return o}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"176"}})),"undefined"!=typeof window&&(window.__THREE__||(window.__THREE__="176"));const $d=Jl;class Xd extends Fd{constructor(t){super(t),this.defaultDPI=90,this.defaultUnit="px"}load(t,e,i,n){const s=this,r=new qd(s.manager);r.setPath(s.path),r.setRequestHeader(s.requestHeader),r.setWithCredentials(s.withCredentials),r.load(t,(function(i){try{e(s.parse(i))}catch(e){n&&n(e),s.manager.itemError(t)}}),i,n)}parse(t){const e=this;function i(t,e,i,s,r,a,o,h){if(0==e||0==i)return void t.lineTo(h.x,h.y);s=s*Math.PI/180,e=Math.abs(e),i=Math.abs(i);const l=(o.x-h.x)/2,u=(o.y-h.y)/2,c=Math.cos(s)*l+Math.sin(s)*u,d=-Math.sin(s)*l+Math.cos(s)*u;let p=e*e,f=i*i;const m=c*c,g=d*d,y=m/p+g/f;if(y>1){const t=Math.sqrt(y);p=(e*=t)*e,f=(i*=t)*i}const v=p*g+f*m,x=(p*f-v)/v;let b=Math.sqrt(Math.max(0,x));r===a&&(b=-b);const w=b*e*d/i,_=-b*i*c/e,S=Math.cos(s)*w-Math.sin(s)*_+(o.x+h.x)/2,E=Math.sin(s)*w+Math.cos(s)*_+(o.y+h.y)/2,M=n(1,0,(c-w)/e,(d-_)/i),A=n((c-w)/e,(d-_)/i,(-c-w)/e,(-d-_)/i)%(2*Math.PI);t.currentPath.absellipse(S,E,e,i,M,M+A,0===a,s)}function n(t,e,i,n){const s=t*i+e*n,r=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+n*n);let a=Math.acos(Math.max(-1,Math.min(1,s/r)));return t*n-e*i<0&&(a=-a),a}function s(t,e){e=Object.assign({},e);let i={};if(t.hasAttribute("class")){const e=t.getAttribute("class").split(/\s/).filter(Boolean).map((t=>t.trim()));for(let t=0;t<e.length;t++)i=Object.assign(i,m["."+e[t]])}function n(n,s,r){void 0===r&&(r=function(t){return t.startsWith("url"),t}),t.hasAttribute(n)&&(e[s]=r(t.getAttribute(n))),i[n]&&(e[s]=r(i[n])),t.style&&""!==t.style[n]&&(e[s]=r(t.style[n]))}function s(t){return Math.max(0,Math.min(1,l(t)))}function r(t){return Math.max(0,l(t))}return t.hasAttribute("id")&&(i=Object.assign(i,m["#"+t.getAttribute("id")])),n("fill","fill"),n("fill-opacity","fillOpacity",s),n("fill-rule","fillRule"),n("opacity","opacity",s),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",s),n("stroke-width","strokeWidth",r),n("stroke-linejoin","strokeLineJoin"),n("stroke-linecap","strokeLineCap"),n("stroke-miterlimit","strokeMiterLimit",r),n("visibility","visibility"),e}function r(t,e){return t-(e-t)}function a(t,e,i){if("string"!=typeof t)throw new TypeError("Invalid input: "+typeof t);const n={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let s=0,r=!0,a="",o="";const h=[];function l(t,e,i){const n=new SyntaxError('Unexpected character "'+t+'" at index '+e+".");throw n.partial=i,n}function u(){""!==a&&(""===o?h.push(Number(a)):h.push(Number(a)*Math.pow(10,Number(o)))),a="",o=""}let c;const d=t.length;for(let p=0;p<d;p++)if(c=t[p],Array.isArray(e)&&e.includes(h.length%i)&&n.FLAGS.test(c))s=1,a=c,u();else{if(0===s){if(n.WHITESPACE.test(c))continue;if(n.DIGIT.test(c)||n.SIGN.test(c)){s=1,a=c;continue}if(n.POINT.test(c)){s=2,a=c;continue}n.COMMA.test(c)&&(r&&l(c,p,h),r=!0)}if(1===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.POINT.test(c)){a+=c,s=2;continue}if(n.EXP.test(c)){s=3;continue}n.SIGN.test(c)&&1===a.length&&n.SIGN.test(a[0])&&l(c,p,h)}if(2===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.EXP.test(c)){s=3;continue}n.POINT.test(c)&&"."===a[a.length-1]&&l(c,p,h)}if(3===s){if(n.DIGIT.test(c)){o+=c;continue}if(n.SIGN.test(c)){if(""===o){o+=c;continue}1===o.length&&n.SIGN.test(o)&&l(c,p,h)}}n.WHITESPACE.test(c)?(u(),s=0,r=!1):n.COMMA.test(c)?(u(),s=0,r=!0):n.SIGN.test(c)?(u(),s=1,a=c):n.POINT.test(c)?(u(),s=2,a=c):l(c,p,h)}return u(),h}const o=["mm","cm","in","pt","pc","px"],h={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function l(t){let i,n="px";if("string"==typeof t||t instanceof String)for(let e=0,i=o.length;e<i;e++){const i=o[e];if(t.endsWith(i)){n=i,t=t.substring(0,t.length-i.length);break}}return"px"===n&&"px"!==e.defaultUnit?i=h.in[e.defaultUnit]/e.defaultDPI:(i=h[n][e.defaultUnit],i<0&&(i=h[n].in*e.defaultDPI)),i*parseFloat(t)}function u(t){const e=t.elements;return e[0]*e[4]-e[1]*e[3]<0}function c(t){const e=t.elements,i=e[0]*e[3]+e[1]*e[4];if(0===i)return!1;const n=d(t),s=p(t);return Math.abs(i/(n*s))>Number.EPSILON}function d(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function p(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}const f=[],m={},g=[],y=new uu,v=new uu,x=new uu,b=new uu,w=new lu,_=new Tu,S=new uu,E=(new DOMParser).parseFromString(t,"image/svg+xml");!function t(e,n){if(1!==e.nodeType)return;const o=function(t){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))))return null;const e=function(t){const e=new uu,i=y;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){const i=l(t.getAttribute("x")),n=l(t.getAttribute("y"));e.translate(i,n)}if(t.hasAttribute("transform")){const n=t.getAttribute("transform").split(")");for(let t=n.length-1;t>=0;t--){const s=n[t].trim();if(""===s)continue;const r=s.indexOf("("),o=s.length;if(r>0&&r<o){const t=s.slice(0,r),e=a(s.slice(r+1));switch(i.identity(),t){case"translate":if(e.length>=1){const t=e[0];let n=0;e.length>=2&&(n=e[1]),i.translate(t,n)}break;case"rotate":if(e.length>=1){let t=0,n=0,s=0;t=e[0]*Math.PI/180,e.length>=3&&(n=e[1],s=e[2]),v.makeTranslation(-n,-s),x.makeRotation(t),b.multiplyMatrices(x,v),v.makeTranslation(n,s),i.multiplyMatrices(v,b)}break;case"scale":if(e.length>=1){const t=e[0];let n=t;e.length>=2&&(n=e[1]),i.scale(t,n)}break;case"skewX":1===e.length&&i.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&i.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&i.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}e.premultiply(i)}}return e}(t);g.length>0&&e.premultiply(g[g.length-1]);return S.copy(e),g.push(e),e}(e);let h=!1,E=null;switch(e.nodeName){case"svg":case"g":n=s(e,n);break;case"style":!function(t){if(!t.sheet||!t.sheet.cssRules||!t.sheet.cssRules.length)return;for(let e=0;e<t.sheet.cssRules.length;e++){const i=t.sheet.cssRules[e];if(1!==i.type)continue;const n=i.selectorText.split(/,/gm).filter(Boolean).map((t=>t.trim()));for(let t=0;t<n.length;t++){const e=Object.fromEntries(Object.entries(i.style).filter((([,t])=>""!==t)));m[n[t]]=Object.assign(m[n[t]]||{},e)}}}(e);break;case"path":n=s(e,n),e.hasAttribute("d")&&(E=function(t){const e=new Gd,n=new lu,s=new lu,o=new lu;let h=!0,l=!1;const u=t.getAttribute("d");if(""===u||"none"===u)return null;const c=u.match(/[a-df-z][^a-df-z]*/gi);for(let t=0,u=c.length;t<u;t++){const u=c[t],d=u.charAt(0),p=u.slice(1).trim();let f;switch(!0===h&&(l=!0,h=!1),d){case"M":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x=f[t+0],n.y=f[t+1],s.x=n.x,s.y=n.y,0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y),0===t&&o.copy(n);break;case"H":f=a(p);for(let t=0,i=f.length;t<i;t++)n.x=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"V":f=a(p);for(let t=0,i=f.length;t<i;t++)n.y=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"L":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x=f[t+0],n.y=f[t+1],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"C":f=a(p);for(let t=0,i=f.length;t<i;t+=6)e.bezierCurveTo(f[t+0],f[t+1],f[t+2],f[t+3],f[t+4],f[t+5]),s.x=f[t+2],s.y=f[t+3],n.x=f[t+4],n.y=f[t+5],0===t&&!0===l&&o.copy(n);break;case"S":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.bezierCurveTo(r(n.x,s.x),r(n.y,s.y),f[t+0],f[t+1],f[t+2],f[t+3]),s.x=f[t+0],s.y=f[t+1],n.x=f[t+2],n.y=f[t+3],0===t&&!0===l&&o.copy(n);break;case"Q":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.quadraticCurveTo(f[t+0],f[t+1],f[t+2],f[t+3]),s.x=f[t+0],s.y=f[t+1],n.x=f[t+2],n.y=f[t+3],0===t&&!0===l&&o.copy(n);break;case"T":f=a(p);for(let t=0,i=f.length;t<i;t+=2){const i=r(n.x,s.x),a=r(n.y,s.y);e.quadraticCurveTo(i,a,f[t+0],f[t+1]),s.x=i,s.y=a,n.x=f[t+0],n.y=f[t+1],0===t&&!0===l&&o.copy(n)}break;case"A":f=a(p,[3,4],7);for(let t=0,r=f.length;t<r;t+=7){if(f[t+5]==n.x&&f[t+6]==n.y)continue;const r=n.clone();n.x=f[t+5],n.y=f[t+6],s.x=n.x,s.y=n.y,i(e,f[t],f[t+1],f[t+2],f[t+3],f[t+4],r,n),0===t&&!0===l&&o.copy(n)}break;case"m":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x+=f[t+0],n.y+=f[t+1],s.x=n.x,s.y=n.y,0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y),0===t&&o.copy(n);break;case"h":f=a(p);for(let t=0,i=f.length;t<i;t++)n.x+=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"v":f=a(p);for(let t=0,i=f.length;t<i;t++)n.y+=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"l":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x+=f[t+0],n.y+=f[t+1],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"c":f=a(p);for(let t=0,i=f.length;t<i;t+=6)e.bezierCurveTo(n.x+f[t+0],n.y+f[t+1],n.x+f[t+2],n.y+f[t+3],n.x+f[t+4],n.y+f[t+5]),s.x=n.x+f[t+2],s.y=n.y+f[t+3],n.x+=f[t+4],n.y+=f[t+5],0===t&&!0===l&&o.copy(n);break;case"s":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.bezierCurveTo(r(n.x,s.x),r(n.y,s.y),n.x+f[t+0],n.y+f[t+1],n.x+f[t+2],n.y+f[t+3]),s.x=n.x+f[t+0],s.y=n.y+f[t+1],n.x+=f[t+2],n.y+=f[t+3],0===t&&!0===l&&o.copy(n);break;case"q":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.quadraticCurveTo(n.x+f[t+0],n.y+f[t+1],n.x+f[t+2],n.y+f[t+3]),s.x=n.x+f[t+0],s.y=n.y+f[t+1],n.x+=f[t+2],n.y+=f[t+3],0===t&&!0===l&&o.copy(n);break;case"t":f=a(p);for(let t=0,i=f.length;t<i;t+=2){const i=r(n.x,s.x),a=r(n.y,s.y);e.quadraticCurveTo(i,a,n.x+f[t+0],n.y+f[t+1]),s.x=i,s.y=a,n.x=n.x+f[t+0],n.y=n.y+f[t+1],0===t&&!0===l&&o.copy(n)}break;case"a":f=a(p,[3,4],7);for(let t=0,r=f.length;t<r;t+=7){if(0==f[t+5]&&0==f[t+6])continue;const r=n.clone();n.x+=f[t+5],n.y+=f[t+6],s.x=n.x,s.y=n.y,i(e,f[t],f[t+1],f[t+2],f[t+3],f[t+4],r,n),0===t&&!0===l&&o.copy(n)}break;case"Z":case"z":e.currentPath.autoClose=!0,e.currentPath.curves.length>0&&(n.copy(o),e.currentPath.currentPoint.copy(n),h=!0)}l=!1}return e}(e));break;case"rect":n=s(e,n),E=function(t){const e=l(t.getAttribute("x")||0),i=l(t.getAttribute("y")||0),n=l(t.getAttribute("rx")||t.getAttribute("ry")||0),s=l(t.getAttribute("ry")||t.getAttribute("rx")||0),r=l(t.getAttribute("width")),a=l(t.getAttribute("height")),o=.448084975506,h=new Gd;h.moveTo(e+n,i),h.lineTo(e+r-n,i),(0!==n||0!==s)&&h.bezierCurveTo(e+r-n*o,i,e+r,i+s*o,e+r,i+s);h.lineTo(e+r,i+a-s),(0!==n||0!==s)&&h.bezierCurveTo(e+r,i+a-s*o,e+r-n*o,i+a,e+r-n,i+a);h.lineTo(e+n,i+a),(0!==n||0!==s)&&h.bezierCurveTo(e+n*o,i+a,e,i+a-s*o,e,i+a-s);h.lineTo(e,i+s),(0!==n||0!==s)&&h.bezierCurveTo(e,i+s*o,e+n*o,i,e+n,i);return h}(e);break;case"polygon":n=s(e,n),E=function(t){function e(t,e,i){const r=l(e),a=l(i);0===s?n.moveTo(r,a):n.lineTo(r,a),s++}const i=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,n=new Gd;let s=0;return t.getAttribute("points").replace(i,e),n.currentPath.autoClose=!0,n}(e);break;case"polyline":n=s(e,n),E=function(t){function e(t,e,i){const r=l(e),a=l(i);0===s?n.moveTo(r,a):n.lineTo(r,a),s++}const i=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,n=new Gd;let s=0;return t.getAttribute("points").replace(i,e),n.currentPath.autoClose=!1,n}(e);break;case"circle":n=s(e,n),E=function(t){const e=l(t.getAttribute("cx")||0),i=l(t.getAttribute("cy")||0),n=l(t.getAttribute("r")||0),s=new ad;s.absarc(e,i,n,0,2*Math.PI);const r=new Gd;return r.subPaths.push(s),r}(e);break;case"ellipse":n=s(e,n),E=function(t){const e=l(t.getAttribute("cx")||0),i=l(t.getAttribute("cy")||0),n=l(t.getAttribute("rx")||0),s=l(t.getAttribute("ry")||0),r=new ad;r.absellipse(e,i,n,s,0,2*Math.PI);const a=new Gd;return a.subPaths.push(r),a}(e);break;case"line":n=s(e,n),E=function(t){const e=l(t.getAttribute("x1")||0),i=l(t.getAttribute("y1")||0),n=l(t.getAttribute("x2")||0),s=l(t.getAttribute("y2")||0),r=new Gd;return r.moveTo(e,i),r.lineTo(n,s),r.currentPath.autoClose=!1,r}(e);break;case"defs":h=!0;break;case"use":n=s(e,n);const o=(e.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),u=e.viewportElement.getElementById(o);u&&t(u,n)}E&&(void 0!==n.fill&&"none"!==n.fill&&E.color.setStyle(n.fill,$d),function(t,e){function i(t){_.set(t.x,t.y,1).applyMatrix3(e),t.set(_.x,_.y)}function n(t){const i=t.xRadius,n=t.yRadius,s=Math.cos(t.aRotation),r=Math.sin(t.aRotation),a=new Tu(i*s,i*r,0),o=new Tu(-n*r,n*s,0),h=a.applyMatrix3(e),l=o.applyMatrix3(e),c=y.set(h.x,l.x,0,h.y,l.y,0,0,0,1),d=v.copy(c).invert(),p=x.copy(d).transpose().multiply(d).elements,f=function(t,e,i){let n,s,r,a,o;const h=t+i,l=t-i,u=Math.sqrt(l*l+4*e*e);h>0?(n=.5*(h+u),o=1/n,s=t*o*i-e*o*e):h<0?s=.5*(h-u):(n=.5*u,s=-.5*u);r=l>0?l+u:l-u;Math.abs(r)>2*Math.abs(e)?(o=-2*e/r,a=1/Math.sqrt(1+o*o),r=o*a):0===Math.abs(e)?(r=1,a=0):(o=-.5*r/e,r=1/Math.sqrt(1+o*o),a=o*r);l>0&&(o=r,r=-a,a=o);return{rt1:n,rt2:s,cs:r,sn:a}}(p[0],p[1],p[4]),m=Math.sqrt(f.rt1),g=Math.sqrt(f.rt2);t.xRadius=1/m,t.yRadius=1/g,t.aRotation=Math.atan2(f.sn,f.cs);if(!((t.aEndAngle-t.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const i=v.set(m,0,0,0,g,0,0,0,1),n=x.set(f.cs,f.sn,0,-f.sn,f.cs,0,0,0,1),s=i.multiply(n).multiply(c),r=t=>{const{x:e,y:i}=new Tu(Math.cos(t),Math.sin(t),0).applyMatrix3(s);return Math.atan2(i,e)};t.aStartAngle=r(t.aStartAngle),t.aEndAngle=r(t.aEndAngle),u(e)&&(t.aClockwise=!t.aClockwise)}}function s(t){const i=d(e),n=p(e);t.xRadius*=i,t.yRadius*=n;const s=i>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);t.aRotation+=s,u(e)&&(t.aStartAngle*=-1,t.aEndAngle*=-1,t.aClockwise=!t.aClockwise)}const r=t.subPaths;for(let t=0,a=r.length;t<a;t++){const a=r[t].curves;for(let t=0;t<a.length;t++){const r=a[t];r.isLineCurve?(i(r.v1),i(r.v2)):r.isCubicBezierCurve?(i(r.v0),i(r.v1),i(r.v2),i(r.v3)):r.isQuadraticBezierCurve?(i(r.v0),i(r.v1),i(r.v2)):r.isEllipseCurve&&(w.set(r.aX,r.aY),i(w),r.aX=w.x,r.aY=w.y,c(e)?n(r):s(r))}}}(E,S),f.push(E),E.userData={node:e,style:n});const M=e.childNodes;for(let e=0;e<M.length;e++){const i=M[e];h&&"style"!==i.nodeName&&"defs"!==i.nodeName||t(i,n)}o&&(g.pop(),g.length>0?S.copy(g[g.length-1]):S.identity())}(E.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4});return{paths:f,xml:E.documentElement}}static createShapes(t){const e=999999999,i=0,n=1,s=2,r=3,a=4,o=5,h=6,l={loc:i,t:0};function u(t,e,n,r){const a=t.x,o=e.x,h=n.x,u=r.x,d=t.y,p=e.y,f=n.y,m=r.y,g=(u-h)*(d-f)-(m-f)*(a-h),y=(m-f)*(o-a)-(u-h)*(p-d),v=g/y,x=((o-a)*(d-f)-(p-d)*(a-h))/y;if(0===y&&0!==g||v<=0||v>=1||x<0||x>1)return null;if(0===g&&0===y){for(let h=0;h<2;h++){if(c(0===h?n:r,t,e),l.loc==i){const t=0===h?n:r;return{x:t.x,y:t.y,t:l.t}}if(l.loc==s){return{x:+(a+l.t*(o-a)).toPrecision(10),y:+(d+l.t*(p-d)).toPrecision(10),t:l.t}}}return null}for(let s=0;s<2;s++)if(c(0===s?n:r,t,e),l.loc==i){const t=0===s?n:r;return{x:t.x,y:t.y,t:l.t}}return{x:+(a+v*(o-a)).toPrecision(10),y:+(d+v*(p-d)).toPrecision(10),t:v}}function c(t,e,u){const c=u.x-e.x,d=u.y-e.y,p=t.x-e.x,f=t.y-e.y,m=c*f-p*d;if(t.x===e.x&&t.y===e.y)return l.loc=i,void(l.t=0);if(t.x===u.x&&t.y===u.y)return l.loc=n,void(l.t=1);if(m<-Number.EPSILON)return void(l.loc=r);if(m>Number.EPSILON)return void(l.loc=a);if(c*p<0||d*f<0)return void(l.loc=o);if(Math.sqrt(c*c+d*d)<Math.sqrt(p*p+f*f))return void(l.loc=h);let g;g=0!==c?p/c:f/d,l.loc=s,l.t=g}function d(t,e,i){const n=new lu;e.getCenter(n);const s=[];return i.forEach((e=>{if(e.boundingBox.containsPoint(n)){(function(t,e){const i=[],n=[];for(let s=1;s<t.length;s++){const r=t[s-1],a=t[s];for(let t=1;t<e.length;t++){const s=u(r,a,e[t-1],e[t]);null!==s&&void 0===i.find((t=>t.t<=s.t+Number.EPSILON&&t.t>=s.t-Number.EPSILON))&&(i.push(s),n.push(new lu(s.x,s.y)))}}return n})(t,e.points).forEach((t=>{s.push({identifier:e.identifier,isCW:e.isCW,point:t})}))}})),s.sort(((t,e)=>t.point.x-e.point.x)),s}let p=e,f=-999999999,m=t.subPaths.map((t=>{const i=t.getPoints();let n=-999999999,s=e,r=-999999999,a=e;for(let t=0;t<i.length;t++){const e=i[t];e.y>n&&(n=e.y),e.y<s&&(s=e.y),e.x>r&&(r=e.x),e.x<a&&(a=e.x)}return f<=r&&(f=r+1),p>=a&&(p=a-1),{curves:t.curves,points:i,isCW:Nd.isClockWise(i),identifier:-1,boundingBox:new Yd(new lu(a,s),new lu(r,n))}}));m=m.filter((t=>t.points.length>1));for(let t=0;t<m.length;t++)m[t].identifier=t;const g=m.map((e=>function(t,e,i,n,s){null!=s&&""!==s||(s="nonzero");const r=new lu;t.boundingBox.getCenter(r);const a=d([new lu(i,r.y),new lu(n,r.y)],t.boundingBox,e);a.sort(((t,e)=>t.point.x-e.point.x));const o=[],h=[];a.forEach((e=>{e.identifier===t.identifier?o.push(e):h.push(e)}));const l=o[0].point.x,u=[];let c=0;for(;c<h.length&&h[c].point.x<l;)u.length>0&&u[u.length-1]===h[c].identifier?u.pop():u.push(h[c].identifier),c++;if(u.push(t.identifier),"evenodd"===s){const e=u.length%2==0,i=u[u.length-2];return{identifier:t.identifier,isHole:e,for:i}}if("nonzero"===s){let i=!0,n=null,s=null;for(let t=0;t<u.length;t++){const r=u[t];i?(s=e[r].isCW,i=!1,n=r):s!==e[r].isCW&&(s=e[r].isCW,i=!0)}return{identifier:t.identifier,isHole:i,for:n}}}(e,m,p,f,t.userData?t.userData.style.fillRule:void 0))),y=[];return m.forEach((t=>{if(!g[t.identifier].isHole){const e=new od;e.curves=t.curves;g.filter((e=>e.isHole&&e.for===t.identifier)).forEach((t=>{const i=m[t.identifier],n=new ad;n.curves=i.curves,e.holes.push(n)})),y.push(e)}})),y}static getStrokeStyle(t,e,i,n,s){return{strokeColor:e=void 0!==e?e:"#000",strokeWidth:t=void 0!==t?t:1,strokeLineJoin:i=void 0!==i?i:"miter",strokeLineCap:n=void 0!==n?n:"butt",strokeMiterLimit:s=void 0!==s?s:4}}static pointsToStroke(t,e,i,n){const s=[],r=[],a=[];if(0===Xd.pointsToStrokeWithBuffers(t,e,i,n,s,r,a))return null;const o=new Vc;return o.setAttribute("position",new Nc(s,3)),o.setAttribute("normal",new Nc(r,3)),o.setAttribute("uv",new Nc(a,2)),o}static pointsToStrokeWithBuffers(t,e,i,n,s,r,a,o){const h=new lu,l=new lu,u=new lu,c=new lu,d=new lu,p=new lu,f=new lu,m=new lu,g=new lu,y=new lu,v=new lu,x=new lu,b=new lu,w=new lu,_=new lu,S=new lu,E=new lu;i=void 0!==i?i:12,n=void 0!==n?n:.001,o=void 0!==o?o:0;const M=(t=function(t){let e=!1;for(let i=1,s=t.length-1;i<s;i++)if(t[i].distanceTo(t[i+1])<n){e=!0;break}if(!e)return t;const i=[];i.push(t[0]);for(let e=1,s=t.length-1;e<s;e++)t[e].distanceTo(t[e+1])>=n&&i.push(t[e]);return i.push(t[t.length-1]),i}(t)).length;if(M<2)return 0;const A=t[0].equals(t[M-1]);let T,C,I=t[0];const D=e.strokeWidth/2,L=1/(M-1);let B,P,k,N,O=0,R=!1,z=0,H=3*o,W=2*o;F(t[0],t[1],h).multiplyScalar(D),m.copy(t[0]).sub(h),g.copy(t[0]).add(h),y.copy(m),v.copy(g);for(let i=1;i<M;i++){T=t[i],C=i===M-1?A?t[1]:void 0:t[i+1];const n=h;if(F(I,T,n),u.copy(n).multiplyScalar(D),x.copy(T).sub(u),b.copy(T).add(u),B=O+L,P=!1,void 0!==C){F(T,C,l),u.copy(l).multiplyScalar(D),w.copy(T).sub(u),_.copy(T).add(u),k=!0,u.subVectors(C,I),n.dot(u)<0&&(k=!1),1===i&&(R=k),u.subVectors(C,T),u.normalize();const t=Math.abs(n.dot(u));if(t>Number.EPSILON){const i=D/t;u.multiplyScalar(-i),c.subVectors(T,I),d.copy(c).setLength(i).add(u),S.copy(d).negate();const n=d.length(),s=c.length();c.divideScalar(s),p.subVectors(C,T);const r=p.length();switch(p.divideScalar(r),c.dot(S)<s&&p.dot(S)<r&&(P=!0),E.copy(d).add(T),S.add(T),N=!1,P?k?(_.copy(S),b.copy(S)):(w.copy(S),x.copy(S)):q(),e.strokeLineJoin){case"bevel":j(k,P,B);break;case"round":Y(k,P),k?V(T,x,w,B,0):V(T,_,b,B,1);break;default:const t=D*e.strokeMiterLimit/n;if(t<1){if("miter-clip"!==e.strokeLineJoin){j(k,P,B);break}Y(k,P),k?(p.subVectors(E,x).multiplyScalar(t).add(x),f.subVectors(E,w).multiplyScalar(t).add(w),U(x,B,0),U(p,B,0),U(T,B,.5),U(T,B,.5),U(p,B,0),U(f,B,0),U(T,B,.5),U(f,B,0),U(w,B,0)):(p.subVectors(E,b).multiplyScalar(t).add(b),f.subVectors(E,_).multiplyScalar(t).add(_),U(b,B,1),U(p,B,1),U(T,B,.5),U(T,B,.5),U(p,B,1),U(f,B,1),U(T,B,.5),U(f,B,1),U(_,B,1))}else P?(k?(U(g,O,1),U(m,O,0),U(E,B,0),U(g,O,1),U(E,B,0),U(S,B,1)):(U(g,O,1),U(m,O,0),U(E,B,1),U(m,O,0),U(S,B,0),U(E,B,1)),k?w.copy(E):_.copy(E)):k?(U(x,B,0),U(E,B,0),U(T,B,.5),U(T,B,.5),U(E,B,0),U(w,B,0)):(U(b,B,1),U(E,B,1),U(T,B,.5),U(T,B,.5),U(E,B,1),U(_,B,1)),N=!0}}else q()}else q();A||i!==M-1||G(t[0],y,v,k,!0,O),O=B,I=T,m.copy(w),g.copy(_)}if(A){if(P&&s){let t=E,e=S;R!==k&&(t=S,e=E),k?(N||R)&&(e.toArray(s,0),e.toArray(s,9),N&&t.toArray(s,3)):!N&&R||(e.toArray(s,3),e.toArray(s,9),N&&t.toArray(s,0))}}else G(T,x,b,k,!1,B);return z;function F(t,e,i){return i.subVectors(e,t),i.set(-i.y,i.x).normalize()}function U(t,e,i){s&&(s[H]=t.x,s[H+1]=t.y,s[H+2]=0,r&&(r[H]=0,r[H+1]=0,r[H+2]=1),H+=3,a&&(a[W]=e,a[W+1]=i,W+=2)),z+=3}function V(t,e,n,s,r){h.copy(e).sub(t).normalize(),l.copy(n).sub(t).normalize();let a=Math.PI;const o=h.dot(l);Math.abs(o)<1&&(a=Math.abs(Math.acos(o))),a/=i,u.copy(e);for(let e=0,n=i-1;e<n;e++)c.copy(u).rotateAround(t,a),U(u,s,r),U(c,s,r),U(t,s,.5),u.copy(c);U(c,s,r),U(n,s,r),U(t,s,.5)}function q(){U(g,O,1),U(m,O,0),U(x,B,0),U(g,O,1),U(x,B,0),U(b,B,1)}function j(t,e,i){e?t?(U(g,O,1),U(m,O,0),U(x,B,0),U(g,O,1),U(x,B,0),U(S,B,1),U(x,i,0),U(w,i,0),U(S,i,.5)):(U(g,O,1),U(m,O,0),U(b,B,1),U(m,O,0),U(S,B,0),U(b,B,1),U(b,i,1),U(S,i,0),U(_,i,1)):t?(U(x,i,0),U(w,i,0),U(T,i,.5)):(U(b,i,1),U(_,i,0),U(T,i,.5))}function Y(t,e){e&&(t?(U(g,O,1),U(m,O,0),U(x,B,0),U(g,O,1),U(x,B,0),U(S,B,1),U(x,O,0),U(T,B,.5),U(S,B,1),U(T,B,.5),U(w,O,0),U(S,B,1)):(U(g,O,1),U(m,O,0),U(b,B,1),U(m,O,0),U(S,B,0),U(b,B,1),U(b,O,1),U(S,B,0),U(T,B,.5),U(T,B,.5),U(S,B,0),U(_,O,1)))}function G(t,i,n,r,o,d){switch(e.strokeLineCap){case"round":o?V(t,n,i,d,.5):V(t,i,n,d,.5);break;case"square":if(o)h.subVectors(i,t),l.set(h.y,-h.x),u.addVectors(h,l).add(t),c.subVectors(l,h).add(t),r?(u.toArray(s,3),c.toArray(s,0),c.toArray(s,9)):(u.toArray(s,3),1===a[7]?c.toArray(s,9):u.toArray(s,9),c.toArray(s,0));else{h.subVectors(n,t),l.set(h.y,-h.x),u.addVectors(h,l).add(t),c.subVectors(l,h).add(t);const e=s.length;r?(u.toArray(s,e-3),c.toArray(s,e-6),c.toArray(s,e-12)):(c.toArray(s,e-6),u.toArray(s,e-3),c.toArray(s,e-12))}}}}}class Zd extends Tu{constructor(t,e,i){super(t,e,i)}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}floorToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this.z=this.z<0?Math.floor(this.z):Math.ceil(this.z),this}roundToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this.z=this.z<0?Math.floor(this.z):Math.ceil(this.z),this}toString(){return`{x: ${this.x}, y: ${this.y}}`}}class Jd extends Xd{constructor(t=void 0){super(t),c(this,"viewportElement"),c(this,"instancedMesh",!1),c(this,"dpr",1)}setRequestHeader(t){return this.requestHeader=t,this}setInstancedMesh(t=!1){return this.instancedMesh=t,this}setPixelRatio(t){return this.dpr=t,this}parse(t,e=!0){const i=this;function n(t,e,i,n,r,a,o,h){var l;if(0==e||0==i)return void t.lineTo(h.x,h.y);n=n*Math.PI/180,e=Math.abs(e),i=Math.abs(i);const u=(o.x-h.x)/2,c=(o.y-h.y)/2,d=Math.cos(n)*u+Math.sin(n)*c,p=-Math.sin(n)*u+Math.cos(n)*c;let f=e*e,m=i*i;const g=d*d,y=p*p,v=g/f+y/m;if(v>1){const t=Math.sqrt(v);f=(e*=t)*e,m=(i*=t)*i}const x=f*y+m*g,b=(f*m-x)/x;let w=Math.sqrt(Math.max(0,b));r===a&&(w=-w);const _=w*e*p/i,S=-w*i*d/e,E=Math.cos(n)*_-Math.sin(n)*S+(o.x+h.x)/2,M=Math.sin(n)*_+Math.cos(n)*S+(o.y+h.y)/2,A=s(1,0,(d-_)/e,(p-S)/i),T=s((d-_)/e,(p-S)/i,(-d-_)/e,(-p-S)/i)%(2*Math.PI);null==(l=t.currentPath)||l.absellipse(E,M,e,i,A,A+T,0===a,n)}function s(t,e,i,n){const s=t*i+e*n,r=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+n*n);let a=Math.acos(Math.max(-1,Math.min(1,s/r)));return t*n-e*i<0&&(a=-a),a}function r(t,e){var i;e=Object.assign({},e);let n={};if(t.hasAttribute("class")){const e=null==(i=t.getAttribute("class"))?void 0:i.split(/\s/).filter(Boolean).map((t=>t.trim()));for(let t=0,i=(null==e?void 0:e.length)||0;t<i;t++)n=Object.assign(n,A["."+e[t]])}function s(i,s,r){void 0===r&&(r=function(t){return t.startsWith("url"),t}),t.hasAttribute(i)&&(e[s]=r(t.getAttribute(i))),n[i]&&(e[s]=r(n[i])),t.style&&""!==t.style[i]&&(e[s]=r(t.style[i]))}t.hasAttribute("id")&&(n=Object.assign(n,A["#"+t.getAttribute("id")]));const{fontSize:r,strokeWidth:a}=e;function o(t){return Math.max(0,Math.min(1,c(t)))}function h(t){return Math.max(0,c(t,{fontSize:r}))}s("font-size","fontSize",h),s("fill","fill"),s("fill-opacity","fillOpacity",o),s("fill-rule","fillRule"),s("opacity","opacity",o),s("stroke","stroke"),s("stroke-opacity","strokeOpacity",o),s("stroke-width","strokeWidth",(function(t){return Math.max(0,c(t,{}))})),s("stroke-linejoin","strokeLineJoin"),s("stroke-linecap","strokeLineCap"),s("stroke-miterlimit","strokeMiterLimit",h),s("visibility","visibility");const l=t.getAttribute("stroke-width")||e.strokeWidth;return ri.endsWith(l,"%")&&(e.thinLine=!0),e}function a(t,e){return t-(e-t)}function o(t,e,i){if("string"!=typeof t)throw new TypeError("Invalid input: "+typeof t);const n={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let s=0,r=!0,a="",o="";const h=[];function l(t,e,i){const n=new SyntaxError('Unexpected character "'+t+'" at index '+e+".");throw n.partial=i,n}function u(){""!==a&&(""===o?h.push(Number(a)):h.push(Number(a)*Math.pow(10,Number(o)))),a="",o=""}let c;const d=t.length;for(let p=0;p<d;p++)if(c=t[p],Array.isArray(e)&&e.includes(h.length%(i||0))&&n.FLAGS.test(c))s=1,a=c,u();else{if(0===s){if(n.WHITESPACE.test(c))continue;if(n.DIGIT.test(c)||n.SIGN.test(c)){s=1,a=c;continue}if(n.POINT.test(c)){s=2,a=c;continue}n.COMMA.test(c)&&(r&&l(c,p,h),r=!0)}if(1===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.POINT.test(c)){a+=c,s=2;continue}if(n.EXP.test(c)){s=3;continue}n.SIGN.test(c)&&1===a.length&&n.SIGN.test(a[0])&&l(c,p,h)}if(2===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.EXP.test(c)){s=3;continue}n.POINT.test(c)&&"."===a[a.length-1]&&l(c,p,h)}if(3===s){if(n.DIGIT.test(c)){o+=c;continue}if(n.SIGN.test(c)){if(""===o){o+=c;continue}1===o.length&&n.SIGN.test(o)&&l(c,p,h)}}n.WHITESPACE.test(c)?(u(),s=0,r=!1):n.COMMA.test(c)?(u(),s=0,r=!0):n.SIGN.test(c)?(u(),s=1,a=c):n.POINT.test(c)?(u(),s=2,a=c):l(c,p,h)}return u(),h}const h=["mm","cm","in","pt","pc","px","em","%"],u={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1},"%":{"%":1,px:-1}};function c(t,e){let n,s="px";if("string"==typeof t||t instanceof String){t=null==t?void 0:t.trim();for(let e=0,i=h.length;e<i;e++){const i=h[e];if(t.endsWith(i)){s=i,t=t.substring(0,t.length-i.length);break}}}if("px"===s&&"px"!==i.defaultUnit)n=u.in[i.defaultUnit]/i.defaultDPI;else if("%"===s){z.getSize(tp),Kd.copy(k).getScale(ep);const t=Math.abs(ep.x||1);n=tp.x/100*t}else"em"===s?n=(null==e?void 0:e.fontSize)||F:(n=u[s][i.defaultUnit],n<0&&(n=u[s].in*i.defaultDPI));return n*parseFloat(t)}function d(t){const e=t.elements;return e[0]*e[4]-e[1]*e[3]<0}function p(t){const e=t.elements,i=e[0]*e[3]+e[1]*e[4];if(0===i)return!1;const n=f(t),s=m(t);return Math.abs(i/(n*s))>Number.EPSILON}function f(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function m(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function g(t){return Math.round(t*W*100)/100}function y(t){return Math.round(t*W*100)/100}function v(t){return Math.round(t*W*100)/100}function x(t){return Math.round(t*W*100)/100}function b(t,e="asset"){let i;const n="function"==typeof t.getAttribute?t.getAttribute("id"):"";if(!n&&t.parentNode)return b(t.parentNode,e);if(!n)return i;if("layer"===e)i=X.find((t=>n===t));else{const t=null==n?void 0:n.replace(/-assets/g,"");i=$.find((e=>t===e))}return!i&&t.parentNode&&(i=b(t.parentNode,e)),i}function w(t){let e;const i="function"==typeof t.getAttribute?t.getAttribute("id"):"";return e=!i&&t.parentNode?w(t.parentNode):i,e}function _(t,e){let i;const n=w(t);return i=t.parentNode&&w(t.parentNode),i&&n!==e||(i=_(t.parentNode,e)),i||(n||"")}function S(t){let e;return w(t),e="function"==typeof t.getAttribute?t.getAttribute("aid"):"",!e&&t.parentNode&&(e=S(t.parentNode)),e}const E=[],M=[],A={},T=[],C=new uu,I=new uu,D=new uu,L=new uu,B=new lu,P=new Tu,k=new uu,N={},O={},R=[],z=new ai,H=new We,W=1,F=16,U=(new DOMParser).parseFromString(t,"image/svg+xml");i.viewportElement=U.documentElement;!function(t,e=new ai){if(!t)return e;let i=t.split(" "),n=ri.map(i,(t=>parseFloat(t)));4!==(null==n?void 0:n.length)||(e.min.set(n[0],n[1]),e.max.set(n[0]+n[2],n[1]+n[3]))}(i.viewportElement.getAttribute("viewBox")||"",z);const V=U.getElementsByTagName("view"),q=(null==V?void 0:V.length)?V[0]:null,j=(null==q?void 0:q.getAttribute("units"))||"";z.getCenter(H);const Y=rn(U.documentElement);let G=[];an(Y||[],(t=>{var e;if("assets"===t.label&&(null==(e=t.children)?void 0:e.length))for(let e,i=0,n=t.children.length;i<n;i++)e=t.children[i],e.label&&G.push(ri.head(ri.split(e.label,"-"))||"")})),G=ri.uniq(ri.compact(G));const $=ri.uniq(ri.compact([...G,...Object.values(Li)])),X=Object.values(Pi);!function t(e,i,s,h=!1){var u;if(1!==e.nodeType)return;const N=function(t,e){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))||"text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))))return null;const i=function(t,e){var i;const n=new uu,s=C;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){let e=c(t.getAttribute("x")),i=c(t.getAttribute("y"));n.translate(e,i)}else if("text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))){let i=0,s=0;i=t.hasAttribute("dx")?c(t.getAttribute("dx")||0,{fontSize:null==e?void 0:e.fontSize}):0,s=t.hasAttribute("dy")?c(t.getAttribute("dy")||0,{fontSize:null==e?void 0:e.fontSize}):0,n.translate(i,s)}if(t.hasAttribute("transform")){const e=null==(i=t.getAttribute("transform"))?void 0:i.split(")");for(let t=((null==e?void 0:e.length)||0)-1;t>=0;t--){const i=e[t].trim();if(""===i)continue;const r=i.indexOf("("),a=i.length;if(r>0&&r<a){const t=i.slice(0,r),e=o(i.slice(r+1));switch(s.identity(),t){case"translate":if(e.length>=1){const t=e[0];let i=0;e.length>=2&&(i=e[1]),s.translate(t,i)}break;case"rotate":if(e.length>=1){let t=0,i=0,n=0;t=e[0]*Math.PI/180,e.length>=3&&(i=e[1],n=e[2]),I.makeTranslation(-i,-n),D.makeRotation(t),L.multiplyMatrices(D,I),I.makeTranslation(i,n),s.multiplyMatrices(I,L)}break;case"scale":if(e.length>=1){const t=e[0];let i=t;e.length>=2&&(i=e[1]),s.scale(t,i)}break;case"skewX":1===e.length&&s.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&s.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&s.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}n.premultiply(s)}}return n}(t,e);T.length>0&&i.premultiply(T[T.length-1]);return k.copy(i),T.push(i),i}(e,i);let R=!1,z=null,H=[];const W="function"==typeof e.getAttribute?e.getAttribute("id"):null;switch(e.nodeName){case"svg":case"g":i=r(e,i);break;case"style":!function(t){const e=t.textContent,i=null==e?void 0:e.replace(/\/\*[\s\S]*?\*\//g,""),n=null==i?void 0:i.replace(/([^;])}/g,"$1;}");if(!n)return;const s=[];let r="",a=0;for(const t of n)"{"===t?a++:"}"===t&&a--,r+=t,"}"===t&&0===a&&(s.push(r.trim()),r="");for(const t of s){if(!t.includes("{"))continue;const[e,i]=t.split(/\s*\{\s*/);if(!e||!i)continue;const n=e.split(",").map((t=>t.trim())).filter(Boolean),s={};i.replace(/}\s*$/,"").split(";").map((t=>t.trim())).filter(Boolean).forEach((t=>{const[e,i]=t.split(/:\s*/);if(e&&i){const t=i.replace(/\s*!important\s*$/,"").trim();s[e.trim()]=t}})),n.forEach((t=>{t&&(A[t]=l(l({},A[t]||{}),s))}))}}(e);break;case"path":i=r(e,i),e.hasAttribute("d")&&(z=function(t,e=!1){const i=new Gd,s=new We,r=new We,h=new We;let l=!0,u=!1;const c=t.getAttribute("d");if(!c||""===c||"none"===c)return null;const d=c.match(/[a-df-z][^a-df-z]*/gi);if(!(null==d?void 0:d.length))return null;for(let t=0,c=(null==d?void 0:d.length)||0;t<c;t++){const c=d[t],p=c.charAt(0),f=c.slice(1).trim();let m;switch(!0===l&&(u=!0,l=!1),p){case"M":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x=e?m[t]:g(m[t]),s.y=e?m[t+1]:y(m[t+1]),r.x=s.x,r.y=s.y,0===t?i.moveTo(s.x,s.y):i.lineTo(s.x,s.y),0===t&&h.copy(s);break;case"H":m=o(f);for(let t=0,n=m.length;t<n;t++)s.x=e?m[t]:g(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"V":m=o(f);for(let t=0,n=m.length;t<n;t++)s.y=e?m[t]:y(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"L":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x=e?m[t]:g(m[t]),s.y=e?m[t+1]:y(m[t+1]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"C":m=o(f);for(let t,n=0,a=m.length;n<a;n+=6)t=e?[m[n],m[n+1],m[n+2],m[n+3],m[n+4],m[n+5]]:[g(m[n]),y(m[n+1]),g(m[n+2]),y(m[n+3]),g(m[n+4]),y(m[n+5])],i.bezierCurveTo(...t),r.x=t[2],r.y=t[3],s.x=t[4],s.y=t[5],0===n&&!0===u&&h.copy(s);break;case"S":m=o(f);for(let t,n=0,o=m.length;n<o;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[g(m[n]),y(m[n+1]),g(m[n+2]),y(m[n+3])],i.bezierCurveTo(a(s.x,r.x),a(s.y,r.y),t[0],t[1],t[2],t[3]),r.x=t[0],r.y=t[1],s.x=t[2],s.y=t[3],0===n&&!0===u&&h.copy(s);break;case"Q":m=o(f);for(let t,n=0,a=m.length;n<a;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[g(m[n]),y(m[n+1]),g(m[n+2]),y(m[n+3])],i.quadraticCurveTo(t[0],t[1],t[2],t[3]),r.x=t[0],r.y=t[1],s.x=t[2],s.y=t[3],0===n&&!0===u&&h.copy(s);break;case"T":m=o(f);for(let t,n=0,o=m.length;n<o;n+=2){const o=a(s.x,r.x),l=a(s.y,r.y);t=e?[m[n],m[n+1]]:[g(m[n]),y(m[n+1])],i.quadraticCurveTo(o,l,t[0],t[1]),r.x=o,r.y=l,s.x=t[0],s.y=t[1],0===n&&!0===u&&h.copy(s)}break;case"A":m=o(f,[3,4],7);for(let t,a=0,o=m.length;a<o;a+=7){if(t=e?[m[a],m[a+1],m[a+2],m[a+3],m[a+4],m[a+5],m[a+6]]:[g(m[a]),y(m[a+1]),m[a+2],m[a+3],m[a+4],v(m[a+5]),x(m[a+6])],t[5]==s.x&&t[6]==s.y)continue;const o=s.clone();s.x=t[5],s.y=t[6],r.x=s.x,r.y=s.y,n(i,t[a],t[1],t[2],t[3],t[4],o,s),0===a&&!0===u&&h.copy(s)}break;case"m":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x+=e?m[t]:v(m[t]),s.y+=e?m[t+1]:x(m[t+1]),r.x=s.x,r.y=s.y,0===t?i.moveTo(s.x,s.y):i.lineTo(s.x,s.y),0===t&&h.copy(s);break;case"h":m=o(f);for(let t=0,n=m.length;t<n;t++)s.x+=e?m[t]:v(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"v":m=o(f);for(let t=0,n=m.length;t<n;t++)s.y+=e?m[t]:x(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"l":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x+=e?m[t]:v(m[t]),s.y+=e?m[t+1]:x(m[t+1]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"c":m=o(f);for(let t,n=0,a=m.length;n<a;n+=6)t=e?[m[n],m[n+1],m[n+2],m[n+3],m[n+4],m[n+5]]:[v(m[n]),x(m[n+1]),v(m[n+2]),x(m[n+3]),v(m[n+4]),x(m[n+5])],i.bezierCurveTo(s.x+t[0],s.y+t[1],s.x+t[2],s.y+t[3],s.x+t[4],s.y+t[5]),r.x=s.x+t[2],r.y=s.y+t[3],s.x+=t[4],s.y+=t[5],0===n&&!0===u&&h.copy(s);break;case"s":m=o(f);for(let t,n=0,o=m.length;n<o;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[v(m[n]),x(m[n+1]),v(m[n+2]),x(m[n+3])],i.bezierCurveTo(a(s.x,r.x),a(s.y,r.y),s.x+t[0],s.y+t[1],s.x+t[2],s.y+t[3]),r.x=s.x+t[0],r.y=s.y+t[1],s.x+=t[2],s.y+=t[3],0===n&&!0===u&&h.copy(s);break;case"q":m=o(f);for(let t,n=0,a=m.length;n<a;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[v(m[n]),x(m[n+1]),v(m[n+2]),x(m[n+3])],i.quadraticCurveTo(s.x+t[0],s.y+t[1],s.x+t[2],s.y+t[3]),r.x=s.x+t[0],r.y=s.y+t[1],s.x+=t[2],s.y+=t[3],0===n&&!0===u&&h.copy(s);break;case"t":m=o(f);for(let t,n=0,o=m.length;n<o;n+=2){const o=a(s.x,r.x),l=a(s.y,r.y);t=e?[m[n],m[n+1]]:[v(m[n]),x(m[n+1])],i.quadraticCurveTo(o,l,s.x+t[0],s.y+t[1]),r.x=o,r.y=l,s.x=s.x+t[0],s.y=s.y+t[1],0===n&&!0===u&&h.copy(s)}break;case"a":m=o(f,[3,4],7);for(let t,a=0,o=m.length;a<o;a+=7){if(t=e?[m[a],m[a+1],m[a+2],m[a+3],m[a+4],m[a+5],m[a+6]]:[v(m[a]),x(m[a+1]),m[a+2],m[a+3],m[a+4],v(m[a+5]),x(m[a+6])],0==t[5]&&0==t[6])continue;const o=s.clone();s.x+=t[5],s.y+=t[6],r.x=s.x,r.y=s.y,n(i,t[0],t[1],t[2],t[3],t[4],o,s),0===a&&!0===u&&h.copy(s)}break;case"Z":case"z":i.currentPath.autoClose=!0,i.currentPath.curves.length>0&&(s.copy(h),i.currentPath.currentPoint.copy(s),l=!0)}u=!1}return i}(e,h));break;case"rect":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("x")||0),n=c(t.getAttribute("y")||0),s=c(t.getAttribute("rx")||t.getAttribute("ry")||0),r=c(t.getAttribute("ry")||t.getAttribute("rx")||0),a=c(t.getAttribute("width")),o=c(t.getAttribute("height"));e||(i=g(i),n=y(n),s=v(s),r=x(r),a=v(a),o=x(o));const h=.448084975506,l=new Gd;l.moveTo(i+s,n),l.lineTo(i+a-s,n),(0!==s||0!==r)&&l.bezierCurveTo(i+a-s*h,n,i+a,n+r*h,i+a,n+r);l.lineTo(i+a,n+o-r),(0!==s||0!==r)&&l.bezierCurveTo(i+a,n+o-r*h,i+a-s*h,n+o,i+a-s,n+o);l.lineTo(i+s,n+o),(0!==s||0!==r)&&l.bezierCurveTo(i+s*h,n+o,i,n+o-r*h,i,n+o-r);l.lineTo(i,n+r),(0!==s||0!==r)&&l.bezierCurveTo(i,n+r*h,i+s*h,n,i+s,n);return l}(e,h);break;case"polygon":i=r(e,i),z=function(t,e=!1){var i;function n(t,i,n){const s=e?c(i):g(c(i)),o=e?c(n):y(c(n));return 0===a?r.moveTo(s,o):r.lineTo(s,o),a++,t}const s=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,r=new Gd;let a=0;return null==(i=t.getAttribute("points"))||i.replace(s,n),r.currentPath.autoClose=!0,r}(e,h);break;case"polyline":i=r(e,i),z=function(t,e=!1){var i;function n(t,i,n){const s=e?c(i):g(c(i)),o=e?c(n):y(c(n));return 0===a?r.moveTo(s,o):r.lineTo(s,o),a++,t}const s=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,r=new Gd;let a=0;return null==(i=t.getAttribute("points"))||i.replace(s,n),r.currentPath.autoClose=!1,r}(e,h);break;case"circle":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),s=c(t.getAttribute("r")||0);e||(i=g(i),n=y(n),s=v(s));const r=new ad;r.absarc(i,n,s,0,2*Math.PI);const a=new Gd;return a.subPaths.push(r),a}(e,h);break;case"ellipse":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),s=c(t.getAttribute("rx")||0),r=c(t.getAttribute("ry")||0);e||(i=g(i),n=y(n),s=v(s),r=x(r));const a=new ad;a.absellipse(i,n,s,r,0,2*Math.PI);const o=new Gd;return o.subPaths.push(a),o}(e,h);break;case"line":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("x1")||0),n=c(t.getAttribute("y1")||0),s=c(t.getAttribute("x2")||0),r=c(t.getAttribute("y2")||0);e||(i=g(i),n=y(n),s=g(s),r=y(r));const a=new Gd;return a.moveTo(i,n),a.lineTo(s,r),a.currentPath.autoClose=!1,a}(e,h);break;case"defs":R=!0;break;case"use":const u=(e.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),d=O[u];d&&(i=r(e,i),void 0===(i=r(d,i)).assetType&&(i.assetType=b(e)),void 0===i.layerType&&(i.layerType=b(e,"layer")),t(d,i,W||s,h));break;case"text":i=r(e,i),z=function(t,e){parseFloat(t.getAttribute("x")||"0"),parseFloat(t.getAttribute("y")||"0");const i=t.textContent;if(!i||!e.fontSize)return;const n=Object.assign({},e);return n.fill=t.getAttribute("fill")||e.fill||"#000",n.fontSize=parseFloat(t.getAttribute("font-size")||e.fontSize||"72"),n.fontFamily=t.getAttribute("font-family")||e.fontFamily||"Arial",{type:"text",textContent:i,style:n,color:new Tc,subPaths:[],userData:{}}}(e,i,h)}if(z){void 0!==i.fill&&"transparent"===i.fill||void 0!==i.fill&&"none"!==i.fill&&z.color.setStyle(i.fill,Qd);const t=i.assetType||b(e),n=i.layerType||b(e,"layer");if(z.userData={pid:s,id:W||s,nodeName:e.nodeName,layerType:n,assetType:t,style:i},"text"===e.nodeName){s||ri.set(z,"userData.pid",w(e)),z.userData.textContent=e.textContent,z.transform=ri.cloneDeep(k),z.userData.id=ri.get(z,"userData.pid"),ri.set(z,"userData.pid",_(e,s));const t=S(e);t?ri.set(z,"userData.aid",t):ri.set(z,"userData.aid",ri.split(null==(u=z.userData)?void 0:u.id,"-").splice(2).join("-")),E.find((t=>t.userData.id===z.userData.aid))}else!function(t,e){function i(t){P.set(t.x,t.y,1).applyMatrix3(e),t.set(P.x,P.y)}function n(t){const i=t.xRadius,n=t.yRadius,s=Math.cos(t.aRotation),r=Math.sin(t.aRotation),a=new Zd(i*s,i*r,0),o=new Zd(-n*r,n*s,0),h=a.applyMatrix3(e),l=o.applyMatrix3(e),u=C.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=I.copy(u).invert(),p=D.copy(c).transpose().multiply(c).elements,f=function(t,e,i){let n,s,r,a,o;const h=t+i,l=t-i,u=Math.sqrt(l*l+4*e*e);h>0?(n=.5*(h+u),o=1/n,s=t*o*i-e*o*e):h<0?s=.5*(h-u):(n=.5*u,s=-.5*u);r=l>0?l+u:l-u;Math.abs(r)>2*Math.abs(e)?(o=-2*e/r,a=1/Math.sqrt(1+o*o),r=o*a):0===Math.abs(e)?(r=1,a=0):(o=-.5*r/e,r=1/Math.sqrt(1+o*o),a=o*r);l>0&&(o=r,r=-a,a=o);return{rt1:n,rt2:s,cs:r,sn:a}}(p[0],p[1],p[4]),m=Math.sqrt(f.rt1),g=Math.sqrt(f.rt2);t.xRadius=1/m,t.yRadius=1/g,t.aRotation=Math.atan2(f.sn,f.cs);if(!((t.aEndAngle-t.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const i=I.set(m,0,0,0,g,0,0,0,1),n=D.set(f.cs,f.sn,0,-f.sn,f.cs,0,0,0,1),s=i.multiply(n).multiply(u),r=t=>{const{x:e,y:i}=new Zd(Math.cos(t),Math.sin(t),0).applyMatrix3(s);return Math.atan2(i,e)};t.aStartAngle=r(t.aStartAngle),t.aEndAngle=r(t.aEndAngle),d(e)&&(t.aClockwise=!t.aClockwise)}}function s(t){const i=f(e),n=m(e);t.xRadius*=i,t.yRadius*=n;const s=i>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);t.aRotation+=s,d(e)&&(t.aStartAngle*=-1,t.aEndAngle*=-1,t.aClockwise=!t.aClockwise)}const r=t.subPaths;for(let t=0,a=(null==r?void 0:r.length)||0;t<a;t++){const a=r[t].curves;for(let t=0;t<a.length;t++){const r=a[t];r.isLineCurve?(i(r.v1),i(r.v2)):r.isCubicBezierCurve?(i(r.v0),i(r.v1),i(r.v2),i(r.v3)):r.isQuadraticBezierCurve?(i(r.v0),i(r.v1),i(r.v2)):r.isEllipseCurve&&(B.set(r.aX,r.aY),i(B),r.aX=B.x,r.aY=B.y,p(e)?n(r):s(r))}}}(z,k);"text"!==e.nodeName?E.push(z):"text"===e.nodeName&&M.push(z)}const F=e.childNodes,U="symbol"===e.nodeName?s:W;for(let e=0,n=(null==F?void 0:F.length)||0;e<n;e++){const n=F[e];if(R){const t="function"==typeof n.getAttribute?n.getAttribute("id"):null;"symbol"===n.nodeName&&t&&(O[t]=n)}if(R&&"style"!==n.nodeName&&"defs"!==n.nodeName)continue;let s=t(n,i,U,h);s&&H.push(s)}return N&&(T.pop(),T.length>0?k.copy(T[T.length-1]):k.identity()),z||((null==H?void 0:H.length)?H:void 0)}(U.documentElement,{fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4,fontSize:F});for(let t in N)N[t].len=ri.sumBy(R,(e=>e.symbolId===t?1:0));R.forEach((t=>{var e;return t.len=null==(e=N[t.symbolId])?void 0:e.len}));return{xml:U.documentElement,viewBox:z,paths:E,labels:M,idsTree:Y,assetTypes:G,symbolsMap:N,uses:R,units:j}}}const Qd=Jl,Kd=new Ui;new uu,new class extends Xu{constructor(t=1,e=0,i=0,n=0,s=0,r=1,a=0,o=0,h=0,l=0,u=1,c=0,d=0,p=0,f=0,m=1){super(t,e,i,n,s,r,a,o,h,l,u,c,d,p,f,m)}setByMatrix3(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[4]=i[3],e[8]=0,e[12]=i[6],e[1]=i[1],e[5]=i[4],e[9]=0,e[13]=i[7],e[2]=0,e[6]=0,e[10]=1,e[14]=0,e[3]=0,e[7]=0,e[11]=0,e[15]=1,this}getMatrix3Array(t=[]){const e=this.elements;return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[4],t[4]=e[5],t[5]=0,t[6]=e[12],t[7]=e[13],t[8]=1,t}};const tp=new We,ep=new lu;new Zd,new Zd,new Zd,new Zd;class ip extends gs{constructor(t={}){super(t),c(this,"type","Group2"),c(this,"isGroup",!0),c(this,"versions",[]),c(this,"params"),c(this,"alignCenter",!1),c(this,"dynamically",!1),c(this,"usedCache",!1),c(this,"wireframe",!1),c(this,"showPoints",!1),this.params=t,void 0!==t.usedCache&&(this.usedCache=t.usedCache),void 0!==t.wireframe&&(this.wireframe=t.wireframe),void 0!==t.showPoints&&(this.showPoints=t.showPoints),void 0!==t.alignCenter&&(this.alignCenter=t.alignCenter),void 0!==t.dynamically&&(this.dynamically=t.dynamically)}destroy(){super.destroy(),this.boundingBox.makeEmpty()}clone(t=!0,e=!1){return new(0,this.constructor)(this.params).copy(this,t,e)}copy(t,e=!0,i=!1){return super.copy(t,e,i),this.params=t.params,this.alignCenter=t.alignCenter,this.dynamically=t.dynamically,this.usedCache=t.usedCache,this.wireframe=t.wireframe,this.showPoints=t.showPoints,this}composeWireframeGeometryPath(t){return this.traverse((e=>{e.isShape&&e.geometry&&e.geometry.path&&t.addPath(e.geometry.path)})),t}raycast(t,e=[]){var i;if(!this.boundingBox||this.boundingBox.isEmpty())return e;if(!this.boundingBoxWorld.containsPoint(t.worldCoords))return e;let n=[];for(let e=0,s=null==(i=this.children)?void 0:i.length;e<s;e++)this.children[e].raycast(t,n);return n.length&&e.push(this),e}}let np=new WeakMap,sp=-1;function rp(t){var e,i;const n=[];return"string"==typeof t.fill?n.push(t.fill):(null==(e=t.fill)?void 0:e.isColor)?n.push(t.fill.getHexString()):t.fill instanceof CanvasGradient||t.fill instanceof CanvasPattern?np.has(t.fill)||np.set(t.fill,"gradientPattern_"+ ++sp):n.push(""),"string"==typeof t.stroke?n.push(t.stroke):(null==(i=t.stroke)?void 0:i.isColor)?n.push(t.stroke.getHexString()):t.stroke instanceof CanvasGradient||t.stroke instanceof CanvasPattern?np.has(t.stroke)||np.set(t.stroke,"gradientPattern_"+ ++sp):n.push(""),n.push(void 0!==t.lineWidth?t.lineWidth.toString():""),n.push(void 0!==t.lineDash?t.lineDash.toString():""),n.push(void 0!==t.lineDashOffset?t.lineDashOffset.toString():""),n.push(void 0!==t.lineCap?t.lineCap.toString():""),n.push(void 0!==t.fillOpacity?t.fillOpacity.toString():""),n.push(void 0!==t.strokeOpacity?t.strokeOpacity.toString():""),n.push(void 0!==t.opacity?t.opacity.toString():""),t.isText&&(n.push(void 0!==t.text?t.text:""),n.push(void 0!==t.fontSize?t.fontSize.toString():"")),n.join("_")}class ap{constructor(t){c(this,"fill"),c(this,"stroke"),c(this,"lineWidth"),c(this,"lineDash"),c(this,"lineDashOffset"),c(this,"lineCap"),c(this,"lineJoin"),c(this,"fillOpacity"),c(this,"strokeOpacity"),c(this,"opacity"),c(this,"featureKey"),c(this,"map"),this.fill=null==t?void 0:t.fill,this.stroke=null==t?void 0:t.stroke,this.lineWidth=null==t?void 0:t.lineWidth,this.lineDash=null==t?void 0:t.lineDash,this.lineDashOffset=null==t?void 0:t.lineDashOffset,this.lineCap=(null==t?void 0:t.lineCap)||"round",this.lineJoin=(null==t?void 0:t.lineJoin)||"miter",void 0!==(null==t?void 0:t.fillOpacity)?this.fillOpacity=null==t?void 0:t.fillOpacity:this.fillOpacity=1,this.featureKey=rp(this)}}class op extends Yh{constructor(t){super(t),this._init(t)}buildPath(t,e,i){const n=this.percent;if(0===n)return;let{x1:s,y1:r,x2:a,y2:o}=e||this;s&&r&&a&&o&&(t.moveTo(s,r),n&&n<1&&(a=s*(1-n)+a*n,o=r*(1-n)+o*n),t.lineTo(a,o))}}class hp extends gs{constructor(t=new op,e=new ap,i){super(i),c(this,"name","Shape"),c(this,"isShape",!0),c(this,"geo"),c(this,"mtl"),c(this,"boundingBox",new ai),this.geo=t,this.mtl=e,(null==i?void 0:i.name)&&(this.name=i.name)}destroy(){super.destroy()}computeBoundingBox(){this.boundingBox.makeEmpty(),this.geo.computeBoundingBox(this.boundingBox);for(let t=0,e=this.children.length;t<e;t++)this.boundingBox.union(this.children[t].computeBoundingBox());return this.boundingBox}buildPath(t,e,i){this.geo.buildPath(t)}raycast(t,e=[]){var i,n;if(super.raycast(t,e),!this.boundingBox||this.boundingBox.isEmpty())return e;if(this.boundingBoxWorld.isEmpty()&&this.updateBoundingBox(),t.intersectType)cp.copy(t.worldBox),(cp.containsBox(this.boundingBoxWorld)||(null==(n=this.geo)?void 0:n.isBoxIntersectsPath(cp.applyMatrix3(up.copy(this.matrixWorld).invert()))))&&e.push(this);else{if(!this.boundingBoxWorld.containsPoint(t.worldCoords))return e;lp.copy(t.worldCoords).applyMatrix3(up.copy(this.matrixWorld).invert()),this.composeNode?this.traverseSome((t=>t.geo.isPointInPath(lp)))&&e.push(this):(null==(i=this.geo)?void 0:i.isPointInPath(lp))&&e.push(this)}return e}clone(t=!0,e=!1){return new(0,this.constructor)(this.geo,this.mtl).copy(this,t,e)}copy(t,e=!0,i=!1){return super.copy(t,e,i),this.params=ri.merge(this.params,t),this.renderOrder=t.renderOrder,i?(this.geo=ri.cloneDeep(t.geo),this.mtl=ri.cloneDeep(t.mtl)):(this.geo=t.geo,this.mtl=t.mtl),this}}const lp=new We,up=new Ui,cp=new ai;class dp extends ap{constructor(t){super(t),c(this,"text"),c(this,"isText",!0),c(this,"fontFamily","Arial"),c(this,"fontSize",12),c(this,"fontStyle",gp),c(this,"fontWeight",gp),c(this,"fontVariant",gp),c(this,"textDecoration",""),c(this,"textAlign",pp),c(this,"verticalAlign",fp),c(this,"textBaseline",mp),c(this,"lineHeight",1),c(this,"letterSpacing",0),c(this,"wrap",yp),c(this,"ellipsis",!1),this.text=null==t?void 0:t.text,this.fill=(null==t?void 0:t.fill)||Le.black,this.fontFamily=(null==t?void 0:t.fontFamily)||"Arial",this.fontSize=(null==t?void 0:t.fontSize)||12,this.fontStyle=(null==t?void 0:t.fontStyle)||gp,this.fontWeight=(null==t?void 0:t.fontWeight)||gp,this.textAlign=(null==t?void 0:t.textAlign)||pp,this.textBaseline=(null==t?void 0:t.textBaseline)||mp,this.featureKey=rp(this)}}const pp="center",fp="top",mp="middle",gp="normal",yp="word";class vp{static hasCache(t){return void 0!==xp[t]}static setCache(t,e){xp[t]=e}static getCache(t){return xp[t]}static getCachedFeatureKeys(){return Object.keys(xp)}static getMtl(t,e){let i=rp(t);return e&&(i=`${e}_${i}`),this.hasCache(i)||(t.text?this.setCache(i,new dp(t)):this.setCache(i,new ap(t))),this.getCache(i)}}const xp={};class bp extends Yh{constructor(t){super(t),this._init(t)}buildPath(t,e,i){if(0===this.percent)return;let{points:n}=e||this;if(n&&n.length&&!(n.length<2)){for(let e=0,i=n.length;e<i;e+=2)e?t.lineTo(n[e],n[e+1]):t.moveTo(n[e],n[e+1]);t.closePath()}}}class wp extends hp{constructor(t={}){void 0===t.fontSize&&(t.fontSize=12),void 0===t.renderOrder&&(t.renderOrder=1),super(new bp(t),new dp(t)),c(this,"name","Text"),c(this,"isText",!0),c(this,"size",new We),t.wireframe&&(this.wireframe=!0)}computeBoundingBox(){var t;if(!(null==(t=this.mtl)?void 0:t.text))return this.boundingBox;this.updateMatrixWorld(!0),Pn.measureText2(this.mtl.text||"",this.mtl.fontSize,this.size);const e=[];return e.push(-this.size.x/2,-this.size.y/2),e.push(e[0],e[1]+this.size.y),e.push(e[2]+this.size.x,e[3]),e.push(e[3],e[1]),this.geo.setPoints(e),super.computeBoundingBox(),this.boundingBox}buildPath(t,e,i){this.wireframe&&this.geo.buildPath(t)}}class _p extends Yh{constructor(t){super(t),this._init(t)}buildPath(t,e,i){let n,s,r,a,o,{x:h=0,y:l=0,w:u=0,h:c=0,r:d=0}=e||this;u<0&&(h+=u,u=-u),c<0&&(l+=c,c=-c),"number"==typeof d?n=s=r=a=d:d instanceof Array?1===d.length?n=s=r=a=d[0]:2===d.length?(n=r=d[0],s=a=d[1]):3===d.length?(n=d[0],s=a=d[1],r=d[2]):(n=d[0],s=d[1],r=d[2],a=d[3]):n=s=r=a=0,n+s>u&&(o=n+s,n*=u/o,s*=u/o),r+a>u&&(o=r+a,r*=u/o,a*=u/o),s+r>c&&(o=s+r,s*=c/o,r*=c/o),n+a>c&&(o=n+a,n*=c/o,a*=c/o),t.moveTo(h+n,l),t.lineTo(h+u-s,l),0!==s&&t.arc(h+u-s,l+s,s,-Math.PI/2,0),t.lineTo(h+u,l+c-r),0!==r&&t.arc(h+u-r,l+c-r,r,0,Math.PI/2),t.lineTo(h+a,l+c),0!==a&&t.arc(h+a,l+c-a,a,Math.PI/2,Math.PI),t.lineTo(h,l+n),0!==n&&t.arc(h+n,l+n,n,Math.PI,1.5*Math.PI)}}class Sp extends hp{constructor(t,e=new ap,i){super(new _p({x:0,y:0,width:1,height:1}),e,i),c(this,"name","SkinnedShape"),this.boundingBox.copy(t),this.geo.lineWidth=e.lineWidth,this.geo.thinLine=!0,Ep.copy(this.boundingBox),Mp.copy(Ep.min),Ep.getSize(Ap),this.geo.x=Mp.x,this.geo.y=Mp.y,this.geo.w=Ap.x,this.geo.h=Ap.y}computeBoundingBox(){return this.boundingBox}}const Ep=new ai,Mp=new We,Ap=new We;class Tp extends Fi{constructor(t={}){super(),c(this,"type","Object2"),c(this,"position",new We),c(this,"rotation",new We),c(this,"scaled",new We(1,1)),c(this,"flipY",!1),c(this,"matrix",new Ui),c(this,"matrixAutoUpdate",!1),void 0!==t.flipY&&(this.flipY=t.flipY),this.flipY&&this.setScale(1,-1)}setPosition(t){return this.position.set(t.x,t.y),this}setRotation(t){return this.rotation.set(t,t),this}setScale(t,e){return this.scaled.set(t,e),this}translate(t,e){return this.position.x+=t,this.position.y+=e,this}rotate(t){return this.rotation.x+=t,this}scale(t,e){return e?(this.scaled.x*=t,this.scaled.y*=e):this.scaled.multiplyScalar(t),this}applyMatrix3(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.rotation,this.scaled)}updateMatrix(){this.matrix.compose(this.position,this.rotation,this.scaled)}copy(t){return this.position.copy(t.position),this.rotation.copy(t.rotation),this.scaled.copy(t.scaled),this.flipY=t.flipY,this.matrix.copy(t.matrix),this.matrixAutoUpdate=t.matrixAutoUpdate,this}}class Cp extends Tp{constructor(t={}){void 0===t.flipY&&(t.flipY=!0),super(t),c(this,"isTexture",!0),c(this,"type","Texture"),c(this,"params"),c(this,"uuid",ms()),c(this,"image"),c(this,"userData",{}),this.params=t}destroy(){}dispose(){}clone(){return new this.constructor(this.params).copy(this)}copy(t){return super.copy(t),this.uuid=ms(),this.image=t.image,this.userData=ri.cloneDeep(t.userData),this}}class Ip{constructor(t,e){c(this,"bindingStates"),this.ctx=t,this.bindingStates=e}destroy(){}setCtx(t){return this.ctx=t,this}render(t){var e,i,n;if(this.ctx&&(Dp=this.ctx,Dp.save(),t.isText?this.renderText(Dp,t):t.isShape&&(Dp.beginPath(),this.setCtxTransform(Dp,t),this.bindingStyle(Dp,t),this.renderShape(Dp,t),this.renderLineDash(Dp,t)),t.isShape&&(null==(i=null==(e=t.mtl)?void 0:e.map)?void 0:i.image)&&this.renderShapeTexture(Dp,t),Dp.restore(),t.composeNode&&(null==(n=t.children)?void 0:n.length)))for(let e,i=0,n=t.children.length;i<n;i++)e=t.children[i],e.isShape&&this.render(e)}renderFill(t){var e;t.mtl.fill&&(null==(e=this.ctx)||e.fill())}renderStroke(t){var e;t.mtl.stroke&&(null==(e=this.ctx)||e.stroke())}renderText(t,e){if(!t)return;const{text:i,fill:n,stroke:s,fontSize:r,fontFamily:a,fontWeight:o,textAlign:h,textBaseline:l}=e.mtl;if(!i)return;e.modelViewMatrix.decompose(Bp,Pp,kp);const u=(r||12)*kp.x;t.font=`${o} ${u}px ${a}`,t.fillStyle=n||Le.black,h&&(t.textAlign=h),l&&(t.textBaseline=l);let c=Bp.y;if("middle"===l){const e=t.measureText(i);c+=(e.actualBoundingBoxAscent-e.actualBoundingBoxDescent)/2}t.fillText(i,Bp.x,c)}renderWireFrame(t){this.ctx&&(Rp.copy(t.boundingBox).applyMatrix3(t.modelViewMatrix).getSize(Hp),zp.copy(Rp.min),this.ctx.save(),this.ctx.beginPath(),this.ctx.lineWidth=1,this.ctx.strokeStyle=Le.red,this.ctx.setLineDash([5,10]),this.ctx.strokeRect(zp.x,zp.y,Hp.x,Hp.y),this.ctx.stroke(),this.ctx.restore())}renderMerged(t){this.ctx&&(Dp=this.ctx,Dp.save(),t.isShape&&(Dp.beginPath(),this.setCtxTransform(Dp,t),this.bindingStyle(Dp,t),this.renderShape(Dp,t)),Dp.restore())}setCtxTransform(t,e){const i=Lp.equals(e.modelViewMatrix);Lp.copy(e.modelViewMatrix),i||Lp.getComponents(Np),t.transform(...Np)}bindingStyle(t,e){if(e.mtl.fill){let i;i=e.mtl.fill.isColor?e.mtl.fill.getHexString():e.mtl.fill,void 0!==e.mtl.fillOpacity&&(t.globalAlpha=e.mtl.fillOpacity),i&&(t.fillStyle=i)}if(e.mtl.stroke){if(e.geo.thinLine){const e=Math.sqrt(Np[0]*Np[0]+Np[1]*Np[1]);t.lineWidth=Math.abs(1/e)}else e.geo.lineWidth?t.lineWidth=e.geo.lineWidth:t.lineWidth=1;let i;e.mtl.lineCap&&(t.lineCap=e.mtl.lineCap),e.mtl.lineJoin&&(t.lineJoin=e.mtl.lineJoin),void 0!==e.mtl.strokeOpacity&&(t.globalAlpha=e.mtl.strokeOpacity),i=e.mtl.stroke.isColor?e.mtl.stroke.getHexString():e.mtl.stroke,i&&(t.strokeStyle=i)}}renderShape(t,e){e.buildPath(t),e.geo.closed&&t.closePath(),this.renderFill(e),this.renderStroke(e)}renderLineDash(t,e){if(e.mtl.stroke&&e.mtl.lineDash&&void 0!==e.mtl.lineDashOffset){if(t.beginPath(),e.buildPath(t),e.geo.thinLine){const e=Math.sqrt(Np[0]*Np[0]+Np[1]*Np[1]);t.lineWidth=Math.abs(1/e)}else e.geo.lineWidth?t.lineWidth=e.geo.lineWidth:t.lineWidth=1;t.strokeStyle=Le.white,t.setLineDash(e.mtl.lineDash),t.lineDashOffset=e.mtl.lineDashOffset,t.globalAlpha=1,t.stroke()}}renderShapeTexture(t,e){var i,n,s,r,a,o,h,l;(null==(n=null==(i=null==e?void 0:e.mtl)?void 0:i.map)?void 0:n.image)&&(!(null==(a=null==(r=null==(s=null==e?void 0:e.mtl)?void 0:s.map)?void 0:r.image)?void 0:a.width)||null==(l=null==(h=null==(o=null==e?void 0:e.mtl)?void 0:o.map)?void 0:h.image)||l.height,e.mtl.map.matrix.getComponents(Op),t.transform(...Op),t.drawImage(e.mtl.map.image,0,0))}}let Dp;const Lp=new Ui,Bp=new We,Pp=new We,kp=new We,Np=[1,0,0,1,0,0],Op=[1,0,0,1,0,0],Rp=new ai,zp=new We,Hp=new We,Wp=class t{constructor(){c(this,"cache",new Map),c(this,"maxSize",2048),c(this,"renderer",new Ip),c(this,"_scaled",new We(1,1))}dispose(){this.clear()}static getInstance(){return Fp||(Fp=new t),Fp}static set(t,e){this.getInstance().set(t,e)}static clear(){this.getInstance().clear()}scale(t=1,e=1){return t||e?(this._scaled.set(t,e),this):this}has(t){return this.cache.has(t)}set(t,e){if(!t||!e)throw new Error("error input");this.cache.set(t,e)}get(t){if(!t)throw new Error("error input");return this.cache.get(t)}clear(){Object.values(this.cache).forEach((t=>t.destroy())),this._scaled.identity(),this.cache=new Map,function(){var t;const e=sf();if(!(null==(t=null==e?void 0:e.children)?void 0:t.length))return;for(let t=e.children.length-1;t>=0;t--)e.removeChild(e.children[t])}()}calculateMipLevel(t){return t>=1?0:t>=.5?1:t>=.25?2:3}setByShape(t,e,i,n){const s=this.getTextureByShape(e,i,n);return e.userData.textureKey=s.userData.textureKey=t,this.renderShapeTexture(e,s),this.set(t,s),s}getTextureByShape(t,e,i,n){const s=new Cp;if(t.boundingBox.isEmpty())throw new Error("get boundingBox error");qp.identity(),jp.identity(),e&&!(null==e?void 0:e.isEmpty())?Qp.copy(e):Qp.copy(t.boundingBox),Qp.getSize(qp),Qp.getCenter(jp),i&&!i.isEmpty()?i.getSize(Yp):Yp.copy(qp),(Yp.x<Vp.x||Yp.y<Vp.y)&&Yp.normalize().multiplyScalar(200),Yp.x<1&&(Yp.x=1),Yp.y<1&&(Yp.y=1),$p.set(Ae.config.width,Ae.config.height);const r=Yp.length()/$p.length();r>1&&Yp.multiplyScalar(1/r);const a=Yp.length()/qp.length();return Kp.copy(qp).multiplyScalar(-.5).add(jp).multiplyScalar(a).negate(),tf.identity(),ef.set(a,a),Xp.compose(Kp,tf,ef),Gp.copy(qp).multiplyScalar(-.5).add(jp),s.position.copy(Gp),s.rotation.copy(tf),s.scaled.multiplyScalar(1/ef.x,1/ef.y),s.updateMatrix(),s}renderShapeTexture(t,e,i){var n;const s=Pn.create(Yp.x,Yp.y),r=Pn.getContext2D(s,{alpha:!0});r.clearRect(0,0,s.width,s.height),r.beginPath(),r.strokeStyle=Le.darkRed,r.lineWidth=1,r.strokeRect(0,0,s.width,s.height),r.closePath(),this._transform(r,t),this._bindStyle(r,t),t.buildPath(r),this._fill(r,t),this._stroke(r,t),null==(n=t.children)||n.forEach((t=>{t.isShape&&(this._bindStyle(r,t),t.buildPath(r),this._fill(r,t),this._stroke(r,t),t.isText&&this._renderText(r,t))})),e.image=s}_transform(t,e){Xp.getComponents(nf),t.transform(...nf)}_bindStyle(t,e){var i,n,s;t.beginPath();const{fill:r,stroke:a}=(null==(i=e.userData)?void 0:i.style)||{};if(r&&(t.fillStyle=r),a){let i=e.mtl.lineWidth;i||(i=1/Math.min(Math.abs(this._scaled.x),Math.abs(this._scaled.y))),t.lineWidth=i,t.strokeStyle=(null==(s=null==(n=e.userData)?void 0:n.style)?void 0:s.stroke)||Le.black}}_fill(t,e){var i,n;(null==(n=null==(i=e.userData)?void 0:i.style)?void 0:n.fill)&&t.fill()}_stroke(t,e){var i,n;(null==(n=null==(i=e.userData)?void 0:i.style)?void 0:n.stroke)&&t.stroke()}_renderText(t,e){const{text:i,fill:n,stroke:s,fontSize:r,fontFamily:a,fontWeight:o,textAlign:h,textBaseline:l}=e.mtl;if(!i)return;Zp.set,Jp.copy(e.matrix).decompose(Kp,tf,ef);const u=(r||12)*ef.x;t.font=`${o} ${u}px ${a}`,h&&(t.textAlign=h),l&&(t.textBaseline=l);let c=Kp.y;s?(t.strokeStyle=s,t.lineWidth=1*Math.abs(1/nf[0]),t.strokeText(i,Kp.x,c)):(t.fillStyle=n||Le.black,t.fillText(i,Kp.x,c))}};c(Wp,"DEBUG_DisplayCachedTexture",ri.throttle(((t=80,e=.8)=>{const i=Fp;if(!i)return;let n=sf();if(n||(n=function(t=80,e=.8){const i=document.createElement("div");function n(){i.style.opacity="1"}function s(){i.style.opacity=e.toString()}return i.setAttribute("id","DEBUG_Displaycached"),i.style.position="absolute",i.style.width=t+"px",i.style.height="92vh",i.style.background=`rgba(255, 255, 255, ${e})`,i.style.left="20px",i.style.top="20px",i.style.overflow="auto",i.style.padding="6px",i.style.opacity=e.toString(),i.addEventListener("mouseenter",n),i.addEventListener("mouseleave",s),document.body.appendChild(i),i}(t,e)),!n)throw new Error("dom not found");!function(t,e){e.forEach(((e,i)=>{e&&e.image&&function(t,e,i){let n;for(let i=0,s=t.childNodes.length;i<s;i++)if(t.childNodes[i].getAttribute("id")===e){n=t.childNodes[i];break}n?function(t,e){if(!e.image)return;const i=t.querySelector("canvas");if(!i)return;const n=i.getContext("2d",{alpha:!0});if(!n)throw new Error("getContext error");n.clearRect(0,0,i.width,i.height),n.save(),n.scale(window.devicePixelRatio,window.devicePixelRatio),n.drawImage(e.image,0,0),n.restore()}(n,i):function(t,e,i){if(!i.image)return;!i.image.width||i.image.height;const n=Ae.document.createElement("div");n.setAttribute("id",e),n.style.display="flex",n.style.flexDirection="column";const s=Pn.createCanvas({containerId:t.id,width:i.image.width,height:i.image.height,dpr:window.devicePixelRatio});s.style.border=`${Le.yellow} 1px solid`,s.style.maxWidth=parseInt(t.style.width)-2+"px",s.style.maxHeight=parseInt(s.style.maxWidth)/(i.image.width/i.image.height)+"px";const r=s.getContext("2d",{alpha:!0});if(!r)throw new Error("getContext error");r.save(),r.scale(window.devicePixelRatio,window.devicePixelRatio),r.drawImage(i.image,0,0),r.restore(),n.appendChild(s);const a=Ae.document.createElement("p");function o(){const t=s.toDataURL("image/png",.6),e=document.createElement("a"),i=new MouseEvent("click");e.download=`thumb.${Date.now()}.png`,e.href=t,e.dispatchEvent(i)}a.innerHTML=i.image.width+" * "+i.image.height,a.innerHTML+="<br/>"+e,a.style.margin="0",a.style.padding="0",a.style.lineHeight="1.2",a.style.fontSize="10px",a.style.padding="3px 0 6px 0",a.style.color=Le.black,n.appendChild(a),t.appendChild(n),n.addEventListener("click",o)}(t,e,i)}(t,i,e)}))}(n,i.cache)}),5e3));let Fp,Up=Wp;const Vp=new We(50,50),qp=new We,jp=new We,Yp=new We,Gp=new We,$p=new We,Xp=new Ui,Zp=new Ui,Jp=new Ui,Qp=new ai,Kp=new We,tf=new We,ef=new We,nf=[1,0,0,1,0,0];function sf(){var t;return"undefined"==typeof window?null:null==(t=null==window?void 0:window.document)?void 0:t.getElementById("DEBUG_Displaycached")}const rf=class t{static getObject2BySvg(t,e){const i=(new Jd).parse(t,this.use3DShape),n=this.getShapesByParsed(i,e);if(1==(null==n?void 0:n.length))return n[0];const s=new ip;return s.adds(n),s}static getShapesBySvg(t,e){const i=(new Jd).parse(t,this.use3DShape);return this.getShapesByParsed(i,e)}static getShapesByParsed(t,e){this.use3DShape=!!(null==e?void 0:e.use3DShape);const i=[],n=this.getPolygons2ByPaths(null==t?void 0:t.paths,e);(null==n?void 0:n.length)&&i.push(...n);const s=this.getLabels(null==t?void 0:t.labels,e);return(null==s?void 0:s.length)&&i.push(...s),i}static getPolygons2ByPaths(t,e){if(!t||!t.length)return;const i=[];for(let n=0,s=t.length;n<s;n++){const s=this.getPolygonsByPath(t[n],e);(null==s?void 0:s.length)&&i.push(...s)}return i}static getPolygonsByPath(t,e){var i,n;if(!t)return;const s=[],{userData:r}=t;let{fill:a,stroke:o,strokeWidth:h,thinLine:l,fillOpacity:u,strokeOpacity:c,opacity:d}=(null==r?void 0:r.style)||{};(null==e?void 0:e.fill)&&(a=e.fill),(null==e?void 0:e.stroke)&&(o=e.stroke),(null==e?void 0:e.lineWidth)&&(h=e.lineWidth),(null==e?void 0:e.thinLine)&&(l=!!e.thinLine),(null==e?void 0:e.fillOpacity)&&(u=e.fillOpacity),(null==e?void 0:e.strokeOpacity)&&(c=e.strokeOpacity),(null==e?void 0:e.opacity)&&(d=e.opacity),"none"!==a&&"transparent"!==a||(a=void 0,ri.unset(r,"style.fill")),"none"!==o&&"transparent"!==o||(o=void 0),o&&!h&&(h=1);const p=vp.getMtl({fill:a,stroke:o,lineWidth:h,fillOpacity:u,strokeOpacity:c,opacity:d}),f=[];if(this.use3DShape){const n=Jd.createShapes(t),s=(null==(i=t.currentPath)?void 0:i.autoClose)||!1;for(let t,i=0,r=(null==n?void 0:n.length)||0;i<r;i++){t=n[i];const r=df(t,{flipY:null==e?void 0:e.flipY,strokeWidth:h,thinLine:l,closed:s});r&&f.push(r)}}else{const i=new $h({cmds:t.getCmds(),flipY:null==e?void 0:e.flipY,lineWidth:h,thinLine:l});f.push(i)}if(null==f?void 0:f.length){const t=Kh.mergeGeoShapes(f),i=new hp(t,p);i.userData=ri.cloneDeep(r),(null==(n=i.userData)?void 0:n.id)&&(i.name=i.userData.id),void 0!==(null==e?void 0:e.selectable)?i.selectable=e.selectable:i.userData.assetType&&(i.selectable=!0),s.push(i)}return s.length?s:void 0}static getInstanceBySymbol(e,i){var n,s,r,a,o,h,u,c;if(!e||!(null==(n=e.paths)?void 0:n.length))return;const d=[],p=ri.cloneDeep(i.userData),f=[];for(let t,i=0,n=(null==(s=null==e?void 0:e.paths)?void 0:s.length)||0;i<n;i++)t=e.paths[i].clone(),t.userData=p,f.push(t);const m=this.getLabels(null==e?void 0:e.labels);if(!e.symbolId)return;const g=new ai;f.forEach((t=>g.union(t.computeBoundingBox()))),null==m||m.forEach((t=>g.union(cf.copy(t.computeBoundingBox()).applyMatrix3(t.matrix)))),of.copy(i.transform).decompose(hf,lf,uf);const y=new ap(l({},null==(r=i.userData)?void 0:r.style)),v=new Sp(g,y,{flipY:!0});if(v.userData=p,d.push(v),v.applyMatrix3(of.flipSvgY()),v.computeBoundingBox(),v.updateMatrix(),v.updateMatrixWorld(!0),!Up.getInstance().has(e.symbolId)){const i=new hp;ri.set(i,"userData.id",e.symbolId),ri.set(i,"userData.style",ri.merge({},e.style,p.style));for(let n,s=0,r=(null==(a=null==e?void 0:e.paths)?void 0:a.length)||0;s<r;s++){n=e.paths[s];const r=ri.merge({},null==(o=n.userData)?void 0:o.style,p.style,{flipY:!1});r.stroke&&!r.lineWidth&&(r.lineWidth=null==(u=null==(h=n.userData)?void 0:h.style)?void 0:u.strokeWidth),r.stroke&&!r.lineWidth&&(r.lineWidth=(null==(c=p.style)?void 0:c.strokeWidth)||1);const a=t.getPolygonsByPath(n,r);(null==a?void 0:a.length)&&i.adds(a)}(null==m?void 0:m.length)&&i.adds(m),i.computeBoundingBox(),i.updateMatrix(),i.updateMatrixWorld(!0),i.updateBoundingBox(),Up.getInstance().scale(uf.x,uf.y).setByShape(e.symbolId,i,g)}let x=Up.getInstance().get(e.symbolId);return x?(x=x.clone(),x.scaled.multiplyScalar(1,-1),x.updateMatrix(),v.mtl.map=x,d):void 0}static getLabels(t,e){if(!(null==t?void 0:t.length))return;const i=[];for(let n=0,s=(null==t?void 0:t.length)||0;n<s;n++){const s=this.getLabel(t[n],e);(null==s?void 0:s.length)&&i.push(...s)}return i}static getLabel(t,e){var i,n,s,r;if(!t||!t.textContent)return;const a=[];let{fill:o,stroke:h}=(null==(i=t.userData)?void 0:i.style)||{};o&&"none"!==o&&"transparent"!==o||h||(o=Le.lightBlack);const l=new wp({text:t.textContent,fontSize:t.userData.style.fontSize,fill:o,stroke:h,flipY:null==e?void 0:e.flipY,wireframe:null==e?void 0:e.wireframe});t.userData&&(l.userData=ri.cloneDeep(t.userData)),(null==(n=l.userData)?void 0:n.id)&&(l.name=l.userData.id),void 0===(null==(r=null==(s=l.userData)?void 0:s.style)?void 0:r.fill)&&ri.set(l.userData,"style.fill",o),l.renderOrder=1,a.push(l),t.transform&&(of.setFromMatrix(t.transform),(null==e?void 0:e.flipY)&&of.scale(1,-1),l.applyMatrix3(of));const{id:u,pid:c,aid:d,assetType:p,layerType:f}=t.userData;return a}};c(rf,"use3DShape",!1);let af=rf;const of=new Ui,hf=new We,lf=new We,uf=new We,cf=new ai;function df(t,e){var i,n;const{closed:s,flipY:r,strokeWidth:a,thinLine:o}=e||{};null==(i=null==t?void 0:t.curves)||i.length;const h=pf(t.curves),l=[];for(let e=0,i=null==(n=null==t?void 0:t.holes)?void 0:n.length;e<i;e++){const i=pf(t.holes[e].curves);l.push(...i)}h.push(...l);return new $h({cmds:h,closed:s,flipY:r,lineWidth:a,thinLine:o})}function pf(t){const e=[];for(let i,n=0,s=t.length;n<s;n++){const s=t[n],r=s.getPoint(0),a=!n;switch(s.type){case"LineCurve":a&&e.push([ln,...s.v1.toArray()]),e.push([un,...s.v2.toArray()]);break;case"QuadraticBezierCurve":{a&&e.push([ln,r.x,r.y]);const t=[];t.push(dn),t.push(...s.v1.toArray()),t.push(...s.v2.toArray()),e.push(t);break}case"CubicBezierCurve":{a&&e.push([ln,r.x,r.y]);const t=[];t.push(cn),t.push(...s.v0.toArray()),t.push(...s.v1.toArray()),t.push(...s.v2.toArray()),t.push(...s.v3.toArray()),e.push(t);break}case"EllipseCurve":{a&&e.push([ln,r.x,r.y]);const t=[];t.push(gn),t.push(s.aX),t.push(s.aY),t.push(s.xRadius),t.push(s.yRadius),t.push(s.aRotation),t.push(s.aStartAngle),t.push(s.aEndAngle),t.push(s.aClockwise?1:0),e.push(t);break}}i=s}return e}const ff=Ae.window||window,mf=ff.requestAnimationFrame||ff.webkitRequestAnimationFrame||ff.mozRequestAnimationFrame||ff.oRequestAnimationFrame||ff.msRequestAnimationFrame||function(t){ff.setTimeout(t,1e3/60)},gf=ff.cancelAnimationFrame||ff.webkitCancelAnimationFrame||ff.mozCancelAnimationFrame||ff.oCancelAnimationFrame||ff.msCancelAnimationFrame||clearTimeout;class yf{constructor(t,e,i=16.7,n){var s;if(c(this,"duration",16.7),c(this,"onComplete"),c(this,"generator"),c(this,"t",null),c(this,"stopped",!1),i&&(this.duration=i),this.onComplete=n,!e||"function"!=typeof e)throw new Error("[task] callback method is null!");let r="number"==typeof t&&t||Array.isArray(t)&&t.length;if(!r)throw new Error("[task] task list is empty ...");if(1===r)return e(0),void(null==(s=this.onComplete)||s.call(this));this.generator=this.queue(r,e),this.t=null,this.stopped=!1,this.next()}next(){var t;if(!this.generator||this.stopped)return;const{generator:e}=this,i=performance.now();let n=null;do{if(!e)break;if(n=e.next(),n.done){null==(t=this.onComplete)||t.call(this),this.clear();break}}while(!n.done&&performance.now()-i<this.duration);n.done||this.stopped||(this.t=mf(this.next.bind(this)))}*queue(t,e){let i=performance.now();for(let n=0;n<t;n++)performance.now()-i>=this.duration&&(i=performance.now(),yield),this.stopped||e(n)}clear(){this.stopped=!0,this.generator=void 0,this.onComplete=void 0,this.t&&(gf(this.t),this.t=null)}}class vf extends Fi{constructor(t={}){super(),c(this,"name","Adapter2@"+si.now()),c(this,"params"),c(this,"xml"),c(this,"units"),c(this,"paths"),c(this,"symbolsMap"),c(this,"uses"),c(this,"labels"),c(this,"idsTree"),c(this,"scene"),c(this,"boundingBox",new ai),c(this,"requestHeader",{}),c(this,"resources",[]),c(this,"_viewBox",new ai),c(this,"_tic"),c(this,"_tic2"),c(this,"_assetTypes",[]),c(this,"_resourcesMap",{}),c(this,"_assetTypeMap",{}),c(this,"_idsMap",{}),c(this,"_boundingBoxMap",{}),c(this,"use3DShape",!1),this.params=t}destroy(){super.destroy(),this.clear()}clear(){this.xml=void 0,this.paths=[],this.symbolsMap={},this.uses=[],this.labels=[],this.idsTree=[],this._idsMap={},this.boundingBox.makeEmpty(),this._resourcesMap={},this._assetTypeMap={},this._assetTypes=[],Up.clear()}setRequestHeader(t){return this.requestHeader=t,this}load(t,e){return d(this,null,(function*(){var e,i;if(!t)throw"url not found";let n;if(this.dispatchEvent({type:Mi.INITIALIZATION_START}),this.clear(),af.use3DShape=this.use3DShape,this.use3DShape)n=yield(new Jd).setRequestHeader({}).setPixelRatio((null==(e=this.params)?void 0:e.dpr)||1).loadAsync(t).catch((()=>({})));else{const e=yield(new Ns).loadAsync(t).catch((()=>({})));n=yield Nn.setInstancedMesh(null==(i=Ae.config)?void 0:i.instancedMesh).parse(e)}return n}))}initResources(t,e){var i,n,s,r,a,o;if(this.clear(),!this.scene)throw new Error("please bind a Scene first");if(this.xml=null==t?void 0:t.xml,!this.xml)return void this.dispatchEvent({type:Mi.INITIALIZATION_COMPLETE});this.units=null==t?void 0:t.units,this.paths=null==t?void 0:t.paths,this.symbolsMap=null==t?void 0:t.symbolsMap,this.uses=null==t?void 0:t.uses,this.labels=null==t?void 0:t.labels,this.idsTree=null==t?void 0:t.idsTree,this._assetTypes=null==t?void 0:t.assetTypes,(null==t?void 0:t.viewBox)&&this._viewBox.copy(t.viewBox).flipY(),this.recomputeIdsMap();const h=this,l=ri.chain(e).flatMap((t=>this._idsMap[t])).commit().uniq().value();if(null==(i=null==t?void 0:t.paths)?void 0:i.length){const e=null==t?void 0:t.paths;this._tic&&this._tic.clear(),this._tic=new yf(e,(function(t){var i,n,s,r,a,o,u,c,d,p,f;const m=af.getPolygonsByPath(e[t],{flipY:!0});if(null==m?void 0:m.length)for(let t=0,e=(null==m?void 0:m.length)||0;t<e;t++){const e=null==(n=null==(i=m[t])?void 0:i.userData)?void 0:n.id;(null==l?void 0:l.length)&&!l.includes(e)&&(m[t].visible=!1),h._resourcesMap[e]||(h._resourcesMap[e]=[]),h._resourcesMap[e].push(m[t]),null==(s=h.scene)||s.add(m[t]),(null==(a=null==(r=m[t])?void 0:r.userData)?void 0:a.assetType)&&(h._assetTypeMap[null==(u=null==(o=m[t])?void 0:o.userData)?void 0:u.assetType]||(h._assetTypeMap[null==(d=null==(c=m[t])?void 0:c.userData)?void 0:d.assetType]=[]),h._assetTypeMap[null==(f=null==(p=m[t])?void 0:p.userData)?void 0:f.assetType].push(m[t]))}}),3,(function(){var t;null==(t=h.scene)||t.computeBoundingBox(),h.scene.needsUpdate=!0}))}if(null==(n=null==t?void 0:t.labels)?void 0:n.length){const e=null==t?void 0:t.labels;this._tic2&&this._tic2.clear(),this._tic2=new yf(e,(function(t){var i,n,s;const r=af.getLabel(e[t],{flipY:!0});if(null==r?void 0:r.length)for(let t=0,e=(null==r?void 0:r.length)||0;t<e;t++){r[t].renderOrder=9;const e=null==(n=null==(i=r[t])?void 0:i.userData)?void 0:n.id;(null==l?void 0:l.length)&&!l.includes(e)&&(r[t].visible=!1),h._resourcesMap[e]||(h._resourcesMap[e]=[]),h._resourcesMap[e].push(r[t]),null==(s=h.scene)||s.add(r[t])}}),3,(()=>{var t;null==(t=this.scene)||t.computeBoundingBox(),this.scene.needsUpdate=!0}))}if(null==(s=null==t?void 0:t.instances)?void 0:s.length){const e=null==t?void 0:t.instances;for(let t,i=0,n=e.length;i<n;i++){t=e[i];const n=af.getInstanceBySymbol(this.symbolsMap[t.symbolId],t);if(null==n?void 0:n.length)for(let t=0,e=(null==n?void 0:n.length)||0;t<e;t++){const e=null==(a=null==(r=n[t])?void 0:r.userData)?void 0:a.id;(null==l?void 0:l.length)&&!l.includes(e)&&(n[t].visible=!1),null==(o=this.scene)||o.add(n[t])}}}}bindScene(t){return this.scene=t,this}recomputeIdsMap(){var t;if(!(null==(t=this.idsTree)?void 0:t.length))return;const e=[];an(this.idsTree,(t=>{var i;if(e.push(t.value),!(null==(i=t.children)?void 0:i.length))return;const n=on(t);this._idsMap[t.value]=ri.map(n,"value")}))}getAssetIdsByType(t){let e=[];Array.isArray(t)||(t=[t]);for(let i,n=0,s=t.length;n<s;n++){i=t[n];let s=Object.hasOwnProperty.call(this._idsMap,i)?this._idsMap[i]:void 0;(null==s?void 0:s.length)||(s=Object.hasOwnProperty.call(this._idsMap,i+"-assets")?this._idsMap[i+"-assets"]:void 0),(null==s?void 0:s.length)&&(e=e.concat(s))}return e}getLayers(t=2){return this.xml?rn(this.xml,t):[]}getViewBox(){return this._viewBox}getAssetTypes(){return this._assetTypes}getByAssetType(t){return this._assetTypeMap[t]||[]}updateLayersVisibility(t,e=!1){if(!this.scene)throw new Error("please bind a Scene first");const i=ri.chain(t).flatMap((t=>this._idsMap[t])).concat(t).compact().uniq().value();this.scene.traverse((t=>{var n,s;(null==(n=t.userData)?void 0:n.id)&&i.includes(t.userData.id)?t.visible=e:(null==(s=t.userData)?void 0:s.id)&&(t.visible=!e)})),this.scene.needsUpdate=!0}getBoundingBoxByIds(t){if(!this._resourcesMap||!Object.keys(this._resourcesMap).length)return;const e=new ai;Array.isArray(t)||(t=[t]);for(let i=0,n=null==t?void 0:t.length;i<n;i++){if(!this._resourcesMap.hasOwnProperty(t[i]))continue;const n=this._resourcesMap[t[i]];if(null==n?void 0:n.length)for(let t=0,i=null==n?void 0:n.length;t<i;t++)n[t].boundingBox.isEmpty()&&n[t].computeBoundingBox(),n[t].boundingBox.isEmpty()||e.union(n[t].boundingBox)}return e}transMmByUtils(t=0){return t*xf[ri.toLower(this.units||"mm")]}}const xf={mm:1,cm:.1,m:.001,inches:.0393701,inch:.0393701};class bf{constructor(t){c(this,"params"),c(this,"currentCamera"),c(this,"bindingStates",new WeakMap),c(this,"forceUpdate",!1),c(this,"currentState"),c(this,"cameraVersion"),c(this,"currentRenderState"),c(this,"ctxMap",{}),this.params=t}destroy(){this.bindingStates=new WeakMap,this.currentState=void 0,this.ctxMap={},this.reset()}reset(){this.forceUpdate=!0}setup(t,e,i){this.currentRenderState=e,this.currentCamera=i,this.currentState=this.getBindingState(t),this.ctxMap={};let n=this.needsUpdate(t);return(this.forceUpdate||n)&&this.saveCache(t),this.currentState}getBindingState(t){return this.bindingStates.has(t)||this.bindingStates.set(t,{id:t.id,uuid:t.uuid,needsUpdate:!0,featureKey:t.featureKey,version:-1,cameraVersion:-1,preShape:wf}),wf=t,this.bindingStates.get(t)}clearBindingState(){this.currentState&&(this.currentState.needsUpdate=!1,this.currentState.version=-1,this.currentState.cameraVersion=-1)}needsUpdate(t){return!this.currentState||(!!this.currentState.needsUpdate||(this.currentState.id!==t.id||this.currentState.version!==t.version))}saveCache(t){this.currentState&&(this.clearBindingState(),this.currentState.version=t.version,this.currentState.needsUpdate=!1,this.currentState.ctx=Pn.getCtx(t.featureKey,this.params.width,this.params.height,this.params.dpr))}updateModelViewMatrix(t,e){void 0!==e?(this.currentState=this.getBindingState(t),(this.currentState.cameraVersion!==e.version||t.dynamically)&&(this.currentState.cameraVersion!==e.version&&(this.currentState.needsUpdate=!0),this.currentState.cameraVersion=e.version,t.updateModelViewMatrix(e))):t.updateModelViewMatrix()}}let wf;class _f{constructor(){c(this,"light"),c(this,"lightsArray",[]),c(this,"shadowsArray",[]),c(this,"lastCameraVersion",-1)}destroy(){var t;this.clear(),null==(t=this.light)||t.destroy()}clear(){this.lightsArray.length=0,this.shadowsArray.length=0}pushLight(t){this.light||(this.light=t),this.lightsArray.push(t)}pushShadow(t){this.shadowsArray.push(t)}}class Sf{constructor(){c(this,"renderStates",new WeakMap)}destroy(){this.renderStates=new WeakMap}get(t,e=0){const i=this.renderStates.get(t);let n;return void 0===i?(n=new _f,this.renderStates.set(t,[n])):e>=i.length?(n=new _f,i.push(n)):n=i[e],n}}class Ef{constructor(t=1e3){c(this,"cellCapacity"),c(this,"firstIndex"),c(this,"lastIndex"),c(this,"items"),this.cellCapacity=t,this.firstIndex=0,this.lastIndex=0,this.items=[new Array(this.cellCapacity)]}adjustCells(){this.lastIndex<this.cellCapacity||(this.items.push(new Array(this.cellCapacity)),this.lastIndex=0)}enqueue(t,e){if(e)return this.unshift(t);this.items[this.items.length-1][this.lastIndex++]=t,this.adjustCells()}unshift(t){for(let t=this.items.length-1;t>=0;t--)for(let e=this.cellCapacity-1;e>=0;e--)e>0&&void 0===this.items[t][e-1]||(this.items[t][e]=0===e&&t>0?this.items[t-1][this.cellCapacity-1]:this.items[t][e-1]);this.items[0][this.firstIndex]=t,this.lastIndex++,this.adjustCells()}dequeue(){if(this.isEmpty())return;const t=this.items[0][this.firstIndex];return this.firstIndex===this.cellCapacity-1?(this.items.shift(),this.firstIndex=0):this.firstIndex++,t}isEmpty(){return 1===this.items.length&&this.firstIndex===this.lastIndex}peek(){if(!this.isEmpty())return this.items[0][this.firstIndex]}size(){return(this.items.length-1)*this.cellCapacity-this.firstIndex+this.lastIndex}clear(){this.firstIndex=0,this.lastIndex=0,this.items=[new Array(this.cellCapacity)]}toString(){if(this.isEmpty())return"";let t=`${this.items[0][this.firstIndex]}`;for(let e=this.firstIndex+1;e<this.items[0].length;e++)t=`${t},${this.items[0][e]}`;for(let e=1;e<this.items.length-1;e++)for(let i=0;i<this.items[e].length;i++)t=`${t},${this.items[e][i]}`;for(let e=0;e<this.lastIndex;e++)t=`${t},${this.items[this.items.length-1][e]}`;return t}getByIndex(t){if(t>=this.size())return;const e=Math.floor((this.firstIndex+t)/this.cellCapacity),i=(this.firstIndex+t)%this.cellCapacity;return this.items[e][i]}setByIndex(t,e){if(t>=this.size())return!1;const i=Math.floor((this.firstIndex+t)/this.cellCapacity),n=(this.firstIndex+t)%this.cellCapacity;return this.items[i][n]=e,!0}sort(t){const e=this.size(),i=new Array(e);for(let t=0;t<e;t++)i[t]=this.getByIndex(t);i.sort(t),this.clear();for(let t=0;t<i.length;t++)this.enqueue(i[t])}getAll(){const t=[];for(let e=0,i=this.size();e<i;e++)t[e]=this.getByIndex(e);return t}}class Mf{constructor(){c(this,"queue",new Ef),c(this,"mergedQueue",{})}destroy(){this.clear()}clear(){this.queue.clear();const t=ri.keys(this.mergedQueue);for(let e=0,i=null==t?void 0:t.length;e<i;e++)void 0!==this.mergedQueue[t[e]]&&this.mergedQueue[t[e]].clear()}push(t,e){return e&&!t.renderOrder&&(t.renderOrder=e),this.queue.enqueue(t),this}unshift(t){this.queue.enqueue(t,!0)}sort(t){return this.queue.size()&&this.queue.sort(t||Af),this}mergeQueue(){for(let t=0,e=this.queue.size();t<e;t++){const t=this.queue.dequeue();if(!t.isShape)continue;const e=rp(t.mtl);let i=this.mergedQueue[e];i||(i=new Ef,this.mergedQueue[e]=i),i.enqueue(t)}return this}}function Af(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.id-e.id}class Tf{constructor(){c(this,"lists",new WeakMap)}destroy(){this.lists=new WeakMap}get(t,e){const i=this.lists.get(t);let n;return void 0===i?(n=new Mf,this.lists.set(t,[n])):e>=i.length?(n=new Mf,i.push(n)):n=i[e],n}}class Cf{constructor(t={}){c(this,"name","CvsRenderer@"+si.now()),c(this,"params"),c(this,"autoClear",!0),c(this,"_currentRenderTarget"),c(this,"cvs"),c(this,"ctx"),c(this,"renderStates",new Sf),c(this,"renderStateStack",[]),c(this,"currentRenderState"),c(this,"renderLists",new Tf),c(this,"currentRenderList"),c(this,"renderListStack",[]),c(this,"bindingStates"),c(this,"renderer"),c(this,"_frustum",new ai),c(this,"_tic"),c(this,"renderSliceComplete",!1),c(this,"lastTicCompleted",-1),c(this,"_isContextLost",!1),c(this,"contextLostHandler",this.handleContextLost.bind(this)),c(this,"contextRestoreHandler",this.handleContextRestore.bind(this)),this.params=t,Ae.config=t,void 0!==t.autoClear&&(this.autoClear=!!t.autoClear),this.init(),this.bindingStates=new bf(this.params),this.renderer=new Ip(this.ctx,this.bindingStates)}destroy(){this.renderer.destroy()}init(){if(this.params.workerRender){if(!this.params.cvs)throw new Error("offscreen canvas not found");this.cvs=this.params.cvs}else this.cvs=Pn.createCanvas(this.params);if(!this.cvs)throw new Error("canvas create error");const t=this.cvs.getContext("2d",{alpha:!0});if(!t)throw new Error("context error");this.params.cvs=this.cvs,this.params.ctx=this.ctx=t,this.setSize(this.params.width,this.params.height)}get isSliceComplete(){return!!this.params.sliceRendering&&this.renderSliceComplete}resize(){this.setSize(this.params.width,this.params.height)}setSize(t,e){this.params.width=t,this.params.height=e,this.params.camera||(this.params.camera={}),this.params.camera.width=t,this.params.camera.height=e,this.params.aspect=t/e,this.params.camera.aspect=this.params.aspect,this.params.camera.left=-.5*t,this.params.camera.right=.5*t,this.params.camera.top=.5*e,this.params.camera.bottom=-.5*e,this.cvs&&Pn.resizeCanvas(this.cvs,t,e,this.params.dpr)}getSize(t=new We){return t.set(this.params.width,this.params.height)}bindEvents(){var t,e;null==(t=this.cvs)||t.addEventListener(If,this.contextLostHandler,!1),null==(e=this.cvs)||e.addEventListener(Df,this.contextRestoreHandler,!1)}unbindEvents(){var t,e;null==(t=this.cvs)||t.removeEventListener(If,this.contextLostHandler,!1),null==(e=this.cvs)||e.removeEventListener(Df,this.contextRestoreHandler,!1)}handleContextLost(t){t.preventDefault(),this._isContextLost=!0}handleContextRestore(){this._isContextLost=!1}clean(){this.ctx&&(this._currentRenderTarget?this._currentRenderTarget.ctx.clearRect(0,0,this.params.width,this.params.height):this.ctx.clearRect(0,0,this.params.width,this.params.height))}getRenderTarget(){return this._currentRenderTarget}setRenderTarget(t){this._currentRenderTarget=t}render(t,e,i){if(this._isContextLost||!this.ctx)return;this._currentRenderTarget?this.renderer.ctx=this._currentRenderTarget.ctx:this.renderer.ctx=this.ctx,this.currentRenderState=this.renderStates.get(t,this.renderStateStack.length);const n=void 0!==e&&this.currentRenderState.lastCameraVersion!==e.version;(n||t.dynamically||t.matrixWorldAutoUpdate)&&t.updateMatrixWorld(),(n||e&&void 0===e.parent&&(null==e?void 0:e.matrixWorldAutoUpdate))&&e.updateMatrixWorld(),e&&(this._frustum.copy(e.boundingBoxWorld),this.currentRenderState.lastCameraVersion=e.version),t.isScene&&t.onBeforeRender(this,t,e,i),this.currentRenderState.clear(),this.renderStateStack.push(this.currentRenderState),this.currentRenderList=this.renderLists.get(t,this.renderListStack.length),this.currentRenderList.clear(),this.renderListStack.push(this.currentRenderList),this.projectObject(t,e,0),this.currentRenderList.sort(),this.renderScene(this.currentRenderList,t,e,i),t.isScene&&t.onAfterRender(this,t,e),this.renderStateStack.pop(),this.renderStateStack.length>0?this.currentRenderState=this.renderStateStack[this.renderStateStack.length-1]:this.currentRenderState=void 0,this.renderListStack.pop(),this.renderListStack.length?this.currentRenderList=this.renderListStack[this.renderListStack.length-1]:this.currentRenderList=void 0}renderTexture(t,e){t&&t.image&&(this._currentRenderTarget?this.renderer.ctx=this._currentRenderTarget.ctx:this.renderer.ctx=this.ctx,this.autoClear&&this.clean(),this.renderer.ctx.drawImage(t.image,0,0))}projectObject(t,e,i=0){var n,s,r,a,o,h;if(t.visible)if(t.composeNode)t.boundingBoxWorld.isEmpty()?null==(n=this.currentRenderList)||n.push(t,i):this._frustum.intersectsBox(t.boundingBoxWorld)&&(null==(s=this.currentRenderList)||s.push(t,i));else{t.isGroup&&(i=t.renderOrder),t.isShape&&e?t.boundingBoxWorld.isEmpty()?null==(r=this.currentRenderList)||r.push(t,i):this._frustum.intersectsBox(t.boundingBoxWorld)&&(null==(a=this.currentRenderList)||a.push(t,i)):t.isShape&&(null==(o=this.currentRenderList)||o.push(t,i));for(let i=0,n=(null==(h=t.children)?void 0:h.length)||0;i<n;i++)this.projectObject(t.children[i],e)}}renderScene(t,e,i,n){this.autoClear&&this.clean();const s=t.queue;s.size()<=0||(e.isStatic&&this.params.sliceRendering?this.renderObjectsSlice(s,e,i,n):this.renderObjects(s,e,i,n),s.clear())}renderObjects(t,e,i,n){for(let s,r=0,a=t.size();r<a;r++)s=t.dequeue(),s&&this.renderObject(s,e,i,n)}renderObject(t,e,i,n){t.onBeforeRender(this,e,i,n),this.bindingStates.updateModelViewMatrix(t,i),this.bindingStates.setup(t,this.currentRenderState,i),this.renderer.render(t),this.params.wireframe&&this.renderer.renderWireFrame(t),t.onAfterRender(this,e,i)}renderObjectsMerged(t,e,i,n){si.now();(()=>{for(let s,r=0,a=t.size();r<a;r++)s=t.dequeue(),s&&this.renderObjectMerged(s,e,i,n)})()}renderObjectMerged(t,e,i,n){t.onBeforeRender(this,e,i,n),this.bindingStates.updateModelViewMatrix(t,i),this.bindingStates.setup(t,this.currentRenderState,i),this.renderer.renderMerged(t),this.params.wireframe&&this.renderer.renderWireFrame(t),t.onAfterRender(this,e,i)}renderObjectsSlice(t,e,i,n){var s;this.autoClear&&this.clean();const r=t.getAll()||[];if(!(null==r?void 0:r.length))return;this._tic&&this._tic.clear(),this.renderSliceComplete=!1;const a=(null==(s=this._currentRenderTarget)?void 0:s.ctx)||this.ctx;if(!a)throw new Error("CvsRenderer.renderObjectsSlice: no ctx");const o=this;this._tic=new yf(r,(t=>{this.renderSliceComplete=!1,this.renderer.ctx=a,this.renderObject(r[t],e,i,n),e.isStatic&&t===r.length-1&&this.params.debounceCache&&(this.renderSliceComplete=!0)}),this.params.sliceDuration,(function(){o.lastTicCompleted=si.now()}))}}const If="contextlost",Df="contextrestored";class Lf{constructor(t=!0){c(this,"autoStart"),c(this,"startTime",0),c(this,"oldTime",0),c(this,"elapsedTime",0),c(this,"running",!1),this.autoStart=t}start(){this.startTime=fi(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=fi();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}class Bf extends Fi{constructor(t={}){super(),c(this,"name","RenderTarget"),c(this,"uuid",ms()),c(this,"featureKey",this.name+"@"+this.uuid),c(this,"offscreen",!0),c(this,"width"),c(this,"height"),c(this,"dpr"),c(this,"texture"),c(this,"cvs"),c(this,"ctx"),void 0!==t.offscreen&&(this.offscreen=t.offscreen),this.width=t.width,this.height=t.height,this.dpr=t.dpr||1,this.offscreen?this.cvs=Pn.get(this.featureKey,this.width,this.height,this.dpr):this.cvs=Pn.createHtmlCanvas(this.width,this.height,this.dpr),this.ctx=Pn.getContext2D(this.cvs,{alpha:!0}),this.texture=new Cp,this.texture.image=this.cvs}destroy(){super.destroy()}setSize(t,e,i=Ae.config.dpr){this.width===t&&this.height===e&&this.dpr===i||(this.width=t,this.height=e,Pn.resizeCanvas(this.cvs,t,e,i))}clean(){this.ctx&&this.ctx.clearRect(0,0,this.width,this.height)}clone(){return new(0,this.constructor)({width:this.width,height:this.height,dpr:this.dpr}).copy(this)}copy(t){return this.name=t.name,this}}const Pf=new We;class kf{constructor(t,e){c(this,"name","EffectComposer"),c(this,"renderer"),c(this,"renderTarget1"),c(this,"renderTarget2"),c(this,"writeBuffer"),c(this,"readBuffer"),c(this,"_width"),c(this,"_height"),c(this,"_pixelRatio"),c(this,"renderToScreen",!0),c(this,"passes",[]),c(this,"clock",new Lf),this.renderer=t,e?(this.renderTarget1=e,this._width=e.width,this._height=e.height):(t.getSize(Pf),this._width=Pf.x,this._height=Pf.y,this.renderTarget1=new Bf({width:this._width,height:this._height}),this.renderTarget1.name="EffectComposer.rt1"),this._pixelRatio=Ae.config.dpr,this.renderTarget2=this.renderTarget1.clone(),this.renderTarget2.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}destroy(){this.renderTarget1.destroy(),this.renderTarget2.destroy()}swapBuffers(){const t=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=t}addPass(t){this.passes.push(t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(t,e){this.passes.splice(e,0,t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(t){const e=this.passes.indexOf(t);-1!==e&&this.passes.splice(e,1)}clearPasses(){this.passes.length=0}isLastEnabledPass(t){for(let e=t+1,i=this.passes.length;e<i;e++)if(this.passes[e].enabled)return!1;return!0}render(t){void 0===t&&(t=this.clock.getDelta());const e=this.renderer.getRenderTarget();for(let e=0,i=this.passes.length;e<i;e++){const i=this.passes[e];i.enabled&&(i.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(e),i.render(this.renderer,this.writeBuffer,this.readBuffer,t,false),i.needsSwap&&this.swapBuffers())}this.renderer.setRenderTarget(e)}reset(t){void 0===t&&(this.renderer.getSize(Pf),this._pixelRatio=Ae.config.dpr,this._width=Pf.x,this._height=Pf.y,(t=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.destroy(),this.renderTarget2.destroy(),this.renderTarget1=t,this.renderTarget2=t.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(t,e){this._width=t,this._height=e;const i=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(i,n),this.renderTarget2.setSize(i,n);for(let t=0,e=this.passes.length;t<e;t++)this.passes[t].setSize(i,n)}setPixelRatio(t){this._pixelRatio=t,this.setSize(this._width,this._height)}}class Nf{constructor(){c(this,"isPass",!0),c(this,"enabled",!0),c(this,"needsSwap",!0),c(this,"clear",!1),c(this,"renderToScreen",!1)}destroy(){}setSize(t,e){}}class Of{constructor(){c(this,"renderTarget"),c(this,"texture"),c(this,"width"),c(this,"height"),c(this,"dpr"),c(this,"version",-1),this.width=Ae.config.width,this.height=Ae.config.height,this.dpr=Ae.config.dpr,this.renderTarget=new Bf({width:this.width,height:this.height,dpr:this.dpr}),this.texture=this.renderTarget.texture,this.texture.image=this.renderTarget.cvs}destroy(){}render(t){t.renderTexture(this.texture)}}class Rf extends Nf{constructor(t,e,i=!0,n=!1){super(),c(this,"name","RenderPass"),c(this,"scene"),c(this,"camera"),this.scene=t,this.camera=e,this.clear=i,this.needsSwap=n}render(t,e,i,n){const s=t.autoClear;t.autoClear=!1,t.setRenderTarget(this.renderToScreen?void 0:i),this.clear&&t.clean(),t.render(this.scene,this.camera,n),t.autoClear=s}}class zf extends Nf{constructor(t,e,i=!0,n=!1){super(),c(this,"name","DebouncePass"),c(this,"scene"),c(this,"camera"),c(this,"fsQuad",new Of),c(this,"debounceQuad",new Of),c(this,"cacheQuad",new Of),c(this,"version",-1),c(this,"_ts",si.now()),c(this,"_initialized",!1),c(this,"debounceRenderHandler",ri.debounce(this.debounceRender.bind(this),100)),this.scene=t,this.camera=e,this.clear=i,this.needsSwap=n}destroy(){super.destroy()}setSize(t,e){this.fsQuad.renderTarget.setSize(t,e),this.debounceQuad.renderTarget.setSize(t,e),this.cacheQuad.renderTarget.setSize(t,e),this.fsQuad.width=t,this.fsQuad.height=e,this.debounceQuad.width=t,this.debounceQuad.height=e,this.cacheQuad.width=t,this.cacheQuad.height=e}get currentVersion(){var t;return this.scene.version+((null==(t=this.camera)?void 0:t.version)||0)}get isChanged(){return this.version!==this.currentVersion}get isDebounceChanged(){return this.debounceQuad.version!==this.currentVersion}isRenderTicComplete(t){return this._ts<=t.lastTicCompleted}render(t,e,i){const n=t.autoClear;t.autoClear=!1,this.isChanged?this.isChanged&&!this._initialized?(this.finalRender(this.fsQuad,t,e,i),this.debounceRender(t,e,i)):(this.renderCache(this.debounceQuad,this.cacheQuad),this.finalRender(this.cacheQuad,t,e,i),this.debounceRenderHandler(t,e,i)):(Ae.config.debounceCache&&this.isDebounceChanged&&this.isRenderTicComplete(t)?(this.saveCache(this.fsQuad,this.debounceQuad),this.finalRender(this.fsQuad,t,e,i),this._initialized=!0):Ae.config.debounceCache&&this._initialized?(this.renderCache(this.debounceQuad,this.cacheQuad),this.finalRender(this.cacheQuad,t,e,i)):(this.renderCache(this.fsQuad,this.cacheQuad),this.finalRender(this.cacheQuad,t,e,i)),this._ts=si.now()),this.version=this.currentVersion,t.autoClear=n}saveCache(t,e){var i;this.isDebounceChanged&&(e.renderTarget.ctx.clearRect(0,0,Ae.config.width,Ae.config.height),e.renderTarget.ctx.drawImage(t.renderTarget.cvs,0,0),null==(i=this.camera)||i.updateMatrixWorld(),e.texture.matrix.copy(t.texture.matrix),e.version=this.currentVersion)}renderCache(t,e){var i;null==(i=this.camera)||i.updateMatrixWorld(),Wf.copy(t.texture.matrix).invert().premultiply(this.camera.viewMatrix).getComponents(Ff),Hf.set(Ae.config.width,Ae.config.height),e.renderTarget.ctx.clearRect(0,0,Ae.config.width,Ae.config.height),e.renderTarget.ctx.save(),e.renderTarget.ctx.transform(...Ff),e.renderTarget.ctx.drawImage(t.renderTarget.cvs,0,0,Hf.x,Hf.y),e.renderTarget.ctx.restore()}finalRender(t,e,i,n){e.setRenderTarget(this.renderToScreen?void 0:n),this.clear&&e.clean(),e.renderTexture(t.renderTarget.texture,this.camera)}debounceRender(t,e,i){t.setRenderTarget(this.renderToScreen?void 0:this.fsQuad.renderTarget),t.clean(),t.render(this.scene,this.camera),this.fsQuad.texture.matrix.copy(this.camera.viewMatrix)}}const Hf=new We,Wf=new Ui,Ff=[1,0,0,1,0,0];class Uf extends Nf{constructor(){super(),c(this,"name","OutputPass"),c(this,"texture"),c(this,"fsQuad"),this.fsQuad=new Of,this.texture=this.fsQuad.texture,this.clear=!0}destroy(){super.destroy(),this.fsQuad.destroy()}render(t,e,i){const n=t.autoClear;t.autoClear=!1,this.fsQuad.texture.image=i.cvs,t.setRenderTarget(this.renderToScreen?void 0:e),this.clear&&t.clean(),this.fsQuad.render(t),i.clean(),t.autoClear=n}}class Vf{noise(t,e,i=0){const n=Math.floor(t),s=Math.floor(e),r=Math.floor(i),a=255&n,o=255&s,h=255&r,l=(t-=n)-1,u=(e-=s)-1,c=(i-=r)-1,d=jf(t),p=jf(e),f=jf(i),m=qf[a]+o,g=qf[m]+h,y=qf[m+1]+h,v=qf[a+1]+o,x=qf[v]+h,b=qf[v+1]+h;return Yf(f,Yf(p,Yf(d,Gf(qf[g],t,e,i),Gf(qf[x],l,e,i)),Yf(d,Gf(qf[y],t,u,i),Gf(qf[b],l,u,i))),Yf(p,Yf(d,Gf(qf[g+1],t,e,c),Gf(qf[x+1],l,e,c)),Yf(d,Gf(qf[y+1],t,u,c),Gf(qf[b+1],l,u,c))))}}const qf=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];for(let t=0;t<256;t++)qf[256+t]=qf[t];function jf(t){return t*t*t*(t*(6*t-15)+10)}function Yf(t,e,i){return e+t*(i-e)}function Gf(t,e,i,n){const s=15&t,r=s<8?e:i,a=s<4?i:12==s||14==s?e:n;return(1&s?-r:r)+(2&s?-a:a)}class $f extends Nf{constructor(t){super(),c(this,"name","PaperPass"),c(this,"fsQuad"),c(this,"ctx"),c(this,"camera"),c(this,"version",0),c(this,"_width",0),c(this,"_height",0),this.camera=t,this.fsQuad=new Of,this.ctx=Pn.getContext2D(this.fsQuad.texture.image,{alpha:!0}),this.needsSwap=!1,this._width=this.fsQuad.width,this._height=this.fsQuad.height,this.generatePerlin()}destroy(){super.destroy(),this.fsQuad.destroy()}setSize(t,e){this.fsQuad.renderTarget.setSize(t,e),this.fsQuad.width=t,this.fsQuad.height=e,this._width=t,this._height=e}generatePerlin(){!function(t,e,i){const n=new Vf,s=t.createImageData(e,i),r=s.data,a=2.5;for(let t=0;t<i;t++)for(let i=0;i<e;i++){const s=n.noise(i/a,t/a,0),o=Math.floor(128*(s+1)),h=4*(t*e+i);r[h]=o,r[h+1]=o,r[h+2]=o,r[h+3]=16}t.putImageData(s,0,0)}(this.ctx,this._width,this._height)}get currentVersion(){var t;return(null==(t=this.camera)?void 0:t.version)||0}render(t,e,i){const n=t.autoClear;t.autoClear=!1,this.currentVersion!==this.version&&(this.version=this.currentVersion),this._width===this.fsQuad.width&&this._height===this.fsQuad.height||(this.fsQuad.width=this._width,this.fsQuad.height=this._height,this.generatePerlin()),t.setRenderTarget(this.renderToScreen?void 0:i),t.renderTexture(this.fsQuad.texture),t.autoClear=n}}class Xf extends Cs{constructor(){super(...arguments),c(this,"isDynamic",!0),c(this,"dynamically",!0)}}const Zf=t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),Jf=(t,e=0,i)=>{if(Zf(t)){return new(0,t.constructor)(t.subarray(e,void 0!==i?i:t.length))}return t.slice(e,i)},Qf=(t,e,i)=>t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t;class Kf{constructor(t,e,i,n){c(this,"parameterPositions"),c(this,"resultBuffer"),c(this,"sampleValues"),c(this,"valueSize"),c(this,"settings",null),c(this,"DefaultSettings_",{}),c(this,"__cacheIndex"),c(this,"_cachedIndex",0),this.parameterPositions=t,this.sampleValues=e,this.valueSize=i,this.resultBuffer=n||new Float32Array(i)}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],s=e[i-1];t:{e:{let r;i:{n:if(!(t<n)){for(let r=i+2;;){if(void 0===n){if(t<s)break n;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===r)break;if(s=n,n=e[++i],t<n)break e}r=e.length;break i}if(t>=s)break t;{const a=e[1];t<a&&(i=2,s=a);for(let r=i-2;;){if(void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(i===r)break;if(n=s,s=e[--i-1],t>=s)break e}r=i,i=0}}for(;i<r;){const n=i+r>>>1;t<e[n]?r=n:i=n+1}if(n=e[i],s=e[i-1],void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,n)}return this.interpolate_(i,s,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,s=t*n;for(let t=0;t!==n;++t)e[t]=i[s+t];return e}}class tm extends Kf{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}intervalChanged_(){}}class em extends Kf{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=(i-e)/(n-e),u=1-l;for(let t=0;t!==a;++t)s[t]=Number(r[h+t])*u+Number(r[o+t])*l;return s}intervalChanged_(){}}class im extends Kf{constructor(t,e,i,n){super(t,e,i,n),c(this,"_weightPrev",-0),c(this,"_offsetPrev",-0),c(this,"_weightNext",-0),c(this,"_offsetNext",-0),this.DefaultSettings_={endingStart:2400,endingEnd:2400}}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=this._offsetPrev,u=this._offsetNext,c=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),f=p*p,m=f*p,g=-c*m+2*c*f-c*p,y=(1+c)*m+(-1.5-2*c)*f+(-.5+c)*p+1,v=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let t=0;t!==a;++t)s[t]=g*Number(r[l+t])+y*Number(r[h+t])+v*Number(r[o+t])+x*Number(r[u+t]);return s}intervalChanged_(t,e,i){const n=this.parameterPositions;let s=t-2,r=t+1,a=n[s],o=n[r];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:s=t,a=2*e-i;break;case 2402:s=n.length-2,a=e+n[s]-n[s+1];break;default:s=t,a=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:r=t,o=2*i-e;break;case 2402:r=1,o=i+n[1]-n[0];break;default:r=t-1,o=e}const h=.5*(i-e),l=this.valueSize;this._weightPrev=h/(e-a),this._weightNext=h/(o-i),this._offsetPrev=s*l,this._offsetNext=r*l}}const nm=2300,sm=2301,rm=2302;class am{constructor(t,e,i,n){if(c(this,"name","KeyframeTrack"),c(this,"times"),c(this,"values"),c(this,"ValueTypeName",""),c(this,"DefaultInterpolation",sm),c(this,"createInterpolant"),c(this,"InterpolantFactoryMethodDiscrete",this._InterpolantFactoryMethodDiscrete),c(this,"InterpolantFactoryMethodLinear",this._InterpolantFactoryMethodLinear),c(this,"InterpolantFactoryMethodSmooth",this._InterpolantFactoryMethodSmooth),!e||!e.length)throw new Error("KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Qf(e,Float32Array),this.values=Qf(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Qf(t.times,Array),values:Qf(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}_InterpolantFactoryMethodDiscrete(t){return new tm(this.times,this.values,this.getValueSize(),t)}_InterpolantFactoryMethodLinear(t){return new em(this.times,this.values,this.getValueSize(),t)}_InterpolantFactoryMethodSmooth(t){return new im(this.times,this.values,this.getValueSize(),t)}getValueSize(){return Math.ceil(this.values.length/this.times.length)}setInterpolation(t){let e;switch(t){case nm:e=this.InterpolantFactoryMethodDiscrete;break;case sm:e=this.InterpolantFactoryMethodLinear;break;case rm:e=this.InterpolantFactoryMethodSmooth}if(!e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return nm;case this.InterpolantFactoryMethodLinear:return sm;case this.InterpolantFactoryMethodSmooth:return rm}}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let s=0,r=n-1;for(;s!==n&&i[s]<t;)++s;for(;-1!==r&&i[r]>e;)--r;if(++r,0!==s||r!==n){s>=r&&(r=Math.max(r,1),s=r-1);const t=this.getValueSize();this.times=Jf(i,s,r),this.values=Jf(this.values,s*t,r*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(t=!1);const i=this.times,n=this.values,s=i.length;0===s&&(t=!1);let r=null;for(let e=0;e!==s;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){t=!1;break}if(null!==r&&r>n){t=!1;break}r=n}if(void 0!==n&&Zf(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){t=!1;break}}return t}optimize(){const t=Jf(this.times),e=Jf(this.values),i=this.getValueSize(),n=this.getInterpolation()===rm,s=t.length-1;let r=1;for(let a=1;a<s;++a){let s=!1;const o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(n)s=!0;else{const t=a*i,n=t-i,r=t+i;for(let a=0;a!==i;++a){const i=e[t+a];if(i!==e[n+a]||i!==e[r+a]){s=!0;break}}}if(s){if(a!==r){t[r]=t[a];const n=a*i,s=r*i;for(let t=0;t!==i;++t)e[s+t]=e[n+t]}++r}}if(s>0){t[r]=t[s];for(let t=s*i,n=r*i,a=0;a!==i;++a)e[n+a]=e[t+a];++r}return r!==t.length?(this.times=Jf(t,0,r),this.values=Jf(e,0,r*i)):(this.times=t,this.values=e),this}clone(){const t=Jf(this.times,0),e=Jf(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}c(am,"DefaultInterpolation",sm),am.prototype.ValueBufferType=Float32Array;class om extends am{constructor(){super(...arguments),c(this,"ValueTypeName","vector2")}}class hm extends am{constructor(){super(...arguments),c(this,"ValueTypeName","number")}}class lm extends am{constructor(){super(...arguments),c(this,"ValueTypeName","color")}}class um extends am{constructor(){super(...arguments),c(this,"ValueTypeName","bool"),c(this,"DefaultInterpolation",nm)}}um.prototype.ValueBufferType=Array,um.prototype.InterpolantFactoryMethodLinear=void 0,um.prototype.InterpolantFactoryMethodSmooth=void 0;class cm extends am{constructor(){super(...arguments),c(this,"ValueTypeName","string"),c(this,"DefaultInterpolation",nm)}}um.prototype.ValueBufferType=Array,cm.prototype.InterpolantFactoryMethodLinear=void 0,cm.prototype.InterpolantFactoryMethodSmooth=void 0;class dm{constructor(t,e=-1,i,n=fm){c(this,"name","AnimationClip"),c(this,"duration"),c(this,"tracks"),c(this,"blendMode",fm),c(this,"uuid",ms()),this.name=t,this.duration=e,this.tracks=i,this.blendMode=n,this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,s=i.length;t!==s;++t)e.push(pm(i[t]).scale(n));const s=new this(t.name,t.duration,e,t.blendMode);return s.uuid=t.uuid,s}static toJSON(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push(am.toJSON(i[t]));return n}static findByName(t,e){var i;let n;if(t.isShape){const e=t;n=(null==(i=e.geo)?void 0:i.animations)||e.animations}else n=t;for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t]}resetDuration(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new(0,this.constructor)(this.name,this.duration,t,this.blendMode)}toJSON(){return dm.toJSON(this)}}function pm(t){if(void 0===t.type)throw new Error("KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return hm;case"vector":case"vector2":return om;case"color":return lm;case"bool":case"boolean":return um;case"string":return cm}throw new Error("KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];((t,e,i,n)=>{let s=1,r=t[0];for(;void 0!==r&&void 0===r[n];)r=t[s++];if(void 0===r)return;let a=r[n];if(void 0!==a)if(Array.isArray(a))do{a=r[n],void 0!==a&&(e.push(r.time),i.push.apply(i,a)),r=t[s++]}while(void 0!==r);else if(void 0!==a.toArray)do{a=r[n],void 0!==a&&(e.push(r.time),a.toArray(i,i.length)),r=t[s++]}while(void 0!==r);else do{a=r[n],void 0!==a&&(e.push(r.time),i.push(a)),r=t[s++]}while(void 0!==r)})(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const fm=2500;class mm{constructor(t,e,i){c(this,"path",""),c(this,"parsedPath"),c(this,"_targetGroup"),c(this,"_bindings"),c(this,"rootNode"),this.parsedPath=i||gm.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,this.parsedPath)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=i.length;n!==s;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}class gm{constructor(t,e,i){c(this,"path"),c(this,"parsedPath"),c(this,"node"),c(this,"rootNode"),c(this,"getValue",this._getValue_unbound),c(this,"setValue",this._setValue_unbound),c(this,"targetObject"),c(this,"propertyName"),c(this,"resolvedProperty"),c(this,"propertyIndex",-1),c(this,"BindingType",{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3,ColorString:4}),c(this,"Versioning",{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2}),c(this,"GetterByBindingType",[this._getValue_direct,this._getValue_array,this._getValue_arrayElement,this._getValue_toArray,this._getValue_color]),c(this,"SetterByBindingTypeAndVersioning",[[this._setValue_direct,this._setValue_direct_setNeedsUpdate,this._setValue_direct_setMatrixWorldNeedsUpdate],[this._setValue_array,this._setValue_array_setNeedsUpdate,this._setValue_array_setMatrixWorldNeedsUpdate],[this._setValue_arrayElement,this._setValue_arrayElement_setNeedsUpdate,this._setValue_arrayElement_setMatrixWorldNeedsUpdate],[this._setValue_fromArray,this._setValue_fromArray_setNeedsUpdate,this._setValue_fromArray_setMatrixWorldNeedsUpdate],[this._setValue_color,this._setValue_color_setNeedsUpdate,this._setValue_color_setMatrixWorldNeedsUpdate]]),this.path=e,this.parsedPath=i||gm.parseTrackName(e),this.node=gm.findNode(t,this.parsedPath.nodeName),this.rootNode=t}static create(t,e,i){return t&&t.isAnimationObjectGroup?new mm(t,e,i):new gm(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(vm,"")}static parseTrackName(t){const e=Mm.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4]?parseInt(e[4]):void 0,propertyName:e[5],propertyIndex:e[6]?parseInt(e[6]):void 0},n=i.nodeName&&i.nodeName.lastIndexOf(".")||void 0;if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==Am.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||void 0===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;const i=t.getObjectByProperty("name",e)||t.getObjectByProperty("uuid",e);return i||void 0}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){this.targetObject&&this.propertyName&&(t[e]=this.targetObject[this.propertyName])}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_getValue_color(t,e){const i=Re.getArray(this.resolvedProperty);for(let n=0,s=i.length;n<s;n++)t[e++]=i[n]}_setValue_direct(t,e){this.targetObject&&this.propertyName&&(this.targetObject[this.propertyName]=t[e])}_setValue_direct_setNeedsUpdate(t,e){this.targetObject&&this.propertyName&&(this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0)}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&this.propertyName&&(this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0)}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){if(!this.targetObject)return;const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){if(!this.targetObject)return;const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0)}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0)}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0)}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0)}_setValue_color(t,e){this.targetObject&&this.propertyName&&(this.resolvedProperty=this.targetObject[this.propertyName]=Tm.fromArray(t,e).getStyle())}_setValue_color_setNeedsUpdate(t,e){this.targetObject&&(this._setValue_color(t,e),this.targetObject.needsUpdate=!0)}_setValue_color_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&(this._setValue_color(t,e),this.targetObject.matrixWorldNeedsUpdate=!0)}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let s=e.propertyIndex;if(t||(t=gm.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return;if(i){let n=e.objectIndex;if(void 0===t[i])return;if(t=t[i],void 0!==n){if(void 0===t[n])return;t=t[n]}}if(!t)return;const r=t[n];if(void 0===r){e.nodeName;return}let a=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;void 0!==s?(o=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s):void 0!==r.fromArray&&void 0!==r.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(o=this.BindingType.EntireArray,this.resolvedProperty=r):r&&Re.isColor(r)?(o=this.BindingType.ColorString,this.resolvedProperty=r,this.propertyName=n):this.propertyName=n,this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=void 0,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}const ym="\\[\\]\\.:\\/",vm=new RegExp("["+ym+"]","g"),xm="[^"+ym+"]",bm="[^"+ym.replace("\\.","")+"]",wm=/((?:WC+[\/:])*)/.source.replace("WC",xm),_m=/(WCOD+)?/.source.replace("WCOD",bm),Sm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",xm),Em=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",xm),Mm=new RegExp("^"+wm+_m+Sm+Em+"$"),Am=["material","materials","bones","map","mat","mtl","geo","l"],Tm=new Re;class Cm{constructor(t,e,i){let n,s,r;switch(c(this,"binding"),c(this,"valueSize"),c(this,"buffer"),c(this,"_workIndex",0),c(this,"_mixBufferRegion"),c(this,"_mixBufferRegionAdditive"),c(this,"_setIdentity"),c(this,"_origIndex",3),c(this,"_addIndex",4),c(this,"_cacheIndex"),c(this,"cumulativeWeight",0),c(this,"cumulativeWeightAdditive",0),c(this,"useCount",0),c(this,"referenceCount",0),this.binding=t,this.valueSize=i,e){case"fill":case"stroke":case"textFill":case"string":case"bool":n=this._select,s=this._select,r=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,s=this._lerpAdditive,r=this._setAdditiveIdentityNumeric,this.buffer=new Float32Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=s,this._setIdentity=r,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const i=this.buffer,n=this.valueSize,s=t*n+n;let r=this.cumulativeWeight;if(0===r){for(let t=0;t!==n;++t)i[s+t]=i[t];r=e}else{r+=e;const t=e/r;this._mixBufferRegion(i,s,0,t,n)}this.cumulativeWeight=r}accumulateAdditive(t){const e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,i=this.buffer,n=t*e+e,s=this.cumulativeWeight,r=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const t=e*this._origIndex;this._mixBufferRegion(i,n,t,1-s,e)}r>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let t=e,s=e+e;t!==s;++t)if(i[t]!==i[t+e]){a.setValue(i,n);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let t=i,s=n;t!==s;++t)e[t]=e[n+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,n,s){if(n>=.5)for(let n=0;n!==s;++n)t[e+n]=t[i+n]}_lerp(t,e,i,n,s){const r=1-n;for(let a=0;a!==s;++a){const s=e+a;t[s]=t[s]*r+t[i+a]*n}}_lerpAdditive(t,e,i,n,s){for(let r=0;r!==s;++r){const s=e+r;t[s]=t[s]+t[i+r]*n}}}const Im=2400,Dm=2401;class Lm{constructor(t,e,i,n=e.blendMode){c(this,"blendMode"),c(this,"loop",2201),c(this,"time",0),c(this,"timeScale",1),c(this,"weight",1),c(this,"repetitions",1/0),c(this,"paused",!1),c(this,"enabled",!0),c(this,"clampWhenFinished",!1),c(this,"zeroSlopeAtStart",!0),c(this,"zeroSlopeAtEnd",!0),c(this,"_mixer"),c(this,"_clip"),c(this,"_localRoot"),c(this,"_interpolantSettings"),c(this,"_interpolants"),c(this,"_propertyBindings"),c(this,"_cacheIndex"),c(this,"_byClipCacheIndex"),c(this,"_timeScaleInterpolant"),c(this,"_weightInterpolant"),c(this,"_loopCount",-1),c(this,"_startTime"),c(this,"_effectiveTimeScale",1),c(this,"_effectiveWeight",1),this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;const s=e.tracks,r=s.length,a=new Array(r),o={endingStart:Im,endingEnd:Im};for(let t=0;t!==r;++t){const e=s[t].createInterpolant();e&&(a[t]=e,e.settings=o)}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r)}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=void 0,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&void 0===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}stopFading(){const t=this._weightInterpolant;return void 0!==t&&(this._weightInterpolant=void 0,this._mixer._takeBackControlInterpolant(t)),this}stopWarping(){const t=this._timeScaleInterpolant;return void 0!==t&&(this._timeScaleInterpolant=void 0,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);const s=this._startTime;if(void 0!==s){const n=(t-s)*i;n<0||0===i?e=0:(this._startTime=void 0,e=i*n)}e*=this._updateTimeScale(t);const r=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(r),e[i].accumulateAdditive(a);else for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(r),e[i].accumulate(n,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(void 0!==i){const n=i.evaluate(t)[0];e*=Number(n),t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(void 0!==i){const n=i.evaluate(t)[0];e*=Number(n),t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let n=this.time+t,s=this._loopCount;const r=2202===i;if(0===t)return-1===s||!r||1&~s?n:e-n;if(2200===i){-1===s&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",data:{action:this,direction:t<0?-1:1}})}}else{if(-1===s&&(t>=0?(s=0,this._setEndings(!0,0===this.repetitions,r)):this._setEndings(0===this.repetitions,!0,r)),n>=e||n<0){const i=Math.floor(n/e);n-=e*i,s+=Math.abs(i);const a=this.repetitions-s;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",data:{action:this,direction:t>0?1:-1}});else{if(1===a){const e=t<0;this._setEndings(e,!e,r)}else this._setEndings(!1,!1,r);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",data:{action:this,loopDelta:i}})}}else this.time=n;if(r&&!(1&~s))return e-n}return n}_setEndings(t,e,i){const n=this._interpolantSettings;i?(n.endingStart=Dm,n.endingEnd=Dm):(n.endingStart=t?this.zeroSlopeAtStart?Dm:Im:2402,n.endingEnd=e?this.zeroSlopeAtEnd?Dm:Im:2402)}}const Bm=new Float32Array(1);class Pm extends Fi{constructor(t){super(),c(this,"stats"),c(this,"time",0),c(this,"timeScale",1),c(this,"_root"),c(this,"_accuIndex",0),c(this,"_actions",[]),c(this,"_nActiveActions",0),c(this,"_actionsByClip",{}),c(this,"_bindings",[]),c(this,"_nActiveBindings",0),c(this,"_bindingsByRootAndName",{}),c(this,"_controlInterpolants",[]),c(this,"_nActiveControlInterpolants",0),this._root=t,this._initMemoryManager()}destroy(){super.destroy(),this.stopAllAction(),this._root=void 0}dispose(){this._root=void 0}bind(t){t&&(this._root=t)}_bindAction(t,e){if(!this._root)return;const i=t._localRoot||this._root,n=t._clip.tracks,s=n.length,r=t._propertyBindings,a=t._interpolants,o=i.uuid,h=this._bindingsByRootAndName;let l=h[o];void 0===l&&(l={},h[o]=l);for(let t=0;t!==s;++t){const s=n[t],h=s.name;let u=l[h];if(void 0===u){if(u=r[t],void 0!==u){void 0===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,h));continue}const n=e&&e._propertyBindings[t].binding.parsedPath,a=s.getValueSize();u=new Cm(gm.create(i,h,n),s.ValueTypeName,a),++u.referenceCount,this._addInactiveBinding(u,o,h),r[t]=u}else++u.referenceCount,r[t]=u;a[t].resultBuffer=u.buffer}}_activateAction(t){if(this._root&&!this._isActiveAction(t)){if(void 0===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return void 0!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){const n=this._actions,s=this._actionsByClip;let r=s[e];if(void 0===r)r={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,s[e]=r;else{const e=r.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=n.length,n.push(t),r.actionByRoot[i]=t}_removeInactiveAction(t){if(!this._root)return;const e=this._actions,i=e[e.length-1],n=t._cacheIndex||0;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=void 0;const s=t._clip.uuid,r=this._actionsByClip,a=r[s],o=a.knownActions,h=o[o.length-1],l=t._byClipCacheIndex||0;h._byClipCacheIndex=l,o[l]=h,o.pop(),t._byClipCacheIndex=void 0;delete a.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete r[s],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(t){if(void 0===t._cacheIndex)return;const e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_takeBackAction(t){if(void 0===t._cacheIndex)return;const e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_addInactiveBinding(t,e,i){const n=this._bindingsByRootAndName,s=this._bindings;let r=n[e];void 0===r&&(r={},n[e]=r),r[i]=t,t._cacheIndex=s.length,s.push(t)}_removeInactiveBinding(t){var e;const i=this._bindings,n=t.binding,s=(null==(e=n.rootNode)?void 0:e.uuid)||"",r=n.path,a=this._bindingsByRootAndName,o=a[s],h=i[i.length-1],l=t._cacheIndex||0;h._cacheIndex=l,i[l]=h,i.pop(),delete o[r],0===Object.keys(o).length&&delete a[s]}_lendBinding(t){if(void 0===t._cacheIndex)return;const e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_takeBackBinding(t){if(void 0===t._cacheIndex)return;const e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=t[e];return void 0===i&&(i=new em(new Float32Array(2),new Float32Array(2),1,Bm),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){if(void 0===t.__cacheIndex)return;const e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,s=e[n];t.__cacheIndex=n,e[n]=t,s.__cacheIndex=i,e[i]=s}clipAction(t,e,i){if(!this._root)return;const n=e||this._root,s=n.uuid;let r;r="string"==typeof t?dm.findByName(n,t):t;const a=r?r.uuid:"",o=this._actionsByClip[a];let h;if(void 0===i&&(i=r?r.blendMode:fm),void 0!==o){const t=o.actionByRoot[s];if(void 0!==t&&t.blendMode===i)return t;h=o.knownActions[0],void 0===r&&(r=h._clip)}if(void 0===r)return;const l=new Lm(this,r,e,i);return this._bindAction(l,h),this._addInactiveAction(l,a,s),l}existingAction(t,e){if(!this._root)return;const i=e||this._root,n=i.uuid;let s="string"==typeof t?dm.findByName(i,t):t;const r=s?s.uuid:"",a=this._actionsByClip[r];return void 0!==a&&a.actionByRoot[n]||void 0}removeAction(t){t&&this._deactivateAction(t)}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,n=this.time+=t,s=Math.sign(t),r=this._accuIndex^=1;for(let a=0;a!==i;++a){e[a]._update(n,t,s,r)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(r);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,i=t.uuid,n=this._actionsByClip,s=n[i];if(void 0!==s){const t=s.knownActions;for(let i=0,n=t.length;i!==n;++i){const n=t[i];this._deactivateAction(n);const s=n._cacheIndex||0,r=e[e.length-1];n._cacheIndex=void 0,n._byClipCacheIndex=void 0,r._cacheIndex=s,e[s]=r,e.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(t){const e=t.uuid,i=this._actionsByClip;for(const t in i){const n=i[t].actionByRoot[e];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}const n=this._bindingsByRootAndName[e];if(void 0!==n)for(const t in n){const e=n[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const i=this.existingAction(t,e);void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class km extends hp{constructor(t,e={}){var i,n;let s;s=Nn.parse(t),ri.set(e,"use3DShape",Nm);const r=af.getShapesByParsed(s,e);if(!(null==r?void 0:r.length))throw new Error(`Svg: no shapes: ${t}`);super(null==(i=null==r?void 0:r[0])?void 0:i.geo,null==(n=null==r?void 0:r[0])?void 0:n.mtl),c(this,"name","Svg"),c(this,"composeNode",!0),(null==r?void 0:r.length)>1&&this.adds(r.slice(1))}}const Nm=!1;class Om extends hp{constructor(t){const e=new bp(t),i=new ap(t);(null==t?void 0:t.lineWidth)||(i.lineWidth=1),super(e,i),c(this,"name","Polygon")}}class Rm extends Xf{constructor(t={}){var e,i;super(),c(this,"isLoadingScene",!0),c(this,"name","LoadingScene"),c(this,"params"),c(this,"loadingShape"),c(this,"lineShape"),c(this,"triangleShape"),c(this,"scales",[.95,1.15,.002]),c(this,"l",0),c(this,"scaleTrend",!1),c(this,"clock",new Lf),c(this,"mixer"),c(this,"_selectedClip"),c(this,"selectedAction"),this.params=t,this.loadingShape=new km(zm,{fill:Le.darkGray,flipY:!0}),this.loadingShape.name="loading",this.loadingShape.dynamically=!0,this.add(this.loadingShape),this.loadingShape.setScale(.5,.5).updateMatrix(),this.loadingShape.updateMatrixWorld(),this.loadingShape.computeBoundingBox(),this.loadingShape.updateBoundingBox(),Fm.copy(this.loadingShape.boundingBoxWorld).getCenter(Hm),Fm.getSize(Wm),this.loadingShape.setPosition(Hm.negate()).updateMatrix(),this.l=Wm.x;const n=Math.max(Math.floor(this.l/30),3),s=[-this.l/2,-(8+n),-this.l/2,-8,this.l/2,-8,this.l/2,-(8+n)];this.lineShape=new Om({points:s,fill:Le.darkGray}),this.add(this.lineShape),this.lineShape.name="loadingLine";const r=[0,0,Wm.x/2,Wm.x,Wm.x,0];this.triangleShape=new Om({points:r,fill:Le.darkRed}),this.add(this.triangleShape),this.triangleShape.name="loadingTriangle",this.triangleShape.setPosition(new We(-.12*Wm.x,Wm.y/-.36)).setScale(.25,.15).updateMatrix(),this.computeBoundingBox(),this.mixer=new Pm(this);const a=new om(`${this.loadingShape.name}.mtl.fill`,[0,1.2,2],[0,0,0,.7,.38,.38,.38,.6,0,0,0,.7]),o=new hm(`${this.triangleShape.name}.mtl.fillOpacity`,[0,1.5,3],[1,.1,1],hm.DefaultInterpolation),h=new om(`${this.lineShape.name}.scaled`,[0,.3,1],[1,1,.1,1,1,1]);this._selectedClip=new dm("selected",3,[a,o,h]),this.selectedAction=null==(e=this.mixer)?void 0:e.clipAction(this._selectedClip,this.desScene),null==(i=this.selectedAction)||i.play()}destroy(){super.destroy()}onBeforeRender(){this.lineShape.updateMatrix()}update(){var t;null==(t=this.mixer)||t.update(this.clock.getDelta())}}const zm='\n<path d="M0 20.7L0 0L7.272 0L7.272 18L20.592 18L19.08 20.7L0 20.7\nM30.78 2.772L30.78 17.928L41.4 17.928L41.4 0L48.708 0L48.708 20.7L23.472 20.7L23.472 0L41.4 0L38.88 2.772L30.78 2.772\nM62.388 12.924L71.028 12.924L68.904 15.768L61.2 15.768L59.292 20.7L51.588 20.7L59.94 0L73.188 0L81.576 20.7L73.944 20.7L71.028 12.924L67.14 2.772L65.988 2.772L62.388 12.924\nM109.728 17.784L106.884 20.7L84.456 20.7L84.456 0L102.528 0L99.972 2.844L91.656 2.844L91.656 17.928L102.528 17.928L102.528 0L107.136 0L109.728 2.7L109.728 17.784\nM119.628 20.7L112.608 20.7L112.608 0L119.628 0L119.628 20.7\nM139.752 20.7L129.78 6.3L129.78 20.7L122.508 20.7L122.508 0L130.644 0L140.58 14.652L140.58 0L147.78 0L147.78 20.7L139.752 20.7\nM168.732 18L168.732 10.728L163.368 10.728L163.368 7.992L175.932 7.992L175.932 20.7L168.732 20.7L168.732 18.504L166.572 20.7L150.66 20.7L150.66 0L176.04 0L174.456 2.7L158.04 2.7L158.04 18L168.732 18\nZ">\n</path>\n',Hm=new We,Wm=new We,Fm=new ai;class Um extends Fi{constructor(t={}){var e,i;super(),c(this,"name","View"),c(this,"params"),c(this,"visible",!0),c(this,"cvs"),c(this,"scene"),c(this,"scenes",[]),c(this,"camera"),c(this,"controller"),c(this,"tween"),c(this,"animateDuration"),c(this,"controlsChangedHandler",this.handleControlsChanged.bind(this)),this.params=t,this.animateDuration=this.params.animateDuration||300,this.cvs=t.cvs,this.camera=new tr(t.camera||{}),this.params.inpEl?this.controller=new Uh(this.params.inpEl,this.camera):this.controller=new Uh(this.cvs,this.camera),void 0!==(null==(e=this.params.controls)?void 0:e.enableRotate)&&(this.controller.enableRotate=!!(null==(i=this.params.controls)?void 0:i.enableRotate))}destroy(){this.controller&&this.controller.destroy(),this.camera&&this.camera.destroy(),this.scene&&this.scene.destroy(),this.scenes.forEach((t=>t.destroy())),this.scenes.length=0,super.destroy()}resize(){var t;this.camera.resize(),null==(t=this.controller)||t.resize()}setEnablePan(t){this.controller&&(this.controller.enablePan=!!t)}bindEvents(){var t;null==(t=this.controller)||t.addEventListener("change",this.controlsChangedHandler)}unbindEvents(){var t;null==(t=this.controller)||t.removeEventListener("change",this.controlsChangedHandler)}handleControlsChanged(t){}bindScene(t){this.scenes.push(t),this.reset(),this.scene=t,t.isStatic}getCameraPosition(){return this.camera.boundingBoxWorld}setCameraPosition(t,e=!0){return Ym.copy(t),this.resetCameraByBoundingBox(Ym,e)}saveCameraPosition(t){Ym.copy(this.camera.boundingBoxWorld);const e=t?Vm+t:Vm;sessionStorage.setItem(e,JSON.stringify(Ym))}clearCameraPosition(t){const e=t?Vm+t:Vm;sessionStorage.setItem(e,"")}restoreCameraPosition(t){const e=t?Vm+t:Vm,i=sessionStorage.getItem(e);i&&(Ym.copy(JSON.parse(i)),this.resetCameraByBoundingBox(Ym,!0))}zoomIn(){Ym.copy(this.camera.boundingBoxWorld).getSize(qm),Ym.expandByScalar(-.1*Math.max(qm.x,qm.y)),this.resetCameraByBoundingBox(Ym,!0)}zoomOut(){this.controller&&(Ym.copy(this.camera.boundingBoxWorld).getSize(qm),Ym.expandByScalar(.1*Math.max(qm.x,qm.y)),this.resetCameraByBoundingBox(Ym,!0))}fullscreen(t=10,e=!1){this.scene&&(this.scene.boundingBox.isEmpty()&&this.scene.computeBoundingBox(),"function"==typeof this.scene.computeBoundingBox?Ym.copy(this.scene.computeBoundingBox()):Ym.copy(this.scene.boundingBox),Ym.expandByVector(qm.set(t,t)),this.resetCameraByBoundingBox(Ym,e))}handleCameraChanged(t){}reset(){}resetCameraByBoundingBox(t,e=!1){return d(this,null,(function*(){if(!this.camera)return;if(!t||t.isEmpty())throw new Error("BoundingBox empty");if(!e)return this.camera.setByBox(t),Promise.resolve();const i=this.camera.getCameraPosition();t.getCenter(qm),t.getSize(jm);const n=Math.max(jm.x/this.camera.width,jm.y/this.camera.height),s={x:qm.x,y:qm.y,z:0,s:n,r:0};yield this.animateCamera(i,s)}))}animateCamera(t,e){return d(this,null,(function*(){return this.controller&&(this.controller.enabled=!1),this.tween&&this.tween.stop(),new Promise((i=>{this.tween=new Ho.Tween(t).to(e,this.animateDuration).easing(Ho.Easing.Exponential.Out).onUpdate((t=>{this.camera.position.set(t.x,t.y),this.camera.scaled.set(t.s,t.s),this.camera.rotation.set(t.r,t.r),this.camera.update()})).onComplete((()=>{this.controller&&(this.controller.enabled=!0),i()})).start()}))}))}computeBoundingBox(t,e=new ai){return t&&t.length?(e.makeEmpty(),t.forEach((t=>e.union(t.computeBoundingBox()))),e):e}expandScenesBoundingBox(t,e=new ai){t.forEach((t=>t.boundingBox.union(e)))}update(t){this.tween&&this.tween.update(t)}}const Vm="camera_position_",qm=new We,jm=new We,Ym=new ai;class Gm extends Cs{constructor(){super(...arguments),c(this,"isStatic",!0),c(this,"featureKey","StaticScene_"+this.id),c(this,"cameraVersion",0),c(this,"dynamically",!1),c(this,"needsUpdateChangedHandler",this.handleNeedsUpdateChanged.bind(this))}handleNeedsUpdateChanged(){this.needsUpdate=!0}}class $m extends Yh{constructor(t){super(t),c(this,"name","GeoPolyline"),this._init(t),((null==t?void 0:t.stArrow)||(null==t?void 0:t.edArrow))&&(this.arrowLength=(null==t?void 0:t.arrowLength)||10,this.arrowDeg=(null==t?void 0:t.arrowDeg)||30)}buildPath(t,e,i){if(0===this.percent)return;let{points:n}=e||this;if(n&&n.length&&!(n.length<2)){for(let e=0,i=n.length;e<i;e+=2)e?t.lineTo(n[e],n[e+1]):t.moveTo(n[e],n[e+1]);this.addArrow(t)}}addArrow(t,e){const{points:i,stArrow:n,edArrow:s,arrowDeg:r,arrowLength:a}=this;if(!(null==i?void 0:i.length)||!n&&!s||!r)return this;if(e||(e=a),!e)return this;const o=i;if(!(null==o?void 0:o.length)||(null==o?void 0:o.length)<4)return this;if(n){if(Xm.set(o[2],o[3]),Jm.set(o[0],o[1]),Xm.equals(Jm))return this;Zm.subVectors(Xm,Jm),Qm.lerpVectors(Jm,Xm,e/Zm.length()),Km.copy(Qm).rotateAround(Jm,Ie(r)),tg.copy(Qm).rotateAround(Jm,-Ie(r)),t.moveTo(Km.x,Km.y),t.lineTo(Jm.x,Jm.y),t.lineTo(tg.x,tg.y)}if(s){const i=o.length;if(Xm.set(o[i-4],o[i-3]),Jm.set(o[i-2],o[i-1]),Xm.equals(Jm))return this;Zm.subVectors(Xm,Jm),Qm.lerpVectors(Jm,Xm,e/Zm.length()),Km.copy(Qm).rotateAround(Jm,Ie(r)),tg.copy(Qm).rotateAround(Jm,-Ie(r)),t.moveTo(Km.x,Km.y),t.lineTo(Jm.x,Jm.y),t.lineTo(tg.x,tg.y)}return this}}const Xm=new We,Zm=new We,Jm=new We,Qm=new We,Km=new We,tg=new We;class eg extends hp{constructor(t={}){(null==t?void 0:t.width)||(t.width=.5*Ae.config.width),(null==t?void 0:t.height)||(t.height=.5*Ae.config.height),(null==t?void 0:t.lineWidth)||(t.lineWidth=1),(null==t?void 0:t.stroke)||(t.stroke=Le.darkRed),(null==t?void 0:t.arrowDeg)||(t.arrowDeg=30),(null==t?void 0:t.arrowLength)||(t.arrowLength=10),(null==t?void 0:t.lineDash)||(t.lineDash=[10,7]),t.points=[-t.width,0,t.width,0,0,t.height,0,-t.height];const e=.5*(t.arrowLength||10);super(new bp({points:[-e,0,0,e,e,0,0,-e]}),new ap({fill:Le.darkRed})),c(this,"name","Axes"),c(this,"params"),c(this,"xShape"),c(this,"yShape"),c(this,"xRShape"),c(this,"yRShape"),this.params=t,this.xShape=new hp(new $m({points:[2*e,0,t.width,0],linewidth:t.lineWidth,edArrow:!0,arrowLength:t.arrowLength,arrowDeg:t.arrowDeg}),new ap({stroke:Le.darkRed,lineWidth:1})),this.yShape=new hp(new $m({points:[0,2*e,0,t.height],linewidth:t.lineWidth,edArrow:!0,arrowLength:t.arrowLength,arrowDeg:t.arrowDeg}),new ap({stroke:Le.darkGreen,lineWidth:1})),this.xRShape=new hp(new $m({points:[-2*e,0,-t.width,0],linewidth:t.lineWidth}),new ap({stroke:Le.darkRed,lineWidth:1,lineDash:t.lineDash})),this.yRShape=new hp(new $m({points:[0,-2*e,0,-t.height],linewidth:t.lineWidth}),new ap({stroke:Le.darkGreen,lineWidth:1,lineDash:t.lineDash})),this.add(this.xShape),this.add(this.yShape),this.add(this.xRShape),this.add(this.yRShape),this.computeBoundingBox()}computeBoundingBox(){var t;return(null==(t=this.params)?void 0:t.fixed)?this.boundingBox.makeEmpty():super.computeBoundingBox(),this.boundingBox}updateModelViewMatrix(t){var e;(null==(e=this.params)?void 0:e.fixed)?t?(this.modelViewMatrix.copy(t.viewMatrix),this.computeAxes(t)):this.modelViewMatrix.copy(this.matrixWorld):super.updateModelViewMatrix(t)}computeAxes(t){if(!t)return;t.updateBoundingBox();const e=t.scaled.x,i=this.params.lineWidth*e,n=[this.params.lineDash[0]*e,this.params.lineDash[1]*e],s=(this.params.arrowLength||10)*e,r=s/4;this.xShape.geo.arrowLength=s,this.xShape.geo.setPoints([s+r,0,t.boundingBoxWorld.max.x,0]),this.xShape.geo.lineWidth=i,this.yShape.geo.arrowLength=s,this.yShape.geo.setPoints([0,s+r,0,t.boundingBoxWorld.max.y]),this.yShape.geo.lineWidth=i,this.xRShape.geo.setPoints([-s-r,0,t.boundingBoxWorld.min.x,0]),this.xRShape.geo.lineWidth=i,this.xRShape.mtl.lineDash=n,this.yRShape.geo.setPoints([0,-s-r,0,t.boundingBoxWorld.min.y]),this.yRShape.geo.lineWidth=i,this.yRShape.mtl.lineDash=n,this.geo.setPoints([-s,0,-r,r,0,s,r,r,s,0,r,-r,0,-s,-r,-r])}}class ig extends Gm{constructor(t={},e){super(),c(this,"isMainScene",!0),c(this,"name","MainScene"),c(this,"params"),c(this,"adapter"),c(this,"featureKey","MainScene_"+this.id),c(this,"axesHelper"),c(this,"resourcesMap",{}),c(this,"legend",[]),c(this,"_viewBox",new ai),this.params=t,this.adapter=e,this.selectable=!0,this.initAxesHelper()}destroy(){var t;super.destroy(),this.resourcesMap={},this.legend=[],null==(t=this.axesHelper)||t.destroy()}initAxesHelper(){this.params.axesHelper&&(this.axesHelper&&this.axesHelper.destroy(),this.axesHelper=new eg({fixed:!0,lineWidth:.5}),this.add(this.axesHelper))}setViewBox(t){t&&this._viewBox.copy(t)}computeBoundingBox(){if(super.computeBoundingBox(),!this._viewBox.isEmpty()){this._viewBox.getCenter(ng),this.boundingBox.getCenter(sg);if(Math.round(We.getDistance(ng,sg)))return this._viewBox}return this.boundingBox}getBoundingBox(){return this._viewBox.isEmpty()?this.boundingBox:this._viewBox}add(t){return super.add(t),t.userData.id?(this.resourcesMap[t.userData.id]||(this.resourcesMap[t.userData.id]=[]),this.resourcesMap[t.userData.id].push(t),this):this}remove(t){if(!t)return this;if(super.remove(t),this.resourcesMap[t.userData.id]){const e=this.resourcesMap[t.userData.id].indexOf(t);e>-1&&this.resourcesMap[t.userData.id].splice(e,1),this.resourcesMap[t.userData.id].length||delete this.resourcesMap[t.userData.id]}return this}getAssetIdsByType(t){const e=[];return this.traverse((i=>{i.userData.assetType===t&&i.userData.id&&e.push(i.userData.id)})),e}getByIds(t,e=[]){if(e.length=0,!t)return e;Array.isArray(t)||(t=[t]);for(let i=0,n=(null==t?void 0:t.length)||0;i<n;i++)Object.hasOwnProperty.call(this.resourcesMap,t[i])&&e.push(...this.resourcesMap[t[i]]);return e}setFillOrStrokeByIds(t,e,i="fill"){this.traverse((n=>{var s;if(!n.mtl||!t.includes(n.userData.id))return;const r=ri.cloneDeep(n.mtl);"fill"===i?r.fill=e:"stroke"===i&&(r.stroke=e,r.lineWidth=5),n.mtl=vp.getMtl(r),this.addLegend(i,e,null==(s=n.userData)?void 0:s.id)})),this.needsUpdate=!0}clearFillOrStroke(t,e){this.traverse((i=>{var n,s,r,a,o,h;if(!i.mtl)return;if(e&&!e.includes(i.userData.id))return;const l=ri.cloneDeep(i.mtl);void 0!==t&&"fill"!==t||!(null==l?void 0:l.fill)||(l.fill=(null==(s=null==(n=i.userData)?void 0:n.style)?void 0:s.fill)||void 0),void 0!==t&&"stroke"!==t||!(null==l?void 0:l.stroke)||(l.stroke=(null==(a=null==(r=i.userData)?void 0:r.style)?void 0:a.stroke)||void 0,l.lineWidth=(null==(h=null==(o=i.userData)?void 0:o.style)?void 0:h.lineWidth)||1),i.mtl=vp.getMtl(l)})),this.needsUpdate=!0,this.clearLegendBy(t)}increaseFontSize(t=1.1){this.traverse((e=>{var i;e.mtl&&e.isText&&(null==(i=e.mtl)?void 0:i.text)&&(e.scaled.multiplyScalar(t),e.updateMatrix(),e.needsUpdate=!0)}));const e=ri.uniq(ri.compact(ri.map(this.children,(t=>t.userData.aid))));this.recomputedAssetLabels(e),this.needsUpdate=!0}increaseStrokeWidth(t=1.1){this.traverse((e=>{var i;e.mtl&&(null==(i=e.mtl)?void 0:i.stroke)&&e.geo.lineWidth&&(e.geo.lineWidth*=t)})),this.needsUpdate=!0}addLegend(t,e,i){let n=this.legend.find((t=>t.color===e));n||(n={type:t,color:e,ids:[]},this.legend.push(n)),n.ids.push(i)}getLegend(){return this.legend}clearLegendBy(t){var e;t||(this.legend.length=0);for(let i=(null==(e=this.legend)?void 0:e.length)-1;i>=0;i--)this.legend[i].type===t&&this.legend.splice(i,i)}getAssetLabels(t,e){var i,n,s,r,a;const o=ri.filter(this.children,(t=>{var i;return(null==(i=t.userData)?void 0:i.aid)===e}));if(!(null==o?void 0:o.length))return;const h=[];for(let t,e=0,l=o.length;e<l;e++){t=o[e],(null==(i=t.mtl)?void 0:i.text)&&h.push(null==(n=t.mtl)?void 0:n.text);for(let e,i=0,n=(null==(s=null==t?void 0:t.children)?void 0:s.length)||0;i<n;i++)e=t.children[i],(null==(r=null==e?void 0:e.mtl)?void 0:r.text)&&h.push(null==(a=null==e?void 0:e.mtl)?void 0:a.text)}return h}setAssetLabels(t,e){if(!ri.find(this.children,(e=>{var i;return(null==(i=e.userData)?void 0:i.id)===t})))return;const i=ri.filter(this.children,(e=>{var i;return(null==(i=e.userData)?void 0:i.aid)===t}));if(!(null==i?void 0:i.length))return;const n=i[i.length-1];for(let t=0,s=((null==e?void 0:e.length)||0)-((i.length||0)-1);t<s;t++){const t=n.clone(!0,!0);this.add(t),t.updateMatrix(),i.push(t)}for(let t=1,n=(null==i?void 0:i.length)||0;t<n;t++){const n=i[t];n.mtl.text=(null==e?void 0:e.length)?e[t-1]:void 0,n.needsUpdate=!0}this.recomputedAssetLabels(t)}recomputedAssetLabels(t){if(t){Array.isArray(t)||(t=[t]);for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++){let i=ri.filter(this.children,(i=>{var n,s;return(null==(n=i.userData)?void 0:n.aid)===t[e]&&!!(null==(s=i.mtl)?void 0:s.text)}));if(!(null==i?void 0:i.length))return;for(let t,e=0,n=(null==i?void 0:i.length)||0;e<n;e++)t=i[e],t.computeBoundingBox(),t.updateBoundingBox(),rg.copy(t.boundingBoxWorld).getSize(sg),ng.copy(i[e?e-1:0].position),sg.multiplyScalar(1.2),e&&(t.position.set(ng.x,ng.y-sg.y),t.updateMatrix())}}}clearAssetLabels(t){const e=t?this.getAssetIdsByType(t):this.children.map((t=>t.userData.id&&t.userData.assetType));for(let t,i=0,n=(null==e?void 0:e.length)||0;i<n;i++)if(t=ri.filter(this.children,(t=>{var n;return(null==(n=t.userData)?void 0:n.aid)===e[i]})),(null==t?void 0:t.length)&&1!==t.length)for(let e=t.length-1;e>0;e--)t[e].destroy(),this.remove(t[e])}getAssetBoundingBox(t,e=new ai){if(e.makeEmpty(),!t)return e;Array.isArray(t)||(t=[t]);for(let i,n=0,s=(null==t?void 0:t.length)||0;n<s;n++){i=t[n];const s=this.getByIds(i);if(null==s?void 0:s.length)for(let t=0,i=s.length;t<i;t++)e.union(s[t].boundingBoxWorld)}return e}setAssetType(t,e){var i,n;const s=[t];t!==Li.RM&&s.push(Li.RM);const r=null==(i=this.adapter)?void 0:i.getAssetIdsByType(s);(null==r?void 0:r.length)&&(null==(n=this.adapter)||n.updateLayersVisibility(r,!0))}}const ng=new We,sg=new We,rg=new ai;class ag extends Xf{constructor(t={}){super(),c(this,"name","AnimateScene"),c(this,"params"),c(this,"resourcesMap",{}),c(this,"dynamicFill",Le.red),c(this,"dynamicScale",new We(1,1)),c(this,"clock",new Lf),c(this,"mixer"),c(this,"_selectedClip"),c(this,"selectedAction"),this.params=t,this.initAxesHelper(),this.mixer=new Pm(this)}destroy(){super.destroy()}initAxesHelper(){this.params.axesHelper&&(this.axesHelper&&this.axesHelper.destroy(),this.axesHelper=new eg({fixed:!0,lineWidth:.5}),this.add(this.axesHelper))}add(t){return super.add(t),t.userData.id?(this.resourcesMap[t.userData.id]||(this.resourcesMap[t.userData.id]=[]),this.resourcesMap[t.userData.id].push(t),this):this}remove(t){if(!t)return this;if(super.remove(t),this.resourcesMap[t.userData.id]){const e=this.resourcesMap[t.userData.id].indexOf(t);e>-1&&this.resourcesMap[t.userData.id].splice(e,1),this.resourcesMap[t.userData.id].length||delete this.resourcesMap[t.userData.id]}return this}getByIds(t,e=[]){if(e.length=0,!t)return e;Array.isArray(t)||(t=[t]);for(let i=0,n=(null==t?void 0:t.length)||0;i<n;i++)Object.hasOwnProperty.call(this.resourcesMap,t[i])&&e.push(...this.resourcesMap[t[i]]);return e}getAssetBoundingBox(t,e=new ai){if(e.makeEmpty(),!t)return e;Array.isArray(t)||(t=[t]);for(let i,n=0,s=(null==t?void 0:t.length)||0;n<s;n++){i=t[n];const s=this.getByIds(i);if(null==s?void 0:s.length)for(let t=0,i=s.length;t<i;t++)e.union(s[t].boundingBoxWorld)}return e}onBeforeRender(){}update(t){var e;null==(e=this.mixer)||e.update(this.clock.getDelta())}}class og extends Xf{constructor(t={}){var e,i;super(),c(this,"isEmptyScene",!0),c(this,"name","EmptyScene"),c(this,"params"),c(this,"loadingShape"),c(this,"lineShape"),c(this,"triangleShape"),c(this,"scales",[.95,1.15,.002]),c(this,"l",0),c(this,"scaleTrend",!1),c(this,"clock",new Lf),c(this,"mixer"),c(this,"_selectedClip"),c(this,"selectedAction"),this.params=t,this.loadingShape=new km(hg,{fill:Le.darkGray,flipY:!0}),this.loadingShape.name="loading",this.loadingShape.dynamically=!0,this.add(this.loadingShape),this.loadingShape.updateMatrixWorld(),this.loadingShape.computeBoundingBox(),this.loadingShape.updateBoundingBox(),cg.copy(this.loadingShape.boundingBoxWorld).getCenter(lg),cg.getSize(ug),this.loadingShape.setPosition(lg.negate()).updateMatrix(),this.l=ug.x;const n=Math.max(Math.floor(this.l/30),2),s=[-this.l/2,-(10+n),-this.l/2,-10,this.l/2,-10,this.l/2,-(10+n)];this.lineShape=new Om({points:s,fill:Le.darkGray}),this.add(this.lineShape),this.lineShape.name="loadingLine";const r=[0,0,ug.x/2,ug.x,ug.x,0];this.triangleShape=new Om({points:r,fill:Le.darkRed}),this.add(this.triangleShape),this.triangleShape.name="loadingTriangle",this.triangleShape.setPosition(new We(-.12*ug.x,ug.y/-.4)).setScale(.25,.15).updateMatrix(),this.computeBoundingBox(),this.mixer=new Pm(this);const a=new om(`${this.loadingShape.name}.mtl.fill`,[0,1.2,2],[0,0,0,.7,.38,.38,.38,.7,0,0,0,.7]),o=new hm(`${this.triangleShape.name}.mtl.fillOpacity`,[0,1.5,3],[1,.8,1],hm.DefaultInterpolation),h=new om(`${this.lineShape.name}.scaled`,[0,1.5,3],[1,1,.6,1,1,1]);this._selectedClip=new dm("selected",3,[a,o,h]),this.selectedAction=null==(e=this.mixer)?void 0:e.clipAction(this._selectedClip,this.desScene),null==(i=this.selectedAction)||i.play()}destroy(){super.destroy()}onBeforeRender(){this.lineShape.updateMatrix()}update(){var t;null==(t=this.mixer)||t.update(this.clock.getDelta())}}const hg='\n<path d="M13.5 15.8L12.62 17.3L0.799999 17.3L0.799999 5.8L13.46 5.8L12.56 7.3L4.84 7.3L4.84 10.66L13.12 10.66L12.24 12.18L4.84 12.18L4.84 15.8L13.5 15.8Z\nM32.12 17.3L28.52 17.3L28.52 9.9L25.18 17.3L22.1 17.3L18.8 10L18.8 17.3L15.1 17.3L15.1 5.8L20.06 5.8L23.68 13.68L27.32 5.8L32.12 5.8L32.12 17.3Z\nM37.72 12.8L37.72 17.3L33.72 17.3L33.72 5.8L42.22 5.8L41.06 7.34L37.72 7.34L37.72 11.3L42.22 11.3L42.22 5.8L46.28 5.8L46.28 12.8L37.72 12.8Z\nM57 17.3L53 17.3L53 7.34L47.88 7.34L47.88 5.8L62.48 5.8L61.6 7.34L57 7.34L57 17.3Z\nM69.92 13.52L64.08 5.78L68.62 5.78L71.92 10.58L75.14 5.78L79.64 5.78L73.92 13.56L73.92 17.28L69.92 17.28L69.92 13.52Z" />\n',lg=new We,ug=new We,cg=new ai;class dg{constructor(t,i){c(this,"parent"),c(this,"view"),c(this,"scenes",[]),c(this,"oriScene"),c(this,"dstScene"),c(this,"_fnEnable",null==(e=Ae.config)?void 0:e.fnEnable),this.parent=t,this.view=i}fnEnableChanged(t){this._fnEnable=!!t}activate(){}deactivate(){this.scenes=[],this.oriScene=void 0,this.dstScene=void 0}bindScene(...t){return this.scenes.length=0,this.scenes.push(...t),this.oriScene=this.scenes.find((t=>t.isStatic)),this.dstScene=this.scenes.find((t=>t.isDynamic)),this}getDynamicObjectsByIds(t){var e,i,n;const s=[];if(null==(e=this.dstScene)||e.getByIds(t,s),null==s?void 0:s.length)return s;const r=null==(i=this.oriScene)?void 0:i.getByIds(t);if(!(null==r?void 0:r.length))return s;for(let t=0,e=(null==r?void 0:r.length)||0;t<e;t++){const e=r[t].clone(!0,!0);null==(n=this.dstScene)||n.add(e),s.push(e)}return s}clearDynamicObjectsByIds(t){var e,i;if(!t)return;Array.isArray(t)||(t=[t]);const n=null==(e=this.dstScene)?void 0:e.getByIds(t);if(null==n?void 0:n.length)for(let t,e=0,s=(null==n?void 0:n.length)||0;e<s;e++)t=n[e],null==(i=this.dstScene)||i.remove(t),t.destroy()}getColorKeyframeTrack(t,e,i=.5,n=[0,1.2,2]){const s=new Re(e).setA(i).getNormalized(),r=[...s,.38*s[0],.38*s[1],.38*s[2],.5*s[3],...s];return new lm(t,n,r)}}class pg extends dg{constructor(t,e){super(t,e),c(this,"type",Go.HOVER),c(this,"rayCaster",new ur),c(this,"_hoverIds",[]),c(this,"hoverAction"),c(this,"_hoverClip"),c(this,"dynamicStroke",Le.red);const i=this.getColorKeyframeTrack(".dynamicStroke",Le.darkRed,.8);this._hoverClip=new dm("selected",1,[i])}activate(){var t;super.activate(),this.hoverAction=null==(t=this.parent.mixer)?void 0:t.clipAction(this._hoverClip,this)}deactivate(){var t,e;super.deactivate(),null==(t=this.hoverAction)||t.stop(),null==(e=this.parent.mixer)||e.removeAction(this.hoverAction),this.hoverAction=void 0,this._hoverIds=[]}handlePointerOver(t){var e,i,n,s,r,a;const{id:o,target:h,isStatic:l,isDynamic:u,isDummy:c}=(null==t?void 0:t.data)||{};if(this._hoverIds.includes(o))return;const d=(null==(i=null==(e=this.view)?void 0:e.camera)?void 0:i.pixelWidth)||1,p=this.getDynamicObjectsByIds(o);c&&(ri.set(t,"data.rmId",null==(n=null==h?void 0:h.userData)?void 0:n.rmId),ri.set(t,"data.wsId",null==(s=null==h?void 0:h.userData)?void 0:s.wsId),ri.set(t,"data.label",null==(r=null==h?void 0:h.userData)?void 0:r.label)),fg(p,d),this._hoverIds.push(o),null==(a=this.hoverAction)||a.play(),this.parent.editor.dispatchEvent({type:Mi.POINTER_OVER,data:null==t?void 0:t.data})}handleOut(t){this.clearHover(),this.parent.editor.dispatchEvent({type:Mi.POINTER_OUT,data:null==t?void 0:t.data})}clearHover(){var t;if(null==(t=this.hoverAction)||t.stop(),this.dstScene){for(let t=0,e=this._hoverIds.length;t<e;t++){const e=this.dstScene.getByIds(this._hoverIds[t]);e.length&&mg(e)}this._hoverIds=[]}}traverse(t){var e;if(this.dstScene)for(let i=0,n=(null==(e=this._hoverIds)?void 0:e.length)||0;i<n;i++){const e=this.dstScene.getByIds(this._hoverIds[i]);for(let i=0,n=(null==e?void 0:e.length)||0;i<n;i++)t(e[i])}}update(){var t,e;(null==(e=null==(t=this.dstScene)?void 0:t.children)?void 0:e.length)&&this.traverse((t=>{t.traverse((t=>{t.isShape&&(t.mtl.stroke=this.dynamicStroke)}))}))}}const fg=(t,e=1)=>{if(t){Array.isArray(t)||(t=[t]);for(let i,n=0,s=t.length;n<s;n++)i=t[n],i.traverse((t=>{t.isShape&&(t.userData.actType|=Xo.HOVER,t.geo.lineWidth=5*e,t.mtl.stroke=Le.darkYellow,t.mtl.lineJoin="round")}))}},mg=(t,e=1)=>{if(t){Array.isArray(t)||(t=[t]);for(let e,i=0,n=t.length;i<n;i++)e=t[i],e.traverse((t=>{var e,i,n;t.isShape&&(t.userData.actType&=~Xo.HOVER,t.geo.lineWidth=null==(i=null==(e=t.userData)?void 0:e.style)?void 0:i.lineWidth,t.mtl.stroke=null==(n=t.userData.style)?void 0:n.stroke,t.mtl.lineJoin=void 0)}))}};class gg extends dg{constructor(t,e){super(t,e),c(this,"type",Go.SELECT),c(this,"intersects",[]),c(this,"rayCaster"),c(this,"_selectedIds",[]),c(this,"_selectedClip"),c(this,"selectedAction"),c(this,"dynamicSelectFill",Le.red),c(this,"dynamicSelectStroke",Le.red),this.rayCaster=new ur;const i=this.getColorKeyframeTrack(".dynamicSelectFill",Le.red,.5),n=this.getColorKeyframeTrack(".dynamicSelectStroke",Le.darkRed,.8);this._selectedClip=new dm("selected",3,[i,n])}get _selectEnable(){var t,e;return!(!(null==(t=Ae.config)?void 0:t.selectEnable)||!(null==(e=this.view)?void 0:e.camera))}get _multiSelectEnable(){return Ae.config.multiSelectEnable}get _dragEnable(){var t,e;return(null==(t=Ae.config)?void 0:t.multiSelectEnable)&&(null==(e=Ae.config)?void 0:e.fnEnable)}activate(){var t;super.activate(),this.selectedAction=null==(t=this.parent.mixer)?void 0:t.clipAction(this._selectedClip,this)}deactivate(){var t,e;this.clearSelected(),super.deactivate(),null==(t=this.selectedAction)||t.stop(),null==(e=this.parent.mixer)||e.removeAction(this.selectedAction),this.selectedAction=void 0,this.intersects=[],this._selectedIds=[]}setDynamicFill(t){}handleTap(t){if(this.intersects.length=0,!this.oriScene)return;if(!this._selectEnable&&!this._multiSelectEnable)return;this.rayCaster.init(t.data,this.view.camera).intersectObjectBy(this.oriScene,this._validFilter.bind(this),!0,this.intersects);const e=ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e,i;return(null==(e=t.userData)?void 0:e.assetType)===Ae.config.assetType?null==(i=t.userData)?void 0:i.id:""}))));this.selectByIds(e,!0),this.parent.editor.dispatchEvent({type:Mi.SELECTED,data:this._selectedIds})}handlePanStart(t){var e;if((null==t?void 0:t.type)===jh.PAN_START&&this._dragEnable){if(!this.dstScene)throw new Error("No dynamic scene found!");this.parent.editor.setEnablePan(!1),yg.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),xg.makeEmpty().expandByPoint(yg)}}handlePanMove(t){var e;(null==t?void 0:t.type)===jh.PAN_MOVE&&this._dragEnable&&(vg.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),xg.makeEmpty().expandByPoint(yg).expandByPoint(vg))}handlePanEnd(t){var e,i;if(this.intersects.length=0,(null==t?void 0:t.type)!==jh.PAN_END)return;if(!this._dragEnable)return;vg.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),xg.makeEmpty().expandByPoint(yg).expandByPoint(vg),this.rayCaster.init({worldBox:xg},null==(i=this.view)?void 0:i.camera).intersectObjectBy(this.oriScene,this._validFilter.bind(this),!0,this.intersects);const n=ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e,i,n;return(null==(e=t.userData)?void 0:e.assetType)===(null==(i=Ae.config)?void 0:i.assetType)?null==(n=t.userData)?void 0:n.id:""}))));this.selectByIds(n,this._multiSelectEnable),this.parent.editor.dispatchEvent({type:Mi.SELECTED,data:this._selectedIds})}_validFilter(t){var e,i,n;if(!t.visible||!t.selectable||(null==(e=t.userData)?void 0:e.assetType)!==(null==(i=Ae.config)?void 0:i.assetType))return!1;return!ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e;return null==(e=t.userData)?void 0:e.id})))).includes(null==(n=t.userData)?void 0:n.id)}traverse(t){if(!this.dstScene)return;const e=this.dstScene.getByIds(this._selectedIds);if(null==e?void 0:e.length)for(let i=0,n=(null==e?void 0:e.length)||0;i<n;i++)t(e[i])}update(){var t,e;if(!(null==(e=null==(t=this.dstScene)?void 0:t.children)?void 0:e.length))return;const i=this.getDynamicObjectsByIds(this._selectedIds);for(let t,e=0,n=(null==i?void 0:i.length)||0;e<n;e++)t=i[e],t.isShape&&(t.userData.actType||0)&Xo.SELECT&&t.traverse((t=>{t.mtl.fill=this.dynamicSelectFill,t.mtl.stroke=this.dynamicSelectStroke}))}hasSelected(t){return this._selectedIds.includes(t)}clearSelected(t){if(this.dstScene){if(!t||!(null==t?void 0:t.length))return this.clearDynamicObjectsByIds(this._selectedIds),void(this._selectedIds.length=0);Array.isArray(t)||(t=[t]),this.clearDynamicObjectsByIds(t);for(let e=0,i=t.length;e<i;e++){const i=this._selectedIds.indexOf(t[e]);i>-1&&this._selectedIds.splice(i,1)}}}selectByIds(t,e){var i,n;if(t&&this.oriScene&&this.dstScene){if(Array.isArray(t)||(t=[t]),null==(i=this.selectedAction)||i.stop(),this._selectEnable){const i=this.hasSelected(t[0]);if(i?this.clearSelected(t[0]):this.clearSelected(),i&&e)return}else this._multiSelectEnable&&(e||this.clearSelected());this.toggleSelectByIds(t,e),null==(n=this.selectedAction)||n.play()}}toggleSelectByIds(t,e){if(this.oriScene&&this.dstScene){Array.isArray(t)||(t=[t]);for(let i=0,n=t.length;i<n;i++){if(this.hasSelected(t[i])){e&&this.clearSelected(t[i]);continue}const n=this.getDynamicObjectsByIds(t[i]);if(null==n?void 0:n.length){for(let t=0,e=n.length;t<e;t++){n[t].moveToLast();const e=this.getDynamicObjectsByIds(n[t].userData.id);for(let t=0,i=(null==e?void 0:e.length)||0;t<i;t++){const i=e[t];i.moveToLast(),i.traverse((t=>{var e;(null==t?void 0:t.isShape)&&(t.userData.actType|=Xo.SELECT,t.geo.lineWidth=5*((null==(e=t.userData.style)?void 0:e.strokeWidth)||1))}))}}this._selectedIds.push(t[i])}}}}}const yg=new We,vg=new We,xg=new ai;class bg extends hp{constructor(t={}){var e;const{x:i=0,y:n=0,w:s=10,h:r=10}=t,a=s/2,o=r/2;(null==(e=t.points)?void 0:e.length)||(t.points=[i-a,n-o,i-a,n+o,i+a,n+o,i+a,n-o,i-a,n-o]);const h=new bp(t),l=new ap(t);(null==t?void 0:t.lineWidth)||(l.lineWidth=1),super(h,l),c(this,"name","Rect")}setPoints(t){return!t||t.length<2||this.geo.setPoints(t),this}}class wg extends dg{constructor(t,e){super(t,e),c(this,"type",Go.SELECTOR_RECT),c(this,"_fnEnable",!1),c(this,"selector"),c(this,"rayCaster",new ur),c(this,"intersects",[]),this.selector=new bg({name:_g,fill:new Re(Le.darkBlue).setA(.1).getStyle(),stroke:Le.darkBlue,lineWidth:1,lineDash:[5,5]})}activate(){super.activate()}deactivate(){super.deactivate(),this.intersects=[]}bindScene(...t){var e,i;return super.bindScene(...t),(null==(e=this.dstScene)?void 0:e.getObjectByProperty("name",_g))||null==(i=this.dstScene)||i.add(this.selector),this}fnEnableChanged(t){this._fnEnable=!!t}get _dragEnable(){var t;return(null==(t=Ae.config)?void 0:t.multiSelectEnable)&&this._fnEnable}handlePanStart(t){var e;if(this._dragEnable&&(null==t?void 0:t.type)===jh.PAN_START){if(!this.dstScene)throw new Error("No dynamic scene found!");this.parent.editor.setEnablePan(!1),Sg.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Mg.makeEmpty().expandByPoint(Sg),this.selector.setVisible(!0).setPoints([Sg.x,Sg.y])}}handlePanMove(t){var e;this._dragEnable&&(null==t?void 0:t.type)===jh.PAN_MOVE&&(Eg.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Mg.makeEmpty().expandByPoint(Sg).expandByPoint(Eg),this.selector.setPoints(Mg.round().getNumbersArray()))}handlePanEnd(t){var e;this.parent.editor.setEnablePan(!0),this._dragEnable&&(null==t?void 0:t.type)===jh.PAN_END&&(Eg.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Mg.makeEmpty().expandByPoint(Sg).expandByPoint(Eg),this.selector.setVisible(!1))}}const _g="EDITOT_SELECTOR",Sg=new We,Eg=new We,Mg=new ai;class Ag extends dg{constructor(t,e){super(t,e),c(this,"type",Go.DRAG),c(this,"_fnEnable",!1),c(this,"dragMode",Zo.MAKE_COPY),c(this,"rayCaster",new ur),c(this,"intersects",[]),c(this,"_currentObject"),c(this,"_originalPosition",new We),c(this,"_dragOffset",new We),c(this,"_objectFilter"),c(this,"_getDragabledHandler")}activate(){super.activate()}deactivate(){super.deactivate(),this.intersects=[],this._currentObject=void 0}setDraggingObject(t){this.handlePanStart({type:jh.PAN_START,data:{target:t}})}handlePanStart(t){var e,i,n;if((null==t?void 0:t.type)!==jh.PAN_START)return;if(!this.dstScene)throw new Error("No dynamic scene found!");if(!(null==(e=null==t?void 0:t.data)?void 0:e.target))return;let s;s="function"==typeof this._getDragabledHandler?this._getDragabledHandler(null==(i=null==t?void 0:t.data)?void 0:i.target):null==(n=null==t?void 0:t.data)?void 0:n.target,s&&(this.parent.editor.setEnablePan(!1),this._currentObject=s,this.parent.handleDragStart(t))}handlePanMove(t){(null==t?void 0:t.type)===jh.PAN_MOVE&&this._currentObject&&(this._currentObject.position.copy(t.data.worldCoords),this._currentObject.updateMatrix(),this._currentObject.updateWorldMatrix(!0,!1))}handlePanEnd(t){var e;this.parent.editor.setEnablePan(!0),(null==t?void 0:t.type)===jh.PAN_END&&(ri.set(t,"data.target",this._currentObject),this.parent.handleDragEnd(t),this._currentObject=void 0,null==(e=this.view.camera)||e.update())}bindFilter(t){this._objectFilter=t}_defaultFilter(t){return t.visible&&t.selectable}_validFilter(t){return this._objectFilter?this._objectFilter(t):this._defaultFilter(t)}bindGetDragabledHandler(t){this._getDragabledHandler=t}}class Tg extends Yh{constructor(t){super(t),this._init(t)}buildPath(t,e,i){if(0===this.percent)return;let{x:n=0,y:s=0,radius:r,startAngle:a=0,endAngle:o=2*Math.PI}=e||this;t.arc(n,s,r,a,o)}}class Cg extends hp{constructor(t=new Tg,e=new ap,i){super(t,e,i),c(this,"name","Sprite"),c(this,"isSprite",!0)}updateModelViewMatrix(t){if(t){Ig.makeScale(t.scaled.x,t.scaled.y).premultiply(this.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.viewMatrix,Ig);for(let e=0,i=this.children.length;e<i;e++)this.children[e].updateModelViewMatrix(t)}}}const Ig=new Ui;class Dg extends Cg{constructor(){super(...arguments),c(this,"isDummy",!0),c(this,"composeNode",!0),c(this,"selectable",!0),c(this,"visible",!0),c(this,"renderOrder",1/0),c(this,"txtShape")}setText(t){var e;(null==(e=this.txtShape)?void 0:e.mtl)&&(this.txtShape.mtl.text=t)}setLabel(t,e){this.userData.label=t}updateModelViewMatrix(t){var e,i;if(super.updateModelViewMatrix(t),!this.txtShape)return;const n=1.2*((null==(e=this.params)?void 0:e.radius)||10)*((null==(i=null==t?void 0:t.scaled)?void 0:i.x)||1);this.txtShape.mtl.fontSize=n,this.txtShape.position.set(0,-n/2),this.txtShape.updateMatrix()}}class Lg extends Dg{constructor(t,e={}){var i,n;e.radius||(e.radius=null==(n=null==(i=Ae.config)?void 0:i.dummy)?void 0:n.radius);const s=new Tg({x:0,y:0,radius:e.radius,thinLine:!0}),r=new ap({fill:Le.blue,stroke:Le.darkBlue});super(s,r),c(this,"params"),c(this,"dragable",!0),c(this,"radius"),this.params=e,this.userData=u(l({},t),{assetType:Bi,style:{fill:r.fill,stroke:r.stroke,lineWidth:r.lineWidth}}),this.txtShape=new wp({text:(t.label||"").substring(0,1),fontSize:1.2*e.radius,fill:Le.white,textBaseline:"ideographic",fontWeight:"300"}),this.add(this.txtShape)}}class Bg extends Dg{constructor(t,e={}){var i,n;e.radius||(e.radius=null==(n=null==(i=Ae.config)?void 0:i.dummy)?void 0:n.radius);const s=e.radius,r=new _p({x:-s,y:-s,w:2*s,h:2*s,r:s/2}),a=new ap({fill:Le.blue,stroke:Le.darkBlue});super(r,a),c(this,"params"),c(this,"txtShape"),this.params=e,this.userData=u(l({},t),{assetType:Bi,style:{fill:a.fill,stroke:a.stroke,lineWidth:a.lineWidth}}),this.txtShape=new wp({text:"1",fontSize:e.radius,fill:Le.white,textBaseline:"ideographic",fontWeight:"300"}),this.add(this.txtShape),this.needsUpdate=!0}}class Pg extends dg{constructor(t,e){super(t,e),c(this,"type",Go.DUMMY),c(this,"_fnEnable",!1),c(this,"_dummies",[]),c(this,"_centroidCache",{}),c(this,"_rmMap",new Map),c(this,"_mergedMap",new Map),c(this,"action"),c(this,"_clip"),c(this,"dynamicDummyFill",Le.red),c(this,"dynamicDummyStroke",Le.darkRed),c(this,"rayCaster",new ur),c(this,"intersects",[]),c(this,"_currentDummy"),c(this,"_unboundDummiesMap",{}),c(this,"_cameraHandler",this.handleCameraUpdate.bind(this)),c(this,"_getDragabledHandler",this.getDragabled.bind(this));const i=new lm(".dynamicDummyFill",[0,.6,1],[.95,.38,.38,.8,.95,.38,.38,.3,.95,.38,.38,.8]),n=new lm(".dynamicDummyStroke",[0,.6,1],[.95,.38,.38,.8,.95,.38,.38,.3,.95,.38,.38,.8]);this._clip=new dm("currentDummy",1,[i,n]),this.bindEvents()}destroy(){this.deactivate(),this.unbindEvents()}bindEvents(){var t,e;null==(e=null==(t=this.view)?void 0:t.camera)||e.addEventListener(er.UPDATE,this._cameraHandler)}unbindEvents(){var t,e;null==(e=null==(t=this.view)?void 0:t.camera)||e.removeEventListener(er.UPDATE,this._cameraHandler)}activate(){var t;super.activate(),this.action=null==(t=this.parent.mixer)?void 0:t.clipAction(this._clip,this);const e=this.parent.get(Go.DRAG);e&&(e.bindFilter(this._validFilter.bind(this)),e.bindGetDragabledHandler(this._getDragabledHandler))}deactivate(){var t,e;this.clearDummies(),super.deactivate(),null==(t=this.action)||t.stop(),null==(e=this.parent.mixer)||e.removeAction(this.action),this.action=void 0,this._dummies=[],this._centroidCache={},this._rmMap=new Map,this._mergedMap=new Map,this.intersects=[];const i=this.parent.get(Go.DRAG);i&&(i.bindFilter(),i.bindGetDragabledHandler())}fnEnableChanged(t){this._fnEnable=!!t}bindEditorDrag(t){let e=this.getDummyById(null==t?void 0:t.id);e||(e=(null==t?void 0:t.rmId)?this.addDummy(t):this.addDummyUnbound(t)),e&&(e.visible=!1)}getDraggingObject(t){return this.getDummyById(null==t?void 0:t.id)}getDragabled(t){var e;if(!t)return;if(Array.isArray(t)||(t=[t]),!t.length)return;const i=t[0];let n=this._unboundDummiesMap[null==(e=i.userData)?void 0:e.id];return!n&&i.dragable&&(i.mtl.fill=i.userData.style.fill=new Re(Le.blue).setA(.5).getStyle(),i.mtl.lineDash=[2,2],i.userData.status=Jo.MODIFIED,n=this.addDummyUnbound(i.userData)),n&&(n.visible=!0),n}handleDragEnd(t){var e;if(!this.oriScene)throw new Error("No dynamic scene found!");const{target:i}=(null==t?void 0:t.data)||{};if(!(null==i?void 0:i.isDummy))return;const n=[],s=u(l({},null==t?void 0:t.data),{screenCoords:i.position});if(this.rayCaster.init(s,this.view.camera).intersectObjectBy(this.oriScene,this._assetFilter.bind(this),!0,n),!(null==n?void 0:n.length))return;i.userData.rmId=null==(e=n[0].userData)?void 0:e.id;const r=this.getDummiesVo(!0);this.parent.editor.dispatchEvent({type:Mi.DRAG_END,data:r})}_validFilter(t){var e,i;if(!t.visible||!t.selectable||(null==(e=t.userData)?void 0:e.assetType)!==Bi)return!1;return!ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e;return null==(e=t.userData)?void 0:e.id})))).includes(null==(i=t.userData)?void 0:i.id)}_assetFilter(t){var e;return t.visible&&t.selectable&&(null==(e=t.userData)?void 0:e.assetType)===Ae.config.assetType}getDummiesVo(t=!0){var e,i,n,s,r,a,o,h,l,u;const c=[];for(let a=0,o=this._dummies.length;a<o;a++){const o=this._dummies[a];if((null==(e=o.userData)?void 0:e.assetType)!==Bi)continue;if(t&&o.userData.status!==Jo.NEW)continue;const h={id:null==(i=o.userData)?void 0:i.id,label:null==(n=o.userData)?void 0:n.label,rmId:null==(s=o.userData)?void 0:s.rmId,wsId:null==(r=o.userData)?void 0:r.wsId};c.push(h)}for(let e=Object.keys(this._unboundDummiesMap),i=0,n=(null==e?void 0:e.length)||0;i<n;i++){const n=e[i];if(!n)continue;const s=this._unboundDummiesMap[n];if((null==(a=s.userData)?void 0:a.assetType)!==Bi)continue;if(t&&s.userData.status!==Jo.NEW)continue;const r={id:null==(o=s.userData)?void 0:o.id,label:null==(h=s.userData)?void 0:h.label,rmId:null==(l=s.userData)?void 0:l.rmId,wsId:null==(u=s.userData)?void 0:u.wsId},d=c.findIndex((t=>t.id===r.id));d>-1&&c.splice(d,1),c.push(r)}return c}getAssetById(t){let e;for(let i=0,n=this.scenes.length;i<n&&(e=this.scenes[i].getByIds(t),!e);i++);return e}getAssetBoundingBoxById(t,e=new ai){e.makeEmpty();const i=this.getAssetById(t);if(!(null==i?void 0:i.length))return e;for(let t=0,n=(null==i?void 0:i.length)||0;t<n;t++)e.union(i[t].boundingBoxWorld);return e}getDummyLabels(t){var e,i;const n=this.getDummyById(t);return n instanceof Bg?((null==(e=null==n?void 0:n.userData)?void 0:e.label)||"").split(","):[null==(i=null==n?void 0:n.userData)?void 0:i.label]}getDummiesBoundingBox(t,e){if(Ng.makeEmpty(),!(null==t?void 0:t.length))return Ng.clone();for(let e,i=0,n=(null==t?void 0:t.length)||0;i<n;i++){e=t[i];const n=this.getDummyById(e);n&&Ng.union(n.boundingBoxWorld)}return Ng.clone()}addDummy(t){var e,i;if(!this.dstScene||!(null==t?void 0:t.rmId))return;const n=t.rmId;let s=this._dummies.find((e=>{var i;return(null==(i=e.userData)?void 0:i.id)===t.id}));return s||(s=new Lg(t,Ae.config.dummy),s.name=t.id||n+"_"+(t.id||(null==(e=this.dstScene.children)?void 0:e.length)),s.userData.rmId=n,this.dstScene.add(s),this._dummies.push(s),this._rmMap.has(n)||this._rmMap.set(n,[]),null==(i=this._rmMap.get(n))||i.push(s)),s}addDummyMerged(t,e){var i,n;if(!this.dstScene||!(null==t?void 0:t.rmId))return;let s;return this._mergedMap.has(t.id)?s=this._mergedMap.get(t.id):(s=new Bg(t,Ae.config.dummy),s.name=t.id||e+"_"+(t.id||(null==(i=this.dstScene.children)?void 0:i.length)),null==(n=this.dstScene)||n.add(s),this._mergedMap.set(e,s)),s}addDummyUnbound(t){var e;if(!(null==t?void 0:t.id))return;const i=new Lg(t,Ae.config.dummy);return i.mtl.fill=i.userData.style.fill=Le.green,i.mtl.stroke=i.userData.style.stroke=Le.darkGreen,i.userData.status=Jo.NEW,null==(e=this.dstScene)||e.add(i),this._unboundDummiesMap[t.id]=i,i}traverseDummies(t){var e;for(let i=0,n=(null==(e=this._dummies)?void 0:e.length)||0;i<n;i++)t(this._dummies[i]);for(let[e,i]of this._mergedMap.entries())t(i);Object.values(this._unboundDummiesMap).forEach((e=>{t(e)}))}clearDummies(t){var e,i,n,s;for(let i,n=Object.keys(this._unboundDummiesMap),s=(null==n?void 0:n.length)||0;s>=0;s--)i=this._unboundDummiesMap[n[s]],(null==t?void 0:t.length)&&!t.includes(null==i?void 0:i.userData.status)||(null==(e=this.dstScene)||e.remove(i),null==i||i.destroy(),delete this._unboundDummiesMap[n[s]]);for(let e,s=((null==(i=this._dummies)?void 0:i.length)||0)-1;s>=0;s--)e=this._dummies[s],(null==t?void 0:t.length)&&!t.includes(e.userData.status)||(null==(n=this.dstScene)||n.remove(e),null==e||e.destroy(),this._dummies.splice(s,1));for(let[e,i]of this._mergedMap.entries())(null==t?void 0:t.length)&&!t.includes(i.userData.status)||(null==(s=this.dstScene)||s.remove(i),null==i||i.destroy(),this._mergedMap.delete(e));(null==t?void 0:t.length)||(this._dummies.length=0,this._centroidCache={},this._rmMap.clear(),this._mergedMap.clear(),this._unboundDummiesMap={})}setDummies(t){var e;if(this.clearDummies(),null==t?void 0:t.length){for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.addDummy(t[e]);null==(e=this.view.camera)||e.update()}}getDummyById(t){var e;if(t){for(let i=0,n=(null==(e=this._dummies)?void 0:e.length)||0;i<n;i++)if(this._dummies[i].name===t)return this._dummies[i];for(let[e,i]of this._mergedMap.entries())if(i.name===t)return i;return this._unboundDummiesMap[t]}}focusAtDummy(t,e=1e3){return d(this,null,(function*(){var i,n,s,r,a,o,h;const l=this.getDummyById(t),u=null==(i=null==l?void 0:l.userData)?void 0:i.rmId;if(u){if(this.getAssetBoundingBoxById(u,Ng),!Ng.isEmpty()&&(Ng.expandByScalar(e),null==(n=this.view)?void 0:n.camera))return void((null==(r=null==(s=this.view)?void 0:s.camera)?void 0:r.boundingBoxWorld.containsBox(Ng))||(yield this.view.resetCameraByBoundingBox(Ng,!0)));if((null==l?void 0:l.position)&&!(null==l?void 0:l.position.isEmpty()))return l.updateWorldMatrix(!0,!1),Og.copy(l.position).applyMatrix3(l.matrixWorld),Ng.setFromCenterAndSize(Og,Rg.set(2*e,2*e)),void((null==(o=null==(a=this.view)?void 0:a.camera)?void 0:o.boundingBoxWorld.containsBox(Ng))||(yield null==(h=this.view)?void 0:h.resetCameraByBoundingBox(Ng,!0)))}}))}highlightDummies(t){return d(this,null,(function*(){var e;Array.isArray(t)||(t=[t]),this.traverseDummies((e=>{var i;t.includes(e.userData.id)||e instanceof Bg&&(null==(i=ri.intersection(t,e.userData.id.split(",")))?void 0:i.length)?e.userData.actType|=Xo.HILIGHT:e.userData.actType&=~Xo.HILIGHT})),null==(e=this.action)||e.play()}))}resetHighlightDummies(){var t;this.traverseDummies((t=>{t.userData.actType&=~Xo.HILIGHT,t.mtl.fill=t.userData.style.fill,t.mtl.stroke=t.userData.style.stroke})),null==(t=this.action)||t.stop()}update(){var t,e;(null==(e=null==(t=this.dstScene)?void 0:t.children)?void 0:e.length)&&this.dstScene.traverse((t=>{var e;((null==(e=null==t?void 0:t.userData)?void 0:e.actType)||0)&Xo.HILIGHT&&t.isDummy&&(t.mtl.fill=this.dynamicDummyFill,t.mtl.stroke=this.dynamicDummyStroke)}))}handleCameraUpdate(t){var e,i;if(null==(e=this.view)?void 0:e.camera){for(let t,e=0,n=(null==(i=this._dummies)?void 0:i.length)||0;e<n;e++)t=this._dummies[e],this.updateDummy(t);this.mergeDummies()}}updateDummy(t){var e,i;const n=t.userData.rmId,s=this.getAssetById(n);if((null==s?void 0:s.length)&&!this._centroidCache[n]){const t=[];for(let n,r=0,a=s.length;r<a;r++)n=s[r],null==(i=null==(e=n.geo)?void 0:e.path)||i.getVertices(t);We.getPoleOfInaccessibility(t,Og),this._centroidCache[n]=Og.clone()}}mergeDummies(){var t,e,i;if(!(null==(t=this.view)?void 0:t.camera))return;kg.copy(this.view.camera.viewMatrix);const n=(null==(i=null==(e=Ae.config)?void 0:e.dummy)?void 0:i.radius)||10;this.view.camera.pixelWidth;for(let[t,e]of this._rmMap){if(!(null==e?void 0:e.length))continue;this.getAssetBoundingBoxById(t,Ng),Ng.applyMatrix3(kg).getSize(Og).round(),Rg.copy(this._centroidCache[t]).applyMatrix3(kg);const i=Ng.centralArrange(e.length,2*n,2*n,Rg);if(Array.isArray(i)){const n=this._mergedMap.get(t);n&&(n.visible=!1),e.forEach(((t,e)=>{t.visible=!0,t.boundingBox.getSize(Hg),t.setPosition(zg.copy(i[e]).unproject(this.view.camera)).updateMatrix()}))}else{e.forEach((t=>t.visible=!1));let i=this._mergedMap.get(t);if(!i){let n=ri.cloneDeep(e[0].userData)||{};const s=ri.reduce(e,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.label)&&t.push(null==(n=e.userData)?void 0:n.label),t}),[]),r=ri.reduce(e,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.id)&&t.push(null==(n=e.userData)?void 0:n.id),t}),[]);n=ri.merge(n,{rmId:t,id:r.join(","),label:s.join(",")}),i=this.addDummyMerged(n,t)}if(!i)continue;i.setText(String(e.length)),i.visible=!0,zg.copy(e[0].position),i.setPosition(zg).updateMatrix()}}}}const kg=new Ui,Ng=new ai,Og=new We,Rg=new We,zg=new We,Hg=new We;class Wg extends hp{constructor(t){const e=new op(t),i=new ap(t);(null==t?void 0:t.lineWidth)||(i.lineWidth=1),super(e,i),c(this,"name","Line"),c(this,"isLine",!0)}}class Fg{static getPoint(t){const e=new Tg(t),i=vp.getMtl(t);return new Cg(e,i)}static getRect(t){const e=new _p(t),i=vp.getMtl(t);return new Cg(e,i)}static getMark(t){const e=new $h({cmds:[[ln,0,0],[un,-5,-10],[cn,-5,-10,-12.5,-25,0,-25],[cn,0,-25,12.5,-25,5,-10],[un,0,0],[fn]],closed:!0,flipY:!0,lineWidth:1,thinLine:!0}),i=vp.getMtl(t);return new Cg(e,i)}}class Ug extends dg{constructor(t,e){super(t,e),c(this,"type",Go.LINKER),c(this,"_linesIds",[]),c(this,"_startIds",[]),c(this,"_endIds",[]),c(this,"_lineDash",20)}activate(){super.activate()}deactivate(){this.clear(),super.deactivate(),this._linesIds=[],this._startIds=[],this._endIds=[]}update(){var t,e;for(let i=0,n=(null==(t=this._linesIds)?void 0:t.length)||0;i<n;i++){const t=null==(e=this.dstScene)?void 0:e.getByIds(this._linesIds[i]);if(null==t?void 0:t.length)for(let e,i=0,n=t.length;i<n;i++){if(e=t[i],!(null==e?void 0:e.mtl))continue;let n=e.mtl.lineDashOffset||0;n<=-2*this._lineDash&&(n=0),e.mtl.lineDashOffset=n-1}}}clear(){var t;(null==(t=this._linesIds)?void 0:t.length)&&(this.clearDynamicObjectsByIds(this._linesIds),this.clearDynamicObjectsByIds(this._startIds),this.clearDynamicObjectsByIds(this._endIds),this._linesIds=[],this._startIds=[],this._endIds=[])}linkAssetsByTree(t){var e,i;if(this.clear(),!(null==(e=null==t?void 0:t.children)?void 0:e.length))return;Ii(t);const n=this.getLinesByTree(t,void 0,!0);if(null==n?void 0:n.length)for(let t,e=0,s=n.length;e<s;e++)t=n[e],null==(i=this.dstScene)||i.add(t),this._linesIds.push(t.userData.id)}getLinesByTree(t,e=[],i=!1){var n,s;if(!(null==t?void 0:t.value))return e;const r=this.getDynamicObjectsByIds(t.value);if(Vg.makeEmpty().expandByObjects(r).getCenter(jg),i){const e=Fg.getMark({fill:Le.red,stroke:Le.darkGreen,lineWidth:1});e.userData.id=`${t.value}-start`,e.setPosition(jg).updateMatrix(),null==(n=this.dstScene)||n.add(e),this._startIds.push(e.userData.id)}return null==(s=t.children)||s.forEach((i=>{var n,s;const r=this.getDynamicObjectsByIds(i.value);qg.makeEmpty().expandByObjects(r).getCenter(Yg);const a=new Wg({x1:jg.x,y1:jg.y,x2:Yg.x,y2:Yg.y,stroke:Le.darkRed,strokeWidth:10,lineCap:"round",lineJoin:"round",lineDash:[this._lineDash,this._lineDash],thinLine:!0});a.userData.id=`${t.value}-${i.value}`,a.userData.actType|=Xo.DYNAMIC_LINE,e.push(a);const o=Fg.getMark({fill:Le.green,stroke:Le.darkGreen,lineWidth:1});o.userData.id=`${t.value}-end`,o.setPosition(Yg).updateMatrix(),null==(n=this.dstScene)||n.add(o),this._endIds.push(o.userData.id),(null==(s=i.children)?void 0:s.length)&&this.getLinesByTree(i,e,!1)})),e}}const Vg=new ai,qg=new ai,jg=new We,Yg=new We;class Gg extends dg{constructor(t,e){super(t,e),c(this,"type",Go.DISTRIBUTION),c(this,"fillIdsMap",{}),c(this,"strokeIdsMap",{})}activate(){super.activate()}deactivate(){this.clearByIds(),super.deactivate(),this.fillIdsMap={},this.strokeIdsMap={}}update(){}setFillByIds(t,e){var i,n;if(t&&e){Array.isArray(t)||(t=[t]);for(let n,s=0,r=(null==t?void 0:t.length)||0;s<r;s++){n=t[s],this.clearById(n,!1);const r=null==(i=this.oriScene)?void 0:i.getByIds(n);if(null==r?void 0:r.length)for(let t,i=0,n=(null==r?void 0:r.length)||0;i<n;i++)t=r[i],(null==t?void 0:t.mtl)&&(t.mtl=vp.getMtl(u(l({},t.userData.style),{fill:e})),t.geo.lineWidth=t.userData.style.lineWidth||1,t.needsUpdate=!0)}this.fillIdsMap[e]=t,(null==(n=this.view)?void 0:n.camera)&&(this.view.camera.needsUpdate=!0)}}setStrokeByIds(t,e){var i,n;if(t&&e){Array.isArray(t)||(t=[t]);for(let n,s=0,r=(null==t?void 0:t.length)||0;s<r;s++){n=t[s],this.clearById(n,!1);const r=null==(i=this.oriScene)?void 0:i.getByIds(n);if(null==r?void 0:r.length)for(let t,i=0,n=(null==r?void 0:r.length)||0;i<n;i++)t=r[i],(null==t?void 0:t.mtl)&&(t.mtl=vp.getMtl(u(l({},t.userData.style),{stroke:e,lineWidth:5*(t.userData.style.lineWidth||1)})),t.geo.lineWidth=5*(t.userData.style.lineWidth||1),t.needsUpdate=!0)}this.strokeIdsMap[e]=t,(null==(n=this.view)?void 0:n.camera)&&(this.view.camera.needsUpdate=!0)}}clearById(t,e=!0){var i,n,s,r,a,o,h;if(!t)return;const l=null==(i=this.oriScene)?void 0:i.getByIds(t);for(let t,e=0,i=(null==l?void 0:l.length)||0;e<i;e++)t=l[e],(null==t?void 0:t.mtl)&&(t.mtl=vp.getMtl(t.userData.style),t.geo.lineWidth=null==(n=t.userData.style)?void 0:n.lineWidth,t.needsUpdate=!0);for(let e,i=Object.keys(this.fillIdsMap),n=((null==i?void 0:i.length)||0)-1;n>=0;n--){e=i[n];const a=null==(s=this.fillIdsMap[e])?void 0:s.findIndex((e=>e===t));a>-1&&this.fillIdsMap[e].splice(a,1),(null==(r=this.fillIdsMap[e])?void 0:r.length)||delete this.fillIdsMap[e]}for(let e,i=Object.keys(this.strokeIdsMap),n=((null==i?void 0:i.length)||0)-1;n>=0;n--){e=i[n];const s=null==(a=this.strokeIdsMap[e])?void 0:a.findIndex((e=>e===t));s>-1&&this.strokeIdsMap[e].splice(s,1),(null==(o=this.strokeIdsMap[e])?void 0:o.length)||delete this.strokeIdsMap[e]}e&&(null==(h=this.view)?void 0:h.camera)&&(this.view.camera.needsUpdate=!0)}clearFillByIds(t,e=!0){var i;t&&!Array.isArray(t)&&(t=[t]),t&&t.length||(t=ri.uniq(ri.compact(ri.flatten(ri.values(this.fillIdsMap)))));for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.clearById(t[e],!1);e&&(null==(i=this.view)?void 0:i.camera)&&(this.view.camera.needsUpdate=!0)}clearStrokeByIds(t,e=!0){var i;t&&!Array.isArray(t)&&(t=[t]),t&&t.length||(t=ri.uniq(ri.compact(ri.flatten(ri.values(this.strokeIdsMap)))));for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.clearById(t[e],!1);e&&(null==(i=this.view)?void 0:i.camera)&&(this.view.camera.needsUpdate=!0)}clearByIds(t,e=!0){var i;t&&!Array.isArray(t)&&(t=[t]),t&&t.length||(t=ri.uniq(ri.compact(ri.flatten(ri.concat(ri.values(this.fillIdsMap),ri.values(this.strokeIdsMap))))));for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.clearById(t[e],!1);e&&(null==(i=this.view)?void 0:i.camera)&&(this.view.camera.needsUpdate=!0)}getLegend(){const t=[];for(let e in this.fillIdsMap)t.push({type:"fill",color:e,ids:this.fillIdsMap[e]});for(let e in this.strokeIdsMap)t.push({type:"stroke",color:e,ids:this.strokeIdsMap[e]});return t}}class $g extends dg{constructor(t,e){super(t,e),c(this,"type",Go.TIPS),c(this,"engineVersion","v2.0.11"),c(this,"monitor"),this.monitor=new hp}activate(){super.activate()}deactivate(){super.deactivate()}handlePointerMove(t){var e,i,n;let s=(null==(e=null==t?void 0:t.e)?void 0:e.target)||(null==(n=null==(i=null==t?void 0:t.e)?void 0:i.srcEvent)?void 0:n.target);null==s||s.id}}class Xg{constructor(t,e){c(this,"tools",new Map),c(this,"activedTools",new Map),c(this,"activedTool"),c(this,"scenes",[]),c(this,"dstScene"),c(this,"mixer"),c(this,"clock",new Lf),this.editor=t,this.view=e,this.mixer=new Pm}destroy(){var t;this.dispose(),this.tools.clear(),null==(t=this.mixer)||t.destroy()}dispose(){var t;this.tools.forEach((t=>{t.deactivate&&t.deactivate()})),this.deactiveAll(),this.scenes=[],null==(t=this.mixer)||t.dispose()}register(t){Array.isArray(t)||(t=[t]),this.deactiveAll();for(let e,i=0,n=(null==t?void 0:t.length)||0;i<n;i++){e=t[i];let n=this.tools.get(e);if(!n){switch(e){case Go.TIPS:n=new $g(this,this.view);break;case Go.HOVER:n=new pg(this,this.view);break;case Go.SELECT:n=new gg(this,this.view);break;case Go.SELECTOR_RECT:n=new wg(this,this.view);break;case Go.DISTRIBUTION:n=new Gg(this,this.view);break;case Go.DRAG:n=new Ag(this,this.view);break;case Go.DUMMY:n=new Pg(this,this.view);break;case Go.LINKER:n=new Ug(this,this.view)}n&&this.tools.set(e,n)}n&&((null==n?void 0:n.bindScene)&&n.bindScene(...this.scenes))}return this}bindScene(...t){var e;return this.scenes.length=0,this.scenes.push(...t),this.dstScene=this.scenes.find((t=>t.isDynamic)),this.dstScene&&(null==(e=this.mixer)||e.bind(this.dstScene)),this.activedTools.forEach((t=>{t.bindScene&&t.bindScene(...this.scenes)})),this}setMode(t){this.deactiveAll();for(let e=1;e<=t;e<<=1)if(t&e){const t=e;this.tools.has(t)&&this.activateTool(t)}}clearMode(){this.deactiveAll()}activateTool(t){const e=this.tools.get(t);e&&(null==e||e.deactivate(),this.activedTools.set(e.type,e),e.bindScene&&e.bindScene(...this.scenes),e.activate())}get(t){return this.tools.get(t)}getActiveTool(t){return this.activedTools.get(t)}deactiveAll(t){const e=[];this.activedTools.forEach((i=>{(null==t?void 0:t.includes(i.type))||e.push(i.type)})),e.forEach((t=>{var e;null==(e=this.activedTools.get(t))||e.deactivate(),this.activedTools.delete(t)}))}handleTap(t){this.activedTools.forEach((e=>{e.handleTap&&e.handleTap(t)}))}handlePanStart(t){this.activedTools.forEach((e=>{e.handlePanStart&&e.handlePanStart(t)}))}handlePanMove(t){this.activedTools.forEach((e=>{e.handlePanMove&&e.handlePanMove(t)}))}handlePanEnd(t){this.activedTools.forEach((e=>{e.handlePanEnd&&e.handlePanEnd(t)}))}handlePointerOver(t){this.activedTools.forEach((e=>{e.handlePointerOver&&e.handlePointerOver(t)}))}handlePointerOut(t){this.activedTools.forEach((e=>{e.handlePointerOut&&e.handlePointerOut(t)}))}handlePointerMove(t){this.activedTools.forEach((e=>{e.handlePointerMove&&e.handlePointerMove(t)}))}handleDragStart(t){this.activedTools.forEach((e=>{e.handleDragStart&&e.handleDragStart(t)}))}handleDragEnd(t){this.activedTools.forEach((e=>{e.handleDragEnd&&e.handleDragEnd(t)}))}update(){var t;null==(t=this.mixer)||t.update(this.clock.getDelta()),this.activedTools.forEach((t=>{t.update&&t.update()}))}clearDummies(t){var e;null==(e=this.tools.get(Go.DUMMY))||e.clearDummies(t)}setDummies(t){var e;null==(e=this.tools.get(Go.DUMMY))||e.setDummies(t)}focusAtDummy(t,e=1e3){var i;null==(i=this.tools.get(Go.DUMMY))||i.focusAtDummy(t,e)}highlightDummies(t){var e;null==(e=this.tools.get(Go.DUMMY))||e.highlightDummies(t)}resetHighlightDummies(){var t;null==(t=this.tools.get(Go.DUMMY))||t.resetHighlightDummies()}getDummyLabels(t){var e;return null==(e=this.tools.get(Go.DUMMY))?void 0:e.getDummyLabels(t)}getDummiesBoundingBox(t,e){var i;return null==(i=this.tools.get(Go.DUMMY))?void 0:i.getDummiesBoundingBox(t)}}class Zg extends Fi{constructor(t,e){var i,n;super(),c(this,"scenes",[]),c(this,"dstScene"),c(this,"handler"),c(this,"view"),c(this,"mode",$o.DEFAULT),c(this,"toolManager"),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"panStartHandler",this.handlePanStart.bind(this)),c(this,"panMoveHandler",this.handlePanMove.bind(this)),c(this,"panEndHandler",this.handlePanEnd.bind(this)),c(this,"pointerOverHandler",this.handlePointerOver.bind(this)),c(this,"pointerOutHandler",this.handlePointerOut.bind(this)),c(this,"pointerMoveHandler",this.handlePointerMove.bind(this)),this.view=e,(null==(i=this.view)?void 0:i.camera)&&(this.handler=new Oh(t,this.view.camera).enableHover(null==(n=Ae.config.controls)?void 0:n.enableHover)),this.toolManager=new Xg(this,this.view).register([Go.TIPS,Go.HOVER,Go.SELECT,Go.SELECTOR_RECT,Go.DISTRIBUTION,Go.DRAG,Go.DUMMY,Go.LINKER]),this.toolManager.setMode(this.mode)}destroy(){var t;this.dispose(),this.unbindEvents(),null==(t=this.handler)||t.destroy()}dispose(){this.toolManager.dispose(),this.scenes=[]}bind(t,e){this.view=t,this.handler=e}bindScene(...t){var e;return this.scenes.length=0,this.scenes.push(...t),null==(e=this.handler)||e.bindScene(...t),this.dstScene=this.scenes.find((t=>t.isDynamic)),this.toolManager.bindScene(...t),this.bindEvents(),this}setMode(t){t&&(this.mode=t,this.toolManager.setMode(t),Ae.config.editorMode=$o.PICKER)}clearMode(){this.mode=$o.DEFAULT,this.toolManager.clearMode(),Ae.config.editorMode=$o.DEFAULT}bindEvents(){var t,e,i,n,s,r,a;this.unbindEvents(),null==(t=this.handler)||t.addEventListener(Fh.TAP,this.tapHandler),null==(e=this.handler)||e.addEventListener(Fh.PAN_START,this.panStartHandler),null==(i=this.handler)||i.addEventListener(Fh.PAN_MOVE,this.panMoveHandler),null==(n=this.handler)||n.addEventListener(Fh.PAN_END,this.panEndHandler),null==(s=this.handler)||s.addEventListener(Fh.POINTEROVER,this.pointerOverHandler),null==(r=this.handler)||r.addEventListener(Fh.POINTEROUT,this.pointerOutHandler),null==(a=this.handler)||a.addEventListener(Fh.POINTERMOVE,this.pointerMoveHandler)}unbindEvents(){var t,e,i,n,s,r,a;null==(t=this.handler)||t.removeEventListener(Fh.TAP,this.tapHandler),null==(e=this.handler)||e.removeEventListener(Fh.PAN_START,this.panStartHandler),null==(i=this.handler)||i.removeEventListener(Fh.PAN_MOVE,this.panMoveHandler),null==(n=this.handler)||n.removeEventListener(Fh.PAN_END,this.panEndHandler),null==(s=this.handler)||s.removeEventListener(Fh.POINTEROVER,this.pointerOverHandler),null==(r=this.handler)||r.removeEventListener(Fh.POINTEROUT,this.pointerOutHandler),null==(a=this.handler)||a.removeEventListener(Fh.POINTERMOVE,this.pointerMoveHandler)}handleTap(t){this.toolManager.handleTap(t)}handlePanStart(t){this.toolManager.handlePanStart(t)}handlePanMove(t){this.toolManager.handlePanMove(t)}handlePanEnd(t){this.toolManager.handlePanEnd(t)}handlePointerOver(t){this.toolManager.handlePointerOver(t)}handlePointerOut(t){this.toolManager.handlePointerOut(t)}handlePointerMove(t){this.toolManager.handlePointerMove(t)}update(){this.toolManager.update()}setEnablePan(t=!1){this.view&&this.view.setEnablePan&&this.view.setEnablePan(t)}selectEnableChanged(t=!1){t?this.setMode($o.PICKER):this.clearMode()}multiSelectEnableChanged(t=!1){t?this.setMode($o.PICKER):this.clearMode()}fnEnableChanged(t=!1){var e;null==(e=this.toolManager.get(Go.SELECTOR_RECT))||e.fnEnableChanged(t)}clearSelected(t){var e;this.mode&Go.SELECT||this.setMode($o.PICKER),null==(e=this.toolManager.get(Go.SELECT))||e.clearSelected(t)}selectByIds(t,e){var i;this.mode&Go.SELECT||this.setMode($o.PICKER),null==(i=this.toolManager.get(Go.SELECT))||i.selectByIds(t,e)}setDynamicFill(t){var e;null==(e=this.toolManager.get(Go.SELECT))||e.setDynamicFill(t)}clearDummies(t){this.mode&$o.DUMMY||this.setMode($o.DUMMY),this.toolManager.clearDummies(t)}setDummies(t){this.mode&$o.DUMMY||this.setMode($o.DUMMY),this.toolManager.setDummies(t)}focusAtDummy(t,e=1e3){this.mode&$o.DUMMY||this.setMode($o.DUMMY),this.toolManager.focusAtDummy(t,e)}highlightDummies(t){this.mode&$o.DUMMY||this.setMode($o.DUMMY),this.toolManager.highlightDummies(t)}resetHighlightDummies(){this.mode&$o.DUMMY||this.setMode($o.DUMMY),this.toolManager.resetHighlightDummies()}getAssetLabels(t,e){var i;if(this.mode===$o.DUMMY)return null==(i=this.toolManager.get(Go.DUMMY))?void 0:i.getDummyLabels(e)}getAssetBoundingBox(t,e){var i;if(this.mode===$o.DUMMY)return null==(i=this.toolManager.get(Go.DUMMY))?void 0:i.getDummiesBoundingBox(t,e)}bindEditorDrag(t){var e;if(this.mode===$o.DUMMY)return null==(e=this.toolManager.get(Go.DUMMY))?void 0:e.bindEditorDrag(t)}setEditorDraggingObject(t){var e,i;if(this.mode===$o.DUMMY){const n=null==(e=this.toolManager.get(Go.DUMMY))?void 0:e.getDraggingObject(t);null==(i=this.toolManager.get(Go.DRAG))||i.setDraggingObject(n)}}getDummies(t){var e;if(this.mode===$o.DUMMY)return null==(e=this.toolManager.get(Go.DUMMY))?void 0:e.getDummiesVo(t)}setFillByIds(t,e){var i;this.mode&Go.DISTRIBUTION||this.setMode($o.DISTRIBUTION),null==(i=this.toolManager.get(Go.DISTRIBUTION))||i.setFillByIds(t,e)}setStrokeByIds(t,e){var i;this.mode&Go.DISTRIBUTION||this.setMode($o.DISTRIBUTION),null==(i=this.toolManager.get(Go.DISTRIBUTION))||i.setStrokeByIds(t,e)}clearFillByIds(t){var e;this.mode&Go.DISTRIBUTION||this.setMode($o.DISTRIBUTION),null==(e=this.toolManager.get(Go.DISTRIBUTION))||e.clearFillByIds(t)}clearStrokeByIds(t){var e;this.mode&Go.DISTRIBUTION||this.setMode($o.DISTRIBUTION),null==(e=this.toolManager.get(Go.DISTRIBUTION))||e.clearStrokeByIds(t)}clearByIds(t){var e;this.mode&Go.DISTRIBUTION||this.setMode($o.DISTRIBUTION),null==(e=this.toolManager.get(Go.DISTRIBUTION))||e.clearByIds(t)}getLegend(){var t;return this.mode&Go.DISTRIBUTION||this.setMode($o.DISTRIBUTION),null==(t=this.toolManager.get(Go.DISTRIBUTION))?void 0:t.getLegend()}linkAssetsByTree(t){var e;this.mode!==$o.LINKER&&this.setMode($o.LINKER),null==(e=this.toolManager.get(Go.LINKER))||e.linkAssetsByTree(t)}}class Jg extends Fi{constructor(){super(),c(this,"name","App2@"+si.now()),c(this,"scenes",[]),c(this,"requestHeader",{}),c(this,"_tic"),c(this,"_url"),c(this,"_layers"),c(this,"_lastCameraVersion",-1/0),c(this,"_runningHandler",this.running.bind(this)),c(this,"_pointerOverHandler",(t=>this.dispatchEvent(t))),c(this,"_pointerOutHandler",(t=>this.dispatchEvent(t))),c(this,"_selectedHandler",(t=>this.dispatchEvent(t))),c(this,"_dragEndHandler",(t=>this.dispatchEvent(t))),this.adapter=new vf}destroy(){var t,e,i,n,s;this.unbindEvents(),super.destroy(),null==(t=this.composer)||t.destroy(),null==(e=this.mainScene)||e.destroy(),null==(i=this.animateScene)||i.destroy(),null==(n=this.view)||n.destroy(),null==(s=this.renderer)||s.destroy()}init(t={}){var e,i;return this.params=t,this.renderer||(this.renderer=new Cf(t)),this.view||(this.view=new Um(t)),this.composer||(this.composer=new kf(this.renderer,new Bf(t))),this.editor||(this.editor=new Zg(this.params.inpEl?this.params.inpEl:this.params.cvs,this.view)),null==(e=this.mainScene)||e.destroy(),this.mainScene=new ig(t,this.adapter),null==(i=this.animateScene)||i.destroy(),this.animateScene=new ag(t),this.trans2LoadingScene(),this.bindEvents(),this}bindEvents(){var t,e,i,n;this.unbindEvents(),null==(t=this.editor)||t.addEventListener(Mi.POINTER_OVER,this._pointerOverHandler),null==(e=this.editor)||e.addEventListener(Mi.POINTER_OUT,this._pointerOutHandler),null==(i=this.editor)||i.addEventListener(Mi.SELECTED,this._selectedHandler),null==(n=this.editor)||n.addEventListener(Mi.DRAG_END,this._dragEndHandler)}unbindEvents(){var t,e,i,n;null==(t=this.editor)||t.removeEventListener(Mi.POINTER_OVER,this._pointerOverHandler),null==(e=this.editor)||e.removeEventListener(Mi.POINTER_OUT,this._pointerOutHandler),null==(i=this.editor)||i.removeEventListener(Mi.SELECTED,this._selectedHandler),null==(n=this.editor)||n.removeEventListener(Mi.DRAG_END,this._dragEndHandler)}get isLoadingScene(){var t;return"LoadingScene"===(null==(t=this.scenes[0])?void 0:t.name)}setRequestHeader(t){return this.requestHeader=t,this}load(t,e,i=2){return d(this,null,(function*(){if(this._tic&&this._tic.clear(),this._url=t,this._layers=e,yield this.trans2LoadingScene(),!t)throw"url not found";const i=yield this.adapter.setRequestHeader(this.requestHeader).load(t,e);return this.adapter.bindScene(this.mainScene).initResources(i,e),yield this.trans2MainScene(),(i||{}).idsTree}))}hasScene(t){return this.scenes.findIndex((e=>e.uuid===t.uuid))>=0}pushScene(t){this.hasScene(t)||(this.view.bindScene(t),this.scenes.push(t))}clearScenes(){this.view.scenes.length=0,this.scenes.forEach((t=>this.removeScene(t))),this.scenes.length=0,this.loadingScene=void 0}removeScene(t){const e=this.scenes.findIndex((e=>e.uuid===t.uuid));e<0||(this.scenes[e].destroy(),this.scenes.splice(e,1))}removeLoadingScene(){this.loadingScene&&(this.removeScene(this.loadingScene),this.loadingScene=void 0)}trans2LoadingScene(){return d(this,null,(function*(){var t;this.clearScenes(),this.loadingScene||(this.loadingScene=new Rm(this.params)),this.pushScene(this.loadingScene),null==(t=this.editor)||t.dispose(),this.view.fullscreen(250);const e=new Rf(this.loadingScene,this.view.camera);this.composer.clearPasses(),this.composer.addPass(e),this.mainScene=new ig(this.params,this.adapter)}))}trans2MainScene(){return d(this,null,(function*(){var t,e;this.clearScenes(),this.mainScene||(this.mainScene=new ig(this.params,this.adapter)),this.animateScene||(this.animateScene=new ag(this.params)),null==(t=this.editor)||t.setMode($o.DEFAULT),null==(e=this.editor)||e.bindScene(this.mainScene,this.animateScene),this.mainScene.setViewBox(this.adapter.getViewBox()),this.pushScene(this.mainScene),this.view.scene=this.mainScene,this.view.fullscreen(10,!0);const i=new zf(this.mainScene,this.view.camera,!1,!1),n=new Rf(this.animateScene,this.view.camera,!1,!1),s=new Uf;this.composer.clearPasses(),this.params.bgPass&&this.composer.addPass(new $f(this.view.camera)),this.composer.addPass(i),this.composer.addPass(n),this.composer.addPass(s)}))}trans2EmptyScene(){var t;this.clearScenes(),this.emptyScene=new og(this.params),null==(t=this.editor)||t.dispose(),this.pushScene(this.emptyScene),this.view.scene=this.emptyScene,this.view.fullscreen(250,!0),this.editor&&this.editor.bindScene(this.emptyScene);const e=new Rf(this.emptyScene,this.view.camera);this.composer.clearPasses(),this.composer.addPass(e)}debounceCacheChanged(t=!1){this.params.debounceCache=t}wireframeChanged(t=!1){this.params.wireframe=t}sliceDurationChanged(t){this.params.sliceDuration=t}selectEnableChanged(t=!1){return d(this,null,(function*(){var e;yield this.clearSelected(),this.params.selectEnable=t,null==(e=this.editor)||e.selectEnableChanged(t)}))}multiSelectEnableChanged(t=!1){return d(this,null,(function*(){var e;yield this.clearSelected(),this.params.multiSelectEnable=t,null==(e=this.editor)||e.multiSelectEnableChanged(t)}))}assetTypeChanged(t){return d(this,null,(function*(){t&&(this.params.assetType=t,this.setAssetType(t))}))}fnEnableChanged(t){return d(this,null,(function*(){var e;this.params.fnEnable=!!t,null==(e=this.editor)||e.fnEnableChanged(t)}))}zoomToSelectEnableChanged(t){return d(this,null,(function*(){this.params.zoomToSelectEnable=!!t}))}socialDistanceEnableChanged(t){return d(this,null,(function*(){this.params.socialDistanceEnable=!!t}))}enableHoverChanged(t){return d(this,null,(function*(){var e,i;ri.set(this.params,"controls.enableHover",!!t),null==(i=null==(e=this.editor)?void 0:e.handler)||i.enableHover(this.params.controls.enableHover)}))}resize(){var t;let e;this.params.containerId&&(e=Ae.window.document.getElementById(this.params.containerId)),e||(e=Ae.window.document.getElementsByTagName("body")[0]);const i=null==(t=null==e?void 0:e.parentElement)?void 0:t.getBoundingClientRect();i&&this.setSize(i.width,i.height)}setSize(t,e){var i,n,s;null==(i=this.renderer)||i.setSize(t,e),null==(n=this.view)||n.resize(),null==(s=this.composer)||s.setSize(t,e)}refresh(){this.view.camera.needsUpdate=!0}fullscreen(){this.view.fullscreen(1,!0)}saveCameraPosition(t){this.view.saveCameraPosition(t)}restoreCameraPosition(t){this.view.restoreCameraPosition(t)}clearCameraPosition(t){this.view.clearCameraPosition(t)}zoomIn(){this.view.zoomIn()}zoomOut(){this.view.zoomOut()}fontZoomIn(t=1.1){var e;null==(e=this.mainScene)||e.increaseFontSize(t)}fontZoomOut(t=.9){var e;null==(e=this.mainScene)||e.increaseFontSize(t)}unproject(t){return d(this,null,(function*(){return Qg.copy(t).unproject(this.view.camera)}))}strokeMore(t=1.1){var e;null==(e=this.mainScene)||e.increaseStrokeWidth(t)}strokeLess(t=.9){var e;null==(e=this.mainScene)||e.increaseStrokeWidth(t)}updateLayersVisibility(t,e=!1){this.adapter.updateLayersVisibility(t,e)}getLayers(t=2){return d(this,null,(function*(){return this.adapter.getLayers(t)}))}focusAtIds(t,e=100){return d(this,null,(function*(){if(!this.mainScene)return;const i=this.adapter.getBoundingBoxByIds(t);return i&&!i.isEmpty()?(i.expandByVector(new We(1,1).multiplyScalar(e)),i.isEmpty()||(yield this.view.resetCameraByBoundingBox(i,!0)),i):void 0}))}clearSelected(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.clearSelected(t)}))}targetByIds(t){return d(this,null,(function*(){var e,i;this.clearSelected(),this.selectByIds(t);let n=null==(e=this.mainScene)?void 0:e.getAssetBoundingBox(t);n||(n=null==(i=this.editor)?void 0:i.getAssetBoundingBox(t)),n&&(n.isEmpty()||(n.getSize(Qg),n.expandByScalar(Math.round(.5*Math.max(Qg.x,Qg.y))),yield this.view.resetCameraByBoundingBox(n,!0)))}))}getAssetIdsByType(t){return d(this,null,(function*(){var e;return null==(e=this.adapter)?void 0:e.getAssetIdsByType(t)}))}setFillByIds(t,e){return d(this,null,(function*(){var i;null==(i=this.editor)||i.setFillByIds(t,e)}))}clearFillByIds(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.clearFillByIds(t)}))}setStrokeByIds(t,e){return d(this,null,(function*(){var i;null==(i=this.editor)||i.setStrokeByIds(t,e)}))}clearFill(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.clearFillByIds()}))}clearStroke(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.clearStrokeByIds()}))}getLegend(){return d(this,null,(function*(){var t;return null==(t=this.editor)?void 0:t.getLegend()}))}getAssetLabels(t,e){return d(this,null,(function*(){var i,n;return t===Bi?null==(i=this.editor)?void 0:i.getAssetLabels(t,e):null==(n=this.mainScene)?void 0:n.getAssetLabels(t,e)}))}setAssetLabels(t,e){return d(this,null,(function*(){var i;return null==(i=this.mainScene)?void 0:i.setAssetLabels(t,e)}))}clearAssetLabels(t){return d(this,null,(function*(){var e;return null==(e=this.mainScene)?void 0:e.clearAssetLabels(t)}))}selectByIds(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.selectByIds(t,!0)}))}getAssetBoundingBox(t,e){return d(this,null,(function*(){var i,n;let s=null==(i=this.mainScene)?void 0:i.getAssetBoundingBox(t);if(s||(s=null==(n=this.editor)?void 0:n.getAssetBoundingBox(t)),s)return e?s.applyMatrix3(this.view.camera.viewMatrix):s}))}setAssetType(t,e){var i;t&&(this.params.assetType=t,null==(i=this.mainScene)||i.setAssetType(t,e))}linkAssetsByTree(t){var e;null==(e=this.editor)||e.linkAssetsByTree(t)}clearDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.clearDummies(t)}))}setDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setDummies(t)}))}focusAtDummy(t,e=1e3){return d(this,null,(function*(){var i;return null==(i=this.editor)?void 0:i.focusAtDummy(t,e)}))}highlightDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.highlightDummies(t)}))}resetHighlightDummies(){return d(this,null,(function*(){var t;return null==(t=this.editor)?void 0:t.resetHighlightDummies()}))}setEditorMode(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setMode(t)}))}bindEditorDrag(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.bindEditorDrag(t)}))}setEditorDraggingObject(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setEditorDraggingObject(t)}))}getDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.getDummies(t)}))}start(){requestAnimationFrame(this._runningHandler)}running(t){var e,i,n,s,r,a;null==(e=this.view)||e.update(t),null==(i=this.editor)||i.update(),(null==(n=this.scenes)?void 0:n.length)&&this.scenes.forEach((t=>"function"==typeof(null==t?void 0:t.update)?t.update():void 0)),null==(s=this.composer)||s.render(),this._lastCameraVersion=null==(a=null==(r=this.view)?void 0:r.camera)?void 0:a.version,requestAnimationFrame(this._runningHandler)}}const Qg=new We;class Kg extends Eh{constructor(t,e,i){super(t,e,i),c(this,"hammer"),c(this,"sendEventHandler",this.sendEvent.bind(this)),this.hammer=new Hammer.Manager(t,{domEvents:!0});const n=new Hammer.Pan({threshold:0,pointers:0}),s=new Hammer.Pinch({threshold:0}),r=new Hammer.Tap({event:"singletap",taps:1}),a=new Hammer.Press({});this.hammer.add([n,r,a,s]),s.recognizeWith(n),this.hammer.on(["panstart","panmove","panend"].join(" "),(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center,isFirst:t.isFirst,pointers:JSON.parse(JSON.stringify(t.pointers))};e(i)}(t,this.sendEventHandler))),this.hammer.on(["pinchstart","pinchmove","pinchend"].join(" "),(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center,isFirst:t.isFirst,pointers:JSON.parse(JSON.stringify(t.pointers)),isFinal:t.isFinal,scale:t.scale};e(i)}(t,this.sendEventHandler))),this.hammer.on("singletap",(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center};e(i)}(t,this.sendEventHandler))),this.hammer.on("press",(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center};e(i)}(t,this.sendEventHandler))),this.hammer.on("hammer.input",(t=>function(t,e){t.preventDefault(),e({type:t.type,isFirst:t.isFirst,isFinal:t.isFinal})}(t,this.sendEventHandler)))}destroy(){var t;null==(t=this.hammer)||t.stop(!0),this.hammer.destroy()}sendEvent(t){this.worker&&this.worker.postMessage({type:"event",id:this.id,data:t}),Th.instance().handleEvent({id:this.id,data:t})}}function ty(t){const e=document.getElementById(t.canvasId);if(!e)throw new Error(`Canvas element with id ${t.canvasId} not found`);const i=new Kg(e,Nh),n=Th.instance().getProxy(i.id);return n.ownerDocument=n,t.inpEl=n,t}class ey extends Jg{constructor(t={},e){var i;super(),c(this,"name","App2Offscreen@"+si.now()),c(this,"cvs"),c(this,"worker"),c(this,"container"),c(this,"offset",new We),c(this,"label"),c(this,"proxy"),c(this,"resizeHandler",ri.debounce(this.resize.bind(this),100)),c(this,"messageHandler",this.handleMessage.bind(this)),c(this,"focusHandler",(t=>this.cvs.focus())),this.params=t,this.params.dpr=1,this.worker=e,this.container=document.getElementById(null==(i=this.params)?void 0:i.containerId),this.container||(this.container=Ae.window.document.getElementsByTagName("body")[0]);let n=this.container.getBoundingClientRect();this.offset.set(n.left,n.top),this.label=new xo(this.container,""),this.params.cvs?(this.cvs=this.params.cvs,delete this.params.cvs):this.cvs=Pn.createCanvas(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}bindEvents(){this.unbindEvents(),window.addEventListener("resize",this.resizeHandler),this.cvs.tabIndex=0,this.cvs.focus(),this.cvs.addEventListener("click",this.focusHandler)}unbindEvents(){window.removeEventListener("resize",this.resizeHandler),this.cvs.removeEventListener("click",this.focusHandler)}resize(){return d(this,null,(function*(){var t;let e;this.params.containerId&&(e=window.document.getElementById(this.params.containerId)),e||(e=window.document.getElementsByTagName("body")[0]);const i=null==(t=null==e?void 0:e.parentElement)?void 0:t.getBoundingClientRect();if(i&&this.cvs)return Pn.resizeCanvas(this.cvs,i.width,i.height,this.params.dpr),this.postAsync({type:Mi.SET_SIZE,w:i.width,h:i.height})}))}start(){"function"==typeof this.cvs.transferControlToOffscreen?(this.workerStart(this.cvs),this.worker.addEventListener("message",this.messageHandler)):this.init(this.params).start()}handleMessage(t){switch(t.data.type){case Mi.POINTER_OVER:case Mi.POINTER_OUT:case Mi.SELECTED:case Mi.DRAG_END:this.dispatchEvent(t.data);break;case Mi.SET_CURSOR:this.cvs.style.cursor=t.data.cursorStyle}}workerStart(t){this.cvs.focus();const e=this.cvs.transferControlToOffscreen();this.proxy=new Kg(this.cvs,Nh,this.worker);const i=ri.cloneDeep(this.params);delete i.cvs,this.worker.postMessage({type:"start",canvas:e,proxyId:this.proxy.id,conf:i},[e])}postAsync(t){return new Promise(((e,i)=>{const n=i=>{var r;(null==(r=null==i?void 0:i.data)?void 0:r.type)===(null==t?void 0:t.type)&&(this.worker.removeEventListener("message",n),this.worker.removeEventListener("error",s),e(i.data.data))},s=t=>{this.worker.removeEventListener("message",n),this.worker.removeEventListener("error",s),i(t.error)};this.worker.addEventListener("message",n),this.worker.addEventListener("error",s),this.worker.postMessage(t)}))}debounceCacheChanged(t=!1){this.worker.postMessage({type:Mi.DEBOUNCE_CACHE_CHANGED,v:t})}wireframeChanged(t=!1){this.worker.postMessage({type:Mi.WIREFRAME_CHANGED,v:t})}sliceDurationChanged(t=0){this.worker.postMessage({type:Mi.SLICE_DURATION_CHANGED,v:t})}selectEnableChanged(t=!1){return d(this,null,(function*(){this.worker.postMessage({type:Mi.SELECT_ENABLE_CHANGED,v:t})}))}multiSelectEnableChanged(t=!1){return d(this,null,(function*(){this.worker.postMessage({type:Mi.MULTI_SELECT_ENABLE_CHANGED,v:t})}))}assetTypeChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:Mi.ASSET_TYPE_CHANGED,v:t})}))}fnEnableChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:Mi.FN_ENABLE_CHANGED,v:t})}))}zoomToSelectEnableChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:Mi.ZOOM_TO_SELECT_ENABLE_CHANGED,v:t})}))}socialDistanceEnableChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:Mi.SOCIAL_DISTANCE_ENABLE_CHANGED,v:t})}))}enableHoverChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:Mi.ENABLE_HOVER_CHANGED,v:t})}))}refresh(){this.postAsync({type:Mi.REFRESH})}fullscreen(){return d(this,null,(function*(){yield this.postAsync({type:Mi.FULLSCREEN})}))}saveCameraPosition(t){return d(this,null,(function*(){const e=yield this.postAsync({type:Mi.GET_CAMERA_POSITION}),i=t?Vm+t:Vm;sessionStorage.setItem(i,JSON.stringify(e))}))}restoreCameraPosition(t){return d(this,null,(function*(){const e=t?Vm+t:Vm,i=sessionStorage.getItem(e);if(!i)return this.fullscreen();const n=JSON.parse(i||"{}");yield this.postAsync({type:Mi.SET_CAMERA_POSITION,data:n})}))}clearCameraPosition(t){return d(this,null,(function*(){const e=t?Vm+t:Vm;sessionStorage.setItem(e,"")}))}zoomIn(){return d(this,null,(function*(){this.postAsync({type:Mi.ZOOM_IN})}))}zoomOut(){return d(this,null,(function*(){this.postAsync({type:Mi.ZOOM_OUT})}))}fontZoomIn(t=1.1){return d(this,null,(function*(){this.postAsync({type:Mi.FONT_ZOOM_IN,v:t})}))}fontZoomOut(t=.9){return d(this,null,(function*(){this.postAsync({type:Mi.FONT_ZOOM_OUT,v:t})}))}unproject(t){return d(this,null,(function*(){return this.postAsync({type:Mi.UNPROJECT,v:t})}))}load(t,e,i=2){return d(this,null,(function*(){return this.postAsync({type:Mi.LOAD,url:t,layers:e,lv:i})}))}strokeMore(t=1.1){return d(this,null,(function*(){this.postAsync({type:Mi.STROKE_MORE,v:t})}))}strokeLess(t=.9){return d(this,null,(function*(){this.postAsync({type:Mi.STROKE_LESS,v:t})}))}updateLayersVisibility(t,e=!1){return d(this,null,(function*(){this.postAsync({type:Mi.UPDATE_LAYERS_VISIBILITY,ids:t,visible:e})}))}getLayers(t=2){return d(this,null,(function*(){return this.postAsync({type:Mi.GET_LAYERS,lv:t})}))}focusAtIds(t,e=100){return d(this,null,(function*(){return this.postAsync({type:Mi.FOCUS_AT_IDS,ids:t,padding:e})}))}clearSelected(t){return d(this,null,(function*(){return this.postAsync({type:Mi.CLEAR_SELECTED,ids:t})}))}targetByIds(t){return d(this,null,(function*(){return this.postAsync({type:Mi.TARGET_BY_IDS,ids:t})}))}getAssetIdsByType(t){return d(this,null,(function*(){return this.postAsync({type:Mi.GET_ASSET_IDS_BY_TYPE,assetType:t})}))}setFillByIds(t,e){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_FILL_BY_IDS,ids:t,c:e})}))}clearFillByIds(t){return d(this,null,(function*(){return this.postAsync({type:Mi.CLEAR_FILL_BY_IDS,ids:t})}))}setStrokeByIds(t,e){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_STROKE_BY_IDS,ids:t,c:e})}))}clearFill(){return d(this,null,(function*(){return this.postAsync({type:Mi.CLEAR_FILL})}))}clearStroke(){return d(this,null,(function*(){return this.postAsync({type:Mi.CLEAR_STROKE})}))}getLegend(){return d(this,null,(function*(){return this.postAsync({type:Mi.GET_LEGEND})}))}getAssetLabelById(t,e){return d(this,null,(function*(){return this.postAsync({type:Mi.GET_ASSET_LABELS,assetType:t,id:e})}))}setAssetLabels(t,e){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_ASSET_LABELS,id:t,labels:e})}))}clearAssetLabels(t){return d(this,null,(function*(){return this.postAsync({type:Mi.CLEAR_ASSET_LABELS,assetType:t})}))}selectByIds(t){return d(this,null,(function*(){return this.postAsync({type:Mi.SELECT_BY_IDS,ids:t})}))}getAssetBoundingBox(t,e=!1){return d(this,null,(function*(){return this.postAsync({type:Mi.GET_ASSET_BOUNDING_BOX,id:t,isViewCoords:e})}))}showAssetsLabel(t,e,i){return d(this,null,(function*(){var n,s;if(!e)return;const r=yield this.getAssetLabelById(t,e);if(r&&(i=r.join("<br/>")+(i?"<br/>"+i:"")),!i)return;null==(n=this.label)||n.setHtml(i);const a=yield this.getAssetBoundingBox(e,!0);a&&(iy.copy(a.min).add(this.offset).round(),null==(s=this.label)||s.show(iy))}))}hideAssetsLabel(){return d(this,null,(function*(){var t;return null==(t=this.label)?void 0:t.hide()}))}setAssetType(t,e){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_ASSET_TYPE,assetType:t,showLayers:e})}))}linkAssetsByTree(t){return d(this,null,(function*(){return this.postAsync({type:Mi.LINK_ASSETS_BY_TREE,o:t})}))}clearDummies(t){return d(this,null,(function*(){return this.postAsync({type:Mi.CLEAR_DUMMIES,aeTypes:t})}))}setDummies(t){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_DUMMIES,dummies:t})}))}focusAtDummy(t,e=1e3){return d(this,null,(function*(){return this.postAsync({type:Mi.FOCUS_AT_DUMMY,id:t,padding:e})}))}highlightDummies(t){return d(this,null,(function*(){return this.postAsync({type:Mi.HIGHLIGHT_DUMMIES,ids:t})}))}resetHighlightDummies(){return d(this,null,(function*(){return this.postAsync({type:Mi.RESET_HIGHLIGHT_DUMMIES})}))}setEditorMode(t){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_EDITOR_MODE,mode:t})}))}bindEditorDrag(t){return d(this,null,(function*(){return this.postAsync({type:Mi.BIND_EDITOR_DRAG,vo:t})}))}setEditorDraggingObject(t){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_EDITOR_DRAGGING_OBJECT,vo:t})}))}handleExternalEvent(t){return d(this,null,(function*(){var e;this.postAsync({type:"event",id:null==(e=this.proxy)?void 0:e.id,data:t})}))}drag(t,e){return d(this,null,(function*(){const i=this,n=function(t){i.bindEditorDrag(e),i.setEditorDraggingObject(e);const n={type:t.type,center:t.center,isFirst:t.isFirst,pointers:JSON.parse(JSON.stringify(t.pointers))};i.handleExternalEvent(n)};if(!ny.has(t)){const e=new Hammer.Manager(t,{domEvents:!0});e.add(new Hammer.Pan({threshold:0,pointers:0})),e.on(["panstart","panmove","panend"].join(" "),n),ny.set(t,e)}}))}drop(t){return d(this,null,(function*(){var e;ny.has(t)&&(null==(e=ny.get(t))||e.destroy(),ny.delete(t))}))}getDummies(t){return d(this,null,(function*(){return this.postAsync({type:Mi.GET_DUMMIES,hasBound:t})}))}}const iy=new We,ny=new Map;function sy(t){return new Worker("/environment.worker.js",{type:"module",name:null==t?void 0:t.name})}function ry(t){return new Worker("/renderer2.worker.js",{type:"module",name:null==t?void 0:t.name})}export{Mi as APP_ENUM,Bi as ASSET_TYPE_DUMMY,Jg as App2,ey as App2Offscreen,Xl as AppEnum,Li as AssetTypeEnum,ai as Box2,Re as Color,Le as ColorsEnum,$o as EDITOR_MODE,sy as EnvironmentWorker,Ae as GLOB,xo as Label,Pi as LayerTypeEnum,yi as Monitor,ry as Renderer2Worker,Gl as SvgApp,Go as TOOL_TYPE,We as Vector2,Wi as assetTypeConflicts,b as defaultConfig,Hi as getAssetLabelByType,zi as getAssetLayerByType,Ii as getIdsByTree,Ci as getRandomString,ty as polyfillHammerProxy,Ti as randomDelay};
|
|
19
|
+
*/const Xl=1001,Zl="srgb",Jl="srgb-linear",Ql="linear",Kl="srgb",tu=2e3;class eu{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){const i=this._listeners;return void 0!==i&&(void 0!==i[t]&&-1!==i[t].indexOf(e))}removeEventListener(t,e){const i=this._listeners;if(void 0===i)return;const n=i[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const i=e[t.type];if(void 0!==i){t.target=this;const e=i.slice(0);for(let i=0,n=e.length;i<n;i++)e[i].call(this,t);t.target=null}}}const iu=["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"];function nu(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(iu[255&t]+iu[t>>8&255]+iu[t>>16&255]+iu[t>>24&255]+"-"+iu[255&e]+iu[e>>8&255]+"-"+iu[e>>16&15|64]+iu[e>>24&255]+"-"+iu[63&i|128]+iu[i>>8&255]+"-"+iu[i>>16&255]+iu[i>>24&255]+iu[255&n]+iu[n>>8&255]+iu[n>>16&255]+iu[n>>24&255]).toLowerCase()}function su(t,e,i){return Math.max(e,Math.min(i,t))}function ru(t,e,i){return(1-i)*t+i*e}function au(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function ou(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}class hu{constructor(t=0,e=0){hu.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=su(this.x,t.x,e.x),this.y=su(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=su(this.x,t,e),this.y=su(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(su(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(su(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*i-r*n+t.x,this.y=s*n+r*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class lu{constructor(t,e,i,n,s,r,a,o,h){lu.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,n,s,r,a,o,h)}set(t,e,i,n,s,r,a,o,h){const l=this.elements;return l[0]=t,l[1]=n,l[2]=a,l[3]=e,l[4]=s,l[5]=o,l[6]=i,l[7]=r,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[3],o=i[6],h=i[1],l=i[4],u=i[7],c=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],y=n[1],v=n[4],x=n[7],b=n[2],w=n[5],_=n[8];return s[0]=r*f+a*y+o*b,s[3]=r*m+a*v+o*w,s[6]=r*g+a*x+o*_,s[1]=h*f+l*y+u*b,s[4]=h*m+l*v+u*w,s[7]=h*g+l*x+u*_,s[2]=c*f+d*y+p*b,s[5]=c*m+d*v+p*w,s[8]=c*g+d*x+p*_,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8];return e*r*l-e*a*h-i*s*l+i*a*o+n*s*h-n*r*o}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=l*r-a*h,c=a*o-l*s,d=h*s-r*o,p=e*u+i*c+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(n*h-l*i)*f,t[2]=(a*i-n*r)*f,t[3]=c*f,t[4]=(l*e-n*o)*f,t[5]=(n*s-a*e)*f,t[6]=d*f,t[7]=(i*o-h*e)*f,t[8]=(r*e-i*s)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,s,r,a){const o=Math.cos(s),h=Math.sin(s);return this.set(i*o,i*h,-i*(o*r+h*a)+r+t,-n*h,n*o,-n*(-h*r+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(uu.makeScale(t,e)),this}rotate(t){return this.premultiply(uu.makeRotation(-t)),this}translate(t,e){return this.premultiply(uu.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const uu=new lu;function cu(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}const du=(new lu).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),pu=(new lu).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function fu(){const t={enabled:!0,workingColorSpace:Jl,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i?(this.spaces[e].transfer===Kl&&(t.r=gu(t.r),t.g=gu(t.g),t.b=gu(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===Kl&&(t.r=yu(t.r),t.g=yu(t.g),t.b=yu(t.b)),t):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?Ql:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],n=[.3127,.329];return t.define({[Jl]:{primaries:e,whitePoint:n,transfer:Ql,toXYZ:du,fromXYZ:pu,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:Zl},outputColorSpaceConfig:{drawingBufferColorSpace:Zl}},[Zl]:{primaries:e,whitePoint:n,transfer:Kl,toXYZ:du,fromXYZ:pu,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:Zl}}}),t}const mu=fu();function gu(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function yu(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let vu;class xu{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{void 0===vu&&(vu=cu("canvas")),vu.width=t.width,vu.height=t.height;const e=vu.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),i=vu}return i.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=cu("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const n=i.getImageData(0,0,t.width,t.height),s=n.data;for(let t=0;t<s.length;t++)s[t]=255*gu(s[t]/255);return i.putImageData(n,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*gu(e[t]/255)):e[t]=gu(e[t]);return{data:e,width:t.width,height:t.height}}return t}}let bu=0;class wu{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:bu++}),this.uuid=nu(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let t;if(Array.isArray(n)){t=[];for(let e=0,i=n.length;e<i;e++)n[e].isDataTexture?t.push(_u(n[e].image)):t.push(_u(n[e]))}else t=_u(n);i.url=t}return e||(t.images[this.uuid]=i),i}}function _u(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?xu.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:{}}let Su=0,Eu=class t extends eu{constructor(e=t.DEFAULT_IMAGE,i=t.DEFAULT_MAPPING,n=1001,s=1001,r=1006,a=1008,o=1023,h=1009,l=t.DEFAULT_ANISOTROPY,u=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Su++}),this.uuid=nu(),this.name="",this.source=new wu(e),this.mipmaps=[],this.mapping=i,this.channel=0,this.wrapS=n,this.wrapT=s,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=h,this.offset=new hu(0,0),this.repeat=new hu(1,1),this.center=new hu(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new lu,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isTextureArray=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isTextureArray=t.isTextureArray,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,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&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case Xl:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case Xl:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}};Eu.DEFAULT_IMAGE=null,Eu.DEFAULT_MAPPING=300,Eu.DEFAULT_ANISOTROPY=1;class Mu{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,s,r,a){let o=i[n+0],h=i[n+1],l=i[n+2],u=i[n+3];const c=s[r+0],d=s[r+1],p=s[r+2],f=s[r+3];if(0===a)return t[e+0]=o,t[e+1]=h,t[e+2]=l,void(t[e+3]=u);if(1===a)return t[e+0]=c,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(u!==f||o!==c||h!==d||l!==p){let t=1-a;const e=o*c+h*d+l*p+u*f,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const s=Math.sqrt(n),r=Math.atan2(s,e*i);t=Math.sin(t*r)/s,a=Math.sin(a*r)/s}const s=a*i;if(o=o*t+c*s,h=h*t+d*s,l=l*t+p*s,u=u*t+f*s,t===1-a){const t=1/Math.sqrt(o*o+h*h+l*l+u*u);o*=t,h*=t,l*=t,u*=t}}t[e]=o,t[e+1]=h,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,n,s,r){const a=i[n],o=i[n+1],h=i[n+2],l=i[n+3],u=s[r],c=s[r+1],d=s[r+2],p=s[r+3];return t[e]=a*p+l*u+o*d-h*c,t[e+1]=o*p+l*c+h*u-a*d,t[e+2]=h*p+l*d+a*c-o*u,t[e+3]=l*p-a*u-o*c-h*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,n=t._y,s=t._z,r=t._order,a=Math.cos,o=Math.sin,h=a(i/2),l=a(n/2),u=a(s/2),c=o(i/2),d=o(n/2),p=o(s/2);switch(r){case"XYZ":this._x=c*l*u+h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u-c*d*p;break;case"YXZ":this._x=c*l*u+h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u+c*d*p;break;case"ZXY":this._x=c*l*u-h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u-c*d*p;break;case"ZYX":this._x=c*l*u-h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u+c*d*p;break;case"YZX":this._x=c*l*u+h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u-c*d*p;break;case"XZY":this._x=c*l*u-h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u+c*d*p}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],s=e[8],r=e[1],a=e[5],o=e[9],h=e[2],l=e[6],u=e[10],c=i+a+u;if(c>0){const t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(l-o)*t,this._y=(s-h)*t,this._z=(r-n)*t}else if(i>a&&i>u){const t=2*Math.sqrt(1+i-a-u);this._w=(l-o)/t,this._x=.25*t,this._y=(n+r)/t,this._z=(s+h)/t}else if(a>u){const t=2*Math.sqrt(1+a-i-u);this._w=(s-h)/t,this._x=(n+r)/t,this._y=.25*t,this._z=(o+l)/t}else{const t=2*Math.sqrt(1+u-i-a);this._w=(r-n)/t,this._x=(s+h)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(su(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,s=t._z,r=t._w,a=e._x,o=e._y,h=e._z,l=e._w;return this._x=i*l+r*a+n*h-s*o,this._y=n*l+r*o+s*a-i*h,this._z=s*l+r*h+i*o-n*a,this._w=r*l-i*a-n*o-s*h,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,s=this._z,r=this._w;let a=r*t._w+i*t._x+n*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=r,this._x=i,this._y=n,this._z=s,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*r+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*s+e*this._z,this.normalize(),this}const h=Math.sqrt(o),l=Math.atan2(h,a),u=Math.sin((1-e)*l)/h,c=Math.sin(e*l)/h;return this._w=r*u+this._w*c,this._x=i*u+this._x*c,this._y=n*u+this._y*c,this._z=s*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(n*Math.sin(t),n*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}let Au=class t{constructor(e=0,i=0,n=0){t.prototype.isVector3=!0,this.x=e,this.y=i,this.z=n}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Cu.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Cu.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*n,this.y=s[1]*e+s[4]*i+s[7]*n,this.z=s[2]*e+s[5]*i+s[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,s=t.elements,r=1/(s[3]*e+s[7]*i+s[11]*n+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*n+s[12])*r,this.y=(s[1]*e+s[5]*i+s[9]*n+s[13])*r,this.z=(s[2]*e+s[6]*i+s[10]*n+s[14])*r,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,a=t.z,o=t.w,h=2*(r*n-a*i),l=2*(a*e-s*n),u=2*(s*i-r*e);return this.x=e+o*h+r*u-a*l,this.y=i+o*l+a*h-s*u,this.z=n+o*u+s*l-r*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n,this.y=s[1]*e+s[5]*i+s[9]*n,this.z=s[2]*e+s[6]*i+s[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=su(this.x,t.x,e.x),this.y=su(this.y,t.y,e.y),this.z=su(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=su(this.x,t,e),this.y=su(this.y,t,e),this.z=su(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(su(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,s=t.z,r=e.x,a=e.y,o=e.z;return this.x=n*o-s*a,this.y=s*r-i*o,this.z=i*a-n*r,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Tu.copy(this).projectOnVector(t),this.sub(Tu)}reflect(t){return this.sub(Tu.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(su(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};const Tu=new Au,Cu=new Mu;class Iu{constructor(t=new Au(1/0,1/0,1/0),e=new Au(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Lu.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Lu.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Lu.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const n=i.getAttribute("position");if(!0===e&&void 0!==n&&!0!==t.isInstancedMesh)for(let e=0,i=n.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,Lu):Lu.fromBufferAttribute(n,e),Lu.applyMatrix4(t.matrixWorld),this.expandByPoint(Lu);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),Bu.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),Bu.copy(i.boundingBox)),Bu.applyMatrix4(t.matrixWorld),this.union(Bu)}const n=t.children;for(let t=0,i=n.length;t<i;t++)this.expandByObject(n[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Lu),Lu.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Hu),Wu.subVectors(this.max,Hu),Pu.subVectors(t.a,Hu),ku.subVectors(t.b,Hu),Nu.subVectors(t.c,Hu),Ou.subVectors(ku,Pu),Ru.subVectors(Nu,ku),zu.subVectors(Pu,Nu);let e=[0,-Ou.z,Ou.y,0,-Ru.z,Ru.y,0,-zu.z,zu.y,Ou.z,0,-Ou.x,Ru.z,0,-Ru.x,zu.z,0,-zu.x,-Ou.y,Ou.x,0,-Ru.y,Ru.x,0,-zu.y,zu.x,0];return!!Vu(e,Pu,ku,Nu,Wu)&&(e=[1,0,0,0,1,0,0,0,1],!!Vu(e,Pu,ku,Nu,Wu)&&(Fu.crossVectors(Ou,Ru),e=[Fu.x,Fu.y,Fu.z],Vu(e,Pu,ku,Nu,Wu)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Lu).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Lu).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Du[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Du[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Du[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Du[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Du[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Du[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Du[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Du[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Du)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Du=[new Au,new Au,new Au,new Au,new Au,new Au,new Au,new Au],Lu=new Au,Bu=new Iu,Pu=new Au,ku=new Au,Nu=new Au,Ou=new Au,Ru=new Au,zu=new Au,Hu=new Au,Wu=new Au,Fu=new Au,Uu=new Au;function Vu(t,e,i,n,s){for(let r=0,a=t.length-3;r<=a;r+=3){Uu.fromArray(t,r);const a=s.x*Math.abs(Uu.x)+s.y*Math.abs(Uu.y)+s.z*Math.abs(Uu.z),o=e.dot(Uu),h=i.dot(Uu),l=n.dot(Uu);if(Math.max(-Math.max(o,h,l),Math.min(o,h,l))>a)return!1}return!0}const qu=new Iu,ju=new Au,Yu=new Au;class Gu{constructor(t=new Au,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):qu.setFromPoints(t).getCenter(i);let n=0;for(let e=0,s=t.length;e<s;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;ju.subVectors(t,this.center);const e=ju.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(ju,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Yu.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(ju.copy(t.center).add(Yu)),this.expandByPoint(ju.copy(t.center).sub(Yu))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}let $u=class t{constructor(e,i,n,s,r,a,o,h,l,u,c,d,p,f,m,g){t.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,i,n,s,r,a,o,h,l,u,c,d,p,f,m,g)}set(t,e,i,n,s,r,a,o,h,l,u,c,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=s,g[5]=r,g[9]=a,g[13]=o,g[2]=h,g[6]=l,g[10]=u,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,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 t).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/Xu.setFromMatrixColumn(t,0).length(),s=1/Xu.setFromMatrixColumn(t,1).length(),r=1/Xu.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*s,e[5]=i[5]*s,e[6]=i[6]*s,e[7]=0,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,n=t.y,s=t.z,r=Math.cos(i),a=Math.sin(i),o=Math.cos(n),h=Math.sin(n),l=Math.cos(s),u=Math.sin(s);if("XYZ"===t.order){const t=r*l,i=r*u,n=a*l,s=a*u;e[0]=o*l,e[4]=-o*u,e[8]=h,e[1]=i+n*h,e[5]=t-s*h,e[9]=-a*o,e[2]=s-t*h,e[6]=n+i*h,e[10]=r*o}else if("YXZ"===t.order){const t=o*l,i=o*u,n=h*l,s=h*u;e[0]=t+s*a,e[4]=n*a-i,e[8]=r*h,e[1]=r*u,e[5]=r*l,e[9]=-a,e[2]=i*a-n,e[6]=s+t*a,e[10]=r*o}else if("ZXY"===t.order){const t=o*l,i=o*u,n=h*l,s=h*u;e[0]=t-s*a,e[4]=-r*u,e[8]=n+i*a,e[1]=i+n*a,e[5]=r*l,e[9]=s-t*a,e[2]=-r*h,e[6]=a,e[10]=r*o}else if("ZYX"===t.order){const t=r*l,i=r*u,n=a*l,s=a*u;e[0]=o*l,e[4]=n*h-i,e[8]=t*h+s,e[1]=o*u,e[5]=s*h+t,e[9]=i*h-n,e[2]=-h,e[6]=a*o,e[10]=r*o}else if("YZX"===t.order){const t=r*o,i=r*h,n=a*o,s=a*h;e[0]=o*l,e[4]=s-t*u,e[8]=n*u+i,e[1]=u,e[5]=r*l,e[9]=-a*l,e[2]=-h*l,e[6]=i*u+n,e[10]=t-s*u}else if("XZY"===t.order){const t=r*o,i=r*h,n=a*o,s=a*h;e[0]=o*l,e[4]=-u,e[8]=h*l,e[1]=t*u+s,e[5]=r*l,e[9]=i*u-n,e[2]=n*u-i,e[6]=a*l,e[10]=s*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Ju,t,Qu)}lookAt(t,e,i){const n=this.elements;return ec.subVectors(t,e),0===ec.lengthSq()&&(ec.z=1),ec.normalize(),Ku.crossVectors(i,ec),0===Ku.lengthSq()&&(1===Math.abs(i.z)?ec.x+=1e-4:ec.z+=1e-4,ec.normalize(),Ku.crossVectors(i,ec)),Ku.normalize(),tc.crossVectors(ec,Ku),n[0]=Ku.x,n[4]=tc.x,n[8]=ec.x,n[1]=Ku.y,n[5]=tc.y,n[9]=ec.y,n[2]=Ku.z,n[6]=tc.z,n[10]=ec.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[4],o=i[8],h=i[12],l=i[1],u=i[5],c=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],y=i[3],v=i[7],x=i[11],b=i[15],w=n[0],_=n[4],S=n[8],E=n[12],M=n[1],A=n[5],T=n[9],C=n[13],I=n[2],D=n[6],L=n[10],B=n[14],P=n[3],k=n[7],N=n[11],O=n[15];return s[0]=r*w+a*M+o*I+h*P,s[4]=r*_+a*A+o*D+h*k,s[8]=r*S+a*T+o*L+h*N,s[12]=r*E+a*C+o*B+h*O,s[1]=l*w+u*M+c*I+d*P,s[5]=l*_+u*A+c*D+d*k,s[9]=l*S+u*T+c*L+d*N,s[13]=l*E+u*C+c*B+d*O,s[2]=p*w+f*M+m*I+g*P,s[6]=p*_+f*A+m*D+g*k,s[10]=p*S+f*T+m*L+g*N,s[14]=p*E+f*C+m*B+g*O,s[3]=y*w+v*M+x*I+b*P,s[7]=y*_+v*A+x*D+b*k,s[11]=y*S+v*T+x*L+b*N,s[15]=y*E+v*C+x*B+b*O,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],s=t[12],r=t[1],a=t[5],o=t[9],h=t[13],l=t[2],u=t[6],c=t[10],d=t[14];return t[3]*(+s*o*u-n*h*u-s*a*c+i*h*c+n*a*d-i*o*d)+t[7]*(+e*o*d-e*h*c+s*r*c-n*r*d+n*h*l-s*o*l)+t[11]*(+e*h*u-e*a*d-s*r*u+i*r*d+s*a*l-i*h*l)+t[15]*(-n*a*l-e*o*u+e*a*c+n*r*u-i*r*c+i*o*l)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],y=u*m*h-f*c*h+f*o*d-a*m*d-u*o*g+a*c*g,v=p*c*h-l*m*h-p*o*d+r*m*d+l*o*g-r*c*g,x=l*f*h-p*u*h+p*a*d-r*f*d-l*a*g+r*u*g,b=p*u*o-l*f*o-p*a*c+r*f*c+l*a*m-r*u*m,w=e*y+i*v+n*x+s*b;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/w;return t[0]=y*_,t[1]=(f*c*s-u*m*s-f*n*d+i*m*d+u*n*g-i*c*g)*_,t[2]=(a*m*s-f*o*s+f*n*h-i*m*h-a*n*g+i*o*g)*_,t[3]=(u*o*s-a*c*s-u*n*h+i*c*h+a*n*d-i*o*d)*_,t[4]=v*_,t[5]=(l*m*s-p*c*s+p*n*d-e*m*d-l*n*g+e*c*g)*_,t[6]=(p*o*s-r*m*s-p*n*h+e*m*h+r*n*g-e*o*g)*_,t[7]=(r*c*s-l*o*s+l*n*h-e*c*h-r*n*d+e*o*d)*_,t[8]=x*_,t[9]=(p*u*s-l*f*s-p*i*d+e*f*d+l*i*g-e*u*g)*_,t[10]=(r*f*s-p*a*s+p*i*h-e*f*h-r*i*g+e*a*g)*_,t[11]=(l*a*s-r*u*s-l*i*h+e*u*h+r*i*d-e*a*d)*_,t[12]=b*_,t[13]=(l*f*n-p*u*n+p*i*c-e*f*c-l*i*m+e*u*m)*_,t[14]=(p*a*n-r*f*n-p*i*o+e*f*o+r*i*m-e*a*m)*_,t[15]=(r*u*n-l*a*n+l*i*o-e*u*o-r*i*c+e*a*c)*_,this}scale(t){const e=this.elements,i=t.x,n=t.y,s=t.z;return e[0]*=i,e[4]*=n,e[8]*=s,e[1]*=i,e[5]*=n,e[9]*=s,e[2]*=i,e[6]*=n,e[10]*=s,e[3]*=i,e[7]*=n,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),s=1-i,r=t.x,a=t.y,o=t.z,h=s*r,l=s*a;return this.set(h*r+i,h*a-n*o,h*o+n*a,0,h*a+n*o,l*a+i,l*o-n*r,0,h*o-n*a,l*o+n*r,s*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,s,r){return this.set(1,i,s,0,t,1,r,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,s=e._x,r=e._y,a=e._z,o=e._w,h=s+s,l=r+r,u=a+a,c=s*h,d=s*l,p=s*u,f=r*l,m=r*u,g=a*u,y=o*h,v=o*l,x=o*u,b=i.x,w=i.y,_=i.z;return n[0]=(1-(f+g))*b,n[1]=(d+x)*b,n[2]=(p-v)*b,n[3]=0,n[4]=(d-x)*w,n[5]=(1-(c+g))*w,n[6]=(m+y)*w,n[7]=0,n[8]=(p+v)*_,n[9]=(m-y)*_,n[10]=(1-(c+f))*_,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let s=Xu.set(n[0],n[1],n[2]).length();const r=Xu.set(n[4],n[5],n[6]).length(),a=Xu.set(n[8],n[9],n[10]).length();this.determinant()<0&&(s=-s),t.x=n[12],t.y=n[13],t.z=n[14],Zu.copy(this);const o=1/s,h=1/r,l=1/a;return Zu.elements[0]*=o,Zu.elements[1]*=o,Zu.elements[2]*=o,Zu.elements[4]*=h,Zu.elements[5]*=h,Zu.elements[6]*=h,Zu.elements[8]*=l,Zu.elements[9]*=l,Zu.elements[10]*=l,e.setFromRotationMatrix(Zu),i.x=s,i.y=r,i.z=a,this}makePerspective(t,e,i,n,s,r,a=2e3){const o=this.elements,h=2*s/(e-t),l=2*s/(i-n),u=(e+t)/(e-t),c=(i+n)/(i-n);let d,p;if(a===tu)d=-(r+s)/(r-s),p=-2*r*s/(r-s);else{if(2001!==a)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-r/(r-s),p=-r*s/(r-s)}return o[0]=h,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,i,n,s,r,a=2e3){const o=this.elements,h=1/(e-t),l=1/(i-n),u=1/(r-s),c=(e+t)*h,d=(i+n)*l;let p,f;if(a===tu)p=(r+s)*u,f=-2*u;else{if(2001!==a)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=s*u,f=-1*u}return o[0]=2*h,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=f,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}};const Xu=new Au,Zu=new $u,Ju=new Au(0,0,0),Qu=new Au(1,1,1),Ku=new Au,tc=new Au,ec=new Au,ic=new $u,nc=new Mu;class sc{constructor(t=0,e=0,i=0,n=sc.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,s=n[0],r=n[4],a=n[8],o=n[1],h=n[5],l=n[9],u=n[2],c=n[6],d=n[10];switch(e){case"XYZ":this._y=Math.asin(su(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(c,h),this._z=0);break;case"YXZ":this._x=Math.asin(-su(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,h)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(su(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-r,h)):(this._y=0,this._z=Math.atan2(o,s));break;case"ZYX":this._y=Math.asin(-su(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(c,d),this._z=Math.atan2(o,s)):(this._x=0,this._z=Math.atan2(-r,h));break;case"YZX":this._z=Math.asin(su(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-su(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(c,h),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-l,d),this._y=0)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return ic.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ic,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return nc.setFromEuler(this),this.setFromQuaternion(nc,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}sc.DEFAULT_ORDER="XYZ";class rc{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return!!(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let ac=0;const oc=new Au,hc=new Mu,lc=new $u,uc=new Au,cc=new Au,dc=new Au,pc=new Mu,fc=new Au(1,0,0),mc=new Au(0,1,0),gc=new Au(0,0,1),yc={type:"added"},vc={type:"removed"},xc={type:"childadded",child:null},bc={type:"childremoved",child:null};class wc extends eu{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ac++}),this.uuid=nu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=wc.DEFAULT_UP.clone();const t=new Au,e=new sc,i=new Mu,n=new Au(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new $u},normalMatrix:{value:new lu}}),this.matrix=new $u,this.matrixWorld=new $u,this.matrixAutoUpdate=wc.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=wc.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new rc,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(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return hc.setFromAxisAngle(t,e),this.quaternion.multiply(hc),this}rotateOnWorldAxis(t,e){return hc.setFromAxisAngle(t,e),this.quaternion.premultiply(hc),this}rotateX(t){return this.rotateOnAxis(fc,t)}rotateY(t){return this.rotateOnAxis(mc,t)}rotateZ(t){return this.rotateOnAxis(gc,t)}translateOnAxis(t,e){return oc.copy(t).applyQuaternion(this.quaternion),this.position.add(oc.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(fc,t)}translateY(t){return this.translateOnAxis(mc,t)}translateZ(t){return this.translateOnAxis(gc,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(lc.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?uc.copy(t):uc.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),cc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?lc.lookAt(cc,uc,this.up):lc.lookAt(uc,cc,this.up),this.quaternion.setFromRotationMatrix(lc),n&&(lc.extractRotation(n.matrixWorld),hc.setFromRotationMatrix(lc),this.quaternion.premultiply(hc.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this||t&&t.isObject3D&&(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(yc),xc.child=t,this.dispatchEvent(xc),xc.child=null),this}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(vc),bc.child=t,this.dispatchEvent(bc),bc.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),lc.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),lc.multiply(t.parent.matrixWorld)),t.applyMatrix4(lc),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(yc),xc.child=t,this.dispatchEvent(xc),xc.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(cc,t,dc),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(cc,pc,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++){e[i].updateMatrixWorld(t)}}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++){t[e].updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const n={};function s(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.geometryInfo=this._geometryInfo.map((t=>u(l({},t),{boundingBox:t.boundingBox?{min:t.boundingBox.min.toArray(),max:t.boundingBox.max.toArray()}:void 0,boundingSphere:t.boundingSphere?{radius:t.boundingSphere.radius,center:t.boundingSphere.center.toArray()}:void 0}))),n.instanceInfo=this._instanceInfo.map((t=>l({},t))),n.availableInstanceIds=this._availableInstanceIds.slice(),n.availableGeometryIds=this._availableGeometryIds.slice(),n.nextIndexStart=this._nextIndexStart,n.nextVertexStart=this._nextVertexStart,n.geometryCount=this._geometryCount,n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.matricesTexture=this._matricesTexture.toJSON(t),n.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(n.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(n.boundingSphere={center:this.boundingSphere.center.toArray(),radius:this.boundingSphere.radius}),null!==this.boundingBox&&(n.boundingBox={min:this.boundingBox.min.toArray(),max:this.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=s(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];s(t.shapes,n)}else s(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(s(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(s(t.materials,this.material[i]));n.material=e}else n.material=s(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(s(t.animations,i))}}if(e){const e=r(t.geometries),n=r(t.materials),s=r(t.textures),a=r(t.images),o=r(t.shapes),h=r(t.skeletons),l=r(t.animations),u=r(t.nodes);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),s.length>0&&(i.textures=s),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),h.length>0&&(i.skeletons=h),l.length>0&&(i.animations=l),u.length>0&&(i.nodes=u)}return i.object=n,i;function r(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}wc.DEFAULT_UP=new Au(0,1,0),wc.DEFAULT_MATRIX_AUTO_UPDATE=!0,wc.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const _c={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},Sc={h:0,s:0,l:0},Ec={h:0,s:0,l:0};function Mc(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class Ac{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Zl){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,mu.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n=mu.workingColorSpace){return this.r=t,this.g=e,this.b=i,mu.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n=mu.workingColorSpace){var s;if(t=(t%(s=1)+s)%s,e=su(e,0,1),i=su(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,s=2*i-n;this.r=Mc(s,n,t+1/3),this.g=Mc(s,n,t),this.b=Mc(s,n,t-1/3)}return mu.toWorkingColorSpace(this,n),this}setStyle(t,e=Zl){function i(t){void 0!==t&&parseFloat(t)}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(t)){let t;const s=n[1],r=n[2];switch(s){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return i(t[4]),this.setRGB(Math.min(255,parseInt(t[1],10))/255,Math.min(255,parseInt(t[2],10))/255,Math.min(255,parseInt(t[3],10))/255,e);if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return i(t[4]),this.setRGB(Math.min(100,parseInt(t[1],10))/100,Math.min(100,parseInt(t[2],10))/100,Math.min(100,parseInt(t[3],10))/100,e);break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return i(t[4]),this.setHSL(parseFloat(t[1])/360,parseFloat(t[2])/100,parseFloat(t[3])/100,e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],i=t.length;if(3===i)return this.setRGB(parseInt(t.charAt(0),16)/15,parseInt(t.charAt(1),16)/15,parseInt(t.charAt(2),16)/15,e);if(6===i)return this.setHex(parseInt(t,16),e)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Zl){const i=_c[t.toLowerCase()];return void 0!==i&&this.setHex(i,e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=gu(t.r),this.g=gu(t.g),this.b=gu(t.b),this}copyLinearToSRGB(t){return this.r=yu(t.r),this.g=yu(t.g),this.b=yu(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Zl){return mu.fromWorkingColorSpace(Tc.copy(this),t),65536*Math.round(su(255*Tc.r,0,255))+256*Math.round(su(255*Tc.g,0,255))+Math.round(su(255*Tc.b,0,255))}getHexString(t=Zl){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=mu.workingColorSpace){mu.fromWorkingColorSpace(Tc.copy(this),e);const i=Tc.r,n=Tc.g,s=Tc.b,r=Math.max(i,n,s),a=Math.min(i,n,s);let o,h;const l=(a+r)/2;if(a===r)o=0,h=0;else{const t=r-a;switch(h=l<=.5?t/(r+a):t/(2-r-a),r){case i:o=(n-s)/t+(n<s?6:0);break;case n:o=(s-i)/t+2;break;case s:o=(i-n)/t+4}o/=6}return t.h=o,t.s=h,t.l=l,t}getRGB(t,e=mu.workingColorSpace){return mu.fromWorkingColorSpace(Tc.copy(this),e),t.r=Tc.r,t.g=Tc.g,t.b=Tc.b,t}getStyle(t=Zl){mu.fromWorkingColorSpace(Tc.copy(this),t);const e=Tc.r,i=Tc.g,n=Tc.b;return t!==Zl?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(t,e,i){return this.getHSL(Sc),this.setHSL(Sc.h+t,Sc.s+e,Sc.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Sc),t.getHSL(Ec);const i=ru(Sc.h,Ec.h,e),n=ru(Sc.s,Ec.s,e),s=ru(Sc.l,Ec.l,e);return this.setHSL(i,n,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,n=this.b,s=t.elements;return this.r=s[0]*e+s[3]*i+s[6]*n,this.g=s[1]*e+s[4]*i+s[7]*n,this.b=s[2]*e+s[5]*i+s[8]*n,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Tc=new Ac;Ac.NAMES=_c;const Cc=new Au,Ic=new hu;let Dc=0;class Lc{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Dc++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,s=this.itemSize;n<s;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Ic.fromBufferAttribute(this,e),Ic.applyMatrix3(t),this.setXY(e,Ic.x,Ic.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Cc.fromBufferAttribute(this,e),Cc.applyMatrix3(t),this.setXYZ(e,Cc.x,Cc.y,Cc.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Cc.fromBufferAttribute(this,e),Cc.applyMatrix4(t),this.setXYZ(e,Cc.x,Cc.y,Cc.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Cc.fromBufferAttribute(this,e),Cc.applyNormalMatrix(t),this.setXYZ(e,Cc.x,Cc.y,Cc.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Cc.fromBufferAttribute(this,e),Cc.transformDirection(t),this.setXYZ(e,Cc.x,Cc.y,Cc.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=au(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=ou(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=au(e,this.array)),e}setX(t,e){return this.normalized&&(e=ou(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=au(e,this.array)),e}setY(t,e){return this.normalized&&(e=ou(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=au(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ou(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=au(e,this.array)),e}setW(t,e){return this.normalized&&(e=ou(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=ou(e,this.array),i=ou(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=ou(e,this.array),i=ou(i,this.array),n=ou(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,s){return t*=this.itemSize,this.normalized&&(e=ou(e,this.array),i=ou(i,this.array),n=ou(n,this.array),s=ou(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),t}}class Bc extends Lc{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class Pc extends Lc{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class kc extends Lc{constructor(t,e,i){super(new Float32Array(t),e,i)}}let Nc=0;const Oc=new $u,Rc=new wc,zc=new Au,Hc=new Iu,Wc=new Iu,Fc=new Au;class Uc extends eu{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Nc++}),this.uuid=nu(),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(t){return Array.isArray(t)?this.index=new(function(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}(t)?Pc:Bc)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new lu).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Oc.makeRotationFromQuaternion(t),this.applyMatrix4(Oc),this}rotateX(t){return Oc.makeRotationX(t),this.applyMatrix4(Oc),this}rotateY(t){return Oc.makeRotationY(t),this.applyMatrix4(Oc),this}rotateZ(t){return Oc.makeRotationZ(t),this.applyMatrix4(Oc),this}translate(t,e,i){return Oc.makeTranslation(t,e,i),this.applyMatrix4(Oc),this}scale(t,e,i){return Oc.makeScale(t,e,i),this.applyMatrix4(Oc),this}lookAt(t){return Rc.lookAt(t),Rc.updateMatrix(),this.applyMatrix4(Rc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(zc).negate(),this.translate(zc.x,zc.y,zc.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}this.setAttribute("position",new kc(e,3))}else{const i=Math.min(t.length,e.count);for(let n=0;n<i;n++){const i=t[n];e.setXYZ(n,i.x,i.y,i.z||0)}t.length,e.count,e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Iu);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingBox.set(new Au(-1/0,-1/0,-1/0),new Au(1/0,1/0,1/0));else{if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Hc.setFromBufferAttribute(i),this.morphTargetsRelative?(Fc.addVectors(this.boundingBox.min,Hc.min),this.boundingBox.expandByPoint(Fc),Fc.addVectors(this.boundingBox.max,Hc.max),this.boundingBox.expandByPoint(Fc)):(this.boundingBox.expandByPoint(Hc.min),this.boundingBox.expandByPoint(Hc.max))}}else this.boundingBox.makeEmpty();isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Gu);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingSphere.set(new Au,1/0);else if(t){const i=this.boundingSphere.center;if(Hc.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Wc.setFromBufferAttribute(i),this.morphTargetsRelative?(Fc.addVectors(Hc.min,Wc.min),Hc.expandByPoint(Fc),Fc.addVectors(Hc.max,Wc.max),Hc.expandByPoint(Fc)):(Hc.expandByPoint(Wc.min),Hc.expandByPoint(Wc.max))}Hc.getCenter(i);let n=0;for(let e=0,s=t.count;e<s;e++)Fc.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(Fc));if(e)for(let s=0,r=e.length;s<r;s++){const r=e[s],a=this.morphTargetsRelative;for(let e=0,s=r.count;e<s;e++)Fc.fromBufferAttribute(r,e),a&&(zc.fromBufferAttribute(t,e),Fc.add(zc)),n=Math.max(n,i.distanceToSquared(Fc))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return;const i=e.position,n=e.normal,s=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Lc(new Float32Array(4*i.count),4));const r=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<i.count;t++)a[t]=new Au,o[t]=new Au;const h=new Au,l=new Au,u=new Au,c=new hu,d=new hu,p=new hu,f=new Au,m=new Au;function g(t,e,n){h.fromBufferAttribute(i,t),l.fromBufferAttribute(i,e),u.fromBufferAttribute(i,n),c.fromBufferAttribute(s,t),d.fromBufferAttribute(s,e),p.fromBufferAttribute(s,n),l.sub(h),u.sub(h),d.sub(c),p.sub(c);const r=1/(d.x*p.y-p.x*d.y);isFinite(r)&&(f.copy(l).multiplyScalar(p.y).addScaledVector(u,-d.y).multiplyScalar(r),m.copy(u).multiplyScalar(d.x).addScaledVector(l,-p.x).multiplyScalar(r),a[t].add(f),a[e].add(f),a[n].add(f),o[t].add(m),o[e].add(m),o[n].add(m))}let y=this.groups;0===y.length&&(y=[{start:0,count:t.count}]);for(let e=0,i=y.length;e<i;++e){const i=y[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)g(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const v=new Au,x=new Au,b=new Au,w=new Au;function _(t){b.fromBufferAttribute(n,t),w.copy(b);const e=a[t];v.copy(e),v.sub(b.multiplyScalar(b.dot(e))).normalize(),x.crossVectors(w,e);const i=x.dot(o[t])<0?-1:1;r.setXYZW(t,v.x,v.y,v.z,i)}for(let e=0,i=y.length;e<i;++e){const i=y[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)_(t.getX(e+0)),_(t.getX(e+1)),_(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new Lc(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new Au,s=new Au,r=new Au,a=new Au,o=new Au,h=new Au,l=new Au,u=new Au;if(t)for(let c=0,d=t.count;c<d;c+=3){const d=t.getX(c+0),p=t.getX(c+1),f=t.getX(c+2);n.fromBufferAttribute(e,d),s.fromBufferAttribute(e,p),r.fromBufferAttribute(e,f),l.subVectors(r,s),u.subVectors(n,s),l.cross(u),a.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),h.fromBufferAttribute(i,f),a.add(l),o.add(l),h.add(l),i.setXYZ(d,a.x,a.y,a.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(f,h.x,h.y,h.z)}else for(let t=0,a=e.count;t<a;t+=3)n.fromBufferAttribute(e,t+0),s.fromBufferAttribute(e,t+1),r.fromBufferAttribute(e,t+2),l.subVectors(r,s),u.subVectors(n,s),l.cross(u),i.setXYZ(t+0,l.x,l.y,l.z),i.setXYZ(t+1,l.x,l.y,l.z),i.setXYZ(t+2,l.x,l.y,l.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Fc.fromBufferAttribute(t,e),Fc.normalize(),t.setXYZ(e,Fc.x,Fc.y,Fc.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,s=t.normalized,r=new i.constructor(e.length*n);let a=0,o=0;for(let s=0,h=e.length;s<h;s++){a=t.isInterleavedBufferAttribute?e[s]*t.data.stride+t.offset:e[s]*n;for(let t=0;t<n;t++)r[o++]=i[a++]}return new Lc(r,n,s)}if(null===this.index)return this;const e=new Uc,i=this.index.array,n=this.attributes;for(const s in n){const r=t(n[s],i);e.setAttribute(s,r)}const s=this.morphAttributes;for(const n in s){const r=[],a=s[n];for(let e=0,n=a.length;e<n;e++){const n=t(a[e],i);r.push(n)}e.morphAttributes[n]=r}e.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let t=0,i=r.length;t<i;t++){const i=r[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let s=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],r=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];r.push(n.toJSON(t.data))}r.length>0&&(n[e]=r,s=!0)}s&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(t.data.groups=JSON.parse(JSON.stringify(r)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone());const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const s=t.morphAttributes;for(const t in s){const i=[],n=s[t];for(let t=0,s=n.length;t<s;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const r=t.groups;for(let t=0,e=r.length;t<e;t++){const e=r[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Vc{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),s=0;e.push(0);for(let r=1;r<=t;r++)i=this.getPoint(r/t),s+=i.distanceTo(n),e.push(s),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){const i=this.getLengths();let n=0;const s=i.length;let r;r=e||t*i[s-1];let a,o=0,h=s-1;for(;o<=h;)if(n=Math.floor(o+(h-o)/2),a=i[n]-r,a<0)o=n+1;else{if(!(a>0)){h=n;break}h=n-1}if(n=h,i[n]===r)return n/(s-1);const l=i[n];return(n+(r-l)/(i[n+1]-l))/(s-1)}getTangent(t,e){const i=1e-4;let n=t-i,s=t+i;n<0&&(n=0),s>1&&(s=1);const r=this.getPoint(n),a=this.getPoint(s),o=e||(r.isVector2?new hu:new Au);return o.copy(a).sub(r).normalize(),o}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){const i=new Au,n=[],s=[],r=[],a=new Au,o=new $u;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new Au)}s[0]=new Au,r[0]=new Au;let h=Number.MAX_VALUE;const l=Math.abs(n[0].x),u=Math.abs(n[0].y),c=Math.abs(n[0].z);l<=h&&(h=l,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),c<=h&&i.set(0,0,1),a.crossVectors(n[0],i).normalize(),s[0].crossVectors(n[0],a),r[0].crossVectors(n[0],s[0]);for(let e=1;e<=t;e++){if(s[e]=s[e-1].clone(),r[e]=r[e-1].clone(),a.crossVectors(n[e-1],n[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(su(n[e-1].dot(n[e]),-1,1));s[e].applyMatrix4(o.makeRotationAxis(a,t))}r[e].crossVectors(n[e],s[e])}if(!0===e){let e=Math.acos(su(s[0].dot(s[t]),-1,1));e/=t,n[0].dot(a.crossVectors(s[0],s[t]))>0&&(e=-e);for(let i=1;i<=t;i++)s[i].applyMatrix4(o.makeRotationAxis(n[i],e*i)),r[i].crossVectors(n[i],s[i])}return{tangents:n,normals:s,binormals:r}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class qc extends Vc{constructor(t=0,e=0,i=1,n=1,s=0,r=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=s,this.aEndAngle=r,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new hu){const i=e,n=2*Math.PI;let s=this.aEndAngle-this.aStartAngle;const r=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=n;for(;s>n;)s-=n;s<Number.EPSILON&&(s=r?0:n),!0!==this.aClockwise||r||(s===n?s=-n:s-=n);const a=this.aStartAngle+t*s;let o=this.aX+this.xRadius*Math.cos(a),h=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=o-this.aX,n=h-this.aY;o=i*t-n*e+this.aX,h=i*e+n*t+this.aY}return i.set(o,h)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}function jc(){let t=0,e=0,i=0,n=0;function s(s,r,a,o){t=s,e=a,i=-3*s+3*r-2*a-o,n=2*s-2*r+a+o}return{initCatmullRom:function(t,e,i,n,r){s(e,i,r*(i-t),r*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,r,a,o){let h=(e-t)/r-(i-t)/(r+a)+(i-e)/a,l=(i-e)/a-(n-e)/(a+o)+(n-i)/o;h*=a,l*=a,s(e,i,h,l)},calc:function(s){const r=s*s;return t+e*s+i*r+n*(r*s)}}}const Yc=new Au,Gc=new jc,$c=new jc,Xc=new jc;function Zc(t,e,i,n,s){const r=.5*(n-e),a=.5*(s-i),o=t*t;return(2*i-2*n+r+a)*(t*o)+(-3*i+3*n-2*r-a)*o+r*t+i}function Jc(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function Qc(t,e,i,n,s){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,s)}class Kc extends Vc{constructor(t=new hu,e=new hu,i=new hu,n=new hu){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new hu){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(Qc(t,n.x,s.x,r.x,a.x),Qc(t,n.y,s.y,r.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class td extends Vc{constructor(t=new hu,e=new hu){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new hu){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new hu){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class ed extends Vc{constructor(t=new hu,e=new hu,i=new hu){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new hu){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(Jc(t,n.x,s.x,r.x),Jc(t,n.y,s.y,r.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class id extends Vc{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new hu){const i=e,n=this.points,s=(n.length-1)*t,r=Math.floor(s),a=s-r,o=n[0===r?r:r-1],h=n[r],l=n[r>n.length-2?n.length-1:r+1],u=n[r>n.length-3?n.length-1:r+2];return i.set(Zc(a,o.x,h.x,l.x,u.x),Zc(a,o.y,h.y,l.y,u.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new hu).fromArray(i))}return this}}var nd=Object.freeze({__proto__:null,ArcCurve:class extends qc{constructor(t,e,i,n,s,r){super(t,e,i,i,n,s,r),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends Vc{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new Au){const i=e,n=this.points,s=n.length,r=(s-(this.closed?0:1))*t;let a,o,h=Math.floor(r),l=r-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/s)+1)*s:0===l&&h===s-1&&(h=s-2,l=1),this.closed||h>0?a=n[(h-1)%s]:(Yc.subVectors(n[0],n[1]).add(n[0]),a=Yc);const u=n[h%s],c=n[(h+1)%s];if(this.closed||h+2<s?o=n[(h+2)%s]:(Yc.subVectors(n[s-1],n[s-2]).add(n[s-1]),o=Yc),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(c),t),n=Math.pow(c.distanceToSquared(o),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),Gc.initNonuniformCatmullRom(a.x,u.x,c.x,o.x,e,i,n),$c.initNonuniformCatmullRom(a.y,u.y,c.y,o.y,e,i,n),Xc.initNonuniformCatmullRom(a.z,u.z,c.z,o.z,e,i,n)}else"catmullrom"===this.curveType&&(Gc.initCatmullRom(a.x,u.x,c.x,o.x,this.tension),$c.initCatmullRom(a.y,u.y,c.y,o.y,this.tension),Xc.initCatmullRom(a.z,u.z,c.z,o.z,this.tension));return i.set(Gc.calc(l),$c.calc(l),Xc.calc(l)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new Au).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},CubicBezierCurve:Kc,CubicBezierCurve3:class extends Vc{constructor(t=new Au,e=new Au,i=new Au,n=new Au){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new Au){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(Qc(t,n.x,s.x,r.x,a.x),Qc(t,n.y,s.y,r.y,a.y),Qc(t,n.z,s.z,r.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},EllipseCurve:qc,LineCurve:td,LineCurve3:class extends Vc{constructor(t=new Au,e=new Au){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new Au){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Au){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:ed,QuadraticBezierCurve3:class extends Vc{constructor(t=new Au,e=new Au,i=new Au){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Au){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(Jc(t,n.x,s.x,r.x),Jc(t,n.y,s.y,r.y),Jc(t,n.z,s.z,r.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},SplineCurve:id});class sd extends Vc{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const i=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new nd[i](e,t))}return this}getPoint(t,e){const i=t*this.getLength(),n=this.getCurveLengths();let s=0;for(;s<n.length;){if(n[s]>=i){const t=n[s]-i,r=this.curves[s],a=r.getLength(),o=0===a?0:1-t/a;return r.getPointAt(o,e)}s++}return null}getLength(){const t=this.getCurveLengths();return t[t.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 t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let n=0,s=this.curves;n<s.length;n++){const r=s[n],a=r.isEllipseCurve?2*t:r.isLineCurve||r.isLineCurve3?1:r.isSplineCurve?t*r.points.length:t,o=r.getPoints(a);for(let t=0;t<o.length;t++){const n=o[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new nd[i.type]).fromJSON(i))}return this}}class rd extends sd{constructor(t){super(),this.type="Path",this.currentPoint=new hu,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new td(this.currentPoint.clone(),new hu(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const s=new ed(this.currentPoint.clone(),new hu(t,e),new hu(i,n));return this.curves.push(s),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,s,r){const a=new Kc(this.currentPoint.clone(),new hu(t,e),new hu(i,n),new hu(s,r));return this.curves.push(a),this.currentPoint.set(s,r),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new id(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,s,r){const a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,i,n,s,r),this}absarc(t,e,i,n,s,r){return this.absellipse(t,e,i,i,n,s,r),this}ellipse(t,e,i,n,s,r,a,o){const h=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+h,e+l,i,n,s,r,a,o),this}absellipse(t,e,i,n,s,r,a,o){const h=new qc(t,e,i,n,s,r,a,o);if(this.curves.length>0){const t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);const l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}let ad=class extends rd{constructor(t){super(t),this.uuid=nu(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new rd).fromJSON(i))}return this}};function od(t,e,i=2){const n=e&&e.length,s=n?e[0]*i:t.length;let r=hd(t,0,s,i,!0);const a=[];if(!r||r.next===r.prev)return a;let o,h,l;if(n&&(r=function(t,e,i,n){const s=[];for(let i=0,r=e.length;i<r;i++){const a=hd(t,e[i]*n,i<r-1?e[i+1]*n:t.length,n,!1);a===a.next&&(a.steiner=!0),s.push(xd(a))}s.sort(md);for(let t=0;t<s.length;t++)i=gd(s[t],i);return i}(t,e,r,i)),t.length>80*i){o=1/0,h=1/0;let e=-1/0,n=-1/0;for(let r=i;r<s;r+=i){const i=t[r],s=t[r+1];i<o&&(o=i),s<h&&(h=s),i>e&&(e=i),s>n&&(n=s)}l=Math.max(e-o,n-h),l=0!==l?32767/l:0}return ud(r,a,i,o,h,l,0),a}function hd(t,e,i,n,s){let r;if(s===function(t,e,i,n){let s=0;for(let r=e,a=i-n;r<i;r+=n)s+=(t[a]-t[r])*(t[r+1]+t[a+1]),a=r;return s}(t,e,i,n)>0)for(let s=e;s<i;s+=n)r=Dd(s/n|0,t[s],t[s+1],r);else for(let s=i-n;s>=e;s-=n)r=Dd(s/n|0,t[s],t[s+1],r);return r&&Ed(r,r.next)&&(Ld(r),r=r.next),r}function ld(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!Ed(n,n.next)&&0!==Sd(n.prev,n,n.next))n=n.next;else{if(Ld(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function ud(t,e,i,n,s,r,a){if(!t)return;!a&&r&&function(t,e,i,n){let s=t;do{0===s.z&&(s.z=vd(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){let e,i=1;do{let n,s=t;t=null;let r=null;for(e=0;s;){e++;let a=s,o=0;for(let t=0;t<i&&(o++,a=a.nextZ,a);t++);let h=i;for(;o>0||h>0&&a;)0!==o&&(0===h||!a||s.z<=a.z)?(n=s,s=s.nextZ,o--):(n=a,a=a.nextZ,h--),r?r.nextZ=n:t=n,n.prevZ=r,r=n;s=a}r.nextZ=null,i*=2}while(e>1)}(s)}(t,n,s,r);let o=t;for(;t.prev!==t.next;){const h=t.prev,l=t.next;if(r?dd(t,n,s,r):cd(t))e.push(h.i,t.i,l.i),Ld(t),t=l.next,o=l.next;else if((t=l)===o){a?1===a?ud(t=pd(ld(t),e),e,i,n,s,r,2):2===a&&fd(t,e,i,n,s,r):ud(ld(t),e,i,n,s,r,1);break}}}function cd(t){const e=t.prev,i=t,n=t.next;if(Sd(e,i,n)>=0)return!1;const s=e.x,r=i.x,a=n.x,o=e.y,h=i.y,l=n.y,u=Math.min(s,r,a),c=Math.min(o,h,l),d=Math.max(s,r,a),p=Math.max(o,h,l);let f=n.next;for(;f!==e;){if(f.x>=u&&f.x<=d&&f.y>=c&&f.y<=p&&wd(s,o,r,h,a,l,f.x,f.y)&&Sd(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function dd(t,e,i,n){const s=t.prev,r=t,a=t.next;if(Sd(s,r,a)>=0)return!1;const o=s.x,h=r.x,l=a.x,u=s.y,c=r.y,d=a.y,p=Math.min(o,h,l),f=Math.min(u,c,d),m=Math.max(o,h,l),g=Math.max(u,c,d),y=vd(p,f,e,i,n),v=vd(m,g,e,i,n);let x=t.prevZ,b=t.nextZ;for(;x&&x.z>=y&&b&&b.z<=v;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==s&&x!==a&&wd(o,u,h,c,l,d,x.x,x.y)&&Sd(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==s&&b!==a&&wd(o,u,h,c,l,d,b.x,b.y)&&Sd(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;x&&x.z>=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==s&&x!==a&&wd(o,u,h,c,l,d,x.x,x.y)&&Sd(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==s&&b!==a&&wd(o,u,h,c,l,d,b.x,b.y)&&Sd(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function pd(t,e){let i=t;do{const n=i.prev,s=i.next.next;!Ed(n,s)&&Md(n,i,i.next,s)&&Cd(n,s)&&Cd(s,n)&&(e.push(n.i,i.i,s.i),Ld(i),Ld(i.next),i=t=s),i=i.next}while(i!==t);return ld(i)}function fd(t,e,i,n,s,r){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&_d(a,t)){let o=Id(a,t);return a=ld(a,a.next),o=ld(o,o.next),ud(a,e,i,n,s,r,0),void ud(o,e,i,n,s,r,0)}t=t.next}a=a.next}while(a!==t)}function md(t,e){let i=t.x-e.x;if(0===i&&(i=t.y-e.y,0===i)){i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return i}function gd(t,e){const i=function(t,e){let i=e;const n=t.x,s=t.y;let r,a=-1/0;if(Ed(t,i))return i;do{if(Ed(t,i.next))return i.next;if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){const t=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>a&&(a=t,r=i.x<i.next.x?i:i.next,t===n))return r}i=i.next}while(i!==e);if(!r)return null;const o=r,h=r.x,l=r.y;let u=1/0;i=r;do{if(n>=i.x&&i.x>=h&&n!==i.x&&bd(s<l?n:a,s,h,l,s<l?a:n,s,i.x,i.y)){const e=Math.abs(s-i.y)/(n-i.x);Cd(i,t)&&(e<u||e===u&&(i.x>r.x||i.x===r.x&&yd(r,i)))&&(r=i,u=e)}i=i.next}while(i!==o);return r}(t,e);if(!i)return e;const n=Id(i,t);return ld(n,n.next),ld(i,i.next)}function yd(t,e){return Sd(t.prev,t,e.prev)<0&&Sd(e.next,t,t.next)<0}function vd(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*s|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function xd(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function bd(t,e,i,n,s,r,a,o){return(s-a)*(e-o)>=(t-a)*(r-o)&&(t-a)*(n-o)>=(i-a)*(e-o)&&(i-a)*(r-o)>=(s-a)*(n-o)}function wd(t,e,i,n,s,r,a,o){return!(t===a&&e===o)&&bd(t,e,i,n,s,r,a,o)}function _d(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Md(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Cd(t,e)&&Cd(e,t)&&function(t,e){let i=t,n=!1;const s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(Sd(t.prev,t,e.prev)||Sd(t,e.prev,e))||Ed(t,e)&&Sd(t.prev,t,t.next)>0&&Sd(e.prev,e,e.next)>0)}function Sd(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Ed(t,e){return t.x===e.x&&t.y===e.y}function Md(t,e,i,n){const s=Td(Sd(t,e,i)),r=Td(Sd(t,e,n)),a=Td(Sd(i,n,t)),o=Td(Sd(i,n,e));return s!==r&&a!==o||(!(0!==s||!Ad(t,i,e))||(!(0!==r||!Ad(t,n,e))||(!(0!==a||!Ad(i,t,n))||!(0!==o||!Ad(i,e,n)))))}function Ad(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Td(t){return t>0?1:t<0?-1:0}function Cd(t,e){return Sd(t.prev,t,t.next)<0?Sd(t,e,t.next)>=0&&Sd(t,t.prev,e)>=0:Sd(t,e,t.prev)<0||Sd(t,t.next,e)<0}function Id(t,e){const i=Bd(t.i,t.x,t.y),n=Bd(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function Dd(t,e,i,n){const s=Bd(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Ld(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Bd(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Pd{static triangulate(t,e,i=2){return od(t,e,i)}}class kd{static area(t){const e=t.length;let i=0;for(let n=e-1,s=0;s<e;n=s++)i+=t[n].x*t[s].y-t[s].x*t[n].y;return.5*i}static isClockWise(t){return kd.area(t)<0}static triangulateShape(t,e){const i=[],n=[],s=[];Nd(t),Od(i,t);let r=t.length;e.forEach(Nd);for(let t=0;t<e.length;t++)n.push(r),r+=e[t].length,Od(i,e[t]);const a=Pd.triangulate(i,n);for(let t=0;t<a.length;t+=3)s.push(a.slice(t,t+3));return s}}function Nd(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Od(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}const Rd={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class zd{constructor(t,e,i){const n=this;let s,r=!1,a=0,o=0;const h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===r&&void 0!==n.onStart&&n.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return h.push(t,e),this},this.removeHandler=function(t){const e=h.indexOf(t);return-1!==e&&h.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=h.length;e<i;e+=2){const i=h[e],n=h[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}}const Hd=new zd;class Wd{constructor(t){this.manager=void 0!==t?t:Hd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise((function(n,s){i.load(t,n,e,s)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}Wd.DEFAULT_MATERIAL_NAME="__DEFAULT";const Fd={};class Ud extends Error{constructor(t,e){super(t),this.response=e}}class Vd extends Wd{constructor(t){super(t),this.mimeType="",this.responseType=""}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const s=Rd.get(t);if(void 0!==s)return this.manager.itemStart(t),setTimeout((()=>{e&&e(s),this.manager.itemEnd(t)}),0),s;if(void 0!==Fd[t])return void Fd[t].push({onLoad:e,onProgress:i,onError:n});Fd[t]=[],Fd[t].push({onLoad:e,onProgress:i,onError:n});const r=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(r).then((e=>{if(200===e.status||0===e.status){if(e.status,"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=Fd[t],n=e.body.getReader(),s=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),r=s?parseInt(s):0,a=0!==r;let o=0;const h=new ReadableStream({start(t){!function e(){n.read().then((({done:n,value:s})=>{if(n)t.close();else{o+=s.byteLength;const n=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:r});for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onProgress&&e.onProgress(n)}t.enqueue(s),e()}}),(e=>{t.error(e)}))}()}});return new Response(h)}throw new Ud(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(""===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),i=e&&e[1]?e[1].toLowerCase():void 0,n=new TextDecoder(i);return t.arrayBuffer().then((t=>n.decode(t)))}}})).then((e=>{Rd.add(t,e);const i=Fd[t];delete Fd[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onLoad&&n.onLoad(e)}})).catch((e=>{const i=Fd[t];if(void 0===i)throw this.manager.itemError(t),e;delete Fd[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}const qd=new hu;class jd{constructor(t=new hu(1/0,1/0),e=new hu(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=qd.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,qd).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}class Yd{constructor(){this.type="ShapePath",this.color=new Ac,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new rd,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.currentPath.bezierCurveTo(t,e,i,n,s,r),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const i=e.length;let n=!1;for(let s=i-1,r=0;r<i;s=r++){let i=e[s],a=e[r],o=a.x-i.x,h=a.y-i.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(i=e[r],o=-o,a=e[s],h=-h),t.y<i.y||t.y>a.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=h*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return n}const i=kd.isClockWise,n=this.subPaths;if(0===n.length)return[];let s,r,a;const o=[];if(1===n.length)return r=n[0],a=new ad,a.curves=r.curves,o.push(a),o;let h=!i(n[0].getPoints());h=t?!h:h;const l=[],u=[];let c,d,p=[],f=0;u[f]=void 0,p[f]=[];for(let e=0,a=n.length;e<a;e++)r=n[e],c=r.getPoints(),s=i(c),s=t?!s:s,s?(!h&&u[f]&&f++,u[f]={s:new ad,p:c},u[f].s.curves=r.curves,h&&f++,p[f]=[]):p[f].push({h:r,p:c[0]});if(!u[0])return function(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i],s=new ad;s.curves=n.curves,e.push(s)}return e}(n);if(u.length>1){let t=!1,i=0;for(let t=0,e=u.length;t<e;t++)l[t]=[];for(let n=0,s=u.length;n<s;n++){const s=p[n];for(let r=0;r<s.length;r++){const a=s[r];let o=!0;for(let s=0;s<u.length;s++)e(a.p,u[s].p)&&(n!==s&&i++,o?(o=!1,l[s].push(a)):t=!0);o&&l[n].push(a)}}i>0&&!1===t&&(p=l)}for(let t=0,e=u.length;t<e;t++){a=u[t].s,o.push(a),d=p[t];for(let t=0,e=d.length;t<e;t++)a.holes.push(d[t].h)}return o}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"176"}})),"undefined"!=typeof window&&(window.__THREE__||(window.__THREE__="176"));const Gd=Zl;class $d extends Wd{constructor(t){super(t),this.defaultDPI=90,this.defaultUnit="px"}load(t,e,i,n){const s=this,r=new Vd(s.manager);r.setPath(s.path),r.setRequestHeader(s.requestHeader),r.setWithCredentials(s.withCredentials),r.load(t,(function(i){try{e(s.parse(i))}catch(e){n&&n(e),s.manager.itemError(t)}}),i,n)}parse(t){const e=this;function i(t,e,i,s,r,a,o,h){if(0==e||0==i)return void t.lineTo(h.x,h.y);s=s*Math.PI/180,e=Math.abs(e),i=Math.abs(i);const l=(o.x-h.x)/2,u=(o.y-h.y)/2,c=Math.cos(s)*l+Math.sin(s)*u,d=-Math.sin(s)*l+Math.cos(s)*u;let p=e*e,f=i*i;const m=c*c,g=d*d,y=m/p+g/f;if(y>1){const t=Math.sqrt(y);p=(e*=t)*e,f=(i*=t)*i}const v=p*g+f*m,x=(p*f-v)/v;let b=Math.sqrt(Math.max(0,x));r===a&&(b=-b);const w=b*e*d/i,_=-b*i*c/e,S=Math.cos(s)*w-Math.sin(s)*_+(o.x+h.x)/2,E=Math.sin(s)*w+Math.cos(s)*_+(o.y+h.y)/2,M=n(1,0,(c-w)/e,(d-_)/i),A=n((c-w)/e,(d-_)/i,(-c-w)/e,(-d-_)/i)%(2*Math.PI);t.currentPath.absellipse(S,E,e,i,M,M+A,0===a,s)}function n(t,e,i,n){const s=t*i+e*n,r=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+n*n);let a=Math.acos(Math.max(-1,Math.min(1,s/r)));return t*n-e*i<0&&(a=-a),a}function s(t,e){e=Object.assign({},e);let i={};if(t.hasAttribute("class")){const e=t.getAttribute("class").split(/\s/).filter(Boolean).map((t=>t.trim()));for(let t=0;t<e.length;t++)i=Object.assign(i,m["."+e[t]])}function n(n,s,r){void 0===r&&(r=function(t){return t.startsWith("url"),t}),t.hasAttribute(n)&&(e[s]=r(t.getAttribute(n))),i[n]&&(e[s]=r(i[n])),t.style&&""!==t.style[n]&&(e[s]=r(t.style[n]))}function s(t){return Math.max(0,Math.min(1,l(t)))}function r(t){return Math.max(0,l(t))}return t.hasAttribute("id")&&(i=Object.assign(i,m["#"+t.getAttribute("id")])),n("fill","fill"),n("fill-opacity","fillOpacity",s),n("fill-rule","fillRule"),n("opacity","opacity",s),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",s),n("stroke-width","strokeWidth",r),n("stroke-linejoin","strokeLineJoin"),n("stroke-linecap","strokeLineCap"),n("stroke-miterlimit","strokeMiterLimit",r),n("visibility","visibility"),e}function r(t,e){return t-(e-t)}function a(t,e,i){if("string"!=typeof t)throw new TypeError("Invalid input: "+typeof t);const n={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let s=0,r=!0,a="",o="";const h=[];function l(t,e,i){const n=new SyntaxError('Unexpected character "'+t+'" at index '+e+".");throw n.partial=i,n}function u(){""!==a&&(""===o?h.push(Number(a)):h.push(Number(a)*Math.pow(10,Number(o)))),a="",o=""}let c;const d=t.length;for(let p=0;p<d;p++)if(c=t[p],Array.isArray(e)&&e.includes(h.length%i)&&n.FLAGS.test(c))s=1,a=c,u();else{if(0===s){if(n.WHITESPACE.test(c))continue;if(n.DIGIT.test(c)||n.SIGN.test(c)){s=1,a=c;continue}if(n.POINT.test(c)){s=2,a=c;continue}n.COMMA.test(c)&&(r&&l(c,p,h),r=!0)}if(1===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.POINT.test(c)){a+=c,s=2;continue}if(n.EXP.test(c)){s=3;continue}n.SIGN.test(c)&&1===a.length&&n.SIGN.test(a[0])&&l(c,p,h)}if(2===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.EXP.test(c)){s=3;continue}n.POINT.test(c)&&"."===a[a.length-1]&&l(c,p,h)}if(3===s){if(n.DIGIT.test(c)){o+=c;continue}if(n.SIGN.test(c)){if(""===o){o+=c;continue}1===o.length&&n.SIGN.test(o)&&l(c,p,h)}}n.WHITESPACE.test(c)?(u(),s=0,r=!1):n.COMMA.test(c)?(u(),s=0,r=!0):n.SIGN.test(c)?(u(),s=1,a=c):n.POINT.test(c)?(u(),s=2,a=c):l(c,p,h)}return u(),h}const o=["mm","cm","in","pt","pc","px"],h={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function l(t){let i,n="px";if("string"==typeof t||t instanceof String)for(let e=0,i=o.length;e<i;e++){const i=o[e];if(t.endsWith(i)){n=i,t=t.substring(0,t.length-i.length);break}}return"px"===n&&"px"!==e.defaultUnit?i=h.in[e.defaultUnit]/e.defaultDPI:(i=h[n][e.defaultUnit],i<0&&(i=h[n].in*e.defaultDPI)),i*parseFloat(t)}function u(t){const e=t.elements;return e[0]*e[4]-e[1]*e[3]<0}function c(t){const e=t.elements,i=e[0]*e[3]+e[1]*e[4];if(0===i)return!1;const n=d(t),s=p(t);return Math.abs(i/(n*s))>Number.EPSILON}function d(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function p(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}const f=[],m={},g=[],y=new lu,v=new lu,x=new lu,b=new lu,w=new hu,_=new Au,S=new lu,E=(new DOMParser).parseFromString(t,"image/svg+xml");!function t(e,n){if(1!==e.nodeType)return;const o=function(t){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))))return null;const e=function(t){const e=new lu,i=y;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){const i=l(t.getAttribute("x")),n=l(t.getAttribute("y"));e.translate(i,n)}if(t.hasAttribute("transform")){const n=t.getAttribute("transform").split(")");for(let t=n.length-1;t>=0;t--){const s=n[t].trim();if(""===s)continue;const r=s.indexOf("("),o=s.length;if(r>0&&r<o){const t=s.slice(0,r),e=a(s.slice(r+1));switch(i.identity(),t){case"translate":if(e.length>=1){const t=e[0];let n=0;e.length>=2&&(n=e[1]),i.translate(t,n)}break;case"rotate":if(e.length>=1){let t=0,n=0,s=0;t=e[0]*Math.PI/180,e.length>=3&&(n=e[1],s=e[2]),v.makeTranslation(-n,-s),x.makeRotation(t),b.multiplyMatrices(x,v),v.makeTranslation(n,s),i.multiplyMatrices(v,b)}break;case"scale":if(e.length>=1){const t=e[0];let n=t;e.length>=2&&(n=e[1]),i.scale(t,n)}break;case"skewX":1===e.length&&i.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&i.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&i.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}e.premultiply(i)}}return e}(t);g.length>0&&e.premultiply(g[g.length-1]);return S.copy(e),g.push(e),e}(e);let h=!1,E=null;switch(e.nodeName){case"svg":case"g":n=s(e,n);break;case"style":!function(t){if(!t.sheet||!t.sheet.cssRules||!t.sheet.cssRules.length)return;for(let e=0;e<t.sheet.cssRules.length;e++){const i=t.sheet.cssRules[e];if(1!==i.type)continue;const n=i.selectorText.split(/,/gm).filter(Boolean).map((t=>t.trim()));for(let t=0;t<n.length;t++){const e=Object.fromEntries(Object.entries(i.style).filter((([,t])=>""!==t)));m[n[t]]=Object.assign(m[n[t]]||{},e)}}}(e);break;case"path":n=s(e,n),e.hasAttribute("d")&&(E=function(t){const e=new Yd,n=new hu,s=new hu,o=new hu;let h=!0,l=!1;const u=t.getAttribute("d");if(""===u||"none"===u)return null;const c=u.match(/[a-df-z][^a-df-z]*/gi);for(let t=0,u=c.length;t<u;t++){const u=c[t],d=u.charAt(0),p=u.slice(1).trim();let f;switch(!0===h&&(l=!0,h=!1),d){case"M":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x=f[t+0],n.y=f[t+1],s.x=n.x,s.y=n.y,0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y),0===t&&o.copy(n);break;case"H":f=a(p);for(let t=0,i=f.length;t<i;t++)n.x=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"V":f=a(p);for(let t=0,i=f.length;t<i;t++)n.y=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"L":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x=f[t+0],n.y=f[t+1],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"C":f=a(p);for(let t=0,i=f.length;t<i;t+=6)e.bezierCurveTo(f[t+0],f[t+1],f[t+2],f[t+3],f[t+4],f[t+5]),s.x=f[t+2],s.y=f[t+3],n.x=f[t+4],n.y=f[t+5],0===t&&!0===l&&o.copy(n);break;case"S":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.bezierCurveTo(r(n.x,s.x),r(n.y,s.y),f[t+0],f[t+1],f[t+2],f[t+3]),s.x=f[t+0],s.y=f[t+1],n.x=f[t+2],n.y=f[t+3],0===t&&!0===l&&o.copy(n);break;case"Q":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.quadraticCurveTo(f[t+0],f[t+1],f[t+2],f[t+3]),s.x=f[t+0],s.y=f[t+1],n.x=f[t+2],n.y=f[t+3],0===t&&!0===l&&o.copy(n);break;case"T":f=a(p);for(let t=0,i=f.length;t<i;t+=2){const i=r(n.x,s.x),a=r(n.y,s.y);e.quadraticCurveTo(i,a,f[t+0],f[t+1]),s.x=i,s.y=a,n.x=f[t+0],n.y=f[t+1],0===t&&!0===l&&o.copy(n)}break;case"A":f=a(p,[3,4],7);for(let t=0,r=f.length;t<r;t+=7){if(f[t+5]==n.x&&f[t+6]==n.y)continue;const r=n.clone();n.x=f[t+5],n.y=f[t+6],s.x=n.x,s.y=n.y,i(e,f[t],f[t+1],f[t+2],f[t+3],f[t+4],r,n),0===t&&!0===l&&o.copy(n)}break;case"m":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x+=f[t+0],n.y+=f[t+1],s.x=n.x,s.y=n.y,0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y),0===t&&o.copy(n);break;case"h":f=a(p);for(let t=0,i=f.length;t<i;t++)n.x+=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"v":f=a(p);for(let t=0,i=f.length;t<i;t++)n.y+=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"l":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x+=f[t+0],n.y+=f[t+1],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"c":f=a(p);for(let t=0,i=f.length;t<i;t+=6)e.bezierCurveTo(n.x+f[t+0],n.y+f[t+1],n.x+f[t+2],n.y+f[t+3],n.x+f[t+4],n.y+f[t+5]),s.x=n.x+f[t+2],s.y=n.y+f[t+3],n.x+=f[t+4],n.y+=f[t+5],0===t&&!0===l&&o.copy(n);break;case"s":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.bezierCurveTo(r(n.x,s.x),r(n.y,s.y),n.x+f[t+0],n.y+f[t+1],n.x+f[t+2],n.y+f[t+3]),s.x=n.x+f[t+0],s.y=n.y+f[t+1],n.x+=f[t+2],n.y+=f[t+3],0===t&&!0===l&&o.copy(n);break;case"q":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.quadraticCurveTo(n.x+f[t+0],n.y+f[t+1],n.x+f[t+2],n.y+f[t+3]),s.x=n.x+f[t+0],s.y=n.y+f[t+1],n.x+=f[t+2],n.y+=f[t+3],0===t&&!0===l&&o.copy(n);break;case"t":f=a(p);for(let t=0,i=f.length;t<i;t+=2){const i=r(n.x,s.x),a=r(n.y,s.y);e.quadraticCurveTo(i,a,n.x+f[t+0],n.y+f[t+1]),s.x=i,s.y=a,n.x=n.x+f[t+0],n.y=n.y+f[t+1],0===t&&!0===l&&o.copy(n)}break;case"a":f=a(p,[3,4],7);for(let t=0,r=f.length;t<r;t+=7){if(0==f[t+5]&&0==f[t+6])continue;const r=n.clone();n.x+=f[t+5],n.y+=f[t+6],s.x=n.x,s.y=n.y,i(e,f[t],f[t+1],f[t+2],f[t+3],f[t+4],r,n),0===t&&!0===l&&o.copy(n)}break;case"Z":case"z":e.currentPath.autoClose=!0,e.currentPath.curves.length>0&&(n.copy(o),e.currentPath.currentPoint.copy(n),h=!0)}l=!1}return e}(e));break;case"rect":n=s(e,n),E=function(t){const e=l(t.getAttribute("x")||0),i=l(t.getAttribute("y")||0),n=l(t.getAttribute("rx")||t.getAttribute("ry")||0),s=l(t.getAttribute("ry")||t.getAttribute("rx")||0),r=l(t.getAttribute("width")),a=l(t.getAttribute("height")),o=.448084975506,h=new Yd;h.moveTo(e+n,i),h.lineTo(e+r-n,i),(0!==n||0!==s)&&h.bezierCurveTo(e+r-n*o,i,e+r,i+s*o,e+r,i+s);h.lineTo(e+r,i+a-s),(0!==n||0!==s)&&h.bezierCurveTo(e+r,i+a-s*o,e+r-n*o,i+a,e+r-n,i+a);h.lineTo(e+n,i+a),(0!==n||0!==s)&&h.bezierCurveTo(e+n*o,i+a,e,i+a-s*o,e,i+a-s);h.lineTo(e,i+s),(0!==n||0!==s)&&h.bezierCurveTo(e,i+s*o,e+n*o,i,e+n,i);return h}(e);break;case"polygon":n=s(e,n),E=function(t){function e(t,e,i){const r=l(e),a=l(i);0===s?n.moveTo(r,a):n.lineTo(r,a),s++}const i=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,n=new Yd;let s=0;return t.getAttribute("points").replace(i,e),n.currentPath.autoClose=!0,n}(e);break;case"polyline":n=s(e,n),E=function(t){function e(t,e,i){const r=l(e),a=l(i);0===s?n.moveTo(r,a):n.lineTo(r,a),s++}const i=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,n=new Yd;let s=0;return t.getAttribute("points").replace(i,e),n.currentPath.autoClose=!1,n}(e);break;case"circle":n=s(e,n),E=function(t){const e=l(t.getAttribute("cx")||0),i=l(t.getAttribute("cy")||0),n=l(t.getAttribute("r")||0),s=new rd;s.absarc(e,i,n,0,2*Math.PI);const r=new Yd;return r.subPaths.push(s),r}(e);break;case"ellipse":n=s(e,n),E=function(t){const e=l(t.getAttribute("cx")||0),i=l(t.getAttribute("cy")||0),n=l(t.getAttribute("rx")||0),s=l(t.getAttribute("ry")||0),r=new rd;r.absellipse(e,i,n,s,0,2*Math.PI);const a=new Yd;return a.subPaths.push(r),a}(e);break;case"line":n=s(e,n),E=function(t){const e=l(t.getAttribute("x1")||0),i=l(t.getAttribute("y1")||0),n=l(t.getAttribute("x2")||0),s=l(t.getAttribute("y2")||0),r=new Yd;return r.moveTo(e,i),r.lineTo(n,s),r.currentPath.autoClose=!1,r}(e);break;case"defs":h=!0;break;case"use":n=s(e,n);const o=(e.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),u=e.viewportElement.getElementById(o);u&&t(u,n)}E&&(void 0!==n.fill&&"none"!==n.fill&&E.color.setStyle(n.fill,Gd),function(t,e){function i(t){_.set(t.x,t.y,1).applyMatrix3(e),t.set(_.x,_.y)}function n(t){const i=t.xRadius,n=t.yRadius,s=Math.cos(t.aRotation),r=Math.sin(t.aRotation),a=new Au(i*s,i*r,0),o=new Au(-n*r,n*s,0),h=a.applyMatrix3(e),l=o.applyMatrix3(e),c=y.set(h.x,l.x,0,h.y,l.y,0,0,0,1),d=v.copy(c).invert(),p=x.copy(d).transpose().multiply(d).elements,f=function(t,e,i){let n,s,r,a,o;const h=t+i,l=t-i,u=Math.sqrt(l*l+4*e*e);h>0?(n=.5*(h+u),o=1/n,s=t*o*i-e*o*e):h<0?s=.5*(h-u):(n=.5*u,s=-.5*u);r=l>0?l+u:l-u;Math.abs(r)>2*Math.abs(e)?(o=-2*e/r,a=1/Math.sqrt(1+o*o),r=o*a):0===Math.abs(e)?(r=1,a=0):(o=-.5*r/e,r=1/Math.sqrt(1+o*o),a=o*r);l>0&&(o=r,r=-a,a=o);return{rt1:n,rt2:s,cs:r,sn:a}}(p[0],p[1],p[4]),m=Math.sqrt(f.rt1),g=Math.sqrt(f.rt2);t.xRadius=1/m,t.yRadius=1/g,t.aRotation=Math.atan2(f.sn,f.cs);if(!((t.aEndAngle-t.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const i=v.set(m,0,0,0,g,0,0,0,1),n=x.set(f.cs,f.sn,0,-f.sn,f.cs,0,0,0,1),s=i.multiply(n).multiply(c),r=t=>{const{x:e,y:i}=new Au(Math.cos(t),Math.sin(t),0).applyMatrix3(s);return Math.atan2(i,e)};t.aStartAngle=r(t.aStartAngle),t.aEndAngle=r(t.aEndAngle),u(e)&&(t.aClockwise=!t.aClockwise)}}function s(t){const i=d(e),n=p(e);t.xRadius*=i,t.yRadius*=n;const s=i>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);t.aRotation+=s,u(e)&&(t.aStartAngle*=-1,t.aEndAngle*=-1,t.aClockwise=!t.aClockwise)}const r=t.subPaths;for(let t=0,a=r.length;t<a;t++){const a=r[t].curves;for(let t=0;t<a.length;t++){const r=a[t];r.isLineCurve?(i(r.v1),i(r.v2)):r.isCubicBezierCurve?(i(r.v0),i(r.v1),i(r.v2),i(r.v3)):r.isQuadraticBezierCurve?(i(r.v0),i(r.v1),i(r.v2)):r.isEllipseCurve&&(w.set(r.aX,r.aY),i(w),r.aX=w.x,r.aY=w.y,c(e)?n(r):s(r))}}}(E,S),f.push(E),E.userData={node:e,style:n});const M=e.childNodes;for(let e=0;e<M.length;e++){const i=M[e];h&&"style"!==i.nodeName&&"defs"!==i.nodeName||t(i,n)}o&&(g.pop(),g.length>0?S.copy(g[g.length-1]):S.identity())}(E.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4});return{paths:f,xml:E.documentElement}}static createShapes(t){const e=999999999,i=0,n=1,s=2,r=3,a=4,o=5,h=6,l={loc:i,t:0};function u(t,e,n,r){const a=t.x,o=e.x,h=n.x,u=r.x,d=t.y,p=e.y,f=n.y,m=r.y,g=(u-h)*(d-f)-(m-f)*(a-h),y=(m-f)*(o-a)-(u-h)*(p-d),v=g/y,x=((o-a)*(d-f)-(p-d)*(a-h))/y;if(0===y&&0!==g||v<=0||v>=1||x<0||x>1)return null;if(0===g&&0===y){for(let h=0;h<2;h++){if(c(0===h?n:r,t,e),l.loc==i){const t=0===h?n:r;return{x:t.x,y:t.y,t:l.t}}if(l.loc==s){return{x:+(a+l.t*(o-a)).toPrecision(10),y:+(d+l.t*(p-d)).toPrecision(10),t:l.t}}}return null}for(let s=0;s<2;s++)if(c(0===s?n:r,t,e),l.loc==i){const t=0===s?n:r;return{x:t.x,y:t.y,t:l.t}}return{x:+(a+v*(o-a)).toPrecision(10),y:+(d+v*(p-d)).toPrecision(10),t:v}}function c(t,e,u){const c=u.x-e.x,d=u.y-e.y,p=t.x-e.x,f=t.y-e.y,m=c*f-p*d;if(t.x===e.x&&t.y===e.y)return l.loc=i,void(l.t=0);if(t.x===u.x&&t.y===u.y)return l.loc=n,void(l.t=1);if(m<-Number.EPSILON)return void(l.loc=r);if(m>Number.EPSILON)return void(l.loc=a);if(c*p<0||d*f<0)return void(l.loc=o);if(Math.sqrt(c*c+d*d)<Math.sqrt(p*p+f*f))return void(l.loc=h);let g;g=0!==c?p/c:f/d,l.loc=s,l.t=g}function d(t,e,i){const n=new hu;e.getCenter(n);const s=[];return i.forEach((e=>{if(e.boundingBox.containsPoint(n)){(function(t,e){const i=[],n=[];for(let s=1;s<t.length;s++){const r=t[s-1],a=t[s];for(let t=1;t<e.length;t++){const s=u(r,a,e[t-1],e[t]);null!==s&&void 0===i.find((t=>t.t<=s.t+Number.EPSILON&&t.t>=s.t-Number.EPSILON))&&(i.push(s),n.push(new hu(s.x,s.y)))}}return n})(t,e.points).forEach((t=>{s.push({identifier:e.identifier,isCW:e.isCW,point:t})}))}})),s.sort(((t,e)=>t.point.x-e.point.x)),s}let p=e,f=-999999999,m=t.subPaths.map((t=>{const i=t.getPoints();let n=-999999999,s=e,r=-999999999,a=e;for(let t=0;t<i.length;t++){const e=i[t];e.y>n&&(n=e.y),e.y<s&&(s=e.y),e.x>r&&(r=e.x),e.x<a&&(a=e.x)}return f<=r&&(f=r+1),p>=a&&(p=a-1),{curves:t.curves,points:i,isCW:kd.isClockWise(i),identifier:-1,boundingBox:new jd(new hu(a,s),new hu(r,n))}}));m=m.filter((t=>t.points.length>1));for(let t=0;t<m.length;t++)m[t].identifier=t;const g=m.map((e=>function(t,e,i,n,s){null!=s&&""!==s||(s="nonzero");const r=new hu;t.boundingBox.getCenter(r);const a=d([new hu(i,r.y),new hu(n,r.y)],t.boundingBox,e);a.sort(((t,e)=>t.point.x-e.point.x));const o=[],h=[];a.forEach((e=>{e.identifier===t.identifier?o.push(e):h.push(e)}));const l=o[0].point.x,u=[];let c=0;for(;c<h.length&&h[c].point.x<l;)u.length>0&&u[u.length-1]===h[c].identifier?u.pop():u.push(h[c].identifier),c++;if(u.push(t.identifier),"evenodd"===s){const e=u.length%2==0,i=u[u.length-2];return{identifier:t.identifier,isHole:e,for:i}}if("nonzero"===s){let i=!0,n=null,s=null;for(let t=0;t<u.length;t++){const r=u[t];i?(s=e[r].isCW,i=!1,n=r):s!==e[r].isCW&&(s=e[r].isCW,i=!0)}return{identifier:t.identifier,isHole:i,for:n}}}(e,m,p,f,t.userData?t.userData.style.fillRule:void 0))),y=[];return m.forEach((t=>{if(!g[t.identifier].isHole){const e=new ad;e.curves=t.curves;g.filter((e=>e.isHole&&e.for===t.identifier)).forEach((t=>{const i=m[t.identifier],n=new rd;n.curves=i.curves,e.holes.push(n)})),y.push(e)}})),y}static getStrokeStyle(t,e,i,n,s){return{strokeColor:e=void 0!==e?e:"#000",strokeWidth:t=void 0!==t?t:1,strokeLineJoin:i=void 0!==i?i:"miter",strokeLineCap:n=void 0!==n?n:"butt",strokeMiterLimit:s=void 0!==s?s:4}}static pointsToStroke(t,e,i,n){const s=[],r=[],a=[];if(0===$d.pointsToStrokeWithBuffers(t,e,i,n,s,r,a))return null;const o=new Uc;return o.setAttribute("position",new kc(s,3)),o.setAttribute("normal",new kc(r,3)),o.setAttribute("uv",new kc(a,2)),o}static pointsToStrokeWithBuffers(t,e,i,n,s,r,a,o){const h=new hu,l=new hu,u=new hu,c=new hu,d=new hu,p=new hu,f=new hu,m=new hu,g=new hu,y=new hu,v=new hu,x=new hu,b=new hu,w=new hu,_=new hu,S=new hu,E=new hu;i=void 0!==i?i:12,n=void 0!==n?n:.001,o=void 0!==o?o:0;const M=(t=function(t){let e=!1;for(let i=1,s=t.length-1;i<s;i++)if(t[i].distanceTo(t[i+1])<n){e=!0;break}if(!e)return t;const i=[];i.push(t[0]);for(let e=1,s=t.length-1;e<s;e++)t[e].distanceTo(t[e+1])>=n&&i.push(t[e]);return i.push(t[t.length-1]),i}(t)).length;if(M<2)return 0;const A=t[0].equals(t[M-1]);let T,C,I=t[0];const D=e.strokeWidth/2,L=1/(M-1);let B,P,k,N,O=0,R=!1,z=0,H=3*o,W=2*o;F(t[0],t[1],h).multiplyScalar(D),m.copy(t[0]).sub(h),g.copy(t[0]).add(h),y.copy(m),v.copy(g);for(let i=1;i<M;i++){T=t[i],C=i===M-1?A?t[1]:void 0:t[i+1];const n=h;if(F(I,T,n),u.copy(n).multiplyScalar(D),x.copy(T).sub(u),b.copy(T).add(u),B=O+L,P=!1,void 0!==C){F(T,C,l),u.copy(l).multiplyScalar(D),w.copy(T).sub(u),_.copy(T).add(u),k=!0,u.subVectors(C,I),n.dot(u)<0&&(k=!1),1===i&&(R=k),u.subVectors(C,T),u.normalize();const t=Math.abs(n.dot(u));if(t>Number.EPSILON){const i=D/t;u.multiplyScalar(-i),c.subVectors(T,I),d.copy(c).setLength(i).add(u),S.copy(d).negate();const n=d.length(),s=c.length();c.divideScalar(s),p.subVectors(C,T);const r=p.length();switch(p.divideScalar(r),c.dot(S)<s&&p.dot(S)<r&&(P=!0),E.copy(d).add(T),S.add(T),N=!1,P?k?(_.copy(S),b.copy(S)):(w.copy(S),x.copy(S)):q(),e.strokeLineJoin){case"bevel":j(k,P,B);break;case"round":Y(k,P),k?V(T,x,w,B,0):V(T,_,b,B,1);break;default:const t=D*e.strokeMiterLimit/n;if(t<1){if("miter-clip"!==e.strokeLineJoin){j(k,P,B);break}Y(k,P),k?(p.subVectors(E,x).multiplyScalar(t).add(x),f.subVectors(E,w).multiplyScalar(t).add(w),U(x,B,0),U(p,B,0),U(T,B,.5),U(T,B,.5),U(p,B,0),U(f,B,0),U(T,B,.5),U(f,B,0),U(w,B,0)):(p.subVectors(E,b).multiplyScalar(t).add(b),f.subVectors(E,_).multiplyScalar(t).add(_),U(b,B,1),U(p,B,1),U(T,B,.5),U(T,B,.5),U(p,B,1),U(f,B,1),U(T,B,.5),U(f,B,1),U(_,B,1))}else P?(k?(U(g,O,1),U(m,O,0),U(E,B,0),U(g,O,1),U(E,B,0),U(S,B,1)):(U(g,O,1),U(m,O,0),U(E,B,1),U(m,O,0),U(S,B,0),U(E,B,1)),k?w.copy(E):_.copy(E)):k?(U(x,B,0),U(E,B,0),U(T,B,.5),U(T,B,.5),U(E,B,0),U(w,B,0)):(U(b,B,1),U(E,B,1),U(T,B,.5),U(T,B,.5),U(E,B,1),U(_,B,1)),N=!0}}else q()}else q();A||i!==M-1||G(t[0],y,v,k,!0,O),O=B,I=T,m.copy(w),g.copy(_)}if(A){if(P&&s){let t=E,e=S;R!==k&&(t=S,e=E),k?(N||R)&&(e.toArray(s,0),e.toArray(s,9),N&&t.toArray(s,3)):!N&&R||(e.toArray(s,3),e.toArray(s,9),N&&t.toArray(s,0))}}else G(T,x,b,k,!1,B);return z;function F(t,e,i){return i.subVectors(e,t),i.set(-i.y,i.x).normalize()}function U(t,e,i){s&&(s[H]=t.x,s[H+1]=t.y,s[H+2]=0,r&&(r[H]=0,r[H+1]=0,r[H+2]=1),H+=3,a&&(a[W]=e,a[W+1]=i,W+=2)),z+=3}function V(t,e,n,s,r){h.copy(e).sub(t).normalize(),l.copy(n).sub(t).normalize();let a=Math.PI;const o=h.dot(l);Math.abs(o)<1&&(a=Math.abs(Math.acos(o))),a/=i,u.copy(e);for(let e=0,n=i-1;e<n;e++)c.copy(u).rotateAround(t,a),U(u,s,r),U(c,s,r),U(t,s,.5),u.copy(c);U(c,s,r),U(n,s,r),U(t,s,.5)}function q(){U(g,O,1),U(m,O,0),U(x,B,0),U(g,O,1),U(x,B,0),U(b,B,1)}function j(t,e,i){e?t?(U(g,O,1),U(m,O,0),U(x,B,0),U(g,O,1),U(x,B,0),U(S,B,1),U(x,i,0),U(w,i,0),U(S,i,.5)):(U(g,O,1),U(m,O,0),U(b,B,1),U(m,O,0),U(S,B,0),U(b,B,1),U(b,i,1),U(S,i,0),U(_,i,1)):t?(U(x,i,0),U(w,i,0),U(T,i,.5)):(U(b,i,1),U(_,i,0),U(T,i,.5))}function Y(t,e){e&&(t?(U(g,O,1),U(m,O,0),U(x,B,0),U(g,O,1),U(x,B,0),U(S,B,1),U(x,O,0),U(T,B,.5),U(S,B,1),U(T,B,.5),U(w,O,0),U(S,B,1)):(U(g,O,1),U(m,O,0),U(b,B,1),U(m,O,0),U(S,B,0),U(b,B,1),U(b,O,1),U(S,B,0),U(T,B,.5),U(T,B,.5),U(S,B,0),U(_,O,1)))}function G(t,i,n,r,o,d){switch(e.strokeLineCap){case"round":o?V(t,n,i,d,.5):V(t,i,n,d,.5);break;case"square":if(o)h.subVectors(i,t),l.set(h.y,-h.x),u.addVectors(h,l).add(t),c.subVectors(l,h).add(t),r?(u.toArray(s,3),c.toArray(s,0),c.toArray(s,9)):(u.toArray(s,3),1===a[7]?c.toArray(s,9):u.toArray(s,9),c.toArray(s,0));else{h.subVectors(n,t),l.set(h.y,-h.x),u.addVectors(h,l).add(t),c.subVectors(l,h).add(t);const e=s.length;r?(u.toArray(s,e-3),c.toArray(s,e-6),c.toArray(s,e-12)):(c.toArray(s,e-6),u.toArray(s,e-3),c.toArray(s,e-12))}}}}}class Xd extends Au{constructor(t,e,i){super(t,e,i)}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}floorToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this.z=this.z<0?Math.floor(this.z):Math.ceil(this.z),this}roundToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this.z=this.z<0?Math.floor(this.z):Math.ceil(this.z),this}toString(){return`{x: ${this.x}, y: ${this.y}}`}}class Zd extends $d{constructor(t=void 0){super(t),c(this,"viewportElement"),c(this,"instancedMesh",!1),c(this,"dpr",1)}setRequestHeader(t){return this.requestHeader=t,this}setInstancedMesh(t=!1){return this.instancedMesh=t,this}setPixelRatio(t){return this.dpr=t,this}parse(t,e=!0){const i=this;function n(t,e,i,n,r,a,o,h){var l;if(0==e||0==i)return void t.lineTo(h.x,h.y);n=n*Math.PI/180,e=Math.abs(e),i=Math.abs(i);const u=(o.x-h.x)/2,c=(o.y-h.y)/2,d=Math.cos(n)*u+Math.sin(n)*c,p=-Math.sin(n)*u+Math.cos(n)*c;let f=e*e,m=i*i;const g=d*d,y=p*p,v=g/f+y/m;if(v>1){const t=Math.sqrt(v);f=(e*=t)*e,m=(i*=t)*i}const x=f*y+m*g,b=(f*m-x)/x;let w=Math.sqrt(Math.max(0,b));r===a&&(w=-w);const _=w*e*p/i,S=-w*i*d/e,E=Math.cos(n)*_-Math.sin(n)*S+(o.x+h.x)/2,M=Math.sin(n)*_+Math.cos(n)*S+(o.y+h.y)/2,A=s(1,0,(d-_)/e,(p-S)/i),T=s((d-_)/e,(p-S)/i,(-d-_)/e,(-p-S)/i)%(2*Math.PI);null==(l=t.currentPath)||l.absellipse(E,M,e,i,A,A+T,0===a,n)}function s(t,e,i,n){const s=t*i+e*n,r=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+n*n);let a=Math.acos(Math.max(-1,Math.min(1,s/r)));return t*n-e*i<0&&(a=-a),a}function r(t,e){var i;e=Object.assign({},e);let n={};if(t.hasAttribute("class")){const e=null==(i=t.getAttribute("class"))?void 0:i.split(/\s/).filter(Boolean).map((t=>t.trim()));for(let t=0,i=(null==e?void 0:e.length)||0;t<i;t++)n=Object.assign(n,A["."+e[t]])}function s(i,s,r){void 0===r&&(r=function(t){return t.startsWith("url"),t}),t.hasAttribute(i)&&(e[s]=r(t.getAttribute(i))),n[i]&&(e[s]=r(n[i])),t.style&&""!==t.style[i]&&(e[s]=r(t.style[i]))}t.hasAttribute("id")&&(n=Object.assign(n,A["#"+t.getAttribute("id")]));const{fontSize:r,strokeWidth:a}=e;function o(t){return Math.max(0,Math.min(1,c(t)))}function h(t){return Math.max(0,c(t,{fontSize:r}))}s("font-size","fontSize",h),s("fill","fill"),s("fill-opacity","fillOpacity",o),s("fill-rule","fillRule"),s("opacity","opacity",o),s("stroke","stroke"),s("stroke-opacity","strokeOpacity",o),s("stroke-width","strokeWidth",(function(t){return Math.max(0,c(t,{}))})),s("stroke-linejoin","strokeLineJoin"),s("stroke-linecap","strokeLineCap"),s("stroke-miterlimit","strokeMiterLimit",h),s("visibility","visibility");const l=t.getAttribute("stroke-width")||e.strokeWidth;return ri.endsWith(l,"%")&&(e.thinLine=!0),e}function a(t,e){return t-(e-t)}function o(t,e,i){if("string"!=typeof t)throw new TypeError("Invalid input: "+typeof t);const n={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let s=0,r=!0,a="",o="";const h=[];function l(t,e,i){const n=new SyntaxError('Unexpected character "'+t+'" at index '+e+".");throw n.partial=i,n}function u(){""!==a&&(""===o?h.push(Number(a)):h.push(Number(a)*Math.pow(10,Number(o)))),a="",o=""}let c;const d=t.length;for(let p=0;p<d;p++)if(c=t[p],Array.isArray(e)&&e.includes(h.length%(i||0))&&n.FLAGS.test(c))s=1,a=c,u();else{if(0===s){if(n.WHITESPACE.test(c))continue;if(n.DIGIT.test(c)||n.SIGN.test(c)){s=1,a=c;continue}if(n.POINT.test(c)){s=2,a=c;continue}n.COMMA.test(c)&&(r&&l(c,p,h),r=!0)}if(1===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.POINT.test(c)){a+=c,s=2;continue}if(n.EXP.test(c)){s=3;continue}n.SIGN.test(c)&&1===a.length&&n.SIGN.test(a[0])&&l(c,p,h)}if(2===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.EXP.test(c)){s=3;continue}n.POINT.test(c)&&"."===a[a.length-1]&&l(c,p,h)}if(3===s){if(n.DIGIT.test(c)){o+=c;continue}if(n.SIGN.test(c)){if(""===o){o+=c;continue}1===o.length&&n.SIGN.test(o)&&l(c,p,h)}}n.WHITESPACE.test(c)?(u(),s=0,r=!1):n.COMMA.test(c)?(u(),s=0,r=!0):n.SIGN.test(c)?(u(),s=1,a=c):n.POINT.test(c)?(u(),s=2,a=c):l(c,p,h)}return u(),h}const h=["mm","cm","in","pt","pc","px","em","%"],u={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1},"%":{"%":1,px:-1}};function c(t,e){let n,s="px";if("string"==typeof t||t instanceof String){t=null==t?void 0:t.trim();for(let e=0,i=h.length;e<i;e++){const i=h[e];if(t.endsWith(i)){s=i,t=t.substring(0,t.length-i.length);break}}}if("px"===s&&"px"!==i.defaultUnit)n=u.in[i.defaultUnit]/i.defaultDPI;else if("%"===s){z.getSize(Kd),Qd.copy(k).getScale(tp);const t=Math.abs(tp.x||1);n=Kd.x/100*t}else"em"===s?n=(null==e?void 0:e.fontSize)||F:(n=u[s][i.defaultUnit],n<0&&(n=u[s].in*i.defaultDPI));return n*parseFloat(t)}function d(t){const e=t.elements;return e[0]*e[4]-e[1]*e[3]<0}function p(t){const e=t.elements,i=e[0]*e[3]+e[1]*e[4];if(0===i)return!1;const n=f(t),s=m(t);return Math.abs(i/(n*s))>Number.EPSILON}function f(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function m(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function g(t){return Math.round(t*W*100)/100}function y(t){return Math.round(t*W*100)/100}function v(t){return Math.round(t*W*100)/100}function x(t){return Math.round(t*W*100)/100}function b(t,e="asset"){let i;const n="function"==typeof t.getAttribute?t.getAttribute("id"):"";if(!n&&t.parentNode)return b(t.parentNode,e);if(!n)return i;if("layer"===e)i=X.find((t=>n===t));else{const t=null==n?void 0:n.replace(/-assets/g,"");i=$.find((e=>t===e))}return!i&&t.parentNode&&(i=b(t.parentNode,e)),i}function w(t){let e;const i="function"==typeof t.getAttribute?t.getAttribute("id"):"";return e=!i&&t.parentNode?w(t.parentNode):i,e}function _(t,e){let i;const n=w(t);return i=t.parentNode&&w(t.parentNode),i&&n!==e||(i=_(t.parentNode,e)),i||(n||"")}function S(t){let e;return w(t),e="function"==typeof t.getAttribute?t.getAttribute("aid"):"",!e&&t.parentNode&&(e=S(t.parentNode)),e}const E=[],M=[],A={},T=[],C=new lu,I=new lu,D=new lu,L=new lu,B=new hu,P=new Au,k=new lu,N={},O={},R=[],z=new ai,H=new We,W=1,F=16,U=(new DOMParser).parseFromString(t,"image/svg+xml");i.viewportElement=U.documentElement;!function(t,e=new ai){if(!t)return e;let i=t.split(" "),n=ri.map(i,(t=>parseFloat(t)));4!==(null==n?void 0:n.length)||(e.min.set(n[0],n[1]),e.max.set(n[0]+n[2],n[1]+n[3]))}(i.viewportElement.getAttribute("viewBox")||"",z);const V=U.getElementsByTagName("view"),q=(null==V?void 0:V.length)?V[0]:null,j=(null==q?void 0:q.getAttribute("units"))||"";z.getCenter(H);const Y=rn(U.documentElement);let G=[];an(Y||[],(t=>{var e;if("assets"===t.label&&(null==(e=t.children)?void 0:e.length))for(let e,i=0,n=t.children.length;i<n;i++)e=t.children[i],e.label&&G.push(ri.head(ri.split(e.label,"-"))||"")})),G=ri.uniq(ri.compact(G));const $=ri.uniq(ri.compact([...G,...Object.values(Li)])),X=Object.values(Pi);!function t(e,i,s,h=!1){var u;if(1!==e.nodeType)return;const N=function(t,e){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))||"text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))))return null;const i=function(t,e){var i;const n=new lu,s=C;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){let e=c(t.getAttribute("x")),i=c(t.getAttribute("y"));n.translate(e,i)}else if("text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))){let i=0,s=0;i=t.hasAttribute("dx")?c(t.getAttribute("dx")||0,{fontSize:null==e?void 0:e.fontSize}):0,s=t.hasAttribute("dy")?c(t.getAttribute("dy")||0,{fontSize:null==e?void 0:e.fontSize}):0,n.translate(i,s)}if(t.hasAttribute("transform")){const e=null==(i=t.getAttribute("transform"))?void 0:i.split(")");for(let t=((null==e?void 0:e.length)||0)-1;t>=0;t--){const i=e[t].trim();if(""===i)continue;const r=i.indexOf("("),a=i.length;if(r>0&&r<a){const t=i.slice(0,r),e=o(i.slice(r+1));switch(s.identity(),t){case"translate":if(e.length>=1){const t=e[0];let i=0;e.length>=2&&(i=e[1]),s.translate(t,i)}break;case"rotate":if(e.length>=1){let t=0,i=0,n=0;t=e[0]*Math.PI/180,e.length>=3&&(i=e[1],n=e[2]),I.makeTranslation(-i,-n),D.makeRotation(t),L.multiplyMatrices(D,I),I.makeTranslation(i,n),s.multiplyMatrices(I,L)}break;case"scale":if(e.length>=1){const t=e[0];let i=t;e.length>=2&&(i=e[1]),s.scale(t,i)}break;case"skewX":1===e.length&&s.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&s.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&s.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}n.premultiply(s)}}return n}(t,e);T.length>0&&i.premultiply(T[T.length-1]);return k.copy(i),T.push(i),i}(e,i);let R=!1,z=null,H=[];const W="function"==typeof e.getAttribute?e.getAttribute("id"):null;switch(e.nodeName){case"svg":case"g":i=r(e,i);break;case"style":!function(t){const e=t.textContent,i=null==e?void 0:e.replace(/\/\*[\s\S]*?\*\//g,""),n=null==i?void 0:i.replace(/([^;])}/g,"$1;}");if(!n)return;const s=[];let r="",a=0;for(const t of n)"{"===t?a++:"}"===t&&a--,r+=t,"}"===t&&0===a&&(s.push(r.trim()),r="");for(const t of s){if(!t.includes("{"))continue;const[e,i]=t.split(/\s*\{\s*/);if(!e||!i)continue;const n=e.split(",").map((t=>t.trim())).filter(Boolean),s={};i.replace(/}\s*$/,"").split(";").map((t=>t.trim())).filter(Boolean).forEach((t=>{const[e,i]=t.split(/:\s*/);if(e&&i){const t=i.replace(/\s*!important\s*$/,"").trim();s[e.trim()]=t}})),n.forEach((t=>{t&&(A[t]=l(l({},A[t]||{}),s))}))}}(e);break;case"path":i=r(e,i),e.hasAttribute("d")&&(z=function(t,e=!1){const i=new Yd,s=new We,r=new We,h=new We;let l=!0,u=!1;const c=t.getAttribute("d");if(!c||""===c||"none"===c)return null;const d=c.match(/[a-df-z][^a-df-z]*/gi);if(!(null==d?void 0:d.length))return null;for(let t=0,c=(null==d?void 0:d.length)||0;t<c;t++){const c=d[t],p=c.charAt(0),f=c.slice(1).trim();let m;switch(!0===l&&(u=!0,l=!1),p){case"M":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x=e?m[t]:g(m[t]),s.y=e?m[t+1]:y(m[t+1]),r.x=s.x,r.y=s.y,0===t?i.moveTo(s.x,s.y):i.lineTo(s.x,s.y),0===t&&h.copy(s);break;case"H":m=o(f);for(let t=0,n=m.length;t<n;t++)s.x=e?m[t]:g(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"V":m=o(f);for(let t=0,n=m.length;t<n;t++)s.y=e?m[t]:y(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"L":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x=e?m[t]:g(m[t]),s.y=e?m[t+1]:y(m[t+1]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"C":m=o(f);for(let t,n=0,a=m.length;n<a;n+=6)t=e?[m[n],m[n+1],m[n+2],m[n+3],m[n+4],m[n+5]]:[g(m[n]),y(m[n+1]),g(m[n+2]),y(m[n+3]),g(m[n+4]),y(m[n+5])],i.bezierCurveTo(...t),r.x=t[2],r.y=t[3],s.x=t[4],s.y=t[5],0===n&&!0===u&&h.copy(s);break;case"S":m=o(f);for(let t,n=0,o=m.length;n<o;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[g(m[n]),y(m[n+1]),g(m[n+2]),y(m[n+3])],i.bezierCurveTo(a(s.x,r.x),a(s.y,r.y),t[0],t[1],t[2],t[3]),r.x=t[0],r.y=t[1],s.x=t[2],s.y=t[3],0===n&&!0===u&&h.copy(s);break;case"Q":m=o(f);for(let t,n=0,a=m.length;n<a;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[g(m[n]),y(m[n+1]),g(m[n+2]),y(m[n+3])],i.quadraticCurveTo(t[0],t[1],t[2],t[3]),r.x=t[0],r.y=t[1],s.x=t[2],s.y=t[3],0===n&&!0===u&&h.copy(s);break;case"T":m=o(f);for(let t,n=0,o=m.length;n<o;n+=2){const o=a(s.x,r.x),l=a(s.y,r.y);t=e?[m[n],m[n+1]]:[g(m[n]),y(m[n+1])],i.quadraticCurveTo(o,l,t[0],t[1]),r.x=o,r.y=l,s.x=t[0],s.y=t[1],0===n&&!0===u&&h.copy(s)}break;case"A":m=o(f,[3,4],7);for(let t,a=0,o=m.length;a<o;a+=7){if(t=e?[m[a],m[a+1],m[a+2],m[a+3],m[a+4],m[a+5],m[a+6]]:[g(m[a]),y(m[a+1]),m[a+2],m[a+3],m[a+4],v(m[a+5]),x(m[a+6])],t[5]==s.x&&t[6]==s.y)continue;const o=s.clone();s.x=t[5],s.y=t[6],r.x=s.x,r.y=s.y,n(i,t[a],t[1],t[2],t[3],t[4],o,s),0===a&&!0===u&&h.copy(s)}break;case"m":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x+=e?m[t]:v(m[t]),s.y+=e?m[t+1]:x(m[t+1]),r.x=s.x,r.y=s.y,0===t?i.moveTo(s.x,s.y):i.lineTo(s.x,s.y),0===t&&h.copy(s);break;case"h":m=o(f);for(let t=0,n=m.length;t<n;t++)s.x+=e?m[t]:v(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"v":m=o(f);for(let t=0,n=m.length;t<n;t++)s.y+=e?m[t]:x(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"l":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x+=e?m[t]:v(m[t]),s.y+=e?m[t+1]:x(m[t+1]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"c":m=o(f);for(let t,n=0,a=m.length;n<a;n+=6)t=e?[m[n],m[n+1],m[n+2],m[n+3],m[n+4],m[n+5]]:[v(m[n]),x(m[n+1]),v(m[n+2]),x(m[n+3]),v(m[n+4]),x(m[n+5])],i.bezierCurveTo(s.x+t[0],s.y+t[1],s.x+t[2],s.y+t[3],s.x+t[4],s.y+t[5]),r.x=s.x+t[2],r.y=s.y+t[3],s.x+=t[4],s.y+=t[5],0===n&&!0===u&&h.copy(s);break;case"s":m=o(f);for(let t,n=0,o=m.length;n<o;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[v(m[n]),x(m[n+1]),v(m[n+2]),x(m[n+3])],i.bezierCurveTo(a(s.x,r.x),a(s.y,r.y),s.x+t[0],s.y+t[1],s.x+t[2],s.y+t[3]),r.x=s.x+t[0],r.y=s.y+t[1],s.x+=t[2],s.y+=t[3],0===n&&!0===u&&h.copy(s);break;case"q":m=o(f);for(let t,n=0,a=m.length;n<a;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[v(m[n]),x(m[n+1]),v(m[n+2]),x(m[n+3])],i.quadraticCurveTo(s.x+t[0],s.y+t[1],s.x+t[2],s.y+t[3]),r.x=s.x+t[0],r.y=s.y+t[1],s.x+=t[2],s.y+=t[3],0===n&&!0===u&&h.copy(s);break;case"t":m=o(f);for(let t,n=0,o=m.length;n<o;n+=2){const o=a(s.x,r.x),l=a(s.y,r.y);t=e?[m[n],m[n+1]]:[v(m[n]),x(m[n+1])],i.quadraticCurveTo(o,l,s.x+t[0],s.y+t[1]),r.x=o,r.y=l,s.x=s.x+t[0],s.y=s.y+t[1],0===n&&!0===u&&h.copy(s)}break;case"a":m=o(f,[3,4],7);for(let t,a=0,o=m.length;a<o;a+=7){if(t=e?[m[a],m[a+1],m[a+2],m[a+3],m[a+4],m[a+5],m[a+6]]:[v(m[a]),x(m[a+1]),m[a+2],m[a+3],m[a+4],v(m[a+5]),x(m[a+6])],0==t[5]&&0==t[6])continue;const o=s.clone();s.x+=t[5],s.y+=t[6],r.x=s.x,r.y=s.y,n(i,t[0],t[1],t[2],t[3],t[4],o,s),0===a&&!0===u&&h.copy(s)}break;case"Z":case"z":i.currentPath.autoClose=!0,i.currentPath.curves.length>0&&(s.copy(h),i.currentPath.currentPoint.copy(s),l=!0)}u=!1}return i}(e,h));break;case"rect":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("x")||0),n=c(t.getAttribute("y")||0),s=c(t.getAttribute("rx")||t.getAttribute("ry")||0),r=c(t.getAttribute("ry")||t.getAttribute("rx")||0),a=c(t.getAttribute("width")),o=c(t.getAttribute("height"));e||(i=g(i),n=y(n),s=v(s),r=x(r),a=v(a),o=x(o));const h=.448084975506,l=new Yd;l.moveTo(i+s,n),l.lineTo(i+a-s,n),(0!==s||0!==r)&&l.bezierCurveTo(i+a-s*h,n,i+a,n+r*h,i+a,n+r);l.lineTo(i+a,n+o-r),(0!==s||0!==r)&&l.bezierCurveTo(i+a,n+o-r*h,i+a-s*h,n+o,i+a-s,n+o);l.lineTo(i+s,n+o),(0!==s||0!==r)&&l.bezierCurveTo(i+s*h,n+o,i,n+o-r*h,i,n+o-r);l.lineTo(i,n+r),(0!==s||0!==r)&&l.bezierCurveTo(i,n+r*h,i+s*h,n,i+s,n);return l}(e,h);break;case"polygon":i=r(e,i),z=function(t,e=!1){var i;function n(t,i,n){const s=e?c(i):g(c(i)),o=e?c(n):y(c(n));return 0===a?r.moveTo(s,o):r.lineTo(s,o),a++,t}const s=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,r=new Yd;let a=0;return null==(i=t.getAttribute("points"))||i.replace(s,n),r.currentPath.autoClose=!0,r}(e,h);break;case"polyline":i=r(e,i),z=function(t,e=!1){var i;function n(t,i,n){const s=e?c(i):g(c(i)),o=e?c(n):y(c(n));return 0===a?r.moveTo(s,o):r.lineTo(s,o),a++,t}const s=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,r=new Yd;let a=0;return null==(i=t.getAttribute("points"))||i.replace(s,n),r.currentPath.autoClose=!1,r}(e,h);break;case"circle":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),s=c(t.getAttribute("r")||0);e||(i=g(i),n=y(n),s=v(s));const r=new rd;r.absarc(i,n,s,0,2*Math.PI);const a=new Yd;return a.subPaths.push(r),a}(e,h);break;case"ellipse":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),s=c(t.getAttribute("rx")||0),r=c(t.getAttribute("ry")||0);e||(i=g(i),n=y(n),s=v(s),r=x(r));const a=new rd;a.absellipse(i,n,s,r,0,2*Math.PI);const o=new Yd;return o.subPaths.push(a),o}(e,h);break;case"line":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("x1")||0),n=c(t.getAttribute("y1")||0),s=c(t.getAttribute("x2")||0),r=c(t.getAttribute("y2")||0);e||(i=g(i),n=y(n),s=g(s),r=y(r));const a=new Yd;return a.moveTo(i,n),a.lineTo(s,r),a.currentPath.autoClose=!1,a}(e,h);break;case"defs":R=!0;break;case"use":const u=(e.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),d=O[u];d&&(i=r(e,i),void 0===(i=r(d,i)).assetType&&(i.assetType=b(e)),void 0===i.layerType&&(i.layerType=b(e,"layer")),t(d,i,W||s,h));break;case"text":i=r(e,i),z=function(t,e){parseFloat(t.getAttribute("x")||"0"),parseFloat(t.getAttribute("y")||"0");const i=t.textContent;if(!i||!e.fontSize)return;const n=Object.assign({},e);return n.fill=t.getAttribute("fill")||e.fill||"#000",n.fontSize=parseFloat(t.getAttribute("font-size")||e.fontSize||"72"),n.fontFamily=t.getAttribute("font-family")||e.fontFamily||"Arial",{type:"text",textContent:i,style:n,color:new Ac,subPaths:[],userData:{}}}(e,i,h)}if(z){void 0!==i.fill&&"transparent"===i.fill||void 0!==i.fill&&"none"!==i.fill&&z.color.setStyle(i.fill,Jd);const t=i.assetType||b(e),n=i.layerType||b(e,"layer");if(z.userData={pid:s,id:W||s,nodeName:e.nodeName,layerType:n,assetType:t,style:i},"text"===e.nodeName){s||ri.set(z,"userData.pid",w(e)),z.userData.textContent=e.textContent,z.transform=ri.cloneDeep(k),z.userData.id=ri.get(z,"userData.pid"),ri.set(z,"userData.pid",_(e,s));const t=S(e);t?ri.set(z,"userData.aid",t):ri.set(z,"userData.aid",ri.split(null==(u=z.userData)?void 0:u.id,"-").splice(2).join("-")),E.find((t=>t.userData.id===z.userData.aid))}else!function(t,e){function i(t){P.set(t.x,t.y,1).applyMatrix3(e),t.set(P.x,P.y)}function n(t){const i=t.xRadius,n=t.yRadius,s=Math.cos(t.aRotation),r=Math.sin(t.aRotation),a=new Xd(i*s,i*r,0),o=new Xd(-n*r,n*s,0),h=a.applyMatrix3(e),l=o.applyMatrix3(e),u=C.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=I.copy(u).invert(),p=D.copy(c).transpose().multiply(c).elements,f=function(t,e,i){let n,s,r,a,o;const h=t+i,l=t-i,u=Math.sqrt(l*l+4*e*e);h>0?(n=.5*(h+u),o=1/n,s=t*o*i-e*o*e):h<0?s=.5*(h-u):(n=.5*u,s=-.5*u);r=l>0?l+u:l-u;Math.abs(r)>2*Math.abs(e)?(o=-2*e/r,a=1/Math.sqrt(1+o*o),r=o*a):0===Math.abs(e)?(r=1,a=0):(o=-.5*r/e,r=1/Math.sqrt(1+o*o),a=o*r);l>0&&(o=r,r=-a,a=o);return{rt1:n,rt2:s,cs:r,sn:a}}(p[0],p[1],p[4]),m=Math.sqrt(f.rt1),g=Math.sqrt(f.rt2);t.xRadius=1/m,t.yRadius=1/g,t.aRotation=Math.atan2(f.sn,f.cs);if(!((t.aEndAngle-t.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const i=I.set(m,0,0,0,g,0,0,0,1),n=D.set(f.cs,f.sn,0,-f.sn,f.cs,0,0,0,1),s=i.multiply(n).multiply(u),r=t=>{const{x:e,y:i}=new Xd(Math.cos(t),Math.sin(t),0).applyMatrix3(s);return Math.atan2(i,e)};t.aStartAngle=r(t.aStartAngle),t.aEndAngle=r(t.aEndAngle),d(e)&&(t.aClockwise=!t.aClockwise)}}function s(t){const i=f(e),n=m(e);t.xRadius*=i,t.yRadius*=n;const s=i>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);t.aRotation+=s,d(e)&&(t.aStartAngle*=-1,t.aEndAngle*=-1,t.aClockwise=!t.aClockwise)}const r=t.subPaths;for(let t=0,a=(null==r?void 0:r.length)||0;t<a;t++){const a=r[t].curves;for(let t=0;t<a.length;t++){const r=a[t];r.isLineCurve?(i(r.v1),i(r.v2)):r.isCubicBezierCurve?(i(r.v0),i(r.v1),i(r.v2),i(r.v3)):r.isQuadraticBezierCurve?(i(r.v0),i(r.v1),i(r.v2)):r.isEllipseCurve&&(B.set(r.aX,r.aY),i(B),r.aX=B.x,r.aY=B.y,p(e)?n(r):s(r))}}}(z,k);"text"!==e.nodeName?E.push(z):"text"===e.nodeName&&M.push(z)}const F=e.childNodes,U="symbol"===e.nodeName?s:W;for(let e=0,n=(null==F?void 0:F.length)||0;e<n;e++){const n=F[e];if(R){const t="function"==typeof n.getAttribute?n.getAttribute("id"):null;"symbol"===n.nodeName&&t&&(O[t]=n)}if(R&&"style"!==n.nodeName&&"defs"!==n.nodeName)continue;let s=t(n,i,U,h);s&&H.push(s)}return N&&(T.pop(),T.length>0?k.copy(T[T.length-1]):k.identity()),z||((null==H?void 0:H.length)?H:void 0)}(U.documentElement,{fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4,fontSize:F});for(let t in N)N[t].len=ri.sumBy(R,(e=>e.symbolId===t?1:0));R.forEach((t=>{var e;return t.len=null==(e=N[t.symbolId])?void 0:e.len}));return{xml:U.documentElement,viewBox:z,paths:E,labels:M,idsTree:Y,assetTypes:G,symbolsMap:N,uses:R,units:j}}}const Jd=Zl,Qd=new Ui;new lu,new class extends $u{constructor(t=1,e=0,i=0,n=0,s=0,r=1,a=0,o=0,h=0,l=0,u=1,c=0,d=0,p=0,f=0,m=1){super(t,e,i,n,s,r,a,o,h,l,u,c,d,p,f,m)}setByMatrix3(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[4]=i[3],e[8]=0,e[12]=i[6],e[1]=i[1],e[5]=i[4],e[9]=0,e[13]=i[7],e[2]=0,e[6]=0,e[10]=1,e[14]=0,e[3]=0,e[7]=0,e[11]=0,e[15]=1,this}getMatrix3Array(t=[]){const e=this.elements;return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[4],t[4]=e[5],t[5]=0,t[6]=e[12],t[7]=e[13],t[8]=1,t}};const Kd=new We,tp=new hu;new Xd,new Xd,new Xd,new Xd;class ep extends ms{constructor(t={}){super(t),c(this,"type","Group2"),c(this,"isGroup",!0),c(this,"versions",[]),c(this,"params"),c(this,"alignCenter",!1),c(this,"dynamically",!1),c(this,"usedCache",!1),c(this,"wireframe",!1),c(this,"showPoints",!1),this.params=t,void 0!==t.usedCache&&(this.usedCache=t.usedCache),void 0!==t.wireframe&&(this.wireframe=t.wireframe),void 0!==t.showPoints&&(this.showPoints=t.showPoints),void 0!==t.alignCenter&&(this.alignCenter=t.alignCenter),void 0!==t.dynamically&&(this.dynamically=t.dynamically)}destroy(){super.destroy(),this.boundingBox.makeEmpty()}clone(t=!0,e=!1){return new(0,this.constructor)(this.params).copy(this,t,e)}copy(t,e=!0,i=!1){return super.copy(t,e,i),this.params=t.params,this.alignCenter=t.alignCenter,this.dynamically=t.dynamically,this.usedCache=t.usedCache,this.wireframe=t.wireframe,this.showPoints=t.showPoints,this}composeWireframeGeometryPath(t){return this.traverse((e=>{e.isShape&&e.geometry&&e.geometry.path&&t.addPath(e.geometry.path)})),t}raycast(t,e=[]){var i;if(!this.boundingBox||this.boundingBox.isEmpty())return e;if(!this.boundingBoxWorld.containsPoint(t.worldCoords))return e;let n=[];for(let e=0,s=null==(i=this.children)?void 0:i.length;e<s;e++)this.children[e].raycast(t,n);return n.length&&e.push(this),e}}let ip=new WeakMap,np=-1;function sp(t){var e,i;const n=[];return"string"==typeof t.fill?n.push(t.fill):(null==(e=t.fill)?void 0:e.isColor)?n.push(t.fill.getHexString()):t.fill instanceof CanvasGradient||t.fill instanceof CanvasPattern?ip.has(t.fill)||ip.set(t.fill,"gradientPattern_"+ ++np):n.push(""),"string"==typeof t.stroke?n.push(t.stroke):(null==(i=t.stroke)?void 0:i.isColor)?n.push(t.stroke.getHexString()):t.stroke instanceof CanvasGradient||t.stroke instanceof CanvasPattern?ip.has(t.stroke)||ip.set(t.stroke,"gradientPattern_"+ ++np):n.push(""),n.push(void 0!==t.lineWidth?t.lineWidth.toString():""),n.push(void 0!==t.lineDash?t.lineDash.toString():""),n.push(void 0!==t.lineDashOffset?t.lineDashOffset.toString():""),n.push(void 0!==t.lineCap?t.lineCap.toString():""),n.push(void 0!==t.fillOpacity?t.fillOpacity.toString():""),n.push(void 0!==t.strokeOpacity?t.strokeOpacity.toString():""),n.push(void 0!==t.opacity?t.opacity.toString():""),t.isText&&(n.push(void 0!==t.text?t.text:""),n.push(void 0!==t.fontSize?t.fontSize.toString():"")),n.join("_")}class rp{constructor(t){c(this,"fill"),c(this,"stroke"),c(this,"lineWidth"),c(this,"lineDash"),c(this,"lineDashOffset"),c(this,"lineCap"),c(this,"lineJoin"),c(this,"fillOpacity"),c(this,"strokeOpacity"),c(this,"opacity"),c(this,"featureKey"),c(this,"map"),this.fill=null==t?void 0:t.fill,this.stroke=null==t?void 0:t.stroke,this.lineWidth=null==t?void 0:t.lineWidth,this.lineDash=null==t?void 0:t.lineDash,this.lineDashOffset=null==t?void 0:t.lineDashOffset,this.lineCap=(null==t?void 0:t.lineCap)||"round",this.lineJoin=(null==t?void 0:t.lineJoin)||"miter",void 0!==(null==t?void 0:t.fillOpacity)?this.fillOpacity=null==t?void 0:t.fillOpacity:this.fillOpacity=1,this.featureKey=sp(this)}}class ap extends jh{constructor(t){super(t),this._init(t)}buildPath(t,e,i){const n=this.percent;if(0===n)return;let{x1:s,y1:r,x2:a,y2:o}=e||this;s&&r&&a&&o&&(t.moveTo(s,r),n&&n<1&&(a=s*(1-n)+a*n,o=r*(1-n)+o*n),t.lineTo(a,o))}}class op extends ms{constructor(t=new ap,e=new rp,i){super(i),c(this,"name","Shape"),c(this,"isShape",!0),c(this,"geo"),c(this,"mtl"),c(this,"boundingBox",new ai),this.geo=t,this.mtl=e,(null==i?void 0:i.name)&&(this.name=i.name)}destroy(){super.destroy()}computeBoundingBox(){this.boundingBox.makeEmpty(),this.geo.computeBoundingBox(this.boundingBox);for(let t=0,e=this.children.length;t<e;t++)this.boundingBox.union(this.children[t].computeBoundingBox());return this.boundingBox}buildPath(t,e,i){this.geo.buildPath(t)}raycast(t,e=[]){var i,n;if(super.raycast(t,e),!this.boundingBox||this.boundingBox.isEmpty())return e;if(this.boundingBoxWorld.isEmpty()&&this.updateBoundingBox(),t.intersectType)up.copy(t.worldBox),(up.containsBox(this.boundingBoxWorld)||(null==(n=this.geo)?void 0:n.isBoxIntersectsPath(up.applyMatrix3(lp.copy(this.matrixWorld).invert()))))&&e.push(this);else{if(!this.boundingBoxWorld.containsPoint(t.worldCoords))return e;hp.copy(t.worldCoords).applyMatrix3(lp.copy(this.matrixWorld).invert()),this.composeNode?this.traverseSome((t=>t.geo.isPointInPath(hp)))&&e.push(this):(null==(i=this.geo)?void 0:i.isPointInPath(hp))&&e.push(this)}return e}clone(t=!0,e=!1){return new(0,this.constructor)(this.geo,this.mtl).copy(this,t,e)}copy(t,e=!0,i=!1){return super.copy(t,e,i),this.params=ri.merge(this.params,t),this.renderOrder=t.renderOrder,i?(this.geo=ri.cloneDeep(t.geo),this.mtl=ri.cloneDeep(t.mtl)):(this.geo=t.geo,this.mtl=t.mtl),this}}const hp=new We,lp=new Ui,up=new ai;class cp extends rp{constructor(t){super(t),c(this,"text"),c(this,"isText",!0),c(this,"fontFamily","Arial"),c(this,"fontSize",12),c(this,"fontStyle",mp),c(this,"fontWeight",mp),c(this,"fontVariant",mp),c(this,"textDecoration",""),c(this,"textAlign",dp),c(this,"verticalAlign",pp),c(this,"textBaseline",fp),c(this,"lineHeight",1),c(this,"letterSpacing",0),c(this,"wrap",gp),c(this,"ellipsis",!1),this.text=null==t?void 0:t.text,this.fill=(null==t?void 0:t.fill)||Le.black,this.fontFamily=(null==t?void 0:t.fontFamily)||"Arial",this.fontSize=(null==t?void 0:t.fontSize)||12,this.fontStyle=(null==t?void 0:t.fontStyle)||mp,this.fontWeight=(null==t?void 0:t.fontWeight)||mp,this.textAlign=(null==t?void 0:t.textAlign)||dp,this.textBaseline=(null==t?void 0:t.textBaseline)||fp,this.featureKey=sp(this)}}const dp="center",pp="top",fp="middle",mp="normal",gp="word";class yp{static hasCache(t){return void 0!==vp[t]}static setCache(t,e){vp[t]=e}static getCache(t){return vp[t]}static getCachedFeatureKeys(){return Object.keys(vp)}static getMtl(t,e){let i=sp(t);return e&&(i=`${e}_${i}`),this.hasCache(i)||(t.text?this.setCache(i,new cp(t)):this.setCache(i,new rp(t))),this.getCache(i)}}const vp={};class xp extends jh{constructor(t){super(t),this._init(t)}buildPath(t,e,i){if(0===this.percent)return;let{points:n}=e||this;if(n&&n.length&&!(n.length<2)){for(let e=0,i=n.length;e<i;e+=2)e?t.lineTo(n[e],n[e+1]):t.moveTo(n[e],n[e+1]);t.closePath()}}}class bp extends op{constructor(t={}){void 0===t.fontSize&&(t.fontSize=12),void 0===t.renderOrder&&(t.renderOrder=1),super(new xp(t),new cp(t)),c(this,"name","Text"),c(this,"isText",!0),c(this,"size",new We),t.wireframe&&(this.wireframe=!0)}computeBoundingBox(){var t;if(!(null==(t=this.mtl)?void 0:t.text))return this.boundingBox;this.updateMatrixWorld(!0),Pn.measureText2(this.mtl.text||"",this.mtl.fontSize,this.size);const e=[];return e.push(-this.size.x/2,-this.size.y/2),e.push(e[0],e[1]+this.size.y),e.push(e[2]+this.size.x,e[3]),e.push(e[3],e[1]),this.geo.setPoints(e),super.computeBoundingBox(),this.boundingBox}buildPath(t,e,i){this.wireframe&&this.geo.buildPath(t)}}class wp extends jh{constructor(t){super(t),this._init(t)}buildPath(t,e,i){let n,s,r,a,o,{x:h=0,y:l=0,w:u=0,h:c=0,r:d=0}=e||this;u<0&&(h+=u,u=-u),c<0&&(l+=c,c=-c),"number"==typeof d?n=s=r=a=d:d instanceof Array?1===d.length?n=s=r=a=d[0]:2===d.length?(n=r=d[0],s=a=d[1]):3===d.length?(n=d[0],s=a=d[1],r=d[2]):(n=d[0],s=d[1],r=d[2],a=d[3]):n=s=r=a=0,n+s>u&&(o=n+s,n*=u/o,s*=u/o),r+a>u&&(o=r+a,r*=u/o,a*=u/o),s+r>c&&(o=s+r,s*=c/o,r*=c/o),n+a>c&&(o=n+a,n*=c/o,a*=c/o),t.moveTo(h+n,l),t.lineTo(h+u-s,l),0!==s&&t.arc(h+u-s,l+s,s,-Math.PI/2,0),t.lineTo(h+u,l+c-r),0!==r&&t.arc(h+u-r,l+c-r,r,0,Math.PI/2),t.lineTo(h+a,l+c),0!==a&&t.arc(h+a,l+c-a,a,Math.PI/2,Math.PI),t.lineTo(h,l+n),0!==n&&t.arc(h+n,l+n,n,Math.PI,1.5*Math.PI)}}class _p extends op{constructor(t,e=new rp,i){super(new wp({x:0,y:0,width:1,height:1}),e,i),c(this,"name","SkinnedShape"),this.boundingBox.copy(t),this.geo.lineWidth=e.lineWidth,this.geo.thinLine=!0,Sp.copy(this.boundingBox),Ep.copy(Sp.min),Sp.getSize(Mp),this.geo.x=Ep.x,this.geo.y=Ep.y,this.geo.w=Mp.x,this.geo.h=Mp.y}computeBoundingBox(){return this.boundingBox}}const Sp=new ai,Ep=new We,Mp=new We;class Ap extends Fi{constructor(t={}){super(),c(this,"type","Object2"),c(this,"position",new We),c(this,"rotation",new We),c(this,"scaled",new We(1,1)),c(this,"flipY",!1),c(this,"matrix",new Ui),c(this,"matrixAutoUpdate",!1),void 0!==t.flipY&&(this.flipY=t.flipY),this.flipY&&this.setScale(1,-1)}setPosition(t){return this.position.set(t.x,t.y),this}setRotation(t){return this.rotation.set(t,t),this}setScale(t,e){return this.scaled.set(t,e),this}translate(t,e){return this.position.x+=t,this.position.y+=e,this}rotate(t){return this.rotation.x+=t,this}scale(t,e){return e?(this.scaled.x*=t,this.scaled.y*=e):this.scaled.multiplyScalar(t),this}applyMatrix3(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.rotation,this.scaled)}updateMatrix(){this.matrix.compose(this.position,this.rotation,this.scaled)}copy(t){return this.position.copy(t.position),this.rotation.copy(t.rotation),this.scaled.copy(t.scaled),this.flipY=t.flipY,this.matrix.copy(t.matrix),this.matrixAutoUpdate=t.matrixAutoUpdate,this}}class Tp extends Ap{constructor(t={}){void 0===t.flipY&&(t.flipY=!0),super(t),c(this,"isTexture",!0),c(this,"type","Texture"),c(this,"params"),c(this,"uuid",fs()),c(this,"image"),c(this,"userData",{}),this.params=t}destroy(){}dispose(){}clone(){return new this.constructor(this.params).copy(this)}copy(t){return super.copy(t),this.uuid=fs(),this.image=t.image,this.userData=ri.cloneDeep(t.userData),this}}class Cp{constructor(t,e){c(this,"bindingStates"),this.ctx=t,this.bindingStates=e}destroy(){}setCtx(t){return this.ctx=t,this}render(t){var e,i,n;if(this.ctx&&(Ip=this.ctx,Ip.save(),t.isText?this.renderText(Ip,t):t.isShape&&(Ip.beginPath(),this.setCtxTransform(Ip,t),this.bindingStyle(Ip,t),this.renderShape(Ip,t),this.renderLineDash(Ip,t)),t.isShape&&(null==(i=null==(e=t.mtl)?void 0:e.map)?void 0:i.image)&&this.renderShapeTexture(Ip,t),Ip.restore(),t.composeNode&&(null==(n=t.children)?void 0:n.length)))for(let e,i=0,n=t.children.length;i<n;i++)e=t.children[i],e.isShape&&this.render(e)}renderFill(t){var e;t.mtl.fill&&(null==(e=this.ctx)||e.fill())}renderStroke(t){var e;t.mtl.stroke&&(null==(e=this.ctx)||e.stroke())}renderText(t,e){if(!t)return;const{text:i,fill:n,stroke:s,fontSize:r,fontFamily:a,fontWeight:o,textAlign:h,textBaseline:l}=e.mtl;if(!i)return;e.modelViewMatrix.decompose(Lp,Bp,Pp);const u=(r||12)*Pp.x;t.font=`${o} ${u}px ${a}`,t.fillStyle=n||Le.black,h&&(t.textAlign=h),l&&(t.textBaseline=l);let c=Lp.y;if("middle"===l){const e=t.measureText(i);c+=(e.actualBoundingBoxAscent-e.actualBoundingBoxDescent)/2}t.fillText(i,Lp.x,c)}renderWireFrame(t){this.ctx&&(Op.copy(t.boundingBox).applyMatrix3(t.modelViewMatrix).getSize(zp),Rp.copy(Op.min),this.ctx.save(),this.ctx.beginPath(),this.ctx.lineWidth=1,this.ctx.strokeStyle=Le.red,this.ctx.setLineDash([5,10]),this.ctx.strokeRect(Rp.x,Rp.y,zp.x,zp.y),this.ctx.stroke(),this.ctx.restore())}renderMerged(t){this.ctx&&(Ip=this.ctx,Ip.save(),t.isShape&&(Ip.beginPath(),this.setCtxTransform(Ip,t),this.bindingStyle(Ip,t),this.renderShape(Ip,t)),Ip.restore())}setCtxTransform(t,e){const i=Dp.equals(e.modelViewMatrix);Dp.copy(e.modelViewMatrix),i||Dp.getComponents(kp),t.transform(...kp)}bindingStyle(t,e){if(e.mtl.fill){let i;i=e.mtl.fill.isColor?e.mtl.fill.getHexString():e.mtl.fill,void 0!==e.mtl.fillOpacity&&(t.globalAlpha=e.mtl.fillOpacity),i&&(t.fillStyle=i)}if(e.mtl.stroke){if(e.geo.thinLine){const e=Math.sqrt(kp[0]*kp[0]+kp[1]*kp[1]);t.lineWidth=Math.abs(1/e)}else e.geo.lineWidth?t.lineWidth=e.geo.lineWidth:t.lineWidth=1;let i;e.mtl.lineCap&&(t.lineCap=e.mtl.lineCap),e.mtl.lineJoin&&(t.lineJoin=e.mtl.lineJoin),void 0!==e.mtl.strokeOpacity&&(t.globalAlpha=e.mtl.strokeOpacity),i=e.mtl.stroke.isColor?e.mtl.stroke.getHexString():e.mtl.stroke,i&&(t.strokeStyle=i)}}renderShape(t,e){e.buildPath(t),e.geo.closed&&t.closePath(),this.renderFill(e),this.renderStroke(e)}renderLineDash(t,e){if(e.mtl.stroke&&e.mtl.lineDash&&void 0!==e.mtl.lineDashOffset){if(t.beginPath(),e.buildPath(t),e.geo.thinLine){const e=Math.sqrt(kp[0]*kp[0]+kp[1]*kp[1]);t.lineWidth=Math.abs(1/e)}else e.geo.lineWidth?t.lineWidth=e.geo.lineWidth:t.lineWidth=1;t.strokeStyle=Le.white,t.setLineDash(e.mtl.lineDash),t.lineDashOffset=e.mtl.lineDashOffset,t.globalAlpha=1,t.stroke()}}renderShapeTexture(t,e){var i,n,s,r,a,o,h,l;(null==(n=null==(i=null==e?void 0:e.mtl)?void 0:i.map)?void 0:n.image)&&(!(null==(a=null==(r=null==(s=null==e?void 0:e.mtl)?void 0:s.map)?void 0:r.image)?void 0:a.width)||null==(l=null==(h=null==(o=null==e?void 0:e.mtl)?void 0:o.map)?void 0:h.image)||l.height,e.mtl.map.matrix.getComponents(Np),t.transform(...Np),t.drawImage(e.mtl.map.image,0,0))}}let Ip;const Dp=new Ui,Lp=new We,Bp=new We,Pp=new We,kp=[1,0,0,1,0,0],Np=[1,0,0,1,0,0],Op=new ai,Rp=new We,zp=new We,Hp=class t{constructor(){c(this,"cache",new Map),c(this,"maxSize",2048),c(this,"renderer",new Cp),c(this,"_scaled",new We(1,1))}dispose(){this.clear()}static getInstance(){return Wp||(Wp=new t),Wp}static set(t,e){this.getInstance().set(t,e)}static clear(){this.getInstance().clear()}scale(t=1,e=1){return t||e?(this._scaled.set(t,e),this):this}has(t){return this.cache.has(t)}set(t,e){if(!t||!e)throw new Error("error input");this.cache.set(t,e)}get(t){if(!t)throw new Error("error input");return this.cache.get(t)}clear(){Object.values(this.cache).forEach((t=>t.destroy())),this._scaled.identity(),this.cache=new Map,function(){var t;const e=nf();if(!(null==(t=null==e?void 0:e.children)?void 0:t.length))return;for(let t=e.children.length-1;t>=0;t--)e.removeChild(e.children[t])}()}calculateMipLevel(t){return t>=1?0:t>=.5?1:t>=.25?2:3}setByShape(t,e,i,n){const s=this.getTextureByShape(e,i,n);return e.userData.textureKey=s.userData.textureKey=t,this.renderShapeTexture(e,s),this.set(t,s),s}getTextureByShape(t,e,i,n){const s=new Tp;if(t.boundingBox.isEmpty())throw new Error("get boundingBox error");Vp.identity(),qp.identity(),e&&!(null==e?void 0:e.isEmpty())?Jp.copy(e):Jp.copy(t.boundingBox),Jp.getSize(Vp),Jp.getCenter(qp),i&&!i.isEmpty()?i.getSize(jp):jp.copy(Vp),(jp.x<Up.x||jp.y<Up.y)&&jp.normalize().multiplyScalar(200),jp.x<1&&(jp.x=1),jp.y<1&&(jp.y=1),Gp.set(Ae.config.width,Ae.config.height);const r=jp.length()/Gp.length();r>1&&jp.multiplyScalar(1/r);const a=jp.length()/Vp.length();return Qp.copy(Vp).multiplyScalar(-.5).add(qp).multiplyScalar(a).negate(),Kp.identity(),tf.set(a,a),$p.compose(Qp,Kp,tf),Yp.copy(Vp).multiplyScalar(-.5).add(qp),s.position.copy(Yp),s.rotation.copy(Kp),s.scaled.multiplyScalar(1/tf.x,1/tf.y),s.updateMatrix(),s}renderShapeTexture(t,e,i){var n;const s=Pn.create(jp.x,jp.y),r=Pn.getContext2D(s,{alpha:!0});r.clearRect(0,0,s.width,s.height),r.beginPath(),r.strokeStyle=Le.darkRed,r.lineWidth=1,r.strokeRect(0,0,s.width,s.height),r.closePath(),this._transform(r,t),this._bindStyle(r,t),t.buildPath(r),this._fill(r,t),this._stroke(r,t),null==(n=t.children)||n.forEach((t=>{t.isShape&&(this._bindStyle(r,t),t.buildPath(r),this._fill(r,t),this._stroke(r,t),t.isText&&this._renderText(r,t))})),e.image=s}_transform(t,e){$p.getComponents(ef),t.transform(...ef)}_bindStyle(t,e){var i,n,s;t.beginPath();const{fill:r,stroke:a}=(null==(i=e.userData)?void 0:i.style)||{};if(r&&(t.fillStyle=r),a){let i=e.mtl.lineWidth;i||(i=1/Math.min(Math.abs(this._scaled.x),Math.abs(this._scaled.y))),t.lineWidth=i,t.strokeStyle=(null==(s=null==(n=e.userData)?void 0:n.style)?void 0:s.stroke)||Le.black}}_fill(t,e){var i,n;(null==(n=null==(i=e.userData)?void 0:i.style)?void 0:n.fill)&&t.fill()}_stroke(t,e){var i,n;(null==(n=null==(i=e.userData)?void 0:i.style)?void 0:n.stroke)&&t.stroke()}_renderText(t,e){const{text:i,fill:n,stroke:s,fontSize:r,fontFamily:a,fontWeight:o,textAlign:h,textBaseline:l}=e.mtl;if(!i)return;Xp.set,Zp.copy(e.matrix).decompose(Qp,Kp,tf);const u=(r||12)*tf.x;t.font=`${o} ${u}px ${a}`,h&&(t.textAlign=h),l&&(t.textBaseline=l);let c=Qp.y;s?(t.strokeStyle=s,t.lineWidth=1*Math.abs(1/ef[0]),t.strokeText(i,Qp.x,c)):(t.fillStyle=n||Le.black,t.fillText(i,Qp.x,c))}};c(Hp,"DEBUG_DisplayCachedTexture",ri.throttle(((t=80,e=.8)=>{const i=Wp;if(!i)return;let n=nf();if(n||(n=function(t=80,e=.8){const i=document.createElement("div");function n(){i.style.opacity="1"}function s(){i.style.opacity=e.toString()}return i.setAttribute("id","DEBUG_Displaycached"),i.style.position="absolute",i.style.width=t+"px",i.style.height="92vh",i.style.background=`rgba(255, 255, 255, ${e})`,i.style.left="20px",i.style.top="20px",i.style.overflow="auto",i.style.padding="6px",i.style.opacity=e.toString(),i.addEventListener("mouseenter",n),i.addEventListener("mouseleave",s),document.body.appendChild(i),i}(t,e)),!n)throw new Error("dom not found");!function(t,e){e.forEach(((e,i)=>{e&&e.image&&function(t,e,i){let n;for(let i=0,s=t.childNodes.length;i<s;i++)if(t.childNodes[i].getAttribute("id")===e){n=t.childNodes[i];break}n?function(t,e){if(!e.image)return;const i=t.querySelector("canvas");if(!i)return;const n=i.getContext("2d",{alpha:!0});if(!n)throw new Error("getContext error");n.clearRect(0,0,i.width,i.height),n.save(),n.scale(window.devicePixelRatio,window.devicePixelRatio),n.drawImage(e.image,0,0),n.restore()}(n,i):function(t,e,i){if(!i.image)return;!i.image.width||i.image.height;const n=Ae.document.createElement("div");n.setAttribute("id",e),n.style.display="flex",n.style.flexDirection="column";const s=Pn.createCanvas({containerId:t.id,width:i.image.width,height:i.image.height,dpr:window.devicePixelRatio});s.style.border=`${Le.yellow} 1px solid`,s.style.maxWidth=parseInt(t.style.width)-2+"px",s.style.maxHeight=parseInt(s.style.maxWidth)/(i.image.width/i.image.height)+"px";const r=s.getContext("2d",{alpha:!0});if(!r)throw new Error("getContext error");r.save(),r.scale(window.devicePixelRatio,window.devicePixelRatio),r.drawImage(i.image,0,0),r.restore(),n.appendChild(s);const a=Ae.document.createElement("p");function o(){const t=s.toDataURL("image/png",.6),e=document.createElement("a"),i=new MouseEvent("click");e.download=`thumb.${Date.now()}.png`,e.href=t,e.dispatchEvent(i)}a.innerHTML=i.image.width+" * "+i.image.height,a.innerHTML+="<br/>"+e,a.style.margin="0",a.style.padding="0",a.style.lineHeight="1.2",a.style.fontSize="10px",a.style.padding="3px 0 6px 0",a.style.color=Le.black,n.appendChild(a),t.appendChild(n),n.addEventListener("click",o)}(t,e,i)}(t,i,e)}))}(n,i.cache)}),5e3));let Wp,Fp=Hp;const Up=new We(50,50),Vp=new We,qp=new We,jp=new We,Yp=new We,Gp=new We,$p=new Ui,Xp=new Ui,Zp=new Ui,Jp=new ai,Qp=new We,Kp=new We,tf=new We,ef=[1,0,0,1,0,0];function nf(){var t;return"undefined"==typeof window?null:null==(t=null==window?void 0:window.document)?void 0:t.getElementById("DEBUG_Displaycached")}const sf=class t{static getObject2BySvg(t,e){const i=(new Zd).parse(t,this.use3DShape),n=this.getShapesByParsed(i,e);if(1==(null==n?void 0:n.length))return n[0];const s=new ep;return s.adds(n),s}static getShapesBySvg(t,e){const i=(new Zd).parse(t,this.use3DShape);return this.getShapesByParsed(i,e)}static getShapesByParsed(t,e){this.use3DShape=!!(null==e?void 0:e.use3DShape);const i=[],n=this.getPolygons2ByPaths(null==t?void 0:t.paths,e);(null==n?void 0:n.length)&&i.push(...n);const s=this.getLabels(null==t?void 0:t.labels,e);return(null==s?void 0:s.length)&&i.push(...s),i}static getPolygons2ByPaths(t,e){if(!t||!t.length)return;const i=[];for(let n=0,s=t.length;n<s;n++){const s=this.getPolygonsByPath(t[n],e);(null==s?void 0:s.length)&&i.push(...s)}return i}static getPolygonsByPath(t,e){var i,n;if(!t)return;const s=[],{userData:r}=t;let{fill:a,stroke:o,strokeWidth:h,thinLine:l,fillOpacity:u,strokeOpacity:c,opacity:d}=(null==r?void 0:r.style)||{};(null==e?void 0:e.fill)&&(a=e.fill),(null==e?void 0:e.stroke)&&(o=e.stroke),(null==e?void 0:e.lineWidth)&&(h=e.lineWidth),(null==e?void 0:e.thinLine)&&(l=!!e.thinLine),(null==e?void 0:e.fillOpacity)&&(u=e.fillOpacity),(null==e?void 0:e.strokeOpacity)&&(c=e.strokeOpacity),(null==e?void 0:e.opacity)&&(d=e.opacity),"none"!==a&&"transparent"!==a||(a=void 0,ri.unset(r,"style.fill")),"none"!==o&&"transparent"!==o||(o=void 0),o&&!h&&(h=1);const p=yp.getMtl({fill:a,stroke:o,lineWidth:h,fillOpacity:u,strokeOpacity:c,opacity:d}),f=[];if(this.use3DShape){const n=Zd.createShapes(t),s=(null==(i=t.currentPath)?void 0:i.autoClose)||!1;for(let t,i=0,r=(null==n?void 0:n.length)||0;i<r;i++){t=n[i];const r=cf(t,{flipY:null==e?void 0:e.flipY,strokeWidth:h,thinLine:l,closed:s});r&&f.push(r)}}else{const i=new Gh({cmds:t.getCmds(),flipY:null==e?void 0:e.flipY,lineWidth:h,thinLine:l});f.push(i)}if(null==f?void 0:f.length){const t=Qh.mergeGeoShapes(f),i=new op(t,p);i.userData=ri.cloneDeep(r),(null==(n=i.userData)?void 0:n.id)&&(i.name=i.userData.id),void 0!==(null==e?void 0:e.selectable)?i.selectable=e.selectable:i.userData.assetType&&(i.selectable=!0),s.push(i)}return s.length?s:void 0}static getInstanceBySymbol(e,i){var n,s,r,a,o,h,u,c;if(!e||!(null==(n=e.paths)?void 0:n.length))return;const d=[],p=ri.cloneDeep(i.userData),f=[];for(let t,i=0,n=(null==(s=null==e?void 0:e.paths)?void 0:s.length)||0;i<n;i++)t=e.paths[i].clone(),t.userData=p,f.push(t);const m=this.getLabels(null==e?void 0:e.labels);if(!e.symbolId)return;const g=new ai;f.forEach((t=>g.union(t.computeBoundingBox()))),null==m||m.forEach((t=>g.union(uf.copy(t.computeBoundingBox()).applyMatrix3(t.matrix)))),af.copy(i.transform).decompose(of,hf,lf);const y=new rp(l({},null==(r=i.userData)?void 0:r.style)),v=new _p(g,y,{flipY:!0});if(v.userData=p,d.push(v),v.applyMatrix3(af.flipSvgY()),v.computeBoundingBox(),v.updateMatrix(),v.updateMatrixWorld(!0),!Fp.getInstance().has(e.symbolId)){const i=new op;ri.set(i,"userData.id",e.symbolId),ri.set(i,"userData.style",ri.merge({},e.style,p.style));for(let n,s=0,r=(null==(a=null==e?void 0:e.paths)?void 0:a.length)||0;s<r;s++){n=e.paths[s];const r=ri.merge({},null==(o=n.userData)?void 0:o.style,p.style,{flipY:!1});r.stroke&&!r.lineWidth&&(r.lineWidth=null==(u=null==(h=n.userData)?void 0:h.style)?void 0:u.strokeWidth),r.stroke&&!r.lineWidth&&(r.lineWidth=(null==(c=p.style)?void 0:c.strokeWidth)||1);const a=t.getPolygonsByPath(n,r);(null==a?void 0:a.length)&&i.adds(a)}(null==m?void 0:m.length)&&i.adds(m),i.computeBoundingBox(),i.updateMatrix(),i.updateMatrixWorld(!0),i.updateBoundingBox(),Fp.getInstance().scale(lf.x,lf.y).setByShape(e.symbolId,i,g)}let x=Fp.getInstance().get(e.symbolId);return x?(x=x.clone(),x.scaled.multiplyScalar(1,-1),x.updateMatrix(),v.mtl.map=x,d):void 0}static getLabels(t,e){if(!(null==t?void 0:t.length))return;const i=[];for(let n=0,s=(null==t?void 0:t.length)||0;n<s;n++){const s=this.getLabel(t[n],e);(null==s?void 0:s.length)&&i.push(...s)}return i}static getLabel(t,e){var i,n,s,r;if(!t||!t.textContent)return;const a=[];let{fill:o,stroke:h}=(null==(i=t.userData)?void 0:i.style)||{};o&&"none"!==o&&"transparent"!==o||h||(o=Le.lightBlack);const l=new bp({text:t.textContent,fontSize:t.userData.style.fontSize,fill:o,stroke:h,flipY:null==e?void 0:e.flipY,wireframe:null==e?void 0:e.wireframe});t.userData&&(l.userData=ri.cloneDeep(t.userData)),(null==(n=l.userData)?void 0:n.id)&&(l.name=l.userData.id),void 0===(null==(r=null==(s=l.userData)?void 0:s.style)?void 0:r.fill)&&ri.set(l.userData,"style.fill",o),l.renderOrder=1,a.push(l),t.transform&&(af.setFromMatrix(t.transform),(null==e?void 0:e.flipY)&&af.scale(1,-1),l.applyMatrix3(af));const{id:u,pid:c,aid:d,assetType:p,layerType:f}=t.userData;return a}};c(sf,"use3DShape",!1);let rf=sf;const af=new Ui,of=new We,hf=new We,lf=new We,uf=new ai;function cf(t,e){var i,n;const{closed:s,flipY:r,strokeWidth:a,thinLine:o}=e||{};null==(i=null==t?void 0:t.curves)||i.length;const h=df(t.curves),l=[];for(let e=0,i=null==(n=null==t?void 0:t.holes)?void 0:n.length;e<i;e++){const i=df(t.holes[e].curves);l.push(...i)}h.push(...l);return new Gh({cmds:h,closed:s,flipY:r,lineWidth:a,thinLine:o})}function df(t){const e=[];for(let i,n=0,s=t.length;n<s;n++){const s=t[n],r=s.getPoint(0),a=!n;switch(s.type){case"LineCurve":a&&e.push([ln,...s.v1.toArray()]),e.push([un,...s.v2.toArray()]);break;case"QuadraticBezierCurve":{a&&e.push([ln,r.x,r.y]);const t=[];t.push(dn),t.push(...s.v1.toArray()),t.push(...s.v2.toArray()),e.push(t);break}case"CubicBezierCurve":{a&&e.push([ln,r.x,r.y]);const t=[];t.push(cn),t.push(...s.v0.toArray()),t.push(...s.v1.toArray()),t.push(...s.v2.toArray()),t.push(...s.v3.toArray()),e.push(t);break}case"EllipseCurve":{a&&e.push([ln,r.x,r.y]);const t=[];t.push(gn),t.push(s.aX),t.push(s.aY),t.push(s.xRadius),t.push(s.yRadius),t.push(s.aRotation),t.push(s.aStartAngle),t.push(s.aEndAngle),t.push(s.aClockwise?1:0),e.push(t);break}}i=s}return e}const pf=Ae.window||window,ff=pf.requestAnimationFrame||pf.webkitRequestAnimationFrame||pf.mozRequestAnimationFrame||pf.oRequestAnimationFrame||pf.msRequestAnimationFrame||function(t){pf.setTimeout(t,1e3/60)},mf=pf.cancelAnimationFrame||pf.webkitCancelAnimationFrame||pf.mozCancelAnimationFrame||pf.oCancelAnimationFrame||pf.msCancelAnimationFrame||clearTimeout;class gf{constructor(t,e,i=16.7,n){var s;if(c(this,"duration",16.7),c(this,"onComplete"),c(this,"generator"),c(this,"t",null),c(this,"stopped",!1),i&&(this.duration=i),this.onComplete=n,!e||"function"!=typeof e)throw new Error("[task] callback method is null!");let r="number"==typeof t&&t||Array.isArray(t)&&t.length;if(!r)throw new Error("[task] task list is empty ...");if(1===r)return e(0),void(null==(s=this.onComplete)||s.call(this));this.generator=this.queue(r,e),this.t=null,this.stopped=!1,this.next()}next(){var t;if(!this.generator||this.stopped)return;const{generator:e}=this,i=performance.now();let n=null;do{if(!e)break;if(n=e.next(),n.done){null==(t=this.onComplete)||t.call(this),this.clear();break}}while(!n.done&&performance.now()-i<this.duration);n.done||this.stopped||(this.t=ff(this.next.bind(this)))}*queue(t,e){let i=performance.now();for(let n=0;n<t;n++)performance.now()-i>=this.duration&&(i=performance.now(),yield),this.stopped||e(n)}clear(){this.stopped=!0,this.generator=void 0,this.onComplete=void 0,this.t&&(mf(this.t),this.t=null)}}class yf extends Fi{constructor(t={}){super(),c(this,"name","Adapter2@"+si.now()),c(this,"params"),c(this,"xml"),c(this,"units"),c(this,"paths"),c(this,"symbolsMap"),c(this,"uses"),c(this,"labels"),c(this,"idsTree"),c(this,"scene"),c(this,"boundingBox",new ai),c(this,"requestHeader",{}),c(this,"resources",[]),c(this,"_viewBox",new ai),c(this,"_tic"),c(this,"_tic2"),c(this,"_assetTypes",[]),c(this,"_resourcesMap",{}),c(this,"_assetTypeMap",{}),c(this,"_idsMap",{}),c(this,"_boundingBoxMap",{}),c(this,"use3DShape",!1),this.params=t}destroy(){super.destroy(),this.clear()}clear(){this.xml=void 0,this.paths=[],this.symbolsMap={},this.uses=[],this.labels=[],this.idsTree=[],this._idsMap={},this.boundingBox.makeEmpty(),this._resourcesMap={},this._assetTypeMap={},this._assetTypes=[],Fp.clear()}setRequestHeader(t){return this.requestHeader=t,this}load(t,e){return d(this,null,(function*(){var e,i;if(!t)throw"url not found";let n;if(this.dispatchEvent({type:Mi.INITIALIZATION_START}),this.clear(),rf.use3DShape=this.use3DShape,this.use3DShape)n=yield(new Zd).setRequestHeader({}).setPixelRatio((null==(e=this.params)?void 0:e.dpr)||1).loadAsync(t).catch((()=>({})));else{const e=yield(new ks).loadAsync(t).catch((()=>({})));n=yield Nn.setInstancedMesh(null==(i=Ae.config)?void 0:i.instancedMesh).parse(e)}return n}))}initResources(t,e){var i,n,s,r,a,o;if(this.clear(),!this.scene)throw new Error("please bind a Scene first");if(this.xml=null==t?void 0:t.xml,!this.xml)return void this.dispatchEvent({type:Mi.INITIALIZATION_COMPLETE});this.units=null==t?void 0:t.units,this.paths=null==t?void 0:t.paths,this.symbolsMap=null==t?void 0:t.symbolsMap,this.uses=null==t?void 0:t.uses,this.labels=null==t?void 0:t.labels,this.idsTree=null==t?void 0:t.idsTree,this._assetTypes=null==t?void 0:t.assetTypes,(null==t?void 0:t.viewBox)&&this._viewBox.copy(t.viewBox).flipY(),this.recomputeIdsMap();const h=this,l=ri.chain(e).flatMap((t=>this._idsMap[t])).commit().uniq().value();if(null==(i=null==t?void 0:t.paths)?void 0:i.length){const e=null==t?void 0:t.paths;this._tic&&this._tic.clear(),this._tic=new gf(e,(function(t){var i,n,s,r,a,o,u,c,d,p,f;const m=rf.getPolygonsByPath(e[t],{flipY:!0});if(null==m?void 0:m.length)for(let t=0,e=(null==m?void 0:m.length)||0;t<e;t++){const e=null==(n=null==(i=m[t])?void 0:i.userData)?void 0:n.id;(null==l?void 0:l.length)&&!l.includes(e)&&(m[t].visible=!1),h._resourcesMap[e]||(h._resourcesMap[e]=[]),h._resourcesMap[e].push(m[t]),null==(s=h.scene)||s.add(m[t]),(null==(a=null==(r=m[t])?void 0:r.userData)?void 0:a.assetType)&&(h._assetTypeMap[null==(u=null==(o=m[t])?void 0:o.userData)?void 0:u.assetType]||(h._assetTypeMap[null==(d=null==(c=m[t])?void 0:c.userData)?void 0:d.assetType]=[]),h._assetTypeMap[null==(f=null==(p=m[t])?void 0:p.userData)?void 0:f.assetType].push(m[t]))}}),3,(function(){var t;null==(t=h.scene)||t.computeBoundingBox(),h.scene.needsUpdate=!0}))}if(null==(n=null==t?void 0:t.labels)?void 0:n.length){const e=null==t?void 0:t.labels;this._tic2&&this._tic2.clear(),this._tic2=new gf(e,(function(t){var i,n,s;const r=rf.getLabel(e[t],{flipY:!0});if(null==r?void 0:r.length)for(let t=0,e=(null==r?void 0:r.length)||0;t<e;t++){r[t].renderOrder=9;const e=null==(n=null==(i=r[t])?void 0:i.userData)?void 0:n.id;(null==l?void 0:l.length)&&!l.includes(e)&&(r[t].visible=!1),h._resourcesMap[e]||(h._resourcesMap[e]=[]),h._resourcesMap[e].push(r[t]),null==(s=h.scene)||s.add(r[t])}}),3,(()=>{var t;null==(t=this.scene)||t.computeBoundingBox(),this.scene.needsUpdate=!0}))}if(null==(s=null==t?void 0:t.instances)?void 0:s.length){const e=null==t?void 0:t.instances;for(let t,i=0,n=e.length;i<n;i++){t=e[i];const n=rf.getInstanceBySymbol(this.symbolsMap[t.symbolId],t);if(null==n?void 0:n.length)for(let t=0,e=(null==n?void 0:n.length)||0;t<e;t++){const e=null==(a=null==(r=n[t])?void 0:r.userData)?void 0:a.id;(null==l?void 0:l.length)&&!l.includes(e)&&(n[t].visible=!1),null==(o=this.scene)||o.add(n[t])}}}}bindScene(t){return this.scene=t,this}recomputeIdsMap(){var t;if(!(null==(t=this.idsTree)?void 0:t.length))return;const e=[];an(this.idsTree,(t=>{var i;if(e.push(t.value),!(null==(i=t.children)?void 0:i.length))return;const n=on(t);this._idsMap[t.value]=ri.map(n,"value")}))}getAssetIdsByType(t){let e=[];Array.isArray(t)||(t=[t]);for(let i,n=0,s=t.length;n<s;n++){i=t[n];let s=Object.hasOwnProperty.call(this._idsMap,i)?this._idsMap[i]:void 0;(null==s?void 0:s.length)||(s=Object.hasOwnProperty.call(this._idsMap,i+"-assets")?this._idsMap[i+"-assets"]:void 0),(null==s?void 0:s.length)&&(e=e.concat(s))}return e}getLayers(t=2){return this.xml?rn(this.xml,t):[]}getViewBox(){return this._viewBox}getAssetTypes(){return this._assetTypes}getByAssetType(t){return this._assetTypeMap[t]||[]}updateLayersVisibility(t,e=!1){if(!this.scene)throw new Error("please bind a Scene first");const i=ri.chain(t).flatMap((t=>this._idsMap[t])).concat(t).compact().uniq().value();this.scene.traverse((t=>{var n,s;(null==(n=t.userData)?void 0:n.id)&&i.includes(t.userData.id)?t.visible=e:(null==(s=t.userData)?void 0:s.id)&&(t.visible=!e)})),this.scene.needsUpdate=!0}getBoundingBoxByIds(t){if(!this._resourcesMap||!Object.keys(this._resourcesMap).length)return;const e=new ai;Array.isArray(t)||(t=[t]);for(let i=0,n=null==t?void 0:t.length;i<n;i++){if(!this._resourcesMap.hasOwnProperty(t[i]))continue;const n=this._resourcesMap[t[i]];if(null==n?void 0:n.length)for(let t=0,i=null==n?void 0:n.length;t<i;t++)n[t].boundingBox.isEmpty()&&n[t].computeBoundingBox(),n[t].boundingBox.isEmpty()||e.union(n[t].boundingBox)}return e}transMmByUtils(t=0){return t*vf[ri.toLower(this.units||"mm")]}}const vf={mm:1,cm:.1,m:.001,inches:.0393701,inch:.0393701};class xf{constructor(t){c(this,"params"),c(this,"currentCamera"),c(this,"bindingStates",new WeakMap),c(this,"forceUpdate",!1),c(this,"currentState"),c(this,"cameraVersion"),c(this,"currentRenderState"),c(this,"ctxMap",{}),this.params=t}destroy(){this.bindingStates=new WeakMap,this.currentState=void 0,this.ctxMap={},this.reset()}reset(){this.forceUpdate=!0}setup(t,e,i){this.currentRenderState=e,this.currentCamera=i,this.currentState=this.getBindingState(t),this.ctxMap={};let n=this.needsUpdate(t);return(this.forceUpdate||n)&&this.saveCache(t),this.currentState}getBindingState(t){return this.bindingStates.has(t)||this.bindingStates.set(t,{id:t.id,uuid:t.uuid,needsUpdate:!0,featureKey:t.featureKey,version:-1,cameraVersion:-1,preShape:bf}),bf=t,this.bindingStates.get(t)}clearBindingState(){this.currentState&&(this.currentState.needsUpdate=!1,this.currentState.version=-1,this.currentState.cameraVersion=-1)}needsUpdate(t){return!this.currentState||(!!this.currentState.needsUpdate||(this.currentState.id!==t.id||this.currentState.version!==t.version))}saveCache(t){this.currentState&&(this.clearBindingState(),this.currentState.version=t.version,this.currentState.needsUpdate=!1,this.currentState.ctx=Pn.getCtx(t.featureKey,this.params.width,this.params.height,this.params.dpr))}updateModelViewMatrix(t,e){void 0!==e?(this.currentState=this.getBindingState(t),(this.currentState.cameraVersion!==e.version||t.dynamically)&&(this.currentState.cameraVersion!==e.version&&(this.currentState.needsUpdate=!0),this.currentState.cameraVersion=e.version,t.updateModelViewMatrix(e))):t.updateModelViewMatrix()}}let bf;class wf{constructor(){c(this,"light"),c(this,"lightsArray",[]),c(this,"shadowsArray",[]),c(this,"lastCameraVersion",-1)}destroy(){var t;this.clear(),null==(t=this.light)||t.destroy()}clear(){this.lightsArray.length=0,this.shadowsArray.length=0}pushLight(t){this.light||(this.light=t),this.lightsArray.push(t)}pushShadow(t){this.shadowsArray.push(t)}}class _f{constructor(){c(this,"renderStates",new WeakMap)}destroy(){this.renderStates=new WeakMap}get(t,e=0){const i=this.renderStates.get(t);let n;return void 0===i?(n=new wf,this.renderStates.set(t,[n])):e>=i.length?(n=new wf,i.push(n)):n=i[e],n}}class Sf{constructor(t=1e3){c(this,"cellCapacity"),c(this,"firstIndex"),c(this,"lastIndex"),c(this,"items"),this.cellCapacity=t,this.firstIndex=0,this.lastIndex=0,this.items=[new Array(this.cellCapacity)]}adjustCells(){this.lastIndex<this.cellCapacity||(this.items.push(new Array(this.cellCapacity)),this.lastIndex=0)}enqueue(t,e){if(e)return this.unshift(t);this.items[this.items.length-1][this.lastIndex++]=t,this.adjustCells()}unshift(t){for(let t=this.items.length-1;t>=0;t--)for(let e=this.cellCapacity-1;e>=0;e--)e>0&&void 0===this.items[t][e-1]||(this.items[t][e]=0===e&&t>0?this.items[t-1][this.cellCapacity-1]:this.items[t][e-1]);this.items[0][this.firstIndex]=t,this.lastIndex++,this.adjustCells()}dequeue(){if(this.isEmpty())return;const t=this.items[0][this.firstIndex];return this.firstIndex===this.cellCapacity-1?(this.items.shift(),this.firstIndex=0):this.firstIndex++,t}isEmpty(){return 1===this.items.length&&this.firstIndex===this.lastIndex}peek(){if(!this.isEmpty())return this.items[0][this.firstIndex]}size(){return(this.items.length-1)*this.cellCapacity-this.firstIndex+this.lastIndex}clear(){this.firstIndex=0,this.lastIndex=0,this.items=[new Array(this.cellCapacity)]}toString(){if(this.isEmpty())return"";let t=`${this.items[0][this.firstIndex]}`;for(let e=this.firstIndex+1;e<this.items[0].length;e++)t=`${t},${this.items[0][e]}`;for(let e=1;e<this.items.length-1;e++)for(let i=0;i<this.items[e].length;i++)t=`${t},${this.items[e][i]}`;for(let e=0;e<this.lastIndex;e++)t=`${t},${this.items[this.items.length-1][e]}`;return t}getByIndex(t){if(t>=this.size())return;const e=Math.floor((this.firstIndex+t)/this.cellCapacity),i=(this.firstIndex+t)%this.cellCapacity;return this.items[e][i]}setByIndex(t,e){if(t>=this.size())return!1;const i=Math.floor((this.firstIndex+t)/this.cellCapacity),n=(this.firstIndex+t)%this.cellCapacity;return this.items[i][n]=e,!0}sort(t){const e=this.size(),i=new Array(e);for(let t=0;t<e;t++)i[t]=this.getByIndex(t);i.sort(t),this.clear();for(let t=0;t<i.length;t++)this.enqueue(i[t])}getAll(){const t=[];for(let e=0,i=this.size();e<i;e++)t[e]=this.getByIndex(e);return t}}class Ef{constructor(){c(this,"queue",new Sf),c(this,"mergedQueue",{})}destroy(){this.clear()}clear(){this.queue.clear();const t=ri.keys(this.mergedQueue);for(let e=0,i=null==t?void 0:t.length;e<i;e++)void 0!==this.mergedQueue[t[e]]&&this.mergedQueue[t[e]].clear()}push(t,e){return e&&!t.renderOrder&&(t.renderOrder=e),this.queue.enqueue(t),this}unshift(t){this.queue.enqueue(t,!0)}sort(t){return this.queue.size()&&this.queue.sort(t||Mf),this}mergeQueue(){for(let t=0,e=this.queue.size();t<e;t++){const t=this.queue.dequeue();if(!t.isShape)continue;const e=sp(t.mtl);let i=this.mergedQueue[e];i||(i=new Sf,this.mergedQueue[e]=i),i.enqueue(t)}return this}}function Mf(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.id-e.id}class Af{constructor(){c(this,"lists",new WeakMap)}destroy(){this.lists=new WeakMap}get(t,e){const i=this.lists.get(t);let n;return void 0===i?(n=new Ef,this.lists.set(t,[n])):e>=i.length?(n=new Ef,i.push(n)):n=i[e],n}}class Tf{constructor(t={}){c(this,"name","CvsRenderer@"+si.now()),c(this,"params"),c(this,"autoClear",!0),c(this,"_currentRenderTarget"),c(this,"cvs"),c(this,"ctx"),c(this,"renderStates",new _f),c(this,"renderStateStack",[]),c(this,"currentRenderState"),c(this,"renderLists",new Af),c(this,"currentRenderList"),c(this,"renderListStack",[]),c(this,"bindingStates"),c(this,"renderer"),c(this,"_frustum",new ai),c(this,"_tic"),c(this,"renderSliceComplete",!1),c(this,"lastTicCompleted",-1),c(this,"_isContextLost",!1),c(this,"contextLostHandler",this.handleContextLost.bind(this)),c(this,"contextRestoreHandler",this.handleContextRestore.bind(this)),this.params=t,Ae.config=t,void 0!==t.autoClear&&(this.autoClear=!!t.autoClear),this.init(),this.bindingStates=new xf(this.params),this.renderer=new Cp(this.ctx,this.bindingStates)}destroy(){this.renderer.destroy()}init(){if(this.params.workerRender){if(!this.params.cvs)throw new Error("offscreen canvas not found");this.cvs=this.params.cvs}else this.cvs=Pn.createCanvas(this.params);if(!this.cvs)throw new Error("canvas create error");const t=this.cvs.getContext("2d",{alpha:!0});if(!t)throw new Error("context error");this.params.cvs=this.cvs,this.params.ctx=this.ctx=t,this.setSize(this.params.width,this.params.height)}get isSliceComplete(){return!!this.params.sliceRendering&&this.renderSliceComplete}resize(){this.setSize(this.params.width,this.params.height)}setSize(t,e){this.params.width=t,this.params.height=e,this.params.camera||(this.params.camera={}),this.params.camera.width=t,this.params.camera.height=e,this.params.aspect=t/e,this.params.camera.aspect=this.params.aspect,this.params.camera.left=-.5*t,this.params.camera.right=.5*t,this.params.camera.top=.5*e,this.params.camera.bottom=-.5*e,this.cvs&&Pn.resizeCanvas(this.cvs,t,e,this.params.dpr)}getSize(t=new We){return t.set(this.params.width,this.params.height)}bindEvents(){var t,e;null==(t=this.cvs)||t.addEventListener(Cf,this.contextLostHandler,!1),null==(e=this.cvs)||e.addEventListener(If,this.contextRestoreHandler,!1)}unbindEvents(){var t,e;null==(t=this.cvs)||t.removeEventListener(Cf,this.contextLostHandler,!1),null==(e=this.cvs)||e.removeEventListener(If,this.contextRestoreHandler,!1)}handleContextLost(t){t.preventDefault(),this._isContextLost=!0}handleContextRestore(){this._isContextLost=!1}clean(){this.ctx&&(this._currentRenderTarget?this._currentRenderTarget.ctx.clearRect(0,0,this.params.width,this.params.height):this.ctx.clearRect(0,0,this.params.width,this.params.height))}getRenderTarget(){return this._currentRenderTarget}setRenderTarget(t){this._currentRenderTarget=t}render(t,e,i){if(this._isContextLost||!this.ctx)return;this._currentRenderTarget?this.renderer.ctx=this._currentRenderTarget.ctx:this.renderer.ctx=this.ctx,this.currentRenderState=this.renderStates.get(t,this.renderStateStack.length);const n=void 0!==e&&this.currentRenderState.lastCameraVersion!==e.version;(n||t.dynamically||t.matrixWorldAutoUpdate)&&t.updateMatrixWorld(),(n||e&&void 0===e.parent&&(null==e?void 0:e.matrixWorldAutoUpdate))&&e.updateMatrixWorld(),e&&(this._frustum.copy(e.boundingBoxWorld),this.currentRenderState.lastCameraVersion=e.version),t.isScene&&t.onBeforeRender(this,t,e,i),this.currentRenderState.clear(),this.renderStateStack.push(this.currentRenderState),this.currentRenderList=this.renderLists.get(t,this.renderListStack.length),this.currentRenderList.clear(),this.renderListStack.push(this.currentRenderList),this.projectObject(t,e,0),this.currentRenderList.sort(),this.renderScene(this.currentRenderList,t,e,i),t.isScene&&t.onAfterRender(this,t,e),this.renderStateStack.pop(),this.renderStateStack.length>0?this.currentRenderState=this.renderStateStack[this.renderStateStack.length-1]:this.currentRenderState=void 0,this.renderListStack.pop(),this.renderListStack.length?this.currentRenderList=this.renderListStack[this.renderListStack.length-1]:this.currentRenderList=void 0}renderTexture(t,e){t&&t.image&&(this._currentRenderTarget?this.renderer.ctx=this._currentRenderTarget.ctx:this.renderer.ctx=this.ctx,this.autoClear&&this.clean(),this.renderer.ctx.drawImage(t.image,0,0))}projectObject(t,e,i=0){var n,s,r,a,o,h;if(t.visible)if(t.composeNode)t.boundingBoxWorld.isEmpty()?null==(n=this.currentRenderList)||n.push(t,i):this._frustum.intersectsBox(t.boundingBoxWorld)&&(null==(s=this.currentRenderList)||s.push(t,i));else{t.isGroup&&(i=t.renderOrder),t.isShape&&e?t.boundingBoxWorld.isEmpty()?null==(r=this.currentRenderList)||r.push(t,i):this._frustum.intersectsBox(t.boundingBoxWorld)&&(null==(a=this.currentRenderList)||a.push(t,i)):t.isShape&&(null==(o=this.currentRenderList)||o.push(t,i));for(let i=0,n=(null==(h=t.children)?void 0:h.length)||0;i<n;i++)this.projectObject(t.children[i],e)}}renderScene(t,e,i,n){this.autoClear&&this.clean();const s=t.queue;s.size()<=0||(e.isStatic&&this.params.sliceRendering?this.renderObjectsSlice(s,e,i,n):this.renderObjects(s,e,i,n),s.clear())}renderObjects(t,e,i,n){for(let s,r=0,a=t.size();r<a;r++)s=t.dequeue(),s&&this.renderObject(s,e,i,n)}renderObject(t,e,i,n){t.onBeforeRender(this,e,i,n),this.bindingStates.updateModelViewMatrix(t,i),this.bindingStates.setup(t,this.currentRenderState,i),this.renderer.render(t),this.params.wireframe&&this.renderer.renderWireFrame(t),t.onAfterRender(this,e,i)}renderObjectsMerged(t,e,i,n){si.now();(()=>{for(let s,r=0,a=t.size();r<a;r++)s=t.dequeue(),s&&this.renderObjectMerged(s,e,i,n)})()}renderObjectMerged(t,e,i,n){t.onBeforeRender(this,e,i,n),this.bindingStates.updateModelViewMatrix(t,i),this.bindingStates.setup(t,this.currentRenderState,i),this.renderer.renderMerged(t),this.params.wireframe&&this.renderer.renderWireFrame(t),t.onAfterRender(this,e,i)}renderObjectsSlice(t,e,i,n){var s;this.autoClear&&this.clean();const r=t.getAll()||[];if(!(null==r?void 0:r.length))return;this._tic&&this._tic.clear(),this.renderSliceComplete=!1;const a=(null==(s=this._currentRenderTarget)?void 0:s.ctx)||this.ctx;if(!a)throw new Error("CvsRenderer.renderObjectsSlice: no ctx");const o=this;this._tic=new gf(r,(t=>{this.renderSliceComplete=!1,this.renderer.ctx=a,this.renderObject(r[t],e,i,n),e.isStatic&&t===r.length-1&&this.params.debounceCache&&(this.renderSliceComplete=!0)}),this.params.sliceDuration,(function(){o.lastTicCompleted=si.now()}))}}const Cf="contextlost",If="contextrestored";class Df{constructor(t=!0){c(this,"autoStart"),c(this,"startTime",0),c(this,"oldTime",0),c(this,"elapsedTime",0),c(this,"running",!1),this.autoStart=t}start(){this.startTime=fi(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=fi();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}class Lf extends Fi{constructor(t={}){super(),c(this,"name","RenderTarget"),c(this,"uuid",fs()),c(this,"featureKey",this.name+"@"+this.uuid),c(this,"offscreen",!0),c(this,"width"),c(this,"height"),c(this,"dpr"),c(this,"texture"),c(this,"cvs"),c(this,"ctx"),void 0!==t.offscreen&&(this.offscreen=t.offscreen),this.width=t.width,this.height=t.height,this.dpr=t.dpr||1,this.offscreen?this.cvs=Pn.get(this.featureKey,this.width,this.height,this.dpr):this.cvs=Pn.createHtmlCanvas(this.width,this.height,this.dpr),this.ctx=Pn.getContext2D(this.cvs,{alpha:!0}),this.texture=new Tp,this.texture.image=this.cvs}destroy(){super.destroy()}setSize(t,e,i=Ae.config.dpr){this.width===t&&this.height===e&&this.dpr===i||(this.width=t,this.height=e,Pn.resizeCanvas(this.cvs,t,e,i))}clean(){this.ctx&&this.ctx.clearRect(0,0,this.width,this.height)}clone(){return new(0,this.constructor)({width:this.width,height:this.height,dpr:this.dpr}).copy(this)}copy(t){return this.name=t.name,this}}const Bf=new We;class Pf{constructor(t,e){c(this,"name","EffectComposer"),c(this,"renderer"),c(this,"renderTarget1"),c(this,"renderTarget2"),c(this,"writeBuffer"),c(this,"readBuffer"),c(this,"_width"),c(this,"_height"),c(this,"_pixelRatio"),c(this,"renderToScreen",!0),c(this,"passes",[]),c(this,"clock",new Df),this.renderer=t,e?(this.renderTarget1=e,this._width=e.width,this._height=e.height):(t.getSize(Bf),this._width=Bf.x,this._height=Bf.y,this.renderTarget1=new Lf({width:this._width,height:this._height}),this.renderTarget1.name="EffectComposer.rt1"),this._pixelRatio=Ae.config.dpr,this.renderTarget2=this.renderTarget1.clone(),this.renderTarget2.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}destroy(){this.renderTarget1.destroy(),this.renderTarget2.destroy()}swapBuffers(){const t=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=t}addPass(t){this.passes.push(t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(t,e){this.passes.splice(e,0,t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(t){const e=this.passes.indexOf(t);-1!==e&&this.passes.splice(e,1)}clearPasses(){this.passes.length=0}isLastEnabledPass(t){for(let e=t+1,i=this.passes.length;e<i;e++)if(this.passes[e].enabled)return!1;return!0}render(t){void 0===t&&(t=this.clock.getDelta());const e=this.renderer.getRenderTarget();for(let e=0,i=this.passes.length;e<i;e++){const i=this.passes[e];i.enabled&&(i.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(e),i.render(this.renderer,this.writeBuffer,this.readBuffer,t,false),i.needsSwap&&this.swapBuffers())}this.renderer.setRenderTarget(e)}reset(t){void 0===t&&(this.renderer.getSize(Bf),this._pixelRatio=Ae.config.dpr,this._width=Bf.x,this._height=Bf.y,(t=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.destroy(),this.renderTarget2.destroy(),this.renderTarget1=t,this.renderTarget2=t.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(t,e){this._width=t,this._height=e;const i=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(i,n),this.renderTarget2.setSize(i,n);for(let t=0,e=this.passes.length;t<e;t++)this.passes[t].setSize(i,n)}setPixelRatio(t){this._pixelRatio=t,this.setSize(this._width,this._height)}}class kf{constructor(){c(this,"isPass",!0),c(this,"enabled",!0),c(this,"needsSwap",!0),c(this,"clear",!1),c(this,"renderToScreen",!1)}destroy(){}setSize(t,e){}}class Nf{constructor(){c(this,"renderTarget"),c(this,"texture"),c(this,"width"),c(this,"height"),c(this,"dpr"),c(this,"version",-1),this.width=Ae.config.width,this.height=Ae.config.height,this.dpr=Ae.config.dpr,this.renderTarget=new Lf({width:this.width,height:this.height,dpr:this.dpr}),this.texture=this.renderTarget.texture,this.texture.image=this.renderTarget.cvs}destroy(){}render(t){t.renderTexture(this.texture)}}class Of extends kf{constructor(t,e,i=!0,n=!1){super(),c(this,"name","RenderPass"),c(this,"scene"),c(this,"camera"),this.scene=t,this.camera=e,this.clear=i,this.needsSwap=n}render(t,e,i,n){const s=t.autoClear;t.autoClear=!1,t.setRenderTarget(this.renderToScreen?void 0:i),this.clear&&t.clean(),t.render(this.scene,this.camera,n),t.autoClear=s}}class Rf extends kf{constructor(t,e,i=!0,n=!1){super(),c(this,"name","DebouncePass"),c(this,"scene"),c(this,"camera"),c(this,"fsQuad",new Nf),c(this,"debounceQuad",new Nf),c(this,"cacheQuad",new Nf),c(this,"version",-1),c(this,"_ts",si.now()),c(this,"_initialized",!1),c(this,"debounceRenderHandler",ri.debounce(this.debounceRender.bind(this),100)),this.scene=t,this.camera=e,this.clear=i,this.needsSwap=n}destroy(){super.destroy()}setSize(t,e){this.fsQuad.renderTarget.setSize(t,e),this.debounceQuad.renderTarget.setSize(t,e),this.cacheQuad.renderTarget.setSize(t,e),this.fsQuad.width=t,this.fsQuad.height=e,this.debounceQuad.width=t,this.debounceQuad.height=e,this.cacheQuad.width=t,this.cacheQuad.height=e}get currentVersion(){var t;return this.scene.version+((null==(t=this.camera)?void 0:t.version)||0)}get isChanged(){return this.version!==this.currentVersion}get isDebounceChanged(){return this.debounceQuad.version!==this.currentVersion}isRenderTicComplete(t){return this._ts<=t.lastTicCompleted}render(t,e,i){const n=t.autoClear;t.autoClear=!1,this.isChanged?this.isChanged&&!this._initialized?(this.finalRender(this.fsQuad,t,e,i),this.debounceRender(t,e,i)):(this.renderCache(this.debounceQuad,this.cacheQuad),this.finalRender(this.cacheQuad,t,e,i),this.debounceRenderHandler(t,e,i)):(Ae.config.debounceCache&&this.isDebounceChanged&&this.isRenderTicComplete(t)?(this.saveCache(this.fsQuad,this.debounceQuad),this.finalRender(this.fsQuad,t,e,i),this._initialized=!0):Ae.config.debounceCache&&this._initialized?(this.renderCache(this.debounceQuad,this.cacheQuad),this.finalRender(this.cacheQuad,t,e,i)):(this.renderCache(this.fsQuad,this.cacheQuad),this.finalRender(this.cacheQuad,t,e,i)),this._ts=si.now()),this.version=this.currentVersion,t.autoClear=n}saveCache(t,e){var i;this.isDebounceChanged&&(e.renderTarget.ctx.clearRect(0,0,Ae.config.width,Ae.config.height),e.renderTarget.ctx.drawImage(t.renderTarget.cvs,0,0),null==(i=this.camera)||i.updateMatrixWorld(),e.texture.matrix.copy(t.texture.matrix),e.version=this.currentVersion)}renderCache(t,e){var i;null==(i=this.camera)||i.updateMatrixWorld(),Hf.copy(t.texture.matrix).invert().premultiply(this.camera.viewMatrix).getComponents(Wf),zf.set(Ae.config.width,Ae.config.height),e.renderTarget.ctx.clearRect(0,0,Ae.config.width,Ae.config.height),e.renderTarget.ctx.save(),e.renderTarget.ctx.transform(...Wf),e.renderTarget.ctx.drawImage(t.renderTarget.cvs,0,0,zf.x,zf.y),e.renderTarget.ctx.restore()}finalRender(t,e,i,n){e.setRenderTarget(this.renderToScreen?void 0:n),this.clear&&e.clean(),e.renderTexture(t.renderTarget.texture,this.camera)}debounceRender(t,e,i){t.setRenderTarget(this.renderToScreen?void 0:this.fsQuad.renderTarget),t.clean(),t.render(this.scene,this.camera),this.fsQuad.texture.matrix.copy(this.camera.viewMatrix)}}const zf=new We,Hf=new Ui,Wf=[1,0,0,1,0,0];class Ff extends kf{constructor(){super(),c(this,"name","OutputPass"),c(this,"texture"),c(this,"fsQuad"),this.fsQuad=new Nf,this.texture=this.fsQuad.texture,this.clear=!0}destroy(){super.destroy(),this.fsQuad.destroy()}render(t,e,i){const n=t.autoClear;t.autoClear=!1,this.fsQuad.texture.image=i.cvs,t.setRenderTarget(this.renderToScreen?void 0:e),this.clear&&t.clean(),this.fsQuad.render(t),i.clean(),t.autoClear=n}}class Uf{noise(t,e,i=0){const n=Math.floor(t),s=Math.floor(e),r=Math.floor(i),a=255&n,o=255&s,h=255&r,l=(t-=n)-1,u=(e-=s)-1,c=(i-=r)-1,d=qf(t),p=qf(e),f=qf(i),m=Vf[a]+o,g=Vf[m]+h,y=Vf[m+1]+h,v=Vf[a+1]+o,x=Vf[v]+h,b=Vf[v+1]+h;return jf(f,jf(p,jf(d,Yf(Vf[g],t,e,i),Yf(Vf[x],l,e,i)),jf(d,Yf(Vf[y],t,u,i),Yf(Vf[b],l,u,i))),jf(p,jf(d,Yf(Vf[g+1],t,e,c),Yf(Vf[x+1],l,e,c)),jf(d,Yf(Vf[y+1],t,u,c),Yf(Vf[b+1],l,u,c))))}}const Vf=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];for(let t=0;t<256;t++)Vf[256+t]=Vf[t];function qf(t){return t*t*t*(t*(6*t-15)+10)}function jf(t,e,i){return e+t*(i-e)}function Yf(t,e,i,n){const s=15&t,r=s<8?e:i,a=s<4?i:12==s||14==s?e:n;return(1&s?-r:r)+(2&s?-a:a)}class Gf extends kf{constructor(t){super(),c(this,"name","PaperPass"),c(this,"fsQuad"),c(this,"ctx"),c(this,"camera"),c(this,"version",0),c(this,"_width",0),c(this,"_height",0),this.camera=t,this.fsQuad=new Nf,this.ctx=Pn.getContext2D(this.fsQuad.texture.image,{alpha:!0}),this.needsSwap=!1,this._width=this.fsQuad.width,this._height=this.fsQuad.height,this.generatePerlin()}destroy(){super.destroy(),this.fsQuad.destroy()}setSize(t,e){this.fsQuad.renderTarget.setSize(t,e),this.fsQuad.width=t,this.fsQuad.height=e,this._width=t,this._height=e}generatePerlin(){!function(t,e,i){const n=new Uf,s=t.createImageData(e,i),r=s.data,a=2.5;for(let t=0;t<i;t++)for(let i=0;i<e;i++){const s=n.noise(i/a,t/a,0),o=Math.floor(128*(s+1)),h=4*(t*e+i);r[h]=o,r[h+1]=o,r[h+2]=o,r[h+3]=16}t.putImageData(s,0,0)}(this.ctx,this._width,this._height)}get currentVersion(){var t;return(null==(t=this.camera)?void 0:t.version)||0}render(t,e,i){const n=t.autoClear;t.autoClear=!1,this.currentVersion!==this.version&&(this.version=this.currentVersion),this._width===this.fsQuad.width&&this._height===this.fsQuad.height||(this.fsQuad.width=this._width,this.fsQuad.height=this._height,this.generatePerlin()),t.setRenderTarget(this.renderToScreen?void 0:i),t.renderTexture(this.fsQuad.texture),t.autoClear=n}}class $f extends Ts{constructor(){super(...arguments),c(this,"isDynamic",!0),c(this,"dynamically",!0)}}const Xf=t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),Zf=(t,e=0,i)=>{if(Xf(t)){return new(0,t.constructor)(t.subarray(e,void 0!==i?i:t.length))}return t.slice(e,i)},Jf=(t,e,i)=>t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t;class Qf{constructor(t,e,i,n){c(this,"parameterPositions"),c(this,"resultBuffer"),c(this,"sampleValues"),c(this,"valueSize"),c(this,"settings",null),c(this,"DefaultSettings_",{}),c(this,"__cacheIndex"),c(this,"_cachedIndex",0),this.parameterPositions=t,this.sampleValues=e,this.valueSize=i,this.resultBuffer=n||new Float32Array(i)}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],s=e[i-1];t:{e:{let r;i:{n:if(!(t<n)){for(let r=i+2;;){if(void 0===n){if(t<s)break n;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===r)break;if(s=n,n=e[++i],t<n)break e}r=e.length;break i}if(t>=s)break t;{const a=e[1];t<a&&(i=2,s=a);for(let r=i-2;;){if(void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(i===r)break;if(n=s,s=e[--i-1],t>=s)break e}r=i,i=0}}for(;i<r;){const n=i+r>>>1;t<e[n]?r=n:i=n+1}if(n=e[i],s=e[i-1],void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,n)}return this.interpolate_(i,s,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,s=t*n;for(let t=0;t!==n;++t)e[t]=i[s+t];return e}}class Kf extends Qf{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}intervalChanged_(){}}class tm extends Qf{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=(i-e)/(n-e),u=1-l;for(let t=0;t!==a;++t)s[t]=Number(r[h+t])*u+Number(r[o+t])*l;return s}intervalChanged_(){}}class em extends Qf{constructor(t,e,i,n){super(t,e,i,n),c(this,"_weightPrev",-0),c(this,"_offsetPrev",-0),c(this,"_weightNext",-0),c(this,"_offsetNext",-0),this.DefaultSettings_={endingStart:2400,endingEnd:2400}}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=this._offsetPrev,u=this._offsetNext,c=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),f=p*p,m=f*p,g=-c*m+2*c*f-c*p,y=(1+c)*m+(-1.5-2*c)*f+(-.5+c)*p+1,v=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let t=0;t!==a;++t)s[t]=g*Number(r[l+t])+y*Number(r[h+t])+v*Number(r[o+t])+x*Number(r[u+t]);return s}intervalChanged_(t,e,i){const n=this.parameterPositions;let s=t-2,r=t+1,a=n[s],o=n[r];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:s=t,a=2*e-i;break;case 2402:s=n.length-2,a=e+n[s]-n[s+1];break;default:s=t,a=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:r=t,o=2*i-e;break;case 2402:r=1,o=i+n[1]-n[0];break;default:r=t-1,o=e}const h=.5*(i-e),l=this.valueSize;this._weightPrev=h/(e-a),this._weightNext=h/(o-i),this._offsetPrev=s*l,this._offsetNext=r*l}}const im=2300,nm=2301,sm=2302;class rm{constructor(t,e,i,n){if(c(this,"name","KeyframeTrack"),c(this,"times"),c(this,"values"),c(this,"ValueTypeName",""),c(this,"DefaultInterpolation",nm),c(this,"createInterpolant"),c(this,"InterpolantFactoryMethodDiscrete",this._InterpolantFactoryMethodDiscrete),c(this,"InterpolantFactoryMethodLinear",this._InterpolantFactoryMethodLinear),c(this,"InterpolantFactoryMethodSmooth",this._InterpolantFactoryMethodSmooth),!e||!e.length)throw new Error("KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Jf(e,Float32Array),this.values=Jf(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Jf(t.times,Array),values:Jf(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}_InterpolantFactoryMethodDiscrete(t){return new Kf(this.times,this.values,this.getValueSize(),t)}_InterpolantFactoryMethodLinear(t){return new tm(this.times,this.values,this.getValueSize(),t)}_InterpolantFactoryMethodSmooth(t){return new em(this.times,this.values,this.getValueSize(),t)}getValueSize(){return Math.ceil(this.values.length/this.times.length)}setInterpolation(t){let e;switch(t){case im:e=this.InterpolantFactoryMethodDiscrete;break;case nm:e=this.InterpolantFactoryMethodLinear;break;case sm:e=this.InterpolantFactoryMethodSmooth}if(!e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return im;case this.InterpolantFactoryMethodLinear:return nm;case this.InterpolantFactoryMethodSmooth:return sm}}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let s=0,r=n-1;for(;s!==n&&i[s]<t;)++s;for(;-1!==r&&i[r]>e;)--r;if(++r,0!==s||r!==n){s>=r&&(r=Math.max(r,1),s=r-1);const t=this.getValueSize();this.times=Zf(i,s,r),this.values=Zf(this.values,s*t,r*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(t=!1);const i=this.times,n=this.values,s=i.length;0===s&&(t=!1);let r=null;for(let e=0;e!==s;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){t=!1;break}if(null!==r&&r>n){t=!1;break}r=n}if(void 0!==n&&Xf(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){t=!1;break}}return t}optimize(){const t=Zf(this.times),e=Zf(this.values),i=this.getValueSize(),n=this.getInterpolation()===sm,s=t.length-1;let r=1;for(let a=1;a<s;++a){let s=!1;const o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(n)s=!0;else{const t=a*i,n=t-i,r=t+i;for(let a=0;a!==i;++a){const i=e[t+a];if(i!==e[n+a]||i!==e[r+a]){s=!0;break}}}if(s){if(a!==r){t[r]=t[a];const n=a*i,s=r*i;for(let t=0;t!==i;++t)e[s+t]=e[n+t]}++r}}if(s>0){t[r]=t[s];for(let t=s*i,n=r*i,a=0;a!==i;++a)e[n+a]=e[t+a];++r}return r!==t.length?(this.times=Zf(t,0,r),this.values=Zf(e,0,r*i)):(this.times=t,this.values=e),this}clone(){const t=Zf(this.times,0),e=Zf(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}c(rm,"DefaultInterpolation",nm),rm.prototype.ValueBufferType=Float32Array;class am extends rm{constructor(){super(...arguments),c(this,"ValueTypeName","vector2")}}class om extends rm{constructor(){super(...arguments),c(this,"ValueTypeName","number")}}class hm extends rm{constructor(){super(...arguments),c(this,"ValueTypeName","color")}}class lm extends rm{constructor(){super(...arguments),c(this,"ValueTypeName","bool"),c(this,"DefaultInterpolation",im)}}lm.prototype.ValueBufferType=Array,lm.prototype.InterpolantFactoryMethodLinear=void 0,lm.prototype.InterpolantFactoryMethodSmooth=void 0;class um extends rm{constructor(){super(...arguments),c(this,"ValueTypeName","string"),c(this,"DefaultInterpolation",im)}}lm.prototype.ValueBufferType=Array,um.prototype.InterpolantFactoryMethodLinear=void 0,um.prototype.InterpolantFactoryMethodSmooth=void 0;class cm{constructor(t,e=-1,i,n=pm){c(this,"name","AnimationClip"),c(this,"duration"),c(this,"tracks"),c(this,"blendMode",pm),c(this,"uuid",fs()),this.name=t,this.duration=e,this.tracks=i,this.blendMode=n,this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,s=i.length;t!==s;++t)e.push(dm(i[t]).scale(n));const s=new this(t.name,t.duration,e,t.blendMode);return s.uuid=t.uuid,s}static toJSON(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push(rm.toJSON(i[t]));return n}static findByName(t,e){var i;let n;if(t.isShape){const e=t;n=(null==(i=e.geo)?void 0:i.animations)||e.animations}else n=t;for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t]}resetDuration(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new(0,this.constructor)(this.name,this.duration,t,this.blendMode)}toJSON(){return cm.toJSON(this)}}function dm(t){if(void 0===t.type)throw new Error("KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return om;case"vector":case"vector2":return am;case"color":return hm;case"bool":case"boolean":return lm;case"string":return um}throw new Error("KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];((t,e,i,n)=>{let s=1,r=t[0];for(;void 0!==r&&void 0===r[n];)r=t[s++];if(void 0===r)return;let a=r[n];if(void 0!==a)if(Array.isArray(a))do{a=r[n],void 0!==a&&(e.push(r.time),i.push.apply(i,a)),r=t[s++]}while(void 0!==r);else if(void 0!==a.toArray)do{a=r[n],void 0!==a&&(e.push(r.time),a.toArray(i,i.length)),r=t[s++]}while(void 0!==r);else do{a=r[n],void 0!==a&&(e.push(r.time),i.push(a)),r=t[s++]}while(void 0!==r)})(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const pm=2500;class fm{constructor(t,e,i){c(this,"path",""),c(this,"parsedPath"),c(this,"_targetGroup"),c(this,"_bindings"),c(this,"rootNode"),this.parsedPath=i||mm.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,this.parsedPath)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=i.length;n!==s;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}class mm{constructor(t,e,i){c(this,"path"),c(this,"parsedPath"),c(this,"node"),c(this,"rootNode"),c(this,"getValue",this._getValue_unbound),c(this,"setValue",this._setValue_unbound),c(this,"targetObject"),c(this,"propertyName"),c(this,"resolvedProperty"),c(this,"propertyIndex",-1),c(this,"BindingType",{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3,ColorString:4}),c(this,"Versioning",{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2}),c(this,"GetterByBindingType",[this._getValue_direct,this._getValue_array,this._getValue_arrayElement,this._getValue_toArray,this._getValue_color]),c(this,"SetterByBindingTypeAndVersioning",[[this._setValue_direct,this._setValue_direct_setNeedsUpdate,this._setValue_direct_setMatrixWorldNeedsUpdate],[this._setValue_array,this._setValue_array_setNeedsUpdate,this._setValue_array_setMatrixWorldNeedsUpdate],[this._setValue_arrayElement,this._setValue_arrayElement_setNeedsUpdate,this._setValue_arrayElement_setMatrixWorldNeedsUpdate],[this._setValue_fromArray,this._setValue_fromArray_setNeedsUpdate,this._setValue_fromArray_setMatrixWorldNeedsUpdate],[this._setValue_color,this._setValue_color_setNeedsUpdate,this._setValue_color_setMatrixWorldNeedsUpdate]]),this.path=e,this.parsedPath=i||mm.parseTrackName(e),this.node=mm.findNode(t,this.parsedPath.nodeName),this.rootNode=t}static create(t,e,i){return t&&t.isAnimationObjectGroup?new fm(t,e,i):new mm(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(ym,"")}static parseTrackName(t){const e=Em.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4]?parseInt(e[4]):void 0,propertyName:e[5],propertyIndex:e[6]?parseInt(e[6]):void 0},n=i.nodeName&&i.nodeName.lastIndexOf(".")||void 0;if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==Mm.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||void 0===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;const i=t.getObjectByProperty("name",e)||t.getObjectByProperty("uuid",e);return i||void 0}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){this.targetObject&&this.propertyName&&(t[e]=this.targetObject[this.propertyName])}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_getValue_color(t,e){const i=Re.getArray(this.resolvedProperty);for(let n=0,s=i.length;n<s;n++)t[e++]=i[n]}_setValue_direct(t,e){this.targetObject&&this.propertyName&&(this.targetObject[this.propertyName]=t[e])}_setValue_direct_setNeedsUpdate(t,e){this.targetObject&&this.propertyName&&(this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0)}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&this.propertyName&&(this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0)}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){if(!this.targetObject)return;const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){if(!this.targetObject)return;const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0)}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0)}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0)}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0)}_setValue_color(t,e){this.targetObject&&this.propertyName&&(this.resolvedProperty=this.targetObject[this.propertyName]=Am.fromArray(t,e).getStyle())}_setValue_color_setNeedsUpdate(t,e){this.targetObject&&(this._setValue_color(t,e),this.targetObject.needsUpdate=!0)}_setValue_color_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&(this._setValue_color(t,e),this.targetObject.matrixWorldNeedsUpdate=!0)}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let s=e.propertyIndex;if(t||(t=mm.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return;if(i){let n=e.objectIndex;if(void 0===t[i])return;if(t=t[i],void 0!==n){if(void 0===t[n])return;t=t[n]}}if(!t)return;const r=t[n];if(void 0===r){e.nodeName;return}let a=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;void 0!==s?(o=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s):void 0!==r.fromArray&&void 0!==r.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(o=this.BindingType.EntireArray,this.resolvedProperty=r):r&&Re.isColor(r)?(o=this.BindingType.ColorString,this.resolvedProperty=r,this.propertyName=n):this.propertyName=n,this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=void 0,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}const gm="\\[\\]\\.:\\/",ym=new RegExp("["+gm+"]","g"),vm="[^"+gm+"]",xm="[^"+gm.replace("\\.","")+"]",bm=/((?:WC+[\/:])*)/.source.replace("WC",vm),wm=/(WCOD+)?/.source.replace("WCOD",xm),_m=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",vm),Sm=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",vm),Em=new RegExp("^"+bm+wm+_m+Sm+"$"),Mm=["material","materials","bones","map","mat","mtl","geo","l"],Am=new Re;class Tm{constructor(t,e,i){let n,s,r;switch(c(this,"binding"),c(this,"valueSize"),c(this,"buffer"),c(this,"_workIndex",0),c(this,"_mixBufferRegion"),c(this,"_mixBufferRegionAdditive"),c(this,"_setIdentity"),c(this,"_origIndex",3),c(this,"_addIndex",4),c(this,"_cacheIndex"),c(this,"cumulativeWeight",0),c(this,"cumulativeWeightAdditive",0),c(this,"useCount",0),c(this,"referenceCount",0),this.binding=t,this.valueSize=i,e){case"fill":case"stroke":case"textFill":case"string":case"bool":n=this._select,s=this._select,r=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,s=this._lerpAdditive,r=this._setAdditiveIdentityNumeric,this.buffer=new Float32Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=s,this._setIdentity=r,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const i=this.buffer,n=this.valueSize,s=t*n+n;let r=this.cumulativeWeight;if(0===r){for(let t=0;t!==n;++t)i[s+t]=i[t];r=e}else{r+=e;const t=e/r;this._mixBufferRegion(i,s,0,t,n)}this.cumulativeWeight=r}accumulateAdditive(t){const e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,i=this.buffer,n=t*e+e,s=this.cumulativeWeight,r=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const t=e*this._origIndex;this._mixBufferRegion(i,n,t,1-s,e)}r>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let t=e,s=e+e;t!==s;++t)if(i[t]!==i[t+e]){a.setValue(i,n);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let t=i,s=n;t!==s;++t)e[t]=e[n+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,n,s){if(n>=.5)for(let n=0;n!==s;++n)t[e+n]=t[i+n]}_lerp(t,e,i,n,s){const r=1-n;for(let a=0;a!==s;++a){const s=e+a;t[s]=t[s]*r+t[i+a]*n}}_lerpAdditive(t,e,i,n,s){for(let r=0;r!==s;++r){const s=e+r;t[s]=t[s]+t[i+r]*n}}}const Cm=2400,Im=2401;class Dm{constructor(t,e,i,n=e.blendMode){c(this,"blendMode"),c(this,"loop",2201),c(this,"time",0),c(this,"timeScale",1),c(this,"weight",1),c(this,"repetitions",1/0),c(this,"paused",!1),c(this,"enabled",!0),c(this,"clampWhenFinished",!1),c(this,"zeroSlopeAtStart",!0),c(this,"zeroSlopeAtEnd",!0),c(this,"_mixer"),c(this,"_clip"),c(this,"_localRoot"),c(this,"_interpolantSettings"),c(this,"_interpolants"),c(this,"_propertyBindings"),c(this,"_cacheIndex"),c(this,"_byClipCacheIndex"),c(this,"_timeScaleInterpolant"),c(this,"_weightInterpolant"),c(this,"_loopCount",-1),c(this,"_startTime"),c(this,"_effectiveTimeScale",1),c(this,"_effectiveWeight",1),this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;const s=e.tracks,r=s.length,a=new Array(r),o={endingStart:Cm,endingEnd:Cm};for(let t=0;t!==r;++t){const e=s[t].createInterpolant();e&&(a[t]=e,e.settings=o)}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r)}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=void 0,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&void 0===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}stopFading(){const t=this._weightInterpolant;return void 0!==t&&(this._weightInterpolant=void 0,this._mixer._takeBackControlInterpolant(t)),this}stopWarping(){const t=this._timeScaleInterpolant;return void 0!==t&&(this._timeScaleInterpolant=void 0,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);const s=this._startTime;if(void 0!==s){const n=(t-s)*i;n<0||0===i?e=0:(this._startTime=void 0,e=i*n)}e*=this._updateTimeScale(t);const r=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(r),e[i].accumulateAdditive(a);else for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(r),e[i].accumulate(n,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(void 0!==i){const n=i.evaluate(t)[0];e*=Number(n),t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(void 0!==i){const n=i.evaluate(t)[0];e*=Number(n),t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let n=this.time+t,s=this._loopCount;const r=2202===i;if(0===t)return-1===s||!r||1&~s?n:e-n;if(2200===i){-1===s&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",data:{action:this,direction:t<0?-1:1}})}}else{if(-1===s&&(t>=0?(s=0,this._setEndings(!0,0===this.repetitions,r)):this._setEndings(0===this.repetitions,!0,r)),n>=e||n<0){const i=Math.floor(n/e);n-=e*i,s+=Math.abs(i);const a=this.repetitions-s;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",data:{action:this,direction:t>0?1:-1}});else{if(1===a){const e=t<0;this._setEndings(e,!e,r)}else this._setEndings(!1,!1,r);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",data:{action:this,loopDelta:i}})}}else this.time=n;if(r&&!(1&~s))return e-n}return n}_setEndings(t,e,i){const n=this._interpolantSettings;i?(n.endingStart=Im,n.endingEnd=Im):(n.endingStart=t?this.zeroSlopeAtStart?Im:Cm:2402,n.endingEnd=e?this.zeroSlopeAtEnd?Im:Cm:2402)}}const Lm=new Float32Array(1);class Bm extends Fi{constructor(t){super(),c(this,"stats"),c(this,"time",0),c(this,"timeScale",1),c(this,"_root"),c(this,"_accuIndex",0),c(this,"_actions",[]),c(this,"_nActiveActions",0),c(this,"_actionsByClip",{}),c(this,"_bindings",[]),c(this,"_nActiveBindings",0),c(this,"_bindingsByRootAndName",{}),c(this,"_controlInterpolants",[]),c(this,"_nActiveControlInterpolants",0),this._root=t,this._initMemoryManager()}destroy(){super.destroy(),this.stopAllAction(),this._root=void 0}dispose(){this._root=void 0}bind(t){t&&(this._root=t)}_bindAction(t,e){if(!this._root)return;const i=t._localRoot||this._root,n=t._clip.tracks,s=n.length,r=t._propertyBindings,a=t._interpolants,o=i.uuid,h=this._bindingsByRootAndName;let l=h[o];void 0===l&&(l={},h[o]=l);for(let t=0;t!==s;++t){const s=n[t],h=s.name;let u=l[h];if(void 0===u){if(u=r[t],void 0!==u){void 0===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,h));continue}const n=e&&e._propertyBindings[t].binding.parsedPath,a=s.getValueSize();u=new Tm(mm.create(i,h,n),s.ValueTypeName,a),++u.referenceCount,this._addInactiveBinding(u,o,h),r[t]=u}else++u.referenceCount,r[t]=u;a[t].resultBuffer=u.buffer}}_activateAction(t){if(this._root&&!this._isActiveAction(t)){if(void 0===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return void 0!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){const n=this._actions,s=this._actionsByClip;let r=s[e];if(void 0===r)r={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,s[e]=r;else{const e=r.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=n.length,n.push(t),r.actionByRoot[i]=t}_removeInactiveAction(t){if(!this._root)return;const e=this._actions,i=e[e.length-1],n=t._cacheIndex||0;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=void 0;const s=t._clip.uuid,r=this._actionsByClip,a=r[s],o=a.knownActions,h=o[o.length-1],l=t._byClipCacheIndex||0;h._byClipCacheIndex=l,o[l]=h,o.pop(),t._byClipCacheIndex=void 0;delete a.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete r[s],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(t){if(void 0===t._cacheIndex)return;const e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_takeBackAction(t){if(void 0===t._cacheIndex)return;const e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_addInactiveBinding(t,e,i){const n=this._bindingsByRootAndName,s=this._bindings;let r=n[e];void 0===r&&(r={},n[e]=r),r[i]=t,t._cacheIndex=s.length,s.push(t)}_removeInactiveBinding(t){var e;const i=this._bindings,n=t.binding,s=(null==(e=n.rootNode)?void 0:e.uuid)||"",r=n.path,a=this._bindingsByRootAndName,o=a[s],h=i[i.length-1],l=t._cacheIndex||0;h._cacheIndex=l,i[l]=h,i.pop(),delete o[r],0===Object.keys(o).length&&delete a[s]}_lendBinding(t){if(void 0===t._cacheIndex)return;const e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_takeBackBinding(t){if(void 0===t._cacheIndex)return;const e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=t[e];return void 0===i&&(i=new tm(new Float32Array(2),new Float32Array(2),1,Lm),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){if(void 0===t.__cacheIndex)return;const e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,s=e[n];t.__cacheIndex=n,e[n]=t,s.__cacheIndex=i,e[i]=s}clipAction(t,e,i){if(!this._root)return;const n=e||this._root,s=n.uuid;let r;r="string"==typeof t?cm.findByName(n,t):t;const a=r?r.uuid:"",o=this._actionsByClip[a];let h;if(void 0===i&&(i=r?r.blendMode:pm),void 0!==o){const t=o.actionByRoot[s];if(void 0!==t&&t.blendMode===i)return t;h=o.knownActions[0],void 0===r&&(r=h._clip)}if(void 0===r)return;const l=new Dm(this,r,e,i);return this._bindAction(l,h),this._addInactiveAction(l,a,s),l}existingAction(t,e){if(!this._root)return;const i=e||this._root,n=i.uuid;let s="string"==typeof t?cm.findByName(i,t):t;const r=s?s.uuid:"",a=this._actionsByClip[r];return void 0!==a&&a.actionByRoot[n]||void 0}removeAction(t){t&&this._deactivateAction(t)}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,n=this.time+=t,s=Math.sign(t),r=this._accuIndex^=1;for(let a=0;a!==i;++a){e[a]._update(n,t,s,r)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(r);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,i=t.uuid,n=this._actionsByClip,s=n[i];if(void 0!==s){const t=s.knownActions;for(let i=0,n=t.length;i!==n;++i){const n=t[i];this._deactivateAction(n);const s=n._cacheIndex||0,r=e[e.length-1];n._cacheIndex=void 0,n._byClipCacheIndex=void 0,r._cacheIndex=s,e[s]=r,e.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(t){const e=t.uuid,i=this._actionsByClip;for(const t in i){const n=i[t].actionByRoot[e];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}const n=this._bindingsByRootAndName[e];if(void 0!==n)for(const t in n){const e=n[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const i=this.existingAction(t,e);void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class Pm extends op{constructor(t,e={}){var i,n;let s;s=Nn.parse(t),ri.set(e,"use3DShape",km);const r=rf.getShapesByParsed(s,e);if(!(null==r?void 0:r.length))throw new Error(`Svg: no shapes: ${t}`);super(null==(i=null==r?void 0:r[0])?void 0:i.geo,null==(n=null==r?void 0:r[0])?void 0:n.mtl),c(this,"name","Svg"),c(this,"composeNode",!0),(null==r?void 0:r.length)>1&&this.adds(r.slice(1))}}const km=!1;class Nm extends op{constructor(t){const e=new xp(t),i=new rp(t);(null==t?void 0:t.lineWidth)||(i.lineWidth=1),super(e,i),c(this,"name","Polygon")}}class Om extends $f{constructor(t={}){var e,i;super(),c(this,"isLoadingScene",!0),c(this,"name","LoadingScene"),c(this,"params"),c(this,"loadingShape"),c(this,"lineShape"),c(this,"triangleShape"),c(this,"scales",[.95,1.15,.002]),c(this,"l",0),c(this,"scaleTrend",!1),c(this,"clock",new Df),c(this,"mixer"),c(this,"_selectedClip"),c(this,"selectedAction"),this.params=t,this.loadingShape=new Pm(Rm,{fill:Le.darkGray,flipY:!0}),this.loadingShape.name="loading",this.loadingShape.dynamically=!0,this.add(this.loadingShape),this.loadingShape.setScale(.5,.5).updateMatrix(),this.loadingShape.updateMatrixWorld(),this.loadingShape.computeBoundingBox(),this.loadingShape.updateBoundingBox(),Wm.copy(this.loadingShape.boundingBoxWorld).getCenter(zm),Wm.getSize(Hm),this.loadingShape.setPosition(zm.negate()).updateMatrix(),this.l=Hm.x;const n=Math.max(Math.floor(this.l/30),3),s=[-this.l/2,-(8+n),-this.l/2,-8,this.l/2,-8,this.l/2,-(8+n)];this.lineShape=new Nm({points:s,fill:Le.darkGray}),this.add(this.lineShape),this.lineShape.name="loadingLine";const r=[0,0,Hm.x/2,Hm.x,Hm.x,0];this.triangleShape=new Nm({points:r,fill:Le.darkRed}),this.add(this.triangleShape),this.triangleShape.name="loadingTriangle",this.triangleShape.setPosition(new We(-.12*Hm.x,Hm.y/-.36)).setScale(.25,.15).updateMatrix(),this.computeBoundingBox(),this.mixer=new Bm(this);const a=new am(`${this.loadingShape.name}.mtl.fill`,[0,1.2,2],[0,0,0,.7,.38,.38,.38,.6,0,0,0,.7]),o=new om(`${this.triangleShape.name}.mtl.fillOpacity`,[0,1.5,3],[1,.1,1],om.DefaultInterpolation),h=new am(`${this.lineShape.name}.scaled`,[0,.3,1],[1,1,.1,1,1,1]);this._selectedClip=new cm("selected",3,[a,o,h]),this.selectedAction=null==(e=this.mixer)?void 0:e.clipAction(this._selectedClip,this.desScene),null==(i=this.selectedAction)||i.play()}destroy(){super.destroy()}onBeforeRender(){this.lineShape.updateMatrix()}update(){var t;null==(t=this.mixer)||t.update(this.clock.getDelta())}}const Rm='\n<path d="M0 20.7L0 0L7.272 0L7.272 18L20.592 18L19.08 20.7L0 20.7\nM30.78 2.772L30.78 17.928L41.4 17.928L41.4 0L48.708 0L48.708 20.7L23.472 20.7L23.472 0L41.4 0L38.88 2.772L30.78 2.772\nM62.388 12.924L71.028 12.924L68.904 15.768L61.2 15.768L59.292 20.7L51.588 20.7L59.94 0L73.188 0L81.576 20.7L73.944 20.7L71.028 12.924L67.14 2.772L65.988 2.772L62.388 12.924\nM109.728 17.784L106.884 20.7L84.456 20.7L84.456 0L102.528 0L99.972 2.844L91.656 2.844L91.656 17.928L102.528 17.928L102.528 0L107.136 0L109.728 2.7L109.728 17.784\nM119.628 20.7L112.608 20.7L112.608 0L119.628 0L119.628 20.7\nM139.752 20.7L129.78 6.3L129.78 20.7L122.508 20.7L122.508 0L130.644 0L140.58 14.652L140.58 0L147.78 0L147.78 20.7L139.752 20.7\nM168.732 18L168.732 10.728L163.368 10.728L163.368 7.992L175.932 7.992L175.932 20.7L168.732 20.7L168.732 18.504L166.572 20.7L150.66 20.7L150.66 0L176.04 0L174.456 2.7L158.04 2.7L158.04 18L168.732 18\nZ">\n</path>\n',zm=new We,Hm=new We,Wm=new ai;class Fm extends Fi{constructor(t={}){var e,i;super(),c(this,"name","View"),c(this,"params"),c(this,"visible",!0),c(this,"cvs"),c(this,"scene"),c(this,"scenes",[]),c(this,"camera"),c(this,"controller"),c(this,"tween"),c(this,"animateDuration"),c(this,"controlsChangedHandler",this.handleControlsChanged.bind(this)),this.params=t,this.animateDuration=this.params.animateDuration||300,this.cvs=t.cvs,this.camera=new Ks(t.camera||{}),this.params.inpEl?this.controller=new Fh(this.params.inpEl,this.camera):this.controller=new Fh(this.cvs,this.camera),void 0!==(null==(e=this.params.controls)?void 0:e.enableRotate)&&(this.controller.enableRotate=!!(null==(i=this.params.controls)?void 0:i.enableRotate))}destroy(){this.controller&&this.controller.destroy(),this.camera&&this.camera.destroy(),this.scene&&this.scene.destroy(),this.scenes.forEach((t=>t.destroy())),this.scenes.length=0,super.destroy()}resize(){var t;this.camera.resize(),null==(t=this.controller)||t.resize()}setEnablePan(t){this.controller&&(this.controller.enablePan=!!t)}bindEvents(){var t;null==(t=this.controller)||t.addEventListener("change",this.controlsChangedHandler)}unbindEvents(){var t;null==(t=this.controller)||t.removeEventListener("change",this.controlsChangedHandler)}handleControlsChanged(t){}bindScene(t){this.scenes.push(t),this.reset(),this.scene=t,t.isStatic}getCameraPosition(){return this.camera.boundingBoxWorld}setCameraPosition(t,e=!0){return jm.copy(t),this.resetCameraByBoundingBox(jm,e)}saveCameraPosition(t){jm.copy(this.camera.boundingBoxWorld);const e=t?Um+t:Um;sessionStorage.setItem(e,JSON.stringify(jm))}clearCameraPosition(t){const e=t?Um+t:Um;sessionStorage.setItem(e,"")}restoreCameraPosition(t){const e=t?Um+t:Um,i=sessionStorage.getItem(e);i&&(jm.copy(JSON.parse(i)),this.resetCameraByBoundingBox(jm,!0))}zoomIn(){jm.copy(this.camera.boundingBoxWorld).getSize(Vm),jm.expandByScalar(-.1*Math.max(Vm.x,Vm.y)),this.resetCameraByBoundingBox(jm,!0)}zoomOut(){this.controller&&(jm.copy(this.camera.boundingBoxWorld).getSize(Vm),jm.expandByScalar(.1*Math.max(Vm.x,Vm.y)),this.resetCameraByBoundingBox(jm,!0))}fullscreen(t=10,e=!1){this.scene&&(this.scene.boundingBox.isEmpty()&&this.scene.computeBoundingBox(),"function"==typeof this.scene.computeBoundingBox?jm.copy(this.scene.computeBoundingBox()):jm.copy(this.scene.boundingBox),jm.expandByVector(Vm.set(t,t)),this.resetCameraByBoundingBox(jm,e))}handleCameraChanged(t){}reset(){}resetCameraByBoundingBox(t,e=!1){return d(this,null,(function*(){if(!this.camera)return;if(!t||t.isEmpty())throw new Error("BoundingBox empty");if(!e)return this.camera.setByBox(t),Promise.resolve();const i=this.camera.getCameraPosition();t.getCenter(Vm),t.getSize(qm);const n=Math.max(qm.x/this.camera.width,qm.y/this.camera.height),s={x:Vm.x,y:Vm.y,z:0,s:n,r:0};yield this.animateCamera(i,s)}))}animateCamera(t,e){return d(this,null,(function*(){return this.controller&&(this.controller.enabled=!1),this.tween&&this.tween.stop(),new Promise((i=>{this.tween=new zo.Tween(t).to(e,this.animateDuration).easing(zo.Easing.Exponential.Out).onUpdate((t=>{this.camera.position.set(t.x,t.y),this.camera.scaled.set(t.s,t.s),this.camera.rotation.set(t.r,t.r),this.camera.update()})).onComplete((()=>{this.controller&&(this.controller.enabled=!0),i()})).start()}))}))}computeBoundingBox(t,e=new ai){return t&&t.length?(e.makeEmpty(),t.forEach((t=>e.union(t.computeBoundingBox()))),e):e}expandScenesBoundingBox(t,e=new ai){t.forEach((t=>t.boundingBox.union(e)))}update(t){this.tween&&this.tween.update(t)}}const Um="camera_position_",Vm=new We,qm=new We,jm=new ai;class Ym extends Ts{constructor(){super(...arguments),c(this,"isStatic",!0),c(this,"featureKey","StaticScene_"+this.id),c(this,"cameraVersion",0),c(this,"dynamically",!1),c(this,"needsUpdateChangedHandler",this.handleNeedsUpdateChanged.bind(this))}handleNeedsUpdateChanged(){this.needsUpdate=!0}}class Gm extends jh{constructor(t){super(t),c(this,"name","GeoPolyline"),this._init(t),((null==t?void 0:t.stArrow)||(null==t?void 0:t.edArrow))&&(this.arrowLength=(null==t?void 0:t.arrowLength)||10,this.arrowDeg=(null==t?void 0:t.arrowDeg)||30)}buildPath(t,e,i){if(0===this.percent)return;let{points:n}=e||this;if(n&&n.length&&!(n.length<2)){for(let e=0,i=n.length;e<i;e+=2)e?t.lineTo(n[e],n[e+1]):t.moveTo(n[e],n[e+1]);this.addArrow(t)}}addArrow(t,e){const{points:i,stArrow:n,edArrow:s,arrowDeg:r,arrowLength:a}=this;if(!(null==i?void 0:i.length)||!n&&!s||!r)return this;if(e||(e=a),!e)return this;const o=i;if(!(null==o?void 0:o.length)||(null==o?void 0:o.length)<4)return this;if(n){if($m.set(o[2],o[3]),Zm.set(o[0],o[1]),$m.equals(Zm))return this;Xm.subVectors($m,Zm),Jm.lerpVectors(Zm,$m,e/Xm.length()),Qm.copy(Jm).rotateAround(Zm,Ie(r)),Km.copy(Jm).rotateAround(Zm,-Ie(r)),t.moveTo(Qm.x,Qm.y),t.lineTo(Zm.x,Zm.y),t.lineTo(Km.x,Km.y)}if(s){const i=o.length;if($m.set(o[i-4],o[i-3]),Zm.set(o[i-2],o[i-1]),$m.equals(Zm))return this;Xm.subVectors($m,Zm),Jm.lerpVectors(Zm,$m,e/Xm.length()),Qm.copy(Jm).rotateAround(Zm,Ie(r)),Km.copy(Jm).rotateAround(Zm,-Ie(r)),t.moveTo(Qm.x,Qm.y),t.lineTo(Zm.x,Zm.y),t.lineTo(Km.x,Km.y)}return this}}const $m=new We,Xm=new We,Zm=new We,Jm=new We,Qm=new We,Km=new We;class tg extends op{constructor(t={}){(null==t?void 0:t.width)||(t.width=.5*Ae.config.width),(null==t?void 0:t.height)||(t.height=.5*Ae.config.height),(null==t?void 0:t.lineWidth)||(t.lineWidth=1),(null==t?void 0:t.stroke)||(t.stroke=Le.darkRed),(null==t?void 0:t.arrowDeg)||(t.arrowDeg=30),(null==t?void 0:t.arrowLength)||(t.arrowLength=10),(null==t?void 0:t.lineDash)||(t.lineDash=[10,7]),t.points=[-t.width,0,t.width,0,0,t.height,0,-t.height];const e=.5*(t.arrowLength||10);super(new xp({points:[-e,0,0,e,e,0,0,-e]}),new rp({fill:Le.darkRed})),c(this,"name","Axes"),c(this,"params"),c(this,"xShape"),c(this,"yShape"),c(this,"xRShape"),c(this,"yRShape"),this.params=t,this.xShape=new op(new Gm({points:[2*e,0,t.width,0],linewidth:t.lineWidth,edArrow:!0,arrowLength:t.arrowLength,arrowDeg:t.arrowDeg}),new rp({stroke:Le.darkRed,lineWidth:1})),this.yShape=new op(new Gm({points:[0,2*e,0,t.height],linewidth:t.lineWidth,edArrow:!0,arrowLength:t.arrowLength,arrowDeg:t.arrowDeg}),new rp({stroke:Le.darkGreen,lineWidth:1})),this.xRShape=new op(new Gm({points:[-2*e,0,-t.width,0],linewidth:t.lineWidth}),new rp({stroke:Le.darkRed,lineWidth:1,lineDash:t.lineDash})),this.yRShape=new op(new Gm({points:[0,-2*e,0,-t.height],linewidth:t.lineWidth}),new rp({stroke:Le.darkGreen,lineWidth:1,lineDash:t.lineDash})),this.add(this.xShape),this.add(this.yShape),this.add(this.xRShape),this.add(this.yRShape),this.computeBoundingBox()}computeBoundingBox(){var t;return(null==(t=this.params)?void 0:t.fixed)?this.boundingBox.makeEmpty():super.computeBoundingBox(),this.boundingBox}updateModelViewMatrix(t){var e;(null==(e=this.params)?void 0:e.fixed)?t?(this.modelViewMatrix.copy(t.viewMatrix),this.computeAxes(t)):this.modelViewMatrix.copy(this.matrixWorld):super.updateModelViewMatrix(t)}computeAxes(t){if(!t)return;t.updateBoundingBox();const e=t.scaled.x,i=this.params.lineWidth*e,n=[this.params.lineDash[0]*e,this.params.lineDash[1]*e],s=(this.params.arrowLength||10)*e,r=s/4;this.xShape.geo.arrowLength=s,this.xShape.geo.setPoints([s+r,0,t.boundingBoxWorld.max.x,0]),this.xShape.geo.lineWidth=i,this.yShape.geo.arrowLength=s,this.yShape.geo.setPoints([0,s+r,0,t.boundingBoxWorld.max.y]),this.yShape.geo.lineWidth=i,this.xRShape.geo.setPoints([-s-r,0,t.boundingBoxWorld.min.x,0]),this.xRShape.geo.lineWidth=i,this.xRShape.mtl.lineDash=n,this.yRShape.geo.setPoints([0,-s-r,0,t.boundingBoxWorld.min.y]),this.yRShape.geo.lineWidth=i,this.yRShape.mtl.lineDash=n,this.geo.setPoints([-s,0,-r,r,0,s,r,r,s,0,r,-r,0,-s,-r,-r])}}class eg extends Ym{constructor(t={},e){super(),c(this,"isMainScene",!0),c(this,"name","MainScene"),c(this,"params"),c(this,"adapter"),c(this,"featureKey","MainScene_"+this.id),c(this,"axesHelper"),c(this,"resourcesMap",{}),c(this,"legend",[]),c(this,"_viewBox",new ai),this.params=t,this.adapter=e,this.selectable=!0,this.initAxesHelper()}destroy(){var t;super.destroy(),this.resourcesMap={},this.legend=[],null==(t=this.axesHelper)||t.destroy()}initAxesHelper(){this.params.axesHelper&&(this.axesHelper&&this.axesHelper.destroy(),this.axesHelper=new tg({fixed:!0,lineWidth:.5}),this.add(this.axesHelper))}setViewBox(t){t&&this._viewBox.copy(t)}computeBoundingBox(){if(super.computeBoundingBox(),!this._viewBox.isEmpty()){this._viewBox.getCenter(ig),this.boundingBox.getCenter(ng);if(Math.round(We.getDistance(ig,ng)))return this._viewBox}return this.boundingBox}getBoundingBox(){return this._viewBox.isEmpty()?this.boundingBox:this._viewBox}add(t){return super.add(t),t.userData.id?(this.resourcesMap[t.userData.id]||(this.resourcesMap[t.userData.id]=[]),this.resourcesMap[t.userData.id].push(t),this):this}remove(t){if(!t)return this;if(super.remove(t),this.resourcesMap[t.userData.id]){const e=this.resourcesMap[t.userData.id].indexOf(t);e>-1&&this.resourcesMap[t.userData.id].splice(e,1),this.resourcesMap[t.userData.id].length||delete this.resourcesMap[t.userData.id]}return this}getAssetIdsByType(t){const e=[];return this.traverse((i=>{i.userData.assetType===t&&i.userData.id&&e.push(i.userData.id)})),e}getByIds(t,e=[]){if(e.length=0,!t)return e;Array.isArray(t)||(t=[t]);for(let i=0,n=(null==t?void 0:t.length)||0;i<n;i++)Object.hasOwnProperty.call(this.resourcesMap,t[i])&&e.push(...this.resourcesMap[t[i]]);return e}setFillOrStrokeByIds(t,e,i="fill"){this.traverse((n=>{var s;if(!n.mtl||!t.includes(n.userData.id))return;const r=ri.cloneDeep(n.mtl);"fill"===i?r.fill=e:"stroke"===i&&(r.stroke=e,r.lineWidth=5),n.mtl=yp.getMtl(r),this.addLegend(i,e,null==(s=n.userData)?void 0:s.id)})),this.needsUpdate=!0}clearFillOrStroke(t,e){this.traverse((i=>{var n,s,r,a,o,h;if(!i.mtl)return;if(e&&!e.includes(i.userData.id))return;const l=ri.cloneDeep(i.mtl);void 0!==t&&"fill"!==t||!(null==l?void 0:l.fill)||(l.fill=(null==(s=null==(n=i.userData)?void 0:n.style)?void 0:s.fill)||void 0),void 0!==t&&"stroke"!==t||!(null==l?void 0:l.stroke)||(l.stroke=(null==(a=null==(r=i.userData)?void 0:r.style)?void 0:a.stroke)||void 0,l.lineWidth=(null==(h=null==(o=i.userData)?void 0:o.style)?void 0:h.lineWidth)||1),i.mtl=yp.getMtl(l)})),this.needsUpdate=!0,this.clearLegendBy(t)}increaseFontSize(t=1.1){this.traverse((e=>{var i;e.mtl&&e.isText&&(null==(i=e.mtl)?void 0:i.text)&&(e.scaled.multiplyScalar(t),e.updateMatrix(),e.needsUpdate=!0)}));const e=ri.uniq(ri.compact(ri.map(this.children,(t=>t.userData.aid))));this.recomputedAssetLabels(e),this.needsUpdate=!0}increaseStrokeWidth(t=1.1){this.traverse((e=>{var i;e.mtl&&(null==(i=e.mtl)?void 0:i.stroke)&&e.geo.lineWidth&&(e.geo.lineWidth*=t)})),this.needsUpdate=!0}addLegend(t,e,i){let n=this.legend.find((t=>t.color===e));n||(n={type:t,color:e,ids:[]},this.legend.push(n)),n.ids.push(i)}getLegend(){return this.legend}clearLegendBy(t){var e;t||(this.legend.length=0);for(let i=(null==(e=this.legend)?void 0:e.length)-1;i>=0;i--)this.legend[i].type===t&&this.legend.splice(i,i)}getAssetLabels(t,e){var i,n,s,r,a;const o=ri.filter(this.children,(t=>{var i;return(null==(i=t.userData)?void 0:i.aid)===e}));if(!(null==o?void 0:o.length))return;const h=[];for(let t,e=0,l=o.length;e<l;e++){t=o[e],(null==(i=t.mtl)?void 0:i.text)&&h.push(null==(n=t.mtl)?void 0:n.text);for(let e,i=0,n=(null==(s=null==t?void 0:t.children)?void 0:s.length)||0;i<n;i++)e=t.children[i],(null==(r=null==e?void 0:e.mtl)?void 0:r.text)&&h.push(null==(a=null==e?void 0:e.mtl)?void 0:a.text)}return h}setAssetLabels(t,e){if(!ri.find(this.children,(e=>{var i;return(null==(i=e.userData)?void 0:i.id)===t})))return;const i=ri.filter(this.children,(e=>{var i;return(null==(i=e.userData)?void 0:i.aid)===t}));if(!(null==i?void 0:i.length))return;const n=i[i.length-1];for(let t=0,s=((null==e?void 0:e.length)||0)-((i.length||0)-1);t<s;t++){const t=n.clone(!0,!0);this.add(t),t.updateMatrix(),i.push(t)}for(let t=1,n=(null==i?void 0:i.length)||0;t<n;t++){const n=i[t];n.mtl.text=(null==e?void 0:e.length)?e[t-1]:void 0,n.needsUpdate=!0}this.recomputedAssetLabels(t)}recomputedAssetLabels(t){if(t){Array.isArray(t)||(t=[t]);for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++){let i=ri.filter(this.children,(i=>{var n,s;return(null==(n=i.userData)?void 0:n.aid)===t[e]&&!!(null==(s=i.mtl)?void 0:s.text)}));if(!(null==i?void 0:i.length))return;for(let t,e=0,n=(null==i?void 0:i.length)||0;e<n;e++)t=i[e],t.computeBoundingBox(),t.updateBoundingBox(),sg.copy(t.boundingBoxWorld).getSize(ng),ig.copy(i[e?e-1:0].position),ng.multiplyScalar(1.2),e&&(t.position.set(ig.x,ig.y-ng.y),t.updateMatrix())}}}clearAssetLabels(t){const e=t?this.getAssetIdsByType(t):this.children.map((t=>t.userData.id&&t.userData.assetType));for(let t,i=0,n=(null==e?void 0:e.length)||0;i<n;i++)if(t=ri.filter(this.children,(t=>{var n;return(null==(n=t.userData)?void 0:n.aid)===e[i]})),(null==t?void 0:t.length)&&1!==t.length)for(let e=t.length-1;e>0;e--)t[e].destroy(),this.remove(t[e])}getAssetBoundingBox(t,e=new ai){if(e.makeEmpty(),!t)return e;Array.isArray(t)||(t=[t]);for(let i,n=0,s=(null==t?void 0:t.length)||0;n<s;n++){i=t[n];const s=this.getByIds(i);if(null==s?void 0:s.length)for(let t=0,i=s.length;t<i;t++)e.union(s[t].boundingBoxWorld)}return e}setAssetType(t,e){var i,n;const s=[t];t!==Li.RM&&s.push(Li.RM);const r=null==(i=this.adapter)?void 0:i.getAssetIdsByType(s);(null==r?void 0:r.length)&&(null==(n=this.adapter)||n.updateLayersVisibility(r,!0))}}const ig=new We,ng=new We,sg=new ai;class rg extends $f{constructor(t={}){super(),c(this,"name","AnimateScene"),c(this,"params"),c(this,"resourcesMap",{}),c(this,"dynamicFill",Le.red),c(this,"dynamicScale",new We(1,1)),c(this,"clock",new Df),c(this,"mixer"),c(this,"_selectedClip"),c(this,"selectedAction"),this.params=t,this.initAxesHelper(),this.mixer=new Bm(this)}destroy(){super.destroy()}initAxesHelper(){this.params.axesHelper&&(this.axesHelper&&this.axesHelper.destroy(),this.axesHelper=new tg({fixed:!0,lineWidth:.5}),this.add(this.axesHelper))}add(t){return super.add(t),t.userData.id?(this.resourcesMap[t.userData.id]||(this.resourcesMap[t.userData.id]=[]),this.resourcesMap[t.userData.id].push(t),this):this}remove(t){if(!t)return this;if(super.remove(t),this.resourcesMap[t.userData.id]){const e=this.resourcesMap[t.userData.id].indexOf(t);e>-1&&this.resourcesMap[t.userData.id].splice(e,1),this.resourcesMap[t.userData.id].length||delete this.resourcesMap[t.userData.id]}return this}getByIds(t,e=[]){if(e.length=0,!t)return e;Array.isArray(t)||(t=[t]);for(let i=0,n=(null==t?void 0:t.length)||0;i<n;i++)Object.hasOwnProperty.call(this.resourcesMap,t[i])&&e.push(...this.resourcesMap[t[i]]);return e}getAssetBoundingBox(t,e=new ai){if(e.makeEmpty(),!t)return e;Array.isArray(t)||(t=[t]);for(let i,n=0,s=(null==t?void 0:t.length)||0;n<s;n++){i=t[n];const s=this.getByIds(i);if(null==s?void 0:s.length)for(let t=0,i=s.length;t<i;t++)e.union(s[t].boundingBoxWorld)}return e}onBeforeRender(){}update(t){var e;null==(e=this.mixer)||e.update(this.clock.getDelta())}}class ag extends $f{constructor(t={}){var e,i;super(),c(this,"isEmptyScene",!0),c(this,"name","EmptyScene"),c(this,"params"),c(this,"loadingShape"),c(this,"lineShape"),c(this,"triangleShape"),c(this,"scales",[.95,1.15,.002]),c(this,"l",0),c(this,"scaleTrend",!1),c(this,"clock",new Df),c(this,"mixer"),c(this,"_selectedClip"),c(this,"selectedAction"),this.params=t,this.loadingShape=new Pm(og,{fill:Le.darkGray,flipY:!0}),this.loadingShape.name="loading",this.loadingShape.dynamically=!0,this.add(this.loadingShape),this.loadingShape.updateMatrixWorld(),this.loadingShape.computeBoundingBox(),this.loadingShape.updateBoundingBox(),ug.copy(this.loadingShape.boundingBoxWorld).getCenter(hg),ug.getSize(lg),this.loadingShape.setPosition(hg.negate()).updateMatrix(),this.l=lg.x;const n=Math.max(Math.floor(this.l/30),2),s=[-this.l/2,-(10+n),-this.l/2,-10,this.l/2,-10,this.l/2,-(10+n)];this.lineShape=new Nm({points:s,fill:Le.darkGray}),this.add(this.lineShape),this.lineShape.name="loadingLine";const r=[0,0,lg.x/2,lg.x,lg.x,0];this.triangleShape=new Nm({points:r,fill:Le.darkRed}),this.add(this.triangleShape),this.triangleShape.name="loadingTriangle",this.triangleShape.setPosition(new We(-.12*lg.x,lg.y/-.4)).setScale(.25,.15).updateMatrix(),this.computeBoundingBox(),this.mixer=new Bm(this);const a=new am(`${this.loadingShape.name}.mtl.fill`,[0,1.2,2],[0,0,0,.7,.38,.38,.38,.7,0,0,0,.7]),o=new om(`${this.triangleShape.name}.mtl.fillOpacity`,[0,1.5,3],[1,.8,1],om.DefaultInterpolation),h=new am(`${this.lineShape.name}.scaled`,[0,1.5,3],[1,1,.6,1,1,1]);this._selectedClip=new cm("selected",3,[a,o,h]),this.selectedAction=null==(e=this.mixer)?void 0:e.clipAction(this._selectedClip,this.desScene),null==(i=this.selectedAction)||i.play()}destroy(){super.destroy()}onBeforeRender(){this.lineShape.updateMatrix()}update(){var t;null==(t=this.mixer)||t.update(this.clock.getDelta())}}const og='\n<path d="M13.5 15.8L12.62 17.3L0.799999 17.3L0.799999 5.8L13.46 5.8L12.56 7.3L4.84 7.3L4.84 10.66L13.12 10.66L12.24 12.18L4.84 12.18L4.84 15.8L13.5 15.8Z\nM32.12 17.3L28.52 17.3L28.52 9.9L25.18 17.3L22.1 17.3L18.8 10L18.8 17.3L15.1 17.3L15.1 5.8L20.06 5.8L23.68 13.68L27.32 5.8L32.12 5.8L32.12 17.3Z\nM37.72 12.8L37.72 17.3L33.72 17.3L33.72 5.8L42.22 5.8L41.06 7.34L37.72 7.34L37.72 11.3L42.22 11.3L42.22 5.8L46.28 5.8L46.28 12.8L37.72 12.8Z\nM57 17.3L53 17.3L53 7.34L47.88 7.34L47.88 5.8L62.48 5.8L61.6 7.34L57 7.34L57 17.3Z\nM69.92 13.52L64.08 5.78L68.62 5.78L71.92 10.58L75.14 5.78L79.64 5.78L73.92 13.56L73.92 17.28L69.92 17.28L69.92 13.52Z" />\n',hg=new We,lg=new We,ug=new ai;class cg{constructor(t,i){c(this,"parent"),c(this,"view"),c(this,"scenes",[]),c(this,"oriScene"),c(this,"dstScene"),c(this,"_fnEnable",null==(e=Ae.config)?void 0:e.fnEnable),this.parent=t,this.view=i}fnEnableChanged(t){this._fnEnable=!!t}activate(){}deactivate(){this.scenes=[],this.oriScene=void 0,this.dstScene=void 0}bindScene(...t){return this.scenes.length=0,this.scenes.push(...t),this.oriScene=this.scenes.find((t=>t.isStatic)),this.dstScene=this.scenes.find((t=>t.isDynamic)),this}getDynamicObjectsByIds(t){var e,i,n;const s=[];if(null==(e=this.dstScene)||e.getByIds(t,s),null==s?void 0:s.length)return s;const r=null==(i=this.oriScene)?void 0:i.getByIds(t);if(!(null==r?void 0:r.length))return s;for(let t=0,e=(null==r?void 0:r.length)||0;t<e;t++){const e=r[t].clone(!0,!0);null==(n=this.dstScene)||n.add(e),s.push(e)}return s}clearDynamicObjectsByIds(t){var e,i;if(!t)return;Array.isArray(t)||(t=[t]);const n=null==(e=this.dstScene)?void 0:e.getByIds(t);if(null==n?void 0:n.length)for(let t,e=0,s=(null==n?void 0:n.length)||0;e<s;e++)t=n[e],null==(i=this.dstScene)||i.remove(t),t.destroy()}getColorKeyframeTrack(t,e,i=.5,n=[0,1.2,2]){const s=new Re(e).setA(i).getNormalized(),r=[...s,.38*s[0],.38*s[1],.38*s[2],.5*s[3],...s];return new hm(t,n,r)}}class dg extends cg{constructor(t,e){super(t,e),c(this,"type",Yo.HOVER),c(this,"rayCaster",new lr),c(this,"_hoverIds",[]),c(this,"hoverAction"),c(this,"_hoverClip"),c(this,"dynamicStroke",Le.red);const i=this.getColorKeyframeTrack(".dynamicStroke",Le.darkRed,.8);this._hoverClip=new cm("selected",1,[i])}activate(){var t;super.activate(),this.hoverAction=null==(t=this.parent.mixer)?void 0:t.clipAction(this._hoverClip,this)}deactivate(){var t,e;super.deactivate(),null==(t=this.hoverAction)||t.stop(),null==(e=this.parent.mixer)||e.removeAction(this.hoverAction),this.hoverAction=void 0,this._hoverIds=[]}handlePointerOver(t){var e,i,n,s,r,a;const{id:o,target:h,isStatic:l,isDynamic:u,isDummy:c}=(null==t?void 0:t.data)||{};if(this._hoverIds.includes(o))return;const d=(null==(i=null==(e=this.view)?void 0:e.camera)?void 0:i.pixelWidth)||1,p=this.getDynamicObjectsByIds(o);c&&(ri.set(t,"data.rmId",null==(n=null==h?void 0:h.userData)?void 0:n.rmId),ri.set(t,"data.wsId",null==(s=null==h?void 0:h.userData)?void 0:s.wsId),ri.set(t,"data.label",null==(r=null==h?void 0:h.userData)?void 0:r.label)),pg(p,d),this._hoverIds.push(o),null==(a=this.hoverAction)||a.play(),this.parent.editor.dispatchEvent({type:Mi.POINTER_OVER,data:null==t?void 0:t.data})}handleOut(t){this.clearHover(),this.parent.editor.dispatchEvent({type:Mi.POINTER_OUT,data:null==t?void 0:t.data})}clearHover(){var t;if(null==(t=this.hoverAction)||t.stop(),this.dstScene){for(let t=0,e=this._hoverIds.length;t<e;t++){const e=this.dstScene.getByIds(this._hoverIds[t]);e.length&&fg(e)}this._hoverIds=[]}}traverse(t){var e;if(this.dstScene)for(let i=0,n=(null==(e=this._hoverIds)?void 0:e.length)||0;i<n;i++){const e=this.dstScene.getByIds(this._hoverIds[i]);for(let i=0,n=(null==e?void 0:e.length)||0;i<n;i++)t(e[i])}}update(){var t,e;(null==(e=null==(t=this.dstScene)?void 0:t.children)?void 0:e.length)&&this.traverse((t=>{t.traverse((t=>{t.isShape&&(t.mtl.stroke=this.dynamicStroke)}))}))}}const pg=(t,e=1)=>{if(t){Array.isArray(t)||(t=[t]);for(let i,n=0,s=t.length;n<s;n++)i=t[n],i.traverse((t=>{t.isShape&&(t.userData.actType|=$o.HOVER,t.geo.lineWidth=5*e,t.mtl.stroke=Le.darkYellow,t.mtl.lineJoin="round")}))}},fg=(t,e=1)=>{if(t){Array.isArray(t)||(t=[t]);for(let e,i=0,n=t.length;i<n;i++)e=t[i],e.traverse((t=>{var e,i,n;t.isShape&&(t.userData.actType&=~$o.HOVER,t.geo.lineWidth=null==(i=null==(e=t.userData)?void 0:e.style)?void 0:i.lineWidth,t.mtl.stroke=null==(n=t.userData.style)?void 0:n.stroke,t.mtl.lineJoin=void 0)}))}};class mg extends cg{constructor(t,e){super(t,e),c(this,"type",Yo.SELECT),c(this,"intersects",[]),c(this,"rayCaster"),c(this,"_selectedIds",[]),c(this,"_selectedClip"),c(this,"selectedAction"),c(this,"dynamicSelectFill",Le.red),c(this,"dynamicSelectStroke",Le.red),this.rayCaster=new lr;const i=this.getColorKeyframeTrack(".dynamicSelectFill",Le.red,.5),n=this.getColorKeyframeTrack(".dynamicSelectStroke",Le.darkRed,.8);this._selectedClip=new cm("selected",3,[i,n])}get _selectEnable(){var t,e;return!(!(null==(t=Ae.config)?void 0:t.selectEnable)||!(null==(e=this.view)?void 0:e.camera))}get _multiSelectEnable(){return Ae.config.multiSelectEnable}get _dragEnable(){var t,e;return(null==(t=Ae.config)?void 0:t.multiSelectEnable)&&(null==(e=Ae.config)?void 0:e.fnEnable)}activate(){var t;super.activate(),this.selectedAction=null==(t=this.parent.mixer)?void 0:t.clipAction(this._selectedClip,this)}deactivate(){var t,e;this.clearSelected(),super.deactivate(),null==(t=this.selectedAction)||t.stop(),null==(e=this.parent.mixer)||e.removeAction(this.selectedAction),this.selectedAction=void 0,this.intersects=[],this._selectedIds=[]}setDynamicFill(t){}handleTap(t){if(this.intersects.length=0,!this.oriScene)return;if(!this._selectEnable&&!this._multiSelectEnable)return;this.rayCaster.init(t.data,this.view.camera).intersectObjectBy(this.oriScene,this._validFilter.bind(this),!0,this.intersects);const e=ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e,i;return(null==(e=t.userData)?void 0:e.assetType)===Ae.config.assetType?null==(i=t.userData)?void 0:i.id:""}))));this.selectByIds(e,!0),this.parent.editor.dispatchEvent({type:Mi.SELECTED,data:this._selectedIds})}handlePanStart(t){var e;if((null==t?void 0:t.type)===qh.PAN_START&&this._dragEnable){if(!this.dstScene)throw new Error("No dynamic scene found!");this.parent.editor.setEnablePan(!1),gg.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),vg.makeEmpty().expandByPoint(gg)}}handlePanMove(t){var e;(null==t?void 0:t.type)===qh.PAN_MOVE&&this._dragEnable&&(yg.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),vg.makeEmpty().expandByPoint(gg).expandByPoint(yg))}handlePanEnd(t){var e,i;if(this.intersects.length=0,(null==t?void 0:t.type)!==qh.PAN_END)return;if(!this._dragEnable)return;yg.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),vg.makeEmpty().expandByPoint(gg).expandByPoint(yg),this.rayCaster.init({worldBox:vg},null==(i=this.view)?void 0:i.camera).intersectObjectBy(this.oriScene,this._validFilter.bind(this),!0,this.intersects);const n=ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e,i,n;return(null==(e=t.userData)?void 0:e.assetType)===(null==(i=Ae.config)?void 0:i.assetType)?null==(n=t.userData)?void 0:n.id:""}))));this.selectByIds(n,this._multiSelectEnable),this.parent.editor.dispatchEvent({type:Mi.SELECTED,data:this._selectedIds})}_validFilter(t){var e,i,n;if(!t.visible||!t.selectable||(null==(e=t.userData)?void 0:e.assetType)!==(null==(i=Ae.config)?void 0:i.assetType))return!1;return!ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e;return null==(e=t.userData)?void 0:e.id})))).includes(null==(n=t.userData)?void 0:n.id)}traverse(t){if(!this.dstScene)return;const e=this.dstScene.getByIds(this._selectedIds);if(null==e?void 0:e.length)for(let i=0,n=(null==e?void 0:e.length)||0;i<n;i++)t(e[i])}update(){var t,e;if(!(null==(e=null==(t=this.dstScene)?void 0:t.children)?void 0:e.length))return;const i=this.getDynamicObjectsByIds(this._selectedIds);for(let t,e=0,n=(null==i?void 0:i.length)||0;e<n;e++)t=i[e],t.isShape&&(t.userData.actType||0)&$o.SELECT&&t.traverse((t=>{t.mtl.fill=this.dynamicSelectFill,t.mtl.stroke=this.dynamicSelectStroke}))}hasSelected(t){return this._selectedIds.includes(t)}clearSelected(t){if(this.dstScene){if(!t||!(null==t?void 0:t.length))return this.clearDynamicObjectsByIds(this._selectedIds),void(this._selectedIds.length=0);Array.isArray(t)||(t=[t]),this.clearDynamicObjectsByIds(t);for(let e=0,i=t.length;e<i;e++){const i=this._selectedIds.indexOf(t[e]);i>-1&&this._selectedIds.splice(i,1)}}}selectByIds(t,e){var i,n;if(t&&this.oriScene&&this.dstScene){if(Array.isArray(t)||(t=[t]),null==(i=this.selectedAction)||i.stop(),this._selectEnable){const i=this.hasSelected(t[0]);if(i?this.clearSelected(t[0]):this.clearSelected(),i&&e)return}else this._multiSelectEnable&&(e||this.clearSelected());this.toggleSelectByIds(t,e),null==(n=this.selectedAction)||n.play()}}toggleSelectByIds(t,e){if(this.oriScene&&this.dstScene){Array.isArray(t)||(t=[t]);for(let i=0,n=t.length;i<n;i++){if(this.hasSelected(t[i])){e&&this.clearSelected(t[i]);continue}const n=this.getDynamicObjectsByIds(t[i]);if(null==n?void 0:n.length){for(let t=0,e=n.length;t<e;t++){n[t].moveToLast();const e=this.getDynamicObjectsByIds(n[t].userData.id);for(let t=0,i=(null==e?void 0:e.length)||0;t<i;t++){const i=e[t];i.moveToLast(),i.traverse((t=>{var e;(null==t?void 0:t.isShape)&&(t.userData.actType|=$o.SELECT,t.geo.lineWidth=5*((null==(e=t.userData.style)?void 0:e.strokeWidth)||1))}))}}this._selectedIds.push(t[i])}}}}}const gg=new We,yg=new We,vg=new ai;class xg extends op{constructor(t={}){var e;const{x:i=0,y:n=0,w:s=10,h:r=10}=t,a=s/2,o=r/2;(null==(e=t.points)?void 0:e.length)||(t.points=[i-a,n-o,i-a,n+o,i+a,n+o,i+a,n-o,i-a,n-o]);const h=new xp(t),l=new rp(t);(null==t?void 0:t.lineWidth)||(l.lineWidth=1),super(h,l),c(this,"name","Rect")}setPoints(t){return!t||t.length<2||this.geo.setPoints(t),this}}class bg extends cg{constructor(t,e){super(t,e),c(this,"type",Yo.SELECTOR_RECT),c(this,"_fnEnable",!1),c(this,"selector"),c(this,"rayCaster",new lr),c(this,"intersects",[]),this.selector=new xg({name:wg,fill:new Re(Le.darkBlue).setA(.1).getStyle(),stroke:Le.darkBlue,lineWidth:1,lineDash:[5,5]})}activate(){super.activate()}deactivate(){super.deactivate(),this.intersects=[]}bindScene(...t){var e,i;return super.bindScene(...t),(null==(e=this.dstScene)?void 0:e.getObjectByProperty("name",wg))||null==(i=this.dstScene)||i.add(this.selector),this}fnEnableChanged(t){this._fnEnable=!!t}get _dragEnable(){var t;return(null==(t=Ae.config)?void 0:t.multiSelectEnable)&&this._fnEnable}handlePanStart(t){var e;if(this._dragEnable&&(null==t?void 0:t.type)===qh.PAN_START){if(!this.dstScene)throw new Error("No dynamic scene found!");this.parent.editor.setEnablePan(!1),_g.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Eg.makeEmpty().expandByPoint(_g),this.selector.setVisible(!0).setPoints([_g.x,_g.y])}}handlePanMove(t){var e;this._dragEnable&&(null==t?void 0:t.type)===qh.PAN_MOVE&&(Sg.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Eg.makeEmpty().expandByPoint(_g).expandByPoint(Sg),this.selector.setPoints(Eg.round().getNumbersArray()))}handlePanEnd(t){var e;this.parent.editor.setEnablePan(!0),this._dragEnable&&(null==t?void 0:t.type)===qh.PAN_END&&(Sg.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Eg.makeEmpty().expandByPoint(_g).expandByPoint(Sg),this.selector.setVisible(!1))}}const wg="EDITOT_SELECTOR",_g=new We,Sg=new We,Eg=new ai;class Mg extends cg{constructor(t,e){super(t,e),c(this,"type",Yo.DRAG),c(this,"_fnEnable",!1),c(this,"dragMode",Xo.MAKE_COPY),c(this,"rayCaster",new lr),c(this,"intersects",[]),c(this,"_currentObject"),c(this,"_originalPosition",new We),c(this,"_dragOffset",new We),c(this,"_objectFilter"),c(this,"_getDragabledHandler")}activate(){super.activate()}deactivate(){super.deactivate(),this.intersects=[],this._currentObject=void 0}setDraggingObject(t){this.handlePanStart({type:qh.PAN_START,data:{target:t}})}handlePanStart(t){var e,i,n;if((null==t?void 0:t.type)!==qh.PAN_START)return;if(!this.dstScene)throw new Error("No dynamic scene found!");if(!(null==(e=null==t?void 0:t.data)?void 0:e.target))return;let s;s="function"==typeof this._getDragabledHandler?this._getDragabledHandler(null==(i=null==t?void 0:t.data)?void 0:i.target):null==(n=null==t?void 0:t.data)?void 0:n.target,s&&(this.parent.editor.setEnablePan(!1),this._currentObject=s,this.parent.handleDragStart(t))}handlePanMove(t){(null==t?void 0:t.type)===qh.PAN_MOVE&&this._currentObject&&(this._currentObject.position.copy(t.data.worldCoords),this._currentObject.updateMatrix(),this._currentObject.updateWorldMatrix(!0,!1))}handlePanEnd(t){var e;this.parent.editor.setEnablePan(!0),(null==t?void 0:t.type)===qh.PAN_END&&(ri.set(t,"data.target",this._currentObject),this.parent.handleDragEnd(t),this._currentObject=void 0,null==(e=this.view.camera)||e.update())}bindFilter(t){this._objectFilter=t}_defaultFilter(t){return t.visible&&t.selectable}_validFilter(t){return this._objectFilter?this._objectFilter(t):this._defaultFilter(t)}bindGetDragabledHandler(t){this._getDragabledHandler=t}}class Ag extends jh{constructor(t){super(t),this._init(t)}buildPath(t,e,i){if(0===this.percent)return;let{x:n=0,y:s=0,radius:r,startAngle:a=0,endAngle:o=2*Math.PI}=e||this;t.arc(n,s,r,a,o)}}class Tg extends op{constructor(t=new Ag,e=new rp,i){super(t,e,i),c(this,"name","Sprite"),c(this,"isSprite",!0)}updateModelViewMatrix(t){if(t){Cg.makeScale(t.scaled.x,t.scaled.y).premultiply(this.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.viewMatrix,Cg);for(let e=0,i=this.children.length;e<i;e++)this.children[e].updateModelViewMatrix(t)}}}const Cg=new Ui;class Ig extends Tg{constructor(){super(...arguments),c(this,"isDummy",!0),c(this,"composeNode",!0),c(this,"selectable",!0),c(this,"visible",!0),c(this,"renderOrder",1/0),c(this,"txtShape")}setText(t){var e;(null==(e=this.txtShape)?void 0:e.mtl)&&(this.txtShape.mtl.text=t)}setLabel(t,e){this.userData.label=t}updateModelViewMatrix(t){var e,i;if(super.updateModelViewMatrix(t),!this.txtShape)return;const n=1.2*((null==(e=this.params)?void 0:e.radius)||10)*((null==(i=null==t?void 0:t.scaled)?void 0:i.x)||1);this.txtShape.mtl.fontSize=n,this.txtShape.position.set(0,-n/2),this.txtShape.updateMatrix()}}class Dg extends Ig{constructor(t,e={}){var i,n;e.radius||(e.radius=null==(n=null==(i=Ae.config)?void 0:i.dummy)?void 0:n.radius);const s=new Ag({x:0,y:0,radius:e.radius,thinLine:!0}),r=new rp({fill:Le.blue,stroke:Le.darkBlue});super(s,r),c(this,"params"),c(this,"dragable",!0),c(this,"radius"),this.params=e,this.userData=u(l({},t),{assetType:Bi,style:{fill:r.fill,stroke:r.stroke,lineWidth:r.lineWidth}}),this.txtShape=new bp({text:(t.label||"").substring(0,1),fontSize:1.2*e.radius,fill:Le.white,textBaseline:"ideographic",fontWeight:"300"}),this.add(this.txtShape)}}class Lg extends Ig{constructor(t,e={}){var i,n;e.radius||(e.radius=null==(n=null==(i=Ae.config)?void 0:i.dummy)?void 0:n.radius);const s=e.radius,r=new wp({x:-s,y:-s,w:2*s,h:2*s,r:s/2}),a=new rp({fill:Le.blue,stroke:Le.darkBlue});super(r,a),c(this,"params"),c(this,"txtShape"),this.params=e,this.userData=u(l({},t),{assetType:Bi,style:{fill:a.fill,stroke:a.stroke,lineWidth:a.lineWidth}}),this.txtShape=new bp({text:"1",fontSize:e.radius,fill:Le.white,textBaseline:"ideographic",fontWeight:"300"}),this.add(this.txtShape),this.needsUpdate=!0}}class Bg extends cg{constructor(t,e){super(t,e),c(this,"type",Yo.DUMMY),c(this,"_fnEnable",!1),c(this,"_dummies",[]),c(this,"_centroidCache",{}),c(this,"_rmMap",new Map),c(this,"_mergedMap",new Map),c(this,"action"),c(this,"_clip"),c(this,"dynamicDummyFill",Le.red),c(this,"dynamicDummyStroke",Le.darkRed),c(this,"rayCaster",new lr),c(this,"intersects",[]),c(this,"_currentDummy"),c(this,"_unboundDummiesMap",{}),c(this,"_cameraHandler",this.handleCameraUpdate.bind(this)),c(this,"_getDragabledHandler",this.getDragabled.bind(this));const i=new hm(".dynamicDummyFill",[0,.6,1],[.95,.38,.38,.8,.95,.38,.38,.3,.95,.38,.38,.8]),n=new hm(".dynamicDummyStroke",[0,.6,1],[.95,.38,.38,.8,.95,.38,.38,.3,.95,.38,.38,.8]);this._clip=new cm("currentDummy",1,[i,n]),this.bindEvents()}destroy(){this.deactivate(),this.unbindEvents()}bindEvents(){var t,e;null==(e=null==(t=this.view)?void 0:t.camera)||e.addEventListener(tr.UPDATE,this._cameraHandler)}unbindEvents(){var t,e;null==(e=null==(t=this.view)?void 0:t.camera)||e.removeEventListener(tr.UPDATE,this._cameraHandler)}activate(){var t;super.activate(),this.action=null==(t=this.parent.mixer)?void 0:t.clipAction(this._clip,this);const e=this.parent.get(Yo.DRAG);e&&(e.bindFilter(this._validFilter.bind(this)),e.bindGetDragabledHandler(this._getDragabledHandler))}deactivate(){var t,e;this.clearDummies(),super.deactivate(),null==(t=this.action)||t.stop(),null==(e=this.parent.mixer)||e.removeAction(this.action),this.action=void 0,this._dummies=[],this._centroidCache={},this._rmMap=new Map,this._mergedMap=new Map,this.intersects=[];const i=this.parent.get(Yo.DRAG);i&&(i.bindFilter(),i.bindGetDragabledHandler())}fnEnableChanged(t){this._fnEnable=!!t}bindEditorDrag(t){let e=this.getDummyById(null==t?void 0:t.id);e||(e=(null==t?void 0:t.rmId)?this.addDummy(t):this.addDummyUnbound(t)),e&&(e.visible=!1)}getDraggingObject(t){return this.getDummyById(null==t?void 0:t.id)}getDragabled(t){var e;if(!t)return;if(Array.isArray(t)||(t=[t]),!t.length)return;const i=t[0];let n=this._unboundDummiesMap[null==(e=i.userData)?void 0:e.id];return!n&&i.dragable&&(i.mtl.fill=i.userData.style.fill=new Re(Le.blue).setA(.5).getStyle(),i.mtl.lineDash=[2,2],i.userData.status=Zo.MODIFIED,n=this.addDummyUnbound(i.userData)),n&&(n.visible=!0),n}handleDragEnd(t){var e;if(!this.oriScene)throw new Error("No dynamic scene found!");const{target:i}=(null==t?void 0:t.data)||{};if(!(null==i?void 0:i.isDummy))return;const n=[],s=u(l({},null==t?void 0:t.data),{screenCoords:i.position});if(this.rayCaster.init(s,this.view.camera).intersectObjectBy(this.oriScene,this._assetFilter.bind(this),!0,n),!(null==n?void 0:n.length))return;i.userData.rmId=null==(e=n[0].userData)?void 0:e.id;const r=this.getDummiesVo(!0);this.parent.editor.dispatchEvent({type:Mi.DRAG_END,data:r})}_validFilter(t){var e,i;if(!t.visible||!t.selectable||(null==(e=t.userData)?void 0:e.assetType)!==Bi)return!1;return!ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e;return null==(e=t.userData)?void 0:e.id})))).includes(null==(i=t.userData)?void 0:i.id)}_assetFilter(t){var e;return t.visible&&t.selectable&&(null==(e=t.userData)?void 0:e.assetType)===Ae.config.assetType}getDummiesVo(t=!0){var e,i,n,s,r,a,o,h,l,u;const c=[];for(let a=0,o=this._dummies.length;a<o;a++){const o=this._dummies[a];if((null==(e=o.userData)?void 0:e.assetType)!==Bi)continue;if(t&&o.userData.status!==Zo.NEW)continue;const h={id:null==(i=o.userData)?void 0:i.id,label:null==(n=o.userData)?void 0:n.label,rmId:null==(s=o.userData)?void 0:s.rmId,wsId:null==(r=o.userData)?void 0:r.wsId};c.push(h)}for(let e=Object.keys(this._unboundDummiesMap),i=0,n=(null==e?void 0:e.length)||0;i<n;i++){const n=e[i];if(!n)continue;const s=this._unboundDummiesMap[n];if((null==(a=s.userData)?void 0:a.assetType)!==Bi)continue;if(t&&s.userData.status!==Zo.NEW)continue;const r={id:null==(o=s.userData)?void 0:o.id,label:null==(h=s.userData)?void 0:h.label,rmId:null==(l=s.userData)?void 0:l.rmId,wsId:null==(u=s.userData)?void 0:u.wsId},d=c.findIndex((t=>t.id===r.id));d>-1&&c.splice(d,1),c.push(r)}return c}getAssetById(t){let e;for(let i=0,n=this.scenes.length;i<n&&(e=this.scenes[i].getByIds(t),!e);i++);return e}getAssetBoundingBoxById(t,e=new ai){e.makeEmpty();const i=this.getAssetById(t);if(!(null==i?void 0:i.length))return e;for(let t=0,n=(null==i?void 0:i.length)||0;t<n;t++)e.union(i[t].boundingBoxWorld);return e}getDummyLabels(t){var e,i;const n=this.getDummyById(t);return n instanceof Lg?((null==(e=null==n?void 0:n.userData)?void 0:e.label)||"").split(","):[null==(i=null==n?void 0:n.userData)?void 0:i.label]}getDummiesBoundingBox(t,e){if(kg.makeEmpty(),!(null==t?void 0:t.length))return kg.clone();for(let e,i=0,n=(null==t?void 0:t.length)||0;i<n;i++){e=t[i];const n=this.getDummyById(e);n&&kg.union(n.boundingBoxWorld)}return kg.clone()}addDummy(t){var e,i;if(!this.dstScene||!(null==t?void 0:t.rmId))return;const n=t.rmId;let s=this._dummies.find((e=>{var i;return(null==(i=e.userData)?void 0:i.id)===t.id}));return s||(s=new Dg(t,Ae.config.dummy),s.name=t.id||n+"_"+(t.id||(null==(e=this.dstScene.children)?void 0:e.length)),s.userData.rmId=n,this.dstScene.add(s),this._dummies.push(s),this._rmMap.has(n)||this._rmMap.set(n,[]),null==(i=this._rmMap.get(n))||i.push(s)),s}addDummyMerged(t,e){var i,n;if(!this.dstScene||!(null==t?void 0:t.rmId))return;let s;return this._mergedMap.has(t.id)?s=this._mergedMap.get(t.id):(s=new Lg(t,Ae.config.dummy),s.name=t.id||e+"_"+(t.id||(null==(i=this.dstScene.children)?void 0:i.length)),null==(n=this.dstScene)||n.add(s),this._mergedMap.set(e,s)),s}addDummyUnbound(t){var e;if(!(null==t?void 0:t.id))return;const i=new Dg(t,Ae.config.dummy);return i.mtl.fill=i.userData.style.fill=Le.green,i.mtl.stroke=i.userData.style.stroke=Le.darkGreen,i.userData.status=Zo.NEW,null==(e=this.dstScene)||e.add(i),this._unboundDummiesMap[t.id]=i,i}traverseDummies(t){var e;for(let i=0,n=(null==(e=this._dummies)?void 0:e.length)||0;i<n;i++)t(this._dummies[i]);for(let[e,i]of this._mergedMap.entries())t(i);Object.values(this._unboundDummiesMap).forEach((e=>{t(e)}))}clearDummies(t){var e,i,n,s;for(let i,n=Object.keys(this._unboundDummiesMap),s=(null==n?void 0:n.length)||0;s>=0;s--)i=this._unboundDummiesMap[n[s]],(null==t?void 0:t.length)&&!t.includes(null==i?void 0:i.userData.status)||(null==(e=this.dstScene)||e.remove(i),null==i||i.destroy(),delete this._unboundDummiesMap[n[s]]);for(let e,s=((null==(i=this._dummies)?void 0:i.length)||0)-1;s>=0;s--)e=this._dummies[s],(null==t?void 0:t.length)&&!t.includes(e.userData.status)||(null==(n=this.dstScene)||n.remove(e),null==e||e.destroy(),this._dummies.splice(s,1));for(let[e,i]of this._mergedMap.entries())(null==t?void 0:t.length)&&!t.includes(i.userData.status)||(null==(s=this.dstScene)||s.remove(i),null==i||i.destroy(),this._mergedMap.delete(e));(null==t?void 0:t.length)||(this._dummies.length=0,this._centroidCache={},this._rmMap.clear(),this._mergedMap.clear(),this._unboundDummiesMap={})}setDummies(t){var e;if(this.clearDummies(),null==t?void 0:t.length){for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.addDummy(t[e]);null==(e=this.view.camera)||e.update()}}getDummyById(t){var e;if(t){for(let i=0,n=(null==(e=this._dummies)?void 0:e.length)||0;i<n;i++)if(this._dummies[i].name===t)return this._dummies[i];for(let[e,i]of this._mergedMap.entries())if(i.name===t)return i;return this._unboundDummiesMap[t]}}focusAtDummy(t,e=1e3){return d(this,null,(function*(){var i,n,s,r,a,o,h;const l=this.getDummyById(t),u=null==(i=null==l?void 0:l.userData)?void 0:i.rmId;if(u){if(this.getAssetBoundingBoxById(u,kg),!kg.isEmpty()&&(kg.expandByScalar(e),null==(n=this.view)?void 0:n.camera))return void((null==(r=null==(s=this.view)?void 0:s.camera)?void 0:r.boundingBoxWorld.containsBox(kg))||(yield this.view.resetCameraByBoundingBox(kg,!0)));if((null==l?void 0:l.position)&&!(null==l?void 0:l.position.isEmpty()))return l.updateWorldMatrix(!0,!1),Ng.copy(l.position).applyMatrix3(l.matrixWorld),kg.setFromCenterAndSize(Ng,Og.set(2*e,2*e)),void((null==(o=null==(a=this.view)?void 0:a.camera)?void 0:o.boundingBoxWorld.containsBox(kg))||(yield null==(h=this.view)?void 0:h.resetCameraByBoundingBox(kg,!0)))}}))}highlightDummies(t){return d(this,null,(function*(){var e;Array.isArray(t)||(t=[t]),this.traverseDummies((e=>{var i;t.includes(e.userData.id)||e instanceof Lg&&(null==(i=ri.intersection(t,e.userData.id.split(",")))?void 0:i.length)?e.userData.actType|=$o.HILIGHT:e.userData.actType&=~$o.HILIGHT})),null==(e=this.action)||e.play()}))}resetHighlightDummies(){var t;this.traverseDummies((t=>{t.userData.actType&=~$o.HILIGHT,t.mtl.fill=t.userData.style.fill,t.mtl.stroke=t.userData.style.stroke})),null==(t=this.action)||t.stop()}update(){var t,e;(null==(e=null==(t=this.dstScene)?void 0:t.children)?void 0:e.length)&&this.dstScene.traverse((t=>{var e;((null==(e=null==t?void 0:t.userData)?void 0:e.actType)||0)&$o.HILIGHT&&t.isDummy&&(t.mtl.fill=this.dynamicDummyFill,t.mtl.stroke=this.dynamicDummyStroke)}))}handleCameraUpdate(t){var e,i;if(null==(e=this.view)?void 0:e.camera){for(let t,e=0,n=(null==(i=this._dummies)?void 0:i.length)||0;e<n;e++)t=this._dummies[e],this.updateDummy(t);this.mergeDummies()}}updateDummy(t){var e,i;const n=t.userData.rmId,s=this.getAssetById(n);if((null==s?void 0:s.length)&&!this._centroidCache[n]){const t=[];for(let n,r=0,a=s.length;r<a;r++)n=s[r],null==(i=null==(e=n.geo)?void 0:e.path)||i.getVertices(t);We.getPoleOfInaccessibility(t,Ng),this._centroidCache[n]=Ng.clone()}}mergeDummies(){var t,e,i;if(!(null==(t=this.view)?void 0:t.camera))return;Pg.copy(this.view.camera.viewMatrix);const n=(null==(i=null==(e=Ae.config)?void 0:e.dummy)?void 0:i.radius)||10;this.view.camera.pixelWidth;for(let[t,e]of this._rmMap){if(!(null==e?void 0:e.length))continue;this.getAssetBoundingBoxById(t,kg),kg.applyMatrix3(Pg).getSize(Ng).round(),Og.copy(this._centroidCache[t]).applyMatrix3(Pg);const i=kg.centralArrange(e.length,2*n,2*n,Og);if(Array.isArray(i)){const n=this._mergedMap.get(t);n&&(n.visible=!1),e.forEach(((t,e)=>{t.visible=!0,t.boundingBox.getSize(zg),t.setPosition(Rg.copy(i[e]).unproject(this.view.camera)).updateMatrix()}))}else{e.forEach((t=>t.visible=!1));let i=this._mergedMap.get(t);if(!i){let n=ri.cloneDeep(e[0].userData)||{};const s=ri.reduce(e,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.label)&&t.push(null==(n=e.userData)?void 0:n.label),t}),[]),r=ri.reduce(e,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.id)&&t.push(null==(n=e.userData)?void 0:n.id),t}),[]);n=ri.merge(n,{rmId:t,id:r.join(","),label:s.join(",")}),i=this.addDummyMerged(n,t)}if(!i)continue;i.setText(String(e.length)),i.visible=!0,Rg.copy(e[0].position),i.setPosition(Rg).updateMatrix()}}}}const Pg=new Ui,kg=new ai,Ng=new We,Og=new We,Rg=new We,zg=new We;class Hg extends op{constructor(t){const e=new ap(t),i=new rp(t);(null==t?void 0:t.lineWidth)||(i.lineWidth=1),super(e,i),c(this,"name","Line"),c(this,"isLine",!0)}}class Wg{static getPoint(t){const e=new Ag(t),i=yp.getMtl(t);return new Tg(e,i)}static getRect(t){const e=new wp(t),i=yp.getMtl(t);return new Tg(e,i)}static getMark(t){const e=new Gh({cmds:[[ln,0,0],[un,-5,-10],[cn,-5,-10,-12.5,-25,0,-25],[cn,0,-25,12.5,-25,5,-10],[un,0,0],[fn]],closed:!0,flipY:!0,lineWidth:1,thinLine:!0}),i=yp.getMtl(t);return new Tg(e,i)}}class Fg extends cg{constructor(t,e){super(t,e),c(this,"type",Yo.LINKER),c(this,"_linesIds",[]),c(this,"_startIds",[]),c(this,"_endIds",[]),c(this,"_lineDash",20)}activate(){super.activate()}deactivate(){this.clear(),super.deactivate(),this._linesIds=[],this._startIds=[],this._endIds=[]}update(){var t,e;for(let i=0,n=(null==(t=this._linesIds)?void 0:t.length)||0;i<n;i++){const t=null==(e=this.dstScene)?void 0:e.getByIds(this._linesIds[i]);if(null==t?void 0:t.length)for(let e,i=0,n=t.length;i<n;i++){if(e=t[i],!(null==e?void 0:e.mtl))continue;let n=e.mtl.lineDashOffset||0;n<=-2*this._lineDash&&(n=0),e.mtl.lineDashOffset=n-1}}}clear(){var t;(null==(t=this._linesIds)?void 0:t.length)&&(this.clearDynamicObjectsByIds(this._linesIds),this.clearDynamicObjectsByIds(this._startIds),this.clearDynamicObjectsByIds(this._endIds),this._linesIds=[],this._startIds=[],this._endIds=[])}linkAssetsByTree(t){var e,i;if(this.clear(),!(null==(e=null==t?void 0:t.children)?void 0:e.length))return;Ii(t);const n=this.getLinesByTree(t,void 0,!0);if(null==n?void 0:n.length)for(let t,e=0,s=n.length;e<s;e++)t=n[e],null==(i=this.dstScene)||i.add(t),this._linesIds.push(t.userData.id)}getLinesByTree(t,e=[],i=!1){var n,s;if(!(null==t?void 0:t.value))return e;const r=this.getDynamicObjectsByIds(t.value);if(Ug.makeEmpty().expandByObjects(r).getCenter(qg),i){const e=Wg.getMark({fill:Le.red,stroke:Le.darkGreen,lineWidth:1});e.userData.id=`${t.value}-start`,e.setPosition(qg).updateMatrix(),null==(n=this.dstScene)||n.add(e),this._startIds.push(e.userData.id)}return null==(s=t.children)||s.forEach((i=>{var n,s;const r=this.getDynamicObjectsByIds(i.value);Vg.makeEmpty().expandByObjects(r).getCenter(jg);const a=new Hg({x1:qg.x,y1:qg.y,x2:jg.x,y2:jg.y,stroke:Le.darkRed,strokeWidth:10,lineCap:"round",lineJoin:"round",lineDash:[this._lineDash,this._lineDash],thinLine:!0});a.userData.id=`${t.value}-${i.value}`,a.userData.actType|=$o.DYNAMIC_LINE,e.push(a);const o=Wg.getMark({fill:Le.green,stroke:Le.darkGreen,lineWidth:1});o.userData.id=`${t.value}-end`,o.setPosition(jg).updateMatrix(),null==(n=this.dstScene)||n.add(o),this._endIds.push(o.userData.id),(null==(s=i.children)?void 0:s.length)&&this.getLinesByTree(i,e,!1)})),e}}const Ug=new ai,Vg=new ai,qg=new We,jg=new We;class Yg extends cg{constructor(t,e){super(t,e),c(this,"type",Yo.DISTRIBUTION),c(this,"fillIdsMap",{}),c(this,"strokeIdsMap",{})}activate(){super.activate()}deactivate(){this.clearByIds(),super.deactivate(),this.fillIdsMap={},this.strokeIdsMap={}}update(){}setFillByIds(t,e){var i,n;if(t&&e){Array.isArray(t)||(t=[t]);for(let n,s=0,r=(null==t?void 0:t.length)||0;s<r;s++){n=t[s],this.clearById(n,!1);const r=null==(i=this.oriScene)?void 0:i.getByIds(n);if(null==r?void 0:r.length)for(let t,i=0,n=(null==r?void 0:r.length)||0;i<n;i++)t=r[i],(null==t?void 0:t.mtl)&&(t.mtl=yp.getMtl(u(l({},t.userData.style),{fill:e})),t.geo.lineWidth=t.userData.style.lineWidth||1,t.needsUpdate=!0)}this.fillIdsMap[e]=t,(null==(n=this.view)?void 0:n.camera)&&(this.view.camera.needsUpdate=!0)}}setStrokeByIds(t,e){var i,n;if(t&&e){Array.isArray(t)||(t=[t]);for(let n,s=0,r=(null==t?void 0:t.length)||0;s<r;s++){n=t[s],this.clearById(n,!1);const r=null==(i=this.oriScene)?void 0:i.getByIds(n);if(null==r?void 0:r.length)for(let t,i=0,n=(null==r?void 0:r.length)||0;i<n;i++)t=r[i],(null==t?void 0:t.mtl)&&(t.mtl=yp.getMtl(u(l({},t.userData.style),{stroke:e,lineWidth:5*(t.userData.style.lineWidth||1)})),t.geo.lineWidth=5*(t.userData.style.lineWidth||1),t.needsUpdate=!0)}this.strokeIdsMap[e]=t,(null==(n=this.view)?void 0:n.camera)&&(this.view.camera.needsUpdate=!0)}}clearById(t,e=!0){var i,n,s,r,a,o,h;if(!t)return;const l=null==(i=this.oriScene)?void 0:i.getByIds(t);for(let t,e=0,i=(null==l?void 0:l.length)||0;e<i;e++)t=l[e],(null==t?void 0:t.mtl)&&(t.mtl=yp.getMtl(t.userData.style),t.geo.lineWidth=null==(n=t.userData.style)?void 0:n.lineWidth,t.needsUpdate=!0);for(let e,i=Object.keys(this.fillIdsMap),n=((null==i?void 0:i.length)||0)-1;n>=0;n--){e=i[n];const a=null==(s=this.fillIdsMap[e])?void 0:s.findIndex((e=>e===t));a>-1&&this.fillIdsMap[e].splice(a,1),(null==(r=this.fillIdsMap[e])?void 0:r.length)||delete this.fillIdsMap[e]}for(let e,i=Object.keys(this.strokeIdsMap),n=((null==i?void 0:i.length)||0)-1;n>=0;n--){e=i[n];const s=null==(a=this.strokeIdsMap[e])?void 0:a.findIndex((e=>e===t));s>-1&&this.strokeIdsMap[e].splice(s,1),(null==(o=this.strokeIdsMap[e])?void 0:o.length)||delete this.strokeIdsMap[e]}e&&(null==(h=this.view)?void 0:h.camera)&&(this.view.camera.needsUpdate=!0)}clearFillByIds(t,e=!0){var i;t&&!Array.isArray(t)&&(t=[t]),t&&t.length||(t=ri.uniq(ri.compact(ri.flatten(ri.values(this.fillIdsMap)))));for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.clearById(t[e],!1);e&&(null==(i=this.view)?void 0:i.camera)&&(this.view.camera.needsUpdate=!0)}clearStrokeByIds(t,e=!0){var i;t&&!Array.isArray(t)&&(t=[t]),t&&t.length||(t=ri.uniq(ri.compact(ri.flatten(ri.values(this.strokeIdsMap)))));for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.clearById(t[e],!1);e&&(null==(i=this.view)?void 0:i.camera)&&(this.view.camera.needsUpdate=!0)}clearByIds(t,e=!0){var i;t&&!Array.isArray(t)&&(t=[t]),t&&t.length||(t=ri.uniq(ri.compact(ri.flatten(ri.concat(ri.values(this.fillIdsMap),ri.values(this.strokeIdsMap))))));for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.clearById(t[e],!1);e&&(null==(i=this.view)?void 0:i.camera)&&(this.view.camera.needsUpdate=!0)}getLegend(){const t=[];for(let e in this.fillIdsMap)t.push({type:"fill",color:e,ids:this.fillIdsMap[e]});for(let e in this.strokeIdsMap)t.push({type:"stroke",color:e,ids:this.strokeIdsMap[e]});return t}}class Gg extends cg{constructor(t,e){super(t,e),c(this,"type",Yo.TIPS),c(this,"engineVersion","v2.0.12"),c(this,"monitor"),this.monitor=new op}activate(){super.activate()}deactivate(){super.deactivate()}handlePointerMove(t){var e,i,n;let s=(null==(e=null==t?void 0:t.e)?void 0:e.target)||(null==(n=null==(i=null==t?void 0:t.e)?void 0:i.srcEvent)?void 0:n.target);null==s||s.id}}class $g{constructor(t,e){c(this,"tools",new Map),c(this,"activedTools",new Map),c(this,"activedTool"),c(this,"scenes",[]),c(this,"dstScene"),c(this,"mixer"),c(this,"clock",new Df),this.editor=t,this.view=e,this.mixer=new Bm}destroy(){var t;this.dispose(),this.tools.clear(),null==(t=this.mixer)||t.destroy()}dispose(){var t;this.tools.forEach((t=>{t.deactivate&&t.deactivate()})),this.deactiveAll(),this.scenes=[],null==(t=this.mixer)||t.dispose()}register(t){Array.isArray(t)||(t=[t]),this.deactiveAll();for(let e,i=0,n=(null==t?void 0:t.length)||0;i<n;i++){e=t[i];let n=this.tools.get(e);if(!n){switch(e){case Yo.TIPS:n=new Gg(this,this.view);break;case Yo.HOVER:n=new dg(this,this.view);break;case Yo.SELECT:n=new mg(this,this.view);break;case Yo.SELECTOR_RECT:n=new bg(this,this.view);break;case Yo.DISTRIBUTION:n=new Yg(this,this.view);break;case Yo.DRAG:n=new Mg(this,this.view);break;case Yo.DUMMY:n=new Bg(this,this.view);break;case Yo.LINKER:n=new Fg(this,this.view)}n&&this.tools.set(e,n)}n&&((null==n?void 0:n.bindScene)&&n.bindScene(...this.scenes))}return this}bindScene(...t){var e;return this.scenes.length=0,this.scenes.push(...t),this.dstScene=this.scenes.find((t=>t.isDynamic)),this.dstScene&&(null==(e=this.mixer)||e.bind(this.dstScene)),this.activedTools.forEach((t=>{t.bindScene&&t.bindScene(...this.scenes)})),this}setMode(t){this.deactiveAll();for(let e=1;e<=t;e<<=1)if(t&e){const t=e;this.tools.has(t)&&this.activateTool(t)}}clearMode(){this.deactiveAll()}activateTool(t){const e=this.tools.get(t);e&&(null==e||e.deactivate(),this.activedTools.set(e.type,e),e.bindScene&&e.bindScene(...this.scenes),e.activate())}get(t){return this.tools.get(t)}getActiveTool(t){return this.activedTools.get(t)}deactiveAll(t){const e=[];this.activedTools.forEach((i=>{(null==t?void 0:t.includes(i.type))||e.push(i.type)})),e.forEach((t=>{var e;null==(e=this.activedTools.get(t))||e.deactivate(),this.activedTools.delete(t)}))}handleTap(t){this.activedTools.forEach((e=>{e.handleTap&&e.handleTap(t)}))}handlePanStart(t){this.activedTools.forEach((e=>{e.handlePanStart&&e.handlePanStart(t)}))}handlePanMove(t){this.activedTools.forEach((e=>{e.handlePanMove&&e.handlePanMove(t)}))}handlePanEnd(t){this.activedTools.forEach((e=>{e.handlePanEnd&&e.handlePanEnd(t)}))}handlePointerOver(t){this.activedTools.forEach((e=>{e.handlePointerOver&&e.handlePointerOver(t)}))}handlePointerOut(t){this.activedTools.forEach((e=>{e.handlePointerOut&&e.handlePointerOut(t)}))}handlePointerMove(t){this.activedTools.forEach((e=>{e.handlePointerMove&&e.handlePointerMove(t)}))}handleDragStart(t){this.activedTools.forEach((e=>{e.handleDragStart&&e.handleDragStart(t)}))}handleDragEnd(t){this.activedTools.forEach((e=>{e.handleDragEnd&&e.handleDragEnd(t)}))}update(){var t;null==(t=this.mixer)||t.update(this.clock.getDelta()),this.activedTools.forEach((t=>{t.update&&t.update()}))}clearDummies(t){var e;null==(e=this.tools.get(Yo.DUMMY))||e.clearDummies(t)}setDummies(t){var e;null==(e=this.tools.get(Yo.DUMMY))||e.setDummies(t)}focusAtDummy(t,e=1e3){var i;null==(i=this.tools.get(Yo.DUMMY))||i.focusAtDummy(t,e)}highlightDummies(t){var e;null==(e=this.tools.get(Yo.DUMMY))||e.highlightDummies(t)}resetHighlightDummies(){var t;null==(t=this.tools.get(Yo.DUMMY))||t.resetHighlightDummies()}getDummyLabels(t){var e;return null==(e=this.tools.get(Yo.DUMMY))?void 0:e.getDummyLabels(t)}getDummiesBoundingBox(t,e){var i;return null==(i=this.tools.get(Yo.DUMMY))?void 0:i.getDummiesBoundingBox(t)}}class Xg extends Fi{constructor(t,e){var i,n;super(),c(this,"scenes",[]),c(this,"dstScene"),c(this,"handler"),c(this,"view"),c(this,"mode",Go.DEFAULT),c(this,"toolManager"),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"panStartHandler",this.handlePanStart.bind(this)),c(this,"panMoveHandler",this.handlePanMove.bind(this)),c(this,"panEndHandler",this.handlePanEnd.bind(this)),c(this,"pointerOverHandler",this.handlePointerOver.bind(this)),c(this,"pointerOutHandler",this.handlePointerOut.bind(this)),c(this,"pointerMoveHandler",this.handlePointerMove.bind(this)),this.view=e,(null==(i=this.view)?void 0:i.camera)&&(this.handler=new Nh(t,this.view.camera).enableHover(null==(n=Ae.config.controls)?void 0:n.enableHover)),this.toolManager=new $g(this,this.view).register([Yo.TIPS,Yo.HOVER,Yo.SELECT,Yo.SELECTOR_RECT,Yo.DISTRIBUTION,Yo.DRAG,Yo.DUMMY,Yo.LINKER]),this.toolManager.setMode(this.mode)}destroy(){var t;this.dispose(),this.unbindEvents(),null==(t=this.handler)||t.destroy()}dispose(){this.toolManager.dispose(),this.scenes=[]}bind(t,e){this.view=t,this.handler=e}bindScene(...t){var e;return this.scenes.length=0,this.scenes.push(...t),null==(e=this.handler)||e.bindScene(...t),this.dstScene=this.scenes.find((t=>t.isDynamic)),this.toolManager.bindScene(...t),this.bindEvents(),this}setMode(t){t&&(this.mode=t,this.toolManager.setMode(t),Ae.config.editorMode=Go.PICKER)}clearMode(){this.mode=Go.DEFAULT,this.toolManager.clearMode(),Ae.config.editorMode=Go.DEFAULT}bindEvents(){var t,e,i,n,s,r,a;this.unbindEvents(),null==(t=this.handler)||t.addEventListener(Wh.TAP,this.tapHandler),null==(e=this.handler)||e.addEventListener(Wh.PAN_START,this.panStartHandler),null==(i=this.handler)||i.addEventListener(Wh.PAN_MOVE,this.panMoveHandler),null==(n=this.handler)||n.addEventListener(Wh.PAN_END,this.panEndHandler),null==(s=this.handler)||s.addEventListener(Wh.POINTEROVER,this.pointerOverHandler),null==(r=this.handler)||r.addEventListener(Wh.POINTEROUT,this.pointerOutHandler),null==(a=this.handler)||a.addEventListener(Wh.POINTERMOVE,this.pointerMoveHandler)}unbindEvents(){var t,e,i,n,s,r,a;null==(t=this.handler)||t.removeEventListener(Wh.TAP,this.tapHandler),null==(e=this.handler)||e.removeEventListener(Wh.PAN_START,this.panStartHandler),null==(i=this.handler)||i.removeEventListener(Wh.PAN_MOVE,this.panMoveHandler),null==(n=this.handler)||n.removeEventListener(Wh.PAN_END,this.panEndHandler),null==(s=this.handler)||s.removeEventListener(Wh.POINTEROVER,this.pointerOverHandler),null==(r=this.handler)||r.removeEventListener(Wh.POINTEROUT,this.pointerOutHandler),null==(a=this.handler)||a.removeEventListener(Wh.POINTERMOVE,this.pointerMoveHandler)}handleTap(t){this.toolManager.handleTap(t)}handlePanStart(t){this.toolManager.handlePanStart(t)}handlePanMove(t){this.toolManager.handlePanMove(t)}handlePanEnd(t){this.toolManager.handlePanEnd(t)}handlePointerOver(t){this.toolManager.handlePointerOver(t)}handlePointerOut(t){this.toolManager.handlePointerOut(t)}handlePointerMove(t){this.toolManager.handlePointerMove(t)}update(){this.toolManager.update()}setEnablePan(t=!1){this.view&&this.view.setEnablePan&&this.view.setEnablePan(t)}selectEnableChanged(t=!1){t?this.setMode(Go.PICKER):this.clearMode()}multiSelectEnableChanged(t=!1){t?this.setMode(Go.PICKER):this.clearMode()}fnEnableChanged(t=!1){var e;null==(e=this.toolManager.get(Yo.SELECTOR_RECT))||e.fnEnableChanged(t)}clearSelected(t){var e;this.mode&Yo.SELECT||this.setMode(Go.PICKER),null==(e=this.toolManager.get(Yo.SELECT))||e.clearSelected(t)}selectByIds(t,e){var i;this.mode&Yo.SELECT||this.setMode(Go.PICKER),null==(i=this.toolManager.get(Yo.SELECT))||i.selectByIds(t,e)}setDynamicFill(t){var e;null==(e=this.toolManager.get(Yo.SELECT))||e.setDynamicFill(t)}clearDummies(t){this.mode&Go.DUMMY||this.setMode(Go.DUMMY),this.toolManager.clearDummies(t)}setDummies(t){this.mode&Go.DUMMY||this.setMode(Go.DUMMY),this.toolManager.setDummies(t)}focusAtDummy(t,e=1e3){this.mode&Go.DUMMY||this.setMode(Go.DUMMY),this.toolManager.focusAtDummy(t,e)}highlightDummies(t){this.mode&Go.DUMMY||this.setMode(Go.DUMMY),this.toolManager.highlightDummies(t)}resetHighlightDummies(){this.mode&Go.DUMMY||this.setMode(Go.DUMMY),this.toolManager.resetHighlightDummies()}getAssetLabels(t,e){var i;if(this.mode===Go.DUMMY)return null==(i=this.toolManager.get(Yo.DUMMY))?void 0:i.getDummyLabels(e)}getAssetBoundingBox(t,e){var i;if(this.mode===Go.DUMMY)return null==(i=this.toolManager.get(Yo.DUMMY))?void 0:i.getDummiesBoundingBox(t,e)}bindEditorDrag(t){var e;if(this.mode===Go.DUMMY)return null==(e=this.toolManager.get(Yo.DUMMY))?void 0:e.bindEditorDrag(t)}setEditorDraggingObject(t){var e,i;if(this.mode===Go.DUMMY){const n=null==(e=this.toolManager.get(Yo.DUMMY))?void 0:e.getDraggingObject(t);null==(i=this.toolManager.get(Yo.DRAG))||i.setDraggingObject(n)}}getDummies(t){var e;if(this.mode===Go.DUMMY)return null==(e=this.toolManager.get(Yo.DUMMY))?void 0:e.getDummiesVo(t)}setFillByIds(t,e){var i;this.mode&Yo.DISTRIBUTION||this.setMode(Go.DISTRIBUTION),null==(i=this.toolManager.get(Yo.DISTRIBUTION))||i.setFillByIds(t,e)}setStrokeByIds(t,e){var i;this.mode&Yo.DISTRIBUTION||this.setMode(Go.DISTRIBUTION),null==(i=this.toolManager.get(Yo.DISTRIBUTION))||i.setStrokeByIds(t,e)}clearFillByIds(t){var e;this.mode&Yo.DISTRIBUTION||this.setMode(Go.DISTRIBUTION),null==(e=this.toolManager.get(Yo.DISTRIBUTION))||e.clearFillByIds(t)}clearStrokeByIds(t){var e;this.mode&Yo.DISTRIBUTION||this.setMode(Go.DISTRIBUTION),null==(e=this.toolManager.get(Yo.DISTRIBUTION))||e.clearStrokeByIds(t)}clearByIds(t){var e;this.mode&Yo.DISTRIBUTION||this.setMode(Go.DISTRIBUTION),null==(e=this.toolManager.get(Yo.DISTRIBUTION))||e.clearByIds(t)}getLegend(){var t;return this.mode&Yo.DISTRIBUTION||this.setMode(Go.DISTRIBUTION),null==(t=this.toolManager.get(Yo.DISTRIBUTION))?void 0:t.getLegend()}linkAssetsByTree(t){var e;this.mode!==Go.LINKER&&this.setMode(Go.LINKER),null==(e=this.toolManager.get(Yo.LINKER))||e.linkAssetsByTree(t)}}class Zg extends Fi{constructor(){super(),c(this,"name","App2@"+si.now()),c(this,"scenes",[]),c(this,"requestHeader",{}),c(this,"_tic"),c(this,"_url"),c(this,"_layers"),c(this,"_lastCameraVersion",-1/0),c(this,"_runningHandler",this.running.bind(this)),c(this,"_pointerOverHandler",(t=>this.dispatchEvent(t))),c(this,"_pointerOutHandler",(t=>this.dispatchEvent(t))),c(this,"_selectedHandler",(t=>this.dispatchEvent(t))),c(this,"_dragEndHandler",(t=>this.dispatchEvent(t))),this.adapter=new yf}destroy(){var t,e,i,n,s;this.unbindEvents(),super.destroy(),null==(t=this.composer)||t.destroy(),null==(e=this.mainScene)||e.destroy(),null==(i=this.animateScene)||i.destroy(),null==(n=this.view)||n.destroy(),null==(s=this.renderer)||s.destroy()}init(t={}){var e,i;return this.params=t,this.renderer||(this.renderer=new Tf(t)),this.view||(this.view=new Fm(t)),this.composer||(this.composer=new Pf(this.renderer,new Lf(t))),this.editor||(this.editor=new Xg(this.params.inpEl?this.params.inpEl:this.params.cvs,this.view)),null==(e=this.mainScene)||e.destroy(),this.mainScene=new eg(t,this.adapter),null==(i=this.animateScene)||i.destroy(),this.animateScene=new rg(t),this.trans2LoadingScene(),this.bindEvents(),this}bindEvents(){var t,e,i,n;this.unbindEvents(),null==(t=this.editor)||t.addEventListener(Mi.POINTER_OVER,this._pointerOverHandler),null==(e=this.editor)||e.addEventListener(Mi.POINTER_OUT,this._pointerOutHandler),null==(i=this.editor)||i.addEventListener(Mi.SELECTED,this._selectedHandler),null==(n=this.editor)||n.addEventListener(Mi.DRAG_END,this._dragEndHandler)}unbindEvents(){var t,e,i,n;null==(t=this.editor)||t.removeEventListener(Mi.POINTER_OVER,this._pointerOverHandler),null==(e=this.editor)||e.removeEventListener(Mi.POINTER_OUT,this._pointerOutHandler),null==(i=this.editor)||i.removeEventListener(Mi.SELECTED,this._selectedHandler),null==(n=this.editor)||n.removeEventListener(Mi.DRAG_END,this._dragEndHandler)}get isLoadingScene(){var t;return"LoadingScene"===(null==(t=this.scenes[0])?void 0:t.name)}setRequestHeader(t){return this.requestHeader=t,this}load(t,e,i=2){return d(this,null,(function*(){if(this._tic&&this._tic.clear(),this._url=t,this._layers=e,yield this.trans2LoadingScene(),!t)throw"url not found";const i=yield this.adapter.setRequestHeader(this.requestHeader).load(t,e);return this.adapter.bindScene(this.mainScene).initResources(i,e),yield this.trans2MainScene(),(i||{}).idsTree}))}hasScene(t){return this.scenes.findIndex((e=>e.uuid===t.uuid))>=0}pushScene(t){this.hasScene(t)||(this.view.bindScene(t),this.scenes.push(t))}clearScenes(){this.view.scenes.length=0,this.scenes.forEach((t=>this.removeScene(t))),this.scenes.length=0,this.loadingScene=void 0}removeScene(t){const e=this.scenes.findIndex((e=>e.uuid===t.uuid));e<0||(this.scenes[e].destroy(),this.scenes.splice(e,1))}removeLoadingScene(){this.loadingScene&&(this.removeScene(this.loadingScene),this.loadingScene=void 0)}trans2LoadingScene(){return d(this,null,(function*(){var t;this.clearScenes(),this.loadingScene||(this.loadingScene=new Om(this.params)),this.pushScene(this.loadingScene),null==(t=this.editor)||t.dispose(),this.view.fullscreen(250);const e=new Of(this.loadingScene,this.view.camera);this.composer.clearPasses(),this.composer.addPass(e),this.mainScene=new eg(this.params,this.adapter)}))}trans2MainScene(){return d(this,null,(function*(){var t,e;this.clearScenes(),this.mainScene||(this.mainScene=new eg(this.params,this.adapter)),this.animateScene||(this.animateScene=new rg(this.params)),null==(t=this.editor)||t.setMode(Go.DEFAULT),null==(e=this.editor)||e.bindScene(this.mainScene,this.animateScene),this.mainScene.setViewBox(this.adapter.getViewBox()),this.pushScene(this.mainScene),this.view.scene=this.mainScene,this.view.fullscreen(10,!0);const i=new Rf(this.mainScene,this.view.camera,!1,!1),n=new Of(this.animateScene,this.view.camera,!1,!1),s=new Ff;this.composer.clearPasses(),this.params.bgPass&&this.composer.addPass(new Gf(this.view.camera)),this.composer.addPass(i),this.composer.addPass(n),this.composer.addPass(s)}))}trans2EmptyScene(){var t;this.clearScenes(),this.emptyScene=new ag(this.params),null==(t=this.editor)||t.dispose(),this.pushScene(this.emptyScene),this.view.scene=this.emptyScene,this.view.fullscreen(250,!0),this.editor&&this.editor.bindScene(this.emptyScene);const e=new Of(this.emptyScene,this.view.camera);this.composer.clearPasses(),this.composer.addPass(e)}debounceCacheChanged(t=!1){this.params.debounceCache=t}wireframeChanged(t=!1){this.params.wireframe=t}sliceDurationChanged(t){this.params.sliceDuration=t}selectEnableChanged(t=!1){return d(this,null,(function*(){var e;yield this.clearSelected(),this.params.selectEnable=t,null==(e=this.editor)||e.selectEnableChanged(t)}))}multiSelectEnableChanged(t=!1){return d(this,null,(function*(){var e;yield this.clearSelected(),this.params.multiSelectEnable=t,null==(e=this.editor)||e.multiSelectEnableChanged(t)}))}assetTypeChanged(t){return d(this,null,(function*(){t&&(this.params.assetType=t,this.setAssetType(t))}))}fnEnableChanged(t){return d(this,null,(function*(){var e;this.params.fnEnable=!!t,null==(e=this.editor)||e.fnEnableChanged(t)}))}zoomToSelectEnableChanged(t){return d(this,null,(function*(){this.params.zoomToSelectEnable=!!t}))}socialDistanceEnableChanged(t){return d(this,null,(function*(){this.params.socialDistanceEnable=!!t}))}enableHoverChanged(t){return d(this,null,(function*(){var e,i;ri.set(this.params,"controls.enableHover",!!t),null==(i=null==(e=this.editor)?void 0:e.handler)||i.enableHover(this.params.controls.enableHover)}))}resize(){var t;let e;this.params.containerId&&(e=Ae.window.document.getElementById(this.params.containerId)),e||(e=Ae.window.document.getElementsByTagName("body")[0]);const i=null==(t=null==e?void 0:e.parentElement)?void 0:t.getBoundingClientRect();i&&this.setSize(i.width,i.height)}setSize(t,e){var i,n,s;null==(i=this.renderer)||i.setSize(t,e),null==(n=this.view)||n.resize(),null==(s=this.composer)||s.setSize(t,e)}refresh(){this.view.camera.needsUpdate=!0}fullscreen(){this.view.fullscreen(1,!0)}saveCameraPosition(t){this.view.saveCameraPosition(t)}restoreCameraPosition(t){this.view.restoreCameraPosition(t)}clearCameraPosition(t){this.view.clearCameraPosition(t)}zoomIn(){this.view.zoomIn()}zoomOut(){this.view.zoomOut()}fontZoomIn(t=1.1){var e;null==(e=this.mainScene)||e.increaseFontSize(t)}fontZoomOut(t=.9){var e;null==(e=this.mainScene)||e.increaseFontSize(t)}unproject(t){return d(this,null,(function*(){return Jg.copy(t).unproject(this.view.camera)}))}strokeMore(t=1.1){var e;null==(e=this.mainScene)||e.increaseStrokeWidth(t)}strokeLess(t=.9){var e;null==(e=this.mainScene)||e.increaseStrokeWidth(t)}updateLayersVisibility(t,e=!1){this.adapter.updateLayersVisibility(t,e)}getLayers(t=2){return d(this,null,(function*(){return this.adapter.getLayers(t)}))}focusAtIds(t,e=100){return d(this,null,(function*(){if(!this.mainScene)return;const i=this.adapter.getBoundingBoxByIds(t);return i&&!i.isEmpty()?(i.expandByVector(new We(1,1).multiplyScalar(e)),i.isEmpty()||(yield this.view.resetCameraByBoundingBox(i,!0)),i):void 0}))}clearSelected(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.clearSelected(t)}))}targetByIds(t){return d(this,null,(function*(){var e,i;this.clearSelected(),this.selectByIds(t);let n=null==(e=this.mainScene)?void 0:e.getAssetBoundingBox(t);n||(n=null==(i=this.editor)?void 0:i.getAssetBoundingBox(t)),n&&(n.isEmpty()||(n.getSize(Jg),n.expandByScalar(Math.round(.5*Math.max(Jg.x,Jg.y))),yield this.view.resetCameraByBoundingBox(n,!0)))}))}getAssetIdsByType(t){return d(this,null,(function*(){var e;return null==(e=this.adapter)?void 0:e.getAssetIdsByType(t)}))}setFillByIds(t,e){return d(this,null,(function*(){var i;null==(i=this.editor)||i.setFillByIds(t,e)}))}clearFillByIds(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.clearFillByIds(t)}))}setStrokeByIds(t,e){return d(this,null,(function*(){var i;null==(i=this.editor)||i.setStrokeByIds(t,e)}))}clearFill(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.clearFillByIds()}))}clearStroke(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.clearStrokeByIds()}))}getLegend(){return d(this,null,(function*(){var t;return null==(t=this.editor)?void 0:t.getLegend()}))}getAssetLabels(t,e){return d(this,null,(function*(){var i,n;return t===Bi?null==(i=this.editor)?void 0:i.getAssetLabels(t,e):null==(n=this.mainScene)?void 0:n.getAssetLabels(t,e)}))}setAssetLabels(t,e){return d(this,null,(function*(){var i;return null==(i=this.mainScene)?void 0:i.setAssetLabels(t,e)}))}clearAssetLabels(t){return d(this,null,(function*(){var e;return null==(e=this.mainScene)?void 0:e.clearAssetLabels(t)}))}selectByIds(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.selectByIds(t,!0)}))}getAssetBoundingBox(t,e){return d(this,null,(function*(){var i,n;let s=null==(i=this.mainScene)?void 0:i.getAssetBoundingBox(t);if(s||(s=null==(n=this.editor)?void 0:n.getAssetBoundingBox(t)),s)return e?s.applyMatrix3(this.view.camera.viewMatrix):s}))}setAssetType(t,e){var i;t&&(this.params.assetType=t,null==(i=this.mainScene)||i.setAssetType(t,e))}linkAssetsByTree(t){var e;null==(e=this.editor)||e.linkAssetsByTree(t)}clearDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.clearDummies(t)}))}setDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setDummies(t)}))}focusAtDummy(t,e=1e3){return d(this,null,(function*(){var i;return null==(i=this.editor)?void 0:i.focusAtDummy(t,e)}))}highlightDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.highlightDummies(t)}))}resetHighlightDummies(){return d(this,null,(function*(){var t;return null==(t=this.editor)?void 0:t.resetHighlightDummies()}))}setEditorMode(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setMode(t)}))}bindEditorDrag(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.bindEditorDrag(t)}))}setEditorDraggingObject(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setEditorDraggingObject(t)}))}getDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.getDummies(t)}))}start(){requestAnimationFrame(this._runningHandler)}running(t){var e,i,n,s,r,a;null==(e=this.view)||e.update(t),null==(i=this.editor)||i.update(),(null==(n=this.scenes)?void 0:n.length)&&this.scenes.forEach((t=>"function"==typeof(null==t?void 0:t.update)?t.update():void 0)),null==(s=this.composer)||s.render(),this._lastCameraVersion=null==(a=null==(r=this.view)?void 0:r.camera)?void 0:a.version,requestAnimationFrame(this._runningHandler)}}const Jg=new We;class Qg extends Sh{constructor(t,e,i){super(t,e,i),c(this,"hammer"),c(this,"sendEventHandler",this.sendEvent.bind(this)),this.hammer=new Hammer.Manager(t,{domEvents:!0});const n=new Hammer.Pan({threshold:0,pointers:0}),s=new Hammer.Pinch({threshold:0}),r=new Hammer.Tap({event:"singletap",taps:1}),a=new Hammer.Press({});this.hammer.add([n,r,a,s]),s.recognizeWith(n),this.hammer.on(["panstart","panmove","panend"].join(" "),(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center,isFirst:t.isFirst,pointers:JSON.parse(JSON.stringify(t.pointers))};e(i)}(t,this.sendEventHandler))),this.hammer.on(["pinchstart","pinchmove","pinchend"].join(" "),(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center,isFirst:t.isFirst,pointers:JSON.parse(JSON.stringify(t.pointers)),isFinal:t.isFinal,scale:t.scale};e(i)}(t,this.sendEventHandler))),this.hammer.on("singletap",(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center};e(i)}(t,this.sendEventHandler))),this.hammer.on("press",(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center};e(i)}(t,this.sendEventHandler))),this.hammer.on("hammer.input",(t=>function(t,e){t.preventDefault(),e({type:t.type,isFirst:t.isFirst,isFinal:t.isFinal})}(t,this.sendEventHandler)))}destroy(){var t;null==(t=this.hammer)||t.stop(!0),this.hammer.destroy()}sendEvent(t){this.worker&&this.worker.postMessage({type:"event",id:this.id,data:t}),Ah.instance().handleEvent({id:this.id,data:t})}}function Kg(t){const e=document.getElementById(t.canvasId);if(!e)throw new Error(`Canvas element with id ${t.canvasId} not found`);const i=new Qg(e,kh),n=Ah.instance().getProxy(i.id);return n.ownerDocument=n,t.inpEl=n,t}class ty extends Zg{constructor(t={},e){var i;super(),c(this,"name","App2Offscreen@"+si.now()),c(this,"cvs"),c(this,"worker"),c(this,"container"),c(this,"offset",new We),c(this,"label"),c(this,"proxy"),c(this,"resizeHandler",ri.debounce(this.resize.bind(this),100)),c(this,"messageHandler",this.handleMessage.bind(this)),c(this,"focusHandler",(t=>this.cvs.focus())),this.params=t,this.params.dpr=1,this.worker=e,this.container=document.getElementById(null==(i=this.params)?void 0:i.containerId),this.container||(this.container=Ae.window.document.getElementsByTagName("body")[0]);let n=this.container.getBoundingClientRect();this.offset.set(n.left,n.top),this.label=new vo(this.container,""),this.params.cvs?(this.cvs=this.params.cvs,delete this.params.cvs):this.cvs=Pn.createCanvas(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}bindEvents(){this.unbindEvents(),window.addEventListener("resize",this.resizeHandler),this.cvs.tabIndex=0,this.cvs.focus(),this.cvs.addEventListener("click",this.focusHandler)}unbindEvents(){window.removeEventListener("resize",this.resizeHandler),this.cvs.removeEventListener("click",this.focusHandler)}resize(){return d(this,null,(function*(){var t;let e;this.params.containerId&&(e=window.document.getElementById(this.params.containerId)),e||(e=window.document.getElementsByTagName("body")[0]);const i=null==(t=null==e?void 0:e.parentElement)?void 0:t.getBoundingClientRect();if(i&&this.cvs)return Pn.resizeCanvas(this.cvs,i.width,i.height,this.params.dpr),this.postAsync({type:Mi.SET_SIZE,w:i.width,h:i.height})}))}start(){"function"==typeof this.cvs.transferControlToOffscreen?(this.workerStart(this.cvs),this.worker.addEventListener("message",this.messageHandler)):this.init(this.params).start()}handleMessage(t){switch(t.data.type){case Mi.POINTER_OVER:case Mi.POINTER_OUT:case Mi.SELECTED:case Mi.DRAG_END:this.dispatchEvent(t.data);break;case Mi.SET_CURSOR:this.cvs.style.cursor=t.data.cursorStyle}}workerStart(t){this.cvs.focus();const e=this.cvs.transferControlToOffscreen();this.proxy=new Qg(this.cvs,kh,this.worker);const i=ri.cloneDeep(this.params);delete i.cvs,this.worker.postMessage({type:"start",canvas:e,proxyId:this.proxy.id,conf:i},[e])}postAsync(t){return new Promise(((e,i)=>{const n=i=>{var r;(null==(r=null==i?void 0:i.data)?void 0:r.type)===(null==t?void 0:t.type)&&(this.worker.removeEventListener("message",n),this.worker.removeEventListener("error",s),e(i.data.data))},s=t=>{this.worker.removeEventListener("message",n),this.worker.removeEventListener("error",s),i(t.error)};this.worker.addEventListener("message",n),this.worker.addEventListener("error",s),this.worker.postMessage(t)}))}debounceCacheChanged(t=!1){this.worker.postMessage({type:Mi.DEBOUNCE_CACHE_CHANGED,v:t})}wireframeChanged(t=!1){this.worker.postMessage({type:Mi.WIREFRAME_CHANGED,v:t})}sliceDurationChanged(t=0){this.worker.postMessage({type:Mi.SLICE_DURATION_CHANGED,v:t})}selectEnableChanged(t=!1){return d(this,null,(function*(){this.worker.postMessage({type:Mi.SELECT_ENABLE_CHANGED,v:t})}))}multiSelectEnableChanged(t=!1){return d(this,null,(function*(){this.worker.postMessage({type:Mi.MULTI_SELECT_ENABLE_CHANGED,v:t})}))}assetTypeChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:Mi.ASSET_TYPE_CHANGED,v:t})}))}fnEnableChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:Mi.FN_ENABLE_CHANGED,v:t})}))}zoomToSelectEnableChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:Mi.ZOOM_TO_SELECT_ENABLE_CHANGED,v:t})}))}socialDistanceEnableChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:Mi.SOCIAL_DISTANCE_ENABLE_CHANGED,v:t})}))}enableHoverChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:Mi.ENABLE_HOVER_CHANGED,v:t})}))}refresh(){this.postAsync({type:Mi.REFRESH})}fullscreen(){return d(this,null,(function*(){yield this.postAsync({type:Mi.FULLSCREEN})}))}saveCameraPosition(t){return d(this,null,(function*(){const e=yield this.postAsync({type:Mi.GET_CAMERA_POSITION}),i=t?Um+t:Um;sessionStorage.setItem(i,JSON.stringify(e))}))}restoreCameraPosition(t){return d(this,null,(function*(){const e=t?Um+t:Um,i=sessionStorage.getItem(e);if(!i)return this.fullscreen();const n=JSON.parse(i||"{}");yield this.postAsync({type:Mi.SET_CAMERA_POSITION,data:n})}))}clearCameraPosition(t){return d(this,null,(function*(){const e=t?Um+t:Um;sessionStorage.setItem(e,"")}))}zoomIn(){return d(this,null,(function*(){this.postAsync({type:Mi.ZOOM_IN})}))}zoomOut(){return d(this,null,(function*(){this.postAsync({type:Mi.ZOOM_OUT})}))}fontZoomIn(t=1.1){return d(this,null,(function*(){this.postAsync({type:Mi.FONT_ZOOM_IN,v:t})}))}fontZoomOut(t=.9){return d(this,null,(function*(){this.postAsync({type:Mi.FONT_ZOOM_OUT,v:t})}))}unproject(t){return d(this,null,(function*(){return this.postAsync({type:Mi.UNPROJECT,v:t})}))}load(t,e,i=2){return d(this,null,(function*(){return this.postAsync({type:Mi.LOAD,url:t,layers:e,lv:i})}))}strokeMore(t=1.1){return d(this,null,(function*(){this.postAsync({type:Mi.STROKE_MORE,v:t})}))}strokeLess(t=.9){return d(this,null,(function*(){this.postAsync({type:Mi.STROKE_LESS,v:t})}))}updateLayersVisibility(t,e=!1){return d(this,null,(function*(){this.postAsync({type:Mi.UPDATE_LAYERS_VISIBILITY,ids:t,visible:e})}))}getLayers(t=2){return d(this,null,(function*(){return this.postAsync({type:Mi.GET_LAYERS,lv:t})}))}focusAtIds(t,e=100){return d(this,null,(function*(){return this.postAsync({type:Mi.FOCUS_AT_IDS,ids:t,padding:e})}))}clearSelected(t){return d(this,null,(function*(){return this.postAsync({type:Mi.CLEAR_SELECTED,ids:t})}))}targetByIds(t){return d(this,null,(function*(){return this.postAsync({type:Mi.TARGET_BY_IDS,ids:t})}))}getAssetIdsByType(t){return d(this,null,(function*(){return this.postAsync({type:Mi.GET_ASSET_IDS_BY_TYPE,assetType:t})}))}setFillByIds(t,e){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_FILL_BY_IDS,ids:t,c:e})}))}clearFillByIds(t){return d(this,null,(function*(){return this.postAsync({type:Mi.CLEAR_FILL_BY_IDS,ids:t})}))}setStrokeByIds(t,e){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_STROKE_BY_IDS,ids:t,c:e})}))}clearFill(){return d(this,null,(function*(){return this.postAsync({type:Mi.CLEAR_FILL})}))}clearStroke(){return d(this,null,(function*(){return this.postAsync({type:Mi.CLEAR_STROKE})}))}getLegend(){return d(this,null,(function*(){return this.postAsync({type:Mi.GET_LEGEND})}))}getAssetLabelById(t,e){return d(this,null,(function*(){return this.postAsync({type:Mi.GET_ASSET_LABELS,assetType:t,id:e})}))}setAssetLabels(t,e){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_ASSET_LABELS,id:t,labels:e})}))}clearAssetLabels(t){return d(this,null,(function*(){return this.postAsync({type:Mi.CLEAR_ASSET_LABELS,assetType:t})}))}selectByIds(t){return d(this,null,(function*(){return this.postAsync({type:Mi.SELECT_BY_IDS,ids:t})}))}getAssetBoundingBox(t,e=!1){return d(this,null,(function*(){return this.postAsync({type:Mi.GET_ASSET_BOUNDING_BOX,id:t,isViewCoords:e})}))}showAssetsLabel(t,e,i){return d(this,null,(function*(){var n,s;if(!e)return;const r=yield this.getAssetLabelById(t,e);if(r&&(i=r.join("<br/>")+(i?"<br/>"+i:"")),!i)return;null==(n=this.label)||n.setHtml(i);const a=yield this.getAssetBoundingBox(e,!0);a&&(ey.copy(a.min).add(this.offset).round(),null==(s=this.label)||s.show(ey))}))}hideAssetsLabel(){return d(this,null,(function*(){var t;return null==(t=this.label)?void 0:t.hide()}))}setAssetType(t,e){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_ASSET_TYPE,assetType:t,showLayers:e})}))}linkAssetsByTree(t){return d(this,null,(function*(){return this.postAsync({type:Mi.LINK_ASSETS_BY_TREE,o:t})}))}clearDummies(t){return d(this,null,(function*(){return this.postAsync({type:Mi.CLEAR_DUMMIES,aeTypes:t})}))}setDummies(t){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_DUMMIES,dummies:t})}))}focusAtDummy(t,e=1e3){return d(this,null,(function*(){return this.postAsync({type:Mi.FOCUS_AT_DUMMY,id:t,padding:e})}))}highlightDummies(t){return d(this,null,(function*(){return this.postAsync({type:Mi.HIGHLIGHT_DUMMIES,ids:t})}))}resetHighlightDummies(){return d(this,null,(function*(){return this.postAsync({type:Mi.RESET_HIGHLIGHT_DUMMIES})}))}setEditorMode(t){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_EDITOR_MODE,mode:t})}))}bindEditorDrag(t){return d(this,null,(function*(){return this.postAsync({type:Mi.BIND_EDITOR_DRAG,vo:t})}))}setEditorDraggingObject(t){return d(this,null,(function*(){return this.postAsync({type:Mi.SET_EDITOR_DRAGGING_OBJECT,vo:t})}))}handleExternalEvent(t){return d(this,null,(function*(){var e;this.postAsync({type:"event",id:null==(e=this.proxy)?void 0:e.id,data:t})}))}drag(t,e){return d(this,null,(function*(){const i=this,n=function(t){i.bindEditorDrag(e),i.setEditorDraggingObject(e);const n={type:t.type,center:t.center,isFirst:t.isFirst,pointers:JSON.parse(JSON.stringify(t.pointers))};i.handleExternalEvent(n)};if(!iy.has(t)){const e=new Hammer.Manager(t,{domEvents:!0});e.add(new Hammer.Pan({threshold:0,pointers:0})),e.on(["panstart","panmove","panend"].join(" "),n),iy.set(t,e)}}))}drop(t){return d(this,null,(function*(){var e;iy.has(t)&&(null==(e=iy.get(t))||e.destroy(),iy.delete(t))}))}getDummies(t){return d(this,null,(function*(){return this.postAsync({type:Mi.GET_DUMMIES,hasBound:t})}))}}const ey=new We,iy=new Map;function ny(t){return new Worker("/environment.worker.js",{type:"module",name:null==t?void 0:t.name})}function sy(t){return new Worker("/renderer2.worker.js",{type:"module",name:null==t?void 0:t.name})}export{Mi as APP_ENUM,Bi as ASSET_TYPE_DUMMY,Zg as App2,ty as App2Offscreen,$l as AppEnum,Li as AssetTypeEnum,ai as Box2,Re as Color,Le as ColorsEnum,Go as EDITOR_MODE,ny as EnvironmentWorker,Ae as GLOB,vo as Label,Pi as LayerTypeEnum,yi as Monitor,sy as Renderer2Worker,Yl as SvgApp,Yo as TOOL_TYPE,We as Vector2,Wi as assetTypeConflicts,b as defaultConfig,Hi as getAssetLabelByType,zi as getAssetLayerByType,Ii as getIdsByTree,Ci as getRandomString,Kg as polyfillHammerProxy,Ti as randomDelay};
|