@netless/appliance-plugin 1.1.34-beta.2 → 1.1.34-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -563,7 +563,7 @@ void main() {
563
563
  gl_FragColor = color;
564
564
  }`},function(i,e,t){t.r(e),(function(r,n){t.d(e,"requestAnimationFrame",function(){return c}),t.d(e,"cancelAnimationFrame",function(){return l}),t(1).glMatrix.setMatrixArrayType(Array);function s(){if(typeof performance<"u"&&performance.now)return performance.now();if(typeof r<"u"&&r.hrtime){const[f,h]=r.hrtime();return f*1e3+h*1e-6}return Date.now?Date.now():new Date().getTime()}let c,l;typeof n<"u"&&typeof n.requestAnimationFrame=="function"?(c=n.requestAnimationFrame,l=n.cancelAnimationFrame):(c=function(f){return setTimeout(()=>{f(s())},16)},l=function(f){return clearTimeout(f)})}).call(this,t(69),t(22))},function(i,e){var t=i.exports={},r,n;function s(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?r=setTimeout:r=s}catch{r=s}try{typeof clearTimeout=="function"?n=clearTimeout:n=c}catch{n=c}})();function l(O){if(r===setTimeout)return setTimeout(O,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(O,0);try{return r(O,0)}catch{try{return r.call(null,O,0)}catch{return r.call(this,O,0)}}}function f(O){if(n===clearTimeout)return clearTimeout(O);if((n===c||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(O);try{return n(O)}catch{try{return n.call(null,O)}catch{return n.call(this,O)}}}var h=[],v=!1,u,y=-1;function T(){!v||!u||(v=!1,u.length?h=u.concat(h):y=-1,h.length&&w())}function w(){if(!v){var O=l(T);v=!0;for(var d=h.length;d;){for(u=h,h=[];++y<d;)u&&u[y].run();y=-1,d=h.length}u=null,v=!1,f(O)}}t.nextTick=function(O){var d=new Array(arguments.length-1);if(arguments.length>1)for(var g=1;g<arguments.length;g++)d[g-1]=arguments[g];h.push(new I(O,d)),h.length===1&&!v&&l(w)};function I(O,d){this.fun=O,this.array=d}I.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function S(){}t.on=S,t.addListener=S,t.once=S,t.off=S,t.removeListener=S,t.removeAllListeners=S,t.emit=S,t.prependListener=S,t.prependOnceListener=S,t.listeners=function(O){return[]},t.binding=function(O){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(O){throw new Error("process.chdir is not supported")},t.umask=function(){return 0}},function(i,e,t){t.r(e),t.d(e,"default",function(){return D});var r=t(1),n=t(71),s=t(73),c=t(213),l=t(214),f=t(215),h=t(216);t(1).glMatrix.setMatrixArrayType(Array);function v(U,M){var W=Object.keys(U);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(U);M&&(X=X.filter(function(B){return Object.getOwnPropertyDescriptor(U,B).enumerable})),W.push.apply(W,X)}return W}function u(U){for(var M=1;M<arguments.length;M++){var W=arguments[M]!=null?arguments[M]:{};M%2?v(Object(W),!0).forEach(function(X){y(U,X,W[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(U,Object.getOwnPropertyDescriptors(W)):v(Object(W)).forEach(function(X){Object.defineProperty(U,X,Object.getOwnPropertyDescriptor(W,X))})}return U}function y(U,M,W){return M in U?Object.defineProperty(U,M,{value:W,enumerable:!0,configurable:!0,writable:!0}):U[M]=W,U}const T=Symbol.for("spritejs_changedAttrs"),w=Symbol.for("spritejs_attributes"),I=Symbol("resolution"),S=Symbol("animations"),O=Symbol("eventListeners"),d=Symbol("captureEventListeners"),g=Symbol("filters"),p=Symbol("display"),x=Symbol("program"),E=Symbol("shaderAttrs"),R=Symbol("uniforms");class D{constructor(M={}){this.attributes=new this.constructor.Attr(this),this[I]={width:300,height:150},Object.assign(this.attributes,M),this[S]=new Set,this[O]={},this[d]={}}get ancestors(){let M=this.parent;const W=[];for(;M;)W.push(M),M=M.parent;return W}get animations(){return this[S]}get filters(){return this[g]||this.parent&&this.parent.filters}get isVisible(){return!1}get layer(){return this.parent?this.parent.layer:null}get localMatrix(){const M=this.transformMatrix,{x:W,y:X}=this.attributes;return M[4]+=W,M[5]+=X,M}get opacity(){let M=this.attributes.opacity;return this.parent&&this.parent.opacity!=null&&(M*=this.parent.opacity),M}get parentNode(){return this.parent}get nextSibling(){return this.getNodeNearBy(1)}get previousSibling(){return this.getNodeNearBy(-1)}get program(){return this[x]}get renderer(){return this.parent?this.parent.renderer:null}get renderMatrix(){if(this.__cacheRenderMatrix)return this.__cacheRenderMatrix;let M=this.localMatrix;const W=this.parent;if(W){const X=W.__cacheRenderMatrix||W.renderMatrix;X&&(M=r.mat2d.multiply(Array.of(0,0,0,0,0,0),X,M))}return M}get worldScaling(){const M=this.renderMatrix;return[Math.hypot(M[0],M[1]),Math.hypot(M[2],M[3])]}get worldRotation(){const M=this.renderMatrix;return Math.atan2(M[1],M[3])}get worldPosition(){const M=this.renderMatrix;return[M[4],M[5]]}get uniforms(){return this[R]}get className(){return this.attributes.className}set className(M){this.attributes.className=M}get id(){return this.attributes.id}set id(M){this.attributes.id=M}get name(){return this.attributes.name}set name(M){this.attributes.name=M}get zIndex(){return this.attributes.zIndex}set zIndex(M){this.attributes.zIndex=M}get mesh(){return null}get shaderAttrs(){return this[E]||{}}activateAnimations(){const M=this.layer;if(M){const W=this[S];W.forEach(B=>{B.baseTimeline=M.timeline,B.play(),B.finished.then(()=>{W.delete(B)})});const X=this.children;X&&X.forEach(B=>{B.activateAnimations&&B.activateAnimations()})}}addEventListener(M,W,X={}){M==="mousewheel"&&(M="wheel"),typeof X=="boolean"&&(X={capture:X});const{capture:B,once:N}=X,$=B?d:O;return this[$][M]=this[$][M]||[],this[$][M].push({listener:W,once:N}),this}animate(M,W){const X=new s.default(this,M,W);return this.effects&&X.applyEffects(this.effects),this.layer&&(X.baseTimeline=this.layer.timeline,X.play(),X.finished.then(()=>{this[S].delete(X)})),this[S].add(X),X}attr(...M){if(M.length===0)return this.attributes[w];if(M.length>1){let[W,X]=M;return typeof X=="function"&&(X=X(this.attr(W))),this.setAttribute(W,X),this}return typeof M[0]=="string"?this.getAttribute(M[0]):(Object.assign(this.attributes,M[0]),this)}cloneNode(){const M=new this.constructor,W=this.attributes[T];return M.attr(W),M}connect(M,W){Object.defineProperty(this,"parent",{value:M,writable:!1,configurable:!0}),Object.defineProperty(this,"zOrder",{value:W,writable:!1,configurable:!0}),M.timeline&&this.activateAnimations(),this.setResolution(M.getResolution()),this.forceUpdate(),this.dispatchEvent({type:"append",detail:{parent:M,zOrder:W}})}contains(M){for(;M&&this!==M;)M=M.parent;return!!M}deactivateAnimations(){this[S].forEach(W=>W.cancel());const M=this.children;M&&M.forEach(W=>{W.deactivateAnimations&&W.deactivateAnimations()})}disconnect(){const{parent:M,zOrder:W}=this;delete this.parent,delete this.zOrder,this.deactivateAnimations(),this.dispatchEvent({type:"remove",detail:{parent:M,zOrder:W}}),M&&M.forceUpdate()}dispatchEvent(M){M instanceof l.default||(M=new l.default(M)),M.target=this;let W=M.type;W==="mousewheel"&&(W="wheel");const X=[this];let B=this.parent;for(;M.bubbles&&B;)X.push(B),B=B.parent;for(let N=X.length-1;N>=0;N--){const $=X[N],J=$[d]&&$[d][W];if(J&&J.length&&(M.currentTarget=$,J.forEach(({listener:tt,once:at})=>{tt.call(this,M),at&&X.removeEventListener(tt)}),delete M.currentTarget),!M.bubbles&&M.cancelBubble)break}if(!M.cancelBubble)for(let N=0;N<X.length;N++){const $=X[N],J=$[O]&&$[O][W];if(J&&J.length&&(M.currentTarget=$,J.forEach(({listener:tt,once:at})=>{tt.call(this,M),at&&X.removeEventListener(tt)}),delete M.currentTarget),!M.bubbles||M.cancelBubble)break}}dispatchPointerEvent(M){const{layerX:W,layerY:X}=M;return this.isPointCollision(W,X)?(this.dispatchEvent(M),!0):!1}draw(M=[]){const W=this.mesh;if(W){if(Object(f.applyFilters)(W,this.filters),M.push(W),this[x]){W.setProgram(this[x]);const X=this[E];X&&Object.entries(X).forEach(([N,$])=>{W.setAttribute(N,$)});const B=this[R];if(this[R]){const N={};Object.entries(B).forEach(([$,J])=>{typeof J=="function"&&(J=J(this,$)),N[$]=J}),W.setUniforms(N)}}Object(h.default)(this,W)}return M}forceUpdate(){this.parent&&this.parent.forceUpdate()}getAttribute(M){return this.attributes[M]}getListeners(M,{capture:W=!1}={}){return[...this[W?d:O][M]||[]]}getNodeNearBy(M=1){if(!this.parent)return null;if(M===0)return this;const W=this.parent.children,X=W.indexOf(this);return W[X+M]}getWorldPosition(M,W){const X=this.renderMatrix,B=M*X[0]+W*X[2]+X[4],N=M*X[1]+W*X[3]+X[5];return[B,N]}getOffsetPosition(M,W){const X=r.mat2d.invert(Array.of(0,0,0,0,0,0),this.renderMatrix),B=M*X[0]+W*X[2]+X[4],N=M*X[1]+W*X[3]+X[5];return[B,N]}getResolution(){return u({},this[I])}isPointCollision(M,W){if(!this.mesh)return!1;const X=this.attributes.pointerEvents;if(X==="none"||X!=="all"&&!this.isVisible)return!1;let B="both";return X==="visibleFill"&&(B="fill"),X==="visibleStroke"&&(B="stroke"),this.mesh.isPointCollision(M,W,B)}onPropertyChange(M,W,X){M!=="id"&&M!=="name"&&M!=="className"&&M!=="pointerEvents"&&M!=="passEvents"&&this.forceUpdate(),M==="filter"&&(this[g]=Object(f.parseFilterString)(W)),M==="zIndex"&&this.parent&&this.parent.reorder()}setAttribute(M,W){M==="attrs"&&this.attr(W),this.attributes[M]=W}setMouseCapture(){this.layer&&(this.layer.__mouseCapturedTarget=this)}setProgram(M){this[x]=M,this.forceUpdate()}setShaderAttribute(M,W){this[E]=this[E]||{},this[E][M]=W,this.forceUpdate()}setUniforms(M){this[R]=this[R]||{},Object.assign(this[R],M),this.forceUpdate()}setResolution({width:M,height:W}){const{width:X,height:B}=this[I];(X!==M||B!==W)&&(this[I]={width:M,height:W},this.forceUpdate(),this.dispatchEvent({type:"resolutionchange",detail:{width:M,height:W}}))}show(){this.attributes.display==="none"&&(this.attributes.display=this[p]||"")}hide(){this.attributes.display!=="none"&&(this[p]=this.attributes.display,this.attributes.display="none")}releaseMouseCapture(){this.layer&&this.layer.__mouseCapturedTarget===this&&(this.layer.__mouseCapturedTarget=null)}remove(){return this.parent&&this.parent.removeChild?(this.parent.removeChild(this),!0):!1}removeAllListeners(M,W={}){typeof W=="boolean"&&(W={capture:W});const B=W.capture?d:O;return this[B][M]&&(this[B][M]=[]),this}removeAttribute(M){this.setAttribute(M,null)}removeEventListener(M,W,X={}){typeof X=="boolean"&&(X={capture:X});const N=X.capture?d:O;if(this[N][M]){const $=this[N][M];if($)for(let J=0;J<$.length;J++){const{listener:tt}=$[J];if(tt===W){this[N][M].splice(J,1);break}}}return this}transition(M,W="linear"){const X=this,B=Symbol("animation");W=W||"linear";let N=0;return typeof M=="object"&&(N=M.delay||0,M=M.duration),{[B]:null,cancel($=!1){const J=this[B];J&&J.cancel($)},end(){const $=this[B];$&&($.playState==="running"||$.playState==="pending")&&$.finish()},reverse(){const $=this[B];if($)if($.playState==="running"||$.playState==="pending")$.playbackRate=-$.playbackRate;else{const J=$.timing.direction;$.timing.direction=J==="reverse"?"normal":"reverse",$.play()}return $.finished},attr($,J){return this.end(),typeof $=="string"&&($={[$]:J}),Object.entries($).forEach(([tt,at])=>{typeof at=="function"&&($[tt]=at(X.attr(tt)))}),this[B]=X.animate([$],{duration:M*1e3,delay:N*1e3,fill:"forwards",easing:W}),this[B].finished}}}updateContours(){}}y(D,"Attr",n.default),c.default.registerNode(D,"node")},function(i,e,t){t.r(e),t.d(e,"default",function(){return D});var r=t(1),n=t(12),s=t(72);t(1).glMatrix.setMatrixArrayType(Array);const c=Symbol.for("spritejs_setAttributeDefault"),l=Symbol.for("spritejs_declareAlias"),f=Symbol.for("spritejs_setAttribute"),h=Symbol.for("spritejs_getAttribute"),v=Symbol.for("spritejs_attributes"),u=Symbol.for("spritejs_changedAttrs"),y=Symbol("subject"),T=Symbol("attr"),w=Symbol("default"),I=Symbol("alias");function S(U,[M,W]){let X=r.mat2d.fromValues(1,0,0,1,0,0);return[...U].forEach(([B,N])=>{if((M||W)&&(X=r.mat2d.translate(Array.of(0,0,0,0,0,0),X,[M,W])),B==="matrix")X=r.mat2d.multiply(X,X,N);else if(B==="offsetTranslate")X[4]+=N[0],X[5]+=N[1];else if(B==="offsetRotate")X=r.mat2d.rotate(Array.of(0,0,0,0,0,0),X,N);else if(B==="skew"){const[$,J]=N;X=r.mat2d.multiply(X,X,r.mat2d.fromValues(1,Math.tan(J),Math.tan($),1,0,0))}else r.mat2d[B](X,X,N);(M||W)&&(X=r.mat2d.translate(Array.of(0,0,0,0,0,0),X,[-M,-W]))}),X}const O=Symbol("transformMatrix"),d=Symbol("transforms"),g=Symbol("changedAttrs"),p=Symbol("lastChangedAttr"),x=Symbol("offsetFigure");function E(U,M,W){const X=U[T][M];if(U[f](M,W,!1)||U[p]!==M){const N=U[d];N.has(M)&&N.delete(M),W&&(M==="rotate"&&(W=Math.PI*W/180),M==="scale"&&(W=W.map($=>Math.abs($)>1e-5?$:1/$>0?1e-5:-1e-5)),N.set(M,W)),U[O]=null,U[y].onPropertyChange(M,W,X,U)}}function R(U){const M=U[x],W=U.offsetDistance*M.getTotalLength(),X=M.getPointAtLength(W);if(X){const B=U[d];let N=U.offsetRotate;N==="auto"?N=X.angle:N==="reverse"?N=Math.PI+X.angle:N=Math.PI*N/180,B.set("offsetRotate",N),B.set("offsetTranslate",[X.x,X.y]),U[O]=null}}class D{static setDefault(M,...W){return M[c](...W)}static declareAlias(M,...W){return M[l](...W)}static setAttribute(M,...W){return M[f](...W)}static getAttribute(M,...W){return M[h](...W)}static getAttributes(M){return M[v]}static getChangedAttributes(M){return M[u]}constructor(M){this[y]=M,this[T]={},this[O]=r.mat2d.fromValues(1,0,0,1,0,0),this[d]=new Map,this[w]={},this[I]=[],Object.defineProperty(M,"transformMatrix",{get:()=>(this[O]||(this[O]=S(this[d],this.transformOrigin)),[...this[O]])}),this[c]({id:"",name:"",className:"",x:0,y:0,transformOrigin:[0,0],transform:"",translate:[0,0],rotate:0,scale:[1,1],skew:[0,0],opacity:1,zIndex:0,offsetPath:void 0,offsetDistance:0,offsetRotate:"auto",pointerEvents:"visible",filter:"none",display:""}),this[l]("class","pos"),this[g]=new Set,this[x]=new n.Figure2D({scale:5,simplify:0})}get[u](){const M={};return[...this[g]].forEach(W=>{M[W]=this[T][W]}),M}get[v](){const M=Object.assign({},this[T]);for(let W=0;W<this[I].length;W++){const X=this[I][W];M[X]=this[X]}return M}[c](M){Object.assign(this[w],M),Object.assign(this[T],M)}[l](...M){this[I].push(...M)}[f](M,W,X=!0){const B=this[T][M],N=this[y];return W==null&&(W=this[w][M]),Object(s.compareValue)(B,W)?!1:(this[T][M]=W,this[g].has(M)&&this[g].delete(M),this[g].add(M),this[p]=M,X&&N.onPropertyChange(M,W,B,this),!0)}[h](M){return this[T][M]}set id(M){this[f]("id",M)}get id(){return this[h]("id")}set name(M){this[f]("name",M)}get name(){return this[h]("name")}set className(M){this[f]("className",M)}get className(){return this[h]("className")}set class(M){this.className=M}get class(){return this.className}get x(){return this[h]("x")}set x(M){this[f]("x",Object(s.toNumber)(M))}get y(){return this[h]("y")}set y(M){this[f]("y",Object(s.toNumber)(M))}get pos(){return[this.x,this.y]}set pos(M){M=Object(s.toArray)(M),Array.isArray(M)||(M=[M,M]),this.x=M[0],this.y=M[1]}get transform(){return this[h]("transform")}set transform(M){let W=null;if(Array.isArray(M)&&(W=M,M=`matrix(${M.map(s.toNumber).join()})`),typeof M=="string")M=M.replace(/\s*,\s*/g,",");else if(M!=null)throw new TypeError("Invalid transform value.");const X=this[T].transform;if(this[f]("transform",M,!1)){const B=this[d];if(B.has("matrix")&&B.delete("matrix"),W)B.set("matrix",W);else if(M){const N=M.match(/(matrix|translate|rotate|scale|skew)\([^()]+\)/g);if(N){let $=r.mat2d.fromValues(1,0,0,1,0,0);for(let J=0;J<N.length;J++){const at=N[J].match(/^(matrix|translate|rotate|scale|skew)\(([^()]+)\)/);if(at){let[,ut,V]=at;ut==="rotate"?V=Math.PI*parseFloat(V)/180:V=V.trim().split(/[\s,]+/).map(Q=>Object(s.toNumber)(Q)),ut==="matrix"?$=r.mat2d.multiply($,$,V):ut==="skew"?$=r.mat2d.multiply($,$,r.mat2d.fromValues(1,Math.tan(V[1]),Math.tan(V[0]),1,0,0)):r.mat2d[ut]($,$,V),B.set("matrix",$)}}}else throw new TypeError("Invalid transform value.")}this[O]=null,this[y].onPropertyChange("transform",M,X,this)}}get transformOrigin(){return this[h]("transformOrigin")}set transformOrigin(M){M=Object(s.toArray)(M,!0),M!=null&&!Array.isArray(M)&&(M=[M,M]),this[f]("transformOrigin",M)&&(this[O]=null)}get rotate(){return this[h]("rotate")}set rotate(M){E(this,"rotate",M)}get translate(){return this[h]("translate")}set translate(M){M=Object(s.toArray)(M,!0),M!=null&&!Array.isArray(M)&&(M=[M,M]),E(this,"translate",M)}get scale(){return this[h]("scale")}set scale(M){M=Object(s.toArray)(M,!0),M!=null&&!Array.isArray(M)&&(M=[M,M]),E(this,"scale",M)}get skew(){return this[h]("skew")}set skew(M){M=Object(s.toArray)(M,!0),M!=null&&!Array.isArray(M)&&(M=[M,M]),E(this,"skew",M)}get opacity(){return this[h]("opacity")}set opacity(M){M!=null&&(M=Number(M)),this[f]("opacity",M)}get zIndex(){return this[h]("zIndex")}set zIndex(M){M!=null&&(M=Number(M)),this[f]("zIndex",M)}get offsetPath(){return this[h]("offsetPath")}set offsetPath(M){this[f]("offsetPath",M)&&(this[x].beginPath(),M!=null&&this[x].addPath(M),R(this))}get offsetDistance(){return this[h]("offsetDistance")}set offsetDistance(M){this[f]("offsetDistance",Object(s.toNumber)(M))&&R(this)}get offsetRotate(){return this[h]("offsetRotate")}set offsetRotate(M){this[f]("offsetRotate",M),R(this)}get pointerEvents(){return this[h]("pointerEvents")}set pointerEvents(M){if(M!=null&&M!=="none"&&M!=="visible"&&M!=="visibleFill"&&M!=="visibleStroke"&&M!=="all")throw new TypeError("Invalid pointerEvents type.");this[f]("pointerEvents",M)}get filter(){return this[h]("filter")}set filter(M){this[f]("filter",M)}get display(){return this[h]("display")}set display(M){this[f]("display",M)}set offset(M){}}},function(i,e,t){t.r(e),t.d(e,"sizeToPixel",function(){return r}),t.d(e,"toString",function(){return n}),t.d(e,"toNumber",function(){return s}),t.d(e,"toArray",function(){return c}),t.d(e,"compareValue",function(){return l}),t(1).glMatrix.setMatrixArrayType(Array);function r(f,h){const v=f.trim().match(/^([\d.]+)(px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin)$/);v?f={size:parseFloat(v[1]),unit:v[2]}:f={size:parseFloat(f),unit:"px"};let{size:u,unit:y}=f;if(y==="pt")u/=.75;else if(y==="pc")u*=16;else if(y==="in")u*=96;else if(y==="cm")u*=37.79527559055118;else if(y==="mm")u*=3.7795275590551185;else if(y==="em"||y==="rem"||y==="ex"){if(!h&&typeof getComputedStyle=="function"&&typeof document<"u"){const T=getComputedStyle(document.documentElement).fontSize;T?h=r(T,16):h=16}u*=h,y==="ex"&&(u/=2)}else if(y==="q")u*=.9448818897637796;else if(y==="vw"||y==="vh"){if(typeof document<"u"){const T=y==="vw"?window.innerWidth||document.documentElement.clientWidth:window.innerHeight||document.documentElement.clientHeight;u*=T/100}}else if((y==="vmax"||y==="vmin")&&typeof document<"u"){const T=window.innerWidth||document.documentElement.clientWidth,w=window.innerHeight||document.documentElement.clientHeight;y==="vmax"?u*=Math.max(T,w)/100:u*=Math.min(T,w)/100}return u}function n(f){return f==null?f:String(f)}function s(f){if(f==null)return f;if(typeof f=="string"&&(f=r(f)),!Number.isFinite(f))throw new TypeError("Invalid value");return f}function c(f,h=!1){return f===""?null:(typeof f=="string"&&(f=f.split(/[\s,]+/g)),Array.isArray(f)&&(h&&(f=f.map(s)),f.length===1)?f[0]:f)}function l(f,h){if(Array.isArray(f)&&Array.isArray(h)){if(f.length!==h.length)return!1;for(let v=0;v<f.length;v++)if(f[v]!==h[v])return!1;return!0}return f==null&&h==null||f===h}},function(i,e,t){t.r(e),t.d(e,"default",function(){return y});var r=t(74),n=t(32),s=t.n(n),c=t(68),l=t(72);t(1).glMatrix.setMatrixArrayType(Array);function f(){return f=Object.assign||function(T){for(var w=1;w<arguments.length;w++){var I=arguments[w];for(var S in I)Object.prototype.hasOwnProperty.call(I,S)&&(T[S]=I[S])}return T},f.apply(this,arguments)}function h(T){if(typeof T=="string"){if(T=T.trim(),/^[0-9.]+%$/.test(T))return parseFloat(T)/100;if(/^([\d.]+)(px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin)$/.test(T))return Object(l.sizeToPixel)(T)}return T}function v(T,w,I,S,O){return typeof T=="string"&&(T=s()(T)),typeof w=="string"&&(w=s()(w)),r.Effects.default(T,w,I,S,O)}function u(T,w,I,S,O){return r.Effects.default(T,w,I,S,O)}r.Effects.default=function(T,w,I,S,O){return Array.isArray(T)&&Array.isArray(w)?T.map((d,g)=>d+(I-S)/(O-S)*(w[g]-d)):typeof T=="number"&&typeof w=="number"?T+(I-S)/(O-S)*(w-T):I-S>O-I?w:T},r.Effects.fillColor=v,r.Effects.strokeColor=v,r.Effects.bgcolor=v,r.Effects.borderColor=v,r.Effects.text=u;class y extends r.Animator{constructor(w,I,S){const O=w.attr();Object.entries(O).forEach(([d,g])=>{O[d]=r.Effects[d]?g:h(g)}),I=I.map(d=>{let g=f({},d);const p={};return Object.entries(g).forEach(([x,E])=>{p[x]=r.Effects[x]?E:h(E)}),p}),super(O,I,S),this.target=w,this.setter=function(d,g){g.attr(d)}}get playState(){return this.target.parent?super.playState:"idle"}get finished(){return super.finished.then(()=>{const w=this;return new Promise(I=>{function S(){w.setter(w.frame,w.target);const O=w.playState;O==="finished"||O==="idle"?(Object(c.cancelAnimationFrame)(w.requestId),I()):Object(c.requestAnimationFrame)(S)}S()})})}finish(){super.finish(),Object(c.cancelAnimationFrame)(this.requestId),this.setter(this.frame,this.target)}play(){if(!this.target.parent||this.playState==="running")return;super.play(),this.setter(this.frame,this.target);const w=this;this.ready.then(()=>{w.setter(w.frame,w.target),w.requestId=Object(c.requestAnimationFrame)(function I(){const S=w.target;if(typeof document<"u"&&document.documentElement&&document.documentElement.contains&&S.layer&&S.layer.canvas&&!document.documentElement.contains(S.layer.canvas)){w.cancel();return}const O=w.playState;w.setter(w.frame,w.target),O!=="idle"&&(O==="running"?w.requestId=Object(c.requestAnimationFrame)(I):(O==="paused"||O==="pending"&&w.timeline.currentTime<0)&&w.ready.then(()=>{w.setter(w.frame,w.target),w.requestId=Object(c.requestAnimationFrame)(I)}))})})}cancel(w=!1){Object(c.cancelAnimationFrame)(this.requestId),w?(this.setter(this.frame,this.target),super.cancel()):(super.cancel(),this.setter(this.frame,this.target))}}},function(i,e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.Timeline=e.Effects=e.Easings=e.Animator=void 0;var r=t(75),n=v(r),s=t(187),c=v(s),l=t(188),f=t(190),h=v(f);function v(u){return u&&u.__esModule?u:{default:u}}e.Animator=h.default,e.Easings=l.Easings,e.Effects=c.default,e.Timeline=n.default},function(i,e,t){Object.defineProperty(e,"__esModule",{value:!0});var r=t(76),n=d(r),s=t(133),c=d(s),l=t(141),f=d(l),h=t(164),v=d(h),u=t(170),y=d(u),T=t(171),w=d(T),I=t(175),S=d(I),O=t(186);function d(X){return X&&X.__esModule?X:{default:X}}var g=(0,O.createNowTime)(),p={originTime:0,playbackRate:1},x=(0,S.default)("timeMark"),E=(0,S.default)("playbackRate"),R=(0,S.default)("timers"),D=(0,S.default)("originTime"),U=(0,S.default)("setTimer"),M=(0,S.default)("parent"),W=function(){function X(B,N){(0,y.default)(this,X),B instanceof X&&(N=B,B={}),B=(0,v.default)({},p,B),N&&(this[M]=N);var $=B.nowtime||g;if(N)Object.defineProperty(this,"globalTime",{get:function(){return N.currentTime}});else{var J=$();Object.defineProperty(this,"globalTime",{get:function(){return $()-J}})}this[x]=[{globalTime:this.globalTime,localTime:-B.originTime,entropy:-B.originTime,playbackRate:B.playbackRate,globalEntropy:0}],this[M]&&(this[x][0].globalEntropy=this[M].entropy),this[D]=B.originTime,this[E]=B.playbackRate,this[R]=new f.default}return(0,w.default)(X,[{key:"markTime",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},$=N.time,J=$===void 0?this.currentTime:$,tt=N.entropy,at=tt===void 0?this.entropy:tt,ut=N.playbackRate,V=ut===void 0?this.playbackRate:ut,Q={globalTime:this.globalTime,localTime:J,entropy:at,playbackRate:V,globalEntropy:this.globalEntropy};this[x].push(Q)}},{key:"fork",value:function(N){return new X(N,this)}},{key:"seekGlobalTime",value:function(N){var $=this.seekTimeMark(N),J=this[x][$],tt=J.entropy,at=J.playbackRate,ut=J.globalTime;return ut+(N-tt)/Math.abs(at)}},{key:"seekLocalTime",value:function(N){var $=this.seekTimeMark(N),J=this[x][$],tt=J.localTime,at=J.entropy,ut=J.playbackRate;return ut>0?tt+(N-at):tt-(N-at)}},{key:"seekTimeMark",value:function(N){var $=this[x],J=0,tt=$.length-1;if(N<=$[J].entropy)return J;if(N>=$[tt].entropy)return tt;for(var at=Math.floor((J+tt)/2);at>J&&at<tt;){if(N===$[at].entropy)return at;N<$[at].entropy?tt=at:N>$[at].entropy&&(J=at),at=Math.floor((J+tt)/2)}return J}},{key:"updateTimers",value:function(){var N=this,$=[].concat((0,c.default)(this[R]));$.forEach(function(J){var tt=(0,n.default)(J,2),at=tt[0],ut=tt[1];N[U](ut.handler,ut.time,at)})}},{key:"clearTimeout",value:function(B){function N($){return B.apply(this,arguments)}return N.toString=function(){return B.toString()},N}(function(B){var N=this[R].get(B);N&&N.timerID!=null&&(this[M]?this[M].clearTimeout(N.timerID):clearTimeout(N.timerID)),this[R].delete(B)})},{key:"clearInterval",value:function(N){return this.clearTimeout(N)}},{key:"clear",value:function(){var N=this,$=this[R];[].concat((0,c.default)($.keys())).forEach(function(J){N.clearTimeout(J)})}},{key:"setTimeout",value:function(N){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{delay:0};return this[U](N,$)}},{key:"setInterval",value:function(N){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{delay:0},J=this,tt=this[U](function at(){J[U](at,$,tt),N()},$);return tt}},{key:U,value:function(N,$){var J=this,tt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(0,S.default)("timerID");$=(0,O.formatDelay)($);var at=this[R].get(tt),ut=void 0,V=null,Q=void 0,ft=void 0;at?(this.clearTimeout(tt),$.isEntropy?ut=($.delay-(this.entropy-at.startEntropy))/Math.abs(this.playbackRate):ut=($.delay-(this.currentTime-at.startTime))/this.playbackRate,Q=at.startTime,ft=at.startEntropy):(ut=$.delay/($.isEntropy?Math.abs(this.playbackRate):this.playbackRate),Q=this.currentTime,ft=this.entropy);var mt=this[M],yt=mt?mt.setTimeout.bind(mt):setTimeout,wt=$.heading;return!mt&&wt===!1&&ut<0&&(ut=1/0),(isFinite(ut)||mt)&&(ut=Math.ceil(ut),yt!==setTimeout&&(ut={delay:ut,heading:wt}),V=yt(function(){J[R].delete(tt),N()},ut)),this[R].set(tt,{timerID:V,handler:N,time:$,startTime:Q,startEntropy:ft}),tt}},{key:"parent",get:function(){return this[M]}},{key:"lastTimeMark",get:function(){return this[x][this[x].length-1]}},{key:"currentTime",get:function(){var N=this.lastTimeMark,$=N.localTime,J=N.globalTime;return $+(this.globalTime-J)*this.playbackRate},set:function(N){var $=this,J=this.currentTime,tt=N,at=this[R];this.markTime({time:N}),[].concat((0,c.default)(at)).forEach(function(ut){var V=(0,n.default)(ut,2),Q=V[0],ft=V[1];if(at.has(Q)){var mt=ft.time,yt=mt.isEntropy,wt=mt.delay,ht=mt.heading,Nt=ft.handler,Dt=ft.startTime;if(yt)wt===0&&(Nt(),$.clearTimeout(Q));else{var G=Dt+wt;(wt===0||ht!==!1&&(tt-J)*wt<=0||J<=G&&G<=tt||J>=G&&G>=tt)&&(Nt(),$.clearTimeout(Q))}}}),this.updateTimers()}},{key:"entropy",get:function(){var N=this.lastTimeMark,$=N.entropy,J=N.globalEntropy;return $+Math.abs((this.globalEntropy-J)*this.playbackRate)},set:function(N){if(this.entropy>N){var $=this.seekTimeMark(N);this[x].length=$+1}this.markTime({entropy:N}),this.updateTimers()}},{key:"globalEntropy",get:function(){return this[M]?this[M].entropy:this.globalTime}},{key:"playbackRate",get:function(){return this[E]},set:function(N){N!==this.playbackRate&&(this.markTime({playbackRate:N}),this[E]=N,this.updateTimers())}},{key:"paused",get:function(){if(this.playbackRate===0)return!0;for(var N=this.parent;N;){if(N.playbackRate===0)return!0;N=N.parent}return!1}}]),X}();e.default=W},function(i,e,t){e.__esModule=!0;var r=t(77),n=l(r),s=t(129),c=l(s);function l(f){return f&&f.__esModule?f:{default:f}}e.default=function(){function f(h,v){var u=[],y=!0,T=!1,w=void 0;try{for(var I=(0,c.default)(h),S;!(y=(S=I.next()).done)&&(u.push(S.value),!(v&&u.length===v));y=!0);}catch(O){T=!0,w=O}finally{try{!y&&I.return&&I.return()}finally{if(T)throw w}}return u}return function(h,v){if(Array.isArray(h))return h;if((0,n.default)(Object(h)))return f(h,v);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},function(i,e,t){i.exports={default:t(78),__esModule:!0}},function(i,e,t){t(79),t(125),i.exports=t(127)},function(i,e,t){t(80);for(var r=t(91),n=t(95),s=t(83),c=t(122)("toStringTag"),l="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),f=0;f<l.length;f++){var h=l[f],v=r[h],u=v&&v.prototype;u&&!u[c]&&n(u,c,h),s[h]=s.Array}},function(i,e,t){var r=t(81),n=t(82),s=t(83),c=t(84);i.exports=t(88)(Array,"Array",function(l,f){this._t=c(l),this._i=0,this._k=f},function(){var l=this._t,f=this._k,h=this._i++;return!l||h>=l.length?(this._t=void 0,n(1)):f=="keys"?n(0,h):f=="values"?n(0,l[h]):n(0,[h,l[h]])},"values"),s.Arguments=s.Array,r("keys"),r("values"),r("entries")},function(i,e){i.exports=function(){}},function(i,e){i.exports=function(t,r){return{value:r,done:!!t}}},function(i,e){i.exports={}},function(i,e,t){var r=t(85),n=t(87);i.exports=function(s){return r(n(s))}},function(i,e,t){var r=t(86);i.exports=Object("z").propertyIsEnumerable(0)?Object:function(n){return r(n)=="String"?n.split(""):Object(n)}},function(i,e){var t={}.toString;i.exports=function(r){return t.call(r).slice(8,-1)}},function(i,e){i.exports=function(t){if(t==null)throw TypeError("Can't call method on "+t);return t}},function(i,e,t){var r=t(89),n=t(90),s=t(106),c=t(95),l=t(83),f=t(107),h=t(121),v=t(123),u=t(122)("iterator"),y=!([].keys&&"next"in[].keys()),T="@@iterator",w="keys",I="values",S=function(){return this};i.exports=function(O,d,g,p,x,E,R){f(g,d,p);var D=function(V){if(!y&&V in X)return X[V];switch(V){case w:return function(){return new g(this,V)};case I:return function(){return new g(this,V)}}return function(){return new g(this,V)}},U=d+" Iterator",M=x==I,W=!1,X=O.prototype,B=X[u]||X[T]||x&&X[x],N=B||D(x),$=x?M?D("entries"):N:void 0,J=d=="Array"&&X.entries||B,tt,at,ut;if(J&&(ut=v(J.call(new O)),ut!==Object.prototype&&ut.next&&(h(ut,U,!0),!r&&typeof ut[u]!="function"&&c(ut,u,S))),M&&B&&B.name!==I&&(W=!0,N=function(){return B.call(this)}),(!r||R)&&(y||W||!X[u])&&c(X,u,N),l[d]=N,l[U]=S,x)if(tt={values:M?N:D(I),keys:E?N:D(w),entries:$},R)for(at in tt)at in X||s(X,at,tt[at]);else n(n.P+n.F*(y||W),d,tt);return tt}},function(i,e){i.exports=!0},function(i,e,t){var r=t(91),n=t(92),s=t(93),c=t(95),l=t(105),f="prototype",h=function(v,u,y){var T=v&h.F,w=v&h.G,I=v&h.S,S=v&h.P,O=v&h.B,d=v&h.W,g=w?n:n[u]||(n[u]={}),p=g[f],x=w?r:I?r[u]:(r[u]||{})[f],E,R,D;w&&(y=u);for(E in y)R=!T&&x&&x[E]!==void 0,!(R&&l(g,E))&&(D=R?x[E]:y[E],g[E]=w&&typeof x[E]!="function"?y[E]:O&&R?s(D,r):d&&x[E]==D?function(U){var M=function(W,X,B){if(this instanceof U){switch(arguments.length){case 0:return new U;case 1:return new U(W);case 2:return new U(W,X)}return new U(W,X,B)}return U.apply(this,arguments)};return M[f]=U[f],M}(D):S&&typeof D=="function"?s(Function.call,D):D,S&&((g.virtual||(g.virtual={}))[E]=D,v&h.R&&p&&!p[E]&&c(p,E,D)))};h.F=1,h.G=2,h.S=4,h.P=8,h.B=16,h.W=32,h.U=64,h.R=128,i.exports=h},function(i,e){var t=i.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=t)},function(i,e){var t=i.exports={version:"2.6.11"};typeof __e=="number"&&(__e=t)},function(i,e,t){var r=t(94);i.exports=function(n,s,c){if(r(n),s===void 0)return n;switch(c){case 1:return function(l){return n.call(s,l)};case 2:return function(l,f){return n.call(s,l,f)};case 3:return function(l,f,h){return n.call(s,l,f,h)}}return function(){return n.apply(s,arguments)}}},function(i,e){i.exports=function(t){if(typeof t!="function")throw TypeError(t+" is not a function!");return t}},function(i,e,t){var r=t(96),n=t(104);i.exports=t(100)?function(s,c,l){return r.f(s,c,n(1,l))}:function(s,c,l){return s[c]=l,s}},function(i,e,t){var r=t(97),n=t(99),s=t(103),c=Object.defineProperty;e.f=t(100)?Object.defineProperty:function(f,h,v){if(r(f),h=s(h,!0),r(v),n)try{return c(f,h,v)}catch{}if("get"in v||"set"in v)throw TypeError("Accessors not supported!");return"value"in v&&(f[h]=v.value),f}},function(i,e,t){var r=t(98);i.exports=function(n){if(!r(n))throw TypeError(n+" is not an object!");return n}},function(i,e){i.exports=function(t){return typeof t=="object"?t!==null:typeof t=="function"}},function(i,e,t){i.exports=!t(100)&&!t(101)(function(){return Object.defineProperty(t(102)("div"),"a",{get:function(){return 7}}).a!=7})},function(i,e,t){i.exports=!t(101)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},function(i,e){i.exports=function(t){try{return!!t()}catch{return!0}}},function(i,e,t){var r=t(98),n=t(91).document,s=r(n)&&r(n.createElement);i.exports=function(c){return s?n.createElement(c):{}}},function(i,e,t){var r=t(98);i.exports=function(n,s){if(!r(n))return n;var c,l;if(s&&typeof(c=n.toString)=="function"&&!r(l=c.call(n))||typeof(c=n.valueOf)=="function"&&!r(l=c.call(n))||!s&&typeof(c=n.toString)=="function"&&!r(l=c.call(n)))return l;throw TypeError("Can't convert object to primitive value")}},function(i,e){i.exports=function(t,r){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:r}}},function(i,e){var t={}.hasOwnProperty;i.exports=function(r,n){return t.call(r,n)}},function(i,e,t){i.exports=t(95)},function(i,e,t){var r=t(108),n=t(104),s=t(121),c={};t(95)(c,t(122)("iterator"),function(){return this}),i.exports=function(l,f,h){l.prototype=r(c,{next:n(1,h)}),s(l,f+" Iterator")}},function(i,e,t){var r=t(97),n=t(109),s=t(119),c=t(116)("IE_PROTO"),l=function(){},f="prototype",h=function(){var v=t(102)("iframe"),u=s.length,y="<",T=">",w;for(v.style.display="none",t(120).appendChild(v),v.src="javascript:",w=v.contentWindow.document,w.open(),w.write(y+"script"+T+"document.F=Object"+y+"/script"+T),w.close(),h=w.F;u--;)delete h[f][s[u]];return h()};i.exports=Object.create||function(u,y){var T;return u!==null?(l[f]=r(u),T=new l,l[f]=null,T[c]=u):T=h(),y===void 0?T:n(T,y)}},function(i,e,t){var r=t(96),n=t(97),s=t(110);i.exports=t(100)?Object.defineProperties:function(l,f){n(l);for(var h=s(f),v=h.length,u=0,y;v>u;)r.f(l,y=h[u++],f[y]);return l}},function(i,e,t){var r=t(111),n=t(119);i.exports=Object.keys||function(c){return r(c,n)}},function(i,e,t){var r=t(105),n=t(84),s=t(112)(!1),c=t(116)("IE_PROTO");i.exports=function(l,f){var h=n(l),v=0,u=[],y;for(y in h)y!=c&&r(h,y)&&u.push(y);for(;f.length>v;)r(h,y=f[v++])&&(~s(u,y)||u.push(y));return u}},function(i,e,t){var r=t(84),n=t(113),s=t(115);i.exports=function(c){return function(l,f,h){var v=r(l),u=n(v.length),y=s(h,u),T;if(c&&f!=f){for(;u>y;)if(T=v[y++],T!=T)return!0}else for(;u>y;y++)if((c||y in v)&&v[y]===f)return c||y||0;return!c&&-1}}},function(i,e,t){var r=t(114),n=Math.min;i.exports=function(s){return s>0?n(r(s),9007199254740991):0}},function(i,e){var t=Math.ceil,r=Math.floor;i.exports=function(n){return isNaN(n=+n)?0:(n>0?r:t)(n)}},function(i,e,t){var r=t(114),n=Math.max,s=Math.min;i.exports=function(c,l){return c=r(c),c<0?n(c+l,0):s(c,l)}},function(i,e,t){var r=t(117)("keys"),n=t(118);i.exports=function(s){return r[s]||(r[s]=n(s))}},function(i,e,t){var r=t(92),n=t(91),s="__core-js_shared__",c=n[s]||(n[s]={});(i.exports=function(l,f){return c[l]||(c[l]=f!==void 0?f:{})})("versions",[]).push({version:r.version,mode:t(89)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(i,e){var t=0,r=Math.random();i.exports=function(n){return"Symbol(".concat(n===void 0?"":n,")_",(++t+r).toString(36))}},function(i,e){i.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(i,e,t){var r=t(91).document;i.exports=r&&r.documentElement},function(i,e,t){var r=t(96).f,n=t(105),s=t(122)("toStringTag");i.exports=function(c,l,f){c&&!n(c=f?c:c.prototype,s)&&r(c,s,{configurable:!0,value:l})}},function(i,e,t){var r=t(117)("wks"),n=t(118),s=t(91).Symbol,c=typeof s=="function",l=i.exports=function(f){return r[f]||(r[f]=c&&s[f]||(c?s:n)("Symbol."+f))};l.store=r},function(i,e,t){var r=t(105),n=t(124),s=t(116)("IE_PROTO"),c=Object.prototype;i.exports=Object.getPrototypeOf||function(l){return l=n(l),r(l,s)?l[s]:typeof l.constructor=="function"&&l instanceof l.constructor?l.constructor.prototype:l instanceof Object?c:null}},function(i,e,t){var r=t(87);i.exports=function(n){return Object(r(n))}},function(i,e,t){var r=t(126)(!0);t(88)(String,"String",function(n){this._t=String(n),this._i=0},function(){var n=this._t,s=this._i,c;return s>=n.length?{value:void 0,done:!0}:(c=r(n,s),this._i+=c.length,{value:c,done:!1})})},function(i,e,t){var r=t(114),n=t(87);i.exports=function(s){return function(c,l){var f=String(n(c)),h=r(l),v=f.length,u,y;return h<0||h>=v?s?"":void 0:(u=f.charCodeAt(h),u<55296||u>56319||h+1===v||(y=f.charCodeAt(h+1))<56320||y>57343?s?f.charAt(h):u:s?f.slice(h,h+2):(u-55296<<10)+(y-56320)+65536)}}},function(i,e,t){var r=t(128),n=t(122)("iterator"),s=t(83);i.exports=t(92).isIterable=function(c){var l=Object(c);return l[n]!==void 0||"@@iterator"in l||s.hasOwnProperty(r(l))}},function(i,e,t){var r=t(86),n=t(122)("toStringTag"),s=r(function(){return arguments}())=="Arguments",c=function(l,f){try{return l[f]}catch{}};i.exports=function(l){var f,h,v;return l===void 0?"Undefined":l===null?"Null":typeof(h=c(f=Object(l),n))=="string"?h:s?r(f):(v=r(f))=="Object"&&typeof f.callee=="function"?"Arguments":v}},function(i,e,t){i.exports={default:t(130),__esModule:!0}},function(i,e,t){t(79),t(125),i.exports=t(131)},function(i,e,t){var r=t(97),n=t(132);i.exports=t(92).getIterator=function(s){var c=n(s);if(typeof c!="function")throw TypeError(s+" is not iterable!");return r(c.call(s))}},function(i,e,t){var r=t(128),n=t(122)("iterator"),s=t(83);i.exports=t(92).getIteratorMethod=function(c){if(c!=null)return c[n]||c["@@iterator"]||s[r(c)]}},function(i,e,t){e.__esModule=!0;var r=t(134),n=s(r);function s(c){return c&&c.__esModule?c:{default:c}}e.default=function(c){if(Array.isArray(c)){for(var l=0,f=Array(c.length);l<c.length;l++)f[l]=c[l];return f}else return(0,n.default)(c)}},function(i,e,t){i.exports={default:t(135),__esModule:!0}},function(i,e,t){t(125),t(136),i.exports=t(92).Array.from},function(i,e,t){var r=t(93),n=t(90),s=t(124),c=t(137),l=t(138),f=t(113),h=t(139),v=t(132);n(n.S+n.F*!t(140)(function(u){Array.from(u)}),"Array",{from:function(y){var T=s(y),w=typeof this=="function"?this:Array,I=arguments.length,S=I>1?arguments[1]:void 0,O=S!==void 0,d=0,g=v(T),p,x,E,R;if(O&&(S=r(S,I>2?arguments[2]:void 0,2)),g!=null&&!(w==Array&&l(g)))for(R=g.call(T),x=new w;!(E=R.next()).done;d++)h(x,d,O?c(R,S,[E.value,d],!0):E.value);else for(p=f(T.length),x=new w(p);p>d;d++)h(x,d,O?S(T[d],d):T[d]);return x.length=d,x}})},function(i,e,t){var r=t(97);i.exports=function(n,s,c,l){try{return l?s(r(c)[0],c[1]):s(c)}catch(h){var f=n.return;throw f!==void 0&&r(f.call(n)),h}}},function(i,e,t){var r=t(83),n=t(122)("iterator"),s=Array.prototype;i.exports=function(c){return c!==void 0&&(r.Array===c||s[n]===c)}},function(i,e,t){var r=t(96),n=t(104);i.exports=function(s,c,l){c in s?r.f(s,c,n(0,l)):s[c]=l}},function(i,e,t){var r=t(122)("iterator"),n=!1;try{var s=[7][r]();s.return=function(){n=!0},Array.from(s,function(){throw 2})}catch{}i.exports=function(c,l){if(!l&&!n)return!1;var f=!1;try{var h=[7],v=h[r]();v.next=function(){return{done:f=!0}},h[r]=function(){return v},c(h)}catch{}return f}},function(i,e,t){i.exports={default:t(142),__esModule:!0}},function(i,e,t){t(143),t(125),t(79),t(144),t(157),t(160),t(162),i.exports=t(92).Map},function(i,e){},function(i,e,t){var r=t(145),n=t(151),s="Map";i.exports=t(152)(s,function(c){return function(){return c(this,arguments.length>0?arguments[0]:void 0)}},{get:function(l){var f=r.getEntry(n(this,s),l);return f&&f.v},set:function(l,f){return r.def(n(this,s),l===0?0:l,f)}},r,!0)},function(i,e,t){var r=t(96).f,n=t(108),s=t(146),c=t(93),l=t(147),f=t(148),h=t(88),v=t(82),u=t(149),y=t(100),T=t(150).fastKey,w=t(151),I=y?"_s":"size",S=function(O,d){var g=T(d),p;if(g!=="F")return O._i[g];for(p=O._f;p;p=p.n)if(p.k==d)return p};i.exports={getConstructor:function(O,d,g,p){var x=O(function(E,R){l(E,x,d,"_i"),E._t=d,E._i=n(null),E._f=void 0,E._l=void 0,E[I]=0,R!=null&&f(R,g,E[p],E)});return s(x.prototype,{clear:function(){for(var R=w(this,d),D=R._i,U=R._f;U;U=U.n)U.r=!0,U.p&&(U.p=U.p.n=void 0),delete D[U.i];R._f=R._l=void 0,R[I]=0},delete:function(E){var R=w(this,d),D=S(R,E);if(D){var U=D.n,M=D.p;delete R._i[D.i],D.r=!0,M&&(M.n=U),U&&(U.p=M),R._f==D&&(R._f=U),R._l==D&&(R._l=M),R[I]--}return!!D},forEach:function(R){w(this,d);for(var D=c(R,arguments.length>1?arguments[1]:void 0,3),U;U=U?U.n:this._f;)for(D(U.v,U.k,this);U&&U.r;)U=U.p},has:function(R){return!!S(w(this,d),R)}}),y&&r(x.prototype,"size",{get:function(){return w(this,d)[I]}}),x},def:function(O,d,g){var p=S(O,d),x,E;return p?p.v=g:(O._l=p={i:E=T(d,!0),k:d,v:g,p:x=O._l,n:void 0,r:!1},O._f||(O._f=p),x&&(x.n=p),O[I]++,E!=="F"&&(O._i[E]=p)),O},getEntry:S,setStrong:function(O,d,g){h(O,d,function(p,x){this._t=w(p,d),this._k=x,this._l=void 0},function(){for(var p=this,x=p._k,E=p._l;E&&E.r;)E=E.p;return!p._t||!(p._l=E=E?E.n:p._t._f)?(p._t=void 0,v(1)):x=="keys"?v(0,E.k):x=="values"?v(0,E.v):v(0,[E.k,E.v])},g?"entries":"values",!g,!0),u(d)}}},function(i,e,t){var r=t(95);i.exports=function(n,s,c){for(var l in s)c&&n[l]?n[l]=s[l]:r(n,l,s[l]);return n}},function(i,e){i.exports=function(t,r,n,s){if(!(t instanceof r)||s!==void 0&&s in t)throw TypeError(n+": incorrect invocation!");return t}},function(i,u,t){var r=t(93),n=t(137),s=t(138),c=t(97),l=t(113),f=t(132),h={},v={},u=i.exports=function(y,T,w,I,S){var O=S?function(){return y}:f(y),d=r(w,I,T?2:1),g=0,p,x,E,R;if(typeof O!="function")throw TypeError(y+" is not iterable!");if(s(O)){for(p=l(y.length);p>g;g++)if(R=T?d(c(x=y[g])[0],x[1]):d(y[g]),R===h||R===v)return R}else for(E=O.call(y);!(x=E.next()).done;)if(R=n(E,d,x.value,T),R===h||R===v)return R};u.BREAK=h,u.RETURN=v},function(i,e,t){var r=t(91),n=t(92),s=t(96),c=t(100),l=t(122)("species");i.exports=function(f){var h=typeof n[f]=="function"?n[f]:r[f];c&&h&&!h[l]&&s.f(h,l,{configurable:!0,get:function(){return this}})}},function(i,e,t){var r=t(118)("meta"),n=t(98),s=t(105),c=t(96).f,l=0,f=Object.isExtensible||function(){return!0},h=!t(101)(function(){return f(Object.preventExtensions({}))}),v=function(I){c(I,r,{value:{i:"O"+ ++l,w:{}}})},u=function(I,S){if(!n(I))return typeof I=="symbol"?I:(typeof I=="string"?"S":"P")+I;if(!s(I,r)){if(!f(I))return"F";if(!S)return"E";v(I)}return I[r].i},y=function(I,S){if(!s(I,r)){if(!f(I))return!0;if(!S)return!1;v(I)}return I[r].w},T=function(I){return h&&w.NEED&&f(I)&&!s(I,r)&&v(I),I},w=i.exports={KEY:r,NEED:!1,fastKey:u,getWeak:y,onFreeze:T}},function(i,e,t){var r=t(98);i.exports=function(n,s){if(!r(n)||n._t!==s)throw TypeError("Incompatible receiver, "+s+" required!");return n}},function(i,e,t){var r=t(91),n=t(90),s=t(150),c=t(101),l=t(95),f=t(146),h=t(148),v=t(147),u=t(98),y=t(121),T=t(96).f,w=t(153)(0),I=t(100);i.exports=function(S,O,d,g,p,x){var E=r[S],R=E,D=p?"set":"add",U=R&&R.prototype,M={};return!I||typeof R!="function"||!(x||U.forEach&&!c(function(){new R().entries().next()}))?(R=g.getConstructor(O,S,p,D),f(R.prototype,d),s.NEED=!0):(R=O(function(W,X){v(W,R,S,"_c"),W._c=new E,X!=null&&h(X,p,W[D],W)}),w("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(W){var X=W=="add"||W=="set";W in U&&!(x&&W=="clear")&&l(R.prototype,W,function(B,N){if(v(this,R,W),!X&&x&&!u(B))return W=="get"?void 0:!1;var $=this._c[W](B===0?0:B,N);return X?this:$})}),x||T(R.prototype,"size",{get:function(){return this._c.size}})),y(R,S),M[S]=R,n(n.G+n.W+n.F,M),x||g.setStrong(R,S,p),R}},function(i,e,t){var r=t(93),n=t(85),s=t(124),c=t(113),l=t(154);i.exports=function(f,h){var v=f==1,u=f==2,y=f==3,T=f==4,w=f==6,I=f==5||w,S=h||l;return function(O,d,g){for(var p=s(O),x=n(p),E=r(d,g,3),R=c(x.length),D=0,U=v?S(O,R):u?S(O,0):void 0,M,W;R>D;D++)if((I||D in x)&&(M=x[D],W=E(M,D,p),f)){if(v)U[D]=W;else if(W)switch(f){case 3:return!0;case 5:return M;case 6:return D;case 2:U.push(M)}else if(T)return!1}return w?-1:y||T?T:U}}},function(i,e,t){var r=t(155);i.exports=function(n,s){return new(r(n))(s)}},function(i,e,t){var r=t(98),n=t(156),s=t(122)("species");i.exports=function(c){var l;return n(c)&&(l=c.constructor,typeof l=="function"&&(l===Array||n(l.prototype))&&(l=void 0),r(l)&&(l=l[s],l===null&&(l=void 0))),l===void 0?Array:l}},function(i,e,t){var r=t(86);i.exports=Array.isArray||function(s){return r(s)=="Array"}},function(i,e,t){var r=t(90);r(r.P+r.R,"Map",{toJSON:t(158)("Map")})},function(i,e,t){var r=t(128),n=t(159);i.exports=function(s){return function(){if(r(this)!=s)throw TypeError(s+"#toJSON isn't generic");return n(this)}}},function(i,e,t){var r=t(148);i.exports=function(n,s){var c=[];return r(n,!1,c.push,c,s),c}},function(i,e,t){t(161)("Map")},function(i,e,t){var r=t(90);i.exports=function(n){r(r.S,n,{of:function(){for(var c=arguments.length,l=new Array(c);c--;)l[c]=arguments[c];return new this(l)}})}},function(i,e,t){t(163)("Map")},function(i,e,t){var r=t(90),n=t(94),s=t(93),c=t(148);i.exports=function(l){r(r.S,l,{from:function(h){var v=arguments[1],u,y,T,w;return n(this),u=v!==void 0,u&&n(v),h==null?new this:(y=[],u?(T=0,w=s(v,arguments[2],2),c(h,!1,function(I){y.push(w(I,T++))})):c(h,!1,y.push,y),new this(y))}})}},function(i,e,t){i.exports={default:t(165),__esModule:!0}},function(i,e,t){t(166),i.exports=t(92).Object.assign},function(i,e,t){var r=t(90);r(r.S+r.F,"Object",{assign:t(167)})},function(i,e,t){var r=t(100),n=t(110),s=t(168),c=t(169),l=t(124),f=t(85),h=Object.assign;i.exports=!h||t(101)(function(){var v={},u={},y=Symbol(),T="abcdefghijklmnopqrst";return v[y]=7,T.split("").forEach(function(w){u[w]=w}),h({},v)[y]!=7||Object.keys(h({},u)).join("")!=T})?function(u,y){for(var T=l(u),w=arguments.length,I=1,S=s.f,O=c.f;w>I;)for(var d=f(arguments[I++]),g=S?n(d).concat(S(d)):n(d),p=g.length,x=0,E;p>x;)E=g[x++],(!r||O.call(d,E))&&(T[E]=d[E]);return T}:h},function(i,e){e.f=Object.getOwnPropertySymbols},function(i,e){e.f={}.propertyIsEnumerable},function(i,e,t){e.__esModule=!0,e.default=function(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}},function(i,e,t){e.__esModule=!0;var r=t(172),n=s(r);function s(c){return c&&c.__esModule?c:{default:c}}e.default=function(){function c(l,f){for(var h=0;h<f.length;h++){var v=f[h];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),(0,n.default)(l,v.key,v)}}return function(l,f,h){return f&&c(l.prototype,f),h&&c(l,h),l}}()},function(i,e,t){i.exports={default:t(173),__esModule:!0}},function(i,e,t){t(174);var r=t(92).Object;i.exports=function(s,c,l){return r.defineProperty(s,c,l)}},function(i,e,t){var r=t(90);r(r.S+r.F*!t(100),"Object",{defineProperty:t(96).f})},function(i,e,t){i.exports={default:t(176),__esModule:!0}},function(i,e,t){t(177),t(143),t(184),t(185),i.exports=t(92).Symbol},function(i,e,t){var r=t(91),n=t(105),s=t(100),c=t(90),l=t(106),f=t(150).KEY,h=t(101),v=t(117),u=t(121),y=t(118),T=t(122),w=t(178),I=t(179),S=t(180),O=t(156),d=t(97),g=t(98),p=t(124),x=t(84),E=t(103),R=t(104),D=t(108),U=t(181),M=t(183),W=t(168),X=t(96),B=t(110),N=M.f,$=X.f,J=U.f,tt=r.Symbol,at=r.JSON,ut=at&&at.stringify,V="prototype",Q=T("_hidden"),ft=T("toPrimitive"),mt={}.propertyIsEnumerable,yt=v("symbol-registry"),wt=v("symbols"),ht=v("op-symbols"),Nt=Object[V],Dt=typeof tt=="function"&&!!W.f,G=r.QObject,k=!G||!G[V]||!G[V].findChild,rt=s&&h(function(){return D($({},"a",{get:function(){return $(this,"a",{value:7}).a}})).a!=7})?function(At,Ot,Lt){var Xt=N(Nt,Ot);Xt&&delete Nt[Ot],$(At,Ot,Lt),Xt&&At!==Nt&&$(Nt,Ot,Xt)}:$,nt=function(At){var Ot=wt[At]=D(tt[V]);return Ot._k=At,Ot},Y=Dt&&typeof tt.iterator=="symbol"?function(At){return typeof At=="symbol"}:function(At){return At instanceof tt},Z=function(Ot,Lt,Xt){return Ot===Nt&&Z(ht,Lt,Xt),d(Ot),Lt=E(Lt,!0),d(Xt),n(wt,Lt)?(Xt.enumerable?(n(Ot,Q)&&Ot[Q][Lt]&&(Ot[Q][Lt]=!1),Xt=D(Xt,{enumerable:R(0,!1)})):(n(Ot,Q)||$(Ot,Q,R(1,{})),Ot[Q][Lt]=!0),rt(Ot,Lt,Xt)):$(Ot,Lt,Xt)},C=function(Ot,Lt){d(Ot);for(var Xt=S(Lt=x(Lt)),$t=0,Wt=Xt.length,Qt;Wt>$t;)Z(Ot,Qt=Xt[$t++],Lt[Qt]);return Ot},L=function(Ot,Lt){return Lt===void 0?D(Ot):C(D(Ot),Lt)},z=function(Ot){var Lt=mt.call(this,Ot=E(Ot,!0));return this===Nt&&n(wt,Ot)&&!n(ht,Ot)?!1:Lt||!n(this,Ot)||!n(wt,Ot)||n(this,Q)&&this[Q][Ot]?Lt:!0},K=function(Ot,Lt){if(Ot=x(Ot),Lt=E(Lt,!0),!(Ot===Nt&&n(wt,Lt)&&!n(ht,Lt))){var Xt=N(Ot,Lt);return Xt&&n(wt,Lt)&&!(n(Ot,Q)&&Ot[Q][Lt])&&(Xt.enumerable=!0),Xt}},q=function(Ot){for(var Lt=J(x(Ot)),Xt=[],$t=0,Wt;Lt.length>$t;)!n(wt,Wt=Lt[$t++])&&Wt!=Q&&Wt!=f&&Xt.push(Wt);return Xt},it=function(Ot){for(var Lt=Ot===Nt,Xt=J(Lt?ht:x(Ot)),$t=[],Wt=0,Qt;Xt.length>Wt;)n(wt,Qt=Xt[Wt++])&&(!Lt||n(Nt,Qt))&&$t.push(wt[Qt]);return $t};Dt||(tt=function(){if(this instanceof tt)throw TypeError("Symbol is not a constructor!");var Ot=y(arguments.length>0?arguments[0]:void 0),Lt=function(Xt){this===Nt&&Lt.call(ht,Xt),n(this,Q)&&n(this[Q],Ot)&&(this[Q][Ot]=!1),rt(this,Ot,R(1,Xt))};return s&&k&&rt(Nt,Ot,{configurable:!0,set:Lt}),nt(Ot)},l(tt[V],"toString",function(){return this._k}),M.f=K,X.f=Z,t(182).f=U.f=q,t(169).f=z,W.f=it,s&&!t(89)&&l(Nt,"propertyIsEnumerable",z,!0),w.f=function(At){return nt(T(At))}),c(c.G+c.W+c.F*!Dt,{Symbol:tt});for(var ct="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),Tt=0;ct.length>Tt;)T(ct[Tt++]);for(var Ct=B(T.store),Mt=0;Ct.length>Mt;)I(Ct[Mt++]);c(c.S+c.F*!Dt,"Symbol",{for:function(At){return n(yt,At+="")?yt[At]:yt[At]=tt(At)},keyFor:function(Ot){if(!Y(Ot))throw TypeError(Ot+" is not a symbol!");for(var Lt in yt)if(yt[Lt]===Ot)return Lt},useSetter:function(){k=!0},useSimple:function(){k=!1}}),c(c.S+c.F*!Dt,"Object",{create:L,defineProperty:Z,defineProperties:C,getOwnPropertyDescriptor:K,getOwnPropertyNames:q,getOwnPropertySymbols:it});var bt=h(function(){W.f(1)});c(c.S+c.F*bt,"Object",{getOwnPropertySymbols:function(Ot){return W.f(p(Ot))}}),at&&c(c.S+c.F*(!Dt||h(function(){var At=tt();return ut([At])!="[null]"||ut({a:At})!="{}"||ut(Object(At))!="{}"})),"JSON",{stringify:function(Ot){for(var Lt=[Ot],Xt=1,$t,Wt;arguments.length>Xt;)Lt.push(arguments[Xt++]);if(Wt=$t=Lt[1],!(!g($t)&&Ot===void 0||Y(Ot)))return O($t)||($t=function(Qt,ue){if(typeof Wt=="function"&&(ue=Wt.call(this,Qt,ue)),!Y(ue))return ue}),Lt[1]=$t,ut.apply(at,Lt)}}),tt[V][ft]||t(95)(tt[V],ft,tt[V].valueOf),u(tt,"Symbol"),u(Math,"Math",!0),u(r.JSON,"JSON",!0)},function(i,e,t){e.f=t(122)},function(i,e,t){var r=t(91),n=t(92),s=t(89),c=t(178),l=t(96).f;i.exports=function(f){var h=n.Symbol||(n.Symbol=s?{}:r.Symbol||{});f.charAt(0)!="_"&&!(f in h)&&l(h,f,{value:c.f(f)})}},function(i,e,t){var r=t(110),n=t(168),s=t(169);i.exports=function(c){var l=r(c),f=n.f;if(f)for(var h=f(c),v=s.f,u=0,y;h.length>u;)v.call(c,y=h[u++])&&l.push(y);return l}},function(i,e,t){var r=t(84),n=t(182).f,s={}.toString,c=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],l=function(f){try{return n(f)}catch{return c.slice()}};i.exports.f=function(h){return c&&s.call(h)=="[object Window]"?l(h):n(r(h))}},function(i,e,t){var r=t(111),n=t(119).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(c){return r(c,n)}},function(i,e,t){var r=t(169),n=t(104),s=t(84),c=t(103),l=t(105),f=t(99),h=Object.getOwnPropertyDescriptor;e.f=t(100)?h:function(u,y){if(u=s(u),y=c(y,!0),f)try{return h(u,y)}catch{}if(l(u,y))return n(!r.f.call(u,y),u[y])}},function(i,e,t){t(179)("asyncIterator")},function(i,e,t){t(179)("observable")},function(i,e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.createNowTime=r,e.formatDelay=n;function r(){var s=null;return Date.now?s=Date.now:s=function(){return new Date().getTime()},s}function n(s){return typeof s=="number"?s={delay:s}:"entropy"in s&&(s={delay:s.entropy,isEntropy:!0}),s}},function(i,e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.default={default:function(n,s,c,l,f){return typeof n=="number"&&typeof s=="number"?n+(c-l)/(f-l)*(s-n):c-l>f-c?s:n}}},function(i,e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.parseEasing=e.Easings=void 0;var r=t(76),n=h(r),s=t(133),c=h(s),l=t(141),f=h(l);function h(O){return O&&O.__esModule?O:{default:O}}var v=t(189),u=new f.default;function y(){for(var O=arguments.length,d=Array(O),g=0;g<O;g++)d[g]=arguments[g];var p=u.get(d);return p||(p=v.apply(void 0,d),u.set(d,p),p)}function T(O){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"end";return function(g,p){for(var x=1;x<p.length;x++){var E=p[x].offset;if(g<=E){var R=p[x-1].offset,D=E,U=(g-R)/(D-R),M=1/O,W=U/M;return d==="end"?W=Math.floor(W):W=Math.ceil(W),M*W*(D-R)+R}}return 0}}function w(O){var d=/^cubic-bezier\((.*)\)/,g=O.match(d);if(g){var p=g[1].trim();return p=p.split(",").map(function(M){return parseFloat(M.trim())}),y.apply(void 0,(0,c.default)(p))}if(d=/^steps\((.*)\)/,g=O.match(d),g){var x=g[1].trim();x=x.split(",").map(function(M){return M.trim()});var E=x,R=(0,n.default)(E,2),D=R[0],U=R[1];return T(parseInt(D,10),U)}return O}var I={linear:function(d){return d},ease:y(.25,.1,.25,1),"ease-in":y(.42,0,1,1),"ease-out":y(0,0,.58,1),"ease-in-out":y(.42,0,.58,1),"step-start":T(1,"start"),"step-end":T(1,"end")};function S(O){return typeof O=="string"?I[O]?O=I[O]:O=w(O):O.type==="cubic-bezier"?O=y.apply(void 0,(0,c.default)(O.value)):O.type==="steps"&&(O=T(O.step,O.pos)),O}e.Easings=I,e.parseEasing=S},function(i,e){var t=4,r=.001,n=1e-7,s=10,c=11,l=1/(c-1),f=typeof Float32Array=="function";function h(O,d){return 1-3*d+3*O}function v(O,d){return 3*d-6*O}function u(O){return 3*O}function y(O,d,g){return((h(d,g)*O+v(d,g))*O+u(d))*O}function T(O,d,g){return 3*h(d,g)*O*O+2*v(d,g)*O+u(d)}function w(O,d,g,p,x){var E,R,D=0;do R=d+(g-d)/2,E=y(R,p,x)-O,E>0?g=R:d=R;while(Math.abs(E)>n&&++D<s);return R}function I(O,d,g,p){for(var x=0;x<t;++x){var E=T(d,g,p);if(E===0)return d;var R=y(d,g,p)-O;d-=R/E}return d}function S(O){return O}i.exports=function(d,g,p,x){if(!(0<=d&&d<=1&&0<=p&&p<=1))throw new Error("bezier x values must be in [0, 1] range");if(d===g&&p===x)return S;for(var E=f?new Float32Array(c):new Array(c),R=0;R<c;++R)E[R]=y(R*l,d,p);function D(U){for(var M=0,W=1,X=c-1;W!==X&&E[W]<=U;++W)M+=l;--W;var B=(U-E[W])/(E[W+1]-E[W]),N=M+B*l,$=T(N,d,p);return $>=r?I(U,N,d,p):$===0?N:w(U,M,M+l,d,p)}return function(M){return M===0?0:M===1?1:y(D(M),g,x)}}},function(i,e,t){Object.defineProperty(e,"__esModule",{value:!0});var r=t(191),n=g(r),s=t(204),c=g(s),l=t(164),f=g(l),h=t(170),v=g(h),u=t(171),y=g(u),T=t(175),w=g(T),I=t(75),S=g(I),O=t(208),d=t(188);function g($){return $&&$.__esModule?$:{default:$}}var p=(0,w.default)("timing"),x=(0,w.default)("keyframes"),E=(0,w.default)("initState"),R=(0,w.default)("readyDefer"),D=(0,w.default)("finishedDefer"),U=(0,w.default)("effects"),M=(0,w.default)("activeReadyTimer"),W=(0,w.default)("activeFinishTimer"),X=(0,w.default)("removeDefer"),B={delay:0,endDelay:0,fill:"auto",iterations:1,playbackRate:1,direction:"normal",easing:"linear",effect:null},N=function(){function $(J,tt,at){var ut=this;if((0,v.default)(this,$),Array.isArray(J)){var V=[J[0],J,tt];J=V[0],tt=V[1],at=V[2]}typeof at=="number"&&(at={duration:at}),this[p]=(0,f.default)({},B,at),this[p].easing=(0,d.parseEasing)(this[p].easing),this[x]=(0,O.calculateFramesOffset)(tt);var Q=this[x][this[x].length-1];this[E]={},(0,c.default)(Q).forEach(function(ft){Object.prototype.hasOwnProperty.call(J,ft)&&ft!=="easing"&&ft!=="offset"&&(ut[E][ft]=J[ft])}),this[x]=this[x].map(function(ft){return(0,f.default)({},ut[E],ft)}),this[x][0].offset!==0&&this[x].unshift((0,f.default)({},this[E],{offset:0})),Q.offset<1&&this[x].push((0,f.default)({},Q,{offset:1})),this[U]={},this.timeline=null}return(0,y.default)($,[{key:"pause",value:function(){this.timeline.playbackRate=0}},{key:M,value:function(){var tt=this;this[R]&&!this[R].timerID&&(this.timeline.currentTime<0?this[R].timerID=this.timeline.setTimeout(function(){tt[R].resolve(),delete tt[R]},{delay:-this.timeline.currentTime,heading:!1}):this[R].timerID=this.timeline.setTimeout(function(){tt[R].resolve(),delete tt[R]},{delay:0,isEntropy:!0}))}},{key:W,value:function(){var tt=this,at=this[p],ut=at.duration,V=at.iterations,Q=at.endDelay,ft=Math.ceil(ut*V+Q-this.timeline.currentTime)+1;this[D]&&!this[D].timerID&&(this[D].timerID=this.timeline.setTimeout(function(){tt[D].resolve(),tt[X](R),tt[X](D)},{delay:ft,heading:!1}),this[D].reverseTimerID=this.timeline.setTimeout(function(){tt[D].resolve(),tt[X](R),tt[X](D),tt.timeline=null},{delay:-this[p].delay-1,heading:!1}))}},{key:"play",value:function(){if(this.playState==="finished"&&this.cancel(),this.playState==="idle"){if(this.playbackRate<=0)return;var tt=this[p],at=tt.delay,ut=tt.playbackRate,V=tt.timeline;this.timeline=new S.default({originTime:at,playbackRate:ut},V),this[M](),this[W]()}else this.playState==="paused"&&(this.timeline.playbackRate=this.playbackRate,this[M]())}},{key:X,value:function(tt){var at=this[tt],ut=this.timeline;at&&ut&&(ut.clearTimeout(at.timerID),at.reverseTimerID&&ut.clearTimeout(at.reverseTimerID)),delete this[tt]}},{key:"cancel",value:function(){this[X](R),this[X](D),this.timeline=null}},{key:"finish",value:function(){this.timeline&&(this.timeline.currentTime=1/0/this.playbackRate),this[X](R),this[X](D)}},{key:"applyEffects",value:function(tt){return(0,f.default)(this[U],tt)}},{key:"playbackRate",get:function(){return this[p].playbackRate},set:function(tt){this.timeline&&(this.timeline.playbackRate=tt),this[p].playbackRate=tt}},{key:"playState",get:function(){var tt=this.timeline,at=this[p],ut=at.iterations,V=at.duration,Q=at.endDelay,ft="running";if(tt==null)ft="idle";else if(tt.paused)ft="paused";else if(tt.currentTime<0)ft="pending";else{var mt=tt.currentTime-ut*V;mt>0&&mt<Q?ft="pending":mt>=Q&&(ft="finished")}return ft}},{key:"progress",get:function(){if(!this.timeline)return 0;var tt=this[p],at=tt.duration,ut=tt.iterations,V=this.timeline,Q=this.playState,ft=void 0;if(Q==="idle")ft=0;else if(Q==="paused"&&V.currentTime<0)ft=0;else if(Q==="pending")if(V.currentTime<0)ft=0;else{var mt=V.seekLocalTime(ut*at);ft=(0,O.periodicity)(mt,at)[1]/at}else(Q==="running"||Q==="paused")&&(ft=(0,O.periodicity)(V.currentTime,at)[1]/at);return Q==="finished"&&(ft=(0,O.periodicity)(ut,1)[1]),ft}},{key:"frame",get:function(){var tt=this.playState,at=this[E],ut=this[p].fill;if(tt==="idle")return at;var V=this.timeline.currentTime,Q=this[x].slice(0),ft=(0,O.getProgress)(this.timeline,this[p],this.progress),mt=ft.p,yt=ft.inverted,wt=at;return V<0&&tt==="pending"?(ut==="backwards"||ut==="both")&&(wt=yt?Q[Q.length-1]:Q[0]):(tt!=="pending"&&tt!=="finished"||ut==="forwards"||ut==="both")&&(wt=(0,O.getCurrentFrame)(this[p],Q,this[U],mt)),wt}},{key:"timing",get:function(){return this[p]}},{key:"effects",get:function(){return this[U]}},{key:"baseTimeline",set:function(tt){this[p].timeline=tt},get:function(){return this[p].timeline}},{key:"ready",get:function(){return this[R]?this[R].promise:this.timeline&&this.timeline.currentTime>=0&&this.playState!=="paused"?n.default.resolve():(this[R]=(0,O.defer)(),this.timeline&&this[M](),this[R]?this[R].promise:n.default.resolve())}},{key:"finished",get:function(){return this.playState==="finished"?n.default.resolve():(this[D]||(this[D]=(0,O.defer)(),this.timeline&&this[W]()),this[D].promise)}}]),$}();e.default=N},function(i,e,t){i.exports={default:t(192),__esModule:!0}},function(i,e,t){t(143),t(125),t(79),t(193),t(202),t(203),i.exports=t(92).Promise},function(i,e,t){var r=t(89),n=t(91),s=t(93),c=t(128),l=t(90),f=t(98),h=t(94),v=t(147),u=t(148),y=t(194),T=t(195).set,w=t(197)(),I=t(198),S=t(199),O=t(200),d=t(201),g="Promise",p=n.TypeError,x=n.process,E=x&&x.versions,R=E&&E.v8||"",D=n[g],U=c(x)=="process",M=function(){},W,X,B,N,$=X=I.f,J=!!function(){try{var yt=D.resolve(1),wt=(yt.constructor={})[t(122)("species")]=function(ht){ht(M,M)};return(U||typeof PromiseRejectionEvent=="function")&&yt.then(M)instanceof wt&&R.indexOf("6.6")!==0&&O.indexOf("Chrome/66")===-1}catch{}}(),tt=function(yt){var wt;return f(yt)&&typeof(wt=yt.then)=="function"?wt:!1},at=function(yt,wt){if(!yt._n){yt._n=!0;var ht=yt._c;w(function(){for(var Nt=yt._v,Dt=yt._s==1,G=0,k=function(rt){var nt=Dt?rt.ok:rt.fail,Y=rt.resolve,Z=rt.reject,C=rt.domain,L,z,K;try{nt?(Dt||(yt._h==2&&Q(yt),yt._h=1),nt===!0?L=Nt:(C&&C.enter(),L=nt(Nt),C&&(C.exit(),K=!0)),L===rt.promise?Z(p("Promise-chain cycle")):(z=tt(L))?z.call(L,Y,Z):Y(L)):Z(Nt)}catch(q){C&&!K&&C.exit(),Z(q)}};ht.length>G;)k(ht[G++]);yt._c=[],yt._n=!1,wt&&!yt._h&&ut(yt)})}},ut=function(yt){T.call(n,function(){var wt=yt._v,ht=V(yt),Nt,Dt,G;if(ht&&(Nt=S(function(){U?x.emit("unhandledRejection",wt,yt):(Dt=n.onunhandledrejection)?Dt({promise:yt,reason:wt}):(G=n.console)&&G.error&&G.error("Unhandled promise rejection",wt)}),yt._h=U||V(yt)?2:1),yt._a=void 0,ht&&Nt.e)throw Nt.v})},V=function(yt){return yt._h!==1&&(yt._a||yt._c).length===0},Q=function(yt){T.call(n,function(){var wt;U?x.emit("rejectionHandled",yt):(wt=n.onrejectionhandled)&&wt({promise:yt,reason:yt._v})})},ft=function(yt){var wt=this;wt._d||(wt._d=!0,wt=wt._w||wt,wt._v=yt,wt._s=2,wt._a||(wt._a=wt._c.slice()),at(wt,!0))},mt=function(yt){var wt=this,ht;if(!wt._d){wt._d=!0,wt=wt._w||wt;try{if(wt===yt)throw p("Promise can't be resolved itself");(ht=tt(yt))?w(function(){var Nt={_w:wt,_d:!1};try{ht.call(yt,s(mt,Nt,1),s(ft,Nt,1))}catch(Dt){ft.call(Nt,Dt)}}):(wt._v=yt,wt._s=1,at(wt,!1))}catch(Nt){ft.call({_w:wt,_d:!1},Nt)}}};J||(D=function(wt){v(this,D,g,"_h"),h(wt),W.call(this);try{wt(s(mt,this,1),s(ft,this,1))}catch(ht){ft.call(this,ht)}},W=function(wt){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},W.prototype=t(146)(D.prototype,{then:function(wt,ht){var Nt=$(y(this,D));return Nt.ok=typeof wt=="function"?wt:!0,Nt.fail=typeof ht=="function"&&ht,Nt.domain=U?x.domain:void 0,this._c.push(Nt),this._a&&this._a.push(Nt),this._s&&at(this,!1),Nt.promise},catch:function(yt){return this.then(void 0,yt)}}),B=function(){var yt=new W;this.promise=yt,this.resolve=s(mt,yt,1),this.reject=s(ft,yt,1)},I.f=$=function(yt){return yt===D||yt===N?new B(yt):X(yt)}),l(l.G+l.W+l.F*!J,{Promise:D}),t(121)(D,g),t(149)(g),N=t(92)[g],l(l.S+l.F*!J,g,{reject:function(wt){var ht=$(this),Nt=ht.reject;return Nt(wt),ht.promise}}),l(l.S+l.F*(r||!J),g,{resolve:function(wt){return d(r&&this===N?D:this,wt)}}),l(l.S+l.F*!(J&&t(140)(function(yt){D.all(yt).catch(M)})),g,{all:function(wt){var ht=this,Nt=$(ht),Dt=Nt.resolve,G=Nt.reject,k=S(function(){var rt=[],nt=0,Y=1;u(wt,!1,function(Z){var C=nt++,L=!1;rt.push(void 0),Y++,ht.resolve(Z).then(function(z){L||(L=!0,rt[C]=z,--Y||Dt(rt))},G)}),--Y||Dt(rt)});return k.e&&G(k.v),Nt.promise},race:function(wt){var ht=this,Nt=$(ht),Dt=Nt.reject,G=S(function(){u(wt,!1,function(k){ht.resolve(k).then(Nt.resolve,Dt)})});return G.e&&Dt(G.v),Nt.promise}})},function(i,e,t){var r=t(97),n=t(94),s=t(122)("species");i.exports=function(c,l){var f=r(c).constructor,h;return f===void 0||(h=r(f)[s])==null?l:n(h)}},function(i,e,t){var r=t(93),n=t(196),s=t(120),c=t(102),l=t(91),f=l.process,h=l.setImmediate,v=l.clearImmediate,u=l.MessageChannel,y=l.Dispatch,T=0,w={},I="onreadystatechange",S,O,d,g=function(){var x=+this;if(w.hasOwnProperty(x)){var E=w[x];delete w[x],E()}},p=function(x){g.call(x.data)};(!h||!v)&&(h=function(E){for(var R=[],D=1;arguments.length>D;)R.push(arguments[D++]);return w[++T]=function(){n(typeof E=="function"?E:Function(E),R)},S(T),T},v=function(E){delete w[E]},t(86)(f)=="process"?S=function(x){f.nextTick(r(g,x,1))}:y&&y.now?S=function(x){y.now(r(g,x,1))}:u?(O=new u,d=O.port2,O.port1.onmessage=p,S=r(d.postMessage,d,1)):l.addEventListener&&typeof postMessage=="function"&&!l.importScripts?(S=function(x){l.postMessage(x+"","*")},l.addEventListener("message",p,!1)):I in c("script")?S=function(x){s.appendChild(c("script"))[I]=function(){s.removeChild(this),g.call(x)}}:S=function(x){setTimeout(r(g,x,1),0)}),i.exports={set:h,clear:v}},function(i,e){i.exports=function(t,r,n){var s=n===void 0;switch(r.length){case 0:return s?t():t.call(n);case 1:return s?t(r[0]):t.call(n,r[0]);case 2:return s?t(r[0],r[1]):t.call(n,r[0],r[1]);case 3:return s?t(r[0],r[1],r[2]):t.call(n,r[0],r[1],r[2]);case 4:return s?t(r[0],r[1],r[2],r[3]):t.call(n,r[0],r[1],r[2],r[3])}return t.apply(n,r)}},function(i,e,t){var r=t(91),n=t(195).set,s=r.MutationObserver||r.WebKitMutationObserver,c=r.process,l=r.Promise,f=t(86)(c)=="process";i.exports=function(){var h,v,u,y=function(){var S,O;for(f&&(S=c.domain)&&S.exit();h;){O=h.fn,h=h.next;try{O()}catch(d){throw h?u():v=void 0,d}}v=void 0,S&&S.enter()};if(f)u=function(){c.nextTick(y)};else if(s&&!(r.navigator&&r.navigator.standalone)){var T=!0,w=document.createTextNode("");new s(y).observe(w,{characterData:!0}),u=function(){w.data=T=!T}}else if(l&&l.resolve){var I=l.resolve(void 0);u=function(){I.then(y)}}else u=function(){n.call(r,y)};return function(S){var O={fn:S,next:void 0};v&&(v.next=O),h||(h=O,u()),v=O}}},function(i,e,t){var r=t(94);function n(s){var c,l;this.promise=new s(function(f,h){if(c!==void 0||l!==void 0)throw TypeError("Bad Promise constructor");c=f,l=h}),this.resolve=r(c),this.reject=r(l)}i.exports.f=function(s){return new n(s)}},function(i,e){i.exports=function(t){try{return{e:!1,v:t()}}catch(r){return{e:!0,v:r}}}},function(i,e,t){var r=t(91),n=r.navigator;i.exports=n&&n.userAgent||""},function(i,e,t){var r=t(97),n=t(98),s=t(198);i.exports=function(c,l){if(r(c),n(l)&&l.constructor===c)return l;var f=s.f(c),h=f.resolve;return h(l),f.promise}},function(i,e,t){var r=t(90),n=t(92),s=t(91),c=t(194),l=t(201);r(r.P+r.R,"Promise",{finally:function(f){var h=c(this,n.Promise||s.Promise),v=typeof f=="function";return this.then(v?function(u){return l(h,f()).then(function(){return u})}:f,v?function(u){return l(h,f()).then(function(){throw u})}:f)}})},function(i,e,t){var r=t(90),n=t(198),s=t(199);r(r.S,"Promise",{try:function(c){var l=n.f(this),f=s(c);return(f.e?l.reject:l.resolve)(f.v),l.promise}})},function(i,e,t){i.exports={default:t(205),__esModule:!0}},function(i,e,t){t(206),i.exports=t(92).Object.keys},function(i,e,t){var r=t(124),n=t(110);t(207)("keys",function(){return function(c){return n(r(c))}})},function(i,e,t){var r=t(90),n=t(92),s=t(101);i.exports=function(c,l){var f=(n.Object||{})[c]||Object[c],h={};h[c]=l(f),r(r.S+r.F*s(function(){f(1)}),"Object",h)}},function(i,e,t){Object.defineProperty(e,"__esModule",{value:!0});var r=t(76),n=w(r),s=t(209),c=w(s),l=t(164),f=w(l),h=t(191),v=w(h);e.defer=I,e.periodicity=S,e.calculateFramesOffset=O,e.getProgress=d,e.getCurrentFrame=p;var u=t(188),y=t(187),T=w(y);function w(x){return x&&x.__esModule?x:{default:x}}function I(){var x={};return x.promise=new v.default(function(E,R){x.resolve=E,x.reject=R}),x}function S(x,E){var R=Math.floor(x/E),D=x-R*E;return D===0&&R>0&&(D=E,R--),[R,D]}function O(x){x=x.slice(0);var E=x[0],R=x[x.length-1];R.offset=R.offset||1,E.offset=E.offset||0;for(var D=0,U=-1,M=0;M<x.length;M++){var W=x[M];if(W.offset!=null){var X=M-U;if(X>1)for(var B=(W.offset-D)/X,N=0;N<X-1;N++)x[U+N+1].offset=D+B*(N+1);D=W.offset,U=M}if(W.easing!=null&&(W.easing=(0,u.parseEasing)(W.easing)),M>0){var $=x[M].easing!=null;x[M]=(0,f.default)({},x[M-1],x[M]),$||delete x[M].easing}}return x}function d(x,E,R){var D=x.currentTime,U=E.direction,M=E.duration,W=!1;if(U==="reverse")R=1-R,W=!0;else if(U==="alternate"||U==="alternate-reverse"){var X=Math.floor(D/M);R===1&&X--,X%2^U==="alternate-reverse"&&(R=1-R,W=!0)}return{p:R,inverted:W}}function g(x,E,R,D){var U={};return(0,c.default)(E).forEach(function(M){var W=(0,n.default)(M,2),X=W[0],B=W[1];if(X!=="offset"&&X!=="easing"){var N=R[X]||R.default,$=N(x[X],B,D,x.offset,E.offset);$!=null&&(U[X]=$)}}),U}function p(x,E,R,D){var U=x.easing,M=x.effect;M||(R=(0,f.default)({},T.default,R));var W={};D=U(D,E);for(var X=1;X<E.length;X++){var B=E[X],N=B.offset;if(N>=D||X===E.length-1){var $=E[X-1],J=$.offset,tt=$.easing,at=D;if(tt){var ut=N-J;at=tt((D-J)/ut)*ut+J}M?W=M($,B,at,J,N):W=g($,B,R,at);break}}return W}},function(i,e,t){i.exports={default:t(210),__esModule:!0}},function(i,e,t){t(211),i.exports=t(92).Object.entries},function(i,e,t){var r=t(90),n=t(212)(!0);r(r.S,"Object",{entries:function(c){return n(c)}})},function(i,e,t){var r=t(100),n=t(110),s=t(84),c=t(169).f;i.exports=function(l){return function(f){for(var h=s(f),v=n(h),u=v.length,y=0,T=[],w;u>y;)w=v[y++],(!r||c.call(h,w))&&T.push(l?[w,h[w]]:h[w]);return T}}},function(i,e,t){t.r(e),t(1).glMatrix.setMatrixArrayType(Array);const r=new Map;function n(c,l={},f=[]){c=c.toLowerCase();const h=r.get(c);if(!h)throw new TypeError(`Invalid node: ${c}`);const v=new h(l);return f.forEach(u=>{v.appendChild(u)}),v}const s={registerNode(c,l,f=100){if(l=l.toLowerCase(),r.has(l))throw new TypeError(`Cannot registerNode, ${l} has been taken.`);r.set(l,c),Object.defineProperties(c.prototype,{nodeType:{value:f},tagName:{value:l.toUpperCase()},nodeName:{value:l},ownerDocument:{value:s},namespaceURI:{value:`http://spritejs.com/${l}`}})},createElement:n,createElementNS(c,l){return n(l)},isSpriteNode(c){return r.has(c.toLowerCase())}};e.default=s},function(i,e,t){t.r(e),t.d(e,"default",function(){return l}),t(1).glMatrix.setMatrixArrayType(Array);const r=Symbol("type"),n=Symbol("bubbles"),s=Symbol("originalEvent"),c=Symbol("detail");class l{constructor(h,{bubbles:v=null}={}){if(typeof h=="string"?(this[r]=h,this[n]=!!v):(this[r]=h.type,this[s]=h,this[n]=v!=null?!!v:!!h.bubbles,h.detail&&(this[c]=h.detail)),!this[r])throw new TypeError("Invalid event type.");this.cancelBubble=!1}setOriginalEvent(h){this[s]=h}get originalEvent(){return this[s]}get type(){return this[r]}get bubbles(){return this[n]}get detail(){return this[c]}stopPropagation(){this.cancelBubble=!0}}},function(i,e,t){t.r(e),t.d(e,"parseFilterString",function(){return n}),t.d(e,"applyFilters",function(){return s});var r=t(72);t(1).glMatrix.setMatrixArrayType(Array);function n(c){if(c=c.trim(),!c||c==="none")return null;const l=/^(?:(url|blur|brightness|contrast|drop-shadow|grayscale|hue-rotate|invert|opacity|saturate|sepia)\(([^()]*(?:\(.*\))*[^()]*)\))+$/i,f=c.match(/(?:(url|blur|brightness|contrast|drop-shadow|grayscale|hue-rotate|invert|opacity|saturate|sepia)\(([^()]*(?:\(.*\))*[^()]*)\))+?/ig),h=[];return f&&f.forEach(v=>{const u=v.match(l);if(!u)throw new TypeError("Invalid fitler string.");let[,y,T]=u;y=y.toLowerCase(),T=T.trim().match(/([^( )]+|([^( )]+\(.*\)))(?=\s|$)/g).map((w,I)=>{let S;return y==="url"||y==="drop-shadow"&&I===3?S=w:S=Object(r.toNumber)(w),/%$/.test(w)&&(S/=100),S}),h.push({type:y,args:T})}),h}function s(c,l){c.clearFilter(),l&&l.forEach(({type:f,args:h})=>{let v=f;v==="drop-shadow"?v="dropShadow":v==="hue-rotate"&&(v="hueRotate"),c[v](...h)})}},function(i,e,t){t.r(e),t.d(e,"default",function(){return r}),t(1).glMatrix.setMatrixArrayType(Array);function r(n,s){if(!s)return;const c=n.getListeners("beforerender"),l=n.getListeners("afterrender");c.length&&!s.beforeRender?s.beforeRender=f=>{n.dispatchEvent({type:"beforerender",detail:{context:f}})}:c.length||(s.beforeRender=null),l.length&&!s.afterRender?s.afterRender=f=>{n.dispatchEvent({type:"afterrender",detail:{context:f}})}:l.length||(s.afterRender=null)}},function(i,e,t){t.r(e),t.d(e,"default",function(){return h});var r=t(12),n=t(218),s=t(70),c=t(213);t(1).glMatrix.setMatrixArrayType(Array);const l=Symbol("amount"),f=Symbol("meshCloud");class h extends s.default{constructor(u,y=1){super(),this.meshNode=u,u.connect(this),this[l]=y,this[f]=null}get meshCloud(){const u=this.meshNode,y=this[l];return!this[f]&&u.mesh&&(this[f]=new r.MeshCloud(u.mesh,y)),this[f]}get isVisible(){return!!this.meshNode&&this.meshNode.isVisible}get amount(){return this[l]}set amount(u){this[l]=u,this[f]&&(this[f].amount=u)}brightness(u,y){this.meshCloud&&(this.meshCloud.brightness(u,y),this.forceUpdate())}contrast(u,y){this.meshCloud&&(this.meshCloud.contrast(u,y),this.forceUpdate())}delete(u){this.meshCloud&&(this.meshCloud.delete(u),this[l]--,this.forceUpdate())}draw(u=[]){if(super.draw(u),this.meshCloud){if(this.program){this.meshCloud.setProgram(this.program);const y=this.shaderAttrs;y&&Object.entries(y).forEach(([w,I])=>{this.meshCloud.mesh.setAttribute(w,I)});const T=this.uniforms;if(this.uniforms){const w={};Object.entries(T).forEach(([I,S])=>{typeof S=="function"&&(S=S(this,I)),w[I]=S}),this.meshCloud.mesh.setUniforms(w)}}this.meshNode.textureImage&&Object(n.drawTexture)(this.meshNode,this.meshNode.mesh),u.push(this.meshCloud)}return u}getTransform(u){if(this.meshCloud)return this.meshCloud.getTransform(u)}grayscale(u,y){this.meshCloud&&(this.meshCloud.grayscale(u,y),this.forceUpdate())}hueRotate(u,y){this.meshCloud&&(this.meshCloud.hueRotate(u,y),this.forceUpdate())}invert(u,y){this.meshCloud&&(this.meshCloud.invert(u,y),this.forceUpdate())}isPointCollision(u,y){if(!this.meshCloud)return!1;const T=this.attributes.pointerEvents;if(T==="none"||T!=="all"&&!this.isVisible)return!1;let w="both";T==="visibleFill"&&(w="fill"),T==="visibleStroke"&&(w="stroke");for(let I=0;I<this[l];I++)if(!this.meshCloud.isPointCollision(I,[u,y],w))return!1;return!0}setOpacity(u,y){this.meshCloud&&(this.meshCloud.opacity(u,y),this.forceUpdate())}rotate(u,y,[T,w]=[0,0]){const I=Math.PI*y/180;if(this.meshCloud){const{x:S,y:O}=this.meshNode.attributes;this.meshCloud.rotate(u,I,[T+S,w+O]),this.forceUpdate()}}saturate(u,y){this.meshCloud&&(this.meshCloud.saturate(u,y),this.forceUpdate())}scale(u,[y,T=y],[w,I]=[0,0]){if(this.meshCloud){const{x:S,y:O}=this.meshNode.attributes,d=1e-5;Math.abs(y)<d&&(y=1/y>0?d:-d),Math.abs(T)<d&&(T=1/T>0?d:-d),this.meshCloud.scale(u,[y,T],[w+S,I+O]),this.forceUpdate()}}setColorTransform(u,y){this.meshCloud&&(this.meshCloud.setColorTransform(u,y),this.forceUpdate())}setFillColor(u,y){this.meshCloud&&(Array.isArray(y)&&(y=[...y],y[0]/=255,y[1]/=255,y[2]/=255),this.meshCloud.setFillColor(u,y),this.forceUpdate())}sepia(u,y){this.meshCloud&&(this.meshCloud.sepia(u,y),this.forceUpdate())}setResolution({width:u,height:y}){super.setResolution({width:u,height:y}),this.meshNode.setResolution({width:u,height:y})}setStrokeColor(u,y){this.meshCloud&&(Array.isArray(y)&&(y=[...y],y[0]/=255,y[1]/=255,y[2]/=255),this.meshCloud.setStrokeColor(u,y),this.forceUpdate())}setTransform(u,y){this.meshCloud&&(this.meshCloud.setTransform(u,y),this.forceUpdate())}skew(u,[y,T=y],[w,I]=[0,0]){if(this.meshCloud){const{x:S,y:O}=this.meshNode.attributes;this.meshCloud.skew(u,[y,T],[w+S,I+O]),this.forceUpdate()}}transform(u,y){this.meshCloud&&(this.meshCloud.transform(u,y),this.forceUpdate())}transformColor(u,y){this.meshCloud&&(this.meshCloud.transformColor(u,y),this.forceUpdate())}translate(u,[y,T]){this.meshCloud&&(this.meshCloud.translate(u,[y,T]),this.forceUpdate())}updateMesh(){this[f]&&(this[f].mesh=this.meshNode.mesh,this.forceUpdate())}}c.default.registerNode(h,"cloud")},function(i,e,t){t.r(e),t.d(e,"loadTexture",function(){return c}),t.d(e,"applyTexture",function(){return l}),t.d(e,"createTexture",function(){return h}),t.d(e,"deleteTexture",function(){return v}),t.d(e,"drawTexture",function(){return y}),t.d(e,"loadFrames",function(){return T});var r=t(12),n=t(72);t(1).glMatrix.setMatrixArrayType(Array);const s={};function c(w,I){if(s[w])return s[w];const S=r.ENV.loadImage(w,{alias:I,useImageBitmap:!1});return S??w}async function l(w,I,S){let O=I;if(typeof I=="string"&&(O=c(I)),O&&typeof O.then=="function"&&(O=await O),I===w.attributes.texture){O&&O.image&&(O.sourceRect&&(w.attributes.sourceRect=O.sourceRect),w.textureImageRotated=!!O.rotated,O=O.image);const{width:d,height:g,textureRect:p}=w.attributes,x=w.textureImage;w.textureImage=O,S&&x!==O&&!p&&(d==null||g==null)&&w.updateContours(),w.forceUpdate()}return O}const f=Symbol("textureMap");function h(w,I){if(I[f]=I[f]||new Map,I[f].has(w))return I[f].get(w);const S=I.createTexture(w);return!/^blob:/.test(w.src)&&typeof w.getContext!="function"&&I[f].set(w,S),S}function v(w,I){if(I[f]&&I[f].has(w)){const S=I[f].get(w);return I.deleteTexture(S),I[f].delete(w),!0}return!1}const u=Symbol("textureContext");function y(w,I){const S=w.textureImage instanceof String?String(w.textureImage):w.textureImage,O=w.textureImageRotated,d=I.texture,g=w.renderer;if(S){const p=w.originalContentRect;let x=w.attributes.textureRect;const E=w.attributes.textureRepeat,R=w.attributes.sourceRect;if(!d||w[u]&&w[u]!==g||d.image!==S||d.options.repeat!==E||!Object(n.compareValue)(d.options.rect,x)||!Object(n.compareValue)(d.options.srcRect,R)){const D=h(S,g);x?(x[0]+=p[0],x[1]+=p[1]):x=p;let U=null;d&&!g[f].has(d.image)&&(!d.options||!d.options.hidden)&&(U=I.uniforms.u_texSampler),I.setTexture(D,{rect:x,repeat:E,srcRect:R,rotated:O}),U&&U.delete&&U.delete(),w[u]=g}}else if(d){let p=null;!g[f].has(d.image)&&(!d.options||!d.options.hidden)&&(p=I.uniforms.u_texSampler),I.setTexture(null),p&&p.delete&&p.delete()}}async function T(w,I){typeof I=="string"&&(I=await(await fetch(I,{method:"GET",mode:"cors",cache:"default"})).json());const S=await c(w),O=I.frames;return Object.entries(O).forEach(([d,g])=>{const{x:p,y:x,w:E,h:R}=g.frame;let D=[p,x,E,R];const U=g.rotated;U&&(D=[D[0],D[1],D[3],D[2]]),s[d]={image:S,sourceRect:D,rotated:U}}),S}},function(i,e,t){t.r(e),t.d(e,"default",function(){return T});var r=t(1),n=t(12),s=t(70),c=t(220),l=t(221),f=t(222),h=t(213),v=t(223);t(1).glMatrix.setMatrixArrayType(Array);function u(w,I,S){return I in w?Object.defineProperty(w,I,{value:S,enumerable:!0,configurable:!0,writable:!0}):w[I]=S,w}const y=Symbol("mesh");class T extends s.default{constructor(I={}){super(I)}get borderSize(){const{paddingTop:I,paddingRight:S,paddingBottom:O,paddingLeft:d,borderWidth:g}=this.attributes,[p,x]=this.contentSize;return[d+p+S+g,I+x+O+g]}get clientSize(){const{paddingTop:I,paddingRight:S,paddingBottom:O,paddingLeft:d}=this.attributes,[g,p]=this.contentSize;return[d+g+S,I+p+O]}get contentSize(){let{width:I,height:S,boxSizing:O,paddingTop:d,paddingRight:g,paddingBottom:p,paddingLeft:x}=this.attributes;if(I=I||0,S=S||0,O==="border-box"){const E=2*this.attributes.borderWidth;I-=E+g+x,S-=E+d+p,I=Math.max(0,I),S=Math.max(0,S)}return[I,S]}get hasBorder(){return this.attributes.borderWidth>0}get isVisible(){const[I,S]=this.borderSize;return I>0&&S>0}get mesh(){if(this.attributes.display==="none")return null;const I=this.clientBox;if(I){let S=this[y];if(S)S.box!==I&&(S.contours=I.contours,S.box=I);else{S=new n.Mesh2D(I),S.box=I;const d=this.attributes.bgcolor;if(Object(l.setFillColor)(S,{color:d}),this.hasBorder){const{borderColor:p,borderWidth:x,borderDash:E,borderDashOffset:R}=this.attributes;Object(l.setStrokeColor)(S,{color:p,lineWidth:x,lineDash:E,lineDashOffset:R})}this[y]=S;const g=this.attributes.clipPath;g&&this[y].setClipPath(g)}const O=this.opacity;return S.getOpacity()!==O&&S.setOpacity(O),S.setTransform(...this.renderMatrix),S}return null}get offsetSize(){const{paddingTop:I,paddingRight:S,paddingBottom:O,paddingLeft:d,borderWidth:g}=this.attributes,[p,x]=this.contentSize,E=2*g;return[d+p+S+E,I+x+O+E]}get originalClientRect(){if(this.mesh){const I=this.mesh.boundingBox;return[I[0][0],I[0][1],I[1][0]-I[0][0],I[1][1]-I[0][1]]}return[0,0,0,0]}get originalContentRect(){const[I,S,O,d]=this.originalClientRect,g=this.attributes.padding;return[I+g[0],S+g[1],O-g[0]-g[2],d-g[1]-g[3]]}getBoundingClientRect(){let I=this.renderMatrix;this.layer&&this.layer.layerTransformInvert&&(I=r.mat2d.multiply(Array.of(0,0,0,0,0,0),this.layer.transformMatrix,I));let S=null;if(this.mesh){S=[...this.mesh.boundingBox];const O=this.attributes.borderWidth;O&&(S[0]=[S[0][0]-O,S[0][1]-O],S[1]=[S[1][0]+O,S[1][1]+O])}return Object(v.default)(S,I)}onPropertyChange(I,S,O){if(super.onPropertyChange(I,S,O),(I==="anchorX"||I==="anchorY"||I==="boxSizing"||I==="width"||I==="height"||I==="borderWidth"||I==="paddingLeft"||I==="paddingRight"||I==="paddingTop"||I==="paddingBottom"||/^border(TopLeft|TopRight|BottomRight|BottomLeft)Radius$/.test(I))&&this.updateContours(),this[y]&&I==="clipPath"&&this[y].setClipPath(S),this[y]&&I==="bgcolor"&&Object(l.setFillColor)(this[y],{color:S}),this[y]&&(I==="borderColor"||I==="borderWidth"||I==="borderDash"||I==="borderDashOffset")){const{borderColor:d,borderWidth:g,borderDash:p,borderDashOffset:x}=this.attributes;Object(l.setStrokeColor)(this[y],{color:d,lineWidth:g,lineDash:g?p:0,lineDashOffset:x})}}updateContours(){const{anchorX:I,anchorY:S,borderWidth:O,borderRadius:d}=this.attributes,[g,p]=this.borderSize,x=this.offsetSize,E=.5*O,R=-I*x[0]+E,D=-S*x[1]+E;this.clientBox=new n.Figure2D,Object(f.createRadiusBox)(this.clientBox,[R,D,g,p],d)}}u(T,"Attr",c.default),h.default.registerNode(T,"block")},function(i,e,t){t.r(e),t.d(e,"default",function(){return v});var r=t(71),n=t(72),s=t(221);t(1).glMatrix.setMatrixArrayType(Array);const c=Symbol.for("spritejs_setAttribute"),l=Symbol.for("spritejs_getAttribute"),f=Symbol.for("spritejs_setAttributeDefault"),h=Symbol.for("spritejs_declareAlias");class v extends r.default{constructor(y){super(y),this[f]({anchorX:0,anchorY:0,width:void 0,height:void 0,borderWidth:0,borderColor:"rgba(0,0,0,1)",borderDash:void 0,borderDashOffset:0,borderTopLeftRadius:[0,0],borderTopRightRadius:[0,0],borderBottomRightRadius:[0,0],borderBottomLeftRadius:[0,0],bgcolor:"rgba(0,0,0,0)",paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,boxSizing:"content-box",clipPath:void 0}),this[h]("anchor","size","border","borderRadius","padding")}get anchorX(){return this[l]("anchorX")}set anchorX(y){this[c]("anchorX",Object(n.toNumber)(y))}get anchorY(){return this[l]("anchorY")}set anchorY(y){this[c]("anchorY",Object(n.toNumber)(y))}get anchor(){return[this.anchorX,this.anchorY]}set anchor(y){y=Object(n.toArray)(y),Array.isArray(y)||(y=[y,y]),this.anchorX=y[0],this.anchorY=y[1]}get width(){return this[l]("width")}set width(y){this[c]("width",Object(n.toNumber)(y))}get height(){return this[l]("height")}set height(y){this[c]("height",Object(n.toNumber)(y))}get size(){return[this.width,this.height]}set size(y){y=Object(n.toArray)(y),Array.isArray(y)||(y=[y,y]),this.width=y[0],this.height=y[1]}get borderWidth(){return this[l]("borderWidth")}set borderWidth(y){this[c]("borderWidth",Object(n.toNumber)(y))}get borderColor(){return this[l]("borderColor")}set borderColor(y){this[c]("borderColor",Object(s.parseColor)(y))}get border(){return[this.borderWidth,this.borderColor]}set border(y){y=Object(n.toArray)(y),Array.isArray(y)||(y=[y]),this.borderWidth=y[0],y[1]!=null&&(this.borderColor=y[1])}get borderDash(){return this[l]("borderDash")}set borderDash(y){y=Object(n.toArray)(y,!0),y!=null&&!Array.isArray(y)&&(y=[y]),this[c]("borderDash",y?y.map(n.toNumber):null)}get borderDashOffset(){return this[l]("borderDashOffset")}set borderDashOffset(y){this[c]("borderDashOffset",Object(n.toNumber)(y))}get borderTopLeftRadius(){return this[l]("borderTopLeftRadius")}set borderTopLeftRadius(y){y=Object(n.toArray)(y,!0),Array.isArray(y)||(y=[y,y]),this[c]("borderTopLeftRadius",y.map(n.toNumber))}get borderTopRightRadius(){return this[l]("borderTopRightRadius")}set borderTopRightRadius(y){y=Object(n.toArray)(y,!0),Array.isArray(y)||(y=[y,y]),this[c]("borderTopRightRadius",y.map(n.toNumber))}get borderBottomRightRadius(){return this[l]("borderBottomRightRadius")}set borderBottomRightRadius(y){y=Object(n.toArray)(y,!0),Array.isArray(y)||(y=[y,y]),this[c]("borderBottomRightRadius",y.map(n.toNumber))}get borderBottomLeftRadius(){return this[l]("borderBottomLeftRadius")}set borderBottomLeftRadius(y){y=Object(n.toArray)(y,!0),Array.isArray(y)||(y=[y,y]),this[c]("borderBottomLeftRadius",y.map(n.toNumber))}get borderRadius(){return[...this.borderTopLeftRadius,...this.borderTopRightRadius,...this.borderBottomRightRadius,...this.borderBottomLeftRadius]}set borderRadius(y){if(y=Object(n.toArray)(y),!Array.isArray(y))y=Array(8).fill(y);else if(y.length===2)y=[y[0],y[1],y[0],y[1],y[0],y[1],y[0],y[1]];else if(y.length===4)y=[y[0],y[1],y[2],y[3],y[0],y[1],y[2],y[3]];else if(y.length===6)y=[y[0],y[1],y[2],y[3],y[4],y[5],y[2],y[3]];else if(y.length!==8)throw new TypeError("Invalid borderRadius value.");this.borderTopLeftRadius=[y[0],y[1]],this.borderTopRightRadius=[y[2],y[3]],this.borderBottomRightRadius=[y[4],y[5]],this.borderBottomLeftRadius=[y[6],y[7]]}get bgcolor(){return this[l]("bgcolor")}set bgcolor(y){this[c]("bgcolor",Object(s.parseColor)(y))}get paddingTop(){return this[l]("paddingTop")}set paddingTop(y){this[c]("paddingTop",Object(n.toNumber)(y))}get paddingRight(){return this[l]("paddingRight")}set paddingRight(y){this[c]("paddingRight",Object(n.toNumber)(y))}get paddingBottom(){return this[l]("paddingBottom")}set paddingBottom(y){this[c]("paddingBottom",Object(n.toNumber)(y))}get paddingLeft(){return this[l]("paddingLeft")}set paddingLeft(y){this[c]("paddingLeft",Object(n.toNumber)(y))}get padding(){return[this.paddingTop,this.paddingRight,this.paddingBottom,this.paddingLeft]}set padding(y){y=Object(n.toArray)(y),Array.isArray(y)?y.length===2?y=[y[0],y[1],y[0],y[1]]:y.length===3&&(y=[y[0],y[1],y[2],y[1]]):y=[y,y,y,y],this.paddingTop=y[0],this.paddingRight=y[1],this.paddingBottom=y[2],this.paddingLeft=y[3]}get clipPath(){return this[l]("clipPath")}set clipPath(y){this[c]("clipPath",y)}get boxSizing(){return this[l]("boxSizing")}set boxSizing(y){if(y!=null&&y!=="border-box"&&y!=="content-box")throw new TypeError("Invalid boxSizing type.");this[c]("boxSizing",y)}}},function(i,e,t){t.r(e),t.d(e,"Gradient",function(){return s}),t.d(e,"isTransparent",function(){return c}),t.d(e,"parseColor",function(){return l}),t.d(e,"setFillColor",function(){return h}),t.d(e,"setStrokeColor",function(){return v}),t.d(e,"Color",function(){return u});var r=t(32),n=t.n(r);t(1).glMatrix.setMatrixArrayType(Array);class s{constructor({vector:T,colors:w}){if(!Array.isArray(T)||T.length!==4&&T.length!==6&&T.length!==3)throw new TypeError("Invalid gradient");this.vector=T,this.colors=w.map(({offset:I,color:S})=>({offset:I,color:l(S)}))}toString(){return JSON.stringify({vector:this.vector,colors:this.colors})}}function c(y){return y instanceof s?!1:y==null?!0:n()(y)[3]===0}function l(y){if(y==null||(y||(y="transparent"),y instanceof s))return y;const T=n()(y);if(!T||!T.length)throw new TypeError("Invalid color value.");return`rgba(${T.join()})`}function f(y,T,w){const I=y.boundingBox[0];if(w.vector){let{vector:S,colors:O}=w;S.length===4?(S=[S[0]+I[0],S[1]+I[1],S[2]+I[0],S[3]+I[1]],y.setLinearGradient({vector:S,colors:O,type:T})):S.length===3?(S=[S[0]+I[0],S[1]+I[1],S[2]],y.setCircularGradient({vector:S,colors:O,type:T})):(S=[S[0]+I[0],S[1]+I[1],S[2],S[3]+I[0],S[4]+I[1],S[5]],y.setRadialGradient({vector:S,colors:O,type:T}))}else y.gradient&&y.gradient[T]&&(delete y.gradient[T],delete y.uniforms.u_radialGradientVector)}function h(y,{color:T,rule:w="nonzero"}){return f(y,"fill",T),T.vector||y.setFill({color:T,rule:w}),y}function v(y,{color:T,lineWidth:w,lineCap:I,lineJoin:S,lineDash:O,lineDashOffset:d,miterLimit:g,roundSegments:p}){f(y,"stroke",T),T.vector&&(T=[0,0,0,1]),y.setStroke({color:T,thickness:w,cap:I,join:S,miterLimit:g,lineDash:O,lineDashOffset:d,roundSegments:p})}class u extends Array{constructor(T=0,w=0,I=0,S=0){return Array.isArray(T)&&([T,w,I,S]=T),typeof T=="string"&&([T,w,I,S]=n()(T),T/=255,w/=255,I/=255),super(T,w,I,S),this}get r(){return Math.round(this[0]*255)}set r(T){this[0]=T/255}get g(){return Math.round(this[1]*255)}set g(T){this[1]=T/255}get b(){return Math.round(this[2]*255)}set b(T){this[2]=T/255}get a(){return this[3]}set a(T){this[3]=T}get hex(){const T=`0${this.r.toString(16)}`.slice(-2),w=`0${this.g.toString(16)}`.slice(-2),I=`0${this.b.toString(16)}`.slice(-2);let S;return this.a<1&&(S=Math.round(this[3]*255),S=`0${S.toString(16)}`.slice(-2)),`#${T}${w}${I}${S||""}`}get rgba(){return`rgba(${this.r},${this.g},${this.b},${this.a})`}fromColor(T){return typeof T=="string"&&(T=n()(T),T[0]/=255,T[1]/=255,T[2]/=255),this[0]=T[0],this[1]=T[1],this[2]=T[2],this[3]=T[3],this}}},function(i,e,t){t.r(e),t.d(e,"createRadiusBox",function(){return n}),t(1).glMatrix.setMatrixArrayType(Array);function r(s,c,l,f,h,v="leftTop"){const u=.5522848,y=f/2*u,T=h/2*u,w=c+f,I=l+h,S=c+f/2,O=l+h/2;v==="leftTop"?(s.moveTo(c,O),s.bezierCurveTo(c,O-T,S-y,l,S,l)):v==="rightTop"?s.bezierCurveTo(S+y,l,w,O-T,w,O):v==="rightBottom"?s.bezierCurveTo(w,O+T,S+y,I,S,I):v==="leftBottom"&&s.bezierCurveTo(S-y,I,c,O+T,c,O)}function n(s,[c,l,f,h],v){if(!v||Array.isArray(v)&&v.every(u=>u===0))s.beginPath(),s.rect(c,l,f,h);else{typeof v=="number"&&(v=Array(8).fill(v));const[u,y,T,w,I,S,O,d]=v.map((g,p)=>p%2?Math.min(g,h/2):Math.min(g,f/2));s.beginPath(),s.moveTo(c,l+y),r(s,c,l,u*2,y*2,"leftTop"),s.lineTo(c+f-T,l),r(s,c+f-T*2,l,T*2,w*2,"rightTop"),s.lineTo(c+f,l+h-S),r(s,c+f-I*2,l+h-S*2,I*2,S*2,"rightBottom"),s.lineTo(c+O,l+h),r(s,c,l+h-d*2,O*2,d*2,"leftBottom"),s.closePath()}return s}},function(i,e,t){t.r(e),t(1).glMatrix.setMatrixArrayType(Array),e.default=function(r,n){if(!r)return{x:0,y:0,width:0,height:0,left:0,top:0,right:0,bottom:0};const[[s,c],[l,f]]=r,h=s*n[0]+c*n[2]+n[4],v=s*n[1]+c*n[3]+n[5],u=l*n[0]+c*n[2]+n[4],y=l*n[1]+c*n[3]+n[5],T=l*n[0]+f*n[2]+n[4],w=l*n[1]+f*n[3]+n[5],I=s*n[0]+f*n[2]+n[4],S=s*n[1]+f*n[3]+n[5],O=Math.min(h,u,T,I),d=Math.min(v,y,w,S),g=Math.max(h,u,T,I),p=Math.max(v,y,w,S);return{x:O,y:d,width:g-O,height:p-d,left:O,top:d,right:g,bottom:p}}},function(i,e,t){t.r(e),t.d(e,"default",function(){return h});var r=t(218),n=t(219),s=t(225),c=t(213);t(1).glMatrix.setMatrixArrayType(Array);function l(v,u,y){return u in v?Object.defineProperty(v,u,{value:y,enumerable:!0,configurable:!0,writable:!0}):v[u]=y,v}const f=Symbol("textureTask");class h extends n.default{constructor(u={}){typeof u=="string"&&(u={texture:u}),super(u)}get contentSize(){let[u,y]=super.contentSize;const{width:T,height:w}=this.attributes;if(T==null||w==null){const I=this.textureImage,S=this.attributes.textureRect,O=this.attributes.sourceRect;if(S)T==null&&(u=S[0]+S[2]),w==null&&(y=S[1]+S[3]);else if(O){const d=this.layer?this.layer.displayRatio:1;T==null&&(u=O[2]/d),w==null&&(y=O[3]/d)}else if(I){const d=this.layer?this.layer.displayRatio:1;T==null&&(u=I.width/d),w==null&&(y=I.height/d)}}return[u,y]}get textureImageReady(){return this[f]||Promise.resolve()}draw(u=[]){super.draw(u);const y=this.mesh;return y&&Object(r.drawTexture)(this,y),u}onPropertyChange(u,y,T){if(super.onPropertyChange(u,y,T),u==="texture"&&(this[f]=Object(r.applyTexture)(this,y,!0)),u==="textureRect"){const{width:w,height:I}=this.attributes;(w==null||I==null)&&this.updateContours()}}}l(h,"Attr",s.default),c.default.registerNode(h,"sprite")},function(i,e,t){t.r(e),t.d(e,"default",function(){return l});var r=t(220);t(1).glMatrix.setMatrixArrayType(Array);const n=Symbol.for("spritejs_setAttributeDefault"),s=Symbol.for("spritejs_setAttribute"),c=Symbol.for("spritejs_getAttribute");class l extends r.default{constructor(h){super(h),this[n]({texture:void 0,textureRect:void 0,textureRepeat:!1,sourceRect:void 0})}get texture(){return this[c]("texture")}set texture(h){this[s]("texture",h)}get textureRect(){return this[c]("textureRect")}set textureRect(h){this[s]("textureRect",h)}get sourceRect(){return this[c]("sourceRect")}set sourceRect(h){this[s]("sourceRect",h)}get textureRepeat(){return this[c]("textureRepeat")}set textureRepeat(h){this[s]("textureRepeat",!!h)}}},function(i,e,t){t.r(e),t.d(e,"default",function(){return w});var r=t(12),n=t(227),s=t.n(n),c=t(70),l=t(228),f=t(221),h=t(218),v=t(213),u=t(223);t(1).glMatrix.setMatrixArrayType(Array);function y(I,S,O){return S in I?Object.defineProperty(I,S,{value:O,enumerable:!0,configurable:!0,writable:!0}):I[S]=O,I}const T=Symbol("mesh");class w extends c.default{constructor(S={}){typeof S=="string"&&(S={d:S}),super(S),this.effects={d(O,d,g,p,x){const E=(g-p)/(x-p);if(E<=0)return O;if(E>=1)return d;const R=s.a._preprocessing(s.a.path2shapes(O),s.a.path2shapes(d)),D=s.a._lerp(...R,E)[0];return D.reduce((M,W)=>`${M}${W.slice(2).join(" ")} `,`M${D[0][0]} ${D[0][1]}C`).trim()}}}get isVisible(){return!!this.d}get mesh(){if(this.attributes.display==="none")return null;const S=this.path;if(S){let O=this[T];if(O)O.path!==S&&(O.contours=S.contours,O.path=S);else{O=new r.Mesh2D(this.path),O.path=S;const g=this.attributes.fillColor,p=this.attributes.fillRule;g&&Object(f.setFillColor)(O,{color:g,rule:p});const x=this.attributes.lineWidth,E=this.attributes.strokeColor;if(E&&x>0){const{lineCap:D,lineJoin:U,miterLimit:M,lineDash:W,lineDashOffset:X,roundSegments:B}=this.attributes;Object(f.setStrokeColor)(O,{color:E,lineWidth:x,lineCap:D,lineJoin:U,miterLimit:M,lineDash:W,lineDashOffset:X,roundSegments:B})}this[T]=O;const R=this.attributes.clipPath;R&&this[T].setClipPath(R)}const d=this.opacity;return O.getOpacity()!==d&&O.setOpacity(d),O.setTransform(...this.renderMatrix),O}return null}get originalContentRect(){if(this.path){const S=this.path.boundingBox;return[S[0][0],S[0][1],S[1][0]-S[0][0],S[1][1]-S[0][1]]}return[0,0,0,0]}get originalClientRect(){if(this.mesh){const S=this.mesh.boundingBox;return[S[0][0],S[0][1],S[1][0]-S[0][0],S[1][1]-S[0][1]]}return[0,0,0,0]}get originalClientCenter(){return this.mesh?this.mesh.boundingCenter:[0,0]}set d(S){this.attributes.d=S}get d(){return this.attributes.d}draw(S=[]){super.draw(S);const O=this.mesh;return O&&Object(h.drawTexture)(this,O),S}getBoundingClientRect(){let S=null;return this.mesh&&(S=this.mesh.boundingBox),Object(u.default)(S,this.renderMatrix)}getPathLength(){return this.mesh?this.mesh.getTotalLength():0}getPointAtLength(S){if(this.mesh){const O=this.mesh.getPointAtLength(S);if(O)return[O.x,O.y]}return[0,0]}onPropertyChange(S,O,d){if(super.onPropertyChange(S,O,d),(S==="d"||S==="normalize")&&this.updateContours(),this[T]&&(S==="fillColor"||S==="fillRule")){const{fillColor:g,fillRule:p}=this.attributes;Object(f.setFillColor)(this[T],{color:g,rule:p})}if(this[T]&&(S==="strokeColor"||S==="lineWidth"||S==="lineCap"||S==="lineJoin"||S==="lineDash"||S==="lineDashOffset"||S==="roundSegments")){const{strokeColor:g,lineWidth:p}=this.attributes;if(g&&p>0){const{lineCap:x,lineJoin:E,lineDash:R,lineDashOffset:D,miterLimit:U,roundSegments:M}=this.attributes;Object(f.setStrokeColor)(this[T],{color:g,lineCap:x,lineJoin:E,lineWidth:p,lineDash:R,lineDashOffset:D,miterLimit:U,roundSegments:M})}}this[T]&&S==="clipPath"&&this[T].setClipPath(O),S==="texture"&&Object(h.applyTexture)(this,O)}updateContours(){this.path=new r.Figure2D,this.path.addPath(this.attributes.d),this.attributes.normalize&&this.path.normalize(...this.path.boundingCenter)}}y(w,"Attr",l.default),v.default.registerNode(w,"path")},function(i,e,t){(function(r,n){i.exports=n()})(this,function(){var r=function(){function W(X,B){var N=[],$=!0,J=!1,tt=void 0;try{for(var at=X[Symbol.iterator](),ut;!($=(ut=at.next()).done)&&(N.push(ut.value),!(B&&N.length===B));$=!0);}catch(V){J=!0,tt=V}finally{try{!$&&at.return&&at.return()}finally{if(J)throw tt}}return N}return function(X,B){if(Array.isArray(X))return X;if(Symbol.iterator in Object(X))return W(X,B);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),n=Math.PI*2,s=function(X,B,N,$,J,tt,at){var ut=X.x,V=X.y;ut*=B,V*=N;var Q=$*ut-J*V,ft=J*ut+$*V;return{x:Q+tt,y:ft+at}},c=function(X,B){var N=1.3333333333333333*Math.tan(B/4),$=Math.cos(X),J=Math.sin(X),tt=Math.cos(X+B),at=Math.sin(X+B);return[{x:$-J*N,y:J+$*N},{x:tt+at*N,y:at-tt*N},{x:tt,y:at}]},l=function(X,B,N,$){var J=X*$-B*N<0?-1:1,tt=Math.sqrt(X*X+B*B),at=Math.sqrt(X*X+B*B),ut=X*N+B*$,V=ut/(tt*at);return V>1&&(V=1),V<-1&&(V=-1),J*Math.acos(V)},f=function(X,B,N,$,J,tt,at,ut,V,Q,ft,mt){var yt=Math.pow(J,2),wt=Math.pow(tt,2),ht=Math.pow(ft,2),Nt=Math.pow(mt,2),Dt=yt*wt-yt*Nt-wt*ht;Dt<0&&(Dt=0),Dt/=yt*Nt+wt*ht,Dt=Math.sqrt(Dt)*(at===ut?-1:1);var G=Dt*J/tt*mt,k=Dt*-tt/J*ft,rt=Q*G-V*k+(X+N)/2,nt=V*G+Q*k+(B+$)/2,Y=(ft-G)/J,Z=(mt-k)/tt,C=(-ft-G)/J,L=(-mt-k)/tt,z=l(1,0,Y,Z),K=l(Y,Z,C,L);return ut===0&&K>0&&(K-=n),ut===1&&K<0&&(K+=n),[rt,nt,z,K]},h=function(X){var B=X.px,N=X.py,$=X.cx,J=X.cy,tt=X.rx,at=X.ry,ut=X.xAxisRotation,V=ut===void 0?0:ut,Q=X.largeArcFlag,ft=Q===void 0?0:Q,mt=X.sweepFlag,yt=mt===void 0?0:mt,wt=[];if(tt===0||at===0)return[];var ht=Math.sin(V*n/360),Nt=Math.cos(V*n/360),Dt=Nt*(B-$)/2+ht*(N-J)/2,G=-ht*(B-$)/2+Nt*(N-J)/2;if(Dt===0&&G===0)return[];tt=Math.abs(tt),at=Math.abs(at);var k=Math.pow(Dt,2)/Math.pow(tt,2)+Math.pow(G,2)/Math.pow(at,2);k>1&&(tt*=Math.sqrt(k),at*=Math.sqrt(k));var rt=f(B,N,$,J,tt,at,ft,yt,ht,Nt,Dt,G),nt=r(rt,4),Y=nt[0],Z=nt[1],C=nt[2],L=nt[3],z=Math.max(Math.ceil(Math.abs(L)/(n/4)),1);L/=z;for(var K=0;K<z;K++)wt.push(c(C,L)),C+=L;return wt.map(function(q){var it=s(q[0],tt,at,Nt,ht,Y,Z),ct=it.x,Tt=it.y,Ct=s(q[1],tt,at,Nt,ht,Y,Z),Mt=Ct.x,bt=Ct.y,At=s(q[2],tt,at,Nt,ht,Y,Z),Ot=At.x,Lt=At.y;return{x1:ct,y1:Tt,x2:Mt,y2:bt,x:Ot,y:Lt}})},v={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},u=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function y(W){var X=[];return W.replace(u,function(B,N,$){var J=N.toLowerCase();for($=w($),J=="m"&&$.length>2&&(X.push([N].concat($.splice(0,2))),J="l",N=N=="m"?"l":"L");;){if($.length==v[J])return $.unshift(N),X.push($);if($.length<v[J])throw new Error("malformed path data");X.push([N].concat($.splice(0,v[J])))}}),X}var T=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function w(W){var X=W.match(T);return X?X.map(Number):[]}function I(W){var X=W[0][0],B=W[0][1],N=X,$=B;return W.forEach(function(J){var tt=J[0],at=J[2],ut=J[4],V=J[6],Q=J[1],ft=J[3],mt=J[5],yt=J[7];X=Math.min(X,tt,at,ut,V),B=Math.min(B,Q,ft,mt,yt),N=Math.max(N,tt,at,ut,V),$=Math.max($,Q,ft,mt,yt)}),[X,B,N,$]}function S(W,X){return Math.sqrt(Math.pow(W[0]-X[0],2)+Math.pow(W[1]-X[1],2))+Math.sqrt(Math.pow(W[2]-X[2],2)+Math.pow(W[3]-X[3],2))}function O(W,X){var B=W[0],N=W[2],$=W[4],J=W[6],tt=W[1],at=W[3],ut=W[5],V=W[7],Q=X[0],ft=X[2],mt=X[4],yt=X[6],wt=X[1],ht=X[3],Nt=X[5],Dt=X[7];return Math.sqrt(Math.pow(Q-B,2)+Math.pow(wt-tt,2))+Math.sqrt(Math.pow(ft-N,2)+Math.pow(ht-at,2))+Math.sqrt(Math.pow(mt-$,2)+Math.pow(Nt-ut,2))+Math.sqrt(Math.pow(yt-J,2)+Math.pow(Dt-V,2))}function d(W,X){var B=p(W.length),N=[];B.forEach(function(J){var tt=0,at=0;J.forEach(function(ut){tt+=O(W[ut],X[at++])}),N.push({index:J,distance:tt})}),N.sort(function(J,tt){return J.distance-tt.distance});var $=[];return N[0].index.forEach(function(J){$.push(W[J])}),$}function g(W,X){var B=x(W.length),N=[];B.forEach(function(J){var tt=0;J.forEach(function(at){tt+=S(I(W[at]),I(X[at]))}),N.push({index:J,distance:tt})}),N.sort(function(J,tt){return J.distance-tt.distance});var $=[];return N[0].index.forEach(function(J){$.push(W[J])}),$}function p(W){for(var X=[],B=0;B<W;B++){for(var N=[],$=0;$<W;$++){var J=$+B;J>W-1&&(J-=W),N[J]=$}X.push(N)}return X}function x(W){for(var X=[],B=0;B<W;B++)X.push(B);return E(X)}function E(W){var X=[],B=[];function N($){var J,tt;for(J=0;J<$.length;J++)tt=$.splice(J,1)[0],B.push(tt),$.length==0&&X.push(B.slice()),N($),$.splice(J,0,tt),B.pop();return X}return N(W)}var R={};R.parser=y,R.lerpCurve=function(W,X,B){return R.lerpPoints(W[0],W[1],X[0],X[1],B).concat(R.lerpPoints(W[2],W[3],X[2],X[3],B)).concat(R.lerpPoints(W[4],W[5],X[4],X[5],B)).concat(R.lerpPoints(W[6],W[7],X[6],X[7],B))},R.lerpPoints=function(W,X,B,N,$){return[W+(B-W)*$,X+(N-X)*$]},R.q2b=function(W,X,B,N,$,J){return[W,X,(W+2*B)/3,(X+2*N)/3,($+2*B)/3,(J+2*N)/3,$,J]},R.path2shapes=function(W){for(var X=R.parser(W),B=0,N=0,$=0,J=X.length,tt=[],at=null,ut=void 0,V=void 0,Q=void 0,ft=void 0,mt=void 0,yt=void 0,wt=void 0;$<J;$++){var ht=X[$],Nt=ht[0],Dt=X[$-1];switch(Nt){case"m":mt=tt.length,tt[mt]=[],at=tt[mt],B=B+ht[1],N=N+ht[2];break;case"M":mt=tt.length,tt[mt]=[],at=tt[mt],B=ht[1],N=ht[2];break;case"l":at.push([B,N,B,N,B,N,B+ht[1],N+ht[2]]),B+=ht[1],N+=ht[2];break;case"L":at.push([B,N,ht[1],ht[2],ht[1],ht[2],ht[1],ht[2]]),B=ht[1],N=ht[2];break;case"h":at.push([B,N,B,N,B,N,B+ht[1],N]),B+=ht[1];break;case"H":at.push([B,N,ht[1],N,ht[1],N,ht[1],N]),B=ht[1];break;case"v":at.push([B,N,B,N,B,N,B,N+ht[1]]),N+=ht[1];break;case"V":at.push([B,N,B,ht[1],B,ht[1],B,ht[1]]),N=ht[1];break;case"C":at.push([B,N,ht[1],ht[2],ht[3],ht[4],ht[5],ht[6]]),B=ht[5],N=ht[6];break;case"S":Dt[0]==="C"||Dt[0]==="c"?at.push([B,N,B+Dt[5]-Dt[3],N+Dt[6]-Dt[4],ht[1],ht[2],ht[3],ht[4]]):(Dt[0]==="S"||Dt[0]==="s")&&at.push([B,N,B+Dt[3]-Dt[1],N+Dt[4]-Dt[2],ht[1],ht[2],ht[3],ht[4]]),B=ht[3],N=ht[4];break;case"c":at.push([B,N,B+ht[1],N+ht[2],B+ht[3],N+ht[4],B+ht[5],N+ht[6]]),B=B+ht[5],N=N+ht[6];break;case"s":Dt[0]==="C"||Dt[0]==="c"?at.push([B,N,B+Dt[5]-Dt[3],N+Dt[6]-Dt[4],B+ht[1],N+ht[2],B+ht[3],N+ht[4]]):(Dt[0]==="S"||Dt[0]==="s")&&at.push([B,N,B+Dt[3]-Dt[1],N+Dt[4]-Dt[2],B+ht[1],N+ht[2],B+ht[3],N+ht[4]]),B=B+ht[3],N=N+ht[4];break;case"a":yt=h({rx:ht[1],ry:ht[2],px:B,py:N,xAxisRotation:ht[3],largeArcFlag:ht[4],sweepFlag:ht[5],cx:B+ht[6],cy:N+ht[7]}),wt=yt[yt.length-1],yt.forEach(function(G,k){k===0?at.push([B,N,G.x1,G.y1,G.x2,G.y2,G.x,G.y]):at.push([yt[k-1].x,yt[k-1].y,G.x1,G.y1,G.x2,G.y2,G.x,G.y])}),B=wt.x,N=wt.y;break;case"A":yt=h({rx:ht[1],ry:ht[2],px:B,py:N,xAxisRotation:ht[3],largeArcFlag:ht[4],sweepFlag:ht[5],cx:ht[6],cy:ht[7]}),wt=yt[yt.length-1],yt.forEach(function(G,k){k===0?at.push([B,N,G.x1,G.y1,G.x2,G.y2,G.x,G.y]):at.push([yt[k-1].x,yt[k-1].y,G.x1,G.y1,G.x2,G.y2,G.x,G.y])}),B=wt.x,N=wt.y;break;case"Q":at.push(R.q2b(B,N,ht[1],ht[2],ht[3],ht[4])),B=ht[3],N=ht[4];break;case"q":at.push(R.q2b(B,N,B+ht[1],N+ht[2],ht[3]+B,ht[4]+N)),B+=ht[3],N+=ht[4];break;case"T":Dt[0]==="Q"||Dt[0]==="q"?(Q=B+Dt[3]-Dt[1],ft=N+Dt[4]-Dt[2],at.push(R.q2b(B,N,Q,ft,ht[1],ht[2]))):(Dt[0]==="T"||Dt[0]==="t")&&(at.push(R.q2b(B,N,B+B-Q,N+N-ft,ht[1],ht[2])),Q=B+B-Q,ft=N+N-ft),B=ht[1],N=ht[2];break;case"t":Dt[0]==="Q"||Dt[0]==="q"?(Q=B+Dt[3]-Dt[1],ft=N+Dt[4]-Dt[2],at.push(R.q2b(B,N,Q,ft,B+ht[1],N+ht[2]))):(Dt[0]==="T"||Dt[0]==="t")&&(at.push(R.q2b(B,N,B+B-Q,N+N-ft,B+ht[1],N+ht[2])),Q=B+B-Q,ft=N+N-ft),B+=ht[1],N+=ht[2];break;case"Z":ut=at[0][0],V=at[0][1],at.push([B,N,ut,V,ut,V,ut,V]);break;case"z":ut=at[0][0],V=at[0][1],at.push([B,N,ut,V,ut,V,ut,V]);break}}return tt},R._upCurves=function(W,X){for(var B=0,N=0,$=W.length;B<X;B++)W.push(W[N].slice(0)),N++,N>$-1&&(N-=$)};function D(W,X,B,N,$,J,tt,at,ut){return{left:U(W,X,B,N,$,J,tt,at,ut),right:U(tt,at,$,J,B,N,W,X,1-ut,!0)}}function U(W,X,B,N,$,J,tt,at,ut,V){var Q=(B-W)*ut+W,ft=(N-X)*ut+X,mt=($-B)*ut+B,yt=(J-N)*ut+N,wt=(tt-$)*ut+$,ht=(at-J)*ut+J,Nt=(mt-Q)*ut+Q,Dt=(yt-ft)*ut+ft,G=(wt-mt)*ut+mt,k=(ht-yt)*ut+yt,rt=(G-Nt)*ut+Nt,nt=(k-Dt)*ut+Dt;return V?[rt,nt,Nt,Dt,Q,ft,W,X]:[W,X,Q,ft,Nt,Dt,rt,nt]}R._splitCurves=function(W,X){for(var B=0,N=0;B<X;B++){var $=W[N],J=D($[0],$[1],$[2],$[3],$[4],$[5],$[6],$[7],.5);W.splice(N,1),W.splice(N,0,J.left,J.right),N+=2,N>=W.length-1&&(N=0)}};function M(W,X){for(var B=function(J){var tt=W[W.length-1],at=[];tt.forEach(function(ut){at.push(ut.slice(0))}),W.push(at)},N=0;N<X;N++)B()}return R.lerp=function(W,X,B){return R._lerp(R.path2shapes(W),R.path2shapes(X),B)},R.MIM_CURVES_COUNT=100,R._preprocessing=function(W,X){var B=W.length,N=X.length,$=JSON.parse(JSON.stringify(W)),J=JSON.parse(JSON.stringify(X));return B>N?M(J,B-N):B<N&&M($,N-B),$=g($,J),$.forEach(function(tt,at){var ut=tt.length,V=J[at].length;ut>V?ut<R.MIM_CURVES_COUNT?(R._splitCurves(tt,R.MIM_CURVES_COUNT-ut),R._splitCurves(J[at],R.MIM_CURVES_COUNT-V)):R._splitCurves(J[at],ut-V):ut<V&&(V<R.MIM_CURVES_COUNT?(R._splitCurves(tt,R.MIM_CURVES_COUNT-ut),R._splitCurves(J[at],R.MIM_CURVES_COUNT-V)):R._splitCurves(tt,V-ut))}),$.forEach(function(tt,at){$[at]=d(tt,J[at])}),[$,J]},R._lerp=function(W,X,B){var N=[];return W.forEach(function($,J){var tt=[];$.forEach(function(at,ut){tt.push(R.lerpCurve(at,X[J][ut],B))}),N.push(tt)}),N},R.animate=function(W){var X=R.path2shapes(W.from),B=R.path2shapes(W.to),N=R._preprocessing(X,B),$=new Date,J=W.end||function(){},tt=W.progress||function(){},at=W.begin||function(){},ut=W.easing||function(yt){return yt},V=null,Q=null,ft=W.time;at(X);var mt=function yt(){var wt=new Date-$;if(wt>=ft){Q=B,tt(Q,1),J(Q),cancelAnimationFrame(V);return}var ht=ut(wt/ft);Q=R._lerp(N[0],N[1],ht),tt(Q,ht),V=requestAnimationFrame(yt)};mt()},R})},function(i,e,t){t.r(e),t.d(e,"default",function(){return h});var r=t(71),n=t(221),s=t(72);t(1).glMatrix.setMatrixArrayType(Array);const c=Symbol.for("spritejs_setAttributeDefault"),l=Symbol.for("spritejs_setAttribute"),f=Symbol.for("spritejs_getAttribute");class h extends r.default{constructor(u){super(u),this[c]({d:"",normalize:!1,fillColor:void 0,fillRule:"nonzero",strokeColor:void 0,lineWidth:1,lineJoin:"miter",lineCap:"butt",roundSegments:20,lineDash:void 0,lineDashOffset:0,miterLimit:10,texture:void 0,textureRect:void 0,textureRepeat:!1,sourceRect:void 0,clipPath:void 0})}get d(){return this[f]("d")}set d(u){this[l]("d",u)}get normalize(){return this[f]("normalize")}set normalize(u){this[l]("normalize",!!u)}get fillColor(){return this[f]("fillColor")}set fillColor(u){this[l]("fillColor",Object(n.parseColor)(u))}get fillRule(){return this[f]("fillRule")}set fillRule(u){if(u!=null&&u!=="nonzero"&&u!=="evenodd")throw new TypeError("Invalid fill rule.");this[l]("fillRule",u)}get strokeColor(){return this[f]("strokeColor")}set strokeColor(u){this[l]("strokeColor",Object(n.parseColor)(u))}get lineWidth(){return this[f]("lineWidth")}set lineWidth(u){this[l]("lineWidth",Object(s.toNumber)(u))}get lineJoin(){return this[f]("lineJoin")}set lineJoin(u){if(u!=null&&u!=="miter"&&u!=="bevel"&&u!=="round")throw new TypeError("Invalid lineJoin type.");this[l]("lineJoin",u)}get lineCap(){return this[f]("lineCap")}set lineCap(u){if(u!=null&&u!=="butt"&&u!=="square"&&u!=="round")throw new TypeError("Invalid lineCap type.");this[l]("lineCap",u)}get lineDash(){return this[f]("lineDash")}set lineDash(u){u=Object(s.toArray)(u,!0),u!=null&&!Array.isArray(u)&&(u=[u]),this[l]("lineDash",u?u.map(s.toNumber):null)}get lineDashOffset(){return this[f]("lineDashOffset")}set lineDashOffset(u){this[l]("lineDashOffset",Object(s.toNumber)(u))}get miterLimit(){return this[f]("miterLimit")}set miterLimit(u){this[l]("miterLimit",Object(s.toNumber)(u))}get roundSegments(){return this[f]("roundSegments")}set roundSegments(u){this[l]("roundSegments",u)}get texture(){return this[f]("texture")}set texture(u){this[l]("texture",u)}get textureRect(){return this[f]("textureRect")}set textureRect(u){this[l]("textureRect",u)}get sourceRect(){return this[f]("sourceRect")}set sourceRect(u){this[l]("sourceRect",u)}get textureRepeat(){return this[f]("textureRepeat")}set textureRepeat(u){this[l]("textureRepeat",!!u)}get clipPath(){return this[f]("clipPath")}set clipPath(u){this[l]("clipPath",u)}}},function(i,e,t){t.r(e),t.d(e,"default",function(){return l});var r=t(226),n=t(213),s=t(230);t(1).glMatrix.setMatrixArrayType(Array);function c(f,h,v){return h in f?Object.defineProperty(f,h,{value:v,enumerable:!0,configurable:!0,writable:!0}):f[h]=v,f}class l extends r.default{get isVisible(){const{width:h,height:v}=this.attributes;return h>0&&v>0&&super.isVisible}}c(l,"Attr",s.default),n.default.registerNode(l,"rect")},function(i,e,t){t.r(e),t.d(e,"default",function(){return v});var r=t(228),n=t(72);t(1).glMatrix.setMatrixArrayType(Array);const s=Symbol.for("spritejs_setAttributeDefault"),c=Symbol.for("spritejs_setAttribute"),l=Symbol.for("spritejs_getAttribute"),f=Symbol.for("spritejs_declareAlias");function h(u){const{width:y,height:T}=u;return`M0 0L${y} 0L${y} ${T}L0 ${T}Z`}class v extends r.default{constructor(y){super(y),this[s]({width:0,height:0}),this[f]("size")}get d(){return this[l]("d")}set d(y){}get width(){return this[l]("width")}set width(y){if(y=Object(n.toNumber)(y),this[c]("width",y)){const T=h(this);this[c]("d",T)}}get height(){return this[l]("height")}set height(y){if(y=Object(n.toNumber)(y),this[c]("height",y)){const T=h(this);this[c]("d",T)}}get size(){return[this.width,this.height]}set size(y){y=Object(n.toArray)(y),Array.isArray(y)||(y=[y,y]),this.width=y[0],this.height=y[1]}}},function(i,e,t){t.r(e),t.d(e,"default",function(){return l});var r=t(232),n=t(213),s=t(235);t(1).glMatrix.setMatrixArrayType(Array);function c(f,h,v){return h in f?Object.defineProperty(f,h,{value:v,enumerable:!0,configurable:!0,writable:!0}):f[h]=v,f}class l extends r.default{get isVisible(){const{sides:h}=this.attributes;return h[0]>0&&h[1]>0&&super.isVisible}}c(l,"Attr",s.default),n.default.registerNode(l,"triangle")},function(i,e,t){t.r(e),t.d(e,"default",function(){return l});var r=t(226),n=t(213),s=t(233);t(1).glMatrix.setMatrixArrayType(Array);function c(f,h,v){return h in f?Object.defineProperty(f,h,{value:v,enumerable:!0,configurable:!0,writable:!0}):f[h]=v,f}class l extends r.default{get isVisible(){const{points:h}=this.attributes;return h.length>0&&super.isVisible}}c(l,"Attr",s.default),n.default.registerNode(l,"polyline")},function(i,e,t){t.r(e),t.d(e,"default",function(){return u});var r=t(228),n=t(72),s=t(234);t(1).glMatrix.setMatrixArrayType(Array);const c=Symbol.for("spritejs_setAttributeDefault"),l=Symbol.for("spritejs_setAttribute"),f=Symbol.for("spritejs_getAttribute"),h=Symbol.for("spritejs_declareAlias");function v(y){const{points:T,smooth:w,smoothRange:I,close:S}=y,O=[];for(let g=0;g<T.length;g+=2)O.push([T[g],T[g+1]]);let d="";return w?d=Object(s.makeSmoothCurveLine)(O,I):O.length&&(d=`M${O.map(g=>g.join(" ")).join("L")}`),d&&S&&(d+="Z"),d}class u extends r.default{constructor(T){super(T),this[c]({points:[],smooth:!1,smoothRange:[0],closeType:"none"}),this[h]("close")}get d(){return this[f]("d")}set d(T){}get close(){return this.closeType!=="none"}set close(T){T=T?"normal":"none",this.closeType=T}get closeType(){return this[f]("closeType")}set closeType(T){if(T!=null&&T!=="none"&&T!=="normal")throw new TypeError("Invalid closeType type.");if(this[l]("closeType",T)){const w=v(this);this[l]("d",w)}}get smooth(){return this[f]("smooth")}set smooth(T){if(this[l]("smooth",T)){const w=v(this);this[l]("d",w)}}get smoothRange(){return this[f]("smoothRange")}set smoothRange(T){if(T&&!Array.isArray(T)&&(T=[T]),this[l]("smoothRange",T)&&this.smooth){const w=v(this);this[l]("d",w)}}get points(){return this[f]("points")}set points(T){if(T=Object(n.toArray)(T),Array.isArray(T)&&(T=T.reduce((w,I)=>Array.isArray(I)?[...w,...I.map(S=>Object(n.toNumber)(S))]:[...w,Object(n.toNumber)(I)],[])),this[l]("points",T)){const w=v(this);this[l]("d",w)}}}},function(i,e,t){t.r(e),t.d(e,"makeSmoothCurveLine",function(){return r}),t(1).glMatrix.setMatrixArrayType(Array);function r(n,s=[0]){function c(h,v=.168,u=.168){let y,T,w,I;if((n[h].x===n[h+1].x||n[h].y===n[h+1].y)&&(v=0,u=0),h<1?(y=n[0].x+(n[1].x-n[0].x)*v,T=n[0].y+(n[1].y-n[0].y)*v):(y=n[h].x+(n[h+1].x-n[h-1].x)*v,T=n[h].y+(n[h+1].y-n[h-1].y)*v),h>n.length-3){const S=n.length-1;w=n[S].x-(n[S].x-n[S-1].x)*u,I=n[S].y-(n[S].y-n[S-1].y)*u}else w=n[h+1].x-(n[h+2].x-n[h].x)*u,I=n[h+1].y-(n[h+2].y-n[h].y)*u;return[{x:y,y:T},{x:w,y:I}]}n=n.map(([h,v])=>({x:h,y:v}));let l="",f=0;return n.forEach((h,v)=>{if(v===0)l+=`M${h.x} ${h.y}`;else{for(;v>s[f];)f++;if(f%2){const[u,y]=c(v-1);l+=`C${[u.x,u.y,y.x,y.y,h.x,h.y].join(" ")}`}else l+=`L${h.x} ${h.y}`}}),l}},function(i,e,t){t.r(e),t.d(e,"default",function(){return h});var r=t(233),n=t(72);t(1).glMatrix.setMatrixArrayType(Array);const s=Symbol.for("spritejs_setAttributeDefault"),c=Symbol.for("spritejs_setAttribute"),l=Symbol.for("spritejs_getAttribute");function f(v){const[u,y]=v.sides;let T=v.angle%360;return T<0&&(T+=360),T=Math.PI*T/180,[0,0,u,0,y*Math.cos(T),y*Math.sin(T)]}class h extends r.default{constructor(u){super(u),this[s]({sides:[0,0],angle:60,closeType:"normal"})}get points(){return super.points}set points(u){}get sides(){return this[l]("sides")}set sides(u){if(u=Object(n.toArray)(u,!0),u!=null&&!Array.isArray(u)&&(u=[u,u]),this[c]("sides",u)){const y=f(this);super.points=y}}get angle(){return this[l]("angle")}set angle(u){if(u=Object(n.toNumber)(u),this[c]("angle",u)){const y=f(this);super.points=y}}}},function(i,e,t){t.r(e),t.d(e,"default",function(){return l});var r=t(232),n=t(213),s=t(237);t(1).glMatrix.setMatrixArrayType(Array);function c(f,h,v){return h in f?Object.defineProperty(f,h,{value:v,enumerable:!0,configurable:!0,writable:!0}):f[h]=v,f}class l extends r.default{get isVisible(){const{sides:h}=this.attributes;return h[0]>0&&h[1]>0&&super.isVisible}}c(l,"Attr",s.default),n.default.registerNode(l,"parallel")},function(i,e,t){t.r(e),t.d(e,"default",function(){return h});var r=t(233),n=t(72);t(1).glMatrix.setMatrixArrayType(Array);const s=Symbol.for("spritejs_setAttributeDefault"),c=Symbol.for("spritejs_setAttribute"),l=Symbol.for("spritejs_getAttribute");function f(v){const[u,y]=v.sides;let T=v.angle%360;T<0&&(T+=360),T=Math.PI*T/180;const w=y*Math.cos(T),I=y*Math.sin(T);return[0,0,u,0,w+u,I,w,I]}class h extends r.default{constructor(u){super(u),this[s]({sides:[0,0],angle:90,closeType:"normal"})}get points(){return super.points}set points(u){}get sides(){return this[l]("sides")}set sides(u){if(u=Object(n.toArray)(u,!0),u!=null&&!Array.isArray(u)&&(u=[u,u]),this[c]("sides",u)){const y=f(this);super.points=y}}get angle(){return this[l]("angle")}set angle(u){if(u=Object(n.toNumber)(u),this[c]("angle",u)){const y=f(this);super.points=y}}}},function(i,e,t){t.r(e),t.d(e,"default",function(){return l});var r=t(232),n=t(213),s=t(239);t(1).glMatrix.setMatrixArrayType(Array);function c(f,h,v){return h in f?Object.defineProperty(f,h,{value:v,enumerable:!0,configurable:!0,writable:!0}):f[h]=v,f}class l extends r.default{}c(l,"Attr",s.default),n.default.registerNode(l,"regular")},function(i,e,t){t.r(e),t.d(e,"default",function(){return h});var r=t(233),n=t(72);t(1).glMatrix.setMatrixArrayType(Array);const s=Symbol.for("spritejs_setAttributeDefault"),c=Symbol.for("spritejs_setAttribute"),l=Symbol.for("spritejs_getAttribute");function f(v){const{edges:u,radius:y,offsetAngle:T}=v,w=Math.PI*T/180-.5*Math.PI;if(u<3||y<=0)return[];const I=[];for(let S=0;S<u;S++){const O=S*2*Math.PI/u+w,d=y*Math.cos(O),g=y*Math.sin(O);I.push(d,g)}return I}class h extends r.default{constructor(u){super(u),this[s]({edges:3,radius:0,offsetAngle:0,closeType:"normal"})}get points(){return super.points}set points(u){}get edges(){return this[l]("edges")}set edges(u){if(u=Object(n.toNumber)(u),this[c]("edges",u)){const y=f(this);super.points=y}}get radius(){return this[l]("radius")}set radius(u){if(u=Object(n.toNumber)(u),this[c]("radius",u)){const y=f(this);super.points=y}}get offsetAngle(){return this[l]("offsetAngle")}set offsetAngle(u){if(u=Object(n.toNumber)(u),this[c]("offsetAngle",u)){const y=f(this);super.points=y}}}},function(i,e,t){t.r(e),t.d(e,"default",function(){return l});var r=t(232),n=t(213),s=t(241);t(1).glMatrix.setMatrixArrayType(Array);function c(f,h,v){return h in f?Object.defineProperty(f,h,{value:v,enumerable:!0,configurable:!0,writable:!0}):f[h]=v,f}class l extends r.default{}c(l,"Attr",s.default),n.default.registerNode(l,"star")},function(i,e,t){t.r(e),t.d(e,"default",function(){return h});var r=t(233),n=t(72);t(1).glMatrix.setMatrixArrayType(Array);const s=Symbol.for("spritejs_setAttributeDefault"),c=Symbol.for("spritejs_setAttribute"),l=Symbol.for("spritejs_getAttribute");function f(v){const{angles:u,innerRadius:y,outerRadius:T,offsetAngle:w}=v,I=Math.PI*w/180-.5*Math.PI;if(u<3||y<=0||T<=0)return[];const S=[];for(let O=0;O<u*2;O++){const d=O*Math.PI/u+I,g=O%2?y:T,p=g*Math.cos(d),x=g*Math.sin(d);S.push(p,x)}return S}class h extends r.default{constructor(u){super(u),this[s]({angles:5,innerRadius:0,outerRadius:0,offsetAngle:0,closeType:"normal"})}get points(){return super.points}set points(u){}get angles(){return this[l]("angles")}set angles(u){if(u=Object(n.toNumber)(u),this[c]("angles",u)){const y=f(this);super.points=y}}get innerRadius(){return this[l]("innerRadius")}set innerRadius(u){if(u=Object(n.toNumber)(u),this[c]("innerRadius",u)){const y=f(this);super.points=y}}get outerRadius(){return this[l]("outerRadius")}set outerRadius(u){if(u=Object(n.toNumber)(u),this[c]("outerRadius",u)){const y=f(this);super.points=y}}get radius(){return[this.innerRadius,this.outerRadius]}set radius(u){u=Object(n.toArray)(u,!0),Array.isArray(u)||(u=[u,u]),this.innerRadius=u[0],this.outerRadius=u[1]}get offsetAngle(){return this[l]("offsetAngle")}set offsetAngle(u){if(u=Object(n.toNumber)(u),this[c]("offsetAngle",u)){const y=f(this);super.points=y}}}},function(i,e,t){t.r(e),t.d(e,"default",function(){return l});var r=t(226),n=t(213),s=t(243);t(1).glMatrix.setMatrixArrayType(Array);function c(f,h,v){return h in f?Object.defineProperty(f,h,{value:v,enumerable:!0,configurable:!0,writable:!0}):f[h]=v,f}class l extends r.default{get isVisible(){const{radiusX:h,radiusY:v,startAngle:u,endAngle:y}=this.attributes;return h>0&&v>0&&u!==y&&super.isVisible}}c(l,"Attr",s.default),n.default.registerNode(l,"ellipse")},function(i,e,t){t.r(e),t.d(e,"default",function(){return u});var r=t(12),n=t(228),s=t(72);t(1).glMatrix.setMatrixArrayType(Array);const c=Symbol.for("spritejs_setAttributeDefault"),l=Symbol.for("spritejs_setAttribute"),f=Symbol.for("spritejs_getAttribute"),h=Symbol.for("spritejs_declareAlias");function v(y){const{radiusX:T,radiusY:w,startAngle:I,endAngle:S,direction:O,closeType:d}=y,g=O==="anitclockwise",p=new r.Figure2D;return d==="sector"&&p.moveTo(0,0),p.ellipse(0,0,T,w,0,Math.PI*I/180,Math.PI*S/180,g),d!=="none"&&p.closePath(),p.path.reduce((R,D)=>R+D.join(" "),"")}class u extends n.default{constructor(T){super(T),this[c]({radiusX:0,radiusY:0,startAngle:0,endAngle:360,direction:"clockwise",closeType:"none"}),this[h]("radius","angle")}get d(){return this[f]("d")}set d(T){}get radiusX(){return this[f]("radiusX")}set radiusX(T){if(T=Object(s.toNumber)(T),this[l]("radiusX",T)){const w=v(this);this[l]("d",w)}}get radiusY(){return this[f]("radiusY")}set radiusY(T){if(T=Object(s.toNumber)(T),this[l]("radiusY",T)){const w=v(this);this[l]("d",w)}}get radius(){return[this.radiusX,this.radiusY]}set radius(T){T=Object(s.toArray)(T,!0),Array.isArray(T)||(T=[T,T]),this.radiusX=T[0],this.radiusY=T[1]}get angle(){return[this.startAngle,this.endAngle]}set angle(T){T=Object(s.toArray)(T),Array.isArray(T)||(T=[T,T]),this.startAngle=T[0],this.endAngle=T[1]}get direction(){return this[f]("direction")}set direction(T){if(T!=null&&T!=="clockwise"&&T!=="anticlockwise")throw new TypeError("Invalid direction type.");this[l]("direction",T)}get startAngle(){return this[f]("startAngle")}set startAngle(T){if(T=Object(s.toNumber)(T),this[l]("startAngle",T)){const w=v(this);this[l]("d",w)}}get endAngle(){return this[f]("endAngle")}set endAngle(T){if(T=Object(s.toNumber)(T),this[l]("endAngle",T)){const w=v(this);this[l]("d",w)}}get closeType(){return this[f]("closeType")}set closeType(T){if(T!=null&&T!=="none"&&T!=="sector"&&T!=="normal")throw new TypeError("Invalid closeType type.");if(this[l]("closeType",T)){const w=v(this);this[l]("d",w)}}}},function(i,e,t){t.r(e),t.d(e,"default",function(){return l});var r=t(242),n=t(213),s=t(245);t(1).glMatrix.setMatrixArrayType(Array);function c(f,h,v){return h in f?Object.defineProperty(f,h,{value:v,enumerable:!0,configurable:!0,writable:!0}):f[h]=v,f}class l extends r.default{}c(l,"Attr",s.default),n.default.registerNode(l,"arc")},function(i,e,t){t.r(e),t.d(e,"default",function(){return s});var r=t(243),n=t(72);t(1).glMatrix.setMatrixArrayType(Array);class s extends r.default{get radius(){return super.radiusX}set radius(l){l=Object(n.toNumber)(l),super.radiusX=l,super.radiusY=l}}},function(i,e,t){t.r(e),t.d(e,"default",function(){return l});var r=t(226),n=t(213),s=t(247);t(1).glMatrix.setMatrixArrayType(Array);function c(f,h,v){return h in f?Object.defineProperty(f,h,{value:v,enumerable:!0,configurable:!0,writable:!0}):f[h]=v,f}class l extends r.default{get isVisible(){const{innerRadius:h,outerRadius:v,startAngle:u,endAngle:y}=this.attributes;return(h>0||v>0)&&u!==y&&super.isVisible}}c(l,"Attr",s.default),n.default.registerNode(l,"ring")},function(i,e,t){t.r(e),t.d(e,"default",function(){return u});var r=t(12),n=t(228),s=t(72);t(1).glMatrix.setMatrixArrayType(Array);const c=Symbol.for("spritejs_setAttributeDefault"),l=Symbol.for("spritejs_setAttribute"),f=Symbol.for("spritejs_getAttribute"),h=Symbol.for("spritejs_declareAlias");function v(y){let{innerRadius:T,outerRadius:w,startAngle:I,endAngle:S}=y;const O=new r.Figure2D;if(I=Math.PI*I/180,S=Math.PI*S/180,T>w&&([T,w]=[w,T]),T<=0&&O.moveTo(0,0),O.arc(0,0,w,I,S,!1),T>0){const p=Math.PI*2;S<I&&(S=I+p+(S-I)%p),S-I>=p&&(S=I+p-1e-6),O.arc(0,0,T,S,I,!0)}return O.closePath(),O.path.reduce((p,x)=>p+x.join(" "),"")}class u extends n.default{constructor(T){super(T),this[c]({innerRadius:0,outerRadius:0,startAngle:0,endAngle:360}),this[h]("radius","angle")}get d(){return this[f]("d")}set d(T){}get innerRadius(){return this[f]("innerRadius")}set innerRadius(T){if(T=Object(s.toNumber)(T),this[l]("innerRadius",T)){const w=v(this);this[l]("d",w)}}get outerRadius(){return this[f]("outerRadius")}set outerRadius(T){if(T=Object(s.toNumber)(T),this[l]("outerRadius",T)){const w=v(this);this[l]("d",w)}}get radius(){return[this.innerRadius,this.outerRadius]}set radius(T){T=Object(s.toArray)(T,!0),Array.isArray(T)||(T=[T,T]),this.innerRadius=T[0],this.outerRadius=T[1]}get startAngle(){return this[f]("startAngle")}set startAngle(T){if(T=Object(s.toNumber)(T),this[l]("startAngle",T)){const w=v(this);this[l]("d",w)}}get endAngle(){return this[f]("endAngle")}set endAngle(T){if(T=Object(s.toNumber)(T),this[l]("endAngle",T)){const w=v(this);this[l]("d",w)}}get angle(){return[this.startAngle,this.endAngle]}set angle(T){T=Object(s.toArray)(T),Array.isArray(T)||(T=[T,T]),this.startAngle=T[0],this.endAngle=T[1]}}},function(i,e,t){t.r(e),t.d(e,"default",function(){return w});var r=t(12),n=t(218),s=t(219),c=t(249),l=t(213);t(1).glMatrix.setMatrixArrayType(Array);function f(I,S,O){return S in I?Object.defineProperty(I,S,{value:O,enumerable:!0,configurable:!0,writable:!0}):I[S]=O,I}const h=Symbol("textImage"),v=Symbol("textImageTask"),u=Symbol("textureContext"),y=Symbol("updateTextureRect"),T=Symbol("textCanvas");class w extends s.default{constructor(S={}){typeof S=="string"&&(S={text:S}),super(S)}get contentSize(){let[S,O]=super.contentSize;const{width:d,height:g}=this.attributes;if(d==null||g==null){const p=this[h];p&&(d==null&&(S=p.rect[2]),g==null&&(O=p.rect[3]))}return[S,O]}get text(){return this.attributes.text}set text(S){this.attributes.text=S}get textContent(){return this.attributes.text}set textContent(S){this.attributes.text=S}get textImage(){return this[h]||{}}get textImageReady(){return this[v]||Promise.resolve()}draw(S){super.draw(S);const O=this.mesh;if(O){const d=this[h];if(d){let g=O.texture;if(!g||this[u]&&this[u]!==this.renderer||d.needsUpdate?(d.needsUpdate=!1,Object(n.deleteTexture)(d.image,this.renderer),g=Object(n.createTexture)(d.image,this.renderer),this[y]=!0):g=O.uniforms.u_texSampler,this[y]){const[p,x]=d.rect.slice(2),[E,R]=this.contentSize,D=this.attributes.textAlign,U=this.attributes.verticalAlign;let M=0;D==="center"?M=(E-p)/2:(D==="right"||D==="end")&&(M=E-p);const W=this.attributes.fontSize,X=this.attributes.lineHeight;let B=0;U==="top"?B=(W-X)/2:U==="bottom"&&(B=(X-W)/2);const{paddingLeft:N,paddingTop:$}=this.attributes,{borderWidth:J}=this.attributes;M+=N+J,B+=$+J;const{anchorX:tt,anchorY:at}=this.attributes;M-=this.offsetSize[0]*tt,B-=this.offsetSize[1]*at,O.setTexture(g,{rect:[M,B,p,x]}),this[y]=!1,this[u]=this.renderer}}}return S}onPropertyChange(S,O,d){S==="text"||S==="fontSize"||S==="fontFamily"||S==="fontStyle"||S==="fontVariant"||S==="fontWeight"||S==="fontStretch"||S==="lineHeight"||S==="strokeColor"||S==="fillColor"||S==="strokeWidth"?this.updateText():((S==="textAlign"||S==="verticalAlign")&&(this[y]=!0),super.onPropertyChange(S,O,d))}updateContours(){super.updateContours(),this[y]=!0}updateText(){this[v]||(this[v]=Promise.resolve().then(()=>{this[v]=null;const{text:S,font:O,fillColor:d,strokeColor:g,strokeWidth:p}=this.attributes,x=this.layer?this.layer.displayRatio:1;return this[T]=this[T]||r.ENV.createCanvas(1,1),this[h]=r.ENV.createText(S,{font:O,fillColor:d,strokeColor:g,strokeWidth:p,parseFont:r.parseFont,ratio:x,textCanvas:this[T]}),this[h].needsUpdate=!0,this.updateContours(),this.forceUpdate(),this[h]}))}}f(w,"Attr",c.default),l.default.registerNode(w,"label")},function(i,e,t){t.r(e),t.d(e,"default",function(){return u});var r=t(12),n=t(72),s=t(221),c=t(220);t(1).glMatrix.setMatrixArrayType(Array);const l=Symbol.for("spritejs_setAttributeDefault"),f=Symbol.for("spritejs_setAttribute"),h=Symbol.for("spritejs_getAttribute"),v=Symbol.for("spritejs_declareAlias");class u extends c.default{constructor(T){super(T),this[l]({text:"",fontSize:16,fontFamily:"Helvetica,Arial,sans-serif",fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",fontStretch:"normal",lineHeight:"",textAlign:"left",strokeColor:void 0,strokeWidth:1,fillColor:void 0,verticalAlign:"middle"}),this[v]("font")}get text(){return this[h]("text")||" "}set text(T){this[f]("text",T)}get fontSize(){return this[h]("fontSize")}set fontSize(T){this[f]("fontSize",Object(n.toNumber)(T))}get fontFamily(){return this[h]("fontFamily")}set fontFamily(T){this[f]("fontFamily",T)}get fontStyle(){return this[h]("fontStyle")}set fontStyle(T){this[f]("fontStyle",T)}get fontVariant(){return this[h]("fontVariant")}set fontVariant(T){this[f]("fontVariant",T)}get fontWeight(){return this[h]("fontWeight")}set fontWeight(T){this[f]("fontWeight",T)}get fontStretch(){return this[h]("fontStretch")}set fontStretch(T){this[f]("fontStretch",T)}get lineHeight(){return this[h]("lineHeight")||this.fontSize}set lineHeight(T){this[f]("lineHeight",Object(n.toNumber)(T))}get textAlign(){return this[h]("textAlign")}set textAlign(T){this[f]("textAlign",T)}get strokeColor(){return this[h]("strokeColor")}set strokeColor(T){this[f]("strokeColor",Object(s.parseColor)(T))}get strokeWidth(){return this[h]("strokeWidth")}set strokeWidth(T){this[f]("strokeWidth",Object(n.toNumber)(T))}get verticalAlign(){return this[h]("verticalAlign")}set verticalAlign(T){this[f]("verticalAlign",T)}get fillColor(){return this[h]("fillColor")}set fillColor(T){this[f]("fillColor",Object(s.parseColor)(T))}get font(){const{fontStyle:T,fontVariant:w,fontWeight:I,fontStretch:S,fontSize:O,lineHeight:d,fontFamily:g}=this;return`${T} ${w} ${I} ${S} ${O}px/${d}px ${g}`}set font(T){if(T==null)this.fontStyle=null,this.fontVariant=null,this.fontWeight=null,this.fontStretch=null,this.fontSize=null,this.lineHeight=null,this.fontFamily=null;else{const w=Object(r.parseFont)(T);this.fontStyle=w.style,this.fontVariant=w.variant,this.fontWeight=w.weight,this.fontStretch=w.stretch,this.fontSize=Object(n.toNumber)(`${w.size}${w.unit}`),w.lineHeight&&(this.lineHeight=w.pxLineHeight),this.fontFamily=w.family}}}},function(i,e,t){t.r(e),t.d(e,"default",function(){return T});var r=t(12),n=t(219),s=t(251),c=t(213),l=t(252);t(1).glMatrix.setMatrixArrayType(Array);function f(w,I,S){return I in w?Object.defineProperty(w,I,{value:S,enumerable:!0,configurable:!0,writable:!0}):w[I]=S,w}const h=Symbol("zOrder"),v=Symbol("ordered"),u=Symbol("children"),y=Symbol("sealed");class T extends n.default{constructor(I={}){super(I),this[u]=[],this[v]=null,this[h]=0}get childNodes(){return this[u]}get children(){return this[u]}get orderedChildren(){return this[v]||(this[v]=[...this[u]],this[v].sort((I,S)=>I.zIndex-S.zIndex||I.zOrder-S.zOrder)),this[v]}append(...I){return I.map(S=>this.appendChild(S))}appendChild(I){return I.remove(),this[u].push(I),I.connect(this,this[h]++),this[v]&&(this[v].length&&I.zIndex<this[v][this[v].length-1].zIndex?this.reorder():this[v].push(I)),I}cloneNode(I=!1){const S=super.cloneNode();return I&&this[u].forEach(O=>{const d=O.cloneNode(I);S.appendChild(d)}),S}dispatchPointerEvent(I){const S=this.orderedChildren;for(let O=S.length-1;O>=0;O--)if(S[O].dispatchPointerEvent(I))return!0;return super.dispatchPointerEvent(I)}draw(I=[]){if(this.__cacheRenderMatrix=this.renderMatrix,super.draw(I),!this[y]&&this.attributes.display!=="none"){const S=this.orderedChildren;for(let O=0;O<S.length;O++)S[O].draw(I)}return this.__cacheRenderMatrix=null,I}getElementById(I){return Object(l.querySelector)(`#${I}`,this)}getElementsByClassName(I){return Object(l.querySelectorAll)(`.${I}`,this)}getElementsByName(I){return Object(l.querySelectorAll)(`[name="${I}"]`,this)}getElementsByTagName(I){return Object(l.querySelectorAll)(I,this)}insertBefore(I,S){if(S==null)return this.appendChild(I);I.remove();const O=this[u].indexOf(S);if(O<0)throw new Error("Invalid reference node.");const d=S.zOrder;for(let g=O;g<this[u].length;g++){const p=this[u][g].zOrder,x=this[u][g];delete x.zOrder,Object.defineProperty(x,"zOrder",{value:p+1,writable:!1,configurable:!0})}if(this[u].splice(O,0,I),I.connect(this,d),this[v])if(I.zIndex!==S.zIndex)this.reorder();else{const g=this[v].indexOf(S);this[v].splice(g,0,I)}return I}querySelector(I){return Object(l.querySelector)(I,this)}querySelectorAll(I){return Object(l.querySelectorAll)(I,this)}replaceChild(I,S){I.remove();const O=this[u].indexOf(S);if(O<0)throw new Error("Invalid reference node.");if(this[u][O]=I,I.connect(this,S.zOrder),this[v])if(I.zIndex!==S.zIndex)this.reorder();else{const d=this[v].indexOf(S);this[v][d]=I}return S.disconnect(this),I}removeAllChildren(){const I=this[u];for(let S=I.length-1;S>=0;S--)I[S].remove()}removeChild(I){const S=this[u].indexOf(I);if(S>=0){if(this[u].splice(S,1),this[v]){const O=this[v].indexOf(I);this[v].splice(O,1)}return I.disconnect(this),I}return null}reorder(){this[v]=null}seal(){function I(g,p){const x=[];for(let E=0;E<g.length;E++){const R=[...g[E]];for(let D=1;D<R.length;D+=2){const U=R[D],M=R[D+1];R[D]=U*p[0]+M*p[2]+p[4],R[D+1]=U*p[1]+M*p[3]+p[5]}x.push(R)}return x}const S=this.orderedChildren,O=new r.Figure2D,d=this.localMatrix;for(let g=0;g<S.length;g++){let p=S[g];if(p instanceof T&&(p=p.seal()),p.clientBox){let x=p.clientBox.contours.path;x=I(x,p.localMatrix),O.addPath(x)}if(p.path){let x=p.path.contours.path;x=I(x,p.localMatrix),O.addPath(x)}}return this[y]=!0,this.clientBox=O,{clientBox:O,localMatrix:d}}setResolution({width:I,height:S}){super.setResolution({width:I,height:S}),this[u].forEach(O=>{O.setResolution({width:I,height:S})})}updateContours(){this[y]||super.updateContours()}}f(T,"Attr",s.default),c.default.registerNode(T,"group")},function(i,e,t){t.r(e),t.d(e,"default",function(){return n});var r=t(220);t(1).glMatrix.setMatrixArrayType(Array);class n extends r.default{}},function(i,e,t){t.r(e),t.d(e,"querySelectorAll",function(){return y}),t.d(e,"querySelector",function(){return T}),t.d(e,"isMatched",function(){return w}),t.d(e,"compile",function(){return I});var r=t(221),n=t(213);t(1).glMatrix.setMatrixArrayType(Array);const s=t(253);function c(S){return S.nodeType===1||n.default.isSpriteNode(S.nodeName)}function l(S){return Array.from(S.childNodes||[])}function f(S){return n.default.isSpriteNode(S.nodeName)?S.parent||S.canvas||S.container:S.parentElement}function h(S){let O=S.length,d,g,p;for(;--O>-1;){for(d=g=S[O],S[O]=null,p=!0;g;){if(S.indexOf(g)>-1){p=!1,S.splice(O,1);break}g=f(g)}p&&(S[O]=d)}return S}const v={isTag:c,existsOne(S,O){return O.some(d=>c(d)?S(d)||v.existsOne(S,l(d)):!1)},getSiblings(S){const O=f(S);return O&&l(O)},getChildren:l,getParent:f,getAttributeValue(S,O){if(S.nodeType===1&&O==="class"||O==="id")return S[O];if(this.hasAttrib(S,O)){let d=S.attributes[O];return Array.isArray(d)&&(d=`[${d.join()}]`),String(d)}},hasAttrib(S,O){return S.attributes[O]!=null},removeSubsets:h,getName(S){return S.tagName?S.tagName.toLowerCase():null},findOne:function S(O,d){let g=null;for(let p=0,x=d.length;p<x&&!g;p++)if(O(d[p]))g=d[p];else{const E=l(d[p]);E&&E.length>0&&(g=S(O,E))}return g},findAll:function S(O,d){let g=[];for(let p=0,x=d.length;p<x;p++){if(!c(d[p]))continue;O(d[p])&&g.push(d[p]);const E=l(d[p]);E&&(g=g.concat(S(O,E)))}return g},getText:function S(O){return Array.isArray(O)?O.map(S).join(""):c(O)?S(l(O)):O.nodeType===3?O.nodeValue:n.default.isSpriteNode(O.nodeName)?O.text:""}};function u(S){if(typeof S!="string")return S;let O=S.match(/\[(bgcolor|fillColor|strokeColor|color)\s*=\s*['"]?\w+['"]?\]/g);return O&&(O=O.map(d=>{const g=d.slice(1,-1).split("="),p=Object(r.parseColor)(g[1].replace(/['"]/g,""));return[d,`[${g[0]}="${p}"]`]}),O.forEach(([d,g])=>{S=S.replace(d,g)})),O=S.match(/\[\w+\s*=\s*['"]\[.+?\]['"]\]/g),O&&(O=O.map(d=>{const g=d.slice(1,-1).split("="),p=g[1].slice(2,-2).split(/,/g).map(x=>x.trim());return[d,`[${g[0]}="[${p}]"]`]}),O.forEach(([d,g])=>{S=S.replace(d,g)})),S}function y(S,O){return s.selectAll(u(S),O,{adapter:v})}function T(S,O){return s.selectOne(u(S),O,{adapter:v})}function w(S,O){return s.is(S,u(O),{adapter:v})}function I(S){return s.compile(u(S),{adapter:v})}},function(i,e,t){i.exports=I;var r=t(254),n=t(273).falseFunc,s=t(274);function c(S){return function(d,g,p){return g=g||{},g.adapter=g.adapter||r,S(d,g,p)}}var l=c(s),f=c(s.compileUnsafe);function h(S){return function(d,g,p){return p=p||{},p.adapter=p.adapter||r,typeof d!="function"&&(d=f(d,p,g)),d.shouldTestNextSiblings&&(g=u(p&&p.context||g,p.adapter)),Array.isArray(g)?g=p.adapter.removeSubsets(g):g=p.adapter.getChildren(g),S(d,g,p)}}function v(S,O){var d=O.getSiblings(S);if(!Array.isArray(d))return[];for(d=d.slice(0);d.shift()!==S;);return d}function u(S,O){Array.isArray(S)||(S=[S]);for(var d=S.slice(0),g=0,p=S.length;g<p;g++){var x=v(d[g],O);d.push.apply(d,x)}return d}var y=h(function(O,d,g){return O===n||!d||d.length===0?[]:g.adapter.findAll(O,d)}),T=h(function(O,d,g){return O===n||!d||d.length===0?null:g.adapter.findOne(O,d)});function w(S,O,d){return d=d||{},d.adapter=d.adapter||r,(typeof O=="function"?O:l(O,d))(S)}function I(S,O,d){return y(S,O,d)}I.compile=l,I.filters=s.Pseudos.filters,I.pseudos=s.Pseudos.pseudos,I.selectAll=y,I.selectOne=T,I.is=w,I.parse=l,I.iterate=y,I._compileUnsafe=f,I._compileToken=s.compileToken},function(i,e,t){var r=i.exports;[t(255),t(268),t(269),t(270),t(271),t(272)].forEach(function(n){Object.keys(n).forEach(function(s){r[s]=n[s].bind(r)})})},function(i,e,t){var r=t(256),n=t(257),s=r.isTag;i.exports={getInnerHTML:c,getOuterHTML:n,getText:l};function c(f,h){return f.children?f.children.map(function(v){return n(v,h)}).join(""):""}function l(f){return Array.isArray(f)?f.map(l).join(""):s(f)?f.name==="br"?`
565
565
  `:l(f.children):f.type===r.CDATA?l(f.children):f.type===r.Text?f.data:""}},function(i,e){i.exports={Text:"text",Directive:"directive",Comment:"comment",Script:"script",Style:"style",Tag:"tag",CDATA:"cdata",Doctype:"doctype",isTag:function(t){return t.type==="tag"||t.type==="script"||t.type==="style"}}},function(i,e,t){var r=t(258),n=t(259),s=t(267);s.elementNames.__proto__=null,s.attributeNames.__proto__=null;var c={__proto__:null,style:!0,script:!0,xmp:!0,iframe:!0,noembed:!0,noframes:!0,plaintext:!0,noscript:!0};function l(S,O){if(S){var d="",g;for(var p in S)g=S[p],d&&(d+=" "),O.xmlMode==="foreign"&&(p=s.attributeNames[p]||p),d+=p,(g!==null&&g!==""||O.xmlMode)&&(d+='="'+(O.decodeEntities?n.encodeXML(g):g.replace(/\"/g,"&quot;"))+'"');return d}}var f={__proto__:null,area:!0,base:!0,basefont:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,isindex:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},h=i.exports=function(S,O){!Array.isArray(S)&&!S.cheerio&&(S=[S]),O=O||{};for(var d="",g=0;g<S.length;g++){var p=S[g];p.type==="root"?d+=h(p.children,O):r.isTag(p)?d+=u(p,O):p.type===r.Directive?d+=y(p):p.type===r.Comment?d+=I(p):p.type===r.CDATA?d+=w(p):d+=T(p,O)}return d},v=["mi","mo","mn","ms","mtext","annotation-xml","foreignObject","desc","title"];function u(S,O){O.xmlMode==="foreign"&&(S.name=s.elementNames[S.name]||S.name,S.parent&&v.indexOf(S.parent.name)>=0&&(O=Object.assign({},O,{xmlMode:!1}))),!O.xmlMode&&["svg","math"].indexOf(S.name)>=0&&(O=Object.assign({},O,{xmlMode:"foreign"}));var d="<"+S.name,g=l(S.attribs,O);return g&&(d+=" "+g),O.xmlMode&&(!S.children||S.children.length===0)?d+="/>":(d+=">",S.children&&(d+=h(S.children,O)),(!f[S.name]||O.xmlMode)&&(d+="</"+S.name+">")),d}function y(S){return"<"+S.data+">"}function T(S,O){var d=S.data||"";return O.decodeEntities&&!(S.parent&&S.parent.name in c)&&(d=n.encodeXML(d)),d}function w(S){return"<![CDATA["+S.children[0].data+"]]>"}function I(S){return"<!--"+S.data+"-->"}},function(i,e,t){Object.defineProperty(e,"__esModule",{value:!0});function r(n){return n.type==="tag"||n.type==="script"||n.type==="style"}e.isTag=r,e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"},function(i,e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.encode=e.decodeStrict=e.decode=void 0;var r=t(260),n=t(266);function s(v,u){return(!u||u<=0?r.decodeXML:r.decodeHTML)(v)}e.decode=s;function c(v,u){return(!u||u<=0?r.decodeXML:r.decodeHTMLStrict)(v)}e.decodeStrict=c;function l(v,u){return(!u||u<=0?n.encodeXML:n.encodeHTML)(v)}e.encode=l;var f=t(266);Object.defineProperty(e,"encodeXML",{enumerable:!0,get:function(){return f.encodeXML}}),Object.defineProperty(e,"encodeHTML",{enumerable:!0,get:function(){return f.encodeHTML}}),Object.defineProperty(e,"escape",{enumerable:!0,get:function(){return f.escape}}),Object.defineProperty(e,"encodeHTML4",{enumerable:!0,get:function(){return f.encodeHTML}}),Object.defineProperty(e,"encodeHTML5",{enumerable:!0,get:function(){return f.encodeHTML}});var h=t(260);Object.defineProperty(e,"decodeXML",{enumerable:!0,get:function(){return h.decodeXML}}),Object.defineProperty(e,"decodeHTML",{enumerable:!0,get:function(){return h.decodeHTML}}),Object.defineProperty(e,"decodeHTMLStrict",{enumerable:!0,get:function(){return h.decodeHTMLStrict}}),Object.defineProperty(e,"decodeHTML4",{enumerable:!0,get:function(){return h.decodeHTML}}),Object.defineProperty(e,"decodeHTML5",{enumerable:!0,get:function(){return h.decodeHTML}}),Object.defineProperty(e,"decodeHTML4Strict",{enumerable:!0,get:function(){return h.decodeHTMLStrict}}),Object.defineProperty(e,"decodeHTML5Strict",{enumerable:!0,get:function(){return h.decodeHTMLStrict}}),Object.defineProperty(e,"decodeXMLStrict",{enumerable:!0,get:function(){return h.decodeXML}})},function(i,e,t){var r=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHTML=e.decodeHTMLStrict=e.decodeXML=void 0;var n=r(t(261)),s=r(t(262)),c=r(t(263)),l=r(t(264));e.decodeXML=f(c.default),e.decodeHTMLStrict=f(n.default);function f(u){var y=Object.keys(u).join("|"),T=v(u);y+="|#[xX][\\da-fA-F]+|#\\d+";var w=new RegExp("&(?:"+y+");","g");return function(I){return String(I).replace(w,T)}}var h=function(u,y){return u<y?1:-1};e.decodeHTML=function(){for(var u=Object.keys(s.default).sort(h),y=Object.keys(n.default).sort(h),T=0,w=0;T<y.length;T++)u[w]===y[T]?(y[T]+=";?",w++):y[T]+=";";var I=new RegExp("&(?:"+y.join("|")+"|#[xX][\\da-fA-F]+;?|#\\d+;?)","g"),S=v(n.default);function O(d){return d.substr(-1)!==";"&&(d+=";"),S(d)}return function(d){return String(d).replace(I,O)}}();function v(u){return function(T){if(T.charAt(1)==="#"){var w=T.charAt(2);return w==="X"||w==="x"?l.default(parseInt(T.substr(3),16)):l.default(parseInt(T.substr(2),10))}return u[T.slice(1,-1)]}}},function(i){i.exports=JSON.parse('{"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":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","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":"⋍","bsolb":"⧅","bsol":"\\\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","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":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","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":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","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":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","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":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"Ê","ecirc":"ê","ecir":"≖","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":"▫","emsp13":" ","emsp14":" ","emsp":" ","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":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","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","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","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":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","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":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","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":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","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":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","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":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","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":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","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":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","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":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","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":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","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":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","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":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","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":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoustache":"⎱","rmoust":"⎱","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":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","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":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","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":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","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":"  ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","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":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","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":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","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":"‌"}')},function(i){i.exports=JSON.parse('{"Aacute":"Á","aacute":"á","Acirc":"Â","acirc":"â","acute":"´","AElig":"Æ","aelig":"æ","Agrave":"À","agrave":"à","amp":"&","AMP":"&","Aring":"Å","aring":"å","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","brvbar":"¦","Ccedil":"Ç","ccedil":"ç","cedil":"¸","cent":"¢","copy":"©","COPY":"©","curren":"¤","deg":"°","divide":"÷","Eacute":"É","eacute":"é","Ecirc":"Ê","ecirc":"ê","Egrave":"È","egrave":"è","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","frac12":"½","frac14":"¼","frac34":"¾","gt":">","GT":">","Iacute":"Í","iacute":"í","Icirc":"Î","icirc":"î","iexcl":"¡","Igrave":"Ì","igrave":"ì","iquest":"¿","Iuml":"Ï","iuml":"ï","laquo":"«","lt":"<","LT":"<","macr":"¯","micro":"µ","middot":"·","nbsp":" ","not":"¬","Ntilde":"Ñ","ntilde":"ñ","Oacute":"Ó","oacute":"ó","Ocirc":"Ô","ocirc":"ô","Ograve":"Ò","ograve":"ò","ordf":"ª","ordm":"º","Oslash":"Ø","oslash":"ø","Otilde":"Õ","otilde":"õ","Ouml":"Ö","ouml":"ö","para":"¶","plusmn":"±","pound":"£","quot":"\\"","QUOT":"\\"","raquo":"»","reg":"®","REG":"®","sect":"§","shy":"­","sup1":"¹","sup2":"²","sup3":"³","szlig":"ß","THORN":"Þ","thorn":"þ","times":"×","Uacute":"Ú","uacute":"ú","Ucirc":"Û","ucirc":"û","Ugrave":"Ù","ugrave":"ù","uml":"¨","Uuml":"Ü","uuml":"ü","Yacute":"Ý","yacute":"ý","yen":"¥","yuml":"ÿ"}')},function(i){i.exports=JSON.parse(`{"amp":"&","apos":"'","gt":">","lt":"<","quot":"\\""}`)},function(i,e,t){var r=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(e,"__esModule",{value:!0});var n=r(t(265));function s(c){if(c>=55296&&c<=57343||c>1114111)return"�";c in n.default&&(c=n.default[c]);var l="";return c>65535&&(c-=65536,l+=String.fromCharCode(c>>>10&1023|55296),c=56320|c&1023),l+=String.fromCharCode(c),l}e.default=s},function(i){i.exports=JSON.parse('{"0":65533,"128":8364,"130":8218,"131":402,"132":8222,"133":8230,"134":8224,"135":8225,"136":710,"137":8240,"138":352,"139":8249,"140":338,"142":381,"145":8216,"146":8217,"147":8220,"148":8221,"149":8226,"150":8211,"151":8212,"152":732,"153":8482,"154":353,"155":8250,"156":339,"158":382,"159":376}')},function(i,e,t){var r=this&&this.__importDefault||function(O){return O&&O.__esModule?O:{default:O}};Object.defineProperty(e,"__esModule",{value:!0}),e.escape=e.encodeHTML=e.encodeXML=void 0;var n=r(t(263)),s=v(n.default),c=u(s);e.encodeXML=w(s,c);var l=r(t(261)),f=v(l.default),h=u(f);e.encodeHTML=w(f,h);function v(O){return Object.keys(O).sort().reduce(function(d,g){return d[O[g]]="&"+g+";",d},{})}function u(O){for(var d=[],g=[],p=0,x=Object.keys(O);p<x.length;p++){var E=x[p];E.length===1?d.push("\\"+E):g.push(E)}d.sort();for(var R=0;R<d.length-1;R++){for(var D=R;D<d.length-1&&d[D].charCodeAt(1)+1===d[D+1].charCodeAt(1);)D+=1;var U=1+D-R;U<3||d.splice(R,U,d[R]+"-"+d[D])}return g.unshift("["+d.join("")+"]"),new RegExp(g.join("|"),"g")}var y=/(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g;function T(O){return"&#x"+O.codePointAt(0).toString(16).toUpperCase()+";"}function w(O,d){return function(g){return g.replace(d,function(p){return O[p]}).replace(y,T)}}var I=u(s);function S(O){return O.replace(I,T).replace(y,T)}e.escape=S},function(i){i.exports=JSON.parse('{"elementNames":{"altglyph":"altGlyph","altglyphdef":"altGlyphDef","altglyphitem":"altGlyphItem","animatecolor":"animateColor","animatemotion":"animateMotion","animatetransform":"animateTransform","clippath":"clipPath","feblend":"feBlend","fecolormatrix":"feColorMatrix","fecomponenttransfer":"feComponentTransfer","fecomposite":"feComposite","feconvolvematrix":"feConvolveMatrix","fediffuselighting":"feDiffuseLighting","fedisplacementmap":"feDisplacementMap","fedistantlight":"feDistantLight","fedropshadow":"feDropShadow","feflood":"feFlood","fefunca":"feFuncA","fefuncb":"feFuncB","fefuncg":"feFuncG","fefuncr":"feFuncR","fegaussianblur":"feGaussianBlur","feimage":"feImage","femerge":"feMerge","femergenode":"feMergeNode","femorphology":"feMorphology","feoffset":"feOffset","fepointlight":"fePointLight","fespecularlighting":"feSpecularLighting","fespotlight":"feSpotLight","fetile":"feTile","feturbulence":"feTurbulence","foreignobject":"foreignObject","glyphref":"glyphRef","lineargradient":"linearGradient","radialgradient":"radialGradient","textpath":"textPath"},"attributeNames":{"definitionurl":"definitionURL","attributename":"attributeName","attributetype":"attributeType","basefrequency":"baseFrequency","baseprofile":"baseProfile","calcmode":"calcMode","clippathunits":"clipPathUnits","diffuseconstant":"diffuseConstant","edgemode":"edgeMode","filterunits":"filterUnits","glyphref":"glyphRef","gradienttransform":"gradientTransform","gradientunits":"gradientUnits","kernelmatrix":"kernelMatrix","kernelunitlength":"kernelUnitLength","keypoints":"keyPoints","keysplines":"keySplines","keytimes":"keyTimes","lengthadjust":"lengthAdjust","limitingconeangle":"limitingConeAngle","markerheight":"markerHeight","markerunits":"markerUnits","markerwidth":"markerWidth","maskcontentunits":"maskContentUnits","maskunits":"maskUnits","numoctaves":"numOctaves","pathlength":"pathLength","patterncontentunits":"patternContentUnits","patterntransform":"patternTransform","patternunits":"patternUnits","pointsatx":"pointsAtX","pointsaty":"pointsAtY","pointsatz":"pointsAtZ","preservealpha":"preserveAlpha","preserveaspectratio":"preserveAspectRatio","primitiveunits":"primitiveUnits","refx":"refX","refy":"refY","repeatcount":"repeatCount","repeatdur":"repeatDur","requiredextensions":"requiredExtensions","requiredfeatures":"requiredFeatures","specularconstant":"specularConstant","specularexponent":"specularExponent","spreadmethod":"spreadMethod","startoffset":"startOffset","stddeviation":"stdDeviation","stitchtiles":"stitchTiles","surfacescale":"surfaceScale","systemlanguage":"systemLanguage","tablevalues":"tableValues","targetx":"targetX","targety":"targetY","textlength":"textLength","viewbox":"viewBox","viewtarget":"viewTarget","xchannelselector":"xChannelSelector","ychannelselector":"yChannelSelector","zoomandpan":"zoomAndPan"}}')},function(i,e){var t=e.getChildren=function(n){return n.children},r=e.getParent=function(n){return n.parent};e.getSiblings=function(n){var s=r(n);return s?t(s):[n]},e.getAttributeValue=function(n,s){return n.attribs&&n.attribs[s]},e.hasAttrib=function(n,s){return!!n.attribs&&hasOwnProperty.call(n.attribs,s)},e.getName=function(n){return n.name}},function(i,e){e.removeElement=function(t){if(t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t.parent){var r=t.parent.children;r.splice(r.lastIndexOf(t),1)}},e.replaceElement=function(t,r){var n=r.prev=t.prev;n&&(n.next=r);var s=r.next=t.next;s&&(s.prev=r);var c=r.parent=t.parent;if(c){var l=c.children;l[l.lastIndexOf(t)]=r}},e.appendChild=function(t,r){if(r.parent=t,t.children.push(r)!==1){var n=t.children[t.children.length-2];n.next=r,r.prev=n,r.next=null}},e.append=function(t,r){var n=t.parent,s=t.next;if(r.next=s,r.prev=t,t.next=r,r.parent=n,s){if(s.prev=r,n){var c=n.children;c.splice(c.lastIndexOf(s),0,r)}}else n&&n.children.push(r)},e.prepend=function(t,r){var n=t.parent;if(n){var s=n.children;s.splice(s.lastIndexOf(t),0,r)}t.prev&&(t.prev.next=r),r.parent=n,r.prev=t.prev,r.next=t,t.prev=r}},function(i,e,t){var r=t(256).isTag;i.exports={filter:n,find:s,findOneChild:c,findOne:l,existsOne:f,findAll:h};function n(v,u,y,T){return Array.isArray(u)||(u=[u]),(typeof T!="number"||!isFinite(T))&&(T=1/0),s(v,u,y!==!1,T)}function s(v,u,y,T){for(var w=[],I,S=0,O=u.length;S<O&&!(v(u[S])&&(w.push(u[S]),--T<=0)||(I=u[S].children,y&&I&&I.length>0&&(I=s(v,I,y,T),w=w.concat(I),T-=I.length,T<=0)));S++);return w}function c(v,u){for(var y=0,T=u.length;y<T;y++)if(v(u[y]))return u[y];return null}function l(v,u){for(var y=null,T=0,w=u.length;T<w&&!y;T++)if(r(u[T]))v(u[T])?y=u[T]:u[T].children.length>0&&(y=l(v,u[T].children));else continue;return y}function f(v,u){for(var y=0,T=u.length;y<T;y++)if(r(u[y])&&(v(u[y])||u[y].children.length>0&&f(v,u[y].children)))return!0;return!1}function h(v,u){for(var y=[],T=u.slice();T.length;){var w=T.shift();r(w)&&(w.children&&w.children.length>0&&T.unshift.apply(T,w.children),v(w)&&y.push(w))}return y}},function(i,e,t){var r=t(256),n=e.isTag=r.isTag;e.testElement=function(f,h){for(var v in f)if(f.hasOwnProperty(v)){if(v==="tag_name"){if(!n(h)||!f.tag_name(h.name))return!1}else if(v==="tag_type"){if(!f.tag_type(h.type))return!1}else if(v==="tag_contains"){if(n(h)||!f.tag_contains(h.data))return!1}else if(!h.attribs||!f[v](h.attribs[v]))return!1}return!0};var s={tag_name:function(f){return typeof f=="function"?function(h){return n(h)&&f(h.name)}:f==="*"?n:function(h){return n(h)&&h.name===f}},tag_type:function(f){return typeof f=="function"?function(h){return f(h.type)}:function(h){return h.type===f}},tag_contains:function(f){return typeof f=="function"?function(h){return!n(h)&&f(h.data)}:function(h){return!n(h)&&h.data===f}}};function c(f,h){return typeof h=="function"?function(v){return v.attribs&&h(v.attribs[f])}:function(v){return v.attribs&&v.attribs[f]===h}}function l(f,h){return function(v){return f(v)||h(v)}}e.getElements=function(f,h,v,u){var y=Object.keys(f).map(function(T){var w=f[T];return T in s?s[T](w):c(T,w)});return y.length===0?[]:this.filter(y.reduce(l),h,v,u)},e.getElementById=function(f,h,v){return Array.isArray(h)||(h=[h]),this.findOne(c("id",f),h,v!==!1)},e.getElementsByTagName=function(f,h,v,u){return this.filter(s.tag_name(f),h,v,u)},e.getElementsByTagType=function(f,h,v,u){return this.filter(s.tag_type(f),h,v,u)}},function(i,e){e.removeSubsets=function(n){for(var s=n.length,c,l,f;--s>-1;){for(c=l=n[s],n[s]=null,f=!0;l;){if(n.indexOf(l)>-1){f=!1,n.splice(s,1);break}l=l.parent}f&&(n[s]=c)}return n};var t={DISCONNECTED:1,PRECEDING:2,FOLLOWING:4,CONTAINS:8,CONTAINED_BY:16},r=e.compareDocumentPosition=function(n,s){var c=[],l=[],f,h,v,u,y,T;if(n===s)return 0;for(f=n;f;)c.unshift(f),f=f.parent;for(f=s;f;)l.unshift(f),f=f.parent;for(T=0;c[T]===l[T];)T++;return T===0?t.DISCONNECTED:(h=c[T-1],v=h.children,u=c[T],y=l[T],v.indexOf(u)>v.indexOf(y)?h===s?t.FOLLOWING|t.CONTAINED_BY:t.FOLLOWING:h===n?t.PRECEDING|t.CONTAINS:t.PRECEDING)};e.uniqueSort=function(n){var s=n.length,c,l;for(n=n.slice();--s>-1;)c=n[s],l=n.indexOf(c),l>-1&&l<s&&n.splice(s,1);return n.sort(function(f,h){var v=r(f,h);return v&t.PRECEDING?-1:v&t.FOLLOWING?1:0}),n}},function(i,e){i.exports={trueFunc:function(){return!0},falseFunc:function(){return!1}}},function(i,e,t){i.exports=y;var r=t(275).parse,n=t(273),s=t(278),c=t(279),l=t(280),f=t(282),h=n.trueFunc,v=n.falseFunc,u=f.filters;function y(M,W,X){var B=w(M,W,X);return T(B,W)}function T(M,W){var X=W.adapter;return function(N){return X.isTag(N)&&M(N)}}function w(M,W,X){var B=r(M,W);return x(B,W,X)}function I(M){return M.type==="pseudo"&&(M.name==="scope"||Array.isArray(M.data)&&M.data.some(function(W){return W.some(I)}))}var S={type:"descendant"},O={type:"_flexibleDescendant"},d={type:"pseudo",name:"scope"},g={};function p(M,W,X){var B=W.adapter,N=!!X&&!!X.length&&X.every(function($){return $===g||!!B.getParent($)});M.forEach(function($){if(!($.length>0&&E($[0])&&$[0].type!=="descendant"))if(N&&!(Array.isArray($)?$.some(I):I($)))$.unshift(S);else return;$.unshift(d)})}function x(M,W,X){M=M.filter(function(J){return J.length>0}),M.forEach(s);var B=Array.isArray(X);X=W&&W.context||X,X&&!B&&(X=[X]),p(M,W,X);var N=!1,$=M.map(function(J){if(J[0]&&J[1]&&J[0].name==="scope"){var tt=J[1].type;B&&tt==="descendant"?J[1]=O:(tt==="adjacent"||tt==="sibling")&&(N=!0)}return R(J,W,X)}).reduce(D,v);return $.shouldTestNextSiblings=N,$}function E(M){return c[M.type]<0}function R(M,W,X){return M.reduce(function(B,N){if(B===v)return B;if(!(N.type in l))throw new Error("Rule type "+N.type+" is not supported by css-select");return l[N.type](B,N,W,X)},W&&W.rootFunc||h)}function D(M,W){return W===v||M===h?M:M===v||W===h?W:function(B){return M(B)||W(B)}}function U(M){return M.some(E)}u.not=function(M,W,X,B){var N={xmlMode:!!(X&&X.xmlMode),strict:!!(X&&X.strict),adapter:X.adapter};if(N.strict&&(W.length>1||W.some(U)))throw new Error("complex selectors in :not aren't allowed in strict mode");var $=x(W,N,B);return $===v?M:$===h?v:function(tt){return!$(tt)&&M(tt)}},u.has=function(M,W,X){var B=X.adapter,N={xmlMode:!!(X&&X.xmlMode),strict:!!(X&&X.strict),adapter:B},$=W.some(U)?[g]:null,J=x(W,N,$);return J===v?v:J===h?function(at){return B.getChildren(at).some(B.isTag)&&M(at)}:(J=T(J,X),$?function(at){return M(at)&&($[0]=at,B.existsOne(J,B.getChildren(at)))}:function(at){return M(at)&&B.existsOne(J,B.getChildren(at))})},u.matches=function(M,W,X,B){var N={xmlMode:!!(X&&X.xmlMode),strict:!!(X&&X.strict),rootFunc:M,adapter:X.adapter};return x(W,N,B)},y.compileToken=x,y.compileUnsafe=w,y.Pseudos=f},function(i,e,t){var r=this&&this.__createBinding||(Object.create?function(l,f,h,v){v===void 0&&(v=h),Object.defineProperty(l,v,{enumerable:!0,get:function(){return f[h]}})}:function(l,f,h,v){v===void 0&&(v=h),l[v]=f[h]}),n=this&&this.__exportStar||function(l,f){for(var h in l)h!=="default"&&!f.hasOwnProperty(h)&&r(f,l,h)};Object.defineProperty(e,"__esModule",{value:!0}),n(t(276),e);var s=t(276);Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return s.default}});var c=t(277);Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.default}})},function(i,e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=I;var r=/^[^\\]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/,n=/\\([\da-f]{1,6}\s?|(\s)|.)/gi,s=/^\s*((?:\\.|[\w\u00b0-\uFFFF-])+)\s*(?:(\S?)=\s*(?:(['"])([^]*?)\3|(#?(?:\\.|[\w\u00b0-\uFFFF-])*)|)|)\s*(i)?\]/,c={undefined:"exists","":"equals","~":"element","^":"start",$:"end","*":"any","!":"not","|":"hyphen"},l={">":"child","<":"parent","~":"sibling","+":"adjacent"},f={"#":["id","equals"],".":["class","element"]},h=new Set(["has","not","matches"]),v=new Set(["contains","icontains"]),u=new Set(['"',"'"]);function y(d,g,p){var x=parseInt(g,16)-65536;return x!==x||p?g:x<0?String.fromCharCode(x+65536):String.fromCharCode(x>>10|55296,x&1023|56320)}function T(d){return d.replace(n,y)}function w(d){return d===" "||d===`
566
- `||d===" "||d==="\f"||d==="\r"}function I(d,g){var p=[];if(d=S(p,""+d,g),d!=="")throw new Error("Unmatched selector: "+d);return p}function S(d,g,p){var x=[],E=!1;function R(){var ft=g.match(r);if(!ft)throw new Error("Expected name, found "+g);var mt=ft[0];return g=g.substr(mt.length),T(mt)}function D(ft){for(;w(g.charAt(ft));)ft++;g=g.substr(ft)}function U(ft){for(var mt=0;g.charAt(--ft)==="\\";)mt++;return(mt&1)===1}for(D(0);g!=="";){var M=g.charAt(0);if(w(M))E=!0,D(1);else if(M in l)x.push({type:l[M]}),E=!1,D(1);else if(M===","){if(x.length===0)throw new Error("Empty sub-selector");d.push(x),x=[],E=!1,D(1)}else if(E&&(x.length>0&&x.push({type:"descendant"}),E=!1),M==="*")g=g.substr(1),x.push({type:"universal"});else if(M in f){var W=f[M],X=W[0],B=W[1];g=g.substr(1),x.push({type:"attribute",name:X,action:B,value:R(),ignoreCase:!1})}else if(M==="["){g=g.substr(1);var N=g.match(s);if(!N)throw new Error("Malformed attribute selector: "+g);g=g.substr(N[0].length);var $=T(N[1]);(!p||("lowerCaseAttributeNames"in p?p.lowerCaseAttributeNames:!p.xmlMode))&&($=$.toLowerCase()),x.push({type:"attribute",name:$,action:c[N[2]],value:T(N[4]||N[5]||""),ignoreCase:!!N[6]})}else if(M===":"){if(g.charAt(1)===":"){g=g.substr(2),x.push({type:"pseudo-element",name:R().toLowerCase()});continue}g=g.substr(1);var J=R().toLowerCase(),N=null;if(g.charAt(0)==="(")if(h.has(J)){var tt=g.charAt(1),at=u.has(tt);if(g=g.substr(at?2:1),N=[],g=S(N,g,p),at){if(g.charAt(0)!==tt)throw new Error("Unmatched quotes in :"+J);g=g.substr(1)}if(g.charAt(0)!==")")throw new Error("Missing closing parenthesis in :"+J+" ("+g+")");g=g.substr(1)}else{for(var ut=1,V=1;V>0&&ut<g.length;ut++)g.charAt(ut)==="("&&!U(ut)?V++:g.charAt(ut)===")"&&!U(ut)&&V--;if(V)throw new Error("Parenthesis not matched");if(N=g.substr(1,ut-2),g=g.substr(ut),v.has(J)){var tt=N.charAt(0);tt===N.slice(-1)&&u.has(tt)&&(N=N.slice(1,-1)),N=T(N)}}x.push({type:"pseudo",name:J,data:N})}else if(r.test(g)){var Q=R();(!p||("lowerCaseTags"in p?p.lowerCaseTags:!p.xmlMode))&&(Q=Q.toLowerCase()),x.push({type:"tag",name:Q})}else return x.length&&x[x.length-1].type==="descendant"&&x.pop(),O(d,x),g}return O(d,x),g}function O(d,g){if(d.length>0&&g.length===0)throw new Error("Empty sub-selector");d.push(g)}},function(i,e,t){Object.defineProperty(e,"__esModule",{value:!0});var r={equals:"",element:"~",start:"^",end:"$",any:"*",not:"!",hyphen:"|"};function n(f){return f.map(s).join(", ")}e.default=n;function s(f){return f.map(c).join("")}function c(f){switch(f.type){case"child":return" > ";case"parent":return" < ";case"sibling":return" ~ ";case"adjacent":return" + ";case"descendant":return" ";case"universal":return"*";case"tag":return f.name;case"pseudo-element":return"::"+f.name;case"pseudo":return f.data===null?":"+f.name:typeof f.data=="string"?":"+f.name+"("+f.data+")":":"+f.name+"("+n(f.data)+")";case"attribute":return f.action==="exists"?"["+f.name+"]":f.name==="id"&&f.action==="equals"&&!f.ignoreCase?"#"+f.value:f.name==="class"&&f.action==="element"&&!f.ignoreCase?"."+f.value:"["+f.name+r[f.action]+"='"+f.value+"'"+(f.ignoreCase?"i":"")+"]";default:throw new Error("Unknown type")}}function l(f){return f}},function(i,e,t){i.exports=s;var r=t(279),n={__proto__:null,exists:10,equals:8,not:7,start:6,end:6,any:5,hyphen:4,element:4};function s(l){for(var f=l.map(c),h=1;h<l.length;h++){var v=f[h];if(!(v<0))for(var u=h-1;u>=0&&v<f[u];u--){var y=l[u+1];l[u+1]=l[u],l[u]=y,f[u+1]=f[u],f[u]=v}}}function c(l){var f=r[l.type];if(f===r.attribute)f=n[l.action],f===n.equals&&l.name==="id"&&(f=9),l.ignoreCase&&(f>>=1);else if(f===r.pseudo)if(!l.data)f=3;else if(l.name==="has"||l.name==="contains")f=0;else if(l.name==="matches"||l.name==="not"){f=0;for(var h=0;h<l.data.length;h++)if(l.data[h].length===1){var v=c(l.data[h][0]);if(v===0){f=0;break}v>f&&(f=v)}l.data.length>1&&f>0&&(f-=1)}else f=1;return f}},function(i){i.exports=JSON.parse('{"universal":50,"tag":30,"attribute":1,"pseudo":0,"descendant":-1,"child":-1,"parent":-1,"sibling":-1,"adjacent":-1}')},function(i,e,t){var r=t(281),n=t(282);i.exports={__proto__:null,attribute:r.compile,pseudo:n.compile,tag:function(s,c,l){var f=c.name,h=l.adapter;return function(u){return h.getName(u)===f&&s(u)}},descendant:function(s,c,l){var f=typeof WeakSet<"u"?new WeakSet:null,h=l.adapter;return function(u){for(var y=!1;!y&&(u=h.getParent(u));)(!f||!f.has(u))&&(y=s(u),!y&&f&&f.add(u));return y}},_flexibleDescendant:function(s,c,l){var f=l.adapter;return function(v){for(var u=s(v);!u&&(v=f.getParent(v));)u=s(v);return u}},parent:function(s,c,l){if(l&&l.strict)throw new Error("Parent selector isn't part of CSS3");var f=l.adapter;return function(u){return f.getChildren(u).some(h)};function h(v){return f.isTag(v)&&s(v)}},child:function(s,c,l){var f=l.adapter;return function(v){var u=f.getParent(v);return!!u&&s(u)}},sibling:function(s,c,l){var f=l.adapter;return function(v){for(var u=f.getSiblings(v),y=0;y<u.length;y++)if(f.isTag(u[y])){if(u[y]===v)break;if(s(u[y]))return!0}return!1}},adjacent:function(s,c,l){var f=l.adapter;return function(v){for(var u=f.getSiblings(v),y,T=0;T<u.length;T++)if(f.isTag(u[T])){if(u[T]===v)break;y=u[T]}return!!y&&s(y)}},universal:function(s){return s}}},function(i,e,t){var r=t(273).falseFunc,n=/[-[\]{}()*+?.,\\^$|#\s]/g,s={__proto__:null,equals:function(c,l,f){var h=l.name,v=l.value,u=f.adapter;return l.ignoreCase?(v=v.toLowerCase(),function(T){var w=u.getAttributeValue(T,h);return w!=null&&w.toLowerCase()===v&&c(T)}):function(T){return u.getAttributeValue(T,h)===v&&c(T)}},hyphen:function(c,l,f){var h=l.name,v=l.value,u=v.length,y=f.adapter;return l.ignoreCase?(v=v.toLowerCase(),function(w){var I=y.getAttributeValue(w,h);return I!=null&&(I.length===u||I.charAt(u)==="-")&&I.substr(0,u).toLowerCase()===v&&c(w)}):function(w){var I=y.getAttributeValue(w,h);return I!=null&&I.substr(0,u)===v&&(I.length===u||I.charAt(u)==="-")&&c(w)}},element:function(c,l,f){var h=l.name,v=l.value,u=f.adapter;if(/\s/.test(v))return r;v=v.replace(n,"\\$&");var y="(?:^|\\s)"+v+"(?:$|\\s)",T=l.ignoreCase?"i":"",w=new RegExp(y,T);return function(S){var O=u.getAttributeValue(S,h);return O!=null&&w.test(O)&&c(S)}},exists:function(c,l,f){var h=l.name,v=f.adapter;return function(y){return v.hasAttrib(y,h)&&c(y)}},start:function(c,l,f){var h=l.name,v=l.value,u=v.length,y=f.adapter;return u===0?r:l.ignoreCase?(v=v.toLowerCase(),function(w){var I=y.getAttributeValue(w,h);return I!=null&&I.substr(0,u).toLowerCase()===v&&c(w)}):function(w){var I=y.getAttributeValue(w,h);return I!=null&&I.substr(0,u)===v&&c(w)}},end:function(c,l,f){var h=l.name,v=l.value,u=-v.length,y=f.adapter;return u===0?r:l.ignoreCase?(v=v.toLowerCase(),function(w){var I=y.getAttributeValue(w,h);return I!=null&&I.substr(u).toLowerCase()===v&&c(w)}):function(w){var I=y.getAttributeValue(w,h);return I!=null&&I.substr(u)===v&&c(w)}},any:function(c,l,f){var h=l.name,v=l.value,u=f.adapter;if(v==="")return r;if(l.ignoreCase){var y=new RegExp(v.replace(n,"\\$&"),"i");return function(w){var I=u.getAttributeValue(w,h);return I!=null&&y.test(I)&&c(w)}}return function(w){var I=u.getAttributeValue(w,h);return I!=null&&I.indexOf(v)>=0&&c(w)}},not:function(c,l,f){var h=l.name,v=l.value,u=f.adapter;return v===""?function(T){return!!u.getAttributeValue(T,h)&&c(T)}:l.ignoreCase?(v=v.toLowerCase(),function(T){var w=u.getAttributeValue(T,h);return w!=null&&w.toLowerCase()!==v&&c(T)}):function(T){return u.getAttributeValue(T,h)!==v&&c(T)}}};i.exports={compile:function(c,l,f){if(f&&f.strict&&(l.ignoreCase||l.action==="not"))throw new Error("Unsupported attribute selector");return s[l.action](c,l,f)},rules:s}},function(i,e,t){var r=t(283),n=t(273),s=t(281),c=n.trueFunc,l=n.falseFunc,f=s.rules.equals;function h(O,d){var g={name:O,value:d};return function(x,E,R){return f(x,g,R)}}function v(O,d){return function(g){return!!d.getParent(g)&&O(g)}}var u={contains:function(O,d,g){var p=g.adapter;return function(E){return O(E)&&p.getText(E).indexOf(d)>=0}},icontains:function(O,d,g){var p=d.toLowerCase(),x=g.adapter;return function(R){return O(R)&&x.getText(R).toLowerCase().indexOf(p)>=0}},"nth-child":function(O,d,g){var p=r(d),x=g.adapter;return p===l?p:p===c?v(O,x):function(R){for(var D=x.getSiblings(R),U=0,M=0;U<D.length;U++)if(x.isTag(D[U])){if(D[U]===R)break;M++}return p(M)&&O(R)}},"nth-last-child":function(O,d,g){var p=r(d),x=g.adapter;return p===l?p:p===c?v(O,x):function(R){for(var D=x.getSiblings(R),U=0,M=D.length-1;M>=0;M--)if(x.isTag(D[M])){if(D[M]===R)break;U++}return p(U)&&O(R)}},"nth-of-type":function(O,d,g){var p=r(d),x=g.adapter;return p===l?p:p===c?v(O,x):function(R){for(var D=x.getSiblings(R),U=0,M=0;M<D.length;M++)if(x.isTag(D[M])){if(D[M]===R)break;x.getName(D[M])===x.getName(R)&&U++}return p(U)&&O(R)}},"nth-last-of-type":function(O,d,g){var p=r(d),x=g.adapter;return p===l?p:p===c?v(O,x):function(R){for(var D=x.getSiblings(R),U=0,M=D.length-1;M>=0;M--)if(x.isTag(D[M])){if(D[M]===R)break;x.getName(D[M])===x.getName(R)&&U++}return p(U)&&O(R)}},root:function(O,d,g){var p=g.adapter;return function(x){return!p.getParent(x)&&O(x)}},scope:function(O,d,g,p){var x=g.adapter;if(!p||p.length===0)return u.root(O,d,g);function E(R,D){return typeof x.equals=="function"?x.equals(R,D):R===D}return p.length===1?function(R){return E(p[0],R)&&O(R)}:function(R){return p.indexOf(R)>=0&&O(R)}},checkbox:h("type","checkbox"),file:h("type","file"),password:h("type","password"),radio:h("type","radio"),reset:h("type","reset"),image:h("type","image"),submit:h("type","submit"),hover:function(O,d,g){var p=g.adapter;return typeof p.isHovered=="function"?function(E){return O(E)&&p.isHovered(E)}:l},visited:function(O,d,g){var p=g.adapter;return typeof p.isVisited=="function"?function(E){return O(E)&&p.isVisited(E)}:l},active:function(O,d,g){var p=g.adapter;return typeof p.isActive=="function"?function(E){return O(E)&&p.isActive(E)}:l}};function y(O,d){for(var g=0;O&&g<O.length;g++)if(d.isTag(O[g]))return O[g]}var T={empty:function(O,d){return!d.getChildren(O).some(function(g){return d.isTag(g)||g.type==="text"})},"first-child":function(O,d){return y(d.getSiblings(O),d)===O},"last-child":function(O,d){for(var g=d.getSiblings(O),p=g.length-1;p>=0;p--){if(g[p]===O)return!0;if(d.isTag(g[p]))break}return!1},"first-of-type":function(O,d){for(var g=d.getSiblings(O),p=0;p<g.length;p++)if(d.isTag(g[p])){if(g[p]===O)return!0;if(d.getName(g[p])===d.getName(O))break}return!1},"last-of-type":function(O,d){for(var g=d.getSiblings(O),p=g.length-1;p>=0;p--)if(d.isTag(g[p])){if(g[p]===O)return!0;if(d.getName(g[p])===d.getName(O))break}return!1},"only-of-type":function(O,d){for(var g=d.getSiblings(O),p=0,x=g.length;p<x;p++)if(d.isTag(g[p])){if(g[p]===O)continue;if(d.getName(g[p])===d.getName(O))return!1}return!0},"only-child":function(O,d){for(var g=d.getSiblings(O),p=0;p<g.length;p++)if(d.isTag(g[p])&&g[p]!==O)return!1;return!0},link:function(O,d){return d.hasAttrib(O,"href")},selected:function(O,d){if(d.hasAttrib(O,"selected"))return!0;if(d.getName(O)!=="option")return!1;var g=d.getParent(O);if(!g||d.getName(g)!=="select"||d.hasAttrib(g,"multiple"))return!1;for(var p=d.getChildren(g),x=!1,E=0;E<p.length;E++)if(d.isTag(p[E]))if(p[E]===O)x=!0;else if(x){if(d.hasAttrib(p[E],"selected"))return!1}else return!1;return x},disabled:function(O,d){return d.hasAttrib(O,"disabled")},enabled:function(O,d){return!d.hasAttrib(O,"disabled")},checked:function(O,d){return d.hasAttrib(O,"checked")||T.selected(O,d)},required:function(O,d){return d.hasAttrib(O,"required")},optional:function(O,d){return!d.hasAttrib(O,"required")},parent:function(O,d){return!T.empty(O,d)},header:w(["h1","h2","h3","h4","h5","h6"]),button:function(O,d){var g=d.getName(O);return g==="button"||g==="input"&&d.getAttributeValue(O,"type")==="button"},input:w(["input","textarea","select","button"]),text:function(O,d){var g;return d.getName(O)==="input"&&(!(g=d.getAttributeValue(O,"type"))||g.toLowerCase()==="text")}};function w(O){if(typeof Set<"u"){var d=new Set(O);return function(g,p){return d.has(p.getName(g))}}return function(g,p){return O.indexOf(p.getName(g))>=0}}function I(O,d,g){if(g===null){if(O.length>2&&d!=="scope")throw new Error("pseudo-selector :"+d+" requires an argument")}else if(O.length===2)throw new Error("pseudo-selector :"+d+" doesn't have any arguments")}var S=/^(?:(?:nth|last|first|only)-(?:child|of-type)|root|empty|(?:en|dis)abled|checked|not)$/;i.exports={compile:function(O,d,g,p){var x=d.name,E=d.data,R=g.adapter;if(g&&g.strict&&!S.test(x))throw new Error(":"+x+" isn't part of CSS3");if(typeof u[x]=="function")return u[x](O,E,g,p);if(typeof T[x]=="function"){var D=T[x];return I(D,x,E),D===l?D:O===c?function(M){return D(M,R,E)}:function(M){return D(M,R,E)&&O(M)}}else throw new Error("unmatched pseudo-class :"+x)},filters:u,pseudos:T}},function(i,e,t){var r=t(284),n=t(285);i.exports=function(c){return n(r(c))},i.exports.parse=r,i.exports.compile=n},function(i,e){i.exports=r;var t=/^([+\-]?\d*n)?\s*(?:([+\-]?)\s*(\d+))?$/;function r(n){if(n=n.trim().toLowerCase(),n==="even")return[2,0];if(n==="odd")return[2,1];var s=n.match(t);if(!s)throw new SyntaxError("n-th rule couldn't be parsed ('"+n+"')");var c;return s[1]?(c=parseInt(s[1],10),isNaN(c)&&(s[1].charAt(0)==="-"?c=-1:c=1)):c=0,[c,s[3]?parseInt((s[2]||"")+s[3],10):0]}},function(i,e,t){i.exports=c;var r=t(273),n=r.trueFunc,s=r.falseFunc;function c(l){var f=l[0],h=l[1]-1;if(h<0&&f<=0)return s;if(f===-1)return function(u){return u<=h};if(f===0)return function(u){return u===h};if(f===1)return h<0?n:function(u){return u>=h};var v=h%f;return v<0&&(v+=f),f>1?function(u){return u>=h&&u%f===v}:(f*=-1,function(u){return u<=h&&u%f===v})}},function(i,e,t){t.r(e),t.d(e,"default",function(){return E});var r=t(12),n=t(74),s=t(1),c=t(68),l=t(250),f=t(213),h=t(218);t(1).glMatrix.setMatrixArrayType(Array);function v(R,D){if(R==null)return{};var U=u(R,D),M,W;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(R);for(W=0;W<X.length;W++)M=X[W],!(D.indexOf(M)>=0)&&Object.prototype.propertyIsEnumerable.call(R,M)&&(U[M]=R[M])}return U}function u(R,D){if(R==null)return{};var U={},M=Object.keys(R),W,X;for(X=0;X<M.length;X++)W=M[X],!(D.indexOf(W)>=0)&&(U[W]=R[W]);return U}const y={antialias:!0,autoRender:!0,alpha:!0},T=Symbol("autoRender"),w=Symbol("renderer"),I=Symbol("timeline"),S=Symbol("prepareRender"),O=Symbol("tickRender"),d=Symbol("pass"),g=Symbol("fbo"),p=Symbol("tickers"),x=Symbol("layerTransformInvert");class E extends l.default{constructor(D={}){if(super(),!D.canvas){const{width:X,height:B}=this.getResolution(),N=r.ENV.createCanvas(X,B,{offscreen:!!D.offscreen,id:D.id,extra:D.extra});N.style&&(N.style.position="absolute"),N.dataset&&(N.dataset.layerId=D.id),N.contextType&&(D.contextType=N.contextType),D.canvas=N}const U=D.canvas,M=Object.assign({},y,D);this[T]=M.autoRender,delete D.autoRender;const W=M.Renderer||r.Renderer;this[w]=new W(U,M),this.options=D,this.id=D.id,this[d]=[],this.setResolution(U),this.canvas=U,this[I]=new n.Timeline,this.__mouseCapturedTarget=null,this[x]=null}get autoRender(){return this[T]}get displayRatio(){return this.parent&&this.parent.options?this.parent.options.displayRatio:1}get height(){const{height:D}=this.getResolution();return D/this.displayRatio}get gl(){return this.renderer.glRenderer?this.renderer.glRenderer.gl:null}get layer(){return this}get offscreen(){return!!this.options.offscreen||this.canvas._offscreen}get pass(){return this[d]}get prepareRender(){return this[S]?this[S]:Promise.resolve()}get renderer(){return this[w]}get renderOffset(){if(this.parent&&this.parent.options){const{left:D,top:U}=this.parent.options;return[D,U]}return[this.options.left|0,this.options.top|0]}get timeline(){return this[I]}get width(){const{width:D}=this.getResolution();return D/this.displayRatio}get localMatrix(){const{x:D,y:U}=this.attributes;return[1,0,0,1,D,U]}get layerTransformInvert(){if(this[x])return this[x];const D=this.transformMatrix;return D[0]===1&&D[1]===0&&D[2]===0&&D[3]===1&&D[4]===0&&D[5]===0?null:(this[x]=s.mat2d.invert(Array.of(0,0,0,0,0,0),D),this[x])}forceContextLoss(){const D=this.renderer.glRenderer;if(D){const U=D.getExtension("WEBGL_lose_context");if(U)return U.loseContext(),!0}return!1}addPass({vertex:D,fragment:U,options:M,uniforms:W}={}){if(this.renderer.glRenderer){const{width:X,height:B}=this.getResolution(),N=this.renderer.createPassProgram({vertex:D,fragment:U,options:M}),$=new r.Figure2D;$.rect(0,0,X/this.displayRatio,B/this.displayRatio);const J=new r.Mesh2D($);return J.setUniforms(W),J.setProgram(N),this[d].push(J),this.forceUpdate(),J}return null}deleteTexture(D){return Object(h.deleteTexture)(D,this.renderer)}dispatchPointerEvent(D){const U=D.type;if(U==="mousedown"||U==="mouseup"||U==="mousemove"){const N=this.__mouseCapturedTarget;if(N){if(N.layer===this)return N.dispatchEvent(D),!0;this.__mouseCapturedTarget=null}}let M,W;const X=this.layerTransformInvert;if(X){M=D.x,W=D.y;const N=X,$=N[0]*M+N[2]*W+N[4],J=N[1]*M+N[3]*W+N[5];delete D.x,delete D.y,delete D.layerX,delete D.layerY,Object.defineProperties(D,{layerX:{value:$,configurable:!0},layerY:{value:J,configurable:!0},x:{value:$,configurable:!0},y:{value:J,configurable:!0}})}const B=super.dispatchPointerEvent(D);return X&&Object.defineProperties(D,{layerX:{value:M,configurable:!0},layerY:{value:W,configurable:!0},x:{value:M,configurable:!0},y:{value:W,configurable:!0}}),B}forceUpdate(){if(!this[S])if(this.parent&&this.parent.hasOffscreenCanvas){this.parent.forceUpdate();let D=null;const U=new Promise(M=>{D=M});U._resolve=D,this[S]=U}else{let D=null,U=null;const M=new Promise(W=>{D=W,this[T]&&(U=Object(c.requestAnimationFrame)(()=>{delete M._requestID,this.render()}))});M._resolve=D,M._requestID=U,this[S]=M}}getFBO(){const D=this.renderer.glRenderer,{width:U,height:M}=this.getResolution();return D&&(!this[g]||this[g].width!==U||this[g].height!==M)?(this[g]={width:U,height:M,target:D.createFBO(),buffer:D.createFBO(),swap(){[this.target,this.buffer]=[this.buffer,this.target]}},this[g]):this[g]?this[g]:null}updateGlobalTransform(){if(this.layerTransformInvert){const D=this.renderer,U=D.__globalTransformMatrix||D.globalTransformMatrix;D.__globalTransformMatrix=U;const M=s.mat2d.fromValues(1,0,0,1,0,0);D.setGlobalTransform(...s.mat2d.multiply(M,U,this.transformMatrix))}}onPropertyChange(D,U,M){if(super.onPropertyChange(D,U,M),D==="zIndex"&&(this.canvas.style.zIndex=U),D==="transform"||D==="translate"||D==="rotate"||D==="scale"||D==="skew"){const W=this[x];if(this[x]=null,this.updateGlobalTransform(),W&&!this.layerTransformInvert){const X=this.renderer,B=X.__globalTransformMatrix||X.globalTransformMatrix;X.setGlobalTransform(...B)}}}_prepareRenderFinished(){this[S]&&(this[S]._requestID&&Object(c.cancelAnimationFrame)(this[S]._requestID),this[S]._resolve(),delete this[S])}render({clear:D=!0}={}){const U=this[d].length?this.getFBO():null;U&&this.renderer.glRenderer.bindFBO(U.target),D&&this[w].clear();const M=this.draw();if(M&&M.length&&(this.renderer.drawMeshes(M),this.canvas.draw&&this.canvas.draw()),U){const W=this.renderer.glRenderer,X=this[d].length,{width:B,height:N}=this.getResolution(),$=[0,0,B/this.displayRatio,N/this.displayRatio];this[d].forEach((J,tt)=>{J.blend=!0,J.setTexture(U.target.texture,{rect:$}),tt===X-1?W.bindFBO(null):(U.swap(),W.bindFBO(U.target)),this[w].clear(),this.renderer.drawMeshes([J])})}this._prepareRenderFinished()}setResolution({width:D,height:U}){const M=this.renderer,W=M.__globalTransformMatrix||M.globalTransformMatrix,X=W[4],B=W[5],N=W[0],{width:$,height:J}=this.getResolution();($!==D||J!==U)&&(super.setResolution({width:D,height:U}),this.canvas&&(this.canvas.width=D,this.canvas.height=U,M.updateResolution&&M.updateResolution()),this.attributes.size=[D,U],this[d].length&&this[d].forEach(V=>{const Q=new r.Figure2D;Q.rect(0,0,D/this.displayRatio,U/this.displayRatio),V.contours=Q.contours}));const[tt,at]=this.renderOffset,ut=this.displayRatio;(X!==tt||B!==at||N!==ut)&&(M.setGlobalTransform(ut,0,0,ut,tt,at),M.__globalTransformMatrix=null,this[x]=null,this.updateGlobalTransform(),this.forceUpdate())}tick(D=null,U={}){let{duration:M=1/0}=U,W=v(U,["duration"]);const X=this.timeline.fork(W),B=this;this[p]=this[p]||[],this[p].push({handler:D,duration:M});const N=()=>{let $=null,J=null;const tt=()=>{const at=this[p].map(({handler:ut,duration:V})=>{const Q=Math.min(1,X.currentTime/V);return{value:ut?ut(X.currentTime,Q):null,p:Q}});B[O]||(B[O]=Promise.resolve().then(()=>{B[T]&&B.render(),delete B[O];for(let ut=at.length-1;ut>=0;ut--){const{value:V,p:Q}=at[ut];(V===!1||Q>=1)&&this[p].splice(ut,1)}this[p].length>0&&N()}))};if(this[S]&&this[S]._type!=="ticker"&&(Object(c.cancelAnimationFrame)(this[S]._requestID),delete this[S]),!this[S]){const at=new Promise(ut=>{$=ut,J=Object(c.requestAnimationFrame)(tt)});at._resolve=$,at._requestID=J,at._type="ticker",this[S]=at}};N()}toGlobalPos(D,U){if(this.layerTransformInvert){const $=this.transformMatrix;D=$[0]*D+$[2]*U+$[4],U=$[1]*D+$[3]*U+$[5]}const{width:M,height:W}=this.getResolution(),X=this.renderOffset,B=[this.canvas.clientWidth,this.canvas.clientHeight];D=D*B[0]/M+X[0],U=U*B[1]/W+X[1];const N=this.displayRatio;return D*=N,U*=N,[D,U]}toLocalPos(D,U){const{width:M,height:W}=this.getResolution(),X=this.renderOffset,B=[this.canvas.clientWidth,this.canvas.clientHeight];D=D*M/B[0]-X[0],U=U*W/B[1]-X[1];const N=this.displayRatio;D/=N,U/=N;const $=this.layerTransformInvert;return $&&(D=$[0]*D+$[2]*U+$[4],U=$[1]*D+$[3]*U+$[5]),[D,U]}}f.default.registerNode(E,"layer")},function(i,e,t){t.r(e),t.d(e,"default",function(){return S});var r=t(224),n=t(288),s=t(213),c=t(252),l=t(72);t(1).glMatrix.setMatrixArrayType(Array);function f(O,d){if(O==null)return{};var g=h(O,d),p,x;if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(O);for(x=0;x<E.length;x++)p=E[x],!(d.indexOf(p)>=0)&&Object.prototype.propertyIsEnumerable.call(O,p)&&(g[p]=O[p])}return g}function h(O,d){if(O==null)return{};var g={},p=Object.keys(O),x,E;for(E=0;E<p.length;E++)x=p[E],!(d.indexOf(x)>=0)&&(g[x]=O[x]);return g}function v(O,d,g){return d in O?Object.defineProperty(O,d,{value:g,enumerable:!0,configurable:!0,writable:!0}):O[d]=g,O}const u="http://www.w3.org/2000/svg",y=Symbol.for("spritejs_setAttribute"),T=Symbol("root"),w=Symbol("task");function I(O,d=!0){const g=O[T];if(g&&g.children[0]){const p=O.svg,x=O.layer?O.layer.displayRatio:1;if(!p.hasAttribute("data-original-width")){let D=p.getAttribute("width");D=D?Object(l.sizeToPixel)(D):300;let U=p.getAttribute("height");U=U?Object(l.sizeToPixel)(U):150,p.hasAttribute("viewBox")||p.setAttribute("viewBox",`0 0 ${Math.round(D)} ${Math.round(U)}`),p.setAttribute("data-original-width",D),p.setAttribute("data-original-height",U)}let E=O.attributes.width||Number(p.getAttribute("data-original-width")),R=O.attributes.height||Number(p.getAttribute("data-original-height"));if(E*=x,R*=x,d&&O.attributes.flexible){const D=O.attributes.scale[0];if(E*=D,R*=D,p.setAttribute("width",E),p.setAttribute("height",R),E&&R&&O.textureImage){const U=O.textureImage.width,M=O.textureImage.height,W=O.clientSize;O.attributes.textureRect=[0,0,Math.round(W[0]*U/E),Math.round(W[1]*M/R)]}}else O[w]||(p.setAttribute("width",E),p.setAttribute("height",R),O[w]=Promise.resolve().then(()=>{delete O[w];const D=g.innerHTML,U=new Blob([D],{type:"image/svg+xml"}),M=URL.createObjectURL(U),W=new Image;W.onload=function(){W.width&&W.height?(O.attributes[y]("texture",W),O.attributes.flexible&&(O.attributes.textureRect=null)):O.attributes[y]("texture",null)},W.src=M}))}}class S extends r.default{constructor(d={}){typeof d=="string"&&(d={svgText:d});let{svgText:g}=d,p=f(d,["svgText"]);if(super(p),this[T]=document.createElement("div"),g){this[T].innerHTML=g;const x=this[T].children[0];x?x.setAttribute("xmlns",u):(fetch(g).then(E=>E.text()).then(E=>{this[T].innerHTML=E,(!this.observer||this.attributes.flexible)&&I(this)}),g=null)}if(!g){const x=document.createElementNS(u,"svg");x.setAttribute("xmlns",u),this[T].appendChild(x)}if(typeof MutationObserver=="function"){const x=new MutationObserver(E=>{I(this,!1)});x.observe(this[T],{attributes:!0,subtree:!0,characterData:!0,childList:!0}),this.observer=x}}get children(){return[this.svg]}get childNodes(){return[this.svg]}get svg(){return this[T]?this[T].children[0]:null}setResolution({width:d,height:g}){super.setResolution({width:d,height:g}),I(this)}dispatchPointerEvent(d){const g=super.dispatchPointerEvent(d);if(g&&this.attributes.passEvents&&typeof MouseEvent=="function"){const{x:p,y:x}=d;let[E,R]=this.getOffsetPosition(p,x);const D=d.originalEvent,U=this.attributes.anchor,M=this.clientSize;E=(E+U[0]*M[0])/2,R=(R+U[1]*M[1])/2;const W=d.type;if(W===D.type){let X=null;if(D instanceof MouseEvent)X=new MouseEvent(W,{screenX:E,screenY:R,clientX:E,clientY:R,bubbles:D.bubbles,button:D.button,buttons:D.buttons,cancelBubble:D.cancelBubble,cancelable:D.cancelable,currentTarget:D.currentTarget,fromElement:D.fromElement,relatedTarget:D.relatedTarget,returnValue:D.returnValue,srcElement:D.srcElement,target:D.target,toElement:D.toElement,which:D.witch});else if(D instanceof TouchEvent){let B=null;const N=D.changedTouches||[D];for(let $=0;$<N.length;$++){const J=N[$];if(d.identifier===J.identifier){B=J;break}}if(B){const $=new Touch({identifier:B.identifier,target:B.target,clientX:E,clientY:R,screenX:E,screenY:R,pageX:E,pageY:R,radiusX:B.radiusX,radiusY:B.radiusY,rotationAngle:B.rotationAngle,force:B.force});X=new TouchEvent(W,{cancelable:D.cancelable,bubbles:D.bubbles,composed:D.composed,touches:[$],targetTouches:[$],changedTouches:[$]})}}else X=D;X&&this.svg.dispatchEvent(X)}}return g}getElementById(d){return Object(c.querySelector)(`#${d}`,this)}getElementsByClassName(d){return Object(c.querySelectorAll)(`.${d}`,this)}getElementsByName(d){return Object(c.querySelectorAll)(`[name="${d}"]`,this)}getElementsByTagName(d){return Object(c.querySelectorAll)(d,this)}querySelector(d){return Object(c.querySelector)(d,this)}querySelectorAll(d){return Object(c.querySelectorAll)(d,this)}onPropertyChange(d,g,p){super.onPropertyChange(d,g,p),d==="flexible"&&I(this),this.attributes.flexible&&(d==="width"||d==="height"||d==="scale"||d==="transform")&&I(this)}}v(S,"Attr",n.default),s.default.registerNode(S,"spritesvg")},function(i,e,t){t.r(e),t.d(e,"default",function(){return l});var r=t(225);t(1).glMatrix.setMatrixArrayType(Array);const n=Symbol.for("spritejs_getAttribute"),s=Symbol.for("spritejs_setAttribute"),c=Symbol.for("spritejs_setAttributeDefault");class l extends r.default{constructor(h){super(h),this[c]({passEvents:!1,flexible:!1})}get texture(){return this[n]("texture")}set texture(h){}get passEvents(){return this[n]("passEvents")}set passEvents(h){return this[s]("passEvents",h)}get flexible(){return this[n]("flexible")}set flexible(h){return this[s]("flexible",h)}}},function(i,e,t){t.r(e);var r=t(12);t(1).glMatrix.setMatrixArrayType(Array);function n(h,v){var u=Object.keys(h);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(h);v&&(y=y.filter(function(T){return Object.getOwnPropertyDescriptor(h,T).enumerable})),u.push.apply(u,y)}return u}function s(h){for(var v=1;v<arguments.length;v++){var u=arguments[v]!=null?arguments[v]:{};v%2?n(Object(u),!0).forEach(function(y){c(h,y,u[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(u)):n(Object(u)).forEach(function(y){Object.defineProperty(h,y,Object.getOwnPropertyDescriptor(u,y))})}return h}function c(h,v,u){return v in h?Object.defineProperty(h,v,{value:u,enumerable:!0,configurable:!0,writable:!0}):h[v]=u,h}const l=Symbol("inited");let f=null;typeof Worker=="function"&&(f=class extends Worker{constructor(h){if(h.worker===!0&&(h.worker=`./${h.id}.worker.js`),super(h.worker),this.options=h,!h.canvas){const{width:v,height:u}=this.getResolution(),y=r.ENV.createCanvas(v,u,{offscreen:!1});y.style&&(y.style.position="absolute"),y.dataset&&(y.dataset.layerId=h.id),h.canvas=y}this.canvas=h.canvas}get id(){return this.options.id}setResolution({width:h,height:v}){if(this[l])this.postMessage({type:"resolution_change",width:h,height:v});else{this.canvas.width=h,this.canvas.height=v;const u=this.options,y=u.canvas.transferControlToOffscreen(),T=s({},u);delete T.container,T.canvas=y,this.postMessage({type:"create",options:T},[y]),this[l]=!0}}getResolution(){if(this.canvas){const{width:h,height:v}=this.canvas;return{width:h,height:v}}return{width:300,height:150}}remove(){return this.parent&&this.parent.removeChild?(this.parent.removeChild(this),!0):!1}connect(h,v){Object.defineProperty(this,"parent",{value:h,writable:!1,configurable:!0}),Object.defineProperty(this,"zOrder",{value:v,writable:!1,configurable:!0})}disconnect(){delete this.parent,delete this.zOrder}dispatchPointerEvent(h){this.postMessage({type:"event",event:{cancelBubble:h.cancelBubble,bubbles:h.bubbles,detail:h.detail,identifier:h.identifier,layerX:h.layerX,layerY:h.layerY,originalX:h.originalX,originalY:h.originalY,type:h.type,x:h.x,y:h.y}})}}),e.default=f},function(i,e,t){t.r(e),(function(r){t.d(e,"default",function(){return E});var n=t(12),s=t(68),c=t(70),l=t(286),f=t(289),h=t(250),v=t(291),u=t(214),y=t(218),T=t(213);t(1).glMatrix.setMatrixArrayType(Array);const w=Symbol("enteredTargets");function I(R){return R.id=R.id||`_layer${Math.random().toString(36).slice(2,12)}`,R.dataset||(R.dataset={}),R.dataset.layerId=R.id,R.connect=(D,U)=>{R.parent=D,Object.defineProperty(R,"zOrder",{value:U,writable:!1,configurable:!0})},R.disconnect=D=>{delete R.zOrder},R.canvas=R,R.getResolution=()=>({width:0,height:0}),R.setResolution=()=>!1,R.options={handleEvent:!1},R}function S(R,D){const U=R.children;let M=null;for(let W=0;W<U.length;W++){const X=U[W];if((D===X||M!=null)&&(M=X),M&&M!==D&&!M.offscreen)return M.canvas}return null}function O(R,D){const[U,M]=R.renderOffset,{width:W,height:X}=R.getResolution(),B=R.displayRatio;R.renderer.drawImage(D.canvas,-U/B,-M/B,W/B,X/B)}const d={};function g(R){const D=["mousedown","mouseup","mousemove","mousewheel","wheel","touchstart","touchend","touchmove","touchcancel","click","dblclick","longpress","tap","contextmenu"],U=R.container;U.addEventListener("mouseleave",M=>{const W=R[w];if(W.size){const X=new u.default("mouseleave");X.setOriginalEvent(M),[...W].forEach(B=>{B.dispatchEvent(X)}),R[w].clear()}},{passive:!0}),D.forEach(M=>{U.addEventListener(M,W=>{const{left:X,top:B,displayRatio:N}=R.options,$=R.orderedChildren;Object(v.default)(W,{offsetLeft:X,offsetTop:B,displayRatio:N}).forEach(tt=>{const at=tt.identifier;if(tt.type==="touchmove"||tt.type==="touchend"){const V=d[at];V&&V.dispatchEvent(tt),tt.type==="touchend"&&delete d[at]}else{for(let V=$.length-1;V>=0;V--){const Q=$[V];if(Q.options.handleEvent!==!1){if(Q.dispatchPointerEvent(tt)&&tt.target!==Q)break;tt.cancelBubble=!1}}if(tt.target===$[0])for(let V=$.length-1;V>=0;V--){const Q=$[V];if(Q.options.handleEvent!==!1){tt.target=Q;break}}}const ut=tt.target;if(tt.type==="touchstart"&&(d[at]=tt.target),tt.type==="mousemove"){const V=R[w];let Q;if(ut){const yt=ut.ancestors||[];Q=new Set([ut,...yt])}else Q=new Set;const ft=Object.entries(W);if(!V.has(ut)&&ut){const yt=new u.default("mouseenter");yt.setOriginalEvent(W),ft.forEach(([ht,Nt])=>{yt[ht]=Nt}),V.add(ut),ut.dispatchEvent(yt);const wt=ut.ancestors;wt&&wt.forEach(ht=>{ht instanceof c.default&&!V.has(ht)&&(V.add(ht),ht.dispatchEvent(yt))})}const mt=new u.default("mouseleave");mt.setOriginalEvent(W),ft.forEach(([yt,wt])=>{mt[yt]=wt}),[...V].forEach(yt=>{Q.has(yt)||(V.delete(yt),yt.dispatchEvent(mt))})}})},{passive:M!=="contextmenu"})})}function p(R,D){if(D&&D.style){let{width:U,height:M,mode:W,container:X}=R;const{clientWidth:B,clientHeight:N}=X;U=U||B,M=M||N,W==="static"?(D.style.width=`${U}px`,D.style.height=`${M}px`):(D.style.top="0",D.style.left="0",D.style.width=`${B}px`,D.style.height=`${N}px`,D.style.transform="",D.style.webkitTransform="")}}const x=Symbol("offscreenLayerCount");class E extends h.default{constructor(D={}){if(super(),!D.container)if(typeof n.ENV.Container=="function")D.container=new n.ENV.Container(D.width||300,D.height||150);else throw new Error("No container specified.");if(this.container=D.container,this.container.style&&(this.container.style.overflow||(this.container.style.overflow="hidden"),this.container.style.position||(this.container.style.position="relative")),this.options=D,D.displayRatio=D.displayRatio||1,D.mode=D.mode||"scale",D.left=0,D.top=0,D.autoResize=D.autoResize!==!1,D.autoResize){let U;if(typeof globalThis<"u"?U=globalThis:U=typeof window<"u"?window:r,U.addEventListener){const M=this;U.addEventListener("resize",function W(){typeof document<"u"&&document.contains(M.container)?M.resize():U.removeEventListener("resize",W)})}}this[w]=new Set,this.setResolution(D),g(this),this[x]=0}get hasOffscreenCanvas(){return this[x]>0}set displayRatio(D){this.options.displayRatio!==D&&(this.options.displayRatio=D,this.resize())}get displayRatio(){return this.options.displayRatio}set height(D){this.options.height!==D&&(this.options.height=D,this.resize())}get height(){return this.options.height}set mode(D){this.options.mode!==D&&(this.options.mode=D,this.resize())}get mode(){return this.options.mode}set width(D){this.options.width!==D&&(this.options.width=D,this.resize())}get width(){return this.options.width}appendChild(D){!(D instanceof l.default)&&!(D instanceof f.default)&&I(D);const U=super.appendChild(D),M=D.canvas;return D.offscreen?this[x]++:this.container.appendChild(M),p(this.options,M),D.setResolution(this.getResolution()),U}forceUpdate(){this.hasOffscreenCanvas&&!this._requestID&&(this._requestID=Object(s.requestAnimationFrame)(()=>{delete this._requestID,this.render()}))}insertBefore(D,U){!(D instanceof l.default)&&!(D instanceof f.default)&&I(D);const M=super.insertBefore(D,U),W=D.canvas;if(!D.offscreen){const X=S(this,D);this.container.insertBefore(W,X)}return p(this.options,W),D.setResolution(this.getResolution()),M}layer(D="default",U={}){U=Object.assign({},this.options,U),U.id=D;const M=this.orderedChildren;for(let B=0;B<M.length;B++)if(M[B].id===D)return M[B];const W=U.worker;let X;return W?X=new f.default(U):X=new l.default(U),this.appendChild(X),X}async preload(...D){const U=[],M=[],W=[];for(let X=0;X<D.length;X++){const B=D[X];let N;if(typeof B=="string")N=Object(y.loadTexture)(B);else if(Array.isArray(B))N=Object(y.loadFrames)(...B);else{const{id:$,src:J}=B;N=Object(y.loadTexture)(J,$)}N instanceof Promise||(N=Promise.resolve(N)),M.push(N.then($=>{U.push($),W[X]=$;const J=new u.default({type:"preload",detail:{current:$,loaded:U,resources:D}});this.dispatchEvent(J)}))}return await Promise.all(M),W}removeChild(D){const U=super.removeChild(D);if(U){D._prepareRenderFinished&&D._prepareRenderFinished();const M=D.canvas;M&&M.remove&&M.remove(),D.offscreen&&this[x]--}return U}render(){const D=this.orderedChildren;let U=null;const M=[];for(let W=0;W<D.length;W++){const X=D[W],B=M.length>0;if(X instanceof l.default&&!X.offscreen)if(!X.autoRender)B&&(console.warn("Some offscreen canvas will not be rendered."),M.length=0);else if(U=X,B){X.renderer.clear();for(let N=0;N<M.length;N++){const $=M[N];$.render(),O(X,$)}M.length=0,X.render({clear:!1})}else X.prepareRender&&X.render();else X.offscreen?U?(X.prepareRender&&X.render(),O(U,X)):M.push(X):X instanceof f.default&&B&&(console.warn("Some offscreen canvas will not be rendered."),M.length=0)}}replaceChild(D,U){const M=super.replaceChild(D,U);U.canvas.remove&&U.canvas.remove(),U.offscreen&&this[x]--;const W=D.canvas;if(!D.offscreen){const X=S(this,D);this.container.insertBefore(W,X)}return p(this.options,W),D.setResolution(this.getResolution()),M}resize(){const D=this.options;this.children.forEach(U=>{p(D,U.canvas)}),this.setResolution(D),this.dispatchEvent({type:"resize"})}setResolution({width:D,height:U}={}){const M=this.container,{clientWidth:W,clientHeight:X}=M;(D==null||U==null)&&(D=D??W,U=U??X);const{mode:B,displayRatio:N}=this.options;if(D*=N,U*=N,this.options.left=0,this.options.top=0,B==="stickyHeight"||B==="stickyLeft"||B==="stickyRight"){const $=D;D=W*U/X,B==="stickyHeight"&&(this.options.left=.5*(D-$)),B==="stickyRight"&&(this.options.left=D-$)}else if(B==="stickyWidth"||B==="stickyTop"||B==="stickyBottom"){const $=U;U=X*D/W,B==="stickyWidth"&&(this.options.top=.5*(U-$)),B==="stickyBottom"&&(this.options.top=U-$)}super.setResolution({width:D,height:U})}snapshot({offscreen:D=!1,layers:U}={}){const M=D?"snapshotOffScreenCanvas":"snapshotCanvas",{width:W,height:X}=this.getResolution();this[M]=this[M]||n.ENV.createCanvas(W,X,{offscreen:D});const B=this[M].getContext("2d");U=U||this.orderedChildren,this[M].width=W,this[M].height=X;for(let N=0;N<U.length;N++){const $=U[N];if(!$.options.ignoreSnapshot){$.render&&$.render();const J=$.canvas;J&&J!==$&&B.drawImage(J,0,0,W,X)}}return this[M]}}typeof document<"u"&&(E.prototype.layer3d=function(R,D={}){const U=D.url||"https://unpkg.com/sprite-extend-3d/dist/sprite-extend-3d.min.js";return new Promise((M,W)=>{const X=document.createElement("script");X.async=!1,X.src=U,X.onload=()=>{try{M(this.layer3d(R,D))}catch(B){W(B)}},document.documentElement.appendChild(X)})}),T.default.registerNode(E,"scene")}).call(this,t(22))},function(i,e,t){t.r(e),t.d(e,"default",function(){return n});var r=t(214);t(1).glMatrix.setMatrixArrayType(Array);function n(s,{offsetTop:c=0,offsetLeft:l=0,displayRatio:f=1}={}){let h,v;const u=[],{left:y,top:T,width:w,height:I}=s.target.getBoundingClientRect(),S=s.target.width,O=s.target.height,d=s.changedTouches||[s];for(let p=0;p<d.length;p++){const x=d[p],E=x.identifier,{clientX:R,clientY:D}=x;R!=null&&D!=null&&u.push({x:Math.round((R|0)-y),y:Math.round((D|0)-T),identifier:E})}u.length<=0&&u.push({x:h,y:v});const g=[];return u.forEach(p=>{p.x!=null&&p.y!=null&&(h=(p.x*S/w-l)/f,v=(p.y*O/I-c)/f);const x=new r.default(s);Object.defineProperties(x,{layerX:{value:h,configurable:!0},layerY:{value:v,configurable:!0},originalX:{value:p.x},originalY:{value:p.y},x:{value:h,configurable:!0},y:{value:v,configurable:!0},identifier:{value:p.identifier}}),g.push(x)}),g}}]);Ie.version,Ie.Arc,Ie.Block,Ie.Cloud,Ie.Color;const tn=Ie.Ellipse;Ie.Gradient;const Je=Ie.Group,fd=Ie.Label,Ao=Ie.Layer;Ie.LayerWorker,Ie.Node,Ie.Parallel;const gn=Ie.Path,en=Ie.Polyline,Eo=Ie.Rect;Ie.Regular,Ie.Ring;const Fl=Ie.Scene,Ul=Ie.Sprite;Ie.SpriteSvg,Ie.Star,Ie.Triangle,Ie.helpers,Ie.createElement,Ie.isSpriteNode,Ie.registerNode,Ie.requestAnimationFrame,Ie.cancelAnimationFrame,Ie.ENV;var Ee=(i=>(i.Normal="Normal",i.Stroke="Stroke",i.Dotted="Dotted",i.LongDotted="LongDotted",i))(Ee||{}),de=(i=>(i.None="None",i.ShowFloatBar="ShowFloatBar",i.ZIndexFloatBar="ZIndexFloatBar",i.DeleteNode="DeleteNode",i.CopyNode="CopyNode",i.ZIndexNode="ZIndexNode",i.ZIndexBackgroundSVG="ZIndexBackgroundSVG",i.RotateNode="RotateNode",i.SetColorNode="SetColorNode",i.TranslateNode="TranslateNode",i.ScaleNode="ScaleNode",i.OriginalEvent="OriginalEvent",i.CreateScene="CreateScene",i.ActiveCursor="ActiveCursor",i.MoveCursor="MoveCursor",i.CommandEditor="CommandEditor",i.SetEditorData="SetEditorData",i.SetFontStyle="SetFontStyle",i.SetPoint="SetPoint",i.SetLock="SetLock",i.SetShapeOpt="SetShapeOpt",i.CameraChange="CameraChange",i.ActiveMethod="ActiveMethod",i.HidFloatBarBtn="HidFloatBarBtn",i))(de||{}),xt=(i=>(i[i.Pencil=1]="Pencil",i[i.Eraser=2]="Eraser",i[i.PencilEraser=3]="PencilEraser",i[i.BitMapEraser=4]="BitMapEraser",i[i.Selector=5]="Selector",i[i.Clicker=6]="Clicker",i[i.Arrow=7]="Arrow",i[i.Hand=8]="Hand",i[i.LaserPen=9]="LaserPen",i[i.Text=10]="Text",i[i.Straight=11]="Straight",i[i.Rectangle=12]="Rectangle",i[i.Ellipse=13]="Ellipse",i[i.Star=14]="Star",i[i.Triangle=15]="Triangle",i[i.Rhombus=16]="Rhombus",i[i.Polygon=17]="Polygon",i[i.SpeechBalloon=18]="SpeechBalloon",i[i.Image=19]="Image",i[i.BackgroundSVG=20]="BackgroundSVG",i))(xt||{}),Kt=(i=>(i[i.Local=1]="Local",i[i.Service=2]="Service",i[i.Worker=3]="Worker",i))(Kt||{}),te=(i=>(i[i.Pending=0]="Pending",i[i.Start=1]="Start",i[i.Doing=2]="Doing",i[i.Done=3]="Done",i[i.Unwritable=4]="Unwritable",i))(te||{}),vt=(i=>(i[i.None=0]="None",i[i.Init=1]="Init",i[i.UpdateCamera=2]="UpdateCamera",i[i.UpdateTools=3]="UpdateTools",i[i.CreateWork=4]="CreateWork",i[i.DrawWork=5]="DrawWork",i[i.FullWork=6]="FullWork",i[i.UpdateNode=7]="UpdateNode",i[i.RemoveNode=8]="RemoveNode",i[i.Clear=9]="Clear",i[i.Select=10]="Select",i[i.Destroy=11]="Destroy",i[i.Snapshot=12]="Snapshot",i[i.BoundingBox=13]="BoundingBox",i[i.Cursor=14]="Cursor",i[i.TextUpdate=15]="TextUpdate",i[i.GetTextActive=16]="GetTextActive",i[i.TasksQueue=17]="TasksQueue",i[i.CursorHover=18]="CursorHover",i[i.CursorBlur=19]="CursorBlur",i[i.Console=20]="Console",i[i.GetImageBitMap=23]="GetImageBitMap",i[i.AuthWriter=24]="AuthWriter",i[i.AuthReader=25]="AuthReader",i[i.AuthClear=26]="AuthClear",i[i.AuthPage=27]="AuthPage",i[i.GetVNodeInfo=28]="GetVNodeInfo",i[i.UpdateDpr=29]="UpdateDpr",i[i.SetFontFace=30]="SetFontFace",i[i.ReportError=31]="ReportError",i[i.ReportLog=32]="ReportLog",i[i.BackgroundSVGUpdate=33]="BackgroundSVGUpdate",i[i.BackgroundSVGDelete=34]="BackgroundSVGDelete",i))(vt||{}),Ut=(i=>(i[i.None=0]="None",i[i.Bg=1]="Bg",i[i.ServiceFloat=2]="ServiceFloat",i[i.Float=3]="Float",i[i.TopFloat=4]="TopFloat",i))(Ut||{}),Te=(i=>(i[i.none=1]="none",i[i.all=2]="all",i[i.both=3]="both",i[i.proportional=4]="proportional",i))(Te||{}),yr=(i=>(i[i.inside=0]="inside",i[i.outside=1]="outside",i[i.intersect=2]="intersect",i))(yr||{}),es=(i=>(i.Image="image",i.Iconify="iconify",i))(es||{});class Hr{constructor(){dt(this,"localWork");dt(this,"serviceWork");dt(this,"threadEngine")}registerForWorker(e){return this.threadEngine=e,this.localWork=e.localWork,this.serviceWork=e.serviceWork,this}}class cd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.CopyNode)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.FullWork&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var n;const{workId:r}=t;r&&await((n=this.localWork)==null?void 0:n.consumeFull(t))}}const Vn="++",Me="selector",ud="all";class hd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.SetColorNode)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var v;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,needUndoTicker:h}=t;r===Me&&n&&await((v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,callback:this.updateSelectorCallback,needUndoTicker:h}))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s}=t,{willSyncService:c,isSync:l,textUpdateForWoker:f,needUndoTicker:h}=r,v=n.render||[],u=n.sp||[];if(c)for(const[y,T]of s.entries())f&&T.toolsType===xt.Text?u.push({...T,workId:y,type:vt.TextUpdate,dataType:Kt.Local,willSyncService:!0}):u.push({...T,workId:y,type:vt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l});return h&&u.push({type:vt.None,needUndoTicker:h}),{render:v,sp:u}}}class dd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.ZIndexNode)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var f;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l}=t;r===Me&&n&&await((f=this.localWork)==null?void 0:f.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,callback:this.updateSelectorCallback}))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s}=t,{willSyncService:c,isSync:l}=r,f=n.render||[],h=n.sp||[];if(c&&h)for(const[v,u]of s.entries())u.toolsType===xt.BackgroundSVG&&h.push({...u,workId:v,type:vt.BackgroundSVGUpdate,dataType:Kt.Local,updateNodeOpt:{useAnimation:!1}}),h.push({...u,workId:v,type:vt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l});return{render:f,sp:h}}}class pd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.TranslateNode)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var y,T;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,emitEventType:h,smoothSync:v,needUndoTicker:u}=t;r===Me&&n&&(n.workState===te.Done&&(n!=null&&n.translate)&&(n.translate[0]||n.translate[1])||n.workState!==te.Done?await((y=this.localWork)==null?void 0:y.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,isSync:!0,textUpdateForWoker:f,emitEventType:h,callback:this.updateSelectorCallback,smoothSync:v,needUndoTicker:u})):n.workState===te.Done&&((T=this.localWork)==null||T.vNodes.deleteLastTarget()))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s,workShapeNode:c,res:l,smoothSync:f}=t,{willSyncService:h,isSync:v,updateSelectorOpt:u,textUpdateForWoker:y,needUndoTicker:T}=r,w=u.workState,I=n.render||[],S=n.sp||[];if(w===te.Start)return{sp:[],render:[]};const O=l==null?void 0:l.selectRect;if(h){S.push({type:vt.Select,selectIds:c.selectIds,selectRect:O,willSyncService:w===te.Done?!0:f,isSync:!0,points:w===te.Done&&c.getChildrenPoints()||void 0,textOpt:c.textOpt});const d={useAnimation:u.useAnimation||!1};u.uid&&(d.uid=u.uid);for(const[g,p]of s.entries())p.toolsType===xt.BackgroundSVG&&S.push({...p,workId:g,type:vt.BackgroundSVGUpdate,dataType:Kt.Local,willSyncService:w===te.Done?!0:f,updateNodeOpt:d}),y&&p.toolsType===xt.Text?S.push({...p,workId:g,type:vt.TextUpdate,dataType:Kt.Local,willSyncService:w===te.Done?!0:f,updateNodeOpt:d}):(f||w===te.Done)&&S.push({...p,workId:g,type:vt.UpdateNode,updateNodeOpt:d,isSync:v})}return T&&S.push({type:vt.None,needUndoTicker:T}),{render:I,sp:S}}}class vd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.ScaleNode)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var h;const{workId:r,updateNodeOpt:n,willSyncService:s,willSerializeData:c,smoothSync:l,needUndoTicker:f}=t;r===Me&&n&&await((h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willSyncService:s,willSerializeData:c,isSync:!0,callback:this.updateSelectorCallback.bind(this),smoothSync:l,needUndoTicker:f}))}updateSelectorCallback(t){const{param:r,postData:n,workShapeNode:s,res:c,newServiceStore:l,smoothSync:f}=t,{updateSelectorOpt:h,willSyncService:v,needUndoTicker:u}=r,y=h.workState,T=n.render||[],w=n.sp||[],I=c==null?void 0:c.selectRect;if(y===te.Start)return{sp:[],render:[]};if(v){w.push({type:vt.Select,selectIds:s.selectIds,selectRect:I,willSyncService:y===te.Done?!0:f,isSync:!0,points:y===te.Done&&s.getChildrenPoints()||void 0,textOpt:s.textOpt});const S={useAnimation:h.useAnimation||!1};h.uid&&(S.uid=h.uid);for(const[O,d]of l.entries())d.toolsType===xt.BackgroundSVG&&w.push({...d,workId:O,type:vt.BackgroundSVGUpdate,dataType:Kt.Local,willSyncService:y===te.Done?!0:f,updateNodeOpt:S}),d.toolsType===xt.Text?w.push({...d,workId:O,type:vt.TextUpdate,dataType:Kt.Local,willSyncService:y===te.Done?!0:f,updateNodeOpt:S}):(f||y===te.Done)&&w.push({...d,workId:O,type:vt.UpdateNode,updateNodeOpt:S,isSync:!0})}return u&&w.push({type:vt.None,needUndoTicker:u}),{render:T,sp:w}}}class gd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.RotateNode)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var u;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,emitEventType:f,smoothSync:h,needUndoTicker:v}=t;r===Me&&n&&await((u=this.localWork)==null?void 0:u.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,emitEventType:f,isSync:!0,callback:this.updateSelectorCallback,smoothSync:h,needUndoTicker:v}))}updateSelectorCallback(t){const{param:r,postData:n,workShapeNode:s,res:c,newServiceStore:l,smoothSync:f}=t,{updateSelectorOpt:h,willSyncService:v,willSerializeData:u,isSync:y,needUndoTicker:T}=r,w=h.workState,I=n.render||[],S=n.sp||[],O=c==null?void 0:c.selectRect;if(v){u&&w===te.Done&&S.push({type:vt.Select,selectIds:s.selectIds,selectRect:O,willSyncService:!0,isSync:y,points:s.getChildrenPoints(),textOpt:s.textOpt,selectorColor:s.selectorColor,strokeColor:s.strokeColor,fillColor:s.fillColor,canTextEdit:s.canTextEdit,canRotate:s.canRotate,scaleType:s.scaleType,opt:s.getWorkOptions()||void 0,canLock:s.canLock,isLocked:s.isLocked,toolsTypes:s.toolsTypes,shapeOpt:s.shapeOpt,thickness:s.thickness,useStroke:s.useStroke,strokeType:s.strokeType});const d={useAnimation:h.useAnimation||!1};if(h.uid&&(d.uid=h.uid),f||w===te.Done)for(const[g,p]of l.entries())S.push({...p,workId:g,type:vt.UpdateNode,updateNodeOpt:d,isSync:y})}return T&&S.push({type:vt.None,needUndoTicker:T}),{render:I,sp:S}}}class md extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.SetFontStyle)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var h;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f}=t;r===Me&&n&&await((h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,callback:this.updateSelectorCallback}))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s,workShapeNode:c,res:l}=t,{willSyncService:f,isSync:h,updateSelectorOpt:v,textUpdateForWoker:u}=r,y=n.render||[],T=n.sp||[],w=l==null?void 0:l.selectRect;if(f&&T){v.fontSize&&T.push({type:vt.Select,selectIds:c.selectIds,selectRect:w,willSyncService:f,isSync:h,points:c.getChildrenPoints()});for(const[I,S]of s.entries())u&&S.toolsType===xt.Text?T.push({...S,workId:I,type:vt.TextUpdate,dataType:Kt.Local,willSyncService:!0}):T.push({...S,workId:I,type:vt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h})}return{render:y,sp:T}}}class yd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.SetPoint)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var v;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,needUndoTicker:h}=t;r===Me&&n&&await((v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,emitEventType:this.emitEventType,willSerializeData:l,isSync:!0,textUpdateForWoker:f,callback:this.updateSelectorCallback,needUndoTicker:h}))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s,workShapeNode:c,res:l}=t,{willSyncService:f,isSync:h,needUndoTicker:v}=r,u=n.render||[],y=n.sp||[],T=l==null?void 0:l.selectRect;if(f&&y){for(const[w,I]of s.entries())y.push({...I,workId:w,type:vt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h});y.push({type:vt.Select,selectIds:c.selectIds,selectRect:T,willSyncService:f,isSync:h,points:c.getChildrenPoints()})}return v&&y.push({type:vt.None,needUndoTicker:v}),{render:u,sp:y}}}class Sd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.SetLock)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var h;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,needUndoTicker:f}=t;r===Me&&n&&await((h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,callback:this.updateSelectorCallback,needUndoTicker:f}))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s,workShapeNode:c,res:l}=t,{willSyncService:f,isSync:h,updateSelectorOpt:v,needUndoTicker:u}=r,y=n.render||[],T=n.sp||[],w=l==null?void 0:l.selectRect;if(f&&T){for(const[I,S]of s.entries())T.push({...S,workId:I,type:vt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h});T.push({isLocked:v.isLocked,selectorColor:c.selectorColor,scaleType:c.scaleType,canRotate:c.canRotate,type:vt.Select,selectIds:c.selectIds,selectRect:w,willSyncService:f,isSync:h})}return u&&T.push({type:vt.None,needUndoTicker:u}),{render:y,sp:T}}}class Pd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.SetShapeOpt)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var h;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,needUndoTicker:f}=t;r===Me&&n&&await((h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,callback:this.updateSelectorCallback,needUndoTicker:f}))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s}=t,{willSyncService:c,isSync:l,needUndoTicker:f}=r,h=n.render||[],v=n.sp||[];if(c&&v)for(const[u,y]of s.entries())v.push({...y,workId:u,type:vt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l});return f&&v.push({type:vt.None,needUndoTicker:f}),{render:h,sp:v}}}class Yl{constructor(e){dt(this,"builders",new Map);this.builders=new Map(e.map(t=>[t,this.build(t)]))}build(e){switch(e){case de.TranslateNode:return new pd;case de.ZIndexNode:return new dd;case de.CopyNode:return new cd;case de.SetColorNode:return new hd;case de.ScaleNode:return new vd;case de.RotateNode:return new gd;case de.SetFontStyle:return new md;case de.SetPoint:return new yd;case de.SetLock:return new Sd;case de.SetShapeOpt:return new Pd}}registerForWorker(e){return this.builders.forEach(t=>{t&&t.registerForWorker(e)}),this}consumeForWorker(e){for(const t of this.builders.values())if(t!=null&&t.consume(e))return!0;return!1}}const xd={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>i*(2-i),easeInOutQuad:i=>i<.5?2*i*i:-1+(4-2*i)*i,easeInCubic:i=>i*i*i,easeOutCubic:i=>--i*i*i+1,easeInOutCubic:i=>i<.5?4*i*i*i:(i-1)*(2*i-2)*(2*i-2)+1,easeInQuart:i=>i*i*i*i,easeOutQuart:i=>1- --i*i*i*i,easeInOutQuart:i=>i<.5?8*i*i*i*i:1-8*--i*i*i*i,easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>1+--i*i*i*i*i,easeInOutQuint:i=>i<.5?16*i*i*i*i*i:1+16*--i*i*i*i*i,easeInSine:i=>1-Math.cos(i*Math.PI/2),easeOutSine:i=>Math.sin(i*Math.PI/2),easeInOutSine:i=>-(Math.cos(Math.PI*i)-1)/2,easeInExpo:i=>i<=0?0:Math.pow(2,10*i-10),easeOutExpo:i=>i>=1?1:1-Math.pow(2,-10*i),easeInOutExpo:i=>i<=0?0:i>=1?1:i<.5?Math.pow(2,20*i-10)/2:(2-Math.pow(2,-20*i+10))/2};class pt{constructor(e=0,t=0,r=1){this.x=e,this.y=t,this.z=r}get XY(){return[this.x,this.y]}setz(e){return this.z=e,this}setXY(e=this.x,t=this.y){return this.x=e,this.y=t,this}set(e=this.x,t=this.y,r=this.z){return this.x=e,this.y=t,this.z=r,this}setTo({x:e=0,y:t=0,z:r=1}){return this.x=e,this.y=t,this.z=r,this}rot(e){if(e===0)return this;const{x:t,y:r}=this,n=Math.sin(e),s=Math.cos(e);return this.x=t*s-r*n,this.y=t*n+r*s,this}rotWith(e,t){if(t===0)return this;const r=this.x-e.x,n=this.y-e.y,s=Math.sin(t),c=Math.cos(t);return this.x=e.x+(r*c-n*s),this.y=e.y+(r*s+n*c),this}clone(){const{x:e,y:t,z:r}=this;return new pt(e,t,r)}sub(e){return this.x-=e.x,this.y-=e.y,this}subXY(e,t){return this.x-=e,this.y-=t,this}subScalar(e){return this.x-=e,this.y-=e,this}add(e){return this.x+=e.x,this.y+=e.y,this}addXY(e,t){return this.x+=e,this.y+=t,this}addScalar(e){return this.x+=e,this.y+=e,this}clamp(e,t){return this.x=Math.max(this.x,e),this.y=Math.max(this.y,e),t!==void 0&&(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)),this}div(e){return this.x/=e,this.y/=e,this}divV(e){return this.x/=e.x,this.y/=e.y,this}mul(e){return this.x*=e,this.y*=e,this}mulV(e){return this.x*=e.x,this.y*=e.y,this}abs(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this}nudge(e,t){const r=pt.Tan(e,this);return this.add(r.mul(t))}neg(){return this.x*=-1,this.y*=-1,this}cross(e){return this.x=this.y*e.z-this.z*e.y,this.y=this.z*e.x-this.x*e.z,this}dpr(e){return pt.Dpr(this,e)}cpr(e){return pt.Cpr(this,e)}len2(){return pt.Len2(this)}len(){return pt.Len(this)}pry(e){return pt.Pry(this,e)}per(){const{x:e,y:t}=this;return this.x=t,this.y=-e,this}uni(){return pt.Uni(this)}tan(e){return pt.Tan(this,e)}dist(e){return pt.Dist(this,e)}distanceToLineSegment(e,t){return pt.DistanceToLineSegment(e,t,this)}slope(e){return pt.Slope(this,e)}snapToGrid(e){return this.x=Math.round(this.x/e)*e,this.y=Math.round(this.y/e)*e,this}angle(e){return pt.Angle(this,e)}toAngle(){return pt.ToAngle(this)}lrp(e,t){return this.x=this.x+(e.x-this.x)*t,this.y=this.y+(e.y-this.y)*t,this}equals(e,t){return pt.Equals(this,e,t)}equalsXY(e,t){return pt.EqualsXY(this,e,t)}norm(){const e=this.len();return this.x=e===0?0:this.x/e,this.y=e===0?0:this.y/e,this}toFixed(){return pt.ToFixed(this)}toString(){return pt.ToString(pt.ToFixed(this))}toJson(){return pt.ToJson(this)}toArray(){return pt.ToArray(this)}static Add(e,t){return new pt(e.x+t.x,e.y+t.y)}static AddXY(e,t,r){return new pt(e.x+t,e.y+r)}static Sub(e,t){return new pt(e.x-t.x,e.y-t.y)}static SubXY(e,t,r){return new pt(e.x-t,e.y-r)}static AddScalar(e,t){return new pt(e.x+t,e.y+t)}static SubScalar(e,t){return new pt(e.x-t,e.y-t)}static Div(e,t){return new pt(e.x/t,e.y/t)}static Mul(e,t){return new pt(e.x*t,e.y*t)}static DivV(e,t){return new pt(e.x/t.x,e.y/t.y)}static MulV(e,t){return new pt(e.x*t.x,e.y*t.y)}static Neg(e){return new pt(-e.x,-e.y)}static Per(e){return new pt(e.y,-e.x)}static Dist2(e,t){return pt.Sub(e,t).len2()}static Abs(e){return new pt(Math.abs(e.x),Math.abs(e.y))}static Dist(e,t){return Math.hypot(e.y-t.y,e.x-t.x)}static Dpr(e,t){return e.x*t.x+e.y*t.y}static Cross(e,t){return new pt(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z)}static Cpr(e,t){return e.x*t.y-t.x*e.y}static Len2(e){return e.x*e.x+e.y*e.y}static Len(e){return Math.hypot(e.x,e.y)}static Pry(e,t){return pt.Dpr(e,t)/pt.Len(t)}static Uni(e){return pt.Div(e,pt.Len(e))}static Tan(e,t){return pt.Uni(pt.Sub(e,t))}static Min(e,t){return new pt(Math.min(e.x,t.x),Math.min(e.y,t.y))}static Max(e,t){return new pt(Math.max(e.x,t.x),Math.max(e.y,t.y))}static From(e){return new pt().add(e)}static FromArray(e){return new pt(e[0],e[1])}static Rot(e,t=0){const r=Math.sin(t),n=Math.cos(t);return new pt(e.x*n-e.y*r,e.x*r+e.y*n)}static RotWith(e,t,r){const n=e.x-t.x,s=e.y-t.y,c=Math.sin(r),l=Math.cos(r);return new pt(t.x+(n*l-s*c),t.y+(n*c+s*l))}static NearestPointOnLineThroughPoint(e,t,r){return pt.Mul(t,pt.Sub(r,e).pry(t)).add(e)}static NearestPointOnLineSegment(e,t,r,n=!0){const s=pt.Tan(t,e),c=pt.Add(e,pt.Mul(s,pt.Sub(r,e).pry(s)));if(n){if(c.x<Math.min(e.x,t.x))return pt.Cast(e.x<t.x?e:t);if(c.x>Math.max(e.x,t.x))return pt.Cast(e.x>t.x?e:t);if(c.y<Math.min(e.y,t.y))return pt.Cast(e.y<t.y?e:t);if(c.y>Math.max(e.y,t.y))return pt.Cast(e.y>t.y?e:t)}return c}static DistanceToLineThroughPoint(e,t,r){return pt.Dist(r,pt.NearestPointOnLineThroughPoint(e,t,r))}static DistanceToLineSegment(e,t,r,n=!0){return pt.Dist(r,pt.NearestPointOnLineSegment(e,t,r,n))}static Snap(e,t=1){return new pt(Math.round(e.x/t)*t,Math.round(e.y/t)*t)}static Cast(e){return e instanceof pt?e:pt.From(e)}static Slope(e,t){return e.x===t.y?NaN:(e.y-t.y)/(e.x-t.x)}static Angle(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}static Lrp(e,t,r){return pt.Sub(t,e).mul(r).add(e)}static Med(e,t){return new pt((e.x+t.x)/2,(e.y+t.y)/2)}static Equals(e,t,r=1e-4){return Math.abs(e.x-t.x)<r&&Math.abs(e.y-t.y)<r}static EqualsXY(e,t,r){return e.x===t&&e.y===r}static EqualsXYZ(e,t,r=1e-4){return pt.Equals(e,t,r)&&Math.abs((e.z||0)-(t.z||0))<r}static Clockwise(e,t,r){return(r.x-e.x)*(t.y-e.y)-(t.x-e.x)*(r.y-e.y)<0}static Rescale(e,t){const r=pt.Len(e);return new pt(t*e.x/r,t*e.y/r)}static ScaleWithOrigin(e,t,r){return pt.Sub(e,r).mul(t).add(r)}static ScaleWOrigin(e,t,r){return pt.Sub(e,r).mulV(t).add(r)}static ToFixed(e,t=2){return new pt(+e.x.toFixed(t),+e.y.toFixed(t),+e.z.toFixed(t))}static Nudge(e,t,r){return pt.Add(e,pt.Tan(t,e).mul(r))}static ToString(e){return`${e.x}, ${e.y}`}static ToAngle(e){let t=Math.atan2(e.y,e.x);return t<0&&(t+=Math.PI*2),t}static FromAngle(e,t=1){return new pt(Math.cos(e)*t,Math.sin(e)*t)}static ToArray(e){return[e.x,e.y,e.z]}static ToJson(e){const{x:t,y:r,z:n}=e;return{x:t,y:r,z:n}}static Average(e){const t=e.length,r=new pt(0,0);for(let n=0;n<t;n++)r.add(e[n]);return r.div(t)}static Clamp(e,t,r){return r===void 0?new pt(Math.min(Math.max(e.x,t)),Math.min(Math.max(e.y,t))):new pt(Math.min(Math.max(e.x,t),r),Math.min(Math.max(e.y,t),r))}static PointsBetween(e,t,r=6){const n=[];for(let s=0;s<r;s++){const c=xd.easeInQuad(s/(r-1)),l=pt.Lrp(e,t,c);l.z=Math.min(1,.5+Math.abs(.5-Td(c))*.65),n.push(l)}return n}static SnapToGrid(e,t=8){return new pt(Math.round(e.x/t)*t,Math.round(e.y/t)*t)}}const Td=i=>i<.5?2*i*i:-1+(4-2*i)*i;class Jt extends pt{constructor(e=0,t=0,r=0,n={x:0,y:0},s=0,c=0){super(e,t,r),this.x=e,this.y=t,this.z=r,this.v=n,this.t=s,this.a=c}get timestamp(){return this.t}get pressure(){return this.z}get angleNum(){return this.a}get XY(){return[this.x,this.y]}setA(e){this.a=e}setT(e){this.t=e}setv(e){return this.v={x:e.x,y:e.y},this}set(e=this.x,t=this.y,r=this.z,n=this.v,s=this.t,c=this.a){return this.x=e,this.y=t,this.z=r,this.v=n,this.t=s,this.a=c,this}clone(){const{x:e,y:t,z:r,v:n,t:s,a:c}=this,l={x:n.x,y:n.y};return new Jt(e,t,r,l,s,c)}distance(e){return Jt.GetDistance(this,e)}isNear(e,t){return Jt.IsNear(this,e,t)}getAngleByPoints(e,t){return Jt.GetAngleByPoints(e,this,t)}static Sub(e,t){return new Jt(e.x-t.x,e.y-t.y)}static Add(e,t){return new Jt(e.x+t.x,e.y+t.y)}static GetDistance(e,t){return Jt.Len(e.clone().sub(t))}static GetAngleByPoints(e,t,r){const n=t.x-e.x,s=r.x-t.x,c=t.y-e.y,l=r.y-t.y;let f=0;const h=Math.sqrt(n*n+c*c),v=Math.sqrt(s*s+l*l);if(h&&v){const u=n*s+c*l;f=Math.acos(u/(h*v)),f=f/Math.PI*180;let y=n*l-c*s;y=y>0?1:-1,f=180+y*f}return f}static IsNear(e,t,r){return Jt.Len(e.clone().sub(t))<r}static RotWith(e,t,r,n=2){const s=e.x-t.x,c=e.y-t.y,l=Math.sin(r),f=Math.cos(r),h=Math.pow(10,n),v=Math.floor((t.x+(s*f-c*l))*h)/h,u=Math.floor((t.y+(s*l+c*f))*h)/h;return new Jt(v,u)}static GetDotStroke(e,t,r=16){const n=new pt(1,1),s=Math.PI+.001,c=Jt.Add(e,Jt.Sub(e,n).uni().per().mul(-t)),l=[];for(let f=1/r,h=f;h<=1;h+=f)l.push(Jt.RotWith(c,e,s*2*h));return l}static GetSemicircleStroke(e,t,r=-1,n=8){const s=r*(Math.PI+.001),c=[];for(let l=1/n,f=l;f<=1;f+=l)c.push(Jt.RotWith(t,e,s*f));return c}}var rn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mn(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Cd=typeof rn=="object"&&rn&&rn.Object===Object&&rn,Xl=Cd,Id=Xl,Od=typeof self=="object"&&self&&self.Object===Object&&self,wd=Id||Od||Function("return this")(),Vr=wd,Ad=Vr,Ed=Ad.Symbol,Ai=Ed,zl=Ai,$l=Object.prototype,Md=$l.hasOwnProperty,Ld=$l.toString,Ei=zl?zl.toStringTag:void 0;function Rd(i){var e=Md.call(i,Ei),t=i[Ei];try{i[Ei]=void 0;var r=!0}catch{}var n=Ld.call(i);return r&&(e?i[Ei]=t:delete i[Ei]),n}var bd=Rd,Dd=Object.prototype,Nd=Dd.toString;function Bd(i){return Nd.call(i)}var Wd=Bd,jl=Ai,Fd=bd,Ud=Wd,Yd="[object Null]",Xd="[object Undefined]",Gl=jl?jl.toStringTag:void 0;function zd(i){return i==null?i===void 0?Xd:Yd:Gl&&Gl in Object(i)?Fd(i):Ud(i)}var Kn=zd;function $d(i){return i!=null&&typeof i=="object"}var nn=$d,jd=Kn,Gd=nn,kd="[object Number]";function Hd(i){return typeof i=="number"||Gd(i)&&jd(i)==kd}var Vd=Hd,Qe=mn(Vd);function Kd(){this.__data__=[],this.size=0}var Zd=Kd;function Jd(i,e){return i===e||i!==i&&e!==e}var Mo=Jd,Qd=Mo;function qd(i,e){for(var t=i.length;t--;)if(Qd(i[t][0],e))return t;return-1}var rs=qd,_d=rs,tp=Array.prototype,ep=tp.splice;function rp(i){var e=this.__data__,t=_d(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():ep.call(e,t,1),--this.size,!0}var np=rp,ip=rs;function sp(i){var e=this.__data__,t=ip(e,i);return t<0?void 0:e[t][1]}var op=sp,ap=rs;function lp(i){return ap(this.__data__,i)>-1}var fp=lp,cp=rs;function up(i,e){var t=this.__data__,r=cp(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}var hp=up,dp=Zd,pp=np,vp=op,gp=fp,mp=hp;function Zn(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}Zn.prototype.clear=dp,Zn.prototype.delete=pp,Zn.prototype.get=vp,Zn.prototype.has=gp,Zn.prototype.set=mp;var ns=Zn,yp=ns;function Sp(){this.__data__=new yp,this.size=0}var Pp=Sp;function xp(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var Tp=xp;function Cp(i){return this.__data__.get(i)}var Ip=Cp;function Op(i){return this.__data__.has(i)}var wp=Op;function Ap(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Mi=Ap,Ep=Kn,Mp=Mi,Lp="[object AsyncFunction]",Rp="[object Function]",bp="[object GeneratorFunction]",Dp="[object Proxy]";function Np(i){if(!Mp(i))return!1;var e=Ep(i);return e==Rp||e==bp||e==Lp||e==Dp}var kl=Np,Bp=Vr,Wp=Bp["__core-js_shared__"],Fp=Wp,Lo=Fp,Hl=function(){var i=/[^.]+$/.exec(Lo&&Lo.keys&&Lo.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function Up(i){return!!Hl&&Hl in i}var Yp=Up,Xp=Function.prototype,zp=Xp.toString;function $p(i){if(i!=null){try{return zp.call(i)}catch{}try{return i+""}catch{}}return""}var Vl=$p,jp=kl,Gp=Yp,kp=Mi,Hp=Vl,Vp=/[\\^$.*+?()[\]{}|]/g,Kp=/^\[object .+?Constructor\]$/,Zp=Function.prototype,Jp=Object.prototype,Qp=Zp.toString,qp=Jp.hasOwnProperty,_p=RegExp("^"+Qp.call(qp).replace(Vp,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function t0(i){if(!kp(i)||Gp(i))return!1;var e=jp(i)?_p:Kp;return e.test(Hp(i))}var e0=t0;function r0(i,e){return i==null?void 0:i[e]}var n0=r0,i0=e0,s0=n0;function o0(i,e){var t=s0(i,e);return i0(t)?t:void 0}var bn=o0,a0=bn,l0=Vr,f0=a0(l0,"Map"),Ro=f0,c0=bn,u0=c0(Object,"create"),is=u0,Kl=is;function h0(){this.__data__=Kl?Kl(null):{},this.size=0}var d0=h0;function p0(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var v0=p0,g0=is,m0="__lodash_hash_undefined__",y0=Object.prototype,S0=y0.hasOwnProperty;function P0(i){var e=this.__data__;if(g0){var t=e[i];return t===m0?void 0:t}return S0.call(e,i)?e[i]:void 0}var x0=P0,T0=is,C0=Object.prototype,I0=C0.hasOwnProperty;function O0(i){var e=this.__data__;return T0?e[i]!==void 0:I0.call(e,i)}var w0=O0,A0=is,E0="__lodash_hash_undefined__";function M0(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=A0&&e===void 0?E0:e,this}var L0=M0,R0=d0,b0=v0,D0=x0,N0=w0,B0=L0;function Jn(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}Jn.prototype.clear=R0,Jn.prototype.delete=b0,Jn.prototype.get=D0,Jn.prototype.has=N0,Jn.prototype.set=B0;var W0=Jn,Zl=W0,F0=ns,U0=Ro;function Y0(){this.size=0,this.__data__={hash:new Zl,map:new(U0||F0),string:new Zl}}var X0=Y0;function z0(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var $0=z0,j0=$0;function G0(i,e){var t=i.__data__;return j0(e)?t[typeof e=="string"?"string":"hash"]:t.map}var ss=G0,k0=ss;function H0(i){var e=k0(this,i).delete(i);return this.size-=e?1:0,e}var V0=H0,K0=ss;function Z0(i){return K0(this,i).get(i)}var J0=Z0,Q0=ss;function q0(i){return Q0(this,i).has(i)}var _0=q0,tv=ss;function ev(i,e){var t=tv(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this}var rv=ev,nv=X0,iv=V0,sv=J0,ov=_0,av=rv;function Qn(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}Qn.prototype.clear=nv,Qn.prototype.delete=iv,Qn.prototype.get=sv,Qn.prototype.has=ov,Qn.prototype.set=av;var Jl=Qn,lv=ns,fv=Ro,cv=Jl,uv=200;function hv(i,e){var t=this.__data__;if(t instanceof lv){var r=t.__data__;if(!fv||r.length<uv-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new cv(r)}return t.set(i,e),this.size=t.size,this}var dv=hv,pv=ns,vv=Pp,gv=Tp,mv=Ip,yv=wp,Sv=dv;function qn(i){var e=this.__data__=new pv(i);this.size=e.size}qn.prototype.clear=vv,qn.prototype.delete=gv,qn.prototype.get=mv,qn.prototype.has=yv,qn.prototype.set=Sv;var Ql=qn;function Pv(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var xv=Pv,Tv=bn,Cv=function(){try{var i=Tv(Object,"defineProperty");return i({},"",{}),i}catch{}}(),ql=Cv,_l=ql;function Iv(i,e,t){e=="__proto__"&&_l?_l(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var tf=Iv,Ov=tf,wv=Mo,Av=Object.prototype,Ev=Av.hasOwnProperty;function Mv(i,e,t){var r=i[e];(!(Ev.call(i,e)&&wv(r,t))||t===void 0&&!(e in i))&&Ov(i,e,t)}var ef=Mv,Lv=ef,Rv=tf;function bv(i,e,t,r){var n=!t;t||(t={});for(var s=-1,c=e.length;++s<c;){var l=e[s],f=r?r(t[l],i[l],l,t,i):void 0;f===void 0&&(f=i[l]),n?Rv(t,l,f):Lv(t,l,f)}return t}var os=bv;function Dv(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var Nv=Dv,Bv=Kn,Wv=nn,Fv="[object Arguments]";function Uv(i){return Wv(i)&&Bv(i)==Fv}var Yv=Uv,rf=Yv,Xv=nn,nf=Object.prototype,zv=nf.hasOwnProperty,$v=nf.propertyIsEnumerable,jv=rf(function(){return arguments}())?rf:function(i){return Xv(i)&&zv.call(i,"callee")&&!$v.call(i,"callee")},sf=jv,Gv=Array.isArray,Li=Gv,as={exports:{}};function kv(){return!1}var Hv=kv;as.exports,function(i,e){var t=Vr,r=Hv,n=e&&!e.nodeType&&e,s=n&&!0&&i&&!i.nodeType&&i,c=s&&s.exports===n,l=c?t.Buffer:void 0,f=l?l.isBuffer:void 0,h=f||r;i.exports=h}(as,as.exports);var bo=as.exports,Vv=9007199254740991,Kv=/^(?:0|[1-9]\d*)$/;function Zv(i,e){var t=typeof i;return e=e??Vv,!!e&&(t=="number"||t!="symbol"&&Kv.test(i))&&i>-1&&i%1==0&&i<e}var Jv=Zv,Qv=9007199254740991;function qv(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=Qv}var of=qv,_v=Kn,tg=of,eg=nn,rg="[object Arguments]",ng="[object Array]",ig="[object Boolean]",sg="[object Date]",og="[object Error]",ag="[object Function]",lg="[object Map]",fg="[object Number]",cg="[object Object]",ug="[object RegExp]",hg="[object Set]",dg="[object String]",pg="[object WeakMap]",vg="[object ArrayBuffer]",gg="[object DataView]",mg="[object Float32Array]",yg="[object Float64Array]",Sg="[object Int8Array]",Pg="[object Int16Array]",xg="[object Int32Array]",Tg="[object Uint8Array]",Cg="[object Uint8ClampedArray]",Ig="[object Uint16Array]",Og="[object Uint32Array]",Xe={};Xe[mg]=Xe[yg]=Xe[Sg]=Xe[Pg]=Xe[xg]=Xe[Tg]=Xe[Cg]=Xe[Ig]=Xe[Og]=!0,Xe[rg]=Xe[ng]=Xe[vg]=Xe[ig]=Xe[gg]=Xe[sg]=Xe[og]=Xe[ag]=Xe[lg]=Xe[fg]=Xe[cg]=Xe[ug]=Xe[hg]=Xe[dg]=Xe[pg]=!1;function wg(i){return eg(i)&&tg(i.length)&&!!Xe[_v(i)]}var Ag=wg;function Eg(i){return function(e){return i(e)}}var ls=Eg,fs={exports:{}};fs.exports,function(i,e){var t=Xl,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s&&t.process,l=function(){try{var f=n&&n.require&&n.require("util").types;return f||c&&c.binding&&c.binding("util")}catch{}}();i.exports=l}(fs,fs.exports);var Do=fs.exports,Mg=Ag,Lg=ls,af=Do,lf=af&&af.isTypedArray,Rg=lf?Lg(lf):Mg,ff=Rg,bg=Nv,Dg=sf,Ng=Li,Bg=bo,Wg=Jv,Fg=ff,Ug=Object.prototype,Yg=Ug.hasOwnProperty;function Xg(i,e){var t=Ng(i),r=!t&&Dg(i),n=!t&&!r&&Bg(i),s=!t&&!r&&!n&&Fg(i),c=t||r||n||s,l=c?bg(i.length,String):[],f=l.length;for(var h in i)(e||Yg.call(i,h))&&!(c&&(h=="length"||n&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||Wg(h,f)))&&l.push(h);return l}var cf=Xg,zg=Object.prototype;function $g(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||zg;return i===t}var No=$g;function jg(i,e){return function(t){return i(e(t))}}var uf=jg,Gg=uf,kg=Gg(Object.keys,Object),Hg=kg,Vg=No,Kg=Hg,Zg=Object.prototype,Jg=Zg.hasOwnProperty;function Qg(i){if(!Vg(i))return Kg(i);var e=[];for(var t in Object(i))Jg.call(i,t)&&t!="constructor"&&e.push(t);return e}var qg=Qg,_g=kl,tm=of;function em(i){return i!=null&&tm(i.length)&&!_g(i)}var Bo=em,rm=cf,nm=qg,im=Bo;function sm(i){return im(i)?rm(i):nm(i)}var Wo=sm,om=os,am=Wo;function lm(i,e){return i&&om(e,am(e),i)}var fm=lm;function cm(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var um=cm,hm=Mi,dm=No,pm=um,vm=Object.prototype,gm=vm.hasOwnProperty;function mm(i){if(!hm(i))return pm(i);var e=dm(i),t=[];for(var r in i)r=="constructor"&&(e||!gm.call(i,r))||t.push(r);return t}var ym=mm,Sm=cf,Pm=ym,xm=Bo;function Tm(i){return xm(i)?Sm(i,!0):Pm(i)}var Fo=Tm,Cm=os,Im=Fo;function Om(i,e){return i&&Cm(e,Im(e),i)}var wm=Om,cs={exports:{}};cs.exports,function(i,e){var t=Vr,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,v){if(v)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y}i.exports=f}(cs,cs.exports);var Am=cs.exports;function Em(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var Mm=Em;function Lm(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c)}return s}var hf=Lm;function Rm(){return[]}var df=Rm,bm=hf,Dm=df,Nm=Object.prototype,Bm=Nm.propertyIsEnumerable,pf=Object.getOwnPropertySymbols,Wm=pf?function(i){return i==null?[]:(i=Object(i),bm(pf(i),function(e){return Bm.call(i,e)}))}:Dm,Uo=Wm,Fm=os,Um=Uo;function Ym(i,e){return Fm(i,Um(i),e)}var Xm=Ym;function zm(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var Yo=zm,$m=uf,jm=$m(Object.getPrototypeOf,Object),vf=jm,Gm=Yo,km=vf,Hm=Uo,Vm=df,Km=Object.getOwnPropertySymbols,Zm=Km?function(i){for(var e=[];i;)Gm(e,Hm(i)),i=km(i);return e}:Vm,gf=Zm,Jm=os,Qm=gf;function qm(i,e){return Jm(i,Qm(i),e)}var _m=qm,ty=Yo,ey=Li;function ry(i,e,t){var r=e(i);return ey(i)?r:ty(r,t(i))}var mf=ry,ny=mf,iy=Uo,sy=Wo;function oy(i){return ny(i,sy,iy)}var yf=oy,ay=mf,ly=gf,fy=Fo;function cy(i){return ay(i,fy,ly)}var uy=cy,hy=bn,dy=Vr,py=hy(dy,"DataView"),vy=py,gy=bn,my=Vr,yy=gy(my,"Promise"),Sy=yy,Py=bn,xy=Vr,Ty=Py(xy,"Set"),Sf=Ty,Cy=bn,Iy=Vr,Oy=Cy(Iy,"WeakMap"),wy=Oy,Xo=vy,zo=Ro,$o=Sy,jo=Sf,Go=wy,Pf=Kn,_n=Vl,xf="[object Map]",Ay="[object Object]",Tf="[object Promise]",Cf="[object Set]",If="[object WeakMap]",Of="[object DataView]",Ey=_n(Xo),My=_n(zo),Ly=_n($o),Ry=_n(jo),by=_n(Go),Dn=Pf;(Xo&&Dn(new Xo(new ArrayBuffer(1)))!=Of||zo&&Dn(new zo)!=xf||$o&&Dn($o.resolve())!=Tf||jo&&Dn(new jo)!=Cf||Go&&Dn(new Go)!=If)&&(Dn=function(i){var e=Pf(i),t=e==Ay?i.constructor:void 0,r=t?_n(t):"";if(r)switch(r){case Ey:return Of;case My:return xf;case Ly:return Tf;case Ry:return Cf;case by:return If}return e});var us=Dn,Dy=Object.prototype,Ny=Dy.hasOwnProperty;function By(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&Ny.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var Wy=By,Fy=Vr,Uy=Fy.Uint8Array,wf=Uy,Af=wf;function Yy(i){var e=new i.constructor(i.byteLength);return new Af(e).set(new Af(i)),e}var ko=Yy,Xy=ko;function zy(i,e){var t=e?Xy(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var $y=zy,jy=/\w*$/;function Gy(i){var e=new i.constructor(i.source,jy.exec(i));return e.lastIndex=i.lastIndex,e}var ky=Gy,Ef=Ai,Mf=Ef?Ef.prototype:void 0,Lf=Mf?Mf.valueOf:void 0;function Hy(i){return Lf?Object(Lf.call(i)):{}}var Vy=Hy,Ky=ko;function Zy(i,e){var t=e?Ky(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var Jy=Zy,Qy=ko,qy=$y,_y=ky,t1=Vy,e1=Jy,r1="[object Boolean]",n1="[object Date]",i1="[object Map]",s1="[object Number]",o1="[object RegExp]",a1="[object Set]",l1="[object String]",f1="[object Symbol]",c1="[object ArrayBuffer]",u1="[object DataView]",h1="[object Float32Array]",d1="[object Float64Array]",p1="[object Int8Array]",v1="[object Int16Array]",g1="[object Int32Array]",m1="[object Uint8Array]",y1="[object Uint8ClampedArray]",S1="[object Uint16Array]",P1="[object Uint32Array]";function x1(i,e,t){var r=i.constructor;switch(e){case c1:return Qy(i);case r1:case n1:return new r(+i);case u1:return qy(i,t);case h1:case d1:case p1:case v1:case g1:case m1:case y1:case S1:case P1:return e1(i,t);case i1:return new r;case s1:case l1:return new r(i);case o1:return _y(i);case a1:return new r;case f1:return t1(i)}}var T1=x1,C1=Mi,Rf=Object.create,I1=function(){function i(){}return function(e){if(!C1(e))return{};if(Rf)return Rf(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}(),O1=I1,w1=O1,A1=vf,E1=No;function M1(i){return typeof i.constructor=="function"&&!E1(i)?w1(A1(i)):{}}var L1=M1,R1=us,b1=nn,D1="[object Map]";function N1(i){return b1(i)&&R1(i)==D1}var B1=N1,W1=B1,F1=ls,bf=Do,Df=bf&&bf.isMap,U1=Df?F1(Df):W1,Y1=U1,X1=us,z1=nn,$1="[object Set]";function j1(i){return z1(i)&&X1(i)==$1}var G1=j1,k1=G1,H1=ls,Nf=Do,Bf=Nf&&Nf.isSet,V1=Bf?H1(Bf):k1,Wf=V1,K1=mn(Wf),Z1=Ql,J1=xv,Q1=ef,q1=fm,_1=wm,tS=Am,eS=Mm,rS=Xm,nS=_m,iS=yf,sS=uy,oS=us,aS=Wy,lS=T1,fS=L1,cS=Li,uS=bo,hS=Y1,dS=Mi,pS=Wf,vS=Wo,gS=Fo,mS=1,yS=2,SS=4,Ff="[object Arguments]",PS="[object Array]",xS="[object Boolean]",TS="[object Date]",CS="[object Error]",Uf="[object Function]",IS="[object GeneratorFunction]",OS="[object Map]",wS="[object Number]",Yf="[object Object]",AS="[object RegExp]",ES="[object Set]",MS="[object String]",LS="[object Symbol]",RS="[object WeakMap]",bS="[object ArrayBuffer]",DS="[object DataView]",NS="[object Float32Array]",BS="[object Float64Array]",WS="[object Int8Array]",FS="[object Int16Array]",US="[object Int32Array]",YS="[object Uint8Array]",XS="[object Uint8ClampedArray]",zS="[object Uint16Array]",$S="[object Uint32Array]",We={};We[Ff]=We[PS]=We[bS]=We[DS]=We[xS]=We[TS]=We[NS]=We[BS]=We[WS]=We[FS]=We[US]=We[OS]=We[wS]=We[Yf]=We[AS]=We[ES]=We[MS]=We[LS]=We[YS]=We[XS]=We[zS]=We[$S]=!0,We[CS]=We[Uf]=We[RS]=!1;function hs(i,e,t,r,n,s){var c,l=e&mS,f=e&yS,h=e&SS;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!dS(i))return i;var v=cS(i);if(v){if(c=aS(i),!l)return eS(i,c)}else{var u=oS(i),y=u==Uf||u==IS;if(uS(i))return tS(i,l);if(u==Yf||u==Ff||y&&!n){if(c=f||y?{}:fS(i),!l)return f?nS(i,_1(c,i)):rS(i,q1(c,i))}else{if(!We[u])return n?i:{};c=lS(i,u,l)}}s||(s=new Z1);var T=s.get(i);if(T)return T;s.set(i,c),pS(i)?i.forEach(function(S){c.add(hs(S,e,t,S,i,s))}):hS(i)&&i.forEach(function(S,O){c.set(O,hs(S,e,t,O,i,s))});var w=h?f?sS:iS:f?gS:vS,I=v?void 0:w(i);return J1(I||i,function(S,O){I&&(O=S,S=i[O]),Q1(c,O,hs(S,e,t,O,i,s))}),c}var jS=hs,GS=jS,kS=1,HS=4;function VS(i){return GS(i,kS|HS)}var KS=VS,ar=mn(KS);const Xf="1.1.34-beta.2",ZS="@netless/appliance-plugin";if(typeof window<"u"){let i=window.__netlessUA||"";i+=` ${ZS}@${Xf}`,window.__netlessUA=i}const ur={useWorker:"auto",useSimple:!1,useBackgroundThread:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"},undoRedo:{enableGlobal:!1,maxStackLength:20},markmap:{enable:!0,timeout:1e4,options:{autoFit:!0,duration:0,zoom:!1,pan:!1,maxInitialScale:10}}};function yn(i,e=!0){const t=i.length;if(t<2)return"";let r=i[0],n=i[1];if(t===2)return`M${ni(r)}L${ni(n)}`;let s="";for(let c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=ii(r,n);return e?`M${ii(i[0],i[1])}Q${ni(i[1])}${ii(i[1],i[2])}T${s}${ii(i[t-1],i[0])}${ii(i[0],i[1])}Z`:`M${ni(i[0])}Q${ni(i[1])}${ii(i[1],i[2])}${i.length>3?"T":""}${s}L${ni(i[t-1])}`}const Ir=class Ir{constructor(e){dt(this,"maxImageWidth",ur.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",ur.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",ur.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);const{vNodes:t,fullLayer:r,drawLayer:n,workId:s,toolsOpt:c}=e;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime}get baseConsumeResult(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions}}filterSamePoints(e,t=.01){return e.reduce((r,n)=>{const s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r},[])}setWorkId(e){this.workId=e}getWorkId(){return this.workId}getWorkOptions(){return this.workOptions}setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;const t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r))}updataOptService(e){var n,s;let t;const r=(n=this.workId)==null?void 0:n.toString();if(r&&e){const c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;const l=c[0],{pos:f,zIndex:h,scale:v,angle:u,translate:y}=e,T={};Qe(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),v&&(T.scale=v),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);const w=l==null?void 0:l.getBoundingClientRect();return w&&(t=Zt(t,{x:Math.floor(w.x-Ir.SafeBorderPadding),y:Math.floor(w.y-Ir.SafeBorderPadding),w:Math.floor(w.width+Ir.SafeBorderPadding*2),h:Math.floor(w.height+Ir.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t}}drawEraserlines(e,t){const{group:r,eraserlines:n,pos:s,layer:c}=e,l=c.parent;if(t)try{const h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,v=r.getBoundingClientRect(),u=v.width*h*c.worldScaling[0],y=v.height*h*c.worldScaling[1];let T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));let w=c.getAttribute("scale");w=[w[0]*T,w[1]*T];const I=c.parent.parent,S=c.getAttribute("translate"),O=this.createVmRenderNode(`${this.workId}_bitMapLayer`,I,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},w,S),d=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(d,n,s,!1),O.appendChild(d);const g=O.parent;g.render();const p=O.renderer.canvasRenderer,x=p.context;if(!x)return;const E=p.options.displayRatio,R=d.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:I.width,h:I.height};if(Fi(D,U)===yr.outside){Cr(d,g),I.removeChild(g),this.isDelete=!0;return}const W=ar(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,I.width)-W.x,W.h=Math.min(D.y+D.h,I.height)-W.y;const X=this.getGroupRect(W,E),B=X.x,N=X.y,$=X.w,J=X.h;let tt=x.getImageData(B,N,$,J);if(this.isTransparentRectByCanvas(tt)){Cr(d,g),I.removeChild(g),this.isDelete=!0,tt=null;return}Cr(r,l);const ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:O.worldScaling});ut&&r.append(ut),Cr(d,g),I.removeChild(g),l.deleteTexture(tt),tt=null}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return}}createVmRenderNode(e,t,r,n,s){const{width:c,height:l}=r,f=`bitMap-${e}`,h=t.layer(f,r),v=new Je({anchor:[.5,.5],pos:[c*.5,l*.5],size:[c,l],name:"viewport",id:e});return v.setAttribute("scale",n),v.setAttribute("translate",s),h.append(v),v}getGroupRect(e,t){const r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c}}addEraserlines(e,t,r,n=!0){for(const s of t){const{thickness:c,op:l}=s;for(const f of l){const h=f.map((w,I)=>I%2?w-r[1]:w-r[0]),v=this.computEraserPoints(h,c),u=yn(v,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new gn(y);T.addEventListener("beforerender",({detail:w})=>{const I=w.context;n?I.blendFuncSeparate(I.ZERO,I.ZERO,I.ZERO,I.ZERO):I.globalCompositeOperation="destination-out"}),T.addEventListener("afterrender",({detail:w})=>{const I=w.context;n?I.blendFuncSeparate(I.SRC_ALPHA,I.ONE_MINUS_SRC_ALPHA,I.ONE,I.ONE_MINUS_SRC_ALPHA):I.globalCompositeOperation="source-over"}),e.append(T)}}}isTransparentRectByCanvas(e){let t=!0;for(let r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break}return t}createSpriteNode(e){const{imageData:t,worldScaling:r,safariRect:n,originRect:s}=e;let c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);const v=c.getContext("2d");v&&v.putImageData(t,0,0)}else if(typeof document<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;const v=c.getContext("2d");v&&v.putImageData(t,0,0)}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;const l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[.5,.5],pos:[0,0],size:l,texture:c,textureRect:f};return new Ul(h)}computEraserPoints(e,t){const r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r)}computDot(e,t){const r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8)}computLine(e,t){const r=[],n=[];let s,c;for(let l=0;l<e.length;l+=2){const f=new Jt(e[l],e[l+1]);let h;if(l==e.length-2){const v=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,v).uni(),s=f}else{l===0&&(c=f);const v=new Jt(e[l+2],e[l+3]);h=pt.Sub(v,f).uni()}if(h){const v=pt.Per(h).mul(t);r.push(Jt.Sub(f,v)),n.push(Jt.Add(f,v))}}if(s&&c){const l=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),f=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(l,n.reverse(),f)}return[]}replace(e,t,r){var s;if(!t){r&&e.append(r);return}const n=e.getElementsByName(t);if(n.length)for(const c of n)r?dT(r,c,e):(c.remove(),dr(c,e.parent));else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(l=>{var f;l.remove(),dr(l,(f=this.drawLayer)==null?void 0:f.parent)}):this.fullLayer.getElementsByName(t).forEach(l=>{l.remove(),dr(l,this.fullLayer.parent)}))}removeDrawCountNodes(e,t){const r=[];e.getElementsByName(this.workId).forEach(n=>{n.id&&t&&Number(n.id)<t&&r.push(n)});for(const n of r)n.remove(),dr(n,e.parent)}static updateNodeOpt(e){var d;const{node:t,opt:r,vNodes:n,willSerializeData:s,targetNode:c}=e,{zIndex:l,translate:f,angle:h,originPoint:v,scenePoint:u,scale:y,pointMap:T,thickness:w}=r;let I;const S=c&&ar(c)||n.get(t.name);if(!S)return;Qe(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);const O=t.parent;if(O){if(v&&y&&c){const g=[S.op[0],S.op[1]];Es(S.op,u,y,f);const p=[S.op[0],S.op[1]],x=[p[0]-g[0],p[1]-g[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(let E=0;E<S.opt.eraserlines.length;E++){const{op:R,thickness:D}=S.opt.eraserlines[E];S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(let U=0;U<R.length;U++)oa(R[U],u,y,f)}}else if(f)if(t.setAttribute("translate",f),S.opt.translate=f,c){const g=[f[0]*O.worldScaling[0],f[1]*O.worldScaling[1]];I=Wi(S.rect,g),S.rect=I}else{const g=Ir.getRectFromLayer(O,t.name);S.rect=g||S.rect}else if(Qe(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)I=sa(S.rect,h),S.rect=I;else{const g=Ir.getRectFromLayer(O,t.name);S.rect=g||S.rect}if(T){const g=T.get(t.name);if(g)for(let p=0,x=0;p<S.op.length;p+=3,x++)S.op[p]=g[x][0],S.op[p+1]=g[x][1]}if(w&&((d=S==null?void 0:S.opt)!=null&&d.thickness)&&(S.opt.thickness=w),s&&!(v&&y&&c)){if(f){const g=S.op.map((p,x)=>{const E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p});if(S.op=g,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(let p=0;p<S.opt.eraserlines.length;p++){const{op:x}=S.opt.eraserlines[p];for(let E=0;E<x.length;E++){const R=x[E].map((D,U)=>U%2?D+f[1]:D+f[0]);S.opt.eraserlines[p].op[E]=R}}}else if(Qe(h)){const g=S.op;if(sT(g,S.centerPos,h),S.op=g,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(let p=0;p<S.opt.eraserlines.length;p++){const{op:x}=S.opt.eraserlines[p];for(let E=0;E<x.length;E++)oT(x[E],S.centerPos,h)}}}S&&n.setInfo(t.name,S)}}static getCenterPos(e,t){const{worldPosition:r,worldScaling:n}=t;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]]}static getRectFromLayer(e,t){const r=e.getElementsByName(t)[0];if(r){const n=r.getBoundingClientRect();return{x:Math.floor(n.x-Ir.SafeBorderPadding),y:Math.floor(n.y-Ir.SafeBorderPadding),w:Math.floor(n.width+Ir.SafeBorderPadding*2),h:Math.floor(n.height+Ir.SafeBorderPadding*2)}}}static isWillRefresh(e){const{toolsType:t,opt:r,node:n,updateOpt:s,willSerializeData:c}=e;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===xt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===xt.BackgroundSVG&&(s.translate||s.scale)||t===xt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&r.type===es.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor))}};dt(Ir,"SafeBorderPadding",10);let Yt=Ir;const Ho=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var Vo={exports:{}};Vo.exports,function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var v=0;v<f.length;v++)s[f][f.charAt(v)]=v}return s[f][h]}var l={compressToBase64:function(f){if(f==null)return"";var h=l._compress(f,6,function(v){return r.charAt(v)});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"="}},decompressFromBase64:function(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h))})},compressToUTF16:function(f){return f==null?"":l._compress(f,15,function(h){return t(h+32)})+" "},decompressFromUTF16:function(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32})},compressToUint8Array:function(f){for(var h=l.compress(f),v=new Uint8Array(h.length*2),u=0,y=h.length;u<y;u++){var T=h.charCodeAt(u);v[u*2]=T>>>8,v[u*2+1]=T%256}return v},decompressFromUint8Array:function(f){if(f==null)return l.decompress(f);for(var h=new Array(f.length/2),v=0,u=h.length;v<u;v++)h[v]=f[v*2]*256+f[v*2+1];var y=[];return h.forEach(function(T){y.push(t(T))}),l.decompress(y.join(""))},compressToEncodedURIComponent:function(f){return f==null?"":l._compress(f,6,function(h){return n.charAt(h)})},decompressFromEncodedURIComponent:function(f){return f==null?"":f==""?null:(f=f.replace(/ /g,"+"),l._decompress(f.length,32,function(h){return c(n,f.charAt(h))}))},compress:function(f){return l._compress(f,16,function(h){return t(h)})},_compress:function(f,h,v){if(f==null)return"";var u,y,T={},w={},I="",S="",O="",d=2,g=3,p=2,x=[],E=0,R=0,D;for(D=0;D<f.length;D+=1)if(I=f.charAt(D),Object.prototype.hasOwnProperty.call(T,I)||(T[I]=g++,w[I]=!0),S=O+I,Object.prototype.hasOwnProperty.call(T,S))O=S;else{if(Object.prototype.hasOwnProperty.call(w,O)){if(O.charCodeAt(0)<256){for(u=0;u<p;u++)E=E<<1,R==h-1?(R=0,x.push(v(E)),E=0):R++;for(y=O.charCodeAt(0),u=0;u<8;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1}else{for(y=1,u=0;u<p;u++)E=E<<1|y,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=0;for(y=O.charCodeAt(0),u=0;u<16;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1}d--,d==0&&(d=Math.pow(2,p),p++),delete w[O]}else for(y=T[O],u=0;u<p;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1;d--,d==0&&(d=Math.pow(2,p),p++),T[S]=g++,O=String(I)}if(O!==""){if(Object.prototype.hasOwnProperty.call(w,O)){if(O.charCodeAt(0)<256){for(u=0;u<p;u++)E=E<<1,R==h-1?(R=0,x.push(v(E)),E=0):R++;for(y=O.charCodeAt(0),u=0;u<8;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1}else{for(y=1,u=0;u<p;u++)E=E<<1|y,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=0;for(y=O.charCodeAt(0),u=0;u<16;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1}d--,d==0&&(d=Math.pow(2,p),p++),delete w[O]}else for(y=T[O],u=0;u<p;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1;d--,d==0&&(d=Math.pow(2,p),p++)}for(y=2,u=0;u<p;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1;for(;;)if(E=E<<1,R==h-1){x.push(v(E));break}else R++;return x.join("")},decompress:function(f){return f==null?"":f==""?null:l._decompress(f.length,32768,function(h){return f.charCodeAt(h)})},_decompress:function(f,h,v){var u=[],y=4,T=4,w=3,I="",S=[],O,d,g,p,x,E,R,D={val:v(0),position:h,index:1};for(O=0;O<3;O+=1)u[O]=O;for(g=0,x=Math.pow(2,2),E=1;E!=x;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=v(D.index++)),g|=(p>0?1:0)*E,E<<=1;switch(g){case 0:for(g=0,x=Math.pow(2,8),E=1;E!=x;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=v(D.index++)),g|=(p>0?1:0)*E,E<<=1;R=t(g);break;case 1:for(g=0,x=Math.pow(2,16),E=1;E!=x;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=v(D.index++)),g|=(p>0?1:0)*E,E<<=1;R=t(g);break;case 2:return""}for(u[3]=R,d=R,S.push(R);;){if(D.index>f)return"";for(g=0,x=Math.pow(2,w),E=1;E!=x;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=v(D.index++)),g|=(p>0?1:0)*E,E<<=1;switch(R=g){case 0:for(g=0,x=Math.pow(2,8),E=1;E!=x;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=v(D.index++)),g|=(p>0?1:0)*E,E<<=1;u[T++]=t(g),R=T-1,y--;break;case 1:for(g=0,x=Math.pow(2,16),E=1;E!=x;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=v(D.index++)),g|=(p>0?1:0)*E,E<<=1;u[T++]=t(g),R=T-1,y--;break;case 2:return S.join("")}if(y==0&&(y=Math.pow(2,w),w++),u[R])I=u[R];else if(R===T)I=d+d.charAt(0);else return null;S.push(I),u[T++]=d+I.charAt(0),y--,d=I,y==0&&(y=Math.pow(2,w),w++)}}};return l}();i!=null?i.exports=e:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return e})}(Vo);var zf=Vo.exports;function ti(i){return JSON.parse(zf.decompress(i))}function hr(i){return zf.compress(JSON.stringify(i))}var $f={exports:{}};(function(i){(function(){var e={};e.version="6.4.2.2",e.use_lines=!0,e.use_xyz=!1;var t=!1;i.exports?(i.exports=e,t=!0):typeof document<"u"?window.ClipperLib=e:self.ClipperLib=e;var r;if(t){var n="chrome";r="Netscape"}else{var n=navigator.userAgent.toString().toLowerCase();r=navigator.appName}var s={};n.indexOf("chrome")!=-1&&n.indexOf("chromium")==-1?s.chrome=1:s.chrome=0,n.indexOf("chromium")!=-1?s.chromium=1:s.chromium=0,n.indexOf("safari")!=-1&&n.indexOf("chrome")==-1&&n.indexOf("chromium")==-1?s.safari=1:s.safari=0,n.indexOf("firefox")!=-1?s.firefox=1:s.firefox=0,n.indexOf("firefox/17")!=-1?s.firefox17=1:s.firefox17=0,n.indexOf("firefox/15")!=-1?s.firefox15=1:s.firefox15=0,n.indexOf("firefox/3")!=-1?s.firefox3=1:s.firefox3=0,n.indexOf("opera")!=-1?s.opera=1:s.opera=0,n.indexOf("msie 10")!=-1?s.msie10=1:s.msie10=0,n.indexOf("msie 9")!=-1?s.msie9=1:s.msie9=0,n.indexOf("msie 8")!=-1?s.msie8=1:s.msie8=0,n.indexOf("msie 7")!=-1?s.msie7=1:s.msie7=0,n.indexOf("msie ")!=-1?s.msie=1:s.msie=0,e.biginteger_used=null;var c;function l(a,P,A){e.biginteger_used=1,a!=null&&(typeof a=="number"&&typeof P>"u"?this.fromInt(a):typeof a=="number"?this.fromNumber(a,P,A):P==null&&typeof a!="string"?this.fromString(a,256):this.fromString(a,P))}function f(){return new l(null,void 0,void 0)}function h(a,P,A,F,j,_){for(;--_>=0;){var st=P*this[a++]+A[F]+j;j=Math.floor(st/67108864),A[F++]=st&67108863}return j}function v(a,P,A,F,j,_){for(var st=P&32767,St=P>>15;--_>=0;){var Pt=this[a]&32767,Bt=this[a++]>>15,Ht=St*Pt+Bt*st;Pt=st*Pt+((Ht&32767)<<15)+A[F]+(j&1073741823),j=(Pt>>>30)+(Ht>>>15)+St*Bt+(j>>>30),A[F++]=Pt&1073741823}return j}function u(a,P,A,F,j,_){for(var st=P&16383,St=P>>14;--_>=0;){var Pt=this[a]&16383,Bt=this[a++]>>14,Ht=St*Pt+Bt*st;Pt=st*Pt+((Ht&16383)<<14)+A[F]+j,j=(Pt>>28)+(Ht>>14)+St*Bt,A[F++]=Pt&268435455}return j}r=="Microsoft Internet Explorer"?(l.prototype.am=v,c=30):r!="Netscape"?(l.prototype.am=h,c=26):(l.prototype.am=u,c=28),l.prototype.DB=c,l.prototype.DM=(1<<c)-1,l.prototype.DV=1<<c;var y=52;l.prototype.FV=Math.pow(2,y),l.prototype.F1=y-c,l.prototype.F2=2*c-y;var T="0123456789abcdefghijklmnopqrstuvwxyz",w=new Array,I,S;for(I=48,S=0;S<=9;++S)w[I++]=S;for(I=97,S=10;S<36;++S)w[I++]=S;for(I=65,S=10;S<36;++S)w[I++]=S;function O(a){return T.charAt(a)}function d(a,P){var A=w[a.charCodeAt(P)];return A??-1}function g(a){for(var P=this.t-1;P>=0;--P)a[P]=this[P];a.t=this.t,a.s=this.s}function p(a){this.t=1,this.s=a<0?-1:0,a>0?this[0]=a:a<-1?this[0]=a+this.DV:this.t=0}function x(a){var P=f();return P.fromInt(a),P}function E(a,P){var A;if(P==16)A=4;else if(P==8)A=3;else if(P==256)A=8;else if(P==2)A=1;else if(P==32)A=5;else if(P==4)A=2;else{this.fromRadix(a,P);return}this.t=0,this.s=0;for(var F=a.length,j=!1,_=0;--F>=0;){var st=A==8?a[F]&255:d(a,F);if(st<0){a.charAt(F)=="-"&&(j=!0);continue}j=!1,_==0?this[this.t++]=st:_+A>this.DB?(this[this.t-1]|=(st&(1<<this.DB-_)-1)<<_,this[this.t++]=st>>this.DB-_):this[this.t-1]|=st<<_,_+=A,_>=this.DB&&(_-=this.DB)}A==8&&a[0]&128&&(this.s=-1,_>0&&(this[this.t-1]|=(1<<this.DB-_)-1<<_)),this.clamp(),j&&l.ZERO.subTo(this,this)}function R(){for(var a=this.s&this.DM;this.t>0&&this[this.t-1]==a;)--this.t}function D(a){if(this.s<0)return"-"+this.negate().toString(a);var P;if(a==16)P=4;else if(a==8)P=3;else if(a==2)P=1;else if(a==32)P=5;else if(a==4)P=2;else return this.toRadix(a);var A=(1<<P)-1,F,j=!1,_="",st=this.t,St=this.DB-st*this.DB%P;if(st-- >0)for(St<this.DB&&(F=this[st]>>St)>0&&(j=!0,_=O(F));st>=0;)St<P?(F=(this[st]&(1<<St)-1)<<P-St,F|=this[--st]>>(St+=this.DB-P)):(F=this[st]>>(St-=P)&A,St<=0&&(St+=this.DB,--st)),F>0&&(j=!0),j&&(_+=O(F));return j?_:"0"}function U(){var a=f();return l.ZERO.subTo(this,a),a}function M(){return this.s<0?this.negate():this}function W(a){var P=this.s-a.s;if(P!=0)return P;var A=this.t;if(P=A-a.t,P!=0)return this.s<0?-P:P;for(;--A>=0;)if((P=this[A]-a[A])!=0)return P;return 0}function X(a){var P=1,A;return(A=a>>>16)!=0&&(a=A,P+=16),(A=a>>8)!=0&&(a=A,P+=8),(A=a>>4)!=0&&(a=A,P+=4),(A=a>>2)!=0&&(a=A,P+=2),(A=a>>1)!=0&&(a=A,P+=1),P}function B(){return this.t<=0?0:this.DB*(this.t-1)+X(this[this.t-1]^this.s&this.DM)}function N(a,P){var A;for(A=this.t-1;A>=0;--A)P[A+a]=this[A];for(A=a-1;A>=0;--A)P[A]=0;P.t=this.t+a,P.s=this.s}function $(a,P){for(var A=a;A<this.t;++A)P[A-a]=this[A];P.t=Math.max(this.t-a,0),P.s=this.s}function J(a,P){var A=a%this.DB,F=this.DB-A,j=(1<<F)-1,_=Math.floor(a/this.DB),st=this.s<<A&this.DM,St;for(St=this.t-1;St>=0;--St)P[St+_+1]=this[St]>>F|st,st=(this[St]&j)<<A;for(St=_-1;St>=0;--St)P[St]=0;P[_]=st,P.t=this.t+_+1,P.s=this.s,P.clamp()}function tt(a,P){P.s=this.s;var A=Math.floor(a/this.DB);if(A>=this.t){P.t=0;return}var F=a%this.DB,j=this.DB-F,_=(1<<F)-1;P[0]=this[A]>>F;for(var st=A+1;st<this.t;++st)P[st-A-1]|=(this[st]&_)<<j,P[st-A]=this[st]>>F;F>0&&(P[this.t-A-1]|=(this.s&_)<<j),P.t=this.t-A,P.clamp()}function at(a,P){for(var A=0,F=0,j=Math.min(a.t,this.t);A<j;)F+=this[A]-a[A],P[A++]=F&this.DM,F>>=this.DB;if(a.t<this.t){for(F-=a.s;A<this.t;)F+=this[A],P[A++]=F&this.DM,F>>=this.DB;F+=this.s}else{for(F+=this.s;A<a.t;)F-=a[A],P[A++]=F&this.DM,F>>=this.DB;F-=a.s}P.s=F<0?-1:0,F<-1?P[A++]=this.DV+F:F>0&&(P[A++]=F),P.t=A,P.clamp()}function ut(a,P){var A=this.abs(),F=a.abs(),j=A.t;for(P.t=j+F.t;--j>=0;)P[j]=0;for(j=0;j<F.t;++j)P[j+A.t]=A.am(0,F[j],P,j,0,A.t);P.s=0,P.clamp(),this.s!=a.s&&l.ZERO.subTo(P,P)}function V(a){for(var P=this.abs(),A=a.t=2*P.t;--A>=0;)a[A]=0;for(A=0;A<P.t-1;++A){var F=P.am(A,P[A],a,2*A,0,1);(a[A+P.t]+=P.am(A+1,2*P[A],a,2*A+1,F,P.t-A-1))>=P.DV&&(a[A+P.t]-=P.DV,a[A+P.t+1]=1)}a.t>0&&(a[a.t-1]+=P.am(A,P[A],a,2*A,0,1)),a.s=0,a.clamp()}function Q(a,P,A){var F=a.abs();if(!(F.t<=0)){var j=this.abs();if(j.t<F.t){P!=null&&P.fromInt(0),A!=null&&this.copyTo(A);return}A==null&&(A=f());var _=f(),st=this.s,St=a.s,Pt=this.DB-X(F[F.t-1]);Pt>0?(F.lShiftTo(Pt,_),j.lShiftTo(Pt,A)):(F.copyTo(_),j.copyTo(A));var Bt=_.t,Ht=_[Bt-1];if(Ht!=0){var jt=Ht*(1<<this.F1)+(Bt>1?_[Bt-2]>>this.F2:0),qt=this.FV/jt,oe=(1<<this.F1)/jt,me=1<<this.F2,Se=A.t,De=Se-Bt,lr=P??f();for(_.dlShiftTo(De,lr),A.compareTo(lr)>=0&&(A[A.t++]=1,A.subTo(lr,A)),l.ONE.dlShiftTo(Bt,lr),lr.subTo(_,_);_.t<Bt;)_[_.t++]=0;for(;--De>=0;){var br=A[--Se]==Ht?this.DM:Math.floor(A[Se]*qt+(A[Se-1]+me)*oe);if((A[Se]+=_.am(0,br,A,De,0,Bt))<br)for(_.dlShiftTo(De,lr),A.subTo(lr,A);A[Se]<--br;)A.subTo(lr,A)}P!=null&&(A.drShiftTo(Bt,P),st!=St&&l.ZERO.subTo(P,P)),A.t=Bt,A.clamp(),Pt>0&&A.rShiftTo(Pt,A),st<0&&l.ZERO.subTo(A,A)}}}function ft(a){var P=f();return this.abs().divRemTo(a,null,P),this.s<0&&P.compareTo(l.ZERO)>0&&a.subTo(P,P),P}function mt(a){this.m=a}function yt(a){return a.s<0||a.compareTo(this.m)>=0?a.mod(this.m):a}function wt(a){return a}function ht(a){a.divRemTo(this.m,null,a)}function Nt(a,P,A){a.multiplyTo(P,A),this.reduce(A)}function Dt(a,P){a.squareTo(P),this.reduce(P)}mt.prototype.convert=yt,mt.prototype.revert=wt,mt.prototype.reduce=ht,mt.prototype.mulTo=Nt,mt.prototype.sqrTo=Dt;function G(){if(this.t<1)return 0;var a=this[0];if(!(a&1))return 0;var P=a&3;return P=P*(2-(a&15)*P)&15,P=P*(2-(a&255)*P)&255,P=P*(2-((a&65535)*P&65535))&65535,P=P*(2-a*P%this.DV)%this.DV,P>0?this.DV-P:-P}function k(a){this.m=a,this.mp=a.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<a.DB-15)-1,this.mt2=2*a.t}function rt(a){var P=f();return a.abs().dlShiftTo(this.m.t,P),P.divRemTo(this.m,null,P),a.s<0&&P.compareTo(l.ZERO)>0&&this.m.subTo(P,P),P}function nt(a){var P=f();return a.copyTo(P),this.reduce(P),P}function Y(a){for(;a.t<=this.mt2;)a[a.t++]=0;for(var P=0;P<this.m.t;++P){var A=a[P]&32767,F=A*this.mpl+((A*this.mph+(a[P]>>15)*this.mpl&this.um)<<15)&a.DM;for(A=P+this.m.t,a[A]+=this.m.am(0,F,a,P,0,this.m.t);a[A]>=a.DV;)a[A]-=a.DV,a[++A]++}a.clamp(),a.drShiftTo(this.m.t,a),a.compareTo(this.m)>=0&&a.subTo(this.m,a)}function Z(a,P){a.squareTo(P),this.reduce(P)}function C(a,P,A){a.multiplyTo(P,A),this.reduce(A)}k.prototype.convert=rt,k.prototype.revert=nt,k.prototype.reduce=Y,k.prototype.mulTo=C,k.prototype.sqrTo=Z;function L(){return(this.t>0?this[0]&1:this.s)==0}function z(a,P){if(a>4294967295||a<1)return l.ONE;var A=f(),F=f(),j=P.convert(this),_=X(a)-1;for(j.copyTo(A);--_>=0;)if(P.sqrTo(A,F),(a&1<<_)>0)P.mulTo(F,j,A);else{var st=A;A=F,F=st}return P.revert(A)}function K(a,P){var A;return a<256||P.isEven()?A=new mt(P):A=new k(P),this.exp(a,A)}l.prototype.copyTo=g,l.prototype.fromInt=p,l.prototype.fromString=E,l.prototype.clamp=R,l.prototype.dlShiftTo=N,l.prototype.drShiftTo=$,l.prototype.lShiftTo=J,l.prototype.rShiftTo=tt,l.prototype.subTo=at,l.prototype.multiplyTo=ut,l.prototype.squareTo=V,l.prototype.divRemTo=Q,l.prototype.invDigit=G,l.prototype.isEven=L,l.prototype.exp=z,l.prototype.toString=D,l.prototype.negate=U,l.prototype.abs=M,l.prototype.compareTo=W,l.prototype.bitLength=B,l.prototype.mod=ft,l.prototype.modPowInt=K,l.ZERO=x(0),l.ONE=x(1);function q(){var a=f();return this.copyTo(a),a}function it(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function ct(){return this.t==0?this.s:this[0]<<24>>24}function Tt(){return this.t==0?this.s:this[0]<<16>>16}function Ct(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function Mt(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function bt(a){if(a==null&&(a=10),this.signum()==0||a<2||a>36)return"0";var P=this.chunkSize(a),A=Math.pow(a,P),F=x(A),j=f(),_=f(),st="";for(this.divRemTo(F,j,_);j.signum()>0;)st=(A+_.intValue()).toString(a).substr(1)+st,j.divRemTo(F,j,_);return _.intValue().toString(a)+st}function At(a,P){this.fromInt(0),P==null&&(P=10);for(var A=this.chunkSize(P),F=Math.pow(P,A),j=!1,_=0,st=0,St=0;St<a.length;++St){var Pt=d(a,St);if(Pt<0){a.charAt(St)=="-"&&this.signum()==0&&(j=!0);continue}st=P*st+Pt,++_>=A&&(this.dMultiply(F),this.dAddOffset(st,0),_=0,st=0)}_>0&&(this.dMultiply(Math.pow(P,_)),this.dAddOffset(st,0)),j&&l.ZERO.subTo(this,this)}function Ot(a,P,A){if(typeof P=="number")if(a<2)this.fromInt(1);else for(this.fromNumber(a,A),this.testBit(a-1)||this.bitwiseTo(l.ONE.shiftLeft(a-1),ne,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(P);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(l.ONE.shiftLeft(a-1),this);else{var F=new Array,j=a&7;F.length=(a>>3)+1,P.nextBytes(F),j>0?F[0]&=(1<<j)-1:F[0]=0,this.fromString(F,256)}}function Lt(){var a=this.t,P=new Array;P[0]=this.s;var A=this.DB-a*this.DB%8,F,j=0;if(a-- >0)for(A<this.DB&&(F=this[a]>>A)!=(this.s&this.DM)>>A&&(P[j++]=F|this.s<<this.DB-A);a>=0;)A<8?(F=(this[a]&(1<<A)-1)<<8-A,F|=this[--a]>>(A+=this.DB-8)):(F=this[a]>>(A-=8)&255,A<=0&&(A+=this.DB,--a)),F&128&&(F|=-256),j==0&&(this.s&128)!=(F&128)&&++j,(j>0||F!=this.s)&&(P[j++]=F);return P}function Xt(a){return this.compareTo(a)==0}function $t(a){return this.compareTo(a)<0?this:a}function Wt(a){return this.compareTo(a)>0?this:a}function Qt(a,P,A){var F,j,_=Math.min(a.t,this.t);for(F=0;F<_;++F)A[F]=P(this[F],a[F]);if(a.t<this.t){for(j=a.s&this.DM,F=_;F<this.t;++F)A[F]=P(this[F],j);A.t=this.t}else{for(j=this.s&this.DM,F=_;F<a.t;++F)A[F]=P(j,a[F]);A.t=a.t}A.s=P(this.s,a.s),A.clamp()}function ue(a,P){return a&P}function ie(a){var P=f();return this.bitwiseTo(a,ue,P),P}function ne(a,P){return a|P}function ae(a){var P=f();return this.bitwiseTo(a,ne,P),P}function se(a,P){return a^P}function Ge(a){var P=f();return this.bitwiseTo(a,se,P),P}function Fe(a,P){return a&~P}function ze(a){var P=f();return this.bitwiseTo(a,Fe,P),P}function Ue(){for(var a=f(),P=0;P<this.t;++P)a[P]=this.DM&~this[P];return a.t=this.t,a.s=~this.s,a}function ke(a){var P=f();return a<0?this.rShiftTo(-a,P):this.lShiftTo(a,P),P}function Ve(a){var P=f();return a<0?this.lShiftTo(-a,P):this.rShiftTo(a,P),P}function qe(a){if(a==0)return-1;var P=0;return a&65535||(a>>=16,P+=16),a&255||(a>>=8,P+=8),a&15||(a>>=4,P+=4),a&3||(a>>=2,P+=2),a&1||++P,P}function we(){for(var a=0;a<this.t;++a)if(this[a]!=0)return a*this.DB+qe(this[a]);return this.s<0?this.t*this.DB:-1}function pr(a){for(var P=0;a!=0;)a&=a-1,++P;return P}function Jr(){for(var a=0,P=this.s&this.DM,A=0;A<this.t;++A)a+=pr(this[A]^P);return a}function sn(a){var P=Math.floor(a/this.DB);return P>=this.t?this.s!=0:(this[P]&1<<a%this.DB)!=0}function li(a,P){var A=l.ONE.shiftLeft(a);return this.bitwiseTo(A,P,A),A}function fi(a){return this.changeBit(a,ne)}function Ui(a){return this.changeBit(a,Fe)}function fa(a){return this.changeBit(a,se)}function Yi(a,P){for(var A=0,F=0,j=Math.min(a.t,this.t);A<j;)F+=this[A]+a[A],P[A++]=F&this.DM,F>>=this.DB;if(a.t<this.t){for(F+=a.s;A<this.t;)F+=this[A],P[A++]=F&this.DM,F>>=this.DB;F+=this.s}else{for(F+=this.s;A<a.t;)F+=a[A],P[A++]=F&this.DM,F>>=this.DB;F+=a.s}P.s=F<0?-1:0,F>0?P[A++]=F:F<-1&&(P[A++]=this.DV+F),P.t=A,P.clamp()}function ca(a){var P=f();return this.addTo(a,P),P}function ua(a){var P=f();return this.subTo(a,P),P}function ha(a){var P=f();return this.multiplyTo(a,P),P}function da(){var a=f();return this.squareTo(a),a}function pa(a){var P=f();return this.divRemTo(a,P,null),P}function va(a){var P=f();return this.divRemTo(a,null,P),P}function ga(a){var P=f(),A=f();return this.divRemTo(a,P,A),new Array(P,A)}function ma(a){this[this.t]=this.am(0,a-1,this,0,0,this.t),++this.t,this.clamp()}function bs(a,P){if(a!=0){for(;this.t<=P;)this[this.t++]=0;for(this[P]+=a;this[P]>=this.DV;)this[P]-=this.DV,++P>=this.t&&(this[this.t++]=0),++this[P]}}function Fn(){}function Ds(a){return a}function ya(a,P,A){a.multiplyTo(P,A)}function Sa(a,P){a.squareTo(P)}Fn.prototype.convert=Ds,Fn.prototype.revert=Ds,Fn.prototype.mulTo=ya,Fn.prototype.sqrTo=Sa;function Pa(a){return this.exp(a,new Fn)}function xa(a,P,A){var F=Math.min(this.t+a.t,P);for(A.s=0,A.t=F;F>0;)A[--F]=0;var j;for(j=A.t-this.t;F<j;++F)A[F+this.t]=this.am(0,a[F],A,F,0,this.t);for(j=Math.min(a.t,P);F<j;++F)this.am(0,a[F],A,F,0,P-F);A.clamp()}function ci(a,P,A){--P;var F=A.t=this.t+a.t-P;for(A.s=0;--F>=0;)A[F]=0;for(F=Math.max(P-this.t,0);F<a.t;++F)A[this.t+F-P]=this.am(P-F,a[F],A,0,0,this.t+F-P);A.clamp(),A.drShiftTo(1,A)}function xn(a){this.r2=f(),this.q3=f(),l.ONE.dlShiftTo(2*a.t,this.r2),this.mu=this.r2.divide(a),this.m=a}function ui(a){if(a.s<0||a.t>2*this.m.t)return a.mod(this.m);if(a.compareTo(this.m)<0)return a;var P=f();return a.copyTo(P),this.reduce(P),P}function Ta(a){return a}function Ca(a){for(a.drShiftTo(this.m.t-1,this.r2),a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);a.compareTo(this.r2)<0;)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);a.compareTo(this.m)>=0;)a.subTo(this.m,a)}function Ia(a,P){a.squareTo(P),this.reduce(P)}function Ns(a,P,A){a.multiplyTo(P,A),this.reduce(A)}xn.prototype.convert=ui,xn.prototype.revert=Ta,xn.prototype.reduce=Ca,xn.prototype.mulTo=Ns,xn.prototype.sqrTo=Ia;function Bs(a,P){var A=a.bitLength(),F,j=x(1),_;if(A<=0)return j;A<18?F=1:A<48?F=3:A<144?F=4:A<768?F=5:F=6,A<8?_=new mt(P):P.isEven()?_=new xn(P):_=new k(P);var st=new Array,St=3,Pt=F-1,Bt=(1<<F)-1;if(st[1]=_.convert(this),F>1){var Ht=f();for(_.sqrTo(st[1],Ht);St<=Bt;)st[St]=f(),_.mulTo(Ht,st[St-2],st[St]),St+=2}var jt=a.t-1,qt,oe=!0,me=f(),Se;for(A=X(a[jt])-1;jt>=0;){for(A>=Pt?qt=a[jt]>>A-Pt&Bt:(qt=(a[jt]&(1<<A+1)-1)<<Pt-A,jt>0&&(qt|=a[jt-1]>>this.DB+A-Pt)),St=F;!(qt&1);)qt>>=1,--St;if((A-=St)<0&&(A+=this.DB,--jt),oe)st[qt].copyTo(j),oe=!1;else{for(;St>1;)_.sqrTo(j,me),_.sqrTo(me,j),St-=2;St>0?_.sqrTo(j,me):(Se=j,j=me,me=Se),_.mulTo(me,st[qt],j)}for(;jt>=0&&!(a[jt]&1<<A);)_.sqrTo(j,me),Se=j,j=me,me=Se,--A<0&&(A=this.DB-1,--jt)}return _.revert(j)}function Ws(a){var P=this.s<0?this.negate():this.clone(),A=a.s<0?a.negate():a.clone();if(P.compareTo(A)<0){var F=P;P=A,A=F}var j=P.getLowestSetBit(),_=A.getLowestSetBit();if(_<0)return P;for(j<_&&(_=j),_>0&&(P.rShiftTo(_,P),A.rShiftTo(_,A));P.signum()>0;)(j=P.getLowestSetBit())>0&&P.rShiftTo(j,P),(j=A.getLowestSetBit())>0&&A.rShiftTo(j,A),P.compareTo(A)>=0?(P.subTo(A,P),P.rShiftTo(1,P)):(A.subTo(P,A),A.rShiftTo(1,A));return _>0&&A.lShiftTo(_,A),A}function Oa(a){if(a<=0)return 0;var P=this.DV%a,A=this.s<0?a-1:0;if(this.t>0)if(P==0)A=this[0]%a;else for(var F=this.t-1;F>=0;--F)A=(P*A+this[F])%a;return A}function wa(a){var P=a.isEven();if(this.isEven()&&P||a.signum()==0)return l.ZERO;for(var A=a.clone(),F=this.clone(),j=x(1),_=x(0),st=x(0),St=x(1);A.signum()!=0;){for(;A.isEven();)A.rShiftTo(1,A),P?((!j.isEven()||!_.isEven())&&(j.addTo(this,j),_.subTo(a,_)),j.rShiftTo(1,j)):_.isEven()||_.subTo(a,_),_.rShiftTo(1,_);for(;F.isEven();)F.rShiftTo(1,F),P?((!st.isEven()||!St.isEven())&&(st.addTo(this,st),St.subTo(a,St)),st.rShiftTo(1,st)):St.isEven()||St.subTo(a,St),St.rShiftTo(1,St);A.compareTo(F)>=0?(A.subTo(F,A),P&&j.subTo(st,j),_.subTo(St,_)):(F.subTo(A,F),P&&st.subTo(j,st),St.subTo(_,St))}if(F.compareTo(l.ONE)!=0)return l.ZERO;if(St.compareTo(a)>=0)return St.subtract(a);if(St.signum()<0)St.addTo(a,St);else return St;return St.signum()<0?St.add(a):St}var ir=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Aa=(1<<26)/ir[ir.length-1];function Fs(a){var P,A=this.abs();if(A.t==1&&A[0]<=ir[ir.length-1]){for(P=0;P<ir.length;++P)if(A[0]==ir[P])return!0;return!1}if(A.isEven())return!1;for(P=1;P<ir.length;){for(var F=ir[P],j=P+1;j<ir.length&&F<Aa;)F*=ir[j++];for(F=A.modInt(F);P<j;)if(F%ir[P++]==0)return!1}return A.millerRabin(a)}function Us(a){var P=this.subtract(l.ONE),A=P.getLowestSetBit();if(A<=0)return!1;var F=P.shiftRight(A);a=a+1>>1,a>ir.length&&(a=ir.length);for(var j=f(),_=0;_<a;++_){j.fromInt(ir[Math.floor(Math.random()*ir.length)]);var st=j.modPow(F,this);if(st.compareTo(l.ONE)!=0&&st.compareTo(P)!=0){for(var St=1;St++<A&&st.compareTo(P)!=0;)if(st=st.modPowInt(2,this),st.compareTo(l.ONE)==0)return!1;if(st.compareTo(P)!=0)return!1}}return!0}l.prototype.chunkSize=Ct,l.prototype.toRadix=bt,l.prototype.fromRadix=At,l.prototype.fromNumber=Ot,l.prototype.bitwiseTo=Qt,l.prototype.changeBit=li,l.prototype.addTo=Yi,l.prototype.dMultiply=ma,l.prototype.dAddOffset=bs,l.prototype.multiplyLowerTo=xa,l.prototype.multiplyUpperTo=ci,l.prototype.modInt=Oa,l.prototype.millerRabin=Us,l.prototype.clone=q,l.prototype.intValue=it,l.prototype.byteValue=ct,l.prototype.shortValue=Tt,l.prototype.signum=Mt,l.prototype.toByteArray=Lt,l.prototype.equals=Xt,l.prototype.min=$t,l.prototype.max=Wt,l.prototype.and=ie,l.prototype.or=ae,l.prototype.xor=Ge,l.prototype.andNot=ze,l.prototype.not=Ue,l.prototype.shiftLeft=ke,l.prototype.shiftRight=Ve,l.prototype.getLowestSetBit=we,l.prototype.bitCount=Jr,l.prototype.testBit=sn,l.prototype.setBit=fi,l.prototype.clearBit=Ui,l.prototype.flipBit=fa,l.prototype.add=ca,l.prototype.subtract=ua,l.prototype.multiply=ha,l.prototype.divide=pa,l.prototype.remainder=va,l.prototype.divideAndRemainder=ga,l.prototype.modPow=Bs,l.prototype.modInverse=wa,l.prototype.pow=Pa,l.prototype.gcd=Ws,l.prototype.isProbablePrime=Fs,l.prototype.square=da;var ge=l;ge.prototype.IsNegative=function(){return this.compareTo(ge.ZERO)==-1},ge.op_Equality=function(a,P){return a.compareTo(P)==0},ge.op_Inequality=function(a,P){return a.compareTo(P)!=0},ge.op_GreaterThan=function(a,P){return a.compareTo(P)>0},ge.op_LessThan=function(a,P){return a.compareTo(P)<0},ge.op_Addition=function(a,P){return new ge(a,void 0,void 0).add(new ge(P,void 0,void 0))},ge.op_Subtraction=function(a,P){return new ge(a,void 0,void 0).subtract(new ge(P,void 0,void 0))},ge.Int128Mul=function(a,P){return new ge(a,void 0,void 0).multiply(new ge(P,void 0,void 0))},ge.op_Division=function(a,P){return a.divide(P)},ge.prototype.ToDouble=function(){return parseFloat(this.toString())};var hi=function(a,P){var A;if(typeof Object.getOwnPropertyNames>"u"){for(A in P.prototype)(typeof a.prototype[A]>"u"||a.prototype[A]===Object.prototype[A])&&(a.prototype[A]=P.prototype[A]);for(A in P)typeof a[A]>"u"&&(a[A]=P[A]);a.$baseCtor=P}else{for(var F=Object.getOwnPropertyNames(P.prototype),j=0;j<F.length;j++)typeof Object.getOwnPropertyDescriptor(a.prototype,F[j])>"u"&&Object.defineProperty(a.prototype,F[j],Object.getOwnPropertyDescriptor(P.prototype,F[j]));for(A in P)typeof a[A]>"u"&&(a[A]=P[A]);a.$baseCtor=P}};e.Path=function(){return[]},e.Path.prototype.push=Array.prototype.push,e.Paths=function(){return[]},e.Paths.prototype.push=Array.prototype.push,e.DoublePoint=function(){var a=arguments;this.X=0,this.Y=0,a.length===1?(this.X=a[0].X,this.Y=a[0].Y):a.length===2&&(this.X=a[0],this.Y=a[1])},e.DoublePoint0=function(){this.X=0,this.Y=0},e.DoublePoint0.prototype=e.DoublePoint.prototype,e.DoublePoint1=function(a){this.X=a.X,this.Y=a.Y},e.DoublePoint1.prototype=e.DoublePoint.prototype,e.DoublePoint2=function(a,P){this.X=a,this.Y=P},e.DoublePoint2.prototype=e.DoublePoint.prototype,e.PolyNode=function(){this.m_Parent=null,this.m_polygon=new e.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1},e.PolyNode.prototype.IsHoleNode=function(){for(var a=!0,P=this.m_Parent;P!==null;)a=!a,P=P.m_Parent;return a},e.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length},e.PolyNode.prototype.Contour=function(){return this.m_polygon},e.PolyNode.prototype.AddChild=function(a){var P=this.m_Childs.length;this.m_Childs.push(a),a.m_Parent=this,a.m_Index=P},e.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()},e.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]},e.PolyNode.prototype.Childs=function(){return this.m_Childs},e.PolyNode.prototype.Parent=function(){return this.m_Parent},e.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()},e.PolyTree=function(){this.m_AllPolys=[],e.PolyNode.call(this)},e.PolyTree.prototype.Clear=function(){for(var a=0,P=this.m_AllPolys.length;a<P;a++)this.m_AllPolys[a]=null;this.m_AllPolys.length=0,this.m_Childs.length=0},e.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null},e.PolyTree.prototype.Total=function(){var a=this.m_AllPolys.length;return a>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&a--,a},hi(e.PolyTree,e.PolyNode),e.Math_Abs_Int64=e.Math_Abs_Int32=e.Math_Abs_Double=function(a){return Math.abs(a)},e.Math_Max_Int32_Int32=function(a,P){return Math.max(a,P)},s.msie||s.opera||s.safari?e.Cast_Int32=function(a){return a|0}:e.Cast_Int32=function(a){return~~a},typeof Number.toInteger>"u"&&(Number.toInteger=null),s.chrome?e.Cast_Int64=function(a){return a<-2147483648||a>2147483647?a<0?Math.ceil(a):Math.floor(a):~~a}:s.firefox&&typeof Number.toInteger=="function"?e.Cast_Int64=function(a){return Number.toInteger(a)}:s.msie7||s.msie8?e.Cast_Int64=function(a){return parseInt(a,10)}:s.msie?e.Cast_Int64=function(a){return a<-2147483648||a>2147483647?a<0?Math.ceil(a):Math.floor(a):a|0}:e.Cast_Int64=function(a){return a<0?Math.ceil(a):Math.floor(a)},e.Clear=function(a){a.length=0},e.PI=3.141592653589793,e.PI2=2*3.141592653589793,e.IntPoint=function(){var a=arguments,P=a.length;if(this.X=0,this.Y=0,e.use_xyz)if(this.Z=0,P===3)this.X=a[0],this.Y=a[1],this.Z=a[2];else if(P===2)this.X=a[0],this.Y=a[1],this.Z=0;else if(P===1)if(a[0]instanceof e.DoublePoint){var A=a[0];this.X=e.Clipper.Round(A.X),this.Y=e.Clipper.Round(A.Y),this.Z=0}else{var F=a[0];typeof F.Z>"u"&&(F.Z=0),this.X=F.X,this.Y=F.Y,this.Z=F.Z}else this.X=0,this.Y=0,this.Z=0;else if(P===2)this.X=a[0],this.Y=a[1];else if(P===1)if(a[0]instanceof e.DoublePoint){var A=a[0];this.X=e.Clipper.Round(A.X),this.Y=e.Clipper.Round(A.Y)}else{var F=a[0];this.X=F.X,this.Y=F.Y}else this.X=0,this.Y=0},e.IntPoint.op_Equality=function(a,P){return a.X===P.X&&a.Y===P.Y},e.IntPoint.op_Inequality=function(a,P){return a.X!==P.X||a.Y!==P.Y},e.IntPoint0=function(){this.X=0,this.Y=0,e.use_xyz&&(this.Z=0)},e.IntPoint0.prototype=e.IntPoint.prototype,e.IntPoint1=function(a){this.X=a.X,this.Y=a.Y,e.use_xyz&&(typeof a.Z>"u"?this.Z=0:this.Z=a.Z)},e.IntPoint1.prototype=e.IntPoint.prototype,e.IntPoint1dp=function(a){this.X=e.Clipper.Round(a.X),this.Y=e.Clipper.Round(a.Y),e.use_xyz&&(this.Z=0)},e.IntPoint1dp.prototype=e.IntPoint.prototype,e.IntPoint2=function(a,P,A){this.X=a,this.Y=P,e.use_xyz&&(typeof A>"u"?this.Z=0:this.Z=A)},e.IntPoint2.prototype=e.IntPoint.prototype,e.IntRect=function(){var a=arguments,P=a.length;if(P===4)this.left=a[0],this.top=a[1],this.right=a[2],this.bottom=a[3];else if(P===1){var A=a[0];this.left=A.left,this.top=A.top,this.right=A.right,this.bottom=A.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0},e.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0},e.IntRect0.prototype=e.IntRect.prototype,e.IntRect1=function(a){this.left=a.left,this.top=a.top,this.right=a.right,this.bottom=a.bottom},e.IntRect1.prototype=e.IntRect.prototype,e.IntRect4=function(a,P,A,F){this.left=a,this.top=P,this.right=A,this.bottom=F},e.IntRect4.prototype=e.IntRect.prototype,e.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},e.PolyType={ptSubject:0,ptClip:1},e.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},e.JoinType={jtSquare:0,jtRound:1,jtMiter:2},e.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},e.EdgeSide={esLeft:0,esRight:1},e.Direction={dRightToLeft:0,dLeftToRight:1},e.TEdge=function(){this.Bot=new e.IntPoint0,this.Curr=new e.IntPoint0,this.Top=new e.IntPoint0,this.Delta=new e.IntPoint0,this.Dx=0,this.PolyTyp=e.PolyType.ptSubject,this.Side=e.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null},e.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new e.IntPoint0},e.MyIntersectNodeSort=function(){},e.MyIntersectNodeSort.Compare=function(a,P){var A=P.Pt.Y-a.Pt.Y;return A>0?1:A<0?-1:0},e.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null},e.Scanbeam=function(){this.Y=0,this.Next=null},e.Maxima=function(){this.X=0,this.Next=null,this.Prev=null},e.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null},e.OutPt=function(){this.Idx=0,this.Pt=new e.IntPoint0,this.Next=null,this.Prev=null},e.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new e.IntPoint0},e.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null},e.ClipperBase.horizontal=-9007199254740992,e.ClipperBase.Skip=-2,e.ClipperBase.Unassigned=-1,e.ClipperBase.tolerance=1e-20,e.ClipperBase.loRange=47453132,e.ClipperBase.hiRange=0xfffffffffffff,e.ClipperBase.near_zero=function(a){return a>-e.ClipperBase.tolerance&&a<e.ClipperBase.tolerance},e.ClipperBase.IsHorizontal=function(a){return a.Delta.Y===0},e.ClipperBase.prototype.PointIsVertex=function(a,P){var A=P;do{if(e.IntPoint.op_Equality(A.Pt,a))return!0;A=A.Next}while(A!==P);return!1},e.ClipperBase.prototype.PointOnLineSegment=function(a,P,A,F){return F?a.X===P.X&&a.Y===P.Y||a.X===A.X&&a.Y===A.Y||a.X>P.X==a.X<A.X&&a.Y>P.Y==a.Y<A.Y&&ge.op_Equality(ge.Int128Mul(a.X-P.X,A.Y-P.Y),ge.Int128Mul(A.X-P.X,a.Y-P.Y)):a.X===P.X&&a.Y===P.Y||a.X===A.X&&a.Y===A.Y||a.X>P.X==a.X<A.X&&a.Y>P.Y==a.Y<A.Y&&(a.X-P.X)*(A.Y-P.Y)===(A.X-P.X)*(a.Y-P.Y)},e.ClipperBase.prototype.PointOnPolygon=function(a,P,A){for(var F=P;;){if(this.PointOnLineSegment(a,F.Pt,F.Next.Pt,A))return!0;if(F=F.Next,F===P)break}return!1},e.ClipperBase.prototype.SlopesEqual=e.ClipperBase.SlopesEqual=function(){var a=arguments,P=a.length,A,F,j,_,st,St,Pt;return P===3?(A=a[0],F=a[1],Pt=a[2],Pt?ge.op_Equality(ge.Int128Mul(A.Delta.Y,F.Delta.X),ge.Int128Mul(A.Delta.X,F.Delta.Y)):e.Cast_Int64(A.Delta.Y*F.Delta.X)===e.Cast_Int64(A.Delta.X*F.Delta.Y)):P===4?(j=a[0],_=a[1],st=a[2],Pt=a[3],Pt?ge.op_Equality(ge.Int128Mul(j.Y-_.Y,_.X-st.X),ge.Int128Mul(j.X-_.X,_.Y-st.Y)):e.Cast_Int64((j.Y-_.Y)*(_.X-st.X))-e.Cast_Int64((j.X-_.X)*(_.Y-st.Y))===0):(j=a[0],_=a[1],st=a[2],St=a[3],Pt=a[4],Pt?ge.op_Equality(ge.Int128Mul(j.Y-_.Y,st.X-St.X),ge.Int128Mul(j.X-_.X,st.Y-St.Y)):e.Cast_Int64((j.Y-_.Y)*(st.X-St.X))-e.Cast_Int64((j.X-_.X)*(st.Y-St.Y))===0)},e.ClipperBase.SlopesEqual3=function(a,P,A){return A?ge.op_Equality(ge.Int128Mul(a.Delta.Y,P.Delta.X),ge.Int128Mul(a.Delta.X,P.Delta.Y)):e.Cast_Int64(a.Delta.Y*P.Delta.X)===e.Cast_Int64(a.Delta.X*P.Delta.Y)},e.ClipperBase.SlopesEqual4=function(a,P,A,F){return F?ge.op_Equality(ge.Int128Mul(a.Y-P.Y,P.X-A.X),ge.Int128Mul(a.X-P.X,P.Y-A.Y)):e.Cast_Int64((a.Y-P.Y)*(P.X-A.X))-e.Cast_Int64((a.X-P.X)*(P.Y-A.Y))===0},e.ClipperBase.SlopesEqual5=function(a,P,A,F,j){return j?ge.op_Equality(ge.Int128Mul(a.Y-P.Y,A.X-F.X),ge.Int128Mul(a.X-P.X,A.Y-F.Y)):e.Cast_Int64((a.Y-P.Y)*(A.X-F.X))-e.Cast_Int64((a.X-P.X)*(A.Y-F.Y))===0},e.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var a=0,P=this.m_edges.length;a<P;++a){for(var A=0,F=this.m_edges[a].length;A<F;++A)this.m_edges[a][A]=null;e.Clear(this.m_edges[a])}e.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1},e.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var a=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=a}this.m_CurrentLM=null},e.ClipperBase.prototype.RangeTest=function(a,P){P.Value?(a.X>e.ClipperBase.hiRange||a.Y>e.ClipperBase.hiRange||-a.X>e.ClipperBase.hiRange||-a.Y>e.ClipperBase.hiRange)&&e.Error("Coordinate outside allowed range in RangeTest()."):(a.X>e.ClipperBase.loRange||a.Y>e.ClipperBase.loRange||-a.X>e.ClipperBase.loRange||-a.Y>e.ClipperBase.loRange)&&(P.Value=!0,this.RangeTest(a,P))},e.ClipperBase.prototype.InitEdge=function(a,P,A,F){a.Next=P,a.Prev=A,a.Curr.X=F.X,a.Curr.Y=F.Y,e.use_xyz&&(a.Curr.Z=F.Z),a.OutIdx=-1},e.ClipperBase.prototype.InitEdge2=function(a,P){a.Curr.Y>=a.Next.Curr.Y?(a.Bot.X=a.Curr.X,a.Bot.Y=a.Curr.Y,e.use_xyz&&(a.Bot.Z=a.Curr.Z),a.Top.X=a.Next.Curr.X,a.Top.Y=a.Next.Curr.Y,e.use_xyz&&(a.Top.Z=a.Next.Curr.Z)):(a.Top.X=a.Curr.X,a.Top.Y=a.Curr.Y,e.use_xyz&&(a.Top.Z=a.Curr.Z),a.Bot.X=a.Next.Curr.X,a.Bot.Y=a.Next.Curr.Y,e.use_xyz&&(a.Bot.Z=a.Next.Curr.Z)),this.SetDx(a),a.PolyTyp=P},e.ClipperBase.prototype.FindNextLocMin=function(a){for(var P;;){for(;e.IntPoint.op_Inequality(a.Bot,a.Prev.Bot)||e.IntPoint.op_Equality(a.Curr,a.Top);)a=a.Next;if(a.Dx!==e.ClipperBase.horizontal&&a.Prev.Dx!==e.ClipperBase.horizontal)break;for(;a.Prev.Dx===e.ClipperBase.horizontal;)a=a.Prev;for(P=a;a.Dx===e.ClipperBase.horizontal;)a=a.Next;if(a.Top.Y!==a.Prev.Bot.Y){P.Prev.Bot.X<a.Bot.X&&(a=P);break}}return a},e.ClipperBase.prototype.ProcessBound=function(a,P){var A,F=a,j;if(F.OutIdx===e.ClipperBase.Skip){if(a=F,P){for(;a.Top.Y===a.Next.Bot.Y;)a=a.Next;for(;a!==F&&a.Dx===e.ClipperBase.horizontal;)a=a.Prev}else{for(;a.Top.Y===a.Prev.Bot.Y;)a=a.Prev;for(;a!==F&&a.Dx===e.ClipperBase.horizontal;)a=a.Next}if(a===F)P?F=a.Next:F=a.Prev;else{P?a=F.Next:a=F.Prev;var _=new e.LocalMinima;_.Next=null,_.Y=a.Bot.Y,_.LeftBound=null,_.RightBound=a,a.WindDelta=0,F=this.ProcessBound(a,P),this.InsertLocalMinima(_)}return F}if(a.Dx===e.ClipperBase.horizontal&&(P?A=a.Prev:A=a.Next,A.Dx===e.ClipperBase.horizontal?A.Bot.X!==a.Bot.X&&A.Top.X!==a.Bot.X&&this.ReverseHorizontal(a):A.Bot.X!==a.Bot.X&&this.ReverseHorizontal(a)),A=a,P){for(;F.Top.Y===F.Next.Bot.Y&&F.Next.OutIdx!==e.ClipperBase.Skip;)F=F.Next;if(F.Dx===e.ClipperBase.horizontal&&F.Next.OutIdx!==e.ClipperBase.Skip){for(j=F;j.Prev.Dx===e.ClipperBase.horizontal;)j=j.Prev;j.Prev.Top.X>F.Next.Top.X&&(F=j.Prev)}for(;a!==F;)a.NextInLML=a.Next,a.Dx===e.ClipperBase.horizontal&&a!==A&&a.Bot.X!==a.Prev.Top.X&&this.ReverseHorizontal(a),a=a.Next;a.Dx===e.ClipperBase.horizontal&&a!==A&&a.Bot.X!==a.Prev.Top.X&&this.ReverseHorizontal(a),F=F.Next}else{for(;F.Top.Y===F.Prev.Bot.Y&&F.Prev.OutIdx!==e.ClipperBase.Skip;)F=F.Prev;if(F.Dx===e.ClipperBase.horizontal&&F.Prev.OutIdx!==e.ClipperBase.Skip){for(j=F;j.Next.Dx===e.ClipperBase.horizontal;)j=j.Next;(j.Next.Top.X===F.Prev.Top.X||j.Next.Top.X>F.Prev.Top.X)&&(F=j.Next)}for(;a!==F;)a.NextInLML=a.Prev,a.Dx===e.ClipperBase.horizontal&&a!==A&&a.Bot.X!==a.Next.Top.X&&this.ReverseHorizontal(a),a=a.Prev;a.Dx===e.ClipperBase.horizontal&&a!==A&&a.Bot.X!==a.Next.Top.X&&this.ReverseHorizontal(a),F=F.Prev}return F},e.ClipperBase.prototype.AddPath=function(a,P,A){e.use_lines?!A&&P===e.PolyType.ptClip&&e.Error("AddPath: Open paths must be subject."):A||e.Error("AddPath: Open paths have been disabled.");var F=a.length-1;if(A)for(;F>0&&e.IntPoint.op_Equality(a[F],a[0]);)--F;for(;F>0&&e.IntPoint.op_Equality(a[F],a[F-1]);)--F;if(A&&F<2||!A&&F<1)return!1;for(var j=new Array,_=0;_<=F;_++)j.push(new e.TEdge);var st=!0;j[1].Curr.X=a[1].X,j[1].Curr.Y=a[1].Y,e.use_xyz&&(j[1].Curr.Z=a[1].Z);var St={Value:this.m_UseFullRange};this.RangeTest(a[0],St),this.m_UseFullRange=St.Value,St.Value=this.m_UseFullRange,this.RangeTest(a[F],St),this.m_UseFullRange=St.Value,this.InitEdge(j[0],j[1],j[F],a[0]),this.InitEdge(j[F],j[0],j[F-1],a[F]);for(var _=F-1;_>=1;--_)St.Value=this.m_UseFullRange,this.RangeTest(a[_],St),this.m_UseFullRange=St.Value,this.InitEdge(j[_],j[_+1],j[_-1],a[_]);for(var Pt=j[0],Bt=Pt,Ht=Pt;;){if(Bt.Curr===Bt.Next.Curr&&(A||Bt.Next!==Pt)){if(Bt===Bt.Next)break;Bt===Pt&&(Pt=Bt.Next),Bt=this.RemoveEdge(Bt),Ht=Bt;continue}if(Bt.Prev===Bt.Next)break;if(A&&e.ClipperBase.SlopesEqual4(Bt.Prev.Curr,Bt.Curr,Bt.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(Bt.Prev.Curr,Bt.Curr,Bt.Next.Curr))){Bt===Pt&&(Pt=Bt.Next),Bt=this.RemoveEdge(Bt),Bt=Bt.Prev,Ht=Bt;continue}if(Bt=Bt.Next,Bt===Ht||!A&&Bt.Next===Pt)break}if(!A&&Bt===Bt.Next||A&&Bt.Prev===Bt.Next)return!1;A||(this.m_HasOpenPaths=!0,Pt.Prev.OutIdx=e.ClipperBase.Skip),Bt=Pt;do this.InitEdge2(Bt,P),Bt=Bt.Next,st&&Bt.Curr.Y!==Pt.Curr.Y&&(st=!1);while(Bt!==Pt);if(st){if(A)return!1;Bt.Prev.OutIdx=e.ClipperBase.Skip;var jt=new e.LocalMinima;for(jt.Next=null,jt.Y=Bt.Bot.Y,jt.LeftBound=null,jt.RightBound=Bt,jt.RightBound.Side=e.EdgeSide.esRight,jt.RightBound.WindDelta=0;Bt.Bot.X!==Bt.Prev.Top.X&&this.ReverseHorizontal(Bt),Bt.Next.OutIdx!==e.ClipperBase.Skip;)Bt.NextInLML=Bt.Next,Bt=Bt.Next;return this.InsertLocalMinima(jt),this.m_edges.push(j),!0}this.m_edges.push(j);var qt,oe=null;for(e.IntPoint.op_Equality(Bt.Prev.Bot,Bt.Prev.Top)&&(Bt=Bt.Next);Bt=this.FindNextLocMin(Bt),Bt!==oe;){oe===null&&(oe=Bt);var jt=new e.LocalMinima;jt.Next=null,jt.Y=Bt.Bot.Y,Bt.Dx<Bt.Prev.Dx?(jt.LeftBound=Bt.Prev,jt.RightBound=Bt,qt=!1):(jt.LeftBound=Bt,jt.RightBound=Bt.Prev,qt=!0),jt.LeftBound.Side=e.EdgeSide.esLeft,jt.RightBound.Side=e.EdgeSide.esRight,A?jt.LeftBound.Next===jt.RightBound?jt.LeftBound.WindDelta=-1:jt.LeftBound.WindDelta=1:jt.LeftBound.WindDelta=0,jt.RightBound.WindDelta=-jt.LeftBound.WindDelta,Bt=this.ProcessBound(jt.LeftBound,qt),Bt.OutIdx===e.ClipperBase.Skip&&(Bt=this.ProcessBound(Bt,qt));var me=this.ProcessBound(jt.RightBound,!qt);me.OutIdx===e.ClipperBase.Skip&&(me=this.ProcessBound(me,!qt)),jt.LeftBound.OutIdx===e.ClipperBase.Skip?jt.LeftBound=null:jt.RightBound.OutIdx===e.ClipperBase.Skip&&(jt.RightBound=null),this.InsertLocalMinima(jt),qt||(Bt=me)}return!0},e.ClipperBase.prototype.AddPaths=function(a,P,A){for(var F=!1,j=0,_=a.length;j<_;++j)this.AddPath(a[j],P,A)&&(F=!0);return F},e.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(a,P,A){return e.IntPoint.op_Equality(a,A)||e.IntPoint.op_Equality(a,P)||e.IntPoint.op_Equality(A,P)?!1:a.X!==A.X?P.X>a.X==P.X<A.X:P.Y>a.Y==P.Y<A.Y},e.ClipperBase.prototype.RemoveEdge=function(a){a.Prev.Next=a.Next,a.Next.Prev=a.Prev;var P=a.Next;return a.Prev=null,P},e.ClipperBase.prototype.SetDx=function(a){a.Delta.X=a.Top.X-a.Bot.X,a.Delta.Y=a.Top.Y-a.Bot.Y,a.Delta.Y===0?a.Dx=e.ClipperBase.horizontal:a.Dx=a.Delta.X/a.Delta.Y},e.ClipperBase.prototype.InsertLocalMinima=function(a){if(this.m_MinimaList===null)this.m_MinimaList=a;else if(a.Y>=this.m_MinimaList.Y)a.Next=this.m_MinimaList,this.m_MinimaList=a;else{for(var P=this.m_MinimaList;P.Next!==null&&a.Y<P.Next.Y;)P=P.Next;a.Next=P.Next,P.Next=a}},e.ClipperBase.prototype.PopLocalMinima=function(a,P){return P.v=this.m_CurrentLM,this.m_CurrentLM!==null&&this.m_CurrentLM.Y===a?(this.m_CurrentLM=this.m_CurrentLM.Next,!0):!1},e.ClipperBase.prototype.ReverseHorizontal=function(a){var P=a.Top.X;a.Top.X=a.Bot.X,a.Bot.X=P,e.use_xyz&&(P=a.Top.Z,a.Top.Z=a.Bot.Z,a.Bot.Z=P)},e.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!==null){this.m_Scanbeam=null;for(var a=this.m_MinimaList;a!==null;){this.InsertScanbeam(a.Y);var P=a.LeftBound;P!==null&&(P.Curr.X=P.Bot.X,P.Curr.Y=P.Bot.Y,e.use_xyz&&(P.Curr.Z=P.Bot.Z),P.OutIdx=e.ClipperBase.Unassigned),P=a.RightBound,P!==null&&(P.Curr.X=P.Bot.X,P.Curr.Y=P.Bot.Y,e.use_xyz&&(P.Curr.Z=P.Bot.Z),P.OutIdx=e.ClipperBase.Unassigned),a=a.Next}this.m_ActiveEdges=null}},e.ClipperBase.prototype.InsertScanbeam=function(a){if(this.m_Scanbeam===null)this.m_Scanbeam=new e.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=a;else if(a>this.m_Scanbeam.Y){var P=new e.Scanbeam;P.Y=a,P.Next=this.m_Scanbeam,this.m_Scanbeam=P}else{for(var A=this.m_Scanbeam;A.Next!==null&&a<=A.Next.Y;)A=A.Next;if(a===A.Y)return;var F=new e.Scanbeam;F.Y=a,F.Next=A.Next,A.Next=F}},e.ClipperBase.prototype.PopScanbeam=function(a){return this.m_Scanbeam===null?(a.v=0,!1):(a.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)},e.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null},e.ClipperBase.prototype.CreateOutRec=function(){var a=new e.OutRec;return a.Idx=e.ClipperBase.Unassigned,a.IsHole=!1,a.IsOpen=!1,a.FirstLeft=null,a.Pts=null,a.BottomPt=null,a.PolyNode=null,this.m_PolyOuts.push(a),a.Idx=this.m_PolyOuts.length-1,a},e.ClipperBase.prototype.DisposeOutRec=function(a){var P=this.m_PolyOuts[a];P.Pts=null,P=null,this.m_PolyOuts[a]=null},e.ClipperBase.prototype.UpdateEdgeIntoAEL=function(a){a.NextInLML===null&&e.Error("UpdateEdgeIntoAEL: invalid call");var P=a.PrevInAEL,A=a.NextInAEL;return a.NextInLML.OutIdx=a.OutIdx,P!==null?P.NextInAEL=a.NextInLML:this.m_ActiveEdges=a.NextInLML,A!==null&&(A.PrevInAEL=a.NextInLML),a.NextInLML.Side=a.Side,a.NextInLML.WindDelta=a.WindDelta,a.NextInLML.WindCnt=a.WindCnt,a.NextInLML.WindCnt2=a.WindCnt2,a=a.NextInLML,a.Curr.X=a.Bot.X,a.Curr.Y=a.Bot.Y,a.PrevInAEL=P,a.NextInAEL=A,e.ClipperBase.IsHorizontal(a)||this.InsertScanbeam(a.Top.Y),a},e.ClipperBase.prototype.SwapPositionsInAEL=function(a,P){if(!(a.NextInAEL===a.PrevInAEL||P.NextInAEL===P.PrevInAEL)){if(a.NextInAEL===P){var A=P.NextInAEL;A!==null&&(A.PrevInAEL=a);var F=a.PrevInAEL;F!==null&&(F.NextInAEL=P),P.PrevInAEL=F,P.NextInAEL=a,a.PrevInAEL=P,a.NextInAEL=A}else if(P.NextInAEL===a){var j=a.NextInAEL;j!==null&&(j.PrevInAEL=P);var _=P.PrevInAEL;_!==null&&(_.NextInAEL=a),a.PrevInAEL=_,a.NextInAEL=P,P.PrevInAEL=a,P.NextInAEL=j}else{var st=a.NextInAEL,St=a.PrevInAEL;a.NextInAEL=P.NextInAEL,a.NextInAEL!==null&&(a.NextInAEL.PrevInAEL=a),a.PrevInAEL=P.PrevInAEL,a.PrevInAEL!==null&&(a.PrevInAEL.NextInAEL=a),P.NextInAEL=st,P.NextInAEL!==null&&(P.NextInAEL.PrevInAEL=P),P.PrevInAEL=St,P.PrevInAEL!==null&&(P.PrevInAEL.NextInAEL=P)}a.PrevInAEL===null?this.m_ActiveEdges=a:P.PrevInAEL===null&&(this.m_ActiveEdges=P)}},e.ClipperBase.prototype.DeleteFromAEL=function(a){var P=a.PrevInAEL,A=a.NextInAEL;P===null&&A===null&&a!==this.m_ActiveEdges||(P!==null?P.NextInAEL=A:this.m_ActiveEdges=A,A!==null&&(A.PrevInAEL=P),a.NextInAEL=null,a.PrevInAEL=null)},e.Clipper=function(a){typeof a>"u"&&(a=0),this.m_PolyOuts=null,this.m_ClipType=e.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=e.PolyFillType.pftEvenOdd,this.m_SubjFillType=e.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,e.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=e.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&a)!==0,this.StrictlySimple=(2&a)!==0,this.PreserveCollinear=(4&a)!==0,e.use_xyz&&(this.ZFillFunction=null)},e.Clipper.ioReverseSolution=1,e.Clipper.ioStrictlySimple=2,e.Clipper.ioPreserveCollinear=4,e.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),e.ClipperBase.prototype.Clear.call(this))},e.Clipper.prototype.InsertMaxima=function(a){var P=new e.Maxima;if(P.X=a,this.m_Maxima===null)this.m_Maxima=P,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(a<this.m_Maxima.X)P.Next=this.m_Maxima,P.Prev=null,this.m_Maxima=P;else{for(var A=this.m_Maxima;A.Next!==null&&a>=A.Next.X;)A=A.Next;if(a===A.X)return;P.Next=A.Next,P.Prev=A,A.Next!==null&&(A.Next.Prev=P),A.Next=P}},e.Clipper.prototype.Execute=function(){var a=arguments,P=a.length,A=a[1]instanceof e.PolyTree;if(P===4&&!A){var F=a[0],j=a[1],_=a[2],st=a[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&e.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,e.Clear(j),this.m_SubjFillType=_,this.m_ClipFillType=st,this.m_ClipType=F,this.m_UsingPolyTree=!1;try{var St=this.ExecuteInternal();St&&this.BuildResult(j)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return St}else if(P===4&&A){var F=a[0],Pt=a[1],_=a[2],st=a[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=_,this.m_ClipFillType=st,this.m_ClipType=F,this.m_UsingPolyTree=!0;try{var St=this.ExecuteInternal();St&&this.BuildResult2(Pt)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return St}else if(P===2&&!A){var F=a[0],j=a[1];return this.Execute(F,j,e.PolyFillType.pftEvenOdd,e.PolyFillType.pftEvenOdd)}else if(P===2&&A){var F=a[0],Pt=a[1];return this.Execute(F,Pt,e.PolyFillType.pftEvenOdd,e.PolyFillType.pftEvenOdd)}},e.Clipper.prototype.FixHoleLinkage=function(a){if(!(a.FirstLeft===null||a.IsHole!==a.FirstLeft.IsHole&&a.FirstLeft.Pts!==null)){for(var P=a.FirstLeft;P!==null&&(P.IsHole===a.IsHole||P.Pts===null);)P=P.FirstLeft;a.FirstLeft=P}},e.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var a={},P={};if(!this.PopScanbeam(a))return!1;for(this.InsertLocalMinimaIntoAEL(a.v);this.PopScanbeam(P)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(P.v))return!1;this.ProcessEdgesAtTopOfScanbeam(P.v),a.v=P.v,this.InsertLocalMinimaIntoAEL(a.v)}var A,F,j;for(F=0,j=this.m_PolyOuts.length;F<j;F++)A=this.m_PolyOuts[F],!(A.Pts===null||A.IsOpen)&&(A.IsHole^this.ReverseSolution)==this.Area$1(A)>0&&this.ReversePolyPtLinks(A.Pts);for(this.JoinCommonEdges(),F=0,j=this.m_PolyOuts.length;F<j;F++)A=this.m_PolyOuts[F],A.Pts!==null&&(A.IsOpen?this.FixupOutPolyline(A):this.FixupOutPolygon(A));return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{this.m_Joins.length=0,this.m_GhostJoins.length=0}},e.Clipper.prototype.DisposeAllPolyPts=function(){for(var a=0,P=this.m_PolyOuts.length;a<P;++a)this.DisposeOutRec(a);e.Clear(this.m_PolyOuts)},e.Clipper.prototype.AddJoin=function(a,P,A){var F=new e.Join;F.OutPt1=a,F.OutPt2=P,F.OffPt.X=A.X,F.OffPt.Y=A.Y,e.use_xyz&&(F.OffPt.Z=A.Z),this.m_Joins.push(F)},e.Clipper.prototype.AddGhostJoin=function(a,P){var A=new e.Join;A.OutPt1=a,A.OffPt.X=P.X,A.OffPt.Y=P.Y,e.use_xyz&&(A.OffPt.Z=P.Z),this.m_GhostJoins.push(A)},e.Clipper.prototype.SetZ=function(a,P,A){if(this.ZFillFunction!==null){if(a.Z!==0||this.ZFillFunction===null)return;e.IntPoint.op_Equality(a,P.Bot)?a.Z=P.Bot.Z:e.IntPoint.op_Equality(a,P.Top)?a.Z=P.Top.Z:e.IntPoint.op_Equality(a,A.Bot)?a.Z=A.Bot.Z:e.IntPoint.op_Equality(a,A.Top)?a.Z=A.Top.Z:this.ZFillFunction(P.Bot,P.Top,A.Bot,A.Top,a)}},e.Clipper.prototype.InsertLocalMinimaIntoAEL=function(a){for(var P={},A,F;this.PopLocalMinima(a,P);){A=P.v.LeftBound,F=P.v.RightBound;var j=null;if(A===null?(this.InsertEdgeIntoAEL(F,null),this.SetWindingCount(F),this.IsContributing(F)&&(j=this.AddOutPt(F,F.Bot))):F===null?(this.InsertEdgeIntoAEL(A,null),this.SetWindingCount(A),this.IsContributing(A)&&(j=this.AddOutPt(A,A.Bot)),this.InsertScanbeam(A.Top.Y)):(this.InsertEdgeIntoAEL(A,null),this.InsertEdgeIntoAEL(F,A),this.SetWindingCount(A),F.WindCnt=A.WindCnt,F.WindCnt2=A.WindCnt2,this.IsContributing(A)&&(j=this.AddLocalMinPoly(A,F,A.Bot)),this.InsertScanbeam(A.Top.Y)),F!==null&&(e.ClipperBase.IsHorizontal(F)?(F.NextInLML!==null&&this.InsertScanbeam(F.NextInLML.Top.Y),this.AddEdgeToSEL(F)):this.InsertScanbeam(F.Top.Y)),!(A===null||F===null)){if(j!==null&&e.ClipperBase.IsHorizontal(F)&&this.m_GhostJoins.length>0&&F.WindDelta!==0)for(var _=0,st=this.m_GhostJoins.length;_<st;_++){var St=this.m_GhostJoins[_];this.HorzSegmentsOverlap(St.OutPt1.Pt.X,St.OffPt.X,F.Bot.X,F.Top.X)&&this.AddJoin(St.OutPt1,j,St.OffPt)}if(A.OutIdx>=0&&A.PrevInAEL!==null&&A.PrevInAEL.Curr.X===A.Bot.X&&A.PrevInAEL.OutIdx>=0&&e.ClipperBase.SlopesEqual5(A.PrevInAEL.Curr,A.PrevInAEL.Top,A.Curr,A.Top,this.m_UseFullRange)&&A.WindDelta!==0&&A.PrevInAEL.WindDelta!==0){var Pt=this.AddOutPt(A.PrevInAEL,A.Bot);this.AddJoin(j,Pt,A.Top)}if(A.NextInAEL!==F){if(F.OutIdx>=0&&F.PrevInAEL.OutIdx>=0&&e.ClipperBase.SlopesEqual5(F.PrevInAEL.Curr,F.PrevInAEL.Top,F.Curr,F.Top,this.m_UseFullRange)&&F.WindDelta!==0&&F.PrevInAEL.WindDelta!==0){var Pt=this.AddOutPt(F.PrevInAEL,F.Bot);this.AddJoin(j,Pt,F.Top)}var Bt=A.NextInAEL;if(Bt!==null)for(;Bt!==F;)this.IntersectEdges(F,Bt,A.Curr),Bt=Bt.NextInAEL}}}},e.Clipper.prototype.InsertEdgeIntoAEL=function(a,P){if(this.m_ActiveEdges===null)a.PrevInAEL=null,a.NextInAEL=null,this.m_ActiveEdges=a;else if(P===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,a))a.PrevInAEL=null,a.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=a,this.m_ActiveEdges=a;else{for(P===null&&(P=this.m_ActiveEdges);P.NextInAEL!==null&&!this.E2InsertsBeforeE1(P.NextInAEL,a);)P=P.NextInAEL;a.NextInAEL=P.NextInAEL,P.NextInAEL!==null&&(P.NextInAEL.PrevInAEL=a),a.PrevInAEL=P,P.NextInAEL=a}},e.Clipper.prototype.E2InsertsBeforeE1=function(a,P){return P.Curr.X===a.Curr.X?P.Top.Y>a.Top.Y?P.Top.X<e.Clipper.TopX(a,P.Top.Y):a.Top.X>e.Clipper.TopX(P,a.Top.Y):P.Curr.X<a.Curr.X},e.Clipper.prototype.IsEvenOddFillType=function(a){return a.PolyTyp===e.PolyType.ptSubject?this.m_SubjFillType===e.PolyFillType.pftEvenOdd:this.m_ClipFillType===e.PolyFillType.pftEvenOdd},e.Clipper.prototype.IsEvenOddAltFillType=function(a){return a.PolyTyp===e.PolyType.ptSubject?this.m_ClipFillType===e.PolyFillType.pftEvenOdd:this.m_SubjFillType===e.PolyFillType.pftEvenOdd},e.Clipper.prototype.IsContributing=function(a){var P,A;switch(a.PolyTyp===e.PolyType.ptSubject?(P=this.m_SubjFillType,A=this.m_ClipFillType):(P=this.m_ClipFillType,A=this.m_SubjFillType),P){case e.PolyFillType.pftEvenOdd:if(a.WindDelta===0&&a.WindCnt!==1)return!1;break;case e.PolyFillType.pftNonZero:if(Math.abs(a.WindCnt)!==1)return!1;break;case e.PolyFillType.pftPositive:if(a.WindCnt!==1)return!1;break;default:if(a.WindCnt!==-1)return!1;break}switch(this.m_ClipType){case e.ClipType.ctIntersection:switch(A){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2!==0;case e.PolyFillType.pftPositive:return a.WindCnt2>0;default:return a.WindCnt2<0}case e.ClipType.ctUnion:switch(A){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2===0;case e.PolyFillType.pftPositive:return a.WindCnt2<=0;default:return a.WindCnt2>=0}case e.ClipType.ctDifference:if(a.PolyTyp===e.PolyType.ptSubject)switch(A){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2===0;case e.PolyFillType.pftPositive:return a.WindCnt2<=0;default:return a.WindCnt2>=0}else switch(A){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2!==0;case e.PolyFillType.pftPositive:return a.WindCnt2>0;default:return a.WindCnt2<0}case e.ClipType.ctXor:if(a.WindDelta===0)switch(A){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2===0;case e.PolyFillType.pftPositive:return a.WindCnt2<=0;default:return a.WindCnt2>=0}else return!0}return!0},e.Clipper.prototype.SetWindingCount=function(a){for(var P=a.PrevInAEL;P!==null&&(P.PolyTyp!==a.PolyTyp||P.WindDelta===0);)P=P.PrevInAEL;if(P===null){var A=a.PolyTyp===e.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;a.WindDelta===0?a.WindCnt=A===e.PolyFillType.pftNegative?-1:1:a.WindCnt=a.WindDelta,a.WindCnt2=0,P=this.m_ActiveEdges}else if(a.WindDelta===0&&this.m_ClipType!==e.ClipType.ctUnion)a.WindCnt=1,a.WindCnt2=P.WindCnt2,P=P.NextInAEL;else if(this.IsEvenOddFillType(a)){if(a.WindDelta===0){for(var F=!0,j=P.PrevInAEL;j!==null;)j.PolyTyp===P.PolyTyp&&j.WindDelta!==0&&(F=!F),j=j.PrevInAEL;a.WindCnt=F?0:1}else a.WindCnt=a.WindDelta;a.WindCnt2=P.WindCnt2,P=P.NextInAEL}else P.WindCnt*P.WindDelta<0?Math.abs(P.WindCnt)>1?P.WindDelta*a.WindDelta<0?a.WindCnt=P.WindCnt:a.WindCnt=P.WindCnt+a.WindDelta:a.WindCnt=a.WindDelta===0?1:a.WindDelta:a.WindDelta===0?a.WindCnt=P.WindCnt<0?P.WindCnt-1:P.WindCnt+1:P.WindDelta*a.WindDelta<0?a.WindCnt=P.WindCnt:a.WindCnt=P.WindCnt+a.WindDelta,a.WindCnt2=P.WindCnt2,P=P.NextInAEL;if(this.IsEvenOddAltFillType(a))for(;P!==a;)P.WindDelta!==0&&(a.WindCnt2=a.WindCnt2===0?1:0),P=P.NextInAEL;else for(;P!==a;)a.WindCnt2+=P.WindDelta,P=P.NextInAEL},e.Clipper.prototype.AddEdgeToSEL=function(a){this.m_SortedEdges===null?(this.m_SortedEdges=a,a.PrevInSEL=null,a.NextInSEL=null):(a.NextInSEL=this.m_SortedEdges,a.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=a,this.m_SortedEdges=a)},e.Clipper.prototype.PopEdgeFromSEL=function(a){if(a.v=this.m_SortedEdges,a.v===null)return!1;var P=a.v;return this.m_SortedEdges=a.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),P.NextInSEL=null,P.PrevInSEL=null,!0},e.Clipper.prototype.CopyAELToSEL=function(){var a=this.m_ActiveEdges;for(this.m_SortedEdges=a;a!==null;)a.PrevInSEL=a.PrevInAEL,a.NextInSEL=a.NextInAEL,a=a.NextInAEL},e.Clipper.prototype.SwapPositionsInSEL=function(a,P){if(!(a.NextInSEL===null&&a.PrevInSEL===null)&&!(P.NextInSEL===null&&P.PrevInSEL===null)){if(a.NextInSEL===P){var A=P.NextInSEL;A!==null&&(A.PrevInSEL=a);var F=a.PrevInSEL;F!==null&&(F.NextInSEL=P),P.PrevInSEL=F,P.NextInSEL=a,a.PrevInSEL=P,a.NextInSEL=A}else if(P.NextInSEL===a){var A=a.NextInSEL;A!==null&&(A.PrevInSEL=P);var F=P.PrevInSEL;F!==null&&(F.NextInSEL=a),a.PrevInSEL=F,a.NextInSEL=P,P.PrevInSEL=a,P.NextInSEL=A}else{var A=a.NextInSEL,F=a.PrevInSEL;a.NextInSEL=P.NextInSEL,a.NextInSEL!==null&&(a.NextInSEL.PrevInSEL=a),a.PrevInSEL=P.PrevInSEL,a.PrevInSEL!==null&&(a.PrevInSEL.NextInSEL=a),P.NextInSEL=A,P.NextInSEL!==null&&(P.NextInSEL.PrevInSEL=P),P.PrevInSEL=F,P.PrevInSEL!==null&&(P.PrevInSEL.NextInSEL=P)}a.PrevInSEL===null?this.m_SortedEdges=a:P.PrevInSEL===null&&(this.m_SortedEdges=P)}},e.Clipper.prototype.AddLocalMaxPoly=function(a,P,A){this.AddOutPt(a,A),P.WindDelta===0&&this.AddOutPt(P,A),a.OutIdx===P.OutIdx?(a.OutIdx=-1,P.OutIdx=-1):a.OutIdx<P.OutIdx?this.AppendPolygon(a,P):this.AppendPolygon(P,a)},e.Clipper.prototype.AddLocalMinPoly=function(a,P,A){var F,j,_;if(e.ClipperBase.IsHorizontal(P)||a.Dx>P.Dx?(F=this.AddOutPt(a,A),P.OutIdx=a.OutIdx,a.Side=e.EdgeSide.esLeft,P.Side=e.EdgeSide.esRight,j=a,j.PrevInAEL===P?_=P.PrevInAEL:_=j.PrevInAEL):(F=this.AddOutPt(P,A),a.OutIdx=P.OutIdx,a.Side=e.EdgeSide.esRight,P.Side=e.EdgeSide.esLeft,j=P,j.PrevInAEL===a?_=a.PrevInAEL:_=j.PrevInAEL),_!==null&&_.OutIdx>=0&&_.Top.Y<A.Y&&j.Top.Y<A.Y){var st=e.Clipper.TopX(_,A.Y),St=e.Clipper.TopX(j,A.Y);if(st===St&&j.WindDelta!==0&&_.WindDelta!==0&&e.ClipperBase.SlopesEqual5(new e.IntPoint2(st,A.Y),_.Top,new e.IntPoint2(St,A.Y),j.Top,this.m_UseFullRange)){var Pt=this.AddOutPt(_,A);this.AddJoin(F,Pt,j.Top)}}return F},e.Clipper.prototype.AddOutPt=function(a,P){if(a.OutIdx<0){var A=this.CreateOutRec();A.IsOpen=a.WindDelta===0;var F=new e.OutPt;return A.Pts=F,F.Idx=A.Idx,F.Pt.X=P.X,F.Pt.Y=P.Y,e.use_xyz&&(F.Pt.Z=P.Z),F.Next=F,F.Prev=F,A.IsOpen||this.SetHoleState(a,A),a.OutIdx=A.Idx,F}else{var A=this.m_PolyOuts[a.OutIdx],j=A.Pts,_=a.Side===e.EdgeSide.esLeft;if(_&&e.IntPoint.op_Equality(P,j.Pt))return j;if(!_&&e.IntPoint.op_Equality(P,j.Prev.Pt))return j.Prev;var F=new e.OutPt;return F.Idx=A.Idx,F.Pt.X=P.X,F.Pt.Y=P.Y,e.use_xyz&&(F.Pt.Z=P.Z),F.Next=j,F.Prev=j.Prev,F.Prev.Next=F,j.Prev=F,_&&(A.Pts=F),F}},e.Clipper.prototype.GetLastOutPt=function(a){var P=this.m_PolyOuts[a.OutIdx];return a.Side===e.EdgeSide.esLeft?P.Pts:P.Pts.Prev},e.Clipper.prototype.SwapPoints=function(a,P){var A=new e.IntPoint1(a.Value);a.Value.X=P.Value.X,a.Value.Y=P.Value.Y,e.use_xyz&&(a.Value.Z=P.Value.Z),P.Value.X=A.X,P.Value.Y=A.Y,e.use_xyz&&(P.Value.Z=A.Z)},e.Clipper.prototype.HorzSegmentsOverlap=function(a,P,A,F){var j;return a>P&&(j=a,a=P,P=j),A>F&&(j=A,A=F,F=j),a<F&&A<P},e.Clipper.prototype.SetHoleState=function(a,P){for(var A=a.PrevInAEL,F=null;A!==null;)A.OutIdx>=0&&A.WindDelta!==0&&(F===null?F=A:F.OutIdx===A.OutIdx&&(F=null)),A=A.PrevInAEL;F===null?(P.FirstLeft=null,P.IsHole=!1):(P.FirstLeft=this.m_PolyOuts[F.OutIdx],P.IsHole=!P.FirstLeft.IsHole)},e.Clipper.prototype.GetDx=function(a,P){return a.Y===P.Y?e.ClipperBase.horizontal:(P.X-a.X)/(P.Y-a.Y)},e.Clipper.prototype.FirstIsBottomPt=function(a,P){for(var A=a.Prev;e.IntPoint.op_Equality(A.Pt,a.Pt)&&A!==a;)A=A.Prev;var F=Math.abs(this.GetDx(a.Pt,A.Pt));for(A=a.Next;e.IntPoint.op_Equality(A.Pt,a.Pt)&&A!==a;)A=A.Next;var j=Math.abs(this.GetDx(a.Pt,A.Pt));for(A=P.Prev;e.IntPoint.op_Equality(A.Pt,P.Pt)&&A!==P;)A=A.Prev;var _=Math.abs(this.GetDx(P.Pt,A.Pt));for(A=P.Next;e.IntPoint.op_Equality(A.Pt,P.Pt)&&A!==P;)A=A.Next;var st=Math.abs(this.GetDx(P.Pt,A.Pt));return Math.max(F,j)===Math.max(_,st)&&Math.min(F,j)===Math.min(_,st)?this.Area(a)>0:F>=_&&F>=st||j>=_&&j>=st},e.Clipper.prototype.GetBottomPt=function(a){for(var P=null,A=a.Next;A!==a;)A.Pt.Y>a.Pt.Y?(a=A,P=null):A.Pt.Y===a.Pt.Y&&A.Pt.X<=a.Pt.X&&(A.Pt.X<a.Pt.X?(P=null,a=A):A.Next!==a&&A.Prev!==a&&(P=A)),A=A.Next;if(P!==null)for(;P!==A;)for(this.FirstIsBottomPt(A,P)||(a=P),P=P.Next;e.IntPoint.op_Inequality(P.Pt,a.Pt);)P=P.Next;return a},e.Clipper.prototype.GetLowermostRec=function(a,P){a.BottomPt===null&&(a.BottomPt=this.GetBottomPt(a.Pts)),P.BottomPt===null&&(P.BottomPt=this.GetBottomPt(P.Pts));var A=a.BottomPt,F=P.BottomPt;return A.Pt.Y>F.Pt.Y?a:A.Pt.Y<F.Pt.Y?P:A.Pt.X<F.Pt.X?a:A.Pt.X>F.Pt.X||A.Next===A?P:F.Next===F||this.FirstIsBottomPt(A,F)?a:P},e.Clipper.prototype.OutRec1RightOfOutRec2=function(a,P){do if(a=a.FirstLeft,a===P)return!0;while(a!==null);return!1},e.Clipper.prototype.GetOutRec=function(a){for(var P=this.m_PolyOuts[a];P!==this.m_PolyOuts[P.Idx];)P=this.m_PolyOuts[P.Idx];return P},e.Clipper.prototype.AppendPolygon=function(a,P){var A=this.m_PolyOuts[a.OutIdx],F=this.m_PolyOuts[P.OutIdx],j;this.OutRec1RightOfOutRec2(A,F)?j=F:this.OutRec1RightOfOutRec2(F,A)?j=A:j=this.GetLowermostRec(A,F);var _=A.Pts,st=_.Prev,St=F.Pts,Pt=St.Prev;a.Side===e.EdgeSide.esLeft?P.Side===e.EdgeSide.esLeft?(this.ReversePolyPtLinks(St),St.Next=_,_.Prev=St,st.Next=Pt,Pt.Prev=st,A.Pts=Pt):(Pt.Next=_,_.Prev=Pt,St.Prev=st,st.Next=St,A.Pts=St):P.Side===e.EdgeSide.esRight?(this.ReversePolyPtLinks(St),st.Next=Pt,Pt.Prev=st,St.Next=_,_.Prev=St):(st.Next=St,St.Prev=st,_.Prev=Pt,Pt.Next=_),A.BottomPt=null,j===F&&(F.FirstLeft!==A&&(A.FirstLeft=F.FirstLeft),A.IsHole=F.IsHole),F.Pts=null,F.BottomPt=null,F.FirstLeft=A;var Bt=a.OutIdx,Ht=P.OutIdx;a.OutIdx=-1,P.OutIdx=-1;for(var jt=this.m_ActiveEdges;jt!==null;){if(jt.OutIdx===Ht){jt.OutIdx=Bt,jt.Side=a.Side;break}jt=jt.NextInAEL}F.Idx=A.Idx},e.Clipper.prototype.ReversePolyPtLinks=function(a){if(a!==null){var P,A;P=a;do A=P.Next,P.Next=P.Prev,P.Prev=A,P=A;while(P!==a)}},e.Clipper.SwapSides=function(a,P){var A=a.Side;a.Side=P.Side,P.Side=A},e.Clipper.SwapPolyIndexes=function(a,P){var A=a.OutIdx;a.OutIdx=P.OutIdx,P.OutIdx=A},e.Clipper.prototype.IntersectEdges=function(a,P,A){var F=a.OutIdx>=0,j=P.OutIdx>=0;if(e.use_xyz&&this.SetZ(A,a,P),e.use_lines&&(a.WindDelta===0||P.WindDelta===0)){if(a.WindDelta===0&&P.WindDelta===0)return;a.PolyTyp===P.PolyTyp&&a.WindDelta!==P.WindDelta&&this.m_ClipType===e.ClipType.ctUnion?a.WindDelta===0?j&&(this.AddOutPt(a,A),F&&(a.OutIdx=-1)):F&&(this.AddOutPt(P,A),j&&(P.OutIdx=-1)):a.PolyTyp!==P.PolyTyp&&(a.WindDelta===0&&Math.abs(P.WindCnt)===1&&(this.m_ClipType!==e.ClipType.ctUnion||P.WindCnt2===0)?(this.AddOutPt(a,A),F&&(a.OutIdx=-1)):P.WindDelta===0&&Math.abs(a.WindCnt)===1&&(this.m_ClipType!==e.ClipType.ctUnion||a.WindCnt2===0)&&(this.AddOutPt(P,A),j&&(P.OutIdx=-1)));return}if(a.PolyTyp===P.PolyTyp)if(this.IsEvenOddFillType(a)){var _=a.WindCnt;a.WindCnt=P.WindCnt,P.WindCnt=_}else a.WindCnt+P.WindDelta===0?a.WindCnt=-a.WindCnt:a.WindCnt+=P.WindDelta,P.WindCnt-a.WindDelta===0?P.WindCnt=-P.WindCnt:P.WindCnt-=a.WindDelta;else this.IsEvenOddFillType(P)?a.WindCnt2=a.WindCnt2===0?1:0:a.WindCnt2+=P.WindDelta,this.IsEvenOddFillType(a)?P.WindCnt2=P.WindCnt2===0?1:0:P.WindCnt2-=a.WindDelta;var st,St,Pt,Bt;a.PolyTyp===e.PolyType.ptSubject?(st=this.m_SubjFillType,Pt=this.m_ClipFillType):(st=this.m_ClipFillType,Pt=this.m_SubjFillType),P.PolyTyp===e.PolyType.ptSubject?(St=this.m_SubjFillType,Bt=this.m_ClipFillType):(St=this.m_ClipFillType,Bt=this.m_SubjFillType);var Ht,jt;switch(st){case e.PolyFillType.pftPositive:Ht=a.WindCnt;break;case e.PolyFillType.pftNegative:Ht=-a.WindCnt;break;default:Ht=Math.abs(a.WindCnt);break}switch(St){case e.PolyFillType.pftPositive:jt=P.WindCnt;break;case e.PolyFillType.pftNegative:jt=-P.WindCnt;break;default:jt=Math.abs(P.WindCnt);break}if(F&&j)Ht!==0&&Ht!==1||jt!==0&&jt!==1||a.PolyTyp!==P.PolyTyp&&this.m_ClipType!==e.ClipType.ctXor?this.AddLocalMaxPoly(a,P,A):(this.AddOutPt(a,A),this.AddOutPt(P,A),e.Clipper.SwapSides(a,P),e.Clipper.SwapPolyIndexes(a,P));else if(F)(jt===0||jt===1)&&(this.AddOutPt(a,A),e.Clipper.SwapSides(a,P),e.Clipper.SwapPolyIndexes(a,P));else if(j)(Ht===0||Ht===1)&&(this.AddOutPt(P,A),e.Clipper.SwapSides(a,P),e.Clipper.SwapPolyIndexes(a,P));else if((Ht===0||Ht===1)&&(jt===0||jt===1)){var qt,oe;switch(Pt){case e.PolyFillType.pftPositive:qt=a.WindCnt2;break;case e.PolyFillType.pftNegative:qt=-a.WindCnt2;break;default:qt=Math.abs(a.WindCnt2);break}switch(Bt){case e.PolyFillType.pftPositive:oe=P.WindCnt2;break;case e.PolyFillType.pftNegative:oe=-P.WindCnt2;break;default:oe=Math.abs(P.WindCnt2);break}if(a.PolyTyp!==P.PolyTyp)this.AddLocalMinPoly(a,P,A);else if(Ht===1&&jt===1)switch(this.m_ClipType){case e.ClipType.ctIntersection:qt>0&&oe>0&&this.AddLocalMinPoly(a,P,A);break;case e.ClipType.ctUnion:qt<=0&&oe<=0&&this.AddLocalMinPoly(a,P,A);break;case e.ClipType.ctDifference:(a.PolyTyp===e.PolyType.ptClip&&qt>0&&oe>0||a.PolyTyp===e.PolyType.ptSubject&&qt<=0&&oe<=0)&&this.AddLocalMinPoly(a,P,A);break;case e.ClipType.ctXor:this.AddLocalMinPoly(a,P,A);break}else e.Clipper.SwapSides(a,P)}},e.Clipper.prototype.DeleteFromSEL=function(a){var P=a.PrevInSEL,A=a.NextInSEL;P===null&&A===null&&a!==this.m_SortedEdges||(P!==null?P.NextInSEL=A:this.m_SortedEdges=A,A!==null&&(A.PrevInSEL=P),a.NextInSEL=null,a.PrevInSEL=null)},e.Clipper.prototype.ProcessHorizontals=function(){for(var a={};this.PopEdgeFromSEL(a);)this.ProcessHorizontal(a.v)},e.Clipper.prototype.GetHorzDirection=function(a,P){a.Bot.X<a.Top.X?(P.Left=a.Bot.X,P.Right=a.Top.X,P.Dir=e.Direction.dLeftToRight):(P.Left=a.Top.X,P.Right=a.Bot.X,P.Dir=e.Direction.dRightToLeft)},e.Clipper.prototype.ProcessHorizontal=function(a){var P={Dir:null,Left:null,Right:null};this.GetHorzDirection(a,P);for(var A=P.Dir,F=P.Left,j=P.Right,_=a.WindDelta===0,st=a,St=null;st.NextInLML!==null&&e.ClipperBase.IsHorizontal(st.NextInLML);)st=st.NextInLML;st.NextInLML===null&&(St=this.GetMaximaPair(st));var Pt=this.m_Maxima;if(Pt!==null)if(A===e.Direction.dLeftToRight){for(;Pt!==null&&Pt.X<=a.Bot.X;)Pt=Pt.Next;Pt!==null&&Pt.X>=st.Top.X&&(Pt=null)}else{for(;Pt.Next!==null&&Pt.Next.X<a.Bot.X;)Pt=Pt.Next;Pt.X<=st.Top.X&&(Pt=null)}for(var Bt=null;;){for(var Ht=a===st,jt=this.GetNextInAEL(a,A);jt!==null;){if(Pt!==null)if(A===e.Direction.dLeftToRight)for(;Pt!==null&&Pt.X<jt.Curr.X;)a.OutIdx>=0&&!_&&this.AddOutPt(a,new e.IntPoint2(Pt.X,a.Bot.Y)),Pt=Pt.Next;else for(;Pt!==null&&Pt.X>jt.Curr.X;)a.OutIdx>=0&&!_&&this.AddOutPt(a,new e.IntPoint2(Pt.X,a.Bot.Y)),Pt=Pt.Prev;if(A===e.Direction.dLeftToRight&&jt.Curr.X>j||A===e.Direction.dRightToLeft&&jt.Curr.X<F||jt.Curr.X===a.Top.X&&a.NextInLML!==null&&jt.Dx<a.NextInLML.Dx)break;if(a.OutIdx>=0&&!_){e.use_xyz&&(A===e.Direction.dLeftToRight?this.SetZ(jt.Curr,a,jt):this.SetZ(jt.Curr,jt,a)),Bt=this.AddOutPt(a,jt.Curr);for(var qt=this.m_SortedEdges;qt!==null;){if(qt.OutIdx>=0&&this.HorzSegmentsOverlap(a.Bot.X,a.Top.X,qt.Bot.X,qt.Top.X)){var oe=this.GetLastOutPt(qt);this.AddJoin(oe,Bt,qt.Top)}qt=qt.NextInSEL}this.AddGhostJoin(Bt,a.Bot)}if(jt===St&&Ht){a.OutIdx>=0&&this.AddLocalMaxPoly(a,St,a.Top),this.DeleteFromAEL(a),this.DeleteFromAEL(St);return}if(A===e.Direction.dLeftToRight){var me=new e.IntPoint2(jt.Curr.X,a.Curr.Y);this.IntersectEdges(a,jt,me)}else{var me=new e.IntPoint2(jt.Curr.X,a.Curr.Y);this.IntersectEdges(jt,a,me)}var Se=this.GetNextInAEL(jt,A);this.SwapPositionsInAEL(a,jt),jt=Se}if(a.NextInLML===null||!e.ClipperBase.IsHorizontal(a.NextInLML))break;a=this.UpdateEdgeIntoAEL(a),a.OutIdx>=0&&this.AddOutPt(a,a.Bot),P={Dir:A,Left:F,Right:j},this.GetHorzDirection(a,P),A=P.Dir,F=P.Left,j=P.Right}if(a.OutIdx>=0&&Bt===null){Bt=this.GetLastOutPt(a);for(var qt=this.m_SortedEdges;qt!==null;){if(qt.OutIdx>=0&&this.HorzSegmentsOverlap(a.Bot.X,a.Top.X,qt.Bot.X,qt.Top.X)){var oe=this.GetLastOutPt(qt);this.AddJoin(oe,Bt,qt.Top)}qt=qt.NextInSEL}this.AddGhostJoin(Bt,a.Top)}if(a.NextInLML!==null)if(a.OutIdx>=0){if(Bt=this.AddOutPt(a,a.Top),a=this.UpdateEdgeIntoAEL(a),a.WindDelta===0)return;var De=a.PrevInAEL,Se=a.NextInAEL;if(De!==null&&De.Curr.X===a.Bot.X&&De.Curr.Y===a.Bot.Y&&De.WindDelta===0&&De.OutIdx>=0&&De.Curr.Y>De.Top.Y&&e.ClipperBase.SlopesEqual3(a,De,this.m_UseFullRange)){var oe=this.AddOutPt(De,a.Bot);this.AddJoin(Bt,oe,a.Top)}else if(Se!==null&&Se.Curr.X===a.Bot.X&&Se.Curr.Y===a.Bot.Y&&Se.WindDelta!==0&&Se.OutIdx>=0&&Se.Curr.Y>Se.Top.Y&&e.ClipperBase.SlopesEqual3(a,Se,this.m_UseFullRange)){var oe=this.AddOutPt(Se,a.Bot);this.AddJoin(Bt,oe,a.Top)}}else a=this.UpdateEdgeIntoAEL(a);else a.OutIdx>=0&&this.AddOutPt(a,a.Top),this.DeleteFromAEL(a)},e.Clipper.prototype.GetNextInAEL=function(a,P){return P===e.Direction.dLeftToRight?a.NextInAEL:a.PrevInAEL},e.Clipper.prototype.IsMinima=function(a){return a!==null&&a.Prev.NextInLML!==a&&a.Next.NextInLML!==a},e.Clipper.prototype.IsMaxima=function(a,P){return a!==null&&a.Top.Y===P&&a.NextInLML===null},e.Clipper.prototype.IsIntermediate=function(a,P){return a.Top.Y===P&&a.NextInLML!==null},e.Clipper.prototype.GetMaximaPair=function(a){return e.IntPoint.op_Equality(a.Next.Top,a.Top)&&a.Next.NextInLML===null?a.Next:e.IntPoint.op_Equality(a.Prev.Top,a.Top)&&a.Prev.NextInLML===null?a.Prev:null},e.Clipper.prototype.GetMaximaPairEx=function(a){var P=this.GetMaximaPair(a);return P===null||P.OutIdx===e.ClipperBase.Skip||P.NextInAEL===P.PrevInAEL&&!e.ClipperBase.IsHorizontal(P)?null:P},e.Clipper.prototype.ProcessIntersections=function(a){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(a),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,e.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0},e.Clipper.prototype.BuildIntersectList=function(a){if(this.m_ActiveEdges!==null){var P=this.m_ActiveEdges;for(this.m_SortedEdges=P;P!==null;)P.PrevInSEL=P.PrevInAEL,P.NextInSEL=P.NextInAEL,P.Curr.X=e.Clipper.TopX(P,a),P=P.NextInAEL;for(var A=!0;A&&this.m_SortedEdges!==null;){for(A=!1,P=this.m_SortedEdges;P.NextInSEL!==null;){var F=P.NextInSEL,j=new e.IntPoint0;if(P.Curr.X>F.Curr.X){this.IntersectPoint(P,F,j),j.Y<a&&(j=new e.IntPoint2(e.Clipper.TopX(P,a),a));var _=new e.IntersectNode;_.Edge1=P,_.Edge2=F,_.Pt.X=j.X,_.Pt.Y=j.Y,e.use_xyz&&(_.Pt.Z=j.Z),this.m_IntersectList.push(_),this.SwapPositionsInSEL(P,F),A=!0}else P=F}if(P.PrevInSEL!==null)P.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}},e.Clipper.prototype.EdgesAdjacent=function(a){return a.Edge1.NextInSEL===a.Edge2||a.Edge1.PrevInSEL===a.Edge2},e.Clipper.IntersectNodeSort=function(a,P){return P.Pt.Y-a.Pt.Y},e.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var a=this.m_IntersectList.length,P=0;P<a;P++){if(!this.EdgesAdjacent(this.m_IntersectList[P])){for(var A=P+1;A<a&&!this.EdgesAdjacent(this.m_IntersectList[A]);)A++;if(A===a)return!1;var F=this.m_IntersectList[P];this.m_IntersectList[P]=this.m_IntersectList[A],this.m_IntersectList[A]=F}this.SwapPositionsInSEL(this.m_IntersectList[P].Edge1,this.m_IntersectList[P].Edge2)}return!0},e.Clipper.prototype.ProcessIntersectList=function(){for(var a=0,P=this.m_IntersectList.length;a<P;a++){var A=this.m_IntersectList[a];this.IntersectEdges(A.Edge1,A.Edge2,A.Pt),this.SwapPositionsInAEL(A.Edge1,A.Edge2)}this.m_IntersectList.length=0};var Ea=function(a){return a<0?Math.ceil(a-.5):Math.round(a)},Ys=function(a){return a<0?Math.ceil(a-.5):Math.floor(a+.5)},di=function(a){return a<0?-Math.round(Math.abs(a)):Math.round(a)},Xs=function(a){return a<0?(a-=.5,a<-2147483648?Math.ceil(a):a|0):(a+=.5,a>2147483647?Math.floor(a):a|0)};s.msie?e.Clipper.Round=Ea:s.chromium?e.Clipper.Round=di:s.safari?e.Clipper.Round=Xs:e.Clipper.Round=Ys,e.Clipper.TopX=function(a,P){return P===a.Top.Y?a.Top.X:a.Bot.X+e.Clipper.Round(a.Dx*(P-a.Bot.Y))},e.Clipper.prototype.IntersectPoint=function(a,P,A){A.X=0,A.Y=0;var F,j;if(a.Dx===P.Dx){A.Y=a.Curr.Y,A.X=e.Clipper.TopX(a,A.Y);return}if(a.Delta.X===0)A.X=a.Bot.X,e.ClipperBase.IsHorizontal(P)?A.Y=P.Bot.Y:(j=P.Bot.Y-P.Bot.X/P.Dx,A.Y=e.Clipper.Round(A.X/P.Dx+j));else if(P.Delta.X===0)A.X=P.Bot.X,e.ClipperBase.IsHorizontal(a)?A.Y=a.Bot.Y:(F=a.Bot.Y-a.Bot.X/a.Dx,A.Y=e.Clipper.Round(A.X/a.Dx+F));else{F=a.Bot.X-a.Bot.Y*a.Dx,j=P.Bot.X-P.Bot.Y*P.Dx;var _=(j-F)/(a.Dx-P.Dx);A.Y=e.Clipper.Round(_),Math.abs(a.Dx)<Math.abs(P.Dx)?A.X=e.Clipper.Round(a.Dx*_+F):A.X=e.Clipper.Round(P.Dx*_+j)}if(A.Y<a.Top.Y||A.Y<P.Top.Y){if(a.Top.Y>P.Top.Y)return A.Y=a.Top.Y,A.X=e.Clipper.TopX(P,a.Top.Y),A.X<a.Top.X;A.Y=P.Top.Y,Math.abs(a.Dx)<Math.abs(P.Dx)?A.X=e.Clipper.TopX(a,A.Y):A.X=e.Clipper.TopX(P,A.Y)}A.Y>a.Curr.Y&&(A.Y=a.Curr.Y,Math.abs(a.Dx)>Math.abs(P.Dx)?A.X=e.Clipper.TopX(P,A.Y):A.X=e.Clipper.TopX(a,A.Y))},e.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(a){for(var P=this.m_ActiveEdges;P!==null;){var A=this.IsMaxima(P,a);if(A){var F=this.GetMaximaPairEx(P);A=F===null||!e.ClipperBase.IsHorizontal(F)}if(A){this.StrictlySimple&&this.InsertMaxima(P.Top.X);var j=P.PrevInAEL;this.DoMaxima(P),j===null?P=this.m_ActiveEdges:P=j.NextInAEL}else{if(this.IsIntermediate(P,a)&&e.ClipperBase.IsHorizontal(P.NextInLML)?(P=this.UpdateEdgeIntoAEL(P),P.OutIdx>=0&&this.AddOutPt(P,P.Bot),this.AddEdgeToSEL(P)):(P.Curr.X=e.Clipper.TopX(P,a),P.Curr.Y=a),e.use_xyz&&(P.Top.Y===a?P.Curr.Z=P.Top.Z:P.Bot.Y===a?P.Curr.Z=P.Bot.Z:P.Curr.Z=0),this.StrictlySimple){var j=P.PrevInAEL;if(P.OutIdx>=0&&P.WindDelta!==0&&j!==null&&j.OutIdx>=0&&j.Curr.X===P.Curr.X&&j.WindDelta!==0){var _=new e.IntPoint1(P.Curr);e.use_xyz&&this.SetZ(_,j,P);var st=this.AddOutPt(j,_),St=this.AddOutPt(P,_);this.AddJoin(st,St,_)}}P=P.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,P=this.m_ActiveEdges;P!==null;){if(this.IsIntermediate(P,a)){var st=null;P.OutIdx>=0&&(st=this.AddOutPt(P,P.Top)),P=this.UpdateEdgeIntoAEL(P);var j=P.PrevInAEL,Pt=P.NextInAEL;if(j!==null&&j.Curr.X===P.Bot.X&&j.Curr.Y===P.Bot.Y&&st!==null&&j.OutIdx>=0&&j.Curr.Y===j.Top.Y&&e.ClipperBase.SlopesEqual5(P.Curr,P.Top,j.Curr,j.Top,this.m_UseFullRange)&&P.WindDelta!==0&&j.WindDelta!==0){var St=this.AddOutPt(ePrev2,P.Bot);this.AddJoin(st,St,P.Top)}else if(Pt!==null&&Pt.Curr.X===P.Bot.X&&Pt.Curr.Y===P.Bot.Y&&st!==null&&Pt.OutIdx>=0&&Pt.Curr.Y===Pt.Top.Y&&e.ClipperBase.SlopesEqual5(P.Curr,P.Top,Pt.Curr,Pt.Top,this.m_UseFullRange)&&P.WindDelta!==0&&Pt.WindDelta!==0){var St=this.AddOutPt(Pt,P.Bot);this.AddJoin(st,St,P.Top)}}P=P.NextInAEL}},e.Clipper.prototype.DoMaxima=function(a){var P=this.GetMaximaPairEx(a);if(P===null){a.OutIdx>=0&&this.AddOutPt(a,a.Top),this.DeleteFromAEL(a);return}for(var A=a.NextInAEL;A!==null&&A!==P;)this.IntersectEdges(a,A,a.Top),this.SwapPositionsInAEL(a,A),A=a.NextInAEL;a.OutIdx===-1&&P.OutIdx===-1?(this.DeleteFromAEL(a),this.DeleteFromAEL(P)):a.OutIdx>=0&&P.OutIdx>=0?(a.OutIdx>=0&&this.AddLocalMaxPoly(a,P,a.Top),this.DeleteFromAEL(a),this.DeleteFromAEL(P)):e.use_lines&&a.WindDelta===0?(a.OutIdx>=0&&(this.AddOutPt(a,a.Top),a.OutIdx=e.ClipperBase.Unassigned),this.DeleteFromAEL(a),P.OutIdx>=0&&(this.AddOutPt(P,a.Top),P.OutIdx=e.ClipperBase.Unassigned),this.DeleteFromAEL(P)):e.Error("DoMaxima error")},e.Clipper.ReversePaths=function(a){for(var P=0,A=a.length;P<A;P++)a[P].reverse()},e.Clipper.Orientation=function(a){return e.Clipper.Area(a)>=0},e.Clipper.prototype.PointCount=function(a){if(a===null)return 0;var P=0,A=a;do P++,A=A.Next;while(A!==a);return P},e.Clipper.prototype.BuildResult=function(a){e.Clear(a);for(var P=0,A=this.m_PolyOuts.length;P<A;P++){var F=this.m_PolyOuts[P];if(F.Pts!==null){var j=F.Pts.Prev,_=this.PointCount(j);if(!(_<2)){for(var st=new Array(_),St=0;St<_;St++)st[St]=j.Pt,j=j.Prev;a.push(st)}}}},e.Clipper.prototype.BuildResult2=function(a){a.Clear();for(var P=0,A=this.m_PolyOuts.length;P<A;P++){var F=this.m_PolyOuts[P],j=this.PointCount(F.Pts);if(!(F.IsOpen&&j<2||!F.IsOpen&&j<3)){this.FixHoleLinkage(F);var _=new e.PolyNode;a.m_AllPolys.push(_),F.PolyNode=_,_.m_polygon.length=j;for(var st=F.Pts.Prev,St=0;St<j;St++)_.m_polygon[St]=st.Pt,st=st.Prev}}for(var P=0,A=this.m_PolyOuts.length;P<A;P++){var F=this.m_PolyOuts[P];F.PolyNode!==null&&(F.IsOpen?(F.PolyNode.IsOpen=!0,a.AddChild(F.PolyNode)):F.FirstLeft!==null&&F.FirstLeft.PolyNode!==null?F.FirstLeft.PolyNode.AddChild(F.PolyNode):a.AddChild(F.PolyNode))}},e.Clipper.prototype.FixupOutPolyline=function(a){for(var P=a.Pts,A=P.Prev;P!==A;)if(P=P.Next,e.IntPoint.op_Equality(P.Pt,P.Prev.Pt)){P===A&&(A=P.Prev);var F=P.Prev;F.Next=P.Next,P.Next.Prev=F,P=F}P===P.Prev&&(a.Pts=null)},e.Clipper.prototype.FixupOutPolygon=function(a){var P=null;a.BottomPt=null;for(var A=a.Pts,F=this.PreserveCollinear||this.StrictlySimple;;){if(A.Prev===A||A.Prev===A.Next){a.Pts=null;return}if(e.IntPoint.op_Equality(A.Pt,A.Next.Pt)||e.IntPoint.op_Equality(A.Pt,A.Prev.Pt)||e.ClipperBase.SlopesEqual4(A.Prev.Pt,A.Pt,A.Next.Pt,this.m_UseFullRange)&&(!F||!this.Pt2IsBetweenPt1AndPt3(A.Prev.Pt,A.Pt,A.Next.Pt)))P=null,A.Prev.Next=A.Next,A.Next.Prev=A.Prev,A=A.Prev;else{if(A===P)break;P===null&&(P=A),A=A.Next}}a.Pts=A},e.Clipper.prototype.DupOutPt=function(a,P){var A=new e.OutPt;return A.Pt.X=a.Pt.X,A.Pt.Y=a.Pt.Y,e.use_xyz&&(A.Pt.Z=a.Pt.Z),A.Idx=a.Idx,P?(A.Next=a.Next,A.Prev=a,a.Next.Prev=A,a.Next=A):(A.Prev=a.Prev,A.Next=a,a.Prev.Next=A,a.Prev=A),A},e.Clipper.prototype.GetOverlap=function(a,P,A,F,j){return a<P?A<F?(j.Left=Math.max(a,A),j.Right=Math.min(P,F)):(j.Left=Math.max(a,F),j.Right=Math.min(P,A)):A<F?(j.Left=Math.max(P,A),j.Right=Math.min(a,F)):(j.Left=Math.max(P,F),j.Right=Math.min(a,A)),j.Left<j.Right},e.Clipper.prototype.JoinHorz=function(a,P,A,F,j,_){var st=a.Pt.X>P.Pt.X?e.Direction.dRightToLeft:e.Direction.dLeftToRight,St=A.Pt.X>F.Pt.X?e.Direction.dRightToLeft:e.Direction.dLeftToRight;if(st===St)return!1;if(st===e.Direction.dLeftToRight){for(;a.Next.Pt.X<=j.X&&a.Next.Pt.X>=a.Pt.X&&a.Next.Pt.Y===j.Y;)a=a.Next;_&&a.Pt.X!==j.X&&(a=a.Next),P=this.DupOutPt(a,!_),e.IntPoint.op_Inequality(P.Pt,j)&&(a=P,a.Pt.X=j.X,a.Pt.Y=j.Y,e.use_xyz&&(a.Pt.Z=j.Z),P=this.DupOutPt(a,!_))}else{for(;a.Next.Pt.X>=j.X&&a.Next.Pt.X<=a.Pt.X&&a.Next.Pt.Y===j.Y;)a=a.Next;!_&&a.Pt.X!==j.X&&(a=a.Next),P=this.DupOutPt(a,_),e.IntPoint.op_Inequality(P.Pt,j)&&(a=P,a.Pt.X=j.X,a.Pt.Y=j.Y,e.use_xyz&&(a.Pt.Z=j.Z),P=this.DupOutPt(a,_))}if(St===e.Direction.dLeftToRight){for(;A.Next.Pt.X<=j.X&&A.Next.Pt.X>=A.Pt.X&&A.Next.Pt.Y===j.Y;)A=A.Next;_&&A.Pt.X!==j.X&&(A=A.Next),F=this.DupOutPt(A,!_),e.IntPoint.op_Inequality(F.Pt,j)&&(A=F,A.Pt.X=j.X,A.Pt.Y=j.Y,e.use_xyz&&(A.Pt.Z=j.Z),F=this.DupOutPt(A,!_))}else{for(;A.Next.Pt.X>=j.X&&A.Next.Pt.X<=A.Pt.X&&A.Next.Pt.Y===j.Y;)A=A.Next;!_&&A.Pt.X!==j.X&&(A=A.Next),F=this.DupOutPt(A,_),e.IntPoint.op_Inequality(F.Pt,j)&&(A=F,A.Pt.X=j.X,A.Pt.Y=j.Y,e.use_xyz&&(A.Pt.Z=j.Z),F=this.DupOutPt(A,_))}return st===e.Direction.dLeftToRight===_?(a.Prev=A,A.Next=a,P.Next=F,F.Prev=P):(a.Next=A,A.Prev=a,P.Prev=F,F.Next=P),!0},e.Clipper.prototype.JoinPoints=function(a,P,A){var F=a.OutPt1,j=new e.OutPt,_=a.OutPt2,st=new e.OutPt,St=a.OutPt1.Pt.Y===a.OffPt.Y;if(St&&e.IntPoint.op_Equality(a.OffPt,a.OutPt1.Pt)&&e.IntPoint.op_Equality(a.OffPt,a.OutPt2.Pt)){if(P!==A)return!1;for(j=a.OutPt1.Next;j!==F&&e.IntPoint.op_Equality(j.Pt,a.OffPt);)j=j.Next;var Pt=j.Pt.Y>a.OffPt.Y;for(st=a.OutPt2.Next;st!==_&&e.IntPoint.op_Equality(st.Pt,a.OffPt);)st=st.Next;var Bt=st.Pt.Y>a.OffPt.Y;return Pt===Bt?!1:Pt?(j=this.DupOutPt(F,!1),st=this.DupOutPt(_,!0),F.Prev=_,_.Next=F,j.Next=st,st.Prev=j,a.OutPt1=F,a.OutPt2=j,!0):(j=this.DupOutPt(F,!0),st=this.DupOutPt(_,!1),F.Next=_,_.Prev=F,j.Prev=st,st.Next=j,a.OutPt1=F,a.OutPt2=j,!0)}else if(St){for(j=F;F.Prev.Pt.Y===F.Pt.Y&&F.Prev!==j&&F.Prev!==_;)F=F.Prev;for(;j.Next.Pt.Y===j.Pt.Y&&j.Next!==F&&j.Next!==_;)j=j.Next;if(j.Next===F||j.Next===_)return!1;for(st=_;_.Prev.Pt.Y===_.Pt.Y&&_.Prev!==st&&_.Prev!==j;)_=_.Prev;for(;st.Next.Pt.Y===st.Pt.Y&&st.Next!==_&&st.Next!==F;)st=st.Next;if(st.Next===_||st.Next===F)return!1;var Ht={Left:null,Right:null};if(!this.GetOverlap(F.Pt.X,j.Pt.X,_.Pt.X,st.Pt.X,Ht))return!1;var jt=Ht.Left,qt=Ht.Right,oe=new e.IntPoint0,me;return F.Pt.X>=jt&&F.Pt.X<=qt?(oe.X=F.Pt.X,oe.Y=F.Pt.Y,e.use_xyz&&(oe.Z=F.Pt.Z),me=F.Pt.X>j.Pt.X):_.Pt.X>=jt&&_.Pt.X<=qt?(oe.X=_.Pt.X,oe.Y=_.Pt.Y,e.use_xyz&&(oe.Z=_.Pt.Z),me=_.Pt.X>st.Pt.X):j.Pt.X>=jt&&j.Pt.X<=qt?(oe.X=j.Pt.X,oe.Y=j.Pt.Y,e.use_xyz&&(oe.Z=j.Pt.Z),me=j.Pt.X>F.Pt.X):(oe.X=st.Pt.X,oe.Y=st.Pt.Y,e.use_xyz&&(oe.Z=st.Pt.Z),me=st.Pt.X>_.Pt.X),a.OutPt1=F,a.OutPt2=_,this.JoinHorz(F,j,_,st,oe,me)}else{for(j=F.Next;e.IntPoint.op_Equality(j.Pt,F.Pt)&&j!==F;)j=j.Next;var Se=j.Pt.Y>F.Pt.Y||!e.ClipperBase.SlopesEqual4(F.Pt,j.Pt,a.OffPt,this.m_UseFullRange);if(Se){for(j=F.Prev;e.IntPoint.op_Equality(j.Pt,F.Pt)&&j!==F;)j=j.Prev;if(j.Pt.Y>F.Pt.Y||!e.ClipperBase.SlopesEqual4(F.Pt,j.Pt,a.OffPt,this.m_UseFullRange))return!1}for(st=_.Next;e.IntPoint.op_Equality(st.Pt,_.Pt)&&st!==_;)st=st.Next;var De=st.Pt.Y>_.Pt.Y||!e.ClipperBase.SlopesEqual4(_.Pt,st.Pt,a.OffPt,this.m_UseFullRange);if(De){for(st=_.Prev;e.IntPoint.op_Equality(st.Pt,_.Pt)&&st!==_;)st=st.Prev;if(st.Pt.Y>_.Pt.Y||!e.ClipperBase.SlopesEqual4(_.Pt,st.Pt,a.OffPt,this.m_UseFullRange))return!1}return j===F||st===_||j===st||P===A&&Se===De?!1:Se?(j=this.DupOutPt(F,!1),st=this.DupOutPt(_,!0),F.Prev=_,_.Next=F,j.Next=st,st.Prev=j,a.OutPt1=F,a.OutPt2=j,!0):(j=this.DupOutPt(F,!0),st=this.DupOutPt(_,!1),F.Next=_,_.Prev=F,j.Prev=st,st.Next=j,a.OutPt1=F,a.OutPt2=j,!0)}},e.Clipper.GetBounds=function(a){for(var P=0,A=a.length;P<A&&a[P].length===0;)P++;if(P===A)return new e.IntRect(0,0,0,0);var F=new e.IntRect;for(F.left=a[P][0].X,F.right=F.left,F.top=a[P][0].Y,F.bottom=F.top;P<A;P++)for(var j=0,_=a[P].length;j<_;j++)a[P][j].X<F.left?F.left=a[P][j].X:a[P][j].X>F.right&&(F.right=a[P][j].X),a[P][j].Y<F.top?F.top=a[P][j].Y:a[P][j].Y>F.bottom&&(F.bottom=a[P][j].Y);return F},e.Clipper.prototype.GetBounds2=function(a){var P=a,A=new e.IntRect;for(A.left=a.Pt.X,A.right=a.Pt.X,A.top=a.Pt.Y,A.bottom=a.Pt.Y,a=a.Next;a!==P;)a.Pt.X<A.left&&(A.left=a.Pt.X),a.Pt.X>A.right&&(A.right=a.Pt.X),a.Pt.Y<A.top&&(A.top=a.Pt.Y),a.Pt.Y>A.bottom&&(A.bottom=a.Pt.Y),a=a.Next;return A},e.Clipper.PointInPolygon=function(a,P){var A=0,F=P.length;if(F<3)return 0;for(var j=P[0],_=1;_<=F;++_){var st=_===F?P[0]:P[_];if(st.Y===a.Y&&(st.X===a.X||j.Y===a.Y&&st.X>a.X==j.X<a.X))return-1;if(j.Y<a.Y!=st.Y<a.Y){if(j.X>=a.X)if(st.X>a.X)A=1-A;else{var St=(j.X-a.X)*(st.Y-a.Y)-(st.X-a.X)*(j.Y-a.Y);if(St===0)return-1;St>0==st.Y>j.Y&&(A=1-A)}else if(st.X>a.X){var St=(j.X-a.X)*(st.Y-a.Y)-(st.X-a.X)*(j.Y-a.Y);if(St===0)return-1;St>0==st.Y>j.Y&&(A=1-A)}}j=st}return A},e.Clipper.prototype.PointInPolygon=function(a,P){var A=0,F=P,j=a.X,_=a.Y,st=P.Pt.X,St=P.Pt.Y;do{P=P.Next;var Pt=P.Pt.X,Bt=P.Pt.Y;if(Bt===_&&(Pt===j||St===_&&Pt>j==st<j))return-1;if(St<_!=Bt<_){if(st>=j)if(Pt>j)A=1-A;else{var Ht=(st-j)*(Bt-_)-(Pt-j)*(St-_);if(Ht===0)return-1;Ht>0==Bt>St&&(A=1-A)}else if(Pt>j){var Ht=(st-j)*(Bt-_)-(Pt-j)*(St-_);if(Ht===0)return-1;Ht>0==Bt>St&&(A=1-A)}}st=Pt,St=Bt}while(F!==P);return A},e.Clipper.prototype.Poly2ContainsPoly1=function(a,P){var A=a;do{var F=this.PointInPolygon(A.Pt,P);if(F>=0)return F>0;A=A.Next}while(A!==a);return!0},e.Clipper.prototype.FixupFirstLefts1=function(a,P){for(var A,F,j=0,_=this.m_PolyOuts.length;j<_;j++)A=this.m_PolyOuts[j],F=e.Clipper.ParseFirstLeft(A.FirstLeft),A.Pts!==null&&F===a&&this.Poly2ContainsPoly1(A.Pts,P.Pts)&&(A.FirstLeft=P)},e.Clipper.prototype.FixupFirstLefts2=function(a,P){for(var A=P.FirstLeft,F,j,_=0,st=this.m_PolyOuts.length;_<st;_++)F=this.m_PolyOuts[_],!(F.Pts===null||F===P||F===a)&&(j=e.Clipper.ParseFirstLeft(F.FirstLeft),!(j!==A&&j!==a&&j!==P)&&(this.Poly2ContainsPoly1(F.Pts,a.Pts)?F.FirstLeft=a:this.Poly2ContainsPoly1(F.Pts,P.Pts)?F.FirstLeft=P:(F.FirstLeft===a||F.FirstLeft===P)&&(F.FirstLeft=A)))},e.Clipper.prototype.FixupFirstLefts3=function(a,P){for(var A,F,j=0,_=this.m_PolyOuts.length;j<_;j++)A=this.m_PolyOuts[j],F=e.Clipper.ParseFirstLeft(A.FirstLeft),A.Pts!==null&&F===a&&(A.FirstLeft=P)},e.Clipper.ParseFirstLeft=function(a){for(;a!==null&&a.Pts===null;)a=a.FirstLeft;return a},e.Clipper.prototype.JoinCommonEdges=function(){for(var a=0,P=this.m_Joins.length;a<P;a++){var A=this.m_Joins[a],F=this.GetOutRec(A.OutPt1.Idx),j=this.GetOutRec(A.OutPt2.Idx);if(!(F.Pts===null||j.Pts===null)&&!(F.IsOpen||j.IsOpen)){var _;F===j?_=F:this.OutRec1RightOfOutRec2(F,j)?_=j:this.OutRec1RightOfOutRec2(j,F)?_=F:_=this.GetLowermostRec(F,j),this.JoinPoints(A,F,j)&&(F===j?(F.Pts=A.OutPt1,F.BottomPt=null,j=this.CreateOutRec(),j.Pts=A.OutPt2,this.UpdateOutPtIdxs(j),this.Poly2ContainsPoly1(j.Pts,F.Pts)?(j.IsHole=!F.IsHole,j.FirstLeft=F,this.m_UsingPolyTree&&this.FixupFirstLefts2(j,F),(j.IsHole^this.ReverseSolution)==this.Area$1(j)>0&&this.ReversePolyPtLinks(j.Pts)):this.Poly2ContainsPoly1(F.Pts,j.Pts)?(j.IsHole=F.IsHole,F.IsHole=!j.IsHole,j.FirstLeft=F.FirstLeft,F.FirstLeft=j,this.m_UsingPolyTree&&this.FixupFirstLefts2(F,j),(F.IsHole^this.ReverseSolution)==this.Area$1(F)>0&&this.ReversePolyPtLinks(F.Pts)):(j.IsHole=F.IsHole,j.FirstLeft=F.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(F,j))):(j.Pts=null,j.BottomPt=null,j.Idx=F.Idx,F.IsHole=_.IsHole,_===j&&(F.FirstLeft=j.FirstLeft),j.FirstLeft=F,this.m_UsingPolyTree&&this.FixupFirstLefts3(j,F)))}}},e.Clipper.prototype.UpdateOutPtIdxs=function(a){var P=a.Pts;do P.Idx=a.Idx,P=P.Prev;while(P!==a.Pts)},e.Clipper.prototype.DoSimplePolygons=function(){for(var a=0;a<this.m_PolyOuts.length;){var P=this.m_PolyOuts[a++],A=P.Pts;if(!(A===null||P.IsOpen))do{for(var F=A.Next;F!==P.Pts;){if(e.IntPoint.op_Equality(A.Pt,F.Pt)&&F.Next!==A&&F.Prev!==A){var j=A.Prev,_=F.Prev;A.Prev=_,_.Next=A,F.Prev=j,j.Next=F,P.Pts=A;var st=this.CreateOutRec();st.Pts=F,this.UpdateOutPtIdxs(st),this.Poly2ContainsPoly1(st.Pts,P.Pts)?(st.IsHole=!P.IsHole,st.FirstLeft=P,this.m_UsingPolyTree&&this.FixupFirstLefts2(st,P)):this.Poly2ContainsPoly1(P.Pts,st.Pts)?(st.IsHole=P.IsHole,P.IsHole=!st.IsHole,st.FirstLeft=P.FirstLeft,P.FirstLeft=st,this.m_UsingPolyTree&&this.FixupFirstLefts2(P,st)):(st.IsHole=P.IsHole,st.FirstLeft=P.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(P,st)),F=A}F=F.Next}A=A.Next}while(A!==P.Pts)}},e.Clipper.Area=function(a){if(!Array.isArray(a))return 0;var P=a.length;if(P<3)return 0;for(var A=0,F=0,j=P-1;F<P;++F)A+=(a[j].X+a[F].X)*(a[j].Y-a[F].Y),j=F;return-A*.5},e.Clipper.prototype.Area=function(a){var P=a;if(a===null)return 0;var A=0;do A=A+(a.Prev.Pt.X+a.Pt.X)*(a.Prev.Pt.Y-a.Pt.Y),a=a.Next;while(a!==P);return A*.5},e.Clipper.prototype.Area$1=function(a){return this.Area(a.Pts)},e.Clipper.SimplifyPolygon=function(a,P){var A=new Array,F=new e.Clipper(0);return F.StrictlySimple=!0,F.AddPath(a,e.PolyType.ptSubject,!0),F.Execute(e.ClipType.ctUnion,A,P,P),A},e.Clipper.SimplifyPolygons=function(a,P){typeof P>"u"&&(P=e.PolyFillType.pftEvenOdd);var A=new Array,F=new e.Clipper(0);return F.StrictlySimple=!0,F.AddPaths(a,e.PolyType.ptSubject,!0),F.Execute(e.ClipType.ctUnion,A,P,P),A},e.Clipper.DistanceSqrd=function(a,P){var A=a.X-P.X,F=a.Y-P.Y;return A*A+F*F},e.Clipper.DistanceFromLineSqrd=function(a,P,A){var F=P.Y-A.Y,j=A.X-P.X,_=F*P.X+j*P.Y;return _=F*a.X+j*a.Y-_,_*_/(F*F+j*j)},e.Clipper.SlopesNearCollinear=function(a,P,A,F){return Math.abs(a.X-P.X)>Math.abs(a.Y-P.Y)?a.X>P.X==a.X<A.X?e.Clipper.DistanceFromLineSqrd(a,P,A)<F:P.X>a.X==P.X<A.X?e.Clipper.DistanceFromLineSqrd(P,a,A)<F:e.Clipper.DistanceFromLineSqrd(A,a,P)<F:a.Y>P.Y==a.Y<A.Y?e.Clipper.DistanceFromLineSqrd(a,P,A)<F:P.Y>a.Y==P.Y<A.Y?e.Clipper.DistanceFromLineSqrd(P,a,A)<F:e.Clipper.DistanceFromLineSqrd(A,a,P)<F},e.Clipper.PointsAreClose=function(a,P,A){var F=a.X-P.X,j=a.Y-P.Y;return F*F+j*j<=A},e.Clipper.ExcludeOp=function(a){var P=a.Prev;return P.Next=a.Next,a.Next.Prev=P,P.Idx=0,P},e.Clipper.CleanPolygon=function(a,P){typeof P>"u"&&(P=1.415);var A=a.length;if(A===0)return new Array;for(var F=new Array(A),j=0;j<A;++j)F[j]=new e.OutPt;for(var j=0;j<A;++j)F[j].Pt=a[j],F[j].Next=F[(j+1)%A],F[j].Next.Prev=F[j],F[j].Idx=0;for(var _=P*P,st=F[0];st.Idx===0&&st.Next!==st.Prev;)e.Clipper.PointsAreClose(st.Pt,st.Prev.Pt,_)?(st=e.Clipper.ExcludeOp(st),A--):e.Clipper.PointsAreClose(st.Prev.Pt,st.Next.Pt,_)?(e.Clipper.ExcludeOp(st.Next),st=e.Clipper.ExcludeOp(st),A-=2):e.Clipper.SlopesNearCollinear(st.Prev.Pt,st.Pt,st.Next.Pt,_)?(st=e.Clipper.ExcludeOp(st),A--):(st.Idx=1,st=st.Next);A<3&&(A=0);for(var St=new Array(A),j=0;j<A;++j)St[j]=new e.IntPoint1(st.Pt),st=st.Next;return F=null,St},e.Clipper.CleanPolygons=function(a,P){for(var A=new Array(a.length),F=0,j=a.length;F<j;F++)A[F]=e.Clipper.CleanPolygon(a[F],P);return A},e.Clipper.Minkowski=function(a,P,A,F){var j=F?1:0,_=a.length,st=P.length,St=new Array;if(A)for(var Pt=0;Pt<st;Pt++){for(var Bt=new Array(_),Ht=0,jt=a.length,qt=a[Ht];Ht<jt;Ht++,qt=a[Ht])Bt[Ht]=new e.IntPoint2(P[Pt].X+qt.X,P[Pt].Y+qt.Y);St.push(Bt)}else for(var Pt=0;Pt<st;Pt++){for(var Bt=new Array(_),Ht=0,jt=a.length,qt=a[Ht];Ht<jt;Ht++,qt=a[Ht])Bt[Ht]=new e.IntPoint2(P[Pt].X-qt.X,P[Pt].Y-qt.Y);St.push(Bt)}for(var oe=new Array,Pt=0;Pt<st-1+j;Pt++)for(var Ht=0;Ht<_;Ht++){var me=new Array;me.push(St[Pt%st][Ht%_]),me.push(St[(Pt+1)%st][Ht%_]),me.push(St[(Pt+1)%st][(Ht+1)%_]),me.push(St[Pt%st][(Ht+1)%_]),e.Clipper.Orientation(me)||me.reverse(),oe.push(me)}return oe},e.Clipper.MinkowskiSum=function(a,P,A){if(P[0]instanceof Array){for(var j=P,st=new e.Paths,_=new e.Clipper,St=0;St<j.length;++St){var Pt=e.Clipper.Minkowski(a,j[St],!0,A);if(_.AddPaths(Pt,e.PolyType.ptSubject,!0),A){var F=e.Clipper.TranslatePath(j[St],a[0]);_.AddPath(F,e.PolyType.ptClip,!0)}}return _.Execute(e.ClipType.ctUnion,st,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),st}else{var F=P,j=e.Clipper.Minkowski(a,F,!0,A),_=new e.Clipper;return _.AddPaths(j,e.PolyType.ptSubject,!0),_.Execute(e.ClipType.ctUnion,j,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),j}},e.Clipper.TranslatePath=function(a,P){for(var A=new e.Path,F=0;F<a.length;F++)A.push(new e.IntPoint2(a[F].X+P.X,a[F].Y+P.Y));return A},e.Clipper.MinkowskiDiff=function(a,P){var A=e.Clipper.Minkowski(a,P,!1,!0),F=new e.Clipper;return F.AddPaths(A,e.PolyType.ptSubject,!0),F.Execute(e.ClipType.ctUnion,A,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),A},e.Clipper.PolyTreeToPaths=function(a){var P=new Array;return e.Clipper.AddPolyNodeToPaths(a,e.Clipper.NodeType.ntAny,P),P},e.Clipper.AddPolyNodeToPaths=function(a,P,A){var F=!0;switch(P){case e.Clipper.NodeType.ntOpen:return;case e.Clipper.NodeType.ntClosed:F=!a.IsOpen;break}a.m_polygon.length>0&&F&&A.push(a.m_polygon);for(var j=0,_=a.Childs(),st=_.length,St=_[j];j<st;j++,St=_[j])e.Clipper.AddPolyNodeToPaths(St,P,A)},e.Clipper.OpenPathsFromPolyTree=function(a){for(var P=new e.Paths,A=0,F=a.ChildCount();A<F;A++)a.Childs()[A].IsOpen&&P.push(a.Childs()[A].m_polygon);return P},e.Clipper.ClosedPathsFromPolyTree=function(a){var P=new e.Paths;return e.Clipper.AddPolyNodeToPaths(a,e.Clipper.NodeType.ntClosed,P),P},hi(e.Clipper,e.ClipperBase),e.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2},e.ClipperOffset=function(a,P){typeof a>"u"&&(a=2),typeof P>"u"&&(P=e.ClipperOffset.def_arc_tolerance),this.m_destPolys=new e.Paths,this.m_srcPoly=new e.Path,this.m_destPoly=new e.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new e.IntPoint0,this.m_polyNodes=new e.PolyNode,this.MiterLimit=a,this.ArcTolerance=P,this.m_lowest.X=-1},e.ClipperOffset.two_pi=6.28318530717959,e.ClipperOffset.def_arc_tolerance=.25,e.ClipperOffset.prototype.Clear=function(){e.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1},e.ClipperOffset.Round=e.Clipper.Round,e.ClipperOffset.prototype.AddPath=function(a,P,A){var F=a.length-1;if(!(F<0)){var j=new e.PolyNode;if(j.m_jointype=P,j.m_endtype=A,A===e.EndType.etClosedLine||A===e.EndType.etClosedPolygon)for(;F>0&&e.IntPoint.op_Equality(a[0],a[F]);)F--;j.m_polygon.push(a[0]);for(var _=0,st=0,St=1;St<=F;St++)e.IntPoint.op_Inequality(j.m_polygon[_],a[St])&&(_++,j.m_polygon.push(a[St]),(a[St].Y>j.m_polygon[st].Y||a[St].Y===j.m_polygon[st].Y&&a[St].X<j.m_polygon[st].X)&&(st=_));if(!(A===e.EndType.etClosedPolygon&&_<2)&&(this.m_polyNodes.AddChild(j),A===e.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new e.IntPoint2(this.m_polyNodes.ChildCount()-1,st);else{var Pt=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(j.m_polygon[st].Y>Pt.Y||j.m_polygon[st].Y===Pt.Y&&j.m_polygon[st].X<Pt.X)&&(this.m_lowest=new e.IntPoint2(this.m_polyNodes.ChildCount()-1,st))}}},e.ClipperOffset.prototype.AddPaths=function(a,P,A){for(var F=0,j=a.length;F<j;F++)this.AddPath(a[F],P,A)},e.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!e.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var a=0;a<this.m_polyNodes.ChildCount();a++){var P=this.m_polyNodes.Childs()[a];(P.m_endtype===e.EndType.etClosedPolygon||P.m_endtype===e.EndType.etClosedLine&&e.Clipper.Orientation(P.m_polygon))&&P.m_polygon.reverse()}else for(var a=0;a<this.m_polyNodes.ChildCount();a++){var P=this.m_polyNodes.Childs()[a];P.m_endtype===e.EndType.etClosedLine&&!e.Clipper.Orientation(P.m_polygon)&&P.m_polygon.reverse()}},e.ClipperOffset.GetUnitNormal=function(a,P){var A=P.X-a.X,F=P.Y-a.Y;if(A===0&&F===0)return new e.DoublePoint2(0,0);var j=1/Math.sqrt(A*A+F*F);return A*=j,F*=j,new e.DoublePoint2(F,-A)},e.ClipperOffset.prototype.DoOffset=function(a){if(this.m_destPolys=new Array,this.m_delta=a,e.ClipperBase.near_zero(a)){for(var P=0;P<this.m_polyNodes.ChildCount();P++){var A=this.m_polyNodes.Childs()[P];A.m_endtype===e.EndType.etClosedPolygon&&this.m_destPolys.push(A.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var F;this.ArcTolerance<=0?F=e.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(a)*e.ClipperOffset.def_arc_tolerance?F=Math.abs(a)*e.ClipperOffset.def_arc_tolerance:F=this.ArcTolerance;var j=3.14159265358979/Math.acos(1-F/Math.abs(a));this.m_sin=Math.sin(e.ClipperOffset.two_pi/j),this.m_cos=Math.cos(e.ClipperOffset.two_pi/j),this.m_StepsPerRad=j/e.ClipperOffset.two_pi,a<0&&(this.m_sin=-this.m_sin);for(var P=0;P<this.m_polyNodes.ChildCount();P++){var A=this.m_polyNodes.Childs()[P];this.m_srcPoly=A.m_polygon;var _=this.m_srcPoly.length;if(!(_===0||a<=0&&(_<3||A.m_endtype!==e.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,_===1){if(A.m_jointype===e.JoinType.jtRound)for(var st=1,St=0,Pt=1;Pt<=j;Pt++){this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X+st*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y+St*a)));var Bt=st;st=st*this.m_cos-this.m_sin*St,St=Bt*this.m_sin+St*this.m_cos}else for(var st=-1,St=-1,Pt=0;Pt<4;++Pt)this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X+st*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y+St*a))),st<0?st=1:St<0?St=1:st=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var Pt=0;Pt<_-1;Pt++)this.m_normals.push(e.ClipperOffset.GetUnitNormal(this.m_srcPoly[Pt],this.m_srcPoly[Pt+1]));if(A.m_endtype===e.EndType.etClosedLine||A.m_endtype===e.EndType.etClosedPolygon?this.m_normals.push(e.ClipperOffset.GetUnitNormal(this.m_srcPoly[_-1],this.m_srcPoly[0])):this.m_normals.push(new e.DoublePoint1(this.m_normals[_-2])),A.m_endtype===e.EndType.etClosedPolygon){for(var Ht=_-1,Pt=0;Pt<_;Pt++)Ht=this.OffsetPoint(Pt,Ht,A.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(A.m_endtype===e.EndType.etClosedLine){for(var Ht=_-1,Pt=0;Pt<_;Pt++)Ht=this.OffsetPoint(Pt,Ht,A.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var jt=this.m_normals[_-1],Pt=_-1;Pt>0;Pt--)this.m_normals[Pt]=new e.DoublePoint2(-this.m_normals[Pt-1].X,-this.m_normals[Pt-1].Y);this.m_normals[0]=new e.DoublePoint2(-jt.X,-jt.Y),Ht=0;for(var Pt=_-1;Pt>=0;Pt--)Ht=this.OffsetPoint(Pt,Ht,A.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var Ht=0,Pt=1;Pt<_-1;++Pt)Ht=this.OffsetPoint(Pt,Ht,A.m_jointype);var qt;if(A.m_endtype===e.EndType.etOpenButt){var Pt=_-1;qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[Pt].X+this.m_normals[Pt].X*a),e.ClipperOffset.Round(this.m_srcPoly[Pt].Y+this.m_normals[Pt].Y*a)),this.m_destPoly.push(qt),qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[Pt].X-this.m_normals[Pt].X*a),e.ClipperOffset.Round(this.m_srcPoly[Pt].Y-this.m_normals[Pt].Y*a)),this.m_destPoly.push(qt)}else{var Pt=_-1;Ht=_-2,this.m_sinA=0,this.m_normals[Pt]=new e.DoublePoint2(-this.m_normals[Pt].X,-this.m_normals[Pt].Y),A.m_endtype===e.EndType.etOpenSquare?this.DoSquare(Pt,Ht):this.DoRound(Pt,Ht)}for(var Pt=_-1;Pt>0;Pt--)this.m_normals[Pt]=new e.DoublePoint2(-this.m_normals[Pt-1].X,-this.m_normals[Pt-1].Y);this.m_normals[0]=new e.DoublePoint2(-this.m_normals[1].X,-this.m_normals[1].Y),Ht=_-1;for(var Pt=Ht-1;Pt>0;--Pt)Ht=this.OffsetPoint(Pt,Ht,A.m_jointype);A.m_endtype===e.EndType.etOpenButt?(qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*a)),this.m_destPoly.push(qt),qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*a)),this.m_destPoly.push(qt)):(Ht=1,this.m_sinA=0,A.m_endtype===e.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}},e.ClipperOffset.prototype.Execute=function(){var a=arguments,P=a[0]instanceof e.PolyTree;if(P){var A=a[0],F=a[1];A.Clear(),this.FixOrientations(),this.DoOffset(F);var j=new e.Clipper(0);if(j.AddPaths(this.m_destPolys,e.PolyType.ptSubject,!0),F>0)j.Execute(e.ClipType.ctUnion,A,e.PolyFillType.pftPositive,e.PolyFillType.pftPositive);else{var _=e.Clipper.GetBounds(this.m_destPolys),st=new e.Path;if(st.push(new e.IntPoint2(_.left-10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.top-10)),st.push(new e.IntPoint2(_.left-10,_.top-10)),j.AddPath(st,e.PolyType.ptSubject,!0),j.ReverseSolution=!0,j.Execute(e.ClipType.ctUnion,A,e.PolyFillType.pftNegative,e.PolyFillType.pftNegative),A.ChildCount()===1&&A.Childs()[0].ChildCount()>0){var St=A.Childs()[0];A.Childs()[0]=St.Childs()[0],A.Childs()[0].m_Parent=A;for(var Pt=1;Pt<St.ChildCount();Pt++)A.AddChild(St.Childs()[Pt])}else A.Clear()}}else{var A=a[0],F=a[1];e.Clear(A),this.FixOrientations(),this.DoOffset(F);var j=new e.Clipper(0);if(j.AddPaths(this.m_destPolys,e.PolyType.ptSubject,!0),F>0)j.Execute(e.ClipType.ctUnion,A,e.PolyFillType.pftPositive,e.PolyFillType.pftPositive);else{var _=e.Clipper.GetBounds(this.m_destPolys),st=new e.Path;st.push(new e.IntPoint2(_.left-10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.top-10)),st.push(new e.IntPoint2(_.left-10,_.top-10)),j.AddPath(st,e.PolyType.ptSubject,!0),j.ReverseSolution=!0,j.Execute(e.ClipType.ctUnion,A,e.PolyFillType.pftNegative,e.PolyFillType.pftNegative),A.length>0&&A.splice(0,1)}}},e.ClipperOffset.prototype.OffsetPoint=function(a,P,A){if(this.m_sinA=this.m_normals[P].X*this.m_normals[a].Y-this.m_normals[a].X*this.m_normals[P].Y,Math.abs(this.m_sinA*this.m_delta)<1){var F=this.m_normals[P].X*this.m_normals[a].X+this.m_normals[a].Y*this.m_normals[P].Y;if(F>0)return this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[P].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[P].Y*this.m_delta))),P}else this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1);if(this.m_sinA*this.m_delta<0)this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[P].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[P].Y*this.m_delta))),this.m_destPoly.push(new e.IntPoint1(this.m_srcPoly[a])),this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[a].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[a].Y*this.m_delta)));else switch(A){case e.JoinType.jtMiter:{var j=1+(this.m_normals[a].X*this.m_normals[P].X+this.m_normals[a].Y*this.m_normals[P].Y);j>=this.m_miterLim?this.DoMiter(a,P,j):this.DoSquare(a,P);break}case e.JoinType.jtSquare:this.DoSquare(a,P);break;case e.JoinType.jtRound:this.DoRound(a,P);break}return P=a,P},e.ClipperOffset.prototype.DoSquare=function(a,P){var A=Math.tan(Math.atan2(this.m_sinA,this.m_normals[P].X*this.m_normals[a].X+this.m_normals[P].Y*this.m_normals[a].Y)/4);this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_delta*(this.m_normals[P].X-this.m_normals[P].Y*A)),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_delta*(this.m_normals[P].Y+this.m_normals[P].X*A)))),this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_delta*(this.m_normals[a].X+this.m_normals[a].Y*A)),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_delta*(this.m_normals[a].Y-this.m_normals[a].X*A))))},e.ClipperOffset.prototype.DoMiter=function(a,P,A){var F=this.m_delta/A;this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+(this.m_normals[P].X+this.m_normals[a].X)*F),e.ClipperOffset.Round(this.m_srcPoly[a].Y+(this.m_normals[P].Y+this.m_normals[a].Y)*F)))},e.ClipperOffset.prototype.DoRound=function(a,P){for(var A=Math.atan2(this.m_sinA,this.m_normals[P].X*this.m_normals[a].X+this.m_normals[P].Y*this.m_normals[a].Y),F=Math.max(e.Cast_Int32(e.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(A))),1),j=this.m_normals[P].X,_=this.m_normals[P].Y,st,St=0;St<F;++St)this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+j*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+_*this.m_delta))),st=j,j=j*this.m_cos-this.m_sin*_,_=st*this.m_sin+_*this.m_cos;this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[a].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[a].Y*this.m_delta)))},e.Error=function(a){try{throw new Error(a)}catch(P){alert(P.message)}},e.JS={},e.JS.AreaOfPolygon=function(a,P){return P||(P=1),e.Clipper.Area(a)/(P*P)},e.JS.AreaOfPolygons=function(a,P){P||(P=1);for(var A=0,F=0;F<a.length;F++)A+=e.Clipper.Area(a[F]);return A/(P*P)},e.JS.BoundsOfPath=function(a,P){return e.JS.BoundsOfPaths([a],P)},e.JS.BoundsOfPaths=function(a,P){P||(P=1);var A=e.Clipper.GetBounds(a);return A.left/=P,A.bottom/=P,A.right/=P,A.top/=P,A},e.JS.Clean=function(F,P){if(!(F instanceof Array))return[];var A=F[0]instanceof Array,F=e.JS.Clone(F);if(typeof P!="number"||P===null)return e.Error("Delta is not a number in Clean()."),F;if(F.length===0||F.length===1&&F[0].length===0||P<0)return F;A||(F=[F]);for(var j=F.length,_,st,St,Pt,Bt,Ht,jt,qt=[],oe=0;oe<j;oe++)if(st=F[oe],_=st.length,_!==0){if(_<3){St=st,qt.push(St);continue}for(St=st,Pt=P*P,Bt=st[0],Ht=1,jt=1;jt<_;jt++)(st[jt].X-Bt.X)*(st[jt].X-Bt.X)+(st[jt].Y-Bt.Y)*(st[jt].Y-Bt.Y)<=Pt||(St[Ht]=st[jt],Bt=st[jt],Ht++);Bt=st[Ht-1],(st[0].X-Bt.X)*(st[0].X-Bt.X)+(st[0].Y-Bt.Y)*(st[0].Y-Bt.Y)<=Pt&&Ht--,Ht<_&&St.splice(Ht,_-Ht),St.length&&qt.push(St)}return!A&&qt.length?qt=qt[0]:!A&&qt.length===0?qt=[]:A&&qt.length===0&&(qt=[[]]),qt},e.JS.Clone=function(a){if(!(a instanceof Array))return[];if(a.length===0)return[];if(a.length===1&&a[0].length===0)return[[]];var P=a[0]instanceof Array;P||(a=[a]);var A=a.length,F,j,_,st,St=new Array(A);for(j=0;j<A;j++){for(F=a[j].length,st=new Array(F),_=0;_<F;_++)st[_]={X:a[j][_].X,Y:a[j][_].Y};St[j]=st}return P||(St=St[0]),St},e.JS.Lighten=function(a,P){if(!(a instanceof Array))return[];if(typeof P!="number"||P===null)return e.Error("Tolerance is not a number in Lighten()."),e.JS.Clone(a);if(a.length===0||a.length===1&&a[0].length===0||P<0)return e.JS.Clone(a);var A=a[0]instanceof Array;A||(a=[a]);var F,j,_,st,St,Pt,Bt,Ht,jt,qt,oe,me,Se,De,lr,br,on,Ma=a.length,La=P*P,Tn=[];for(F=0;F<Ma;F++)if(_=a[F],Pt=_.length,Pt!==0){for(st=0;st<1e6;st++){for(St=[],Pt=_.length,_[Pt-1].X!==_[0].X||_[Pt-1].Y!==_[0].Y?(me=1,_.push({X:_[0].X,Y:_[0].Y}),Pt=_.length):me=0,oe=[],j=0;j<Pt-2;j++)Bt=_[j],jt=_[j+1],Ht=_[j+2],br=Bt.X,on=Bt.Y,Se=Ht.X-br,De=Ht.Y-on,(Se!==0||De!==0)&&(lr=((jt.X-br)*Se+(jt.Y-on)*De)/(Se*Se+De*De),lr>1?(br=Ht.X,on=Ht.Y):lr>0&&(br+=Se*lr,on+=De*lr)),Se=jt.X-br,De=jt.Y-on,qt=Se*Se+De*De,qt<=La&&(oe[j+1]=1,j++);for(St.push({X:_[0].X,Y:_[0].Y}),j=1;j<Pt-1;j++)oe[j]||St.push({X:_[j].X,Y:_[j].Y});if(St.push({X:_[Pt-1].X,Y:_[Pt-1].Y}),me&&_.pop(),oe.length)_=St;else break}Pt=St.length,St[Pt-1].X===St[0].X&&St[Pt-1].Y===St[0].Y&&St.pop(),St.length>2&&Tn.push(St)}return A||(Tn=Tn[0]),typeof Tn>"u"&&(Tn=[]),Tn},e.JS.PerimeterOfPath=function(a,P,A){if(typeof a>"u")return 0;var F=Math.sqrt,j=0,_,st,St=0,Pt=0,Bt=0,Ht=0,jt=a.length;if(jt<2)return 0;for(P&&(a[jt]=a[0],jt++);--jt;)_=a[jt],St=_.X,Pt=_.Y,st=a[jt-1],Bt=st.X,Ht=st.Y,j+=F((St-Bt)*(St-Bt)+(Pt-Ht)*(Pt-Ht));return P&&a.pop(),j/A},e.JS.PerimeterOfPaths=function(a,P,A){A||(A=1);for(var F=0,j=0;j<a.length;j++)F+=e.JS.PerimeterOfPath(a[j],P,A);return F},e.JS.ScaleDownPath=function(a,P){var A,F;for(P||(P=1),A=a.length;A--;)F=a[A],F.X=F.X/P,F.Y=F.Y/P},e.JS.ScaleDownPaths=function(a,P){var A,F,j;for(P||(P=1),A=a.length;A--;)for(F=a[A].length;F--;)j=a[A][F],j.X=j.X/P,j.Y=j.Y/P},e.JS.ScaleUpPath=function(a,P){var A,F,j=Math.round;for(P||(P=1),A=a.length;A--;)F=a[A],F.X=j(F.X*P),F.Y=j(F.Y*P)},e.JS.ScaleUpPaths=function(a,P){var A,F,j,_=Math.round;for(P||(P=1),A=a.length;A--;)for(F=a[A].length;F--;)j=a[A][F],j.X=_(j.X*P),j.Y=_(j.Y*P)},e.ExPolygons=function(){return[]},e.ExPolygon=function(){this.outer=null,this.holes=null},e.JS.AddOuterPolyNodeToExPolygons=function(a,P){var A=new e.ExPolygon;A.outer=a.Contour();var F=a.Childs(),j=F.length;A.holes=new Array(j);var _,st,St,Pt,Bt,Ht;for(St=0;St<j;St++)for(_=F[St],A.holes[St]=_.Contour(),Pt=0,Bt=_.Childs(),Ht=Bt.length;Pt<Ht;Pt++)st=Bt[Pt],e.JS.AddOuterPolyNodeToExPolygons(st,P);P.push(A)},e.JS.ExPolygonsToPaths=function(a){var P,A,F,j,_=new e.Paths;for(P=0,F=a.length;P<F;P++)for(_.push(a[P].outer),A=0,j=a[P].holes.length;A<j;A++)_.push(a[P].holes[A]);return _},e.JS.PolyTreeToExPolygons=function(a){var P=new e.ExPolygons,A,F,j,_;for(F=0,j=a.Childs(),_=j.length;F<_;F++)A=j[F],e.JS.AddOuterPolyNodeToExPolygons(A,P);return P}})()})($f);var JS=$f.exports,Kr=mn(JS);function jf(i,e,t=.01){return Math.abs(i[0]-e[0])<t&&Math.abs(i[1]-e[1])<t}function QS(i,e=.01){if(i.length===0)return[];const t=[[i[0][0],i[0][1]]];for(let r=1;r<i.length;r++)jf([i[r][0],i[r][1]],t[t.length-1],e)||t.push([i[r][0],i[r][1]]);return t}function qS(i,e=.01){if(i.length<=2)return i;const t=i[0],r=i[i.length-1];return jf(t,r,e)?i.slice(0,-1):i}function _S(i){const e=i.reduce((r,n)=>r+n[0],0)/i.length,t=i.reduce((r,n)=>r+n[1],0)/i.length;return[e,t]}function Gf(i,e){return Math.atan2(e[1]-i[1],e[0]-i[0])}function tP(i,e=.01){if(i.length<=2)return i;const t=[];for(const n of i)t.some(c=>Math.abs(c[0]-n[0])<e&&Math.abs(c[1]-n[1])<e)||t.push([n[0],n[1]]);const r=_S(t);return t.sort((n,s)=>{const c=Gf(r,n),l=Gf(r,s);return c-l})}function eP(i,e){const t=e[0].x<e[e.length-1].x;return i.map(n=>{const c=n.map(l=>{let f=-1,h=1/0,v=0;for(let u=0;u<e.length;u++){const y=e[u],T=Math.sqrt(Math.pow(y.x-l[0],2)+Math.pow(y.y-l[1],2));T<h&&(h=T,f=u,v=y.z)}return{point:l,index:f,bestZ:v}}).sort((l,f)=>l.index-f.index).map(l=>[...l.point,l.bestZ]);return t&&c[0][0]>c[c.length-1][0]||!t&&c[0][0]<c[c.length-1][0]?c.reverse():c}).sort((n,s)=>{const c=n[0][0],l=s[0][0];return t?c-l:l-c})}function rP(i,e,t=.01){const n=i.map(u=>[u.x,u.y]),s=(u,y)=>u.map(([T,w])=>({X:Math.round(T*y),Y:Math.round(w*y)})),c=new Kr.ClipperOffset;c.AddPath(s(n,1e3),Kr.JoinType.jtRound,Kr.EndType.etOpenButt);const l=[];c.Execute(l,1);const f=new Kr.Clipper;f.AddPaths(l,Kr.PolyType.ptSubject,!0),e.forEach(u=>{f.AddPath(s(u,1e3),Kr.PolyType.ptClip,!0)});const h=new Kr.Paths;f.Execute(Kr.ClipType.ctDifference,h,Kr.PolyFillType.pftNonZero,Kr.PolyFillType.pftNonZero);const v=h.map(u=>qS(tP(QS(u.map(y=>[y.X/1e3,y.Y/1e3]),t),t),t)).filter(u=>u.length>=2);return eP(v,i)}class kf extends Yt{constructor(t){super(t);dt(this,"canRotate",!0);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.Pencil);dt(this,"syncTimestamp");dt(this,"syncIndex",0);dt(this,"tmpPoints",[]);dt(this,"MAX_REPEAR",10);dt(this,"uniThickness");dt(this,"workOptions");dt(this,"centerPos",[0,0]);this.workOptions=t.toolsOpt,this.uniThickness=this.MAX_REPEAR/this.workOptions.thickness/10,this.syncTimestamp=0}combineConsume(){var l;const t=(l=this.workId)==null?void 0:l.toString();if(this.tmpPoints.length<2)return{type:vt.None};const r=this.transformDataAll(!0),n={name:t};let s;const c=this.drawLayer||this.fullLayer;return r.length&&(s=this.draw({attrs:n,tasks:r,replaceId:t,layer:c})),{rect:s,type:vt.DrawWork,dataType:Kt.Local}}setWorkOptions(t){super.setWorkOptions(t),this.syncTimestamp=Date.now()}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,drawCount:l,removeDrawCount:f,isSimpleWorker:h}=t,{workId:v,syncUnitTime:u}=r;u&&(this.syncUnitTime=u);const{tasks:y,effects:T,consumeIndex:w}=this.transformData(r,!1);this.syncIndex=Math.min(this.syncIndex,w,Math.max(0,this.tmpPoints.length-2));const I={name:v,id:Qe(l)&&l.toString()||void 0};let S,O=!1;const d=this.syncIndex;if(this.syncTimestamp===0&&(this.syncTimestamp=Date.now()),y.length&&(y[0].taskId-this.syncTimestamp>this.syncUnitTime&&(O=!0,this.syncTimestamp=y[0].taskId,this.syncIndex=this.tmpPoints.length),s||c||h)){const p=n?this.fullLayer:this.drawLayer||this.fullLayer;S=this.draw({attrs:I,tasks:y,effects:T,layer:p,removeDrawCount:f})}if(h){const p=[];return this.tmpPoints.slice(d).forEach(x=>{p.push(x.x,x.y,this.computRadius(x.z,this.workOptions.thickness))}),{...this.baseConsumeResult,type:vt.DrawWork,dataType:Kt.Local,op:O?p:void 0,index:O?d*3:void 0,rect:S,updateNodeOpt:{useAnimation:!0}}}if(s)return w>10&&this.tmpPoints.splice(0,w-10),{rect:S,type:vt.DrawWork,dataType:Kt.Local};const g=[];return this.tmpPoints.slice(d).forEach(p=>{g.push(p.x,p.y,this.computRadius(p.z,this.workOptions.thickness))}),{...this.baseConsumeResult,type:vt.DrawWork,dataType:Kt.Local,rect:S,op:O?g:void 0,index:O?d*3:void 0,updateNodeOpt:{useAnimation:!0}}}consumeAll(t){var v;const r=this.workId;if(t.data){const{op:u,workState:y}=t.data;u!=null&&u.length&&y===te.Done&&this.workOptions.strokeType===Ee.Stroke&&this.updateTempPointsWithPressureWhenDone(u)}const n=this.transformDataAll(!0),s={name:r};let c;const l=this.fullLayer;if(n.length&&(c=this.draw({attrs:s,tasks:n,replaceId:r,layer:l})),this.tmpPoints.length<2)return this.replace(l,r),{type:vt.RemoveNode,removeIds:[r],rect:c};const f=[];this.tmpPoints.map(u=>{f.push(u.x,u.y,u.z)}),this.syncTimestamp=0,delete this.workOptions.syncUnitTime;const h=hr(f);return(v=this.vNodes)==null||v.setInfo(r,{rect:c,op:f,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:c&&Yt.getCenterPos(c,l)}),{...this.baseConsumeResult,rect:c,type:vt.FullWork,dataType:Kt.Local,ops:h,updateNodeOpt:{pos:this.centerPos,useAnimation:!0}}}clearTmpPoints(){this.tmpPoints.length=0,this.syncTimestamp=0,this.syncIndex=0}consumeService(t){var u,y;const{op:r,isFullWork:n,replaceId:s,workState:c=te.Done}=t;this.tmpPoints.length=0;for(let T=0;T<r.length;T+=3){const w=new Jt(r[T],r[T+1],r[T+2]);if(this.tmpPoints.length>0){const I=this.tmpPoints[this.tmpPoints.length-1],S=pt.Sub(w,I).uni();w.setv(S)}this.tmpPoints.push(w)}if(this.tmpPoints.length<2)return;const l=this.transformDataAll(!0),f=(u=this.workId)==null?void 0:u.toString(),h={name:f};let v;if(f&&l.length){const T=n?this.fullLayer:this.drawLayer||this.fullLayer;v=this.draw({attrs:h,tasks:l,replaceId:s,layer:T,isDrawEraserlines:c===te.Done}),(y=this.vNodes)==null||y.setInfo(f,{rect:v,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:v&&Yt.getCenterPos(v,T)})}return v}computPencilPoints(t){const r=[],{op:n,eraserPolylines:s,eraserThickness:c}=t;this.tmpPoints.length=0;for(let f=0;f<n.length;f+=3){const h=new Jt(n[f],n[f+1],n[f+2]);if(this.tmpPoints.length>0){const v=this.tmpPoints[this.tmpPoints.length-1],u=pt.Sub(h,v).uni();h.setv(u)}this.tmpPoints.push(h)}if(this.tmpPoints.length<2)return;const l=this.transformDataAll(!0);if(l.length)for(let f=0;f<l.length;f++){const{pos:h,points:v}=l[f],u=v.map(w=>w.point.addXY(h[0],h[1])),y=[];for(const w of s){const I=[];for(let O=0;O<w.length;O+=2){const d=new Jt(w[O],w[O+1]);if(I.length>0){const g=I[I.length-1].point,p=pt.Sub(d,g).uni();d.setv(p)}I.push({point:d,radius:c})}const{ps:S}=this.computStroke(I,!1);y.push(S.map(O=>O.XY))}rP(u,y,.01).forEach(w=>{r.push(w.map(I=>[I[0],I[1],I[2]]).flat(1))})}return r}transformDataAll(t=!0){return this.getTaskPoints(this.tmpPoints,t&&this.workOptions.thickness||void 0)}draw(t){const{attrs:r,tasks:n,replaceId:s,effects:c,layer:l,removeDrawCount:f,isDrawEraserlines:h=!0}=t,{strokeColor:v,strokeType:u,thickness:y,zIndex:T,scale:w,rotate:I,translate:S,eraserlines:O,lineCap:d,lineDash:g}=this.workOptions;c!=null&&c.size&&(c.forEach(U=>{var M;(M=l.getElementById(U+""))==null||M.remove()}),c.clear()),f&&this.removeDrawCountNodes(l,f);let p;const x=[],E=l.worldPosition,R=l.worldScaling;for(let U=0;U<n.length;U++){const{pos:M,points:W}=n[U],{ps:X,rect:B}=this.computDrawPoints(W);let N;const $=W.length===1;u===Ee.Stroke||$?N=yn(X,!0):N=yn(X,!1);const J={pos:M,d:N,fillColor:u===Ee.Stroke||$?v:void 0,lineDash:$?void 0:u===Ee.Dotted?[g&&g[0]||1,(g&&g[1]||2)*y]:u===Ee.LongDotted?[(g&&g[0]||1)*y,(g&&g[1]||2)*y]:void 0,strokeColor:v,lineCap:$?void 0:d,lineWidth:u===Ee.Stroke||$?0:y};p=Zt(p,{x:Math.floor((B.x+M[0])*R[0]+E[0]-Yt.SafeBorderPadding),y:Math.floor((B.y+M[1])*R[1]+E[1]-Yt.SafeBorderPadding),w:Math.floor(B.w*R[0]+2*Yt.SafeBorderPadding),h:Math.floor(B.h*R[1]+2*Yt.SafeBorderPadding)}),x.push(J)}w&&(r.scale=w),I&&(r.rotate=I),S&&(r.translate=S);const D=new Je;if(p){this.centerPos=Yt.getCenterPos(p,l);const U=u===Ee.Stroke&&!O;D.attr({...r,normalize:!0,anchor:[.5,.5],bgcolor:U?v:void 0,pos:this.centerPos,size:[(p.w-2*Yt.SafeBorderPadding)/R[0],(p.h-2*Yt.SafeBorderPadding)/R[1]],zIndex:T});const M=x.map(W=>(W.pos=[W.pos[0]-this.centerPos[0],W.pos[1]-this.centerPos[1]],new gn(W)));D.append(...M),U&&D.seal(),O&&(this.scaleType=Te.proportional,this.drawEraserlines({group:D,eraserlines:O,pos:this.centerPos,layer:l},h)),this.replace(l,s,D)}if(w||I||S){const U=D==null?void 0:D.getBoundingClientRect();U&&(p={x:Math.floor(U.x-Yt.SafeBorderPadding),y:Math.floor(U.y-Yt.SafeBorderPadding),w:Math.floor(U.width+Yt.SafeBorderPadding*2),h:Math.floor(U.height+Yt.SafeBorderPadding*2)})}return this.isDelete&&D.setAttribute("opacity",0),p}computDrawPoints(t){return this.workOptions.strokeType===Ee.Stroke||t.length===1?this.computStroke(t):this.computNomal(t)}computNomal(t){let r=this.workOptions.thickness;const n=t.map(s=>(r=Math.max(r,s.radius),s.point));return{ps:n,rect:Re(n,r)}}computStroke(t,r=!0){return t.length===1?this.computDotStroke(t[0]):this.computLineStroke(t,r)}computLineStroke(t,r=!0){const n=[],s=[];for(let f=0;f<t.length;f++){const{point:h,radius:v}=t[f];let u=h.v;f===0&&t.length>1&&(u=t[f+1].point.v);const y=pt.Per(u).mul(v);n.push(Jt.Sub(h,y)),s.push(Jt.Add(h,y))}const c=t[t.length-1];if(r){const f=Jt.GetSemicircleStroke(c.point,n[n.length-1],-1,8),h=Jt.GetSemicircleStroke(t[0].point,s[0],-1,8),v=n.concat(f,s.reverse(),h);return{ps:v,rect:Re(v)}}const l=n.concat(s.reverse());return{ps:l,rect:Re(l)}}computDotStroke(t){const{point:r,radius:n}=t,s={x:r.x-n,y:r.y-n,w:n*2,h:n*2};return{ps:Jt.GetDotStroke(r,n,8),rect:s}}transformData(t,r){const{op:n,workState:s}=t;let c=this.tmpPoints.length-1,l=[];if(n!=null&&n.length&&s){const{strokeType:f,thickness:h}=this.workOptions,v=new Set;c=f===Ee.Stroke?this.updateTempPointsWithPressure(n,h,v):this.updateTempPoints(n,h,v);const u=r?this.tmpPoints:this.tmpPoints.slice(c);return l=this.getTaskPoints(u,h),{tasks:l,effects:v,consumeIndex:c}}return{tasks:l,consumeIndex:c}}computRadius(t,r){return t*.03*r+r*.5}getMinZ(t,r){return((r||Math.max(1,Math.floor(t*.3)))-t*.5)*100/t/3}getTaskPoints(t,r){var u;const n=[];if(t.length===0)return[];let s=0,c=t[0].x,l=t[0].y,f=[c,l],h=[],v=t[0].t;for(;s<t.length;){const y=t[s],T=y.x-c,w=y.y-l,I=y.z,S=r?this.computRadius(I,r):I;if(h.push({point:new Jt(T,w,I,t[s].v),radius:S}),s>0&&s<t.length-1){const O=t[s].getAngleByPoints(t[s-1],t[s+1]);if(O<60||O>300){const d=(u=h.pop())==null?void 0:u.point.clone();d&&n.push({taskId:v,pos:f,points:[...h,{point:d,radius:S}]}),c=t[s].x,l=t[s].y,f=[c,l];const g=y.x-c,p=y.y-l;h=[{point:new Jt(g,p,I),radius:S}],v=Date.now()}}s++}return n.push({taskId:v,pos:f,points:h}),n}updateTempPointsWithPressure(t,r,n){const s=Date.now(),c=this.tmpPoints.length;let l=c;for(let h=0;h<t.length;h+=2){l=Math.min(l,c);const v=this.tmpPoints.length,u=new Jt(t[h],t[h+1]);if(v===0){this.tmpPoints.push(u);continue}const y=v-1,T=this.tmpPoints[y],w=pt.Sub(u,T).uni();if(u.isNear(T,r)){if(T.z<this.MAX_REPEAR){if(T.setz(Math.min(T.z+1,this.MAX_REPEAR)),l=Math.min(l,y),v>1){let O=v-1;for(;O>0;){const d=this.tmpPoints[O].distance(this.tmpPoints[O-1]),g=Math.max(this.tmpPoints[O].z-this.uniThickness*d,0);if(this.tmpPoints[O-1].z>=g)break;this.tmpPoints[O-1].setz(g),l=Math.min(l,O-1),O--}}}else l=1/0;continue}u.setv(w);const I=u.distance(T),S=Math.max(T.z-this.uniThickness*I,0);v>1&&pt.Equals(w,T.v,.02)&&(S>0||T.z<=0)&&(n&&T.t&&n.add(T.t),this.tmpPoints.pop(),l=Math.min(y,l)),u.setz(S),this.tmpPoints.push(u)}if(l===1/0)return this.tmpPoints.length;let f=c;if(l===c){f=Math.max(f-1,0);const h=this.tmpPoints[f].t;h&&(n==null||n.add(h))}else{let h=c-1;for(f=l;h>=0;){const v=this.tmpPoints[h].t;if(v&&(n==null||n.add(v),h<=l)){f=h,h=-1;break}h--}}return this.tmpPoints[f].setT(s),f}updateTempPoints(t,r,n){var h;const s=Date.now(),c=this.tmpPoints.length;let l=c;for(let v=0;v<t.length;v+=2){const u=this.tmpPoints.length,y=new Jt(t[v],t[v+1]);if(u===0){this.tmpPoints.push(y);continue}const T=u-1,w=this.tmpPoints[T],I=pt.Sub(y,w).uni();if(y.isNear(w,r/2)){l=Math.min(T,l);continue}pt.Equals(I,w.v,.02)&&(n&&w.t&&n.add(w.t),this.tmpPoints.pop(),l=Math.min(T,l)),y.setv(I),this.tmpPoints.push(y)}let f=c;if(l===c){f=Math.max(f-1,0);const v=this.tmpPoints[f].t;v&&(n==null||n.add(v))}else{let v=Math.min(c-1,l);for(f=l;v>=0;){const u=(h=this.tmpPoints[v])==null?void 0:h.t;if(u&&(n==null||n.add(u),v<=l)){f=v,v=-1;break}v--}}return this.tmpPoints[f].setT(s),f}updateTempPointsWithPressureWhenDone(t){const{thickness:r}=this.workOptions,n=t.length,s=this.getMinZ(r);for(let c=0;c<n;c+=2){const l=this.tmpPoints.length,f=new Jt(t[c],t[c+1]);if(l===0){this.tmpPoints.push(f);continue}const h=l-1,v=this.tmpPoints[h],u=pt.Sub(f,v).uni(),y=f.distance(v);if(l>1&&v.z===s)break;if(f.isNear(v,r/2)){if(n<3&&v.z<this.MAX_REPEAR&&(v.setz(Math.min(v.z+1,this.MAX_REPEAR)),l>1)){let w=l-1;for(;w>0;){const I=this.tmpPoints[w].distance(this.tmpPoints[w-1]),S=Math.max(this.tmpPoints[w].z-this.uniThickness*I,-r/4);if(this.tmpPoints[w-1].z>=S)break;this.tmpPoints[w-1].setz(S),w--}}continue}f.setv(u);const T=Math.max(v.z-this.uniThickness*y,s);l>1&&pt.Equals(u,v.v,.02)&&v.z<=0&&this.tmpPoints.pop(),f.setz(T),this.tmpPoints.push(f)}}static updateNodeOpt(t){var u,y;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,strokeType:l,lineCap:f,lineDash:h}=n,v=s.get(r.name);return c&&(r.tagName==="GROUP"?hT(r)?r.setAttribute("bgcolor",c):r.children.forEach(T=>{T.setAttribute("strokeColor",c),T.getAttribute("fillColor")&&T.setAttribute("fillColor",c)}):(r.setAttribute("strokeColor",c),r.setAttribute("fillColor",c)),(u=v==null?void 0:v.opt)!=null&&u.strokeColor&&(v.opt.strokeColor=c)),l&&(v!=null&&v.opt)&&((y=v.opt)!=null&&y.strokeType)&&(v.opt.strokeType=l),f&&(v!=null&&v.opt)&&(v.opt.lineCap=f),h&&(v!=null&&v.opt)&&(v.opt.lineDash=h),v&&s.setInfo(r.name,v),Yt.updateNodeOpt(t)}}class Hf extends Yt{constructor(t){super(t);dt(this,"toolsType",xt.LaserPen);dt(this,"canRotate",!1);dt(this,"scaleType",Te.none);dt(this,"syncTimestamp");dt(this,"syncIndex",0);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"consumeIndex",0);this.workOptions=t.toolsOpt,this.syncTimestamp=0}combineConsume(){}setWorkOptions(t){super.setWorkOptions(t),this.syncTimestamp=Date.now()}consume(t){const{data:r,isSubWorker:n}=t,{workId:s,op:c,syncUnitTime:l}=r;if((c==null?void 0:c.length)===0)return{type:vt.None};if(l&&(this.syncUnitTime=l),this.updateTempPoints(c||[]),this.consumeIndex>this.tmpPoints.length-4)return{type:vt.None};const{strokeColor:f,thickness:h,strokeType:v,lineDash:u,lineCap:y}=this.workOptions,T=Re(this.tmpPoints,h);let w=!1;const I=this.syncIndex,S=this.tmpPoints.slice(this.consumeIndex);this.consumeIndex=this.tmpPoints.length-1,this.syncTimestamp===0&&(this.syncTimestamp=Date.now());const O={name:s==null?void 0:s.toString(),opacity:1,lineDash:v===Ee.Dotted?[u&&u[0]||1,(u&&u[1]||2)*h]:v===Ee.LongDotted?[(u&&u[0]||1)*h,(u&&u[1]||2)*h]:void 0,strokeColor:f,lineCap:y,lineWidth:h,anchor:[.5,.5]},d=this.getTaskPoints(S);if(d.length){const p=Date.now();p-this.syncTimestamp>this.syncUnitTime&&(w=!0,this.syncTimestamp=p,this.syncIndex=this.tmpPoints.length),n&&this.draw({attrs:O,tasks:d,isDot:!1,layer:this.drawLayer||this.fullLayer})}const g=[];return this.tmpPoints.slice(I).forEach(p=>{g.push(p.x,p.y)}),{rect:{x:T.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:T.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:T.w*this.fullLayer.worldScaling[0],h:T.h*this.fullLayer.worldScaling[1]},type:vt.DrawWork,dataType:Kt.Local,op:w?g:void 0,index:w?I*2:void 0,...this.baseConsumeResult}}consumeAll(){var c;const t=(c=this.workId)==null?void 0:c.toString();let r;if(this.tmpPoints.length-1>this.consumeIndex){let l=this.tmpPoints.slice(this.consumeIndex);const f=l.length===1,{strokeColor:h,thickness:v,strokeType:u}=this.workOptions;if(f){const w=this.computDotStroke({point:l[0],radius:v/2});l=w.ps,r=w.rect}else r=Re(this.tmpPoints,v);const y={name:t==null?void 0:t.toString(),fillColor:f?h:void 0,opacity:1,lineDash:u===Ee.Dotted&&!f?[1,v*2]:u===Ee.LongDotted&&!f?[v,v*2]:void 0,strokeColor:h,lineCap:f?void 0:"round",lineWidth:f?0:v,anchor:[.5,.5]},T=this.getTaskPoints(l);T.length&&this.draw({attrs:y,tasks:T,isDot:f,layer:this.drawLayer||this.fullLayer})}const n=[];this.tmpPoints.forEach(l=>{n.push(l.x,l.y)});const s=hr(n);return{rect:r&&{x:r.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:r.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:r.w*this.fullLayer.worldScaling[0],h:r.h*this.fullLayer.worldScaling[1]},type:vt.FullWork,dataType:Kt.Local,ops:s,index:this.syncIndex*2,...this.baseConsumeResult}}clearTmpPoints(){this.tmpPoints.length=0,this.syncTimestamp=0,this.syncIndex=0}consumeService(t){var I;const{op:r,replaceId:n,isFullWork:s}=t,{strokeColor:c,thickness:l,strokeType:f}=this.workOptions;if(!r.length){const S=Re(this.tmpPoints,l);return{x:S.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:S.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:S.w*this.fullLayer.worldScaling[0],h:S.h*this.fullLayer.worldScaling[1]}}const h=Math.max(0,this.tmpPoints.length-1);this.updateTempPoints(r||[]);let v,u=this.tmpPoints.slice(h);const y=u.length===1;if(y){const S=this.computDotStroke({point:u[0],radius:l/2});u=S.ps,v=S.rect}else v=Re(this.tmpPoints,l);const T={name:(I=this.workId)==null?void 0:I.toString(),fillColor:y?c:void 0,opacity:1,lineDash:f===Ee.Dotted&&!y?[1,l*2]:f===Ee.LongDotted&&!y?[l,l*2]:void 0,strokeColor:c,lineCap:y?void 0:"round",lineWidth:y?0:l,anchor:[.5,.5]},w=this.getTaskPoints(u);if(w.length){const S=s?this.fullLayer:this.drawLayer||this.fullLayer;this.draw({attrs:T,tasks:w,isDot:y,replaceId:n,layer:S})}return{x:v.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:v.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:v.w*this.fullLayer.worldScaling[0],h:v.h*this.fullLayer.worldScaling[1]}}computDotStroke(t){const{point:r,radius:n}=t,s={x:r.x-n,y:r.y-n,w:n*2,h:n*2};return{ps:Jt.GetDotStroke(r,n,8),rect:s}}updateTempPoints(t){const r=this.tmpPoints.length;for(let n=0;n<t.length;n+=2){if(r){const s=this.tmpPoints.slice(-1)[0];s&&s.x===t[n]&&s.y===t[n+1]&&this.tmpPoints.pop()}this.tmpPoints.push(new Jt(t[n],t[n+1]))}}async draw(t){const{attrs:r,tasks:n,isDot:s,layer:c}=t,{duration:l}=this.workOptions;for(const f of n){const h=new gn,{pos:v,points:u}=f;let y;s?y=yn(u,!0):y=yn(u,!1),h.attr({...r,pos:v,d:y}),c.appendChild(h),h.transition(l).attr({scale:s?[.1,.1]:[1,1],lineWidth:s?0:1}).then(()=>{h.remove()})}}getTaskPoints(t){var h;const r=[];if(t.length===0)return[];let n=0,s=t[0].x,c=t[0].y,l=[s,c],f=[];for(;n<t.length;){const v=t[n],u=v.x-s,y=v.y-c;if(f.push(new Jt(u,y)),n>0&&n<t.length-1){const T=t[n].getAngleByPoints(t[n-1],t[n+1]);if(T<60||T>300){const w=(h=f.pop())==null?void 0:h.clone();w&&r.push({pos:l,points:[...f,w]}),s=t[n].x,c=t[n].y,l=[s,c];const I=v.x-s,S=v.y-c;f=[new Jt(I,S)]}}n++}return r.push({pos:l,points:f}),r}removeLocal(){}removeService(t){let r;const n=[];return this.fullLayer.getElementsByName(t).forEach(s=>{if(s.name===t){const c=s.getBoundingClientRect();r=Zt(r,{x:c.x,y:c.y,w:c.width,h:c.height}),n.push(s)}}),n.length&&n.forEach(s=>s.remove()),r}}var nP=ds;ds.polyline=ds,ds.polygon=iP;function ds(i,e,t){var r=i.length,n=ei(i[0],e),s=[],c,l,f,h,v;for(t||(t=[]),c=1;c<r;c++){for(l=i[c-1],f=i[c],h=v=ei(f,e);;)if(n|h){if(n&h)break;n?(l=Ko(l,f,n,e),n=ei(l,e)):(f=Ko(l,f,h,e),h=ei(f,e))}else{s.push(l),h!==v?(s.push(f),c<r-1&&(t.push(s),s=[])):c===r-1&&s.push(f);break}n=v}return s.length&&t.push(s),t}function iP(i,e){var t,r,n,s,c,l,f;for(r=1;r<=8;r*=2){for(t=[],n=i[i.length-1],s=!(ei(n,e)&r),c=0;c<i.length;c++)l=i[c],f=!(ei(l,e)&r),f!==s&&t.push(Ko(n,l,r,e)),f&&t.push(l),n=l,s=f;if(i=t,!i.length)break}return t}function Ko(i,e,t,r){return t&8?[i[0]+(e[0]-i[0])*(r[3]-i[1])/(e[1]-i[1]),r[3]]:t&4?[i[0]+(e[0]-i[0])*(r[1]-i[1])/(e[1]-i[1]),r[1]]:t&2?[r[2],i[1]+(e[1]-i[1])*(r[2]-i[0])/(e[0]-i[0])]:t&1?[r[0],i[1]+(e[1]-i[1])*(r[0]-i[0])/(e[0]-i[0])]:null}function ei(i,e){var t=0;return i[0]<e[0]?t|=1:i[0]>e[2]&&(t|=2),i[1]<e[1]?t|=4:i[1]>e[3]&&(t|=8),t}var Zo=mn(nP);const si=class si extends Yt{constructor(t,r){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.none);dt(this,"toolsType",xt.Eraser);dt(this,"serviceWork");dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"worldPosition");dt(this,"worldScaling");dt(this,"eraserRect");dt(this,"eraserPolyline");this.serviceWork=r,this.workOptions=t.toolsOpt,this.worldPosition=this.fullLayer.worldPosition,this.worldScaling=this.fullLayer.worldScaling}combineConsume(){}consumeService(){}setWorkOptions(t){super.setWorkOptions(t)}createEraserRect(t){const r=t[0]*this.worldScaling[0]+this.worldPosition[0],n=t[1]*this.worldScaling[1]+this.worldPosition[1],{width:s,height:c}=si.eraserSizes[this.workOptions.thickness];this.eraserRect={x:r-s*.5,y:n-c*.5,w:s,h:c},this.eraserPolyline=[this.eraserRect.x,this.eraserRect.y,this.eraserRect.x+this.eraserRect.w,this.eraserRect.y+this.eraserRect.h]}computRectCenterPoints(){const t=this.tmpPoints.slice(-2);if(this.tmpPoints.length===4){const r=new pt(this.tmpPoints[0],this.tmpPoints[1]),n=new pt(this.tmpPoints[2],this.tmpPoints[3]),s=pt.Sub(n,r).uni(),c=pt.Dist(r,n),{width:l,height:f}=si.eraserSizes[this.workOptions.thickness],h=Math.min(l,f),v=Math.round(c/h);if(v>1){const u=[];for(let y=0;y<v;y++){const T=pt.Mul(s,y*h);u.push(this.tmpPoints[0]+T.x,this.tmpPoints[1]+T.y)}return u.concat(t)}}return t}isNear(t,r){const n=new pt(t[0],t[1]),s=new pt(r[0],r[1]),{width:c,height:l}=si.eraserSizes[this.workOptions.thickness];return pt.Dist(n,s)<Math.hypot(c,l)*.5}remove(t){const{curNodeMap:r,removeIds:n}=t;let s;for(const c of r.values())if(c.rect&&this.eraserRect&&this.eraserPolyline&&ia(this.eraserRect,c.rect)){const{op:l}=c,f=[],h=[];for(let u=0;u<l.length;u+=3){const y=new pt(l[u]*this.worldScaling[0]+this.worldPosition[0],l[u+1]*this.worldScaling[1]+this.worldPosition[1],l[u+2]);h.push(y),f.push(new Jt(y.x,y.y))}const v=f.length&&Re(f)||c.rect;ia(v,this.eraserRect)&&(h.length>1?Zo.polyline(h.map(y=>y.XY),this.eraserPolyline).length&&n.add(c.name):n.add(c.name),s=Zt(s,c.rect||v))}return n.forEach(c=>{var f;const l=this.fullLayer.getElementsByName(c);l[0]&&(l[0].remove(),dr(l[0],this.fullLayer.parent),(f=this.vNodes)==null||f.delete(c))}),s&&(s.x-=Yt.SafeBorderPadding,s.y-=Yt.SafeBorderPadding,s.w+=Yt.SafeBorderPadding*2,s.h+=Yt.SafeBorderPadding*2),s}consume(t){const{op:r,disableEraseImage:n,disableEraseText:s}=t.data;if(!r||r.length===0)return{type:vt.None,...this.baseConsumeResult};const c=this.tmpPoints.length;if(c>1&&this.isNear([r[0],r[1]],[this.tmpPoints[c-2],this.tmpPoints[c-1]]))return{type:vt.None,...this.baseConsumeResult};c<3?this.tmpPoints.push(r[0],r[1]):this.tmpPoints.splice(2,2,r[0],r[1]);const l=this.computRectCenterPoints();let f;const h=new Set;if(!this.vNodes)return{type:vt.None,...this.baseConsumeResult};const v=this.getCanEraserNodeMap(this.vNodes.getCanEraserNodes(this.vNodes.curNodeMap,{disableEraseImage:n,disableEraseText:s}));for(let u=0;u<l.length-1;u+=2){this.createEraserRect(l.slice(u,u+2));const y=this.remove({curNodeMap:v,removeIds:h});f=Zt(f,y)}return f&&h.size?{type:vt.RemoveNode,rect:f,removeIds:[...h]}:{type:vt.None,...this.baseConsumeResult}}consumeAll(t){return this.consume(t)}clearTmpPoints(){this.tmpPoints.length=0}getCanEraserNodeMap(t){var r;if(this.serviceWork){const n=new Map(t),s=this.serviceWork.selectorWorkShapes,c=this.serviceWork.workShapes;for(const l of s.values())if((r=l.selectIds)!=null&&r.length)for(const f of l.selectIds)n.delete(f);for(const l of c.keys())n.delete(l);return n}return t}};dt(si,"eraserSizes",Ho);let ps=si;var sP="__lodash_hash_undefined__";function oP(i){return this.__data__.set(i,sP),this}var aP=oP;function lP(i){return this.__data__.has(i)}var fP=lP,cP=Jl,uP=aP,hP=fP;function vs(i){var e=-1,t=i==null?0:i.length;for(this.__data__=new cP;++e<t;)this.add(i[e])}vs.prototype.add=vs.prototype.push=uP,vs.prototype.has=hP;var Jo=vs;function dP(i,e){for(var t=-1,r=i==null?0:i.length;++t<r;)if(e(i[t],t,i))return!0;return!1}var pP=dP;function vP(i,e){return i.has(e)}var Qo=vP,gP=Jo,mP=pP,yP=Qo,SP=1,PP=2;function xP(i,e,t,r,n,s){var c=t&SP,l=i.length,f=e.length;if(l!=f&&!(c&&f>l))return!1;var h=s.get(i),v=s.get(e);if(h&&v)return h==e&&v==i;var u=-1,y=!0,T=t&PP?new gP:void 0;for(s.set(i,e),s.set(e,i);++u<l;){var w=i[u],I=e[u];if(r)var S=c?r(I,w,u,e,i,s):r(w,I,u,i,e,s);if(S!==void 0){if(S)continue;y=!1;break}if(T){if(!mP(e,function(O,d){if(!yP(T,d)&&(w===O||n(w,O,t,r,s)))return T.push(d)})){y=!1;break}}else if(!(w===I||n(w,I,t,r,s))){y=!1;break}}return s.delete(i),s.delete(e),y}var Vf=xP;function TP(i){var e=-1,t=Array(i.size);return i.forEach(function(r,n){t[++e]=[n,r]}),t}var CP=TP;function IP(i){var e=-1,t=Array(i.size);return i.forEach(function(r){t[++e]=r}),t}var qo=IP,Kf=Ai,Zf=wf,OP=Mo,wP=Vf,AP=CP,EP=qo,MP=1,LP=2,RP="[object Boolean]",bP="[object Date]",DP="[object Error]",NP="[object Map]",BP="[object Number]",WP="[object RegExp]",FP="[object Set]",UP="[object String]",YP="[object Symbol]",XP="[object ArrayBuffer]",zP="[object DataView]",Jf=Kf?Kf.prototype:void 0,_o=Jf?Jf.valueOf:void 0;function $P(i,e,t,r,n,s,c){switch(t){case zP:if(i.byteLength!=e.byteLength||i.byteOffset!=e.byteOffset)return!1;i=i.buffer,e=e.buffer;case XP:return!(i.byteLength!=e.byteLength||!s(new Zf(i),new Zf(e)));case RP:case bP:case BP:return OP(+i,+e);case DP:return i.name==e.name&&i.message==e.message;case WP:case UP:return i==e+"";case NP:var l=AP;case FP:var f=r&MP;if(l||(l=EP),i.size!=e.size&&!f)return!1;var h=c.get(i);if(h)return h==e;r|=LP,c.set(i,e);var v=wP(l(i),l(e),r,n,s,c);return c.delete(i),v;case YP:if(_o)return _o.call(i)==_o.call(e)}return!1}var jP=$P,Qf=yf,GP=1,kP=Object.prototype,HP=kP.hasOwnProperty;function VP(i,e,t,r,n,s){var c=t&GP,l=Qf(i),f=l.length,h=Qf(e),v=h.length;if(f!=v&&!c)return!1;for(var u=f;u--;){var y=l[u];if(!(c?y in e:HP.call(e,y)))return!1}var T=s.get(i),w=s.get(e);if(T&&w)return T==e&&w==i;var I=!0;s.set(i,e),s.set(e,i);for(var S=c;++u<f;){y=l[u];var O=i[y],d=e[y];if(r)var g=c?r(d,O,y,e,i,s):r(O,d,y,i,e,s);if(!(g===void 0?O===d||n(O,d,t,r,s):g)){I=!1;break}S||(S=y=="constructor")}if(I&&!S){var p=i.constructor,x=e.constructor;p!=x&&"constructor"in i&&"constructor"in e&&!(typeof p=="function"&&p instanceof p&&typeof x=="function"&&x instanceof x)&&(I=!1)}return s.delete(i),s.delete(e),I}var KP=VP,ta=Ql,ZP=Vf,JP=jP,QP=KP,qf=us,_f=Li,tc=bo,qP=ff,_P=1,ec="[object Arguments]",rc="[object Array]",gs="[object Object]",tx=Object.prototype,nc=tx.hasOwnProperty;function ex(i,e,t,r,n,s){var c=_f(i),l=_f(e),f=c?rc:qf(i),h=l?rc:qf(e);f=f==ec?gs:f,h=h==ec?gs:h;var v=f==gs,u=h==gs,y=f==h;if(y&&tc(i)){if(!tc(e))return!1;c=!0,v=!1}if(y&&!v)return s||(s=new ta),c||qP(i)?ZP(i,e,t,r,n,s):JP(i,e,f,t,r,n,s);if(!(t&_P)){var T=v&&nc.call(i,"__wrapped__"),w=u&&nc.call(e,"__wrapped__");if(T||w){var I=T?i.value():i,S=w?e.value():e;return s||(s=new ta),n(I,S,t,r,s)}}return y?(s||(s=new ta),QP(i,e,t,r,n,s)):!1}var rx=ex,nx=rx,ic=nn;function sc(i,e,t,r,n){return i===e?!0:i==null||e==null||!ic(i)&&!ic(e)?i!==i&&e!==e:nx(i,e,t,r,sc,n)}var ix=sc,sx=ix;function ox(i,e){return sx(i,e)}var ax=ox,Zr=mn(ax);function oc(i,e,t,r=1){return`rgba(${i},${e},${t},${r})`}function lx(i){const e=i.split(","),t=parseInt(e[0].split("(")[1]),r=parseInt(e[1]),n=parseInt(e[2]),s=Number(e[3].split(")")[0]);return[t,r,n,s]}const Rs=class Rs extends Yt{constructor(t){super(t);dt(this,"toolsType",xt.Selector);dt(this,"tmpPoints",[]);dt(this,"subTmpPoints",[]);dt(this,"workOptions");dt(this,"vNodes");dt(this,"selectIds");dt(this,"selectorColor");dt(this,"strokeColor");dt(this,"fillColor");dt(this,"oldSelectRect");dt(this,"oldSubSelectRect");dt(this,"canRotate",!1);dt(this,"canTextEdit",!1);dt(this,"canLock",!1);dt(this,"scaleType",Te.all);dt(this,"toolsTypes");dt(this,"shapeOpt");dt(this,"textOpt");dt(this,"isLocked");dt(this,"thickness");dt(this,"strokeType");dt(this,"useStroke");this.workOptions=t.toolsOpt,this.vNodes=t.vNodes}computSelector(t=!0){const r=Re(this.tmpPoints);if(r.w===0||r.h===0)return{selectIds:[],intersectRect:void 0,subNodeMap:new Map};const{rectRange:n,nodeRange:s}=this.vNodes.getRectIntersectRange(r,t);return{selectIds:[...s.keys()],intersectRect:n,subNodeMap:s}}updateTempPoints(t){const r=this.tmpPoints.length,n=t.length;if(n>1){const s=new Jt(t[n-2]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],t[n-1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]);r===2?this.tmpPoints.splice(1,1,s):this.tmpPoints.push(s)}}drawSelector(t){const{drawRect:r,subNodeMap:n,selectorId:s,layer:c,isService:l}=t,f=new Je({pos:[r.x,r.y],anchor:[0,0],size:[r.w,r.h],id:s,name:s,zIndex:9999}),h=[];if(l){const v=new Eo({normalize:!0,pos:[r.w/2,r.h/2],lineWidth:1,strokeColor:this.selectorColor||this.workOptions.strokeColor,width:r.w,height:r.h,name:Rs.selectorBorderId});h.push(v)}n.forEach((v,u)=>{const y=[v.rect.x+v.rect.w/2-r.x,v.rect.y+v.rect.h/2-r.y],T=new Eo({normalize:!0,pos:y,lineWidth:1,strokeColor:n.size>1?this.selectorColor||this.workOptions.strokeColor:void 0,width:v.rect.w,height:v.rect.h,id:`selector-${u}`,name:`selector-${u}`});h.push(T)}),h&&f.append(...h),(c==null?void 0:c.parent).appendChild(f)}draw(t,r,n,s=!1){var f,h;const{intersectRect:c,subNodeMap:l}=n;(h=(f=r.parent)==null?void 0:f.getElementById(t))==null||h.remove(),c&&this.drawSelector({drawRect:c,subNodeMap:l,selectorId:t,layer:r,isService:s})}getSelecteorInfo(t){this.scaleType=Te.all,this.canRotate=!1,this.textOpt=void 0,this.strokeColor=void 0,this.fillColor=void 0,this.canTextEdit=!1,this.canLock=!1,this.isLocked=!1,this.toolsTypes=void 0,this.shapeOpt=void 0,this.thickness=void 0,this.strokeType=void 0,this.useStroke=!1;const r=new Set;let n,s=!0;for(const c of t.values()){const{opt:l,canRotate:f,scaleType:h,toolsType:v}=c;this.selectorColor=this.workOptions.strokeColor,l.strokeColor&&(this.strokeColor=l.strokeColor),l.fillColor&&(this.fillColor=l.fillColor),l.textOpt&&(this.textOpt=l.textOpt),l.thickness&&(this.thickness=l.thickness),v!==xt.Pencil&&(s=!1),l.strokeType&&(this.strokeType=l.strokeType),v===xt.SpeechBalloon&&(r.add(v),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.placement=l.placement),v===xt.Polygon&&(r.add(v),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=l.vertices),v===xt.Star&&(r.add(v),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=l.vertices,this.shapeOpt.innerRatio=l.innerRatio,this.shapeOpt.innerVerticeStep=l.innerVerticeStep),v===xt.Text&&(this.textOpt=l),t.size===1&&(this.textOpt&&(this.canTextEdit=!0),this.canRotate=f,this.scaleType=h),(v===xt.Image||v===xt.BackgroundSVG)&&(n=c),(h===Te.proportional&&this.scaleType!==Te.none||h===Te.none)&&(this.scaleType=h)}s&&(this.useStroke=!0),r.size&&(this.toolsTypes=[...r]),n&&(t.size===1?(this.canLock=!0,n.opt.locked&&(this.isLocked=!0,this.scaleType=Te.none,this.canRotate=!1,this.textOpt=void 0,this.fillColor=void 0,this.selectorColor="rgb(177,177,177)",this.strokeColor=void 0,this.canTextEdit=!1,this.thickness=void 0,this.strokeType=void 0,this.useStroke=void 0)):t.size>1&&!n.opt.locked&&(this.canLock=!1,this.canRotate=!1))}getChildrenPoints(){var t,r;if(this.scaleType===Te.both&&((t=this.selectIds)==null?void 0:t.length)===1){const n=this.selectIds[0],s=(r=this.vNodes.get(n))==null?void 0:r.op;if(s){const c=[];for(let l=0;l<s.length;l+=3)c.push([s[l],s[l+1]]);return c}}}consume(t){if(t.isSubWorker)return this.subWorkerConsume(t);let r={type:vt.Select,dataType:Kt.Local,...this.baseConsumeResult};if(t.isSimpleWorker){const v=this.subWorkerConsume(t);r.subRect=v.rect}const{op:n,workState:s}=t.data;let c=this.oldSelectRect;if(s===te.Start&&(c=this.unSelectedAllIds()),!(n!=null&&n.length)||!this.vNodes.curNodeMap.size)return t.isSimpleWorker?r:{type:vt.None};this.updateTempPoints(n);const l=this.computSelector();if(this.selectIds&&Zr(this.selectIds,l.selectIds))return t.isSimpleWorker?r:{type:vt.None};this.selectIds=l.selectIds;const f=l.intersectRect;this.getSelecteorInfo(l.subNodeMap),this.draw(Me,this.fullLayer,l),this.oldSelectRect=f;const h=this.getChildrenPoints();return r={...r,rect:Zt(f,c),selectIds:l.selectIds,selectRect:f,selectorColor:this.selectorColor,strokeColor:this.strokeColor,fillColor:this.fillColor,textOpt:this.textOpt,canTextEdit:this.canTextEdit,canRotate:this.canRotate,canLock:this.canLock,scaleType:this.scaleType,willSyncService:!0,points:h,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType},r}consumeAll(){var r,n;let t=this.oldSelectRect;if(!((r=this.selectIds)!=null&&r.length)&&this.tmpPoints[0]&&this.selectSingleTool(this.tmpPoints[0].XY,Me,!1),(n=this.selectIds)!=null&&n.length&&(t=this.selectedByIds(this.selectIds)),t){const s=this.getChildrenPoints();return{type:vt.Select,dataType:Kt.Local,rect:this.oldSelectRect,selectIds:this.selectIds,selectorColor:this.selectorColor,selectRect:this.oldSelectRect,strokeColor:this.strokeColor,fillColor:this.fillColor,textOpt:this.textOpt,canTextEdit:this.canTextEdit,canRotate:this.canRotate,canLock:this.canLock,scaleType:this.scaleType,willSyncService:!0,points:s,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType,...this.baseConsumeResult}}return{type:vt.None}}consumeService(){}updateTempPointsForSubWorker(t){const r=t.slice(-2),n=new Jt(r[0],r[1]);if(this.subTmpPoints[0].isNear(n,1))return!1;if(this.subTmpPoints.length===2){if(n.isNear(this.subTmpPoints[1],1))return!1;this.subTmpPoints[1]=n}else this.subTmpPoints.push(n);return!0}computDrawPoints(t){const{thickness:r}=this.workOptions,n=[];for(const l of t)n.push(new pt(...l));const s=Re(n,r),c=[s.x+s.w/2,s.y+s.h/2];return{rect:s,pos:c,points:n.map(l=>l.XY).flat(1)}}drawForSubWorker(t){const{workId:r,layer:n,ps:s}=t,{strokeColor:c,scale:l,rotate:f,translate:h}=this.workOptions,v=n.worldPosition,u=n.worldScaling,{points:y,rect:T,pos:w}=this.computDrawPoints(s),I=1/n.worldScaling[0],S=c&&lx(c)||[0,0,0,0],O={close:!0,normalize:!0,points:y,lineWidth:I,fillColor:oc(S[0],S[1],S[2],.1),strokeColor:oc(S[0],S[1],S[2],1),lineJoin:"round",lineCap:"round"};let d={x:Math.floor(T.x*u[0]+v[0]-Yt.SafeBorderPadding),y:Math.floor(T.y*u[1]+v[1]-Yt.SafeBorderPadding),w:Math.floor(T.w*u[0]+2*Yt.SafeBorderPadding),h:Math.floor(T.h*u[0]+2*Yt.SafeBorderPadding)};const g=new Je({name:r,id:r,pos:w,anchor:[.5,.5],size:[T.w,T.h],scale:l,rotate:f,translate:h}),p=new en({...O,pos:[0,0]});if(g.appendChild(p),this.replace(n,r,g),l||f||h){const x=g.getBoundingClientRect();d={x:Math.floor(x.x-Yt.SafeBorderPadding),y:Math.floor(x.y-Yt.SafeBorderPadding),w:Math.floor(x.width+2*Yt.SafeBorderPadding),h:Math.floor(x.height+2*Yt.SafeBorderPadding)}}return d}transformData(t){const r=Re(t);return[[r.x,r.y,0],[r.x+r.w,r.y,0],[r.x+r.w,r.y+r.h,0],[r.x,r.y+r.h,0]]}subWorkerConsume(t){const{data:r,isFullWork:n}=t,{op:s,syncUnitTime:c}=r;c&&(this.syncUnitTime=c);const l=s==null?void 0:s.length;if(!l||l<2)return{type:vt.None,rect:void 0};let f;if(this.subTmpPoints.length===0?(this.subTmpPoints=[new Jt(s[0],s[1])],f=!1):f=this.updateTempPointsForSubWorker(s),!f)return{type:vt.None,rect:void 0};const h=this.transformData(this.subTmpPoints),v=n?this.fullLayer:this.drawLayer||this.fullLayer,u=this.drawForSubWorker({ps:h,workId:this.workId,layer:v}),y=Zt(u,this.oldSubSelectRect);return this.oldSubSelectRect=u,{rect:y,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult}}subWorkerConsumeAll(t){const{isFullWork:r}=t,n=r?this.fullLayer:this.drawLayer||this.fullLayer;return this.replace(n,this.workId),{rect:this.oldSelectRect,type:vt.FullWork,dataType:Kt.Local,...this.baseConsumeResult}}clearSubTmpPoints(){this.subTmpPoints.length=0}clearTmpPoints(){this.tmpPoints.length=0,this.clearSubTmpPoints()}clearSubSelectData(){this.oldSubSelectRect=void 0}clearSelectData(){this.selectIds=void 0,this.oldSelectRect=void 0,this.clearSubSelectData()}selectSingleTool(t,r=Me,n=!1){if(t.length===2){const s=t[0],c=t[1];let l;const{nodeRange:f}=this.vNodes.getRectIntersectRange({x:s,y:c,w:0,h:0},!1),h=[...f.values()].sort((v,u)=>(u.opt.zIndex||0)-(v.opt.zIndex||0));for(const v of h){const u=this.fullLayer.getElementsByName(v.name);if(Bc(u).find(T=>T.isPointCollision(s,c))){l=v;break}}if(l){const v=l.name;if(!Zr(this.oldSelectRect,l.rect)){const u=new Map([[v,l]]);this.getSelecteorInfo(u),this.draw(r,this.fullLayer,{intersectRect:l.rect,subNodeMap:u,selectIds:this.selectIds||[]},n)}this.selectIds=[v],this.oldSelectRect=l.rect}}}unSelectedAllIds(){let t;for(const[r,n]of this.vNodes.curNodeMap.entries())n.isSelected&&(t=Zt(t,n.rect),this.vNodes.unSelected(r));return t}unSelectedByIds(t){let r;for(const n of t){const s=this.vNodes.get(n);s&&s.isSelected&&(r=Zt(r,s.rect),this.vNodes.unSelected(n))}return r}selectedByIds(t){let r;for(const n of t){const s=this.vNodes.get(n);s&&(r=Zt(r,s.rect),this.vNodes.selected(n))}return r}getSelectorRect(t,r){var l;let n;const s=(l=t.parent)==null?void 0:l.getElementById(r),c=s==null?void 0:s.getBoundingClientRect();return c&&(n=Zt(n,{x:Math.floor(c.x),y:Math.floor(c.y),w:Math.floor(c.width+1),h:Math.floor(c.height+1)})),n}isCanFillColor(t){return t===xt.Ellipse||t===xt.Triangle||t===xt.Rectangle||t===xt.Polygon||t===xt.Star||t===xt.SpeechBalloon}async updateSelector(t){const{updateSelectorOpt:r,selectIds:n,vNodes:s,willSerializeData:c,worker:l,offset:f}=t,h=this.fullLayer;if(!h)return;let v;const u=new Map,{originPoint:y,workState:T,angle:w,translate:I,dir:S,scale:O}=r;f&&(I?r.translate=[I[0]+f[0],I[1]+f[1]]:r.translate=f);let d;if(y||I||Qe(w)){if(T===te.Start&&n)return s.setTargetAssignKeys(n),{type:vt.Select,dataType:Kt.Local,selectRect:this.oldSelectRect,rect:this.oldSelectRect};if(d=s.getLastTarget(),!d)return}if(n)for(const x of n){const E=s.get(x);if(E){const{toolsType:R,opt:D}=E,U=(h==null?void 0:h.getElementsByName(x))[0];if(U){const M={...r};let W;const X=Yt.isWillRefresh({toolsType:R,opt:D,updateOpt:M,vNodes:s,node:U,willSerializeData:c});if(R){W=d==null?void 0:d.get(x);const B=Nc(R);if(B==null||B.updateNodeOpt({node:U,opt:M,vNodes:s,willSerializeData:c,targetNode:W}),E&&l&&X){const N=l.createWorkShapeNode({workId:x,toolsType:R,toolsOpt:E.opt});N==null||N.setWorkId(x);let $;if(R===xt.BackgroundSVG)$=N.consumeService({isFullWork:!0,replaceId:x});else if(R===xt.Image)$=await N.consumeServiceAsync({isFullWork:!0,replaceId:x,worker:l});else if(R===xt.Text)$=await N.consumeServiceAsync({isFullWork:!0,replaceId:x,isDrawLabel:!0});else try{$=N==null?void 0:N.consumeService({op:E.op,isFullWork:!0,replaceId:x,workState:T})}catch(J){console.error("consumeService error",J);continue}$&&(E.rect=$)}E&&(u.set(x,E),v=Zt(v,E.rect))}}}}d&&T===te.Done&&(s.deleteLastTarget(),d=void 0);const g=v;if(y&&I&&O&&S&&g&&!f){const x=[[g.x,g.y],[g.x+g.w,g.y],[g.x+g.w,g.y+g.h],[g.x,g.y+g.h]];let E;switch(S){case"top":case"topLeft":case"left":I[0]>0&&I[1]>0?E=x[0]:I[0]>0?E=x[3]:I[1]>0?E=x[1]:E=x[2];break;case"topRight":I[0]<0&&I[1]>0?E=x[1]:I[0]<0?E=x[2]:I[1]>0?E=x[0]:E=x[3];break;case"right":case"bottomRight":case"bottom":I[0]<0&&I[1]<0?E=x[2]:I[0]<0?E=x[1]:I[1]<0?E=x[3]:E=x[0];break;case"bottomLeft":I[0]>0&&I[1]<0?E=x[3]:I[0]>0?E=x[0]:I[1]<0?E=x[2]:E=x[1];break}const R=E&&[y[0]-E[0],y[1]-E[1]]||[0,0];if(!Zr(R,[0,0]))return await this.updateSelector({...t,updateSelectorOpt:{workState:T},offset:R})}this.getSelecteorInfo(u),this.draw(Me,h,{selectIds:n||[],subNodeMap:u,intersectRect:g});const p=Zt(this.oldSelectRect,g);return this.oldSelectRect=g,{type:vt.Select,dataType:Kt.Local,selectRect:g,renderRect:v,rect:Zt(p,g),selectIds:n}}blurSelector(){const t=this.unSelectedAllIds();return{type:vt.Select,dataType:Kt.Local,rect:t,selectIds:[],willSyncService:!0}}getRightServiceId(t){return t.replace(Vn,"-")}selectServiceNode(t,r,n){const{selectIds:s}=r,c=this.getRightServiceId(t),l=this.getSelectorRect(this.fullLayer,c);let f;const h=new Map;return s==null||s.forEach(v=>{const u=this.vNodes.get(v);u&&(f=Zt(f,u.rect),h.set(v,u))}),this.getSelecteorInfo(h),this.draw(c,this.fullLayer,{intersectRect:f,selectIds:s||[],subNodeMap:h},n),Zt(f,l)}reRenderSelector(){var n;let t;const r=new Map;return(n=this.selectIds)==null||n.forEach(s=>{const c=this.vNodes.get(s);c&&(t=Zt(t,c.rect),r.set(s,c))},this),this.getSelecteorInfo(r),this.draw(Me,this.fullLayer,{intersectRect:t,subNodeMap:r,selectIds:this.selectIds||[]}),this.oldSelectRect=t,t}updateSelectIds(t){var c;let r;const n=(c=this.selectIds)==null?void 0:c.filter(l=>!t.includes(l));if(n!=null&&n.length&&(r=this.unSelectedByIds(n)),t.length){const l=this.selectedByIds(t);r=Zt(r,l)}this.selectIds=t;const s=this.reRenderSelector();return{bgRect:r,selectRect:s}}cursorHover(t){var c,l;const r=this.oldSelectRect;this.selectIds=[];const n=(c=this.workId)==null?void 0:c.toString(),s=[t[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],t[1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]];if(this.selectSingleTool(s,n,!0),this.oldSelectRect&&!Zr(r,this.oldSelectRect))return{type:vt.CursorHover,dataType:Kt.Local,rect:Zt(r,this.oldSelectRect),selectorColor:this.selectorColor,willSyncService:!1};if((l=this.selectIds)!=null&&l.length||(this.oldSelectRect=void 0),r&&!this.oldSelectRect)return this.cursorBlur(),{type:vt.CursorHover,dataType:Kt.Local,rect:r,selectorColor:this.selectorColor,willSyncService:!1}}cursorBlur(){var r,n;this.selectIds=[];const t=(r=this.workId)==null?void 0:r.toString();((n=this.fullLayer)==null?void 0:n.parent).children.forEach(s=>{s.name===t&&s.remove()})}};dt(Rs,"selectorBorderId","selector-border");let Ri=Rs;class ac extends Yt{constructor(t){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.both);dt(this,"toolsType",xt.Arrow);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"arrowTipWidth");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.arrowTipWidth=this.workOptions.thickness*4,this.syncTimestamp=0,this.syncUnitTime=50}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,h=this.workId,{op:v,syncUnitTime:u}=r;u&&(this.syncUnitTime=u);const y=v==null?void 0:v.length;if(!y||y<2)return{type:vt.None};let T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(v[0],v[1])],T=!1):T=this.updateTempPoints(v),!T)return{type:vt.None};let w;if(s||c||f){const S=n?this.fullLayer:this.drawLayer||this.fullLayer;w=this.draw({workId:h,layer:S})}if(f){const S=Zt(w,this.oldRect);this.oldRect=w;const O={rect:S,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult};if(l){const d=Date.now();d-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=d,O.op=this.tmpPoints.map(g=>[...g.XY,0]).flat(1),O.index=0,O.isSync=!0)}return O}if(!s&&l){const S=Date.now();return S-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=S,{...this.baseConsumeResult,type:vt.DrawWork,dataType:Kt.Local,op:this.tmpPoints.map(O=>[...O.XY,0]).flat(1),isSync:!0,index:0}):{type:vt.None}}const I=Zt(w,this.oldRect);return this.oldRect=w,{rect:I,...this.baseConsumeResult,type:vt.DrawWork,dataType:Kt.Local}}consumeAll(){var l;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.fullLayer,n=this.draw({workId:t,layer:r});this.oldRect=n;const s=this.tmpPoints.map(f=>[...f.XY,0]).flat(1),c=hr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:Yt.getCenterPos(n,r)}),{rect:n,...this.baseConsumeResult,type:vt.FullWork,dataType:Kt.Local,ops:c,isSync:!0,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawEraserlines:s}=t,{strokeColor:c,thickness:l,zIndex:f,scale:h,rotate:v,translate:u,strokeType:y,eraserlines:T,lineDash:w,lineCap:I}=this.workOptions,S=n.worldPosition,O=n.worldScaling,{points:d,pos:g,rect:p,isTriangle:x,trianglePoints:E,trianglePos:R}=this.computDrawPoints(l),D=[p.x+p.w/2,p.y+p.h/2],U={pos:D,name:r,id:r,zIndex:f,anchor:[.5,.5],size:[p.w,p.h]};h&&(U.scale=h),v&&(U.rotate=v),u&&(U.translate=u);const M=new Je(U),W={points:E,pos:[R[0]-D[0],R[1]-D[1]],fillColor:c,strokeColor:c,lineWidth:0,normalize:!1},X=new en(W);if(M.append(X),!x&&d&&g){const N={points:d,pos:[g[0]-D[0],g[1]-D[1]],fillColor:c,strokeColor:c,lineDash:y===Ee.Dotted?[w&&w[0]||1,(w&&w[1]||2)*l]:y===Ee.LongDotted?[(w&&w[0]||1)*l,(w&&w[1]||2)*l]:void 0,lineCap:y===Ee.Normal?void 0:I,lineWidth:l,normalize:!1},$=new en(N);M.append($)}T&&(this.scaleType=Te.proportional,this.drawEraserlines({group:M,eraserlines:T,pos:D,layer:n},s)),this.replace(n,r,M);let B={x:Math.floor(p.x*O[0]+S[0]-Yt.SafeBorderPadding),y:Math.floor(p.y*O[1]+S[1]-Yt.SafeBorderPadding),w:Math.floor(p.w*O[0]+2*Yt.SafeBorderPadding),h:Math.floor(p.h*O[1]+2*Yt.SafeBorderPadding)};if(h||v||u){const N=M.getBoundingClientRect();B={x:Math.floor(N.x-Yt.SafeBorderPadding),y:Math.floor(N.y-Yt.SafeBorderPadding),w:Math.floor(N.width+Yt.SafeBorderPadding*2),h:Math.floor(N.height+Yt.SafeBorderPadding*2)}}return this.isDelete&&M.setAttribute("opacity",0),B}computDrawPoints(t){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.arrowTipWidth?this.computFullArrowPoints(t):this.computTrianglePoints()}computFullArrowPoints(t){const r=pt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),n=pt.Per(r).mul(t/2),s=Jt.Sub(this.tmpPoints[0],n),c=Jt.Add(this.tmpPoints[0],n),l=pt.Mul(r,this.arrowTipWidth),f=pt.Sub(this.tmpPoints[1],l),h=Jt.Sub(f,n),v=Jt.Add(f,n),u=pt.Per(r).mul(t*1.5),y=Jt.Sub(f,u),T=Jt.Add(f,u),w=[this.tmpPoints[0],f],I=[y,this.tmpPoints[1],T],S=[s,c,...I,h,v];return{trianglePoints:I.map(O=>Jt.Sub(O,this.tmpPoints[1]).XY).flat(1),trianglePos:this.tmpPoints[1].XY,points:w.map(O=>Jt.Sub(O,this.tmpPoints[0]).XY).flat(1),rect:Re(S),isTriangle:!1,pos:this.tmpPoints[0].XY}}computTrianglePoints(){const t=pt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),r=this.tmpPoints[1].distance(this.tmpPoints[0]),n=pt.Per(t).mul(Math.floor(r*3/8)),s=Jt.Sub(this.tmpPoints[0],n),c=Jt.Add(this.tmpPoints[0],n),l=[s,this.tmpPoints[1],c];return{trianglePoints:l.map(f=>Jt.Sub(f,this.tmpPoints[1]).XY).flat(1),trianglePos:this.tmpPoints[1].XY,rect:Re(l),isTriangle:!0}}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var h,v;const{op:r,isFullWork:n,workState:s=te.Done}=t,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(let u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));const l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawEraserlines:s===te.Done});return this.oldRect=f,(v=this.vNodes)==null||v.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:Yt.getCenterPos(f,l)}),f}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var h,v;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,strokeType:l}=n,f=s.get(r.name);return c&&(r.tagName==="GROUP"?r.children.forEach(u=>{u.setAttribute("strokeColor",c),u.getAttribute("fillColor")&&u.setAttribute("fillColor",c)}):(r.setAttribute("strokeColor",c),r.setAttribute("fillColor",c)),(h=f==null?void 0:f.opt)!=null&&h.strokeColor&&(f.opt.strokeColor=c)),l&&(f!=null&&f.opt)&&((v=f.opt)!=null&&v.strokeType)&&(f.opt.strokeType=l),f&&s.setInfo(r.name,f),Yt.updateNodeOpt(t)}}class lc extends Yt{constructor(t){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.Ellipse);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.syncTimestamp=0,this.syncUnitTime=50}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,h=this.workId,{op:v,syncUnitTime:u}=r;u&&(this.syncUnitTime=u);const y=v==null?void 0:v.length;if(!y||y<2)return{type:vt.None};let T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(v[0],v[1])],T=!1):T=this.updateTempPoints(v),!T)return{type:vt.None};let w;if(s||c||f){const I=n?this.fullLayer:this.drawLayer||this.fullLayer;w=this.draw({workId:h,layer:I,isDrawing:!0});const S=I.parent.parent,O={x:0,y:0,w:Math.floor(S.width),h:Math.floor(S.height)},d={type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult};if(Fi(w,O)!==yr.outside){const p=Zt(w,this.oldRect);if(this.oldRect=w,d.rect=p,!f)return d}if(f){const p=Date.now();return p-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=p,d.op=this.tmpPoints.map(x=>[...x.XY,0]).flat(1),d.index=0,d.isSync=!0),d}return{type:vt.None}}if(!s&&!c&&!f&&l){const I=Date.now();return I-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=I,{type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult,op:this.tmpPoints.map(S=>[...S.XY,0]).flat(1),isSync:!0,index:0}):{type:vt.None}}return{type:vt.None}}consumeAll(){var l;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;const s=this.tmpPoints.map(f=>[...f.XY,0]).flat(1),c=hr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:n&&Yt.getCenterPos(n,r)}),{rect:n,type:vt.FullWork,dataType:Kt.Local,...this.baseConsumeResult,ops:c,isSync:!0,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawing:s,isDrawEraserlines:c}=t,{strokeColor:l,fillColor:f,thickness:h,zIndex:v,scale:u,rotate:y,translate:T,strokeType:w,eraserlines:I,lineDash:S,lineCap:O}=this.workOptions,d=n.worldScaling,{radius:g,rect:p,pos:x}=this.computDrawPoints(h),E={closeType:"normal",radius:g,lineWidth:h,fillColor:f!=="transparent"&&f||void 0,strokeColor:l,normalize:!0,lineCap:O,lineDash:w===Ee.Dotted?[S&&S[0]||1,(S&&S[1]||2)*h]:w===Ee.LongDotted?[(S&&S[0]||1)*h,(S&&S[1]||2)*h]:void 0},R={name:r,id:r,zIndex:v,pos:x,anchor:[.5,.5],size:[p.w,p.h]};u&&(R.scale=u),y&&(R.rotate=y),T&&(R.translate=T);const D=new Je(R);if(s){const W=new gn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:l,lineWidth:1,scale:[1/d[0],1/d[1]]});D.append(W)}const U=new tn({...E,pos:[0,0]});D.append(U),I&&(this.scaleType=Te.proportional,this.drawEraserlines({group:D,eraserlines:I,pos:x,layer:n},c)),this.replace(n,r,D);const M=D.getBoundingClientRect();return this.isDelete&&D.setAttribute("opacity",0),{x:Math.floor(M.x-Yt.SafeBorderPadding),y:Math.floor(M.y-Yt.SafeBorderPadding),w:Math.floor(M.width+Yt.SafeBorderPadding*2),h:Math.floor(M.height+Yt.SafeBorderPadding*2)}}computDrawPoints(t){const r=Re(this.tmpPoints),n=Re(this.tmpPoints,t),s=[Math.floor(r.x+r.w/2),Math.floor(r.y+r.h/2)];return{rect:n,pos:s,radius:[Math.floor(r.w/2),Math.floor(r.h/2)]}}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var h,v;const{op:r,isFullWork:n,workState:s=te.Done}=t,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(let u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));const l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(v=this.vNodes)==null||v.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:Yt.getCenterPos(f,l)}),f}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var u,y,T;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,fillColor:l,strokeType:f}=n,h=s.get(r.name);let v=r;return r.tagName==="GROUP"&&(v=r.children[0]),c&&(v.setAttribute("strokeColor",c),(u=h==null?void 0:h.opt)!=null&&u.strokeColor&&(h.opt.strokeColor=c)),l&&(l==="transparent"?v.setAttribute("fillColor","rgba(0,0,0,0)"):v.setAttribute("fillColor",l),(y=h==null?void 0:h.opt)!=null&&y.fillColor&&(h.opt.fillColor=l)),f&&(h!=null&&h.opt)&&((T=h.opt)!=null&&T.strokeType)&&(h.opt.strokeType=f),h&&s.setInfo(r.name,h),Yt.updateNodeOpt(t)}}class fc extends Yt{constructor(t){super(t);dt(this,"canRotate",!0);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.Rectangle);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.syncTimestamp=0,this.syncUnitTime=50}transformData(){const t=Re(this.tmpPoints);return[[t.x,t.y,0],[t.x+t.w,t.y,0],[t.x+t.w,t.y+t.h,0],[t.x,t.y+t.h,0]]}computDrawPoints(t){const{thickness:r}=this.workOptions,n=[];for(const l of t)n.push(new pt(...l));const s=Re(n,r),c=[s.x+s.w/2,s.y+s.h/2];return{rect:s,pos:c,points:n.map(l=>l.XY).flat(1)}}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,h=this.workId,{op:v}=r,u=v==null?void 0:v.length;if(!u||u<2)return{type:vt.None};let y;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(v[0],v[1])],y=!1):y=this.updateTempPoints(v),!y)return{type:vt.None};const T=this.transformData();let w;if(s||c||f){const S=n?this.fullLayer:this.drawLayer||this.fullLayer;w=this.draw({ps:T,workId:h,layer:S,isDrawing:!0})}if(f){const S=Zt(w,this.oldRect);this.oldRect=w;const O={rect:S,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult};if(l){const d=Date.now();d-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=d,O.op=T.flat(1),O.index=0,O.isSync=!0)}return O}if(!s&&l){const S=Date.now();return S-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=S,{type:vt.DrawWork,dataType:Kt.Local,op:T.flat(1),isSync:!0,index:0,...this.baseConsumeResult}):{type:vt.None}}const I=Zt(w,this.oldRect);return this.oldRect=w,{rect:I,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult}}consumeAll(){var f;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.transformData(),n=this.fullLayer,s=this.draw({ps:r,workId:t,layer:n,isDrawing:!1});this.oldRect=s;const c=r.flat(1),l=hr(c);return(f=this.vNodes)==null||f.setInfo(t,{rect:s,op:c,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:s&&Yt.getCenterPos(s,n)}),{rect:s,type:vt.FullWork,dataType:Kt.Local,ops:l,isSync:!0,...this.baseConsumeResult,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawing:s,ps:c,replaceId:l,isDrawEraserlines:f=!0}=t,{strokeColor:h,fillColor:v,thickness:u,zIndex:y,scale:T,rotate:w,translate:I,strokeType:S,eraserlines:O,lineCap:d,lineDash:g}=this.workOptions,p=n.worldPosition,x=n.worldScaling,{points:E,rect:R,pos:D}=this.computDrawPoints(c),U={close:!0,normalize:!0,points:E,lineWidth:u,fillColor:v!=="transparent"&&v||void 0,strokeColor:h,lineCap:d,lineDash:S===Ee.Dotted?[g&&g[0]||1,(g&&g[1]||2)*u]:S===Ee.LongDotted?[(g&&g[0]||1)*u,(g&&g[1]||2)*u]:void 0};let M={x:Math.floor(R.x*x[0]+p[0]-Yt.SafeBorderPadding),y:Math.floor(R.y*x[1]+p[1]-Yt.SafeBorderPadding),w:Math.floor(R.w*x[0]+2*Yt.SafeBorderPadding),h:Math.floor(R.h*x[0]+2*Yt.SafeBorderPadding)};const W=new Je({name:r,id:r,zIndex:y,pos:D,anchor:[.5,.5],size:[R.w,R.h],scale:T,rotate:w,translate:I}),X=new en({...U,pos:[0,0]});if(W.appendChild(X),s){const B=new gn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:h,lineWidth:1,scale:[1/x[0],1/x[1]]});W.appendChild(B)}if(O&&(this.scaleType=Te.proportional,this.drawEraserlines({group:W,eraserlines:O,pos:D,layer:n},f)),this.replace(n,l||r,W),T||w||I){const B=W.getBoundingClientRect();M={x:Math.floor(B.x-Yt.SafeBorderPadding),y:Math.floor(B.y-Yt.SafeBorderPadding),w:Math.floor(B.width+2*Yt.SafeBorderPadding),h:Math.floor(B.height+2*Yt.SafeBorderPadding)}}return this.isDelete&&W.setAttribute("opacity",0),M}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var u,y;const{op:r,isFullWork:n,replaceId:s,workState:c=te.Done}=t,l=(u=this.workId)==null?void 0:u.toString();if(!l)return;const f=[];for(let T=0;T<r.length;T+=3)f.push([r[T],r[T+1],r[T+2]]);const h=n?this.fullLayer:this.drawLayer||this.fullLayer,v=this.draw({ps:f,workId:l,layer:h,isDrawing:!1,replaceId:s,isDrawEraserlines:c===te.Done});return this.oldRect=v,(y=this.vNodes)==null||y.setInfo(l,{rect:v,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:v&&Yt.getCenterPos(v,h)}),v}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var u,y,T;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,fillColor:l,strokeType:f}=n,h=s.get(r.name);let v=r;return r.tagName==="GROUP"&&(v=r.children[0]),c&&(v.setAttribute("strokeColor",c),(u=h==null?void 0:h.opt)!=null&&u.strokeColor&&(h.opt.strokeColor=c)),l&&(l==="transparent"?v.setAttribute("fillColor","rgba(0,0,0,0)"):v.setAttribute("fillColor",l),(y=h==null?void 0:h.opt)!=null&&y.fillColor&&(h.opt.fillColor=l)),f&&(h!=null&&h.opt)&&((T=h.opt)!=null&&T.strokeType)&&(h.opt.strokeType=f),h&&s.setInfo(r.name,h),Yt.updateNodeOpt(t)}}class cc extends Yt{constructor(t){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.Star);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.syncTimestamp=0,this.syncUnitTime=50}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,h=this.workId,{op:v,syncUnitTime:u}=r,y=v==null?void 0:v.length;if(!y||y<2)return{type:vt.None};u&&(this.syncUnitTime=u);let T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(v[0],v[1])],T=!1):T=this.updateTempPoints(v),!T)return{type:vt.None};let w;if(s||c||f){const S=n?this.fullLayer:this.drawLayer||this.fullLayer;w=this.draw({workId:h,layer:S,isDrawing:!0})}if(f){const S=Zt(w,this.oldRect);this.oldRect=w;const O={rect:S,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult};if(l){const d=Date.now();d-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=d,O.op=this.tmpPoints.map(g=>[...g.XY,0]).flat(1),O.index=0,O.isSync=!0)}return O}if(!s&&l){const S=Date.now();return S-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=S,{type:vt.DrawWork,dataType:Kt.Local,op:this.tmpPoints.map(O=>[...O.XY,0]).flat(1),isSync:!0,index:0,...this.baseConsumeResult}):{type:vt.None}}const I=Zt(w,this.oldRect);return this.oldRect=w,{rect:I,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult}}consumeAll(){var l;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;const s=this.tmpPoints.map(f=>[...f.XY,0]).flat(1),c=hr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&Yt.getCenterPos(n,r)}),{rect:n,type:vt.FullWork,dataType:Kt.Local,ops:c,isSync:!0,...this.baseConsumeResult,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawing:s,isDrawEraserlines:c=!0}=t,{strokeColor:l,fillColor:f,thickness:h,zIndex:v,vertices:u,innerVerticeStep:y,innerRatio:T,scale:w,rotate:I,translate:S,strokeType:O,eraserlines:d,lineDash:g,lineCap:p}=this.workOptions,x=n.worldScaling,{rect:E,pos:R,points:D}=this.computDrawPoints(h,u,y,T),U={close:!0,points:D,lineWidth:h,fillColor:f!=="transparent"&&f||void 0,strokeColor:l,normalize:!0,lineCap:p,lineDash:O===Ee.Dotted?[g&&g[0]||1,(g&&g[1]||2)*h]:O===Ee.LongDotted?[(g&&g[0]||1)*h,(g&&g[1]||2)*h]:void 0},M={name:r,id:r,zIndex:v,pos:R,anchor:[.5,.5],size:[E.w,E.h]};w&&(M.scale=w),I&&(M.rotate=I),S&&(M.translate=S);const W=new Je(M);if(s){const N=new gn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:l,lineWidth:1,scale:[1/x[0],1/x[1]]});W.append(N)}const X=new en({...U,pos:[0,0]});W.append(X),d&&(this.scaleType=Te.proportional,this.drawEraserlines({group:W,eraserlines:d,pos:R,layer:n},c)),this.replace(n,r,W);const B=W.getBoundingClientRect();return this.isDelete&&W.setAttribute("opacity",0),{x:Math.floor(B.x-Yt.SafeBorderPadding),y:Math.floor(B.y-Yt.SafeBorderPadding),w:Math.floor(B.width+Yt.SafeBorderPadding*2),h:Math.floor(B.height+Yt.SafeBorderPadding*2)}}computDrawPoints(t,r,n,s){const c=Re(this.tmpPoints),l=[Math.floor(c.x+c.w/2),Math.floor(c.y+c.h/2)],f=Fc(c.w,c.h),h=Math.floor(Math.min(c.w,c.h)/2),v=s*h,u=[],y=2*Math.PI/r;for(let w=0;w<r;w++){const I=w*y-.5*Math.PI;let S,O;w%n===1?(S=v*f[0]*Math.cos(I),O=v*f[1]*Math.sin(I)):(S=h*f[0]*Math.cos(I),O=h*f[1]*Math.sin(I),u.push(S,O)),u.push(S,O)}return{rect:Re(this.tmpPoints,t),pos:l,points:u}}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c)||Jt.Sub(s,n).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var h,v;const{op:r,isFullWork:n,workState:s=te.Done}=t,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(let u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));const l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(v=this.vNodes)==null||v.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&Yt.getCenterPos(f,l)}),f}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var S;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,fillColor:l,toolsType:f,vertices:h,innerVerticeStep:v,innerRatio:u,strokeType:y}=n,T=s.get(r.name),w=T==null?void 0:T.opt;let I=r;return r.tagName==="GROUP"&&(I=r.children[0]),c&&(I.setAttribute("strokeColor",c),w!=null&&w.strokeColor&&(w.strokeColor=c)),l&&(l==="transparent"?I.setAttribute("fillColor","rgba(0,0,0,0)"):I.setAttribute("fillColor",l),w!=null&&w.fillColor&&(w.fillColor=l)),f===xt.Star&&(h&&(w.vertices=h),v&&(w.innerVerticeStep=v),u&&(w.innerRatio=u)),y&&(T!=null&&T.opt)&&((S=T.opt)!=null&&S.strokeType)&&(T.opt.strokeType=y),T&&s.setInfo(r.name,{...T,opt:w}),Yt.updateNodeOpt(t)}}class uc extends Yt{constructor(t){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.Polygon);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.syncTimestamp=0,this.syncUnitTime=50}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,{op:h,syncUnitTime:v}=r;v&&(this.syncUnitTime=v);const u=this.workId,y=h==null?void 0:h.length;if(!y||y<2)return{type:vt.None};let T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(h[0],h[1])],T=!1):T=this.updateTempPoints(h),!T)return{type:vt.None};let w;if(s||c||f){const S=n?this.fullLayer:this.drawLayer||this.fullLayer;w=this.draw({workId:u,layer:S,isDrawing:!0})}if(f){const S=Zt(w,this.oldRect);this.oldRect=w;const O={type:vt.DrawWork,rect:S,dataType:Kt.Local,...this.baseConsumeResult};if(l){const d=Date.now();d-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=d,O.op=this.tmpPoints.map(g=>[...g.XY,0]).flat(1),O.index=0,O.isSync=!0)}return O}if(!s&&l){const S=Date.now();return S-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=S,{type:vt.DrawWork,dataType:Kt.Local,op:this.tmpPoints.map(O=>[...O.XY,0]).flat(1),isSync:!0,index:0,...this.baseConsumeResult}):{type:vt.None}}const I=Zt(w,this.oldRect);return this.oldRect=w,{rect:I,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult}}consumeAll(){var l;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;const s=this.tmpPoints.map(f=>[...f.XY,0]).flat(1),c=hr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&Yt.getCenterPos(n,r)}),{rect:n,type:vt.FullWork,dataType:Kt.Local,ops:c,isSync:!0,...this.baseConsumeResult,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawing:s,isDrawEraserlines:c=!0}=t,{strokeColor:l,fillColor:f,thickness:h,zIndex:v,vertices:u,scale:y,rotate:T,translate:w,strokeType:I,eraserlines:S,lineCap:O,lineDash:d}=this.workOptions,g=n.worldScaling,{rect:p,pos:x,points:E}=this.computDrawPoints(h,u),R={close:!0,points:E,lineWidth:h,fillColor:f!=="transparent"&&f||void 0,strokeColor:l,normalize:!0,lineCap:O,lineDash:I===Ee.Dotted?[d&&d[0]||1,(d&&d[1]||2)*h]:I===Ee.LongDotted?[(d&&d[0]||1)*h,(d&&d[1]||2)*h]:void 0},D={name:r,id:r,zIndex:v,pos:x,anchor:[.5,.5],size:[p.w,p.h]};y&&(D.scale=y),T&&(D.rotate=T),w&&(D.translate=w);const U=new Je(D);if(s){const X=new gn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:l,lineWidth:1,scale:[1/g[0],1/g[1]]});U.append(X)}const M=new en({...R,pos:[0,0]});U.append(M),S&&(this.scaleType=Te.proportional,this.drawEraserlines({group:U,eraserlines:S,pos:x,layer:n},c)),this.replace(n,r,U);const W=U.getBoundingClientRect();return this.isDelete&&U.setAttribute("opacity",0),{x:Math.floor(W.x-Yt.SafeBorderPadding),y:Math.floor(W.y-Yt.SafeBorderPadding),w:Math.floor(W.width+Yt.SafeBorderPadding*2),h:Math.floor(W.height+Yt.SafeBorderPadding*2)}}computDrawPoints(t,r){const n=Re(this.tmpPoints),s=[Math.floor(n.x+n.w/2),Math.floor(n.y+n.h/2)],c=Fc(n.w,n.h),l=Math.floor(Math.min(n.w,n.h)/2),f=[],h=2*Math.PI/r;for(let u=0;u<r;u++){const y=u*h-.5*Math.PI,T=l*c[0]*Math.cos(y),w=l*c[1]*Math.sin(y);f.push(T,w)}return{rect:Re(this.tmpPoints,t),pos:s,points:f}}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c)||Jt.Sub(s,n).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var h,v;const{op:r,isFullWork:n,workState:s=te.Done}=t,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(let u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));const l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(v=this.vNodes)==null||v.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&Yt.getCenterPos(f,l)}),f}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var w;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,fillColor:l,toolsType:f,vertices:h,strokeType:v}=n,u=s.get(r.name),y=u==null?void 0:u.opt;let T=r;return r.tagName==="GROUP"&&(T=r.children[0]),c&&(T.setAttribute("strokeColor",c),y!=null&&y.strokeColor&&(y.strokeColor=c)),l&&(l==="transparent"?T.setAttribute("fillColor","rgba(0,0,0,0)"):T.setAttribute("fillColor",l),y!=null&&y.fillColor&&(y.fillColor=l)),f===xt.Polygon&&h&&(y.vertices=h),v&&(u!=null&&u.opt)&&((w=u.opt)!=null&&w.strokeType)&&(u.opt.strokeType=v),u&&s.setInfo(r.name,{...u,opt:y}),Yt.updateNodeOpt(t)}}class zr{static bezier(e,t){const r=[];for(let n=0;n<t.length;n+=4){const s=t[n],c=t[n+1],l=t[n+2],f=t[n+3];s&&c&&l&&f?r.push(...zr.getBezierPoints(e,s,c,l,f)):s&&c&&l?r.push(...zr.getBezierPoints(e,s,c,l)):s&&c?r.push(...zr.getBezierPoints(e,s,c)):s&&r.push(s)}return r}static getBezierPoints(e=10,t,r,n,s){let c=null;const l=[];!n&&!s?c=zr.oneBezier:n&&!s?c=zr.twoBezier:n&&s&&(c=zr.threeBezier);for(let f=0;f<e;f++)c&&l.push(c(f/e,t,r,n,s));return s?l.push(s):n&&l.push(n),l}static oneBezier(e,t,r){const n=t.x+(r.x-t.x)*e,s=t.y+(r.y-t.y)*e;return new pt(n,s)}static twoBezier(e,t,r,n){const s=(1-e)*(1-e)*t.x+2*e*(1-e)*r.x+e*e*n.x,c=(1-e)*(1-e)*t.y+2*e*(1-e)*r.y+e*e*n.y;return new pt(s,c)}static threeBezier(e,t,r,n,s){const c=t.x*(1-e)*(1-e)*(1-e)+3*r.x*e*(1-e)*(1-e)+3*n.x*e*e*(1-e)+s.x*e*e*e,l=t.y*(1-e)*(1-e)*(1-e)+3*r.y*e*(1-e)*(1-e)+3*n.y*e*e*(1-e)+s.y*e*e*e;return new pt(c,l)}}class hc extends Yt{constructor(t){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.SpeechBalloon);dt(this,"ratio",.8);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.syncTimestamp=0,this.syncUnitTime=50}consume(t){var I;const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,h=(I=r==null?void 0:r.workId)==null?void 0:I.toString();if(!h)return{type:vt.None};const{op:v}=r,u=v==null?void 0:v.length;if(!u||u<2)return{type:vt.None};let y;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(v[0],v[1])],y=!1):y=this.updateTempPoints(v),!y)return{type:vt.None};let T;if(s||c||f){const S=n?this.fullLayer:this.drawLayer||this.fullLayer;T=this.draw({workId:h,layer:S,isDrawing:!0})}if(f){const S=Zt(T,this.oldRect);this.oldRect=T;const O={rect:S,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult};if(l){const d=Date.now();d-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=d,O.op=this.tmpPoints.map(g=>[...g.XY,0]).flat(1),O.index=0,O.isSync=!0)}return O}if(!s&&l){const S=Date.now();return S-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=S,{type:vt.DrawWork,dataType:Kt.Local,op:this.tmpPoints.map(O=>[...O.XY,0]).flat(1),isSync:!0,index:0,...this.baseConsumeResult}):{type:vt.None}}const w=Zt(T,this.oldRect);return this.oldRect=T,{rect:w,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult}}consumeAll(){var l;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;const s=this.tmpPoints.map(f=>[...f.XY,0]).flat(1),c=hr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&Yt.getCenterPos(n,r)}),{rect:n,type:vt.FullWork,dataType:Kt.Local,ops:c,isSync:!0,...this.baseConsumeResult,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawEraserlines:s=!0}=t,{strokeColor:c,fillColor:l,thickness:f,zIndex:h,placement:v,scale:u,rotate:y,translate:T,strokeType:w,eraserlines:I,lineDash:S,lineCap:O}=this.workOptions,{rect:d,pos:g,points:p}=this.computDrawPoints(f,v),x={points:p.map(M=>M.XY),lineWidth:f,fillColor:l!=="transparent"&&l||void 0,strokeColor:c,normalize:!0,className:`${g[0]},${g[1]}`,close:!0,lineCap:O,lineDash:w===Ee.Dotted?[S&&S[0]||1,(S&&S[1]||2)*f]:w===Ee.LongDotted?[(S&&S[0]||1)*f,(S&&S[1]||2)*f]:void 0},E={name:r,id:r,zIndex:h,pos:g,anchor:[.5,.5],size:[d.w,d.h]};u&&(E.scale=u),y&&(E.rotate=y),T&&(E.translate=T);const R=new Je(E),D=new en({...x,pos:[0,0]});R.append(D),I&&(this.scaleType=Te.proportional,this.drawEraserlines({group:R,eraserlines:I,pos:g,layer:n},s)),this.replace(n,r,R);const U=R.getBoundingClientRect();return this.isDelete&&R.setAttribute("opacity",0),{x:Math.floor(U.x-Yt.SafeBorderPadding),y:Math.floor(U.y-Yt.SafeBorderPadding),w:Math.floor(U.width+Yt.SafeBorderPadding*2),h:Math.floor(U.height+Yt.SafeBorderPadding*2)}}transformControlPoints(t){const r=Re(this.tmpPoints);switch(t){case"bottom":case"bottomLeft":case"bottomRight":{const n=r.y+r.h*this.ratio;return[new pt(r.x,r.y,0),new pt(r.x+r.w,r.y,0),new pt(r.x+r.w,n,0),new pt(r.x,n,0)]}case"top":case"topLeft":case"topRight":{const n=r.y+r.h*(1-this.ratio);return[new pt(r.x,n,0),new pt(r.x+r.w,n,0),new pt(r.x+r.w,r.y+r.h,0),new pt(r.x,r.y+r.h,0)]}case"left":case"leftBottom":case"leftTop":{const n=r.x+r.w*(1-this.ratio);return[new pt(n,r.y,0),new pt(r.x+r.w,r.y,0),new pt(r.x+r.w,r.y+r.h,0),new pt(n,r.y+r.h,0)]}case"right":case"rightBottom":case"rightTop":{const n=r.x+r.w*this.ratio;return[new pt(r.x,r.y,0),new pt(n,r.y,0),new pt(n,r.y+r.h,0),new pt(r.x,r.y+r.h,0)]}}}computDrawPoints(t,r){const n=Re(this.tmpPoints),s=this.transformControlPoints(r),c=Math.floor(n.w*.1),l=Math.floor(n.h*.1),f=[],h=pt.Add(s[0],new pt(0,l,0)),v=pt.Add(s[0],new pt(c,0,0)),u=zr.getBezierPoints(10,h,s[0],v),y=pt.Sub(s[1],new pt(c,0,0)),T=pt.Add(s[1],new pt(0,l,0)),w=zr.getBezierPoints(10,y,s[1],T),I=pt.Sub(s[2],new pt(0,l,0)),S=pt.Sub(s[2],new pt(c,0,0)),O=zr.getBezierPoints(10,I,s[2],S),d=pt.Add(s[3],new pt(c,0,0)),g=pt.Sub(s[3],new pt(0,l,0)),p=zr.getBezierPoints(10,d,s[3],g),x=c*(1-this.ratio)*10,E=l*(1-this.ratio)*10;switch(r){case"bottom":{const U=pt.Sub(s[2],new pt(c*5-x/2,0,0)),M=pt.Sub(s[2],new pt(c*5,-E,0)),W=pt.Sub(s[2],new pt(c*5+x/2,0,0));f.push(M,W,...p,...u,...w,...O,U);break}case"bottomRight":{const U=pt.Sub(s[2],new pt(c*1.1,0,0)),M=pt.Sub(s[2],new pt(c*1.1+x/2,-E,0)),W=pt.Sub(s[2],new pt(c*1.1+x,0,0));f.push(M,W,...p,...u,...w,...O,U);break}case"bottomLeft":{const U=pt.Add(s[3],new pt(c*1.1+x,0,0)),M=pt.Add(s[3],new pt(c*1.1+x/2,E,0)),W=pt.Add(s[3],new pt(c*1.1,0,0));f.push(M,W,...p,...u,...w,...O,U);break}case"top":{const U=pt.Sub(s[1],new pt(c*5-x/2,0,0)),M=pt.Sub(s[1],new pt(c*5,E,0)),W=pt.Sub(s[1],new pt(c*5+x/2,0,0));f.push(M,U,...w,...O,...p,...u,W);break}case"topRight":{const U=pt.Sub(s[1],new pt(c*1.1,0,0)),M=pt.Sub(s[1],new pt(c*1.1+x/2,E,0)),W=pt.Sub(s[1],new pt(c*1.1+x,0,0));f.push(M,U,...w,...O,...p,...u,W);break}case"topLeft":{const U=pt.Add(s[0],new pt(c*1.1+x,0,0)),M=pt.Add(s[0],new pt(c*1.1+x/2,-E,0)),W=pt.Add(s[0],new pt(c*1.1,0,0));f.push(M,U,...w,...O,...p,...u,W);break}case"left":{const U=pt.Add(s[0],new pt(0,l*5-E/2,0)),M=pt.Add(s[0],new pt(-x,l*5,0)),W=pt.Add(s[0],new pt(0,l*5+E/2,0));f.push(M,U,...u,...w,...O,...p,W);break}case"leftTop":{const U=pt.Add(s[0],new pt(0,l*1.1,0)),M=pt.Add(s[0],new pt(-x,l*1.1+E/2,0)),W=pt.Add(s[0],new pt(0,l*1.1+E,0));f.push(M,U,...u,...w,...O,...p,W);break}case"leftBottom":{const U=pt.Sub(s[3],new pt(0,l*1.1+E,0)),M=pt.Sub(s[3],new pt(x,l*1.1+E/2,0)),W=pt.Sub(s[3],new pt(0,l*1.1,0));f.push(M,U,...u,...w,...O,...p,W);break}case"right":{const U=pt.Add(s[1],new pt(0,l*5-E/2,0)),M=pt.Add(s[1],new pt(x,l*5,0)),W=pt.Add(s[1],new pt(0,l*5+E/2,0));f.push(M,W,...O,...p,...u,...w,U);break}case"rightTop":{const U=pt.Add(s[1],new pt(0,l*1.1,0)),M=pt.Add(s[1],new pt(x,l*1.1+E/2,0)),W=pt.Add(s[1],new pt(0,l*1.1+E,0));f.push(M,W,...O,...p,...u,...w,U);break}case"rightBottom":{const U=pt.Sub(s[2],new pt(0,l*1.1+E,0)),M=pt.Sub(s[2],new pt(-x,l*1.1+E/2,0)),W=pt.Sub(s[2],new pt(0,l*1.1,0));f.push(M,W,...O,...p,...u,...w,U);break}}const R=Re(this.tmpPoints,t),D=[Math.floor(R.x+R.w/2),Math.floor(R.y+R.h/2)];return{rect:R,pos:D,points:f}}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c)||Jt.Sub(s,n).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var h,v;const{op:r,isFullWork:n,workState:s=te.Done}=t,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(let u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));const l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(v=this.vNodes)==null||v.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&Yt.getCenterPos(f,l)}),f}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var w;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,fillColor:l,toolsType:f,placement:h,strokeType:v}=n,u=s.get(r.name),y=u==null?void 0:u.opt;let T=r;return r.tagName==="GROUP"&&(T=r.children[0]),c&&(T.setAttribute("strokeColor",c),y!=null&&y.strokeColor&&(y.strokeColor=c)),l&&(l==="transparent"?T.setAttribute("fillColor","rgba(0,0,0,0)"):T.setAttribute("fillColor",l),y!=null&&y.fillColor&&(y.fillColor=l)),f===xt.SpeechBalloon&&h&&(y.placement=h),v&&(u!=null&&u.opt)&&((w=u.opt)!=null&&w.strokeType)&&(u.opt.strokeType=v),u&&s.setInfo(r.name,{...u,opt:y}),Yt.updateNodeOpt(t)}}var fx=Kn,cx=nn,ux="[object Boolean]";function hx(i){return i===!0||i===!1||cx(i)&&fx(i)==ux}var dx=hx,Nn=mn(dx);class bi extends Yt{constructor(t){super(t);dt(this,"canRotate",!0);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.Image);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");this.workOptions=t.toolsOpt,this.scaleType=bi.getScaleType(this.workOptions)}consume(){return{type:vt.None}}consumeAll(){return{type:vt.None}}draw(t){const{layer:r,workId:n,replaceId:s,imageBitmap:c}=t,{centerX:l,centerY:f,width:h,height:v,rotate:u,zIndex:y,eraserlines:T}=this.workOptions,w=new Je({anchor:[.5,.5],pos:[l,f],name:n,size:[h,v],zIndex:y,rotate:u}),I={anchor:[.5,.5],pos:[0,0],size:[h,v],texture:c};c||(I.bgcolor="rgba(0,0,0,0.3)");const S=new Ul(I);w.append(S),T&&this.drawEraserlines({group:w,eraserlines:T,pos:[l,f],layer:r}),this.replace(r,s||n,w);const O=w.getBoundingClientRect();if(O)return{x:Math.floor(O.x-Yt.SafeBorderPadding),y:Math.floor(O.y-Yt.SafeBorderPadding),w:Math.floor(O.width+Yt.SafeBorderPadding*2),h:Math.floor(O.height+Yt.SafeBorderPadding*2)}}consumeService(){}async consumeServiceAsync(t){var v,u,y,T;const{isFullWork:r,replaceId:n,worker:s}=t,{src:c,uuid:l}=this.workOptions,f=((v=this.workId)==null?void 0:v.toString())||l,h=r?this.fullLayer:this.drawLayer||this.fullLayer;if(c){const w=await s.loadImageBitMap({toolsType:this.toolsType,opt:this.workOptions,workId:f,isSubWorker:s instanceof _c});if(w){const I=this.draw({workId:f,layer:h,replaceId:n,imageBitmap:w});return this.oldRect=f&&((y=(u=this.vNodes)==null?void 0:u.get(f))==null?void 0:y.rect)||void 0,(T=this.vNodes)==null||T.setInfo(f,{rect:I,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:I&&Yt.getCenterPos(I,h)}),I}}}clearTmpPoints(){this.tmpPoints.length=0}static getScaleType(t){const{uniformScale:r,rotate:n}=t;return r!==!1||n&&Math.abs(n)%90>0?Te.proportional:Te.all}static updateNodeOpt(t){const{node:r,opt:n,vNodes:s,targetNode:c}=t,{translate:l,originPoint:f,scenePoint:h,scale:v,angle:u,isLocked:y,zIndex:T,strokeColor:w}=n,I=c&&ar(c)||s.get(r.name);if(!I)return;const S=r.parent;if(S){if(w&&(I.opt.strokeColor=w),Qe(T)&&(r.setAttribute("zIndex",T),I.opt.zIndex=T),Nn(y)&&(I.opt.locked=y),f&&h&&v&&l){const{centerX:O,centerY:d,width:g,height:p,uniformScale:x}=I.opt,E=x!==!1?[v[0],v[0]]:v,R=[O,d],D=[O,d];Es(D,h,E,l);const U=[D[0]-R[0],D[1]-R[1]];if(I.centerPos=[I.centerPos[0]+U[0],I.centerPos[1]+U[1]],I.opt.width=Math.round(g*E[0]),I.opt.height=Math.round(p*E[1]),I.opt.centerX=D[0],I.opt.centerY=D[1],I.opt.eraserlines)for(const M of I.opt.eraserlines){const{op:W,thickness:X}=M;M.thickness=Math.round(X*Math.max(v[0],v[1]));for(let B=0;B<W.length;B++)oa(W[B],h,v,l)}}else if(l){if(I.opt.centerX=I.opt.centerX+l[0],I.opt.centerY=I.opt.centerY+l[1],I.centerPos=[I.centerPos[0]+l[0],I.centerPos[1]+l[1]],I.opt.eraserlines)for(const O of I.opt.eraserlines){const{op:d}=O;for(let g=0;g<d.length;g++){const p=d[g].map((x,E)=>E%2?x+l[1]:x+l[0]);O.op[g]=p}}}else if(Qe(u))if(I.opt.rotate=u,I.scaleType=bi.getScaleType(I.opt),c){const O=sa(I.rect,u);I.rect=O}else{const O=Yt.getRectFromLayer(S,r.name);I.rect=O||I.rect}return I&&s.setInfo(r.name,I),I==null?void 0:I.rect}}}class dc extends Yt{constructor(t){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.both);dt(this,"toolsType",xt.Straight);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"straightTipWidth");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.straightTipWidth=this.workOptions.thickness/2,this.syncTimestamp=0,this.syncUnitTime=50}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,h=this.workId,{op:v,syncUnitTime:u}=r,y=v==null?void 0:v.length;if(!y||y<2)return{type:vt.None};u&&(this.syncUnitTime=u);let T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(v[0],v[1])],T=!1):T=this.updateTempPoints(v),!T)return{type:vt.None};let w;if(s||c||f){const S=n?this.fullLayer:this.drawLayer||this.fullLayer;w=this.draw({workId:h,layer:S})}if(f){const S=Zt(w,this.oldRect);this.oldRect=w;const O={rect:S,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult};if(l){const d=Date.now();d-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=d,O.op=this.tmpPoints.map(g=>[...g.XY,0]).flat(1),O.index=0,O.isSync=!0)}return O}if(!s&&l){const S=Date.now();return S-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=S,{type:vt.DrawWork,dataType:Kt.Local,op:this.tmpPoints.map(O=>[...O.XY,0]).flat(1),isSync:!0,index:0,...this.baseConsumeResult}):{type:vt.None}}const I=Zt(w,this.oldRect);return this.oldRect=w,{rect:I,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult}}consumeAll(){var l;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.fullLayer,n=this.draw({workId:t,layer:r});this.oldRect=n;const s=this.tmpPoints.map(f=>[...f.XY,0]).flat(1),c=hr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&Yt.getCenterPos(n,r)}),{rect:n,type:vt.FullWork,dataType:Kt.Local,ops:c,isSync:!0,...this.baseConsumeResult,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawEraserlines:s=!0}=t,{strokeColor:c,thickness:l,zIndex:f,scale:h,rotate:v,translate:u,strokeType:y,eraserlines:T,lineCap:w,lineDash:I}=this.workOptions,S=n.worldPosition,O=n.worldScaling,{d,rect:g,isDot:p}=this.computDrawPoints(l,y),x=[g.x+g.w/2,g.y+g.h/2],E=new Je({pos:x,anchor:[.5,.5],size:[g.w,g.h],name:r,id:r,normalize:!0,zIndex:f}),R={pos:[0,0],normalize:!0,d,fillColor:c,strokeColor:c,lineDash:p?void 0:y===Ee.Dotted?[I&&I[0]||1,(I&&I[1]||2)*l]:y===Ee.LongDotted?[(I&&I[0]||1)*l,(I&&I[1]||2)*l]:void 0,lineCap:p?void 0:w,lineWidth:y===Ee.Normal||p?0:l};h&&(R.scale=h),v&&(R.rotate=v),u&&(R.translate=u);const D=new gn(R);E.append(D),T&&(this.scaleType=Te.proportional,this.drawEraserlines({group:E,eraserlines:T,pos:x,layer:n},s)),this.replace(n,r,E);let U={x:Math.floor(g.x*O[0]+S[0]-Yt.SafeBorderPadding),y:Math.floor(g.y*O[1]+S[1]-Yt.SafeBorderPadding),w:Math.floor(g.w*O[0]+2*Yt.SafeBorderPadding),h:Math.floor(g.h*O[1]+2*Yt.SafeBorderPadding)};if(v||h||u){const M=D.getBoundingClientRect();U={x:Math.floor(M.x-Yt.SafeBorderPadding),y:Math.floor(M.y-Yt.SafeBorderPadding),w:Math.floor(M.width+Yt.SafeBorderPadding*2),h:Math.floor(M.height+Yt.SafeBorderPadding*2)}}return this.isDelete&&E.setAttribute("opacity",0),U}computDrawPoints(t,r){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.straightTipWidth?this.computFullPoints(t,r):this.computDotPoints(t)}computFullPoints(t,r){const n=pt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),s=pt.Per(n).mul(t/2),c=Jt.Sub(this.tmpPoints[0],s),l=Jt.Add(this.tmpPoints[0],s),f=Jt.Sub(this.tmpPoints[1],s),h=Jt.Add(this.tmpPoints[1],s),v=Jt.GetSemicircleStroke(this.tmpPoints[1],f,-1,8),u=Jt.GetSemicircleStroke(this.tmpPoints[0],l,-1,8),y=[c,f,...v,h,l,...u];let T;return r!==Ee.Normal?T=yn(this.tmpPoints,!1):T=yn(y,!0),{d:T,rect:Re(y),isDot:!1,pos:this.tmpPoints[0].XY}}computDotPoints(t){const r=Jt.GetDotStroke(this.tmpPoints[0],t/2,8);return{d:yn(r,!0),rect:Re(r),isDot:!0,pos:this.tmpPoints[0].XY}}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var h,v;const{op:r,isFullWork:n,workState:s=te.Done}=t,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(let u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));const l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawEraserlines:s===te.Done});return this.oldRect=f,(v=this.vNodes)==null||v.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&Yt.getCenterPos(f,l)}),f}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var h,v;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,strokeType:l}=n,f=s.get(r.name);return c&&(r.tagName==="GROUP"?r.children.forEach(u=>{u.setAttribute("strokeColor",c),u.getAttribute("fillColor")&&u.setAttribute("fillColor",c)}):(r.setAttribute("strokeColor",c),r.setAttribute("fillColor",c)),(h=f==null?void 0:f.opt)!=null&&h.strokeColor&&(f.opt.strokeColor=c)),l&&(f!=null&&f.opt)&&((v=f.opt)!=null&&v.strokeType)&&(f.opt.strokeType=l),f&&s.setInfo(r.name,f),Yt.updateNodeOpt(t)}}const ri="cursorhover",pc=20,Bn="mainView";var vc={exports:{}},je={},ea={exports:{}},Wn={};function gc(){var i={};return i["align-content"]=!1,i["align-items"]=!1,i["align-self"]=!1,i["alignment-adjust"]=!1,i["alignment-baseline"]=!1,i.all=!1,i["anchor-point"]=!1,i.animation=!1,i["animation-delay"]=!1,i["animation-direction"]=!1,i["animation-duration"]=!1,i["animation-fill-mode"]=!1,i["animation-iteration-count"]=!1,i["animation-name"]=!1,i["animation-play-state"]=!1,i["animation-timing-function"]=!1,i.azimuth=!1,i["backface-visibility"]=!1,i.background=!0,i["background-attachment"]=!0,i["background-clip"]=!0,i["background-color"]=!0,i["background-image"]=!0,i["background-origin"]=!0,i["background-position"]=!0,i["background-repeat"]=!0,i["background-size"]=!0,i["baseline-shift"]=!1,i.binding=!1,i.bleed=!1,i["bookmark-label"]=!1,i["bookmark-level"]=!1,i["bookmark-state"]=!1,i.border=!0,i["border-bottom"]=!0,i["border-bottom-color"]=!0,i["border-bottom-left-radius"]=!0,i["border-bottom-right-radius"]=!0,i["border-bottom-style"]=!0,i["border-bottom-width"]=!0,i["border-collapse"]=!0,i["border-color"]=!0,i["border-image"]=!0,i["border-image-outset"]=!0,i["border-image-repeat"]=!0,i["border-image-slice"]=!0,i["border-image-source"]=!0,i["border-image-width"]=!0,i["border-left"]=!0,i["border-left-color"]=!0,i["border-left-style"]=!0,i["border-left-width"]=!0,i["border-radius"]=!0,i["border-right"]=!0,i["border-right-color"]=!0,i["border-right-style"]=!0,i["border-right-width"]=!0,i["border-spacing"]=!0,i["border-style"]=!0,i["border-top"]=!0,i["border-top-color"]=!0,i["border-top-left-radius"]=!0,i["border-top-right-radius"]=!0,i["border-top-style"]=!0,i["border-top-width"]=!0,i["border-width"]=!0,i.bottom=!1,i["box-decoration-break"]=!0,i["box-shadow"]=!0,i["box-sizing"]=!0,i["box-snap"]=!0,i["box-suppress"]=!0,i["break-after"]=!0,i["break-before"]=!0,i["break-inside"]=!0,i["caption-side"]=!1,i.chains=!1,i.clear=!0,i.clip=!1,i["clip-path"]=!1,i["clip-rule"]=!1,i.color=!0,i["color-interpolation-filters"]=!0,i["column-count"]=!1,i["column-fill"]=!1,i["column-gap"]=!1,i["column-rule"]=!1,i["column-rule-color"]=!1,i["column-rule-style"]=!1,i["column-rule-width"]=!1,i["column-span"]=!1,i["column-width"]=!1,i.columns=!1,i.contain=!1,i.content=!1,i["counter-increment"]=!1,i["counter-reset"]=!1,i["counter-set"]=!1,i.crop=!1,i.cue=!1,i["cue-after"]=!1,i["cue-before"]=!1,i.cursor=!1,i.direction=!1,i.display=!0,i["display-inside"]=!0,i["display-list"]=!0,i["display-outside"]=!0,i["dominant-baseline"]=!1,i.elevation=!1,i["empty-cells"]=!1,i.filter=!1,i.flex=!1,i["flex-basis"]=!1,i["flex-direction"]=!1,i["flex-flow"]=!1,i["flex-grow"]=!1,i["flex-shrink"]=!1,i["flex-wrap"]=!1,i.float=!1,i["float-offset"]=!1,i["flood-color"]=!1,i["flood-opacity"]=!1,i["flow-from"]=!1,i["flow-into"]=!1,i.font=!0,i["font-family"]=!0,i["font-feature-settings"]=!0,i["font-kerning"]=!0,i["font-language-override"]=!0,i["font-size"]=!0,i["font-size-adjust"]=!0,i["font-stretch"]=!0,i["font-style"]=!0,i["font-synthesis"]=!0,i["font-variant"]=!0,i["font-variant-alternates"]=!0,i["font-variant-caps"]=!0,i["font-variant-east-asian"]=!0,i["font-variant-ligatures"]=!0,i["font-variant-numeric"]=!0,i["font-variant-position"]=!0,i["font-weight"]=!0,i.grid=!1,i["grid-area"]=!1,i["grid-auto-columns"]=!1,i["grid-auto-flow"]=!1,i["grid-auto-rows"]=!1,i["grid-column"]=!1,i["grid-column-end"]=!1,i["grid-column-start"]=!1,i["grid-row"]=!1,i["grid-row-end"]=!1,i["grid-row-start"]=!1,i["grid-template"]=!1,i["grid-template-areas"]=!1,i["grid-template-columns"]=!1,i["grid-template-rows"]=!1,i["hanging-punctuation"]=!1,i.height=!0,i.hyphens=!1,i.icon=!1,i["image-orientation"]=!1,i["image-resolution"]=!1,i["ime-mode"]=!1,i["initial-letters"]=!1,i["inline-box-align"]=!1,i["justify-content"]=!1,i["justify-items"]=!1,i["justify-self"]=!1,i.left=!1,i["letter-spacing"]=!0,i["lighting-color"]=!0,i["line-box-contain"]=!1,i["line-break"]=!1,i["line-grid"]=!1,i["line-height"]=!1,i["line-snap"]=!1,i["line-stacking"]=!1,i["line-stacking-ruby"]=!1,i["line-stacking-shift"]=!1,i["line-stacking-strategy"]=!1,i["list-style"]=!0,i["list-style-image"]=!0,i["list-style-position"]=!0,i["list-style-type"]=!0,i.margin=!0,i["margin-bottom"]=!0,i["margin-left"]=!0,i["margin-right"]=!0,i["margin-top"]=!0,i["marker-offset"]=!1,i["marker-side"]=!1,i.marks=!1,i.mask=!1,i["mask-box"]=!1,i["mask-box-outset"]=!1,i["mask-box-repeat"]=!1,i["mask-box-slice"]=!1,i["mask-box-source"]=!1,i["mask-box-width"]=!1,i["mask-clip"]=!1,i["mask-image"]=!1,i["mask-origin"]=!1,i["mask-position"]=!1,i["mask-repeat"]=!1,i["mask-size"]=!1,i["mask-source-type"]=!1,i["mask-type"]=!1,i["max-height"]=!0,i["max-lines"]=!1,i["max-width"]=!0,i["min-height"]=!0,i["min-width"]=!0,i["move-to"]=!1,i["nav-down"]=!1,i["nav-index"]=!1,i["nav-left"]=!1,i["nav-right"]=!1,i["nav-up"]=!1,i["object-fit"]=!1,i["object-position"]=!1,i.opacity=!1,i.order=!1,i.orphans=!1,i.outline=!1,i["outline-color"]=!1,i["outline-offset"]=!1,i["outline-style"]=!1,i["outline-width"]=!1,i.overflow=!1,i["overflow-wrap"]=!1,i["overflow-x"]=!1,i["overflow-y"]=!1,i.padding=!0,i["padding-bottom"]=!0,i["padding-left"]=!0,i["padding-right"]=!0,i["padding-top"]=!0,i.page=!1,i["page-break-after"]=!1,i["page-break-before"]=!1,i["page-break-inside"]=!1,i["page-policy"]=!1,i.pause=!1,i["pause-after"]=!1,i["pause-before"]=!1,i.perspective=!1,i["perspective-origin"]=!1,i.pitch=!1,i["pitch-range"]=!1,i["play-during"]=!1,i.position=!1,i["presentation-level"]=!1,i.quotes=!1,i["region-fragment"]=!1,i.resize=!1,i.rest=!1,i["rest-after"]=!1,i["rest-before"]=!1,i.richness=!1,i.right=!1,i.rotation=!1,i["rotation-point"]=!1,i["ruby-align"]=!1,i["ruby-merge"]=!1,i["ruby-position"]=!1,i["shape-image-threshold"]=!1,i["shape-outside"]=!1,i["shape-margin"]=!1,i.size=!1,i.speak=!1,i["speak-as"]=!1,i["speak-header"]=!1,i["speak-numeral"]=!1,i["speak-punctuation"]=!1,i["speech-rate"]=!1,i.stress=!1,i["string-set"]=!1,i["tab-size"]=!1,i["table-layout"]=!1,i["text-align"]=!0,i["text-align-last"]=!0,i["text-combine-upright"]=!0,i["text-decoration"]=!0,i["text-decoration-color"]=!0,i["text-decoration-line"]=!0,i["text-decoration-skip"]=!0,i["text-decoration-style"]=!0,i["text-emphasis"]=!0,i["text-emphasis-color"]=!0,i["text-emphasis-position"]=!0,i["text-emphasis-style"]=!0,i["text-height"]=!0,i["text-indent"]=!0,i["text-justify"]=!0,i["text-orientation"]=!0,i["text-overflow"]=!0,i["text-shadow"]=!0,i["text-space-collapse"]=!0,i["text-transform"]=!0,i["text-underline-position"]=!0,i["text-wrap"]=!0,i.top=!1,i.transform=!1,i["transform-origin"]=!1,i["transform-style"]=!1,i.transition=!1,i["transition-delay"]=!1,i["transition-duration"]=!1,i["transition-property"]=!1,i["transition-timing-function"]=!1,i["unicode-bidi"]=!1,i["vertical-align"]=!1,i.visibility=!1,i["voice-balance"]=!1,i["voice-duration"]=!1,i["voice-family"]=!1,i["voice-pitch"]=!1,i["voice-range"]=!1,i["voice-rate"]=!1,i["voice-stress"]=!1,i["voice-volume"]=!1,i.volume=!1,i["white-space"]=!1,i.widows=!1,i.width=!0,i["will-change"]=!1,i["word-break"]=!0,i["word-spacing"]=!0,i["word-wrap"]=!0,i["wrap-flow"]=!1,i["wrap-through"]=!1,i["writing-mode"]=!1,i["z-index"]=!1,i}function px(i,e,t){}function vx(i,e,t){}var gx=/javascript\s*\:/img;function mx(i,e){return gx.test(e)?"":e}Wn.whiteList=gc(),Wn.getDefaultWhiteList=gc,Wn.onAttr=px,Wn.onIgnoreAttr=vx,Wn.safeAttrValue=mx;var yx={indexOf:function(i,e){var t,r;if(Array.prototype.indexOf)return i.indexOf(e);for(t=0,r=i.length;t<r;t++)if(i[t]===e)return t;return-1},forEach:function(i,e,t){var r,n;if(Array.prototype.forEach)return i.forEach(e,t);for(r=0,n=i.length;r<n;r++)e.call(t,i[r],r,i)},trim:function(i){return String.prototype.trim?i.trim():i.replace(/(^\s*)|(\s*$)/g,"")},trimRight:function(i){return String.prototype.trimRight?i.trimRight():i.replace(/(\s*$)/g,"")}},Di=yx;function Sx(i,e){i=Di.trimRight(i),i[i.length-1]!==";"&&(i+=";");var t=i.length,r=!1,n=0,s=0,c="";function l(){if(!r){var v=Di.trim(i.slice(n,s)),u=v.indexOf(":");if(u!==-1){var y=Di.trim(v.slice(0,u)),T=Di.trim(v.slice(u+1));if(y){var w=e(n,c.length,y,T,v);w&&(c+=w+"; ")}}}n=s+1}for(;s<t;s++){var f=i[s];if(f==="/"&&i[s+1]==="*"){var h=i.indexOf("*/",s+2);if(h===-1)break;s=h+1,n=s+1,r=!1}else f==="("?r=!0:f===")"?r=!1:f===";"?r||l():f===`
566
+ `||d===" "||d==="\f"||d==="\r"}function I(d,g){var p=[];if(d=S(p,""+d,g),d!=="")throw new Error("Unmatched selector: "+d);return p}function S(d,g,p){var x=[],E=!1;function R(){var ft=g.match(r);if(!ft)throw new Error("Expected name, found "+g);var mt=ft[0];return g=g.substr(mt.length),T(mt)}function D(ft){for(;w(g.charAt(ft));)ft++;g=g.substr(ft)}function U(ft){for(var mt=0;g.charAt(--ft)==="\\";)mt++;return(mt&1)===1}for(D(0);g!=="";){var M=g.charAt(0);if(w(M))E=!0,D(1);else if(M in l)x.push({type:l[M]}),E=!1,D(1);else if(M===","){if(x.length===0)throw new Error("Empty sub-selector");d.push(x),x=[],E=!1,D(1)}else if(E&&(x.length>0&&x.push({type:"descendant"}),E=!1),M==="*")g=g.substr(1),x.push({type:"universal"});else if(M in f){var W=f[M],X=W[0],B=W[1];g=g.substr(1),x.push({type:"attribute",name:X,action:B,value:R(),ignoreCase:!1})}else if(M==="["){g=g.substr(1);var N=g.match(s);if(!N)throw new Error("Malformed attribute selector: "+g);g=g.substr(N[0].length);var $=T(N[1]);(!p||("lowerCaseAttributeNames"in p?p.lowerCaseAttributeNames:!p.xmlMode))&&($=$.toLowerCase()),x.push({type:"attribute",name:$,action:c[N[2]],value:T(N[4]||N[5]||""),ignoreCase:!!N[6]})}else if(M===":"){if(g.charAt(1)===":"){g=g.substr(2),x.push({type:"pseudo-element",name:R().toLowerCase()});continue}g=g.substr(1);var J=R().toLowerCase(),N=null;if(g.charAt(0)==="(")if(h.has(J)){var tt=g.charAt(1),at=u.has(tt);if(g=g.substr(at?2:1),N=[],g=S(N,g,p),at){if(g.charAt(0)!==tt)throw new Error("Unmatched quotes in :"+J);g=g.substr(1)}if(g.charAt(0)!==")")throw new Error("Missing closing parenthesis in :"+J+" ("+g+")");g=g.substr(1)}else{for(var ut=1,V=1;V>0&&ut<g.length;ut++)g.charAt(ut)==="("&&!U(ut)?V++:g.charAt(ut)===")"&&!U(ut)&&V--;if(V)throw new Error("Parenthesis not matched");if(N=g.substr(1,ut-2),g=g.substr(ut),v.has(J)){var tt=N.charAt(0);tt===N.slice(-1)&&u.has(tt)&&(N=N.slice(1,-1)),N=T(N)}}x.push({type:"pseudo",name:J,data:N})}else if(r.test(g)){var Q=R();(!p||("lowerCaseTags"in p?p.lowerCaseTags:!p.xmlMode))&&(Q=Q.toLowerCase()),x.push({type:"tag",name:Q})}else return x.length&&x[x.length-1].type==="descendant"&&x.pop(),O(d,x),g}return O(d,x),g}function O(d,g){if(d.length>0&&g.length===0)throw new Error("Empty sub-selector");d.push(g)}},function(i,e,t){Object.defineProperty(e,"__esModule",{value:!0});var r={equals:"",element:"~",start:"^",end:"$",any:"*",not:"!",hyphen:"|"};function n(f){return f.map(s).join(", ")}e.default=n;function s(f){return f.map(c).join("")}function c(f){switch(f.type){case"child":return" > ";case"parent":return" < ";case"sibling":return" ~ ";case"adjacent":return" + ";case"descendant":return" ";case"universal":return"*";case"tag":return f.name;case"pseudo-element":return"::"+f.name;case"pseudo":return f.data===null?":"+f.name:typeof f.data=="string"?":"+f.name+"("+f.data+")":":"+f.name+"("+n(f.data)+")";case"attribute":return f.action==="exists"?"["+f.name+"]":f.name==="id"&&f.action==="equals"&&!f.ignoreCase?"#"+f.value:f.name==="class"&&f.action==="element"&&!f.ignoreCase?"."+f.value:"["+f.name+r[f.action]+"='"+f.value+"'"+(f.ignoreCase?"i":"")+"]";default:throw new Error("Unknown type")}}function l(f){return f}},function(i,e,t){i.exports=s;var r=t(279),n={__proto__:null,exists:10,equals:8,not:7,start:6,end:6,any:5,hyphen:4,element:4};function s(l){for(var f=l.map(c),h=1;h<l.length;h++){var v=f[h];if(!(v<0))for(var u=h-1;u>=0&&v<f[u];u--){var y=l[u+1];l[u+1]=l[u],l[u]=y,f[u+1]=f[u],f[u]=v}}}function c(l){var f=r[l.type];if(f===r.attribute)f=n[l.action],f===n.equals&&l.name==="id"&&(f=9),l.ignoreCase&&(f>>=1);else if(f===r.pseudo)if(!l.data)f=3;else if(l.name==="has"||l.name==="contains")f=0;else if(l.name==="matches"||l.name==="not"){f=0;for(var h=0;h<l.data.length;h++)if(l.data[h].length===1){var v=c(l.data[h][0]);if(v===0){f=0;break}v>f&&(f=v)}l.data.length>1&&f>0&&(f-=1)}else f=1;return f}},function(i){i.exports=JSON.parse('{"universal":50,"tag":30,"attribute":1,"pseudo":0,"descendant":-1,"child":-1,"parent":-1,"sibling":-1,"adjacent":-1}')},function(i,e,t){var r=t(281),n=t(282);i.exports={__proto__:null,attribute:r.compile,pseudo:n.compile,tag:function(s,c,l){var f=c.name,h=l.adapter;return function(u){return h.getName(u)===f&&s(u)}},descendant:function(s,c,l){var f=typeof WeakSet<"u"?new WeakSet:null,h=l.adapter;return function(u){for(var y=!1;!y&&(u=h.getParent(u));)(!f||!f.has(u))&&(y=s(u),!y&&f&&f.add(u));return y}},_flexibleDescendant:function(s,c,l){var f=l.adapter;return function(v){for(var u=s(v);!u&&(v=f.getParent(v));)u=s(v);return u}},parent:function(s,c,l){if(l&&l.strict)throw new Error("Parent selector isn't part of CSS3");var f=l.adapter;return function(u){return f.getChildren(u).some(h)};function h(v){return f.isTag(v)&&s(v)}},child:function(s,c,l){var f=l.adapter;return function(v){var u=f.getParent(v);return!!u&&s(u)}},sibling:function(s,c,l){var f=l.adapter;return function(v){for(var u=f.getSiblings(v),y=0;y<u.length;y++)if(f.isTag(u[y])){if(u[y]===v)break;if(s(u[y]))return!0}return!1}},adjacent:function(s,c,l){var f=l.adapter;return function(v){for(var u=f.getSiblings(v),y,T=0;T<u.length;T++)if(f.isTag(u[T])){if(u[T]===v)break;y=u[T]}return!!y&&s(y)}},universal:function(s){return s}}},function(i,e,t){var r=t(273).falseFunc,n=/[-[\]{}()*+?.,\\^$|#\s]/g,s={__proto__:null,equals:function(c,l,f){var h=l.name,v=l.value,u=f.adapter;return l.ignoreCase?(v=v.toLowerCase(),function(T){var w=u.getAttributeValue(T,h);return w!=null&&w.toLowerCase()===v&&c(T)}):function(T){return u.getAttributeValue(T,h)===v&&c(T)}},hyphen:function(c,l,f){var h=l.name,v=l.value,u=v.length,y=f.adapter;return l.ignoreCase?(v=v.toLowerCase(),function(w){var I=y.getAttributeValue(w,h);return I!=null&&(I.length===u||I.charAt(u)==="-")&&I.substr(0,u).toLowerCase()===v&&c(w)}):function(w){var I=y.getAttributeValue(w,h);return I!=null&&I.substr(0,u)===v&&(I.length===u||I.charAt(u)==="-")&&c(w)}},element:function(c,l,f){var h=l.name,v=l.value,u=f.adapter;if(/\s/.test(v))return r;v=v.replace(n,"\\$&");var y="(?:^|\\s)"+v+"(?:$|\\s)",T=l.ignoreCase?"i":"",w=new RegExp(y,T);return function(S){var O=u.getAttributeValue(S,h);return O!=null&&w.test(O)&&c(S)}},exists:function(c,l,f){var h=l.name,v=f.adapter;return function(y){return v.hasAttrib(y,h)&&c(y)}},start:function(c,l,f){var h=l.name,v=l.value,u=v.length,y=f.adapter;return u===0?r:l.ignoreCase?(v=v.toLowerCase(),function(w){var I=y.getAttributeValue(w,h);return I!=null&&I.substr(0,u).toLowerCase()===v&&c(w)}):function(w){var I=y.getAttributeValue(w,h);return I!=null&&I.substr(0,u)===v&&c(w)}},end:function(c,l,f){var h=l.name,v=l.value,u=-v.length,y=f.adapter;return u===0?r:l.ignoreCase?(v=v.toLowerCase(),function(w){var I=y.getAttributeValue(w,h);return I!=null&&I.substr(u).toLowerCase()===v&&c(w)}):function(w){var I=y.getAttributeValue(w,h);return I!=null&&I.substr(u)===v&&c(w)}},any:function(c,l,f){var h=l.name,v=l.value,u=f.adapter;if(v==="")return r;if(l.ignoreCase){var y=new RegExp(v.replace(n,"\\$&"),"i");return function(w){var I=u.getAttributeValue(w,h);return I!=null&&y.test(I)&&c(w)}}return function(w){var I=u.getAttributeValue(w,h);return I!=null&&I.indexOf(v)>=0&&c(w)}},not:function(c,l,f){var h=l.name,v=l.value,u=f.adapter;return v===""?function(T){return!!u.getAttributeValue(T,h)&&c(T)}:l.ignoreCase?(v=v.toLowerCase(),function(T){var w=u.getAttributeValue(T,h);return w!=null&&w.toLowerCase()!==v&&c(T)}):function(T){return u.getAttributeValue(T,h)!==v&&c(T)}}};i.exports={compile:function(c,l,f){if(f&&f.strict&&(l.ignoreCase||l.action==="not"))throw new Error("Unsupported attribute selector");return s[l.action](c,l,f)},rules:s}},function(i,e,t){var r=t(283),n=t(273),s=t(281),c=n.trueFunc,l=n.falseFunc,f=s.rules.equals;function h(O,d){var g={name:O,value:d};return function(x,E,R){return f(x,g,R)}}function v(O,d){return function(g){return!!d.getParent(g)&&O(g)}}var u={contains:function(O,d,g){var p=g.adapter;return function(E){return O(E)&&p.getText(E).indexOf(d)>=0}},icontains:function(O,d,g){var p=d.toLowerCase(),x=g.adapter;return function(R){return O(R)&&x.getText(R).toLowerCase().indexOf(p)>=0}},"nth-child":function(O,d,g){var p=r(d),x=g.adapter;return p===l?p:p===c?v(O,x):function(R){for(var D=x.getSiblings(R),U=0,M=0;U<D.length;U++)if(x.isTag(D[U])){if(D[U]===R)break;M++}return p(M)&&O(R)}},"nth-last-child":function(O,d,g){var p=r(d),x=g.adapter;return p===l?p:p===c?v(O,x):function(R){for(var D=x.getSiblings(R),U=0,M=D.length-1;M>=0;M--)if(x.isTag(D[M])){if(D[M]===R)break;U++}return p(U)&&O(R)}},"nth-of-type":function(O,d,g){var p=r(d),x=g.adapter;return p===l?p:p===c?v(O,x):function(R){for(var D=x.getSiblings(R),U=0,M=0;M<D.length;M++)if(x.isTag(D[M])){if(D[M]===R)break;x.getName(D[M])===x.getName(R)&&U++}return p(U)&&O(R)}},"nth-last-of-type":function(O,d,g){var p=r(d),x=g.adapter;return p===l?p:p===c?v(O,x):function(R){for(var D=x.getSiblings(R),U=0,M=D.length-1;M>=0;M--)if(x.isTag(D[M])){if(D[M]===R)break;x.getName(D[M])===x.getName(R)&&U++}return p(U)&&O(R)}},root:function(O,d,g){var p=g.adapter;return function(x){return!p.getParent(x)&&O(x)}},scope:function(O,d,g,p){var x=g.adapter;if(!p||p.length===0)return u.root(O,d,g);function E(R,D){return typeof x.equals=="function"?x.equals(R,D):R===D}return p.length===1?function(R){return E(p[0],R)&&O(R)}:function(R){return p.indexOf(R)>=0&&O(R)}},checkbox:h("type","checkbox"),file:h("type","file"),password:h("type","password"),radio:h("type","radio"),reset:h("type","reset"),image:h("type","image"),submit:h("type","submit"),hover:function(O,d,g){var p=g.adapter;return typeof p.isHovered=="function"?function(E){return O(E)&&p.isHovered(E)}:l},visited:function(O,d,g){var p=g.adapter;return typeof p.isVisited=="function"?function(E){return O(E)&&p.isVisited(E)}:l},active:function(O,d,g){var p=g.adapter;return typeof p.isActive=="function"?function(E){return O(E)&&p.isActive(E)}:l}};function y(O,d){for(var g=0;O&&g<O.length;g++)if(d.isTag(O[g]))return O[g]}var T={empty:function(O,d){return!d.getChildren(O).some(function(g){return d.isTag(g)||g.type==="text"})},"first-child":function(O,d){return y(d.getSiblings(O),d)===O},"last-child":function(O,d){for(var g=d.getSiblings(O),p=g.length-1;p>=0;p--){if(g[p]===O)return!0;if(d.isTag(g[p]))break}return!1},"first-of-type":function(O,d){for(var g=d.getSiblings(O),p=0;p<g.length;p++)if(d.isTag(g[p])){if(g[p]===O)return!0;if(d.getName(g[p])===d.getName(O))break}return!1},"last-of-type":function(O,d){for(var g=d.getSiblings(O),p=g.length-1;p>=0;p--)if(d.isTag(g[p])){if(g[p]===O)return!0;if(d.getName(g[p])===d.getName(O))break}return!1},"only-of-type":function(O,d){for(var g=d.getSiblings(O),p=0,x=g.length;p<x;p++)if(d.isTag(g[p])){if(g[p]===O)continue;if(d.getName(g[p])===d.getName(O))return!1}return!0},"only-child":function(O,d){for(var g=d.getSiblings(O),p=0;p<g.length;p++)if(d.isTag(g[p])&&g[p]!==O)return!1;return!0},link:function(O,d){return d.hasAttrib(O,"href")},selected:function(O,d){if(d.hasAttrib(O,"selected"))return!0;if(d.getName(O)!=="option")return!1;var g=d.getParent(O);if(!g||d.getName(g)!=="select"||d.hasAttrib(g,"multiple"))return!1;for(var p=d.getChildren(g),x=!1,E=0;E<p.length;E++)if(d.isTag(p[E]))if(p[E]===O)x=!0;else if(x){if(d.hasAttrib(p[E],"selected"))return!1}else return!1;return x},disabled:function(O,d){return d.hasAttrib(O,"disabled")},enabled:function(O,d){return!d.hasAttrib(O,"disabled")},checked:function(O,d){return d.hasAttrib(O,"checked")||T.selected(O,d)},required:function(O,d){return d.hasAttrib(O,"required")},optional:function(O,d){return!d.hasAttrib(O,"required")},parent:function(O,d){return!T.empty(O,d)},header:w(["h1","h2","h3","h4","h5","h6"]),button:function(O,d){var g=d.getName(O);return g==="button"||g==="input"&&d.getAttributeValue(O,"type")==="button"},input:w(["input","textarea","select","button"]),text:function(O,d){var g;return d.getName(O)==="input"&&(!(g=d.getAttributeValue(O,"type"))||g.toLowerCase()==="text")}};function w(O){if(typeof Set<"u"){var d=new Set(O);return function(g,p){return d.has(p.getName(g))}}return function(g,p){return O.indexOf(p.getName(g))>=0}}function I(O,d,g){if(g===null){if(O.length>2&&d!=="scope")throw new Error("pseudo-selector :"+d+" requires an argument")}else if(O.length===2)throw new Error("pseudo-selector :"+d+" doesn't have any arguments")}var S=/^(?:(?:nth|last|first|only)-(?:child|of-type)|root|empty|(?:en|dis)abled|checked|not)$/;i.exports={compile:function(O,d,g,p){var x=d.name,E=d.data,R=g.adapter;if(g&&g.strict&&!S.test(x))throw new Error(":"+x+" isn't part of CSS3");if(typeof u[x]=="function")return u[x](O,E,g,p);if(typeof T[x]=="function"){var D=T[x];return I(D,x,E),D===l?D:O===c?function(M){return D(M,R,E)}:function(M){return D(M,R,E)&&O(M)}}else throw new Error("unmatched pseudo-class :"+x)},filters:u,pseudos:T}},function(i,e,t){var r=t(284),n=t(285);i.exports=function(c){return n(r(c))},i.exports.parse=r,i.exports.compile=n},function(i,e){i.exports=r;var t=/^([+\-]?\d*n)?\s*(?:([+\-]?)\s*(\d+))?$/;function r(n){if(n=n.trim().toLowerCase(),n==="even")return[2,0];if(n==="odd")return[2,1];var s=n.match(t);if(!s)throw new SyntaxError("n-th rule couldn't be parsed ('"+n+"')");var c;return s[1]?(c=parseInt(s[1],10),isNaN(c)&&(s[1].charAt(0)==="-"?c=-1:c=1)):c=0,[c,s[3]?parseInt((s[2]||"")+s[3],10):0]}},function(i,e,t){i.exports=c;var r=t(273),n=r.trueFunc,s=r.falseFunc;function c(l){var f=l[0],h=l[1]-1;if(h<0&&f<=0)return s;if(f===-1)return function(u){return u<=h};if(f===0)return function(u){return u===h};if(f===1)return h<0?n:function(u){return u>=h};var v=h%f;return v<0&&(v+=f),f>1?function(u){return u>=h&&u%f===v}:(f*=-1,function(u){return u<=h&&u%f===v})}},function(i,e,t){t.r(e),t.d(e,"default",function(){return E});var r=t(12),n=t(74),s=t(1),c=t(68),l=t(250),f=t(213),h=t(218);t(1).glMatrix.setMatrixArrayType(Array);function v(R,D){if(R==null)return{};var U=u(R,D),M,W;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(R);for(W=0;W<X.length;W++)M=X[W],!(D.indexOf(M)>=0)&&Object.prototype.propertyIsEnumerable.call(R,M)&&(U[M]=R[M])}return U}function u(R,D){if(R==null)return{};var U={},M=Object.keys(R),W,X;for(X=0;X<M.length;X++)W=M[X],!(D.indexOf(W)>=0)&&(U[W]=R[W]);return U}const y={antialias:!0,autoRender:!0,alpha:!0},T=Symbol("autoRender"),w=Symbol("renderer"),I=Symbol("timeline"),S=Symbol("prepareRender"),O=Symbol("tickRender"),d=Symbol("pass"),g=Symbol("fbo"),p=Symbol("tickers"),x=Symbol("layerTransformInvert");class E extends l.default{constructor(D={}){if(super(),!D.canvas){const{width:X,height:B}=this.getResolution(),N=r.ENV.createCanvas(X,B,{offscreen:!!D.offscreen,id:D.id,extra:D.extra});N.style&&(N.style.position="absolute"),N.dataset&&(N.dataset.layerId=D.id),N.contextType&&(D.contextType=N.contextType),D.canvas=N}const U=D.canvas,M=Object.assign({},y,D);this[T]=M.autoRender,delete D.autoRender;const W=M.Renderer||r.Renderer;this[w]=new W(U,M),this.options=D,this.id=D.id,this[d]=[],this.setResolution(U),this.canvas=U,this[I]=new n.Timeline,this.__mouseCapturedTarget=null,this[x]=null}get autoRender(){return this[T]}get displayRatio(){return this.parent&&this.parent.options?this.parent.options.displayRatio:1}get height(){const{height:D}=this.getResolution();return D/this.displayRatio}get gl(){return this.renderer.glRenderer?this.renderer.glRenderer.gl:null}get layer(){return this}get offscreen(){return!!this.options.offscreen||this.canvas._offscreen}get pass(){return this[d]}get prepareRender(){return this[S]?this[S]:Promise.resolve()}get renderer(){return this[w]}get renderOffset(){if(this.parent&&this.parent.options){const{left:D,top:U}=this.parent.options;return[D,U]}return[this.options.left|0,this.options.top|0]}get timeline(){return this[I]}get width(){const{width:D}=this.getResolution();return D/this.displayRatio}get localMatrix(){const{x:D,y:U}=this.attributes;return[1,0,0,1,D,U]}get layerTransformInvert(){if(this[x])return this[x];const D=this.transformMatrix;return D[0]===1&&D[1]===0&&D[2]===0&&D[3]===1&&D[4]===0&&D[5]===0?null:(this[x]=s.mat2d.invert(Array.of(0,0,0,0,0,0),D),this[x])}forceContextLoss(){const D=this.renderer.glRenderer;if(D){const U=D.getExtension("WEBGL_lose_context");if(U)return U.loseContext(),!0}return!1}addPass({vertex:D,fragment:U,options:M,uniforms:W}={}){if(this.renderer.glRenderer){const{width:X,height:B}=this.getResolution(),N=this.renderer.createPassProgram({vertex:D,fragment:U,options:M}),$=new r.Figure2D;$.rect(0,0,X/this.displayRatio,B/this.displayRatio);const J=new r.Mesh2D($);return J.setUniforms(W),J.setProgram(N),this[d].push(J),this.forceUpdate(),J}return null}deleteTexture(D){return Object(h.deleteTexture)(D,this.renderer)}dispatchPointerEvent(D){const U=D.type;if(U==="mousedown"||U==="mouseup"||U==="mousemove"){const N=this.__mouseCapturedTarget;if(N){if(N.layer===this)return N.dispatchEvent(D),!0;this.__mouseCapturedTarget=null}}let M,W;const X=this.layerTransformInvert;if(X){M=D.x,W=D.y;const N=X,$=N[0]*M+N[2]*W+N[4],J=N[1]*M+N[3]*W+N[5];delete D.x,delete D.y,delete D.layerX,delete D.layerY,Object.defineProperties(D,{layerX:{value:$,configurable:!0},layerY:{value:J,configurable:!0},x:{value:$,configurable:!0},y:{value:J,configurable:!0}})}const B=super.dispatchPointerEvent(D);return X&&Object.defineProperties(D,{layerX:{value:M,configurable:!0},layerY:{value:W,configurable:!0},x:{value:M,configurable:!0},y:{value:W,configurable:!0}}),B}forceUpdate(){if(!this[S])if(this.parent&&this.parent.hasOffscreenCanvas){this.parent.forceUpdate();let D=null;const U=new Promise(M=>{D=M});U._resolve=D,this[S]=U}else{let D=null,U=null;const M=new Promise(W=>{D=W,this[T]&&(U=Object(c.requestAnimationFrame)(()=>{delete M._requestID,this.render()}))});M._resolve=D,M._requestID=U,this[S]=M}}getFBO(){const D=this.renderer.glRenderer,{width:U,height:M}=this.getResolution();return D&&(!this[g]||this[g].width!==U||this[g].height!==M)?(this[g]={width:U,height:M,target:D.createFBO(),buffer:D.createFBO(),swap(){[this.target,this.buffer]=[this.buffer,this.target]}},this[g]):this[g]?this[g]:null}updateGlobalTransform(){if(this.layerTransformInvert){const D=this.renderer,U=D.__globalTransformMatrix||D.globalTransformMatrix;D.__globalTransformMatrix=U;const M=s.mat2d.fromValues(1,0,0,1,0,0);D.setGlobalTransform(...s.mat2d.multiply(M,U,this.transformMatrix))}}onPropertyChange(D,U,M){if(super.onPropertyChange(D,U,M),D==="zIndex"&&(this.canvas.style.zIndex=U),D==="transform"||D==="translate"||D==="rotate"||D==="scale"||D==="skew"){const W=this[x];if(this[x]=null,this.updateGlobalTransform(),W&&!this.layerTransformInvert){const X=this.renderer,B=X.__globalTransformMatrix||X.globalTransformMatrix;X.setGlobalTransform(...B)}}}_prepareRenderFinished(){this[S]&&(this[S]._requestID&&Object(c.cancelAnimationFrame)(this[S]._requestID),this[S]._resolve(),delete this[S])}render({clear:D=!0}={}){const U=this[d].length?this.getFBO():null;U&&this.renderer.glRenderer.bindFBO(U.target),D&&this[w].clear();const M=this.draw();if(M&&M.length&&(this.renderer.drawMeshes(M),this.canvas.draw&&this.canvas.draw()),U){const W=this.renderer.glRenderer,X=this[d].length,{width:B,height:N}=this.getResolution(),$=[0,0,B/this.displayRatio,N/this.displayRatio];this[d].forEach((J,tt)=>{J.blend=!0,J.setTexture(U.target.texture,{rect:$}),tt===X-1?W.bindFBO(null):(U.swap(),W.bindFBO(U.target)),this[w].clear(),this.renderer.drawMeshes([J])})}this._prepareRenderFinished()}setResolution({width:D,height:U}){const M=this.renderer,W=M.__globalTransformMatrix||M.globalTransformMatrix,X=W[4],B=W[5],N=W[0],{width:$,height:J}=this.getResolution();($!==D||J!==U)&&(super.setResolution({width:D,height:U}),this.canvas&&(this.canvas.width=D,this.canvas.height=U,M.updateResolution&&M.updateResolution()),this.attributes.size=[D,U],this[d].length&&this[d].forEach(V=>{const Q=new r.Figure2D;Q.rect(0,0,D/this.displayRatio,U/this.displayRatio),V.contours=Q.contours}));const[tt,at]=this.renderOffset,ut=this.displayRatio;(X!==tt||B!==at||N!==ut)&&(M.setGlobalTransform(ut,0,0,ut,tt,at),M.__globalTransformMatrix=null,this[x]=null,this.updateGlobalTransform(),this.forceUpdate())}tick(D=null,U={}){let{duration:M=1/0}=U,W=v(U,["duration"]);const X=this.timeline.fork(W),B=this;this[p]=this[p]||[],this[p].push({handler:D,duration:M});const N=()=>{let $=null,J=null;const tt=()=>{const at=this[p].map(({handler:ut,duration:V})=>{const Q=Math.min(1,X.currentTime/V);return{value:ut?ut(X.currentTime,Q):null,p:Q}});B[O]||(B[O]=Promise.resolve().then(()=>{B[T]&&B.render(),delete B[O];for(let ut=at.length-1;ut>=0;ut--){const{value:V,p:Q}=at[ut];(V===!1||Q>=1)&&this[p].splice(ut,1)}this[p].length>0&&N()}))};if(this[S]&&this[S]._type!=="ticker"&&(Object(c.cancelAnimationFrame)(this[S]._requestID),delete this[S]),!this[S]){const at=new Promise(ut=>{$=ut,J=Object(c.requestAnimationFrame)(tt)});at._resolve=$,at._requestID=J,at._type="ticker",this[S]=at}};N()}toGlobalPos(D,U){if(this.layerTransformInvert){const $=this.transformMatrix;D=$[0]*D+$[2]*U+$[4],U=$[1]*D+$[3]*U+$[5]}const{width:M,height:W}=this.getResolution(),X=this.renderOffset,B=[this.canvas.clientWidth,this.canvas.clientHeight];D=D*B[0]/M+X[0],U=U*B[1]/W+X[1];const N=this.displayRatio;return D*=N,U*=N,[D,U]}toLocalPos(D,U){const{width:M,height:W}=this.getResolution(),X=this.renderOffset,B=[this.canvas.clientWidth,this.canvas.clientHeight];D=D*M/B[0]-X[0],U=U*W/B[1]-X[1];const N=this.displayRatio;D/=N,U/=N;const $=this.layerTransformInvert;return $&&(D=$[0]*D+$[2]*U+$[4],U=$[1]*D+$[3]*U+$[5]),[D,U]}}f.default.registerNode(E,"layer")},function(i,e,t){t.r(e),t.d(e,"default",function(){return S});var r=t(224),n=t(288),s=t(213),c=t(252),l=t(72);t(1).glMatrix.setMatrixArrayType(Array);function f(O,d){if(O==null)return{};var g=h(O,d),p,x;if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(O);for(x=0;x<E.length;x++)p=E[x],!(d.indexOf(p)>=0)&&Object.prototype.propertyIsEnumerable.call(O,p)&&(g[p]=O[p])}return g}function h(O,d){if(O==null)return{};var g={},p=Object.keys(O),x,E;for(E=0;E<p.length;E++)x=p[E],!(d.indexOf(x)>=0)&&(g[x]=O[x]);return g}function v(O,d,g){return d in O?Object.defineProperty(O,d,{value:g,enumerable:!0,configurable:!0,writable:!0}):O[d]=g,O}const u="http://www.w3.org/2000/svg",y=Symbol.for("spritejs_setAttribute"),T=Symbol("root"),w=Symbol("task");function I(O,d=!0){const g=O[T];if(g&&g.children[0]){const p=O.svg,x=O.layer?O.layer.displayRatio:1;if(!p.hasAttribute("data-original-width")){let D=p.getAttribute("width");D=D?Object(l.sizeToPixel)(D):300;let U=p.getAttribute("height");U=U?Object(l.sizeToPixel)(U):150,p.hasAttribute("viewBox")||p.setAttribute("viewBox",`0 0 ${Math.round(D)} ${Math.round(U)}`),p.setAttribute("data-original-width",D),p.setAttribute("data-original-height",U)}let E=O.attributes.width||Number(p.getAttribute("data-original-width")),R=O.attributes.height||Number(p.getAttribute("data-original-height"));if(E*=x,R*=x,d&&O.attributes.flexible){const D=O.attributes.scale[0];if(E*=D,R*=D,p.setAttribute("width",E),p.setAttribute("height",R),E&&R&&O.textureImage){const U=O.textureImage.width,M=O.textureImage.height,W=O.clientSize;O.attributes.textureRect=[0,0,Math.round(W[0]*U/E),Math.round(W[1]*M/R)]}}else O[w]||(p.setAttribute("width",E),p.setAttribute("height",R),O[w]=Promise.resolve().then(()=>{delete O[w];const D=g.innerHTML,U=new Blob([D],{type:"image/svg+xml"}),M=URL.createObjectURL(U),W=new Image;W.onload=function(){W.width&&W.height?(O.attributes[y]("texture",W),O.attributes.flexible&&(O.attributes.textureRect=null)):O.attributes[y]("texture",null)},W.src=M}))}}class S extends r.default{constructor(d={}){typeof d=="string"&&(d={svgText:d});let{svgText:g}=d,p=f(d,["svgText"]);if(super(p),this[T]=document.createElement("div"),g){this[T].innerHTML=g;const x=this[T].children[0];x?x.setAttribute("xmlns",u):(fetch(g).then(E=>E.text()).then(E=>{this[T].innerHTML=E,(!this.observer||this.attributes.flexible)&&I(this)}),g=null)}if(!g){const x=document.createElementNS(u,"svg");x.setAttribute("xmlns",u),this[T].appendChild(x)}if(typeof MutationObserver=="function"){const x=new MutationObserver(E=>{I(this,!1)});x.observe(this[T],{attributes:!0,subtree:!0,characterData:!0,childList:!0}),this.observer=x}}get children(){return[this.svg]}get childNodes(){return[this.svg]}get svg(){return this[T]?this[T].children[0]:null}setResolution({width:d,height:g}){super.setResolution({width:d,height:g}),I(this)}dispatchPointerEvent(d){const g=super.dispatchPointerEvent(d);if(g&&this.attributes.passEvents&&typeof MouseEvent=="function"){const{x:p,y:x}=d;let[E,R]=this.getOffsetPosition(p,x);const D=d.originalEvent,U=this.attributes.anchor,M=this.clientSize;E=(E+U[0]*M[0])/2,R=(R+U[1]*M[1])/2;const W=d.type;if(W===D.type){let X=null;if(D instanceof MouseEvent)X=new MouseEvent(W,{screenX:E,screenY:R,clientX:E,clientY:R,bubbles:D.bubbles,button:D.button,buttons:D.buttons,cancelBubble:D.cancelBubble,cancelable:D.cancelable,currentTarget:D.currentTarget,fromElement:D.fromElement,relatedTarget:D.relatedTarget,returnValue:D.returnValue,srcElement:D.srcElement,target:D.target,toElement:D.toElement,which:D.witch});else if(D instanceof TouchEvent){let B=null;const N=D.changedTouches||[D];for(let $=0;$<N.length;$++){const J=N[$];if(d.identifier===J.identifier){B=J;break}}if(B){const $=new Touch({identifier:B.identifier,target:B.target,clientX:E,clientY:R,screenX:E,screenY:R,pageX:E,pageY:R,radiusX:B.radiusX,radiusY:B.radiusY,rotationAngle:B.rotationAngle,force:B.force});X=new TouchEvent(W,{cancelable:D.cancelable,bubbles:D.bubbles,composed:D.composed,touches:[$],targetTouches:[$],changedTouches:[$]})}}else X=D;X&&this.svg.dispatchEvent(X)}}return g}getElementById(d){return Object(c.querySelector)(`#${d}`,this)}getElementsByClassName(d){return Object(c.querySelectorAll)(`.${d}`,this)}getElementsByName(d){return Object(c.querySelectorAll)(`[name="${d}"]`,this)}getElementsByTagName(d){return Object(c.querySelectorAll)(d,this)}querySelector(d){return Object(c.querySelector)(d,this)}querySelectorAll(d){return Object(c.querySelectorAll)(d,this)}onPropertyChange(d,g,p){super.onPropertyChange(d,g,p),d==="flexible"&&I(this),this.attributes.flexible&&(d==="width"||d==="height"||d==="scale"||d==="transform")&&I(this)}}v(S,"Attr",n.default),s.default.registerNode(S,"spritesvg")},function(i,e,t){t.r(e),t.d(e,"default",function(){return l});var r=t(225);t(1).glMatrix.setMatrixArrayType(Array);const n=Symbol.for("spritejs_getAttribute"),s=Symbol.for("spritejs_setAttribute"),c=Symbol.for("spritejs_setAttributeDefault");class l extends r.default{constructor(h){super(h),this[c]({passEvents:!1,flexible:!1})}get texture(){return this[n]("texture")}set texture(h){}get passEvents(){return this[n]("passEvents")}set passEvents(h){return this[s]("passEvents",h)}get flexible(){return this[n]("flexible")}set flexible(h){return this[s]("flexible",h)}}},function(i,e,t){t.r(e);var r=t(12);t(1).glMatrix.setMatrixArrayType(Array);function n(h,v){var u=Object.keys(h);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(h);v&&(y=y.filter(function(T){return Object.getOwnPropertyDescriptor(h,T).enumerable})),u.push.apply(u,y)}return u}function s(h){for(var v=1;v<arguments.length;v++){var u=arguments[v]!=null?arguments[v]:{};v%2?n(Object(u),!0).forEach(function(y){c(h,y,u[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(u)):n(Object(u)).forEach(function(y){Object.defineProperty(h,y,Object.getOwnPropertyDescriptor(u,y))})}return h}function c(h,v,u){return v in h?Object.defineProperty(h,v,{value:u,enumerable:!0,configurable:!0,writable:!0}):h[v]=u,h}const l=Symbol("inited");let f=null;typeof Worker=="function"&&(f=class extends Worker{constructor(h){if(h.worker===!0&&(h.worker=`./${h.id}.worker.js`),super(h.worker),this.options=h,!h.canvas){const{width:v,height:u}=this.getResolution(),y=r.ENV.createCanvas(v,u,{offscreen:!1});y.style&&(y.style.position="absolute"),y.dataset&&(y.dataset.layerId=h.id),h.canvas=y}this.canvas=h.canvas}get id(){return this.options.id}setResolution({width:h,height:v}){if(this[l])this.postMessage({type:"resolution_change",width:h,height:v});else{this.canvas.width=h,this.canvas.height=v;const u=this.options,y=u.canvas.transferControlToOffscreen(),T=s({},u);delete T.container,T.canvas=y,this.postMessage({type:"create",options:T},[y]),this[l]=!0}}getResolution(){if(this.canvas){const{width:h,height:v}=this.canvas;return{width:h,height:v}}return{width:300,height:150}}remove(){return this.parent&&this.parent.removeChild?(this.parent.removeChild(this),!0):!1}connect(h,v){Object.defineProperty(this,"parent",{value:h,writable:!1,configurable:!0}),Object.defineProperty(this,"zOrder",{value:v,writable:!1,configurable:!0})}disconnect(){delete this.parent,delete this.zOrder}dispatchPointerEvent(h){this.postMessage({type:"event",event:{cancelBubble:h.cancelBubble,bubbles:h.bubbles,detail:h.detail,identifier:h.identifier,layerX:h.layerX,layerY:h.layerY,originalX:h.originalX,originalY:h.originalY,type:h.type,x:h.x,y:h.y}})}}),e.default=f},function(i,e,t){t.r(e),(function(r){t.d(e,"default",function(){return E});var n=t(12),s=t(68),c=t(70),l=t(286),f=t(289),h=t(250),v=t(291),u=t(214),y=t(218),T=t(213);t(1).glMatrix.setMatrixArrayType(Array);const w=Symbol("enteredTargets");function I(R){return R.id=R.id||`_layer${Math.random().toString(36).slice(2,12)}`,R.dataset||(R.dataset={}),R.dataset.layerId=R.id,R.connect=(D,U)=>{R.parent=D,Object.defineProperty(R,"zOrder",{value:U,writable:!1,configurable:!0})},R.disconnect=D=>{delete R.zOrder},R.canvas=R,R.getResolution=()=>({width:0,height:0}),R.setResolution=()=>!1,R.options={handleEvent:!1},R}function S(R,D){const U=R.children;let M=null;for(let W=0;W<U.length;W++){const X=U[W];if((D===X||M!=null)&&(M=X),M&&M!==D&&!M.offscreen)return M.canvas}return null}function O(R,D){const[U,M]=R.renderOffset,{width:W,height:X}=R.getResolution(),B=R.displayRatio;R.renderer.drawImage(D.canvas,-U/B,-M/B,W/B,X/B)}const d={};function g(R){const D=["mousedown","mouseup","mousemove","mousewheel","wheel","touchstart","touchend","touchmove","touchcancel","click","dblclick","longpress","tap","contextmenu"],U=R.container;U.addEventListener("mouseleave",M=>{const W=R[w];if(W.size){const X=new u.default("mouseleave");X.setOriginalEvent(M),[...W].forEach(B=>{B.dispatchEvent(X)}),R[w].clear()}},{passive:!0}),D.forEach(M=>{U.addEventListener(M,W=>{const{left:X,top:B,displayRatio:N}=R.options,$=R.orderedChildren;Object(v.default)(W,{offsetLeft:X,offsetTop:B,displayRatio:N}).forEach(tt=>{const at=tt.identifier;if(tt.type==="touchmove"||tt.type==="touchend"){const V=d[at];V&&V.dispatchEvent(tt),tt.type==="touchend"&&delete d[at]}else{for(let V=$.length-1;V>=0;V--){const Q=$[V];if(Q.options.handleEvent!==!1){if(Q.dispatchPointerEvent(tt)&&tt.target!==Q)break;tt.cancelBubble=!1}}if(tt.target===$[0])for(let V=$.length-1;V>=0;V--){const Q=$[V];if(Q.options.handleEvent!==!1){tt.target=Q;break}}}const ut=tt.target;if(tt.type==="touchstart"&&(d[at]=tt.target),tt.type==="mousemove"){const V=R[w];let Q;if(ut){const yt=ut.ancestors||[];Q=new Set([ut,...yt])}else Q=new Set;const ft=Object.entries(W);if(!V.has(ut)&&ut){const yt=new u.default("mouseenter");yt.setOriginalEvent(W),ft.forEach(([ht,Nt])=>{yt[ht]=Nt}),V.add(ut),ut.dispatchEvent(yt);const wt=ut.ancestors;wt&&wt.forEach(ht=>{ht instanceof c.default&&!V.has(ht)&&(V.add(ht),ht.dispatchEvent(yt))})}const mt=new u.default("mouseleave");mt.setOriginalEvent(W),ft.forEach(([yt,wt])=>{mt[yt]=wt}),[...V].forEach(yt=>{Q.has(yt)||(V.delete(yt),yt.dispatchEvent(mt))})}})},{passive:M!=="contextmenu"})})}function p(R,D){if(D&&D.style){let{width:U,height:M,mode:W,container:X}=R;const{clientWidth:B,clientHeight:N}=X;U=U||B,M=M||N,W==="static"?(D.style.width=`${U}px`,D.style.height=`${M}px`):(D.style.top="0",D.style.left="0",D.style.width=`${B}px`,D.style.height=`${N}px`,D.style.transform="",D.style.webkitTransform="")}}const x=Symbol("offscreenLayerCount");class E extends h.default{constructor(D={}){if(super(),!D.container)if(typeof n.ENV.Container=="function")D.container=new n.ENV.Container(D.width||300,D.height||150);else throw new Error("No container specified.");if(this.container=D.container,this.container.style&&(this.container.style.overflow||(this.container.style.overflow="hidden"),this.container.style.position||(this.container.style.position="relative")),this.options=D,D.displayRatio=D.displayRatio||1,D.mode=D.mode||"scale",D.left=0,D.top=0,D.autoResize=D.autoResize!==!1,D.autoResize){let U;if(typeof globalThis<"u"?U=globalThis:U=typeof window<"u"?window:r,U.addEventListener){const M=this;U.addEventListener("resize",function W(){typeof document<"u"&&document.contains(M.container)?M.resize():U.removeEventListener("resize",W)})}}this[w]=new Set,this.setResolution(D),g(this),this[x]=0}get hasOffscreenCanvas(){return this[x]>0}set displayRatio(D){this.options.displayRatio!==D&&(this.options.displayRatio=D,this.resize())}get displayRatio(){return this.options.displayRatio}set height(D){this.options.height!==D&&(this.options.height=D,this.resize())}get height(){return this.options.height}set mode(D){this.options.mode!==D&&(this.options.mode=D,this.resize())}get mode(){return this.options.mode}set width(D){this.options.width!==D&&(this.options.width=D,this.resize())}get width(){return this.options.width}appendChild(D){!(D instanceof l.default)&&!(D instanceof f.default)&&I(D);const U=super.appendChild(D),M=D.canvas;return D.offscreen?this[x]++:this.container.appendChild(M),p(this.options,M),D.setResolution(this.getResolution()),U}forceUpdate(){this.hasOffscreenCanvas&&!this._requestID&&(this._requestID=Object(s.requestAnimationFrame)(()=>{delete this._requestID,this.render()}))}insertBefore(D,U){!(D instanceof l.default)&&!(D instanceof f.default)&&I(D);const M=super.insertBefore(D,U),W=D.canvas;if(!D.offscreen){const X=S(this,D);this.container.insertBefore(W,X)}return p(this.options,W),D.setResolution(this.getResolution()),M}layer(D="default",U={}){U=Object.assign({},this.options,U),U.id=D;const M=this.orderedChildren;for(let B=0;B<M.length;B++)if(M[B].id===D)return M[B];const W=U.worker;let X;return W?X=new f.default(U):X=new l.default(U),this.appendChild(X),X}async preload(...D){const U=[],M=[],W=[];for(let X=0;X<D.length;X++){const B=D[X];let N;if(typeof B=="string")N=Object(y.loadTexture)(B);else if(Array.isArray(B))N=Object(y.loadFrames)(...B);else{const{id:$,src:J}=B;N=Object(y.loadTexture)(J,$)}N instanceof Promise||(N=Promise.resolve(N)),M.push(N.then($=>{U.push($),W[X]=$;const J=new u.default({type:"preload",detail:{current:$,loaded:U,resources:D}});this.dispatchEvent(J)}))}return await Promise.all(M),W}removeChild(D){const U=super.removeChild(D);if(U){D._prepareRenderFinished&&D._prepareRenderFinished();const M=D.canvas;M&&M.remove&&M.remove(),D.offscreen&&this[x]--}return U}render(){const D=this.orderedChildren;let U=null;const M=[];for(let W=0;W<D.length;W++){const X=D[W],B=M.length>0;if(X instanceof l.default&&!X.offscreen)if(!X.autoRender)B&&(console.warn("Some offscreen canvas will not be rendered."),M.length=0);else if(U=X,B){X.renderer.clear();for(let N=0;N<M.length;N++){const $=M[N];$.render(),O(X,$)}M.length=0,X.render({clear:!1})}else X.prepareRender&&X.render();else X.offscreen?U?(X.prepareRender&&X.render(),O(U,X)):M.push(X):X instanceof f.default&&B&&(console.warn("Some offscreen canvas will not be rendered."),M.length=0)}}replaceChild(D,U){const M=super.replaceChild(D,U);U.canvas.remove&&U.canvas.remove(),U.offscreen&&this[x]--;const W=D.canvas;if(!D.offscreen){const X=S(this,D);this.container.insertBefore(W,X)}return p(this.options,W),D.setResolution(this.getResolution()),M}resize(){const D=this.options;this.children.forEach(U=>{p(D,U.canvas)}),this.setResolution(D),this.dispatchEvent({type:"resize"})}setResolution({width:D,height:U}={}){const M=this.container,{clientWidth:W,clientHeight:X}=M;(D==null||U==null)&&(D=D??W,U=U??X);const{mode:B,displayRatio:N}=this.options;if(D*=N,U*=N,this.options.left=0,this.options.top=0,B==="stickyHeight"||B==="stickyLeft"||B==="stickyRight"){const $=D;D=W*U/X,B==="stickyHeight"&&(this.options.left=.5*(D-$)),B==="stickyRight"&&(this.options.left=D-$)}else if(B==="stickyWidth"||B==="stickyTop"||B==="stickyBottom"){const $=U;U=X*D/W,B==="stickyWidth"&&(this.options.top=.5*(U-$)),B==="stickyBottom"&&(this.options.top=U-$)}super.setResolution({width:D,height:U})}snapshot({offscreen:D=!1,layers:U}={}){const M=D?"snapshotOffScreenCanvas":"snapshotCanvas",{width:W,height:X}=this.getResolution();this[M]=this[M]||n.ENV.createCanvas(W,X,{offscreen:D});const B=this[M].getContext("2d");U=U||this.orderedChildren,this[M].width=W,this[M].height=X;for(let N=0;N<U.length;N++){const $=U[N];if(!$.options.ignoreSnapshot){$.render&&$.render();const J=$.canvas;J&&J!==$&&B.drawImage(J,0,0,W,X)}}return this[M]}}typeof document<"u"&&(E.prototype.layer3d=function(R,D={}){const U=D.url||"https://unpkg.com/sprite-extend-3d/dist/sprite-extend-3d.min.js";return new Promise((M,W)=>{const X=document.createElement("script");X.async=!1,X.src=U,X.onload=()=>{try{M(this.layer3d(R,D))}catch(B){W(B)}},document.documentElement.appendChild(X)})}),T.default.registerNode(E,"scene")}).call(this,t(22))},function(i,e,t){t.r(e),t.d(e,"default",function(){return n});var r=t(214);t(1).glMatrix.setMatrixArrayType(Array);function n(s,{offsetTop:c=0,offsetLeft:l=0,displayRatio:f=1}={}){let h,v;const u=[],{left:y,top:T,width:w,height:I}=s.target.getBoundingClientRect(),S=s.target.width,O=s.target.height,d=s.changedTouches||[s];for(let p=0;p<d.length;p++){const x=d[p],E=x.identifier,{clientX:R,clientY:D}=x;R!=null&&D!=null&&u.push({x:Math.round((R|0)-y),y:Math.round((D|0)-T),identifier:E})}u.length<=0&&u.push({x:h,y:v});const g=[];return u.forEach(p=>{p.x!=null&&p.y!=null&&(h=(p.x*S/w-l)/f,v=(p.y*O/I-c)/f);const x=new r.default(s);Object.defineProperties(x,{layerX:{value:h,configurable:!0},layerY:{value:v,configurable:!0},originalX:{value:p.x},originalY:{value:p.y},x:{value:h,configurable:!0},y:{value:v,configurable:!0},identifier:{value:p.identifier}}),g.push(x)}),g}}]);Ie.version,Ie.Arc,Ie.Block,Ie.Cloud,Ie.Color;const tn=Ie.Ellipse;Ie.Gradient;const Je=Ie.Group,fd=Ie.Label,Ao=Ie.Layer;Ie.LayerWorker,Ie.Node,Ie.Parallel;const gn=Ie.Path,en=Ie.Polyline,Eo=Ie.Rect;Ie.Regular,Ie.Ring;const Fl=Ie.Scene,Ul=Ie.Sprite;Ie.SpriteSvg,Ie.Star,Ie.Triangle,Ie.helpers,Ie.createElement,Ie.isSpriteNode,Ie.registerNode,Ie.requestAnimationFrame,Ie.cancelAnimationFrame,Ie.ENV;var Ee=(i=>(i.Normal="Normal",i.Stroke="Stroke",i.Dotted="Dotted",i.LongDotted="LongDotted",i))(Ee||{}),de=(i=>(i.None="None",i.ShowFloatBar="ShowFloatBar",i.ZIndexFloatBar="ZIndexFloatBar",i.DeleteNode="DeleteNode",i.CopyNode="CopyNode",i.ZIndexNode="ZIndexNode",i.ZIndexBackgroundSVG="ZIndexBackgroundSVG",i.RotateNode="RotateNode",i.SetColorNode="SetColorNode",i.TranslateNode="TranslateNode",i.ScaleNode="ScaleNode",i.OriginalEvent="OriginalEvent",i.CreateScene="CreateScene",i.ActiveCursor="ActiveCursor",i.MoveCursor="MoveCursor",i.CommandEditor="CommandEditor",i.SetEditorData="SetEditorData",i.SetFontStyle="SetFontStyle",i.SetPoint="SetPoint",i.SetLock="SetLock",i.SetShapeOpt="SetShapeOpt",i.CameraChange="CameraChange",i.ActiveMethod="ActiveMethod",i.HidFloatBarBtn="HidFloatBarBtn",i))(de||{}),xt=(i=>(i[i.Pencil=1]="Pencil",i[i.Eraser=2]="Eraser",i[i.PencilEraser=3]="PencilEraser",i[i.BitMapEraser=4]="BitMapEraser",i[i.Selector=5]="Selector",i[i.Clicker=6]="Clicker",i[i.Arrow=7]="Arrow",i[i.Hand=8]="Hand",i[i.LaserPen=9]="LaserPen",i[i.Text=10]="Text",i[i.Straight=11]="Straight",i[i.Rectangle=12]="Rectangle",i[i.Ellipse=13]="Ellipse",i[i.Star=14]="Star",i[i.Triangle=15]="Triangle",i[i.Rhombus=16]="Rhombus",i[i.Polygon=17]="Polygon",i[i.SpeechBalloon=18]="SpeechBalloon",i[i.Image=19]="Image",i[i.BackgroundSVG=20]="BackgroundSVG",i))(xt||{}),Kt=(i=>(i[i.Local=1]="Local",i[i.Service=2]="Service",i[i.Worker=3]="Worker",i))(Kt||{}),te=(i=>(i[i.Pending=0]="Pending",i[i.Start=1]="Start",i[i.Doing=2]="Doing",i[i.Done=3]="Done",i[i.Unwritable=4]="Unwritable",i))(te||{}),vt=(i=>(i[i.None=0]="None",i[i.Init=1]="Init",i[i.UpdateCamera=2]="UpdateCamera",i[i.UpdateTools=3]="UpdateTools",i[i.CreateWork=4]="CreateWork",i[i.DrawWork=5]="DrawWork",i[i.FullWork=6]="FullWork",i[i.UpdateNode=7]="UpdateNode",i[i.RemoveNode=8]="RemoveNode",i[i.Clear=9]="Clear",i[i.Select=10]="Select",i[i.Destroy=11]="Destroy",i[i.Snapshot=12]="Snapshot",i[i.BoundingBox=13]="BoundingBox",i[i.Cursor=14]="Cursor",i[i.TextUpdate=15]="TextUpdate",i[i.GetTextActive=16]="GetTextActive",i[i.TasksQueue=17]="TasksQueue",i[i.CursorHover=18]="CursorHover",i[i.CursorBlur=19]="CursorBlur",i[i.Console=20]="Console",i[i.GetImageBitMap=23]="GetImageBitMap",i[i.AuthWriter=24]="AuthWriter",i[i.AuthReader=25]="AuthReader",i[i.AuthClear=26]="AuthClear",i[i.AuthPage=27]="AuthPage",i[i.GetVNodeInfo=28]="GetVNodeInfo",i[i.UpdateDpr=29]="UpdateDpr",i[i.SetFontFace=30]="SetFontFace",i[i.ReportError=31]="ReportError",i[i.ReportLog=32]="ReportLog",i[i.BackgroundSVGUpdate=33]="BackgroundSVGUpdate",i[i.BackgroundSVGDelete=34]="BackgroundSVGDelete",i))(vt||{}),Ut=(i=>(i[i.None=0]="None",i[i.Bg=1]="Bg",i[i.ServiceFloat=2]="ServiceFloat",i[i.Float=3]="Float",i[i.TopFloat=4]="TopFloat",i))(Ut||{}),Te=(i=>(i[i.none=1]="none",i[i.all=2]="all",i[i.both=3]="both",i[i.proportional=4]="proportional",i))(Te||{}),yr=(i=>(i[i.inside=0]="inside",i[i.outside=1]="outside",i[i.intersect=2]="intersect",i))(yr||{}),es=(i=>(i.Image="image",i.Iconify="iconify",i))(es||{});class Hr{constructor(){dt(this,"localWork");dt(this,"serviceWork");dt(this,"threadEngine")}registerForWorker(e){return this.threadEngine=e,this.localWork=e.localWork,this.serviceWork=e.serviceWork,this}}class cd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.CopyNode)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.FullWork&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var n;const{workId:r}=t;r&&await((n=this.localWork)==null?void 0:n.consumeFull(t))}}const Vn="++",Me="selector",ud="all";class hd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.SetColorNode)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var v;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,needUndoTicker:h}=t;r===Me&&n&&await((v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,callback:this.updateSelectorCallback,needUndoTicker:h}))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s}=t,{willSyncService:c,isSync:l,textUpdateForWoker:f,needUndoTicker:h}=r,v=n.render||[],u=n.sp||[];if(c)for(const[y,T]of s.entries())f&&T.toolsType===xt.Text?u.push({...T,workId:y,type:vt.TextUpdate,dataType:Kt.Local,willSyncService:!0}):u.push({...T,workId:y,type:vt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l});return h&&u.push({type:vt.None,needUndoTicker:h}),{render:v,sp:u}}}class dd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.ZIndexNode)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var f;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l}=t;r===Me&&n&&await((f=this.localWork)==null?void 0:f.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,callback:this.updateSelectorCallback}))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s}=t,{willSyncService:c,isSync:l}=r,f=n.render||[],h=n.sp||[];if(c&&h)for(const[v,u]of s.entries())u.toolsType===xt.BackgroundSVG&&h.push({...u,workId:v,type:vt.BackgroundSVGUpdate,dataType:Kt.Local,updateNodeOpt:{useAnimation:!1}}),h.push({...u,workId:v,type:vt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l});return{render:f,sp:h}}}class pd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.TranslateNode)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var y,T;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,emitEventType:h,smoothSync:v,needUndoTicker:u}=t;r===Me&&n&&(n.workState===te.Done&&(n!=null&&n.translate)&&(n.translate[0]||n.translate[1])||n.workState!==te.Done?await((y=this.localWork)==null?void 0:y.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,isSync:!0,textUpdateForWoker:f,emitEventType:h,callback:this.updateSelectorCallback,smoothSync:v,needUndoTicker:u})):n.workState===te.Done&&((T=this.localWork)==null||T.vNodes.deleteLastTarget()))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s,workShapeNode:c,res:l,smoothSync:f}=t,{willSyncService:h,isSync:v,updateSelectorOpt:u,textUpdateForWoker:y,needUndoTicker:T}=r,w=u.workState,I=n.render||[],S=n.sp||[];if(w===te.Start)return{sp:[],render:[]};const O=l==null?void 0:l.selectRect;if(h){S.push({type:vt.Select,selectIds:c.selectIds,selectRect:O,willSyncService:w===te.Done?!0:f,isSync:!0,points:w===te.Done&&c.getChildrenPoints()||void 0,textOpt:c.textOpt});const d={useAnimation:u.useAnimation||!1};u.uid&&(d.uid=u.uid);for(const[g,p]of s.entries())p.toolsType===xt.BackgroundSVG&&S.push({...p,workId:g,type:vt.BackgroundSVGUpdate,dataType:Kt.Local,willSyncService:w===te.Done?!0:f,updateNodeOpt:d}),y&&p.toolsType===xt.Text?S.push({...p,workId:g,type:vt.TextUpdate,dataType:Kt.Local,willSyncService:w===te.Done?!0:f,updateNodeOpt:d}):(f||w===te.Done)&&S.push({...p,workId:g,type:vt.UpdateNode,updateNodeOpt:d,isSync:v})}return T&&S.push({type:vt.None,needUndoTicker:T}),{render:I,sp:S}}}class vd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.ScaleNode)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var h;const{workId:r,updateNodeOpt:n,willSyncService:s,willSerializeData:c,smoothSync:l,needUndoTicker:f}=t;r===Me&&n&&await((h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willSyncService:s,willSerializeData:c,isSync:!0,callback:this.updateSelectorCallback.bind(this),smoothSync:l,needUndoTicker:f}))}updateSelectorCallback(t){const{param:r,postData:n,workShapeNode:s,res:c,newServiceStore:l,smoothSync:f}=t,{updateSelectorOpt:h,willSyncService:v,needUndoTicker:u}=r,y=h.workState,T=n.render||[],w=n.sp||[],I=c==null?void 0:c.selectRect;if(y===te.Start)return{sp:[],render:[]};if(v){w.push({type:vt.Select,selectIds:s.selectIds,selectRect:I,willSyncService:y===te.Done?!0:f,isSync:!0,points:y===te.Done&&s.getChildrenPoints()||void 0,textOpt:s.textOpt});const S={useAnimation:h.useAnimation||!1};h.uid&&(S.uid=h.uid);for(const[O,d]of l.entries())d.toolsType===xt.BackgroundSVG&&w.push({...d,workId:O,type:vt.BackgroundSVGUpdate,dataType:Kt.Local,willSyncService:y===te.Done?!0:f,updateNodeOpt:S}),d.toolsType===xt.Text?w.push({...d,workId:O,type:vt.TextUpdate,dataType:Kt.Local,willSyncService:y===te.Done?!0:f,updateNodeOpt:S}):(f||y===te.Done)&&w.push({...d,workId:O,type:vt.UpdateNode,updateNodeOpt:S,isSync:!0})}return u&&w.push({type:vt.None,needUndoTicker:u}),{render:T,sp:w}}}class gd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.RotateNode)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var u;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,emitEventType:f,smoothSync:h,needUndoTicker:v}=t;r===Me&&n&&await((u=this.localWork)==null?void 0:u.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,emitEventType:f,isSync:!0,callback:this.updateSelectorCallback,smoothSync:h,needUndoTicker:v}))}updateSelectorCallback(t){const{param:r,postData:n,workShapeNode:s,res:c,newServiceStore:l,smoothSync:f}=t,{updateSelectorOpt:h,willSyncService:v,willSerializeData:u,isSync:y,needUndoTicker:T}=r,w=h.workState,I=n.render||[],S=n.sp||[],O=c==null?void 0:c.selectRect;if(v){u&&w===te.Done&&S.push({type:vt.Select,selectIds:s.selectIds,selectRect:O,willSyncService:!0,isSync:y,points:s.getChildrenPoints(),textOpt:s.textOpt,selectorColor:s.selectorColor,strokeColor:s.strokeColor,fillColor:s.fillColor,canTextEdit:s.canTextEdit,canRotate:s.canRotate,scaleType:s.scaleType,opt:s.getWorkOptions()||void 0,canLock:s.canLock,isLocked:s.isLocked,toolsTypes:s.toolsTypes,shapeOpt:s.shapeOpt,thickness:s.thickness,useStroke:s.useStroke,strokeType:s.strokeType});const d={useAnimation:h.useAnimation||!1};if(h.uid&&(d.uid=h.uid),f||w===te.Done)for(const[g,p]of l.entries())S.push({...p,workId:g,type:vt.UpdateNode,updateNodeOpt:d,isSync:y})}return T&&S.push({type:vt.None,needUndoTicker:T}),{render:I,sp:S}}}class md extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.SetFontStyle)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var h;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f}=t;r===Me&&n&&await((h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,callback:this.updateSelectorCallback}))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s,workShapeNode:c,res:l}=t,{willSyncService:f,isSync:h,updateSelectorOpt:v,textUpdateForWoker:u}=r,y=n.render||[],T=n.sp||[],w=l==null?void 0:l.selectRect;if(f&&T){v.fontSize&&T.push({type:vt.Select,selectIds:c.selectIds,selectRect:w,willSyncService:f,isSync:h,points:c.getChildrenPoints()});for(const[I,S]of s.entries())u&&S.toolsType===xt.Text?T.push({...S,workId:I,type:vt.TextUpdate,dataType:Kt.Local,willSyncService:!0}):T.push({...S,workId:I,type:vt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h})}return{render:y,sp:T}}}class yd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.SetPoint)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var v;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,needUndoTicker:h}=t;r===Me&&n&&await((v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,emitEventType:this.emitEventType,willSerializeData:l,isSync:!0,textUpdateForWoker:f,callback:this.updateSelectorCallback,needUndoTicker:h}))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s,workShapeNode:c,res:l}=t,{willSyncService:f,isSync:h,needUndoTicker:v}=r,u=n.render||[],y=n.sp||[],T=l==null?void 0:l.selectRect;if(f&&y){for(const[w,I]of s.entries())y.push({...I,workId:w,type:vt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h});y.push({type:vt.Select,selectIds:c.selectIds,selectRect:T,willSyncService:f,isSync:h,points:c.getChildrenPoints()})}return v&&y.push({type:vt.None,needUndoTicker:v}),{render:u,sp:y}}}class Sd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.SetLock)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var h;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,needUndoTicker:f}=t;r===Me&&n&&await((h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,callback:this.updateSelectorCallback,needUndoTicker:f}))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s,workShapeNode:c,res:l}=t,{willSyncService:f,isSync:h,updateSelectorOpt:v,needUndoTicker:u}=r,y=n.render||[],T=n.sp||[],w=l==null?void 0:l.selectRect;if(f&&T){for(const[I,S]of s.entries())T.push({...S,workId:I,type:vt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h});T.push({isLocked:v.isLocked,selectorColor:c.selectorColor,scaleType:c.scaleType,canRotate:c.canRotate,type:vt.Select,selectIds:c.selectIds,selectRect:w,willSyncService:f,isSync:h})}return u&&T.push({type:vt.None,needUndoTicker:u}),{render:y,sp:T}}}class Pd extends Hr{constructor(){super(...arguments);dt(this,"emitEventType",de.SetShapeOpt)}consume(t){const{msgType:r,dataType:n,emitEventType:s}=t;if(r===vt.UpdateNode&&n===Kt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0}async consumeForLocalWorker(t){var h;const{workId:r,updateNodeOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,needUndoTicker:f}=t;r===Me&&n&&await((h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,callback:this.updateSelectorCallback,needUndoTicker:f}))}updateSelectorCallback(t){const{param:r,postData:n,newServiceStore:s}=t,{willSyncService:c,isSync:l,needUndoTicker:f}=r,h=n.render||[],v=n.sp||[];if(c&&v)for(const[u,y]of s.entries())v.push({...y,workId:u,type:vt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l});return f&&v.push({type:vt.None,needUndoTicker:f}),{render:h,sp:v}}}class Yl{constructor(e){dt(this,"builders",new Map);this.builders=new Map(e.map(t=>[t,this.build(t)]))}build(e){switch(e){case de.TranslateNode:return new pd;case de.ZIndexNode:return new dd;case de.CopyNode:return new cd;case de.SetColorNode:return new hd;case de.ScaleNode:return new vd;case de.RotateNode:return new gd;case de.SetFontStyle:return new md;case de.SetPoint:return new yd;case de.SetLock:return new Sd;case de.SetShapeOpt:return new Pd}}registerForWorker(e){return this.builders.forEach(t=>{t&&t.registerForWorker(e)}),this}consumeForWorker(e){for(const t of this.builders.values())if(t!=null&&t.consume(e))return!0;return!1}}const xd={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>i*(2-i),easeInOutQuad:i=>i<.5?2*i*i:-1+(4-2*i)*i,easeInCubic:i=>i*i*i,easeOutCubic:i=>--i*i*i+1,easeInOutCubic:i=>i<.5?4*i*i*i:(i-1)*(2*i-2)*(2*i-2)+1,easeInQuart:i=>i*i*i*i,easeOutQuart:i=>1- --i*i*i*i,easeInOutQuart:i=>i<.5?8*i*i*i*i:1-8*--i*i*i*i,easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>1+--i*i*i*i*i,easeInOutQuint:i=>i<.5?16*i*i*i*i*i:1+16*--i*i*i*i*i,easeInSine:i=>1-Math.cos(i*Math.PI/2),easeOutSine:i=>Math.sin(i*Math.PI/2),easeInOutSine:i=>-(Math.cos(Math.PI*i)-1)/2,easeInExpo:i=>i<=0?0:Math.pow(2,10*i-10),easeOutExpo:i=>i>=1?1:1-Math.pow(2,-10*i),easeInOutExpo:i=>i<=0?0:i>=1?1:i<.5?Math.pow(2,20*i-10)/2:(2-Math.pow(2,-20*i+10))/2};class pt{constructor(e=0,t=0,r=1){this.x=e,this.y=t,this.z=r}get XY(){return[this.x,this.y]}setz(e){return this.z=e,this}setXY(e=this.x,t=this.y){return this.x=e,this.y=t,this}set(e=this.x,t=this.y,r=this.z){return this.x=e,this.y=t,this.z=r,this}setTo({x:e=0,y:t=0,z:r=1}){return this.x=e,this.y=t,this.z=r,this}rot(e){if(e===0)return this;const{x:t,y:r}=this,n=Math.sin(e),s=Math.cos(e);return this.x=t*s-r*n,this.y=t*n+r*s,this}rotWith(e,t){if(t===0)return this;const r=this.x-e.x,n=this.y-e.y,s=Math.sin(t),c=Math.cos(t);return this.x=e.x+(r*c-n*s),this.y=e.y+(r*s+n*c),this}clone(){const{x:e,y:t,z:r}=this;return new pt(e,t,r)}sub(e){return this.x-=e.x,this.y-=e.y,this}subXY(e,t){return this.x-=e,this.y-=t,this}subScalar(e){return this.x-=e,this.y-=e,this}add(e){return this.x+=e.x,this.y+=e.y,this}addXY(e,t){return this.x+=e,this.y+=t,this}addScalar(e){return this.x+=e,this.y+=e,this}clamp(e,t){return this.x=Math.max(this.x,e),this.y=Math.max(this.y,e),t!==void 0&&(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)),this}div(e){return this.x/=e,this.y/=e,this}divV(e){return this.x/=e.x,this.y/=e.y,this}mul(e){return this.x*=e,this.y*=e,this}mulV(e){return this.x*=e.x,this.y*=e.y,this}abs(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this}nudge(e,t){const r=pt.Tan(e,this);return this.add(r.mul(t))}neg(){return this.x*=-1,this.y*=-1,this}cross(e){return this.x=this.y*e.z-this.z*e.y,this.y=this.z*e.x-this.x*e.z,this}dpr(e){return pt.Dpr(this,e)}cpr(e){return pt.Cpr(this,e)}len2(){return pt.Len2(this)}len(){return pt.Len(this)}pry(e){return pt.Pry(this,e)}per(){const{x:e,y:t}=this;return this.x=t,this.y=-e,this}uni(){return pt.Uni(this)}tan(e){return pt.Tan(this,e)}dist(e){return pt.Dist(this,e)}distanceToLineSegment(e,t){return pt.DistanceToLineSegment(e,t,this)}slope(e){return pt.Slope(this,e)}snapToGrid(e){return this.x=Math.round(this.x/e)*e,this.y=Math.round(this.y/e)*e,this}angle(e){return pt.Angle(this,e)}toAngle(){return pt.ToAngle(this)}lrp(e,t){return this.x=this.x+(e.x-this.x)*t,this.y=this.y+(e.y-this.y)*t,this}equals(e,t){return pt.Equals(this,e,t)}equalsXY(e,t){return pt.EqualsXY(this,e,t)}norm(){const e=this.len();return this.x=e===0?0:this.x/e,this.y=e===0?0:this.y/e,this}toFixed(){return pt.ToFixed(this)}toString(){return pt.ToString(pt.ToFixed(this))}toJson(){return pt.ToJson(this)}toArray(){return pt.ToArray(this)}static Add(e,t){return new pt(e.x+t.x,e.y+t.y)}static AddXY(e,t,r){return new pt(e.x+t,e.y+r)}static Sub(e,t){return new pt(e.x-t.x,e.y-t.y)}static SubXY(e,t,r){return new pt(e.x-t,e.y-r)}static AddScalar(e,t){return new pt(e.x+t,e.y+t)}static SubScalar(e,t){return new pt(e.x-t,e.y-t)}static Div(e,t){return new pt(e.x/t,e.y/t)}static Mul(e,t){return new pt(e.x*t,e.y*t)}static DivV(e,t){return new pt(e.x/t.x,e.y/t.y)}static MulV(e,t){return new pt(e.x*t.x,e.y*t.y)}static Neg(e){return new pt(-e.x,-e.y)}static Per(e){return new pt(e.y,-e.x)}static Dist2(e,t){return pt.Sub(e,t).len2()}static Abs(e){return new pt(Math.abs(e.x),Math.abs(e.y))}static Dist(e,t){return Math.hypot(e.y-t.y,e.x-t.x)}static Dpr(e,t){return e.x*t.x+e.y*t.y}static Cross(e,t){return new pt(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z)}static Cpr(e,t){return e.x*t.y-t.x*e.y}static Len2(e){return e.x*e.x+e.y*e.y}static Len(e){return Math.hypot(e.x,e.y)}static Pry(e,t){return pt.Dpr(e,t)/pt.Len(t)}static Uni(e){return pt.Div(e,pt.Len(e))}static Tan(e,t){return pt.Uni(pt.Sub(e,t))}static Min(e,t){return new pt(Math.min(e.x,t.x),Math.min(e.y,t.y))}static Max(e,t){return new pt(Math.max(e.x,t.x),Math.max(e.y,t.y))}static From(e){return new pt().add(e)}static FromArray(e){return new pt(e[0],e[1])}static Rot(e,t=0){const r=Math.sin(t),n=Math.cos(t);return new pt(e.x*n-e.y*r,e.x*r+e.y*n)}static RotWith(e,t,r){const n=e.x-t.x,s=e.y-t.y,c=Math.sin(r),l=Math.cos(r);return new pt(t.x+(n*l-s*c),t.y+(n*c+s*l))}static NearestPointOnLineThroughPoint(e,t,r){return pt.Mul(t,pt.Sub(r,e).pry(t)).add(e)}static NearestPointOnLineSegment(e,t,r,n=!0){const s=pt.Tan(t,e),c=pt.Add(e,pt.Mul(s,pt.Sub(r,e).pry(s)));if(n){if(c.x<Math.min(e.x,t.x))return pt.Cast(e.x<t.x?e:t);if(c.x>Math.max(e.x,t.x))return pt.Cast(e.x>t.x?e:t);if(c.y<Math.min(e.y,t.y))return pt.Cast(e.y<t.y?e:t);if(c.y>Math.max(e.y,t.y))return pt.Cast(e.y>t.y?e:t)}return c}static DistanceToLineThroughPoint(e,t,r){return pt.Dist(r,pt.NearestPointOnLineThroughPoint(e,t,r))}static DistanceToLineSegment(e,t,r,n=!0){return pt.Dist(r,pt.NearestPointOnLineSegment(e,t,r,n))}static Snap(e,t=1){return new pt(Math.round(e.x/t)*t,Math.round(e.y/t)*t)}static Cast(e){return e instanceof pt?e:pt.From(e)}static Slope(e,t){return e.x===t.y?NaN:(e.y-t.y)/(e.x-t.x)}static Angle(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}static Lrp(e,t,r){return pt.Sub(t,e).mul(r).add(e)}static Med(e,t){return new pt((e.x+t.x)/2,(e.y+t.y)/2)}static Equals(e,t,r=1e-4){return Math.abs(e.x-t.x)<r&&Math.abs(e.y-t.y)<r}static EqualsXY(e,t,r){return e.x===t&&e.y===r}static EqualsXYZ(e,t,r=1e-4){return pt.Equals(e,t,r)&&Math.abs((e.z||0)-(t.z||0))<r}static Clockwise(e,t,r){return(r.x-e.x)*(t.y-e.y)-(t.x-e.x)*(r.y-e.y)<0}static Rescale(e,t){const r=pt.Len(e);return new pt(t*e.x/r,t*e.y/r)}static ScaleWithOrigin(e,t,r){return pt.Sub(e,r).mul(t).add(r)}static ScaleWOrigin(e,t,r){return pt.Sub(e,r).mulV(t).add(r)}static ToFixed(e,t=2){return new pt(+e.x.toFixed(t),+e.y.toFixed(t),+e.z.toFixed(t))}static Nudge(e,t,r){return pt.Add(e,pt.Tan(t,e).mul(r))}static ToString(e){return`${e.x}, ${e.y}`}static ToAngle(e){let t=Math.atan2(e.y,e.x);return t<0&&(t+=Math.PI*2),t}static FromAngle(e,t=1){return new pt(Math.cos(e)*t,Math.sin(e)*t)}static ToArray(e){return[e.x,e.y,e.z]}static ToJson(e){const{x:t,y:r,z:n}=e;return{x:t,y:r,z:n}}static Average(e){const t=e.length,r=new pt(0,0);for(let n=0;n<t;n++)r.add(e[n]);return r.div(t)}static Clamp(e,t,r){return r===void 0?new pt(Math.min(Math.max(e.x,t)),Math.min(Math.max(e.y,t))):new pt(Math.min(Math.max(e.x,t),r),Math.min(Math.max(e.y,t),r))}static PointsBetween(e,t,r=6){const n=[];for(let s=0;s<r;s++){const c=xd.easeInQuad(s/(r-1)),l=pt.Lrp(e,t,c);l.z=Math.min(1,.5+Math.abs(.5-Td(c))*.65),n.push(l)}return n}static SnapToGrid(e,t=8){return new pt(Math.round(e.x/t)*t,Math.round(e.y/t)*t)}}const Td=i=>i<.5?2*i*i:-1+(4-2*i)*i;class Jt extends pt{constructor(e=0,t=0,r=0,n={x:0,y:0},s=0,c=0){super(e,t,r),this.x=e,this.y=t,this.z=r,this.v=n,this.t=s,this.a=c}get timestamp(){return this.t}get pressure(){return this.z}get angleNum(){return this.a}get XY(){return[this.x,this.y]}setA(e){this.a=e}setT(e){this.t=e}setv(e){return this.v={x:e.x,y:e.y},this}set(e=this.x,t=this.y,r=this.z,n=this.v,s=this.t,c=this.a){return this.x=e,this.y=t,this.z=r,this.v=n,this.t=s,this.a=c,this}clone(){const{x:e,y:t,z:r,v:n,t:s,a:c}=this,l={x:n.x,y:n.y};return new Jt(e,t,r,l,s,c)}distance(e){return Jt.GetDistance(this,e)}isNear(e,t){return Jt.IsNear(this,e,t)}getAngleByPoints(e,t){return Jt.GetAngleByPoints(e,this,t)}static Sub(e,t){return new Jt(e.x-t.x,e.y-t.y)}static Add(e,t){return new Jt(e.x+t.x,e.y+t.y)}static GetDistance(e,t){return Jt.Len(e.clone().sub(t))}static GetAngleByPoints(e,t,r){const n=t.x-e.x,s=r.x-t.x,c=t.y-e.y,l=r.y-t.y;let f=0;const h=Math.sqrt(n*n+c*c),v=Math.sqrt(s*s+l*l);if(h&&v){const u=n*s+c*l;f=Math.acos(u/(h*v)),f=f/Math.PI*180;let y=n*l-c*s;y=y>0?1:-1,f=180+y*f}return f}static IsNear(e,t,r){return Jt.Len(e.clone().sub(t))<r}static RotWith(e,t,r,n=2){const s=e.x-t.x,c=e.y-t.y,l=Math.sin(r),f=Math.cos(r),h=Math.pow(10,n),v=Math.floor((t.x+(s*f-c*l))*h)/h,u=Math.floor((t.y+(s*l+c*f))*h)/h;return new Jt(v,u)}static GetDotStroke(e,t,r=16){const n=new pt(1,1),s=Math.PI+.001,c=Jt.Add(e,Jt.Sub(e,n).uni().per().mul(-t)),l=[];for(let f=1/r,h=f;h<=1;h+=f)l.push(Jt.RotWith(c,e,s*2*h));return l}static GetSemicircleStroke(e,t,r=-1,n=8){const s=r*(Math.PI+.001),c=[];for(let l=1/n,f=l;f<=1;f+=l)c.push(Jt.RotWith(t,e,s*f));return c}}var rn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mn(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Cd=typeof rn=="object"&&rn&&rn.Object===Object&&rn,Xl=Cd,Id=Xl,Od=typeof self=="object"&&self&&self.Object===Object&&self,wd=Id||Od||Function("return this")(),Vr=wd,Ad=Vr,Ed=Ad.Symbol,Ai=Ed,zl=Ai,$l=Object.prototype,Md=$l.hasOwnProperty,Ld=$l.toString,Ei=zl?zl.toStringTag:void 0;function Rd(i){var e=Md.call(i,Ei),t=i[Ei];try{i[Ei]=void 0;var r=!0}catch{}var n=Ld.call(i);return r&&(e?i[Ei]=t:delete i[Ei]),n}var bd=Rd,Dd=Object.prototype,Nd=Dd.toString;function Bd(i){return Nd.call(i)}var Wd=Bd,jl=Ai,Fd=bd,Ud=Wd,Yd="[object Null]",Xd="[object Undefined]",Gl=jl?jl.toStringTag:void 0;function zd(i){return i==null?i===void 0?Xd:Yd:Gl&&Gl in Object(i)?Fd(i):Ud(i)}var Kn=zd;function $d(i){return i!=null&&typeof i=="object"}var nn=$d,jd=Kn,Gd=nn,kd="[object Number]";function Hd(i){return typeof i=="number"||Gd(i)&&jd(i)==kd}var Vd=Hd,Qe=mn(Vd);function Kd(){this.__data__=[],this.size=0}var Zd=Kd;function Jd(i,e){return i===e||i!==i&&e!==e}var Mo=Jd,Qd=Mo;function qd(i,e){for(var t=i.length;t--;)if(Qd(i[t][0],e))return t;return-1}var rs=qd,_d=rs,tp=Array.prototype,ep=tp.splice;function rp(i){var e=this.__data__,t=_d(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():ep.call(e,t,1),--this.size,!0}var np=rp,ip=rs;function sp(i){var e=this.__data__,t=ip(e,i);return t<0?void 0:e[t][1]}var op=sp,ap=rs;function lp(i){return ap(this.__data__,i)>-1}var fp=lp,cp=rs;function up(i,e){var t=this.__data__,r=cp(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}var hp=up,dp=Zd,pp=np,vp=op,gp=fp,mp=hp;function Zn(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}Zn.prototype.clear=dp,Zn.prototype.delete=pp,Zn.prototype.get=vp,Zn.prototype.has=gp,Zn.prototype.set=mp;var ns=Zn,yp=ns;function Sp(){this.__data__=new yp,this.size=0}var Pp=Sp;function xp(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var Tp=xp;function Cp(i){return this.__data__.get(i)}var Ip=Cp;function Op(i){return this.__data__.has(i)}var wp=Op;function Ap(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Mi=Ap,Ep=Kn,Mp=Mi,Lp="[object AsyncFunction]",Rp="[object Function]",bp="[object GeneratorFunction]",Dp="[object Proxy]";function Np(i){if(!Mp(i))return!1;var e=Ep(i);return e==Rp||e==bp||e==Lp||e==Dp}var kl=Np,Bp=Vr,Wp=Bp["__core-js_shared__"],Fp=Wp,Lo=Fp,Hl=function(){var i=/[^.]+$/.exec(Lo&&Lo.keys&&Lo.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function Up(i){return!!Hl&&Hl in i}var Yp=Up,Xp=Function.prototype,zp=Xp.toString;function $p(i){if(i!=null){try{return zp.call(i)}catch{}try{return i+""}catch{}}return""}var Vl=$p,jp=kl,Gp=Yp,kp=Mi,Hp=Vl,Vp=/[\\^$.*+?()[\]{}|]/g,Kp=/^\[object .+?Constructor\]$/,Zp=Function.prototype,Jp=Object.prototype,Qp=Zp.toString,qp=Jp.hasOwnProperty,_p=RegExp("^"+Qp.call(qp).replace(Vp,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function t0(i){if(!kp(i)||Gp(i))return!1;var e=jp(i)?_p:Kp;return e.test(Hp(i))}var e0=t0;function r0(i,e){return i==null?void 0:i[e]}var n0=r0,i0=e0,s0=n0;function o0(i,e){var t=s0(i,e);return i0(t)?t:void 0}var bn=o0,a0=bn,l0=Vr,f0=a0(l0,"Map"),Ro=f0,c0=bn,u0=c0(Object,"create"),is=u0,Kl=is;function h0(){this.__data__=Kl?Kl(null):{},this.size=0}var d0=h0;function p0(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var v0=p0,g0=is,m0="__lodash_hash_undefined__",y0=Object.prototype,S0=y0.hasOwnProperty;function P0(i){var e=this.__data__;if(g0){var t=e[i];return t===m0?void 0:t}return S0.call(e,i)?e[i]:void 0}var x0=P0,T0=is,C0=Object.prototype,I0=C0.hasOwnProperty;function O0(i){var e=this.__data__;return T0?e[i]!==void 0:I0.call(e,i)}var w0=O0,A0=is,E0="__lodash_hash_undefined__";function M0(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=A0&&e===void 0?E0:e,this}var L0=M0,R0=d0,b0=v0,D0=x0,N0=w0,B0=L0;function Jn(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}Jn.prototype.clear=R0,Jn.prototype.delete=b0,Jn.prototype.get=D0,Jn.prototype.has=N0,Jn.prototype.set=B0;var W0=Jn,Zl=W0,F0=ns,U0=Ro;function Y0(){this.size=0,this.__data__={hash:new Zl,map:new(U0||F0),string:new Zl}}var X0=Y0;function z0(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var $0=z0,j0=$0;function G0(i,e){var t=i.__data__;return j0(e)?t[typeof e=="string"?"string":"hash"]:t.map}var ss=G0,k0=ss;function H0(i){var e=k0(this,i).delete(i);return this.size-=e?1:0,e}var V0=H0,K0=ss;function Z0(i){return K0(this,i).get(i)}var J0=Z0,Q0=ss;function q0(i){return Q0(this,i).has(i)}var _0=q0,tv=ss;function ev(i,e){var t=tv(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this}var rv=ev,nv=X0,iv=V0,sv=J0,ov=_0,av=rv;function Qn(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}Qn.prototype.clear=nv,Qn.prototype.delete=iv,Qn.prototype.get=sv,Qn.prototype.has=ov,Qn.prototype.set=av;var Jl=Qn,lv=ns,fv=Ro,cv=Jl,uv=200;function hv(i,e){var t=this.__data__;if(t instanceof lv){var r=t.__data__;if(!fv||r.length<uv-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new cv(r)}return t.set(i,e),this.size=t.size,this}var dv=hv,pv=ns,vv=Pp,gv=Tp,mv=Ip,yv=wp,Sv=dv;function qn(i){var e=this.__data__=new pv(i);this.size=e.size}qn.prototype.clear=vv,qn.prototype.delete=gv,qn.prototype.get=mv,qn.prototype.has=yv,qn.prototype.set=Sv;var Ql=qn;function Pv(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var xv=Pv,Tv=bn,Cv=function(){try{var i=Tv(Object,"defineProperty");return i({},"",{}),i}catch{}}(),ql=Cv,_l=ql;function Iv(i,e,t){e=="__proto__"&&_l?_l(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var tf=Iv,Ov=tf,wv=Mo,Av=Object.prototype,Ev=Av.hasOwnProperty;function Mv(i,e,t){var r=i[e];(!(Ev.call(i,e)&&wv(r,t))||t===void 0&&!(e in i))&&Ov(i,e,t)}var ef=Mv,Lv=ef,Rv=tf;function bv(i,e,t,r){var n=!t;t||(t={});for(var s=-1,c=e.length;++s<c;){var l=e[s],f=r?r(t[l],i[l],l,t,i):void 0;f===void 0&&(f=i[l]),n?Rv(t,l,f):Lv(t,l,f)}return t}var os=bv;function Dv(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var Nv=Dv,Bv=Kn,Wv=nn,Fv="[object Arguments]";function Uv(i){return Wv(i)&&Bv(i)==Fv}var Yv=Uv,rf=Yv,Xv=nn,nf=Object.prototype,zv=nf.hasOwnProperty,$v=nf.propertyIsEnumerable,jv=rf(function(){return arguments}())?rf:function(i){return Xv(i)&&zv.call(i,"callee")&&!$v.call(i,"callee")},sf=jv,Gv=Array.isArray,Li=Gv,as={exports:{}};function kv(){return!1}var Hv=kv;as.exports,function(i,e){var t=Vr,r=Hv,n=e&&!e.nodeType&&e,s=n&&!0&&i&&!i.nodeType&&i,c=s&&s.exports===n,l=c?t.Buffer:void 0,f=l?l.isBuffer:void 0,h=f||r;i.exports=h}(as,as.exports);var bo=as.exports,Vv=9007199254740991,Kv=/^(?:0|[1-9]\d*)$/;function Zv(i,e){var t=typeof i;return e=e??Vv,!!e&&(t=="number"||t!="symbol"&&Kv.test(i))&&i>-1&&i%1==0&&i<e}var Jv=Zv,Qv=9007199254740991;function qv(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=Qv}var of=qv,_v=Kn,tg=of,eg=nn,rg="[object Arguments]",ng="[object Array]",ig="[object Boolean]",sg="[object Date]",og="[object Error]",ag="[object Function]",lg="[object Map]",fg="[object Number]",cg="[object Object]",ug="[object RegExp]",hg="[object Set]",dg="[object String]",pg="[object WeakMap]",vg="[object ArrayBuffer]",gg="[object DataView]",mg="[object Float32Array]",yg="[object Float64Array]",Sg="[object Int8Array]",Pg="[object Int16Array]",xg="[object Int32Array]",Tg="[object Uint8Array]",Cg="[object Uint8ClampedArray]",Ig="[object Uint16Array]",Og="[object Uint32Array]",Xe={};Xe[mg]=Xe[yg]=Xe[Sg]=Xe[Pg]=Xe[xg]=Xe[Tg]=Xe[Cg]=Xe[Ig]=Xe[Og]=!0,Xe[rg]=Xe[ng]=Xe[vg]=Xe[ig]=Xe[gg]=Xe[sg]=Xe[og]=Xe[ag]=Xe[lg]=Xe[fg]=Xe[cg]=Xe[ug]=Xe[hg]=Xe[dg]=Xe[pg]=!1;function wg(i){return eg(i)&&tg(i.length)&&!!Xe[_v(i)]}var Ag=wg;function Eg(i){return function(e){return i(e)}}var ls=Eg,fs={exports:{}};fs.exports,function(i,e){var t=Xl,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s&&t.process,l=function(){try{var f=n&&n.require&&n.require("util").types;return f||c&&c.binding&&c.binding("util")}catch{}}();i.exports=l}(fs,fs.exports);var Do=fs.exports,Mg=Ag,Lg=ls,af=Do,lf=af&&af.isTypedArray,Rg=lf?Lg(lf):Mg,ff=Rg,bg=Nv,Dg=sf,Ng=Li,Bg=bo,Wg=Jv,Fg=ff,Ug=Object.prototype,Yg=Ug.hasOwnProperty;function Xg(i,e){var t=Ng(i),r=!t&&Dg(i),n=!t&&!r&&Bg(i),s=!t&&!r&&!n&&Fg(i),c=t||r||n||s,l=c?bg(i.length,String):[],f=l.length;for(var h in i)(e||Yg.call(i,h))&&!(c&&(h=="length"||n&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||Wg(h,f)))&&l.push(h);return l}var cf=Xg,zg=Object.prototype;function $g(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||zg;return i===t}var No=$g;function jg(i,e){return function(t){return i(e(t))}}var uf=jg,Gg=uf,kg=Gg(Object.keys,Object),Hg=kg,Vg=No,Kg=Hg,Zg=Object.prototype,Jg=Zg.hasOwnProperty;function Qg(i){if(!Vg(i))return Kg(i);var e=[];for(var t in Object(i))Jg.call(i,t)&&t!="constructor"&&e.push(t);return e}var qg=Qg,_g=kl,tm=of;function em(i){return i!=null&&tm(i.length)&&!_g(i)}var Bo=em,rm=cf,nm=qg,im=Bo;function sm(i){return im(i)?rm(i):nm(i)}var Wo=sm,om=os,am=Wo;function lm(i,e){return i&&om(e,am(e),i)}var fm=lm;function cm(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var um=cm,hm=Mi,dm=No,pm=um,vm=Object.prototype,gm=vm.hasOwnProperty;function mm(i){if(!hm(i))return pm(i);var e=dm(i),t=[];for(var r in i)r=="constructor"&&(e||!gm.call(i,r))||t.push(r);return t}var ym=mm,Sm=cf,Pm=ym,xm=Bo;function Tm(i){return xm(i)?Sm(i,!0):Pm(i)}var Fo=Tm,Cm=os,Im=Fo;function Om(i,e){return i&&Cm(e,Im(e),i)}var wm=Om,cs={exports:{}};cs.exports,function(i,e){var t=Vr,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,v){if(v)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y}i.exports=f}(cs,cs.exports);var Am=cs.exports;function Em(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var Mm=Em;function Lm(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c)}return s}var hf=Lm;function Rm(){return[]}var df=Rm,bm=hf,Dm=df,Nm=Object.prototype,Bm=Nm.propertyIsEnumerable,pf=Object.getOwnPropertySymbols,Wm=pf?function(i){return i==null?[]:(i=Object(i),bm(pf(i),function(e){return Bm.call(i,e)}))}:Dm,Uo=Wm,Fm=os,Um=Uo;function Ym(i,e){return Fm(i,Um(i),e)}var Xm=Ym;function zm(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var Yo=zm,$m=uf,jm=$m(Object.getPrototypeOf,Object),vf=jm,Gm=Yo,km=vf,Hm=Uo,Vm=df,Km=Object.getOwnPropertySymbols,Zm=Km?function(i){for(var e=[];i;)Gm(e,Hm(i)),i=km(i);return e}:Vm,gf=Zm,Jm=os,Qm=gf;function qm(i,e){return Jm(i,Qm(i),e)}var _m=qm,ty=Yo,ey=Li;function ry(i,e,t){var r=e(i);return ey(i)?r:ty(r,t(i))}var mf=ry,ny=mf,iy=Uo,sy=Wo;function oy(i){return ny(i,sy,iy)}var yf=oy,ay=mf,ly=gf,fy=Fo;function cy(i){return ay(i,fy,ly)}var uy=cy,hy=bn,dy=Vr,py=hy(dy,"DataView"),vy=py,gy=bn,my=Vr,yy=gy(my,"Promise"),Sy=yy,Py=bn,xy=Vr,Ty=Py(xy,"Set"),Sf=Ty,Cy=bn,Iy=Vr,Oy=Cy(Iy,"WeakMap"),wy=Oy,Xo=vy,zo=Ro,$o=Sy,jo=Sf,Go=wy,Pf=Kn,_n=Vl,xf="[object Map]",Ay="[object Object]",Tf="[object Promise]",Cf="[object Set]",If="[object WeakMap]",Of="[object DataView]",Ey=_n(Xo),My=_n(zo),Ly=_n($o),Ry=_n(jo),by=_n(Go),Dn=Pf;(Xo&&Dn(new Xo(new ArrayBuffer(1)))!=Of||zo&&Dn(new zo)!=xf||$o&&Dn($o.resolve())!=Tf||jo&&Dn(new jo)!=Cf||Go&&Dn(new Go)!=If)&&(Dn=function(i){var e=Pf(i),t=e==Ay?i.constructor:void 0,r=t?_n(t):"";if(r)switch(r){case Ey:return Of;case My:return xf;case Ly:return Tf;case Ry:return Cf;case by:return If}return e});var us=Dn,Dy=Object.prototype,Ny=Dy.hasOwnProperty;function By(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&Ny.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var Wy=By,Fy=Vr,Uy=Fy.Uint8Array,wf=Uy,Af=wf;function Yy(i){var e=new i.constructor(i.byteLength);return new Af(e).set(new Af(i)),e}var ko=Yy,Xy=ko;function zy(i,e){var t=e?Xy(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var $y=zy,jy=/\w*$/;function Gy(i){var e=new i.constructor(i.source,jy.exec(i));return e.lastIndex=i.lastIndex,e}var ky=Gy,Ef=Ai,Mf=Ef?Ef.prototype:void 0,Lf=Mf?Mf.valueOf:void 0;function Hy(i){return Lf?Object(Lf.call(i)):{}}var Vy=Hy,Ky=ko;function Zy(i,e){var t=e?Ky(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var Jy=Zy,Qy=ko,qy=$y,_y=ky,t1=Vy,e1=Jy,r1="[object Boolean]",n1="[object Date]",i1="[object Map]",s1="[object Number]",o1="[object RegExp]",a1="[object Set]",l1="[object String]",f1="[object Symbol]",c1="[object ArrayBuffer]",u1="[object DataView]",h1="[object Float32Array]",d1="[object Float64Array]",p1="[object Int8Array]",v1="[object Int16Array]",g1="[object Int32Array]",m1="[object Uint8Array]",y1="[object Uint8ClampedArray]",S1="[object Uint16Array]",P1="[object Uint32Array]";function x1(i,e,t){var r=i.constructor;switch(e){case c1:return Qy(i);case r1:case n1:return new r(+i);case u1:return qy(i,t);case h1:case d1:case p1:case v1:case g1:case m1:case y1:case S1:case P1:return e1(i,t);case i1:return new r;case s1:case l1:return new r(i);case o1:return _y(i);case a1:return new r;case f1:return t1(i)}}var T1=x1,C1=Mi,Rf=Object.create,I1=function(){function i(){}return function(e){if(!C1(e))return{};if(Rf)return Rf(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}(),O1=I1,w1=O1,A1=vf,E1=No;function M1(i){return typeof i.constructor=="function"&&!E1(i)?w1(A1(i)):{}}var L1=M1,R1=us,b1=nn,D1="[object Map]";function N1(i){return b1(i)&&R1(i)==D1}var B1=N1,W1=B1,F1=ls,bf=Do,Df=bf&&bf.isMap,U1=Df?F1(Df):W1,Y1=U1,X1=us,z1=nn,$1="[object Set]";function j1(i){return z1(i)&&X1(i)==$1}var G1=j1,k1=G1,H1=ls,Nf=Do,Bf=Nf&&Nf.isSet,V1=Bf?H1(Bf):k1,Wf=V1,K1=mn(Wf),Z1=Ql,J1=xv,Q1=ef,q1=fm,_1=wm,tS=Am,eS=Mm,rS=Xm,nS=_m,iS=yf,sS=uy,oS=us,aS=Wy,lS=T1,fS=L1,cS=Li,uS=bo,hS=Y1,dS=Mi,pS=Wf,vS=Wo,gS=Fo,mS=1,yS=2,SS=4,Ff="[object Arguments]",PS="[object Array]",xS="[object Boolean]",TS="[object Date]",CS="[object Error]",Uf="[object Function]",IS="[object GeneratorFunction]",OS="[object Map]",wS="[object Number]",Yf="[object Object]",AS="[object RegExp]",ES="[object Set]",MS="[object String]",LS="[object Symbol]",RS="[object WeakMap]",bS="[object ArrayBuffer]",DS="[object DataView]",NS="[object Float32Array]",BS="[object Float64Array]",WS="[object Int8Array]",FS="[object Int16Array]",US="[object Int32Array]",YS="[object Uint8Array]",XS="[object Uint8ClampedArray]",zS="[object Uint16Array]",$S="[object Uint32Array]",We={};We[Ff]=We[PS]=We[bS]=We[DS]=We[xS]=We[TS]=We[NS]=We[BS]=We[WS]=We[FS]=We[US]=We[OS]=We[wS]=We[Yf]=We[AS]=We[ES]=We[MS]=We[LS]=We[YS]=We[XS]=We[zS]=We[$S]=!0,We[CS]=We[Uf]=We[RS]=!1;function hs(i,e,t,r,n,s){var c,l=e&mS,f=e&yS,h=e&SS;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!dS(i))return i;var v=cS(i);if(v){if(c=aS(i),!l)return eS(i,c)}else{var u=oS(i),y=u==Uf||u==IS;if(uS(i))return tS(i,l);if(u==Yf||u==Ff||y&&!n){if(c=f||y?{}:fS(i),!l)return f?nS(i,_1(c,i)):rS(i,q1(c,i))}else{if(!We[u])return n?i:{};c=lS(i,u,l)}}s||(s=new Z1);var T=s.get(i);if(T)return T;s.set(i,c),pS(i)?i.forEach(function(S){c.add(hs(S,e,t,S,i,s))}):hS(i)&&i.forEach(function(S,O){c.set(O,hs(S,e,t,O,i,s))});var w=h?f?sS:iS:f?gS:vS,I=v?void 0:w(i);return J1(I||i,function(S,O){I&&(O=S,S=i[O]),Q1(c,O,hs(S,e,t,O,i,s))}),c}var jS=hs,GS=jS,kS=1,HS=4;function VS(i){return GS(i,kS|HS)}var KS=VS,ar=mn(KS);const Xf="1.1.34-beta.3",ZS="@netless/appliance-plugin";if(typeof window<"u"){let i=window.__netlessUA||"";i+=` ${ZS}@${Xf}`,window.__netlessUA=i}const ur={useWorker:"auto",useSimple:!1,useBackgroundThread:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"},undoRedo:{enableGlobal:!1,maxStackLength:20},markmap:{enable:!0,timeout:1e4,options:{autoFit:!0,duration:0,zoom:!1,pan:!1,maxInitialScale:10}}};function yn(i,e=!0){const t=i.length;if(t<2)return"";let r=i[0],n=i[1];if(t===2)return`M${ni(r)}L${ni(n)}`;let s="";for(let c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=ii(r,n);return e?`M${ii(i[0],i[1])}Q${ni(i[1])}${ii(i[1],i[2])}T${s}${ii(i[t-1],i[0])}${ii(i[0],i[1])}Z`:`M${ni(i[0])}Q${ni(i[1])}${ii(i[1],i[2])}${i.length>3?"T":""}${s}L${ni(i[t-1])}`}const Ir=class Ir{constructor(e){dt(this,"maxImageWidth",ur.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",ur.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",ur.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);const{vNodes:t,fullLayer:r,drawLayer:n,workId:s,toolsOpt:c}=e;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime}get baseConsumeResult(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions}}filterSamePoints(e,t=.01){return e.reduce((r,n)=>{const s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r},[])}setWorkId(e){this.workId=e}getWorkId(){return this.workId}getWorkOptions(){return this.workOptions}setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;const t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r))}updataOptService(e){var n,s;let t;const r=(n=this.workId)==null?void 0:n.toString();if(r&&e){const c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;const l=c[0],{pos:f,zIndex:h,scale:v,angle:u,translate:y}=e,T={};Qe(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),v&&(T.scale=v),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);const w=l==null?void 0:l.getBoundingClientRect();return w&&(t=Zt(t,{x:Math.floor(w.x-Ir.SafeBorderPadding),y:Math.floor(w.y-Ir.SafeBorderPadding),w:Math.floor(w.width+Ir.SafeBorderPadding*2),h:Math.floor(w.height+Ir.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t}}drawEraserlines(e,t){const{group:r,eraserlines:n,pos:s,layer:c}=e,l=c.parent;if(t)try{const h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,v=r.getBoundingClientRect(),u=v.width*h*c.worldScaling[0],y=v.height*h*c.worldScaling[1];let T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));let w=c.getAttribute("scale");w=[w[0]*T,w[1]*T];const I=c.parent.parent,S=c.getAttribute("translate"),O=this.createVmRenderNode(`${this.workId}_bitMapLayer`,I,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},w,S),d=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(d,n,s,!1),O.appendChild(d);const g=O.parent;g.render();const p=O.renderer.canvasRenderer,x=p.context;if(!x)return;const E=p.options.displayRatio,R=d.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:I.width,h:I.height};if(Fi(D,U)===yr.outside){Cr(d,g),I.removeChild(g),this.isDelete=!0;return}const W=ar(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,I.width)-W.x,W.h=Math.min(D.y+D.h,I.height)-W.y;const X=this.getGroupRect(W,E),B=X.x,N=X.y,$=X.w,J=X.h;let tt=x.getImageData(B,N,$,J);if(this.isTransparentRectByCanvas(tt)){Cr(d,g),I.removeChild(g),this.isDelete=!0,tt=null;return}Cr(r,l);const ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:O.worldScaling});ut&&r.append(ut),Cr(d,g),I.removeChild(g),l.deleteTexture(tt),tt=null}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return}}createVmRenderNode(e,t,r,n,s){const{width:c,height:l}=r,f=`bitMap-${e}`,h=t.layer(f,r),v=new Je({anchor:[.5,.5],pos:[c*.5,l*.5],size:[c,l],name:"viewport",id:e});return v.setAttribute("scale",n),v.setAttribute("translate",s),h.append(v),v}getGroupRect(e,t){const r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c}}addEraserlines(e,t,r,n=!0){for(const s of t){const{thickness:c,op:l}=s;for(const f of l){const h=f.map((w,I)=>I%2?w-r[1]:w-r[0]),v=this.computEraserPoints(h,c),u=yn(v,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new gn(y);T.addEventListener("beforerender",({detail:w})=>{const I=w.context;n?I.blendFuncSeparate(I.ZERO,I.ZERO,I.ZERO,I.ZERO):I.globalCompositeOperation="destination-out"}),T.addEventListener("afterrender",({detail:w})=>{const I=w.context;n?I.blendFuncSeparate(I.SRC_ALPHA,I.ONE_MINUS_SRC_ALPHA,I.ONE,I.ONE_MINUS_SRC_ALPHA):I.globalCompositeOperation="source-over"}),e.append(T)}}}isTransparentRectByCanvas(e){let t=!0;for(let r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break}return t}createSpriteNode(e){const{imageData:t,worldScaling:r,safariRect:n,originRect:s}=e;let c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);const v=c.getContext("2d");v&&v.putImageData(t,0,0)}else if(typeof document<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;const v=c.getContext("2d");v&&v.putImageData(t,0,0)}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;const l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[.5,.5],pos:[0,0],size:l,texture:c,textureRect:f};return new Ul(h)}computEraserPoints(e,t){const r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r)}computDot(e,t){const r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8)}computLine(e,t){const r=[],n=[];let s,c;for(let l=0;l<e.length;l+=2){const f=new Jt(e[l],e[l+1]);let h;if(l==e.length-2){const v=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,v).uni(),s=f}else{l===0&&(c=f);const v=new Jt(e[l+2],e[l+3]);h=pt.Sub(v,f).uni()}if(h){const v=pt.Per(h).mul(t);r.push(Jt.Sub(f,v)),n.push(Jt.Add(f,v))}}if(s&&c){const l=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),f=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(l,n.reverse(),f)}return[]}replace(e,t,r){var s;if(!t){r&&e.append(r);return}const n=e.getElementsByName(t);if(n.length)for(const c of n)r?dT(r,c,e):(c.remove(),dr(c,e.parent));else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(l=>{var f;l.remove(),dr(l,(f=this.drawLayer)==null?void 0:f.parent)}):this.fullLayer.getElementsByName(t).forEach(l=>{l.remove(),dr(l,this.fullLayer.parent)}))}removeDrawCountNodes(e,t){const r=[];e.getElementsByName(this.workId).forEach(n=>{n.id&&t&&Number(n.id)<t&&r.push(n)});for(const n of r)n.remove(),dr(n,e.parent)}static updateNodeOpt(e){var d;const{node:t,opt:r,vNodes:n,willSerializeData:s,targetNode:c}=e,{zIndex:l,translate:f,angle:h,originPoint:v,scenePoint:u,scale:y,pointMap:T,thickness:w}=r;let I;const S=c&&ar(c)||n.get(t.name);if(!S)return;Qe(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);const O=t.parent;if(O){if(v&&y&&c){const g=[S.op[0],S.op[1]];Es(S.op,u,y,f);const p=[S.op[0],S.op[1]],x=[p[0]-g[0],p[1]-g[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(let E=0;E<S.opt.eraserlines.length;E++){const{op:R,thickness:D}=S.opt.eraserlines[E];S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(let U=0;U<R.length;U++)oa(R[U],u,y,f)}}else if(f)if(t.setAttribute("translate",f),S.opt.translate=f,c){const g=[f[0]*O.worldScaling[0],f[1]*O.worldScaling[1]];I=Wi(S.rect,g),S.rect=I}else{const g=Ir.getRectFromLayer(O,t.name);S.rect=g||S.rect}else if(Qe(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)I=sa(S.rect,h),S.rect=I;else{const g=Ir.getRectFromLayer(O,t.name);S.rect=g||S.rect}if(T){const g=T.get(t.name);if(g)for(let p=0,x=0;p<S.op.length;p+=3,x++)S.op[p]=g[x][0],S.op[p+1]=g[x][1]}if(w&&((d=S==null?void 0:S.opt)!=null&&d.thickness)&&(S.opt.thickness=w),s&&!(v&&y&&c)){if(f){const g=S.op.map((p,x)=>{const E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p});if(S.op=g,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(let p=0;p<S.opt.eraserlines.length;p++){const{op:x}=S.opt.eraserlines[p];for(let E=0;E<x.length;E++){const R=x[E].map((D,U)=>U%2?D+f[1]:D+f[0]);S.opt.eraserlines[p].op[E]=R}}}else if(Qe(h)){const g=S.op;if(sT(g,S.centerPos,h),S.op=g,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(let p=0;p<S.opt.eraserlines.length;p++){const{op:x}=S.opt.eraserlines[p];for(let E=0;E<x.length;E++)oT(x[E],S.centerPos,h)}}}S&&n.setInfo(t.name,S)}}static getCenterPos(e,t){const{worldPosition:r,worldScaling:n}=t;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]]}static getRectFromLayer(e,t){const r=e.getElementsByName(t)[0];if(r){const n=r.getBoundingClientRect();return{x:Math.floor(n.x-Ir.SafeBorderPadding),y:Math.floor(n.y-Ir.SafeBorderPadding),w:Math.floor(n.width+Ir.SafeBorderPadding*2),h:Math.floor(n.height+Ir.SafeBorderPadding*2)}}}static isWillRefresh(e){const{toolsType:t,opt:r,node:n,updateOpt:s,willSerializeData:c}=e;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===xt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===xt.BackgroundSVG&&(s.translate||s.scale)||t===xt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&r.type===es.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor))}};dt(Ir,"SafeBorderPadding",10);let Yt=Ir;const Ho=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var Vo={exports:{}};Vo.exports,function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var v=0;v<f.length;v++)s[f][f.charAt(v)]=v}return s[f][h]}var l={compressToBase64:function(f){if(f==null)return"";var h=l._compress(f,6,function(v){return r.charAt(v)});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"="}},decompressFromBase64:function(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h))})},compressToUTF16:function(f){return f==null?"":l._compress(f,15,function(h){return t(h+32)})+" "},decompressFromUTF16:function(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32})},compressToUint8Array:function(f){for(var h=l.compress(f),v=new Uint8Array(h.length*2),u=0,y=h.length;u<y;u++){var T=h.charCodeAt(u);v[u*2]=T>>>8,v[u*2+1]=T%256}return v},decompressFromUint8Array:function(f){if(f==null)return l.decompress(f);for(var h=new Array(f.length/2),v=0,u=h.length;v<u;v++)h[v]=f[v*2]*256+f[v*2+1];var y=[];return h.forEach(function(T){y.push(t(T))}),l.decompress(y.join(""))},compressToEncodedURIComponent:function(f){return f==null?"":l._compress(f,6,function(h){return n.charAt(h)})},decompressFromEncodedURIComponent:function(f){return f==null?"":f==""?null:(f=f.replace(/ /g,"+"),l._decompress(f.length,32,function(h){return c(n,f.charAt(h))}))},compress:function(f){return l._compress(f,16,function(h){return t(h)})},_compress:function(f,h,v){if(f==null)return"";var u,y,T={},w={},I="",S="",O="",d=2,g=3,p=2,x=[],E=0,R=0,D;for(D=0;D<f.length;D+=1)if(I=f.charAt(D),Object.prototype.hasOwnProperty.call(T,I)||(T[I]=g++,w[I]=!0),S=O+I,Object.prototype.hasOwnProperty.call(T,S))O=S;else{if(Object.prototype.hasOwnProperty.call(w,O)){if(O.charCodeAt(0)<256){for(u=0;u<p;u++)E=E<<1,R==h-1?(R=0,x.push(v(E)),E=0):R++;for(y=O.charCodeAt(0),u=0;u<8;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1}else{for(y=1,u=0;u<p;u++)E=E<<1|y,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=0;for(y=O.charCodeAt(0),u=0;u<16;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1}d--,d==0&&(d=Math.pow(2,p),p++),delete w[O]}else for(y=T[O],u=0;u<p;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1;d--,d==0&&(d=Math.pow(2,p),p++),T[S]=g++,O=String(I)}if(O!==""){if(Object.prototype.hasOwnProperty.call(w,O)){if(O.charCodeAt(0)<256){for(u=0;u<p;u++)E=E<<1,R==h-1?(R=0,x.push(v(E)),E=0):R++;for(y=O.charCodeAt(0),u=0;u<8;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1}else{for(y=1,u=0;u<p;u++)E=E<<1|y,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=0;for(y=O.charCodeAt(0),u=0;u<16;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1}d--,d==0&&(d=Math.pow(2,p),p++),delete w[O]}else for(y=T[O],u=0;u<p;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1;d--,d==0&&(d=Math.pow(2,p),p++)}for(y=2,u=0;u<p;u++)E=E<<1|y&1,R==h-1?(R=0,x.push(v(E)),E=0):R++,y=y>>1;for(;;)if(E=E<<1,R==h-1){x.push(v(E));break}else R++;return x.join("")},decompress:function(f){return f==null?"":f==""?null:l._decompress(f.length,32768,function(h){return f.charCodeAt(h)})},_decompress:function(f,h,v){var u=[],y=4,T=4,w=3,I="",S=[],O,d,g,p,x,E,R,D={val:v(0),position:h,index:1};for(O=0;O<3;O+=1)u[O]=O;for(g=0,x=Math.pow(2,2),E=1;E!=x;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=v(D.index++)),g|=(p>0?1:0)*E,E<<=1;switch(g){case 0:for(g=0,x=Math.pow(2,8),E=1;E!=x;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=v(D.index++)),g|=(p>0?1:0)*E,E<<=1;R=t(g);break;case 1:for(g=0,x=Math.pow(2,16),E=1;E!=x;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=v(D.index++)),g|=(p>0?1:0)*E,E<<=1;R=t(g);break;case 2:return""}for(u[3]=R,d=R,S.push(R);;){if(D.index>f)return"";for(g=0,x=Math.pow(2,w),E=1;E!=x;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=v(D.index++)),g|=(p>0?1:0)*E,E<<=1;switch(R=g){case 0:for(g=0,x=Math.pow(2,8),E=1;E!=x;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=v(D.index++)),g|=(p>0?1:0)*E,E<<=1;u[T++]=t(g),R=T-1,y--;break;case 1:for(g=0,x=Math.pow(2,16),E=1;E!=x;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=v(D.index++)),g|=(p>0?1:0)*E,E<<=1;u[T++]=t(g),R=T-1,y--;break;case 2:return S.join("")}if(y==0&&(y=Math.pow(2,w),w++),u[R])I=u[R];else if(R===T)I=d+d.charAt(0);else return null;S.push(I),u[T++]=d+I.charAt(0),y--,d=I,y==0&&(y=Math.pow(2,w),w++)}}};return l}();i!=null?i.exports=e:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return e})}(Vo);var zf=Vo.exports;function ti(i){return JSON.parse(zf.decompress(i))}function hr(i){return zf.compress(JSON.stringify(i))}var $f={exports:{}};(function(i){(function(){var e={};e.version="6.4.2.2",e.use_lines=!0,e.use_xyz=!1;var t=!1;i.exports?(i.exports=e,t=!0):typeof document<"u"?window.ClipperLib=e:self.ClipperLib=e;var r;if(t){var n="chrome";r="Netscape"}else{var n=navigator.userAgent.toString().toLowerCase();r=navigator.appName}var s={};n.indexOf("chrome")!=-1&&n.indexOf("chromium")==-1?s.chrome=1:s.chrome=0,n.indexOf("chromium")!=-1?s.chromium=1:s.chromium=0,n.indexOf("safari")!=-1&&n.indexOf("chrome")==-1&&n.indexOf("chromium")==-1?s.safari=1:s.safari=0,n.indexOf("firefox")!=-1?s.firefox=1:s.firefox=0,n.indexOf("firefox/17")!=-1?s.firefox17=1:s.firefox17=0,n.indexOf("firefox/15")!=-1?s.firefox15=1:s.firefox15=0,n.indexOf("firefox/3")!=-1?s.firefox3=1:s.firefox3=0,n.indexOf("opera")!=-1?s.opera=1:s.opera=0,n.indexOf("msie 10")!=-1?s.msie10=1:s.msie10=0,n.indexOf("msie 9")!=-1?s.msie9=1:s.msie9=0,n.indexOf("msie 8")!=-1?s.msie8=1:s.msie8=0,n.indexOf("msie 7")!=-1?s.msie7=1:s.msie7=0,n.indexOf("msie ")!=-1?s.msie=1:s.msie=0,e.biginteger_used=null;var c;function l(a,P,A){e.biginteger_used=1,a!=null&&(typeof a=="number"&&typeof P>"u"?this.fromInt(a):typeof a=="number"?this.fromNumber(a,P,A):P==null&&typeof a!="string"?this.fromString(a,256):this.fromString(a,P))}function f(){return new l(null,void 0,void 0)}function h(a,P,A,F,j,_){for(;--_>=0;){var st=P*this[a++]+A[F]+j;j=Math.floor(st/67108864),A[F++]=st&67108863}return j}function v(a,P,A,F,j,_){for(var st=P&32767,St=P>>15;--_>=0;){var Pt=this[a]&32767,Bt=this[a++]>>15,Ht=St*Pt+Bt*st;Pt=st*Pt+((Ht&32767)<<15)+A[F]+(j&1073741823),j=(Pt>>>30)+(Ht>>>15)+St*Bt+(j>>>30),A[F++]=Pt&1073741823}return j}function u(a,P,A,F,j,_){for(var st=P&16383,St=P>>14;--_>=0;){var Pt=this[a]&16383,Bt=this[a++]>>14,Ht=St*Pt+Bt*st;Pt=st*Pt+((Ht&16383)<<14)+A[F]+j,j=(Pt>>28)+(Ht>>14)+St*Bt,A[F++]=Pt&268435455}return j}r=="Microsoft Internet Explorer"?(l.prototype.am=v,c=30):r!="Netscape"?(l.prototype.am=h,c=26):(l.prototype.am=u,c=28),l.prototype.DB=c,l.prototype.DM=(1<<c)-1,l.prototype.DV=1<<c;var y=52;l.prototype.FV=Math.pow(2,y),l.prototype.F1=y-c,l.prototype.F2=2*c-y;var T="0123456789abcdefghijklmnopqrstuvwxyz",w=new Array,I,S;for(I=48,S=0;S<=9;++S)w[I++]=S;for(I=97,S=10;S<36;++S)w[I++]=S;for(I=65,S=10;S<36;++S)w[I++]=S;function O(a){return T.charAt(a)}function d(a,P){var A=w[a.charCodeAt(P)];return A??-1}function g(a){for(var P=this.t-1;P>=0;--P)a[P]=this[P];a.t=this.t,a.s=this.s}function p(a){this.t=1,this.s=a<0?-1:0,a>0?this[0]=a:a<-1?this[0]=a+this.DV:this.t=0}function x(a){var P=f();return P.fromInt(a),P}function E(a,P){var A;if(P==16)A=4;else if(P==8)A=3;else if(P==256)A=8;else if(P==2)A=1;else if(P==32)A=5;else if(P==4)A=2;else{this.fromRadix(a,P);return}this.t=0,this.s=0;for(var F=a.length,j=!1,_=0;--F>=0;){var st=A==8?a[F]&255:d(a,F);if(st<0){a.charAt(F)=="-"&&(j=!0);continue}j=!1,_==0?this[this.t++]=st:_+A>this.DB?(this[this.t-1]|=(st&(1<<this.DB-_)-1)<<_,this[this.t++]=st>>this.DB-_):this[this.t-1]|=st<<_,_+=A,_>=this.DB&&(_-=this.DB)}A==8&&a[0]&128&&(this.s=-1,_>0&&(this[this.t-1]|=(1<<this.DB-_)-1<<_)),this.clamp(),j&&l.ZERO.subTo(this,this)}function R(){for(var a=this.s&this.DM;this.t>0&&this[this.t-1]==a;)--this.t}function D(a){if(this.s<0)return"-"+this.negate().toString(a);var P;if(a==16)P=4;else if(a==8)P=3;else if(a==2)P=1;else if(a==32)P=5;else if(a==4)P=2;else return this.toRadix(a);var A=(1<<P)-1,F,j=!1,_="",st=this.t,St=this.DB-st*this.DB%P;if(st-- >0)for(St<this.DB&&(F=this[st]>>St)>0&&(j=!0,_=O(F));st>=0;)St<P?(F=(this[st]&(1<<St)-1)<<P-St,F|=this[--st]>>(St+=this.DB-P)):(F=this[st]>>(St-=P)&A,St<=0&&(St+=this.DB,--st)),F>0&&(j=!0),j&&(_+=O(F));return j?_:"0"}function U(){var a=f();return l.ZERO.subTo(this,a),a}function M(){return this.s<0?this.negate():this}function W(a){var P=this.s-a.s;if(P!=0)return P;var A=this.t;if(P=A-a.t,P!=0)return this.s<0?-P:P;for(;--A>=0;)if((P=this[A]-a[A])!=0)return P;return 0}function X(a){var P=1,A;return(A=a>>>16)!=0&&(a=A,P+=16),(A=a>>8)!=0&&(a=A,P+=8),(A=a>>4)!=0&&(a=A,P+=4),(A=a>>2)!=0&&(a=A,P+=2),(A=a>>1)!=0&&(a=A,P+=1),P}function B(){return this.t<=0?0:this.DB*(this.t-1)+X(this[this.t-1]^this.s&this.DM)}function N(a,P){var A;for(A=this.t-1;A>=0;--A)P[A+a]=this[A];for(A=a-1;A>=0;--A)P[A]=0;P.t=this.t+a,P.s=this.s}function $(a,P){for(var A=a;A<this.t;++A)P[A-a]=this[A];P.t=Math.max(this.t-a,0),P.s=this.s}function J(a,P){var A=a%this.DB,F=this.DB-A,j=(1<<F)-1,_=Math.floor(a/this.DB),st=this.s<<A&this.DM,St;for(St=this.t-1;St>=0;--St)P[St+_+1]=this[St]>>F|st,st=(this[St]&j)<<A;for(St=_-1;St>=0;--St)P[St]=0;P[_]=st,P.t=this.t+_+1,P.s=this.s,P.clamp()}function tt(a,P){P.s=this.s;var A=Math.floor(a/this.DB);if(A>=this.t){P.t=0;return}var F=a%this.DB,j=this.DB-F,_=(1<<F)-1;P[0]=this[A]>>F;for(var st=A+1;st<this.t;++st)P[st-A-1]|=(this[st]&_)<<j,P[st-A]=this[st]>>F;F>0&&(P[this.t-A-1]|=(this.s&_)<<j),P.t=this.t-A,P.clamp()}function at(a,P){for(var A=0,F=0,j=Math.min(a.t,this.t);A<j;)F+=this[A]-a[A],P[A++]=F&this.DM,F>>=this.DB;if(a.t<this.t){for(F-=a.s;A<this.t;)F+=this[A],P[A++]=F&this.DM,F>>=this.DB;F+=this.s}else{for(F+=this.s;A<a.t;)F-=a[A],P[A++]=F&this.DM,F>>=this.DB;F-=a.s}P.s=F<0?-1:0,F<-1?P[A++]=this.DV+F:F>0&&(P[A++]=F),P.t=A,P.clamp()}function ut(a,P){var A=this.abs(),F=a.abs(),j=A.t;for(P.t=j+F.t;--j>=0;)P[j]=0;for(j=0;j<F.t;++j)P[j+A.t]=A.am(0,F[j],P,j,0,A.t);P.s=0,P.clamp(),this.s!=a.s&&l.ZERO.subTo(P,P)}function V(a){for(var P=this.abs(),A=a.t=2*P.t;--A>=0;)a[A]=0;for(A=0;A<P.t-1;++A){var F=P.am(A,P[A],a,2*A,0,1);(a[A+P.t]+=P.am(A+1,2*P[A],a,2*A+1,F,P.t-A-1))>=P.DV&&(a[A+P.t]-=P.DV,a[A+P.t+1]=1)}a.t>0&&(a[a.t-1]+=P.am(A,P[A],a,2*A,0,1)),a.s=0,a.clamp()}function Q(a,P,A){var F=a.abs();if(!(F.t<=0)){var j=this.abs();if(j.t<F.t){P!=null&&P.fromInt(0),A!=null&&this.copyTo(A);return}A==null&&(A=f());var _=f(),st=this.s,St=a.s,Pt=this.DB-X(F[F.t-1]);Pt>0?(F.lShiftTo(Pt,_),j.lShiftTo(Pt,A)):(F.copyTo(_),j.copyTo(A));var Bt=_.t,Ht=_[Bt-1];if(Ht!=0){var jt=Ht*(1<<this.F1)+(Bt>1?_[Bt-2]>>this.F2:0),qt=this.FV/jt,oe=(1<<this.F1)/jt,me=1<<this.F2,Se=A.t,De=Se-Bt,lr=P??f();for(_.dlShiftTo(De,lr),A.compareTo(lr)>=0&&(A[A.t++]=1,A.subTo(lr,A)),l.ONE.dlShiftTo(Bt,lr),lr.subTo(_,_);_.t<Bt;)_[_.t++]=0;for(;--De>=0;){var br=A[--Se]==Ht?this.DM:Math.floor(A[Se]*qt+(A[Se-1]+me)*oe);if((A[Se]+=_.am(0,br,A,De,0,Bt))<br)for(_.dlShiftTo(De,lr),A.subTo(lr,A);A[Se]<--br;)A.subTo(lr,A)}P!=null&&(A.drShiftTo(Bt,P),st!=St&&l.ZERO.subTo(P,P)),A.t=Bt,A.clamp(),Pt>0&&A.rShiftTo(Pt,A),st<0&&l.ZERO.subTo(A,A)}}}function ft(a){var P=f();return this.abs().divRemTo(a,null,P),this.s<0&&P.compareTo(l.ZERO)>0&&a.subTo(P,P),P}function mt(a){this.m=a}function yt(a){return a.s<0||a.compareTo(this.m)>=0?a.mod(this.m):a}function wt(a){return a}function ht(a){a.divRemTo(this.m,null,a)}function Nt(a,P,A){a.multiplyTo(P,A),this.reduce(A)}function Dt(a,P){a.squareTo(P),this.reduce(P)}mt.prototype.convert=yt,mt.prototype.revert=wt,mt.prototype.reduce=ht,mt.prototype.mulTo=Nt,mt.prototype.sqrTo=Dt;function G(){if(this.t<1)return 0;var a=this[0];if(!(a&1))return 0;var P=a&3;return P=P*(2-(a&15)*P)&15,P=P*(2-(a&255)*P)&255,P=P*(2-((a&65535)*P&65535))&65535,P=P*(2-a*P%this.DV)%this.DV,P>0?this.DV-P:-P}function k(a){this.m=a,this.mp=a.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<a.DB-15)-1,this.mt2=2*a.t}function rt(a){var P=f();return a.abs().dlShiftTo(this.m.t,P),P.divRemTo(this.m,null,P),a.s<0&&P.compareTo(l.ZERO)>0&&this.m.subTo(P,P),P}function nt(a){var P=f();return a.copyTo(P),this.reduce(P),P}function Y(a){for(;a.t<=this.mt2;)a[a.t++]=0;for(var P=0;P<this.m.t;++P){var A=a[P]&32767,F=A*this.mpl+((A*this.mph+(a[P]>>15)*this.mpl&this.um)<<15)&a.DM;for(A=P+this.m.t,a[A]+=this.m.am(0,F,a,P,0,this.m.t);a[A]>=a.DV;)a[A]-=a.DV,a[++A]++}a.clamp(),a.drShiftTo(this.m.t,a),a.compareTo(this.m)>=0&&a.subTo(this.m,a)}function Z(a,P){a.squareTo(P),this.reduce(P)}function C(a,P,A){a.multiplyTo(P,A),this.reduce(A)}k.prototype.convert=rt,k.prototype.revert=nt,k.prototype.reduce=Y,k.prototype.mulTo=C,k.prototype.sqrTo=Z;function L(){return(this.t>0?this[0]&1:this.s)==0}function z(a,P){if(a>4294967295||a<1)return l.ONE;var A=f(),F=f(),j=P.convert(this),_=X(a)-1;for(j.copyTo(A);--_>=0;)if(P.sqrTo(A,F),(a&1<<_)>0)P.mulTo(F,j,A);else{var st=A;A=F,F=st}return P.revert(A)}function K(a,P){var A;return a<256||P.isEven()?A=new mt(P):A=new k(P),this.exp(a,A)}l.prototype.copyTo=g,l.prototype.fromInt=p,l.prototype.fromString=E,l.prototype.clamp=R,l.prototype.dlShiftTo=N,l.prototype.drShiftTo=$,l.prototype.lShiftTo=J,l.prototype.rShiftTo=tt,l.prototype.subTo=at,l.prototype.multiplyTo=ut,l.prototype.squareTo=V,l.prototype.divRemTo=Q,l.prototype.invDigit=G,l.prototype.isEven=L,l.prototype.exp=z,l.prototype.toString=D,l.prototype.negate=U,l.prototype.abs=M,l.prototype.compareTo=W,l.prototype.bitLength=B,l.prototype.mod=ft,l.prototype.modPowInt=K,l.ZERO=x(0),l.ONE=x(1);function q(){var a=f();return this.copyTo(a),a}function it(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function ct(){return this.t==0?this.s:this[0]<<24>>24}function Tt(){return this.t==0?this.s:this[0]<<16>>16}function Ct(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function Mt(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function bt(a){if(a==null&&(a=10),this.signum()==0||a<2||a>36)return"0";var P=this.chunkSize(a),A=Math.pow(a,P),F=x(A),j=f(),_=f(),st="";for(this.divRemTo(F,j,_);j.signum()>0;)st=(A+_.intValue()).toString(a).substr(1)+st,j.divRemTo(F,j,_);return _.intValue().toString(a)+st}function At(a,P){this.fromInt(0),P==null&&(P=10);for(var A=this.chunkSize(P),F=Math.pow(P,A),j=!1,_=0,st=0,St=0;St<a.length;++St){var Pt=d(a,St);if(Pt<0){a.charAt(St)=="-"&&this.signum()==0&&(j=!0);continue}st=P*st+Pt,++_>=A&&(this.dMultiply(F),this.dAddOffset(st,0),_=0,st=0)}_>0&&(this.dMultiply(Math.pow(P,_)),this.dAddOffset(st,0)),j&&l.ZERO.subTo(this,this)}function Ot(a,P,A){if(typeof P=="number")if(a<2)this.fromInt(1);else for(this.fromNumber(a,A),this.testBit(a-1)||this.bitwiseTo(l.ONE.shiftLeft(a-1),ne,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(P);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(l.ONE.shiftLeft(a-1),this);else{var F=new Array,j=a&7;F.length=(a>>3)+1,P.nextBytes(F),j>0?F[0]&=(1<<j)-1:F[0]=0,this.fromString(F,256)}}function Lt(){var a=this.t,P=new Array;P[0]=this.s;var A=this.DB-a*this.DB%8,F,j=0;if(a-- >0)for(A<this.DB&&(F=this[a]>>A)!=(this.s&this.DM)>>A&&(P[j++]=F|this.s<<this.DB-A);a>=0;)A<8?(F=(this[a]&(1<<A)-1)<<8-A,F|=this[--a]>>(A+=this.DB-8)):(F=this[a]>>(A-=8)&255,A<=0&&(A+=this.DB,--a)),F&128&&(F|=-256),j==0&&(this.s&128)!=(F&128)&&++j,(j>0||F!=this.s)&&(P[j++]=F);return P}function Xt(a){return this.compareTo(a)==0}function $t(a){return this.compareTo(a)<0?this:a}function Wt(a){return this.compareTo(a)>0?this:a}function Qt(a,P,A){var F,j,_=Math.min(a.t,this.t);for(F=0;F<_;++F)A[F]=P(this[F],a[F]);if(a.t<this.t){for(j=a.s&this.DM,F=_;F<this.t;++F)A[F]=P(this[F],j);A.t=this.t}else{for(j=this.s&this.DM,F=_;F<a.t;++F)A[F]=P(j,a[F]);A.t=a.t}A.s=P(this.s,a.s),A.clamp()}function ue(a,P){return a&P}function ie(a){var P=f();return this.bitwiseTo(a,ue,P),P}function ne(a,P){return a|P}function ae(a){var P=f();return this.bitwiseTo(a,ne,P),P}function se(a,P){return a^P}function Ge(a){var P=f();return this.bitwiseTo(a,se,P),P}function Fe(a,P){return a&~P}function ze(a){var P=f();return this.bitwiseTo(a,Fe,P),P}function Ue(){for(var a=f(),P=0;P<this.t;++P)a[P]=this.DM&~this[P];return a.t=this.t,a.s=~this.s,a}function ke(a){var P=f();return a<0?this.rShiftTo(-a,P):this.lShiftTo(a,P),P}function Ve(a){var P=f();return a<0?this.lShiftTo(-a,P):this.rShiftTo(a,P),P}function qe(a){if(a==0)return-1;var P=0;return a&65535||(a>>=16,P+=16),a&255||(a>>=8,P+=8),a&15||(a>>=4,P+=4),a&3||(a>>=2,P+=2),a&1||++P,P}function we(){for(var a=0;a<this.t;++a)if(this[a]!=0)return a*this.DB+qe(this[a]);return this.s<0?this.t*this.DB:-1}function pr(a){for(var P=0;a!=0;)a&=a-1,++P;return P}function Jr(){for(var a=0,P=this.s&this.DM,A=0;A<this.t;++A)a+=pr(this[A]^P);return a}function sn(a){var P=Math.floor(a/this.DB);return P>=this.t?this.s!=0:(this[P]&1<<a%this.DB)!=0}function li(a,P){var A=l.ONE.shiftLeft(a);return this.bitwiseTo(A,P,A),A}function fi(a){return this.changeBit(a,ne)}function Ui(a){return this.changeBit(a,Fe)}function fa(a){return this.changeBit(a,se)}function Yi(a,P){for(var A=0,F=0,j=Math.min(a.t,this.t);A<j;)F+=this[A]+a[A],P[A++]=F&this.DM,F>>=this.DB;if(a.t<this.t){for(F+=a.s;A<this.t;)F+=this[A],P[A++]=F&this.DM,F>>=this.DB;F+=this.s}else{for(F+=this.s;A<a.t;)F+=a[A],P[A++]=F&this.DM,F>>=this.DB;F+=a.s}P.s=F<0?-1:0,F>0?P[A++]=F:F<-1&&(P[A++]=this.DV+F),P.t=A,P.clamp()}function ca(a){var P=f();return this.addTo(a,P),P}function ua(a){var P=f();return this.subTo(a,P),P}function ha(a){var P=f();return this.multiplyTo(a,P),P}function da(){var a=f();return this.squareTo(a),a}function pa(a){var P=f();return this.divRemTo(a,P,null),P}function va(a){var P=f();return this.divRemTo(a,null,P),P}function ga(a){var P=f(),A=f();return this.divRemTo(a,P,A),new Array(P,A)}function ma(a){this[this.t]=this.am(0,a-1,this,0,0,this.t),++this.t,this.clamp()}function bs(a,P){if(a!=0){for(;this.t<=P;)this[this.t++]=0;for(this[P]+=a;this[P]>=this.DV;)this[P]-=this.DV,++P>=this.t&&(this[this.t++]=0),++this[P]}}function Fn(){}function Ds(a){return a}function ya(a,P,A){a.multiplyTo(P,A)}function Sa(a,P){a.squareTo(P)}Fn.prototype.convert=Ds,Fn.prototype.revert=Ds,Fn.prototype.mulTo=ya,Fn.prototype.sqrTo=Sa;function Pa(a){return this.exp(a,new Fn)}function xa(a,P,A){var F=Math.min(this.t+a.t,P);for(A.s=0,A.t=F;F>0;)A[--F]=0;var j;for(j=A.t-this.t;F<j;++F)A[F+this.t]=this.am(0,a[F],A,F,0,this.t);for(j=Math.min(a.t,P);F<j;++F)this.am(0,a[F],A,F,0,P-F);A.clamp()}function ci(a,P,A){--P;var F=A.t=this.t+a.t-P;for(A.s=0;--F>=0;)A[F]=0;for(F=Math.max(P-this.t,0);F<a.t;++F)A[this.t+F-P]=this.am(P-F,a[F],A,0,0,this.t+F-P);A.clamp(),A.drShiftTo(1,A)}function xn(a){this.r2=f(),this.q3=f(),l.ONE.dlShiftTo(2*a.t,this.r2),this.mu=this.r2.divide(a),this.m=a}function ui(a){if(a.s<0||a.t>2*this.m.t)return a.mod(this.m);if(a.compareTo(this.m)<0)return a;var P=f();return a.copyTo(P),this.reduce(P),P}function Ta(a){return a}function Ca(a){for(a.drShiftTo(this.m.t-1,this.r2),a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);a.compareTo(this.r2)<0;)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);a.compareTo(this.m)>=0;)a.subTo(this.m,a)}function Ia(a,P){a.squareTo(P),this.reduce(P)}function Ns(a,P,A){a.multiplyTo(P,A),this.reduce(A)}xn.prototype.convert=ui,xn.prototype.revert=Ta,xn.prototype.reduce=Ca,xn.prototype.mulTo=Ns,xn.prototype.sqrTo=Ia;function Bs(a,P){var A=a.bitLength(),F,j=x(1),_;if(A<=0)return j;A<18?F=1:A<48?F=3:A<144?F=4:A<768?F=5:F=6,A<8?_=new mt(P):P.isEven()?_=new xn(P):_=new k(P);var st=new Array,St=3,Pt=F-1,Bt=(1<<F)-1;if(st[1]=_.convert(this),F>1){var Ht=f();for(_.sqrTo(st[1],Ht);St<=Bt;)st[St]=f(),_.mulTo(Ht,st[St-2],st[St]),St+=2}var jt=a.t-1,qt,oe=!0,me=f(),Se;for(A=X(a[jt])-1;jt>=0;){for(A>=Pt?qt=a[jt]>>A-Pt&Bt:(qt=(a[jt]&(1<<A+1)-1)<<Pt-A,jt>0&&(qt|=a[jt-1]>>this.DB+A-Pt)),St=F;!(qt&1);)qt>>=1,--St;if((A-=St)<0&&(A+=this.DB,--jt),oe)st[qt].copyTo(j),oe=!1;else{for(;St>1;)_.sqrTo(j,me),_.sqrTo(me,j),St-=2;St>0?_.sqrTo(j,me):(Se=j,j=me,me=Se),_.mulTo(me,st[qt],j)}for(;jt>=0&&!(a[jt]&1<<A);)_.sqrTo(j,me),Se=j,j=me,me=Se,--A<0&&(A=this.DB-1,--jt)}return _.revert(j)}function Ws(a){var P=this.s<0?this.negate():this.clone(),A=a.s<0?a.negate():a.clone();if(P.compareTo(A)<0){var F=P;P=A,A=F}var j=P.getLowestSetBit(),_=A.getLowestSetBit();if(_<0)return P;for(j<_&&(_=j),_>0&&(P.rShiftTo(_,P),A.rShiftTo(_,A));P.signum()>0;)(j=P.getLowestSetBit())>0&&P.rShiftTo(j,P),(j=A.getLowestSetBit())>0&&A.rShiftTo(j,A),P.compareTo(A)>=0?(P.subTo(A,P),P.rShiftTo(1,P)):(A.subTo(P,A),A.rShiftTo(1,A));return _>0&&A.lShiftTo(_,A),A}function Oa(a){if(a<=0)return 0;var P=this.DV%a,A=this.s<0?a-1:0;if(this.t>0)if(P==0)A=this[0]%a;else for(var F=this.t-1;F>=0;--F)A=(P*A+this[F])%a;return A}function wa(a){var P=a.isEven();if(this.isEven()&&P||a.signum()==0)return l.ZERO;for(var A=a.clone(),F=this.clone(),j=x(1),_=x(0),st=x(0),St=x(1);A.signum()!=0;){for(;A.isEven();)A.rShiftTo(1,A),P?((!j.isEven()||!_.isEven())&&(j.addTo(this,j),_.subTo(a,_)),j.rShiftTo(1,j)):_.isEven()||_.subTo(a,_),_.rShiftTo(1,_);for(;F.isEven();)F.rShiftTo(1,F),P?((!st.isEven()||!St.isEven())&&(st.addTo(this,st),St.subTo(a,St)),st.rShiftTo(1,st)):St.isEven()||St.subTo(a,St),St.rShiftTo(1,St);A.compareTo(F)>=0?(A.subTo(F,A),P&&j.subTo(st,j),_.subTo(St,_)):(F.subTo(A,F),P&&st.subTo(j,st),St.subTo(_,St))}if(F.compareTo(l.ONE)!=0)return l.ZERO;if(St.compareTo(a)>=0)return St.subtract(a);if(St.signum()<0)St.addTo(a,St);else return St;return St.signum()<0?St.add(a):St}var ir=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Aa=(1<<26)/ir[ir.length-1];function Fs(a){var P,A=this.abs();if(A.t==1&&A[0]<=ir[ir.length-1]){for(P=0;P<ir.length;++P)if(A[0]==ir[P])return!0;return!1}if(A.isEven())return!1;for(P=1;P<ir.length;){for(var F=ir[P],j=P+1;j<ir.length&&F<Aa;)F*=ir[j++];for(F=A.modInt(F);P<j;)if(F%ir[P++]==0)return!1}return A.millerRabin(a)}function Us(a){var P=this.subtract(l.ONE),A=P.getLowestSetBit();if(A<=0)return!1;var F=P.shiftRight(A);a=a+1>>1,a>ir.length&&(a=ir.length);for(var j=f(),_=0;_<a;++_){j.fromInt(ir[Math.floor(Math.random()*ir.length)]);var st=j.modPow(F,this);if(st.compareTo(l.ONE)!=0&&st.compareTo(P)!=0){for(var St=1;St++<A&&st.compareTo(P)!=0;)if(st=st.modPowInt(2,this),st.compareTo(l.ONE)==0)return!1;if(st.compareTo(P)!=0)return!1}}return!0}l.prototype.chunkSize=Ct,l.prototype.toRadix=bt,l.prototype.fromRadix=At,l.prototype.fromNumber=Ot,l.prototype.bitwiseTo=Qt,l.prototype.changeBit=li,l.prototype.addTo=Yi,l.prototype.dMultiply=ma,l.prototype.dAddOffset=bs,l.prototype.multiplyLowerTo=xa,l.prototype.multiplyUpperTo=ci,l.prototype.modInt=Oa,l.prototype.millerRabin=Us,l.prototype.clone=q,l.prototype.intValue=it,l.prototype.byteValue=ct,l.prototype.shortValue=Tt,l.prototype.signum=Mt,l.prototype.toByteArray=Lt,l.prototype.equals=Xt,l.prototype.min=$t,l.prototype.max=Wt,l.prototype.and=ie,l.prototype.or=ae,l.prototype.xor=Ge,l.prototype.andNot=ze,l.prototype.not=Ue,l.prototype.shiftLeft=ke,l.prototype.shiftRight=Ve,l.prototype.getLowestSetBit=we,l.prototype.bitCount=Jr,l.prototype.testBit=sn,l.prototype.setBit=fi,l.prototype.clearBit=Ui,l.prototype.flipBit=fa,l.prototype.add=ca,l.prototype.subtract=ua,l.prototype.multiply=ha,l.prototype.divide=pa,l.prototype.remainder=va,l.prototype.divideAndRemainder=ga,l.prototype.modPow=Bs,l.prototype.modInverse=wa,l.prototype.pow=Pa,l.prototype.gcd=Ws,l.prototype.isProbablePrime=Fs,l.prototype.square=da;var ge=l;ge.prototype.IsNegative=function(){return this.compareTo(ge.ZERO)==-1},ge.op_Equality=function(a,P){return a.compareTo(P)==0},ge.op_Inequality=function(a,P){return a.compareTo(P)!=0},ge.op_GreaterThan=function(a,P){return a.compareTo(P)>0},ge.op_LessThan=function(a,P){return a.compareTo(P)<0},ge.op_Addition=function(a,P){return new ge(a,void 0,void 0).add(new ge(P,void 0,void 0))},ge.op_Subtraction=function(a,P){return new ge(a,void 0,void 0).subtract(new ge(P,void 0,void 0))},ge.Int128Mul=function(a,P){return new ge(a,void 0,void 0).multiply(new ge(P,void 0,void 0))},ge.op_Division=function(a,P){return a.divide(P)},ge.prototype.ToDouble=function(){return parseFloat(this.toString())};var hi=function(a,P){var A;if(typeof Object.getOwnPropertyNames>"u"){for(A in P.prototype)(typeof a.prototype[A]>"u"||a.prototype[A]===Object.prototype[A])&&(a.prototype[A]=P.prototype[A]);for(A in P)typeof a[A]>"u"&&(a[A]=P[A]);a.$baseCtor=P}else{for(var F=Object.getOwnPropertyNames(P.prototype),j=0;j<F.length;j++)typeof Object.getOwnPropertyDescriptor(a.prototype,F[j])>"u"&&Object.defineProperty(a.prototype,F[j],Object.getOwnPropertyDescriptor(P.prototype,F[j]));for(A in P)typeof a[A]>"u"&&(a[A]=P[A]);a.$baseCtor=P}};e.Path=function(){return[]},e.Path.prototype.push=Array.prototype.push,e.Paths=function(){return[]},e.Paths.prototype.push=Array.prototype.push,e.DoublePoint=function(){var a=arguments;this.X=0,this.Y=0,a.length===1?(this.X=a[0].X,this.Y=a[0].Y):a.length===2&&(this.X=a[0],this.Y=a[1])},e.DoublePoint0=function(){this.X=0,this.Y=0},e.DoublePoint0.prototype=e.DoublePoint.prototype,e.DoublePoint1=function(a){this.X=a.X,this.Y=a.Y},e.DoublePoint1.prototype=e.DoublePoint.prototype,e.DoublePoint2=function(a,P){this.X=a,this.Y=P},e.DoublePoint2.prototype=e.DoublePoint.prototype,e.PolyNode=function(){this.m_Parent=null,this.m_polygon=new e.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1},e.PolyNode.prototype.IsHoleNode=function(){for(var a=!0,P=this.m_Parent;P!==null;)a=!a,P=P.m_Parent;return a},e.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length},e.PolyNode.prototype.Contour=function(){return this.m_polygon},e.PolyNode.prototype.AddChild=function(a){var P=this.m_Childs.length;this.m_Childs.push(a),a.m_Parent=this,a.m_Index=P},e.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()},e.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]},e.PolyNode.prototype.Childs=function(){return this.m_Childs},e.PolyNode.prototype.Parent=function(){return this.m_Parent},e.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()},e.PolyTree=function(){this.m_AllPolys=[],e.PolyNode.call(this)},e.PolyTree.prototype.Clear=function(){for(var a=0,P=this.m_AllPolys.length;a<P;a++)this.m_AllPolys[a]=null;this.m_AllPolys.length=0,this.m_Childs.length=0},e.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null},e.PolyTree.prototype.Total=function(){var a=this.m_AllPolys.length;return a>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&a--,a},hi(e.PolyTree,e.PolyNode),e.Math_Abs_Int64=e.Math_Abs_Int32=e.Math_Abs_Double=function(a){return Math.abs(a)},e.Math_Max_Int32_Int32=function(a,P){return Math.max(a,P)},s.msie||s.opera||s.safari?e.Cast_Int32=function(a){return a|0}:e.Cast_Int32=function(a){return~~a},typeof Number.toInteger>"u"&&(Number.toInteger=null),s.chrome?e.Cast_Int64=function(a){return a<-2147483648||a>2147483647?a<0?Math.ceil(a):Math.floor(a):~~a}:s.firefox&&typeof Number.toInteger=="function"?e.Cast_Int64=function(a){return Number.toInteger(a)}:s.msie7||s.msie8?e.Cast_Int64=function(a){return parseInt(a,10)}:s.msie?e.Cast_Int64=function(a){return a<-2147483648||a>2147483647?a<0?Math.ceil(a):Math.floor(a):a|0}:e.Cast_Int64=function(a){return a<0?Math.ceil(a):Math.floor(a)},e.Clear=function(a){a.length=0},e.PI=3.141592653589793,e.PI2=2*3.141592653589793,e.IntPoint=function(){var a=arguments,P=a.length;if(this.X=0,this.Y=0,e.use_xyz)if(this.Z=0,P===3)this.X=a[0],this.Y=a[1],this.Z=a[2];else if(P===2)this.X=a[0],this.Y=a[1],this.Z=0;else if(P===1)if(a[0]instanceof e.DoublePoint){var A=a[0];this.X=e.Clipper.Round(A.X),this.Y=e.Clipper.Round(A.Y),this.Z=0}else{var F=a[0];typeof F.Z>"u"&&(F.Z=0),this.X=F.X,this.Y=F.Y,this.Z=F.Z}else this.X=0,this.Y=0,this.Z=0;else if(P===2)this.X=a[0],this.Y=a[1];else if(P===1)if(a[0]instanceof e.DoublePoint){var A=a[0];this.X=e.Clipper.Round(A.X),this.Y=e.Clipper.Round(A.Y)}else{var F=a[0];this.X=F.X,this.Y=F.Y}else this.X=0,this.Y=0},e.IntPoint.op_Equality=function(a,P){return a.X===P.X&&a.Y===P.Y},e.IntPoint.op_Inequality=function(a,P){return a.X!==P.X||a.Y!==P.Y},e.IntPoint0=function(){this.X=0,this.Y=0,e.use_xyz&&(this.Z=0)},e.IntPoint0.prototype=e.IntPoint.prototype,e.IntPoint1=function(a){this.X=a.X,this.Y=a.Y,e.use_xyz&&(typeof a.Z>"u"?this.Z=0:this.Z=a.Z)},e.IntPoint1.prototype=e.IntPoint.prototype,e.IntPoint1dp=function(a){this.X=e.Clipper.Round(a.X),this.Y=e.Clipper.Round(a.Y),e.use_xyz&&(this.Z=0)},e.IntPoint1dp.prototype=e.IntPoint.prototype,e.IntPoint2=function(a,P,A){this.X=a,this.Y=P,e.use_xyz&&(typeof A>"u"?this.Z=0:this.Z=A)},e.IntPoint2.prototype=e.IntPoint.prototype,e.IntRect=function(){var a=arguments,P=a.length;if(P===4)this.left=a[0],this.top=a[1],this.right=a[2],this.bottom=a[3];else if(P===1){var A=a[0];this.left=A.left,this.top=A.top,this.right=A.right,this.bottom=A.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0},e.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0},e.IntRect0.prototype=e.IntRect.prototype,e.IntRect1=function(a){this.left=a.left,this.top=a.top,this.right=a.right,this.bottom=a.bottom},e.IntRect1.prototype=e.IntRect.prototype,e.IntRect4=function(a,P,A,F){this.left=a,this.top=P,this.right=A,this.bottom=F},e.IntRect4.prototype=e.IntRect.prototype,e.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},e.PolyType={ptSubject:0,ptClip:1},e.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},e.JoinType={jtSquare:0,jtRound:1,jtMiter:2},e.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},e.EdgeSide={esLeft:0,esRight:1},e.Direction={dRightToLeft:0,dLeftToRight:1},e.TEdge=function(){this.Bot=new e.IntPoint0,this.Curr=new e.IntPoint0,this.Top=new e.IntPoint0,this.Delta=new e.IntPoint0,this.Dx=0,this.PolyTyp=e.PolyType.ptSubject,this.Side=e.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null},e.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new e.IntPoint0},e.MyIntersectNodeSort=function(){},e.MyIntersectNodeSort.Compare=function(a,P){var A=P.Pt.Y-a.Pt.Y;return A>0?1:A<0?-1:0},e.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null},e.Scanbeam=function(){this.Y=0,this.Next=null},e.Maxima=function(){this.X=0,this.Next=null,this.Prev=null},e.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null},e.OutPt=function(){this.Idx=0,this.Pt=new e.IntPoint0,this.Next=null,this.Prev=null},e.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new e.IntPoint0},e.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null},e.ClipperBase.horizontal=-9007199254740992,e.ClipperBase.Skip=-2,e.ClipperBase.Unassigned=-1,e.ClipperBase.tolerance=1e-20,e.ClipperBase.loRange=47453132,e.ClipperBase.hiRange=0xfffffffffffff,e.ClipperBase.near_zero=function(a){return a>-e.ClipperBase.tolerance&&a<e.ClipperBase.tolerance},e.ClipperBase.IsHorizontal=function(a){return a.Delta.Y===0},e.ClipperBase.prototype.PointIsVertex=function(a,P){var A=P;do{if(e.IntPoint.op_Equality(A.Pt,a))return!0;A=A.Next}while(A!==P);return!1},e.ClipperBase.prototype.PointOnLineSegment=function(a,P,A,F){return F?a.X===P.X&&a.Y===P.Y||a.X===A.X&&a.Y===A.Y||a.X>P.X==a.X<A.X&&a.Y>P.Y==a.Y<A.Y&&ge.op_Equality(ge.Int128Mul(a.X-P.X,A.Y-P.Y),ge.Int128Mul(A.X-P.X,a.Y-P.Y)):a.X===P.X&&a.Y===P.Y||a.X===A.X&&a.Y===A.Y||a.X>P.X==a.X<A.X&&a.Y>P.Y==a.Y<A.Y&&(a.X-P.X)*(A.Y-P.Y)===(A.X-P.X)*(a.Y-P.Y)},e.ClipperBase.prototype.PointOnPolygon=function(a,P,A){for(var F=P;;){if(this.PointOnLineSegment(a,F.Pt,F.Next.Pt,A))return!0;if(F=F.Next,F===P)break}return!1},e.ClipperBase.prototype.SlopesEqual=e.ClipperBase.SlopesEqual=function(){var a=arguments,P=a.length,A,F,j,_,st,St,Pt;return P===3?(A=a[0],F=a[1],Pt=a[2],Pt?ge.op_Equality(ge.Int128Mul(A.Delta.Y,F.Delta.X),ge.Int128Mul(A.Delta.X,F.Delta.Y)):e.Cast_Int64(A.Delta.Y*F.Delta.X)===e.Cast_Int64(A.Delta.X*F.Delta.Y)):P===4?(j=a[0],_=a[1],st=a[2],Pt=a[3],Pt?ge.op_Equality(ge.Int128Mul(j.Y-_.Y,_.X-st.X),ge.Int128Mul(j.X-_.X,_.Y-st.Y)):e.Cast_Int64((j.Y-_.Y)*(_.X-st.X))-e.Cast_Int64((j.X-_.X)*(_.Y-st.Y))===0):(j=a[0],_=a[1],st=a[2],St=a[3],Pt=a[4],Pt?ge.op_Equality(ge.Int128Mul(j.Y-_.Y,st.X-St.X),ge.Int128Mul(j.X-_.X,st.Y-St.Y)):e.Cast_Int64((j.Y-_.Y)*(st.X-St.X))-e.Cast_Int64((j.X-_.X)*(st.Y-St.Y))===0)},e.ClipperBase.SlopesEqual3=function(a,P,A){return A?ge.op_Equality(ge.Int128Mul(a.Delta.Y,P.Delta.X),ge.Int128Mul(a.Delta.X,P.Delta.Y)):e.Cast_Int64(a.Delta.Y*P.Delta.X)===e.Cast_Int64(a.Delta.X*P.Delta.Y)},e.ClipperBase.SlopesEqual4=function(a,P,A,F){return F?ge.op_Equality(ge.Int128Mul(a.Y-P.Y,P.X-A.X),ge.Int128Mul(a.X-P.X,P.Y-A.Y)):e.Cast_Int64((a.Y-P.Y)*(P.X-A.X))-e.Cast_Int64((a.X-P.X)*(P.Y-A.Y))===0},e.ClipperBase.SlopesEqual5=function(a,P,A,F,j){return j?ge.op_Equality(ge.Int128Mul(a.Y-P.Y,A.X-F.X),ge.Int128Mul(a.X-P.X,A.Y-F.Y)):e.Cast_Int64((a.Y-P.Y)*(A.X-F.X))-e.Cast_Int64((a.X-P.X)*(A.Y-F.Y))===0},e.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var a=0,P=this.m_edges.length;a<P;++a){for(var A=0,F=this.m_edges[a].length;A<F;++A)this.m_edges[a][A]=null;e.Clear(this.m_edges[a])}e.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1},e.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var a=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=a}this.m_CurrentLM=null},e.ClipperBase.prototype.RangeTest=function(a,P){P.Value?(a.X>e.ClipperBase.hiRange||a.Y>e.ClipperBase.hiRange||-a.X>e.ClipperBase.hiRange||-a.Y>e.ClipperBase.hiRange)&&e.Error("Coordinate outside allowed range in RangeTest()."):(a.X>e.ClipperBase.loRange||a.Y>e.ClipperBase.loRange||-a.X>e.ClipperBase.loRange||-a.Y>e.ClipperBase.loRange)&&(P.Value=!0,this.RangeTest(a,P))},e.ClipperBase.prototype.InitEdge=function(a,P,A,F){a.Next=P,a.Prev=A,a.Curr.X=F.X,a.Curr.Y=F.Y,e.use_xyz&&(a.Curr.Z=F.Z),a.OutIdx=-1},e.ClipperBase.prototype.InitEdge2=function(a,P){a.Curr.Y>=a.Next.Curr.Y?(a.Bot.X=a.Curr.X,a.Bot.Y=a.Curr.Y,e.use_xyz&&(a.Bot.Z=a.Curr.Z),a.Top.X=a.Next.Curr.X,a.Top.Y=a.Next.Curr.Y,e.use_xyz&&(a.Top.Z=a.Next.Curr.Z)):(a.Top.X=a.Curr.X,a.Top.Y=a.Curr.Y,e.use_xyz&&(a.Top.Z=a.Curr.Z),a.Bot.X=a.Next.Curr.X,a.Bot.Y=a.Next.Curr.Y,e.use_xyz&&(a.Bot.Z=a.Next.Curr.Z)),this.SetDx(a),a.PolyTyp=P},e.ClipperBase.prototype.FindNextLocMin=function(a){for(var P;;){for(;e.IntPoint.op_Inequality(a.Bot,a.Prev.Bot)||e.IntPoint.op_Equality(a.Curr,a.Top);)a=a.Next;if(a.Dx!==e.ClipperBase.horizontal&&a.Prev.Dx!==e.ClipperBase.horizontal)break;for(;a.Prev.Dx===e.ClipperBase.horizontal;)a=a.Prev;for(P=a;a.Dx===e.ClipperBase.horizontal;)a=a.Next;if(a.Top.Y!==a.Prev.Bot.Y){P.Prev.Bot.X<a.Bot.X&&(a=P);break}}return a},e.ClipperBase.prototype.ProcessBound=function(a,P){var A,F=a,j;if(F.OutIdx===e.ClipperBase.Skip){if(a=F,P){for(;a.Top.Y===a.Next.Bot.Y;)a=a.Next;for(;a!==F&&a.Dx===e.ClipperBase.horizontal;)a=a.Prev}else{for(;a.Top.Y===a.Prev.Bot.Y;)a=a.Prev;for(;a!==F&&a.Dx===e.ClipperBase.horizontal;)a=a.Next}if(a===F)P?F=a.Next:F=a.Prev;else{P?a=F.Next:a=F.Prev;var _=new e.LocalMinima;_.Next=null,_.Y=a.Bot.Y,_.LeftBound=null,_.RightBound=a,a.WindDelta=0,F=this.ProcessBound(a,P),this.InsertLocalMinima(_)}return F}if(a.Dx===e.ClipperBase.horizontal&&(P?A=a.Prev:A=a.Next,A.Dx===e.ClipperBase.horizontal?A.Bot.X!==a.Bot.X&&A.Top.X!==a.Bot.X&&this.ReverseHorizontal(a):A.Bot.X!==a.Bot.X&&this.ReverseHorizontal(a)),A=a,P){for(;F.Top.Y===F.Next.Bot.Y&&F.Next.OutIdx!==e.ClipperBase.Skip;)F=F.Next;if(F.Dx===e.ClipperBase.horizontal&&F.Next.OutIdx!==e.ClipperBase.Skip){for(j=F;j.Prev.Dx===e.ClipperBase.horizontal;)j=j.Prev;j.Prev.Top.X>F.Next.Top.X&&(F=j.Prev)}for(;a!==F;)a.NextInLML=a.Next,a.Dx===e.ClipperBase.horizontal&&a!==A&&a.Bot.X!==a.Prev.Top.X&&this.ReverseHorizontal(a),a=a.Next;a.Dx===e.ClipperBase.horizontal&&a!==A&&a.Bot.X!==a.Prev.Top.X&&this.ReverseHorizontal(a),F=F.Next}else{for(;F.Top.Y===F.Prev.Bot.Y&&F.Prev.OutIdx!==e.ClipperBase.Skip;)F=F.Prev;if(F.Dx===e.ClipperBase.horizontal&&F.Prev.OutIdx!==e.ClipperBase.Skip){for(j=F;j.Next.Dx===e.ClipperBase.horizontal;)j=j.Next;(j.Next.Top.X===F.Prev.Top.X||j.Next.Top.X>F.Prev.Top.X)&&(F=j.Next)}for(;a!==F;)a.NextInLML=a.Prev,a.Dx===e.ClipperBase.horizontal&&a!==A&&a.Bot.X!==a.Next.Top.X&&this.ReverseHorizontal(a),a=a.Prev;a.Dx===e.ClipperBase.horizontal&&a!==A&&a.Bot.X!==a.Next.Top.X&&this.ReverseHorizontal(a),F=F.Prev}return F},e.ClipperBase.prototype.AddPath=function(a,P,A){e.use_lines?!A&&P===e.PolyType.ptClip&&e.Error("AddPath: Open paths must be subject."):A||e.Error("AddPath: Open paths have been disabled.");var F=a.length-1;if(A)for(;F>0&&e.IntPoint.op_Equality(a[F],a[0]);)--F;for(;F>0&&e.IntPoint.op_Equality(a[F],a[F-1]);)--F;if(A&&F<2||!A&&F<1)return!1;for(var j=new Array,_=0;_<=F;_++)j.push(new e.TEdge);var st=!0;j[1].Curr.X=a[1].X,j[1].Curr.Y=a[1].Y,e.use_xyz&&(j[1].Curr.Z=a[1].Z);var St={Value:this.m_UseFullRange};this.RangeTest(a[0],St),this.m_UseFullRange=St.Value,St.Value=this.m_UseFullRange,this.RangeTest(a[F],St),this.m_UseFullRange=St.Value,this.InitEdge(j[0],j[1],j[F],a[0]),this.InitEdge(j[F],j[0],j[F-1],a[F]);for(var _=F-1;_>=1;--_)St.Value=this.m_UseFullRange,this.RangeTest(a[_],St),this.m_UseFullRange=St.Value,this.InitEdge(j[_],j[_+1],j[_-1],a[_]);for(var Pt=j[0],Bt=Pt,Ht=Pt;;){if(Bt.Curr===Bt.Next.Curr&&(A||Bt.Next!==Pt)){if(Bt===Bt.Next)break;Bt===Pt&&(Pt=Bt.Next),Bt=this.RemoveEdge(Bt),Ht=Bt;continue}if(Bt.Prev===Bt.Next)break;if(A&&e.ClipperBase.SlopesEqual4(Bt.Prev.Curr,Bt.Curr,Bt.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(Bt.Prev.Curr,Bt.Curr,Bt.Next.Curr))){Bt===Pt&&(Pt=Bt.Next),Bt=this.RemoveEdge(Bt),Bt=Bt.Prev,Ht=Bt;continue}if(Bt=Bt.Next,Bt===Ht||!A&&Bt.Next===Pt)break}if(!A&&Bt===Bt.Next||A&&Bt.Prev===Bt.Next)return!1;A||(this.m_HasOpenPaths=!0,Pt.Prev.OutIdx=e.ClipperBase.Skip),Bt=Pt;do this.InitEdge2(Bt,P),Bt=Bt.Next,st&&Bt.Curr.Y!==Pt.Curr.Y&&(st=!1);while(Bt!==Pt);if(st){if(A)return!1;Bt.Prev.OutIdx=e.ClipperBase.Skip;var jt=new e.LocalMinima;for(jt.Next=null,jt.Y=Bt.Bot.Y,jt.LeftBound=null,jt.RightBound=Bt,jt.RightBound.Side=e.EdgeSide.esRight,jt.RightBound.WindDelta=0;Bt.Bot.X!==Bt.Prev.Top.X&&this.ReverseHorizontal(Bt),Bt.Next.OutIdx!==e.ClipperBase.Skip;)Bt.NextInLML=Bt.Next,Bt=Bt.Next;return this.InsertLocalMinima(jt),this.m_edges.push(j),!0}this.m_edges.push(j);var qt,oe=null;for(e.IntPoint.op_Equality(Bt.Prev.Bot,Bt.Prev.Top)&&(Bt=Bt.Next);Bt=this.FindNextLocMin(Bt),Bt!==oe;){oe===null&&(oe=Bt);var jt=new e.LocalMinima;jt.Next=null,jt.Y=Bt.Bot.Y,Bt.Dx<Bt.Prev.Dx?(jt.LeftBound=Bt.Prev,jt.RightBound=Bt,qt=!1):(jt.LeftBound=Bt,jt.RightBound=Bt.Prev,qt=!0),jt.LeftBound.Side=e.EdgeSide.esLeft,jt.RightBound.Side=e.EdgeSide.esRight,A?jt.LeftBound.Next===jt.RightBound?jt.LeftBound.WindDelta=-1:jt.LeftBound.WindDelta=1:jt.LeftBound.WindDelta=0,jt.RightBound.WindDelta=-jt.LeftBound.WindDelta,Bt=this.ProcessBound(jt.LeftBound,qt),Bt.OutIdx===e.ClipperBase.Skip&&(Bt=this.ProcessBound(Bt,qt));var me=this.ProcessBound(jt.RightBound,!qt);me.OutIdx===e.ClipperBase.Skip&&(me=this.ProcessBound(me,!qt)),jt.LeftBound.OutIdx===e.ClipperBase.Skip?jt.LeftBound=null:jt.RightBound.OutIdx===e.ClipperBase.Skip&&(jt.RightBound=null),this.InsertLocalMinima(jt),qt||(Bt=me)}return!0},e.ClipperBase.prototype.AddPaths=function(a,P,A){for(var F=!1,j=0,_=a.length;j<_;++j)this.AddPath(a[j],P,A)&&(F=!0);return F},e.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(a,P,A){return e.IntPoint.op_Equality(a,A)||e.IntPoint.op_Equality(a,P)||e.IntPoint.op_Equality(A,P)?!1:a.X!==A.X?P.X>a.X==P.X<A.X:P.Y>a.Y==P.Y<A.Y},e.ClipperBase.prototype.RemoveEdge=function(a){a.Prev.Next=a.Next,a.Next.Prev=a.Prev;var P=a.Next;return a.Prev=null,P},e.ClipperBase.prototype.SetDx=function(a){a.Delta.X=a.Top.X-a.Bot.X,a.Delta.Y=a.Top.Y-a.Bot.Y,a.Delta.Y===0?a.Dx=e.ClipperBase.horizontal:a.Dx=a.Delta.X/a.Delta.Y},e.ClipperBase.prototype.InsertLocalMinima=function(a){if(this.m_MinimaList===null)this.m_MinimaList=a;else if(a.Y>=this.m_MinimaList.Y)a.Next=this.m_MinimaList,this.m_MinimaList=a;else{for(var P=this.m_MinimaList;P.Next!==null&&a.Y<P.Next.Y;)P=P.Next;a.Next=P.Next,P.Next=a}},e.ClipperBase.prototype.PopLocalMinima=function(a,P){return P.v=this.m_CurrentLM,this.m_CurrentLM!==null&&this.m_CurrentLM.Y===a?(this.m_CurrentLM=this.m_CurrentLM.Next,!0):!1},e.ClipperBase.prototype.ReverseHorizontal=function(a){var P=a.Top.X;a.Top.X=a.Bot.X,a.Bot.X=P,e.use_xyz&&(P=a.Top.Z,a.Top.Z=a.Bot.Z,a.Bot.Z=P)},e.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!==null){this.m_Scanbeam=null;for(var a=this.m_MinimaList;a!==null;){this.InsertScanbeam(a.Y);var P=a.LeftBound;P!==null&&(P.Curr.X=P.Bot.X,P.Curr.Y=P.Bot.Y,e.use_xyz&&(P.Curr.Z=P.Bot.Z),P.OutIdx=e.ClipperBase.Unassigned),P=a.RightBound,P!==null&&(P.Curr.X=P.Bot.X,P.Curr.Y=P.Bot.Y,e.use_xyz&&(P.Curr.Z=P.Bot.Z),P.OutIdx=e.ClipperBase.Unassigned),a=a.Next}this.m_ActiveEdges=null}},e.ClipperBase.prototype.InsertScanbeam=function(a){if(this.m_Scanbeam===null)this.m_Scanbeam=new e.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=a;else if(a>this.m_Scanbeam.Y){var P=new e.Scanbeam;P.Y=a,P.Next=this.m_Scanbeam,this.m_Scanbeam=P}else{for(var A=this.m_Scanbeam;A.Next!==null&&a<=A.Next.Y;)A=A.Next;if(a===A.Y)return;var F=new e.Scanbeam;F.Y=a,F.Next=A.Next,A.Next=F}},e.ClipperBase.prototype.PopScanbeam=function(a){return this.m_Scanbeam===null?(a.v=0,!1):(a.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)},e.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null},e.ClipperBase.prototype.CreateOutRec=function(){var a=new e.OutRec;return a.Idx=e.ClipperBase.Unassigned,a.IsHole=!1,a.IsOpen=!1,a.FirstLeft=null,a.Pts=null,a.BottomPt=null,a.PolyNode=null,this.m_PolyOuts.push(a),a.Idx=this.m_PolyOuts.length-1,a},e.ClipperBase.prototype.DisposeOutRec=function(a){var P=this.m_PolyOuts[a];P.Pts=null,P=null,this.m_PolyOuts[a]=null},e.ClipperBase.prototype.UpdateEdgeIntoAEL=function(a){a.NextInLML===null&&e.Error("UpdateEdgeIntoAEL: invalid call");var P=a.PrevInAEL,A=a.NextInAEL;return a.NextInLML.OutIdx=a.OutIdx,P!==null?P.NextInAEL=a.NextInLML:this.m_ActiveEdges=a.NextInLML,A!==null&&(A.PrevInAEL=a.NextInLML),a.NextInLML.Side=a.Side,a.NextInLML.WindDelta=a.WindDelta,a.NextInLML.WindCnt=a.WindCnt,a.NextInLML.WindCnt2=a.WindCnt2,a=a.NextInLML,a.Curr.X=a.Bot.X,a.Curr.Y=a.Bot.Y,a.PrevInAEL=P,a.NextInAEL=A,e.ClipperBase.IsHorizontal(a)||this.InsertScanbeam(a.Top.Y),a},e.ClipperBase.prototype.SwapPositionsInAEL=function(a,P){if(!(a.NextInAEL===a.PrevInAEL||P.NextInAEL===P.PrevInAEL)){if(a.NextInAEL===P){var A=P.NextInAEL;A!==null&&(A.PrevInAEL=a);var F=a.PrevInAEL;F!==null&&(F.NextInAEL=P),P.PrevInAEL=F,P.NextInAEL=a,a.PrevInAEL=P,a.NextInAEL=A}else if(P.NextInAEL===a){var j=a.NextInAEL;j!==null&&(j.PrevInAEL=P);var _=P.PrevInAEL;_!==null&&(_.NextInAEL=a),a.PrevInAEL=_,a.NextInAEL=P,P.PrevInAEL=a,P.NextInAEL=j}else{var st=a.NextInAEL,St=a.PrevInAEL;a.NextInAEL=P.NextInAEL,a.NextInAEL!==null&&(a.NextInAEL.PrevInAEL=a),a.PrevInAEL=P.PrevInAEL,a.PrevInAEL!==null&&(a.PrevInAEL.NextInAEL=a),P.NextInAEL=st,P.NextInAEL!==null&&(P.NextInAEL.PrevInAEL=P),P.PrevInAEL=St,P.PrevInAEL!==null&&(P.PrevInAEL.NextInAEL=P)}a.PrevInAEL===null?this.m_ActiveEdges=a:P.PrevInAEL===null&&(this.m_ActiveEdges=P)}},e.ClipperBase.prototype.DeleteFromAEL=function(a){var P=a.PrevInAEL,A=a.NextInAEL;P===null&&A===null&&a!==this.m_ActiveEdges||(P!==null?P.NextInAEL=A:this.m_ActiveEdges=A,A!==null&&(A.PrevInAEL=P),a.NextInAEL=null,a.PrevInAEL=null)},e.Clipper=function(a){typeof a>"u"&&(a=0),this.m_PolyOuts=null,this.m_ClipType=e.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=e.PolyFillType.pftEvenOdd,this.m_SubjFillType=e.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,e.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=e.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&a)!==0,this.StrictlySimple=(2&a)!==0,this.PreserveCollinear=(4&a)!==0,e.use_xyz&&(this.ZFillFunction=null)},e.Clipper.ioReverseSolution=1,e.Clipper.ioStrictlySimple=2,e.Clipper.ioPreserveCollinear=4,e.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),e.ClipperBase.prototype.Clear.call(this))},e.Clipper.prototype.InsertMaxima=function(a){var P=new e.Maxima;if(P.X=a,this.m_Maxima===null)this.m_Maxima=P,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(a<this.m_Maxima.X)P.Next=this.m_Maxima,P.Prev=null,this.m_Maxima=P;else{for(var A=this.m_Maxima;A.Next!==null&&a>=A.Next.X;)A=A.Next;if(a===A.X)return;P.Next=A.Next,P.Prev=A,A.Next!==null&&(A.Next.Prev=P),A.Next=P}},e.Clipper.prototype.Execute=function(){var a=arguments,P=a.length,A=a[1]instanceof e.PolyTree;if(P===4&&!A){var F=a[0],j=a[1],_=a[2],st=a[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&e.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,e.Clear(j),this.m_SubjFillType=_,this.m_ClipFillType=st,this.m_ClipType=F,this.m_UsingPolyTree=!1;try{var St=this.ExecuteInternal();St&&this.BuildResult(j)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return St}else if(P===4&&A){var F=a[0],Pt=a[1],_=a[2],st=a[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=_,this.m_ClipFillType=st,this.m_ClipType=F,this.m_UsingPolyTree=!0;try{var St=this.ExecuteInternal();St&&this.BuildResult2(Pt)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return St}else if(P===2&&!A){var F=a[0],j=a[1];return this.Execute(F,j,e.PolyFillType.pftEvenOdd,e.PolyFillType.pftEvenOdd)}else if(P===2&&A){var F=a[0],Pt=a[1];return this.Execute(F,Pt,e.PolyFillType.pftEvenOdd,e.PolyFillType.pftEvenOdd)}},e.Clipper.prototype.FixHoleLinkage=function(a){if(!(a.FirstLeft===null||a.IsHole!==a.FirstLeft.IsHole&&a.FirstLeft.Pts!==null)){for(var P=a.FirstLeft;P!==null&&(P.IsHole===a.IsHole||P.Pts===null);)P=P.FirstLeft;a.FirstLeft=P}},e.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var a={},P={};if(!this.PopScanbeam(a))return!1;for(this.InsertLocalMinimaIntoAEL(a.v);this.PopScanbeam(P)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(P.v))return!1;this.ProcessEdgesAtTopOfScanbeam(P.v),a.v=P.v,this.InsertLocalMinimaIntoAEL(a.v)}var A,F,j;for(F=0,j=this.m_PolyOuts.length;F<j;F++)A=this.m_PolyOuts[F],!(A.Pts===null||A.IsOpen)&&(A.IsHole^this.ReverseSolution)==this.Area$1(A)>0&&this.ReversePolyPtLinks(A.Pts);for(this.JoinCommonEdges(),F=0,j=this.m_PolyOuts.length;F<j;F++)A=this.m_PolyOuts[F],A.Pts!==null&&(A.IsOpen?this.FixupOutPolyline(A):this.FixupOutPolygon(A));return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{this.m_Joins.length=0,this.m_GhostJoins.length=0}},e.Clipper.prototype.DisposeAllPolyPts=function(){for(var a=0,P=this.m_PolyOuts.length;a<P;++a)this.DisposeOutRec(a);e.Clear(this.m_PolyOuts)},e.Clipper.prototype.AddJoin=function(a,P,A){var F=new e.Join;F.OutPt1=a,F.OutPt2=P,F.OffPt.X=A.X,F.OffPt.Y=A.Y,e.use_xyz&&(F.OffPt.Z=A.Z),this.m_Joins.push(F)},e.Clipper.prototype.AddGhostJoin=function(a,P){var A=new e.Join;A.OutPt1=a,A.OffPt.X=P.X,A.OffPt.Y=P.Y,e.use_xyz&&(A.OffPt.Z=P.Z),this.m_GhostJoins.push(A)},e.Clipper.prototype.SetZ=function(a,P,A){if(this.ZFillFunction!==null){if(a.Z!==0||this.ZFillFunction===null)return;e.IntPoint.op_Equality(a,P.Bot)?a.Z=P.Bot.Z:e.IntPoint.op_Equality(a,P.Top)?a.Z=P.Top.Z:e.IntPoint.op_Equality(a,A.Bot)?a.Z=A.Bot.Z:e.IntPoint.op_Equality(a,A.Top)?a.Z=A.Top.Z:this.ZFillFunction(P.Bot,P.Top,A.Bot,A.Top,a)}},e.Clipper.prototype.InsertLocalMinimaIntoAEL=function(a){for(var P={},A,F;this.PopLocalMinima(a,P);){A=P.v.LeftBound,F=P.v.RightBound;var j=null;if(A===null?(this.InsertEdgeIntoAEL(F,null),this.SetWindingCount(F),this.IsContributing(F)&&(j=this.AddOutPt(F,F.Bot))):F===null?(this.InsertEdgeIntoAEL(A,null),this.SetWindingCount(A),this.IsContributing(A)&&(j=this.AddOutPt(A,A.Bot)),this.InsertScanbeam(A.Top.Y)):(this.InsertEdgeIntoAEL(A,null),this.InsertEdgeIntoAEL(F,A),this.SetWindingCount(A),F.WindCnt=A.WindCnt,F.WindCnt2=A.WindCnt2,this.IsContributing(A)&&(j=this.AddLocalMinPoly(A,F,A.Bot)),this.InsertScanbeam(A.Top.Y)),F!==null&&(e.ClipperBase.IsHorizontal(F)?(F.NextInLML!==null&&this.InsertScanbeam(F.NextInLML.Top.Y),this.AddEdgeToSEL(F)):this.InsertScanbeam(F.Top.Y)),!(A===null||F===null)){if(j!==null&&e.ClipperBase.IsHorizontal(F)&&this.m_GhostJoins.length>0&&F.WindDelta!==0)for(var _=0,st=this.m_GhostJoins.length;_<st;_++){var St=this.m_GhostJoins[_];this.HorzSegmentsOverlap(St.OutPt1.Pt.X,St.OffPt.X,F.Bot.X,F.Top.X)&&this.AddJoin(St.OutPt1,j,St.OffPt)}if(A.OutIdx>=0&&A.PrevInAEL!==null&&A.PrevInAEL.Curr.X===A.Bot.X&&A.PrevInAEL.OutIdx>=0&&e.ClipperBase.SlopesEqual5(A.PrevInAEL.Curr,A.PrevInAEL.Top,A.Curr,A.Top,this.m_UseFullRange)&&A.WindDelta!==0&&A.PrevInAEL.WindDelta!==0){var Pt=this.AddOutPt(A.PrevInAEL,A.Bot);this.AddJoin(j,Pt,A.Top)}if(A.NextInAEL!==F){if(F.OutIdx>=0&&F.PrevInAEL.OutIdx>=0&&e.ClipperBase.SlopesEqual5(F.PrevInAEL.Curr,F.PrevInAEL.Top,F.Curr,F.Top,this.m_UseFullRange)&&F.WindDelta!==0&&F.PrevInAEL.WindDelta!==0){var Pt=this.AddOutPt(F.PrevInAEL,F.Bot);this.AddJoin(j,Pt,F.Top)}var Bt=A.NextInAEL;if(Bt!==null)for(;Bt!==F;)this.IntersectEdges(F,Bt,A.Curr),Bt=Bt.NextInAEL}}}},e.Clipper.prototype.InsertEdgeIntoAEL=function(a,P){if(this.m_ActiveEdges===null)a.PrevInAEL=null,a.NextInAEL=null,this.m_ActiveEdges=a;else if(P===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,a))a.PrevInAEL=null,a.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=a,this.m_ActiveEdges=a;else{for(P===null&&(P=this.m_ActiveEdges);P.NextInAEL!==null&&!this.E2InsertsBeforeE1(P.NextInAEL,a);)P=P.NextInAEL;a.NextInAEL=P.NextInAEL,P.NextInAEL!==null&&(P.NextInAEL.PrevInAEL=a),a.PrevInAEL=P,P.NextInAEL=a}},e.Clipper.prototype.E2InsertsBeforeE1=function(a,P){return P.Curr.X===a.Curr.X?P.Top.Y>a.Top.Y?P.Top.X<e.Clipper.TopX(a,P.Top.Y):a.Top.X>e.Clipper.TopX(P,a.Top.Y):P.Curr.X<a.Curr.X},e.Clipper.prototype.IsEvenOddFillType=function(a){return a.PolyTyp===e.PolyType.ptSubject?this.m_SubjFillType===e.PolyFillType.pftEvenOdd:this.m_ClipFillType===e.PolyFillType.pftEvenOdd},e.Clipper.prototype.IsEvenOddAltFillType=function(a){return a.PolyTyp===e.PolyType.ptSubject?this.m_ClipFillType===e.PolyFillType.pftEvenOdd:this.m_SubjFillType===e.PolyFillType.pftEvenOdd},e.Clipper.prototype.IsContributing=function(a){var P,A;switch(a.PolyTyp===e.PolyType.ptSubject?(P=this.m_SubjFillType,A=this.m_ClipFillType):(P=this.m_ClipFillType,A=this.m_SubjFillType),P){case e.PolyFillType.pftEvenOdd:if(a.WindDelta===0&&a.WindCnt!==1)return!1;break;case e.PolyFillType.pftNonZero:if(Math.abs(a.WindCnt)!==1)return!1;break;case e.PolyFillType.pftPositive:if(a.WindCnt!==1)return!1;break;default:if(a.WindCnt!==-1)return!1;break}switch(this.m_ClipType){case e.ClipType.ctIntersection:switch(A){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2!==0;case e.PolyFillType.pftPositive:return a.WindCnt2>0;default:return a.WindCnt2<0}case e.ClipType.ctUnion:switch(A){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2===0;case e.PolyFillType.pftPositive:return a.WindCnt2<=0;default:return a.WindCnt2>=0}case e.ClipType.ctDifference:if(a.PolyTyp===e.PolyType.ptSubject)switch(A){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2===0;case e.PolyFillType.pftPositive:return a.WindCnt2<=0;default:return a.WindCnt2>=0}else switch(A){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2!==0;case e.PolyFillType.pftPositive:return a.WindCnt2>0;default:return a.WindCnt2<0}case e.ClipType.ctXor:if(a.WindDelta===0)switch(A){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2===0;case e.PolyFillType.pftPositive:return a.WindCnt2<=0;default:return a.WindCnt2>=0}else return!0}return!0},e.Clipper.prototype.SetWindingCount=function(a){for(var P=a.PrevInAEL;P!==null&&(P.PolyTyp!==a.PolyTyp||P.WindDelta===0);)P=P.PrevInAEL;if(P===null){var A=a.PolyTyp===e.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;a.WindDelta===0?a.WindCnt=A===e.PolyFillType.pftNegative?-1:1:a.WindCnt=a.WindDelta,a.WindCnt2=0,P=this.m_ActiveEdges}else if(a.WindDelta===0&&this.m_ClipType!==e.ClipType.ctUnion)a.WindCnt=1,a.WindCnt2=P.WindCnt2,P=P.NextInAEL;else if(this.IsEvenOddFillType(a)){if(a.WindDelta===0){for(var F=!0,j=P.PrevInAEL;j!==null;)j.PolyTyp===P.PolyTyp&&j.WindDelta!==0&&(F=!F),j=j.PrevInAEL;a.WindCnt=F?0:1}else a.WindCnt=a.WindDelta;a.WindCnt2=P.WindCnt2,P=P.NextInAEL}else P.WindCnt*P.WindDelta<0?Math.abs(P.WindCnt)>1?P.WindDelta*a.WindDelta<0?a.WindCnt=P.WindCnt:a.WindCnt=P.WindCnt+a.WindDelta:a.WindCnt=a.WindDelta===0?1:a.WindDelta:a.WindDelta===0?a.WindCnt=P.WindCnt<0?P.WindCnt-1:P.WindCnt+1:P.WindDelta*a.WindDelta<0?a.WindCnt=P.WindCnt:a.WindCnt=P.WindCnt+a.WindDelta,a.WindCnt2=P.WindCnt2,P=P.NextInAEL;if(this.IsEvenOddAltFillType(a))for(;P!==a;)P.WindDelta!==0&&(a.WindCnt2=a.WindCnt2===0?1:0),P=P.NextInAEL;else for(;P!==a;)a.WindCnt2+=P.WindDelta,P=P.NextInAEL},e.Clipper.prototype.AddEdgeToSEL=function(a){this.m_SortedEdges===null?(this.m_SortedEdges=a,a.PrevInSEL=null,a.NextInSEL=null):(a.NextInSEL=this.m_SortedEdges,a.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=a,this.m_SortedEdges=a)},e.Clipper.prototype.PopEdgeFromSEL=function(a){if(a.v=this.m_SortedEdges,a.v===null)return!1;var P=a.v;return this.m_SortedEdges=a.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),P.NextInSEL=null,P.PrevInSEL=null,!0},e.Clipper.prototype.CopyAELToSEL=function(){var a=this.m_ActiveEdges;for(this.m_SortedEdges=a;a!==null;)a.PrevInSEL=a.PrevInAEL,a.NextInSEL=a.NextInAEL,a=a.NextInAEL},e.Clipper.prototype.SwapPositionsInSEL=function(a,P){if(!(a.NextInSEL===null&&a.PrevInSEL===null)&&!(P.NextInSEL===null&&P.PrevInSEL===null)){if(a.NextInSEL===P){var A=P.NextInSEL;A!==null&&(A.PrevInSEL=a);var F=a.PrevInSEL;F!==null&&(F.NextInSEL=P),P.PrevInSEL=F,P.NextInSEL=a,a.PrevInSEL=P,a.NextInSEL=A}else if(P.NextInSEL===a){var A=a.NextInSEL;A!==null&&(A.PrevInSEL=P);var F=P.PrevInSEL;F!==null&&(F.NextInSEL=a),a.PrevInSEL=F,a.NextInSEL=P,P.PrevInSEL=a,P.NextInSEL=A}else{var A=a.NextInSEL,F=a.PrevInSEL;a.NextInSEL=P.NextInSEL,a.NextInSEL!==null&&(a.NextInSEL.PrevInSEL=a),a.PrevInSEL=P.PrevInSEL,a.PrevInSEL!==null&&(a.PrevInSEL.NextInSEL=a),P.NextInSEL=A,P.NextInSEL!==null&&(P.NextInSEL.PrevInSEL=P),P.PrevInSEL=F,P.PrevInSEL!==null&&(P.PrevInSEL.NextInSEL=P)}a.PrevInSEL===null?this.m_SortedEdges=a:P.PrevInSEL===null&&(this.m_SortedEdges=P)}},e.Clipper.prototype.AddLocalMaxPoly=function(a,P,A){this.AddOutPt(a,A),P.WindDelta===0&&this.AddOutPt(P,A),a.OutIdx===P.OutIdx?(a.OutIdx=-1,P.OutIdx=-1):a.OutIdx<P.OutIdx?this.AppendPolygon(a,P):this.AppendPolygon(P,a)},e.Clipper.prototype.AddLocalMinPoly=function(a,P,A){var F,j,_;if(e.ClipperBase.IsHorizontal(P)||a.Dx>P.Dx?(F=this.AddOutPt(a,A),P.OutIdx=a.OutIdx,a.Side=e.EdgeSide.esLeft,P.Side=e.EdgeSide.esRight,j=a,j.PrevInAEL===P?_=P.PrevInAEL:_=j.PrevInAEL):(F=this.AddOutPt(P,A),a.OutIdx=P.OutIdx,a.Side=e.EdgeSide.esRight,P.Side=e.EdgeSide.esLeft,j=P,j.PrevInAEL===a?_=a.PrevInAEL:_=j.PrevInAEL),_!==null&&_.OutIdx>=0&&_.Top.Y<A.Y&&j.Top.Y<A.Y){var st=e.Clipper.TopX(_,A.Y),St=e.Clipper.TopX(j,A.Y);if(st===St&&j.WindDelta!==0&&_.WindDelta!==0&&e.ClipperBase.SlopesEqual5(new e.IntPoint2(st,A.Y),_.Top,new e.IntPoint2(St,A.Y),j.Top,this.m_UseFullRange)){var Pt=this.AddOutPt(_,A);this.AddJoin(F,Pt,j.Top)}}return F},e.Clipper.prototype.AddOutPt=function(a,P){if(a.OutIdx<0){var A=this.CreateOutRec();A.IsOpen=a.WindDelta===0;var F=new e.OutPt;return A.Pts=F,F.Idx=A.Idx,F.Pt.X=P.X,F.Pt.Y=P.Y,e.use_xyz&&(F.Pt.Z=P.Z),F.Next=F,F.Prev=F,A.IsOpen||this.SetHoleState(a,A),a.OutIdx=A.Idx,F}else{var A=this.m_PolyOuts[a.OutIdx],j=A.Pts,_=a.Side===e.EdgeSide.esLeft;if(_&&e.IntPoint.op_Equality(P,j.Pt))return j;if(!_&&e.IntPoint.op_Equality(P,j.Prev.Pt))return j.Prev;var F=new e.OutPt;return F.Idx=A.Idx,F.Pt.X=P.X,F.Pt.Y=P.Y,e.use_xyz&&(F.Pt.Z=P.Z),F.Next=j,F.Prev=j.Prev,F.Prev.Next=F,j.Prev=F,_&&(A.Pts=F),F}},e.Clipper.prototype.GetLastOutPt=function(a){var P=this.m_PolyOuts[a.OutIdx];return a.Side===e.EdgeSide.esLeft?P.Pts:P.Pts.Prev},e.Clipper.prototype.SwapPoints=function(a,P){var A=new e.IntPoint1(a.Value);a.Value.X=P.Value.X,a.Value.Y=P.Value.Y,e.use_xyz&&(a.Value.Z=P.Value.Z),P.Value.X=A.X,P.Value.Y=A.Y,e.use_xyz&&(P.Value.Z=A.Z)},e.Clipper.prototype.HorzSegmentsOverlap=function(a,P,A,F){var j;return a>P&&(j=a,a=P,P=j),A>F&&(j=A,A=F,F=j),a<F&&A<P},e.Clipper.prototype.SetHoleState=function(a,P){for(var A=a.PrevInAEL,F=null;A!==null;)A.OutIdx>=0&&A.WindDelta!==0&&(F===null?F=A:F.OutIdx===A.OutIdx&&(F=null)),A=A.PrevInAEL;F===null?(P.FirstLeft=null,P.IsHole=!1):(P.FirstLeft=this.m_PolyOuts[F.OutIdx],P.IsHole=!P.FirstLeft.IsHole)},e.Clipper.prototype.GetDx=function(a,P){return a.Y===P.Y?e.ClipperBase.horizontal:(P.X-a.X)/(P.Y-a.Y)},e.Clipper.prototype.FirstIsBottomPt=function(a,P){for(var A=a.Prev;e.IntPoint.op_Equality(A.Pt,a.Pt)&&A!==a;)A=A.Prev;var F=Math.abs(this.GetDx(a.Pt,A.Pt));for(A=a.Next;e.IntPoint.op_Equality(A.Pt,a.Pt)&&A!==a;)A=A.Next;var j=Math.abs(this.GetDx(a.Pt,A.Pt));for(A=P.Prev;e.IntPoint.op_Equality(A.Pt,P.Pt)&&A!==P;)A=A.Prev;var _=Math.abs(this.GetDx(P.Pt,A.Pt));for(A=P.Next;e.IntPoint.op_Equality(A.Pt,P.Pt)&&A!==P;)A=A.Next;var st=Math.abs(this.GetDx(P.Pt,A.Pt));return Math.max(F,j)===Math.max(_,st)&&Math.min(F,j)===Math.min(_,st)?this.Area(a)>0:F>=_&&F>=st||j>=_&&j>=st},e.Clipper.prototype.GetBottomPt=function(a){for(var P=null,A=a.Next;A!==a;)A.Pt.Y>a.Pt.Y?(a=A,P=null):A.Pt.Y===a.Pt.Y&&A.Pt.X<=a.Pt.X&&(A.Pt.X<a.Pt.X?(P=null,a=A):A.Next!==a&&A.Prev!==a&&(P=A)),A=A.Next;if(P!==null)for(;P!==A;)for(this.FirstIsBottomPt(A,P)||(a=P),P=P.Next;e.IntPoint.op_Inequality(P.Pt,a.Pt);)P=P.Next;return a},e.Clipper.prototype.GetLowermostRec=function(a,P){a.BottomPt===null&&(a.BottomPt=this.GetBottomPt(a.Pts)),P.BottomPt===null&&(P.BottomPt=this.GetBottomPt(P.Pts));var A=a.BottomPt,F=P.BottomPt;return A.Pt.Y>F.Pt.Y?a:A.Pt.Y<F.Pt.Y?P:A.Pt.X<F.Pt.X?a:A.Pt.X>F.Pt.X||A.Next===A?P:F.Next===F||this.FirstIsBottomPt(A,F)?a:P},e.Clipper.prototype.OutRec1RightOfOutRec2=function(a,P){do if(a=a.FirstLeft,a===P)return!0;while(a!==null);return!1},e.Clipper.prototype.GetOutRec=function(a){for(var P=this.m_PolyOuts[a];P!==this.m_PolyOuts[P.Idx];)P=this.m_PolyOuts[P.Idx];return P},e.Clipper.prototype.AppendPolygon=function(a,P){var A=this.m_PolyOuts[a.OutIdx],F=this.m_PolyOuts[P.OutIdx],j;this.OutRec1RightOfOutRec2(A,F)?j=F:this.OutRec1RightOfOutRec2(F,A)?j=A:j=this.GetLowermostRec(A,F);var _=A.Pts,st=_.Prev,St=F.Pts,Pt=St.Prev;a.Side===e.EdgeSide.esLeft?P.Side===e.EdgeSide.esLeft?(this.ReversePolyPtLinks(St),St.Next=_,_.Prev=St,st.Next=Pt,Pt.Prev=st,A.Pts=Pt):(Pt.Next=_,_.Prev=Pt,St.Prev=st,st.Next=St,A.Pts=St):P.Side===e.EdgeSide.esRight?(this.ReversePolyPtLinks(St),st.Next=Pt,Pt.Prev=st,St.Next=_,_.Prev=St):(st.Next=St,St.Prev=st,_.Prev=Pt,Pt.Next=_),A.BottomPt=null,j===F&&(F.FirstLeft!==A&&(A.FirstLeft=F.FirstLeft),A.IsHole=F.IsHole),F.Pts=null,F.BottomPt=null,F.FirstLeft=A;var Bt=a.OutIdx,Ht=P.OutIdx;a.OutIdx=-1,P.OutIdx=-1;for(var jt=this.m_ActiveEdges;jt!==null;){if(jt.OutIdx===Ht){jt.OutIdx=Bt,jt.Side=a.Side;break}jt=jt.NextInAEL}F.Idx=A.Idx},e.Clipper.prototype.ReversePolyPtLinks=function(a){if(a!==null){var P,A;P=a;do A=P.Next,P.Next=P.Prev,P.Prev=A,P=A;while(P!==a)}},e.Clipper.SwapSides=function(a,P){var A=a.Side;a.Side=P.Side,P.Side=A},e.Clipper.SwapPolyIndexes=function(a,P){var A=a.OutIdx;a.OutIdx=P.OutIdx,P.OutIdx=A},e.Clipper.prototype.IntersectEdges=function(a,P,A){var F=a.OutIdx>=0,j=P.OutIdx>=0;if(e.use_xyz&&this.SetZ(A,a,P),e.use_lines&&(a.WindDelta===0||P.WindDelta===0)){if(a.WindDelta===0&&P.WindDelta===0)return;a.PolyTyp===P.PolyTyp&&a.WindDelta!==P.WindDelta&&this.m_ClipType===e.ClipType.ctUnion?a.WindDelta===0?j&&(this.AddOutPt(a,A),F&&(a.OutIdx=-1)):F&&(this.AddOutPt(P,A),j&&(P.OutIdx=-1)):a.PolyTyp!==P.PolyTyp&&(a.WindDelta===0&&Math.abs(P.WindCnt)===1&&(this.m_ClipType!==e.ClipType.ctUnion||P.WindCnt2===0)?(this.AddOutPt(a,A),F&&(a.OutIdx=-1)):P.WindDelta===0&&Math.abs(a.WindCnt)===1&&(this.m_ClipType!==e.ClipType.ctUnion||a.WindCnt2===0)&&(this.AddOutPt(P,A),j&&(P.OutIdx=-1)));return}if(a.PolyTyp===P.PolyTyp)if(this.IsEvenOddFillType(a)){var _=a.WindCnt;a.WindCnt=P.WindCnt,P.WindCnt=_}else a.WindCnt+P.WindDelta===0?a.WindCnt=-a.WindCnt:a.WindCnt+=P.WindDelta,P.WindCnt-a.WindDelta===0?P.WindCnt=-P.WindCnt:P.WindCnt-=a.WindDelta;else this.IsEvenOddFillType(P)?a.WindCnt2=a.WindCnt2===0?1:0:a.WindCnt2+=P.WindDelta,this.IsEvenOddFillType(a)?P.WindCnt2=P.WindCnt2===0?1:0:P.WindCnt2-=a.WindDelta;var st,St,Pt,Bt;a.PolyTyp===e.PolyType.ptSubject?(st=this.m_SubjFillType,Pt=this.m_ClipFillType):(st=this.m_ClipFillType,Pt=this.m_SubjFillType),P.PolyTyp===e.PolyType.ptSubject?(St=this.m_SubjFillType,Bt=this.m_ClipFillType):(St=this.m_ClipFillType,Bt=this.m_SubjFillType);var Ht,jt;switch(st){case e.PolyFillType.pftPositive:Ht=a.WindCnt;break;case e.PolyFillType.pftNegative:Ht=-a.WindCnt;break;default:Ht=Math.abs(a.WindCnt);break}switch(St){case e.PolyFillType.pftPositive:jt=P.WindCnt;break;case e.PolyFillType.pftNegative:jt=-P.WindCnt;break;default:jt=Math.abs(P.WindCnt);break}if(F&&j)Ht!==0&&Ht!==1||jt!==0&&jt!==1||a.PolyTyp!==P.PolyTyp&&this.m_ClipType!==e.ClipType.ctXor?this.AddLocalMaxPoly(a,P,A):(this.AddOutPt(a,A),this.AddOutPt(P,A),e.Clipper.SwapSides(a,P),e.Clipper.SwapPolyIndexes(a,P));else if(F)(jt===0||jt===1)&&(this.AddOutPt(a,A),e.Clipper.SwapSides(a,P),e.Clipper.SwapPolyIndexes(a,P));else if(j)(Ht===0||Ht===1)&&(this.AddOutPt(P,A),e.Clipper.SwapSides(a,P),e.Clipper.SwapPolyIndexes(a,P));else if((Ht===0||Ht===1)&&(jt===0||jt===1)){var qt,oe;switch(Pt){case e.PolyFillType.pftPositive:qt=a.WindCnt2;break;case e.PolyFillType.pftNegative:qt=-a.WindCnt2;break;default:qt=Math.abs(a.WindCnt2);break}switch(Bt){case e.PolyFillType.pftPositive:oe=P.WindCnt2;break;case e.PolyFillType.pftNegative:oe=-P.WindCnt2;break;default:oe=Math.abs(P.WindCnt2);break}if(a.PolyTyp!==P.PolyTyp)this.AddLocalMinPoly(a,P,A);else if(Ht===1&&jt===1)switch(this.m_ClipType){case e.ClipType.ctIntersection:qt>0&&oe>0&&this.AddLocalMinPoly(a,P,A);break;case e.ClipType.ctUnion:qt<=0&&oe<=0&&this.AddLocalMinPoly(a,P,A);break;case e.ClipType.ctDifference:(a.PolyTyp===e.PolyType.ptClip&&qt>0&&oe>0||a.PolyTyp===e.PolyType.ptSubject&&qt<=0&&oe<=0)&&this.AddLocalMinPoly(a,P,A);break;case e.ClipType.ctXor:this.AddLocalMinPoly(a,P,A);break}else e.Clipper.SwapSides(a,P)}},e.Clipper.prototype.DeleteFromSEL=function(a){var P=a.PrevInSEL,A=a.NextInSEL;P===null&&A===null&&a!==this.m_SortedEdges||(P!==null?P.NextInSEL=A:this.m_SortedEdges=A,A!==null&&(A.PrevInSEL=P),a.NextInSEL=null,a.PrevInSEL=null)},e.Clipper.prototype.ProcessHorizontals=function(){for(var a={};this.PopEdgeFromSEL(a);)this.ProcessHorizontal(a.v)},e.Clipper.prototype.GetHorzDirection=function(a,P){a.Bot.X<a.Top.X?(P.Left=a.Bot.X,P.Right=a.Top.X,P.Dir=e.Direction.dLeftToRight):(P.Left=a.Top.X,P.Right=a.Bot.X,P.Dir=e.Direction.dRightToLeft)},e.Clipper.prototype.ProcessHorizontal=function(a){var P={Dir:null,Left:null,Right:null};this.GetHorzDirection(a,P);for(var A=P.Dir,F=P.Left,j=P.Right,_=a.WindDelta===0,st=a,St=null;st.NextInLML!==null&&e.ClipperBase.IsHorizontal(st.NextInLML);)st=st.NextInLML;st.NextInLML===null&&(St=this.GetMaximaPair(st));var Pt=this.m_Maxima;if(Pt!==null)if(A===e.Direction.dLeftToRight){for(;Pt!==null&&Pt.X<=a.Bot.X;)Pt=Pt.Next;Pt!==null&&Pt.X>=st.Top.X&&(Pt=null)}else{for(;Pt.Next!==null&&Pt.Next.X<a.Bot.X;)Pt=Pt.Next;Pt.X<=st.Top.X&&(Pt=null)}for(var Bt=null;;){for(var Ht=a===st,jt=this.GetNextInAEL(a,A);jt!==null;){if(Pt!==null)if(A===e.Direction.dLeftToRight)for(;Pt!==null&&Pt.X<jt.Curr.X;)a.OutIdx>=0&&!_&&this.AddOutPt(a,new e.IntPoint2(Pt.X,a.Bot.Y)),Pt=Pt.Next;else for(;Pt!==null&&Pt.X>jt.Curr.X;)a.OutIdx>=0&&!_&&this.AddOutPt(a,new e.IntPoint2(Pt.X,a.Bot.Y)),Pt=Pt.Prev;if(A===e.Direction.dLeftToRight&&jt.Curr.X>j||A===e.Direction.dRightToLeft&&jt.Curr.X<F||jt.Curr.X===a.Top.X&&a.NextInLML!==null&&jt.Dx<a.NextInLML.Dx)break;if(a.OutIdx>=0&&!_){e.use_xyz&&(A===e.Direction.dLeftToRight?this.SetZ(jt.Curr,a,jt):this.SetZ(jt.Curr,jt,a)),Bt=this.AddOutPt(a,jt.Curr);for(var qt=this.m_SortedEdges;qt!==null;){if(qt.OutIdx>=0&&this.HorzSegmentsOverlap(a.Bot.X,a.Top.X,qt.Bot.X,qt.Top.X)){var oe=this.GetLastOutPt(qt);this.AddJoin(oe,Bt,qt.Top)}qt=qt.NextInSEL}this.AddGhostJoin(Bt,a.Bot)}if(jt===St&&Ht){a.OutIdx>=0&&this.AddLocalMaxPoly(a,St,a.Top),this.DeleteFromAEL(a),this.DeleteFromAEL(St);return}if(A===e.Direction.dLeftToRight){var me=new e.IntPoint2(jt.Curr.X,a.Curr.Y);this.IntersectEdges(a,jt,me)}else{var me=new e.IntPoint2(jt.Curr.X,a.Curr.Y);this.IntersectEdges(jt,a,me)}var Se=this.GetNextInAEL(jt,A);this.SwapPositionsInAEL(a,jt),jt=Se}if(a.NextInLML===null||!e.ClipperBase.IsHorizontal(a.NextInLML))break;a=this.UpdateEdgeIntoAEL(a),a.OutIdx>=0&&this.AddOutPt(a,a.Bot),P={Dir:A,Left:F,Right:j},this.GetHorzDirection(a,P),A=P.Dir,F=P.Left,j=P.Right}if(a.OutIdx>=0&&Bt===null){Bt=this.GetLastOutPt(a);for(var qt=this.m_SortedEdges;qt!==null;){if(qt.OutIdx>=0&&this.HorzSegmentsOverlap(a.Bot.X,a.Top.X,qt.Bot.X,qt.Top.X)){var oe=this.GetLastOutPt(qt);this.AddJoin(oe,Bt,qt.Top)}qt=qt.NextInSEL}this.AddGhostJoin(Bt,a.Top)}if(a.NextInLML!==null)if(a.OutIdx>=0){if(Bt=this.AddOutPt(a,a.Top),a=this.UpdateEdgeIntoAEL(a),a.WindDelta===0)return;var De=a.PrevInAEL,Se=a.NextInAEL;if(De!==null&&De.Curr.X===a.Bot.X&&De.Curr.Y===a.Bot.Y&&De.WindDelta===0&&De.OutIdx>=0&&De.Curr.Y>De.Top.Y&&e.ClipperBase.SlopesEqual3(a,De,this.m_UseFullRange)){var oe=this.AddOutPt(De,a.Bot);this.AddJoin(Bt,oe,a.Top)}else if(Se!==null&&Se.Curr.X===a.Bot.X&&Se.Curr.Y===a.Bot.Y&&Se.WindDelta!==0&&Se.OutIdx>=0&&Se.Curr.Y>Se.Top.Y&&e.ClipperBase.SlopesEqual3(a,Se,this.m_UseFullRange)){var oe=this.AddOutPt(Se,a.Bot);this.AddJoin(Bt,oe,a.Top)}}else a=this.UpdateEdgeIntoAEL(a);else a.OutIdx>=0&&this.AddOutPt(a,a.Top),this.DeleteFromAEL(a)},e.Clipper.prototype.GetNextInAEL=function(a,P){return P===e.Direction.dLeftToRight?a.NextInAEL:a.PrevInAEL},e.Clipper.prototype.IsMinima=function(a){return a!==null&&a.Prev.NextInLML!==a&&a.Next.NextInLML!==a},e.Clipper.prototype.IsMaxima=function(a,P){return a!==null&&a.Top.Y===P&&a.NextInLML===null},e.Clipper.prototype.IsIntermediate=function(a,P){return a.Top.Y===P&&a.NextInLML!==null},e.Clipper.prototype.GetMaximaPair=function(a){return e.IntPoint.op_Equality(a.Next.Top,a.Top)&&a.Next.NextInLML===null?a.Next:e.IntPoint.op_Equality(a.Prev.Top,a.Top)&&a.Prev.NextInLML===null?a.Prev:null},e.Clipper.prototype.GetMaximaPairEx=function(a){var P=this.GetMaximaPair(a);return P===null||P.OutIdx===e.ClipperBase.Skip||P.NextInAEL===P.PrevInAEL&&!e.ClipperBase.IsHorizontal(P)?null:P},e.Clipper.prototype.ProcessIntersections=function(a){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(a),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,e.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0},e.Clipper.prototype.BuildIntersectList=function(a){if(this.m_ActiveEdges!==null){var P=this.m_ActiveEdges;for(this.m_SortedEdges=P;P!==null;)P.PrevInSEL=P.PrevInAEL,P.NextInSEL=P.NextInAEL,P.Curr.X=e.Clipper.TopX(P,a),P=P.NextInAEL;for(var A=!0;A&&this.m_SortedEdges!==null;){for(A=!1,P=this.m_SortedEdges;P.NextInSEL!==null;){var F=P.NextInSEL,j=new e.IntPoint0;if(P.Curr.X>F.Curr.X){this.IntersectPoint(P,F,j),j.Y<a&&(j=new e.IntPoint2(e.Clipper.TopX(P,a),a));var _=new e.IntersectNode;_.Edge1=P,_.Edge2=F,_.Pt.X=j.X,_.Pt.Y=j.Y,e.use_xyz&&(_.Pt.Z=j.Z),this.m_IntersectList.push(_),this.SwapPositionsInSEL(P,F),A=!0}else P=F}if(P.PrevInSEL!==null)P.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}},e.Clipper.prototype.EdgesAdjacent=function(a){return a.Edge1.NextInSEL===a.Edge2||a.Edge1.PrevInSEL===a.Edge2},e.Clipper.IntersectNodeSort=function(a,P){return P.Pt.Y-a.Pt.Y},e.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var a=this.m_IntersectList.length,P=0;P<a;P++){if(!this.EdgesAdjacent(this.m_IntersectList[P])){for(var A=P+1;A<a&&!this.EdgesAdjacent(this.m_IntersectList[A]);)A++;if(A===a)return!1;var F=this.m_IntersectList[P];this.m_IntersectList[P]=this.m_IntersectList[A],this.m_IntersectList[A]=F}this.SwapPositionsInSEL(this.m_IntersectList[P].Edge1,this.m_IntersectList[P].Edge2)}return!0},e.Clipper.prototype.ProcessIntersectList=function(){for(var a=0,P=this.m_IntersectList.length;a<P;a++){var A=this.m_IntersectList[a];this.IntersectEdges(A.Edge1,A.Edge2,A.Pt),this.SwapPositionsInAEL(A.Edge1,A.Edge2)}this.m_IntersectList.length=0};var Ea=function(a){return a<0?Math.ceil(a-.5):Math.round(a)},Ys=function(a){return a<0?Math.ceil(a-.5):Math.floor(a+.5)},di=function(a){return a<0?-Math.round(Math.abs(a)):Math.round(a)},Xs=function(a){return a<0?(a-=.5,a<-2147483648?Math.ceil(a):a|0):(a+=.5,a>2147483647?Math.floor(a):a|0)};s.msie?e.Clipper.Round=Ea:s.chromium?e.Clipper.Round=di:s.safari?e.Clipper.Round=Xs:e.Clipper.Round=Ys,e.Clipper.TopX=function(a,P){return P===a.Top.Y?a.Top.X:a.Bot.X+e.Clipper.Round(a.Dx*(P-a.Bot.Y))},e.Clipper.prototype.IntersectPoint=function(a,P,A){A.X=0,A.Y=0;var F,j;if(a.Dx===P.Dx){A.Y=a.Curr.Y,A.X=e.Clipper.TopX(a,A.Y);return}if(a.Delta.X===0)A.X=a.Bot.X,e.ClipperBase.IsHorizontal(P)?A.Y=P.Bot.Y:(j=P.Bot.Y-P.Bot.X/P.Dx,A.Y=e.Clipper.Round(A.X/P.Dx+j));else if(P.Delta.X===0)A.X=P.Bot.X,e.ClipperBase.IsHorizontal(a)?A.Y=a.Bot.Y:(F=a.Bot.Y-a.Bot.X/a.Dx,A.Y=e.Clipper.Round(A.X/a.Dx+F));else{F=a.Bot.X-a.Bot.Y*a.Dx,j=P.Bot.X-P.Bot.Y*P.Dx;var _=(j-F)/(a.Dx-P.Dx);A.Y=e.Clipper.Round(_),Math.abs(a.Dx)<Math.abs(P.Dx)?A.X=e.Clipper.Round(a.Dx*_+F):A.X=e.Clipper.Round(P.Dx*_+j)}if(A.Y<a.Top.Y||A.Y<P.Top.Y){if(a.Top.Y>P.Top.Y)return A.Y=a.Top.Y,A.X=e.Clipper.TopX(P,a.Top.Y),A.X<a.Top.X;A.Y=P.Top.Y,Math.abs(a.Dx)<Math.abs(P.Dx)?A.X=e.Clipper.TopX(a,A.Y):A.X=e.Clipper.TopX(P,A.Y)}A.Y>a.Curr.Y&&(A.Y=a.Curr.Y,Math.abs(a.Dx)>Math.abs(P.Dx)?A.X=e.Clipper.TopX(P,A.Y):A.X=e.Clipper.TopX(a,A.Y))},e.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(a){for(var P=this.m_ActiveEdges;P!==null;){var A=this.IsMaxima(P,a);if(A){var F=this.GetMaximaPairEx(P);A=F===null||!e.ClipperBase.IsHorizontal(F)}if(A){this.StrictlySimple&&this.InsertMaxima(P.Top.X);var j=P.PrevInAEL;this.DoMaxima(P),j===null?P=this.m_ActiveEdges:P=j.NextInAEL}else{if(this.IsIntermediate(P,a)&&e.ClipperBase.IsHorizontal(P.NextInLML)?(P=this.UpdateEdgeIntoAEL(P),P.OutIdx>=0&&this.AddOutPt(P,P.Bot),this.AddEdgeToSEL(P)):(P.Curr.X=e.Clipper.TopX(P,a),P.Curr.Y=a),e.use_xyz&&(P.Top.Y===a?P.Curr.Z=P.Top.Z:P.Bot.Y===a?P.Curr.Z=P.Bot.Z:P.Curr.Z=0),this.StrictlySimple){var j=P.PrevInAEL;if(P.OutIdx>=0&&P.WindDelta!==0&&j!==null&&j.OutIdx>=0&&j.Curr.X===P.Curr.X&&j.WindDelta!==0){var _=new e.IntPoint1(P.Curr);e.use_xyz&&this.SetZ(_,j,P);var st=this.AddOutPt(j,_),St=this.AddOutPt(P,_);this.AddJoin(st,St,_)}}P=P.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,P=this.m_ActiveEdges;P!==null;){if(this.IsIntermediate(P,a)){var st=null;P.OutIdx>=0&&(st=this.AddOutPt(P,P.Top)),P=this.UpdateEdgeIntoAEL(P);var j=P.PrevInAEL,Pt=P.NextInAEL;if(j!==null&&j.Curr.X===P.Bot.X&&j.Curr.Y===P.Bot.Y&&st!==null&&j.OutIdx>=0&&j.Curr.Y===j.Top.Y&&e.ClipperBase.SlopesEqual5(P.Curr,P.Top,j.Curr,j.Top,this.m_UseFullRange)&&P.WindDelta!==0&&j.WindDelta!==0){var St=this.AddOutPt(ePrev2,P.Bot);this.AddJoin(st,St,P.Top)}else if(Pt!==null&&Pt.Curr.X===P.Bot.X&&Pt.Curr.Y===P.Bot.Y&&st!==null&&Pt.OutIdx>=0&&Pt.Curr.Y===Pt.Top.Y&&e.ClipperBase.SlopesEqual5(P.Curr,P.Top,Pt.Curr,Pt.Top,this.m_UseFullRange)&&P.WindDelta!==0&&Pt.WindDelta!==0){var St=this.AddOutPt(Pt,P.Bot);this.AddJoin(st,St,P.Top)}}P=P.NextInAEL}},e.Clipper.prototype.DoMaxima=function(a){var P=this.GetMaximaPairEx(a);if(P===null){a.OutIdx>=0&&this.AddOutPt(a,a.Top),this.DeleteFromAEL(a);return}for(var A=a.NextInAEL;A!==null&&A!==P;)this.IntersectEdges(a,A,a.Top),this.SwapPositionsInAEL(a,A),A=a.NextInAEL;a.OutIdx===-1&&P.OutIdx===-1?(this.DeleteFromAEL(a),this.DeleteFromAEL(P)):a.OutIdx>=0&&P.OutIdx>=0?(a.OutIdx>=0&&this.AddLocalMaxPoly(a,P,a.Top),this.DeleteFromAEL(a),this.DeleteFromAEL(P)):e.use_lines&&a.WindDelta===0?(a.OutIdx>=0&&(this.AddOutPt(a,a.Top),a.OutIdx=e.ClipperBase.Unassigned),this.DeleteFromAEL(a),P.OutIdx>=0&&(this.AddOutPt(P,a.Top),P.OutIdx=e.ClipperBase.Unassigned),this.DeleteFromAEL(P)):e.Error("DoMaxima error")},e.Clipper.ReversePaths=function(a){for(var P=0,A=a.length;P<A;P++)a[P].reverse()},e.Clipper.Orientation=function(a){return e.Clipper.Area(a)>=0},e.Clipper.prototype.PointCount=function(a){if(a===null)return 0;var P=0,A=a;do P++,A=A.Next;while(A!==a);return P},e.Clipper.prototype.BuildResult=function(a){e.Clear(a);for(var P=0,A=this.m_PolyOuts.length;P<A;P++){var F=this.m_PolyOuts[P];if(F.Pts!==null){var j=F.Pts.Prev,_=this.PointCount(j);if(!(_<2)){for(var st=new Array(_),St=0;St<_;St++)st[St]=j.Pt,j=j.Prev;a.push(st)}}}},e.Clipper.prototype.BuildResult2=function(a){a.Clear();for(var P=0,A=this.m_PolyOuts.length;P<A;P++){var F=this.m_PolyOuts[P],j=this.PointCount(F.Pts);if(!(F.IsOpen&&j<2||!F.IsOpen&&j<3)){this.FixHoleLinkage(F);var _=new e.PolyNode;a.m_AllPolys.push(_),F.PolyNode=_,_.m_polygon.length=j;for(var st=F.Pts.Prev,St=0;St<j;St++)_.m_polygon[St]=st.Pt,st=st.Prev}}for(var P=0,A=this.m_PolyOuts.length;P<A;P++){var F=this.m_PolyOuts[P];F.PolyNode!==null&&(F.IsOpen?(F.PolyNode.IsOpen=!0,a.AddChild(F.PolyNode)):F.FirstLeft!==null&&F.FirstLeft.PolyNode!==null?F.FirstLeft.PolyNode.AddChild(F.PolyNode):a.AddChild(F.PolyNode))}},e.Clipper.prototype.FixupOutPolyline=function(a){for(var P=a.Pts,A=P.Prev;P!==A;)if(P=P.Next,e.IntPoint.op_Equality(P.Pt,P.Prev.Pt)){P===A&&(A=P.Prev);var F=P.Prev;F.Next=P.Next,P.Next.Prev=F,P=F}P===P.Prev&&(a.Pts=null)},e.Clipper.prototype.FixupOutPolygon=function(a){var P=null;a.BottomPt=null;for(var A=a.Pts,F=this.PreserveCollinear||this.StrictlySimple;;){if(A.Prev===A||A.Prev===A.Next){a.Pts=null;return}if(e.IntPoint.op_Equality(A.Pt,A.Next.Pt)||e.IntPoint.op_Equality(A.Pt,A.Prev.Pt)||e.ClipperBase.SlopesEqual4(A.Prev.Pt,A.Pt,A.Next.Pt,this.m_UseFullRange)&&(!F||!this.Pt2IsBetweenPt1AndPt3(A.Prev.Pt,A.Pt,A.Next.Pt)))P=null,A.Prev.Next=A.Next,A.Next.Prev=A.Prev,A=A.Prev;else{if(A===P)break;P===null&&(P=A),A=A.Next}}a.Pts=A},e.Clipper.prototype.DupOutPt=function(a,P){var A=new e.OutPt;return A.Pt.X=a.Pt.X,A.Pt.Y=a.Pt.Y,e.use_xyz&&(A.Pt.Z=a.Pt.Z),A.Idx=a.Idx,P?(A.Next=a.Next,A.Prev=a,a.Next.Prev=A,a.Next=A):(A.Prev=a.Prev,A.Next=a,a.Prev.Next=A,a.Prev=A),A},e.Clipper.prototype.GetOverlap=function(a,P,A,F,j){return a<P?A<F?(j.Left=Math.max(a,A),j.Right=Math.min(P,F)):(j.Left=Math.max(a,F),j.Right=Math.min(P,A)):A<F?(j.Left=Math.max(P,A),j.Right=Math.min(a,F)):(j.Left=Math.max(P,F),j.Right=Math.min(a,A)),j.Left<j.Right},e.Clipper.prototype.JoinHorz=function(a,P,A,F,j,_){var st=a.Pt.X>P.Pt.X?e.Direction.dRightToLeft:e.Direction.dLeftToRight,St=A.Pt.X>F.Pt.X?e.Direction.dRightToLeft:e.Direction.dLeftToRight;if(st===St)return!1;if(st===e.Direction.dLeftToRight){for(;a.Next.Pt.X<=j.X&&a.Next.Pt.X>=a.Pt.X&&a.Next.Pt.Y===j.Y;)a=a.Next;_&&a.Pt.X!==j.X&&(a=a.Next),P=this.DupOutPt(a,!_),e.IntPoint.op_Inequality(P.Pt,j)&&(a=P,a.Pt.X=j.X,a.Pt.Y=j.Y,e.use_xyz&&(a.Pt.Z=j.Z),P=this.DupOutPt(a,!_))}else{for(;a.Next.Pt.X>=j.X&&a.Next.Pt.X<=a.Pt.X&&a.Next.Pt.Y===j.Y;)a=a.Next;!_&&a.Pt.X!==j.X&&(a=a.Next),P=this.DupOutPt(a,_),e.IntPoint.op_Inequality(P.Pt,j)&&(a=P,a.Pt.X=j.X,a.Pt.Y=j.Y,e.use_xyz&&(a.Pt.Z=j.Z),P=this.DupOutPt(a,_))}if(St===e.Direction.dLeftToRight){for(;A.Next.Pt.X<=j.X&&A.Next.Pt.X>=A.Pt.X&&A.Next.Pt.Y===j.Y;)A=A.Next;_&&A.Pt.X!==j.X&&(A=A.Next),F=this.DupOutPt(A,!_),e.IntPoint.op_Inequality(F.Pt,j)&&(A=F,A.Pt.X=j.X,A.Pt.Y=j.Y,e.use_xyz&&(A.Pt.Z=j.Z),F=this.DupOutPt(A,!_))}else{for(;A.Next.Pt.X>=j.X&&A.Next.Pt.X<=A.Pt.X&&A.Next.Pt.Y===j.Y;)A=A.Next;!_&&A.Pt.X!==j.X&&(A=A.Next),F=this.DupOutPt(A,_),e.IntPoint.op_Inequality(F.Pt,j)&&(A=F,A.Pt.X=j.X,A.Pt.Y=j.Y,e.use_xyz&&(A.Pt.Z=j.Z),F=this.DupOutPt(A,_))}return st===e.Direction.dLeftToRight===_?(a.Prev=A,A.Next=a,P.Next=F,F.Prev=P):(a.Next=A,A.Prev=a,P.Prev=F,F.Next=P),!0},e.Clipper.prototype.JoinPoints=function(a,P,A){var F=a.OutPt1,j=new e.OutPt,_=a.OutPt2,st=new e.OutPt,St=a.OutPt1.Pt.Y===a.OffPt.Y;if(St&&e.IntPoint.op_Equality(a.OffPt,a.OutPt1.Pt)&&e.IntPoint.op_Equality(a.OffPt,a.OutPt2.Pt)){if(P!==A)return!1;for(j=a.OutPt1.Next;j!==F&&e.IntPoint.op_Equality(j.Pt,a.OffPt);)j=j.Next;var Pt=j.Pt.Y>a.OffPt.Y;for(st=a.OutPt2.Next;st!==_&&e.IntPoint.op_Equality(st.Pt,a.OffPt);)st=st.Next;var Bt=st.Pt.Y>a.OffPt.Y;return Pt===Bt?!1:Pt?(j=this.DupOutPt(F,!1),st=this.DupOutPt(_,!0),F.Prev=_,_.Next=F,j.Next=st,st.Prev=j,a.OutPt1=F,a.OutPt2=j,!0):(j=this.DupOutPt(F,!0),st=this.DupOutPt(_,!1),F.Next=_,_.Prev=F,j.Prev=st,st.Next=j,a.OutPt1=F,a.OutPt2=j,!0)}else if(St){for(j=F;F.Prev.Pt.Y===F.Pt.Y&&F.Prev!==j&&F.Prev!==_;)F=F.Prev;for(;j.Next.Pt.Y===j.Pt.Y&&j.Next!==F&&j.Next!==_;)j=j.Next;if(j.Next===F||j.Next===_)return!1;for(st=_;_.Prev.Pt.Y===_.Pt.Y&&_.Prev!==st&&_.Prev!==j;)_=_.Prev;for(;st.Next.Pt.Y===st.Pt.Y&&st.Next!==_&&st.Next!==F;)st=st.Next;if(st.Next===_||st.Next===F)return!1;var Ht={Left:null,Right:null};if(!this.GetOverlap(F.Pt.X,j.Pt.X,_.Pt.X,st.Pt.X,Ht))return!1;var jt=Ht.Left,qt=Ht.Right,oe=new e.IntPoint0,me;return F.Pt.X>=jt&&F.Pt.X<=qt?(oe.X=F.Pt.X,oe.Y=F.Pt.Y,e.use_xyz&&(oe.Z=F.Pt.Z),me=F.Pt.X>j.Pt.X):_.Pt.X>=jt&&_.Pt.X<=qt?(oe.X=_.Pt.X,oe.Y=_.Pt.Y,e.use_xyz&&(oe.Z=_.Pt.Z),me=_.Pt.X>st.Pt.X):j.Pt.X>=jt&&j.Pt.X<=qt?(oe.X=j.Pt.X,oe.Y=j.Pt.Y,e.use_xyz&&(oe.Z=j.Pt.Z),me=j.Pt.X>F.Pt.X):(oe.X=st.Pt.X,oe.Y=st.Pt.Y,e.use_xyz&&(oe.Z=st.Pt.Z),me=st.Pt.X>_.Pt.X),a.OutPt1=F,a.OutPt2=_,this.JoinHorz(F,j,_,st,oe,me)}else{for(j=F.Next;e.IntPoint.op_Equality(j.Pt,F.Pt)&&j!==F;)j=j.Next;var Se=j.Pt.Y>F.Pt.Y||!e.ClipperBase.SlopesEqual4(F.Pt,j.Pt,a.OffPt,this.m_UseFullRange);if(Se){for(j=F.Prev;e.IntPoint.op_Equality(j.Pt,F.Pt)&&j!==F;)j=j.Prev;if(j.Pt.Y>F.Pt.Y||!e.ClipperBase.SlopesEqual4(F.Pt,j.Pt,a.OffPt,this.m_UseFullRange))return!1}for(st=_.Next;e.IntPoint.op_Equality(st.Pt,_.Pt)&&st!==_;)st=st.Next;var De=st.Pt.Y>_.Pt.Y||!e.ClipperBase.SlopesEqual4(_.Pt,st.Pt,a.OffPt,this.m_UseFullRange);if(De){for(st=_.Prev;e.IntPoint.op_Equality(st.Pt,_.Pt)&&st!==_;)st=st.Prev;if(st.Pt.Y>_.Pt.Y||!e.ClipperBase.SlopesEqual4(_.Pt,st.Pt,a.OffPt,this.m_UseFullRange))return!1}return j===F||st===_||j===st||P===A&&Se===De?!1:Se?(j=this.DupOutPt(F,!1),st=this.DupOutPt(_,!0),F.Prev=_,_.Next=F,j.Next=st,st.Prev=j,a.OutPt1=F,a.OutPt2=j,!0):(j=this.DupOutPt(F,!0),st=this.DupOutPt(_,!1),F.Next=_,_.Prev=F,j.Prev=st,st.Next=j,a.OutPt1=F,a.OutPt2=j,!0)}},e.Clipper.GetBounds=function(a){for(var P=0,A=a.length;P<A&&a[P].length===0;)P++;if(P===A)return new e.IntRect(0,0,0,0);var F=new e.IntRect;for(F.left=a[P][0].X,F.right=F.left,F.top=a[P][0].Y,F.bottom=F.top;P<A;P++)for(var j=0,_=a[P].length;j<_;j++)a[P][j].X<F.left?F.left=a[P][j].X:a[P][j].X>F.right&&(F.right=a[P][j].X),a[P][j].Y<F.top?F.top=a[P][j].Y:a[P][j].Y>F.bottom&&(F.bottom=a[P][j].Y);return F},e.Clipper.prototype.GetBounds2=function(a){var P=a,A=new e.IntRect;for(A.left=a.Pt.X,A.right=a.Pt.X,A.top=a.Pt.Y,A.bottom=a.Pt.Y,a=a.Next;a!==P;)a.Pt.X<A.left&&(A.left=a.Pt.X),a.Pt.X>A.right&&(A.right=a.Pt.X),a.Pt.Y<A.top&&(A.top=a.Pt.Y),a.Pt.Y>A.bottom&&(A.bottom=a.Pt.Y),a=a.Next;return A},e.Clipper.PointInPolygon=function(a,P){var A=0,F=P.length;if(F<3)return 0;for(var j=P[0],_=1;_<=F;++_){var st=_===F?P[0]:P[_];if(st.Y===a.Y&&(st.X===a.X||j.Y===a.Y&&st.X>a.X==j.X<a.X))return-1;if(j.Y<a.Y!=st.Y<a.Y){if(j.X>=a.X)if(st.X>a.X)A=1-A;else{var St=(j.X-a.X)*(st.Y-a.Y)-(st.X-a.X)*(j.Y-a.Y);if(St===0)return-1;St>0==st.Y>j.Y&&(A=1-A)}else if(st.X>a.X){var St=(j.X-a.X)*(st.Y-a.Y)-(st.X-a.X)*(j.Y-a.Y);if(St===0)return-1;St>0==st.Y>j.Y&&(A=1-A)}}j=st}return A},e.Clipper.prototype.PointInPolygon=function(a,P){var A=0,F=P,j=a.X,_=a.Y,st=P.Pt.X,St=P.Pt.Y;do{P=P.Next;var Pt=P.Pt.X,Bt=P.Pt.Y;if(Bt===_&&(Pt===j||St===_&&Pt>j==st<j))return-1;if(St<_!=Bt<_){if(st>=j)if(Pt>j)A=1-A;else{var Ht=(st-j)*(Bt-_)-(Pt-j)*(St-_);if(Ht===0)return-1;Ht>0==Bt>St&&(A=1-A)}else if(Pt>j){var Ht=(st-j)*(Bt-_)-(Pt-j)*(St-_);if(Ht===0)return-1;Ht>0==Bt>St&&(A=1-A)}}st=Pt,St=Bt}while(F!==P);return A},e.Clipper.prototype.Poly2ContainsPoly1=function(a,P){var A=a;do{var F=this.PointInPolygon(A.Pt,P);if(F>=0)return F>0;A=A.Next}while(A!==a);return!0},e.Clipper.prototype.FixupFirstLefts1=function(a,P){for(var A,F,j=0,_=this.m_PolyOuts.length;j<_;j++)A=this.m_PolyOuts[j],F=e.Clipper.ParseFirstLeft(A.FirstLeft),A.Pts!==null&&F===a&&this.Poly2ContainsPoly1(A.Pts,P.Pts)&&(A.FirstLeft=P)},e.Clipper.prototype.FixupFirstLefts2=function(a,P){for(var A=P.FirstLeft,F,j,_=0,st=this.m_PolyOuts.length;_<st;_++)F=this.m_PolyOuts[_],!(F.Pts===null||F===P||F===a)&&(j=e.Clipper.ParseFirstLeft(F.FirstLeft),!(j!==A&&j!==a&&j!==P)&&(this.Poly2ContainsPoly1(F.Pts,a.Pts)?F.FirstLeft=a:this.Poly2ContainsPoly1(F.Pts,P.Pts)?F.FirstLeft=P:(F.FirstLeft===a||F.FirstLeft===P)&&(F.FirstLeft=A)))},e.Clipper.prototype.FixupFirstLefts3=function(a,P){for(var A,F,j=0,_=this.m_PolyOuts.length;j<_;j++)A=this.m_PolyOuts[j],F=e.Clipper.ParseFirstLeft(A.FirstLeft),A.Pts!==null&&F===a&&(A.FirstLeft=P)},e.Clipper.ParseFirstLeft=function(a){for(;a!==null&&a.Pts===null;)a=a.FirstLeft;return a},e.Clipper.prototype.JoinCommonEdges=function(){for(var a=0,P=this.m_Joins.length;a<P;a++){var A=this.m_Joins[a],F=this.GetOutRec(A.OutPt1.Idx),j=this.GetOutRec(A.OutPt2.Idx);if(!(F.Pts===null||j.Pts===null)&&!(F.IsOpen||j.IsOpen)){var _;F===j?_=F:this.OutRec1RightOfOutRec2(F,j)?_=j:this.OutRec1RightOfOutRec2(j,F)?_=F:_=this.GetLowermostRec(F,j),this.JoinPoints(A,F,j)&&(F===j?(F.Pts=A.OutPt1,F.BottomPt=null,j=this.CreateOutRec(),j.Pts=A.OutPt2,this.UpdateOutPtIdxs(j),this.Poly2ContainsPoly1(j.Pts,F.Pts)?(j.IsHole=!F.IsHole,j.FirstLeft=F,this.m_UsingPolyTree&&this.FixupFirstLefts2(j,F),(j.IsHole^this.ReverseSolution)==this.Area$1(j)>0&&this.ReversePolyPtLinks(j.Pts)):this.Poly2ContainsPoly1(F.Pts,j.Pts)?(j.IsHole=F.IsHole,F.IsHole=!j.IsHole,j.FirstLeft=F.FirstLeft,F.FirstLeft=j,this.m_UsingPolyTree&&this.FixupFirstLefts2(F,j),(F.IsHole^this.ReverseSolution)==this.Area$1(F)>0&&this.ReversePolyPtLinks(F.Pts)):(j.IsHole=F.IsHole,j.FirstLeft=F.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(F,j))):(j.Pts=null,j.BottomPt=null,j.Idx=F.Idx,F.IsHole=_.IsHole,_===j&&(F.FirstLeft=j.FirstLeft),j.FirstLeft=F,this.m_UsingPolyTree&&this.FixupFirstLefts3(j,F)))}}},e.Clipper.prototype.UpdateOutPtIdxs=function(a){var P=a.Pts;do P.Idx=a.Idx,P=P.Prev;while(P!==a.Pts)},e.Clipper.prototype.DoSimplePolygons=function(){for(var a=0;a<this.m_PolyOuts.length;){var P=this.m_PolyOuts[a++],A=P.Pts;if(!(A===null||P.IsOpen))do{for(var F=A.Next;F!==P.Pts;){if(e.IntPoint.op_Equality(A.Pt,F.Pt)&&F.Next!==A&&F.Prev!==A){var j=A.Prev,_=F.Prev;A.Prev=_,_.Next=A,F.Prev=j,j.Next=F,P.Pts=A;var st=this.CreateOutRec();st.Pts=F,this.UpdateOutPtIdxs(st),this.Poly2ContainsPoly1(st.Pts,P.Pts)?(st.IsHole=!P.IsHole,st.FirstLeft=P,this.m_UsingPolyTree&&this.FixupFirstLefts2(st,P)):this.Poly2ContainsPoly1(P.Pts,st.Pts)?(st.IsHole=P.IsHole,P.IsHole=!st.IsHole,st.FirstLeft=P.FirstLeft,P.FirstLeft=st,this.m_UsingPolyTree&&this.FixupFirstLefts2(P,st)):(st.IsHole=P.IsHole,st.FirstLeft=P.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(P,st)),F=A}F=F.Next}A=A.Next}while(A!==P.Pts)}},e.Clipper.Area=function(a){if(!Array.isArray(a))return 0;var P=a.length;if(P<3)return 0;for(var A=0,F=0,j=P-1;F<P;++F)A+=(a[j].X+a[F].X)*(a[j].Y-a[F].Y),j=F;return-A*.5},e.Clipper.prototype.Area=function(a){var P=a;if(a===null)return 0;var A=0;do A=A+(a.Prev.Pt.X+a.Pt.X)*(a.Prev.Pt.Y-a.Pt.Y),a=a.Next;while(a!==P);return A*.5},e.Clipper.prototype.Area$1=function(a){return this.Area(a.Pts)},e.Clipper.SimplifyPolygon=function(a,P){var A=new Array,F=new e.Clipper(0);return F.StrictlySimple=!0,F.AddPath(a,e.PolyType.ptSubject,!0),F.Execute(e.ClipType.ctUnion,A,P,P),A},e.Clipper.SimplifyPolygons=function(a,P){typeof P>"u"&&(P=e.PolyFillType.pftEvenOdd);var A=new Array,F=new e.Clipper(0);return F.StrictlySimple=!0,F.AddPaths(a,e.PolyType.ptSubject,!0),F.Execute(e.ClipType.ctUnion,A,P,P),A},e.Clipper.DistanceSqrd=function(a,P){var A=a.X-P.X,F=a.Y-P.Y;return A*A+F*F},e.Clipper.DistanceFromLineSqrd=function(a,P,A){var F=P.Y-A.Y,j=A.X-P.X,_=F*P.X+j*P.Y;return _=F*a.X+j*a.Y-_,_*_/(F*F+j*j)},e.Clipper.SlopesNearCollinear=function(a,P,A,F){return Math.abs(a.X-P.X)>Math.abs(a.Y-P.Y)?a.X>P.X==a.X<A.X?e.Clipper.DistanceFromLineSqrd(a,P,A)<F:P.X>a.X==P.X<A.X?e.Clipper.DistanceFromLineSqrd(P,a,A)<F:e.Clipper.DistanceFromLineSqrd(A,a,P)<F:a.Y>P.Y==a.Y<A.Y?e.Clipper.DistanceFromLineSqrd(a,P,A)<F:P.Y>a.Y==P.Y<A.Y?e.Clipper.DistanceFromLineSqrd(P,a,A)<F:e.Clipper.DistanceFromLineSqrd(A,a,P)<F},e.Clipper.PointsAreClose=function(a,P,A){var F=a.X-P.X,j=a.Y-P.Y;return F*F+j*j<=A},e.Clipper.ExcludeOp=function(a){var P=a.Prev;return P.Next=a.Next,a.Next.Prev=P,P.Idx=0,P},e.Clipper.CleanPolygon=function(a,P){typeof P>"u"&&(P=1.415);var A=a.length;if(A===0)return new Array;for(var F=new Array(A),j=0;j<A;++j)F[j]=new e.OutPt;for(var j=0;j<A;++j)F[j].Pt=a[j],F[j].Next=F[(j+1)%A],F[j].Next.Prev=F[j],F[j].Idx=0;for(var _=P*P,st=F[0];st.Idx===0&&st.Next!==st.Prev;)e.Clipper.PointsAreClose(st.Pt,st.Prev.Pt,_)?(st=e.Clipper.ExcludeOp(st),A--):e.Clipper.PointsAreClose(st.Prev.Pt,st.Next.Pt,_)?(e.Clipper.ExcludeOp(st.Next),st=e.Clipper.ExcludeOp(st),A-=2):e.Clipper.SlopesNearCollinear(st.Prev.Pt,st.Pt,st.Next.Pt,_)?(st=e.Clipper.ExcludeOp(st),A--):(st.Idx=1,st=st.Next);A<3&&(A=0);for(var St=new Array(A),j=0;j<A;++j)St[j]=new e.IntPoint1(st.Pt),st=st.Next;return F=null,St},e.Clipper.CleanPolygons=function(a,P){for(var A=new Array(a.length),F=0,j=a.length;F<j;F++)A[F]=e.Clipper.CleanPolygon(a[F],P);return A},e.Clipper.Minkowski=function(a,P,A,F){var j=F?1:0,_=a.length,st=P.length,St=new Array;if(A)for(var Pt=0;Pt<st;Pt++){for(var Bt=new Array(_),Ht=0,jt=a.length,qt=a[Ht];Ht<jt;Ht++,qt=a[Ht])Bt[Ht]=new e.IntPoint2(P[Pt].X+qt.X,P[Pt].Y+qt.Y);St.push(Bt)}else for(var Pt=0;Pt<st;Pt++){for(var Bt=new Array(_),Ht=0,jt=a.length,qt=a[Ht];Ht<jt;Ht++,qt=a[Ht])Bt[Ht]=new e.IntPoint2(P[Pt].X-qt.X,P[Pt].Y-qt.Y);St.push(Bt)}for(var oe=new Array,Pt=0;Pt<st-1+j;Pt++)for(var Ht=0;Ht<_;Ht++){var me=new Array;me.push(St[Pt%st][Ht%_]),me.push(St[(Pt+1)%st][Ht%_]),me.push(St[(Pt+1)%st][(Ht+1)%_]),me.push(St[Pt%st][(Ht+1)%_]),e.Clipper.Orientation(me)||me.reverse(),oe.push(me)}return oe},e.Clipper.MinkowskiSum=function(a,P,A){if(P[0]instanceof Array){for(var j=P,st=new e.Paths,_=new e.Clipper,St=0;St<j.length;++St){var Pt=e.Clipper.Minkowski(a,j[St],!0,A);if(_.AddPaths(Pt,e.PolyType.ptSubject,!0),A){var F=e.Clipper.TranslatePath(j[St],a[0]);_.AddPath(F,e.PolyType.ptClip,!0)}}return _.Execute(e.ClipType.ctUnion,st,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),st}else{var F=P,j=e.Clipper.Minkowski(a,F,!0,A),_=new e.Clipper;return _.AddPaths(j,e.PolyType.ptSubject,!0),_.Execute(e.ClipType.ctUnion,j,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),j}},e.Clipper.TranslatePath=function(a,P){for(var A=new e.Path,F=0;F<a.length;F++)A.push(new e.IntPoint2(a[F].X+P.X,a[F].Y+P.Y));return A},e.Clipper.MinkowskiDiff=function(a,P){var A=e.Clipper.Minkowski(a,P,!1,!0),F=new e.Clipper;return F.AddPaths(A,e.PolyType.ptSubject,!0),F.Execute(e.ClipType.ctUnion,A,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),A},e.Clipper.PolyTreeToPaths=function(a){var P=new Array;return e.Clipper.AddPolyNodeToPaths(a,e.Clipper.NodeType.ntAny,P),P},e.Clipper.AddPolyNodeToPaths=function(a,P,A){var F=!0;switch(P){case e.Clipper.NodeType.ntOpen:return;case e.Clipper.NodeType.ntClosed:F=!a.IsOpen;break}a.m_polygon.length>0&&F&&A.push(a.m_polygon);for(var j=0,_=a.Childs(),st=_.length,St=_[j];j<st;j++,St=_[j])e.Clipper.AddPolyNodeToPaths(St,P,A)},e.Clipper.OpenPathsFromPolyTree=function(a){for(var P=new e.Paths,A=0,F=a.ChildCount();A<F;A++)a.Childs()[A].IsOpen&&P.push(a.Childs()[A].m_polygon);return P},e.Clipper.ClosedPathsFromPolyTree=function(a){var P=new e.Paths;return e.Clipper.AddPolyNodeToPaths(a,e.Clipper.NodeType.ntClosed,P),P},hi(e.Clipper,e.ClipperBase),e.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2},e.ClipperOffset=function(a,P){typeof a>"u"&&(a=2),typeof P>"u"&&(P=e.ClipperOffset.def_arc_tolerance),this.m_destPolys=new e.Paths,this.m_srcPoly=new e.Path,this.m_destPoly=new e.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new e.IntPoint0,this.m_polyNodes=new e.PolyNode,this.MiterLimit=a,this.ArcTolerance=P,this.m_lowest.X=-1},e.ClipperOffset.two_pi=6.28318530717959,e.ClipperOffset.def_arc_tolerance=.25,e.ClipperOffset.prototype.Clear=function(){e.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1},e.ClipperOffset.Round=e.Clipper.Round,e.ClipperOffset.prototype.AddPath=function(a,P,A){var F=a.length-1;if(!(F<0)){var j=new e.PolyNode;if(j.m_jointype=P,j.m_endtype=A,A===e.EndType.etClosedLine||A===e.EndType.etClosedPolygon)for(;F>0&&e.IntPoint.op_Equality(a[0],a[F]);)F--;j.m_polygon.push(a[0]);for(var _=0,st=0,St=1;St<=F;St++)e.IntPoint.op_Inequality(j.m_polygon[_],a[St])&&(_++,j.m_polygon.push(a[St]),(a[St].Y>j.m_polygon[st].Y||a[St].Y===j.m_polygon[st].Y&&a[St].X<j.m_polygon[st].X)&&(st=_));if(!(A===e.EndType.etClosedPolygon&&_<2)&&(this.m_polyNodes.AddChild(j),A===e.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new e.IntPoint2(this.m_polyNodes.ChildCount()-1,st);else{var Pt=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(j.m_polygon[st].Y>Pt.Y||j.m_polygon[st].Y===Pt.Y&&j.m_polygon[st].X<Pt.X)&&(this.m_lowest=new e.IntPoint2(this.m_polyNodes.ChildCount()-1,st))}}},e.ClipperOffset.prototype.AddPaths=function(a,P,A){for(var F=0,j=a.length;F<j;F++)this.AddPath(a[F],P,A)},e.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!e.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var a=0;a<this.m_polyNodes.ChildCount();a++){var P=this.m_polyNodes.Childs()[a];(P.m_endtype===e.EndType.etClosedPolygon||P.m_endtype===e.EndType.etClosedLine&&e.Clipper.Orientation(P.m_polygon))&&P.m_polygon.reverse()}else for(var a=0;a<this.m_polyNodes.ChildCount();a++){var P=this.m_polyNodes.Childs()[a];P.m_endtype===e.EndType.etClosedLine&&!e.Clipper.Orientation(P.m_polygon)&&P.m_polygon.reverse()}},e.ClipperOffset.GetUnitNormal=function(a,P){var A=P.X-a.X,F=P.Y-a.Y;if(A===0&&F===0)return new e.DoublePoint2(0,0);var j=1/Math.sqrt(A*A+F*F);return A*=j,F*=j,new e.DoublePoint2(F,-A)},e.ClipperOffset.prototype.DoOffset=function(a){if(this.m_destPolys=new Array,this.m_delta=a,e.ClipperBase.near_zero(a)){for(var P=0;P<this.m_polyNodes.ChildCount();P++){var A=this.m_polyNodes.Childs()[P];A.m_endtype===e.EndType.etClosedPolygon&&this.m_destPolys.push(A.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var F;this.ArcTolerance<=0?F=e.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(a)*e.ClipperOffset.def_arc_tolerance?F=Math.abs(a)*e.ClipperOffset.def_arc_tolerance:F=this.ArcTolerance;var j=3.14159265358979/Math.acos(1-F/Math.abs(a));this.m_sin=Math.sin(e.ClipperOffset.two_pi/j),this.m_cos=Math.cos(e.ClipperOffset.two_pi/j),this.m_StepsPerRad=j/e.ClipperOffset.two_pi,a<0&&(this.m_sin=-this.m_sin);for(var P=0;P<this.m_polyNodes.ChildCount();P++){var A=this.m_polyNodes.Childs()[P];this.m_srcPoly=A.m_polygon;var _=this.m_srcPoly.length;if(!(_===0||a<=0&&(_<3||A.m_endtype!==e.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,_===1){if(A.m_jointype===e.JoinType.jtRound)for(var st=1,St=0,Pt=1;Pt<=j;Pt++){this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X+st*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y+St*a)));var Bt=st;st=st*this.m_cos-this.m_sin*St,St=Bt*this.m_sin+St*this.m_cos}else for(var st=-1,St=-1,Pt=0;Pt<4;++Pt)this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X+st*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y+St*a))),st<0?st=1:St<0?St=1:st=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var Pt=0;Pt<_-1;Pt++)this.m_normals.push(e.ClipperOffset.GetUnitNormal(this.m_srcPoly[Pt],this.m_srcPoly[Pt+1]));if(A.m_endtype===e.EndType.etClosedLine||A.m_endtype===e.EndType.etClosedPolygon?this.m_normals.push(e.ClipperOffset.GetUnitNormal(this.m_srcPoly[_-1],this.m_srcPoly[0])):this.m_normals.push(new e.DoublePoint1(this.m_normals[_-2])),A.m_endtype===e.EndType.etClosedPolygon){for(var Ht=_-1,Pt=0;Pt<_;Pt++)Ht=this.OffsetPoint(Pt,Ht,A.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(A.m_endtype===e.EndType.etClosedLine){for(var Ht=_-1,Pt=0;Pt<_;Pt++)Ht=this.OffsetPoint(Pt,Ht,A.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var jt=this.m_normals[_-1],Pt=_-1;Pt>0;Pt--)this.m_normals[Pt]=new e.DoublePoint2(-this.m_normals[Pt-1].X,-this.m_normals[Pt-1].Y);this.m_normals[0]=new e.DoublePoint2(-jt.X,-jt.Y),Ht=0;for(var Pt=_-1;Pt>=0;Pt--)Ht=this.OffsetPoint(Pt,Ht,A.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var Ht=0,Pt=1;Pt<_-1;++Pt)Ht=this.OffsetPoint(Pt,Ht,A.m_jointype);var qt;if(A.m_endtype===e.EndType.etOpenButt){var Pt=_-1;qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[Pt].X+this.m_normals[Pt].X*a),e.ClipperOffset.Round(this.m_srcPoly[Pt].Y+this.m_normals[Pt].Y*a)),this.m_destPoly.push(qt),qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[Pt].X-this.m_normals[Pt].X*a),e.ClipperOffset.Round(this.m_srcPoly[Pt].Y-this.m_normals[Pt].Y*a)),this.m_destPoly.push(qt)}else{var Pt=_-1;Ht=_-2,this.m_sinA=0,this.m_normals[Pt]=new e.DoublePoint2(-this.m_normals[Pt].X,-this.m_normals[Pt].Y),A.m_endtype===e.EndType.etOpenSquare?this.DoSquare(Pt,Ht):this.DoRound(Pt,Ht)}for(var Pt=_-1;Pt>0;Pt--)this.m_normals[Pt]=new e.DoublePoint2(-this.m_normals[Pt-1].X,-this.m_normals[Pt-1].Y);this.m_normals[0]=new e.DoublePoint2(-this.m_normals[1].X,-this.m_normals[1].Y),Ht=_-1;for(var Pt=Ht-1;Pt>0;--Pt)Ht=this.OffsetPoint(Pt,Ht,A.m_jointype);A.m_endtype===e.EndType.etOpenButt?(qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*a)),this.m_destPoly.push(qt),qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*a)),this.m_destPoly.push(qt)):(Ht=1,this.m_sinA=0,A.m_endtype===e.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}},e.ClipperOffset.prototype.Execute=function(){var a=arguments,P=a[0]instanceof e.PolyTree;if(P){var A=a[0],F=a[1];A.Clear(),this.FixOrientations(),this.DoOffset(F);var j=new e.Clipper(0);if(j.AddPaths(this.m_destPolys,e.PolyType.ptSubject,!0),F>0)j.Execute(e.ClipType.ctUnion,A,e.PolyFillType.pftPositive,e.PolyFillType.pftPositive);else{var _=e.Clipper.GetBounds(this.m_destPolys),st=new e.Path;if(st.push(new e.IntPoint2(_.left-10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.top-10)),st.push(new e.IntPoint2(_.left-10,_.top-10)),j.AddPath(st,e.PolyType.ptSubject,!0),j.ReverseSolution=!0,j.Execute(e.ClipType.ctUnion,A,e.PolyFillType.pftNegative,e.PolyFillType.pftNegative),A.ChildCount()===1&&A.Childs()[0].ChildCount()>0){var St=A.Childs()[0];A.Childs()[0]=St.Childs()[0],A.Childs()[0].m_Parent=A;for(var Pt=1;Pt<St.ChildCount();Pt++)A.AddChild(St.Childs()[Pt])}else A.Clear()}}else{var A=a[0],F=a[1];e.Clear(A),this.FixOrientations(),this.DoOffset(F);var j=new e.Clipper(0);if(j.AddPaths(this.m_destPolys,e.PolyType.ptSubject,!0),F>0)j.Execute(e.ClipType.ctUnion,A,e.PolyFillType.pftPositive,e.PolyFillType.pftPositive);else{var _=e.Clipper.GetBounds(this.m_destPolys),st=new e.Path;st.push(new e.IntPoint2(_.left-10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.top-10)),st.push(new e.IntPoint2(_.left-10,_.top-10)),j.AddPath(st,e.PolyType.ptSubject,!0),j.ReverseSolution=!0,j.Execute(e.ClipType.ctUnion,A,e.PolyFillType.pftNegative,e.PolyFillType.pftNegative),A.length>0&&A.splice(0,1)}}},e.ClipperOffset.prototype.OffsetPoint=function(a,P,A){if(this.m_sinA=this.m_normals[P].X*this.m_normals[a].Y-this.m_normals[a].X*this.m_normals[P].Y,Math.abs(this.m_sinA*this.m_delta)<1){var F=this.m_normals[P].X*this.m_normals[a].X+this.m_normals[a].Y*this.m_normals[P].Y;if(F>0)return this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[P].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[P].Y*this.m_delta))),P}else this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1);if(this.m_sinA*this.m_delta<0)this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[P].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[P].Y*this.m_delta))),this.m_destPoly.push(new e.IntPoint1(this.m_srcPoly[a])),this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[a].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[a].Y*this.m_delta)));else switch(A){case e.JoinType.jtMiter:{var j=1+(this.m_normals[a].X*this.m_normals[P].X+this.m_normals[a].Y*this.m_normals[P].Y);j>=this.m_miterLim?this.DoMiter(a,P,j):this.DoSquare(a,P);break}case e.JoinType.jtSquare:this.DoSquare(a,P);break;case e.JoinType.jtRound:this.DoRound(a,P);break}return P=a,P},e.ClipperOffset.prototype.DoSquare=function(a,P){var A=Math.tan(Math.atan2(this.m_sinA,this.m_normals[P].X*this.m_normals[a].X+this.m_normals[P].Y*this.m_normals[a].Y)/4);this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_delta*(this.m_normals[P].X-this.m_normals[P].Y*A)),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_delta*(this.m_normals[P].Y+this.m_normals[P].X*A)))),this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_delta*(this.m_normals[a].X+this.m_normals[a].Y*A)),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_delta*(this.m_normals[a].Y-this.m_normals[a].X*A))))},e.ClipperOffset.prototype.DoMiter=function(a,P,A){var F=this.m_delta/A;this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+(this.m_normals[P].X+this.m_normals[a].X)*F),e.ClipperOffset.Round(this.m_srcPoly[a].Y+(this.m_normals[P].Y+this.m_normals[a].Y)*F)))},e.ClipperOffset.prototype.DoRound=function(a,P){for(var A=Math.atan2(this.m_sinA,this.m_normals[P].X*this.m_normals[a].X+this.m_normals[P].Y*this.m_normals[a].Y),F=Math.max(e.Cast_Int32(e.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(A))),1),j=this.m_normals[P].X,_=this.m_normals[P].Y,st,St=0;St<F;++St)this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+j*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+_*this.m_delta))),st=j,j=j*this.m_cos-this.m_sin*_,_=st*this.m_sin+_*this.m_cos;this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[a].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[a].Y*this.m_delta)))},e.Error=function(a){try{throw new Error(a)}catch(P){alert(P.message)}},e.JS={},e.JS.AreaOfPolygon=function(a,P){return P||(P=1),e.Clipper.Area(a)/(P*P)},e.JS.AreaOfPolygons=function(a,P){P||(P=1);for(var A=0,F=0;F<a.length;F++)A+=e.Clipper.Area(a[F]);return A/(P*P)},e.JS.BoundsOfPath=function(a,P){return e.JS.BoundsOfPaths([a],P)},e.JS.BoundsOfPaths=function(a,P){P||(P=1);var A=e.Clipper.GetBounds(a);return A.left/=P,A.bottom/=P,A.right/=P,A.top/=P,A},e.JS.Clean=function(F,P){if(!(F instanceof Array))return[];var A=F[0]instanceof Array,F=e.JS.Clone(F);if(typeof P!="number"||P===null)return e.Error("Delta is not a number in Clean()."),F;if(F.length===0||F.length===1&&F[0].length===0||P<0)return F;A||(F=[F]);for(var j=F.length,_,st,St,Pt,Bt,Ht,jt,qt=[],oe=0;oe<j;oe++)if(st=F[oe],_=st.length,_!==0){if(_<3){St=st,qt.push(St);continue}for(St=st,Pt=P*P,Bt=st[0],Ht=1,jt=1;jt<_;jt++)(st[jt].X-Bt.X)*(st[jt].X-Bt.X)+(st[jt].Y-Bt.Y)*(st[jt].Y-Bt.Y)<=Pt||(St[Ht]=st[jt],Bt=st[jt],Ht++);Bt=st[Ht-1],(st[0].X-Bt.X)*(st[0].X-Bt.X)+(st[0].Y-Bt.Y)*(st[0].Y-Bt.Y)<=Pt&&Ht--,Ht<_&&St.splice(Ht,_-Ht),St.length&&qt.push(St)}return!A&&qt.length?qt=qt[0]:!A&&qt.length===0?qt=[]:A&&qt.length===0&&(qt=[[]]),qt},e.JS.Clone=function(a){if(!(a instanceof Array))return[];if(a.length===0)return[];if(a.length===1&&a[0].length===0)return[[]];var P=a[0]instanceof Array;P||(a=[a]);var A=a.length,F,j,_,st,St=new Array(A);for(j=0;j<A;j++){for(F=a[j].length,st=new Array(F),_=0;_<F;_++)st[_]={X:a[j][_].X,Y:a[j][_].Y};St[j]=st}return P||(St=St[0]),St},e.JS.Lighten=function(a,P){if(!(a instanceof Array))return[];if(typeof P!="number"||P===null)return e.Error("Tolerance is not a number in Lighten()."),e.JS.Clone(a);if(a.length===0||a.length===1&&a[0].length===0||P<0)return e.JS.Clone(a);var A=a[0]instanceof Array;A||(a=[a]);var F,j,_,st,St,Pt,Bt,Ht,jt,qt,oe,me,Se,De,lr,br,on,Ma=a.length,La=P*P,Tn=[];for(F=0;F<Ma;F++)if(_=a[F],Pt=_.length,Pt!==0){for(st=0;st<1e6;st++){for(St=[],Pt=_.length,_[Pt-1].X!==_[0].X||_[Pt-1].Y!==_[0].Y?(me=1,_.push({X:_[0].X,Y:_[0].Y}),Pt=_.length):me=0,oe=[],j=0;j<Pt-2;j++)Bt=_[j],jt=_[j+1],Ht=_[j+2],br=Bt.X,on=Bt.Y,Se=Ht.X-br,De=Ht.Y-on,(Se!==0||De!==0)&&(lr=((jt.X-br)*Se+(jt.Y-on)*De)/(Se*Se+De*De),lr>1?(br=Ht.X,on=Ht.Y):lr>0&&(br+=Se*lr,on+=De*lr)),Se=jt.X-br,De=jt.Y-on,qt=Se*Se+De*De,qt<=La&&(oe[j+1]=1,j++);for(St.push({X:_[0].X,Y:_[0].Y}),j=1;j<Pt-1;j++)oe[j]||St.push({X:_[j].X,Y:_[j].Y});if(St.push({X:_[Pt-1].X,Y:_[Pt-1].Y}),me&&_.pop(),oe.length)_=St;else break}Pt=St.length,St[Pt-1].X===St[0].X&&St[Pt-1].Y===St[0].Y&&St.pop(),St.length>2&&Tn.push(St)}return A||(Tn=Tn[0]),typeof Tn>"u"&&(Tn=[]),Tn},e.JS.PerimeterOfPath=function(a,P,A){if(typeof a>"u")return 0;var F=Math.sqrt,j=0,_,st,St=0,Pt=0,Bt=0,Ht=0,jt=a.length;if(jt<2)return 0;for(P&&(a[jt]=a[0],jt++);--jt;)_=a[jt],St=_.X,Pt=_.Y,st=a[jt-1],Bt=st.X,Ht=st.Y,j+=F((St-Bt)*(St-Bt)+(Pt-Ht)*(Pt-Ht));return P&&a.pop(),j/A},e.JS.PerimeterOfPaths=function(a,P,A){A||(A=1);for(var F=0,j=0;j<a.length;j++)F+=e.JS.PerimeterOfPath(a[j],P,A);return F},e.JS.ScaleDownPath=function(a,P){var A,F;for(P||(P=1),A=a.length;A--;)F=a[A],F.X=F.X/P,F.Y=F.Y/P},e.JS.ScaleDownPaths=function(a,P){var A,F,j;for(P||(P=1),A=a.length;A--;)for(F=a[A].length;F--;)j=a[A][F],j.X=j.X/P,j.Y=j.Y/P},e.JS.ScaleUpPath=function(a,P){var A,F,j=Math.round;for(P||(P=1),A=a.length;A--;)F=a[A],F.X=j(F.X*P),F.Y=j(F.Y*P)},e.JS.ScaleUpPaths=function(a,P){var A,F,j,_=Math.round;for(P||(P=1),A=a.length;A--;)for(F=a[A].length;F--;)j=a[A][F],j.X=_(j.X*P),j.Y=_(j.Y*P)},e.ExPolygons=function(){return[]},e.ExPolygon=function(){this.outer=null,this.holes=null},e.JS.AddOuterPolyNodeToExPolygons=function(a,P){var A=new e.ExPolygon;A.outer=a.Contour();var F=a.Childs(),j=F.length;A.holes=new Array(j);var _,st,St,Pt,Bt,Ht;for(St=0;St<j;St++)for(_=F[St],A.holes[St]=_.Contour(),Pt=0,Bt=_.Childs(),Ht=Bt.length;Pt<Ht;Pt++)st=Bt[Pt],e.JS.AddOuterPolyNodeToExPolygons(st,P);P.push(A)},e.JS.ExPolygonsToPaths=function(a){var P,A,F,j,_=new e.Paths;for(P=0,F=a.length;P<F;P++)for(_.push(a[P].outer),A=0,j=a[P].holes.length;A<j;A++)_.push(a[P].holes[A]);return _},e.JS.PolyTreeToExPolygons=function(a){var P=new e.ExPolygons,A,F,j,_;for(F=0,j=a.Childs(),_=j.length;F<_;F++)A=j[F],e.JS.AddOuterPolyNodeToExPolygons(A,P);return P}})()})($f);var JS=$f.exports,Kr=mn(JS);function jf(i,e,t=.01){return Math.abs(i[0]-e[0])<t&&Math.abs(i[1]-e[1])<t}function QS(i,e=.01){if(i.length===0)return[];const t=[[i[0][0],i[0][1]]];for(let r=1;r<i.length;r++)jf([i[r][0],i[r][1]],t[t.length-1],e)||t.push([i[r][0],i[r][1]]);return t}function qS(i,e=.01){if(i.length<=2)return i;const t=i[0],r=i[i.length-1];return jf(t,r,e)?i.slice(0,-1):i}function _S(i){const e=i.reduce((r,n)=>r+n[0],0)/i.length,t=i.reduce((r,n)=>r+n[1],0)/i.length;return[e,t]}function Gf(i,e){return Math.atan2(e[1]-i[1],e[0]-i[0])}function tP(i,e=.01){if(i.length<=2)return i;const t=[];for(const n of i)t.some(c=>Math.abs(c[0]-n[0])<e&&Math.abs(c[1]-n[1])<e)||t.push([n[0],n[1]]);const r=_S(t);return t.sort((n,s)=>{const c=Gf(r,n),l=Gf(r,s);return c-l})}function eP(i,e){const t=e[0].x<e[e.length-1].x;return i.map(n=>{const c=n.map(l=>{let f=-1,h=1/0,v=0;for(let u=0;u<e.length;u++){const y=e[u],T=Math.sqrt(Math.pow(y.x-l[0],2)+Math.pow(y.y-l[1],2));T<h&&(h=T,f=u,v=y.z)}return{point:l,index:f,bestZ:v}}).sort((l,f)=>l.index-f.index).map(l=>[...l.point,l.bestZ]);return t&&c[0][0]>c[c.length-1][0]||!t&&c[0][0]<c[c.length-1][0]?c.reverse():c}).sort((n,s)=>{const c=n[0][0],l=s[0][0];return t?c-l:l-c})}function rP(i,e,t=.01){const n=i.map(u=>[u.x,u.y]),s=(u,y)=>u.map(([T,w])=>({X:Math.round(T*y),Y:Math.round(w*y)})),c=new Kr.ClipperOffset;c.AddPath(s(n,1e3),Kr.JoinType.jtRound,Kr.EndType.etOpenButt);const l=[];c.Execute(l,1);const f=new Kr.Clipper;f.AddPaths(l,Kr.PolyType.ptSubject,!0),e.forEach(u=>{f.AddPath(s(u,1e3),Kr.PolyType.ptClip,!0)});const h=new Kr.Paths;f.Execute(Kr.ClipType.ctDifference,h,Kr.PolyFillType.pftNonZero,Kr.PolyFillType.pftNonZero);const v=h.map(u=>qS(tP(QS(u.map(y=>[y.X/1e3,y.Y/1e3]),t),t),t)).filter(u=>u.length>=2);return eP(v,i)}class kf extends Yt{constructor(t){super(t);dt(this,"canRotate",!0);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.Pencil);dt(this,"syncTimestamp");dt(this,"syncIndex",0);dt(this,"tmpPoints",[]);dt(this,"MAX_REPEAR",10);dt(this,"uniThickness");dt(this,"workOptions");dt(this,"centerPos",[0,0]);this.workOptions=t.toolsOpt,this.uniThickness=this.MAX_REPEAR/this.workOptions.thickness/10,this.syncTimestamp=0}combineConsume(){var l;const t=(l=this.workId)==null?void 0:l.toString();if(this.tmpPoints.length<2)return{type:vt.None};const r=this.transformDataAll(!0),n={name:t};let s;const c=this.drawLayer||this.fullLayer;return r.length&&(s=this.draw({attrs:n,tasks:r,replaceId:t,layer:c})),{rect:s,type:vt.DrawWork,dataType:Kt.Local}}setWorkOptions(t){super.setWorkOptions(t),this.syncTimestamp=Date.now()}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,drawCount:l,removeDrawCount:f,isSimpleWorker:h}=t,{workId:v,syncUnitTime:u}=r;u&&(this.syncUnitTime=u);const{tasks:y,effects:T,consumeIndex:w}=this.transformData(r,!1);this.syncIndex=Math.min(this.syncIndex,w,Math.max(0,this.tmpPoints.length-2));const I={name:v,id:Qe(l)&&l.toString()||void 0};let S,O=!1;const d=this.syncIndex;if(this.syncTimestamp===0&&(this.syncTimestamp=Date.now()),y.length&&(y[0].taskId-this.syncTimestamp>this.syncUnitTime&&(O=!0,this.syncTimestamp=y[0].taskId,this.syncIndex=this.tmpPoints.length),s||c||h)){const p=n?this.fullLayer:this.drawLayer||this.fullLayer;S=this.draw({attrs:I,tasks:y,effects:T,layer:p,removeDrawCount:f})}if(h){const p=[];return this.tmpPoints.slice(d).forEach(x=>{p.push(x.x,x.y,this.computRadius(x.z,this.workOptions.thickness))}),{...this.baseConsumeResult,type:vt.DrawWork,dataType:Kt.Local,op:O?p:void 0,index:O?d*3:void 0,rect:S,updateNodeOpt:{useAnimation:!0}}}if(s)return w>10&&this.tmpPoints.splice(0,w-10),{rect:S,type:vt.DrawWork,dataType:Kt.Local};const g=[];return this.tmpPoints.slice(d).forEach(p=>{g.push(p.x,p.y,this.computRadius(p.z,this.workOptions.thickness))}),{...this.baseConsumeResult,type:vt.DrawWork,dataType:Kt.Local,rect:S,op:O?g:void 0,index:O?d*3:void 0,updateNodeOpt:{useAnimation:!0}}}consumeAll(t){var v;const r=this.workId;if(t.data){const{op:u,workState:y}=t.data;u!=null&&u.length&&y===te.Done&&this.workOptions.strokeType===Ee.Stroke&&this.updateTempPointsWithPressureWhenDone(u)}const n=this.transformDataAll(!0),s={name:r};let c;const l=this.fullLayer;if(n.length&&(c=this.draw({attrs:s,tasks:n,replaceId:r,layer:l})),this.tmpPoints.length<2)return this.replace(l,r),{type:vt.RemoveNode,removeIds:[r],rect:c};const f=[];this.tmpPoints.map(u=>{f.push(u.x,u.y,u.z)}),this.syncTimestamp=0,delete this.workOptions.syncUnitTime;const h=hr(f);return(v=this.vNodes)==null||v.setInfo(r,{rect:c,op:f,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:c&&Yt.getCenterPos(c,l)}),{...this.baseConsumeResult,rect:c,type:vt.FullWork,dataType:Kt.Local,ops:h,updateNodeOpt:{pos:this.centerPos,useAnimation:!0}}}clearTmpPoints(){this.tmpPoints.length=0,this.syncTimestamp=0,this.syncIndex=0}consumeService(t){var u,y;const{op:r,isFullWork:n,replaceId:s,workState:c=te.Done}=t;this.tmpPoints.length=0;for(let T=0;T<r.length;T+=3){const w=new Jt(r[T],r[T+1],r[T+2]);if(this.tmpPoints.length>0){const I=this.tmpPoints[this.tmpPoints.length-1],S=pt.Sub(w,I).uni();w.setv(S)}this.tmpPoints.push(w)}if(this.tmpPoints.length<2)return;const l=this.transformDataAll(!0),f=(u=this.workId)==null?void 0:u.toString(),h={name:f};let v;if(f&&l.length){const T=n?this.fullLayer:this.drawLayer||this.fullLayer;v=this.draw({attrs:h,tasks:l,replaceId:s,layer:T,isDrawEraserlines:c===te.Done}),(y=this.vNodes)==null||y.setInfo(f,{rect:v,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:v&&Yt.getCenterPos(v,T)})}return v}computPencilPoints(t){const r=[],{op:n,eraserPolylines:s,eraserThickness:c}=t;this.tmpPoints.length=0;for(let f=0;f<n.length;f+=3){const h=new Jt(n[f],n[f+1],n[f+2]);if(this.tmpPoints.length>0){const v=this.tmpPoints[this.tmpPoints.length-1],u=pt.Sub(h,v).uni();h.setv(u)}this.tmpPoints.push(h)}if(this.tmpPoints.length<2)return;const l=this.transformDataAll(!0);if(l.length)for(let f=0;f<l.length;f++){const{pos:h,points:v}=l[f],u=v.map(w=>w.point.addXY(h[0],h[1])),y=[];for(const w of s){const I=[];for(let O=0;O<w.length;O+=2){const d=new Jt(w[O],w[O+1]);if(I.length>0){const g=I[I.length-1].point,p=pt.Sub(d,g).uni();d.setv(p)}I.push({point:d,radius:c})}const{ps:S}=this.computStroke(I,!1);y.push(S.map(O=>O.XY))}rP(u,y,.01).forEach(w=>{r.push(w.map(I=>[I[0],I[1],I[2]]).flat(1))})}return r}transformDataAll(t=!0){return this.getTaskPoints(this.tmpPoints,t&&this.workOptions.thickness||void 0)}draw(t){const{attrs:r,tasks:n,replaceId:s,effects:c,layer:l,removeDrawCount:f,isDrawEraserlines:h=!0}=t,{strokeColor:v,strokeType:u,thickness:y,zIndex:T,scale:w,rotate:I,translate:S,eraserlines:O,lineCap:d,lineDash:g}=this.workOptions;c!=null&&c.size&&(c.forEach(U=>{var M;(M=l.getElementById(U+""))==null||M.remove()}),c.clear()),f&&this.removeDrawCountNodes(l,f);let p;const x=[],E=l.worldPosition,R=l.worldScaling;for(let U=0;U<n.length;U++){const{pos:M,points:W}=n[U],{ps:X,rect:B}=this.computDrawPoints(W);let N;const $=W.length===1;u===Ee.Stroke||$?N=yn(X,!0):N=yn(X,!1);const J={pos:M,d:N,fillColor:u===Ee.Stroke||$?v:void 0,lineDash:$?void 0:u===Ee.Dotted?[g&&g[0]||1,(g&&g[1]||2)*y]:u===Ee.LongDotted?[(g&&g[0]||1)*y,(g&&g[1]||2)*y]:void 0,strokeColor:v,lineCap:$?void 0:d,lineWidth:u===Ee.Stroke||$?0:y};p=Zt(p,{x:Math.floor((B.x+M[0])*R[0]+E[0]-Yt.SafeBorderPadding),y:Math.floor((B.y+M[1])*R[1]+E[1]-Yt.SafeBorderPadding),w:Math.floor(B.w*R[0]+2*Yt.SafeBorderPadding),h:Math.floor(B.h*R[1]+2*Yt.SafeBorderPadding)}),x.push(J)}w&&(r.scale=w),I&&(r.rotate=I),S&&(r.translate=S);const D=new Je;if(p){this.centerPos=Yt.getCenterPos(p,l);const U=u===Ee.Stroke&&!O;D.attr({...r,normalize:!0,anchor:[.5,.5],bgcolor:U?v:void 0,pos:this.centerPos,size:[(p.w-2*Yt.SafeBorderPadding)/R[0],(p.h-2*Yt.SafeBorderPadding)/R[1]],zIndex:T});const M=x.map(W=>(W.pos=[W.pos[0]-this.centerPos[0],W.pos[1]-this.centerPos[1]],new gn(W)));D.append(...M),U&&D.seal(),O&&(this.scaleType=Te.proportional,this.drawEraserlines({group:D,eraserlines:O,pos:this.centerPos,layer:l},h)),this.replace(l,s,D)}if(w||I||S){const U=D==null?void 0:D.getBoundingClientRect();U&&(p={x:Math.floor(U.x-Yt.SafeBorderPadding),y:Math.floor(U.y-Yt.SafeBorderPadding),w:Math.floor(U.width+Yt.SafeBorderPadding*2),h:Math.floor(U.height+Yt.SafeBorderPadding*2)})}return this.isDelete&&D.setAttribute("opacity",0),p}computDrawPoints(t){return this.workOptions.strokeType===Ee.Stroke||t.length===1?this.computStroke(t):this.computNomal(t)}computNomal(t){let r=this.workOptions.thickness;const n=t.map(s=>(r=Math.max(r,s.radius),s.point));return{ps:n,rect:Re(n,r)}}computStroke(t,r=!0){return t.length===1?this.computDotStroke(t[0]):this.computLineStroke(t,r)}computLineStroke(t,r=!0){const n=[],s=[];for(let f=0;f<t.length;f++){const{point:h,radius:v}=t[f];let u=h.v;f===0&&t.length>1&&(u=t[f+1].point.v);const y=pt.Per(u).mul(v);n.push(Jt.Sub(h,y)),s.push(Jt.Add(h,y))}const c=t[t.length-1];if(r){const f=Jt.GetSemicircleStroke(c.point,n[n.length-1],-1,8),h=Jt.GetSemicircleStroke(t[0].point,s[0],-1,8),v=n.concat(f,s.reverse(),h);return{ps:v,rect:Re(v)}}const l=n.concat(s.reverse());return{ps:l,rect:Re(l)}}computDotStroke(t){const{point:r,radius:n}=t,s={x:r.x-n,y:r.y-n,w:n*2,h:n*2};return{ps:Jt.GetDotStroke(r,n,8),rect:s}}transformData(t,r){const{op:n,workState:s}=t;let c=this.tmpPoints.length-1,l=[];if(n!=null&&n.length&&s){const{strokeType:f,thickness:h}=this.workOptions,v=new Set;c=f===Ee.Stroke?this.updateTempPointsWithPressure(n,h,v):this.updateTempPoints(n,h,v);const u=r?this.tmpPoints:this.tmpPoints.slice(c);return l=this.getTaskPoints(u,h),{tasks:l,effects:v,consumeIndex:c}}return{tasks:l,consumeIndex:c}}computRadius(t,r){return t*.03*r+r*.5}getMinZ(t,r){return((r||Math.max(1,Math.floor(t*.3)))-t*.5)*100/t/3}getTaskPoints(t,r){var u;const n=[];if(t.length===0)return[];let s=0,c=t[0].x,l=t[0].y,f=[c,l],h=[],v=t[0].t;for(;s<t.length;){const y=t[s],T=y.x-c,w=y.y-l,I=y.z,S=r?this.computRadius(I,r):I;if(h.push({point:new Jt(T,w,I,t[s].v),radius:S}),s>0&&s<t.length-1){const O=t[s].getAngleByPoints(t[s-1],t[s+1]);if(O<60||O>300){const d=(u=h.pop())==null?void 0:u.point.clone();d&&n.push({taskId:v,pos:f,points:[...h,{point:d,radius:S}]}),c=t[s].x,l=t[s].y,f=[c,l];const g=y.x-c,p=y.y-l;h=[{point:new Jt(g,p,I),radius:S}],v=Date.now()}}s++}return n.push({taskId:v,pos:f,points:h}),n}updateTempPointsWithPressure(t,r,n){const s=Date.now(),c=this.tmpPoints.length;let l=c;for(let h=0;h<t.length;h+=2){l=Math.min(l,c);const v=this.tmpPoints.length,u=new Jt(t[h],t[h+1]);if(v===0){this.tmpPoints.push(u);continue}const y=v-1,T=this.tmpPoints[y],w=pt.Sub(u,T).uni();if(u.isNear(T,r)){if(T.z<this.MAX_REPEAR){if(T.setz(Math.min(T.z+1,this.MAX_REPEAR)),l=Math.min(l,y),v>1){let O=v-1;for(;O>0;){const d=this.tmpPoints[O].distance(this.tmpPoints[O-1]),g=Math.max(this.tmpPoints[O].z-this.uniThickness*d,0);if(this.tmpPoints[O-1].z>=g)break;this.tmpPoints[O-1].setz(g),l=Math.min(l,O-1),O--}}}else l=1/0;continue}u.setv(w);const I=u.distance(T),S=Math.max(T.z-this.uniThickness*I,0);v>1&&pt.Equals(w,T.v,.02)&&(S>0||T.z<=0)&&(n&&T.t&&n.add(T.t),this.tmpPoints.pop(),l=Math.min(y,l)),u.setz(S),this.tmpPoints.push(u)}if(l===1/0)return this.tmpPoints.length;let f=c;if(l===c){f=Math.max(f-1,0);const h=this.tmpPoints[f].t;h&&(n==null||n.add(h))}else{let h=c-1;for(f=l;h>=0;){const v=this.tmpPoints[h].t;if(v&&(n==null||n.add(v),h<=l)){f=h,h=-1;break}h--}}return this.tmpPoints[f].setT(s),f}updateTempPoints(t,r,n){var h;const s=Date.now(),c=this.tmpPoints.length;let l=c;for(let v=0;v<t.length;v+=2){const u=this.tmpPoints.length,y=new Jt(t[v],t[v+1]);if(u===0){this.tmpPoints.push(y);continue}const T=u-1,w=this.tmpPoints[T],I=pt.Sub(y,w).uni();if(y.isNear(w,r/2)){l=Math.min(T,l);continue}pt.Equals(I,w.v,.02)&&(n&&w.t&&n.add(w.t),this.tmpPoints.pop(),l=Math.min(T,l)),y.setv(I),this.tmpPoints.push(y)}let f=c;if(l===c){f=Math.max(f-1,0);const v=this.tmpPoints[f].t;v&&(n==null||n.add(v))}else{let v=Math.min(c-1,l);for(f=l;v>=0;){const u=(h=this.tmpPoints[v])==null?void 0:h.t;if(u&&(n==null||n.add(u),v<=l)){f=v,v=-1;break}v--}}return this.tmpPoints[f].setT(s),f}updateTempPointsWithPressureWhenDone(t){const{thickness:r}=this.workOptions,n=t.length,s=this.getMinZ(r);for(let c=0;c<n;c+=2){const l=this.tmpPoints.length,f=new Jt(t[c],t[c+1]);if(l===0){this.tmpPoints.push(f);continue}const h=l-1,v=this.tmpPoints[h],u=pt.Sub(f,v).uni(),y=f.distance(v);if(l>1&&v.z===s)break;if(f.isNear(v,r/2)){if(n<3&&v.z<this.MAX_REPEAR&&(v.setz(Math.min(v.z+1,this.MAX_REPEAR)),l>1)){let w=l-1;for(;w>0;){const I=this.tmpPoints[w].distance(this.tmpPoints[w-1]),S=Math.max(this.tmpPoints[w].z-this.uniThickness*I,-r/4);if(this.tmpPoints[w-1].z>=S)break;this.tmpPoints[w-1].setz(S),w--}}continue}f.setv(u);const T=Math.max(v.z-this.uniThickness*y,s);l>1&&pt.Equals(u,v.v,.02)&&v.z<=0&&this.tmpPoints.pop(),f.setz(T),this.tmpPoints.push(f)}}static updateNodeOpt(t){var u,y;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,strokeType:l,lineCap:f,lineDash:h}=n,v=s.get(r.name);return c&&(r.tagName==="GROUP"?hT(r)?r.setAttribute("bgcolor",c):r.children.forEach(T=>{T.setAttribute("strokeColor",c),T.getAttribute("fillColor")&&T.setAttribute("fillColor",c)}):(r.setAttribute("strokeColor",c),r.setAttribute("fillColor",c)),(u=v==null?void 0:v.opt)!=null&&u.strokeColor&&(v.opt.strokeColor=c)),l&&(v!=null&&v.opt)&&((y=v.opt)!=null&&y.strokeType)&&(v.opt.strokeType=l),f&&(v!=null&&v.opt)&&(v.opt.lineCap=f),h&&(v!=null&&v.opt)&&(v.opt.lineDash=h),v&&s.setInfo(r.name,v),Yt.updateNodeOpt(t)}}class Hf extends Yt{constructor(t){super(t);dt(this,"toolsType",xt.LaserPen);dt(this,"canRotate",!1);dt(this,"scaleType",Te.none);dt(this,"syncTimestamp");dt(this,"syncIndex",0);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"consumeIndex",0);this.workOptions=t.toolsOpt,this.syncTimestamp=0}combineConsume(){}setWorkOptions(t){super.setWorkOptions(t),this.syncTimestamp=Date.now()}consume(t){const{data:r,isSubWorker:n}=t,{workId:s,op:c,syncUnitTime:l}=r;if((c==null?void 0:c.length)===0)return{type:vt.None};if(l&&(this.syncUnitTime=l),this.updateTempPoints(c||[]),this.consumeIndex>this.tmpPoints.length-4)return{type:vt.None};const{strokeColor:f,thickness:h,strokeType:v,lineDash:u,lineCap:y}=this.workOptions,T=Re(this.tmpPoints,h);let w=!1;const I=this.syncIndex,S=this.tmpPoints.slice(this.consumeIndex);this.consumeIndex=this.tmpPoints.length-1,this.syncTimestamp===0&&(this.syncTimestamp=Date.now());const O={name:s==null?void 0:s.toString(),opacity:1,lineDash:v===Ee.Dotted?[u&&u[0]||1,(u&&u[1]||2)*h]:v===Ee.LongDotted?[(u&&u[0]||1)*h,(u&&u[1]||2)*h]:void 0,strokeColor:f,lineCap:y,lineWidth:h,anchor:[.5,.5]},d=this.getTaskPoints(S);if(d.length){const p=Date.now();p-this.syncTimestamp>this.syncUnitTime&&(w=!0,this.syncTimestamp=p,this.syncIndex=this.tmpPoints.length),n&&this.draw({attrs:O,tasks:d,isDot:!1,layer:this.drawLayer||this.fullLayer})}const g=[];return this.tmpPoints.slice(I).forEach(p=>{g.push(p.x,p.y)}),{rect:{x:T.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:T.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:T.w*this.fullLayer.worldScaling[0],h:T.h*this.fullLayer.worldScaling[1]},type:vt.DrawWork,dataType:Kt.Local,op:w?g:void 0,index:w?I*2:void 0,...this.baseConsumeResult}}consumeAll(){var c;const t=(c=this.workId)==null?void 0:c.toString();let r;if(this.tmpPoints.length-1>this.consumeIndex){let l=this.tmpPoints.slice(this.consumeIndex);const f=l.length===1,{strokeColor:h,thickness:v,strokeType:u}=this.workOptions;if(f){const w=this.computDotStroke({point:l[0],radius:v/2});l=w.ps,r=w.rect}else r=Re(this.tmpPoints,v);const y={name:t==null?void 0:t.toString(),fillColor:f?h:void 0,opacity:1,lineDash:u===Ee.Dotted&&!f?[1,v*2]:u===Ee.LongDotted&&!f?[v,v*2]:void 0,strokeColor:h,lineCap:f?void 0:"round",lineWidth:f?0:v,anchor:[.5,.5]},T=this.getTaskPoints(l);T.length&&this.draw({attrs:y,tasks:T,isDot:f,layer:this.drawLayer||this.fullLayer})}const n=[];this.tmpPoints.forEach(l=>{n.push(l.x,l.y)});const s=hr(n);return{rect:r&&{x:r.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:r.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:r.w*this.fullLayer.worldScaling[0],h:r.h*this.fullLayer.worldScaling[1]},type:vt.FullWork,dataType:Kt.Local,ops:s,index:this.syncIndex*2,...this.baseConsumeResult}}clearTmpPoints(){this.tmpPoints.length=0,this.syncTimestamp=0,this.syncIndex=0}consumeService(t){var I;const{op:r,replaceId:n,isFullWork:s}=t,{strokeColor:c,thickness:l,strokeType:f}=this.workOptions;if(!r.length){const S=Re(this.tmpPoints,l);return{x:S.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:S.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:S.w*this.fullLayer.worldScaling[0],h:S.h*this.fullLayer.worldScaling[1]}}const h=Math.max(0,this.tmpPoints.length-1);this.updateTempPoints(r||[]);let v,u=this.tmpPoints.slice(h);const y=u.length===1;if(y){const S=this.computDotStroke({point:u[0],radius:l/2});u=S.ps,v=S.rect}else v=Re(this.tmpPoints,l);const T={name:(I=this.workId)==null?void 0:I.toString(),fillColor:y?c:void 0,opacity:1,lineDash:f===Ee.Dotted&&!y?[1,l*2]:f===Ee.LongDotted&&!y?[l,l*2]:void 0,strokeColor:c,lineCap:y?void 0:"round",lineWidth:y?0:l,anchor:[.5,.5]},w=this.getTaskPoints(u);if(w.length){const S=s?this.fullLayer:this.drawLayer||this.fullLayer;this.draw({attrs:T,tasks:w,isDot:y,replaceId:n,layer:S})}return{x:v.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:v.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:v.w*this.fullLayer.worldScaling[0],h:v.h*this.fullLayer.worldScaling[1]}}computDotStroke(t){const{point:r,radius:n}=t,s={x:r.x-n,y:r.y-n,w:n*2,h:n*2};return{ps:Jt.GetDotStroke(r,n,8),rect:s}}updateTempPoints(t){const r=this.tmpPoints.length;for(let n=0;n<t.length;n+=2){if(r){const s=this.tmpPoints.slice(-1)[0];s&&s.x===t[n]&&s.y===t[n+1]&&this.tmpPoints.pop()}this.tmpPoints.push(new Jt(t[n],t[n+1]))}}async draw(t){const{attrs:r,tasks:n,isDot:s,layer:c}=t,{duration:l}=this.workOptions;for(const f of n){const h=new gn,{pos:v,points:u}=f;let y;s?y=yn(u,!0):y=yn(u,!1),h.attr({...r,pos:v,d:y}),c.appendChild(h),h.transition(l).attr({scale:s?[.1,.1]:[1,1],lineWidth:s?0:1}).then(()=>{h.remove()})}}getTaskPoints(t){var h;const r=[];if(t.length===0)return[];let n=0,s=t[0].x,c=t[0].y,l=[s,c],f=[];for(;n<t.length;){const v=t[n],u=v.x-s,y=v.y-c;if(f.push(new Jt(u,y)),n>0&&n<t.length-1){const T=t[n].getAngleByPoints(t[n-1],t[n+1]);if(T<60||T>300){const w=(h=f.pop())==null?void 0:h.clone();w&&r.push({pos:l,points:[...f,w]}),s=t[n].x,c=t[n].y,l=[s,c];const I=v.x-s,S=v.y-c;f=[new Jt(I,S)]}}n++}return r.push({pos:l,points:f}),r}removeLocal(){}removeService(t){let r;const n=[];return this.fullLayer.getElementsByName(t).forEach(s=>{if(s.name===t){const c=s.getBoundingClientRect();r=Zt(r,{x:c.x,y:c.y,w:c.width,h:c.height}),n.push(s)}}),n.length&&n.forEach(s=>s.remove()),r}}var nP=ds;ds.polyline=ds,ds.polygon=iP;function ds(i,e,t){var r=i.length,n=ei(i[0],e),s=[],c,l,f,h,v;for(t||(t=[]),c=1;c<r;c++){for(l=i[c-1],f=i[c],h=v=ei(f,e);;)if(n|h){if(n&h)break;n?(l=Ko(l,f,n,e),n=ei(l,e)):(f=Ko(l,f,h,e),h=ei(f,e))}else{s.push(l),h!==v?(s.push(f),c<r-1&&(t.push(s),s=[])):c===r-1&&s.push(f);break}n=v}return s.length&&t.push(s),t}function iP(i,e){var t,r,n,s,c,l,f;for(r=1;r<=8;r*=2){for(t=[],n=i[i.length-1],s=!(ei(n,e)&r),c=0;c<i.length;c++)l=i[c],f=!(ei(l,e)&r),f!==s&&t.push(Ko(n,l,r,e)),f&&t.push(l),n=l,s=f;if(i=t,!i.length)break}return t}function Ko(i,e,t,r){return t&8?[i[0]+(e[0]-i[0])*(r[3]-i[1])/(e[1]-i[1]),r[3]]:t&4?[i[0]+(e[0]-i[0])*(r[1]-i[1])/(e[1]-i[1]),r[1]]:t&2?[r[2],i[1]+(e[1]-i[1])*(r[2]-i[0])/(e[0]-i[0])]:t&1?[r[0],i[1]+(e[1]-i[1])*(r[0]-i[0])/(e[0]-i[0])]:null}function ei(i,e){var t=0;return i[0]<e[0]?t|=1:i[0]>e[2]&&(t|=2),i[1]<e[1]?t|=4:i[1]>e[3]&&(t|=8),t}var Zo=mn(nP);const si=class si extends Yt{constructor(t,r){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.none);dt(this,"toolsType",xt.Eraser);dt(this,"serviceWork");dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"worldPosition");dt(this,"worldScaling");dt(this,"eraserRect");dt(this,"eraserPolyline");this.serviceWork=r,this.workOptions=t.toolsOpt,this.worldPosition=this.fullLayer.worldPosition,this.worldScaling=this.fullLayer.worldScaling}combineConsume(){}consumeService(){}setWorkOptions(t){super.setWorkOptions(t)}createEraserRect(t){const r=t[0]*this.worldScaling[0]+this.worldPosition[0],n=t[1]*this.worldScaling[1]+this.worldPosition[1],{width:s,height:c}=si.eraserSizes[this.workOptions.thickness];this.eraserRect={x:r-s*.5,y:n-c*.5,w:s,h:c},this.eraserPolyline=[this.eraserRect.x,this.eraserRect.y,this.eraserRect.x+this.eraserRect.w,this.eraserRect.y+this.eraserRect.h]}computRectCenterPoints(){const t=this.tmpPoints.slice(-2);if(this.tmpPoints.length===4){const r=new pt(this.tmpPoints[0],this.tmpPoints[1]),n=new pt(this.tmpPoints[2],this.tmpPoints[3]),s=pt.Sub(n,r).uni(),c=pt.Dist(r,n),{width:l,height:f}=si.eraserSizes[this.workOptions.thickness],h=Math.min(l,f),v=Math.round(c/h);if(v>1){const u=[];for(let y=0;y<v;y++){const T=pt.Mul(s,y*h);u.push(this.tmpPoints[0]+T.x,this.tmpPoints[1]+T.y)}return u.concat(t)}}return t}isNear(t,r){const n=new pt(t[0],t[1]),s=new pt(r[0],r[1]),{width:c,height:l}=si.eraserSizes[this.workOptions.thickness];return pt.Dist(n,s)<Math.hypot(c,l)*.5}remove(t){const{curNodeMap:r,removeIds:n}=t;let s;for(const c of r.values())if(c.rect&&this.eraserRect&&this.eraserPolyline&&ia(this.eraserRect,c.rect)){const{op:l}=c,f=[],h=[];for(let u=0;u<l.length;u+=3){const y=new pt(l[u]*this.worldScaling[0]+this.worldPosition[0],l[u+1]*this.worldScaling[1]+this.worldPosition[1],l[u+2]);h.push(y),f.push(new Jt(y.x,y.y))}const v=f.length&&Re(f)||c.rect;ia(v,this.eraserRect)&&(h.length>1?Zo.polyline(h.map(y=>y.XY),this.eraserPolyline).length&&n.add(c.name):n.add(c.name),s=Zt(s,c.rect||v))}return n.forEach(c=>{var f;const l=this.fullLayer.getElementsByName(c);l[0]&&(l[0].remove(),dr(l[0],this.fullLayer.parent),(f=this.vNodes)==null||f.delete(c))}),s&&(s.x-=Yt.SafeBorderPadding,s.y-=Yt.SafeBorderPadding,s.w+=Yt.SafeBorderPadding*2,s.h+=Yt.SafeBorderPadding*2),s}consume(t){const{op:r,disableEraseImage:n,disableEraseText:s}=t.data;if(!r||r.length===0)return{type:vt.None,...this.baseConsumeResult};const c=this.tmpPoints.length;if(c>1&&this.isNear([r[0],r[1]],[this.tmpPoints[c-2],this.tmpPoints[c-1]]))return{type:vt.None,...this.baseConsumeResult};c<3?this.tmpPoints.push(r[0],r[1]):this.tmpPoints.splice(2,2,r[0],r[1]);const l=this.computRectCenterPoints();let f;const h=new Set;if(!this.vNodes)return{type:vt.None,...this.baseConsumeResult};const v=this.getCanEraserNodeMap(this.vNodes.getCanEraserNodes(this.vNodes.curNodeMap,{disableEraseImage:n,disableEraseText:s}));for(let u=0;u<l.length-1;u+=2){this.createEraserRect(l.slice(u,u+2));const y=this.remove({curNodeMap:v,removeIds:h});f=Zt(f,y)}return f&&h.size?{type:vt.RemoveNode,rect:f,removeIds:[...h]}:{type:vt.None,...this.baseConsumeResult}}consumeAll(t){return this.consume(t)}clearTmpPoints(){this.tmpPoints.length=0}getCanEraserNodeMap(t){var r;if(this.serviceWork){const n=new Map(t),s=this.serviceWork.selectorWorkShapes,c=this.serviceWork.workShapes;for(const l of s.values())if((r=l.selectIds)!=null&&r.length)for(const f of l.selectIds)n.delete(f);for(const l of c.keys())n.delete(l);return n}return t}};dt(si,"eraserSizes",Ho);let ps=si;var sP="__lodash_hash_undefined__";function oP(i){return this.__data__.set(i,sP),this}var aP=oP;function lP(i){return this.__data__.has(i)}var fP=lP,cP=Jl,uP=aP,hP=fP;function vs(i){var e=-1,t=i==null?0:i.length;for(this.__data__=new cP;++e<t;)this.add(i[e])}vs.prototype.add=vs.prototype.push=uP,vs.prototype.has=hP;var Jo=vs;function dP(i,e){for(var t=-1,r=i==null?0:i.length;++t<r;)if(e(i[t],t,i))return!0;return!1}var pP=dP;function vP(i,e){return i.has(e)}var Qo=vP,gP=Jo,mP=pP,yP=Qo,SP=1,PP=2;function xP(i,e,t,r,n,s){var c=t&SP,l=i.length,f=e.length;if(l!=f&&!(c&&f>l))return!1;var h=s.get(i),v=s.get(e);if(h&&v)return h==e&&v==i;var u=-1,y=!0,T=t&PP?new gP:void 0;for(s.set(i,e),s.set(e,i);++u<l;){var w=i[u],I=e[u];if(r)var S=c?r(I,w,u,e,i,s):r(w,I,u,i,e,s);if(S!==void 0){if(S)continue;y=!1;break}if(T){if(!mP(e,function(O,d){if(!yP(T,d)&&(w===O||n(w,O,t,r,s)))return T.push(d)})){y=!1;break}}else if(!(w===I||n(w,I,t,r,s))){y=!1;break}}return s.delete(i),s.delete(e),y}var Vf=xP;function TP(i){var e=-1,t=Array(i.size);return i.forEach(function(r,n){t[++e]=[n,r]}),t}var CP=TP;function IP(i){var e=-1,t=Array(i.size);return i.forEach(function(r){t[++e]=r}),t}var qo=IP,Kf=Ai,Zf=wf,OP=Mo,wP=Vf,AP=CP,EP=qo,MP=1,LP=2,RP="[object Boolean]",bP="[object Date]",DP="[object Error]",NP="[object Map]",BP="[object Number]",WP="[object RegExp]",FP="[object Set]",UP="[object String]",YP="[object Symbol]",XP="[object ArrayBuffer]",zP="[object DataView]",Jf=Kf?Kf.prototype:void 0,_o=Jf?Jf.valueOf:void 0;function $P(i,e,t,r,n,s,c){switch(t){case zP:if(i.byteLength!=e.byteLength||i.byteOffset!=e.byteOffset)return!1;i=i.buffer,e=e.buffer;case XP:return!(i.byteLength!=e.byteLength||!s(new Zf(i),new Zf(e)));case RP:case bP:case BP:return OP(+i,+e);case DP:return i.name==e.name&&i.message==e.message;case WP:case UP:return i==e+"";case NP:var l=AP;case FP:var f=r&MP;if(l||(l=EP),i.size!=e.size&&!f)return!1;var h=c.get(i);if(h)return h==e;r|=LP,c.set(i,e);var v=wP(l(i),l(e),r,n,s,c);return c.delete(i),v;case YP:if(_o)return _o.call(i)==_o.call(e)}return!1}var jP=$P,Qf=yf,GP=1,kP=Object.prototype,HP=kP.hasOwnProperty;function VP(i,e,t,r,n,s){var c=t&GP,l=Qf(i),f=l.length,h=Qf(e),v=h.length;if(f!=v&&!c)return!1;for(var u=f;u--;){var y=l[u];if(!(c?y in e:HP.call(e,y)))return!1}var T=s.get(i),w=s.get(e);if(T&&w)return T==e&&w==i;var I=!0;s.set(i,e),s.set(e,i);for(var S=c;++u<f;){y=l[u];var O=i[y],d=e[y];if(r)var g=c?r(d,O,y,e,i,s):r(O,d,y,i,e,s);if(!(g===void 0?O===d||n(O,d,t,r,s):g)){I=!1;break}S||(S=y=="constructor")}if(I&&!S){var p=i.constructor,x=e.constructor;p!=x&&"constructor"in i&&"constructor"in e&&!(typeof p=="function"&&p instanceof p&&typeof x=="function"&&x instanceof x)&&(I=!1)}return s.delete(i),s.delete(e),I}var KP=VP,ta=Ql,ZP=Vf,JP=jP,QP=KP,qf=us,_f=Li,tc=bo,qP=ff,_P=1,ec="[object Arguments]",rc="[object Array]",gs="[object Object]",tx=Object.prototype,nc=tx.hasOwnProperty;function ex(i,e,t,r,n,s){var c=_f(i),l=_f(e),f=c?rc:qf(i),h=l?rc:qf(e);f=f==ec?gs:f,h=h==ec?gs:h;var v=f==gs,u=h==gs,y=f==h;if(y&&tc(i)){if(!tc(e))return!1;c=!0,v=!1}if(y&&!v)return s||(s=new ta),c||qP(i)?ZP(i,e,t,r,n,s):JP(i,e,f,t,r,n,s);if(!(t&_P)){var T=v&&nc.call(i,"__wrapped__"),w=u&&nc.call(e,"__wrapped__");if(T||w){var I=T?i.value():i,S=w?e.value():e;return s||(s=new ta),n(I,S,t,r,s)}}return y?(s||(s=new ta),QP(i,e,t,r,n,s)):!1}var rx=ex,nx=rx,ic=nn;function sc(i,e,t,r,n){return i===e?!0:i==null||e==null||!ic(i)&&!ic(e)?i!==i&&e!==e:nx(i,e,t,r,sc,n)}var ix=sc,sx=ix;function ox(i,e){return sx(i,e)}var ax=ox,Zr=mn(ax);function oc(i,e,t,r=1){return`rgba(${i},${e},${t},${r})`}function lx(i){const e=i.split(","),t=parseInt(e[0].split("(")[1]),r=parseInt(e[1]),n=parseInt(e[2]),s=Number(e[3].split(")")[0]);return[t,r,n,s]}const Rs=class Rs extends Yt{constructor(t){super(t);dt(this,"toolsType",xt.Selector);dt(this,"tmpPoints",[]);dt(this,"subTmpPoints",[]);dt(this,"workOptions");dt(this,"vNodes");dt(this,"selectIds");dt(this,"selectorColor");dt(this,"strokeColor");dt(this,"fillColor");dt(this,"oldSelectRect");dt(this,"oldSubSelectRect");dt(this,"canRotate",!1);dt(this,"canTextEdit",!1);dt(this,"canLock",!1);dt(this,"scaleType",Te.all);dt(this,"toolsTypes");dt(this,"shapeOpt");dt(this,"textOpt");dt(this,"isLocked");dt(this,"thickness");dt(this,"strokeType");dt(this,"useStroke");this.workOptions=t.toolsOpt,this.vNodes=t.vNodes}computSelector(t=!0){const r=Re(this.tmpPoints);if(r.w===0||r.h===0)return{selectIds:[],intersectRect:void 0,subNodeMap:new Map};const{rectRange:n,nodeRange:s}=this.vNodes.getRectIntersectRange(r,t);return{selectIds:[...s.keys()],intersectRect:n,subNodeMap:s}}updateTempPoints(t){const r=this.tmpPoints.length,n=t.length;if(n>1){const s=new Jt(t[n-2]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],t[n-1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]);r===2?this.tmpPoints.splice(1,1,s):this.tmpPoints.push(s)}}drawSelector(t){const{drawRect:r,subNodeMap:n,selectorId:s,layer:c,isService:l}=t,f=new Je({pos:[r.x,r.y],anchor:[0,0],size:[r.w,r.h],id:s,name:s,zIndex:9999}),h=[];if(l){const v=new Eo({normalize:!0,pos:[r.w/2,r.h/2],lineWidth:1,strokeColor:this.selectorColor||this.workOptions.strokeColor,width:r.w,height:r.h,name:Rs.selectorBorderId});h.push(v)}n.forEach((v,u)=>{const y=[v.rect.x+v.rect.w/2-r.x,v.rect.y+v.rect.h/2-r.y],T=new Eo({normalize:!0,pos:y,lineWidth:1,strokeColor:n.size>1?this.selectorColor||this.workOptions.strokeColor:void 0,width:v.rect.w,height:v.rect.h,id:`selector-${u}`,name:`selector-${u}`});h.push(T)}),h&&f.append(...h),(c==null?void 0:c.parent).appendChild(f)}draw(t,r,n,s=!1){var f,h;const{intersectRect:c,subNodeMap:l}=n;(h=(f=r.parent)==null?void 0:f.getElementById(t))==null||h.remove(),c&&this.drawSelector({drawRect:c,subNodeMap:l,selectorId:t,layer:r,isService:s})}getSelecteorInfo(t){this.scaleType=Te.all,this.canRotate=!1,this.textOpt=void 0,this.strokeColor=void 0,this.fillColor=void 0,this.canTextEdit=!1,this.canLock=!1,this.isLocked=!1,this.toolsTypes=void 0,this.shapeOpt=void 0,this.thickness=void 0,this.strokeType=void 0,this.useStroke=!1;const r=new Set;let n,s=!0;for(const c of t.values()){const{opt:l,canRotate:f,scaleType:h,toolsType:v}=c;this.selectorColor=this.workOptions.strokeColor,l.strokeColor&&(this.strokeColor=l.strokeColor),l.fillColor&&(this.fillColor=l.fillColor),l.textOpt&&(this.textOpt=l.textOpt),l.thickness&&(this.thickness=l.thickness),v!==xt.Pencil&&(s=!1),l.strokeType&&(this.strokeType=l.strokeType),v===xt.SpeechBalloon&&(r.add(v),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.placement=l.placement),v===xt.Polygon&&(r.add(v),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=l.vertices),v===xt.Star&&(r.add(v),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=l.vertices,this.shapeOpt.innerRatio=l.innerRatio,this.shapeOpt.innerVerticeStep=l.innerVerticeStep),v===xt.Text&&(this.textOpt=l),t.size===1&&(this.textOpt&&(this.canTextEdit=!0),this.canRotate=f,this.scaleType=h),(v===xt.Image||v===xt.BackgroundSVG)&&(n=c),(h===Te.proportional&&this.scaleType!==Te.none||h===Te.none)&&(this.scaleType=h)}s&&(this.useStroke=!0),r.size&&(this.toolsTypes=[...r]),n&&(t.size===1?(this.canLock=!0,n.opt.locked&&(this.isLocked=!0,this.scaleType=Te.none,this.canRotate=!1,this.textOpt=void 0,this.fillColor=void 0,this.selectorColor="rgb(177,177,177)",this.strokeColor=void 0,this.canTextEdit=!1,this.thickness=void 0,this.strokeType=void 0,this.useStroke=void 0)):t.size>1&&!n.opt.locked&&(this.canLock=!1,this.canRotate=!1))}getChildrenPoints(){var t,r;if(this.scaleType===Te.both&&((t=this.selectIds)==null?void 0:t.length)===1){const n=this.selectIds[0],s=(r=this.vNodes.get(n))==null?void 0:r.op;if(s){const c=[];for(let l=0;l<s.length;l+=3)c.push([s[l],s[l+1]]);return c}}}consume(t){if(t.isSubWorker)return this.subWorkerConsume(t);let r={type:vt.Select,dataType:Kt.Local,...this.baseConsumeResult};if(t.isSimpleWorker){const v=this.subWorkerConsume(t);r.subRect=v.rect}const{op:n,workState:s}=t.data;let c=this.oldSelectRect;if(s===te.Start&&(c=this.unSelectedAllIds()),!(n!=null&&n.length)||!this.vNodes.curNodeMap.size)return t.isSimpleWorker?r:{type:vt.None};this.updateTempPoints(n);const l=this.computSelector();if(this.selectIds&&Zr(this.selectIds,l.selectIds))return t.isSimpleWorker?r:{type:vt.None};this.selectIds=l.selectIds;const f=l.intersectRect;this.getSelecteorInfo(l.subNodeMap),this.draw(Me,this.fullLayer,l),this.oldSelectRect=f;const h=this.getChildrenPoints();return r={...r,rect:Zt(f,c),selectIds:l.selectIds,selectRect:f,selectorColor:this.selectorColor,strokeColor:this.strokeColor,fillColor:this.fillColor,textOpt:this.textOpt,canTextEdit:this.canTextEdit,canRotate:this.canRotate,canLock:this.canLock,scaleType:this.scaleType,willSyncService:!0,points:h,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType},r}consumeAll(){var r,n;let t=this.oldSelectRect;if(!((r=this.selectIds)!=null&&r.length)&&this.tmpPoints[0]&&this.selectSingleTool(this.tmpPoints[0].XY,Me,!1),(n=this.selectIds)!=null&&n.length&&(t=this.selectedByIds(this.selectIds)),t){const s=this.getChildrenPoints();return{type:vt.Select,dataType:Kt.Local,rect:this.oldSelectRect,selectIds:this.selectIds,selectorColor:this.selectorColor,selectRect:this.oldSelectRect,strokeColor:this.strokeColor,fillColor:this.fillColor,textOpt:this.textOpt,canTextEdit:this.canTextEdit,canRotate:this.canRotate,canLock:this.canLock,scaleType:this.scaleType,willSyncService:!0,points:s,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType,...this.baseConsumeResult}}return{type:vt.None}}consumeService(){}updateTempPointsForSubWorker(t){const r=t.slice(-2),n=new Jt(r[0],r[1]);if(this.subTmpPoints[0].isNear(n,1))return!1;if(this.subTmpPoints.length===2){if(n.isNear(this.subTmpPoints[1],1))return!1;this.subTmpPoints[1]=n}else this.subTmpPoints.push(n);return!0}computDrawPoints(t){const{thickness:r}=this.workOptions,n=[];for(const l of t)n.push(new pt(...l));const s=Re(n,r),c=[s.x+s.w/2,s.y+s.h/2];return{rect:s,pos:c,points:n.map(l=>l.XY).flat(1)}}drawForSubWorker(t){const{workId:r,layer:n,ps:s}=t,{strokeColor:c,scale:l,rotate:f,translate:h}=this.workOptions,v=n.worldPosition,u=n.worldScaling,{points:y,rect:T,pos:w}=this.computDrawPoints(s),I=1/n.worldScaling[0],S=c&&lx(c)||[0,0,0,0],O={close:!0,normalize:!0,points:y,lineWidth:I,fillColor:oc(S[0],S[1],S[2],.1),strokeColor:oc(S[0],S[1],S[2],1),lineJoin:"round",lineCap:"round"};let d={x:Math.floor(T.x*u[0]+v[0]-Yt.SafeBorderPadding),y:Math.floor(T.y*u[1]+v[1]-Yt.SafeBorderPadding),w:Math.floor(T.w*u[0]+2*Yt.SafeBorderPadding),h:Math.floor(T.h*u[0]+2*Yt.SafeBorderPadding)};const g=new Je({name:r,id:r,pos:w,anchor:[.5,.5],size:[T.w,T.h],scale:l,rotate:f,translate:h}),p=new en({...O,pos:[0,0]});if(g.appendChild(p),this.replace(n,r,g),l||f||h){const x=g.getBoundingClientRect();d={x:Math.floor(x.x-Yt.SafeBorderPadding),y:Math.floor(x.y-Yt.SafeBorderPadding),w:Math.floor(x.width+2*Yt.SafeBorderPadding),h:Math.floor(x.height+2*Yt.SafeBorderPadding)}}return d}transformData(t){const r=Re(t);return[[r.x,r.y,0],[r.x+r.w,r.y,0],[r.x+r.w,r.y+r.h,0],[r.x,r.y+r.h,0]]}subWorkerConsume(t){const{data:r,isFullWork:n}=t,{op:s,syncUnitTime:c}=r;c&&(this.syncUnitTime=c);const l=s==null?void 0:s.length;if(!l||l<2)return{type:vt.None,rect:void 0};let f;if(this.subTmpPoints.length===0?(this.subTmpPoints=[new Jt(s[0],s[1])],f=!1):f=this.updateTempPointsForSubWorker(s),!f)return{type:vt.None,rect:void 0};const h=this.transformData(this.subTmpPoints),v=n?this.fullLayer:this.drawLayer||this.fullLayer,u=this.drawForSubWorker({ps:h,workId:this.workId,layer:v}),y=Zt(u,this.oldSubSelectRect);return this.oldSubSelectRect=u,{rect:y,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult}}subWorkerConsumeAll(t){const{isFullWork:r}=t,n=r?this.fullLayer:this.drawLayer||this.fullLayer;return this.replace(n,this.workId),{rect:this.oldSelectRect,type:vt.FullWork,dataType:Kt.Local,...this.baseConsumeResult}}clearSubTmpPoints(){this.subTmpPoints.length=0}clearTmpPoints(){this.tmpPoints.length=0,this.clearSubTmpPoints()}clearSubSelectData(){this.oldSubSelectRect=void 0}clearSelectData(){this.selectIds=void 0,this.oldSelectRect=void 0,this.clearSubSelectData()}selectSingleTool(t,r=Me,n=!1){if(t.length===2){const s=t[0],c=t[1];let l;const{nodeRange:f}=this.vNodes.getRectIntersectRange({x:s,y:c,w:0,h:0},!1),h=[...f.values()].sort((v,u)=>(u.opt.zIndex||0)-(v.opt.zIndex||0));for(const v of h){const u=this.fullLayer.getElementsByName(v.name);if(Bc(u).find(T=>T.isPointCollision(s,c))){l=v;break}}if(l){const v=l.name;if(!Zr(this.oldSelectRect,l.rect)){const u=new Map([[v,l]]);this.getSelecteorInfo(u),this.draw(r,this.fullLayer,{intersectRect:l.rect,subNodeMap:u,selectIds:this.selectIds||[]},n)}this.selectIds=[v],this.oldSelectRect=l.rect}}}unSelectedAllIds(){let t;for(const[r,n]of this.vNodes.curNodeMap.entries())n.isSelected&&(t=Zt(t,n.rect),this.vNodes.unSelected(r));return t}unSelectedByIds(t){let r;for(const n of t){const s=this.vNodes.get(n);s&&s.isSelected&&(r=Zt(r,s.rect),this.vNodes.unSelected(n))}return r}selectedByIds(t){let r;for(const n of t){const s=this.vNodes.get(n);s&&(r=Zt(r,s.rect),this.vNodes.selected(n))}return r}getSelectorRect(t,r){var l;let n;const s=(l=t.parent)==null?void 0:l.getElementById(r),c=s==null?void 0:s.getBoundingClientRect();return c&&(n=Zt(n,{x:Math.floor(c.x),y:Math.floor(c.y),w:Math.floor(c.width+1),h:Math.floor(c.height+1)})),n}isCanFillColor(t){return t===xt.Ellipse||t===xt.Triangle||t===xt.Rectangle||t===xt.Polygon||t===xt.Star||t===xt.SpeechBalloon}async updateSelector(t){const{updateSelectorOpt:r,selectIds:n,vNodes:s,willSerializeData:c,worker:l,offset:f}=t,h=this.fullLayer;if(!h)return;let v;const u=new Map,{originPoint:y,workState:T,angle:w,translate:I,dir:S,scale:O}=r;f&&(I?r.translate=[I[0]+f[0],I[1]+f[1]]:r.translate=f);let d;if(y||I||Qe(w)){if(T===te.Start&&n)return s.setTargetAssignKeys(n),{type:vt.Select,dataType:Kt.Local,selectRect:this.oldSelectRect,rect:this.oldSelectRect};if(d=s.getLastTarget(),!d)return}if(n)for(const x of n){const E=s.get(x);if(E){const{toolsType:R,opt:D}=E,U=(h==null?void 0:h.getElementsByName(x))[0];if(U){const M={...r};let W;const X=Yt.isWillRefresh({toolsType:R,opt:D,updateOpt:M,vNodes:s,node:U,willSerializeData:c});if(R){W=d==null?void 0:d.get(x);const B=Nc(R);if(B==null||B.updateNodeOpt({node:U,opt:M,vNodes:s,willSerializeData:c,targetNode:W}),E&&l&&X){const N=l.createWorkShapeNode({workId:x,toolsType:R,toolsOpt:E.opt});N==null||N.setWorkId(x);let $;if(R===xt.BackgroundSVG)$=N.consumeService({isFullWork:!0,replaceId:x});else if(R===xt.Image)$=await N.consumeServiceAsync({isFullWork:!0,replaceId:x,worker:l});else if(R===xt.Text)$=await N.consumeServiceAsync({isFullWork:!0,replaceId:x,isDrawLabel:!0});else try{$=N==null?void 0:N.consumeService({op:E.op,isFullWork:!0,replaceId:x,workState:T})}catch(J){console.error("consumeService error",J);continue}$&&(E.rect=$)}E&&(u.set(x,E),v=Zt(v,E.rect))}}}}d&&T===te.Done&&(s.deleteLastTarget(),d=void 0);const g=v;if(y&&I&&O&&S&&g&&!f){const x=[[g.x,g.y],[g.x+g.w,g.y],[g.x+g.w,g.y+g.h],[g.x,g.y+g.h]];let E;switch(S){case"top":case"topLeft":case"left":I[0]>0&&I[1]>0?E=x[0]:I[0]>0?E=x[3]:I[1]>0?E=x[1]:E=x[2];break;case"topRight":I[0]<0&&I[1]>0?E=x[1]:I[0]<0?E=x[2]:I[1]>0?E=x[0]:E=x[3];break;case"right":case"bottomRight":case"bottom":I[0]<0&&I[1]<0?E=x[2]:I[0]<0?E=x[1]:I[1]<0?E=x[3]:E=x[0];break;case"bottomLeft":I[0]>0&&I[1]<0?E=x[3]:I[0]>0?E=x[0]:I[1]<0?E=x[2]:E=x[1];break}const R=E&&[y[0]-E[0],y[1]-E[1]]||[0,0];if(!Zr(R,[0,0]))return await this.updateSelector({...t,updateSelectorOpt:{workState:T},offset:R})}this.getSelecteorInfo(u),this.draw(Me,h,{selectIds:n||[],subNodeMap:u,intersectRect:g});const p=Zt(this.oldSelectRect,g);return this.oldSelectRect=g,{type:vt.Select,dataType:Kt.Local,selectRect:g,renderRect:v,rect:Zt(p,g),selectIds:n}}blurSelector(){const t=this.unSelectedAllIds();return{type:vt.Select,dataType:Kt.Local,rect:t,selectIds:[],willSyncService:!0}}getRightServiceId(t){return t.replace(Vn,"-")}selectServiceNode(t,r,n){const{selectIds:s}=r,c=this.getRightServiceId(t),l=this.getSelectorRect(this.fullLayer,c);let f;const h=new Map;return s==null||s.forEach(v=>{const u=this.vNodes.get(v);u&&(f=Zt(f,u.rect),h.set(v,u))}),this.getSelecteorInfo(h),this.draw(c,this.fullLayer,{intersectRect:f,selectIds:s||[],subNodeMap:h},n),Zt(f,l)}reRenderSelector(){var n;let t;const r=new Map;return(n=this.selectIds)==null||n.forEach(s=>{const c=this.vNodes.get(s);c&&(t=Zt(t,c.rect),r.set(s,c))},this),this.getSelecteorInfo(r),this.draw(Me,this.fullLayer,{intersectRect:t,subNodeMap:r,selectIds:this.selectIds||[]}),this.oldSelectRect=t,t}updateSelectIds(t){var c;let r;const n=(c=this.selectIds)==null?void 0:c.filter(l=>!t.includes(l));if(n!=null&&n.length&&(r=this.unSelectedByIds(n)),t.length){const l=this.selectedByIds(t);r=Zt(r,l)}this.selectIds=t;const s=this.reRenderSelector();return{bgRect:r,selectRect:s}}cursorHover(t){var c,l;const r=this.oldSelectRect;this.selectIds=[];const n=(c=this.workId)==null?void 0:c.toString(),s=[t[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],t[1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]];if(this.selectSingleTool(s,n,!0),this.oldSelectRect&&!Zr(r,this.oldSelectRect))return{type:vt.CursorHover,dataType:Kt.Local,rect:Zt(r,this.oldSelectRect),selectorColor:this.selectorColor,willSyncService:!1};if((l=this.selectIds)!=null&&l.length||(this.oldSelectRect=void 0),r&&!this.oldSelectRect)return this.cursorBlur(),{type:vt.CursorHover,dataType:Kt.Local,rect:r,selectorColor:this.selectorColor,willSyncService:!1}}cursorBlur(){var r,n;this.selectIds=[];const t=(r=this.workId)==null?void 0:r.toString();((n=this.fullLayer)==null?void 0:n.parent).children.forEach(s=>{s.name===t&&s.remove()})}};dt(Rs,"selectorBorderId","selector-border");let Ri=Rs;class ac extends Yt{constructor(t){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.both);dt(this,"toolsType",xt.Arrow);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"arrowTipWidth");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.arrowTipWidth=this.workOptions.thickness*4,this.syncTimestamp=0,this.syncUnitTime=50}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,h=this.workId,{op:v,syncUnitTime:u}=r;u&&(this.syncUnitTime=u);const y=v==null?void 0:v.length;if(!y||y<2)return{type:vt.None};let T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(v[0],v[1])],T=!1):T=this.updateTempPoints(v),!T)return{type:vt.None};let w;if(s||c||f){const S=n?this.fullLayer:this.drawLayer||this.fullLayer;w=this.draw({workId:h,layer:S})}if(f){const S=Zt(w,this.oldRect);this.oldRect=w;const O={rect:S,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult};if(l){const d=Date.now();d-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=d,O.op=this.tmpPoints.map(g=>[...g.XY,0]).flat(1),O.index=0,O.isSync=!0)}return O}if(!s&&l){const S=Date.now();return S-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=S,{...this.baseConsumeResult,type:vt.DrawWork,dataType:Kt.Local,op:this.tmpPoints.map(O=>[...O.XY,0]).flat(1),isSync:!0,index:0}):{type:vt.None}}const I=Zt(w,this.oldRect);return this.oldRect=w,{rect:I,...this.baseConsumeResult,type:vt.DrawWork,dataType:Kt.Local}}consumeAll(){var l;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.fullLayer,n=this.draw({workId:t,layer:r});this.oldRect=n;const s=this.tmpPoints.map(f=>[...f.XY,0]).flat(1),c=hr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:Yt.getCenterPos(n,r)}),{rect:n,...this.baseConsumeResult,type:vt.FullWork,dataType:Kt.Local,ops:c,isSync:!0,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawEraserlines:s}=t,{strokeColor:c,thickness:l,zIndex:f,scale:h,rotate:v,translate:u,strokeType:y,eraserlines:T,lineDash:w,lineCap:I}=this.workOptions,S=n.worldPosition,O=n.worldScaling,{points:d,pos:g,rect:p,isTriangle:x,trianglePoints:E,trianglePos:R}=this.computDrawPoints(l),D=[p.x+p.w/2,p.y+p.h/2],U={pos:D,name:r,id:r,zIndex:f,anchor:[.5,.5],size:[p.w,p.h]};h&&(U.scale=h),v&&(U.rotate=v),u&&(U.translate=u);const M=new Je(U),W={points:E,pos:[R[0]-D[0],R[1]-D[1]],fillColor:c,strokeColor:c,lineWidth:0,normalize:!1},X=new en(W);if(M.append(X),!x&&d&&g){const N={points:d,pos:[g[0]-D[0],g[1]-D[1]],fillColor:c,strokeColor:c,lineDash:y===Ee.Dotted?[w&&w[0]||1,(w&&w[1]||2)*l]:y===Ee.LongDotted?[(w&&w[0]||1)*l,(w&&w[1]||2)*l]:void 0,lineCap:y===Ee.Normal?void 0:I,lineWidth:l,normalize:!1},$=new en(N);M.append($)}T&&(this.scaleType=Te.proportional,this.drawEraserlines({group:M,eraserlines:T,pos:D,layer:n},s)),this.replace(n,r,M);let B={x:Math.floor(p.x*O[0]+S[0]-Yt.SafeBorderPadding),y:Math.floor(p.y*O[1]+S[1]-Yt.SafeBorderPadding),w:Math.floor(p.w*O[0]+2*Yt.SafeBorderPadding),h:Math.floor(p.h*O[1]+2*Yt.SafeBorderPadding)};if(h||v||u){const N=M.getBoundingClientRect();B={x:Math.floor(N.x-Yt.SafeBorderPadding),y:Math.floor(N.y-Yt.SafeBorderPadding),w:Math.floor(N.width+Yt.SafeBorderPadding*2),h:Math.floor(N.height+Yt.SafeBorderPadding*2)}}return this.isDelete&&M.setAttribute("opacity",0),B}computDrawPoints(t){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.arrowTipWidth?this.computFullArrowPoints(t):this.computTrianglePoints()}computFullArrowPoints(t){const r=pt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),n=pt.Per(r).mul(t/2),s=Jt.Sub(this.tmpPoints[0],n),c=Jt.Add(this.tmpPoints[0],n),l=pt.Mul(r,this.arrowTipWidth),f=pt.Sub(this.tmpPoints[1],l),h=Jt.Sub(f,n),v=Jt.Add(f,n),u=pt.Per(r).mul(t*1.5),y=Jt.Sub(f,u),T=Jt.Add(f,u),w=[this.tmpPoints[0],f],I=[y,this.tmpPoints[1],T],S=[s,c,...I,h,v];return{trianglePoints:I.map(O=>Jt.Sub(O,this.tmpPoints[1]).XY).flat(1),trianglePos:this.tmpPoints[1].XY,points:w.map(O=>Jt.Sub(O,this.tmpPoints[0]).XY).flat(1),rect:Re(S),isTriangle:!1,pos:this.tmpPoints[0].XY}}computTrianglePoints(){const t=pt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),r=this.tmpPoints[1].distance(this.tmpPoints[0]),n=pt.Per(t).mul(Math.floor(r*3/8)),s=Jt.Sub(this.tmpPoints[0],n),c=Jt.Add(this.tmpPoints[0],n),l=[s,this.tmpPoints[1],c];return{trianglePoints:l.map(f=>Jt.Sub(f,this.tmpPoints[1]).XY).flat(1),trianglePos:this.tmpPoints[1].XY,rect:Re(l),isTriangle:!0}}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var h,v;const{op:r,isFullWork:n,workState:s=te.Done}=t,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(let u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));const l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawEraserlines:s===te.Done});return this.oldRect=f,(v=this.vNodes)==null||v.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:Yt.getCenterPos(f,l)}),f}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var h,v;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,strokeType:l}=n,f=s.get(r.name);return c&&(r.tagName==="GROUP"?r.children.forEach(u=>{u.setAttribute("strokeColor",c),u.getAttribute("fillColor")&&u.setAttribute("fillColor",c)}):(r.setAttribute("strokeColor",c),r.setAttribute("fillColor",c)),(h=f==null?void 0:f.opt)!=null&&h.strokeColor&&(f.opt.strokeColor=c)),l&&(f!=null&&f.opt)&&((v=f.opt)!=null&&v.strokeType)&&(f.opt.strokeType=l),f&&s.setInfo(r.name,f),Yt.updateNodeOpt(t)}}class lc extends Yt{constructor(t){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.Ellipse);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.syncTimestamp=0,this.syncUnitTime=50}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,h=this.workId,{op:v,syncUnitTime:u}=r;u&&(this.syncUnitTime=u);const y=v==null?void 0:v.length;if(!y||y<2)return{type:vt.None};let T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(v[0],v[1])],T=!1):T=this.updateTempPoints(v),!T)return{type:vt.None};let w;if(s||c||f){const I=n?this.fullLayer:this.drawLayer||this.fullLayer;w=this.draw({workId:h,layer:I,isDrawing:!0});const S=I.parent.parent,O={x:0,y:0,w:Math.floor(S.width),h:Math.floor(S.height)},d={type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult};if(Fi(w,O)!==yr.outside){const p=Zt(w,this.oldRect);if(this.oldRect=w,d.rect=p,!f)return d}if(f){const p=Date.now();return p-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=p,d.op=this.tmpPoints.map(x=>[...x.XY,0]).flat(1),d.index=0,d.isSync=!0),d}return{type:vt.None}}if(!s&&!c&&!f&&l){const I=Date.now();return I-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=I,{type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult,op:this.tmpPoints.map(S=>[...S.XY,0]).flat(1),isSync:!0,index:0}):{type:vt.None}}return{type:vt.None}}consumeAll(){var l;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;const s=this.tmpPoints.map(f=>[...f.XY,0]).flat(1),c=hr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:n&&Yt.getCenterPos(n,r)}),{rect:n,type:vt.FullWork,dataType:Kt.Local,...this.baseConsumeResult,ops:c,isSync:!0,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawing:s,isDrawEraserlines:c}=t,{strokeColor:l,fillColor:f,thickness:h,zIndex:v,scale:u,rotate:y,translate:T,strokeType:w,eraserlines:I,lineDash:S,lineCap:O}=this.workOptions,d=n.worldScaling,{radius:g,rect:p,pos:x}=this.computDrawPoints(h),E={closeType:"normal",radius:g,lineWidth:h,fillColor:f!=="transparent"&&f||void 0,strokeColor:l,normalize:!0,lineCap:O,lineDash:w===Ee.Dotted?[S&&S[0]||1,(S&&S[1]||2)*h]:w===Ee.LongDotted?[(S&&S[0]||1)*h,(S&&S[1]||2)*h]:void 0},R={name:r,id:r,zIndex:v,pos:x,anchor:[.5,.5],size:[p.w,p.h]};u&&(R.scale=u),y&&(R.rotate=y),T&&(R.translate=T);const D=new Je(R);if(s){const W=new gn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:l,lineWidth:1,scale:[1/d[0],1/d[1]]});D.append(W)}const U=new tn({...E,pos:[0,0]});D.append(U),I&&(this.scaleType=Te.proportional,this.drawEraserlines({group:D,eraserlines:I,pos:x,layer:n},c)),this.replace(n,r,D);const M=D.getBoundingClientRect();return this.isDelete&&D.setAttribute("opacity",0),{x:Math.floor(M.x-Yt.SafeBorderPadding),y:Math.floor(M.y-Yt.SafeBorderPadding),w:Math.floor(M.width+Yt.SafeBorderPadding*2),h:Math.floor(M.height+Yt.SafeBorderPadding*2)}}computDrawPoints(t){const r=Re(this.tmpPoints),n=Re(this.tmpPoints,t),s=[Math.floor(r.x+r.w/2),Math.floor(r.y+r.h/2)];return{rect:n,pos:s,radius:[Math.floor(r.w/2),Math.floor(r.h/2)]}}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var h,v;const{op:r,isFullWork:n,workState:s=te.Done}=t,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(let u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));const l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(v=this.vNodes)==null||v.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:Yt.getCenterPos(f,l)}),f}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var u,y,T;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,fillColor:l,strokeType:f}=n,h=s.get(r.name);let v=r;return r.tagName==="GROUP"&&(v=r.children[0]),c&&(v.setAttribute("strokeColor",c),(u=h==null?void 0:h.opt)!=null&&u.strokeColor&&(h.opt.strokeColor=c)),l&&(l==="transparent"?v.setAttribute("fillColor","rgba(0,0,0,0)"):v.setAttribute("fillColor",l),(y=h==null?void 0:h.opt)!=null&&y.fillColor&&(h.opt.fillColor=l)),f&&(h!=null&&h.opt)&&((T=h.opt)!=null&&T.strokeType)&&(h.opt.strokeType=f),h&&s.setInfo(r.name,h),Yt.updateNodeOpt(t)}}class fc extends Yt{constructor(t){super(t);dt(this,"canRotate",!0);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.Rectangle);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.syncTimestamp=0,this.syncUnitTime=50}transformData(){const t=Re(this.tmpPoints);return[[t.x,t.y,0],[t.x+t.w,t.y,0],[t.x+t.w,t.y+t.h,0],[t.x,t.y+t.h,0]]}computDrawPoints(t){const{thickness:r}=this.workOptions,n=[];for(const l of t)n.push(new pt(...l));const s=Re(n,r),c=[s.x+s.w/2,s.y+s.h/2];return{rect:s,pos:c,points:n.map(l=>l.XY).flat(1)}}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,h=this.workId,{op:v}=r,u=v==null?void 0:v.length;if(!u||u<2)return{type:vt.None};let y;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(v[0],v[1])],y=!1):y=this.updateTempPoints(v),!y)return{type:vt.None};const T=this.transformData();let w;if(s||c||f){const S=n?this.fullLayer:this.drawLayer||this.fullLayer;w=this.draw({ps:T,workId:h,layer:S,isDrawing:!0})}if(f){const S=Zt(w,this.oldRect);this.oldRect=w;const O={rect:S,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult};if(l){const d=Date.now();d-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=d,O.op=T.flat(1),O.index=0,O.isSync=!0)}return O}if(!s&&l){const S=Date.now();return S-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=S,{type:vt.DrawWork,dataType:Kt.Local,op:T.flat(1),isSync:!0,index:0,...this.baseConsumeResult}):{type:vt.None}}const I=Zt(w,this.oldRect);return this.oldRect=w,{rect:I,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult}}consumeAll(){var f;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.transformData(),n=this.fullLayer,s=this.draw({ps:r,workId:t,layer:n,isDrawing:!1});this.oldRect=s;const c=r.flat(1),l=hr(c);return(f=this.vNodes)==null||f.setInfo(t,{rect:s,op:c,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:s&&Yt.getCenterPos(s,n)}),{rect:s,type:vt.FullWork,dataType:Kt.Local,ops:l,isSync:!0,...this.baseConsumeResult,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawing:s,ps:c,replaceId:l,isDrawEraserlines:f=!0}=t,{strokeColor:h,fillColor:v,thickness:u,zIndex:y,scale:T,rotate:w,translate:I,strokeType:S,eraserlines:O,lineCap:d,lineDash:g}=this.workOptions,p=n.worldPosition,x=n.worldScaling,{points:E,rect:R,pos:D}=this.computDrawPoints(c),U={close:!0,normalize:!0,points:E,lineWidth:u,fillColor:v!=="transparent"&&v||void 0,strokeColor:h,lineCap:d,lineDash:S===Ee.Dotted?[g&&g[0]||1,(g&&g[1]||2)*u]:S===Ee.LongDotted?[(g&&g[0]||1)*u,(g&&g[1]||2)*u]:void 0};let M={x:Math.floor(R.x*x[0]+p[0]-Yt.SafeBorderPadding),y:Math.floor(R.y*x[1]+p[1]-Yt.SafeBorderPadding),w:Math.floor(R.w*x[0]+2*Yt.SafeBorderPadding),h:Math.floor(R.h*x[0]+2*Yt.SafeBorderPadding)};const W=new Je({name:r,id:r,zIndex:y,pos:D,anchor:[.5,.5],size:[R.w,R.h],scale:T,rotate:w,translate:I}),X=new en({...U,pos:[0,0]});if(W.appendChild(X),s){const B=new gn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:h,lineWidth:1,scale:[1/x[0],1/x[1]]});W.appendChild(B)}if(O&&(this.scaleType=Te.proportional,this.drawEraserlines({group:W,eraserlines:O,pos:D,layer:n},f)),this.replace(n,l||r,W),T||w||I){const B=W.getBoundingClientRect();M={x:Math.floor(B.x-Yt.SafeBorderPadding),y:Math.floor(B.y-Yt.SafeBorderPadding),w:Math.floor(B.width+2*Yt.SafeBorderPadding),h:Math.floor(B.height+2*Yt.SafeBorderPadding)}}return this.isDelete&&W.setAttribute("opacity",0),M}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var u,y;const{op:r,isFullWork:n,replaceId:s,workState:c=te.Done}=t,l=(u=this.workId)==null?void 0:u.toString();if(!l)return;const f=[];for(let T=0;T<r.length;T+=3)f.push([r[T],r[T+1],r[T+2]]);const h=n?this.fullLayer:this.drawLayer||this.fullLayer,v=this.draw({ps:f,workId:l,layer:h,isDrawing:!1,replaceId:s,isDrawEraserlines:c===te.Done});return this.oldRect=v,(y=this.vNodes)==null||y.setInfo(l,{rect:v,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:v&&Yt.getCenterPos(v,h)}),v}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var u,y,T;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,fillColor:l,strokeType:f}=n,h=s.get(r.name);let v=r;return r.tagName==="GROUP"&&(v=r.children[0]),c&&(v.setAttribute("strokeColor",c),(u=h==null?void 0:h.opt)!=null&&u.strokeColor&&(h.opt.strokeColor=c)),l&&(l==="transparent"?v.setAttribute("fillColor","rgba(0,0,0,0)"):v.setAttribute("fillColor",l),(y=h==null?void 0:h.opt)!=null&&y.fillColor&&(h.opt.fillColor=l)),f&&(h!=null&&h.opt)&&((T=h.opt)!=null&&T.strokeType)&&(h.opt.strokeType=f),h&&s.setInfo(r.name,h),Yt.updateNodeOpt(t)}}class cc extends Yt{constructor(t){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.Star);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.syncTimestamp=0,this.syncUnitTime=50}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,h=this.workId,{op:v,syncUnitTime:u}=r,y=v==null?void 0:v.length;if(!y||y<2)return{type:vt.None};u&&(this.syncUnitTime=u);let T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(v[0],v[1])],T=!1):T=this.updateTempPoints(v),!T)return{type:vt.None};let w;if(s||c||f){const S=n?this.fullLayer:this.drawLayer||this.fullLayer;w=this.draw({workId:h,layer:S,isDrawing:!0})}if(f){const S=Zt(w,this.oldRect);this.oldRect=w;const O={rect:S,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult};if(l){const d=Date.now();d-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=d,O.op=this.tmpPoints.map(g=>[...g.XY,0]).flat(1),O.index=0,O.isSync=!0)}return O}if(!s&&l){const S=Date.now();return S-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=S,{type:vt.DrawWork,dataType:Kt.Local,op:this.tmpPoints.map(O=>[...O.XY,0]).flat(1),isSync:!0,index:0,...this.baseConsumeResult}):{type:vt.None}}const I=Zt(w,this.oldRect);return this.oldRect=w,{rect:I,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult}}consumeAll(){var l;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;const s=this.tmpPoints.map(f=>[...f.XY,0]).flat(1),c=hr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&Yt.getCenterPos(n,r)}),{rect:n,type:vt.FullWork,dataType:Kt.Local,ops:c,isSync:!0,...this.baseConsumeResult,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawing:s,isDrawEraserlines:c=!0}=t,{strokeColor:l,fillColor:f,thickness:h,zIndex:v,vertices:u,innerVerticeStep:y,innerRatio:T,scale:w,rotate:I,translate:S,strokeType:O,eraserlines:d,lineDash:g,lineCap:p}=this.workOptions,x=n.worldScaling,{rect:E,pos:R,points:D}=this.computDrawPoints(h,u,y,T),U={close:!0,points:D,lineWidth:h,fillColor:f!=="transparent"&&f||void 0,strokeColor:l,normalize:!0,lineCap:p,lineDash:O===Ee.Dotted?[g&&g[0]||1,(g&&g[1]||2)*h]:O===Ee.LongDotted?[(g&&g[0]||1)*h,(g&&g[1]||2)*h]:void 0},M={name:r,id:r,zIndex:v,pos:R,anchor:[.5,.5],size:[E.w,E.h]};w&&(M.scale=w),I&&(M.rotate=I),S&&(M.translate=S);const W=new Je(M);if(s){const N=new gn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:l,lineWidth:1,scale:[1/x[0],1/x[1]]});W.append(N)}const X=new en({...U,pos:[0,0]});W.append(X),d&&(this.scaleType=Te.proportional,this.drawEraserlines({group:W,eraserlines:d,pos:R,layer:n},c)),this.replace(n,r,W);const B=W.getBoundingClientRect();return this.isDelete&&W.setAttribute("opacity",0),{x:Math.floor(B.x-Yt.SafeBorderPadding),y:Math.floor(B.y-Yt.SafeBorderPadding),w:Math.floor(B.width+Yt.SafeBorderPadding*2),h:Math.floor(B.height+Yt.SafeBorderPadding*2)}}computDrawPoints(t,r,n,s){const c=Re(this.tmpPoints),l=[Math.floor(c.x+c.w/2),Math.floor(c.y+c.h/2)],f=Fc(c.w,c.h),h=Math.floor(Math.min(c.w,c.h)/2),v=s*h,u=[],y=2*Math.PI/r;for(let w=0;w<r;w++){const I=w*y-.5*Math.PI;let S,O;w%n===1?(S=v*f[0]*Math.cos(I),O=v*f[1]*Math.sin(I)):(S=h*f[0]*Math.cos(I),O=h*f[1]*Math.sin(I),u.push(S,O)),u.push(S,O)}return{rect:Re(this.tmpPoints,t),pos:l,points:u}}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c)||Jt.Sub(s,n).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var h,v;const{op:r,isFullWork:n,workState:s=te.Done}=t,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(let u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));const l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(v=this.vNodes)==null||v.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&Yt.getCenterPos(f,l)}),f}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var S;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,fillColor:l,toolsType:f,vertices:h,innerVerticeStep:v,innerRatio:u,strokeType:y}=n,T=s.get(r.name),w=T==null?void 0:T.opt;let I=r;return r.tagName==="GROUP"&&(I=r.children[0]),c&&(I.setAttribute("strokeColor",c),w!=null&&w.strokeColor&&(w.strokeColor=c)),l&&(l==="transparent"?I.setAttribute("fillColor","rgba(0,0,0,0)"):I.setAttribute("fillColor",l),w!=null&&w.fillColor&&(w.fillColor=l)),f===xt.Star&&(h&&(w.vertices=h),v&&(w.innerVerticeStep=v),u&&(w.innerRatio=u)),y&&(T!=null&&T.opt)&&((S=T.opt)!=null&&S.strokeType)&&(T.opt.strokeType=y),T&&s.setInfo(r.name,{...T,opt:w}),Yt.updateNodeOpt(t)}}class uc extends Yt{constructor(t){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.Polygon);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.syncTimestamp=0,this.syncUnitTime=50}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,{op:h,syncUnitTime:v}=r;v&&(this.syncUnitTime=v);const u=this.workId,y=h==null?void 0:h.length;if(!y||y<2)return{type:vt.None};let T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(h[0],h[1])],T=!1):T=this.updateTempPoints(h),!T)return{type:vt.None};let w;if(s||c||f){const S=n?this.fullLayer:this.drawLayer||this.fullLayer;w=this.draw({workId:u,layer:S,isDrawing:!0})}if(f){const S=Zt(w,this.oldRect);this.oldRect=w;const O={type:vt.DrawWork,rect:S,dataType:Kt.Local,...this.baseConsumeResult};if(l){const d=Date.now();d-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=d,O.op=this.tmpPoints.map(g=>[...g.XY,0]).flat(1),O.index=0,O.isSync=!0)}return O}if(!s&&l){const S=Date.now();return S-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=S,{type:vt.DrawWork,dataType:Kt.Local,op:this.tmpPoints.map(O=>[...O.XY,0]).flat(1),isSync:!0,index:0,...this.baseConsumeResult}):{type:vt.None}}const I=Zt(w,this.oldRect);return this.oldRect=w,{rect:I,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult}}consumeAll(){var l;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;const s=this.tmpPoints.map(f=>[...f.XY,0]).flat(1),c=hr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&Yt.getCenterPos(n,r)}),{rect:n,type:vt.FullWork,dataType:Kt.Local,ops:c,isSync:!0,...this.baseConsumeResult,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawing:s,isDrawEraserlines:c=!0}=t,{strokeColor:l,fillColor:f,thickness:h,zIndex:v,vertices:u,scale:y,rotate:T,translate:w,strokeType:I,eraserlines:S,lineCap:O,lineDash:d}=this.workOptions,g=n.worldScaling,{rect:p,pos:x,points:E}=this.computDrawPoints(h,u),R={close:!0,points:E,lineWidth:h,fillColor:f!=="transparent"&&f||void 0,strokeColor:l,normalize:!0,lineCap:O,lineDash:I===Ee.Dotted?[d&&d[0]||1,(d&&d[1]||2)*h]:I===Ee.LongDotted?[(d&&d[0]||1)*h,(d&&d[1]||2)*h]:void 0},D={name:r,id:r,zIndex:v,pos:x,anchor:[.5,.5],size:[p.w,p.h]};y&&(D.scale=y),T&&(D.rotate=T),w&&(D.translate=w);const U=new Je(D);if(s){const X=new gn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:l,lineWidth:1,scale:[1/g[0],1/g[1]]});U.append(X)}const M=new en({...R,pos:[0,0]});U.append(M),S&&(this.scaleType=Te.proportional,this.drawEraserlines({group:U,eraserlines:S,pos:x,layer:n},c)),this.replace(n,r,U);const W=U.getBoundingClientRect();return this.isDelete&&U.setAttribute("opacity",0),{x:Math.floor(W.x-Yt.SafeBorderPadding),y:Math.floor(W.y-Yt.SafeBorderPadding),w:Math.floor(W.width+Yt.SafeBorderPadding*2),h:Math.floor(W.height+Yt.SafeBorderPadding*2)}}computDrawPoints(t,r){const n=Re(this.tmpPoints),s=[Math.floor(n.x+n.w/2),Math.floor(n.y+n.h/2)],c=Fc(n.w,n.h),l=Math.floor(Math.min(n.w,n.h)/2),f=[],h=2*Math.PI/r;for(let u=0;u<r;u++){const y=u*h-.5*Math.PI,T=l*c[0]*Math.cos(y),w=l*c[1]*Math.sin(y);f.push(T,w)}return{rect:Re(this.tmpPoints,t),pos:s,points:f}}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c)||Jt.Sub(s,n).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var h,v;const{op:r,isFullWork:n,workState:s=te.Done}=t,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(let u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));const l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(v=this.vNodes)==null||v.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&Yt.getCenterPos(f,l)}),f}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var w;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,fillColor:l,toolsType:f,vertices:h,strokeType:v}=n,u=s.get(r.name),y=u==null?void 0:u.opt;let T=r;return r.tagName==="GROUP"&&(T=r.children[0]),c&&(T.setAttribute("strokeColor",c),y!=null&&y.strokeColor&&(y.strokeColor=c)),l&&(l==="transparent"?T.setAttribute("fillColor","rgba(0,0,0,0)"):T.setAttribute("fillColor",l),y!=null&&y.fillColor&&(y.fillColor=l)),f===xt.Polygon&&h&&(y.vertices=h),v&&(u!=null&&u.opt)&&((w=u.opt)!=null&&w.strokeType)&&(u.opt.strokeType=v),u&&s.setInfo(r.name,{...u,opt:y}),Yt.updateNodeOpt(t)}}class zr{static bezier(e,t){const r=[];for(let n=0;n<t.length;n+=4){const s=t[n],c=t[n+1],l=t[n+2],f=t[n+3];s&&c&&l&&f?r.push(...zr.getBezierPoints(e,s,c,l,f)):s&&c&&l?r.push(...zr.getBezierPoints(e,s,c,l)):s&&c?r.push(...zr.getBezierPoints(e,s,c)):s&&r.push(s)}return r}static getBezierPoints(e=10,t,r,n,s){let c=null;const l=[];!n&&!s?c=zr.oneBezier:n&&!s?c=zr.twoBezier:n&&s&&(c=zr.threeBezier);for(let f=0;f<e;f++)c&&l.push(c(f/e,t,r,n,s));return s?l.push(s):n&&l.push(n),l}static oneBezier(e,t,r){const n=t.x+(r.x-t.x)*e,s=t.y+(r.y-t.y)*e;return new pt(n,s)}static twoBezier(e,t,r,n){const s=(1-e)*(1-e)*t.x+2*e*(1-e)*r.x+e*e*n.x,c=(1-e)*(1-e)*t.y+2*e*(1-e)*r.y+e*e*n.y;return new pt(s,c)}static threeBezier(e,t,r,n,s){const c=t.x*(1-e)*(1-e)*(1-e)+3*r.x*e*(1-e)*(1-e)+3*n.x*e*e*(1-e)+s.x*e*e*e,l=t.y*(1-e)*(1-e)*(1-e)+3*r.y*e*(1-e)*(1-e)+3*n.y*e*e*(1-e)+s.y*e*e*e;return new pt(c,l)}}class hc extends Yt{constructor(t){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.SpeechBalloon);dt(this,"ratio",.8);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.syncTimestamp=0,this.syncUnitTime=50}consume(t){var I;const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,h=(I=r==null?void 0:r.workId)==null?void 0:I.toString();if(!h)return{type:vt.None};const{op:v}=r,u=v==null?void 0:v.length;if(!u||u<2)return{type:vt.None};let y;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(v[0],v[1])],y=!1):y=this.updateTempPoints(v),!y)return{type:vt.None};let T;if(s||c||f){const S=n?this.fullLayer:this.drawLayer||this.fullLayer;T=this.draw({workId:h,layer:S,isDrawing:!0})}if(f){const S=Zt(T,this.oldRect);this.oldRect=T;const O={rect:S,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult};if(l){const d=Date.now();d-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=d,O.op=this.tmpPoints.map(g=>[...g.XY,0]).flat(1),O.index=0,O.isSync=!0)}return O}if(!s&&l){const S=Date.now();return S-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=S,{type:vt.DrawWork,dataType:Kt.Local,op:this.tmpPoints.map(O=>[...O.XY,0]).flat(1),isSync:!0,index:0,...this.baseConsumeResult}):{type:vt.None}}const w=Zt(T,this.oldRect);return this.oldRect=T,{rect:w,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult}}consumeAll(){var l;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;const s=this.tmpPoints.map(f=>[...f.XY,0]).flat(1),c=hr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&Yt.getCenterPos(n,r)}),{rect:n,type:vt.FullWork,dataType:Kt.Local,ops:c,isSync:!0,...this.baseConsumeResult,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawEraserlines:s=!0}=t,{strokeColor:c,fillColor:l,thickness:f,zIndex:h,placement:v,scale:u,rotate:y,translate:T,strokeType:w,eraserlines:I,lineDash:S,lineCap:O}=this.workOptions,{rect:d,pos:g,points:p}=this.computDrawPoints(f,v),x={points:p.map(M=>M.XY),lineWidth:f,fillColor:l!=="transparent"&&l||void 0,strokeColor:c,normalize:!0,className:`${g[0]},${g[1]}`,close:!0,lineCap:O,lineDash:w===Ee.Dotted?[S&&S[0]||1,(S&&S[1]||2)*f]:w===Ee.LongDotted?[(S&&S[0]||1)*f,(S&&S[1]||2)*f]:void 0},E={name:r,id:r,zIndex:h,pos:g,anchor:[.5,.5],size:[d.w,d.h]};u&&(E.scale=u),y&&(E.rotate=y),T&&(E.translate=T);const R=new Je(E),D=new en({...x,pos:[0,0]});R.append(D),I&&(this.scaleType=Te.proportional,this.drawEraserlines({group:R,eraserlines:I,pos:g,layer:n},s)),this.replace(n,r,R);const U=R.getBoundingClientRect();return this.isDelete&&R.setAttribute("opacity",0),{x:Math.floor(U.x-Yt.SafeBorderPadding),y:Math.floor(U.y-Yt.SafeBorderPadding),w:Math.floor(U.width+Yt.SafeBorderPadding*2),h:Math.floor(U.height+Yt.SafeBorderPadding*2)}}transformControlPoints(t){const r=Re(this.tmpPoints);switch(t){case"bottom":case"bottomLeft":case"bottomRight":{const n=r.y+r.h*this.ratio;return[new pt(r.x,r.y,0),new pt(r.x+r.w,r.y,0),new pt(r.x+r.w,n,0),new pt(r.x,n,0)]}case"top":case"topLeft":case"topRight":{const n=r.y+r.h*(1-this.ratio);return[new pt(r.x,n,0),new pt(r.x+r.w,n,0),new pt(r.x+r.w,r.y+r.h,0),new pt(r.x,r.y+r.h,0)]}case"left":case"leftBottom":case"leftTop":{const n=r.x+r.w*(1-this.ratio);return[new pt(n,r.y,0),new pt(r.x+r.w,r.y,0),new pt(r.x+r.w,r.y+r.h,0),new pt(n,r.y+r.h,0)]}case"right":case"rightBottom":case"rightTop":{const n=r.x+r.w*this.ratio;return[new pt(r.x,r.y,0),new pt(n,r.y,0),new pt(n,r.y+r.h,0),new pt(r.x,r.y+r.h,0)]}}}computDrawPoints(t,r){const n=Re(this.tmpPoints),s=this.transformControlPoints(r),c=Math.floor(n.w*.1),l=Math.floor(n.h*.1),f=[],h=pt.Add(s[0],new pt(0,l,0)),v=pt.Add(s[0],new pt(c,0,0)),u=zr.getBezierPoints(10,h,s[0],v),y=pt.Sub(s[1],new pt(c,0,0)),T=pt.Add(s[1],new pt(0,l,0)),w=zr.getBezierPoints(10,y,s[1],T),I=pt.Sub(s[2],new pt(0,l,0)),S=pt.Sub(s[2],new pt(c,0,0)),O=zr.getBezierPoints(10,I,s[2],S),d=pt.Add(s[3],new pt(c,0,0)),g=pt.Sub(s[3],new pt(0,l,0)),p=zr.getBezierPoints(10,d,s[3],g),x=c*(1-this.ratio)*10,E=l*(1-this.ratio)*10;switch(r){case"bottom":{const U=pt.Sub(s[2],new pt(c*5-x/2,0,0)),M=pt.Sub(s[2],new pt(c*5,-E,0)),W=pt.Sub(s[2],new pt(c*5+x/2,0,0));f.push(M,W,...p,...u,...w,...O,U);break}case"bottomRight":{const U=pt.Sub(s[2],new pt(c*1.1,0,0)),M=pt.Sub(s[2],new pt(c*1.1+x/2,-E,0)),W=pt.Sub(s[2],new pt(c*1.1+x,0,0));f.push(M,W,...p,...u,...w,...O,U);break}case"bottomLeft":{const U=pt.Add(s[3],new pt(c*1.1+x,0,0)),M=pt.Add(s[3],new pt(c*1.1+x/2,E,0)),W=pt.Add(s[3],new pt(c*1.1,0,0));f.push(M,W,...p,...u,...w,...O,U);break}case"top":{const U=pt.Sub(s[1],new pt(c*5-x/2,0,0)),M=pt.Sub(s[1],new pt(c*5,E,0)),W=pt.Sub(s[1],new pt(c*5+x/2,0,0));f.push(M,U,...w,...O,...p,...u,W);break}case"topRight":{const U=pt.Sub(s[1],new pt(c*1.1,0,0)),M=pt.Sub(s[1],new pt(c*1.1+x/2,E,0)),W=pt.Sub(s[1],new pt(c*1.1+x,0,0));f.push(M,U,...w,...O,...p,...u,W);break}case"topLeft":{const U=pt.Add(s[0],new pt(c*1.1+x,0,0)),M=pt.Add(s[0],new pt(c*1.1+x/2,-E,0)),W=pt.Add(s[0],new pt(c*1.1,0,0));f.push(M,U,...w,...O,...p,...u,W);break}case"left":{const U=pt.Add(s[0],new pt(0,l*5-E/2,0)),M=pt.Add(s[0],new pt(-x,l*5,0)),W=pt.Add(s[0],new pt(0,l*5+E/2,0));f.push(M,U,...u,...w,...O,...p,W);break}case"leftTop":{const U=pt.Add(s[0],new pt(0,l*1.1,0)),M=pt.Add(s[0],new pt(-x,l*1.1+E/2,0)),W=pt.Add(s[0],new pt(0,l*1.1+E,0));f.push(M,U,...u,...w,...O,...p,W);break}case"leftBottom":{const U=pt.Sub(s[3],new pt(0,l*1.1+E,0)),M=pt.Sub(s[3],new pt(x,l*1.1+E/2,0)),W=pt.Sub(s[3],new pt(0,l*1.1,0));f.push(M,U,...u,...w,...O,...p,W);break}case"right":{const U=pt.Add(s[1],new pt(0,l*5-E/2,0)),M=pt.Add(s[1],new pt(x,l*5,0)),W=pt.Add(s[1],new pt(0,l*5+E/2,0));f.push(M,W,...O,...p,...u,...w,U);break}case"rightTop":{const U=pt.Add(s[1],new pt(0,l*1.1,0)),M=pt.Add(s[1],new pt(x,l*1.1+E/2,0)),W=pt.Add(s[1],new pt(0,l*1.1+E,0));f.push(M,W,...O,...p,...u,...w,U);break}case"rightBottom":{const U=pt.Sub(s[2],new pt(0,l*1.1+E,0)),M=pt.Sub(s[2],new pt(-x,l*1.1+E/2,0)),W=pt.Sub(s[2],new pt(0,l*1.1,0));f.push(M,W,...O,...p,...u,...w,U);break}}const R=Re(this.tmpPoints,t),D=[Math.floor(R.x+R.w/2),Math.floor(R.y+R.h/2)];return{rect:R,pos:D,points:f}}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c)||Jt.Sub(s,n).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var h,v;const{op:r,isFullWork:n,workState:s=te.Done}=t,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(let u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));const l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(v=this.vNodes)==null||v.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&Yt.getCenterPos(f,l)}),f}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var w;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,fillColor:l,toolsType:f,placement:h,strokeType:v}=n,u=s.get(r.name),y=u==null?void 0:u.opt;let T=r;return r.tagName==="GROUP"&&(T=r.children[0]),c&&(T.setAttribute("strokeColor",c),y!=null&&y.strokeColor&&(y.strokeColor=c)),l&&(l==="transparent"?T.setAttribute("fillColor","rgba(0,0,0,0)"):T.setAttribute("fillColor",l),y!=null&&y.fillColor&&(y.fillColor=l)),f===xt.SpeechBalloon&&h&&(y.placement=h),v&&(u!=null&&u.opt)&&((w=u.opt)!=null&&w.strokeType)&&(u.opt.strokeType=v),u&&s.setInfo(r.name,{...u,opt:y}),Yt.updateNodeOpt(t)}}var fx=Kn,cx=nn,ux="[object Boolean]";function hx(i){return i===!0||i===!1||cx(i)&&fx(i)==ux}var dx=hx,Nn=mn(dx);class bi extends Yt{constructor(t){super(t);dt(this,"canRotate",!0);dt(this,"scaleType",Te.all);dt(this,"toolsType",xt.Image);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");this.workOptions=t.toolsOpt,this.scaleType=bi.getScaleType(this.workOptions)}consume(){return{type:vt.None}}consumeAll(){return{type:vt.None}}draw(t){const{layer:r,workId:n,replaceId:s,imageBitmap:c}=t,{centerX:l,centerY:f,width:h,height:v,rotate:u,zIndex:y,eraserlines:T}=this.workOptions,w=new Je({anchor:[.5,.5],pos:[l,f],name:n,size:[h,v],zIndex:y,rotate:u}),I={anchor:[.5,.5],pos:[0,0],size:[h,v],texture:c};c||(I.bgcolor="rgba(0,0,0,0.3)");const S=new Ul(I);w.append(S),T&&this.drawEraserlines({group:w,eraserlines:T,pos:[l,f],layer:r}),this.replace(r,s||n,w);const O=w.getBoundingClientRect();if(O)return{x:Math.floor(O.x-Yt.SafeBorderPadding),y:Math.floor(O.y-Yt.SafeBorderPadding),w:Math.floor(O.width+Yt.SafeBorderPadding*2),h:Math.floor(O.height+Yt.SafeBorderPadding*2)}}consumeService(){}async consumeServiceAsync(t){var v,u,y,T;const{isFullWork:r,replaceId:n,worker:s}=t,{src:c,uuid:l}=this.workOptions,f=((v=this.workId)==null?void 0:v.toString())||l,h=r?this.fullLayer:this.drawLayer||this.fullLayer;if(c){const w=await s.loadImageBitMap({toolsType:this.toolsType,opt:this.workOptions,workId:f,isSubWorker:s instanceof _c});if(w){const I=this.draw({workId:f,layer:h,replaceId:n,imageBitmap:w});return this.oldRect=f&&((y=(u=this.vNodes)==null?void 0:u.get(f))==null?void 0:y.rect)||void 0,(T=this.vNodes)==null||T.setInfo(f,{rect:I,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:I&&Yt.getCenterPos(I,h)}),I}}}clearTmpPoints(){this.tmpPoints.length=0}static getScaleType(t){const{uniformScale:r,rotate:n}=t;return r!==!1||n&&Math.abs(n)%90>0?Te.proportional:Te.all}static updateNodeOpt(t){const{node:r,opt:n,vNodes:s,targetNode:c}=t,{translate:l,originPoint:f,scenePoint:h,scale:v,angle:u,isLocked:y,zIndex:T,strokeColor:w}=n,I=c&&ar(c)||s.get(r.name);if(!I)return;const S=r.parent;if(S){if(w&&(I.opt.strokeColor=w),Qe(T)&&(r.setAttribute("zIndex",T),I.opt.zIndex=T),Nn(y)&&(I.opt.locked=y),f&&h&&v&&l){const{centerX:O,centerY:d,width:g,height:p,uniformScale:x}=I.opt,E=x!==!1?[v[0],v[0]]:v,R=[O,d],D=[O,d];Es(D,h,E,l);const U=[D[0]-R[0],D[1]-R[1]];if(I.centerPos=[I.centerPos[0]+U[0],I.centerPos[1]+U[1]],I.opt.width=Math.round(g*E[0]),I.opt.height=Math.round(p*E[1]),I.opt.centerX=D[0],I.opt.centerY=D[1],I.opt.eraserlines)for(const M of I.opt.eraserlines){const{op:W,thickness:X}=M;M.thickness=Math.round(X*Math.max(v[0],v[1]));for(let B=0;B<W.length;B++)oa(W[B],h,v,l)}}else if(l){if(I.opt.centerX=I.opt.centerX+l[0],I.opt.centerY=I.opt.centerY+l[1],I.centerPos=[I.centerPos[0]+l[0],I.centerPos[1]+l[1]],I.opt.eraserlines)for(const O of I.opt.eraserlines){const{op:d}=O;for(let g=0;g<d.length;g++){const p=d[g].map((x,E)=>E%2?x+l[1]:x+l[0]);O.op[g]=p}}}else if(Qe(u))if(I.opt.rotate=u,I.scaleType=bi.getScaleType(I.opt),c){const O=sa(I.rect,u);I.rect=O}else{const O=Yt.getRectFromLayer(S,r.name);I.rect=O||I.rect}return I&&s.setInfo(r.name,I),I==null?void 0:I.rect}}}class dc extends Yt{constructor(t){super(t);dt(this,"canRotate",!1);dt(this,"scaleType",Te.both);dt(this,"toolsType",xt.Straight);dt(this,"tmpPoints",[]);dt(this,"workOptions");dt(this,"oldRect");dt(this,"straightTipWidth");dt(this,"syncTimestamp");this.workOptions=t.toolsOpt,this.straightTipWidth=this.workOptions.thickness/2,this.syncTimestamp=0,this.syncUnitTime=50}consume(t){const{data:r,isFullWork:n,isSubWorker:s,isMainThread:c,smoothSync:l,isSimpleWorker:f}=t,h=this.workId,{op:v,syncUnitTime:u}=r,y=v==null?void 0:v.length;if(!y||y<2)return{type:vt.None};u&&(this.syncUnitTime=u);let T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(v[0],v[1])],T=!1):T=this.updateTempPoints(v),!T)return{type:vt.None};let w;if(s||c||f){const S=n?this.fullLayer:this.drawLayer||this.fullLayer;w=this.draw({workId:h,layer:S})}if(f){const S=Zt(w,this.oldRect);this.oldRect=w;const O={rect:S,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult};if(l){const d=Date.now();d-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=d,O.op=this.tmpPoints.map(g=>[...g.XY,0]).flat(1),O.index=0,O.isSync=!0)}return O}if(!s&&l){const S=Date.now();return S-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=S,{type:vt.DrawWork,dataType:Kt.Local,op:this.tmpPoints.map(O=>[...O.XY,0]).flat(1),isSync:!0,index:0,...this.baseConsumeResult}):{type:vt.None}}const I=Zt(w,this.oldRect);return this.oldRect=w,{rect:I,type:vt.DrawWork,dataType:Kt.Local,...this.baseConsumeResult}}consumeAll(){var l;const t=this.workId;if(this.tmpPoints.length<2)return{type:vt.RemoveNode,removeIds:[t]};const r=this.fullLayer,n=this.draw({workId:t,layer:r});this.oldRect=n;const s=this.tmpPoints.map(f=>[...f.XY,0]).flat(1),c=hr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&Yt.getCenterPos(n,r)}),{rect:n,type:vt.FullWork,dataType:Kt.Local,ops:c,isSync:!0,...this.baseConsumeResult,updateNodeOpt:{useAnimation:!0}}}draw(t){const{workId:r,layer:n,isDrawEraserlines:s=!0}=t,{strokeColor:c,thickness:l,zIndex:f,scale:h,rotate:v,translate:u,strokeType:y,eraserlines:T,lineCap:w,lineDash:I}=this.workOptions,S=n.worldPosition,O=n.worldScaling,{d,rect:g,isDot:p}=this.computDrawPoints(l,y),x=[g.x+g.w/2,g.y+g.h/2],E=new Je({pos:x,anchor:[.5,.5],size:[g.w,g.h],name:r,id:r,normalize:!0,zIndex:f}),R={pos:[0,0],normalize:!0,d,fillColor:c,strokeColor:c,lineDash:p?void 0:y===Ee.Dotted?[I&&I[0]||1,(I&&I[1]||2)*l]:y===Ee.LongDotted?[(I&&I[0]||1)*l,(I&&I[1]||2)*l]:void 0,lineCap:p?void 0:w,lineWidth:y===Ee.Normal||p?0:l};h&&(R.scale=h),v&&(R.rotate=v),u&&(R.translate=u);const D=new gn(R);E.append(D),T&&(this.scaleType=Te.proportional,this.drawEraserlines({group:E,eraserlines:T,pos:x,layer:n},s)),this.replace(n,r,E);let U={x:Math.floor(g.x*O[0]+S[0]-Yt.SafeBorderPadding),y:Math.floor(g.y*O[1]+S[1]-Yt.SafeBorderPadding),w:Math.floor(g.w*O[0]+2*Yt.SafeBorderPadding),h:Math.floor(g.h*O[1]+2*Yt.SafeBorderPadding)};if(v||h||u){const M=D.getBoundingClientRect();U={x:Math.floor(M.x-Yt.SafeBorderPadding),y:Math.floor(M.y-Yt.SafeBorderPadding),w:Math.floor(M.width+Yt.SafeBorderPadding*2),h:Math.floor(M.height+Yt.SafeBorderPadding*2)}}return this.isDelete&&E.setAttribute("opacity",0),U}computDrawPoints(t,r){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.straightTipWidth?this.computFullPoints(t,r):this.computDotPoints(t)}computFullPoints(t,r){const n=pt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),s=pt.Per(n).mul(t/2),c=Jt.Sub(this.tmpPoints[0],s),l=Jt.Add(this.tmpPoints[0],s),f=Jt.Sub(this.tmpPoints[1],s),h=Jt.Add(this.tmpPoints[1],s),v=Jt.GetSemicircleStroke(this.tmpPoints[1],f,-1,8),u=Jt.GetSemicircleStroke(this.tmpPoints[0],l,-1,8),y=[c,f,...v,h,l,...u];let T;return r!==Ee.Normal?T=yn(this.tmpPoints,!1):T=yn(y,!0),{d:T,rect:Re(y),isDot:!1,pos:this.tmpPoints[0].XY}}computDotPoints(t){const r=Jt.GetDotStroke(this.tmpPoints[0],t/2,8);return{d:yn(r,!0),rect:Re(r),isDot:!0,pos:this.tmpPoints[0].XY}}updateTempPoints(t){const r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],{thickness:c}=this.workOptions;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n}else this.tmpPoints.push(n);return!0}consumeService(t){var h,v;const{op:r,isFullWork:n,workState:s=te.Done}=t,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(let u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));const l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawEraserlines:s===te.Done});return this.oldRect=f,(v=this.vNodes)==null||v.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&Yt.getCenterPos(f,l)}),f}clearTmpPoints(){this.tmpPoints.length=0}static updateNodeOpt(t){var h,v;const{node:r,opt:n,vNodes:s}=t,{strokeColor:c,strokeType:l}=n,f=s.get(r.name);return c&&(r.tagName==="GROUP"?r.children.forEach(u=>{u.setAttribute("strokeColor",c),u.getAttribute("fillColor")&&u.setAttribute("fillColor",c)}):(r.setAttribute("strokeColor",c),r.setAttribute("fillColor",c)),(h=f==null?void 0:f.opt)!=null&&h.strokeColor&&(f.opt.strokeColor=c)),l&&(f!=null&&f.opt)&&((v=f.opt)!=null&&v.strokeType)&&(f.opt.strokeType=l),f&&s.setInfo(r.name,f),Yt.updateNodeOpt(t)}}const ri="cursorhover",pc=20,Bn="mainView";var vc={exports:{}},je={},ea={exports:{}},Wn={};function gc(){var i={};return i["align-content"]=!1,i["align-items"]=!1,i["align-self"]=!1,i["alignment-adjust"]=!1,i["alignment-baseline"]=!1,i.all=!1,i["anchor-point"]=!1,i.animation=!1,i["animation-delay"]=!1,i["animation-direction"]=!1,i["animation-duration"]=!1,i["animation-fill-mode"]=!1,i["animation-iteration-count"]=!1,i["animation-name"]=!1,i["animation-play-state"]=!1,i["animation-timing-function"]=!1,i.azimuth=!1,i["backface-visibility"]=!1,i.background=!0,i["background-attachment"]=!0,i["background-clip"]=!0,i["background-color"]=!0,i["background-image"]=!0,i["background-origin"]=!0,i["background-position"]=!0,i["background-repeat"]=!0,i["background-size"]=!0,i["baseline-shift"]=!1,i.binding=!1,i.bleed=!1,i["bookmark-label"]=!1,i["bookmark-level"]=!1,i["bookmark-state"]=!1,i.border=!0,i["border-bottom"]=!0,i["border-bottom-color"]=!0,i["border-bottom-left-radius"]=!0,i["border-bottom-right-radius"]=!0,i["border-bottom-style"]=!0,i["border-bottom-width"]=!0,i["border-collapse"]=!0,i["border-color"]=!0,i["border-image"]=!0,i["border-image-outset"]=!0,i["border-image-repeat"]=!0,i["border-image-slice"]=!0,i["border-image-source"]=!0,i["border-image-width"]=!0,i["border-left"]=!0,i["border-left-color"]=!0,i["border-left-style"]=!0,i["border-left-width"]=!0,i["border-radius"]=!0,i["border-right"]=!0,i["border-right-color"]=!0,i["border-right-style"]=!0,i["border-right-width"]=!0,i["border-spacing"]=!0,i["border-style"]=!0,i["border-top"]=!0,i["border-top-color"]=!0,i["border-top-left-radius"]=!0,i["border-top-right-radius"]=!0,i["border-top-style"]=!0,i["border-top-width"]=!0,i["border-width"]=!0,i.bottom=!1,i["box-decoration-break"]=!0,i["box-shadow"]=!0,i["box-sizing"]=!0,i["box-snap"]=!0,i["box-suppress"]=!0,i["break-after"]=!0,i["break-before"]=!0,i["break-inside"]=!0,i["caption-side"]=!1,i.chains=!1,i.clear=!0,i.clip=!1,i["clip-path"]=!1,i["clip-rule"]=!1,i.color=!0,i["color-interpolation-filters"]=!0,i["column-count"]=!1,i["column-fill"]=!1,i["column-gap"]=!1,i["column-rule"]=!1,i["column-rule-color"]=!1,i["column-rule-style"]=!1,i["column-rule-width"]=!1,i["column-span"]=!1,i["column-width"]=!1,i.columns=!1,i.contain=!1,i.content=!1,i["counter-increment"]=!1,i["counter-reset"]=!1,i["counter-set"]=!1,i.crop=!1,i.cue=!1,i["cue-after"]=!1,i["cue-before"]=!1,i.cursor=!1,i.direction=!1,i.display=!0,i["display-inside"]=!0,i["display-list"]=!0,i["display-outside"]=!0,i["dominant-baseline"]=!1,i.elevation=!1,i["empty-cells"]=!1,i.filter=!1,i.flex=!1,i["flex-basis"]=!1,i["flex-direction"]=!1,i["flex-flow"]=!1,i["flex-grow"]=!1,i["flex-shrink"]=!1,i["flex-wrap"]=!1,i.float=!1,i["float-offset"]=!1,i["flood-color"]=!1,i["flood-opacity"]=!1,i["flow-from"]=!1,i["flow-into"]=!1,i.font=!0,i["font-family"]=!0,i["font-feature-settings"]=!0,i["font-kerning"]=!0,i["font-language-override"]=!0,i["font-size"]=!0,i["font-size-adjust"]=!0,i["font-stretch"]=!0,i["font-style"]=!0,i["font-synthesis"]=!0,i["font-variant"]=!0,i["font-variant-alternates"]=!0,i["font-variant-caps"]=!0,i["font-variant-east-asian"]=!0,i["font-variant-ligatures"]=!0,i["font-variant-numeric"]=!0,i["font-variant-position"]=!0,i["font-weight"]=!0,i.grid=!1,i["grid-area"]=!1,i["grid-auto-columns"]=!1,i["grid-auto-flow"]=!1,i["grid-auto-rows"]=!1,i["grid-column"]=!1,i["grid-column-end"]=!1,i["grid-column-start"]=!1,i["grid-row"]=!1,i["grid-row-end"]=!1,i["grid-row-start"]=!1,i["grid-template"]=!1,i["grid-template-areas"]=!1,i["grid-template-columns"]=!1,i["grid-template-rows"]=!1,i["hanging-punctuation"]=!1,i.height=!0,i.hyphens=!1,i.icon=!1,i["image-orientation"]=!1,i["image-resolution"]=!1,i["ime-mode"]=!1,i["initial-letters"]=!1,i["inline-box-align"]=!1,i["justify-content"]=!1,i["justify-items"]=!1,i["justify-self"]=!1,i.left=!1,i["letter-spacing"]=!0,i["lighting-color"]=!0,i["line-box-contain"]=!1,i["line-break"]=!1,i["line-grid"]=!1,i["line-height"]=!1,i["line-snap"]=!1,i["line-stacking"]=!1,i["line-stacking-ruby"]=!1,i["line-stacking-shift"]=!1,i["line-stacking-strategy"]=!1,i["list-style"]=!0,i["list-style-image"]=!0,i["list-style-position"]=!0,i["list-style-type"]=!0,i.margin=!0,i["margin-bottom"]=!0,i["margin-left"]=!0,i["margin-right"]=!0,i["margin-top"]=!0,i["marker-offset"]=!1,i["marker-side"]=!1,i.marks=!1,i.mask=!1,i["mask-box"]=!1,i["mask-box-outset"]=!1,i["mask-box-repeat"]=!1,i["mask-box-slice"]=!1,i["mask-box-source"]=!1,i["mask-box-width"]=!1,i["mask-clip"]=!1,i["mask-image"]=!1,i["mask-origin"]=!1,i["mask-position"]=!1,i["mask-repeat"]=!1,i["mask-size"]=!1,i["mask-source-type"]=!1,i["mask-type"]=!1,i["max-height"]=!0,i["max-lines"]=!1,i["max-width"]=!0,i["min-height"]=!0,i["min-width"]=!0,i["move-to"]=!1,i["nav-down"]=!1,i["nav-index"]=!1,i["nav-left"]=!1,i["nav-right"]=!1,i["nav-up"]=!1,i["object-fit"]=!1,i["object-position"]=!1,i.opacity=!1,i.order=!1,i.orphans=!1,i.outline=!1,i["outline-color"]=!1,i["outline-offset"]=!1,i["outline-style"]=!1,i["outline-width"]=!1,i.overflow=!1,i["overflow-wrap"]=!1,i["overflow-x"]=!1,i["overflow-y"]=!1,i.padding=!0,i["padding-bottom"]=!0,i["padding-left"]=!0,i["padding-right"]=!0,i["padding-top"]=!0,i.page=!1,i["page-break-after"]=!1,i["page-break-before"]=!1,i["page-break-inside"]=!1,i["page-policy"]=!1,i.pause=!1,i["pause-after"]=!1,i["pause-before"]=!1,i.perspective=!1,i["perspective-origin"]=!1,i.pitch=!1,i["pitch-range"]=!1,i["play-during"]=!1,i.position=!1,i["presentation-level"]=!1,i.quotes=!1,i["region-fragment"]=!1,i.resize=!1,i.rest=!1,i["rest-after"]=!1,i["rest-before"]=!1,i.richness=!1,i.right=!1,i.rotation=!1,i["rotation-point"]=!1,i["ruby-align"]=!1,i["ruby-merge"]=!1,i["ruby-position"]=!1,i["shape-image-threshold"]=!1,i["shape-outside"]=!1,i["shape-margin"]=!1,i.size=!1,i.speak=!1,i["speak-as"]=!1,i["speak-header"]=!1,i["speak-numeral"]=!1,i["speak-punctuation"]=!1,i["speech-rate"]=!1,i.stress=!1,i["string-set"]=!1,i["tab-size"]=!1,i["table-layout"]=!1,i["text-align"]=!0,i["text-align-last"]=!0,i["text-combine-upright"]=!0,i["text-decoration"]=!0,i["text-decoration-color"]=!0,i["text-decoration-line"]=!0,i["text-decoration-skip"]=!0,i["text-decoration-style"]=!0,i["text-emphasis"]=!0,i["text-emphasis-color"]=!0,i["text-emphasis-position"]=!0,i["text-emphasis-style"]=!0,i["text-height"]=!0,i["text-indent"]=!0,i["text-justify"]=!0,i["text-orientation"]=!0,i["text-overflow"]=!0,i["text-shadow"]=!0,i["text-space-collapse"]=!0,i["text-transform"]=!0,i["text-underline-position"]=!0,i["text-wrap"]=!0,i.top=!1,i.transform=!1,i["transform-origin"]=!1,i["transform-style"]=!1,i.transition=!1,i["transition-delay"]=!1,i["transition-duration"]=!1,i["transition-property"]=!1,i["transition-timing-function"]=!1,i["unicode-bidi"]=!1,i["vertical-align"]=!1,i.visibility=!1,i["voice-balance"]=!1,i["voice-duration"]=!1,i["voice-family"]=!1,i["voice-pitch"]=!1,i["voice-range"]=!1,i["voice-rate"]=!1,i["voice-stress"]=!1,i["voice-volume"]=!1,i.volume=!1,i["white-space"]=!1,i.widows=!1,i.width=!0,i["will-change"]=!1,i["word-break"]=!0,i["word-spacing"]=!0,i["word-wrap"]=!0,i["wrap-flow"]=!1,i["wrap-through"]=!1,i["writing-mode"]=!1,i["z-index"]=!1,i}function px(i,e,t){}function vx(i,e,t){}var gx=/javascript\s*\:/img;function mx(i,e){return gx.test(e)?"":e}Wn.whiteList=gc(),Wn.getDefaultWhiteList=gc,Wn.onAttr=px,Wn.onIgnoreAttr=vx,Wn.safeAttrValue=mx;var yx={indexOf:function(i,e){var t,r;if(Array.prototype.indexOf)return i.indexOf(e);for(t=0,r=i.length;t<r;t++)if(i[t]===e)return t;return-1},forEach:function(i,e,t){var r,n;if(Array.prototype.forEach)return i.forEach(e,t);for(r=0,n=i.length;r<n;r++)e.call(t,i[r],r,i)},trim:function(i){return String.prototype.trim?i.trim():i.replace(/(^\s*)|(\s*$)/g,"")},trimRight:function(i){return String.prototype.trimRight?i.trimRight():i.replace(/(\s*$)/g,"")}},Di=yx;function Sx(i,e){i=Di.trimRight(i),i[i.length-1]!==";"&&(i+=";");var t=i.length,r=!1,n=0,s=0,c="";function l(){if(!r){var v=Di.trim(i.slice(n,s)),u=v.indexOf(":");if(u!==-1){var y=Di.trim(v.slice(0,u)),T=Di.trim(v.slice(u+1));if(y){var w=e(n,c.length,y,T,v);w&&(c+=w+"; ")}}}n=s+1}for(;s<t;s++){var f=i[s];if(f==="/"&&i[s+1]==="*"){var h=i.indexOf("*/",s+2);if(h===-1)break;s=h+1,n=s+1,r=!1}else f==="("?r=!0:f===")"?r=!1:f===";"?r||l():f===`
567
567
  `&&l()}return Di.trim(c)}var Px=Sx,ms=Wn,xx=Px;function mc(i){return i==null}function Tx(i){var e={};for(var t in i)e[t]=i[t];return e}function yc(i){i=Tx(i||{}),i.whiteList=i.whiteList||ms.whiteList,i.onAttr=i.onAttr||ms.onAttr,i.onIgnoreAttr=i.onIgnoreAttr||ms.onIgnoreAttr,i.safeAttrValue=i.safeAttrValue||ms.safeAttrValue,this.options=i}yc.prototype.process=function(i){if(i=i||"",i=i.toString(),!i)return"";var e=this,t=e.options,r=t.whiteList,n=t.onAttr,s=t.onIgnoreAttr,c=t.safeAttrValue,l=xx(i,function(f,h,v,u,y){var T=r[v],w=!1;if(T===!0?w=T:typeof T=="function"?w=T(u):T instanceof RegExp&&(w=T.test(u)),w!==!0&&(w=!1),u=c(v,u),!!u){var I={position:h,sourcePosition:f,source:y,isWhite:w};if(w){var S=n(v,u,I);return mc(S)?v+":"+u:S}else{var S=s(v,u,I);if(!mc(S))return S}}});return l};var Cx=yc;(function(i,e){var t=Wn,r=Cx;function n(c,l){var f=new r(l);return f.process(c)}e=i.exports=n,e.FilterCSS=r;for(var s in t)e[s]=t[s];typeof window<"u"&&(window.filterCSS=i.exports)})(ea,ea.exports);var ra=ea.exports,na={indexOf:function(i,e){var t,r;if(Array.prototype.indexOf)return i.indexOf(e);for(t=0,r=i.length;t<r;t++)if(i[t]===e)return t;return-1},forEach:function(i,e,t){var r,n;if(Array.prototype.forEach)return i.forEach(e,t);for(r=0,n=i.length;r<n;r++)e.call(t,i[r],r,i)},trim:function(i){return String.prototype.trim?i.trim():i.replace(/(^\s*)|(\s*$)/g,"")},spaceIndex:function(i){var e=/\s|\n|\t/,t=e.exec(i);return t?t.index:-1}},Ix=ra.FilterCSS,Ox=ra.getDefaultWhiteList,ys=na;function Sc(){return{a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],figcaption:[],figure:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height","loading"],ins:["datetime"],kbd:[],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],summary:[],sup:[],strong:[],strike:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","crossorigin","loop","muted","playsinline","poster","preload","src","height","width"]}}var Pc=new Ix;function wx(i,e,t){}function Ax(i,e,t){}function Ex(i,e,t){}function Mx(i,e,t){}function xc(i){return i.replace(Rx,"&lt;").replace(bx,"&gt;")}function Lx(i,e,t,r){if(t=Mc(t),e==="href"||e==="src"){if(t=ys.trim(t),t==="#")return"#";if(!(t.substr(0,7)==="http://"||t.substr(0,8)==="https://"||t.substr(0,7)==="mailto:"||t.substr(0,4)==="tel:"||t.substr(0,11)==="data:image/"||t.substr(0,6)==="ftp://"||t.substr(0,2)==="./"||t.substr(0,3)==="../"||t[0]==="#"||t[0]==="/"))return""}else if(e==="background"){if(Ss.lastIndex=0,Ss.test(t))return""}else if(e==="style"){if(Tc.lastIndex=0,Tc.test(t)||(Cc.lastIndex=0,Cc.test(t)&&(Ss.lastIndex=0,Ss.test(t))))return"";r!==!1&&(r=r||Pc,t=r.process(t))}return t=Lc(t),t}var Rx=/</g,bx=/>/g,Dx=/"/g,Nx=/&quot;/g,Bx=/&#([a-zA-Z0-9]*);?/gim,Wx=/&colon;?/gim,Fx=/&newline;?/gim,Ss=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,Tc=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,Cc=/u\s*r\s*l\s*\(.*/gi;function Ic(i){return i.replace(Dx,"&quot;")}function Oc(i){return i.replace(Nx,'"')}function wc(i){return i.replace(Bx,function(t,r){return r[0]==="x"||r[0]==="X"?String.fromCharCode(parseInt(r.substr(1),16)):String.fromCharCode(parseInt(r,10))})}function Ac(i){return i.replace(Wx,":").replace(Fx," ")}function Ec(i){for(var e="",t=0,r=i.length;t<r;t++)e+=i.charCodeAt(t)<32?" ":i.charAt(t);return ys.trim(e)}function Mc(i){return i=Oc(i),i=wc(i),i=Ac(i),i=Ec(i),i}function Lc(i){return i=Ic(i),i=xc(i),i}function Ux(){return""}function Yx(i,e){typeof e!="function"&&(e=function(){});var t=!Array.isArray(i);function r(c){return t?!0:ys.indexOf(i,c)!==-1}var n=[],s=!1;return{onIgnoreTag:function(c,l,f){if(r(c))if(f.isClosing){var h="[/removed]",v=f.position+h.length;return n.push([s!==!1?s:f.position,v]),s=!1,h}else return s||(s=f.position),"[removed]";else return e(c,l,f)},remove:function(c){var l="",f=0;return ys.forEach(n,function(h){l+=c.slice(f,h[0]),f=h[1]}),l+=c.slice(f),l}}}function Xx(i){for(var e="",t=0;t<i.length;){var r=i.indexOf("<!--",t);if(r===-1){e+=i.slice(t);break}e+=i.slice(t,r);var n=i.indexOf("-->",r);if(n===-1)break;t=n+3}return e}function zx(i){var e=i.split("");return e=e.filter(function(t){var r=t.charCodeAt(0);return r===127?!1:r<=31?r===10||r===13:!0}),e.join("")}je.whiteList=Sc(),je.getDefaultWhiteList=Sc,je.onTag=wx,je.onIgnoreTag=Ax,je.onTagAttr=Ex,je.onIgnoreTagAttr=Mx,je.safeAttrValue=Lx,je.escapeHtml=xc,je.escapeQuote=Ic,je.unescapeQuote=Oc,je.escapeHtmlEntities=wc,je.escapeDangerHtml5Entities=Ac,je.clearNonPrintableCharacter=Ec,je.friendlyAttrValue=Mc,je.escapeAttrValue=Lc,je.onIgnoreTagStripAll=Ux,je.StripTagBody=Yx,je.stripCommentTag=Xx,je.stripBlankChar=zx,je.attributeWrapSign='"',je.cssFilter=Pc,je.getDefaultCSSWhiteList=Ox;var Ps={},Sn=na;function $x(i){var e=Sn.spaceIndex(i),t;return e===-1?t=i.slice(1,-1):t=i.slice(1,e+1),t=Sn.trim(t).toLowerCase(),t.slice(0,1)==="/"&&(t=t.slice(1)),t.slice(-1)==="/"&&(t=t.slice(0,-1)),t}function jx(i){return i.slice(0,2)==="</"}function Gx(i,e,t){var r="",n=0,s=!1,c=!1,l=0,f=i.length,h="",v="";t:for(l=0;l<f;l++){var u=i.charAt(l);if(s===!1){if(u==="<"){s=l;continue}}else if(c===!1){if(u==="<"){r+=t(i.slice(n,l)),s=l,n=l;continue}if(u===">"||l===f-1){r+=t(i.slice(n,s)),v=i.slice(s,l+1),h=$x(v),r+=e(s,r.length,h,v,jx(v)),n=l+1,s=!1;continue}if(u==='"'||u==="'")for(var y=1,T=i.charAt(l-y);T.trim()===""||T==="=";){if(T==="="){c=u;continue t}T=i.charAt(l-++y)}}else if(u===c){c=!1;continue}}return n<f&&(r+=t(i.substr(n))),r}var kx=/[^a-zA-Z0-9\\_:.-]/gim;function Hx(i,e){var t=0,r=0,n=[],s=!1,c=i.length;function l(y,T){if(y=Sn.trim(y),y=y.replace(kx,"").toLowerCase(),!(y.length<1)){var w=e(y,T||"");w&&n.push(w)}}for(var f=0;f<c;f++){var h=i.charAt(f),v,u;if(s===!1&&h==="="){s=i.slice(t,f),t=f+1,r=i.charAt(t)==='"'||i.charAt(t)==="'"?t:Kx(i,f+1);continue}if(s!==!1&&f===r){if(u=i.indexOf(h,f+1),u===-1)break;v=Sn.trim(i.slice(r+1,u)),l(s,v),s=!1,f=u,t=f+1;continue}if(/\s|\n|\t/.test(h))if(i=i.replace(/\s|\n|\t/g," "),s===!1)if(u=Vx(i,f),u===-1){v=Sn.trim(i.slice(t,f)),l(v),s=!1,t=f+1;continue}else{f=u-1;continue}else if(u=Zx(i,f-1),u===-1){v=Sn.trim(i.slice(t,f)),v=Rc(v),l(s,v),s=!1,t=f+1;continue}else continue}return t<i.length&&(s===!1?l(i.slice(t)):l(s,Rc(Sn.trim(i.slice(t))))),Sn.trim(n.join(" "))}function Vx(i,e){for(;e<i.length;e++){var t=i[e];if(t!==" ")return t==="="?e:-1}}function Kx(i,e){for(;e<i.length;e++){var t=i[e];if(t!==" ")return t==="'"||t==='"'?e:-1}}function Zx(i,e){for(;e>0;e--){var t=i[e];if(t!==" ")return t==="="?e:-1}}function Jx(i){return i[0]==='"'&&i[i.length-1]==='"'||i[0]==="'"&&i[i.length-1]==="'"}function Rc(i){return Jx(i)?i.substr(1,i.length-2):i}Ps.parseTag=Gx,Ps.parseAttr=Hx;var Qx=ra.FilterCSS,Rr=je,bc=Ps,qx=bc.parseTag,_x=bc.parseAttr,xs=na;function Ts(i){return i==null}function tT(i){var e=xs.spaceIndex(i);if(e===-1)return{html:"",closing:i[i.length-2]==="/"};i=xs.trim(i.slice(e+1,-1));var t=i[i.length-1]==="/";return t&&(i=xs.trim(i.slice(0,-1))),{html:i,closing:t}}function eT(i){var e={};for(var t in i)e[t]=i[t];return e}function rT(i){var e={};for(var t in i)Array.isArray(i[t])?e[t.toLowerCase()]=i[t].map(function(r){return r.toLowerCase()}):e[t.toLowerCase()]=i[t];return e}function Dc(i){i=eT(i||{}),i.stripIgnoreTag&&(i.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),i.onIgnoreTag=Rr.onIgnoreTagStripAll),i.whiteList||i.allowList?i.whiteList=rT(i.whiteList||i.allowList):i.whiteList=Rr.whiteList,this.attributeWrapSign=i.singleQuotedAttributeValue===!0?"'":Rr.attributeWrapSign,i.onTag=i.onTag||Rr.onTag,i.onTagAttr=i.onTagAttr||Rr.onTagAttr,i.onIgnoreTag=i.onIgnoreTag||Rr.onIgnoreTag,i.onIgnoreTagAttr=i.onIgnoreTagAttr||Rr.onIgnoreTagAttr,i.safeAttrValue=i.safeAttrValue||Rr.safeAttrValue,i.escapeHtml=i.escapeHtml||Rr.escapeHtml,this.options=i,i.css===!1?this.cssFilter=!1:(i.css=i.css||{},this.cssFilter=new Qx(i.css))}Dc.prototype.process=function(i){if(i=i||"",i=i.toString(),!i)return"";var e=this,t=e.options,r=t.whiteList,n=t.onTag,s=t.onIgnoreTag,c=t.onTagAttr,l=t.onIgnoreTagAttr,f=t.safeAttrValue,h=t.escapeHtml,v=e.attributeWrapSign,u=e.cssFilter;t.stripBlankChar&&(i=Rr.stripBlankChar(i)),t.allowCommentTag||(i=Rr.stripCommentTag(i));var y=!1;t.stripIgnoreTagBody&&(y=Rr.StripTagBody(t.stripIgnoreTagBody,s),s=y.onIgnoreTag);var T=qx(i,function(w,I,S,O,d){var g={sourcePosition:w,position:I,isClosing:d,isWhite:Object.prototype.hasOwnProperty.call(r,S)},p=n(S,O,g);if(!Ts(p))return p;if(g.isWhite){if(g.isClosing)return"</"+S+">";var x=tT(O),E=r[S],R=_x(x.html,function(D,U){var M=xs.indexOf(E,D)!==-1,W=c(S,D,U,M);return Ts(W)?M?(U=f(S,D,U,u),U?D+"="+v+U+v:D):(W=l(S,D,U,M),Ts(W)?void 0:W):W});return O="<"+S,R&&(O+=" "+R),x.closing&&(O+=" /"),O+=">",O}else return p=s(S,O,g),Ts(p)?h(O):p},h);return y&&(T=y.remove(T)),T};var nT=Dc;(function(i,e){var t=je,r=Ps,n=nT;function s(l,f){var h=new n(f);return h.process(l)}e=i.exports=s,e.filterXSS=s,e.FilterXSS=n,function(){for(var l in t)e[l]=t[l];for(var f in r)e[f]=r[f]}(),typeof window<"u"&&(window.filterXSS=i.exports);function c(){return typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope}c()&&(self.filterXSS=i.exports)})(vc,vc.exports);var Cs={exports:{}};/**
568
568
  * @license
569
569
  * Lodash <https://lodash.com/>