@leafer/core 1.5.2 → 1.6.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.
- package/lib/core.cjs +90 -36
- package/lib/core.cjs.map +1 -1
- package/lib/core.esm.js +90 -36
- package/lib/core.esm.js.map +1 -1
- package/lib/core.esm.min.js +1 -1
- package/lib/core.esm.min.js.map +1 -1
- package/lib/core.min.cjs +1 -1
- package/lib/core.min.cjs.map +1 -1
- package/package.json +17 -17
- package/src/index.ts +1 -1
- package/types/index.d.ts +1 -1
package/lib/core.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const t={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(e){const{prefix:s,suffix:r}=t.image;return!r||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+r),s&&"/"===e[0]&&(e=s+e),e}}},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:n}=Math,a={within:(t,e,s)=>("object"==typeof e&&(s=e.max,e=e.min),void 0!==e&&t<e&&(t=e),void 0!==s&&t>s&&(t=s),t),fourNumber(t,e){let s;if(t instanceof Array)switch(t.length){case 4:s=void 0===e?t:[...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)),a.float(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=void 0!==e?o(10,e):1e12;return-0===(t=i(t*s)/s)?0:t},getScaleData(t,e,s,r){if(r||(r={}),e){const t=("number"==typeof e?e:e.width||0)/s.width,i=("number"==typeof e?e:e.height||0)/s.height;r.scaleX=t||i||1,r.scaleY=i||t||1}else t&&a.assignScale(r,t);return r},assignScale(t,e){"number"==typeof e?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)}},h=n/180,l=2*n,d=n/2;function u(){return{x:0,y:0}}function c(){return{x:0,y:0,width:0,height:0}}function p(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:_,cos:f,acos:g,sqrt:y}=Math,{float:x}=a,m={};function w(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const b={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:w(),tempMatrix:{},set(t,e=1,s=0,r=0,i=1,o=0,n=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=o,t.f=n},get:p,getWorld:w,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,r){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,r&&(t.e-=e,t.f-=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,m),v.scaleOfInner(t,m,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,n=f(e*=h),a=_(e);t.a=s*n-r*a,t.b=s*a+r*n,t.c=i*n-o*a,t.d=i*a+o*n},rotateOfOuter(t,e,s){v.toInnerPoint(t,e,m),v.rotateOfInner(t,m,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:n}=t;s&&(s*=h,t.a=r+o*s,t.b=i+n*s),e&&(e*=h,t.c=o+r*e,t.d=n+i*e)},skewOfOuter(t,e,s,r){v.toInnerPoint(t,e,m),v.skewOfInner(t,m,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:n,f:a}=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+n,t.f=e.e*r+e.f*o+a},multiplyParent(t,e,s,r,i,o){let{e:n,f:a}=t;if(o&&(n+=o.scrollX,a+=o.scrollY),s||(s=t),void 0===r&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:r,b:o,c:n,d:a}=t;s.a=r*e.a+o*e.c,s.b=r*e.b+o*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,i&&(s.scaleX=e.scaleX*i.scaleX,s.scaleY=e.scaleY*i.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,i&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},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:n}=t;if(s||r){const a=1/(e*i-s*r);t.a=i*a,t.b=-s*a,t.c=-r*a,t.d=e*a,t.e=-(o*i-n*r)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===i)t.e=-o,t.f=-n;else{const s=1/(e*i);t.a=i*s,t.d=e*s,t.e=-o*i*s,t.f=-n*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:n,d:a}=t,h=1/(i*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*i-l*o)*h,!r){const{e:e,f:r}=t;s.x-=(e*a-r*n)*h,s.y-=(r*i-e*o)*h}},setLayout(t,e,s,r,i){const{x:o,y:n,scaleX:a,scaleY:l}=e;if(void 0===i&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:r,skewY:i}=e,o=s*h,n=f(o),d=_(o);if(r||i){const e=r*h,s=i*h;t.a=(n+s*-d)*a,t.b=(d+s*n)*a,t.c=(e*n-d)*l,t.d=(n+e*d)*l}else t.a=n*a,t.b=d*a,t.c=-d*l,t.d=n*l}else t.a=a,t.b=0,t.c=0,t.d=l;t.e=o,t.f=n,(s=s||r)&&v.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,r){const{a:i,b:o,c:n,d:a,e:l,f:u}=t;let c,p,m,w,b,v=l,B=u;if(o||n){const t=i*a-o*n;if(n&&!r){c=y(i*i+o*o),p=t/c;const e=i/c;m=o>0?g(e):-g(e)}else{p=y(n*n+a*a),c=t/p;const e=n/p;m=d-(a>0?g(-e):-g(e))}const e=x(f(m)),s=_(m);c=x(c),p=x(p),w=e?x((n/p+s)/e/h,9):0,b=e?x((o/c-s)/e/h,9):0,m=x(m/h)}else c=i,p=a,m=w=b=0;return(e=s||e)&&(v+=e.x*i+e.y*n,B+=e.x*o+e.y*a,s||(v-=e.x,B-=e.y)),{x:v,y:B,scaleX:c,scaleY:p,rotation:m,skewX:w,skewY:b}},withScale(t,e,s=e){const r=t;if(!e||!s){const{a:r,b:i,c:o,d:n}=t;i||o?s=(r*n-i*o)/(e=y(r*r+i*i)):(e=r,s=n)}return r.scaleX=e,r.scaleY=s,r},reset(t){v.set(t)}},v=b,{toInnerPoint:B,toOuterPoint:k}=b,{sin:C,cos:T,abs:O,sqrt:P,atan2:L,min:R,PI:S}=Math,I={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},copyFrom(t,e,s){t.x=e,t.y=s},move(t,e,s){t.x+=e,t.y+=s},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,r=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(r-1)},rotate(t,e,s){s||(s=E.defaultPoint);const r=T(e*=h),i=C(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*r-n*i,t.y=s.y+o*i+n*r},tempToInnerOf(t,e){const{tempPoint:s}=E;return A(s,t),B(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=E;return A(s,t),k(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=E;return A(s,t),E.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),B(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){B(e,t,s)},toOuterOf(t,e,s){k(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)=>M(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=O(s-t),o=O(r-e);return P(i*i+o*o)},getMinDistanceFrom:(t,e,s,r,i,o)=>R(M(t,e,s,r),M(s,r,i,o)),getAngle:(t,e)=>W(t,e)/h,getRotation:(t,e,s,r)=>(r||(r=e),E.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,n,a){void 0===n&&(n=s,a=r);let h=L(e-r,t-s);const d=L(o-a,i-n)-h;return d<-S?d+l:d},getAtan2:(t,e)=>L(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r){const i=W(t,e);return(e=r?e:{}).x=t.x+T(i)*s,e.y=t.y+C(i)*s,e},toNumberPoints(t){let e=t;return"object"==typeof t[0]&&(e=[],t.forEach((t=>e.push(t.x,t.y)))),e},reset(t){E.reset(t)}},E=I,{getDistanceFrom:M,copy:A,getAtan2:W}=E;class D{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?I.copy(this,t):I.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new D(this)}move(t,e){return I.move(this,t,e),this}scale(t,e){return I.scale(this,t,e),this}scaleOf(t,e,s){return I.scaleOf(this,t,e,s),this}rotate(t,e){return I.rotate(this,t,e),this}rotateOf(t,e){return I.rotate(this,e,t),this}getRotation(t,e,s){return I.getRotation(this,t,e,s)}toInnerOf(t,e){return I.toInnerOf(this,t,e),this}toOuterOf(t,e){return I.toOuterOf(this,t,e),this}getCenter(t){return new D(I.getCenter(this,t))}getDistance(t){return I.getDistance(this,t)}getDistancePoint(t,e,s){return new D(I.getDistancePoint(this,t,e,s))}getAngle(t){return I.getAngle(this,t)}getAtan2(t){return I.getAtan2(this,t)}reset(){return I.reset(this),this}}const N=new D;class Y{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?b.copy(this,t):b.set(this,t,e,s,r,i,o),this}setWith(t){return b.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,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 Y(this)}translate(t,e){return b.translate(this,t,e),this}translateInner(t,e){return b.translateInner(this,t,e),this}scale(t,e){return b.scale(this,t,e),this}scaleWith(t,e){return b.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return b.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return b.scaleOfInner(this,t,e,s),this}rotate(t){return b.rotate(this,t),this}rotateOfOuter(t,e){return b.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return b.rotateOfInner(this,t,e),this}skew(t,e){return b.skew(this,t,e),this}skewOfOuter(t,e,s){return b.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return b.skewOfInner(this,t,e,s),this}multiply(t){return b.multiply(this,t),this}multiplyParent(t){return b.multiplyParent(this,t),this}divide(t){return b.divide(this,t),this}divideParent(t){return b.divideParent(this,t),this}invert(){return b.invert(this),this}invertWith(){return b.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){b.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){b.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return b.setLayout(this,t,e,s),this}getLayout(t,e,s){return b.getLayout(this,t,e,s)}withScale(t,e){return b.withScale(this,t,e)}reset(){b.reset(this)}}const X=new Y,z={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){F(t,e,s),F(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:F}=z,{tempPointBounds:j,setPoint:H,addPoint:U,toBounds:G}=z,{toOuterPoint:V}=b,{float:q,fourNumber:Q}=a,{floor:J,ceil:Z}=Math;let $,K,tt,et;const st={},rt={},it={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,i){const{x:o,y:n,width:a,height:h}=e;if(s instanceof Array){const e=Q(s);r?ot.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):ot.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else r&&(s=-s),ot.set(t,o-s,n-s,a+2*s,h+2*s);i&&("width"===i?(t.y=n,t.height=h):(t.x=o,t.width=a))},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),ot.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?at(e,t):e=t,s?(e.offsetX=-(ot.maxX(s)-t.x),e.offsetY=-(ot.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),ot.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){I.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){I.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(ot.copy(ot.tempBounds,t),ot.toOuterOf(ot.tempBounds,e),ot.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),ot.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 st.x=t.x,st.y=t.y,V(e,st,rt),H(j,rt.x,rt.y),st.x=t.x+t.width,V(e,st,rt),U(j,rt.x,rt.y),st.y=t.y+t.height,V(e,st,rt),U(j,rt.x,rt.y),st.x=t.x,V(e,st,rt),U(j,rt.x,rt.y),G(j,s)},toInnerOf(t,e,s){s||(s=t),ot.move(s,-e.e,-e.f),ot.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,Math.min(t.width/e.width,t.height/e.height));return new Y(r,0,0,r,-e.x*r,-e.y*r)},getSpread(t,e,s){const r={};return ot.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){ot.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){ot.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=J(t.x),t.y=J(t.y),t.width=e>t.x?Z(t.width+e-t.x):Z(t.width),t.height=s>t.y?Z(t.height+s-t.y):Z(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=q(t.x,e),t.y=q(t.y,e),t.width=q(t.width,e),t.height=q(t.height,e)},add(t,e,s){$=t.x+t.width,K=t.y+t.height,tt=e.x,et=e.y,s||(tt+=e.width,et+=e.height),$=$>tt?$:tt,K=K>et?K:et,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=$-t.x,t.height=K-t.y},addList(t,e){ot.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){ot.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){ot.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,r=!1){let i,o=!0;for(let n=0,a=e.length;n<a;n++)i=s?s(e[n]):e[n],i&&(i.width||i.height)&&(o?(o=!1,r||at(t,i)):nt(t,i));o&&ot.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?H(j,t.x,t.y):U(j,t.x,t.y))),G(j,t)},setPoint(t,e){ot.set(t,e.x,e.y)},addPoint(t,e){nt(t,e,!0)},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=I.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=I.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=ot.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=ot.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){if(s&&(e=ot.tempToOuterOf(e,s)),!ot.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:o,height:n}=e;return $=r+o,K=i+n,tt=t.x+t.width,et=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,$=$<tt?$:tt,K=K<et?K:et,o=$-r,n=K-i,{x:r,y:i,width:o,height:n}},intersect(t,e,s){ot.copy(t,ot.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){ot.set(t)}},ot=it,{add:nt,copy:at}=ot;class ht{get minX(){return it.minX(this)}get minY(){return it.minY(this)}get maxX(){return it.maxX(this)}get maxY(){return it.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?it.copy(this,t):it.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 ht(this)}move(t,e){return it.move(this,t,e),this}scale(t,e){return it.scale(this,t,e),this}scaleOf(t,e,s){return it.scaleOf(this,t,e,s),this}toOuterOf(t,e){return it.toOuterOf(this,t,e),this}toInnerOf(t,e){return it.toInnerOf(this,t,e),this}getFitMatrix(t,e){return it.getFitMatrix(this,t,e)}spread(t,e){return it.spread(this,t,e),this}shrink(t,e){return it.shrink(this,t,e),this}ceil(){return it.ceil(this),this}unsign(){return it.unsign(this),this}float(t){return it.float(this,t),this}add(t){return it.add(this,t),this}addList(t){return it.setList(this,t,!0),this}setList(t){return it.setList(this,t),this}addListWithFn(t,e){return it.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return it.setListWithFn(this,t,e),this}setPoint(t){return it.setPoint(this,t),this}setPoints(t){return it.setPoints(this,t),this}addPoint(t){return it.addPoint(this,t),this}getPoints(){return it.getPoints(this)}hitPoint(t,e){return it.hitPoint(this,t,e)}hitRadiusPoint(t,e){return it.hitRadiusPoint(this,t,e)}hit(t,e){return it.hit(this,t,e)}includes(t,e){return it.includes(this,t,e)}intersect(t,e){return it.intersect(this,t,e),this}getIntersect(t,e){return new ht(it.getIntersectData(this,t,e))}isSame(t){return it.isSame(this,t)}isEmpty(){return it.isEmpty(this)}reset(){it.reset(this)}}const lt=new ht;var dt,ut;exports.Direction4=void 0,(dt=exports.Direction4||(exports.Direction4={}))[dt.top=0]="top",dt[dt.right=1]="right",dt[dt.bottom=2]="bottom",dt[dt.left=3]="left",exports.Direction9=void 0,(ut=exports.Direction9||(exports.Direction9={}))[ut.topLeft=0]="topLeft",ut[ut.top=1]="top",ut[ut.topRight=2]="topRight",ut[ut.right=3]="right",ut[ut.bottomRight=4]="bottomRight",ut[ut.bottom=5]="bottom",ut[ut.bottomLeft=6]="bottomLeft",ut[ut.left=7]="left",ut[ut.center=8]="center",ut[ut["top-left"]=0]="top-left",ut[ut["top-right"]=2]="top-right",ut[ut["bottom-right"]=4]="bottom-right",ut[ut["bottom-left"]=6]="bottom-left";const ct=[{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}];ct.forEach((t=>t.type="percent"));const pt={directionData:ct,tempPoint:{},get:_t,toPoint(t,e,s,r,i){const o=_t(t);s.x=o.x,s.y=o.y,"percent"===o.type&&(s.x*=e.width,s.y*=e.height,i&&(s.x-=i.x,s.y-=i.y,o.x&&(s.x-=1===o.x?i.width:.5===o.x?o.x*i.width:0),o.y&&(s.y-=1===o.y?i.height:.5===o.y?o.y*i.height:0))),r||(s.x+=e.x,s.y+=e.y)}};function _t(t){return"string"==typeof t?ct[exports.Direction9[t]]:t}const{toPoint:ft}=pt,gt={toPoint(t,e,s,r,i){ft(t,s,r,i,e)}},yt={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 xt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new xt(t)}static set filter(t){this.filterList=mt(t)}static set exclude(t){this.excludeList=mt(t)}log(...t){if(wt.enable){if(wt.filterList.length&&wt.filterList.every((t=>t!==this.name)))return;if(wt.excludeList.length&&wt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){wt.enable&&this.warn(...t)}warn(...t){wt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function mt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}xt.filterList=[],xt.excludeList=[],xt.showWarn=!0;const wt=xt,bt=xt.get("RunTime"),vt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const r=s.create(s.RUNTIME);return Bt.currentId=Bt.idMap[r]=e?performance.now():Date.now(),Bt.currentName=Bt.nameMap[r]=t,Bt.nameToIdMap[t]=r,r},end(t,e){const s=Bt.idMap[t],r=Bt.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;Bt.idMap[t]=Bt.nameMap[t]=Bt.nameToIdMap[r]=void 0,bt.log(r,i,"ms")},endOfName(t,e){const s=Bt.nameToIdMap[t];void 0!==s&&Bt.end(s,e)}},Bt=vt,kt=[],Ct={list:{},add(t,...e){this.list[t]=!0,kt.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("need plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>kt.forEach((t=>Ct.has(t,!0)))));const Tt=xt.get("UICreator"),Ot={list:{},register(t){const{__tag:e}=t.prototype;Pt[e]&&Tt.repeat(e),Pt[e]=t},get(t,e,s,r,i,o){Pt[t]||Tt.error("not register "+t);const n=new Pt[t](e);return void 0!==s&&(n.x=s,r&&(n.y=r),i&&(n.width=i),o&&(n.height=o)),n}},{list:Pt}=Ot,Lt=xt.get("EventCreator"),Rt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(St[e]&&Lt.repeat(e),St[e]=t)}))},changeName(t,e){const s=St[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,St[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new St[t](...e)},{nameList:St}=Rt;const It={default:(t,e)=>(Et(e,t),Et(t,e),t),assign(t,e,s){let r;Object.keys(e).forEach((i=>{var o,n;if(r=e[i],(null==r?void 0:r.constructor)===Object&&(null===(o=t[i])||void 0===o?void 0:o.constructor)===Object)return Et(t[i],e[i],s&&s[i]);s&&i in s?(null===(n=s[i])||void 0===n?void 0:n.constructor)===Object&&Et(t[i]={},e[i],s[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)),toMap(t){const e={};for(let s=0,r=t.length;s<r;s++)e[t[s]]=!0;return e}},{assign:Et}=It;class Mt{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(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}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(t instanceof Array)for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:r}=this;s.tag=this.__leaf.tag;for(let i in this)if("_"!==i[0]&&(t=this["_"+i],void 0!==t)){if("path"===i&&!this.__pathInputed)continue;e=r?r[i]:void 0,s[i]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:r,d:i,e:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:r,d:i,e:o,f:n}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}var At;exports.Answer=void 0,(At=exports.Answer||(exports.Answer={}))[At.No=0]="No",At[At.Yes=1]="Yes",At[At.NoAndSkip=2]="NoAndSkip",At[At.YesAndSkip=3]="YesAndSkip";function Wt(t){return"{}"===JSON.stringify(t)}function Dt(t,e,s,r){var i,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(n=(o<3?i(n):o>3?i(e,s,n):i(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function Nt(t,e,s,r){return new(s||(s=Promise))((function(i,o){function n(t){try{h(r.next(t))}catch(t){o(t)}}function a(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(n,a)}h((r=r.apply(t,e||[])).next())}))}function Yt(t){return(e,s)=>{t||(t=s),Object.defineProperty(e,s,{get(){return this.context[t]},set(e){this.context[t]=e}})}}"function"==typeof SuppressedError&&SuppressedError;const Xt=[];function zt(){return(t,e)=>{Xt.push(e)}}const Ft=[];class jt{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||Ft)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Xt.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,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,r,i,o,n,a,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,n,a){}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}}Dt([Yt("imageSmoothingEnabled")],jt.prototype,"smooth",void 0),Dt([Yt("imageSmoothingQuality")],jt.prototype,"smoothLevel",void 0),Dt([Yt("globalAlpha")],jt.prototype,"opacity",void 0),Dt([Yt()],jt.prototype,"fillStyle",void 0),Dt([Yt()],jt.prototype,"strokeStyle",void 0),Dt([Yt("lineWidth")],jt.prototype,"strokeWidth",void 0),Dt([Yt("lineCap")],jt.prototype,"strokeCap",void 0),Dt([Yt("lineJoin")],jt.prototype,"strokeJoin",void 0),Dt([Yt("lineDashOffset")],jt.prototype,"dashOffset",void 0),Dt([Yt()],jt.prototype,"miterLimit",void 0),Dt([Yt()],jt.prototype,"shadowBlur",void 0),Dt([Yt()],jt.prototype,"shadowColor",void 0),Dt([Yt()],jt.prototype,"shadowOffsetX",void 0),Dt([Yt()],jt.prototype,"shadowOffsetY",void 0),Dt([Yt()],jt.prototype,"filter",void 0),Dt([Yt()],jt.prototype,"font",void 0),Dt([Yt()],jt.prototype,"fontKerning",void 0),Dt([Yt()],jt.prototype,"fontStretch",void 0),Dt([Yt()],jt.prototype,"fontVariantCaps",void 0),Dt([Yt()],jt.prototype,"textAlign",void 0),Dt([Yt()],jt.prototype,"textBaseline",void 0),Dt([Yt()],jt.prototype,"textRendering",void 0),Dt([Yt()],jt.prototype,"wordSpacing",void 0),Dt([Yt()],jt.prototype,"letterSpacing",void 0),Dt([Yt()],jt.prototype,"direction",void 0),Dt([zt()],jt.prototype,"setTransform",null),Dt([zt()],jt.prototype,"resetTransform",null),Dt([zt()],jt.prototype,"getTransform",null),Dt([zt()],jt.prototype,"save",null),Dt([zt()],jt.prototype,"restore",null),Dt([zt()],jt.prototype,"translate",null),Dt([zt()],jt.prototype,"scale",null),Dt([zt()],jt.prototype,"rotate",null),Dt([zt()],jt.prototype,"fill",null),Dt([zt()],jt.prototype,"stroke",null),Dt([zt()],jt.prototype,"clip",null),Dt([zt()],jt.prototype,"fillRect",null),Dt([zt()],jt.prototype,"strokeRect",null),Dt([zt()],jt.prototype,"clearRect",null),Dt([zt()],jt.prototype,"beginPath",null),Dt([zt()],jt.prototype,"moveTo",null),Dt([zt()],jt.prototype,"lineTo",null),Dt([zt()],jt.prototype,"bezierCurveTo",null),Dt([zt()],jt.prototype,"quadraticCurveTo",null),Dt([zt()],jt.prototype,"closePath",null),Dt([zt()],jt.prototype,"arc",null),Dt([zt()],jt.prototype,"arcTo",null),Dt([zt()],jt.prototype,"ellipse",null),Dt([zt()],jt.prototype,"rect",null),Dt([zt()],jt.prototype,"roundRect",null),Dt([zt()],jt.prototype,"createConicGradient",null),Dt([zt()],jt.prototype,"createLinearGradient",null),Dt([zt()],jt.prototype,"createPattern",null),Dt([zt()],jt.prototype,"createRadialGradient",null),Dt([zt()],jt.prototype,"fillText",null),Dt([zt()],jt.prototype,"measureText",null),Dt([zt()],jt.prototype,"strokeText",null);const{copy:Ht}=b,Ut={width:1,height:1,pixelRatio:1},Gt=["width","height","pixelRatio"];const Vt={creator:{},parse(t,e){},convertToCanvasData(t,e){}},qt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Qt=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},qt),Jt={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},Zt={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},$t=Object.assign(Object.assign({},Zt),qt),Kt=Qt,te={};for(let t in Kt)te[Kt[t]]=t;const ee={};for(let t in Kt)ee[Kt[t]]=Jt[t];const se={drawRoundRect(t,e,s,r,i,o){const n=a.fourNumber(o,Math.min(r/2,i/2)),h=e+r,l=s+i;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(h,s,h,l,n[1]):t.lineTo(h,s),n[2]?t.arcTo(h,l,e,l,n[2]):t.lineTo(h,l),n[3]?t.arcTo(e,l,e,s,n[3]):t.lineTo(e,l),n[0]?t.arcTo(e,s,h,s,n[0]):t.lineTo(e,s)}},{sin:re,cos:ie,atan2:oe,ceil:ne,abs:ae,PI:he,sqrt:le,pow:de}=Math,{setPoint:ue,addPoint:ce}=z,{set:pe,toNumberPoints:_e}=I,{M:fe,L:ge,C:ye,Q:xe,Z:me}=Qt,we={},be={points(t,e,s,r){let i=_e(e);if(t.push(fe,i[0],i[1]),s&&i.length>5){let e,o,n,a,h,l,d,u,c,p,_,f,g,y=i.length;const x=!0===s?.5:s;r&&(i=[i[y-2],i[y-1],...i,i[0],i[1],i[2],i[3]],y=i.length);for(let s=2;s<y-2;s+=2)e=i[s-2],o=i[s-1],n=i[s],a=i[s+1],h=i[s+2],l=i[s+3],_=le(de(n-e,2)+de(a-o,2)),f=le(de(h-n,2)+de(l-a,2)),g=_+f,_=x*_/g,f=x*f/g,h-=e,l-=o,d=n-_*h,u=a-_*l,2===s?r||t.push(xe,d,u,n,a):t.push(ye,c,p,d,u,n,a),c=n+f*h,p=a+f*l;r||t.push(xe,c,p,i[y-2],i[y-1])}else for(let e=2,s=i.length;e<s;e+=2)t.push(ge,i[e],i[e+1]);r&&t.push(me)},rect(t,e,s,r,i){Vt.creator.path=t,Vt.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){Vt.creator.path=[],se.drawRoundRect(Vt.creator,e,s,r,i,o),t.push(...Vt.convertToCanvasData(Vt.creator.path,!0))},arcTo(t,e,s,r,i,o,n,a,u,c,p){const _=r-e,f=i-s,g=o-r,y=n-i;let x=oe(f,_),m=oe(y,g),w=m-x;if(w<0&&(w+=l),w===he||ae(_+f)<1e-12||ae(g+y)<1e-12)return t&&t.push(ge,r,i),u&&(ue(u,e,s),ce(u,r,i)),p&&pe(p,e,s),void(c&&pe(c,r,i));const b=_*y-g*f<0,v=b?-1:1,B=a/ie(w/2),k=r+B*ie(x+w/2+d*v),C=i+B*re(x+w/2+d*v);return x-=d*v,m-=d*v,ke(t,k,C,a,a,0,x/h,m/h,b,u,c,p)},arc:(t,e,s,r,i,o,n,a,h,l)=>ke(t,e,s,r,r,0,i,o,n,a,h,l),ellipse(t,e,s,r,i,o,n,a,u,c,p,_){const f=o*h,g=re(f),y=ie(f);let x=n*h,m=a*h;x>he&&(x-=l),m<0&&(m+=l);let w=m-x;w<0?w+=l:w>l&&(w-=l),u&&(w-=l);const b=ne(ae(w/d)),v=w/b,B=re(v/4),k=8/3*B*B/re(v/2);m=x+v;let C,T,O,P,L,R,S,I,E=ie(x),M=re(x),A=O=y*r*E-g*i*M,W=P=g*r*E+y*i*M,D=e+O,N=s+P;t&&t.push(t.length?ge:fe,D,N),c&&ue(c,D,N),_&&pe(_,D,N);for(let o=0;o<b;o++)C=ie(m),T=re(m),O=y*r*C-g*i*T,P=g*r*C+y*i*T,L=e+A-k*(y*r*M+g*i*E),R=s+W-k*(g*r*M-y*i*E),S=e+O+k*(y*r*T+g*i*C),I=s+P+k*(g*r*T-y*i*C),t&&t.push(ye,L,R,S,I,e+O,s+P),c&&Be(e+A,s+W,L,R,S,I,e+O,s+P,c,!0),A=O,W=P,E=C,M=T,x=m,m+=v;p&&pe(p,e+O,s+P)},quadraticCurveTo(t,e,s,r,i,o,n){t.push(ye,(e+2*r)/3,(s+2*i)/3,(o+2*r)/3,(n+2*i)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,o,n,a){Be(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(o+2*r)/3,i,o,n,a)},toTwoPointBounds(t,e,s,r,i,o,n,a,h,l){const d=[];let u,c,p,_,f,g,y,x,m=t,w=s,b=i,v=n;for(let t=0;t<2;++t)if(1==t&&(m=e,w=r,b=o,v=a),u=-3*m+9*w-9*b+3*v,c=6*m-12*w+6*b,p=3*w-3*m,Math.abs(u)<1e-12){if(Math.abs(c)<1e-12)continue;_=-p/c,0<_&&_<1&&d.push(_)}else y=c*c-4*p*u,x=Math.sqrt(y),y<0||(f=(-c+x)/(2*u),0<f&&f<1&&d.push(f),g=(-c-x)/(2*u),0<g&&g<1&&d.push(g));l?ce(h,t,e):ue(h,t,e),ce(h,n,a);for(let l=0,u=d.length;l<u;l++)ve(d[l],t,e,s,r,i,o,n,a,we),ce(h,we.x,we.y)},getPointAndSet(t,e,s,r,i,o,n,a,h,l){const d=1-t,u=d*d*d,c=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=u*e+c*r+p*o+_*a,l.y=u*s+c*i+p*n+_*h},getPoint(t,e,s,r,i,o,n,a,h){const l={};return ve(t,e,s,r,i,o,n,a,h,l),l}},{getPointAndSet:ve,toTwoPointBounds:Be,ellipse:ke}=be,{sin:Ce,cos:Te,sqrt:Oe,atan2:Pe}=Math,{ellipse:Le}=be,Re={ellipticalArc(e,s,r,i,o,n,a,d,u,c,p){const _=(u-s)/2,f=(c-r)/2,g=n*h,y=Ce(g),x=Te(g),m=-x*_-y*f,w=-x*f+y*_,b=i*i,v=o*o,B=w*w,k=m*m,C=b*v-b*B-v*k;let T=0;if(C<0){const t=Oe(1-C/(b*v));i*=t,o*=t}else T=(a===d?-1:1)*Oe(C/(b*B+v*k));const O=T*i*w/o,P=-T*o*m/i,L=Pe((w-P)/o,(m-O)/i),R=Pe((-w-P)/o,(-m-O)/i);let S=R-L;0===d&&S>0?S-=l:1===d&&S<0&&(S+=l);const I=s+_+x*O-y*P,E=r+f+y*O+x*P,M=S<0?1:0;p||t.ellipseToCurve?Le(e,I,E,i,o,n,L/h,R/h,M):i!==o||n?e.push(Qt.G,I,E,i,o,n,L/h,R/h,M):e.push(Qt.O,I,E,i,L/h,R/h,M)}},{M:Se,m:Ie,L:Ee,l:Me,H:Ae,h:We,V:De,v:Ne,C:Ye,c:Xe,S:ze,s:Fe,Q:je,q:He,T:Ue,t:Ge,A:Ve,a:qe,Z:Qe,z:Je,N:Ze,D:$e,X:Ke,G:ts,F:es,O:ss,P:rs,U:is}=Qt,{rect:os,roundRect:ns,arcTo:as,arc:hs,ellipse:ls,quadraticCurveTo:ds}=be,{ellipticalArc:us}=Re,cs=xt.get("PathConvert"),ps={},_s={current:{dot:0},stringify(t,e){let s,r,i,o=0,n=t.length,h="";for(;o<n;){r=t[o],s=ee[r],h+=r===i?" ":te[r];for(let r=1;r<s;r++)h+=a.float(t[o+r],e),r===s-1||(h+=" ");i=r,o+=s}return h},parse(t,e){let s,r,i,o="";const n=[],a=e?$t:Zt;for(let e=0,h=t.length;e<h;e++)r=t[e],yt[r]?("."===r&&(fs.dot&&(gs(n,o),o=""),fs.dot++),"0"===o&&"."!==r&&(gs(n,o),o=""),o+=r):Qt[r]?(o&&(gs(n,o),o=""),fs.name=Qt[r],fs.length=Jt[r],fs.index=0,gs(n,fs.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&gs(n,o),o=r):o&&(gs(n,o),o=""),i=r;return o&&gs(n,o),s?_s.toCanvasData(n,e):n},toCanvasData(t,e){let s,r,i,o,n,a=0,h=0,l=0,d=0,u=0,c=t.length;const p=[];for(;u<c;){switch(i=t[u],i){case Ie:t[u+1]+=a,t[u+2]+=h;case Se:a=t[u+1],h=t[u+2],p.push(Se,a,h),u+=3;break;case We:t[u+1]+=a;case Ae:a=t[u+1],p.push(Ee,a,h),u+=2;break;case Ne:t[u+1]+=h;case De:h=t[u+1],p.push(Ee,a,h),u+=2;break;case Me:t[u+1]+=a,t[u+2]+=h;case Ee:a=t[u+1],h=t[u+2],p.push(Ee,a,h),u+=3;break;case Fe:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=ze;case ze:n=o===Ye||o===ze,l=n?2*a-s:t[u+1],d=n?2*h-r:t[u+2],s=t[u+1],r=t[u+2],a=t[u+3],h=t[u+4],p.push(Ye,l,d,s,r,a,h),u+=5;break;case Xe:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,t[u+5]+=a,t[u+6]+=h,i=Ye;case Ye:s=t[u+3],r=t[u+4],a=t[u+5],h=t[u+6],p.push(Ye,t[u+1],t[u+2],s,r,a,h),u+=7;break;case Ge:t[u+1]+=a,t[u+2]+=h,i=Ue;case Ue:n=o===je||o===Ue,s=n?2*a-s:t[u+1],r=n?2*h-r:t[u+2],e?ds(p,a,h,s,r,t[u+1],t[u+2]):p.push(je,s,r,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],u+=3;break;case He:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=je;case je:s=t[u+1],r=t[u+2],e?ds(p,a,h,s,r,t[u+3],t[u+4]):p.push(je,s,r,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case qe:t[u+6]+=a,t[u+7]+=h;case Ve:us(p,a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],e),a=t[u+6],h=t[u+7],u+=8;break;case Je:case Qe:p.push(Qe),u++;break;case Ze:a=t[u+1],h=t[u+2],e?os(p,a,h,t[u+3],t[u+4]):ys(p,t,u,5),u+=5;break;case $e:a=t[u+1],h=t[u+2],e?ns(p,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):ys(p,t,u,9),u+=9;break;case Ke:a=t[u+1],h=t[u+2],e?ns(p,a,h,t[u+3],t[u+4],t[u+5]):ys(p,t,u,6),u+=6;break;case ts:ls(e?p:ys(p,t,u,9),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],t[u+8],null,ps),a=ps.x,h=ps.y,u+=9;break;case es:e?ls(p,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):ys(p,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case ss:hs(e?p:ys(p,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,ps),a=ps.x,h=ps.y,u+=7;break;case rs:e?hs(p,t[u+1],t[u+2],t[u+3],0,360,!1):ys(p,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case is:as(e?p:ys(p,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,ps),a=ps.x,h=ps.y,u+=6;break;default:return cs.error(`command: ${i} [index:${u}]`,t),p}o=i}return p},objectToCanvasData(t){const e=[];return t.forEach((t=>{switch(t.name){case"M":e.push(Se,t.x,t.y);break;case"L":e.push(Ee,t.x,t.y);break;case"C":e.push(Ye,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(je,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Qe)}})),e},copyData(t,e,s,r){for(let i=s,o=s+r;i<o;i++)t.push(e[i])},pushData(t,e){fs.index===fs.length&&(fs.index=1,t.push(fs.name)),t.push(Number(e)),fs.index++,fs.dot=0}},{current:fs,pushData:gs,copyData:ys}=_s,{M:xs,L:ms,C:ws,Q:bs,Z:vs,N:Bs,D:ks,X:Cs,G:Ts,F:Os,O:Ps,P:Ls,U:Rs}=Qt,{getMinDistanceFrom:Ss,getRadianFrom:Is}=I,{tan:Es,min:Ms,abs:As}=Math,Ws={},Ds={beginPath(t){t.length=0},moveTo(t,e,s){t.push(xs,e,s)},lineTo(t,e,s){t.push(ms,e,s)},bezierCurveTo(t,e,s,r,i,o,n){t.push(ws,e,s,r,i,o,n)},quadraticCurveTo(t,e,s,r,i){t.push(bs,e,s,r,i)},closePath(t){t.push(vs)},rect(t,e,s,r,i){t.push(Bs,e,s,r,i)},roundRect(t,e,s,r,i,o){if("number"==typeof o)t.push(Cs,e,s,r,i,o);else{const n=a.fourNumber(o);n?t.push(ks,e,s,r,i,...n):t.push(Bs,e,s,r,i)}},ellipse(t,e,s,r,i,o,n,a,h){void 0===o?t.push(Os,e,s,r,i):(void 0===n&&(n=0),void 0===a&&(a=360),t.push(Ts,e,s,r,i,o,n,a,h?1:0))},arc(t,e,s,r,i,o,n){void 0===i?t.push(Ls,e,s,r):(void 0===o&&(o=360),t.push(Ps,e,s,r,i,o,n?1:0))},arcTo(t,e,s,r,i,o,n,a){if(void 0!==n){const t=Ss(n,a,e,s,r,i);o=Ms(o,Ms(t/2,t/2*As(Es(Is(n,a,e,s,r,i)/2))))}t.push(Rs,e,s,r,i,o)},drawEllipse(t,e,s,r,i,o,n,a,h){be.ellipse(null,e,s,r,i,void 0===o?0:o,void 0===n?0:n,void 0===a?360:a,h,null,null,Ws),t.push(xs,Ws.x,Ws.y),Ns(t,e,s,r,i,o,n,a,h)},drawArc(t,e,s,r,i,o,n){be.arc(null,e,s,r,void 0===i?0:i,void 0===o?360:o,n,null,null,Ws),t.push(xs,Ws.x,Ws.y),Ys(t,e,s,r,i,o,n)},drawPoints(t,e,s,r){be.points(t,e,s,r)}},{ellipse:Ns,arc:Ys}=Ds,{moveTo:Xs,lineTo:zs,quadraticCurveTo:Fs,bezierCurveTo:js,closePath:Hs,beginPath:Us,rect:Gs,roundRect:Vs,ellipse:qs,arc:Qs,arcTo:Js,drawEllipse:Zs,drawArc:$s,drawPoints:Ks}=Ds;class tr{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?"string"==typeof t?Vt.parse(t):t:[],this}beginPath(){return Us(this.__path),this.paint(),this}moveTo(t,e){return Xs(this.__path,t,e),this.paint(),this}lineTo(t,e){return zs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,r,i,o){return js(this.__path,t,e,s,r,i,o),this.paint(),this}quadraticCurveTo(t,e,s,r){return Fs(this.__path,t,e,s,r),this.paint(),this}closePath(){return Hs(this.__path),this.paint(),this}rect(t,e,s,r){return Gs(this.__path,t,e,s,r),this.paint(),this}roundRect(t,e,s,r,i){return Vs(this.__path,t,e,s,r,i),this.paint(),this}ellipse(t,e,s,r,i,o,n,a){return qs(this.__path,t,e,s,r,i,o,n,a),this.paint(),this}arc(t,e,s,r,i,o){return Qs(this.__path,t,e,s,r,i,o),this.paint(),this}arcTo(t,e,s,r,i){return Js(this.__path,t,e,s,r,i),this.paint(),this}drawEllipse(t,e,s,r,i,o,n,a){return Zs(this.__path,t,e,s,r,i,o,n,a),this.paint(),this}drawArc(t,e,s,r,i,o){return $s(this.__path,t,e,s,r,i,o),this.paint(),this}drawPoints(t,e,s){return Ks(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:er,L:sr,C:rr,Q:ir,Z:or,N:nr,D:ar,X:hr,G:lr,F:dr,O:ur,P:cr,U:pr}=Qt,_r=xt.get("PathDrawer"),fr={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case er:t.moveTo(e[r+1],e[r+2]),r+=3;break;case sr:t.lineTo(e[r+1],e[r+2]),r+=3;break;case rr:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case ir:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case or:t.closePath(),r+=1;break;case nr:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case ar: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 hr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case lr: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 dr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,l,!1),r+=5;break;case ur: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 cr:t.arc(e[r+1],e[r+2],e[r+3],0,l,!1),r+=4;break;case pr:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void _r.error(`command: ${s} [index:${r}]`,e)}}},{M:gr,L:yr,C:xr,Q:mr,Z:wr,N:br,D:vr,X:Br,G:kr,F:Cr,O:Tr,P:Or,U:Pr}=Qt,{toTwoPointBounds:Lr,toTwoPointBoundsByQuadraticCurve:Rr,arcTo:Sr,arc:Ir,ellipse:Er}=be,{addPointBounds:Mr,copy:Ar,addPoint:Wr,setPoint:Dr,addBounds:Nr,toBounds:Yr}=z,Xr=xt.get("PathBounds");let zr,Fr,jr;const Hr={},Ur={},Gr={},Vr={toBounds(t,e){Vr.toTwoPointBounds(t,Ur),Yr(Ur,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Dr(e,0,0);let s,r,i,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===wr||n===xr||n===mr?Dr(e,h,l):Dr(e,t[a+1],t[a+2])),n){case gr:case yr:h=t[a+1],l=t[a+2],Wr(e,h,l),a+=3;break;case xr:i=t[a+5],o=t[a+6],Lr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,o,Hr),Mr(e,Hr),h=i,l=o,a+=7;break;case mr:s=t[a+1],r=t[a+2],i=t[a+3],o=t[a+4],Rr(h,l,s,r,i,o,Hr),Mr(e,Hr),h=i,l=o,a+=5;break;case wr:a+=1;break;case br:h=t[a+1],l=t[a+2],Nr(e,h,l,t[a+3],t[a+4]),a+=5;break;case vr:case Br:h=t[a+1],l=t[a+2],Nr(e,h,l,t[a+3],t[a+4]),a+=n===vr?9:6;break;case kr:Er(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],Hr,Gr),0===a?Ar(e,Hr):Mr(e,Hr),h=Gr.x,l=Gr.y,a+=9;break;case Cr:h=t[a+1],l=t[a+2],Fr=t[a+3],jr=t[a+4],Nr(e,h-Fr,l-jr,2*Fr,2*jr),h+=Fr,a+=5;break;case Tr:Ir(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Hr,Gr),0===a?Ar(e,Hr):Mr(e,Hr),h=Gr.x,l=Gr.y,a+=7;break;case Or:h=t[a+1],l=t[a+2],zr=t[a+3],Nr(e,h-zr,l-zr,2*zr,2*zr),h+=zr,a+=4;break;case Pr:Sr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Hr,Gr),0===a?Ar(e,Hr):Mr(e,Hr),h=Gr.x,l=Gr.y,a+=6;break;default:return void Xr.error(`command: ${n} [index:${a}]`,t)}}},{M:qr,L:Qr,Z:Jr}=Qt,{getCenterX:Zr,getCenterY:$r}=I,{arcTo:Kr}=Ds,ti={smooth(t,e,s){let r,i,o=0,n=0,a=0,h=0,l=0,d=0,u=0,c=0,p=0;const _=t.length,f=[];for(;o<_;)switch(r=t[o],r){case qr:h=c=t[o+1],l=p=t[o+2],o+=3,t[o]===Qr?(d=t[o+1],u=t[o+2],f.push(qr,Zr(h,d),$r(l,u))):f.push(qr,h,l);break;case Qr:switch(n=t[o+1],a=t[o+2],o+=3,t[o]){case Qr:Kr(f,n,a,t[o+1],t[o+2],e,c,p);break;case Jr:Kr(f,n,a,h,l,e,c,p);break;default:f.push(Qr,n,a)}c=n,p=a;break;case Jr:Kr(f,h,l,d,u,e,c,p),f.push(Jr),o+=1;break;default:i=ee[r];for(let e=0;e<i;e++)f.push(t[o+e]);o+=i}return r!==Jr&&(f[1]=h,f[2]=l),f}};Vt.creator=new tr,Vt.parse=_s.parse,Vt.convertToCanvasData=_s.toCanvasData;const ei=new tr,{drawRoundRect:si}=se;const ri={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]},isOpaqueImage(t){const e=ii.fileType(t);return["jpg","jpeg"].some((t=>t===e))},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},ii=ri;ii.opacityTypes.forEach((t=>ii.upperCaseTypeMap[t]=t.toUpperCase()));const oi=xt.get("TaskProcessor");class ni{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Nt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){oi.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class ai{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&&It.assign(this.config,t),this.empty()}add(t,e){let s,r,i,o;const n=new ni(t);return n.parent=this,"number"==typeof e?o=e:e&&(r=e.parallel,s=e.start,i=e.time,o=e.delay),i&&(n.time=i),!1===r&&(n.parallel=!1),void 0===o?this.push(n,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(n,s))}),o)),this.isComplete=!1,n}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 hi=xt.get("Resource"),li={tasker:new ai,map:{},get isComplete(){return di.tasker.isComplete},set(t,e){di.map[t]&&hi.repeat(t),di.map[t]=e},get:t=>di.map[t],remove(t){const e=di.map[t];e&&(e.destroy&&e.destroy(),delete di.map[t])},loadImage(t,e){return new Promise(((s,r)=>{const i=this.setImage(t,t,e);i.load((()=>s(i)),(t=>r(t)))}))},setImage(t,s,r){let i;return"string"==typeof s?i={url:s}:s.url||(i={url:t,view:s}),i&&(r&&(i.format=r),s=e.image(i)),di.set(t,s),s},destroy(){di.map={}}},di=li,ui={maxRecycled:100,recycledList:[],patternTasker:new ai,get(t){let s=li.get(t.url);return s||li.set(t.url,s=e.image(t)),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||ci.recycledList.push(t)}))},clearRecycled(){const t=ci.recycledList;t.length>ci.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&li.remove(t.url))),t.length=0)},hasOpacityPixel:t=>ri.opacityTypes.some((e=>ci.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+ri.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+ri.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){ci.recycledList=[]}},ci=ui,{IMAGE:pi,create:_i}=s;function fi(t,e,s,r){r||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function gi(t,e){return Object.getOwnPropertyDescriptor(t,e)}function yi(t,e){return(s,r)=>mi(s,r,t,e&&e(r))}function xi(t){return t}function mi(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};fi(t,e,Object.assign(i,r||{})),Pi(t,e,s)}function wi(t,e){return yi(t,(t=>({set(s){this.__setAttr(t,s,e)&&bi(this)}})))}function bi(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}const vi=wi;function Bi(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&ki(this)}})))}function ki(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&bi(t)}const Ci=Bi;function Ti(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Oi(t,e,s,r){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==r&&0!==s||bi(t))}function Pi(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t}};if(void 0===s)n.get=function(){return this[i]};else if("function"==typeof s)n.get=function(){let t=this[i];return void 0===t?s(this.__leaf):t};else if("object"==typeof s){const t=Wt(s);n.get=function(){let e=this[i];return void 0===e?this[i]=t?{}:It.clone(s):e}}const a=t.isBranchLeaf;"width"===e?n.get=function(){const t=this[i];if(void 0===t){const t=this,e=t.__naturalWidth,r=t.__leaf;return!s||r.pathInputed?r.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:a&&r.children.length?r.boxBounds.width:s}return t}:"height"===e&&(n.get=function(){const t=this[i];if(void 0===t){const t=this,e=t.__naturalHeight,r=t.__leaf;return!s||r.pathInputed?r.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:a&&r.children.length?r.boxBounds.height:s}return t});let h,l=r;for(;!h&&l;)h=gi(l,e),l=l.__proto__;h&&h.set&&(n.set=h.set),r[o]&&(n.set=r[o],delete r[o]),fi(r,e,n)}const Li=new xt("rewrite"),Ri=[],Si=["destroy","constructor"];function Ii(t){Ri.length&&(Ri.forEach((e=>{t&&Li.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Ri.length=0)}function Ei(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(Si.includes(r)||e&&e.includes(r)))if(t.prototype){gi(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}setTimeout((()=>Ii(!0)));const{copy:Mi,toInnerPoint:Ai,toOuterPoint:Wi,scaleOfOuter:Di,rotateOfOuter:Ni,skewOfOuter:Yi,multiplyParent:Xi,divideParent:zi,getLayout:Fi}=b,ji={},Hi={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Vi(t,e,s),t.isBranch){const{children:r}=t;for(let t=0,i=r.length;t<i;t++)Gi(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++)qi(e[t])}},updateAllChange(t){if(qi(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Qi(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s=0,r,i){const o="object"==typeof e?Object.assign({},e):{x:e,y:s};r?Wi(t.localTransform,o,o,!0):t.parent&&Ai(t.parent.worldTransform,o,o,!0),Ui.moveLocal(t,o.x,o.y,i)},moveLocal(t,e,s=0,r){"object"==typeof e&&(s=e.y,e=e.x),e+=t.x,s+=t.y,r?t.animate({x:e,y:s},r):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,r,i,o){Ui.zoomOfLocal(t,Ji(t,e),s,r,i,o)},zoomOfLocal(t,e,s,r=s,i,o){const n=t.__localMatrix;if("number"!=typeof r&&(r&&(o=r),r=s),Mi(ji,n),Di(ji,e,s,r),t.origin||t.around)Ui.setTransform(t,ji,i,o);else{const e=t.x+ji.e-n.e,a=t.y+ji.f-n.f;o&&!i?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*r},o):(t.x=e,t.y=a,t.scaleResize(s,r,!0!==i))}},rotateOfWorld(t,e,s,r){Ui.rotateOfLocal(t,Ji(t,e),s,r)},rotateOfLocal(t,e,s,r){const i=t.__localMatrix;Mi(ji,i),Ni(ji,e,s),t.origin||t.around?Ui.setTransform(t,ji,!1,r):t.set({x:t.x+ji.e-i.e,y:t.y+ji.f-i.f,rotation:a.formatRotation(t.rotation+s)},r)},skewOfWorld(t,e,s,r,i,o){Ui.skewOfLocal(t,Ji(t,e),s,r,i,o)},skewOfLocal(t,e,s,r=0,i,o){Mi(ji,t.__localMatrix),Yi(ji,e,s,r),Ui.setTransform(t,ji,i,o)},transformWorld(t,e,s,r){Mi(ji,t.worldTransform),Xi(ji,e),t.parent&&zi(ji,t.parent.worldTransform),Ui.setTransform(t,ji,s,r)},transform(t,e,s,r){Mi(ji,t.localTransform),Xi(ji,e),Ui.setTransform(t,ji,s,r)},setTransform(t,e,s,r){const i=t.__,o=i.origin&&Ui.getInnerOrigin(t,i.origin),n=Fi(e,o,i.around&&Ui.getInnerOrigin(t,i.around));if(s){const e=n.scaleX/t.scaleX,s=n.scaleY/t.scaleY;if(delete n.scaleX,delete n.scaleY,o){it.scale(t.boxBounds,Math.abs(e),Math.abs(s));const r=Ui.getInnerOrigin(t,i.origin);I.move(n,o.x-r.x,o.y-r.y)}t.set(n),t.scaleResize(e,s,!1)}else t.set(n,r)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},r="x"===e?1:-1;return Di(s,Ui.getLocalOrigin(t,"center"),-1*r,1*r),s},getLocalOrigin:(t,e)=>I.tempToOuterOf(Ui.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return pt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Mi(ji,t.worldTransform),zi(ji,e.worldTransform),s?ji:Object.assign({},ji)),drop(t,e,s,r){t.setTransform(Ui.getRelativeWorld(t,e,!0),r),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}}},Ui=Hi,{updateAllMatrix:Gi,updateMatrix:Vi,updateAllWorldOpacity:qi,updateAllChange:Qi}=Ui;function Ji(t,e){return t.__layout.update(),t.parent?I.tempToInnerOf(e,t.parent.__world):e}const Zi={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.mask?t.__localBoxBounds:null,maskLocalStrokeBounds:t=>t.__.mask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.mask?t.__layout.localRenderBounds:null,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))},{updateBounds:$i}=Hi,Ki={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),to(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++)eo(e[t],e)},updateBounds(t,e){const s=[t];eo(t,s),so(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++)$i(r[t]);e&&e===s||$i(s)}}},{pushAllChildBranch:to,pushAllBranchStack:eo,updateBoundsByBranchStack:so}=Ki,ro={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:io}=Hi,{toOuterOf:oo,getPoints:no,copy:ao}=it,ho="_localContentBounds",lo="_worldContentBounds",uo="_worldBoxBounds",co="_worldStrokeBounds";class po{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}get localContentBounds(){return oo(this.contentBounds,this.leaf.__localMatrix,this[ho]||(this[ho]={})),this[ho]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return oo(this.contentBounds,this.leaf.__world,this[lo]||(this[lo]={})),this[lo]}get worldBoxBounds(){return oo(this.boxBounds,this.leaf.__world,this[uo]||(this[uo]={})),this[uo]}get worldStrokeBounds(){return oo(this.strokeBounds,this.leaf.__world,this[co]||(this[co]={})),this[co]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.boxBounds={x:0,y:0,width:0,height:0},this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),this.boxChange(),this.matrixChange()}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{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;const s=e;if(s.__fullLayouting)return;s.__fullLayouting=!0,t.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return b.defaultMatrix;case"page":t=e.zoomLayer;default:return io(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new ht(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:r}=this;let i,o,n,a=this.getInnerBounds(t);switch(e){case"world":i=r.getWorldPoint(a),o=r.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=r.__;n={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},i=r.getLocalPointByInner(a);break;case"inner":i=a,o=b.defaultMatrix;break;case"page":e=r.zoomLayer;default:i=r.getWorldPoint(a,e),o=io(r,e,!0)}if(n||(n=b.getLayout(o)),ao(n,a),I.copy(n,i),s){const{scaleX:t,scaleY:e}=n,s=Math.abs(t),r=Math.abs(e);1===s&&1===r||(n.scaleX/=s,n.scaleY/=r,n.width*=s,n.height*=r)}return n}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=no(this.getInnerBounds(t));let i;switch(e){case"world":i=null;break;case"local":i=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:i=e}return void 0!==i&&r.forEach((t=>s.innerToWorld(t,null,!1,i))),r}shrinkContent(){const{x:t,y:e,width:s,height:r}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:r}}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}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class _o{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 fo extends _o{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}fo.ADD="child.add",fo.REMOVE="child.remove",fo.CREATED="created",fo.MOUNTED="mounted",fo.UNMOUNTED="unmounted",fo.DESTROY="destroy";class go extends _o{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}go.CHANGE="property.change",go.LEAFER_CHANGE="property.leafer_change";class yo extends _o{constructor(t,e){super(t),Object.assign(this,e)}}yo.LOAD="image.load",yo.LOADED="image.loaded",yo.ERROR="image.error";class xo extends _o{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(xo.RESIZE),Object.assign(this,t)):super(t),this.old=e}}xo.RESIZE="resize";class mo extends _o{constructor(t,e){super(t),this.data=e}}mo.REQUEST="watch.request",mo.DATA="watch.data";class wo extends _o{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}wo.REQUEST="layout.request",wo.START="layout.start",wo.BEFORE="layout.before",wo.LAYOUT="layout",wo.AFTER="layout.after",wo.AGAIN="layout.again",wo.END="layout.end";class bo extends _o{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}bo.REQUEST="render.request",bo.CHILD_START="render.child_start",bo.START="render.start",bo.BEFORE="render.before",bo.RENDER="render",bo.AFTER="render.after",bo.AGAIN="render.again",bo.END="render.end",bo.NEXT="render.next";class vo extends _o{}vo.START="leafer.start",vo.BEFORE_READY="leafer.before_ready",vo.READY="leafer.ready",vo.AFTER_READY="leafer.after_ready",vo.VIEW_READY="leafer.view_ready",vo.VIEW_COMPLETED="leafer.view_completed",vo.STOP="leafer.stop",vo.RESTART="leafer.restart",vo.END="leafer.end";const Bo={};class ko{set event(t){this.on(t)}on(t,e,s){if(!e){let e,s=t;for(let t in s)e=s[t],e instanceof Array?this.on(t,e[0],e[1]):this.on(t,e);return}let r,i,o;s&&("once"===s?i=!0:"boolean"==typeof s?r=s:(r=s.capture,i=s.once));const n=Co(this,r,!0),a="string"==typeof t?t.split(" "):t,h=i?{listener:e,once:i}:{listener:e};a.forEach((t=>{t&&(o=n[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):n[t]=[h])}))}off(t,e,s){if(t){const r="string"==typeof t?t.split(" "):t;if(e){let t,i,o;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const n=Co(this,t);r.forEach((t=>{t&&(i=n[t],i&&(o=i.findIndex((t=>t.listener===e)),o>-1&&i.splice(o,1),i.length||delete n[t]))}))}else{const{__bubbleMap:t,__captureMap:e}=this;r.forEach((s=>{t&&delete t[s],e&&delete e[s]}))}}else this.__bubbleMap=this.__captureMap=void 0}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&&Rt.has(t)&&(e=Rt.get(t,{type:t,target:this,current:this}));const r=Co(this,s)[t];if(r){let i;for(let o=0,n=r.length;o<n&&!((i=r[o])&&(i.listener(e),i.once&&(this.off(t,i.listener,s),o--,n--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:r}=this,i=s&&s[t],o=r&&r[t];return!!(void 0===e?i||o:e?o:i)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Co(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Bo)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Bo)}}const{on:To,on_:Oo,off:Po,off_:Lo,once:Ro,emit:So,emitEvent:Io,hasEvent:Eo,destroy:Mo}=ko.prototype,Ao={on:To,on_:Oo,off:Po,off_:Lo,once:Ro,emit:So,emitEvent:Io,hasEvent:Eo,destroyEventer:Mo},{isFinite:Wo}=Number,Do=xt.get("setAttr"),No={__setAttr(t,e,s){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(s&&!Wo(e)&&void 0!==e&&(Do.warn(this.innerName,t,e),e=void 0),"object"==typeof e||r!==e){this.__realSetAttr(t,e);const{CHANGE:s}=go,i=new go(s,this,t,r,e);return this.isLeafer?this.emitEvent(new go(go.LEAFER_CHANGE,this,t,r,e)):this.hasEvent(s)&&this.emitEvent(i),this.leafer.emitEvent(i),!0}return!1}return this.__realSetAttr(t,e),!0},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||void 0===s.normalStyle[t]||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Yo,multiplyParent:Xo,translateInner:zo,defaultWorld:Fo}=b,{toPoint:jo,tempPoint:Ho}=pt,Uo={__updateWorldMatrix(){Xo(this.__local||this.__layout,this.parent?this.parent.__world:Fo,this.__world,!!this.__layout.affectScaleOrRotation,this.__,this.parent&&this.parent.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged||t.rotationChanged)&&(Yo(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(jo(s.around||s.origin,t.boxBounds,Ho),zo(e,-Ho.x,-Ho.y,!s.around))}this.__layout.matrixChanged=!1}},{updateMatrix:Go,updateAllMatrix:Vo}=Hi,{updateBounds:qo}=Ki,{toOuterOf:Qo,copyAndSpread:Jo,copy:Zo}=it,{toBounds:$o}=Vr,Ko={__updateWorldBounds(){Qo(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),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.boxChanged=!1,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.strokeSpread!==t.strokeBoxSpread)&&(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.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Qo(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Qo(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Qo(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?$o(e.path,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Vo(this),qo(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Vo(this),qo(this,this))):Go(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Jo(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Jo(t.renderBounds,t.boxBounds,t.renderSpread):Zo(t.renderBounds,t.strokeBounds)}},tn={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=this.__.opacity,this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),this.__worldFlipped?t.copyWorldByReset(s,this.__nowWorld,null,this.__.__blendMode,!0):t.copyWorldToInner(s,this.__nowWorld,this.__layout.renderBounds,this.__.__blendMode),s.recycle(this.__nowWorld)}else this.__draw(t,e)},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.windingRule?t.clip(this.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:en}=Zi,sn={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity)if(this.__.__single){if("path"===this.__.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__nowWorld;t.opacity=this.__.opacity,t.copyWorldByReset(s,r,r,this.__.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let r=0,i=s.length;r<i;r++)en(s[r],e)||s[r].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let r=0,i=s.length;r<i;r++)en(s[r],e)||s[r].__clip(t,e)}}},{LEAF:rn,create:on}=s,{toInnerPoint:nn,toOuterPoint:an,multiplyParent:hn}=b,{toOuterOf:ln}=it,{copy:dn,move:un}=I,{moveLocal:cn,zoomOfLocal:pn,rotateOfLocal:_n,skewOfLocal:fn,moveWorld:gn,zoomOfWorld:yn,rotateOfWorld:xn,skewOfWorld:mn,transform:wn,transformWorld:bn,setTransform:vn,getFlipTransform:Bn,getLocalOrigin:kn,getRelativeWorld:Cn,drop:Tn}=Hi;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 Mt}get __LayoutProcessor(){return po}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__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}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=on(rn),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(fo.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0}),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(fo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(fo.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer((()=>this.leafer.nextRender(t,e,s)))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(fo.MOUNTED)):this.__emitLifeEvent(fo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){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}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateContentBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.eraser))}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some((t=>t.__.mask&&t.__.visible&&t.__.opacity))}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld;return hn(this.__world,t.matrix,e,void 0,this.__world),ln(this.__layout.renderBounds,e,e),e}return this.__world}getTransform(t){return this.__layout.getTransform(t||"local")}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)}getWorldBounds(t,e,s){const r=e?Cn(this,e):this.worldTransform,i=s?t:{};return ln(t,r,i),i}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&dn(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&dn(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),nn(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){an(this.worldTransform,t,e,s),r&&r.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,r){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,r),null,null,!0)}getBoxPointByInner(t,e,s,r){const i=r?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return un(i,-o,-n),i}getInnerPoint(t,e,s,r){const i=r?t:{};return this.worldToInner(t,i,s,e),i}getInnerPointByBox(t,e,s,r){const i=r?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return un(i,o,n),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)}getPagePoint(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,r)}getWorldPoint(t,e,s,r){const i=r?t:{};return this.innerToWorld(t,i,s,e),i}getWorldPointByBox(t,e,s,r){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,r),e,s,!0)}getWorldPointByLocal(t,e,s,r){const i=r?t:{};return this.localToWorld(t,i,s,e),i}getWorldPointByPage(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,r)}setTransform(t,e,s){vn(this,t,e,s)}transform(t,e,s){wn(this,t,e,s)}move(t,e,s){cn(this,t,e,s)}moveInner(t,e,s){gn(this,t,e,!0,s)}scaleOf(t,e,s,r,i){pn(this,kn(this,t),e,s,r,i)}rotateOf(t,e,s){_n(this,kn(this,t),e,s)}skewOf(t,e,s,r,i){fn(this,kn(this,t),e,s,r,i)}transformWorld(t,e,s){bn(this,t,e,s)}moveWorld(t,e,s){gn(this,t,e,!1,s)}scaleOfWorld(t,e,s,r,i){yn(this,t,e,s,r,i)}rotateOfWorld(t,e){xn(this,t,e)}skewOfWorld(t,e,s,r,i){mn(this,t,e,s,r,i)}flip(t,e){wn(this,Bn(this,t),!1,e)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__clip(t,e){}__renderShape(t,e,s,r){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Ct.need("path")}getMotionPoint(t){return Ct.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){Tn(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,s){s?this.addAttr(t,e,s):Pi(this.prototype,t,e)}static addAttr(t,e,s,r){s||(s=wi),s(e,r)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new fo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(fo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},exports.Leaf=Dt([Ei(No),Ei(Uo),Ei(Ko),Ei(Ao),Ei(tn)],exports.Leaf);const{setListWithFn:On}=it,{sort:Pn}=Ki,{localBoxBounds:Ln,localStrokeBounds:Rn,localRenderBounds:Sn,maskLocalBoxBounds:In,maskLocalStrokeBounds:En,maskLocalRenderBounds:Mn}=Zi,An=new xt("Branch");exports.Branch=class extends exports.Leaf{__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(){On(this.__layout.boxBounds,this.children,this.__hasMask?In:Ln)}__updateStrokeBounds(){On(this.__layout.strokeBounds,this.children,this.__hasMask?En:Rn)}__updateRenderBounds(){On(this.__layout.renderBounds,this.children,this.__hasMask?Mn:Sn)}__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(Pn),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return An.warn("add self or destroyed");const s=void 0===e;if(!t.__){if(t instanceof Array)return t.forEach((t=>{this.add(t,e),s||e++}));t=Ot.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,s?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const r=t.__layout;r.boxChanged||r.boxChange(),r.matrixChanged||r.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(fo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(fo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",(()=>this.__remove(t,e))):this.__remove(t,e):this.find(t).forEach((t=>this.remove(t,e))):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()})))}clear(){this.removeAll(!0)}__remove(t,e){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())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(fo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(fo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new fo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},exports.Branch=Dt([Ei(sn)],exports.Branch);class Wn{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 Wn;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()}}exports.AlignHelper=gt,exports.AroundHelper=pt,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:n}=t;this.set(e,s,r,i,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=this;return new ht(i,e,o||t.width-i-s,n||t.height-e-r)}},exports.BezierHelper=be,exports.Bounds=ht,exports.BoundsHelper=it,exports.BranchHelper=Ki,exports.BranchRender=sn,exports.CanvasManager=class{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=!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()}},exports.ChildEvent=fo,exports.Creator=e,exports.DataHelper=It,exports.Debug=xt,exports.EllipseHelper=Re,exports.Event=_o,exports.EventCreator=Rt,exports.Eventer=ko,exports.FileHelper=ri,exports.ImageEvent=yo,exports.ImageManager=ui,exports.IncrementId=s,exports.LayoutEvent=wo,exports.LeafBounds=Ko,exports.LeafBoundsHelper=Zi,exports.LeafData=Mt,exports.LeafDataProxy=No,exports.LeafEventer=Ao,exports.LeafHelper=Hi,exports.LeafLayout=po,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=Wn,exports.LeafMatrix=Uo,exports.LeafRender=tn,exports.LeaferCanvasBase=class extends jt{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView}constructor(e,r){super(),this.size={},this.worldTransform={},e||(e=Ut),this.manager=r,this.innerId=s.create(s.CNAVAS);const{width:i,height:o,pixelRatio:n}=e;this.autoLayout=!i||!o,this.size.pixelRatio=n|t.devicePixelRatio,this.config=e,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const r=this.size;It.copyAttrs(r,t,Gt),Gt.forEach((t=>r[t]||(r[t]=1))),this.bounds=new ht(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle())}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s}=this,r=this.worldTransform;if(e){const{a:i,b:o,c:n,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*i+t.b*n)*s,r.b=(t.a*o+t.b*a)*s,r.c=(t.c*i+t.d*n)*s,r.d=(t.c*o+t.d*a)*s,r.e=(t.e*i+t.f*n+h)*s,r.f=(t.e*o+t.f*a+l)*s)}else this.setTransform(r.a=t.a*s,r.b=t.b*s,r.c=t.c*s,r.d=t.d*s,r.e=t.e*s,r.f=t.f*s)}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="none"===t.strokeCap?"butt":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!0}hitStroke(t,e){return!0}hitPixel(t,e,s=1){return!0}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,it.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,i){this.resetTransform(),this.copyWorld(t,e,s,r),i||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempBounds(t,!0,!0);const{context:r}=this,i=r.getImageData(lt.x,lt.y,lt.width,lt.height),{data:o}=i;for(let t=0,r=o.length;t<r;t+=4)s=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?s:e*(s/255));r.putImageData(i,lt.x,lt.y)}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,this.setTempBounds(t),this.fillRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(lt.x,lt.y,lt.width,lt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(lt.x,lt.y,lt.width,lt.height)}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(lt.x,lt.y,lt.width,lt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,s){lt.set(t),s&<.intersect(this.bounds),lt.scale(this.pixelRatio),e&<.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,s){const r=this.manager?this.manager.get(this.size):e.canvas(Object.assign({},this.size));return r.save(),t&&(Ht(r.worldTransform,this.worldTransform),r.useWorldTransform()),s&&(r.smooth=this.smooth),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}},exports.LeaferEvent=vo,exports.LeaferImage=class{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=_i(pi),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}ui.isFormat("svg",t)&&(this.isSVG=!0),ui.hasOpacityPixel(t)&&(this.hasOpacityPixel=!0)}load(e,s){return this.loading||(this.loading=!0,li.tasker.add((()=>Nt(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>this.setView(t))).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}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach(((s,r)=>{e=r%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(e,s,r,i){if(e||(e=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const o=t.origin.createCanvas(e,s),n=o.getContext("2d");return r&&(n.globalAlpha=r),n.drawImage(this.view,0,0,e,s),this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(e,s,r,i){const o=t.canvas.createPattern(e,s);try{r&&o.setTransform&&(o.setTransform(r),r=null)}catch(t){}return i&&(i.transform=r),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}},exports.MathHelper=a,exports.Matrix=Y,exports.MatrixHelper=b,exports.NeedConvertToCanvasCommandMap=Zt,exports.OneRadian=h,exports.PI2=l,exports.PI_2=d,exports.PathBounds=Vr,exports.PathCommandDataHelper=Ds,exports.PathCommandMap=Qt,exports.PathConvert=_s,exports.PathCorner=ti,exports.PathCreator=tr,exports.PathDrawer=fr,exports.PathHelper=Vt,exports.PathNumberCommandLengthMap=ee,exports.PathNumberCommandMap=te,exports.Platform=t,exports.Plugin=Ct,exports.Point=D,exports.PointHelper=I,exports.PropertyEvent=go,exports.RectHelper=se,exports.RenderEvent=bo,exports.ResizeEvent=xo,exports.Resource=li,exports.Run=vt,exports.StringNumberMap=yt,exports.TaskItem=ni,exports.TaskProcessor=ai,exports.TwoPointBoundsHelper=z,exports.UICreator=Ot,exports.WaitHelper=ro,exports.WatchEvent=mo,exports.affectRenderBoundsType=function(t){return yi(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))},exports.affectStrokeBoundsType=Bi,exports.attr=xi,exports.autoLayoutType=function(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),bi(this))}})))},exports.boundsType=wi,exports.canvasPatch=function(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){si(this,t,e,s,r,i)})}(t)},exports.canvasSizeAttrs=Gt,exports.cursorType=function(t){return yi(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))},exports.dataProcessor=function(t){return(e,s)=>{fi(e,"__DataProcessor",{get:()=>t})}},exports.dataType=function(t){return yi(t)},exports.decorateLeafAttr=yi,exports.defineDataProcessor=Pi,exports.defineKey=fi,exports.defineLeafAttr=mi,exports.doBoundsType=bi,exports.doStrokeType=ki,exports.emptyData={},exports.eraserType=function(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))},exports.getBoundsData=c,exports.getDescriptor=gi,exports.getMatrixData=p,exports.getPointData=u,exports.hitType=function(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,xt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))},exports.isEmptyData=Wt,exports.isNull=function(t){return null==t},exports.layoutProcessor=function(t){return(e,s)=>{fi(e,"__LayoutProcessor",{get:()=>t})}},exports.maskType=function(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))},exports.naturalBoundsType=function(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(bi(this),this.__.__removeNaturalSize())}})))},exports.opacityType=function(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Ti(this)}})))},exports.pathInputType=function(t){return yi(t,(t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),bi(this)}})))},exports.pathType=vi,exports.pen=ei,exports.positionType=function(t,e){return yi(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))},exports.registerUI=function(){return t=>{Ot.register(t)}},exports.registerUIEvent=function(){return t=>{Rt.register(t)}},exports.rewrite=function(t){return(e,s)=>{Ri.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}},exports.rewriteAble=function(){return t=>{Ii()}},exports.rotationType=function(t,e){return yi(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))},exports.scaleType=function(t,e){return yi(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))},exports.sortType=function(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))},exports.strokeType=Ci,exports.surfaceType=function(t){return yi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))},exports.tempBounds=lt,exports.tempMatrix=X,exports.tempPoint=N,exports.useModule=Ei,exports.version="1.5.2",exports.visibleType=function(t){return yi(t,(t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Oi(this,t,e,s)))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");Oi(this,t,e,s),this.mask&&Ti(this)}})))};
|
|
1
|
+
"use strict";const t={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(e){const{prefix:s,suffix:r}=t.image;return!r||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+r),s&&"/"===e[0]&&(e=s+e),e}}},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:n}=Math,a={within:(t,e,s)=>("object"==typeof e&&(s=e.max,e=e.min),void 0!==e&&t<e&&(t=e),void 0!==s&&t>s&&(t=s),t),fourNumber(t,e){let s;if(t instanceof Array)switch(t.length){case 4:s=void 0===e?t:[...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)),a.float(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=void 0!==e?o(10,e):1e12;return-0===(t=i(t*s)/s)?0:t},getScaleData(t,e,s,r){if(r||(r={}),e){const t=("number"==typeof e?e:e.width||0)/s.width,i=("number"==typeof e?e:e.height||0)/s.height;r.scaleX=t||i||1,r.scaleY=i||t||1}else t&&a.assignScale(r,t);return r},assignScale(t,e){"number"==typeof e?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:h,randColor:t=>`rgba(${h(255)},${h(255)},${h(255)},${t||1})`};function h(t){return Math.round(Math.random()*t)}const l=n/180,d=2*n,u=n/2;function c(){return{x:0,y:0}}function p(){return{x:0,y:0,width:0,height:0}}function _(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:f,cos:g,acos:y,sqrt:x}=Math,{float:m}=a,w={};function b(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const v={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:b(),tempMatrix:{},set(t,e=1,s=0,r=0,i=1,o=0,n=0){t.a=e,t.b=s,t.c=r,t.d=i,t.e=o,t.f=n},get:_,getWorld:b,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,r){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,r&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,r){B.toInnerPoint(t,e,w),B.scaleOfInner(t,w,s,r)},scaleOfInner(t,e,s,r=s){B.translateInner(t,e.x,e.y),B.scale(t,s,r),B.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:r,c:i,d:o}=t,n=g(e*=l),a=f(e);t.a=s*n-r*a,t.b=s*a+r*n,t.c=i*n-o*a,t.d=i*a+o*n},rotateOfOuter(t,e,s){B.toInnerPoint(t,e,w),B.rotateOfInner(t,w,s)},rotateOfInner(t,e,s){B.translateInner(t,e.x,e.y),B.rotate(t,s),B.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:r,b:i,c:o,d:n}=t;s&&(s*=l,t.a=r+o*s,t.b=i+n*s),e&&(e*=l,t.c=o+r*e,t.d=n+i*e)},skewOfOuter(t,e,s,r){B.toInnerPoint(t,e,w),B.skewOfInner(t,w,s,r)},skewOfInner(t,e,s,r=0){B.translateInner(t,e.x,e.y),B.skew(t,s,r),B.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:r,c:i,d:o,e:n,f:a}=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+n,t.f=e.e*r+e.f*o+a},multiplyParent(t,e,s,r,i,o){let{e:n,f:a}=t;if(o&&(n+=o.scrollX,a+=o.scrollY),s||(s=t),void 0===r&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:r,b:o,c:n,d:a}=t;s.a=r*e.a+o*e.c,s.b=r*e.b+o*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,i&&(s.scaleX=e.scaleX*i.scaleX,s.scaleY=e.scaleY*i.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,i&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},divide(t,e){B.multiply(t,B.tempInvert(e))},divideParent(t,e){B.multiplyParent(t,B.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=B;return B.copy(e,t),B.invert(e),e},invert(t){const{a:e,b:s,c:r,d:i,e:o,f:n}=t;if(s||r){const a=1/(e*i-s*r);t.a=i*a,t.b=-s*a,t.c=-r*a,t.d=e*a,t.e=-(o*i-n*r)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===i)t.e=-o,t.f=-n;else{const s=1/(e*i);t.a=i*s,t.d=e*s,t.e=-o*i*s,t.f=-n*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:n,d:a}=t,h=1/(i*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*i-l*o)*h,!r){const{e:e,f:r}=t;s.x-=(e*a-r*n)*h,s.y-=(r*i-e*o)*h}},setLayout(t,e,s,r,i){const{x:o,y:n,scaleX:a,scaleY:h}=e;if(void 0===i&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:r,skewY:i}=e,o=s*l,n=g(o),d=f(o);if(r||i){const e=r*l,s=i*l;t.a=(n+s*-d)*a,t.b=(d+s*n)*a,t.c=(e*n-d)*h,t.d=(n+e*d)*h}else t.a=n*a,t.b=d*a,t.c=-d*h,t.d=n*h}else t.a=a,t.b=0,t.c=0,t.d=h;t.e=o,t.f=n,(s=s||r)&&B.translateInner(t,-s.x,-s.y,!r)},getLayout(t,e,s,r){const{a:i,b:o,c:n,d:a,e:h,f:d}=t;let c,p,_,w,b,v=h,B=d;if(o||n){const t=i*a-o*n;if(n&&!r){c=x(i*i+o*o),p=t/c;const e=i/c;_=o>0?y(e):-y(e)}else{p=x(n*n+a*a),c=t/p;const e=n/p;_=u-(a>0?y(-e):-y(e))}const e=m(g(_)),s=f(_);c=m(c),p=m(p),w=e?m((n/p+s)/e/l,9):0,b=e?m((o/c-s)/e/l,9):0,_=m(_/l)}else c=i,p=a,_=w=b=0;return(e=s||e)&&(v+=e.x*i+e.y*n,B+=e.x*o+e.y*a,s||(v-=e.x,B-=e.y)),{x:v,y:B,scaleX:c,scaleY:p,rotation:_,skewX:w,skewY:b}},withScale(t,e,s=e){const r=t;if(!e||!s){const{a:r,b:i,c:o,d:n}=t;i||o?s=(r*n-i*o)/(e=x(r*r+i*i)):(e=r,s=n)}return r.scaleX=e,r.scaleY=s,r},reset(t){B.set(t)}},B=v,{toInnerPoint:k,toOuterPoint:C}=v,{sin:T,cos:O,abs:P,sqrt:L,atan2:R,min:S,round:I,PI:M}=Math,E={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},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?I(t.x-.5)+.5:I(t.x),t.y=e?I(t.y-.5)+.5:I(t.y)},move(t,e,s){t.x+=e,t.y+=s},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,r=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(r-1)},rotate(t,e,s){s||(s=A.defaultPoint);const r=O(e*=l),i=T(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*r-n*i,t.y=s.y+o*i+n*r},tempToInnerOf(t,e){const{tempPoint:s}=A;return D(s,t),k(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=A;return D(s,t),C(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=A;return D(s,t),A.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),k(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){k(e,t,s)},toOuterOf(t,e,s){C(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)=>W(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,r){const i=P(s-t),o=P(r-e);return L(i*i+o*o)},getMinDistanceFrom:(t,e,s,r,i,o)=>S(W(t,e,s,r),W(s,r,i,o)),getAngle:(t,e)=>N(t,e)/l,getRotation:(t,e,s,r)=>(r||(r=e),A.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,r.x,r.y)/l),getRadianFrom(t,e,s,r,i,o,n,a){void 0===n&&(n=s,a=r);let h=R(e-r,t-s);const l=R(o-a,i-n)-h;return l<-M?l+d:l},getAtan2:(t,e)=>R(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,r){const i=N(t,e);return(e=r?e:{}).x=t.x+O(i)*s,e.y=t.y+T(i)*s,e},toNumberPoints(t){let e=t;return"object"==typeof t[0]&&(e=[],t.forEach((t=>e.push(t.x,t.y)))),e},reset(t){A.reset(t)}},A=E,{getDistanceFrom:W,copy:D,getAtan2:N}=A;class Y{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?E.copy(this,t):E.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new Y(this)}move(t,e){return E.move(this,t,e),this}scale(t,e){return E.scale(this,t,e),this}scaleOf(t,e,s){return E.scaleOf(this,t,e,s),this}rotate(t,e){return E.rotate(this,t,e),this}rotateOf(t,e){return E.rotate(this,e,t),this}getRotation(t,e,s){return E.getRotation(this,t,e,s)}toInnerOf(t,e){return E.toInnerOf(this,t,e),this}toOuterOf(t,e){return E.toOuterOf(this,t,e),this}getCenter(t){return new Y(E.getCenter(this,t))}getDistance(t){return E.getDistance(this,t)}getDistancePoint(t,e,s){return new Y(E.getDistancePoint(this,t,e,s))}getAngle(t){return E.getAngle(this,t)}getAtan2(t){return E.getAtan2(this,t)}reset(){return E.reset(this),this}}const X=new Y;class z{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?v.copy(this,t):v.set(this,t,e,s,r,i,o),this}setWith(t){return v.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,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 z(this)}translate(t,e){return v.translate(this,t,e),this}translateInner(t,e){return v.translateInner(this,t,e),this}scale(t,e){return v.scale(this,t,e),this}scaleWith(t,e){return v.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return v.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return v.scaleOfInner(this,t,e,s),this}rotate(t){return v.rotate(this,t),this}rotateOfOuter(t,e){return v.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return v.rotateOfInner(this,t,e),this}skew(t,e){return v.skew(this,t,e),this}skewOfOuter(t,e,s){return v.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return v.skewOfInner(this,t,e,s),this}multiply(t){return v.multiply(this,t),this}multiplyParent(t){return v.multiplyParent(this,t),this}divide(t){return v.divide(this,t),this}divideParent(t){return v.divideParent(this,t),this}invert(){return v.invert(this),this}invertWith(){return v.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){v.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){v.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return v.setLayout(this,t,e,s),this}getLayout(t,e,s){return v.getLayout(this,t,e,s)}withScale(t,e){return v.withScale(this,t,e)}reset(){v.reset(this)}}const F=new z,j={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){H(t,e,s),H(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:H}=j,{tempPointBounds:U,setPoint:G,addPoint:V,toBounds:q}=j,{toOuterPoint:Q}=v,{float:J,fourNumber:Z}=a,{floor:$,ceil:K}=Math;let tt,et,st,rt;const it={},ot={},nt={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,i){const{x:o,y:n,width:a,height:h}=e;if(s instanceof Array){const e=Z(s);r?at.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):at.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else r&&(s=-s),at.set(t,o-s,n-s,a+2*s,h+2*s);i&&("width"===i?(t.y=n,t.height=h):(t.x=o,t.width=a))},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),at.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?lt(e,t):e=t,s?(e.offsetX=-(at.maxX(s)-t.x),e.offsetY=-(at.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),at.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){E.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,r=s){E.scaleOf(t,e,s,r),t.width*=s,t.height*=r},tempToOuterOf:(t,e)=>(at.copy(at.tempBounds,t),at.toOuterOf(at.tempBounds,e),at.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),at.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 it.x=t.x,it.y=t.y,Q(e,it,ot),G(U,ot.x,ot.y),it.x=t.x+t.width,Q(e,it,ot),V(U,ot.x,ot.y),it.y=t.y+t.height,Q(e,it,ot),V(U,ot.x,ot.y),it.x=t.x,Q(e,it,ot),V(U,ot.x,ot.y),q(U,s)},toInnerOf(t,e,s){s||(s=t),at.move(s,-e.e,-e.f),at.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const r=Math.min(s,Math.min(t.width/e.width,t.height/e.height));return new z(r,0,0,r,-e.x*r,-e.y*r)},getSpread(t,e,s){const r={};return at.copyAndSpread(r,t,e,!1,s),r},spread(t,e,s){at.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){at.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=$(t.x),t.y=$(t.y),t.width=e>t.x?K(t.width+e-t.x):K(t.width),t.height=s>t.y?K(t.height+s-t.y):K(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=J(t.x,e),t.y=J(t.y,e),t.width=J(t.width,e),t.height=J(t.height,e)},add(t,e,s){tt=t.x+t.width,et=t.y+t.height,st=e.x,rt=e.y,s||(st+=e.width,rt+=e.height),tt=tt>st?tt:st,et=et>rt?et:rt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=tt-t.x,t.height=et-t.y},addList(t,e){at.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){at.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){at.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,r=!1){let i,o=!0;for(let n=0,a=e.length;n<a;n++)i=s?s(e[n]):e[n],i&&(i.width||i.height)&&(o?(o=!1,r||lt(t,i)):ht(t,i));o&&at.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?G(U,t.x,t.y):V(U,t.x,t.y))),q(U,t)},setPoint(t,e){at.set(t,e.x,e.y)},addPoint(t,e){ht(t,e,!0)},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=E.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=E.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=at.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=at.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){if(s&&(e=at.tempToOuterOf(e,s)),!at.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:r,y:i,width:o,height:n}=e;return tt=r+o,et=i+n,st=t.x+t.width,rt=t.y+t.height,r=r>t.x?r:t.x,i=i>t.y?i:t.y,tt=tt<st?tt:st,et=et<rt?et:rt,o=tt-r,n=et-i,{x:r,y:i,width:o,height:n}},intersect(t,e,s){at.copy(t,at.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){at.set(t)}},at=nt,{add:ht,copy:lt}=at;class dt{get minX(){return nt.minX(this)}get minY(){return nt.minY(this)}get maxX(){return nt.maxX(this)}get maxY(){return nt.maxY(this)}constructor(t,e,s,r){this.set(t,e,s,r)}set(t,e,s,r){return"object"==typeof t?nt.copy(this,t):nt.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 dt(this)}move(t,e){return nt.move(this,t,e),this}scale(t,e){return nt.scale(this,t,e),this}scaleOf(t,e,s){return nt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return nt.toOuterOf(this,t,e),this}toInnerOf(t,e){return nt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return nt.getFitMatrix(this,t,e)}spread(t,e){return nt.spread(this,t,e),this}shrink(t,e){return nt.shrink(this,t,e),this}ceil(){return nt.ceil(this),this}unsign(){return nt.unsign(this),this}float(t){return nt.float(this,t),this}add(t){return nt.add(this,t),this}addList(t){return nt.setList(this,t,!0),this}setList(t){return nt.setList(this,t),this}addListWithFn(t,e){return nt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return nt.setListWithFn(this,t,e),this}setPoint(t){return nt.setPoint(this,t),this}setPoints(t){return nt.setPoints(this,t),this}addPoint(t){return nt.addPoint(this,t),this}getPoints(){return nt.getPoints(this)}hitPoint(t,e){return nt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return nt.hitRadiusPoint(this,t,e)}hit(t,e){return nt.hit(this,t,e)}includes(t,e){return nt.includes(this,t,e)}intersect(t,e){return nt.intersect(this,t,e),this}getIntersect(t,e){return new dt(nt.getIntersectData(this,t,e))}isSame(t){return nt.isSame(this,t)}isEmpty(){return nt.isEmpty(this)}reset(){nt.reset(this)}}const ut=new dt;var ct,pt;exports.Direction4=void 0,(ct=exports.Direction4||(exports.Direction4={}))[ct.top=0]="top",ct[ct.right=1]="right",ct[ct.bottom=2]="bottom",ct[ct.left=3]="left",exports.Direction9=void 0,(pt=exports.Direction9||(exports.Direction9={}))[pt.topLeft=0]="topLeft",pt[pt.top=1]="top",pt[pt.topRight=2]="topRight",pt[pt.right=3]="right",pt[pt.bottomRight=4]="bottomRight",pt[pt.bottom=5]="bottom",pt[pt.bottomLeft=6]="bottomLeft",pt[pt.left=7]="left",pt[pt.center=8]="center",pt[pt["top-left"]=0]="top-left",pt[pt["top-right"]=2]="top-right",pt[pt["bottom-right"]=4]="bottom-right",pt[pt["bottom-left"]=6]="bottom-left";const _t=[{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}];_t.forEach((t=>t.type="percent"));const ft={directionData:_t,tempPoint:{},get:gt,toPoint(t,e,s,r,i){const o=gt(t);s.x=o.x,s.y=o.y,"percent"===o.type&&(s.x*=e.width,s.y*=e.height,i&&(s.x-=i.x,s.y-=i.y,o.x&&(s.x-=1===o.x?i.width:.5===o.x?o.x*i.width:0),o.y&&(s.y-=1===o.y?i.height:.5===o.y?o.y*i.height:0))),r||(s.x+=e.x,s.y+=e.y)}};function gt(t){return"string"==typeof t?_t[exports.Direction9[t]]:t}const{toPoint:yt}=ft,xt={toPoint(t,e,s,r,i){yt(t,s,r,i,e)}},mt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:wt}=a;class bt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new bt(t)}static set filter(t){this.filterList=vt(t)}static set exclude(t){this.excludeList=vt(t)}static drawRepaint(t,e){const s=wt();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const r="hit"===bt.showBounds,i=t.__nowWorld,o=wt();r&&(e.setWorld(i),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),r?e.stroke():e.strokeWorld(i,o)}log(...t){if(Bt.enable){if(Bt.filterList.length&&Bt.filterList.every((t=>t!==this.name)))return;if(Bt.excludeList.length&&Bt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Bt.enable&&this.warn(...t)}warn(...t){Bt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function vt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}bt.filterList=[],bt.excludeList=[],bt.showWarn=!0;const Bt=bt,kt=bt.get("RunTime"),Ct={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const r=s.create(s.RUNTIME);return Tt.currentId=Tt.idMap[r]=e?performance.now():Date.now(),Tt.currentName=Tt.nameMap[r]=t,Tt.nameToIdMap[t]=r,r},end(t,e){const s=Tt.idMap[t],r=Tt.nameMap[t],i=e?(performance.now()-s)/1e3:Date.now()-s;Tt.idMap[t]=Tt.nameMap[t]=Tt.nameToIdMap[r]=void 0,kt.log(r,i,"ms")},endOfName(t,e){const s=Tt.nameToIdMap[t];void 0!==s&&Tt.end(s,e)}},Tt=Ct,Ot=[],Pt={list:{},add(t,...e){this.list[t]=!0,Ot.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>Ot.forEach((t=>Pt.has(t,!0)))));const Lt=bt.get("UICreator"),Rt={list:{},register(t){const{__tag:e}=t.prototype;St[e]&&Lt.repeat(e),St[e]=t},get(t,e,s,r,i,o){St[t]||Lt.error("not register "+t);const n=new St[t](e);return void 0!==s&&(n.x=s,r&&(n.y=r),i&&(n.width=i),o&&(n.height=o)),n}},{list:St}=Rt,It=bt.get("EventCreator"),Mt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Et[e]&&It.repeat(e),Et[e]=t)}))},changeName(t,e){const s=Et[t];if(s){const r=Object.keys(s).find((e=>s[e]===t));r&&(s[r]=e,Et[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Et[t](...e)},{nameList:Et}=Mt;const At={default:(t,e)=>(Wt(e,t),Wt(t,e),t),assign(t,e,s){let r;Object.keys(e).forEach((i=>{var o,n;if(r=e[i],(null==r?void 0:r.constructor)===Object&&(null===(o=t[i])||void 0===o?void 0:o.constructor)===Object)return Wt(t[i],e[i],s&&s[i]);s&&i in s?(null===(n=s[i])||void 0===n?void 0:n.constructor)===Object&&Wt(t[i]={},e[i],s[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)),toMap(t){const e={};for(let s=0,r=t.length;s<r;s++)e[t[s]]=!0;return e}},{assign:Wt}=At;class Dt{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(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}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(t instanceof Array)for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:r}=this;s.tag=this.__leaf.tag;for(let i in this)if("_"!==i[0]&&(t=this["_"+i],void 0!==t)){if("path"===i&&!this.__pathInputed)continue;e=r?r[i]:void 0,s[i]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:r,d:i,e:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:r,d:i,e:o,f:n}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}var Nt;exports.Answer=void 0,(Nt=exports.Answer||(exports.Answer={}))[Nt.No=0]="No",Nt[Nt.Yes=1]="Yes",Nt[Nt.NoAndSkip=2]="NoAndSkip",Nt[Nt.YesAndSkip=3]="YesAndSkip";function Yt(t){return"{}"===JSON.stringify(t)}function Xt(t,e,s,r){var i,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(n=(o<3?i(n):o>3?i(e,s,n):i(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function zt(t,e,s,r){return new(s||(s=Promise))((function(i,o){function n(t){try{h(r.next(t))}catch(t){o(t)}}function a(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(n,a)}h((r=r.apply(t,e||[])).next())}))}function Ft(t){return(e,s)=>{t||(t=s),Object.defineProperty(e,s,{get(){return this.context[t]},set(e){this.context[t]=e}})}}"function"==typeof SuppressedError&&SuppressedError;const jt=[];function Ht(){return(t,e)=>{jt.push(e)}}const Ut=[];class Gt{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||Ut)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;jt.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,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/r*a;r+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/i*h;i+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,r,i,o,n,a,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,n,a){}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}}Xt([Ft("imageSmoothingEnabled")],Gt.prototype,"smooth",void 0),Xt([Ft("imageSmoothingQuality")],Gt.prototype,"smoothLevel",void 0),Xt([Ft("globalAlpha")],Gt.prototype,"opacity",void 0),Xt([Ft()],Gt.prototype,"fillStyle",void 0),Xt([Ft()],Gt.prototype,"strokeStyle",void 0),Xt([Ft("lineWidth")],Gt.prototype,"strokeWidth",void 0),Xt([Ft("lineCap")],Gt.prototype,"strokeCap",void 0),Xt([Ft("lineJoin")],Gt.prototype,"strokeJoin",void 0),Xt([Ft("lineDashOffset")],Gt.prototype,"dashOffset",void 0),Xt([Ft()],Gt.prototype,"miterLimit",void 0),Xt([Ft()],Gt.prototype,"shadowBlur",void 0),Xt([Ft()],Gt.prototype,"shadowColor",void 0),Xt([Ft()],Gt.prototype,"shadowOffsetX",void 0),Xt([Ft()],Gt.prototype,"shadowOffsetY",void 0),Xt([Ft()],Gt.prototype,"filter",void 0),Xt([Ft()],Gt.prototype,"font",void 0),Xt([Ft()],Gt.prototype,"fontKerning",void 0),Xt([Ft()],Gt.prototype,"fontStretch",void 0),Xt([Ft()],Gt.prototype,"fontVariantCaps",void 0),Xt([Ft()],Gt.prototype,"textAlign",void 0),Xt([Ft()],Gt.prototype,"textBaseline",void 0),Xt([Ft()],Gt.prototype,"textRendering",void 0),Xt([Ft()],Gt.prototype,"wordSpacing",void 0),Xt([Ft()],Gt.prototype,"letterSpacing",void 0),Xt([Ft()],Gt.prototype,"direction",void 0),Xt([Ht()],Gt.prototype,"setTransform",null),Xt([Ht()],Gt.prototype,"resetTransform",null),Xt([Ht()],Gt.prototype,"getTransform",null),Xt([Ht()],Gt.prototype,"save",null),Xt([Ht()],Gt.prototype,"restore",null),Xt([Ht()],Gt.prototype,"translate",null),Xt([Ht()],Gt.prototype,"scale",null),Xt([Ht()],Gt.prototype,"rotate",null),Xt([Ht()],Gt.prototype,"fill",null),Xt([Ht()],Gt.prototype,"stroke",null),Xt([Ht()],Gt.prototype,"clip",null),Xt([Ht()],Gt.prototype,"fillRect",null),Xt([Ht()],Gt.prototype,"strokeRect",null),Xt([Ht()],Gt.prototype,"clearRect",null),Xt([Ht()],Gt.prototype,"beginPath",null),Xt([Ht()],Gt.prototype,"moveTo",null),Xt([Ht()],Gt.prototype,"lineTo",null),Xt([Ht()],Gt.prototype,"bezierCurveTo",null),Xt([Ht()],Gt.prototype,"quadraticCurveTo",null),Xt([Ht()],Gt.prototype,"closePath",null),Xt([Ht()],Gt.prototype,"arc",null),Xt([Ht()],Gt.prototype,"arcTo",null),Xt([Ht()],Gt.prototype,"ellipse",null),Xt([Ht()],Gt.prototype,"rect",null),Xt([Ht()],Gt.prototype,"roundRect",null),Xt([Ht()],Gt.prototype,"createConicGradient",null),Xt([Ht()],Gt.prototype,"createLinearGradient",null),Xt([Ht()],Gt.prototype,"createPattern",null),Xt([Ht()],Gt.prototype,"createRadialGradient",null),Xt([Ht()],Gt.prototype,"fillText",null),Xt([Ht()],Gt.prototype,"measureText",null),Xt([Ht()],Gt.prototype,"strokeText",null);const{copy:Vt,multiplyParent:qt}=v,{round:Qt}=Math,Jt={width:1,height:1,pixelRatio:1},Zt=["width","height","pixelRatio"];const $t={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Kt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},te=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},Kt),ee={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},se={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},re=Object.assign(Object.assign({},se),Kt),ie=te,oe={};for(let t in ie)oe[ie[t]]=t;const ne={};for(let t in ie)ne[ie[t]]=ee[t];const ae={drawRoundRect(t,e,s,r,i,o){const n=a.fourNumber(o,Math.min(r/2,i/2)),h=e+r,l=s+i;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(h,s,h,l,n[1]):t.lineTo(h,s),n[2]?t.arcTo(h,l,e,l,n[2]):t.lineTo(h,l),n[3]?t.arcTo(e,l,e,s,n[3]):t.lineTo(e,l),n[0]?t.arcTo(e,s,h,s,n[0]):t.lineTo(e,s)}},{sin:he,cos:le,atan2:de,ceil:ue,abs:ce,PI:pe,sqrt:_e,pow:fe}=Math,{setPoint:ge,addPoint:ye}=j,{set:xe,toNumberPoints:me}=E,{M:we,L:be,C:ve,Q:Be,Z:ke}=te,Ce={},Te={points(t,e,s,r){let i=me(e);if(t.push(we,i[0],i[1]),s&&i.length>5){let e,o,n,a,h,l,d,u,c,p,_,f,g,y=i.length;const x=!0===s?.5:s;r&&(i=[i[y-2],i[y-1],...i,i[0],i[1],i[2],i[3]],y=i.length);for(let s=2;s<y-2;s+=2)e=i[s-2],o=i[s-1],n=i[s],a=i[s+1],h=i[s+2],l=i[s+3],_=_e(fe(n-e,2)+fe(a-o,2)),f=_e(fe(h-n,2)+fe(l-a,2)),g=_+f,_=x*_/g,f=x*f/g,h-=e,l-=o,d=n-_*h,u=a-_*l,2===s?r||t.push(Be,d,u,n,a):t.push(ve,c,p,d,u,n,a),c=n+f*h,p=a+f*l;r||t.push(Be,c,p,i[y-2],i[y-1])}else for(let e=2,s=i.length;e<s;e+=2)t.push(be,i[e],i[e+1]);r&&t.push(ke)},rect(t,e,s,r,i){$t.creator.path=t,$t.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){$t.creator.path=[],ae.drawRoundRect($t.creator,e,s,r,i,o),t.push(...$t.convertToCanvasData($t.creator.path,!0))},arcTo(t,e,s,r,i,o,n,a,h,c,p){const _=r-e,f=i-s,g=o-r,y=n-i;let x=de(f,_),m=de(y,g),w=m-x;if(w<0&&(w+=d),w===pe||ce(_+f)<1e-12||ce(g+y)<1e-12)return t&&t.push(be,r,i),h&&(ge(h,e,s),ye(h,r,i)),p&&xe(p,e,s),void(c&&xe(c,r,i));const b=_*y-g*f<0,v=b?-1:1,B=a/le(w/2),k=r+B*le(x+w/2+u*v),C=i+B*he(x+w/2+u*v);return x-=u*v,m-=u*v,Le(t,k,C,a,a,0,x/l,m/l,b,h,c,p)},arc:(t,e,s,r,i,o,n,a,h,l)=>Le(t,e,s,r,r,0,i,o,n,a,h,l),ellipse(t,e,s,r,i,o,n,a,h,c,p,_){const f=o*l,g=he(f),y=le(f);let x=n*l,m=a*l;x>pe&&(x-=d),m<0&&(m+=d);let w=m-x;w<0?w+=d:w>d&&(w-=d),h&&(w-=d);const b=ue(ce(w/u)),v=w/b,B=he(v/4),k=8/3*B*B/he(v/2);m=x+v;let C,T,O,P,L,R,S,I,M=le(x),E=he(x),A=O=y*r*M-g*i*E,W=P=g*r*M+y*i*E,D=e+O,N=s+P;t&&t.push(t.length?be:we,D,N),c&&ge(c,D,N),_&&xe(_,D,N);for(let o=0;o<b;o++)C=le(m),T=he(m),O=y*r*C-g*i*T,P=g*r*C+y*i*T,L=e+A-k*(y*r*E+g*i*M),R=s+W-k*(g*r*E-y*i*M),S=e+O+k*(y*r*T+g*i*C),I=s+P+k*(g*r*T-y*i*C),t&&t.push(ve,L,R,S,I,e+O,s+P),c&&Pe(e+A,s+W,L,R,S,I,e+O,s+P,c,!0),A=O,W=P,M=C,E=T,x=m,m+=v;p&&xe(p,e+O,s+P)},quadraticCurveTo(t,e,s,r,i,o,n){t.push(ve,(e+2*r)/3,(s+2*i)/3,(o+2*r)/3,(n+2*i)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,r,i,o,n,a){Pe(t,e,(t+2*s)/3,(e+2*r)/3,(i+2*s)/3,(o+2*r)/3,i,o,n,a)},toTwoPointBounds(t,e,s,r,i,o,n,a,h,l){const d=[];let u,c,p,_,f,g,y,x,m=t,w=s,b=i,v=n;for(let t=0;t<2;++t)if(1==t&&(m=e,w=r,b=o,v=a),u=-3*m+9*w-9*b+3*v,c=6*m-12*w+6*b,p=3*w-3*m,Math.abs(u)<1e-12){if(Math.abs(c)<1e-12)continue;_=-p/c,0<_&&_<1&&d.push(_)}else y=c*c-4*p*u,x=Math.sqrt(y),y<0||(f=(-c+x)/(2*u),0<f&&f<1&&d.push(f),g=(-c-x)/(2*u),0<g&&g<1&&d.push(g));l?ye(h,t,e):ge(h,t,e),ye(h,n,a);for(let l=0,u=d.length;l<u;l++)Oe(d[l],t,e,s,r,i,o,n,a,Ce),ye(h,Ce.x,Ce.y)},getPointAndSet(t,e,s,r,i,o,n,a,h,l){const d=1-t,u=d*d*d,c=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=u*e+c*r+p*o+_*a,l.y=u*s+c*i+p*n+_*h},getPoint(t,e,s,r,i,o,n,a,h){const l={};return Oe(t,e,s,r,i,o,n,a,h,l),l}},{getPointAndSet:Oe,toTwoPointBounds:Pe,ellipse:Le}=Te,{sin:Re,cos:Se,sqrt:Ie,atan2:Me}=Math,{ellipse:Ee}=Te,Ae={ellipticalArc(e,s,r,i,o,n,a,h,u,c,p){const _=(u-s)/2,f=(c-r)/2,g=n*l,y=Re(g),x=Se(g),m=-x*_-y*f,w=-x*f+y*_,b=i*i,v=o*o,B=w*w,k=m*m,C=b*v-b*B-v*k;let T=0;if(C<0){const t=Ie(1-C/(b*v));i*=t,o*=t}else T=(a===h?-1:1)*Ie(C/(b*B+v*k));const O=T*i*w/o,P=-T*o*m/i,L=Me((w-P)/o,(m-O)/i),R=Me((-w-P)/o,(-m-O)/i);let S=R-L;0===h&&S>0?S-=d:1===h&&S<0&&(S+=d);const I=s+_+x*O-y*P,M=r+f+y*O+x*P,E=S<0?1:0;p||t.ellipseToCurve?Ee(e,I,M,i,o,n,L/l,R/l,E):i!==o||n?e.push(te.G,I,M,i,o,n,L/l,R/l,E):e.push(te.O,I,M,i,L/l,R/l,E)}},{M:We,m:De,L:Ne,l:Ye,H:Xe,h:ze,V:Fe,v:je,C:He,c:Ue,S:Ge,s:Ve,Q:qe,q:Qe,T:Je,t:Ze,A:$e,a:Ke,Z:ts,z:es,N:ss,D:rs,X:is,G:os,F:ns,O:as,P:hs,U:ls}=te,{rect:ds,roundRect:us,arcTo:cs,arc:ps,ellipse:_s,quadraticCurveTo:fs}=Te,{ellipticalArc:gs}=Ae,ys=bt.get("PathConvert"),xs={},ms={current:{dot:0},stringify(t,e){let s,r,i,o=0,n=t.length,h="";for(;o<n;){r=t[o],s=ne[r],h+=r===i?" ":oe[r];for(let r=1;r<s;r++)h+=a.float(t[o+r],e),r===s-1||(h+=" ");i=r,o+=s}return h},parse(t,e){let s,r,i,o="";const n=[],a=e?re:se;for(let e=0,h=t.length;e<h;e++)r=t[e],mt[r]?("."===r&&(ws.dot&&(bs(n,o),o=""),ws.dot++),"0"===o&&"."!==r&&(bs(n,o),o=""),o+=r):te[r]?(o&&(bs(n,o),o=""),ws.name=te[r],ws.length=ee[r],ws.index=0,bs(n,ws.name),!s&&a[r]&&(s=!0)):"-"===r||"+"===r?"e"===i||"E"===i?o+=r:(o&&bs(n,o),o=r):o&&(bs(n,o),o=""),i=r;return o&&bs(n,o),s?ms.toCanvasData(n,e):n},toCanvasData(t,e){let s,r,i,o,n,a=0,h=0,l=0,d=0,u=0,c=t.length;const p=[];for(;u<c;){switch(i=t[u],i){case De:t[u+1]+=a,t[u+2]+=h;case We:a=t[u+1],h=t[u+2],p.push(We,a,h),u+=3;break;case ze:t[u+1]+=a;case Xe:a=t[u+1],p.push(Ne,a,h),u+=2;break;case je:t[u+1]+=h;case Fe:h=t[u+1],p.push(Ne,a,h),u+=2;break;case Ye:t[u+1]+=a,t[u+2]+=h;case Ne:a=t[u+1],h=t[u+2],p.push(Ne,a,h),u+=3;break;case Ve:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=Ge;case Ge:n=o===He||o===Ge,l=n?2*a-s:t[u+1],d=n?2*h-r:t[u+2],s=t[u+1],r=t[u+2],a=t[u+3],h=t[u+4],p.push(He,l,d,s,r,a,h),u+=5;break;case Ue:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,t[u+5]+=a,t[u+6]+=h,i=He;case He:s=t[u+3],r=t[u+4],a=t[u+5],h=t[u+6],p.push(He,t[u+1],t[u+2],s,r,a,h),u+=7;break;case Ze:t[u+1]+=a,t[u+2]+=h,i=Je;case Je:n=o===qe||o===Je,s=n?2*a-s:t[u+1],r=n?2*h-r:t[u+2],e?fs(p,a,h,s,r,t[u+1],t[u+2]):p.push(qe,s,r,t[u+1],t[u+2]),a=t[u+1],h=t[u+2],u+=3;break;case Qe:t[u+1]+=a,t[u+2]+=h,t[u+3]+=a,t[u+4]+=h,i=qe;case qe:s=t[u+1],r=t[u+2],e?fs(p,a,h,s,r,t[u+3],t[u+4]):p.push(qe,s,r,t[u+3],t[u+4]),a=t[u+3],h=t[u+4],u+=5;break;case Ke:t[u+6]+=a,t[u+7]+=h;case $e:gs(p,a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],e),a=t[u+6],h=t[u+7],u+=8;break;case es:case ts:p.push(ts),u++;break;case ss:a=t[u+1],h=t[u+2],e?ds(p,a,h,t[u+3],t[u+4]):vs(p,t,u,5),u+=5;break;case rs:a=t[u+1],h=t[u+2],e?us(p,a,h,t[u+3],t[u+4],[t[u+5],t[u+6],t[u+7],t[u+8]]):vs(p,t,u,9),u+=9;break;case is:a=t[u+1],h=t[u+2],e?us(p,a,h,t[u+3],t[u+4],t[u+5]):vs(p,t,u,6),u+=6;break;case os:_s(e?p:vs(p,t,u,9),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],t[u+7],t[u+8],null,xs),a=xs.x,h=xs.y,u+=9;break;case ns:e?_s(p,t[u+1],t[u+2],t[u+3],t[u+4],0,0,360,!1):vs(p,t,u,5),a=t[u+1]+t[u+3],h=t[u+2],u+=5;break;case as:ps(e?p:vs(p,t,u,7),t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],t[u+6],null,xs),a=xs.x,h=xs.y,u+=7;break;case hs:e?ps(p,t[u+1],t[u+2],t[u+3],0,360,!1):vs(p,t,u,4),a=t[u+1]+t[u+3],h=t[u+2],u+=4;break;case ls:cs(e?p:vs(p,t,u,6),a,h,t[u+1],t[u+2],t[u+3],t[u+4],t[u+5],null,xs),a=xs.x,h=xs.y,u+=6;break;default:return ys.error(`command: ${i} [index:${u}]`,t),p}o=i}return p},objectToCanvasData(t){const e=[];return t.forEach((t=>{switch(t.name){case"M":e.push(We,t.x,t.y);break;case"L":e.push(Ne,t.x,t.y);break;case"C":e.push(He,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(qe,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(ts)}})),e},copyData(t,e,s,r){for(let i=s,o=s+r;i<o;i++)t.push(e[i])},pushData(t,e){ws.index===ws.length&&(ws.index=1,t.push(ws.name)),t.push(Number(e)),ws.index++,ws.dot=0}},{current:ws,pushData:bs,copyData:vs}=ms,{M:Bs,L:ks,C:Cs,Q:Ts,Z:Os,N:Ps,D:Ls,X:Rs,G:Ss,F:Is,O:Ms,P:Es,U:As}=te,{getMinDistanceFrom:Ws,getRadianFrom:Ds}=E,{tan:Ns,min:Ys,abs:Xs}=Math,zs={},Fs={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Bs,e,s)},lineTo(t,e,s){t.push(ks,e,s)},bezierCurveTo(t,e,s,r,i,o,n){t.push(Cs,e,s,r,i,o,n)},quadraticCurveTo(t,e,s,r,i){t.push(Ts,e,s,r,i)},closePath(t){t.push(Os)},rect(t,e,s,r,i){t.push(Ps,e,s,r,i)},roundRect(t,e,s,r,i,o){if("number"==typeof o)t.push(Rs,e,s,r,i,o);else{const n=a.fourNumber(o);n?t.push(Ls,e,s,r,i,...n):t.push(Ps,e,s,r,i)}},ellipse(t,e,s,r,i,o,n,a,h){void 0===o?t.push(Is,e,s,r,i):(void 0===n&&(n=0),void 0===a&&(a=360),t.push(Ss,e,s,r,i,o,n,a,h?1:0))},arc(t,e,s,r,i,o,n){void 0===i?t.push(Es,e,s,r):(void 0===o&&(o=360),t.push(Ms,e,s,r,i,o,n?1:0))},arcTo(t,e,s,r,i,o,n,a){if(void 0!==n){const t=Ws(n,a,e,s,r,i);o=Ys(o,Ys(t/2,t/2*Xs(Ns(Ds(n,a,e,s,r,i)/2))))}t.push(As,e,s,r,i,o)},drawEllipse(t,e,s,r,i,o,n,a,h){Te.ellipse(null,e,s,r,i,void 0===o?0:o,void 0===n?0:n,void 0===a?360:a,h,null,null,zs),t.push(Bs,zs.x,zs.y),js(t,e,s,r,i,o,n,a,h)},drawArc(t,e,s,r,i,o,n){Te.arc(null,e,s,r,void 0===i?0:i,void 0===o?360:o,n,null,null,zs),t.push(Bs,zs.x,zs.y),Hs(t,e,s,r,i,o,n)},drawPoints(t,e,s,r){Te.points(t,e,s,r)}},{ellipse:js,arc:Hs}=Fs,{moveTo:Us,lineTo:Gs,quadraticCurveTo:Vs,bezierCurveTo:qs,closePath:Qs,beginPath:Js,rect:Zs,roundRect:$s,ellipse:Ks,arc:tr,arcTo:er,drawEllipse:sr,drawArc:rr,drawPoints:ir}=Fs;class or{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?"string"==typeof t?$t.parse(t):t:[],this}beginPath(){return Js(this.__path),this.paint(),this}moveTo(t,e){return Us(this.__path,t,e),this.paint(),this}lineTo(t,e){return Gs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,r,i,o){return qs(this.__path,t,e,s,r,i,o),this.paint(),this}quadraticCurveTo(t,e,s,r){return Vs(this.__path,t,e,s,r),this.paint(),this}closePath(){return Qs(this.__path),this.paint(),this}rect(t,e,s,r){return Zs(this.__path,t,e,s,r),this.paint(),this}roundRect(t,e,s,r,i){return $s(this.__path,t,e,s,r,i),this.paint(),this}ellipse(t,e,s,r,i,o,n,a){return Ks(this.__path,t,e,s,r,i,o,n,a),this.paint(),this}arc(t,e,s,r,i,o){return tr(this.__path,t,e,s,r,i,o),this.paint(),this}arcTo(t,e,s,r,i){return er(this.__path,t,e,s,r,i),this.paint(),this}drawEllipse(t,e,s,r,i,o,n,a){return sr(this.__path,t,e,s,r,i,o,n,a),this.paint(),this}drawArc(t,e,s,r,i,o){return rr(this.__path,t,e,s,r,i,o),this.paint(),this}drawPoints(t,e,s){return ir(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:nr,L:ar,C:hr,Q:lr,Z:dr,N:ur,D:cr,X:pr,G:_r,F:fr,O:gr,P:yr,U:xr}=te,mr=bt.get("PathDrawer"),wr={drawPathByData(t,e){if(!e)return;let s,r=0,i=e.length;for(;r<i;)switch(s=e[r],s){case nr:t.moveTo(e[r+1],e[r+2]),r+=3;break;case ar:t.lineTo(e[r+1],e[r+2]),r+=3;break;case hr:t.bezierCurveTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5],e[r+6]),r+=7;break;case lr:t.quadraticCurveTo(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case dr:t.closePath(),r+=1;break;case ur:t.rect(e[r+1],e[r+2],e[r+3],e[r+4]),r+=5;break;case cr: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 pr:t.roundRect(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;case _r:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]*l,e[r+6]*l,e[r+7]*l,e[r+8]),r+=9;break;case fr:t.ellipse(e[r+1],e[r+2],e[r+3],e[r+4],0,0,d,!1),r+=5;break;case gr:t.arc(e[r+1],e[r+2],e[r+3],e[r+4]*l,e[r+5]*l,e[r+6]),r+=7;break;case yr:t.arc(e[r+1],e[r+2],e[r+3],0,d,!1),r+=4;break;case xr:t.arcTo(e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]),r+=6;break;default:return void mr.error(`command: ${s} [index:${r}]`,e)}}},{M:br,L:vr,C:Br,Q:kr,Z:Cr,N:Tr,D:Or,X:Pr,G:Lr,F:Rr,O:Sr,P:Ir,U:Mr}=te,{toTwoPointBounds:Er,toTwoPointBoundsByQuadraticCurve:Ar,arcTo:Wr,arc:Dr,ellipse:Nr}=Te,{addPointBounds:Yr,copy:Xr,addPoint:zr,setPoint:Fr,addBounds:jr,toBounds:Hr}=j,Ur=bt.get("PathBounds");let Gr,Vr,qr;const Qr={},Jr={},Zr={},$r={toBounds(t,e){$r.toTwoPointBounds(t,Jr),Hr(Jr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Fr(e,0,0);let s,r,i,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===Cr||n===Br||n===kr?Fr(e,h,l):Fr(e,t[a+1],t[a+2])),n){case br:case vr:h=t[a+1],l=t[a+2],zr(e,h,l),a+=3;break;case Br:i=t[a+5],o=t[a+6],Er(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,o,Qr),Yr(e,Qr),h=i,l=o,a+=7;break;case kr:s=t[a+1],r=t[a+2],i=t[a+3],o=t[a+4],Ar(h,l,s,r,i,o,Qr),Yr(e,Qr),h=i,l=o,a+=5;break;case Cr:a+=1;break;case Tr:h=t[a+1],l=t[a+2],jr(e,h,l,t[a+3],t[a+4]),a+=5;break;case Or:case Pr:h=t[a+1],l=t[a+2],jr(e,h,l,t[a+3],t[a+4]),a+=n===Or?9:6;break;case Lr:Nr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],Qr,Zr),0===a?Xr(e,Qr):Yr(e,Qr),h=Zr.x,l=Zr.y,a+=9;break;case Rr:h=t[a+1],l=t[a+2],Vr=t[a+3],qr=t[a+4],jr(e,h-Vr,l-qr,2*Vr,2*qr),h+=Vr,a+=5;break;case Sr:Dr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Qr,Zr),0===a?Xr(e,Qr):Yr(e,Qr),h=Zr.x,l=Zr.y,a+=7;break;case Ir:h=t[a+1],l=t[a+2],Gr=t[a+3],jr(e,h-Gr,l-Gr,2*Gr,2*Gr),h+=Gr,a+=4;break;case Mr:Wr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Qr,Zr),0===a?Xr(e,Qr):Yr(e,Qr),h=Zr.x,l=Zr.y,a+=6;break;default:return void Ur.error(`command: ${n} [index:${a}]`,t)}}},{M:Kr,L:ti,Z:ei}=te,{getCenterX:si,getCenterY:ri}=E,{arcTo:ii}=Fs,oi={smooth(t,e,s){let r,i,o=0,n=0,a=0,h=0,l=0,d=0,u=0,c=0,p=0;const _=t.length,f=[];for(;o<_;)switch(r=t[o],r){case Kr:h=c=t[o+1],l=p=t[o+2],o+=3,t[o]===ti?(d=t[o+1],u=t[o+2],f.push(Kr,si(h,d),ri(l,u))):f.push(Kr,h,l);break;case ti:switch(n=t[o+1],a=t[o+2],o+=3,t[o]){case ti:ii(f,n,a,t[o+1],t[o+2],e,c,p);break;case ei:ii(f,n,a,h,l,e,c,p);break;default:f.push(ti,n,a)}c=n,p=a;break;case ei:ii(f,h,l,d,u,e,c,p),f.push(ei),o+=1;break;default:i=ne[r];for(let e=0;e<i;e++)f.push(t[o+e]);o+=i}return r!==ei&&(f[1]=h,f[2]=l),f}};$t.creator=new or,$t.parse=ms.parse,$t.convertToCanvasData=ms.toCanvasData;const ni=new or,{drawRoundRect:ai}=ae;const hi={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]},isOpaqueImage(t){const e=li.fileType(t);return["jpg","jpeg"].some((t=>t===e))},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},li=hi;li.opacityTypes.forEach((t=>li.upperCaseTypeMap[t]=t.toUpperCase()));const di=bt.get("TaskProcessor");class ui{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return zt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){di.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class ci{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&&At.assign(this.config,t),this.empty()}add(t,e){let s,r,i,o;const n=new ui(t);return n.parent=this,"number"==typeof e?o=e:e&&(r=e.parallel,s=e.start,i=e.time,o=e.delay),i&&(n.time=i),!1===r&&(n.parallel=!1),void 0===o?this.push(n,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(n,s))}),o)),this.isComplete=!1,n}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 pi=bt.get("Resource"),_i={tasker:new ci,map:{},get isComplete(){return fi.tasker.isComplete},set(t,e){fi.map[t]&&pi.repeat(t),fi.map[t]=e},get:t=>fi.map[t],remove(t){const e=fi.map[t];e&&(e.destroy&&e.destroy(),delete fi.map[t])},loadImage(t,e){return new Promise(((s,r)=>{const i=this.setImage(t,t,e);i.load((()=>s(i)),(t=>r(t)))}))},setImage(t,s,r){let i;return"string"==typeof s?i={url:s}:s.url||(i={url:t,view:s}),i&&(r&&(i.format=r),s=e.image(i)),fi.set(t,s),s},destroy(){fi.map={}}},fi=_i,gi={maxRecycled:10,recycledList:[],patternTasker:new ci,get(t){let s=_i.get(t.url);return s||_i.set(t.url,s=e.image(t)),s.use++,s},recycle(t){t.use--,setTimeout((()=>{t.use||yi.recycledList.push(t)}))},clearRecycled(){const t=yi.recycledList;t.length>yi.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&_i.remove(t.url))),t.length=0)},hasOpacityPixel:t=>hi.opacityTypes.some((e=>yi.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+hi.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+hi.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){yi.recycledList=[]}},yi=gi,{IMAGE:xi,create:mi}=s;function wi(t,e,s,r){r||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function bi(t,e){return Object.getOwnPropertyDescriptor(t,e)}function vi(t,e){return(s,r)=>ki(s,r,t,e&&e(r))}function Bi(t){return t}function ki(t,e,s,r){const i={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};wi(t,e,Object.assign(i,r||{})),Mi(t,e,s)}function Ci(t,e){return vi(t,(t=>({set(s){this.__setAttr(t,s,e)&&Ti(this)}})))}function Ti(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}const Oi=Ci;function Pi(t){return vi(t,(t=>({set(e){this.__setAttr(t,e)&&Li(this)}})))}function Li(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Ti(t)}const Ri=Pi;function Si(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Ii(t,e,s,r){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==r&&0!==s||Ti(t))}function Mi(t,e,s){const r=t.__DataProcessor.prototype,i="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[i];return void 0===t?s:t},set(t){this[i]=t}};if(void 0===s)n.get=function(){return this[i]};else if("function"==typeof s)n.get=function(){let t=this[i];return void 0===t?s(this.__leaf):t};else if("object"==typeof s){const t=Yt(s);n.get=function(){let e=this[i];return void 0===e?this[i]=t?{}:At.clone(s):e}}const a=t.isBranchLeaf;"width"===e?n.get=function(){const t=this[i];if(void 0===t){const t=this,e=t.__naturalWidth,r=t.__leaf;return!s||r.pathInputed?r.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:a&&r.children.length?r.boxBounds.width:s}return t}:"height"===e&&(n.get=function(){const t=this[i];if(void 0===t){const t=this,e=t.__naturalHeight,r=t.__leaf;return!s||r.pathInputed?r.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:a&&r.children.length?r.boxBounds.height:s}return t});let h,l=r;for(;!h&&l;)h=bi(l,e),l=l.__proto__;h&&h.set&&(n.set=h.set),r[o]&&(n.set=r[o],delete r[o]),wi(r,e,n)}const Ei=new bt("rewrite"),Ai=[],Wi=["destroy","constructor"];function Di(t){Ai.length&&(Ai.forEach((e=>{t&&Ei.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Ai.length=0)}function Ni(t,e){return s=>{var r;(t.prototype?(r=t.prototype,Object.getOwnPropertyNames(r)):Object.keys(t)).forEach((r=>{if(!(Wi.includes(r)||e&&e.includes(r)))if(t.prototype){bi(t.prototype,r).writable&&(s.prototype[r]=t.prototype[r])}else s.prototype[r]=t[r]}))}}setTimeout((()=>Di(!0)));const{copy:Yi,toInnerPoint:Xi,toOuterPoint:zi,scaleOfOuter:Fi,rotateOfOuter:ji,skewOfOuter:Hi,multiplyParent:Ui,divideParent:Gi,getLayout:Vi}=v,qi={},{round:Qi}=Math,Ji={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Ki(t,e,s),t.isBranch){const{children:r}=t;for(let t=0,i=r.length;t<i;t++)$i(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++)to(e[t])}},updateAllChange(t){if(to(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)eo(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s=0,r,i){const o="object"==typeof e?Object.assign({},e):{x:e,y:s};r?zi(t.localTransform,o,o,!0):t.parent&&Xi(t.parent.worldTransform,o,o,!0),Zi.moveLocal(t,o.x,o.y,i)},moveLocal(t,e,s=0,r){"object"==typeof e&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Qi(e),s=Qi(s)),r?t.animate({x:e,y:s},r):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,r,i,o){Zi.zoomOfLocal(t,so(t,e),s,r,i,o)},zoomOfLocal(t,e,s,r=s,i,o){const n=t.__localMatrix;if("number"!=typeof r&&(r&&(o=r),r=s),Yi(qi,n),Fi(qi,e,s,r),t.origin||t.around)Zi.setTransform(t,qi,i,o);else{const e=t.x+qi.e-n.e,a=t.y+qi.f-n.f;o&&!i?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*r},o):(t.x=e,t.y=a,t.scaleResize(s,r,!0!==i))}},rotateOfWorld(t,e,s,r){Zi.rotateOfLocal(t,so(t,e),s,r)},rotateOfLocal(t,e,s,r){const i=t.__localMatrix;Yi(qi,i),ji(qi,e,s),t.origin||t.around?Zi.setTransform(t,qi,!1,r):t.set({x:t.x+qi.e-i.e,y:t.y+qi.f-i.f,rotation:a.formatRotation(t.rotation+s)},r)},skewOfWorld(t,e,s,r,i,o){Zi.skewOfLocal(t,so(t,e),s,r,i,o)},skewOfLocal(t,e,s,r=0,i,o){Yi(qi,t.__localMatrix),Hi(qi,e,s,r),Zi.setTransform(t,qi,i,o)},transformWorld(t,e,s,r){Yi(qi,t.worldTransform),Ui(qi,e),t.parent&&Gi(qi,t.parent.worldTransform),Zi.setTransform(t,qi,s,r)},transform(t,e,s,r){Yi(qi,t.localTransform),Ui(qi,e),Zi.setTransform(t,qi,s,r)},setTransform(t,e,s,r){const i=t.__,o=i.origin&&Zi.getInnerOrigin(t,i.origin),n=Vi(e,o,i.around&&Zi.getInnerOrigin(t,i.around));if(s){const e=n.scaleX/t.scaleX,s=n.scaleY/t.scaleY;if(delete n.scaleX,delete n.scaleY,o){nt.scale(t.boxBounds,Math.abs(e),Math.abs(s));const r=Zi.getInnerOrigin(t,i.origin);E.move(n,o.x-r.x,o.y-r.y)}t.set(n),t.scaleResize(e,s,!1)}else t.set(n,r)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},r="x"===e?1:-1;return Fi(s,Zi.getLocalOrigin(t,"center"),-1*r,1*r),s},getLocalOrigin:(t,e)=>E.tempToOuterOf(Zi.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return ft.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Yi(qi,t.worldTransform),Gi(qi,e.worldTransform),s?qi:Object.assign({},qi)),drop(t,e,s,r){t.setTransform(Zi.getRelativeWorld(t,e,!0),r),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}}},Zi=Ji,{updateAllMatrix:$i,updateMatrix:Ki,updateAllWorldOpacity:to,updateAllChange:eo}=Zi;function so(t,e){return t.__layout.update(),t.parent?E.tempToInnerOf(e,t.parent.__world):e}const ro={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.mask?t.__localBoxBounds:null,maskLocalStrokeBounds:t=>t.__.mask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.mask?t.__layout.localRenderBounds:null,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))},{updateBounds:io}=Ji,oo={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),no(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),ho(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++)io(r[t]);e&&e===s||io(s)}}},{pushAllChildBranch:no,pushAllBranchStack:ao,updateBoundsByBranchStack:ho}=oo,lo={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:uo}=Ji,{toOuterOf:co,getPoints:po,copy:_o}=nt,fo="_localContentBounds",go="_worldContentBounds",yo="_worldBoxBounds",xo="_worldStrokeBounds";class mo{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return co(this.contentBounds,this.leaf.__localMatrix,this[fo]||(this[fo]={})),this[fo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return co(this.contentBounds,this.leaf.__world,this[go]||(this[go]={})),this[go]}get worldBoxBounds(){return co(this.boxBounds,this.leaf.__world,this[yo]||(this[yo]={})),this[yo]}get worldStrokeBounds(){return co(this.strokeBounds,this.leaf.__world,this[xo]||(this[xo]={})),this[xo]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{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;const s=e;if(s.__fullLayouting)return;s.__fullLayouting=!0,t.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return v.defaultMatrix;case"page":t=e.zoomLayer;default:return uo(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new dt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:r}=this;let i,o,n,a=this.getInnerBounds(t);switch(e){case"world":i=r.getWorldPoint(a),o=r.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=r.__;n={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},i=r.getLocalPointByInner(a);break;case"inner":i=a,o=v.defaultMatrix;break;case"page":e=r.zoomLayer;default:i=r.getWorldPoint(a,e),o=uo(r,e,!0)}if(n||(n=v.getLayout(o)),_o(n,a),E.copy(n,i),s){const{scaleX:t,scaleY:e}=n,s=Math.abs(t),r=Math.abs(e);1===s&&1===r||(n.scaleX/=s,n.scaleY/=r,n.width*=s,n.height*=r)}return n}getLayoutPoints(t,e="world"){const{leaf:s}=this,r=po(this.getInnerBounds(t));let i;switch(e){case"world":i=null;break;case"local":i=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:i=e}return void 0!==i&&r.forEach((t=>s.innerToWorld(t,null,!1,i))),r}shrinkContent(){const{x:t,y:e,width:s,height:r}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:r}}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}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class wo{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 bo extends wo{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}bo.ADD="child.add",bo.REMOVE="child.remove",bo.CREATED="created",bo.MOUNTED="mounted",bo.UNMOUNTED="unmounted",bo.DESTROY="destroy";class vo extends wo{constructor(t,e,s,r,i){super(t,e),this.attrName=s,this.oldValue=r,this.newValue=i}}vo.CHANGE="property.change",vo.LEAFER_CHANGE="property.leafer_change";class Bo extends wo{constructor(t,e){super(t),Object.assign(this,e)}}Bo.LOAD="image.load",Bo.LOADED="image.loaded",Bo.ERROR="image.error";class ko extends wo{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(ko.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&void 0!==this.resizingKeys[t.innerId]}}ko.RESIZE="resize";class Co extends wo{constructor(t,e){super(t),this.data=e}}Co.REQUEST="watch.request",Co.DATA="watch.data";class To extends wo{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}To.REQUEST="layout.request",To.START="layout.start",To.BEFORE="layout.before",To.LAYOUT="layout",To.AFTER="layout.after",To.AGAIN="layout.again",To.END="layout.end";class Oo extends wo{constructor(t,e,s,r){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=r)}}Oo.REQUEST="render.request",Oo.CHILD_START="render.child_start",Oo.CHILD_END="render.child_end",Oo.START="render.start",Oo.BEFORE="render.before",Oo.RENDER="render",Oo.AFTER="render.after",Oo.AGAIN="render.again",Oo.END="render.end",Oo.NEXT="render.next";class Po extends wo{}Po.START="leafer.start",Po.BEFORE_READY="leafer.before_ready",Po.READY="leafer.ready",Po.AFTER_READY="leafer.after_ready",Po.VIEW_READY="leafer.view_ready",Po.VIEW_COMPLETED="leafer.view_completed",Po.STOP="leafer.stop",Po.RESTART="leafer.restart",Po.END="leafer.end";const Lo={};class Ro{set event(t){this.on(t)}on(t,e,s){if(!e){let e,s=t;for(let t in s)e=s[t],e instanceof Array?this.on(t,e[0],e[1]):this.on(t,e);return}let r,i,o;s&&("once"===s?i=!0:"boolean"==typeof s?r=s:(r=s.capture,i=s.once));const n=So(this,r,!0),a="string"==typeof t?t.split(" "):t,h=i?{listener:e,once:i}:{listener:e};a.forEach((t=>{t&&(o=n[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):n[t]=[h])}))}off(t,e,s){if(t){const r="string"==typeof t?t.split(" "):t;if(e){let t,i,o;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const n=So(this,t);r.forEach((t=>{t&&(i=n[t],i&&(o=i.findIndex((t=>t.listener===e)),o>-1&&i.splice(o,1),i.length||delete n[t]))}))}else{const{__bubbleMap:t,__captureMap:e}=this;r.forEach((s=>{t&&delete t[s],e&&delete e[s]}))}}else this.__bubbleMap=this.__captureMap=void 0}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&&Mt.has(t)&&(e=Mt.get(t,{type:t,target:this,current:this}));const r=So(this,s)[t];if(r){let i;for(let o=0,n=r.length;o<n&&!((i=r[o])&&(i.listener(e),i.once&&(this.off(t,i.listener,s),o--,n--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:r}=this,i=s&&s[t],o=r&&r[t];return!!(void 0===e?i||o:e?o:i)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}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{on:Io,on_:Mo,off:Eo,off_:Ao,once:Wo,emit:Do,emitEvent:No,hasEvent:Yo,destroy:Xo}=Ro.prototype,zo={on:Io,on_:Mo,off:Eo,off_:Ao,once:Wo,emit:Do,emitEvent:No,hasEvent:Yo,destroyEventer:Xo},{isFinite:Fo}=Number,jo=bt.get("setAttr"),Ho={__setAttr(t,e,s){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(s&&!Fo(e)&&void 0!==e&&(jo.warn(this.innerName,t,e),e=void 0),"object"==typeof e||r!==e){this.__realSetAttr(t,e);const{CHANGE:s}=vo,i=new vo(s,this,t,r,e);return this.isLeafer?this.emitEvent(new vo(vo.LEAFER_CHANGE,this,t,r,e)):this.hasEvent(s)&&this.emitEvent(i),this.leafer.emitEvent(i),!0}return!1}return this.__realSetAttr(t,e),!0},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||void 0===s.normalStyle[t]||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Uo,multiplyParent:Go,translateInner:Vo,defaultWorld:qo}=v,{toPoint:Qo,tempPoint:Jo}=ft,Zo={__updateWorldMatrix(){Go(this.__local||this.__layout,this.parent?this.parent.__world:qo,this.__world,!!this.__layout.affectScaleOrRotation,this.__,this.parent&&this.parent.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged||t.rotationChanged)&&(Uo(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(Qo(s.around||s.origin,t.boxBounds,Jo),Vo(e,-Jo.x,-Jo.y,!s.around))}this.__layout.matrixChanged=!1}},{updateMatrix:$o,updateAllMatrix:Ko}=Ji,{updateBounds:tn}=oo,{toOuterOf:en,copyAndSpread:sn,copy:rn}=nt,{toBounds:on}=$r,nn={__updateWorldBounds(){en(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),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.boxChanged=!1,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.strokeSpread!==t.strokeBoxSpread)&&(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.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),en(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){en(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){en(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?on(e.path,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Ko(this),tn(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ko(this),tn(this,this))):$o(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;sn(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?sn(t.renderBounds,t.boxBounds,t.renderSpread):rn(t.renderBounds,t.strokeBounds)}},an={__render(t,e){if(this.__worldOpacity){const s=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!s.dimskip?s.opacity*e.dimOpacity:s.opacity,this.__.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const r=t.getSameCanvas(!0,!0);this.__draw(r,e,t),this.__worldFlipped?t.copyWorldByReset(r,this.__nowWorld,null,s.__blendMode,!0):t.copyWorldToInner(r,this.__nowWorld,this.__layout.renderBounds,s.__blendMode),r.recycle(this.__nowWorld)}else this.__draw(t,e);bt.showBounds&&bt.drawBounds(this,t,e)}},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.windingRule?t.clip(this.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:hn}=ro,ln={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const s=this.__;if(s.dim?e.dimOpacity=!0===s.dim?.2:s.dim:s.dimskip&&e.dimOpacity&&(e.dimOpacity=0),s.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const r=t.getSameCanvas(!1,!0);this.__renderBranch(r,e);const i=this.__nowWorld;t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(r,i,i,s.__blendMode,!0),r.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let r=0,i=s.length;r<i;r++)hn(s[r],e)||s[r].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let r=0,i=s.length;r<i;r++)hn(s[r],e)||s[r].__clip(t,e)}}},{LEAF:dn,create:un}=s,{toInnerPoint:cn,toOuterPoint:pn,multiplyParent:_n}=v,{toOuterOf:fn}=nt,{copy:gn,move:yn}=E,{moveLocal:xn,zoomOfLocal:mn,rotateOfLocal:wn,skewOfLocal:bn,moveWorld:vn,zoomOfWorld:Bn,rotateOfWorld:kn,skewOfWorld:Cn,transform:Tn,transformWorld:On,setTransform:Pn,getFlipTransform:Ln,getLocalOrigin:Rn,getRelativeWorld:Sn,drop:In}=Ji;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 Dt}get __LayoutProcessor(){return mo}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__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}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=un(dn),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(bo.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(bo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(bo.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer((()=>this.leafer.nextRender(t,e,s)))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(bo.MOUNTED)):this.__emitLifeEvent(bo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,r=e.length;s<r;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){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}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateContentBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.eraser))}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some((t=>t.__.mask&&t.__.visible&&t.__.opacity))}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,s=this.__world;return _n(s,t.matrix,e,void 0,s),fn(this.__layout.renderBounds,e,e),e.half!==s.half&&(e.half=s.half),e}return this.__world}getTransform(t){return this.__layout.getTransform(t||"local")}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)}getWorldBounds(t,e,s){const r=e?Sn(this,e):this.worldTransform,i=s?t:{};return fn(t,r,i),i}worldToLocal(t,e,s,r){this.parent?this.parent.worldToInner(t,e,s,r):e&&gn(e,t)}localToWorld(t,e,s,r){this.parent?this.parent.innerToWorld(t,e,s,r):e&&gn(e,t)}worldToInner(t,e,s,r){r&&(r.innerToWorld(t,e,s),t=e||t),cn(this.worldTransform,t,e,s)}innerToWorld(t,e,s,r){pn(this.worldTransform,t,e,s),r&&r.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,r){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,r),null,null,!0)}getBoxPointByInner(t,e,s,r){const i=r?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return yn(i,-o,-n),i}getInnerPoint(t,e,s,r){const i=r?t:{};return this.worldToInner(t,i,s,e),i}getInnerPointByBox(t,e,s,r){const i=r?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return yn(i,o,n),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)}getPagePoint(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,r)}getWorldPoint(t,e,s,r){const i=r?t:{};return this.innerToWorld(t,i,s,e),i}getWorldPointByBox(t,e,s,r){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,r),e,s,!0)}getWorldPointByLocal(t,e,s,r){const i=r?t:{};return this.localToWorld(t,i,s,e),i}getWorldPointByPage(t,e,s,r){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,r)}setTransform(t,e,s){Pn(this,t,e,s)}transform(t,e,s){Tn(this,t,e,s)}move(t,e,s){xn(this,t,e,s)}moveInner(t,e,s){vn(this,t,e,!0,s)}scaleOf(t,e,s,r,i){mn(this,Rn(this,t),e,s,r,i)}rotateOf(t,e,s){wn(this,Rn(this,t),e,s)}skewOf(t,e,s,r,i){bn(this,Rn(this,t),e,s,r,i)}transformWorld(t,e,s){On(this,t,e,s)}moveWorld(t,e,s){vn(this,t,e,!1,s)}scaleOfWorld(t,e,s,r,i){Bn(this,t,e,s,r,i)}rotateOfWorld(t,e){kn(this,t,e)}skewOfWorld(t,e,s,r,i){Cn(this,t,e,s,r,i)}flip(t,e){Tn(this,Ln(this,t),!1,e)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,s){}__clip(t,e){}__renderShape(t,e,s,r){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Pt.need("path")}getMotionPoint(t){return Pt.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){In(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,s){s?this.addAttr(t,e,s):Mi(this.prototype,t,e)}static addAttr(t,e,s,r){s||(s=Ci),s(e,r)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new bo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(bo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},exports.Leaf=Xt([Ni(Ho),Ni(Zo),Ni(nn),Ni(zo),Ni(an)],exports.Leaf);const{setListWithFn:Mn}=nt,{sort:En}=oo,{localBoxBounds:An,localStrokeBounds:Wn,localRenderBounds:Dn,maskLocalBoxBounds:Nn,maskLocalStrokeBounds:Yn,maskLocalRenderBounds:Xn}=ro,zn=new bt("Branch");exports.Branch=class extends exports.Leaf{__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(){Mn(this.__layout.boxBounds,this.children,this.__hasMask?Nn:An)}__updateStrokeBounds(){Mn(this.__layout.strokeBounds,this.children,this.__hasMask?Yn:Wn)}__updateRenderBounds(){Mn(this.__layout.renderBounds,this.children,this.__hasMask?Xn:Dn)}__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(En),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return zn.warn("add self or destroyed");const s=void 0===e;if(!t.__){if(t instanceof Array)return t.forEach((t=>{this.add(t,e),s||e++}));t=Rt.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,s?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const r=t.__layout;r.boxChanged||r.boxChange(),r.matrixChanged||r.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(bo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(bo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",(()=>this.__remove(t,e))):this.__remove(t,e):this.find(t).forEach((t=>this.remove(t,e))):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()})))}clear(){this.removeAll(!0)}__remove(t,e){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())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(bo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(bo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new bo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},exports.Branch=Xt([Ni(ln)],exports.Branch);class Fn{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 Fn;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()}}exports.AlignHelper=xt,exports.AroundHelper=ft,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:n}=t;this.set(e,s,r,i,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:r,left:i,width:o,height:n}=this;return new dt(i,e,o||t.width-i-s,n||t.height-e-r)}},exports.BezierHelper=Te,exports.Bounds=dt,exports.BoundsHelper=nt,exports.BranchHelper=oo,exports.BranchRender=ln,exports.CanvasManager=class{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=!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()}},exports.ChildEvent=bo,exports.Creator=e,exports.DataHelper=At,exports.Debug=bt,exports.EllipseHelper=Ae,exports.Event=wo,exports.EventCreator=Mt,exports.Eventer=Ro,exports.FileHelper=hi,exports.ImageEvent=Bo,exports.ImageManager=gi,exports.IncrementId=s,exports.LayoutEvent=To,exports.LeafBounds=nn,exports.LeafBoundsHelper=ro,exports.LeafData=Dt,exports.LeafDataProxy=Ho,exports.LeafEventer=zo,exports.LeafHelper=Ji,exports.LeafLayout=mo,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=Fn,exports.LeafMatrix=Zo,exports.LeafRender=an,exports.LeaferCanvasBase=class extends Gt{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(e,r){super(),this.size={},this.worldTransform={},e||(e=Jt),this.manager=r,this.innerId=s.create(s.CNAVAS);const{width:i,height:o,pixelRatio:n}=e;this.autoLayout=!i||!o,this.size.pixelRatio=n|t.devicePixelRatio,this.config=e,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const r=this.size;At.copyAttrs(r,t,Zt),Zt.forEach((t=>r[t]||(r[t]=1))),this.bounds=new dt(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle())}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:r}=this,i=this.worldTransform;e&&qt(t,e,i),i.a=t.a*s,i.b=t.b*s,i.c=t.c*s,i.d=t.d*s,i.e=t.e*s,i.f=t.f*s,r&&(t.half&&t.half*s%2?(i.e=Qt(i.e-.5)+.5,i.f=Qt(i.f-.5)+.5):(i.e=Qt(i.e),i.f=Qt(i.f))),this.setTransform(i.a,i.b,i.c,i.d,i.e,i.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap="none"===t.strokeCap?"butt":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!0}hitStroke(t,e){return!0}hitPixel(t,e,s=1){return!0}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,nt.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,i){this.resetTransform(),this.copyWorld(t,e,s,r),i||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempBounds(t,!0,!0);const{context:r}=this,i=r.getImageData(ut.x,ut.y,ut.width,ut.height),{data:o}=i;for(let t=0,r=o.length;t<r;t+=4)s=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?s:e*(s/255));r.putImageData(i,ut.x,ut.y)}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,this.setTempBounds(t),this.fillRect(ut.x,ut.y,ut.width,ut.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(ut.x,ut.y,ut.width,ut.height),s&&(this.blendMode="source-over")}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(ut.x,ut.y,ut.width,ut.height)}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(ut.x,ut.y,ut.width,ut.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,s){ut.set(t),s&&ut.intersect(this.bounds),ut.scale(this.pixelRatio),e&&ut.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,s){const{size:r,pixelSnap:i}=this,o=this.manager?this.manager.get(r):e.canvas(Object.assign({},r));return o.save(),t&&(Vt(o.worldTransform,this.worldTransform),o.useWorldTransform()),s&&(o.smooth=this.smooth),o.pixelSnap!==i&&(o.pixelSnap=i),o}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}},exports.LeaferEvent=Po,exports.LeaferImage=class{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=mi(xi),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}gi.isFormat("svg",t)&&(this.isSVG=!0),gi.hasOpacityPixel(t)&&(this.hasOpacityPixel=!0)}load(e,s){return this.loading||(this.loading=!0,_i.tasker.add((()=>zt(this,void 0,void 0,(function*(){return yield t.origin.loadImage(this.url).then((t=>this.setView(t))).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}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach(((s,r)=>{e=r%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(e,s,r,i){if(e||(e=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const o=t.origin.createCanvas(e,s),n=o.getContext("2d");return r&&(n.globalAlpha=r),n.drawImage(this.view,0,0,e,s),this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(e,s,r,i){const o=t.canvas.createPattern(e,s);try{r&&o.setTransform&&(o.setTransform(r),r=null)}catch(t){}return i&&(i.transform=r),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}},exports.MathHelper=a,exports.Matrix=z,exports.MatrixHelper=v,exports.NeedConvertToCanvasCommandMap=se,exports.OneRadian=l,exports.PI2=d,exports.PI_2=u,exports.PathBounds=$r,exports.PathCommandDataHelper=Fs,exports.PathCommandMap=te,exports.PathConvert=ms,exports.PathCorner=oi,exports.PathCreator=or,exports.PathDrawer=wr,exports.PathHelper=$t,exports.PathNumberCommandLengthMap=ne,exports.PathNumberCommandMap=oe,exports.Platform=t,exports.Plugin=Pt,exports.Point=Y,exports.PointHelper=E,exports.PropertyEvent=vo,exports.RectHelper=ae,exports.RenderEvent=Oo,exports.ResizeEvent=ko,exports.Resource=_i,exports.Run=Ct,exports.StringNumberMap=mt,exports.TaskItem=ui,exports.TaskProcessor=ci,exports.TwoPointBoundsHelper=j,exports.UICreator=Rt,exports.WaitHelper=lo,exports.WatchEvent=Co,exports.affectRenderBoundsType=function(t){return vi(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))},exports.affectStrokeBoundsType=Pi,exports.attr=Bi,exports.autoLayoutType=function(t){return vi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Ti(this))}})))},exports.boundsType=Ci,exports.canvasPatch=function(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,r,i){ai(this,t,e,s,r,i)})}(t)},exports.canvasSizeAttrs=Zt,exports.cursorType=function(t){return vi(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))},exports.dataProcessor=function(t){return(e,s)=>{wi(e,"__DataProcessor",{get:()=>t})}},exports.dataType=function(t){return vi(t)},exports.decorateLeafAttr=vi,exports.defineDataProcessor=Mi,exports.defineKey=wi,exports.defineLeafAttr=ki,exports.doBoundsType=Ti,exports.doStrokeType=Li,exports.emptyData={},exports.eraserType=function(t){return vi(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))},exports.getBoundsData=p,exports.getDescriptor=bi,exports.getMatrixData=_,exports.getPointData=c,exports.hitType=function(t){return vi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===bt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))},exports.isEmptyData=Yt,exports.isNull=function(t){return null==t},exports.layoutProcessor=function(t){return(e,s)=>{wi(e,"__LayoutProcessor",{get:()=>t})}},exports.maskType=function(t){return vi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))},exports.naturalBoundsType=function(t){return vi(t,(t=>({set(e){this.__setAttr(t,e)&&(Ti(this),this.__.__removeNaturalSize())}})))},exports.opacityType=function(t){return vi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Si(this)}})))},exports.pathInputType=function(t){return vi(t,(t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),Ti(this)}})))},exports.pathType=Oi,exports.pen=ni,exports.positionType=function(t,e){return vi(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))},exports.registerUI=function(){return t=>{Rt.register(t)}},exports.registerUIEvent=function(){return t=>{Mt.register(t)}},exports.rewrite=function(t){return(e,s)=>{Ai.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}},exports.rewriteAble=function(){return t=>{Di()}},exports.rotationType=function(t,e){return vi(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))},exports.scaleType=function(t,e){return vi(t,(t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))},exports.sortType=function(t){return vi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))},exports.strokeType=Ri,exports.surfaceType=function(t){return vi(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))},exports.tempBounds=ut,exports.tempMatrix=F,exports.tempPoint=X,exports.useModule=Ni,exports.version="1.6.0",exports.visibleType=function(t){return vi(t,(t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Ii(this,t,e,s)))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");Ii(this,t,e,s),this.mask&&Si(this)}})))};
|
|
2
2
|
//# sourceMappingURL=core.min.cjs.map
|