leafer-x-tooltip-canvas 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.en.md +394 -0
- package/README.md +392 -0
- package/dev/bundle.js +12467 -0
- package/dev/index.html +13 -0
- package/dist/index.cjs +10911 -0
- package/dist/index.esm.js +10909 -0
- package/dist/index.esm.min.js +1 -0
- package/dist/index.js +10915 -0
- package/dist/index.min.cjs +1 -0
- package/dist/index.min.js +1 -0
- package/package.json +52 -0
- package/src/Tooltip.ts +166 -0
- package/src/TooltipPlugin.ts +187 -0
- package/src/defaultConfig.ts +26 -0
- package/src/index.ts +1 -0
- package/src/interface/config.ts +40 -0
- package/src/interface/display.ts +5 -0
- package/src/interface/index.ts +2 -0
- package/src/utils.ts +52 -0
- package/types/index.d.ts +48 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{HitCanvasManager as t,InteractionBase as e,InteractionHelper as s,Cursor as i,Leafer as o,Box as r,Pen as n,Text as a,PenData as h,PointerEvent as l}from"@leafer-ui/core";function d(t,e,s,i){var o,r=arguments.length,n=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(n=(r<3?o(n):r>3?o(e,s,n):o(e,s))||n);return r>3&&n&&Object.defineProperty(e,s,n),n}"function"==typeof SuppressedError&&SuppressedError;const c={image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,suffix:"leaf",crossOrigin:"anonymous"}},u={},_={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=p;return e[t]?e[t]++:(e[t]=1,0)}},p=_,{round:g,pow:f,PI:y}=Math,m={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),minus(t,e){if(t instanceof Array){e&&(t=m.fourNumber(t,0));for(let e=0;e<t.length;e++)t[e]=-t[e]}else t=-t;return 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)),m.float(t)),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=e?f(10,e):1e12;return-0===(t=g(t*s)/s)?0:t}},w=y/180,v=2*y,x=y/2;function b(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:B,cos:k,acos:R,sqrt:C}=Math,{float:T}=m,S={};function L(){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 P={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:L(),tempMatrix:{},set(t,e=1,s=0,i=0,o=1,r=0,n=0){t.a=e,t.b=s,t.c=i,t.d=o,t.e=r,t.f=n},get:b,getWorld:L,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,i){E.toInnerPoint(t,e,S),E.scaleOfInner(t,S,s,i)},scaleOfInner(t,e,s,i=s){E.translateInner(t,e.x,e.y),E.scale(t,s,i),E.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:o,d:r}=t,n=k(e*=w),a=B(e);t.a=s*n-i*a,t.b=s*a+i*n,t.c=o*n-r*a,t.d=o*a+r*n},rotateOfOuter(t,e,s){E.toInnerPoint(t,e,S),E.rotateOfInner(t,S,s)},rotateOfInner(t,e,s){E.translateInner(t,e.x,e.y),E.rotate(t,s),E.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:o,c:r,d:n}=t;s&&(s*=w,t.a=i+r*s,t.b=o+n*s),e&&(e*=w,t.c=r+i*e,t.d=n+o*e)},skewOfOuter(t,e,s,i){E.toInnerPoint(t,e,S),E.skewOfInner(t,S,s,i)},skewOfInner(t,e,s,i=0){E.translateInner(t,e.x,e.y),E.skew(t,s,i),E.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:o,d:r,e:n,f:a}=t;t.a=e.a*s+e.b*o,t.b=e.a*i+e.b*r,t.c=e.c*s+e.d*o,t.d=e.c*i+e.d*r,t.e=e.e*s+e.f*o+n,t.f=e.e*i+e.f*r+a},multiplyParent(t,e,s,i,o){const{e:r,f:n}=t;if(s||(s=t),void 0===i&&(i=1!==t.a||t.b||t.c||1!==t.d),i){const{a:i,b:r,c:n,d:a}=t;s.a=i*e.a+r*e.c,s.b=i*e.b+r*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,o&&(s.scaleX=e.scaleX*o.scaleX,s.scaleY=e.scaleY*o.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,o&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=r*e.a+n*e.c+e.e,s.f=r*e.b+n*e.d+e.f},divide(t,e){E.multiply(t,E.tempInvert(e))},divideParent(t,e){E.multiplyParent(t,E.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=E;return E.copy(e,t),E.invert(e),e},invert(t){const{a:e,b:s,c:i,d:o,e:r,f:n}=t;if(s||i){const a=1/(e*o-s*i);t.a=o*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(r*o-n*i)*a,t.f=-(n*e-r*s)*a}else if(1===e&&1===o)t.e=-r,t.f=-n;else{const s=1/(e*o);t.a=o*s,t.d=e*s,t.e=-r*o*s,t.f=-n*e*s}},toOuterPoint(t,e,s,i){const{x:o,y:r}=e;s||(s=e),s.x=o*t.a+r*t.c,s.y=o*t.b+r*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:o,b:r,c:n,d:a}=t,h=1/(o*a-r*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*o-l*r)*h,!i){const{e:e,f:i}=t;s.x-=(e*a-i*n)*h,s.y-=(i*o-e*r)*h}},setLayout(t,e,s,i){const{x:o,y:r,scaleX:n,scaleY:a}=e;if(void 0===i&&(i=e.rotation||e.skewX||e.skewY),i){const{rotation:s,skewX:i,skewY:o}=e,r=s*w,h=k(r),l=B(r);if(i||o){const e=i*w,s=o*w;t.a=(h+s*-l)*n,t.b=(l+s*h)*n,t.c=(e*h-l)*a,t.d=(h+e*l)*a}else t.a=h*n,t.b=l*n,t.c=-l*a,t.d=h*a}else t.a=n,t.b=0,t.c=0,t.d=a;t.e=o,t.f=r,s&&E.translateInner(t,-s.x,-s.y)},getLayout(t,e,s){const{a:i,b:o,c:r,d:n,e:a,f:h}=t;let l,d,c,u,_,p=a,g=h;if(o||r){const t=i*n-o*r;if(r&&!s){l=C(i*i+o*o),d=t/l;const e=i/l;c=o>0?R(e):-R(e)}else{d=C(r*r+n*n),l=t/d;const e=r/d;c=x-(n>0?R(-e):-R(e))}const e=T(k(c)),a=B(c);l=T(l),d=T(d),u=e?T((r/d+a)/e/w,9):0,_=e?T((o/l-a)/e/w,9):0,c=T(c/w)}else l=i,d=n,c=u=_=0;return e&&(p+=e.x*i+e.y*r,g+=e.x*o+e.y*n),{x:p,y:g,scaleX:l,scaleY:d,rotation:c,skewX:u,skewY:_}},withScale(t,e,s=e){const i=t;if(!e||!s){const{a:i,b:o,c:r,d:n}=t;o||r?s=(i*n-o*r)/(e=C(i*i+o*o)):(e=i,s=n)}return i.scaleX=e,i.scaleY=s,i},reset(t){E.set(t)}},E=P,{toInnerPoint:O,toOuterPoint:A}=P,{sin:M,cos:I,abs:W,sqrt:D,atan2:F,min:N,PI:z}=Math,Y={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,i=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1)},rotate(t,e,s){s||(s=X.defaultPoint);const i=I(e*=w),o=M(e),r=t.x-s.x,n=t.y-s.y;t.x=s.x+r*i-n*o,t.y=s.y+r*o+n*i},tempToInnerOf(t,e){const{tempPoint:s}=X;return U(s,t),O(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=X;return U(s,t),A(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=X;return U(s,t),X.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),O(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){O(e,t,s)},toOuterOf(t,e,s){A(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)=>j(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const o=W(s-t),r=W(i-e);return D(o*o+r*r)},getMinDistanceFrom:(t,e,s,i,o,r)=>N(j(t,e,s,i),j(s,i,o,r)),getAngle:(t,e)=>V(t,e)/w,getRotation:(t,e,s,i)=>(i||(i=e),X.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/w),getRadianFrom(t,e,s,i,o,r,n,a){void 0===n&&(n=s,a=i);let h=F(e-i,t-s);const l=F(r-a,o-n)-h;return l<-z?l+v:l},getAtan2:(t,e)=>F(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i){const o=V(t,e);return(e=i?e:{}).x=t.x+I(o)*s,e.y=t.y+M(o)*s,e},reset(t){}},X=Y,{getDistanceFrom:j,copy:U,getAtan2:V}=X;class H{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?Y.copy(this,t):Y.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new H(this)}move(t,e){return Y.move(this,t,e),this}scale(t,e){return Y.scale(this,t,e),this}scaleOf(t,e,s){return Y.scaleOf(this,t,e,s),this}rotate(t,e){return Y.rotate(this,t,e),this}rotateOf(t,e){return Y.rotate(this,e,t),this}getRotation(t,e,s){return Y.getRotation(this,t,e,s)}toInnerOf(t,e){return Y.toInnerOf(this,t,e),this}toOuterOf(t,e){return Y.toOuterOf(this,t,e),this}getCenter(t){return new H(Y.getCenter(this,t))}getDistance(t){return Y.getDistance(this,t)}getDistancePoint(t,e,s){return new H(Y.getDistancePoint(this,t,e,s))}getAngle(t){return Y.getAngle(this,t)}getAtan2(t){return Y.getAtan2(this,t)}reset(){return this}}new H;class G{constructor(t,e,s,i,o,r){this.set(t,e,s,i,o,r)}set(t,e,s,i,o,r){return"object"==typeof t?P.copy(this,t):P.set(this,t,e,s,i,o,r),this}setWith(t){return P.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:i,e:o,f:r}=this;return{a:t,b:e,c:s,d:i,e:o,f:r}}clone(){return new G(this)}translate(t,e){return P.translate(this,t,e),this}translateInner(t,e){return P.translateInner(this,t,e),this}scale(t,e){return P.scale(this,t,e),this}scaleWith(t,e){return P.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return P.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return P.scaleOfInner(this,t,e,s),this}rotate(t){return P.rotate(this,t),this}rotateOfOuter(t,e){return P.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return P.rotateOfInner(this,t,e),this}skew(t,e){return P.skew(this,t,e),this}skewOfOuter(t,e,s){return P.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return P.skewOfInner(this,t,e,s),this}multiply(t){return P.multiply(this,t),this}multiplyParent(t){return P.multiplyParent(this,t),this}divide(t){return P.divide(this,t),this}divideParent(t){return P.divideParent(this,t),this}invert(){return P.invert(this),this}invertWith(){return P.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){P.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){P.toInnerPoint(this,t,e,s)}setLayout(t,e){return P.setLayout(this,t,e),this}getLayout(t,e){return P.getLayout(this,t,e)}withScale(t,e){return P.withScale(this,t,e)}reset(){P.reset(this)}}new G;const q={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,o){K(t,e,s),K(t,e+i,s+o)},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:K}=q,{tempPointBounds:$,setPoint:J,addPoint:Q,toBounds:Z}=q,{toOuterPoint:tt}=P,{float:et,fourNumber:st}=m,{floor:it,ceil:ot}=Math;let rt,nt,at,ht;const lt={},dt={},ct={tempBounds:{},set(t,e=0,s=0,i=0,o=0){t.x=e,t.y=s,t.width=i,t.height=o},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,i){if(s instanceof Array){const i=st(s);ut.set(t,e.x-i[3],e.y-i[0],e.width+i[1]+i[3],e.height+i[2]+i[0])}else i||(i=s),ut.set(t,e.x-s,e.y-i,e.width+2*s,e.height+2*i)},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),ut.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?pt(e,t):e=t,s?(e.offsetX=-(ut.maxX(s)-t.x),e.offsetY=-(ut.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),ut.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e){Y.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){Y.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(ut.copy(ut.tempBounds,t),ut.toOuterOf(ut.tempBounds,e),ut.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),ut.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:o}=e;i>0?(s.width=t.width*i,s.x=e.e+t.x*i):(s.width=t.width*-i,s.x=e.e+t.x*i-s.width),o>0?(s.height=t.height*o,s.y=e.f+t.y*o):(s.height=t.height*-o,s.y=e.f+t.y*o-s.height)}else lt.x=t.x,lt.y=t.y,tt(e,lt,dt),J($,dt.x,dt.y),lt.x=t.x+t.width,tt(e,lt,dt),Q($,dt.x,dt.y),lt.y=t.y+t.height,tt(e,lt,dt),Q($,dt.x,dt.y),lt.x=t.x,tt(e,lt,dt),Q($,dt.x,dt.y),Z($,s)},toInnerOf(t,e,s){s||(s=t),ut.move(s,-e.e,-e.f),ut.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Math.min(t.width/e.width,t.height/e.height));return new G(i,0,0,i,-e.x*i,-e.y*i)},getSpread(t,e,s){const i={};return ut.copyAndSpread(i,t,e,s),i},spread(t,e,s=e){ut.copyAndSpread(t,t,e,s)},ceil(t){const{x:e,y:s}=t;t.x=it(t.x),t.y=it(t.y),t.width=e>t.x?ot(t.width+e-t.x):ot(t.width),t.height=s>t.y?ot(t.height+s-t.y):ot(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=et(t.x,e),t.y=et(t.y,e),t.width=et(t.width,e),t.height=et(t.height,e)},add(t,e,s){rt=t.x+t.width,nt=t.y+t.height,at=e.x,ht=e.y,s||(at+=e.width,ht+=e.height),rt=rt>at?rt:at,nt=nt>ht?nt:ht,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=rt-t.x,t.height=nt-t.y},addList(t,e){ut.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){ut.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){ut.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let o,r=!0;for(let n=0,a=e.length;n<a;n++)o=s?s(e[n]):e[n],o&&(o.width||o.height)&&(r?(r=!1,i||pt(t,o)):_t(t,o));r&&ut.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?J($,t.x,t.y):Q($,t.x,t.y))),Z($,t)},addPoint(t,e){_t(t,e,!0)},getPoints(t){const{x:e,y:s,width:i,height:o}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+o},{x:e,y:s+o}]},hitRadiusPoint:(t,e,s)=>(s&&(e=Y.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=Y.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=ut.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=ut.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=ut.tempToOuterOf(e,s)),!ut.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:o,width:r,height:n}=e;return rt=i+r,nt=o+n,at=t.x+t.width,ht=t.y+t.height,i=i>t.x?i:t.x,o=o>t.y?o:t.y,rt=rt<at?rt:at,nt=nt<ht?nt:ht,r=rt-i,n=nt-o,{x:i,y:o,width:r,height:n}},intersect(t,e,s){ut.copy(t,ut.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){ut.set(t)}},ut=ct,{add:_t,copy:pt}=ut;class gt{get minX(){return ct.minX(this)}get minY(){return ct.minY(this)}get maxX(){return ct.maxX(this)}get maxY(){return ct.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return"object"==typeof t?ct.copy(this,t):ct.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new gt(this)}move(t,e){return ct.move(this,t,e),this}scale(t,e){return ct.scale(this,t,e),this}scaleOf(t,e,s){return ct.scaleOf(this,t,e,s),this}toOuterOf(t,e){return ct.toOuterOf(this,t,e),this}toInnerOf(t,e){return ct.toInnerOf(this,t,e),this}getFitMatrix(t,e){return ct.getFitMatrix(this,t,e)}spread(t,e){return ct.spread(this,t,e),this}shrink(t){return ct.spread(this,m.minus(t,!0)),this}ceil(){return ct.ceil(this),this}unsign(){return ct.unsign(this),this}float(t){return ct.float(this,t),this}add(t){return ct.add(this,t),this}addList(t){return ct.setList(this,t,!0),this}setList(t){return ct.setList(this,t),this}addListWithFn(t,e){return ct.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return ct.setListWithFn(this,t,e),this}setPoints(t){return ct.setPoints(this,t),this}addPoint(t){return ct.addPoint(this,t),this}getPoints(){return ct.getPoints(this)}hitPoint(t,e){return ct.hitPoint(this,t,e)}hitRadiusPoint(t,e){return ct.hitRadiusPoint(this,t,e)}hit(t,e){return ct.hit(this,t,e)}includes(t,e){return ct.includes(this,t,e)}intersect(t,e){return ct.intersect(this,t,e),this}getIntersect(t,e){return new gt(ct.getIntersectData(this,t,e))}isSame(t){return ct.isSame(this,t)}isEmpty(){return ct.isEmpty(this)}reset(){ct.reset(this)}}const ft=new gt;class yt{constructor(t,e,s,i,o,r){"object"==typeof t?this.copy(t):this.set(t,e,s,i,o,r)}set(t=0,e=0,s=0,i=0,o=0,r=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=o,this.height=r}copy(t){const{top:e,right:s,bottom:i,left:o,width:r,height:n}=t;this.set(e,s,i,o,r,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:o,width:r,height:n}=this;return new gt(o,e,r||t.width-o-s,n||t.height-e-i)}}var mt,wt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(mt||(mt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center"}(wt||(wt={}));const vt=[{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}],xt={directionData:vt,tempPoint:{},get:bt,toPoint(t,e,s,i,o){s||(s={});const r=bt(t);s.x=r.x*e.width,s.y=r.y*e.height,o&&(s.x-=o.x,s.y-=o.y,r.x&&(s.x-=1===r.x?o.width:.5===r.x?r.x*o.width:0),r.y&&(s.y-=1===r.y?o.height:.5===r.y?r.y*o.height:0)),i||(s.x+=e.x,s.y+=e.y)}};function bt(t){return"string"==typeof t?vt[wt[t]]:t}const Bt={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 kt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new kt(t)}static set filter(t){this.filterList=Rt(t)}static set exclude(t){this.excludeList=Rt(t)}log(...t){if(Ct.enable){if(Ct.filterList.length&&Ct.filterList.every((t=>t!==this.name)))return;if(Ct.excludeList.length&&Ct.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Ct.enable&&this.warn(...t)}warn(...t){Ct.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 Rt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}kt.filterList=[],kt.excludeList=[],kt.showWarn=!0;const Ct=kt,Tt=kt.get("RunTime"),St={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=_.create(_.RUNTIME);return Lt.currentId=Lt.idMap[s]=e?performance.now():Date.now(),Lt.currentName=Lt.nameMap[s]=t,Lt.nameToIdMap[t]=s,s},end(t,e){const s=Lt.idMap[t],i=Lt.nameMap[t],o=e?(performance.now()-s)/1e3:Date.now()-s;Lt.idMap[t]=Lt.nameMap[t]=Lt.nameToIdMap[i]=void 0,Tt.log(i,o,"ms")},endOfName(t,e){const s=Lt.nameToIdMap[t];void 0!==s&&Lt.end(s,e)}},Lt=St,Pt=kt.get("UICreator"),Et={list:{},register(t){const{__tag:e}=t.prototype;Ot[e]?Pt.repeat(e):Ot[e]=t},get(t,e,s,i,o,r){const n=new Ot[t](e);return void 0!==s&&(n.x=s,i&&(n.y=i),o&&(n.width=o),r&&(n.height=r)),n}},{list:Ot}=Et,At=kt.get("EventCreator"),Mt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(It[e]?At.repeat(e):It[e]=t)}))},changeName(t,e){const s=It[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,It[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new It[t](...e)},{nameList:It}=Mt;class Wt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,o=s.length;i<o;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=u.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}const Dt={default:(t,e)=>(Ft(e,t),Ft(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var o;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(o=t[i])||void 0===o?void 0:o.constructor)===Object?Ft(t[i],e[i]):t[i]=e[i]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:Ft}=Dt;class Nt{get __blendMode(){if(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 i in this)"_"!==i[0]&&(s=e?e[i]:void 0,t[i]=void 0===s?this[i]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(t){const e={};if(t)if(t instanceof Array)for(let s of t)e[s]=this.__getInput(s);else for(let s in t)e[s]=this.__getInput(s);else{let t,s,{__input:i}=this;e.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],void 0!==t)){if("path"===o&&!this.__pathInputed)continue;s=i?i[o]:void 0,e[o]=void 0===s?t:s}}return e}__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||e.__hasEraser||t.eraser?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 zt;function Yt(t,e,s,i){var o,r=arguments.length,n=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(n=(r<3?o(n):r>3?o(e,s,n):o(e,s))||n);return r>3&&n&&Object.defineProperty(e,s,n),n}function Xt(t,e,s,i){return new(s||(s=Promise))((function(o,r){function n(t){try{h(i.next(t))}catch(t){r(t)}}function a(t){try{h(i.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?o(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,a)}h((i=i.apply(t,e||[])).next())}))}function jt(t){return(e,s)=>{t||(t=s),Object.defineProperty(e,s,{get(){return this.context[t]},set(e){this.context[t]=e}})}}!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(zt||(zt={})),"function"==typeof SuppressedError&&SuppressedError;const Ut=[];function Vt(){return(t,e)=>{Ut.push(e)}}const Ht=[];let Gt=class{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||Ht)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Ut.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,i,o,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,o,r){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,o,r)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,o,r,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,r+=t,a-=t}if(s<0){const t=-s/o*h;o+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,o,r,n,a,h);break;case 5:this.context.drawImage(t,e,s,i,o);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,o,r){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,o,r){}arcTo(t,e,s,i,o){}ellipse(t,e,s,i,o,r,n,a){}rect(t,e,s,i){}roundRect(t,e,s,i,o){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,o,r){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};Yt([jt("imageSmoothingEnabled")],Gt.prototype,"smooth",void 0),Yt([jt("imageSmoothingQuality")],Gt.prototype,"smoothLevel",void 0),Yt([jt("globalAlpha")],Gt.prototype,"opacity",void 0),Yt([jt()],Gt.prototype,"fillStyle",void 0),Yt([jt()],Gt.prototype,"strokeStyle",void 0),Yt([jt("lineWidth")],Gt.prototype,"strokeWidth",void 0),Yt([jt("lineCap")],Gt.prototype,"strokeCap",void 0),Yt([jt("lineJoin")],Gt.prototype,"strokeJoin",void 0),Yt([jt("lineDashOffset")],Gt.prototype,"dashOffset",void 0),Yt([jt()],Gt.prototype,"miterLimit",void 0),Yt([jt()],Gt.prototype,"shadowBlur",void 0),Yt([jt()],Gt.prototype,"shadowColor",void 0),Yt([jt()],Gt.prototype,"shadowOffsetX",void 0),Yt([jt()],Gt.prototype,"shadowOffsetY",void 0),Yt([jt()],Gt.prototype,"filter",void 0),Yt([jt()],Gt.prototype,"font",void 0),Yt([jt()],Gt.prototype,"fontKerning",void 0),Yt([jt()],Gt.prototype,"fontStretch",void 0),Yt([jt()],Gt.prototype,"fontVariantCaps",void 0),Yt([jt()],Gt.prototype,"textAlign",void 0),Yt([jt()],Gt.prototype,"textBaseline",void 0),Yt([jt()],Gt.prototype,"textRendering",void 0),Yt([jt()],Gt.prototype,"wordSpacing",void 0),Yt([jt()],Gt.prototype,"letterSpacing",void 0),Yt([jt()],Gt.prototype,"direction",void 0),Yt([Vt()],Gt.prototype,"setTransform",null),Yt([Vt()],Gt.prototype,"resetTransform",null),Yt([Vt()],Gt.prototype,"getTransform",null),Yt([Vt()],Gt.prototype,"save",null),Yt([Vt()],Gt.prototype,"restore",null),Yt([Vt()],Gt.prototype,"translate",null),Yt([Vt()],Gt.prototype,"scale",null),Yt([Vt()],Gt.prototype,"rotate",null),Yt([Vt()],Gt.prototype,"fill",null),Yt([Vt()],Gt.prototype,"stroke",null),Yt([Vt()],Gt.prototype,"clip",null),Yt([Vt()],Gt.prototype,"fillRect",null),Yt([Vt()],Gt.prototype,"strokeRect",null),Yt([Vt()],Gt.prototype,"clearRect",null),Yt([Vt()],Gt.prototype,"beginPath",null),Yt([Vt()],Gt.prototype,"moveTo",null),Yt([Vt()],Gt.prototype,"lineTo",null),Yt([Vt()],Gt.prototype,"bezierCurveTo",null),Yt([Vt()],Gt.prototype,"quadraticCurveTo",null),Yt([Vt()],Gt.prototype,"closePath",null),Yt([Vt()],Gt.prototype,"arc",null),Yt([Vt()],Gt.prototype,"arcTo",null),Yt([Vt()],Gt.prototype,"ellipse",null),Yt([Vt()],Gt.prototype,"rect",null),Yt([Vt()],Gt.prototype,"roundRect",null),Yt([Vt()],Gt.prototype,"createConicGradient",null),Yt([Vt()],Gt.prototype,"createLinearGradient",null),Yt([Vt()],Gt.prototype,"createPattern",null),Yt([Vt()],Gt.prototype,"createRadialGradient",null),Yt([Vt()],Gt.prototype,"fillText",null),Yt([Vt()],Gt.prototype,"measureText",null),Yt([Vt()],Gt.prototype,"strokeText",null);const{copy:qt}=P,Kt={width:1,height:1,pixelRatio:1},$t=["width","height","pixelRatio"];class Jt 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 allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Kt),t.pixelRatio||(t.pixelRatio=c.devicePixelRatio),this.manager=e,this.innerId=_.create(_.CNAVAS);const{width:s,height:i,pixelRatio:o}=t;this.autoLayout=!s||!i,this.size.pixelRatio=o,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),Dt.copyAttrs(this.size,t,$t),this.size.pixelRatio||(this.size.pixelRatio=1),this.bounds=new gt(0,0,this.width,this.height),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}updateClientBounds(){}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s}=this,i=this.worldTransform;if(e){const{a:o,b:r,c:n,d:a,e:h,f:l}=e;this.setTransform(i.a=(t.a*o+t.b*n)*s,i.b=(t.a*r+t.b*a)*s,i.c=(t.c*o+t.d*n)*s,i.d=(t.c*r+t.d*a)*s,i.e=(t.e*o+t.f*n+h)*s,i.f=(t.e*r+t.f*a+l)*s)}else this.setTransform(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)}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,i){const{pixelRatio:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=s*o,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i){if(i&&(this.blendMode=i),e){const{pixelRatio:i}=this;s||(s=e),this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x*i,s.y*i,s.width*i,s.height*i)}else this.drawImage(t.view,0,0);i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i){if(i&&(this.blendMode=i),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,ct.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:i}=this;this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x,s.y,s.width,s.height)}i&&(this.blendMode="source-over")}copyWorldByReset(t,e,s,i,o){this.resetTransform(),this.copyWorld(t,e,s,i),o||this.useWorldTransform()}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s){s&&(this.blendMode=s),this.fillStyle=e,ft.set(t).scale(this.pixelRatio),this.fillRect(ft.x,ft.y,ft.width,ft.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,ft.set(t).scale(this.pixelRatio),this.strokeRect(ft.x,ft.y,ft.width,ft.height),s&&(this.blendMode="source-over")}clearWorld(t,e){ft.set(t).scale(this.pixelRatio),e&&ft.ceil(),this.clearRect(ft.x,ft.y,ft.width,ft.height)}clipWorld(t,e){this.beginPath(),ft.set(t).scale(this.pixelRatio),e&&ft.ceil(),this.rect(ft.x,ft.y,ft.width,ft.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t,e){const s=this.manager?this.manager.get(this.size):u.canvas(Object.assign({},this.size));return s.save(),t&&(qt(s.worldTransform,this.worldTransform),s.useWorldTransform()),e&&(s.smooth=this.smooth),s}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Qt={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Zt={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},Zt),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},ie=Object.assign(Object.assign({},se),Zt),oe=te,re={};for(let t in oe)re[oe[t]]=t;const ne={};for(let t in oe)ne[oe[t]]=ee[t];const ae={drawRoundRect(t,e,s,i,o,r){const n=m.fourNumber(r,Math.min(i/2,o/2)),a=e+i,h=s+o;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(a,s,a,h,n[1]):t.lineTo(a,s),n[2]?t.arcTo(a,h,e,h,n[2]):t.lineTo(a,h),n[3]?t.arcTo(e,h,e,s,n[3]):t.lineTo(e,h),n[0]?t.arcTo(e,s,a,s,n[0]):t.lineTo(e,s)}},{sin:he,cos:le,atan2:de,ceil:ce,abs:ue,PI:_e,sqrt:pe,pow:ge}=Math,{setPoint:fe,addPoint:ye}=q,{set:me}=Y,{M:we,L:ve,C:xe,Q:be,Z:Be}=te,ke={},Re={points(t,e,s,i){if(t.push(we,e[0],e[1]),s&&e.length>5){let o,r,n,a,h,l,d,c,u,_,p,g,f,y=e.length;const m=!0===s?.5:s;i&&(y=(e=[e[y-2],e[y-1],...e,e[0],e[1],e[2],e[3]]).length);for(let s=2;s<y-2;s+=2)o=e[s-2],r=e[s-1],n=e[s],a=e[s+1],h=e[s+2],l=e[s+3],p=pe(ge(n-o,2)+ge(a-r,2)),g=pe(ge(h-n,2)+ge(l-a,2)),f=p+g,p=m*p/f,g=m*g/f,h-=o,l-=r,d=n-p*h,c=a-p*l,2===s?i||t.push(be,d,c,n,a):t.push(xe,u,_,d,c,n,a),u=n+g*h,_=a+g*l;i||t.push(be,u,_,e[y-2],e[y-1])}else for(let s=2,i=e.length;s<i;s+=2)t.push(ve,e[s],e[s+1]);i&&t.push(Be)},rect(t,e,s,i,o){Qt.creator.path=t,Qt.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+o).lineTo(e,s+o).lineTo(e,s)},roundRect(t,e,s,i,o,r){Qt.creator.path=[],ae.drawRoundRect(Qt.creator,e,s,i,o,r),t.push(...Qt.convertToCanvasData(Qt.creator.path,!0))},arcTo(t,e,s,i,o,r,n,a,h,l,d){const c=i-e,u=o-s,_=r-i,p=n-o;let g=de(u,c),f=de(p,_),y=f-g;if(y<0&&(y+=v),y===_e||ue(c+u)<1e-12||ue(_+p)<1e-12)return t&&t.push(ve,i,o),h&&(fe(h,e,s),ye(h,i,o)),d&&me(d,e,s),void(l&&me(l,i,o));const m=c*p-_*u<0,b=m?-1:1,B=a/le(y/2),k=i+B*le(g+y/2+x*b),R=o+B*he(g+y/2+x*b);return g-=x*b,f-=x*b,Se(t,k,R,a,a,0,g/w,f/w,m,h,l,d)},arc:(t,e,s,i,o,r,n,a,h,l)=>Se(t,e,s,i,i,0,o,r,n,a,h,l),ellipse(t,e,s,i,o,r,n,a,h,l,d,c){const u=r*w,_=he(u),p=le(u);let g=n*w,f=a*w;g>_e&&(g-=v),f<0&&(f+=v);let y=f-g;y<0?y+=v:y>v&&(y-=v),h&&(y-=v);const m=ce(ue(y/x)),b=y/m,B=he(b/4),k=8/3*B*B/he(b/2);f=g+b;let R,C,T,S,L,P,E,O,A=le(g),M=he(g),I=T=p*i*A-_*o*M,W=S=_*i*A+p*o*M,D=e+T,F=s+S;t&&t.push(ve,D,F),l&&fe(l,D,F),c&&me(c,D,F);for(let r=0;r<m;r++)R=le(f),C=he(f),T=p*i*R-_*o*C,S=_*i*R+p*o*C,L=e+I-k*(p*i*M+_*o*A),P=s+W-k*(_*i*M-p*o*A),E=e+T+k*(p*i*C+_*o*R),O=s+S+k*(_*i*C-p*o*R),t&&t.push(xe,L,P,E,O,e+T,s+S),l&&Te(e+I,s+W,L,P,E,O,e+T,s+S,l,!0),I=T,W=S,A=R,M=C,g=f,f+=b;d&&me(d,e+T,s+S)},quadraticCurveTo(t,e,s,i,o,r,n){t.push(xe,(e+2*i)/3,(s+2*o)/3,(r+2*i)/3,(n+2*o)/3,r,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,o,r,n,a){Te(t,e,(t+2*s)/3,(e+2*i)/3,(o+2*s)/3,(r+2*i)/3,o,r,n,a)},toTwoPointBounds(t,e,s,i,o,r,n,a,h,l){const d=[];let c,u,_,p,g,f,y,m,w=t,v=s,x=o,b=n;for(let t=0;t<2;++t)if(1==t&&(w=e,v=i,x=r,b=a),c=-3*w+9*v-9*x+3*b,u=6*w-12*v+6*x,_=3*v-3*w,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?ye(h,t,e):fe(h,t,e),ye(h,n,a);for(let l=0,c=d.length;l<c;l++)Ce(d[l],t,e,s,i,o,r,n,a,ke),ye(h,ke.x,ke.y)},getPointAndSet(t,e,s,i,o,r,n,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*r+p*a,l.y=c*s+u*o+_*n+p*h},getPoint(t,e,s,i,o,r,n,a,h){const l={};return Ce(t,e,s,i,o,r,n,a,h,l),l}},{getPointAndSet:Ce,toTwoPointBounds:Te,ellipse:Se}=Re,{sin:Le,cos:Pe,sqrt:Ee,atan2:Oe}=Math,{ellipse:Ae}=Re,Me={ellipticalArc(t,e,s,i,o,r,n,a,h,l,d){const u=(h-e)/2,_=(l-s)/2,p=r*w,g=Le(p),f=Pe(p),y=-f*u-g*_,m=-f*_+g*u,x=i*i,b=o*o,B=m*m,k=y*y,R=x*b-x*B-b*k;let C=0;if(R<0){const t=Ee(1-R/(x*b));i*=t,o*=t}else C=(n===a?-1:1)*Ee(R/(x*B+b*k));const T=C*i*m/o,S=-C*o*y/i,L=Oe((m-S)/o,(y-T)/i),P=Oe((-m-S)/o,(-y-T)/i);let E=P-L;0===a&&E>0?E-=v:1===a&&E<0&&(E+=v);const O=e+u+f*T-g*S,A=s+_+g*T+f*S,M=E<0?1:0;d||c.ellipseToCurve?Ae(t,O,A,i,o,r,L/w,P/w,M):i!==o||r?t.push(te.G,O,A,i,o,r,L/w,P/w,M):t.push(te.O,O,A,i,L/w,P/w,M)}},{M:Ie,m:We,L:De,l:Fe,H:Ne,h:ze,V:Ye,v:Xe,C:je,c:Ue,S:Ve,s:He,Q:Ge,q:qe,T:Ke,t:$e,A:Je,a:Qe,Z:Ze,z:ts,N:es,D:ss,X:is,G:os,F:rs,O:ns,P:as,U:hs}=te,{rect:ls,roundRect:ds,arcTo:cs,arc:us,ellipse:_s,quadraticCurveTo:ps}=Re,{ellipticalArc:gs}=Me,fs=kt.get("PathConvert"),ys={},ms={current:{dot:0},stringify(t,e){let s,i,o,r=0,n=t.length,a="";for(;r<n;){i=t[r],s=ne[i],a+=i===o?" ":re[i];for(let i=1;i<s;i++)a+=m.float(t[r+i],e),i===s-1||(a+=" ");o=i,r+=s}return a},parse(t,e){let s,i,o,r="";const n=[],a=e?ie:se;for(let e=0,h=t.length;e<h;e++)i=t[e],Bt[i]?("."===i&&(ws.dot++,ws.dot>1&&(vs(n,r),r="")),r+=i):te[i]?(r&&(vs(n,r),r=""),ws.name=te[i],ws.length=ee[i],ws.index=0,vs(n,ws.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===o||"E"===o?r+=i:(r&&vs(n,r),r=i):r&&(vs(n,r),r=""),o=i;return r&&vs(n,r),s?ms.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,o,r,n,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(o=t[c],o){case We:t[c+1]+=a,t[c+2]+=h;case Ie:a=t[c+1],h=t[c+2],_.push(Ie,a,h),c+=3;break;case ze:t[c+1]+=a;case Ne:a=t[c+1],_.push(De,a,h),c+=2;break;case Xe:t[c+1]+=h;case Ye:h=t[c+1],_.push(De,a,h),c+=2;break;case Fe:t[c+1]+=a,t[c+2]+=h;case De:a=t[c+1],h=t[c+2],_.push(De,a,h),c+=3;break;case He:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=Ve;case Ve:n=r===je||r===Ve,l=n?2*a-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(je,l,d,s,i,a,h),c+=5;break;case Ue:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,o=je;case je:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(je,t[c+1],t[c+2],s,i,a,h),c+=7;break;case $e:t[c+1]+=a,t[c+2]+=h,o=Ke;case Ke:n=r===Ge||r===Ke,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?ps(_,a,h,s,i,t[c+1],t[c+2]):_.push(Ge,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case qe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=Ge;case Ge:s=t[c+1],i=t[c+2],e?ps(_,a,h,s,i,t[c+3],t[c+4]):_.push(Ge,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Qe:t[c+6]+=a,t[c+7]+=h;case Je:gs(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case ts:case Ze:_.push(Ze),c++;break;case es:a=t[c+1],h=t[c+2],e?ls(_,a,h,t[c+3],t[c+4]):xs(_,t,c,5),c+=5;break;case ss:a=t[c+1],h=t[c+2],e?ds(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):xs(_,t,c,9),c+=9;break;case is:a=t[c+1],h=t[c+2],e?ds(_,a,h,t[c+3],t[c+4],t[c+5]):xs(_,t,c,6),c+=6;break;case os:_s(e?_:xs(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,ys),a=ys.x,h=ys.y,c+=9;break;case rs:e?_s(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):xs(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case ns:us(e?_:xs(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,ys),a=ys.x,h=ys.y,c+=7;break;case as:e?us(_,t[c+1],t[c+2],t[c+3],0,360,!1):xs(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case hs:cs(e?_:xs(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,ys),a=ys.x,h=ys.y,c+=6;break;default:return fs.error(`command: ${o} [index:${c}]`,t),_}r=o}return _},copyData(t,e,s,i){for(let o=s,r=s+i;o<r;o++)t.push(e[o])},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:vs,copyData:xs}=ms,{M:bs,L:Bs,C:ks,Q:Rs,Z:Cs,N:Ts,D:Ss,X:Ls,G:Ps,F:Es,O:Os,P:As,U:Ms}=te,{getMinDistanceFrom:Is,getRadianFrom:Ws}=Y,{tan:Ds,min:Fs,abs:Ns}=Math,zs={},Ys={beginPath(t){t.length=0},moveTo(t,e,s){t.push(bs,e,s)},lineTo(t,e,s){t.push(Bs,e,s)},bezierCurveTo(t,e,s,i,o,r,n){t.push(ks,e,s,i,o,r,n)},quadraticCurveTo(t,e,s,i,o){t.push(Rs,e,s,i,o)},closePath(t){t.push(Cs)},rect(t,e,s,i,o){t.push(Ts,e,s,i,o)},roundRect(t,e,s,i,o,r){if("number"==typeof r)t.push(Ls,e,s,i,o,r);else{const n=m.fourNumber(r);n?t.push(Ss,e,s,i,o,...n):t.push(Ts,e,s,i,o)}},ellipse(t,e,s,i,o,r,n,a,h){void 0===r?t.push(Es,e,s,i,o):(void 0===n&&(n=0),void 0===a&&(a=360),t.push(Ps,e,s,i,o,r,n,a,h?1:0))},arc(t,e,s,i,o,r,n){void 0===o?t.push(As,e,s,i):(void 0===r&&(r=360),t.push(Os,e,s,i,o,r,n?1:0))},arcTo(t,e,s,i,o,r,n,a){if(void 0!==n){const h=Ds(Ws(n,a,e,s,i,o)/2)*(Is(n,a,e,s,i,o)/2);t.push(Ms,e,s,i,o,Fs(r,Ns(h)))}else t.push(Ms,e,s,i,o,r)},drawEllipse(t,e,s,i,o,r,n,a,h){Re.ellipse(null,e,s,i,o,void 0===r?0:r,void 0===n?0:n,void 0===a?360:a,h,null,null,zs),t.push(bs,zs.x,zs.y),Xs(t,e,s,i,o,r,n,a,h)},drawArc(t,e,s,i,o,r,n){Re.arc(null,e,s,i,void 0===o?0:o,void 0===r?360:r,n,null,null,zs),t.push(bs,zs.x,zs.y),js(t,e,s,i,o,r,n)},drawPoints(t,e,s,i){Re.points(t,e,s,i)}},{ellipse:Xs,arc:js}=Ys,{moveTo:Us,lineTo:Vs,quadraticCurveTo:Hs,bezierCurveTo:Gs,closePath:qs,beginPath:Ks,rect:$s,roundRect:Js,ellipse:Qs,arc:Zs,arcTo:ti,drawEllipse:ei,drawArc:si,drawPoints:ii}=Ys;class oi{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.clearPath=this.beginPath,this.set(t)}set(t){return this.__path=t?"string"==typeof t?Qt.parse(t):t:[],this}beginPath(){return Ks(this.__path),this}moveTo(t,e){return Us(this.__path,t,e),this}lineTo(t,e){return Vs(this.__path,t,e),this}bezierCurveTo(t,e,s,i,o,r){return Gs(this.__path,t,e,s,i,o,r),this}quadraticCurveTo(t,e,s,i){return Hs(this.__path,t,e,s,i),this}closePath(){return qs(this.__path),this}rect(t,e,s,i){return $s(this.__path,t,e,s,i),this}roundRect(t,e,s,i,o){return Js(this.__path,t,e,s,i,o),this}ellipse(t,e,s,i,o,r,n,a){return Qs(this.__path,t,e,s,i,o,r,n,a),this}arc(t,e,s,i,o,r){return Zs(this.__path,t,e,s,i,o,r),this}arcTo(t,e,s,i,o){return ti(this.__path,t,e,s,i,o),this}drawEllipse(t,e,s,i,o,r,n,a){return ei(this.__path,t,e,s,i,o,r,n,a),this}drawArc(t,e,s,i,o,r){return si(this.__path,t,e,s,i,o,r),this}drawPoints(t,e,s){return ii(this.__path,t,e,s),this}}const{M:ri,L:ni,C:ai,Q:hi,Z:li,N:di,D:ci,X:ui,G:_i,F:pi,O:gi,P:fi,U:yi}=te,mi=kt.get("PathDrawer"),wi={drawPathByData(t,e){if(!e)return;let s,i=0,o=e.length;for(;i<o;)switch(s=e[i],s){case ri:t.moveTo(e[i+1],e[i+2]),i+=3;break;case ni:t.lineTo(e[i+1],e[i+2]),i+=3;break;case ai:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case hi:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case li:t.closePath(),i+=1;break;case di:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case ci:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case ui:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case _i:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*w,e[i+6]*w,e[i+7]*w,e[i+8]),i+=9;break;case pi:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,v,!1),i+=5;break;case gi:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*w,e[i+5]*w,e[i+6]),i+=7;break;case fi:t.arc(e[i+1],e[i+2],e[i+3],0,v,!1),i+=4;break;case yi:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void mi.error(`command: ${s} [index:${i}]`,e)}}},{M:vi,L:xi,C:bi,Q:Bi,Z:ki,N:Ri,D:Ci,X:Ti,G:Si,F:Li,O:Pi,P:Ei,U:Oi}=te,{toTwoPointBounds:Ai,toTwoPointBoundsByQuadraticCurve:Mi,arcTo:Ii,arc:Wi,ellipse:Di}=Re,{addPointBounds:Fi,copy:Ni,addPoint:zi,setPoint:Yi,addBounds:Xi,toBounds:ji}=q,Ui=kt.get("PathBounds");let Vi,Hi,Gi;const qi={},Ki={},$i={},Ji={toBounds(t,e){Ji.toTwoPointBounds(t,Ki),ji(Ki,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Yi(e,0,0);let s,i,o,r,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===ki||s===bi||s===Bi?Yi(e,h,l):Yi(e,t[a+1],t[a+2])),s){case vi:case xi:h=t[a+1],l=t[a+2],zi(e,h,l),a+=3;break;case bi:r=t[a+5],n=t[a+6],Ai(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,n,qi),Fi(e,qi),h=r,l=n,a+=7;break;case Bi:i=t[a+1],o=t[a+2],r=t[a+3],n=t[a+4],Mi(h,l,i,o,r,n,qi),Fi(e,qi),h=r,l=n,a+=5;break;case ki:a+=1;break;case Ri:h=t[a+1],l=t[a+2],Xi(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ci:case Ti:h=t[a+1],l=t[a+2],Xi(e,h,l,t[a+3],t[a+4]),a+=s===Ci?9:6;break;case Si:Di(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],qi,$i),0===a?Ni(e,qi):Fi(e,qi),h=$i.x,l=$i.y,a+=9;break;case Li:h=t[a+1],l=t[a+2],Hi=t[a+3],Gi=t[a+4],Xi(e,h-Hi,l-Gi,2*Hi,2*Gi),h+=Hi,a+=5;break;case Pi:Wi(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],qi,$i),0===a?Ni(e,qi):Fi(e,qi),h=$i.x,l=$i.y,a+=7;break;case Ei:h=t[a+1],l=t[a+2],Vi=t[a+3],Xi(e,h-Vi,l-Vi,2*Vi,2*Vi),h+=Vi,a+=4;break;case Oi:Ii(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],qi,$i),0===a?Ni(e,qi):Fi(e,qi),h=$i.x,l=$i.y,a+=6;break;default:return void Ui.error(`command: ${s} [index:${a}]`,t)}}},{M:Qi,L:Zi,C:to,Z:eo}=te,{getCenterX:so,getCenterY:io}=Y,{arcTo:oo}=Ys,ro={smooth(t,e,s){let i,o=0,r=0,n=0,a=0,h=0,l=0,d=0,c=0,u=0;const _=t.length,p=[];for(;o<_;)switch(i=t[o],i){case Qi:a=c=t[o+1],h=u=t[o+2],o+=3,t[o]===Zi?(l=t[o+1],d=t[o+2],p.push(Qi,so(a,l),io(h,d))):p.push(Qi,a,h);break;case Zi:switch(r=t[o+1],n=t[o+2],o+=3,t[o]){case Zi:oo(p,r,n,t[o+1],t[o+2],e,c,u);break;case eo:oo(p,r,n,a,h,e,c,u);break;default:p.push(Zi,r,n)}c=r,u=n;break;case to:p.push(to,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6]),o+=7;break;case eo:oo(p,a,h,l,d,e,c,u),p.push(eo),o+=1}return i!==eo&&(p[1]=a,p[2]=h),p}};Qt.creator=new oi,Qt.parse=ms.parse,Qt.convertToCanvasData=ms.toCanvasData;const no=new oi,{drawRoundRect:ao}=ae;function ho(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,o){ao(this,t,e,s,i,o)})}(t)}const lo={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=co.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{}}}},co=lo;co.opacityTypes.forEach((t=>co.upperCaseTypeMap[t]=t.toUpperCase()));const uo=kt.get("TaskProcessor");class _o{constructor(t){this.parallel=!0,this.time=1,this.id=_.create(_.TASK),this.task=t}run(){return Xt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){uo.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class po{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&Dt.assign(this.config,t),this.empty()}add(t,e){let s,i,o,r;const n=new _o(t);return n.parent=this,"number"==typeof e?r=e:e&&(i=e.parallel,s=e.start,o=e.time,r=e.delay),o&&(n.time=o),!1===i&&(n.parallel=!1),void 0===r?this.push(n,s):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(n,s))}),r)),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,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const go={map:{},recycledList:[],tasker:new po,patternTasker:new po,get isComplete(){return fo.tasker.isComplete},get(t){let e=fo.map[t.url];return e||(e=u.image(t),fo.map[t.url]=e),e.use++,e},recycle(t){t.use--,setTimeout((()=>{t.use||fo.recycledList.push(t)}))},clearRecycled(){const t=fo.recycledList;t.length>100&&(t.forEach((t=>{!t.use&&t.url&&(delete fo.map[t.url],t.destroy())})),t.length=0)},hasOpacityPixel:t=>lo.opacityTypes.some((e=>fo.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+lo.mineType(t)))return!0}else if(s.includes("."+t)||s.includes("."+lo.upperCaseTypeMap[t]))return!0;return!1},destroy(){fo.map={},fo.recycledList=[]}},fo=go,{IMAGE:yo,create:mo}=_;class wo{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){this.use=0,this.waitComplete=[],this.innerId=mo(yo),this.config=t||{url:""},this.isSVG=go.isFormat("svg",t),this.hasOpacityPixel=go.hasOpacityPixel(t)}load(t,e){return this.loading||(this.loading=!0,go.tasker.add((()=>Xt(this,void 0,void 0,(function*(){return yield c.origin.loadImage(this.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)})).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}onComplete(t){let e;this.waitComplete.forEach(((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))})),this.waitComplete.length=0,this.loading=!1}getCanvas(t,e,s,i){if(t||(t=this.width),e||(e=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=c.origin.createCanvas(t,e),r=o.getContext("2d");return s&&(r.globalAlpha=s),r.drawImage(this.view,0,0,t,e),this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(t,e,s,i){const o=c.canvas.createPattern(t,e);try{s&&o.setTransform&&(o.setTransform(s),s=null)}catch(t){}return i&&(i.transform=s),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function vo(t,e,s){Object.defineProperty(t,e,s)}function xo(t,e){return Object.getOwnPropertyDescriptor(t,e)}function bo(t,e){return(s,i)=>function(t,e,s,i){const o={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};vo(t,e,Object.assign(o,i||{})),Fo(t,e,s)}(s,i,t,e&&e(i))}function Bo(t){return bo(t)}function ko(t,e){return bo(t,(t=>({set(s){this.__setAttr(t,s,e),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}function Ro(t,e){return bo(t,(t=>({set(s){this.__setAttr(t,s,e),this.__layout.scaleChanged||this.__layout.scaleChange()}})))}function Co(t,e){return bo(t,(t=>({set(s){this.__setAttr(t,s,e),this.__layout.rotationChanged||this.__layout.rotationChange()}})))}function To(t,e){return bo(t,(t=>({set(s){this.__setAttr(t,s,e)&&So(this)}})))}function So(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}const Lo=To;function Po(t){return bo(t,(t=>({set(e){this.__setAttr(t,e)&&Eo(this)}})))}function Eo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&So(t)}const Oo=Po;function Ao(t){return bo(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Mo(t){return bo(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})))}function Io(t){return bo(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.opacityChanged||this.__layout.opacityChange()}})))}function Wo(t){return bo(t,(t=>({set(e){this.__setAttr(t,e),kt.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor()}})))}function Do(t){return(e,s)=>{vo(e,"__DataProcessor",{get:()=>t})}}function Fo(t,e,s){const i=t.__DataProcessor.prototype,o="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),n={get(){const t=this[o];return void 0===t?s:t},set(t){this[o]=t},configurable:!0,enumerable:!0};void 0===s?n.get=function(){return this[o]}:"width"===e?n.get=function(){const t=this[o];return void 0===t?this.__naturalWidth||s:t}:"height"===e&&(n.get=function(){const t=this[o];return void 0===t?this.__naturalHeight||s:t});let a,h=i;for(;!a&&h;)a=xo(h,e),h=h.__proto__;a&&a.set&&(n.set=a.set),i[r]&&(n.set=i[r],delete i[r]),Object.defineProperty(i,e,n)}const No=new kt("rewrite"),zo=[],Yo=["destroy","constructor"];function Xo(t){return(e,s)=>{zo.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function jo(){return t=>{Uo()}}function Uo(t){zo.length&&(zo.forEach((e=>{t&&No.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),zo.length=0)}function Vo(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(Yo.includes(i)||e&&e.includes(i)))if(t.prototype){xo(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function Ho(){return t=>{Et.register(t)}}setTimeout((()=>Uo(!0)));const{copy:Go,toInnerPoint:qo,scaleOfOuter:Ko,rotateOfOuter:$o,skewOfOuter:Jo,multiplyParent:Qo,divideParent:Zo,getLayout:tr}=P,er={},sr={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),rr(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,o=i.length;t<o;t++)or(i[t],e,s)}},updateMatrix(t,e,s){const i=t.__layout;e?s&&(i.waitAutoLayout=!0,t.__hasAutoLayout&&(i.matrixChanged=!1)):i.waitAutoLayout&&(i.waitAutoLayout=!1),i.matrixChanged&&t.__updateLocalMatrix(),i.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)nr(e[t])}},updateAllChange(t){if(nr(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)ar(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,s=0){const i="object"==typeof e?Object.assign({},e):{x:e,y:s};t.parent&&qo(t.parent.worldTransform,i,i,!0),ir.moveLocal(t,i.x,i.y)},moveLocal(t,e,s=0){"object"==typeof e?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},zoomOfWorld(t,e,s,i,o){ir.zoomOfLocal(t,lr(t,e),s,i,o)},zoomOfLocal(t,e,s,i=s,o){Go(er,t.__localMatrix),Ko(er,e,s,i),hr(t,er),t.scaleResize(s,i,!0!==o)},rotateOfWorld(t,e,s){ir.rotateOfLocal(t,lr(t,e),s)},rotateOfLocal(t,e,s){Go(er,t.__localMatrix),$o(er,e,s),hr(t,er),t.rotation=m.formatRotation(t.rotation+s)},skewOfWorld(t,e,s,i,o){ir.skewOfLocal(t,lr(t,e),s,i,o)},skewOfLocal(t,e,s,i=0,o){Go(er,t.__localMatrix),Jo(er,e,s,i),ir.setTransform(t,er,o)},transformWorld(t,e,s){Go(er,t.worldTransform),Qo(er,e),t.parent&&Zo(er,t.parent.worldTransform),ir.setTransform(t,er,s)},transform(t,e,s){Go(er,t.localTransform),Qo(er,e),ir.setTransform(t,er,s)},setTransform(t,e,s){const i=tr(e);s&&(t.scaleResize(i.scaleX/t.scaleX,i.scaleY/t.scaleY,!0!==s),delete i.scaleX,delete i.scaleY),t.set(i)},getRelativeWorld:(t,e,s)=>(Go(er,t.worldTransform),Zo(er,e.worldTransform),s?er:Object.assign({},er)),drop(t,e,s,i){t.setTransform(ir.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},hasParentAutoLayout(t){for(;t.parent;)if((t=t.parent).__hasAutoLayout)return!0}},ir=sr,{updateAllMatrix:or,updateMatrix:rr,updateAllWorldOpacity:nr,updateAllChange:ar}=ir;function hr(t,e){const{e:s,f:i}=t.__localMatrix;t.x+=e.e-s,t.y+=e.f-i}function lr(t,e){return t.__layout.update(),t.parent?Y.tempToInnerOf(e,t.parent.__world):e}const dr={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser?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:cr}=sr,ur={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let i=0,o=s.length;i<o;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.add(t),_r(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)pr(e[t],e)},updateBounds(t,e){const s=[t];pr(t,s),gr(s,e)},updateBoundsByBranchStack(t,e){let s,i;for(let o=t.length-1;o>-1;o--){s=t[o],i=s.children;for(let t=0,e=i.length;t<e;t++)cr(i[t]);e&&e===s||cr(s)}}},{pushAllChildBranch:_r,pushAllBranchStack:pr,updateBoundsByBranchStack:gr}=ur,fr={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:yr}=sr,{toOuterOf:mr,getPoints:wr,copy:vr}=ct;class xr{get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}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:t}=this.leaf;if(t)t.ready?t.watcher.changed&&t.layouter.layout():t.start();else{let t=this.leaf;for(;t.parent&&!t.parent.leafer;)t=t.parent;c.layout(t)}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return P.defaultMatrix;case"page":t=e.zoomLayer;default:return yr(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new gt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"margin":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"margin":case"content":case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}}getLayoutBounds(t,e="world",s){const{leaf:i}=this;let o,r,n=this.getInnerBounds(t);switch(e){case"world":o=i.getWorldPoint(n),r=i.__world;break;case"local":o=i.getLocalPointByInner(n),r=i.__localMatrix;break;case"inner":o=n,r=P.defaultMatrix;break;case"page":e=i.zoomLayer;default:o=i.getWorldPoint(n,e),r=yr(i,e,!0)}const a=P.getLayout(r);if(vr(a,n),Y.copy(a,o),s){const{scaleX:t,scaleY:e}=a,s=Math.abs(t),i=Math.abs(e);1===s&&1===i||(a.scaleX/=s,a.scaleY/=i,a.width*=s,a.height*=i)}return a}getLayoutPoints(t,e="world"){const{leaf:s}=this,i=wr(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:o=e}return void 0!==o&&i.forEach((t=>s.innerToWorld(t,null,!1,o))),i}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),mr(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),mr(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),mr(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}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}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:i},this._localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:i},this._localRenderBounds={x:t,y:e,width:s,height:i}}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),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(){}}const br={},Br={on(t,e,s){let i,o,r;s&&("boolean"==typeof s?i=s:(i=s.capture,o=s.once));const n=kr(this,i,!0),a="string"==typeof t?t.split(" "):t,h=o?{listener:e,once:o}:{listener:e};a.forEach((t=>{t&&(r=n[t],r?-1===r.findIndex((t=>t.listener===e))&&r.push(h):n[t]=[h])}))},off(t,e,s){let i,o,r;s&&(i="boolean"==typeof s?s:s.capture);const n=kr(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(o=n[t],o&&(r=o.findIndex((t=>t.listener===e)),r>-1&&o.splice(r,1),o.length||delete n[t]))}))},on_(t,e,s,i){return s&&(e=e.bind(s)),this.on(t,e,i),{type:t,current:this,listener:e,options:i}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){!e&&Mt.has(t)&&(e=Mt.get(t,{type:t,target:this,current:this}));const i=kr(this,s)[t];if(i){let o;for(let r=0,n=i.length;r<n&&(o=i[r],o.listener(e),o.once&&(this.off(t,o.listener,s),r--,n--),!e||!e.isStopNow);r++);}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:i}=this,o=s&&s[t],r=i&&i[t];return!!(void 0===e?o||r:e?r:o)}};function kr(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:br)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:br)}}class Rr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&c.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&c.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&c.event.stop(this.origin)}}class Cr extends Rr{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Cr.ADD="child.add",Cr.REMOVE="child.remove",Cr.DESTROY="child.destroy";class Tr extends Rr{constructor(t,e,s,i,o){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=o}}Tr.CHANGE="property.change",Tr.LEAFER_CHANGE="property.leafer_change";class Sr extends Rr{constructor(t,e){super(t),Object.assign(this,e)}}Sr.LOAD="image.load",Sr.LOADED="image.loaded",Sr.ERROR="image.error";class Lr extends Rr{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(Lr.RESIZE),Object.assign(this,t)):super(t),this.old=e}}Lr.RESIZE="resize";class Pr extends Rr{constructor(t,e){super(t),this.data=e}}Pr.REQUEST="watch.request",Pr.DATA="watch.data";class Er extends Rr{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}Er.CHECK_UPDATE="layout.check_update",Er.REQUEST="layout.request",Er.START="layout.start",Er.BEFORE="layout.before",Er.LAYOUT="layout",Er.AFTER="layout.after",Er.AGAIN="layout.again",Er.END="layout.end";class Or extends Rr{}Or.FRAME="animate.frame";class Ar extends Rr{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}Ar.REQUEST="render.request",Ar.START="render.start",Ar.BEFORE="render.before",Ar.RENDER="render",Ar.AFTER="render.after",Ar.AGAIN="render.again",Ar.END="render.end",Ar.NEXT="render.next";class Mr extends Rr{}Mr.START="leafer.start",Mr.BEFORE_READY="leafer.before_ready",Mr.READY="leafer.ready",Mr.AFTER_READY="leafer.after_ready",Mr.VIEW_READY="leafer.view_ready",Mr.VIEW_COMPLETED="leafer.view_completed",Mr.STOP="leafer.stop",Mr.RESTART="leafer.restart",Mr.END="leafer.end";const{isFinite:Ir}=Number,Wr=kt.get("setAttr"),Dr={__setAttr(t,e,s){if(this.leafer&&this.leafer.created){const i=this.__.__getInput(t);if(s&&!Ir(e)&&void 0!==e&&(Wr.warn(this.innerName,t,e),e=void 0),"object"==typeof e||i!==e){this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e);const{CHANGE:s}=Tr,o=new Tr(s,this,t,i,e);return this.isLeafer?this.emitEvent(new Tr(Tr.LEAFER_CHANGE,this,t,i,e)):this.hasEvent(s)&&this.emitEvent(o),this.leafer.emitEvent(o),!0}return!1}return this.__[t]=e,this.__proxyData&&this.setProxyAttr(t,e),!0},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Fr,multiplyParent:Nr,translateInner:zr,defaultWorld:Yr}=P,{toPoint:Xr,tempPoint:jr}=xt,Ur={__updateWorldMatrix(){Nr(this.__local||this.__layout,this.parent?this.parent.__world:Yr,this.__world,!!this.__layout.affectScaleOrRotation,this.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged||t.rotationChanged)&&(Fr(e,s,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=s.x,e.f=s.y,s.around&&(Xr(s.around,t.boxBounds,jr),zr(e,-jr.x,-jr.y))}this.__layout.matrixChanged=!1}},{updateMatrix:Vr,updateAllMatrix:Hr,hasParentAutoLayout:Gr}=sr,{updateBounds:qr}=ur,{toOuterOf:Kr,copyAndSpread:$r,copy:Jr}=ct,{toBounds:Qr}=Ji,Zr={__updateWorldBounds(){Kr(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.boxChanged=!1,t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasAutoLayout&&this.__updateAutoLayout(),Kr(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Kr(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Kr(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Qr(e.__pathForRender,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.leafer&&this.leafer.layouter.addExtra(this),Gr(this)?Vr(this):(Hr(this),qr(this,this))):Vr(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){$r(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){const{renderSpread:t,strokeBounds:e,renderBounds:s}=this.__layout;t>0?$r(s,e,t):Jr(s,e)}},tn={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=this.__.opacity,this.__.__single){const s=t.getSameCanvas(!0,!0);this.__draw(s,e),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}=dr,sn={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const i=this.__getNowWorld(e);t.opacity=this.__.opacity,t.copyWorldByReset(s,i,i,this.__.__blendMode,!0),s.recycle(i)}else this.__renderBranch(t,e)},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let i=0,o=s.length;i<o;i++)en(s[i],e)||s[i].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let i=0,o=s.length;i<o;i++)en(s[i],e)||s[i].__clip(t,e)}}},{LEAF:on,create:rn}=_,{toInnerPoint:nn,toOuterPoint:an,multiplyParent:hn}=P,{toOuterOf:ln}=ct,{tempToOuterOf:dn,copy:cn}=Y,{moveLocal:un,zoomOfLocal:_n,rotateOfLocal:pn,skewOfLocal:gn,moveWorld:fn,zoomOfWorld:yn,rotateOfWorld:mn,skewOfWorld:wn,transform:vn,transformWorld:xn,setTransform:bn,getRelativeWorld:Bn,drop:kn}=sr;let Rn=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 Nt}get __LayoutProcessor(){return xr}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 pathInputed(){return!!this.__.__pathInputed}constructor(t){this.innerId=rn(on),this.reset(t)}reset(t){this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},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.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}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.__leaferWait&&fr.run(this.__leaferWait)),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t){}get(t){}toJSON(){return this.__.__getInputData()}toString(){return JSON.stringify(this.toJSON())}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findOne(t,e){}focus(t){}forceUpdate(t){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===e?null:void 0,this[t]=e}updateLayout(){this.__layout.update()}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.eraser))}__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.mask))}__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}getWorld(t){return this.__layout.update(),"x"===t?this.__world.e:"y"===t?this.__world.f:this.getLayoutBounds()[t]}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 i=e?Bn(this,e):this.worldTransform,o=s?t:{};return ln(t,i,o),o}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&cn(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&cn(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),nn(this.worldTransform,t,e,s)}innerToWorld(t,e,s,i){an(this.worldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getInnerPoint(t,e,s,i){const o=i?t:{};return this.worldToInner(t,o,s,e),o}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const o=i?t:{};return this.worldToLocal(t,o,s,e),o}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getWorldPoint(t,e,s,i){const o=i?t:{};return this.innerToWorld(t,o,s,e),o}getWorldPointByLocal(t,e,s,i){const o=i?t:{};return this.localToWorld(t,o,s,e),o}getPagePoint(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,i)}getWorldPointByPage(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,i)}setTransform(t,e){bn(this,t,e)}transform(t,e){vn(this,t,e)}move(t,e){un(this,t,e)}scaleOf(t,e,s,i){_n(this,dn(t,this.localTransform),e,s,i)}rotateOf(t,e){pn(this,dn(t,this.localTransform),e)}skewOf(t,e,s,i){gn(this,dn(t,this.localTransform),e,s,i)}transformWorld(t,e){xn(this,t,e)}moveWorld(t,e){fn(this,t,e)}scaleOfWorld(t,e,s,i){yn(this,t,e,s,i)}rotateOfWorld(t,e){mn(this,t,e)}skewOfWorld(t,e,s,i){wn(this,t,e,s,i)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}__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,i){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){kn(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e){Fo(this.prototype,t,e)}static addAttr(t,e,s){s||(s=To),s(e)(this.prototype,t)}destroy(){if(!this.destroyed){const{parent:t}=this;t&&this.remove(),this.children&&this.removeAll(!0),this.hasEvent(Cr.DESTROY)&&this.emitEvent(new Cr(Cr.DESTROY,this,t)),this.__.destroy(),this.__layout.destroy(),this.__captureMap=this.__bubbleMap=this.__parentWait=this.__leaferWait=null,this.destroyed=!0}}};Rn=Yt([Vo(Dr),Vo(Ur),Vo(Zr),Vo(Br),Vo(tn)],Rn);const{setListWithFn:Cn}=ct,{sort:Tn}=ur,{localBoxBounds:Sn,localStrokeBounds:Ln,localRenderBounds:Pn,maskLocalBoxBounds:En,maskLocalStrokeBounds:On,maskLocalRenderBounds:An}=dr;let Mn=class extends Rn{__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(){Cn(this.__layout.boxBounds,this.children,this.__hasMask?En:Sn)}__updateStrokeBounds(){Cn(this.__layout.strokeBounds,this.children,this.__hasMask?On:Ln)}__updateRenderBounds(){Cn(this.__layout.renderBounds,this.children,this.__hasMask?An:Pn)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Tn),this.__layout.affectChildrenSort=t}}add(t,e){t!==this&&(t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boxChanged||t.__layout.boxChange(),t.__layout.matrixChanged||t.__layout.matrixChange(),t.__parentWait&&fr.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Cr.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange())}addMany(...t){t.forEach((t=>this.add(t)))}remove(t,e){if(t){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}else void 0===t&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach((e=>{this.__realRemoveChild(e),t&&e.destroy()})))}clear(){this.removeAll(!0)}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Cr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Cr(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};Mn=Yt([Vo(sn)],Mn);class In{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return t&&void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}add(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(void 0===s[t.innerId]){const{list:i}=this;for(let t=e,o=i.length;t<o;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let i=0,o=e.length;i<o;i++)void 0!==s?this.keys[e[i].innerId]=i-1:e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}forEach(t){this.list.forEach(t)}clone(){const t=new In;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Wn{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.addList(t):this.add(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}addList(t){t.forEach((t=>{this.add(t)}))}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}function Dn(t,e,s,i){var o,r=arguments.length,n=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(n=(r<3?o(n):r>3?o(e,s,n):o(e,s))||n);return r>3&&n&&Object.defineProperty(e,s,n),n}"function"==typeof SuppressedError&&SuppressedError;const Fn={},Nn={},zn={},Yn={},Xn={},jn={},Un={},Vn={},Hn={};function Gn(t){return bo(t,(t=>({set(e){this.__setAttr(t,e),this.waitLeafer((()=>{Hn.setStyle&&Hn.setStyle(this,t+"Style",e)}))}})))}function qn(t){return bo(t,(t=>({set(e){this.__setAttr(t,e);const s=this.__;s.__useArrow="none"!==s.startArrow||"none"!==s.endArrow,Eo(this)}})))}function Kn(t){return bo(t,(t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function $n(t){return bo(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}const{parse:Jn}=ms,Qn={},Zn=kt.get("UIData");class ta extends Nt{get __strokeWidth(){const{strokeWidth:t,strokeWidthFixed:e}=this;if(e){const e=this.__leaf;let{scaleX:s}=e.__nowWorld||e.__world;return s<0&&(s=-s),s>1?t/s:t}return t}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this.__leaf.leafer&&(this.__leaf.leafer.watcher.hasVisible=!0),this._visible=t}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Zn.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Zn.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isFills=!0,this._fill||(this._fill=Qn)):(this.__isFills&&(this.__removeInput("fill"),Xn.recycleImage("fill",this),this.__isFills=!1,this.__pixelFill&&(this.__pixelFill=!1)),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged||this.__leaf.__layout.boxChange(),this.__isStrokes=!0,this._stroke||(this._stroke=Qn)):(this.__isStrokes&&(this.__removeInput("stroke"),Xn.recycleImage("stroke",this),this.__isStrokes=!1,this.__pixelStroke&&(this.__pixelStroke=!1)),this._stroke=t)}setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=Jn(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){this.__setInput("shadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._shadow=t.length?t:null):this._shadow=t?!1===t.visible?null:[t]:null}setInnerShadow(t){this.__setInput("innerShadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._innerShadow=t.length?t:null):this._innerShadow=t?!1===t.visible?null:[t]:null}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Yn.compute("fill",this.__leaf),e&&Yn.compute("stroke",this.__leaf),this.__needComputePaint=!1}}const ea={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class sa extends ta{}class ia extends sa{get __boxStroke(){return!0}}class oa extends ta{get __boxStroke(){return!0}}const ra={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};const na={__updateStrokeSpread(){let t=0,e=0;const{stroke:s,hitStroke:i,strokeAlign:o,strokeWidth:r}=this.__;if((s||"all"===i)&&r&&"inside"!==o&&(e=t="center"===o?r/2:r,!this.__.__boxStroke)){const{miterLimit:e,strokeCap:s}=this.__,i="Line"!==this.__tag?1/Math.sin(e*w/2)*Math.sqrt(r)-t:0,o="none"===s?0:r;t+=Math.max(i,o)}return this.__layout.strokeBoxSpread=e,this.__.__useArrow&&(t+=5*r),t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:o}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),i&&(t=Math.max(t,i));let r=t=Math.ceil(t);return s&&s.forEach((t=>{r=Math.max(r,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),o&&(r=Math.max(r,o)),this.__layout.renderShapeSpread=r,t}},aa={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:i,backgroundBlur:o}=this.__;t.__useEffect=!!(e||s||i||o)}t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){ha(this,t,e)},__draw(t,e){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:i,stroke:o,__drawAfterFill:r}=s;if(this.__drawRenderPath(t),s.__useEffect){const n=Yn.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:a,innerShadow:h}=s;a&&Un.shadow(this,t,n),i&&(s.__isFills?Yn.fills(i,this,t):Yn.fill(i,this,t)),r&&this.__drawAfterFill(t,e),h&&Un.innerShadow(this,t,n),o&&(s.__isStrokes?Yn.strokes(o,this,t):Yn.stroke(o,this,t)),n.worldCanvas&&n.worldCanvas.recycle(),n.canvas.recycle()}else i&&(s.__isFills?Yn.fills(i,this,t):Yn.fill(i,this,t)),r&&this.__drawAfterFill(t,e),o&&(s.__isStrokes?Yn.strokes(o,this,t):Yn.stroke(o,this,t))}else s.__pathInputed?ha(this,t,e):this.__drawFast(t,e)},__renderShape(t,e,s,i){if(this.__worldOpacity){t.setWorld(this.__nowWorld=this.__getNowWorld(e));const{fill:o,stroke:r}=this.__;this.__drawRenderPath(t),o&&!s&&(this.__.__pixelFill?Yn.fills(o,this,t):Yn.fill("#000000",this,t)),r&&!i&&(this.__.__pixelStroke?Yn.strokes(r,this,t):Yn.stroke("#000000",this,t))}}};function ha(t,e,s){const{fill:i,stroke:o,__drawAfterFill:r}=t.__;t.__drawRenderPath(e),i&&Yn.fill(i,t,e),r&&t.__drawAfterFill(e,s),o&&Yn.stroke(o,t,e)}const la={__drawFast(t,e){const{width:s,height:i,fill:o,stroke:r,__drawAfterFill:n}=this.__;if(o&&(t.fillStyle=o,t.fillRect(0,0,s,i)),n&&this.__drawAfterFill(t,e),r){const{strokeAlign:e,__strokeWidth:o}=this.__;if(!o)return;t.setStroke(r,o,this.__);const n=o/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(n,n,s-o,i-o);break;case"outside":t.strokeRect(-n,-n,s+o,i+o)}}}};var da;let ca=da=class extends Rn{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){"number"==typeof t?this.scaleX=this.scaleY=t:(this.scaleX=t.x,this.scaleY=t.y)}get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get pen(){return no.set(this.path=this.__.path||[]),no}get editConfig(){}get editOuter(){return"EditTool"}get editInner(){return"PathEditor"}constructor(t){super(t)}reset(t){}set(t){Object.assign(this,t)}get(t){return"string"==typeof t?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){}findOne(t,e){}getPath(t,e){this.__layout.update();let s=e?this.__.__pathForRender:this.__.path;if(!s){const{width:t,height:e}=this.boxBounds;(t||e)&&(no.set(s=[]),this.__drawPathByBox(no))}return t?ms.toCanvasData(s,!0):s}getPathString(t,e){return ms.stringify(this.getPath(t,e))}__onUpdateSize(){if(this.__.__input){const t=this.__;t.lazy&&this.leafer&&this.leafer.created&&!this.leafer.lazyBounds.hit(this.__world)?t.__needComputePaint=!0:t.__computePaint()}}__updateRenderPath(){if(this.__.path){const t=this.__;t.__pathForRender=t.cornerRadius?ro.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&zn.addArrows(this,!t.cornerRadius)}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?wi.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:s,width:i,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,s,i,o,"number"==typeof r?[r]:r)}else t.rect(e,s,i,o)}export(t,e){return Vn.export(this,t,e)}clone(){return da.one(this.toJSON())}static one(t,e,s,i,o){return Et.get(t.tag||this.prototype.__tag,t,e,s,i,o)}static registerUI(){Ho()(this)}static registerData(t){Do(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,super.destroy()}};var ua;Dn([Do(ta)],ca.prototype,"__",void 0),Dn([(t,e)=>{const s="_"+e;vo(t,e,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}],ca.prototype,"zoomLayer",void 0),Dn([Bo("")],ca.prototype,"id",void 0),Dn([Bo("")],ca.prototype,"name",void 0),Dn([Bo("")],ca.prototype,"className",void 0),Dn([Mo("pass-through")],ca.prototype,"blendMode",void 0),Dn([Io(1)],ca.prototype,"opacity",void 0),Dn([Io(!0)],ca.prototype,"visible",void 0),Dn([Gn(!1)],ca.prototype,"selected",void 0),Dn([Gn(!1)],ca.prototype,"disabled",void 0),Dn([Bo(!1)],ca.prototype,"locked",void 0),Dn([(ua=0,bo(ua,(t=>({set(e){this.__setAttr(t,e),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()}))}}))))],ca.prototype,"zIndex",void 0),Dn([function(t){return bo(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)}))}})))}(!1)],ca.prototype,"mask",void 0),Dn([Mo("pixel")],ca.prototype,"maskType",void 0),Dn([function(t){return bo(t,(t=>({set(e){this.__setAttr(t,e),this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}(!1)],ca.prototype,"eraser",void 0),Dn([ko(0,!0)],ca.prototype,"x",void 0),Dn([ko(0,!0)],ca.prototype,"y",void 0),Dn([To(100,!0)],ca.prototype,"width",void 0),Dn([To(100,!0)],ca.prototype,"height",void 0),Dn([Ro(1,!0)],ca.prototype,"scaleX",void 0),Dn([Ro(1,!0)],ca.prototype,"scaleY",void 0),Dn([Co(0,!0)],ca.prototype,"rotation",void 0),Dn([Co(0,!0)],ca.prototype,"skewX",void 0),Dn([Co(0,!0)],ca.prototype,"skewY",void 0),Dn([function(t){return bo(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.matrixChanged||this.__layout.matrixChange(),this.__hasAutoLayout=!!e,this.__local||this.__layout.createLocal()}})))}()],ca.prototype,"around",void 0),Dn([Bo(!1)],ca.prototype,"draggable",void 0),Dn([Bo()],ca.prototype,"dragBounds",void 0),Dn([Bo(!1)],ca.prototype,"editable",void 0),Dn([Bo("size")],ca.prototype,"editSize",void 0),Dn([Wo(!0)],ca.prototype,"hittable",void 0),Dn([Wo("path")],ca.prototype,"hitFill",void 0),Dn([Oo("path")],ca.prototype,"hitStroke",void 0),Dn([Wo(!1)],ca.prototype,"hitBox",void 0),Dn([Wo(!0)],ca.prototype,"hitChildren",void 0),Dn([Wo(!0)],ca.prototype,"hitSelf",void 0),Dn([Wo()],ca.prototype,"hitRadius",void 0),Dn([function(t){return bo(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}("")],ca.prototype,"cursor",void 0),Dn([Mo()],ca.prototype,"fill",void 0),Dn([Oo()],ca.prototype,"stroke",void 0),Dn([Oo("inside")],ca.prototype,"strokeAlign",void 0),Dn([Oo(1)],ca.prototype,"strokeWidth",void 0),Dn([Oo(!1)],ca.prototype,"strokeWidthFixed",void 0),Dn([Oo("none")],ca.prototype,"strokeCap",void 0),Dn([Oo("miter")],ca.prototype,"strokeJoin",void 0),Dn([Oo()],ca.prototype,"dashPattern",void 0),Dn([Oo()],ca.prototype,"dashOffset",void 0),Dn([Oo(10)],ca.prototype,"miterLimit",void 0),Dn([Bo(!1)],ca.prototype,"lazy",void 0),Dn([function(t){return bo(t,(t=>({set(e){this.__setAttr(t,e),So(this),this.__.__removeNaturalSize()}})))}(1)],ca.prototype,"pixelRatio",void 0),Dn([function(t){return bo(t,(t=>({set(e){2!==this.__.__pathInputed&&(this.__.__pathInputed=e?1:0),this.__setAttr(t,e),So(this)}})))}()],ca.prototype,"path",void 0),Dn([Lo()],ca.prototype,"windingRule",void 0),Dn([Lo(!0)],ca.prototype,"closed",void 0),Dn([qn("none")],ca.prototype,"startArrow",void 0),Dn([qn("none")],ca.prototype,"endArrow",void 0),Dn([Lo(0)],ca.prototype,"cornerRadius",void 0),Dn([Lo()],ca.prototype,"cornerSmoothing",void 0),Dn([Kn()],ca.prototype,"shadow",void 0),Dn([Kn()],ca.prototype,"innerShadow",void 0),Dn([Kn()],ca.prototype,"blur",void 0),Dn([Kn()],ca.prototype,"backgroundBlur",void 0),Dn([Kn()],ca.prototype,"grayscale",void 0),Dn([Bo()],ca.prototype,"normalStyle",void 0),Dn([Bo()],ca.prototype,"hoverStyle",void 0),Dn([Bo()],ca.prototype,"pressStyle",void 0),Dn([Bo()],ca.prototype,"focusStyle",void 0),Dn([Bo()],ca.prototype,"selectedStyle",void 0),Dn([Bo()],ca.prototype,"disabledStyle",void 0),Dn([Xo(Rn.prototype.reset)],ca.prototype,"reset",null),ca=da=Dn([Vo(na),Vo(aa),jo()],ca);let _a=class extends ca{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t){if(t.children){const{children:e}=t;let s;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t),e.forEach((t=>{s=t.__?t:Et.get(t.tag,t),this.add(s)})),t.children=e}else super.set(t)}toJSON(){const t=super.toJSON();return t.children=this.children.map((t=>t.toJSON())),t}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var pa;Dn([Do(sa)],_a.prototype,"__",void 0),_a=Dn([Vo(Mn),Ho()],_a);const ga=kt.get("Leafer");let fa=pa=class extends _a{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&go.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}constructor(t,e){super(e),this.config={type:"design",start:!0,hittable:!0,smooth:!0,lazySpeard:100,zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0,autoDistance:2}},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),pa.list.add(this)}init(t,e){if(this.canvas)return;let s;this.__setLeafer(this),t&&Dt.assign(this.config,t);const{config:i}=this;this.initType(i.type);const o=this.canvas=u.canvas(i);this.__controllers.push(this.renderer=u.renderer(this,o,i),this.watcher=u.watcher(this,i),this.layouter=u.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i),this.view=o.view,e?(this.__bindApp(e),s=e.running):(this.selector=u.selector(this),this.interaction=u.interaction(this,o,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=u.hitCanvasManager()),this.canvasManager=new Wt,s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(o),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),fr.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t){this.waitInit((()=>{super.set(t)}))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(Mr.RESTART):this.emitLeafer(Mr.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render(),this.running=!0)}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(Mr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=Dt.copyAttrs({},t,$t);Object.keys(e).forEach((t=>this[t]=e[t]))}forceFullRender(){this.forceRender()}forceRender(t){this.renderer.addBlock(t?new gt(t):this.canvas.bounds),this.viewReady&&this.renderer.update()}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const s=Dt.copyAttrs({},this.canvas,$t);e.resize(t),this.updateLazyBounds(),this.__onResize(new Lr(t,s))}__onResize(t){this.emitEvent(t),Dt.copyAttrs(this.__,t,$t),setTimeout((()=>{this.canvasManager&&this.canvasManager.clearRecycled()}),0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new yt(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&($t.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t&&(this.canvas.hittable=e)),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&$t.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=Dt.copyAttrs({},this.canvas,$t);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceFullRender()}__onCreated(){this.created=!0}__onReady(){this.ready||(this.ready=!0,this.emitLeafer(Mr.BEFORE_READY),this.emitLeafer(Mr.READY),this.emitLeafer(Mr.AFTER_READY),fr.run(this.__readyWait))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Mr.VIEW_READY),fr.run(this.__viewReadyWait))}__onNextRender(){if(this.viewReady){fr.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1)}}__checkViewCompleted(t=!0){this.nextRender((()=>{this.imageReady&&(t&&this.emitLeafer(Mr.VIEW_COMPLETED),fr.run(this.__viewCompletedWait),this.viewCompleted=!0)}))}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender((()=>this.interaction.updateCursor()))}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,s){e&&(t=t.bind(e));const i=this.__nextRenderWait;if(s){for(let e=0;e<i.length;e++)if(i[e]===t){i.splice(e,1);break}}else i.push(t)}zoom(t,e,s){}getValidMove(t,e){return{x:t,y:e}}getValidScale(t){return t}__checkUpdateLayout(){this.__layout.update()}emitLeafer(t){this.emitEvent(new Mr(t,this))}__listenEvents(){const t=St.start("FirstCreate "+this.innerName);this.once(Mr.START,(()=>St.end(t))),this.once(Er.START,(()=>this.updateLazyBounds())),this.once(Er.END,(()=>this.__onReady())),this.once(Ar.START,(()=>this.__onCreated())),this.once(Ar.END,(()=>this.__onViewReady())),this.__eventIds.push(this.on_(Pr.DATA,this.__onWatchData,this),this.on_(Ar.NEXT,this.__onNextRender,this),this.on_(Er.CHECK_UPDATE,this.__checkUpdateLayout,this))}__removeListenEvents(){this.off_(this.__eventIds),this.__eventIds.length=0}destroy(t){const e=()=>{if(!this.destroyed){pa.list.remove(this);try{this.stop(),this.emitEvent(new Mr(Mr.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>{this.parent&&t===this.interaction||t.destroy()})),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout((()=>{go.clearRecycled()}),100)}catch(t){ga.error(t)}}};t?e():setTimeout(e)}};fa.list=new In,Dn([Do(class extends sa{})],fa.prototype,"__",void 0),Dn([To()],fa.prototype,"pixelRatio",void 0),fa=pa=Dn([Ho()],fa);let ya=class extends ca{get __tag(){return"Rect"}constructor(t){super(t)}};Dn([Do(oa)],ya.prototype,"__",void 0),ya=Dn([Vo(la),jo(),Ho()],ya);const ma=ya.prototype,wa=_a.prototype,va={},{copy:xa,add:ba}=ct;let Ba=class extends _a{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){const t=this.__updateRectRenderSpread(),e=this.__.__drawAfterFill="hide"===this.__.overflow;return t||e?t:-1}__updateRectBoxBounds(){}__updateBoxBounds(){const t=this.__;if(t.__autoSide&&this.children.length){if(this.leafer&&this.leafer.layouter.addExtra(this),super.__updateBoxBounds(),!t.__autoSize){const e=this.__layout.boxBounds;t.__autoWidth||(e.x=0,e.width=t.width),t.__autoHeight||(e.y=0,e.height=t.height)}}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.__drawAfterFill){const{renderBounds:t}=this.__layout;xa(va,t),super.__updateRenderBounds(),ba(t,va)}}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.__renderGroup(t,e))}__drawAfterFill(t,e){t.save(),t.clip(),this.__renderGroup(t,e),t.restore(),this.__.stroke&&this.__drawRenderPath(t)}};Dn([Do(ia)],Ba.prototype,"__",void 0),Dn([Ao("show")],Ba.prototype,"overflow",void 0),Dn([Xo(ma.__updateStrokeSpread)],Ba.prototype,"__updateStrokeSpread",null),Dn([Xo(ma.__updateRenderSpread)],Ba.prototype,"__updateRectRenderSpread",null),Dn([Xo(ma.__updateBoxBounds)],Ba.prototype,"__updateRectBoxBounds",null),Dn([Xo(ma.__updateStrokeBounds)],Ba.prototype,"__updateStrokeBounds",null),Dn([Xo(ma.__updateRenderBounds)],Ba.prototype,"__updateRectRenderBounds",null),Dn([Xo(ma.__updateChange)],Ba.prototype,"__updateRectChange",null),Dn([Xo(ma.__render)],Ba.prototype,"__renderRect",null),Dn([Xo(wa.__render)],Ba.prototype,"__renderGroup",null),Ba=Dn([jo(),Ho()],Ba);let ka=class extends Ba{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};Dn([Do(class extends ia{})],ka.prototype,"__",void 0),Dn([Mo("#FFFFFF")],ka.prototype,"fill",void 0),Dn([Ao("hide")],ka.prototype,"overflow",void 0),ka=Dn([Ho()],ka);const{moveTo:Ra,closePath:Ca,ellipse:Ta}=Ys;let Sa=class extends ca{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:o}=this.__,r=t/2,n=e/2,a=this.__.path=[];s?(i||o?(s<1&&Ta(a,r,n,r*s,n*s,0,i,o,!1),Ta(a,r,n,r,n,0,o,i,!0),s<1&&Ca(a)):(s<1&&(Ta(a,r,n,r*s,n*s),Ra(a,t,n)),Ta(a,r,n,r,n,0,360,0,!0)),c.ellipseToCurve&&(this.__.path=this.getPath(!0))):i||o?(Ra(a,r,n),Ta(a,r,n,r,n,0,i,o,!1),Ca(a)):Ta(a,r,n,r,n)}};Dn([Do(class extends ta{get __boxStroke(){return!0}})],Sa.prototype,"__",void 0),Dn([Lo(0)],Sa.prototype,"innerRadius",void 0),Dn([Lo(0)],Sa.prototype,"startAngle",void 0),Dn([Lo(0)],Sa.prototype,"endAngle",void 0),Sa=Dn([Ho()],Sa);const{moveTo:La,lineTo:Pa,drawPoints:Ea}=Ys,{rotate:Oa,getAngle:Aa,getDistance:Ma,defaultPoint:Ia}=Y,{toBounds:Wa}=Ji;let Da=class extends ca{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Oa(s,e),s}set toPoint(t){this.width=Ma(Ia,t),this.rotation=Aa(Ia,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];this.__.points?Ea(t,this.__.points,this.__.closed):(La(t,0,0),Pa(t,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Ea(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&zn.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?Wa(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};Dn([Do(class extends ta{})],Da.prototype,"__",void 0),Dn([Po("center")],Da.prototype,"strokeAlign",void 0),Dn([To(0)],Da.prototype,"height",void 0),Dn([Lo()],Da.prototype,"points",void 0),Dn([Lo(0)],Da.prototype,"curve",void 0),Dn([Lo(!1)],Da.prototype,"closed",void 0),Da=Dn([Ho()],Da);const{sin:Fa,cos:Na,PI:za}=Math,{moveTo:Ya,lineTo:Xa,closePath:ja,drawPoints:Ua}=Ys,Va=Da.prototype;let Ha=class extends ca{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)Ua(t,this.__.points,!1,!0);else{const{width:e,height:s,sides:i}=this.__,o=e/2,r=s/2;Ya(t,o,0);for(let e=1;e<i;e++)Xa(t,o+o*Fa(2*e*za/i),r-r*Na(2*e*za/i))}ja(t)}__updateRenderPath(){}__updateBoxBounds(){}};Dn([Do(class extends ta{})],Ha.prototype,"__",void 0),Dn([Lo(3)],Ha.prototype,"sides",void 0),Dn([Lo()],Ha.prototype,"points",void 0),Dn([Lo(0)],Ha.prototype,"curve",void 0),Dn([Xo(Va.__updateRenderPath)],Ha.prototype,"__updateRenderPath",null),Dn([Xo(Va.__updateBoxBounds)],Ha.prototype,"__updateBoxBounds",null),Ha=Dn([jo(),Ho()],Ha);const{sin:Ga,cos:qa,PI:Ka}=Math,{moveTo:$a,lineTo:Ja,closePath:Qa}=Ys;let Za=class extends ca{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,o=t/2,r=e/2,n=this.__.path=[];$a(n,o,0);for(let t=1;t<2*s;t++)Ja(n,o+(t%2==0?o:o*i)*Ga(t*Ka/s),r-(t%2==0?r:r*i)*qa(t*Ka/s));Qa(n)}};Dn([Do(class extends ta{})],Za.prototype,"__",void 0),Dn([Lo(5)],Za.prototype,"corners",void 0),Dn([Lo(.382)],Za.prototype,"innerRadius",void 0),Za=Dn([Ho()],Za);let th=class extends ya{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t),this.on(Sr.LOADED,(t=>{"fill"===t.attrName&&t.attrValue.url===this.url&&(this.image=t.image)}))}destroy(){this.image=null,super.destroy()}};Dn([Do(class extends oa{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.__leaf.image&&(this.__leaf.image=null),this.fill=t?{type:"image",mode:"strench",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(){const t=super.__getInputData();return delete t.fill,t}})],th.prototype,"__",void 0),Dn([To("")],th.prototype,"url",void 0),th=Dn([Ho()],th);let eh=class extends ya{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=u.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,i){t.__layout.update();const o=new G(t.__world).invert(),r=new G;e&&r.translate(e.x,e.y),s&&("number"==typeof s?r.scale(s):r.scale(s.x,s.y)),i&&r.rotate(i),o.multiplyParent(r),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceUpdate("fill")}__drawAfterFill(t,e){const s=this.canvas.view,{width:i,height:o}=this;this.__.cornerRadius?(t.save(),t.clip(),t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,o),t.restore()):t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,o)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e}=this.__;t.smooth!==e&&(t.smooth=e),t.resize(this.__)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null,this.context=null),super.destroy()}};Dn([Do(class extends oa{})],eh.prototype,"__",void 0),Dn([$n(100)],eh.prototype,"width",void 0),Dn([$n(100)],eh.prototype,"height",void 0),Dn([$n(c.devicePixelRatio)],eh.prototype,"pixelRatio",void 0),Dn([$n(!0)],eh.prototype,"smooth",void 0),Dn([$n()],eh.prototype,"contextSettings",void 0),Dn([Wo("all")],eh.prototype,"hitFill",void 0),eh=Dn([Ho()],eh);const{copyAndSpread:sh,includes:ih,spread:oh,setList:rh}=ct;let nh=class extends ca{get __tag(){return"Text"}get editInner(){return"TextEditor"}get textDrawData(){return this.__layout.update(),this.__.__textDrawData}constructor(t){super(t)}__drawHitPath(t){const{__lineHeight:e,__baseLine:s,__textDrawData:i}=this.__;t.beginPath(),this.__.__letterSpacing<0?this.__drawPathByData(t):i.rows.forEach((i=>t.rect(i.x,i.y-s,i.width,e)))}__drawPathByData(t,e){const{x:s,y:i,width:o,height:r}=this.__layout.boxBounds;t.rect(s,i,o,r)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=Fn.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{lineHeight:s,letterSpacing:i,fontFamily:o,fontSize:r,fontWeight:n,italic:a,textCase:h,textOverflow:l,padding:d}=t,c=t.__autoWidth,u=t.__autoHeight;t.__lineHeight=ea.number(s,r),t.__letterSpacing=ea.number(i,r),t.__padding=d?m.fourNumber(d):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${a?"italic ":""}${"small-caps"===h?"small-caps ":""}${"normal"!==n?n+" ":""}${r}px ${o}`,t.__clipText="show"!==l&&!t.__autoSize,this.__updateTextDrawData();const{bounds:_}=t.__textDrawData,p=e.boxBounds;if(t.__lineHeight<r&&oh(_,r/2),c||u){if(p.x=c?_.x:0,p.y=u?_.y:0,p.width=c?_.width:t.width,p.height=u?_.height:t.height,d){const[e,s,i,o]=t.__padding;c&&(p.x-=o,p.width+=s+o),u&&(p.y-=e,p.height+=i+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();a&&(p.width+=.16*r);const g=ih(p,_)?p:_;g!==e.contentBounds?(e.contentBounds=g,e.renderChanged=!0,rh(t.__textBoxBounds={},[p,_])):t.__textBoxBounds=g}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.__layout.boxBounds===this.__layout.contentBounds?0:1),t}__updateRenderBounds(){sh(this.__layout.renderBounds,this.__.__textBoxBounds,this.__layout.renderSpread)}};Dn([Do(class extends ta{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=ra[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],nh.prototype,"__",void 0),Dn([To(0)],nh.prototype,"width",void 0),Dn([To(0)],nh.prototype,"height",void 0),Dn([To(0)],nh.prototype,"padding",void 0),Dn([Mo("#000000")],nh.prototype,"fill",void 0),Dn([Po("outside")],nh.prototype,"strokeAlign",void 0),Dn([Wo("all")],nh.prototype,"hitFill",void 0),Dn([To("")],nh.prototype,"text",void 0),Dn([To("L")],nh.prototype,"fontFamily",void 0),Dn([To(12)],nh.prototype,"fontSize",void 0),Dn([To("normal")],nh.prototype,"fontWeight",void 0),Dn([To(!1)],nh.prototype,"italic",void 0),Dn([To("none")],nh.prototype,"textCase",void 0),Dn([To("none")],nh.prototype,"textDecoration",void 0),Dn([To(0)],nh.prototype,"letterSpacing",void 0),Dn([To({type:"percent",value:150})],nh.prototype,"lineHeight",void 0),Dn([To(0)],nh.prototype,"paraIndent",void 0),Dn([To(0)],nh.prototype,"paraSpacing",void 0),Dn([To("left")],nh.prototype,"textAlign",void 0),Dn([To("top")],nh.prototype,"verticalAlign",void 0),Dn([To("normal")],nh.prototype,"textWrap",void 0),Dn([To("show")],nh.prototype,"textOverflow",void 0),nh=Dn([Ho()],nh);let ah=class extends ca{get __tag(){return"Path"}constructor(t){super(t),this.__.__pathInputed=2}};Dn([Do(class extends ta{})],ah.prototype,"__",void 0),Dn([Po("center")],ah.prototype,"strokeAlign",void 0),ah=Dn([Ho()],ah);let hh=class extends _a{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new ah(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this.__path.length=0,this.paint(),this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,o,r){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,o){return this}ellipse(t,e,s,i,o,r,n,a){return this}arc(t,e,s,i,o,r){return this}arcTo(t,e,s,i,o){return this}drawEllipse(t,e,s,i,o,r,n,a){return this}drawArc(t,e,s,i,o,r){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){this.pathElement.forceUpdate("path")}};Dn([Do(class extends sa{})],hh.prototype,"__",void 0),Dn([(t,e)=>{vo(t,e,{get(){return this.__path}})}],hh.prototype,"path",void 0),hh=Dn([Vo(oi,["set","beginPath","path"]),Ho()],hh);const lh=kt.get("LeaferCanvas");class dh extends Jt{init(){const{view:t}=this.config;t?this.__createViewFrom(t):this.__createView();const{style:e}=this.view;e.display||(e.display="block"),this.parentView=this.view.parentElement,this.parentView&&(this.parentView.style.userSelect="none"),c.syncDomFont&&!this.parentView&&(this.view.style.display="none",document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(this.config)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e="string"==typeof t?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:s}=e;s.position="absolute",s.top=s.bottom=s.left=s.right="0px",document.body.appendChild(e),t=e}this.__createView();const s=this.view;if(t.hasChildNodes()){const{style:e}=s;e.position="absolute",e.top=e.left="0px",t.style.position||(t.style.position="relative")}t.appendChild(s)}else lh.error(`no id: ${t}`),this.__createView()}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this,{style:i}=this.view;i.width=t+"px",i.height=e+"px",this.view.width=Math.ceil(t*s),this.view.height=Math.ceil(e*s)}updateClientBounds(){this.clientBounds=this.view.getBoundingClientRect()}startAutoLayout(t,e){this.autoBounds=t,this.resizeListener=e;try{this.resizeObserver=new ResizeObserver((t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)}));const t=this.parentView;t&&(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect()))}catch(t){this.imitateResizeObserver()}}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),c.requestRender(this.imitateResizeObserver.bind(this)))}checkAutoBounds(t){const e=this.view,{x:s,y:i,width:o,height:r}=this.autoBounds.getBoundsFrom(t);if(o!==this.width||r!==this.height){const{style:t}=e,{pixelRatio:n}=this;t.marginLeft=s+"px",t.marginTop=i+"px";const a={width:o,height:r,pixelRatio:n},h={};Dt.copyAttrs(h,this,$t),this.resize(a),void 0!==this.width&&this.resizeListener(new Lr(a,h))}}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}ho(CanvasRenderingContext2D.prototype),ho(Path2D.prototype);const{mineType:ch,fileType:uh}=lo;Object.assign(u,{canvas:(t,e)=>new dh(t,e),image:t=>new wo(t)}),c.name="web",c.isMobile="ontouchstart"in window,c.requestRender=function(t){window.requestAnimationFrame(t)},c.devicePixelRatio=Math.max(1,devicePixelRatio);const{userAgent:_h}=navigator;_h.indexOf("Firefox")>-1?(c.conicGradientRotate90=!0,c.intWheelDeltaY=!0,c.syncDomFont=!0):_h.indexOf("Safari")>-1&&-1===_h.indexOf("Chrome")&&(c.fullImageShadow=!0),_h.indexOf("Windows")>-1?(c.os="Windows",c.intWheelDeltaY=!0):_h.indexOf("Mac")>-1?c.os="Mac":_h.indexOf("Linux")>-1&&(c.os="Linux");class ph{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new In;return this.__updatedList.list.forEach((e=>{e.leafer&&t.add(e)})),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new In,this.target=t,e&&(this.config=Dt.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Ar.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Cr.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Pr(Pr.DATA,{updatedList:this.updatedList})),this.__updatedList=new In,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Tr.CHANGE,this.__onAttrChange,this),t.on_([Cr.ADD,Cr.REMOVE],this.__onChildEvent,this),t.on_(Pr.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:gh,updateBounds:fh,updateAllWorldOpacity:yh}=sr,{pushAllChildBranch:mh,pushAllParent:wh}=ur;const{worldBounds:vh}=dr,xh={x:0,y:0,width:1e5,height:1e5};class bh{constructor(t){this.updatedBounds=new gt,this.beforeBounds=new gt,this.afterBounds=new gt,t instanceof Array&&(t=new In(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,vh)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(xh):this.afterBounds.setListWithFn(t,vh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Bh,updateAllChange:kh}=sr,Rh=kt.get("Layouter");class Ch{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new Wn,this.target=t,e&&(this.config=Dt.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:t}=this;this.times=0;try{t.emit(Er.START),this.layoutOnce(),t.emitEvent(new Er(Er.END,this.layoutedBlocks,this.times))}catch(t){Rh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Rh.warn("layouting"):this.times>3?Rh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Pr.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=St.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:o,LAYOUT:r,AFTER:n}=Er,a=this.getBlocks(i);a.forEach((t=>t.setBefore())),s.emitEvent(new Er(o,a,this.times)),this.extraBlock=null,i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.proxyZoom&&(s.matrixChanged?(gh(t,!0),e.add(t),t.isBranch&&mh(t,e),wh(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),wh(t,e)))}))}(i,this.__levelList),function(t){let e,s,i;t.sort(!0),t.levels.forEach((o=>{e=t.levelMap[o];for(let t=0,o=e.length;t<o;t++){if(s=e[t],s.isBranch&&s.__tempNumber){i=s.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||fh(i[t])}fh(s)}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&yh(t),t.__updateChange()}))}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach((t=>t.setAfter())),s.emitEvent(new Er(r,a,this.times)),s.emitEvent(new Er(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,St.end(e)}fullLayout(){const t=St.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:o}=Er,r=this.getBlocks(new In(e));e.emitEvent(new Er(s,r,this.times)),Ch.fullLayout(e),r.forEach((t=>{t.setAfter()})),e.emitEvent(new Er(i,r,this.times)),e.emitEvent(new Er(o,r,this.times)),this.addBlocks(r),St.end(t)}static fullLayout(t){Bh(t,!0),t.isBranch?ur.updateBounds(t):sr.updateBounds(t),kh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new bh([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new bh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Er.REQUEST,this.layout,this),t.on_(Er.AGAIN,this.layoutAgain,this),t.on_(Pr.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Th=kt.get("Renderer");class Sh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,s&&(this.config=Dt.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(Er.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new gt,Th.log(e.innerName,"---\x3e");try{this.emitRender(Ar.START),this.renderOnce(t),this.emitRender(Ar.END,this.totalBounds),go.clearRecycled()}catch(t){this.rendering=!1,Th.error(t)}Th.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Th.warn("rendering");if(this.times>3)return Th.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new gt,this.renderOptions={},t)this.emitRender(Ar.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Ar.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Ar.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Ar.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return Th.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=St.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),o=t.includes(this.target.__world),r=new gt(i);s.save(),o&&!kt.showRepaint?s.clear():(i.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0)),this.__render(i,o,r),s.restore(),St.end(e)}fullRender(){const t=St.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds,!0),e.restore(),St.end(t)}__render(t,e,s){const i=t.includes(this.target.__world)?{includes:e}:{bounds:t,includes:e};this.needFill&&this.canvas.fillWorld(t,this.config.fill),kt.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,i),this.renderBounds=s||t,this.renderOptions=i,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),kt.showHitView&&this.renderHitView(i),kt.showBoundsView&&this.renderBoundsView(i),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new gt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=Date.now();c.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.running&&(this.target.emit(Or.FRAME),this.changed&&this.canvas.view&&this.render(),this.target.emit(Ar.NEXT)),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new gt(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("surface"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Th.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new Ar(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Ar.REQUEST,this.update,this),t.on_(Er.END,this.__onLayoutEnd,this),t.on_(Ar.AGAIN,this.renderAgain,this),t.on_(Lr.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}const{hitRadiusPoint:Lh}=ct;class Ph{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const i=s.through||!1,o=s.ignoreHittable||!1,r=s.target||this.target;this.exclude=s.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new In(s.findList),s.findList||this.hitBranch(r);const{list:n}=this.findList,a=this.getBestMatchLeaf(n,s.bottomList,o),h=o?this.getPath(a):this.getHitablePath(a);return this.clear(),i?{path:h,target:a,throughPath:n.length?this.getThroughPath(n):h}:{path:h,target:a}}getBestMatchLeaf(t,e,s){if(t.length){let e;this.findList=new In;const{x:i,y:o}=this.point,r={x:i,y:o,radiusX:0,radiusY:0};for(let i=0,o=t.length;i<o;i++)if(e=t[i],(s||sr.worldHittable(e))&&(this.hitChild(e,r),this.findList.length))return this.findList.list[0]}if(e)for(let t=0,s=e.length;t<s;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),this.findList.length)return this.findList.list[0];return t[0]}getPath(t){const e=new In;for(;t;)e.add(t),t=t.parent;return e.add(this.target),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let s,i=new In;for(let t=e.list.length-1;t>-1&&(s=e.list[t],s.__.hittable)&&(i.addAt(s,0),s.__.hitChildren);t--);return i}getThroughPath(t){const e=new In,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let i,o,r;for(let t=0,n=s.length;t<n;t++){i=s[t],o=s[t+1];for(let t=0,s=i.length;t<s&&(r=i.list[t],!o||!o.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let s,i;const{point:o}=this;for(let r=t.length-1;r>-1;r--)s=t[r],!s.__.visible||e&&!s.__.mask||(i=!!s.__.hitRadius||Lh(s.__world,o),s.isBranch?(i||s.__ignoreHitWorld)&&(this.eachFind(s.children,s.__onlyHitMask),s.isBranchLeaf&&!this.findList.length&&this.hitChild(s,o)):i&&this.hitChild(s,o))}hitChild(t,e,s){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.add(s||t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}const{Yes:Eh,NoAndSkip:Oh,YesAndSkip:Ah}=zt;class Mh{constructor(t,e){this.config={},this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.idMap[e]=t,1):0,innerId:(t,e)=>t.innerId===e?(this.innerIdMap[e]=t,1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0},this.target=t,e&&(this.config=Dt.default(e,this.config)),this.picker=new Ph(t,this),this.__listenEvents()}getBy(t,e,s,i){switch(typeof t){case"number":const o=this.getByInnerId(t,e);return s?o:o?[o]:[];case"string":switch(t[0]){case"#":const i=this.getById(t.substring(1),e);return s?i:i?[i]:[];case".":return this.getByMethod(this.methods.className,e,s,t.substring(1));default:return this.getByMethod(this.methods.tag,e,s,t)}case"function":return this.getByMethod(t,e,s,i)}}getByPoint(t,e,s){return"node"===c.name&&this.target.emit(Er.CHECK_UPDATE),this.picker.getByPoint(t,e,s)}getByInnerId(t,e){const s=this.innerIdMap[t];return s||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const s=this.idMap[t];return s&&sr.hasParent(s,e||this.target)?s:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,s,i){const o=s?null:[];return this.eachFind(this.toChildren(e),t,o,i),o||this.findLeaf}eachFind(t,e,s,i){let o,r;for(let n=0,a=t.length;n<a;n++){if(o=t[n],r=e(o,i),r===Eh||r===Ah){if(!s)return void(this.findLeaf=o);s.push(o)}o.isBranch&&r<Oh&&this.eachFind(o.children,e,s,i)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:s}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[s]&&delete this.innerIdMap[s]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Cr.REMOVE,this.__onRemoveChild,this),this.target.on_(Tr.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.picker.destroy(),this.findLeaf=null,this.innerIdMap={},this.idMap={})}}Object.assign(u,{watcher:(t,e)=>new ph(t,e),layouter:(t,e)=>new Ch(t,e),renderer:(t,e,s)=>new Sh(t,e,s),selector:(t,e)=>new Mh(t,e)}),c.layout=Ch.fullLayout;const Ih={convert(t,e){const i=s.getBase(t),o=Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===o.pointerType&&(o.tangentialPressure=t.tangentialPressure,o.tiltX=t.tiltX,o.tiltY=t.tiltY,o.twist=t.twist),o},convertMouse(t,e){const i=s.getBase(t);return Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=Ih.getTouch(t),o=s.getBase(t);return Object.assign(Object.assign({},o),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",pressure:i.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},Wh={getMove(t,e){let{moveSpeed:s}=e,{deltaX:i,deltaY:o}=t;return t.shiftKey&&!i&&(i=o,o=0),i>50&&(i=Math.max(50,i/3)),o>50&&(o=Math.max(50,o/3)),{x:-i*s*2,y:-o*s*2}},getScale(t,e){let s,i=1,{zoomMode:o,zoomSpeed:r}=e;const n=t.deltaY||t.deltaX;if(o?(s="mouse"===o||!t.deltaX&&(c.intWheelDeltaY?Math.abs(n)>17:Math.ceil(n)!==n),(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)):s=!t.shiftKey&&(t.metaKey||t.ctrlKey),s){r=m.within(r,0,1);i=1-n/(4*(t.deltaY?e.delta.y:e.delta.x))*r,i<.5&&(i=.5),i>=1.5&&(i=1.5)}return i}},Dh={convert(t){const e=s.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{getMoveEventData:Fh,getZoomEventData:Nh,getRotateEventData:zh}=s;class Yh extends e{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:s}=this;for(let s in e)e[s]=e[s].bind(this),t.addEventListener(s,e[s]);for(let t in s)s[t]=s[t].bind(this),window.addEventListener(t,s[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getLocal(t,e){e&&this.canvas.updateClientBounds();const{clientBounds:s}=this.canvas;return{x:t.clientX-s.x,y:t.clientY-s.y}}getTouches(t){const e=[];for(let s=0,i=t.length;s<i;s++)e.push(t[s]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown(Dh.convert(t))}onKeyUp(t){this.keyUp(Dh.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(Ih.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMultiTouch||this.pointerDown(Ih.convert(t,this.getLocal(t)))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMultiTouch||this.preventWindowPointer(t)||this.pointerMove(Ih.convert(t,this.getLocal(t,!0)))}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.useMultiTouch||this.preventWindowPointer(t)||this.pointerUp(Ih.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(Ih.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerMove(Ih.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerUp(Ih.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){if(t.preventDefault(),this.multiTouchStart(t),this.usePointer)return;this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0;const e=Ih.getTouch(t);this.pointerDown(Ih.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.usePointer||this.preventWindowPointer(t))return;const e=Ih.getTouch(t);this.pointerMove(Ih.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.usePointer||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout((()=>{this.useTouch=!1}),500);const e=Ih.getTouch(t);this.pointerUp(Ih.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>=2,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(s.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let s;const i=[];return t.forEach((t=>{s=e.find((e=>e.identifier===t.identifier)),s&&i.push({from:this.getLocal(t),to:this.getLocal(s)})})),i}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}onWheel(t){this.preventDefaultWheel(t);const{wheel:e}=this.config,i=e.getScale?e.getScale(t,e):Wh.getScale(t,e),o=this.getLocal(t),r=s.getBase(t);1!==i?this.zoom(Nh(o,i,r)):this.move(Fh(o,e.getMove?e.getMove(t,e):Wh.getMove(t,e),r))}onGesturestart(t){this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0}onGesturechange(t){this.preventDefaultWheel(t);const e=this.getLocal(t),i=s.getBase(t),o=t.scale/this.lastGestureScale,r=t.rotation-this.lastGestureRotation;let{rotateSpeed:n}=this.config.wheel;n=m.within(n,0,1),this.zoom(Nh(e,o*o,i)),this.rotate(zh(e,r/Math.PI*180*(n/4+.1),i)),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.preventDefaultWheel(t),this.transformEnd()}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),"object"==typeof e[e.length-1]&&e.push("default"),this.canvas.view.style.cursor=e.map((t=>"object"==typeof t?`url(${t.url}) ${t.x||0} ${t.y||0}`:t)).join(",")}eachCursor(t,e,s=0){if(s++,t instanceof Array)t.forEach((t=>this.eachCursor(t,e,s)));else{const o="string"==typeof t&&i.get(t);o&&s<2?this.eachCursor(o,e,s):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function Xh(t,e){let s;const{rows:i,decorationY:o,decorationHeight:r}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.fillText(t.char,t.x,s.y)})),o&&e.fillRect(s.x,s.y+o,s.width,r)}function jh(t,e,s){const{strokeAlign:i}=e.__,o="string"!=typeof t;switch(i){case"center":s.setStroke(o?void 0:t,e.__.strokeWidth,e.__),o?Hh(t,!0,e,s):Vh(e,s);break;case"inside":Uh("inside",t,o,e,s);break;case"outside":Uh("outside",t,o,e,s)}}function Uh(t,e,s,i,o){const{__strokeWidth:r,__font:n}=i.__,a=o.getSameCanvas(!0,!0);a.setStroke(s?void 0:e,2*r,i.__),a.font=n,s?Hh(e,!0,i,a):Vh(i,a),a.blendMode="outside"===t?"destination-out":"destination-in",Xh(i,a),a.blendMode="normal",i.__worldFlipped?o.copyWorldByReset(a,i.__nowWorld):o.copyWorldToInner(a,i.__nowWorld,i.__layout.renderBounds),a.recycle(i.__nowWorld)}function Vh(t,e){let s;const{rows:i,decorationY:o,decorationHeight:r}=t.__.__textDrawData;for(let t=0,n=i.length;t<n;t++)s=i[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.strokeText(t.char,t.x,s.y)})),o&&e.strokeRect(s.x,s.y+o,s.width,r)}function Hh(t,e,s,i){let o;for(let r=0,n=t.length;r<n;r++)o=t[r],o.image&&Xn.checkImage(s,i,o,!1)||o.style&&(i.strokeStyle=o.style,o.blendMode?(i.saveBlendMode(o.blendMode),e?Vh(s,i):i.stroke(),i.restoreBlendMode()):e?Vh(s,i):i.stroke())}const{getSpread:Gh,getOuterOf:qh,getByMove:Kh,getIntersectData:$h}=ct;let Jh;function Qh(t,e,s){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:i}=s.__layout;switch(e.type){case"solid":let{type:o,blendMode:r,color:n,opacity:a}=e;return{type:o,blendMode:r,style:Nn.string(n,a)};case"image":return Xn.image(s,t,e,i,!Jh||!Jh[e.url]);case"linear":return jn.linearGradient(e,i);case"radial":return jn.radialGradient(e,i);case"angular":return jn.conicGradient(e,i);default:return e.r?{type:"solid",style:Nn.string(e)}:void 0}}const Zh={compute:function(t,e){const s=e.__,i=[];let o,r=s.__input[t];r instanceof Array||(r=[r]),Jh=Xn.recycleImage(t,s);for(let s,o=0,n=r.length;o<n;o++)s=Qh(t,r[o],e),s&&i.push(s);s["_"+t]=i.length?i:void 0,i.length&&i[0].image&&(o=i[0].image.hasOpacityPixel),"fill"===t?s.__pixelFill=o:s.__pixelStroke=o},fill:function(t,e,s){s.fillStyle=t,e.__.__font?Xh(e,s):e.__.windingRule?s.fill(e.__.windingRule):s.fill()},fills:function(t,e,s){let i;const{windingRule:o,__font:r}=e.__;for(let n=0,a=t.length;n<a;n++)i=t[n],i.image&&Xn.checkImage(e,s,i,!r)||i.style&&(s.fillStyle=i.style,i.transform?(s.save(),s.transform(i.transform),i.blendMode&&(s.blendMode=i.blendMode),r?Xh(e,s):o?s.fill(o):s.fill(),s.restore()):i.blendMode?(s.saveBlendMode(i.blendMode),r?Xh(e,s):o?s.fill(o):s.fill(),s.restoreBlendMode()):r?Xh(e,s):o?s.fill(o):s.fill())},fillText:Xh,stroke:function(t,e,s){const i=e.__,{__strokeWidth:o,strokeAlign:r,__font:n}=i;if(o)if(n)jh(t,e,s);else switch(r){case"center":s.setStroke(t,o,i),s.stroke();break;case"inside":s.save(),s.setStroke(t,2*o,i),i.windingRule?s.clip(i.windingRule):s.clip(),s.stroke(),s.restore();break;case"outside":const r=s.getSameCanvas(!0,!0);r.setStroke(t,2*o,i),e.__drawRenderPath(r),r.stroke(),i.windingRule?r.clip(i.windingRule):r.clip(),r.clearWorld(e.__layout.renderBounds),e.__worldFlipped?s.copyWorldByReset(r,e.__nowWorld):s.copyWorldToInner(r,e.__nowWorld,e.__layout.renderBounds),r.recycle(e.__nowWorld)}},strokes:function(t,e,s){const i=e.__,{__strokeWidth:o,strokeAlign:r,__font:n}=i;if(o)if(n)jh(t,e,s);else switch(r){case"center":s.setStroke(void 0,o,i),Hh(t,!1,e,s);break;case"inside":s.save(),s.setStroke(void 0,2*o,i),i.windingRule?s.clip(i.windingRule):s.clip(),Hh(t,!1,e,s),s.restore();break;case"outside":const{renderBounds:r}=e.__layout,n=s.getSameCanvas(!0,!0);e.__drawRenderPath(n),n.setStroke(void 0,2*o,i),Hh(t,!1,e,n),i.windingRule?n.clip(i.windingRule):n.clip(),n.clearWorld(r),e.__worldFlipped?s.copyWorldByReset(n,e.__nowWorld):s.copyWorldToInner(n,e.__nowWorld,r),n.recycle(e.__nowWorld)}},strokeText:jh,drawTextStroke:Vh,shape:function(t,e,s){const i=e.getSameCanvas(),o=t.__nowWorld;let r,n,a,h,{scaleX:l,scaleY:d}=o;if(l<0&&(l=-l),d<0&&(d=-d),e.bounds.includes(o))h=i,r=a=o;else{const{renderShapeSpread:i}=t.__layout,c=$h(i?Gh(e.bounds,i*l,i*d):e.bounds,o);n=e.bounds.getFitMatrix(c);let{a:u,d:_}=n;if(n.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,s),l*=u,d*=_),a=qh(o,n),r=Kh(a,-n.e,-n.f),s.matrix){const{matrix:t}=s;n.multiply(t),u*=t.scaleX,_*=t.scaleY}s=Object.assign(Object.assign({},s),{matrix:n.withScale(u,_)})}return t.__renderShape(i,s),{canvas:i,matrix:n,bounds:r,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:d}}};let tl={};const{get:el,rotateOfOuter:sl,translate:il,scaleOfOuter:ol,scale:rl,rotate:nl}=P;function al(t,e,s,i,o,r,n){const a=el();il(a,e.x+s,e.y+i),rl(a,o,r),n&&sl(a,{x:e.x+e.width/2,y:e.y+e.height/2},n),t.transform=a}function hl(t,e,s,i,o,r,n){const a=el();il(a,e.x+s,e.y+i),o&&rl(a,o,r),n&&nl(a,n),t.transform=a}function ll(t,e,s,i,o,r,n,a,h,l){const d=el();if(h)if("center"===l)sl(d,{x:s/2,y:i/2},h);else switch(nl(d,h),h){case 90:il(d,i,0);break;case 180:il(d,s,i);break;case 270:il(d,0,s)}tl.x=e.x+o,tl.y=e.y+r,il(d,tl.x,tl.y),n&&ol(d,tl,n,a),t.transform=d}const{get:dl,translate:cl}=P,ul=new gt,_l={};function pl(t,e,s,i){let{width:o,height:r}=e;s.padding&&(i=ul.set(i).shrink(s.padding));const{opacity:n,mode:a,around:h,offset:l,scale:d,size:c,rotation:u,blendMode:_,repeat:p}=s,g=i.width===o&&i.height===r;_&&(t.blendMode=_);const f=t.data={mode:a},y="center"!==h&&(u||0)%180==90,m=y?r:o,w=y?o:r;let v,x,b=0,B=0;if(a&&"cover"!==a&&"fit"!==a)c?(v=("number"==typeof c?c:c.width)/o,x=("number"==typeof c?c:c.height)/r):d&&(v="number"==typeof d?d:d.x,x="number"==typeof d?d:d.y);else if(!g||u){const t=i.width/m,e=i.height/w;v=x="fit"===a?Math.min(t,e):Math.max(t,e),b+=(i.width-o*v)/2,B+=(i.height-r*x)/2}if(h){const t={x:b,y:B,width:m,height:w};v&&(t.width*=v,t.height*=x),xt.toPoint(h,i,_l,!0,t),b+=_l.x,B+=_l.y}switch(l&&(b+=l.x,B+=l.y),a){case"strench":g||(o=i.width,r=i.height);break;case"normal":case"clip":(b||B||v||u)&&hl(f,i,b,B,v,x,u);break;case"repeat":(!g||v||u)&&ll(f,i,o,r,b,B,v,x,u,h),p||(f.repeat="repeat");break;default:v&&al(f,i,b,B,v,x,u)}f.transform||(i.x||i.y)&&(f.transform=dl(),cl(f.transform,i.x,i.y)),v&&"strench"!==a&&(f.scaleX=v,f.scaleY=x),f.width=o,f.height=r,n&&(f.opacity=n),p&&(f.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat")}let gl,fl=new gt;const{isSame:yl}=ct;function ml(t,e,s,i,o,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return o.data||pl(o,i,s,r),!0}function wl(t,e){bl(t,Sr.LOAD,e)}function vl(t,e){bl(t,Sr.LOADED,e)}function xl(t,e,s){e.error=s,t.forceUpdate("surface"),bl(t,Sr.ERROR,e)}function bl(t,e,s){t.hasEvent(e)&&t.emitEvent(new Sr(e,s))}function Bl(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:kl,scale:Rl,copy:Cl}=P,{ceil:Tl,abs:Sl}=Math;function Ll(t,e,s){let{scaleX:i,scaleY:o}=go.patternLocked?t.__world:t.__nowWorld;const r=i+"-"+o;if(e.patternId===r||t.destroyed)return!1;{i=Sl(i),o=Sl(o);const{image:t,data:n}=e;let a,h,{width:l,height:d,scaleX:u,scaleY:_,opacity:p,transform:g,repeat:f}=n;u&&(h=kl(),Cl(h,g),Rl(h,1/u,1/_),i*=u,o*=_),i*=s,o*=s,l*=i,d*=o;const y=l*d;if(!f&&y>c.image.maxCacheSize)return!1;let m=c.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;m>e&&(m=e)}y>m&&(a=Math.sqrt(y/m)),a&&(i/=a,o/=a,l/=a,d/=a),u&&(i/=u,o/=_),(g||1!==i||1!==o)&&(h||(h=kl(),g&&Cl(h,g)),Rl(h,1/i,1/o));const w=t.getCanvas(Tl(l)||1,Tl(d)||1,p),v=t.getPattern(w,f||c.origin.noRepeat||"no-repeat",h,e);return e.style=v,e.patternId=r,!0}}function Pl(t,e,s,i){return new(s||(s=Promise))((function(o,r){function n(t){try{h(i.next(t))}catch(t){r(t)}}function a(t){try{h(i.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?o(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(n,a)}h((i=i.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:El}=Math;const Ol={image:function(t,e,s,i,o){let r,n;const a=go.get(s);return gl&&s===gl.paint&&yl(i,gl.boxBounds)?r=gl.leafPaint:(r={type:s.type,image:a},gl=a.use>1?{leafPaint:r,paint:s,boxBounds:fl.set(i)}:null),(o||a.loading)&&(n={image:a,attrName:e,attrValue:s}),a.ready?(ml(t,e,s,a,r,i),o&&(wl(t,n),vl(t,n))):a.error?o&&xl(t,n,a.error):(Bl(t,!0),o&&wl(t,n),r.loadId=a.load((()=>{Bl(t,!1),t.destroyed||(ml(t,e,s,a,r,i)&&(a.hasOpacityPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),vl(t,n)),r.loadId=null}),(e=>{Bl(t,!1),xl(t,n,e),r.loadId=null}))),r},createData:pl,fillOrFitMode:al,clipMode:hl,repeatMode:ll,createPattern:Ll,checkImage:function(t,e,s,i){const{scaleX:o,scaleY:r}=go.patternLocked?t.__world:t.__nowWorld;if(s.data&&s.patternId!==o+"-"+r){const{data:n}=s;if(i)if(n.repeat)i=!1;else{let{width:t,height:s}=n;t*=El(o)*e.pixelRatio,s*=El(r)*e.pixelRatio,n.scaleX&&(t*=n.scaleX,s*=n.scaleY),i=t*s>c.image.maxCacheSize}return i?(e.save(),e.clip(),s.blendMode&&(e.blendMode=s.blendMode),n.opacity&&(e.opacity*=n.opacity),n.transform&&e.transform(n.transform),e.drawImage(s.image.view,0,0,n.width,n.height),e.restore(),!0):(!s.style||Vn.running?Ll(t,s,e.pixelRatio):s.patternTask||(s.patternTask=go.patternTasker.add((()=>Pl(this,void 0,void 0,(function*(){s.patternTask=null,e.bounds.hit(t.__nowWorld)&&Ll(t,s,e.pixelRatio),t.forceUpdate("surface")}))),300)),!1)}return!1},recycleImage:function(t,e){const s=e["_"+t];if(s instanceof Array){let i,o,r,n;for(let a=0,h=s.length;a<h;a++)i=s[a].image,n=i&&i.url,n&&(o||(o={}),o[n]=!0,go.recycle(i),i.loading&&(r||(r=e.__input&&e.__input[t]||[],r instanceof Array||(r=[r])),i.unload(s[a].loadId,!r.some((t=>t.url===n)))));return o}return null}},Al={x:.5,y:0},Ml={x:.5,y:1};function Il(t,e,s){let i;for(let o=0,r=e.length;o<r;o++)i=e[o],t.addColorStop(i.offset,Nn.string(i.color,s))}const{set:Wl,getAngle:Dl,getDistance:Fl}=Y,{get:Nl,rotateOfOuter:zl,scaleOfOuter:Yl}=P,Xl={x:.5,y:.5},jl={x:.5,y:1},Ul={},Vl={};const{set:Hl,getAngle:Gl,getDistance:ql}=Y,{get:Kl,rotateOfOuter:$l,scaleOfOuter:Jl}=P,Ql={x:.5,y:.5},Zl={x:.5,y:1},td={},ed={};const sd={linearGradient:function(t,e){let{from:s,to:i,type:o,blendMode:r,opacity:n}=t;s||(s=Al),i||(i=Ml);const a=c.canvas.createLinearGradient(e.x+s.x*e.width,e.y+s.y*e.height,e.x+i.x*e.width,e.y+i.y*e.height);Il(a,t.stops,n);const h={type:o,style:a};return r&&(h.blendMode=r),h},radialGradient:function(t,e){let{from:s,to:i,type:o,opacity:r,blendMode:n,stretch:a}=t;s||(s=Xl),i||(i=jl);const{x:h,y:l,width:d,height:u}=e;let _;Wl(Ul,h+s.x*d,l+s.y*u),Wl(Vl,h+i.x*d,l+i.y*u),(d!==u||a)&&(_=Nl(),Yl(_,Ul,d/u*(a||1),1),zl(_,Ul,Dl(Ul,Vl)+90));const p=c.canvas.createRadialGradient(Ul.x,Ul.y,0,Ul.x,Ul.y,Fl(Ul,Vl));Il(p,t.stops,r);const g={type:o,style:p,transform:_};return n&&(g.blendMode=n),g},conicGradient:function(t,e){let{from:s,to:i,type:o,opacity:r,blendMode:n,stretch:a}=t;s||(s=Ql),i||(i=Zl);const{x:h,y:l,width:d,height:u}=e;Hl(td,h+s.x*d,l+s.y*u),Hl(ed,h+i.x*d,l+i.y*u);const _=Kl(),p=Gl(td,ed);c.conicGradientRotate90?(Jl(_,td,d/u*(a||1),1),$l(_,td,p+90)):(Jl(_,td,1,d/u*(a||1)),$l(_,td,p));const g=c.conicGradientSupport?c.canvas.createConicGradient(0,td.x,td.y):c.canvas.createRadialGradient(td.x,td.y,0,td.x,td.y,ql(td,ed));Il(g,t.stops,r);const f={type:o,style:g,transform:_};return n&&(f.blendMode=n),f}},{copy:id,toOffsetOutBounds:od}=ct,rd={},nd={};function ad(t,e,s,i){const{bounds:o,shapeBounds:r}=i;if(c.fullImageShadow){if(id(rd,t.bounds),rd.x+=e.x-r.x,rd.y+=e.y-r.y,s){const{matrix:t}=i;rd.x-=(o.x+(t?t.e:0)+o.width/2)*(s-1),rd.y-=(o.y+(t?t.f:0)+o.height/2)*(s-1),rd.width*=s,rd.height*=s}t.copyWorld(i.canvas,t.bounds,rd)}else s&&(id(rd,e),rd.x-=e.width/2*(s-1),rd.y-=e.height/2*(s-1),rd.width*=s,rd.height*=s),t.copyWorld(i.canvas,r,s?rd:e)}const{toOffsetOutBounds:hd}=ct,ld={};const dd={shadow:function(t,e,s){let i,o;const{__nowWorld:r,__layout:n}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;od(l,nd),a.forEach(((a,g)=>{_.setWorldShadow(nd.offsetX+a.x*c,nd.offsetY+a.y*u,a.blur*c,a.color),o=a.spread?1+2*a.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0)):0,ad(_,nd,o,s),i=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,r,"copy"),i=r),h?_.copyWorld(h,r,r,"destination-out"):_.copyWorld(s.canvas,d,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(_,i,r,a.blendMode):e.copyWorldToInner(_,i,n.renderBounds,a.blendMode),p&&g<p&&_.clearWorld(i,!0)})),_.recycle(i)},innerShadow:function(t,e,s){let i,o;const{__nowWorld:r,__layout:n}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;hd(l,ld),a.forEach(((a,g)=>{_.save(),_.setWorldShadow(ld.offsetX+a.x*c,ld.offsetY+a.y*u,a.blur*c),o=a.spread?1-2*a.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0)):0,ad(_,ld,o,s),_.restore(),h?(_.copyWorld(_,l,r,"copy"),_.copyWorld(h,r,r,"source-out"),i=r):(_.copyWorld(s.canvas,d,l,"source-out"),i=l),_.fillWorld(i,a.color,"source-in"),t.__worldFlipped?e.copyWorldByReset(_,i,r,a.blendMode):e.copyWorldToInner(_,i,n.renderBounds,a.blendMode),p&&g<p&&_.clearWorld(i,!0)})),_.recycle(i)},blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__nowWorld.a),s.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),s.filter="none"},backgroundBlur:function(t,e,s){}},{excludeRenderBounds:cd}=dr;function ud(t,e,s,i,o,r){switch(e){case"alpha":!function(t,e,s,i){const o=t.__nowWorld;s.resetTransform(),s.opacity=1,s.useMask(i,o),i.recycle(o),pd(t,e,s,1)}(t,s,i,o);break;case"opacity-path":pd(t,s,i,r);break;case"path":s.restore()}}function _d(t){return t.getSameCanvas(!1,!0)}function pd(t,e,s,i){const o=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(s,o),s.recycle(o)}_a.prototype.__renderMask=function(t,e){let s,i,o,r,n;const{children:a}=this;for(let h=0,l=a.length;h<l;h++)s=a[h],s.__.mask&&(n&&(ud(this,n,t,o,i,r),i=o=null),"path"===s.__.maskType?(s.opacity<1?(n="opacity-path",r=s.opacity,o||(o=_d(t))):(n="path",t.save()),s.__clip(o||t,e)):(n="alpha",i||(i=_d(t)),o||(o=_d(t)),s.__render(i,e)),"clipping"!==s.__.maskType)||cd(s,e)||s.__render(o||t,e);ud(this,n,t,o,i,r)};const gd=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",fd=gd+"_#~&*+\\=|≮≯≈≠=…",yd=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function md(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const wd=md("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),vd=md("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),xd=md(gd),bd=md(fd),Bd=md("- —/~|┆·");var kd;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(kd||(kd={}));const{Letter:Rd,Single:Cd,Before:Td,After:Sd,Symbol:Ld,Break:Pd}=kd;function Ed(t){return wd[t]?Rd:Bd[t]?Pd:vd[t]?Td:xd[t]?Sd:bd[t]?Ld:yd.test(t)?Cd:Rd}const Od={trimRight(t){const{words:e}=t;let s,i=0,o=e.length;for(let r=o-1;r>-1&&(s=e[r].data[0]," "===s.char);r--)i++,t.width-=s.width;i&&e.splice(o-i,i)}};function Ad(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Md}=Od,{Letter:Id,Single:Wd,Before:Dd,After:Fd,Symbol:Nd,Break:zd}=kd;let Yd,Xd,jd,Ud,Vd,Hd,Gd,qd,Kd,$d,Jd,Qd,Zd,tc,ec,sc,ic=[];function oc(t,e){Kd&&!qd&&(qd=Kd),Yd.data.push({char:t,width:e}),jd+=e}function rc(){Ud+=jd,Yd.width=jd,Xd.words.push(Yd),Yd={data:[]},jd=0}function nc(){tc&&(ec.paraNumber++,Xd.paraStart=!0,tc=!1),Kd&&(Xd.startCharSize=qd,Xd.endCharSize=Kd,qd=0),Xd.width=Ud,sc.width&&Md(Xd),ic.push(Xd),Xd={words:[]},Ud=0}const ac=0,hc=1,lc=2;const{top:dc,right:cc,bottom:uc,left:_c}=mt;function pc(t,e,s){const{bounds:i,rows:o}=t;i[e]+=s;for(let t=0;t<o.length;t++)o[t][e]+=s}const gc={getDrawData:function(t,e){"string"!=typeof t&&(t=String(t));let s=0,i=0,o=e.__getInput("width")||0,r=e.__getInput("height")||0;const{textDecoration:n,__font:a,__padding:h}=e;h&&(o&&(s=h[_c],o-=h[cc]+h[_c]),r&&(i=h[dc],r-=h[dc]+h[uc]));const l={bounds:{x:s,y:i,width:o,height:r},rows:[],paraNumber:0,font:c.canvas.font=a};return function(t,e,s){ec=t,ic=t.rows,sc=t.bounds;const{__letterSpacing:i,paraIndent:o,textCase:r}=s,{canvas:n}=c,{width:a,height:h}=sc;if(a||h||i||"none"!==r){const t="none"!==s.textWrap,h="break"===s.textWrap;tc=!0,Jd=null,qd=Gd=Kd=jd=Ud=0,Yd={data:[]},Xd={words:[]};for(let s=0,l=e.length;s<l;s++)Hd=e[s],"\n"===Hd?(jd&&rc(),Xd.paraEnd=!0,nc(),tc=!0):($d=Ed(Hd),$d===Id&&"none"!==r&&(Hd=Ad(Hd,r,!jd)),Gd=n.measureText(Hd).width,i&&(i<0&&(Kd=Gd),Gd+=i),Qd=$d===Wd&&(Jd===Wd||Jd===Id)||Jd===Wd&&$d!==Fd,Zd=!($d!==Dd&&$d!==Wd||Jd!==Nd&&Jd!==Fd),Vd=tc&&o?a-o:a,t&&a&&Ud+jd+Gd>Vd&&(h?(jd&&rc(),nc()):(Zd||(Zd=$d===Id&&Jd==Fd),Qd||Zd||$d===zd||$d===Dd||$d===Wd||jd+Gd>Vd?(jd&&rc(),nc()):nc()))," "===Hd&&!0!==tc&&Ud+jd===0||($d===zd?(" "===Hd&&jd&&rc(),oc(Hd,Gd),rc()):Qd||Zd?(jd&&rc(),oc(Hd,Gd)):oc(Hd,Gd)),Jd=$d);jd&&rc(),Ud&&nc(),ic.length>0&&(ic[ic.length-1].paraEnd=!0)}else e.split("\n").forEach((t=>{ec.paraNumber++,ic.push({x:o||0,text:t,width:n.measureText(t).width,paraStart:!0})}))}(l,t,e),h&&function(t,e,s,i,o){if(!i)switch(s.textAlign){case"left":pc(e,"x",t[_c]);break;case"right":pc(e,"x",-t[cc])}if(!o)switch(s.verticalAlign){case"top":pc(e,"y",t[dc]);break;case"bottom":pc(e,"y",-t[uc])}}(h,l,e,o,r),function(t,e){const{rows:s,bounds:i}=t,{__lineHeight:o,__baseLine:r,__letterSpacing:n,__clipText:a,textAlign:h,verticalAlign:l,paraSpacing:d}=e;let c,u,_,{x:p,y:g,width:f,height:y}=i,m=o*s.length+(d?d*(t.paraNumber-1):0),w=r;if(a&&m>y)m=Math.max(y,o),t.overflow=s.length;else switch(l){case"middle":g+=(y-m)/2;break;case"bottom":g+=y-m}w+=g;for(let r=0,l=s.length;r<l;r++){switch(c=s[r],c.x=p,h){case"center":c.x+=(f-c.width)/2;break;case"right":c.x+=f-c.width}c.paraStart&&d&&r>0&&(w+=d),c.y=w,w+=o,t.overflow>r&&w>m&&(c.isOverflow=!0,t.overflow=r+1),u=c.x,_=c.width,n<0&&(c.width<0?(_=-c.width+e.fontSize+n,u-=_,_+=e.fontSize):_-=n),u<i.x&&(i.x=u),_>i.width&&(i.width=_),a&&f&&f<_&&(c.isOverflow=!0,t.overflow||(t.overflow=s.length))}i.y=g,i.height=m}(l,e),function(t,e,s,i){const{rows:o}=t,{textAlign:r,paraIndent:n,letterSpacing:a}=e;let h,l,d,c,u;o.forEach((t=>{t.words&&(d=n&&t.paraStart?n:0,l=s&&"justify"===r&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=a||t.isOverflow?ac:l>.01?hc:lc,t.isOverflow&&!a&&(t.textMode=!0),c===lc?(t.x+=d,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=d,h=t.x,t.data=[],t.words.forEach((e=>{c===hc?(u={char:"",x:h},h=function(t,e,s){return t.forEach((t=>{s.char+=t.char,e+=t.width})),e}(e.data,h,u)," "!==u.char&&t.data.push(u)):h=function(t,e,s){return t.forEach((t=>{" "!==t.char&&(t.x=e,s.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(l,e,o),l.overflow&&function(t,e){const{rows:s,overflow:i}=t;let{textOverflow:o}=e;if(s.splice(i),"hide"!==o){let t,r;"ellipsis"===o&&(o="...");const n=c.canvas.measureText(o).width,a=e.x+e.width-n;("none"===e.textWrap?s:[s[i-1]]).forEach((e=>{if(e.isOverflow&&e.data){let s=e.data.length-1;for(let i=s;i>-1&&(t=e.data[i],r=t.x+t.width,!(i===s&&r<a));i--){if(r<a&&" "!==t.char){e.data.splice(i+1),e.width-=t.width;break}e.width-=t.width}e.width+=n,e.data.push({char:o,x:r}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(l,e),"none"!==n&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"under":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(l,e),l}};const fc={string:function(t,e){if("string"==typeof t)return t;let s=void 0===t.a?1:t.a;e&&(s*=e);const i=t.r+","+t.g+","+t.b;return 1===s?"rgb("+i+")":"rgba("+i+","+s+")"}},{setPoint:yc,addPoint:mc,toBounds:wc}=q;const vc={export(t,e,s){return this.running=!0,function(t){xc||(xc=new po);return new Promise((e=>{xc.add((()=>Pl(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((i=>new Promise((o=>{const r=t=>{i(t),o(),this.running=!1};if("json"===e)return r({data:t.toJSON()});if("json"===lo.fileType(e))return c.origin.download("data:text/plain;charset=utf-8,"+encodeURIComponent(JSON.stringify(t.toJSON())),e),r({data:!0});const{leafer:n}=t;n?n.waitViewCompleted((()=>Pl(this,void 0,void 0,(function*(){s=lo.getExportOptions(s);let i,o,a=1,h=1;const{worldTransform:l,isLeafer:d,isFrame:c}=t,{slice:_,trim:p,onCanvas:g}=s,f=s.scale||1,y=s.pixelRatio||1,m=s.screenshot||t.isApp,w=d&&m&&void 0===s.fill?t.fill:s.fill,v=lo.isOpaqueImage(e)||w,x=new G;if(m)i=!0===m?d?n.canvas.bounds:t.worldRenderBounds:m;else{let e=s.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,e){case"inner":x.set(l);break;case"local":x.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":e=t.leafer;default:x.set(l).divide(t.getTransform(e));const s=e.worldTransform;a/=a/s.scaleX,h/=h/s.scaleY}i=t.getBounds("render",e)}const{x:b,y:B,width:k,height:R}=new gt(i).scale(f);let C=u.canvas({width:Math.round(k),height:Math.round(R),pixelRatio:y});const T={matrix:x.scale(1/f).invert().translate(-b,-B).withScale(1/a*f,1/h*f)};if(_&&(t=n,T.bounds=C.bounds),C.save(),c&&void 0!==w){const e=t.get("fill");t.fill="",t.__render(C,T),t.fill=e}else t.__render(C,T);if(C.restore(),p){o=function(t){const{width:e,height:s}=t.view,{data:i}=t.context.getImageData(0,0,e,s);let o,r,n,a=0;for(let t=0;t<i.length;t+=4)0!==i[t+3]&&(o=a%e,r=(a-o)/e,n?mc(n,o,r):yc(n={},o,r)),a++;const h=new gt;return wc(n,h),h.scale(1/t.pixelRatio).ceil()}(C);const t=C,{width:e,height:s}=o,i={x:0,y:0,width:e,height:s,pixelRatio:y};C=u.canvas(i),C.copyWorld(t,o,i)}v&&C.fillWorld(C.bounds,w||"#FFFFFF","destination-over"),g&&g(C);const S="canvas"===e?C:yield C.export(e,s);r({data:S,width:C.pixelWidth,height:C.pixelHeight,renderBounds:i,trimBounds:o})})))):r({data:!1})}))))}};let xc;const bc=Jt.prototype,Bc=kt.get("@leafer-ui/export");bc.export=function(t,e){const{quality:s,blob:i}=lo.getExportOptions(e);return t.includes(".")?this.saveAs(t,s):i?this.toBlob(t,s):this.toDataURL(t,s)},bc.toBlob=function(t,e){return new Promise((s=>{c.origin.canvasToBolb(this.view,t,e).then((t=>{s(t)})).catch((t=>{Bc.error(t),s(null)}))}))},bc.toDataURL=function(t,e){return c.origin.canvasToDataURL(this.view,t,e)},bc.saveAs=function(t,e){return new Promise((s=>{c.origin.canvasSaveAs(this.view,t,e).then((()=>{s(!0)})).catch((t=>{Bc.error(t),s(!1)}))}))},Object.assign(Fn,gc),Object.assign(Nn,fc),Object.assign(Yn,Zh),Object.assign(Xn,Ol),Object.assign(jn,sd),Object.assign(Un,dd),Object.assign(Vn,vc),Object.assign(u,{interaction:(t,e,s,i)=>new Yh(t,e,s,i),hitCanvas:(t,e)=>new dh(t,e),hitCanvasManager:()=>new t}),c.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>t.toDataURL(ch(e),s),canvasToBolb:(t,e,s)=>new Promise((i=>t.toBlob(i,ch(e),s))),canvasSaveAs:(t,e,s)=>{const i=t.toDataURL(ch(uh(e)),s);return c.origin.download(i,e)},download:(t,e)=>new Promise((s=>{let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),s()})),loadImage:t=>new Promise(((e,s)=>{const i=new Image,{suffix:o,crossOrigin:r}=c.image;r&&(i.setAttribute("crossOrigin",r),i.crossOrigin=r),i.onload=()=>{e(i)},i.onerror=t=>{s(t)},t.startsWith("data:")||t.startsWith("blob:")||!o||(t+=(t.includes("?")?"&":"?")+o),i.src=t}))},c.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},c.canvas=u.canvas(),c.conicGradientSupport=!!c.canvas.context.createConicGradient,window.addEventListener("unload",(()=>{const{list:t}=o;t.forEach((t=>t.destroy(!0))),t.destroy(),go.destroy()}));const kc=function(t,e){const s=function(t,e){let s="";const i=t;void 0!==e.formatter(i)?s=e.formatter(i):"value"==e.showType?s+=e.info.map((t=>`${i[t]}`)).join("\n"):"key-value"==e.showType&&(s+=e.info.map((t=>`${t} : ${i[t]}`)).join("\n"));return s}(t,e),{fontSize:i,fontFamily:o,fontWeight:n,padding:a}=e.style,h=new r({children:[{tag:"Text",text:s,fontSize:i,fontFamily:o,fontWeight:n,padding:a}]}),{width:l,height:d}=h.getBounds();return{width:l,height:d,text:s}};let Rc=class extends n{get __tag(){return"Tooltip"}constructor(t){super(t),this.target=t.target,this.config=t.config,this.show()}createShapes(t=this.__.pointerPos){this.clear();const{width:e,height:s,text:i}=kc(this.target,this.config),{backgroundColor:o,stroke:r,color:n,padding:h,borderRadius:l,fontSize:d,fontWeight:c,fontFamily:u}=this.config.style;let _=this.config.offset;this.setStyle({fill:o,stroke:r}),this.add(new a({className:"leafer-x-tooltip",fill:n,fontSize:d,fontWeight:c,fontFamily:u,x:t.x+_[0],y:t.y+_[1],text:i,padding:h})),this.roundRect(t.x+_[0],t.y+_[1],e,s,l),this.isShow=!0}clearShowHideTimers(){this.showTimerId&&(clearTimeout(this.showTimerId),this.showTimerId=null),this.hideTimerId&&(clearTimeout(this.hideTimerId),this.hideTimerId=null)}show(t=this.__.pointerPos){this.clearShowHideTimers(),this.showTimerId=setTimeout((()=>{this.createShapes(t),clearTimeout(this.showTimerId),this.showTimerId=null}),this.config.showDelay)}hide(t=!1){this.clearShowHideTimers(),t?this.destroy():this.hideTimerId||(this.hideTimerId=setTimeout((()=>{this.destroy()}),this.config.hideDelay))}update(t){this.clearShowHideTimers(),this.isShow?this.createShapes(t):this.show(t)}destroyTooltip(){this.clearShowHideTimers(),this.destroy(),this.isShow=!1,this.target=void 0}};d([Do(class extends h{})],Rc.prototype,"__",void 0),d([Bo({x:0,y:0})],Rc.prototype,"pointerPos",void 0),d([Bo()],Rc.prototype,"showTimerId",void 0),d([Bo()],Rc.prototype,"hideTimerId",void 0),d([Bo(!1)],Rc.prototype,"isShow",void 0),d([Bo()],Rc.prototype,"config",void 0),d([Bo()],Rc.prototype,"target",void 0),Rc=d([Ho()],Rc);const Cc={reference:"pointer",info:["tag"],showType:"value",formatter:()=>{},showDelay:500,hideDelay:0,arrow:!1,placement:"right-end",offset:[5,5],preventOverflow:!1,includesType:[],excludesType:[],theme:"light",style:{backgroundColor:"white",stroke:"black",color:"black",borderRadius:8,padding:8,fontSize:14,fontWeight:400,fontFamily:'"Punctuation SC","Inter",ui-sans-serif,system-ui,"PingFang SC","Noto Sans CJK SC", "Noto Sans SC", "Heiti SC", "Microsoft YaHei", "DengXian", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"'}};class Tc{constructor(t,e){this.instance=t,this.config=Object.assign({},Cc,e),this.handleConfig(),this.initState(),this.pointEventId=this.initEvent()}initState(){if(this.instance.isApp){const t=this.instance;void 0===t.sky&&(t.sky=t.addLeafer({type:"draw",usePartRender:!1})),this.aimLeafer=t.sky}else this.instance.isLeafer&&(this.aimLeafer=this.instance)}handleConfig(){"dark"===this.config.theme&&(this.config.style.backgroundColor="black",this.config.style.color="white")}initEvent(){return this.instance.on_(l.MOVE,this.handlePointMove,this)}handlePointMove(t){const e=this.instance.pick({x:t.x,y:t.y},{ignoreHittable:!0,through:!0}),s=this.filterTarget(e.throughPath.list);s&&this.handleAllowed(s)?this.handleTooltip(t,s):this.hideTooltip()}filterTarget(t){const e=["Leafer","App"],s=t.filter((t=>{var s;return!e.includes(null==t?void 0:t.tag)&&"Tooltip"!==(null===(s=null==t?void 0:t.parent)||void 0===s?void 0:s.tag)&&"leafer-x-tooltip"!==(null==t?void 0:t.className)}));return s[s.length-1]||null}handleAllowed(t){const e=["#"+t.id,"."+t.className,t.tag],{includesType:s,excludesType:i}=this.config;if(0===s.length&&0===i.length)return!0;const o=e.some((t=>s.includes(t))),r=e.some((t=>i.includes(t)));return!r&&0===s.length||!(!o&&0===i.length)&&(o||!r)}hideTooltip(){this.aimLeafer.find("Tooltip").forEach((t=>{t.hide()}))}handleTooltip(t,e){const s=function(t){return t.tag+t.innerId}(e),i=this.aimLeafer.find("Tooltip");let o=!1;for(const e of i)e.id===s?(e.update({x:t.x,y:t.y}),o=!0):e.hide();o||this.aimLeafer.add(new Rc({id:s,pointerPos:{x:t.x,y:t.y},target:e,config:this.config}))}destroy(){const t=this.aimLeafer.find("Tooltip");t&&t.forEach((t=>{t.destroyTooltip(),t.parent.remove(t)})),this.instance.off_(this.pointEventId),this.instance=null,this.aimLeafer=null}}export{Tc as TooltipPlugin};
|