@leafer/core 1.0.0-rc.9 → 1.0.0

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 +0,0 @@
1
- const t={image:{maxCacheSize:4096e3,maxPatternSize:8847360,suffix:"leaf"}},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s,{round:r,pow:a,PI:o}=Math,n={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t,e){let s;if(t instanceof Array)switch(t.length){case 4:s=t;break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),e)for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),t),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=e?a(10,e):1e12;return-0===(t=r(t*s)/s)?0:t}},h=o/180,l=2*o,d=o/2,{sin:c,cos:u,acos:p,sqrt:_}=Math,{float:g}=n,f={};function m(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function y(){return 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 x={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:y(),tempMatrix:{},set(t,e=1,s=0,i=0,r=1,a=0,o=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=a,t.f=o},get:m,getWorld:y,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,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,i){v.toInnerPoint(t,e,f),v.scaleOfInner(t,f,s,i)},scaleOfInner(t,e,s,i=s){v.translateInner(t,e.x,e.y),v.scale(t,s,i),v.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:a}=t,o=u(e*=h),n=c(e);t.a=s*o-i*n,t.b=s*n+i*o,t.c=r*o-a*n,t.d=r*n+a*o},rotateOfOuter(t,e,s){v.toInnerPoint(t,e,f),v.rotateOfInner(t,f,s)},rotateOfInner(t,e,s){v.translateInner(t,e.x,e.y),v.rotate(t,s),v.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:a,d:o}=t;s&&(s*=h,t.a=i+a*s,t.b=r+o*s),e&&(e*=h,t.c=a+i*e,t.d=o+r*e)},skewOfOuter(t,e,s,i){v.toInnerPoint(t,e,f),v.skewOfInner(t,f,s,i)},skewOfInner(t,e,s,i=0){v.translateInner(t,e.x,e.y),v.skew(t,s,i),v.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:a,e:o,f:n}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*a,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*a,t.e=e.e*s+e.f*r+o,t.f=e.e*i+e.f*a+n},multiplyParent(t,e,s,i,r){const{e:a,f:o}=t;if(s||(s=t),void 0===i&&(i=1!==t.a||t.b||t.c||1!==t.d),i){const{a:i,b:a,c:o,d:n}=t;s.a=i*e.a+a*e.c,s.b=i*e.b+a*e.d,s.c=o*e.a+n*e.c,s.d=o*e.b+n*e.d,r&&v.multiplyParentLayout(s,e,r)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,r&&v.multiplyParentLayout(s,e);s.e=a*e.a+o*e.c+e.e,s.f=a*e.b+o*e.d+e.f},multiplyParentLayout(t,e,s){s?(t.scaleX=e.scaleX*s.scaleX,t.scaleY=e.scaleY*s.scaleY,t.rotation=e.rotation+s.rotation,t.skewX=e.skewX+s.skewX,t.skewY=e.skewY+s.skewY):(t.scaleX=e.scaleX,t.scaleY=e.scaleY,t.rotation=e.rotation,t.skewX=e.skewX,t.skewY=e.skewY)},divide(t,e){v.multiply(t,v.tempInvert(e))},divideParent(t,e){v.multiplyParent(t,v.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=v;return v.copy(e,t),v.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:a,f:o}=t;if(s||i){const n=1/(e*r-s*i);t.a=r*n,t.b=-s*n,t.c=-i*n,t.d=e*n,t.e=-(a*r-o*i)*n,t.f=-(o*e-a*s)*n}else if(1===e&&1===r)t.e=-a,t.f=-o;else{const s=1/(e*r);t.a=r*s,t.d=e*s,t.e=-a*r*s,t.f=-o*e*s}},toOuterPoint(t,e,s,i){const{x:r,y:a}=e;s||(s=e),s.x=r*t.a+a*t.c,s.y=r*t.b+a*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:r,b:a,c:o,d:n}=t,h=1/(r*n-a*o),{x:l,y:d}=e;if(s||(s=e),s.x=(l*n-d*o)*h,s.y=(d*r-l*a)*h,!i){const{e:e,f:i}=t;s.x-=(e*n-i*o)*h,s.y-=(i*r-e*a)*h}},setLayout(t,e,s,i){const{x:r,y:a,scaleX:o,scaleY:n}=e;if(void 0===i&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:i,skewY:r}=e,a=s*h,l=u(a),d=c(a);if(i||r){const e=i*h,s=r*h;t.a=(l+s*-d)*o,t.b=(d+s*l)*o,t.c=(e*l-d)*n,t.d=(l+e*d)*n}else t.a=l*o,t.b=d*o,t.c=-d*n,t.d=l*n}else t.a=o,t.b=0,t.c=0,t.d=n;t.e=r,t.f=a,s&&v.translateInner(t,-s.x,-s.y)},getLayout(t,e,s){const{a:i,b:r,c:a,d:o,e:n,f:l}=t;let f,m,y,x,v,w=n,b=l;if(r||a){const t=i*o-r*a;if(a&&!s){f=_(i*i+r*r),m=t/f;const e=i/f;y=r>0?p(e):-p(e)}else{m=_(a*a+o*o),f=t/m;const e=a/m;y=d-(o>0?p(-e):-p(e))}const e=u(y),n=c(y);f=g(f),m=g(m),x=g((a/m+n)/e/h),v=g((r/f-n)/e/h),y=g(y/h)}else f=i,m=o,y=x=v=0;return e&&(w+=e.x*i+e.y*a,b+=e.x*r+e.y*o),{x:w,y:b,scaleX:f,scaleY:m,rotation:y,skewX:x,skewY:v}},reset(t){v.set(t)}},v=x,{toInnerPoint:w,toOuterPoint:b}=x,{sin:C,cos:O,abs:T,sqrt:k,atan2:B,min:P,PI:E}=Math,R={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=void 0===s?e:s},copy(t,e){t.x=e.x,t.y=e.y},move(t,e,s){t.x+=e,t.y+=s},rotate(t,e,s){s||(s=D.defaultPoint);const i=O(e*=h),r=C(e),a=t.x-s.x,o=t.y-s.y;t.x=s.x+a*i-o*r,t.y=s.y+a*r+o*i},tempToInnerOf(t,e){const{tempPoint:s}=D;return D.copy(s,t),w(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=D;return D.copy(s,t),b(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=D;return D.copy(s,t),D.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),w(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){w(e,t,s)},toOuterOf(t,e,s){b(e,t,s)},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)=>D.getDistanceFrom(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=T(s-t),a=T(i-e);return k(r*r+a*a)},getMinDistanceFrom:(t,e,s,i,r,a)=>P(D.getDistanceFrom(t,e,s,i),D.getDistanceFrom(s,i,r,a)),getAngle:(t,e)=>D.getAtan2(t,e)/h,getRotation:(t,e,s,i)=>(i||(i=e),D.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/h),getRadianFrom(t,e,s,i,r,a,o,n){void 0===o&&(o=s,n=i);let h=B(e-i,t-s);const d=B(a-n,r-o)-h;return d<-E?d+l:d},getAtan2:(t,e)=>B(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=D.getAtan2(t,e);return{x:t.x+O(i)*s,y:t.y+C(i)*s}},reset(t){D.reset(t)}},D=R;class L{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?R.copy(this,t):R.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new L(this)}rotate(t,e){return R.rotate(this,t,e),this}rotateOf(t,e){return R.rotate(this,e,t),this}getRotation(t,e,s){return R.getRotation(this,t,e,s)}toInnerOf(t,e){return R.toInnerOf(this,t,e),this}toOuterOf(t,e){return R.toOuterOf(this,t,e),this}getCenter(t){return new L(R.getCenter(this,t))}getDistance(t){return R.getDistance(this,t)}getDistancePoint(t,e){return new L(R.getDistancePoint(this,t,e))}getAngle(t){return R.getAngle(this,t)}getAtan2(t){return R.getAtan2(this,t)}reset(){return R.reset(this),this}}class M{constructor(t,e,s,i,r,a){this.set(t,e,s,i,r,a)}set(t,e,s,i,r,a){return"object"==typeof t?x.copy(this,t):x.set(this,t,e,s,i,r,a),this}get(){const{a:t,b:e,c:s,d:i,e:r,f:a}=this;return{a:t,b:e,c:s,d:i,e:r,f:a}}clone(){return new M(this)}translate(t,e){return x.translate(this,t,e),this}translateInner(t,e){return x.translateInner(this,t,e),this}scale(t,e){return x.scale(this,t,e),this}scaleOfOuter(t,e,s){return x.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return x.scaleOfInner(this,t,e,s),this}rotate(t){return x.rotate(this,t),this}rotateOfOuter(t,e){return x.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return x.rotateOfInner(this,t,e),this}skew(t,e){return x.skew(this,t,e),this}skewOfOuter(t,e,s){return x.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return x.skewOfInner(this,t,e,s),this}multiply(t){return x.multiply(this,t),this}multiplyParent(t){return x.multiplyParent(this,t),this}divide(t){return x.divide(this,t),this}divideParent(t){return x.divideParent(this,t),this}invert(){return x.invert(this),this}toOuterPoint(t,e,s){x.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){x.toInnerPoint(this,t,e,s)}setLayout(t,e){return x.setLayout(this,t,e),this}getLayout(t,e){return x.getLayout(this,t,e)}reset(){x.reset(this)}}const S={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){A(t,e,s),A(t,e+i,s+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:A}=S,{tempPointBounds:I,setPoint:W,addPoint:N,toBounds:X}=S,{toOuterPoint:Y}=x;let F,z,j,U;const V={},H={},G={tempBounds:{},set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,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,s,i){i||(i=s),K.set(t,e.x-s,e.y-i,e.width+2*s,e.height+2*i)},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,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),K.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Z(e,t):e=t,s?(e.offsetX=-(K.maxX(s)-t.x),e.offsetY=-(K.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),K.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s),t.width*=e,t.height*=s},scaleOf(t,e,s,i){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(K.copy(K.tempBounds,t),K.toOuterOf(K.tempBounds,e),K.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),K.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r}=e;i>0?(s.width=t.width*i,s.x=e.e+t.x*i):(s.width=t.width*-i,s.x=e.e+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=e.f+t.y*r):(s.height=t.height*-r,s.y=e.f+t.y*r-s.height)}else V.x=t.x,V.y=t.y,Y(e,V,H),W(I,H.x,H.y),V.x=t.x+t.width,Y(e,V,H),N(I,H.x,H.y),V.y=t.y+t.height,Y(e,V,H),N(I,H.x,H.y),V.x=t.x,Y(e,V,H),N(I,H.x,H.y),X(I,s)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new M(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e,s){const i={};return K.copyAndSpread(i,t,e,s),i},spread(t,e,s=e){K.copyAndSpread(t,t,e,s)},ceil(t){t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.ceil(t.width),t.height=Math.ceil(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)},add(t,e){F=t.x+t.width,z=t.y+t.height,j=e.x+e.width,U=e.y+e.height,F=F>j?F:j,z=z>U?z:U,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=F-t.x,t.height=z-t.y},addList(t,e){K.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){K.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){K.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let r,a=!0;for(let o=0,n=e.length;o<n;o++)r=s?s(e[o]):e[o],r&&(r.width||r.height)&&(a?(a=!1,i||Z(t,r)):q(t,r));a&&K.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?W(I,t.x,t.y):N(I,t.x,t.y))),X(I,t)},getPoints(t){const{x:e,y:s,width:i,height:r}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+r},{x:e,y:s+r}]},hitRadiusPoint:(t,e,s)=>(s&&(e=R.tempToInnerRadiusPointOf(e,s)),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,s)=>(s&&(e=R.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=K.tempToOuterOf(e,s)),!(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,s)=>(s&&(e=K.tempToOuterOf(e,s)),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,s){s&&(e=K.tempToOuterOf(e,s));let{x:i,y:r,width:a,height:o}=e;return F=i+a,z=r+o,j=t.x+t.width,U=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,F=F<j?F:j,z=z<U?z:U,a=F-i,o=z-r,{x:i,y:r,width:a,height:o}},intersect(t,e,s){K.copy(t,K.getIntersectData(t,e,s))},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){K.set(t)}},K=G,{add:q,copy:Z}=K;class Q{get minX(){return G.minX(this)}get minY(){return G.minY(this)}get maxX(){return G.maxX(this)}get maxY(){return G.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return"object"==typeof t?G.copy(this,t):G.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new Q(this)}scale(t,e){return G.scale(this,t,e),this}scaleOf(t,e,s){return G.scaleOf(this,t,e,s),this}toOuterOf(t,e){return G.toOuterOf(this,t,e),this}getFitMatrix(t){return G.getFitMatrix(this,t)}spread(t,e){return G.spread(this,t,e),this}ceil(){return G.ceil(this),this}unsign(){return G.unsign(this),this}add(t){return G.add(this,t),this}addList(t){return G.setList(this,t,!0),this}setList(t){return G.setList(this,t),this}addListWithFn(t,e){return G.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return G.setListWithFn(this,t,e),this}setPoints(t){return G.setPoints(this,t),this}getPoints(){return G.getPoints(this)}hitPoint(t,e){return G.hitPoint(this,t,e)}hitRadiusPoint(t,e){return G.hitRadiusPoint(this,t,e)}hit(t,e){return G.hit(this,t,e)}includes(t,e){return G.includes(this,t,e)}intersect(t,e){return G.intersect(this,t,e),this}getIntersect(t,e){return new Q(G.getIntersectData(this,t,e))}isSame(t){return G.isSame(this,t)}isEmpty(){return G.isEmpty(this)}reset(){G.reset(this)}}class J{constructor(t,e,s,i,r,a){"object"==typeof t?this.copy(t):this.set(t,e,s,i,r,a)}set(t=0,e=0,s=0,i=0,r=0,a=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=a}copy(t){const{top:e,right:s,bottom:i,left:r,width:a,height:o}=t;this.set(e,s,i,r,a,o)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:a,height:o}=this;return new Q(r,e,a||t.width-r-s,o||t.height-e-i)}}var $,tt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}($||($={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center"}(tt||(tt={}));const et=[{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={directionData:et,tempPoint:{},get:it,toPoint(t,e,s,i){s||(s={});const r=it(t);s.x=r.x*e.width,s.y=r.y*e.height,i||(s.x+=e.x,s.y+=e.y)}};function it(t){return"string"==typeof t?et[tt[t]]:t}const rt={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};class at{constructor(t){this.repeatMap={},this.name=t}static get(t){return new at(t)}static set filter(t){t?"string"==typeof t&&(t=[t]):t=[],this.filterList=t}static set exclude(t){t?"string"==typeof t&&(t=[t]):t=[],this.excludeList=t}log(...t){if(ot.enable){if(ot.filterList.length&&ot.filterList.every((t=>t!==this.name)))return;if(ot.excludeList.length&&ot.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ot.enable&&console.warn(this.name,...t)}warn(...t){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)}}}at.filterList=[],at.excludeList=[];const ot=at,nt=at.get("RunTime"),ht={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return lt.currentId=lt.idMap[i]=e?performance.now():Date.now(),lt.currentName=lt.nameMap[i]=t,lt.nameToIdMap[t]=i,i},end(t,e){const s=lt.idMap[t],i=lt.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;lt.idMap[t]=lt.nameMap[t]=lt.nameToIdMap[i]=void 0,nt.log(i,r,"ms")},endOfName(t,e){const s=lt.nameToIdMap[t];void 0!==s&&lt.end(s,e)}},lt=ht,dt=at.get("UICreator"),ct={list:{},register(t){const{__tag:e}=t.prototype;ut[e]?dt.repeat(e):ut[e]=t},get(t,e,s,i,r,a){const o=new ut[t](e);return void 0!==s&&(o.x=s,i&&(o.y=i),r&&(o.width=r),a&&(o.height=a)),o}},{list:ut}=ct,pt=at.get("EventCreator"),_t={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(gt[e]?pt.repeat(e):gt[e]=t)}))},changeName(t,e){const s=gt[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,gt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new gt[t](...e)},{nameList:gt}=_t;class ft{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:i}=this;for(let e=0,r=i.length;e<r;e++)if(s=i[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const r=e.canvas(t);return this.add(r),r}recycle(t){t.recycled||(t.clear(),t.recycled=!0)}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}class mt{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return t&&void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}add(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(void 0===s[t.innerId]){const{list:i}=this;for(let t=e,r=i.length;t<r;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let i=0,r=e.length;i<r;i++)void 0!==s?this.keys[e[i].innerId]=i-1:e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,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 mt;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class yt{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===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:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class xt extends ft{constructor(){super(...arguments),this.pathTypeList=new mt,this.imageTypeList=new mt}getImageType(t,s){return this.imageTypeList.add(t),e.hitCanvas(s)}getPathType(t){return this.pathTypeList.add(t),e.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.length&&(t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset())}clear(){this.clearPathType(),this.clearImageType()}}const vt={default:(t,e)=>(wt(e,t),wt(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var r;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(r=t[i])||void 0===r?void 0:r.constructor)===Object?wt(t[i],e[i]):t[i]=e[i]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:wt}=vt;class bt{constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let i in this)"_"!==i[0]&&(s=e?e[i]:void 0,t[i]=void 0===s?this[i]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s,i;for(let r in this)"_"!==r[0]&&(s=this["_"+r],void 0!==s&&(i=e?e[r]:void 0,t[r]=void 0===i?s:i));return t}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){"pass-through"===this.blendMode?this.__leaf.__hasEraser||this.isEraser?this.__single=!0:this.__single&&(this.__single=!1):this.__single=!0}destroy(){this.__input=this.__middle=null}}const Ct={opacityTypes:["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]}};function Ot(t,e,s,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(o=(a<3?r(o):a>3?r(e,s,o):r(e,s))||o);return a>3&&o&&Object.defineProperty(e,s,o),o}function Tt(t,e,s,i){return new(s||(s=Promise))((function(r,a){function o(t){try{h(i.next(t))}catch(t){a(t)}}function n(t){try{h(i.throw(t))}catch(t){a(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,n)}h((i=i.apply(t,e||[])).next())}))}function kt(t){return(e,s)=>{t||(t=s),Object.defineProperty(e,s,{get(){return this.context[t]},set(e){this.context[t]=e}})}}Ct.opacityTypes.forEach((t=>Ct.upperCaseTypeMap[t]=t.toUpperCase())),"function"==typeof SuppressedError&&SuppressedError;const Bt=[];function Pt(){return(t,e)=>{Bt.push(e)}}const Et=[];class Rt{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||Et)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Bt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,a){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,a){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,a)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,a,o,n,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*n;i+=e,e=0,a+=t,n-=t}if(s<0){const t=-s/r*h;r+=s,s=0,o+=t,h-=t}this.context.drawImage(t,e,s,i,r,a,o,n,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,a){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,a){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,a,o,n){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,a){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}}Ot([kt("imageSmoothingEnabled")],Rt.prototype,"smooth",void 0),Ot([kt("imageSmoothingQuality")],Rt.prototype,"smoothLevel",void 0),Ot([kt("globalAlpha")],Rt.prototype,"opacity",void 0),Ot([kt()],Rt.prototype,"fillStyle",void 0),Ot([kt()],Rt.prototype,"strokeStyle",void 0),Ot([kt("lineWidth")],Rt.prototype,"strokeWidth",void 0),Ot([kt("lineCap")],Rt.prototype,"strokeCap",void 0),Ot([kt("lineJoin")],Rt.prototype,"strokeJoin",void 0),Ot([kt("lineDashOffset")],Rt.prototype,"dashOffset",void 0),Ot([kt()],Rt.prototype,"miterLimit",void 0),Ot([kt()],Rt.prototype,"shadowBlur",void 0),Ot([kt()],Rt.prototype,"shadowColor",void 0),Ot([kt()],Rt.prototype,"shadowOffsetX",void 0),Ot([kt()],Rt.prototype,"shadowOffsetY",void 0),Ot([kt()],Rt.prototype,"filter",void 0),Ot([kt()],Rt.prototype,"font",void 0),Ot([kt()],Rt.prototype,"fontKerning",void 0),Ot([kt()],Rt.prototype,"fontStretch",void 0),Ot([kt()],Rt.prototype,"fontVariantCaps",void 0),Ot([kt()],Rt.prototype,"textAlign",void 0),Ot([kt()],Rt.prototype,"textBaseline",void 0),Ot([kt()],Rt.prototype,"textRendering",void 0),Ot([kt()],Rt.prototype,"wordSpacing",void 0),Ot([kt()],Rt.prototype,"letterSpacing",void 0),Ot([kt()],Rt.prototype,"direction",void 0),Ot([Pt()],Rt.prototype,"setTransform",null),Ot([Pt()],Rt.prototype,"resetTransform",null),Ot([Pt()],Rt.prototype,"getTransform",null),Ot([Pt()],Rt.prototype,"save",null),Ot([Pt()],Rt.prototype,"restore",null),Ot([Pt()],Rt.prototype,"translate",null),Ot([Pt()],Rt.prototype,"scale",null),Ot([Pt()],Rt.prototype,"rotate",null),Ot([Pt()],Rt.prototype,"fill",null),Ot([Pt()],Rt.prototype,"stroke",null),Ot([Pt()],Rt.prototype,"clip",null),Ot([Pt()],Rt.prototype,"fillRect",null),Ot([Pt()],Rt.prototype,"strokeRect",null),Ot([Pt()],Rt.prototype,"clearRect",null),Ot([Pt()],Rt.prototype,"beginPath",null),Ot([Pt()],Rt.prototype,"moveTo",null),Ot([Pt()],Rt.prototype,"lineTo",null),Ot([Pt()],Rt.prototype,"bezierCurveTo",null),Ot([Pt()],Rt.prototype,"quadraticCurveTo",null),Ot([Pt()],Rt.prototype,"closePath",null),Ot([Pt()],Rt.prototype,"arc",null),Ot([Pt()],Rt.prototype,"arcTo",null),Ot([Pt()],Rt.prototype,"ellipse",null),Ot([Pt()],Rt.prototype,"rect",null),Ot([Pt()],Rt.prototype,"roundRect",null),Ot([Pt()],Rt.prototype,"createConicGradient",null),Ot([Pt()],Rt.prototype,"createLinearGradient",null),Ot([Pt()],Rt.prototype,"createPattern",null),Ot([Pt()],Rt.prototype,"createRadialGradient",null),Ot([Pt()],Rt.prototype,"fillText",null),Ot([Pt()],Rt.prototype,"measureText",null),Ot([Pt()],Rt.prototype,"strokeText",null);const Dt=new Q,Lt={width:1,height:1,pixelRatio:1},Mt=at.get("LeaferCanvasBase"),St=["width","height","pixelRatio"];class At extends Rt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView}constructor(e,i){super(),this.worldTransform={},e||(e=Lt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:a,pixelRatio:o}=e;this.autoLayout=!r||!a,this.pixelRatio=o,this.config=e,this.init()}init(){}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}toBlob(e,s){return new Promise((i=>{const r=this.getSaveCanvas(e);t.origin.canvasToBolb(r.view,e,s).then((t=>{r.recycle(),i(t)})).catch((t=>{Mt.error(t),i(null)}))}))}toDataURL(e,s){const i=this.getSaveCanvas(e),r=t.origin.canvasToDataURL(i.view,e,s);return i.recycle(),r}saveAs(e,s){return new Promise((i=>{const r=this.getSaveCanvas(Ct.fileType(e));t.origin.canvasSaveAs(r.view,e,s).then((()=>{r.recycle(),i(!0)})).catch((t=>{Mt.error(t),i(!1)}))}))}getSaveCanvas(t){const{backgroundColor:e,bounds:s}=this,i=this.getSameCanvas();return["jpg","jpeg"].includes(t)&&i.fillWorld(s,"#FFFFFF"),e&&i.fillWorld(s,e),i.copyWorld(this),i}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),vt.copyAttrs(this,t,St),this.bounds=new Q(0,0,this.width,this.height),this.pixelRatio||(this.pixelRatio=1),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}updateClientBounds(){}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e,s){const{pixelRatio:i}=this,r=this.worldTransform;if(e)if(s)this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=(t.e+e.e)*i,r.f=(t.f+e.f)*i);else{const{a:s,b:a,c:o,d:n,e:h,f:l}=e;this.setTransform(r.a=(t.a*s+t.b*o)*i,r.b=(t.a*a+t.b*n)*i,r.c=(t.c*s+t.d*o)*i,r.d=(t.c*a+t.d*n)*i,r.e=(t.e*s+t.f*o+h)*i,r.f=(t.e*a+t.f*n+l)*i)}else this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=t.e*i,r.f=t.f*i)}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,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap=t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i){if(i&&(this.blendMode=i),e){const{pixelRatio:i}=this;s||(s=e),this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x*i,s.y*i,s.width*i,s.height*i)}else this.drawImage(t.view,0,0);i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i){if(i&&(this.blendMode=i),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,G.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:i}=this;this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x,s.y,s.width,s.height)}i&&(this.blendMode="source-over")}copyWorldByReset(t,e,s,i){this.resetTransform(),this.copyWorld(t,e,s,i),this.useWorldTransform()}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,Dt.set(t).scale(this.pixelRatio),this.fillRect(Dt.x,Dt.y,Dt.width,Dt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,Dt.set(t).scale(this.pixelRatio),this.strokeRect(Dt.x,Dt.y,Dt.width,Dt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){Dt.set(t).scale(this.pixelRatio),e&&Dt.ceil(),this.clearRect(Dt.x,Dt.y,Dt.width,Dt.height)}clipWorld(t,e){this.beginPath(),Dt.set(t).scale(this.pixelRatio),e&&Dt.ceil(),this.rect(Dt.x,Dt.y,Dt.width,Dt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t,s){const{width:i,height:r,pixelRatio:a}=this,o={width:i,height:r,pixelRatio:a},n=this.manager?this.manager.get(o):e.canvas(o);return n.save(),t&&n.useWorldTransform(Object.assign({},this.worldTransform)),s&&(n.smooth=this.smooth),n}getBiggerCanvas(t,s){let{width:i,height:r,pixelRatio:a}=this;t&&(i+=t),s&&(r+=s);const o={width:i,height:r,pixelRatio:a},n=this.manager?this.manager.get(o):e.canvas(o);return n.save(),n}recycle(){this.recycled||(this.restore(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const It={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Wt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Nt=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},Wt),Xt={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},Yt={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},Ft=Object.assign(Object.assign({},Yt),Wt),zt=Nt,jt={};for(let t in zt)jt[zt[t]]=t;const Ut={};for(let t in zt)Ut[zt[t]]=Xt[t];const Vt={drawRoundRect(t,e,s,i,r,a){const o=n.fourNumber(a,Math.min(i/2,r/2)),h=e+i,l=s+r;o[0]?t.moveTo(e+o[0],s):t.moveTo(e,s),o[1]?t.arcTo(h,s,h,l,o[1]):t.lineTo(h,s),o[2]?t.arcTo(h,l,e,l,o[2]):t.lineTo(h,l),o[3]?t.arcTo(e,l,e,s,o[3]):t.lineTo(e,l),o[0]?t.arcTo(e,s,h,s,o[0]):t.lineTo(e,s)}},{sin:Ht,cos:Gt,atan2:Kt,ceil:qt,abs:Zt,PI:Qt,sqrt:Jt,pow:$t}=Math,{setPoint:te,addPoint:ee}=S,{set:se}=R,{M:ie,L:re,C:ae,Q:oe,Z:ne}=Nt,he={},le={points(t,e,s,i){if(t.push(ie,e[0],e[1]),s&&e.length>5){let r,a,o,n,h,l,d,c,u,p,_,g,f,m=e.length;const y=!0===s?.5:s;i&&(m=(e=[e[m-2],e[m-1],...e,e[0],e[1],e[2],e[3]]).length);for(let s=2;s<m-2;s+=2)r=e[s-2],a=e[s-1],o=e[s],n=e[s+1],h=e[s+2],l=e[s+3],_=Jt($t(o-r,2)+$t(n-a,2)),g=Jt($t(h-o,2)+$t(l-n,2)),f=_+g,_=y*_/f,g=y*g/f,h-=r,l-=a,d=o-_*h,c=n-_*l,2===s?i||t.push(oe,d,c,o,n):t.push(ae,u,p,d,c,o,n),u=o+g*h,p=n+g*l;i||t.push(oe,u,p,e[m-2],e[m-1])}else for(let s=2,i=e.length;s<i;s+=2)t.push(re,e[s],e[s+1]);i&&t.push(ne)},rect(t,e,s,i,r){It.creator.path=t,It.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,a){It.creator.path=[],Vt.drawRoundRect(It.creator,e,s,i,r,a),t.push(...It.convertToCanvasData(It.creator.path,!0))},arcTo(t,e,s,i,r,a,o,n,c,u,p){const _=i-e,g=r-s,f=a-i,m=o-r;let y=Kt(g,_),x=Kt(m,f),v=x-y;if(v<0&&(v+=l),v===Qt||Zt(_+g)<1e-12||Zt(f+m)<1e-12)return t&&t.push(re,i,r),c&&(te(c,e,s),ee(c,i,r)),p&&se(p,e,s),void(u&&se(u,i,r));const w=_*m-f*g<0,b=w?-1:1,C=n/Gt(v/2),O=i+C*Gt(y+v/2+d*b),T=r+C*Ht(y+v/2+d*b);return y-=d*b,x-=d*b,ue(t,O,T,n,n,0,y/h,x/h,w,c,u,p)},arc:(t,e,s,i,r,a,o,n,h,l)=>ue(t,e,s,i,i,0,r,a,o,n,h,l),ellipse(t,e,s,i,r,a,o,n,c,u,p,_){const g=a*h,f=Ht(g),m=Gt(g);let y=o*h,x=n*h;y>Qt&&(y-=l),x<0&&(x+=l);let v=x-y;v<0?v+=l:v>l&&(v-=l),c&&(v-=l);const w=qt(Zt(v/d)),b=v/w,C=Ht(b/4),O=8/3*C*C/Ht(b/2);x=y+b;let T,k,B,P,E,R,D,L,M=Gt(y),S=Ht(y),A=B=m*i*M-f*r*S,I=P=f*i*M+m*r*S,W=e+B,N=s+P;t&&t.push(re,W,N),u&&te(u,W,N),_&&se(_,W,N);for(let a=0;a<w;a++)T=Gt(x),k=Ht(x),B=m*i*T-f*r*k,P=f*i*T+m*r*k,E=e+A-O*(m*i*S+f*r*M),R=s+I-O*(f*i*S-m*r*M),D=e+B+O*(m*i*k+f*r*T),L=s+P+O*(f*i*k-m*r*T),t&&t.push(ae,E,R,D,L,e+B,s+P),u&&ce(e+A,s+I,E,R,D,L,e+B,s+P,u,!0),A=B,I=P,M=T,S=k,y=x,x+=b;p&&se(p,e+B,s+P)},quadraticCurveTo(t,e,s,i,r,a,o){t.push(ae,(e+2*i)/3,(s+2*r)/3,(a+2*i)/3,(o+2*r)/3,a,o)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,a,o,n){ce(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(a+2*i)/3,r,a,o,n)},toTwoPointBounds(t,e,s,i,r,a,o,n,h,l){const d=[];let c,u,p,_,g,f,m,y,x=t,v=s,w=r,b=o;for(let t=0;t<2;++t)if(1==t&&(x=e,v=i,w=a,b=n),c=-3*x+9*v-9*w+3*b,u=6*x-12*v+6*w,p=3*v-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else m=u*u-4*p*c,y=Math.sqrt(m),m<0||(g=(-u+y)/(2*c),0<g&&g<1&&d.push(g),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?ee(h,t,e):te(h,t,e),ee(h,o,n);for(let l=0,c=d.length;l<c;l++)de(d[l],t,e,s,i,r,a,o,n,he),ee(h,he.x,he.y)},getPointAndSet(t,e,s,i,r,a,o,n,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=c*e+u*i+p*a+_*n,l.y=c*s+u*r+p*o+_*h},getPoint(t,e,s,i,r,a,o,n,h){const l={};return de(t,e,s,i,r,a,o,n,h,l),l}},{getPointAndSet:de,toTwoPointBounds:ce,ellipse:ue}=le,{sin:pe,cos:_e,sqrt:ge,atan2:fe}=Math,{ellipse:me}=le,ye={ellipticalArc(e,s,i,r,a,o,n,d,c,u,p){const _=(c-s)/2,g=(u-i)/2,f=o*h,m=pe(f),y=_e(f),x=-y*_-m*g,v=-y*g+m*_,w=r*r,b=a*a,C=v*v,O=x*x,T=w*b-w*C-b*O;let k=0;if(T<0){const t=ge(1-T/(w*b));r*=t,a*=t}else k=(n===d?-1:1)*ge(T/(w*C+b*O));const B=k*r*v/a,P=-k*a*x/r,E=fe((v-P)/a,(x-B)/r),R=fe((-v-P)/a,(-x-B)/r);let D=R-E;0===d&&D>0?D-=l:1===d&&D<0&&(D+=l);const L=s+_+y*B-m*P,M=i+g+m*B+y*P,S=D<0?1:0;p||t.ellipseToCurve?me(e,L,M,r,a,o,E/h,R/h,S):r!==a||o?e.push(Nt.G,L,M,r,a,o,E/h,R/h,S):e.push(Nt.O,L,M,r,E/h,R/h,S)}},{M:xe,m:ve,L:we,l:be,H:Ce,h:Oe,V:Te,v:ke,C:Be,c:Pe,S:Ee,s:Re,Q:De,q:Le,T:Me,t:Se,A:Ae,a:Ie,Z:We,z:Ne,N:Xe,D:Ye,X:Fe,G:ze,F:je,O:Ue,P:Ve,U:He}=Nt,{rect:Ge,roundRect:Ke,arcTo:qe,arc:Ze,ellipse:Qe,quadraticCurveTo:Je}=le,{ellipticalArc:$e}=ye,ts=at.get("PathConvert"),es={},ss={current:{dot:0},stringify(t){let e,s,i,r=0,a=t.length,o="";for(;r<a;){s=t[r],e=Ut[s],o+=s===i?" ":jt[s];for(let s=1;s<e;s++)o+=t[r+s],s===e-1||(o+=" ");i=s,r+=e}return o},parse(t,e){let s,i,r,a="";const o=[],n=e?Ft:Yt;for(let e=0,h=t.length;e<h;e++)i=t[e],rt[i]?("."===i&&(is.dot++,is.dot>1&&(rs(o,a),a="")),a+=i):Nt[i]?(a&&(rs(o,a),a=""),is.name=Nt[i],is.length=Xt[i],is.index=0,rs(o,is.name),!s&&n[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?a+=i:(a&&rs(o,a),a=i):a&&(rs(o,a),a=""),r=i;return a&&rs(o,a),s?ss.toCanvasData(o,e):o},toCanvasData(t,e){let s,i,r,a,o,n=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(r=t[c],r){case ve:t[c+1]+=n,t[c+2]+=h;case xe:n=t[c+1],h=t[c+2],p.push(xe,n,h),c+=3;break;case Oe:t[c+1]+=n;case Ce:n=t[c+1],p.push(we,n,h),c+=2;break;case ke:t[c+1]+=h;case Te:h=t[c+1],p.push(we,n,h),c+=2;break;case be:t[c+1]+=n,t[c+2]+=h;case we:n=t[c+1],h=t[c+2],p.push(we,n,h),c+=3;break;case Re:t[c+1]+=n,t[c+2]+=h,t[c+3]+=n,t[c+4]+=h,r=Ee;case Ee:o=a===Be||a===Ee,l=o?2*n-s:t[c+1],d=o?2*h-i:t[c+2],s=t[c+1],i=t[c+2],n=t[c+3],h=t[c+4],p.push(Be,l,d,s,i,n,h),c+=5;break;case Pe:t[c+1]+=n,t[c+2]+=h,t[c+3]+=n,t[c+4]+=h,t[c+5]+=n,t[c+6]+=h,r=Be;case Be:s=t[c+3],i=t[c+4],n=t[c+5],h=t[c+6],p.push(Be,t[c+1],t[c+2],s,i,n,h),c+=7;break;case Se:t[c+1]+=n,t[c+2]+=h,r=Me;case Me:o=a===De||a===Me,s=o?2*n-s:t[c+1],i=o?2*h-i:t[c+2],e?Je(p,n,h,s,i,t[c+1],t[c+2]):p.push(De,s,i,t[c+1],t[c+2]),n=t[c+1],h=t[c+2],c+=3;break;case Le:t[c+1]+=n,t[c+2]+=h,t[c+3]+=n,t[c+4]+=h,r=De;case De:s=t[c+1],i=t[c+2],e?Je(p,n,h,s,i,t[c+3],t[c+4]):p.push(De,s,i,t[c+3],t[c+4]),n=t[c+3],h=t[c+4],c+=5;break;case Ie:t[c+6]+=n,t[c+7]+=h;case Ae:$e(p,n,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),n=t[c+6],h=t[c+7],c+=8;break;case Ne:case We:p.push(We),c++;break;case Xe:n=t[c+1],h=t[c+2],e?Ge(p,n,h,t[c+3],t[c+4]):as(p,t,c,5),c+=5;break;case Ye:n=t[c+1],h=t[c+2],e?Ke(p,n,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):as(p,t,c,9),c+=9;break;case Fe:n=t[c+1],h=t[c+2],e?Ke(p,n,h,t[c+3],t[c+4],t[c+5]):as(p,t,c,6),c+=6;break;case ze:Qe(e?p:as(p,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,es),n=es.x,h=es.y,c+=9;break;case je:e?Qe(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):as(p,t,c,5),n=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ue:Ze(e?p:as(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,es),n=es.x,h=es.y,c+=7;break;case Ve:e?Ze(p,t[c+1],t[c+2],t[c+3],0,360,!1):as(p,t,c,4),n=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case He:qe(e?p:as(p,t,c,6),n,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,es),n=es.x,h=es.y,c+=6;break;default:return ts.error(`command: ${r} [index:${c}]`,t),p}a=r}return p},copyData(t,e,s,i){for(let r=s,a=s+i;r<a;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:rs,copyData:as}=ss,{M:os,L:ns,C:hs,Q:ls,Z:ds,N:cs,D:us,X:ps,G:_s,F:gs,O:fs,P:ms,U:ys}=Nt,{getMinDistanceFrom:xs,getRadianFrom:vs}=R,{tan:ws,min:bs,abs:Cs}=Math,Os={},Ts={beginPath(t){t.length=0},moveTo(t,e,s){t.push(os,e,s)},lineTo(t,e,s){t.push(ns,e,s)},bezierCurveTo(t,e,s,i,r,a,o){t.push(hs,e,s,i,r,a,o)},quadraticCurveTo(t,e,s,i,r){t.push(ls,e,s,i,r)},closePath(t){t.push(ds)},rect(t,e,s,i,r){t.push(cs,e,s,i,r)},roundRect(t,e,s,i,r,a){if("number"==typeof a)t.push(ps,e,s,i,r,a);else{const o=n.fourNumber(a);o?t.push(us,e,s,i,r,...o):t.push(cs,e,s,i,r)}},ellipse(t,e,s,i,r,a,o,n,h){void 0===a?t.push(gs,e,s,i,r):(void 0===o&&(o=0),void 0===n&&(n=360),t.push(_s,e,s,i,r,a,o,n,h?1:0))},arc(t,e,s,i,r,a,o){void 0===r?t.push(ms,e,s,i):(void 0===a&&(a=360),t.push(fs,e,s,i,r,a,o?1:0))},arcTo(t,e,s,i,r,a,o,n){if(void 0!==o){const h=ws(vs(o,n,e,s,i,r)/2)*(xs(o,n,e,s,i,r)/2);t.push(ys,e,s,i,r,bs(a,Cs(h)))}else t.push(ys,e,s,i,r,a)},drawEllipse(t,e,s,i,r,a,o,n,h){void 0===a&&(a=0),void 0===o&&(o=0),void 0===n&&(n=360),le.ellipse(null,e,s,i,r,a,o,n,h,null,null,Os),t.push(os,Os.x,Os.y),ks(t,e,s,i,r,a,o,n,h)},drawArc(t,e,s,i,r,a,o){void 0===r&&(r=0),void 0===a&&(a=360),le.arc(null,e,s,i,r,a,o,null,null,Os),t.push(os,Os.x,Os.y),Bs(t,e,s,i,r,a,o)},drawPoints(t,e,s,i){le.points(t,e,s,i)}},{ellipse:ks,arc:Bs}=Ts,{moveTo:Ps,lineTo:Es,quadraticCurveTo:Rs,bezierCurveTo:Ds,closePath:Ls,beginPath:Ms,rect:Ss,roundRect:As,ellipse:Is,arc:Ws,arcTo:Ns,drawEllipse:Xs,drawArc:Ys,drawPoints:Fs}=Ts;class zs{constructor(t){this.path=t?"string"==typeof t?It.parse(t):t:[]}beginPath(){return Ms(this.path),this}moveTo(t,e){return Ps(this.path,t,e),this}lineTo(t,e){return Es(this.path,t,e),this}bezierCurveTo(t,e,s,i,r,a){return Ds(this.path,t,e,s,i,r,a),this}quadraticCurveTo(t,e,s,i){return Rs(this.path,t,e,s,i),this}closePath(){return Ls(this.path),this}rect(t,e,s,i){return Ss(this.path,t,e,s,i),this}roundRect(t,e,s,i,r){return As(this.path,t,e,s,i,r),this}ellipse(t,e,s,i,r,a,o,n){return Is(this.path,t,e,s,i,r,a,o,n),this}arc(t,e,s,i,r,a){return Ws(this.path,t,e,s,i,r,a),this}arcTo(t,e,s,i,r){return Ns(this.path,t,e,s,i,r),this}drawEllipse(t,e,s,i,r,a,o,n){return Xs(this.path,t,e,s,i,r,a,o,n),this}drawArc(t,e,s,i,r,a){return Ys(this.path,t,e,s,i,r,a),this}drawPoints(t,e,s){return Fs(this.path,t,e,s),this}}const{M:js,L:Us,C:Vs,Q:Hs,Z:Gs,N:Ks,D:qs,X:Zs,G:Qs,F:Js,O:$s,P:ti,U:ei}=Nt,si=at.get("PathDrawer"),ii={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case js:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Us:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Vs:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Hs:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Gs:t.closePath(),i+=1;break;case Ks:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case qs:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Zs:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Qs:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*h,e[i+6]*h,e[i+7]*h,e[i+8]),i+=9;break;case Js:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,l,!1),i+=5;break;case $s:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*h,e[i+5]*h,e[i+6]),i+=7;break;case ti:t.arc(e[i+1],e[i+2],e[i+3],0,l,!1),i+=4;break;case ei:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void si.error(`command: ${s} [index:${i}]`,e)}}},{M:ri,L:ai,C:oi,Q:ni,Z:hi,N:li,D:di,X:ci,G:ui,F:pi,O:_i,P:gi,U:fi}=Nt,mi={scale(t,e,s){if(!t)return;let i,r=0,a=t.length;for(;r<a;)switch(i=t[r],i){case ri:case ai:yi(t,e,s,r,1),r+=3;break;case oi:yi(t,e,s,r,3),r+=7;break;case ni:yi(t,e,s,r,2),r+=5;break;case hi:r+=1;break;case li:yi(t,e,s,r,2),r+=5;break;case di:yi(t,e,s,r,2),r+=9;break;case ci:yi(t,e,s,r,2),r+=6;break;case ui:yi(t,e,s,r,2),r+=9;break;case pi:yi(t,e,s,r,2),r+=5;break;case _i:t[r]=ui,t.splice(r+4,0,t[r+3],0),yi(t,e,s,r,2),r+=9,a+=2;break;case gi:t[r]=pi,t.splice(r+4,0,t[r+3]),yi(t,e,s,r,2),r+=5,a+=1;break;case fi:yi(t,e,s,r,2),r+=6}},scalePoints(t,e,s,i,r){for(let a=r?i+1:0,o=r?a+2*r:t.length;a<o;a+=2)t[a]*=e,t[a+1]*=s}},{scalePoints:yi}=mi,{M:xi,L:vi,C:wi,Q:bi,Z:Ci,N:Oi,D:Ti,X:ki,G:Bi,F:Pi,O:Ei,P:Ri,U:Di}=Nt,{toTwoPointBounds:Li,toTwoPointBoundsByQuadraticCurve:Mi,arcTo:Si,arc:Ai,ellipse:Ii}=le,{addPointBounds:Wi,copy:Ni,addPoint:Xi,setPoint:Yi,addBounds:Fi,toBounds:zi}=S,ji=at.get("PathBounds");let Ui,Vi,Hi;const Gi={},Ki={},qi={},Zi={toBounds(t,e){Zi.toTwoPointBounds(t,Ki),zi(Ki,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Yi(e,0,0);let s,i,r,a,o,n=0,h=0,l=0;const d=t.length;for(;n<d;)switch(s=t[n],0===n&&(s===Ci||s===wi||s===bi?Yi(e,h,l):Yi(e,t[n+1],t[n+2])),s){case xi:case vi:h=t[n+1],l=t[n+2],Xi(e,h,l),n+=3;break;case wi:a=t[n+5],o=t[n+6],Li(h,l,t[n+1],t[n+2],t[n+3],t[n+4],a,o,Gi),Wi(e,Gi),h=a,l=o,n+=7;break;case bi:i=t[n+1],r=t[n+2],a=t[n+3],o=t[n+4],Mi(h,l,i,r,a,o,Gi),Wi(e,Gi),h=a,l=o,n+=5;break;case Ci:n+=1;break;case Oi:h=t[n+1],l=t[n+2],Fi(e,h,l,t[n+3],t[n+4]),n+=5;break;case Ti:case ki:h=t[n+1],l=t[n+2],Fi(e,h,l,t[n+3],t[n+4]),n+=s===Ti?9:6;break;case Bi:Ii(null,t[n+1],t[n+2],t[n+3],t[n+4],t[n+5],t[n+6],t[n+7],t[n+8],Gi,qi),0===n?Ni(e,Gi):Wi(e,Gi),h=qi.x,l=qi.y,n+=9;break;case Pi:h=t[n+1],l=t[n+2],Vi=t[n+3],Hi=t[n+4],Fi(e,h-Vi,l-Hi,2*Vi,2*Hi),h+=Vi,n+=5;break;case Ei:Ai(null,t[n+1],t[n+2],t[n+3],t[n+4],t[n+5],t[n+6],Gi,qi),0===n?Ni(e,Gi):Wi(e,Gi),h=qi.x,l=qi.y,n+=7;break;case Ri:h=t[n+1],l=t[n+2],Ui=t[n+3],Fi(e,h-Ui,l-Ui,2*Ui,2*Ui),h+=Ui,n+=4;break;case Di:Si(null,h,l,t[n+1],t[n+2],t[n+3],t[n+4],t[n+5],Gi,qi),0===n?Ni(e,Gi):Wi(e,Gi),h=qi.x,l=qi.y,n+=6;break;default:return void ji.error(`command: ${s} [index:${n}]`,t)}}},{M:Qi,L:Ji,C:$i,Z:tr}=Nt,{getCenterX:er,getCenterY:sr}=R,{arcTo:ir}=Ts,rr={smooth(t,e,s){let i,r=0,a=0,o=0,n=0,h=0,l=0,d=0,c=0,u=0;const p=t.length,_=[];for(;r<p;)switch(i=t[r],i){case Qi:n=c=t[r+1],h=u=t[r+2],r+=3,t[r]===Ji?(l=t[r+1],d=t[r+2],_.push(Qi,er(n,l),sr(h,d))):_.push(Qi,n,h);break;case Ji:switch(a=t[r+1],o=t[r+2],r+=3,t[r]){case Ji:ir(_,a,o,t[r+1],t[r+2],e,c,u);break;case tr:ir(_,a,o,n,h,e,c,u);break;default:_.push(Ji,a,o)}c=a,u=o;break;case $i:_.push($i,t[r+1],t[r+2],t[r+3],t[r+4],t[r+5],t[r+6]),r+=7;break;case tr:ir(_,n,h,l,d,e,c,u),_.push(tr),r+=1}return i!==tr&&(_[1]=n,_[2]=h),_}};It.creator=new zs,It.parse=ss.parse,It.convertToCanvasData=ss.toCanvasData;const{drawRoundRect:ar}=Vt;function or(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){ar(this,t,e,s,i,r)})}(t)}const nr=at.get("TaskProcessor");class hr{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Tt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){nr.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class lr{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,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&vt.assign(this.config,t),this.empty()}add(t,e){let s,i,r,a;const o=new hr(t);return o.parent=this,"number"==typeof e?a=e:e&&(i=e.parallel,s=e.start,r=e.time,a=e.delay),r&&(o.time=r),!1===i&&(o.parallel=!1),void 0===a?this.push(o,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(o,s))}),a)),this.isComplete=!1,o}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++,this.nextTask()})).catch((t=>{this.onError(t)})):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;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],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 dr={map:{},recycledList:[],tasker:new lr,patternTasker:new lr,get isComplete(){return cr.tasker.isComplete},get(t){let s=cr.map[t.url];return s||(s=e.image(t),cr.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||cr.recycledList.push(t)}))},clearRecycled(){const t=cr.recycledList;t.length&&(t.forEach((t=>{!t.use&&t.url&&(delete cr.map[t.url],t.destroy())})),t.length=0)},isPixel:t=>Ct.opacityTypes.some((e=>cr.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+Ct.mineType(t)))return!0}else if(s.includes("."+t)||s.includes("."+Ct.upperCaseTypeMap[t]))return!0;return!1},destroy(){cr.map={}}},cr=dr,{IMAGE:ur,create:pr}=s;class _r{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=pr(ur),this.config=t||{url:""},this.isSVG=dr.isFormat("svg",t)}load(e,s){return this.loading||(this.loading=!0,dr.tasker.add((()=>Tt(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}onComplete(t){let e;this.waitComplete.forEach(((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,i,r){e||(e=this.width),s||(s=this.height);const a=t.origin.createCanvas(e,s),o=a.getContext("2d");return i&&(o.globalAlpha=i),o.drawImage(this.view,0,0,e,s),a}destroy(){this.config={url:""},this.waitComplete.length=0}}class gr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class fr extends gr{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}fr.ADD="child.add",fr.REMOVE="child.remove";class mr extends gr{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}mr.CHANGE="property.change";class yr extends gr{constructor(t,e){super(t),Object.assign(this,e)}}yr.LOAD="image.load",yr.LOADED="image.loaded",yr.ERROR="image.error";class xr extends gr{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){"object"==typeof t?(super(xr.RESIZE),Object.assign(this,t)):super(t),this.old=e}}xr.RESIZE="resize";class vr extends gr{constructor(t,e){super(t),this.data=e}}vr.REQUEST="watch.request",vr.DATA="watch.data";class wr extends gr{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}wr.CHECK_UPDATE="layout.check_update",wr.REQUEST="layout.request",wr.START="layout.start",wr.BEFORE="layout.before",wr.LAYOUT="layout",wr.AFTER="layout.after",wr.AGAIN="layout.again",wr.END="layout.end";class br extends gr{}br.FRAME="animate.frame";class Cr extends gr{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}Cr.REQUEST="render.request",Cr.START="render.start",Cr.BEFORE="render.before",Cr.RENDER="render",Cr.AFTER="render.after",Cr.AGAIN="render.again",Cr.END="render.end";class Or extends gr{}Or.START="leafer.start",Or.BEFORE_READY="leafer.before_ready",Or.READY="leafer.ready",Or.AFTER_READY="leafer.after_ready",Or.VIEW_READY="leafer.view_ready",Or.VIEW_COMPLETED="leafer.view_completed",Or.STOP="leafer.stop",Or.RESTART="leafer.restart",Or.END="leafer.end";const Tr={},kr={isHoldSpaceKey:()=>kr.isHold("Space"),isHold:t=>Tr[t],setDownCode(t){Tr[t]||(Tr[t]=!0)},setUpCode(t){Tr[t]=!1}},Br={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 Pr extends gr{get spaceKey(){return kr.isHoldSpaceKey()}get left(){return Br.left(this)}get right(){return Br.right(this)}get middle(){return Br.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getInner(t){return t||(t=this.current),t.getInnerPoint(this)}getLocal(t){return t||(t=this.current),t.getLocalPoint(this)}static changeName(t,e){_t.changeName(t,e)}}function Er(t,e,s){Object.defineProperty(t,e,s)}function Rr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Dr(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};Er(t,e,Object.assign(r,i||{})),Qr(t,e,s)}function Lr(t){return(e,s)=>{Dr(e,s,t)}}function Mr(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.matrixChanged||this.__layout.matrixChange()}})}}function Sr(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.matrixChanged||this.__layout.matrixChange(),this.__hasAutoLayout=!!t}})}}function Ar(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function Ir(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function Wr(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__hasAutoLayout&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})}}const Nr=Wr;function Xr(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const Yr=Xr;function Fr(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function zr(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function jr(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function Ur(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()}))}})}}function Vr(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function Hr(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}}function Gr(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),at.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor()}})}}function Kr(t){return(e,s)=>{Dr(e,s,t,{set(t){this.__setAttr(s,t),this.leafer&&this.leafer.updateCursor()}})}}function qr(t){return(e,s)=>{Er(e,"__DataProcessor",{get:()=>t})}}function Zr(t){return(e,s)=>{Er(e,"__LayoutProcessor",{get:()=>t})}}function Qr(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,a=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o={get(){const t=this[r];return void 0===t?s:t},set(t){this[r]=t},configurable:!0,enumerable:!0};void 0===s?o.get=function(){return this[r]}:"width"===e?o.get=function(){const t=this[r];return void 0===t?this.__naturalWidth||s:t}:"height"===e&&(o.get=function(){const t=this[r];return void 0===t?this.__naturalHeight||s:t});let n,h=i;for(;!n&&h;)n=Rr(h,e),h=h.__proto__;n&&n.set&&(o.set=n.set),i[a]&&(o.set=i[a],delete i[a]),Object.defineProperty(i,e,o)}const Jr=new at("rewrite"),$r=[],ta=["destroy","constructor"];function ea(t){return(e,s)=>{$r.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function sa(){return t=>{ia()}}function ia(t){$r.length&&($r.forEach((e=>{t&&Jr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),$r.length=0)}function ra(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(ta.includes(i)||e&&e.includes(i)))if(t.prototype){Rr(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function aa(){return t=>{ct.register(t)}}function oa(){return t=>{_t.register(t)}}setTimeout((()=>ia(!0)));let na=class extends Pr{};na.POINTER="pointer",na.BEFORE_DOWN="pointer.before_down",na.BEFORE_MOVE="pointer.before_move",na.BEFORE_UP="pointer.before_up",na.DOWN="pointer.down",na.MOVE="pointer.move",na.UP="pointer.up",na.OVER="pointer.over",na.OUT="pointer.out",na.ENTER="pointer.enter",na.LEAVE="pointer.leave",na.TAP="tap",na.DOUBLE_TAP="double_tap",na.CLICK="click",na.DOUBLE_CLICK="double_click",na.LONG_PRESS="long_press",na.LONG_TAP="long_tap",na.MENU="pointer.menu",na=Ot([oa()],na);const ha={};let la=class extends na{static setList(t){this.list=t instanceof mt?t:new mt(t)}static setData(t){this.data=t}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(ha,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(ha,null,!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}assignMove(t){ha.x=t?this.totalX:this.moveX,ha.y=t?this.totalY:this.moveY}};la.BEFORE_DRAG="drag.before_drag",la.START="drag.start",la.DRAG="drag",la.END="drag.end",la.OVER="drag.over",la.OUT="drag.out",la.ENTER="drag.enter",la.LEAVE="drag.leave",la=Ot([oa()],la);let da=class extends na{static setList(t){la.setList(t)}static setData(t){la.setData(t)}};da.DROP="drop",da=Ot([oa()],da);let ca=class extends la{};ca.BEFORE_MOVE="move.before_move",ca.START="move.start",ca.MOVE="move",ca.END="move.end",ca=Ot([oa()],ca);let ua=class extends Pr{};ua.BEFORE_ROTATE="rotate.before_rotate",ua.START="rotate.start",ua.ROTATE="rotate",ua.END="rotate.end",ua=Ot([oa()],ua);let pa=class extends la{};pa.SWIPE="swipe",pa.LEFT="swipe.left",pa.RIGHT="swipe.right",pa.UP="swipe.up",pa.DOWN="swipe.down",pa=Ot([oa()],pa);let _a=class extends Pr{};_a.BEFORE_ZOOM="zoom.before_zoom",_a.START="zoom.start",_a.ZOOM="zoom",_a.END="zoom.end",_a=Ot([oa()],_a);let ga=class extends Pr{};ga.DOWN="key.down",ga.HOLD="key.hold",ga.UP="key.up",ga=Ot([oa()],ga);class fa{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(ca.START,this.moveData)}t.path=this.moveData.path,e.emit(ca.BEFORE_MOVE,t),e.emit(ca.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(_a.START,this.zoomData)}t.path=this.zoomData.path,e.emit(_a.BEFORE_ZOOM,t),e.emit(_a.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(ua.START,this.rotateData)}t.path=this.rotateData.path,e.emit(ua.BEFORE_ROTATE,t),e.emit(ua.ROTATE,t),this.transformEndWait()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout((()=>{this.transformEnd()}),this.interaction.config.pointer.transformTime)}transformEnd(){this.moveEnd(),this.zoomEnd(),this.rotateEnd()}moveEnd(){this.moveData&&(this.interaction.emit(ca.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(_a.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(ua.END,this.rotateData),this.rotateData=null)}destroy(){this.zoomData=this.moveData=this.rotateData=null}}const{copy:ma,toInnerPoint:ya,scaleOfOuter:xa,rotateOfOuter:va,skewOfOuter:wa,multiplyParent:ba,divideParent:Ca,getLayout:Oa}=x,Ta={},ka={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Ea(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)Pa(i[t],e,s)}},updateMatrix(t,e,s){const i=t.__layout;e?s&&(i.waitAutoLayout=!0,t.__hasAutoLayout&&(i.matrixChanged=!1)):i.waitAutoLayout&&(i.waitAutoLayout=!1),i.matrixChanged&&t.__updateLocalMatrix(),i.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,s=e.length;t<s;t++)Ra(e[t])}},updateAllChange(t){if(Ra(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Da(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s){const i={x:e,y:s};t.parent&&ya(t.parent.worldTransform,i,i,!0),Ba.moveLocal(t,i.x,i.y)},moveLocal(t,e,s=0){t.x+=e,t.y+=s},zoomOfWorld(t,e,s,i,r){this.zoomOfLocal(t,Ma(t,e),s,i,r)},zoomOfLocal(t,e,s,i=s,r){ma(Ta,t.__localMatrix),xa(Ta,e,s,i),La(t,Ta),t.scaleResize(s,i,!0!==r)},rotateOfWorld(t,e,s){this.rotateOfLocal(t,Ma(t,e),s)},rotateOfLocal(t,e,s){ma(Ta,t.__localMatrix),va(Ta,e,s),La(t,Ta),t.rotation=n.formatRotation(t.rotation+s)},skewOfWorld(t,e,s,i,r){this.skewOfLocal(t,Ma(t,e),s,i,r)},skewOfLocal(t,e,s,i=0,r){ma(Ta,t.__localMatrix),wa(Ta,e,s,i),Ba.setTransform(t,Ta,r)},transform(t,e,s){ma(Ta,t.localTransform),ba(Ta,e),Ba.setTransform(t,Ta,s)},setTransform(t,e,s){const i=Oa(e);s&&(t.scaleResize(i.scaleX/t.scaleX,i.scaleY/t.scaleY,!0!==s),delete i.scaleX,delete i.scaleY),t.set(i)},drop(t,e,s,i){ma(Ta,t.worldTransform),Ca(Ta,e.worldTransform),t.setTransform(Ta,i),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},hasParentAutoLayout(t){for(;t.parent;)if((t=t.parent).__hasAutoLayout)return!0}},Ba=ka,{updateAllMatrix:Pa,updateMatrix:Ea,updateAllWorldOpacity:Ra,updateAllChange:Da}=Ba;function La(t,e){const{e:s,f:i}=t.__localMatrix;t.x+=e.e-s,t.y+=e.f-i}function Ma(t,e){return t.__layout.update(),t.parent?R.tempToInnerOf(e,t.parent.__world):e}const Sa={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.isEraser?null:t.__local||t.__,localStrokeBounds:t=>t.__.isEraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.isEraser?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.isMask?t.__localBounds:null,maskLocalStrokeBounds:t=>t.__.isMask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.isMask?t.__layout.localRenderBounds:null},{updateBounds:Aa}=ka,Ia={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:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.add(t),Wa(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[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 s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)Na(e[t],e)},updateBounds(t,e){const s=[t];Na(t,s),Xa(s,e)},updateBoundsByBranchStack(t,e){let s,i;for(let r=t.length-1;r>-1;r--){s=t[r],i=s.children;for(let t=0,e=i.length;t<e;t++)Aa(i[t]);e&&e===s||Aa(s)}}},{pushAllChildBranch:Wa,pushAllBranchStack:Na,updateBoundsByBranchStack:Xa}=Ia,Ya={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},Fa={getMoveEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,moveX:e.x,moveY:e.y}),getRotateEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,rotation:e}),getZoomEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,scale:e}),getDragEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:s.x,y:s.y,moveX:s.x-e.x,moveY:s.y-e.y,totalX:s.x-t.x,totalY:s.y-t.y}),getDropEventData:(t,e,s)=>Object.assign(Object.assign({},t),{list:e,data:s}),getSwipeDirection:t=>t<-45&&t>-135?pa.UP:t>45&&t<135?pa.DOWN:t<=45&&t>=-45?pa.RIGHT:pa.LEFT,getSwipeEventData:(t,e,s)=>Object.assign(Object.assign({},s),{moveX:e.moveX,moveY:e.moveY,totalX:s.x-t.x,totalY:s.y-t.y,type:za.getSwipeDirection(R.getAngle(t,s))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons,origin:t}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,i=s.length;t<i;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const s=new mt,{list:i}=t;for(let t=0,r=i.length;t<r;t++)i[t].hasEvent(e)&&s.add(i[t]);return s}},za=Fa,ja=new mt,{getDragEventData:Ua,getDropEventData:Va,getSwipeEventData:Ha}=Fa;class Ga{constructor(t){this.interaction=t}setDragData(t){this.dragData=Ua(t,t,t)}getList(){const{proxy:t}=this.interaction.selector;return!this.dragging||t&&t.list.length?ja:la.list||this.dragableList||ja}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!Br.middle(t)&&!Br.left(t))return void s.pointerCancel();const{dragData:r}=this;this.moving||(this.moving=(Br.middle(t)||s.moveMode)&&e,this.moving&&s.emit(ca.START,r)),this.moving||this.dragStart(t,e);const{path:a,throughPath:o}=i;this.dragData=Ua(i,r,t),o&&(this.dragData.throughPath=o),this.dragData.path=a,this.moving?(s.emit(ca.BEFORE_MOVE,this.dragData),s.emit(ca.MOVE,this.dragData)):this.dragging&&(this.realDrag(),s.emit(la.BEFORE_DRAG,this.dragData),s.emit(la.DRAG,this.dragData))}dragStart(t,e){this.dragging||(this.dragging=Br.left(t)&&e,this.dragging&&(this.interaction.emit(la.START,this.dragData),this.getDragableList(this.dragData.path)))}getDragableList(t){let e;for(let s=0,i=t.length;s<i;s++)if(e=t.list[s],(e.__.draggable||e.__.editable)&&e.__.hitSelf){this.dragableList=new mt(e);break}}realDrag(){const{running:t}=this.interaction,e=this.getList();if(e.length&&t){const{moveX:t,moveY:s}=this.dragData;e.forEach((e=>ka.moveWorld(e,t,s)))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:i}=t;s?i.indexAt(0)!==s.indexAt(0)&&(e.emit(la.OUT,t,s),e.emit(la.OVER,t,i)):e.emit(la.OVER,t,i),this.dragOverPath=i}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:i}=t;e.emit(la.LEAVE,t,s,i),e.emit(la.ENTER,t,i,s),this.dragEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:r}=s,a=Ua(s,t,t);r&&(a.throughPath=r),a.path=i,this.moving&&e.emit(ca.END,a),this.dragging&&(e.emit(la.END,a),this.swipe(t,a),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(R.getDistance(i,t)>s.config.pointer.swipeDistance){const t=Ha(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Va(t,this.getList(),la.data);e.path=this.dragEnterPath,this.interaction.emit(da.DROP,e),this.interaction.emit(la.LEAVE,t,this.dragEnterPath)}dragReset(){la.list=la.data=this.dragableList=this.dragData=this.dragOverPath=this.dragEnterPath=null,this.dragging=this.moving=!1}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:s}=e,{autoDistance:i,dragOut:r}=e.config.move;if(!r||!i)return;const a=e.shrinkCanvasBounds,{x:o,y:n}=a,h=G.maxX(a),l=G.maxY(a),d=t.x<o?i:h<t.x?-i:0,c=t.y<n?i:l<t.y?-i:0;let u=0,p=0;this.autoMoveTimer=setInterval((()=>{u+=d,p+=c,R.move(s,d,c),R.move(this.dragData,d,c),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:c,totalX:u,totalY:p})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.dragReset()}}const Ka=at.get("emit");const qa=["move","zoom","rotate","key"];function Za(t,e,s,i,r){if(qa.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Ja(t,r)){let a;for(let o=0,n=t.children.length;o<n;o++)a=t.children[o],!s.path.has(a)&&a.__.hittable&&Qa(a,e,s,i,r)}}function Qa(t,e,s,i,r){if(t.destroyed)return!0;if(t.__.hitSelf&&t.hasEvent(e,i)&&!Ja(t,r)){s.phase=i?1:t===s.target?2:3;const r=_t.get(e,s);if(t.emitEvent(r,i),r.isStop)return!0}return!1}function Ja(t,e){return e&&e.has(t)}const $a={getData(t){const e=t[0],s=t[1],i=R.getCenter(e.from,s.from),r=R.getCenter(e.to,s.to),a={x:r.x-i.x,y:r.y-i.y},o=R.getDistance(e.from,s.from);return{move:a,scale:R.getDistance(e.to,s.to)/o,angle:R.getRotation(e.from,s.from,e.to,s.to),center:r}}},to={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:"Windows"===t.os?{x:37.5,y:37.5}:{x:20,y:8},preventDefault:!0},pointer:{hitRadius:5,through:!1,tapTime:120,longPressTime:800,transformTime:500,dragHover:!0,dragDistance:2,swipeDistance:20,ignoreMove:!1},cursor:{}},{pathHasEventType:eo,getMoveEventData:so,getZoomEventData:io,getRotateEventData:ro}=Fa;class ao{get dragging(){return this.dragger.dragging}get isDragEmpty(){return this.config.move.dragEmpty&&this.hoverData&&this.hoverData.path.list[0].isLeafer&&(!this.downData||this.downData.path.list[0].isLeafer)}get moveMode(){return this.config.move.drag||this.config.move.holdSpaceKey&&kr.isHoldSpaceKey()||this.downData&&Br.middle(this.downData)||this.isDragEmpty}get hitRadius(){return this.config.pointer.hitRadius}constructor(t,e,s,i){this.config=to,this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=s,this.defaultPath=new mt(t),this.transformer=new fa(this),this.dragger=new Ga(this),i&&(this.config=vt.default(i,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Br.defaultLeft(t),this.updateDownData(t),e&&(t.path=this.defaultPath),this.emit(na.BEFORE_DOWN,t),this.emit(na.DOWN,t),this.downTime=Date.now(),this.dragger.setDragData(t),Br.left(t)&&(this.tapWait(),this.longPressWait(t)),this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;this.downData&&Br.defaultLeft(t);const e=this.canvas.bounds.hitPoint(t);(e||this.downData)&&(e&&!this.downData&&Br.left(t)&&this.pointerDown(t,!0),this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(na.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=R.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),Br.right(this.downData)||this.dragger.checkDrag(t,e)}this.dragger.moving||this.config.pointer.ignoreMove||(this.updateHoverData(t),this.emit(na.MOVE,t),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t)),this.updateCursor(t))}pointerUp(t){t||(t=this.downData),this.downData&&(Br.defaultLeft(t),this.findPath(t),this.emit(na.BEFORE_UP,t),this.emit(na.UP,t),this.emit(na.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.dragger.dragEnd(t),this.downData=null,this.updateCursor(t))}pointerCancel(){this.pointerUp(this.dragger.dragData)}multiTouch(t,e){const{move:s,angle:i,scale:r,center:a}=$a.getData(e);this.rotate(ro(a,i,t)),this.zoom(io(a,r,t)),this.move(so(a,s,t))}menu(t){this.findPath(t),this.emit(na.MENU,t)}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}keyDown(t){const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,kr.setDownCode(e),this.emit(ga.HOLD,t,this.defaultPath),this.moveMode&&this.updateCursor()),this.emit(ga.DOWN,t,this.defaultPath)}keyUp(t){const{code:e}=t;this.downKeyMap[e]=!1,kr.setUpCode(e),this.emit(ga.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerOverOrOut(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.overPath?e.indexAt(0)!==this.overPath.indexAt(0)&&(this.emit(na.OUT,t,this.overPath),this.emit(na.OVER,t,e)):this.emit(na.OVER,t,e),this.overPath=e}pointerEnterOrLeave(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.emit(na.LEAVE,t,this.enterPath,e),this.emit(na.ENTER,t,e,this.enterPath),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(na.LEAVE,t),this.dragger.dragging&&this.emit(da.LEAVE,t))}tap(t){const{pointer:e}=this.config,s=this.longTap(t);if(!e.tapMore&&s)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const i=Date.now()-this.downTime,r=[na.DOUBLE_TAP,na.DOUBLE_CLICK].some((e=>eo(t.path,e)));i<e.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:s,through:i}=this.config.pointer,r=this.selector.getByPoint(t,s,e||{through:i});return r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,r.path}isDrag(t){return this.dragger.getList().has(t)}updateDownData(t){t||(t=this.downData),t&&(this.findPath(t),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(),name:na.MOVE}),this.hoverData=t)}updateCursor(t){if(this.config.cursor.stop)return;if(t||(this.updateHoverData(),t=this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.moveMode)return this.setCursor(this.downData?"grabbing":"grab");if(!t||this.dragger.dragging)return;let e,s;const{path:i}=t;for(let t=0,r=i.length;t<r&&(e=i.list[t],s=e.cursor,!s);t++);this.setCursor(s)}setCursor(t){this.cursor=t,this.canvas.setCursor(t)}emitTap(t){this.emit(na.TAP,t),this.emit(na.CLICK,t)}emitDoubleTap(t){this.emit(na.DOUBLE_TAP,t),this.emit(na.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(na.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(na.LONG_TAP,t),eo(t.path,na.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new Q(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(xr.RESIZE,this.__onResize,this)],t.once(Or.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,s,i){this.running&&function(t,e,s,i){if(!s&&!e.path)return;let r;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);try{for(let a=s.length-1;a>-1;a--){if(r=s.list[a],Qa(r,t,e,!0,i))return;r.isApp&&Za(r,t,e,!0,i)}for(let a=0,o=s.length;a<o;a++)if(r=s.list[a],r.isApp&&Za(r,t,e,!1,i),Qa(r,t,e,!1,i))return}catch(t){Ka.error(t)}}(t,e,s,i)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class oo{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}oo.custom={};const{toOuterOf:no,getPoints:ho}=G;class lo{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}constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},t.__local&&(this.localRenderBounds=this.localStrokeBounds=t.__local),this.boxChange(),this.matrixChange()}update(){const{leafer:e}=this.leaf;if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=this.leaf;for(;e.parent&&!e.parent.leafer;)e=e.parent;t.layout(e)}}getTransform(t="world"){switch(this.update(),t){case"world":return this.leaf.__world;case"local":return this.leaf.__localMatrix;case"inner":return x.defaultMatrix;default:return new M(this.leaf.__world).divideParent(t.__world)}}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);default:return new Q(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"margin":case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":if(this.localRenderBounds)return this.localRenderBounds;case"stroke":if(this.localStrokeBounds)return this.localStrokeBounds;case"margin":case"content":case"box":return this.leaf.__localBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}}getLayoutBounds(t,e="world",s){const{leaf:i}=this;let r,a,o=this.getInnerBounds(t);switch(e){case"world":r=i.getWorldPoint(o),a=i.__world;break;case"local":r=i.getLocalPointByInner(o),a=i.__;break;case"inner":r=o,a=x.defaultWorld;break;default:r=i.getWorldPoint(o,e),a=i.__world}let{scaleX:n,scaleY:h,rotation:l,skewX:d,skewY:c}=a,{width:u,height:p}=o;if("object"==typeof e){const t=e.__world;n/=t.scaleX,h/=t.scaleY,l-=t.rotation,d-=t.skewX,c-=t.skewY}if(s){const t=n<0?-n:n,e=h<0?-h:h;n/=t,h/=e,u*=t,p*=e}return{x:r.x,y:r.y,scaleX:n,scaleY:h,rotation:l,skewX:d,skewY:c,width:u,height:p}}getLayoutPoints(t,e="world"){const{leaf:s}=this,i=ho(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=s.parent;break;case"inner":break;default:r=e}return void 0!==r&&i.forEach((t=>s.innerToWorld(t,null,!1,r))),i}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),no(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),no(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),no(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__localBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this.strokeBounds={x:t,y:e,width:s,height:i},this.localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:i},this.localRenderBounds={x:t,y:e,width:s,height:i}}boxChange(){this.boxChanged=!0,this.localBoxChanged||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()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}const co={},uo={on(t,e,s){let i,r,a;s&&("boolean"==typeof s?i=s:(i=s.capture,r=s.once));const o=po(this,i,!0),n="string"==typeof t?t.split(" "):t,h=r?{listener:e,once:r}:{listener:e};n.forEach((t=>{t&&(a=o[t],a?-1===a.findIndex((t=>t.listener===e))&&a.push(h):o[t]=[h])}))},off(t,e,s){let i,r,a;s&&(i="boolean"==typeof s?s:s.capture);const o=po(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(r=o[t],r&&(a=r.findIndex((t=>t.listener===e)),a>-1&&r.splice(a,1),r.length||delete o[t]))}))},on_(t,e,s,i){return s&&(e=e.bind(s)),this.on(t,e,i),{type:t,current:this,listener:e,options:i}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){!e&&_t.has(t)&&(e=_t.get(t,{type:t,target:this,current:this}));const i=po(this,s)[t];if(i){let r;for(let a=0,o=i.length;a<o&&(r=i[a],r.listener(e),r.once&&(this.off(t,r.listener,s),a--,o--),!e||!e.isStopNow);a++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:i}=this;return void 0===e?!!(i&&i[t]||s&&s[t]):!!(e?i&&i[t]:s&&s[t])}};function po(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:co)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:co)}}const _o={__setAttr(t,e){if(this.leafer&&this.leafer.created){const s=this.__.__getInput(t);if("object"==typeof e||s!==e){this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e);const{CHANGE:i}=mr,r=new mr(i,this,t,s,e);this.hasEvent(i)&&!this.isLeafer&&this.emitEvent(r),this.leafer.emitEvent(r)}}else this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e)},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:go,multiplyParent:fo,translateInner:mo,defaultWorld:yo}=x,{toPoint:xo,tempPoint:vo}=st,wo={__updateWorldMatrix(){fo(this.__local||this.__layout,this.parent?this.parent.__world:yo,this.__world,!!this.__layout.affectScaleOrRotation,this.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged||t.rotationChanged)&&(go(e,s,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x,e.f=s.y,s.around&&(xo(s.around,t.boxBounds,vo),mo(e,-vo.x,-vo.y))}this.__layout.matrixChanged=!1}},{updateMatrix:bo,updateAllMatrix:Co,hasParentAutoLayout:Oo}=ka,{updateBounds:To}=Ia,{toOuterOf:ko,copyAndSpread:Bo}=G,Po={__updateWorldBounds(){ko(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.boxChanged=!1,t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),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=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasAutoLayout&&this.__updateAutoLayout(),ko(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ko(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ko(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,{width:e,height:s}=this.__;t.x=0,t.y=0,t.width=e,t.height=s},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.leafer&&this.leafer.layouter.addExtra(this),Oo(this)?bo(this):(Co(this),To(this,this))):bo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){Bo(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){Bo(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:Eo,copy:Ro,setRadius:Do}=R,Lo={},Mo={__hitWorld(t){return!this.__layout.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),this.__.hitRadius&&(Ro(Lo,t),Do(t=Lo,this.__.hitRadius)),Eo(t,this.__world,Lo),!(!this.__.hitBox||!G.hitRadiusPoint(this.__layout.boxBounds,Lo))||this.__hit(Lo)},__drawHitPath(t){this.__drawRenderPath(t)}},So={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__.__single){const s=t.getSameCanvas(!0,!0);this.__draw(s,e);const i=this.__.isEraser?"destination-out":this.__.blendMode;this.__worldFlipped||e.matrix?t.copyWorldByReset(s,null,null,i):t.copyWorldToInner(s,this.__world,this.__layout.renderBounds,i),s.recycle()}else this.__draw(t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},Ao={__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.isEraser))},__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s,i){e.opacity=1,e.resetTransform(),e.useMask(s),t.opacity=this.__worldOpacity,t.resetTransform(),t.copyWorld(e),i?(e.recycle(),s.recycle()):(e.clear(),s.clear())},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,i=e.length;s<i;s++)(t=e[s]).isMask&&(this.__removeMask(t),i--,s--)}}},Io={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){t.resetTransform();const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e),t.opacity=this.__worldOpacity;const i=this.__.isEraser?"destination-out":this.__.blendMode;this.__worldFlipped||e.matrix?t.copyWorld(s,null,null,i):t.copyWorld(s,this.__world,this.__world,i),s.recycle()}else this.__renderBranch(t,e)},__renderBranch(t,e){let s;const{children:i}=this;if(this.__hasMask&&i.length>1){let r;const a=t.getSameCanvas(!1,!0),o=t.getSameCanvas(!1,!0);for(let n=0,h=i.length;n<h;n++)s=i[n],s.isMask?(r?this.__renderMask(t,o,a):r=!0,s.__render(a,e)):s.__render(r?o:t,e);this.__renderMask(t,o,a,!0)}else{const{bounds:r,hideBounds:a}=e;for(let o=0,n=i.length;o<n;o++)s=i[o],r&&!r.hit(s.__world,e.matrix)||a&&a.includes(s.__world,e.matrix)||s.__render(t,e)}}},{LEAF:Wo,create:No}=s,{toInnerPoint:Xo,toOuterPoint:Yo}=x,{tempToOuterOf:Fo,copy:zo}=R,{moveLocal:jo,zoomOfLocal:Uo,rotateOfLocal:Vo,skewOfLocal:Ho,transform:Go,setTransform:Ko,drop:qo}=ka;let Zo=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 bt}get __LayoutProcessor(){return lo}get __localMatrix(){return this.__local||this.__layout}get __localBounds(){return this.__local||this.__}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get boxBounds(){return this.getBounds("box","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.update(),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}constructor(t){this.innerId=No(Wo),this.reset(t)}reset(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,rotation:0,skewX:0,skewY:0},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.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t){this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}nextRender(t){this.leafer?this.leafer.nextRender(t):this.waitLeafer((()=>this.leafer.nextRender(t)))}__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.__leaferWait&&Ya.run(this.__leaferWait)),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t){}get(){}toJSON(){return this.__.__getInputData()}toString(){return JSON.stringify(this.toJSON())}__setAttr(t,e){}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findOne(t,e){}forceUpdate(t){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===e?null:void 0,this[t]=e}updateLayout(){this.__layout.update()}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){}__updateMask(t){}__renderMask(t,e,s,i){}__removeMask(t){}getWorld(t){return this.__layout.update(),"x"===t?this.__world.e:"y"===t?this.__world.f:this.__world[t]}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&zo(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&zo(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),Xo(this.worldTransform,t,e,s)}innerToWorld(t,e,s,i){Yo(this.worldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getInnerPoint(t,e,s,i){const r=i?t:{};return this.worldToInner(t,r,s,e),r}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const r=i?t:{};return this.worldToLocal(t,r,s,e),r}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getWorldPoint(t,e,s,i){const r=i?t:{};return this.innerToWorld(t,r,s,e),r}getWorldPointByLocal(t,e,s,i){const r=i?t:{};return this.localToWorld(t,r,s,e),r}setTransform(t,e){Ko(this,t,e)}transform(t,e){Go(this,t,e)}move(t,e){jo(this,t,e)}scaleOf(t,e,s,i){Uo(this,Fo(t,this.localTransform),e,s,i)}rotateOf(t,e){Vo(this,Fo(t,this.localTransform),e)}skewOf(t,e,s,i){Ho(this,Fo(t,this.localTransform),e,s,i)}scaleResize(t,e=t,s){const i=this;s?(i.scaleX*=t,i.scaleY*=e):(t<0&&(i.scaleX*=-1,t=-t),e<0&&(i.scaleY*=-1,e=-e),this.__scaleResize(t,e))}__scaleResize(t,e){1!==t&&(this.width*=t),1!==e&&(this.height*=e)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){qo(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e){Qr(this.prototype,t,e)}static addAttr(t,e,s){s||(s=Wr),s(e)(this.prototype,t)}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.removeAll(!0),this.__.destroy(),this.__layout.destroy(),this.__captureMap=this.__bubbleMap=this.__parentWait=this.__leaferWait=null,this.destroyed=!0)}};Zo=Ot([ra(_o),ra(wo),ra(Po),ra(Mo),ra(uo),ra(So)],Zo);const{setListWithFn:Qo}=G,{sort:Jo}=Ia,{localBoxBounds:$o,localStrokeBounds:tn,localRenderBounds:en,maskLocalBoxBounds:sn,maskLocalStrokeBounds:rn,maskLocalRenderBounds:an}=Sa;let on=class extends Zo{constructor(){super(),this.isBranch=!0,this.children=[]}__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){Qo(this.__layout.boxBounds,this.children,this.__hasMask?sn:$o)}__updateStrokeBounds(){Qo(this.__layout.strokeBounds,this.children,this.__hasMask?rn:tn)}__updateRenderBounds(){Qo(this.__layout.renderBounds,this.children,this.__hasMask?an:en)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Jo),this.__layout.affectChildrenSort=t}}add(t,e){t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.matrixChange(),t.__parentWait&&Ya.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(fr.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){t.forEach((t=>this.add(t)))}remove(t,e){if(t){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}else void 0===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()})))}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(fr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new fr(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};on=Ot([ra(Io),ra(Ao)],on);const nn=at.get("plugin"),hn={power:{},list:[],onLeafer(t){hn.list.forEach((e=>{e.onLeafer&&e.onLeafer(t)}))}};function ln(t,e){const s={},{power:i,list:r}=hn;if(i||nn.error("need add PluginManager.power = LeaferUI"),r.includes(t))nn.warn("repeat run",t.name);else{r.push(t),t.import?t.import.forEach((t=>{i[t]?s[t]=i[t]:nn.error(t+" non-existent")})):nn.warn("no import");try{t.run(s,e)}catch(t){nn.error(t)}}}export{br as AnimateEvent,st as AroundHelper,J as AutoBounds,le as BezierHelper,Q as Bounds,G as BoundsHelper,on as Branch,Ia as BranchHelper,Io as BranchRender,ft as CanvasManager,fr as ChildEvent,e as Creator,oo as Cursor,vt as DataHelper,at as Debug,$ as Direction4,tt as Direction9,la as DragEvent,da as DropEvent,ye as EllipseHelper,gr as Event,_t as EventCreator,Ct as FileHelper,xt as HitCanvasManager,yr as ImageEvent,dr as ImageManager,s as IncrementId,ao as InteractionBase,Fa as InteractionHelper,ga as KeyEvent,kr as Keyboard,wr as LayoutEvent,Zo as Leaf,Po as LeafBounds,Sa as LeafBoundsHelper,bt as LeafData,_o as LeafDataProxy,uo as LeafEventer,ka as LeafHelper,Mo as LeafHit,lo as LeafLayout,yt as LeafLevelList,mt as LeafList,Ao as LeafMask,wo as LeafMatrix,So as LeafRender,At as LeaferCanvasBase,Or as LeaferEvent,_r as LeaferImage,n as MathHelper,M as Matrix,x as MatrixHelper,ca as MoveEvent,$a as MultiTouchHelper,Yt as NeedConvertToCanvasCommandMap,h as OneRadian,l as PI2,d as PI_2,Zi as PathBounds,Ts as PathCommandDataHelper,Nt as PathCommandMap,ss as PathConvert,rr as PathCorner,zs as PathCreator,ii as PathDrawer,It as PathHelper,Ut as PathNumberCommandLengthMap,jt as PathNumberCommandMap,mi as PathScaler,t as Platform,hn as PluginManager,L as Point,R as PointHelper,Br as PointerButton,na as PointerEvent,mr as PropertyEvent,Vt as RectHelper,Cr as RenderEvent,xr as ResizeEvent,ua as RotateEvent,ht as Run,rt as StringNumberMap,pa as SwipeEvent,hr as TaskItem,lr as TaskProcessor,S as TwoPointBoundsHelper,ct as UICreator,Pr as UIEvent,Ya as WaitHelper,vr as WatchEvent,_a as ZoomEvent,Fr as affectRenderBoundsType,Xr as affectStrokeBoundsType,Sr as autoLayoutType,Wr as boundsType,or as canvasPatch,St as canvasSizeAttrs,Kr as cursorType,qr as dataProcessor,Lr as dataType,Qr as defineDataProcessor,Er as defineKey,Dr as defineLeafAttr,Hr as eraserType,Rr as getDescriptor,Gr as hitType,Zr as layoutProcessor,Vr as maskType,jr as opacityType,Nr as pathType,Mr as positionType,aa as registerUI,oa as registerUIEvent,ea as rewrite,sa as rewriteAble,Ir as rotationType,Ar as scaleType,Ur as sortType,Yr as strokeType,zr as surfaceType,ra as useModule,ln as usePlugin};
package/dist/core.min.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";const t={image:{maxCacheSize:4096e3,maxPatternSize:8847360,suffix:"leaf"}},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=r;return e[t]?e[t]++:(e[t]=1,0)}},r=s,{round:i,pow:o,PI:a}=Math,n={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t,e){let s;if(t instanceof Array)switch(t.length){case 4:s=t;break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),e)for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),t),getGapRotation(t,e,s=0){let r=t+s;if(e>1){const t=Math.abs(r%e);(t<1||t>e-1)&&(r=Math.round(r/e)*e)}return r-s},float(t,e){const s=e?o(10,e):1e12;return-0===(t=i(t*s)/s)?0:t}},h=a/180,l=2*a,d=a/2,{sin:c,cos:u,acos:p,sqrt:g}=Math,{float:_}=n,f={};function m(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function y(){return 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 x={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:y(),tempMatrix:{},set(t,e=1,s=0,r=0,i=1,o=0,a=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=o,t.f=a},get:m,getWorld:y,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,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,r){v.toInnerPoint(t,e,f),v.scaleOfInner(t,f,s,r)},scaleOfInner(t,e,s,r=s){v.translateInner(t,e.x,e.y),v.scale(t,s,r),v.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:o}=t,a=u(e*=h),n=c(e);t.a=s*a-r*n,t.b=s*n+r*a,t.c=i*a-o*n,t.d=i*n+o*a},rotateOfOuter(t,e,s){v.toInnerPoint(t,e,f),v.rotateOfInner(t,f,s)},rotateOfInner(t,e,s){v.translateInner(t,e.x,e.y),v.rotate(t,s),v.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:o,d:a}=t;s&&(s*=h,t.a=r+o*s,t.b=i+a*s),e&&(e*=h,t.c=o+r*e,t.d=a+i*e)},skewOfOuter(t,e,s,r){v.toInnerPoint(t,e,f),v.skewOfInner(t,f,s,r)},skewOfInner(t,e,s,r=0){v.translateInner(t,e.x,e.y),v.skew(t,s,r),v.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:o,e:a,f:n}=t;t.a=e.a*s+e.b*i,t.b=e.a*r+e.b*o,t.c=e.c*s+e.d*i,t.d=e.c*r+e.d*o,t.e=e.e*s+e.f*i+a,t.f=e.e*r+e.f*o+n},multiplyParent(t,e,s,r,i){const{e:o,f:a}=t;if(s||(s=t),void 0===r&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:r,b:o,c:a,d:n}=t;s.a=r*e.a+o*e.c,s.b=r*e.b+o*e.d,s.c=a*e.a+n*e.c,s.d=a*e.b+n*e.d,i&&v.multiplyParentLayout(s,e,i)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,i&&v.multiplyParentLayout(s,e);s.e=o*e.a+a*e.c+e.e,s.f=o*e.b+a*e.d+e.f},multiplyParentLayout(t,e,s){s?(t.scaleX=e.scaleX*s.scaleX,t.scaleY=e.scaleY*s.scaleY,t.rotation=e.rotation+s.rotation,t.skewX=e.skewX+s.skewX,t.skewY=e.skewY+s.skewY):(t.scaleX=e.scaleX,t.scaleY=e.scaleY,t.rotation=e.rotation,t.skewX=e.skewX,t.skewY=e.skewY)},divide(t,e){v.multiply(t,v.tempInvert(e))},divideParent(t,e){v.multiplyParent(t,v.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=v;return v.copy(e,t),v.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e:o,f:a}=t;if(s||r){const n=1/(e*i-s*r);t.a=i*n,t.b=-s*n,t.c=-r*n,t.d=e*n,t.e=-(o*i-a*r)*n,t.f=-(a*e-o*s)*n}else if(1===e&&1===i)t.e=-o,t.f=-a;else{const s=1/(e*i);t.a=i*s,t.d=e*s,t.e=-o*i*s,t.f=-a*e*s}},toOuterPoint(t,e,s,r){const{x:i,y:o}=e;s||(s=e),s.x=i*t.a+o*t.c,s.y=i*t.b+o*t.d,r||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,r){const{a:i,b:o,c:a,d:n}=t,h=1/(i*n-o*a),{x:l,y:d}=e;if(s||(s=e),s.x=(l*n-d*a)*h,s.y=(d*i-l*o)*h,!r){const{e:e,f:r}=t;s.x-=(e*n-r*a)*h,s.y-=(r*i-e*o)*h}},setLayout(t,e,s,r){const{x:i,y:o,scaleX:a,scaleY:n}=e;if(void 0===r&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:s,skewX:r,skewY:i}=e,o=s*h,l=u(o),d=c(o);if(r||i){const e=r*h,s=i*h;t.a=(l+s*-d)*a,t.b=(d+s*l)*a,t.c=(e*l-d)*n,t.d=(l+e*d)*n}else t.a=l*a,t.b=d*a,t.c=-d*n,t.d=l*n}else t.a=a,t.b=0,t.c=0,t.d=n;t.e=i,t.f=o,s&&v.translateInner(t,-s.x,-s.y)},getLayout(t,e,s){const{a:r,b:i,c:o,d:a,e:n,f:l}=t;let f,m,y,x,v,w=n,E=l;if(i||o){const t=r*a-i*o;if(o&&!s){f=g(r*r+i*i),m=t/f;const e=r/f;y=i>0?p(e):-p(e)}else{m=g(o*o+a*a),f=t/m;const e=o/m;y=d-(a>0?p(-e):-p(e))}const e=u(y),n=c(y);f=_(f),m=_(m),x=_((o/m+n)/e/h),v=_((i/f-n)/e/h),y=_(y/h)}else f=r,m=a,y=x=v=0;return e&&(w+=e.x*r+e.y*o,E+=e.x*i+e.y*a),{x:w,y:E,scaleX:f,scaleY:m,rotation:y,skewX:x,skewY:v}},reset(t){v.set(t)}},v=x,{toInnerPoint:w,toOuterPoint:E}=x,{sin:b,cos:P,abs:T,sqrt:C,atan2:O,min:k,PI:B}=Math,D={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=void 0===s?e:s},copy(t,e){t.x=e.x,t.y=e.y},move(t,e,s){t.x+=e,t.y+=s},rotate(t,e,s){s||(s=R.defaultPoint);const r=P(e*=h),i=b(e),o=t.x-s.x,a=t.y-s.y;t.x=s.x+o*r-a*i,t.y=s.y+o*i+a*r},tempToInnerOf(t,e){const{tempPoint:s}=R;return R.copy(s,t),w(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=R;return R.copy(s,t),E(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=R;return R.copy(s,t),R.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),w(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){w(e,t,s)},toOuterOf(t,e,s){E(e,t,s)},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)=>R.getDistanceFrom(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=T(s-t),o=T(r-e);return C(i*i+o*o)},getMinDistanceFrom:(t,e,s,r,i,o)=>k(R.getDistanceFrom(t,e,s,r),R.getDistanceFrom(s,r,i,o)),getAngle:(t,e)=>R.getAtan2(t,e)/h,getRotation:(t,e,s,r)=>(r||(r=e),R.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/h),getRadianFrom(t,e,s,r,i,o,a,n){void 0===a&&(a=s,n=r);let h=O(e-r,t-s);const d=O(o-n,i-a)-h;return d<-B?d+l:d},getAtan2:(t,e)=>O(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const r=R.getAtan2(t,e);return{x:t.x+P(r)*s,y:t.y+b(r)*s}},reset(t){R.reset(t)}},R=D;class L{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?D.copy(this,t):D.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new L(this)}rotate(t,e){return D.rotate(this,t,e),this}rotateOf(t,e){return D.rotate(this,e,t),this}getRotation(t,e,s){return D.getRotation(this,t,e,s)}toInnerOf(t,e){return D.toInnerOf(this,t,e),this}toOuterOf(t,e){return D.toOuterOf(this,t,e),this}getCenter(t){return new L(D.getCenter(this,t))}getDistance(t){return D.getDistance(this,t)}getDistancePoint(t,e){return new L(D.getDistancePoint(this,t,e))}getAngle(t){return D.getAngle(this,t)}getAtan2(t){return D.getAtan2(this,t)}reset(){return D.reset(this),this}}class M{constructor(t,e,s,r,i,o){this.set(t,e,s,r,i,o)}set(t,e,s,r,i,o){return"object"==typeof t?x.copy(this,t):x.set(this,t,e,s,r,i,o),this}get(){const{a:t,b:e,c:s,d:r,e:i,f:o}=this;return{a:t,b:e,c:s,d:r,e:i,f:o}}clone(){return new M(this)}translate(t,e){return x.translate(this,t,e),this}translateInner(t,e){return x.translateInner(this,t,e),this}scale(t,e){return x.scale(this,t,e),this}scaleOfOuter(t,e,s){return x.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return x.scaleOfInner(this,t,e,s),this}rotate(t){return x.rotate(this,t),this}rotateOfOuter(t,e){return x.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return x.rotateOfInner(this,t,e),this}skew(t,e){return x.skew(this,t,e),this}skewOfOuter(t,e,s){return x.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return x.skewOfInner(this,t,e,s),this}multiply(t){return x.multiply(this,t),this}multiplyParent(t){return x.multiplyParent(this,t),this}divide(t){return x.divide(this,t),this}divideParent(t){return x.divideParent(this,t),this}invert(){return x.invert(this),this}toOuterPoint(t,e,s){x.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){x.toInnerPoint(this,t,e,s)}setLayout(t,e){return x.setLayout(this,t,e),this}getLayout(t,e){return x.getLayout(this,t,e)}reset(){x.reset(this)}}const S={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,r,i){I(t,e,s),I(t,e+r,s+i)},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:I}=S,{tempPointBounds:A,setPoint:W,addPoint:N,toBounds:X}=S,{toOuterPoint:Y}=x;let F,z,j,H;const U={},V={},K={tempBounds:{},set(t,e=0,s=0,r=0,i=0){t.x=e,t.y=s,t.width=r,t.height=i},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,r){r||(r=s),G.set(t,e.x-s,e.y-r,e.width+2*s,e.height+2*r)},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,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),G.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?q(e,t):e=t,s?(e.offsetX=-(G.maxX(s)-t.x),e.offsetY=-(G.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),G.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s),t.width*=e,t.height*=s},scaleOf(t,e,s,r){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(r-1),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(G.copy(G.tempBounds,t),G.toOuterOf(G.tempBounds,e),G.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),G.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:r,d:i}=e;r>0?(s.width=t.width*r,s.x=e.e+t.x*r):(s.width=t.width*-r,s.x=e.e+t.x*r-s.width),i>0?(s.height=t.height*i,s.y=e.f+t.y*i):(s.height=t.height*-i,s.y=e.f+t.y*i-s.height)}else U.x=t.x,U.y=t.y,Y(e,U,V),W(A,V.x,V.y),U.x=t.x+t.width,Y(e,U,V),N(A,V.x,V.y),U.y=t.y+t.height,Y(e,U,V),N(A,V.x,V.y),U.x=t.x,Y(e,U,V),N(A,V.x,V.y),X(A,s)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new M(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e,s){const r={};return G.copyAndSpread(r,t,e,s),r},spread(t,e,s=e){G.copyAndSpread(t,t,e,s)},ceil(t){t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.ceil(t.width),t.height=Math.ceil(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)},add(t,e){F=t.x+t.width,z=t.y+t.height,j=e.x+e.width,H=e.y+e.height,F=F>j?F:j,z=z>H?z:H,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=F-t.x,t.height=z-t.y},addList(t,e){G.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){G.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){G.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,r=!1){let i,o=!0;for(let a=0,n=e.length;a<n;a++)i=s?s(e[a]):e[a],i&&(i.width||i.height)&&(o?(o=!1,r||q(t,i)):Z(t,i));o&&G.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?W(A,t.x,t.y):N(A,t.x,t.y))),X(A,t)},getPoints(t){const{x:e,y:s,width:r,height:i}=t;return[{x:e,y:s},{x:e+r,y:s},{x:e+r,y:s+i},{x:e,y:s+i}]},hitRadiusPoint:(t,e,s)=>(s&&(e=D.tempToInnerRadiusPointOf(e,s)),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,s)=>(s&&(e=D.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=G.tempToOuterOf(e,s)),!(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,s)=>(s&&(e=G.tempToOuterOf(e,s)),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,s){s&&(e=G.tempToOuterOf(e,s));let{x:r,y:i,width:o,height:a}=e;return F=r+o,z=i+a,j=t.x+t.width,H=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,F=F<j?F:j,z=z<H?z:H,o=F-r,a=z-i,{x:r,y:i,width:o,height:a}},intersect(t,e,s){G.copy(t,G.getIntersectData(t,e,s))},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){G.set(t)}},G=K,{add:Z,copy:q}=G;class Q{get minX(){return K.minX(this)}get minY(){return K.minY(this)}get maxX(){return K.maxX(this)}get maxY(){return K.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?K.copy(this,t):K.set(this,t,e,s,r),this}get(){const{x:t,y:e,width:s,height:r}=this;return{x:t,y:e,width:s,height:r}}clone(){return new Q(this)}scale(t,e){return K.scale(this,t,e),this}scaleOf(t,e,s){return K.scaleOf(this,t,e,s),this}toOuterOf(t,e){return K.toOuterOf(this,t,e),this}getFitMatrix(t){return K.getFitMatrix(this,t)}spread(t,e){return K.spread(this,t,e),this}ceil(){return K.ceil(this),this}unsign(){return K.unsign(this),this}add(t){return K.add(this,t),this}addList(t){return K.setList(this,t,!0),this}setList(t){return K.setList(this,t),this}addListWithFn(t,e){return K.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return K.setListWithFn(this,t,e),this}setPoints(t){return K.setPoints(this,t),this}getPoints(){return K.getPoints(this)}hitPoint(t,e){return K.hitPoint(this,t,e)}hitRadiusPoint(t,e){return K.hitRadiusPoint(this,t,e)}hit(t,e){return K.hit(this,t,e)}includes(t,e){return K.includes(this,t,e)}intersect(t,e){return K.intersect(this,t,e),this}getIntersect(t,e){return new Q(K.getIntersectData(this,t,e))}isSame(t){return K.isSame(this,t)}isEmpty(){return K.isEmpty(this)}reset(){K.reset(this)}}var J,$;exports.Direction4=void 0,(J=exports.Direction4||(exports.Direction4={}))[J.top=0]="top",J[J.right=1]="right",J[J.bottom=2]="bottom",J[J.left=3]="left",exports.Direction9=void 0,($=exports.Direction9||(exports.Direction9={}))[$.topLeft=0]="topLeft",$[$.top=1]="top",$[$.topRight=2]="topRight",$[$.right=3]="right",$[$.bottomRight=4]="bottomRight",$[$.bottom=5]="bottom",$[$.bottomLeft=6]="bottomLeft",$[$.left=7]="left",$[$.center=8]="center";const tt=[{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}],et={directionData:tt,tempPoint:{},get:st,toPoint(t,e,s,r){s||(s={});const i=st(t);s.x=i.x*e.width,s.y=i.y*e.height,r||(s.x+=e.x,s.y+=e.y)}};function st(t){return"string"==typeof t?tt[exports.Direction9[t]]:t}const rt={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};class it{constructor(t){this.repeatMap={},this.name=t}static get(t){return new it(t)}static set filter(t){t?"string"==typeof t&&(t=[t]):t=[],this.filterList=t}static set exclude(t){t?"string"==typeof t&&(t=[t]):t=[],this.excludeList=t}log(...t){if(ot.enable){if(ot.filterList.length&&ot.filterList.every((t=>t!==this.name)))return;if(ot.excludeList.length&&ot.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ot.enable&&console.warn(this.name,...t)}warn(...t){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)}}}it.filterList=[],it.excludeList=[];const ot=it,at=it.get("RunTime"),nt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const r=s.create(s.RUNTIME);return ht.currentId=ht.idMap[r]=e?performance.now():Date.now(),ht.currentName=ht.nameMap[r]=t,ht.nameToIdMap[t]=r,r},end(t,e){const s=ht.idMap[t],r=ht.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;ht.idMap[t]=ht.nameMap[t]=ht.nameToIdMap[r]=void 0,at.log(r,i,"ms")},endOfName(t,e){const s=ht.nameToIdMap[t];void 0!==s&&ht.end(s,e)}},ht=nt,lt=it.get("UICreator"),dt={list:{},register(t){const{__tag:e}=t.prototype;ct[e]?lt.repeat(e):ct[e]=t},get(t,e,s,r,i,o){const a=new ct[t](e);return void 0!==s&&(a.x=s,r&&(a.y=r),i&&(a.width=i),o&&(a.height=o)),a}},{list:ct}=dt,ut=it.get("EventCreator"),pt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(gt[e]?ut.repeat(e):gt[e]=t)}))},changeName(t,e){const s=gt[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,gt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new gt[t](...e)},{nameList:gt}=pt;class _t{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:r}=this;for(let e=0,i=r.length;e<i;e++)if(s=r[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const i=e.canvas(t);return this.add(i),i}recycle(t){t.recycled||(t.clear(),t.recycled=!0)}clearRecycled(){let t;const e=[];for(let s=0,r=this.list.length;s<r;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}class ft{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return t&&void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}add(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(void 0===s[t.innerId]){const{list:r}=this;for(let t=e,i=r.length;t<i;t++)s[r[t].innerId]++;0===e?r.unshift(t):(e>r.length&&(e=r.length),r.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let r=0,i=e.length;r<i;r++)void 0!==s?this.keys[e[r].innerId]=r-1:e[r].innerId===t.innerId&&(s=r,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,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 ft;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,r=t.length;s<r;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}const mt={default:(t,e)=>(yt(e,t),yt(t,e),t),assign(t,e){let s;Object.keys(e).forEach((r=>{var i;s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(i=t[r])||void 0===i?void 0:i.constructor)===Object?yt(t[r],e[r]):t[r]=e[r]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:yt}=mt;class xt{constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let r in this)"_"!==r[0]&&(s=e?e[r]:void 0,t[r]=void 0===s?this[r]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s,r;for(let i in this)"_"!==i[0]&&(s=this["_"+i],void 0!==s&&(r=e?e[i]:void 0,t[i]=void 0===r?s:r));return t}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){"pass-through"===this.blendMode?this.__leaf.__hasEraser||this.isEraser?this.__single=!0:this.__single&&(this.__single=!1):this.__single=!0}destroy(){this.__input=this.__middle=null}}const vt={opacityTypes:["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]}};function wt(t,e,s,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,r);else for(var n=t.length-1;n>=0;n--)(i=t[n])&&(a=(o<3?i(a):o>3?i(e,s,a):i(e,s))||a);return o>3&&a&&Object.defineProperty(e,s,a),a}function Et(t,e,s,r){return new(s||(s=Promise))((function(i,o){function a(t){try{h(r.next(t))}catch(t){o(t)}}function n(t){try{h(r.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,n)}h((r=r.apply(t,e||[])).next())}))}function bt(t){return(e,s)=>{t||(t=s),Object.defineProperty(e,s,{get(){return this.context[t]},set(e){this.context[t]=e}})}}vt.opacityTypes.forEach((t=>vt.upperCaseTypeMap[t]=t.toUpperCase())),"function"==typeof SuppressedError&&SuppressedError;const Pt=[];function Tt(){return(t,e)=>{Pt.push(e)}}const Ct=[];class Ot{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||Ct)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Pt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,r,i,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,r,i,o){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,r,i,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,r){}strokeRect(t,e,s,r){}clearRect(t,e,s,r){}drawImage(t,e,s,r,i,o,a,n,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*n;r+=e,e=0,o+=t,n-=t}if(s<0){const t=-s/i*h;i+=s,s=0,a+=t,h-=t}this.context.drawImage(t,e,s,r,i,o,a,n,h);break;case 5:this.context.drawImage(t,e,s,r,i);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,r,i,o){}quadraticCurveTo(t,e,s,r){}closePath(){}arc(t,e,s,r,i,o){}arcTo(t,e,s,r,i){}ellipse(t,e,s,r,i,o,a,n){}rect(t,e,s,r){}roundRect(t,e,s,r,i){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,r){}createPattern(t,e){}createRadialGradient(t,e,s,r,i,o){}fillText(t,e,s,r){}measureText(t){}strokeText(t,e,s,r){}destroy(){this.context=null}}wt([bt("imageSmoothingEnabled")],Ot.prototype,"smooth",void 0),wt([bt("imageSmoothingQuality")],Ot.prototype,"smoothLevel",void 0),wt([bt("globalAlpha")],Ot.prototype,"opacity",void 0),wt([bt()],Ot.prototype,"fillStyle",void 0),wt([bt()],Ot.prototype,"strokeStyle",void 0),wt([bt("lineWidth")],Ot.prototype,"strokeWidth",void 0),wt([bt("lineCap")],Ot.prototype,"strokeCap",void 0),wt([bt("lineJoin")],Ot.prototype,"strokeJoin",void 0),wt([bt("lineDashOffset")],Ot.prototype,"dashOffset",void 0),wt([bt()],Ot.prototype,"miterLimit",void 0),wt([bt()],Ot.prototype,"shadowBlur",void 0),wt([bt()],Ot.prototype,"shadowColor",void 0),wt([bt()],Ot.prototype,"shadowOffsetX",void 0),wt([bt()],Ot.prototype,"shadowOffsetY",void 0),wt([bt()],Ot.prototype,"filter",void 0),wt([bt()],Ot.prototype,"font",void 0),wt([bt()],Ot.prototype,"fontKerning",void 0),wt([bt()],Ot.prototype,"fontStretch",void 0),wt([bt()],Ot.prototype,"fontVariantCaps",void 0),wt([bt()],Ot.prototype,"textAlign",void 0),wt([bt()],Ot.prototype,"textBaseline",void 0),wt([bt()],Ot.prototype,"textRendering",void 0),wt([bt()],Ot.prototype,"wordSpacing",void 0),wt([bt()],Ot.prototype,"letterSpacing",void 0),wt([bt()],Ot.prototype,"direction",void 0),wt([Tt()],Ot.prototype,"setTransform",null),wt([Tt()],Ot.prototype,"resetTransform",null),wt([Tt()],Ot.prototype,"getTransform",null),wt([Tt()],Ot.prototype,"save",null),wt([Tt()],Ot.prototype,"restore",null),wt([Tt()],Ot.prototype,"translate",null),wt([Tt()],Ot.prototype,"scale",null),wt([Tt()],Ot.prototype,"rotate",null),wt([Tt()],Ot.prototype,"fill",null),wt([Tt()],Ot.prototype,"stroke",null),wt([Tt()],Ot.prototype,"clip",null),wt([Tt()],Ot.prototype,"fillRect",null),wt([Tt()],Ot.prototype,"strokeRect",null),wt([Tt()],Ot.prototype,"clearRect",null),wt([Tt()],Ot.prototype,"beginPath",null),wt([Tt()],Ot.prototype,"moveTo",null),wt([Tt()],Ot.prototype,"lineTo",null),wt([Tt()],Ot.prototype,"bezierCurveTo",null),wt([Tt()],Ot.prototype,"quadraticCurveTo",null),wt([Tt()],Ot.prototype,"closePath",null),wt([Tt()],Ot.prototype,"arc",null),wt([Tt()],Ot.prototype,"arcTo",null),wt([Tt()],Ot.prototype,"ellipse",null),wt([Tt()],Ot.prototype,"rect",null),wt([Tt()],Ot.prototype,"roundRect",null),wt([Tt()],Ot.prototype,"createConicGradient",null),wt([Tt()],Ot.prototype,"createLinearGradient",null),wt([Tt()],Ot.prototype,"createPattern",null),wt([Tt()],Ot.prototype,"createRadialGradient",null),wt([Tt()],Ot.prototype,"fillText",null),wt([Tt()],Ot.prototype,"measureText",null),wt([Tt()],Ot.prototype,"strokeText",null);const kt=new Q,Bt={width:1,height:1,pixelRatio:1},Dt=it.get("LeaferCanvasBase"),Rt=["width","height","pixelRatio"];const Lt={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Mt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},St=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},Mt),It={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},At={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},Wt=Object.assign(Object.assign({},At),Mt),Nt=St,Xt={};for(let t in Nt)Xt[Nt[t]]=t;const Yt={};for(let t in Nt)Yt[Nt[t]]=It[t];const Ft={drawRoundRect(t,e,s,r,i,o){const a=n.fourNumber(o,Math.min(r/2,i/2)),h=e+r,l=s+i;a[0]?t.moveTo(e+a[0],s):t.moveTo(e,s),a[1]?t.arcTo(h,s,h,l,a[1]):t.lineTo(h,s),a[2]?t.arcTo(h,l,e,l,a[2]):t.lineTo(h,l),a[3]?t.arcTo(e,l,e,s,a[3]):t.lineTo(e,l),a[0]?t.arcTo(e,s,h,s,a[0]):t.lineTo(e,s)}},{sin:zt,cos:jt,atan2:Ht,ceil:Ut,abs:Vt,PI:Kt,sqrt:Gt,pow:Zt}=Math,{setPoint:qt,addPoint:Qt}=S,{set:Jt}=D,{M:$t,L:te,C:ee,Q:se,Z:re}=St,ie={},oe={points(t,e,s,r){if(t.push($t,e[0],e[1]),s&&e.length>5){let i,o,a,n,h,l,d,c,u,p,g,_,f,m=e.length;const y=!0===s?.5:s;r&&(m=(e=[e[m-2],e[m-1],...e,e[0],e[1],e[2],e[3]]).length);for(let s=2;s<m-2;s+=2)i=e[s-2],o=e[s-1],a=e[s],n=e[s+1],h=e[s+2],l=e[s+3],g=Gt(Zt(a-i,2)+Zt(n-o,2)),_=Gt(Zt(h-a,2)+Zt(l-n,2)),f=g+_,g=y*g/f,_=y*_/f,h-=i,l-=o,d=a-g*h,c=n-g*l,2===s?r||t.push(se,d,c,a,n):t.push(ee,u,p,d,c,a,n),u=a+_*h,p=n+_*l;r||t.push(se,u,p,e[m-2],e[m-1])}else for(let s=2,r=e.length;s<r;s+=2)t.push(te,e[s],e[s+1]);r&&t.push(re)},rect(t,e,s,r,i){Lt.creator.path=t,Lt.creator.moveTo(e,s).lineTo(e+r,s).lineTo(e+r,s+i).lineTo(e,s+i).lineTo(e,s)},roundRect(t,e,s,r,i,o){Lt.creator.path=[],Ft.drawRoundRect(Lt.creator,e,s,r,i,o),t.push(...Lt.convertToCanvasData(Lt.creator.path,!0))},arcTo(t,e,s,r,i,o,a,n,c,u,p){const g=r-e,_=i-s,f=o-r,m=a-i;let y=Ht(_,g),x=Ht(m,f),v=x-y;if(v<0&&(v+=l),v===Kt||Vt(g+_)<1e-12||Vt(f+m)<1e-12)return t&&t.push(te,r,i),c&&(qt(c,e,s),Qt(c,r,i)),p&&Jt(p,e,s),void(u&&Jt(u,r,i));const w=g*m-f*_<0,E=w?-1:1,b=n/jt(v/2),P=r+b*jt(y+v/2+d*E),T=i+b*zt(y+v/2+d*E);return y-=d*E,x-=d*E,he(t,P,T,n,n,0,y/h,x/h,w,c,u,p)},arc:(t,e,s,r,i,o,a,n,h,l)=>he(t,e,s,r,r,0,i,o,a,n,h,l),ellipse(t,e,s,r,i,o,a,n,c,u,p,g){const _=o*h,f=zt(_),m=jt(_);let y=a*h,x=n*h;y>Kt&&(y-=l),x<0&&(x+=l);let v=x-y;v<0?v+=l:v>l&&(v-=l),c&&(v-=l);const w=Ut(Vt(v/d)),E=v/w,b=zt(E/4),P=8/3*b*b/zt(E/2);x=y+E;let T,C,O,k,B,D,R,L,M=jt(y),S=zt(y),I=O=m*r*M-f*i*S,A=k=f*r*M+m*i*S,W=e+O,N=s+k;t&&t.push(te,W,N),u&&qt(u,W,N),g&&Jt(g,W,N);for(let o=0;o<w;o++)T=jt(x),C=zt(x),O=m*r*T-f*i*C,k=f*r*T+m*i*C,B=e+I-P*(m*r*S+f*i*M),D=s+A-P*(f*r*S-m*i*M),R=e+O+P*(m*r*C+f*i*T),L=s+k+P*(f*r*C-m*i*T),t&&t.push(ee,B,D,R,L,e+O,s+k),u&&ne(e+I,s+A,B,D,R,L,e+O,s+k,u,!0),I=O,A=k,M=T,S=C,y=x,x+=E;p&&Jt(p,e+O,s+k)},quadraticCurveTo(t,e,s,r,i,o,a){t.push(ee,(e+2*r)/3,(s+2*i)/3,(o+2*r)/3,(a+2*i)/3,o,a)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,o,a,n){ne(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(o+2*r)/3,i,o,a,n)},toTwoPointBounds(t,e,s,r,i,o,a,n,h,l){const d=[];let c,u,p,g,_,f,m,y,x=t,v=s,w=i,E=a;for(let t=0;t<2;++t)if(1==t&&(x=e,v=r,w=o,E=n),c=-3*x+9*v-9*w+3*E,u=6*x-12*v+6*w,p=3*v-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;g=-p/u,0<g&&g<1&&d.push(g)}else m=u*u-4*p*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?Qt(h,t,e):qt(h,t,e),Qt(h,a,n);for(let l=0,c=d.length;l<c;l++)ae(d[l],t,e,s,r,i,o,a,n,ie),Qt(h,ie.x,ie.y)},getPointAndSet(t,e,s,r,i,o,a,n,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,g=t*t*t;l.x=c*e+u*r+p*o+g*n,l.y=c*s+u*i+p*a+g*h},getPoint(t,e,s,r,i,o,a,n,h){const l={};return ae(t,e,s,r,i,o,a,n,h,l),l}},{getPointAndSet:ae,toTwoPointBounds:ne,ellipse:he}=oe,{sin:le,cos:de,sqrt:ce,atan2:ue}=Math,{ellipse:pe}=oe,ge={ellipticalArc(e,s,r,i,o,a,n,d,c,u,p){const g=(c-s)/2,_=(u-r)/2,f=a*h,m=le(f),y=de(f),x=-y*g-m*_,v=-y*_+m*g,w=i*i,E=o*o,b=v*v,P=x*x,T=w*E-w*b-E*P;let C=0;if(T<0){const t=ce(1-T/(w*E));i*=t,o*=t}else C=(n===d?-1:1)*ce(T/(w*b+E*P));const O=C*i*v/o,k=-C*o*x/i,B=ue((v-k)/o,(x-O)/i),D=ue((-v-k)/o,(-x-O)/i);let R=D-B;0===d&&R>0?R-=l:1===d&&R<0&&(R+=l);const L=s+g+y*O-m*k,M=r+_+m*O+y*k,S=R<0?1:0;p||t.ellipseToCurve?pe(e,L,M,i,o,a,B/h,D/h,S):i!==o||a?e.push(St.G,L,M,i,o,a,B/h,D/h,S):e.push(St.O,L,M,i,B/h,D/h,S)}},{M:_e,m:fe,L:me,l:ye,H:xe,h:ve,V:we,v:Ee,C:be,c:Pe,S:Te,s:Ce,Q:Oe,q:ke,T:Be,t:De,A:Re,a:Le,Z:Me,z:Se,N:Ie,D:Ae,X:We,G:Ne,F:Xe,O:Ye,P:Fe,U:ze}=St,{rect:je,roundRect:He,arcTo:Ue,arc:Ve,ellipse:Ke,quadraticCurveTo:Ge}=oe,{ellipticalArc:Ze}=ge,qe=it.get("PathConvert"),Qe={},Je={current:{dot:0},stringify(t){let e,s,r,i=0,o=t.length,a="";for(;i<o;){s=t[i],e=Yt[s],a+=s===r?" ":Xt[s];for(let s=1;s<e;s++)a+=t[i+s],s===e-1||(a+=" ");r=s,i+=e}return a},parse(t,e){let s,r,i,o="";const a=[],n=e?Wt:At;for(let e=0,h=t.length;e<h;e++)r=t[e],rt[r]?("."===r&&($e.dot++,$e.dot>1&&(ts(a,o),o="")),o+=r):St[r]?(o&&(ts(a,o),o=""),$e.name=St[r],$e.length=It[r],$e.index=0,ts(a,$e.name),!s&&n[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&ts(a,o),o=r):o&&(ts(a,o),o=""),i=r;return o&&ts(a,o),s?Je.toCanvasData(a,e):a},toCanvasData(t,e){let s,r,i,o,a,n=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(i=t[c],i){case fe:t[c+1]+=n,t[c+2]+=h;case _e:n=t[c+1],h=t[c+2],p.push(_e,n,h),c+=3;break;case ve:t[c+1]+=n;case xe:n=t[c+1],p.push(me,n,h),c+=2;break;case Ee:t[c+1]+=h;case we:h=t[c+1],p.push(me,n,h),c+=2;break;case ye:t[c+1]+=n,t[c+2]+=h;case me:n=t[c+1],h=t[c+2],p.push(me,n,h),c+=3;break;case Ce:t[c+1]+=n,t[c+2]+=h,t[c+3]+=n,t[c+4]+=h,i=Te;case Te:a=o===be||o===Te,l=a?2*n-s:t[c+1],d=a?2*h-r:t[c+2],s=t[c+1],r=t[c+2],n=t[c+3],h=t[c+4],p.push(be,l,d,s,r,n,h),c+=5;break;case Pe:t[c+1]+=n,t[c+2]+=h,t[c+3]+=n,t[c+4]+=h,t[c+5]+=n,t[c+6]+=h,i=be;case be:s=t[c+3],r=t[c+4],n=t[c+5],h=t[c+6],p.push(be,t[c+1],t[c+2],s,r,n,h),c+=7;break;case De:t[c+1]+=n,t[c+2]+=h,i=Be;case Be:a=o===Oe||o===Be,s=a?2*n-s:t[c+1],r=a?2*h-r:t[c+2],e?Ge(p,n,h,s,r,t[c+1],t[c+2]):p.push(Oe,s,r,t[c+1],t[c+2]),n=t[c+1],h=t[c+2],c+=3;break;case ke:t[c+1]+=n,t[c+2]+=h,t[c+3]+=n,t[c+4]+=h,i=Oe;case Oe:s=t[c+1],r=t[c+2],e?Ge(p,n,h,s,r,t[c+3],t[c+4]):p.push(Oe,s,r,t[c+3],t[c+4]),n=t[c+3],h=t[c+4],c+=5;break;case Le:t[c+6]+=n,t[c+7]+=h;case Re:Ze(p,n,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),n=t[c+6],h=t[c+7],c+=8;break;case Se:case Me:p.push(Me),c++;break;case Ie:n=t[c+1],h=t[c+2],e?je(p,n,h,t[c+3],t[c+4]):es(p,t,c,5),c+=5;break;case Ae:n=t[c+1],h=t[c+2],e?He(p,n,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):es(p,t,c,9),c+=9;break;case We:n=t[c+1],h=t[c+2],e?He(p,n,h,t[c+3],t[c+4],t[c+5]):es(p,t,c,6),c+=6;break;case Ne:Ke(e?p:es(p,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,Qe),n=Qe.x,h=Qe.y,c+=9;break;case Xe:e?Ke(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):es(p,t,c,5),n=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ye:Ve(e?p:es(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Qe),n=Qe.x,h=Qe.y,c+=7;break;case Fe:e?Ve(p,t[c+1],t[c+2],t[c+3],0,360,!1):es(p,t,c,4),n=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case ze:Ue(e?p:es(p,t,c,6),n,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Qe),n=Qe.x,h=Qe.y,c+=6;break;default:return qe.error(`command: ${i} [index:${c}]`,t),p}o=i}return p},copyData(t,e,s,r){for(let i=s,o=s+r;i<o;i++)t.push(e[i])},pushData(t,e){$e.index===$e.length&&($e.index=1,t.push($e.name)),t.push(Number(e)),$e.index++,$e.dot=0}},{current:$e,pushData:ts,copyData:es}=Je,{M:ss,L:rs,C:is,Q:os,Z:as,N:ns,D:hs,X:ls,G:ds,F:cs,O:us,P:ps,U:gs}=St,{getMinDistanceFrom:_s,getRadianFrom:fs}=D,{tan:ms,min:ys,abs:xs}=Math,vs={},ws={beginPath(t){t.length=0},moveTo(t,e,s){t.push(ss,e,s)},lineTo(t,e,s){t.push(rs,e,s)},bezierCurveTo(t,e,s,r,i,o,a){t.push(is,e,s,r,i,o,a)},quadraticCurveTo(t,e,s,r,i){t.push(os,e,s,r,i)},closePath(t){t.push(as)},rect(t,e,s,r,i){t.push(ns,e,s,r,i)},roundRect(t,e,s,r,i,o){if("number"==typeof o)t.push(ls,e,s,r,i,o);else{const a=n.fourNumber(o);a?t.push(hs,e,s,r,i,...a):t.push(ns,e,s,r,i)}},ellipse(t,e,s,r,i,o,a,n,h){void 0===o?t.push(cs,e,s,r,i):(void 0===a&&(a=0),void 0===n&&(n=360),t.push(ds,e,s,r,i,o,a,n,h?1:0))},arc(t,e,s,r,i,o,a){void 0===i?t.push(ps,e,s,r):(void 0===o&&(o=360),t.push(us,e,s,r,i,o,a?1:0))},arcTo(t,e,s,r,i,o,a,n){if(void 0!==a){const h=ms(fs(a,n,e,s,r,i)/2)*(_s(a,n,e,s,r,i)/2);t.push(gs,e,s,r,i,ys(o,xs(h)))}else t.push(gs,e,s,r,i,o)},drawEllipse(t,e,s,r,i,o,a,n,h){void 0===o&&(o=0),void 0===a&&(a=0),void 0===n&&(n=360),oe.ellipse(null,e,s,r,i,o,a,n,h,null,null,vs),t.push(ss,vs.x,vs.y),Es(t,e,s,r,i,o,a,n,h)},drawArc(t,e,s,r,i,o,a){void 0===i&&(i=0),void 0===o&&(o=360),oe.arc(null,e,s,r,i,o,a,null,null,vs),t.push(ss,vs.x,vs.y),bs(t,e,s,r,i,o,a)},drawPoints(t,e,s,r){oe.points(t,e,s,r)}},{ellipse:Es,arc:bs}=ws,{moveTo:Ps,lineTo:Ts,quadraticCurveTo:Cs,bezierCurveTo:Os,closePath:ks,beginPath:Bs,rect:Ds,roundRect:Rs,ellipse:Ls,arc:Ms,arcTo:Ss,drawEllipse:Is,drawArc:As,drawPoints:Ws}=ws;class Ns{constructor(t){this.path=t?"string"==typeof t?Lt.parse(t):t:[]}beginPath(){return Bs(this.path),this}moveTo(t,e){return Ps(this.path,t,e),this}lineTo(t,e){return Ts(this.path,t,e),this}bezierCurveTo(t,e,s,r,i,o){return Os(this.path,t,e,s,r,i,o),this}quadraticCurveTo(t,e,s,r){return Cs(this.path,t,e,s,r),this}closePath(){return ks(this.path),this}rect(t,e,s,r){return Ds(this.path,t,e,s,r),this}roundRect(t,e,s,r,i){return Rs(this.path,t,e,s,r,i),this}ellipse(t,e,s,r,i,o,a,n){return Ls(this.path,t,e,s,r,i,o,a,n),this}arc(t,e,s,r,i,o){return Ms(this.path,t,e,s,r,i,o),this}arcTo(t,e,s,r,i){return Ss(this.path,t,e,s,r,i),this}drawEllipse(t,e,s,r,i,o,a,n){return Is(this.path,t,e,s,r,i,o,a,n),this}drawArc(t,e,s,r,i,o){return As(this.path,t,e,s,r,i,o),this}drawPoints(t,e,s){return Ws(this.path,t,e,s),this}}const{M:Xs,L:Ys,C:Fs,Q:zs,Z:js,N:Hs,D:Us,X:Vs,G:Ks,F:Gs,O:Zs,P:qs,U:Qs}=St,Js=it.get("PathDrawer"),$s={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case Xs:t.moveTo(e[r+1],e[r+2]),r+=3;break;case Ys:t.lineTo(e[r+1],e[r+2]),r+=3;break;case Fs:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case zs:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case js:t.closePath(),r+=1;break;case Hs:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case Us:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],[e[r+5],e[r+6],e[r+7],e[r+8]]),r+=9;break;case Vs:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case Ks:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*h,e[r+6]*h,e[r+7]*h,e[r+8]),r+=9;break;case Gs:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,l,!1),r+=5;break;case Zs:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*h,e[r+5]*h,e[r+6]),r+=7;break;case qs:t.arc(e[r+1],e[r+2],e[r+3],0,l,!1),r+=4;break;case Qs:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void Js.error(`command: ${s} [index:${r}]`,e)}}},{M:tr,L:er,C:sr,Q:rr,Z:ir,N:or,D:ar,X:nr,G:hr,F:lr,O:dr,P:cr,U:ur}=St,pr={scale(t,e,s){if(!t)return;let r,i=0,o=t.length;for(;i<o;)switch(r=t[i],r){case tr:case er:gr(t,e,s,i,1),i+=3;break;case sr:gr(t,e,s,i,3),i+=7;break;case rr:gr(t,e,s,i,2),i+=5;break;case ir:i+=1;break;case or:gr(t,e,s,i,2),i+=5;break;case ar:gr(t,e,s,i,2),i+=9;break;case nr:gr(t,e,s,i,2),i+=6;break;case hr:gr(t,e,s,i,2),i+=9;break;case lr:gr(t,e,s,i,2),i+=5;break;case dr:t[i]=hr,t.splice(i+4,0,t[i+3],0),gr(t,e,s,i,2),i+=9,o+=2;break;case cr:t[i]=lr,t.splice(i+4,0,t[i+3]),gr(t,e,s,i,2),i+=5,o+=1;break;case ur:gr(t,e,s,i,2),i+=6}},scalePoints(t,e,s,r,i){for(let o=i?r+1:0,a=i?o+2*i:t.length;o<a;o+=2)t[o]*=e,t[o+1]*=s}},{scalePoints:gr}=pr,{M:_r,L:fr,C:mr,Q:yr,Z:xr,N:vr,D:wr,X:Er,G:br,F:Pr,O:Tr,P:Cr,U:Or}=St,{toTwoPointBounds:kr,toTwoPointBoundsByQuadraticCurve:Br,arcTo:Dr,arc:Rr,ellipse:Lr}=oe,{addPointBounds:Mr,copy:Sr,addPoint:Ir,setPoint:Ar,addBounds:Wr,toBounds:Nr}=S,Xr=it.get("PathBounds");let Yr,Fr,zr;const jr={},Hr={},Ur={},Vr={toBounds(t,e){Vr.toTwoPointBounds(t,Hr),Nr(Hr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Ar(e,0,0);let s,r,i,o,a,n=0,h=0,l=0;const d=t.length;for(;n<d;)switch(s=t[n],0===n&&(s===xr||s===mr||s===yr?Ar(e,h,l):Ar(e,t[n+1],t[n+2])),s){case _r:case fr:h=t[n+1],l=t[n+2],Ir(e,h,l),n+=3;break;case mr:o=t[n+5],a=t[n+6],kr(h,l,t[n+1],t[n+2],t[n+3],t[n+4],o,a,jr),Mr(e,jr),h=o,l=a,n+=7;break;case yr:r=t[n+1],i=t[n+2],o=t[n+3],a=t[n+4],Br(h,l,r,i,o,a,jr),Mr(e,jr),h=o,l=a,n+=5;break;case xr:n+=1;break;case vr:h=t[n+1],l=t[n+2],Wr(e,h,l,t[n+3],t[n+4]),n+=5;break;case wr:case Er:h=t[n+1],l=t[n+2],Wr(e,h,l,t[n+3],t[n+4]),n+=s===wr?9:6;break;case br:Lr(null,t[n+1],t[n+2],t[n+3],t[n+4],t[n+5],t[n+6],t[n+7],t[n+8],jr,Ur),0===n?Sr(e,jr):Mr(e,jr),h=Ur.x,l=Ur.y,n+=9;break;case Pr:h=t[n+1],l=t[n+2],Fr=t[n+3],zr=t[n+4],Wr(e,h-Fr,l-zr,2*Fr,2*zr),h+=Fr,n+=5;break;case Tr:Rr(null,t[n+1],t[n+2],t[n+3],t[n+4],t[n+5],t[n+6],jr,Ur),0===n?Sr(e,jr):Mr(e,jr),h=Ur.x,l=Ur.y,n+=7;break;case Cr:h=t[n+1],l=t[n+2],Yr=t[n+3],Wr(e,h-Yr,l-Yr,2*Yr,2*Yr),h+=Yr,n+=4;break;case Or:Dr(null,h,l,t[n+1],t[n+2],t[n+3],t[n+4],t[n+5],jr,Ur),0===n?Sr(e,jr):Mr(e,jr),h=Ur.x,l=Ur.y,n+=6;break;default:return void Xr.error(`command: ${s} [index:${n}]`,t)}}},{M:Kr,L:Gr,C:Zr,Z:qr}=St,{getCenterX:Qr,getCenterY:Jr}=D,{arcTo:$r}=ws,ti={smooth(t,e,s){let r,i=0,o=0,a=0,n=0,h=0,l=0,d=0,c=0,u=0;const p=t.length,g=[];for(;i<p;)switch(r=t[i],r){case Kr:n=c=t[i+1],h=u=t[i+2],i+=3,t[i]===Gr?(l=t[i+1],d=t[i+2],g.push(Kr,Qr(n,l),Jr(h,d))):g.push(Kr,n,h);break;case Gr:switch(o=t[i+1],a=t[i+2],i+=3,t[i]){case Gr:$r(g,o,a,t[i+1],t[i+2],e,c,u);break;case qr:$r(g,o,a,n,h,e,c,u);break;default:g.push(Gr,o,a)}c=o,u=a;break;case Zr:g.push(Zr,t[i+1],t[i+2],t[i+3],t[i+4],t[i+5],t[i+6]),i+=7;break;case qr:$r(g,n,h,l,d,e,c,u),g.push(qr),i+=1}return r!==qr&&(g[1]=n,g[2]=h),g}};Lt.creator=new Ns,Lt.parse=Je.parse,Lt.convertToCanvasData=Je.toCanvasData;const{drawRoundRect:ei}=Ft;const si=it.get("TaskProcessor");class ri{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Et(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){si.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class ii{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,s=0;for(let r=0;r<t;r++)r<=this.finishedIndex?(s+=this.list[r].time,r===this.finishedIndex&&(e=s)):e+=this.list[r].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&mt.assign(this.config,t),this.empty()}add(t,e){let s,r,i,o;const a=new ri(t);return a.parent=this,"number"==typeof e?o=e:e&&(r=e.parallel,s=e.start,i=e.time,o=e.delay),i&&(a.time=i),!1===r&&(a.parallel=!1),void 0===o?this.push(a,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(a,s))}),o)),this.isComplete=!1,a}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++,this.nextTask()})).catch((t=>{this.onError(t)})):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;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,r=this.finishedIndex+s;if(e.length){if(!this.running)return;r<this.total&&(t=this.list[r],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 oi={map:{},recycledList:[],tasker:new ii,patternTasker:new ii,get isComplete(){return ai.tasker.isComplete},get(t){let s=ai.map[t.url];return s||(s=e.image(t),ai.map[t.url]=s),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||ai.recycledList.push(t)}))},clearRecycled(){const t=ai.recycledList;t.length&&(t.forEach((t=>{!t.use&&t.url&&(delete ai.map[t.url],t.destroy())})),t.length=0)},isPixel:t=>vt.opacityTypes.some((e=>ai.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+vt.mineType(t)))return!0}else if(s.includes("."+t)||s.includes("."+vt.upperCaseTypeMap[t]))return!0;return!1},destroy(){ai.map={}}},ai=oi,{IMAGE:ni,create:hi}=s;class li{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class di extends li{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}di.ADD="child.add",di.REMOVE="child.remove";class ci extends li{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}ci.CHANGE="property.change";class ui extends li{constructor(t,e){super(t),Object.assign(this,e)}}ui.LOAD="image.load",ui.LOADED="image.loaded",ui.ERROR="image.error";class pi extends li{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){"object"==typeof t?(super(pi.RESIZE),Object.assign(this,t)):super(t),this.old=e}}pi.RESIZE="resize";class gi extends li{constructor(t,e){super(t),this.data=e}}gi.REQUEST="watch.request",gi.DATA="watch.data";class _i extends li{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}_i.CHECK_UPDATE="layout.check_update",_i.REQUEST="layout.request",_i.START="layout.start",_i.BEFORE="layout.before",_i.LAYOUT="layout",_i.AFTER="layout.after",_i.AGAIN="layout.again",_i.END="layout.end";class fi extends li{}fi.FRAME="animate.frame";class mi extends li{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}mi.REQUEST="render.request",mi.START="render.start",mi.BEFORE="render.before",mi.RENDER="render",mi.AFTER="render.after",mi.AGAIN="render.again",mi.END="render.end";class yi extends li{}yi.START="leafer.start",yi.BEFORE_READY="leafer.before_ready",yi.READY="leafer.ready",yi.AFTER_READY="leafer.after_ready",yi.VIEW_READY="leafer.view_ready",yi.VIEW_COMPLETED="leafer.view_completed",yi.STOP="leafer.stop",yi.RESTART="leafer.restart",yi.END="leafer.end";const xi={},vi={isHoldSpaceKey:()=>vi.isHold("Space"),isHold:t=>xi[t],setDownCode(t){xi[t]||(xi[t]=!0)},setUpCode(t){xi[t]=!1}},wi={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 Ei extends li{get spaceKey(){return vi.isHoldSpaceKey()}get left(){return wi.left(this)}get right(){return wi.right(this)}get middle(){return wi.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getInner(t){return t||(t=this.current),t.getInnerPoint(this)}getLocal(t){return t||(t=this.current),t.getLocalPoint(this)}static changeName(t,e){pt.changeName(t,e)}}function bi(t,e,s){Object.defineProperty(t,e,s)}function Pi(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Ti(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};bi(t,e,Object.assign(i,r||{})),Di(t,e,s)}function Ci(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__hasAutoLayout&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})}}const Oi=Ci;function ki(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const Bi=ki;function Di(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t},configurable:!0,enumerable:!0};void 0===s?a.get=function(){return this[i]}:"width"===e?a.get=function(){const t=this[i];return void 0===t?this.__naturalWidth||s:t}:"height"===e&&(a.get=function(){const t=this[i];return void 0===t?this.__naturalHeight||s:t});let n,h=r;for(;!n&&h;)n=Pi(h,e),h=h.__proto__;n&&n.set&&(a.set=n.set),r[o]&&(a.set=r[o],delete r[o]),Object.defineProperty(r,e,a)}const Ri=new it("rewrite"),Li=[],Mi=["destroy","constructor"];function Si(t){Li.length&&(Li.forEach((e=>{t&&Ri.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Li.length=0)}function Ii(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(Mi.includes(r)||e&&e.includes(r)))if(t.prototype){Pi(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}function Ai(){return t=>{pt.register(t)}}setTimeout((()=>Si(!0))),exports.PointerEvent=class extends Ei{},exports.PointerEvent.POINTER="pointer",exports.PointerEvent.BEFORE_DOWN="pointer.before_down",exports.PointerEvent.BEFORE_MOVE="pointer.before_move",exports.PointerEvent.BEFORE_UP="pointer.before_up",exports.PointerEvent.DOWN="pointer.down",exports.PointerEvent.MOVE="pointer.move",exports.PointerEvent.UP="pointer.up",exports.PointerEvent.OVER="pointer.over",exports.PointerEvent.OUT="pointer.out",exports.PointerEvent.ENTER="pointer.enter",exports.PointerEvent.LEAVE="pointer.leave",exports.PointerEvent.TAP="tap",exports.PointerEvent.DOUBLE_TAP="double_tap",exports.PointerEvent.CLICK="click",exports.PointerEvent.DOUBLE_CLICK="double_click",exports.PointerEvent.LONG_PRESS="long_press",exports.PointerEvent.LONG_TAP="long_tap",exports.PointerEvent.MENU="pointer.menu",exports.PointerEvent=wt([Ai()],exports.PointerEvent);const Wi={};exports.DragEvent=class extends exports.PointerEvent{static setList(t){this.list=t instanceof ft?t:new ft(t)}static setData(t){this.data=t}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Wi,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Wi,null,!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}assignMove(t){Wi.x=t?this.totalX:this.moveX,Wi.y=t?this.totalY:this.moveY}},exports.DragEvent.BEFORE_DRAG="drag.before_drag",exports.DragEvent.START="drag.start",exports.DragEvent.DRAG="drag",exports.DragEvent.END="drag.end",exports.DragEvent.OVER="drag.over",exports.DragEvent.OUT="drag.out",exports.DragEvent.ENTER="drag.enter",exports.DragEvent.LEAVE="drag.leave",exports.DragEvent=wt([Ai()],exports.DragEvent),exports.DropEvent=class extends exports.PointerEvent{static setList(t){exports.DragEvent.setList(t)}static setData(t){exports.DragEvent.setData(t)}},exports.DropEvent.DROP="drop",exports.DropEvent=wt([Ai()],exports.DropEvent),exports.MoveEvent=class extends exports.DragEvent{},exports.MoveEvent.BEFORE_MOVE="move.before_move",exports.MoveEvent.START="move.start",exports.MoveEvent.MOVE="move",exports.MoveEvent.END="move.end",exports.MoveEvent=wt([Ai()],exports.MoveEvent),exports.RotateEvent=class extends Ei{},exports.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",exports.RotateEvent.START="rotate.start",exports.RotateEvent.ROTATE="rotate",exports.RotateEvent.END="rotate.end",exports.RotateEvent=wt([Ai()],exports.RotateEvent),exports.SwipeEvent=class extends exports.DragEvent{},exports.SwipeEvent.SWIPE="swipe",exports.SwipeEvent.LEFT="swipe.left",exports.SwipeEvent.RIGHT="swipe.right",exports.SwipeEvent.UP="swipe.up",exports.SwipeEvent.DOWN="swipe.down",exports.SwipeEvent=wt([Ai()],exports.SwipeEvent),exports.ZoomEvent=class extends Ei{},exports.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",exports.ZoomEvent.START="zoom.start",exports.ZoomEvent.ZOOM="zoom",exports.ZoomEvent.END="zoom.end",exports.ZoomEvent=wt([Ai()],exports.ZoomEvent),exports.KeyEvent=class extends Ei{},exports.KeyEvent.DOWN="key.down",exports.KeyEvent.HOLD="key.hold",exports.KeyEvent.UP="key.up",exports.KeyEvent=wt([Ai()],exports.KeyEvent);class Ni{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(exports.MoveEvent.START,this.moveData)}t.path=this.moveData.path,e.emit(exports.MoveEvent.BEFORE_MOVE,t),e.emit(exports.MoveEvent.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(exports.ZoomEvent.START,this.zoomData)}t.path=this.zoomData.path,e.emit(exports.ZoomEvent.BEFORE_ZOOM,t),e.emit(exports.ZoomEvent.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(exports.RotateEvent.START,this.rotateData)}t.path=this.rotateData.path,e.emit(exports.RotateEvent.BEFORE_ROTATE,t),e.emit(exports.RotateEvent.ROTATE,t),this.transformEndWait()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout((()=>{this.transformEnd()}),this.interaction.config.pointer.transformTime)}transformEnd(){this.moveEnd(),this.zoomEnd(),this.rotateEnd()}moveEnd(){this.moveData&&(this.interaction.emit(exports.MoveEvent.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(exports.ZoomEvent.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(exports.RotateEvent.END,this.rotateData),this.rotateData=null)}destroy(){this.zoomData=this.moveData=this.rotateData=null}}const{copy:Xi,toInnerPoint:Yi,scaleOfOuter:Fi,rotateOfOuter:zi,skewOfOuter:ji,multiplyParent:Hi,divideParent:Ui,getLayout:Vi}=x,Ki={},Gi={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Qi(t,e,s),t.isBranch){const{children:r}=t;for(let t=0,i=r.length;t<i;t++)qi(r[t],e,s)}},updateMatrix(t,e,s){const r=t.__layout;e?s&&(r.waitAutoLayout=!0,t.__hasAutoLayout&&(r.matrixChanged=!1)):r.waitAutoLayout&&(r.waitAutoLayout=!1),r.matrixChanged&&t.__updateLocalMatrix(),r.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,s=e.length;t<s;t++)Ji(e[t])}},updateAllChange(t){if(Ji(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)$i(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s){const r={x:e,y:s};t.parent&&Yi(t.parent.worldTransform,r,r,!0),Zi.moveLocal(t,r.x,r.y)},moveLocal(t,e,s=0){t.x+=e,t.y+=s},zoomOfWorld(t,e,s,r,i){this.zoomOfLocal(t,eo(t,e),s,r,i)},zoomOfLocal(t,e,s,r=s,i){Xi(Ki,t.__localMatrix),Fi(Ki,e,s,r),to(t,Ki),t.scaleResize(s,r,!0!==i)},rotateOfWorld(t,e,s){this.rotateOfLocal(t,eo(t,e),s)},rotateOfLocal(t,e,s){Xi(Ki,t.__localMatrix),zi(Ki,e,s),to(t,Ki),t.rotation=n.formatRotation(t.rotation+s)},skewOfWorld(t,e,s,r,i){this.skewOfLocal(t,eo(t,e),s,r,i)},skewOfLocal(t,e,s,r=0,i){Xi(Ki,t.__localMatrix),ji(Ki,e,s,r),Zi.setTransform(t,Ki,i)},transform(t,e,s){Xi(Ki,t.localTransform),Hi(Ki,e),Zi.setTransform(t,Ki,s)},setTransform(t,e,s){const r=Vi(e);s&&(t.scaleResize(r.scaleX/t.scaleX,r.scaleY/t.scaleY,!0!==s),delete r.scaleX,delete r.scaleY),t.set(r)},drop(t,e,s,r){Xi(Ki,t.worldTransform),Ui(Ki,e.worldTransform),t.setTransform(Ki,r),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},hasParentAutoLayout(t){for(;t.parent;)if((t=t.parent).__hasAutoLayout)return!0}},Zi=Gi,{updateAllMatrix:qi,updateMatrix:Qi,updateAllWorldOpacity:Ji,updateAllChange:$i}=Zi;function to(t,e){const{e:s,f:r}=t.__localMatrix;t.x+=e.e-s,t.y+=e.f-r}function eo(t,e){return t.__layout.update(),t.parent?D.tempToInnerOf(e,t.parent.__world):e}const so={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.isEraser?null:t.__local||t.__,localStrokeBounds:t=>t.__.isEraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.isEraser?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.isMask?t.__localBounds:null,maskLocalStrokeBounds:t=>t.__.isMask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.isMask?t.__layout.localRenderBounds:null},{updateBounds:ro}=Gi,io={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:s}=t;for(let r=0,i=s.length;r<i;r++)(t=s[r]).isBranch&&(t.__tempNumber=1,e.add(t),oo(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[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 s=e.length;const{children:r}=t;for(let t=0,s=r.length;t<s;t++)r[t].isBranch&&e.push(r[t]);for(let t=s,r=e.length;t<r;t++)ao(e[t],e)},updateBounds(t,e){const s=[t];ao(t,s),no(s,e)},updateBoundsByBranchStack(t,e){let s,r;for(let i=t.length-1;i>-1;i--){s=t[i],r=s.children;for(let t=0,e=r.length;t<e;t++)ro(r[t]);e&&e===s||ro(s)}}},{pushAllChildBranch:oo,pushAllBranchStack:ao,updateBoundsByBranchStack:no}=io,ho={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},lo={getMoveEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,moveX:e.x,moveY:e.y}),getRotateEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,rotation:e}),getZoomEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,scale:e}),getDragEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:s.x,y:s.y,moveX:s.x-e.x,moveY:s.y-e.y,totalX:s.x-t.x,totalY:s.y-t.y}),getDropEventData:(t,e,s)=>Object.assign(Object.assign({},t),{list:e,data:s}),getSwipeDirection:t=>t<-45&&t>-135?exports.SwipeEvent.UP:t>45&&t<135?exports.SwipeEvent.DOWN:t<=45&&t>=-45?exports.SwipeEvent.RIGHT:exports.SwipeEvent.LEFT,getSwipeEventData:(t,e,s)=>Object.assign(Object.assign({},s),{moveX:e.moveX,moveY:e.moveY,totalX:s.x-t.x,totalY:s.y-t.y,type:co.getSwipeDirection(D.getAngle(t,s))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons,origin:t}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,r=s.length;t<r;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const s=new ft,{list:r}=t;for(let t=0,i=r.length;t<i;t++)r[t].hasEvent(e)&&s.add(r[t]);return s}},co=lo,uo=new ft,{getDragEventData:po,getDropEventData:go,getSwipeEventData:_o}=lo;class fo{constructor(t){this.interaction=t}setDragData(t){this.dragData=po(t,t,t)}getList(){const{proxy:t}=this.interaction.selector;return!this.dragging||t&&t.list.length?uo:exports.DragEvent.list||this.dragableList||uo}checkDrag(t,e){const{interaction:s}=this,{downData:r}=s;if(this.moving&&!wi.middle(t)&&!wi.left(t))return void s.pointerCancel();const{dragData:i}=this;this.moving||(this.moving=(wi.middle(t)||s.moveMode)&&e,this.moving&&s.emit(exports.MoveEvent.START,i)),this.moving||this.dragStart(t,e);const{path:o,throughPath:a}=r;this.dragData=po(r,i,t),a&&(this.dragData.throughPath=a),this.dragData.path=o,this.moving?(s.emit(exports.MoveEvent.BEFORE_MOVE,this.dragData),s.emit(exports.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.realDrag(),s.emit(exports.DragEvent.BEFORE_DRAG,this.dragData),s.emit(exports.DragEvent.DRAG,this.dragData))}dragStart(t,e){this.dragging||(this.dragging=wi.left(t)&&e,this.dragging&&(this.interaction.emit(exports.DragEvent.START,this.dragData),this.getDragableList(this.dragData.path)))}getDragableList(t){let e;for(let s=0,r=t.length;s<r;s++)if(e=t.list[s],(e.__.draggable||e.__.editable)&&e.__.hitSelf){this.dragableList=new ft(e);break}}realDrag(){const{running:t}=this.interaction,e=this.getList();if(e.length&&t){const{moveX:t,moveY:s}=this.dragData;e.forEach((e=>Gi.moveWorld(e,t,s)))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:r}=t;s?r.indexAt(0)!==s.indexAt(0)&&(e.emit(exports.DragEvent.OUT,t,s),e.emit(exports.DragEvent.OVER,t,r)):e.emit(exports.DragEvent.OVER,t,r),this.dragOverPath=r}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:r}=t;e.emit(exports.DragEvent.LEAVE,t,s,r),e.emit(exports.DragEvent.ENTER,t,r,s),this.dragEnterPath=r}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:r,throughPath:i}=s,o=po(s,t,t);i&&(o.throughPath=i),o.path=r,this.moving&&e.emit(exports.MoveEvent.END,o),this.dragging&&(e.emit(exports.DragEvent.END,o),this.swipe(t,o),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:r}=s;if(D.getDistance(r,t)>s.config.pointer.swipeDistance){const t=_o(r,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=go(t,this.getList(),exports.DragEvent.data);e.path=this.dragEnterPath,this.interaction.emit(exports.DropEvent.DROP,e),this.interaction.emit(exports.DragEvent.LEAVE,t,this.dragEnterPath)}dragReset(){exports.DragEvent.list=exports.DragEvent.data=this.dragableList=this.dragData=this.dragOverPath=this.dragEnterPath=null,this.dragging=this.moving=!1}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:s}=e,{autoDistance:r,dragOut:i}=e.config.move;if(!i||!r)return;const o=e.shrinkCanvasBounds,{x:a,y:n}=o,h=K.maxX(o),l=K.maxY(o),d=t.x<a?r:h<t.x?-r:0,c=t.y<n?r:l<t.y?-r:0;let u=0,p=0;this.autoMoveTimer=setInterval((()=>{u+=d,p+=c,D.move(s,d,c),D.move(this.dragData,d,c),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:c,totalX:u,totalY:p})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.dragReset()}}const mo=it.get("emit");const yo=["move","zoom","rotate","key"];function xo(t,e,s,r,i){if(yo.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!wo(t,i)){let o;for(let a=0,n=t.children.length;a<n;a++)o=t.children[a],!s.path.has(o)&&o.__.hittable&&vo(o,e,s,r,i)}}function vo(t,e,s,r,i){if(t.destroyed)return!0;if(t.__.hitSelf&&t.hasEvent(e,r)&&!wo(t,i)){s.phase=r?1:t===s.target?2:3;const i=pt.get(e,s);if(t.emitEvent(i,r),i.isStop)return!0}return!1}function wo(t,e){return e&&e.has(t)}const Eo={getData(t){const e=t[0],s=t[1],r=D.getCenter(e.from,s.from),i=D.getCenter(e.to,s.to),o={x:i.x-r.x,y:i.y-r.y},a=D.getDistance(e.from,s.from);return{move:o,scale:D.getDistance(e.to,s.to)/a,angle:D.getRotation(e.from,s.from,e.to,s.to),center:i}}},bo={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:"Windows"===t.os?{x:37.5,y:37.5}:{x:20,y:8},preventDefault:!0},pointer:{hitRadius:5,through:!1,tapTime:120,longPressTime:800,transformTime:500,dragHover:!0,dragDistance:2,swipeDistance:20,ignoreMove:!1},cursor:{}},{pathHasEventType:Po,getMoveEventData:To,getZoomEventData:Co,getRotateEventData:Oo}=lo;class ko{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}ko.custom={};const{toOuterOf:Bo,getPoints:Do}=K;class Ro{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}constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},t.__local&&(this.localRenderBounds=this.localStrokeBounds=t.__local),this.boxChange(),this.matrixChange()}update(){const{leafer:e}=this.leaf;if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=this.leaf;for(;e.parent&&!e.parent.leafer;)e=e.parent;t.layout(e)}}getTransform(t="world"){switch(this.update(),t){case"world":return this.leaf.__world;case"local":return this.leaf.__localMatrix;case"inner":return x.defaultMatrix;default:return new M(this.leaf.__world).divideParent(t.__world)}}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);default:return new Q(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"margin":case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":if(this.localRenderBounds)return this.localRenderBounds;case"stroke":if(this.localStrokeBounds)return this.localStrokeBounds;case"margin":case"content":case"box":return this.leaf.__localBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}}getLayoutBounds(t,e="world",s){const{leaf:r}=this;let i,o,a=this.getInnerBounds(t);switch(e){case"world":i=r.getWorldPoint(a),o=r.__world;break;case"local":i=r.getLocalPointByInner(a),o=r.__;break;case"inner":i=a,o=x.defaultWorld;break;default:i=r.getWorldPoint(a,e),o=r.__world}let{scaleX:n,scaleY:h,rotation:l,skewX:d,skewY:c}=o,{width:u,height:p}=a;if("object"==typeof e){const t=e.__world;n/=t.scaleX,h/=t.scaleY,l-=t.rotation,d-=t.skewX,c-=t.skewY}if(s){const t=n<0?-n:n,e=h<0?-h:h;n/=t,h/=e,u*=t,p*=e}return{x:i.x,y:i.y,scaleX:n,scaleY:h,rotation:l,skewX:d,skewY:c,width:u,height:p}}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=Do(this.getInnerBounds(t));let i;switch(e){case"world":i=null;break;case"local":i=s.parent;break;case"inner":break;default:i=e}return void 0!==i&&r.forEach((t=>s.innerToWorld(t,null,!1,i))),r}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),Bo(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Bo(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),Bo(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__localBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}spreadStroke(){const{x:t,y:e,width:s,height:r}=this.strokeBounds;this.strokeBounds={x:t,y:e,width:s,height:r},this.localStrokeBounds={x:t,y:e,width:s,height:r},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:r}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:r},this.localRenderBounds={x:t,y:e,width:s,height:r}}boxChange(){this.boxChanged=!0,this.localBoxChanged||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()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}const Lo={},Mo={on(t,e,s){let r,i,o;s&&("boolean"==typeof s?r=s:(r=s.capture,i=s.once));const a=So(this,r,!0),n="string"==typeof t?t.split(" "):t,h=i?{listener:e,once:i}:{listener:e};n.forEach((t=>{t&&(o=a[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):a[t]=[h])}))},off(t,e,s){let r,i,o;s&&(r="boolean"==typeof s?s:s.capture);const a=So(this,r);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(i=a[t],i&&(o=i.findIndex((t=>t.listener===e)),o>-1&&i.splice(o,1),i.length||delete a[t]))}))},on_(t,e,s,r){return s&&(e=e.bind(s)),this.on(t,e,r),{type:t,current:this,listener:e,options:r}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){!e&&pt.has(t)&&(e=pt.get(t,{type:t,target:this,current:this}));const r=So(this,s)[t];if(r){let i;for(let o=0,a=r.length;o<a&&(i=r[o],i.listener(e),i.once&&(this.off(t,i.listener,s),o--,a--),!e||!e.isStopNow);o++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:r}=this;return void 0===e?!!(r&&r[t]||s&&s[t]):!!(e?r&&r[t]:s&&s[t])}};function So(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Lo)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Lo)}}const Io={__setAttr(t,e){if(this.leafer&&this.leafer.created){const s=this.__.__getInput(t);if("object"==typeof e||s!==e){this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e);const{CHANGE:r}=ci,i=new ci(r,this,t,s,e);this.hasEvent(r)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}}else this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e)},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Ao,multiplyParent:Wo,translateInner:No,defaultWorld:Xo}=x,{toPoint:Yo,tempPoint:Fo}=et,zo={__updateWorldMatrix(){Wo(this.__local||this.__layout,this.parent?this.parent.__world:Xo,this.__world,!!this.__layout.affectScaleOrRotation,this.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged||t.rotationChanged)&&(Ao(e,s,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x,e.f=s.y,s.around&&(Yo(s.around,t.boxBounds,Fo),No(e,-Fo.x,-Fo.y))}this.__layout.matrixChanged=!1}},{updateMatrix:jo,updateAllMatrix:Ho,hasParentAutoLayout:Uo}=Gi,{updateBounds:Vo}=io,{toOuterOf:Ko,copyAndSpread:Go}=K,Zo={__updateWorldBounds(){Ko(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.boxChanged=!1,t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),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=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasAutoLayout&&this.__updateAutoLayout(),Ko(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ko(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ko(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,{width:e,height:s}=this.__;t.x=0,t.y=0,t.width=e,t.height=s},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.leafer&&this.leafer.layouter.addExtra(this),Uo(this)?jo(this):(Ho(this),Vo(this,this))):jo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){Go(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){Go(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:qo,copy:Qo,setRadius:Jo}=D,$o={},ta={__hitWorld(t){return!this.__layout.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),this.__.hitRadius&&(Qo($o,t),Jo(t=$o,this.__.hitRadius)),qo(t,this.__world,$o),!(!this.__.hitBox||!K.hitRadiusPoint(this.__layout.boxBounds,$o))||this.__hit($o)},__drawHitPath(t){this.__drawRenderPath(t)}},ea={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__.__single){const s=t.getSameCanvas(!0,!0);this.__draw(s,e);const r=this.__.isEraser?"destination-out":this.__.blendMode;this.__worldFlipped||e.matrix?t.copyWorldByReset(s,null,null,r):t.copyWorldToInner(s,this.__world,this.__layout.renderBounds,r),s.recycle()}else this.__draw(t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},sa={__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.isEraser))},__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s,r){e.opacity=1,e.resetTransform(),e.useMask(s),t.opacity=this.__worldOpacity,t.resetTransform(),t.copyWorld(e),r?(e.recycle(),s.recycle()):(e.clear(),s.clear())},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,r=e.length;s<r;s++)(t=e[s]).isMask&&(this.__removeMask(t),r--,s--)}}},ra={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){t.resetTransform();const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e),t.opacity=this.__worldOpacity;const r=this.__.isEraser?"destination-out":this.__.blendMode;this.__worldFlipped||e.matrix?t.copyWorld(s,null,null,r):t.copyWorld(s,this.__world,this.__world,r),s.recycle()}else this.__renderBranch(t,e)},__renderBranch(t,e){let s;const{children:r}=this;if(this.__hasMask&&r.length>1){let i;const o=t.getSameCanvas(!1,!0),a=t.getSameCanvas(!1,!0);for(let n=0,h=r.length;n<h;n++)s=r[n],s.isMask?(i?this.__renderMask(t,a,o):i=!0,s.__render(o,e)):s.__render(i?a:t,e);this.__renderMask(t,a,o,!0)}else{const{bounds:i,hideBounds:o}=e;for(let a=0,n=r.length;a<n;a++)s=r[a],i&&!i.hit(s.__world,e.matrix)||o&&o.includes(s.__world,e.matrix)||s.__render(t,e)}}},{LEAF:ia,create:oa}=s,{toInnerPoint:aa,toOuterPoint:na}=x,{tempToOuterOf:ha,copy:la}=D,{moveLocal:da,zoomOfLocal:ca,rotateOfLocal:ua,skewOfLocal:pa,transform:ga,setTransform:_a,drop:fa}=Gi;exports.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 xt}get __LayoutProcessor(){return Ro}get __localMatrix(){return this.__local||this.__layout}get __localBounds(){return this.__local||this.__}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get boxBounds(){return this.getBounds("box","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.update(),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}constructor(t){this.innerId=oa(ia),this.reset(t)}reset(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,rotation:0,skewX:0,skewY:0},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.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t){this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}nextRender(t){this.leafer?this.leafer.nextRender(t):this.waitLeafer((()=>this.leafer.nextRender(t)))}__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.__leaferWait&&ho.run(this.__leaferWait)),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t){}get(){}toJSON(){return this.__.__getInputData()}toString(){return JSON.stringify(this.toJSON())}__setAttr(t,e){}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findOne(t,e){}forceUpdate(t){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===e?null:void 0,this[t]=e}updateLayout(){this.__layout.update()}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){}__updateMask(t){}__renderMask(t,e,s,r){}__removeMask(t){}getWorld(t){return this.__layout.update(),"x"===t?this.__world.e:"y"===t?this.__world.f:this.__world[t]}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&la(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&la(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),aa(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){na(this.worldTransform,t,e,s),r&&r.worldToInner(e||t,null,s)}getInnerPoint(t,e,s,r){const i=r?t:{};return this.worldToInner(t,i,s,e),i}getInnerPointByLocal(t,e,s,r){return this.getInnerPoint(t,this.parent,s,r)}getLocalPoint(t,e,s,r){const i=r?t:{};return this.worldToLocal(t,i,s,e),i}getLocalPointByInner(t,e,s,r){return this.getWorldPoint(t,this.parent,s,r)}getWorldPoint(t,e,s,r){const i=r?t:{};return this.innerToWorld(t,i,s,e),i}getWorldPointByLocal(t,e,s,r){const i=r?t:{};return this.localToWorld(t,i,s,e),i}setTransform(t,e){_a(this,t,e)}transform(t,e){ga(this,t,e)}move(t,e){da(this,t,e)}scaleOf(t,e,s,r){ca(this,ha(t,this.localTransform),e,s,r)}rotateOf(t,e){ua(this,ha(t,this.localTransform),e)}skewOf(t,e,s,r){pa(this,ha(t,this.localTransform),e,s,r)}scaleResize(t,e=t,s){const r=this;s?(r.scaleX*=t,r.scaleY*=e):(t<0&&(r.scaleX*=-1,t=-t),e<0&&(r.scaleY*=-1,e=-e),this.__scaleResize(t,e))}__scaleResize(t,e){1!==t&&(this.width*=t),1!==e&&(this.height*=e)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){fa(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,r){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e){Di(this.prototype,t,e)}static addAttr(t,e,s){s||(s=Ci),s(e)(this.prototype,t)}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.removeAll(!0),this.__.destroy(),this.__layout.destroy(),this.__captureMap=this.__bubbleMap=this.__parentWait=this.__leaferWait=null,this.destroyed=!0)}},exports.Leaf=wt([Ii(Io),Ii(zo),Ii(Zo),Ii(ta),Ii(Mo),Ii(ea)],exports.Leaf);const{setListWithFn:ma}=K,{sort:ya}=io,{localBoxBounds:xa,localStrokeBounds:va,localRenderBounds:wa,maskLocalBoxBounds:Ea,maskLocalStrokeBounds:ba,maskLocalRenderBounds:Pa}=so;exports.Branch=class extends exports.Leaf{constructor(){super(),this.isBranch=!0,this.children=[]}__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){ma(this.__layout.boxBounds,this.children,this.__hasMask?Ea:xa)}__updateStrokeBounds(){ma(this.__layout.strokeBounds,this.children,this.__hasMask?ba:va)}__updateRenderBounds(){ma(this.__layout.renderBounds,this.children,this.__hasMask?Pa:wa)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,r=e.length;s<r;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(ya),this.__layout.affectChildrenSort=t}}add(t,e){t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.matrixChange(),t.__parentWait&&ho.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(di.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){t.forEach((t=>this.add(t)))}remove(t,e){if(t){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}else void 0===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()})))}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(di.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new di(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},exports.Branch=wt([Ii(ra),Ii(sa)],exports.Branch);const Ta=it.get("plugin"),Ca={power:{},list:[],onLeafer(t){Ca.list.forEach((e=>{e.onLeafer&&e.onLeafer(t)}))}};exports.AnimateEvent=fi,exports.AroundHelper=et,exports.AutoBounds=class{constructor(t,e,s,r,i,o){"object"==typeof t?this.copy(t):this.set(t,e,s,r,i,o)}set(t=0,e=0,s=0,r=0,i=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=r,this.width=i,this.height=o}copy(t){const{top:e,right:s,bottom:r,left:i,width:o,height:a}=t;this.set(e,s,r,i,o,a)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:o,height:a}=this;return new Q(i,e,o||t.width-i-s,a||t.height-e-r)}},exports.BezierHelper=oe,exports.Bounds=Q,exports.BoundsHelper=K,exports.BranchHelper=io,exports.BranchRender=ra,exports.CanvasManager=_t,exports.ChildEvent=di,exports.Creator=e,exports.Cursor=ko,exports.DataHelper=mt,exports.Debug=it,exports.EllipseHelper=ge,exports.Event=li,exports.EventCreator=pt,exports.FileHelper=vt,exports.HitCanvasManager=class extends _t{constructor(){super(...arguments),this.pathTypeList=new ft,this.imageTypeList=new ft}getImageType(t,s){return this.imageTypeList.add(t),e.hitCanvas(s)}getPathType(t){return this.pathTypeList.add(t),e.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.length&&(t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset())}clear(){this.clearPathType(),this.clearImageType()}},exports.ImageEvent=ui,exports.ImageManager=oi,exports.IncrementId=s,exports.InteractionBase=class{get dragging(){return this.dragger.dragging}get isDragEmpty(){return this.config.move.dragEmpty&&this.hoverData&&this.hoverData.path.list[0].isLeafer&&(!this.downData||this.downData.path.list[0].isLeafer)}get moveMode(){return this.config.move.drag||this.config.move.holdSpaceKey&&vi.isHoldSpaceKey()||this.downData&&wi.middle(this.downData)||this.isDragEmpty}get hitRadius(){return this.config.pointer.hitRadius}constructor(t,e,s,r){this.config=bo,this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=s,this.defaultPath=new ft(t),this.transformer=new Ni(this),this.dragger=new fo(this),r&&(this.config=mt.default(r,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(wi.defaultLeft(t),this.updateDownData(t),e&&(t.path=this.defaultPath),this.emit(exports.PointerEvent.BEFORE_DOWN,t),this.emit(exports.PointerEvent.DOWN,t),this.downTime=Date.now(),this.dragger.setDragData(t),wi.left(t)&&(this.tapWait(),this.longPressWait(t)),this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;this.downData&&wi.defaultLeft(t);const e=this.canvas.bounds.hitPoint(t);(e||this.downData)&&(e&&!this.downData&&wi.left(t)&&this.pointerDown(t,!0),this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(exports.PointerEvent.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=D.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),wi.right(this.downData)||this.dragger.checkDrag(t,e)}this.dragger.moving||this.config.pointer.ignoreMove||(this.updateHoverData(t),this.emit(exports.PointerEvent.MOVE,t),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t)),this.updateCursor(t))}pointerUp(t){t||(t=this.downData),this.downData&&(wi.defaultLeft(t),this.findPath(t),this.emit(exports.PointerEvent.BEFORE_UP,t),this.emit(exports.PointerEvent.UP,t),this.emit(exports.PointerEvent.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.dragger.dragEnd(t),this.downData=null,this.updateCursor(t))}pointerCancel(){this.pointerUp(this.dragger.dragData)}multiTouch(t,e){const{move:s,angle:r,scale:i,center:o}=Eo.getData(e);this.rotate(Oo(o,r,t)),this.zoom(Co(o,i,t)),this.move(To(o,s,t))}menu(t){this.findPath(t),this.emit(exports.PointerEvent.MENU,t)}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}keyDown(t){const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,vi.setDownCode(e),this.emit(exports.KeyEvent.HOLD,t,this.defaultPath),this.moveMode&&this.updateCursor()),this.emit(exports.KeyEvent.DOWN,t,this.defaultPath)}keyUp(t){const{code:e}=t;this.downKeyMap[e]=!1,vi.setUpCode(e),this.emit(exports.KeyEvent.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerOverOrOut(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.overPath?e.indexAt(0)!==this.overPath.indexAt(0)&&(this.emit(exports.PointerEvent.OUT,t,this.overPath),this.emit(exports.PointerEvent.OVER,t,e)):this.emit(exports.PointerEvent.OVER,t,e),this.overPath=e}pointerEnterOrLeave(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.emit(exports.PointerEvent.LEAVE,t,this.enterPath,e),this.emit(exports.PointerEvent.ENTER,t,e,this.enterPath),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(exports.PointerEvent.LEAVE,t),this.dragger.dragging&&this.emit(exports.DropEvent.LEAVE,t))}tap(t){const{pointer:e}=this.config,s=this.longTap(t);if(!e.tapMore&&s)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const r=Date.now()-this.downTime,i=[exports.PointerEvent.DOUBLE_TAP,exports.PointerEvent.DOUBLE_CLICK].some((e=>Po(t.path,e)));r<e.tapTime+50&&i?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:s,through:r}=this.config.pointer,i=this.selector.getByPoint(t,s,e||{through:r});return i.throughPath&&(t.throughPath=i.throughPath),t.path=i.path,i.path}isDrag(t){return this.dragger.getList().has(t)}updateDownData(t){t||(t=this.downData),t&&(this.findPath(t),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(),name:exports.PointerEvent.MOVE}),this.hoverData=t)}updateCursor(t){if(this.config.cursor.stop)return;if(t||(this.updateHoverData(),t=this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.moveMode)return this.setCursor(this.downData?"grabbing":"grab");if(!t||this.dragger.dragging)return;let e,s;const{path:r}=t;for(let t=0,i=r.length;t<i&&(e=r.list[t],s=e.cursor,!s);t++);this.setCursor(s)}setCursor(t){this.cursor=t,this.canvas.setCursor(t)}emitTap(t){this.emit(exports.PointerEvent.TAP,t),this.emit(exports.PointerEvent.CLICK,t)}emitDoubleTap(t){this.emit(exports.PointerEvent.DOUBLE_TAP,t),this.emit(exports.PointerEvent.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(exports.PointerEvent.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(exports.PointerEvent.LONG_TAP,t),Po(t.path,exports.PointerEvent.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new Q(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(pi.RESIZE,this.__onResize,this)],t.once(yi.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,s,r){this.running&&function(t,e,s,r){if(!s&&!e.path)return;let i;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);try{for(let o=s.length-1;o>-1;o--){if(i=s.list[o],vo(i,t,e,!0,r))return;i.isApp&&xo(i,t,e,!0,r)}for(let o=0,a=s.length;o<a;o++)if(i=s.list[o],i.isApp&&xo(i,t,e,!1,r),vo(i,t,e,!1,r))return}catch(t){mo.error(t)}}(t,e,s,r)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}},exports.InteractionHelper=lo,exports.Keyboard=vi,exports.LayoutEvent=_i,exports.LeafBounds=Zo,exports.LeafBoundsHelper=so,exports.LeafData=xt,exports.LeafDataProxy=Io,exports.LeafEventer=Mo,exports.LeafHelper=Gi,exports.LeafHit=ta,exports.LeafLayout=Ro,exports.LeafLevelList=class{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===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:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,r=e.length;s<r;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}},exports.LeafList=ft,exports.LeafMask=sa,exports.LeafMatrix=zo,exports.LeafRender=ea,exports.LeaferCanvasBase=class extends Ot{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView}constructor(e,r){super(),this.worldTransform={},e||(e=Bt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=r,this.innerId=s.create(s.CNAVAS);const{width:i,height:o,pixelRatio:a}=e;this.autoLayout=!i||!o,this.pixelRatio=a,this.config=e,this.init()}init(){}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}toBlob(e,s){return new Promise((r=>{const i=this.getSaveCanvas(e);t.origin.canvasToBolb(i.view,e,s).then((t=>{i.recycle(),r(t)})).catch((t=>{Dt.error(t),r(null)}))}))}toDataURL(e,s){const r=this.getSaveCanvas(e),i=t.origin.canvasToDataURL(r.view,e,s);return r.recycle(),i}saveAs(e,s){return new Promise((r=>{const i=this.getSaveCanvas(vt.fileType(e));t.origin.canvasSaveAs(i.view,e,s).then((()=>{i.recycle(),r(!0)})).catch((t=>{Dt.error(t),r(!1)}))}))}getSaveCanvas(t){const{backgroundColor:e,bounds:s}=this,r=this.getSameCanvas();return["jpg","jpeg"].includes(t)&&r.fillWorld(s,"#FFFFFF"),e&&r.fillWorld(s,e),r.copyWorld(this),r}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),mt.copyAttrs(this,t,Rt),this.bounds=new Q(0,0,this.width,this.height),this.pixelRatio||(this.pixelRatio=1),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}updateClientBounds(){}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e,s){const{pixelRatio:r}=this,i=this.worldTransform;if(e)if(s)this.setTransform(i.a=t.a*r,i.b=t.b*r,i.c=t.c*r,i.d=t.d*r,i.e=(t.e+e.e)*r,i.f=(t.f+e.f)*r);else{const{a:s,b:o,c:a,d:n,e:h,f:l}=e;this.setTransform(i.a=(t.a*s+t.b*a)*r,i.b=(t.a*o+t.b*n)*r,i.c=(t.c*s+t.d*a)*r,i.d=(t.c*o+t.d*n)*r,i.e=(t.e*s+t.f*a+h)*r,i.f=(t.e*o+t.f*n+l)*r)}else this.setTransform(i.a=t.a*r,i.b=t.b*r,i.c=t.c*r,i.d=t.d*r,i.e=t.e*r,i.f=t.f*r)}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,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap=t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}setWorldShadow(t,e,s,r){const{pixelRatio:i}=this;this.shadowOffsetX=t*i,this.shadowOffsetY=e*i,this.shadowBlur=s*i,this.shadowColor=r||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,r){if(r&&(this.blendMode=r),e){const{pixelRatio:r}=this;s||(s=e),this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x*r,s.y*r,s.width*r,s.height*r)}else this.drawImage(t.view,0,0);r&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,r){if(r&&(this.blendMode=r),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,K.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:r}=this;this.drawImage(t.view,e.x*r,e.y*r,e.width*r,e.height*r,s.x,s.y,s.width,s.height)}r&&(this.blendMode="source-over")}copyWorldByReset(t,e,s,r){this.resetTransform(),this.copyWorld(t,e,s,r),this.useWorldTransform()}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,kt.set(t).scale(this.pixelRatio),this.fillRect(kt.x,kt.y,kt.width,kt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,kt.set(t).scale(this.pixelRatio),this.strokeRect(kt.x,kt.y,kt.width,kt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){kt.set(t).scale(this.pixelRatio),e&&kt.ceil(),this.clearRect(kt.x,kt.y,kt.width,kt.height)}clipWorld(t,e){this.beginPath(),kt.set(t).scale(this.pixelRatio),e&&kt.ceil(),this.rect(kt.x,kt.y,kt.width,kt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t,s){const{width:r,height:i,pixelRatio:o}=this,a={width:r,height:i,pixelRatio:o},n=this.manager?this.manager.get(a):e.canvas(a);return n.save(),t&&n.useWorldTransform(Object.assign({},this.worldTransform)),s&&(n.smooth=this.smooth),n}getBiggerCanvas(t,s){let{width:r,height:i,pixelRatio:o}=this;t&&(r+=t),s&&(i+=s);const a={width:r,height:i,pixelRatio:o},n=this.manager?this.manager.get(a):e.canvas(a);return n.save(),n}recycle(){this.recycled||(this.restore(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}},exports.LeaferEvent=yi,exports.LeaferImage=class{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=hi(ni),this.config=t||{url:""},this.isSVG=oi.isFormat("svg",t)}load(e,s){return this.loading||(this.loading=!0,oi.tasker.add((()=>Et(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(e,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}onComplete(t){let e;this.waitComplete.forEach(((s,r)=>{e=r%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(e,s,r,i){e||(e=this.width),s||(s=this.height);const o=t.origin.createCanvas(e,s),a=o.getContext("2d");return r&&(a.globalAlpha=r),a.drawImage(this.view,0,0,e,s),o}destroy(){this.config={url:""},this.waitComplete.length=0}},exports.MathHelper=n,exports.Matrix=M,exports.MatrixHelper=x,exports.MultiTouchHelper=Eo,exports.NeedConvertToCanvasCommandMap=At,exports.OneRadian=h,exports.PI2=l,exports.PI_2=d,exports.PathBounds=Vr,exports.PathCommandDataHelper=ws,exports.PathCommandMap=St,exports.PathConvert=Je,exports.PathCorner=ti,exports.PathCreator=Ns,exports.PathDrawer=$s,exports.PathHelper=Lt,exports.PathNumberCommandLengthMap=Yt,exports.PathNumberCommandMap=Xt,exports.PathScaler=pr,exports.Platform=t,exports.PluginManager=Ca,exports.Point=L,exports.PointHelper=D,exports.PointerButton=wi,exports.PropertyEvent=ci,exports.RectHelper=Ft,exports.RenderEvent=mi,exports.ResizeEvent=pi,exports.Run=nt,exports.StringNumberMap=rt,exports.TaskItem=ri,exports.TaskProcessor=ii,exports.TwoPointBoundsHelper=S,exports.UICreator=dt,exports.UIEvent=Ei,exports.WaitHelper=ho,exports.WatchEvent=gi,exports.affectRenderBoundsType=function(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}},exports.affectStrokeBoundsType=ki,exports.autoLayoutType=function(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.matrixChanged||this.__layout.matrixChange(),this.__hasAutoLayout=!!t}})}},exports.boundsType=Ci,exports.canvasPatch=function(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){ei(this,t,e,s,r,i)})}(t)},exports.canvasSizeAttrs=Rt,exports.cursorType=function(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),this.leafer&&this.leafer.updateCursor()}})}},exports.dataProcessor=function(t){return(e,s)=>{bi(e,"__DataProcessor",{get:()=>t})}},exports.dataType=function(t){return(e,s)=>{Ti(e,s,t)}},exports.defineDataProcessor=Di,exports.defineKey=bi,exports.defineLeafAttr=Ti,exports.eraserType=function(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}},exports.getDescriptor=Pi,exports.hitType=function(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),it.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor()}})}},exports.layoutProcessor=function(t){return(e,s)=>{bi(e,"__LayoutProcessor",{get:()=>t})}},exports.maskType=function(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}},exports.opacityType=function(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}},exports.pathType=Oi,exports.positionType=function(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.matrixChanged||this.__layout.matrixChange()}})}},exports.registerUI=function(){return t=>{dt.register(t)}},exports.registerUIEvent=Ai,exports.rewrite=function(t){return(e,s)=>{Li.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}},exports.rewriteAble=function(){return t=>{Si()}},exports.rotationType=function(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}},exports.scaleType=function(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}},exports.sortType=function(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()}))}})}},exports.strokeType=Bi,exports.surfaceType=function(t){return(e,s)=>{Ti(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}},exports.useModule=Ii,exports.usePlugin=function(t,e){const s={},{power:r,list:i}=Ca;if(r||Ta.error("need add PluginManager.power = LeaferUI"),i.includes(t))Ta.warn("repeat run",t.name);else{i.push(t),t.import?t.import.forEach((t=>{r[t]?s[t]=r[t]:Ta.error(t+" non-existent")})):Ta.warn("no import");try{t.run(s,e)}catch(t){Ta.error(t)}}};