@leafer/worker 1.8.0 → 1.9.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/dist/worker.cjs +198 -130
- package/dist/worker.esm.js +35 -18
- package/dist/worker.js +7860 -8492
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +8994 -8209
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +22 -22
package/dist/worker.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var LeaferUI=function(t){"use strict";const e={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(t){const{prefix:i,suffix:s}=e.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),i&&"/"===t[0]&&(t=i+t),t}}},i={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=s;return e[t]?e[t]++:(e[t]=1,0)}},s=i,{round:o,pow:n,PI:r}=Math,a={within:(t,e,i)=>("object"==typeof e&&(i=e.max,e=e.min),void 0!==e&&t<e&&(t=e),void 0!==i&&t>i&&(t=i),t),fourNumber(t,e){let i;if(t instanceof Array)switch(t.length){case 4:i=void 0===e?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),e)for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),a.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=void 0!==e?n(10,e):1e12;return-0===(t=o(t*i)/i)?0:t},getScaleData(t,e,i,s){if(s||(s={}),e){const t=("number"==typeof e?e:e.width||0)/i.width,o=("number"==typeof e?e:e.height||0)/i.height;s.scaleX=t||o||1,s.scaleY=o||t||1}else t&&a.assignScale(s,t);return s},assignScale(t,e){"number"==typeof e?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:h,randColor:t=>`rgba(${h(255)},${h(255)},${h(255)},${t||1})`};function h(t){return Math.round(Math.random()*t)}const l=r/180,d=2*r,c=r/2;function u(){return{x:0,y:0}}function p(){return{x:0,y:0,width:0,height:0}}function _(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:g,cos:f,acos:y,sqrt:m}=Math,{float:v}=a,w={};function x(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const b={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:x(),tempMatrix:{},set(t,e=1,i=0,s=0,o=1,n=0,r=0){t.a=e,t.b=i,t.c=s,t.d=o,t.e=n,t.f=r},get:_,getWorld:x,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},scaleOfOuter(t,e,i,s){E.toInnerPoint(t,e,w),E.scaleOfInner(t,w,i,s)},scaleOfInner(t,e,i,s=i){E.translateInner(t,e.x,e.y),E.scale(t,i,s),E.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:o,d:n}=t,r=f(e*=l),a=g(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=o*r-n*a,t.d=o*a+n*r},rotateOfOuter(t,e,i){E.toInnerPoint(t,e,w),E.rotateOfInner(t,w,i)},rotateOfInner(t,e,i){E.translateInner(t,e.x,e.y),E.rotate(t,i),E.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:o,c:n,d:r}=t;i&&(i*=l,t.a=s+n*i,t.b=o+r*i),e&&(e*=l,t.c=n+s*e,t.d=r+o*e)},skewOfOuter(t,e,i,s){E.toInnerPoint(t,e,w),E.skewOfInner(t,w,i,s)},skewOfInner(t,e,i,s=0){E.translateInner(t,e.x,e.y),E.skew(t,i,s),E.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:o,d:n,e:r,f:a}=t;t.a=e.a*i+e.b*o,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*o,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*o+r,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,s,o,n){let{e:r,f:a}=t;if(n&&(r+=n.scrollX,a+=n.scrollY),i||(i=t),void 0===s&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:n,c:r,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,o&&(i.scaleX=e.scaleX*o.scaleX,i.scaleY=e.scaleY*o.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,o&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*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:i,c:s,d:o,e:n,f:r}=t;if(i||s){const a=1/(e*o-i*s);t.a=o*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*o-r*s)*a,t.f=-(r*e-n*i)*a}else if(1===e&&1===o)t.e=-n,t.f=-r;else{const i=1/(e*o);t.a=o*i,t.d=e*i,t.e=-n*o*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:o,y:n}=e;i||(i=e),i.x=o*t.a+n*t.c,i.y=o*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:o,b:n,c:r,d:a}=t,h=1/(o*a-n*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*o-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*o-e*n)*h}},setLayout(t,e,i,s,o){const{x:n,y:r,scaleX:a,scaleY:h}=e;if(void 0===o&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:i,skewX:s,skewY:o}=e,n=i*l,r=f(n),d=g(n);if(s||o){const e=s*l,i=o*l;t.a=(r+i*-d)*a,t.b=(d+i*r)*a,t.c=(e*r-d)*h,t.d=(r+e*d)*h}else t.a=r*a,t.b=d*a,t.c=-d*h,t.d=r*h}else t.a=a,t.b=0,t.c=0,t.d=h;t.e=n,t.f=r,(i=i||s)&&E.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:o,b:n,c:r,d:a,e:h,f:d}=t;let u,p,_,w,x,b=h,E=d;if(n||r){const t=o*a-n*r;if(r&&!s){u=m(o*o+n*n),p=t/u;const e=o/u;_=n>0?y(e):-y(e)}else{p=m(r*r+a*a),u=t/p;const e=r/p;_=c-(a>0?y(-e):-y(e))}const e=v(f(_)),i=g(_);u=v(u),p=v(p),w=e?v((r/p+i)/e/l,9):0,x=e?v((n/u-i)/e/l,9):0,_=v(_/l)}else u=o,p=a,_=w=x=0;return(e=i||e)&&(b+=e.x*o+e.y*r,E+=e.x*n+e.y*a,i||(b-=e.x,E-=e.y)),{x:b,y:E,scaleX:u,scaleY:p,rotation:_,skewX:w,skewY:x}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:o,c:n,d:r}=t;o||n?i=(s*r-o*n)/(e=m(s*s+o*o)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){E.set(t)}},E=b,{toInnerPoint:k,toOuterPoint:B}=b,{sin:S,cos:T,abs:P,sqrt:R,atan2:C,min:L,round:A}=Math,O={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=void 0===i?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?A(t.x-.5)+.5:A(t.x),t.y=e?A(t.y-.5)+.5:A(t.y)},move(t,e,i){"object"==typeof e?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=D.defaultPoint);const s=T(e*=l),o=S(e),n=t.x-i.x,r=t.y-i.y;t.x=i.x+n*s-r*o,t.y=i.y+n*o+r*s},tempToInnerOf(t,e){const{tempPoint:i}=D;return M(i,t),k(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=D;return M(i,t),B(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=D;return M(i,t),D.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),k(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){k(e,t,i)},toOuterOf(t,e,i){B(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>I(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const o=P(i-t),n=P(s-e);return R(o*o+n*n)},getMinDistanceFrom:(t,e,i,s,o,n)=>L(I(t,e,i,s),I(i,s,o,n)),getAngle:(t,e)=>F(t,e)/l,getRotation:(t,e,i,s)=>(s||(s=e),D.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/l),getRadianFrom(t,e,i,s,o,n,r,a){void 0===r&&(r=i,a=s);const h=t-i,l=e-s,d=o-r,c=n-a;return Math.atan2(h*c-l*d,h*d+l*c)},getAtan2:(t,e)=>C(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const o=F(t,e);return(e=s?e:{}).x=t.x+T(o)*i,e.y=t.y+S(o)*i,e},toNumberPoints(t){let e=t;return"object"==typeof t[0]&&(e=[],t.forEach((t=>e.push(t.x,t.y)))),e},reset(t){D.reset(t)}},D=O,{getDistanceFrom:I,copy:M,getAtan2:F}=D;class W{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?O.copy(this,t):O.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new W(this)}move(t,e){return O.move(this,t,e),this}scale(t,e){return O.scale(this,t,e),this}scaleOf(t,e,i){return O.scaleOf(this,t,e,i),this}rotate(t,e){return O.rotate(this,t,e),this}rotateOf(t,e){return O.rotate(this,e,t),this}getRotation(t,e,i){return O.getRotation(this,t,e,i)}toInnerOf(t,e){return O.toInnerOf(this,t,e),this}toOuterOf(t,e){return O.toOuterOf(this,t,e),this}getCenter(t){return new W(O.getCenter(this,t))}getDistance(t){return O.getDistance(this,t)}getDistancePoint(t,e,i){return new W(O.getDistancePoint(this,t,e,i))}getAngle(t){return O.getAngle(this,t)}getAtan2(t){return O.getAtan2(this,t)}reset(){return O.reset(this),this}}const z=new W;class U{constructor(t,e,i,s,o,n){this.set(t,e,i,s,o,n)}set(t,e,i,s,o,n){return"object"==typeof t?b.copy(this,t):b.set(this,t,e,i,s,o,n),this}setWith(t){return b.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:o,f:n}=this;return{a:t,b:e,c:i,d:s,e:o,f:n}}clone(){return new U(this)}translate(t,e){return b.translate(this,t,e),this}translateInner(t,e){return b.translateInner(this,t,e),this}scale(t,e){return b.scale(this,t,e),this}scaleWith(t,e){return b.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return b.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return b.scaleOfInner(this,t,e,i),this}rotate(t){return b.rotate(this,t),this}rotateOfOuter(t,e){return b.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return b.rotateOfInner(this,t,e),this}skew(t,e){return b.skew(this,t,e),this}skewOfOuter(t,e,i){return b.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return b.skewOfInner(this,t,e,i),this}multiply(t){return b.multiply(this,t),this}multiplyParent(t){return b.multiplyParent(this,t),this}divide(t){return b.divide(this,t),this}divideParent(t){return b.divideParent(this,t),this}invert(){return b.invert(this),this}invertWith(){return b.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){b.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){b.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return b.setLayout(this,t,e,i),this}getLayout(t,e,i){return b.getLayout(this,t,e,i)}withScale(t,e){return b.withScale(this,t,e)}reset(){b.reset(this)}}const H=new U,N={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,o){Y(t,e,i),Y(t,e+s,i+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:Y}=N;var X,j;t.Direction4=void 0,(X=t.Direction4||(t.Direction4={}))[X.top=0]="top",X[X.right=1]="right",X[X.bottom=2]="bottom",X[X.left=3]="left",t.Direction9=void 0,(j=t.Direction9||(t.Direction9={}))[j.topLeft=0]="topLeft",j[j.top=1]="top",j[j.topRight=2]="topRight",j[j.right=3]="right",j[j.bottomRight=4]="bottomRight",j[j.bottom=5]="bottom",j[j.bottomLeft=6]="bottomLeft",j[j.left=7]="left",j[j.center=8]="center",j[j["top-left"]=0]="top-left",j[j["top-right"]=2]="top-right",j[j["bottom-right"]=4]="bottom-right",j[j["bottom-left"]=6]="bottom-left";const V=[{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}];V.forEach((t=>t.type="percent"));const G={directionData:V,tempPoint:{},get:Z,toPoint(t,e,i,s,o,n){const r=Z(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,o&&(n||(i.x-=o.x,i.y-=o.y),r.x&&(i.x-=1===r.x?o.width:.5===r.x?r.x*o.width:0),r.y&&(i.y-=1===r.y?o.height:.5===r.y?r.y*o.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),G.toPoint(t,e,i,!0),i)};function Z(e){return"string"==typeof e?V[t.Direction9[e]]:e}const{toPoint:K}=G,q={toPoint(t,e,i,s,o,n){K(t,i,s,o,e,n)}},{tempPointBounds:J,setPoint:$,addPoint:Q,toBounds:tt}=N,{toOuterPoint:et}=b,{float:it,fourNumber:st}=a,{floor:ot,ceil:nt}=Math;let rt,at,ht,lt;const dt={},ct={},ut={},pt={tempBounds:ut,set(t,e=0,i=0,s=0,o=0){t.x=e,t.y=i,t.width=s,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,i,s,o){const{x:n,y:r,width:a,height:h}=e;if(i instanceof Array){const e=st(i);s?_t.set(t,n+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):_t.set(t,n-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),_t.set(t,n-i,r-i,a+2*i,h+2*i);o&&("width"===o?(t.y=r,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},getByMove:(t,e,i)=>(t=Object.assign({},t),_t.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?ft(e,t):e=t,i?(e.offsetX=-(_t.maxX(i)-t.x),e.offsetY=-(_t.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),_t.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||O.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){O.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(_t.copy(ut,t),_t.toOuterOf(ut,e),ut),getOuterOf:(t,e)=>(t=Object.assign({},t),_t.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:o}=e;s>0?(i.width=t.width*s,i.x=e.e+t.x*s):(i.width=t.width*-s,i.x=e.e+t.x*s-i.width),o>0?(i.height=t.height*o,i.y=e.f+t.y*o):(i.height=t.height*-o,i.y=e.f+t.y*o-i.height)}else dt.x=t.x,dt.y=t.y,et(e,dt,ct),$(J,ct.x,ct.y),dt.x=t.x+t.width,et(e,dt,ct),Q(J,ct.x,ct.y),dt.y=t.y+t.height,et(e,dt,ct),Q(J,ct.x,ct.y),dt.x=t.x,et(e,dt,ct),Q(J,ct.x,ct.y),tt(J,i)},toInnerOf(t,e,i){i||(i=t),_t.move(i,-e.e,-e.f),_t.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,_t.getFitScale(t,e));return new U(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,o=t.height/e.height;return i?Math.max(s,o):Math.min(s,o)},put(t,e,i="center",s=1,o=!0,n){n||(n=e),"string"==typeof s&&(s=_t.getFitScale(t,e,"cover"===s)),ut.width=o?e.width*=s:e.width*s,ut.height=o?e.height*=s:e.height*s,q.toPoint(i,ut,t,n,!0,!0)},getSpread(t,e,i){const s={};return _t.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){_t.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){_t.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=ot(t.x),t.y=ot(t.y),t.width=e>t.x?nt(t.width+e-t.x):nt(t.width),t.height=i>t.y?nt(t.height+i-t.y):nt(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=it(t.x,e),t.y=it(t.y,e),t.width=it(t.width,e),t.height=it(t.height,e)},add(t,e,i){rt=t.x+t.width,at=t.y+t.height,ht=e.x,lt=e.y,i||(ht+=e.width,lt+=e.height),rt=rt>ht?rt:ht,at=at>lt?at:lt,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=at-t.y},addList(t,e){_t.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){_t.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){_t.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let o,n=!0;for(let r=0,a=e.length;r<a;r++)o=i?i(e[r]):e[r],o&&(o.width||o.height)&&(n?(n=!1,s||ft(t,o)):gt(t,o));n&&_t.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?$(J,t.x,t.y):Q(J,t.x,t.y))),tt(J,t)},setPoint(t,e){_t.set(t,e.x,e.y)},addPoint(t,e){gt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:o}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+o},{x:e,y:i+o}]},hitRadiusPoint:(t,e,i)=>(i&&(e=O.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=O.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=_t.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=_t.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=_t.tempToOuterOf(e,i)),!_t.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:o,width:n,height:r}=e;return rt=s+n,at=o+r,ht=t.x+t.width,lt=t.y+t.height,s=s>t.x?s:t.x,o=o>t.y?o:t.y,rt=rt<ht?rt:ht,at=at<lt?at:lt,n=rt-s,r=at-o,{x:s,y:o,width:n,height:r}},intersect(t,e,i){_t.copy(t,_t.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){_t.set(t)}},_t=pt,{add:gt,copy:ft}=_t;class yt{get minX(){return pt.minX(this)}get minY(){return pt.minY(this)}get maxX(){return pt.maxX(this)}get maxY(){return pt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return"object"==typeof t?pt.copy(this,t):pt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new yt(this)}move(t,e){return pt.move(this,t,e),this}scale(t,e,i){return pt.scale(this,t,e,i),this}scaleOf(t,e,i){return pt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return pt.toOuterOf(this,t,e),this}toInnerOf(t,e){return pt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return pt.getFitMatrix(this,t,e)}put(t,e,i){pt.put(this,t,e,i)}spread(t,e){return pt.spread(this,t,e),this}shrink(t,e){return pt.shrink(this,t,e),this}ceil(){return pt.ceil(this),this}unsign(){return pt.unsign(this),this}float(t){return pt.float(this,t),this}add(t){return pt.add(this,t),this}addList(t){return pt.setList(this,t,!0),this}setList(t){return pt.setList(this,t),this}addListWithFn(t,e){return pt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return pt.setListWithFn(this,t,e),this}setPoint(t){return pt.setPoint(this,t),this}setPoints(t){return pt.setPoints(this,t),this}addPoint(t){return pt.addPoint(this,t),this}getPoints(){return pt.getPoints(this)}hitPoint(t,e){return pt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return pt.hitRadiusPoint(this,t,e)}hit(t,e){return pt.hit(this,t,e)}includes(t,e){return pt.includes(this,t,e)}intersect(t,e){return pt.intersect(this,t,e),this}getIntersect(t,e){return new yt(pt.getIntersectData(this,t,e))}isSame(t){return pt.isSame(this,t)}isEmpty(){return pt.isEmpty(this)}reset(){pt.reset(this)}}const mt=new yt;class vt{constructor(t,e,i,s,o,n){"object"==typeof t?this.copy(t):this.set(t,e,i,s,o,n)}set(t=0,e=0,i=0,s=0,o=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=o,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=t;this.set(e,i,s,o,n,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=this;return new yt(o,e,n||t.width-o-i,r||t.height-e-s)}}const wt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:xt}=a;class bt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new bt(t)}static set filter(t){this.filterList=Et(t)}static set exclude(t){this.excludeList=Et(t)}static drawRepaint(t,e){const i=xt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===bt.showBounds,o=t.__nowWorld,n=xt();s&&(e.setWorld(o),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(o,n)}log(...t){if(kt.enable){if(kt.filterList.length&&kt.filterList.every((t=>t!==this.name)))return;if(kt.excludeList.length&&kt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){kt.enable&&this.warn(...t)}warn(...t){kt.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 Et(t){return t?"string"==typeof t&&(t=[t]):t=[],t}bt.filterList=[],bt.excludeList=[],bt.showWarn=!0;const kt=bt,Bt=bt.get("RunTime"),St={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=i.create(i.RUNTIME);return Tt.currentId=Tt.idMap[s]=e?performance.now():Date.now(),Tt.currentName=Tt.nameMap[s]=t,Tt.nameToIdMap[t]=s,s},end(t,e){const i=Tt.idMap[t],s=Tt.nameMap[t],o=e?(performance.now()-i)/1e3:Date.now()-i;Tt.idMap[t]=Tt.nameMap[t]=Tt.nameToIdMap[s]=void 0,Bt.log(s,o,"ms")},endOfName(t,e){const i=Tt.nameToIdMap[t];void 0!==i&&Tt.end(i,e)}},Tt=St,Pt=[],Rt={list:{},add(t,...e){this.list[t]=!0,Pt.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>Pt.forEach((t=>Rt.has(t,!0)))));const Ct={editor:t=>Rt.need("editor")},Lt=bt.get("UICreator"),At={list:{},register(t){const{__tag:e}=t.prototype;Ot[e]&&Lt.repeat(e),Ot[e]=t},get(t,e,i,s,o,n){Ot[t]||Lt.error("not register "+t);const r=new Ot[t](e);return void 0!==i&&(r.x=i,s&&(r.y=s),o&&(r.width=o),n&&(r.height=n)),r}},{list:Ot}=At,Dt=bt.get("EventCreator"),It={nameList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(Mt[e]&&Dt.repeat(e),Mt[e]=t)}))},changeName(t,e){const i=Mt[t];if(i){const s=Object.keys(i).find((e=>i[e]===t));s&&(i[s]=e,Mt[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Mt[t](...e)},{nameList:Mt}=It;class Ft{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,o=i.length;s<o;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=Ct.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach((t=>{t.destroy()})),this.list.length=0}destroy(){this.clear()}}const Wt={default:(t,e)=>(zt(e,t),zt(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach((o=>{var n,r;if(s=e[o],(null==s?void 0:s.constructor)===Object&&(null===(n=t[o])||void 0===n?void 0:n.constructor)===Object)return zt(t[o],e[o],i&&i[o]);i&&o in i?(null===(r=i[o])||void 0===r?void 0:r.constructor)===Object&&zt(t[o]={},e[o],i[o]):t[o]=e[o]}))},copyAttrs:(t,e,i)=>(i.forEach((i=>{void 0!==e[i]&&(t[i]=e[i])})),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:zt}=Wt;class Ut{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=void 0===i?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(void 0!==e)return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(t instanceof Array)for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],void 0!==t)){if("path"===o&&!this.__pathInputed)continue;e=s?s[o]:void 0,i[o]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:o,e:n,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:o,e:n,f:r}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}var Ht;t.Answer=void 0,(Ht=t.Answer||(t.Answer={}))[Ht.No=0]="No",Ht[Ht.Yes=1]="Yes",Ht[Ht.NoAndSkip=2]="NoAndSkip",Ht[Ht.YesAndSkip=3]="YesAndSkip";const Nt={};function Yt(t){return null==t}function Xt(t){return"{}"===JSON.stringify(t)}function jt(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}function Vt(t,e,i,s){return new(i||(i=Promise))((function(o,n){function r(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?o(t.value):function(t){return t instanceof i?t:new i((function(e){e(t)}))}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())}))}function Gt(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const Zt=[];function Kt(){return(t,e)=>{Zt.push(e)}}const qt=[];class Jt{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||qt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Zt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,i,s,o,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,o,n){"object"==typeof t?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,o,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,o,n,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/o*h;o+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,o,n,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,o);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,o,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,o,n){}arcTo(t,e,i,s,o){}ellipse(t,e,i,s,o,n,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,o){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,o,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}jt([Gt("imageSmoothingEnabled")],Jt.prototype,"smooth",void 0),jt([Gt("imageSmoothingQuality")],Jt.prototype,"smoothLevel",void 0),jt([Gt("globalAlpha")],Jt.prototype,"opacity",void 0),jt([Gt()],Jt.prototype,"fillStyle",void 0),jt([Gt()],Jt.prototype,"strokeStyle",void 0),jt([Gt("lineWidth")],Jt.prototype,"strokeWidth",void 0),jt([Gt("lineCap")],Jt.prototype,"strokeCap",void 0),jt([Gt("lineJoin")],Jt.prototype,"strokeJoin",void 0),jt([Gt("lineDashOffset")],Jt.prototype,"dashOffset",void 0),jt([Gt()],Jt.prototype,"miterLimit",void 0),jt([Gt()],Jt.prototype,"shadowBlur",void 0),jt([Gt()],Jt.prototype,"shadowColor",void 0),jt([Gt()],Jt.prototype,"shadowOffsetX",void 0),jt([Gt()],Jt.prototype,"shadowOffsetY",void 0),jt([Gt()],Jt.prototype,"filter",void 0),jt([Gt()],Jt.prototype,"font",void 0),jt([Gt()],Jt.prototype,"fontKerning",void 0),jt([Gt()],Jt.prototype,"fontStretch",void 0),jt([Gt()],Jt.prototype,"fontVariantCaps",void 0),jt([Gt()],Jt.prototype,"textAlign",void 0),jt([Gt()],Jt.prototype,"textBaseline",void 0),jt([Gt()],Jt.prototype,"textRendering",void 0),jt([Gt()],Jt.prototype,"wordSpacing",void 0),jt([Gt()],Jt.prototype,"letterSpacing",void 0),jt([Gt()],Jt.prototype,"direction",void 0),jt([Kt()],Jt.prototype,"setTransform",null),jt([Kt()],Jt.prototype,"resetTransform",null),jt([Kt()],Jt.prototype,"getTransform",null),jt([Kt()],Jt.prototype,"save",null),jt([Kt()],Jt.prototype,"restore",null),jt([Kt()],Jt.prototype,"translate",null),jt([Kt()],Jt.prototype,"scale",null),jt([Kt()],Jt.prototype,"rotate",null),jt([Kt()],Jt.prototype,"fill",null),jt([Kt()],Jt.prototype,"stroke",null),jt([Kt()],Jt.prototype,"clip",null),jt([Kt()],Jt.prototype,"fillRect",null),jt([Kt()],Jt.prototype,"strokeRect",null),jt([Kt()],Jt.prototype,"clearRect",null),jt([Kt()],Jt.prototype,"beginPath",null),jt([Kt()],Jt.prototype,"moveTo",null),jt([Kt()],Jt.prototype,"lineTo",null),jt([Kt()],Jt.prototype,"bezierCurveTo",null),jt([Kt()],Jt.prototype,"quadraticCurveTo",null),jt([Kt()],Jt.prototype,"closePath",null),jt([Kt()],Jt.prototype,"arc",null),jt([Kt()],Jt.prototype,"arcTo",null),jt([Kt()],Jt.prototype,"ellipse",null),jt([Kt()],Jt.prototype,"rect",null),jt([Kt()],Jt.prototype,"roundRect",null),jt([Kt()],Jt.prototype,"createConicGradient",null),jt([Kt()],Jt.prototype,"createLinearGradient",null),jt([Kt()],Jt.prototype,"createPattern",null),jt([Kt()],Jt.prototype,"createRadialGradient",null),jt([Kt()],Jt.prototype,"fillText",null),jt([Kt()],Jt.prototype,"measureText",null),jt([Kt()],Jt.prototype,"strokeText",null);const{copy:$t,multiplyParent:Qt}=b,{round:te}=Math,ee={width:1,height:1,pixelRatio:1},ie=["width","height","pixelRatio"];class se extends Jt{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,s){super(),this.size={},this.worldTransform={},t||(t=ee),this.manager=s,this.innerId=i.create(i.CNAVAS);const{width:o,height:n,pixelRatio:r}=t;this.autoLayout=!o||!n,this.size.pixelRatio=r|e.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;Wt.copyAttrs(s,t,ie),ie.forEach((t=>s[t]||(s[t]=1))),this.bounds=new yt(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle())}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,o=this.worldTransform;e&&Qt(t,e,o),o.a=t.a*i,o.b=t.b*i,o.c=t.c*i,o.d=t.d*i,o.e=t.e*i,o.f=t.f*i,s&&(t.half&&t.half*i%2?(o.e=te(o.e-.5)+.5,o.f=te(o.f-.5)+.5):(o.e=te(o.e),o.f=te(o.f))),this.setTransform(o.a,o.b,o.c,o.d,o.e,o.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:o,dashOffset:n,miterLimit:r}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),void 0!==e.dashPattern&&(o=e.dashPattern),void 0!==e.dashOffset&&(n=e.dashOffset),e.miterLimit&&(r=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=o,this.dashOffset=n,this.miterLimit=r}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=i*o,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s){if(s&&(this.blendMode=s),e){const{pixelRatio:s}=this;i||(i=e),this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x*s,i.y*s,i.width*s,i.height*s)}else this.drawImage(t.view,0,0);s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s){if(s&&(this.blendMode=s),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,pt.tempToOuterOf(i,e)),this.restore();else{const{pixelRatio:s}=this;this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x,i.y,i.width,i.height)}s&&(this.blendMode="source-over")}copyWorldByReset(t,e,i,s,o){this.resetTransform(),this.copyWorld(t,e,i,s),o||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempBounds(t,!0,!0);const{context:s}=this,o=s.getImageData(mt.x,mt.y,mt.width,mt.height),{data:n}=o;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(o,mt.x,mt.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i){i&&(this.blendMode=i),this.fillStyle=e,this.setTempBounds(t),this.fillRect(mt.x,mt.y,mt.width,mt.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(mt.x,mt.y,mt.width,mt.height),i&&(this.blendMode="source-over")}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(mt.x,mt.y,mt.width,mt.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(mt.x,mt.y,mt.width,mt.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,i){mt.set(t),i&&mt.intersect(this.bounds),mt.scale(this.pixelRatio),e&&mt.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,o=this.manager?this.manager.get(i):Ct.canvas(Object.assign({},i));return o.save(),t&&($t(o.worldTransform,this.worldTransform),o.useWorldTransform()),e&&(o.smooth=this.smooth),o.pixelSnap!==s&&(o.pixelSnap=s),o}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const oe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},ne={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},re=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},ne),ae={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},he={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},le=Object.assign(Object.assign({},he),ne),de=re,ce={};for(let t in de)ce[de[t]]=t;const ue={};for(let t in de)ue[de[t]]=ae[t];const pe={drawRoundRect(t,e,i,s,o,n){const r=a.fourNumber(n,Math.min(s/2,o/2)),h=e+s,l=i+o;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(h,i,h,l,r[1]):t.lineTo(h,i),r[2]?t.arcTo(h,l,e,l,r[2]):t.lineTo(h,l),r[3]?t.arcTo(e,l,e,i,r[3]):t.lineTo(e,l),r[0]?t.arcTo(e,i,h,i,r[0]):t.lineTo(e,i)}},{sin:_e,cos:ge,atan2:fe,ceil:ye,abs:me,PI:ve,sqrt:we,pow:xe}=Math,{setPoint:be,addPoint:Ee}=N,{set:ke,toNumberPoints:Be}=O,{M:Se,L:Te,C:Pe,Q:Re,Z:Ce}=re,Le={},Ae={points(t,e,i,s){let o=Be(e);if(t.push(Se,o[0],o[1]),i&&o.length>5){let e,n,r,a,h,l,d,c,u,p,_,g,f,y=o.length;const m=!0===i?.5:i;s&&(o=[o[y-2],o[y-1],...o,o[0],o[1],o[2],o[3]],y=o.length);for(let i=2;i<y-2;i+=2)e=o[i-2],n=o[i-1],r=o[i],a=o[i+1],h=o[i+2],l=o[i+3],_=we(xe(r-e,2)+xe(a-n,2)),g=we(xe(h-r,2)+xe(l-a,2)),(_||g)&&(f=_+g,_=m*_/f,g=m*g/f,h-=e,l-=n,d=r-_*h,c=a-_*l,2===i?s||t.push(Re,d,c,r,a):t.push(Pe,u,p,d,c,r,a),u=r+g*h,p=a+g*l);s||t.push(Re,u,p,o[y-2],o[y-1])}else for(let e=2,i=o.length;e<i;e+=2)t.push(Te,o[e],o[e+1]);s&&t.push(Ce)},rect(t,e,i,s,o){oe.creator.path=t,oe.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+o).lineTo(e,i+o).lineTo(e,i)},roundRect(t,e,i,s,o,n){oe.creator.path=[],pe.drawRoundRect(oe.creator,e,i,s,o,n),t.push(...oe.convertToCanvasData(oe.creator.path,!0))},arcTo(t,e,i,s,o,n,r,a,h,u,p){const _=s-e,g=o-i,f=n-s,y=r-o;let m=fe(g,_),v=fe(y,f),w=v-m;if(w<0&&(w+=d),w===ve||me(_+g)<1e-12||me(f+y)<1e-12)return t&&t.push(Te,s,o),h&&(be(h,e,i),Ee(h,s,o)),p&&ke(p,e,i),void(u&&ke(u,s,o));const x=_*y-f*g<0,b=x?-1:1,E=a/ge(w/2),k=s+E*ge(m+w/2+c*b),B=o+E*_e(m+w/2+c*b);return m-=c*b,v-=c*b,Ie(t,k,B,a,a,0,m/l,v/l,x,h,u,p)},arc:(t,e,i,s,o,n,r,a,h,l)=>Ie(t,e,i,s,s,0,o,n,r,a,h,l),ellipse(t,e,i,s,o,n,r,a,h,u,p,_){const g=n*l,f=_e(g),y=ge(g);let m=r*l,v=a*l;m>ve&&(m-=d),v<0&&(v+=d);let w=v-m;w<0?w+=d:w>d&&(w-=d),h&&(w-=d);const x=ye(me(w/c)),b=w/x,E=_e(b/4),k=8/3*E*E/_e(b/2);v=m+b;let B,S,T,P,R,C,L,A,O=ge(m),D=_e(m),I=T=y*s*O-f*o*D,M=P=f*s*O+y*o*D,F=e+T,W=i+P;t&&t.push(t.length?Te:Se,F,W),u&&be(u,F,W),_&&ke(_,F,W);for(let n=0;n<x;n++)B=ge(v),S=_e(v),T=y*s*B-f*o*S,P=f*s*B+y*o*S,R=e+I-k*(y*s*D+f*o*O),C=i+M-k*(f*s*D-y*o*O),L=e+T+k*(y*s*S+f*o*B),A=i+P+k*(f*s*S-y*o*B),t&&t.push(Pe,R,C,L,A,e+T,i+P),u&&De(e+I,i+M,R,C,L,A,e+T,i+P,u,!0),I=T,M=P,O=B,D=S,m=v,v+=b;p&&ke(p,e+T,i+P)},quadraticCurveTo(t,e,i,s,o,n,r){t.push(Pe,(e+2*s)/3,(i+2*o)/3,(n+2*s)/3,(r+2*o)/3,n,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,o,n,r,a){De(t,e,(t+2*i)/3,(e+2*s)/3,(o+2*i)/3,(n+2*s)/3,o,n,r,a)},toTwoPointBounds(t,e,i,s,o,n,r,a,h,l){const d=[];let c,u,p,_,g,f,y,m,v=t,w=i,x=o,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,p=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else y=u*u-4*p*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?Ee(h,t,e):be(h,t,e),Ee(h,r,a);for(let l=0,c=d.length;l<c;l++)Oe(d[l],t,e,i,s,o,n,r,a,Le),Ee(h,Le.x,Le.y)},getPointAndSet(t,e,i,s,o,n,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=c*e+u*s+p*n+_*a,l.y=c*i+u*o+p*r+_*h},getPoint(t,e,i,s,o,n,r,a,h){const l={};return Oe(t,e,i,s,o,n,r,a,h,l),l},getDerivative(t,e,i,s,o){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(o-s)}},{getPointAndSet:Oe,toTwoPointBounds:De,ellipse:Ie}=Ae,{sin:Me,cos:Fe,sqrt:We,atan2:ze}=Math,{ellipse:Ue}=Ae,He={ellipticalArc(t,i,s,o,n,r,a,h,c,u,p){const _=(c-i)/2,g=(u-s)/2,f=r*l,y=Me(f),m=Fe(f),v=-m*_-y*g,w=-m*g+y*_,x=o*o,b=n*n,E=w*w,k=v*v,B=x*b-x*E-b*k;let S=0;if(B<0){const t=We(1-B/(x*b));o*=t,n*=t}else S=(a===h?-1:1)*We(B/(x*E+b*k));const T=S*o*w/n,P=-S*n*v/o,R=ze((w-P)/n,(v-T)/o),C=ze((-w-P)/n,(-v-T)/o);let L=C-R;0===h&&L>0?L-=d:1===h&&L<0&&(L+=d);const A=i+_+m*T-y*P,O=s+g+y*T+m*P,D=L<0?1:0;p||e.ellipseToCurve?Ue(t,A,O,o,n,r,R/l,C/l,D):o!==n||r?t.push(re.G,A,O,o,n,r,R/l,C/l,D):t.push(re.O,A,O,o,R/l,C/l,D)}},{M:Ne,m:Ye,L:Xe,l:je,H:Ve,h:Ge,V:Ze,v:Ke,C:qe,c:Je,S:$e,s:Qe,Q:ti,q:ei,T:ii,t:si,A:oi,a:ni,Z:ri,z:ai,N:hi,D:li,X:di,G:ci,F:ui,O:pi,P:_i,U:gi}=re,{rect:fi,roundRect:yi,arcTo:mi,arc:vi,ellipse:wi,quadraticCurveTo:xi}=Ae,{ellipticalArc:bi}=He,Ei=bt.get("PathConvert"),ki={},Bi={current:{dot:0},stringify(t,e){let i,s,o,n=0,r=t.length,h="";for(;n<r;){s=t[n],i=ue[s],h+=s===o?" ":ce[s];for(let s=1;s<i;s++)h+=a.float(t[n+s],e),s===i-1||(h+=" ");o=s,n+=i}return h},parse(t,e){let i,s,o,n="";const r=[],a=e?le:he;for(let e=0,h=t.length;e<h;e++)s=t[e],wt[s]?("."===s&&(Si.dot&&(Ti(r,n),n=""),Si.dot++),"0"===n&&"."!==s&&(Ti(r,n),n=""),n+=s):re[s]?(n&&(Ti(r,n),n=""),Si.name=re[s],Si.length=ae[s],Si.index=0,Ti(r,Si.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===o||"E"===o?n+=s:(n&&Ti(r,n),n=s):n&&(Ti(r,n),n=""),o=s;return n&&Ti(r,n),i?Bi.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,o,n,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(o=t[c],o){case Ye:t[c+1]+=a,t[c+2]+=h;case Ne:a=t[c+1],h=t[c+2],p.push(Ne,a,h),c+=3;break;case Ge:t[c+1]+=a;case Ve:a=t[c+1],p.push(Xe,a,h),c+=2;break;case Ke:t[c+1]+=h;case Ze:h=t[c+1],p.push(Xe,a,h),c+=2;break;case je:t[c+1]+=a,t[c+2]+=h;case Xe:a=t[c+1],h=t[c+2],p.push(Xe,a,h),c+=3;break;case Qe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=$e;case $e:r=n===qe||n===$e,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(qe,l,d,i,s,a,h),c+=5;break;case Je: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=qe;case qe:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(qe,t[c+1],t[c+2],i,s,a,h),c+=7;break;case si:t[c+1]+=a,t[c+2]+=h,o=ii;case ii:r=n===ti||n===ii,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?xi(p,a,h,i,s,t[c+1],t[c+2]):p.push(ti,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ei:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=ti;case ti:i=t[c+1],s=t[c+2],e?xi(p,a,h,i,s,t[c+3],t[c+4]):p.push(ti,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case ni:t[c+6]+=a,t[c+7]+=h;case oi:bi(p,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 ai:case ri:p.push(ri),c++;break;case hi:a=t[c+1],h=t[c+2],e?fi(p,a,h,t[c+3],t[c+4]):Pi(p,t,c,5),c+=5;break;case li:a=t[c+1],h=t[c+2],e?yi(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Pi(p,t,c,9),c+=9;break;case di:a=t[c+1],h=t[c+2],e?yi(p,a,h,t[c+3],t[c+4],t[c+5]):Pi(p,t,c,6),c+=6;break;case ci:wi(e?p:Pi(p,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,ki),a=ki.x,h=ki.y,c+=9;break;case ui:e?wi(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Pi(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case pi:vi(e?p:Pi(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,ki),a=ki.x,h=ki.y,c+=7;break;case _i:e?vi(p,t[c+1],t[c+2],t[c+3],0,360,!1):Pi(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case gi:mi(e?p:Pi(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,ki),a=ki.x,h=ki.y,c+=6;break;default:return Ei.error(`command: ${o} [index:${c}]`,t),p}n=o}return p},objectToCanvasData(t){const e=[];return t.forEach((t=>{switch(t.name){case"M":e.push(Ne,t.x,t.y);break;case"L":e.push(Xe,t.x,t.y);break;case"C":e.push(qe,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ti,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(ri)}})),e},copyData(t,e,i,s){for(let o=i,n=i+s;o<n;o++)t.push(e[o])},pushData(t,e){Si.index===Si.length&&(Si.index=1,t.push(Si.name)),t.push(Number(e)),Si.index++,Si.dot=0}},{current:Si,pushData:Ti,copyData:Pi}=Bi,{M:Ri,L:Ci,C:Li,Q:Ai,Z:Oi,N:Di,D:Ii,X:Mi,G:Fi,F:Wi,O:zi,P:Ui,U:Hi}=re,{getMinDistanceFrom:Ni,getRadianFrom:Yi}=O,{tan:Xi,min:ji,abs:Vi}=Math,Gi={},Zi={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Ri,e,i)},lineTo(t,e,i){t.push(Ci,e,i)},bezierCurveTo(t,e,i,s,o,n,r){t.push(Li,e,i,s,o,n,r)},quadraticCurveTo(t,e,i,s,o){t.push(Ai,e,i,s,o)},closePath(t){t.push(Oi)},rect(t,e,i,s,o){t.push(Di,e,i,s,o)},roundRect(t,e,i,s,o,n){if("number"==typeof n)t.push(Mi,e,i,s,o,n);else{const r=a.fourNumber(n);r?t.push(Ii,e,i,s,o,...r):t.push(Di,e,i,s,o)}},ellipse(t,e,i,s,o,n,r,a,h){void 0===n?t.push(Wi,e,i,s,o):(void 0===r&&(r=0),void 0===a&&(a=360),t.push(Fi,e,i,s,o,n,r,a,h?1:0))},arc(t,e,i,s,o,n,r){void 0===o?t.push(Ui,e,i,s):(void 0===n&&(n=360),t.push(zi,e,i,s,o,n,r?1:0))},arcTo(t,e,i,s,o,n,r,a){if(void 0!==r){const t=Ni(r,a,e,i,s,o);n=ji(n,ji(t/2,t/2*Vi(Xi(Yi(r,a,e,i,s,o)/2))))}t.push(Hi,e,i,s,o,n)},drawEllipse(t,e,i,s,o,n,r,a,h){Ae.ellipse(null,e,i,s,o,void 0===n?0:n,void 0===r?0:r,void 0===a?360:a,h,null,null,Gi),t.push(Ri,Gi.x,Gi.y),Ki(t,e,i,s,o,n,r,a,h)},drawArc(t,e,i,s,o,n,r){Ae.arc(null,e,i,s,void 0===o?0:o,void 0===n?360:n,r,null,null,Gi),t.push(Ri,Gi.x,Gi.y),qi(t,e,i,s,o,n,r)},drawPoints(t,e,i,s){Ae.points(t,e,i,s)}},{ellipse:Ki,arc:qi}=Zi,{moveTo:Ji,lineTo:$i,quadraticCurveTo:Qi,bezierCurveTo:ts,closePath:es,beginPath:is,rect:ss,roundRect:os,ellipse:ns,arc:rs,arcTo:as,drawEllipse:hs,drawArc:ls,drawPoints:ds}=Zi;class cs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?"string"==typeof t?oe.parse(t):t:[],this}beginPath(){return is(this.__path),this.paint(),this}moveTo(t,e){return Ji(this.__path,t,e),this.paint(),this}lineTo(t,e){return $i(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,o,n){return ts(this.__path,t,e,i,s,o,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Qi(this.__path,t,e,i,s),this.paint(),this}closePath(){return es(this.__path),this.paint(),this}rect(t,e,i,s){return ss(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,o){return os(this.__path,t,e,i,s,o),this.paint(),this}ellipse(t,e,i,s,o,n,r,a){return ns(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}arc(t,e,i,s,o,n){return rs(this.__path,t,e,i,s,o,n),this.paint(),this}arcTo(t,e,i,s,o){return as(this.__path,t,e,i,s,o),this.paint(),this}drawEllipse(t,e,i,s,o,n,r,a){return hs(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}drawArc(t,e,i,s,o,n){return ls(this.__path,t,e,i,s,o,n),this.paint(),this}drawPoints(t,e,i){return ds(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:us,L:ps,C:_s,Q:gs,Z:fs,N:ys,D:ms,X:vs,G:ws,F:xs,O:bs,P:Es,U:ks}=re,Bs=bt.get("PathDrawer"),Ss={drawPathByData(t,e){if(!e)return;let i,s=0,o=e.length;for(;s<o;)switch(i=e[s],i){case us:t.moveTo(e[s+1],e[s+2]),s+=3;break;case ps:t.lineTo(e[s+1],e[s+2]),s+=3;break;case _s:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case gs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case fs:t.closePath(),s+=1;break;case ys:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case ms:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case vs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case ws:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*l,e[s+6]*l,e[s+7]*l,e[s+8]),s+=9;break;case xs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,d,!1),s+=5;break;case bs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*l,e[s+5]*l,e[s+6]),s+=7;break;case Es:t.arc(e[s+1],e[s+2],e[s+3],0,d,!1),s+=4;break;case ks:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Bs.error(`command: ${i} [index:${s}]`,e)}}},{M:Ts,L:Ps,C:Rs,Q:Cs,Z:Ls,N:As,D:Os,X:Ds,G:Is,F:Ms,O:Fs,P:Ws,U:zs}=re,{toTwoPointBounds:Us,toTwoPointBoundsByQuadraticCurve:Hs,arcTo:Ns,arc:Ys,ellipse:Xs}=Ae,{addPointBounds:js,copy:Vs,addPoint:Gs,setPoint:Zs,addBounds:Ks,toBounds:qs}=N,Js=bt.get("PathBounds");let $s,Qs,to;const eo={},io={},so={},oo={toBounds(t,e){oo.toTwoPointBounds(t,io),qs(io,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Zs(e,0,0);let i,s,o,n,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===Ls||r===Rs||r===Cs?Zs(e,h,l):Zs(e,t[a+1],t[a+2])),r){case Ts:case Ps:h=t[a+1],l=t[a+2],Gs(e,h,l),a+=3;break;case Rs:o=t[a+5],n=t[a+6],Us(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,eo),js(e,eo),h=o,l=n,a+=7;break;case Cs:i=t[a+1],s=t[a+2],o=t[a+3],n=t[a+4],Hs(h,l,i,s,o,n,eo),js(e,eo),h=o,l=n,a+=5;break;case Ls:a+=1;break;case As:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=5;break;case Os:case Ds:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=r===Os?9:6;break;case Is:Xs(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],eo,so),0===a?Vs(e,eo):js(e,eo),h=so.x,l=so.y,a+=9;break;case Ms:h=t[a+1],l=t[a+2],Qs=t[a+3],to=t[a+4],Ks(e,h-Qs,l-to,2*Qs,2*to),h+=Qs,a+=5;break;case Fs:Ys(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],eo,so),0===a?Vs(e,eo):js(e,eo),h=so.x,l=so.y,a+=7;break;case Ws:h=t[a+1],l=t[a+2],$s=t[a+3],Ks(e,h-$s,l-$s,2*$s,2*$s),h+=$s,a+=4;break;case zs:Ns(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],eo,so),0===a?Vs(e,eo):js(e,eo),h=so.x,l=so.y,a+=6;break;default:return void Js.error(`command: ${r} [index:${a}]`,t)}}},{M:no,L:ro,Z:ao}=re,{getCenterX:ho,getCenterY:lo}=O,{arcTo:co}=Zi,uo={smooth(t,e,i){let s,o,n,r=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0,_=0;const g=t.length,f=[];for(;r<g;){switch(s=t[r],s){case no:l=p=t[r+1],d=_=t[r+2],r+=3,t[r]===ro?(c=t[r+1],u=t[r+2],f.push(no,ho(l,c),lo(d,u))):f.push(no,l,d);break;case ro:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case ro:co(f,a,h,t[r+1],t[r+2],e,p,_);break;case ao:co(f,a,h,l,d,e,p,_);break;default:f.push(ro,a,h)}p=a,_=h;break;case ao:o!==ao&&(co(f,l,d,c,u,e,p,_),f.push(ao)),r+=1;break;default:n=ue[s];for(let e=0;e<n;e++)f.push(t[r+e]);r+=n}o=s}return s!==ao&&(f[1]=l,f[2]=d),f}};oe.creator=new cs,oe.parse=Bi.parse,oe.convertToCanvasData=Bi.toCanvasData;const po=new cs,{drawRoundRect:_o}=pe;function go(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,o){_o(this,t,e,i,s,o)})}(t)}const fo={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=yo.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{}}}},yo=fo;yo.alphaPixelTypes.forEach((t=>yo.upperCaseTypeMap[t]=t.toUpperCase()));const mo=bt.get("TaskProcessor");class vo{constructor(t){this.parallel=!0,this.time=1,this.id=i.create(i.TASK),this.task=t}run(){return Vt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){mo.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class wo{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&Wt.assign(this.config,t),this.empty()}add(t,e){let i,s,o,n;const r=new vo(t);return r.parent=this,"number"==typeof e?n=e:e&&(s=e.parallel,i=e.start,o=e.time,n=e.delay),o&&(r.time=o),!1===s&&(r.parallel=!1),void 0===n?this.push(r,i):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(r,i))}),n)),this.isComplete=!1,r}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 i=this.index;i<e&&(t=this.list[i],t.parallel);i++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const xo=bt.get("Resource"),bo={tasker:new wo,map:{},get isComplete(){return Eo.tasker.isComplete},set(t,e){Eo.map[t]&&xo.repeat(t),Eo.map[t]=e},get:t=>Eo.map[t],remove(t){const e=Eo.map[t];e&&(e.destroy&&e.destroy(),delete Eo.map[t])},loadImage(t,e){return new Promise(((i,s)=>{const o=this.setImage(t,t,e);o.load((()=>i(o)),(t=>s(t)))}))},setImage(t,e,i){let s;return"string"==typeof e?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=Ct.image(s)),Eo.set(t,e),e},destroy(){Eo.map={}}},Eo=bo,ko={maxRecycled:10,recycledList:[],patternTasker:new wo,get(t){let e=bo.get(t.url);return e||bo.set(t.url,e=Ct.image(t)),e.use++,e},recycle(t){t.use--,setTimeout((()=>{t.use||Bo.recycledList.push(t)}))},clearRecycled(){const t=Bo.recycledList;t.length>Bo.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&bo.remove(t.url))),t.length=0)},hasAlphaPixel:t=>fo.alphaPixelTypes.some((e=>Bo.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+fo.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+fo.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Bo.recycledList=[]}},Bo=ko,{IMAGE:So,create:To}=i;class Po{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=To(So),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}ko.isFormat("svg",t)&&(this.isSVG=!0),ko.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,i){if(!this.loading){this.loading=!0;let{loadImage:t,loadImageWithProgress:i}=e.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(t=i),bo.tasker.add((()=>Vt(this,void 0,void 0,(function*(){return yield t(this.url,s).then((t=>this.setView(t))).catch((t=>{this.error=t,this.onComplete(!1)}))}))))}return this.waitComplete.push(t,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach(((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))})),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,i,s,o){if(t||(t=this.width),i||(i=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const n=e.origin.createCanvas(t,i),r=n.getContext("2d");return s&&(r.globalAlpha=s),r.drawImage(this.view,0,0,t,i),this.cache=this.use>1?{data:n,params:arguments}:null,n}getPattern(t,i,s,o){const n=e.canvas.createPattern(t,i);try{s&&n.setTransform&&(n.setTransform(s),s=void 0)}catch(t){}return o&&Wt.stintSet(o,"transform",s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Ro(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Co(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Lo(t,e){const i="_"+t;return{get(){const t=this[i];return void 0===t?e:t},set(t){this[i]=t}}}function Ao(t,e){return(i,s)=>Do(i,s,t,e&&e(s))}function Oo(t){return t}function Do(t,e,i,s){const o={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Ro(t,e,Object.assign(o,s||{})),an(t,e,i)}function Io(t){return Ao(t)}function Mo(t,e){return Ao(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function Fo(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),No(this))}})))}function Wo(t,e){return Ao(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function zo(t,e){return Ao(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Uo(t,e){return Ao(t,(t=>({set(i){this.__setAttr(t,i,e)&&No(this)}})))}function Ho(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e)&&(No(this),this.__.__removeNaturalSize())}})))}function No(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Yo(t){return Ao(t,(t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),No(this)}})))}const Xo=Uo;function jo(t,e){return Ao(t,(t=>({set(i){this.__setAttr(t,i)&&(Vo(this),e&&(this.__.__useStroke=!0))}})))}function Vo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&No(t)}const Go=jo;function Zo(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Ko(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function qo(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&$o(this)}})))}function Jo(t){return Ao(t,(t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Qo(this,t,e,i)))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Qo(this,t,e,i),this.mask&&$o(this)}})))}function $o(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Qo(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||No(t))}function tn(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function en(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function sn(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function on(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===bt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))}function nn(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function rn(t){return(e,i)=>{Ro(e,"__DataProcessor",{get:()=>t})}}function an(t,e,i){const s=t.__DataProcessor.prototype,o="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),r=Lo(e,i);if(void 0===i)r.get=function(){return this[o]};else if("function"==typeof i)r.get=function(){let t=this[o];return void 0===t?i(this.__leaf):t};else if("object"==typeof i){const t=Xt(i);r.get=function(){let e=this[o];return void 0===e?this[o]=t?{}:Wt.clone(i):e}}const a=t.isBranchLeaf;"width"===e?r.get=function(){const t=this[o];if(void 0===t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:a&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(r.get=function(){const t=this[o];if(void 0===t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:a&&s.children.length?s.boxBounds.height:i}return t});let h,l=s;for(;!h&&l;)h=Co(l,e),l=l.__proto__;h&&h.set&&(r.set=h.set),s[n]&&(r.set=s[n],delete s[n]),Ro(s,e,r)}const hn=new bt("rewrite"),ln=[],dn=["destroy","constructor"];function cn(t){return(e,i)=>{ln.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function un(){return t=>{pn()}}function pn(t){ln.length&&(ln.forEach((e=>{t&&hn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),ln.length=0)}function _n(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach((s=>{if(!(dn.includes(s)||e&&e.includes(s)))if(t.prototype){Co(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]}))}}function gn(){return t=>{At.register(t)}}function fn(){return t=>{It.register(t)}}setTimeout((()=>pn(!0)));const{copy:yn,toInnerPoint:mn,toOuterPoint:vn,scaleOfOuter:wn,rotateOfOuter:xn,skewOfOuter:bn,multiplyParent:En,divideParent:kn,getLayout:Bn}=b,Sn={},{round:Tn}=Math,Pn={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Ln(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,o=s.length;t<o;t++)Cn(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)An(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&An(t),t.__updateChange()},updateAllChange(t){if(Dn(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)On(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},copyCanvasByWorld(t,i,s,o,n,r){o||(o=t.__nowWorld),t.__worldFlipped||e.fullImageShadow?i.copyWorldByReset(s,o,t.__nowWorld,n,r):i.copyWorldToInner(s,o,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,o){const n="object"==typeof e?Object.assign({},e):{x:e,y:i};s?vn(t.localTransform,n,n,!0):t.parent&&mn(t.parent.worldTransform,n,n,!0),Rn.moveLocal(t,n.x,n.y,o)},moveLocal(t,e,i=0,s){"object"==typeof e&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Tn(e),i=Tn(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,o,n){Rn.zoomOfLocal(t,In(t,e),i,s,o,n)},zoomOfLocal(t,e,i,s=i,o,n){const r=t.__localMatrix;if("number"!=typeof s&&(s&&(n=s),s=i),yn(Sn,r),wn(Sn,e,i,s),t.origin||t.around)Rn.setTransform(t,Sn,o,n);else{const e=t.x+Sn.e-r.e,a=t.y+Sn.f-r.f;n&&!o?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==o))}},rotateOfWorld(t,e,i,s){Rn.rotateOfLocal(t,In(t,e),i,s)},rotateOfLocal(t,e,i,s){const o=t.__localMatrix;yn(Sn,o),xn(Sn,e,i),t.origin||t.around?Rn.setTransform(t,Sn,!1,s):t.set({x:t.x+Sn.e-o.e,y:t.y+Sn.f-o.f,rotation:a.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,o,n){Rn.skewOfLocal(t,In(t,e),i,s,o,n)},skewOfLocal(t,e,i,s=0,o,n){yn(Sn,t.__localMatrix),bn(Sn,e,i,s),Rn.setTransform(t,Sn,o,n)},transformWorld(t,e,i,s){yn(Sn,t.worldTransform),En(Sn,e),t.parent&&kn(Sn,t.parent.worldTransform),Rn.setTransform(t,Sn,i,s)},transform(t,e,i,s){yn(Sn,t.localTransform),En(Sn,e),Rn.setTransform(t,Sn,i,s)},setTransform(t,e,i,s){const o=t.__,n=o.origin&&Rn.getInnerOrigin(t,o.origin),r=Bn(e,n,o.around&&Rn.getInnerOrigin(t,o.around));if(i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,n){pt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Rn.getInnerOrigin(t,o.origin);O.move(r,n.x-s.x,n.y-s.y)}t.set(r),t.scaleResize(e,i,!1)}else t.set(r,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return wn(i,Rn.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>O.tempToOuterOf(Rn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return G.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(yn(Sn,t.worldTransform),kn(Sn,e.worldTransform),i?Sn:Object.assign({},Sn)),drop(t,e,i,s){t.setTransform(Rn.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}}},Rn=Pn,{updateAllMatrix:Cn,updateMatrix:Ln,updateAllWorldOpacity:An,updateAllChange:On,updateChange:Dn}=Rn;function In(t,e){return t.__layout.update(),t.parent?O.tempToInnerOf(e,t.parent.__world):e}const Mn={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.mask?t.__localBoxBounds:null,maskLocalStrokeBounds:t=>t.__.mask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.mask?t.__layout.localRenderBounds:null,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))},{updateBounds:Fn}=Pn,Wn={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,o=i.length;s<o;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),zn(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&void 0===i[t.parent.innerId];)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)Un(e[t],e)},updateBounds(t,e){const i=[t];Un(t,i),Hn(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let o=t.length-1;o>-1;o--){i=t[o],s=i.children;for(let t=0,e=s.length;t<e;t++)Fn(s[t]);e&&e===i||Fn(i)}}},{pushAllChildBranch:zn,pushAllBranchStack:Un,updateBoundsByBranchStack:Hn}=Wn,Nn={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:Yn,updateBounds:Xn}=Pn,{toOuterOf:jn,getPoints:Vn,copy:Gn}=pt,Zn="_localContentBounds",Kn="_worldContentBounds",qn="_worldBoxBounds",Jn="_worldStrokeBounds";class $n{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return jn(this.contentBounds,this.leaf.__localMatrix,this[Zn]||(this[Zn]={})),this[Zn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return jn(this.contentBounds,this.leaf.__world,this[Kn]||(this[Kn]={})),this[Kn]}get worldBoxBounds(){return jn(this.boxBounds,this.leaf.__world,this[qn]||(this[qn]={})),this[qn]}get worldStrokeBounds(){return jn(this.strokeBounds,this.leaf.__world,this[Jn]||(this[Jn]={})),this[Jn]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:i}=t;if(t.isApp)return Xn(t);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=t;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,e.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return b.defaultMatrix;case"page":t=e.zoomLayer;default:return Yn(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 yt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let o,n,r,a=this.getInnerBounds(t);switch(e){case"world":o=s.getWorldPoint(a),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},o=s.getLocalPointByInner(a);break;case"inner":o=a,n=b.defaultMatrix;break;case"page":e=s.zoomLayer;default:o=s.getWorldPoint(a,e),n=Yn(s,e,!0)}if(r||(r=b.getLayout(n)),Gn(r,a),O.copy(r,o),i){const{scaleX:t,scaleY:e}=r,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(r.scaleX/=i,r.scaleY/=s,r.width*=i,r.height*=s)}return r}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Vn(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:o=e}return void 0!==o&&s.forEach((t=>i.innerToWorld(t,null,!1,o))),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.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=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Qn{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.event.stop(this.origin)}}class tr extends Qn{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}tr.ADD="child.add",tr.REMOVE="child.remove",tr.CREATED="created",tr.MOUNTED="mounted",tr.UNMOUNTED="unmounted",tr.DESTROY="destroy";class er extends Qn{constructor(t,e,i,s,o){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=o}}er.CHANGE="property.change",er.LEAFER_CHANGE="property.leafer_change";class ir extends Qn{constructor(t,e){super(t),Object.assign(this,e)}}ir.LOAD="image.load",ir.LOADED="image.loaded",ir.ERROR="image.error";class sr extends Qn{static checkHas(t,e,i){"on"===i?e===ar?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(or)||t.hasEvent(nr)||t.hasEvent(rr),t.__hasWorldEvent=t.hasEvent(ar))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(or,t),"inner"===e&&t.emit(nr,t)),t.emit(rr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(ar,this)}}sr.RESIZE="bounds.resize",sr.INNER="bounds.inner",sr.LOCAL="bounds.local",sr.WORLD="bounds.world";const{RESIZE:or,INNER:nr,LOCAL:rr,WORLD:ar}=sr,hr={};[or,nr,rr,ar].forEach((t=>hr[t]=1));class lr extends Qn{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}static isResizing(t){return this.resizingKeys&&void 0!==this.resizingKeys[t.innerId]}}lr.RESIZE="resize";class dr extends Qn{constructor(t,e){super(t),this.data=e}}dr.REQUEST="watch.request",dr.DATA="watch.data";class cr extends Qn{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}cr.REQUEST="layout.request",cr.START="layout.start",cr.BEFORE="layout.before",cr.LAYOUT="layout",cr.AFTER="layout.after",cr.AGAIN="layout.again",cr.END="layout.end";class ur extends Qn{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}ur.REQUEST="render.request",ur.CHILD_START="render.child_start",ur.CHILD_END="render.child_end",ur.START="render.start",ur.BEFORE="render.before",ur.RENDER="render",ur.AFTER="render.after",ur.AGAIN="render.again",ur.END="render.end",ur.NEXT="render.next";class pr extends Qn{}pr.START="leafer.start",pr.BEFORE_READY="leafer.before_ready",pr.READY="leafer.ready",pr.AFTER_READY="leafer.after_ready",pr.VIEW_READY="leafer.view_ready",pr.VIEW_COMPLETED="leafer.view_completed",pr.STOP="leafer.stop",pr.RESTART="leafer.restart",pr.END="leafer.end";const _r={};class gr{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(t instanceof Array)t.forEach((t=>this.on(t[0],t[1],t[2])));else for(let i in t)(e=t[i])instanceof Array?this.on(i,e[0],e[1]):this.on(i,e);return}let s,o,n;i&&("once"===i?o=!0:"boolean"==typeof i?s=i:(s=i.capture,o=i.once));const r=fr(this,s,!0),a="string"==typeof t?t.split(" "):t,h=o?{listener:e,once:o}:{listener:e};a.forEach((t=>{t&&(n=r[t],n?-1===n.findIndex((t=>t.listener===e))&&n.push(h):r[t]=[h],hr[t]&&sr.checkHas(this,t,"on"))}))}off(t,e,i){if(t){const s="string"==typeof t?t.split(" "):t;if(e){let t,o,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=fr(this,t);s.forEach((t=>{t&&(o=r[t],o&&(n=o.findIndex((t=>t.listener===e)),n>-1&&o.splice(n,1),o.length||delete r[t],hr[t]&&sr.checkHas(this,t,"off")))}))}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach((i=>{t&&delete t[i],e&&delete e[i]}))}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):t instanceof Array&&t.forEach((t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3]))),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>{t.listener?t.current.off(t.type,t.listener,t.options):t.type instanceof Array&&t.type.forEach((e=>t.current.off(e[0],e[1],e[3])))})),e.length=0}once(t,e,i,s){if(!e)return t instanceof Array&&t.forEach((t=>this.once(t[0],t[1],t[2],t[3])));"object"==typeof i?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&It.has(t)&&(e=It.get(t,{type:t,target:this,current:this}));const s=fr(this,i)[t];if(s){let o;for(let n=0,r=s.length;n<r&&!((o=s[n])&&(o.listener(e),o.once&&(this.off(t,o.listener,i),n--,r--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,o=i&&i[t],n=s&&s[t];return!!(void 0===e?o||n:e?n:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function fr(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:_r)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:_r)}}const{on:yr,on_:mr,off:vr,off_:wr,once:xr,emit:br,emitEvent:Er,hasEvent:kr,destroy:Br}=gr.prototype,Sr={on:yr,on_:mr,off:vr,off_:wr,once:xr,emit:br,emitEvent:Er,hasEvent:kr,destroyEventer:Br},{isFinite:Tr}=Number,Pr=bt.get("setAttr"),Rr={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(i&&!Tr(e)&&void 0!==e&&(Pr.warn(this.innerName,t,e),e=void 0),"object"==typeof e||s!==e){this.__realSetAttr(t,e);const{CHANGE:i}=er,o=new er(i,this,t,s,e);return this.isLeafer?this.emitEvent(new er(er.LEAFER_CHANGE,this,t,s,e)):this.hasEvent(i)&&this.emitEvent(o),this.leafer.emitEvent(o),!0}return!1}return this.__realSetAttr(t,e),!0},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||void 0===i.normalStyle[t]||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Cr,multiplyParent:Lr,translateInner:Ar,defaultWorld:Or}=b,{toPoint:Dr,tempPoint:Ir}=G,Mr={__updateWorldMatrix(){const{parent:t,__layout:e}=this;Lr(this.__local||e,t?t.__world:Or,this.__world,!!e.affectScaleOrRotation,this.__,t&&(t.scrollY||t.scrollX)&&t.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Cr(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Dr(i.around||i.origin,t.boxBounds,Ir),Ar(e,-Ir.x,-Ir.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Fr,updateAllMatrix:Wr}=Pn,{updateBounds:zr}=Wn,{toOuterOf:Ur,copyAndSpread:Hr,copy:Nr}=pt,{toBounds:Yr}=oo,Xr={__updateWorldBounds(){const t=this.__layout;Ur(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&sr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&sr.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Ur(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ur(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ur(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Yr(e.path,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Wr(this),zr(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Wr(this),zr(this,this))):Fr(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Hr(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Hr(t.renderBounds,t.boxBounds,t.renderSpread):Nr(t.renderBounds,t.strokeBounds)}},jr={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),Pn.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);bt.showBounds&&bt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Vr}=Mn,Gr={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.dim?e.dimOpacity=!0===i.dim?.2:i.dim:i.dimskip&&e.dimOpacity&&(e.dimOpacity=0),i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const o=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,o,o,i.__blendMode,!0),s.recycle(o)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,o=i.length;s<o;s++)Vr(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,o=i.length;s<o;s++)Vr(i[s],e)||i[s].__clip(t,e)}}},Zr={},{LEAF:Kr,create:qr}=i,{toInnerPoint:Jr,toOuterPoint:$r,multiplyParent:Qr}=b,{toOuterOf:ta}=pt,{copy:ea,move:ia}=O,{moveLocal:sa,zoomOfLocal:oa,rotateOfLocal:na,skewOfLocal:ra,moveWorld:aa,zoomOfWorld:ha,rotateOfWorld:la,skewOfWorld:da,transform:ca,transformWorld:ua,setTransform:pa,getFlipTransform:_a,getLocalOrigin:ga,getRelativeWorld:fa,drop:ya}=Pn;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return Ut}get __LayoutProcessor(){return $n}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.update(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=qr(Kr),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(tr.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(tr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(tr.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer((()=>this.leafer.nextRender(t,e,i)))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(tr.MOUNTED)):this.__emitLifeEvent(tr.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){void 0===t?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=void 0===e?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateContentBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.eraser))}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some((t=>t.__.mask&&t.__.visible&&t.__.opacity))}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Qr(i,t.matrix,e,void 0,i),ta(this.__layout.renderBounds,e,e),e.half!==i.half&&(e.half=i.half),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){const{scaleX:i,scaleY:s}=ko.patternLocked?this.__world:this.__nowWorld;return e?Zr.scaleX=Zr.scaleY=1:t?(Zr.scaleX=i<0?-i:i,Zr.scaleY=s<0?-s:s):(Zr.scaleX=i,Zr.scaleY=s),Zr}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?fa(this,e):this.worldTransform,o=i?t:{};return ta(t,s,o),o}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&ea(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&ea(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Jr(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){$r(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return ia(o,-n,-r),o}getInnerPoint(t,e,i,s){const o=s?t:{};return this.worldToInner(t,o,i,e),o}getInnerPointByBox(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return ia(o,n,r),o}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const o=s?t:{};return this.worldToLocal(t,o,i,e),o}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const o=s?t:{};return this.innerToWorld(t,o,i,e),o}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const o=s?t:{};return this.localToWorld(t,o,i,e),o}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){pa(this,t,e,i)}transform(t,e,i){ca(this,t,e,i)}move(t,e,i){sa(this,t,e,i)}moveInner(t,e,i){aa(this,t,e,!0,i)}scaleOf(t,e,i,s,o){oa(this,ga(this,t),e,i,s,o)}rotateOf(t,e,i){na(this,ga(this,t),e,i)}skewOf(t,e,i,s,o){ra(this,ga(this,t),e,i,s,o)}transformWorld(t,e,i){ua(this,t,e,i)}moveWorld(t,e,i){aa(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,o){ha(this,t,e,i,s,o)}rotateOfWorld(t,e){la(this,t,e)}skewOfWorld(t,e,i,s,o){da(this,t,e,i,s,o)}flip(t,e){ca(this,_a(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Rt.need("path")}getMotionPoint(t){return Rt.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){ya(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):an(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Uo),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new tr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(tr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=jt([_n(Rr),_n(Mr),_n(Xr),_n(Sr),_n(jr)],t.Leaf);const{setListWithFn:ma}=pt,{sort:va}=Wn,{localBoxBounds:wa,localStrokeBounds:xa,localRenderBounds:ba,maskLocalBoxBounds:Ea,maskLocalStrokeBounds:ka,maskLocalRenderBounds:Ba}=Mn,Sa=new bt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){ma(this.__layout.boxBounds,this.children,this.__hasMask?Ea:wa)}__updateStrokeBounds(){ma(this.__layout.strokeBounds,this.children,this.__hasMask?ka:xa)}__updateRenderBounds(){ma(this.__layout.renderBounds,this.children,this.__hasMask?Ba:ba)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(va),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Sa.warn("add self or destroyed");const i=void 0===e;if(!t.__){if(t instanceof Array)return t.forEach((t=>{this.add(t,e),i||e++}));t=At.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(tr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(tr.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",(()=>this.__remove(t,e))):this.__remove(t,e):this.find(t).forEach((t=>this.remove(t,e))):void 0===t&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach((e=>{this.__realRemoveChild(e),t&&e.destroy()})))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(tr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(tr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new tr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=jt([_n(Gr)],t.Branch);class Ta{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:i}=this;void 0===i[t.innerId]&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(void 0===i[t.innerId]){const{list:s}=this;for(let t=e,o=s.length;t<o;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,o=e.length;s<o;s++)void 0!==i?this.keys[e[s].innerId]=s-1:e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]);void 0!==i&&e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}forEach(t){this.list.forEach(t)}clone(){const t=new Ta;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Pa{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:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach((i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])}))}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class Ra extends se{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}go(OffscreenCanvasRenderingContext2D.prototype),go(Path2D.prototype);const{mineType:Ca}=fo;function La(t,i){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise(((s,o)=>{t.convertToBlob({type:Ca(e),quality:i}).then((t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>o(t),e.readAsDataURL(t)})).catch((t=>{o(t)}))})),canvasToBolb:(t,e,i)=>t.convertToBlob({type:Ca(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise((t=>t())),download(t,e){},loadImage:t=>new Promise(((i,s)=>{let o=new XMLHttpRequest;o.open("GET",e.image.getRealURL(t),!0),o.responseType="blob",o.onload=()=>{createImageBitmap(o.response).then((t=>{i(t)})).catch((t=>{s(t)}))},o.onerror=t=>s(t),o.send()}))},e.canvas=Ct.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(Ct,{canvas:(t,e)=>new Ra(t,e),image:t=>new Po(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},Ro(e,"devicePixelRatio",{get:()=>1});const{userAgent:Aa}=navigator;Aa.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0):Aa.indexOf("Safari")>-1&&-1===Aa.indexOf("Chrome")&&(e.fullImageShadow=!0),Aa.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):Aa.indexOf("Mac")>-1?e.os="Mac":Aa.indexOf("Linux")>-1&&(e.os="Linux");class Oa{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new Ta;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 Ta,this.target=t,e&&(this.config=Wt.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(ur.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===tr.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new dr(dr.DATA,{updatedList:this.updatedList})),this.__updatedList=new Ta,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[er.CHANGE,this.__onAttrChange,this],[[tr.ADD,tr.REMOVE],this.__onChildEvent,this],[dr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Da,updateBounds:Ia,updateChange:Ma}=Pn,{pushAllChildBranch:Fa,pushAllParent:Wa}=Wn;const{worldBounds:za}=Mn;class Ua{constructor(t){this.updatedBounds=new yt,this.beforeBounds=new yt,this.afterBounds=new yt,t instanceof Array&&(t=new Ta(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,za)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,za),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:Ha,updateAllChange:Na}=Pn,Ya=bt.get("Layouter");class Xa{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new Pa,this.target=t,e&&(this.config=Wt.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(cr.START),this.layoutOnce(),t.emitEvent(new cr(cr.END,this.layoutedBlocks,this.times))}catch(t){Ya.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ya.warn("layouting"):this.times>3?Ya.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(dr.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:i,__updatedList:s}=this,{BEFORE:o,LAYOUT:n,AFTER:r}=cr,a=this.getBlocks(s);a.forEach((t=>t.setBefore())),i.emitEvent(new cr(o,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Da(t,!0),e.add(t),t.isBranch&&Fa(t,e),Wa(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Wa(t,e)))}))}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach((o=>{e=t.levelMap[o];for(let t=0,o=e.length;t<o;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Ia(s[t])}Ia(i)}}))}(this.__levelList),function(t){t.list.forEach(Ma)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach((t=>t.setAfter())),i.emitEvent(new cr(n,a,this.times)),i.emitEvent(new cr(r,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:i,LAYOUT:s,AFTER:o}=cr,n=this.getBlocks(new Ta(e));e.emitEvent(new cr(i,n,this.times)),Xa.fullLayout(e),n.forEach((t=>{t.setAfter()})),e.emitEvent(new cr(s,n,this.times)),e.emitEvent(new cr(o,n,this.times)),this.addBlocks(n),St.end(t)}static fullLayout(t){Ha(t,!0),t.isBranch?Wn.updateBounds(t):Pn.updateBounds(t),Na(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ua([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ua(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[cr.REQUEST,this.layout,this],[cr.AGAIN,this.layoutAgain,this],[dr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const ja=bt.get("Renderer");class Va{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,i&&(this.config=Wt.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(cr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(ur.CHILD_START,t),t.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),t.emit(ur.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(ur.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new yt,ja.log(e.innerName,"---\x3e");try{this.emitRender(ur.START),this.renderOnce(t),this.emitRender(ur.END,this.totalBounds),ko.clearRecycled()}catch(t){this.rendering=!1,ja.error(t)}ja.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return ja.warn("rendering");if(this.times>3)return ja.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new yt,this.renderOptions={},t)this.emitRender(ur.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(ur.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(ur.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ur.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)})))}clipRender(t){const e=St.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),o=new yt(s);i.save(),s.spread(Va.clipSpread).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0),this.__render(s,o),i.restore(),St.end(e)}fullRender(){const t=St.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),St.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),o=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),bt.showRepaint&&bt.drawRepaint(i,t),this.target.__render(i,o),this.renderBounds=e=e||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new yt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);const i=this.requestTime=Date.now();e.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()}))}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new yt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new yt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||ja.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,i){this.target.emitEvent(new ur(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[ur.REQUEST,this.update,this],[cr.END,this.__onLayoutEnd,this],[ur.AGAIN,this.renderAgain,this],[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)}}Va.clipSpread=10;const{hitRadiusPoint:Ga}=pt;class Za{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,o=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Ta(i.findList),i.findList||this.hitBranch(n);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,o),h=o?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:a}}getBestMatchLeaf(t,e,i){if(t.length){let e;this.findList=new Ta;const{x:s,y:o}=this.point,n={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=t.length;s<o;s++)if(e=t[s],(i||Pn.worldHittable(e))&&(this.hitChild(e,n),this.findList.length))return this.findList.list[0]}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),this.findList.length)return this.findList.list[0];return t[0]}getPath(t){const e=new Ta;for(;t;)e.add(t),t=t.parent;return this.target&&e.add(this.target),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new Ta;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren);t--);return s}getThroughPath(t){const e=new Ta,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,o,n;for(let t=0,r=i.length;t<r;t++){s=i[t],o=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!o||!o.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:o}=this;for(let n=t.length-1;n>-1;n--)i=t[n],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||Ga(i.__world,o),i.isBranch?(s||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)):s&&this.hitChild(i,o))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask&&!s.children.some((t=>t.__.mask&&t.__hitWorld(e))))return;this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Ka{constructor(t,e){this.config={},e&&(this.config=Wt.default(e,this.config)),this.picker=new Za(this.target=t,this),this.finder=Ct.finder&&Ct.finder()}getByPoint(t,i,s){const{target:o,picker:n}=this;return e.backgrounder&&o&&o.updateLayout(),n.getByPoint(t,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Rt.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function qa(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Ja(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function $a(){return(t,e)=>{const i="_"+e;Ro(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(Ct,{watcher:(t,e)=>new Oa(t,e),layouter:(t,e)=>new Xa(t,e),renderer:(t,e,i)=>new Va(t,e,i),selector:(t,e)=>new Ka(t,e)}),e.layout=Xa.fullLayout;const Qa={},th={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},eh={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},ih={},sh={},oh={},nh={},rh={},ah={apply(){Rt.need("filter")}},hh={},lh={setStyleName:()=>Rt.need("state"),set:()=>Rt.need("state")},dh={list:{},register(t,e){dh.list[t]=e},get:t=>dh.list[t]},{parse:ch,objectToCanvasData:uh}=Bi,{stintSet:ph}=Wt,{hasTransparent:_h}=th,gh={},fh=bt.get("UIData");class yh extends Ut{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,fh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,fh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("fill",t):(ph(this,"__isTransparentFill",_h(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("stroke",t):(ph(this,"__isTransparentStroke",_h(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t)}setPath(t){const e="string"==typeof t;e||t&&"object"==typeof t[0]?(this.__setInput("path",t),this._path=e?ch(t):uh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){mh(this,"shadow",t)}setInnerShadow(t){mh(this,"innerShadow",t)}setFilter(t){mh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&sh.compute("fill",this.__leaf),e&&sh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),void 0!==t.strokeWidthFixed&&(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),e instanceof Array&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=gh)):(this.__isStrokes=!0,this._stroke||(this._stroke=gh))}__removePaint(t,e){e&&this.__removeInput(t),oh.recycleImage(t,this),"fill"===t?(ph(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(ph(this,"__isAlphaPixelStroke",void 0),ph(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function mh(t,e,i){t.__setInput(e,i),i instanceof Array?(i.some((t=>!1===t.visible))&&(i=i.filter((t=>!1!==t.visible))),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class vh extends yh{}class wh extends vh{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"hide"===t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class xh extends vh{__getInputData(t,e){const i=super.__getInputData(t,e);return ie.forEach((t=>delete i[t])),i}}class bh extends wh{}class Eh extends yh{}class kh extends yh{get __boxStroke(){return!this.__pathInputed}}class Bh extends yh{get __boxStroke(){return!this.__pathInputed}}class Sh extends yh{}class Th extends yh{}class Ph extends yh{get __pathInputed(){return 2}}class Rh extends vh{}const Ch={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Lh extends yh{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),t=Ch[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=At.get("Rect",0);const o=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=o.boxBounds),i.set(t),n.strokeChanged&&o.strokeChange(),n.renderChanged&&o.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class Ah extends kh{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class Oh extends kh{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const Dh={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),n&&(t=Math.max(n.__layout.strokeSpread=n.__updateStrokeSpread(),t),e=n.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:n,renderSpread:r}=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))),s&&(t=Math.max(t,s)),n&&(t+=ah.getSpread(n)),r&&(t+=r);let a=t=Math.ceil(t);return i&&i.forEach((t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur))),o&&(a=Math.max(a,o)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{stintSet:Ih}=Wt,Mh={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Ih(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Ih(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Ih(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&i&&!t.__isTransparentFill&&!(i instanceof Array&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),Ih(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Fh(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:n,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=sh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&rh.shadow(this,t,h),a&&(s.__isStrokes?sh.strokes(n,this,t):sh.stroke(n,this,t)),o&&(s.__isFills?sh.fills(o,this,t):sh.fill(o,this,t)),r&&this.__drawAfterFill(t,e),d&&rh.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?sh.strokes(n,this,t):sh.stroke(n,this,t)),c&&ah.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?sh.strokes(n,this,t):sh.stroke(n,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.__nowWorld;t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,th.string(e.color))}o&&(s.__isFills?sh.fills(o,this,t):sh.fill(o,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?sh.strokes(n,this,t):sh.stroke(n,this,t))}}else s.__pathInputed?Fh(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?sh.fills(s,this,t):sh.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?sh.strokes(o,this,t):sh.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Fh(t,e,i){const{fill:s,stroke:o,__drawAfterFill:n,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&sh.stroke(o,t,e),s&&sh.fill(s,t,e),n&&t.__drawAfterFill(e,i),o&&!r&&sh.stroke(o,t,e)}const Wh={__drawFast(t,e){let{x:i,y:s,width:o,height:n}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,o,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:r,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(r){case"center":t.strokeRect(0,0,o,n);break;case"inside":o-=h,n-=h,o<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,o,n),t.restore()):t.strokeRect(i+l,s+l,o,n);break;case"outside":t.strokeRect(i-l,s-l,o+h,n+h)}}}};var zh,Uh;t.UI=zh=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){a.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return po.set(this.path=t||[]),t||this.__drawPathByBox(po),po}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))}get(t){return"string"==typeof t?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Rt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Rt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(po.set(i=[]),this.__drawPathByBox(po)),t?Bi.toCanvasData(i,!0):i}getPathString(t,e,i){return Bi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||hh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?uo.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&ih.addArrows(this,!t.cornerRadius)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Ss.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,o,"number"==typeof n?[n]:n)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){sh.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return Rt.need("animate")}killAnimate(t,e){}export(t,e){return Rt.need("export")}syncExport(t,e){return Rt.need("export")}clone(t){const e=Wt.clone(this.toJSON());return t&&Object.assign(e,t),zh.one(e)}static one(t,e,i,s,o){return At.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){gn()(this)}static registerData(t){rn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},jt([rn(yh)],t.UI.prototype,"__",void 0),jt([$a()],t.UI.prototype,"zoomLayer",void 0),jt([Io("")],t.UI.prototype,"id",void 0),jt([Io("")],t.UI.prototype,"name",void 0),jt([Io("")],t.UI.prototype,"className",void 0),jt([Ko("pass-through")],t.UI.prototype,"blendMode",void 0),jt([qo(1)],t.UI.prototype,"opacity",void 0),jt([Jo(!0)],t.UI.prototype,"visible",void 0),jt([Ko(!1)],t.UI.prototype,"locked",void 0),jt([Ko(!1)],t.UI.prototype,"dim",void 0),jt([Ko(!1)],t.UI.prototype,"dimskip",void 0),jt([tn(0)],t.UI.prototype,"zIndex",void 0),jt([en(!1)],t.UI.prototype,"mask",void 0),jt([sn(!1)],t.UI.prototype,"eraser",void 0),jt([Mo(0,!0)],t.UI.prototype,"x",void 0),jt([Mo(0,!0)],t.UI.prototype,"y",void 0),jt([Uo(100,!0)],t.UI.prototype,"width",void 0),jt([Uo(100,!0)],t.UI.prototype,"height",void 0),jt([Wo(1,!0)],t.UI.prototype,"scaleX",void 0),jt([Wo(1,!0)],t.UI.prototype,"scaleY",void 0),jt([zo(0,!0)],t.UI.prototype,"rotation",void 0),jt([zo(0,!0)],t.UI.prototype,"skewX",void 0),jt([zo(0,!0)],t.UI.prototype,"skewY",void 0),jt([Mo(0,!0)],t.UI.prototype,"offsetX",void 0),jt([Mo(0,!0)],t.UI.prototype,"offsetY",void 0),jt([Mo(0,!0)],t.UI.prototype,"scrollX",void 0),jt([Mo(0,!0)],t.UI.prototype,"scrollY",void 0),jt([Fo()],t.UI.prototype,"origin",void 0),jt([Fo()],t.UI.prototype,"around",void 0),jt([Io(!1)],t.UI.prototype,"lazy",void 0),jt([Ho(1)],t.UI.prototype,"pixelRatio",void 0),jt([Zo(0)],t.UI.prototype,"renderSpread",void 0),jt([Yo()],t.UI.prototype,"path",void 0),jt([Xo()],t.UI.prototype,"windingRule",void 0),jt([Xo(!0)],t.UI.prototype,"closed",void 0),jt([Uo(0)],t.UI.prototype,"padding",void 0),jt([Uo(!1)],t.UI.prototype,"lockRatio",void 0),jt([Uo()],t.UI.prototype,"widthRange",void 0),jt([Uo()],t.UI.prototype,"heightRange",void 0),jt([Io(!1)],t.UI.prototype,"draggable",void 0),jt([Io()],t.UI.prototype,"dragBounds",void 0),jt([Io(!1)],t.UI.prototype,"editable",void 0),jt([on(!0)],t.UI.prototype,"hittable",void 0),jt([on("path")],t.UI.prototype,"hitFill",void 0),jt([Go("path")],t.UI.prototype,"hitStroke",void 0),jt([on(!1)],t.UI.prototype,"hitBox",void 0),jt([on(!0)],t.UI.prototype,"hitChildren",void 0),jt([on(!0)],t.UI.prototype,"hitSelf",void 0),jt([on()],t.UI.prototype,"hitRadius",void 0),jt([nn("")],t.UI.prototype,"cursor",void 0),jt([Ko()],t.UI.prototype,"fill",void 0),jt([Go(void 0,!0)],t.UI.prototype,"stroke",void 0),jt([Go("inside")],t.UI.prototype,"strokeAlign",void 0),jt([Go(1,!0)],t.UI.prototype,"strokeWidth",void 0),jt([Go(!1)],t.UI.prototype,"strokeWidthFixed",void 0),jt([Go("none")],t.UI.prototype,"strokeCap",void 0),jt([Go("miter")],t.UI.prototype,"strokeJoin",void 0),jt([Go()],t.UI.prototype,"dashPattern",void 0),jt([Go(0)],t.UI.prototype,"dashOffset",void 0),jt([Go(10)],t.UI.prototype,"miterLimit",void 0),jt([Xo(0)],t.UI.prototype,"cornerRadius",void 0),jt([Xo()],t.UI.prototype,"cornerSmoothing",void 0),jt([qa()],t.UI.prototype,"shadow",void 0),jt([qa()],t.UI.prototype,"innerShadow",void 0),jt([qa()],t.UI.prototype,"blur",void 0),jt([qa()],t.UI.prototype,"backgroundBlur",void 0),jt([qa()],t.UI.prototype,"grayscale",void 0),jt([qa()],t.UI.prototype,"filter",void 0),jt([Ko()],t.UI.prototype,"placeholderColor",void 0),jt([Io(100)],t.UI.prototype,"placeholderDelay",void 0),jt([Io({})],t.UI.prototype,"data",void 0),jt([cn(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=zh=jt([_n(Dh),_n(Mh),un()],t.UI),t.Group=class extends t.UI{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,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach((t=>this.add(t))),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map((e=>e.toJSON(t)))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},jt([rn(vh)],t.Group.prototype,"__",void 0),jt([Uo(0)],t.Group.prototype,"width",void 0),jt([Uo(0)],t.Group.prototype,"height",void 0),t.Group=jt([_n(t.Branch),gn()],t.Group);const Hh=bt.get("Leafer");t.Leafer=Uh=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&bo.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Uh.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,Wt.assign(s,t));const o=this.canvas=Ct.canvas(s);this.__controllers.push(this.renderer=Ct.renderer(this,o,s),this.watcher=Ct.watcher(this,s),this.layouter=Ct.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=o.view,e||(this.selector=Ct.selector(this),this.interaction=Ct.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Ct.hitCanvasManager()),this.canvasManager=new Ft,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Nn.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit((()=>{super.set(t,e)}))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(pr.RESTART):this.emitLeafer(pr.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(pr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=Wt.copyAttrs({},t,ie);Object.keys(e).forEach((t=>this[t]=e[t]))}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new yt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=Wt.copyAttrs({},this.canvas,ie);e.resize(t),this.updateLazyBounds(),this.__onResize(new lr(t,i))}__onResize(t){this.emitEvent(t),Wt.copyAttrs(this.__,t,ie),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,e){e||(t.width&&t.height||(this.autoLayout=new vt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ie.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t&&(this.canvas.zIndex=e,setTimeout((()=>this.parent&&this.parent.__updateSortChildren())))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ie.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=Wt.copyAttrs({},this.canvas,ie);i[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(i)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(pr.BEFORE_READY),this.emitLeafer(pr.READY),this.emitLeafer(pr.AFTER_READY),Nn.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(pr.VIEW_READY),Nn.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:n}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(o=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:o,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Nn.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender((()=>{this.imageReady&&(t&&this.emitLeafer(pr.VIEW_COMPLETED),Nn.run(this.__viewCompletedWait),this.viewCompleted=!0)}))}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender((()=>this.interaction.updateCursor()))}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return Rt.need("view")}getValidMove(t,e){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new pr(t,this))}__listenEvents(){const t=St.start("FirstCreate "+this.innerName);this.once([[pr.START,()=>St.end(t)],[cr.START,this.updateLazyBounds,this],[ur.START,this.__onCreated,this],[ur.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[dr.DATA,this.__onWatchData,this],[cr.END,this.__onLayoutEnd,this],[ur.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Uh.list.remove(this);try{this.stop(),this.emitLeafer(pr.END),this.__removeListenEvents(),this.__controllers.forEach((t=>!(this.parent&&t===this.interaction)&&t.destroy())),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout((()=>{ko.clearRecycled()}),100)}catch(t){Hh.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new Ta,jt([rn(xh)],t.Leafer.prototype,"__",void 0),jt([Uo()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=Uh=jt([gn()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}constructor(t){super(t)}},jt([rn(kh)],t.Rect.prototype,"__",void 0),t.Rect=jt([_n(Wh),un(),gn()],t.Rect);const{copy:Nh,add:Yh,includes:Xh}=pt,jh=t.Rect.prototype,Vh=t.Group.prototype,Gh={};t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t;if(this.children.length){const e=this.__,{renderBounds:i,boxBounds:s}=this.__layout;super.__updateRenderBounds(),Nh(Gh,i),this.__updateRectRenderBounds(),(e.scrollY||e.scrollX)&&(Gh.x+=e.scrollX,Gh.y+=e.scrollY),t=!Xh(s,Gh),t&&"hide"!==e.overflow&&Yh(i,Gh)}else this.__updateRectRenderBounds();Wt.stintSet(this,"isOverflow",t),this.__updateScrollBar()}__updateRectRenderBounds(){}__updateScrollBar(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.scrollBar&&this.scrollBar.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},jt([rn(wh)],t.Box.prototype,"__",void 0),jt([Uo(100)],t.Box.prototype,"width",void 0),jt([Uo(100)],t.Box.prototype,"height",void 0),jt([Io(!1)],t.Box.prototype,"resizeChildren",void 0),jt([Zo("show")],t.Box.prototype,"overflow",void 0),jt([cn(jh.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),jt([cn(jh.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),jt([cn(jh.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),jt([cn(jh.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),jt([cn(jh.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),jt([cn(jh.__updateChange)],t.Box.prototype,"__updateRectChange",null),jt([cn(jh.__render)],t.Box.prototype,"__renderRect",null),jt([cn(Vh.__render)],t.Box.prototype,"__renderGroup",null),t.Box=jt([un(),gn()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},jt([rn(bh)],t.Frame.prototype,"__",void 0),jt([Ko("#FFFFFF")],t.Frame.prototype,"fill",void 0),jt([Zo("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=jt([gn()],t.Frame);const{moveTo:Zh,closePath:Kh,ellipse:qh}=Zi;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:i,innerRadius:s,startAngle:o,endAngle:n}=this.__,r=t/2,a=i/2,h=this.__.path=[];s?(o||n?(s<1&&qh(h,r,a,r*s,a*s,0,o,n,!1),qh(h,r,a,r,a,0,n,o,!0),s<1&&Kh(h)):(s<1&&(qh(h,r,a,r*s,a*s),Zh(h,t,a)),qh(h,r,a,r,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):o||n?(Zh(h,r,a),qh(h,r,a,r,a,0,o,n,!1),Kh(h)):qh(h,r,a,r,a)}},jt([rn(Bh)],t.Ellipse.prototype,"__",void 0),jt([Xo(0)],t.Ellipse.prototype,"innerRadius",void 0),jt([Xo(0)],t.Ellipse.prototype,"startAngle",void 0),jt([Xo(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=jt([gn()],t.Ellipse);const{moveTo:Jh,lineTo:$h,drawPoints:Qh}=Zi,{rotate:tl,getAngle:el,getDistance:il,defaultPoint:sl}=O,{toBounds:ol}=oo;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&tl(i,e),i}set toPoint(t){this.width=il(sl,t),this.rotation=el(sl,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Qh(e,t.points,!1,t.closed):(Jh(e,0,0),$h(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Qh(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&ih.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?ol(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},jt([rn(Eh)],t.Line.prototype,"__",void 0),jt([jo("center")],t.Line.prototype,"strokeAlign",void 0),jt([Uo(0)],t.Line.prototype,"height",void 0),jt([Xo()],t.Line.prototype,"points",void 0),jt([Xo(0)],t.Line.prototype,"curve",void 0),jt([Xo(!1)],t.Line.prototype,"closed",void 0),t.Line=jt([gn()],t.Line);const{sin:nl,cos:rl,PI:al}=Math,{moveTo:hl,lineTo:ll,closePath:dl,drawPoints:cl}=Zi,ul=t.Line.prototype;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)cl(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,o=e/2,n=i/2;hl(t,o,0);for(let e=1;e<s;e++)ll(t,o+o*nl(2*e*al/s),n-n*rl(2*e*al/s));dl(t)}}__updateRenderPath(){}__updateBoxBounds(){}},jt([rn(Sh)],t.Polygon.prototype,"__",void 0),jt([Xo(3)],t.Polygon.prototype,"sides",void 0),jt([Xo()],t.Polygon.prototype,"points",void 0),jt([Xo(0)],t.Polygon.prototype,"curve",void 0),jt([cn(ul.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),jt([cn(ul.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=jt([un(),gn()],t.Polygon);const{sin:pl,cos:_l,PI:gl}=Math,{moveTo:fl,lineTo:yl,closePath:ml}=Zi;t.Star=class extends t.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,n=e/2,r=this.__.path=[];fl(r,o,0);for(let t=1;t<2*i;t++)yl(r,o+(t%2==0?o:o*s)*pl(t*gl/i),n-(t%2==0?n:n*s)*_l(t*gl/i));ml(r)}},jt([rn(Th)],t.Star.prototype,"__",void 0),jt([Xo(5)],t.Star.prototype,"corners",void 0),jt([Xo(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=jt([gn()],t.Star),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return t instanceof Array&&t[0].image}constructor(t){super(t)}},jt([rn(Ah)],t.Image.prototype,"__",void 0),jt([Uo("")],t.Image.prototype,"url",void 0),t.Image=jt([gn()],t.Image);const vl=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Ct.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Po({url:t}).load((t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new ir(ir.LOADED,{image:t}))}))}draw(t,e,i,s){const o=new U(t.worldTransform).invert(),n=new U;e&&n.translate(e.x,e.y),i&&("number"==typeof i?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),o.multiplyParent(n),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},jt([rn(Oh)],t.Canvas.prototype,"__",void 0),jt([Ja(100)],t.Canvas.prototype,"width",void 0),jt([Ja(100)],t.Canvas.prototype,"height",void 0),jt([Ja(1)],t.Canvas.prototype,"pixelRatio",void 0),jt([Ja(!0)],t.Canvas.prototype,"smooth",void 0),jt([Io(!1)],t.Canvas.prototype,"safeResize",void 0),jt([Ja()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=jt([gn()],t.Canvas);const{copyAndSpread:wl,includes:xl,spread:bl,setList:El}=pt;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:n,italic:r,textCase:h,textOverflow:l,padding:d}=t;t.__lineHeight=eh.number(e,o),t.__letterSpacing=eh.number(i,o),t.__padding=d?a.fourNumber(d):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${r?"italic ":""}${"small-caps"===h?"small-caps ":""}${"normal"!==n?n+" ":""}${o}px ${s}`,t.__clipText="show"!==l&&!t.__autoSize,t.__textDrawData=Qa.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:n,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&bl(a,i/2),n||r){if(h.x=n?a.x:0,h.y=r?a.y:0,h.width=n?a.width:t.width,h.height=r?a.height:t.height,o){const[e,i,s,o]=t.__padding;n&&(h.x-=o,h.width+=i+o),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),Wt.stintSet(this,"isOverflow",!xl(h,a)),this.isOverflow?(El(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;wl(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},jt([rn(Lh)],t.Text.prototype,"__",void 0),jt([Uo(0)],t.Text.prototype,"width",void 0),jt([Uo(0)],t.Text.prototype,"height",void 0),jt([Ko()],t.Text.prototype,"boxStyle",void 0),jt([Io(!1)],t.Text.prototype,"resizeFontSize",void 0),jt([Ko("#000000")],t.Text.prototype,"fill",void 0),jt([jo("outside")],t.Text.prototype,"strokeAlign",void 0),jt([on("all")],t.Text.prototype,"hitFill",void 0),jt([Uo("")],t.Text.prototype,"text",void 0),jt([Uo("")],t.Text.prototype,"placeholder",void 0),jt([Uo("caption")],t.Text.prototype,"fontFamily",void 0),jt([Uo(12)],t.Text.prototype,"fontSize",void 0),jt([Uo("normal")],t.Text.prototype,"fontWeight",void 0),jt([Uo(!1)],t.Text.prototype,"italic",void 0),jt([Uo("none")],t.Text.prototype,"textCase",void 0),jt([Uo("none")],t.Text.prototype,"textDecoration",void 0),jt([Uo(0)],t.Text.prototype,"letterSpacing",void 0),jt([Uo({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),jt([Uo(0)],t.Text.prototype,"paraIndent",void 0),jt([Uo(0)],t.Text.prototype,"paraSpacing",void 0),jt([Uo("x")],t.Text.prototype,"writingMode",void 0),jt([Uo("left")],t.Text.prototype,"textAlign",void 0),jt([Uo("top")],t.Text.prototype,"verticalAlign",void 0),jt([Uo(!0)],t.Text.prototype,"autoSizeAlign",void 0),jt([Uo("normal")],t.Text.prototype,"textWrap",void 0),jt([Uo("show")],t.Text.prototype,"textOverflow",void 0),jt([Ko(!1)],t.Text.prototype,"textEditing",void 0),t.Text=jt([gn()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}constructor(t){super(t)}},jt([rn(Ph)],t.Path.prototype,"__",void 0),jt([jo("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=jt([gn()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,n,r,a){return this}arc(t,e,i,s,o,n){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,n,r,a){return this}drawArc(t,e,i,s,o,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},jt([rn(Rh)],t.Pen.prototype,"__",void 0),jt([(t,e)=>{Ro(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=jt([_n(cs,["set","path","paint"]),gn()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:o}=t;e&&(this.ground=this.addLeafer(e)),(i||o)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||o)&&(this.sky=this.addLeafer(s)),o&&Ct.editor(o,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach((t=>t.updateLayout())),super.__updateLocalBounds()}start(){super.start(),this.forEach((t=>t.start()))}stop(){this.forEach((t=>t.stop())),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach((t=>t.unlockLayout()))}lockLayout(){super.lockLayout(),this.forEach((t=>t.lockLayout()))}forceRender(t,e){this.forEach((i=>i.forceRender(t,e)))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout((()=>this.add(t,e)),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),void 0!==e&&(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every((t=>t.created))}__onReady(){this.children.every((t=>t.ready))&&super.__onReady()}__onViewReady(){this.children.every((t=>t.viewReady))&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach((i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e&&e.bounds)))}__onResize(t){this.forEach((e=>e.resize(t))),super.__onResize(t)}updateLayout(){this.forEach((t=>t.updateLayout()))}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&Wt.assign(e,t),this.autoLayout&&Wt.copyAttrs(e,this,ie),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[cr.END,this.__onReady,this],[ur.START,this.__onCreated,this],[ur.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(ur.END,this.__onChildRenderEnd,this))}},t.App=jt([gn()],t.App);const kl={},Bl={isHoldSpaceKey:()=>Bl.isHold("Space"),isHold:t=>kl[t],setDownCode(t){kl[t]||(kl[t]=!0)},setUpCode(t){kl[t]=!1}},Sl={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class Tl extends Qn{get spaceKey(){return Bl.isHoldSpaceKey()}get left(){return Sl.left(this)}get right(){return Sl.right(this)}get middle(){return Sl.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){It.changeName(t,e)}}t.PointerEvent=class extends Tl{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=jt([fn()],t.PointerEvent);const Pl=t.PointerEvent,Rl={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof Ta?t:new Ta(t)}static setData(t){this.data=t}static getValidMove(t,e,i){const{draggable:s,dragBounds:o}=t,n=t.getLocalPoint(i,null,!0);return O.move(n,e.x-t.x,e.y-t.y),o&&this.getMoveInDragBounds(t.__localBoxBounds,"parent"===o?t.parent.boxBounds:o,n,!0),"x"===s&&(n.y=0),"y"===s&&(n.x=0),n}static getMoveInDragBounds(t,e,i,s){const o=t.x+i.x,n=t.y+i.y,r=o+t.width,a=n+t.height,h=e.x+e.width,l=e.y+e.height;return s||(i=Object.assign({},i)),pt.includes(t,e)?(o>e.x?i.x+=e.x-o:r<h&&(i.x+=h-r),n>e.y?i.y+=e.y-n:a<l&&(i.y+=l-a)):(o<e.x?i.x+=e.x-o:r>h&&(i.x+=h-r),n<e.y?i.y+=e.y-n:a>l&&(i.y+=l-a)),i}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Rl,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Rl,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Rl,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return pt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),pt.unsign(i),i}assignMove(t){Rl.x=t?this.totalX:this.moveX,Rl.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=jt([fn()],t.DragEvent);const Cl=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=jt([fn()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=jt([fn()],t.MoveEvent),t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=jt([fn()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=jt([fn()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=jt([fn()],t.ZoomEvent),t.KeyEvent=class extends Tl{},t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=jt([fn()],t.KeyEvent);const Ll={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Al.getSwipeDirection(O.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new Ta,{list:s}=t;for(let t=0,o=s.length;t<o;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some((e=>e.draggable||e.editable||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},Al=Ll,Ol=new Ta,{getDragEventData:Dl,getDropEventData:Il,getSwipeEventData:Ml}=Ll;class Fl{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Dl(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,o=s&&s.list.length,n=t.DragEvent.list||this.draggableList||Ol;return this.dragging&&(o?e?Ol:new Ta(i?[...s.list,...s.dragHoverExclude]:s.list):n)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&Sl.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach((t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y}))}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],(e.draggable||e.editable)&&e.hitSelf&&!e.locked){this.draggableList=new Ta(e);break}}drag(e){const{interaction:i,dragData:s,downData:o}=this,{path:n,throughPath:r}=o;this.dragData=Dl(o,s,e),r&&(this.dragData.throughPath=r),this.dragData.path=n,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(){const{running:e}=this.interaction,i=this.realDraggableList;if(i.length&&e){const{totalX:e,totalY:s}=this.dragData;i.forEach((i=>i.draggable&&i.move(t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:e,y:s}))))}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:o}=e;this.dragOverPath=o,s?o.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,o)):i.emit(t.DragEvent.OVER,e,o)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:o}=e;i.emit(t.DragEvent.LEAVE,e,s,o),i.emit(t.DragEvent.ENTER,e,o,s),this.dragEnterPath=o}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:o}=this;e||(e=o);const{path:n,throughPath:r}=s,a=Dl(s,e,e);if(r&&(a.throughPath=r),a.path=n,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const n=this.getList();this.dragging=!1,i.emit(t.DragEvent.END,a),this.swipe(e,s,o,a),this.drop(e,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:o}=this;if(O.getDistance(e,t)>o.config.pointer.swipeDistance){const t=Ml(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const o=Il(e,i,t.DragEvent.data);o.path=s,this.interaction.emit(t.DropEvent.DROP,o),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Wl=bt.get("emit");const zl=["move","zoom","rotate","key"];function Ul(t,e,i,s,o){if(zl.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Nl(t,o)){let n;for(let r=0,a=t.children.length;r<a;r++)n=t.children[r],!i.path.has(n)&&n.__.hittable&&Hl(n,e,i,s,o)}}function Hl(t,e,i,s,o){if(t.destroyed)return!1;if(t.__.hitSelf&&!Nl(t,o)&&(lh.updateEventStyle&&!s&&lh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const o=It.get(e,i);if(t.emitEvent(o,s),o.isStop)return!0}return!1}function Nl(t,e){return e&&e.has(t)}const Yl={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Xl,pathCanDrag:jl,pathHasOutside:Vl}=Ll;class Gl{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&Sl.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Sl.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Bl.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=Wt.clone(Yl),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Ta(t),this.createTransformer(),this.dragger=new Fl(this),s&&(this.config=Wt.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(Sl.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),Sl.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=Sl.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Sl.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=O.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;Sl.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,Bl.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;const{code:i}=e;this.downKeyMap[i]=!1,Bl.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Ta),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach((t=>i.add(t))));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const o=Date.now()-this.downTime,n=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some((t=>Xl(e.path,t)));o<i.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}),i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,i){const{hitRadius:s,through:o}=this.p,{bottomList:n,target:r}=this;e.backgrounder||t.origin||r&&r.updateLayout();const a=this.selector.getByPoint(t,s,Object.assign({bottomList:n,name:t.type},i||{through:o}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Vl(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!jl(t.path))&&!Vl(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,o=s.length;t<o&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y};return this.p.snap&&O.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)}),this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Xl(e.path,t.PointerEvent.LONG_TAP)||Xl(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new yt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-("number"==typeof t?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(lr.RESIZE,this.__onResize,this)],t.once(pr.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let o;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(o=i.list[n],Hl(o,t,e,!0,s))return;o.isApp&&Ul(o,t,e,!0,s)}for(let n=0,r=i.length;n<r;n++)if(o=i.list[n],o.isApp&&Ul(o,t,e,!1,s),Hl(o,t,e,!1,s))return}catch(t){Wl.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class Zl{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Zl.custom={};class Kl extends Ft{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Ta,this.pixelList=new Ta}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),Ct.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),Ct.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}const{toInnerRadiusPointOf:ql,copy:Jl,setRadius:$l}=O,Ql={},td=t.Leaf.prototype;td.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,o=i.width<10&&i.height<10;if(e.hitRadius&&(Jl(Ql,t),$l(t=Ql,e.hitRadius)),ql(t,i,Ql),e.hitBox||o){if(pt.hitRadiusPoint(s.boxBounds,Ql))return!0;if(o)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Ql)},td.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},td.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},td.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},td.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const ed=new U,id=t.UI.prototype;id.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const t=this.leafer||this.parent&&this.parent.leafer;if(!t)return;const i=this.__,{hitCanvasManager:s}=t,o=(i.__isAlphaPixelFill||i.__isCanvas)&&"pixel"===i.hitFill,n=i.__isAlphaPixelStroke&&"pixel"===i.hitStroke,r=o||n;this.__hitCanvas||(this.__hitCanvas=r?s.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):s.getPathType(this));const a=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,s=e.image.hitCanvasSize,r=a.hitScale=mt.set(0,0,s,s).getFitMatrix(t).a,{x:h,y:l,width:d,height:c}=mt.set(t).scale(r);a.resize({width:d,height:c,pixelRatio:1}),a.clear(),ko.patternLocked=!0,this.__renderShape(a,{matrix:ed.setWith(this.__world).scaleWith(1/r).invertWith().translate(-h,-l),ignoreFill:!o,ignoreStroke:!n}),ko.patternLocked=!1,a.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(a),a.setStrokeOptions(i)},id.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:o,__maxStrokeWidth:n}=e,r=e.stroke&&("path"===o||"pixel"===o&&!e.__isAlphaPixelStroke)||"all"===o;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const sd=t.UI.prototype,od=t.Rect.prototype,nd=t.Box.prototype;od.__updateHitCanvas=nd.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?sd.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},od.__hitFill=nd.__hitFill=function(t){return this.__hitCanvas?sd.__hitFill.call(this,t):pt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:o,__textDrawData:n}=this.__;t.beginPath(),o<0?this.__drawPathByBox(t):n.rows.forEach((o=>t.rect(o.x,o.y-s,o.width,e<i?i:e)))},t.Group.prototype.pick=function(t,i){return i||(i=Nt),this.updateLayout(),function(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Ct.selector())}(this).getByPoint(t,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const rd=se.prototype;function ad(t,e){const i=t.__,{rows:s,decorationY:o}=i.__textDrawData;let n;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)n=s[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.fillText(t.char,t.x,n.y)}));if(o){const{decorationColor:t,decorationHeight:n}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach((t=>o.forEach((i=>e.fillRect(t.x,t.y+i,t.width,n)))))}}function hd(t,e){t.__.__font?ad(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function ld(t,e,i){switch(e.__.strokeAlign){case"center":dd(t,1,e,i);break;case"inside":cd(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?dd(t,2,e,i):cd(t,"outside",e,i)}}function dd(t,e,i,s){const o=i.__;"object"==typeof t?pd(t,e,!0,i,s):(s.setStroke(t,o.__strokeWidth*e,o),ud(i,s))}function cd(t,e,i,s){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,dd(t,2,i,o),o.blendMode="outside"===e?"destination-out":"destination-in",ad(i,o),o.blendMode="normal",Pn.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}function ud(t,e){let i,s=t.__.__textDrawData;const{rows:o,decorationY:n}=s;for(let t=0,s=o.length;t<s;t++)i=o[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)}));if(n){const{decorationHeight:t}=s;o.forEach((i=>n.forEach((s=>e.strokeRect(i.x,i.y+s,i.width,t)))))}}function pd(t,e,i,s,o){let n;const r=s.__,{__hasMultiStrokeStyle:a}=r;a||o.setStroke(void 0,r.__strokeWidth*e,r);for(let h=0,l=t.length;h<l;h++)if(n=t[h],(!n.image||!oh.checkImage(s,o,n,!1))&&n.style){if(a){const{strokeStyle:t}=n;t?o.setStroke(n.style,r.__getRealStrokeWidth(t)*e,r,t):o.setStroke(n.style,r.__strokeWidth*e,r)}else o.strokeStyle=n.style;n.blendMode?(o.saveBlendMode(n.blendMode),i?ud(s,o):o.stroke(),o.restoreBlendMode()):i?ud(s,o):o.stroke()}}function _d(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)ld(t,e,i);else switch(s.strokeAlign){case"center":gd(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),gd(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)gd(t,2,e,i);else{const{renderBounds:o}=e.__layout,n=i.getSameCanvas(!0,!0);e.__drawRenderPath(n),gd(t,2,e,n),n.clipUI(s),n.clearWorld(o),Pn.copyCanvasByWorld(e,i,n),n.recycle(e.__nowWorld)}}(t,e,i)}}function gd(t,e,i,s){const o=i.__;"object"==typeof t?pd(t,e,!1,i,s):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&sh.strokeArrow(t,i,s)}rd.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},rd.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},rd.hitPixel=function(t,e,i=1){let{x:s,y:o,radiusX:n,radiusY:r}=t;e&&(s-=e.x,o-=e.y),mt.set(s-n,o-r,2*n,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(mt.x,mt.y,mt.width||1,mt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:fd,getOuterOf:yd,getByMove:md,getIntersectData:vd}=pt;let wd;const{stintSet:xd}=Wt,{hasTransparent:bd}=th;function Ed(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:o}=i.__layout;switch(e.type){case"image":s=oh.image(i,t,e,o,!wd||!wd[e.url]);break;case"linear":s=nh.linearGradient(e,o);break;case"radial":s=nh.radialGradient(e,o);break;case"angular":s=nh.conicGradient(e,o);break;case"solid":const{type:n,color:r,opacity:a}=e;s={type:n,style:th.string(r,a)};break;default:void 0!==e.r&&(s={type:"solid",style:th.string(e)})}if(s){if("string"==typeof s.style&&bd(s.style)&&(s.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}e.blendMode&&(s.blendMode=e.blendMode)}return s}const kd={compute:function(t,e){const i=e.__,s=[];let o,n,r,a=i.__input[t];a instanceof Array||(a=[a]),wd=oh.recycleImage(t,i);for(let i,o=0,n=a.length;o<n;o++)(i=Ed(t,a[o],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every((t=>t.isTransparent))&&(s.some((t=>t.image))&&(o=!0),n=!0),"fill"===t?(xd(i,"__isAlphaPixelFill",o),xd(i,"__isTransparentFill",n)):(xd(i,"__isAlphaPixelStroke",o),xd(i,"__isTransparentStroke",n),xd(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,hd(e,i)},fills:function(t,e,i){let s;for(let o=0,n=t.length;o<n;o++){if(s=t[o],s.image){if(oh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!o&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);i.scale(1/t,1/s)}s.blendMode&&(i.blendMode=s.blendMode),hd(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),hd(e,i),i.restoreBlendMode()):hd(e,i)}},fillPathOrText:hd,fillText:ad,stroke:_d,strokes:function(t,e,i){_d(t,e,i)},strokeText:ld,drawTextStroke:ud,shape:function(t,e,i){const s=e.getSameCanvas(),o=t.__nowWorld;let n,r,a,h,{scaleX:l,scaleY:d}=o;if(l<0&&(l=-l),d<0&&(d=-d),e.bounds.includes(o))h=s,n=a=o;else{const{renderShapeSpread:s}=t.__layout,c=vd(s?fd(e.bounds,l===d?s*l:[s*d,s*l]):e.bounds,o);r=e.bounds.getFitMatrix(c);let{a:u,d:p}=r;if(r.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,d*=p),a=yd(o,r),n=md(a,-r.e,-r.f),i.matrix){const{matrix:t}=i;r.multiply(t),u*=t.scaleX,p*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:r.withScale(u,p)})}return t.__renderShape(s,i),{canvas:s,matrix:r,bounds:n,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:d}}};let Bd={},Sd={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Td,rotateOfOuter:Pd,translate:Rd,scaleOfOuter:Cd,multiplyParent:Ld,scale:Ad,rotate:Od,skew:Dd}=b;function Id(t,e,i,s,o,n,r){const a=Td();Rd(a,e.x+i,e.y+s),Ad(a,o,n),r&&Pd(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function Md(t,e,i,s,o,n,r,a,h){const l=Td();r&&Od(l,r),a&&Dd(l,a.x,a.y),o&&Ad(l,o,n),Rd(l,e.x+i,e.y+s),h&&(Sd.a=e.width/h.width,Sd.d=e.height/h.height,Ld(l,Sd)),t.transform=l}function Fd(t,e,i,s,o,n,r,a,h,l){const d=Td();if(h)if("center"===l)Pd(d,{x:i/2,y:s/2},h);else switch(Od(d,h),h){case 90:Rd(d,s,0);break;case 180:Rd(d,i,s);break;case 270:Rd(d,0,i)}Bd.x=e.x+o,Bd.y=e.y+n,Rd(d,Bd.x,Bd.y),r&&Cd(d,Bd,r,a),t.transform=d}const{get:Wd,translate:zd}=b,Ud=new yt,Hd={},Nd={};function Yd(t,e,i,s){const{changeful:o,sync:n,editing:r,scaleFixed:a}=i;o&&(t.changeful=o),n&&(t.sync=n),r&&(t.editing=r),a&&(t.scaleFixed=a),t.data=Xd(i,s,e)}function Xd(t,e,i){t.padding&&(e=Ud.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:o}=i;const{opacity:n,mode:r,align:h,offset:l,scale:d,size:c,rotation:u,skew:p,clipSize:_,repeat:g,filters:f}=t,y=e.width===s&&e.height===o,m={mode:r},v="center"!==h&&(u||0)%180==90;let w,x;switch(pt.set(Nd,0,0,v?o:s,v?s:o),r&&"cover"!==r&&"fit"!==r?((d||c)&&(a.getScaleData(d,c,i,Hd),w=Hd.scaleX,x=Hd.scaleY),h&&(w&&pt.scale(Nd,w,x,!0),q.toPoint(h,Nd,e,Nd,!0,!0))):y&&!u||(w=x=pt.getFitScale(e,Nd,"fit"!==r),pt.put(e,i,h,w,!1,Nd),pt.scale(Nd,w,x,!0)),l&&O.move(Nd,l),r){case"stretch":y||(s=e.width,o=e.height);break;case"normal":case"clip":(Nd.x||Nd.y||w||_||u||p)&&Md(m,e,Nd.x,Nd.y,w,x,u,p,t.clipSize);break;case"repeat":(!y||w||u)&&Fd(m,e,s,o,Nd.x,Nd.y,w,x,u,h),g||(m.repeat="repeat");break;default:w&&Id(m,e,Nd.x,Nd.y,w,x,u)}return m.transform||(e.x||e.y)&&(m.transform=Wd(),zd(m.transform,e.x,e.y)),w&&"stretch"!==r&&(m.scaleX=w,m.scaleY=x),m.width=s,m.height=o,n&&(m.opacity=n),f&&(m.filters=f),g&&(m.repeat="string"==typeof g?"x"===g?"repeat-x":"repeat-y":"repeat"),m}let jd,Vd=new yt;const{isSame:Gd}=pt;function Zd(t,e,i,s,o,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return o.data||Yd(o,s,i,n),!0}function Kd(t,e){$d(t,ir.LOAD,e)}function qd(t,e){$d(t,ir.LOADED,e)}function Jd(t,e,i){e.error=i,t.forceUpdate("surface"),$d(t,ir.ERROR,e)}function $d(t,e,i){t.hasEvent(e)&&t.emitEvent(new ir(e,i))}function Qd(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:tc,scale:ec,copy:ic}=b,{ceil:sc,abs:oc}=Math;function nc(t,i,s){let{scaleX:o,scaleY:n}=t.getRenderScaleData(!0,i.scaleFixed);const r=o+"-"+n+"-"+s;if(i.patternId===r||t.destroyed)return!1;{const{image:t,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:p,transform:_,repeat:g}=a;u&&(u=oc(u),p=oc(p),l=tc(),ic(l,_),ec(l,1/u,1/p),o*=u,n*=p),o*=s,n*=s,d*=o,c*=n;const f=d*c;if(!g&&f>e.image.maxCacheSize)return!1;let y=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;y>e&&(y=e)}f>y&&(h=Math.sqrt(f/y)),h&&(o/=h,n/=h,d/=h,c/=h),u&&(o/=u,n/=p),(_||1!==o||1!==n)&&(l||(l=tc(),_&&ic(l,_)),ec(l,1/o,1/n));const m=t.getCanvas(sc(d)||1,sc(c)||1,a.opacity,a.filters),v=t.getPattern(m,g||e.origin.noRepeat||"no-repeat",l,i);return i.style=v,i.patternId=r,!0}}const rc={image:function(t,e,i,s,o){let n,r;const a=ko.get(i);return jd&&i===jd.paint&&Gd(s,jd.boxBounds)?n=jd.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),jd=a.use>1?{leafPaint:n,paint:i,boxBounds:Vd.set(s)}:null),(o||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(Zd(t,e,i,a,n,s),o&&(Kd(t,r),qd(t,r))):a.error?o&&Jd(t,r,a.error):(o&&(Qd(t,!0),Kd(t,r)),n.loadId=a.load((()=>{Qd(t,!1),t.destroyed||(Zd(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),qd(t,r)),n.loadId=void 0}),(e=>{Qd(t,!1),Jd(t,r,e),n.loadId=void 0})),t.placeholderColor&&(t.placeholderDelay?setTimeout((()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))}),t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(t,i,s,o){const{scaleX:n,scaleY:r}=t.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===n+"-"+r+"-"+a&&!hh.running)return!1;if(o)if(h.repeat)o=!1;else if(!(s.changeful||lr.isResizing(t)||hh.running)){let{width:t,height:i}=h;t*=n*a,i*=r*a,h.scaleX&&(t*=h.scaleX,i*=h.scaleY),o=t*i>e.image.maxCacheSize}return o?(t.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(t,i,s,h),!0):(!s.style||s.sync||hh.running?nc(t,s,a):s.patternTask||(s.patternTask=ko.patternTasker.add((()=>Vt(this,void 0,void 0,(function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&nc(t,s,a),t.forceUpdate("surface")}))),300)),!1)},createPattern:nc,recycleImage:function(t,e){const i=e["_"+t];if(i instanceof Array){let s,o,n,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],o=s.image,a=o&&o.url,a&&(n||(n={}),n[a]=!0,ko.recycle(o),o.loading&&(r||(r=e.__input&&e.__input[t]||[],r instanceof Array||(r=[r])),o.unload(i[h].loadId,!r.some((t=>t.url===a)))));return n}return null},createData:Yd,getPatternData:Xd,fillOrFitMode:Id,clipMode:Md,repeatMode:Fd},{toPoint:ac}=G,{hasTransparent:hc}=th,lc={},dc={};function cc(t,e,i,s){if(i){let o,n,r,a;for(let t=0,h=i.length;t<h;t++)o=i[t],"string"==typeof o?(r=t/(h-1),n=th.string(o,s)):(r=o.offset,n=th.string(o.color,s)),e.addColorStop(r,n),!a&&hc(n)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:uc,getDistance:pc}=O,{get:_c,rotateOfOuter:gc,scaleOfOuter:fc}=b,{toPoint:yc}=G,mc={},vc={};function wc(t,e,i,s,o){let n;const{width:r,height:a}=t;if(r!==a||s){const t=uc(e,i);n=_c(),o?(fc(n,e,r/a*(s||1),1),gc(n,e,t+90)):(fc(n,e,1,r/a*(s||1)),gc(n,e,t))}return n}const{getDistance:xc}=O,{toPoint:bc}=G,Ec={},kc={};const Bc={linearGradient:function(t,i){let{from:s,to:o,type:n,opacity:r}=t;ac(s||"top",i,lc),ac(o||"bottom",i,dc);const a=e.canvas.createLinearGradient(lc.x,lc.y,dc.x,dc.y),h={type:n,style:a};return cc(h,a,t.stops,r),h},radialGradient:function(t,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=t;yc(s||"center",i,mc),yc(o||"bottom",i,vc);const h=e.canvas.createRadialGradient(mc.x,mc.y,0,mc.x,mc.y,pc(mc,vc)),l={type:n,style:h};cc(l,h,t.stops,r);const d=wc(i,mc,vc,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=t;bc(s||"center",i,Ec),bc(o||"bottom",i,kc);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,Ec.x,Ec.y):e.canvas.createRadialGradient(Ec.x,Ec.y,0,Ec.x,Ec.y,xc(Ec,kc)),l={type:n,style:h};cc(l,h,t.stops,r);const d=wc(i,Ec,kc,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:wc},{copy:Sc,toOffsetOutBounds:Tc}=pt,Pc={},Rc={};function Cc(t,i,s,o){const{bounds:n,shapeBounds:r}=o;if(e.fullImageShadow){if(Sc(Pc,t.bounds),Pc.x+=i.x-r.x,Pc.y+=i.y-r.y,s){const{matrix:t}=o;Pc.x-=(n.x+(t?t.e:0)+n.width/2)*(s-1),Pc.y-=(n.y+(t?t.f:0)+n.height/2)*(s-1),Pc.width*=s,Pc.height*=s}t.copyWorld(o.canvas,t.bounds,Pc)}else s&&(Sc(Pc,i),Pc.x-=i.width/2*(s-1),Pc.y-=i.height/2*(s-1),Pc.width*=s,Pc.height*=s),t.copyWorld(o.canvas,r,s?Pc:i)}const{toOffsetOutBounds:Lc}=pt,Ac={};const Oc={shadow:function(t,e,i){let s,o;const{__nowWorld:n,__layout:r}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=a.length-1;Tc(l,Rc),a.forEach(((a,g)=>{p.setWorldShadow(Rc.offsetX+a.x*c,Rc.offsetY+a.y*u,a.blur*c,th.string(a.color)),o=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,Cc(p,Rc,o,i),s=l,a.box&&(p.restore(),p.save(),h&&(p.copyWorld(p,l,n,"copy"),s=n),h?p.copyWorld(h,n,n,"destination-out"):p.copyWorld(i.canvas,d,l,"destination-out")),Pn.copyCanvasByWorld(t,e,p,s,a.blendMode),_&&g<_&&p.clearWorld(s,!0)})),p.recycle(s)},innerShadow:function(t,e,i){let s,o;const{__nowWorld:n,__layout:r}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=a.length-1;Lc(l,Ac),a.forEach(((a,g)=>{p.save(),p.setWorldShadow(Ac.offsetX+a.x*c,Ac.offsetY+a.y*u,a.blur*c),o=a.spread?1-2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,Cc(p,Ac,o,i),p.restore(),h?(p.copyWorld(p,l,n,"copy"),p.copyWorld(h,n,n,"source-out"),s=n):(p.copyWorld(i.canvas,d,l,"source-out"),s=l),p.fillWorld(s,th.string(a.color),"source-in"),Pn.copyCanvasByWorld(t,e,p,s,a.blendMode),_&&g<_&&p.clearWorld(s,!0)})),p.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:Dc}=Mn;function Ic(t,e,i,s,o,n){switch(e){case"grayscale":o.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,s){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),s.recycle(o),Fc(t,e,i,1)}(t,i,s,o);break;case"opacity-path":Fc(t,i,s,n);break;case"path":i.restore()}}function Mc(t){return t.getSameCanvas(!1,!0)}function Fc(t,e,i,s){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o),i.recycle(o)}t.Group.prototype.__renderMask=function(t,e){let i,s,o,n,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++)i=h[l],a=i.__.mask,a?(r&&(Ic(this,r,t,o,s,n),s=o=null),"path"===a||"clipping-path"===a?(i.opacity<1?(r="opacity-path",n=i.opacity,o||(o=Mc(t))):(r="path",t.save()),i.__clip(o||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=Mc(t)),o||(o=Mc(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a||Dc(i,e)||i.__render(t,e)):Dc(i,e)||i.__render(o||t,e);Ic(this,r,t,o,s,n)};const Wc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",zc=Wc+"_#~&*+\\=|≮≯≈≠=…",Uc=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 Hc(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Nc=Hc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Yc=Hc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Xc=Hc(Wc),jc=Hc(zc),Vc=Hc("- —/~|┆·");var Gc;!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"}(Gc||(Gc={}));const{Letter:Zc,Single:Kc,Before:qc,After:Jc,Symbol:$c,Break:Qc}=Gc;function tu(t){return Nc[t]?Zc:Vc[t]?Qc:Yc[t]?qc:Xc[t]?Jc:jc[t]?$c:Uc.test(t)?Kc:Zc}const eu={trimRight(t){const{words:e}=t;let i,s=0,o=e.length;for(let n=o-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(o-s,s)}};function iu(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:su}=eu,{Letter:ou,Single:nu,Before:ru,After:au,Symbol:hu,Break:lu}=Gc;let du,cu,uu,pu,_u,gu,fu,yu,mu,vu,wu,xu,bu,Eu,ku,Bu,Su,Tu=[];function Pu(t,e){mu&&!yu&&(yu=mu),du.data.push({char:t,width:e}),uu+=e}function Ru(){pu+=uu,du.width=uu,cu.words.push(du),du={data:[]},uu=0}function Cu(){Eu&&(ku.paraNumber++,cu.paraStart=!0,Eu=!1),mu&&(cu.startCharSize=yu,cu.endCharSize=mu,yu=0),cu.width=pu,Bu.width?su(cu):Su&&Lu(),Tu.push(cu),cu={words:[]},pu=0}function Lu(){pu>(ku.maxWidth||0)&&(ku.maxWidth=pu)}const{top:Au,right:Ou,bottom:Du,left:Iu}=t.Direction4;function Mu(t,e,i){const{bounds:s,rows:o}=t;s[e]+=i;for(let t=0;t<o.length;t++)o[t][e]+=i}const Fu={getDrawData:function(t,i){"string"!=typeof t&&(t=String(t));let s=0,o=0,n=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:a,__font:h,__padding:l}=i;l&&(n?(s=l[Iu],n-=l[Ou]+l[Iu]):i.autoSizeAlign||(s=l[Iu]),r?(o=l[Au],r-=l[Au]+l[Du]):i.autoSizeAlign||(o=l[Au]));const d={bounds:{x:s,y:o,width:n,height:r},rows:[],paraNumber:0,font:e.canvas.font=h};return function(t,i,s){ku=t,Tu=t.rows,Bu=t.bounds,Su=!Bu.width&&!s.autoSizeAlign;const{__letterSpacing:o,paraIndent:n,textCase:r}=s,{canvas:a}=e,{width:h,height:l}=Bu;if(h||l||o||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;Eu=!0,wu=null,yu=fu=mu=uu=pu=0,du={data:[]},cu={words:[]},o&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)gu=i[s],"\n"===gu?(uu&&Ru(),cu.paraEnd=!0,Cu(),Eu=!0):(vu=tu(gu),vu===ou&&"none"!==r&&(gu=iu(gu,r,!uu)),fu=a.measureText(gu).width,o&&(o<0&&(mu=fu),fu+=o),xu=vu===nu&&(wu===nu||wu===ou)||wu===nu&&vu!==au,bu=!(vu!==ru&&vu!==nu||wu!==hu&&wu!==au),_u=Eu&&n?h-n:h,t&&h&&pu+uu+fu>_u&&(e?(uu&&Ru(),pu&&Cu()):(bu||(bu=vu===ou&&wu==au),xu||bu||vu===lu||vu===ru||vu===nu||uu+fu>_u?(uu&&Ru(),pu&&Cu()):pu&&Cu()))," "===gu&&!0!==Eu&&pu+uu===0||(vu===lu?(" "===gu&&uu&&Ru(),Pu(gu,fu),Ru()):xu||bu?(uu&&Ru(),Pu(gu,fu)):Pu(gu,fu)),wu=vu);uu&&Ru(),pu&&Cu(),Tu.length>0&&(Tu[Tu.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{ku.paraNumber++,pu=a.measureText(t).width,Tu.push({x:n||0,text:t,width:pu,paraStart:!0}),Su&&Lu()}))}(d,t,i),l&&function(t,e,i,s,o){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Mu(e,"x",t[Iu]);break;case"right":Mu(e,"x",-t[Ou])}if(!o&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Mu(e,"y",t[Au]);break;case"bottom":Mu(e,"y",-t[Du])}}(l,d,i,n,r),function(t,e){const{rows:i,bounds:s}=t,o=i.length,{__lineHeight:n,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:p,y:_,width:g,height:f}=s,y=n*o+(c?c*(t.paraNumber-1):0),m=r;if(h&&y>f)y=Math.max(f,n),o>1&&(t.overflow=o);else if(f||u)switch(d){case"middle":_+=(f-y)/2;break;case"bottom":_+=f-y}m+=_;let v,w,x,b=g||u?g:t.maxWidth;for(let r=0,d=o;r<d;r++){if(v=i[r],v.x=p,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(m+=c),v.y=m,m+=n,t.overflow>r&&m>y&&(v.isOverflow=!0,t.overflow=r+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=y}(d,i),function(t,e,i){const{rows:s}=t,{textAlign:o,paraIndent:n,letterSpacing:r}=e;let a,h,l,d,c,u;s.forEach((t=>{t.words&&(l=n&&t.paraStart?n:0,u=t.words.length,h=i&&("justify"===o||"both"===o)&&u>1?(i-t.width-l)/(u-1):0,d=r||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach(((e,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach((t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==o||i===u-1||(a+=h,t.width+=h)}))),t.words=null)}))}(d,i,n),d.overflow&&function(t,i,s,o){if(!o)return;const{rows:n,overflow:r}=t;let{textOverflow:a}=i;if(n.splice(r),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=s+o-l;("none"===i.textWrap?n:[n[r-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<d));s--){if(h<d&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(d,i,s,n),"none"!==a&&function(t,e){let i;const{fontSize:s,textDecoration:o}=e;switch(t.decorationHeight=s/11,"object"==typeof o?(i=o.type,o.color&&(t.decorationColor=th.string(o.color))):i=o,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(d,i),d}};const Wu={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!th.object)return t;t=th.object(t)}let s=void 0===t.a?1:t.a;i&&(s*=e);const o=t.r+","+t.g+","+t.b;return 1===s?"rgb("+o+")":"rgba("+o+","+s+")"}};function zu(t){return t?t instanceof Array?t:[t]:[]}Object.assign(Qa,Fu),Object.assign(th,Wu),Object.assign(sh,kd),Object.assign(oh,rc),Object.assign(nh,Bc),Object.assign(rh,Oc),Object.assign(Ct,{interaction:(t,e,i,s)=>new Gl(t,e,i,s),hitCanvas:(t,e)=>new Ra(t,e),hitCanvasManager:()=>new Kl}),La();class Uu extends Qn{get list(){return zu(this.value)}get oldList(){return zu(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function Hu(t){return(e,i)=>{const s="_"+i;Ro(e,i,{get(){return this[s]},set(e){const o=this[s];if(o!==e){if(this.config){const t="target"===i;if(t){e instanceof Array&&e.length>1&&e[0].locked&&e.splice(0,1),this.single&&(this.element.syncEventer=null);const{beforeSelect:t}=this.config;if(t){const i=t({target:e});if("object"==typeof i)e=i;else if(!1===i)return}}const s=t?Uu.BEFORE_SELECT:Uu.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new Uu(s,{editor:this,value:e,oldValue:o}))}this[s]=e,t(this,o)}}})}}Uu.BEFORE_SELECT="editor.before_select",Uu.SELECT="editor.select",Uu.AFTER_SELECT="editor.after_select",Uu.BEFORE_HOVER="editor.before_hover",Uu.HOVER="editor.hover";const{abs:Nu}=Math,{copy:Yu,scale:Xu}=b,{setListWithFn:ju}=pt,{worldBounds:Vu}=Mn,Gu={a:1,b:0,c:0,d:1,e:0,f:0},Zu={x:0,y:0,width:0,height:0};class Ku extends t.UI{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(ju(Zu,e,Vu),t&&this.set(t),this.set(Zu),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const o=this.__,{stroke:n,strokeWidth:r,fill:a}=o,{bounds:h}=e;for(let l=0;l<i.length;l++){s=i[l];const{worldTransform:d,worldRenderBounds:c}=s;if(c.width&&c.height&&(!h||h.hit(c,e.matrix))){const i=Nu(d.scaleX),h=Nu(d.scaleY);if(Yu(Gu,d),Gu.half=r%2,i!==h){Xu(Gu,1/i,1/h),t.setWorld(Gu,e.matrix),t.beginPath(),o.strokeWidth=r;const{x:n,y:a,width:l,height:d}=s.__layout.boxBounds;t.rect(n*i,a*h,l*i,d*h)}else t.setWorld(Gu,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),o.strokeWidth=r/Nu(d.scaleX);n&&("string"==typeof n?sh.stroke(n,this,t):sh.strokes(n,this,t)),a&&("string"==typeof a?sh.fill(a,this,t):sh.fills(a,this,t))}}o.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}jt([Hu((function(t){const e=t.target;t.list=e?e instanceof Array?e:[e]:[]}))],Ku.prototype,"target",void 0);class qu extends t.Group{constructor(e){super(e),this.strokeArea=new t.Rect({strokeAlign:"center"}),this.fillArea=new t.Rect,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:o}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:o},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const Ju={findOne:t=>t.list.find((t=>t.editable)),findByBounds(t,e){const i=[];return $u([t],i,e),i}};function $u(t,e,i){let s,o;for(let n=0,r=t.length;n<r;n++)if(s=t[n],o=s.__,o.hittable&&o.visible&&!o.locked&&i.hit(s.__world)){if(o.editable){if(s.isBranch&&!o.hitChildren){o.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&o.hitSelf&&e.push(s)}s.isBranch&&$u(s.children,e,i)}}const{findOne:Qu,findByBounds:tp}=Ju;class ep extends t.Group{get dragging(){return!!this.originList}get running(){const{editor:t}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector}get isMoveMode(){return this.app&&this.app.interaction.moveMode}constructor(t){super(),this.hoverStroker=new Ku,this.targetStroker=new Ku,this.bounds=new yt,this.selectArea=new qu,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{stroke:e,strokeWidth:i,hover:s,hoverStyle:o}=t.mergeConfig;this.hoverStroker.setTarget(s?this.editor.hoverTarget:null,Object.assign({stroke:e,strokeWidth:i},o||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(e.target=null)}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(t.shiftKey||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:o,y:n}=t.getInnerPoint(this);this.bounds.set(o,n),this.selectArea.setStyle({visible:!0,stroke:i,x:o,y:n},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),o=new Ta(tp(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),o.length){const t=[];this.originList.forEach((e=>{o.has(e)||t.push(e)})),o.forEach((e=>{this.originList.has(e)||t.push(e)})),(t.length!==e.list.length||e.list.some(((e,i)=>e!==t[i])))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||t.shiftKey&&!Qu(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Ta(this.editor.editBox.rect)};return Qu(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Qu(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(t.shiftKey||i)}__listenEvents(){const{editor:e}=this;e.waitLeafer((()=>{const{app:i}=e;i.selector.proxy=e,this.__eventIds=[e.on_([[Uu.HOVER,this.onHover,this],[Uu.SELECT,this.onSelect,this]]),i.on_([[t.PointerEvent.MOVE,this.onPointerMove,this],[t.PointerEvent.BEFORE_DOWN,this.onBeforeDown,this],[t.PointerEvent.TAP,this.onTap,this],[t.DragEvent.START,this.onDragStart,this,!0],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.MoveEvent.MOVE,this.onAutoMove,this],[[t.ZoomEvent.ZOOM,t.MoveEvent.MOVE],()=>{this.editor.hoverTarget=null}]])]}))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:ip,top:sp,topRight:op,right:np,bottomRight:rp,bottom:ap,bottomLeft:hp,left:lp}=t.Direction9,{toPoint:dp}=G,{within:cp}=a,up={getScaleData(t,e,i,s,o,n,r,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:p,heightRange:_,dragBounds:g,worldBoxBounds:f}=t,{width:y,height:m}=e;n&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,w=t.scaleY/e.scaleY,x=v<0?-1:1,b=w<0?-1:1,E=a?v:x*u.width/y,k=a?w:b*u.height/m;s.x*=a?v:x,s.y*=a?w:b;const B=(-s.y+m)/m,S=(s.x+y)/y,T=(s.y+m)/m,P=(-s.x+y)/y;switch(i){case sp:c=B,h="bottom";break;case np:d=S,h="left";break;case ap:c=T,h="top";break;case lp:d=P,h="right";break;case ip:c=B,d=P,h="bottom-right";break;case op:c=B,d=S,h="bottom-left";break;case rp:c=T,d=S,h="top-left";break;case hp:c=T,d=P,h="top-right"}if(o)if("corner"===o&&i%2)o=!1;else{let t;switch(i){case sp:case ap:t=c;break;case lp:case np:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const R=1!==d,C=1!==c;if(R&&(d/=E),C&&(c/=k),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(dp(n||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new yt(t.__localBoxBounds);if(pt.includes(new yt(e).spread(.1),i)&&(i.scaleOf(t.getLocalPointByInner(l),d,c),!pt.includes(e,i))){const t=i.getIntersect(e),s=t.width/i.width,o=t.height/i.height;R&&(d*=s),C&&(c*=o)}}if(R&&p){const e=u.width*t.scaleX;d=cp(e*d,p)/e}if(C&&_){const e=u.height*t.scaleY;c=cp(e*c,_)/e}return R&&Math.abs(d*f.width)<1&&(d=(d<0?-1:1)/f.width),C&&Math.abs(c*f.height)<1&&(c=(c<0?-1:1)/f.height),o&&d!==c&&(c=d=Math.min(d,c)),{origin:l,scaleX:d,scaleY:c,direction:i,lockRatio:o,around:n}},getRotateData(t,e,i,s,o){let n,r={};switch(e){case ip:n="bottom-right";break;case op:n="bottom-left";break;case rp:n="top-left";break;case hp:n="top-right";break;default:n="center"}return dp(o||n,t.boxBounds,r,!0),{origin:r,rotation:O.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let o,n,r={},a=0,h=0;switch(e){case sp:case ip:n={x:.5,y:0},o="bottom",a=1;break;case ap:case rp:n={x:.5,y:1},o="top",a=1;break;case lp:case hp:n={x:0,y:.5},o="right",h=1;break;case np:case op:n={x:1,y:.5},o="left",h=1}const{width:l,height:d}=t;n.x=n.x*l,n.y=n.y*d,dp(s||o,t,r,!0);const c=O.getRotation(n,r,{x:n.x+(a?i.x:0),y:n.y+(h?i.y:0)});return a?a=-c:h=c,{origin:r,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case lp:t=np;break;case ip:t=op;break;case hp:t=rp;break;case np:t=lp;break;case op:t=ip;break;case rp:t=hp}if(i)switch(t){case sp:t=ap;break;case ip:t=hp;break;case op:t=rp;break;case ap:t=sp;break;case hp:t=ip;break;case rp:t=op}return t}},pp={};function _p(t,e){const{enterPoint:i,dragging:s,skewing:o,resizing:n,flippedX:r,flippedY:h}=t;if(!i||!t.editor.editing||!t.canUse)return;if("circle"===i.name)return;if("button"===i.pointType)return void(i.cursor||(i.cursor="pointer"));let{rotation:l}=t;const{pointType:d}=i,{resizeCursor:c,rotateCursor:u,skewCursor:p,resizeable:_,rotateable:g,skewable:f}=t.mergeConfig;let y=d.includes("resize");y&&g&&(e.metaKey||e.ctrlKey||!_)&&(y=!1);const m=f&&!y&&("resize-line"===i.name||"skew"===d),v=s?o?p:n?c:u:m?p:y?c:u;l+=45*(up.getFlipDirection(i.direction,r,h)+1),l=2*Math.round(a.formatRotation(l,!0)/2);const{url:w,x:x,y:b}=v,E=w+l;pp[E]?i.cursor=pp[E]:pp[E]=i.cursor={url:fp(w,l),x:x,y:b}}function gp(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function fp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class yp extends t.Box{constructor(t){super(t),this.useFastShadow=!0}}const mp=["top","right","bottom","left"],vp=void 0;class wp extends t.Group{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.visible&&this.view.visible}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return"string"==typeof t||"string"==typeof e||"string"==typeof i}constructor(e){super(),this.view=new t.Group,this.rect=new t.Box({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new yp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new t.Group({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=e,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:o,rotatePoints:n,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new yp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),n.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new yp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new yp({name:"resize-point",hitRadius:5}),o.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),s.addMany(...n,a,h,l,...r,...o),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:o,resizePoints:n}=this,{stroke:r,strokeWidth:a}=e,h=this.getPointsStyle(),l=this.getMiddlePointsStyle();let d;for(let t=0;t<8;t++)d=n[t],d.set(this.getPointStyle(t%2?l[(t-1)/2%l.length]:h[t/2%h.length])),d.rotation=(t-(t%2?1:0))/2*90;o.set(this.getPointStyle(e.circle||e.rotatePoint||h[0])),s.set(Object.assign({stroke:r,strokeWidth:a,editConfig:vp},e.rect||{}));const c=i&&this.transformTool.editTool;s.hittable=!c,s.syncEventer=c&&this.editor,c&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),gp(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:o,rotation:n,skewX:r,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.set({x:e,y:i,scaleX:s,scaleY:o,rotation:n,skewX:r,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editMask:e}=this.editor,{mergeConfig:i,single:s,rect:o,circle:n,buttons:r,resizePoints:a,rotatePoints:h,resizeLines:l}=this,{middlePoint:d,resizeable:c,rotateable:u,hideOnSmall:p,editBox:_,mask:g,spread:f}=i;if(this.visible=!this.target.locked,e.visible=!!g||0,f&&pt.spread(t,f),this.view.worldOpacity){const{width:e,height:g}=t,f="number"==typeof p?p:10,y=_&&!(p&&e<f&&g<f);let m,v,w,x={};for(let s=0;s<8;s++)G.toPoint(G.directionData[s],t,x),v=a[s],m=h[s],w=l[Math.floor(s/2)],v.set(x),m.set(x),w.set(x),v.visible=w.visible=y&&!(!c&&!u),m.visible=y&&u&&c&&!i.rotatePoint,s%2&&(v.visible=m.visible=y&&!!d,(s+1)/2%2?(w.width=e,p&&2*v.width>e&&(v.visible=!1)):(w.height=g,p&&2*v.width>g&&(v.visible=!1)));n.visible=y&&u&&!(!i.circle&&!i.rotatePoint),n.visible&&this.layoutCircle(),o.path&&(o.path=null),o.set(Object.assign(Object.assign({},t),{visible:!s||_})),r.visible=y&&r.children.length>0||0,r.visible&&this.layoutButtons()}else o.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:o}=this.mergedConfig,n=mp.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,n,e||i,!!o)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:o}=this.mergedConfig,{flippedX:n,flippedY:r}=this;let a=mp.indexOf(e);(a%2&&n||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?up.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!o),i&&(t.rotation=90*(h-a)),t.scaleX=n?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const o=this.resizePoints[2*e+1],n=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?o.width:0)+t.boxBounds.width:(s?o.height:0)+t.boxBounds.height)/2)*r;n?(t.x=o.x+a,t.y=o.y):(t.x=o.x,t.y=o.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:o,pointRadius:n}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:o,height:o,cornerRadius:n,offsetX:0,offsetY:0,editConfig:vp};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return t instanceof Array?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return t instanceof Array?t:t?[t]:this.getPointsStyle()}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{editor:s,dragStartData:o}=this,{target:n}=this,{moveable:r,resizeable:a,rotateable:h,skewable:l,hideOnMove:d}=this.mergeConfig;"rect"===e.name?(r&&(this.moving=!0),s.opacity=d?0:1):(i.includes("rotate")||t.metaKey||t.ctrlKey||!a?(h&&(this.rotating=!0),"resize-rotate"===i?a&&(this.resizing=!0):"resize-line"===e.name&&(l&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&a&&(this.resizing=!0),"skew"===i&&l&&(this.skewing=!0)),o.x=t.x,o.y=t.y,o.point={x:n.x,y:n.y},o.bounds=Object.assign({},n.getLayoutBounds("box","local")),o.rotation=n.rotation,i&&i.includes("resize")&&(lr.resizingKeys=s.leafList.keys)}onDragEnd(t){this.dragPoint=null,this.resetDoing();const{name:e,pointType:i}=t.current;"rect"===e&&(this.editor.opacity=1),i&&i.includes("resize")&&(lr.resizingKeys=null)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:o,skewing:n}=this;if(i)e.onMove(t),gp(this);else if(s||o||n){const i=t.current;i.pointType&&(this.enterPoint=i),o&&e.onRotate(t),s&&e.onScale(t),n&&e.onSkew(t),_p(this,t)}}resetDoing(){this.canUse&&(this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1)}onMove(t){this.canGesture&&"drag"!==t.moveType&&(t.stop(),"string"==typeof this.mergeConfig.moveable&&(this.gesturing=this.moving=!0,this.transformTool.onMove(t)))}onScale(t){this.canGesture&&(t.stop(),"string"==typeof this.mergeConfig.resizeable&&(this.gesturing=this.resizing=!0,this.transformTool.onScale(t)))}onRotate(t){this.canGesture&&(t.stop(),"string"==typeof this.mergeConfig.rotateable&&(this.gesturing=this.rotating=!0,this.transformTool.onRotate(t)))}onKey(t){_p(this,t)}onArrow(t){const{editor:e,transformTool:i}=this;if(this.canUse&&e.editing&&this.mergeConfig.keyEvent){let e=0,s=0;const o=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=o;break;case"ArrowUp":s=-o;break;case"ArrowLeft":e=-o;break;case"ArrowRight":e=o}(e||s)&&i.move(e,s)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(e){const{editor:i,target:s}=this;if(this.single){if(s.locked)return;if(s.isBranch&&!s.editInner){if(s.textBox){const{children:e}=s,o=e.find((e=>e.editable&&e instanceof t.Text))||e.find((e=>e instanceof t.Text));if(o)return i.openInnerEditor(o)}i.openGroup(s),i.target=i.selector.findDeepOne(e)}else i.openInnerEditor()}}listenPointEvents(e,i,s){e.direction=s,e.pointType=i;const o=[[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.LEAVE,()=>{this.enterPoint=null}]];"circle"!==e.name&&o.push([t.PointerEvent.ENTER,t=>{this.enterPoint=e,_p(this,t)}]),this.__eventIds.push(e.on_(o))}__listenEvents(){const{rect:e,editor:i,__eventIds:s}=this;s.push(e.on_([[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.ENTER,()=>gp(this)],[t.PointerEvent.DOUBLE_TAP,this.onDoubleTap,this],[t.PointerEvent.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer((()=>{s.push(i.app.on_([[[t.KeyEvent.HOLD,t.KeyEvent.UP],this.onKey,this],[t.KeyEvent.DOWN,this.onArrow,this],[t.MoveEvent.BEFORE_MOVE,this.onMove,this,!0],[t.ZoomEvent.BEFORE_ZOOM,this.onScale,this,!0],[t.RotateEvent.BEFORE_ROTATE,this.onRotate,this,!0],[t.MoveEvent.END,this.resetDoing,this],[t.ZoomEvent.END,this.resetDoing,this],[t.RotateEvent.END,this.resetDoing,this]]))}))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const xp={x:0,y:0,width:1e5,height:1e5};class bp extends t.UI{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,xp),Object.assign(this.__world,xp)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach((i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)})),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const Ep='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',kp={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${Ep}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${Ep}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${Ep}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},Bp=new yt;function Sp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange((()=>{Bp.setListWithFn(i,(t=>t.getBounds("box","page"))),0===Bp.width&&(Bp.width=.1),0===Bp.height&&(Bp.height=.1),e.reset(Bp.get())})),s.add(e)}const Tp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),Pp=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),Rp={group(e,i,s){e.sort(Pp);const{app:o,parent:n}=e[0];let r;r=s&&s.add?s:new t.Group(s),n.addAt(r,n.children.indexOf(e[0])),e.sort(Tp);const a=new U(i.worldTransform);return a.divideParent(n.worldTransform),r.setTransform(a),r.editable=!0,r.hitChildren=!1,o.lockLayout(),e.forEach((t=>t.dropTo(r))),o.unlockLayout(),r},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach((t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)})),e.unlockLayout(),i},toTop(t){t.sort(Tp),t.forEach((t=>{t.parent&&t.parent.add(t)}))},toBottom(t){t.sort(Pp),t.forEach((t=>{t.parent&&t.parent.addAt(t,0)}))}},Cp=bt.get("EditToolCreator");function Lp(){return t=>{Op.register(t)}}const Ap=Lp,Op={list:{},register(t){const{tag:e}=t.prototype;Dp[e]&&Cp.repeat(e),Dp[e]=t},get:(t,e)=>new Dp[t](e)},{list:Dp}=Op;class Ip extends Uu{constructor(t,e){super(t,e)}}Ip.BEFORE_OPEN="innerEditor.before_open",Ip.OPEN="innerEditor.open",Ip.BEFORE_CLOSE="innerEditor.before_close",Ip.CLOSE="innerEditor.close";class Mp extends Uu{constructor(t,e){super(t,e)}}Mp.BEFORE_GROUP="editor.before_group",Mp.GROUP="editor.group",Mp.BEFORE_UNGROUP="editor.before_ungroup",Mp.UNGROUP="editor.ungroup",Mp.BEFORE_OPEN="editor.before_open_group",Mp.OPEN="editor.open_group",Mp.BEFORE_CLOSE="editor.before_close_group",Mp.CLOSE="editor.close_group";const{updateMatrix:Fp}=Pn,Wp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},zp="top-left";class Up extends t.Rect{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(er.CHANGE,(e=>{if(this.checkChange&&Wp[e.attrName]){const{attrName:i,newValue:s,oldValue:o}=e,n="s"===i[0]?(s||1)/(o||1):(s||0)-(o||0);this.canChange=!1;const r=this.__;r[i]=o,Fp(this.parent),Fp(this);const a=new U(this.__world);switch(r[i]=s,this.__layout.rotationChange(),Fp(this),this.changedTransform=new U(this.__world).divide(a),i){case"x":t.move(n,0);break;case"y":t.move(0,n);break;case"rotation":t.rotateOf(zp,n);break;case"scaleX":t.scaleOf(zp,n,1);break;case"scaleY":t.scaleOf(zp,1,n);break;case"skewX":t.skewOf(zp,n,0);break;case"skewY":t.skewOf(zp,0,n)}this.canChange=!0}}))}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Hp extends Uu{constructor(t,e){super(t,e)}}Hp.BEFORE_MOVE="editor.before_move",Hp.MOVE="editor.move";class Np extends Uu{constructor(t,e){super(t,e)}}Np.BEFORE_SCALE="editor.before_scale",Np.SCALE="editor.scale";class Yp extends Uu{constructor(t,e){super(t,e)}}Yp.BEFORE_ROTATE="editor.before_rotate",Yp.ROTATE="editor.rotate";class Xp extends Uu{constructor(t,e){super(t,e)}}Xp.BEFORE_SKEW="editor.before_skew",Xp.SKEW="editor.skew";class jp{onMove(e){const{target:i,dragStartData:s}=this.editBox;if(e instanceof t.MoveEvent){const t=e.getLocalMove(i);this.move(t.x,t.y)}else{const o={x:e.totalX,y:e.totalY};e.shiftKey&&(Math.abs(o.x)>Math.abs(o.y)?o.y=0:o.x=0),this.move(t.DragEvent.getValidMove(i,s.point,o))}}onScale(e){const{target:i,mergeConfig:s,single:o,dragStartData:n}=this.editBox;let{around:r,lockRatio:a,flipable:h,editSize:l}=s;if(e instanceof t.ZoomEvent)this.scaleOf(i.getBoxPoint(e),e.scale,e.scale);else{const{direction:t}=e.current;(e.shiftKey||i.lockRatio)&&(a=!0);const s=up.getScaleData(i,n.bounds,t,e.getInnerTotal(i),a,up.getAround(r,e.altKey),h,!o||"scale"===l);this.editTool&&this.editTool.onScaleWithDrag?(s.drag=e,this.scaleWithDrag(s)):this.scaleOf(s.origin,s.scaleX,s.scaleY)}}onRotate(e){const{target:i,mergeConfig:s,dragStartData:o}=this.editBox,{around:n,rotateAround:r,rotateGap:h}=s,{direction:l}=e.current;let d,c;if(e instanceof t.RotateEvent)c=e.rotation,d=r?G.getPoint(r,i.boxBounds):i.getBoxPoint(e);else{const t=up.getRotateData(i,l,e,o,e.shiftKey?null:r||i.around||i.origin||n||"center");c=o.rotation+t.rotation-i.rotation,d=t.origin}c=a.float(a.getGapRotation(c,h,i.rotation),2),c&&this.rotateOf(d,c)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:o,skewX:n,skewY:r}=up.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),up.getAround(s,t.altKey));(n||r)&&this.skewOf(o,n,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;"object"==typeof t&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if("object"==typeof s)t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);o||i.safeChange((()=>i.move(t,e)));const h={target:i,editor:n,moveX:a.x,moveY:a.y};this.emitEvent(new Hp(Hp.BEFORE_MOVE,h));const l=new Hp(Hp.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:o}=i;if(o){const{origin:i,scaleX:s,scaleY:n,drag:r}=t;if(!1===o({target:e,drag:r,origin:i,scaleX:s,scaleY:n}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new Np(Np.BEFORE_SCALE,t));const n=new Np(Np.SCALE,t);this.editTool.onScaleWithDrag(n),this.emitEvent(n)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeScale:h}=n;if(h){const s=h({target:o,origin:t,scaleX:e,scaleY:i});if("object"==typeof s)e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform((()=>o.safeChange((()=>o.scaleOf(t,e,i))))),c={target:o,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new Np(Np.BEFORE_SCALE,c));const u=new Np(Np.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,o=this.getWorldOrigin("center"),n=i?new U(Pn.getFlipTransform(e,t)):this.getChangedTransform((()=>e.safeChange((()=>e.flip(t))))),r={target:e,editor:s,worldOrigin:o,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:n};this.emitEvent(new Np(Np.BEFORE_SCALE,r));const a=new Np(Np.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if("number"==typeof s)e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!o&&this.getChangedTransform((()=>i.safeChange((()=>i.rotateOf(t,e))))),l={target:i,editor:n,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new Yp(Yp.BEFORE_ROTATE,l));const d=new Yp(Yp.ROTATE,l);this.doRotate(d),this.emitEvent(d)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeSkew:h}=n;if(h){const s=h({target:o,origin:t,skewX:e,skewY:i});if("object"==typeof s)e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform((()=>o.safeChange((()=>o.skewOf(t,e,i))))),c={target:o,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new Xp(Xp.BEFORE_SKEW,c));const u=new Xp(Xp.SKEW,c);this.doSkew(u),this.emitEvent(u)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(Pn.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new U(e.worldTransform);return t(),new U(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}t.Editor=class extends t.Group{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}constructor(t,e){super(e),this.leafList=new Ta,this.openedGroupList=new Ta,this.simulateTarget=new Up(this),this.editBox=new wp(this),this.editToolList={},this.selector=new ep(this),this.editMask=new bp(this),this.targetEventIds=[];let i=Wt.clone(kp);t&&(i=Wt.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Rt.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&Sp(this),this.update()}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element.editOuter||"EditTool",e=this.editTool=this.editToolList[t]=this.editToolList[t]||Op.get(t,this);this.editBox.load(),e.load(),this.update()}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(Mp.BEFORE_GROUP),this.target=Rp.group(this.list,this.element,t),this.emitGroupEvent(Mp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach((t=>t.isBranch&&this.emitGroupEvent(Mp.BEFORE_UNGROUP,t))),this.target=Rp.ungroup(t),t.forEach((t=>t.isBranch&&this.emitGroupEvent(Mp.UNGROUP,t)))),this.list}openGroup(t){this.emitGroupEvent(Mp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Mp.OPEN,t)}closeGroup(t){this.emitGroupEvent(Mp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Mp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach((t=>this.list.every((e=>!Pn.hasParent(e,t)))&&e.push(t)))),e.forEach((t=>this.closeGroup(t)))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new Mp(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if("string"==typeof e?s=e:i||(i=e),t&&i&&(this.target=t),this.single){const e=t||this.element;s||(s=e.editInner),s&&Op.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||Op.get(s,this),this.innerEditor.editTarget=e,this.emitInnerEvent(Ip.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Ip.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Ip.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Ip.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Ip(t,{editTarget:i,innerEditor:e});this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach((t=>t.locked=!0)),this.update()}unlock(){this.list.forEach((t=>t.locked=!1)),this.update()}toTop(){this.list.length&&(Rp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(Rp.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some((t=>t!==this.leafer&&t.renderer.changed)))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,editMask:i}=this;this.targetEventIds=[e.on_(ur.START,this.onRenderStart,this),t.on_(ur.CHILD_START,this.onAppRenderStart,this)],i.visible&&i.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach((t=>t.destroy())),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}},jt([(t,e)=>{Ro(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s}=this,o=Object.assign({},t);return e&&e.editConfig&&Object.assign(o,e.editConfig),s.config&&Object.assign(o,s.config),i&&(i.editConfig&&Object.assign(o,i.editConfig),"font-size"===o.editSize&&(o.lockRatio=!0),"resize-rotate"===i.pointType&&(o.around||(o.around="center"),Yt(o.lockRatio)&&(o.lockRatio=!0))),this.mergedConfig=o}})}],t.Editor.prototype,"mergeConfig",void 0),jt([Hu((function(t,e){t.emitEvent(new Uu(Uu.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))}))],t.Editor.prototype,"hoverTarget",void 0),jt([Hu((function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Ta?i:new Ta(i),t.multiple&&Sp(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new Uu(Uu.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer((()=>{t.updateEditTool(),t.listenTargetEvents()})):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new Uu(Uu.AFTER_SELECT,s))}))],t.Editor.prototype,"target",void 0),t.Editor=jt([_n(jp,["editBox","editTool","emitEvent"])],t.Editor);class Vp{static registerInnerEditor(){Op.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new t.Group,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}t.EditTool=class extends Vp{static registerEditTool(){Op.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:o,list:n}=s;o.lockLayout(),n.forEach((t=>{t.moveWorld(e,i)})),o.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach((t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(o,e,i,r)})),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:o}=t,{app:n,list:r}=o;n.lockLayout(),r.forEach((t=>{const n="scale"!==o.getEditSize(t);i?t.transformWorld(i,n):t.rotateOfWorld(s,e)})),n.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach((t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(o,e,i,r)})),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}},t.EditTool=jt([Lp()],t.EditTool);const{left:Gp,right:Zp}=t.Direction9,{move:Kp,copy:qp,toNumberPoints:Jp}=O;t.LineEditTool=class extends t.EditTool{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:o}=t,n=t.target,r=i===Gp;if(n.pathInputed){const{path:t}=n.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,n.path=t}else if(n.points){const{points:t}=n,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,n.points=t}else{const t={x:0,y:0},{toPoint:i}=n;n.rotation=0,this.dragPoint(t,i,r,o,this.getInnerMove(n,e,s)),n.getLocalPointByInner(t,null,null,!0),n.getLocalPointByInner(i,null,null,!0),n.x=t.x,n.y=t.y,n.getInnerPointByLocal(i,null,null,!0),n.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=Jp(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,o){const{x:n,y:r}=o;i?(Kp(t,n,r),s&&Kp(e,-n,-r)):(s&&Kp(t,-n,-r),Kp(e,n,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:o}=t,n=this.editor.element;let r,a;if(n.pathInputed?r=this.getFromToByPath(n.__.path):n.points&&(r=this.getFromToByPoints(n.__.points)),r){const{from:i,to:a}=r;n.innerToWorld(i,i,!1,t),n.innerToWorld(a,a,!1,t),o.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),qp(s[7],i),qp(e[7],i),qp(s[3],a),qp(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Gp||t===Zp,s[t].visible=a,e[t].visible=!r&&a}},t.LineEditTool=jt([Lp()],t.LineEditTool);const{M:$p,L:Qp,C:t_,Q:e_,Z:i_,N:s_,D:o_,X:n_,G:r_,F:a_,O:h_,P:l_,U:d_}=re,c_={scale(t,e,i){if(!t)return;let s,o=0,n=t.length;for(;o<n;)switch(s=t[o],s){case $p:case Qp:u_(t,e,i,o,1),o+=3;break;case t_:u_(t,e,i,o,3),o+=7;break;case e_:u_(t,e,i,o,2),o+=5;break;case i_:o+=1;break;case s_:u_(t,e,i,o,2),o+=5;break;case o_:u_(t,e,i,o,2),o+=9;break;case n_:u_(t,e,i,o,2),o+=6;break;case r_:u_(t,e,i,o,2),o+=9;break;case a_:u_(t,e,i,o,2),o+=5;break;case h_:t[o]=r_,t.splice(o+4,0,t[o+3],0),u_(t,e,i,o,2),o+=9,n+=2;break;case l_:t[o]=a_,t.splice(o+4,0,t[o+3]),u_(t,e,i,o,2),o+=5,n+=1;break;case d_:u_(t,e,i,o,2),o+=6}},scalePoints(t,e,i,s,o){for(let n=o?s+1:0,r=o?n+2*o:t.length;n<r;n+=2)t[n]*=e,t[n+1]*=i}},{scalePoints:u_}=c_,p_=b.get(),{topLeft:__,top:g_,topRight:f_,right:y_,bottom:m_,left:v_}=t.Direction9;function w_(t,e,i){t.pathInputed?b_(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function x_(t,e,i,s){let o=e;if(void 0!==s){const n=t.__layout;let{width:r,height:a}=n.boxBounds;switch(r*=i-e,a*=e-i,s){case g_:case m_:o=i,n.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case v_:case y_:n.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case __:case f_:n.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=o;const n=t.__,{padding:r}=n;r&&(t.padding=r instanceof Array?r.map((t=>t*o)):r*o),n.__autoWidth||(t.width*=o),n.__autoHeight||(t.height*=o)}function b_(t,e,i){c_.scale(t.__.path,e,i),t.path=t.__.path}function E_(t,e,i){const{points:s}=t;"object"==typeof s[0]?s.forEach((t=>{t.x*=e,t.y*=i})):c_.scalePoints(s,e,i),t.points=s}function k_(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)p_.a=e,p_.d=i,s[t].transform(p_,!0)}const B_=t.Leaf.prototype;B_.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},B_.__scaleResize=function(t,e){w_(this,t,e)},B_.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},B_.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},t.Text.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,o=i&&i.editor,n=o&&o.dragPoint,{__autoWidth:r,__autoHeight:a,textAlign:h,verticalAlign:l}=this.__,{boxBounds:d}=this.__layout;r&&"left"!==h&&1!==t&&(this.x+=d.x),a&&"top"!==l&&1!==e&&(this.y+=d.y),this.__.resizeFontSize||s&&"font-size"===s.editSize||n&&"font-size"===o.mergedConfig.editSize?x_(this,t,e,n&&n.direction):w_(this,t,e)},t.Path.prototype.__scaleResize=function(t,e){b_(this,t,e)},t.Line.prototype.__scaleResize=function(t,e){this.pathInputed?b_(this,t,e):this.points?E_(this,t,e):this.width*=t},t.Polygon.prototype.__scaleResize=function(t,e){this.pathInputed?b_(this,t,e):this.points?E_(this,t,e):w_(this,t,e)},t.Group.prototype.__scaleResize=function(t,e){k_(this,t,e)},t.Box.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||w_(this,t,e),i&&k_(this,t,e)},Rt.add("resize"),Rt.add("editor","resize"),Ct.editor=function(e,i){const s=new t.Editor(e);return i&&i.sky.add(i.editor=s),s},t.Box.addAttr("textBox",!1,Io),t.UI.addAttr("editConfig",void 0,Io),t.UI.addAttr("editOuter",(t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool")),Io),t.UI.addAttr("editInner","PathEditor",Io),t.Group.addAttr("editInner","",Io),t.Text.addAttr("editInner","TextEditor",Io),t.UI.setEditConfig=function(t){this.changeAttr("editConfig",t)},t.UI.setEditOuter=function(t){this.changeAttr("editOuter",t)},t.UI.setEditInner=function(t){this.changeAttr("editInner",t)};const S_={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},T_={top:"flex-start",middle:"center",bottom:"flex-end"},P_={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function R_(t,e,i){const{style:s}=t,{fill:o,padding:n,textWrap:r,textOverflow:a,textDecoration:h}=e;let l;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";e instanceof Array&&(e=e[0]);if("object"==typeof e)switch(e.type){case"solid":i=th.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=th.string("string"==typeof t?t:t.color);break;default:void 0!==e.r&&(i=th.string(e))}else i=e;t.color=i}(s,o),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,"object"==typeof h?(l=h.type,h.color&&(s.textDecorationColor=th.string(h.color))):l=h,s.textDecoration=P_[l],s.textTransform=S_[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=T_[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===r||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===r?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=n instanceof Array?n.map((t=>t*i+"px")).join(" "):(n||0)*i+"px",s.textOverflow="show"===a?"":"hide"===a?"clip":a}function C_(e,i,s){L_(e.parentApp?e.parentApp:e,i),e.isApp||s||e.__eventIds.push(e.on_(t.MoveEvent.BEFORE_MOVE,(t=>{e.zoomLayer.move(e.getValidMove(t.moveX,t.moveY))})),e.on_(t.ZoomEvent.BEFORE_ZOOM,(t=>{const{zoomLayer:i}=e,s=e.getValidScale(t.scale);1!==s&&i.scaleOfWorld(t,s)})))}function L_(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&Wt.assign(i,e),Wt.assign(t.config,i,t.userConfig)}t.TextEditor=class extends Vp{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:e}=this,{config:i}=e.app,s=this.editTarget;s.textEditing=!0,this.isHTMLText=!(s instanceof t.Text),this._keyEvent=i.keyEvent,i.keyEvent=!1;const o=this.editDom=document.createElement("div"),{style:n}=o;o.contentEditable="true",n.position="fixed",n.transformOrigin="left top",n.boxSizing="border-box",this.isHTMLText?o.innerHTML=String(s.text):o.innerText=String(s.text);const{view:r}=e.app;(this.inBody=r instanceof HTMLCanvasElement)?document.body.appendChild(o):r.appendChild(o),this.eventIds=[e.app.on_(t.PointerEvent.DOWN,(t=>{let i,{target:s}=t.origin;for(;s;)s===o&&(i=!0),s=s.parentElement;i||e.closeInnerEditor()}))],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),o.addEventListener("focus",this.onFocus),o.addEventListener("input",this.onInput),o.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const a=window.getSelection(),h=document.createRange();if(this.config.selectAll)h.selectNodeContents(o);else{const t=o.childNodes[0];h.setStartAfter(t),h.setEndAfter(t),h.collapse(!0)}a.removeAllRanges(),a.addRange(h)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode(""),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const o=s.getRangeAt(0);o.deleteContents();const n=i.split("\n"),r=document.createDocumentFragment();n.forEach(((t,e)=>{e>0&&r.appendChild(document.createElement("br")),r.appendChild(document.createTextNode(t))})),o.insertNode(r),o.collapse(!1),s.removeAllRanges(),s.addRange(o),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,o=0,n=0;i*=e,s*=e;const r=t.__;if(r.__autoWidth&&(i+=20,r.autoSizeAlign))switch(r.textAlign){case"center":o=-i/2;break;case"right":o=-i}if(r.__autoHeight&&(s+=20,r.autoSizeAlign))switch(r.verticalAlign){case"middle":n=-s/2;break;case"bottom":n=-s}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:p,f:_}=new U(t.worldTransform).scale(1/e).translateInner(o,n),{style:g}=this.editDom;g.transform=`matrix(${l},${d},${c},${u},${p},${_})`,g.left=a+"px",g.top=h+"px",g.width=i+"px",g.height=s+"px",this.isHTMLText||R_(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}},t.TextEditor=jt([Ap()],t.TextEditor),Rt.add("text-editor","editor");const A_=bt.get("LeaferTypeCreator"),O_={list:{},register(t,e){D_[t]&&A_.repeat(t),D_[t]=e},run(t,e){const i=D_[t];i&&i(e)}},{list:D_,register:I_}=O_;I_("viewport",C_),I_("custom",(function(t){C_(t,null,!0)})),I_("design",(function(t){C_(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})})),I_("document",(function(t){C_(t,{zoom:{min:1},move:{scroll:"limit"}})}));const M_={getData(t){const e=t[0],i=t[1],s=O.getCenter(e.from,i.from),o=O.getCenter(e.to,i.to),n={x:o.x-s.x,y:o.y-s.y},r=O.getDistance(e.from,i.from);return{move:n,scale:O.getDistance(e.to,i.to)/r,rotation:O.getRotation(e.from,i.from,e.to,i.to),center:o}}},F_={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:o}=t;return t.shiftKey&&!s&&(s=o,o=0),s>50&&(s=Math.max(50,s/3)),o>50&&(o=Math.max(50,o/3)),{x:-s*i*2,y:-o*i*2}},getScale(t,i){let s,o=1,{zoomMode:n,zoomSpeed:r}=i;const h=t.deltaY||t.deltaX;if(n?(s="mouse"===n||!t.deltaX&&(e.intWheelDeltaY?Math.abs(h)>17:Math.ceil(h)!==h),(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)):s=!t.shiftKey&&(t.metaKey||t.ctrlKey),s){r=a.within(r,0,1);o=1-h/(4*(t.deltaY?i.delta.y:i.delta.x))*r,o<.5&&(o=.5),o>=1.5&&(o=1.5)}return o}};class W_{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(e){const{interaction:i}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0}),i.emit(t.MoveEvent.START,this.moveData)),e.path=this.moveData.path,i.emit(t.MoveEvent.BEFORE_MOVE,e),i.emit(t.MoveEvent.MOVE,e),this.transformEndWait()}zoom(e){const{interaction:i}=this;this.zoomData||(this.setPath(e),this.zoomData=Object.assign(Object.assign({},e),{scale:1}),i.emit(t.ZoomEvent.START,this.zoomData)),e.path=this.zoomData.path,i.emit(t.ZoomEvent.BEFORE_ZOOM,e),i.emit(t.ZoomEvent.ZOOM,e),this.transformEndWait()}rotate(e){const{interaction:i}=this;this.rotateData||(this.setPath(e),this.rotateData=Object.assign(Object.assign({},e),{rotation:0}),i.emit(t.RotateEvent.START,this.rotateData)),e.path=this.rotateData.path,i.emit(t.RotateEvent.BEFORE_ROTATE,e),i.emit(t.RotateEvent.ROTATE,e),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout((()=>{this.transformEnd()}),this.interaction.p.transformTime)}transformEnd(){const{interaction:e,moveData:i,zoomData:s,rotateData:o}=this;i&&e.emit(t.MoveEvent.END,i),s&&e.emit(t.ZoomEvent.END,s),o&&e.emit(t.RotateEvent.END,o),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const z_=t.Leafer.prototype,U_=new yt;function H_(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function N_(t,e){return Object.assign(Object.assign({},e),{scale:t})}z_.initType=function(t){O_.run(t,this)},z_.getValidMove=function(t,e){const{scroll:i,disabled:s}=this.app.config.move;if(i){const s=!0===i?"":i;if(s.includes("x")?(t=t||e,e=0):s.includes("y")?(e=e||t,t=0):Math.abs(t)>Math.abs(e)?e=0:t=0,s.includes("limit")){const{x:i,y:s,width:o,height:n}=U_.set(this.__world).addPoint(this.zoomLayer),r=i+o-this.width,a=s+n-this.height;i>=0&&r<=0?t=0:t>0?i+t>0&&(t=-i):t<0&&r+t<0&&(t=-r),s>=0&&a<=0?e=0:e>0?s+e>0&&(e=-s):e<0&&a+e<0&&(e=-a)}}return{x:s?0:t,y:s?0:e}},z_.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:o}=this.app.config.zoom,n=Math.abs(e*t);return i&&n<i?t=i/e:s&&n>s&&(t=s/e),o?1:t};const Y_=Gl.prototype;Y_.createTransformer=function(){this.transformer=new W_(this)},Y_.move=function(t){this.transformer.move(t)},Y_.zoom=function(t){this.transformer.zoom(t)},Y_.rotate=function(t){this.transformer.rotate(t)},Y_.transformEnd=function(){this.transformer.transformEnd()},Y_.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:o}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):o&&(t.deltaX*=o),t.deltaY>0?s&&(t.deltaY*=s):o&&(t.deltaY*=o);const n=e.getScale?e.getScale(t,e):F_.getScale(t,e);if(1!==n)this.zoom(N_(n,t));else{const s=e.getMove?e.getMove(t,e):F_.getMove(t,e);i.snap&&O.round(s),this.move(H_(s,t))}},Y_.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:o,center:n}=M_.getData(e);Object.assign(t,n),t.multiTouch=!0,this.pointerWaitCancel(),this.rotate(function(t,e){return Object.assign(Object.assign({},e),{rotation:t})}(s,t)),this.zoom(N_(o,t)),this.move(H_(i,t))};const X_=Fl.prototype,{abs:j_}=Math;function V_(t,e){let i=1;const s="out"===e,o=Math.abs(t);if(o>1){for(;s?i<o:i<=o;)i*=2;s&&(i/=2)}else{for(;s?i>=o:i>o;)i/=2;s||(i*=2)}return i/t}X_.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,o=j_(i),n=j_(s),r=e?1:.1,a=this.interaction.m.dragAnimate&&this.canAnimate&&this.moving&&(o>r||n>r);if(a){const r="touch"===t.pointerType?3:1,a=70;o*(e=e?.95:r)>a?e=a/o:n*e>a&&(e=a/n),t=Object.assign({},t),O.move(t,i*e,s*e),this.drag(t),this.animate((()=>{this.dragEnd(t,1)}))}return a},X_.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},X_.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},X_.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:o,dragOut:n}=e.m;if(!n||!s||!o)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=pt.maxX(r),d=pt.maxY(r),c=t.x<a?o:l<t.x?-o:0,u=t.y<h?o:d<t.y?-o:0;let p=0,_=0;this.autoMoveTimer=setInterval((()=>{p+=c,_+=u,O.move(i,c,u),O.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:p,totalY:_,moveType:"drag"})),e.pointerMoveReal(t)}),10)},X_.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Rt.add("viewport"),Rt.add("view"),t.Leafer.prototype.zoom=function(t,e,i,s){let o;this.killAnimate(),"object"!=typeof e||e instanceof Array?o=e:(o=e.padding,i=e.scroll,s=e.transition);const{zoomLayer:n}=this,r=this.canvas.bounds.clone().shrink(void 0!==o?o:30),a=new yt,h={x:r.x+r.width/2,y:r.y+r.height/2};let l;const{x:d,y:c,scaleX:u,scaleY:p}=n.__;if("string"==typeof t)switch(t){case"in":l=V_(u,"in");break;case"out":l=V_(u,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new yt(this.boxBounds)).height=0;break;case"fit-height":(t=new yt(this.boxBounds)).width=0}else"number"==typeof t&&(l=t/u);if(l)l=this.getValidScale(l),n.scaleOfWorld(h,l,l,!1,s);else if("object"==typeof t){const e={x:d,y:c,scaleX:u,scaleY:p},o=t instanceof Array;if(o||t.tag){const e=o?t:[t];a.setListWithFn(e,Mn.worldBounds)}else{const e=function(t,e){let i,{x:s,y:o,width:n,height:r}=t;return r||(r=n*(e.height/e.width),i=!0),n||(n=r*(e.width/e.height),i=!0),i?{x:s,y:o,width:n,height:r}:t}(t,r);a.set(n.getWorldBounds(e))}const{width:h,height:_}=a;let g=r.x-a.x,f=r.y-a.y;return i?(g+=Math.max((r.width-h)/2,0),f+=Math.max((r.height-_)/2,0)):(l=this.getValidScale(Math.min(r.width/h,r.height/_)),g+=(r.width-h*l)/2,f+=(r.height-_*l)/2,O.scaleOf(e,a,l),a.scaleOf(a,l),e.scaleX*=l,e.scaleY*=l),"x"===i?f=0:"y"===i&&(g=0),O.move(e,g,f),a.move(g,f),n.set(e,s),a}return n.worldBoxBounds};class G_ extends t.Group{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&Wt.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(e){let i;"string"==typeof e?(i={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===e&&(i.fill="white",i.stroke="rgba(0,0,0,0.2)")):i=e,this.scrollXBar||this.addMany(this.scrollXBar=new t.Box,this.scrollYBar=new t.Box),i=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},i),i.height||(i.height=i.width),this.scrollXBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:o}=this.target.leafer,{worldRenderBounds:n}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(n))return;this.scrollBounds=new yt(n);const r=o.bounds.clone().shrink(i),a=r.clone().add(n),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,p=l<1,{scrollXBar:_,scrollYBar:g}=this,{x:f,y:y,width:m,height:v}=r.shrink([2,p?g.width+6:2,u?_.height+6:2,2]);_.set({x:f+m*d,y:y+v+2,width:Math.max(m*h,e),visible:u}),g.set({x:f+m+2,y:y+v*c,height:Math.max(v*l,e),visible:p})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:e,scrollYBar:i}=this;this.__eventIds=[e.on_(t.DragEvent.DRAG,this.onDrag,this),i.on_(t.DragEvent.DRAG,this.onDrag,this),e.on_(t.DragEvent.END,this.onDragEnd,this),i.on_(t.DragEvent.END,this.onDragEnd,this),this.target.on_(ur.BEFORE,(()=>this.update(!0))),this.target.leafer.on_(lr.RESIZE,(()=>this.update()))]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}Rt.add("scroll");class Z_ extends Ah{setText(t){this._text=t,this.__htmlChanged=!0}}t.HTMLText=class extends t.Image{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:o}=e.getBoundingClientRect(),n=s+10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${o}">\n <foreignObject width="${n}" height="${o}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.text}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(r)),t.__naturalWidth=n/t.pixelRatio,t.__naturalHeight=o/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}},jt([rn(Z_)],t.HTMLText.prototype,"__",void 0),jt([Uo("")],t.HTMLText.prototype,"text",void 0),jt([Io("TextEditor")],t.HTMLText.prototype,"editInner",void 0),jt([Ko(!1)],t.HTMLText.prototype,"textEditing",void 0),t.HTMLText=jt([gn()],t.HTMLText),Rt.add("html");class K_ extends Eh{}function q_(t){return Ao(t,(t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,Vo(this)}}})))}t.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}},jt([rn(K_)],t.Arrow.prototype,"__",void 0),jt([q_("angle")],t.Arrow.prototype,"endArrow",void 0),t.Arrow=jt([gn()],t.Arrow);const{M:J_,L:$_,C:Q_,Q:tg,O:eg}=re,{rotate:ig,copyFrom:sg,scale:og}=O,ng={},rg={layout(t,e,i,s,o,n,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case J_:case $_:ag(t,l+1,e,i,s,o,n,r),l+=3;break;case Q_:for(h=1;h<6;h+=2)ag(t,l+h,e,i,s,o,n,r);l+=7;break;case tg:for(h=1;h<4;h+=2)ag(t,l+h,e,i,s,o,n,r);l+=5;break;case eg:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),n&&(t[l+4]+=n,t[l+5]+=n),l+=7}},rotate(t,e,i){rg.layout(t,0,0,1,1,e,i)}};function ag(t,e,i,s,o,n,r,a){sg(ng,t[e],t[e+1]),r&&ig(ng,r,a),o&&og(ng,o,n),t[e]=i+ng.x,t[e+1]=s+ng.y}const{layout:hg,rotate:lg}=rg,{getAngle:dg}=O,cg={x:-.5},ug={connect:cg,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},pg={connect:cg,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},_g={connect:cg,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},gg={connect:cg,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},fg={offset:cg,path:[..._g.path],dashPath:[1,-2.5,0,2,-1,0]};lg(fg.path,180,{x:-1.5,y:0});const yg={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},mg={connect:{x:.5},path:[...yg.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},vg={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},wg={path:[...vg.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},xg=Wt.clone(vg),bg=Wt.clone(wg);lg(xg.path,45),lg(bg.path,45);const Eg={angle:ug,"angle-side":pg,arrow:gg,triangle:_g,"triangle-flip":fg,circle:mg,"circle-line":yg,square:wg,"square-line":vg,diamond:bg,"diamond-line":xg,mark:{offset:cg,path:[1,0,-2,2,0,2]}};function kg(t,e,i,s,o,n,r){const{strokeCap:a,strokeJoin:h}=t.__,{offset:l,connect:d,path:c,dashPath:u}="object"==typeof e?e:Eg[e];let p=d?d.x:0,_=l?l.x:0;const g=[...c];return r&&u&&g.push(...u),"none"!==a&&(p-=.5),l&&("round"===h&&l.roundJoin?_+=l.roundJoin:"bevel"===h&&l.bevelJoin&&(_+=l.bevelJoin)),_&&hg(g,_,0),hg(g,s.x,s.y,o,o,dg(i,s)),n.x=(p+_)*o,g}const{M:Bg,L:Sg,C:Tg,Q:Pg,Z:Rg,N:Cg,D:Lg,X:Ag,G:Og,F:Dg,O:Ig,P:Mg,U:Fg}=re,{copy:Wg,copyFrom:zg,getDistancePoint:Ug}=O,Hg={},Ng={},Yg={},Xg={},jg={},Vg={list:Eg,addArrows(t,e){const{startArrow:i,endArrow:s,strokeWidth:o,dashPattern:n,__pathForRender:r}=t.__;let a,h=0,l=r.length,d=0,c=i&&"none"!==i;for(;h<l;){switch(a=r[h],a){case Bg:case Sg:(d<2||h+6>=l)&&(zg(jg,r[h+1],r[h+2]),!d&&c&&Wg(Ng,jg)),h+=3;break;case Tg:1!==d&&h+7!==l||Gg(r,Xg,jg,h+3),h+=7;break;case Pg:1!==d&&h+5!==l||Gg(r,Xg,jg,h+1),h+=5;break;case Rg:return;case Cg:h+=5;break;case Lg:h+=9;break;case Ag:h+=6;break;case Og:h+=9;break;case Dg:h+=5;break;case Ig:h+=7;break;case Mg:h+=4;break;case Fg:1!==d&&h+6!==l||Gg(r,Xg,jg,h+1),h+=6}if(d++,1===d&&a!==Bg)return;if(2===d&&c&&Wg(Yg,a===Sg?jg:Xg),h===l){const l=t.__.__pathForRender=e?[...r]:r,d=t.__.__pathForArrow=[];if(c){const e=kg(t,i,Yg,Ng,o,Hg,!!n);n?d.push(...e):l.push(...e),Hg.x&&(Ug(Ng,Yg,-Hg.x,!0),l[1]=Yg.x,l[2]=Yg.y)}if(s&&"none"!==s){const e=kg(t,s,Xg,jg,o,Hg,!!n);if(n?d.push(...e):l.push(...e),Hg.x){let t;switch(Ug(jg,Xg,-Hg.x,!0),a){case Sg:t=h-3+1;break;case Tg:t=h-7+5;break;case Pg:t=h-5+3;break;case Fg:t=h-6+3}t&&Zg(l,Xg,t)}}}else Wg(Xg,jg)}}};function Gg(t,e,i,s){zg(e,t[s],t[s+1]),zg(i,t[s+2],t[s+3])}function Zg(t,e,i){t[i]=e.x,t[i+1]=e.y}Rt.add("arrow"),t.UI.addAttr("startArrow","none",q_),t.UI.addAttr("endArrow","none",q_),Object.assign(ih,Vg),Object.assign(sh,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});t.Flow=class extends t.Box{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}},jt([rn(class extends wh{})],t.Flow.prototype,"__",void 0),jt([Fo("x")],t.Flow.prototype,"flow",void 0),t.Flow=jt([gn()],t.Flow);const Kg={},qg={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},Jg={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function $g(t,e,i){const s=t.__,{contentBounds:o}=t.__layout;q.toPoint(i,e,o,Kg),e.x=s.__autoWidth?o.x:Kg.x,e.y=s.__autoHeight?o.y:Kg.y}const{move:Qg}=O;function tf(t,e,i,s,o,n){const{children:r}=t;let a,h,{x:l,start:d}=e,c=s;l+=i;for(let t=0,i=e.count;t<i;t++)a=r[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=s+(e.height-h.height)/("center"===o?2:1)),Qg(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function ef(t,e,i){const s="width"===i?"height":"width";t[i]=Math.max(t[i],e[i]),t[s]+=t.count?e[s]+t.gap:e[s],t.list.push(e),t.count++}const sf={};function of(t,e){const{gap:i,flowAlign:s,flowWrap:o,__autoWidth:n,__autoHeight:r}=t.__,a=o&&(e?!n:!r);return"object"==typeof i?(sf.xGap=i.x||0,sf.yGap=i.y||0):sf.xGap=sf.yGap=i,sf.isAutoXGap="string"==typeof sf.xGap&&!n,sf.isAutoYGap="string"==typeof sf.yGap&&!r,sf.complex=a||"top-left"!==s||t.__hasGrow||sf.isAutoXGap||sf.isAutoYGap,sf.wrap=a,sf.complex&&(sf.isFitXGap="fit"===sf.xGap&&!n,sf.isFitYGap="fit"===sf.yGap&&!r,"object"==typeof s?(sf.contentAlign=s.content||"top-left",sf.rowXAlign=s.x||"from",sf.rowYAlign=s.y||"from"):(sf.contentAlign=s,sf.rowXAlign=qg[s],sf.rowYAlign=Jg[s])),sf}function nf(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function rf(t,e,i,s){const{count:o}=t;o>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(o-1),t[e]=i)}function af(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:hf}=a;function lf(t,e,i,s){let o,n,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.width)/l,{children:u}=t;if(!(c<=0)){e.width=i;for(let t=0,i=e.count;t<i;t++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__widthGrow)&&(r=df(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.widthRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach((t=>{s=t.__widthGrow,o=e/i*s,r=df(t,n=t.__flowBounds,n.width+o),e-=o-r,i-=s}))}(h,a,l)}}function df(t,e,i){const{widthRange:s,lockRatio:o}=t.__,n=s?hf(i,s):i,r=n/e.width;return t.scaleResize(r,o?r:1),e.width=n,i-n}const{within:cf}=a;function uf(t,e,i,s){let o,n,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.height)/l,{children:u}=t;if(!(c<=0)){e.height=i;for(let t=0,i=e.count;t<i;t++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__heightGrow)&&(r=pf(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.heightRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach((t=>{s=t.__heightGrow,o=e/i*s,r=pf(t,n=t.__flowBounds,n.height+o),e-=o-r,i-=s}))}(h,a,l)}}function pf(t,e,i){const{heightRange:s,lockRatio:o}=t.__,n=s?cf(i,s):i,r=n/e.height;return t.scaleResize(o?r:1,r),e.height=n,i-n}const{move:_f}=O;function gf(t,e){const i="width",{children:s,itemBox:o}=t,n=of(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},p=d?0:h;let _,g,f,y,m,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)_=s[y=e?h-1-n:n],_.__.inFlow&&0!==_.__.visible&&(g=af(_,o),r?(_.__flowBounds=g,m||(m=nf(y,p)),a&&m.count&&m.width+g.width>x&&(m.grow?lf(t,m,x,e):d&&rf(m,i,x,c),ef(u,m,i),m=nf(y,p)),f=g.width,_.__widthGrow&&(m.grow+=_.__widthGrow,f=0,_.__.widthRange&&(m.hasRangeSize=!0)),_.__heightGrow&&pf(_,g,b),m.width+=m.count?f+p:f,m.height=Math.max(m.height,g.height),m.count++):(_f(_,v-g.x,w-g.y),v+=g.width+p));if(r&&m){const{isAutoYGap:s,isFitYGap:o,contentAlign:r,rowXAlign:h,rowYAlign:p}=n;m.count&&(m.grow?lf(t,m,x,e):d&&rf(m,i,x,c),a&&ef(u,m,i)),a?(s?rf(u,"height",b,o):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){$g(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=qg[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],tf(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,p,e)):($g(t,m,r),tf(t,m,0,m.y,p,e))}}const{move:ff}=O;function yf(t,e,i,s,o,n){const{children:r}=t;let a,h,{y:l,start:d}=e,c=i;l+=s;for(let t=0,s=e.count;t<s;t++)a=r[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=i+(e.width-h.width)/("center"===o?2:1)),ff(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:mf}=O;function vf(t,e){const i="height",{children:s,itemBox:o}=t,n=of(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},p=d?0:l;let _,g,f,y,m,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)_=s[y=e?h-1-n:n],_.__.inFlow&&0!==_.__.visible&&(g=af(_,o),r?(_.__flowBounds=g,m||(m=nf(y,p)),a&&m.count&&m.height+g.height>b&&(m.grow&&uf(t,m,b,e),d&&rf(m,i,b,c),ef(u,m,i),m=nf(y,p)),f=g.height,_.__heightGrow&&(m.grow+=_.__heightGrow,f=0,_.__.heightRange&&(m.hasRangeSize=!0)),_.__widthGrow&&df(_,g,x),m.height+=m.count?f+p:f,m.width=Math.max(m.width,g.width),m.count++):(mf(_,v-g.x,w-g.y),w+=g.height+p));if(r&&m){const{isAutoXGap:s,isFitXGap:o,contentAlign:r,rowXAlign:l,rowYAlign:p}=n;m.count&&(m.grow&&uf(t,m,b,e),d&&rf(m,i,b,c),a&&ef(u,m,i)),a?(s?rf(u,"width",x,o):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){$g(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=Jg[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,p),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],yf(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):($g(t,m,r),yf(t,m,m.x,0,l,e))}}function wf(t){return Ao(t,(t=>({set(e){const i="number"==typeof e?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent((()=>{this.parent.__hasGrow=!0})),this.__setAttr(t,e)&&No(this)}})))}Rt.add("flow","resize");const xf=t.Box.prototype,{__updateBoxBounds:bf}=t.Group.prototype;t.UI.addAttr("flow",!1,Fo),t.UI.addAttr("gap",0,Uo),t.UI.addAttr("flowAlign","top-left",Uo),t.UI.addAttr("flowWrap",!1,Uo),t.UI.addAttr("itemBox","box",Uo),t.UI.addAttr("inFlow",!0,Uo),t.UI.addAttr("autoWidth",void 0,wf),t.UI.addAttr("autoHeight",void 0,wf),t.UI.addAttr("autoBox",void 0,Uo);const{copyAndSpread:Ef}=pt;xf.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:gf(this);break;case"y":vf(this);break;case"x-reverse":gf(this,!0);break;case"y-reverse":vf(this,!0)}t&&(this.leafer.created=!0)},xf.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),Ef(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},xf.__updateBoxBounds=function(t){if(this.children.length&&!this.pathInputed){const e=this.__,{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():bf.call(this);const{boxBounds:s}=this.__layout;e.__autoSize||(e.__autoWidth?(i||(s.width+=s.x,s.x=0),s.height=e.height,s.y=0):(i||(s.height+=s.y,s.y=0),s.width=e.width,s.x=0)),i&&t&&e.padding&&Ef(s,s,e.padding,!1,e.__autoSize?null:e.__autoWidth?"width":"height"),this.__updateNaturalSize()}else this.__updateRectBoxBounds();i&&this.__updateContentBounds()}else this.__updateRectBoxBounds()};const{cos:kf,sin:Bf,pow:Sf,sqrt:Tf,abs:Pf,ceil:Rf,floor:Cf,round:Lf,PI:Af}=Math,Of=5*Af,Df=1.70158,If=2.5949095,Mf=7.5625,Ff=2.75;function Wf(t){return e=>Sf(e,t)}function zf(t){return e=>1-Sf(1-e,t)}function Uf(t){return e=>e<.5?.5*Sf(2*e,t):1-.5*Sf(2-2*e,t)}function Hf(t){return t<1/Ff?Mf*t*t:t<2/Ff?Mf*(t-=1.5/Ff)*t+.75:t<2.5/Ff?Mf*(t-=2.25/Ff)*t+.9375:Mf*(t-=2.625/Ff)*t+.984375}function Nf(t,e,i,s){const o={};return n=>{const r=~~(1e4*n),a=o[r];if(a)return a;let h,l,d,c=n;for(let e=0;e<8&&(h=1-c,d=Yf(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Pf(l)<1e-6));e++)c-=d/l;return o[r]=Yf(c,e,s)}}function Yf(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Xf={get(t){const{list:e}=Xf;return"string"==typeof t?e[t||"ease"]:"object"==typeof t?e[t.name].apply(e,t.value instanceof Array?t.value:[t.value]):e.ease},register(t,e){Xf.list[t]=e},list:{linear:t=>t,ease:Nf(.25,.1,.25,1),"ease-in":Nf(.42,0,1,1),"ease-out":Nf(0,0,.58,1),"ease-in-out":Nf(.42,0,.58,1),"sine-in":t=>1-kf(t*Af*.5),"sine-out":t=>Bf(t*Af*.5),"sine-in-out":t=>.5*(1-kf(t*Af)),"quad-in":Wf(2),"quad-out":zf(2),"quad-in-out":Uf(2),"cubic-in":Wf(3),"cubic-out":zf(3),"cubic-in-out":Uf(3),"quart-in":Wf(4),"quart-out":zf(4),"quart-in-out":Uf(4),"quint-in":Wf(5),"quint-out":zf(5),"quint-in-out":Uf(5),"expo-in":t=>t?Sf(2,10*t-10):0,"expo-out":t=>1===t?1:1-Sf(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Sf(2,2*t*10-10):.5*(2-Sf(2,10-2*t*10)),"circ-in":t=>1-Tf(1-Sf(t,2)),"circ-out":t=>Tf(1-Sf(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Tf(1-Sf(2*t,2))):.5*(Tf(1-Sf(2-2*t,2))+1),"back-in":t=>((Df+1)*t-Df)*t*t,"back-out":t=>(t-=1)*t*((Df+1)*t+Df)+1,"back-in-out":t=>t<.5?(t*=2)*t*((If+1)*t-If)*.5:.5*((t=2*t-2)*t*((If+1)*t+If)+2),"elastic-in":t=>0===t||1===t?t:-Sf(2,10*(t-1))*Bf((t-1.1)*Of),"elastic-out":t=>0===t||1===t?t:Sf(2,-10*t)*Bf((t-.1)*Of)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Sf(2,10*((t*=2)-1))*Bf((t-1.1)*Of)*.5:Sf(2,10*(1-(t*=2)))*Bf((t-1.1)*Of)*.5+1,"bounce-in":t=>1-Hf(1-t),"bounce-out":Hf,"bounce-in-out":t=>t<.5?.5*(1-Hf(1-2*t)):.5*(1+Hf(2*t-1)),"cubic-bezier":Nf,steps:function(t,e="floor"){return i=>("floor"===e?Cf(i*t):"ceil"===e?Rf(i*t):Lf(i*t))/t}}};function jf(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class Vf{}Vf.CREATED="created",Vf.PLAY="play",Vf.PAUSE="pause",Vf.STOP="stop",Vf.SEEK="seek",Vf.UPDATE="update",Vf.COMPLETED="completed";t.Animate=class extends gr{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:o}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&o&&"number"==typeof o&&(t+=o-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=e instanceof Array?e:e?[e]:[];const{easing:o,attrs:n}=this;this.easingFn=Xf.get(o),(n||this.attrsMap)&&(this.attrsMap=n?n.reduce(((t,e)=>(t[e]=!0,t)),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout((()=>{this.timer=0,this.play()}),0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emitType(Vf.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(Vf.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(Vf.STOP))}seek(t){this.destroyed||("object"==typeof t&&(t=eh.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer((()=>this.requestAnimate())),this.emitType(Vf.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:o}=i,n=!(o>1)||this.join;let r,a,h,l,d,c=0,u=0;o>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<o;s++){if(a=i[s],l=a.style||a,r||(r=n?t:l),h={style:l,beforeStyle:{}},d=1,a.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:o,swing:n,loop:r}=a;n&&(h.swing="number"==typeof n?n:2,d=2*h.swing-1),r&&(h.loop=d="number"==typeof r?r:2),t?(h.duration=t,c+=t*d,i&&(h.totalTime=t+i)):e&&(h.autoDuration=e,u+=e*d),i?(h.delay=i,c+=i*d):s&&(h.autoDelay=s,u+=s*d),o&&(h.easingFn=Xf.get(o))}if(h.autoDuration||void 0!==h.duration||(o>1?s>0||n?u+=d:h.duration=0:h.duration=this.duration),o>1)this.setBefore(h,l,r);else{for(let e in l)h.beforeStyle[e]=t[e];this.fromStyle=h.beforeStyle,this.toStyle=h.style}r=l,e.push(h)}u?((this.duration<=c||!s||!s.duration)&&this.changeDuration(c+.2*u),this.allocateTime((this.duration-c)/u)):c&&this.changeDuration(c),this.emitType(Vf.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:o,target:n}=this;for(let r in e)void 0===s[r]&&(s[r]=o[r]=e===i?i[r]:n[r]),t.beforeStyle[r]=void 0===i[r]?o[r]:i[r],o[r]=e[r]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let o=0;o<s;o++)e=i[o],void 0===e.duration&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),e.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout((()=>{this.timer=0,this.begin()}),e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout((()=>{this.timer=0,this.begin()}),t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(Vf.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,o=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(o);else{const{attrsMap:i,target:n}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),dh.setBetweenStyle(r,s,o,e,t,n,i),this.setStyle(r)}this.emitType(Vf.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return"number"==typeof e&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}},jt([jf("ease")],t.Animate.prototype,"easing",void 0),jt([jf(0)],t.Animate.prototype,"delay",void 0),jt([jf(.2)],t.Animate.prototype,"duration",void 0),jt([jf("auto")],t.Animate.prototype,"ending",void 0),jt([jf(!1)],t.Animate.prototype,"reverse",void 0),jt([jf(!1)],t.Animate.prototype,"swing",void 0),jt([jf(!1)],t.Animate.prototype,"loop",void 0),jt([jf(0)],t.Animate.prototype,"loopDelay",void 0),jt([jf(1)],t.Animate.prototype,"speed",void 0),jt([jf(!0)],t.Animate.prototype,"autoplay",void 0),jt([jf()],t.Animate.prototype,"join",void 0),jt([jf()],t.Animate.prototype,"attrs",void 0),t.Animate=jt([_n(Sr)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every((t=>t.completed))}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter((t=>{const{completed:e}=t;return e&&t.destroy(),!e}))),this.list=e.map((e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s}))}play(){this.each((t=>t.play())),this.emitType(Vf.PLAY)}pause(){this.each((t=>t.pause())),this.emitType(Vf.PAUSE)}stop(){this.each((t=>t.stop())),this.emitType(Vf.STOP)}seek(t){this.each((e=>e.seek(t))),this.emitType(Vf.SEEK)}kill(t,e){this.each((i=>i.kill(t,e))),this.destroy()}onChildEvent(t,e){switch(t){case Vf.COMPLETED:this.completed&&this.emitType(t);break;case Vf.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each((e=>e.destroy(t))),e.length=0)}},t.AnimateList=jt([_n(Sr)],t.AnimateList);const Gf={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},Zf=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Kf=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,qf=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,Jf=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,$f=parseInt,Qf=parseFloat,{round:ty}=Math;let ey={},iy=0;function sy(t){let e,i,s,o=1;switch(t.length){case 9:e=$f(t.slice(1,3),16),i=$f(t.slice(3,5),16),s=$f(t.slice(5,7),16),o=$f(t.slice(7,9),16)/255;break;case 7:e=$f(t.slice(1,3),16),i=$f(t.slice(3,5),16),s=$f(t.slice(5,7),16);break;case 5:e=$f(t[1]+t[1],16),i=$f(t[2]+t[2],16),s=$f(t[3]+t[3],16),o=$f(t[4]+t[4],16)/255;break;case 4:e=$f(t[1]+t[1],16),i=$f(t[2]+t[2],16),s=$f(t[3]+t[3],16);break;case 3:e=i=s=$f(t[1]+t[2],16);break;case 2:e=i=s=$f(t[1]+t[1],16)}return{r:e,g:i,b:s,a:o}}const oy=1/6,ny=.5,ry=2/3,ay=1/3;function hy(t,e,i){return i<0?i++:i>1&&i--,i<oy?t+6*(e-t)*i:i<ny?e:i<ry?t+(e-t)*(ry-i)*6:t}function ly(t,e,i,s=1){let o,n,r;if(t/=360,i/=100,0===(e/=100))o=n=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;o=hy(a,s,t+ay),n=hy(a,s,t),r=hy(a,s,t-ay)}return{r:ty(255*o),g:ty(255*n),b:ty(255*r),a:s}}Rt.add("color"),th.object=function(t,e){let i,s=void 0!==e&&1!==e;if("string"==typeof t){const e=ey[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=sy(t);break;case"R":case"r":"("===t[4]&&Kf.test(t)?i=function(t){const e=Kf.exec(t);return{r:$f(e[1]),g:$f(e[2]),b:$f(e[3]),a:Qf(e[4])}}(t):"("===t[3]&&Zf.test(t)&&(i=function(t){const e=Zf.exec(t);return{r:$f(e[1]),g:$f(e[2]),b:$f(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&Jf.test(t)?i=function(t){const e=Jf.exec(t);return ly(Qf(e[1]),Qf(e[2]),Qf(e[3]),Qf(e[4]))}(t):"("===t[3]&&qf.test(t)&&(i=function(t){const e=qf.exec(t);return ly(Qf(e[1]),Qf(e[2]),Qf(e[3]),1)}(t))}if(!i){const e=Gf[t.toLowerCase()];e&&(i=sy("#"+e))}i&&(iy++,iy>1e4&&(ey={},iy=0),ey[t]=Object.assign({},i))}}else"object"==typeof t&&(void 0===t.a&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:dy}=Math,{fourNumber:cy}=a,uy={fill:yy,stroke:yy,cornerRadius:(t,e,i)=>"number"==typeof t&&"number"==typeof e?gy(t,e,i):(t=cy(t),e=cy(e),t.map(((t,s)=>gy(t,e[s],i)))),text(t,e,i){if("string"==typeof t&&"string"==typeof e){const s=t.length,o=e.length,n=gy(s,o,i,1);return s<o?e.substring(0,n):t.substring(0,n)}return"number"==typeof t||"number"==typeof e?a.float(gy(t,e,i),Math.max(_y(t),_y(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const o=Object.assign(Object.assign({},t),e);return dh.setBetweenStyle(o,t,e,o,i,s),o},shadow:my,innerShadow:my},py={value:function(t,e,i){const s="number"==typeof t,o="number"==typeof e;return s&&o?t+(e-t)*i:o||s?gy(t,e,i):t},number:gy,color:fy,setBetweenStyle:function(t,e,i,s,o,n,r){let a,h,l;const{list:d,value:c}=dh;for(let u in s)r&&!r[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,o,n)))}};function _y(t){const e=String(t).split(".")[1];return e?e.length:0}function gy(t,e,i,s){t||(t=0),e||(e=0);const o=t+(e-t)*i;return s?dy(o):o}function fy(t,e,i){t=th.object(t),e=th.object(e);const s=gy(t.r,e.r,i,1)+","+gy(t.g,e.g,i,1)+","+gy(t.b,e.b,i,1),o=gy(t.a,e.a,i);return 1===o?"rgb("+s+")":"rgba("+s+","+o+")"}function yy(t,e,i){return"string"==typeof t&&"string"==typeof e?fy(t,e,i):e}function my(t,e,i){return t instanceof Array||e instanceof Array?e:(e=e||{},{x:gy((t=t||{}).x,e.x,i),y:gy(t.y,e.y,i),blur:gy(t.blur,e.blur,i),spread:gy(t.spread,e.spread,i),color:fy(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}Rt.add("animate","color"),lh.canAnimate=!0,Object.assign(dh.list,uy),Object.assign(dh,py);const vy=t.UI.prototype;t.UI.addAttr("animation",void 0,(function(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}})))})),t.UI.addAttr("animationOut",void 0,Io),t.UI.addAttr("transition",!0,Io),t.UI.addAttr("transitionOut",void 0,Io),vy.animate=function(e,i,s,o){if(void 0===e)return this.__animate;let n=e instanceof Array&&!i&&s?new t.AnimateList(this,e,o):new t.Animate(this,e,i,o);this.killAnimate(s,n.toStyle);const r=this.__animate;return r&&(n instanceof t.AnimateList?n.list.unshift(r):n=new t.AnimateList(this,[r,n])),this.__animate=n},vy.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:o}=s;for(let t in i)if(t in o){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},vy.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(Vf.COMPLETED,e)};const wy=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],xy=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:by}=Math,{getDerivative:Ey}=Ae,ky={getDistance(t,e,i,s,o,n,r,a,h=1){let l,d,c,u,p,_,g=0,f=h/2;for(let h=0;h<wy.length;h++)l=f*(1+wy[h]),d=f*(1-wy[h]),c=Ey(l,t,i,o,r),u=Ey(l,e,s,n,a),p=Ey(d,t,i,o,r),_=Ey(d,e,s,n,a),g+=xy[h]*(by(c*c+u*u)+by(p*p+_*_));return g*f},getRotation(t,e,i,s,o,n,r,a,h){const d=Ey(t,e,s,n,a),c=Ey(t,i,o,r,h);return Math.atan2(c,d)/l},getT(t,e,i,s,o,n,r,a,h,l,d=1){let c=0,u=1,p=t/e,_=d/e/3;if(p>=1)return 1;if(p<=0)return 0;for(;u-c>_;)By(i,s,o,n,r,a,h,l,p)<t?c=p:u=p,p=(c+u)/2;return p},cut(t,e,i,s,o,n,r,a,h,l){const d=1-e,c=d*i+e*o,u=d*s+e*n,p=d*o+e*r,_=d*n+e*a,g=d*c+e*p,f=d*u+e*_,y=d*g+e*(d*p+e*(d*r+e*h)),m=d*f+e*(d*_+e*(d*a+e*l));t.push(re.C,c,u,g,f,y,m)}},{getDistance:By}=ky,{M:Sy,L:Ty,C:Py,Z:Ry}=re,Cy={},Ly={},Ay={transform(t,e){let i,s=0;const o=t.length;for(;s<o;)switch(i=t[s],i){case Sy:case Ty:Ay.transformPoints(t,e,s,1),s+=3;break;case Py:Ay.transformPoints(t,e,s,3),s+=7;break;case Ry:s+=1}},transformPoints(t,e,i,s){for(let o=i+1,n=o+2*s;o<n;o+=2)Cy.x=t[o],Cy.y=t[o+1],b.toOuterPoint(e,Cy),t[o]=Cy.x,t[o+1]=Cy.y},getMotionPathData(t){let e,i,s,o,n=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(o=t[a],o){case Sy:case Ty:i=t[a+1],s=t[a+2],e=o===Ty&&a>0?O.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Py:i=t[a+5],s=t[a+6],e=ky.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case Ry:a+=1;default:e=0}r.push(e),n+=e}return{total:n,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:o}=t;e=eh.number(e,t.total);let n,r,a,h,l,d,c,u,p,_=0,g={},f=0,y=0,m=0,v=0;const w=o.length;for(;f<w;){switch(h=o[f],h){case Sy:case Ty:if(r=o[f+1],a=o[f+2],n=s[y],_+n>=e||!t.total)return f||(m=r,v=a),Ly.x=m,Ly.y=v,g.x=r,g.y=a,O.getDistancePoint(Ly,g,e-_,!0),g.rotation=O.getAngle(Ly,g),g;m=r,v=a,f+=3;break;case Py:if(r=o[f+5],a=o[f+6],n=s[y],_+n>=e)return l=o[f+1],d=o[f+2],c=o[f+3],u=o[f+4],p=ky.getT(e-_,n,m,v,l,d,c,u,r,a,i),Ae.getPointAndSet(p,m,v,l,d,c,u,r,a,g),g.rotation=ky.getRotation(p,m,v,l,d,c,u,r,a),g;m=r,v=a,f+=7;break;case Ry:f+=1;default:n=0}y++,_+=n}return g},getDistancePath(t,e,i){const{segments:s,data:o}=t,n=[];e=eh.number(e,t.total);let r,a,h,l,d,c,u,p,_,g=0,f={},y=0,m=0,v=0,w=0;const x=o.length;for(;y<x;){switch(l=o[y],l){case Sy:case Ty:if(a=o[y+1],h=o[y+2],r=s[m],g+r>=e||!t.total)return y||(v=a,w=h),Ly.x=v,Ly.y=w,f.x=a,f.y=h,O.getDistancePoint(Ly,f,e-g,!0),n.push(l,f.x,f.y),n;v=a,w=h,y+=3,n.push(l,v,w);break;case Py:if(d=o[y+1],c=o[y+2],u=o[y+3],p=o[y+4],a=o[y+5],h=o[y+6],r=s[m],g+r>=e)return _=ky.getT(e-g,r,v,w,d,c,u,p,a,h,i),ky.cut(n,_,v,w,d,c,u,p,a,h),n;v=a,w=h,y+=7,n.push(l,d,c,u,p,a,h);break;case Ry:y+=1,n.push(l);default:r=0}m++,g+=r}return n}};function Oy(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!Yt(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}Rt.add("motion-path"),dh.register("motion",(function(t,e,i,s){return t?"object"==typeof t&&(t=eh.number(t,s.getMotionTotal())):t=0,e?"object"==typeof e&&(e=eh.number(e,s.getMotionTotal())):e=0,dh.number(t,e,i)})),dh.register("motionRotation",(function(t,e,i){return dh.number(t,e,i)}));const Dy=t.UI.prototype,{updateMatrix:Iy,updateAllMatrix:My}=Pn,{updateBounds:Fy}=Wn;function Wy(t){const{motion:e,leaferIsCreated:i}=t;if(!Yt(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Uy(t);i.total&&(t.__.__pathForRender=Ay.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(My(t),Fy(t,t)):Iy(t));i&&(t.leafer.created=!0)}}function zy(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function Uy(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Ay.getMotionPathData(t.getPath(!0,!0))}function Hy(t,e){return Ao(t,(t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?lh.setStyleName(this,e,i):lh.set(this,i):this.__layout.stateStyleChanged=!0}})))}function Ny(t){return Ao(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}})))}function Yy(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function Xy(t,e){"object"!=typeof e&&(e=void 0),Gy(t,e,"in")}function jy(t,e){const{normalStyle:i}=t;"object"!=typeof e&&(e=void 0),i&&(e||(e=i),Gy(t,e,"out"))}t.UI.addAttr("motionPath",void 0,Oy),t.UI.addAttr("motionPrecision",1,Oy),t.UI.addAttr("motion",void 0,Oy),t.UI.addAttr("motionRotation",!0,Oy),Dy.getMotionPathData=function(){return Uy(zy(this))},Dy.getMotionPoint=function(t){const e=zy(this),i=Uy(e);if(!i.total)return{};const s=Ay.getDistancePoint(i,t,e.motionPrecision);b.toOuterPoint(e.localTransform,s);const{motionRotation:o}=this;return!1===o?delete s.rotation:"number"==typeof o&&(s.rotation+=o),s},Dy.getMotionTotal=function(){return this.getMotionPathData().total},Dy.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],Yt(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Wy(t))}else Wy(this)};const Vy={};function Gy(t,e,i){const{normalStyle:s}=t;e||(e=Vy),e.scale&&(a.assignScale(e,e.scale),delete e.scale),e!==Vy&&lh.canAnimate||(i=null);let o=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&Yt(i[s])&&Yt(e[s])&&(s="transition");return Yt(e[s])?i[s]:e[s]}(i,e,t);const n=o?function(t,e){const i=qy(e,t),s=t.animate();s&&qy(i,t,s.fromStyle);return i}(t,e):void 0;lh.canAnimate&&Zy(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const r=Zy(t);if(r){const{animation:s}=r;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(r,n.endingStyle),"in"!==i||e.animation!==s?n.kill():o=!1,delete r.animation}t.normalStyle=Ky(r,t),t.set(r,"temp")}else t.normalStyle=void 0;if(o){const e=Ky(n,t);t.set(n,"temp"),t.animate([n,e],o,"transition",!0)}t.__layout.stateStyleChanged=!1}function Zy(t){let e;const i={},s=Yy(t),o=s?t.state||s.state:t.state,n=o&&t.states[o];n&&lh.isState(o,t,s)&&(e=Jy(i,n));const r=i.selectedStyle||t.selectedStyle;r&&lh.isSelected(t,s)&&(e=Jy(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&lh.isPlacehold(t,s)&&(e=Jy(i,a)),lh.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Jy(i,s))}else{const o=i.focusStyle||t.focusStyle;o&&lh.isFocus(t,s)&&(e=Jy(i,o));const n=i.hoverStyle||t.hoverStyle;n&&lh.isHover(t,s)&&(e=Jy(i,n));const r=i.pressStyle||t.pressStyle;r&&lh.isPress(t,s)&&(e=Jy(i,r))}return e?i:void 0}function Ky(t,e,i,s){const o=i?t:{},n=i||t;for(let t in n)s&&lh.animateExcludes[t]||(o[t]=e[t]);return o}function qy(t,e,i){return Ky(t,e,i,!0)}function Jy(t,e){return Object.assign(t,e),!0}function $y(t,e){const i=t[e];i&&Xy(t,i),t.button&&tm(t.children,e)}function Qy(t,e,i){i||(i=t.states[e]),Xy(t,i),t.button&&tm(t.children,null,e)}function tm(t,e,i){if(!t)return;let s,o;for(let n=0,r=t.length;n<r;n++){if(s=t[n],e){switch(o=!0,e){case"hoverStyle":lh.isHover(s)&&(o=!1);break;case"pressStyle":lh.isPress(s)&&(o=!1);break;case"focusStyle":lh.isFocus(s)&&(o=!1)}o&&$y(s,e)}else void 0!==i&&Qy(s,i);s.isBranch&&tm(s.children,e,i)}}function em(t,e){const i=t[e];i&&jy(t,i),t.button&&sm(t.children,e)}function im(t,e,i){jy(t,i),t.button&&sm(t.children,null,e)}function sm(t,e,i){if(!t)return;let s;for(let o=0,n=t.length;o<n;o++)s=t[o],e?em(s,e):void 0!==i&&im(s,i),s.isBranch&&sm(s.children,e,i)}function om(t,e,i){let s;const o=e.leafer?e.leafer.interaction:null;if(o&&(s=o[t](e),!s&&i)){const n=Yy(e,i);n&&(s=o[t](n))}return s}function nm(t,e,i){let s=e[t];if(!s&&i){const o=Yy(e,i);o&&(s=o[t])}return s}Rt.add("state"),lh.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},lh.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const o=Yy(e,i);o&&(s=o.states[t])}return!!s}(t,e,i)},lh.isSelected=function(t,e){return nm("selected",t,e)},lh.isDisabled=function(t,e){return nm("disabled",t,e)},lh.isFocus=function(t,e){return om("isFocus",t,e)},lh.isHover=function(t,e){return om("isHover",t,e)},lh.isPress=function(t,e){return om("isPress",t,e)},lh.isPlacehold=function(t,e){return t.__.__isPlacehold},lh.isDrag=function(t,e){return om("isDrag",t,e)},lh.setStyleName=function(t,e,i){i?Qy(t,e,t[e]):im(t,e,t[e])},lh.set=function(t,e){const i=t.states[e];i?Qy(t,e,i):im(t,e,i)},lh.getStyle=Zy,lh.updateStyle=Gy,lh.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:$y(e,"hoverStyle");break;case t.PointerEvent.LEAVE:em(e,"hoverStyle");break;case t.PointerEvent.DOWN:$y(e,"pressStyle");break;case t.PointerEvent.UP:em(e,"pressStyle")}};const rm=t.UI.prototype;t.UI.addAttr("selected",!1,Hy,"selectedStyle"),t.UI.addAttr("disabled",!1,Hy,"disabledStyle"),t.UI.addAttr("states",{},Ny),t.UI.addAttr("state","",Hy),t.UI.addAttr("normalStyle",void 0,Io),t.UI.addAttr("hoverStyle",void 0,Ny),t.UI.addAttr("pressStyle",void 0,Ny),t.UI.addAttr("focusStyle",void 0,Ny),t.UI.addAttr("selectedStyle",void 0,Ny),t.UI.addAttr("disabledStyle",void 0,Ny),t.UI.addAttr("placeholderStyle",void 0,Ny),t.UI.addAttr("button",!1,Io),rm.focus=function(t=!0){this.waitLeafer((()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?$y(this,"focusStyle"):em(this,"focusStyle")}))},rm.updateState=function(){lh.updateStyle(this,void 0,"in")};const am=t.Text.prototype,hm="text";Ro(am,hm,Object.assign(Object.assign({},Co(am,hm)),{set(t){const e=this,i=e.text;e.__setAttr(hm,t)&&(No(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class lm extends yh{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;t instanceof Array?t.forEach((t=>this.__loadRobot(t,e,e+=t.total||1))):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),void 0!==t)if("number"==typeof t)this.now=t;else if("object"==typeof t){const e=t instanceof Array,i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=ko.get(t);s.ready?this.__createFrames(s,t,e,i):s.load((()=>this.__createFrames(s,t,e,i)))}__createFrames(t,e,i,s){const{offset:o,size:n,total:r}=e,{width:a,height:h}=n&&("number"==typeof n?{width:n,height:n}:n)||(r>1?this:t);let l=o?o.x:0,d=o?o.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:l,y:d,width:a,height:h},l+a>=t.width?(l=0,d+=h):l+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new ir(ir.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:o}=this;o&&(o.FPS&&(i=o.FPS),void 0!==o.loop&&(s=o.loop)),this.__timer=setTimeout((()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)}),1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:o}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,o)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},jt([rn(lm)],t.Robot.prototype,"__",void 0),jt([Uo()],t.Robot.prototype,"robot",void 0),jt([Io()],t.Robot.prototype,"actions",void 0),jt([Io("")],t.Robot.prototype,"action",void 0),jt([Ko(0)],t.Robot.prototype,"now",void 0),jt([Io(12)],t.Robot.prototype,"FPS",void 0),jt([Io(!0)],t.Robot.prototype,"loop",void 0),t.Robot=jt([gn()],t.Robot),Rt.add("robot");const{Yes:dm,NoAndSkip:cm,YesAndSkip:um}=t.Answer,pm={},_m={},gm={};class fm{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const o=this.getByInnerId(t,e);return i?o:o?[o]:[];case"string":switch(t[0]){case"#":pm.id=t.substring(1),t=pm;break;case".":_m.className=t.substring(1),t=_m;break;default:gm.tag=t,t=gm}case"object":if(void 0!==t.id){const s=this.getById(t.id,e);return i?s:s?[s]:[]}if(t.tag){const{tag:s}=t,o=s instanceof Array;return this.getByMethod(o?this.methods.tags:this.methods.tag,e,i,o?Wt.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className);case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&Pn.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const o=i?null:[];return this.eachFind(this.toChildren(e),t,o,s),o||this.findLeaf}eachFind(t,e,i,s){let o,n;for(let r=0,a=t.length;r<a;r++){if(o=t[r],n=e(o,s),n===dm||n===um){if(!i)return void(this.findLeaf=o);i.push(o)}o.isBranch&&n<cm&&this.eachFind(o.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(tr.REMOVE,this.__onRemoveChild,this),this.target.on_(er.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const ym=t.UI.prototype;function mm(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Ct.selector())}ym.find=function(t,e){return mm(this).getBy(t,this,!1,e)},ym.findOne=function(t,e){return mm(this).getBy(t,this,!0,e)},Rt.add("find"),Ct.finder=function(t){return new fm(t)};const{setPoint:vm,addPoint:wm,toBounds:xm}=N;const bm={syncExport(t,i,s){let o;hh.running=!0;try{const n=fo.fileType(i),r=i.includes(".");s=fo.getExportOptions(s);const{toURL:h}=e,{download:l}=e.origin;if("json"===n)r&&l(h(JSON.stringify(t.toJSON(s.json)),"text"),i),o={data:!!r||t.toJSON(s.json)};else if("svg"===n)r&&l(h(t.toSVG(),"svg"),i),o={data:!!r||t.toSVG()};else{let e,n,r=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:p,clip:_,trim:g,screenshot:f,padding:y,onCanvas:m}=s,v=void 0===s.smooth?!c||c.config.smooth:s.smooth,w=s.contextSettings||(c?c.config.contextSettings:void 0),x=d&&f&&void 0===s.fill?t.fill:s.fill,b=fo.isOpaqueImage(i)||x,E=new U;if(f)e=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let i=s.relative||(d?"inner":"local");switch(r=l.scaleX,h=l.scaleY,i){case"inner":E.set(l);break;case"local":E.set(l).divide(t.localTransform),r/=t.scaleX,h/=t.scaleY;break;case"world":r=1,h=1;break;case"page":i=c||t;default:E.set(l).divide(t.getTransform(i));const e=i.worldTransform;r/=r/e.scaleX,h/=h/e.scaleY}e=t.getBounds("render",i)}const k={scaleX:1,scaleY:1};a.getScaleData(s.scale,s.size,e,k);let B=s.pixelRatio||1,{x:S,y:T,width:P,height:R}=new yt(e).scale(k.scaleX,k.scaleY);_&&(S+=_.x,T+=_.y,P=_.width,R=_.height);const C={exporting:!0,matrix:E.scale(1/k.scaleX,1/k.scaleY).invert().translate(-S,-T).withScale(1/r*k.scaleX,1/h*k.scaleY)};let L,A=Ct.canvas({width:Math.floor(P),height:Math.floor(R),pixelRatio:B,smooth:v,contextSettings:w});if(p&&(L=t,L.__worldOpacity=0,t=c||t,C.bounds=A.bounds),A.save(),u&&void 0!==x){const e=t.get("fill");t.fill="",t.__render(A,C),t.fill=e}else t.__render(A,C);if(A.restore(),L&&L.__updateWorldOpacity(),g){n=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let o,n,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(o=a%e,n=(a-o)/e,r?wm(r,o,n):vm(r={},o,n)),a++;const h=new yt;return r&&(xm(r,h),h.scale(1/t.pixelRatio).ceil()),h}(A);const t=A,{width:e,height:i}=n,s={x:0,y:0,width:e,height:i,pixelRatio:B};A=Ct.canvas(s),A.copyWorld(t,n,s)}if(y){const[t,e,i,s]=a.fourNumber(y),o=A,{width:n,height:r}=o;A=Ct.canvas({width:n+s+e,height:r+t+i,pixelRatio:B}),A.copyWorld(o,o.bounds,{x:s,y:t,width:n,height:r})}b&&A.fillWorld(A.bounds,x||"#FFFFFF","destination-over"),m&&m(A);o={data:"canvas"===i?A:A.export(i,s),width:A.pixelWidth,height:A.pixelHeight,renderBounds:e,trimBounds:n}}}catch(t){o={data:"",error:t}}return hh.running=!1,o},export(t,i,s){return hh.running=!0,function(t){Em||(Em=new wo);return new Promise((e=>{Em.add((()=>Vt(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((o=>new Promise((n=>{const r=()=>Vt(this,void 0,void 0,(function*(){if(!bo.isComplete)return e.requestRender(r);const a=hh.syncExport(t,i,s);a.data instanceof Promise&&(a.data=yield a.data),o(a),n()}));t.updateLayout(),km(t);const{leafer:a}=t;a?a.waitViewCompleted(r):r()}))))}};let Em;function km(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach((t=>km(t)))}const Bm=se.prototype,Sm=bt.get("@leafer-in/export");return Bm.export=function(t,e){const{quality:i,blob:s}=fo.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Bm.toBlob=function(t,i){return new Promise((s=>{e.origin.canvasToBolb(this.view,t,i).then((t=>{s(t)})).catch((t=>{Sm.error(t),s(null)}))}))},Bm.toDataURL=function(t,i){return e.origin.canvasToDataURL(this.view,t,i)},Bm.saveAs=function(t,i){return new Promise((s=>{e.origin.canvasSaveAs(this.view,t,i).then((()=>{s(!0)})).catch((t=>{Sm.error(t),s(!1)}))}))},Rt.add("export"),Object.assign(hh,bm),t.UI.prototype.export=function(t,e){return hh.export(this,t,e)},t.UI.prototype.syncExport=function(t,e){return hh.syncExport(this,t,e)},Rt.add("filter"),Object.assign(ah,{list:{},register(t,e){ah.list[t]=e},apply(t,e,i,s,o,n){let r;t.forEach((t=>{r=ah.list[t.type],r&&r.apply(t,e,i,s,o,n)}))},getSpread(t){let e,i=0;return t.forEach((t=>{e=ah.list[t.type],e&&(i+=e.getSpread(t))})),i}}),t.AlignHelper=q,t.AnimateEasing=Xf,t.AnimateEvent=Vf,t.AroundHelper=G,t.ArrowData=K_,t.AutoBounds=vt,t.BezierHelper=Ae,t.Bounds=yt,t.BoundsEvent=sr,t.BoundsHelper=pt,t.BoxData=wh,t.BranchHelper=Wn,t.BranchRender=Gr,t.CanvasData=Oh,t.CanvasManager=Ft,t.ChildEvent=tr,t.ColorConvert=th,t.Creator=Ct,t.Cursor=Zl,t.DataHelper=Wt,t.Debug=bt,t.Dragger=Fl,t.EditBox=wp,t.EditDataHelper=up,t.EditPoint=yp,t.EditSelect=ep,t.EditSelectHelper=Ju,t.EditToolCreator=Op,t.EditorEvent=Uu,t.EditorGroupEvent=Mp,t.EditorHelper=Rp,t.EditorMoveEvent=Hp,t.EditorRotateEvent=Yp,t.EditorScaleEvent=Np,t.EditorSkewEvent=Xp,t.Effect=rh,t.EllipseData=Bh,t.EllipseHelper=He,t.Event=Qn,t.EventCreator=It,t.Eventer=gr,t.Export=hh,t.FileHelper=fo,t.Filter=ah,t.Finder=fm,t.FrameData=bh,t.GroupData=vh,t.HTMLTextData=Z_,t.HighBezierHelper=ky,t.HighCurveHelper=Ay,t.HitCanvasManager=Kl,t.ImageData=Ah,t.ImageEvent=ir,t.ImageManager=ko,t.IncrementId=i,t.InnerEditor=Vp,t.InnerEditorEvent=Ip,t.InteractionBase=Gl,t.InteractionHelper=Ll,t.Keyboard=Bl,t.LayoutEvent=cr,t.Layouter=Xa,t.LeafBounds=Xr,t.LeafBoundsHelper=Mn,t.LeafData=Ut,t.LeafDataProxy=Rr,t.LeafEventer=Sr,t.LeafHelper=Pn,t.LeafLayout=$n,t.LeafLevelList=Pa,t.LeafList=Ta,t.LeafMatrix=Mr,t.LeafRender=jr,t.LeaferCanvas=Ra,t.LeaferCanvasBase=se,t.LeaferData=xh,t.LeaferEvent=pr,t.LeaferImage=Po,t.LeaferTypeCreator=O_,t.LineData=Eh,t.MathHelper=a,t.Matrix=U,t.MatrixHelper=b,t.MultiTouchHelper=M_,t.MyDragEvent=Cl,t.MyImage=vl,t.MyPointerEvent=Pl,t.NeedConvertToCanvasCommandMap=he,t.OneRadian=l,t.PI2=d,t.PI_2=c,t.Paint=sh,t.PaintGradient=nh,t.PaintImage=oh,t.PathArrow=ih,t.PathArrowModule=Vg,t.PathBounds=oo,t.PathCommandDataHelper=Zi,t.PathCommandMap=re,t.PathConvert=Bi,t.PathCorner=uo,t.PathCreator=cs,t.PathData=Ph,t.PathDrawer=Ss,t.PathHelper=oe,t.PathMatrixHelper=rg,t.PathNumberCommandLengthMap=ue,t.PathNumberCommandMap=ce,t.PathScaler=c_,t.PenData=Rh,t.Picker=Za,t.Platform=e,t.Plugin=Rt,t.Point=W,t.PointHelper=O,t.PointerButton=Sl,t.PolygonData=Sh,t.PropertyEvent=er,t.RectData=kh,t.RectHelper=pe,t.RectRender=Wh,t.RenderEvent=ur,t.Renderer=Va,t.ResizeEvent=lr,t.Resource=bo,t.RobotData=lm,t.Run=St,t.ScrollBar=G_,t.SelectArea=qu,t.Selector=Ka,t.StarData=Th,t.State=lh,t.StringNumberMap=wt,t.Stroker=Ku,t.TaskItem=vo,t.TaskProcessor=wo,t.TextConvert=Qa,t.TextData=Lh,t.TransformTool=jp,t.Transformer=W_,t.Transition=dh,t.TwoPointBoundsHelper=N,t.UIBounds=Dh,t.UICreator=At,t.UIData=yh,t.UIEvent=Tl,t.UIRender=Mh,t.UnitConvert=eh,t.WaitHelper=Nn,t.WatchEvent=dr,t.Watcher=Oa,t.WheelEventHelper=F_,t.addViewport=C_,t.addViewportConfig=L_,t.affectRenderBoundsType=Zo,t.affectStrokeBoundsType=jo,t.arrowType=q_,t.attr=Oo,t.autoLayoutType=Fo,t.boundsType=Uo,t.canvasPatch=go,t.canvasSizeAttrs=ie,t.createAttr=function(t){return(e,i)=>{Ro(e,i,Lo(i,t))}},t.createDescriptor=Lo,t.cursorType=nn,t.dataProcessor=rn,t.dataType=Io,t.decorateLeafAttr=Ao,t.defineDataProcessor=an,t.defineKey=Ro,t.defineLeafAttr=Do,t.doBoundsType=No,t.doStrokeType=Vo,t.effectType=qa,t.emptyData=Nt,t.eraserType=sn,t.getBoundsData=p,t.getDescriptor=Co,t.getMatrixData=_,t.getPointData=u,t.hitType=on,t.isEmptyData=Xt,t.isNull=Yt,t.layoutProcessor=function(t){return(e,i)=>{Ro(e,"__LayoutProcessor",{get:()=>t})}},t.maskType=en,t.motionPathType=Oy,t.naturalBoundsType=Ho,t.opacityType=qo,t.pathInputType=Yo,t.pathType=Xo,t.pen=po,t.positionType=Mo,t.registerEditTool=Lp,t.registerInnerEditor=Ap,t.registerUI=gn,t.registerUIEvent=fn,t.resizeType=Ja,t.rewrite=cn,t.rewriteAble=un,t.rotationType=zo,t.scaleResize=w_,t.scaleResizeFontSize=x_,t.scaleResizeGroup=k_,t.scaleResizePath=b_,t.scaleResizePoints=E_,t.scaleType=Wo,t.sortType=tn,t.stateStyleType=Ny,t.stateType=Hy,t.strokeType=Go,t.surfaceType=Ko,t.tempBounds=mt,t.tempMatrix=H,t.tempPoint=z,t.useCanvas=La,t.useModule=_n,t.version="1.8.0",t.visibleType=Jo,t.zoomLayerType=$a,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
1
|
+
var LeaferUI=function(t){"use strict";const e={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(t){const{prefix:i,suffix:s}=e.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),i&&"/"===t[0]&&(t=i+t),t}}},i={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=s;return e[t]?e[t]++:(e[t]=1,0)}},s=i;var n;t.Answer=void 0,(n=t.Answer||(t.Answer={}))[n.No=0]="No",n[n.Yes=1]="Yes",n[n.NoAndSkip=2]="NoAndSkip",n[n.YesAndSkip=3]="YesAndSkip";const o={};function r(t){return void 0===t}function a(t){return null==t}function h(t){return"string"==typeof t}const{isFinite:l}=Number;function d(t){return"number"==typeof t}const c=/^-?\d+(?:\.\d+)?$/;function u(t){return"string"==typeof t&&c.test(t)?+t:t}const{isArray:p}=Array;function _(t){return t&&"object"==typeof t}function g(t){return _(t)&&!p(t)}function f(t){return"{}"===JSON.stringify(t)}const y={default:(t,e)=>(m(e,t),m(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var o,r;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(o=t[n])||void 0===o?void 0:o.constructor)===Object)return m(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&m(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{r(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:m}=y;class v{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=r(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!r(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(p(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!r(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=r(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:o,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:o,f:r}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{round:w,pow:x,PI:b}=Math,E={within:(t,e,i)=>(_(e)&&(i=e.max,e=e.min),!r(e)&&t<e&&(t=e),!r(i)&&t>i&&(t=i),t),fourNumber(t,e){let i;if(p(t))switch(t.length){case 4:i=r(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),e)for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),E.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=r(e)?1e12:x(10,e);return-0===(t=w(t*i)/i)?0:t},getScaleData(t,e,i,s){if(s||(s={}),e){const t=(d(e)?e:e.width||0)/i.width,n=(d(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&E.assignScale(s,t);return s},assignScale(t,e){d(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:k,randColor:t=>`rgba(${k(255)},${k(255)},${k(255)},${t||1})`};function k(t){return Math.round(Math.random()*t)}const B=b/180,S=2*b,T=b/2;function P(){return{x:0,y:0}}function R(){return{x:0,y:0,width:0,height:0}}function L(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:C,cos:O,acos:A,sqrt:D}=Math,{float:M}=E,I={};function F(){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 W={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:F(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,o=0,r=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=o,t.f=r},get:L,getWorld:F,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},scaleOfOuter(t,e,i,s){z.toInnerPoint(t,e,I),z.scaleOfInner(t,I,i,s)},scaleOfInner(t,e,i,s=i){z.translateInner(t,e.x,e.y),z.scale(t,i,s),z.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=O(e*=B),a=C(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=n*r-o*a,t.d=n*a+o*r},rotateOfOuter(t,e,i){z.toInnerPoint(t,e,I),z.rotateOfInner(t,I,i)},rotateOfInner(t,e,i){z.translateInner(t,e.x,e.y),z.rotate(t,i),z.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=B,t.a=s+o*i,t.b=n+r*i),e&&(e*=B,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){z.toInnerPoint(t,e,I),z.skewOfInner(t,I,i,s)},skewOfInner(t,e,i,s=0){z.translateInner(t,e.x,e.y),z.skew(t,i,s),z.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:o,e:r,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*o,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*o,t.e=e.e*i+e.f*n+r,t.f=e.e*s+e.f*o+a},multiplyParent(t,e,i,s,n,o){let{e:a,f:h}=t;if(o&&(a+=o.scrollX,h+=o.scrollY),i||(i=t),r(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:o,c:r,d:a}=t;i.a=s*e.a+o*e.c,i.b=s*e.b+o*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=a*e.a+h*e.c+e.e,i.f=a*e.b+h*e.d+e.f},divide(t,e){z.multiply(t,z.tempInvert(e))},divideParent(t,e){z.multiplyParent(t,z.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=z;return z.copy(e,t),z.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:o,f:r}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(o*n-r*s)*a,t.f=-(r*e-o*i)*a}else if(1===e&&1===n)t.e=-o,t.f=-r;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-o*n*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:o}=e;i||(i=e),i.x=n*t.a+o*t.c,i.y=n*t.b+o*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:o,c:r,d:a}=t,h=1/(n*a-o*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*n-l*o)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*n-e*o)*h}},setLayout(t,e,i,s,n){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(r(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,o=i*B,r=O(o),a=C(o);if(s||n){const e=s*B,i=n*B;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(i=i||s)&&z.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:o,c:r,d:a,e:h,f:l}=t;let d,c,u,p,_,g=h,f=l;if(o||r){const t=n*a-o*r;if(r&&!s){d=D(n*n+o*o),c=t/d;const e=n/d;u=o>0?A(e):-A(e)}else{c=D(r*r+a*a),d=t/c;const e=r/c;u=T-(a>0?A(-e):-A(e))}const e=M(O(u)),i=C(u);d=M(d),c=M(c),p=e?M((r/c+i)/e/B,9):0,_=e?M((o/d-i)/e/B,9):0,u=M(u/B)}else d=n,c=a,u=p=_=0;return(e=i||e)&&(g+=e.x*n+e.y*r,f+=e.x*o+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:_}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=D(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){z.set(t)}},z=W,{toInnerPoint:U,toOuterPoint:H}=W,{sin:N,cos:Y,abs:X,sqrt:V,atan2:G,min:j,round:K}=Math,Z={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=r(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?K(t.x-.5)+.5:K(t.x),t.y=e?K(t.y-.5)+.5:K(t.y)},move(t,e,i){_(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=q.defaultPoint);const s=Y(e*=B),n=N(e),o=t.x-i.x,r=t.y-i.y;t.x=i.x+o*s-r*n,t.y=i.y+o*n+r*s},tempToInnerOf(t,e){const{tempPoint:i}=q;return $(i,t),U(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=q;return $(i,t),H(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=q;return $(i,t),q.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),U(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){U(e,t,i)},toOuterOf(t,e,i){H(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>J(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=X(i-t),o=X(s-e);return V(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>j(J(t,e,i,s),J(i,s,n,o)),getAngle:(t,e)=>Q(t,e)/B,getRotation:(t,e,i,s)=>(s||(s=e),q.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/B),getRadianFrom(t,e,i,s,n,o,a,h){r(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>G(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=Q(t,e);return(e=s?e:{}).x=t.x+Y(n)*i,e.y=t.y+N(n)*i,e},toNumberPoints(t){let e=t;return _(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){q.reset(t)}},q=Z,{getDistanceFrom:J,copy:$,getAtan2:Q}=q;class tt{constructor(t,e){this.set(t,e)}set(t,e){return _(t)?Z.copy(this,t):Z.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new tt(this)}move(t,e){return Z.move(this,t,e),this}scale(t,e){return Z.scale(this,t,e),this}scaleOf(t,e,i){return Z.scaleOf(this,t,e,i),this}rotate(t,e){return Z.rotate(this,t,e),this}rotateOf(t,e){return Z.rotate(this,e,t),this}getRotation(t,e,i){return Z.getRotation(this,t,e,i)}toInnerOf(t,e){return Z.toInnerOf(this,t,e),this}toOuterOf(t,e){return Z.toOuterOf(this,t,e),this}getCenter(t){return new tt(Z.getCenter(this,t))}getDistance(t){return Z.getDistance(this,t)}getDistancePoint(t,e,i){return new tt(Z.getDistancePoint(this,t,e,i))}getAngle(t){return Z.getAngle(this,t)}getAtan2(t){return Z.getAtan2(this,t)}reset(){return Z.reset(this),this}}const et=new tt;class it{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return _(t)?W.copy(this,t):W.set(this,t,e,i,s,n,o),this}setWith(t){return W.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:o}=this;return{a:t,b:e,c:i,d:s,e:n,f:o}}clone(){return new it(this)}translate(t,e){return W.translate(this,t,e),this}translateInner(t,e){return W.translateInner(this,t,e),this}scale(t,e){return W.scale(this,t,e),this}scaleWith(t,e){return W.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return W.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return W.scaleOfInner(this,t,e,i),this}rotate(t){return W.rotate(this,t),this}rotateOfOuter(t,e){return W.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return W.rotateOfInner(this,t,e),this}skew(t,e){return W.skew(this,t,e),this}skewOfOuter(t,e,i){return W.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return W.skewOfInner(this,t,e,i),this}multiply(t){return W.multiply(this,t),this}multiplyParent(t){return W.multiplyParent(this,t),this}divide(t){return W.divide(this,t),this}divideParent(t){return W.divideParent(this,t),this}invert(){return W.invert(this),this}invertWith(){return W.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){W.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){W.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return W.setLayout(this,t,e,i),this}getLayout(t,e,i){return W.getLayout(this,t,e,i)}withScale(t,e){return W.withScale(this,t,e)}reset(){W.reset(this)}}const st=new it,nt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){ot(t,e,i),ot(t,e+s,i+n)},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:ot}=nt;var rt,at;t.Direction4=void 0,(rt=t.Direction4||(t.Direction4={}))[rt.top=0]="top",rt[rt.right=1]="right",rt[rt.bottom=2]="bottom",rt[rt.left=3]="left",t.Direction9=void 0,(at=t.Direction9||(t.Direction9={}))[at.topLeft=0]="topLeft",at[at.top=1]="top",at[at.topRight=2]="topRight",at[at.right=3]="right",at[at.bottomRight=4]="bottomRight",at[at.bottom=5]="bottom",at[at.bottomLeft=6]="bottomLeft",at[at.left=7]="left",at[at.center=8]="center",at[at["top-left"]=0]="top-left",at[at["top-right"]=2]="top-right",at[at["bottom-right"]=4]="bottom-right",at[at["bottom-left"]=6]="bottom-left";const ht=[{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}];ht.forEach(t=>t.type="percent");const lt={directionData:ht,tempPoint:{},get:dt,toPoint(t,e,i,s,n,o){const r=dt(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,n&&(o||(i.x-=n.x,i.y-=n.y),r.x&&(i.x-=1===r.x?n.width:.5===r.x?r.x*n.width:0),r.y&&(i.y-=1===r.y?n.height:.5===r.y?r.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),lt.toPoint(t,e,i,!0),i)};function dt(e){return h(e)?ht[t.Direction9[e]]:e}const{toPoint:ct}=lt,ut={toPoint(t,e,i,s,n,o){ct(t,i,s,n,e,o)}},{tempPointBounds:pt,setPoint:_t,addPoint:gt,toBounds:ft}=nt,{toOuterPoint:yt}=W,{float:mt,fourNumber:vt}=E,{floor:wt,ceil:xt}=Math;let bt,Et,kt,Bt;const St={},Tt={},Pt={},Rt={tempBounds:Pt,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:o,y:r,width:a,height:h}=e;if(p(i)){const e=vt(i);s?Lt.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Lt.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Lt.set(t,o-i,r-i,a+2*i,h+2*i);n&&("width"===n?(t.y=r,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},getByMove:(t,e,i)=>(t=Object.assign({},t),Lt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Ot(e,t):e=t,i?(e.offsetX=-(Lt.maxX(i)-t.x),e.offsetY=-(Lt.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Lt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||Z.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){Z.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Lt.copy(Pt,t),Lt.toOuterOf(Pt,e),Pt),getOuterOf:(t,e)=>(t=Object.assign({},t),Lt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n}=e;s>0?(i.width=t.width*s,i.x=e.e+t.x*s):(i.width=t.width*-s,i.x=e.e+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=e.f+t.y*n):(i.height=t.height*-n,i.y=e.f+t.y*n-i.height)}else St.x=t.x,St.y=t.y,yt(e,St,Tt),_t(pt,Tt.x,Tt.y),St.x=t.x+t.width,yt(e,St,Tt),gt(pt,Tt.x,Tt.y),St.y=t.y+t.height,yt(e,St,Tt),gt(pt,Tt.x,Tt.y),St.x=t.x,yt(e,St,Tt),gt(pt,Tt.x,Tt.y),ft(pt,i)},toInnerOf(t,e,i){i||(i=t),Lt.move(i,-e.e,-e.f),Lt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Lt.getFitScale(t,e));return new it(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,o){o||(o=e),h(s)&&(s=Lt.getFitScale(t,e,"cover"===s)),Pt.width=n?e.width*=s:e.width*s,Pt.height=n?e.height*=s:e.height*s,ut.toPoint(i,Pt,t,o,!0,!0)},getSpread(t,e,i){const s={};return Lt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Lt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Lt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=wt(t.x),t.y=wt(t.y),t.width=e>t.x?xt(t.width+e-t.x):xt(t.width),t.height=i>t.y?xt(t.height+i-t.y):xt(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=mt(t.x,e),t.y=mt(t.y,e),t.width=mt(t.width,e),t.height=mt(t.height,e)},add(t,e,i){bt=t.x+t.width,Et=t.y+t.height,kt=e.x,Bt=e.y,i||(kt+=e.width,Bt+=e.height),bt=bt>kt?bt:kt,Et=Et>Bt?Et:Bt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=bt-t.x,t.height=Et-t.y},addList(t,e){Lt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Lt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Lt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,o=!0;for(let r=0,a=e.length;r<a;r++)n=i?i(e[r],r):e[r],n&&(n.width||n.height)&&(o?(o=!1,s||Ot(t,n)):Ct(t,n));o&&Lt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?_t(pt,t.x,t.y):gt(pt,t.x,t.y)),ft(pt,t)},setPoint(t,e){Lt.set(t,e.x,e.y)},addPoint(t,e){Ct(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=Z.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=Z.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Lt.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Lt.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Lt.tempToOuterOf(e,i)),!Lt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return bt=s+o,Et=n+r,kt=t.x+t.width,Bt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,bt=bt<kt?bt:kt,Et=Et<Bt?Et:Bt,o=bt-s,r=Et-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){Lt.copy(t,Lt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Lt.set(t)}},Lt=Rt,{add:Ct,copy:Ot}=Lt;class At{get minX(){return Rt.minX(this)}get minY(){return Rt.minY(this)}get maxX(){return Rt.maxX(this)}get maxY(){return Rt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return _(t)?Rt.copy(this,t):Rt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new At(this)}move(t,e){return Rt.move(this,t,e),this}scale(t,e,i){return Rt.scale(this,t,e,i),this}scaleOf(t,e,i){return Rt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Rt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Rt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Rt.getFitMatrix(this,t,e)}put(t,e,i){Rt.put(this,t,e,i)}spread(t,e){return Rt.spread(this,t,e),this}shrink(t,e){return Rt.shrink(this,t,e),this}ceil(){return Rt.ceil(this),this}unsign(){return Rt.unsign(this),this}float(t){return Rt.float(this,t),this}add(t){return Rt.add(this,t),this}addList(t){return Rt.setList(this,t,!0),this}setList(t){return Rt.setList(this,t),this}addListWithFn(t,e){return Rt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Rt.setListWithFn(this,t,e),this}setPoint(t){return Rt.setPoint(this,t),this}setPoints(t){return Rt.setPoints(this,t),this}addPoint(t){return Rt.addPoint(this,t),this}getPoints(){return Rt.getPoints(this)}hitPoint(t,e){return Rt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Rt.hitRadiusPoint(this,t,e)}hit(t,e){return Rt.hit(this,t,e)}includes(t,e){return Rt.includes(this,t,e)}intersect(t,e){return Rt.intersect(this,t,e),this}getIntersect(t,e){return new At(Rt.getIntersectData(this,t,e))}isSame(t){return Rt.isSame(this,t)}isEmpty(){return Rt.isEmpty(this)}reset(){Rt.reset(this)}}const Dt=new At;class Mt{constructor(t,e,i,s,n,o){_(t)?this.copy(t):this.set(t,e,i,s,n,o)}set(t=0,e=0,i=0,s=0,n=0,o=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=o}copy(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=t;this.set(e,i,s,n,o,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:o,height:r}=this;return new At(n,e,o||t.width-n-i,r||t.height-e-s)}}const It={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Ft}=E;class Wt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Wt(t)}static set filter(t){this.filterList=zt(t)}static set exclude(t){this.excludeList=zt(t)}static drawRepaint(t,e){const i=Ft();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Wt.showBounds,n=t.__nowWorld,o=Ft();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),s?e.stroke():e.strokeWorld(n,o)}log(...t){if(Ut.enable){if(Ut.filterList.length&&Ut.filterList.every(t=>t!==this.name))return;if(Ut.excludeList.length&&Ut.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Ut.enable&&this.warn(...t)}warn(...t){Ut.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 zt(t){return t?h(t)&&(t=[t]):t=[],t}Wt.filterList=[],Wt.excludeList=[],Wt.showWarn=!0;const Ut=Wt,Ht=Wt.get("RunTime"),Nt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=i.create(i.RUNTIME);return Yt.currentId=Yt.idMap[s]=e?performance.now():Date.now(),Yt.currentName=Yt.nameMap[s]=t,Yt.nameToIdMap[t]=s,s},end(t,e){const i=Yt.idMap[t],s=Yt.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;Yt.idMap[t]=Yt.nameMap[t]=Yt.nameToIdMap[s]=void 0,Ht.log(s,n,"ms")},endOfName(t,e){const i=Yt.nameToIdMap[t];r(i)||Yt.end(i,e)}},Yt=Nt,Xt=[],Vt={list:{},add(t,...e){this.list[t]=!0,Xt.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>Xt.forEach(t=>Vt.has(t,!0)));const Gt={editor:t=>Vt.need("editor")},jt=Wt.get("UICreator"),Kt={list:{},register(t){const{__tag:e}=t.prototype;Zt[e]&&jt.repeat(e),Zt[e]=t},get(t,e,i,s,n,o){Zt[t]||jt.error("not register "+t);const a=new Zt[t](e);return r(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),o&&(a.height=o)),a}},{list:Zt}=Kt,qt=Wt.get("EventCreator"),Jt={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],h(e)&&($t[e]&&qt.repeat(e),$t[e]=t)})},changeName(t,e){const i=$t[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,$t[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new $t[t](...e)},{nameList:$t}=Jt;class Qt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=Gt.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function te(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}function ee(t,e,i,s){return new(i||(i=Promise))(function(n,o){function r(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}function ie(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const se=[];function ne(){return(t,e)=>{se.push(e)}}const oe=[];class re{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||oe)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;se.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,o){_(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,o,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,o+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,n,o,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,o){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,o){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,o,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,o){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}te([ie("imageSmoothingEnabled")],re.prototype,"smooth",void 0),te([ie("imageSmoothingQuality")],re.prototype,"smoothLevel",void 0),te([ie("globalAlpha")],re.prototype,"opacity",void 0),te([ie()],re.prototype,"fillStyle",void 0),te([ie()],re.prototype,"strokeStyle",void 0),te([ie("lineWidth")],re.prototype,"strokeWidth",void 0),te([ie("lineCap")],re.prototype,"strokeCap",void 0),te([ie("lineJoin")],re.prototype,"strokeJoin",void 0),te([ie("lineDashOffset")],re.prototype,"dashOffset",void 0),te([ie()],re.prototype,"miterLimit",void 0),te([ie()],re.prototype,"shadowBlur",void 0),te([ie()],re.prototype,"shadowColor",void 0),te([ie()],re.prototype,"shadowOffsetX",void 0),te([ie()],re.prototype,"shadowOffsetY",void 0),te([ie()],re.prototype,"filter",void 0),te([ie()],re.prototype,"font",void 0),te([ie()],re.prototype,"fontKerning",void 0),te([ie()],re.prototype,"fontStretch",void 0),te([ie()],re.prototype,"fontVariantCaps",void 0),te([ie()],re.prototype,"textAlign",void 0),te([ie()],re.prototype,"textBaseline",void 0),te([ie()],re.prototype,"textRendering",void 0),te([ie()],re.prototype,"wordSpacing",void 0),te([ie()],re.prototype,"letterSpacing",void 0),te([ie()],re.prototype,"direction",void 0),te([ne()],re.prototype,"setTransform",null),te([ne()],re.prototype,"resetTransform",null),te([ne()],re.prototype,"getTransform",null),te([ne()],re.prototype,"save",null),te([ne()],re.prototype,"restore",null),te([ne()],re.prototype,"translate",null),te([ne()],re.prototype,"scale",null),te([ne()],re.prototype,"rotate",null),te([ne()],re.prototype,"fill",null),te([ne()],re.prototype,"stroke",null),te([ne()],re.prototype,"clip",null),te([ne()],re.prototype,"fillRect",null),te([ne()],re.prototype,"strokeRect",null),te([ne()],re.prototype,"clearRect",null),te([ne()],re.prototype,"beginPath",null),te([ne()],re.prototype,"moveTo",null),te([ne()],re.prototype,"lineTo",null),te([ne()],re.prototype,"bezierCurveTo",null),te([ne()],re.prototype,"quadraticCurveTo",null),te([ne()],re.prototype,"closePath",null),te([ne()],re.prototype,"arc",null),te([ne()],re.prototype,"arcTo",null),te([ne()],re.prototype,"ellipse",null),te([ne()],re.prototype,"rect",null),te([ne()],re.prototype,"roundRect",null),te([ne()],re.prototype,"createConicGradient",null),te([ne()],re.prototype,"createLinearGradient",null),te([ne()],re.prototype,"createPattern",null),te([ne()],re.prototype,"createRadialGradient",null),te([ne()],re.prototype,"fillText",null),te([ne()],re.prototype,"measureText",null),te([ne()],re.prototype,"strokeText",null);const{copy:ae,multiplyParent:he}=W,{round:le}=Math,de={width:1,height:1,pixelRatio:1},ce=["width","height","pixelRatio"];class ue extends re{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,s){super(),this.size={},this.worldTransform={},t||(t=de),this.manager=s,this.innerId=i.create(i.CNAVAS);const{width:n,height:o,pixelRatio:r}=t;this.autoLayout=!n||!o,this.size.pixelRatio=r|e.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;y.copyAttrs(s,t,ce),ce.forEach(t=>s[t]||(s[t]=1)),this.bounds=new At(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle())}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&he(t,e,n),n.a=t.a*i,n.b=t.b*i,n.c=t.c*i,n.d=t.d*i,n.e=t.e*i,n.f=t.f*i,s&&(t.half&&t.half*i%2?(n.e=le(n.e-.5)+.5,n.f=le(n.f-.5)+.5):(n.e=le(n.e),n.f=le(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),r(e.dashPattern)||(n=e.dashPattern),r(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s){if(s&&(this.blendMode=s),e){const{pixelRatio:s}=this;i||(i=e),this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x*s,i.y*s,i.width*s,i.height*s)}else this.drawImage(t.view,0,0);s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s){if(s&&(this.blendMode=s),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,Rt.tempToOuterOf(i,e)),this.restore();else{const{pixelRatio:s}=this;this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x,i.y,i.width,i.height)}s&&(this.blendMode="source-over")}copyWorldByReset(t,e,i,s,n){this.resetTransform(),this.copyWorld(t,e,i,s),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Dt.x,Dt.y,Dt.width,Dt.height),{data:o}=n;for(let t=0,s=o.length;t<s;t+=4)i=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?i:e*(i/255));s.putImageData(n,Dt.x,Dt.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i){i&&(this.blendMode=i),this.fillStyle=e,this.setTempBounds(t),this.fillRect(Dt.x,Dt.y,Dt.width,Dt.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(Dt.x,Dt.y,Dt.width,Dt.height),i&&(this.blendMode="source-over")}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(Dt.x,Dt.y,Dt.width,Dt.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(Dt.x,Dt.y,Dt.width,Dt.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,i){Dt.set(t),i&&Dt.intersect(this.bounds),Dt.scale(this.pixelRatio),e&&Dt.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):Gt.canvas(Object.assign({},i));return n.save(),t&&(ae(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const pe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},_e={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},ge=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},_e),fe={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},ye={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},me=Object.assign(Object.assign({},ye),_e),ve=ge,we={};for(let t in ve)we[ve[t]]=t;const xe={};for(let t in ve)xe[ve[t]]=fe[t];const be={drawRoundRect(t,e,i,s,n,o){const r=E.fourNumber(o,Math.min(s/2,n/2)),a=e+s,h=i+n;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(a,i,a,h,r[1]):t.lineTo(a,i),r[2]?t.arcTo(a,h,e,h,r[2]):t.lineTo(a,h),r[3]?t.arcTo(e,h,e,i,r[3]):t.lineTo(e,h),r[0]?t.arcTo(e,i,a,i,r[0]):t.lineTo(e,i)}},{sin:Ee,cos:ke,atan2:Be,ceil:Se,abs:Te,PI:Pe,sqrt:Re,pow:Le}=Math,{setPoint:Ce,addPoint:Oe}=nt,{set:Ae,toNumberPoints:De}=Z,{M:Me,L:Ie,C:Fe,Q:We,Z:ze}=ge,Ue={},He={points(t,e,i,s){let n=De(e);if(t.push(Me,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,p,_,g,f,y=n.length;const m=!0===i?.5:i;s&&(n=[n[y-2],n[y-1],...n,n[0],n[1],n[2],n[3]],y=n.length);for(let i=2;i<y-2;i+=2)e=n[i-2],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],_=Re(Le(r-e,2)+Le(a-o,2)),g=Re(Le(h-r,2)+Le(l-a,2)),(_||g)&&(f=_+g,_=m*_/f,g=m*g/f,h-=e,l-=o,d=r-_*h,c=a-_*l,2===i?s||t.push(We,d,c,r,a):t.push(Fe,u,p,d,c,r,a),u=r+g*h,p=a+g*l);s||t.push(We,u,p,n[y-2],n[y-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(Ie,n[e],n[e+1]);s&&t.push(ze)},rect(t,e,i,s,n){pe.creator.path=t,pe.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,o){pe.creator.path=[],be.drawRoundRect(pe.creator,e,i,s,n,o),t.push(...pe.convertToCanvasData(pe.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,l,d){const c=s-e,u=n-i,p=o-s,_=r-n;let g=Be(u,c),f=Be(_,p),y=f-g;if(y<0&&(y+=S),y===Pe||Te(c+u)<1e-12||Te(p+_)<1e-12)return t&&t.push(Ie,s,n),h&&(Ce(h,e,i),Oe(h,s,n)),d&&Ae(d,e,i),void(l&&Ae(l,s,n));const m=c*_-p*u<0,v=m?-1:1,w=a/ke(y/2),x=s+w*ke(g+y/2+T*v),b=n+w*Ee(g+y/2+T*v);return g-=T*v,f-=T*v,Xe(t,x,b,a,a,0,g/B,f/B,m,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>Xe(t,e,i,s,s,0,n,o,r,a,h,l),ellipse(t,e,i,s,n,o,r,a,h,l,d,c){const u=o*B,p=Ee(u),_=ke(u);let g=r*B,f=a*B;g>Pe&&(g-=S),f<0&&(f+=S);let y=f-g;y<0?y+=S:y>S&&(y-=S),h&&(y-=S);const m=Se(Te(y/T)),v=y/m,w=Ee(v/4),x=8/3*w*w/Ee(v/2);f=g+v;let b,E,k,P,R,L,C,O,A=ke(g),D=Ee(g),M=k=_*s*A-p*n*D,I=P=p*s*A+_*n*D,F=e+k,W=i+P;t&&t.push(t.length?Ie:Me,F,W),l&&Ce(l,F,W),c&&Ae(c,F,W);for(let o=0;o<m;o++)b=ke(f),E=Ee(f),k=_*s*b-p*n*E,P=p*s*b+_*n*E,R=e+M-x*(_*s*D+p*n*A),L=i+I-x*(p*s*D-_*n*A),C=e+k+x*(_*s*E+p*n*b),O=i+P+x*(p*s*E-_*n*b),t&&t.push(Fe,R,L,C,O,e+k,i+P),l&&Ye(e+M,i+I,R,L,C,O,e+k,i+P,l,!0),M=k,I=P,A=b,D=E,g=f,f+=v;d&&Ae(d,e+k,i+P)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(Fe,(e+2*s)/3,(i+2*n)/3,(o+2*s)/3,(r+2*n)/3,o,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,o,r,a){Ye(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(o+2*s)/3,n,o,r,a)},toTwoPointBounds(t,e,i,s,n,o,r,a,h,l){const d=[];let c,u,p,_,g,f,y,m,v=t,w=i,x=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=o,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,p=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else y=u*u-4*p*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?Oe(h,t,e):Ce(h,t,e),Oe(h,r,a);for(let l=0,c=d.length;l<c;l++)Ne(d[l],t,e,i,s,n,o,r,a,Ue),Oe(h,Ue.x,Ue.y)},getPointAndSet(t,e,i,s,n,o,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=c*e+u*s+p*o+_*a,l.y=c*i+u*n+p*r+_*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return Ne(t,e,i,s,n,o,r,a,h,l),l},getDerivative(t,e,i,s,n){const o=1-t;return 3*o*o*(i-e)+6*o*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:Ne,toTwoPointBounds:Ye,ellipse:Xe}=He,{sin:Ve,cos:Ge,sqrt:je,atan2:Ke}=Math,{ellipse:Ze}=He,qe={ellipticalArc(t,i,s,n,o,r,a,h,l,d,c){const u=(l-i)/2,p=(d-s)/2,_=r*B,g=Ve(_),f=Ge(_),y=-f*u-g*p,m=-f*p+g*u,v=n*n,w=o*o,x=m*m,b=y*y,E=v*w-v*x-w*b;let k=0;if(E<0){const t=je(1-E/(v*w));n*=t,o*=t}else k=(a===h?-1:1)*je(E/(v*x+w*b));const T=k*n*m/o,P=-k*o*y/n,R=Ke((m-P)/o,(y-T)/n),L=Ke((-m-P)/o,(-y-T)/n);let C=L-R;0===h&&C>0?C-=S:1===h&&C<0&&(C+=S);const O=i+u+f*T-g*P,A=s+p+g*T+f*P,D=C<0?1:0;c||e.ellipseToCurve?Ze(t,O,A,n,o,r,R/B,L/B,D):n!==o||r?t.push(ge.G,O,A,n,o,r,R/B,L/B,D):t.push(ge.O,O,A,n,R/B,L/B,D)}},{M:Je,m:$e,L:Qe,l:ti,H:ei,h:ii,V:si,v:ni,C:oi,c:ri,S:ai,s:hi,Q:li,q:di,T:ci,t:ui,A:pi,a:_i,Z:gi,z:fi,N:yi,D:mi,X:vi,G:wi,F:xi,O:bi,P:Ei,U:ki}=ge,{rect:Bi,roundRect:Si,arcTo:Ti,arc:Pi,ellipse:Ri,quadraticCurveTo:Li}=He,{ellipticalArc:Ci}=qe,Oi=Wt.get("PathConvert"),Ai={},Di={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=xe[s],a+=s===n?" ":we[s];for(let s=1;s<i;s++)a+=E.float(t[o+s],e),s===i-1||(a+=" ");n=s,o+=i}return a},parse(t,e){let i,s,n,o="";const r=[],a=e?me:ye;for(let e=0,h=t.length;e<h;e++)s=t[e],It[s]?("."===s&&(Mi.dot&&(Ii(r,o),o=""),Mi.dot++),"0"===o&&"."!==s&&(Ii(r,o),o=""),o+=s):ge[s]?(o&&(Ii(r,o),o=""),Mi.name=ge[s],Mi.length=fe[s],Mi.index=0,Ii(r,Mi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&Ii(r,o),o=s):o&&(Ii(r,o),o=""),n=s;return o&&Ii(r,o),i?Di.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,n,o,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(n=t[c],n){case $e:t[c+1]+=a,t[c+2]+=h;case Je:a=t[c+1],h=t[c+2],p.push(Je,a,h),c+=3;break;case ii:t[c+1]+=a;case ei:a=t[c+1],p.push(Qe,a,h),c+=2;break;case ni:t[c+1]+=h;case si:h=t[c+1],p.push(Qe,a,h),c+=2;break;case ti:t[c+1]+=a,t[c+2]+=h;case Qe:a=t[c+1],h=t[c+2],p.push(Qe,a,h),c+=3;break;case hi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=ai;case ai:r=o===oi||o===ai,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(oi,l,d,i,s,a,h),c+=5;break;case ri:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=oi;case oi:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(oi,t[c+1],t[c+2],i,s,a,h),c+=7;break;case ui:t[c+1]+=a,t[c+2]+=h,n=ci;case ci:r=o===li||o===ci,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Li(p,a,h,i,s,t[c+1],t[c+2]):p.push(li,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case di:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=li;case li:i=t[c+1],s=t[c+2],e?Li(p,a,h,i,s,t[c+3],t[c+4]):p.push(li,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case _i:t[c+6]+=a,t[c+7]+=h;case pi:Ci(p,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 fi:case gi:p.push(gi),c++;break;case yi:a=t[c+1],h=t[c+2],e?Bi(p,a,h,t[c+3],t[c+4]):Fi(p,t,c,5),c+=5;break;case mi:a=t[c+1],h=t[c+2],e?Si(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Fi(p,t,c,9),c+=9;break;case vi:a=t[c+1],h=t[c+2],e?Si(p,a,h,t[c+3],t[c+4],t[c+5]):Fi(p,t,c,6),c+=6;break;case wi:Ri(e?p:Fi(p,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Ai),a=Ai.x,h=Ai.y,c+=9;break;case xi:e?Ri(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Fi(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case bi:Pi(e?p:Fi(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ai),a=Ai.x,h=Ai.y,c+=7;break;case Ei:e?Pi(p,t[c+1],t[c+2],t[c+3],0,360,!1):Fi(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case ki:Ti(e?p:Fi(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ai),a=Ai.x,h=Ai.y,c+=6;break;default:return Oi.error(`command: ${n} [index:${c}]`,t),p}o=n}return p},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(Je,t.x,t.y);break;case"L":e.push(Qe,t.x,t.y);break;case"C":e.push(oi,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(li,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(gi)}}),e},copyData(t,e,i,s){for(let n=i,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){Mi.index===Mi.length&&(Mi.index=1,t.push(Mi.name)),t.push(Number(e)),Mi.index++,Mi.dot=0}},{current:Mi,pushData:Ii,copyData:Fi}=Di,{M:Wi,L:zi,C:Ui,Q:Hi,Z:Ni,N:Yi,D:Xi,X:Vi,G:Gi,F:ji,O:Ki,P:Zi,U:qi}=ge,{getMinDistanceFrom:Ji,getRadianFrom:$i}=Z,{tan:Qi,min:ts,abs:es}=Math,is={},ss={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Wi,e,i)},lineTo(t,e,i){t.push(zi,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(Ui,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(Hi,e,i,s,n)},closePath(t){t.push(Ni)},rect(t,e,i,s,n){t.push(Yi,e,i,s,n)},roundRect(t,e,i,s,n,o){if(d(o))t.push(Vi,e,i,s,n,o);else{const r=E.fourNumber(o);r?t.push(Xi,e,i,s,n,...r):t.push(Yi,e,i,s,n)}},ellipse(t,e,i,s,n,o,r,h,l){a(o)?t.push(ji,e,i,s,n):(a(r)&&(r=0),a(h)&&(h=360),t.push(Gi,e,i,s,n,o,r,h,l?1:0))},arc(t,e,i,s,n,o,r){a(n)?t.push(Zi,e,i,s):(a(o)&&(o=360),t.push(Ki,e,i,s,n,o,r?1:0))},arcTo(t,e,i,s,n,o,a,h){if(!r(a)){const t=Ji(a,h,e,i,s,n);o=ts(o,ts(t/2,t/2*es(Qi($i(a,h,e,i,s,n)/2))))}t.push(qi,e,i,s,n,o)},drawEllipse(t,e,i,s,n,o,r,h,l){He.ellipse(null,e,i,s,n,a(o)?0:o,a(r)?0:r,a(h)?360:h,l,null,null,is),t.push(Wi,is.x,is.y),ns(t,e,i,s,n,o,r,h,l)},drawArc(t,e,i,s,n,o,r){He.arc(null,e,i,s,a(n)?0:n,a(o)?360:o,r,null,null,is),t.push(Wi,is.x,is.y),os(t,e,i,s,n,o,r)},drawPoints(t,e,i,s){He.points(t,e,i,s)}},{ellipse:ns,arc:os}=ss,{moveTo:rs,lineTo:as,quadraticCurveTo:hs,bezierCurveTo:ls,closePath:ds,beginPath:cs,rect:us,roundRect:ps,ellipse:_s,arc:gs,arcTo:fs,drawEllipse:ys,drawArc:ms,drawPoints:vs}=ss;class ws{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?h(t)?pe.parse(t):t:[],this}beginPath(){return cs(this.__path),this.paint(),this}moveTo(t,e){return rs(this.__path,t,e),this.paint(),this}lineTo(t,e){return as(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return ls(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return hs(this.__path,t,e,i,s),this.paint(),this}closePath(){return ds(this.__path),this.paint(),this}rect(t,e,i,s){return us(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return ps(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return _s(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return gs(this.__path,t,e,i,s,n,o),this.paint(),this}arcTo(t,e,i,s,n){return fs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return ys(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return ms(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return vs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:xs,L:bs,C:Es,Q:ks,Z:Bs,N:Ss,D:Ts,X:Ps,G:Rs,F:Ls,O:Cs,P:Os,U:As}=ge,Ds=Wt.get("PathDrawer"),Ms={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case xs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case bs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Es:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case ks:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Bs:t.closePath(),s+=1;break;case Ss:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ts:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Ps:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Rs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*B,e[s+6]*B,e[s+7]*B,e[s+8]),s+=9;break;case Ls:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,S,!1),s+=5;break;case Cs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*B,e[s+5]*B,e[s+6]),s+=7;break;case Os:t.arc(e[s+1],e[s+2],e[s+3],0,S,!1),s+=4;break;case As:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Ds.error(`command: ${i} [index:${s}]`,e)}}},{M:Is,L:Fs,C:Ws,Q:zs,Z:Us,N:Hs,D:Ns,X:Ys,G:Xs,F:Vs,O:Gs,P:js,U:Ks}=ge,{toTwoPointBounds:Zs,toTwoPointBoundsByQuadraticCurve:qs,arcTo:Js,arc:$s,ellipse:Qs}=He,{addPointBounds:tn,copy:en,addPoint:sn,setPoint:nn,addBounds:on,toBounds:rn}=nt,an=Wt.get("PathBounds");let hn,ln,dn;const cn={},un={},pn={},_n={toBounds(t,e){_n.toTwoPointBounds(t,un),rn(un,e)},toTwoPointBounds(t,e){if(!t||!t.length)return nn(e,0,0);let i,s,n,o,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===Us||r===Ws||r===zs?nn(e,h,l):nn(e,t[a+1],t[a+2])),r){case Is:case Fs:h=t[a+1],l=t[a+2],sn(e,h,l),a+=3;break;case Ws:n=t[a+5],o=t[a+6],Zs(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,cn),tn(e,cn),h=n,l=o,a+=7;break;case zs:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],qs(h,l,i,s,n,o,cn),tn(e,cn),h=n,l=o,a+=5;break;case Us:a+=1;break;case Hs:h=t[a+1],l=t[a+2],on(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ns:case Ys:h=t[a+1],l=t[a+2],on(e,h,l,t[a+3],t[a+4]),a+=r===Ns?9:6;break;case Xs:Qs(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],cn,pn),0===a?en(e,cn):tn(e,cn),h=pn.x,l=pn.y,a+=9;break;case Vs:h=t[a+1],l=t[a+2],ln=t[a+3],dn=t[a+4],on(e,h-ln,l-dn,2*ln,2*dn),h+=ln,a+=5;break;case Gs:$s(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],cn,pn),0===a?en(e,cn):tn(e,cn),h=pn.x,l=pn.y,a+=7;break;case js:h=t[a+1],l=t[a+2],hn=t[a+3],on(e,h-hn,l-hn,2*hn,2*hn),h+=hn,a+=4;break;case Ks:Js(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],cn,pn),0===a?en(e,cn):tn(e,cn),h=pn.x,l=pn.y,a+=6;break;default:return void an.error(`command: ${r} [index:${a}]`,t)}}},{M:gn,L:fn,Z:yn}=ge,{getCenterX:mn,getCenterY:vn}=Z,{arcTo:wn}=ss,xn={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0,_=0;const g=t.length,f=[];for(;r<g;){switch(s=t[r],s){case gn:l=p=t[r+1],d=_=t[r+2],r+=3,t[r]===fn?(c=t[r+1],u=t[r+2],f.push(gn,mn(l,c),vn(d,u))):f.push(gn,l,d);break;case fn:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case fn:wn(f,a,h,t[r+1],t[r+2],e,p,_);break;case yn:wn(f,a,h,l,d,e,p,_);break;default:f.push(fn,a,h)}p=a,_=h;break;case yn:n!==yn&&(wn(f,l,d,c,u,e,p,_),f.push(yn)),r+=1;break;default:o=xe[s];for(let e=0;e<o;e++)f.push(t[r+e]);r+=o}n=s}return s!==yn&&(f[1]=l,f[2]=d),f}};pe.creator=new ws,pe.parse=Di.parse,pe.convertToCanvasData=Di.toCanvasData;const bn=new ws,{drawRoundRect:En}=be;function kn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){En(this,t,e,i,s,n)})}(t)}const Bn={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Sn.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{}}}},Sn=Bn;Sn.alphaPixelTypes.forEach(t=>Sn.upperCaseTypeMap[t]=t.toUpperCase());const Tn=Wt.get("TaskProcessor");class Pn{constructor(t){this.parallel=!0,this.time=1,this.id=i.create(i.TASK),this.task=t}run(){return ee(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Tn.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Rn{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&y.assign(this.config,t),this.empty()}add(t,e){let i,s,n,o;const a=new Pn(t);return a.parent=this,d(e)?o=e:e&&(s=e.parallel,i=e.start,n=e.time,o=e.delay),n&&(a.time=n),!1===s&&(a.parallel=!1),r(o)?this.push(a,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,i))},o)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let i=this.index;i<e&&(t=this.list[i],t.parallel);i++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Ln=Wt.get("Resource"),Cn={tasker:new Rn,map:{},get isComplete(){return On.tasker.isComplete},set(t,e){On.map[t]&&Ln.repeat(t),On.map[t]=e},get:t=>On.map[t],remove(t){const e=On.map[t];e&&(e.destroy&&e.destroy(),delete On.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return h(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=Gt.image(s)),On.set(t,e),e},destroy(){On.map={}}},On=Cn,An={maxRecycled:10,recycledList:[],patternTasker:new Rn,get(t){let e=Cn.get(t.url);return e||Cn.set(t.url,e=Gt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Dn.recycledList.push(t)})},clearRecycled(){const t=Dn.recycledList;t.length>Dn.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Cn.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Bn.alphaPixelTypes.some(e=>Dn.isFormat(e,t)),isFormat(t,e){if(e.format===t)return!0;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Bn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Bn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Dn.recycledList=[]}},Dn=An,{IMAGE:Mn,create:In}=i,{floor:Fn,max:Wn}=Math;class zn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=In(Mn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}An.isFormat("svg",t)&&(this.isSVG=!0),An.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,i){if(!this.loading){this.loading=!0;let{loadImage:t,loadImageWithProgress:i}=e.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(t=i),Cn.tasker.add(()=>ee(this,void 0,void 0,function*(){return yield t(this.url,s).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,i,s,n,o,r){if(t||(t=this.width),i||(i=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const a=e.origin.createCanvas(Wn(Fn(t+(o||0)),1),Wn(Fn(i+(r||0)),1)),h=a.getContext("2d");return s&&(h.globalAlpha=s),h.drawImage(this.view,0,0,t,i),this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,i,s,n){const o=e.canvas.createPattern(t,i);try{s&&o.setTransform&&(o.setTransform(s),s=void 0)}catch(t){}return n&&y.stintSet(n,"transform",s),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Un(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Hn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Nn(t,e){const i="_"+t;return{get(){const t=this[i];return r(t)?e:t},set(t){this[i]=t}}}function Yn(t,e){return(i,s)=>Vn(i,s,t,e&&e(s))}function Xn(t){return t}function Vn(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Un(t,e,Object.assign(n,s||{})),mo(t,e,i)}function Gn(t){return Yn(t)}function jn(t,e){return Yn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Kn(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Qn(this))}}))}function Zn(t,e){return Yn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function qn(t,e){return Yn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function Jn(t,e){return Yn(t,t=>({set(i){this.__setAttr(t,i,e)&&Qn(this)}}))}function $n(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&(Qn(this),this.__.__removeNaturalSize())}}))}function Qn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function to(t){return Yn(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Qn(this)}}))}const eo=Jn;function io(t,e){return Yn(t,t=>({set(i){this.__setAttr(t,i)&&(so(this),e&&(this.__.__useStroke=!0))}}))}function so(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Qn(t)}const no=io;function oo(t){return Yn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function ro(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function ao(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&lo(this)}}))}function ho(t){return Yn(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>co(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");co(this,t,e,i),this.mask&&lo(this)}}))}function lo(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function co(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||Qn(t))}function uo(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function po(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function _o(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function go(t){return Yn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Wt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function fo(t){return Yn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function yo(t){return(e,i)=>{Un(e,"__DataProcessor",{get:()=>t})}}function mo(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Nn(e,i);if(r(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){let t=this[n];return void 0===t?i(this.__leaf):t};else if(_(i)){const t=f(i);a.get=function(){let e=this[n];return void 0===e?this[n]=t?{}:y.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(void 0===t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(void 0===t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=Hn(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[o]&&(a.set=s[o],delete s[o]),Un(s,e,a)}const vo=new Wt("rewrite"),wo=[],xo=["destroy","constructor"];function bo(t){return(e,i)=>{wo.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Eo(){return t=>{ko()}}function ko(t){wo.length&&(wo.forEach(e=>{t&&vo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),wo.length=0)}function Bo(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(xo.includes(s)||e&&e.includes(s)))if(t.prototype){Hn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function So(){return t=>{Kt.register(t)}}function To(){return t=>{Jt.register(t)}}setTimeout(()=>ko(!0));const{copy:Po,toInnerPoint:Ro,toOuterPoint:Lo,scaleOfOuter:Co,rotateOfOuter:Oo,skewOfOuter:Ao,multiplyParent:Do,divideParent:Mo,getLayout:Io}=W,Fo={},{round:Wo}=Math,zo={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),No(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Ho(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Yo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Yo(t),t.__updateChange()},updateAllChange(t){if(Vo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Xo(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,i,s,n,o,r){n||(n=t.__nowWorld),t.__worldFlipped||e.fullImageShadow?i.copyWorldByReset(s,n,t.__nowWorld,o,r):i.copyWorldToInner(s,n,t.__layout.renderBounds,o)},moveWorld(t,e,i=0,s,n){const o=_(e)?Object.assign({},e):{x:e,y:i};s?Lo(t.localTransform,o,o,!0):t.parent&&Ro(t.parent.worldTransform,o,o,!0),Uo.moveLocal(t,o.x,o.y,n)},moveLocal(t,e,i=0,s){_(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Wo(e),i=Wo(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){Uo.zoomOfLocal(t,Go(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const r=t.__localMatrix;if(d(s)||(s&&(o=s),s=i),Po(Fo,r),Co(Fo,e,i,s),t.origin||t.around)Uo.setTransform(t,Fo,n,o);else{const e=t.x+Fo.e-r.e,a=t.y+Fo.f-r.f;o&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){Uo.rotateOfLocal(t,Go(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Po(Fo,n),Oo(Fo,e,i),t.origin||t.around?Uo.setTransform(t,Fo,!1,s):t.set({x:t.x+Fo.e-n.e,y:t.y+Fo.f-n.f,rotation:E.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){Uo.skewOfLocal(t,Go(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){Po(Fo,t.__localMatrix),Ao(Fo,e,i,s),Uo.setTransform(t,Fo,n,o)},transformWorld(t,e,i,s){Po(Fo,t.worldTransform),Do(Fo,e),t.parent&&Mo(Fo,t.parent.worldTransform),Uo.setTransform(t,Fo,i,s)},transform(t,e,i,s){Po(Fo,t.localTransform),Do(Fo,e),Uo.setTransform(t,Fo,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&Uo.getInnerOrigin(t,n.origin),r=Io(e,o,n.around&&Uo.getInnerOrigin(t,n.around));if(i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,o){Rt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Uo.getInnerOrigin(t,n.origin);Z.move(r,o.x-s.x,o.y-s.y)}t.set(r),t.scaleResize(e,i,!1)}else t.set(r,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Co(i,Uo.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>Z.tempToOuterOf(Uo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return lt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Po(Fo,t.worldTransform),Mo(Fo,e.worldTransform),i?Fo:Object.assign({},Fo)),drop(t,e,i,s){t.setTransform(Uo.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,i,s=.3){if(i.x||i.y)if(Math.abs(i.x)<1&&Math.abs(i.y)<1)t.move(i);else{const n=i.x*s,o=i.y*s;i.x-=n,i.y-=o,t.move(n,o),e.requestRender(()=>Uo.animateMove(t,i,s))}}},Uo=zo,{updateAllMatrix:Ho,updateMatrix:No,updateAllWorldOpacity:Yo,updateAllChange:Xo,updateChange:Vo}=Uo;function Go(t,e){return t.__layout.update(),t.parent?Z.tempToInnerOf(e,t.parent.__world):e}const jo={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>Zo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>Zo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>Zo(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let Ko;function Zo(t,e){return e||(Ko=0),t.__.mask&&(Ko=1),Ko<0?null:(Ko&&(Ko=-1),!0)}const{updateBounds:qo}=zo,Jo={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),$o(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&r(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)Qo(e[t],e)},updateBounds(t,e){const i=[t];Qo(t,i),tr(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)qo(s[t]);e&&e===i||qo(i)}}},{pushAllChildBranch:$o,pushAllBranchStack:Qo,updateBoundsByBranchStack:tr}=Jo,er={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:ir,updateBounds:sr}=zo,{toOuterOf:nr,getPoints:or,copy:rr}=Rt,ar="_localContentBounds",hr="_worldContentBounds",lr="_worldBoxBounds",dr="_worldStrokeBounds";class cr{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return nr(this.contentBounds,this.leaf.__localMatrix,this[ar]||(this[ar]={})),this[ar]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return nr(this.contentBounds,this.leaf.__world,this[hr]||(this[hr]={})),this[hr]}get worldBoxBounds(){return nr(this.boxBounds,this.leaf.__world,this[lr]||(this[lr]={})),this[lr]}get worldStrokeBounds(){return nr(this.strokeBounds,this.leaf.__world,this[dr]||(this[dr]={})),this[dr]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:i}=t;if(t.isApp)return sr(t);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=t;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,e.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return W.defaultMatrix;case"page":t=e.zoomLayer;default:return ir(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 At(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,o,r,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),o=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,o=W.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=ir(s,e,!0)}if(r||(r=W.getLayout(o)),rr(r,a),Z.copy(r,n),i){const{scaleX:t,scaleY:e}=r,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(r.scaleX/=i,r.scaleY/=s,r.width*=i,r.height*=s)}return r}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=or(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return r(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.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=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class ur{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.event.stop(this.origin)}}class pr extends ur{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}pr.ADD="child.add",pr.REMOVE="child.remove",pr.CREATED="created",pr.MOUNTED="mounted",pr.UNMOUNTED="unmounted",pr.DESTROY="destroy";class _r extends ur{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}_r.CHANGE="property.change",_r.LEAFER_CHANGE="property.leafer_change";class gr extends ur{constructor(t,e){super(t),Object.assign(this,e)}}gr.LOAD="image.load",gr.LOADED="image.loaded",gr.ERROR="image.error";class fr extends ur{static checkHas(t,e,i){"on"===i?e===wr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(yr)||t.hasEvent(mr)||t.hasEvent(vr),t.__hasWorldEvent=t.hasEvent(wr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(yr,t),"inner"===e&&t.emit(mr,t)),t.emit(vr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(wr,this)}}fr.RESIZE="bounds.resize",fr.INNER="bounds.inner",fr.LOCAL="bounds.local",fr.WORLD="bounds.world";const{RESIZE:yr,INNER:mr,LOCAL:vr,WORLD:wr}=fr,xr={};[yr,mr,vr,wr].forEach(t=>xr[t]=1);class br extends ur{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){_(t)?(super(br.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!r(this.resizingKeys[t.innerId])}}br.RESIZE="resize";class Er extends ur{constructor(t,e){super(t),this.data=e}}Er.REQUEST="watch.request",Er.DATA="watch.data";class kr extends ur{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}kr.REQUEST="layout.request",kr.START="layout.start",kr.BEFORE="layout.before",kr.LAYOUT="layout",kr.AFTER="layout.after",kr.AGAIN="layout.again",kr.END="layout.end";class Br extends ur{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Br.REQUEST="render.request",Br.CHILD_START="render.child_start",Br.CHILD_END="render.child_end",Br.START="render.start",Br.BEFORE="render.before",Br.RENDER="render",Br.AFTER="render.after",Br.AGAIN="render.again",Br.END="render.end",Br.NEXT="render.next";class Sr extends ur{}Sr.START="leafer.start",Sr.BEFORE_READY="leafer.before_ready",Sr.READY="leafer.ready",Sr.AFTER_READY="leafer.after_ready",Sr.VIEW_READY="leafer.view_ready",Sr.VIEW_COMPLETED="leafer.view_completed",Sr.STOP="leafer.stop",Sr.RESTART="leafer.restart",Sr.END="leafer.end",Sr.TRANSFORM="leafer.transform",Sr.MOVE="leafer.move",Sr.SCALE="leafer.scale",Sr.ROTATE="leafer.rotate",Sr.SKEW="leafer.skew";const{MOVE:Tr,SCALE:Pr,ROTATE:Rr,SKEW:Lr}=Sr,Cr={x:Tr,y:Tr,scaleX:Pr,scaleY:Pr,rotation:Rr,skewX:Lr,skewY:Lr},Or={};class Ar{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(p(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)p(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,o;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const r=Dr(this,s,!0),a=h(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};a.forEach(t=>{t&&(o=r[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):r[t]=[l],xr[t]&&fr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=h(t)?t.split(" "):t;if(e){let t,n,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=Dr(this,t);s.forEach(t=>{t&&(n=r[t],n&&(o=n.findIndex(t=>t.listener===e),o>-1&&n.splice(o,1),n.length||delete r[t],xr[t]&&fr.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):p(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=p(t)?t:[t];e.forEach(t=>{t.listener?t.current.off(t.type,t.listener,t.options):p(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3]))}),e.length=0}once(t,e,i,s){if(!e)return p(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));_(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&Jt.has(t)&&(e=Jt.get(t,{type:t,target:this,current:this}));const s=Dr(this,i)[t];if(s){let n;for(let o=0,r=s.length;o<r&&!((n=s[o])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),o--,r--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],o=s&&s[t];return!!(r(e)?n||o:e?o:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Dr(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Or)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Or)}}const{on:Mr,on_:Ir,off:Fr,off_:Wr,once:zr,emit:Ur,emitEvent:Hr,hasEvent:Nr,destroy:Yr}=Ar.prototype,Xr={on:Mr,on_:Ir,off:Fr,off_:Wr,once:zr,emit:Ur,emitEvent:Hr,hasEvent:Nr,destroyEventer:Yr},Vr=Wt.get("setAttr"),Gr={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||l(e)||r(e)||(Vr.warn(this.innerName,t,e),e=void 0),_(e)||s!==e){this.__realSetAttr(t,e);const{CHANGE:i}=_r,n=new _r(i,this,t,s,e);if(this.isLeafer){this.emitEvent(new _r(_r.LEAFER_CHANGE,this,t,s,e));const i=Cr[t];i&&(this.emitEvent(new Sr(i,this)),this.emitEvent(new Sr(Sr.TRANSFORM,this)))}else this.hasEvent(i)&&this.emitEvent(n);return this.leafer.emitEvent(n),!0}return!1}return this.__realSetAttr(t,e),!0},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||r(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:jr,multiplyParent:Kr,translateInner:Zr,defaultWorld:qr}=W,{toPoint:Jr,tempPoint:$r}=lt,Qr={__updateWorldMatrix(){const{parent:t,__layout:e}=this;Kr(this.__local||e,t?t.__world:qr,this.__world,!!e.affectScaleOrRotation,this.__,t&&(t.scrollY||t.scrollX)&&t.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(jr(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Jr(i.around||i.origin,t.boxBounds,$r),Zr(e,-$r.x,-$r.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ta,updateAllMatrix:ea}=zo,{updateBounds:ia}=Jo,{toOuterOf:sa,copyAndSpread:na,copy:oa}=Rt,{toBounds:ra}=_n,aa={__updateWorldBounds(){const t=this.__layout;sa(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&fr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&fr.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),sa(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){sa(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){sa(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?ra(e.path,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ea(this),ia(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ea(this),ia(this,this))):ta(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;na(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?na(t.renderBounds,t.boxBounds,t.renderSpread):oa(t.renderBounds,t.strokeBounds)}},ha={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),zo.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Wt.showBounds&&Wt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:la}=jo,da={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.dim?e.dimOpacity=!0===i.dim?.2:i.dim:i.dimskip&&e.dimOpacity&&(e.dimOpacity=0),i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)la(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)la(i[s],e)||i[s].__clip(t,e)}}},ca={},{LEAF:ua,create:pa}=i,{toInnerPoint:_a,toOuterPoint:ga,multiplyParent:fa}=W,{toOuterOf:ya}=Rt,{copy:ma,move:va}=Z,{moveLocal:wa,zoomOfLocal:xa,rotateOfLocal:ba,skewOfLocal:Ea,moveWorld:ka,zoomOfWorld:Ba,rotateOfWorld:Sa,skewOfWorld:Ta,transform:Pa,transformWorld:Ra,setTransform:La,getFlipTransform:Ca,getLocalOrigin:Oa,getRelativeWorld:Aa,drop:Da}=zo;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return v}get __LayoutProcessor(){return cr}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.update(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=pa(ua),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(pr.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(pr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(pr.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(pr.MOUNTED)):this.__emitLifeEvent(pr.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){r(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=r(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateContentBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return fa(i,t.matrix,e,void 0,i),ya(this.__layout.renderBounds,e,e),e.half!==i.half&&(e.half=i.half),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=An.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),ca.scaleX=i,ca.scaleY=s,ca}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?Aa(this,e):this.worldTransform,n=i?t:{};return ya(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&ma(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&ma(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),_a(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){ga(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return va(n,-o,-r),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return va(n,o,r),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){La(this,t,e,i)}transform(t,e,i){Pa(this,t,e,i)}move(t,e,i){wa(this,t,e,i)}moveInner(t,e,i){ka(this,t,e,!0,i)}scaleOf(t,e,i,s,n){xa(this,Oa(this,t),e,i,s,n)}rotateOf(t,e,i){ba(this,Oa(this,t),e,i)}skewOf(t,e,i,s,n){Ea(this,Oa(this,t),e,i,s,n)}transformWorld(t,e,i){Ra(this,t,e,i)}moveWorld(t,e,i){ka(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){Ba(this,t,e,i,s,n)}rotateOfWorld(t,e){Sa(this,t,e)}skewOfWorld(t,e,i,s,n){Ta(this,t,e,i,s,n)}flip(t,e){Pa(this,Ca(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Vt.need("path")}getMotionPoint(t){return Vt.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){Da(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):mo(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Jn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new pr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(pr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=te([Bo(Gr),Bo(Qr),Bo(aa),Bo(Xr),Bo(ha)],t.Leaf);const{setListWithFn:Ma}=Rt,{sort:Ia}=Jo,{localBoxBounds:Fa,localStrokeBounds:Wa,localRenderBounds:za,maskLocalBoxBounds:Ua,maskLocalStrokeBounds:Ha,maskLocalRenderBounds:Na}=jo,Ya=new Wt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){Ma(this.__layout.boxBounds,this.children,this.__hasMask?Ua:Fa)}__updateStrokeBounds(){Ma(this.__layout.strokeBounds,this.children,this.__hasMask?Ha:Wa)}__updateRenderBounds(){Ma(this.__layout.renderBounds,this.children,this.__hasMask?Na:za)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(Ia),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Ya.warn("add self or destroyed");const i=r(e);if(!t.__){if(p(t))return t.forEach(t=>{this.add(t,e),i||e++});t=Kt.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(pr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(pr.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):r(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(pr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(pr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new pr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=te([Bo(da)],t.Branch);class Xa{get length(){return this.list.length}constructor(t){this.reset(),t&&(p(t)?this.addList(t):this.add(t))}has(t){return t&&!r(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return r(e)?-1:e}add(t){const{list:e,keys:i}=this;r(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(r(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)r(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;r(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new Xa;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Va{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(p(t)?this.addList(t):this.add(t))}has(t){return!r(this.keys[t.innerId])}without(t){return r(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class Ga extends ue{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}kn(OffscreenCanvasRenderingContext2D.prototype),kn(Path2D.prototype);const{mineType:ja}=Bn;function Ka(t,i){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:ja(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:ja(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((i,s)=>{let n=new XMLHttpRequest;n.open("GET",e.image.getRealURL(t),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then(t=>{i(t)}).catch(t=>{s(t)})},n.onerror=t=>s(t),n.send()})},e.canvas=Gt.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(Gt,{canvas:(t,e)=>new Ga(t,e),image:t=>new zn(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},Un(e,"devicePixelRatio",{get:()=>1});const{userAgent:Za}=navigator;Za.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.fullImageShadow=!0),Za.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):Za.indexOf("Mac")>-1?e.os="Mac":Za.indexOf("Linux")>-1&&(e.os="Linux");class qa{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new Xa;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 Xa,this.target=t,e&&(this.config=y.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(Br.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===pr.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Er(Er.DATA,{updatedList:this.updatedList})),this.__updatedList=new Xa,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[_r.CHANGE,this.__onAttrChange,this],[[pr.ADD,pr.REMOVE],this.__onChildEvent,this],[Er.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Ja,updateBounds:$a,updateChange:Qa}=zo,{pushAllChildBranch:th,pushAllParent:eh}=Jo;const{worldBounds:ih}=jo;class sh{constructor(t){this.updatedBounds=new At,this.beforeBounds=new At,this.afterBounds=new At,p(t)&&(t=new Xa(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,ih)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,ih),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:nh,updateAllChange:oh}=zo,rh=Wt.get("Layouter");class ah{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new Va,this.target=t,e&&(this.config=y.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(kr.START),this.layoutOnce(),t.emitEvent(new kr(kr.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(Er.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=Nt.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=kr,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new kr(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Ja(t,!0),e.add(t),t.isBranch&&th(t,e),eh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),eh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||$a(s[t])}$a(i)}})}(this.__levelList),function(t){t.list.forEach(Qa)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new kr(o,a,this.times)),i.emitEvent(new kr(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Nt.end(e)}fullLayout(){const t=Nt.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=kr,o=this.getBlocks(new Xa(e));e.emitEvent(new kr(i,o,this.times)),ah.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new kr(s,o,this.times)),e.emitEvent(new kr(n,o,this.times)),this.addBlocks(o),Nt.end(t)}static fullLayout(t){nh(t,!0),t.isBranch?Jo.updateBounds(t):zo.updateBounds(t),oh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new sh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new sh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[kr.REQUEST,this.layout,this],[kr.AGAIN,this.layoutAgain,this],[Er.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const hh=Wt.get("Renderer");class lh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,i&&(this.config=y.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(kr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Br.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Br.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Br.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new At,hh.log(e.innerName,"---\x3e");try{this.emitRender(Br.START),this.renderOnce(t),this.emitRender(Br.END,this.totalBounds),An.clearRecycled()}catch(t){this.rendering=!1,hh.error(t)}hh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return hh.warn("rendering");if(this.times>3)return hh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new At,this.renderOptions={},t)this.emitRender(Br.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Br.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Br.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Br.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=Nt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new At(s);i.save(),s.spread(lh.clipSpread).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0),this.__render(s,n),i.restore(),Nt.end(e)}fullRender(){const t=Nt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Nt.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),Wt.showRepaint&&Wt.drawRepaint(i,t),this.target.__render(i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new At;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);const i=this.requestTime=Date.now();e.requestRender(()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()})}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new At(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new At(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||hh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Br(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Br.REQUEST,this.update,this],[kr.END,this.__onLayoutEnd,this],[Br.AGAIN,this.renderAgain,this],[br.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}lh.clipSpread=10;const{hitRadiusPoint:dh}=Rt;class ch{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Xa(i.findList),i.findList||this.hitBranch(o.isBranchLeaf?{children:[o]}:o);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,n),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i){const s=this.findList=new Xa;if(t.length){let e;const{x:n,y:o}=this.point,r={x:n,y:o,radiusX:0,radiusY:0};for(let n=0,o=t.length;n<o;n++)if(e=t[n],(i||zo.worldHittable(e))&&(this.hitChild(e,r),s.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&zo.hasParent(t,e))){s.reset();break}return s.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),s.length)return s.list[0];return i?t[0]:t.find(t=>zo.worldHittable(t))}getPath(t){const e=new Xa;for(;t;)e.add(t),t=t.parent;return this.target&&e.add(this.target),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new Xa;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren);t--);return s}getThroughPath(t){const e=new Xa,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||dh(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:o}=s;for(let s=0,r=o.length;s<r;s++)if(i=o[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class uh{constructor(t,e){this.config={},e&&(this.config=y.default(e,this.config)),this.picker=new ch(this.target=t,this),this.finder=Gt.finder&&Gt.finder()}getByPoint(t,i,s){const{target:n,picker:o}=this;return e.backgrounder&&n&&n.updateLayout(),o.getByPoint(t,i,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Vt.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function ph(t){return Yn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function _h(t){return Yn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function gh(){return(t,e)=>{const i="_"+e;Un(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(Gt,{watcher:(t,e)=>new qa(t,e),layouter:(t,e)=>new ah(t,e),renderer:(t,e,i)=>new lh(t,e,i),selector:(t,e)=>new uh(t,e)}),e.layout=ah.fullLayout;const fh={},yh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},mh={number:(t,e)=>_(t)?"percent"===t.type?t.value*e:t.value:t},vh={},wh={},xh={},bh={},Eh={},kh={apply(){Vt.need("filter")}},Bh={},Sh={setStyleName:()=>Vt.need("state"),set:()=>Vt.need("state")},Th={list:{},register(t,e){Th.list[t]=e},get:t=>Th.list[t]},{parse:Ph,objectToCanvasData:Rh}=Di,{stintSet:Lh}=y,{hasTransparent:Ch}=yh,Oh={},Ah=Wt.get("UIData");class Dh extends v{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Ah.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Ah.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),h(t)||!t?(Lh(this,"__isTransparentFill",Ch(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):_(t)&&this.__setPaint("fill",t)}setStroke(t){h(t)||!t?(Lh(this,"__isTransparentStroke",Ch(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):_(t)&&this.__setPaint("stroke",t)}setPath(t){const e=h(t);e||t&&_(t[0])?(this.__setInput("path",t),this._path=e?Ph(t):Rh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Mh(this,"shadow",t)}setInnerShadow(t){Mh(this,"innerShadow",t)}setFilter(t){Mh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&wh.compute("fill",this.__leaf),e&&wh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),r(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),p(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Oh)):(this.__isStrokes=!0,this._stroke||(this._stroke=Oh))}__removePaint(t,e){e&&this.__removeInput(t),xh.recycleImage(t,this),"fill"===t?(Lh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Lh(this,"__isAlphaPixelStroke",void 0),Lh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Mh(t,e,i){t.__setInput(e,i),p(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class Ih extends Dh{}class Fh extends Ih{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"hide"===t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Wh extends Ih{__getInputData(t,e){const i=super.__getInputData(t,e);return ce.forEach(t=>delete i[t]),i}}class zh extends Fh{}class Uh extends Dh{}class Hh extends Dh{get __boxStroke(){return!this.__pathInputed}}class Nh extends Dh{get __boxStroke(){return!this.__pathInputed}}class Yh extends Dh{}class Xh extends Dh{}class Vh extends Dh{get __pathInputed(){return 2}}class Gh extends Ih{}const jh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Kh extends Dh{get __useNaturalRatio(){return!1}setFontWeight(t){h(t)?(this.__setInput("fontWeight",t),t=jh[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=Kt.get("Rect",0);const n=e.__layout,o=i.__layout;s||(i.parent=e,i.__world=e.__world,o.boxBounds=n.boxBounds),i.set(t),o.strokeChanged&&n.strokeChange(),o.renderChanged&&n.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class Zh extends Hh{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class qh extends Hh{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const Jh={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,o=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),o&&(t=Math.max(o.__layout.strokeSpread=o.__updateStrokeSpread(),t),e=o.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:o,renderSpread:r}=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)),s&&(t=Math.max(t,s)),o&&(t+=kh.getSpread(o)),r&&(t+=r);let a=t=Math.ceil(t);return i&&i.forEach(t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),n&&(a=Math.max(a,n)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{stintSet:$h}=y,Qh={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);$h(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),$h(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;$h(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&i&&!t.__isTransparentFill&&!(p(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),$h(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){tl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:o,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=wh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Eh.shadow(this,t,h),a&&(s.__isStrokes?wh.strokes(o,this,t):wh.stroke(o,this,t)),n&&(s.__isFills?wh.fills(n,this,t):wh.fill(n,this,t)),r&&this.__drawAfterFill(t,e),d&&Eh.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?wh.strokes(o,this,t):wh.stroke(o,this,t)),c&&kh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?wh.strokes(o,this,t):wh.stroke(o,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,yh.string(e.color))}n&&(s.__isFills?wh.fills(n,this,t):wh.fill(n,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?wh.strokes(o,this,t):wh.stroke(o,this,t))}}else s.__pathInputed?tl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?wh.fills(s,this,t):wh.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?wh.strokes(n,this,t):wh.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function tl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&wh.stroke(n,t,e),s&&wh.fill(s,t,e),o&&t.__drawAfterFill(e,i),n&&!r&&wh.stroke(n,t,e)}const el={__drawFast(t,e){let{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,n,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:r,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(r){case"center":t.strokeRect(0,0,n,o);break;case"inside":n-=h,o-=h,n<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,o),t.restore()):t.strokeRect(i+l,s+l,n,o);break;case"outside":t.strokeRect(i-l,s-l,n+h,o+h)}}}};var il,sl;t.UI=il=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){E.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return bn.set(this.path=t||[]),t||this.__drawPathByBox(bn),bn}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))}get(t){return h(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Vt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Vt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(bn.set(i=[]),this.__drawPathByBox(bn)),t?Di.toCanvasData(i,!0):i}getPathString(t,e,i){return Di.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Bh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?xn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&vh.addArrows(this,!t.cornerRadius)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Ms.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,i,s,n,d(o)?[o]:o)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e){wh.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return Vt.need("animate")}killAnimate(t,e){}export(t,e){return Vt.need("export")}syncExport(t,e){return Vt.need("export")}clone(t){const e=y.clone(this.toJSON());return t&&Object.assign(e,t),il.one(e)}static one(t,e,i,s,n){return Kt.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){So()(this)}static registerData(t){yo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},te([yo(Dh)],t.UI.prototype,"__",void 0),te([gh()],t.UI.prototype,"zoomLayer",void 0),te([Gn("")],t.UI.prototype,"id",void 0),te([Gn("")],t.UI.prototype,"name",void 0),te([Gn("")],t.UI.prototype,"className",void 0),te([ro("pass-through")],t.UI.prototype,"blendMode",void 0),te([ao(1)],t.UI.prototype,"opacity",void 0),te([ho(!0)],t.UI.prototype,"visible",void 0),te([ro(!1)],t.UI.prototype,"locked",void 0),te([ro(!1)],t.UI.prototype,"dim",void 0),te([ro(!1)],t.UI.prototype,"dimskip",void 0),te([uo(0)],t.UI.prototype,"zIndex",void 0),te([po(!1)],t.UI.prototype,"mask",void 0),te([_o(!1)],t.UI.prototype,"eraser",void 0),te([jn(0,!0)],t.UI.prototype,"x",void 0),te([jn(0,!0)],t.UI.prototype,"y",void 0),te([Jn(100,!0)],t.UI.prototype,"width",void 0),te([Jn(100,!0)],t.UI.prototype,"height",void 0),te([Zn(1,!0)],t.UI.prototype,"scaleX",void 0),te([Zn(1,!0)],t.UI.prototype,"scaleY",void 0),te([qn(0,!0)],t.UI.prototype,"rotation",void 0),te([qn(0,!0)],t.UI.prototype,"skewX",void 0),te([qn(0,!0)],t.UI.prototype,"skewY",void 0),te([jn(0,!0)],t.UI.prototype,"offsetX",void 0),te([jn(0,!0)],t.UI.prototype,"offsetY",void 0),te([jn(0,!0)],t.UI.prototype,"scrollX",void 0),te([jn(0,!0)],t.UI.prototype,"scrollY",void 0),te([Kn()],t.UI.prototype,"origin",void 0),te([Kn()],t.UI.prototype,"around",void 0),te([Gn(!1)],t.UI.prototype,"lazy",void 0),te([$n(1)],t.UI.prototype,"pixelRatio",void 0),te([oo(0)],t.UI.prototype,"renderSpread",void 0),te([to()],t.UI.prototype,"path",void 0),te([eo()],t.UI.prototype,"windingRule",void 0),te([eo(!0)],t.UI.prototype,"closed",void 0),te([Jn(0)],t.UI.prototype,"padding",void 0),te([Jn(!1)],t.UI.prototype,"lockRatio",void 0),te([Jn()],t.UI.prototype,"widthRange",void 0),te([Jn()],t.UI.prototype,"heightRange",void 0),te([Gn(!1)],t.UI.prototype,"draggable",void 0),te([Gn()],t.UI.prototype,"dragBounds",void 0),te([Gn(!1)],t.UI.prototype,"editable",void 0),te([go(!0)],t.UI.prototype,"hittable",void 0),te([go("path")],t.UI.prototype,"hitFill",void 0),te([no("path")],t.UI.prototype,"hitStroke",void 0),te([go(!1)],t.UI.prototype,"hitBox",void 0),te([go(!0)],t.UI.prototype,"hitChildren",void 0),te([go(!0)],t.UI.prototype,"hitSelf",void 0),te([go()],t.UI.prototype,"hitRadius",void 0),te([fo("")],t.UI.prototype,"cursor",void 0),te([ro()],t.UI.prototype,"fill",void 0),te([no(void 0,!0)],t.UI.prototype,"stroke",void 0),te([no("inside")],t.UI.prototype,"strokeAlign",void 0),te([no(1,!0)],t.UI.prototype,"strokeWidth",void 0),te([no(!1)],t.UI.prototype,"strokeWidthFixed",void 0),te([no("none")],t.UI.prototype,"strokeCap",void 0),te([no("miter")],t.UI.prototype,"strokeJoin",void 0),te([no()],t.UI.prototype,"dashPattern",void 0),te([no(0)],t.UI.prototype,"dashOffset",void 0),te([no(10)],t.UI.prototype,"miterLimit",void 0),te([eo(0)],t.UI.prototype,"cornerRadius",void 0),te([eo()],t.UI.prototype,"cornerSmoothing",void 0),te([ph()],t.UI.prototype,"shadow",void 0),te([ph()],t.UI.prototype,"innerShadow",void 0),te([ph()],t.UI.prototype,"blur",void 0),te([ph()],t.UI.prototype,"backgroundBlur",void 0),te([ph()],t.UI.prototype,"grayscale",void 0),te([ph()],t.UI.prototype,"filter",void 0),te([ro()],t.UI.prototype,"placeholderColor",void 0),te([Gn(100)],t.UI.prototype,"placeholderDelay",void 0),te([Gn({})],t.UI.prototype,"data",void 0),te([bo(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=il=te([Bo(Jh),Bo(Qh),Eo()],t.UI),t.Group=class extends t.UI{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,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},te([yo(Ih)],t.Group.prototype,"__",void 0),te([Jn(0)],t.Group.prototype,"width",void 0),te([Jn(0)],t.Group.prototype,"height",void 0),t.Group=te([Bo(t.Branch),So()],t.Group);const nl=Wt.get("Leafer");t.Leafer=sl=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Cn.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),sl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,y.assign(s,t));const n=this.canvas=Gt.canvas(s);this.__controllers.push(this.renderer=Gt.renderer(this,n,s),this.watcher=Gt.watcher(this,s),this.layouter=Gt.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=n.view,e||(this.selector=Gt.selector(this),this.interaction=Gt.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Gt.hitCanvasManager()),this.canvasManager=new Qt,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),er.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(Sr.RESTART):this.emitLeafer(Sr.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(Sr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=y.copyAttrs({},t,ce);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new At(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=y.copyAttrs({},this.canvas,ce);e.resize(t),this.updateLazyBounds(),this.__onResize(new br(t,i))}__onResize(t){this.emitEvent(t),y.copyAttrs(this.__,t,ce),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(t,e){e||(t.width&&t.height||(this.autoLayout=new Mt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ce.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t&&(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ce.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=y.copyAttrs({},this.canvas,ce);i[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(i)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Sr.BEFORE_READY),this.emitLeafer(Sr.READY),this.emitLeafer(Sr.AFTER_READY),er.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Sr.VIEW_READY),er.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:o}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(n=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:n,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){er.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(Sr.VIEW_COMPLETED),er.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return Vt.need("view")}getValidMove(t,e){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Sr(t,this))}__listenEvents(){const t=Nt.start("FirstCreate "+this.innerName);this.once([[Sr.START,()=>Nt.end(t)],[kr.START,this.updateLazyBounds,this],[Br.START,this.__onCreated,this],[Br.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Er.DATA,this.__onWatchData,this],[kr.END,this.__onLayoutEnd,this],[Br.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){sl.list.remove(this);try{this.stop(),this.emitLeafer(Sr.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{An.clearRecycled()},100)}catch(t){nl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new Xa,te([yo(Wh)],t.Leafer.prototype,"__",void 0),te([Jn()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=sl=te([So()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}constructor(t){super(t)}},te([yo(Hh)],t.Rect.prototype,"__",void 0),t.Rect=te([Bo(el),Eo(),So()],t.Rect);const{copy:ol,add:rl,includes:al}=Rt,hl=t.Rect.prototype,ll=t.Group.prototype,dl={};t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t;if(this.children.length){const e=this.__,{renderBounds:i,boxBounds:s}=this.__layout;super.__updateRenderBounds(),ol(dl,i),this.__updateRectRenderBounds(),(e.scrollY||e.scrollX)&&(dl.x+=e.scrollX,dl.y+=e.scrollY),t=!al(s,dl),t&&"hide"!==e.overflow&&rl(i,dl)}else this.__updateRectRenderBounds();y.stintSet(this,"isOverflow",t),this.__updateScrollBar()}__updateRectRenderBounds(){}__updateScrollBar(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.scrollBar&&this.scrollBar.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},te([yo(Fh)],t.Box.prototype,"__",void 0),te([Jn(100)],t.Box.prototype,"width",void 0),te([Jn(100)],t.Box.prototype,"height",void 0),te([Gn(!1)],t.Box.prototype,"resizeChildren",void 0),te([oo("show")],t.Box.prototype,"overflow",void 0),te([bo(hl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),te([bo(hl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),te([bo(hl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),te([bo(hl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),te([bo(hl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),te([bo(hl.__updateChange)],t.Box.prototype,"__updateRectChange",null),te([bo(hl.__render)],t.Box.prototype,"__renderRect",null),te([bo(ll.__render)],t.Box.prototype,"__renderGroup",null),t.Box=te([Eo(),So()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},te([yo(zh)],t.Frame.prototype,"__",void 0),te([ro("#FFFFFF")],t.Frame.prototype,"fill",void 0),te([oo("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=te([So()],t.Frame);const{moveTo:cl,closePath:ul,ellipse:pl}=ss;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:i,innerRadius:s,startAngle:n,endAngle:o}=this.__,r=t/2,a=i/2,h=this.__.path=[];s?(n||o?(s<1&&pl(h,r,a,r*s,a*s,0,n,o,!1),pl(h,r,a,r,a,0,o,n,!0),s<1&&ul(h)):(s<1&&(pl(h,r,a,r*s,a*s),cl(h,t,a)),pl(h,r,a,r,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||o?(cl(h,r,a),pl(h,r,a,r,a,0,n,o,!1),ul(h)):pl(h,r,a,r,a)}},te([yo(Nh)],t.Ellipse.prototype,"__",void 0),te([eo(0)],t.Ellipse.prototype,"innerRadius",void 0),te([eo(0)],t.Ellipse.prototype,"startAngle",void 0),te([eo(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=te([So()],t.Ellipse);const{moveTo:_l,lineTo:gl,drawPoints:fl}=ss,{rotate:yl,getAngle:ml,getDistance:vl,defaultPoint:wl}=Z,{toBounds:xl}=_n;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&yl(i,e),i}set toPoint(t){this.width=vl(wl,t),this.rotation=ml(wl,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?fl(e,t.points,!1,t.closed):(_l(e,0,0),gl(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(fl(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&vh.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?xl(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},te([yo(Uh)],t.Line.prototype,"__",void 0),te([io("center")],t.Line.prototype,"strokeAlign",void 0),te([Jn(0)],t.Line.prototype,"height",void 0),te([eo()],t.Line.prototype,"points",void 0),te([eo(0)],t.Line.prototype,"curve",void 0),te([eo(!1)],t.Line.prototype,"closed",void 0),t.Line=te([So()],t.Line);const{sin:bl,cos:El,PI:kl}=Math,{moveTo:Bl,lineTo:Sl,closePath:Tl,drawPoints:Pl}=ss,Rl=t.Line.prototype;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)Pl(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,n=e/2,o=i/2;Bl(t,n,0);for(let e=1;e<s;e++)Sl(t,n+n*bl(2*e*kl/s),o-o*El(2*e*kl/s));Tl(t)}}__updateRenderPath(){}__updateBoxBounds(){}},te([yo(Yh)],t.Polygon.prototype,"__",void 0),te([eo(3)],t.Polygon.prototype,"sides",void 0),te([eo()],t.Polygon.prototype,"points",void 0),te([eo(0)],t.Polygon.prototype,"curve",void 0),te([bo(Rl.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),te([bo(Rl.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=te([Eo(),So()],t.Polygon);const{sin:Ll,cos:Cl,PI:Ol}=Math,{moveTo:Al,lineTo:Dl,closePath:Ml}=ss;t.Star=class extends t.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];Al(r,n,0);for(let t=1;t<2*i;t++)Dl(r,n+(t%2==0?n:n*s)*Ll(t*Ol/i),o-(t%2==0?o:o*s)*Cl(t*Ol/i));Ml(r)}},te([yo(Xh)],t.Star.prototype,"__",void 0),te([eo(5)],t.Star.prototype,"corners",void 0),te([eo(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=te([So()],t.Star),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return p(t)&&t[0].image}constructor(t){super(t)}},te([yo(Zh)],t.Image.prototype,"__",void 0),te([Jn("")],t.Image.prototype,"url",void 0),t.Image=te([So()],t.Image);const Il=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Gt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new zn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new gr(gr.LOADED,{image:t}))})}draw(t,e,i,s){const n=new it(t.worldTransform).invert(),o=new it;e&&o.translate(e.x,e.y),i&&(d(i)?o.scale(i):o.scale(i.x,i.y)),s&&o.rotate(s),n.multiplyParent(o),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},te([yo(qh)],t.Canvas.prototype,"__",void 0),te([_h(100)],t.Canvas.prototype,"width",void 0),te([_h(100)],t.Canvas.prototype,"height",void 0),te([_h(1)],t.Canvas.prototype,"pixelRatio",void 0),te([_h(!0)],t.Canvas.prototype,"smooth",void 0),te([Gn(!1)],t.Canvas.prototype,"safeResize",void 0),te([_h()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=te([So()],t.Canvas);const{copyAndSpread:Fl,includes:Wl,spread:zl,setList:Ul}=Rt;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:o,italic:r,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=mh.number(e,n),t.__letterSpacing=mh.number(i,n),t.__padding=l?E.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${n}px ${s}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=fh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:o,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&zl(a,i/2),o||r){if(h.x=o?a.x:0,h.y=r?a.y:0,h.width=o?a.width:t.width,h.height=r?a.height:t.height,n){const[e,i,s,n]=t.__padding;o&&(h.x-=n,h.width+=i+n),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),y.stintSet(this,"isOverflow",!Wl(h,a)),this.isOverflow?(Ul(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Fl(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},te([yo(Kh)],t.Text.prototype,"__",void 0),te([Jn(0)],t.Text.prototype,"width",void 0),te([Jn(0)],t.Text.prototype,"height",void 0),te([ro()],t.Text.prototype,"boxStyle",void 0),te([Gn(!1)],t.Text.prototype,"resizeFontSize",void 0),te([ro("#000000")],t.Text.prototype,"fill",void 0),te([io("outside")],t.Text.prototype,"strokeAlign",void 0),te([go("all")],t.Text.prototype,"hitFill",void 0),te([Jn("")],t.Text.prototype,"text",void 0),te([Jn("")],t.Text.prototype,"placeholder",void 0),te([Jn("caption")],t.Text.prototype,"fontFamily",void 0),te([Jn(12)],t.Text.prototype,"fontSize",void 0),te([Jn("normal")],t.Text.prototype,"fontWeight",void 0),te([Jn(!1)],t.Text.prototype,"italic",void 0),te([Jn("none")],t.Text.prototype,"textCase",void 0),te([Jn("none")],t.Text.prototype,"textDecoration",void 0),te([Jn(0)],t.Text.prototype,"letterSpacing",void 0),te([Jn({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),te([Jn(0)],t.Text.prototype,"paraIndent",void 0),te([Jn(0)],t.Text.prototype,"paraSpacing",void 0),te([Jn("x")],t.Text.prototype,"writingMode",void 0),te([Jn("left")],t.Text.prototype,"textAlign",void 0),te([Jn("top")],t.Text.prototype,"verticalAlign",void 0),te([Jn(!0)],t.Text.prototype,"autoSizeAlign",void 0),te([Jn("normal")],t.Text.prototype,"textWrap",void 0),te([Jn("show")],t.Text.prototype,"textOverflow",void 0),te([ro(!1)],t.Text.prototype,"textEditing",void 0),t.Text=te([So()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}constructor(t){super(t)}},te([yo(Vh)],t.Path.prototype,"__",void 0),te([io("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=te([So()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,o){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,o,r,a){return this}arc(t,e,i,s,n,o){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,o,r,a){return this}drawArc(t,e,i,s,n,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},te([yo(Gh)],t.Pen.prototype,"__",void 0),te([(t,e)=>{Un(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=te([Bo(ws,["set","path","paint"]),So()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&Gt.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),r(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e&&e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&y.assign(e,t),this.autoLayout&&y.copyAttrs(e,this,ce),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[kr.END,this.__onReady,this],[Br.START,this.__onCreated,this],[Br.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Br.END,this.__onChildRenderEnd,this))}},t.App=te([So()],t.App);const Hl={},Nl={isHoldSpaceKey:()=>Nl.isHold("Space"),isHold:t=>Hl[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Hl[t]||(Hl[t]=!0)},setUpCode(t){Hl[t]=!1}},Yl={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class Xl extends ur{get spaceKey(){return Nl.isHoldSpaceKey()}get left(){return Yl.left(this)}get right(){return Yl.right(this)}get middle(){return Yl.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Nl.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){Jt.changeName(t,e)}}t.PointerEvent=class extends Xl{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=te([To()],t.PointerEvent);const Vl=t.PointerEvent,Gl={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof Xa?t:new Xa(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return Z.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),n}static limitMove(t,e){const{draggable:i,dragBounds:s}=t;s&&this.getMoveInDragBounds(t.__localBoxBounds,"parent"===s?t.parent.boxBounds:s,e,!0),"x"===i&&(e.y=0),"y"===i&&(e.x=0)}static getMoveInDragBounds(t,e,i,s){const n=t.x+i.x,o=t.y+i.y,r=n+t.width,a=o+t.height,h=e.x+e.width,l=e.y+e.height;return s||(i=Object.assign({},i)),Rt.includes(t,e)?(n>e.x?i.x+=e.x-n:r<h&&(i.x+=h-r),o>e.y?i.y+=e.y-o:a<l&&(i.y+=l-a)):(n<e.x?i.x+=e.x-n:r>h&&(i.x+=h-r),o<e.y?i.y+=e.y-o:a>l&&(i.y+=l-a)),i}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Gl,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Gl,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Gl,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Rt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Rt.unsign(i),i}assignMove(t){Gl.x=t?this.totalX:this.moveX,Gl.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=te([To()],t.DragEvent);const jl=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=te([To()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=te([To()],t.MoveEvent),t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=te([To()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=te([To()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=te([To()],t.ZoomEvent),t.KeyEvent=class extends Xl{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=te([To()],t.KeyEvent);const Kl={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Zl.getSwipeDirection(Z.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:r(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new Xa,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>zo.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Zl=Kl,ql=new Xa,{getDragEventData:Jl,getDropEventData:$l,getSwipeEventData:Ql}=Kl;class td{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Jl(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,o=t.DragEvent.list||this.draggableList||ql;return this.dragging&&(n?e?ql:new Xa(i?[...s.list,...s.dragHoverExclude]:s.list):o)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&Yl.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],zo.draggable(e)){this.draggableList=new Xa(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:o,throughPath:r}=n;this.dragData=Jl(n,s,e),r&&(this.dragData.throughPath=r),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,n=this.realDraggableList;if(n.length&&s){const{totalX:s,totalY:o}=this.dragData,{dragLimitAnimate:r}=i.p,a=!r||!!e;n.forEach(i=>{if(i.draggable){const n=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:o},a);r&&e?zo.animateMove(i,n,d(r)?r:.3):i.move(n)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:o,throughPath:r}=s,a=Jl(s,e,e);if(r&&(a.throughPath=r),a.path=o,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const o=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(Z.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Ql(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=$l(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const ed=Wt.get("emit");const id=["move","zoom","rotate","key"];function sd(t,e,i,s,n){if(id.some(t=>e.startsWith(t))&&t.__.hitChildren&&!od(t,n)){let o;for(let r=0,a=t.children.length;r<a;r++)o=t.children[r],!i.path.has(o)&&o.__.hittable&&nd(o,e,i,s,n)}}function nd(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!od(t,n)&&(Sh.updateEventStyle&&!s&&Sh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=Jt.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function od(t,e){return e&&e.has(t)}const rd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:ad,pathCanDrag:hd,pathHasOutside:ld}=Kl;class dd{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&Yl.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Yl.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Nl.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=y.clone(rd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Xa(t),this.createTransformer(),this.dragger=new td(this),s&&(this.config=y.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(Yl.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),Yl.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=Yl.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Yl.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=Z.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;Yl.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,Nl.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,Nl.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Xa),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,o=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>ad(e.path,t));n<i.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,i){const{hitRadius:s,through:n}=this.p,{bottomList:o,target:r}=this;e.backgrounder||t.origin||r&&r.updateLayout();const a=this.selector.getByPoint(t,s,Object.assign({bottomList:o,name:t.type},i||{through:n}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!ld(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!hd(t.path))&&!ld(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&Z.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(ad(e.path,t.PointerEvent.LONG_TAP)||ad(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new At(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(d(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(br.RESIZE,this.__onResize,this)],t.once(Sr.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let o=i.length-1;o>-1;o--){if(n=i.list[o],nd(n,t,e,!0,s))return;n.isApp&&sd(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&sd(n,t,e,!1,s),nd(n,t,e,!1,s))return}catch(t){ed.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class cd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}cd.custom={};class ud extends Qt{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Xa,this.pixelList=new Xa}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),Gt.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),Gt.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}e.getSelector=function(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Gt.selector())};const{toInnerRadiusPointOf:pd,copy:_d,setRadius:gd}=Z,{hitRadiusPoint:fd,hitPoint:yd}=Rt,md={},vd={},wd=t.Leaf.prototype;wd.hit=function(t,i=0){this.updateLayout(),_d(vd,t),gd(vd,i);const s=this.__world;return!!(i?fd(s,vd):yd(s,vd))&&(this.isBranch?e.getSelector(this).hitPoint(Object.assign({},vd),i,{target:this}):this.__hitWorld(vd))},wd.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,n=i.width<10&&i.height<10;if(e.hitRadius&&(_d(md,t),gd(t=md,e.hitRadius)),pd(t,i,md),e.hitBox||n){if(Rt.hitRadiusPoint(s.boxBounds,md))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(md)},wd.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},wd.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},wd.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},wd.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const xd=new it,bd=t.UI.prototype;bd.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const t=this.leafer||this.parent&&this.parent.leafer;if(!t)return;const i=this.__,{hitCanvasManager:s}=t,n=(i.__isAlphaPixelFill||i.__isCanvas)&&"pixel"===i.hitFill,o=i.__isAlphaPixelStroke&&"pixel"===i.hitStroke,r=n||o;this.__hitCanvas||(this.__hitCanvas=r?s.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):s.getPathType(this));const a=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,s=e.image.hitCanvasSize,r=a.hitScale=Dt.set(0,0,s,s).getFitMatrix(t).a,{x:h,y:l,width:d,height:c}=Dt.set(t).scale(r);a.resize({width:d,height:c,pixelRatio:1}),a.clear(),An.patternLocked=!0,this.__renderShape(a,{matrix:xd.setWith(this.__world).scaleWith(1/r).invertWith().translate(-h,-l),ignoreFill:!n,ignoreStroke:!o}),An.patternLocked=!1,a.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(a),a.setStrokeOptions(i)},bd.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:o}=e,r=e.stroke&&("path"===n||"pixel"===n&&!e.__isAlphaPixelStroke)||"all"===n;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*o,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=o;break;case"outside":if(h+=2*o,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Ed=t.UI.prototype,kd=t.Rect.prototype,Bd=t.Box.prototype;kd.__updateHitCanvas=Bd.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Ed.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},kd.__hitFill=Bd.__hitFill=function(t){return this.__hitCanvas?Ed.__hitFill.call(this,t):Rt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:o}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):o.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},t.Group.prototype.pick=function(t,i){return i||(i=o),this.updateLayout(),e.getSelector(this).getByPoint(t,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const Sd=ue.prototype;function Td(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let o;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)o=s[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(n){const{decorationColor:t,decorationHeight:o}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,o)))}}function Pd(t,e){t.__.__font?Td(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Rd(t,e,i){switch(e.__.strokeAlign){case"center":Ld(t,1,e,i);break;case"inside":Cd(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?Ld(t,2,e,i):Cd(t,"outside",e,i)}}function Ld(t,e,i,s){const n=i.__;_(t)?Ad(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),Od(i,s))}function Cd(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Ld(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",Td(i,n),n.blendMode="normal",zo.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function Od(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:o}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(o){const{decorationHeight:t}=s;n.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function Ad(t,e,i,s,n){let o;const r=s.__,{__hasMultiStrokeStyle:a}=r;a||n.setStroke(void 0,r.__strokeWidth*e,r);for(let h=0,l=t.length;h<l;h++)if(o=t[h],(!o.image||!xh.checkImage(s,n,o,!1))&&o.style){if(a){const{strokeStyle:t}=o;t?n.setStroke(o.style,r.__getRealStrokeWidth(t)*e,r,t):n.setStroke(o.style,r.__strokeWidth*e,r)}else n.strokeStyle=o.style;o.blendMode?(n.saveBlendMode(o.blendMode),i?Od(s,n):n.stroke(),n.restoreBlendMode()):i?Od(s,n):n.stroke()}}function Dd(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)Rd(t,e,i);else switch(s.strokeAlign){case"center":Md(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),Md(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)Md(t,2,e,i);else{const{renderBounds:n}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),Md(t,2,e,o),o.clipUI(s),o.clearWorld(n),zo.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i)}}function Md(t,e,i,s){const n=i.__;_(t)?Ad(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&wh.strokeArrow(t,i,s)}Sd.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Sd.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Sd.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),Dt.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(Dt.x,Dt.y,Dt.width||1,Dt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:Id,getOuterOf:Fd,getByMove:Wd,getIntersectData:zd}=Rt;let Ud;const{stintSet:Hd}=y,{hasTransparent:Nd}=yh;function Yd(t,e,i){if(!_(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=xh.image(i,t,e,n,!Ud||!Ud[e.url]);break;case"linear":s=bh.linearGradient(e,n);break;case"radial":s=bh.radialGradient(e,n);break;case"angular":s=bh.conicGradient(e,n);break;case"solid":const{type:o,color:a,opacity:h}=e;s={type:o,style:yh.string(a,h)};break;default:r(e.r)||(s={type:"solid",style:yh.string(e)})}if(s){if(h(s.style)&&Nd(s.style)&&(s.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}e.editing&&(s.editing=e.editing),e.blendMode&&(s.blendMode=e.blendMode)}return s}const Xd={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];p(a)||(a=[a]),Ud=xh.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=Yd(t,a[n],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),o=!0),"fill"===t?(Hd(i,"__isAlphaPixelFill",n),Hd(i,"__isTransparentFill",o)):(Hd(i,"__isAlphaPixelStroke",n),Hd(i,"__isTransparentStroke",o),Hd(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,Pd(e,i)},fills:function(t,e,i){let s;for(let n=0,o=t.length;n<o;n++){if(s=t[n],s.image){if(xh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}s.blendMode&&(i.blendMode=s.blendMode),Pd(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),Pd(e,i),i.restoreBlendMode()):Pd(e,i)}},fillPathOrText:Pd,fillText:Td,stroke:Dd,strokes:function(t,e,i){Dd(t,e,i)},strokeText:Rd,drawTextStroke:Od,shape:function(t,e,i){const s=e.getSameCanvas(),n=t.__nowWorld;let o,r,a,h,l,{scaleX:d,scaleY:c}=n;if(d<0&&(d=-d),c<0&&(c=-c),e.bounds.includes(n))l=s,o=h=n;else{const{renderShapeSpread:s}=t.__layout,u=zd(s?Id(e.bounds,d===c?s*d:[s*c,s*d]):e.bounds,n);a=e.bounds.getFitMatrix(u);let{a:p,d:_}=a;a.a<1&&(l=e.getSameCanvas(),t.__renderShape(l,i),d*=p,c*=_),h=Fd(n,a),o=Wd(h,-a.e,-a.f);const g=i.matrix;g?(r=new it(a),r.multiply(g),p*=g.scaleX,_*=g.scaleY):r=a,r.withScale(p,_),i=Object.assign(Object.assign({},i),{matrix:r})}return t.__renderShape(s,i),{canvas:s,matrix:r,fitMatrix:a,bounds:o,worldCanvas:l,shapeBounds:h,scaleX:d,scaleY:c}}};let Vd={},Gd={a:1,b:0,c:0,d:1,e:0,f:0};const{get:jd,rotateOfOuter:Kd,translate:Zd,scaleOfOuter:qd,multiplyParent:Jd,scale:$d,rotate:Qd,skew:tc}=W;function ec(t,e,i,s,n,o,r){const a=jd();Zd(a,e.x+i,e.y+s),$d(a,n,o),r&&Kd(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function ic(t,e,i,s,n,o,r,a,h){const l=jd();nc(l,e,i,s,n,o,r,a),h&&(Gd.a=e.width/h.width,Gd.d=e.height/h.height,Jd(l,Gd)),t.transform=l}function sc(t,e,i,s,n,o,r,a,h,l,d,c){const u=jd();if(c)nc(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)Kd(u,{x:i/2,y:s/2},h);else switch(Qd(u,h),h){case 90:Zd(u,s,0);break;case 180:Zd(u,i,s);break;case 270:Zd(u,0,i)}Vd.x=e.x+n,Vd.y=e.y+o,Zd(u,Vd.x,Vd.y),r&&qd(u,Vd,r,a)}t.transform=u}function nc(t,e,i,s,n,o,r,a){r&&Qd(t,r),a&&tc(t,a.x,a.y),n&&$d(t,n,o),Zd(t,e.x+i,e.y+s)}const{get:oc,translate:rc}=W,ac=new At,hc={},lc={};function dc(t,e,i,s){const{changeful:n,sync:o,scaleFixed:r}=i;n&&(t.changeful=n),o&&(t.sync=o),r&&(t.scaleFixed=r),t.data=cc(i,s,e)}function cc(t,e,i){t.padding&&(e=ac.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:o,mode:r,align:a,offset:l,scale:d,size:c,rotation:u,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===n,w={mode:r},x="center"!==a&&(u||0)%180==90;let b,k;switch(Rt.set(lc,0,0,x?n:s,x?s:n),r&&"cover"!==r&&"fit"!==r?((d||c)&&(E.getScaleData(d,c,i,hc),b=hc.scaleX,k=hc.scaleY),(a||y||f)&&(b&&Rt.scale(lc,b,k,!0),a&&ut.toPoint(a,lc,e,lc,!0,!0))):v&&!u||(b=k=Rt.getFitScale(e,lc,"fit"!==r),Rt.put(e,i,a,b,!1,lc),Rt.scale(lc,b,k,!0)),l&&Z.move(lc,l),r){case"stretch":v||(s=e.width,n=e.height);break;case"normal":case"clip":(lc.x||lc.y||b||g||u||p)&&ic(w,e,lc.x,lc.y,b,k,u,p,t.clipSize);break;case"repeat":(!v||b||u||p)&&sc(w,e,s,n,lc.x,lc.y,b,k,u,p,a,t.freeTransform),f||(w.repeat="repeat");const i=_(f);(y||i)&&(w.gap=function(t,e,i,s,n){let o,r;_(t)?(o=t.x,r=t.y):o=r=t;return{x:uc(o,i,n.width,e&&e.x),y:uc(r,s,n.height,e&&e.y)}}(y,i&&f,lc.width,lc.height,e));break;default:b&&ec(w,e,lc.x,lc.y,b,k,u)}return w.transform||(e.x||e.y)&&(w.transform=oc(),rc(w.transform,e.x,e.y)),b&&"stretch"!==r&&(w.scaleX=b,w.scaleY=k),w.width=s,w.height=n,o&&(w.opacity=o),m&&(w.filters=m),f&&(w.repeat=h(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w}function uc(t,e,i,s){const n=h(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let pc,_c=new At;const{isSame:gc}=Rt;function fc(t,e,i,s,n,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||dc(n,s,i,o),!0}function yc(t,e){wc(t,gr.LOAD,e)}function mc(t,e){wc(t,gr.LOADED,e)}function vc(t,e,i){e.error=i,t.forceUpdate("surface"),wc(t,gr.ERROR,e)}function wc(t,e,i){t.hasEvent(e)&&t.emitEvent(new gr(e,i))}function xc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:bc,scale:Ec,copy:kc}=W,{floor:Bc,max:Sc,abs:Tc}=Math;function Pc(t,i,s){let{scaleX:n,scaleY:o}=t.getRenderScaleData(!0,i.scaleFixed);const r=n+"-"+o+"-"+s;if(i.patternId===r||t.destroyed)return!1;{const{image:t,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:p,transform:_,repeat:g,gap:f}=a;n*=s,o*=s;const y=f&&f.x*n,m=f&&f.y*o;u&&(u=Tc(u),p=Tc(p),l=bc(),kc(l,_),Ec(l,1/u,1/p),n*=u,o*=p),d*=n,c*=o;const v=d*c;if(!g&&v>e.image.maxCacheSize)return!1;let w=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;w>e&&(w=e)}if(v>w&&(h=Math.sqrt(v/w)),h&&(n/=h,o/=h,d/=h,c/=h),u&&(n/=u,o/=p),(_||1!==n||1!==o)&&(l||(l=bc(),_&&kc(l,_)),Ec(l,1/n,1/o)),l){const t=d+(y||0),e=c+(m||0);Ec(l,t/Sc(Bc(t),1),e/Sc(Bc(e),1))}const x=t.getCanvas(d,c,a.opacity,a.filters,y,m),b=t.getPattern(x,g||e.origin.noRepeat||"no-repeat",l,i);return i.style=b,i.patternId=r,!0}}const Rc={image:function(t,e,i,s,n){let o,r;const a=An.get(i);return pc&&i===pc.paint&&gc(s,pc.boxBounds)?o=pc.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),pc=a.use>1?{leafPaint:o,paint:i,boxBounds:_c.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(fc(t,e,i,a,o,s),n&&(yc(t,r),mc(t,r))):a.error?n&&vc(t,r,a.error):(n&&(xc(t,!0),yc(t,r)),o.loadId=a.load(()=>{xc(t,!1),t.destroyed||(fc(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),mc(t,r)),o.loadId=void 0},e=>{xc(t,!1),vc(t,r,e),o.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,i,s,n){const{scaleX:o,scaleY:r}=t.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===o+"-"+r+"-"+a&&!Bh.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||"miniapp"===e.name&&br.isResizing(t)||Bh.running)){let{width:t,height:i}=h;t*=o*a,i*=r*a,h.scaleX&&(t*=h.scaleX,i*=h.scaleY),n=t*i>e.image.maxCacheSize}return n?(t.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(t,i,s,h),!0):(!s.style||s.sync||Bh.running?Pc(t,s,a):s.patternTask||(s.patternTask=An.patternTasker.add(()=>ee(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&Pc(t,s,a),t.forceUpdate("surface")}),300)),!1)},createPattern:Pc,recycleImage:function(t,e){const i=e["_"+t];if(p(i)){let s,n,o,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,An.recycle(n),n.loading&&(r||(r=e.__input&&e.__input[t]||[],p(r)||(r=[r])),n.unload(i[h].loadId,!r.some(t=>t.url===a))));return o}return null},createData:dc,getPatternData:cc,fillOrFitMode:ec,clipMode:ic,repeatMode:sc},{toPoint:Lc}=lt,{hasTransparent:Cc}=yh,Oc={},Ac={};function Dc(t,e,i,s){if(i){let n,o,r,a;for(let t=0,l=i.length;t<l;t++)n=i[t],h(n)?(r=t/(l-1),o=yh.string(n,s)):(r=n.offset,o=yh.string(n.color,s)),e.addColorStop(r,o),!a&&Cc(o)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:Mc,getDistance:Ic}=Z,{get:Fc,rotateOfOuter:Wc,scaleOfOuter:zc}=W,{toPoint:Uc}=lt,Hc={},Nc={};function Yc(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Mc(e,i);o=Fc(),n?(zc(o,e,r/a*(s||1),1),Wc(o,e,t+90)):(zc(o,e,1,r/a*(s||1)),Wc(o,e,t))}return o}const{getDistance:Xc}=Z,{toPoint:Vc}=lt,Gc={},jc={};const Kc={linearGradient:function(t,i){let{from:s,to:n,type:o,opacity:r}=t;Lc(s||"top",i,Oc),Lc(n||"bottom",i,Ac);const a=e.canvas.createLinearGradient(Oc.x,Oc.y,Ac.x,Ac.y),h={type:o,style:a};return Dc(h,a,t.stops,r),h},radialGradient:function(t,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=t;Uc(s||"center",i,Hc),Uc(n||"bottom",i,Nc);const h=e.canvas.createRadialGradient(Hc.x,Hc.y,0,Hc.x,Hc.y,Ic(Hc,Nc)),l={type:o,style:h};Dc(l,h,t.stops,r);const d=Yc(i,Hc,Nc,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=t;Vc(s||"center",i,Gc),Vc(n||"bottom",i,jc);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,Gc.x,Gc.y):e.canvas.createRadialGradient(Gc.x,Gc.y,0,Gc.x,Gc.y,Xc(Gc,jc)),l={type:o,style:h};Dc(l,h,t.stops,r);const d=Yc(i,Gc,jc,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Yc},{copy:Zc,toOffsetOutBounds:qc}=Rt,Jc={},$c={};function Qc(t,i,s,n){const{bounds:o,shapeBounds:r}=n;if(e.fullImageShadow){if(Zc(Jc,t.bounds),Jc.x+=i.x-r.x,Jc.y+=i.y-r.y,s){const{fitMatrix:t}=n;Jc.x-=(o.x+(t?t.e:0)+o.width/2)*(s-1),Jc.y-=(o.y+(t?t.f:0)+o.height/2)*(s-1),Jc.width*=s,Jc.height*=s}t.copyWorld(n.canvas,t.bounds,Jc)}else s&&(Zc(Jc,i),Jc.x-=i.width/2*(s-1),Jc.y-=i.height/2*(s-1),Jc.width*=s,Jc.height*=s),t.copyWorld(n.canvas,r,s?Jc:i)}const{toOffsetOutBounds:tu}=Rt,eu={};const iu={shadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:r}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=a.length-1;qc(l,$c),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}p.setWorldShadow($c.offsetX+a.x*c*f,$c.offsetY+a.y*u*f,a.blur*c*f,yh.string(a.color)),n=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0))*f:0,Qc(p,$c,n,i),s=l,a.box&&(p.restore(),p.save(),h&&(p.copyWorld(p,l,o,"copy"),s=o),h?p.copyWorld(h,o,o,"destination-out"):p.copyWorld(i.canvas,d,l,"destination-out")),zo.copyCanvasByWorld(t,e,p,s,a.blendMode),_&&g<_&&p.clearWorld(s,!0)}),p.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:r}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=a.length-1;tu(l,eu),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(eu.offsetX+a.x*c*f,eu.offsetY+a.y*u*f,a.blur*c*f),n=a.spread?1-2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0))*f:0,Qc(p,eu,n,i),p.restore(),h?(p.copyWorld(p,l,o,"copy"),p.copyWorld(h,o,o,"source-out"),s=o):(p.copyWorld(i.canvas,d,l,"source-out"),s=l),p.fillWorld(s,yh.string(a.color),"source-in"),zo.copyCanvasByWorld(t,e,p,s,a.blendMode),_&&g<_&&p.clearWorld(s,!0)}),p.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:su}=jo;let nu;function ou(t,e,i,s,n,o,r,a){switch(e){case"grayscale":nu||(nu=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,o){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),o&&s.recycle(r);au(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":au(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function ru(t){return t.getSameCanvas(!1,!0)}function au(t,e,i,s,n,o){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),o?i.recycle(r):i.clearWorld(r,!0)}t.Group.prototype.__renderMask=function(t,e){let i,s,n,o,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){r&&(ou(this,r,t,n,s,o,void 0,!0),s=n=null),o=i.__.opacity,nu=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=ru(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=ru(t)),n||(n=ru(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a||su(i,e)||i.__render(t,e);continue}const d=1===o&&i.__.__blendMode;d&&ou(this,r,t,n,s,o,void 0,!1),su(i,e)||i.__render(n||t,e),d&&ou(this,r,t,n,s,o,d,!1)}ou(this,r,t,n,s,o,void 0,!0)};const hu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",lu=hu+"_#~&*+\\=|≮≯≈≠=…",du=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 cu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const uu=cu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),pu=cu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),_u=cu(hu),gu=cu(lu),fu=cu("- —/~|┆·");var yu;!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"}(yu||(yu={}));const{Letter:mu,Single:vu,Before:wu,After:xu,Symbol:bu,Break:Eu}=yu;function ku(t){return uu[t]?mu:fu[t]?Eu:pu[t]?wu:_u[t]?xu:gu[t]?bu:du.test(t)?vu:mu}const Bu={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Su(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Tu}=Bu,{Letter:Pu,Single:Ru,Before:Lu,After:Cu,Symbol:Ou,Break:Au}=yu;let Du,Mu,Iu,Fu,Wu,zu,Uu,Hu,Nu,Yu,Xu,Vu,Gu,ju,Ku,Zu,qu,Ju=[];function $u(t,e){Nu&&!Hu&&(Hu=Nu),Du.data.push({char:t,width:e}),Iu+=e}function Qu(){Fu+=Iu,Du.width=Iu,Mu.words.push(Du),Du={data:[]},Iu=0}function tp(){ju&&(Ku.paraNumber++,Mu.paraStart=!0,ju=!1),Nu&&(Mu.startCharSize=Hu,Mu.endCharSize=Nu,Hu=0),Mu.width=Fu,Zu.width?Tu(Mu):qu&&ep(),Ju.push(Mu),Mu={words:[]},Fu=0}function ep(){Fu>(Ku.maxWidth||0)&&(Ku.maxWidth=Fu)}const{top:ip,right:sp,bottom:np,left:op}=t.Direction4;function rp(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const ap={getDrawData:function(t,i){h(t)||(t=String(t));let s=0,n=0,o=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:a,__font:l,__padding:d}=i;d&&(o?(s=d[op],o-=d[sp]+d[op]):i.autoSizeAlign||(s=d[op]),r?(n=d[ip],r-=d[ip]+d[np]):i.autoSizeAlign||(n=d[ip]));const c={bounds:{x:s,y:n,width:o,height:r},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,i,s){Ku=t,Ju=t.rows,Zu=t.bounds,qu=!Zu.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:r}=s,{canvas:a}=e,{width:h,height:l}=Zu;if(h||l||n||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;ju=!0,Xu=null,Hu=Uu=Nu=Iu=Fu=0,Du={data:[]},Mu={words:[]},n&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)zu=i[s],"\n"===zu?(Iu&&Qu(),Mu.paraEnd=!0,tp(),ju=!0):(Yu=ku(zu),Yu===Pu&&"none"!==r&&(zu=Su(zu,r,!Iu)),Uu=a.measureText(zu).width,n&&(n<0&&(Nu=Uu),Uu+=n),Vu=Yu===Ru&&(Xu===Ru||Xu===Pu)||Xu===Ru&&Yu!==Cu,Gu=!(Yu!==Lu&&Yu!==Ru||Xu!==Ou&&Xu!==Cu),Wu=ju&&o?h-o:h,t&&h&&Fu+Iu+Uu>Wu&&(e?(Iu&&Qu(),Fu&&tp()):(Gu||(Gu=Yu===Pu&&Xu==Cu),Vu||Gu||Yu===Au||Yu===Lu||Yu===Ru||Iu+Uu>Wu?(Iu&&Qu(),Fu&&tp()):Fu&&tp()))," "===zu&&!0!==ju&&Fu+Iu===0||(Yu===Au?(" "===zu&&Iu&&Qu(),$u(zu,Uu),Qu()):Vu||Gu?(Iu&&Qu(),$u(zu,Uu)):$u(zu,Uu)),Xu=Yu);Iu&&Qu(),Fu&&tp(),Ju.length>0&&(Ju[Ju.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Ku.paraNumber++,Fu=a.measureText(t).width,Ju.push({x:o||0,text:t,width:Fu,paraStart:!0}),qu&&ep()})}(c,t,i),d&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":rp(e,"x",t[op]);break;case"right":rp(e,"x",-t[sp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":rp(e,"y",t[ip]);break;case"bottom":rp(e,"y",-t[np])}}(d,c,i,o,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:o,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:p,y:_,width:g,height:f}=s,y=o*n+(c?c*(t.paraNumber-1):0),m=r;if(h&&y>f)y=Math.max(f,o),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":_+=(f-y)/2;break;case"bottom":_+=f-y}m+=_;let v,w,x,b=g||u?g:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=p,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(m+=c),v.y=m,m+=o,t.overflow>r&&m>y&&(v.isOverflow=!0,t.overflow=r+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=y}(c,i),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,letterSpacing:r}=e;let a,h,l,d,c,u;s.forEach(t=>{t.words&&(l=o&&t.paraStart?o:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-l)/(u-1):0,d=r||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==n||i===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,i,o),c.overflow&&function(t,i,s,n){if(!n)return;const{rows:o,overflow:r}=t;let{textOverflow:a}=i;if(o.splice(r),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=s+n-l;("none"===i.textWrap?o:[o[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<d));s--){if(h<d&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(c,i,s,o),"none"!==a&&function(t,e){let i;const{fontSize:s,textDecoration:n}=e;switch(t.decorationHeight=s/11,_(n)?(i=n.type,n.color&&(t.decorationColor=yh.string(n.color))):i=n,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(c,i),c}};const hp={string:function(t,e){const i=d(e)&&e<1;if(h(t)){if(!i||!yh.object)return t;t=yh.object(t)}let s=r(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};function lp(t){return t?p(t)?t:[t]:[]}Object.assign(fh,ap),Object.assign(yh,hp),Object.assign(wh,Xd),Object.assign(xh,Rc),Object.assign(bh,Kc),Object.assign(Eh,iu),Object.assign(Gt,{interaction:(t,e,i,s)=>new dd(t,e,i,s),hitCanvas:(t,e)=>new Ga(t,e),hitCanvasManager:()=>new ud}),Ka();class dp extends ur{get list(){return lp(this.value)}get oldList(){return lp(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function cp(t){return(e,i)=>{const s="_"+i;Un(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){if(this.config){const t="target"===i;if(t){p(e)&&e.length>1&&e[0].locked&&e.splice(0,1),this.single&&(this.element.syncEventer=null);const{beforeSelect:t}=this.config;if(t){const i=t({target:e});if(_(i))e=i;else if(!1===i)return}}const s=t?dp.BEFORE_SELECT:dp.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new dp(s,{editor:this,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}dp.BEFORE_SELECT="editor.before_select",dp.SELECT="editor.select",dp.AFTER_SELECT="editor.after_select",dp.BEFORE_HOVER="editor.before_hover",dp.HOVER="editor.hover";const{abs:up}=Math,{copy:pp,scale:_p}=W,{setListWithFn:gp}=Rt,{worldBounds:fp}=jo,yp={a:1,b:0,c:0,d:1,e:0,f:0},mp={x:0,y:0,width:0,height:0};class vp extends t.UI{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(gp(mp,e,fp),t&&this.set(t),this.set(mp),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:o,strokeWidth:r,fill:a}=n,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=up(c.scaleX),l=up(c.scaleY);if(pp(yp,c),yp.half=r%2,i!==l){_p(yp,1/i,1/l),t.setWorld(yp,e.matrix),t.beginPath(),n.strokeWidth=r;const{x:o,y:a,width:h,height:d}=s.__layout.boxBounds;t.rect(o*i,a*l,h*i,d*l)}else t.setWorld(yp,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=r/up(c.scaleX);o&&(h(o)?wh.stroke(o,this,t):wh.strokes(o,this,t)),a&&(h(a)?wh.fill(a,this,t):wh.fills(a,this,t))}}n.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}te([cp(function(t){const e=t.target;t.list=e?p(e)?e:[e]:[]})],vp.prototype,"target",void 0);class wp extends t.Group{constructor(e){super(e),this.strokeArea=new t.Rect({strokeAlign:"center"}),this.fillArea=new t.Rect,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:n}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:n},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const xp={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return bp([t],i,e),i}};function bp(t,e,i){let s,n;for(let o=0,r=t.length;o<r;o++)if(s=t[o],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&n.hitSelf&&e.push(s)}s.isBranch&&bp(s.children,e,i)}}const{findOne:Ep,findByBounds:kp}=xp;class Bp extends t.Group{get dragging(){return!!this.originList}get running(){const{editor:t}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector}get isMoveMode(){return this.app&&this.app.interaction.moveMode}constructor(t){super(),this.hoverStroker=new vp,this.targetStroker=new vp,this.bounds=new At,this.selectArea=new wp,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{stroke:e,strokeWidth:i,hover:s,hoverStyle:n}=t.mergeConfig;this.hoverStroker.setTarget(s?this.editor.hoverTarget:null,Object.assign({stroke:e,strokeWidth:i},n||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(e.target=null)}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:n,y:o}=t.getInnerPoint(this);this.bounds.set(n,o),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:o},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),n=new Xa(kp(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),n.length){const t=[];this.originList.forEach(e=>{n.has(e)||t.push(e)}),n.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!Ep(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Xa(this.editor.editBox.rect)};return Ep(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Ep(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:e}=this;e.waitLeafer(()=>{const{app:i}=e;i.selector.proxy=e,this.__eventIds=[e.on_([[dp.HOVER,this.onHover,this],[dp.SELECT,this.onSelect,this]]),i.on_([[t.PointerEvent.MOVE,this.onPointerMove,this],[t.PointerEvent.BEFORE_DOWN,this.onBeforeDown,this],[t.PointerEvent.TAP,this.onTap,this],[t.DragEvent.START,this.onDragStart,this,!0],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.MoveEvent.MOVE,this.onAutoMove,this],[[t.ZoomEvent.ZOOM,t.MoveEvent.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:Sp,top:Tp,topRight:Pp,right:Rp,bottomRight:Lp,bottom:Cp,bottomLeft:Op,left:Ap}=t.Direction9,{toPoint:Dp}=lt,{within:Mp}=E,Ip={getScaleData(t,e,i,s,n,o,r,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:p,heightRange:_,dragBounds:g,worldBoxBounds:f}=t,{width:y,height:m}=e;o&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,w=t.scaleY/e.scaleY,x=v<0?-1:1,b=w<0?-1:1,E=a?v:x*u.width/y,k=a?w:b*u.height/m;s.x*=a?v:x,s.y*=a?w:b;const B=(-s.y+m)/m,S=(s.x+y)/y,T=(s.y+m)/m,P=(-s.x+y)/y;switch(i){case Tp:c=B,h="bottom";break;case Rp:d=S,h="left";break;case Cp:c=T,h="top";break;case Ap:d=P,h="right";break;case Sp:c=B,d=P,h="bottom-right";break;case Pp:c=B,d=S,h="bottom-left";break;case Lp:c=T,d=S,h="top-left";break;case Op:c=T,d=P,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else{let t;switch(i){case Tp:case Cp:t=c;break;case Ap:case Rp:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const R=1!==d,L=1!==c;if(R&&(d/=E),L&&(c/=k),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(Dp(o||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new At(t.__localBoxBounds);if(Rt.includes(new At(e).spread(.1),i)&&(i.scaleOf(t.getLocalPointByInner(l),d,c),!Rt.includes(e,i))){const t=i.getIntersect(e),s=t.width/i.width,n=t.height/i.height;R&&(d*=s),L&&(c*=n)}}if(R&&p){const e=u.width*t.scaleX;d=Mp(e*d,p)/e}if(L&&_){const e=u.height*t.scaleY;c=Mp(e*c,_)/e}return R&&Math.abs(d*f.width)<1&&(d=(d<0?-1:1)/f.width),L&&Math.abs(c*f.height)<1&&(c=(c<0?-1:1)/f.height),n&&d!==c&&(c=d=Math.min(d,c)),{origin:l,scaleX:d,scaleY:c,direction:i,lockRatio:n,around:o}},getRotateData(t,e,i,s,n){let o,r={};switch(e){case Sp:o="bottom-right";break;case Pp:o="bottom-left";break;case Lp:o="top-left";break;case Op:o="top-right";break;default:o="center"}return Dp(n||o,t.boxBounds,r,!0),{origin:r,rotation:Z.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case Tp:case Sp:o={x:.5,y:0},n="bottom",a=1;break;case Cp:case Lp:o={x:.5,y:1},n="top",a=1;break;case Ap:case Op:o={x:0,y:.5},n="right",h=1;break;case Rp:case Pp:o={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;o.x=o.x*l,o.y=o.y*d,Dp(s||n,t,r,!0);const c=Z.getRotation(o,r,{x:o.x+(a?i.x:0),y:o.y+(h?i.y:0)});return a?a=-c:h=c,{origin:r,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case Ap:t=Rp;break;case Sp:t=Pp;break;case Op:t=Lp;break;case Rp:t=Ap;break;case Pp:t=Sp;break;case Lp:t=Op}if(i)switch(t){case Tp:t=Cp;break;case Sp:t=Op;break;case Pp:t=Lp;break;case Cp:t=Tp;break;case Op:t=Sp;break;case Lp:t=Pp}return t}},Fp={};function Wp(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:o,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("circle"===i.name)return;if("button"===i.pointType)return void(i.cursor||(i.cursor="pointer"));let{rotation:h}=t;const{pointType:l}=i,{resizeCursor:d,rotateCursor:c,skewCursor:u,resizeable:p,rotateable:_,skewable:g}=t.mergeConfig;let f=l.includes("resize");f&&_&&(t.isHoldRotateKey(e)||!p)&&(f=!1);const y=g&&!f&&("resize-line"===i.name||"skew"===l),m=s?n?u:o?d:c:y?u:f?d:c;h+=45*(Ip.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(E.formatRotation(h,!0)/2);const{url:v,x:w,y:x}=m,b=v+h;Fp[b]?i.cursor=Fp[b]:Fp[b]=i.cursor={url:Up(v,h),x:w,y:x}}function zp(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function Up(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class Hp extends t.Box{constructor(t){super(t),this.useFastShadow=!0}}const Np=["top","right","bottom","left"],Yp=void 0;class Xp extends t.Group{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.visible&&this.view.visible}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return h(t)||h(e)||h(i)}constructor(e){super(),this.view=new t.Group,this.rect=new t.Box({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new Hp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new t.Group({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=e,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:o,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new Hp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new Hp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new Hp({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),s.addMany(...o,a,h,l,...r,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:n,resizePoints:o}=this,{stroke:r,strokeWidth:a}=e,h=this.getPointsStyle(),l=this.getMiddlePointsStyle();let d;this.visible=!t.locked;for(let t=0;t<8;t++)d=o[t],d.set(this.getPointStyle(t%2?l[(t-1)/2%l.length]:h[t/2%h.length])),d.rotation=(t-(t%2?1:0))/2*90;n.set(this.getPointStyle(e.circle||e.rotatePoint||h[0])),s.set(Object.assign({stroke:r,strokeWidth:a,editConfig:Yp},e.rect||{}));const c=i&&this.transformTool.editTool;s.hittable=!c,s.syncEventer=c&&this.editor,c&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),zp(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editMask:e}=this.editor,{mergeConfig:i,single:s,rect:n,circle:o,buttons:r,resizePoints:a,rotatePoints:h,resizeLines:l}=this,{middlePoint:c,resizeable:u,rotateable:p,hideOnSmall:_,editBox:g,mask:f,spread:y,hideRotatePoints:m,hideResizeLines:v}=i;if(e.visible=!!f||0,y&&Rt.spread(t,y),this.view.worldOpacity){const{width:e,height:f}=t,y=d(_)?_:10,w=g&&!(_&&e<y&&f<y);let x,b,E,k={};for(let i=0;i<8;i++)lt.toPoint(lt.directionData[i],t,k),b=a[i],x=h[i],b.set(k),x.set(k),b.visible=w&&!(!u&&!p),x.visible=w&&p&&u&&!m,i%2&&(E=l[(i-1)/2],E.set(k),E.visible=b.visible&&!v,b.visible=x.visible=w&&!!c,(i+1)/2%2?(E.width=e,_&&2*b.width>e&&(b.visible=!1)):(E.height=f,_&&2*b.width>f&&(b.visible=!1)));o.visible=w&&p&&!(!i.circle&&!i.rotatePoint),o.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||g})),r.visible=w&&r.children.length>0||0,r.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,o=Np.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,o,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:o,flippedY:r}=this;let a=Np.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?Ip.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=o?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],o=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*r;o?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:o}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:n,height:n,cornerRadius:o,offsetX:0,offsetY:0,editConfig:Yp};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return p(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return p(t)?t:t?[t]:this.getPointsStyle()}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{editor:s,dragStartData:n}=this,{target:o}=this,{moveable:r,resizeable:a,rotateable:h,skewable:l,hideOnMove:d}=this.mergeConfig;"rect"===e.name?(r&&(this.moving=!0),s.opacity=d?0:1):(i.includes("rotate")||this.isHoldRotateKey(t)||!a?(h&&(this.rotating=!0),"resize-rotate"===i?a&&(this.resizing=!0):"resize-line"===e.name&&(l&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&a&&(this.resizing=!0),"skew"===i&&l&&(this.skewing=!0)),n.x=t.x,n.y=t.y,n.point={x:o.x,y:o.y},n.bounds=Object.assign({},o.getLayoutBounds("box","local")),n.rotation=o.rotation,i&&i.includes("resize")&&(br.resizingKeys=s.leafList.keys)}onDragEnd(t){this.mergeConfig.dragLimitAnimate&&this.moving&&this.transformTool.onMove(t),this.dragPoint=null,this.resetDoing();const{name:e,pointType:i}=t.current;"rect"===e&&(this.editor.opacity=1),i&&i.includes("resize")&&(br.resizingKeys=null)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:o}=this;if(i)e.onMove(t),zp(this);else if(s||n||o){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),o&&e.onSkew(t),Wp(this,t)}}resetDoing(){this.canUse&&(this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1)}onMove(t){this.canGesture&&"drag"!==t.moveType&&(t.stop(),h(this.mergeConfig.moveable)&&(this.gesturing=this.moving=!0,this.transformTool.onMove(t)))}onScale(t){this.canGesture&&(t.stop(),h(this.mergeConfig.resizeable)&&(this.gesturing=this.resizing=!0,this.transformTool.onScale(t)))}onRotate(t){this.canGesture&&(t.stop(),h(this.mergeConfig.rotateable)&&(this.gesturing=this.rotating=!0,this.transformTool.onRotate(t)))}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){Wp(this,t)}onArrow(t){const{editor:e,transformTool:i}=this;if(this.canUse&&e.editing&&this.mergeConfig.keyEvent){let e=0,s=0;const n=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=n;break;case"ArrowUp":s=-n;break;case"ArrowLeft":e=-n;break;case"ArrowRight":e=n}(e||s)&&i.move(e,s)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(e){const{editor:i,target:s}=this;if(this.single){if(s.locked)return;if(s.isBranch&&!s.editInner){if(s.textBox){const{children:e}=s,n=e.find(e=>e.editable&&e instanceof t.Text)||e.find(e=>e instanceof t.Text);if(n)return i.openInnerEditor(n)}i.openGroup(s),i.target=i.selector.findDeepOne(e)}else i.openInnerEditor()}}listenPointEvents(e,i,s){e.direction=s,e.pointType=i;const n=[[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.LEAVE,()=>{this.enterPoint=null}]];"circle"!==e.name&&n.push([t.PointerEvent.ENTER,t=>{this.enterPoint=e,Wp(this,t)}]),this.__eventIds.push(e.on_(n))}__listenEvents(){const{rect:e,editor:i,__eventIds:s}=this;s.push(e.on_([[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.ENTER,()=>zp(this)],[t.PointerEvent.DOUBLE_TAP,this.onDoubleTap,this],[t.PointerEvent.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{s.push(i.app.on_([[[t.KeyEvent.HOLD,t.KeyEvent.UP],this.onKey,this],[t.KeyEvent.DOWN,this.onArrow,this],[t.MoveEvent.BEFORE_MOVE,this.onMove,this,!0],[t.ZoomEvent.BEFORE_ZOOM,this.onScale,this,!0],[t.RotateEvent.BEFORE_ROTATE,this.onRotate,this,!0],[t.MoveEvent.END,this.resetDoing,this],[t.ZoomEvent.END,this.resetDoing,this],[t.RotateEvent.END,this.resetDoing,this]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const Vp={x:0,y:0,width:1e5,height:1e5};class Gp extends t.UI{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,Vp),Object.assign(this.__world,Vp)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach(i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)}),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const jp='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',Kp={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${jp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${jp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${jp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},Zp=new At;function qp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{Zp.setListWithFn(i,t=>t.getBounds("box","page")),0===Zp.width&&(Zp.width=.1),0===Zp.height&&(Zp.height=.1),e.reset(Zp.get())}),s.add(e)}const Jp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),$p=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),Qp={group(e,i,s){e.sort($p);const{app:n,parent:o}=e[0];let r;r=s&&s.add?s:new t.Group(s),o.addAt(r,o.children.indexOf(e[0])),e.sort(Jp);const a=new it(i.worldTransform);return a.divideParent(o.worldTransform),r.setTransform(a),r.editable=!0,r.hitChildren=!1,n.lockLayout(),e.forEach(t=>t.dropTo(r)),n.unlockLayout(),r},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(Jp),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort($p),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},t_=Wt.get("EditToolCreator");function e_(){return t=>{s_.register(t)}}const i_=e_,s_={list:{},register(t){const{tag:e}=t.prototype;n_[e]&&t_.repeat(e),n_[e]=t},get:(t,e)=>new n_[t](e)},{list:n_}=s_;class o_ extends dp{constructor(t,e){super(t,e)}}o_.BEFORE_OPEN="innerEditor.before_open",o_.OPEN="innerEditor.open",o_.BEFORE_CLOSE="innerEditor.before_close",o_.CLOSE="innerEditor.close";class r_ extends dp{constructor(t,e){super(t,e)}}r_.BEFORE_GROUP="editor.before_group",r_.GROUP="editor.group",r_.BEFORE_UNGROUP="editor.before_ungroup",r_.UNGROUP="editor.ungroup",r_.BEFORE_OPEN="editor.before_open_group",r_.OPEN="editor.open_group",r_.BEFORE_CLOSE="editor.before_close_group",r_.CLOSE="editor.close_group";const{updateMatrix:a_}=zo,h_={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},l_="top-left";class d_ extends t.Rect{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(_r.CHANGE,e=>{if(this.checkChange&&h_[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,o="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const r=this.__;r[i]=n,a_(this.parent),a_(this);const a=new it(this.__world);switch(r[i]=s,this.__layout.rotationChange(),a_(this),this.changedTransform=new it(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(l_,o);break;case"scaleX":t.scaleOf(l_,o,1);break;case"scaleY":t.scaleOf(l_,1,o);break;case"skewX":t.skewOf(l_,o,0);break;case"skewY":t.skewOf(l_,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class c_ extends dp{constructor(t,e){super(t,e)}}c_.BEFORE_MOVE="editor.before_move",c_.MOVE="editor.move";class u_ extends dp{constructor(t,e){super(t,e)}}u_.BEFORE_SCALE="editor.before_scale",u_.SCALE="editor.scale";class p_ extends dp{constructor(t,e){super(t,e)}}p_.BEFORE_ROTATE="editor.before_rotate",p_.ROTATE="editor.rotate";class __ extends dp{constructor(t,e){super(t,e)}}__.BEFORE_SKEW="editor.before_skew",__.SKEW="editor.skew";class g_{onMove(e){const{target:i,mergeConfig:s,dragStartData:n,app:o}=this.editBox;let a,{dragLimitAnimate:h}=s;r(h)&&(h=o&&o.config.pointer.dragLimitAnimate);const l=e.type===t.DragEvent.END||e.type===t.DragEvent.END,c=!h||l;if(e instanceof t.MoveEvent)a=e.getLocalMove(i),c&&t.DragEvent.limitMove(i,a);else{const s={x:e.totalX,y:e.totalY};e.shiftKey&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),a=t.DragEvent.getValidMove(i,n.point,s,c)}h&&l?zo.animateMove(this,a,d(h)?h:.3):this.move(a)}onScale(e){const{target:i,mergeConfig:s,single:n,dragStartData:o}=this.editBox;let{around:r,lockRatio:a,flipable:h,editSize:l}=s;if(e instanceof t.ZoomEvent)this.scaleOf(i.getBoxPoint(e),e.scale,e.scale);else{const{direction:t}=e.current;(e.shiftKey||i.lockRatio)&&(a=!0);const s=Ip.getScaleData(i,o.bounds,t,e.getInnerTotal(i),a,Ip.getAround(r,e.altKey),h,!n||"scale"===l);this.editTool&&this.editTool.onScaleWithDrag?(s.drag=e,this.scaleWithDrag(s)):this.scaleOf(s.origin,s.scaleX,s.scaleY)}}onRotate(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox,{around:o,rotateAround:r,rotateGap:a}=s,{direction:h}=e.current;let l,d;if(e instanceof t.RotateEvent)d=e.rotation,l=r?lt.getPoint(r,i.boxBounds):i.getBoxPoint(e);else{const t=Ip.getRotateData(i,h,e,n,e.shiftKey?null:r||i.around||i.origin||o||"center");d=n.rotation+t.rotation-i.rotation,l=t.origin}d=E.float(E.getGapRotation(d,a,i.rotation),2),d&&this.rotateOf(l,d)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:o,skewY:r}=Ip.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),Ip.getAround(s,t.altKey));(o||r)&&this.skewOf(n,o,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;_(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if(_(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:o,moveX:a.x,moveY:a.y};this.emitEvent(new c_(c_.BEFORE_MOVE,h));const l=new c_(c_.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:n}=i;if(n){const{origin:i,scaleX:s,scaleY:o,drag:r}=t;if(!1===n({target:e,drag:r,origin:i,scaleX:s,scaleY:o}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new u_(u_.BEFORE_SCALE,t));const o=new u_(u_.SCALE,t);this.editTool.onScaleWithDrag(o),this.emitEvent(o)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeScale:h}=o;if(h){const s=h({target:n,origin:t,scaleX:e,scaleY:i});if(_(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new u_(u_.BEFORE_SCALE,c));const u=new u_(u_.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),o=i?new it(zo.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:o};this.emitEvent(new u_(u_.BEFORE_SCALE,r));const a=new u_(u_.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if(d(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),l={target:i,editor:o,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new p_(p_.BEFORE_ROTATE,l));const c=new p_(p_.ROTATE,l);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeSkew:h}=o;if(h){const s=h({target:n,origin:t,skewX:e,skewY:i});if(_(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new __(__.BEFORE_SKEW,c));const u=new __(__.SKEW,c);this.doSkew(u),this.emitEvent(u)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(zo.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new it(e.worldTransform);return t(),new it(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}t.Editor=class extends t.Group{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}constructor(t,e){super(e),this.leafList=new Xa,this.openedGroupList=new Xa,this.simulateTarget=new d_(this),this.editBox=new Xp(this),this.editToolList={},this.selector=new Bp(this),this.editMask=new Gp(this),this.targetEventIds=[];let i=y.clone(Kp);t&&(i=y.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Vt.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&qp(this),this.update()}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element.editOuter||"EditTool",e=this.editTool=this.editToolList[t]=this.editToolList[t]||s_.get(t,this);this.editBox.load(),e.load(),this.update()}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(r_.BEFORE_GROUP),this.target=Qp.group(this.list,this.element,t),this.emitGroupEvent(r_.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(r_.BEFORE_UNGROUP,t)),this.target=Qp.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(r_.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(r_.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(r_.OPEN,t)}closeGroup(t){this.emitGroupEvent(r_.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(r_.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!zo.hasParent(e,t))&&e.push(t))),e.forEach(t=>this.closeGroup(t))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new r_(t,{editTarget:e});e&&e.syncEventer||this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if(h(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){const e=t||this.element;s||(s=e.editInner),s&&s_.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||s_.get(s,this),this.innerEditor.editTarget=e,this.emitInnerEvent(o_.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(o_.OPEN),console.log("hello"))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(o_.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(o_.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new o_(t,{editTarget:i,innerEditor:e});i.syncEventer||this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach(t=>t.locked=!0),this.update()}unlock(){this.list.forEach(t=>t.locked=!1),this.update()}toTop(){this.list.length&&(Qp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(Qp.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,editMask:i}=this;this.targetEventIds=[e.on_(Br.START,this.onRenderStart,this),t.on_(Br.CHILD_START,this.onAppRenderStart,this)],i.visible&&i.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}},te([(t,e)=>{Un(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s}=this,n=Object.assign({},t);return e&&e.editConfig&&Object.assign(n,e.editConfig),s.config&&Object.assign(n,s.config),i&&(i.editConfig&&Object.assign(n,i.editConfig),"font-size"===n.editSize&&(n.lockRatio=!0),"resize-rotate"===i.pointType&&(n.around||(n.around="center"),a(n.lockRatio)&&(n.lockRatio=!0))),this.mergedConfig=n}})}],t.Editor.prototype,"mergeConfig",void 0),te([cp(function(t,e){t.emitEvent(new dp(dp.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],t.Editor.prototype,"hoverTarget",void 0),te([cp(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Xa?i:new Xa(i),t.multiple&&qp(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new dp(dp.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new dp(dp.AFTER_SELECT,s))})],t.Editor.prototype,"target",void 0),t.Editor=te([Bo(g_,["editBox","editTool","emitEvent"])],t.Editor);class f_{static registerInnerEditor(){s_.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new t.Group,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}t.EditTool=class extends f_{static registerEditTool(){s_.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:o}=s;n.lockLayout(),o.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(n,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:o,list:r}=n;o.lockLayout(),r.forEach(t=>{const o="scale"!==n.getEditSize(t);i?t.transformWorld(i,o):t.rotateOfWorld(s,e)}),o.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(n,e,i,r)}),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}},t.EditTool=te([e_()],t.EditTool);const{left:y_,right:m_}=t.Direction9,{move:v_,copy:w_,toNumberPoints:x_}=Z;t.LineEditTool=class extends t.EditTool{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,o=t.target,r=i===y_;if(o.pathInputed){const{path:t}=o.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,o.path=t}else if(o.points){const{points:t}=o,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,o.points=t}else{const t={x:0,y:0},{toPoint:i}=o;o.rotation=0,this.dragPoint(t,i,r,n,this.getInnerMove(o,e,s)),o.getLocalPointByInner(t,null,null,!0),o.getLocalPointByInner(i,null,null,!0),o.x=t.x,o.y=t.y,o.getInnerPointByLocal(i,null,null,!0),o.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=x_(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:o,y:r}=n;i?(v_(t,o,r),s&&v_(e,-o,-r)):(s&&v_(t,-o,-r),v_(e,o,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,o=this.editor.element;let r,a;if(o.pathInputed?r=this.getFromToByPath(o.__.path):o.points&&(r=this.getFromToByPoints(o.__.points)),r){const{from:i,to:a}=r;o.innerToWorld(i,i,!1,t),o.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),w_(s[7],i),w_(e[7],i),w_(s[3],a),w_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===y_||t===m_,s[t].visible=a,e[t].visible=!r&&a}},t.LineEditTool=te([e_()],t.LineEditTool);const{M:b_,L:E_,C:k_,Q:B_,Z:S_,N:T_,D:P_,X:R_,G:L_,F:C_,O:O_,P:A_,U:D_}=ge,M_={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case b_:case E_:I_(t,e,i,n,1),n+=3;break;case k_:I_(t,e,i,n,3),n+=7;break;case B_:I_(t,e,i,n,2),n+=5;break;case S_:n+=1;break;case T_:I_(t,e,i,n,2),n+=5;break;case P_:I_(t,e,i,n,2),n+=9;break;case R_:I_(t,e,i,n,2),n+=6;break;case L_:I_(t,e,i,n,2),n+=9;break;case C_:I_(t,e,i,n,2),n+=5;break;case O_:t[n]=L_,t.splice(n+4,0,t[n+3],0),I_(t,e,i,n,2),n+=9,o+=2;break;case A_:t[n]=C_,t.splice(n+4,0,t[n+3]),I_(t,e,i,n,2),n+=5,o+=1;break;case D_:I_(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let o=n?s+1:0,r=n?o+2*n:t.length;o<r;o+=2)t[o]*=e,t[o+1]*=i}},{scalePoints:I_}=M_,F_=W.get(),{topLeft:W_,top:z_,topRight:U_,right:H_,bottom:N_,left:Y_}=t.Direction9;function X_(t,e,i){t.pathInputed?G_(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function V_(t,e,i,s){let n=e;if(!r(s)){const o=t.__layout;let{width:r,height:a}=o.boxBounds;switch(r*=i-e,a*=e-i,s){case z_:case N_:n=i,o.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case Y_:case H_:o.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case W_:case U_:o.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const o=t.__,{padding:a}=o;a&&(t.padding=p(a)?a.map(t=>t*n):a*n),o.__autoWidth||(t.width*=n),o.__autoHeight||(t.height*=n)}function G_(t,e,i){M_.scale(t.__.path,e,i),t.path=t.__.path}function j_(t,e,i){const{points:s}=t;_(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):M_.scalePoints(s,e,i),t.points=s}function K_(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)F_.a=e,F_.d=i,s[t].transform(F_,!0)}const Z_=t.Leaf.prototype;Z_.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},Z_.__scaleResize=function(t,e){X_(this,t,e)},Z_.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},Z_.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},t.Text.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,o=n&&n.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||o&&"font-size"===n.mergedConfig.editSize)V_(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:o}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=r.x),s&&"top"!==o&&1!==e&&(this.y+=r.y),X_(this,t,e)}},t.Path.prototype.__scaleResize=function(t,e){G_(this,t,e)},t.Line.prototype.__scaleResize=function(t,e){this.pathInputed?G_(this,t,e):this.points?j_(this,t,e):this.width*=t},t.Polygon.prototype.__scaleResize=function(t,e){this.pathInputed?G_(this,t,e):this.points?j_(this,t,e):X_(this,t,e)},t.Group.prototype.__scaleResize=function(t,e){K_(this,t,e)},t.Box.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||X_(this,t,e),i&&K_(this,t,e)},Vt.add("resize"),Vt.add("editor","resize"),Gt.editor=function(e,i){const s=new t.Editor(e);return i&&i.sky.add(i.editor=s),s},t.Box.addAttr("textBox",!1,Gn),t.UI.addAttr("editConfig",void 0,Gn),t.UI.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),Gn),t.UI.addAttr("editInner","PathEditor",Gn),t.Group.addAttr("editInner","",Gn),t.Text.addAttr("editInner","TextEditor",Gn),t.UI.setEditConfig=function(t){this.changeAttr("editConfig",t)},t.UI.setEditOuter=function(t){this.changeAttr("editOuter",t)},t.UI.setEditInner=function(t){this.changeAttr("editInner",t)};const q_={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},J_={top:"flex-start",middle:"center",bottom:"flex-end"},$_={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function Q_(t,e,i){const{style:s}=t,{fill:n,padding:o,textWrap:a,textOverflow:l,textDecoration:d}=e;let c;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";p(e)&&(e=e[0]);if(_(e))switch(e.type){case"solid":i=yh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=yh.string(h(t)?t:t.color);break;default:r(e.r)||(i=yh.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,_(d)?(c=d.type,d.color&&(s.textDecorationColor=yh.string(d.color))):c=d,s.textDecoration=$_[c],s.textTransform=q_[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=J_[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===a||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===a?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=p(o)?o.map(t=>t*i+"px").join(" "):(o||0)*i+"px",s.textOverflow="show"===l?"":"hide"===l?"clip":l}function tg(e,i,s){eg(e.parentApp?e.parentApp:e,i),e.isApp||s||e.__eventIds.push(e.on_(t.MoveEvent.BEFORE_MOVE,t=>{e.zoomLayer.move(e.getValidMove(t.moveX,t.moveY))}),e.on_(t.ZoomEvent.BEFORE_ZOOM,t=>{const{zoomLayer:i}=e,s=e.getValidScale(t.scale);1!==s&&i.scaleOfWorld(t,s)}))}function eg(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&y.assign(i,e),y.assign(t.config,i,t.userConfig)}t.TextEditor=class extends f_{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:e}=this,{config:i}=e.app,s=this.editTarget;s.textEditing=!0,this.isHTMLText=!(s instanceof t.Text),this._keyEvent=i.keyEvent,i.keyEvent=!1;const n=this.editDom=document.createElement("div"),{style:o}=n;n.contentEditable="true",o.position="fixed",o.transformOrigin="left top",o.boxSizing="border-box",this.isHTMLText?n.innerHTML=String(s.text):n.innerText=String(s.text);const{view:r}=e.app;(this.inBody=r instanceof HTMLCanvasElement)?document.body.appendChild(n):r.appendChild(n),this.eventIds=[e.app.on_(t.PointerEvent.DOWN,t=>{let i,{target:s}=t.origin;for(;s;)s===n&&(i=!0),s=s.parentElement;i||e.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),n.addEventListener("focus",this.onFocus),n.addEventListener("input",this.onInput),n.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const a=window.getSelection(),h=document.createRange();if(this.config.selectAll)h.selectNodeContents(n);else{const t=n.childNodes[0];h.setStartAfter(t),h.setEndAfter(t),h.collapse(!0)}a.removeAllRanges(),a.addRange(h)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode(""),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const o=i.split("\n"),r=document.createDocumentFragment();o.forEach((t,e)=>{e>0&&r.appendChild(document.createElement("br")),r.appendChild(document.createTextNode(t))}),n.insertNode(r),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,o=0;i*=e,s*=e;const r=t.__;if(r.__autoWidth&&(i+=20,r.autoSizeAlign))switch(r.textAlign){case"center":n=-i/2;break;case"right":n=-i}if(r.__autoHeight&&(s+=20,r.autoSizeAlign))switch(r.verticalAlign){case"middle":o=-s/2;break;case"bottom":o=-s}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:p,f:_}=new it(t.worldTransform).scale(1/e).translateInner(n,o),{style:g}=this.editDom;g.transform=`matrix(${l},${d},${c},${u},${p},${_})`,g.left=a+"px",g.top=h+"px",g.width=i+"px",g.height=s+"px",this.isHTMLText||Q_(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}},t.TextEditor=te([i_()],t.TextEditor),Vt.add("text-editor","editor");const ig=Wt.get("LeaferTypeCreator"),sg={list:{},register(t,e){ng[t]&&ig.repeat(t),ng[t]=e},run(t,e){const i=ng[t];i&&i(e)}},{list:ng,register:og}=sg;og("viewport",tg),og("custom",function(t){tg(t,null,!0)}),og("design",function(t){tg(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),og("document",function(t){tg(t,{zoom:{min:1},move:{scroll:"limit"}})});const rg={getData(t){const e=t[0],i=t[1],s=Z.getCenter(e.from,i.from),n=Z.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=Z.getDistance(e.from,i.from);return{move:o,scale:Z.getDistance(e.to,i.to)/r,rotation:Z.getRotation(e.from,i.from,e.to,i.to),center:n}}},ag={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;return t.shiftKey&&!s&&(s=n,n=0),s>50&&(s=Math.max(50,s/3)),n>50&&(n=Math.max(50,n/3)),{x:-s*i*2,y:-n*i*2}},getScale(t,i){let s,n=1,{zoomMode:o,zoomSpeed:r}=i;const a=t.deltaY||t.deltaX;if(o?(s="mouse"===o||!t.deltaX&&(e.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)):s=!t.shiftKey&&(t.metaKey||t.ctrlKey),s){r=E.within(r,0,1);n=1-a/(4*(t.deltaY?i.delta.y:i.delta.x))*r,n<.5&&(n=.5),n>=1.5&&(n=1.5)}return n}};class hg{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(e){const{interaction:i}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0}),i.emit(t.MoveEvent.START,this.moveData)),e.path=this.moveData.path,i.emit(t.MoveEvent.BEFORE_MOVE,e),i.emit(t.MoveEvent.MOVE,e),this.transformEndWait()}zoom(e){const{interaction:i}=this;this.zoomData||(this.setPath(e),this.zoomData=Object.assign(Object.assign({},e),{scale:1}),i.emit(t.ZoomEvent.START,this.zoomData)),e.path=this.zoomData.path,i.emit(t.ZoomEvent.BEFORE_ZOOM,e),i.emit(t.ZoomEvent.ZOOM,e),this.transformEndWait()}rotate(e){const{interaction:i}=this;this.rotateData||(this.setPath(e),this.rotateData=Object.assign(Object.assign({},e),{rotation:0}),i.emit(t.RotateEvent.START,this.rotateData)),e.path=this.rotateData.path,i.emit(t.RotateEvent.BEFORE_ROTATE,e),i.emit(t.RotateEvent.ROTATE,e),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:e,moveData:i,zoomData:s,rotateData:n}=this;i&&e.emit(t.MoveEvent.END,i),s&&e.emit(t.ZoomEvent.END,s),n&&e.emit(t.RotateEvent.END,n),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const lg=t.Leafer.prototype,dg=new At;function cg(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function ug(t,e){return Object.assign(Object.assign({},e),{scale:t})}lg.initType=function(t){sg.run(t,this)},lg.getValidMove=function(t,e){const{scroll:i,disabled:s}=this.app.config.move;if(i){const s=!0===i?"":i;if(s.includes("x")?(t=t||e,e=0):s.includes("y")?(e=e||t,t=0):Math.abs(t)>Math.abs(e)?e=0:t=0,s.includes("limit")){const{x:i,y:s,width:n,height:o}=dg.set(this.__world).addPoint(this.zoomLayer),r=i+n-this.width,a=s+o-this.height;i>=0&&r<=0?t=0:t>0?i+t>0&&(t=-i):t<0&&r+t<0&&(t=-r),s>=0&&a<=0?e=0:e>0?s+e>0&&(e=-s):e<0&&a+e<0&&(e=-a)}}return{x:s?0:t,y:s?0:e}},lg.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,o=Math.abs(e*t);return i&&o<i?t=i/e:s&&o>s&&(t=s/e),n?1:t};const pg=dd.prototype;pg.createTransformer=function(){this.transformer=new hg(this)},pg.move=function(t){this.transformer.move(t)},pg.zoom=function(t){this.transformer.zoom(t)},pg.rotate=function(t){this.transformer.rotate(t)},pg.transformEnd=function(){this.transformer.transformEnd()},pg.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const o=e.getScale?e.getScale(t,e):ag.getScale(t,e);if(1!==o)this.zoom(ug(o,t));else{const s=e.getMove?e.getMove(t,e):ag.getMove(t,e);i.snap&&Z.round(s),this.move(cg(s,t))}},pg.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:n,center:o}=rg.getData(e);Object.assign(t,o),t.multiTouch=!0,this.pointerWaitCancel(),this.rotate(function(t,e){return Object.assign(Object.assign({},e),{rotation:t})}(s,t)),this.zoom(ug(n,t)),this.move(cg(i,t))};const _g=td.prototype,{abs:gg}=Math;function fg(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}_g.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=gg(i),o=gg(s),r=e?1:.1,a=this.canAnimate&&this.moving&&(n>r||o>r)&&this.interaction.m.dragAnimate;if(a){const r="touch"===t.pointerType?3:1,h=70;n*(e=e?d(a)?a:.95:r)>h?e=h/n:o*e>h&&(e=h/o),t=Object.assign({},t),Z.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},_g.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},_g.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},_g.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:o}=e.m;if(!o||!s||!n)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Rt.maxX(r),d=Rt.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let p=0,_=0;this.autoMoveTimer=setInterval(()=>{p+=c,_+=u,Z.move(i,c,u),Z.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:p,totalY:_,moveType:"drag"})),e.pointerMoveReal(t)},10)},_g.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Vt.add("viewport"),Vt.add("view"),t.Leafer.prototype.zoom=function(t,e,i,s){let n;this.killAnimate(),g(e)?(n=e.padding,i=e.scroll,s=e.transition):n=e;const{zoomLayer:o}=this,r=this.canvas.bounds.clone().shrink(a(n)?30:n),l=new At,c={x:r.x+r.width/2,y:r.y+r.height/2};let u;const{x:f,y:y,scaleX:m,scaleY:v}=o.__;if(h(t))switch(t){case"in":u=fg(m,"in");break;case"out":u=fg(m,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new At(this.boxBounds)).height=0;break;case"fit-height":(t=new At(this.boxBounds)).width=0}else d(t)&&(u=t/m);if(u)u=this.getValidScale(u),o.scaleOfWorld(c,u,u,!1,s);else if(_(t)){const e={x:f,y:y,scaleX:m,scaleY:v},n=p(t);if(n||t.tag){const e=n?t:[t];l.setListWithFn(e,jo.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:o,height:r}=t;return r||(r=o*(e.height/e.width),i=!0),o||(o=r*(e.width/e.height),i=!0),i?{x:s,y:n,width:o,height:r}:t}(t,r);l.set(o.getWorldBounds(e))}const{width:a,height:h}=l;let d=r.x-l.x,c=r.y-l.y;return i?(d+=Math.max((r.width-a)/2,0),c+=Math.max((r.height-h)/2,0)):(u=this.getValidScale(Math.min(r.width/a,r.height/h)),d+=(r.width-a*u)/2,c+=(r.height-h*u)/2,Z.scaleOf(e,l,u),l.scaleOf(l,u),e.scaleX*=u,e.scaleY*=u),"x"===i?c=0:"y"===i&&(d=0),Z.move(e,d,c),l.move(d,c),o.set(e,s),l}return o.worldBoxBounds};class yg extends t.Group{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&y.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(e){let i;h(e)?(i={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===e&&(i.fill="white",i.stroke="rgba(0,0,0,0.2)")):i=e,this.scrollXBar||this.addMany(this.scrollXBar=new t.Box,this.scrollYBar=new t.Box),i=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},i),i.height||(i.height=i.width),this.scrollXBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:o}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(o))return;this.scrollBounds=new At(o);const r=n.bounds.clone().shrink(i),a=r.clone().add(o),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,p=l<1,{scrollXBar:_,scrollYBar:g}=this,{x:f,y:y,width:m,height:v}=r.shrink([2,p?g.width+6:2,u?_.height+6:2,2]);_.set({x:f+m*d,y:y+v+2,width:Math.max(m*h,e),visible:u}),g.set({x:f+m+2,y:y+v*c,height:Math.max(v*l,e),visible:p})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:e,scrollYBar:i}=this;this.__eventIds=[e.on_(t.DragEvent.DRAG,this.onDrag,this),i.on_(t.DragEvent.DRAG,this.onDrag,this),e.on_(t.DragEvent.END,this.onDragEnd,this),i.on_(t.DragEvent.END,this.onDragEnd,this),this.target.on_(Br.BEFORE,()=>this.update(!0)),this.target.leafer.on_(br.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}Vt.add("scroll");class mg extends Zh{setText(t){this._text=t,this.__htmlChanged=!0}}t.HTMLText=class extends t.Image{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),o=s+10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}">\n <foreignObject width="${o}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.text}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(r)),t.__naturalWidth=o/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}},te([yo(mg)],t.HTMLText.prototype,"__",void 0),te([Jn("")],t.HTMLText.prototype,"text",void 0),te([Gn("TextEditor")],t.HTMLText.prototype,"editInner",void 0),te([ro(!1)],t.HTMLText.prototype,"textEditing",void 0),t.HTMLText=te([So()],t.HTMLText),Vt.add("html");class vg extends Uh{}function wg(t){return Yn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,so(this)}}}))}t.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}},te([yo(vg)],t.Arrow.prototype,"__",void 0),te([wg("angle")],t.Arrow.prototype,"endArrow",void 0),t.Arrow=te([So()],t.Arrow);const{M:xg,L:bg,C:Eg,Q:kg,O:Bg}=ge,{rotate:Sg,copyFrom:Tg,scale:Pg}=Z,Rg={},Lg={layout(t,e,i,s,n,o,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case xg:case bg:Cg(t,l+1,e,i,s,n,o,r),l+=3;break;case Eg:for(h=1;h<6;h+=2)Cg(t,l+h,e,i,s,n,o,r);l+=7;break;case kg:for(h=1;h<4;h+=2)Cg(t,l+h,e,i,s,n,o,r);l+=5;break;case Bg:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),o&&(t[l+4]+=o,t[l+5]+=o),l+=7}},rotate(t,e,i){Lg.layout(t,0,0,1,1,e,i)}};function Cg(t,e,i,s,n,o,r,a){Tg(Rg,t[e],t[e+1]),r&&Sg(Rg,r,a),n&&Pg(Rg,n,o),t[e]=i+Rg.x,t[e+1]=s+Rg.y}const{layout:Og,rotate:Ag}=Lg,{getAngle:Dg}=Z,Mg={x:-.5},Ig={connect:Mg,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Fg={connect:Mg,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Wg={connect:Mg,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},zg={connect:Mg,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},Ug={offset:Mg,path:[...Wg.path],dashPath:[1,-2.5,0,2,-1,0]};Ag(Ug.path,180,{x:-1.5,y:0});const Hg={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},Ng={connect:{x:.5},path:[...Hg.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Yg={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},Xg={path:[...Yg.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Vg=y.clone(Yg),Gg=y.clone(Xg);Ag(Vg.path,45),Ag(Gg.path,45);const jg={angle:Ig,"angle-side":Fg,arrow:zg,triangle:Wg,"triangle-flip":Ug,circle:Ng,"circle-line":Hg,square:Xg,"square-line":Yg,diamond:Gg,"diamond-line":Vg,mark:{offset:Mg,path:[1,0,-2,2,0,2]}};function Kg(t,e,i,s,n,o,r){const{strokeCap:a,strokeJoin:h}=t.__,{offset:l,connect:d,path:c,dashPath:u}=_(e)?e:jg[e];let p=d?d.x:0,g=l?l.x:0;const f=[...c];return r&&u&&f.push(...u),"none"!==a&&(p-=.5),l&&("round"===h&&l.roundJoin?g+=l.roundJoin:"bevel"===h&&l.bevelJoin&&(g+=l.bevelJoin)),g&&Og(f,g,0),Og(f,s.x,s.y,n,n,Dg(i,s)),o.x=(p+g)*n,f}const{M:Zg,L:qg,C:Jg,Q:$g,Z:Qg,N:tf,D:ef,X:sf,G:nf,F:of,O:rf,P:af,U:hf}=ge,{copy:lf,copyFrom:df,getDistancePoint:cf}=Z,uf={},pf={},_f={},gf={},ff={},yf={list:jg,addArrows(t,e){const{startArrow:i,endArrow:s,strokeWidth:n,dashPattern:o,__pathForRender:r}=t.__;let a,h=0,l=r.length,d=0,c=i&&"none"!==i;for(;h<l;){switch(a=r[h],a){case Zg:case qg:(d<2||h+6>=l)&&(df(ff,r[h+1],r[h+2]),!d&&c&&lf(pf,ff)),h+=3;break;case Jg:1!==d&&h+7!==l||mf(r,gf,ff,h+3),h+=7;break;case $g:1!==d&&h+5!==l||mf(r,gf,ff,h+1),h+=5;break;case Qg:return;case tf:h+=5;break;case ef:h+=9;break;case sf:h+=6;break;case nf:h+=9;break;case of:h+=5;break;case rf:h+=7;break;case af:h+=4;break;case hf:1!==d&&h+6!==l||mf(r,gf,ff,h+1),h+=6}if(d++,1===d&&a!==Zg)return;if(2===d&&c&&lf(_f,a===qg?ff:gf),h===l){const l=t.__.__pathForRender=e?[...r]:r,d=t.__.__pathForArrow=[];if(c){const e=Kg(t,i,_f,pf,n,uf,!!o);o?d.push(...e):l.push(...e),uf.x&&(cf(pf,_f,-uf.x,!0),l[1]=_f.x,l[2]=_f.y)}if(s&&"none"!==s){const e=Kg(t,s,gf,ff,n,uf,!!o);if(o?d.push(...e):l.push(...e),uf.x){let t;switch(cf(ff,gf,-uf.x,!0),a){case qg:t=h-3+1;break;case Jg:t=h-7+5;break;case $g:t=h-5+3;break;case hf:t=h-6+3}t&&vf(l,gf,t)}}}else lf(gf,ff)}}};function mf(t,e,i,s){df(e,t[s],t[s+1]),df(i,t[s+2],t[s+3])}function vf(t,e,i){t[i]=e.x,t[i+1]=e.y}Vt.add("arrow"),t.UI.addAttr("startArrow","none",wg),t.UI.addAttr("endArrow","none",wg),Object.assign(vh,yf),Object.assign(wh,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});t.Flow=class extends t.Box{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}},te([yo(class extends Fh{})],t.Flow.prototype,"__",void 0),te([Kn("x")],t.Flow.prototype,"flow",void 0),t.Flow=te([So()],t.Flow);const wf={},xf={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},bf={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function Ef(t,e,i){const s=t.__,{contentBounds:n}=t.__layout;ut.toPoint(i,e,n,wf),e.x=s.__autoWidth?n.x:wf.x,e.y=s.__autoHeight?n.y:wf.y}const{move:kf}=Z;function Bf(t,e,i,s,n,o){const{children:r}=t;let a,h,{x:l,start:d}=e,c=s;l+=i;for(let t=0,i=e.count;t<i;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=s+(e.height-h.height)/("center"===n?2:1)),kf(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function Sf(t,e,i){const s="width"===i?"height":"width";t[i]=Math.max(t[i],e[i]),t[s]+=t.count?e[s]+t.gap:e[s],t.list.push(e),t.count++}const Tf={};function Pf(t,e){const{gap:i,flowAlign:s,flowWrap:n,__autoWidth:o,__autoHeight:r}=t.__,a=n&&(e?!o:!r);return _(i)?(Tf.xGap=i.x||0,Tf.yGap=i.y||0):Tf.xGap=Tf.yGap=u(i),Tf.isAutoXGap=h(Tf.xGap)&&!o,Tf.isAutoYGap=h(Tf.yGap)&&!r,Tf.complex=a||"top-left"!==s||t.__hasGrow||Tf.isAutoXGap||Tf.isAutoYGap,Tf.wrap=a,Tf.complex&&(Tf.isFitXGap="fit"===Tf.xGap&&!o,Tf.isFitYGap="fit"===Tf.yGap&&!r,_(s)?(Tf.contentAlign=s.content||"top-left",Tf.rowXAlign=s.x||"from",Tf.rowYAlign=s.y||"from"):(Tf.contentAlign=s,Tf.rowXAlign=xf[s],Tf.rowYAlign=bf[s])),Tf}function Rf(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function Lf(t,e,i,s){const{count:n}=t;n>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(n-1),t[e]=i)}function Cf(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:Of}=E;function Af(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.width)/l,{children:u}=t;if(!(c<=0)){e.width=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__widthGrow)&&(r=Df(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.widthRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__widthGrow,n=e/i*s,r=Df(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function Df(t,e,i){const{widthRange:s,lockRatio:n}=t.__,o=s?Of(i,s):i,r=o/e.width;return t.scaleResize(r,n?r:1),e.width=o,i-o}const{within:Mf}=E;function If(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.height)/l,{children:u}=t;if(!(c<=0)){e.height=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__heightGrow)&&(r=Ff(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.heightRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__heightGrow,n=e/i*s,r=Ff(t,o=t.__flowBounds,o.height+n),e-=n-r,i-=s})}(h,a,l)}}function Ff(t,e,i){const{heightRange:s,lockRatio:n}=t.__,o=s?Mf(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:Wf}=Z;function zf(t,e){const i="width",{children:s,itemBox:n}=t,o=Pf(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},p=d?0:h;let _,g,f,y,m,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)_=s[y=e?h-1-o:o],_.__.inFlow&&0!==_.__.visible&&(g=Cf(_,n),r?(_.__flowBounds=g,m||(m=Rf(y,p)),a&&m.count&&m.width+g.width>x&&(m.grow?Af(t,m,x,e):d&&Lf(m,i,x,c),Sf(u,m,i),m=Rf(y,p)),f=g.width,_.__widthGrow&&(m.grow+=_.__widthGrow,f=0,_.__.widthRange&&(m.hasRangeSize=!0)),_.__heightGrow&&Ff(_,g,b),m.width+=m.count?f+p:f,m.height=Math.max(m.height,g.height),m.count++):(Wf(_,v-g.x,w-g.y),v+=g.width+p));if(r&&m){const{isAutoYGap:s,isFitYGap:n,contentAlign:r,rowXAlign:h,rowYAlign:p}=o;m.count&&(m.grow?Af(t,m,x,e):d&&Lf(m,i,x,c),a&&Sf(u,m,i)),a?(s?Lf(u,"height",b,n):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){Ef(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=xf[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],Bf(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,p,e)):(Ef(t,m,r),Bf(t,m,0,m.y,p,e))}}const{move:Uf}=Z;function Hf(t,e,i,s,n,o){const{children:r}=t;let a,h,{y:l,start:d}=e,c=i;l+=s;for(let t=0,s=e.count;t<s;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=i+(e.width-h.width)/("center"===n?2:1)),Uf(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:Nf}=Z;function Yf(t,e){const i="height",{children:s,itemBox:n}=t,o=Pf(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},p=d?0:l;let _,g,f,y,m,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)_=s[y=e?h-1-o:o],_.__.inFlow&&0!==_.__.visible&&(g=Cf(_,n),r?(_.__flowBounds=g,m||(m=Rf(y,p)),a&&m.count&&m.height+g.height>b&&(m.grow&&If(t,m,b,e),d&&Lf(m,i,b,c),Sf(u,m,i),m=Rf(y,p)),f=g.height,_.__heightGrow&&(m.grow+=_.__heightGrow,f=0,_.__.heightRange&&(m.hasRangeSize=!0)),_.__widthGrow&&Df(_,g,x),m.height+=m.count?f+p:f,m.width=Math.max(m.width,g.width),m.count++):(Nf(_,v-g.x,w-g.y),w+=g.height+p));if(r&&m){const{isAutoXGap:s,isFitXGap:n,contentAlign:r,rowXAlign:l,rowYAlign:p}=o;m.count&&(m.grow&&If(t,m,b,e),d&&Lf(m,i,b,c),a&&Sf(u,m,i)),a?(s?Lf(u,"width",x,n):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){Ef(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=bf[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,p),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],Hf(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(Ef(t,m,r),Hf(t,m,m.x,0,l,e))}}function Xf(t){return Yn(t,t=>({set(e){const i=d(e)?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent(()=>{this.parent.__hasGrow=!0}),this.__setAttr(t,e)&&Qn(this)}}))}Vt.add("flow","resize");const Vf=t.Box.prototype,{__updateBoxBounds:Gf}=t.Group.prototype;t.UI.addAttr("flow",!1,Kn),t.UI.addAttr("gap",0,Jn),t.UI.addAttr("flowAlign","top-left",Jn),t.UI.addAttr("flowWrap",!1,Jn),t.UI.addAttr("itemBox","box",Jn),t.UI.addAttr("inFlow",!0,Jn),t.UI.addAttr("autoWidth",void 0,Xf),t.UI.addAttr("autoHeight",void 0,Xf),t.UI.addAttr("autoBox",void 0,Jn);const{copyAndSpread:jf}=Rt;Vf.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:zf(this);break;case"y":Yf(this);break;case"x-reverse":zf(this,!0);break;case"y-reverse":Yf(this,!0)}t&&(this.leafer.created=!0)},Vf.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),jf(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},Vf.__updateBoxBounds=function(t){if(this.children.length&&!this.pathInputed){const e=this.__,{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():Gf.call(this);const{boxBounds:s}=this.__layout;e.__autoSize||(e.__autoWidth?(i||(s.width+=s.x,s.x=0),s.height=e.height,s.y=0):(i||(s.height+=s.y,s.y=0),s.width=e.width,s.x=0)),i&&t&&e.padding&&jf(s,s,e.padding,!1,e.__autoSize?null:e.__autoWidth?"width":"height"),this.__updateNaturalSize()}else this.__updateRectBoxBounds();i&&this.__updateContentBounds()}else this.__updateRectBoxBounds()};const{cos:Kf,sin:Zf,pow:qf,sqrt:Jf,abs:$f,ceil:Qf,floor:ty,round:ey,PI:iy}=Math,sy=5*iy,ny=1.70158,oy=2.5949095,ry=7.5625,ay=2.75;function hy(t){return e=>qf(e,t)}function ly(t){return e=>1-qf(1-e,t)}function dy(t){return e=>e<.5?.5*qf(2*e,t):1-.5*qf(2-2*e,t)}function cy(t){return t<1/ay?ry*t*t:t<2/ay?ry*(t-=1.5/ay)*t+.75:t<2.5/ay?ry*(t-=2.25/ay)*t+.9375:ry*(t-=2.625/ay)*t+.984375}function uy(t,e,i,s){const n={};return o=>{const r=~~(1e4*o),a=n[r];if(a)return a;let h,l,d,c=o;for(let e=0;e<8&&(h=1-c,d=py(c,t,i)-o,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!($f(l)<1e-6));e++)c-=d/l;return n[r]=py(c,e,s)}}function py(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const _y={get(t){const{list:e}=_y;return h(t)?e[t||"ease"]:_(t)?e[t.name].apply(e,p(t.value)?t.value:[t.value]):e.ease},register(t,e){_y.list[t]=e},list:{linear:t=>t,ease:uy(.25,.1,.25,1),"ease-in":uy(.42,0,1,1),"ease-out":uy(0,0,.58,1),"ease-in-out":uy(.42,0,.58,1),"sine-in":t=>1-Kf(t*iy*.5),"sine-out":t=>Zf(t*iy*.5),"sine-in-out":t=>.5*(1-Kf(t*iy)),"quad-in":hy(2),"quad-out":ly(2),"quad-in-out":dy(2),"cubic-in":hy(3),"cubic-out":ly(3),"cubic-in-out":dy(3),"quart-in":hy(4),"quart-out":ly(4),"quart-in-out":dy(4),"quint-in":hy(5),"quint-out":ly(5),"quint-in-out":dy(5),"expo-in":t=>t?qf(2,10*t-10):0,"expo-out":t=>1===t?1:1-qf(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*qf(2,2*t*10-10):.5*(2-qf(2,10-2*t*10)),"circ-in":t=>1-Jf(1-qf(t,2)),"circ-out":t=>Jf(1-qf(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Jf(1-qf(2*t,2))):.5*(Jf(1-qf(2-2*t,2))+1),"back-in":t=>((ny+1)*t-ny)*t*t,"back-out":t=>(t-=1)*t*((ny+1)*t+ny)+1,"back-in-out":t=>t<.5?(t*=2)*t*((oy+1)*t-oy)*.5:.5*((t=2*t-2)*t*((oy+1)*t+oy)+2),"elastic-in":t=>0===t||1===t?t:-qf(2,10*(t-1))*Zf((t-1.1)*sy),"elastic-out":t=>0===t||1===t?t:qf(2,-10*t)*Zf((t-.1)*sy)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-qf(2,10*((t*=2)-1))*Zf((t-1.1)*sy)*.5:qf(2,10*(1-(t*=2)))*Zf((t-1.1)*sy)*.5+1,"bounce-in":t=>1-cy(1-t),"bounce-out":cy,"bounce-in-out":t=>t<.5?.5*(1-cy(1-2*t)):.5*(1+cy(2*t-1)),"cubic-bezier":uy,steps:function(t,e="floor"){return i=>("floor"===e?ty(i*t):"ceil"===e?Qf(i*t):ey(i*t))/t}}};function gy(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class fy{}fy.CREATED="created",fy.PLAY="play",fy.PAUSE="pause",fy.STOP="stop",fy.SEEK="seek",fy.UPDATE="update",fy.COMPLETED="completed";t.Animate=class extends Ar{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&d(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=p(e)?e:e?[e]:[];const{easing:n,attrs:o}=this;this.easingFn=_y.get(n),(o||this.attrsMap)&&(this.attrsMap=o?o.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emitType(fy.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(fy.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(fy.STOP))}seek(t){this.destroyed||(_(t)&&(t=mh.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer(()=>this.requestAnimate()),this.emitType(fy.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,o=!(n>1)||this.join;let a,h,l,c,u,p=0,_=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(h=i[s],c=h.style||h,a||(a=o?t:c),l={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:o,loop:r}=h;o&&(l.swing=d(o)?o:2,u=2*l.swing-1),r&&(l.loop=u=d(r)?r:2),t?(l.duration=t,p+=t*u,i&&(l.totalTime=t+i)):e&&(l.autoDuration=e,_+=e*u),i?(l.delay=i,p+=i*u):s&&(l.autoDelay=s,_+=s*u),n&&(l.easingFn=_y.get(n))}if(!l.autoDuration&&r(l.duration)&&(n>1?s>0||o?_+=u:l.duration=0:l.duration=this.duration),n>1)this.setBefore(l,c,a);else{for(let e in c)l.beforeStyle[e]=t[e];this.fromStyle=l.beforeStyle,this.toStyle=l.style}a=c,e.push(l)}_?((this.duration<=p||!s||!s.duration)&&this.changeDuration(p+.2*_),this.allocateTime((this.duration-p)/_)):p&&this.changeDuration(p),this.emitType(fy.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:n,target:o}=this;for(let a in e)r(s[a])&&(s[a]=n[a]=e===i?i[a]:o[a]),t.beforeStyle[a]=r(i[a])?n[a]:i[a],n[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],r(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),e.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(fy.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:o}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),Th.setBetweenStyle(r,s,n,e,t,o,i),this.setStyle(r)}this.emitType(fy.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return d(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}},te([gy("ease")],t.Animate.prototype,"easing",void 0),te([gy(0)],t.Animate.prototype,"delay",void 0),te([gy(.2)],t.Animate.prototype,"duration",void 0),te([gy("auto")],t.Animate.prototype,"ending",void 0),te([gy(!1)],t.Animate.prototype,"reverse",void 0),te([gy(!1)],t.Animate.prototype,"swing",void 0),te([gy(!1)],t.Animate.prototype,"loop",void 0),te([gy(0)],t.Animate.prototype,"loopDelay",void 0),te([gy(1)],t.Animate.prototype,"speed",void 0),te([gy(!0)],t.Animate.prototype,"autoplay",void 0),te([gy()],t.Animate.prototype,"join",void 0),te([gy()],t.Animate.prototype,"attrs",void 0),t.Animate=te([Bo(Xr)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=e.map(e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s})}play(){this.each(t=>t.play()),this.emitType(fy.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(fy.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(fy.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(fy.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case fy.COMPLETED:this.completed&&this.emitType(t);break;case fy.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}},t.AnimateList=te([Bo(Xr)],t.AnimateList);const yy={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},my=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,vy=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,wy=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,xy=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,by=parseInt,Ey=parseFloat,{round:ky}=Math;let By={},Sy=0;function Ty(t){let e,i,s,n=1;switch(t.length){case 9:e=by(t.slice(1,3),16),i=by(t.slice(3,5),16),s=by(t.slice(5,7),16),n=by(t.slice(7,9),16)/255;break;case 7:e=by(t.slice(1,3),16),i=by(t.slice(3,5),16),s=by(t.slice(5,7),16);break;case 5:e=by(t[1]+t[1],16),i=by(t[2]+t[2],16),s=by(t[3]+t[3],16),n=by(t[4]+t[4],16)/255;break;case 4:e=by(t[1]+t[1],16),i=by(t[2]+t[2],16),s=by(t[3]+t[3],16);break;case 3:e=i=s=by(t[1]+t[2],16);break;case 2:e=i=s=by(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const Py=1/6,Ry=.5,Ly=2/3,Cy=1/3;function Oy(t,e,i){return i<0?i++:i>1&&i--,i<Py?t+6*(e-t)*i:i<Ry?e:i<Ly?t+(e-t)*(Ly-i)*6:t}function Ay(t,e,i,s=1){let n,o,r;if(t/=360,i/=100,0===(e/=100))n=o=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=Oy(a,s,t+Cy),o=Oy(a,s,t),r=Oy(a,s,t-Cy)}return{r:ky(255*n),g:ky(255*o),b:ky(255*r),a:s}}Vt.add("color"),yh.object=function(t,e){let i,s=!r(e)&&e<1;if(h(t)){const e=By[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Ty(t);break;case"R":case"r":"("===t[4]&&vy.test(t)?i=function(t){const e=vy.exec(t);return{r:by(e[1]),g:by(e[2]),b:by(e[3]),a:Ey(e[4])}}(t):"("===t[3]&&my.test(t)&&(i=function(t){const e=my.exec(t);return{r:by(e[1]),g:by(e[2]),b:by(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&xy.test(t)?i=function(t){const e=xy.exec(t);return Ay(Ey(e[1]),Ey(e[2]),Ey(e[3]),Ey(e[4]))}(t):"("===t[3]&&wy.test(t)&&(i=function(t){const e=wy.exec(t);return Ay(Ey(e[1]),Ey(e[2]),Ey(e[3]),1)}(t))}if(!i){const e=yy[t.toLowerCase()];e&&(i=Ty("#"+e))}i&&(Sy++,Sy>1e4&&(By={},Sy=0),By[t]=Object.assign({},i))}}else _(t)&&(r(t.a)&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:Dy}=Math,{fourNumber:My}=E,Iy={fill:Hy,stroke:Hy,cornerRadius:(t,e,i)=>d(t)&&d(e)?zy(t,e,i):(t=My(t),e=My(e),t.map((t,s)=>zy(t,e[s],i))),text(t,e,i){if(h(t)&&h(e)){const s=t.length,n=e.length,o=zy(s,n,i,1);return s<n?e.substring(0,o):t.substring(0,o)}return d(t)||d(e)?E.float(zy(t,e,i),Math.max(Wy(t),Wy(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return Th.setBetweenStyle(n,t,e,n,i,s),n},shadow:Ny,innerShadow:Ny},Fy={value:function(t,e,i){const s=d(t),n=d(e);return s&&n?t+(e-t)*i:n||s?zy(t,e,i):t},number:zy,color:Uy,setBetweenStyle:function(t,e,i,s,n,o,r){let a,h,l;const{list:d,value:c}=Th;for(let u in s)r&&!r[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,o)))}};function Wy(t){const e=String(t).split(".")[1];return e?e.length:0}function zy(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?Dy(n):n}function Uy(t,e,i){t=yh.object(t),e=yh.object(e);const s=zy(t.r,e.r,i,1)+","+zy(t.g,e.g,i,1)+","+zy(t.b,e.b,i,1),n=zy(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function Hy(t,e,i){return h(t)&&h(e)?Uy(t,e,i):e}function Ny(t,e,i){return p(t)||p(e)?e:(e=e||{},{x:zy((t=t||{}).x,e.x,i),y:zy(t.y,e.y,i),blur:zy(t.blur,e.blur,i),spread:zy(t.spread,e.spread,i),color:Uy(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}Vt.add("animate","color"),Sh.canAnimate=!0,Object.assign(Th.list,Iy),Object.assign(Th,Fy);const Yy=t.UI.prototype;t.UI.addAttr("animation",void 0,function(t){return Yn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),t.UI.addAttr("animationOut",void 0,Gn),t.UI.addAttr("transition",!0,Gn),t.UI.addAttr("transitionOut",void 0,Gn),Yy.animate=function(e,i,s,n){if(r(e))return this.__animate;let o=p(e)&&!i&&s?new t.AnimateList(this,e,n):new t.Animate(this,e,i,n);this.killAnimate(s,o.toStyle);const a=this.__animate;return a&&(o instanceof t.AnimateList?o.list.unshift(a):o=new t.AnimateList(this,[a,o])),this.__animate=o},Yy.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},Yy.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(fy.COMPLETED,e)};const Xy=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Vy=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Gy}=Math,{getDerivative:jy}=He,Ky={getDistance(t,e,i,s,n,o,r,a,h=1){let l,d,c,u,p,_,g=0,f=h/2;for(let h=0;h<Xy.length;h++)l=f*(1+Xy[h]),d=f*(1-Xy[h]),c=jy(l,t,i,n,r),u=jy(l,e,s,o,a),p=jy(d,t,i,n,r),_=jy(d,e,s,o,a),g+=Vy[h]*(Gy(c*c+u*u)+Gy(p*p+_*_));return g*f},getRotation(t,e,i,s,n,o,r,a,h){const l=jy(t,e,s,o,a),d=jy(t,i,n,r,h);return Math.atan2(d,l)/B},getT(t,e,i,s,n,o,r,a,h,l,d=1){let c=0,u=1,p=t/e,_=d/e/3;if(p>=1)return 1;if(p<=0)return 0;for(;u-c>_;)Zy(i,s,n,o,r,a,h,l,p)<t?c=p:u=p,p=(c+u)/2;return p},cut(t,e,i,s,n,o,r,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*o,p=d*n+e*r,_=d*o+e*a,g=d*c+e*p,f=d*u+e*_,y=d*g+e*(d*p+e*(d*r+e*h)),m=d*f+e*(d*_+e*(d*a+e*l));t.push(ge.C,c,u,g,f,y,m)}},{getDistance:Zy}=Ky,{M:qy,L:Jy,C:$y,Z:Qy}=ge,tm={},em={},im={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case qy:case Jy:im.transformPoints(t,e,s,1),s+=3;break;case $y:im.transformPoints(t,e,s,3),s+=7;break;case Qy:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,o=n+2*s;n<o;n+=2)tm.x=t[n],tm.y=t[n+1],W.toOuterPoint(e,tm),t[n]=tm.x,t[n+1]=tm.y},getMotionPathData(t){let e,i,s,n,o=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case qy:case Jy:i=t[a+1],s=t[a+2],e=n===Jy&&a>0?Z.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case $y:i=t[a+5],s=t[a+6],e=Ky.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case Qy:a+=1;default:e=0}r.push(e),o+=e}return{total:o,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=mh.number(e,t.total);let o,r,a,h,l,d,c,u,p,_=0,g={},f=0,y=0,m=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case qy:case Jy:if(r=n[f+1],a=n[f+2],o=s[y],_+o>=e||!t.total)return f||(m=r,v=a),em.x=m,em.y=v,g.x=r,g.y=a,Z.getDistancePoint(em,g,e-_,!0),g.rotation=Z.getAngle(em,g),g;m=r,v=a,f+=3;break;case $y:if(r=n[f+5],a=n[f+6],o=s[y],_+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],p=Ky.getT(e-_,o,m,v,l,d,c,u,r,a,i),He.getPointAndSet(p,m,v,l,d,c,u,r,a,g),g.rotation=Ky.getRotation(p,m,v,l,d,c,u,r,a),g;m=r,v=a,f+=7;break;case Qy:f+=1;default:o=0}y++,_+=o}return g},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=mh.number(e,t.total);let r,a,h,l,d,c,u,p,_,g=0,f={},y=0,m=0,v=0,w=0;const x=n.length;for(;y<x;){switch(l=n[y],l){case qy:case Jy:if(a=n[y+1],h=n[y+2],r=s[m],g+r>=e||!t.total)return y||(v=a,w=h),em.x=v,em.y=w,f.x=a,f.y=h,Z.getDistancePoint(em,f,e-g,!0),o.push(l,f.x,f.y),o;v=a,w=h,y+=3,o.push(l,v,w);break;case $y:if(d=n[y+1],c=n[y+2],u=n[y+3],p=n[y+4],a=n[y+5],h=n[y+6],r=s[m],g+r>=e)return _=Ky.getT(e-g,r,v,w,d,c,u,p,a,h,i),Ky.cut(o,_,v,w,d,c,u,p,a,h),o;v=a,w=h,y+=7,o.push(l,d,c,u,p,a,h);break;case Qy:y+=1,o.push(l);default:r=0}m++,g+=r}return o}};function sm(t){return Yn(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!a(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}Vt.add("motion-path"),Th.register("motion",function(t,e,i,s){return _(t)&&(t=mh.number(t,s.getMotionTotal())),_(e)&&(e=mh.number(e,s.getMotionTotal())),Th.number(t||0,e||0,i)}),Th.register("motionRotation",function(t,e,i){return Th.number(t,e,i)});const nm=t.UI.prototype,{updateMatrix:om,updateAllMatrix:rm}=zo,{updateBounds:am}=Jo;function hm(t){const{motion:e,leaferIsCreated:i}=t;if(!a(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=dm(t);i.total&&(t.__.__pathForRender=im.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(rm(t),am(t,t)):om(t));i&&(t.leafer.created=!0)}}function lm(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function dm(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=im.getMotionPathData(t.getPath(!0,!0))}function cm(t,e){return Yn(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?Sh.setStyleName(this,e,i):Sh.set(this,i):this.__layout.stateStyleChanged=!0}}))}function um(t){return Yn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function pm(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function _m(t,e){_(e)||(e=void 0),ym(t,e,"in")}function gm(t,e){const{normalStyle:i}=t;_(e)||(e=void 0),i&&(e||(e=i),ym(t,e,"out"))}t.UI.addAttr("motionPath",void 0,sm),t.UI.addAttr("motionPrecision",1,sm),t.UI.addAttr("motion",void 0,sm),t.UI.addAttr("motionRotation",!0,sm),nm.getMotionPathData=function(){return dm(lm(this))},nm.getMotionPoint=function(t){const e=lm(this),i=dm(e);if(!i.total)return{};const s=im.getDistancePoint(i,t,e.motionPrecision);W.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:d(n)&&(s.rotation+=n),s},nm.getMotionTotal=function(){return this.getMotionPathData().total},nm.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],a(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),hm(t))}else hm(this)};const fm={};function ym(t,e,i){const{normalStyle:s}=t;e||(e=fm),e.scale&&(E.assignScale(e,e.scale),delete e.scale),e!==fm&&Sh.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&a(i[s])&&a(e[s])&&(s="transition");return a(e[s])?i[s]:e[s]}(i,e,t);const o=n?function(t,e){const i=wm(e,t),s=t.animate();s&&wm(i,t,s.fromStyle);return i}(t,e):void 0;Sh.canAnimate&&mm(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const r=mm(t);if(r){const{animation:s}=r;if(s){const o=t.animate(s,void 0,"animation",!0);Object.assign(r,o.endingStyle),"in"!==i||e.animation!==s?o.kill():n=!1,delete r.animation}t.normalStyle=vm(r,t),t.set(r,"temp")}else t.normalStyle=void 0;if(n){const e=vm(o,t);t.set(o,"temp"),t.animate([o,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function mm(t){let e;const i={},s=pm(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&Sh.isState(n,t,s)&&(e=xm(i,o));const r=i.selectedStyle||t.selectedStyle;r&&Sh.isSelected(t,s)&&(e=xm(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&Sh.isPlacehold(t,s)&&(e=xm(i,a)),Sh.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=xm(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&Sh.isFocus(t,s)&&(e=xm(i,n));const o=i.hoverStyle||t.hoverStyle;o&&Sh.isHover(t,s)&&(e=xm(i,o));const r=i.pressStyle||t.pressStyle;r&&Sh.isPress(t,s)&&(e=xm(i,r))}return e?i:void 0}function vm(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&Sh.animateExcludes[t]||(n[t]=e[t]);return n}function wm(t,e,i){return vm(t,e,i,!0)}function xm(t,e){return Object.assign(t,e),!0}function bm(t,e){const i=t[e];i&&_m(t,i),t.button&&km(t.children,e)}function Em(t,e,i){i||(i=t.states[e]),_m(t,i),t.button&&km(t.children,null,e)}function km(t,e,i){if(!t)return;let s,n;for(let o=0,a=t.length;o<a;o++){if(s=t[o],e){switch(n=!0,e){case"hoverStyle":Sh.isHover(s)&&(n=!1);break;case"pressStyle":Sh.isPress(s)&&(n=!1);break;case"focusStyle":Sh.isFocus(s)&&(n=!1)}n&&bm(s,e)}else r(i)||Em(s,i);s.isBranch&&km(s.children,e,i)}}function Bm(t,e){const i=t[e];i&&gm(t,i),t.button&&Tm(t.children,e)}function Sm(t,e,i){gm(t,i),t.button&&Tm(t.children,null,e)}function Tm(t,e,i){if(!t)return;let s;for(let n=0,o=t.length;n<o;n++)s=t[n],e?Bm(s,e):r(i)||Sm(s,i),s.isBranch&&Tm(s.children,e,i)}function Pm(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=pm(e,i);o&&(s=n[t](o))}return s}function Rm(t,e,i){let s=e[t];if(!s&&i){const n=pm(e,i);n&&(s=n[t])}return s}Vt.add("state"),Sh.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},Sh.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=pm(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},Sh.isSelected=function(t,e){return Rm("selected",t,e)},Sh.isDisabled=function(t,e){return Rm("disabled",t,e)},Sh.isFocus=function(t,e){return Pm("isFocus",t,e)},Sh.isHover=function(t,e){return Pm("isHover",t,e)},Sh.isPress=function(t,e){return Pm("isPress",t,e)},Sh.isPlacehold=function(t,e){return t.__.__isPlacehold},Sh.isDrag=function(t,e){return Pm("isDrag",t,e)},Sh.setStyleName=function(t,e,i){i?Em(t,e,t[e]):Sm(t,e,t[e])},Sh.set=function(t,e){const i=t.states[e];i?Em(t,e,i):Sm(t,e,i)},Sh.getStyle=mm,Sh.updateStyle=ym,Sh.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:bm(e,"hoverStyle");break;case t.PointerEvent.LEAVE:Bm(e,"hoverStyle");break;case t.PointerEvent.DOWN:bm(e,"pressStyle");break;case t.PointerEvent.UP:Bm(e,"pressStyle")}};const Lm=t.UI.prototype;t.UI.addAttr("selected",!1,cm,"selectedStyle"),t.UI.addAttr("disabled",!1,cm,"disabledStyle"),t.UI.addAttr("states",{},um),t.UI.addAttr("state","",cm),t.UI.addAttr("normalStyle",void 0,Gn),t.UI.addAttr("hoverStyle",void 0,um),t.UI.addAttr("pressStyle",void 0,um),t.UI.addAttr("focusStyle",void 0,um),t.UI.addAttr("selectedStyle",void 0,um),t.UI.addAttr("disabledStyle",void 0,um),t.UI.addAttr("placeholderStyle",void 0,um),t.UI.addAttr("button",!1,Gn),Lm.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?bm(this,"focusStyle"):Bm(this,"focusStyle")})},Lm.updateState=function(){Sh.updateStyle(this,void 0,"in")};const Cm=t.Text.prototype,Om="text";Un(Cm,Om,Object.assign(Object.assign({},Hn(Cm,Om)),{set(t){const e=this,i=e.text;e.__setAttr(Om,t)&&(Qn(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class Am extends Dh{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;p(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!r(t))if(d(t))this.now=t;else if(_(t)){const e=p(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=An.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:n,size:o,total:r}=e,{width:a,height:h}=o&&(d(o)?{width:o,height:o}:o)||(r>1?this:t);let l=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:l,y:c,width:a,height:h},l+a>=t.width?(l=0,c+=h):l+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new gr(gr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),r(n.loop)||(s=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},te([yo(Am)],t.Robot.prototype,"__",void 0),te([Jn()],t.Robot.prototype,"robot",void 0),te([Gn()],t.Robot.prototype,"actions",void 0),te([Gn("")],t.Robot.prototype,"action",void 0),te([ro(0)],t.Robot.prototype,"now",void 0),te([Gn(12)],t.Robot.prototype,"FPS",void 0),te([Gn(!0)],t.Robot.prototype,"loop",void 0),t.Robot=te([So()],t.Robot),Vt.add("robot");const{Yes:Dm,NoAndSkip:Mm,YesAndSkip:Im}=t.Answer,Fm={},Wm={},zm={};class Um{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":Fm.id=t.substring(1),t=Fm;break;case".":Wm.className=t.substring(1),t=Wm;break;default:zm.tag=t,t=zm}case"object":if(r(t.id)){if(t.tag){const{tag:s}=t,n=p(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?y.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&zo.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],o=e(n,s),o===Dm||o===Im){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<Mm&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(pr.REMOVE,this.__onRemoveChild,this),this.target.on_(_r.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const Hm=t.UI.prototype;function Nm(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Gt.selector())}Hm.find=function(t,e){return Nm(this).getBy(t,this,!1,e)},Hm.findOne=function(t,e){return Nm(this).getBy(t,this,!0,e)},Vt.add("find"),Gt.finder=function(t){return new Um(t)};const{setPoint:Ym,addPoint:Xm,toBounds:Vm}=nt;const Gm={syncExport(t,i,s){let n;Bh.running=!0;try{const o=Bn.fileType(i),a=i.includes(".");s=Bn.getExportOptions(s);const{toURL:h}=e,{download:l}=e.origin;if("json"===o)a&&l(h(JSON.stringify(t.toJSON(s.json)),"text"),i),n={data:!!a||t.toJSON(s.json)};else if("svg"===o)a&&l(h(t.toSVG(),"svg"),i),n={data:!!a||t.toSVG()};else{let e,o,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:p,clip:_,trim:g,screenshot:f,padding:y,onCanvas:m}=s,v=r(s.smooth)?!c||c.config.smooth:s.smooth,w=s.contextSettings||(c?c.config.contextSettings:void 0),x=d&&f&&r(s.fill)?t.fill:s.fill,b=Bn.isOpaqueImage(i)||x,k=new it;if(f)e=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let i=s.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,i){case"inner":k.set(l);break;case"local":k.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":i=c||t;default:k.set(l).divide(t.getTransform(i));const e=i.worldTransform;a/=a/e.scaleX,h/=h/e.scaleY}e=t.getBounds("render",i)}const B={scaleX:1,scaleY:1};E.getScaleData(s.scale,s.size,e,B);let S=s.pixelRatio||1,{x:T,y:P,width:R,height:L}=new At(e).scale(B.scaleX,B.scaleY);_&&(T+=_.x,P+=_.y,R=_.width,L=_.height);const C={exporting:!0,matrix:k.scale(1/B.scaleX,1/B.scaleY).invert().translate(-T,-P).withScale(1/a*B.scaleX,1/h*B.scaleY)};let O,A=Gt.canvas({width:Math.floor(R),height:Math.floor(L),pixelRatio:S,smooth:v,contextSettings:w});if(p&&(O=t,O.__worldOpacity=0,t=c||t,C.bounds=A.bounds),A.save(),u&&!r(x)){const e=t.get("fill");t.fill="",t.__render(A,C),t.fill=e}else t.__render(A,C);if(A.restore(),O&&O.__updateWorldOpacity(),g){o=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,o=(a-n)/e,r?Xm(r,n,o):Ym(r={},n,o)),a++;const h=new At;return r&&(Vm(r,h),h.scale(1/t.pixelRatio).ceil()),h}(A);const t=A,{width:e,height:i}=o,s={x:0,y:0,width:e,height:i,pixelRatio:S};A=Gt.canvas(s),A.copyWorld(t,o,s),t.destroy()}if(y){const[t,e,i,s]=E.fourNumber(y),n=A,{width:o,height:r}=n;A=Gt.canvas({width:o+s+e,height:r+t+i,pixelRatio:S}),A.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:r}),n.destroy()}b&&A.fillWorld(A.bounds,x||"#FFFFFF","destination-over"),m&&m(A);n={data:"canvas"===i?A:A.export(i,s),width:A.pixelWidth,height:A.pixelHeight,renderBounds:e,trimBounds:o}}}catch(t){n={data:"",error:t}}return Bh.running=!1,n},export(t,i,s){return Bh.running=!0,function(t){jm||(jm=new Rn);return new Promise(e=>{jm.add(()=>ee(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(n=>new Promise(o=>{const r=()=>ee(this,void 0,void 0,function*(){if(!Cn.isComplete)return e.requestRender(r);const a=Bh.syncExport(t,i,s);a.data instanceof Promise&&(a.data=yield a.data),n(a),o()});t.updateLayout(),Km(t);const{leafer:a}=t;a?a.waitViewCompleted(r):r()}))}};let jm;function Km(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Km(t))}const Zm=ue.prototype,qm=Wt.get("@leafer-in/export");return Zm.export=function(t,e){const{quality:i,blob:s}=Bn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Zm.toBlob=function(t,i){return new Promise(s=>{e.origin.canvasToBolb(this.view,t,i).then(t=>{s(t)}).catch(t=>{qm.error(t),s(null)})})},Zm.toDataURL=function(t,i){return e.origin.canvasToDataURL(this.view,t,i)},Zm.saveAs=function(t,i){return new Promise(s=>{e.origin.canvasSaveAs(this.view,t,i).then(()=>{s(!0)}).catch(t=>{qm.error(t),s(!1)})})},Vt.add("export"),Object.assign(Bh,Gm),t.UI.prototype.export=function(t,e){return Bh.export(this,t,e)},t.UI.prototype.syncExport=function(t,e){return Bh.syncExport(this,t,e)},Vt.add("filter"),Object.assign(kh,{list:{},register(t,e){kh.list[t]=e},apply(t,e,i,s,n,o){let r;t.forEach(t=>{r=kh.list[t.type],r&&r.apply(t,e,i,s,n,o)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=kh.list[t.type],e&&(i+=e.getSpread(t))}),i}}),t.AlignHelper=ut,t.AnimateEasing=_y,t.AnimateEvent=fy,t.AroundHelper=lt,t.ArrowData=vg,t.AutoBounds=Mt,t.BezierHelper=He,t.Bounds=At,t.BoundsEvent=fr,t.BoundsHelper=Rt,t.BoxData=Fh,t.BranchHelper=Jo,t.BranchRender=da,t.CanvasData=qh,t.CanvasManager=Qt,t.ChildEvent=pr,t.ColorConvert=yh,t.Creator=Gt,t.Cursor=cd,t.DataHelper=y,t.Debug=Wt,t.Dragger=td,t.EditBox=Xp,t.EditDataHelper=Ip,t.EditPoint=Hp,t.EditSelect=Bp,t.EditSelectHelper=xp,t.EditToolCreator=s_,t.EditorEvent=dp,t.EditorGroupEvent=r_,t.EditorHelper=Qp,t.EditorMoveEvent=c_,t.EditorRotateEvent=p_,t.EditorScaleEvent=u_,t.EditorSkewEvent=__,t.Effect=Eh,t.EllipseData=Nh,t.EllipseHelper=qe,t.Event=ur,t.EventCreator=Jt,t.Eventer=Ar,t.Export=Bh,t.FileHelper=Bn,t.Filter=kh,t.Finder=Um,t.FrameData=zh,t.GroupData=Ih,t.HTMLTextData=mg,t.HighBezierHelper=Ky,t.HighCurveHelper=im,t.HitCanvasManager=ud,t.ImageData=Zh,t.ImageEvent=gr,t.ImageManager=An,t.IncrementId=i,t.InnerEditor=f_,t.InnerEditorEvent=o_,t.InteractionBase=dd,t.InteractionHelper=Kl,t.Keyboard=Nl,t.LayoutEvent=kr,t.Layouter=ah,t.LeafBounds=aa,t.LeafBoundsHelper=jo,t.LeafData=v,t.LeafDataProxy=Gr,t.LeafEventer=Xr,t.LeafHelper=zo,t.LeafLayout=cr,t.LeafLevelList=Va,t.LeafList=Xa,t.LeafMatrix=Qr,t.LeafRender=ha,t.LeaferCanvas=Ga,t.LeaferCanvasBase=ue,t.LeaferData=Wh,t.LeaferEvent=Sr,t.LeaferImage=zn,t.LeaferTypeCreator=sg,t.LineData=Uh,t.MathHelper=E,t.Matrix=it,t.MatrixHelper=W,t.MultiTouchHelper=rg,t.MyDragEvent=jl,t.MyImage=Il,t.MyPointerEvent=Vl,t.NeedConvertToCanvasCommandMap=ye,t.OneRadian=B,t.PI2=S,t.PI_2=T,t.Paint=wh,t.PaintGradient=bh,t.PaintImage=xh,t.PathArrow=vh,t.PathArrowModule=yf,t.PathBounds=_n,t.PathCommandDataHelper=ss,t.PathCommandMap=ge,t.PathConvert=Di,t.PathCorner=xn,t.PathCreator=ws,t.PathData=Vh,t.PathDrawer=Ms,t.PathHelper=pe,t.PathMatrixHelper=Lg,t.PathNumberCommandLengthMap=xe,t.PathNumberCommandMap=we,t.PathScaler=M_,t.PenData=Gh,t.Picker=ch,t.Platform=e,t.Plugin=Vt,t.Point=tt,t.PointHelper=Z,t.PointerButton=Yl,t.PolygonData=Yh,t.PropertyEvent=_r,t.RectData=Hh,t.RectHelper=be,t.RectRender=el,t.RenderEvent=Br,t.Renderer=lh,t.ResizeEvent=br,t.Resource=Cn,t.RobotData=Am,t.Run=Nt,t.ScrollBar=yg,t.SelectArea=wp,t.Selector=uh,t.StarData=Xh,t.State=Sh,t.StringNumberMap=It,t.Stroker=vp,t.TaskItem=Pn,t.TaskProcessor=Rn,t.TextConvert=fh,t.TextData=Kh,t.TransformTool=g_,t.Transformer=hg,t.Transition=Th,t.TwoPointBoundsHelper=nt,t.UIBounds=Jh,t.UICreator=Kt,t.UIData=Dh,t.UIEvent=Xl,t.UIRender=Qh,t.UnitConvert=mh,t.WaitHelper=er,t.WatchEvent=Er,t.Watcher=qa,t.WheelEventHelper=ag,t.addViewport=tg,t.addViewportConfig=eg,t.affectRenderBoundsType=oo,t.affectStrokeBoundsType=io,t.arrowType=wg,t.attr=Xn,t.autoLayoutType=Kn,t.boundsType=Jn,t.canvasPatch=kn,t.canvasSizeAttrs=ce,t.createAttr=function(t){return(e,i)=>{Un(e,i,Nn(i,t))}},t.createDescriptor=Nn,t.cursorType=fo,t.dataProcessor=yo,t.dataType=Gn,t.decorateLeafAttr=Yn,t.defineDataProcessor=mo,t.defineKey=Un,t.defineLeafAttr=Vn,t.doBoundsType=Qn,t.doStrokeType=so,t.effectType=ph,t.emptyData=o,t.eraserType=_o,t.getBoundsData=R,t.getDescriptor=Hn,t.getMatrixData=L,t.getPointData=P,t.hitType=go,t.isArray=p,t.isData=g,t.isEmptyData=f,t.isFinite=l,t.isNull=a,t.isNumber=d,t.isObject=_,t.isString=h,t.isUndefined=r,t.layoutProcessor=function(t){return(e,i)=>{Un(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Cr,t.maskType=po,t.motionPathType=sm,t.naturalBoundsType=$n,t.opacityType=ao,t.pathInputType=to,t.pathType=eo,t.pen=bn,t.positionType=jn,t.registerEditTool=e_,t.registerInnerEditor=i_,t.registerUI=So,t.registerUIEvent=To,t.resizeType=_h,t.rewrite=bo,t.rewriteAble=Eo,t.rotationType=qn,t.scaleResize=X_,t.scaleResizeFontSize=V_,t.scaleResizeGroup=K_,t.scaleResizePath=G_,t.scaleResizePoints=j_,t.scaleType=Zn,t.sortType=uo,t.stateStyleType=um,t.stateType=cm,t.strokeType=no,t.surfaceType=ro,t.tempBounds=Dt,t.tempMatrix=st,t.tempPoint=et,t.tryToNumber=u,t.useCanvas=Ka,t.useModule=Bo,t.version="1.9.0",t.visibleType=ho,t.zoomLayerType=gh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
2
2
|
//# sourceMappingURL=worker.min.js.map
|