@leafer/miniapp 1.6.2 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- const t={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(e){const{prefix:i,suffix:s}=t.image;return!s||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+s),i&&"/"===e[0]&&(e=i+e),e}}},e={},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 _(){return{x:0,y:0,width:0,height:0}}function p(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin: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:p,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){k.toInnerPoint(t,e,w),k.scaleOfInner(t,w,i,s)},scaleOfInner(t,e,i,s=i){k.translateInner(t,e.x,e.y),k.scale(t,i,s),k.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){k.toInnerPoint(t,e,w),k.rotateOfInner(t,w,i)},rotateOfInner(t,e,i){k.translateInner(t,e.x,e.y),k.rotate(t,i),k.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){k.toInnerPoint(t,e,w),k.skewOfInner(t,w,i,s)},skewOfInner(t,e,i,s=0){k.translateInner(t,e.x,e.y),k.skew(t,i,s),k.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){k.multiply(t,k.tempInvert(e))},divideParent(t,e){k.multiplyParent(t,k.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=k;return k.copy(e,t),k.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)&&k.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,k=d;if(n||r){const t=o*a-n*r;if(r&&!s){u=m(o*o+n*n),_=t/u;const e=o/u;p=n>0?y(e):-y(e)}else{_=m(r*r+a*a),u=t/_;const e=r/_;p=c-(a>0?y(-e):-y(e))}const e=v(f(p)),i=g(p);u=v(u),_=v(_),w=e?v((r/_+i)/e/l,9):0,x=e?v((n/u-i)/e/l,9):0,p=v(p/l)}else u=o,_=a,p=w=x=0;return(e=i||e)&&(b+=e.x*o+e.y*r,k+=e.x*n+e.y*a,i||(b-=e.x,k-=e.y)),{x:b,y:k,scaleX:u,scaleY:_,rotation:p,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){k.set(t)}},k=b,{toInnerPoint:E,toOuterPoint:B}=b,{sin:S,cos:R,abs:C,sqrt:T,atan2:O,min:L,round:P,PI:A}=Math,M={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?P(t.x-.5)+.5:P(t.x),t.y=e?P(t.y-.5)+.5:P(t.y)},move(t,e,i){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=R(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 I(i,t),E(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=D;return I(i,t),B(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=D;return I(i,t),D.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),E(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){E(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)=>F(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const o=C(i-t),n=C(s-e);return T(o*o+n*n)},getMinDistanceFrom:(t,e,i,s,o,n)=>L(F(t,e,i,s),F(i,s,o,n)),getAngle:(t,e)=>W(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);let h=O(e-s,t-i);const l=O(n-a,o-r)-h;return l<-A?l+d:l},getAtan2:(t,e)=>O(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const o=W(t,e);return(e=s?e:{}).x=t.x+R(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=M,{getDistanceFrom:F,copy:I,getAtan2:W}=D;class z{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?M.copy(this,t):M.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new z(this)}move(t,e){return M.move(this,t,e),this}scale(t,e){return M.scale(this,t,e),this}scaleOf(t,e,i){return M.scaleOf(this,t,e,i),this}rotate(t,e){return M.rotate(this,t,e),this}rotateOf(t,e){return M.rotate(this,e,t),this}getRotation(t,e,i){return M.getRotation(this,t,e,i)}toInnerOf(t,e){return M.toInnerOf(this,t,e),this}toOuterOf(t,e){return M.toOuterOf(this,t,e),this}getCenter(t){return new z(M.getCenter(this,t))}getDistance(t){return M.getDistance(this,t)}getDistancePoint(t,e,i){return new z(M.getDistancePoint(this,t,e,i))}getAngle(t){return M.getAngle(this,t)}getAtan2(t){return M.getAtan2(this,t)}reset(){return M.reset(this),this}}const Y=new z;class N{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 N(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 X=new N,H={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){V(t,e,i),V(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:V}=H,{tempPointBounds:j,setPoint:G,addPoint:U,toBounds:q}=H,{toOuterPoint:Z}=b,{float:K,fourNumber:J}=a,{floor:Q,ceil:$}=Math;let tt,et,it,st;const ot={},nt={},rt={tempBounds:{},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=J(i);s?at.set(t,n+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):at.set(t,n-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),at.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),at.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?lt(e,t):e=t,i?(e.offsetX=-(at.maxX(i)-t.x),e.offsetY=-(at.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),at.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e){M.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){M.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(at.copy(at.tempBounds,t),at.toOuterOf(at.tempBounds,e),at.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),at.toOuterOf(t,e),t),toOuterOf(t,e,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 ot.x=t.x,ot.y=t.y,Z(e,ot,nt),G(j,nt.x,nt.y),ot.x=t.x+t.width,Z(e,ot,nt),U(j,nt.x,nt.y),ot.y=t.y+t.height,Z(e,ot,nt),U(j,nt.x,nt.y),ot.x=t.x,Z(e,ot,nt),U(j,nt.x,nt.y),q(j,i)},toInnerOf(t,e,i){i||(i=t),at.move(i,-e.e,-e.f),at.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Math.min(t.width/e.width,t.height/e.height));return new N(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e,i){const s={};return at.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){at.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){at.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Q(t.x),t.y=Q(t.y),t.width=e>t.x?$(t.width+e-t.x):$(t.width),t.height=i>t.y?$(t.height+i-t.y):$(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=K(t.x,e),t.y=K(t.y,e),t.width=K(t.width,e),t.height=K(t.height,e)},add(t,e,i){tt=t.x+t.width,et=t.y+t.height,it=e.x,st=e.y,i||(it+=e.width,st+=e.height),tt=tt>it?tt:it,et=et>st?et:st,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=tt-t.x,t.height=et-t.y},addList(t,e){at.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){at.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){at.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||lt(t,o)):ht(t,o));n&&at.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?G(j,t.x,t.y):U(j,t.x,t.y))),q(j,t)},setPoint(t,e){at.set(t,e.x,e.y)},addPoint(t,e){ht(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=M.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=M.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=at.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=at.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=at.tempToOuterOf(e,i)),!at.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:o,width:n,height:r}=e;return tt=s+n,et=o+r,it=t.x+t.width,st=t.y+t.height,s=s>t.x?s:t.x,o=o>t.y?o:t.y,tt=tt<it?tt:it,et=et<st?et:st,n=tt-s,r=et-o,{x:s,y:o,width:n,height:r}},intersect(t,e,i){at.copy(t,at.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){at.set(t)}},at=rt,{add:ht,copy:lt}=at;class dt{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"object"==typeof 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 dt(this)}move(t,e){return rt.move(this,t,e),this}scale(t,e){return rt.scale(this,t,e),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)}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 dt(rt.getIntersectData(this,t,e))}isSame(t){return rt.isSame(this,t)}isEmpty(){return rt.isEmpty(this)}reset(){rt.reset(this)}}const ct=new dt;class ut{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 dt(o,e,n||t.width-o-i,r||t.height-e-s)}}var _t,pt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(_t||(_t={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(pt||(pt={}));const gt=[{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}];gt.forEach((t=>t.type="percent"));const ft={directionData:gt,tempPoint:{},get:yt,toPoint(t,e,i,s,o){const n=yt(t);i.x=n.x,i.y=n.y,"percent"===n.type&&(i.x*=e.width,i.y*=e.height,o&&(i.x-=o.x,i.y-=o.y,n.x&&(i.x-=1===n.x?o.width:.5===n.x?n.x*o.width:0),n.y&&(i.y-=1===n.y?o.height:.5===n.y?n.y*o.height:0))),s||(i.x+=e.x,i.y+=e.y)}};function yt(t){return"string"==typeof t?gt[pt[t]]:t}const{toPoint:mt}=ft,vt={toPoint(t,e,i,s,o){mt(t,i,s,o,e)}},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=kt(t)}static set exclude(t){this.excludeList=kt(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(Et.enable){if(Et.filterList.length&&Et.filterList.every((t=>t!==this.name)))return;if(Et.excludeList.length&&Et.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Et.enable&&this.warn(...t)}warn(...t){Et.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 kt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}bt.filterList=[],bt.excludeList=[],bt.showWarn=!0;const Et=bt,Bt=bt.get("RunTime"),St={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=i.create(i.RUNTIME);return Rt.currentId=Rt.idMap[s]=e?performance.now():Date.now(),Rt.currentName=Rt.nameMap[s]=t,Rt.nameToIdMap[t]=s,s},end(t,e){const i=Rt.idMap[t],s=Rt.nameMap[t],o=e?(performance.now()-i)/1e3:Date.now()-i;Rt.idMap[t]=Rt.nameMap[t]=Rt.nameToIdMap[s]=void 0,Bt.log(s,o,"ms")},endOfName(t,e){const i=Rt.nameToIdMap[t];void 0!==i&&Rt.end(i,e)}},Rt=St,Ct=[],Tt={list:{},add(t,...e){this.list[t]=!0,Ct.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>Ct.forEach((t=>Tt.has(t,!0)))));const Ot=bt.get("UICreator"),Lt={list:{},register(t){const{__tag:e}=t.prototype;Pt[e]&&Ot.repeat(e),Pt[e]=t},get(t,e,i,s,o,n){Pt[t]||Ot.error("not register "+t);const r=new Pt[t](e);return void 0!==i&&(r.x=i,s&&(r.y=s),o&&(r.width=o),n&&(r.height=n)),r}},{list:Pt}=Lt,At=bt.get("EventCreator"),Mt={nameList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(Dt[e]&&At.repeat(e),Dt[e]=t)}))},changeName(t,e){const i=Dt[t];if(i){const s=Object.keys(i).find((e=>i[e]===t));s&&(i[s]=e,Dt[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Dt[t](...e)},{nameList:Dt}=Mt;class Ft{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let i;const{list:s}=this;for(let e=0,o=s.length;e<o;e++)if(i=s[e],i.recycled&&i.isSameSize(t))return i.recycled=!1,i.manager||(i.manager=this),i;const o=e.canvas(t);return this.add(o),o}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 It={default:(t,e)=>(Wt(e,t),Wt(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 Wt(t[o],e[o],i&&i[o]);i&&o in i?(null===(r=i[o])||void 0===r?void 0:r.constructor)===Object&&Wt(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}},{assign:Wt}=It;class zt{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 Yt;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(Yt||(Yt={}));const Nt={};function Xt(t){return null==t}function Ht(t){return"{}"===JSON.stringify(t)}function Vt(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 jt(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),Object.defineProperty(e,i,{get(){return this.context[t]},set(e){this.context[t]=e}})}}"function"==typeof SuppressedError&&SuppressedError;const Ut=[];function qt(){return(t,e)=>{Ut.push(e)}}const Zt=[];let Kt=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||Zt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Ut.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,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}};Vt([Gt("imageSmoothingEnabled")],Kt.prototype,"smooth",void 0),Vt([Gt("imageSmoothingQuality")],Kt.prototype,"smoothLevel",void 0),Vt([Gt("globalAlpha")],Kt.prototype,"opacity",void 0),Vt([Gt()],Kt.prototype,"fillStyle",void 0),Vt([Gt()],Kt.prototype,"strokeStyle",void 0),Vt([Gt("lineWidth")],Kt.prototype,"strokeWidth",void 0),Vt([Gt("lineCap")],Kt.prototype,"strokeCap",void 0),Vt([Gt("lineJoin")],Kt.prototype,"strokeJoin",void 0),Vt([Gt("lineDashOffset")],Kt.prototype,"dashOffset",void 0),Vt([Gt()],Kt.prototype,"miterLimit",void 0),Vt([Gt()],Kt.prototype,"shadowBlur",void 0),Vt([Gt()],Kt.prototype,"shadowColor",void 0),Vt([Gt()],Kt.prototype,"shadowOffsetX",void 0),Vt([Gt()],Kt.prototype,"shadowOffsetY",void 0),Vt([Gt()],Kt.prototype,"filter",void 0),Vt([Gt()],Kt.prototype,"font",void 0),Vt([Gt()],Kt.prototype,"fontKerning",void 0),Vt([Gt()],Kt.prototype,"fontStretch",void 0),Vt([Gt()],Kt.prototype,"fontVariantCaps",void 0),Vt([Gt()],Kt.prototype,"textAlign",void 0),Vt([Gt()],Kt.prototype,"textBaseline",void 0),Vt([Gt()],Kt.prototype,"textRendering",void 0),Vt([Gt()],Kt.prototype,"wordSpacing",void 0),Vt([Gt()],Kt.prototype,"letterSpacing",void 0),Vt([Gt()],Kt.prototype,"direction",void 0),Vt([qt()],Kt.prototype,"setTransform",null),Vt([qt()],Kt.prototype,"resetTransform",null),Vt([qt()],Kt.prototype,"getTransform",null),Vt([qt()],Kt.prototype,"save",null),Vt([qt()],Kt.prototype,"restore",null),Vt([qt()],Kt.prototype,"translate",null),Vt([qt()],Kt.prototype,"scale",null),Vt([qt()],Kt.prototype,"rotate",null),Vt([qt()],Kt.prototype,"fill",null),Vt([qt()],Kt.prototype,"stroke",null),Vt([qt()],Kt.prototype,"clip",null),Vt([qt()],Kt.prototype,"fillRect",null),Vt([qt()],Kt.prototype,"strokeRect",null),Vt([qt()],Kt.prototype,"clearRect",null),Vt([qt()],Kt.prototype,"beginPath",null),Vt([qt()],Kt.prototype,"moveTo",null),Vt([qt()],Kt.prototype,"lineTo",null),Vt([qt()],Kt.prototype,"bezierCurveTo",null),Vt([qt()],Kt.prototype,"quadraticCurveTo",null),Vt([qt()],Kt.prototype,"closePath",null),Vt([qt()],Kt.prototype,"arc",null),Vt([qt()],Kt.prototype,"arcTo",null),Vt([qt()],Kt.prototype,"ellipse",null),Vt([qt()],Kt.prototype,"rect",null),Vt([qt()],Kt.prototype,"roundRect",null),Vt([qt()],Kt.prototype,"createConicGradient",null),Vt([qt()],Kt.prototype,"createLinearGradient",null),Vt([qt()],Kt.prototype,"createPattern",null),Vt([qt()],Kt.prototype,"createRadialGradient",null),Vt([qt()],Kt.prototype,"fillText",null),Vt([qt()],Kt.prototype,"measureText",null),Vt([qt()],Kt.prototype,"strokeText",null);const{copy:Jt,multiplyParent:Qt}=b,{round:$t}=Math,te={width:1,height:1,pixelRatio:1},ee=["width","height","pixelRatio"];class ie extends Kt{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(e,s){super(),this.size={},this.worldTransform={},e||(e=te),this.manager=s,this.innerId=i.create(i.CNAVAS);const{width:o,height:n,pixelRatio:r}=e;this.autoLayout=!o||!n,this.size.pixelRatio=r|t.devicePixelRatio,this.config=e,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;It.copyAttrs(s,t,ee),ee.forEach((t=>s[t]||(s[t]=1))),this.bounds=new dt(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&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=$t(o.e-.5)+.5,o.f=$t(o.f-.5)+.5):(o.e=$t(o.e),o.f=$t(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){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i)}setStrokeOptions(t){this.strokeCap="none"===t.strokeCap?"butt":t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,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,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,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(ct.x,ct.y,ct.width,ct.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,ct.x,ct.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(ct.x,ct.y,ct.width,ct.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(ct.x,ct.y,ct.width,ct.height),i&&(this.blendMode="source-over")}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(ct.x,ct.y,ct.width,ct.height)}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(ct.x,ct.y,ct.width,ct.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,i){ct.set(t),i&&ct.intersect(this.bounds),ct.scale(this.pixelRatio),e&&ct.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,i){const{size:s,pixelSnap:o}=this,n=this.manager?this.manager.get(s):e.canvas(Object.assign({},s));return n.save(),t&&(Jt(n.worldTransform,this.worldTransform),n.useWorldTransform()),i&&(n.smooth=this.smooth),n.pixelSnap!==o&&(n.pixelSnap=o),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 se={creator:{},parse(t,e){},convertToCanvasData(t,e){}},oe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},ne=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},oe),re={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},ae={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},he=Object.assign(Object.assign({},ae),oe),le=ne,de={};for(let t in le)de[le[t]]=t;const ce={};for(let t in le)ce[le[t]]=re[t];const ue={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:pe,atan2:ge,ceil:fe,abs:ye,PI:me,sqrt:ve,pow:we}=Math,{setPoint:xe,addPoint:be}=H,{set:ke,toNumberPoints:Ee}=M,{M:Be,L:Se,C:Re,Q:Ce,Z:Te}=ne,Oe={},Le={points(t,e,i,s){let o=Ee(e);if(t.push(Be,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],p=ve(we(r-e,2)+we(a-n,2)),g=ve(we(h-r,2)+we(l-a,2)),f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=n,d=r-p*h,c=a-p*l,2===i?s||t.push(Ce,d,c,r,a):t.push(Re,u,_,d,c,r,a),u=r+g*h,_=a+g*l;s||t.push(Ce,u,_,o[y-2],o[y-1])}else for(let e=2,i=o.length;e<i;e+=2)t.push(Se,o[e],o[e+1]);s&&t.push(Te)},rect(t,e,i,s,o){se.creator.path=t,se.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){se.creator.path=[],ue.drawRoundRect(se.creator,e,i,s,o,n),t.push(...se.convertToCanvasData(se.creator.path,!0))},arcTo(t,e,i,s,o,n,r,a,h,u,_){const p=s-e,g=o-i,f=n-s,y=r-o;let m=ge(g,p),v=ge(y,f),w=v-m;if(w<0&&(w+=d),w===me||ye(p+g)<1e-12||ye(f+y)<1e-12)return t&&t.push(Se,s,o),h&&(xe(h,e,i),be(h,s,o)),_&&ke(_,e,i),void(u&&ke(u,s,o));const x=p*y-f*g<0,b=x?-1:1,k=a/pe(w/2),E=s+k*pe(m+w/2+c*b),B=o+k*_e(m+w/2+c*b);return m-=c*b,v-=c*b,Me(t,E,B,a,a,0,m/l,v/l,x,h,u,_)},arc:(t,e,i,s,o,n,r,a,h,l)=>Me(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=pe(g);let m=r*l,v=a*l;m>me&&(m-=d),v<0&&(v+=d);let w=v-m;w<0?w+=d:w>d&&(w-=d),h&&(w-=d);const x=fe(ye(w/c)),b=w/x,k=_e(b/4),E=8/3*k*k/_e(b/2);v=m+b;let B,S,R,C,T,O,L,P,A=pe(m),M=_e(m),D=R=y*s*A-f*o*M,F=C=f*s*A+y*o*M,I=e+R,W=i+C;t&&t.push(t.length?Se:Be,I,W),u&&xe(u,I,W),p&&ke(p,I,W);for(let n=0;n<x;n++)B=pe(v),S=_e(v),R=y*s*B-f*o*S,C=f*s*B+y*o*S,T=e+D-E*(y*s*M+f*o*A),O=i+F-E*(f*s*M-y*o*A),L=e+R+E*(y*s*S+f*o*B),P=i+C+E*(f*s*S-y*o*B),t&&t.push(Re,T,O,L,P,e+R,i+C),u&&Ae(e+D,i+F,T,O,L,P,e+R,i+C,u,!0),D=R,F=C,A=B,M=S,m=v,v+=b;_&&ke(_,e+R,i+C)},quadraticCurveTo(t,e,i,s,o,n,r){t.push(Re,(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){Ae(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,_=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?be(h,t,e):xe(h,t,e),be(h,r,a);for(let l=0,c=d.length;l<c;l++)Pe(d[l],t,e,i,s,o,n,r,a,Oe),be(h,Oe.x,Oe.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,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*a,l.y=c*i+u*o+_*r+p*h},getPoint(t,e,i,s,o,n,r,a,h){const l={};return Pe(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:Pe,toTwoPointBounds:Ae,ellipse:Me}=Le,{sin:De,cos:Fe,sqrt:Ie,atan2:We}=Math,{ellipse:ze}=Le,Ye={ellipticalArc(e,i,s,o,n,r,a,h,c,u,_){const p=(c-i)/2,g=(u-s)/2,f=r*l,y=De(f),m=Fe(f),v=-m*p-y*g,w=-m*g+y*p,x=o*o,b=n*n,k=w*w,E=v*v,B=x*b-x*k-b*E;let S=0;if(B<0){const t=Ie(1-B/(x*b));o*=t,n*=t}else S=(a===h?-1:1)*Ie(B/(x*k+b*E));const R=S*o*w/n,C=-S*n*v/o,T=We((w-C)/n,(v-R)/o),O=We((-w-C)/n,(-v-R)/o);let L=O-T;0===h&&L>0?L-=d:1===h&&L<0&&(L+=d);const P=i+p+m*R-y*C,A=s+g+y*R+m*C,M=L<0?1:0;_||t.ellipseToCurve?ze(e,P,A,o,n,r,T/l,O/l,M):o!==n||r?e.push(ne.G,P,A,o,n,r,T/l,O/l,M):e.push(ne.O,P,A,o,T/l,O/l,M)}},{M:Ne,m:Xe,L:He,l:Ve,H:je,h:Ge,V:Ue,v:qe,C:Ze,c:Ke,S:Je,s:Qe,Q:$e,q:ti,T:ei,t:ii,A:si,a:oi,Z:ni,z:ri,N:ai,D:hi,X:li,G:di,F:ci,O:ui,P:_i,U:pi}=ne,{rect:gi,roundRect:fi,arcTo:yi,arc:mi,ellipse:vi,quadraticCurveTo:wi}=Le,{ellipticalArc:xi}=Ye,bi=bt.get("PathConvert"),ki={},Ei={current:{dot:0},stringify(t,e){let i,s,o,n=0,r=t.length,h="";for(;n<r;){s=t[n],i=ce[s],h+=s===o?" ":de[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?he:ae;for(let e=0,h=t.length;e<h;e++)s=t[e],wt[s]?("."===s&&(Bi.dot&&(Si(r,n),n=""),Bi.dot++),"0"===n&&"."!==s&&(Si(r,n),n=""),n+=s):ne[s]?(n&&(Si(r,n),n=""),Bi.name=ne[s],Bi.length=re[s],Bi.index=0,Si(r,Bi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===o||"E"===o?n+=s:(n&&Si(r,n),n=s):n&&(Si(r,n),n=""),o=s;return n&&Si(r,n),i?Ei.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 _=[];for(;c<u;){switch(o=t[c],o){case Xe:t[c+1]+=a,t[c+2]+=h;case Ne:a=t[c+1],h=t[c+2],_.push(Ne,a,h),c+=3;break;case Ge:t[c+1]+=a;case je:a=t[c+1],_.push(He,a,h),c+=2;break;case qe:t[c+1]+=h;case Ue:h=t[c+1],_.push(He,a,h),c+=2;break;case Ve:t[c+1]+=a,t[c+2]+=h;case He:a=t[c+1],h=t[c+2],_.push(He,a,h),c+=3;break;case Qe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=Je;case Je:r=n===Ze||n===Je,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],_.push(Ze,l,d,i,s,a,h),c+=5;break;case Ke: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=Ze;case Ze:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(Ze,t[c+1],t[c+2],i,s,a,h),c+=7;break;case ii:t[c+1]+=a,t[c+2]+=h,o=ei;case ei:r=n===$e||n===ei,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?wi(_,a,h,i,s,t[c+1],t[c+2]):_.push($e,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ti:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=$e;case $e:i=t[c+1],s=t[c+2],e?wi(_,a,h,i,s,t[c+3],t[c+4]):_.push($e,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case oi:t[c+6]+=a,t[c+7]+=h;case si:xi(_,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 ri:case ni:_.push(ni),c++;break;case ai:a=t[c+1],h=t[c+2],e?gi(_,a,h,t[c+3],t[c+4]):Ri(_,t,c,5),c+=5;break;case hi:a=t[c+1],h=t[c+2],e?fi(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ri(_,t,c,9),c+=9;break;case li:a=t[c+1],h=t[c+2],e?fi(_,a,h,t[c+3],t[c+4],t[c+5]):Ri(_,t,c,6),c+=6;break;case di:vi(e?_:Ri(_,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 ci:e?vi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ri(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case ui:mi(e?_:Ri(_,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?mi(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ri(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case pi:yi(e?_:Ri(_,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 bi.error(`command: ${o} [index:${c}]`,t),_}n=o}return _},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(He,t.x,t.y);break;case"C":e.push(Ze,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push($e,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(ni)}})),e},copyData(t,e,i,s){for(let o=i,n=i+s;o<n;o++)t.push(e[o])},pushData(t,e){Bi.index===Bi.length&&(Bi.index=1,t.push(Bi.name)),t.push(Number(e)),Bi.index++,Bi.dot=0}},{current:Bi,pushData:Si,copyData:Ri}=Ei,{M:Ci,L:Ti,C:Oi,Q:Li,Z:Pi,N:Ai,D:Mi,X:Di,G:Fi,F:Ii,O:Wi,P:zi,U:Yi}=ne,{getMinDistanceFrom:Ni,getRadianFrom:Xi}=M,{tan:Hi,min:Vi,abs:ji}=Math,Gi={},Ui={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Ci,e,i)},lineTo(t,e,i){t.push(Ti,e,i)},bezierCurveTo(t,e,i,s,o,n,r){t.push(Oi,e,i,s,o,n,r)},quadraticCurveTo(t,e,i,s,o){t.push(Li,e,i,s,o)},closePath(t){t.push(Pi)},rect(t,e,i,s,o){t.push(Ai,e,i,s,o)},roundRect(t,e,i,s,o,n){if("number"==typeof n)t.push(Di,e,i,s,o,n);else{const r=a.fourNumber(n);r?t.push(Mi,e,i,s,o,...r):t.push(Ai,e,i,s,o)}},ellipse(t,e,i,s,o,n,r,a,h){void 0===n?t.push(Ii,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(zi,e,i,s):(void 0===n&&(n=360),t.push(Wi,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=Vi(n,Vi(t/2,t/2*ji(Hi(Xi(r,a,e,i,s,o)/2))))}t.push(Yi,e,i,s,o,n)},drawEllipse(t,e,i,s,o,n,r,a,h){Le.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(Ci,Gi.x,Gi.y),qi(t,e,i,s,o,n,r,a,h)},drawArc(t,e,i,s,o,n,r){Le.arc(null,e,i,s,void 0===o?0:o,void 0===n?360:n,r,null,null,Gi),t.push(Ci,Gi.x,Gi.y),Zi(t,e,i,s,o,n,r)},drawPoints(t,e,i,s){Le.points(t,e,i,s)}},{ellipse:qi,arc:Zi}=Ui,{moveTo:Ki,lineTo:Ji,quadraticCurveTo:Qi,bezierCurveTo:$i,closePath:ts,beginPath:es,rect:is,roundRect:ss,ellipse:os,arc:ns,arcTo:rs,drawEllipse:as,drawArc:hs,drawPoints:ls}=Ui;class ds{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?se.parse(t):t:[],this}beginPath(){return es(this.__path),this.paint(),this}moveTo(t,e){return Ki(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ji(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,o,n){return $i(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 ts(this.__path),this.paint(),this}rect(t,e,i,s){return is(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,o){return ss(this.__path,t,e,i,s,o),this.paint(),this}ellipse(t,e,i,s,o,n,r,a){return os(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}arc(t,e,i,s,o,n){return ns(this.__path,t,e,i,s,o,n),this.paint(),this}arcTo(t,e,i,s,o){return rs(this.__path,t,e,i,s,o),this.paint(),this}drawEllipse(t,e,i,s,o,n,r,a){return as(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}drawArc(t,e,i,s,o,n){return hs(this.__path,t,e,i,s,o,n),this.paint(),this}drawPoints(t,e,i){return ls(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:cs,L:us,C:_s,Q:ps,Z:gs,N:fs,D:ys,X:ms,G:vs,F:ws,O:xs,P:bs,U:ks}=ne,Es=bt.get("PathDrawer"),Bs={drawPathByData(t,e){if(!e)return;let i,s=0,o=e.length;for(;s<o;)switch(i=e[s],i){case cs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case us: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 ps:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case gs:t.closePath(),s+=1;break;case fs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case ys: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 ms:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case vs: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 ws:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,d,!1),s+=5;break;case xs: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 bs: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 Es.error(`command: ${i} [index:${s}]`,e)}}},{M:Ss,L:Rs,C:Cs,Q:Ts,Z:Os,N:Ls,D:Ps,X:As,G:Ms,F:Ds,O:Fs,P:Is,U:Ws}=ne,{toTwoPointBounds:zs,toTwoPointBoundsByQuadraticCurve:Ys,arcTo:Ns,arc:Xs,ellipse:Hs}=Le,{addPointBounds:Vs,copy:js,addPoint:Gs,setPoint:Us,addBounds:qs,toBounds:Zs}=H,Ks=bt.get("PathBounds");let Js,Qs,$s;const to={},eo={},io={},so={toBounds(t,e){so.toTwoPointBounds(t,eo),Zs(eo,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Us(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===Os||r===Cs||r===Ts?Us(e,h,l):Us(e,t[a+1],t[a+2])),r){case Ss:case Rs:h=t[a+1],l=t[a+2],Gs(e,h,l),a+=3;break;case Cs:o=t[a+5],n=t[a+6],zs(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,to),Vs(e,to),h=o,l=n,a+=7;break;case Ts:i=t[a+1],s=t[a+2],o=t[a+3],n=t[a+4],Ys(h,l,i,s,o,n,to),Vs(e,to),h=o,l=n,a+=5;break;case Os:a+=1;break;case Ls:h=t[a+1],l=t[a+2],qs(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ps:case As:h=t[a+1],l=t[a+2],qs(e,h,l,t[a+3],t[a+4]),a+=r===Ps?9:6;break;case Ms:Hs(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],to,io),0===a?js(e,to):Vs(e,to),h=io.x,l=io.y,a+=9;break;case Ds:h=t[a+1],l=t[a+2],Qs=t[a+3],$s=t[a+4],qs(e,h-Qs,l-$s,2*Qs,2*$s),h+=Qs,a+=5;break;case Fs:Xs(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],to,io),0===a?js(e,to):Vs(e,to),h=io.x,l=io.y,a+=7;break;case Is:h=t[a+1],l=t[a+2],Js=t[a+3],qs(e,h-Js,l-Js,2*Js,2*Js),h+=Js,a+=4;break;case Ws:Ns(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],to,io),0===a?js(e,to):Vs(e,to),h=io.x,l=io.y,a+=6;break;default:return void Ks.error(`command: ${r} [index:${a}]`,t)}}},{M:oo,L:no,Z:ro}=ne,{getCenterX:ao,getCenterY:ho}=M,{arcTo:lo}=Ui,co={smooth(t,e,i){let s,o,n=0,r=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0;const p=t.length,g=[];for(;n<p;)switch(s=t[n],s){case oo:h=u=t[n+1],l=_=t[n+2],n+=3,t[n]===no?(d=t[n+1],c=t[n+2],g.push(oo,ao(h,d),ho(l,c))):g.push(oo,h,l);break;case no:switch(r=t[n+1],a=t[n+2],n+=3,t[n]){case no:lo(g,r,a,t[n+1],t[n+2],e,u,_);break;case ro:lo(g,r,a,h,l,e,u,_);break;default:g.push(no,r,a)}u=r,_=a;break;case ro:lo(g,h,l,d,c,e,u,_),g.push(ro),n+=1;break;default:o=ce[s];for(let e=0;e<o;e++)g.push(t[n+e]);n+=o}return s!==ro&&(g[1]=h,g[2]=l),g}};se.creator=new ds,se.parse=Ei.parse,se.convertToCanvasData=Ei.toCanvasData;const uo=new ds,{drawRoundRect:_o}=ue;function po(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,o){_o(this,t,e,i,s,o)})}(t)}const go={opacityTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=fo.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{}}}},fo=go;fo.opacityTypes.forEach((t=>fo.upperCaseTypeMap[t]=t.toUpperCase()));const yo=bt.get("TaskProcessor");class mo{constructor(t){this.parallel=!0,this.time=1,this.id=i.create(i.TASK),this.task=t}run(){return jt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){yo.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class vo{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&&It.assign(this.config,t),this.empty()}add(t,e){let i,s,o,n;const r=new mo(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 wo=bt.get("Resource"),xo={tasker:new vo,map:{},get isComplete(){return bo.tasker.isComplete},set(t,e){bo.map[t]&&wo.repeat(t),bo.map[t]=e},get:t=>bo.map[t],remove(t){const e=bo.map[t];e&&(e.destroy&&e.destroy(),delete bo.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,i,s){let o;return"string"==typeof i?o={url:i}:i.url||(o={url:t,view:i}),o&&(s&&(o.format=s),i=e.image(o)),bo.set(t,i),i},destroy(){bo.map={}}},bo=xo,ko={maxRecycled:10,recycledList:[],patternTasker:new vo,get(t){let i=xo.get(t.url);return i||xo.set(t.url,i=e.image(t)),i.use++,i},recycle(t){t.use--,setTimeout((()=>{t.use||Eo.recycledList.push(t)}))},clearRecycled(){const t=Eo.recycledList;t.length>Eo.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&xo.remove(t.url))),t.length=0)},hasOpacityPixel:t=>go.opacityTypes.some((e=>Eo.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+go.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+go.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Eo.recycledList=[]}},Eo=ko,{IMAGE:Bo,create:So}=i;class Ro{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=So(Bo),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.hasOpacityPixel(t)&&(this.hasOpacityPixel=!0)}load(e,i){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:i}=t.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(e=i),xo.tasker.add((()=>jt(this,void 0,void 0,(function*(){return yield e(this.url,s).then((t=>this.setView(t))).catch((t=>{this.error=t,this.onComplete(!1)}))}))))}return this.waitComplete.push(e,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(e,i,s,o){if(e||(e=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=t.origin.createCanvas(e,i),r=n.getContext("2d");return s&&(r.globalAlpha=s),r.drawImage(this.view,0,0,e,i),this.cache=this.use>1?{data:n,params:arguments}:null,n}getPattern(e,i,s,o){const n=t.canvas.createPattern(e,i);try{s&&n.setTransform&&(n.setTransform(s),s=null)}catch(t){}return o&&(o.transform=s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Co(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function To(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Oo(t,e){return(i,s)=>Po(i,s,t,e&&e(s))}function Lo(t){return t}function Po(t,e,i,s){const o={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Co(t,e,Object.assign(o,s||{})),rn(t,e,i)}function Ao(t){return Oo(t)}function Mo(t,e){return Oo(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function Do(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Yo(this))}})))}function Fo(t,e){return Oo(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Io(t,e){return Oo(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Wo(t,e){return Oo(t,(t=>({set(i){this.__setAttr(t,i,e)&&Yo(this)}})))}function zo(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e)&&(Yo(this),this.__.__removeNaturalSize())}})))}function Yo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function No(t){return Oo(t,(t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Yo(this)}})))}const Xo=Wo;function Ho(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e)&&Vo(this)}})))}function Vo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Yo(t)}const jo=Ho;function Go(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Uo(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function qo(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Ko(this)}})))}function Zo(t){return Oo(t,(t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Jo(this,t,e,i)))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Jo(this,t,e,i),this.mask&&Ko(this)}})))}function Ko(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Jo(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||Yo(t))}function Qo(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function $o(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function tn(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function en(t){return Oo(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 sn(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function on(t){return(e,i)=>{Co(e,"__DataProcessor",{get:()=>t})}}function nn(t){return(e,i)=>{Co(e,"__LayoutProcessor",{get:()=>t})}}function rn(t,e,i){const s=t.__DataProcessor.prototype,o="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),r={get(){const t=this[o];return void 0===t?i:t},set(t){this[o]=t}};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=Ht(i);r.get=function(){let e=this[o];return void 0===e?this[o]=t?{}:It.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=To(l,e),l=l.__proto__;h&&h.set&&(r.set=h.set),s[n]&&(r.set=s[n],delete s[n]),Co(s,e,r)}const an=new bt("rewrite"),hn=[],ln=["destroy","constructor"];function dn(t){return(e,i)=>{hn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function cn(){return t=>{un()}}function un(t){hn.length&&(hn.forEach((e=>{t&&an.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),hn.length=0)}function _n(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach((s=>{if(!(ln.includes(s)||e&&e.includes(s)))if(t.prototype){To(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]}))}}function pn(){return t=>{Lt.register(t)}}function gn(){return t=>{Mt.register(t)}}setTimeout((()=>un(!0)));const{copy:fn,toInnerPoint:yn,toOuterPoint:mn,scaleOfOuter:vn,rotateOfOuter:wn,skewOfOuter:xn,multiplyParent:bn,divideParent:kn,getLayout:En}=b,Bn={},{round:Sn}=Math,Rn={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),On(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,o=s.length;t<o;t++)Tn(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++)Ln(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Ln(t),t.__updateChange()},updateAllChange(t){if(An(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Pn(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,i=0,s,o){const n="object"==typeof e?Object.assign({},e):{x:e,y:i};s?mn(t.localTransform,n,n,!0):t.parent&&yn(t.parent.worldTransform,n,n,!0),Cn.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=Sn(e),i=Sn(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,o,n){Cn.zoomOfLocal(t,Mn(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),fn(Bn,r),vn(Bn,e,i,s),t.origin||t.around)Cn.setTransform(t,Bn,o,n);else{const e=t.x+Bn.e-r.e,a=t.y+Bn.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){Cn.rotateOfLocal(t,Mn(t,e),i,s)},rotateOfLocal(t,e,i,s){const o=t.__localMatrix;fn(Bn,o),wn(Bn,e,i),t.origin||t.around?Cn.setTransform(t,Bn,!1,s):t.set({x:t.x+Bn.e-o.e,y:t.y+Bn.f-o.f,rotation:a.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,o,n){Cn.skewOfLocal(t,Mn(t,e),i,s,o,n)},skewOfLocal(t,e,i,s=0,o,n){fn(Bn,t.__localMatrix),xn(Bn,e,i,s),Cn.setTransform(t,Bn,o,n)},transformWorld(t,e,i,s){fn(Bn,t.worldTransform),bn(Bn,e),t.parent&&kn(Bn,t.parent.worldTransform),Cn.setTransform(t,Bn,i,s)},transform(t,e,i,s){fn(Bn,t.localTransform),bn(Bn,e),Cn.setTransform(t,Bn,i,s)},setTransform(t,e,i,s){const o=t.__,n=o.origin&&Cn.getInnerOrigin(t,o.origin),r=En(e,n,o.around&&Cn.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){rt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Cn.getInnerOrigin(t,o.origin);M.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 vn(i,Cn.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>M.tempToOuterOf(Cn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return ft.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(fn(Bn,t.worldTransform),kn(Bn,e.worldTransform),i?Bn:Object.assign({},Bn)),drop(t,e,i,s){t.setTransform(Cn.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}}},Cn=Rn,{updateAllMatrix:Tn,updateMatrix:On,updateAllWorldOpacity:Ln,updateAllChange:Pn,updateChange:An}=Cn;function Mn(t,e){return t.__layout.update(),t.parent?M.tempToInnerOf(e,t.parent.__world):e}const Dn={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}=Rn,In={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),Wn(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++)zn(e[t],e)},updateBounds(t,e){const i=[t];zn(t,i),Yn(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:Wn,pushAllBranchStack:zn,updateBoundsByBranchStack:Yn}=In,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:Xn}=Rn,{toOuterOf:Hn,getPoints:Vn,copy:jn}=rt,Gn="_localContentBounds",Un="_worldContentBounds",qn="_worldBoxBounds",Zn="_worldStrokeBounds";class Kn{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 Hn(this.contentBounds,this.leaf.__localMatrix,this[Gn]||(this[Gn]={})),this[Gn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Hn(this.contentBounds,this.leaf.__world,this[Un]||(this[Un]={})),this[Un]}get worldBoxBounds(){return Hn(this.boxBounds,this.leaf.__world,this[qn]||(this[qn]={})),this[qn]}get worldStrokeBounds(){return Hn(this.strokeBounds,this.leaf.__world,this[Zn]||(this[Zn]={})),this[Zn]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leafer:e}=this.leaf;if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=this.leaf;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,t.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return b.defaultMatrix;case"page":t=e.zoomLayer;default:return Xn(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new dt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",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=Xn(s,e,!0)}if(r||(r=b.getLayout(n)),jn(r,a),M.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=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Jn{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class Qn extends Jn{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Qn.ADD="child.add",Qn.REMOVE="child.remove",Qn.CREATED="created",Qn.MOUNTED="mounted",Qn.UNMOUNTED="unmounted",Qn.DESTROY="destroy";class $n extends Jn{constructor(t,e,i,s,o){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=o}}$n.CHANGE="property.change",$n.LEAFER_CHANGE="property.leafer_change";class tr extends Jn{constructor(t,e){super(t),Object.assign(this,e)}}tr.LOAD="image.load",tr.LOADED="image.loaded",tr.ERROR="image.error";class er extends Jn{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(er.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&void 0!==this.resizingKeys[t.innerId]}}er.RESIZE="resize";class ir extends Jn{constructor(t,e){super(t),this.data=e}}ir.REQUEST="watch.request",ir.DATA="watch.data";class sr extends Jn{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}sr.REQUEST="layout.request",sr.START="layout.start",sr.BEFORE="layout.before",sr.LAYOUT="layout",sr.AFTER="layout.after",sr.AGAIN="layout.again",sr.END="layout.end";class or extends Jn{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}or.REQUEST="render.request",or.CHILD_START="render.child_start",or.CHILD_END="render.child_end",or.START="render.start",or.BEFORE="render.before",or.RENDER="render",or.AFTER="render.after",or.AGAIN="render.again",or.END="render.end",or.NEXT="render.next";class nr extends Jn{}nr.START="leafer.start",nr.BEFORE_READY="leafer.before_ready",nr.READY="leafer.ready",nr.AFTER_READY="leafer.after_ready",nr.VIEW_READY="leafer.view_ready",nr.VIEW_COMPLETED="leafer.view_completed",nr.STOP="leafer.stop",nr.RESTART="leafer.restart",nr.END="leafer.end";const rr={};class ar{set event(t){this.on(t)}on(t,e,i){if(!e){let e,i=t;for(let t in i)e=i[t],e instanceof Array?this.on(t,e[0],e[1]):this.on(t,e);return}let s,o,n;i&&("once"===i?o=!0:"boolean"==typeof i?s=i:(s=i.capture,o=i.once));const r=hr(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])}))}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=hr(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]))}))}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 i&&(e=e.bind(i)),this.on(t,e,s),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>t.current.off(t.type,t.listener,t.options))),e.length=0}once(t,e,i){this.on(t,e,{once:!0,capture:i})}emit(t,e,i){!e&&Mt.has(t)&&(e=Mt.get(t,{type:t,target:this,current:this}));const s=hr(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 hr(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:rr)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:rr)}}const{on:lr,on_:dr,off:cr,off_:ur,once:_r,emit:pr,emitEvent:gr,hasEvent:fr,destroy:yr}=ar.prototype,mr={on:lr,on_:dr,off:cr,off_:ur,once:_r,emit:pr,emitEvent:gr,hasEvent:fr,destroyEventer:yr},{isFinite:vr}=Number,wr=bt.get("setAttr"),xr={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(i&&!vr(e)&&void 0!==e&&(wr.warn(this.innerName,t,e),e=void 0),"object"==typeof e||s!==e){this.__realSetAttr(t,e);const{CHANGE:i}=$n,o=new $n(i,this,t,s,e);return this.isLeafer?this.emitEvent(new $n($n.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:br,multiplyParent:kr,translateInner:Er,defaultWorld:Br}=b,{toPoint:Sr,tempPoint:Rr}=ft,Cr={__updateWorldMatrix(){kr(this.__local||this.__layout,this.parent?this.parent.__world:Br,this.__world,!!this.__layout.affectScaleOrRotation,this.__,this.parent&&this.parent.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged||t.rotationChanged)&&(br(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=!1),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Sr(i.around||i.origin,t.boxBounds,Rr),Er(e,-Rr.x,-Rr.y,!i.around))}this.__layout.matrixChanged=!1}},{updateMatrix:Tr,updateAllMatrix:Or}=Rn,{updateBounds:Lr}=In,{toOuterOf:Pr,copyAndSpread:Ar,copy:Mr}=rt,{toBounds:Dr}=so,Fr={__updateWorldBounds(){Pr(this.__layout.renderBounds,this.__world,this.__world),this.__layout.resized&&(this.__onUpdateSize(),this.__layout.resized=!1)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized=!0),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=!1,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=!1,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=!1,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized=!0),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=!1,this.parent&&this.parent.__layout.renderChange()),t.boundsChanged=!1},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Pr(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Pr(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Pr(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Dr(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(),Or(this),Lr(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Or(this),Lr(this,this))):Tr(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Ar(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Ar(t.renderBounds,t.boxBounds,t.renderSpread):Mr(t.renderBounds,t.strokeBounds)}},Ir={__render(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),this.__worldFlipped?t.copyWorldByReset(s,this.__nowWorld,null,i.__blendMode,!0):t.copyWorldToInner(s,this.__nowWorld,this.__layout.renderBounds,i.__blendMode),s.recycle(this.__nowWorld)}else this.__draw(t,e);bt.showBounds&&bt.drawBounds(this,t,e)}},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.windingRule?t.clip(this.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Wr}=Dn,zr={__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){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++)Wr(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++)Wr(i[s],e)||i[s].__clip(t,e)}}},{LEAF:Yr,create:Nr}=i,{toInnerPoint:Xr,toOuterPoint:Hr,multiplyParent:Vr}=b,{toOuterOf:jr}=rt,{copy:Gr,move:Ur}=M,{moveLocal:qr,zoomOfLocal:Zr,rotateOfLocal:Kr,skewOfLocal:Jr,moveWorld:Qr,zoomOfWorld:$r,rotateOfWorld:ta,skewOfWorld:ea,transform:ia,transformWorld:sa,setTransform:oa,getFlipTransform:na,getLocalOrigin:ra,getRelativeWorld:aa,drop:ha}=Rn;let la=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 zt}get __LayoutProcessor(){return Kn}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=Nr(Yr),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Qn.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(Qn.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Qn.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(Qn.MOUNTED)):this.__emitLifeEvent(Qn.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 Vr(i,t.matrix,e,void 0,i),jr(this.__layout.renderBounds,e,e),e.half!==i.half&&(e.half=i.half),e}return this.__world}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,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,o=i?t:{};return jr(t,s,o),o}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Gr(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Gr(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Xr(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){Hr(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 Ur(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 Ur(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){oa(this,t,e,i)}transform(t,e,i){ia(this,t,e,i)}move(t,e,i){qr(this,t,e,i)}moveInner(t,e,i){Qr(this,t,e,!0,i)}scaleOf(t,e,i,s,o){Zr(this,ra(this,t),e,i,s,o)}rotateOf(t,e,i){Kr(this,ra(this,t),e,i)}skewOf(t,e,i,s,o){Jr(this,ra(this,t),e,i,s,o)}transformWorld(t,e,i){sa(this,t,e,i)}moveWorld(t,e,i){Qr(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,o){$r(this,t,e,i,s,o)}rotateOfWorld(t,e){ta(this,t,e)}skewOfWorld(t,e,i,s,o){ea(this,t,e,i,s,o)}flip(t,e){ia(this,na(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,i,s){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Tt.need("path")}getMotionPoint(t){return Tt.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){ha(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):rn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Wo),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Qn(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Qn.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};la=Vt([_n(xr),_n(Cr),_n(Fr),_n(mr),_n(Ir)],la);const{setListWithFn:da}=rt,{sort:ca}=In,{localBoxBounds:ua,localStrokeBounds:_a,localRenderBounds:pa,maskLocalBoxBounds:ga,maskLocalStrokeBounds:fa,maskLocalRenderBounds:ya}=Dn,ma=new bt("Branch");let va=class extends la{__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(){da(this.__layout.boxBounds,this.children,this.__hasMask?ga:ua)}__updateStrokeBounds(){da(this.__layout.strokeBounds,this.children,this.__hasMask?fa:_a)}__updateRenderBounds(){da(this.__layout.renderBounds,this.children,this.__hasMask?ya:pa)}__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(ca),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return ma.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=Lt.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(Qn.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Qn.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(Qn.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Qn.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Qn(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};va=Vt([_n(zr)],va);class wa{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 wa;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 xa{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}}const ba="1.6.2";class ka extends ie{get allowBackgroundColor(){return!1}init(){const{config:e}=this;let i=e.view||e.canvas;i?("string"==typeof i?("#"!==i[0]&&(i="#"+i),this.viewSelect=t.miniapp.select(i)):i.fields?this.viewSelect=i:this.initView(i),this.viewSelect&&t.miniapp.getSizeView(this.viewSelect).then((t=>{this.initView(t)}))):this.initView()}initView(e){e?this.view=e.view||e:(e={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:i,height:s,pixelRatio:o}=this.config,n={width:i||e.width,height:s||e.height,pixelRatio:o};this.resize(n),this.context&&(this.viewSelect&&(t.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,o){this.context.roundRect(t,e,i,s,"number"==typeof o?[o]:o)}),po(this.context.__proto__))}__createView(){this.view=t.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)}updateClientBounds(e){this.viewSelect&&t.miniapp.getBounds(this.viewSelect).then((t=>{this.clientBounds=t,e&&e()}))}startAutoLayout(e,i){this.resizeListener=i,e&&(this.checkSize=this.checkSize.bind(this),t.miniapp.onWindowResize(this.checkSize))}checkSize(){this.viewSelect&&setTimeout((()=>{this.updateClientBounds((()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)}))}),500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,t.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};It.copyAttrs(e,this,ee),this.resize(t),void 0!==this.width&&this.resizeListener(new er(t,e))}}const{mineType:Ea,fileType:Ba}=go;function Sa(i,s){t.origin={createCanvas:(t,e,i)=>{const o={type:"2d",width:t,height:e};return s.createOffscreenCanvas?s.createOffscreenCanvas(o):s.createOffScreenCanvas(o)},canvasToDataURL:(t,e,i)=>t.toDataURL(Ea(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(e,i,s)=>{let o=e.toDataURL(Ea(Ba(i)),s);return o=o.substring(o.indexOf("64,")+3),t.origin.download(o,i)},download:(e,i)=>new Promise(((o,n)=>{let r;i.includes("/")||(i=`${s.env.USER_DATA_PATH}/`+i,r=!0);const a=s.getFileSystemManager();a.writeFile({filePath:i,data:e,encoding:"base64",success(){r?t.miniapp.saveToAlbum(i).then((()=>{a.unlink({filePath:i}),o()})):o()},fail(t){n(t)}})})),loadImage:e=>new Promise(((i,s)=>{const o=t.canvas.view.createImage();o.onload=()=>{i(o)},o.onerror=t=>{s(t)},o.src=t.image.getRealURL(e)})),noRepeat:"repeat-x"},t.miniapp={select:t=>s.createSelectorQuery().select(t),getBounds:t=>new Promise((e=>{t.boundingClientRect().exec((t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})}))})),getSizeView:t=>new Promise((e=>{t.fields({node:!0,size:!0}).exec((t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})}))})),saveToAlbum:t=>new Promise((e=>{s.getSetting({success:i=>{i.authSetting["scope.writePhotosAlbum"]?s.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):s.authorize({scope:"scope.writePhotosAlbum",success:()=>{s.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})})),onWindowResize(t){s.onWindowResize(t)},offWindowResize(t){s.offWindowResize(t)}},t.event={stopDefault(t){},stopNow(t){},stop(t){}},t.canvas=e.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(e,{canvas:(t,e)=>new ka(t,e),image:t=>new Ro(t)}),t.name="miniapp",t.requestRender=function(e){const{view:i}=t.renderCanvas||t.canvas;i.requestAnimationFrame?i.requestAnimationFrame(e):setTimeout(e,16)},Co(t,"devicePixelRatio",{get:()=>Math.max(1,wx.getSystemInfoSync().pixelRatio)});class Ra{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new wa;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 wa,this.target=t,e&&(this.config=It.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(or.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Qn.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 ir(ir.DATA,{updatedList:this.updatedList})),this.__updatedList=new wa,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_($n.CHANGE,this.__onAttrChange,this),t.on_([Qn.ADD,Qn.REMOVE],this.__onChildEvent,this),t.on_(ir.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:Ca,updateBounds:Ta,updateChange:Oa}=Rn,{pushAllChildBranch:La,pushAllParent:Pa}=In;const{worldBounds:Aa}=Dn;class Ma{constructor(t){this.updatedBounds=new dt,this.beforeBounds=new dt,this.afterBounds=new dt,t instanceof Array&&(t=new wa(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Aa)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Aa),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:Da,updateAllChange:Fa}=Rn,Ia=bt.get("Layouter");class Wa{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new xa,this.target=t,e&&(this.config=It.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:t}=this;this.times=0;try{t.emit(sr.START),this.layoutOnce(),t.emitEvent(new sr(sr.END,this.layoutedBlocks,this.times))}catch(t){Ia.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ia.warn("layouting"):this.times>3?Ia.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(ir.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}=sr,a=this.getBlocks(s);a.forEach((t=>t.setBefore())),i.emitEvent(new sr(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?(Ca(t,!0),e.add(t),t.isBranch&&La(t,e),Pa(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Pa(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||Ta(s[t])}Ta(i)}}))}(this.__levelList),function(t){t.list.forEach(Oa)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach((t=>t.setAfter())),i.emitEvent(new sr(n,a,this.times)),i.emitEvent(new sr(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}=sr,n=this.getBlocks(new wa(e));e.emitEvent(new sr(i,n,this.times)),Wa.fullLayout(e),n.forEach((t=>{t.setAfter()})),e.emitEvent(new sr(s,n,this.times)),e.emitEvent(new sr(o,n,this.times)),this.addBlocks(n),St.end(t)}static fullLayout(t){Da(t,!0),t.isBranch?In.updateBounds(t):Rn.updateBounds(t),Fa(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ma([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ma(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(sr.REQUEST,this.layout,this),t.on_(sr.AGAIN,this.layoutAgain,this),t.on_(ir.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const za=bt.get("Renderer");class Ya{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=It.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(sr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(or.CHILD_START,t),t.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),t.emit(or.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(or.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new dt,za.log(e.innerName,"---\x3e");try{this.emitRender(or.START),this.renderOnce(t),this.emitRender(or.END,this.totalBounds),ko.clearRecycled()}catch(t){this.rendering=!1,za.error(t)}za.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return za.warn("rendering");if(this.times>3)return za.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new dt,this.renderOptions={},t)this.emitRender(or.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(or.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(or.RENDER,this.renderBounds,this.renderOptions),this.emitRender(or.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 dt(s);i.save(),s.spread(Ya.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 dt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now();t.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 dt(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 dt(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||za.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 or(t,this.times,e,i))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(or.REQUEST,this.update,this),t.on_(sr.END,this.__onLayoutEnd,this),t.on_(or.AGAIN,this.renderAgain,this),t.on_(er.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}Ya.clipSpread=10;const{hitRadiusPoint:Na}=rt;class Xa{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 wa(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 wa;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||Rn.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 wa;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 wa;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 wa,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||Na(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 Ha{constructor(t,i){this.config={},i&&(this.config=It.default(i,this.config)),this.picker=new Xa(this.target=t,this),this.finder=e.finder&&e.finder()}getByPoint(e,i,s){const{target:o,picker:n}=this;return t.backgrounder&&o&&o.updateLayout(),n.getByPoint(e,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Tt.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Va(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function ja(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function Ga(){return(t,e)=>{const i="_"+e;Co(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(e,{watcher:(t,e)=>new Ra(t,e),layouter:(t,e)=>new Wa(t,e),renderer:(t,e,i)=>new Ya(t,e,i),selector:(t,e)=>new Ha(t,e)}),t.layout=Wa.fullLayout;const Ua={},qa={},Za={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},Ka={},Ja={},Qa={},$a={},th={},eh={apply(){Tt.need("filter")}},ih={},sh={setStyleName:()=>Tt.need("state"),set:()=>Tt.need("state")},oh={list:{},register(t,e){oh.list[t]=e},get:t=>oh.list[t]},{parse:nh,objectToCanvasData:rh}=Ei,ah={},hh=bt.get("UIData");class lh extends zt{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){const{strokeWidth:t,strokeWidthFixed:e}=this;if(e){const e=this.__leaf;let{scaleX:i}=e.__nowWorld||e.__world;return i<0&&(i=-i),i>1?t/i:t}return t}get __hasStroke(){return this.stroke&&this.strokeWidth}get __hasHalf(){const t=this;return t.stroke&&"center"===t.strokeAlign&&t.strokeWidth%2||void 0}get __hasMultiPaint(){const t=this;return!!(t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect)||t.fill&&this.__hasStroke}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,hh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,hh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){if(this.__naturalWidth&&this.__removeNaturalSize(),"string"!=typeof t&&t){if("object"==typeof t){this.__setInput("fill",t);const e=this.__leaf.__layout;e.boxChanged||e.boxChange(),this.__isFills=!0,this._fill||(this._fill=ah)}}else this.__isFills&&(this.__removeInput("fill"),Qa.recycleImage("fill",this),this.__isFills=!1,this.__pixelFill&&(this.__pixelFill=!1)),this._fill=t}setStroke(t){if("string"!=typeof t&&t){if("object"==typeof t){this.__setInput("stroke",t);const e=this.__leaf.__layout;e.boxChanged||e.boxChange(),this.__isStrokes=!0,this._stroke||(this._stroke=ah)}}else this.__isStrokes&&(this.__removeInput("stroke"),Qa.recycleImage("stroke",this),this.__isStrokes=!1,this.__pixelStroke&&(this.__pixelStroke=!1)),this._stroke=t}setPath(t){const e="string"==typeof t;e||t&&"object"==typeof t[0]?(this.__setInput("path",t),this._path=e?nh(t):rh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){dh(this,"shadow",t)}setInnerShadow(t){dh(this,"innerShadow",t)}setFilter(t){dh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Ja.compute("fill",this.__leaf),e&&Ja.compute("stroke",this.__leaf),this.__needComputePaint=!1}}function dh(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=null)):i=i&&!1!==i.visible?[i]:null,t["_"+e]=i}class ch extends lh{}class uh extends ch{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){const t=this;return"hide"===t.overflow&&(t.__clipAfterFill||t.innerShadow)&&t.__leaf.children.length}get __clipAfterFill(){return this.__leaf.isOverflow||super.__clipAfterFill}}class _h extends ch{__getInputData(t,e){const i=super.__getInputData(t,e);return ee.forEach((t=>delete i[t])),i}}class ph extends uh{}class gh extends lh{}class fh extends lh{get __boxStroke(){return!this.__pathInputed}}class yh extends lh{get __boxStroke(){return!this.__pathInputed}}class mh extends lh{}class vh extends lh{}class wh extends lh{get __pathInputed(){return 2}}class xh extends ch{}const bh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class kh extends lh{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),t=bh[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=Lt.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 Eh extends fh{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.__leaf.image&&(this.__leaf.image=null),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 Bh extends fh{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 Sh={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,strokeWidth: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}=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+=eh.getSpread(n));let r=t=Math.ceil(t);return i&&i.forEach((t=>r=Math.max(r,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur))),o&&(r=Math.max(r,o)),this.__layout.renderShapeSpread=r,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},Rh={__updateChange(){const t=this.__,e=this.__world;if(t.__useEffect){const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:n}=this.__;t.__useEffect=!!(e||i||s||o||n)}const i=t.__hasHalf;e.half!==i&&(e.half=i),t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){Ch(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:n,__drawAfterFill:r}=s;if(this.__drawRenderPath(t),s.__useEffect){const a=Ja.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:l,filter:d}=s;h&&th.shadow(this,t,a),o&&(s.__isFills?Ja.fills(o,this,t):Ja.fill(o,this,t)),r&&this.__drawAfterFill(t,e),l&&th.innerShadow(this,t,a),n&&(s.__isStrokes?Ja.strokes(n,this,t):Ja.stroke(n,this,t)),d&&eh.apply(d,this,this.__nowWorld,t,i,a),a.worldCanvas&&a.worldCanvas.recycle(),a.canvas.recycle()}else o&&(s.__isFills?Ja.fills(o,this,t):Ja.fill(o,this,t)),r&&this.__drawAfterFill(t,e),n&&(s.__isStrokes?Ja.strokes(n,this,t):Ja.stroke(n,this,t))}else s.__pathInputed?Ch(this,t,e):this.__drawFast(t,e)},__renderShape(t,e,i,s){if(this.__worldOpacity){t.setWorld(this.__nowWorld=this.__getNowWorld(e));const{fill:o,stroke:n}=this.__;this.__drawRenderPath(t),o&&!i&&(this.__.__pixelFill?Ja.fills(o,this,t):Ja.fill("#000000",this,t)),this.__.__isCanvas&&this.__drawAfterFill(t,e),n&&!s&&(this.__.__pixelStroke?Ja.strokes(n,this,t):Ja.stroke("#000000",this,t))}},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),this.windingRule?t.clip(this.windingRule):t.clip(),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Ch(t,e,i){const{fill:s,stroke:o,__drawAfterFill:n}=t.__;t.__drawRenderPath(e),s&&Ja.fill(s,t,e),n&&t.__drawAfterFill(e,i),o&&Ja.stroke(o,t,e)}const Th={__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 Oh;let Lh=Oh=class extends la{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 pen(){const{path:t}=this.__;return uo.set(this.path=t||[]),t||this.__drawPathByBox(uo),uo}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 Tt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Tt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(uo.set(i=[]),this.__drawPathByBox(uo)),t?Ei.toCanvasData(i,!0):i}getPathString(t,e,i){return Ei.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||ih.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){if(this.__.path){const t=this.__;t.__pathForRender=t.cornerRadius?co.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Ka.addArrows(this,!t.cornerRadius)}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Bs.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){Ja.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return Tt.need("animate")}killAnimate(t,e){}export(t,e){return Tt.need("export")}syncExport(t,e){return Tt.need("export")}clone(t){const e=It.clone(this.toJSON());return t&&Object.assign(e,t),Oh.one(e)}static one(t,e,i,s,o){return Lt.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){pn()(this)}static registerData(t){on(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};Vt([on(lh)],Lh.prototype,"__",void 0),Vt([Ga()],Lh.prototype,"zoomLayer",void 0),Vt([Ao("")],Lh.prototype,"id",void 0),Vt([Ao("")],Lh.prototype,"name",void 0),Vt([Ao("")],Lh.prototype,"className",void 0),Vt([Uo("pass-through")],Lh.prototype,"blendMode",void 0),Vt([qo(1)],Lh.prototype,"opacity",void 0),Vt([Zo(!0)],Lh.prototype,"visible",void 0),Vt([Uo(!1)],Lh.prototype,"locked",void 0),Vt([Uo(!1)],Lh.prototype,"dim",void 0),Vt([Uo(!1)],Lh.prototype,"dimskip",void 0),Vt([Qo(0)],Lh.prototype,"zIndex",void 0),Vt([$o(!1)],Lh.prototype,"mask",void 0),Vt([tn(!1)],Lh.prototype,"eraser",void 0),Vt([Mo(0,!0)],Lh.prototype,"x",void 0),Vt([Mo(0,!0)],Lh.prototype,"y",void 0),Vt([Wo(100,!0)],Lh.prototype,"width",void 0),Vt([Wo(100,!0)],Lh.prototype,"height",void 0),Vt([Fo(1,!0)],Lh.prototype,"scaleX",void 0),Vt([Fo(1,!0)],Lh.prototype,"scaleY",void 0),Vt([Io(0,!0)],Lh.prototype,"rotation",void 0),Vt([Io(0,!0)],Lh.prototype,"skewX",void 0),Vt([Io(0,!0)],Lh.prototype,"skewY",void 0),Vt([Mo(0,!0)],Lh.prototype,"offsetX",void 0),Vt([Mo(0,!0)],Lh.prototype,"offsetY",void 0),Vt([Mo(0,!0)],Lh.prototype,"scrollX",void 0),Vt([Mo(0,!0)],Lh.prototype,"scrollY",void 0),Vt([Do()],Lh.prototype,"origin",void 0),Vt([Do()],Lh.prototype,"around",void 0),Vt([Ao(!1)],Lh.prototype,"lazy",void 0),Vt([zo(1)],Lh.prototype,"pixelRatio",void 0),Vt([No()],Lh.prototype,"path",void 0),Vt([Xo()],Lh.prototype,"windingRule",void 0),Vt([Xo(!0)],Lh.prototype,"closed",void 0),Vt([Wo(0)],Lh.prototype,"padding",void 0),Vt([Wo(!1)],Lh.prototype,"lockRatio",void 0),Vt([Wo()],Lh.prototype,"widthRange",void 0),Vt([Wo()],Lh.prototype,"heightRange",void 0),Vt([Ao(!1)],Lh.prototype,"draggable",void 0),Vt([Ao()],Lh.prototype,"dragBounds",void 0),Vt([Ao(!1)],Lh.prototype,"editable",void 0),Vt([en(!0)],Lh.prototype,"hittable",void 0),Vt([en("path")],Lh.prototype,"hitFill",void 0),Vt([jo("path")],Lh.prototype,"hitStroke",void 0),Vt([en(!1)],Lh.prototype,"hitBox",void 0),Vt([en(!0)],Lh.prototype,"hitChildren",void 0),Vt([en(!0)],Lh.prototype,"hitSelf",void 0),Vt([en()],Lh.prototype,"hitRadius",void 0),Vt([sn("")],Lh.prototype,"cursor",void 0),Vt([Uo()],Lh.prototype,"fill",void 0),Vt([jo()],Lh.prototype,"stroke",void 0),Vt([jo("inside")],Lh.prototype,"strokeAlign",void 0),Vt([jo(1)],Lh.prototype,"strokeWidth",void 0),Vt([jo(!1)],Lh.prototype,"strokeWidthFixed",void 0),Vt([jo("none")],Lh.prototype,"strokeCap",void 0),Vt([jo("miter")],Lh.prototype,"strokeJoin",void 0),Vt([jo()],Lh.prototype,"dashPattern",void 0),Vt([jo(0)],Lh.prototype,"dashOffset",void 0),Vt([jo(10)],Lh.prototype,"miterLimit",void 0),Vt([Xo(0)],Lh.prototype,"cornerRadius",void 0),Vt([Xo()],Lh.prototype,"cornerSmoothing",void 0),Vt([Va()],Lh.prototype,"shadow",void 0),Vt([Va()],Lh.prototype,"innerShadow",void 0),Vt([Va()],Lh.prototype,"blur",void 0),Vt([Va()],Lh.prototype,"backgroundBlur",void 0),Vt([Va()],Lh.prototype,"grayscale",void 0),Vt([Va()],Lh.prototype,"filter",void 0),Vt([Uo()],Lh.prototype,"placeholderColor",void 0),Vt([Ao({})],Lh.prototype,"data",void 0),Vt([dn(la.prototype.reset)],Lh.prototype,"reset",null),Lh=Oh=Vt([_n(Sh),_n(Rh),cn()],Lh);let Ph=class extends Lh{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 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(){}};var Ah;Vt([on(ch)],Ph.prototype,"__",void 0),Vt([Wo(0)],Ph.prototype,"width",void 0),Vt([Wo(0)],Ph.prototype,"height",void 0),Ph=Vt([_n(va),pn()],Ph);const Mh=bt.get("Leafer");let Dh=Ah=class extends Ph{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&xo.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),Ah.list.add(this)}init(t,i){if(this.canvas)return;let s;const{config:o}=this;this.__setLeafer(this),i&&(this.parentApp=i,this.__bindApp(i),s=i.running),t&&(this.parent=i,this.initType(t.type),this.parent=void 0,It.assign(o,t));const n=this.canvas=e.canvas(o);this.__controllers.push(this.renderer=e.renderer(this,n,o),this.watcher=e.watcher(this,o),this.layouter=e.layouter(this,o)),this.isApp&&this.__setApp(),this.__checkAutoLayout(o,i),this.view=n.view,i||(this.selector=e.selector(this),this.interaction=e.interaction(this,n,this.selector,o),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=e.hitCanvasManager()),this.canvasManager=new Ft,s=o.start),this.hittable=o.hittable,this.fill=o.fill,this.canvasManager.add(n),this.__listenEvents(),s&&(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(nr.RESTART):this.emitLeafer(nr.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(nr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=It.copyAttrs({},t,ee);Object.keys(e).forEach((t=>this[t]=e[t]))}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new dt(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=It.copyAttrs({},this.canvas,ee);e.resize(t),this.updateLazyBounds(),this.__onResize(new er(t,i))}__onResize(t){this.emitEvent(t),It.copyAttrs(this.__,t,ee),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 ut(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ee.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&&ee.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=It.copyAttrs({},this.canvas,ee);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(nr.BEFORE_READY),this.emitLeafer(nr.READY),this.emitLeafer(nr.AFTER_READY),Nn.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(nr.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(nr.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 Tt.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 nr(t,this))}__listenEvents(){const t=St.start("FirstCreate "+this.innerName);this.once(nr.START,(()=>St.end(t))),this.once(sr.START,(()=>this.updateLazyBounds())),this.once(or.START,(()=>this.__onCreated())),this.once(or.END,(()=>this.__onViewReady())),this.__eventIds.push(this.on_(ir.DATA,this.__onWatchData,this),this.on_(sr.END,this.__onLayoutEnd,this),this.on_(or.NEXT,this.__onNextRender,this))}__removeListenEvents(){this.off_(this.__eventIds),this.__eventIds.length=0}destroy(t){const e=()=>{if(!this.destroyed){Ah.list.remove(this);try{this.stop(),this.emitEvent(new nr(nr.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>!(this.parent&&t===this.interaction)&&t.destroy())),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout((()=>{ko.clearRecycled()}),100)}catch(t){Mh.error(t)}}};t?e():setTimeout(e)}};Dh.list=new wa,Vt([on(_h)],Dh.prototype,"__",void 0),Vt([Wo()],Dh.prototype,"pixelRatio",void 0),Dh=Ah=Vt([pn()],Dh);let Fh=class extends Lh{get __tag(){return"Rect"}constructor(t){super(t)}};Vt([on(fh)],Fh.prototype,"__",void 0),Fh=Vt([_n(Th),cn(),pn()],Fh);const{copy:Ih,add:Wh,includes:zh}=rt,Yh=Fh.prototype,Nh=Ph.prototype,Xh={};let Hh=class extends Ph{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){const e=this.__;if(this.children.length&&!this.pathInputed)if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:t}=this.__layout;e.__autoSize||(e.__autoWidth?(t.width+=t.x,t.x=0,t.height=e.height,t.y=0):(t.height+=t.y,t.y=0,t.width=e.width,t.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds();else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t;const{renderBounds:e}=this.__layout;this.children.length?(super.__updateRenderBounds(),Ih(Xh,e),this.__updateRectRenderBounds(),t=!zh(e,Xh)||void 0,t&&"hide"!==this.__.overflow&&Wh(e,Xh)):this.__updateRectRenderBounds(),this.isOverflow!==t&&(this.isOverflow=t)}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e))}__drawContent(t,e){this.__renderGroup(t,e),this.__.__hasStroke&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};Vt([on(uh)],Hh.prototype,"__",void 0),Vt([Wo(100)],Hh.prototype,"width",void 0),Vt([Wo(100)],Hh.prototype,"height",void 0),Vt([Ao(!1)],Hh.prototype,"resizeChildren",void 0),Vt([Go("show")],Hh.prototype,"overflow",void 0),Vt([dn(Yh.__updateStrokeSpread)],Hh.prototype,"__updateStrokeSpread",null),Vt([dn(Yh.__updateRenderSpread)],Hh.prototype,"__updateRectRenderSpread",null),Vt([dn(Yh.__updateBoxBounds)],Hh.prototype,"__updateRectBoxBounds",null),Vt([dn(Yh.__updateStrokeBounds)],Hh.prototype,"__updateStrokeBounds",null),Vt([dn(Yh.__updateRenderBounds)],Hh.prototype,"__updateRectRenderBounds",null),Vt([dn(Yh.__updateChange)],Hh.prototype,"__updateRectChange",null),Vt([dn(Yh.__render)],Hh.prototype,"__renderRect",null),Vt([dn(Nh.__render)],Hh.prototype,"__renderGroup",null),Hh=Vt([cn(),pn()],Hh);let Vh=class extends Hh{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};Vt([on(ph)],Vh.prototype,"__",void 0),Vt([Uo("#FFFFFF")],Vh.prototype,"fill",void 0),Vt([Go("hide")],Vh.prototype,"overflow",void 0),Vh=Vt([pn()],Vh);const{moveTo:jh,closePath:Gh,ellipse:Uh}=Ui;let qh=class extends Lh{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:e,height:i,innerRadius:s,startAngle:o,endAngle:n}=this.__,r=e/2,a=i/2,h=this.__.path=[];s?(o||n?(s<1&&Uh(h,r,a,r*s,a*s,0,o,n,!1),Uh(h,r,a,r,a,0,n,o,!0),s<1&&Gh(h)):(s<1&&(Uh(h,r,a,r*s,a*s),jh(h,e,a)),Uh(h,r,a,r,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):o||n?(jh(h,r,a),Uh(h,r,a,r,a,0,o,n,!1),Gh(h)):Uh(h,r,a,r,a)}};Vt([on(yh)],qh.prototype,"__",void 0),Vt([Xo(0)],qh.prototype,"innerRadius",void 0),Vt([Xo(0)],qh.prototype,"startAngle",void 0),Vt([Xo(0)],qh.prototype,"endAngle",void 0),qh=Vt([pn()],qh);const{moveTo:Zh,lineTo:Kh,drawPoints:Jh}=Ui,{rotate:Qh,getAngle:$h,getDistance:tl,defaultPoint:el}=M,{toBounds:il}=so;let sl=class extends Lh{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Qh(i,e),i}set toPoint(t){this.width=tl(el,t),this.rotation=$h(el,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Jh(e,t.points,!1,t.closed):(Zh(e,0,0),Kh(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Jh(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&Ka.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?il(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};Vt([on(gh)],sl.prototype,"__",void 0),Vt([Ho("center")],sl.prototype,"strokeAlign",void 0),Vt([Wo(0)],sl.prototype,"height",void 0),Vt([Xo()],sl.prototype,"points",void 0),Vt([Xo(0)],sl.prototype,"curve",void 0),Vt([Xo(!1)],sl.prototype,"closed",void 0),sl=Vt([pn()],sl);const{sin:ol,cos:nl,PI:rl}=Math,{moveTo:al,lineTo:hl,closePath:ll,drawPoints:dl}=Ui,cl=sl.prototype;let ul=class extends Lh{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)dl(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,o=e/2,n=i/2;al(t,o,0);for(let e=1;e<s;e++)hl(t,o+o*ol(2*e*rl/s),n-n*nl(2*e*rl/s))}ll(t)}__updateRenderPath(){}__updateBoxBounds(){}};Vt([on(mh)],ul.prototype,"__",void 0),Vt([Xo(3)],ul.prototype,"sides",void 0),Vt([Xo()],ul.prototype,"points",void 0),Vt([Xo(0)],ul.prototype,"curve",void 0),Vt([dn(cl.__updateRenderPath)],ul.prototype,"__updateRenderPath",null),Vt([dn(cl.__updateBoxBounds)],ul.prototype,"__updateBoxBounds",null),ul=Vt([cn(),pn()],ul);const{sin:_l,cos:pl,PI:gl}=Math,{moveTo:fl,lineTo:yl,closePath:ml}=Ui;let vl=class extends Lh{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)*_l(t*gl/i),n-(t%2==0?n:n*s)*pl(t*gl/i));ml(r)}};Vt([on(vh)],vl.prototype,"__",void 0),Vt([Xo(5)],vl.prototype,"corners",void 0),Vt([Xo(.382)],vl.prototype,"innerRadius",void 0),vl=Vt([pn()],vl);let wl=class extends Fh{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t),this.on_(tr.LOADED,this.__onLoaded,this)}__onLoaded(t){"fill"===t.attrName&&t.attrValue.url===this.url&&(this.image=t.image)}destroy(){this.image=null,super.destroy()}};Vt([on(Eh)],wl.prototype,"__",void 0),Vt([Wo("")],wl.prototype,"url",void 0),wl=Vt([pn()],wl);const xl=wl;let bl=class extends Fh{get __tag(){return"Canvas"}get ready(){return!this.url}constructor(t){super(t),this.canvas=e.canvas(this.__),this.context=this.canvas.context,t&&t.url&&this.drawImage(t.url)}drawImage(t){new Ro({url:t}).load((t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new tr(tr.LOADED,{image:t}))}))}draw(t,e,i,s){const o=new N(t.worldTransform).invert(),n=new N;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=this.context=null),super.destroy()}};Vt([on(Bh)],bl.prototype,"__",void 0),Vt([ja(100)],bl.prototype,"width",void 0),Vt([ja(100)],bl.prototype,"height",void 0),Vt([ja(1)],bl.prototype,"pixelRatio",void 0),Vt([ja(!0)],bl.prototype,"smooth",void 0),Vt([Ao(!1)],bl.prototype,"safeResize",void 0),Vt([ja()],bl.prototype,"contextSettings",void 0),bl=Vt([pn()],bl);const{copyAndSpread:kl,includes:El,spread:Bl,setList:Sl}=rt;let Rl=class extends Lh{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=Za.number(e,o),t.__letterSpacing=Za.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=Ua.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);const l=!El(h,a)||void 0;l?(Sl(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h,this.isOverflow!==l&&(this.isOverflow=l)}__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;kl(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&&!ih.running||super.__draw(t,e,i)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};Vt([on(kh)],Rl.prototype,"__",void 0),Vt([Wo(0)],Rl.prototype,"width",void 0),Vt([Wo(0)],Rl.prototype,"height",void 0),Vt([Uo()],Rl.prototype,"boxStyle",void 0),Vt([Ao(!1)],Rl.prototype,"resizeFontSize",void 0),Vt([Uo("#000000")],Rl.prototype,"fill",void 0),Vt([Ho("outside")],Rl.prototype,"strokeAlign",void 0),Vt([en("all")],Rl.prototype,"hitFill",void 0),Vt([Wo("")],Rl.prototype,"text",void 0),Vt([Wo("")],Rl.prototype,"placeholder",void 0),Vt([Wo("caption")],Rl.prototype,"fontFamily",void 0),Vt([Wo(12)],Rl.prototype,"fontSize",void 0),Vt([Wo("normal")],Rl.prototype,"fontWeight",void 0),Vt([Wo(!1)],Rl.prototype,"italic",void 0),Vt([Wo("none")],Rl.prototype,"textCase",void 0),Vt([Wo("none")],Rl.prototype,"textDecoration",void 0),Vt([Wo(0)],Rl.prototype,"letterSpacing",void 0),Vt([Wo({type:"percent",value:1.5})],Rl.prototype,"lineHeight",void 0),Vt([Wo(0)],Rl.prototype,"paraIndent",void 0),Vt([Wo(0)],Rl.prototype,"paraSpacing",void 0),Vt([Wo("x")],Rl.prototype,"writingMode",void 0),Vt([Wo("left")],Rl.prototype,"textAlign",void 0),Vt([Wo("top")],Rl.prototype,"verticalAlign",void 0),Vt([Wo(!0)],Rl.prototype,"autoSizeAlign",void 0),Vt([Wo("normal")],Rl.prototype,"textWrap",void 0),Vt([Wo("show")],Rl.prototype,"textOverflow",void 0),Rl=Vt([pn()],Rl);let Cl=class extends Lh{get __tag(){return"Path"}constructor(t){super(t)}};Vt([on(wh)],Cl.prototype,"__",void 0),Vt([Ho("center")],Cl.prototype,"strokeAlign",void 0),Cl=Vt([pn()],Cl);let Tl=class extends Ph{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new Cl(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),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")}};Vt([on(xh)],Tl.prototype,"__",void 0),Vt([(t,e)=>{Co(t,e,{get(){return this.__path}})}],Tl.prototype,"path",void 0),Tl=Vt([_n(ds,["set","path","paint"]),pn()],Tl);let Ol=class extends Dh{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,i){if(super.init(t,i),t){const{ground:i,tree:s,sky:o,editor:n}=t;i&&(this.ground=this.addLeafer(i)),(s||n)&&(this.tree=this.addLeafer(s||{type:t.type||"design"})),(o||n)&&(this.sky=this.addLeafer(o)),n&&this.sky.add(this.editor=e.editor(n))}}__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()}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(t){const e=new Dh(t);return this.add(e),e}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){if(t.context){const i=e.matrix;i&&t.setTransform(i.a,i.b,i.c,i.d,i.e,i.f),this.forEach((e=>t.copyWorld(e.canvas)))}}__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&&It.assign(e,t),this.autoLayout&&It.copyAttrs(e,this,ee),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once(sr.END,(()=>this.__onReady())),t.once(or.START,(()=>this.__onCreated())),t.once(or.END,(()=>this.__onViewReady())),this.realCanvas&&this.__eventIds.push(t.on_(or.END,this.__onChildRenderEnd,this))}};Ol=Vt([pn()],Ol);const Ll={},Pl={isHoldSpaceKey:()=>Pl.isHold("Space"),isHold:t=>Ll[t],setDownCode(t){Ll[t]||(Ll[t]=!0)},setUpCode(t){Ll[t]=!1}},Al={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 Ml extends Jn{get spaceKey(){return Pl.isHoldSpaceKey()}get left(){return Al.left(this)}get right(){return Al.right(this)}get middle(){return Al.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){Mt.changeName(t,e)}}let Dl=class extends Ml{};Dl.POINTER="pointer",Dl.BEFORE_DOWN="pointer.before_down",Dl.BEFORE_MOVE="pointer.before_move",Dl.BEFORE_UP="pointer.before_up",Dl.DOWN="pointer.down",Dl.MOVE="pointer.move",Dl.UP="pointer.up",Dl.OVER="pointer.over",Dl.OUT="pointer.out",Dl.ENTER="pointer.enter",Dl.LEAVE="pointer.leave",Dl.TAP="tap",Dl.DOUBLE_TAP="double_tap",Dl.CLICK="click",Dl.DOUBLE_CLICK="double_click",Dl.LONG_PRESS="long_press",Dl.LONG_TAP="long_tap",Dl.MENU="pointer.menu",Dl.MENU_TAP="pointer.menu_tap",Dl=Vt([gn()],Dl);const Fl=Dl,Il={};let Wl=class extends Dl{static setList(t){this.list=t instanceof wa?t:new wa(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 M.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)),rt.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(Il,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Il,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Il,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){Il.x=t?this.totalX:this.moveX,Il.y=t?this.totalY:this.moveY}};Wl.BEFORE_DRAG="drag.before_drag",Wl.START="drag.start",Wl.DRAG="drag",Wl.END="drag.end",Wl.OVER="drag.over",Wl.OUT="drag.out",Wl.ENTER="drag.enter",Wl.LEAVE="drag.leave",Wl=Vt([gn()],Wl);const zl=Wl;let Yl=class extends Dl{static setList(t){Wl.setList(t)}static setData(t){Wl.setData(t)}};Yl.DROP="drop",Yl=Vt([gn()],Yl);let Nl=class extends Wl{};Nl.BEFORE_MOVE="move.before_move",Nl.START="move.start",Nl.MOVE="move",Nl.END="move.end",Nl=Vt([gn()],Nl);let Xl=class extends Ml{};Xl.BEFORE_ROTATE="rotate.before_rotate",Xl.START="rotate.start",Xl.ROTATE="rotate",Xl.END="rotate.end",Xl=Vt([gn()],Xl);let Hl=class extends Wl{};Hl.SWIPE="swipe",Hl.LEFT="swipe.left",Hl.RIGHT="swipe.right",Hl.UP="swipe.up",Hl.DOWN="swipe.down",Hl=Vt([gn()],Hl);let Vl=class extends Ml{};Vl.BEFORE_ZOOM="zoom.before_zoom",Vl.START="zoom.start",Vl.ZOOM="zoom",Vl.END="zoom.end",Vl=Vt([gn()],Vl);let jl=class extends Ml{};jl.DOWN="key.down",jl.HOLD="key.hold",jl.UP="key.up",jl=Vt([gn()],jl);const Gl={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:t=>t<-45&&t>-135?Hl.UP:t>45&&t<135?Hl.DOWN:t<=45&&t>=-45?Hl.RIGHT:Hl.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:Ul.getSwipeDirection(M.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 wa,{list:s}=t;for(let t=0,o=s.length;t<o;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some((t=>t.draggable||t.editable||!t.isLeafer&&t.hasEvent(Wl.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},Ul=Gl,ql=new wa,{getDragEventData:Zl,getDropEventData:Kl,getSwipeEventData:Jl}=Gl;class Ql{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Zl(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,o=Wl.list||this.draggableList||ql;return this.dragging&&(s?t?ql:new wa(e?[...i.list,...i.dragHoverExclude]:i.list):o)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(Nl.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Al.left(t),this.dragging&&(this.interaction.emit(Wl.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 wa(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:o,throughPath:n}=s;this.dragData=Zl(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",e.emit(Nl.BEFORE_MOVE,this.dragData),e.emit(Nl.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(Wl.BEFORE_DRAG,this.dragData),e.emit(Wl.DRAG,this.dragData))}dragReal(){const{running:t}=this.interaction,e=this.realDraggableList;if(e.length&&t){const{totalX:t,totalY:i}=this.dragData;e.forEach((e=>e.draggable&&e.move(Wl.getValidMove(e,this.dragStartPoints[e.innerId],{x:t,y:i}))))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(Wl.OUT,t,i),e.emit(Wl.OVER,t,s)):e.emit(Wl.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(Wl.LEAVE,t,i,s),e.emit(Wl.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:o,throughPath:n}=i,r=Zl(i,t,t);if(n&&(r.throughPath=n),r.path=o,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(Nl.END,r)),this.dragging){const o=this.getList();this.dragging=!1,e.emit(Wl.END,r),this.swipe(t,i,s,r),this.drop(t,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:o}=this;if(M.getDistance(e,t)>o.config.pointer.swipeDistance){const t=Jl(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=Kl(t,e,Wl.data);s.path=i,this.interaction.emit(Yl.DROP,s),this.interaction.emit(Wl.LEAVE,t,i)}dragReset(){Wl.list=Wl.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 $l=bt.get("emit");const td=["move","zoom","rotate","key"];function ed(t,e,i,s,o){if(td.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!sd(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&&id(n,e,i,s,o)}}function id(t,e,i,s,o){if(t.destroyed)return!1;if(t.__.hitSelf&&!sd(t,o)&&(sh.updateEventStyle&&!s&&sh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const o=Mt.get(e,i);if(t.emitEvent(o,s),o.isStop)return!0}return!1}function sd(t,e){return e&&e.has(t)}const od={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},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:nd,pathCanDrag:rd,pathHasOutside:ad}=Gl;class hd{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&&Al.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Al.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Pl.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=It.clone(od),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new wa(t),this.createTransformer(),this.dragger=new Ql(this),s&&(this.config=It.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Al.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(Dl.BEFORE_DOWN,t),this.emit(Dl.DOWN,t),Al.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Al.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Al.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(Dl.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=M.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(Dl.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Al.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(Dl.BEFORE_UP,t),this.emit(Dl.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(Dl.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(Dl.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Pl.setDownCode(e),this.emit(jl.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(jl.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]=!1,Pl.setUpCode(e),this.emit(jl.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new wa),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(Dl.OUT,t,i),this.emit(Dl.OVER,t,e)):this.emit(Dl.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach((t=>e.add(t))));const{enterPath:i}=this;this.enterPath=e,this.emit(Dl.LEAVE,t,i,e),this.emit(Dl.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Dl.LEAVE,t),this.dragger.dragging&&this.emit(Yl.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,o=[Dl.DOUBLE_TAP,Dl.DOUBLE_CLICK].some((e=>nd(t.path,e)));s<e.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(e,i){const{hitRadius:s,through:o}=this.p,{bottomList:n,target:r}=this;t.backgrounder||e.origin||r&&r.updateLayout();const a=this.selector.getByPoint(e,s,Object.assign({bottomList:n,name:e.type},i||{through:o}));return a.throughPath&&(e.throughPath=a.throughPath),e.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&&!ad(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!rd(t.path))&&!ad(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(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:Dl.MOVE}),this.hoverData=t)}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&&M.round(s),s}emitTap(t){this.emit(Dl.TAP,t),this.emit(Dl.CLICK,t)}emitDoubleTap(t){this.emit(Dl.DOUBLE_TAP,t),this.emit(Dl.DOUBLE_CLICK,t)}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(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(Dl.LONG_PRESS,t)}),this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(Dl.LONG_TAP,t),(nd(t.path,Dl.LONG_TAP)||nd(t.path,Dl.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new dt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-("number"==typeof t?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(er.RESIZE,this.__onResize,this)],t.once(nr.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],id(o,t,e,!0,s))return;o.isApp&&ed(o,t,e,!0,s)}for(let n=0,r=i.length;n<r;n++)if(o=i.list[n],o.isApp&&ed(o,t,e,!1,s),id(o,t,e,!1,s))return}catch(t){$l.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 ld{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}ld.custom={};class dd extends Ft{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new wa,this.pixelList=new wa}getPixelType(t,i){return this.__autoClear(),this.pixelList.add(t),e.hitCanvas(i)}getPathType(t){return this.__autoClear(),this.pathList.add(t),e.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:cd,copy:ud,setRadius:_d}=M,pd={},gd=la.prototype;gd.__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&&(ud(pd,t),_d(t=pd,e.hitRadius)),cd(t,i,pd),e.hitBox||o){if(rt.hitRadiusPoint(s.boxBounds,pd))return!0;if(o)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(pd)},gd.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},gd.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},gd.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},gd.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const fd=new N,yd=Lh.prototype;yd.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const e=this.__,{hitCanvasManager:i}=this.leafer||this.parent.leafer,s=(e.__pixelFill||e.__isCanvas)&&"pixel"===e.hitFill,o=e.__pixelStroke&&"pixel"===e.hitStroke,n=s||o;this.__hitCanvas||(this.__hitCanvas=n?i.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):i.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:i}=this.__layout,n=t.image.hitCanvasSize,a=r.hitScale=ct.set(0,0,n,n).getFitMatrix(i).a,{x:h,y:l,width:d,height:c}=ct.set(i).scale(a);r.resize({width:d,height:c,pixelRatio:1}),r.clear(),ko.patternLocked=!0,this.__renderShape(r,{matrix:fd.setWith(this.__world).scaleWith(1/a).invertWith().translate(-h,-l)},!s,!o),ko.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},yd.__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.__pixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:o,__strokeWidth:n}=e,r=e.stroke&&("path"===o||"pixel"===o&&!e.__pixelStroke)||"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 md=Lh.prototype,vd=Fh.prototype,wd=Hh.prototype;vd.__updateHitCanvas=wd.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?md.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},vd.__hitFill=wd.__hitFill=function(t){return this.__hitCanvas?md.__hitFill.call(this,t):rt.hitRadiusPoint(this.__layout.boxBounds,t)},Rl.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)))},Ph.prototype.pick=function(i,s){return s||(s=Nt),this.updateLayout(),function(i){return i.leafer?i.leafer.selector:t.selector||(t.selector=e.selector())}(this).getByPoint(i,s.hitRadius||0,Object.assign(Object.assign({},s),{target:this}))};const xd=ie.prototype;xd.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},xd.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},xd.hitPixel=function(t,e,i=1){let{x:s,y:o,radiusX:n,radiusY:r}=t;e&&(s-=e.x,o-=e.y),ct.set(s-n,o-r,2*n,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(ct.x,ct.y,ct.width||1,ct.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 bd={convertTouch(t,e){const i=bd.getTouch(t),s=Gl.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class kd extends hd{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return void 0!==t.x?{x:t.x,y:t.y}:super.getLocal(t,e)}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=bd.getTouch(t);this.pointerDown(bd.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=bd.getTouch(t);this.pointerMove(bd.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=bd.getTouch(t);this.pointerUp(bd.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Gl.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach((t=>{i=e.find((e=>e.identifier===t.identifier)),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})})),s}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}destroy(){super.destroy(),this.touches=null}}function Ed(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 Bd(t,e){t.__.__font?Ed(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Sd(t,e,i){const{strokeAlign:s}=e.__,o="string"!=typeof t;switch(s){case"center":i.setStroke(o?void 0:t,e.__.strokeWidth,e.__),o?Td(t,!0,e,i):Cd(e,i);break;case"inside":Rd("inside",t,o,e,i);break;case"outside":Rd("outside",t,o,e,i)}}function Rd(t,e,i,s,o){const{__strokeWidth:n,__font:r}=s.__,a=o.getSameCanvas(!0,!0);a.setStroke(i?void 0:e,2*n,s.__),a.font=r,i?Td(e,!0,s,a):Cd(s,a),a.blendMode="outside"===t?"destination-out":"destination-in",Ed(s,a),a.blendMode="normal",s.__worldFlipped?o.copyWorldByReset(a,s.__nowWorld):o.copyWorldToInner(a,s.__nowWorld,s.__layout.renderBounds),a.recycle(s.__nowWorld)}function Cd(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 Td(t,e,i,s){let o;for(let n=0,r=t.length;n<r;n++)o=t[n],o.image&&Qa.checkImage(i,s,o,!1)||o.style&&(s.strokeStyle=o.style,o.blendMode?(s.saveBlendMode(o.blendMode),e?Cd(i,s):s.stroke(),s.restoreBlendMode()):e?Cd(i,s):s.stroke())}function Od(t,e){t.__.dashPattern&&(e.beginPath(),t.__drawPathByData(e,t.__.__pathForArrow),e.dashPattern=null,e.stroke())}const{getSpread:Ld,getOuterOf:Pd,getByMove:Ad,getIntersectData:Md}=rt;let Dd;function Fd(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:s}=i.__layout;switch(e.type){case"solid":let{type:o,blendMode:n,color:r,opacity:a}=e;return{type:o,blendMode:n,style:qa.string(r,a)};case"image":return Qa.image(i,t,e,s,!Dd||!Dd[e.url]);case"linear":return $a.linearGradient(e,s);case"radial":return $a.radialGradient(e,s);case"angular":return $a.conicGradient(e,s);default:return void 0!==e.r?{type:"solid",style:qa.string(e)}:void 0}}const Id={compute:function(t,e){const i=e.__,s=[];let o,n=i.__input[t];n instanceof Array||(n=[n]),Dd=Qa.recycleImage(t,i);for(let i,o=0,r=n.length;o<r;o++)i=Fd(t,n[o],e),i&&s.push(i);i["_"+t]=s.length?s:void 0,s.length&&s[0].image&&(o=s[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=o:i.__pixelStroke=o},fill:function(t,e,i){i.fillStyle=t,Bd(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(Qa.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!o&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}i.fillStyle=s.style,s.transform?(i.save(),i.transform(s.transform),s.blendMode&&(i.blendMode=s.blendMode),Bd(e,i),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),Bd(e,i),i.restoreBlendMode()):Bd(e,i)}},fillPathOrText:Bd,fillText:Ed,stroke:function(t,e,i){const s=e.__,{__strokeWidth:o,strokeAlign:n,__font:r}=s;if(o)if(r)Sd(t,e,i);else switch(n){case"center":i.setStroke(t,o,s),i.stroke(),s.__useArrow&&Od(e,i);break;case"inside":i.save(),i.setStroke(t,2*o,s),s.windingRule?i.clip(s.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const n=i.getSameCanvas(!0,!0);n.setStroke(t,2*o,s),e.__drawRenderPath(n),n.stroke(),s.windingRule?n.clip(s.windingRule):n.clip(),n.clearWorld(e.__layout.renderBounds),e.__worldFlipped?i.copyWorldByReset(n,e.__nowWorld):i.copyWorldToInner(n,e.__nowWorld,e.__layout.renderBounds),n.recycle(e.__nowWorld)}},strokes:function(t,e,i){const s=e.__,{__strokeWidth:o,strokeAlign:n,__font:r}=s;if(o)if(r)Sd(t,e,i);else switch(n){case"center":i.setStroke(void 0,o,s),Td(t,!1,e,i),s.__useArrow&&Od(e,i);break;case"inside":i.save(),i.setStroke(void 0,2*o,s),s.windingRule?i.clip(s.windingRule):i.clip(),Td(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:n}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),r.setStroke(void 0,2*o,s),Td(t,!1,e,r),s.windingRule?r.clip(s.windingRule):r.clip(),r.clearWorld(n),e.__worldFlipped?i.copyWorldByReset(r,e.__nowWorld):i.copyWorldToInner(r,e.__nowWorld,n),r.recycle(e.__nowWorld)}},strokeText:Sd,drawTextStroke:Cd,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=Md(s?Ld(e.bounds,l===d?s*l:[s*d,s*l]):e.bounds,o);r=e.bounds.getFitMatrix(c);let{a:u,d:_}=r;if(r.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,d*=_),a=Pd(o,r),n=Ad(a,-r.e,-r.f),i.matrix){const{matrix:t}=i;r.multiply(t),u*=t.scaleX,_*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:r.withScale(u,_)})}return t.__renderShape(s,i),{canvas:s,matrix:r,bounds:n,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:d}}};let Wd={};const{get:zd,rotateOfOuter:Yd,translate:Nd,scaleOfOuter:Xd,scale:Hd,rotate:Vd}=b;function jd(t,e,i,s,o,n,r){const a=zd();Nd(a,e.x+i,e.y+s),Hd(a,o,n),r&&Yd(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function Gd(t,e,i,s,o,n,r){const a=zd();Nd(a,e.x+i,e.y+s),o&&Hd(a,o,n),r&&Vd(a,r),t.transform=a}function Ud(t,e,i,s,o,n,r,a,h,l){const d=zd();if(h)if("center"===l)Yd(d,{x:i/2,y:s/2},h);else switch(Vd(d,h),h){case 90:Nd(d,s,0);break;case 180:Nd(d,i,s);break;case 270:Nd(d,0,i)}Wd.x=e.x+o,Wd.y=e.y+n,Nd(d,Wd.x,Wd.y),r&&Xd(d,Wd,r,a),t.transform=d}const{get:qd,translate:Zd}=b,Kd=new dt,Jd={},Qd={};function $d(t,e,i,s){const{blendMode:o,changeful:n,sync:r}=i;o&&(t.blendMode=o),n&&(t.changeful=n),r&&(t.sync=r),t.data=tc(i,s,e)}function tc(t,e,i){let{width:s,height:o}=i;t.padding&&(e=Kd.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{opacity:n,mode:r,align:h,offset:l,scale:d,size:c,rotation:u,repeat:_,filters:p}=t,g=e.width===s&&e.height===o,f={mode:r},y="center"!==h&&(u||0)%180==90,m=y?o:s,v=y?s:o;let w,x,b=0,k=0;if(r&&"cover"!==r&&"fit"!==r)(d||c)&&(a.getScaleData(d,c,i,Qd),w=Qd.scaleX,x=Qd.scaleY);else if(!g||u){const t=e.width/m,i=e.height/v;w=x="fit"===r?Math.min(t,i):Math.max(t,i),b+=(e.width-s*w)/2,k+=(e.height-o*x)/2}if(h){const t={x:b,y:k,width:m,height:v};w&&(t.width*=w,t.height*=x),vt.toPoint(h,t,e,Jd,!0),b+=Jd.x,k+=Jd.y}switch(l&&(b+=l.x,k+=l.y),r){case"stretch":g||(s=e.width,o=e.height);break;case"normal":case"clip":(b||k||w||u)&&Gd(f,e,b,k,w,x,u);break;case"repeat":(!g||w||u)&&Ud(f,e,s,o,b,k,w,x,u,h),_||(f.repeat="repeat");break;default:w&&jd(f,e,b,k,w,x,u)}return f.transform||(e.x||e.y)&&(f.transform=qd(),Zd(f.transform,e.x,e.y)),w&&"stretch"!==r&&(f.scaleX=w,f.scaleY=x),f.width=s,f.height=o,n&&(f.opacity=n),p&&(f.filters=p),_&&(f.repeat="string"==typeof _?"x"===_?"repeat-x":"repeat-y":"repeat"),f}let ec,ic=new dt;const{isSame:sc}=rt;function oc(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||$d(o,s,i,n),!0}function nc(t,e){hc(t,tr.LOAD,e)}function rc(t,e){hc(t,tr.LOADED,e)}function ac(t,e,i){e.error=i,t.forceUpdate("surface"),hc(t,tr.ERROR,e)}function hc(t,e,i){t.hasEvent(e)&&t.emitEvent(new tr(e,i))}function lc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:dc,scale:cc,copy:uc}=b,{ceil:_c,abs:pc}=Math;function gc(e,i,s){let{scaleX:o,scaleY:n}=ko.patternLocked?e.__world:e.__nowWorld;const r=o+"-"+n+"-"+s;if(i.patternId===r||e.destroyed)return!1;{o=pc(o),n=pc(n);const{image:e,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:_,transform:p,repeat:g}=a;u&&(l=dc(),uc(l,p),cc(l,1/u,1/_),o*=u,n*=_),o*=s,n*=s,d*=o,c*=n;const f=d*c;if(!g&&f>t.image.maxCacheSize)return!1;let y=t.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;y>t&&(y=t)}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=dc(),p&&uc(l,p)),cc(l,1/o,1/n));const m=e.getCanvas(_c(d)||1,_c(c)||1,a.opacity,a.filters),v=e.getPattern(m,g||t.origin.noRepeat||"no-repeat",l,i);return i.style=v,i.patternId=r,!0}}const{abs:fc}=Math;const yc={image:function(t,e,i,s,o){let n,r;const a=ko.get(i);return ec&&i===ec.paint&&sc(s,ec.boxBounds)?n=ec.leafPaint:(n={type:i.type,image:a},ec=a.use>1?{leafPaint:n,paint:i,boxBounds:ic.set(s)}:null),(o||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(oc(t,e,i,a,n,s),o&&(nc(t,r),rc(t,r))):a.error?o&&ac(t,r,a.error):(o&&(lc(t,!0),nc(t,r)),n.loadId=a.load((()=>{lc(t,!1),t.destroyed||(oc(t,e,i,a,n,s)&&(a.hasOpacityPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),rc(t,r)),n.loadId=null}),(e=>{lc(t,!1),ac(t,r,e),n.loadId=null})),t.placeholderColor&&setTimeout((()=>{a.ready||a.isPlacehold||(a.isPlacehold=!0,t.forceUpdate("surface"))}),100)),n},checkImage:function(e,i,s,o){const{scaleX:n,scaleY:r}=ko.patternLocked?e.__world:e.__nowWorld,{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===n+"-"+r+"-"+a&&!ih.running)return!1;if(o)if(h.repeat)o=!1;else if(!(s.changeful||er.isResizing(e)||ih.running)){let{width:e,height:i}=h;e*=fc(n)*a,i*=fc(r)*a,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),o=e*i>t.image.maxCacheSize}return o?(function(t,e,i,s){e.save(),t.windingRule?e.clip(t.windingRule):e.clip(),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()}(e,i,s,h),!0):(!s.style||s.sync||ih.running?gc(e,s,a):s.patternTask||(s.patternTask=ko.patternTasker.add((()=>jt(this,void 0,void 0,(function*(){s.patternTask=null,i.bounds.hit(e.__nowWorld)&&gc(e,s,a),e.forceUpdate("surface")}))),300)),!1)},createPattern:gc,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:$d,getPatternData:tc,fillOrFitMode:jd,clipMode:Gd,repeatMode:Ud},{toPoint:mc}=ft,vc={},wc={};function xc(t,e,i){if(e){let s;for(let o=0,n=e.length;o<n;o++)s=e[o],"string"==typeof s?t.addColorStop(o/(n-1),qa.string(s,i)):t.addColorStop(s.offset,qa.string(s.color,i))}}const{getAngle:bc,getDistance:kc}=M,{get:Ec,rotateOfOuter:Bc,scaleOfOuter:Sc}=b,{toPoint:Rc}=ft,Cc={},Tc={};function Oc(t,e,i,s,o){let n;const{width:r,height:a}=t;if(r!==a||s){const t=bc(e,i);n=Ec(),o?(Sc(n,e,r/a*(s||1),1),Bc(n,e,t+90)):(Sc(n,e,1,r/a*(s||1)),Bc(n,e,t))}return n}const{getDistance:Lc}=M,{toPoint:Pc}=ft,Ac={},Mc={};const Dc={linearGradient:function(e,i){let{from:s,to:o,type:n,blendMode:r,opacity:a}=e;mc(s||"top",i,vc),mc(o||"bottom",i,wc);const h=t.canvas.createLinearGradient(vc.x,vc.y,wc.x,wc.y);xc(h,e.stops,a);const l={type:n,style:h};return r&&(l.blendMode=r),l},radialGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,blendMode:a,stretch:h}=e;Rc(s||"center",i,Cc),Rc(o||"bottom",i,Tc);const l=t.canvas.createRadialGradient(Cc.x,Cc.y,0,Cc.x,Cc.y,kc(Cc,Tc));xc(l,e.stops,r);const d={type:n,style:l},c=Oc(i,Cc,Tc,h,!0);return c&&(d.transform=c),a&&(d.blendMode=a),d},conicGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,blendMode:a,stretch:h}=e;Pc(s||"center",i,Ac),Pc(o||"bottom",i,Mc);const l=t.conicGradientSupport?t.canvas.createConicGradient(0,Ac.x,Ac.y):t.canvas.createRadialGradient(Ac.x,Ac.y,0,Ac.x,Ac.y,Lc(Ac,Mc));xc(l,e.stops,r);const d={type:n,style:l},c=Oc(i,Ac,Mc,h||1,t.conicGradientRotate90);return c&&(d.transform=c),a&&(d.blendMode=a),d},getTransform:Oc},{copy:Fc,toOffsetOutBounds:Ic}=rt,Wc={},zc={};function Yc(e,i,s,o){const{bounds:n,shapeBounds:r}=o;if(t.fullImageShadow){if(Fc(Wc,e.bounds),Wc.x+=i.x-r.x,Wc.y+=i.y-r.y,s){const{matrix:t}=o;Wc.x-=(n.x+(t?t.e:0)+n.width/2)*(s-1),Wc.y-=(n.y+(t?t.f:0)+n.height/2)*(s-1),Wc.width*=s,Wc.height*=s}e.copyWorld(o.canvas,e.bounds,Wc)}else s&&(Fc(Wc,i),Wc.x-=i.width/2*(s-1),Wc.y-=i.height/2*(s-1),Wc.width*=s,Wc.height*=s),e.copyWorld(o.canvas,r,s?Wc:i)}const{toOffsetOutBounds:Nc}=rt,Xc={};const Hc={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,_=e.getSameCanvas(),p=a.length-1;Ic(l,zc),a.forEach(((a,g)=>{_.setWorldShadow(zc.offsetX+a.x*c,zc.offsetY+a.y*u,a.blur*c,qa.string(a.color)),o=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,Yc(_,zc,o,i),s=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,n,"copy"),s=n),h?_.copyWorld(h,n,n,"destination-out"):_.copyWorld(i.canvas,d,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(_,s,n,a.blendMode):e.copyWorldToInner(_,s,r.renderBounds,a.blendMode),p&&g<p&&_.clearWorld(s,!0)})),_.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,_=e.getSameCanvas(),p=a.length-1;Nc(l,Xc),a.forEach(((a,g)=>{_.save(),_.setWorldShadow(Xc.offsetX+a.x*c,Xc.offsetY+a.y*u,a.blur*c),o=a.spread?1-2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,Yc(_,Xc,o,i),_.restore(),h?(_.copyWorld(_,l,n,"copy"),_.copyWorld(h,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,l,"source-out"),s=l),_.fillWorld(s,qa.string(a.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(_,s,n,a.blendMode):e.copyWorldToInner(_,s,r.renderBounds,a.blendMode),p&&g<p&&_.clearWorld(s,!0)})),_.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:Vc}=Dn;function jc(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),Uc(t,e,i,1)}(t,i,s,o);break;case"opacity-path":Uc(t,i,s,n);break;case"path":i.restore()}}function Gc(t){return t.getSameCanvas(!1,!0)}function Uc(t,e,i,s){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o),i.recycle(o)}Ph.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&&(jc(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=Gc(t))):(r="path",t.save()),i.__clip(o||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=Gc(t)),o||(o=Gc(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a)||Vc(i,e)||i.__render(o||t,e);jc(this,r,t,o,s,n)};const qc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Zc=qc+"_#~&*+\\=|≮≯≈≠=…",Kc=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 Jc(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Qc=Jc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),$c=Jc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),tu=Jc(qc),eu=Jc(Zc),iu=Jc("- —/~|┆·");var su;!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"}(su||(su={}));const{Letter:ou,Single:nu,Before:ru,After:au,Symbol:hu,Break:lu}=su;function du(t){return Qc[t]?ou:iu[t]?lu:$c[t]?ru:tu[t]?au:eu[t]?hu:Kc.test(t)?nu:ou}const cu={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 uu(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:_u}=cu,{Letter:pu,Single:gu,Before:fu,After:yu,Symbol:mu,Break:vu}=su;let wu,xu,bu,ku,Eu,Bu,Su,Ru,Cu,Tu,Ou,Lu,Pu,Au,Mu,Du,Fu,Iu=[];function Wu(t,e){Cu&&!Ru&&(Ru=Cu),wu.data.push({char:t,width:e}),bu+=e}function zu(){ku+=bu,wu.width=bu,xu.words.push(wu),wu={data:[]},bu=0}function Yu(){Au&&(Mu.paraNumber++,xu.paraStart=!0,Au=!1),Cu&&(xu.startCharSize=Ru,xu.endCharSize=Cu,Ru=0),xu.width=ku,Du.width?_u(xu):Fu&&Nu(),Iu.push(xu),xu={words:[]},ku=0}function Nu(){ku>(Mu.maxWidth||0)&&(Mu.maxWidth=ku)}const{top:Xu,right:Hu,bottom:Vu,left:ju}=_t;function Gu(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 Uu={getDrawData:function(e,i){"string"!=typeof e&&(e=String(e));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[ju],n-=l[Hu]+l[ju]):i.autoSizeAlign||(s=l[ju]),r?(o=l[Xu],r-=l[Xu]+l[Vu]):i.autoSizeAlign||(o=l[Xu]));const d={bounds:{x:s,y:o,width:n,height:r},rows:[],paraNumber:0,font:t.canvas.font=h};return function(e,i,s){Mu=e,Iu=e.rows,Du=e.bounds,Fu=!Du.width&&!s.autoSizeAlign;const{__letterSpacing:o,paraIndent:n,textCase:r}=s,{canvas:a}=t,{width:h,height:l}=Du;if(h||l||o||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;Au=!0,Ou=null,Ru=Su=Cu=bu=ku=0,wu={data:[]},xu={words:[]};for(let s=0,l=i.length;s<l;s++)Bu=i[s],"\n"===Bu?(bu&&zu(),xu.paraEnd=!0,Yu(),Au=!0):(Tu=du(Bu),Tu===pu&&"none"!==r&&(Bu=uu(Bu,r,!bu)),Su=a.measureText(Bu).width,o&&(o<0&&(Cu=Su),Su+=o),Lu=Tu===gu&&(Ou===gu||Ou===pu)||Ou===gu&&Tu!==yu,Pu=!(Tu!==fu&&Tu!==gu||Ou!==mu&&Ou!==yu),Eu=Au&&n?h-n:h,t&&h&&ku+bu+Su>Eu&&(e?(bu&&zu(),ku&&Yu()):(Pu||(Pu=Tu===pu&&Ou==yu),Lu||Pu||Tu===vu||Tu===fu||Tu===gu||bu+Su>Eu?(bu&&zu(),ku&&Yu()):ku&&Yu()))," "===Bu&&!0!==Au&&ku+bu===0||(Tu===vu?(" "===Bu&&bu&&zu(),Wu(Bu,Su),zu()):Lu||Pu?(bu&&zu(),Wu(Bu,Su)):Wu(Bu,Su)),Ou=Tu);bu&&zu(),ku&&Yu(),Iu.length>0&&(Iu[Iu.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Mu.paraNumber++,ku=a.measureText(t).width,Iu.push({x:n||0,text:t,width:ku,paraStart:!0}),Fu&&Nu()}))}(d,e,i),l&&function(t,e,i,s,o){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Gu(e,"x",t[ju]);break;case"right":Gu(e,"x",-t[Hu])}if(!o&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Gu(e,"y",t[Xu]);break;case"bottom":Gu(e,"y",-t[Vu])}}(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:_,y:p,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":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;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=_,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=p,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(e,i,s,o){if(!o)return;const{rows:n,overflow:r}=e;let{textOverflow:a}=i;if(n.splice(r),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.canvas.measureText(a).width:0,d=s+o-l;("none"===i.textWrap?n:[n[r-1]]).forEach((t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let s=i;s>-1&&(e=t.data[s],h=e.x+e.width,!(s===i&&h<d));s--){if(h<d&&" "!==e.char||!s){t.data.splice(s+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:a,x:h}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(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=qa.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 qu={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!qa.object)return t;t=qa.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+")"}};Object.assign(Ua,Uu),Object.assign(qa,qu),Object.assign(Ja,Id),Object.assign(Qa,yc),Object.assign($a,Dc),Object.assign(th,Hc),Object.assign(e,{interaction:(t,e,i,s)=>new kd(t,e,i,s),hitCanvas:(t,e)=>new ka(t,e),hitCanvasManager:()=>new dd}),Dh.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&Sa(0,wx)}catch(t){}function Zu(t){return t?t instanceof Array?t:[t]:[]}class Ku extends Jn{get list(){return Zu(this.value)}get oldList(){return Zu(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}Ku.BEFORE_SELECT="editor.before_select",Ku.SELECT="editor.select",Ku.BEFORE_HOVER="editor.before_hover",Ku.HOVER="editor.hover";class Ju extends Ku{constructor(t,e){super(t,e)}}Ju.BEFORE_MOVE="editor.before_move",Ju.MOVE="editor.move";class Qu extends Ku{constructor(t,e){super(t,e)}}Qu.BEFORE_SCALE="editor.before_scale",Qu.SCALE="editor.scale";class $u extends Ku{constructor(t,e){super(t,e)}}$u.BEFORE_ROTATE="editor.before_rotate",$u.ROTATE="editor.rotate";class t_ extends Ku{constructor(t,e){super(t,e)}}function e_(t){return(e,i)=>{const s="_"+i;Co(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);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?Ku.BEFORE_SELECT:Ku.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new Ku(s,{editor:this,value:e,oldValue:o}))}this[s]=e,t(this,o)}}})}}t_.BEFORE_SKEW="editor.before_skew",t_.SKEW="editor.skew";const{abs:i_}=Math,{copy:s_,scale:o_}=b,{setListWithFn:n_}=rt,{worldBounds:r_}=Dn,a_={a:1,b:0,c:0,d:1,e:0,f:0},h_={x:0,y:0,width:0,height:0};class l_ extends Lh{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){this.set(e),this.target=t,this.update()}update(){const{list:t}=this;t.length?(n_(h_,t,r_),this.set(h_),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=i_(d.scaleX),h=i_(d.scaleY);if(s_(a_,d),a_.half=r%2,i!==h){o_(a_,1/i,1/h),t.setWorld(a_,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(a_,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),o.strokeWidth=r/i_(d.scaleX);n&&("string"==typeof n?Ja.stroke(n,this,t):Ja.strokes(n,this,t)),a&&("string"==typeof a?Ja.fill(a,this,t):Ja.fills(a,this,t))}}o.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}Vt([e_((function(t){const e=t.target;t.list=e?e instanceof Array?e:[e]:[]}))],l_.prototype,"target",void 0);class d_ extends Ph{constructor(t){super(t),this.strokeArea=new Fh({strokeAlign:"center"}),this.fillArea=new Fh,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 c_={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:__,findByBounds:p_}=c_;class g_ extends Ph{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 l_,this.targetStroker=new l_,this.bounds=new dt,this.selectArea=new d_,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(){if(this.running){const{mergeConfig:t,list:e}=this.editor,{stroke:i,strokeWidth:s,selectedStyle:o}=t;this.targetStroker.setTarget(e,Object.assign({stroke:i,strokeWidth:Math.max(1,s/2)},o||{})),this.hoverStroker.target=null}}update(){this.hoverStroker.update(),this.targetStroker.update()}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 wa(p_(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&&!__(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new wa(this.editor.editBox.rect)};return __(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):__(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(t.shiftKey||i)}__listenEvents(){const{editor:t}=this;t.waitLeafer((()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_(Ku.HOVER,this.onHover,this),t.on_(Ku.SELECT,this.onSelect,this),e.on_(Dl.MOVE,this.onPointerMove,this),e.on_(Dl.BEFORE_DOWN,this.onBeforeDown,this),e.on_(Dl.TAP,this.onTap,this),e.on_(Wl.START,this.onDragStart,this,!0),e.on_(Wl.DRAG,this.onDrag,this),e.on_(Wl.END,this.onDragEnd,this),e.on_(Nl.MOVE,this.onAutoMove,this),e.on_([Vl.ZOOM,Nl.MOVE],(()=>{this.editor.hoverTarget=null}))]}))}__removeListenEvents(){this.__eventIds&&(this.off_(this.__eventIds),this.__eventIds.length=0)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:f_,top:y_,topRight:m_,right:v_,bottomRight:w_,bottom:x_,bottomLeft:b_,left:k_}=pt,{toPoint:E_}=ft,{within:B_}=a,S_={getScaleData(t,e,i,s,o,n,r,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:_,heightRange:p,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,k=a?v:x*u.width/y,E=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,R=(s.y+m)/m,C=(-s.x+y)/y;switch(i){case y_:c=B,h="bottom";break;case v_:d=S,h="left";break;case x_:c=R,h="top";break;case k_:d=C,h="right";break;case f_:c=B,d=C,h="bottom-right";break;case m_:c=B,d=S,h="bottom-left";break;case w_:c=R,d=S,h="top-left";break;case b_:c=R,d=C,h="top-right"}if(o)if("corner"===o&&i%2)o=!1;else{let t;switch(i){case y_:case x_:t=c;break;case k_:case v_:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const T=1!==d,O=1!==c;if(T&&(d/=k),O&&(c/=E),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(E_(n||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new dt(t.__localBoxBounds);if(i.scaleOf(t.getLocalPointByInner(l),d,c),!rt.includes(e,i)){const t=i.getIntersect(e),s=t.width/i.width,o=t.height/i.height;T&&(d*=s),O&&(c*=o)}}if(T&&_){const e=u.width*t.scaleX;d=B_(e*d,_)/e}if(O&&p){const e=u.height*t.scaleY;c=B_(e*c,p)/e}return T&&Math.abs(d*f.width)<1&&(d=(d<0?-1:1)/f.width),O&&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 f_:n="bottom-right";break;case m_:n="bottom-left";break;case w_:n="top-left";break;case b_:n="top-right";break;default:n="center"}return E_(o||n,t,r,!0),{origin:r,rotation:M.getRotation(s,r,i)}},getSkewData(t,e,i,s){let o,n,r={},a=0,h=0;switch(e){case y_:case f_:n={x:.5,y:0},o="bottom",a=1;break;case x_:case w_:n={x:.5,y:1},o="top",a=1;break;case k_:case b_:n={x:0,y:.5},o="right",h=1;break;case v_:case m_: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,E_(s||o,t,r,!0);const c=M.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 k_:t=v_;break;case f_:t=m_;break;case b_:t=w_;break;case v_:t=k_;break;case m_:t=f_;break;case w_:t=b_}if(i)switch(t){case y_:t=x_;break;case f_:t=b_;break;case m_:t=w_;break;case x_:t=y_;break;case b_:t=f_;break;case w_:t=m_}return t}},R_={};function C_(t,e){const{editBox:i}=t,s=i.enterPoint;if(!s||!t.editing||!i.visible)return;if("circle"===s.name)return;if("button"===s.pointType)return void(s.cursor||(s.cursor="pointer"));let{rotation:o}=i;const{resizeCursor:n,rotateCursor:r,skewCursor:h,resizeable:l,rotateable:d,skewable:c}=t.mergeConfig,{pointType:u}=s,{flippedX:_,flippedY:p}=i;let g=u.includes("resize");g&&d&&(e.metaKey||e.ctrlKey||!l)&&(g=!1);const f=c&&!g&&("resize-line"===s.name||"skew"===u)?h:g?n:r;o+=45*(S_.getFlipDirection(s.direction,_,p)+1),o=2*Math.round(a.formatRotation(o,!0)/2);const{url:y,x:m,y:v}=f,w=y+o;R_[w]?s.cursor=R_[w]:R_[w]=s.cursor={url:O_(y,o),x:m,y:v}}function T_(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.editBox.rect.cursor=i?e:void 0}function O_(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class L_ extends Hh{}const P_=["top","right","bottom","left"],A_=void 0;class M_ extends Ph{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}constructor(t){super(),this.view=new Ph,this.rect=new Hh({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new L_({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Ph({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,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 L_({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),n.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new L_({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new L_({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{mergeConfig:t,element:e,single:i}=this.editor,{rect:s,circle:o,resizePoints:n}=this,{stroke:r,strokeWidth:a}=t,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])),t%2||(d.rotation=t/2*90);o.set(this.getPointStyle(t.circle||t.rotatePoint||h[0])),s.set(Object.assign({stroke:r,strokeWidth:a,editConfig:A_},t.rect||{})),s.hittable=!i,s.syncEventer=i&&this.editor,i&&(e.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:e}])}update(t){const{rect:e,circle:i,buttons:s,resizePoints:o,rotatePoints:n,resizeLines:r,editor:a}=this,{mergeConfig:h,element:l,multiple:d,editMask:c}=a,{middlePoint:u,resizeable:_,rotateable:p,hideOnSmall:g,editBox:f,mask:y}=h;if(this.visible=!l.locked,c.visible=!!y||0,this.view.worldOpacity){const{width:a,height:l}=t,c="number"==typeof g?g:10,y=f&&!(g&&a<c&&l<c);let m,v,w,x={};for(let e=0;e<8;e++)ft.toPoint(ft.directionData[e],t,x),v=o[e],m=n[e],w=r[Math.floor(e/2)],v.set(x),m.set(x),w.set(x),v.visible=w.visible=y&&!(!_&&!p),m.visible=y&&p&&_&&!h.rotatePoint,e%2&&(v.visible=m.visible=y&&!!u,(e+1)/2%2?(w.width=a,g&&2*v.width>a&&(v.visible=!1)):(w.height=l,v.rotation=90,g&&2*v.width>l&&(v.visible=!1)));i.visible=y&&p&&!(!h.circle&&!h.rotatePoint),i.visible&&this.layoutCircle(h),e.path&&(e.path=null),e.set(Object.assign(Object.assign({},t),{visible:!!d||f})),s.visible=y&&s.children.length>0||0,s.visible&&this.layoutButtons(h)}else e.set(t)}layoutCircle(t){const{circleDirection:e,circleMargin:i,buttonsMargin:s,buttonsDirection:o,middlePoint:n}=t,r=P_.indexOf(e||(this.buttons.children.length&&"bottom"===o?"top":"bottom"));this.setButtonPosition(this.circle,r,i||s,!!n)}layoutButtons(t){const{buttons:e}=this,{buttonsDirection:i,buttonsFixed:s,buttonsMargin:o,middlePoint:n}=t,{flippedX:r,flippedY:a}=this;let h=P_.indexOf(i);(h%2&&r||(h+1)%2&&a)&&s&&(h=(h+2)%4);const l=s?S_.getRotateDirection(h,this.flippedOne?this.rotation:-this.rotation,4):h;this.setButtonPosition(e,l,o,!!n),s&&(e.rotation=90*(l-h)),e.scaleX=r?-1:1,e.scaleY=a?-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)}unload(){this.visible=!1}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:o,pointRadius:n}=this.editor.mergeConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:o,height:o,cornerRadius:n,offsetX:0,offsetY:0,editConfig:A_};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.editor.mergeConfig;return t instanceof Array?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.editor.mergeConfig;return t instanceof Array?t:t?[t]:this.getPointsStyle()}onSelect(t){1===t.oldList.length&&(t.oldList[0].syncEventer=null,this.app&&(this.app.interaction.bottomList=null))}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{editor:s,dragStartData:o}=this,{element:n}=s;"rect"===e.name&&(this.moving=!0,s.opacity=s.mergeConfig.hideOnMove?0:1),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")&&(er.resizingKeys=s.leafList.keys)}onDragEnd(t){this.dragging=!1,this.dragPoint=null,this.moving=!1;const{name:e,pointType:i}=t.current;"rect"===e&&(this.editor.opacity=1),i&&i.includes("resize")&&(er.resizingKeys=null)}onDrag(t){const{editor:e}=this,{pointType:i}=this.enterPoint=t.current;i.includes("rotate")||t.metaKey||t.ctrlKey||!e.mergeConfig.resizeable?(e.onRotate(t),"resize-rotate"===i&&e.onScale(t)):"resize"===i&&e.onScale(t),"skew"===i&&e.onSkew(t),C_(e,t)}onArrow(t){const{editor:e}=this;if(e.editing&&e.mergeConfig.keyEvent){let i=0,s=0;const o=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=o;break;case"ArrowUp":s=-o;break;case"ArrowLeft":i=-o;break;case"ArrowRight":i=o}(i||s)&&e.move(i,s)}}onDoubleTap(t){"double"===this.editor.mergeConfig.openInner&&this.openInner(t)}onLongPress(t){"long"===this.editor.mergeConfig.openInner&&this.openInner(t)}openInner(t){const{editor:e}=this;if(e.single){const{element:i}=e;if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find((t=>t.editable&&t instanceof Rl))||t.find((t=>t instanceof Rl));if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){const{editor:s}=this;t.direction=i,t.pointType=e,t.on_(Wl.START,this.onDragStart,this),t.on_(Wl.DRAG,this.onDrag,this),t.on_(Wl.END,this.onDragEnd,this),t.on_(Dl.LEAVE,(()=>this.enterPoint=null)),"circle"!==t.name&&t.on_(Dl.ENTER,(e=>{this.enterPoint=t,C_(s,e)}))}__listenEvents(){const{rect:t,editor:e}=this;this.__eventIds=[e.on_(Ku.SELECT,this.onSelect,this),t.on_(Wl.START,this.onDragStart,this),t.on_(Wl.DRAG,e.onMove,e),t.on_(Wl.END,this.onDragEnd,this),t.on_(Dl.ENTER,(()=>T_(e))),t.on_(Dl.DOUBLE_TAP,this.onDoubleTap,this),t.on_(Dl.LONG_PRESS,this.onLongPress,this)]}__removeListenEvents(){this.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const D_={x:0,y:0,width:1e5,height:1e5};class F_ extends Lh{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,D_),Object.assign(this.__world,D_)}__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"),i.list.forEach((i=>{i.__renderShape(t,e);const{__box:s,parent:o}=i;((i=s)||(i=o)&&o.textBox)&&i.__renderShape(t,e)})),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const I_='\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"/>',W_={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${I_}\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${I_}\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${I_}\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},z_=new dt;function Y_(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer.zoomLayer;e.safeChange((()=>{z_.setListWithFn(i,(t=>t.getBounds("box","page"))),0===z_.width&&(z_.width=.1),0===z_.height&&(z_.height=.1),e.reset(z_.get())})),s.add(e)}const N_=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),X_=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),H_={group(t,e,i){t.sort(X_);const{app:s,parent:o}=t[0];let n;n=i&&i.add?i:new Ph(i),o.addAt(n,o.children.indexOf(t[0])),t.sort(N_);const r=new N(e.worldTransform);return r.divideParent(o.worldTransform),n.setTransform(r),n.editable=!0,n.hitChildren=!1,s.lockLayout(),t.forEach((t=>t.dropTo(n))),s.unlockLayout(),n},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(N_),t.forEach((t=>{t.parent&&t.parent.add(t)}))},toBottom(t){t.sort(X_),t.forEach((t=>{t.parent&&t.parent.addAt(t,0)}))}},V_=bt.get("EditToolCreator");function j_(){return t=>{U_.register(t)}}const G_=j_,U_={list:{},register(t){const{tag:e}=t.prototype;q_[e]&&V_.repeat(e),q_[e]=t},get:(t,e)=>new q_[t](e)},{list:q_}=U_;class Z_ extends Ku{constructor(t,e){super(t,e)}}Z_.BEFORE_OPEN="innerEditor.before_open",Z_.OPEN="innerEditor.open",Z_.BEFORE_CLOSE="innerEditor.before_close",Z_.CLOSE="innerEditor.close";class K_ extends Ku{constructor(t,e){super(t,e)}}K_.BEFORE_GROUP="editor.before_group",K_.GROUP="editor.group",K_.BEFORE_UNGROUP="editor.before_ungroup",K_.UNGROUP="editor.ungroup",K_.BEFORE_OPEN="editor.before_open_group",K_.OPEN="editor.open_group",K_.BEFORE_CLOSE="editor.before_close_group",K_.CLOSE="editor.close_group";const{updateMatrix:J_}=Rn,Q_={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},$_="top-left";class tp extends Fh{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on($n.CHANGE,(e=>{if(this.checkChange&&Q_[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,J_(this.parent),J_(this);const a=new N(this.__world);switch(r[i]=s,this.__layout.rotationChange(),J_(this),this.changedTransform=new N(this.__world).divide(a),i){case"x":t.move(n,0);break;case"y":t.move(0,n);break;case"rotation":t.rotateOf($_,n);break;case"scaleX":t.scaleOf($_,n,1);break;case"scaleY":t.scaleOf($_,1,n);break;case"skewX":t.skewOf($_,n,0);break;case"skewY":t.skewOf($_,0,n)}this.canChange=!0}}))}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class ep extends Ph{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 dragging(){return this.editBox.dragging}get moving(){return this.editBox.moving}get dragPoint(){return this.editBox.dragPoint}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}constructor(t,e){super(e),this.leafList=new wa,this.openedGroupList=new wa,this.simulateTarget=new tp(this),this.editBox=new M_(this),this.editToolList={},this.selector=new g_(this),this.editMask=new F_(this),this.targetEventIds=[];let i=It.clone(W_);t&&(i=It.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Tt.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&&Y_(this),this.update()}updateEditTool(){const t=this.editTool;if(t&&(this.editBox.unload(),t.unload(),this.editTool=null),this.editing){const t=this.single?this.list[0].editOuter:"EditTool";this.editTool=this.editToolList[t]=this.editToolList[t]||U_.get(t,this),this.editBox.load(),this.editTool.load()}}getEditSize(t){return this.mergeConfig.editSize}onMove(t){if(t instanceof Nl){if("drag"!==t.moveType){const{moveable:e,resizeable:i}=this.mergeConfig,s=t.getLocalMove(this.element);"move"===e?(t.stop(),this.move(s.x,s.y)):"zoom"===i&&t.stop()}}else{const e={x:t.totalX,y:t.totalY};t.shiftKey&&(Math.abs(e.x)>Math.abs(e.y)?e.y=0:e.x=0),this.move(Wl.getValidMove(this.element,this.editBox.dragStartData.point,e))}}onScale(t){const{element:e}=this;let{around:i,lockRatio:s,resizeable:o,flipable:n,editSize:r}=this.mergeConfig;if(t instanceof Vl)"zoom"===o&&(t.stop(),this.scaleOf(e.getBoxPoint(t),t.scale,t.scale));else{const{direction:o}=t.current;(t.shiftKey||e.lockRatio)&&(s=!0);const a=S_.getScaleData(e,this.editBox.dragStartData.bounds,o,t.getInnerTotal(e),s,S_.getAround(i,t.altKey),n,this.multiple||"scale"===r);this.editTool.onScaleWithDrag?(a.drag=t,this.scaleWithDrag(a)):this.scaleOf(a.origin,a.scaleX,a.scaleY)}}onRotate(t){const{skewable:e,rotateable:i,around:s,rotateGap:o}=this.mergeConfig,{direction:n,name:r}=t.current;if(e&&"resize-line"===r)return this.onSkew(t);const{element:h}=this,{dragStartData:l}=this.editBox;let d,c;if(t instanceof Xl){if("rotate"!==i)return;t.stop(),c=t.rotation,d=h.getBoxPoint(t),h.scaleX*h.scaleY<0&&(c=-c)}else{const e=S_.getRotateData(h.boxBounds,n,t.getBoxPoint(h),h.getBoxPoint(l),t.shiftKey?null:h.around||h.origin||s||"center");c=e.rotation,d=e.origin}h.scaleX*h.scaleY<0&&(c=-c),t instanceof Wl&&(c=l.rotation+c-h.rotation),c=a.float(a.getGapRotation(c,o,h.rotation),2),c&&this.rotateOf(d,c)}onSkew(t){const{element:e}=this,{around:i}=this.mergeConfig,{origin:s,skewX:o,skewY:n}=S_.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),S_.getAround(i,t.altKey));(o||n)&&this.skewOf(s,o,n)}move(t,e=0){if(!this.checkTransform("moveable"))return;"object"==typeof t&&(e=t.y,t=t.x);const{element:i}=this,{beforeMove:s}=this.mergeConfig;if(s){const o=s({target:i,x:t,y:e});if("object"==typeof o)t=o.x,e=o.y;else if(!1===o)return}const o=i.getWorldPointByLocal({x:t,y:e},null,!0);this.multiple&&i.safeChange((()=>i.move(t,e)));const n={target:i,editor:this,moveX:o.x,moveY:o.y};this.emitEvent(new Ju(Ju.BEFORE_MOVE,n));const r=new Ju(Ju.MOVE,n);this.editTool.onMove(r),this.emitEvent(r)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{element:e}=this,{beforeScale:i}=this.mergeConfig;if(i){const{origin:s,scaleX:o,scaleY:n,drag:r}=t;if(!1===i({target:e,drag:r,origin:s,scaleX:o,scaleY:n}))return}t=Object.assign(Object.assign({},t),{target:e,editor:this,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new Qu(Qu.BEFORE_SCALE,t));const s=new Qu(Qu.SCALE,t);this.editTool.onScaleWithDrag(s),this.emitEvent(s)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{element:o}=this,{beforeScale:n}=this.mergeConfig;if(n){const s=n({target:o,origin:t,scaleX:e,scaleY:i});if("object"==typeof s)e=s.scaleX,i=s.scaleY;else if(!1===s)return}const r=this.getWorldOrigin(t),a=this.multiple&&this.getChangedTransform((()=>o.safeChange((()=>o.scaleOf(t,e,i))))),h={target:o,editor:this,worldOrigin:r,scaleX:e,scaleY:i,transform:a};this.emitEvent(new Qu(Qu.BEFORE_SCALE,h));const l=new Qu(Qu.SCALE,h);this.editTool.onScale(l),this.emitEvent(l)}flip(t){if(!this.checkTransform("resizeable"))return;const{element:e}=this,i=this.getWorldOrigin("center"),s=this.multiple?this.getChangedTransform((()=>e.safeChange((()=>e.flip(t))))):new N(Rn.getFlipTransform(e,t)),o={target:e,editor:this,worldOrigin:i,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:s};this.emitEvent(new Qu(Qu.BEFORE_SCALE,o));const n=new Qu(Qu.SCALE,o);this.editTool.onScale(n),this.emitEvent(n)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{element:i}=this,{beforeRotate:s}=this.mergeConfig;if(s){const o=s({target:i,origin:t,rotation:e});if("number"==typeof o)e=o;else if(!1===o)return}const o=this.getWorldOrigin(t),n=this.multiple&&this.getChangedTransform((()=>i.safeChange((()=>i.rotateOf(t,e))))),r={target:i,editor:this,worldOrigin:o,rotation:e,transform:n};this.emitEvent(new $u($u.BEFORE_ROTATE,r));const a=new $u($u.ROTATE,r);this.editTool.onRotate(a),this.emitEvent(a)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{element:o}=this,{beforeSkew:n}=this.mergeConfig;if(n){const s=n({target:o,origin:t,skewX:e,skewY:i});if("object"==typeof s)e=s.skewX,i=s.skewY;else if(!1===s)return}const r=this.getWorldOrigin(t),a=this.multiple&&this.getChangedTransform((()=>o.safeChange((()=>o.skewOf(t,e,i))))),h={target:o,editor:this,worldOrigin:r,skewX:e,skewY:i,transform:a};this.emitEvent(new t_(t_.BEFORE_SKEW,h));const l=new t_(t_.SKEW,h);this.editTool.onSkew(l),this.emitEvent(l)}checkTransform(t){return this.element&&!this.element.locked&&this.mergeConfig[t]}getWorldOrigin(t){return this.element.getWorldPoint(Rn.getInnerOrigin(this.element,t))}getChangedTransform(t){const{element:e}=this;if(this.multiple&&!e.canChange)return e.changedTransform;const i=new N(e.worldTransform);return t(),new N(e.worldTransform).divide(i)}group(t){return this.multiple&&(this.emitGroupEvent(K_.BEFORE_GROUP),this.target=H_.group(this.list,this.element,t),this.emitGroupEvent(K_.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach((t=>t.isBranch&&this.emitGroupEvent(K_.BEFORE_UNGROUP,t))),this.target=H_.ungroup(t),t.forEach((t=>t.isBranch&&this.emitGroupEvent(K_.UNGROUP,t)))),this.list}openGroup(t){this.emitGroupEvent(K_.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(K_.OPEN,t)}closeGroup(t){this.emitGroupEvent(K_.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(K_.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach((t=>this.list.every((e=>!Rn.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 K_(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e){if(t&&e&&(this.target=t),this.single){const e=t||this.element,i=e.editInner;i&&U_.list[i]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[i]||U_.get(i,this),this.innerEditor.editTarget=e,this.emitInnerEvent(Z_.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Z_.OPEN))}}closeInnerEditor(){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Z_.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Z_.CLOSE),this.editTool.load(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Z_(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&&(H_.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(H_.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()}onKey(t){C_(this,t)}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,editBox:i,editMask:s}=this;this.targetEventIds=[e.on_(or.START,this.onRenderStart,this),t.on_(or.CHILD_START,this.onAppRenderStart,this),t.on_(Nl.BEFORE_MOVE,this.onMove,this,!0),t.on_(Vl.BEFORE_ZOOM,this.onScale,this,!0),t.on_(Xl.BEFORE_ROTATE,this.onRotate,this,!0),t.on_([jl.HOLD,jl.UP],this.onKey,this),t.on_(jl.DOWN,i.onArrow,i)],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),t.length=0,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())}}Vt([(t,e)=>{Co(t,e,{get(){const{config:t,element:e,dragPoint:i}=this,s=Object.assign({},t);return e&&e.editConfig&&Object.assign(s,e.editConfig),i&&(i.editConfig&&Object.assign(s,i.editConfig),"font-size"===s.editSize&&(s.lockRatio=!0),"resize-rotate"===i.pointType&&(s.around||(s.around="center"),Xt(s.lockRatio)&&(s.lockRatio=!0))),this.mergedConfig=s}})}],ep.prototype,"mergeConfig",void 0),Vt([e_((function(t,e){t.emitEvent(new Ku(Ku.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))}))],ep.prototype,"hoverTarget",void 0),Vt([e_((function(t,e){const{target:i}=t;i?(t.leafList=i instanceof wa?i:new wa(i),t.multiple&&Y_(t)):(t.simulateTarget.remove(),t.leafList.reset(),t.closeInnerEditor()),t.emitEvent(new Ku(Ku.SELECT,{editor:t,value:i,oldValue:e})),t.checkOpenedGroups(),t.editing?t.waitLeafer((()=>{T_(t),t.updateEditTool(),t.update(),t.listenTargetEvents()})):(t.updateEditTool(),t.removeTargetEvents())}))],ep.prototype,"target",void 0);class ip{static registerInnerEditor(){U_.register(this)}get tag(){return"InnerEditor"}get editBox(){return this.editor.editBox}constructor(t){this.editor=t,this.create()}onCreate(){}create(){this.view=new Ph,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&(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)}}let sp=class extends ip{static registerEditTool(){U_.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(){const{editor:t,editBox:e}=this,{x:i,y:s,scaleX:o,scaleY:n,rotation:r,skewX:a,skewY:h,width:l,height:d}=t.element.getLayoutBounds("box",t,!0);e.set({x:i,y:s,scaleX:o,scaleY:n,rotation:r,skewX:a,skewY:h}),e.update({x:0,y:0,width:l,height:d}),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};sp=Vt([j_()],sp);const{left:op,right:np}=pt,{move:rp,copy:ap,toNumberPoints:hp}=M;let lp=class extends sp{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===op;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=hp(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?(rp(t,n,r),s&&rp(e,-n,-r)):(s&&rp(t,-n,-r),rp(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),ap(s[7],i),ap(e[7],i),ap(s[3],a),ap(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===op||t===np,s[t].visible=a,e[t].visible=!r&&a}};lp=Vt([j_()],lp);const{M:dp,L:cp,C:up,Q:_p,Z:pp,N:gp,D:fp,X:yp,G:mp,F:vp,O:wp,P:xp,U:bp}=ne,kp={scale(t,e,i){if(!t)return;let s,o=0,n=t.length;for(;o<n;)switch(s=t[o],s){case dp:case cp:Ep(t,e,i,o,1),o+=3;break;case up:Ep(t,e,i,o,3),o+=7;break;case _p:Ep(t,e,i,o,2),o+=5;break;case pp:o+=1;break;case gp:Ep(t,e,i,o,2),o+=5;break;case fp:Ep(t,e,i,o,2),o+=9;break;case yp:Ep(t,e,i,o,2),o+=6;break;case mp:Ep(t,e,i,o,2),o+=9;break;case vp:Ep(t,e,i,o,2),o+=5;break;case wp:t[o]=mp,t.splice(o+4,0,t[o+3],0),Ep(t,e,i,o,2),o+=9,n+=2;break;case xp:t[o]=vp,t.splice(o+4,0,t[o+3]),Ep(t,e,i,o,2),o+=5,n+=1;break;case bp:Ep(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:Ep}=kp,Bp=b.get(),{topLeft:Sp,top:Rp,topRight:Cp,right:Tp,bottom:Op,left:Lp}=pt;function Pp(t,e,i){t.pathInputed?Mp(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function Ap(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 Rp:case Op:o=i,n.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case Lp:case Tp:n.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case Sp:case Cp: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 Mp(t,e,i){kp.scale(t.__.path,e,i),t.path=t.__.path}function Dp(t,e,i){const{points:s}=t;"object"==typeof s[0]?s.forEach((t=>{t.x*=e,t.y*=i})):kp.scalePoints(s,e,i),t.points=s}function Fp(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)Bp.a=e,Bp.d=i,s[t].transform(Bp,!0)}const Ip=la.prototype;function Wp(t,e,i){zp(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(Nl.BEFORE_MOVE,(e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY))})),t.on_(Vl.BEFORE_ZOOM,(e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)})))}function zp(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&It.assign(i,e),It.assign(t.config,i,t.userConfig)}Ip.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))},Ip.__scaleResize=function(t,e){Pp(this,t,e)},Ip.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},Ip.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Rl.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?Ap(this,t,e,n&&n.direction):Pp(this,t,e)},Cl.prototype.__scaleResize=function(t,e){Mp(this,t,e)},sl.prototype.__scaleResize=function(t,e){this.pathInputed?Mp(this,t,e):this.points?Dp(this,t,e):this.width*=t},ul.prototype.__scaleResize=function(t,e){this.pathInputed?Mp(this,t,e):this.points?Dp(this,t,e):Pp(this,t,e)},Ph.prototype.__scaleResize=function(t,e){Fp(this,t,e)},Hh.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||Pp(this,t,e),i&&Fp(this,t,e)},Tt.add("resize"),Tt.add("editor","resize"),e.editor=function(t){return new ep(t)},Hh.addAttr("textBox",!1,Ao),Lh.addAttr("editConfig",void 0,Ao),Lh.addAttr("editOuter",(t=>t.__.__isLinePath?"LineEditTool":"EditTool"),Ao),Lh.addAttr("editInner","PathEditor",Ao),Ph.addAttr("editInner","",Ao),Rl.addAttr("editInner","TextEditor",Ao),Lh.setEditConfig=function(t){this.changeAttr("editConfig",t)},Lh.setEditOuter=function(t){this.changeAttr("editOuter",t)},Lh.setEditInner=function(t){this.changeAttr("editInner",t)};const Yp=bt.get("LeaferTypeCreator"),Np={list:{},register(t,e){Xp[t]&&Yp.repeat(t),Xp[t]=e},run(t,e){const i=Xp[t];i&&i(e)}},{list:Xp,register:Hp}=Np;Hp("viewport",Wp),Hp("custom",(function(t){Wp(t,null,!0)})),Hp("design",(function(t){Wp(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})})),Hp("document",(function(t){Wp(t,{zoom:{min:1},move:{scroll:"limit"}})}));const Vp={getData(t){const e=t[0],i=t[1],s=M.getCenter(e.from,i.from),o=M.getCenter(e.to,i.to),n={x:o.x-s.x,y:o.y-s.y},r=M.getDistance(e.from,i.from);return{move:n,scale:M.getDistance(e.to,i.to)/r,rotation:M.getRotation(e.from,i.from,e.to,i.to),center:o}}},jp={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(e,i){let s,o=1,{zoomMode:n,zoomSpeed:r}=i;const h=e.deltaY||e.deltaX;if(n?(s="mouse"===n||!e.deltaX&&(t.intWheelDeltaY?Math.abs(h)>17:Math.ceil(h)!==h),(e.shiftKey||e.metaKey||e.ctrlKey)&&(s=!0)):s=!e.shiftKey&&(e.metaKey||e.ctrlKey),s){r=a.within(r,0,1);o=1-h/(4*(e.deltaY?i.delta.y:i.delta.x))*r,o<.5&&(o=.5),o>=1.5&&(o=1.5)}return o}};class Gp{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(Nl.START,this.moveData)),t.path=this.moveData.path,e.emit(Nl.BEFORE_MOVE,t),e.emit(Nl.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(Vl.START,this.zoomData)),t.path=this.zoomData.path,e.emit(Vl.BEFORE_ZOOM,t),e.emit(Vl.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(Xl.START,this.rotateData)),t.path=this.rotateData.path,e.emit(Xl.BEFORE_ROTATE,t),e.emit(Xl.ROTATE,t),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:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(Nl.END,e),i&&t.emit(Vl.END,i),s&&t.emit(Xl.END,s),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const Up=Dh.prototype,qp=new dt;function Zp(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Kp(t,e){return Object.assign(Object.assign({},e),{scale:t})}Up.initType=function(t){Np.run(t,this)},Up.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}=qp.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}},Up.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 Jp=hd.prototype;Jp.createTransformer=function(){this.transformer=new Gp(this)},Jp.move=function(t){this.transformer.move(t)},Jp.zoom=function(t){this.transformer.zoom(t)},Jp.rotate=function(t){this.transformer.rotate(t)},Jp.transformEnd=function(){this.transformer.transformEnd()},Jp.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):jp.getScale(t,e);if(1!==n)this.zoom(Kp(n,t));else{const s=e.getMove?e.getMove(t,e):jp.getMove(t,e);i.snap&&M.round(s),this.move(Zp(s,t))}},Jp.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:o,center:n}=Vp.getData(e);Object.assign(t,n),this.pointerWaitCancel(),this.rotate(function(t,e){return Object.assign(Object.assign({},e),{rotation:t})}(s,t)),this.zoom(Kp(o,t)),this.move(Zp(i,t))};const Qp=Ql.prototype,{abs:$p}=Math;function tg(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}Qp.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,o=$p(i),n=$p(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),M.move(t,i*e,s*e),this.drag(t),this.animate((()=>{this.dragEnd(t,1)}))}return a},Qp.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Qp.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Qp.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=rt.maxX(r),d=rt.maxY(r),c=t.x<a?o:l<t.x?-o:0,u=t.y<h?o:d<t.y?-o:0;let _=0,p=0;this.autoMoveTimer=setInterval((()=>{_+=c,p+=u,M.move(i,c,u),M.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:_,totalY:p,moveType:"drag"})),e.pointerMoveReal(t)}),10)},Qp.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Tt.add("viewport"),Tt.add("view"),Dh.prototype.zoom=function(t,e,i,s){this.killAnimate();const{zoomLayer:o}=this,n=this.canvas.bounds.clone().shrink(void 0!==e?e:30),r=new dt,a={x:n.x+n.width/2,y:n.y+n.height/2};let h;const{x:l,y:d,scaleX:c,scaleY:u}=o.__;if("string"==typeof t)switch(t){case"in":h=tg(c,"in");break;case"out":h=tg(c,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new dt(this.boxBounds)).height=0;break;case"fit-height":(t=new dt(this.boxBounds)).width=0}else"number"==typeof t&&(h=t/c);if(h)h=this.getValidScale(h),o.scaleOfWorld(a,h,h,!1,s);else if("object"==typeof t){const e={x:l,y:d,scaleX:c,scaleY:u},a=t instanceof Array;if(a||t.tag){const e=a?t:[t];r.setListWithFn(e,Dn.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,n);r.set(o.getWorldBounds(e))}const{width:_,height:p}=r;let g=n.x-r.x,f=n.y-r.y;return i?(g+=Math.max((n.width-_)/2,0),f+=Math.max((n.height-p)/2,0)):(h=this.getValidScale(Math.min(n.width/_,n.height/p)),g+=(n.width-_*h)/2,f+=(n.height-p*h)/2,M.scaleOf(e,r,h),r.scaleOf(r,h),e.scaleX*=h,e.scaleY*=h),M.move(e,g,f),r.move(g,f),o.set(e,s),r}return o.worldBoxBounds};class eg extends Ph{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&&It.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;"string"==typeof t?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new Hh,this.scrollYBar=new Hh),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{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 dt(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,_=l<1,{scrollXBar:p,scrollYBar:g}=this,{x:f,y:y,width:m,height:v}=r.shrink([2,_?g.width+6:2,u?p.height+6:2,2]);p.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:_})}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:t,scrollYBar:e}=this;this.__eventIds=[t.on_(Wl.DRAG,this.onDrag,this),e.on_(Wl.DRAG,this.onDrag,this),t.on_(Wl.END,this.onDragEnd,this),e.on_(Wl.END,this.onDragEnd,this),this.target.on_(or.BEFORE,(()=>this.update(!0))),this.target.leafer.on_(er.RESIZE,(()=>this.update()))]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}Tt.add("scroll");class ig extends gh{}function sg(t){return Oo(t,(t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,Vo(this)}}})))}let og=class extends sl{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}};Vt([on(ig)],og.prototype,"__",void 0),Vt([sg("angle")],og.prototype,"endArrow",void 0),og=Vt([pn()],og);const{M:ng,L:rg,C:ag,Q:hg,O:lg}=ne,{rotate:dg,copyFrom:cg,scale:ug}=M,_g={},pg={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 ng:case rg:gg(t,l+1,e,i,s,o,n,r),l+=3;break;case ag:for(h=1;h<6;h+=2)gg(t,l+h,e,i,s,o,n,r);l+=7;break;case hg:for(h=1;h<4;h+=2)gg(t,l+h,e,i,s,o,n,r);l+=5;break;case lg: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){pg.layout(t,0,0,1,1,e,i)}};function gg(t,e,i,s,o,n,r,a){cg(_g,t[e],t[e+1]),r&&dg(_g,r,a),o&&ug(_g,o,n),t[e]=i+_g.x,t[e+1]=s+_g.y}const{layout:fg,rotate:yg}=pg,{getAngle:mg}=M,vg={x:-.5},wg={connect:vg,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},xg={connect:vg,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},bg={connect:vg,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]},kg={connect:vg,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]},Eg={offset:vg,path:[...bg.path],dashPath:[1,-2.5,0,2,-1,0]};yg(Eg.path,180,{x:-1.5,y:0});const Bg={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},Sg={connect:{x:.5},path:[...Bg.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Rg={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]},Cg={path:[...Rg.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Tg=It.clone(Rg),Og=It.clone(Cg);yg(Tg.path,45),yg(Og.path,45);const Lg={angle:wg,"angle-side":xg,arrow:kg,triangle:bg,"triangle-flip":Eg,circle:Sg,"circle-line":Bg,square:Cg,"square-line":Rg,diamond:Og,"diamond-line":Tg,mark:{offset:vg,path:[1,0,-2,2,0,2]}};function Pg(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:Lg[e];let _=d?d.x:0,p=l?l.x:0;const g=[...c];return r&&u&&g.push(...u),"none"!==a&&(_-=.5),l&&("round"===h&&l.roundJoin?p+=l.roundJoin:"bevel"===h&&l.bevelJoin&&(p+=l.bevelJoin)),p&&fg(g,p,0),fg(g,s.x,s.y,o,o,mg(i,s)),n.x=(_+p)*o,g}const{M:Ag,L:Mg,C:Dg,Q:Fg,Z:Ig,N:Wg,D:zg,X:Yg,G:Ng,F:Xg,O:Hg,P:Vg,U:jg}=ne,{copy:Gg,copyFrom:Ug,getDistancePoint:qg}=M,Zg={},Kg={},Jg={},Qg={},$g={},tf={list:Lg,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 Ag:case Mg:(d<2||h+6>=l)&&(Ug($g,r[h+1],r[h+2]),!d&&c&&Gg(Kg,$g)),h+=3;break;case Dg:1!==d&&h+7!==l||ef(r,Qg,$g,h+3),h+=7;break;case Fg:1!==d&&h+5!==l||ef(r,Qg,$g,h+1),h+=5;break;case Ig:return;case Wg:h+=5;break;case zg:h+=9;break;case Yg:h+=6;break;case Ng:h+=9;break;case Xg:h+=5;break;case Hg:h+=7;break;case Vg:h+=4;break;case jg:1!==d&&h+6!==l||ef(r,Qg,$g,h+1),h+=6}if(d++,1===d&&a!==Ag)return;if(2===d&&c&&Gg(Jg,a===Mg?$g:Qg),h===l){const l=t.__.__pathForRender=e?[...r]:r,d=t.__.__pathForArrow=[];if(c){const e=Pg(t,i,Jg,Kg,o,Zg,!!n);n?d.push(...e):l.push(...e),Zg.x&&(qg(Kg,Jg,-Zg.x,!0),l[1]=Jg.x,l[2]=Jg.y)}if(s&&"none"!==s){const e=Pg(t,s,Qg,$g,o,Zg,!!n);if(n?d.push(...e):l.push(...e),Zg.x){let t;switch(qg($g,Qg,-Zg.x,!0),a){case Mg:t=h-3+1;break;case Dg:t=h-7+5;break;case Fg:t=h-5+3;break;case jg:t=h-6+3}t&&sf(l,Qg,t)}}}else Gg(Qg,$g)}}};function ef(t,e,i,s){Ug(e,t[s],t[s+1]),Ug(i,t[s+2],t[s+3])}function sf(t,e,i){t[i]=e.x,t[i+1]=e.y}Tt.add("arrow"),Lh.addAttr("startArrow","none",sg),Lh.addAttr("endArrow","none",sg),Object.assign(Ka,tf);let of=class extends Hh{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};Vt([on(class extends uh{})],of.prototype,"__",void 0),Vt([Do("x")],of.prototype,"flow",void 0),of=Vt([pn()],of);const nf={},rf={"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"},af={"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 hf(t,e,i){const s=t.__,{contentBounds:o}=t.__layout;vt.toPoint(i,e,o,nf),e.x=s.__autoWidth?o.x:nf.x,e.y=s.__autoHeight?o.y:nf.y}const{move:lf}=M;function df(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)),lf(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function cf(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 uf={};function _f(t,e){const{gap:i,flowAlign:s,flowWrap:o,__autoWidth:n,__autoHeight:r}=t.__,a=o&&(e?!n:!r);return"object"==typeof i?(uf.xGap=i.x||0,uf.yGap=i.y||0):uf.xGap=uf.yGap=i,uf.isAutoXGap="string"==typeof uf.xGap&&!n,uf.isAutoYGap="string"==typeof uf.yGap&&!r,uf.complex=a||"top-left"!==s||t.__hasGrow||uf.isAutoXGap||uf.isAutoYGap,uf.wrap=a,uf.complex&&(uf.isFitXGap="fit"===uf.xGap&&!n,uf.isFitYGap="fit"===uf.yGap&&!r,"object"==typeof s?(uf.contentAlign=s.content||"top-left",uf.rowXAlign=s.x||"from",uf.rowYAlign=s.y||"from"):(uf.contentAlign=s,uf.rowXAlign=rf[s],uf.rowYAlign=af[s])),uf}function pf(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function gf(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 ff(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:yf}=a;function mf(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=vf(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=vf(t,n=t.__flowBounds,n.width+o),e-=o-r,i-=s}))}(h,a,l)}}function vf(t,e,i){const{widthRange:s,lockRatio:o}=t.__,n=s?yf(i,s):i,r=n/e.width;return t.scaleResize(r,o?r:1),e.width=n,i-n}const{within:wf}=a;function xf(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=bf(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=bf(t,n=t.__flowBounds,n.height+o),e-=o-r,i-=s}))}(h,a,l)}}function bf(t,e,i){const{heightRange:s,lockRatio:o}=t.__,n=s?wf(i,s):i,r=n/e.height;return t.scaleResize(o?r:1,r),e.height=n,i-n}const{move:kf}=M;function Ef(t,e){const i="width",{children:s,itemBox:o}=t,n=_f(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:[]},_=d?0:h;let p,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++)p=s[y=e?h-1-n:n],p.__.inFlow&&0!==p.__.visible&&(g=ff(p,o),r?(p.__flowBounds=g,m||(m=pf(y,_)),a&&m.count&&m.width+g.width>x&&(m.grow?mf(t,m,x,e):d&&gf(m,i,x,c),cf(u,m,i),m=pf(y,_)),f=g.width,p.__widthGrow&&(m.grow+=p.__widthGrow,f=0,p.__.widthRange&&(m.hasRangeSize=!0)),p.__heightGrow&&bf(p,g,b),m.width+=m.count?f+_:f,m.height=Math.max(m.height,g.height),m.count++):(kf(p,v-g.x,w-g.y),v+=g.width+_));if(r&&m){const{isAutoYGap:s,isFitYGap:o,contentAlign:r,rowXAlign:h,rowYAlign:_}=n;m.count&&(m.grow?mf(t,m,x,e):d&&gf(m,i,x,c),a&&cf(u,m,i)),a?(s?gf(u,"height",b,o):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){hf(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=rf[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],df(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,_,e)):(hf(t,m,r),df(t,m,0,m.y,_,e))}}const{move:Bf}=M;function Sf(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)),Bf(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:Rf}=M;function Cf(t,e){const i="height",{children:s,itemBox:o}=t,n=_f(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:[]},_=d?0:l;let p,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++)p=s[y=e?h-1-n:n],p.__.inFlow&&0!==p.__.visible&&(g=ff(p,o),r?(p.__flowBounds=g,m||(m=pf(y,_)),a&&m.count&&m.height+g.height>b&&(m.grow&&xf(t,m,b,e),d&&gf(m,i,b,c),cf(u,m,i),m=pf(y,_)),f=g.height,p.__heightGrow&&(m.grow+=p.__heightGrow,f=0,p.__.heightRange&&(m.hasRangeSize=!0)),p.__widthGrow&&vf(p,g,x),m.height+=m.count?f+_:f,m.width=Math.max(m.width,g.width),m.count++):(Rf(p,v-g.x,w-g.y),w+=g.height+_));if(r&&m){const{isAutoXGap:s,isFitXGap:o,contentAlign:r,rowXAlign:l,rowYAlign:_}=n;m.count&&(m.grow&&xf(t,m,b,e),d&&gf(m,i,b,c),a&&cf(u,m,i)),a?(s?gf(u,"width",x,o):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){hf(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=af[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,_),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],Sf(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(hf(t,m,r),Sf(t,m,m.x,0,l,e))}}function Tf(t){return Oo(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)&&Yo(this)}})))}Tt.add("flow","resize");const Of=Hh.prototype,{__updateBoxBounds:Lf}=Ph.prototype;Lh.addAttr("flow",!1,Do),Lh.addAttr("gap",0,Wo),Lh.addAttr("flowAlign","top-left",Wo),Lh.addAttr("flowWrap",!1,Wo),Lh.addAttr("itemBox","box",Wo),Lh.addAttr("inFlow",!0,Wo),Lh.addAttr("autoWidth",void 0,Tf),Lh.addAttr("autoHeight",void 0,Tf),Lh.addAttr("autoBox",void 0,Wo);const{copyAndSpread:Pf}=rt;Of.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:Ef(this);break;case"y":Cf(this);break;case"x-reverse":Ef(this,!0);break;case"y-reverse":Cf(this,!0)}t&&(this.leafer.created=!0)},Of.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),Pf(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},Of.__updateBoxBounds=function(t){const e=this.__;if(this.children.length&&!this.pathInputed){const{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():Lf.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&&Pf(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:Af,sin:Mf,pow:Df,sqrt:Ff,abs:If,ceil:Wf,floor:zf,round:Yf,PI:Nf}=Math,Xf=5*Nf,Hf=1.70158,Vf=2.5949095,jf=7.5625,Gf=2.75;function Uf(t){return e=>Df(e,t)}function qf(t){return e=>1-Df(1-e,t)}function Zf(t){return e=>e<.5?.5*Df(2*e,t):1-.5*Df(2-2*e,t)}function Kf(t){return t<1/Gf?jf*t*t:t<2/Gf?jf*(t-=1.5/Gf)*t+.75:t<2.5/Gf?jf*(t-=2.25/Gf)*t+.9375:jf*(t-=2.625/Gf)*t+.984375}function Jf(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=Qf(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(If(l)<1e-6));e++)c-=d/l;return o[r]=Qf(c,e,s)}}function Qf(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const $f={get(t){const{list:e}=$f;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){$f.list[t]=e},list:{linear:t=>t,ease:Jf(.25,.1,.25,1),"ease-in":Jf(.42,0,1,1),"ease-out":Jf(0,0,.58,1),"ease-in-out":Jf(.42,0,.58,1),"sine-in":t=>1-Af(t*Nf*.5),"sine-out":t=>Mf(t*Nf*.5),"sine-in-out":t=>.5*(1-Af(t*Nf)),"quad-in":Uf(2),"quad-out":qf(2),"quad-in-out":Zf(2),"cubic-in":Uf(3),"cubic-out":qf(3),"cubic-in-out":Zf(3),"quart-in":Uf(4),"quart-out":qf(4),"quart-in-out":Zf(4),"quint-in":Uf(5),"quint-out":qf(5),"quint-in-out":Zf(5),"expo-in":t=>t?Df(2,10*t-10):0,"expo-out":t=>1===t?1:1-Df(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Df(2,2*t*10-10):.5*(2-Df(2,10-2*t*10)),"circ-in":t=>1-Ff(1-Df(t,2)),"circ-out":t=>Ff(1-Df(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Ff(1-Df(2*t,2))):.5*(Ff(1-Df(2-2*t,2))+1),"back-in":t=>((Hf+1)*t-Hf)*t*t,"back-out":t=>(t-=1)*t*((Hf+1)*t+Hf)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Vf+1)*t-Vf)*.5:.5*((t=2*t-2)*t*((Vf+1)*t+Vf)+2),"elastic-in":t=>0===t||1===t?t:-Df(2,10*(t-1))*Mf((t-1.1)*Xf),"elastic-out":t=>0===t||1===t?t:Df(2,-10*t)*Mf((t-.1)*Xf)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Df(2,10*((t*=2)-1))*Mf((t-1.1)*Xf)*.5:Df(2,10*(1-(t*=2)))*Mf((t-1.1)*Xf)*.5+1,"bounce-in":t=>1-Kf(1-t),"bounce-out":Kf,"bounce-in-out":t=>t<.5?.5*(1-Kf(1-2*t)):.5*(1+Kf(2*t-1)),"cubic-bezier":Jf,steps:function(t,e="floor"){return i=>("floor"===e?zf(i*t):"ceil"===e?Wf(i*t):Yf(i*t))/t}}};function ty(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 ey{}ey.CREATED="created",ey.PLAY="play",ey.PAUSE="pause",ey.STOP="stop",ey.SEEK="seek",ey.UPDATE="update",ey.COMPLETED="completed";let iy=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: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=$f.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))}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emit(ey.PLAY,this))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emit(ey.PAUSE,this))}stop(){this.destroyed||(this.complete(),this.emit(ey.STOP,this))}seek(t){this.destroyed||("object"==typeof t&&(t=Za.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.emit(ey.SEEK,this))}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=$f.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.emit(ey.CREATED,this)}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(),t.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.emit(ey.COMPLETED,this)}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={}),oh.setBetweenStyle(r,s,o,e,t,n,i),this.setStyle(r)}this.emit(ey.UPDATE,this)}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.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};Vt([ty("ease")],iy.prototype,"easing",void 0),Vt([ty(0)],iy.prototype,"delay",void 0),Vt([ty(.2)],iy.prototype,"duration",void 0),Vt([ty("auto")],iy.prototype,"ending",void 0),Vt([ty(!1)],iy.prototype,"reverse",void 0),Vt([ty(!1)],iy.prototype,"swing",void 0),Vt([ty(!1)],iy.prototype,"loop",void 0),Vt([ty(0)],iy.prototype,"loopDelay",void 0),Vt([ty(1)],iy.prototype,"speed",void 0),Vt([ty(!0)],iy.prototype,"autoplay",void 0),Vt([ty()],iy.prototype,"join",void 0),Vt([ty()],iy.prototype,"attrs",void 0),iy=Vt([_n(mr)],iy);let sy=class extends iy{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(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter((t=>{const{completed:e}=t;return e&&t.destroy(),!e}))),this.list=t.map((t=>{const i=t.target?t:new iy(this.target,t,e);return Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i}))}play(){this.each((t=>t.play()))}pause(){this.each((t=>t.pause()))}stop(){this.each((t=>t.stop()))}seek(t){this.each((e=>e.seek(t)))}kill(t,e){this.each((i=>i.kill(t,e))),this.destroy()}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each((e=>e.destroy(t))),e.length=0)}};sy=Vt([_n(mr)],sy);const oy={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"},ny=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,ry=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,ay=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,hy=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,ly=parseInt,dy=parseFloat,{round:cy}=Math;let uy={},_y=0;function py(t){let e,i,s,o=1;switch(t.length){case 9:e=ly(t.slice(1,3),16),i=ly(t.slice(3,5),16),s=ly(t.slice(5,7),16),o=ly(t.slice(7,9),16)/255;break;case 7:e=ly(t.slice(1,3),16),i=ly(t.slice(3,5),16),s=ly(t.slice(5,7),16);break;case 5:e=ly(t[1]+t[1],16),i=ly(t[2]+t[2],16),s=ly(t[3]+t[3],16),o=ly(t[4]+t[4],16)/255;break;case 4:e=ly(t[1]+t[1],16),i=ly(t[2]+t[2],16),s=ly(t[3]+t[3],16);break;case 3:e=i=s=ly(t[1]+t[2],16);break;case 2:e=i=s=ly(t[1]+t[1],16)}return{r:e,g:i,b:s,a:o}}const gy=1/6,fy=.5,yy=2/3,my=1/3;function vy(t,e,i){return i<0?i++:i>1&&i--,i<gy?t+6*(e-t)*i:i<fy?e:i<yy?t+(e-t)*(yy-i)*6:t}function wy(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=vy(a,s,t+my),n=vy(a,s,t),r=vy(a,s,t-my)}return{r:cy(255*o),g:cy(255*n),b:cy(255*r),a:s}}Tt.add("color"),qa.object=function(t,e){let i,s=void 0!==e&&1!==e;if("string"==typeof t){const e=uy[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=py(t);break;case"R":case"r":"("===t[4]&&ry.test(t)?i=function(t){const e=ry.exec(t);return{r:ly(e[1]),g:ly(e[2]),b:ly(e[3]),a:dy(e[4])}}(t):"("===t[3]&&ny.test(t)&&(i=function(t){const e=ny.exec(t);return{r:ly(e[1]),g:ly(e[2]),b:ly(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&hy.test(t)?i=function(t){const e=hy.exec(t);return wy(dy(e[1]),dy(e[2]),dy(e[3]),dy(e[4]))}(t):"("===t[3]&&ay.test(t)&&(i=function(t){const e=ay.exec(t);return wy(dy(e[1]),dy(e[2]),dy(e[3]),1)}(t))}if(!i){const e=oy[t.toLowerCase()];e&&(i=py("#"+e))}i&&(_y++,_y>1e4&&(uy={},_y=0),uy[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:xy}=Math,{fourNumber:by}=a,ky={fill:Cy,stroke:Cy,cornerRadius:(t,e,i)=>"number"==typeof t&&"number"==typeof e?Sy(t,e,i):(t=by(t),e=by(e),t.map(((t,s)=>Sy(t,e[s],i)))),text(t,e,i){if("string"==typeof t&&"string"==typeof e){const s=t.length,o=e.length,n=Sy(s,o,i,1);return s<o?e.substring(0,n):t.substring(0,n)}return"number"==typeof t||"number"==typeof e?a.float(Sy(t,e,i),Math.max(By(t),By(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const o=Object.assign(Object.assign({},t),e);return oh.setBetweenStyle(o,t,e,o,i,s),o},shadow:Ty,innerShadow:Ty},Ey={value:function(t,e,i){const s="number"==typeof t,o="number"==typeof e;return s&&o?t+(e-t)*i:o||s?Sy(t,e,i):t},number:Sy,color:Ry,setBetweenStyle:function(t,e,i,s,o,n,r){let a,h,l;const{list:d,value:c}=oh;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 By(t){const e=String(t).split(".")[1];return e?e.length:0}function Sy(t,e,i,s){t||(t=0),e||(e=0);const o=t+(e-t)*i;return s?xy(o):o}function Ry(t,e,i){t=qa.object(t),e=qa.object(e);const s=Sy(t.r,e.r,i,1)+","+Sy(t.g,e.g,i,1)+","+Sy(t.b,e.b,i,1),o=Sy(t.a,e.a,i);return 1===o?"rgb("+s+")":"rgba("+s+","+o+")"}function Cy(t,e,i){return"string"==typeof t&&"string"==typeof e?Ry(t,e,i):e}function Ty(t,e,i){return t instanceof Array||e instanceof Array?e:(e=e||{},{x:Sy((t=t||{}).x,e.x,i),y:Sy(t.y,e.y,i),blur:Sy(t.blur,e.blur,i),spread:Sy(t.spread,e.spread,i),color:Ry(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}Tt.add("animate","color"),sh.canAnimate=!0,Object.assign(oh.list,ky),Object.assign(oh,Ey);const Oy=Lh.prototype;Lh.addAttr("animation",void 0,(function(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}})))})),Lh.addAttr("animationOut",void 0,Ao),Lh.addAttr("transition",!0,Ao),Lh.addAttr("transitionOut",void 0,Ao),Oy.animate=function(t,e,i,s){if(void 0===t)return this.__animate;let o=t instanceof Array&&!e&&i?new sy(this,t,s):new iy(this,t,e,s);this.killAnimate(i,o.toStyle);const n=this.__animate;return n&&(o instanceof sy?o.list.unshift(n):o=new sy(this,[n,o])),this.__animate=o},Oy.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof sy&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},Oy.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(ey.COMPLETED,e)};const Ly=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Py=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Ay}=Math,{getDerivative:My}=Le,Dy={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<Ly.length;h++)l=f*(1+Ly[h]),d=f*(1-Ly[h]),c=My(l,t,i,o,r),u=My(l,e,s,n,a),_=My(d,t,i,o,r),p=My(d,e,s,n,a),g+=Py[h]*(Ay(c*c+u*u)+Ay(_*_+p*p));return g*f},getRotation(t,e,i,s,o,n,r,a,h){const d=My(t,e,s,n,a),c=My(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,_=t/e,p=d/e/3;if(_>=1)return 1;if(_<=0)return 0;for(;u-c>p;)Fy(i,s,o,n,r,a,h,l,_)<t?c=_:u=_,_=(c+u)/2;return _},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,_=d*o+e*r,p=d*n+e*a,g=d*c+e*_,f=d*u+e*p,y=d*g+e*(d*_+e*(d*r+e*h)),m=d*f+e*(d*p+e*(d*a+e*l));t.push(ne.C,c,u,g,f,y,m)}},{getDistance:Fy}=Dy,{M:Iy,L:Wy,C:zy,Z:Yy}=ne,Ny={},Xy={},Hy={transform(t,e){let i,s=0;const o=t.length;for(;s<o;)switch(i=t[s],i){case Iy:case Wy:Hy.transformPoints(t,e,s,1),s+=3;break;case zy:Hy.transformPoints(t,e,s,3),s+=7;break;case Yy:s+=1}},transformPoints(t,e,i,s){for(let o=i+1,n=o+2*s;o<n;o+=2)Ny.x=t[o],Ny.y=t[o+1],b.toOuterPoint(e,Ny),t[o]=Ny.x,t[o+1]=Ny.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 Iy:case Wy:i=t[a+1],s=t[a+2],e=o===Wy&&a>0?M.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case zy:i=t[a+5],s=t[a+6],e=Dy.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 Yy: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=Za.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 Iy:case Wy:if(r=o[f+1],a=o[f+2],n=s[y],p+n>=e||!t.total)return f||(m=r,v=a),Xy.x=m,Xy.y=v,g.x=r,g.y=a,M.getDistancePoint(Xy,g,e-p,!0),g.rotation=M.getAngle(Xy,g),g;m=r,v=a,f+=3;break;case zy:if(r=o[f+5],a=o[f+6],n=s[y],p+n>=e)return l=o[f+1],d=o[f+2],c=o[f+3],u=o[f+4],_=Dy.getT(e-p,n,m,v,l,d,c,u,r,a,i),Le.getPointAndSet(_,m,v,l,d,c,u,r,a,g),g.rotation=Dy.getRotation(_,m,v,l,d,c,u,r,a),g;m=r,v=a,f+=7;break;case Yy:f+=1;default:n=0}y++,p+=n}return g},getDistancePath(t,e,i){const{segments:s,data:o}=t,n=[];e=Za.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 Iy:case Wy:if(a=o[y+1],h=o[y+2],r=s[m],g+r>=e||!t.total)return y||(v=a,w=h),Xy.x=v,Xy.y=w,f.x=a,f.y=h,M.getDistancePoint(Xy,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 zy:if(d=o[y+1],c=o[y+2],u=o[y+3],_=o[y+4],a=o[y+5],h=o[y+6],r=s[m],g+r>=e)return p=Dy.getT(e-g,r,v,w,d,c,u,_,a,h,i),Dy.cut(n,p,v,w,d,c,u,_,a,h),n;v=a,w=h,y+=7,n.push(l,d,c,u,_,a,h);break;case Yy:y+=1,n.push(l);default:r=0}m++,g+=r}return n}};function Vy(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!Xt(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}Tt.add("motion-path"),oh.register("motion",(function(t,e,i,s){return t?"object"==typeof t&&(t=Za.number(t,s.getMotionTotal())):t=0,e?"object"==typeof e&&(e=Za.number(e,s.getMotionTotal())):e=0,oh.number(t,e,i)})),oh.register("motionRotation",(function(t,e,i){return oh.number(t,e,i)}));const jy=Lh.prototype,{updateMatrix:Gy,updateAllMatrix:Uy}=Rn,{updateBounds:qy}=In;function Zy(t){const{motion:e,leaferIsCreated:i}=t;if(!Xt(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Jy(t);i.total&&(t.__.__pathForRender=Hy.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Uy(t),qy(t,t)):Gy(t));i&&(t.leafer.created=!0)}}function Ky(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 Jy(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Hy.getMotionPathData(t.getPath(!0,!0))}function Qy(t,e){return Oo(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 $y(t){return Oo(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}})))}function tm(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 em(t,e){"object"!=typeof e&&(e=void 0),om(t,e,"in")}function im(t,e){const{normalStyle:i}=t;"object"!=typeof e&&(e=void 0),i&&(e||(e=i),om(t,e,"out"))}Lh.addAttr("motionPath",void 0,Vy),Lh.addAttr("motionPrecision",1,Vy),Lh.addAttr("motion",void 0,Vy),Lh.addAttr("motionRotation",!0,Vy),jy.getMotionPathData=function(){return Jy(Ky(this))},jy.getMotionPoint=function(t){const e=Ky(this),i=Jy(e);if(!i.total)return{};const s=Hy.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},jy.getMotionTotal=function(){return this.getMotionPathData().total},jy.__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],Xt(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Zy(t))}else Zy(this)};const sm={};function om(t,e,i){const{normalStyle:s}=t;e||(e=sm),e.scale&&(a.assignScale(e,e.scale),delete e.scale),e!==sm&&sh.canAnimate||(i=null);let o=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&Xt(i[s])&&Xt(e[s])&&(s="transition");return Xt(e[s])?i[s]:e[s]}(i,e,t);const n=o?function(t,e){const i=am(e,t),s=t.animate();s&&am(i,t,s.fromStyle);return i}(t,e):void 0;sh.canAnimate&&nm(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const r=nm(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=rm(r,t),t.set(r,"temp")}else t.normalStyle=void 0;if(o){const e=rm(n,t);t.set(n,"temp"),t.animate([n,e],o,"transition",!0)}t.__layout.stateStyleChanged=!1}function nm(t){let e;const i={},s=tm(t),o=s?t.state||s.state:t.state,n=o&&t.states[o];n&&sh.isState(o,t,s)&&(e=hm(i,n));const r=i.selectedStyle||t.selectedStyle;r&&sh.isSelected(t,s)&&(e=hm(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&sh.isPlacehold(t,s)&&(e=hm(i,a)),sh.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=hm(i,s))}else{const o=i.focusStyle||t.focusStyle;o&&sh.isFocus(t,s)&&(e=hm(i,o));const n=i.hoverStyle||t.hoverStyle;n&&sh.isHover(t,s)&&(e=hm(i,n));const r=i.pressStyle||t.pressStyle;r&&sh.isPress(t,s)&&(e=hm(i,r))}return e?i:void 0}function rm(t,e,i,s){const o=i?t:{},n=i||t;for(let t in n)s&&sh.animateExcludes[t]||(o[t]=e[t]);return o}function am(t,e,i){return rm(t,e,i,!0)}function hm(t,e){return Object.assign(t,e),!0}function lm(t,e){const i=t[e];i&&em(t,i),t.button&&cm(t.children,e)}function dm(t,e,i){i||(i=t.states[e]),em(t,i),t.button&&cm(t.children,null,e)}function cm(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":sh.isHover(s)&&(o=!1);break;case"pressStyle":sh.isPress(s)&&(o=!1);break;case"focusStyle":sh.isFocus(s)&&(o=!1)}o&&lm(s,e)}else void 0!==i&&dm(s,i);s.isBranch&&cm(s.children,e,i)}}function um(t,e){const i=t[e];i&&im(t,i),t.button&&pm(t.children,e)}function _m(t,e,i){im(t,i),t.button&&pm(t.children,null,e)}function pm(t,e,i){if(!t)return;let s;for(let o=0,n=t.length;o<n;o++)s=t[o],e?um(s,e):void 0!==i&&_m(s,i),s.isBranch&&pm(s.children,e,i)}function gm(t,e,i){let s;const o=e.leafer?e.leafer.interaction:null;if(o&&(s=o[t](e),!s&&i)){const n=tm(e,i);n&&(s=o[t](n))}return s}function fm(t,e,i){let s=e[t];if(!s&&i){const o=tm(e,i);o&&(s=o[t])}return s}Tt.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 o=tm(e,i);o&&(s=o.states[t])}return!!s}(t,e,i)},sh.isSelected=function(t,e){return fm("selected",t,e)},sh.isDisabled=function(t,e){return fm("disabled",t,e)},sh.isFocus=function(t,e){return gm("isFocus",t,e)},sh.isHover=function(t,e){return gm("isHover",t,e)},sh.isPress=function(t,e){return gm("isPress",t,e)},sh.isPlacehold=function(t,e){return t.__.__isPlacehold},sh.isDrag=function(t,e){return gm("isDrag",t,e)},sh.setStyleName=function(t,e,i){i?dm(t,e,t[e]):_m(t,e,t[e])},sh.set=function(t,e){const i=t.states[e];i?dm(t,e,i):_m(t,e,i)},sh.getStyle=nm,sh.updateStyle=om,sh.updateEventStyle=function(t,e){switch(e){case Dl.ENTER:lm(t,"hoverStyle");break;case Dl.LEAVE:um(t,"hoverStyle");break;case Dl.DOWN:lm(t,"pressStyle");break;case Dl.UP:um(t,"pressStyle")}};const ym=Lh.prototype;Lh.addAttr("selected",!1,Qy,"selectedStyle"),Lh.addAttr("disabled",!1,Qy,"disabledStyle"),Lh.addAttr("states",{},$y),Lh.addAttr("state","",Qy),Lh.addAttr("normalStyle",void 0,Ao),Lh.addAttr("hoverStyle",void 0,$y),Lh.addAttr("pressStyle",void 0,$y),Lh.addAttr("focusStyle",void 0,$y),Lh.addAttr("selectedStyle",void 0,$y),Lh.addAttr("disabledStyle",void 0,$y),Lh.addAttr("placeholderStyle",void 0,$y),Lh.addAttr("button",!1,Ao),ym.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?lm(this,"focusStyle"):um(this,"focusStyle")}))},ym.updateState=function(){sh.updateStyle(this,void 0,"in")};const mm=Rl.prototype,vm="text";Co(mm,vm,Object.assign(Object.assign({},To(mm,vm)),{set(t){const e=this,i=e.text;e.__setAttr(vm,t)&&(Yo(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class wm extends lh{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let xm=class extends Lh{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 tr(tr.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()}};Vt([on(wm)],xm.prototype,"__",void 0),Vt([Wo()],xm.prototype,"robot",void 0),Vt([Ao()],xm.prototype,"actions",void 0),Vt([Ao("")],xm.prototype,"action",void 0),Vt([Uo(0)],xm.prototype,"now",void 0),Vt([Ao(12)],xm.prototype,"FPS",void 0),Vt([Ao(!0)],xm.prototype,"loop",void 0),xm=Vt([pn()],xm),Tt.add("robot");const{Yes:bm,NoAndSkip:km,YesAndSkip:Em}=Yt,Bm={},Sm={},Rm={};class Cm{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"#":Bm.id=t.substring(1),t=Bm;break;case".":Sm.className=t.substring(1),t=Sm;break;default:Rm.tag=t,t=Rm}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?It.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&&Rn.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===bm||n===Em){if(!i)return void(this.findLeaf=o);i.push(o)}o.isBranch&&n<km&&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_(Qn.REMOVE,this.__onRemoveChild,this),this.target.on_($n.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 Tm=Lh.prototype;function Om(i){return i.leafer?i.leafer.selector:t.selector||(t.selector=e.selector())}Tm.find=function(t,e){return Om(this).getBy(t,this,!1,e)},Tm.findOne=function(t,e){return Om(this).getBy(t,this,!0,e)},Tt.add("find"),e.finder=function(t){return new Cm(t)};const{setPoint:Lm,addPoint:Pm,toBounds:Am}=H;const Mm={syncExport(i,s,o){let n;this.running=!0;const r=go.fileType(s),h=s.includes(".");o=go.getExportOptions(o);const{toURL:l}=t,{download:d}=t.origin;if("json"===r)h&&d(l(JSON.stringify(i.toJSON(o.json)),"text"),s),n={data:!!h||i.toJSON(o.json)};else if("svg"===r)h&&d(l(i.toSVG(),"svg"),s),n={data:!!h||i.toSVG()};else{let t,r,h=1,l=1;const{worldTransform:d,isLeafer:c,leafer:u,isFrame:_}=i,{slice:p,clip:g,trim:f,padding:y,onCanvas:m}=o,v=void 0===o.smooth?!u||u.config.smooth:o.smooth,w=o.contextSettings||(u?u.config.contextSettings:void 0),x=o.screenshot||i.isApp,b=c&&x&&void 0===o.fill?i.fill:o.fill,k=go.isOpaqueImage(s)||b,E=new N;if(x)t=!0===x?c?u.canvas.bounds:i.worldRenderBounds:x;else{let e=o.relative||(c?"inner":"local");switch(h=d.scaleX,l=d.scaleY,e){case"inner":E.set(d);break;case"local":E.set(d).divide(i.localTransform),h/=i.scaleX,l/=i.scaleY;break;case"world":h=1,l=1;break;case"page":e=u||i;default:E.set(d).divide(i.getTransform(e));const t=e.worldTransform;h/=h/t.scaleX,l/=l/t.scaleY}t=i.getBounds("render",e)}const B={scaleX:1,scaleY:1};a.getScaleData(o.scale,o.size,t,B);let S=o.pixelRatio||1;i.isApp&&(B.scaleX*=S,B.scaleY*=S,S=i.app.pixelRatio);let{x:R,y:C,width:T,height:O}=new dt(t).scale(B.scaleX,B.scaleY);g&&(R+=g.x,C+=g.y,T=g.width,O=g.height);const L={matrix:E.scale(1/B.scaleX,1/B.scaleY).invert().translate(-R,-C).withScale(1/h*B.scaleX,1/l*B.scaleY)};let P,A=e.canvas({width:Math.floor(T),height:Math.floor(O),pixelRatio:S,smooth:v,contextSettings:w});if(p&&(P=i,P.__worldOpacity=0,i=u||i,L.bounds=A.bounds),A.save(),_&&void 0!==b){const t=i.get("fill");i.fill="",i.__render(A,L),i.fill=t}else i.__render(A,L);if(A.restore(),P&&P.__updateWorldOpacity(),f){r=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?Pm(r,o,n):Lm(r={},o,n)),a++;const h=new dt;return Am(r,h),h.scale(1/t.pixelRatio).ceil()}(A);const t=A,{width:i,height:s}=r,o={x:0,y:0,width:i,height:s,pixelRatio:S};A=e.canvas(o),A.copyWorld(t,r,o)}if(y){const[t,i,s,o]=a.fourNumber(y),n=A,{width:r,height:h}=n;A=e.canvas({width:r+o+i,height:h+t+s,pixelRatio:S}),A.copyWorld(n,n.bounds,{x:o,y:t,width:r,height:h})}k&&A.fillWorld(A.bounds,b||"#FFFFFF","destination-over"),m&&m(A);n={data:"canvas"===s?A:A.export(s,o),width:A.pixelWidth,height:A.pixelHeight,renderBounds:t,trimBounds:r}}return this.running=!1,n},export(e,i,s){return this.running=!0,function(t){Dm||(Dm=new vo);return new Promise((e=>{Dm.add((()=>jt(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((o=>new Promise((n=>{const r=()=>jt(this,void 0,void 0,(function*(){if(!xo.isComplete)return t.requestRender(r);const a=Mm.syncExport(e,i,s);a.data instanceof Promise&&(a.data=yield a.data),o(a),n()}));e.updateLayout(),Fm(e);const{leafer:a}=e;a?a.waitViewCompleted(r):r()}))))}};let Dm;function Fm(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach((t=>Fm(t)))}const Im=ie.prototype,Wm=bt.get("@leafer-in/export");Im.export=function(t,e){const{quality:i,blob:s}=go.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Im.toBlob=function(e,i){return new Promise((s=>{t.origin.canvasToBolb(this.view,e,i).then((t=>{s(t)})).catch((t=>{Wm.error(t),s(null)}))}))},Im.toDataURL=function(e,i){return t.origin.canvasToDataURL(this.view,e,i)},Im.saveAs=function(e,i){return new Promise((s=>{t.origin.canvasSaveAs(this.view,e,i).then((()=>{s(!0)})).catch((t=>{Wm.error(t),s(!1)}))}))},Tt.add("export"),Object.assign(ih,Mm),Lh.prototype.export=function(t,e){return ih.export(this,t,e)},Lh.prototype.syncExport=function(t,e){return ih.syncExport(this,t,e)},Tt.add("filter"),Object.assign(eh,{list:{},register(t,e){eh.list[t]=e},apply(t,e,i,s,o,n){let r;t.forEach((t=>{r=eh.list[t.type],r&&r.apply(t,e,i,s,o,n)}))},getSpread(t){let e,i=0;return t.forEach((t=>{e=eh.list[t.type],e&&(i+=e.getSpread(t))})),i}});export{vt as AlignHelper,iy as Animate,$f as AnimateEasing,ey as AnimateEvent,sy as AnimateList,Yt as Answer,Ol as App,ft as AroundHelper,og as Arrow,ig as ArrowData,ut as AutoBounds,Le as BezierHelper,dt as Bounds,rt as BoundsHelper,Hh as Box,uh as BoxData,va as Branch,In as BranchHelper,zr as BranchRender,bl as Canvas,Bh as CanvasData,Ft as CanvasManager,Qn as ChildEvent,qa as ColorConvert,e as Creator,ld as Cursor,It as DataHelper,bt as Debug,_t as Direction4,pt as Direction9,Wl as DragEvent,Ql as Dragger,Yl as DropEvent,M_ as EditBox,S_ as EditDataHelper,L_ as EditPoint,g_ as EditSelect,c_ as EditSelectHelper,sp as EditTool,U_ as EditToolCreator,ep as Editor,Ku as EditorEvent,K_ as EditorGroupEvent,H_ as EditorHelper,Ju as EditorMoveEvent,$u as EditorRotateEvent,Qu as EditorScaleEvent,t_ as EditorSkewEvent,th as Effect,qh as Ellipse,yh as EllipseData,Ye as EllipseHelper,Jn as Event,Mt as EventCreator,ar as Eventer,ih as Export,go as FileHelper,eh as Filter,Cm as Finder,of as Flow,Vh as Frame,ph as FrameData,Ph as Group,ch as GroupData,Dy as HighBezierHelper,Hy as HighCurveHelper,dd as HitCanvasManager,wl as Image,Eh as ImageData,tr as ImageEvent,ko as ImageManager,i as IncrementId,ip as InnerEditor,Z_ as InnerEditorEvent,kd as Interaction,hd as InteractionBase,Gl as InteractionHelper,jl as KeyEvent,Pl as Keyboard,sr as LayoutEvent,Wa as Layouter,la as Leaf,Fr as LeafBounds,Dn as LeafBoundsHelper,zt as LeafData,xr as LeafDataProxy,mr as LeafEventer,Rn as LeafHelper,Kn as LeafLayout,xa as LeafLevelList,wa as LeafList,Cr as LeafMatrix,Ir as LeafRender,Dh as Leafer,ka as LeaferCanvas,ie as LeaferCanvasBase,_h as LeaferData,nr as LeaferEvent,Ro as LeaferImage,Np as LeaferTypeCreator,sl as Line,gh as LineData,lp as LineEditTool,a as MathHelper,N as Matrix,b as MatrixHelper,Nl as MoveEvent,Vp as MultiTouchHelper,zl as MyDragEvent,xl as MyImage,Fl as MyPointerEvent,ae as NeedConvertToCanvasCommandMap,l as OneRadian,d as PI2,c as PI_2,Ja as Paint,$a as PaintGradient,Qa as PaintImage,Cl as Path,Ka as PathArrow,tf as PathArrowModule,so as PathBounds,Ui as PathCommandDataHelper,ne as PathCommandMap,Ei as PathConvert,co as PathCorner,ds as PathCreator,wh as PathData,Bs as PathDrawer,se as PathHelper,pg as PathMatrixHelper,ce as PathNumberCommandLengthMap,de as PathNumberCommandMap,kp as PathScaler,Tl as Pen,xh as PenData,Xa as Picker,t as Platform,Tt as Plugin,z as Point,M as PointHelper,Al as PointerButton,Dl as PointerEvent,ul as Polygon,mh as PolygonData,$n as PropertyEvent,Fh as Rect,fh as RectData,ue as RectHelper,Th as RectRender,or as RenderEvent,Ya as Renderer,er as ResizeEvent,xo as Resource,xm as Robot,wm as RobotData,Xl as RotateEvent,St as Run,eg as ScrollBar,d_ as SelectArea,Ha as Selector,vl as Star,vh as StarData,sh as State,wt as StringNumberMap,l_ as Stroker,Hl as SwipeEvent,mo as TaskItem,vo as TaskProcessor,Rl as Text,Ua as TextConvert,kh as TextData,Gp as Transformer,oh as Transition,H as TwoPointBoundsHelper,Lh as UI,Sh as UIBounds,Lt as UICreator,lh as UIData,Ml as UIEvent,Rh as UIRender,Za as UnitConvert,Nn as WaitHelper,ir as WatchEvent,Ra as Watcher,jp as WheelEventHelper,Vl as ZoomEvent,Wp as addViewport,zp as addViewportConfig,Go as affectRenderBoundsType,Ho as affectStrokeBoundsType,sg as arrowType,Lo as attr,Do as autoLayoutType,Wo as boundsType,po as canvasPatch,ee as canvasSizeAttrs,sn as cursorType,on as dataProcessor,Ao as dataType,Oo as decorateLeafAttr,rn as defineDataProcessor,Co as defineKey,Po as defineLeafAttr,Yo as doBoundsType,Vo as doStrokeType,Va as effectType,Nt as emptyData,tn as eraserType,_ as getBoundsData,To as getDescriptor,p as getMatrixData,u as getPointData,en as hitType,Ht as isEmptyData,Xt as isNull,nn as layoutProcessor,$o as maskType,Vy as motionPathType,zo as naturalBoundsType,qo as opacityType,No as pathInputType,Xo as pathType,uo as pen,Mo as positionType,j_ as registerEditTool,G_ as registerInnerEditor,pn as registerUI,gn as registerUIEvent,ja as resizeType,dn as rewrite,cn as rewriteAble,Io as rotationType,Pp as scaleResize,Ap as scaleResizeFontSize,Fp as scaleResizeGroup,Mp as scaleResizePath,Dp as scaleResizePoints,Fo as scaleType,Qo as sortType,$y as stateStyleType,Qy as stateType,jo as strokeType,Uo as surfaceType,ct as tempBounds,X as tempMatrix,Y as tempPoint,Sa as useCanvas,_n as useModule,ba as version,Zo as visibleType,Ga as zoomLayerType};
1
+ const t={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(e){const{prefix:i,suffix:s}=t.image;return!s||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+s),i&&"/"===e[0]&&(e=i+e),e}}},e={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=e,{round:s,pow:o,PI:n}=Math,r={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)),r.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?o(10,e):1e12;return-0===(t=s(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&&r.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:a,randColor:t=>`rgba(${a(255)},${a(255)},${a(255)},${t||1})`};function a(t){return Math.round(Math.random()*t)}const h=n/180,l=2*n,d=n/2;function c(){return{x:0,y:0}}function u(){return{x:0,y:0,width:0,height:0}}function p(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:_,cos:g,acos:f,sqrt:y}=Math,{float:m}=r,v={};function w(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const x={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:w(),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:p,getWorld:w,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,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){b.toInnerPoint(t,e,v),b.scaleOfInner(t,v,i,s)},scaleOfInner(t,e,i,s=i){b.translateInner(t,e.x,e.y),b.scale(t,i,s),b.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:o,d:n}=t,r=g(e*=h),a=_(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){b.toInnerPoint(t,e,v),b.rotateOfInner(t,v,i)},rotateOfInner(t,e,i){b.translateInner(t,e.x,e.y),b.rotate(t,i),b.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:o,c:n,d:r}=t;i&&(i*=h,t.a=s+n*i,t.b=o+r*i),e&&(e*=h,t.c=n+s*e,t.d=r+o*e)},skewOfOuter(t,e,i,s){b.toInnerPoint(t,e,v),b.skewOfInner(t,v,i,s)},skewOfInner(t,e,i,s=0){b.translateInner(t,e.x,e.y),b.skew(t,i,s),b.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){b.multiply(t,b.tempInvert(e))},divideParent(t,e){b.multiplyParent(t,b.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=b;return b.copy(e,t),b.invert(e),e},invert(t){const{a:e,b: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:l}=e;if(void 0===o&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:i,skewX:s,skewY:o}=e,n=i*h,r=g(n),d=_(n);if(s||o){const e=s*h,i=o*h;t.a=(r+i*-d)*a,t.b=(d+i*r)*a,t.c=(e*r-d)*l,t.d=(r+e*d)*l}else t.a=r*a,t.b=d*a,t.c=-d*l,t.d=r*l}else t.a=a,t.b=0,t.c=0,t.d=l;t.e=n,t.f=r,(i=i||s)&&b.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:o,b:n,c:r,d:a,e:l,f:c}=t;let u,p,v,w,x,b=l,k=c;if(n||r){const t=o*a-n*r;if(r&&!s){u=y(o*o+n*n),p=t/u;const e=o/u;v=n>0?f(e):-f(e)}else{p=y(r*r+a*a),u=t/p;const e=r/p;v=d-(a>0?f(-e):-f(e))}const e=m(g(v)),i=_(v);u=m(u),p=m(p),w=e?m((r/p+i)/e/h,9):0,x=e?m((n/u-i)/e/h,9):0,v=m(v/h)}else u=o,p=a,v=w=x=0;return(e=i||e)&&(b+=e.x*o+e.y*r,k+=e.x*n+e.y*a,i||(b-=e.x,k-=e.y)),{x:b,y:k,scaleX:u,scaleY:p,rotation:v,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=y(s*s+o*o)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){b.set(t)}},b=x,{toInnerPoint:k,toOuterPoint:E}=x,{sin:B,cos:S,abs:R,sqrt:T,atan2:C,min:L,round:P,PI:O}=Math,A={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?P(t.x-.5)+.5:P(t.x),t.y=e?P(t.y-.5)+.5:P(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=S(e*=h),o=B(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 F(i,t),k(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=D;return F(i,t),E(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=D;return F(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){E(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)=>M(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const o=R(i-t),n=R(s-e);return T(o*o+n*n)},getMinDistanceFrom:(t,e,i,s,o,n)=>L(M(t,e,i,s),M(i,s,o,n)),getAngle:(t,e)=>I(t,e)/h,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)/h),getRadianFrom(t,e,i,s,o,n,r,a){void 0===r&&(r=i,a=s);let h=C(e-s,t-i);const d=C(n-a,o-r)-h;return d<-O?d+l:d},getAtan2:(t,e)=>C(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const o=I(t,e);return(e=s?e:{}).x=t.x+S(o)*i,e.y=t.y+B(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=A,{getDistanceFrom:M,copy:F,getAtan2:I}=D;class W{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?A.copy(this,t):A.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 A.move(this,t,e),this}scale(t,e){return A.scale(this,t,e),this}scaleOf(t,e,i){return A.scaleOf(this,t,e,i),this}rotate(t,e){return A.rotate(this,t,e),this}rotateOf(t,e){return A.rotate(this,e,t),this}getRotation(t,e,i){return A.getRotation(this,t,e,i)}toInnerOf(t,e){return A.toInnerOf(this,t,e),this}toOuterOf(t,e){return A.toOuterOf(this,t,e),this}getCenter(t){return new W(A.getCenter(this,t))}getDistance(t){return A.getDistance(this,t)}getDistancePoint(t,e,i){return new W(A.getDistancePoint(this,t,e,i))}getAngle(t){return A.getAngle(this,t)}getAtan2(t){return A.getAtan2(this,t)}reset(){return A.reset(this),this}}const z=new W;class N{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?x.copy(this,t):x.set(this,t,e,i,s,o,n),this}setWith(t){return x.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 N(this)}translate(t,e){return x.translate(this,t,e),this}translateInner(t,e){return x.translateInner(this,t,e),this}scale(t,e){return x.scale(this,t,e),this}scaleWith(t,e){return x.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return x.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return x.scaleOfInner(this,t,e,i),this}rotate(t){return x.rotate(this,t),this}rotateOfOuter(t,e){return x.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return x.rotateOfInner(this,t,e),this}skew(t,e){return x.skew(this,t,e),this}skewOfOuter(t,e,i){return x.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return x.skewOfInner(this,t,e,i),this}multiply(t){return x.multiply(this,t),this}multiplyParent(t){return x.multiplyParent(this,t),this}divide(t){return x.divide(this,t),this}divideParent(t){return x.divideParent(this,t),this}invert(){return x.invert(this),this}invertWith(){return x.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){x.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){x.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return x.setLayout(this,t,e,i),this}getLayout(t,e,i){return x.getLayout(this,t,e,i)}withScale(t,e){return x.withScale(this,t,e)}reset(){x.reset(this)}}const Y=new N,X={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){H(t,e,i),H(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:H}=X;var V,j;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(V||(V={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(j||(j={}));const G=[{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}];G.forEach((t=>t.type="percent"));const U={directionData:G,tempPoint:{},get:q,toPoint(t,e,i,s,o,n){const r=q(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)}};function q(t){return"string"==typeof t?G[j[t]]:t}const{toPoint:Z}=U,K={toPoint(t,e,i,s,o,n){Z(t,i,s,o,e,n)}},{tempPointBounds:J,setPoint:Q,addPoint:$,toBounds:tt}=X,{toOuterPoint:et}=x,{float:it,fourNumber:st}=r,{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||A.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){A.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),Q(J,ct.x,ct.y),dt.x=t.x+t.width,et(e,dt,ct),$(J,ct.x,ct.y),dt.y=t.y+t.height,et(e,dt,ct),$(J,ct.x,ct.y),dt.x=t.x,et(e,dt,ct),$(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 N(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,K.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?Q(J,t.x,t.y):$(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=A.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=A.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}=r;class bt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new bt(t)}static set filter(t){this.filterList=kt(t)}static set exclude(t){this.excludeList=kt(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(Et.enable){if(Et.filterList.length&&Et.filterList.every((t=>t!==this.name)))return;if(Et.excludeList.length&&Et.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Et.enable&&this.warn(...t)}warn(...t){Et.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 kt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}bt.filterList=[],bt.excludeList=[],bt.showWarn=!0;const Et=bt,Bt=bt.get("RunTime"),St={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,i){const s=e.create(e.RUNTIME);return Rt.currentId=Rt.idMap[s]=i?performance.now():Date.now(),Rt.currentName=Rt.nameMap[s]=t,Rt.nameToIdMap[t]=s,s},end(t,e){const i=Rt.idMap[t],s=Rt.nameMap[t],o=e?(performance.now()-i)/1e3:Date.now()-i;Rt.idMap[t]=Rt.nameMap[t]=Rt.nameToIdMap[s]=void 0,Bt.log(s,o,"ms")},endOfName(t,e){const i=Rt.nameToIdMap[t];void 0!==i&&Rt.end(i,e)}},Rt=St,Tt=[],Ct={list:{},add(t,...e){this.list[t]=!0,Tt.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((()=>Tt.forEach((t=>Ct.has(t,!0)))));const Lt={editor:t=>Ct.need("editor")},Pt=bt.get("UICreator"),Ot={list:{},register(t){const{__tag:e}=t.prototype;At[e]&&Pt.repeat(e),At[e]=t},get(t,e,i,s,o,n){At[t]||Pt.error("not register "+t);const r=new At[t](e);return void 0!==i&&(r.x=i,s&&(r.y=s),o&&(r.width=o),n&&(r.height=n)),r}},{list:At}=Ot,Dt=bt.get("EventCreator"),Mt={nameList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(Ft[e]&&Dt.repeat(e),Ft[e]=t)}))},changeName(t,e){const i=Ft[t];if(i){const s=Object.keys(i).find((e=>i[e]===t));s&&(i[s]=e,Ft[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Ft[t](...e)},{nameList:Ft}=Mt;class It{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=Lt.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 Nt{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 Yt;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(Yt||(Yt={}));const Xt={};function Ht(t){return null==t}function Vt(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 Gt(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 Ut(t){return(e,i)=>{t||(t=i),Object.defineProperty(e,i,{get(){return this.context[t]},set(e){this.context[t]=e}})}}"function"==typeof SuppressedError&&SuppressedError;const qt=[];function Zt(){return(t,e)=>{qt.push(e)}}const Kt=[];let Jt=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||Kt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;qt.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([Ut("imageSmoothingEnabled")],Jt.prototype,"smooth",void 0),jt([Ut("imageSmoothingQuality")],Jt.prototype,"smoothLevel",void 0),jt([Ut("globalAlpha")],Jt.prototype,"opacity",void 0),jt([Ut()],Jt.prototype,"fillStyle",void 0),jt([Ut()],Jt.prototype,"strokeStyle",void 0),jt([Ut("lineWidth")],Jt.prototype,"strokeWidth",void 0),jt([Ut("lineCap")],Jt.prototype,"strokeCap",void 0),jt([Ut("lineJoin")],Jt.prototype,"strokeJoin",void 0),jt([Ut("lineDashOffset")],Jt.prototype,"dashOffset",void 0),jt([Ut()],Jt.prototype,"miterLimit",void 0),jt([Ut()],Jt.prototype,"shadowBlur",void 0),jt([Ut()],Jt.prototype,"shadowColor",void 0),jt([Ut()],Jt.prototype,"shadowOffsetX",void 0),jt([Ut()],Jt.prototype,"shadowOffsetY",void 0),jt([Ut()],Jt.prototype,"filter",void 0),jt([Ut()],Jt.prototype,"font",void 0),jt([Ut()],Jt.prototype,"fontKerning",void 0),jt([Ut()],Jt.prototype,"fontStretch",void 0),jt([Ut()],Jt.prototype,"fontVariantCaps",void 0),jt([Ut()],Jt.prototype,"textAlign",void 0),jt([Ut()],Jt.prototype,"textBaseline",void 0),jt([Ut()],Jt.prototype,"textRendering",void 0),jt([Ut()],Jt.prototype,"wordSpacing",void 0),jt([Ut()],Jt.prototype,"letterSpacing",void 0),jt([Ut()],Jt.prototype,"direction",void 0),jt([Zt()],Jt.prototype,"setTransform",null),jt([Zt()],Jt.prototype,"resetTransform",null),jt([Zt()],Jt.prototype,"getTransform",null),jt([Zt()],Jt.prototype,"save",null),jt([Zt()],Jt.prototype,"restore",null),jt([Zt()],Jt.prototype,"translate",null),jt([Zt()],Jt.prototype,"scale",null),jt([Zt()],Jt.prototype,"rotate",null),jt([Zt()],Jt.prototype,"fill",null),jt([Zt()],Jt.prototype,"stroke",null),jt([Zt()],Jt.prototype,"clip",null),jt([Zt()],Jt.prototype,"fillRect",null),jt([Zt()],Jt.prototype,"strokeRect",null),jt([Zt()],Jt.prototype,"clearRect",null),jt([Zt()],Jt.prototype,"beginPath",null),jt([Zt()],Jt.prototype,"moveTo",null),jt([Zt()],Jt.prototype,"lineTo",null),jt([Zt()],Jt.prototype,"bezierCurveTo",null),jt([Zt()],Jt.prototype,"quadraticCurveTo",null),jt([Zt()],Jt.prototype,"closePath",null),jt([Zt()],Jt.prototype,"arc",null),jt([Zt()],Jt.prototype,"arcTo",null),jt([Zt()],Jt.prototype,"ellipse",null),jt([Zt()],Jt.prototype,"rect",null),jt([Zt()],Jt.prototype,"roundRect",null),jt([Zt()],Jt.prototype,"createConicGradient",null),jt([Zt()],Jt.prototype,"createLinearGradient",null),jt([Zt()],Jt.prototype,"createPattern",null),jt([Zt()],Jt.prototype,"createRadialGradient",null),jt([Zt()],Jt.prototype,"fillText",null),jt([Zt()],Jt.prototype,"measureText",null),jt([Zt()],Jt.prototype,"strokeText",null);const{copy:Qt,multiplyParent:$t}=x,{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}get pixelHeight(){return this.height*this.pixelRatio}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(i,s){super(),this.size={},this.worldTransform={},i||(i=ee),this.manager=s,this.innerId=e.create(e.CNAVAS);const{width:o,height:n,pixelRatio:r}=i;this.autoLayout=!o||!n,this.size.pixelRatio=r|t.devicePixelRatio,this.config=i,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&&$t(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){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i)}setStrokeOptions(t){this.strokeCap="none"===t.strokeCap?"butt":t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,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")}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(mt.x,mt.y,mt.width,mt.height)}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(mt.x,mt.y,mt.width,mt.height),this.clip()}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):Lt.canvas(Object.assign({},i));return o.save(),t&&(Qt(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 a=r.fourNumber(n,Math.min(s/2,o/2)),h=e+s,l=i+o;a[0]?t.moveTo(e+a[0],i):t.moveTo(e,i),a[1]?t.arcTo(h,i,h,l,a[1]):t.lineTo(h,i),a[2]?t.arcTo(h,l,e,l,a[2]):t.lineTo(h,l),a[3]?t.arcTo(e,l,e,i,a[3]):t.lineTo(e,l),a[0]?t.arcTo(e,i,h,i,a[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:ke}=X,{set:Ee,toNumberPoints:Be}=A,{M:Se,L:Re,C:Te,Q:Ce,Z:Le}=re,Pe={},Oe={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(Ce,d,c,r,a):t.push(Te,u,p,d,c,r,a),u=r+g*h,p=a+g*l);s||t.push(Ce,u,p,o[y-2],o[y-1])}else for(let e=2,i=o.length;e<i;e+=2)t.push(Re,o[e],o[e+1]);s&&t.push(Le)},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,c,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+=l),w===ve||me(_+g)<1e-12||me(f+y)<1e-12)return t&&t.push(Re,s,o),c&&(be(c,e,i),ke(c,s,o)),p&&Ee(p,e,i),void(u&&Ee(u,s,o));const x=_*y-f*g<0,b=x?-1:1,k=a/ge(w/2),E=s+k*ge(m+w/2+d*b),B=o+k*_e(m+w/2+d*b);return m-=d*b,v-=d*b,Me(t,E,B,a,a,0,m/h,v/h,x,c,u,p)},arc:(t,e,i,s,o,n,r,a,h,l)=>Me(t,e,i,s,s,0,o,n,r,a,h,l),ellipse(t,e,i,s,o,n,r,a,c,u,p,_){const g=n*h,f=_e(g),y=ge(g);let m=r*h,v=a*h;m>ve&&(m-=l),v<0&&(v+=l);let w=v-m;w<0?w+=l:w>l&&(w-=l),c&&(w-=l);const x=ye(me(w/d)),b=w/x,k=_e(b/4),E=8/3*k*k/_e(b/2);v=m+b;let B,S,R,T,C,L,P,O,A=ge(m),D=_e(m),M=R=y*s*A-f*o*D,F=T=f*s*A+y*o*D,I=e+R,W=i+T;t&&t.push(t.length?Re:Se,I,W),u&&be(u,I,W),_&&Ee(_,I,W);for(let n=0;n<x;n++)B=ge(v),S=_e(v),R=y*s*B-f*o*S,T=f*s*B+y*o*S,C=e+M-E*(y*s*D+f*o*A),L=i+F-E*(f*s*D-y*o*A),P=e+R+E*(y*s*S+f*o*B),O=i+T+E*(f*s*S-y*o*B),t&&t.push(Te,C,L,P,O,e+R,i+T),u&&De(e+M,i+F,C,L,P,O,e+R,i+T,u,!0),M=R,F=T,A=B,D=S,m=v,v+=b;p&&Ee(p,e+R,i+T)},quadraticCurveTo(t,e,i,s,o,n,r){t.push(Te,(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?ke(h,t,e):be(h,t,e),ke(h,r,a);for(let l=0,c=d.length;l<c;l++)Ae(d[l],t,e,i,s,o,n,r,a,Pe),ke(h,Pe.x,Pe.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 Ae(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:Ae,toTwoPointBounds:De,ellipse:Me}=Oe,{sin:Fe,cos:Ie,sqrt:We,atan2:ze}=Math,{ellipse:Ne}=Oe,Ye={ellipticalArc(e,i,s,o,n,r,a,d,c,u,p){const _=(c-i)/2,g=(u-s)/2,f=r*h,y=Fe(f),m=Ie(f),v=-m*_-y*g,w=-m*g+y*_,x=o*o,b=n*n,k=w*w,E=v*v,B=x*b-x*k-b*E;let S=0;if(B<0){const t=We(1-B/(x*b));o*=t,n*=t}else S=(a===d?-1:1)*We(B/(x*k+b*E));const R=S*o*w/n,T=-S*n*v/o,C=ze((w-T)/n,(v-R)/o),L=ze((-w-T)/n,(-v-R)/o);let P=L-C;0===d&&P>0?P-=l:1===d&&P<0&&(P+=l);const O=i+_+m*R-y*T,A=s+g+y*R+m*T,D=P<0?1:0;p||t.ellipseToCurve?Ne(e,O,A,o,n,r,C/h,L/h,D):o!==n||r?e.push(re.G,O,A,o,n,r,C/h,L/h,D):e.push(re.O,O,A,o,C/h,L/h,D)}},{M:Xe,m:He,L:Ve,l:je,H:Ge,h:Ue,V:qe,v:Ze,C:Ke,c:Je,S:Qe,s:$e,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}=Oe,{ellipticalArc:bi}=Ye,ki=bt.get("PathConvert"),Ei={},Bi={current:{dot:0},stringify(t,e){let i,s,o,n=0,a=t.length,h="";for(;n<a;){s=t[n],i=ue[s],h+=s===o?" ":ce[s];for(let s=1;s<i;s++)h+=r.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&&(Ri(r,n),n=""),Si.dot++),"0"===n&&"."!==s&&(Ri(r,n),n=""),n+=s):re[s]?(n&&(Ri(r,n),n=""),Si.name=re[s],Si.length=ae[s],Si.index=0,Ri(r,Si.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===o||"E"===o?n+=s:(n&&Ri(r,n),n=s):n&&(Ri(r,n),n=""),o=s;return n&&Ri(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 He: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 Ue:t[c+1]+=a;case Ge:a=t[c+1],p.push(Ve,a,h),c+=2;break;case Ze:t[c+1]+=h;case qe:h=t[c+1],p.push(Ve,a,h),c+=2;break;case je:t[c+1]+=a,t[c+2]+=h;case Ve:a=t[c+1],h=t[c+2],p.push(Ve,a,h),c+=3;break;case $e:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=Qe;case Qe:r=n===Ke||n===Qe,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(Ke,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=Ke;case Ke:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(Ke,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]):Ti(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]]):Ti(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]):Ti(p,t,c,6),c+=6;break;case ci:wi(e?p:Ti(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,Ei),a=Ei.x,h=Ei.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):Ti(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case pi:vi(e?p:Ti(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ei),a=Ei.x,h=Ei.y,c+=7;break;case _i:e?vi(p,t[c+1],t[c+2],t[c+3],0,360,!1):Ti(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case gi:mi(e?p:Ti(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ei),a=Ei.x,h=Ei.y,c+=6;break;default:return ki.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(Xe,t.x,t.y);break;case"L":e.push(Ve,t.x,t.y);break;case"C":e.push(Ke,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:Ri,copyData:Ti}=Bi,{M:Ci,L:Li,C:Pi,Q:Oi,Z:Ai,N:Di,D:Mi,X:Fi,G:Ii,F:Wi,O:zi,P:Ni,U:Yi}=re,{getMinDistanceFrom:Xi,getRadianFrom:Hi}=A,{tan:Vi,min:ji,abs:Gi}=Math,Ui={},qi={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Ci,e,i)},lineTo(t,e,i){t.push(Li,e,i)},bezierCurveTo(t,e,i,s,o,n,r){t.push(Pi,e,i,s,o,n,r)},quadraticCurveTo(t,e,i,s,o){t.push(Oi,e,i,s,o)},closePath(t){t.push(Ai)},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(Fi,e,i,s,o,n);else{const a=r.fourNumber(n);a?t.push(Mi,e,i,s,o,...a):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(Ii,e,i,s,o,n,r,a,h?1:0))},arc(t,e,i,s,o,n,r){void 0===o?t.push(Ni,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=Xi(r,a,e,i,s,o);n=ji(n,ji(t/2,t/2*Gi(Vi(Hi(r,a,e,i,s,o)/2))))}t.push(Yi,e,i,s,o,n)},drawEllipse(t,e,i,s,o,n,r,a,h){Oe.ellipse(null,e,i,s,o,void 0===n?0:n,void 0===r?0:r,void 0===a?360:a,h,null,null,Ui),t.push(Ci,Ui.x,Ui.y),Zi(t,e,i,s,o,n,r,a,h)},drawArc(t,e,i,s,o,n,r){Oe.arc(null,e,i,s,void 0===o?0:o,void 0===n?360:n,r,null,null,Ui),t.push(Ci,Ui.x,Ui.y),Ki(t,e,i,s,o,n,r)},drawPoints(t,e,i,s){Oe.points(t,e,i,s)}},{ellipse:Zi,arc:Ki}=qi,{moveTo:Ji,lineTo:Qi,quadraticCurveTo:$i,bezierCurveTo:ts,closePath:es,beginPath:is,rect:ss,roundRect:os,ellipse:ns,arc:rs,arcTo:as,drawEllipse:hs,drawArc:ls,drawPoints:ds}=qi;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 Qi(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 $i(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:ks,U:Es}=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]*h,e[s+6]*h,e[s+7]*h,e[s+8]),s+=9;break;case xs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,l,!1),s+=5;break;case bs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*h,e[s+5]*h,e[s+6]),s+=7;break;case ks:t.arc(e[s+1],e[s+2],e[s+3],0,l,!1),s+=4;break;case Es: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:Rs,L:Ts,C:Cs,Q:Ls,Z:Ps,N:Os,D:As,X:Ds,G:Ms,F:Fs,O:Is,P:Ws,U:zs}=re,{toTwoPointBounds:Ns,toTwoPointBoundsByQuadraticCurve:Ys,arcTo:Xs,arc:Hs,ellipse:Vs}=Oe,{addPointBounds:js,copy:Gs,addPoint:Us,setPoint:qs,addBounds:Zs,toBounds:Ks}=X,Js=bt.get("PathBounds");let Qs,$s,to;const eo={},io={},so={},oo={toBounds(t,e){oo.toTwoPointBounds(t,io),Ks(io,e)},toTwoPointBounds(t,e){if(!t||!t.length)return qs(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===Ps||r===Cs||r===Ls?qs(e,h,l):qs(e,t[a+1],t[a+2])),r){case Rs:case Ts:h=t[a+1],l=t[a+2],Us(e,h,l),a+=3;break;case Cs:o=t[a+5],n=t[a+6],Ns(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 Ls:i=t[a+1],s=t[a+2],o=t[a+3],n=t[a+4],Ys(h,l,i,s,o,n,eo),js(e,eo),h=o,l=n,a+=5;break;case Ps:a+=1;break;case Os:h=t[a+1],l=t[a+2],Zs(e,h,l,t[a+3],t[a+4]),a+=5;break;case As:case Ds:h=t[a+1],l=t[a+2],Zs(e,h,l,t[a+3],t[a+4]),a+=r===As?9:6;break;case Ms:Vs(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?Gs(e,eo):js(e,eo),h=so.x,l=so.y,a+=9;break;case Fs:h=t[a+1],l=t[a+2],$s=t[a+3],to=t[a+4],Zs(e,h-$s,l-to,2*$s,2*to),h+=$s,a+=5;break;case Is:Hs(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],eo,so),0===a?Gs(e,eo):js(e,eo),h=so.x,l=so.y,a+=7;break;case Ws:h=t[a+1],l=t[a+2],Qs=t[a+3],Zs(e,h-Qs,l-Qs,2*Qs,2*Qs),h+=Qs,a+=4;break;case zs:Xs(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],eo,so),0===a?Gs(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}=A,{arcTo:co}=qi,uo={smooth(t,e,i){let s,o,n=0,r=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0;const _=t.length,g=[];for(;n<_;)switch(s=t[n],s){case no:h=u=t[n+1],l=p=t[n+2],n+=3,t[n]===ro?(d=t[n+1],c=t[n+2],g.push(no,ho(h,d),lo(l,c))):g.push(no,h,l);break;case ro:switch(r=t[n+1],a=t[n+2],n+=3,t[n]){case ro:co(g,r,a,t[n+1],t[n+2],e,u,p);break;case ao:co(g,r,a,h,l,e,u,p);break;default:g.push(ro,r,a)}u=r,p=a;break;case ao:co(g,h,l,d,c,e,u,p),g.push(ao),n+=1;break;default:o=ue[s];for(let e=0;e<o;e++)g.push(t[n+e]);n+=o}return s!==ao&&(g[1]=h,g[2]=l),g}};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=e.create(e.TASK),this.task=t}run(){return Gt(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 ko.tasker.isComplete},set(t,e){ko.map[t]&&xo.repeat(t),ko.map[t]=e},get:t=>ko.map[t],remove(t){const e=ko.map[t];e&&(e.destroy&&e.destroy(),delete ko.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=Lt.image(s)),ko.set(t,e),e},destroy(){ko.map={}}},ko=bo,Eo={maxRecycled:10,recycledList:[],patternTasker:new wo,get(t){let e=bo.get(t.url);return e||bo.set(t.url,e=Lt.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=Eo,{IMAGE:So,create:Ro}=e;class To{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Ro(So),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Eo.isFormat("svg",t)&&(this.isSVG=!0),Eo.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(e,i){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:i}=t.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(e=i),bo.tasker.add((()=>Gt(this,void 0,void 0,(function*(){return yield e(this.url,s).then((t=>this.setView(t))).catch((t=>{this.error=t,this.onComplete(!1)}))}))))}return this.waitComplete.push(e,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(e,i,s,o){if(e||(e=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=t.origin.createCanvas(e,i),r=n.getContext("2d");return s&&(r.globalAlpha=s),r.drawImage(this.view,0,0,e,i),this.cache=this.use>1?{data:n,params:arguments}:null,n}getPattern(e,i,s,o){const n=t.canvas.createPattern(e,i);try{s&&n.setTransform&&(n.setTransform(s),s=null)}catch(t){}return o&&(o.transform=s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Co(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Lo(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Po(t,e){return(i,s)=>Ao(i,s,t,e&&e(s))}function Oo(t){return t}function Ao(t,e,i,s){const o={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Co(t,e,Object.assign(o,s||{})),an(t,e,i)}function Do(t){return Po(t)}function Mo(t,e){return Po(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function Fo(t){return Po(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Yo(this))}})))}function Io(t,e){return Po(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Wo(t,e){return Po(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function zo(t,e){return Po(t,(t=>({set(i){this.__setAttr(t,i,e)&&Yo(this)}})))}function No(t){return Po(t,(t=>({set(e){this.__setAttr(t,e)&&(Yo(this),this.__.__removeNaturalSize())}})))}function Yo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Xo(t){return Po(t,(t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Yo(this)}})))}const Ho=zo;function Vo(t){return Po(t,(t=>({set(e){this.__setAttr(t,e)&&jo(this)}})))}function jo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Yo(t)}const Go=Vo;function Uo(t){return Po(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function qo(t){return Po(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function Zo(t){return Po(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Jo(this)}})))}function Ko(t){return Po(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&&Jo(this)}})))}function Jo(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||Yo(t))}function $o(t){return Po(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function tn(t){return Po(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function en(t){return Po(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function sn(t){return Po(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 on(t){return Po(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function nn(t){return(e,i)=>{Co(e,"__DataProcessor",{get:()=>t})}}function rn(t){return(e,i)=>{Co(e,"__LayoutProcessor",{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={get(){const t=this[o];return void 0===t?i:t},set(t){this[o]=t}};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=Vt(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=Lo(l,e),l=l.__proto__;h&&h.set&&(r.set=h.set),s[n]&&(r.set=s[n],delete s[n]),Co(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){Lo(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]}))}}function gn(){return t=>{Ot.register(t)}}function fn(){return t=>{Mt.register(t)}}setTimeout((()=>pn(!0)));const{copy:yn,toInnerPoint:mn,toOuterPoint:vn,scaleOfOuter:wn,rotateOfOuter:xn,skewOfOuter:bn,multiplyParent:kn,divideParent:En,getLayout:Bn}=x,Sn={},{round:Rn}=Math,Tn={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Pn(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,o=s.length;t<o;t++)Ln(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++)On(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&On(t),t.__updateChange()},updateAllChange(t){if(Dn(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)An(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},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),Cn.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=Rn(e),i=Rn(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,o,n){Cn.zoomOfLocal(t,Mn(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)Cn.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){Cn.rotateOfLocal(t,Mn(t,e),i,s)},rotateOfLocal(t,e,i,s){const o=t.__localMatrix;yn(Sn,o),xn(Sn,e,i),t.origin||t.around?Cn.setTransform(t,Sn,!1,s):t.set({x:t.x+Sn.e-o.e,y:t.y+Sn.f-o.f,rotation:r.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,o,n){Cn.skewOfLocal(t,Mn(t,e),i,s,o,n)},skewOfLocal(t,e,i,s=0,o,n){yn(Sn,t.__localMatrix),bn(Sn,e,i,s),Cn.setTransform(t,Sn,o,n)},transformWorld(t,e,i,s){yn(Sn,t.worldTransform),kn(Sn,e),t.parent&&En(Sn,t.parent.worldTransform),Cn.setTransform(t,Sn,i,s)},transform(t,e,i,s){yn(Sn,t.localTransform),kn(Sn,e),Cn.setTransform(t,Sn,i,s)},setTransform(t,e,i,s){const o=t.__,n=o.origin&&Cn.getInnerOrigin(t,o.origin),r=Bn(e,n,o.around&&Cn.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=Cn.getInnerOrigin(t,o.origin);A.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,Cn.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>A.tempToOuterOf(Cn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return U.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(yn(Sn,t.worldTransform),En(Sn,e.worldTransform),i?Sn:Object.assign({},Sn)),drop(t,e,i,s){t.setTransform(Cn.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}}},Cn=Tn,{updateAllMatrix:Ln,updateMatrix:Pn,updateAllWorldOpacity:On,updateAllChange:An,updateChange:Dn}=Cn;function Mn(t,e){return t.__layout.update(),t.parent?A.tempToInnerOf(e,t.parent.__world):e}const Fn={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:In}=Tn,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++)Nn(e[t],e)},updateBounds(t,e){const i=[t];Nn(t,i),Yn(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++)In(s[t]);e&&e===i||In(i)}}},{pushAllChildBranch:zn,pushAllBranchStack:Nn,updateBoundsByBranchStack:Yn}=Wn,Xn={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:Hn,updateBounds:Vn}=Tn,{toOuterOf:jn,getPoints:Gn,copy:Un}=pt,qn="_localContentBounds",Zn="_worldContentBounds",Kn="_worldBoxBounds",Jn="_worldStrokeBounds";class Qn{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[qn]||(this[qn]={})),this[qn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return jn(this.contentBounds,this.leaf.__world,this[Zn]||(this[Zn]={})),this[Zn]}get worldBoxBounds(){return jn(this.boxBounds,this.leaf.__world,this[Kn]||(this[Kn]={})),this[Kn]}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:e}=this,{leafer:i}=e;if(e.isApp)return Vn(e);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=e;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,t.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return x.defaultMatrix;case"page":t=e.zoomLayer;default:return Hn(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=x.defaultMatrix;break;case"page":e=s.zoomLayer;default:o=s.getWorldPoint(a,e),n=Hn(s,e,!0)}if(r||(r=x.getLayout(n)),Un(r,a),A.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=Gn(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 $n{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class tr extends $n{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 $n{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 $n{constructor(t,e){super(t),Object.assign(this,e)}}ir.LOAD="image.load",ir.LOADED="image.loaded",ir.ERROR="image.error";class sr extends $n{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 $n{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 $n{constructor(t,e){super(t),this.data=e}}dr.REQUEST="watch.request",dr.DATA="watch.data";class cr extends $n{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 $n{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 $n{}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&&Mt.has(t)&&(e=Mt.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:kr,hasEvent:Er,destroy:Br}=gr.prototype,Sr={on:yr,on_:mr,off:vr,off_:wr,once:xr,emit:br,emitEvent:kr,hasEvent:Er,destroyEventer:Br},{isFinite:Rr}=Number,Tr=bt.get("setAttr"),Cr={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(i&&!Rr(e)&&void 0!==e&&(Tr.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:Lr,multiplyParent:Pr,translateInner:Or,defaultWorld:Ar}=x,{toPoint:Dr,tempPoint:Mr}=U,Fr={__updateWorldMatrix(){Pr(this.__local||this.__layout,this.parent?this.parent.__world:Ar,this.__world,!!this.__layout.affectScaleOrRotation,this.__,this.parent&&this.parent.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized="scale")||t.rotationChanged)&&(Lr(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,Mr),Or(e,-Mr.x,-Mr.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ir,updateAllMatrix:Wr}=Tn,{updateBounds:zr}=Wn,{toOuterOf:Nr,copyAndSpread:Yr,copy:Xr}=pt,{toBounds:Hr}=oo,Vr={__updateWorldBounds(){const t=this.__layout;Nr(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(),Nr(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Nr(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Nr(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Hr(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))):Ir(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Yr(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Yr(t.renderBounds,t.boxBounds,t.renderSpread):Xr(t.renderBounds,t.strokeBounds)}},jr={__render(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),this.__worldFlipped?t.copyWorldByReset(s,this.__nowWorld,null,i.__blendMode,!0):t.copyWorldToInner(s,this.__nowWorld,this.__layout.renderBounds,i.__blendMode),s.recycle(this.__nowWorld)}else this.__draw(t,e);bt.showBounds&&bt.drawBounds(this,t,e)}},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),this.windingRule?t.clip(this.windingRule):t.clip())},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Gr}=Fn,Ur={__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){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++)Gr(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++)Gr(i[s],e)||i[s].__clip(t,e)}}},{LEAF:qr,create:Zr}=e,{toInnerPoint:Kr,toOuterPoint:Jr,multiplyParent:Qr}=x,{toOuterOf:$r}=pt,{copy:ta,move:ea}=A,{moveLocal:ia,zoomOfLocal:sa,rotateOfLocal:oa,skewOfLocal:na,moveWorld:ra,zoomOfWorld:aa,rotateOfWorld:ha,skewOfWorld:la,transform:da,transformWorld:ca,setTransform:ua,getFlipTransform:pa,getLocalOrigin:_a,getRelativeWorld:ga,drop:fa}=Tn;let ya=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return Nt}get __LayoutProcessor(){return Qn}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=Zr(qr),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),$r(this.__layout.renderBounds,e,e),e.half!==i.half&&(e.half=i.half),e}return this.__world}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?ga(this,e):this.worldTransform,o=i?t:{};return $r(t,s,o),o}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&ta(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&ta(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Kr(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){Jr(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 ea(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 ea(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){ua(this,t,e,i)}transform(t,e,i){da(this,t,e,i)}move(t,e,i){ia(this,t,e,i)}moveInner(t,e,i){ra(this,t,e,!0,i)}scaleOf(t,e,i,s,o){sa(this,_a(this,t),e,i,s,o)}rotateOf(t,e,i){oa(this,_a(this,t),e,i)}skewOf(t,e,i,s,o){na(this,_a(this,t),e,i,s,o)}transformWorld(t,e,i){ca(this,t,e,i)}moveWorld(t,e,i){ra(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,o){aa(this,t,e,i,s,o)}rotateOfWorld(t,e){ha(this,t,e)}skewOfWorld(t,e,i,s,o){la(this,t,e,i,s,o)}flip(t,e){da(this,pa(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,i,s){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Ct.need("path")}getMotionPoint(t){return Ct.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){fa(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=zo),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)}};ya=jt([_n(Cr),_n(Fr),_n(Vr),_n(Sr),_n(jr)],ya);const{setListWithFn:ma}=pt,{sort:va}=Wn,{localBoxBounds:wa,localStrokeBounds:xa,localRenderBounds:ba,maskLocalBoxBounds:ka,maskLocalStrokeBounds:Ea,maskLocalRenderBounds:Ba}=Fn,Sa=new bt("Branch");let Ra=class extends ya{__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?ka:wa)}__updateStrokeBounds(){ma(this.__layout.strokeBounds,this.children,this.__hasMask?Ea: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=Ot.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)}};Ra=jt([_n(Ur)],Ra);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 Ca{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}}const La="1.6.3";class Pa extends se{get allowBackgroundColor(){return!1}init(){const{config:e}=this;let i=e.view||e.canvas;i?("string"==typeof i?("#"!==i[0]&&(i="#"+i),this.viewSelect=t.miniapp.select(i)):i.fields?this.viewSelect=i:this.initView(i),this.viewSelect&&t.miniapp.getSizeView(this.viewSelect).then((t=>{this.initView(t)}))):this.initView()}initView(e){e?this.view=e.view||e:(e={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:i,height:s,pixelRatio:o}=this.config,n={width:i||e.width,height:s||e.height,pixelRatio:o};this.resize(n),this.context&&(this.viewSelect&&(t.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,o){this.context.roundRect(t,e,i,s,"number"==typeof o?[o]:o)}),go(this.context.__proto__))}__createView(){this.view=t.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)}updateClientBounds(e){this.viewSelect&&t.miniapp.getBounds(this.viewSelect).then((t=>{this.clientBounds=t,e&&e()}))}startAutoLayout(e,i){this.resizeListener=i,e&&(this.checkSize=this.checkSize.bind(this),t.miniapp.onWindowResize(this.checkSize))}checkSize(){this.viewSelect&&setTimeout((()=>{this.updateClientBounds((()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)}))}),500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,t.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};Wt.copyAttrs(e,this,ie),this.resize(t),void 0!==this.width&&this.resizeListener(new lr(t,e))}}const{mineType:Oa,fileType:Aa}=fo;function Da(e,i){t.origin={createCanvas:(t,e,s)=>{const o={type:"2d",width:t,height:e};return i.createOffscreenCanvas?i.createOffscreenCanvas(o):i.createOffScreenCanvas(o)},canvasToDataURL:(t,e,i)=>t.toDataURL(Oa(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(e,i,s)=>{let o=e.toDataURL(Oa(Aa(i)),s);return o=o.substring(o.indexOf("64,")+3),t.origin.download(o,i)},download:(e,s)=>new Promise(((o,n)=>{let r;s.includes("/")||(s=`${i.env.USER_DATA_PATH}/`+s,r=!0);const a=i.getFileSystemManager();a.writeFile({filePath:s,data:e,encoding:"base64",success(){r?t.miniapp.saveToAlbum(s).then((()=>{a.unlink({filePath:s}),o()})):o()},fail(t){n(t)}})})),loadImage:e=>new Promise(((i,s)=>{const o=t.canvas.view.createImage();o.onload=()=>{i(o)},o.onerror=t=>{s(t)},o.src=t.image.getRealURL(e)})),noRepeat:"repeat-x"},t.miniapp={select:t=>i.createSelectorQuery().select(t),getBounds:t=>new Promise((e=>{t.boundingClientRect().exec((t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})}))})),getSizeView:t=>new Promise((e=>{t.fields({node:!0,size:!0}).exec((t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})}))})),saveToAlbum:t=>new Promise((e=>{i.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):i.authorize({scope:"scope.writePhotosAlbum",success:()=>{i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})})),onWindowResize(t){i.onWindowResize(t)},offWindowResize(t){i.offWindowResize(t)}},t.event={stopDefault(t){},stopNow(t){},stop(t){}},t.canvas=Lt.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(Lt,{canvas:(t,e)=>new Pa(t,e),image:t=>new To(t)}),t.name="miniapp",t.requestRender=function(e){const{view:i}=t.renderCanvas||t.canvas;i.requestAnimationFrame?i.requestAnimationFrame(e):setTimeout(e,16)},Co(t,"devicePixelRatio",{get:()=>Math.max(1,wx.getSystemInfoSync().pixelRatio)});class Ma{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:Fa,updateBounds:Ia,updateChange:Wa}=Tn,{pushAllChildBranch:za,pushAllParent:Na}=Wn;const{worldBounds:Ya}=Fn;class Xa{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,Ya)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ya),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:Va}=Tn,ja=bt.get("Layouter");class Ga{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new Ca,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){ja.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?ja.warn("layouting"):this.times>3?ja.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?(Fa(t,!0),e.add(t),t.isBranch&&za(t,e),Na(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Na(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(Wa)}(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)),Ga.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):Tn.updateBounds(t),Va(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Xa([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Xa(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 Ua=bt.get("Renderer");class qa{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,Ua.log(e.innerName,"---\x3e");try{this.emitRender(ur.START),this.renderOnce(t),this.emitRender(ur.END,this.totalBounds),Eo.clearRecycled()}catch(t){this.rendering=!1,Ua.error(t)}Ua.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ua.warn("rendering");if(this.times>3)return Ua.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(qa.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 e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now();t.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||Ua.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)}}qa.clipSpread=10;const{hitRadiusPoint:Za}=pt;class Ka{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||Tn.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||Za(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 Ja{constructor(t,e){this.config={},e&&(this.config=Wt.default(e,this.config)),this.picker=new Ka(this.target=t,this),this.finder=Lt.finder&&Lt.finder()}getByPoint(e,i,s){const{target:o,picker:n}=this;return t.backgrounder&&o&&o.updateLayout(),n.getByPoint(e,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Ct.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Qa(t){return Po(t,(t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function $a(t){return Po(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function th(){return(t,e)=>{const i="_"+e;Co(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(Lt,{watcher:(t,e)=>new Ma(t,e),layouter:(t,e)=>new Ga(t,e),renderer:(t,e,i)=>new qa(t,e,i),selector:(t,e)=>new Ja(t,e)}),t.layout=Ga.fullLayout;const eh={},ih={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}},sh={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},oh={},nh={},rh={},ah={},hh={},lh={apply(){Ct.need("filter")}},dh={},ch={setStyleName:()=>Ct.need("state"),set:()=>Ct.need("state")},uh={list:{},register(t,e){uh.list[t]=e},get:t=>uh.list[t]},{parse:ph,objectToCanvasData:_h}=Bi,{stintSet:gh}=Wt,{hasTransparent:fh}=ih,yh={},mh=bt.get("UIData");class vh extends Nt{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){const{strokeWidth:t,strokeWidthFixed:e}=this;if(e){const e=this.__leaf;let{scaleX:i}=e.__nowWorld||e.__world;return i<0&&(i=-i),i>1?t/i:t}return t}get __hasStroke(){return this.stroke&&this.strokeWidth}get __hasHalf(){const t=this;return t.stroke&&"center"===t.strokeAlign&&t.strokeWidth%2||void 0}get __hasMultiPaint(){const t=this;return!!(t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect)||t.fill&&this.__hasStroke}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,mh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,mh.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):(gh(this,"__isTransparentFill",fh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("stroke",t):(gh(this,"__isTransparentStroke",fh(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?ph(t):_h(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){wh(this,"shadow",t)}setInnerShadow(t){wh(this,"innerShadow",t)}setFilter(t){wh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&nh.compute("fill",this.__leaf),e&&nh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__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=yh)):(this.__isStrokes=!0,this._stroke||(this._stroke=yh))}__removePaint(t,e){e&&this.__removeInput(t),rh.recycleImage(t,this),"fill"===t?(gh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(gh(this,"__isAlphaPixelStroke",void 0),this._stroke=this.__isStrokes=void 0)}}function wh(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 xh extends vh{}class bh extends xh{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){const t=this;return"hide"===t.overflow&&(t.__clipAfterFill||t.innerShadow)&&t.__leaf.children.length}get __clipAfterFill(){return this.__leaf.isOverflow||super.__clipAfterFill}}class kh extends xh{__getInputData(t,e){const i=super.__getInputData(t,e);return ie.forEach((t=>delete i[t])),i}}class Eh extends bh{}class Bh extends vh{}class Sh extends vh{get __boxStroke(){return!this.__pathInputed}}class Rh extends vh{get __boxStroke(){return!this.__pathInputed}}class Th extends vh{}class Ch extends vh{}class Lh extends vh{get __pathInputed(){return 2}}class Ph extends xh{}const Oh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Ah extends vh{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),t=Oh[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=Ot.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 Dh extends Sh{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 Mh extends Sh{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 Fh={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,strokeWidth: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}=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+=lh.getSpread(n));let r=t=Math.ceil(t);return i&&i.forEach((t=>r=Math.max(r,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur))),o&&(r=Math.max(r,o)),this.__layout.renderShapeSpread=r,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{stintSet:Ih}=Wt,Wh={__updateChange(){const t=this.__;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&&!(e[0].box&&t.__isTransparentFill)&&i&&!(i instanceof Array&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}Ih(this.__world,"half",t.__hasHalf),Ih(t,"__fillAfterStroke",t.stroke&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill),t.__checkSingle(),Ih(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){zh(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=nh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&hh.shadow(this,t,h),a&&(s.__isStrokes?nh.strokes(n,this,t):nh.stroke(n,this,t)),o&&(s.__isFills?nh.fills(o,this,t):nh.fill(o,this,t)),r&&this.__drawAfterFill(t,e),d&&hh.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?nh.strokes(n,this,t):nh.stroke(n,this,t)),c&&lh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?nh.strokes(n,this,t):nh.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,ih.string(e.color))}o&&(s.__isFills?nh.fills(o,this,t):nh.fill(o,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?nh.strokes(n,this,t):nh.stroke(n,this,t))}}else s.__pathInputed?zh(this,t,e):this.__drawFast(t,e)},__renderShape(t,e,i,s){if(this.__worldOpacity){t.setWorld(this.__nowWorld=this.__getNowWorld(e));const{fill:o,stroke:n}=this.__;this.__drawRenderPath(t),o&&!i&&(this.__.__isAlphaPixelFill?nh.fills(o,this,t):nh.fill("#000000",this,t)),this.__.__isCanvas&&this.__drawAfterFill(t,e),n&&!s&&(this.__.__isAlphaPixelStroke?nh.strokes(n,this,t):nh.stroke("#000000",this,t))}},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),this.windingRule?t.clip(this.windingRule):t.clip(),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function zh(t,e,i){const{fill:s,stroke:o,__drawAfterFill:n,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&nh.stroke(o,t,e),s&&nh.fill(s,t,e),n&&t.__drawAfterFill(e,i),o&&!r&&nh.stroke(o,t,e)}const Nh={__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 Yh;let Xh=Yh=class extends ya{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){r.assignScale(this,t)}get scale(){return this.__.scale}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 Ct.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Ct.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||dh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){if(this.__.path){const t=this.__;t.__pathForRender=t.cornerRadius?uo.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&oh.addArrows(this,!t.cornerRadius)}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?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){nh.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return Ct.need("animate")}killAnimate(t,e){}export(t,e){return Ct.need("export")}syncExport(t,e){return Ct.need("export")}clone(t){const e=Wt.clone(this.toJSON());return t&&Object.assign(e,t),Yh.one(e)}static one(t,e,i,s,o){return Ot.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){gn()(this)}static registerData(t){nn(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([nn(vh)],Xh.prototype,"__",void 0),jt([th()],Xh.prototype,"zoomLayer",void 0),jt([Do("")],Xh.prototype,"id",void 0),jt([Do("")],Xh.prototype,"name",void 0),jt([Do("")],Xh.prototype,"className",void 0),jt([qo("pass-through")],Xh.prototype,"blendMode",void 0),jt([Zo(1)],Xh.prototype,"opacity",void 0),jt([Ko(!0)],Xh.prototype,"visible",void 0),jt([qo(!1)],Xh.prototype,"locked",void 0),jt([qo(!1)],Xh.prototype,"dim",void 0),jt([qo(!1)],Xh.prototype,"dimskip",void 0),jt([$o(0)],Xh.prototype,"zIndex",void 0),jt([tn(!1)],Xh.prototype,"mask",void 0),jt([en(!1)],Xh.prototype,"eraser",void 0),jt([Mo(0,!0)],Xh.prototype,"x",void 0),jt([Mo(0,!0)],Xh.prototype,"y",void 0),jt([zo(100,!0)],Xh.prototype,"width",void 0),jt([zo(100,!0)],Xh.prototype,"height",void 0),jt([Io(1,!0)],Xh.prototype,"scaleX",void 0),jt([Io(1,!0)],Xh.prototype,"scaleY",void 0),jt([Wo(0,!0)],Xh.prototype,"rotation",void 0),jt([Wo(0,!0)],Xh.prototype,"skewX",void 0),jt([Wo(0,!0)],Xh.prototype,"skewY",void 0),jt([Mo(0,!0)],Xh.prototype,"offsetX",void 0),jt([Mo(0,!0)],Xh.prototype,"offsetY",void 0),jt([Mo(0,!0)],Xh.prototype,"scrollX",void 0),jt([Mo(0,!0)],Xh.prototype,"scrollY",void 0),jt([Fo()],Xh.prototype,"origin",void 0),jt([Fo()],Xh.prototype,"around",void 0),jt([Do(!1)],Xh.prototype,"lazy",void 0),jt([No(1)],Xh.prototype,"pixelRatio",void 0),jt([Xo()],Xh.prototype,"path",void 0),jt([Ho()],Xh.prototype,"windingRule",void 0),jt([Ho(!0)],Xh.prototype,"closed",void 0),jt([zo(0)],Xh.prototype,"padding",void 0),jt([zo(!1)],Xh.prototype,"lockRatio",void 0),jt([zo()],Xh.prototype,"widthRange",void 0),jt([zo()],Xh.prototype,"heightRange",void 0),jt([Do(!1)],Xh.prototype,"draggable",void 0),jt([Do()],Xh.prototype,"dragBounds",void 0),jt([Do(!1)],Xh.prototype,"editable",void 0),jt([sn(!0)],Xh.prototype,"hittable",void 0),jt([sn("path")],Xh.prototype,"hitFill",void 0),jt([Go("path")],Xh.prototype,"hitStroke",void 0),jt([sn(!1)],Xh.prototype,"hitBox",void 0),jt([sn(!0)],Xh.prototype,"hitChildren",void 0),jt([sn(!0)],Xh.prototype,"hitSelf",void 0),jt([sn()],Xh.prototype,"hitRadius",void 0),jt([on("")],Xh.prototype,"cursor",void 0),jt([qo()],Xh.prototype,"fill",void 0),jt([Go()],Xh.prototype,"stroke",void 0),jt([Go("inside")],Xh.prototype,"strokeAlign",void 0),jt([Go(1)],Xh.prototype,"strokeWidth",void 0),jt([Go(!1)],Xh.prototype,"strokeWidthFixed",void 0),jt([Go("none")],Xh.prototype,"strokeCap",void 0),jt([Go("miter")],Xh.prototype,"strokeJoin",void 0),jt([Go()],Xh.prototype,"dashPattern",void 0),jt([Go(0)],Xh.prototype,"dashOffset",void 0),jt([Go(10)],Xh.prototype,"miterLimit",void 0),jt([Ho(0)],Xh.prototype,"cornerRadius",void 0),jt([Ho()],Xh.prototype,"cornerSmoothing",void 0),jt([Qa()],Xh.prototype,"shadow",void 0),jt([Qa()],Xh.prototype,"innerShadow",void 0),jt([Qa()],Xh.prototype,"blur",void 0),jt([Qa()],Xh.prototype,"backgroundBlur",void 0),jt([Qa()],Xh.prototype,"grayscale",void 0),jt([Qa()],Xh.prototype,"filter",void 0),jt([qo()],Xh.prototype,"placeholderColor",void 0),jt([Do(100)],Xh.prototype,"placeholderDelay",void 0),jt([Do({})],Xh.prototype,"data",void 0),jt([cn(ya.prototype.reset)],Xh.prototype,"reset",null),Xh=Yh=jt([_n(Fh),_n(Wh),un()],Xh);let Hh=class extends Xh{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 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(){}};var Vh;jt([nn(xh)],Hh.prototype,"__",void 0),jt([zo(0)],Hh.prototype,"width",void 0),jt([zo(0)],Hh.prototype,"height",void 0),Hh=jt([_n(Ra),gn()],Hh);const jh=bt.get("Leafer");let Gh=Vh=class extends Hh{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),Vh.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=Lt.canvas(s);this.__controllers.push(this.renderer=Lt.renderer(this,o,s),this.watcher=Lt.watcher(this,s),this.layouter=Lt.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=o.view,e||(this.selector=Lt.selector(this),this.interaction=Lt.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Lt.hitCanvasManager()),this.canvasManager=new It,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))),Xn.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),Xn.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(pr.VIEW_READY),Xn.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){Xn.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),Xn.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 Ct.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){Vh.list.remove(this);try{this.stop(),this.emitEvent(new pr(pr.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>!(this.parent&&t===this.interaction)&&t.destroy())),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout((()=>{Eo.clearRecycled()}),100)}catch(t){jh.error(t)}}};t?e():setTimeout(e)}};Gh.list=new Ta,jt([nn(kh)],Gh.prototype,"__",void 0),jt([zo()],Gh.prototype,"pixelRatio",void 0),Gh=Vh=jt([gn()],Gh);let Uh=class extends Xh{get __tag(){return"Rect"}constructor(t){super(t)}};jt([nn(Sh)],Uh.prototype,"__",void 0),Uh=jt([_n(Nh),un(),gn()],Uh);const{copy:qh,add:Zh,includes:Kh}=pt,Jh=Uh.prototype,Qh=Hh.prototype,$h={};let tl=class extends Hh{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){const e=this.__;if(this.children.length&&!this.pathInputed)if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:t}=this.__layout;e.__autoSize||(e.__autoWidth?(t.width+=t.x,t.x=0,t.height=e.height,t.y=0):(t.height+=t.y,t.y=0,t.width=e.width,t.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds();else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t;const{renderBounds:e}=this.__layout;this.children.length?(super.__updateRenderBounds(),qh($h,e),this.__updateRectRenderBounds(),t=!Kh(e,$h),t&&"hide"!==this.__.overflow&&Zh(e,$h)):this.__updateRectRenderBounds(),Wt.stintSet(this,"isOverflow",t)}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e))}__drawContent(t,e){this.__renderGroup(t,e),this.__.__hasStroke&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};jt([nn(bh)],tl.prototype,"__",void 0),jt([zo(100)],tl.prototype,"width",void 0),jt([zo(100)],tl.prototype,"height",void 0),jt([Do(!1)],tl.prototype,"resizeChildren",void 0),jt([Uo("show")],tl.prototype,"overflow",void 0),jt([cn(Jh.__updateStrokeSpread)],tl.prototype,"__updateStrokeSpread",null),jt([cn(Jh.__updateRenderSpread)],tl.prototype,"__updateRectRenderSpread",null),jt([cn(Jh.__updateBoxBounds)],tl.prototype,"__updateRectBoxBounds",null),jt([cn(Jh.__updateStrokeBounds)],tl.prototype,"__updateStrokeBounds",null),jt([cn(Jh.__updateRenderBounds)],tl.prototype,"__updateRectRenderBounds",null),jt([cn(Jh.__updateChange)],tl.prototype,"__updateRectChange",null),jt([cn(Jh.__render)],tl.prototype,"__renderRect",null),jt([cn(Qh.__render)],tl.prototype,"__renderGroup",null),tl=jt([un(),gn()],tl);let el=class extends tl{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};jt([nn(Eh)],el.prototype,"__",void 0),jt([qo("#FFFFFF")],el.prototype,"fill",void 0),jt([Uo("hide")],el.prototype,"overflow",void 0),el=jt([gn()],el);const{moveTo:il,closePath:sl,ellipse:ol}=qi;let nl=class extends Xh{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:e,height:i,innerRadius:s,startAngle:o,endAngle:n}=this.__,r=e/2,a=i/2,h=this.__.path=[];s?(o||n?(s<1&&ol(h,r,a,r*s,a*s,0,o,n,!1),ol(h,r,a,r,a,0,n,o,!0),s<1&&sl(h)):(s<1&&(ol(h,r,a,r*s,a*s),il(h,e,a)),ol(h,r,a,r,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):o||n?(il(h,r,a),ol(h,r,a,r,a,0,o,n,!1),sl(h)):ol(h,r,a,r,a)}};jt([nn(Rh)],nl.prototype,"__",void 0),jt([Ho(0)],nl.prototype,"innerRadius",void 0),jt([Ho(0)],nl.prototype,"startAngle",void 0),jt([Ho(0)],nl.prototype,"endAngle",void 0),nl=jt([gn()],nl);const{moveTo:rl,lineTo:al,drawPoints:hl}=qi,{rotate:ll,getAngle:dl,getDistance:cl,defaultPoint:ul}=A,{toBounds:pl}=oo;let _l=class extends Xh{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&ll(i,e),i}set toPoint(t){this.width=cl(ul,t),this.rotation=dl(ul,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?hl(e,t.points,!1,t.closed):(rl(e,0,0),al(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(hl(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&oh.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?pl(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};jt([nn(Bh)],_l.prototype,"__",void 0),jt([Vo("center")],_l.prototype,"strokeAlign",void 0),jt([zo(0)],_l.prototype,"height",void 0),jt([Ho()],_l.prototype,"points",void 0),jt([Ho(0)],_l.prototype,"curve",void 0),jt([Ho(!1)],_l.prototype,"closed",void 0),_l=jt([gn()],_l);const{sin:gl,cos:fl,PI:yl}=Math,{moveTo:ml,lineTo:vl,closePath:wl,drawPoints:xl}=qi,bl=_l.prototype;let kl=class extends Xh{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)xl(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,o=e/2,n=i/2;ml(t,o,0);for(let e=1;e<s;e++)vl(t,o+o*gl(2*e*yl/s),n-n*fl(2*e*yl/s))}wl(t)}__updateRenderPath(){}__updateBoxBounds(){}};jt([nn(Th)],kl.prototype,"__",void 0),jt([Ho(3)],kl.prototype,"sides",void 0),jt([Ho()],kl.prototype,"points",void 0),jt([Ho(0)],kl.prototype,"curve",void 0),jt([cn(bl.__updateRenderPath)],kl.prototype,"__updateRenderPath",null),jt([cn(bl.__updateBoxBounds)],kl.prototype,"__updateBoxBounds",null),kl=jt([un(),gn()],kl);const{sin:El,cos:Bl,PI:Sl}=Math,{moveTo:Rl,lineTo:Tl,closePath:Cl}=qi;let Ll=class extends Xh{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=[];Rl(r,o,0);for(let t=1;t<2*i;t++)Tl(r,o+(t%2==0?o:o*s)*El(t*Sl/i),n-(t%2==0?n:n*s)*Bl(t*Sl/i));Cl(r)}};jt([nn(Ch)],Ll.prototype,"__",void 0),jt([Ho(5)],Ll.prototype,"corners",void 0),jt([Ho(.382)],Ll.prototype,"innerRadius",void 0),Ll=jt([gn()],Ll);let Pl=class extends Uh{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([nn(Dh)],Pl.prototype,"__",void 0),jt([zo("")],Pl.prototype,"url",void 0),Pl=jt([gn()],Pl);const Ol=Pl;let Al=class extends Uh{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Lt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new To({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 N(t.worldTransform).invert(),n=new N;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([nn(Mh)],Al.prototype,"__",void 0),jt([$a(100)],Al.prototype,"width",void 0),jt([$a(100)],Al.prototype,"height",void 0),jt([$a(1)],Al.prototype,"pixelRatio",void 0),jt([$a(!0)],Al.prototype,"smooth",void 0),jt([Do(!1)],Al.prototype,"safeResize",void 0),jt([$a()],Al.prototype,"contextSettings",void 0),Al=jt([gn()],Al);const{copyAndSpread:Dl,includes:Ml,spread:Fl,setList:Il}=pt;let Wl=class extends Xh{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:a,textCase:h,textOverflow:l,padding:d}=t;t.__lineHeight=sh.number(e,o),t.__letterSpacing=sh.number(i,o),t.__padding=d?r.fourNumber(d):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${a?"italic ":""}${"small-caps"===h?"small-caps ":""}${"normal"!==n?n+" ":""}${o}px ${s}`,t.__clipText="show"!==l&&!t.__autoSize,t.__textDrawData=eh.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&&Fl(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",!Ml(h,a)),this.isOverflow?(Il(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;Dl(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&&!dh.running||super.__draw(t,e,i)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};jt([nn(Ah)],Wl.prototype,"__",void 0),jt([zo(0)],Wl.prototype,"width",void 0),jt([zo(0)],Wl.prototype,"height",void 0),jt([qo()],Wl.prototype,"boxStyle",void 0),jt([Do(!1)],Wl.prototype,"resizeFontSize",void 0),jt([qo("#000000")],Wl.prototype,"fill",void 0),jt([Vo("outside")],Wl.prototype,"strokeAlign",void 0),jt([sn("all")],Wl.prototype,"hitFill",void 0),jt([zo("")],Wl.prototype,"text",void 0),jt([zo("")],Wl.prototype,"placeholder",void 0),jt([zo("caption")],Wl.prototype,"fontFamily",void 0),jt([zo(12)],Wl.prototype,"fontSize",void 0),jt([zo("normal")],Wl.prototype,"fontWeight",void 0),jt([zo(!1)],Wl.prototype,"italic",void 0),jt([zo("none")],Wl.prototype,"textCase",void 0),jt([zo("none")],Wl.prototype,"textDecoration",void 0),jt([zo(0)],Wl.prototype,"letterSpacing",void 0),jt([zo({type:"percent",value:1.5})],Wl.prototype,"lineHeight",void 0),jt([zo(0)],Wl.prototype,"paraIndent",void 0),jt([zo(0)],Wl.prototype,"paraSpacing",void 0),jt([zo("x")],Wl.prototype,"writingMode",void 0),jt([zo("left")],Wl.prototype,"textAlign",void 0),jt([zo("top")],Wl.prototype,"verticalAlign",void 0),jt([zo(!0)],Wl.prototype,"autoSizeAlign",void 0),jt([zo("normal")],Wl.prototype,"textWrap",void 0),jt([zo("show")],Wl.prototype,"textOverflow",void 0),Wl=jt([gn()],Wl);let zl=class extends Xh{get __tag(){return"Path"}constructor(t){super(t)}};jt([nn(Lh)],zl.prototype,"__",void 0),jt([Vo("center")],zl.prototype,"strokeAlign",void 0),zl=jt([gn()],zl);let Nl=class extends Hh{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new zl(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),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([nn(Ph)],Nl.prototype,"__",void 0),jt([(t,e)=>{Co(t,e,{get(){return this.__path}})}],Nl.prototype,"path",void 0),Nl=jt([_n(cs,["set","path","paint"]),gn()],Nl);let Yl=class extends Gh{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&&Lt.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(t){const e=new Gh(t);return this.add(e),e}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))}};Yl=jt([gn()],Yl);const Xl={},Hl={isHoldSpaceKey:()=>Hl.isHold("Space"),isHold:t=>Xl[t],setDownCode(t){Xl[t]||(Xl[t]=!0)},setUpCode(t){Xl[t]=!1}},Vl={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 jl extends $n{get spaceKey(){return Hl.isHoldSpaceKey()}get left(){return Vl.left(this)}get right(){return Vl.right(this)}get middle(){return Vl.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){Mt.changeName(t,e)}}let Gl=class extends jl{};Gl.POINTER="pointer",Gl.BEFORE_DOWN="pointer.before_down",Gl.BEFORE_MOVE="pointer.before_move",Gl.BEFORE_UP="pointer.before_up",Gl.DOWN="pointer.down",Gl.MOVE="pointer.move",Gl.UP="pointer.up",Gl.OVER="pointer.over",Gl.OUT="pointer.out",Gl.ENTER="pointer.enter",Gl.LEAVE="pointer.leave",Gl.TAP="tap",Gl.DOUBLE_TAP="double_tap",Gl.CLICK="click",Gl.DOUBLE_CLICK="double_click",Gl.LONG_PRESS="long_press",Gl.LONG_TAP="long_tap",Gl.MENU="pointer.menu",Gl.MENU_TAP="pointer.menu_tap",Gl=jt([fn()],Gl);const Ul=Gl,ql={};let Zl=class extends Gl{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 A.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(ql,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(ql,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(ql,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){ql.x=t?this.totalX:this.moveX,ql.y=t?this.totalY:this.moveY}};Zl.BEFORE_DRAG="drag.before_drag",Zl.START="drag.start",Zl.DRAG="drag",Zl.END="drag.end",Zl.OVER="drag.over",Zl.OUT="drag.out",Zl.ENTER="drag.enter",Zl.LEAVE="drag.leave",Zl=jt([fn()],Zl);const Kl=Zl;let Jl=class extends Gl{static setList(t){Zl.setList(t)}static setData(t){Zl.setData(t)}};Jl.DROP="drop",Jl=jt([fn()],Jl);let Ql=class extends Zl{};Ql.BEFORE_MOVE="move.before_move",Ql.START="move.start",Ql.MOVE="move",Ql.END="move.end",Ql=jt([fn()],Ql);let $l=class extends Gl{};$l.BEFORE_ROTATE="rotate.before_rotate",$l.START="rotate.start",$l.ROTATE="rotate",$l.END="rotate.end",$l=jt([fn()],$l);let td=class extends Zl{};td.SWIPE="swipe",td.LEFT="swipe.left",td.RIGHT="swipe.right",td.UP="swipe.up",td.DOWN="swipe.down",td=jt([fn()],td);let ed=class extends Gl{};ed.BEFORE_ZOOM="zoom.before_zoom",ed.START="zoom.start",ed.ZOOM="zoom",ed.END="zoom.end",ed=jt([fn()],ed);let id=class extends jl{};id.DOWN="key.down",id.HOLD="key.hold",id.UP="key.up",id=jt([fn()],id);const sd={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:t=>t<-45&&t>-135?td.UP:t>45&&t<135?td.DOWN:t<=45&&t>=-45?td.RIGHT:td.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:od.getSwipeDirection(A.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:t=>t&&t.list.some((t=>t.draggable||t.editable||!t.isLeafer&&t.hasEvent(Zl.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},od=sd,nd=new Ta,{getDragEventData:rd,getDropEventData:ad,getSwipeEventData:hd}=sd;class ld{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=rd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,o=Zl.list||this.draggableList||nd;return this.dragging&&(s?t?nd:new Ta(e?[...i.list,...i.dragHoverExclude]:i.list):o)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(Ql.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Vl.left(t),this.dragging&&(this.interaction.emit(Zl.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(t){const{interaction:e,dragData:i,downData:s}=this,{path:o,throughPath:n}=s;this.dragData=rd(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",e.emit(Ql.BEFORE_MOVE,this.dragData),e.emit(Ql.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(Zl.BEFORE_DRAG,this.dragData),e.emit(Zl.DRAG,this.dragData))}dragReal(){const{running:t}=this.interaction,e=this.realDraggableList;if(e.length&&t){const{totalX:t,totalY:i}=this.dragData;e.forEach((e=>e.draggable&&e.move(Zl.getValidMove(e,this.dragStartPoints[e.innerId],{x:t,y:i}))))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(Zl.OUT,t,i),e.emit(Zl.OVER,t,s)):e.emit(Zl.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(Zl.LEAVE,t,i,s),e.emit(Zl.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:o,throughPath:n}=i,r=rd(i,t,t);if(n&&(r.throughPath=n),r.path=o,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(Ql.END,r)),this.dragging){const o=this.getList();this.dragging=!1,e.emit(Zl.END,r),this.swipe(t,i,s,r),this.drop(t,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:o}=this;if(A.getDistance(e,t)>o.config.pointer.swipeDistance){const t=hd(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=ad(t,e,Zl.data);s.path=i,this.interaction.emit(Jl.DROP,s),this.interaction.emit(Zl.LEAVE,t,i)}dragReset(){Zl.list=Zl.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 dd=bt.get("emit");const cd=["move","zoom","rotate","key"];function ud(t,e,i,s,o){if(cd.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!_d(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&&pd(n,e,i,s,o)}}function pd(t,e,i,s,o){if(t.destroyed)return!1;if(t.__.hitSelf&&!_d(t,o)&&(ch.updateEventStyle&&!s&&ch.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const o=Mt.get(e,i);if(t.emitEvent(o,s),o.isStop)return!0}return!1}function _d(t,e){return e&&e.has(t)}const gd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},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:fd,pathCanDrag:yd,pathHasOutside:md}=sd;class vd{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&&Vl.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Vl.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Hl.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(gd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Ta(t),this.createTransformer(),this.dragger=new ld(this),s&&(this.config=Wt.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Vl.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(Gl.BEFORE_DOWN,t),this.emit(Gl.DOWN,t),Vl.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Vl.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Vl.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(Gl.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=A.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(Gl.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Vl.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(Gl.BEFORE_UP,t),this.emit(Gl.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(Gl.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(Gl.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Hl.setDownCode(e),this.emit(id.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(id.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]=!1,Hl.setUpCode(e),this.emit(id.UP,t,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(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(Gl.OUT,t,i),this.emit(Gl.OVER,t,e)):this.emit(Gl.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach((t=>e.add(t))));const{enterPath:i}=this;this.enterPath=e,this.emit(Gl.LEAVE,t,i,e),this.emit(Gl.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Gl.LEAVE,t),this.dragger.dragging&&this.emit(Jl.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,o=[Gl.DOUBLE_TAP,Gl.DOUBLE_CLICK].some((e=>fd(t.path,e)));s<e.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(e,i){const{hitRadius:s,through:o}=this.p,{bottomList:n,target:r}=this;t.backgrounder||e.origin||r&&r.updateLayout();const a=this.selector.getByPoint(e,s,Object.assign({bottomList:n,name:e.type},i||{through:o}));return a.throughPath&&(e.throughPath=a.throughPath),e.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&&!md(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!yd(t.path))&&!md(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(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:Gl.MOVE}),this.hoverData=t)}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&&A.round(s),s}emitTap(t){this.emit(Gl.TAP,t),this.emit(Gl.CLICK,t)}emitDoubleTap(t){this.emit(Gl.DOUBLE_TAP,t),this.emit(Gl.DOUBLE_CLICK,t)}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(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(Gl.LONG_PRESS,t)}),this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(Gl.LONG_TAP,t),(fd(t.path,Gl.LONG_TAP)||fd(t.path,Gl.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}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],pd(o,t,e,!0,s))return;o.isApp&&ud(o,t,e,!0,s)}for(let n=0,r=i.length;n<r;n++)if(o=i.list[n],o.isApp&&ud(o,t,e,!1,s),pd(o,t,e,!1,s))return}catch(t){dd.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 wd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}wd.custom={};class xd extends It{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Ta,this.pixelList=new Ta}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),Lt.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),Lt.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:bd,copy:kd,setRadius:Ed}=A,Bd={},Sd=ya.prototype;Sd.__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&&(kd(Bd,t),Ed(t=Bd,e.hitRadius)),bd(t,i,Bd),e.hitBox||o){if(pt.hitRadiusPoint(s.boxBounds,Bd))return!0;if(o)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Bd)},Sd.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},Sd.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},Sd.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},Sd.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Rd=new N,Td=Xh.prototype;Td.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const e=this.__,{hitCanvasManager:i}=this.leafer||this.parent.leafer,s=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,o=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,n=s||o;this.__hitCanvas||(this.__hitCanvas=n?i.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):i.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:i}=this.__layout,n=t.image.hitCanvasSize,a=r.hitScale=mt.set(0,0,n,n).getFitMatrix(i).a,{x:h,y:l,width:d,height:c}=mt.set(i).scale(a);r.resize({width:d,height:c,pixelRatio:1}),r.clear(),Eo.patternLocked=!0,this.__renderShape(r,{matrix:Rd.setWith(this.__world).scaleWith(1/a).invertWith().translate(-h,-l)},!s,!o),Eo.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},Td.__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,__strokeWidth: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 Cd=Xh.prototype,Ld=Uh.prototype,Pd=tl.prototype;Ld.__updateHitCanvas=Pd.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Cd.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Ld.__hitFill=Pd.__hitFill=function(t){return this.__hitCanvas?Cd.__hitFill.call(this,t):pt.hitRadiusPoint(this.__layout.boxBounds,t)},Wl.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)))},Hh.prototype.pick=function(e,i){return i||(i=Xt),this.updateLayout(),function(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=Lt.selector())}(this).getByPoint(e,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const Od=se.prototype;Od.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Od.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Od.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 Ad={convertTouch(t,e){const i=Ad.getTouch(t),s=sd.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class Dd extends vd{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return void 0!==t.x?{x:t.x,y:t.y}:super.getLocal(t,e)}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=Ad.getTouch(t);this.pointerDown(Ad.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=Ad.getTouch(t);this.pointerMove(Ad.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=Ad.getTouch(t);this.pointerUp(Ad.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(sd.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach((t=>{i=e.find((e=>e.identifier===t.identifier)),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})})),s}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}destroy(){super.destroy(),this.touches=null}}function Md(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 Fd(t,e){t.__.__font?Md(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Id(t,e,i){switch(e.__.strokeAlign){case"center":Wd(t,1,e,i);break;case"inside":zd(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?Wd(t,2,e,i):zd(t,"outside",e,i)}}function Wd(t,e,i,s){const o=i.__;s.setStroke(!o.__isStrokes&&t,o.strokeWidth*e,o),o.__isStrokes?Yd(t,!0,i,s):Nd(i,s)}function zd(e,i,s,o){const n=o.getSameCanvas(!0,!0);n.font=s.__.__font,Wd(e,2,s,n),n.blendMode="outside"===i?"destination-out":"destination-in",Md(s,n),n.blendMode="normal",s.__worldFlipped||t.fullImageShadow?o.copyWorldByReset(n,s.__nowWorld):o.copyWorldToInner(n,s.__nowWorld,s.__layout.renderBounds),n.recycle(s.__nowWorld)}function Nd(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 Yd(t,e,i,s){let o;for(let n=0,r=t.length;n<r;n++)o=t[n],o.image&&rh.checkImage(i,s,o,!1)||o.style&&(s.strokeStyle=o.style,o.blendMode?(s.saveBlendMode(o.blendMode),e?Nd(i,s):s.stroke(),s.restoreBlendMode()):e?Nd(i,s):s.stroke())}function Xd(e,i,s){const o=i.__;if(o.__strokeWidth)if(o.__font)Id(e,i,s);else switch(o.strokeAlign){case"center":Hd(e,1,i,s);break;case"inside":!function(t,e,i){const s=e.__;i.save(),s.windingRule?i.clip(s.windingRule):i.clip(),Hd(t,2,e,i),i.restore()}(e,i,s);break;case"outside":!function(e,i,s){const o=i.__;if(o.__fillAfterStroke)Hd(e,2,i,s);else{const{renderBounds:n}=i.__layout,r=s.getSameCanvas(!0,!0);i.__drawRenderPath(r),Hd(e,2,i,r),o.windingRule?r.clip(o.windingRule):r.clip(),r.clearWorld(n),i.__worldFlipped||t.fullImageShadow?s.copyWorldByReset(r,i.__nowWorld):s.copyWorldToInner(r,i.__nowWorld,n),r.recycle(i.__nowWorld)}}(e,i,s)}}function Hd(t,e,i,s){const o=i.__;s.setStroke(!o.__isStrokes&&t,o.__strokeWidth*e,o),o.__isStrokes?Yd(t,!1,i,s):s.stroke(),o.__useArrow&&nh.strokeArrow(t,i,s)}const{getSpread:Vd,getOuterOf:jd,getByMove:Gd,getIntersectData:Ud}=pt;let qd;const{stintSet:Zd}=Wt,{hasTransparent:Kd}=ih;function Jd(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=rh.image(i,t,e,o,!qd||!qd[e.url]);break;case"linear":s=ah.linearGradient(e,o);break;case"radial":s=ah.radialGradient(e,o);break;case"angular":s=ah.conicGradient(e,o);break;case"solid":const{type:n,blendMode:r,color:a,opacity:h}=e;s={type:n,blendMode:r,style:ih.string(a,h)};break;default:void 0!==e.r&&(s={type:"solid",style:ih.string(e)})}return s&&("string"==typeof s.style&&Kd(s.style)&&(s.isTransparent=!0),e.blendMode&&(s.blendMode=e.blendMode)),s}const Qd={compute:function(t,e){const i=e.__,s=[];let o,n,r=i.__input[t];r instanceof Array||(r=[r]),qd=rh.recycleImage(t,i);for(let i,o=0,n=r.length;o<n;o++)i=Jd(t,r[o],e),i&&s.push(i);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?(Zd(i,"__isAlphaPixelFill",o),Zd(i,"__isTransparentFill",n)):(Zd(i,"__isAlphaPixelStroke",o),Zd(i,"__isTransparentStroke",n))},fill:function(t,e,i){i.fillStyle=t,Fd(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(rh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!o&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}i.fillStyle=s.style,s.transform?(i.save(),i.transform(s.transform),s.blendMode&&(i.blendMode=s.blendMode),Fd(e,i),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),Fd(e,i),i.restoreBlendMode()):Fd(e,i)}},fillPathOrText:Fd,fillText:Md,stroke:Xd,strokes:function(t,e,i){Xd(t,e,i)},strokeText:Id,drawTextStroke:Nd,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=Ud(s?Vd(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=jd(o,r),n=Gd(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 $d={};const{get:tc,rotateOfOuter:ec,translate:ic,scaleOfOuter:sc,scale:oc,rotate:nc}=x;function rc(t,e,i,s,o,n,r){const a=tc();ic(a,e.x+i,e.y+s),oc(a,o,n),r&&ec(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function ac(t,e,i,s,o,n,r){const a=tc();ic(a,e.x+i,e.y+s),o&&oc(a,o,n),r&&nc(a,r),t.transform=a}function hc(t,e,i,s,o,n,r,a,h,l){const d=tc();if(h)if("center"===l)ec(d,{x:i/2,y:s/2},h);else switch(nc(d,h),h){case 90:ic(d,s,0);break;case 180:ic(d,i,s);break;case 270:ic(d,0,i)}$d.x=e.x+o,$d.y=e.y+n,ic(d,$d.x,$d.y),r&&sc(d,$d,r,a),t.transform=d}const{get:lc,translate:dc}=x,cc=new yt,uc={},pc={};function _c(t,e,i,s){const{changeful:o,sync:n}=i;o&&(t.changeful=o),n&&(t.sync=n),t.data=gc(i,s,e)}function gc(t,e,i){t.padding&&(e=cc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:o}=i;const{opacity:n,mode:a,align:h,offset:l,scale:d,size:c,rotation:u,repeat:p,filters:_}=t,g=e.width===s&&e.height===o,f={mode:a},y="center"!==h&&(u||0)%180==90;let m,v;switch(pt.set(pc,0,0,y?o:s,y?s:o),a&&"cover"!==a&&"fit"!==a?((d||c)&&(r.getScaleData(d,c,i,uc),m=uc.scaleX,v=uc.scaleY),h&&(m&&pt.scale(pc,m,v,!0),K.toPoint(h,pc,e,pc,!0,!0))):g&&!u||(m=v=pt.getFitScale(e,pc,"fit"!==a),pt.put(e,i,h,m,!1,pc),pt.scale(pc,m,v,!0)),l&&A.move(pc,l),a){case"stretch":g||(s=e.width,o=e.height);break;case"normal":case"clip":(pc.x||pc.y||m||u)&&ac(f,e,pc.x,pc.y,m,v,u);break;case"repeat":(!g||m||u)&&hc(f,e,s,o,pc.x,pc.y,m,v,u,h),p||(f.repeat="repeat");break;default:m&&rc(f,e,pc.x,pc.y,m,v,u)}return f.transform||(e.x||e.y)&&(f.transform=lc(),dc(f.transform,e.x,e.y)),m&&"stretch"!==a&&(f.scaleX=m,f.scaleY=v),f.width=s,f.height=o,n&&(f.opacity=n),_&&(f.filters=_),p&&(f.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat"),f}let fc,yc=new yt;const{isSame:mc}=pt;function vc(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||_c(o,s,i,n),!0}function wc(t,e){kc(t,ir.LOAD,e)}function xc(t,e){kc(t,ir.LOADED,e)}function bc(t,e,i){e.error=i,t.forceUpdate("surface"),kc(t,ir.ERROR,e)}function kc(t,e,i){t.hasEvent(e)&&t.emitEvent(new ir(e,i))}function Ec(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Bc,scale:Sc,copy:Rc}=x,{ceil:Tc,abs:Cc}=Math;function Lc(e,i,s){let{scaleX:o,scaleY:n}=Eo.patternLocked?e.__world:e.__nowWorld;const r=o+"-"+n+"-"+s;if(i.patternId===r||e.destroyed)return!1;{o=Cc(o),n=Cc(n);const{image:e,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:p,transform:_,repeat:g}=a;u&&(l=Bc(),Rc(l,_),Sc(l,1/u,1/p),o*=u,n*=p),o*=s,n*=s,d*=o,c*=n;const f=d*c;if(!g&&f>t.image.maxCacheSize)return!1;let y=t.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;y>t&&(y=t)}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=Bc(),_&&Rc(l,_)),Sc(l,1/o,1/n));const m=e.getCanvas(Tc(d)||1,Tc(c)||1,a.opacity,a.filters),v=e.getPattern(m,g||t.origin.noRepeat||"no-repeat",l,i);return i.style=v,i.patternId=r,!0}}const{abs:Pc}=Math;const Oc={image:function(t,e,i,s,o){let n,r;const a=Eo.get(i);return fc&&i===fc.paint&&mc(s,fc.boxBounds)?n=fc.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),fc=a.use>1?{leafPaint:n,paint:i,boxBounds:yc.set(s)}:null),(o||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(vc(t,e,i,a,n,s),o&&(wc(t,r),xc(t,r))):a.error?o&&bc(t,r,a.error):(o&&(Ec(t,!0),wc(t,r)),n.loadId=a.load((()=>{Ec(t,!1),t.destroyed||(vc(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),xc(t,r)),n.loadId=null}),(e=>{Ec(t,!1),bc(t,r,e),n.loadId=null})),t.placeholderColor&&(t.placeholderDelay?setTimeout((()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))}),t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(e,i,s,o){const{scaleX:n,scaleY:r}=Eo.patternLocked?e.__world:e.__nowWorld,{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===n+"-"+r+"-"+a&&!dh.running)return!1;if(o)if(h.repeat)o=!1;else if(!(s.changeful||lr.isResizing(e)||dh.running)){let{width:e,height:i}=h;e*=Pc(n)*a,i*=Pc(r)*a,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),o=e*i>t.image.maxCacheSize}return o?(function(t,e,i,s){e.save(),t.windingRule?e.clip(t.windingRule):e.clip(),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()}(e,i,s,h),!0):(!s.style||s.sync||dh.running?Lc(e,s,a):s.patternTask||(s.patternTask=Eo.patternTasker.add((()=>Gt(this,void 0,void 0,(function*(){s.patternTask=null,i.bounds.hit(e.__nowWorld)&&Lc(e,s,a),e.forceUpdate("surface")}))),300)),!1)},createPattern:Lc,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,Eo.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:_c,getPatternData:gc,fillOrFitMode:rc,clipMode:ac,repeatMode:hc},{toPoint:Ac}=U,{hasTransparent:Dc}=ih,Mc={},Fc={};function Ic(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=ih.string(o,s)):(r=o.offset,n=ih.string(o.color,s)),e.addColorStop(r,n),!a&&Dc(n)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:Wc,getDistance:zc}=A,{get:Nc,rotateOfOuter:Yc,scaleOfOuter:Xc}=x,{toPoint:Hc}=U,Vc={},jc={};function Gc(t,e,i,s,o){let n;const{width:r,height:a}=t;if(r!==a||s){const t=Wc(e,i);n=Nc(),o?(Xc(n,e,r/a*(s||1),1),Yc(n,e,t+90)):(Xc(n,e,1,r/a*(s||1)),Yc(n,e,t))}return n}const{getDistance:Uc}=A,{toPoint:qc}=U,Zc={},Kc={};const Jc={linearGradient:function(e,i){let{from:s,to:o,type:n,opacity:r}=e;Ac(s||"top",i,Mc),Ac(o||"bottom",i,Fc);const a=t.canvas.createLinearGradient(Mc.x,Mc.y,Fc.x,Fc.y),h={type:n,style:a};return Ic(h,a,e.stops,r),h},radialGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=e;Hc(s||"center",i,Vc),Hc(o||"bottom",i,jc);const h=t.canvas.createRadialGradient(Vc.x,Vc.y,0,Vc.x,Vc.y,zc(Vc,jc)),l={type:n,style:h};Ic(l,h,e.stops,r);const d=Gc(i,Vc,jc,a,!0);return d&&(l.transform=d),l},conicGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=e;qc(s||"center",i,Zc),qc(o||"bottom",i,Kc);const h=t.conicGradientSupport?t.canvas.createConicGradient(0,Zc.x,Zc.y):t.canvas.createRadialGradient(Zc.x,Zc.y,0,Zc.x,Zc.y,Uc(Zc,Kc)),l={type:n,style:h};Ic(l,h,e.stops,r);const d=Gc(i,Zc,Kc,a||1,t.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Gc},{copy:Qc,toOffsetOutBounds:$c}=pt,tu={},eu={};function iu(e,i,s,o){const{bounds:n,shapeBounds:r}=o;if(t.fullImageShadow){if(Qc(tu,e.bounds),tu.x+=i.x-r.x,tu.y+=i.y-r.y,s){const{matrix:t}=o;tu.x-=(n.x+(t?t.e:0)+n.width/2)*(s-1),tu.y-=(n.y+(t?t.f:0)+n.height/2)*(s-1),tu.width*=s,tu.height*=s}e.copyWorld(o.canvas,e.bounds,tu)}else s&&(Qc(tu,i),tu.x-=i.width/2*(s-1),tu.y-=i.height/2*(s-1),tu.width*=s,tu.height*=s),e.copyWorld(o.canvas,r,s?tu:i)}const{toOffsetOutBounds:su}=pt,ou={};const nu={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;$c(l,eu),a.forEach(((a,g)=>{p.setWorldShadow(eu.offsetX+a.x*c,eu.offsetY+a.y*u,a.blur*c,ih.string(a.color)),o=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,iu(p,eu,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")),t.__worldFlipped?e.copyWorldByReset(p,s,n,a.blendMode):e.copyWorldToInner(p,s,r.renderBounds,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;su(l,ou),a.forEach(((a,g)=>{p.save(),p.setWorldShadow(ou.offsetX+a.x*c,ou.offsetY+a.y*u,a.blur*c),o=a.spread?1-2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,iu(p,ou,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,ih.string(a.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(p,s,n,a.blendMode):e.copyWorldToInner(p,s,r.renderBounds,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:ru}=Fn;function au(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),lu(t,e,i,1)}(t,i,s,o);break;case"opacity-path":lu(t,i,s,n);break;case"path":i.restore()}}function hu(t){return t.getSameCanvas(!1,!0)}function lu(t,e,i,s){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o),i.recycle(o)}Hh.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&&(au(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=hu(t))):(r="path",t.save()),i.__clip(o||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=hu(t)),o||(o=hu(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a)||ru(i,e)||i.__render(o||t,e);au(this,r,t,o,s,n)};const du=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",cu=du+"_#~&*+\\=|≮≯≈≠=…",uu=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 pu(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const _u=pu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),gu=pu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),fu=pu(du),yu=pu(cu),mu=pu("- —/~|┆·");var vu;!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"}(vu||(vu={}));const{Letter:wu,Single:xu,Before:bu,After:ku,Symbol:Eu,Break:Bu}=vu;function Su(t){return _u[t]?wu:mu[t]?Bu:gu[t]?bu:fu[t]?ku:yu[t]?Eu:uu.test(t)?xu:wu}const Ru={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 Tu(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:Cu}=Ru,{Letter:Lu,Single:Pu,Before:Ou,After:Au,Symbol:Du,Break:Mu}=vu;let Fu,Iu,Wu,zu,Nu,Yu,Xu,Hu,Vu,ju,Gu,Uu,qu,Zu,Ku,Ju,Qu,$u=[];function tp(t,e){Vu&&!Hu&&(Hu=Vu),Fu.data.push({char:t,width:e}),Wu+=e}function ep(){zu+=Wu,Fu.width=Wu,Iu.words.push(Fu),Fu={data:[]},Wu=0}function ip(){Zu&&(Ku.paraNumber++,Iu.paraStart=!0,Zu=!1),Vu&&(Iu.startCharSize=Hu,Iu.endCharSize=Vu,Hu=0),Iu.width=zu,Ju.width?Cu(Iu):Qu&&sp(),$u.push(Iu),Iu={words:[]},zu=0}function sp(){zu>(Ku.maxWidth||0)&&(Ku.maxWidth=zu)}const{top:op,right:np,bottom:rp,left:ap}=V;function hp(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 lp={getDrawData:function(e,i){"string"!=typeof e&&(e=String(e));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[ap],n-=l[np]+l[ap]):i.autoSizeAlign||(s=l[ap]),r?(o=l[op],r-=l[op]+l[rp]):i.autoSizeAlign||(o=l[op]));const d={bounds:{x:s,y:o,width:n,height:r},rows:[],paraNumber:0,font:t.canvas.font=h};return function(e,i,s){Ku=e,$u=e.rows,Ju=e.bounds,Qu=!Ju.width&&!s.autoSizeAlign;const{__letterSpacing:o,paraIndent:n,textCase:r}=s,{canvas:a}=t,{width:h,height:l}=Ju;if(h||l||o||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;Zu=!0,Gu=null,Hu=Xu=Vu=Wu=zu=0,Fu={data:[]},Iu={words:[]},o&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)Yu=i[s],"\n"===Yu?(Wu&&ep(),Iu.paraEnd=!0,ip(),Zu=!0):(ju=Su(Yu),ju===Lu&&"none"!==r&&(Yu=Tu(Yu,r,!Wu)),Xu=a.measureText(Yu).width,o&&(o<0&&(Vu=Xu),Xu+=o),Uu=ju===Pu&&(Gu===Pu||Gu===Lu)||Gu===Pu&&ju!==Au,qu=!(ju!==Ou&&ju!==Pu||Gu!==Du&&Gu!==Au),Nu=Zu&&n?h-n:h,t&&h&&zu+Wu+Xu>Nu&&(e?(Wu&&ep(),zu&&ip()):(qu||(qu=ju===Lu&&Gu==Au),Uu||qu||ju===Mu||ju===Ou||ju===Pu||Wu+Xu>Nu?(Wu&&ep(),zu&&ip()):zu&&ip()))," "===Yu&&!0!==Zu&&zu+Wu===0||(ju===Mu?(" "===Yu&&Wu&&ep(),tp(Yu,Xu),ep()):Uu||qu?(Wu&&ep(),tp(Yu,Xu)):tp(Yu,Xu)),Gu=ju);Wu&&ep(),zu&&ip(),$u.length>0&&($u[$u.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Ku.paraNumber++,zu=a.measureText(t).width,$u.push({x:n||0,text:t,width:zu,paraStart:!0}),Qu&&sp()}))}(d,e,i),l&&function(t,e,i,s,o){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":hp(e,"x",t[ap]);break;case"right":hp(e,"x",-t[np])}if(!o&&i.autoSizeAlign)switch(i.verticalAlign){case"top":hp(e,"y",t[op]);break;case"bottom":hp(e,"y",-t[rp])}}(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(e,i,s,o){if(!o)return;const{rows:n,overflow:r}=e;let{textOverflow:a}=i;if(n.splice(r),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.canvas.measureText(a).width:0,d=s+o-l;("none"===i.textWrap?n:[n[r-1]]).forEach((t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let s=i;s>-1&&(e=t.data[s],h=e.x+e.width,!(s===i&&h<d));s--){if(h<d&&" "!==e.char||!s){t.data.splice(s+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:a,x:h}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(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=ih.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 dp={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!ih.object)return t;t=ih.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+")"}};Object.assign(eh,lp),Object.assign(ih,dp),Object.assign(nh,Qd),Object.assign(rh,Oc),Object.assign(ah,Jc),Object.assign(hh,nu),Object.assign(Lt,{interaction:(t,e,i,s)=>new Dd(t,e,i,s),hitCanvas:(t,e)=>new Pa(t,e),hitCanvasManager:()=>new xd}),Gh.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&Da(0,wx)}catch(t){}function cp(t){return t?t instanceof Array?t:[t]:[]}class up extends $n{get list(){return cp(this.value)}get oldList(){return cp(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}up.BEFORE_SELECT="editor.before_select",up.SELECT="editor.select",up.BEFORE_HOVER="editor.before_hover",up.HOVER="editor.hover";class pp extends up{constructor(t,e){super(t,e)}}pp.BEFORE_MOVE="editor.before_move",pp.MOVE="editor.move";class _p extends up{constructor(t,e){super(t,e)}}_p.BEFORE_SCALE="editor.before_scale",_p.SCALE="editor.scale";class gp extends up{constructor(t,e){super(t,e)}}gp.BEFORE_ROTATE="editor.before_rotate",gp.ROTATE="editor.rotate";class fp extends up{constructor(t,e){super(t,e)}}function yp(t){return(e,i)=>{const s="_"+i;Co(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);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?up.BEFORE_SELECT:up.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new up(s,{editor:this,value:e,oldValue:o}))}this[s]=e,t(this,o)}}})}}fp.BEFORE_SKEW="editor.before_skew",fp.SKEW="editor.skew";const{abs:mp}=Math,{copy:vp,scale:wp}=x,{setListWithFn:xp}=pt,{worldBounds:bp}=Fn,kp={a:1,b:0,c:0,d:1,e:0,f:0},Ep={x:0,y:0,width:0,height:0};class Bp extends Xh{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){this.set(e),this.target=t,this.update()}update(){const{list:t}=this;t.length?(xp(Ep,t,bp),this.set(Ep),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=mp(d.scaleX),h=mp(d.scaleY);if(vp(kp,d),kp.half=r%2,i!==h){wp(kp,1/i,1/h),t.setWorld(kp,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(kp,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),o.strokeWidth=r/mp(d.scaleX);n&&("string"==typeof n?nh.stroke(n,this,t):nh.strokes(n,this,t)),a&&("string"==typeof a?nh.fill(a,this,t):nh.fills(a,this,t))}}o.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}jt([yp((function(t){const e=t.target;t.list=e?e instanceof Array?e:[e]:[]}))],Bp.prototype,"target",void 0);class Sp extends Hh{constructor(t){super(t),this.strokeArea=new Uh({strokeAlign:"center"}),this.fillArea=new Uh,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 Rp={findOne:t=>t.list.find((t=>t.editable)),findByBounds(t,e){const i=[];return Tp([t],i,e),i}};function Tp(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&&Tp(s.children,e,i)}}const{findOne:Cp,findByBounds:Lp}=Rp;class Pp extends Hh{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 Bp,this.targetStroker=new Bp,this.bounds=new yt,this.selectArea=new Sp,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(){if(this.running){const{mergeConfig:t,list:e}=this.editor,{stroke:i,strokeWidth:s,selectedStyle:o}=t;this.targetStroker.setTarget(e,Object.assign({stroke:i,strokeWidth:Math.max(1,s/2)},o||{})),this.hoverStroker.target=null}}update(){this.hoverStroker.update(),this.targetStroker.update()}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(Lp(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&&!Cp(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Ta(this.editor.editBox.rect)};return Cp(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Cp(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(t.shiftKey||i)}__listenEvents(){const{editor:t}=this;t.waitLeafer((()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[up.HOVER,this.onHover,this],[up.SELECT,this.onSelect,this]]),e.on_([[Gl.MOVE,this.onPointerMove,this],[Gl.BEFORE_DOWN,this.onBeforeDown,this],[Gl.TAP,this.onTap,this],[Zl.START,this.onDragStart,this,!0],[Zl.DRAG,this.onDrag,this],[Zl.END,this.onDragEnd,this],[Ql.MOVE,this.onAutoMove,this],[[ed.ZOOM,Ql.MOVE],()=>{this.editor.hoverTarget=null}]])]}))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:Op,top:Ap,topRight:Dp,right:Mp,bottomRight:Fp,bottom:Ip,bottomLeft:Wp,left:zp}=j,{toPoint:Np}=U,{within:Yp}=r,Xp={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,k=a?v:x*u.width/y,E=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,R=(s.y+m)/m,T=(-s.x+y)/y;switch(i){case Ap:c=B,h="bottom";break;case Mp:d=S,h="left";break;case Ip:c=R,h="top";break;case zp:d=T,h="right";break;case Op:c=B,d=T,h="bottom-right";break;case Dp:c=B,d=S,h="bottom-left";break;case Fp:c=R,d=S,h="top-left";break;case Wp:c=R,d=T,h="top-right"}if(o)if("corner"===o&&i%2)o=!1;else{let t;switch(i){case Ap:case Ip:t=c;break;case zp:case Mp:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const C=1!==d,L=1!==c;if(C&&(d/=k),L&&(c/=E),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(Np(n||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new yt(t.__localBoxBounds);if(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;C&&(d*=s),L&&(c*=o)}}if(C&&p){const e=u.width*t.scaleX;d=Yp(e*d,p)/e}if(L&&_){const e=u.height*t.scaleY;c=Yp(e*c,_)/e}return C&&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),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 Op:n="bottom-right";break;case Dp:n="bottom-left";break;case Fp:n="top-left";break;case Wp:n="top-right";break;default:n="center"}return Np(o||n,t,r,!0),{origin:r,rotation:A.getRotation(s,r,i)}},getSkewData(t,e,i,s){let o,n,r={},a=0,h=0;switch(e){case Ap:case Op:n={x:.5,y:0},o="bottom",a=1;break;case Ip:case Fp:n={x:.5,y:1},o="top",a=1;break;case zp:case Wp:n={x:0,y:.5},o="right",h=1;break;case Mp:case Dp: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,Np(s||o,t,r,!0);const c=A.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 zp:t=Mp;break;case Op:t=Dp;break;case Wp:t=Fp;break;case Mp:t=zp;break;case Dp:t=Op;break;case Fp:t=Wp}if(i)switch(t){case Ap:t=Ip;break;case Op:t=Wp;break;case Dp:t=Fp;break;case Ip:t=Ap;break;case Wp:t=Op;break;case Fp:t=Dp}return t}},Hp={};function Vp(t,e){const{editBox:i}=t,s=i.enterPoint;if(!s||!t.editing||!i.visible)return;if("circle"===s.name)return;if("button"===s.pointType)return void(s.cursor||(s.cursor="pointer"));let{rotation:o}=i;const{resizeCursor:n,rotateCursor:a,skewCursor:h,resizeable:l,rotateable:d,skewable:c}=t.mergeConfig,{pointType:u}=s,{flippedX:p,flippedY:_}=i;let g=u.includes("resize");g&&d&&(e.metaKey||e.ctrlKey||!l)&&(g=!1);const f=c&&!g&&("resize-line"===s.name||"skew"===u)?h:g?n:a;o+=45*(Xp.getFlipDirection(s.direction,p,_)+1),o=2*Math.round(r.formatRotation(o,!0)/2);const{url:y,x:m,y:v}=f,w=y+o;Hp[w]?s.cursor=Hp[w]:Hp[w]=s.cursor={url:Gp(y,o),x:m,y:v}}function jp(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.editBox.rect.cursor=i?e:void 0}function Gp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class Up extends tl{constructor(t){super(t),this.useFastShadow=!0}}const qp=["top","right","bottom","left"],Zp=void 0;class Kp extends Hh{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}constructor(t){super(),this.view=new Hh,this.rect=new tl({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new Up({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Hh({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,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 Up({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),n.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new Up({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new Up({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{mergeConfig:t,element:e,single:i}=this.editor,{rect:s,circle:o,resizePoints:n}=this,{stroke:r,strokeWidth:a}=t,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])),t%2||(d.rotation=t/2*90);o.set(this.getPointStyle(t.circle||t.rotatePoint||h[0])),s.set(Object.assign({stroke:r,strokeWidth:a,editConfig:Zp},t.rect||{})),s.hittable=!i,s.syncEventer=i&&this.editor,i&&(e.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:e}])}update(t){const{rect:e,circle:i,buttons:s,resizePoints:o,rotatePoints:n,resizeLines:r,editor:a}=this,{mergeConfig:h,element:l,multiple:d,editMask:c}=a,{middlePoint:u,resizeable:p,rotateable:_,hideOnSmall:g,editBox:f,mask:y}=h;if(this.visible=!l.locked,c.visible=!!y||0,this.view.worldOpacity){const{width:a,height:l}=t,c="number"==typeof g?g:10,y=f&&!(g&&a<c&&l<c);let m,v,w,x={};for(let e=0;e<8;e++)U.toPoint(U.directionData[e],t,x),v=o[e],m=n[e],w=r[Math.floor(e/2)],v.set(x),m.set(x),w.set(x),v.visible=w.visible=y&&!(!p&&!_),m.visible=y&&_&&p&&!h.rotatePoint,e%2&&(v.visible=m.visible=y&&!!u,(e+1)/2%2?(w.width=a,g&&2*v.width>a&&(v.visible=!1)):(w.height=l,v.rotation=90,g&&2*v.width>l&&(v.visible=!1)));i.visible=y&&_&&!(!h.circle&&!h.rotatePoint),i.visible&&this.layoutCircle(h),e.path&&(e.path=null),e.set(Object.assign(Object.assign({},t),{visible:!!d||f})),s.visible=y&&s.children.length>0||0,s.visible&&this.layoutButtons(h)}else e.set(t)}layoutCircle(t){const{circleDirection:e,circleMargin:i,buttonsMargin:s,buttonsDirection:o,middlePoint:n}=t,r=qp.indexOf(e||(this.buttons.children.length&&"bottom"===o?"top":"bottom"));this.setButtonPosition(this.circle,r,i||s,!!n)}layoutButtons(t){const{buttons:e}=this,{buttonsDirection:i,buttonsFixed:s,buttonsMargin:o,middlePoint:n}=t,{flippedX:r,flippedY:a}=this;let h=qp.indexOf(i);(h%2&&r||(h+1)%2&&a)&&s&&(h=(h+2)%4);const l=s?Xp.getRotateDirection(h,this.flippedOne?this.rotation:-this.rotation,4):h;this.setButtonPosition(e,l,o,!!n),s&&(e.rotation=90*(l-h)),e.scaleX=r?-1:1,e.scaleY=a?-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)}unload(){this.visible=!1}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:o,pointRadius:n}=this.editor.mergeConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:o,height:o,cornerRadius:n,offsetX:0,offsetY:0,editConfig:Zp};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.editor.mergeConfig;return t instanceof Array?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.editor.mergeConfig;return t instanceof Array?t:t?[t]:this.getPointsStyle()}onSelect(t){1===t.oldList.length&&(t.oldList[0].syncEventer=null,this.app&&(this.app.interaction.bottomList=null))}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{editor:s,dragStartData:o}=this,{element:n}=s;"rect"===e.name&&(this.moving=!0,s.opacity=s.mergeConfig.hideOnMove?0:1),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.dragging=!1,this.dragPoint=null,this.moving=!1;const{name:e,pointType:i}=t.current;"rect"===e&&(this.editor.opacity=1),i&&i.includes("resize")&&(lr.resizingKeys=null)}onDrag(t){const{editor:e}=this,{pointType:i}=this.enterPoint=t.current;i.includes("rotate")||t.metaKey||t.ctrlKey||!e.mergeConfig.resizeable?(e.onRotate(t),"resize-rotate"===i&&e.onScale(t)):"resize"===i&&e.onScale(t),"skew"===i&&e.onSkew(t),Vp(e,t)}onArrow(t){const{editor:e}=this;if(e.editing&&e.mergeConfig.keyEvent){let i=0,s=0;const o=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=o;break;case"ArrowUp":s=-o;break;case"ArrowLeft":i=-o;break;case"ArrowRight":i=o}(i||s)&&e.move(i,s)}}onDoubleTap(t){"double"===this.editor.mergeConfig.openInner&&this.openInner(t)}onLongPress(t){"long"===this.editor.mergeConfig.openInner&&this.openInner(t)}openInner(t){const{editor:e}=this;if(e.single){const{element:i}=e;if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find((t=>t.editable&&t instanceof Wl))||t.find((t=>t instanceof Wl));if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){const{editor:s}=this;t.direction=i,t.pointType=e;const o=[[Zl.START,this.onDragStart,this],[Zl.DRAG,this.onDrag,this],[Zl.END,this.onDragEnd,this],[Gl.LEAVE,()=>{this.enterPoint=null}]];"circle"!==t.name&&o.push([Gl.ENTER,e=>{this.enterPoint=t,Vp(s,e)}]),this.__eventIds.push(t.on_(o))}__listenEvents(){const{rect:t,editor:e}=this;this.__eventIds.push(e.on_(up.SELECT,this.onSelect,this),t.on_([[Zl.START,this.onDragStart,this],[Zl.DRAG,e.onMove,e],[Zl.END,this.onDragEnd,this],[Gl.ENTER,()=>jp(e)],[Gl.DOUBLE_TAP,this.onDoubleTap,this],[Gl.LONG_PRESS,this.onLongPress,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const Jp={x:0,y:0,width:1e5,height:1e5};class Qp extends Xh{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,Jp),Object.assign(this.__world,Jp)}__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"),i.list.forEach((i=>{i.__renderShape(t,e);const{__box:s,parent:o}=i;((i=s)||(i=o)&&o.textBox)&&i.__renderShape(t,e)})),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const $p='\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"/>',t_={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${$p}\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${$p}\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${$p}\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},e_=new yt;function i_(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer.zoomLayer;e.safeChange((()=>{e_.setListWithFn(i,(t=>t.getBounds("box","page"))),0===e_.width&&(e_.width=.1),0===e_.height&&(e_.height=.1),e.reset(e_.get())})),s.add(e)}const s_=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),o_=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),n_={group(t,e,i){t.sort(o_);const{app:s,parent:o}=t[0];let n;n=i&&i.add?i:new Hh(i),o.addAt(n,o.children.indexOf(t[0])),t.sort(s_);const r=new N(e.worldTransform);return r.divideParent(o.worldTransform),n.setTransform(r),n.editable=!0,n.hitChildren=!1,s.lockLayout(),t.forEach((t=>t.dropTo(n))),s.unlockLayout(),n},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(s_),t.forEach((t=>{t.parent&&t.parent.add(t)}))},toBottom(t){t.sort(o_),t.forEach((t=>{t.parent&&t.parent.addAt(t,0)}))}},r_=bt.get("EditToolCreator");function a_(){return t=>{l_.register(t)}}const h_=a_,l_={list:{},register(t){const{tag:e}=t.prototype;d_[e]&&r_.repeat(e),d_[e]=t},get:(t,e)=>new d_[t](e)},{list:d_}=l_;class c_ extends up{constructor(t,e){super(t,e)}}c_.BEFORE_OPEN="innerEditor.before_open",c_.OPEN="innerEditor.open",c_.BEFORE_CLOSE="innerEditor.before_close",c_.CLOSE="innerEditor.close";class u_ extends up{constructor(t,e){super(t,e)}}u_.BEFORE_GROUP="editor.before_group",u_.GROUP="editor.group",u_.BEFORE_UNGROUP="editor.before_ungroup",u_.UNGROUP="editor.ungroup",u_.BEFORE_OPEN="editor.before_open_group",u_.OPEN="editor.open_group",u_.BEFORE_CLOSE="editor.before_close_group",u_.CLOSE="editor.close_group";const{updateMatrix:p_}=Tn,__={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},g_="top-left";class f_ extends Uh{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&&__[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,p_(this.parent),p_(this);const a=new N(this.__world);switch(r[i]=s,this.__layout.rotationChange(),p_(this),this.changedTransform=new N(this.__world).divide(a),i){case"x":t.move(n,0);break;case"y":t.move(0,n);break;case"rotation":t.rotateOf(g_,n);break;case"scaleX":t.scaleOf(g_,n,1);break;case"scaleY":t.scaleOf(g_,1,n);break;case"skewX":t.skewOf(g_,n,0);break;case"skewY":t.skewOf(g_,0,n)}this.canChange=!0}}))}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class y_ extends Hh{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 dragging(){return this.editBox.dragging}get moving(){return this.editBox.moving}get dragPoint(){return this.editBox.dragPoint}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 f_(this),this.editBox=new Kp(this),this.editToolList={},this.selector=new Pp(this),this.editMask=new Qp(this),this.targetEventIds=[];let i=Wt.clone(t_);t&&(i=Wt.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Ct.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&&i_(this),this.update()}updateEditTool(){const t=this.editTool;if(t&&(this.editBox.unload(),t.unload(),this.editTool=null),this.editing){const t=this.single?this.list[0].editOuter:"EditTool";this.editTool=this.editToolList[t]=this.editToolList[t]||l_.get(t,this),this.editBox.load(),this.editTool.load()}}getEditSize(t){return this.mergeConfig.editSize}onMove(t){if(t instanceof Ql){if("drag"!==t.moveType){const{moveable:e,resizeable:i}=this.mergeConfig,s=t.getLocalMove(this.element);"move"===e?(t.stop(),this.move(s.x,s.y)):"zoom"===i&&t.stop()}}else{const e={x:t.totalX,y:t.totalY};t.shiftKey&&(Math.abs(e.x)>Math.abs(e.y)?e.y=0:e.x=0),this.move(Zl.getValidMove(this.element,this.editBox.dragStartData.point,e))}}onScale(t){const{element:e}=this;let{around:i,lockRatio:s,resizeable:o,flipable:n,editSize:r}=this.mergeConfig;if(t instanceof ed)"zoom"===o&&(t.stop(),this.scaleOf(e.getBoxPoint(t),t.scale,t.scale));else{const{direction:o}=t.current;(t.shiftKey||e.lockRatio)&&(s=!0);const a=Xp.getScaleData(e,this.editBox.dragStartData.bounds,o,t.getInnerTotal(e),s,Xp.getAround(i,t.altKey),n,this.multiple||"scale"===r);this.editTool.onScaleWithDrag?(a.drag=t,this.scaleWithDrag(a)):this.scaleOf(a.origin,a.scaleX,a.scaleY)}}onRotate(t){const{skewable:e,rotateable:i,around:s,rotateGap:o}=this.mergeConfig,{direction:n,name:a}=t.current;if(e&&"resize-line"===a)return this.onSkew(t);const{element:h}=this,{dragStartData:l}=this.editBox;let d,c;if(t instanceof $l){if("rotate"!==i)return;t.stop(),c=t.rotation,d=h.getBoxPoint(t),h.scaleX*h.scaleY<0&&(c=-c)}else{const e=Xp.getRotateData(h.boxBounds,n,t.getBoxPoint(h),h.getBoxPoint(l),t.shiftKey?null:h.around||h.origin||s||"center");c=e.rotation,d=e.origin}h.scaleX*h.scaleY<0&&(c=-c),t instanceof Zl&&(c=l.rotation+c-h.rotation),c=r.float(r.getGapRotation(c,o,h.rotation),2),c&&this.rotateOf(d,c)}onSkew(t){const{element:e}=this,{around:i}=this.mergeConfig,{origin:s,skewX:o,skewY:n}=Xp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),Xp.getAround(i,t.altKey));(o||n)&&this.skewOf(s,o,n)}move(t,e=0){if(!this.checkTransform("moveable"))return;"object"==typeof t&&(e=t.y,t=t.x);const{element:i}=this,{beforeMove:s}=this.mergeConfig;if(s){const o=s({target:i,x:t,y:e});if("object"==typeof o)t=o.x,e=o.y;else if(!1===o)return}const o=i.getWorldPointByLocal({x:t,y:e},null,!0);this.multiple&&i.safeChange((()=>i.move(t,e)));const n={target:i,editor:this,moveX:o.x,moveY:o.y};this.emitEvent(new pp(pp.BEFORE_MOVE,n));const r=new pp(pp.MOVE,n);this.editTool.onMove(r),this.emitEvent(r)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{element:e}=this,{beforeScale:i}=this.mergeConfig;if(i){const{origin:s,scaleX:o,scaleY:n,drag:r}=t;if(!1===i({target:e,drag:r,origin:s,scaleX:o,scaleY:n}))return}t=Object.assign(Object.assign({},t),{target:e,editor:this,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new _p(_p.BEFORE_SCALE,t));const s=new _p(_p.SCALE,t);this.editTool.onScaleWithDrag(s),this.emitEvent(s)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{element:o}=this,{beforeScale:n}=this.mergeConfig;if(n){const s=n({target:o,origin:t,scaleX:e,scaleY:i});if("object"==typeof s)e=s.scaleX,i=s.scaleY;else if(!1===s)return}const r=this.getWorldOrigin(t),a=this.multiple&&this.getChangedTransform((()=>o.safeChange((()=>o.scaleOf(t,e,i))))),h={target:o,editor:this,worldOrigin:r,scaleX:e,scaleY:i,transform:a};this.emitEvent(new _p(_p.BEFORE_SCALE,h));const l=new _p(_p.SCALE,h);this.editTool.onScale(l),this.emitEvent(l)}flip(t){if(!this.checkTransform("resizeable"))return;const{element:e}=this,i=this.getWorldOrigin("center"),s=this.multiple?this.getChangedTransform((()=>e.safeChange((()=>e.flip(t))))):new N(Tn.getFlipTransform(e,t)),o={target:e,editor:this,worldOrigin:i,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:s};this.emitEvent(new _p(_p.BEFORE_SCALE,o));const n=new _p(_p.SCALE,o);this.editTool.onScale(n),this.emitEvent(n)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{element:i}=this,{beforeRotate:s}=this.mergeConfig;if(s){const o=s({target:i,origin:t,rotation:e});if("number"==typeof o)e=o;else if(!1===o)return}const o=this.getWorldOrigin(t),n=this.multiple&&this.getChangedTransform((()=>i.safeChange((()=>i.rotateOf(t,e))))),r={target:i,editor:this,worldOrigin:o,rotation:e,transform:n};this.emitEvent(new gp(gp.BEFORE_ROTATE,r));const a=new gp(gp.ROTATE,r);this.editTool.onRotate(a),this.emitEvent(a)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{element:o}=this,{beforeSkew:n}=this.mergeConfig;if(n){const s=n({target:o,origin:t,skewX:e,skewY:i});if("object"==typeof s)e=s.skewX,i=s.skewY;else if(!1===s)return}const r=this.getWorldOrigin(t),a=this.multiple&&this.getChangedTransform((()=>o.safeChange((()=>o.skewOf(t,e,i))))),h={target:o,editor:this,worldOrigin:r,skewX:e,skewY:i,transform:a};this.emitEvent(new fp(fp.BEFORE_SKEW,h));const l=new fp(fp.SKEW,h);this.editTool.onSkew(l),this.emitEvent(l)}checkTransform(t){return this.element&&!this.element.locked&&this.mergeConfig[t]}getWorldOrigin(t){return this.element.getWorldPoint(Tn.getInnerOrigin(this.element,t))}getChangedTransform(t){const{element:e}=this;if(this.multiple&&!e.canChange)return e.changedTransform;const i=new N(e.worldTransform);return t(),new N(e.worldTransform).divide(i)}group(t){return this.multiple&&(this.emitGroupEvent(u_.BEFORE_GROUP),this.target=n_.group(this.list,this.element,t),this.emitGroupEvent(u_.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach((t=>t.isBranch&&this.emitGroupEvent(u_.BEFORE_UNGROUP,t))),this.target=n_.ungroup(t),t.forEach((t=>t.isBranch&&this.emitGroupEvent(u_.UNGROUP,t)))),this.list}openGroup(t){this.emitGroupEvent(u_.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(u_.OPEN,t)}closeGroup(t){this.emitGroupEvent(u_.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(u_.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach((t=>this.list.every((e=>!Tn.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 u_(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e){if(t&&e&&(this.target=t),this.single){const e=t||this.element,i=e.editInner;i&&l_.list[i]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[i]||l_.get(i,this),this.innerEditor.editTarget=e,this.emitInnerEvent(c_.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(c_.OPEN))}}closeInnerEditor(){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(c_.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(c_.CLOSE),this.editTool.load(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new c_(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&&(n_.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(n_.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()}onKey(t){Vp(this,t)}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,editBox:i,editMask:s}=this;this.targetEventIds=[e.on_(ur.START,this.onRenderStart,this),t.on_([[ur.CHILD_START,this.onAppRenderStart,this],[Ql.BEFORE_MOVE,this.onMove,this,!0],[ed.BEFORE_ZOOM,this.onScale,this,!0],[$l.BEFORE_ROTATE,this.onRotate,this,!0],[[id.HOLD,id.UP],this.onKey,this],[id.DOWN,i.onArrow,i]])],s.visible&&s.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)=>{Co(t,e,{get(){const{config:t,element:e,dragPoint:i}=this,s=Object.assign({},t);return e&&e.editConfig&&Object.assign(s,e.editConfig),i&&(i.editConfig&&Object.assign(s,i.editConfig),"font-size"===s.editSize&&(s.lockRatio=!0),"resize-rotate"===i.pointType&&(s.around||(s.around="center"),Ht(s.lockRatio)&&(s.lockRatio=!0))),this.mergedConfig=s}})}],y_.prototype,"mergeConfig",void 0),jt([yp((function(t,e){t.emitEvent(new up(up.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))}))],y_.prototype,"hoverTarget",void 0),jt([yp((function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Ta?i:new Ta(i),t.multiple&&i_(t)):(t.simulateTarget.remove(),t.leafList.reset(),t.closeInnerEditor()),t.emitEvent(new up(up.SELECT,{editor:t,value:i,oldValue:e})),t.checkOpenedGroups(),t.editing?t.waitLeafer((()=>{jp(t),t.updateEditTool(),t.update(),t.listenTargetEvents()})):(t.updateEditTool(),t.removeTargetEvents())}))],y_.prototype,"target",void 0);class m_{static registerInnerEditor(){l_.register(this)}get tag(){return"InnerEditor"}get editBox(){return this.editor.editBox}constructor(t){this.editor=t,this.create()}onCreate(){}create(){this.view=new Hh,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&(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)}}let v_=class extends m_{static registerEditTool(){l_.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(){const{editor:t,editBox:e}=this,{x:i,y:s,scaleX:o,scaleY:n,rotation:r,skewX:a,skewY:h,width:l,height:d}=t.element.getLayoutBounds("box",t,!0);e.set({x:i,y:s,scaleX:o,scaleY:n,rotation:r,skewX:a,skewY:h}),e.update({x:0,y:0,width:l,height:d}),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};v_=jt([a_()],v_);const{left:w_,right:x_}=j,{move:b_,copy:k_,toNumberPoints:E_}=A;let B_=class extends v_{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===w_;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=E_(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?(b_(t,n,r),s&&b_(e,-n,-r)):(s&&b_(t,-n,-r),b_(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),k_(s[7],i),k_(e[7],i),k_(s[3],a),k_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===w_||t===x_,s[t].visible=a,e[t].visible=!r&&a}};B_=jt([a_()],B_);const{M:S_,L:R_,C:T_,Q:C_,Z:L_,N:P_,D:O_,X:A_,G:D_,F:M_,O:F_,P:I_,U:W_}=re,z_={scale(t,e,i){if(!t)return;let s,o=0,n=t.length;for(;o<n;)switch(s=t[o],s){case S_:case R_:N_(t,e,i,o,1),o+=3;break;case T_:N_(t,e,i,o,3),o+=7;break;case C_:N_(t,e,i,o,2),o+=5;break;case L_:o+=1;break;case P_:N_(t,e,i,o,2),o+=5;break;case O_:N_(t,e,i,o,2),o+=9;break;case A_:N_(t,e,i,o,2),o+=6;break;case D_:N_(t,e,i,o,2),o+=9;break;case M_:N_(t,e,i,o,2),o+=5;break;case F_:t[o]=D_,t.splice(o+4,0,t[o+3],0),N_(t,e,i,o,2),o+=9,n+=2;break;case I_:t[o]=M_,t.splice(o+4,0,t[o+3]),N_(t,e,i,o,2),o+=5,n+=1;break;case W_:N_(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:N_}=z_,Y_=x.get(),{topLeft:X_,top:H_,topRight:V_,right:j_,bottom:G_,left:U_}=j;function q_(t,e,i){t.pathInputed?K_(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function Z_(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 H_:case G_:o=i,n.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case U_:case j_:n.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case X_:case V_: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 K_(t,e,i){z_.scale(t.__.path,e,i),t.path=t.__.path}function J_(t,e,i){const{points:s}=t;"object"==typeof s[0]?s.forEach((t=>{t.x*=e,t.y*=i})):z_.scalePoints(s,e,i),t.points=s}function Q_(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)Y_.a=e,Y_.d=i,s[t].transform(Y_,!0)}const $_=ya.prototype;function tg(t,e,i){eg(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(Ql.BEFORE_MOVE,(e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY))})),t.on_(ed.BEFORE_ZOOM,(e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)})))}function eg(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)}$_.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))},$_.__scaleResize=function(t,e){q_(this,t,e)},$_.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},$_.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Wl.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?Z_(this,t,e,n&&n.direction):q_(this,t,e)},zl.prototype.__scaleResize=function(t,e){K_(this,t,e)},_l.prototype.__scaleResize=function(t,e){this.pathInputed?K_(this,t,e):this.points?J_(this,t,e):this.width*=t},kl.prototype.__scaleResize=function(t,e){this.pathInputed?K_(this,t,e):this.points?J_(this,t,e):q_(this,t,e)},Hh.prototype.__scaleResize=function(t,e){Q_(this,t,e)},tl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||q_(this,t,e),i&&Q_(this,t,e)},Ct.add("resize"),Ct.add("editor","resize"),Lt.editor=function(t,e){const i=new y_(t);return e&&e.sky.add(e.editor=i),i},tl.addAttr("textBox",!1,Do),Xh.addAttr("editConfig",void 0,Do),Xh.addAttr("editOuter",(t=>t.__.__isLinePath?"LineEditTool":"EditTool"),Do),Xh.addAttr("editInner","PathEditor",Do),Hh.addAttr("editInner","",Do),Wl.addAttr("editInner","TextEditor",Do),Xh.setEditConfig=function(t){this.changeAttr("editConfig",t)},Xh.setEditOuter=function(t){this.changeAttr("editOuter",t)},Xh.setEditInner=function(t){this.changeAttr("editInner",t)};const ig=bt.get("LeaferTypeCreator"),sg={list:{},register(t,e){og[t]&&ig.repeat(t),og[t]=e},run(t,e){const i=og[t];i&&i(e)}},{list:og,register:ng}=sg;ng("viewport",tg),ng("custom",(function(t){tg(t,null,!0)})),ng("design",(function(t){tg(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})})),ng("document",(function(t){tg(t,{zoom:{min:1},move:{scroll:"limit"}})}));const rg={getData(t){const e=t[0],i=t[1],s=A.getCenter(e.from,i.from),o=A.getCenter(e.to,i.to),n={x:o.x-s.x,y:o.y-s.y},r=A.getDistance(e.from,i.from);return{move:n,scale:A.getDistance(e.to,i.to)/r,rotation:A.getRotation(e.from,i.from,e.to,i.to),center:o}}},ag={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(e,i){let s,o=1,{zoomMode:n,zoomSpeed:a}=i;const h=e.deltaY||e.deltaX;if(n?(s="mouse"===n||!e.deltaX&&(t.intWheelDeltaY?Math.abs(h)>17:Math.ceil(h)!==h),(e.shiftKey||e.metaKey||e.ctrlKey)&&(s=!0)):s=!e.shiftKey&&(e.metaKey||e.ctrlKey),s){a=r.within(a,0,1);o=1-h/(4*(e.deltaY?i.delta.y:i.delta.x))*a,o<.5&&(o=.5),o>=1.5&&(o=1.5)}return o}};class hg{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(Ql.START,this.moveData)),t.path=this.moveData.path,e.emit(Ql.BEFORE_MOVE,t),e.emit(Ql.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(ed.START,this.zoomData)),t.path=this.zoomData.path,e.emit(ed.BEFORE_ZOOM,t),e.emit(ed.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit($l.START,this.rotateData)),t.path=this.rotateData.path,e.emit($l.BEFORE_ROTATE,t),e.emit($l.ROTATE,t),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:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(Ql.END,e),i&&t.emit(ed.END,i),s&&t.emit($l.END,s),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const lg=Gh.prototype,dg=new yt;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:o,height:n}=dg.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}},lg.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 pg=vd.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: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):ag.getScale(t,e);if(1!==n)this.zoom(ug(n,t));else{const s=e.getMove?e.getMove(t,e):ag.getMove(t,e);i.snap&&A.round(s),this.move(cg(s,t))}},pg.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:o,center:n}=rg.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(ug(o,t)),this.move(cg(i,t))};const _g=ld.prototype,{abs:gg}=Math;function fg(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}_g.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,o=gg(i),n=gg(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),A.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: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,A.move(i,c,u),A.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)},Ct.add("viewport"),Ct.add("view"),Gh.prototype.zoom=function(t,e,i,s){this.killAnimate();const{zoomLayer:o}=this,n=this.canvas.bounds.clone().shrink(void 0!==e?e:30),r=new yt,a={x:n.x+n.width/2,y:n.y+n.height/2};let h;const{x:l,y:d,scaleX:c,scaleY:u}=o.__;if("string"==typeof t)switch(t){case"in":h=fg(c,"in");break;case"out":h=fg(c,"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&&(h=t/c);if(h)h=this.getValidScale(h),o.scaleOfWorld(a,h,h,!1,s);else if("object"==typeof t){const e={x:l,y:d,scaleX:c,scaleY:u},a=t instanceof Array;if(a||t.tag){const e=a?t:[t];r.setListWithFn(e,Fn.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,n);r.set(o.getWorldBounds(e))}const{width:p,height:_}=r;let g=n.x-r.x,f=n.y-r.y;return i?(g+=Math.max((n.width-p)/2,0),f+=Math.max((n.height-_)/2,0)):(h=this.getValidScale(Math.min(n.width/p,n.height/_)),g+=(n.width-p*h)/2,f+=(n.height-_*h)/2,A.scaleOf(e,r,h),r.scaleOf(r,h),e.scaleX*=h,e.scaleY*=h),A.move(e,g,f),r.move(g,f),o.set(e,s),r}return o.worldBoxBounds};class yg extends Hh{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(t){let e;"string"==typeof t?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new tl,this.scrollYBar=new tl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{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:t,scrollYBar:e}=this;this.__eventIds=[t.on_(Zl.DRAG,this.onDrag,this),e.on_(Zl.DRAG,this.onDrag,this),t.on_(Zl.END,this.onDragEnd,this),e.on_(Zl.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())}}Ct.add("scroll");class mg extends Bh{}function vg(t){return Po(t,(t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,jo(this)}}})))}let wg=class extends _l{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}};jt([nn(mg)],wg.prototype,"__",void 0),jt([vg("angle")],wg.prototype,"endArrow",void 0),wg=jt([gn()],wg);const{M:xg,L:bg,C:kg,Q:Eg,O:Bg}=re,{rotate:Sg,copyFrom:Rg,scale:Tg}=A,Cg={},Lg={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 xg:case bg:Pg(t,l+1,e,i,s,o,n,r),l+=3;break;case kg:for(h=1;h<6;h+=2)Pg(t,l+h,e,i,s,o,n,r);l+=7;break;case Eg:for(h=1;h<4;h+=2)Pg(t,l+h,e,i,s,o,n,r);l+=5;break;case Bg: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){Lg.layout(t,0,0,1,1,e,i)}};function Pg(t,e,i,s,o,n,r,a){Rg(Cg,t[e],t[e+1]),r&&Sg(Cg,r,a),o&&Tg(Cg,o,n),t[e]=i+Cg.x,t[e+1]=s+Cg.y}const{layout:Og,rotate:Ag}=Lg,{getAngle:Dg}=A,Mg={x:-.5},Fg={connect:Mg,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Ig={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]},Ng={offset:Mg,path:[...Wg.path],dashPath:[1,-2.5,0,2,-1,0]};Ag(Ng.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]},Xg={connect:{x:.5},path:[...Yg.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Hg={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]},Vg={path:[...Hg.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},jg=Wt.clone(Hg),Gg=Wt.clone(Vg);Ag(jg.path,45),Ag(Gg.path,45);const Ug={angle:Fg,"angle-side":Ig,arrow:zg,triangle:Wg,"triangle-flip":Ng,circle:Xg,"circle-line":Yg,square:Vg,"square-line":Hg,diamond:Gg,"diamond-line":jg,mark:{offset:Mg,path:[1,0,-2,2,0,2]}};function qg(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:Ug[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)),_&&Og(g,_,0),Og(g,s.x,s.y,o,o,Dg(i,s)),n.x=(p+_)*o,g}const{M:Zg,L:Kg,C:Jg,Q:Qg,Z:$g,N:tf,D:ef,X:sf,G:of,F:nf,O:rf,P:af,U:hf}=re,{copy:lf,copyFrom:df,getDistancePoint:cf}=A,uf={},pf={},_f={},gf={},ff={},yf={list:Ug,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 Zg:case Kg:(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 Qg:1!==d&&h+5!==l||mf(r,gf,ff,h+1),h+=5;break;case $g:return;case tf:h+=5;break;case ef:h+=9;break;case sf:h+=6;break;case of:h+=9;break;case nf: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===Kg?ff:gf),h===l){const l=t.__.__pathForRender=e?[...r]:r,d=t.__.__pathForArrow=[];if(c){const e=qg(t,i,_f,pf,o,uf,!!n);n?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=qg(t,s,gf,ff,o,uf,!!n);if(n?d.push(...e):l.push(...e),uf.x){let t;switch(cf(ff,gf,-uf.x,!0),a){case Kg:t=h-3+1;break;case Jg:t=h-7+5;break;case Qg: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}Ct.add("arrow"),Xh.addAttr("startArrow","none",vg),Xh.addAttr("endArrow","none",vg),Object.assign(oh,yf),Object.assign(nh,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let wf=class extends tl{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};jt([nn(class extends bh{})],wf.prototype,"__",void 0),jt([Fo("x")],wf.prototype,"flow",void 0),wf=jt([gn()],wf);const xf={},bf={"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"},kf={"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:o}=t.__layout;K.toPoint(i,e,o,xf),e.x=s.__autoWidth?o.x:xf.x,e.y=s.__autoHeight?o.y:xf.y}const{move:Bf}=A;function Sf(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)),Bf(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function Rf(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 Cf(t,e){const{gap:i,flowAlign:s,flowWrap:o,__autoWidth:n,__autoHeight:r}=t.__,a=o&&(e?!n:!r);return"object"==typeof i?(Tf.xGap=i.x||0,Tf.yGap=i.y||0):Tf.xGap=Tf.yGap=i,Tf.isAutoXGap="string"==typeof Tf.xGap&&!n,Tf.isAutoYGap="string"==typeof 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&&!n,Tf.isFitYGap="fit"===Tf.yGap&&!r,"object"==typeof s?(Tf.contentAlign=s.content||"top-left",Tf.rowXAlign=s.x||"from",Tf.rowYAlign=s.y||"from"):(Tf.contentAlign=s,Tf.rowXAlign=bf[s],Tf.rowYAlign=kf[s])),Tf}function Lf(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function Pf(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 Of(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:Af}=r;function Df(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=Mf(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=Mf(t,n=t.__flowBounds,n.width+o),e-=o-r,i-=s}))}(h,a,l)}}function Mf(t,e,i){const{widthRange:s,lockRatio:o}=t.__,n=s?Af(i,s):i,r=n/e.width;return t.scaleResize(r,o?r:1),e.width=n,i-n}const{within:Ff}=r;function If(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=Wf(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=Wf(t,n=t.__flowBounds,n.height+o),e-=o-r,i-=s}))}(h,a,l)}}function Wf(t,e,i){const{heightRange:s,lockRatio:o}=t.__,n=s?Ff(i,s):i,r=n/e.height;return t.scaleResize(o?r:1,r),e.height=n,i-n}const{move:zf}=A;function Nf(t,e){const i="width",{children:s,itemBox:o}=t,n=Cf(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=Of(_,o),r?(_.__flowBounds=g,m||(m=Lf(y,p)),a&&m.count&&m.width+g.width>x&&(m.grow?Df(t,m,x,e):d&&Pf(m,i,x,c),Rf(u,m,i),m=Lf(y,p)),f=g.width,_.__widthGrow&&(m.grow+=_.__widthGrow,f=0,_.__.widthRange&&(m.hasRangeSize=!0)),_.__heightGrow&&Wf(_,g,b),m.width+=m.count?f+p:f,m.height=Math.max(m.height,g.height),m.count++):(zf(_,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?Df(t,m,x,e):d&&Pf(m,i,x,c),a&&Rf(u,m,i)),a?(s?Pf(u,"height",b,o):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){Ef(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=bf[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],Sf(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,p,e)):(Ef(t,m,r),Sf(t,m,0,m.y,p,e))}}const{move:Yf}=A;function Xf(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)),Yf(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:Hf}=A;function Vf(t,e){const i="height",{children:s,itemBox:o}=t,n=Cf(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=Of(_,o),r?(_.__flowBounds=g,m||(m=Lf(y,p)),a&&m.count&&m.height+g.height>b&&(m.grow&&If(t,m,b,e),d&&Pf(m,i,b,c),Rf(u,m,i),m=Lf(y,p)),f=g.height,_.__heightGrow&&(m.grow+=_.__heightGrow,f=0,_.__.heightRange&&(m.hasRangeSize=!0)),_.__widthGrow&&Mf(_,g,x),m.height+=m.count?f+p:f,m.width=Math.max(m.width,g.width),m.count++):(Hf(_,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&&If(t,m,b,e),d&&Pf(m,i,b,c),a&&Rf(u,m,i)),a?(s?Pf(u,"width",x,o):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){Ef(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=kf[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],Xf(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(Ef(t,m,r),Xf(t,m,m.x,0,l,e))}}function jf(t){return Po(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)&&Yo(this)}})))}Ct.add("flow","resize");const Gf=tl.prototype,{__updateBoxBounds:Uf}=Hh.prototype;Xh.addAttr("flow",!1,Fo),Xh.addAttr("gap",0,zo),Xh.addAttr("flowAlign","top-left",zo),Xh.addAttr("flowWrap",!1,zo),Xh.addAttr("itemBox","box",zo),Xh.addAttr("inFlow",!0,zo),Xh.addAttr("autoWidth",void 0,jf),Xh.addAttr("autoHeight",void 0,jf),Xh.addAttr("autoBox",void 0,zo);const{copyAndSpread:qf}=pt;Gf.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:Nf(this);break;case"y":Vf(this);break;case"x-reverse":Nf(this,!0);break;case"y-reverse":Vf(this,!0)}t&&(this.leafer.created=!0)},Gf.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),qf(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},Gf.__updateBoxBounds=function(t){const e=this.__;if(this.children.length&&!this.pathInputed){const{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():Uf.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&&qf(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:Zf,sin:Kf,pow:Jf,sqrt:Qf,abs:$f,ceil:ty,floor:ey,round:iy,PI:sy}=Math,oy=5*sy,ny=1.70158,ry=2.5949095,ay=7.5625,hy=2.75;function ly(t){return e=>Jf(e,t)}function dy(t){return e=>1-Jf(1-e,t)}function cy(t){return e=>e<.5?.5*Jf(2*e,t):1-.5*Jf(2-2*e,t)}function uy(t){return t<1/hy?ay*t*t:t<2/hy?ay*(t-=1.5/hy)*t+.75:t<2.5/hy?ay*(t-=2.25/hy)*t+.9375:ay*(t-=2.625/hy)*t+.984375}function py(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=_y(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!($f(l)<1e-6));e++)c-=d/l;return o[r]=_y(c,e,s)}}function _y(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const gy={get(t){const{list:e}=gy;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){gy.list[t]=e},list:{linear:t=>t,ease:py(.25,.1,.25,1),"ease-in":py(.42,0,1,1),"ease-out":py(0,0,.58,1),"ease-in-out":py(.42,0,.58,1),"sine-in":t=>1-Zf(t*sy*.5),"sine-out":t=>Kf(t*sy*.5),"sine-in-out":t=>.5*(1-Zf(t*sy)),"quad-in":ly(2),"quad-out":dy(2),"quad-in-out":cy(2),"cubic-in":ly(3),"cubic-out":dy(3),"cubic-in-out":cy(3),"quart-in":ly(4),"quart-out":dy(4),"quart-in-out":cy(4),"quint-in":ly(5),"quint-out":dy(5),"quint-in-out":cy(5),"expo-in":t=>t?Jf(2,10*t-10):0,"expo-out":t=>1===t?1:1-Jf(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Jf(2,2*t*10-10):.5*(2-Jf(2,10-2*t*10)),"circ-in":t=>1-Qf(1-Jf(t,2)),"circ-out":t=>Qf(1-Jf(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Qf(1-Jf(2*t,2))):.5*(Qf(1-Jf(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*((ry+1)*t-ry)*.5:.5*((t=2*t-2)*t*((ry+1)*t+ry)+2),"elastic-in":t=>0===t||1===t?t:-Jf(2,10*(t-1))*Kf((t-1.1)*oy),"elastic-out":t=>0===t||1===t?t:Jf(2,-10*t)*Kf((t-.1)*oy)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Jf(2,10*((t*=2)-1))*Kf((t-1.1)*oy)*.5:Jf(2,10*(1-(t*=2)))*Kf((t-1.1)*oy)*.5+1,"bounce-in":t=>1-uy(1-t),"bounce-out":uy,"bounce-in-out":t=>t<.5?.5*(1-uy(1-2*t)):.5*(1+uy(2*t-1)),"cubic-bezier":py,steps:function(t,e="floor"){return i=>("floor"===e?ey(i*t):"ceil"===e?ty(i*t):iy(i*t))/t}}};function fy(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 yy{}yy.CREATED="created",yy.PLAY="play",yy.PAUSE="pause",yy.STOP="stop",yy.SEEK="seek",yy.UPDATE="update",yy.COMPLETED="completed";let my=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=gy.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))}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emit(yy.PLAY,this))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emit(yy.PAUSE,this))}stop(){this.destroyed||(this.complete(),this.emit(yy.STOP,this))}seek(t){this.destroyed||("object"==typeof t&&(t=sh.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.emit(yy.SEEK,this))}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=gy.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.emit(yy.CREATED,this)}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(),t.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.emit(yy.COMPLETED,this)}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={}),uh.setBetweenStyle(r,s,o,e,t,n,i),this.setStyle(r)}this.emit(yy.UPDATE,this)}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.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};jt([fy("ease")],my.prototype,"easing",void 0),jt([fy(0)],my.prototype,"delay",void 0),jt([fy(.2)],my.prototype,"duration",void 0),jt([fy("auto")],my.prototype,"ending",void 0),jt([fy(!1)],my.prototype,"reverse",void 0),jt([fy(!1)],my.prototype,"swing",void 0),jt([fy(!1)],my.prototype,"loop",void 0),jt([fy(0)],my.prototype,"loopDelay",void 0),jt([fy(1)],my.prototype,"speed",void 0),jt([fy(!0)],my.prototype,"autoplay",void 0),jt([fy()],my.prototype,"join",void 0),jt([fy()],my.prototype,"attrs",void 0),my=jt([_n(Sr)],my);let vy=class extends my{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(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter((t=>{const{completed:e}=t;return e&&t.destroy(),!e}))),this.list=t.map((t=>{const i=t.target?t:new my(this.target,t,e);return Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i}))}play(){this.each((t=>t.play()))}pause(){this.each((t=>t.pause()))}stop(){this.each((t=>t.stop()))}seek(t){this.each((e=>e.seek(t)))}kill(t,e){this.each((i=>i.kill(t,e))),this.destroy()}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each((e=>e.destroy(t))),e.length=0)}};vy=jt([_n(Sr)],vy);const wy={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"},xy=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,by=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,ky=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,Ey=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,By=parseInt,Sy=parseFloat,{round:Ry}=Math;let Ty={},Cy=0;function Ly(t){let e,i,s,o=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),o=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),o=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:o}}const Py=1/6,Oy=.5,Ay=2/3,Dy=1/3;function My(t,e,i){return i<0?i++:i>1&&i--,i<Py?t+6*(e-t)*i:i<Oy?e:i<Ay?t+(e-t)*(Ay-i)*6:t}function Fy(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=My(a,s,t+Dy),n=My(a,s,t),r=My(a,s,t-Dy)}return{r:Ry(255*o),g:Ry(255*n),b:Ry(255*r),a:s}}Ct.add("color"),ih.object=function(t,e){let i,s=void 0!==e&&1!==e;if("string"==typeof t){const e=Ty[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Ly(t);break;case"R":case"r":"("===t[4]&&by.test(t)?i=function(t){const e=by.exec(t);return{r:By(e[1]),g:By(e[2]),b:By(e[3]),a:Sy(e[4])}}(t):"("===t[3]&&xy.test(t)&&(i=function(t){const e=xy.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]&&Ey.test(t)?i=function(t){const e=Ey.exec(t);return Fy(Sy(e[1]),Sy(e[2]),Sy(e[3]),Sy(e[4]))}(t):"("===t[3]&&ky.test(t)&&(i=function(t){const e=ky.exec(t);return Fy(Sy(e[1]),Sy(e[2]),Sy(e[3]),1)}(t))}if(!i){const e=wy[t.toLowerCase()];e&&(i=Ly("#"+e))}i&&(Cy++,Cy>1e4&&(Ty={},Cy=0),Ty[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:Iy}=Math,{fourNumber:Wy}=r,zy={fill:Vy,stroke:Vy,cornerRadius:(t,e,i)=>"number"==typeof t&&"number"==typeof e?Xy(t,e,i):(t=Wy(t),e=Wy(e),t.map(((t,s)=>Xy(t,e[s],i)))),text(t,e,i){if("string"==typeof t&&"string"==typeof e){const s=t.length,o=e.length,n=Xy(s,o,i,1);return s<o?e.substring(0,n):t.substring(0,n)}return"number"==typeof t||"number"==typeof e?r.float(Xy(t,e,i),Math.max(Yy(t),Yy(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const o=Object.assign(Object.assign({},t),e);return uh.setBetweenStyle(o,t,e,o,i,s),o},shadow:jy,innerShadow:jy},Ny={value:function(t,e,i){const s="number"==typeof t,o="number"==typeof e;return s&&o?t+(e-t)*i:o||s?Xy(t,e,i):t},number:Xy,color:Hy,setBetweenStyle:function(t,e,i,s,o,n,r){let a,h,l;const{list:d,value:c}=uh;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 Yy(t){const e=String(t).split(".")[1];return e?e.length:0}function Xy(t,e,i,s){t||(t=0),e||(e=0);const o=t+(e-t)*i;return s?Iy(o):o}function Hy(t,e,i){t=ih.object(t),e=ih.object(e);const s=Xy(t.r,e.r,i,1)+","+Xy(t.g,e.g,i,1)+","+Xy(t.b,e.b,i,1),o=Xy(t.a,e.a,i);return 1===o?"rgb("+s+")":"rgba("+s+","+o+")"}function Vy(t,e,i){return"string"==typeof t&&"string"==typeof e?Hy(t,e,i):e}function jy(t,e,i){return t instanceof Array||e instanceof Array?e:(e=e||{},{x:Xy((t=t||{}).x,e.x,i),y:Xy(t.y,e.y,i),blur:Xy(t.blur,e.blur,i),spread:Xy(t.spread,e.spread,i),color:Hy(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}Ct.add("animate","color"),ch.canAnimate=!0,Object.assign(uh.list,zy),Object.assign(uh,Ny);const Gy=Xh.prototype;Xh.addAttr("animation",void 0,(function(t){return Po(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}})))})),Xh.addAttr("animationOut",void 0,Do),Xh.addAttr("transition",!0,Do),Xh.addAttr("transitionOut",void 0,Do),Gy.animate=function(t,e,i,s){if(void 0===t)return this.__animate;let o=t instanceof Array&&!e&&i?new vy(this,t,s):new my(this,t,e,s);this.killAnimate(i,o.toStyle);const n=this.__animate;return n&&(o instanceof vy?o.list.unshift(n):o=new vy(this,[n,o])),this.__animate=o},Gy.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof vy&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},Gy.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(yy.COMPLETED,e)};const Uy=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],qy=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Zy}=Math,{getDerivative:Ky}=Oe,Jy={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<Uy.length;h++)l=f*(1+Uy[h]),d=f*(1-Uy[h]),c=Ky(l,t,i,o,r),u=Ky(l,e,s,n,a),p=Ky(d,t,i,o,r),_=Ky(d,e,s,n,a),g+=qy[h]*(Zy(c*c+u*u)+Zy(p*p+_*_));return g*f},getRotation(t,e,i,s,o,n,r,a,l){const d=Ky(t,e,s,n,a),c=Ky(t,i,o,r,l);return Math.atan2(c,d)/h},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>_;)Qy(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:Qy}=Jy,{M:$y,L:tm,C:em,Z:im}=re,sm={},om={},nm={transform(t,e){let i,s=0;const o=t.length;for(;s<o;)switch(i=t[s],i){case $y:case tm:nm.transformPoints(t,e,s,1),s+=3;break;case em:nm.transformPoints(t,e,s,3),s+=7;break;case im:s+=1}},transformPoints(t,e,i,s){for(let o=i+1,n=o+2*s;o<n;o+=2)sm.x=t[o],sm.y=t[o+1],x.toOuterPoint(e,sm),t[o]=sm.x,t[o+1]=sm.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 $y:case tm:i=t[a+1],s=t[a+2],e=o===tm&&a>0?A.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case em:i=t[a+5],s=t[a+6],e=Jy.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 im: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=sh.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 $y:case tm:if(r=o[f+1],a=o[f+2],n=s[y],_+n>=e||!t.total)return f||(m=r,v=a),om.x=m,om.y=v,g.x=r,g.y=a,A.getDistancePoint(om,g,e-_,!0),g.rotation=A.getAngle(om,g),g;m=r,v=a,f+=3;break;case em: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=Jy.getT(e-_,n,m,v,l,d,c,u,r,a,i),Oe.getPointAndSet(p,m,v,l,d,c,u,r,a,g),g.rotation=Jy.getRotation(p,m,v,l,d,c,u,r,a),g;m=r,v=a,f+=7;break;case im:f+=1;default:n=0}y++,_+=n}return g},getDistancePath(t,e,i){const{segments:s,data:o}=t,n=[];e=sh.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 $y:case tm:if(a=o[y+1],h=o[y+2],r=s[m],g+r>=e||!t.total)return y||(v=a,w=h),om.x=v,om.y=w,f.x=a,f.y=h,A.getDistancePoint(om,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 em: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 _=Jy.getT(e-g,r,v,w,d,c,u,p,a,h,i),Jy.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 im:y+=1,n.push(l);default:r=0}m++,g+=r}return n}};function rm(t){return Po(t,(t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!Ht(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}Ct.add("motion-path"),uh.register("motion",(function(t,e,i,s){return t?"object"==typeof t&&(t=sh.number(t,s.getMotionTotal())):t=0,e?"object"==typeof e&&(e=sh.number(e,s.getMotionTotal())):e=0,uh.number(t,e,i)})),uh.register("motionRotation",(function(t,e,i){return uh.number(t,e,i)}));const am=Xh.prototype,{updateMatrix:hm,updateAllMatrix:lm}=Tn,{updateBounds:dm}=Wn;function cm(t){const{motion:e,leaferIsCreated:i}=t;if(!Ht(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=pm(t);i.total&&(t.__.__pathForRender=nm.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(lm(t),dm(t,t)):hm(t));i&&(t.leafer.created=!0)}}function um(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 pm(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=nm.getMotionPathData(t.getPath(!0,!0))}function _m(t,e){return Po(t,(t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?ch.setStyleName(this,e,i):ch.set(this,i):this.__layout.stateStyleChanged=!0}})))}function gm(t){return Po(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}})))}function fm(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 ym(t,e){"object"!=typeof e&&(e=void 0),wm(t,e,"in")}function mm(t,e){const{normalStyle:i}=t;"object"!=typeof e&&(e=void 0),i&&(e||(e=i),wm(t,e,"out"))}Xh.addAttr("motionPath",void 0,rm),Xh.addAttr("motionPrecision",1,rm),Xh.addAttr("motion",void 0,rm),Xh.addAttr("motionRotation",!0,rm),am.getMotionPathData=function(){return pm(um(this))},am.getMotionPoint=function(t){const e=um(this),i=pm(e);if(!i.total)return{};const s=nm.getDistancePoint(i,t,e.motionPrecision);x.toOuterPoint(e.localTransform,s);const{motionRotation:o}=this;return!1===o?delete s.rotation:"number"==typeof o&&(s.rotation+=o),s},am.getMotionTotal=function(){return this.getMotionPathData().total},am.__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],Ht(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),cm(t))}else cm(this)};const vm={};function wm(t,e,i){const{normalStyle:s}=t;e||(e=vm),e.scale&&(r.assignScale(e,e.scale),delete e.scale),e!==vm&&ch.canAnimate||(i=null);let o=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&Ht(i[s])&&Ht(e[s])&&(s="transition");return Ht(e[s])?i[s]:e[s]}(i,e,t);const n=o?function(t,e){const i=km(e,t),s=t.animate();s&&km(i,t,s.fromStyle);return i}(t,e):void 0;ch.canAnimate&&xm(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=xm(t);if(a){const{animation:s}=a;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(a,n.endingStyle),"in"!==i||e.animation!==s?n.kill():o=!1,delete a.animation}t.normalStyle=bm(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(o){const e=bm(n,t);t.set(n,"temp"),t.animate([n,e],o,"transition",!0)}t.__layout.stateStyleChanged=!1}function xm(t){let e;const i={},s=fm(t),o=s?t.state||s.state:t.state,n=o&&t.states[o];n&&ch.isState(o,t,s)&&(e=Em(i,n));const r=i.selectedStyle||t.selectedStyle;r&&ch.isSelected(t,s)&&(e=Em(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&ch.isPlacehold(t,s)&&(e=Em(i,a)),ch.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Em(i,s))}else{const o=i.focusStyle||t.focusStyle;o&&ch.isFocus(t,s)&&(e=Em(i,o));const n=i.hoverStyle||t.hoverStyle;n&&ch.isHover(t,s)&&(e=Em(i,n));const r=i.pressStyle||t.pressStyle;r&&ch.isPress(t,s)&&(e=Em(i,r))}return e?i:void 0}function bm(t,e,i,s){const o=i?t:{},n=i||t;for(let t in n)s&&ch.animateExcludes[t]||(o[t]=e[t]);return o}function km(t,e,i){return bm(t,e,i,!0)}function Em(t,e){return Object.assign(t,e),!0}function Bm(t,e){const i=t[e];i&&ym(t,i),t.button&&Rm(t.children,e)}function Sm(t,e,i){i||(i=t.states[e]),ym(t,i),t.button&&Rm(t.children,null,e)}function Rm(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":ch.isHover(s)&&(o=!1);break;case"pressStyle":ch.isPress(s)&&(o=!1);break;case"focusStyle":ch.isFocus(s)&&(o=!1)}o&&Bm(s,e)}else void 0!==i&&Sm(s,i);s.isBranch&&Rm(s.children,e,i)}}function Tm(t,e){const i=t[e];i&&mm(t,i),t.button&&Lm(t.children,e)}function Cm(t,e,i){mm(t,i),t.button&&Lm(t.children,null,e)}function Lm(t,e,i){if(!t)return;let s;for(let o=0,n=t.length;o<n;o++)s=t[o],e?Tm(s,e):void 0!==i&&Cm(s,i),s.isBranch&&Lm(s.children,e,i)}function Pm(t,e,i){let s;const o=e.leafer?e.leafer.interaction:null;if(o&&(s=o[t](e),!s&&i)){const n=fm(e,i);n&&(s=o[t](n))}return s}function Om(t,e,i){let s=e[t];if(!s&&i){const o=fm(e,i);o&&(s=o[t])}return s}Ct.add("state"),ch.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},ch.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const o=fm(e,i);o&&(s=o.states[t])}return!!s}(t,e,i)},ch.isSelected=function(t,e){return Om("selected",t,e)},ch.isDisabled=function(t,e){return Om("disabled",t,e)},ch.isFocus=function(t,e){return Pm("isFocus",t,e)},ch.isHover=function(t,e){return Pm("isHover",t,e)},ch.isPress=function(t,e){return Pm("isPress",t,e)},ch.isPlacehold=function(t,e){return t.__.__isPlacehold},ch.isDrag=function(t,e){return Pm("isDrag",t,e)},ch.setStyleName=function(t,e,i){i?Sm(t,e,t[e]):Cm(t,e,t[e])},ch.set=function(t,e){const i=t.states[e];i?Sm(t,e,i):Cm(t,e,i)},ch.getStyle=xm,ch.updateStyle=wm,ch.updateEventStyle=function(t,e){switch(e){case Gl.ENTER:Bm(t,"hoverStyle");break;case Gl.LEAVE:Tm(t,"hoverStyle");break;case Gl.DOWN:Bm(t,"pressStyle");break;case Gl.UP:Tm(t,"pressStyle")}};const Am=Xh.prototype;Xh.addAttr("selected",!1,_m,"selectedStyle"),Xh.addAttr("disabled",!1,_m,"disabledStyle"),Xh.addAttr("states",{},gm),Xh.addAttr("state","",_m),Xh.addAttr("normalStyle",void 0,Do),Xh.addAttr("hoverStyle",void 0,gm),Xh.addAttr("pressStyle",void 0,gm),Xh.addAttr("focusStyle",void 0,gm),Xh.addAttr("selectedStyle",void 0,gm),Xh.addAttr("disabledStyle",void 0,gm),Xh.addAttr("placeholderStyle",void 0,gm),Xh.addAttr("button",!1,Do),Am.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"):Tm(this,"focusStyle")}))},Am.updateState=function(){ch.updateStyle(this,void 0,"in")};const Dm=Wl.prototype,Mm="text";Co(Dm,Mm,Object.assign(Object.assign({},Lo(Dm,Mm)),{set(t){const e=this,i=e.text;e.__setAttr(Mm,t)&&(Yo(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class Fm extends vh{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let Im=class extends Xh{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=Eo.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([nn(Fm)],Im.prototype,"__",void 0),jt([zo()],Im.prototype,"robot",void 0),jt([Do()],Im.prototype,"actions",void 0),jt([Do("")],Im.prototype,"action",void 0),jt([qo(0)],Im.prototype,"now",void 0),jt([Do(12)],Im.prototype,"FPS",void 0),jt([Do(!0)],Im.prototype,"loop",void 0),Im=jt([gn()],Im),Ct.add("robot");const{Yes:Wm,NoAndSkip:zm,YesAndSkip:Nm}=Yt,Ym={},Xm={},Hm={};class Vm{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"#":Ym.id=t.substring(1),t=Ym;break;case".":Xm.className=t.substring(1),t=Xm;break;default:Hm.tag=t,t=Hm}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&&Tn.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===Wm||n===Nm){if(!i)return void(this.findLeaf=o);i.push(o)}o.isBranch&&n<zm&&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 jm=Xh.prototype;function Gm(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=Lt.selector())}jm.find=function(t,e){return Gm(this).getBy(t,this,!1,e)},jm.findOne=function(t,e){return Gm(this).getBy(t,this,!0,e)},Ct.add("find"),Lt.finder=function(t){return new Vm(t)};const{setPoint:Um,addPoint:qm,toBounds:Zm}=X;const Km={syncExport(e,i,s){let o;this.running=!0;const n=fo.fileType(i),a=i.includes(".");s=fo.getExportOptions(s);const{toURL:h}=t,{download:l}=t.origin;if("json"===n)a&&l(h(JSON.stringify(e.toJSON(s.json)),"text"),i),o={data:!!a||e.toJSON(s.json)};else if("svg"===n)a&&l(h(e.toSVG(),"svg"),i),o={data:!!a||e.toSVG()};else{let t,n,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=e,{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?e.fill:s.fill,b=fo.isOpaqueImage(i)||x,k=new N;if(f)t=!0===f?d?c.canvas.bounds:e.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(e.localTransform),a/=e.scaleX,h/=e.scaleY;break;case"world":a=1,h=1;break;case"page":i=c||e;default:k.set(l).divide(e.getTransform(i));const t=i.worldTransform;a/=a/t.scaleX,h/=h/t.scaleY}t=e.getBounds("render",i)}const E={scaleX:1,scaleY:1};r.getScaleData(s.scale,s.size,t,E);let B=s.pixelRatio||1,{x:S,y:R,width:T,height:C}=new yt(t).scale(E.scaleX,E.scaleY);_&&(S+=_.x,R+=_.y,T=_.width,C=_.height);const L={matrix:k.scale(1/E.scaleX,1/E.scaleY).invert().translate(-S,-R).withScale(1/a*E.scaleX,1/h*E.scaleY)};let P,O=Lt.canvas({width:Math.floor(T),height:Math.floor(C),pixelRatio:B,smooth:v,contextSettings:w});if(p&&(P=e,P.__worldOpacity=0,e=c||e,L.bounds=O.bounds),O.save(),u&&void 0!==x){const t=e.get("fill");e.fill="",e.__render(O,L),e.fill=t}else e.__render(O,L);if(O.restore(),P&&P.__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?qm(r,o,n):Um(r={},o,n)),a++;const h=new yt;return Zm(r,h),h.scale(1/t.pixelRatio).ceil()}(O);const t=O,{width:e,height:i}=n,s={x:0,y:0,width:e,height:i,pixelRatio:B};O=Lt.canvas(s),O.copyWorld(t,n,s)}if(y){const[t,e,i,s]=r.fourNumber(y),o=O,{width:n,height:a}=o;O=Lt.canvas({width:n+s+e,height:a+t+i,pixelRatio:B}),O.copyWorld(o,o.bounds,{x:s,y:t,width:n,height:a})}b&&O.fillWorld(O.bounds,x||"#FFFFFF","destination-over"),m&&m(O);o={data:"canvas"===i?O:O.export(i,s),width:O.pixelWidth,height:O.pixelHeight,renderBounds:t,trimBounds:n}}return this.running=!1,o},export(e,i,s){return this.running=!0,function(t){Jm||(Jm=new wo);return new Promise((e=>{Jm.add((()=>Gt(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((o=>new Promise((n=>{const r=()=>Gt(this,void 0,void 0,(function*(){if(!bo.isComplete)return t.requestRender(r);const a=Km.syncExport(e,i,s);a.data instanceof Promise&&(a.data=yield a.data),o(a),n()}));e.updateLayout(),Qm(e);const{leafer:a}=e;a?a.waitViewCompleted(r):r()}))))}};let Jm;function Qm(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach((t=>Qm(t)))}const $m=se.prototype,tv=bt.get("@leafer-in/export");$m.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)},$m.toBlob=function(e,i){return new Promise((s=>{t.origin.canvasToBolb(this.view,e,i).then((t=>{s(t)})).catch((t=>{tv.error(t),s(null)}))}))},$m.toDataURL=function(e,i){return t.origin.canvasToDataURL(this.view,e,i)},$m.saveAs=function(e,i){return new Promise((s=>{t.origin.canvasSaveAs(this.view,e,i).then((()=>{s(!0)})).catch((t=>{tv.error(t),s(!1)}))}))},Ct.add("export"),Object.assign(dh,Km),Xh.prototype.export=function(t,e){return dh.export(this,t,e)},Xh.prototype.syncExport=function(t,e){return dh.syncExport(this,t,e)},Ct.add("filter"),Object.assign(lh,{list:{},register(t,e){lh.list[t]=e},apply(t,e,i,s,o,n){let r;t.forEach((t=>{r=lh.list[t.type],r&&r.apply(t,e,i,s,o,n)}))},getSpread(t){let e,i=0;return t.forEach((t=>{e=lh.list[t.type],e&&(i+=e.getSpread(t))})),i}});export{K as AlignHelper,my as Animate,gy as AnimateEasing,yy as AnimateEvent,vy as AnimateList,Yt as Answer,Yl as App,U as AroundHelper,wg as Arrow,mg as ArrowData,vt as AutoBounds,Oe as BezierHelper,yt as Bounds,sr as BoundsEvent,pt as BoundsHelper,tl as Box,bh as BoxData,Ra as Branch,Wn as BranchHelper,Ur as BranchRender,Al as Canvas,Mh as CanvasData,It as CanvasManager,tr as ChildEvent,ih as ColorConvert,Lt as Creator,wd as Cursor,Wt as DataHelper,bt as Debug,V as Direction4,j as Direction9,Zl as DragEvent,ld as Dragger,Jl as DropEvent,Kp as EditBox,Xp as EditDataHelper,Up as EditPoint,Pp as EditSelect,Rp as EditSelectHelper,v_ as EditTool,l_ as EditToolCreator,y_ as Editor,up as EditorEvent,u_ as EditorGroupEvent,n_ as EditorHelper,pp as EditorMoveEvent,gp as EditorRotateEvent,_p as EditorScaleEvent,fp as EditorSkewEvent,hh as Effect,nl as Ellipse,Rh as EllipseData,Ye as EllipseHelper,$n as Event,Mt as EventCreator,gr as Eventer,dh as Export,fo as FileHelper,lh as Filter,Vm as Finder,wf as Flow,el as Frame,Eh as FrameData,Hh as Group,xh as GroupData,Jy as HighBezierHelper,nm as HighCurveHelper,xd as HitCanvasManager,Pl as Image,Dh as ImageData,ir as ImageEvent,Eo as ImageManager,e as IncrementId,m_ as InnerEditor,c_ as InnerEditorEvent,Dd as Interaction,vd as InteractionBase,sd as InteractionHelper,id as KeyEvent,Hl as Keyboard,cr as LayoutEvent,Ga as Layouter,ya as Leaf,Vr as LeafBounds,Fn as LeafBoundsHelper,Nt as LeafData,Cr as LeafDataProxy,Sr as LeafEventer,Tn as LeafHelper,Qn as LeafLayout,Ca as LeafLevelList,Ta as LeafList,Fr as LeafMatrix,jr as LeafRender,Gh as Leafer,Pa as LeaferCanvas,se as LeaferCanvasBase,kh as LeaferData,pr as LeaferEvent,To as LeaferImage,sg as LeaferTypeCreator,_l as Line,Bh as LineData,B_ as LineEditTool,r as MathHelper,N as Matrix,x as MatrixHelper,Ql as MoveEvent,rg as MultiTouchHelper,Kl as MyDragEvent,Ol as MyImage,Ul as MyPointerEvent,he as NeedConvertToCanvasCommandMap,h as OneRadian,l as PI2,d as PI_2,nh as Paint,ah as PaintGradient,rh as PaintImage,zl as Path,oh as PathArrow,yf as PathArrowModule,oo as PathBounds,qi as PathCommandDataHelper,re as PathCommandMap,Bi as PathConvert,uo as PathCorner,cs as PathCreator,Lh as PathData,Ss as PathDrawer,oe as PathHelper,Lg as PathMatrixHelper,ue as PathNumberCommandLengthMap,ce as PathNumberCommandMap,z_ as PathScaler,Nl as Pen,Ph as PenData,Ka as Picker,t as Platform,Ct as Plugin,W as Point,A as PointHelper,Vl as PointerButton,Gl as PointerEvent,kl as Polygon,Th as PolygonData,er as PropertyEvent,Uh as Rect,Sh as RectData,pe as RectHelper,Nh as RectRender,ur as RenderEvent,qa as Renderer,lr as ResizeEvent,bo as Resource,Im as Robot,Fm as RobotData,$l as RotateEvent,St as Run,yg as ScrollBar,Sp as SelectArea,Ja as Selector,Ll as Star,Ch as StarData,ch as State,wt as StringNumberMap,Bp as Stroker,td as SwipeEvent,vo as TaskItem,wo as TaskProcessor,Wl as Text,eh as TextConvert,Ah as TextData,hg as Transformer,uh as Transition,X as TwoPointBoundsHelper,Xh as UI,Fh as UIBounds,Ot as UICreator,vh as UIData,jl as UIEvent,Wh as UIRender,sh as UnitConvert,Xn as WaitHelper,dr as WatchEvent,Ma as Watcher,ag as WheelEventHelper,ed as ZoomEvent,tg as addViewport,eg as addViewportConfig,Uo as affectRenderBoundsType,Vo as affectStrokeBoundsType,vg as arrowType,Oo as attr,Fo as autoLayoutType,zo as boundsType,go as canvasPatch,ie as canvasSizeAttrs,on as cursorType,nn as dataProcessor,Do as dataType,Po as decorateLeafAttr,an as defineDataProcessor,Co as defineKey,Ao as defineLeafAttr,Yo as doBoundsType,jo as doStrokeType,Qa as effectType,Xt as emptyData,en as eraserType,u as getBoundsData,Lo as getDescriptor,p as getMatrixData,c as getPointData,sn as hitType,Vt as isEmptyData,Ht as isNull,rn as layoutProcessor,tn as maskType,rm as motionPathType,No as naturalBoundsType,Zo as opacityType,Xo as pathInputType,Ho as pathType,po as pen,Mo as positionType,a_ as registerEditTool,h_ as registerInnerEditor,gn as registerUI,fn as registerUIEvent,$a as resizeType,cn as rewrite,un as rewriteAble,Wo as rotationType,q_ as scaleResize,Z_ as scaleResizeFontSize,Q_ as scaleResizeGroup,K_ as scaleResizePath,J_ as scaleResizePoints,Io as scaleType,$o as sortType,gm as stateStyleType,_m as stateType,Go as strokeType,qo as surfaceType,mt as tempBounds,Y as tempMatrix,z as tempPoint,Da as useCanvas,_n as useModule,La as version,Ko as visibleType,th as zoomLayerType};
2
2
  //# sourceMappingURL=miniapp.module.min.js.map