@leafer-game/worker 1.12.0 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- var LeaferUI=function(t){"use strict";var e,i;t.PathNodeHandleType=void 0,(e=t.PathNodeHandleType||(t.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror",t.Answer=void 0,(i=t.Answer||(t.Answer={}))[i.No=0]="No",i[i.Yes=1]="Yes",i[i.NoAndSkip=2]="NoAndSkip",i[i.YesAndSkip=3]="YesAndSkip";const s={};function r(t){return void 0===t}function n(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:o}=Number;function h(t){return"number"==typeof t}const l=/^-?\d+(?:\.\d+)?$/;const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return"{}"===JSON.stringify(t)}const _={default:(t,e)=>(p(e,t),p(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var n,a;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return p(t[r],e[r],i&&i[r]);i&&r in i?(null===(a=i[r])||void 0===a?void 0:a.constructor)===Object&&p(t[r]={},e[r],i[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{r(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:p}=_;class g{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=r(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!r(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(d(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!r(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=r(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:a}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:a}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{floor:f,max:y}=Math,m={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||v.maxCacheSize),isSuperLarge:(t,e,i)=>v.isLarge(t,e,i,v.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=m.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,r,n,a,o,h){const l=m.origin.createCanvas(y(f(e+(s||0)),1),y(f(i+(r||0)),1)),d=l.getContext("2d");if(o&&(d.globalAlpha=o),d.imageSmoothingEnabled=!1!==a,n){const s=e/n.width,r=i/n.height;d.setTransform(s,0,0,r,-n.x*s,-n.y*r),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&_.stintSet(i,"transform",e)}}},{image:v}=m,x={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=w;return e[t]?e[t]++:(e[t]=1,0)}},w=x;let b,E,S;const{max:P}=Math,B=[0,0,0,0],k={zero:[...B],tempFour:B,set:(t,e,i,s,r)=>(void 0===i&&(i=s=r=e),t[0]=e,t[1]=i,t[2]=s,t[3]=r,t),setTemp:(t,e,i,s)=>T(B,t,e,i,s),toTempAB(t,e,i){S=i?h(t)?e:t:[],h(t)?(b=R(t),E=e):h(e)?(b=t,E=R(e)):(b=t,E=e),4!==b.length&&(b=C(b)),4!==E.length&&(E=C(E))},get(t,e){let i;if(!h(t))switch(t.length){case 4:i=r(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!r(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>h(t)&&h(e)?P(t,e):(L(t,e,i),T(S,P(b[0],E[0]),P(b[1],E[1]),P(b[2],E[2]),P(b[3],E[3]))),add:(t,e,i)=>h(t)&&h(e)?t+e:(L(t,e,i),T(S,b[0]+E[0],b[1]+E[1],b[2]+E[2],b[3]+E[3])),swapAndScale(t,e,i,s){if(h(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[n,a,o,l]=4===t.length?t:C(t);return T(r,o*i,l*e,n*i,a*e)}},{set:T,get:C,setTemp:R,toTempAB:L}=k,{round:A,pow:D,max:O,floor:I,PI:F}=Math,M={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!r(e)&&t<e&&(t=e),!r(i)&&t>i&&(t=i),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),M.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=r(e)?1e12:D(10,e);return-0===(t=A(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(h(e)?e:e.width||0)/i.width,r=(h(e)?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&M.assignScale(s,t);return s},assignScale(t,e){h(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>O(I(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const U=F/180,N=2*F,z=F/2;function Y(){return{x:0,y:0}}function X(){return{x:0,y:0,width:0,height:0}}function H(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:j,cos:V,acos:G,sqrt:q}=Math,{float:K}=M,Z={};function Q(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const J={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Q(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,n=0,a=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=a},get:H,getWorld:Q,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){$.toInnerPoint(t,e,Z),$.scaleOfInner(t,Z,i,s)},scaleOfInner(t,e,i,s=i){$.translateInner(t,e.x,e.y),$.scale(t,i,s),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,a=V(e*=U),o=j(e);t.a=i*a-s*o,t.b=i*o+s*a,t.c=r*a-n*o,t.d=r*o+n*a},rotateOfOuter(t,e,i){$.toInnerPoint(t,e,Z),$.rotateOfInner(t,Z,i)},rotateOfInner(t,e,i){$.translateInner(t,e.x,e.y),$.rotate(t,i),$.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:a}=t;i&&(i*=U,t.a=s+n*i,t.b=r+a*i),e&&(e*=U,t.c=n+s*e,t.d=a+r*e)},skewOfOuter(t,e,i,s){$.toInnerPoint(t,e,Z),$.skewOfInner(t,Z,i,s)},skewOfInner(t,e,i,s=0){$.translateInner(t,e.x,e.y),$.skew(t,i,s),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:a,f:o}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+a,t.f=e.e*s+e.f*n+o},multiplyParent(t,e,i,s,n){const{e:a,f:o}=t;if(i||(i=t),r(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:a,d:o}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=a*e.a+o*e.c,i.d=a*e.b+o*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=a*e.a+o*e.c+e.e,i.f=a*e.b+o*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:i,c:s,d:r,e:n,f:a}=t;if(i||s){const o=1/(e*r-i*s);t.a=r*o,t.b=-i*o,t.c=-s*o,t.d=e*o,t.e=-(n*r-a*s)*o,t.f=-(a*e-n*i)*o}else if(1===e&&1===r)t.e=-n,t.f=-a;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-a*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:a,d:o}=t,h=1/(r*o-n*a),{x:l,y:d}=e;if(i||(i=e),i.x=(l*o-d*a)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*o-s*a)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,s,n){const{x:a,y:o,scaleX:h,scaleY:l}=e;if(r(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:r}=e,n=i*U,a=V(n),o=j(n);if(s||r){const e=s*U,i=r*U;t.a=(a+i*-o)*h,t.b=(o+i*a)*h,t.c=(e*a-o)*l,t.d=(a+e*o)*l}else t.a=a*h,t.b=o*h,t.c=-o*l,t.d=a*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=a,t.f=o,(i=i||s)&&$.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:r,b:n,c:a,d:o,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||a){const t=r*o-n*a;if(a&&!s){d=q(r*r+n*n),c=t/d;const e=r/d;u=n>0?G(e):-G(e)}else{c=q(a*a+o*o),d=t/c;const e=a/c;u=z-(o>0?G(-e):-G(e))}const e=K(V(u)),i=j(u);d=K(d),c=K(c),_=e?K((a/c+i)/e/U,9):0,p=e?K((n/d-i)/e/U,9):0,u=K(u/U)}else d=r,c=o,u=_=p=0;return(e=i||e)&&(g+=e.x*r+e.y*a,f+=e.x*n+e.y*o,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:a}=t;r||n?i=(s*a-r*n)/(e=q(s*s+r*r)):(e=s,i=a)}return s.scaleX=e,s.scaleY=i,s},reset(t){$.set(t)}},$=J,{toInnerPoint:tt,toOuterPoint:et}=J,{sin:it,cos:st,abs:rt,sqrt:nt,atan2:at,min:ot,round:ht}=Math,lt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=r(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=dt.defaultPoint);const s=st(e*=U),r=it(e),n=t.x-i.x,a=t.y-i.y;t.x=i.x+n*s-a*r,t.y=i.y+n*r+a*s},tempToInnerOf(t,e){const{tempPoint:i}=dt;return ut(i,t),tt(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=dt;return ut(i,t),et(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=dt;return ut(i,t),dt.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),tt(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){tt(e,t,i)},toOuterOf(t,e,i){et(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>ct(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=rt(i-t),n=rt(s-e);return nt(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>ot(ct(t,e,i,s),ct(i,s,r,n)),getAngle:(t,e)=>_t(t,e)/U,getRotation:(t,e,i,s)=>(s||(s=e),dt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/U),getRadianFrom(t,e,i,s,n,a,o,h){r(o)&&(o=i,h=s);const l=t-i,d=e-s,c=n-o,u=a-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>at(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,r){const n=_t(t,e);return r&&(t=e),s||(e={}),e.x=t.x+st(n)*i,e.y=t.y+it(n)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>t.x===e.x&&t.y===e.y,reset(t){dt.reset(t)}},dt=lt,{getDistanceFrom:ct,copy:ut,getAtan2:_t}=dt;class pt{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?lt.copy(this,t):lt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new pt(this)}move(t,e){return lt.move(this,t,e),this}scale(t,e){return lt.scale(this,t,e),this}scaleOf(t,e,i){return lt.scaleOf(this,t,e,i),this}rotate(t,e){return lt.rotate(this,t,e),this}rotateOf(t,e){return lt.rotate(this,e,t),this}getRotation(t,e,i){return lt.getRotation(this,t,e,i)}toInnerOf(t,e){return lt.toInnerOf(this,t,e),this}toOuterOf(t,e){return lt.toOuterOf(this,t,e),this}getCenter(t){return new pt(lt.getCenter(this,t))}getDistance(t){return lt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new pt(lt.getDistancePoint(this,t,e,i,s))}getAngle(t){return lt.getAngle(this,t)}getAtan2(t){return lt.getAtan2(this,t)}isSame(t){return lt.isSame(this,t)}reset(){return lt.reset(this),this}}const gt=new pt;class ft{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return c(t)?J.copy(this,t):J.set(this,t,e,i,s,r,n),this}setWith(t){return J.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new ft(this)}translate(t,e){return J.translate(this,t,e),this}translateInner(t,e){return J.translateInner(this,t,e),this}scale(t,e){return J.scale(this,t,e),this}scaleWith(t,e){return J.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return J.pixelScale(this,t),this}scaleOfOuter(t,e,i){return J.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return J.scaleOfInner(this,t,e,i),this}rotate(t){return J.rotate(this,t),this}rotateOfOuter(t,e){return J.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return J.rotateOfInner(this,t,e),this}skew(t,e){return J.skew(this,t,e),this}skewOfOuter(t,e,i){return J.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return J.skewOfInner(this,t,e,i),this}multiply(t){return J.multiply(this,t),this}multiplyParent(t){return J.multiplyParent(this,t),this}divide(t){return J.divide(this,t),this}divideParent(t){return J.divideParent(this,t),this}invert(){return J.invert(this),this}invertWith(){return J.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){J.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){J.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return J.setLayout(this,t,e,i),this}getLayout(t,e,i){return J.getLayout(this,t,e,i)}withScale(t,e){return J.withScale(this,t,e)}reset(){J.reset(this)}}const yt=new ft,mt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,r){vt(t,e,i),vt(t,e+s,i+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:vt}=mt;var xt,wt;t.Direction4=void 0,(xt=t.Direction4||(t.Direction4={}))[xt.top=0]="top",xt[xt.right=1]="right",xt[xt.bottom=2]="bottom",xt[xt.left=3]="left",t.Direction9=void 0,(wt=t.Direction9||(t.Direction9={}))[wt.topLeft=0]="topLeft",wt[wt.top=1]="top",wt[wt.topRight=2]="topRight",wt[wt.right=3]="right",wt[wt.bottomRight=4]="bottomRight",wt[wt.bottom=5]="bottom",wt[wt.bottomLeft=6]="bottomLeft",wt[wt.left=7]="left",wt[wt.center=8]="center",wt[wt["top-left"]=0]="top-left",wt[wt["top-right"]=2]="top-right",wt[wt["bottom-right"]=4]="bottom-right",wt[wt["bottom-left"]=6]="bottom-left";const bt=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];bt.forEach(t=>t.type="percent");const Et={directionData:bt,tempPoint:{},get:St,toPoint(t,e,i,s,r,n){const a=St(t);i.x=a.x,i.y=a.y,"percent"===a.type&&(i.x*=e.width,i.y*=e.height,r&&(n||(i.x-=r.x,i.y-=r.y),a.x&&(i.x-=1===a.x?r.width:.5===a.x?a.x*r.width:0),a.y&&(i.y-=1===a.y?r.height:.5===a.y?a.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),Et.toPoint(t,e,i,!0),i)};function St(e){return a(e)?bt[t.Direction9[e]]:e}const{toPoint:Pt}=Et,Bt={toPoint(t,e,i,s,r,n){Pt(t,i,s,r,e,n)}},{tempPointBounds:kt,setPoint:Tt,addPoint:Ct,toBounds:Rt}=mt,{toOuterPoint:Lt}=J,{float:At,fourNumber:Dt}=M,{floor:Ot,ceil:It}=Math;let Ft,Mt,Wt,Ut;const Nt={},zt={},Yt={},Xt={tempBounds:Yt,set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,r){const{x:n,y:a,width:o,height:h}=e;if(d(i)){const e=Dt(i);s?Ht.set(t,n+e[3],a+e[0],o-e[1]-e[3],h-e[2]-e[0]):Ht.set(t,n-e[3],a-e[0],o+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ht.set(t,n-i,a-i,o+2*i,h+2*i);r&&("width"===r?(t.y=a,t.height=h):(t.x=n,t.width=o))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Ht.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Vt(e,t):e=t,i||(i=t),e.offsetX=Ht.maxX(i),e.offsetY=Ht.maxY(i),Ht.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||lt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){lt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ht.copy(Yt,t),Ht.toOuterOf(Yt,e),Yt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ht.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r,e:n,f:a}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=a+t.y*r):(i.height=t.height*-r,i.y=a+t.y*r-i.height)}else Nt.x=t.x,Nt.y=t.y,Lt(e,Nt,zt),Tt(kt,zt.x,zt.y),Nt.x=t.x+t.width,Lt(e,Nt,zt),Ct(kt,zt.x,zt.y),Nt.y=t.y+t.height,Lt(e,Nt,zt),Ct(kt,zt.x,zt.y),Nt.x=t.x,Lt(e,Nt,zt),Ct(kt,zt.x,zt.y),Rt(kt,i)},toInnerOf(t,e,i){i||(i=t),Ht.move(i,-e.e,-e.f),Ht.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ht.getFitScale(t,e));return new ft(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,r=t.height/e.height;return i?Math.max(s,r):Math.min(s,r)},put(t,e,i="center",s=1,r=!0,n){n||(n=e),a(s)&&(s=Ht.getFitScale(t,e,"cover"===s)),Yt.width=r?e.width*=s:e.width*s,Yt.height=r?e.height*=s:e.height*s,Bt.toPoint(i,Yt,t,n,!0,!0)},getSpread(t,e,i){const s={};return Ht.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ht.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ht.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Ot(t.x),t.y=Ot(t.y),t.width=e>t.x?It(t.width+e-t.x):It(t.width),t.height=i>t.y?It(t.height+i-t.y):It(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=At(t.x,e),t.y=At(t.y,e),t.width=At(t.width,e),t.height=At(t.height,e)},add(t,e,i){Ft=t.x+t.width,Mt=t.y+t.height,Wt=e.x,Ut=e.y,i||(Wt+=e.width,Ut+=e.height),Ft=Ft>Wt?Ft:Wt,Mt=Mt>Ut?Mt:Ut,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Ft-t.x,t.height=Mt-t.y},addList(t,e){Ht.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ht.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ht.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let r,n=!0;for(let a=0,o=e.length;a<o;a++)r=i?i(e[a],a):e[a],r&&(r.width||r.height)&&(n?(n=!1,s||Vt(t,r)):jt(t,r));n&&Ht.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Tt(kt,t.x,t.y):Ct(kt,t.x,t.y)),Rt(kt,t)},setPoint(t,e){Ht.set(t,e.x,e.y)},addPoint(t,e){jt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},hitRadiusPoint:(t,e,i)=>(i&&(e=lt.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=lt.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Ht.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Ht.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Ht.tempToOuterOf(e,i)),!Ht.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:n,height:a}=e;return Ft=s+n,Mt=r+a,Wt=t.x+t.width,Ut=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,Ft=Ft<Wt?Ft:Wt,Mt=Mt<Ut?Mt:Ut,n=Ft-s,a=Mt-r,{x:s,y:r,width:n,height:a}},intersect(t,e,i){Ht.copy(t,Ht.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Ht.set(t)}},Ht=Xt,{add:jt,copy:Vt}=Ht;class Gt{get minX(){return Xt.minX(this)}get minY(){return Xt.minY(this)}get maxX(){return Xt.maxX(this)}get maxY(){return Xt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Xt.copy(this,t):Xt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Gt(this)}move(t,e){return Xt.move(this,t,e),this}scale(t,e,i){return Xt.scale(this,t,e,i),this}scaleOf(t,e,i){return Xt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Xt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Xt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Xt.getFitMatrix(this,t,e)}put(t,e,i){Xt.put(this,t,e,i)}spread(t,e){return Xt.spread(this,t,e),this}shrink(t,e){return Xt.shrink(this,t,e),this}ceil(){return Xt.ceil(this),this}unsign(){return Xt.unsign(this),this}float(t){return Xt.float(this,t),this}add(t){return Xt.add(this,t),this}addList(t){return Xt.setList(this,t,!0),this}setList(t){return Xt.setList(this,t),this}addListWithFn(t,e){return Xt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Xt.setListWithFn(this,t,e),this}setPoint(t){return Xt.setPoint(this,t),this}setPoints(t){return Xt.setPoints(this,t),this}addPoint(t){return Xt.addPoint(this,t),this}getPoints(){return Xt.getPoints(this)}hitPoint(t,e){return Xt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Xt.hitRadiusPoint(this,t,e)}hit(t,e){return Xt.hit(this,t,e)}includes(t,e){return Xt.includes(this,t,e)}intersect(t,e){return Xt.intersect(this,t,e),this}getIntersect(t,e){return new Gt(Xt.getIntersectData(this,t,e))}isSame(t){return Xt.isSame(this,t)}isEmpty(){return Xt.isEmpty(this)}reset(){Xt.reset(this)}}const qt=new Gt;class Kt{constructor(t,e,i,s,r,n){c(t)?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=t;this.set(e,i,s,r,n,a)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=this;return new Gt(r,e,n||t.width-r-i,a||t.height-e-s)}}const Zt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Qt}=M;class Jt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Jt(t)}static set filter(t){this.filterList=$t(t)}static set exclude(t){this.excludeList=$t(t)}static drawRepaint(t,e){const i=Qt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Jt.showBounds,r=t.__nowWorld,n=Qt();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if(te.enable){if(te.filterList.length&&te.filterList.every(t=>t!==this.name))return;if(te.excludeList.length&&te.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){te.enable&&this.warn(...t)}warn(...t){te.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function $t(t){return t?a(t)&&(t=[t]):t=[],t}Jt.filterList=[],Jt.excludeList=[],Jt.showWarn=!0;const te=Jt,ee=Jt.get("RunTime"),ie={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=x.create(x.RUNTIME);return se.currentId=se.idMap[i]=e?performance.now():Date.now(),se.currentName=se.nameMap[i]=t,se.nameToIdMap[t]=i,i},end(t,e){const i=se.idMap[t],s=se.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;se.idMap[t]=se.nameMap[t]=se.nameToIdMap[s]=void 0,ee.log(s,r,"ms")},endOfName(t,e){const i=se.nameToIdMap[t];r(i)||se.end(i,e)}},se=ie,re=[],ne={list:{},add(t,...e){this.list[t]=!0,re.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>re.forEach(t=>ne.has(t,!0)));const ae={editor:t=>ne.need("editor")},oe=Jt.get("UICreator"),he={list:{},register(t){const{__tag:e}=t.prototype;le[e]&&oe.repeat(e),le[e]=t},get(t,e,i,s,n,a){le[t]||oe.error("not register "+t);const o=new le[t](e);return r(i)||(o.x=i,s&&(o.y=s),n&&(o.width=n),a&&(o.height=a)),o}},{list:le}=he,de=Jt.get("EventCreator"),ce={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(ue[e]&&de.repeat(e),ue[e]=t)})},changeName(t,e){const i=ue[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ue[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ue[t](...e)},{nameList:ue}=ce;class _e{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,r=i.length;s<r;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ae.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function pe(t,e,i,s){var r,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}function ge(t,e,i,s){return new(i||(i=Promise))(function(r,n){function a(t){try{h(s.next(t))}catch(t){n(t)}}function o(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?r(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(a,o)}h((s=s.apply(t,e||[])).next())})}function fe(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const ye=[];function me(){return(t,e)=>{ye.push(e)}}const ve=[];class xe{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ve)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ye.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,a,o,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*o;s+=e,e=0,n+=t,o-=t}if(i<0){const t=-i/r*h;r+=i,i=0,a+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,a,o,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,a,o){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}pe([fe("imageSmoothingEnabled")],xe.prototype,"smooth",void 0),pe([fe("imageSmoothingQuality")],xe.prototype,"smoothLevel",void 0),pe([fe("globalAlpha")],xe.prototype,"opacity",void 0),pe([fe()],xe.prototype,"fillStyle",void 0),pe([fe()],xe.prototype,"strokeStyle",void 0),pe([fe("lineWidth")],xe.prototype,"strokeWidth",void 0),pe([fe("lineCap")],xe.prototype,"strokeCap",void 0),pe([fe("lineJoin")],xe.prototype,"strokeJoin",void 0),pe([fe("lineDashOffset")],xe.prototype,"dashOffset",void 0),pe([fe()],xe.prototype,"miterLimit",void 0),pe([fe()],xe.prototype,"shadowBlur",void 0),pe([fe()],xe.prototype,"shadowColor",void 0),pe([fe()],xe.prototype,"shadowOffsetX",void 0),pe([fe()],xe.prototype,"shadowOffsetY",void 0),pe([fe()],xe.prototype,"filter",void 0),pe([fe()],xe.prototype,"font",void 0),pe([fe()],xe.prototype,"fontKerning",void 0),pe([fe()],xe.prototype,"fontStretch",void 0),pe([fe()],xe.prototype,"fontVariantCaps",void 0),pe([fe()],xe.prototype,"textAlign",void 0),pe([fe()],xe.prototype,"textBaseline",void 0),pe([fe()],xe.prototype,"textRendering",void 0),pe([fe()],xe.prototype,"wordSpacing",void 0),pe([fe()],xe.prototype,"letterSpacing",void 0),pe([fe()],xe.prototype,"direction",void 0),pe([me()],xe.prototype,"setTransform",null),pe([me()],xe.prototype,"resetTransform",null),pe([me()],xe.prototype,"getTransform",null),pe([me()],xe.prototype,"save",null),pe([me()],xe.prototype,"restore",null),pe([me()],xe.prototype,"translate",null),pe([me()],xe.prototype,"scale",null),pe([me()],xe.prototype,"rotate",null),pe([me()],xe.prototype,"fill",null),pe([me()],xe.prototype,"stroke",null),pe([me()],xe.prototype,"clip",null),pe([me()],xe.prototype,"fillRect",null),pe([me()],xe.prototype,"strokeRect",null),pe([me()],xe.prototype,"clearRect",null),pe([me()],xe.prototype,"beginPath",null),pe([me()],xe.prototype,"moveTo",null),pe([me()],xe.prototype,"lineTo",null),pe([me()],xe.prototype,"bezierCurveTo",null),pe([me()],xe.prototype,"quadraticCurveTo",null),pe([me()],xe.prototype,"closePath",null),pe([me()],xe.prototype,"arc",null),pe([me()],xe.prototype,"arcTo",null),pe([me()],xe.prototype,"ellipse",null),pe([me()],xe.prototype,"rect",null),pe([me()],xe.prototype,"roundRect",null),pe([me()],xe.prototype,"createConicGradient",null),pe([me()],xe.prototype,"createLinearGradient",null),pe([me()],xe.prototype,"createPattern",null),pe([me()],xe.prototype,"createRadialGradient",null),pe([me()],xe.prototype,"fillText",null),pe([me()],xe.prototype,"measureText",null),pe([me()],xe.prototype,"strokeText",null);const{copy:we,multiplyParent:be,pixelScale:Ee}=J,{round:Se}=Math,Pe=new Gt,Be=new Gt,ke={width:1,height:1,pixelRatio:1},Te=["width","height","pixelRatio"];class Ce extends xe{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=ke),this.manager=e,this.innerId=x.create(x.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||m.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;_.copyAttrs(s,t,Te),Te.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Gt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,r=this.worldTransform;e&&be(t,e,r),Ee(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=Se(r.e-.5)+.5,r.f=Se(r.f-.5)+.5):(r.e=Se(r.e),r.f=Se(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:a,miterLimit:o}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),r(e.dashPattern)||(n=e.dashPattern),r(e.dashOffset)||(a=e.dashOffset),e.miterLimit&&(o=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=a,this.miterLimit=o}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,r=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,r),i?(this.setTempPixelBounds2(i,r),i=Be):i=Pe,this.drawImage(t.view,Pe.x,Pe.y,Pe.width,Pe.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Xt.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),this.drawImage(t.view,Pe.x,Pe.y,Pe.width,Pe.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,r,n=!0){this.resetTransform(),this.copyWorld(t,e,i,s,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(Pe.x,Pe.y,Pe.width,Pe.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,Pe.x,Pe.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Pe.x,Pe.y,Pe.width,Pe.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Pe.x,Pe.y,Pe.width,Pe.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Pe.x,Pe.y,Pe.width,Pe.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Pe.x,Pe.y,Pe.width,Pe.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Pe,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Be,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,r=this.manager?this.manager.get(i):ae.canvas(Object.assign({},i));return r.save(),t&&(we(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==s&&(r.pixelSnap=s),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Re={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Le={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ae=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Le),De={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Oe={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Ie=Object.assign(Object.assign({},Oe),Le),Fe=Ae,Me={};for(let t in Fe)Me[Fe[t]]=t;const We={};for(let t in Fe)We[Fe[t]]=De[t];const Ue={drawRoundRect(t,e,i,s,r,n){const a=M.fourNumber(n,Math.min(s/2,r/2)),o=e+s,h=i+r;a[0]?t.moveTo(e+a[0],i):t.moveTo(e,i),a[1]?t.arcTo(o,i,o,h,a[1]):t.lineTo(o,i),a[2]?t.arcTo(o,h,e,h,a[2]):t.lineTo(o,h),a[3]?t.arcTo(e,h,e,i,a[3]):t.lineTo(e,h),a[0]?t.arcTo(e,i,o,i,a[0]):t.lineTo(e,i)}},{sin:Ne,cos:ze,hypot:Ye,atan2:Xe,ceil:He,abs:je,PI:Ve,sqrt:Ge,pow:qe}=Math,{setPoint:Ke,addPoint:Ze}=mt,{set:Qe,toNumberPoints:Je}=lt,{M:$e,L:ti,C:ei,Q:ii,Z:si}=Ae,ri={},ni={points(t,e,i,s){let r=Je(e);if(t.push($e,r[0],r[1]),i&&r.length>5){let e,n,a,o,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===i?.5:i;s&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let i=2;i<y-2;i+=2)e=r[i-2],n=r[i-1],a=r[i],o=r[i+1],h=r[i+2],l=r[i+3],p=Ge(qe(a-e,2)+qe(o-n,2)),g=Ge(qe(h-a,2)+qe(l-o,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=n,d=a-p*h,c=o-p*l,2===i?s||t.push(ii,d,c,a,o):t.push(ei,u,_,d,c,a,o),u=a+g*h,_=o+g*l);s||t.push(ii,u,_,r[y-2],r[y-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push(ti,r[e],r[e+1]);s&&t.push(si)},rect(t,e,i,s,r){Re.creator.path=t,Re.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){Re.creator.path=[],Ue.drawRoundRect(Re.creator,e,i,s,r,n),t.push(...Re.convertToCanvasData(Re.creator.path,!0))},arcTo(t,e,i,s,r,n,a,o,h,l,d){const c=s-e,u=r-i,_=n-s,p=a-r;let g=Xe(u,c),f=Xe(p,_);const y=Ye(c,u),m=Ye(_,p);let v=f-g;if(v<0&&(v+=N),y<1e-12||m<1e-12||v<1e-12||je(v-Ve)<1e-12)return t&&t.push(ti,s,r),h&&(Ke(h,e,i),Ze(h,s,r)),d&&Qe(d,e,i),void(l&&Qe(l,s,r));const x=c*p-_*u<0,w=x?-1:1,b=o/ze(v/2),E=s+b*ze(g+v/2+z*w),S=r+b*Ne(g+v/2+z*w);return g-=z*w,f-=z*w,hi(t,E,S,o,o,0,g/U,f/U,x,h,l,d)},arc:(t,e,i,s,r,n,a,o,h,l)=>hi(t,e,i,s,s,0,r,n,a,o,h,l),ellipse(t,e,i,s,r,n,a,o,h,l,d,c){const u=n*U,_=Ne(u),p=ze(u);let g=a*U,f=o*U;g>Ve&&(g-=N),f<0&&(f+=N);let y=f-g;y<0?y+=N:y>N&&(y-=N),h&&(y-=N);const m=He(je(y/z)),v=y/m,x=Ne(v/4),w=8/3*x*x/Ne(v/2);f=g+v;let b,E,S,P,B,k,T,C,R=ze(g),L=Ne(g),A=S=p*s*R-_*r*L,D=P=_*s*R+p*r*L,O=e+S,I=i+P;t&&t.push(t.length?ti:$e,O,I),l&&Ke(l,O,I),c&&Qe(c,O,I);for(let n=0;n<m;n++)b=ze(f),E=Ne(f),S=p*s*b-_*r*E,P=_*s*b+p*r*E,B=e+A-w*(p*s*L+_*r*R),k=i+D-w*(_*s*L-p*r*R),T=e+S+w*(p*s*E+_*r*b),C=i+P+w*(_*s*E-p*r*b),t&&t.push(ei,B,k,T,C,e+S,i+P),l&&oi(e+A,i+D,B,k,T,C,e+S,i+P,l,!0),A=S,D=P,R=b,L=E,g=f,f+=v;d&&Qe(d,e+S,i+P)},quadraticCurveTo(t,e,i,s,r,n,a){t.push(ei,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(a+2*r)/3,n,a)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,a,o){oi(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,a,o)},toTwoPointBounds(t,e,i,s,r,n,a,o,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,x=i,w=r,b=a;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=n,b=o),c=-3*v+9*x-9*w+3*b,u=6*v-12*x+6*w,_=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Ze(h,t,e):Ke(h,t,e),Ze(h,a,o);for(let l=0,c=d.length;l<c;l++)ai(d[l],t,e,i,s,r,n,a,o,ri),Ze(h,ri.x,ri.y)},getPointAndSet(t,e,i,s,r,n,a,o,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*o,l.y=c*i+u*r+_*a+p*h},getPoint(t,e,i,s,r,n,a,o,h){const l={};return ai(t,e,i,s,r,n,a,o,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)}},{getPointAndSet:ai,toTwoPointBounds:oi,ellipse:hi}=ni,{sin:li,cos:di,sqrt:ci,atan2:ui}=Math,{ellipse:_i}=ni,pi={ellipticalArc(t,e,i,s,r,n,a,o,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=n*U,p=li(_),g=di(_),f=-g*c-p*u,y=-g*u+p*c,v=s*s,x=r*r,w=y*y,b=f*f,E=v*x-v*w-x*b;let S=0;if(E<0){const t=ci(1-E/(v*x));s*=t,r*=t}else S=(a===o?-1:1)*ci(E/(v*w+x*b));const P=S*s*y/r,B=-S*r*f/s,k=ui((y-B)/r,(f-P)/s),T=ui((-y-B)/r,(-f-P)/s);let C=T-k;0===o&&C>0?C-=N:1===o&&C<0&&(C+=N);const R=e+c+g*P-p*B,L=i+u+p*P+g*B,A=C<0?1:0;d||m.ellipseToCurve?_i(t,R,L,s,r,n,k/U,T/U,A):s!==r||n?t.push(Ae.G,R,L,s,r,n,k/U,T/U,A):t.push(Ae.O,R,L,s,k/U,T/U,A)}},gi={toCommand:t=>[],toNode:t=>[]},{M:fi,m:yi,L:mi,l:vi,H:xi,h:wi,V:bi,v:Ei,C:Si,c:Pi,S:Bi,s:ki,Q:Ti,q:Ci,T:Ri,t:Li,A:Ai,a:Di,Z:Oi,z:Ii,N:Fi,D:Mi,X:Wi,G:Ui,F:Ni,O:zi,P:Yi,U:Xi}=Ae,{rect:Hi,roundRect:ji,arcTo:Vi,arc:Gi,ellipse:qi,quadraticCurveTo:Ki}=ni,{ellipticalArc:Zi}=pi,Qi=Jt.get("PathConvert"),Ji={},$i={current:{dot:0},stringify(t,e){let i,s,r,n=0,a=t.length,o="";for(;n<a;){s=t[n],i=We[s],o+=s===r?" ":Me[s];for(let s=1;s<i;s++)o+=M.float(t[n+s],e),s===i-1||(o+=" ");r=s,n+=i}return o},parse(t,e){let i,s,r,n="";const a=[],o=e?Ie:Oe;for(let e=0,h=t.length;e<h;e++)s=t[e],Zt[s]?("."===s&&(ts.dot&&(es(a,n),n=""),ts.dot++),"0"===n&&"."!==s&&(es(a,n),n=""),n+=s):Ae[s]?(n&&(es(a,n),n=""),ts.name=Ae[s],ts.length=De[s],ts.index=0,es(a,ts.name),!i&&o[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&es(a,n),n=s):n&&(es(a,n),n=""),r=s;return n&&es(a,n),i?$i.toCanvasData(a,e):a},toCanvasData(t,e){let i,s,r,n,a,o=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case yi:t[c+1]+=o,t[c+2]+=h;case fi:o=t[c+1],h=t[c+2],_.push(fi,o,h),c+=3;break;case wi:t[c+1]+=o;case xi:o=t[c+1],_.push(mi,o,h),c+=2;break;case Ei:t[c+1]+=h;case bi:h=t[c+1],_.push(mi,o,h),c+=2;break;case vi:t[c+1]+=o,t[c+2]+=h;case mi:o=t[c+1],h=t[c+2],_.push(mi,o,h),c+=3;break;case ki:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Bi;case Bi:a=n===Si||n===Bi,l=a?2*o-i:t[c+1],d=a?2*h-s:t[c+2],i=t[c+1],s=t[c+2],o=t[c+3],h=t[c+4],_.push(Si,l,d,i,s,o,h),c+=5;break;case Pi:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,t[c+5]+=o,t[c+6]+=h,r=Si;case Si:i=t[c+3],s=t[c+4],o=t[c+5],h=t[c+6],_.push(Si,t[c+1],t[c+2],i,s,o,h),c+=7;break;case Li:t[c+1]+=o,t[c+2]+=h,r=Ri;case Ri:a=n===Ti||n===Ri,i=a?2*o-i:t[c+1],s=a?2*h-s:t[c+2],e?Ki(_,o,h,i,s,t[c+1],t[c+2]):_.push(Ti,i,s,t[c+1],t[c+2]),o=t[c+1],h=t[c+2],c+=3;break;case Ci:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Ti;case Ti:i=t[c+1],s=t[c+2],e?Ki(_,o,h,i,s,t[c+3],t[c+4]):_.push(Ti,i,s,t[c+3],t[c+4]),o=t[c+3],h=t[c+4],c+=5;break;case Di:t[c+6]+=o,t[c+7]+=h;case Ai:Zi(_,o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),o=t[c+6],h=t[c+7],c+=8;break;case Ii:case Oi:_.push(Oi),c++;break;case Fi:o=t[c+1],h=t[c+2],e?Hi(_,o,h,t[c+3],t[c+4]):is(_,t,c,5),c+=5;break;case Mi:o=t[c+1],h=t[c+2],e?ji(_,o,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):is(_,t,c,9),c+=9;break;case Wi:o=t[c+1],h=t[c+2],e?ji(_,o,h,t[c+3],t[c+4],t[c+5]):is(_,t,c,6),c+=6;break;case Ui:qi(e?_:is(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Ji),o=Ji.x,h=Ji.y,c+=9;break;case Ni:e?qi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):is(_,t,c,5),o=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case zi:Gi(e?_:is(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ji),o=Ji.x,h=Ji.y,c+=7;break;case Yi:e?Gi(_,t[c+1],t[c+2],t[c+3],0,360,!1):is(_,t,c,4),o=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Xi:Vi(e?_:is(_,t,c,6),o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ji),o=Ji.x,h=Ji.y,c+=6;break;default:return Qi.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return gi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(fi,t.x,t.y);break;case"L":e.push(mi,t.x,t.y);break;case"C":e.push(Si,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ti,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Oi)}}),e}},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){ts.index===ts.length&&(ts.index=1,t.push(ts.name)),t.push(Number(e)),ts.index++,ts.dot=0}},{current:ts,pushData:es,copyData:is}=$i,{M:ss,L:rs,C:ns,Q:as,Z:os,N:hs,D:ls,X:ds,G:cs,F:us,O:_s,P:ps,U:gs}=Ae,{getMinDistanceFrom:fs,getRadianFrom:ys}=lt,{tan:ms,min:vs,abs:xs}=Math,ws={},bs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(ss,e,i)},lineTo(t,e,i){t.push(rs,e,i)},bezierCurveTo(t,e,i,s,r,n,a){t.push(ns,e,i,s,r,n,a)},quadraticCurveTo(t,e,i,s,r){t.push(as,e,i,s,r)},closePath(t){t.push(os)},rect(t,e,i,s,r){t.push(hs,e,i,s,r)},roundRect(t,e,i,s,r,n){if(h(n))t.push(ds,e,i,s,r,n);else{const a=M.fourNumber(n);a?t.push(ls,e,i,s,r,...a):t.push(hs,e,i,s,r)}},ellipse(t,e,i,s,r,a,o,h,l){n(a)?t.push(us,e,i,s,r):(n(o)&&(o=0),n(h)&&(h=360),t.push(cs,e,i,s,r,a,o,h,l?1:0))},arc(t,e,i,s,r,a,o){n(r)?t.push(ps,e,i,s):(n(a)&&(a=360),t.push(_s,e,i,s,r,a,o?1:0))},arcTo(t,e,i,s,n,a,o,h){if(!r(o)){const t=fs(o,h,e,i,s,n);a=vs(a,vs(t/2,t/2*xs(ms(ys(o,h,e,i,s,n)/2))))}t.push(gs,e,i,s,n,a)},drawEllipse(t,e,i,s,r,a,o,h,l){ni.ellipse(null,e,i,s,r,n(a)?0:a,n(o)?0:o,n(h)?360:h,l,null,null,ws),t.push(ss,ws.x,ws.y),Es(t,e,i,s,r,a,o,h,l)},drawArc(t,e,i,s,r,a,o){ni.arc(null,e,i,s,n(r)?0:r,n(a)?360:a,o,null,null,ws),t.push(ss,ws.x,ws.y),Ss(t,e,i,s,r,a,o)},drawPoints(t,e,i,s){ni.points(t,e,i,s)}},{ellipse:Es,arc:Ss}=bs,{moveTo:Ps,lineTo:Bs,quadraticCurveTo:ks,bezierCurveTo:Ts,closePath:Cs,beginPath:Rs,rect:Ls,roundRect:As,ellipse:Ds,arc:Os,arcTo:Is,drawEllipse:Fs,drawArc:Ms,drawPoints:Ws}=bs;class Us{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?Re.parse(t):t:[],this}beginPath(){return Rs(this.__path),this.paint(),this}moveTo(t,e){return Ps(this.__path,t,e),this.paint(),this}lineTo(t,e){return Bs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return Ts(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return ks(this.__path,t,e,i,s),this.paint(),this}closePath(){return Cs(this.__path),this.paint(),this}rect(t,e,i,s){return Ls(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return As(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,a,o){return Ds(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}arc(t,e,i,s,r,n){return Os(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return Is(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,a,o){return Fs(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}drawArc(t,e,i,s,r,n){return Ms(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return Ws(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ns,L:zs,C:Ys,Q:Xs,Z:Hs,N:js,D:Vs,X:Gs,G:qs,F:Ks,O:Zs,P:Qs,U:Js}=Ae,$s=Jt.get("PathDrawer"),tr={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Ns:t.moveTo(e[s+1],e[s+2]),s+=3;break;case zs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ys:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Xs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Hs:t.closePath(),s+=1;break;case js:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Vs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Gs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*U,e[s+6]*U,e[s+7]*U,e[s+8]),s+=9;break;case Ks:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,N,!1),s+=5;break;case Zs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*U,e[s+5]*U,e[s+6]),s+=7;break;case Qs:t.arc(e[s+1],e[s+2],e[s+3],0,N,!1),s+=4;break;case Js:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void $s.error(`command: ${i} [index:${s}]`,e)}}},{M:er,L:ir,C:sr,Q:rr,Z:nr,N:ar,D:or,X:hr,G:lr,F:dr,O:cr,P:ur,U:_r}=Ae,{toTwoPointBounds:pr,toTwoPointBoundsByQuadraticCurve:gr,arcTo:fr,arc:yr,ellipse:mr}=ni,{addPointBounds:vr,copy:xr,addPoint:wr,setPoint:br,addBounds:Er,toBounds:Sr}=mt,Pr=Jt.get("PathBounds");let Br,kr,Tr;const Cr={},Rr={},Lr={},Ar={toBounds(t,e){Ar.toTwoPointBounds(t,Rr),Sr(Rr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return br(e,0,0);let i,s,r,n,a,o=0,h=0,l=0;const d=t.length;for(;o<d;)switch(a=t[o],0===o&&(a===nr||a===sr||a===rr?br(e,h,l):br(e,t[o+1],t[o+2])),a){case er:case ir:h=t[o+1],l=t[o+2],wr(e,h,l),o+=3;break;case sr:r=t[o+5],n=t[o+6],pr(h,l,t[o+1],t[o+2],t[o+3],t[o+4],r,n,Cr),vr(e,Cr),h=r,l=n,o+=7;break;case rr:i=t[o+1],s=t[o+2],r=t[o+3],n=t[o+4],gr(h,l,i,s,r,n,Cr),vr(e,Cr),h=r,l=n,o+=5;break;case nr:o+=1;break;case ar:h=t[o+1],l=t[o+2],Er(e,h,l,t[o+3],t[o+4]),o+=5;break;case or:case hr:h=t[o+1],l=t[o+2],Er(e,h,l,t[o+3],t[o+4]),o+=a===or?9:6;break;case lr:mr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],t[o+7],t[o+8],Cr,Lr),0===o?xr(e,Cr):vr(e,Cr),h=Lr.x,l=Lr.y,o+=9;break;case dr:h=t[o+1],l=t[o+2],kr=t[o+3],Tr=t[o+4],Er(e,h-kr,l-Tr,2*kr,2*Tr),h+=kr,o+=5;break;case cr:yr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],Cr,Lr),0===o?xr(e,Cr):vr(e,Cr),h=Lr.x,l=Lr.y,o+=7;break;case ur:h=t[o+1],l=t[o+2],Br=t[o+3],Er(e,h-Br,l-Br,2*Br,2*Br),h+=Br,o+=4;break;case _r:fr(null,h,l,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],Cr,Lr),0===o?xr(e,Cr):vr(e,Cr),h=Lr.x,l=Lr.y,o+=6;break;default:return void Pr.error(`command: ${a} [index:${o}]`,t)}}},{M:Dr,L:Or,Z:Ir}=Ae,{getCenterX:Fr,getCenterY:Mr}=lt,{arcTo:Wr}=bs,Ur={smooth(t,e,i){let s,r,n,a=0,o=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;a<g;){switch(s=t[a],s){case Dr:l=_=t[a+1],d=p=t[a+2],a+=3,t[a]===Or?(c=t[a+1],u=t[a+2],f.push(Dr,Fr(l,c),Mr(d,u))):f.push(Dr,l,d);break;case Or:switch(o=t[a+1],h=t[a+2],a+=3,t[a]){case Or:Wr(f,o,h,t[a+1],t[a+2],e,_,p);break;case Ir:Wr(f,o,h,l,d,e,_,p);break;default:f.push(Or,o,h)}_=o,p=h;break;case Ir:r!==Ir&&(Wr(f,l,d,c,u,e,_,p),f.push(Ir)),a+=1;break;default:n=We[s];for(let e=0;e<n;e++)f.push(t[a+e]);a+=n}r=s}return s!==Ir&&(f[1]=l,f[2]=d),f}};function Nr(t){return new Us(t)}const zr=Nr();Re.creator=Nr(),Re.parse=$i.parse,Re.convertToCanvasData=$i.toCanvasData;const{drawRoundRect:Yr}=Ue;function Xr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){Yr(this,t,e,i,s,r)})}(t)}const Hr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=jr.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},jr=Hr;jr.alphaPixelTypes.forEach(t=>jr.upperCaseTypeMap[t]=t.toUpperCase());const Vr=Jt.get("TaskProcessor");class Gr{constructor(t){this.parallel=!0,this.time=1,this.id=x.create(x.TASK),this.task=t}run(){return ge(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Vr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class qr{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&_.assign(this.config,t),this.empty()}add(t,e,i){let s,n,a,o;const l=new Gr(t);return l.parent=this,h(e)?o=e:e&&(n=e.parallel,s=e.start,a=e.time,o=e.delay,i||(i=e.canUse)),a&&(l.time=a),!1===n&&(l.parallel=!1),i&&(l.canUse=i),r(o)?this.push(l,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,s))},o)),this.isComplete=!1,l}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=s+e.parallel;if(r>i.length&&(r=i.length),e.parallel>1)for(let e=s;e<r&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Kr=Jt.get("Resource"),Zr={tasker:new qr,map:{},get isComplete(){return Qr.tasker.isComplete},set(t,e){Qr.map[t]&&Kr.repeat(t),Qr.map[t]=e},get:t=>Qr.map[t],remove(t){const e=Qr.map[t];e&&(e.destroy&&e.destroy(),delete Qr.map[t])},loadImage(t,e){return new Promise((i,s)=>{const r=this.setImage(t,t,e);r.load(()=>i(r),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ae.image(s)),Qr.set(t,e),e},destroy(){Qr.map={}}},Qr=Zr,Jr={maxRecycled:10,recycledList:[],patternTasker:new qr,get(t){let e=Zr.get(t.url);return e||Zr.set(t.url,e=ae.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(m.image.isLarge(t)?t.url&&Zr.remove(t.url):(t.clearLevels(),$r.recycledList.push(t)))})},recyclePaint(t){$r.recycle(t.image)},clearRecycled(t){const e=$r.recycledList;(e.length>$r.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&Zr.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Hr.alphaPixelTypes.some(e=>$r.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Hr.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Hr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},$r=Jr,{IMAGE:tn,create:en}=x;class sn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=en(tn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Jr.isFormat("svg",t)&&(this.isSVG=!0),Jr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;Zr.tasker.add(()=>ge(this,void 0,void 0,function*(){return yield m.origin.loadImage(this.url,r(t)?m.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,r,n,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const o=m.image.resize(this.view,t,e,r,n,void 0,a,i,s);return this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(t,e,i,s){const r=m.canvas.createPattern(t,e);return m.image.setPatternTransform(r,i,s),r}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function rn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function nn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function an(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function on(t,e){return(i,s)=>ln(i,s,t,e&&e(s))}function hn(t){return t}function ln(t,e,i,s){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};rn(t,e,Object.assign(r,s||{})),Mn(t,e,i)}function dn(t){return on(t)}function cn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function un(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function _n(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),mn(this))}}))}function pn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function gn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function fn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&mn(this)}}))}function yn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(mn(this),this.__.__removeNaturalSize())}}))}function mn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function vn(t){return on(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),mn(this)}}))}const xn=fn;function wn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i)&&(bn(this),e&&(this.__.__useStroke=!0))}}))}function bn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&mn(t)}const En=wn;function Sn(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Pn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Bn(t){return on(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;_.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function kn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Cn(this)}}))}function Tn(t){return on(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Rn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Rn(this,t,e,i),this.mask&&Cn(this)}}))}function Cn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Rn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||mn(t))}function Ln(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function An(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Dn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function On(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Jt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function In(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Fn(t){return(e,i)=>{rn(e,"__DataProcessor",{get:()=>t})}}function Mn(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,a=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o=an(e,i);if(r(i))o.get=function(){return this[n]};else if("function"==typeof i)o.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(c(i)){const t=u(i);o.get=function(){const e=this[n];return null==e?this[n]=t?{}:_.clone(i):e}}const h=t.isBranchLeaf;"width"===e?o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=nn(d,e),d=d.__proto__;l&&l.set&&(o.set=l.set),s[a]&&(o.set=s[a],delete s[a]),rn(s,e,o)}const Wn=new Jt("rewrite"),Un=[],Nn=["destroy","constructor"];function zn(t){return(e,i)=>{Un.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Yn(){return t=>{Xn()}}function Xn(t){Un.length&&(Un.forEach(e=>{t&&Wn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Un.length=0)}function Hn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Nn.includes(s)||e&&e.includes(s)))if(t.prototype){nn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function jn(){return t=>{he.register(t)}}function Vn(){return t=>{ce.register(t)}}setTimeout(()=>Xn(!0));const{copy:Gn,toInnerPoint:qn,toOuterPoint:Kn,scaleOfOuter:Zn,rotateOfOuter:Qn,skewOfOuter:Jn,multiplyParent:$n,divideParent:ta,getLayout:ea}=J,ia={},{round:sa}=Math,ra={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),oa(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)aa(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ha(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&ha(t),t.__updateChange()},updateAllChange(t){if(da(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)la(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,r,n){s||(s=t.__nowWorld),t.__worldFlipped||m.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,r,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,r){const n=c(e)?Object.assign({},e):{x:e,y:i};s?Kn(t.localTransform,n,n,!0):t.parent&&qn(t.parent.scrollWorldTransform,n,n,!0),na.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,i=0,s){c(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=sa(e),i=sa(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,n){na.zoomOfLocal(t,ca(t,e),i,s,r,n)},zoomOfLocal(t,e,i,s=i,r,n){const a=t.__localMatrix;if(h(s)||(s&&(n=s),s=i),Gn(ia,a),Zn(ia,e,i,s),na.hasHighPosition(t))na.setTransform(t,ia,r,n);else{const e=t.x+ia.e-a.e,o=t.y+ia.f-a.f;n&&!r?t.animate({x:e,y:o,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=o,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){na.rotateOfLocal(t,ca(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;Gn(ia,r),Qn(ia,e,i),na.hasHighPosition(t)?na.setTransform(t,ia,!1,s):t.set({x:t.x+ia.e-r.e,y:t.y+ia.f-r.f,rotation:M.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,n){na.skewOfLocal(t,ca(t,e),i,s,r,n)},skewOfLocal(t,e,i,s=0,r,n){Gn(ia,t.__localMatrix),Jn(ia,e,i,s),na.setTransform(t,ia,r,n)},transformWorld(t,e,i,s){Gn(ia,t.worldTransform),$n(ia,e),t.parent&&ta(ia,t.parent.scrollWorldTransform),na.setTransform(t,ia,i,s)},transform(t,e,i,s){Gn(ia,t.localTransform),$n(ia,e),na.setTransform(t,ia,i,s)},setTransform(t,e,i,s){const r=t.__,n=r.origin&&na.getInnerOrigin(t,r.origin),a=ea(e,n,r.around&&na.getInnerOrigin(t,r.around));if(na.hasOffset(t)&&(a.x-=r.offsetX,a.y-=r.offsetY),i){const e=a.scaleX/t.scaleX,i=a.scaleY/t.scaleY;if(delete a.scaleX,delete a.scaleY,n){Xt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=na.getInnerOrigin(t,r.origin);lt.move(a,n.x-s.x,n.y-s.y)}t.set(a),t.scaleResize(e,i,!1)}else t.set(a,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Zn(i,na.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>lt.tempToOuterOf(na.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Et.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Gn(ia,t.worldTransform),ta(ia,e.scrollWorldTransform),i?ia:Object.assign({},ia)),drop(t,e,i,s){t.setTransform(na.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||na.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,r=e.y*i;e.x-=s,e.y-=r,t.move(s,r),m.requestRender(()=>na.animateMove(t,e,i))}}},na=ra,{updateAllMatrix:aa,updateMatrix:oa,updateAllWorldOpacity:ha,updateAllChange:la,updateChange:da}=na;function ca(t,e){return t.updateLayout(),t.parent?lt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const ua={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>pa(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>pa(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>pa(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let _a;function pa(t,e){return e||(_a=0),t.__.mask&&(_a=1),_a<0?null:(_a&&(_a=-1),!0)}const{updateBounds:ga}=ra,fa={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,r=i.length;s<r;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),ya(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&r(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)ma(e[t],e)},updateBounds(t,e){const i=[t];ma(t,i),va(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let r=t.length-1;r>-1;r--){i=t[r],s=i.children;for(let t=0,e=s.length;t<e;t++)ga(s[t]);e&&e===i||ga(i)}}},{pushAllChildBranch:ya,pushAllBranchStack:ma,updateBoundsByBranchStack:va}=fa,xa={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:wa,updateBounds:ba}=ra,{toOuterOf:Ea,getPoints:Sa,copy:Pa}=Xt,Ba="_localContentBounds",ka="_worldContentBounds",Ta="_worldBoxBounds",Ca="_worldStrokeBounds";class Ra{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return Ea(this.contentBounds,this.leaf.__localMatrix,this[Ba]||(this[Ba]={})),this[Ba]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Ea(this.contentBounds,this.leaf.__world,this[ka]||(this[ka]={})),this[ka]}get worldBoxBounds(){return Ea(this.boxBounds,this.leaf.__world,this[Ta]||(this[Ta]={})),this[Ta]}get worldStrokeBounds(){return Ea(this.strokeBounds,this.leaf.__world,this[Ca]||(this[Ca]={})),this[Ca]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return ba(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,m.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return J.defaultMatrix;case"page":t=e.zoomLayer;default:return wa(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Gt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let r,n,a,o=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(o),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;a={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(o);break;case"inner":r=o,n=J.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(o,e),n=wa(s,e,!0)}if(a||(a=J.getLayout(n)),Pa(a,o),lt.copy(a,r),i){const{scaleX:t,scaleY:e}=a,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(a.scaleX/=i,a.scaleY/=s,a.width*=i,a.height*=s)}return a}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Sa(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return r(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class La{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&m.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&m.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&m.event.stop(this.origin)}}class Aa extends La{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Aa.ADD="child.add",Aa.REMOVE="child.remove",Aa.CREATED="created",Aa.MOUNTED="mounted",Aa.UNMOUNTED="unmounted",Aa.DESTROY="destroy";const Da="property.scroll";class Oa extends La{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}}Oa.CHANGE="property.change",Oa.LEAFER_CHANGE="property.leafer_change",Oa.SCROLL=Da;const Ia={scrollX:Da,scrollY:Da};class Fa extends La{constructor(t,e){super(t),Object.assign(this,e)}}Fa.LOAD="image.load",Fa.LOADED="image.loaded",Fa.ERROR="image.error";class Ma extends La{static checkHas(t,e,i){"on"===i?e===za?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Wa)||t.hasEvent(Ua)||t.hasEvent(Na),t.__hasWorldEvent=t.hasEvent(za))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Wa,t),"inner"===e&&t.emit(Ua,t)),t.emit(Na,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(za,this)}}Ma.RESIZE="bounds.resize",Ma.INNER="bounds.inner",Ma.LOCAL="bounds.local",Ma.WORLD="bounds.world";const{RESIZE:Wa,INNER:Ua,LOCAL:Na,WORLD:za}=Ma,Ya={};[Wa,Ua,Na,za].forEach(t=>Ya[t]=1);class Xa extends La{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){c(t)?(super(Xa.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!r(this.resizingKeys[t.innerId])}}Xa.RESIZE="resize";class Ha extends La{constructor(t,e){super(t),this.data=e}}Ha.REQUEST="watch.request",Ha.DATA="watch.data";class ja extends La{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}ja.REQUEST="layout.request",ja.START="layout.start",ja.BEFORE="layout.before",ja.LAYOUT="layout",ja.AFTER="layout.after",ja.AGAIN="layout.again",ja.END="layout.end";class Va extends La{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Va.REQUEST="render.request",Va.CHILD_START="render.child_start",Va.CHILD_END="render.child_end",Va.START="render.start",Va.BEFORE="render.before",Va.RENDER="render",Va.AFTER="render.after",Va.AGAIN="render.again",Va.END="render.end",Va.NEXT="render.next";class Ga extends La{}Ga.START="leafer.start",Ga.BEFORE_READY="leafer.before_ready",Ga.READY="leafer.ready",Ga.AFTER_READY="leafer.after_ready",Ga.VIEW_READY="leafer.view_ready",Ga.VIEW_COMPLETED="leafer.view_completed",Ga.STOP="leafer.stop",Ga.RESTART="leafer.restart",Ga.END="leafer.end",Ga.UPDATE_MODE="leafer.update_mode",Ga.TRANSFORM="leafer.transform",Ga.MOVE="leafer.move",Ga.SCALE="leafer.scale",Ga.ROTATE="leafer.rotate",Ga.SKEW="leafer.skew";const{MOVE:qa,SCALE:Ka,ROTATE:Za,SKEW:Qa}=Ga,Ja={x:qa,y:qa,scaleX:Ka,scaleY:Ka,rotation:Za,skewX:Qa,skewY:Qa},$a={};class to{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,r,n;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const o=eo(this,s,!0),h=a(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(n=o[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(l):o[t]=[l],Ya[t]&&Ma.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,r,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const a=eo(this,t);s.forEach(t=>{t&&(r=a[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete a[t],Ya[t]&&Ma.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ce.has(t)&&(e=ce.get(t,{type:t,target:this,current:this}));const s=eo(this,i)[t];if(s){let r;for(let n=0,a=s.length;n<a&&!((r=s[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),n--,a--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],a=s&&s[t];return!!(r(e)?n||a:e?a:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function eo(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:$a)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:$a)}}const{on:io,on_:so,off:ro,off_:no,once:ao,emit:oo,emitEvent:ho,hasEvent:lo,destroy:co}=to.prototype,uo={on:io,on_:so,off:ro,off_:no,once:ao,emit:oo,emitEvent:ho,hasEvent:lo,destroyEventer:co},_o=Jt.get("setAttr"),po={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||o(e)||r(e)||(_o.warn(this.innerName,t,e),e=void 0),c(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Oa(Oa.LEAFER_CHANGE,this,t,s,e));const i=Ja[t];i&&(this.emitEvent(new Ga(i,this)),this.emitEvent(new Ga(Ga.TRANSFORM,this)))}this.emitPropertyEvent(Oa.CHANGE,t,s,e);const i=Ia[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const r=new Oa(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||r(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:go,multiplyParent:fo,translateInner:yo,defaultWorld:mo}=J,{toPoint:vo,tempPoint:xo}=Et,wo={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:r}=this;fo(this.__local||e,t?t.__scrollWorld||t.__world:mo,i,!!e.affectScaleOrRotation,r),s&&yo(Object.assign(s,i),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(go(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(vo(i.around||i.origin,t.boxBounds,xo),yo(e,-xo.x,-xo.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:bo,updateAllMatrix:Eo}=ra,{updateBounds:So}=fa,{toOuterOf:Po,copyAndSpread:Bo,copy:ko}=Xt,{toBounds:To}=Ar,Co={__updateWorldBounds(){const{__layout:t,__world:e}=this;Po(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Ma.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Ma.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Po(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Po(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Po(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?To(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Eo(this),So(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Eo(this),So(this,this))):bo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Bo(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;h(i)&&i<=0?ko(e.renderBounds,e.strokeBounds):Bo(e.renderBounds,e.boxBounds,i)}},Ro={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),ra.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Jt.showBounds&&Jt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Lo}=ua,Ao={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,r,r,i.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Lo(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Lo(i[s],e)||i[s].__clip(t,e)}}},Do={},{LEAF:Oo,create:Io}=x,{stintSet:Fo}=_,{toInnerPoint:Mo,toOuterPoint:Wo,multiplyParent:Uo}=J,{toOuterOf:No}=Xt,{copy:zo,move:Yo}=lt,{moveLocal:Xo,zoomOfLocal:Ho,rotateOfLocal:jo,skewOfLocal:Vo,moveWorld:Go,zoomOfWorld:qo,rotateOfWorld:Ko,skewOfWorld:Zo,transform:Qo,transformWorld:Jo,setTransform:$o,getFlipTransform:th,getLocalOrigin:eh,getRelativeWorld:ih,drop:sh}=ra;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return g}get __LayoutProcessor(){return Ra}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Io(Oo),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Aa.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(Aa.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Aa.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(Aa.MOUNTED)):this.__emitLifeEvent(Aa.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){r(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=r(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Uo(i,t.matrix,e,void 0,i),No(this.__layout.renderBounds,e,e),Fo(e,"half",i.half),Fo(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=Jr.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Do.scaleX=i,Do.scaleY=s,Do}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?ih(this,e):this.worldTransform,r=i?t:{};return No(t,s,r),r}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&zo(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&zo(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Mo(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Wo(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return Yo(r,-n,-a),r}getInnerPoint(t,e,i,s){const r=s?t:{};return this.worldToInner(t,r,i,e),r}getInnerPointByBox(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return Yo(r,n,a),r}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const r=s?t:{};return this.worldToLocal(t,r,i,e),r}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const r=s?t:{};return this.innerToWorld(t,r,i,e),r}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const r=s?t:{};return this.localToWorld(t,r,i,e),r}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){$o(this,t,e,i)}transform(t,e,i){Qo(this,t,e,i)}move(t,e,i){Xo(this,t,e,i)}moveInner(t,e,i){Go(this,t,e,!0,i)}scaleOf(t,e,i,s,r){Ho(this,eh(this,t),e,i,s,r)}rotateOf(t,e,i){jo(this,eh(this,t),e,i)}skewOf(t,e,i,s,r){Vo(this,eh(this,t),e,i,s,r)}transformWorld(t,e,i){Jo(this,t,e,i)}moveWorld(t,e,i){Go(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){qo(this,t,e,i,s,r)}rotateOfWorld(t,e){Ko(this,t,e)}skewOfWorld(t,e,i,s,r){Zo(this,t,e,i,s,r)}flip(t,e){Qo(this,th(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return ne.need("path")}getMotionPoint(t){return ne.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){sh(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Mn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=fn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Aa(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Aa.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=pe([Hn(po),Hn(wo),Hn(Co),Hn(uo),Hn(Ro)],t.Leaf);const{setListWithFn:rh}=Xt,{sort:nh}=fa,{localBoxBounds:ah,localStrokeBounds:oh,localRenderBounds:hh,maskLocalBoxBounds:lh,maskLocalStrokeBounds:dh,maskLocalRenderBounds:ch}=ua,uh=new Jt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){rh(e||this.__layout.boxBounds,this.children,this.__hasMask?lh:ah)}__updateStrokeBounds(t){rh(t||this.__layout.strokeBounds,this.children,this.__hasMask?dh:oh)}__updateRenderBounds(t){rh(t||this.__layout.renderBounds,this.children,this.__hasMask?ch:hh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(nh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return uh.warn("add self or destroyed");const i=r(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=he.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Aa.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Aa.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):r(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Aa.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Aa.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Aa(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=pe([Hn(Ao)],t.Branch);class _h{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!r(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return r(e)?-1:e}add(t){const{list:e,keys:i}=this;r(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(r(i[t.innerId])){const{list:s}=this;for(let t=e,r=s.length;t<r;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)r(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;r(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new _h;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class ph{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!r(this.keys[t.innerId])}without(t){return r(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class gh extends Ce{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=m.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}Xr(OffscreenCanvasRenderingContext2D.prototype),Xr(Path2D.prototype);const{mineType:fh}=Hr;function yh(t,e){m.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,r)=>{t.convertToBlob({type:fh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)}).catch(t=>{r(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:fh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",m.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},m.canvas=ae.canvas(),m.conicGradientSupport=!!m.canvas.context.createConicGradient}Object.assign(ae,{canvas:(t,e)=>new gh(t,e),image:t=>new sn(t)}),m.name="web",m.isWorker=!0,m.backgrounder=!0,m.requestRender=function(t){requestAnimationFrame(t)},rn(m,"devicePixelRatio",{get:()=>1});const{userAgent:mh}=navigator;mh.indexOf("Firefox")>-1?(m.conicGradientRotate90=!0,m.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(m.fullImageShadow=!0),mh.indexOf("Windows")>-1?(m.os="Windows",m.intWheelDeltaY=!0):mh.indexOf("Mac")>-1?m.os="Mac":mh.indexOf("Linux")>-1&&(m.os="Linux");class vh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new _h;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new _h,this.target=t,e&&(this.config=_.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Va.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Aa.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Ha(Ha.DATA,{updatedList:this.updatedList})),this.__updatedList=new _h,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Oa.CHANGE,this.__onAttrChange,this],[[Aa.ADD,Aa.REMOVE],this.__onChildEvent,this],[Ha.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:xh,updateBounds:wh,updateChange:bh}=ra,{pushAllChildBranch:Eh,pushAllParent:Sh}=fa;const{worldBounds:Ph}=ua;class Bh{constructor(t){this.updatedBounds=new Gt,this.beforeBounds=new Gt,this.afterBounds=new Gt,d(t)&&(t=new _h(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ph)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ph),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:kh,updateAllChange:Th}=ra,Ch=Jt.get("Layouter");class Rh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new ph,this.target=t,e&&(this.config=_.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(ja.START),this.layoutOnce(),t.emitEvent(new ja(ja.END,this.layoutedBlocks,this.times))}catch(t){Ch.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ch.warn("layouting"):this.times>3?Ch.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Ha.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=ie.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:n,AFTER:a}=ja,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),i.emitEvent(new ja(r,o,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(xh(t,!0),e.add(t),t.isBranch&&Eh(t,e),Sh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Sh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||wh(s[t])}wh(i)}})}(this.__levelList),function(t){t.list.forEach(bh)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),i.emitEvent(new ja(n,o,this.times)),i.emitEvent(new ja(a,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,ie.end(e)}fullLayout(){const t=ie.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:r}=ja,n=this.getBlocks(new _h(e));e.emitEvent(new ja(i,n,this.times)),Rh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new ja(s,n,this.times)),e.emitEvent(new ja(r,n,this.times)),this.addBlocks(n),ie.end(t)}static fullLayout(t){kh(t,!0),t.isBranch?fa.updateBounds(t):ra.updateBounds(t),Th(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Bh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Bh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[ja.REQUEST,this.layout,this],[ja.AGAIN,this.layoutAgain,this],[Ha.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Lh=Jt.get("Renderer");class Ah{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=_.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(ja.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Va.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Va.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Va.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Gt,Lh.log(e.innerName,"---\x3e");try{this.emitRender(Va.START),this.renderOnce(t),this.emitRender(Va.END,this.totalBounds),Jr.clearRecycled()}catch(t){this.rendering=!1,Lh.error(t)}Lh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Lh.warn("rendering");if(this.times>3)return Lh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Gt,this.renderOptions={},t)this.emitRender(Va.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Va.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Va.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Va.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=ie.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),r=new Gt(s);i.save(),s.spread(Ah.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,r),i.restore(),ie.end(e)}fullRender(){const t=ie.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ie.end(t)}__render(t,e){const{canvas:i,target:s}=this,r=t.includes(s.__world),n=r?{includes:r}:{bounds:t,includes:r};this.needFill&&i.fillWorld(t,this.config.fill),Jt.showRepaint&&Jt.drawRepaint(i,t),this.config.useCellRender&&(n.cellList=this.getCellList()),m.render(s,i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Gt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return m.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};m.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Gt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Gt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Lh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Va(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Va.REQUEST,this.update,this],[ja.END,this.__onLayoutEnd,this],[Va.AGAIN,this.renderAgain,this],[Xa.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Ah.clipSpread=10;const{hitRadiusPoint:Dh}=Xt;class Oh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,r=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new _h(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:a}=this.findList,o=this.getBestMatchLeaf(a,i.bottomList,r,!!i.findList),h=r?this.getPath(o):this.getHitablePath(o);return this.clear(),s?{path:h,target:o,throughPath:a.length?this.getThroughPath(a):h}:{path:h,target:o}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const r=this.findList=new _h;if(t.length){let e;const{x:s,y:n}=this.point,a={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||ra.worldHittable(e))&&(this.hitChild(e,a),r.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ra.hasParent(t,e))){r.reset();break}return r.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),r.length)return r.list[0];return s?null:i?t[0]:t.find(t=>ra.worldHittable(t))}getPath(t){const e=new _h,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new _h;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new _h,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,r,n;for(let t=0,a=i.length;t<a;t++){s=i[t],r=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!r||!r.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:r}=this;for(let n=t.length-1;n>-1;n--)if(i=t[n],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Dh(i.__world,r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(r))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,r=[];const{children:n}=s;for(let s=0,a=n.length;s<a;s++)if(i=n[s],i.__.mask&&r.push(i),i===t){if(r&&!r.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Ih{constructor(t,e){this.config={},e&&(this.config=_.default(e,this.config)),this.picker=new Oh(this.target=t,this),this.finder=ae.finder&&ae.finder()}getByPoint(t,e,i){const{target:s,picker:r}=this;return m.backgrounder&&s&&s.updateLayout(),r.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):ne.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Fh(t){return on(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Mh(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Wh(){return(t,e)=>{const i="_"+e;rn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(ae,{watcher:(t,e)=>new vh(t,e),layouter:(t,e)=>new Rh(t,e),renderer:(t,e,i)=>new Ah(t,e,i),selector:(t,e)=>new Ih(t,e)}),m.layout=Rh.fullLayout,m.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new _h,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Uh={},Nh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},zh={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Yh={},Xh={},Hh={},jh={},Vh={},Gh={apply(){ne.need("filter")}},qh={},Kh={setStyleName:()=>ne.need("state"),set:()=>ne.need("state")},Zh={list:{},register(t,e){Zh.list[t]=e},get:t=>Zh.list[t]},{parse:Qh,objectToCanvasData:Jh}=$i,{stintSet:$h}=_,{hasTransparent:tl}=Nh,el={originPaint:{}},il=Jt.get("UIData");class sl extends g{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,il.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,il.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?($h(this,"__isTransparentFill",tl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?($h(this,"__isTransparentStroke",tl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?Qh(t):Jh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){rl(this,"shadow",t)}setInnerShadow(t){rl(this,"innerShadow",t)}setFilter(t){rl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Xh.compute("fill",this.__leaf),e&&Xh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),r(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=el)):(this.__isStrokes=!0,this._stroke||(this._stroke=el))}__removePaint(t,e){e&&this.__removeInput(t),Hh.recycleImage(t,this),"fill"===t?($h(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):($h(this,"__isAlphaPixelStroke",void 0),$h(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function rl(t,e,i){t.__setInput(e,i),d(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class nl extends sl{}class al extends nl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class ol extends nl{__getInputData(t,e){const i=super.__getInputData(t,e);return Te.forEach(t=>delete i[t]),i}}class hl extends al{}class ll extends sl{get __usePathBox(){return this.points||this.__pathInputed}}class dl extends sl{get __boxStroke(){return!this.__pathInputed}}class cl extends sl{get __boxStroke(){return!this.__pathInputed}}class ul extends ll{}class _l extends sl{}class pl extends sl{get __pathInputed(){return 2}}class gl extends nl{}const fl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class yl extends sl{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=fl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=he.get("Rect",0);const r=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=r.boxBounds),i.set(t),n.strokeChanged&&r.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class ml extends dl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class vl extends dl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:xl,add:wl}=k,bl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:r}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),n&&(t=xl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n,renderSpread:a}=this.__,{strokeSpread:o}=this.__layout,h=this.__box;e&&(t=Vh.getShadowRenderSpread(this,e)),s&&(t=xl(t,s)),n&&(t=wl(t,Gh.getSpread(n))),a&&(t=wl(t,a)),o&&(t=wl(t,o));let l=t;return i&&(l=xl(l,Vh.getInnerShadowSpread(this,i))),r&&(l=xl(l,r)),this.__layout.renderShapeSpread=l,h?xl(h.__updateRenderSpread(),t):t}},{stintSet:El}=_,Sl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);El(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),El(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;El(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Vh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),El(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Pl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:r,stroke:n,__drawAfterFill:a,__fillAfterStroke:o,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Xh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Vh.shadow(this,t,h),o&&(s.__isStrokes?Xh.strokes(n,this,t,e):Xh.stroke(n,this,t,e)),r&&(s.__isFills?Xh.fills(r,this,t,e):Xh.fill(r,this,t,e)),a&&this.__drawAfterFill(t,e),d&&Vh.innerShadow(this,t,h),n&&!o&&(s.__isStrokes?Xh.strokes(n,this,t,e):Xh.stroke(n,this,t,e)),c&&Gh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(o&&(s.__isStrokes?Xh.strokes(n,this,t,e):Xh.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*r,e.blur*i,Nh.string(e.color))}r&&(s.__isFills?Xh.fills(r,this,t,e):Xh.fill(r,this,t,e)),h&&t.restore(),a&&this.__drawAfterFill(t,e),n&&!o&&(s.__isStrokes?Xh.strokes(n,this,t,e):Xh.stroke(n,this,t,e))}}else s.__pathInputed?Pl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:r}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Xh.fills(s,this,t,e):Xh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Xh.strokes(r,this,t,e):Xh.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Pl(t,e,i){const{fill:s,stroke:r,__drawAfterFill:n,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Xh.stroke(r,t,e,i),s&&Xh.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),r&&!a&&Xh.stroke(r,t,e,i)}const Bl={__drawFast(t,e){let{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;const{fill:a,stroke:o,__drawAfterFill:h}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,r,n)),h&&this.__drawAfterFill(t,e),o){const{strokeAlign:a,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(o,h,this.__);const l=h/2;switch(a){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,n),t.restore()):t.strokeRect(i+l,s+l,r,n);break;case"outside":t.strokeRect(i-l,s-l,r+h,n+h)}}}};var kl,Tl;t.UI=kl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){M.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return zr.set(this.path=t||[]),t||this.__drawPathByBox(zr),zr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return ne.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ne.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(zr.set(i=[]),this.__drawPathByBox(zr)),t?$i.toCanvasData(i,!0):i}getPathString(t,e,i){return $i.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||qh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Ur.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Yh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?tr.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,r,h(n)?[n]:n)}else t.rect(e,i,s,r)}drawImagePlaceholder(t,e,i){Xh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),ne.need("animate")}killAnimate(t,e){}export(t,e){return ne.need("export")}syncExport(t,e){return ne.need("export")}clone(t){const e=_.clone(this.toJSON());return t&&Object.assign(e,t),kl.one(e)}static one(t,e,i,s,r){return he.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){jn()(this)}static registerData(t){Fn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},pe([Fn(sl)],t.UI.prototype,"__",void 0),pe([Wh()],t.UI.prototype,"zoomLayer",void 0),pe([dn("")],t.UI.prototype,"id",void 0),pe([dn("")],t.UI.prototype,"name",void 0),pe([dn("")],t.UI.prototype,"className",void 0),pe([Pn("pass-through")],t.UI.prototype,"blendMode",void 0),pe([kn(1)],t.UI.prototype,"opacity",void 0),pe([Tn(!0)],t.UI.prototype,"visible",void 0),pe([Pn(!1)],t.UI.prototype,"locked",void 0),pe([Bn(!1)],t.UI.prototype,"dim",void 0),pe([Bn(!1)],t.UI.prototype,"dimskip",void 0),pe([Ln(0)],t.UI.prototype,"zIndex",void 0),pe([An(!1)],t.UI.prototype,"mask",void 0),pe([Dn(!1)],t.UI.prototype,"eraser",void 0),pe([cn(0,!0)],t.UI.prototype,"x",void 0),pe([cn(0,!0)],t.UI.prototype,"y",void 0),pe([fn(100,!0)],t.UI.prototype,"width",void 0),pe([fn(100,!0)],t.UI.prototype,"height",void 0),pe([pn(1,!0)],t.UI.prototype,"scaleX",void 0),pe([pn(1,!0)],t.UI.prototype,"scaleY",void 0),pe([gn(0,!0)],t.UI.prototype,"rotation",void 0),pe([gn(0,!0)],t.UI.prototype,"skewX",void 0),pe([gn(0,!0)],t.UI.prototype,"skewY",void 0),pe([cn(0,!0)],t.UI.prototype,"offsetX",void 0),pe([cn(0,!0)],t.UI.prototype,"offsetY",void 0),pe([un(0,!0)],t.UI.prototype,"scrollX",void 0),pe([un(0,!0)],t.UI.prototype,"scrollY",void 0),pe([_n()],t.UI.prototype,"origin",void 0),pe([_n()],t.UI.prototype,"around",void 0),pe([dn(!1)],t.UI.prototype,"lazy",void 0),pe([yn(1)],t.UI.prototype,"pixelRatio",void 0),pe([Sn(0)],t.UI.prototype,"renderSpread",void 0),pe([vn()],t.UI.prototype,"path",void 0),pe([xn()],t.UI.prototype,"windingRule",void 0),pe([xn(!0)],t.UI.prototype,"closed",void 0),pe([fn(0)],t.UI.prototype,"padding",void 0),pe([fn(!1)],t.UI.prototype,"lockRatio",void 0),pe([fn()],t.UI.prototype,"widthRange",void 0),pe([fn()],t.UI.prototype,"heightRange",void 0),pe([dn(!1)],t.UI.prototype,"draggable",void 0),pe([dn()],t.UI.prototype,"dragBounds",void 0),pe([dn("auto")],t.UI.prototype,"dragBoundsType",void 0),pe([dn(!1)],t.UI.prototype,"editable",void 0),pe([On(!0)],t.UI.prototype,"hittable",void 0),pe([On("path")],t.UI.prototype,"hitFill",void 0),pe([En("path")],t.UI.prototype,"hitStroke",void 0),pe([On(!1)],t.UI.prototype,"hitBox",void 0),pe([On(!0)],t.UI.prototype,"hitChildren",void 0),pe([On(!0)],t.UI.prototype,"hitSelf",void 0),pe([On()],t.UI.prototype,"hitRadius",void 0),pe([In("")],t.UI.prototype,"cursor",void 0),pe([Pn()],t.UI.prototype,"fill",void 0),pe([En(void 0,!0)],t.UI.prototype,"stroke",void 0),pe([En("inside")],t.UI.prototype,"strokeAlign",void 0),pe([En(1,!0)],t.UI.prototype,"strokeWidth",void 0),pe([En(!1)],t.UI.prototype,"strokeWidthFixed",void 0),pe([En("none")],t.UI.prototype,"strokeCap",void 0),pe([En("miter")],t.UI.prototype,"strokeJoin",void 0),pe([En()],t.UI.prototype,"dashPattern",void 0),pe([En(0)],t.UI.prototype,"dashOffset",void 0),pe([En(10)],t.UI.prototype,"miterLimit",void 0),pe([xn(0)],t.UI.prototype,"cornerRadius",void 0),pe([xn()],t.UI.prototype,"cornerSmoothing",void 0),pe([Fh()],t.UI.prototype,"shadow",void 0),pe([Fh()],t.UI.prototype,"innerShadow",void 0),pe([Fh()],t.UI.prototype,"blur",void 0),pe([Fh()],t.UI.prototype,"backgroundBlur",void 0),pe([Fh()],t.UI.prototype,"grayscale",void 0),pe([Fh()],t.UI.prototype,"filter",void 0),pe([Pn()],t.UI.prototype,"placeholderColor",void 0),pe([dn(100)],t.UI.prototype,"placeholderDelay",void 0),pe([dn({})],t.UI.prototype,"data",void 0),pe([zn(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=kl=pe([Hn(bl),Hn(Sl),Yn()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},pe([Fn(nl)],t.Group.prototype,"__",void 0),pe([fn(0)],t.Group.prototype,"width",void 0),pe([fn(0)],t.Group.prototype,"height",void 0),t.Group=pe([Hn(t.Branch),jn()],t.Group);const Cl=Jt.get("Leafer");t.Leafer=Tl=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Zr.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Tl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,_.assign(s,t));const r=this.canvas=ae.canvas(s);this.__controllers.push(this.renderer=ae.renderer(this,r,s),this.watcher=ae.watcher(this,s),this.layouter=ae.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=ae.selector(this),this.interaction=ae.interaction(this,r,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ae.hitCanvasManager()),this.canvasManager=new _e,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(r),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),xa.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(Ga.RESTART):this.emitLeafer(Ga.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(Ga.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=_.copyAttrs({},t,Te);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Gt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=_.copyAttrs({},this.canvas,Te);e.resize(t),this.updateLazyBounds(),this.__onResize(new Xa(t,i))}__onResize(t){this.emitEvent(t),_.copyAttrs(this.__,t,Te),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Kt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Te.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(Ga.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Te.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,r=_.copyAttrs({},s,Te);r[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Ga.BEFORE_READY),this.emitLeafer(Ga.READY),this.emitLeafer(Ga.AFTER_READY),xa.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Ga.VIEW_READY),xa.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:n}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(r=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){xa.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(Ga.VIEW_COMPLETED),xa.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return ne.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Ga(t,this))}__listenEvents(){const t=ie.start("FirstCreate "+this.innerName);this.once([[Ga.START,()=>ie.end(t)],[ja.START,this.updateLazyBounds,this],[Va.START,this.__onCreated,this],[Va.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Ha.DATA,this.__onWatchData,this],[ja.END,this.__onLayoutEnd,this],[Va.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Tl.list.remove(this);try{this.stop(),this.emitLeafer(Ga.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Jr.clearRecycled()},100)}catch(t){Cl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new _h,pe([Fn(ol)],t.Leafer.prototype,"__",void 0),pe([fn()],t.Leafer.prototype,"pixelRatio",void 0),pe([dn("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Tl=pe([jn()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},pe([Fn(dl)],t.Rect.prototype,"__",void 0),t.Rect=pe([Hn(Bl),Yn(),jn()],t.Rect);const{add:Rl,includes:Ll,scroll:Al}=Xt,Dl=t.Rect.prototype,Ol=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:r,boxBounds:n}=s,{overflow:a}=i,o=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(o),(e=a&&a.includes("scroll"))&&(Rl(o,n),Al(o,i)),this.__updateRectRenderBounds(),t=!Ll(n,o),t&&"show"===a&&Rl(r,o)}else this.__updateRectRenderBounds();_.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},pe([Fn(al)],t.Box.prototype,"__",void 0),pe([fn(100)],t.Box.prototype,"width",void 0),pe([fn(100)],t.Box.prototype,"height",void 0),pe([dn(!1)],t.Box.prototype,"resizeChildren",void 0),pe([Sn("show")],t.Box.prototype,"overflow",void 0),pe([zn(Dl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),pe([zn(Dl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),pe([zn(Dl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),pe([zn(Dl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),pe([zn(Dl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),pe([zn(Dl.__updateChange)],t.Box.prototype,"__updateRectChange",null),pe([zn(Dl.__render)],t.Box.prototype,"__renderRect",null),pe([zn(Ol.__render)],t.Box.prototype,"__renderGroup",null),t.Box=pe([Yn(),jn()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},pe([Fn(hl)],t.Frame.prototype,"__",void 0),pe([Pn("#FFFFFF")],t.Frame.prototype,"fill",void 0),pe([Sn("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=pe([jn()],t.Frame);const{moveTo:Il,closePath:Fl,ellipse:Ml}=bs;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:r}=this.__,n=t/2,a=e/2,o=this.__.path=[];i?(s||r?(i<1&&Ml(o,n,a,n*i,a*i,0,s,r,!1),Ml(o,n,a,n,a,0,r,s,!0),i<1&&Fl(o)):(i<1&&(Ml(o,n,a,n*i,a*i),Il(o,t,a)),Ml(o,n,a,n,a,0,360,0,!0)),m.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||r?(Il(o,n,a),Ml(o,n,a,n,a,0,s,r,!1),Fl(o)):Ml(o,n,a,n,a)}},pe([Fn(cl)],t.Ellipse.prototype,"__",void 0),pe([xn(0)],t.Ellipse.prototype,"innerRadius",void 0),pe([xn(0)],t.Ellipse.prototype,"startAngle",void 0),pe([xn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=pe([jn()],t.Ellipse);const{sin:Wl,cos:Ul,PI:Nl}=Math,{moveTo:zl,lineTo:Yl,closePath:Xl,drawPoints:Hl}=bs;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Hl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:r}=t,n=i/2,a=s/2;zl(e,n,0);for(let t=1;t<r;t++)Yl(e,n+n*Wl(2*t*Nl/r),a-a*Ul(2*t*Nl/r));Xl(e)}}},pe([Fn(ul)],t.Polygon.prototype,"__",void 0),pe([xn(3)],t.Polygon.prototype,"sides",void 0),pe([xn()],t.Polygon.prototype,"points",void 0),pe([xn(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=pe([Yn(),jn()],t.Polygon);const{sin:jl,cos:Vl,PI:Gl}=Math,{moveTo:ql,lineTo:Kl,closePath:Zl}=bs;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,r=t/2,n=e/2,a=this.__.path=[];ql(a,r,0);for(let t=1;t<2*i;t++)Kl(a,r+(t%2==0?r:r*s)*jl(t*Gl/i),n-(t%2==0?n:n*s)*Vl(t*Gl/i));Zl(a)}},pe([Fn(_l)],t.Star.prototype,"__",void 0),pe([xn(5)],t.Star.prototype,"corners",void 0),pe([xn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=pe([jn()],t.Star);const{moveTo:Ql,lineTo:Jl,drawPoints:$l}=bs,{rotate:td,getAngle:ed,getDistance:id,defaultPoint:sd}=lt;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&td(i,e),i}set toPoint(t){this.width=id(sd,t),this.rotation=ed(sd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?$l(e,t.points,t.curve,t.closed):(Ql(e,0,0),Jl(e,this.width,0))}},pe([Fn(ll)],t.Line.prototype,"__",void 0),pe([wn("center")],t.Line.prototype,"strokeAlign",void 0),pe([fn(0)],t.Line.prototype,"height",void 0),pe([xn()],t.Line.prototype,"points",void 0),pe([xn(0)],t.Line.prototype,"curve",void 0),pe([xn(!1)],t.Line.prototype,"closed",void 0),t.Line=pe([jn()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}},pe([Fn(ml)],t.Image.prototype,"__",void 0),pe([fn("")],t.Image.prototype,"url",void 0),t.Image=pe([jn()],t.Image);const rd=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ae.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new sn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Fa(Fa.LOADED,{image:t}))})}draw(t,e,i,s){const r=new ft(t.worldTransform).invert(),n=new ft;e&&n.translate(e.x,e.y),i&&(h(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},pe([Fn(vl)],t.Canvas.prototype,"__",void 0),pe([Mh(100)],t.Canvas.prototype,"width",void 0),pe([Mh(100)],t.Canvas.prototype,"height",void 0),pe([Mh(1)],t.Canvas.prototype,"pixelRatio",void 0),pe([Mh(!0)],t.Canvas.prototype,"smooth",void 0),pe([dn(!1)],t.Canvas.prototype,"safeResize",void 0),pe([Mh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=pe([jn()],t.Canvas);const{copyAndSpread:nd,includes:ad,spread:od,setList:hd}=Xt,{stintSet:ld}=_;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:r,fontWeight:n,italic:a,textCase:o,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=zh.number(e,r),t.__letterSpacing=zh.number(i,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${a?"italic ":""}${"small-caps"===o?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${s||"caption"}`,ld(t,"__padding",l&&M.fourNumber(l)),ld(t,"__clipText","show"!==h&&!t.__autoSize),ld(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==o),t.__textDrawData=Uh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:r,__autoWidth:n,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:o}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=o,t.__lineHeight<i&&od(o,i/2),n||a){if(h.x=n?o.x:0,h.y=a?o.y:0,h.width=n?o.width:t.width,h.height=a?o.height:t.height,r){const[e,i,s,r]=t.__padding;n&&(h.x-=r,h.width+=i+r),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),_.stintSet(this,"isOverflow",!ad(h,o)),this.isOverflow?(hd(t.__textBoxBounds={},[h,o]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;nd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},pe([Fn(yl)],t.Text.prototype,"__",void 0),pe([fn(0)],t.Text.prototype,"width",void 0),pe([fn(0)],t.Text.prototype,"height",void 0),pe([Pn()],t.Text.prototype,"boxStyle",void 0),pe([dn(!1)],t.Text.prototype,"resizeFontSize",void 0),pe([Pn("#000000")],t.Text.prototype,"fill",void 0),pe([wn("outside")],t.Text.prototype,"strokeAlign",void 0),pe([On("all")],t.Text.prototype,"hitFill",void 0),pe([fn("")],t.Text.prototype,"text",void 0),pe([fn("")],t.Text.prototype,"placeholder",void 0),pe([fn("caption")],t.Text.prototype,"fontFamily",void 0),pe([fn(12)],t.Text.prototype,"fontSize",void 0),pe([fn("normal")],t.Text.prototype,"fontWeight",void 0),pe([fn(!1)],t.Text.prototype,"italic",void 0),pe([fn("none")],t.Text.prototype,"textCase",void 0),pe([fn("none")],t.Text.prototype,"textDecoration",void 0),pe([fn(0)],t.Text.prototype,"letterSpacing",void 0),pe([fn({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),pe([fn(0)],t.Text.prototype,"paraIndent",void 0),pe([fn(0)],t.Text.prototype,"paraSpacing",void 0),pe([fn("x")],t.Text.prototype,"writingMode",void 0),pe([fn("left")],t.Text.prototype,"textAlign",void 0),pe([fn("top")],t.Text.prototype,"verticalAlign",void 0),pe([fn(!0)],t.Text.prototype,"autoSizeAlign",void 0),pe([fn("normal")],t.Text.prototype,"textWrap",void 0),pe([fn("show")],t.Text.prototype,"textOverflow",void 0),pe([Pn(!1)],t.Text.prototype,"textEditing",void 0),t.Text=pe([jn()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},pe([Fn(pl)],t.Path.prototype,"__",void 0),pe([wn("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=pe([jn()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,r,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,n,a,o){return this}arc(t,e,i,s,r,n){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,n,a,o){return this}drawArc(t,e,i,s,r,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},pe([Fn(gl)],t.Pen.prototype,"__",void 0),pe([(t,e)=>{rn(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=pe([Hn(Us,["set","path","paint"]),jn()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(i||r)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||r)&&(this.sky=this.addLeafer(s)),r&&ae.editor(r,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),r(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&_.assign(e,t),this.autoLayout&&_.copyAttrs(e,this,Te),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[ja.END,this.__onReady,this],[Va.START,this.__onCreated,this],[Va.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Va.END,this.__onChildRenderEnd,this))}},t.App=pe([jn()],t.App);const dd={},cd={isHoldSpaceKey:()=>cd.isHold("Space"),isHold:t=>dd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){dd[t]||(dd[t]=!0)},setUpCode(t){dd[t]=!1}},ud={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class _d extends La{get spaceKey(){return cd.isHoldSpaceKey()}get left(){return ud.left(this)}get right(){return ud.right(this)}get middle(){return ud.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return cd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){ce.changeName(t,e)}}const{min:pd,max:gd,abs:fd}=Math,{float:yd,sign:md}=M,{minX:vd,maxX:xd,minY:wd,maxY:bd}=Xt,Ed=new Gt,Sd=new Gt,Pd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Bd.getValidMove(t.__localBoxBounds,Bd.getDragBounds(t),s,e,!0),Bd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:r,dragBoundsType:n}=t;r&&Bd.getValidScaleOf(t.__localBoxBounds,Bd.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,r){const n=t.x+s.x,a=t.y+s.y,o=n+t.width,h=a+t.height,l=e.x+e.width,d=e.y+e.height;return r||(s=Object.assign({},s)),Bd.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:o<l&&(s.x+=l-o):n<e.x?s.x+=e.x-n:o>l&&(s.x+=l-o),Bd.isInnerMode(t,e,i,"height")?a>e.y?s.y+=e.y-a:h<d&&(s.y+=d-h):a<e.y?s.y+=e.y-a:h>d&&(s.y+=d-h),s.x=yd(s.x),s.y=yd(s.y),s},getValidScaleOf(t,e,i,s,r,n,a){a||(r=Object.assign({},r)),Sd.set(e),Ed.set(t).scaleOf(s,r.x,r.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,_,p,g,f=1,y=1;return Bd.isInnerMode(t,e,i,"width")?(r.x<0&&Ed.scaleOf(s,f=1/r.x,1),p=yd(Ed.minX-Sd.minX),g=yd(Sd.maxX-Ed.maxX),u=h&&p>0?1+p/(h*Ed.width):1,_=l&&g>0?1+g/(l*Ed.width):1,f*=gd(u,_)):(r.x<0&&((yd(vd(t)-vd(e))<=0||yd(xd(e)-xd(t))<=0)&&Ed.scaleOf(s,f=1/r.x,1),Ed.unsign()),p=yd(Sd.minX-Ed.minX),g=yd(Ed.maxX-Sd.maxX),u=h&&p>0?1-p/(h*Ed.width):1,_=l&&g>0?1-g/(l*Ed.width):1,f*=pd(u,_)),Bd.isInnerMode(t,e,i,"height")?(r.y<0&&Ed.scaleOf(s,1,y=1/r.y),p=yd(Ed.minY-Sd.minY),g=yd(Sd.maxY-Ed.maxY),u=d&&p>0?1+p/(d*Ed.height):1,_=c&&g>0?1+g/(c*Ed.height):1,y*=gd(u,_),n&&(u=gd(fd(f),fd(y)),f=md(f)*u,y=md(y)*u)):(r.y<0&&((yd(wd(t)-wd(e))<=0||yd(bd(e)-bd(t))<=0)&&Ed.scaleOf(s,1,y=1/r.y),Ed.unsign()),p=yd(Sd.minY-Ed.minY),g=yd(Ed.maxY-Sd.maxY),u=d&&p>0?1-p/(d*Ed.height):1,_=c&&g>0?1-g/(c*Ed.height):1,y*=pd(u,_)),r.x*=o(f)?f:1,r.y*=o(y)?y:1,r}},Bd=Pd;t.PointerEvent=class extends _d{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=pe([Vn()],t.PointerEvent);const kd=t.PointerEvent,Td={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof _h?t:new _h(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const r=t.getLocalPoint(i,null,!0);return lt.move(r,e.x-t.x,e.y-t.y),s&&this.limitMove(t,r),Pd.axisMove(t,r),r}static limitMove(t,e){Pd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Td,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Td,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Td,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Xt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Xt.unsign(i),i}assignMove(t){Td.x=t?this.totalX:this.moveX,Td.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=pe([Vn()],t.DragEvent);const Cd=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=pe([Vn()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=pe([Vn()],t.MoveEvent),t.TouchEvent=class extends _d{},t.TouchEvent=pe([Vn()],t.TouchEvent);const Rd=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=pe([Vn()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=pe([Vn()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=pe([Vn()],t.ZoomEvent),t.KeyEvent=class extends _d{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=pe([Vn()],t.KeyEvent);const Ld={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Ad.getSwipeDirection(lt.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:r(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new _h,{list:s}=t;for(let t=0,r=s.length;t<r;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>ra.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Ad=Ld,Dd=new _h,{getDragEventData:Od,getDropEventData:Id,getSwipeEventData:Fd}=Ld;class Md{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Od(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,r=s&&s.list.length,n=t.DragEvent.list||this.draggableList||Dd;return this.dragging&&(r?e?Dd:new _h(i?[...s.list,...s.dragHoverExclude]:s.list):n)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&ud.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],ra.draggable(e)){this.draggableList=new _h(e);break}}drag(e){const{interaction:i,dragData:s,downData:r}=this,{path:n,throughPath:a}=r;this.dragData=Od(r,s,e),a&&(this.dragData.throughPath=a),this.dragData.path=n,this.moving?(e.moving=!0,this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(e.dragging=!0,this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,r=this.realDraggableList;if(r.length&&s){const{totalX:s,totalY:n}=this.dragData,{dragLimitAnimate:o}=i.p,l=!o||!!e;r.forEach(i=>{if(i.draggable){const r=a(i.draggable),d=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:n},l||r);o&&!r&&e?ra.animateMove(i,d,h(o)?o:.3):i.move(d)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:r}=e;this.dragOverPath=r,s?r.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,r)):i.emit(t.DragEvent.OVER,e,r)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:r}=e;i.emit(t.DragEvent.LEAVE,e,s,r),i.emit(t.DragEvent.ENTER,e,r,s),this.dragEnterPath=r}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:r}=this;e||(e=r);const{path:n,throughPath:a}=s,o=Od(s,e,e);if(a&&(o.throughPath=a),o.path=n,this.moving&&(this.moving=!1,o.moveType="drag",i.emit(t.MoveEvent.END,o)),this.dragging){const n=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,o),this.swipe(e,s,r,o),this.drop(e,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(lt.getDistance(e,t)>r.config.pointer.swipeDistance){const t=Fd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const r=Id(e,i,t.DragEvent.data);r.path=s,this.interaction.emit(t.DropEvent.DROP,r),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Wd=Jt.get("emit");const Ud=["move","zoom","rotate","key"];function Nd(t,e,i,s,r){if(Ud.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Yd(t,r)){let n;for(let a=0,o=t.children.length;a<o;a++)n=t.children[a],!i.path.has(n)&&n.__.hittable&&zd(n,e,i,s,r)}}function zd(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!Yd(t,r)&&(Kh.updateEventStyle&&!s&&Kh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=ce.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function Yd(t,e){return e&&e.has(t)}const Xd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Hd,pathCanDrag:jd,pathHasOutside:Vd}=Ld;class Gd{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&ud.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&ud.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&cd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=_.clone(Xd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new _h(t),this.createTransformer(),this.dragger=new Md(this),s&&(this.config=_.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(ud.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),ud.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=ud.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&ud.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=lt.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;ud.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,cd.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,cd.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new _h),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const r=Date.now()-this.downTime,n=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>Hd(e.path,t));r<i.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:r,target:n}=this;m.backgrounder||t.origin||n&&n.updateLayout();const a=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Vd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!jd(t.path))&&!Vd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,r=s.length;t<r&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:r}=this.canvas;return s.x*=r.width/i.width,s.y*=r.height/i.height,this.p.snap&&lt.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Hd(e.path,t.PointerEvent.LONG_TAP)||Hd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Gt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(h(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Xa.RESIZE,this.__onResize,this)],t.once(Ga.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(r=i.list[n],zd(r,t,e,!0,s))return;r.isApp&&Nd(r,t,e,!0,s)}for(let n=0,a=i.length;n<a;n++)if(r=i.list[n],r.isApp&&Nd(r,t,e,!1,s),zd(r,t,e,!1,s))return}catch(t){Wd.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class qd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}qd.custom={};class Kd extends _e{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new _h,this.pixelList=new _h}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ae.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ae.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}m.getSelector=function(t){return t.leafer?t.leafer.selector:m.selector||(m.selector=ae.selector())};const{toInnerRadiusPointOf:Zd,copy:Qd,setRadius:Jd}=lt,{hitRadiusPoint:$d,hitPoint:tc}=Xt,ec={},ic={},sc=t.Leaf.prototype;sc.hit=function(t,e=0){this.updateLayout(),Qd(ic,t),Jd(ic,e);const i=this.__world;return!!(e?$d(i,ic):tc(i,ic))&&(this.isBranch?m.getSelector(this).hitPoint(Object.assign({},ic),e,{target:this}):this.__hitWorld(ic))},sc.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,r=i.width<10&&i.height<10;if(e.hitRadius&&(Qd(ec,t),Jd(t=ec,e.hitRadius)),Zd(t,i,ec),e.hitBox||r){if(Xt.hitRadiusPoint(s.boxBounds,ec))return!0;if(r)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(ec)},sc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},sc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},sc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},sc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const rc=new ft,nc=t.UI.prototype;nc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,r=i||s;this.__hitCanvas||(this.__hitCanvas=r?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,r=m.image.hitCanvasSize,a=n.hitScale=qt.set(0,0,r,r).getFitMatrix(t).a,{x:o,y:h,width:l,height:d}=qt.set(t).scale(a);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),Jr.patternLocked=!0,this.__renderShape(n,{matrix:rc.setWith(this.__world).scaleWith(1/a).invertWith().translate(-o,-h),ignoreFill:!i,ignoreStroke:!s}),Jr.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},nc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:r,__maxStrokeWidth:n}=e,a=e.stroke&&("path"===r||"pixel"===r&&!e.__isAlphaPixelStroke)||"all"===r;if(!s&&!a)return!1;const o=2*t.radiusX;let h=o;if(a)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=o;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=o}}return!!h&&this.__hitStroke(t,h)};const ac=t.UI.prototype,oc=t.Rect.prototype,hc=t.Box.prototype;oc.__updateHitCanvas=hc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?ac.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},oc.__hitFill=hc.__hitFill=function(t){return this.__hitCanvas?ac.__hitFill.call(this,t):Xt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:r,__textDrawData:n}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):n.rows.forEach(r=>t.rect(r.x,r.y-s,r.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=s),this.updateLayout(),m.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const lc=Ce.prototype;function dc(t,e,i){t.__.__font?Xh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function cc(t,e,i,s,r){const n=i.__;c(t)?Xh.drawStrokesStyle(t,e,!1,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Xh.strokeArrow(t,i,s,r)}function uc(t,e,i,s,r){const n=i.__;c(t)?Xh.drawStrokesStyle(t,e,!0,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),Xh.drawTextStroke(i,s,r))}function _c(t,e,i,s,r){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,uc(t,2,i,n,r),n.blendMode="outside"===e?"destination-out":"destination-in",Xh.fillText(i,n,r),n.blendMode="normal",ra.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}lc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},lc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},lc.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:n,radiusY:a}=t;e&&(s-=e.x,r-=e.y),qt.set(s-n,r-a,2*n,2*a).scale(i).ceil();const{data:o}=this.context.getImageData(qt.x,qt.y,qt.width||1,qt.height||1);for(let t=0,e=o.length;t<e;t+=4)if(o[t+3]>0)return!0;return o[3]>0};const{getSpread:pc,copyAndSpread:gc,toOuterOf:fc,getOuterOf:yc,getByMove:mc,move:vc,getIntersectData:xc}=Xt,wc={};let bc;const{stintSet:Ec}=_,{hasTransparent:Sc}=Nh;function Pc(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":if(!e.url)return;s=Hh.image(i,t,e,n,!bc||!bc[e.url]);break;case"linear":s=jh.linearGradient(e,n);break;case"radial":s=jh.radialGradient(e,n);break;case"angular":s=jh.conicGradient(e,n);break;case"solid":const{type:a,color:o,opacity:h}=e;s={type:a,style:Nh.string(o,h)};break;default:r(e.r)||(s={type:"solid",style:Nh.string(e)})}if(s&&(s.originPaint=e,a(s.style)&&Sc(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Bc={compute:function(t,e){const i=e.__,s=[];let r,n,a,o=i.__input[t];d(o)||(o=[o]),bc=Hh.recycleImage(t,i);for(let i,r=0,n=o.length;r<n;r++)(i=Pc(t,o[r],e))&&(s.push(i),i.strokeStyle&&(a||(a=1),i.strokeStyle.strokeWidth&&(a=Math.max(a,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(Ec(i,"__isAlphaPixelFill",r),Ec(i,"__isTransparentFill",n)):(Ec(i,"__isAlphaPixelStroke",r),Ec(i,"__isTransparentStroke",n),Ec(i,"__hasMultiStrokeStyle",a))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,dc(e,i,s)},fills:function(t,e,i,s){let r,n,a;for(let o=0,h=t.length;o<h;o++){if(r=t[o],n=r.originPaint,r.image){if(a?a++:a=1,Hh.checkImage(r,!e.__.__font,e,i,s))continue;if(!r.style){1===a&&r.image.isPlacehold&&e.drawImagePlaceholder(r,i,s);continue}}if(i.fillStyle=r.style,r.transform||n.scaleFixed){if(i.save(),r.transform&&i.transform(r.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),dc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),dc(e,i,s),i.restoreBlendMode()):dc(e,i,s)}},fillPathOrText:dc,fillText:function(t,e,i){const s=t.__,{rows:r,decorationY:n}=s.__textDrawData;let a;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=r.length;t<i;t++)a=r[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const r=e.__;if(r.__strokeWidth)if(r.__font)Xh.strokeText(t,e,i,s);else switch(r.strokeAlign){case"center":cc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),cc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const r=e.__;if(r.__fillAfterStroke)cc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),cc(t,2,e,a,s),a.clipUI(r),a.clearWorld(n),ra.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){Xh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":uc(t,1,e,i,s);break;case"inside":_c(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?uc(t,2,e,i,s):_c(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,r=t.__.__textDrawData;const{rows:n,decorationY:a}=r;for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(a){const{decorationHeight:t}=r;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,r,n){let a;const o=s.__,{__hasMultiStrokeStyle:h}=o;h||r.setStroke(void 0,o.__strokeWidth*e,o);for(let l=0,d=t.length;l<d;l++)if(a=t[l],(!a.image||!Hh.checkImage(a,!1,s,r,n))&&a.style){if(h){const{strokeStyle:t}=a;t?r.setStroke(a.style,o.__getRealStrokeWidth(t)*e,o,t):r.setStroke(a.style,o.__strokeWidth*e,o)}else r.strokeStyle=a.style;a.originPaint.blendMode?(r.saveBlendMode(a.originPaint.blendMode),i?Xh.drawTextStroke(s,r,n):r.stroke(),r.restoreBlendMode()):i?Xh.drawTextStroke(s,r,n):r.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),r=e.bounds,n=t.__nowWorld,a=t.__layout,o=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;fc(a.strokeSpread?(gc(wc,a.boxBounds,a.strokeSpread),wc):a.boxBounds,n,o);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(o))_=s,h=u=o,l=n;else{let s;if(m.fullImageShadow)s=o;else{const t=a.renderShapeSpread?pc(r,k.swapAndScale(a.renderShapeSpread,p,g)):r;s=xc(t,o)}c=r.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=y),u=yc(o,c),h=mc(u,-c.e,-c.f),l=yc(n,c),vc(l,-c.e,-c.f);const v=i.matrix;v?(d=new ft(c),d.multiply(v),f*=v.scaleX,y*=v.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let kc,Tc=new Gt;const{isSame:Cc}=Xt;function Rc(t,e,i,s,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||Hh.createData(r,s,i,n),!0}function Lc(t,e){Oc(t,Fa.LOAD,e)}function Ac(t,e){Oc(t,Fa.LOADED,e)}function Dc(t,e,i){e.error=i,t.forceUpdate("surface"),Oc(t,Fa.ERROR,e)}function Oc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Fa(e,i))}function Ic(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Fc,translate:Mc}=J,Wc=new Gt,Uc={},Nc={};function zc(t,e,i,s){const r=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&r<0?0:r}let Yc={},Xc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Hc,set:jc,rotateOfOuter:Vc,translate:Gc,scaleOfOuter:qc,multiplyParent:Kc,scale:Zc,rotate:Qc,skew:Jc}=J;function $c(t,e,i,s,r,n,a,o){a&&Qc(t,a),o&&Jc(t,o.x,o.y),r&&Zc(t,r,n),Gc(t,e.x+i,e.y+s)}const{get:tu,scale:eu,copy:iu}=J,{getFloorScale:su}=M,{abs:ru}=Math;const nu={image:function(t,e,i,s,r){let n,a;const o=Jr.get(i);return kc&&i===kc.paint&&Cc(s,kc.boxBounds)?n=kc.leafPaint:(n={type:i.type,image:o},o.hasAlphaPixel&&(n.isTransparent=!0),kc=o.use>1?{leafPaint:n,paint:i,boxBounds:Tc.set(s)}:null),(r||o.loading)&&(a={image:o,attrName:e,attrValue:i}),o.ready?(Rc(t,e,i,o,n,s),r&&(Lc(t,a),Ac(t,a))):o.error?r&&Dc(t,a,o.error):(r&&(Ic(t,!0),Lc(t,a)),n.loadId=o.load(()=>{Ic(t,!1),t.destroyed||(Rc(t,e,i,o,n,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Ac(t,a)),n.loadId=void 0},e=>{Ic(t,!1),Dc(t,a,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),n},checkImage:function(t,e,i,s,r){const{scaleX:n,scaleY:a}=Hh.getImageRenderScaleData(t,i,s,r),{image:o,data:h,originPaint:l}=t,{exporting:d}=r;return!(!h||t.patternId===n+"-"+a&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===m.name&&Xa.isResizing(i)||d||(e=m.image.isLarge(o,n,a)||o.width*n>8096||o.height*a>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Hh.drawImage(t,n,a,i,s,r),!0):(!t.style||l.sync||d?Hh.createPattern(t,i,s,r):Hh.createPatternTask(t,i,s,r),!1))},drawImage:function(t,e,i,s,r,n){const{data:a,image:o}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=a,c=o.getFull(a.filters),u=s.__;let _,{width:p,height:g}=o;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(s),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(a.scaleX&&(p*=a.scaleX,g*=a.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,i,s){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;r.scaleX*=t,r.scaleY*=t}return n&&n.scaleX&&(r.scaleX*=Math.abs(n.scaleX),r.scaleY*=Math.abs(n.scaleY)),r},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,r,n,a,o;for(let h=0,l=i.length;h<l;h++)s=i[h],r=s.image,o=r&&r.url,o&&(n||(n={}),n[o]=!0,Jr.recyclePaint(s),r.loading&&(a||(a=e.__input&&e.__input[t]||[],d(a)||(a=[a])),r.unload(i[h].loadId,!a.some(t=>t.url===o))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=Jr.patternTasker.add(()=>ge(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&Hh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:r,scaleY:n}=Hh.getImageRenderScaleData(t,e,i,s),a=r+"-"+n;if(t.patternId!==a&&!e.destroyed&&(!m.image.isLarge(t.image,r,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:o,gap:h}=s,l=Hh.getPatternFixScale(t,r,n);let d,c,u,{width:_,height:p}=i;l&&(r*=l,n*=l),_*=r,p*=n,h&&(c=h.x*r/ru(s.scaleX||1),u=h.y*n/ru(s.scaleY||1)),(o||1!==r||1!==n)&&(r*=su(_+(c||0)),n*=su(p+(u||0)),d=tu(),o&&iu(d,o),eu(d,1/r,1/n));const g=i.getCanvas(_,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(g,s.repeat||m.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=a}},getPatternFixScale:function(t,e,i){const{image:s}=t;let r,n=m.image.maxPatternSize,a=s.width*s.height;return s.isSVG?e>1&&(r=Math.ceil(e)/e):n>a&&(n=a),(a*=e*i)>n&&(r=Math.sqrt(n/a)),r},createData:function(t,e,i,s){t.data=Hh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Wc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:r}=i,{opacity:n,mode:o,align:h,offset:l,scale:d,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===r,x={mode:o},w="center"!==h&&(_||0)%180==90;let b,E;switch(Xt.set(Nc,0,0,w?r:s,w?s:r),o&&"cover"!==o&&"fit"!==o?((d||u)&&(M.getScaleData(d,u,i,Uc),b=Uc.scaleX,E=Uc.scaleY),(h||y||f)&&(b&&Xt.scale(Nc,b,E,!0),h&&Bt.toPoint(h,Nc,e,Nc,!0,!0))):v&&!_||(b=E=Xt.getFitScale(e,Nc,"fit"!==o),Xt.put(e,i,h,b,!1,Nc),Xt.scale(Nc,b,E,!0)),l&&lt.move(Nc,l),o){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/r,Hh.stretchMode(x,e,b,E));break;case"normal":case"clip":if(Nc.x||Nc.y||b||g||_||p){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),Hh.clipMode(x,e,Nc.x,Nc.y,b,E,_,p,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||_||p)&&Hh.repeatMode(x,e,s,r,Nc.x,Nc.y,b,E,_,p,h,t.freeTransform),f||(x.repeat="repeat");const i=c(f);(y||i)&&(x.gap=function(t,e,i,s,r){let n,a;c(t)?(n=t.x,a=t.y):n=a=t;return{x:zc(n,i,r.width,e&&e.x),y:zc(a,s,r.height,e&&e.y)}}(y,i&&f,Nc.width,Nc.height,e));break;default:b&&Hh.fillOrFitMode(x,e,Nc.x,Nc.y,b,E,_)}return x.transform||(e.x||e.y)&&Mc(x.transform=Fc(),e.x,e.y),b&&(x.scaleX=b,x.scaleY=E),n&&n<1&&(x.opacity=n),m&&(x.filters=m),f&&(x.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),x},stretchMode:function(t,e,i,s){const r=Hc(),{x:n,y:a}=e;n||a?Gc(r,n,a):r.onlyScale=!0,Zc(r,i,s),t.transform=r},fillOrFitMode:function(t,e,i,s,r,n,a){const o=Hc();Gc(o,e.x+i,e.y+s),Zc(o,r,n),a&&Vc(o,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=o},clipMode:function(t,e,i,s,r,n,a,o,h,l){const d=Hc();$c(d,e,i,s,r,n,a,o),h&&(a||o?(jc(Xc),qc(Xc,e,h,l),Kc(d,Xc)):qc(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,r,n,a,o,h,l,d,c){const u=Hc();if(c)$c(u,e,r,n,a,o,h,l);else{if(h)if("center"===d)Vc(u,{x:i/2,y:s/2},h);else switch(Qc(u,h),h){case 90:Gc(u,s,0);break;case 180:Gc(u,i,s);break;case 270:Gc(u,0,i)}Yc.x=e.x+r,Yc.y=e.y+n,Gc(u,Yc.x,Yc.y),a&&qc(u,Yc,a,o)}t.transform=u}},{toPoint:au}=Et,{hasTransparent:ou}=Nh,hu={},lu={};function du(t,e,i,s){if(i){let r,n,o,h;for(let t=0,l=i.length;t<l;t++)r=i[t],a(r)?(o=t/(l-1),n=Nh.string(r,s)):(o=r.offset,n=Nh.string(r.color,s)),e.addColorStop(o,n),!h&&ou(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:cu,getDistance:uu}=lt,{get:_u,rotateOfOuter:pu,scaleOfOuter:gu}=J,{toPoint:fu}=Et,yu={},mu={};function vu(t,e,i,s,r){let n;const{width:a,height:o}=t;if(a!==o||s){const t=cu(e,i);n=_u(),r?(gu(n,e,a/o*(s||1),1),pu(n,e,t+90)):(gu(n,e,1,a/o*(s||1)),pu(n,e,t))}return n}const{getDistance:xu}=lt,{toPoint:wu}=Et,bu={},Eu={};const Su={linearGradient:function(t,e){let{from:i,to:s,type:r,opacity:n}=t;au(i||"top",e,hu),au(s||"bottom",e,lu);const a=m.canvas.createLinearGradient(hu.x,hu.y,lu.x,lu.y),o={type:r,style:a};return du(o,a,t.stops,n),o},radialGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;fu(i||"center",e,yu),fu(s||"bottom",e,mu);const o=m.canvas.createRadialGradient(yu.x,yu.y,0,yu.x,yu.y,uu(yu,mu)),h={type:r,style:o};du(h,o,t.stops,n);const l=vu(e,yu,mu,a,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;wu(i||"center",e,bu),wu(s||"bottom",e,Eu);const o=m.conicGradientSupport?m.canvas.createConicGradient(0,bu.x,bu.y):m.canvas.createRadialGradient(bu.x,bu.y,0,bu.x,bu.y,xu(bu,Eu)),h={type:r,style:o};du(h,o,t.stops,n);const l=vu(e,bu,Eu,a||1,m.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:vu},{copy:Pu,move:Bu,toOffsetOutBounds:ku}=Xt,{max:Tu,abs:Cu}=Math,Ru={},Lu=new ft,Au={};function Du(t,e){let i,s,r,n,a=0,o=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),r=Cu(t.spread||0),a=Tu(a,r+n-s),o=Tu(o,r+n+i),h=Tu(h,r+n+s),l=Tu(l,r+n-i)}),a===o&&o===h&&h===l?a:[a,o,h,l]}function Ou(t,e,i){const{shapeBounds:s}=i;let r,n;m.fullImageShadow?(Pu(Ru,t.bounds),Bu(Ru,e.x-s.x,e.y-s.y),r=t.bounds,n=Ru):(r=s,n=e),t.copyWorld(i.canvas,r,n)}const{toOffsetOutBounds:Iu}=Xt,Fu={};const Mu=Du;const Wu={shadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{shadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;ku(h,Au,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Au.offsetX+(a.x||0)*c*f,Au.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f,Nh.string(a.color)),r=Vh.getShadowTransform(t,_,i,a,Au,f),r&&_.setTransform(r),Ou(_,Au,i),r&&_.resetTransform(),s=l,a.box&&(_.restore(),_.save(),o&&(_.copyWorld(_,l,n,"copy"),s=n),o?_.copyWorld(o,n,n,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),ra.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{innerShadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Iu(h,Fu,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Fu.offsetX+(a.x||0)*c*f,Fu.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f),r=Vh.getShadowTransform(t,_,i,a,Fu,f,!0),r&&_.setTransform(r),Ou(_,Fu,i),_.restore(),o?(_.copyWorld(_,l,n,"copy"),_.copyWorld(o,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,Nh.string(a.color),"source-in"),ra.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:Du,getShadowTransform:function(t,e,i,s,r,n,a){if(s.spread){const i=2*s.spread*n*(a?-1:1),{width:o,height:h}=t.__layout.strokeBounds;return Lu.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+i/o,1+i/h),Lu}},isTransformShadow(t){},getInnerShadowSpread:Mu},{excludeRenderBounds:Uu}=ua;let Nu;function zu(t,e,i,s,r,n,a,o){switch(e){case"grayscale":Nu||(Nu=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,r,n){const a=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,a),n&&s.recycle(a);Xu(t,e,i,1,r,n)}(t,i,s,r,a,o);break;case"opacity-path":Xu(t,i,s,n,a,o);break;case"path":o&&i.restore()}}function Yu(t){return t.getSameCanvas(!1,!0)}function Xu(t,e,i,s,r,n){const a=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,a,void 0,r),n?i.recycle(a):i.clearWorld(a)}t.Group.prototype.__renderMask=function(t,e){let i,s,r,n,a,o;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],o=i.__.mask,o){a&&(zu(this,a,t,r,s,n,void 0,!0),s=r=null),"clipping"!==o&&"clipping-path"!==o||Uu(i,e)||i.__render(t,e),n=i.__.opacity,Nu=!1,"path"===o||"clipping-path"===o?(n<1?(a="opacity-path",r||(r=Yu(t))):(a="path",t.save()),i.__clip(r||t,e)):(a="grayscale"===o?"grayscale":"alpha",s||(s=Yu(t)),r||(r=Yu(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&zu(this,a,t,r,s,n,void 0,!1),Uu(i,e)||i.__render(r||t,e),d&&zu(this,a,t,r,s,n,d,!1)}zu(this,a,t,r,s,n,void 0,!0)};const Hu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ju=Hu+"_#~&*+\\=|≮≯≈≠=…",Vu=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function Gu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const qu=Gu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Ku=Gu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Zu=Gu(Hu),Qu=Gu(ju),Ju=Gu("- —/~|┆·");var $u;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}($u||($u={}));const{Letter:t_,Single:e_,Before:i_,After:s_,Symbol:r_,Break:n_}=$u;function a_(t){return qu[t]?t_:Ju[t]?n_:Ku[t]?i_:Zu[t]?s_:Qu[t]?r_:Vu.test(t)?e_:t_}const o_={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let n=r-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function h_(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:l_}=o_,{Letter:d_,Single:c_,Before:u_,After:__,Symbol:p_,Break:g_}=$u;let f_,y_,m_,v_,x_,w_,b_,E_,S_,P_,B_,k_,T_,C_,R_,L_,A_,D_=[];function O_(t,e){S_&&!E_&&(E_=S_),f_.data.push({char:t,width:e}),m_+=e}function I_(){v_+=m_,f_.width=m_,y_.words.push(f_),f_={data:[]},m_=0}function F_(){C_&&(R_.paraNumber++,y_.paraStart=!0,C_=!1),S_&&(y_.startCharSize=E_,y_.endCharSize=S_,E_=0),y_.width=v_,L_.width?l_(y_):A_&&M_(),D_.push(y_),y_={words:[]},v_=0}function M_(){v_>(R_.maxWidth||0)&&(R_.maxWidth=v_)}const{top:W_,right:U_,bottom:N_,left:z_}=t.Direction4;function Y_(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let t=0;t<r.length;t++)r[t][e]+=i}const X_={getDrawData:function(t,e){a(t)||(t=String(t));let i=0,s=0,r=e.__getInput("width")||0,n=e.__getInput("height")||0;const{__padding:o}=e;o&&(r?(i=o[z_],r-=o[U_]+o[z_],!r&&(r=.01)):e.autoSizeAlign||(i=o[z_]),n?(s=o[W_],n-=o[W_]+o[N_],!n&&(n=.01)):e.autoSizeAlign||(s=o[W_]));const h={bounds:{x:i,y:s,width:r,height:n},rows:[],paraNumber:0,font:m.canvas.font=e.__font};return function(t,e,i){R_=t,D_=t.rows,L_=t.bounds,A_=!L_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:r,textCase:n}=i,{canvas:a}=m,{width:o}=L_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;C_=!0,B_=null,E_=b_=S_=m_=v_=0,f_={data:[]},y_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)w_=e[i],"\n"===w_?(m_&&I_(),y_.paraEnd=!0,F_(),C_=!0):(P_=a_(w_),P_===d_&&"none"!==n&&(w_=h_(w_,n,!m_)),b_=a.measureText(w_).width,s&&(s<0&&(S_=b_),b_+=s),k_=P_===c_&&(B_===c_||B_===d_)||B_===c_&&P_!==__,T_=!(P_!==u_&&P_!==c_||B_!==p_&&B_!==__),x_=C_&&r?o-r:o,t&&o&&v_+m_+b_>x_&&(h?(m_&&I_(),v_&&F_()):(T_||(T_=P_===d_&&B_==__),k_||T_||P_===g_||P_===u_||P_===c_||m_+b_>x_?(m_&&I_(),v_&&F_()):v_&&F_()))," "===w_&&!0!==C_&&v_+m_===0||(P_===g_?(" "===w_&&m_&&I_(),O_(w_,b_),I_()):k_||T_?(m_&&I_(),O_(w_,b_)):O_(w_,b_)),B_=P_);m_&&I_(),v_&&F_(),D_.length>0&&(D_[D_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{R_.paraNumber++,v_=a.measureText(t).width,D_.push({x:r||0,text:t,width:v_,paraStart:!0}),A_&&M_()})}(h,t,e),o&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Y_(e,"x",t[z_]);break;case"right":Y_(e,"x",-t[U_])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Y_(e,"y",t[W_]);break;case"bottom":Y_(e,"y",-t[N_])}}(o,h,e,r,n),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:n,__baseLine:a,__letterSpacing:o,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*r+(c?c*(t.paraNumber-1):0),m=a;if(h&&y>f)y=Math.max(f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,x,w,b=g||u?g:t.maxWidth;for(let a=0,d=r;a<d;a++){if(v=i[a],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&a>0&&(m+=c),v.y=m,m+=n,t.overflow>a&&m>y&&(v.isOverflow=!0,t.overflow=a+1),x=v.x,w=v.width,o<0&&(v.width<0?(w=-v.width+e.fontSize+o,x-=w,w+=e.fontSize):w-=o),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&g&&g<w&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:n,letterSpacing:a}=e,o=i&&r.includes("both"),h=o||i&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,v;s.forEach(t=>{t.words&&(p=n&&t.paraStart?n:0,y=t.words.length,h&&(v=!t.paraEnd||o,c=i-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=a||t.isOverflow||l?0:u?1:2,t.isOverflow&&!a&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,r){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,v&&_),v&&(m=i===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:r,overflow:n}=t;let{textOverflow:a}=e;if(r.splice(n),a&&"show"!==a){let t,o;"hide"===a?a="":"ellipsis"===a&&(a="...");const h=a?m.canvas.measureText(a).width:0,l=i+s-h;("none"===e.textWrap?r:[r[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],o=t.x+t.width,!(s===i&&o<l));s--){if(o<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:a,x:o}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,c(n)?(i=n.type,n.color&&(t.decorationColor=Nh.string(n.color)),n.offset&&(s=Math.min(.3*r,Math.max(n.offset,.15*-r)))):i=n,i){case"under":t.decorationY=[.15*r+s];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+s,.35*-r]}}(h,e),h}};const H_={string:function(t,e){if(!t)return"#000";const i=h(e)&&e<1;if(a(t)){if(!i||!Nh.object)return t;t=Nh.object(t)}let s=r(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign(Uh,X_),Object.assign(Nh,H_),Object.assign(Xh,Bc),Object.assign(Hh,nu),Object.assign(jh,Su),Object.assign(Vh,Wu),Object.assign(ae,{interaction:(t,e,i,s)=>new Gd(t,e,i,s),hitCanvas:(t,e)=>new gh(t,e),hitCanvasManager:()=>new Kd}),yh();class j_ extends sl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}function V_(t,e){return on(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?Kh.setStyleName(this,e,i):Kh.set(this,i):this.__layout.stateStyleChanged=!0}}))}function G_(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function q_(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function K_(t,e){c(e)||(e=void 0),J_(t,e,"in")}function Z_(t,e){const{normalStyle:i}=t;c(e)||(e=void 0),i&&(e||(e=i),J_(t,e,"out"))}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;d(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!r(t))if(h(t))this.now=t;else if(c(t)){const e=d(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=Jr.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:r,size:n,total:a}=e,{width:o,height:l}=n&&(h(n)?{width:n,height:n}:n)||(a>1?this:t);let d=r?r.x:0,c=r?r.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:o,height:l},d+o>=t.width?(d=0,c+=l):d+=o;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Fa(Fa.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),r(n.loop)||(s=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:r}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,r)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},pe([Fn(j_)],t.Robot.prototype,"__",void 0),pe([fn()],t.Robot.prototype,"robot",void 0),pe([dn()],t.Robot.prototype,"actions",void 0),pe([dn("")],t.Robot.prototype,"action",void 0),pe([Pn(0)],t.Robot.prototype,"now",void 0),pe([dn(12)],t.Robot.prototype,"FPS",void 0),pe([dn(!0)],t.Robot.prototype,"loop",void 0),t.Robot=pe([jn()],t.Robot),ne.add("robot");const Q_={};function J_(t,e,i){const{normalStyle:s}=t;e||(e=Q_),e.scale&&(M.assignScale(e,e.scale),delete e.scale),e!==Q_&&Kh.canAnimate||(i=null);let r=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&n(i[s])&&n(e[s])&&(s="transition");return n(e[s])?i[s]:e[s]}(i,e,t);const a=r?function(t,e){const i=ep(e,t),s=t.animate();s&&ep(i,t,s.fromStyle);return i}(t,e):void 0;Kh.canAnimate&&$_(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const o=$_(t);if(o){const{animation:s}=o;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(o,n.endingStyle),"in"!==i||e.animation!==s?n.kill():r=!1,delete o.animation}t.normalStyle=tp(o,t),t.set(o,"temp")}else t.normalStyle=void 0;if(r){const e=tp(a,t);t.set(a,"temp"),t.animate([a,e],r,"transition",!0)}t.__layout.stateStyleChanged=!1}function $_(t){let e;const i={},s=q_(t),r=s?t.state||s.state:t.state,n=r&&t.states[r];n&&Kh.isState(r,t,s)&&(e=ip(i,n));const a=i.selectedStyle||t.selectedStyle;a&&Kh.isSelected(t,s)&&(e=ip(i,a));const o=i.placeholderStyle||t.placeholderStyle;if(o&&Kh.isPlacehold(t,s)&&(e=ip(i,o)),Kh.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=ip(i,s))}else{const r=i.focusStyle||t.focusStyle;r&&Kh.isFocus(t,s)&&(e=ip(i,r));const n=i.hoverStyle||t.hoverStyle;n&&Kh.isHover(t,s)&&(e=ip(i,n));const a=i.pressStyle||t.pressStyle;a&&Kh.isPress(t,s)&&(e=ip(i,a))}return e?i:void 0}function tp(t,e,i,s){const r=i?t:{},n=i||t;for(let t in n)s&&Kh.animateExcludes[t]||(r[t]=e[t]);return r}function ep(t,e,i){return tp(t,e,i,!0)}function ip(t,e){return Object.assign(t,e),!0}function sp(t,e){const i=t[e];i&&K_(t,i),t.button&&np(t.children,e)}function rp(t,e,i){i||(i=t.states[e]),K_(t,i),t.button&&np(t.children,null,e)}function np(t,e,i){if(!t)return;let s,n;for(let a=0,o=t.length;a<o;a++){if(s=t[a],e){switch(n=!0,e){case"hoverStyle":Kh.isHover(s)&&(n=!1);break;case"pressStyle":Kh.isPress(s)&&(n=!1);break;case"focusStyle":Kh.isFocus(s)&&(n=!1)}n&&sp(s,e)}else r(i)||rp(s,i);s.isBranch&&np(s.children,e,i)}}function ap(t,e){const i=t[e];i&&Z_(t,i),t.button&&hp(t.children,e)}function op(t,e,i){Z_(t,i),t.button&&hp(t.children,null,e)}function hp(t,e,i){if(!t)return;let s;for(let n=0,a=t.length;n<a;n++)s=t[n],e?ap(s,e):r(i)||op(s,i),s.isBranch&&hp(s.children,e,i)}function lp(t,e,i){let s;const r=e.leafer?e.leafer.interaction:null;if(r&&(s=r[t](e),!s&&i)){const n=q_(e,i);n&&(s=r[t](n))}return s}function dp(t,e,i){let s=e[t];if(!s&&i){const r=q_(e,i);r&&(s=r[t])}return s}ne.add("state"),Kh.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},Kh.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const r=q_(e,i);r&&(s=r.states[t])}return!!s}(t,e,i)},Kh.isSelected=function(t,e){return dp("selected",t,e)},Kh.isDisabled=function(t,e){return dp("disabled",t,e)},Kh.isFocus=function(t,e){return lp("isFocus",t,e)},Kh.isHover=function(t,e){return lp("isHover",t,e)},Kh.isPress=function(t,e){return lp("isPress",t,e)},Kh.isPlacehold=function(t,e){return t.__.__isPlacehold},Kh.isDrag=function(t,e){return lp("isDrag",t,e)},Kh.setStyleName=function(t,e,i){i?rp(t,e,t[e]):op(t,e,t[e])},Kh.set=function(t,e){const i=t.states[e];i?rp(t,e,i):op(t,e,i)},Kh.getStyle=$_,Kh.updateStyle=J_,Kh.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:sp(e,"hoverStyle");break;case t.PointerEvent.LEAVE:ap(e,"hoverStyle");break;case t.PointerEvent.DOWN:sp(e,"pressStyle");break;case t.PointerEvent.UP:ap(e,"pressStyle")}};const cp=t.UI.prototype;t.UI.addAttr("selected",!1,V_,"selectedStyle"),t.UI.addAttr("disabled",!1,V_,"disabledStyle"),t.UI.addAttr("states",{},G_),t.UI.addAttr("state","",V_),t.UI.addAttr("normalStyle",void 0,dn),t.UI.addAttr("hoverStyle",void 0,G_),t.UI.addAttr("pressStyle",void 0,G_),t.UI.addAttr("focusStyle",void 0,G_),t.UI.addAttr("selectedStyle",void 0,G_),t.UI.addAttr("disabledStyle",void 0,G_),t.UI.addAttr("placeholderStyle",void 0,G_),t.UI.addAttr("button",!1,dn),cp.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},cp.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?sp(this,"focusStyle"):ap(this,"focusStyle")})},cp.updateState=function(){Kh.updateStyle(this,void 0,"in")};const up=t.Text.prototype,_p="text";rn(up,_p,Object.assign(Object.assign({},nn(up,_p)),{set(t){const e=this,i=e.text;e.__setAttr(_p,t)&&(mn(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:pp,sin:gp,pow:fp,sqrt:yp,abs:mp,ceil:vp,floor:xp,round:wp,PI:bp}=Math,Ep=5*bp,Sp=1.70158,Pp=2.5949095,Bp=7.5625,kp=2.75;function Tp(t){return e=>fp(e,t)}function Cp(t){return e=>1-fp(1-e,t)}function Rp(t){return e=>e<.5?.5*fp(2*e,t):1-.5*fp(2-2*e,t)}function Lp(t){return t<1/kp?Bp*t*t:t<2/kp?Bp*(t-=1.5/kp)*t+.75:t<2.5/kp?Bp*(t-=2.25/kp)*t+.9375:Bp*(t-=2.625/kp)*t+.984375}function Ap(t,e,i,s){const r={};return n=>{const a=~~(1e4*n),o=r[a];if(o)return o;let h,l,d,c=n;for(let e=0;e<8&&(h=1-c,d=Dp(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(mp(l)<1e-6));e++)c-=d/l;return r[a]=Dp(c,e,s)}}function Dp(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Op={get(t){const{list:e}=Op;return a(t)?e[t||"ease"]:c(t)?e[t.name].apply(e,d(t.value)?t.value:[t.value]):e.ease},register(t,e){Op.list[t]=e},list:{linear:t=>t,ease:Ap(.25,.1,.25,1),"ease-in":Ap(.42,0,1,1),"ease-out":Ap(0,0,.58,1),"ease-in-out":Ap(.42,0,.58,1),"sine-in":t=>1-pp(t*bp*.5),"sine-out":t=>gp(t*bp*.5),"sine-in-out":t=>.5*(1-pp(t*bp)),"quad-in":Tp(2),"quad-out":Cp(2),"quad-in-out":Rp(2),"cubic-in":Tp(3),"cubic-out":Cp(3),"cubic-in-out":Rp(3),"quart-in":Tp(4),"quart-out":Cp(4),"quart-in-out":Rp(4),"quint-in":Tp(5),"quint-out":Cp(5),"quint-in-out":Rp(5),"expo-in":t=>t?fp(2,10*t-10):0,"expo-out":t=>1===t?1:1-fp(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*fp(2,2*t*10-10):.5*(2-fp(2,10-2*t*10)),"circ-in":t=>1-yp(1-fp(t,2)),"circ-out":t=>yp(1-fp(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-yp(1-fp(2*t,2))):.5*(yp(1-fp(2-2*t,2))+1),"back-in":t=>((Sp+1)*t-Sp)*t*t,"back-out":t=>(t-=1)*t*((Sp+1)*t+Sp)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Pp+1)*t-Pp)*.5:.5*((t=2*t-2)*t*((Pp+1)*t+Pp)+2),"elastic-in":t=>0===t||1===t?t:-fp(2,10*(t-1))*gp((t-1.1)*Ep),"elastic-out":t=>0===t||1===t?t:fp(2,-10*t)*gp((t-.1)*Ep)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-fp(2,10*((t*=2)-1))*gp((t-1.1)*Ep)*.5:fp(2,10*(1-(t*=2)))*gp((t-1.1)*Ep)*.5+1,"bounce-in":t=>1-Lp(1-t),"bounce-out":Lp,"bounce-in-out":t=>t<.5?.5*(1-Lp(1-2*t)):.5*(1+Lp(2*t-1)),"cubic-bezier":Ap,steps:function(t,e="floor"){return i=>("floor"===e?xp(i*t):"ceil"===e?vp(i*t):wp(i*t))/t}}};function Ip(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class Fp{}Fp.CREATED="created",Fp.PLAY="play",Fp.PAUSE="pause",Fp.STOP="stop",Fp.SEEK="seek",Fp.UPDATE="update",Fp.COMPLETED="completed";t.Animate=class extends to{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:r}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&r&&h(r)&&(t+=r-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=d(e)?e:e?[e]:[];const{easing:r,attrs:n}=this;this.easingFn=Op.get(r),(n||this.attrsMap)&&(this.attrsMap=n?n.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emitType(Fp.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(Fp.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(Fp.STOP))}seek(t){this.destroyed||(c(t)&&(t=zh.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer(()=>this.requestAnimate()),this.emitType(Fp.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,a=!(n>1)||this.join;let o,l,d,c,u,_=0,p=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(l=i[s],c=l.style||l,o||(o=a?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:r,swing:n,loop:a}=l;n&&(d.swing=h(n)?n:2,u=2*d.swing-1),a&&(d.loop=u=h(a)?a:2),t?(d.duration=t,_+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,p+=e*u),i?(d.delay=i,_+=i*u):s&&(d.autoDelay=s,p+=s*u),r&&(d.easingFn=Op.get(r))}if(!d.autoDuration&&r(d.duration)&&(n>1?s>0||a?p+=u:d.duration=0:d.duration=this.duration),n>1)this.setBefore(d,c,o);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}o=c,e.push(d)}p?((this.duration<=_||!s||!s.duration)&&this.changeDuration(_+.2*p),this.allocateTime((this.duration-_)/p)):_&&this.changeDuration(_),this.emitType(Fp.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:n,target:a}=this;for(let o in e)r(s[o])&&(s[o]=n[o]=e===i?i[o]:a[o]),t.beforeStyle[o]=r(i[o])?n[o]:i[o],n[o]=e[o]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],r(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),m.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(Fp.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,r=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(r);else{const{attrsMap:i,target:n}=this;let{betweenStyle:a}=this.frame;a||(a=this.frame.betweenStyle={}),Zh.setBetweenStyle(a,s,r,e,t,n,i),this.setStyle(a)}this.emitType(Fp.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return h(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}},pe([Ip("ease")],t.Animate.prototype,"easing",void 0),pe([Ip(0)],t.Animate.prototype,"delay",void 0),pe([Ip(.2)],t.Animate.prototype,"duration",void 0),pe([Ip("auto")],t.Animate.prototype,"ending",void 0),pe([Ip(!1)],t.Animate.prototype,"reverse",void 0),pe([Ip(!1)],t.Animate.prototype,"swing",void 0),pe([Ip(!1)],t.Animate.prototype,"loop",void 0),pe([Ip(0)],t.Animate.prototype,"loopDelay",void 0),pe([Ip(1)],t.Animate.prototype,"speed",void 0),pe([Ip(!0)],t.Animate.prototype,"autoplay",void 0),pe([Ip()],t.Animate.prototype,"join",void 0),pe([Ip()],t.Animate.prototype,"attrs",void 0),t.Animate=pe([Hn(uo)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=e.map(e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s})}play(){this.each(t=>t.play()),this.emitType(Fp.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(Fp.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(Fp.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(Fp.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case Fp.COMPLETED:this.completed&&this.emitType(t);break;case Fp.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}},t.AnimateList=pe([Hn(uo)],t.AnimateList);const Mp={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},Wp=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Up=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,Np=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,zp=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Yp=parseInt,Xp=parseFloat,{round:Hp}=Math;let jp={},Vp=0;function Gp(t){let e,i,s,r=1;switch(t.length){case 9:e=Yp(t.slice(1,3),16),i=Yp(t.slice(3,5),16),s=Yp(t.slice(5,7),16),r=Yp(t.slice(7,9),16)/255;break;case 7:e=Yp(t.slice(1,3),16),i=Yp(t.slice(3,5),16),s=Yp(t.slice(5,7),16);break;case 5:e=Yp(t[1]+t[1],16),i=Yp(t[2]+t[2],16),s=Yp(t[3]+t[3],16),r=Yp(t[4]+t[4],16)/255;break;case 4:e=Yp(t[1]+t[1],16),i=Yp(t[2]+t[2],16),s=Yp(t[3]+t[3],16);break;case 3:e=i=s=Yp(t[1]+t[2],16);break;case 2:e=i=s=Yp(t[1]+t[1],16)}return{r:e,g:i,b:s,a:r}}const qp=1/6,Kp=.5,Zp=2/3,Qp=1/3;function Jp(t,e,i){return i<0?i++:i>1&&i--,i<qp?t+6*(e-t)*i:i<Kp?e:i<Zp?t+(e-t)*(Zp-i)*6:t}function $p(t,e,i,s=1){let r,n,a;if(t/=360,i/=100,0===(e/=100))r=n=a=i;else{let s=i<.5?i*(1+e):i+e-i*e,o=2*i-s;r=Jp(o,s,t+Qp),n=Jp(o,s,t),a=Jp(o,s,t-Qp)}return{r:Hp(255*r),g:Hp(255*n),b:Hp(255*a),a:s}}ne.add("color"),Nh.object=function(t,e){let i,s=!r(e)&&e<1;if(a(t)){const e=jp[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Gp(t);break;case"R":case"r":"("===t[4]&&Up.test(t)?i=function(t){const e=Up.exec(t);return{r:Yp(e[1]),g:Yp(e[2]),b:Yp(e[3]),a:Xp(e[4])}}(t):"("===t[3]&&Wp.test(t)&&(i=function(t){const e=Wp.exec(t);return{r:Yp(e[1]),g:Yp(e[2]),b:Yp(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&zp.test(t)?i=function(t){const e=zp.exec(t);return $p(Xp(e[1]),Xp(e[2]),Xp(e[3]),Xp(e[4]))}(t):"("===t[3]&&Np.test(t)&&(i=function(t){const e=Np.exec(t);return $p(Xp(e[1]),Xp(e[2]),Xp(e[3]),1)}(t))}if(!i){const e=Mp[t.toLowerCase()];e&&(i=Gp("#"+e))}i&&(Vp++,Vp>1e4&&(jp={},Vp=0),jp[t]=Object.assign({},i))}}else c(t)&&(r(t.a)&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:tg}=Math,{fourNumber:eg}=M,ig={fill:og,stroke:og,cornerRadius:(t,e,i)=>h(t)&&h(e)?ng(t,e,i):(t=eg(t),e=eg(e),t.map((t,s)=>ng(t,e[s],i))),text(t,e,i){if(a(t)&&a(e)){const s=t.length,r=e.length,n=ng(s,r,i,1);return s<r?e.substring(0,n):t.substring(0,n)}return h(t)||h(e)?M.float(ng(t,e,i),Math.max(rg(t),rg(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const r=Object.assign(Object.assign({},t),e);return Zh.setBetweenStyle(r,t,e,r,i,s),r},shadow:hg,innerShadow:hg},sg={value:function(t,e,i){const s=h(t),r=h(e);return s&&r?t+(e-t)*i:r||s?ng(t,e,i):t},number:ng,color:ag,setBetweenStyle:function(t,e,i,s,r,n,a){let o,h,l;const{list:d,value:c}=Zh;for(let u in s)a&&!a[u]||(o=e[u],h=i[u],l=d[u]||c,o!==h&&(t[u]=l(o,h,r,n)))}};function rg(t){const e=String(t).split(".")[1];return e?e.length:0}function ng(t,e,i,s){t||(t=0),e||(e=0);const r=t+(e-t)*i;return s?tg(r):r}function ag(t,e,i){t=Nh.object(t),e=Nh.object(e);const s=ng(t.r,e.r,i,1)+","+ng(t.g,e.g,i,1)+","+ng(t.b,e.b,i,1),r=ng(t.a,e.a,i);return 1===r?"rgb("+s+")":"rgba("+s+","+r+")"}function og(t,e,i){return a(t)&&a(e)?ag(t,e,i):e}function hg(t,e,i){return d(t)||d(e)?e:(e=e||{},{x:ng((t=t||{}).x,e.x,i),y:ng(t.y,e.y,i),blur:ng(t.blur,e.blur,i),spread:ng(t.spread,e.spread,i),color:ag(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}ne.add("animate","color"),Kh.canAnimate=!0,Object.assign(Zh.list,ig),Object.assign(Zh,sg);const lg=t.UI.prototype;t.UI.addAttr("animation",void 0,function(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),t.UI.addAttr("animationOut",void 0,dn),t.UI.addAttr("transition",!0,dn),t.UI.addAttr("transitionOut",void 0,dn),lg.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},lg.animate=function(e,i,s,n){if(r(e))return this.__animate;let a=d(e)&&!i&&s?new t.AnimateList(this,e,n):new t.Animate(this,e,i,n);this.killAnimate(s,a.toStyle);const o=this.__animate;return o&&(a instanceof t.AnimateList?a.list.unshift(o):a=new t.AnimateList(this,[o,a])),this.__animate=a},lg.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:r}=s;for(let t in i)if(t in r){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},lg.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(Fp.COMPLETED,e)};const dg=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],cg=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:ug}=Math,{getDerivative:_g}=ni,pg={getDistance(t,e,i,s,r,n,a,o,h=1){let l,d,c,u,_,p,g=0,f=h/2;for(let h=0;h<dg.length;h++)l=f*(1+dg[h]),d=f*(1-dg[h]),c=_g(l,t,i,r,a),u=_g(l,e,s,n,o),_=_g(d,t,i,r,a),p=_g(d,e,s,n,o),g+=cg[h]*(ug(c*c+u*u)+ug(_*_+p*p));return g*f},getRotation(t,e,i,s,r,n,a,o,h){const l=_g(t,e,s,n,o),d=_g(t,i,r,a,h);return Math.atan2(d,l)/U},getT(t,e,i,s,r,n,a,o,h,l,d=1){let c=0,u=1,_=t/e,p=d/e/3;if(_>=1)return 1;if(_<=0)return 0;for(;u-c>p;)gg(i,s,r,n,a,o,h,l,_)<t?c=_:u=_,_=(c+u)/2;return _},cut(t,e,i,s,r,n,a,o,h,l){const d=1-e,c=d*i+e*r,u=d*s+e*n,_=d*r+e*a,p=d*n+e*o,g=d*c+e*_,f=d*u+e*p,y=d*g+e*(d*_+e*(d*a+e*h)),m=d*f+e*(d*p+e*(d*o+e*l));t.push(Ae.C,c,u,g,f,y,m)}},{getDistance:gg}=pg,{M:fg,L:yg,C:mg,Z:vg}=Ae,xg={},wg={},bg={transform(t,e){let i,s=0;const r=t.length;for(;s<r;)switch(i=t[s],i){case fg:case yg:bg.transformPoints(t,e,s,1),s+=3;break;case mg:bg.transformPoints(t,e,s,3),s+=7;break;case vg:s+=1}},transformPoints(t,e,i,s){for(let r=i+1,n=r+2*s;r<n;r+=2)xg.x=t[r],xg.y=t[r+1],J.toOuterPoint(e,xg),t[r]=xg.x,t[r+1]=xg.y},getMotionPathData(t){let e,i,s,r,n=0,a=[],o=0,h=0,l=0;const d=t.length;for(;o<d;){switch(r=t[o],r){case fg:case yg:i=t[o+1],s=t[o+2],e=r===yg&&o>0?lt.getDistanceFrom(h,l,i,s):0,h=i,l=s,o+=3;break;case mg:i=t[o+5],s=t[o+6],e=pg.getDistance(h,l,t[o+1],t[o+2],t[o+3],t[o+4],i,s),h=i,l=s,o+=7;break;case vg:o+=1;default:e=0}a.push(e),n+=e}return{total:n,segments:a,data:t}},getDistancePoint(t,e,i){const{segments:s,data:r}=t;e=zh.number(e,t.total);let n,a,o,h,l,d,c,u,_,p=0,g={},f=0,y=0,m=0,v=0;const x=r.length;for(;f<x;){switch(h=r[f],h){case fg:case yg:if(a=r[f+1],o=r[f+2],n=s[y],p+n>=e||!t.total)return f||(m=a,v=o),wg.x=m,wg.y=v,g.x=a,g.y=o,lt.getDistancePoint(wg,g,e-p,!0),g.rotation=lt.getAngle(wg,g),g;m=a,v=o,f+=3;break;case mg:if(a=r[f+5],o=r[f+6],n=s[y],p+n>=e)return l=r[f+1],d=r[f+2],c=r[f+3],u=r[f+4],_=pg.getT(e-p,n,m,v,l,d,c,u,a,o,i),ni.getPointAndSet(_,m,v,l,d,c,u,a,o,g),g.rotation=pg.getRotation(_,m,v,l,d,c,u,a,o),g;m=a,v=o,f+=7;break;case vg:f+=1;default:n=0}y++,p+=n}return g},getDistancePath(t,e,i){const{segments:s,data:r}=t,n=[];e=zh.number(e,t.total);let a,o,h,l,d,c,u,_,p,g=0,f={},y=0,m=0,v=0,x=0;const w=r.length;for(;y<w;){switch(l=r[y],l){case fg:case yg:if(o=r[y+1],h=r[y+2],a=s[m],g+a>=e||!t.total)return y||(v=o,x=h),wg.x=v,wg.y=x,f.x=o,f.y=h,lt.getDistancePoint(wg,f,e-g,!0),n.push(l,f.x,f.y),n;v=o,x=h,y+=3,n.push(l,v,x);break;case mg:if(d=r[y+1],c=r[y+2],u=r[y+3],_=r[y+4],o=r[y+5],h=r[y+6],a=s[m],g+a>=e)return p=pg.getT(e-g,a,v,x,d,c,u,_,o,h,i),pg.cut(n,p,v,x,d,c,u,_,o,h),n;v=o,x=h,y+=7,n.push(l,d,c,u,_,o,h);break;case vg:y+=1,n.push(l);default:a=0}m++,g+=a}return n}};function Eg(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!n(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}ne.add("motion-path"),Zh.register("motion",function(t,e,i,s){return c(t)&&(t=zh.number(t,s.getMotionTotal())),c(e)&&(e=zh.number(e,s.getMotionTotal())),Zh.number(t||0,e||0,i)}),Zh.register("motionRotation",function(t,e,i){return Zh.number(t,e,i)});const Sg=t.UI.prototype,{updateMatrix:Pg,updateAllMatrix:Bg}=ra,{updateBounds:kg}=fa;function Tg(t){const{motion:e,leaferIsCreated:i}=t;if(!n(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Rg(t);i.total&&(t.__.__pathForRender=bg.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Bg(t),kg(t,t)):Pg(t));i&&(t.leafer.created=!0)}}function Cg(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function Rg(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=bg.getMotionPathData(t.getPath(!0,!0))}t.UI.addAttr("motionPath",void 0,Eg),t.UI.addAttr("motionPrecision",1,Eg),t.UI.addAttr("motion",void 0,Eg),t.UI.addAttr("motionRotation",!0,Eg),Sg.getMotionPathData=function(){return Rg(Cg(this))},Sg.getMotionPoint=function(t){const e=Cg(this),i=Rg(e);if(!i.total)return{};const s=bg.getDistancePoint(i,t,e.motionPrecision);J.toOuterPoint(e.localTransform,s);const{motionRotation:r}=this;return!1===r?delete s.rotation:h(r)&&(s.rotation+=r),s},Sg.getMotionTotal=function(){return this.getMotionPathData().total},Sg.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],n(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Tg(t))}else Tg(this)};const{Yes:Lg,NoAndSkip:Ag,YesAndSkip:Dg}=t.Answer,Og={},Ig={},Fg={};class Mg{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":Og.id=t.substring(1),t=Og;break;case".":Ig.className=t.substring(1),t=Ig;break;default:Fg.tag=t,t=Fg}case"object":if(r(t.id)){if(t.tag){const{tag:s}=t,r=d(s);return this.getByMethod(r?this.methods.tags:this.methods.tag,e,i,r?_.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&ra.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const r=i?null:[];return this.eachFind(this.toChildren(e),t,r,s),r||this.findLeaf}eachFind(t,e,i,s){let r,n;for(let a=0,o=t.length;a<o;a++){if(r=t[a],n=e(r,s),n===Lg||n===Dg){if(!i)return void(this.findLeaf=r);i.push(r)}r.isBranch&&n<Ag&&this.eachFind(r.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Aa.REMOVE,this.__onRemoveChild,this),this.target.on_(Oa.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const Wg=t.UI.prototype;function Ug(t){return t.leafer?t.leafer.selector:m.selector||(m.selector=ae.selector())}return Wg.find=function(t,e){return Ug(this).getBy(t,this,!1,e)},Wg.findOne=function(t,e){return Ug(this).getBy(t,this,!0,e)},ne.add("find"),ae.finder=function(t){return new Mg(t)},t.AlignHelper=Bt,t.AnimateEasing=Op,t.AnimateEvent=Fp,t.AroundHelper=Et,t.AutoBounds=Kt,t.BezierHelper=ni,t.Bounds=Gt,t.BoundsEvent=Ma,t.BoundsHelper=Xt,t.BoxData=al,t.BranchHelper=fa,t.BranchRender=Ao,t.CanvasData=vl,t.CanvasManager=_e,t.ChildEvent=Aa,t.ColorConvert=Nh,t.Creator=ae,t.Cursor=qd,t.DataHelper=_,t.Debug=Jt,t.DragBoundsHelper=Pd,t.Dragger=Md,t.Effect=Vh,t.EllipseData=cl,t.EllipseHelper=pi,t.Event=La,t.EventCreator=ce,t.Eventer=to,t.Export=qh,t.FileHelper=Hr,t.Filter=Gh,t.Finder=Mg,t.FourNumberHelper=k,t.FrameData=hl,t.GroupData=nl,t.HighBezierHelper=pg,t.HighCurveHelper=bg,t.HitCanvasManager=Kd,t.ImageData=ml,t.ImageEvent=Fa,t.ImageManager=Jr,t.IncrementId=x,t.InteractionBase=Gd,t.InteractionHelper=Ld,t.Keyboard=cd,t.LayoutEvent=ja,t.Layouter=Rh,t.LeafBounds=Co,t.LeafBoundsHelper=ua,t.LeafData=g,t.LeafDataProxy=po,t.LeafEventer=uo,t.LeafHelper=ra,t.LeafLayout=Ra,t.LeafLevelList=ph,t.LeafList=_h,t.LeafMatrix=wo,t.LeafRender=Ro,t.LeaferCanvas=gh,t.LeaferCanvasBase=Ce,t.LeaferData=ol,t.LeaferEvent=Ga,t.LeaferImage=sn,t.LineData=ll,t.MathHelper=M,t.Matrix=ft,t.MatrixHelper=J,t.MyDragEvent=Cd,t.MyImage=rd,t.MyPointerEvent=kd,t.MyTouchEvent=Rd,t.NeedConvertToCanvasCommandMap=Oe,t.OneRadian=U,t.PI2=N,t.PI_2=z,t.Paint=Xh,t.PaintGradient=jh,t.PaintImage=Hh,t.PathArrow=Yh,t.PathBounds=Ar,t.PathCommandDataHelper=bs,t.PathCommandMap=Ae,t.PathCommandNodeHelper=gi,t.PathConvert=$i,t.PathCorner=Ur,t.PathCreator=Us,t.PathData=pl,t.PathDrawer=tr,t.PathHelper=Re,t.PathNumberCommandLengthMap=We,t.PathNumberCommandMap=Me,t.PenData=gl,t.Picker=Oh,t.Platform=m,t.Plugin=ne,t.Point=pt,t.PointHelper=lt,t.PointerButton=ud,t.PolygonData=ul,t.PropertyEvent=Oa,t.RectData=dl,t.RectHelper=Ue,t.RectRender=Bl,t.RenderEvent=Va,t.Renderer=Ah,t.ResizeEvent=Xa,t.Resource=Zr,t.RobotData=j_,t.Run=ie,t.Selector=Ih,t.StarData=_l,t.State=Kh,t.StringNumberMap=Zt,t.TaskItem=Gr,t.TaskProcessor=qr,t.TextConvert=Uh,t.TextData=yl,t.Transition=Zh,t.TwoPointBoundsHelper=mt,t.UIBounds=bl,t.UICreator=he,t.UIData=sl,t.UIEvent=_d,t.UIRender=Sl,t.UnitConvert=zh,t.WaitHelper=xa,t.WatchEvent=Ha,t.Watcher=vh,t.affectRenderBoundsType=Sn,t.affectStrokeBoundsType=wn,t.attr=hn,t.autoLayoutType=_n,t.boundsType=fn,t.canvasPatch=Xr,t.canvasSizeAttrs=Te,t.createAttr=function(t){return(e,i)=>{rn(e,i,an(i,t))}},t.createDescriptor=an,t.cursorType=In,t.dataProcessor=Fn,t.dataType=dn,t.decorateLeafAttr=on,t.defineDataProcessor=Mn,t.defineKey=rn,t.defineLeafAttr=ln,t.dimType=Bn,t.doBoundsType=mn,t.doStrokeType=bn,t.effectType=Fh,t.emptyData=s,t.eraserType=Dn,t.extraPropertyEventMap=Ia,t.getBoundsData=X,t.getDescriptor=nn,t.getMatrixData=H,t.getPointData=Y,t.hitType=On,t.isArray=d,t.isData=function(t){return c(t)&&!d(t)},t.isEmptyData=u,t.isFinite=o,t.isNull=n,t.isNumber=h,t.isObject=c,t.isString=a,t.isUndefined=r,t.layoutProcessor=function(t){return(e,i)=>{rn(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Ja,t.maskType=An,t.motionPathType=Eg,t.naturalBoundsType=yn,t.opacityType=kn,t.path=Nr,t.pathInputType=vn,t.pathType=xn,t.pen=zr,t.positionType=cn,t.registerUI=jn,t.registerUIEvent=Vn,t.resizeType=Mh,t.rewrite=zn,t.rewriteAble=Yn,t.rotationType=gn,t.scaleType=pn,t.scrollType=un,t.sortType=Ln,t.stateStyleType=G_,t.stateType=V_,t.strokeType=En,t.surfaceType=Pn,t.tempBounds=qt,t.tempMatrix=yt,t.tempPoint=gt,t.tryToNumber=function(t){return"string"==typeof t&&l.test(t)?+t:t},t.useCanvas=yh,t.useModule=Hn,t.version="1.12.0",t.visibleType=Tn,t.zoomLayerType=Wh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
1
+ var LeaferUI=function(t){"use strict";var e,i;t.PathNodeHandleType=void 0,(e=t.PathNodeHandleType||(t.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror",t.Answer=void 0,(i=t.Answer||(t.Answer={}))[i.No=0]="No",i[i.Yes=1]="Yes",i[i.NoAndSkip=2]="NoAndSkip",i[i.YesAndSkip=3]="YesAndSkip";const s={};function r(t){return void 0===t}function n(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:o}=Number;function h(t){return"number"==typeof t}const l=/^-?\d+(?:\.\d+)?$/;const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return"{}"===JSON.stringify(t)}const _={default:(t,e)=>(p(e,t),p(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var n,a;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return p(t[r],e[r],i&&i[r]);i&&r in i?(null===(a=i[r])||void 0===a?void 0:a.constructor)===Object&&p(t[r]={},e[r],i[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{r(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:p}=_;class g{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=r(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!r(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(d(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!r(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=r(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:a}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:a}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{floor:f,max:y}=Math,m={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||v.maxCacheSize),isSuperLarge:(t,e,i)=>v.isLarge(t,e,i,v.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=m.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,r,n,a,o,h){const l=m.origin.createCanvas(y(f(e+(s||0)),1),y(f(i+(r||0)),1)),d=l.getContext("2d");if(o&&(d.globalAlpha=o),d.imageSmoothingEnabled=!1!==a,n){const s=e/n.width,r=i/n.height;d.setTransform(s,0,0,r,-n.x*s,-n.y*r),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&_.stintSet(i,"transform",e)}}},{image:v}=m,x={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=w;return e[t]?e[t]++:(e[t]=1,0)}},w=x;let b,E,S;const{max:P}=Math,B=[0,0,0,0],k={zero:[...B],tempFour:B,set:(t,e,i,s,r)=>(void 0===i&&(i=s=r=e),t[0]=e,t[1]=i,t[2]=s,t[3]=r,t),setTemp:(t,e,i,s)=>T(B,t,e,i,s),toTempAB(t,e,i){S=i?h(t)?e:t:[],h(t)?(b=C(t),E=e):h(e)?(b=t,E=C(e)):(b=t,E=e),4!==b.length&&(b=R(b)),4!==E.length&&(E=R(E))},get(t,e){let i;if(!h(t))switch(t.length){case 4:i=r(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!r(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>h(t)&&h(e)?P(t,e):(L(t,e,i),T(S,P(b[0],E[0]),P(b[1],E[1]),P(b[2],E[2]),P(b[3],E[3]))),add:(t,e,i)=>h(t)&&h(e)?t+e:(L(t,e,i),T(S,b[0]+E[0],b[1]+E[1],b[2]+E[2],b[3]+E[3])),swapAndScale(t,e,i,s){if(h(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[n,a,o,l]=4===t.length?t:R(t);return T(r,o*i,l*e,n*i,a*e)}},{set:T,get:R,setTemp:C,toTempAB:L}=k,{round:A,pow:D,max:O,floor:I,PI:F}=Math,M={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!r(e)&&t<e&&(t=e),!r(i)&&t>i&&(t=i),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),M.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=r(e)?1e12:D(10,e);return-0===(t=A(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(h(e)?e:e.width||0)/i.width,r=(h(e)?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&M.assignScale(s,t);return s},assignScale(t,e){h(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>O(I(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const U=F/180,N=2*F,z=F/2;function Y(){return{x:0,y:0}}function X(){return{x:0,y:0,width:0,height:0}}function H(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:j,cos:q,acos:V,sqrt:G}=Math,{float:K}=M,Z={};function Q(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const J={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Q(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,n=0,a=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=a},get:H,getWorld:Q,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){$.toInnerPoint(t,e,Z),$.scaleOfInner(t,Z,i,s)},scaleOfInner(t,e,i,s=i){$.translateInner(t,e.x,e.y),$.scale(t,i,s),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,a=q(e*=U),o=j(e);t.a=i*a-s*o,t.b=i*o+s*a,t.c=r*a-n*o,t.d=r*o+n*a},rotateOfOuter(t,e,i){$.toInnerPoint(t,e,Z),$.rotateOfInner(t,Z,i)},rotateOfInner(t,e,i){$.translateInner(t,e.x,e.y),$.rotate(t,i),$.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:a}=t;i&&(i*=U,t.a=s+n*i,t.b=r+a*i),e&&(e*=U,t.c=n+s*e,t.d=a+r*e)},skewOfOuter(t,e,i,s){$.toInnerPoint(t,e,Z),$.skewOfInner(t,Z,i,s)},skewOfInner(t,e,i,s=0){$.translateInner(t,e.x,e.y),$.skew(t,i,s),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:a,f:o}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+a,t.f=e.e*s+e.f*n+o},multiplyParent(t,e,i,s,n){const{e:a,f:o}=t;if(i||(i=t),r(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:a,d:o}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=a*e.a+o*e.c,i.d=a*e.b+o*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=a*e.a+o*e.c+e.e,i.f=a*e.b+o*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:i,c:s,d:r,e:n,f:a}=t;if(i||s){const o=1/(e*r-i*s);t.a=r*o,t.b=-i*o,t.c=-s*o,t.d=e*o,t.e=-(n*r-a*s)*o,t.f=-(a*e-n*i)*o}else if(1===e&&1===r)t.e=-n,t.f=-a;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-a*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:a,d:o}=t,h=1/(r*o-n*a),{x:l,y:d}=e;if(i||(i=e),i.x=(l*o-d*a)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*o-s*a)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,s,n){const{x:a,y:o,scaleX:h,scaleY:l}=e;if(r(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:r}=e,n=i*U,a=q(n),o=j(n);if(s||r){const e=s*U,i=r*U;t.a=(a+i*-o)*h,t.b=(o+i*a)*h,t.c=(e*a-o)*l,t.d=(a+e*o)*l}else t.a=a*h,t.b=o*h,t.c=-o*l,t.d=a*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=a,t.f=o,(i=i||s)&&$.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:r,b:n,c:a,d:o,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||a){const t=r*o-n*a;if(a&&!s){d=G(r*r+n*n),c=t/d;const e=r/d;u=n>0?V(e):-V(e)}else{c=G(a*a+o*o),d=t/c;const e=a/c;u=z-(o>0?V(-e):-V(e))}const e=K(q(u)),i=j(u);d=K(d),c=K(c),_=e?K((a/c+i)/e/U,9):0,p=e?K((n/d-i)/e/U,9):0,u=K(u/U)}else d=r,c=o,u=_=p=0;return(e=i||e)&&(g+=e.x*r+e.y*a,f+=e.x*n+e.y*o,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:a}=t;r||n?i=(s*a-r*n)/(e=G(s*s+r*r)):(e=s,i=a)}return s.scaleX=e,s.scaleY=i,s},reset(t){$.set(t)}},$=J,{float:tt}=M,{toInnerPoint:et,toOuterPoint:it}=J,{sin:st,cos:rt,abs:nt,sqrt:at,atan2:ot,min:ht,round:lt}=Math,dt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=r(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?lt(t.x-.5)+.5:lt(t.x),t.y=e?lt(t.y-.5)+.5:lt(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=ct.defaultPoint);const s=rt(e*=U),r=st(e),n=t.x-i.x,a=t.y-i.y;t.x=i.x+n*s-a*r,t.y=i.y+n*r+a*s},tempToInnerOf(t,e){const{tempPoint:i}=ct;return _t(i,t),et(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ct;return _t(i,t),it(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ct;return _t(i,t),ct.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(_t(t,e),pt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),et(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){et(e,t,i)},toOuterOf(t,e,i){it(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>ut(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=nt(i-t),n=nt(s-e);return at(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>ht(ut(t,e,i,s),ut(i,s,r,n)),getAngle:(t,e)=>gt(t,e)/U,getRotation:(t,e,i,s)=>(s||(s=e),ct.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/U),getRadianFrom(t,e,i,s,n,a,o,h){r(o)&&(o=i,h=s);const l=t-i,d=e-s,c=n-o,u=a-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>ot(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,r){const n=gt(t,e);return r&&(t=e),s||(e={}),e.x=t.x+rt(n)*i,e.y=t.y+st(n)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>tt(t.x)===tt(e.x)&&tt(t.y)===tt(e.y),reset(t){ct.reset(t)}},ct=dt,{getDistanceFrom:ut,copy:_t,setRadius:pt,getAtan2:gt}=ct;class ft{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?dt.copy(this,t):dt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new ft(this)}move(t,e){return dt.move(this,t,e),this}scale(t,e){return dt.scale(this,t,e),this}scaleOf(t,e,i){return dt.scaleOf(this,t,e,i),this}rotate(t,e){return dt.rotate(this,t,e),this}rotateOf(t,e){return dt.rotate(this,e,t),this}getRotation(t,e,i){return dt.getRotation(this,t,e,i)}toInnerOf(t,e){return dt.toInnerOf(this,t,e),this}toOuterOf(t,e){return dt.toOuterOf(this,t,e),this}getCenter(t){return new ft(dt.getCenter(this,t))}getDistance(t){return dt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new ft(dt.getDistancePoint(this,t,e,i,s))}getAngle(t){return dt.getAngle(this,t)}getAtan2(t){return dt.getAtan2(this,t)}isSame(t){return dt.isSame(this,t)}reset(){return dt.reset(this),this}}const yt=new ft;class mt{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return c(t)?J.copy(this,t):J.set(this,t,e,i,s,r,n),this}setWith(t){return J.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new mt(this)}translate(t,e){return J.translate(this,t,e),this}translateInner(t,e){return J.translateInner(this,t,e),this}scale(t,e){return J.scale(this,t,e),this}scaleWith(t,e){return J.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return J.pixelScale(this,t),this}scaleOfOuter(t,e,i){return J.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return J.scaleOfInner(this,t,e,i),this}rotate(t){return J.rotate(this,t),this}rotateOfOuter(t,e){return J.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return J.rotateOfInner(this,t,e),this}skew(t,e){return J.skew(this,t,e),this}skewOfOuter(t,e,i){return J.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return J.skewOfInner(this,t,e,i),this}multiply(t){return J.multiply(this,t),this}multiplyParent(t){return J.multiplyParent(this,t),this}divide(t){return J.divide(this,t),this}divideParent(t){return J.divideParent(this,t),this}invert(){return J.invert(this),this}invertWith(){return J.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){J.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){J.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return J.setLayout(this,t,e,i),this}getLayout(t,e,i){return J.getLayout(this,t,e,i)}withScale(t,e){return J.withScale(this,t,e)}reset(){J.reset(this)}}const vt=new mt,xt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,r){wt(t,e,i),wt(t,e+s,i+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:wt}=xt;var bt,Et;t.Direction4=void 0,(bt=t.Direction4||(t.Direction4={}))[bt.top=0]="top",bt[bt.right=1]="right",bt[bt.bottom=2]="bottom",bt[bt.left=3]="left",t.Direction9=void 0,(Et=t.Direction9||(t.Direction9={}))[Et.topLeft=0]="topLeft",Et[Et.top=1]="top",Et[Et.topRight=2]="topRight",Et[Et.right=3]="right",Et[Et.bottomRight=4]="bottomRight",Et[Et.bottom=5]="bottom",Et[Et.bottomLeft=6]="bottomLeft",Et[Et.left=7]="left",Et[Et.center=8]="center",Et[Et["top-left"]=0]="top-left",Et[Et["top-right"]=2]="top-right",Et[Et["bottom-right"]=4]="bottom-right",Et[Et["bottom-left"]=6]="bottom-left";const St=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];St.forEach(t=>t.type="percent");const Pt={directionData:St,tempPoint:{},get:Bt,toPoint(t,e,i,s,r,n){const a=Bt(t);i.x=a.x,i.y=a.y,"percent"===a.type&&(i.x*=e.width,i.y*=e.height,r&&(n||(i.x-=r.x,i.y-=r.y),a.x&&(i.x-=1===a.x?r.width:.5===a.x?a.x*r.width:0),a.y&&(i.y-=1===a.y?r.height:.5===a.y?a.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),Pt.toPoint(t,e,i,!0),i)};function Bt(e){return a(e)?St[t.Direction9[e]]:e}const{toPoint:kt}=Pt,Tt={toPoint(t,e,i,s,r,n){kt(t,i,s,r,e,n)}},{tempPointBounds:Rt,setPoint:Ct,addPoint:Lt,toBounds:At}=xt,{toOuterPoint:Dt}=J,{float:Ot,fourNumber:It}=M,{floor:Ft,ceil:Mt}=Math;let Wt,Ut,Nt,zt;const Yt={},Xt={},Ht={},jt={tempBounds:Ht,set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,r){const{x:n,y:a,width:o,height:h}=e;if(d(i)){const e=It(i);s?qt.set(t,n+e[3],a+e[0],o-e[1]-e[3],h-e[2]-e[0]):qt.set(t,n-e[3],a-e[0],o+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),qt.set(t,n-i,a-i,o+2*i,h+2*i);r&&("width"===r?(t.y=a,t.height=h):(t.x=n,t.width=o))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),qt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Gt(e,t):e=t,i||(i=t),e.offsetX=qt.maxX(i),e.offsetY=qt.maxY(i),qt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||dt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){dt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(qt.copy(Ht,t),qt.toOuterOf(Ht,e),Ht),getOuterOf:(t,e)=>(t=Object.assign({},t),qt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r,e:n,f:a}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=a+t.y*r):(i.height=t.height*-r,i.y=a+t.y*r-i.height)}else Yt.x=t.x,Yt.y=t.y,Dt(e,Yt,Xt),Ct(Rt,Xt.x,Xt.y),Yt.x=t.x+t.width,Dt(e,Yt,Xt),Lt(Rt,Xt.x,Xt.y),Yt.y=t.y+t.height,Dt(e,Yt,Xt),Lt(Rt,Xt.x,Xt.y),Yt.x=t.x,Dt(e,Yt,Xt),Lt(Rt,Xt.x,Xt.y),At(Rt,i)},toInnerOf(t,e,i){i||(i=t),qt.move(i,-e.e,-e.f),qt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,qt.getFitScale(t,e));return new mt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,r=t.height/e.height;return i?Math.max(s,r):Math.min(s,r)},put(t,e,i="center",s=1,r=!0,n){n||(n=e),a(s)&&(s=qt.getFitScale(t,e,"cover"===s)),Ht.width=r?e.width*=s:e.width*s,Ht.height=r?e.height*=s:e.height*s,Tt.toPoint(i,Ht,t,n,!0,!0)},getSpread(t,e,i){const s={};return qt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){qt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){qt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Ft(t.x),t.y=Ft(t.y),t.width=e>t.x?Mt(t.width+e-t.x):Mt(t.width),t.height=i>t.y?Mt(t.height+i-t.y):Mt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Ot(t.x,e),t.y=Ot(t.y,e),t.width=Ot(t.width,e),t.height=Ot(t.height,e)},add(t,e,i){Wt=t.x+t.width,Ut=t.y+t.height,Nt=e.x,zt=e.y,i||(Nt+=e.width,zt+=e.height),Wt=Wt>Nt?Wt:Nt,Ut=Ut>zt?Ut:zt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Wt-t.x,t.height=Ut-t.y},addList(t,e){qt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){qt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){qt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let r,n=!0;for(let a=0,o=e.length;a<o;a++)r=i?i(e[a],a):e[a],r&&(r.width||r.height)&&(n?(n=!1,s||Gt(t,r)):Vt(t,r));n&&qt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Rt,t.x,t.y):Lt(Rt,t.x,t.y)),At(Rt,t)},setPoint(t,e){qt.set(t,e.x,e.y)},addPoint(t,e){Vt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},hitRadiusPoint:(t,e,i)=>(i&&(e=dt.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=dt.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=qt.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=qt.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=qt.tempToOuterOf(e,i)),!qt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:n,height:a}=e;return Wt=s+n,Ut=r+a,Nt=t.x+t.width,zt=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,Wt=Wt<Nt?Wt:Nt,Ut=Ut<zt?Ut:zt,n=Wt-s,a=Ut-r,{x:s,y:r,width:n,height:a}},intersect(t,e,i){qt.copy(t,qt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){qt.set(t)}},qt=jt,{add:Vt,copy:Gt}=qt;class Kt{get minX(){return jt.minX(this)}get minY(){return jt.minY(this)}get maxX(){return jt.maxX(this)}get maxY(){return jt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?jt.copy(this,t):jt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Kt(this)}move(t,e){return jt.move(this,t,e),this}scale(t,e,i){return jt.scale(this,t,e,i),this}scaleOf(t,e,i){return jt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return jt.toOuterOf(this,t,e),this}toInnerOf(t,e){return jt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return jt.getFitMatrix(this,t,e)}put(t,e,i){jt.put(this,t,e,i)}spread(t,e){return jt.spread(this,t,e),this}shrink(t,e){return jt.shrink(this,t,e),this}ceil(){return jt.ceil(this),this}unsign(){return jt.unsign(this),this}float(t){return jt.float(this,t),this}add(t){return jt.add(this,t),this}addList(t){return jt.setList(this,t,!0),this}setList(t){return jt.setList(this,t),this}addListWithFn(t,e){return jt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return jt.setListWithFn(this,t,e),this}setPoint(t){return jt.setPoint(this,t),this}setPoints(t){return jt.setPoints(this,t),this}addPoint(t){return jt.addPoint(this,t),this}getPoints(){return jt.getPoints(this)}hitPoint(t,e){return jt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return jt.hitRadiusPoint(this,t,e)}hit(t,e){return jt.hit(this,t,e)}includes(t,e){return jt.includes(this,t,e)}intersect(t,e){return jt.intersect(this,t,e),this}getIntersect(t,e){return new Kt(jt.getIntersectData(this,t,e))}isSame(t){return jt.isSame(this,t)}isEmpty(){return jt.isEmpty(this)}reset(){jt.reset(this)}}const Zt=new Kt;class Qt{constructor(t,e,i,s,r,n){c(t)?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=t;this.set(e,i,s,r,n,a)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=this;return new Kt(r,e,n||t.width-r-i,a||t.height-e-s)}}const Jt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:$t}=M;class te{constructor(t){this.repeatMap={},this.name=t}static get(t){return new te(t)}static set filter(t){this.filterList=ee(t)}static set exclude(t){this.excludeList=ee(t)}static drawRepaint(t,e){const i=$t();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===te.showBounds,r=t.__nowWorld,n=$t();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if(ie.enable){if(ie.filterList.length&&ie.filterList.every(t=>t!==this.name))return;if(ie.excludeList.length&&ie.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ie.enable&&this.warn(...t)}warn(...t){ie.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function ee(t){return t?a(t)&&(t=[t]):t=[],t}te.filterList=[],te.excludeList=[],te.showWarn=!0;const ie=te,se=te.get("RunTime"),re={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=x.create(x.RUNTIME);return ne.currentId=ne.idMap[i]=e?performance.now():Date.now(),ne.currentName=ne.nameMap[i]=t,ne.nameToIdMap[t]=i,i},end(t,e){const i=ne.idMap[t],s=ne.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;ne.idMap[t]=ne.nameMap[t]=ne.nameToIdMap[s]=void 0,se.log(s,r,"ms")},endOfName(t,e){const i=ne.nameToIdMap[t];r(i)||ne.end(i,e)}},ne=re,ae=[],oe={list:{},add(t,...e){this.list[t]=!0,ae.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>ae.forEach(t=>oe.has(t,!0)));const he={editor:t=>oe.need("editor")},le=te.get("UICreator"),de={list:{},register(t){const{__tag:e}=t.prototype;ce[e]&&le.repeat(e),ce[e]=t},get(t,e,i,s,n,a){ce[t]||le.error("not register "+t);const o=new ce[t](e);return r(i)||(o.x=i,s&&(o.y=s),n&&(o.width=n),a&&(o.height=a)),o}},{list:ce}=de,ue=te.get("EventCreator"),_e={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(pe[e]&&ue.repeat(e),pe[e]=t)})},changeName(t,e){const i=pe[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,pe[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new pe[t](...e)},{nameList:pe}=_e;class ge{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,r=i.length;s<r;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=he.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function fe(t,e,i,s){var r,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}function ye(t,e,i,s){return new(i||(i=Promise))(function(r,n){function a(t){try{h(s.next(t))}catch(t){n(t)}}function o(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?r(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(a,o)}h((s=s.apply(t,e||[])).next())})}function me(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const ve=[];function xe(){return(t,e)=>{ve.push(e)}}const we=[];class be{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||we)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ve.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,a,o,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*o;s+=e,e=0,n+=t,o-=t}if(i<0){const t=-i/r*h;r+=i,i=0,a+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,a,o,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,a,o){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}fe([me("imageSmoothingEnabled")],be.prototype,"smooth",void 0),fe([me("imageSmoothingQuality")],be.prototype,"smoothLevel",void 0),fe([me("globalAlpha")],be.prototype,"opacity",void 0),fe([me()],be.prototype,"fillStyle",void 0),fe([me()],be.prototype,"strokeStyle",void 0),fe([me("lineWidth")],be.prototype,"strokeWidth",void 0),fe([me("lineCap")],be.prototype,"strokeCap",void 0),fe([me("lineJoin")],be.prototype,"strokeJoin",void 0),fe([me("lineDashOffset")],be.prototype,"dashOffset",void 0),fe([me()],be.prototype,"miterLimit",void 0),fe([me()],be.prototype,"shadowBlur",void 0),fe([me()],be.prototype,"shadowColor",void 0),fe([me()],be.prototype,"shadowOffsetX",void 0),fe([me()],be.prototype,"shadowOffsetY",void 0),fe([me()],be.prototype,"filter",void 0),fe([me()],be.prototype,"font",void 0),fe([me()],be.prototype,"fontKerning",void 0),fe([me()],be.prototype,"fontStretch",void 0),fe([me()],be.prototype,"fontVariantCaps",void 0),fe([me()],be.prototype,"textAlign",void 0),fe([me()],be.prototype,"textBaseline",void 0),fe([me()],be.prototype,"textRendering",void 0),fe([me()],be.prototype,"wordSpacing",void 0),fe([me()],be.prototype,"letterSpacing",void 0),fe([me()],be.prototype,"direction",void 0),fe([xe()],be.prototype,"setTransform",null),fe([xe()],be.prototype,"resetTransform",null),fe([xe()],be.prototype,"getTransform",null),fe([xe()],be.prototype,"save",null),fe([xe()],be.prototype,"restore",null),fe([xe()],be.prototype,"translate",null),fe([xe()],be.prototype,"scale",null),fe([xe()],be.prototype,"rotate",null),fe([xe()],be.prototype,"fill",null),fe([xe()],be.prototype,"stroke",null),fe([xe()],be.prototype,"clip",null),fe([xe()],be.prototype,"fillRect",null),fe([xe()],be.prototype,"strokeRect",null),fe([xe()],be.prototype,"clearRect",null),fe([xe()],be.prototype,"beginPath",null),fe([xe()],be.prototype,"moveTo",null),fe([xe()],be.prototype,"lineTo",null),fe([xe()],be.prototype,"bezierCurveTo",null),fe([xe()],be.prototype,"quadraticCurveTo",null),fe([xe()],be.prototype,"closePath",null),fe([xe()],be.prototype,"arc",null),fe([xe()],be.prototype,"arcTo",null),fe([xe()],be.prototype,"ellipse",null),fe([xe()],be.prototype,"rect",null),fe([xe()],be.prototype,"roundRect",null),fe([xe()],be.prototype,"createConicGradient",null),fe([xe()],be.prototype,"createLinearGradient",null),fe([xe()],be.prototype,"createPattern",null),fe([xe()],be.prototype,"createRadialGradient",null),fe([xe()],be.prototype,"fillText",null),fe([xe()],be.prototype,"measureText",null),fe([xe()],be.prototype,"strokeText",null);const{copy:Ee,multiplyParent:Se,pixelScale:Pe}=J,{round:Be}=Math,ke=new Kt,Te=new Kt,Re={width:1,height:1,pixelRatio:1},Ce=["width","height","pixelRatio"];class Le extends be{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Re),this.manager=e,this.innerId=x.create(x.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||m.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;_.copyAttrs(s,t,Ce),Ce.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Kt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,r=this.worldTransform;e&&Se(t,e,r),Pe(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=Be(r.e-.5)+.5,r.f=Be(r.f-.5)+.5):(r.e=Be(r.e),r.f=Be(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:a,miterLimit:o}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),r(e.dashPattern)||(n=e.dashPattern),r(e.dashOffset)||(a=e.dashOffset),e.miterLimit&&(o=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=a,this.miterLimit=o}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,r){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,r),i?(this.setTempPixelBounds2(i,r),i=Te):i=ke,this.drawImage(t.view,ke.x,ke.y,ke.width,ke.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,r){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,jt.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),this.drawImage(t.view,ke.x,ke.y,ke.width,ke.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,r,n){this.resetTransform(),this.copyWorld(t,e,i,s,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(ke.x,ke.y,ke.width,ke.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,ke.x,ke.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(ke.x,ke.y,ke.width,ke.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(ke.x,ke.y,ke.width,ke.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(ke.x,ke.y,ke.width,ke.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(ke.x,ke.y,ke.width,ke.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(ke,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Te,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,r=this.manager?this.manager.get(i):he.canvas(Object.assign({},i));return r.save(),t&&(Ee(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==s&&(r.pixelSnap=s),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Ae={creator:{},parse(t,e){},convertToCanvasData(t,e){}},De={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Oe=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},De),Ie={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Fe={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Me=Object.assign(Object.assign({},Fe),De),We=Oe,Ue={};for(let t in We)Ue[We[t]]=t;const Ne={};for(let t in We)Ne[We[t]]=Ie[t];const ze={drawRoundRect(t,e,i,s,r,n){const a=M.fourNumber(n,Math.min(s/2,r/2)),o=e+s,h=i+r;a[0]?t.moveTo(e+a[0],i):t.moveTo(e,i),a[1]?t.arcTo(o,i,o,h,a[1]):t.lineTo(o,i),a[2]?t.arcTo(o,h,e,h,a[2]):t.lineTo(o,h),a[3]?t.arcTo(e,h,e,i,a[3]):t.lineTo(e,h),a[0]?t.arcTo(e,i,o,i,a[0]):t.lineTo(e,i)}},{sin:Ye,cos:Xe,hypot:He,atan2:je,ceil:qe,abs:Ve,PI:Ge,sqrt:Ke,pow:Ze}=Math,{setPoint:Qe,addPoint:Je}=xt,{set:$e,toNumberPoints:ti}=dt,{M:ei,L:ii,C:si,Q:ri,Z:ni}=Oe,ai={},oi={points(t,e,i,s){let r=ti(e);if(t.push(ei,r[0],r[1]),i&&r.length>5){let e,n,a,o,h,l,d,c,u,_,p,g,f,y,m,v=r.length;const x=!0===i?.5:i;s&&(r=[r[v-2],r[v-1],...r,r[0],r[1],r[2],r[3]],v=r.length);for(let i=2;i<v-2;i+=2)e=r[i-2],n=r[i-1],a=r[i],o=r[i+1],h=r[i+2],l=r[i+3],p=a-e,g=o-n,f=Ke(Ze(p,2)+Ze(g,2)),y=Ke(Ze(h-a,2)+Ze(l-o,2)),(f||y)&&(m=f+y,f=x*f/m,y=x*y/m,h-=e,l-=n,d=a-f*h,c=o-f*l,2===i?s||t.push(ri,d,c,a,o):(p||g)&&t.push(si,u,_,d,c,a,o),u=a+y*h,_=o+y*l);s||t.push(ri,u,_,r[v-2],r[v-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push(ii,r[e],r[e+1]);s&&t.push(ni)},rect(t,e,i,s,r){Ae.creator.path=t,Ae.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){Ae.creator.path=[],ze.drawRoundRect(Ae.creator,e,i,s,r,n),t.push(...Ae.convertToCanvasData(Ae.creator.path,!0))},arcTo(t,e,i,s,r,n,a,o,h,l,d){const c=s-e,u=r-i,_=n-s,p=a-r;let g=je(u,c),f=je(p,_);const y=He(c,u),m=He(_,p);let v=f-g;if(v<0&&(v+=N),y<1e-12||m<1e-12||v<1e-12||Ve(v-Ge)<1e-12)return t&&t.push(ii,s,r),h&&(Qe(h,e,i),Je(h,s,r)),d&&$e(d,e,i),void(l&&$e(l,s,r));const x=c*p-_*u<0,w=x?-1:1,b=o/Xe(v/2),E=s+b*Xe(g+v/2+z*w),S=r+b*Ye(g+v/2+z*w);return g-=z*w,f-=z*w,di(t,E,S,o,o,0,g/U,f/U,x,h,l,d)},arc:(t,e,i,s,r,n,a,o,h,l)=>di(t,e,i,s,s,0,r,n,a,o,h,l),ellipse(t,e,i,s,r,n,a,o,h,l,d,c){const u=n*U,_=Ye(u),p=Xe(u);let g=a*U,f=o*U;g>Ge&&(g-=N),f<0&&(f+=N);let y=f-g;y<0?y+=N:y>N&&(y-=N),h&&(y-=N);const m=qe(Ve(y/z)),v=y/m,x=Ye(v/4),w=8/3*x*x/Ye(v/2);f=g+v;let b,E,S,P,B,k,T,R,C=Xe(g),L=Ye(g),A=S=p*s*C-_*r*L,D=P=_*s*C+p*r*L,O=e+S,I=i+P;t&&t.push(t.length?ii:ei,O,I),l&&Qe(l,O,I),c&&$e(c,O,I);for(let n=0;n<m;n++)b=Xe(f),E=Ye(f),S=p*s*b-_*r*E,P=_*s*b+p*r*E,B=e+A-w*(p*s*L+_*r*C),k=i+D-w*(_*s*L-p*r*C),T=e+S+w*(p*s*E+_*r*b),R=i+P+w*(_*s*E-p*r*b),t&&t.push(si,B,k,T,R,e+S,i+P),l&&li(e+A,i+D,B,k,T,R,e+S,i+P,l,!0),A=S,D=P,C=b,L=E,g=f,f+=v;d&&$e(d,e+S,i+P)},quadraticCurveTo(t,e,i,s,r,n,a){t.push(si,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(a+2*r)/3,n,a)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,a,o){li(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,a,o)},toTwoPointBounds(t,e,i,s,r,n,a,o,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,x=i,w=r,b=a;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=n,b=o),c=-3*v+9*x-9*w+3*b,u=6*v-12*x+6*w,_=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Je(h,t,e):Qe(h,t,e),Je(h,a,o);for(let l=0,c=d.length;l<c;l++)hi(d[l],t,e,i,s,r,n,a,o,ai),Je(h,ai.x,ai.y)},getPointAndSet(t,e,i,s,r,n,a,o,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*o,l.y=c*i+u*r+_*a+p*h},getPoint(t,e,i,s,r,n,a,o,h){const l={};return hi(t,e,i,s,r,n,a,o,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)}},{getPointAndSet:hi,toTwoPointBounds:li,ellipse:di}=oi,{sin:ci,cos:ui,sqrt:_i,atan2:pi}=Math,{ellipse:gi}=oi,fi={ellipticalArc(t,e,i,s,r,n,a,o,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=n*U,p=ci(_),g=ui(_),f=-g*c-p*u,y=-g*u+p*c,v=s*s,x=r*r,w=y*y,b=f*f,E=v*x-v*w-x*b;let S=0;if(E<0){const t=_i(1-E/(v*x));s*=t,r*=t}else S=(a===o?-1:1)*_i(E/(v*w+x*b));const P=S*s*y/r,B=-S*r*f/s,k=pi((y-B)/r,(f-P)/s),T=pi((-y-B)/r,(-f-P)/s);let R=T-k;0===o&&R>0?R-=N:1===o&&R<0&&(R+=N);const C=e+c+g*P-p*B,L=i+u+p*P+g*B,A=R<0?1:0;d||m.ellipseToCurve?gi(t,C,L,s,r,n,k/U,T/U,A):s!==r||n?t.push(Oe.G,C,L,s,r,n,k/U,T/U,A):t.push(Oe.O,C,L,s,k/U,T/U,A)}},yi={toCommand:t=>[],toNode:t=>[]},{M:mi,m:vi,L:xi,l:wi,H:bi,h:Ei,V:Si,v:Pi,C:Bi,c:ki,S:Ti,s:Ri,Q:Ci,q:Li,T:Ai,t:Di,A:Oi,a:Ii,Z:Fi,z:Mi,N:Wi,D:Ui,X:Ni,G:zi,F:Yi,O:Xi,P:Hi,U:ji}=Oe,{rect:qi,roundRect:Vi,arcTo:Gi,arc:Ki,ellipse:Zi,quadraticCurveTo:Qi}=oi,{ellipticalArc:Ji}=fi,$i=te.get("PathConvert"),ts={},es={current:{dot:0},stringify(t,e){let i,s,r,n=0,a=t.length,o="";for(;n<a;){s=t[n],i=Ne[s],o+=s===r?" ":Ue[s];for(let s=1;s<i;s++)o+=M.float(t[n+s],e),s===i-1||(o+=" ");r=s,n+=i}return o},parse(t,e){let i,s,r,n="";const a=[],o=e?Me:Fe;for(let e=0,h=t.length;e<h;e++)s=t[e],Jt[s]?("."===s&&(is.dot&&(ss(a,n),n=""),is.dot++),"0"===n&&"."!==s&&(ss(a,n),n=""),n+=s):Oe[s]?(n&&(ss(a,n),n=""),is.name=Oe[s],is.length=Ie[s],is.index=0,ss(a,is.name),!i&&o[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&ss(a,n),n=s):n&&(ss(a,n),n=""),r=s;return n&&ss(a,n),i?es.toCanvasData(a,e):a},toCanvasData(t,e){let i,s,r,n,a,o=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case vi:t[c+1]+=o,t[c+2]+=h;case mi:o=t[c+1],h=t[c+2],_.push(mi,o,h),c+=3;break;case Ei:t[c+1]+=o;case bi:o=t[c+1],_.push(xi,o,h),c+=2;break;case Pi:t[c+1]+=h;case Si:h=t[c+1],_.push(xi,o,h),c+=2;break;case wi:t[c+1]+=o,t[c+2]+=h;case xi:o=t[c+1],h=t[c+2],_.push(xi,o,h),c+=3;break;case Ri:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Ti;case Ti:a=n===Bi||n===Ti,l=a?2*o-i:t[c+1],d=a?2*h-s:t[c+2],i=t[c+1],s=t[c+2],o=t[c+3],h=t[c+4],_.push(Bi,l,d,i,s,o,h),c+=5;break;case ki:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,t[c+5]+=o,t[c+6]+=h,r=Bi;case Bi:i=t[c+3],s=t[c+4],o=t[c+5],h=t[c+6],_.push(Bi,t[c+1],t[c+2],i,s,o,h),c+=7;break;case Di:t[c+1]+=o,t[c+2]+=h,r=Ai;case Ai:a=n===Ci||n===Ai,i=a?2*o-i:t[c+1],s=a?2*h-s:t[c+2],e?Qi(_,o,h,i,s,t[c+1],t[c+2]):_.push(Ci,i,s,t[c+1],t[c+2]),o=t[c+1],h=t[c+2],c+=3;break;case Li:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Ci;case Ci:i=t[c+1],s=t[c+2],e?Qi(_,o,h,i,s,t[c+3],t[c+4]):_.push(Ci,i,s,t[c+3],t[c+4]),o=t[c+3],h=t[c+4],c+=5;break;case Ii:t[c+6]+=o,t[c+7]+=h;case Oi:Ji(_,o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),o=t[c+6],h=t[c+7],c+=8;break;case Mi:case Fi:_.push(Fi),c++;break;case Wi:o=t[c+1],h=t[c+2],e?qi(_,o,h,t[c+3],t[c+4]):rs(_,t,c,5),c+=5;break;case Ui:o=t[c+1],h=t[c+2],e?Vi(_,o,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):rs(_,t,c,9),c+=9;break;case Ni:o=t[c+1],h=t[c+2],e?Vi(_,o,h,t[c+3],t[c+4],t[c+5]):rs(_,t,c,6),c+=6;break;case zi:Zi(e?_:rs(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,ts),o=ts.x,h=ts.y,c+=9;break;case Yi:e?Zi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):rs(_,t,c,5),o=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Xi:Ki(e?_:rs(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,ts),o=ts.x,h=ts.y,c+=7;break;case Hi:e?Ki(_,t[c+1],t[c+2],t[c+3],0,360,!1):rs(_,t,c,4),o=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case ji:Gi(e?_:rs(_,t,c,6),o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,ts),o=ts.x,h=ts.y,c+=6;break;default:return $i.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return yi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(mi,t.x,t.y);break;case"L":e.push(xi,t.x,t.y);break;case"C":e.push(Bi,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ci,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Fi)}}),e}},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){is.index===is.length&&(is.index=1,t.push(is.name)),t.push(Number(e)),is.index++,is.dot=0}},{current:is,pushData:ss,copyData:rs}=es,{M:ns,L:as,C:os,Q:hs,Z:ls,N:ds,D:cs,X:us,G:_s,F:ps,O:gs,P:fs,U:ys}=Oe,{getMinDistanceFrom:ms,getRadianFrom:vs}=dt,{tan:xs,min:ws,abs:bs}=Math,Es={},Ss={beginPath(t){t.length=0},moveTo(t,e,i){t.push(ns,e,i)},lineTo(t,e,i){t.push(as,e,i)},bezierCurveTo(t,e,i,s,r,n,a){t.push(os,e,i,s,r,n,a)},quadraticCurveTo(t,e,i,s,r){t.push(hs,e,i,s,r)},closePath(t){t.push(ls)},rect(t,e,i,s,r){t.push(ds,e,i,s,r)},roundRect(t,e,i,s,r,n){if(h(n))t.push(us,e,i,s,r,n);else{const a=M.fourNumber(n);a?t.push(cs,e,i,s,r,...a):t.push(ds,e,i,s,r)}},ellipse(t,e,i,s,r,a,o,h,l){if(s===r)return Bs(t,e,i,s,o,h,l);n(a)?t.push(ps,e,i,s,r):(n(o)&&(o=0),n(h)&&(h=360),t.push(_s,e,i,s,r,a,o,h,l?1:0))},arc(t,e,i,s,r,a,o){n(r)?t.push(fs,e,i,s):(n(r)&&(r=0),n(a)&&(a=360),t.push(gs,e,i,s,r,a,o?1:0))},arcTo(t,e,i,s,n,a,o,h){if(!r(o)){const t=ms(o,h,e,i,s,n);a=ws(a,ws(t/2,t/2*bs(xs(vs(o,h,e,i,s,n)/2))))}t.push(ys,e,i,s,n,a)},drawEllipse(t,e,i,s,r,a,o,h,l){oi.ellipse(null,e,i,s,r,n(a)?0:a,n(o)?0:o,n(h)?360:h,l,null,null,Es),t.push(ns,Es.x,Es.y),Ps(t,e,i,s,r,a,o,h,l)},drawArc(t,e,i,s,r,a,o){oi.arc(null,e,i,s,n(r)?0:r,n(a)?360:a,o,null,null,Es),t.push(ns,Es.x,Es.y),Bs(t,e,i,s,r,a,o)},drawPoints(t,e,i,s){oi.points(t,e,i,s)}},{ellipse:Ps,arc:Bs}=Ss,{moveTo:ks,lineTo:Ts,quadraticCurveTo:Rs,bezierCurveTo:Cs,closePath:Ls,beginPath:As,rect:Ds,roundRect:Os,ellipse:Is,arc:Fs,arcTo:Ms,drawEllipse:Ws,drawArc:Us,drawPoints:Ns}=Ss;class zs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?Ae.parse(t):t:[],this}beginPath(){return As(this.__path),this.paint(),this}moveTo(t,e){return ks(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ts(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return Cs(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Rs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ls(this.__path),this.paint(),this}rect(t,e,i,s){return Ds(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return Os(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,a,o){return Is(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}arc(t,e,i,s,r,n){return Fs(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return Ms(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,a,o){return Ws(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}drawArc(t,e,i,s,r,n){return Us(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return Ns(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ys,L:Xs,C:Hs,Q:js,Z:qs,N:Vs,D:Gs,X:Ks,G:Zs,F:Qs,O:Js,P:$s,U:tr}=Oe,er=te.get("PathDrawer"),ir={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Ys:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Xs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Hs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case js:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case qs:t.closePath(),s+=1;break;case Vs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Ks:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Zs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*U,e[s+6]*U,e[s+7]*U,e[s+8]),s+=9;break;case Qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,N,!1),s+=5;break;case Js:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*U,e[s+5]*U,e[s+6]),s+=7;break;case $s:t.arc(e[s+1],e[s+2],e[s+3],0,N,!1),s+=4;break;case tr:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void er.error(`command: ${i} [index:${s}]`,e)}}},{M:sr,L:rr,C:nr,Q:ar,Z:or,N:hr,D:lr,X:dr,G:cr,F:ur,O:_r,P:pr,U:gr}=Oe,{toTwoPointBounds:fr,toTwoPointBoundsByQuadraticCurve:yr,arcTo:mr,arc:vr,ellipse:xr}=oi,{addPointBounds:wr,copy:br,addPoint:Er,setPoint:Sr,addBounds:Pr,toBounds:Br}=xt,kr=te.get("PathBounds");let Tr,Rr,Cr;const Lr={},Ar={},Dr={},Or={toBounds(t,e){Or.toTwoPointBounds(t,Ar),Br(Ar,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Sr(e,0,0);let i,s,r,n,a,o=0,h=0,l=0;const d=t.length;for(;o<d;)switch(a=t[o],0===o&&(a===or||a===nr||a===ar?Sr(e,h,l):Sr(e,t[o+1],t[o+2])),a){case sr:case rr:h=t[o+1],l=t[o+2],Er(e,h,l),o+=3;break;case nr:r=t[o+5],n=t[o+6],fr(h,l,t[o+1],t[o+2],t[o+3],t[o+4],r,n,Lr),wr(e,Lr),h=r,l=n,o+=7;break;case ar:i=t[o+1],s=t[o+2],r=t[o+3],n=t[o+4],yr(h,l,i,s,r,n,Lr),wr(e,Lr),h=r,l=n,o+=5;break;case or:o+=1;break;case hr:h=t[o+1],l=t[o+2],Pr(e,h,l,t[o+3],t[o+4]),o+=5;break;case lr:case dr:h=t[o+1],l=t[o+2],Pr(e,h,l,t[o+3],t[o+4]),o+=a===lr?9:6;break;case cr:xr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],t[o+7],t[o+8],Lr,Dr),0===o?br(e,Lr):wr(e,Lr),h=Dr.x,l=Dr.y,o+=9;break;case ur:h=t[o+1],l=t[o+2],Rr=t[o+3],Cr=t[o+4],Pr(e,h-Rr,l-Cr,2*Rr,2*Cr),h+=Rr,o+=5;break;case _r:vr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],Lr,Dr),0===o?br(e,Lr):wr(e,Lr),h=Dr.x,l=Dr.y,o+=7;break;case pr:h=t[o+1],l=t[o+2],Tr=t[o+3],Pr(e,h-Tr,l-Tr,2*Tr,2*Tr),h+=Tr,o+=4;break;case gr:mr(null,h,l,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],Lr,Dr),0===o?br(e,Lr):wr(e,Lr),h=Dr.x,l=Dr.y,o+=6;break;default:return void kr.error(`command: ${a} [index:${o}]`,t)}}},{M:Ir,L:Fr,Z:Mr}=Oe,{getCenterX:Wr,getCenterY:Ur}=dt,{arcTo:Nr}=Ss,zr={smooth(t,e,i){let s,r,n,a=0,o=0,h=0,l=0,c=0,u=0,_=0,p=0,g=0;d(e)&&(e=e[0]||0);const f=t.length,y=[];for(;a<f;){switch(s=t[a],s){case Ir:l=p=t[a+1],c=g=t[a+2],a+=3,t[a]===Fr?(u=t[a+1],_=t[a+2],y.push(Ir,Wr(l,u),Ur(c,_))):y.push(Ir,l,c);break;case Fr:switch(o=t[a+1],h=t[a+2],a+=3,t[a]){case Fr:Nr(y,o,h,t[a+1],t[a+2],e,p,g);break;case Mr:Nr(y,o,h,l,c,e,p,g);break;default:y.push(Fr,o,h)}p=o,g=h;break;case Mr:r!==Mr&&(Nr(y,l,c,u,_,e,p,g),y.push(Mr)),a+=1;break;default:n=Ne[s];for(let e=0;e<n;e++)y.push(t[a+e]);a+=n}r=s}return s!==Mr&&(y[1]=l,y[2]=c),y}};function Yr(t){return new zs(t)}const Xr=Yr();Ae.creator=Yr(),Ae.parse=es.parse,Ae.convertToCanvasData=es.toCanvasData;const{drawRoundRect:Hr}=ze;function jr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){Hr(this,t,e,i,s,r)})}(t)}const qr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Vr.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},Vr=qr;Vr.alphaPixelTypes.forEach(t=>Vr.upperCaseTypeMap[t]=t.toUpperCase());const Gr=te.get("TaskProcessor");class Kr{constructor(t){this.parallel=!0,this.time=1,this.id=x.create(x.TASK),this.task=t}run(){return ye(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Gr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Zr{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&_.assign(this.config,t),this.empty()}add(t,e,i){let s,n,a,o;const l=new Kr(t);return l.parent=this,h(e)?o=e:e&&(n=e.parallel,s=e.start,a=e.time,o=e.delay,i||(i=e.canUse)),a&&(l.time=a),!1===n&&(l.parallel=!1),i&&(l.canUse=i),r(o)?this.push(l,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,s))},o)),this.isComplete=!1,l}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=s+e.parallel;if(r>i.length&&(r=i.length),e.parallel>1)for(let e=s;e<r&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Qr=te.get("Resource"),Jr={tasker:new Zr,map:{},get isComplete(){return $r.tasker.isComplete},set(t,e){$r.map[t]&&Qr.repeat(t),$r.map[t]=e},get:t=>$r.map[t],remove(t){const e=$r.map[t];e&&(e.destroy&&e.destroy(),delete $r.map[t])},loadImage(t,e){return new Promise((i,s)=>{const r=this.setImage(t,t,e);r.load(()=>i(r),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=he.image(s)),$r.set(t,e),e},destroy(){$r.map={}}},$r=Jr,tn={maxRecycled:10,recycledList:[],patternTasker:new Zr({parallel:1}),get(t){let e=Jr.get(t.url);return e||Jr.set(t.url,e=he.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(m.image.isLarge(t)?t.url&&Jr.remove(t.url):(t.clearLevels(),en.recycledList.push(t)))})},recyclePaint(t){en.recycle(t.image)},clearRecycled(t){const e=en.recycledList;(e.length>en.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&Jr.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>qr.alphaPixelTypes.some(e=>en.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+qr.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+qr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},en=tn,{IMAGE:sn,create:rn}=x;class nn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=rn(sn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}tn.isFormat("svg",t)&&(this.isSVG=!0),tn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;Jr.tasker.add(()=>ye(this,void 0,void 0,function*(){return yield m.origin.loadImage(this.url,r(t)?m.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,r,n,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const o=m.image.resize(this.view,t,e,r,n,void 0,a,i,s);return this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(t,e,i,s){const r=m.canvas.createPattern(t,e);return m.image.setPatternTransform(r,i,s),r}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function an(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function on(t,e){return Object.getOwnPropertyDescriptor(t,e)}function hn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function ln(t,e){return(i,s)=>cn(i,s,t,e&&e(s))}function dn(t){return t}function cn(t,e,i,s){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};an(t,e,Object.assign(r,s||{})),Un(t,e,i)}function un(t){return ln(t)}function _n(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function pn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function gn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),xn(this))}}))}function fn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function yn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function mn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&xn(this)}}))}function vn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(xn(this),this.__.__removeNaturalSize())}}))}function xn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function wn(t){return ln(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),xn(this)}}))}const bn=mn;function En(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i)&&(Sn(this),e&&(this.__.__useStroke=!0))}}))}function Sn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&xn(t)}const Pn=En;function Bn(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function kn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Tn(t){return ln(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;_.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Rn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Ln(this)}}))}function Cn(t){return ln(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>An(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");An(this,t,e,i),this.mask&&Ln(this)}}))}function Ln(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function An(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||xn(t))}function Dn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function On(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function In(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Fn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===te.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Mn(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Wn(t){return(e,i)=>{an(e,"__DataProcessor",{get:()=>t})}}function Un(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,a=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o=hn(e,i);if(r(i))o.get=function(){return this[n]};else if("function"==typeof i)o.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(c(i)){const t=u(i);o.get=function(){const e=this[n];return null==e?this[n]=t?{}:_.clone(i):e}}const h=t.isBranchLeaf;"width"===e?o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=on(d,e),d=d.__proto__;l&&l.set&&(o.set=l.set),s[a]&&(o.set=s[a],delete s[a]),an(s,e,o)}const Nn=new te("rewrite"),zn=[],Yn=["destroy","constructor"];function Xn(t){return(e,i)=>{zn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Hn(){return t=>{jn()}}function jn(t){zn.length&&(zn.forEach(e=>{t&&Nn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),zn.length=0)}function qn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Yn.includes(s)||e&&e.includes(s)))if(t.prototype){on(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Vn(){return t=>{de.register(t)}}function Gn(){return t=>{_e.register(t)}}setTimeout(()=>jn(!0));const{copy:Kn,toInnerPoint:Zn,toOuterPoint:Qn,scaleOfOuter:Jn,rotateOfOuter:$n,skewOfOuter:ta,multiplyParent:ea,divideParent:ia,getLayout:sa}=J,ra={},{round:na}=Math,aa={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),la(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)ha(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)da(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&da(t),t.__updateChange()},updateAllChange(t){if(ua(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ca(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,r,n){s||(s=t.__nowWorld),t.__worldFlipped||m.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,r,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,r){const n=c(e)?Object.assign({},e):{x:e,y:i};s?Qn(t.localTransform,n,n,!0):t.parent&&Zn(t.parent.scrollWorldTransform,n,n,!0),oa.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,i=0,s){c(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=na(e),i=na(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,n){oa.zoomOfLocal(t,_a(t,e),i,s,r,n)},zoomOfLocal(t,e,i,s=i,r,n){const a=t.__localMatrix;if(h(s)||(s&&(n=s),s=i),Kn(ra,a),Jn(ra,e,i,s),oa.hasHighPosition(t))oa.setTransform(t,ra,r,n);else{const e=t.x+ra.e-a.e,o=t.y+ra.f-a.f;n&&!r?t.animate({x:e,y:o,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=o,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){oa.rotateOfLocal(t,_a(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;Kn(ra,r),$n(ra,e,i),oa.hasHighPosition(t)?oa.setTransform(t,ra,!1,s):t.set({x:t.x+ra.e-r.e,y:t.y+ra.f-r.f,rotation:M.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,n){oa.skewOfLocal(t,_a(t,e),i,s,r,n)},skewOfLocal(t,e,i,s=0,r,n){Kn(ra,t.__localMatrix),ta(ra,e,i,s),oa.setTransform(t,ra,r,n)},transformWorld(t,e,i,s){Kn(ra,t.worldTransform),ea(ra,e),t.parent&&ia(ra,t.parent.scrollWorldTransform),oa.setTransform(t,ra,i,s)},transform(t,e,i,s){Kn(ra,t.localTransform),ea(ra,e),oa.setTransform(t,ra,i,s)},setTransform(t,e,i,s){const r=t.__,n=r.origin&&oa.getInnerOrigin(t,r.origin),a=sa(e,n,r.around&&oa.getInnerOrigin(t,r.around));if(oa.hasOffset(t)&&(a.x-=r.offsetX,a.y-=r.offsetY),i){const e=a.scaleX/t.scaleX,i=a.scaleY/t.scaleY;if(delete a.scaleX,delete a.scaleY,n){jt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=oa.getInnerOrigin(t,r.origin);dt.move(a,n.x-s.x,n.y-s.y)}t.set(a),t.scaleResize(e,i,!1)}else t.set(a,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Jn(i,oa.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>dt.tempToOuterOf(oa.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Pt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Kn(ra,t.worldTransform),ia(ra,e.scrollWorldTransform),i?ra:Object.assign({},ra)),drop(t,e,i,s){t.setTransform(oa.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||oa.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,r=e.y*i;e.x-=s,e.y-=r,t.move(s,r),m.requestRender(()=>oa.animateMove(t,e,i))}}},oa=aa,{updateAllMatrix:ha,updateMatrix:la,updateAllWorldOpacity:da,updateAllChange:ca,updateChange:ua}=oa;function _a(t,e){return t.updateLayout(),t.parent?dt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const pa={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>fa(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>fa(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>fa(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let ga;function fa(t,e){return e||(ga=0),t.__.mask&&(ga=1),ga<0?null:(ga&&(ga=-1),!0)}const{updateBounds:ya}=aa,ma={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,r=i.length;s<r;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),va(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&r(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)xa(e[t],e)},updateBounds(t,e){const i=[t];xa(t,i),wa(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let r=t.length-1;r>-1;r--){i=t[r],s=i.children;for(let t=0,e=s.length;t<e;t++)ya(s[t]);e&&e===i||ya(i)}},move(t,e,i){let s;const{children:r}=t;for(let n=0,a=r.length;n<a;n++)s=(t=r[n]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&ba(t,e,i)},scale(t,e,i,s,r,n,a){let o;const{children:h}=t,l=s-1,d=r-1;for(let c=0,u=h.length;c<u;c++)o=(t=h[c]).__world,o.a*=s,o.d*=r,(o.b||o.c)&&(o.b*=s,o.c*=r),o.e===o.x&&o.f===o.y?(o.x=o.e+=(o.e-n)*l+e,o.y=o.f+=(o.f-a)*d+i):(o.e+=(o.e-n)*l+e,o.f+=(o.f-a)*d+i,o.x+=(o.x-n)*l+e,o.y+=(o.y-a)*d+i),o.width*=s,o.height*=r,o.scaleX*=s,o.scaleY*=r,t.isBranch&&Ea(t,e,i,s,r,n,a)}},{pushAllChildBranch:va,pushAllBranchStack:xa,updateBoundsByBranchStack:wa,move:ba,scale:Ea}=ma,Sa={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Pa,updateBounds:Ba}=aa,{toOuterOf:ka,getPoints:Ta,copy:Ra}=jt,Ca="_localContentBounds",La="_worldContentBounds",Aa="_worldBoxBounds",Da="_worldStrokeBounds";class Oa{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return ka(this.contentBounds,this.leaf.__localMatrix,this[Ca]||(this[Ca]={})),this[Ca]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return ka(this.contentBounds,this.leaf.__world,this[La]||(this[La]={})),this[La]}get worldBoxBounds(){return ka(this.boxBounds,this.leaf.__world,this[Aa]||(this[Aa]={})),this[Aa]}get worldStrokeBounds(){return ka(this.strokeBounds,this.leaf.__world,this[Da]||(this[Da]={})),this[Da]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return Ba(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,m.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return J.defaultMatrix;case"page":t=e.zoomLayer;default:return Pa(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Kt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let r,n,a,o=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(o),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;a={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(o);break;case"inner":r=o,n=J.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(o,e),n=Pa(s,e,!0)}if(a||(a=J.getLayout(n)),Ra(a,o),dt.copy(a,r),i){const{scaleX:t,scaleY:e}=a,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(a.scaleX/=i,a.scaleY/=s,a.width*=i,a.height*=s)}return a}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Ta(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return r(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Ia{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&m.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&m.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&m.event.stop(this.origin)}}class Fa extends Ia{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Fa.ADD="child.add",Fa.REMOVE="child.remove",Fa.CREATED="created",Fa.MOUNTED="mounted",Fa.UNMOUNTED="unmounted",Fa.DESTROY="destroy";const Ma="property.scroll";class Wa extends Ia{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}}Wa.CHANGE="property.change",Wa.LEAFER_CHANGE="property.leafer_change",Wa.SCROLL=Ma;const Ua={scrollX:Ma,scrollY:Ma};class Na extends Ia{constructor(t,e){super(t),Object.assign(this,e)}}Na.LOAD="image.load",Na.LOADED="image.loaded",Na.ERROR="image.error";class za extends Ia{static checkHas(t,e,i){"on"===i?e===ja?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Ya)||t.hasEvent(Xa)||t.hasEvent(Ha),t.__hasWorldEvent=t.hasEvent(ja))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Ya,t),"inner"===e&&t.emit(Xa,t)),t.emit(Ha,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(ja,this)}}za.RESIZE="bounds.resize",za.INNER="bounds.inner",za.LOCAL="bounds.local",za.WORLD="bounds.world";const{RESIZE:Ya,INNER:Xa,LOCAL:Ha,WORLD:ja}=za,qa={};[Ya,Xa,Ha,ja].forEach(t=>qa[t]=1);class Va extends Ia{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){c(t)?(super(Va.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!r(this.resizingKeys[t.innerId])}}Va.RESIZE="resize";class Ga extends Ia{constructor(t,e){super(t),this.data=e}}Ga.REQUEST="watch.request",Ga.DATA="watch.data";class Ka extends Ia{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Ka.REQUEST="layout.request",Ka.START="layout.start",Ka.BEFORE="layout.before",Ka.LAYOUT="layout",Ka.AFTER="layout.after",Ka.AGAIN="layout.again",Ka.END="layout.end";class Za extends Ia{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Za.REQUEST="render.request",Za.CHILD_START="render.child_start",Za.CHILD_END="render.child_end",Za.START="render.start",Za.BEFORE="render.before",Za.RENDER="render",Za.AFTER="render.after",Za.AGAIN="render.again",Za.END="render.end",Za.NEXT="render.next";class Qa extends Ia{}Qa.START="leafer.start",Qa.BEFORE_READY="leafer.before_ready",Qa.READY="leafer.ready",Qa.AFTER_READY="leafer.after_ready",Qa.VIEW_READY="leafer.view_ready",Qa.VIEW_COMPLETED="leafer.view_completed",Qa.STOP="leafer.stop",Qa.RESTART="leafer.restart",Qa.END="leafer.end",Qa.UPDATE_MODE="leafer.update_mode",Qa.TRANSFORM="leafer.transform",Qa.MOVE="leafer.move",Qa.SCALE="leafer.scale",Qa.ROTATE="leafer.rotate",Qa.SKEW="leafer.skew";const{MOVE:Ja,SCALE:$a,ROTATE:to,SKEW:eo}=Qa,io={x:Ja,y:Ja,scaleX:$a,scaleY:$a,rotation:to,skewX:eo,skewY:eo},so={};class ro{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,r,n;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const o=no(this,s,!0),h=a(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(n=o[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(l):o[t]=[l],qa[t]&&za.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,r,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const a=no(this,t);s.forEach(t=>{t&&(r=a[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete a[t],qa[t]&&za.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&_e.has(t)&&(e=_e.get(t,{type:t,target:this,current:this}));const s=no(this,i)[t];if(s){let r;for(let n=0,a=s.length;n<a&&!((r=s[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),n--,a--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],a=s&&s[t];return!!(r(e)?n||a:e?a:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function no(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:so)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:so)}}const{on:ao,on_:oo,off:ho,off_:lo,once:co,emit:uo,emitEvent:_o,hasEvent:po,destroy:go}=ro.prototype,fo={on:ao,on_:oo,off:ho,off_:lo,once:co,emit:uo,emitEvent:_o,hasEvent:po,destroyEventer:go},yo=te.get("setAttr"),mo={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||o(e)||r(e)||(yo.warn(this.innerName,t,e),e=void 0),c(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Wa(Wa.LEAFER_CHANGE,this,t,s,e));const i=io[t];i&&(this.emitEvent(new Qa(i,this)),this.emitEvent(new Qa(Qa.TRANSFORM,this)))}this.emitPropertyEvent(Wa.CHANGE,t,s,e);const i=Ua[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const r=new Wa(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||r(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:vo,multiplyParent:xo,translateInner:wo,defaultWorld:bo}=J,{toPoint:Eo,tempPoint:So}=Pt,Po={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:r}=this;xo(this.__local||e,t?t.__scrollWorld||t.__world:bo,i,!!e.affectScaleOrRotation,r),s&&wo(Object.assign(s,i),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(vo(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Eo(i.around||i.origin,t.boxBounds,So),wo(e,-So.x,-So.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Bo,updateAllMatrix:ko}=aa,{updateBounds:To}=ma,{toOuterOf:Ro,copyAndSpread:Co,copy:Lo}=jt,{toBounds:Ao}=Or,Do={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ro(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&za.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&za.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Ro(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ro(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ro(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Ao(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ko(this),To(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ko(this),To(this,this))):Bo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Co(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;h(i)&&i<=0?Lo(e.renderBounds,e.strokeBounds):Co(e.renderBounds,e.boxBounds,i)}},Oo={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),aa.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);te.showBounds&&te.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Io}=pa,Fo={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,r,r,i.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Io(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Io(i[s],e)||i[s].__clip(t,e)}}},Mo={},{LEAF:Wo,create:Uo}=x,{stintSet:No}=_,{toInnerPoint:zo,toOuterPoint:Yo,multiplyParent:Xo}=J,{toOuterOf:Ho}=jt,{copy:jo,move:qo}=dt,{moveLocal:Vo,zoomOfLocal:Go,rotateOfLocal:Ko,skewOfLocal:Zo,moveWorld:Qo,zoomOfWorld:Jo,rotateOfWorld:$o,skewOfWorld:th,transform:eh,transformWorld:ih,setTransform:sh,getFlipTransform:rh,getLocalOrigin:nh,getRelativeWorld:ah,drop:oh}=aa;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return g}get __LayoutProcessor(){return Oa}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Uo(Wo),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Fa.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(Fa.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Fa.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(Fa.MOUNTED)):this.__emitLifeEvent(Fa.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){r(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=r(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Xo(i,t.matrix,e,void 0,i),Ho(this.__layout.renderBounds,e,e),No(e,"half",i.half),No(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=tn.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Mo.scaleX=i,Mo.scaleY=s,Mo}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?ah(this,e):this.worldTransform,r=i?t:{};return Ho(t,s,r),r}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&jo(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&jo(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),zo(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Yo(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return qo(r,-n,-a),r}getInnerPoint(t,e,i,s){const r=s?t:{};return this.worldToInner(t,r,i,e),r}getInnerPointByBox(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return qo(r,n,a),r}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const r=s?t:{};return this.worldToLocal(t,r,i,e),r}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const r=s?t:{};return this.innerToWorld(t,r,i,e),r}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const r=s?t:{};return this.localToWorld(t,r,i,e),r}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){sh(this,t,e,i)}transform(t,e,i){eh(this,t,e,i)}move(t,e,i){Vo(this,t,e,i)}moveInner(t,e,i){Qo(this,t,e,!0,i)}scaleOf(t,e,i,s,r){Go(this,nh(this,t),e,i,s,r)}rotateOf(t,e,i){Ko(this,nh(this,t),e,i)}skewOf(t,e,i,s,r){Zo(this,nh(this,t),e,i,s,r)}transformWorld(t,e,i){ih(this,t,e,i)}moveWorld(t,e,i){Qo(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){Jo(this,t,e,i,s,r)}rotateOfWorld(t,e){$o(this,t,e)}skewOfWorld(t,e,i,s,r){th(this,t,e,i,s,r)}flip(t,e){eh(this,rh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return oe.need("path")}getMotionPoint(t){return oe.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){oh(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Un(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=mn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Fa(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Fa.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=fe([qn(mo),qn(Po),qn(Do),qn(fo),qn(Oo)],t.Leaf);const{setListWithFn:hh}=jt,{sort:lh}=ma,{localBoxBounds:dh,localStrokeBounds:ch,localRenderBounds:uh,maskLocalBoxBounds:_h,maskLocalStrokeBounds:ph,maskLocalRenderBounds:gh}=pa,fh=new te("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){hh(e||this.__layout.boxBounds,this.children,this.__hasMask?_h:dh)}__updateStrokeBounds(t){hh(t||this.__layout.strokeBounds,this.children,this.__hasMask?ph:ch)}__updateRenderBounds(t){hh(t||this.__layout.renderBounds,this.children,this.__hasMask?gh:uh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(lh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return fh.warn("add self or destroyed");const i=r(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=de.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Fa.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Fa.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):r(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Fa.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Fa.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Fa(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=fe([qn(Fo)],t.Branch);class yh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!r(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return r(e)?-1:e}add(t){const{list:e,keys:i}=this;r(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(r(i[t.innerId])){const{list:s}=this;for(let t=e,r=s.length;t<r;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)r(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;r(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new yh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class mh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!r(this.keys[t.innerId])}without(t){return r(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class vh extends Le{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=m.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}jr(OffscreenCanvasRenderingContext2D.prototype),jr(Path2D.prototype);const{mineType:xh}=qr;function wh(t,e){m.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,r)=>{t.convertToBlob({type:xh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)}).catch(t=>{r(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:xh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",m.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},m.canvas=he.canvas(),m.conicGradientSupport=!!m.canvas.context.createConicGradient}Object.assign(he,{canvas:(t,e)=>new vh(t,e),image:t=>new nn(t)}),m.name="web",m.isWorker=!0,m.backgrounder=!0,m.requestRender=function(t){requestAnimationFrame(t)},an(m,"devicePixelRatio",{get:()=>1});const{userAgent:bh}=navigator;bh.indexOf("Firefox")>-1?(m.conicGradientRotate90=!0,m.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(m.fullImageShadow=!0),bh.indexOf("Windows")>-1?(m.os="Windows",m.intWheelDeltaY=!0):bh.indexOf("Mac")>-1?m.os="Mac":bh.indexOf("Linux")>-1&&(m.os="Linux");class Eh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new yh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new yh,this.target=t,e&&(this.config=_.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Za.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Fa.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Ga(Ga.DATA,{updatedList:this.updatedList})),this.__updatedList=new yh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Wa.CHANGE,this.__onAttrChange,this],[[Fa.ADD,Fa.REMOVE],this.__onChildEvent,this],[Ga.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Sh,updateBounds:Ph,updateChange:Bh}=aa,{pushAllChildBranch:kh,pushAllParent:Th}=ma;const{worldBounds:Rh}=pa;class Ch{constructor(t){this.updatedBounds=new Kt,this.beforeBounds=new Kt,this.afterBounds=new Kt,d(t)&&(t=new yh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Rh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Rh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Lh,updateAllChange:Ah}=aa,Dh=te.get("Layouter");class Oh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new mh,this.target=t,e&&(this.config=_.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(Ka.START),this.layoutOnce(),t.emitEvent(new Ka(Ka.END,this.layoutedBlocks,this.times))}catch(t){Dh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Dh.warn("layouting"):this.times>3?Dh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Ga.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=re.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:n,AFTER:a}=Ka,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),i.emitEvent(new Ka(r,o,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Sh(t,!0),e.add(t),t.isBranch&&kh(t,e),Th(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Th(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Ph(s[t])}Ph(i)}})}(this.__levelList),function(t){t.list.forEach(Bh)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),i.emitEvent(new Ka(n,o,this.times)),i.emitEvent(new Ka(a,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,re.end(e)}fullLayout(){const t=re.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:r}=Ka,n=this.getBlocks(new yh(e));e.emitEvent(new Ka(i,n,this.times)),Oh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Ka(s,n,this.times)),e.emitEvent(new Ka(r,n,this.times)),this.addBlocks(n),re.end(t)}static fullLayout(t){Lh(t,!0),t.isBranch?ma.updateBounds(t):aa.updateBounds(t),Ah(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ch([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ch(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[Ka.REQUEST,this.layout,this],[Ka.AGAIN,this.layoutAgain,this],[Ga.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Ih=te.get("Renderer");class Fh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=_.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(Ka.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Za.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Za.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Za.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Kt,Ih.log(e.innerName,"---\x3e");try{this.emitRender(Za.START),this.renderOnce(t),this.emitRender(Za.END,this.totalBounds),tn.clearRecycled()}catch(t){this.rendering=!1,Ih.error(t)}Ih.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ih.warn("rendering");if(this.times>3)return Ih.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Kt,this.renderOptions={},t)this.emitRender(Za.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Za.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Za.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Za.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=re.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),r=new Kt(s);i.save(),s.spread(Fh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,r),i.restore(),re.end(e)}fullRender(){const t=re.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),re.end(t)}__render(t,e){const{canvas:i,target:s}=this,r=t.includes(s.__world),n=r?{includes:r}:{bounds:t,includes:r};this.needFill&&i.fillWorld(t,this.config.fill),te.showRepaint&&te.drawRepaint(i,t),this.config.useCellRender&&(n.cellList=this.getCellList()),m.render(s,i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Kt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return m.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};m.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Kt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Kt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Ih.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Za(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Za.REQUEST,this.update,this],[Ka.END,this.__onLayoutEnd,this],[Za.AGAIN,this.renderAgain,this],[Va.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Fh.clipSpread=10;const Mh={},{copyRadiusPoint:Wh}=dt,{hitRadiusPoint:Uh}=jt;class Nh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,r=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new yh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:a}=this.findList,o=this.getBestMatchLeaf(a,i.bottomList,r,!!i.findList),h=r?this.getPath(o):this.getHitablePath(o);return this.clear(),s?{path:h,target:o,throughPath:a.length?this.getThroughPath(a):h}:{path:h,target:o}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const r=this.findList=new yh;if(t.length){let e;const{x:s,y:n}=this.point,a={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||aa.worldHittable(e))&&(this.hitChild(e,a),r.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&aa.hasParent(t,e))){r.reset();break}return r.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),r.length)return r.list[0];return s?null:i?t[0]:t.find(t=>aa.worldHittable(t))}getPath(t){const e=new yh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new yh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new yh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,r,n;for(let t=0,a=i.length;t<a;t++){s=i[t],r=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!r||!r.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,r;const{point:n}=this;for(let a=t.length-1;a>-1;a--)if(i=t[a],r=i.__,r.visible&&(!e||r.mask))if(s=Uh(i.__world,r.hitRadius?Wh(Mh,n,r.hitRadius):n),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&r.__clipAfterFill&&!i.__hitWorld(n,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)}}else s&&this.hitChild(i,n)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,r=[];const{children:n}=s;for(let s=0,a=n.length;s<a;s++)if(i=n[s],i.__.mask&&r.push(i),i===t){if(r&&!r.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class zh{constructor(t,e){this.config={},e&&(this.config=_.default(e,this.config)),this.picker=new Nh(this.target=t,this),this.finder=he.finder&&he.finder()}getByPoint(t,e,i){const{target:s,picker:r}=this;return m.backgrounder&&s&&s.updateLayout(),r.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):oe.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Yh(t){return ln(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Xh(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Hh(){return(t,e)=>{const i="_"+e;an(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(he,{watcher:(t,e)=>new Eh(t,e),layouter:(t,e)=>new Oh(t,e),renderer:(t,e,i)=>new Fh(t,e,i),selector:(t,e)=>new zh(t,e)}),m.layout=Oh.fullLayout,m.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new yh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const jh={},qh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Vh={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Gh={},Kh={},Zh={},Qh={},Jh={},$h={apply(){oe.need("filter")}},tl={},el={setStyleName:()=>oe.need("state"),set:()=>oe.need("state")},il={list:{},register(t,e){il.list[t]=e},get:t=>il.list[t]},{parse:sl,objectToCanvasData:rl}=es,{stintSet:nl}=_,{hasTransparent:al}=qh,ol={originPaint:{}},hl=te.get("UIData");class ll extends g{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,hl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,hl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(nl(this,"__isTransparentFill",al(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(nl(this,"__isTransparentStroke",al(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?sl(t):rl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){dl(this,"shadow",t)}setInnerShadow(t){dl(this,"innerShadow",t)}setFilter(t){dl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Kh.compute("fill",this.__leaf),e&&Kh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),r(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=ol)):(this.__isStrokes=!0,this._stroke||(this._stroke=ol))}__removePaint(t,e){e&&this.__removeInput(t),Zh.recycleImage(t,this),"fill"===t?(nl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(nl(this,"__isAlphaPixelStroke",void 0),nl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function dl(t,e,i){t.__setInput(e,i),d(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class cl extends ll{}class ul extends cl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class _l extends cl{__getInputData(t,e){const i=super.__getInputData(t,e);return Ce.forEach(t=>delete i[t]),i}}class pl extends ul{}class gl extends ll{get __usePathBox(){return this.points||this.__pathInputed}}class fl extends ll{get __boxStroke(){return!this.__pathInputed}}class yl extends ll{get __boxStroke(){return!this.__pathInputed}}class ml extends gl{}class vl extends ll{}class xl extends ll{get __pathInputed(){return 2}}class wl extends cl{}const bl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class El extends ll{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=bl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=de.get("Rect",0);const r=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=r.boxBounds),i.set(t),n.strokeChanged&&r.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Sl extends fl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Pl extends fl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:Bl,add:kl}=k,Tl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:r}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),n&&(t=Bl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n,renderSpread:a}=this.__,{strokeSpread:o}=this.__layout,h=this.__box;e&&(t=Jh.getShadowRenderSpread(this,e)),s&&(t=Bl(t,s)),n&&(t=kl(t,$h.getSpread(n))),a&&(t=kl(t,a)),o&&(t=kl(t,o));let l=t;return i&&(l=Bl(l,Jh.getInnerShadowSpread(this,i))),r&&(l=Bl(l,r)),this.__layout.renderShapeSpread=l,h?Bl(h.__updateRenderSpread(),t):t}},{stintSet:Rl}=_,Cl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Rl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Rl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Rl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Jh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),Rl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Ll(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:r,stroke:n,__drawAfterFill:a,__fillAfterStroke:o,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Kh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Jh.shadow(this,t,h),o&&(s.__isStrokes?Kh.strokes(n,this,t,e):Kh.stroke(n,this,t,e)),r&&(s.__isFills?Kh.fills(r,this,t,e):Kh.fill(r,this,t,e)),a&&this.__drawAfterFill(t,e),d&&Jh.innerShadow(this,t,h),n&&!o&&(s.__isStrokes?Kh.strokes(n,this,t,e):Kh.stroke(n,this,t,e)),c&&$h.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(o&&(s.__isStrokes?Kh.strokes(n,this,t,e):Kh.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*r,e.blur*i,qh.string(e.color))}r&&(s.__isFills?Kh.fills(r,this,t,e):Kh.fill(r,this,t,e)),h&&t.restore(),a&&this.__drawAfterFill(t,e),n&&!o&&(s.__isStrokes?Kh.strokes(n,this,t,e):Kh.stroke(n,this,t,e))}}else s.__pathForRender?Ll(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:r}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Kh.fills(s,this,t,e):Kh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Kh.strokes(r,this,t,e):Kh.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Ll(t,e,i){const{fill:s,stroke:r,__drawAfterFill:n,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Kh.stroke(r,t,e,i),s&&Kh.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),r&&!a&&Kh.stroke(r,t,e,i)}const Al={__drawFast(t,e){let{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;const{fill:a,stroke:o,__drawAfterFill:h}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,r,n)),h&&this.__drawAfterFill(t,e),o){const{strokeAlign:a,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(o,h,this.__);const l=h/2;switch(a){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,n),t.restore()):t.strokeRect(i+l,s+l,r,n);break;case"outside":t.strokeRect(i-l,s-l,r+h,n+h)}}}};var Dl,Ol;t.UI=Dl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){M.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Xr.set(this.path=t||[]),t||this.__drawPathByBox(Xr),Xr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return oe.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return oe.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Xr.set(i=[]),this.__drawPathByBox(Xr,!e)),t?es.toCanvasData(i,!0):i}getPathString(t,e,i){return es.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||tl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?zr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Gh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?ir.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,r,n,h(e)?[e]:e)}else t.rect(i,s,r,n);t.closePath()}drawImagePlaceholder(t,e,i){Kh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),oe.need("animate")}killAnimate(t,e){}export(t,e){return oe.need("export")}syncExport(t,e){return oe.need("export")}clone(t){const e=_.clone(this.toJSON());return t&&Object.assign(e,t),Dl.one(e)}static one(t,e,i,s,r){return de.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){Vn()(this)}static registerData(t){Wn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},fe([Wn(ll)],t.UI.prototype,"__",void 0),fe([Hh()],t.UI.prototype,"zoomLayer",void 0),fe([un("")],t.UI.prototype,"id",void 0),fe([un("")],t.UI.prototype,"name",void 0),fe([un("")],t.UI.prototype,"className",void 0),fe([kn("pass-through")],t.UI.prototype,"blendMode",void 0),fe([Rn(1)],t.UI.prototype,"opacity",void 0),fe([Cn(!0)],t.UI.prototype,"visible",void 0),fe([kn(!1)],t.UI.prototype,"locked",void 0),fe([Tn(!1)],t.UI.prototype,"dim",void 0),fe([Tn(!1)],t.UI.prototype,"dimskip",void 0),fe([Dn(0)],t.UI.prototype,"zIndex",void 0),fe([On(!1)],t.UI.prototype,"mask",void 0),fe([In(!1)],t.UI.prototype,"eraser",void 0),fe([_n(0,!0)],t.UI.prototype,"x",void 0),fe([_n(0,!0)],t.UI.prototype,"y",void 0),fe([mn(100,!0)],t.UI.prototype,"width",void 0),fe([mn(100,!0)],t.UI.prototype,"height",void 0),fe([fn(1,!0)],t.UI.prototype,"scaleX",void 0),fe([fn(1,!0)],t.UI.prototype,"scaleY",void 0),fe([yn(0,!0)],t.UI.prototype,"rotation",void 0),fe([yn(0,!0)],t.UI.prototype,"skewX",void 0),fe([yn(0,!0)],t.UI.prototype,"skewY",void 0),fe([_n(0,!0)],t.UI.prototype,"offsetX",void 0),fe([_n(0,!0)],t.UI.prototype,"offsetY",void 0),fe([pn(0,!0)],t.UI.prototype,"scrollX",void 0),fe([pn(0,!0)],t.UI.prototype,"scrollY",void 0),fe([gn()],t.UI.prototype,"origin",void 0),fe([gn()],t.UI.prototype,"around",void 0),fe([un(!1)],t.UI.prototype,"lazy",void 0),fe([vn(1)],t.UI.prototype,"pixelRatio",void 0),fe([Bn(0)],t.UI.prototype,"renderSpread",void 0),fe([wn()],t.UI.prototype,"path",void 0),fe([bn()],t.UI.prototype,"windingRule",void 0),fe([bn(!0)],t.UI.prototype,"closed",void 0),fe([mn(0)],t.UI.prototype,"padding",void 0),fe([mn(!1)],t.UI.prototype,"lockRatio",void 0),fe([mn()],t.UI.prototype,"widthRange",void 0),fe([mn()],t.UI.prototype,"heightRange",void 0),fe([un(!1)],t.UI.prototype,"draggable",void 0),fe([un()],t.UI.prototype,"dragBounds",void 0),fe([un("auto")],t.UI.prototype,"dragBoundsType",void 0),fe([un(!1)],t.UI.prototype,"editable",void 0),fe([Fn(!0)],t.UI.prototype,"hittable",void 0),fe([Fn("path")],t.UI.prototype,"hitFill",void 0),fe([Pn("path")],t.UI.prototype,"hitStroke",void 0),fe([Fn(!1)],t.UI.prototype,"hitBox",void 0),fe([Fn(!0)],t.UI.prototype,"hitChildren",void 0),fe([Fn(!0)],t.UI.prototype,"hitSelf",void 0),fe([Fn()],t.UI.prototype,"hitRadius",void 0),fe([Mn("")],t.UI.prototype,"cursor",void 0),fe([kn()],t.UI.prototype,"fill",void 0),fe([Pn(void 0,!0)],t.UI.prototype,"stroke",void 0),fe([Pn("inside")],t.UI.prototype,"strokeAlign",void 0),fe([Pn(1,!0)],t.UI.prototype,"strokeWidth",void 0),fe([Pn(!1)],t.UI.prototype,"strokeWidthFixed",void 0),fe([Pn("none")],t.UI.prototype,"strokeCap",void 0),fe([Pn("miter")],t.UI.prototype,"strokeJoin",void 0),fe([Pn()],t.UI.prototype,"dashPattern",void 0),fe([Pn(0)],t.UI.prototype,"dashOffset",void 0),fe([Pn(10)],t.UI.prototype,"miterLimit",void 0),fe([bn(0)],t.UI.prototype,"cornerRadius",void 0),fe([bn()],t.UI.prototype,"cornerSmoothing",void 0),fe([Yh()],t.UI.prototype,"shadow",void 0),fe([Yh()],t.UI.prototype,"innerShadow",void 0),fe([Yh()],t.UI.prototype,"blur",void 0),fe([Yh()],t.UI.prototype,"backgroundBlur",void 0),fe([Yh()],t.UI.prototype,"grayscale",void 0),fe([Yh()],t.UI.prototype,"filter",void 0),fe([kn()],t.UI.prototype,"placeholderColor",void 0),fe([un(100)],t.UI.prototype,"placeholderDelay",void 0),fe([un({})],t.UI.prototype,"data",void 0),fe([Xn(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Dl=fe([qn(Tl),qn(Cl),Hn()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},fe([Wn(cl)],t.Group.prototype,"__",void 0),fe([mn(0)],t.Group.prototype,"width",void 0),fe([mn(0)],t.Group.prototype,"height",void 0),t.Group=fe([qn(t.Branch),Vn()],t.Group);const Il=te.get("Leafer");t.Leafer=Ol=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Jr.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Ol.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,_.assign(s,t));const r=this.canvas=he.canvas(s);this.__controllers.push(this.renderer=he.renderer(this,r,s),this.watcher=he.watcher(this,s),this.layouter=he.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=he.selector(this),this.interaction=he.interaction(this,r,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=he.hitCanvasManager()),this.canvasManager=new ge,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(r),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Sa.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(Qa.RESTART):this.emitLeafer(Qa.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(Qa.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=_.copyAttrs({},t,Ce);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Kt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=_.copyAttrs({},this.canvas,Ce);e.resize(t),this.updateLazyBounds(),this.__onResize(new Va(t,i))}__onResize(t){this.emitEvent(t),_.copyAttrs(this.__,t,Ce),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Qt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Ce.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(Qa.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ce.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,r=_.copyAttrs({},s,Ce);r[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Qa.BEFORE_READY),this.emitLeafer(Qa.READY),this.emitLeafer(Qa.AFTER_READY),Sa.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Qa.VIEW_READY),Sa.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:n}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(r=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Sa.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(Qa.VIEW_COMPLETED),Sa.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return oe.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Qa(t,this))}__listenEvents(){const t=re.start("FirstCreate "+this.innerName);this.once([[Qa.START,()=>re.end(t)],[Ka.START,this.updateLazyBounds,this],[Za.START,this.__onCreated,this],[Za.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Ga.DATA,this.__onWatchData,this],[Ka.END,this.__onLayoutEnd,this],[Za.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Ol.list.remove(this);try{this.stop(),this.emitLeafer(Qa.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{tn.clearRecycled()},100)}catch(t){Il.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new yh,fe([Wn(_l)],t.Leafer.prototype,"__",void 0),fe([mn()],t.Leafer.prototype,"pixelRatio",void 0),fe([un("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Ol=fe([Vn()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},fe([Wn(fl)],t.Rect.prototype,"__",void 0),t.Rect=fe([qn(Al),Hn(),Vn()],t.Rect);const{add:Fl,includes:Ml,scroll:Wl}=jt,Ul=t.Rect.prototype,Nl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:r,boxBounds:n}=s,{overflow:a}=i,o=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(o),(e=a&&a.includes("scroll"))&&(Fl(o,n),Wl(o,i)),this.__updateRectRenderBounds(),t=!Ml(n,o),t&&"show"===a&&Fl(r,o)}else this.__updateRectRenderBounds();_.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},fe([Wn(ul)],t.Box.prototype,"__",void 0),fe([mn(100)],t.Box.prototype,"width",void 0),fe([mn(100)],t.Box.prototype,"height",void 0),fe([un(!1)],t.Box.prototype,"resizeChildren",void 0),fe([Bn("show")],t.Box.prototype,"overflow",void 0),fe([Xn(Ul.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),fe([Xn(Ul.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),fe([Xn(Ul.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),fe([Xn(Ul.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),fe([Xn(Ul.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),fe([Xn(Ul.__updateChange)],t.Box.prototype,"__updateRectChange",null),fe([Xn(Ul.__render)],t.Box.prototype,"__renderRect",null),fe([Xn(Nl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=fe([Hn(),Vn()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},fe([Wn(pl)],t.Frame.prototype,"__",void 0),fe([kn("#FFFFFF")],t.Frame.prototype,"fill",void 0),fe([Bn("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=fe([Vn()],t.Frame);const{moveTo:zl,closePath:Yl,ellipse:Xl}=Ss;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:r}=this.__,n=t/2,a=e/2,o=this.__.path=[];i?s||r?(i<1&&Xl(o,n,a,n*i,a*i,0,s,r,!1),Xl(o,n,a,n,a,0,r,s,!0)):(i<1&&(Xl(o,n,a,n*i,a*i),zl(o,t,a)),Xl(o,n,a,n,a,0,360,0,!0)):s||r?(zl(o,n,a),Xl(o,n,a,n,a,0,s,r,!1)):Xl(o,n,a,n,a),Yl(o),m.ellipseToCurve&&(this.__.path=this.getPath(!0))}},fe([Wn(yl)],t.Ellipse.prototype,"__",void 0),fe([bn(0)],t.Ellipse.prototype,"innerRadius",void 0),fe([bn(0)],t.Ellipse.prototype,"startAngle",void 0),fe([bn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=fe([Vn()],t.Ellipse);const{sin:Hl,cos:jl,PI:ql}=Math,{moveTo:Vl,lineTo:Gl,closePath:Kl,drawPoints:Zl}=Ss;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Zl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:r}=t,n=i/2,a=s/2;Vl(e,n,0);for(let t=1;t<r;t++)Gl(e,n+n*Hl(2*t*ql/r),a-a*jl(2*t*ql/r));Kl(e)}}},fe([Wn(ml)],t.Polygon.prototype,"__",void 0),fe([bn(3)],t.Polygon.prototype,"sides",void 0),fe([bn()],t.Polygon.prototype,"points",void 0),fe([bn(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=fe([Hn(),Vn()],t.Polygon);const{sin:Ql,cos:Jl,PI:$l}=Math,{moveTo:td,lineTo:ed,closePath:id}=Ss;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,r=t/2,n=e/2,a=this.__.path=[];td(a,r,0);for(let t=1;t<2*i;t++)ed(a,r+(t%2==0?r:r*s)*Ql(t*$l/i),n-(t%2==0?n:n*s)*Jl(t*$l/i));id(a)}},fe([Wn(vl)],t.Star.prototype,"__",void 0),fe([bn(5)],t.Star.prototype,"corners",void 0),fe([bn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=fe([Vn()],t.Star);const{moveTo:sd,lineTo:rd,drawPoints:nd}=Ss,{rotate:ad,getAngle:od,getDistance:hd,defaultPoint:ld}=dt;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&ad(i,e),i}set toPoint(t){this.width=hd(ld,t),this.rotation=od(ld,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?nd(e,t.points,t.curve,t.closed):(sd(e,0,0),rd(e,this.width,0))}},fe([Wn(gl)],t.Line.prototype,"__",void 0),fe([En("center")],t.Line.prototype,"strokeAlign",void 0),fe([mn(0)],t.Line.prototype,"height",void 0),fe([bn()],t.Line.prototype,"points",void 0),fe([bn(0)],t.Line.prototype,"curve",void 0),fe([bn(!1)],t.Line.prototype,"closed",void 0),t.Line=fe([Vn()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}},fe([Wn(Sl)],t.Image.prototype,"__",void 0),fe([mn("")],t.Image.prototype,"url",void 0),t.Image=fe([Vn()],t.Image);const dd=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=he.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new nn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Na(Na.LOADED,{image:t}))})}draw(t,e,i,s){const r=new mt(t.worldTransform).invert(),n=new mt;e&&n.translate(e.x,e.y),i&&(h(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},fe([Wn(Pl)],t.Canvas.prototype,"__",void 0),fe([Xh(100)],t.Canvas.prototype,"width",void 0),fe([Xh(100)],t.Canvas.prototype,"height",void 0),fe([Xh(1)],t.Canvas.prototype,"pixelRatio",void 0),fe([Xh(!0)],t.Canvas.prototype,"smooth",void 0),fe([un(!1)],t.Canvas.prototype,"safeResize",void 0),fe([Xh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=fe([Vn()],t.Canvas);const{copyAndSpread:cd,includes:ud,spread:_d,setList:pd}=jt,{stintSet:gd}=_;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:r,fontWeight:n,italic:a,textCase:o,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Vh.number(e,r),t.__letterSpacing=Vh.number(i,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${a?"italic ":""}${"small-caps"===o?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${s||"caption"}`,gd(t,"__padding",l&&M.fourNumber(l)),gd(t,"__clipText","show"!==h&&!t.__autoSize),gd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==o),t.__textDrawData=jh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:r,__autoWidth:n,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:o}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=o,t.__lineHeight<i&&_d(o,i/2),n||a){if(h.x=n?o.x:0,h.y=a?o.y:0,h.width=n?o.width:t.width,h.height=a?o.height:t.height,r){const[e,i,s,r]=t.__padding;n&&(h.x-=r,h.width+=i+r),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),_.stintSet(this,"isOverflow",!ud(h,o)),this.isOverflow?(pd(t.__textBoxBounds={},[h,o]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;cd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},fe([Wn(El)],t.Text.prototype,"__",void 0),fe([mn(0)],t.Text.prototype,"width",void 0),fe([mn(0)],t.Text.prototype,"height",void 0),fe([kn()],t.Text.prototype,"boxStyle",void 0),fe([un(!1)],t.Text.prototype,"resizeFontSize",void 0),fe([kn("#000000")],t.Text.prototype,"fill",void 0),fe([En("outside")],t.Text.prototype,"strokeAlign",void 0),fe([Fn("all")],t.Text.prototype,"hitFill",void 0),fe([mn("")],t.Text.prototype,"text",void 0),fe([mn("")],t.Text.prototype,"placeholder",void 0),fe([mn("caption")],t.Text.prototype,"fontFamily",void 0),fe([mn(12)],t.Text.prototype,"fontSize",void 0),fe([mn("normal")],t.Text.prototype,"fontWeight",void 0),fe([mn(!1)],t.Text.prototype,"italic",void 0),fe([mn("none")],t.Text.prototype,"textCase",void 0),fe([mn("none")],t.Text.prototype,"textDecoration",void 0),fe([mn(0)],t.Text.prototype,"letterSpacing",void 0),fe([mn({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),fe([mn(0)],t.Text.prototype,"paraIndent",void 0),fe([mn(0)],t.Text.prototype,"paraSpacing",void 0),fe([mn("x")],t.Text.prototype,"writingMode",void 0),fe([mn("left")],t.Text.prototype,"textAlign",void 0),fe([mn("top")],t.Text.prototype,"verticalAlign",void 0),fe([mn(!0)],t.Text.prototype,"autoSizeAlign",void 0),fe([mn("normal")],t.Text.prototype,"textWrap",void 0),fe([mn("show")],t.Text.prototype,"textOverflow",void 0),fe([kn(!1)],t.Text.prototype,"textEditing",void 0),t.Text=fe([Vn()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},fe([Wn(xl)],t.Path.prototype,"__",void 0),fe([En("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=fe([Vn()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,r,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,n,a,o){return this}arc(t,e,i,s,r,n){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,n,a,o){return this}drawArc(t,e,i,s,r,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},fe([Wn(wl)],t.Pen.prototype,"__",void 0),fe([(t,e)=>{an(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=fe([qn(zs,["set","path","paint"]),Vn()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(i||r)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||r)&&(this.sky=this.addLeafer(s)),r&&he.editor(r,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),r(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&_.assign(e,t),this.autoLayout&&_.copyAttrs(e,this,Ce),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Ka.END,this.__onReady,this],[Za.START,this.__onCreated,this],[Za.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Za.END,this.__onChildRenderEnd,this))}},t.App=fe([Vn()],t.App);const fd={},yd={isHoldSpaceKey:()=>yd.isHold("Space"),isHold:t=>fd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){fd[t]||(fd[t]=!0)},setUpCode(t){fd[t]=!1}},md={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class vd extends Ia{get spaceKey(){return yd.isHoldSpaceKey()}get left(){return md.left(this)}get right(){return md.right(this)}get middle(){return md.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return yd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){_e.changeName(t,e)}}const{min:xd,max:wd,abs:bd}=Math,{float:Ed,sign:Sd}=M,{minX:Pd,maxX:Bd,minY:kd,maxY:Td}=jt,Rd=new Kt,Cd=new Kt,Ld={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Ad.getValidMove(t.__localBoxBounds,Ad.getDragBounds(t),s,e,!0),Ad.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:r,dragBoundsType:n}=t;r&&Ad.getValidScaleOf(t.__localBoxBounds,Ad.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,r){const n=t.x+s.x,a=t.y+s.y,o=n+t.width,h=a+t.height,l=e.x+e.width,d=e.y+e.height;return r||(s=Object.assign({},s)),Ad.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:o<l&&(s.x+=l-o):n<e.x?s.x+=e.x-n:o>l&&(s.x+=l-o),Ad.isInnerMode(t,e,i,"height")?a>e.y?s.y+=e.y-a:h<d&&(s.y+=d-h):a<e.y?s.y+=e.y-a:h>d&&(s.y+=d-h),s.x=Ed(s.x),s.y=Ed(s.y),s},getValidScaleOf(t,e,i,s,r,n,a){a||(r=Object.assign({},r)),Cd.set(e),Rd.set(t).scaleOf(s,r.x,r.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,_,p,g,f=1,y=1;return Ad.isInnerMode(t,e,i,"width")?(r.x<0&&Rd.scaleOf(s,f=1/r.x,1),p=Ed(Rd.minX-Cd.minX),g=Ed(Cd.maxX-Rd.maxX),u=h&&p>0?1+p/(h*Rd.width):1,_=l&&g>0?1+g/(l*Rd.width):1,f*=wd(u,_)):(r.x<0&&((Ed(Pd(t)-Pd(e))<=0||Ed(Bd(e)-Bd(t))<=0)&&Rd.scaleOf(s,f=1/r.x,1),Rd.unsign()),p=Ed(Cd.minX-Rd.minX),g=Ed(Rd.maxX-Cd.maxX),u=h&&p>0?1-p/(h*Rd.width):1,_=l&&g>0?1-g/(l*Rd.width):1,f*=xd(u,_)),Ad.isInnerMode(t,e,i,"height")?(r.y<0&&Rd.scaleOf(s,1,y=1/r.y),p=Ed(Rd.minY-Cd.minY),g=Ed(Cd.maxY-Rd.maxY),u=d&&p>0?1+p/(d*Rd.height):1,_=c&&g>0?1+g/(c*Rd.height):1,y*=wd(u,_),n&&(u=wd(bd(f),bd(y)),f=Sd(f)*u,y=Sd(y)*u)):(r.y<0&&((Ed(kd(t)-kd(e))<=0||Ed(Td(e)-Td(t))<=0)&&Rd.scaleOf(s,1,y=1/r.y),Rd.unsign()),p=Ed(Cd.minY-Rd.minY),g=Ed(Rd.maxY-Cd.maxY),u=d&&p>0?1-p/(d*Rd.height):1,_=c&&g>0?1-g/(c*Rd.height):1,y*=xd(u,_)),r.x*=o(f)?f:1,r.y*=o(y)?y:1,r}},Ad=Ld;t.PointerEvent=class extends vd{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=fe([Gn()],t.PointerEvent);const Dd=t.PointerEvent,Od={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof yh?t:new yh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const r=t.getLocalPoint(i,null,!0);return dt.move(r,e.x-t.x,e.y-t.y),s&&this.limitMove(t,r),Ld.axisMove(t,r),r}static limitMove(t,e){Ld.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Od,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Od,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Od,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return jt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),jt.unsign(i),i}assignMove(t){Od.x=t?this.totalX:this.moveX,Od.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=fe([Gn()],t.DragEvent);const Id=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=fe([Gn()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.DRAG_ANIMATE="move.drag_animate",t.MoveEvent.END="move.end",t.MoveEvent=fe([Gn()],t.MoveEvent),t.TouchEvent=class extends vd{},t.TouchEvent=fe([Gn()],t.TouchEvent);const Fd=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=fe([Gn()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=fe([Gn()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=fe([Gn()],t.ZoomEvent),t.KeyEvent=class extends vd{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=fe([Gn()],t.KeyEvent);const Md={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Wd.getSwipeDirection(dt.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,time:Date.now(),buttons:r(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new yh,{list:s}=t;for(let t=0,r=s.length;t<r;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>aa.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Wd=Md,Ud=new yh,{getDragEventData:Nd,getDropEventData:zd,getSwipeEventData:Yd}=Md;class Xd{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Nd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,r=s&&s.list.length,n=t.DragEvent.list||this.draggableList||Ud;return this.dragging&&(r?e?Ud:new yh(i?[...s.list,...s.dragHoverExclude]:s.list):n)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&md.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],aa.draggable(e)){this.draggableList=new yh(e);break}}drag(e){const{interaction:i,dragData:s,downData:r}=this,{path:n,throughPath:a}=r;this.dragData=Nd(r,s,e),a&&(this.dragData.throughPath=a),this.dragData.path=n,this.dragDataList.push(this.dragData),this.moving?(e.moving=!0,this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(e.dragging=!0,this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,r=this.realDraggableList;if(r.length&&s){const{totalX:s,totalY:n}=this.dragData,{dragLimitAnimate:o}=i.p,l=!o||!!e;r.forEach(i=>{if(i.draggable){const r=a(i.draggable),d=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:n},l||r);o&&!r&&e?aa.animateMove(i,d,h(o)?o:.3):i.move(d)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:r}=e;this.dragOverPath=r,s?r.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,r)):i.emit(t.DragEvent.OVER,e,r)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:r}=e;i.emit(t.DragEvent.LEAVE,e,s,r),i.emit(t.DragEvent.ENTER,e,r,s),this.dragEnterPath=r}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:r}=this;e||(e=r);const{path:n,throughPath:a}=s,o=Nd(s,e,e);if(a&&(o.throughPath=a),o.path=n,this.moving&&(this.moving=!1,o.moveType="drag",i.emit(t.MoveEvent.END,o)),this.dragging){const n=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,o),this.swipe(e,s,r,o),this.drop(e,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(dt.getDistance(e,t)>r.config.pointer.swipeDistance){const t=Yd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const r=zd(e,i,t.DragEvent.data);r.path=s,this.interaction.emit(t.DropEvent.DROP,r),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Hd=te.get("emit");const jd=["move","zoom","rotate","key"];function qd(t,e,i,s,r){if(jd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Gd(t,r)){let n;for(let a=0,o=t.children.length;a<o;a++)n=t.children[a],!i.path.has(n)&&n.__.hittable&&Vd(n,e,i,s,r)}}function Vd(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!Gd(t,r)&&(el.updateEventStyle&&!s&&el.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=_e.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function Gd(t,e){return e&&e.has(t)}const Kd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Zd,pathCanDrag:Qd,pathHasOutside:Jd}=Md;class $d{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&md.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&md.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&yd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=_.clone(Kd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new yh(t),this.createTransformer(),this.dragger=new Xd(this),s&&(this.config=_.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(md.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),md.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=md.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&md.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=dt.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;md.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,yd.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,yd.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new yh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const r=Date.now()-this.downTime,n=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>Zd(e.path,t));r<i.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:r,target:n}=this;m.backgrounder||t.origin||n&&n.updateLayout();const a=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Jd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Qd(t.path))&&!Jd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}stopDragAnimate(){this.dragger.stopAnimate()}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,r=s.length;t<r&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:r}=this.canvas;return s.x*=r.width/i.width,s.y*=r.height/i.height,this.p.snap&&dt.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Zd(e.path,t.PointerEvent.LONG_TAP)||Zd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Kt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(h(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Va.RESIZE,this.__onResize,this)],t.once(Qa.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(r=i.list[n],Vd(r,t,e,!0,s))return;r.isApp&&qd(r,t,e,!0,s)}for(let n=0,a=i.length;n<a;n++)if(r=i.list[n],r.isApp&&qd(r,t,e,!1,s),Vd(r,t,e,!1,s))return}catch(t){Hd.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class tc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}tc.custom={};class ec extends ge{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new yh,this.pixelList=new yh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),he.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),he.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}m.getSelector=function(t){return t.leafer?t.leafer.selector:m.selector||(m.selector=he.selector())};const{toInnerRadiusPointOf:ic,copyRadiusPoint:sc}=dt,{hitRadiusPoint:rc,hitPoint:nc}=jt,ac={},oc={},hc=t.Leaf.prototype;hc.hit=function(t,e=0){this.updateLayout(),sc(oc,t,e);const i=this.__world;return!!(e?rc(i,oc):nc(i,oc))&&(this.isBranch?m.getSelector(this).hitPoint(Object.assign({},oc),e,{target:this}):this.__hitWorld(oc))},hc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,r=this.__layout,n=s.width<10&&s.height<10;if(i.hitRadius&&(sc(ac,t,i.hitRadius),t=ac),ic(t,s,ac),i.hitBox||n){if(jt.hitRadiusPoint(r.boxBounds,ac))return!0;if(n)return!1}return!r.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),r.boundsChanged||(r.hitCanvasChanged=!1)),this.__hit(ac,e)},hc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},hc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},hc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},hc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const lc=new mt,dc=t.UI.prototype;dc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,r=i||s;this.__hitCanvas||(this.__hitCanvas=r?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,r=m.image.hitCanvasSize,a=n.hitScale=Zt.set(0,0,r,r).getFitMatrix(t).a,{x:o,y:h,width:l,height:d}=Zt.set(t).scale(a);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),tn.patternLocked=!0,this.__renderShape(n,{matrix:lc.setWith(this.__world).scaleWith(1/a).invertWith().translate(-o,-h),ignoreFill:!i,ignoreStroke:!s}),tn.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},dc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,r=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(r&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:a}=i,o=i.stroke&&("path"===n||"pixel"===n&&!i.__isAlphaPixelStroke)||"all"===n;if(!r&&!o)return!1;const h=2*t.radiusX;let l=h;if(o)switch(i.strokeAlign){case"inside":if(l+=2*a,!r&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=a;break;case"outside":if(l+=2*a,!r){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const cc=t.UI.prototype,uc=t.Rect.prototype,_c=t.Box.prototype;uc.__updateHitCanvas=_c.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?cc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},uc.__hitFill=_c.__hitFill=function(t){return this.__hitCanvas?cc.__hitFill.call(this,t):jt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:r,__textDrawData:n}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):n.rows.forEach(r=>t.rect(r.x,r.y-s,r.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=s),this.updateLayout(),m.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const pc=Le.prototype;function gc(t,e,i){t.__.__font?Kh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function fc(t,e,i,s,r){const n=i.__;c(t)?Kh.drawStrokesStyle(t,e,!1,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Kh.strokeArrow(t,i,s,r)}function yc(t,e,i,s,r){const n=i.__;c(t)?Kh.drawStrokesStyle(t,e,!0,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),Kh.drawTextStroke(i,s,r))}function mc(t,e,i,s,r){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,yc(t,2,i,n,r),n.blendMode="outside"===e?"destination-out":"destination-in",Kh.fillText(i,n,r),n.blendMode="normal",aa.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}pc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},pc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},pc.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:n,radiusY:a}=t;e&&(s-=e.x,r-=e.y),Zt.set(s-n,r-a,2*n,2*a).scale(i).ceil();const{data:o}=this.context.getImageData(Zt.x,Zt.y,Zt.width||1,Zt.height||1);for(let t=0,e=o.length;t<e;t+=4)if(o[t+3]>0)return!0;return o[3]>0};const{getSpread:vc,copyAndSpread:xc,toOuterOf:wc,getOuterOf:bc,getByMove:Ec,move:Sc,getIntersectData:Pc}=jt,Bc={};let kc;const{stintSet:Tc}=_,{hasTransparent:Rc}=qh;function Cc(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":if(!e.url)return;s=Zh.image(i,t,e,n,!kc||!kc[e.url]);break;case"linear":s=Qh.linearGradient(e,n);break;case"radial":s=Qh.radialGradient(e,n);break;case"angular":s=Qh.conicGradient(e,n);break;case"solid":const{type:a,color:o,opacity:h}=e;s={type:a,style:qh.string(o,h)};break;default:r(e.r)||(s={type:"solid",style:qh.string(e)})}if(s&&(s.originPaint=e,a(s.style)&&Rc(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Lc={compute:function(t,e){const i=e.__,s=[];let r,n,a,o=i.__input[t];d(o)||(o=[o]),kc=Zh.recycleImage(t,i);for(let i,r=0,n=o.length;r<n;r++)(i=Cc(t,o[r],e))&&(s.push(i),i.strokeStyle&&(a||(a=1),i.strokeStyle.strokeWidth&&(a=Math.max(a,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(Tc(i,"__isAlphaPixelFill",r),Tc(i,"__isTransparentFill",n)):(Tc(i,"__isAlphaPixelStroke",r),Tc(i,"__isTransparentStroke",n),Tc(i,"__hasMultiStrokeStyle",a))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,gc(e,i,s)},fills:function(t,e,i,s){let r,n,a;for(let o=0,h=t.length;o<h;o++){if(r=t[o],n=r.originPaint,r.image){if(a?a++:a=1,Zh.checkImage(r,!e.__.__font,e,i,s))continue;if(!r.style){1===a&&r.image.isPlacehold&&e.drawImagePlaceholder(r,i,s);continue}}if(i.fillStyle=r.style,r.transform||n.scaleFixed){if(i.save(),r.transform&&i.transform(r.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),gc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),gc(e,i,s),i.restoreBlendMode()):gc(e,i,s)}},fillPathOrText:gc,fillText:function(t,e,i){const s=t.__,{rows:r,decorationY:n}=s.__textDrawData;let a;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=r.length;t<i;t++)a=r[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const r=e.__;if(r.__strokeWidth)if(r.__font)Kh.strokeText(t,e,i,s);else switch(r.strokeAlign){case"center":fc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),fc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const r=e.__;if(r.__fillAfterStroke)fc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),fc(t,2,e,a,s),a.clipUI(r),a.clearWorld(n),aa.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){Kh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":yc(t,1,e,i,s);break;case"inside":mc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?yc(t,2,e,i,s):mc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,r=t.__.__textDrawData;const{rows:n,decorationY:a}=r;for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(a){const{decorationHeight:t}=r;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,r,n){let a;const o=s.__,{__hasMultiStrokeStyle:h}=o;h||r.setStroke(void 0,o.__strokeWidth*e,o);for(let l=0,d=t.length;l<d;l++)if(a=t[l],(!a.image||!Zh.checkImage(a,!1,s,r,n))&&a.style){if(h){const{strokeStyle:t}=a;t?r.setStroke(a.style,o.__getRealStrokeWidth(t)*e,o,t):r.setStroke(a.style,o.__strokeWidth*e,o)}else r.strokeStyle=a.style;a.originPaint.blendMode?(r.saveBlendMode(a.originPaint.blendMode),i?Kh.drawTextStroke(s,r,n):r.stroke(),r.restoreBlendMode()):i?Kh.drawTextStroke(s,r,n):r.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),r=e.bounds,n=t.__nowWorld,a=t.__layout,o=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;wc(a.strokeSpread?(xc(Bc,a.boxBounds,a.strokeSpread),Bc):a.boxBounds,n,o);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(o))_=s,h=u=o,l=n;else{let s;if(m.fullImageShadow)s=o;else{const t=a.renderShapeSpread?vc(r,k.swapAndScale(a.renderShapeSpread,p,g)):r;s=Pc(t,o)}c=r.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=y),u=bc(o,c),h=Ec(u,-c.e,-c.f),l=bc(n,c),Sc(l,-c.e,-c.f);const v=i.matrix;v?(d=new mt(c),d.multiply(v),f*=v.scaleX,y*=v.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let Ac,Dc=new Kt;const{isSame:Oc}=jt;function Ic(t,e,i,s,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||Zh.createData(r,s,i,n),!0}function Fc(t,e){Uc(t,Na.LOAD,e)}function Mc(t,e){Uc(t,Na.LOADED,e)}function Wc(t,e,i){e.error=i,t.forceUpdate("surface"),Uc(t,Na.ERROR,e)}function Uc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Na(e,i))}function Nc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:zc,translate:Yc}=J,Xc=new Kt,Hc={},jc={};function qc(t,e,i,s){const r=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&r<0?0:r}let Vc={},Gc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Kc,set:Zc,rotateOfOuter:Qc,translate:Jc,scaleOfOuter:$c,multiplyParent:tu,scale:eu,rotate:iu,skew:su}=J;function ru(t,e,i,s,r,n,a,o){a&&iu(t,a),o&&su(t,o.x,o.y),r&&eu(t,r,n),Jc(t,e.x+i,e.y+s)}const{get:nu,scale:au,copy:ou}=J,{getFloorScale:hu}=M,{abs:lu}=Math;const du={image:function(t,e,i,s,r){let n,a;const o=tn.get(i);return Ac&&i===Ac.paint&&Oc(s,Ac.boxBounds)?n=Ac.leafPaint:(n={type:i.type,image:o},o.hasAlphaPixel&&(n.isTransparent=!0),Ac=o.use>1?{leafPaint:n,paint:i,boxBounds:Dc.set(s)}:null),(r||o.loading)&&(a={image:o,attrName:e,attrValue:i}),o.ready?(Ic(t,e,i,o,n,s),r&&(Fc(t,a),Mc(t,a))):o.error?r&&Wc(t,a,o.error):(r&&(Nc(t,!0),Fc(t,a)),n.loadId=o.load(()=>{Nc(t,!1),t.destroyed||(Ic(t,e,i,o,n,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Mc(t,a)),n.loadId=void 0},e=>{Nc(t,!1),Wc(t,a,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),n},checkImage:function(t,e,i,s,r){const{scaleX:n,scaleY:a}=Zh.getImageRenderScaleData(t,i,s,r),{image:o,data:h,originPaint:l}=t,{exporting:d}=r;return!(!h||t.patternId===n+"-"+a&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===m.name&&Va.isResizing(i)||d||(e=m.image.isLarge(o,n,a)||o.width*n>8096||o.height*a>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Zh.drawImage(t,n,a,i,s,r),!0):(!t.style||l.sync||d?Zh.createPattern(t,i,s,r):Zh.createPatternTask(t,i,s,r),!1))},drawImage:function(t,e,i,s,r,n){const{data:a,image:o}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=a,c=o.getFull(a.filters),u=s.__;let _,{width:p,height:g}=o;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(s),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(a.scaleX&&(p*=a.scaleX,g*=a.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,i,s){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;r.scaleX*=t,r.scaleY*=t}return n&&n.scaleX&&(r.scaleX*=Math.abs(n.scaleX),r.scaleY*=Math.abs(n.scaleY)),r},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,r,n,a,o;for(let h=0,l=i.length;h<l;h++)s=i[h],r=s.image,o=r&&r.url,o&&(n||(n={}),n[o]=!0,tn.recyclePaint(s),r.loading&&(a||(a=e.__input&&e.__input[t]||[],d(a)||(a=[a])),r.unload(i[h].loadId,!a.some(t=>t.url===o))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=tn.patternTasker.add(()=>ye(this,void 0,void 0,function*(){Zh.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:r,scaleY:n}=Zh.getImageRenderScaleData(t,e,i,s),a=r+"-"+n;if(t.patternId!==a&&!e.destroyed&&(!m.image.isLarge(t.image,r,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:o,gap:h}=s,l=Zh.getPatternFixScale(t,r,n);let d,c,u,{width:_,height:p}=i;l&&(r*=l,n*=l),_*=r,p*=n,h&&(c=h.x*r/lu(s.scaleX||1),u=h.y*n/lu(s.scaleY||1)),(o||1!==r||1!==n)&&(r*=hu(_+(c||0)),n*=hu(p+(u||0)),d=nu(),o&&ou(d,o),au(d,1/r,1/n));const g=i.getCanvas(_,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(g,s.repeat||m.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=a}},getPatternFixScale:function(t,e,i){const{image:s}=t;let r,n=m.image.maxPatternSize,a=s.width*s.height;return s.isSVG?e>1&&(r=Math.ceil(e)/e):n>a&&(n=a),(a*=e*i)>n&&(r=Math.sqrt(n/a)),r},createData:function(t,e,i,s){t.data=Zh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Xc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:r}=i,{opacity:n,mode:o,align:h,offset:l,scale:d,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===r,x={mode:o},w="center"!==h&&(_||0)%180==90;let b,E;switch(jt.set(jc,0,0,w?r:s,w?s:r),o&&"cover"!==o&&"fit"!==o?((d||u)&&(M.getScaleData(d,u,i,Hc),b=Hc.scaleX,E=Hc.scaleY),(h||y||f)&&(b&&jt.scale(jc,b,E,!0),h&&Tt.toPoint(h,jc,e,jc,!0,!0))):v&&!_||(b=E=jt.getFitScale(e,jc,"fit"!==o),jt.put(e,i,h,b,!1,jc),jt.scale(jc,b,E,!0)),l&&dt.move(jc,l),o){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/r,Zh.stretchMode(x,e,b,E));break;case"normal":case"clip":if(jc.x||jc.y||b||g||_||p){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),Zh.clipMode(x,e,jc.x,jc.y,b,E,_,p,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||_||p)&&Zh.repeatMode(x,e,s,r,jc.x,jc.y,b,E,_,p,h,t.freeTransform),f||(x.repeat="repeat");const i=c(f);(y||i)&&(x.gap=function(t,e,i,s,r){let n,a;c(t)?(n=t.x,a=t.y):n=a=t;return{x:qc(n,i,r.width,e&&e.x),y:qc(a,s,r.height,e&&e.y)}}(y,i&&f,jc.width,jc.height,e));break;default:b&&Zh.fillOrFitMode(x,e,jc.x,jc.y,b,E,_)}return x.transform||(e.x||e.y)&&Yc(x.transform=zc(),e.x,e.y),b&&(x.scaleX=b,x.scaleY=E),n&&n<1&&(x.opacity=n),m&&(x.filters=m),f&&(x.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),x},stretchMode:function(t,e,i,s){const r=Kc(),{x:n,y:a}=e;n||a?Jc(r,n,a):r.onlyScale=!0,eu(r,i,s),t.transform=r},fillOrFitMode:function(t,e,i,s,r,n,a){const o=Kc();Jc(o,e.x+i,e.y+s),eu(o,r,n),a&&Qc(o,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=o},clipMode:function(t,e,i,s,r,n,a,o,h,l){const d=Kc();ru(d,e,i,s,r,n,a,o),h&&(a||o?(Zc(Gc),$c(Gc,e,h,l),tu(d,Gc)):$c(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,r,n,a,o,h,l,d,c){const u=Kc();if(c)ru(u,e,r,n,a,o,h,l);else{if(h)if("center"===d)Qc(u,{x:i/2,y:s/2},h);else switch(iu(u,h),h){case 90:Jc(u,s,0);break;case 180:Jc(u,i,s);break;case 270:Jc(u,0,i)}Vc.x=e.x+r,Vc.y=e.y+n,Jc(u,Vc.x,Vc.y),a&&$c(u,Vc,a,o)}t.transform=u}},{toPoint:cu}=Pt,{hasTransparent:uu}=qh,_u={},pu={};function gu(t,e,i,s){if(i){let r,n,o,h;for(let t=0,l=i.length;t<l;t++)r=i[t],a(r)?(o=t/(l-1),n=qh.string(r,s)):(o=r.offset,n=qh.string(r.color,s)),e.addColorStop(o,n),!h&&uu(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:fu,getDistance:yu}=dt,{get:mu,rotateOfOuter:vu,scaleOfOuter:xu}=J,{toPoint:wu}=Pt,bu={},Eu={};function Su(t,e,i,s,r){let n;const{width:a,height:o}=t;if(a!==o||s){const t=fu(e,i);n=mu(),r?(xu(n,e,a/o*(s||1),1),vu(n,e,t+90)):(xu(n,e,1,a/o*(s||1)),vu(n,e,t))}return n}const{getDistance:Pu}=dt,{toPoint:Bu}=Pt,ku={},Tu={};const Ru={linearGradient:function(t,e){let{from:i,to:s,type:r,opacity:n}=t;cu(i||"top",e,_u),cu(s||"bottom",e,pu);const a=m.canvas.createLinearGradient(_u.x,_u.y,pu.x,pu.y),o={type:r,style:a};return gu(o,a,t.stops,n),o},radialGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;wu(i||"center",e,bu),wu(s||"bottom",e,Eu);const o=m.canvas.createRadialGradient(bu.x,bu.y,0,bu.x,bu.y,yu(bu,Eu)),h={type:r,style:o};gu(h,o,t.stops,n);const l=Su(e,bu,Eu,a,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;Bu(i||"center",e,ku),Bu(s||"bottom",e,Tu);const o=m.conicGradientSupport?m.canvas.createConicGradient(0,ku.x,ku.y):m.canvas.createRadialGradient(ku.x,ku.y,0,ku.x,ku.y,Pu(ku,Tu)),h={type:r,style:o};gu(h,o,t.stops,n);const l=Su(e,ku,Tu,a||1,m.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:Su},{copy:Cu,move:Lu,toOffsetOutBounds:Au}=jt,{max:Du,abs:Ou}=Math,Iu={},Fu=new mt,Mu={};function Wu(t,e){let i,s,r,n,a=0,o=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),r=Ou(t.spread||0),a=Du(a,r+n-s),o=Du(o,r+n+i),h=Du(h,r+n+s),l=Du(l,r+n-i)}),a===o&&o===h&&h===l?a:[a,o,h,l]}function Uu(t,e,i){const{shapeBounds:s}=i;let r,n;m.fullImageShadow?(Cu(Iu,t.bounds),Lu(Iu,e.x-s.x,e.y-s.y),r=t.bounds,n=Iu):(r=s,n=e),t.copyWorld(i.canvas,r,n)}const{toOffsetOutBounds:Nu}=jt,zu={};const Yu=Wu;const Xu={shadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{shadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Au(h,Mu,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Mu.offsetX+(a.x||0)*c*f,Mu.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f,qh.string(a.color)),r=Jh.getShadowTransform(t,_,i,a,Mu,f),r&&_.setTransform(r),Uu(_,Mu,i),r&&_.resetTransform(),s=l,a.box&&(_.restore(),_.save(),o&&(_.copyWorld(_,l,n,"copy"),s=n),o?_.copyWorld(o,n,n,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),aa.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{innerShadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Nu(h,zu,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(zu.offsetX+(a.x||0)*c*f,zu.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f),r=Jh.getShadowTransform(t,_,i,a,zu,f,!0),r&&_.setTransform(r),Uu(_,zu,i),_.restore(),o?(_.copyWorld(_,l,n,"copy"),_.copyWorld(o,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,qh.string(a.color),"source-in"),aa.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:Wu,getShadowTransform:function(t,e,i,s,r,n,a){if(s.spread){const i=2*s.spread*n*(a?-1:1),{width:o,height:h}=t.__layout.strokeBounds;return Fu.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+i/o,1+i/h),Fu}},isTransformShadow(t){},getInnerShadowSpread:Yu},{excludeRenderBounds:Hu}=pa;let ju;function qu(t,e,i,s,r,n,a,o){switch(e){case"grayscale":ju||(ju=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,r,n){const a=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,a),n&&s.recycle(a);Gu(t,e,i,1,r,n)}(t,i,s,r,a,o);break;case"opacity-path":Gu(t,i,s,n,a,o);break;case"path":o&&i.restore()}}function Vu(t){return t.getSameCanvas(!1,!0)}function Gu(t,e,i,s,r,n){const a=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,a,void 0,r),n?i.recycle(a):i.clearWorld(a)}t.Group.prototype.__renderMask=function(t,e){let i,s,r,n,a,o;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],o=i.__.mask,o){a&&(qu(this,a,t,r,s,n,void 0,!0),s=r=null),"clipping"!==o&&"clipping-path"!==o||Hu(i,e)||i.__render(t,e),n=i.__.opacity,ju=!1,"path"===o||"clipping-path"===o?(n<1?(a="opacity-path",r||(r=Vu(t))):(a="path",t.save()),i.__clip(r||t,e)):(a="grayscale"===o?"grayscale":"alpha",s||(s=Vu(t)),r||(r=Vu(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&qu(this,a,t,r,s,n,void 0,!1),Hu(i,e)||i.__render(r||t,e),d&&qu(this,a,t,r,s,n,d,!1)}qu(this,a,t,r,s,n,void 0,!0)};const Ku=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Zu=Ku+"_#~&*+\\=|≮≯≈≠=…",Qu=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function Ju(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const $u=Ju("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),t_=Ju("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),e_=Ju(Ku),i_=Ju(Zu),s_=Ju("- —/~|┆·");var r_;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(r_||(r_={}));const{Letter:n_,Single:a_,Before:o_,After:h_,Symbol:l_,Break:d_}=r_;function c_(t){return $u[t]?n_:s_[t]?d_:t_[t]?o_:e_[t]?h_:i_[t]?l_:Qu.test(t)?a_:n_}const u_={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let n=r-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function __(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:p_}=u_,{Letter:g_,Single:f_,Before:y_,After:m_,Symbol:v_,Break:x_}=r_;let w_,b_,E_,S_,P_,B_,k_,T_,R_,C_,L_,A_,D_,O_,I_,F_,M_,W_=[];function U_(t,e){R_&&!T_&&(T_=R_),w_.data.push({char:t,width:e}),E_+=e}function N_(){S_+=E_,w_.width=E_,b_.words.push(w_),w_={data:[]},E_=0}function z_(){O_&&(I_.paraNumber++,b_.paraStart=!0,O_=!1),R_&&(b_.startCharSize=T_,b_.endCharSize=R_,T_=0),b_.width=S_,F_.width?p_(b_):M_&&Y_(),W_.push(b_),b_={words:[]},S_=0}function Y_(){S_>(I_.maxWidth||0)&&(I_.maxWidth=S_)}const{top:X_,right:H_,bottom:j_,left:q_}=t.Direction4;function V_(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let t=0;t<r.length;t++)r[t][e]+=i}const G_={getDrawData:function(t,e){a(t)||(t=String(t));let i=0,s=0,r=e.__getInput("width")||0,n=e.__getInput("height")||0;const{__padding:o}=e;o&&(r?(i=o[q_],r-=o[H_]+o[q_],!r&&(r=.01)):e.autoSizeAlign||(i=o[q_]),n?(s=o[X_],n-=o[X_]+o[j_],!n&&(n=.01)):e.autoSizeAlign||(s=o[X_]));const h={bounds:{x:i,y:s,width:r,height:n},rows:[],paraNumber:0,font:m.canvas.font=e.__font};return function(t,e,i){I_=t,W_=t.rows,F_=t.bounds,M_=!F_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:r,textCase:n}=i,{canvas:a}=m,{width:o}=F_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;O_=!0,L_=null,T_=k_=R_=E_=S_=0,w_={data:[]},b_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)B_=e[i],"\n"===B_?(E_&&N_(),b_.paraEnd=!0,z_(),O_=!0):(C_=c_(B_),C_===g_&&"none"!==n&&(B_=__(B_,n,!E_)),k_=a.measureText(B_).width,s&&(s<0&&(R_=k_),k_+=s),A_=C_===f_&&(L_===f_||L_===g_)||L_===f_&&C_!==m_,D_=!(C_!==y_&&C_!==f_||L_!==v_&&L_!==m_),P_=O_&&r?o-r:o,t&&o&&S_+E_+k_>P_&&(h?(E_&&N_(),S_&&z_()):(D_||(D_=C_===g_&&L_==m_),A_||D_||C_===x_||C_===y_||C_===f_||E_+k_>P_?(E_&&N_(),S_&&z_()):S_&&z_()))," "===B_&&!0!==O_&&S_+E_===0||(C_===x_?(" "===B_&&E_&&N_(),U_(B_,k_),N_()):A_||D_?(E_&&N_(),U_(B_,k_)):U_(B_,k_)),L_=C_);E_&&N_(),S_&&z_(),W_.length>0&&(W_[W_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{I_.paraNumber++,S_=a.measureText(t).width,W_.push({x:r||0,text:t,width:S_,paraStart:!0}),M_&&Y_()})}(h,t,e),o&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":V_(e,"x",t[q_]);break;case"right":V_(e,"x",-t[H_])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":V_(e,"y",t[X_]);break;case"bottom":V_(e,"y",-t[j_])}}(o,h,e,r,n),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:n,__baseLine:a,__letterSpacing:o,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*r+(c?c*(t.paraNumber-1):0),m=a;if(h&&y>f)y=Math.max(f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,x,w,b=g||u?g:t.maxWidth;for(let a=0,d=r;a<d;a++){if(v=i[a],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&a>0&&(m+=c),v.y=m,m+=n,t.overflow>a&&m>y&&(v.isOverflow=!0,t.overflow=a+1),x=v.x,w=v.width,o<0&&(v.width<0?(w=-v.width+e.fontSize+o,x-=w,w+=e.fontSize):w-=o),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&g&&g<w&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:n,letterSpacing:a}=e,o=i&&r.includes("both"),h=o||i&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,v;s.forEach(t=>{t.words&&(p=n&&t.paraStart?n:0,y=t.words.length,h&&(v=!t.paraEnd||o,c=i-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=a||t.isOverflow||l?0:u?1:2,t.isOverflow&&!a&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,r){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,v&&_),v&&(m=i===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:r,overflow:n}=t;let{textOverflow:a}=e;if(r.splice(n),a&&"show"!==a){let t,o;"hide"===a?a="":"ellipsis"===a&&(a="...");const h=a?m.canvas.measureText(a).width:0,l=i+s-h;("none"===e.textWrap?r:[r[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],o=t.x+t.width,!(s===i&&o<l));s--){if(o<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:a,x:o}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,c(n)?(i=n.type,n.color&&(t.decorationColor=qh.string(n.color)),n.offset&&(s=Math.min(.3*r,Math.max(n.offset,.15*-r)))):i=n,i){case"under":t.decorationY=[.15*r+s];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+s,.35*-r]}}(h,e),h}};const K_={string:function(t,e){if(!t)return"#000";const i=h(e)&&e<1;if(a(t)){if(!i||!qh.object)return t;t=qh.object(t)}let s=r(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign(jh,G_),Object.assign(qh,K_),Object.assign(Kh,Lc),Object.assign(Zh,du),Object.assign(Qh,Ru),Object.assign(Jh,Xu),Object.assign(he,{interaction:(t,e,i,s)=>new $d(t,e,i,s),hitCanvas:(t,e)=>new vh(t,e),hitCanvasManager:()=>new ec}),wh();class Z_ extends ll{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}function Q_(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?el.setStyleName(this,e,i):el.set(this,i):this.__layout.stateStyleChanged=!0}}))}function J_(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function $_(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function tp(t,e){c(e)||(e=void 0),sp(t,e,"in")}function ep(t,e){const{normalStyle:i}=t;c(e)||(e=void 0),i&&(e||(e=i),sp(t,e,"out"))}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;d(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!r(t))if(h(t))this.now=t;else if(c(t)){const e=d(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=tn.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:r,size:n,total:a}=e,{width:o,height:l}=n&&(h(n)?{width:n,height:n}:n)||(a>1?this:t);let d=r?r.x:0,c=r?r.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:o,height:l},d+o>=t.width?(d=0,c+=l):d+=o;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Na(Na.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),r(n.loop)||(s=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:r}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,r)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},fe([Wn(Z_)],t.Robot.prototype,"__",void 0),fe([mn()],t.Robot.prototype,"robot",void 0),fe([un()],t.Robot.prototype,"actions",void 0),fe([un("")],t.Robot.prototype,"action",void 0),fe([kn(0)],t.Robot.prototype,"now",void 0),fe([un(12)],t.Robot.prototype,"FPS",void 0),fe([un(!0)],t.Robot.prototype,"loop",void 0),t.Robot=fe([Vn()],t.Robot),oe.add("robot");const ip={};function sp(t,e,i){const{normalStyle:s}=t;e||(e=ip),e.scale&&(M.assignScale(e,e.scale),delete e.scale),e!==ip&&el.canAnimate||(i=null);let r=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&n(i[s])&&n(e[s])&&(s="transition");return n(e[s])?i[s]:e[s]}(i,e,t);const a=r?function(t,e){const i=ap(e,t),s=t.animate();s&&ap(i,t,s.fromStyle);return i}(t,e):void 0;el.canAnimate&&rp(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const o=rp(t);if(o){const{animation:s}=o;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(o,n.endingStyle),"in"!==i||e.animation!==s?n.kill():r=!1,delete o.animation}t.normalStyle=np(o,t),t.set(o,"temp")}else t.normalStyle=void 0;if(r){const e=np(a,t);t.set(a,"temp"),t.animate([a,e],r,"transition",!0)}t.__layout.stateStyleChanged=!1}function rp(t){let e;const i={},s=$_(t),r=s?t.state||s.state:t.state,n=r&&t.states[r];n&&el.isState(r,t,s)&&(e=op(i,n));const a=i.selectedStyle||t.selectedStyle;a&&el.isSelected(t,s)&&(e=op(i,a));const o=i.placeholderStyle||t.placeholderStyle;if(o&&el.isPlacehold(t,s)&&(e=op(i,o)),el.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=op(i,s))}else{const r=i.focusStyle||t.focusStyle;r&&el.isFocus(t,s)&&(e=op(i,r));const n=i.hoverStyle||t.hoverStyle;n&&el.isHover(t,s)&&(e=op(i,n));const a=i.pressStyle||t.pressStyle;a&&el.isPress(t,s)&&(e=op(i,a))}return e?i:void 0}function np(t,e,i,s){const r=i?t:{},n=i||t;for(let t in n)s&&el.animateExcludes[t]||(r[t]=e[t]);return r}function ap(t,e,i){return np(t,e,i,!0)}function op(t,e){return Object.assign(t,e),!0}function hp(t,e){const i=t[e];i&&tp(t,i),t.button&&dp(t.children,e)}function lp(t,e,i){i||(i=t.states[e]),tp(t,i),t.button&&dp(t.children,null,e)}function dp(t,e,i){if(!t)return;let s,n;for(let a=0,o=t.length;a<o;a++){if(s=t[a],e){switch(n=!0,e){case"hoverStyle":el.isHover(s)&&(n=!1);break;case"pressStyle":el.isPress(s)&&(n=!1);break;case"focusStyle":el.isFocus(s)&&(n=!1)}n&&hp(s,e)}else r(i)||lp(s,i);s.isBranch&&dp(s.children,e,i)}}function cp(t,e){const i=t[e];i&&ep(t,i),t.button&&_p(t.children,e)}function up(t,e,i){ep(t,i),t.button&&_p(t.children,null,e)}function _p(t,e,i){if(!t)return;let s;for(let n=0,a=t.length;n<a;n++)s=t[n],e?cp(s,e):r(i)||up(s,i),s.isBranch&&_p(s.children,e,i)}function pp(t,e,i){let s;const r=e.leafer?e.leafer.interaction:null;if(r&&(s=r[t](e),!s&&i)){const n=$_(e,i);n&&(s=r[t](n))}return s}function gp(t,e,i){let s=e[t];if(!s&&i){const r=$_(e,i);r&&(s=r[t])}return s}oe.add("state"),el.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},el.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const r=$_(e,i);r&&(s=r.states[t])}return!!s}(t,e,i)},el.isSelected=function(t,e){return gp("selected",t,e)},el.isDisabled=function(t,e){return gp("disabled",t,e)},el.isFocus=function(t,e){return pp("isFocus",t,e)},el.isHover=function(t,e){return pp("isHover",t,e)},el.isPress=function(t,e){return pp("isPress",t,e)},el.isPlacehold=function(t,e){return t.__.__isPlacehold},el.isDrag=function(t,e){return pp("isDrag",t,e)},el.setStyleName=function(t,e,i){i?lp(t,e,t[e]):up(t,e,t[e])},el.set=function(t,e){const i=t.states[e];i?lp(t,e,i):up(t,e,i)},el.getStyle=rp,el.updateStyle=sp,el.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:hp(e,"hoverStyle");break;case t.PointerEvent.LEAVE:cp(e,"hoverStyle");break;case t.PointerEvent.DOWN:hp(e,"pressStyle");break;case t.PointerEvent.UP:cp(e,"pressStyle")}};const fp=t.UI.prototype;t.UI.addAttr("selected",!1,Q_,"selectedStyle"),t.UI.addAttr("disabled",!1,Q_,"disabledStyle"),t.UI.addAttr("states",{},J_),t.UI.addAttr("state","",Q_),t.UI.addAttr("normalStyle",void 0,un),t.UI.addAttr("hoverStyle",void 0,J_),t.UI.addAttr("pressStyle",void 0,J_),t.UI.addAttr("focusStyle",void 0,J_),t.UI.addAttr("selectedStyle",void 0,J_),t.UI.addAttr("disabledStyle",void 0,J_),t.UI.addAttr("placeholderStyle",void 0,J_),t.UI.addAttr("button",!1,un),fp.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},fp.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?hp(this,"focusStyle"):cp(this,"focusStyle")})},fp.updateState=function(){el.updateStyle(this,void 0,"in")};const yp=t.Text.prototype,mp="text";an(yp,mp,Object.assign(Object.assign({},on(yp,mp)),{set(t){const e=this,i=e.text;e.__setAttr(mp,t)&&(xn(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:vp,sin:xp,pow:wp,sqrt:bp,abs:Ep,ceil:Sp,floor:Pp,round:Bp,PI:kp}=Math,Tp=5*kp,Rp=1.70158,Cp=2.5949095,Lp=7.5625,Ap=2.75;function Dp(t){return e=>wp(e,t)}function Op(t){return e=>1-wp(1-e,t)}function Ip(t){return e=>e<.5?.5*wp(2*e,t):1-.5*wp(2-2*e,t)}function Fp(t){return t<1/Ap?Lp*t*t:t<2/Ap?Lp*(t-=1.5/Ap)*t+.75:t<2.5/Ap?Lp*(t-=2.25/Ap)*t+.9375:Lp*(t-=2.625/Ap)*t+.984375}function Mp(t,e,i,s){const r={};return n=>{const a=~~(1e4*n),o=r[a];if(o)return o;let h,l,d,c=n;for(let e=0;e<8&&(h=1-c,d=Wp(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Ep(l)<1e-6));e++)c-=d/l;return r[a]=Wp(c,e,s)}}function Wp(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Up={get(t){const{list:e}=Up;return a(t)?e[t||"ease"]:c(t)?e[t.name].apply(e,d(t.value)?t.value:[t.value]):e.ease},register(t,e){Up.list[t]=e},list:{linear:t=>t,ease:Mp(.25,.1,.25,1),"ease-in":Mp(.42,0,1,1),"ease-out":Mp(0,0,.58,1),"ease-in-out":Mp(.42,0,.58,1),"sine-in":t=>1-vp(t*kp*.5),"sine-out":t=>xp(t*kp*.5),"sine-in-out":t=>.5*(1-vp(t*kp)),"quad-in":Dp(2),"quad-out":Op(2),"quad-in-out":Ip(2),"cubic-in":Dp(3),"cubic-out":Op(3),"cubic-in-out":Ip(3),"quart-in":Dp(4),"quart-out":Op(4),"quart-in-out":Ip(4),"quint-in":Dp(5),"quint-out":Op(5),"quint-in-out":Ip(5),"expo-in":t=>t?wp(2,10*t-10):0,"expo-out":t=>1===t?1:1-wp(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*wp(2,2*t*10-10):.5*(2-wp(2,10-2*t*10)),"circ-in":t=>1-bp(1-wp(t,2)),"circ-out":t=>bp(1-wp(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-bp(1-wp(2*t,2))):.5*(bp(1-wp(2-2*t,2))+1),"back-in":t=>((Rp+1)*t-Rp)*t*t,"back-out":t=>(t-=1)*t*((Rp+1)*t+Rp)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Cp+1)*t-Cp)*.5:.5*((t=2*t-2)*t*((Cp+1)*t+Cp)+2),"elastic-in":t=>0===t||1===t?t:-wp(2,10*(t-1))*xp((t-1.1)*Tp),"elastic-out":t=>0===t||1===t?t:wp(2,-10*t)*xp((t-.1)*Tp)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-wp(2,10*((t*=2)-1))*xp((t-1.1)*Tp)*.5:wp(2,10*(1-(t*=2)))*xp((t-1.1)*Tp)*.5+1,"bounce-in":t=>1-Fp(1-t),"bounce-out":Fp,"bounce-in-out":t=>t<.5?.5*(1-Fp(1-2*t)):.5*(1+Fp(2*t-1)),"cubic-bezier":Mp,steps:function(t,e="floor"){return i=>("floor"===e?Pp(i*t):"ceil"===e?Sp(i*t):Bp(i*t))/t}}};function Np(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class zp{}zp.CREATED="created",zp.PLAY="play",zp.PAUSE="pause",zp.STOP="stop",zp.SEEK="seek",zp.UPDATE="update",zp.COMPLETED="completed";t.Animate=class extends ro{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:r}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&r&&h(r)&&(t+=r-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),this.nowIndex=0,this.playedTotalTime=0,e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=d(e)?e:e?[e]:[];const{easing:r,attrs:n}=this;this.easingFn=Up.get(r),(n||this.attrsMap)&&(this.attrsMap=n?n.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.startRequestAnimate():(this.clearTimer(),this.start()),this.emitType(zp.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(zp.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(zp.STOP))}seek(t,e){if(this.destroyed)return;const{delay:i}=this;let s;c(t)&&(t=Vh.number(t,this.duration+(e?i:0))),e&&(t-=i),t&&(t/=this.speed),t<0&&(s=-t,t=0),(!this.started||t<this.time||!t)&&this.start(!0),this.time=t,s||this.animate(0,!0),this.clearTimer(()=>{s?this.timer=setTimeout(()=>{this.timer=0,this.begin()},1e3*s):this.startRequestAnimate()}),this.emitType(zp.SEEK)}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,a=!(n>1)||this.join;let o,l,d,c,u,_=0,p=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(l=i[s],c=l.style||l,o||(o=a?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:r,swing:n,loop:a}=l;n&&(d.swing=h(n)?n:2,u=2*d.swing-1),a&&(d.loop=u=h(a)?a:2),t?(d.duration=t,_+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,p+=e*u),i?(d.delay=i,_+=i*u):s&&(d.autoDelay=s,p+=s*u),r&&(d.easingFn=Up.get(r))}if(!d.autoDuration&&r(d.duration)&&(n>1?s>0||a?p+=u:d.duration=0:d.duration=this.duration),n>1)this.setBefore(d,c,o);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}o=c,e.push(d)}p?((this.duration<=_||!s||!s.duration)&&this.changeDuration(_+.2*p),this.allocateTime((this.duration-_)/p)):_&&this.changeDuration(_),this.emitType(zp.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:n,target:a}=this;for(let o in e)r(s[o])&&(s[o]=n[o]=e===i?i[o]:a[o]),t.beforeStyle[o]=r(i[o])?n[o]:i[o],n[o]=e[o]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],r(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}startRequestAnimate(){this.requestAnimateTime=Date.now(),this.requestAnimatePageTime=0,this.waitRequestRender||this.requestAnimate()}requestAnimate(){this.waitRequestRender=!0,m.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(this.waitRequestRender=!1,!this.running)return;let e;e=t&&this.requestAnimatePageTime?t-this.requestAnimatePageTime:Date.now()-this.requestAnimateTime,this.time+=e/1e3,this.requestAnimatePageTime=t,this.requestAnimateTime=Date.now()}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e,jump:i}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?(i&&this.begin(!0),this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3)):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.startRequestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(zp.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,r=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(r);else{const{attrsMap:i,target:n}=this;let{betweenStyle:a}=this.frame;a||(a=this.frame.betweenStyle={}),il.setBetweenStyle(a,s,r,e,t,n,i),this.setStyle(a)}this.emitType(zp.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return h(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}},fe([Np("ease")],t.Animate.prototype,"easing",void 0),fe([Np(0)],t.Animate.prototype,"delay",void 0),fe([Np(.2)],t.Animate.prototype,"duration",void 0),fe([Np("auto")],t.Animate.prototype,"ending",void 0),fe([Np(!1)],t.Animate.prototype,"reverse",void 0),fe([Np(!1)],t.Animate.prototype,"swing",void 0),fe([Np(!1)],t.Animate.prototype,"loop",void 0),fe([Np(0)],t.Animate.prototype,"loopDelay",void 0),fe([Np(1)],t.Animate.prototype,"speed",void 0),fe([Np(!0)],t.Animate.prototype,"autoplay",void 0),fe([Np()],t.Animate.prototype,"join",void 0),fe([Np()],t.Animate.prototype,"jump",void 0),fe([Np()],t.Animate.prototype,"attrs",void 0),t.Animate=fe([qn(fo)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=e.map(e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s})}play(){this.each(t=>t.play()),this.emitType(zp.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(zp.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(zp.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(zp.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case zp.COMPLETED:this.completed&&this.emitType(t);break;case zp.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}},t.AnimateList=fe([qn(fo)],t.AnimateList);const Yp={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},Xp=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Hp=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,jp=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,qp=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Vp=parseInt,Gp=parseFloat,{round:Kp}=Math;let Zp={},Qp=0;function Jp(t){let e,i,s,r=1;switch(t.length){case 9:e=Vp(t.slice(1,3),16),i=Vp(t.slice(3,5),16),s=Vp(t.slice(5,7),16),r=Vp(t.slice(7,9),16)/255;break;case 7:e=Vp(t.slice(1,3),16),i=Vp(t.slice(3,5),16),s=Vp(t.slice(5,7),16);break;case 5:e=Vp(t[1]+t[1],16),i=Vp(t[2]+t[2],16),s=Vp(t[3]+t[3],16),r=Vp(t[4]+t[4],16)/255;break;case 4:e=Vp(t[1]+t[1],16),i=Vp(t[2]+t[2],16),s=Vp(t[3]+t[3],16);break;case 3:e=i=s=Vp(t[1]+t[2],16);break;case 2:e=i=s=Vp(t[1]+t[1],16)}return{r:e,g:i,b:s,a:r}}const $p=1/6,tg=.5,eg=2/3,ig=1/3;function sg(t,e,i){return i<0?i++:i>1&&i--,i<$p?t+6*(e-t)*i:i<tg?e:i<eg?t+(e-t)*(eg-i)*6:t}function rg(t,e,i,s=1){let r,n,a;if(t/=360,i/=100,0===(e/=100))r=n=a=i;else{let s=i<.5?i*(1+e):i+e-i*e,o=2*i-s;r=sg(o,s,t+ig),n=sg(o,s,t),a=sg(o,s,t-ig)}return{r:Kp(255*r),g:Kp(255*n),b:Kp(255*a),a:s}}oe.add("color"),qh.object=function(t,e){let i,s=!r(e)&&e<1;if(a(t)){const e=Zp[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Jp(t);break;case"R":case"r":"("===t[4]&&Hp.test(t)?i=function(t){const e=Hp.exec(t);return{r:Vp(e[1]),g:Vp(e[2]),b:Vp(e[3]),a:Gp(e[4])}}(t):"("===t[3]&&Xp.test(t)&&(i=function(t){const e=Xp.exec(t);return{r:Vp(e[1]),g:Vp(e[2]),b:Vp(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&qp.test(t)?i=function(t){const e=qp.exec(t);return rg(Gp(e[1]),Gp(e[2]),Gp(e[3]),Gp(e[4]))}(t):"("===t[3]&&jp.test(t)&&(i=function(t){const e=jp.exec(t);return rg(Gp(e[1]),Gp(e[2]),Gp(e[3]),1)}(t))}if(!i){const e=Yp[t.toLowerCase()];e&&(i=Jp("#"+e))}i&&(Qp++,Qp>1e4&&(Zp={},Qp=0),Zp[t]=Object.assign({},i))}}else c(t)&&(r(t.a)&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:ng}=Math,{fourNumber:ag}=M,og={fill:ug,stroke:ug,cornerRadius:(t,e,i)=>h(t)&&h(e)?dg(t,e,i):(t=ag(t),e=ag(e),t.map((t,s)=>dg(t,e[s],i))),text(t,e,i){if(a(t)&&a(e)){const s=t.length,r=e.length,n=dg(s,r,i,1);return s<r?e.substring(0,n):t.substring(0,n)}return h(t)||h(e)?M.float(dg(t,e,i),Math.max(lg(t),lg(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const r=Object.assign(Object.assign({},t),e);return il.setBetweenStyle(r,t,e,r,i,s),r},shadow:_g,innerShadow:_g},hg={value:function(t,e,i){const s=h(t),r=h(e);return s&&r?t+(e-t)*i:r||s?dg(t,e,i):t},number:dg,color:cg,setBetweenStyle:function(t,e,i,s,r,n,a){let o,h,l;const{list:d,value:c}=il;for(let u in s)a&&!a[u]||(o=e[u],h=i[u],l=d[u]||c,o!==h&&(t[u]=l(o,h,r,n)))}};function lg(t){const e=String(t).split(".")[1];return e?e.length:0}function dg(t,e,i,s){t||(t=0),e||(e=0);const r=t+(e-t)*i;return s?ng(r):r}function cg(t,e,i){t=qh.object(t),e=qh.object(e);const s=dg(t.r,e.r,i,1)+","+dg(t.g,e.g,i,1)+","+dg(t.b,e.b,i,1),r=dg(t.a,e.a,i);return 1===r?"rgb("+s+")":"rgba("+s+","+r+")"}function ug(t,e,i){return a(t)&&a(e)?cg(t,e,i):e}function _g(t,e,i){return d(t)||d(e)?e:(e=e||{},{x:dg((t=t||{}).x,e.x,i),y:dg(t.y,e.y,i),blur:dg(t.blur,e.blur,i),spread:dg(t.spread,e.spread,i),color:cg(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}oe.add("animate","color"),el.canAnimate=!0,Object.assign(il.list,og),Object.assign(il,hg);const pg=t.UI.prototype;t.UI.addAttr("animation",void 0,function(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),t.UI.addAttr("animationOut",void 0,un),t.UI.addAttr("transition",!0,un),t.UI.addAttr("transitionOut",void 0,un),pg.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},pg.animate=function(e,i,s,n){if(r(e))return this.__animate;let a=d(e)&&!i&&s?new t.AnimateList(this,e,n):new t.Animate(this,e,i,n);this.killAnimate(s,a.toStyle);const o=this.__animate;return o&&(a instanceof t.AnimateList?a.list.unshift(o):a=new t.AnimateList(this,[o,a])),this.__animate=a},pg.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:r}=s;for(let t in i)if(t in r){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},pg.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(zp.COMPLETED,e)};const gg=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],fg=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:yg}=Math,{getDerivative:mg}=oi,vg={getDistance(t,e,i,s,r,n,a,o,h=1){let l,d,c,u,_,p,g=0,f=h/2;for(let h=0;h<gg.length;h++)l=f*(1+gg[h]),d=f*(1-gg[h]),c=mg(l,t,i,r,a),u=mg(l,e,s,n,o),_=mg(d,t,i,r,a),p=mg(d,e,s,n,o),g+=fg[h]*(yg(c*c+u*u)+yg(_*_+p*p));return g*f},getRotation(t,e,i,s,r,n,a,o,h){const l=mg(t,e,s,n,o),d=mg(t,i,r,a,h);return Math.atan2(d,l)/U},getT(t,e,i,s,r,n,a,o,h,l,d=1){let c=0,u=1,_=t/e,p=d/e/3;if(_>=1)return 1;if(_<=0)return 0;for(;u-c>p;)xg(i,s,r,n,a,o,h,l,_)<t?c=_:u=_,_=(c+u)/2;return _},cut(t,e,i,s,r,n,a,o,h,l){const d=1-e,c=d*i+e*r,u=d*s+e*n,_=d*r+e*a,p=d*n+e*o,g=d*c+e*_,f=d*u+e*p,y=d*g+e*(d*_+e*(d*a+e*h)),m=d*f+e*(d*p+e*(d*o+e*l));t.push(Oe.C,c,u,g,f,y,m)}},{getDistance:xg}=vg,{M:wg,L:bg,C:Eg,Z:Sg}=Oe,{float:Pg}=M,Bg={},kg={},Tg={transform(t,e){let i,s=0;const r=t.length;for(;s<r;)switch(i=t[s],i){case wg:case bg:Tg.transformPoints(t,e,s,1),s+=3;break;case Eg:Tg.transformPoints(t,e,s,3),s+=7;break;case Sg:s+=1}},transformPoints(t,e,i,s){for(let r=i+1,n=r+2*s;r<n;r+=2)Bg.x=t[r],Bg.y=t[r+1],J.toOuterPoint(e,Bg),t[r]=Bg.x,t[r+1]=Bg.y},getMotionPathData(t){let e,i,s,r,n=0,a=[],o=0,h=0,l=0;const d=t.length;for(;o<d;){switch(r=t[o],r){case wg:case bg:i=t[o+1],s=t[o+2],e=r===bg&&o>0?dt.getDistanceFrom(h,l,i,s):0,h=i,l=s,o+=3;break;case Eg:i=t[o+5],s=t[o+6],e=vg.getDistance(h,l,t[o+1],t[o+2],t[o+3],t[o+4],i,s),h=i,l=s,o+=7;break;case Sg:o+=1;default:e=0}a.push(e),n+=e}return{total:n,segments:a,data:t}},getDistancePoint(t,e,i){const{segments:s,data:r}=t;e=Vh.number(e,t.total);let n,a,o,h,l,d,c,u,_,p=0,g={},f=0,y=0,m=0,v=0;const x=r.length;for(;f<x;){switch(h=r[f],h){case wg:case bg:if(a=r[f+1],o=r[f+2],n=s[y],p+n>=e||!t.total)return f||(m=a,v=o),kg.x=m,kg.y=v,g.x=a,g.y=o,dt.getDistancePoint(kg,g,e-p,!0),g.rotation=dt.getAngle(kg,g),g;m=a,v=o,f+=3;break;case Eg:if(a=r[f+5],o=r[f+6],n=s[y],p+n>=e)return l=r[f+1],d=r[f+2],c=r[f+3],u=r[f+4],_=vg.getT(e-p,n,m,v,l,d,c,u,a,o,i),oi.getPointAndSet(_,m,v,l,d,c,u,a,o,g),g.rotation=vg.getRotation(_,m,v,l,d,c,u,a,o),g;m=a,v=o,f+=7;break;case Sg:f+=1;default:n=0}y++,p+=n}return g},getDistancePath(t,e,i){const{segments:s,data:r}=t,n=[];e=Vh.number(e,t.total);let a,o,h,l,d,c,u,_,p,g,f=0,y={},m=0,v=0,x=0,w=0;const b=r.length;for(;m<b;){switch(d=r[m],d){case wg:case bg:if(h=r[m+1],l=r[m+2],a=s[v],f+a>e||!t.total)return m||(x=h,w=l),kg.x=x,kg.y=w,y.x=h,y.y=l,o=Pg(e-f),o&&(dt.getDistancePoint(kg,y,o,!0),n.push(d,y.x,y.y)),n;x=h,w=l,m+=3,n.push(d,x,w);break;case Eg:if(c=r[m+1],u=r[m+2],_=r[m+3],p=r[m+4],h=r[m+5],l=r[m+6],a=s[v],f+a>e)return o=Pg(e-f),o&&(g=vg.getT(o,a,x,w,c,u,_,p,h,l,i),vg.cut(n,g,x,w,c,u,_,p,h,l)),n;x=h,w=l,m+=7,n.push(d,c,u,_,p,h,l);break;case Sg:m+=1,n.push(d);default:a=0}v++,f+=a}return n}};function Rg(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!n(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}oe.add("motion-path"),il.register("motion",function(t,e,i,s){return c(t)&&(t=Vh.number(t,s.getMotionTotal())),c(e)&&(e=Vh.number(e,s.getMotionTotal())),il.number(t||0,e||0,i)}),il.register("motionRotation",function(t,e,i){return il.number(t,e,i)});const Cg=t.UI.prototype,{updateMatrix:Lg,updateAllMatrix:Ag}=aa,{updateBounds:Dg}=ma;function Og(t){const{motion:e,leaferIsCreated:i}=t;if(!n(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Fg(t);i.total&&(t.__.__pathForRender=Tg.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Ag(t),Dg(t,t)):Lg(t));i&&(t.leafer.created=!0)}}function Ig(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function Fg(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Tg.getMotionPathData(t.getPath(!0,!0))}t.UI.addAttr("motionPath",void 0,Rg),t.UI.addAttr("motionPrecision",1,Rg),t.UI.addAttr("motion",void 0,Rg),t.UI.addAttr("motionRotation",!0,Rg),Cg.getMotionPathData=function(){return Fg(Ig(this))},Cg.getMotionPoint=function(t){const e=Ig(this),i=Fg(e);if(!i.total)return{};const s=Tg.getDistancePoint(i,t,e.motionPrecision);J.toOuterPoint(e.localTransform,s);const{motionRotation:r}=this;return!1===r?delete s.rotation:h(r)&&(s.rotation+=r),s},Cg.getMotionTotal=function(){return this.getMotionPathData().total},Cg.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],n(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Og(t))}else Og(this)};const{Yes:Mg,NoAndSkip:Wg,YesAndSkip:Ug}=t.Answer,Ng={},zg={},Yg={};class Xg{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":Ng.id=t.substring(1),t=Ng;break;case".":zg.className=t.substring(1),t=zg;break;default:Yg.tag=t,t=Yg}case"object":if(r(t.id)){if(t.tag){const{tag:s}=t,r=d(s);return this.getByMethod(r?this.methods.tags:this.methods.tag,e,i,r?_.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&aa.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const r=i?null:[];return this.eachFind(this.toChildren(e),t,r,s),r||this.findLeaf}eachFind(t,e,i,s){let r,n;for(let a=0,o=t.length;a<o;a++){if(r=t[a],n=e(r,s),"boolean"==typeof n&&(n=n?1:0),n===Mg||n===Ug){if(!i)return void(this.findLeaf=r);i.push(r)}r.isBranch&&n<Wg&&this.eachFind(r.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Fa.REMOVE,this.__onRemoveChild,this),this.target.on_(Wa.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const Hg=t.UI.prototype;function jg(t){return t.leafer?t.leafer.selector:m.selector||(m.selector=he.selector())}return Hg.find=function(t,e){return jg(this).getBy(t,this,!1,e)},Hg.findOne=function(t,e){return jg(this).getBy(t,this,!0,e)},oe.add("find"),he.finder=function(t){return new Xg(t)},t.AlignHelper=Tt,t.AnimateEasing=Up,t.AnimateEvent=zp,t.AroundHelper=Pt,t.AutoBounds=Qt,t.BezierHelper=oi,t.Bounds=Kt,t.BoundsEvent=za,t.BoundsHelper=jt,t.BoxData=ul,t.BranchHelper=ma,t.BranchRender=Fo,t.CanvasData=Pl,t.CanvasManager=ge,t.ChildEvent=Fa,t.ColorConvert=qh,t.Creator=he,t.Cursor=tc,t.DataHelper=_,t.Debug=te,t.DragBoundsHelper=Ld,t.Dragger=Xd,t.Effect=Jh,t.EllipseData=yl,t.EllipseHelper=fi,t.Event=Ia,t.EventCreator=_e,t.Eventer=ro,t.Export=tl,t.FileHelper=qr,t.Filter=$h,t.Finder=Xg,t.FourNumberHelper=k,t.FrameData=pl,t.GroupData=cl,t.HighBezierHelper=vg,t.HighCurveHelper=Tg,t.HitCanvasManager=ec,t.ImageData=Sl,t.ImageEvent=Na,t.ImageManager=tn,t.IncrementId=x,t.InteractionBase=$d,t.InteractionHelper=Md,t.Keyboard=yd,t.LayoutEvent=Ka,t.Layouter=Oh,t.LeafBounds=Do,t.LeafBoundsHelper=pa,t.LeafData=g,t.LeafDataProxy=mo,t.LeafEventer=fo,t.LeafHelper=aa,t.LeafLayout=Oa,t.LeafLevelList=mh,t.LeafList=yh,t.LeafMatrix=Po,t.LeafRender=Oo,t.LeaferCanvas=vh,t.LeaferCanvasBase=Le,t.LeaferData=_l,t.LeaferEvent=Qa,t.LeaferImage=nn,t.LineData=gl,t.MathHelper=M,t.Matrix=mt,t.MatrixHelper=J,t.MyDragEvent=Id,t.MyImage=dd,t.MyPointerEvent=Dd,t.MyTouchEvent=Fd,t.NeedConvertToCanvasCommandMap=Fe,t.OneRadian=U,t.PI2=N,t.PI_2=z,t.Paint=Kh,t.PaintGradient=Qh,t.PaintImage=Zh,t.PathArrow=Gh,t.PathBounds=Or,t.PathCommandDataHelper=Ss,t.PathCommandMap=Oe,t.PathCommandNodeHelper=yi,t.PathConvert=es,t.PathCorner=zr,t.PathCreator=zs,t.PathData=xl,t.PathDrawer=ir,t.PathHelper=Ae,t.PathNumberCommandLengthMap=Ne,t.PathNumberCommandMap=Ue,t.PenData=wl,t.Picker=Nh,t.Platform=m,t.Plugin=oe,t.Point=ft,t.PointHelper=dt,t.PointerButton=md,t.PolygonData=ml,t.PropertyEvent=Wa,t.RectData=fl,t.RectHelper=ze,t.RectRender=Al,t.RenderEvent=Za,t.Renderer=Fh,t.ResizeEvent=Va,t.Resource=Jr,t.RobotData=Z_,t.Run=re,t.Selector=zh,t.StarData=vl,t.State=el,t.StringNumberMap=Jt,t.TaskItem=Kr,t.TaskProcessor=Zr,t.TextConvert=jh,t.TextData=El,t.Transition=il,t.TwoPointBoundsHelper=xt,t.UIBounds=Tl,t.UICreator=de,t.UIData=ll,t.UIEvent=vd,t.UIRender=Cl,t.UnitConvert=Vh,t.WaitHelper=Sa,t.WatchEvent=Ga,t.Watcher=Eh,t.affectRenderBoundsType=Bn,t.affectStrokeBoundsType=En,t.attr=dn,t.autoLayoutType=gn,t.boundsType=mn,t.canvasPatch=jr,t.canvasSizeAttrs=Ce,t.createAttr=function(t){return(e,i)=>{an(e,i,hn(i,t))}},t.createDescriptor=hn,t.cursorType=Mn,t.dataProcessor=Wn,t.dataType=un,t.decorateLeafAttr=ln,t.defineDataProcessor=Un,t.defineKey=an,t.defineLeafAttr=cn,t.dimType=Tn,t.doBoundsType=xn,t.doStrokeType=Sn,t.effectType=Yh,t.emptyData=s,t.eraserType=In,t.extraPropertyEventMap=Ua,t.getBoundsData=X,t.getDescriptor=on,t.getMatrixData=H,t.getPointData=Y,t.hitType=Fn,t.isArray=d,t.isData=function(t){return c(t)&&!d(t)},t.isEmptyData=u,t.isFinite=o,t.isNull=n,t.isNumber=h,t.isObject=c,t.isString=a,t.isUndefined=r,t.layoutProcessor=function(t){return(e,i)=>{an(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=io,t.maskType=On,t.motionPathType=Rg,t.naturalBoundsType=vn,t.opacityType=Rn,t.path=Yr,t.pathInputType=wn,t.pathType=bn,t.pen=Xr,t.positionType=_n,t.registerUI=Vn,t.registerUIEvent=Gn,t.resizeType=Xh,t.rewrite=Xn,t.rewriteAble=Hn,t.rotationType=yn,t.scaleType=fn,t.scrollType=pn,t.sortType=Dn,t.stateStyleType=J_,t.stateType=Q_,t.strokeType=Pn,t.surfaceType=kn,t.tempBounds=Zt,t.tempMatrix=vt,t.tempPoint=yt,t.tryToNumber=function(t){return"string"==typeof t&&l.test(t)?+t:t},t.useCanvas=wh,t.useModule=qn,t.version="1.12.2",t.visibleType=Cn,t.zoomLayerType=Hh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
2
2
  //# sourceMappingURL=worker.min.js.map