leafer-game 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var LeaferUI=function(t){"use strict";const e={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(t){const{prefix:i,suffix:s}=e.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),i&&"/"===t[0]&&(t=i+t),t}}},i={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=n;return e[t]?e[t]++:(e[t]=1,0)}},n=s,{round:r,pow:o,PI:a}=Math,h={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)),h.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=r(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,n=("number"==typeof e?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&h.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:l,randColor:t=>`rgba(${l(255)},${l(255)},${l(255)},${t||1})`};function l(t){return Math.round(Math.random()*t)}const d=a/180,c=2*a,u=a/2;function p(){return{x:0,y:0}}function _(){return{x:0,y:0,width:0,height:0}}function g(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:f,cos:y,acos:m,sqrt:v}=Math,{float:w}=h,x={};function b(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const E={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:b(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:g,getWorld:b,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,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,x),B.scaleOfInner(t,x,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:n,d:r}=t,o=y(e*=d),a=f(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){B.toInnerPoint(t,e,x),B.rotateOfInner(t,x,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:n,c:r,d:o}=t;i&&(i*=d,t.a=s+r*i,t.b=n+o*i),e&&(e*=d,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){B.toInnerPoint(t,e,x),B.skewOfInner(t,x,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:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+a},multiplyParent(t,e,i,s,n,r){let{e:o,f:a}=t;if(r&&(o+=r.scrollX,a+=r.scrollY),i||(i=t),void 0===s&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*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:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*h}},setLayout(t,e,i,s,n){const{x:r,y:o,scaleX:a,scaleY:h}=e;if(void 0===n&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,r=i*d,o=y(r),l=f(r);if(s||n){const e=s*d,i=n*d;t.a=(o+i*-l)*a,t.b=(l+i*o)*a,t.c=(e*o-l)*h,t.d=(o+e*l)*h}else t.a=o*a,t.b=l*a,t.c=-l*h,t.d=o*h}else t.a=a,t.b=0,t.c=0,t.d=h;t.e=r,t.f=o,(i=i||s)&&B.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let c,p,_,g,x,b=h,E=l;if(r||o){const t=n*a-r*o;if(o&&!s){c=v(n*n+r*r),p=t/c;const e=n/c;_=r>0?m(e):-m(e)}else{p=v(o*o+a*a),c=t/p;const e=o/p;_=u-(a>0?m(-e):-m(e))}const e=w(y(_)),i=f(_);c=w(c),p=w(p),g=e?w((o/p+i)/e/d,9):0,x=e?w((r/c-i)/e/d,9):0,_=w(_/d)}else c=n,p=a,_=g=x=0;return(e=i||e)&&(b+=e.x*n+e.y*o,E+=e.x*r+e.y*a,i||(b-=e.x,E-=e.y)),{x:b,y:E,scaleX:c,scaleY:p,rotation:_,skewX:g,skewY:x}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=v(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){B.set(t)}},B=E,{toInnerPoint:P,toOuterPoint:k}=E,{sin:R,cos:C,abs:T,sqrt:S,atan2:L,min:D,round:A,PI:O}=Math,I={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=void 0===i?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?A(t.x-.5)+.5:A(t.x),t.y=e?A(t.y-.5)+.5:A(t.y)},move(t,e,i){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=M.defaultPoint);const s=C(e*=d),n=R(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=M;return W(i,t),P(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=M;return W(i,t),k(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=M;return W(i,t),M.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),P(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){P(e,t,i)},toOuterOf(t,e,i){k(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 n=T(i-t),r=T(s-e);return S(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>D(F(t,e,i,s),F(i,s,n,r)),getAngle:(t,e)=>U(t,e)/d,getRotation:(t,e,i,s)=>(s||(s=e),M.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/d),getRadianFrom(t,e,i,s,n,r,o,a){void 0===o&&(o=i,a=s);let h=L(e-s,t-i);const l=L(r-a,n-o)-h;return l<-O?l+c:l},getAtan2:(t,e)=>L(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=U(t,e);return(e=s?e:{}).x=t.x+C(n)*i,e.y=t.y+R(n)*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){M.reset(t)}},M=I,{getDistanceFrom:F,copy:W,getAtan2:U}=M;class N{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?I.copy(this,t):I.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new N(this)}move(t,e){return I.move(this,t,e),this}scale(t,e){return I.scale(this,t,e),this}scaleOf(t,e,i){return I.scaleOf(this,t,e,i),this}rotate(t,e){return I.rotate(this,t,e),this}rotateOf(t,e){return I.rotate(this,e,t),this}getRotation(t,e,i){return I.getRotation(this,t,e,i)}toInnerOf(t,e){return I.toInnerOf(this,t,e),this}toOuterOf(t,e){return I.toOuterOf(this,t,e),this}getCenter(t){return new N(I.getCenter(this,t))}getDistance(t){return I.getDistance(this,t)}getDistancePoint(t,e,i){return new N(I.getDistancePoint(this,t,e,i))}getAngle(t){return I.getAngle(this,t)}getAtan2(t){return I.getAtan2(this,t)}reset(){return I.reset(this),this}}const z=new N;class Y{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return"object"==typeof t?E.copy(this,t):E.set(this,t,e,i,s,n,r),this}setWith(t){return E.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new Y(this)}translate(t,e){return E.translate(this,t,e),this}translateInner(t,e){return E.translateInner(this,t,e),this}scale(t,e){return E.scale(this,t,e),this}scaleWith(t,e){return E.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return E.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return E.scaleOfInner(this,t,e,i),this}rotate(t){return E.rotate(this,t),this}rotateOfOuter(t,e){return E.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return E.rotateOfInner(this,t,e),this}skew(t,e){return E.skew(this,t,e),this}skewOfOuter(t,e,i){return E.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return E.skewOfInner(this,t,e,i),this}multiply(t){return E.multiply(this,t),this}multiplyParent(t){return E.multiplyParent(this,t),this}divide(t){return E.divide(this,t),this}divideParent(t){return E.divideParent(this,t),this}invert(){return E.invert(this),this}invertWith(){return E.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){E.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){E.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return E.setLayout(this,t,e,i),this}getLayout(t,e,i){return E.getLayout(this,t,e,i)}withScale(t,e){return E.withScale(this,t,e)}reset(){E.reset(this)}}const j=new Y,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,n){X(t,e,i),X(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:X}=H,{tempPointBounds:G,setPoint:V,addPoint:q,toBounds:K}=H,{toOuterPoint:Z}=E,{float:$,fourNumber:Q}=h,{floor:J,ceil:tt}=Math;let et,it,st,nt;const rt={},ot={},at={tempBounds:{},set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(i instanceof Array){const e=Q(i);s?ht.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):ht.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),ht.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,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),ht.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?dt(e,t):e=t,i?(e.offsetX=-(ht.maxX(i)-t.x),e.offsetY=-(ht.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),ht.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e){I.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){I.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(ht.copy(ht.tempBounds,t),ht.toOuterOf(ht.tempBounds,e),ht.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),ht.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n}=e;s>0?(i.width=t.width*s,i.x=e.e+t.x*s):(i.width=t.width*-s,i.x=e.e+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=e.f+t.y*n):(i.height=t.height*-n,i.y=e.f+t.y*n-i.height)}else rt.x=t.x,rt.y=t.y,Z(e,rt,ot),V(G,ot.x,ot.y),rt.x=t.x+t.width,Z(e,rt,ot),q(G,ot.x,ot.y),rt.y=t.y+t.height,Z(e,rt,ot),q(G,ot.x,ot.y),rt.x=t.x,Z(e,rt,ot),q(G,ot.x,ot.y),K(G,i)},toInnerOf(t,e,i){i||(i=t),ht.move(i,-e.e,-e.f),ht.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 Y(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e,i){const s={};return ht.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){ht.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){ht.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=J(t.x),t.y=J(t.y),t.width=e>t.x?tt(t.width+e-t.x):tt(t.width),t.height=i>t.y?tt(t.height+i-t.y):tt(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=$(t.x,e),t.y=$(t.y,e),t.width=$(t.width,e),t.height=$(t.height,e)},add(t,e,i){et=t.x+t.width,it=t.y+t.height,st=e.x,nt=e.y,i||(st+=e.width,nt+=e.height),et=et>st?et:st,it=it>nt?it:nt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=et-t.x,t.height=it-t.y},addList(t,e){ht.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){ht.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){ht.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o]):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||dt(t,n)):lt(t,n));r&&ht.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?V(G,t.x,t.y):q(G,t.x,t.y))),K(G,t)},setPoint(t,e){ht.set(t,e.x,e.y)},addPoint(t,e){lt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=I.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=I.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=ht.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=ht.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=ht.tempToOuterOf(e,i)),!ht.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return et=s+r,it=n+o,st=t.x+t.width,nt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,et=et<st?et:st,it=it<nt?it:nt,r=et-s,o=it-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){ht.copy(t,ht.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){ht.set(t)}},ht=at,{add:lt,copy:dt}=ht;class ct{get minX(){return at.minX(this)}get minY(){return at.minY(this)}get maxX(){return at.maxX(this)}get maxY(){return at.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return"object"==typeof t?at.copy(this,t):at.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 ct(this)}move(t,e){return at.move(this,t,e),this}scale(t,e){return at.scale(this,t,e),this}scaleOf(t,e,i){return at.scaleOf(this,t,e,i),this}toOuterOf(t,e){return at.toOuterOf(this,t,e),this}toInnerOf(t,e){return at.toInnerOf(this,t,e),this}getFitMatrix(t,e){return at.getFitMatrix(this,t,e)}spread(t,e){return at.spread(this,t,e),this}shrink(t,e){return at.shrink(this,t,e),this}ceil(){return at.ceil(this),this}unsign(){return at.unsign(this),this}float(t){return at.float(this,t),this}add(t){return at.add(this,t),this}addList(t){return at.setList(this,t,!0),this}setList(t){return at.setList(this,t),this}addListWithFn(t,e){return at.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return at.setListWithFn(this,t,e),this}setPoint(t){return at.setPoint(this,t),this}setPoints(t){return at.setPoints(this,t),this}addPoint(t){return at.addPoint(this,t),this}getPoints(){return at.getPoints(this)}hitPoint(t,e){return at.hitPoint(this,t,e)}hitRadiusPoint(t,e){return at.hitRadiusPoint(this,t,e)}hit(t,e){return at.hit(this,t,e)}includes(t,e){return at.includes(this,t,e)}intersect(t,e){return at.intersect(this,t,e),this}getIntersect(t,e){return new ct(at.getIntersectData(this,t,e))}isSame(t){return at.isSame(this,t)}isEmpty(){return at.isEmpty(this)}reset(){at.reset(this)}}const ut=new ct;class pt{constructor(t,e,i,s,n,r){"object"==typeof t?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new ct(n,e,r||t.width-n-i,o||t.height-e-s)}}var _t,gt;t.Direction4=void 0,(_t=t.Direction4||(t.Direction4={}))[_t.top=0]="top",_t[_t.right=1]="right",_t[_t.bottom=2]="bottom",_t[_t.left=3]="left",t.Direction9=void 0,(gt=t.Direction9||(t.Direction9={}))[gt.topLeft=0]="topLeft",gt[gt.top=1]="top",gt[gt.topRight=2]="topRight",gt[gt.right=3]="right",gt[gt.bottomRight=4]="bottomRight",gt[gt.bottom=5]="bottom",gt[gt.bottomLeft=6]="bottomLeft",gt[gt.left=7]="left",gt[gt.center=8]="center",gt[gt["top-left"]=0]="top-left",gt[gt["top-right"]=2]="top-right",gt[gt["bottom-right"]=4]="bottom-right",gt[gt["bottom-left"]=6]="bottom-left";const ft=[{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}];ft.forEach((t=>t.type="percent"));const yt={directionData:ft,tempPoint:{},get:mt,toPoint(t,e,i,s,n){const r=mt(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,n&&(i.x-=n.x,i.y-=n.y,r.x&&(i.x-=1===r.x?n.width:.5===r.x?r.x*n.width:0),r.y&&(i.y-=1===r.y?n.height:.5===r.y?r.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)}};function mt(e){return"string"==typeof e?ft[t.Direction9[e]]:e}const{toPoint:vt}=yt,wt={toPoint(t,e,i,s,n){vt(t,i,s,n,e)}},xt={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:bt}=h;class Et{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Et(t)}static set filter(t){this.filterList=Bt(t)}static set exclude(t){this.excludeList=Bt(t)}static drawRepaint(t,e){const i=bt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Et.showBounds,n=t.__nowWorld,r=bt();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(Pt.enable){if(Pt.filterList.length&&Pt.filterList.every((t=>t!==this.name)))return;if(Pt.excludeList.length&&Pt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Pt.enable&&this.warn(...t)}warn(...t){Pt.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 Bt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}Et.filterList=[],Et.excludeList=[],Et.showWarn=!0;const Pt=Et,kt=Et.get("RunTime"),Rt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return Ct.currentId=Ct.idMap[i]=e?performance.now():Date.now(),Ct.currentName=Ct.nameMap[i]=t,Ct.nameToIdMap[t]=i,i},end(t,e){const i=Ct.idMap[t],s=Ct.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;Ct.idMap[t]=Ct.nameMap[t]=Ct.nameToIdMap[s]=void 0,kt.log(s,n,"ms")},endOfName(t,e){const i=Ct.nameToIdMap[t];void 0!==i&&Ct.end(i,e)}},Ct=Rt,Tt=[],St={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 plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>Tt.forEach((t=>St.has(t,!0)))));const Lt=Et.get("UICreator"),Dt={list:{},register(t){const{__tag:e}=t.prototype;At[e]&&Lt.repeat(e),At[e]=t},get(t,e,i,s,n,r){At[t]||Lt.error("not register "+t);const o=new At[t](e);return void 0!==i&&(o.x=i,s&&(o.y=s),n&&(o.width=n),r&&(o.height=r)),o}},{list:At}=Dt,Ot=Et.get("EventCreator"),It={nameList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(Mt[e]&&Ot.repeat(e),Mt[e]=t)}))},changeName(t,e){const i=Mt[t];if(i){const s=Object.keys(i).find((e=>i[e]===t));s&&(i[s]=e,Mt[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Mt[t](...e)},{nameList:Mt}=It;class Ft{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,n=s.length;i<n;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const n=i.canvas(t);return this.add(n),n}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)=>(Ut(e,t),Ut(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach((n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return Ut(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&Ut(t[n]={},e[n],i[n]):t[n]=e[n]}))},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:Ut}=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 n in this)if("_"!==n[0]&&(t=this["_"+n],void 0!==t)){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,f:o}}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 zt;t.Answer=void 0,(zt=t.Answer||(t.Answer={}))[zt.No=0]="No",zt[zt.Yes=1]="Yes",zt[zt.NoAndSkip=2]="NoAndSkip",zt[zt.YesAndSkip=3]="YesAndSkip";const Yt={};function jt(t){return null==t}function Ht(t){return"{}"===JSON.stringify(t)}function Xt(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function Gt(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof i?t:new i((function(e){e(t)}))}(t.value).then(o,a)}h((s=s.apply(t,e||[])).next())}))}function Vt(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 Kt(){return(t,e)=>{qt.push(e)}}const Zt=[];class $t{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;qt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){"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,n,r)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}Xt([Vt("imageSmoothingEnabled")],$t.prototype,"smooth",void 0),Xt([Vt("imageSmoothingQuality")],$t.prototype,"smoothLevel",void 0),Xt([Vt("globalAlpha")],$t.prototype,"opacity",void 0),Xt([Vt()],$t.prototype,"fillStyle",void 0),Xt([Vt()],$t.prototype,"strokeStyle",void 0),Xt([Vt("lineWidth")],$t.prototype,"strokeWidth",void 0),Xt([Vt("lineCap")],$t.prototype,"strokeCap",void 0),Xt([Vt("lineJoin")],$t.prototype,"strokeJoin",void 0),Xt([Vt("lineDashOffset")],$t.prototype,"dashOffset",void 0),Xt([Vt()],$t.prototype,"miterLimit",void 0),Xt([Vt()],$t.prototype,"shadowBlur",void 0),Xt([Vt()],$t.prototype,"shadowColor",void 0),Xt([Vt()],$t.prototype,"shadowOffsetX",void 0),Xt([Vt()],$t.prototype,"shadowOffsetY",void 0),Xt([Vt()],$t.prototype,"filter",void 0),Xt([Vt()],$t.prototype,"font",void 0),Xt([Vt()],$t.prototype,"fontKerning",void 0),Xt([Vt()],$t.prototype,"fontStretch",void 0),Xt([Vt()],$t.prototype,"fontVariantCaps",void 0),Xt([Vt()],$t.prototype,"textAlign",void 0),Xt([Vt()],$t.prototype,"textBaseline",void 0),Xt([Vt()],$t.prototype,"textRendering",void 0),Xt([Vt()],$t.prototype,"wordSpacing",void 0),Xt([Vt()],$t.prototype,"letterSpacing",void 0),Xt([Vt()],$t.prototype,"direction",void 0),Xt([Kt()],$t.prototype,"setTransform",null),Xt([Kt()],$t.prototype,"resetTransform",null),Xt([Kt()],$t.prototype,"getTransform",null),Xt([Kt()],$t.prototype,"save",null),Xt([Kt()],$t.prototype,"restore",null),Xt([Kt()],$t.prototype,"translate",null),Xt([Kt()],$t.prototype,"scale",null),Xt([Kt()],$t.prototype,"rotate",null),Xt([Kt()],$t.prototype,"fill",null),Xt([Kt()],$t.prototype,"stroke",null),Xt([Kt()],$t.prototype,"clip",null),Xt([Kt()],$t.prototype,"fillRect",null),Xt([Kt()],$t.prototype,"strokeRect",null),Xt([Kt()],$t.prototype,"clearRect",null),Xt([Kt()],$t.prototype,"beginPath",null),Xt([Kt()],$t.prototype,"moveTo",null),Xt([Kt()],$t.prototype,"lineTo",null),Xt([Kt()],$t.prototype,"bezierCurveTo",null),Xt([Kt()],$t.prototype,"quadraticCurveTo",null),Xt([Kt()],$t.prototype,"closePath",null),Xt([Kt()],$t.prototype,"arc",null),Xt([Kt()],$t.prototype,"arcTo",null),Xt([Kt()],$t.prototype,"ellipse",null),Xt([Kt()],$t.prototype,"rect",null),Xt([Kt()],$t.prototype,"roundRect",null),Xt([Kt()],$t.prototype,"createConicGradient",null),Xt([Kt()],$t.prototype,"createLinearGradient",null),Xt([Kt()],$t.prototype,"createPattern",null),Xt([Kt()],$t.prototype,"createRadialGradient",null),Xt([Kt()],$t.prototype,"fillText",null),Xt([Kt()],$t.prototype,"measureText",null),Xt([Kt()],$t.prototype,"strokeText",null);const{copy:Qt,multiplyParent:Jt}=E,{round:te}=Math,ee={width:1,height:1,pixelRatio:1},ie=["width","height","pixelRatio"];class se extends $t{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(t,i){super(),this.size={},this.worldTransform={},t||(t=ee),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:n,height:r,pixelRatio:o}=t;this.autoLayout=!n||!r,this.size.pixelRatio=o|e.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;Wt.copyAttrs(s,t,ie),ie.forEach((t=>s[t]||(s[t]=1))),this.bounds=new ct(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle())}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&Jt(t,e,n),n.a=t.a*i,n.b=t.b*i,n.c=t.c*i,n.d=t.d*i,n.e=t.e*i,n.f=t.f*i,s&&(t.half&&t.half*i%2?(n.e=te(n.e-.5)+.5,n.f=te(n.f-.5)+.5):(n.e=te(n.e),n.f=te(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i){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:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s){if(s&&(this.blendMode=s),e){const{pixelRatio:s}=this;i||(i=e),this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x*s,i.y*s,i.width*s,i.height*s)}else this.drawImage(t.view,0,0);s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s){if(s&&(this.blendMode=s),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,at.tempToOuterOf(i,e)),this.restore();else{const{pixelRatio:s}=this;this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x,i.y,i.width,i.height)}s&&(this.blendMode="source-over")}copyWorldByReset(t,e,i,s,n){this.resetTransform(),this.copyWorld(t,e,i,s),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(ut.x,ut.y,ut.width,ut.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,ut.x,ut.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(ut.x,ut.y,ut.width,ut.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(ut.x,ut.y,ut.width,ut.height),i&&(this.blendMode="source-over")}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(ut.x,ut.y,ut.width,ut.height)}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(ut.x,ut.y,ut.width,ut.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,i){ut.set(t),i&&ut.intersect(this.bounds),ut.scale(this.pixelRatio),e&&ut.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:n}=this,r=this.manager?this.manager.get(s):i.canvas(Object.assign({},s));return r.save(),t&&(Qt(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==n&&(r.pixelSnap=n),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const ne={creator:{},parse(t,e){},convertToCanvasData(t,e){}},re={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},oe=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},re),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),re),de=oe,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,n,r){const o=h.fourNumber(r,Math.min(s/2,n/2)),a=e+s,l=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,l,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,l,e,l,o[2]):t.lineTo(a,l),o[3]?t.arcTo(e,l,e,i,o[3]):t.lineTo(e,l),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:_e,cos:ge,atan2:fe,ceil:ye,abs:me,PI:ve,sqrt:we,pow:xe}=Math,{setPoint:be,addPoint:Ee}=H,{set:Be,toNumberPoints:Pe}=I,{M:ke,L:Re,C:Ce,Q:Te,Z:Se}=oe,Le={},De={points(t,e,i,s){let n=Pe(e);if(t.push(ke,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,p,_,g,f,y=n.length;const m=!0===i?.5:i;s&&(n=[n[y-2],n[y-1],...n,n[0],n[1],n[2],n[3]],y=n.length);for(let i=2;i<y-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],_=we(xe(o-e,2)+xe(a-r,2)),g=we(xe(h-o,2)+xe(l-a,2)),f=_+g,_=m*_/f,g=m*g/f,h-=e,l-=r,d=o-_*h,c=a-_*l,2===i?s||t.push(Te,d,c,o,a):t.push(Ce,u,p,d,c,o,a),u=o+g*h,p=a+g*l;s||t.push(Te,u,p,n[y-2],n[y-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(Re,n[e],n[e+1]);s&&t.push(Se)},rect(t,e,i,s,n){ne.creator.path=t,ne.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){ne.creator.path=[],pe.drawRoundRect(ne.creator,e,i,s,n,r),t.push(...ne.convertToCanvasData(ne.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,p){const _=s-e,g=n-i,f=r-s,y=o-n;let m=fe(g,_),v=fe(y,f),w=v-m;if(w<0&&(w+=c),w===ve||me(_+g)<1e-12||me(f+y)<1e-12)return t&&t.push(Re,s,n),h&&(be(h,e,i),Ee(h,s,n)),p&&Be(p,e,i),void(l&&Be(l,s,n));const x=_*y-f*g<0,b=x?-1:1,E=a/ge(w/2),B=s+E*ge(m+w/2+u*b),P=n+E*_e(m+w/2+u*b);return m-=u*b,v-=u*b,Ie(t,B,P,a,a,0,m/d,v/d,x,h,l,p)},arc:(t,e,i,s,n,r,o,a,h,l)=>Ie(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,p,_){const g=r*d,f=_e(g),y=ge(g);let m=o*d,v=a*d;m>ve&&(m-=c),v<0&&(v+=c);let w=v-m;w<0?w+=c:w>c&&(w-=c),h&&(w-=c);const x=ye(me(w/u)),b=w/x,E=_e(b/4),B=8/3*E*E/_e(b/2);v=m+b;let P,k,R,C,T,S,L,D,A=ge(m),O=_e(m),I=R=y*s*A-f*n*O,M=C=f*s*A+y*n*O,F=e+R,W=i+C;t&&t.push(t.length?Re:ke,F,W),l&&be(l,F,W),_&&Be(_,F,W);for(let r=0;r<x;r++)P=ge(v),k=_e(v),R=y*s*P-f*n*k,C=f*s*P+y*n*k,T=e+I-B*(y*s*O+f*n*A),S=i+M-B*(f*s*O-y*n*A),L=e+R+B*(y*s*k+f*n*P),D=i+C+B*(f*s*k-y*n*P),t&&t.push(Ce,T,S,L,D,e+R,i+C),l&&Oe(e+I,i+M,T,S,L,D,e+R,i+C,l,!0),I=R,M=C,A=P,O=k,m=v,v+=b;p&&Be(p,e+R,i+C)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(Ce,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){Oe(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,p,_,g,f,y,m,v=t,w=i,x=n,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=r,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,p=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else y=u*u-4*p*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Ee(h,t,e):be(h,t,e),Ee(h,o,a);for(let l=0,c=d.length;l<c;l++)Ae(d[l],t,e,i,s,n,r,o,a,Le),Ee(h,Le.x,Le.y)},getPointAndSet(t,e,i,s,n,r,o,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*r+_*a,l.y=c*i+u*n+p*o+_*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return Ae(t,e,i,s,n,r,o,a,h,l),l}},{getPointAndSet:Ae,toTwoPointBounds:Oe,ellipse:Ie}=De,{sin:Me,cos:Fe,sqrt:We,atan2:Ue}=Math,{ellipse:Ne}=De,ze={ellipticalArc(t,i,s,n,r,o,a,h,l,u,p){const _=(l-i)/2,g=(u-s)/2,f=o*d,y=Me(f),m=Fe(f),v=-m*_-y*g,w=-m*g+y*_,x=n*n,b=r*r,E=w*w,B=v*v,P=x*b-x*E-b*B;let k=0;if(P<0){const t=We(1-P/(x*b));n*=t,r*=t}else k=(a===h?-1:1)*We(P/(x*E+b*B));const R=k*n*w/r,C=-k*r*v/n,T=Ue((w-C)/r,(v-R)/n),S=Ue((-w-C)/r,(-v-R)/n);let L=S-T;0===h&&L>0?L-=c:1===h&&L<0&&(L+=c);const D=i+_+m*R-y*C,A=s+g+y*R+m*C,O=L<0?1:0;p||e.ellipseToCurve?Ne(t,D,A,n,r,o,T/d,S/d,O):n!==r||o?t.push(oe.G,D,A,n,r,o,T/d,S/d,O):t.push(oe.O,D,A,n,T/d,S/d,O)}},{M:Ye,m:je,L:He,l:Xe,H:Ge,h:Ve,V:qe,v:Ke,C:Ze,c:$e,S:Qe,s:Je,Q:ti,q:ei,T:ii,t:si,A:ni,a:ri,Z:oi,z:ai,N:hi,D:li,X:di,G:ci,F:ui,O:pi,P:_i,U:gi}=oe,{rect:fi,roundRect:yi,arcTo:mi,arc:vi,ellipse:wi,quadraticCurveTo:xi}=De,{ellipticalArc:bi}=ze,Ei=Et.get("PathConvert"),Bi={},Pi={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=ue[s],a+=s===n?" ":ce[s];for(let s=1;s<i;s++)a+=h.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?le:he;for(let e=0,h=t.length;e<h;e++)s=t[e],xt[s]?("."===s&&(ki.dot&&(Ri(o,r),r=""),ki.dot++),"0"===r&&"."!==s&&(Ri(o,r),r=""),r+=s):oe[s]?(r&&(Ri(o,r),r=""),ki.name=oe[s],ki.length=ae[s],ki.index=0,Ri(o,ki.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&Ri(o,r),r=s):r&&(Ri(o,r),r=""),n=s;return r&&Ri(o,r),i?Pi.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(n=t[c],n){case je:t[c+1]+=a,t[c+2]+=h;case Ye:a=t[c+1],h=t[c+2],p.push(Ye,a,h),c+=3;break;case Ve:t[c+1]+=a;case Ge:a=t[c+1],p.push(He,a,h),c+=2;break;case Ke:t[c+1]+=h;case qe:h=t[c+1],p.push(He,a,h),c+=2;break;case Xe:t[c+1]+=a,t[c+2]+=h;case He:a=t[c+1],h=t[c+2],p.push(He,a,h),c+=3;break;case Je:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Qe;case Qe:o=r===Ze||r===Qe,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(Ze,l,d,i,s,a,h),c+=5;break;case $e:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Ze;case Ze:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(Ze,t[c+1],t[c+2],i,s,a,h),c+=7;break;case si:t[c+1]+=a,t[c+2]+=h,n=ii;case ii:o=r===ti||r===ii,i=o?2*a-i:t[c+1],s=o?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,n=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 ri:t[c+6]+=a,t[c+7]+=h;case ni: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 oi:p.push(oi),c++;break;case hi:a=t[c+1],h=t[c+2],e?fi(p,a,h,t[c+3],t[c+4]):Ci(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]]):Ci(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]):Ci(p,t,c,6),c+=6;break;case ci:wi(e?p:Ci(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,Bi),a=Bi.x,h=Bi.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):Ci(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case pi:vi(e?p:Ci(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Bi),a=Bi.x,h=Bi.y,c+=7;break;case _i:e?vi(p,t[c+1],t[c+2],t[c+3],0,360,!1):Ci(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case gi:mi(e?p:Ci(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Bi),a=Bi.x,h=Bi.y,c+=6;break;default:return Ei.error(`command: ${n} [index:${c}]`,t),p}r=n}return p},objectToCanvasData(t){const e=[];return t.forEach((t=>{switch(t.name){case"M":e.push(Ye,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(ti,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(oi)}})),e},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){ki.index===ki.length&&(ki.index=1,t.push(ki.name)),t.push(Number(e)),ki.index++,ki.dot=0}},{current:ki,pushData:Ri,copyData:Ci}=Pi,{M:Ti,L:Si,C:Li,Q:Di,Z:Ai,N:Oi,D:Ii,X:Mi,G:Fi,F:Wi,O:Ui,P:Ni,U:zi}=oe,{getMinDistanceFrom:Yi,getRadianFrom:ji}=I,{tan:Hi,min:Xi,abs:Gi}=Math,Vi={},qi={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Ti,e,i)},lineTo(t,e,i){t.push(Si,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(Li,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(Di,e,i,s,n)},closePath(t){t.push(Ai)},rect(t,e,i,s,n){t.push(Oi,e,i,s,n)},roundRect(t,e,i,s,n,r){if("number"==typeof r)t.push(Mi,e,i,s,n,r);else{const o=h.fourNumber(r);o?t.push(Ii,e,i,s,n,...o):t.push(Oi,e,i,s,n)}},ellipse(t,e,i,s,n,r,o,a,h){void 0===r?t.push(Wi,e,i,s,n):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Fi,e,i,s,n,r,o,a,h?1:0))},arc(t,e,i,s,n,r,o){void 0===n?t.push(Ni,e,i,s):(void 0===r&&(r=360),t.push(Ui,e,i,s,n,r,o?1:0))},arcTo(t,e,i,s,n,r,o,a){if(void 0!==o){const t=Yi(o,a,e,i,s,n);r=Xi(r,Xi(t/2,t/2*Gi(Hi(ji(o,a,e,i,s,n)/2))))}t.push(zi,e,i,s,n,r)},drawEllipse(t,e,i,s,n,r,o,a,h){De.ellipse(null,e,i,s,n,void 0===r?0:r,void 0===o?0:o,void 0===a?360:a,h,null,null,Vi),t.push(Ti,Vi.x,Vi.y),Ki(t,e,i,s,n,r,o,a,h)},drawArc(t,e,i,s,n,r,o){De.arc(null,e,i,s,void 0===n?0:n,void 0===r?360:r,o,null,null,Vi),t.push(Ti,Vi.x,Vi.y),Zi(t,e,i,s,n,r,o)},drawPoints(t,e,i,s){De.points(t,e,i,s)}},{ellipse:Ki,arc:Zi}=qi,{moveTo:$i,lineTo:Qi,quadraticCurveTo:Ji,bezierCurveTo:ts,closePath:es,beginPath:is,rect:ss,roundRect:ns,ellipse:rs,arc:os,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?ne.parse(t):t:[],this}beginPath(){return is(this.__path),this.paint(),this}moveTo(t,e){return $i(this.__path,t,e),this.paint(),this}lineTo(t,e){return Qi(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return ts(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ji(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,n){return ns(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return rs(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return os(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return as(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return hs(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return ls(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return ds(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:us,L:ps,C:_s,Q:gs,Z:fs,N:ys,D:ms,X:vs,G:ws,F:xs,O:bs,P:Es,U:Bs}=oe,Ps=Et.get("PathDrawer"),ks={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)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]*d,e[s+6]*d,e[s+7]*d,e[s+8]),s+=9;break;case xs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,c,!1),s+=5;break;case bs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*d,e[s+5]*d,e[s+6]),s+=7;break;case Es:t.arc(e[s+1],e[s+2],e[s+3],0,c,!1),s+=4;break;case Bs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Ps.error(`command: ${i} [index:${s}]`,e)}}},{M:Rs,L:Cs,C:Ts,Q:Ss,Z:Ls,N:Ds,D:As,X:Os,G:Is,F:Ms,O:Fs,P:Ws,U:Us}=oe,{toTwoPointBounds:Ns,toTwoPointBoundsByQuadraticCurve:zs,arcTo:Ys,arc:js,ellipse:Hs}=De,{addPointBounds:Xs,copy:Gs,addPoint:Vs,setPoint:qs,addBounds:Ks,toBounds:Zs}=H,$s=Et.get("PathBounds");let Qs,Js,tn;const en={},sn={},nn={},rn={toBounds(t,e){rn.toTwoPointBounds(t,sn),Zs(sn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return qs(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===Ls||o===Ts||o===Ss?qs(e,h,l):qs(e,t[a+1],t[a+2])),o){case Rs:case Cs:h=t[a+1],l=t[a+2],Vs(e,h,l),a+=3;break;case Ts:n=t[a+5],r=t[a+6],Ns(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,en),Xs(e,en),h=n,l=r,a+=7;break;case Ss:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],zs(h,l,i,s,n,r,en),Xs(e,en),h=n,l=r,a+=5;break;case Ls:a+=1;break;case Ds:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=5;break;case As:case Os:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=o===As?9:6;break;case Is: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],en,nn),0===a?Gs(e,en):Xs(e,en),h=nn.x,l=nn.y,a+=9;break;case Ms:h=t[a+1],l=t[a+2],Js=t[a+3],tn=t[a+4],Ks(e,h-Js,l-tn,2*Js,2*tn),h+=Js,a+=5;break;case Fs:js(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],en,nn),0===a?Gs(e,en):Xs(e,en),h=nn.x,l=nn.y,a+=7;break;case Ws:h=t[a+1],l=t[a+2],Qs=t[a+3],Ks(e,h-Qs,l-Qs,2*Qs,2*Qs),h+=Qs,a+=4;break;case Us:Ys(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],en,nn),0===a?Gs(e,en):Xs(e,en),h=nn.x,l=nn.y,a+=6;break;default:return void $s.error(`command: ${o} [index:${a}]`,t)}}},{M:on,L:an,Z:hn}=oe,{getCenterX:ln,getCenterY:dn}=I,{arcTo:cn}=qi,un={smooth(t,e,i){let s,n,r=0,o=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0;const _=t.length,g=[];for(;r<_;)switch(s=t[r],s){case on:h=u=t[r+1],l=p=t[r+2],r+=3,t[r]===an?(d=t[r+1],c=t[r+2],g.push(on,ln(h,d),dn(l,c))):g.push(on,h,l);break;case an:switch(o=t[r+1],a=t[r+2],r+=3,t[r]){case an:cn(g,o,a,t[r+1],t[r+2],e,u,p);break;case hn:cn(g,o,a,h,l,e,u,p);break;default:g.push(an,o,a)}u=o,p=a;break;case hn:cn(g,h,l,d,c,e,u,p),g.push(hn),r+=1;break;default:n=ue[s];for(let e=0;e<n;e++)g.push(t[r+e]);r+=n}return s!==hn&&(g[1]=h,g[2]=l),g}};ne.creator=new cs,ne.parse=Pi.parse,ne.convertToCanvasData=Pi.toCanvasData;const pn=new cs,{drawRoundRect:_n}=pe;function gn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){_n(this,t,e,i,s,n)})}(t)}const fn={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=yn.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{}}}},yn=fn;yn.opacityTypes.forEach((t=>yn.upperCaseTypeMap[t]=t.toUpperCase()));const mn=Et.get("TaskProcessor");class vn{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.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){mn.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class wn{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,n,r;const o=new vn(t);return o.parent=this,"number"==typeof e?r=e:e&&(s=e.parallel,i=e.start,n=e.time,r=e.delay),n&&(o.time=n),!1===s&&(o.parallel=!1),void 0===r?this.push(o,i):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(o,i))}),r)),this.isComplete=!1,o}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout((()=>this.start())))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)})):this.nextTask()}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout((()=>this.run()))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let 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 xn=Et.get("Resource"),bn={tasker:new wn,map:{},get isComplete(){return En.tasker.isComplete},set(t,e){En.map[t]&&xn.repeat(t),En.map[t]=e},get:t=>En.map[t],remove(t){const e=En.map[t];e&&(e.destroy&&e.destroy(),delete En.map[t])},loadImage(t,e){return new Promise(((i,s)=>{const n=this.setImage(t,t,e);n.load((()=>i(n)),(t=>s(t)))}))},setImage(t,e,s){let n;return"string"==typeof e?n={url:e}:e.url||(n={url:t,view:e}),n&&(s&&(n.format=s),e=i.image(n)),En.set(t,e),e},destroy(){En.map={}}},En=bn,Bn={maxRecycled:10,recycledList:[],patternTasker:new wn,get(t){let e=bn.get(t.url);return e||bn.set(t.url,e=i.image(t)),e.use++,e},recycle(t){t.use--,setTimeout((()=>{t.use||Pn.recycledList.push(t)}))},clearRecycled(){const t=Pn.recycledList;t.length>Pn.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&bn.remove(t.url))),t.length=0)},hasOpacityPixel:t=>fn.opacityTypes.some((e=>Pn.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+fn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+fn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Pn.recycledList=[]}},Pn=Bn,{IMAGE:kn,create:Rn}=s;class Cn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Rn(kn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Bn.isFormat("svg",t)&&(this.isSVG=!0),Bn.hasOpacityPixel(t)&&(this.hasOpacityPixel=!0)}load(t,i){return this.loading||(this.loading=!0,bn.tasker.add((()=>Gt(this,void 0,void 0,(function*(){return yield e.origin.loadImage(this.url).then((t=>this.setView(t))).catch((t=>{this.error=t,this.onComplete(!1)}))}))))),this.waitComplete.push(t,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach(((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))})),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,i,s,n){if(t||(t=this.width),i||(i=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const r=e.origin.createCanvas(t,i),o=r.getContext("2d");return s&&(o.globalAlpha=s),o.drawImage(this.view,0,0,t,i),this.cache=this.use>1?{data:r,params:arguments}:null,r}getPattern(t,i,s,n){const r=e.canvas.createPattern(t,i);try{s&&r.setTransform&&(r.setTransform(s),s=null)}catch(t){}return n&&(n.transform=s),r}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Tn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Sn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Ln(t,e){return(i,s)=>An(i,s,t,e&&e(s))}function Dn(t){return t}function An(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Tn(t,e,Object.assign(n,s||{})),rr(t,e,i)}function On(t){return Ln(t)}function In(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function Mn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),zn(this))}})))}function Fn(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Wn(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Un(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&zn(this)}})))}function Nn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(zn(this),this.__.__removeNaturalSize())}})))}function zn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Yn(t){return Ln(t,(t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),zn(this)}})))}const jn=Un;function Hn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&Xn(this)}})))}function Xn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&zn(t)}const Gn=Hn;function Vn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function qn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function Kn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&$n(this)}})))}function Zn(t){return Ln(t,(t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Qn(this,t,e,i)))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Qn(this,t,e,i),this.mask&&$n(this)}})))}function $n(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Qn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||zn(t))}function Jn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function tr(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function er(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function ir(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Et.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))}function sr(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function nr(t){return(e,i)=>{Tn(e,"__DataProcessor",{get:()=>t})}}function rr(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o={get(){const t=this[n];return void 0===t?i:t},set(t){this[n]=t}};if(void 0===i)o.get=function(){return this[n]};else if("function"==typeof i)o.get=function(){let t=this[n];return void 0===t?i(this.__leaf):t};else if("object"==typeof i){const t=Ht(i);o.get=function(){let e=this[n];return void 0===e?this[n]=t?{}:Wt.clone(i):e}}const a=t.isBranchLeaf;"width"===e?o.get=function(){const t=this[n];if(void 0===t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:a&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(o.get=function(){const t=this[n];if(void 0===t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:a&&s.children.length?s.boxBounds.height:i}return t});let h,l=s;for(;!h&&l;)h=Sn(l,e),l=l.__proto__;h&&h.set&&(o.set=h.set),s[r]&&(o.set=s[r],delete s[r]),Tn(s,e,o)}const or=new Et("rewrite"),ar=[],hr=["destroy","constructor"];function lr(t){return(e,i)=>{ar.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function dr(){return t=>{cr()}}function cr(t){ar.length&&(ar.forEach((e=>{t&&or.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),ar.length=0)}function ur(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach((s=>{if(!(hr.includes(s)||e&&e.includes(s)))if(t.prototype){Sn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]}))}}function pr(){return t=>{Dt.register(t)}}function _r(){return t=>{It.register(t)}}setTimeout((()=>cr(!0)));const{copy:gr,toInnerPoint:fr,toOuterPoint:yr,scaleOfOuter:mr,rotateOfOuter:vr,skewOfOuter:wr,multiplyParent:xr,divideParent:br,getLayout:Er}=E,Br={},{round:Pr}=Math,kr={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Tr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Cr(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++)Sr(e[t])}},updateAllChange(t){if(Sr(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Lr(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,i=0,s,n){const r="object"==typeof e?Object.assign({},e):{x:e,y:i};s?yr(t.localTransform,r,r,!0):t.parent&&fr(t.parent.worldTransform,r,r,!0),Rr.moveLocal(t,r.x,r.y,n)},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=Pr(e),i=Pr(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){Rr.zoomOfLocal(t,Dr(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if("number"!=typeof s&&(s&&(r=s),s=i),gr(Br,o),mr(Br,e,i,s),t.origin||t.around)Rr.setTransform(t,Br,n,r);else{const e=t.x+Br.e-o.e,a=t.y+Br.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){Rr.rotateOfLocal(t,Dr(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;gr(Br,n),vr(Br,e,i),t.origin||t.around?Rr.setTransform(t,Br,!1,s):t.set({x:t.x+Br.e-n.e,y:t.y+Br.f-n.f,rotation:h.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){Rr.skewOfLocal(t,Dr(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){gr(Br,t.__localMatrix),wr(Br,e,i,s),Rr.setTransform(t,Br,n,r)},transformWorld(t,e,i,s){gr(Br,t.worldTransform),xr(Br,e),t.parent&&br(Br,t.parent.worldTransform),Rr.setTransform(t,Br,i,s)},transform(t,e,i,s){gr(Br,t.localTransform),xr(Br,e),Rr.setTransform(t,Br,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&Rr.getInnerOrigin(t,n.origin),o=Er(e,r,n.around&&Rr.getInnerOrigin(t,n.around));if(i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){at.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Rr.getInnerOrigin(t,n.origin);I.move(o,r.x-s.x,r.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return mr(i,Rr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>I.tempToOuterOf(Rr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return yt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(gr(Br,t.worldTransform),br(Br,e.worldTransform),i?Br:Object.assign({},Br)),drop(t,e,i,s){t.setTransform(Rr.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}}},Rr=kr,{updateAllMatrix:Cr,updateMatrix:Tr,updateAllWorldOpacity:Sr,updateAllChange:Lr}=Rr;function Dr(t,e){return t.__layout.update(),t.parent?I.tempToInnerOf(e,t.parent.__world):e}const Ar={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:Or}=kr,Ir={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),Mr(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++)Fr(e[t],e)},updateBounds(t,e){const i=[t];Fr(t,i),Wr(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)Or(s[t]);e&&e===i||Or(i)}}},{pushAllChildBranch:Mr,pushAllBranchStack:Fr,updateBoundsByBranchStack:Wr}=Ir,Ur={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:Nr}=kr,{toOuterOf:zr,getPoints:Yr,copy:jr}=at,Hr="_localContentBounds",Xr="_worldContentBounds",Gr="_worldBoxBounds",Vr="_worldStrokeBounds";class qr{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 zr(this.contentBounds,this.leaf.__localMatrix,this[Hr]||(this[Hr]={})),this[Hr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return zr(this.contentBounds,this.leaf.__world,this[Xr]||(this[Xr]={})),this[Xr]}get worldBoxBounds(){return zr(this.boxBounds,this.leaf.__world,this[Gr]||(this[Gr]={})),this[Gr]}get worldStrokeBounds(){return zr(this.strokeBounds,this.leaf.__world,this[Vr]||(this[Vr]={})),this[Vr]}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:t}=this.leaf;if(t)t.ready?t.watcher.changed&&t.layouter.layout():t.start();else{let t=this.leaf;for(;t.parent&&!t.parent.leafer;)t=t.parent;const i=t;if(i.__fullLayouting)return;i.__fullLayouting=!0,e.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 E.defaultMatrix;case"page":t=e.zoomLayer;default:return Nr(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 ct(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=E.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=Nr(s,e,!0)}if(o||(o=E.getLayout(r)),jr(o,a),I.copy(o,n),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Yr(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return void 0!==n&&s.forEach((t=>i.innerToWorld(t,null,!1,n))),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Kr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.event.stop(this.origin)}}class Zr extends Kr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Zr.ADD="child.add",Zr.REMOVE="child.remove",Zr.CREATED="created",Zr.MOUNTED="mounted",Zr.UNMOUNTED="unmounted",Zr.DESTROY="destroy";class $r extends Kr{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}$r.CHANGE="property.change",$r.LEAFER_CHANGE="property.leafer_change";class Qr extends Kr{constructor(t,e){super(t),Object.assign(this,e)}}Qr.LOAD="image.load",Qr.LOADED="image.loaded",Qr.ERROR="image.error";class Jr extends Kr{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(Jr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&void 0!==this.resizingKeys[t.innerId]}}Jr.RESIZE="resize";class to extends Kr{constructor(t,e){super(t),this.data=e}}to.REQUEST="watch.request",to.DATA="watch.data";class eo extends Kr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}eo.REQUEST="layout.request",eo.START="layout.start",eo.BEFORE="layout.before",eo.LAYOUT="layout",eo.AFTER="layout.after",eo.AGAIN="layout.again",eo.END="layout.end";class io extends Kr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}io.REQUEST="render.request",io.CHILD_START="render.child_start",io.CHILD_END="render.child_end",io.START="render.start",io.BEFORE="render.before",io.RENDER="render",io.AFTER="render.after",io.AGAIN="render.again",io.END="render.end",io.NEXT="render.next";class so extends Kr{}so.START="leafer.start",so.BEFORE_READY="leafer.before_ready",so.READY="leafer.ready",so.AFTER_READY="leafer.after_ready",so.VIEW_READY="leafer.view_ready",so.VIEW_COMPLETED="leafer.view_completed",so.STOP="leafer.stop",so.RESTART="leafer.restart",so.END="leafer.end";const no={};class ro{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,n,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const o=oo(this,s,!0),a="string"==typeof t?t.split(" "):t,h=n?{listener:e,once:n}:{listener:e};a.forEach((t=>{t&&(r=o[t],r?-1===r.findIndex((t=>t.listener===e))&&r.push(h):o[t]=[h])}))}off(t,e,i){if(t){const s="string"==typeof t?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=oo(this,t);s.forEach((t=>{t&&(n=o[t],n&&(r=n.findIndex((t=>t.listener===e)),r>-1&&n.splice(r,1),n.length||delete o[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&&It.has(t)&&(e=It.get(t,{type:t,target:this,current:this}));const s=oo(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],r=s&&s[t];return!!(void 0===e?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function oo(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:no)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:no)}}const{on:ao,on_:ho,off:lo,off_:co,once:uo,emit:po,emitEvent:_o,hasEvent:go,destroy:fo}=ro.prototype,yo={on:ao,on_:ho,off:lo,off_:co,once:uo,emit:po,emitEvent:_o,hasEvent:go,destroyEventer:fo},{isFinite:mo}=Number,vo=Et.get("setAttr"),wo={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(i&&!mo(e)&&void 0!==e&&(vo.warn(this.innerName,t,e),e=void 0),"object"==typeof e||s!==e){this.__realSetAttr(t,e);const{CHANGE:i}=$r,n=new $r(i,this,t,s,e);return this.isLeafer?this.emitEvent(new $r($r.LEAFER_CHANGE,this,t,s,e)):this.hasEvent(i)&&this.emitEvent(n),this.leafer.emitEvent(n),!0}return!1}return this.__realSetAttr(t,e),!0},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||void 0===i.normalStyle[t]||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:xo,multiplyParent:bo,translateInner:Eo,defaultWorld:Bo}=E,{toPoint:Po,tempPoint:ko}=yt,Ro={__updateWorldMatrix(){bo(this.__local||this.__layout,this.parent?this.parent.__world:Bo,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)&&(xo(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)&&(Po(i.around||i.origin,t.boxBounds,ko),Eo(e,-ko.x,-ko.y,!i.around))}this.__layout.matrixChanged=!1}},{updateMatrix:Co,updateAllMatrix:To}=kr,{updateBounds:So}=Ir,{toOuterOf:Lo,copyAndSpread:Do,copy:Ao}=at,{toBounds:Oo}=rn,Io={__updateWorldBounds(){Lo(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(),Lo(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Lo(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Lo(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Oo(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(),To(this),So(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(To(this),So(this,this))):Co(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Do(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Do(t.renderBounds,t.boxBounds,t.renderSpread):Ao(t.renderBounds,t.strokeBounds)}},Mo={__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);Et.showBounds&&Et.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:Fo}=Ar,Wo={__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 n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Fo(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Fo(i[s],e)||i[s].__clip(t,e)}}},{LEAF:Uo,create:No}=s,{toInnerPoint:zo,toOuterPoint:Yo,multiplyParent:jo}=E,{toOuterOf:Ho}=at,{copy:Xo,move:Go}=I,{moveLocal:Vo,zoomOfLocal:qo,rotateOfLocal:Ko,skewOfLocal:Zo,moveWorld:$o,zoomOfWorld:Qo,rotateOfWorld:Jo,skewOfWorld:ta,transform:ea,transformWorld:ia,setTransform:sa,getFlipTransform:na,getLocalOrigin:ra,getRelativeWorld:oa,drop:aa}=kr;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return Nt}get __LayoutProcessor(){return qr}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=No(Uo),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Zr.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(Zr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Zr.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(Zr.MOUNTED)):this.__emitLifeEvent(Zr.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 jo(i,t.matrix,e,void 0,i),Ho(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?oa(this,e):this.worldTransform,n=i?t:{};return Ho(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Xo(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Xo(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),zo(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){Yo(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Go(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Go(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){sa(this,t,e,i)}transform(t,e,i){ea(this,t,e,i)}move(t,e,i){Vo(this,t,e,i)}moveInner(t,e,i){$o(this,t,e,!0,i)}scaleOf(t,e,i,s,n){qo(this,ra(this,t),e,i,s,n)}rotateOf(t,e,i){Ko(this,ra(this,t),e,i)}skewOf(t,e,i,s,n){Zo(this,ra(this,t),e,i,s,n)}transformWorld(t,e,i){ia(this,t,e,i)}moveWorld(t,e,i){$o(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){Qo(this,t,e,i,s,n)}rotateOfWorld(t,e){Jo(this,t,e)}skewOfWorld(t,e,i,s,n){ta(this,t,e,i,s,n)}flip(t,e){ea(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 St.need("path")}getMotionPoint(t){return St.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){aa(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):rr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Un),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Zr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Zr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=Xt([ur(wo),ur(Ro),ur(Io),ur(yo),ur(Mo)],t.Leaf);const{setListWithFn:ha}=at,{sort:la}=Ir,{localBoxBounds:da,localStrokeBounds:ca,localRenderBounds:ua,maskLocalBoxBounds:pa,maskLocalStrokeBounds:_a,maskLocalRenderBounds:ga}=Ar,fa=new Et("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){ha(this.__layout.boxBounds,this.children,this.__hasMask?pa:da)}__updateStrokeBounds(){ha(this.__layout.strokeBounds,this.children,this.__hasMask?_a:ca)}__updateRenderBounds(){ha(this.__layout.renderBounds,this.children,this.__hasMask?ga:ua)}__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(la),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return fa.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=Dt.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(Zr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Zr.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(Zr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Zr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Zr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=Xt([ur(Wo)],t.Branch);class ya{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,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)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 ya;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 ma{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 va=Et.get("LeaferCanvas");class wa extends se{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const s=i.children[t];s?(this.setAbsolute(s),i.insertBefore(e,s)):i.appendChild(s)}}init(){const{config:t}=this,i=t.view||t.canvas;i?this.__createViewFrom(i):this.__createView();const{style:s}=this.view;if(s.display||(s.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}e.syncDomFont&&!this.parentView&&(s.display="none",document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e="string"==typeof t?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else va.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:s}=this.view;s.width=t+"px",s.height=e+"px",this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,i){if(this.resizeListener=i,t){this.autoBounds=t;try{this.resizeObserver=new ResizeObserver((t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)}));const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),va.warn("no parent"))}catch(t){this.imitateResizeObserver()}}else window.addEventListener("resize",this.windowListener=()=>{const t=e.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:i}=this;this.emitResize({width:e,height:i,pixelRatio:t})}})}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),e.requestRender(this.imitateResizeObserver.bind(this)))}checkAutoBounds(t){const i=this.view,{x:s,y:n,width:r,height:o}=this.autoBounds.getBoundsFrom(t),a={width:r,height:o,pixelRatio:this.config.pixelRatio?this.pixelRatio:e.devicePixelRatio};if(!this.isSameSize(a)){const{style:t}=i;t.marginLeft=s+"px",t.marginTop=n+"px",this.emitResize(a)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};Wt.copyAttrs(e,this,ie),this.resize(t),this.resizeListener&&void 0!==this.width&&this.resizeListener(new Jr(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}gn(CanvasRenderingContext2D.prototype),gn(Path2D.prototype);const{mineType:xa,fileType:ba}=fn;function Ea(t,s){e.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const s=xa(e),n=t.toDataURL(s,i);return"image/bmp"===s?n.replace("image/png;","image/bmp;"):n},canvasToBolb:(t,e,i)=>new Promise((s=>t.toBlob(s,xa(e),i))),canvasSaveAs:(t,i,s)=>{const n=t.toDataURL(xa(ba(i)),s);return e.origin.download(n,i)},download:(t,e)=>new Promise((i=>{let s=document.createElement("a");s.href=t,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),i()})),loadImage:t=>new Promise(((i,s)=>{const n=new e.origin.Image,{crossOrigin:r}=e.image;r&&(n.setAttribute("crossOrigin",r),n.crossOrigin=r),n.onload=()=>{i(n)},n.onerror=t=>{s(t)},n.src=e.image.getRealURL(t)})),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},e.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},e.canvas=i.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(i,{canvas:(t,e)=>new wa(t,e),image:t=>new Cn(t)}),e.name="web",e.isMobile="ontouchstart"in window,e.requestRender=function(t){window.requestAnimationFrame(t)},Tn(e,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:Ba}=navigator;Ba.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0,e.syncDomFont=!0):Ba.indexOf("AppleWebKit")>-1&&(e.fullImageShadow=!0),Ba.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):Ba.indexOf("Mac")>-1?e.os="Mac":Ba.indexOf("Linux")>-1&&(e.os="Linux");class Pa{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new ya;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 ya,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(io.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Zr.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 to(to.DATA,{updatedList:this.updatedList})),this.__updatedList=new ya,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_($r.CHANGE,this.__onAttrChange,this),t.on_([Zr.ADD,Zr.REMOVE],this.__onChildEvent,this),t.on_(to.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:ka,updateBounds:Ra,updateAllWorldOpacity:Ca}=kr,{pushAllChildBranch:Ta,pushAllParent:Sa}=Ir;const{worldBounds:La}=Ar;class Da{constructor(t){this.updatedBounds=new ct,this.beforeBounds=new ct,this.afterBounds=new ct,t instanceof Array&&(t=new ya(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,La)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,La),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:Aa,updateAllChange:Oa}=kr,Ia=Et.get("Layouter");class Ma{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new ma,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.running)return;const{target:t}=this;this.times=0;try{t.emit(eo.START),this.layoutOnce(),t.emitEvent(new eo(eo.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(to.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=Rt.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=eo,a=this.getBlocks(s);a.forEach((t=>t.setBefore())),i.emitEvent(new eo(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(ka(t,!0),e.add(t),t.isBranch&&Ta(t,e),Sa(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Sa(t,e)))}))}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach((n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Ra(s[t])}Ra(i)}}))}(this.__levelList),function(t){let e;t.list.forEach((t=>{e=t.__layout,e.opacityChanged&&Ca(t),e.stateStyleChanged&&setTimeout((()=>e.stateStyleChanged&&t.updateState())),t.__updateChange()}))}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach((t=>t.setAfter())),i.emitEvent(new eo(r,a,this.times)),i.emitEvent(new eo(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Rt.end(e)}fullLayout(){const t=Rt.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=eo,r=this.getBlocks(new ya(e));e.emitEvent(new eo(i,r,this.times)),Ma.fullLayout(e),r.forEach((t=>{t.setAfter()})),e.emitEvent(new eo(s,r,this.times)),e.emitEvent(new eo(n,r,this.times)),this.addBlocks(r),Rt.end(t)}static fullLayout(t){Aa(t,!0),t.isBranch?Ir.updateBounds(t):kr.updateBounds(t),Oa(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Da([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Da(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_(eo.REQUEST,this.layout,this),t.on_(eo.AGAIN,this.layoutAgain,this),t.on_(to.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Fa=Et.get("Renderer");class Wa{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(eo.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(io.CHILD_START,t),t.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),t.emit(io.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(io.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new ct,Fa.log(e.innerName,"---\x3e");try{this.emitRender(io.START),this.renderOnce(t),this.emitRender(io.END,this.totalBounds),Bn.clearRecycled()}catch(t){this.rendering=!1,Fa.error(t)}Fa.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Fa.warn("rendering");if(this.times>3)return Fa.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new ct,this.renderOptions={},t)this.emitRender(io.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(io.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(io.RENDER,this.renderBounds,this.renderOptions),this.emitRender(io.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=Rt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new ct(s);i.save(),s.spread(Wa.clipSpread).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0),this.__render(s,n),i.restore(),Rt.end(e)}fullRender(){const t=Rt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Rt.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),Et.showRepaint&&Et.drawRepaint(i,t),this.target.__render(i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new ct;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);const i=this.requestTime=Date.now();e.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()}))}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new ct(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 ct(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||Fa.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 io(t,this.times,e,i))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(io.REQUEST,this.update,this),t.on_(eo.END,this.__onLayoutEnd,this),t.on_(io.AGAIN,this.renderAgain,this),t.on_(Jr.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}Wa.clipSpread=10;const{hitRadiusPoint:Ua}=at;class Na{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new ya(i.findList),i.findList||this.hitBranch(r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}getBestMatchLeaf(t,e,i){if(t.length){let e;this.findList=new ya;const{x:s,y:n}=this.point,r={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||kr.worldHittable(e))&&(this.hitChild(e,r),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 ya;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 ya;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 ya,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let r=t.length-1;r>-1;r--)i=t[r],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||Ua(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask&&!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 za{constructor(t,e){this.config={},e&&(this.config=Wt.default(e,this.config)),this.picker=new Na(this.target=t,this),this.finder=i.finder&&i.finder()}getByPoint(t,i,s){const{target:n,picker:r}=this;return e.backgrounder&&n&&n.updateLayout(),r.getByPoint(t,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):St.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Ya(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function ja(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function Ha(){return(t,e)=>{const i="_"+e;Tn(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(i,{watcher:(t,e)=>new Pa(t,e),layouter:(t,e)=>new Ma(t,e),renderer:(t,e,i)=>new Wa(t,e,i),selector:(t,e)=>new za(t,e)}),e.layout=Ma.fullLayout;const Xa={},Ga={},Va={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},qa={},Ka={},Za={},$a={},Qa={},Ja={apply(){St.need("filter")}},th={},eh={setStyleName:()=>St.need("state"),set:()=>St.need("state")},ih={list:{},register(t,e){ih.list[t]=e},get:t=>ih.list[t]},{parse:sh,objectToCanvasData:nh}=Pi,rh={},oh=Et.get("UIData");class ah 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,oh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,oh.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=rh)}}else this.__isFills&&(this.__removeInput("fill"),Za.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=rh)}}else this.__isStrokes&&(this.__removeInput("stroke"),Za.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?sh(t):nh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){hh(this,"shadow",t)}setInnerShadow(t){hh(this,"innerShadow",t)}setFilter(t){hh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Ka.compute("fill",this.__leaf),e&&Ka.compute("stroke",this.__leaf),this.__needComputePaint=!1}}function hh(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 lh extends ah{}class dh extends lh{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 ch extends lh{__getInputData(t,e){const i=super.__getInputData(t,e);return ie.forEach((t=>delete i[t])),i}}class uh extends dh{}class ph extends ah{}class _h extends ah{get __boxStroke(){return!this.__pathInputed}}class gh extends ah{get __boxStroke(){return!this.__pathInputed}}class fh extends ah{}class yh extends ah{}class mh extends ah{get __pathInputed(){return 2}}class vh extends lh{}const wh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class xh extends ah{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=wh[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=Dt.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.strokeChange(),r.renderChanged&&n.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class bh extends _h{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 Eh extends _h{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 Bh={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,strokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Math.max(r.__layout.strokeSpread=r.__updateStrokeSpread(),t),e=r.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r}=this.__;e&&e.forEach((e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur))),s&&(t=Math.max(t,s)),r&&(t+=Ja.getSpread(r));let o=t=Math.ceil(t);return i&&i.forEach((t=>o=Math.max(o,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur))),n&&(o=Math.max(o,n)),this.__layout.renderShapeSpread=o,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},Ph={__updateChange(){const t=this.__,e=this.__world;if(t.__useEffect){const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r}=this.__;t.__useEffect=!!(e||i||s||n||r)}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){kh(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o}=s;if(this.__drawRenderPath(t),s.__useEffect){const a=Ka.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:l,filter:d}=s;h&&Qa.shadow(this,t,a),n&&(s.__isFills?Ka.fills(n,this,t):Ka.fill(n,this,t)),o&&this.__drawAfterFill(t,e),l&&Qa.innerShadow(this,t,a),r&&(s.__isStrokes?Ka.strokes(r,this,t):Ka.stroke(r,this,t)),d&&Ja.apply(d,this,this.__nowWorld,t,i,a),a.worldCanvas&&a.worldCanvas.recycle(),a.canvas.recycle()}else n&&(s.__isFills?Ka.fills(n,this,t):Ka.fill(n,this,t)),o&&this.__drawAfterFill(t,e),r&&(s.__isStrokes?Ka.strokes(r,this,t):Ka.stroke(r,this,t))}else s.__pathInputed?kh(this,t,e):this.__drawFast(t,e)},__renderShape(t,e,i,s){if(this.__worldOpacity){t.setWorld(this.__nowWorld=this.__getNowWorld(e));const{fill:n,stroke:r}=this.__;this.__drawRenderPath(t),n&&!i&&(this.__.__pixelFill?Ka.fills(n,this,t):Ka.fill("#000000",this,t)),this.__.__isCanvas&&this.__drawAfterFill(t,e),r&&!s&&(this.__.__pixelStroke?Ka.strokes(r,this,t):Ka.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 kh(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r}=t.__;t.__drawRenderPath(e),s&&Ka.fill(s,t,e),r&&t.__drawAfterFill(e,i),n&&Ka.stroke(n,t,e)}const Rh={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var Ch,Th;t.UI=Ch=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){h.assignScale(this,t)}get scale(){return this.__.scale}get pen(){const{path:t}=this.__;return pn.set(this.path=t||[]),t||this.__drawPathByBox(pn),pn}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 St.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return St.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(pn.set(i=[]),this.__drawPathByBox(pn)),t?Pi.toCanvasData(i,!0):i}getPathString(t,e,i){return Pi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||th.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){if(this.__.path){const t=this.__;t.__pathForRender=t.cornerRadius?un.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&qa.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?ks.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,n,"number"==typeof r?[r]:r)}else t.rect(e,i,s,n)}animate(t,e,i,s){return St.need("animate")}killAnimate(t,e){}export(t,e){return St.need("export")}syncExport(t,e){return St.need("export")}clone(t){const e=Wt.clone(this.toJSON());return t&&Object.assign(e,t),Ch.one(e)}static one(t,e,i,s,n){return Dt.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){pr()(this)}static registerData(t){nr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},Xt([nr(ah)],t.UI.prototype,"__",void 0),Xt([Ha()],t.UI.prototype,"zoomLayer",void 0),Xt([On("")],t.UI.prototype,"id",void 0),Xt([On("")],t.UI.prototype,"name",void 0),Xt([On("")],t.UI.prototype,"className",void 0),Xt([qn("pass-through")],t.UI.prototype,"blendMode",void 0),Xt([Kn(1)],t.UI.prototype,"opacity",void 0),Xt([Zn(!0)],t.UI.prototype,"visible",void 0),Xt([qn(!1)],t.UI.prototype,"locked",void 0),Xt([qn(!1)],t.UI.prototype,"dim",void 0),Xt([qn(!1)],t.UI.prototype,"dimskip",void 0),Xt([Jn(0)],t.UI.prototype,"zIndex",void 0),Xt([tr(!1)],t.UI.prototype,"mask",void 0),Xt([er(!1)],t.UI.prototype,"eraser",void 0),Xt([In(0,!0)],t.UI.prototype,"x",void 0),Xt([In(0,!0)],t.UI.prototype,"y",void 0),Xt([Un(100,!0)],t.UI.prototype,"width",void 0),Xt([Un(100,!0)],t.UI.prototype,"height",void 0),Xt([Fn(1,!0)],t.UI.prototype,"scaleX",void 0),Xt([Fn(1,!0)],t.UI.prototype,"scaleY",void 0),Xt([Wn(0,!0)],t.UI.prototype,"rotation",void 0),Xt([Wn(0,!0)],t.UI.prototype,"skewX",void 0),Xt([Wn(0,!0)],t.UI.prototype,"skewY",void 0),Xt([In(0,!0)],t.UI.prototype,"offsetX",void 0),Xt([In(0,!0)],t.UI.prototype,"offsetY",void 0),Xt([In(0,!0)],t.UI.prototype,"scrollX",void 0),Xt([In(0,!0)],t.UI.prototype,"scrollY",void 0),Xt([Mn()],t.UI.prototype,"origin",void 0),Xt([Mn()],t.UI.prototype,"around",void 0),Xt([On(!1)],t.UI.prototype,"lazy",void 0),Xt([Nn(1)],t.UI.prototype,"pixelRatio",void 0),Xt([Yn()],t.UI.prototype,"path",void 0),Xt([jn()],t.UI.prototype,"windingRule",void 0),Xt([jn(!0)],t.UI.prototype,"closed",void 0),Xt([Un(0)],t.UI.prototype,"padding",void 0),Xt([Un(!1)],t.UI.prototype,"lockRatio",void 0),Xt([Un()],t.UI.prototype,"widthRange",void 0),Xt([Un()],t.UI.prototype,"heightRange",void 0),Xt([On(!1)],t.UI.prototype,"draggable",void 0),Xt([On()],t.UI.prototype,"dragBounds",void 0),Xt([On(!1)],t.UI.prototype,"editable",void 0),Xt([ir(!0)],t.UI.prototype,"hittable",void 0),Xt([ir("path")],t.UI.prototype,"hitFill",void 0),Xt([Gn("path")],t.UI.prototype,"hitStroke",void 0),Xt([ir(!1)],t.UI.prototype,"hitBox",void 0),Xt([ir(!0)],t.UI.prototype,"hitChildren",void 0),Xt([ir(!0)],t.UI.prototype,"hitSelf",void 0),Xt([ir()],t.UI.prototype,"hitRadius",void 0),Xt([sr("")],t.UI.prototype,"cursor",void 0),Xt([qn()],t.UI.prototype,"fill",void 0),Xt([Gn()],t.UI.prototype,"stroke",void 0),Xt([Gn("inside")],t.UI.prototype,"strokeAlign",void 0),Xt([Gn(1)],t.UI.prototype,"strokeWidth",void 0),Xt([Gn(!1)],t.UI.prototype,"strokeWidthFixed",void 0),Xt([Gn("none")],t.UI.prototype,"strokeCap",void 0),Xt([Gn("miter")],t.UI.prototype,"strokeJoin",void 0),Xt([Gn()],t.UI.prototype,"dashPattern",void 0),Xt([Gn(0)],t.UI.prototype,"dashOffset",void 0),Xt([Gn(10)],t.UI.prototype,"miterLimit",void 0),Xt([jn(0)],t.UI.prototype,"cornerRadius",void 0),Xt([jn()],t.UI.prototype,"cornerSmoothing",void 0),Xt([Ya()],t.UI.prototype,"shadow",void 0),Xt([Ya()],t.UI.prototype,"innerShadow",void 0),Xt([Ya()],t.UI.prototype,"blur",void 0),Xt([Ya()],t.UI.prototype,"backgroundBlur",void 0),Xt([Ya()],t.UI.prototype,"grayscale",void 0),Xt([Ya()],t.UI.prototype,"filter",void 0),Xt([On({})],t.UI.prototype,"data",void 0),Xt([lr(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Ch=Xt([ur(Bh),ur(Ph),dr()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach((t=>this.add(t))),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return 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(){}},Xt([nr(lh)],t.Group.prototype,"__",void 0),Xt([Un(0)],t.Group.prototype,"width",void 0),Xt([Un(0)],t.Group.prototype,"height",void 0),t.Group=Xt([ur(t.Branch),pr()],t.Group);const Sh=Et.get("Leafer");t.Leafer=Th=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&bn.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),Th.list.add(this)}init(t,e){if(this.canvas)return;let s;const{config:n}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),s=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,Wt.assign(n,t));const r=this.canvas=i.canvas(n);this.__controllers.push(this.renderer=i.renderer(this,r,n),this.watcher=i.watcher(this,n),this.layouter=i.layouter(this,n)),this.isApp&&this.__setApp(),this.__checkAutoLayout(n,e),this.view=r.view,e||(this.selector=i.selector(this),this.interaction=i.interaction(this,r,this.selector,n),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=i.hitCanvasManager()),this.canvasManager=new Ft,s=n.start),this.hittable=n.hittable,this.fill=n.fill,this.canvasManager.add(r),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),Ur.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(so.RESTART):this.emitLeafer(so.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(so.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 ct(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 Jr(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 pt(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(so.BEFORE_READY),this.emitLeafer(so.READY),this.emitLeafer(so.AFTER_READY),Ur.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(so.VIEW_READY),Ur.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Ur.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(so.VIEW_COMPLETED),Ur.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 St.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 so(t,this))}__listenEvents(){const t=Rt.start("FirstCreate "+this.innerName);this.once(so.START,(()=>Rt.end(t))),this.once(eo.START,(()=>this.updateLazyBounds())),this.once(io.START,(()=>this.__onCreated())),this.once(io.END,(()=>this.__onViewReady())),this.__eventIds.push(this.on_(to.DATA,this.__onWatchData,this),this.on_(eo.END,this.__onLayoutEnd,this),this.on_(io.NEXT,this.__onNextRender,this))}__removeListenEvents(){this.off_(this.__eventIds),this.__eventIds.length=0}destroy(t){const e=()=>{if(!this.destroyed){Th.list.remove(this);try{this.stop(),this.emitEvent(new so(so.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((()=>{Bn.clearRecycled()}),100)}catch(t){Sh.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new ya,Xt([nr(ch)],t.Leafer.prototype,"__",void 0),Xt([Un()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=Th=Xt([pr()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}constructor(t){super(t)}},Xt([nr(_h)],t.Rect.prototype,"__",void 0),t.Rect=Xt([ur(Rh),dr(),pr()],t.Rect);const{copy:Lh,add:Dh,includes:Ah}=at,Oh=t.Rect.prototype,Ih=t.Group.prototype,Mh={};t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){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(),Lh(Mh,e),this.__updateRectRenderBounds(),t=!Ah(e,Mh)||void 0,t&&"hide"!==this.__.overflow&&Dh(e,Mh)):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))}},Xt([nr(dh)],t.Box.prototype,"__",void 0),Xt([Un(100)],t.Box.prototype,"width",void 0),Xt([Un(100)],t.Box.prototype,"height",void 0),Xt([On(!1)],t.Box.prototype,"resizeChildren",void 0),Xt([Vn("show")],t.Box.prototype,"overflow",void 0),Xt([lr(Oh.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),Xt([lr(Oh.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),Xt([lr(Oh.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),Xt([lr(Oh.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),Xt([lr(Oh.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),Xt([lr(Oh.__updateChange)],t.Box.prototype,"__updateRectChange",null),Xt([lr(Oh.__render)],t.Box.prototype,"__renderRect",null),Xt([lr(Ih.__render)],t.Box.prototype,"__renderGroup",null),t.Box=Xt([dr(),pr()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},Xt([nr(uh)],t.Frame.prototype,"__",void 0),Xt([qn("#FFFFFF")],t.Frame.prototype,"fill",void 0),Xt([Vn("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=Xt([pr()],t.Frame);const{moveTo:Fh,closePath:Wh,ellipse:Uh}=qi;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:i,innerRadius:s,startAngle:n,endAngle:r}=this.__,o=t/2,a=i/2,h=this.__.path=[];s?(n||r?(s<1&&Uh(h,o,a,o*s,a*s,0,n,r,!1),Uh(h,o,a,o,a,0,r,n,!0),s<1&&Wh(h)):(s<1&&(Uh(h,o,a,o*s,a*s),Fh(h,t,a)),Uh(h,o,a,o,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||r?(Fh(h,o,a),Uh(h,o,a,o,a,0,n,r,!1),Wh(h)):Uh(h,o,a,o,a)}},Xt([nr(gh)],t.Ellipse.prototype,"__",void 0),Xt([jn(0)],t.Ellipse.prototype,"innerRadius",void 0),Xt([jn(0)],t.Ellipse.prototype,"startAngle",void 0),Xt([jn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=Xt([pr()],t.Ellipse);const{moveTo:Nh,lineTo:zh,drawPoints:Yh}=qi,{rotate:jh,getAngle:Hh,getDistance:Xh,defaultPoint:Gh}=I,{toBounds:Vh}=rn;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&jh(i,e),i}set toPoint(t){this.width=Xh(Gh,t),this.rotation=Hh(Gh,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Yh(e,t.points,!1,t.closed):(Nh(e,0,0),zh(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Yh(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&qa.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?Vh(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},Xt([nr(ph)],t.Line.prototype,"__",void 0),Xt([Hn("center")],t.Line.prototype,"strokeAlign",void 0),Xt([Un(0)],t.Line.prototype,"height",void 0),Xt([jn()],t.Line.prototype,"points",void 0),Xt([jn(0)],t.Line.prototype,"curve",void 0),Xt([jn(!1)],t.Line.prototype,"closed",void 0),t.Line=Xt([pr()],t.Line);const{sin:qh,cos:Kh,PI:Zh}=Math,{moveTo:$h,lineTo:Qh,closePath:Jh,drawPoints:tl}=qi,el=t.Line.prototype;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)tl(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,n=e/2,r=i/2;$h(t,n,0);for(let e=1;e<s;e++)Qh(t,n+n*qh(2*e*Zh/s),r-r*Kh(2*e*Zh/s))}Jh(t)}__updateRenderPath(){}__updateBoxBounds(){}},Xt([nr(fh)],t.Polygon.prototype,"__",void 0),Xt([jn(3)],t.Polygon.prototype,"sides",void 0),Xt([jn()],t.Polygon.prototype,"points",void 0),Xt([jn(0)],t.Polygon.prototype,"curve",void 0),Xt([lr(el.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),Xt([lr(el.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=Xt([dr(),pr()],t.Polygon);const{sin:il,cos:sl,PI:nl}=Math,{moveTo:rl,lineTo:ol,closePath:al}=qi;t.Star=class extends t.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];rl(o,n,0);for(let t=1;t<2*i;t++)ol(o,n+(t%2==0?n:n*s)*il(t*nl/i),r-(t%2==0?r:r*s)*sl(t*nl/i));al(o)}},Xt([nr(yh)],t.Star.prototype,"__",void 0),Xt([jn(5)],t.Star.prototype,"corners",void 0),Xt([jn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=Xt([pr()],t.Star),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t),this.on(Qr.LOADED,(t=>{"fill"===t.attrName&&t.attrValue.url===this.url&&(this.image=t.image)}))}destroy(){this.image=null,super.destroy()}},Xt([nr(bh)],t.Image.prototype,"__",void 0),Xt([Un("")],t.Image.prototype,"url",void 0),t.Image=Xt([pr()],t.Image);const hl=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get ready(){return!this.url}constructor(t){super(t),this.canvas=i.canvas(this.__),this.context=this.canvas.context,t&&t.url&&this.drawImage(t.url)}drawImage(t){new Cn({url:t}).load((t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Qr(Qr.LOADED,{image:t}))}))}draw(t,e,i,s){const n=new Y(t.worldTransform).invert(),r=new Y;e&&r.translate(e.x,e.y),i&&("number"==typeof i?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=this.context=null),super.destroy()}},Xt([nr(Eh)],t.Canvas.prototype,"__",void 0),Xt([ja(100)],t.Canvas.prototype,"width",void 0),Xt([ja(100)],t.Canvas.prototype,"height",void 0),Xt([ja(1)],t.Canvas.prototype,"pixelRatio",void 0),Xt([ja(!0)],t.Canvas.prototype,"smooth",void 0),Xt([On(!1)],t.Canvas.prototype,"safeResize",void 0),Xt([ja()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=Xt([pr()],t.Canvas);const{copyAndSpread:ll,includes:dl,spread:cl,setList:ul}=at;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:r,italic:o,textCase:a,textOverflow:l,padding:d}=t;t.__lineHeight=Va.number(e,n),t.__letterSpacing=Va.number(i,n),t.__padding=d?h.fourNumber(d):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n}px ${s}`,t.__clipText="show"!==l&&!t.__autoSize,t.__textDrawData=Xa.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&cl(a,i/2),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i);const l=!dl(h,a)||void 0;l?(ul(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;ll(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&&!th.running||super.__draw(t,e,i)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},Xt([nr(xh)],t.Text.prototype,"__",void 0),Xt([Un(0)],t.Text.prototype,"width",void 0),Xt([Un(0)],t.Text.prototype,"height",void 0),Xt([qn()],t.Text.prototype,"boxStyle",void 0),Xt([On(!1)],t.Text.prototype,"resizeFontSize",void 0),Xt([qn("#000000")],t.Text.prototype,"fill",void 0),Xt([Hn("outside")],t.Text.prototype,"strokeAlign",void 0),Xt([ir("all")],t.Text.prototype,"hitFill",void 0),Xt([Un("")],t.Text.prototype,"text",void 0),Xt([Un("caption")],t.Text.prototype,"fontFamily",void 0),Xt([Un(12)],t.Text.prototype,"fontSize",void 0),Xt([Un("normal")],t.Text.prototype,"fontWeight",void 0),Xt([Un(!1)],t.Text.prototype,"italic",void 0),Xt([Un("none")],t.Text.prototype,"textCase",void 0),Xt([Un("none")],t.Text.prototype,"textDecoration",void 0),Xt([Un(0)],t.Text.prototype,"letterSpacing",void 0),Xt([Un({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),Xt([Un(0)],t.Text.prototype,"paraIndent",void 0),Xt([Un(0)],t.Text.prototype,"paraSpacing",void 0),Xt([Un("x")],t.Text.prototype,"writingMode",void 0),Xt([Un("left")],t.Text.prototype,"textAlign",void 0),Xt([Un("top")],t.Text.prototype,"verticalAlign",void 0),Xt([Un(!0)],t.Text.prototype,"autoSizeAlign",void 0),Xt([Un("normal")],t.Text.prototype,"textWrap",void 0),Xt([Un("show")],t.Text.prototype,"textOverflow",void 0),t.Text=Xt([pr()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}constructor(t){super(t)}},Xt([nr(mh)],t.Path.prototype,"__",void 0),Xt([Hn("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=Xt([pr()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},Xt([nr(vh)],t.Pen.prototype,"__",void 0),Xt([(t,e)=>{Tn(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=Xt([ur(cs,["set","path","paint"]),pr()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:s,sky:n,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(s||r)&&(this.tree=this.addLeafer(s||{type:t.type||"design"})),(n||r)&&(this.sky=this.addLeafer(n)),r&&this.sky.add(this.editor=i.editor(r))}}__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(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout((()=>this.add(t,e)),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),void 0!==e&&(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every((t=>t.created))}__onReady(){this.children.every((t=>t.ready))&&super.__onReady()}__onViewReady(){this.children.every((t=>t.viewReady))&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){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&&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(eo.END,(()=>this.__onReady())),t.once(io.START,(()=>this.__onCreated())),t.once(io.END,(()=>this.__onViewReady())),this.realCanvas&&this.__eventIds.push(t.on_(io.END,this.__onChildRenderEnd,this))}},t.App=Xt([pr()],t.App);const pl={},_l={isHoldSpaceKey:()=>_l.isHold("Space"),isHold:t=>pl[t],setDownCode(t){pl[t]||(pl[t]=!0)},setUpCode(t){pl[t]=!1}},gl={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 fl extends Kr{get spaceKey(){return _l.isHoldSpaceKey()}get left(){return gl.left(this)}get right(){return gl.right(this)}get middle(){return gl.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){It.changeName(t,e)}}t.PointerEvent=class extends fl{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=Xt([_r()],t.PointerEvent);const yl=t.PointerEvent,ml={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof ya?t:new ya(t)}static setData(t){this.data=t}static getValidMove(t,e,i){const{draggable:s,dragBounds:n}=t,r=t.getLocalPoint(i,null,!0);return I.move(r,e.x-t.x,e.y-t.y),n&&this.getMoveInDragBounds(t.__localBoxBounds,"parent"===n?t.parent.boxBounds:n,r,!0),"x"===s&&(r.y=0),"y"===s&&(r.x=0),r}static getMoveInDragBounds(t,e,i,s){const n=t.x+i.x,r=t.y+i.y,o=n+t.width,a=r+t.height,h=e.x+e.width,l=e.y+e.height;return s||(i=Object.assign({},i)),at.includes(t,e)?(n>e.x?i.x+=e.x-n:o<h&&(i.x+=h-o),r>e.y?i.y+=e.y-r:a<l&&(i.y+=l-a)):(n<e.x?i.x+=e.x-n:o>h&&(i.x+=h-o),r<e.y?i.y+=e.y-r:a>l&&(i.y+=l-a)),i}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(ml,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(ml,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(ml,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 at.set(i,e.x-t.x,e.y-t.y,t.x,t.y),at.unsign(i),i}assignMove(t){ml.x=t?this.totalX:this.moveX,ml.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=Xt([_r()],t.DragEvent);const vl=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=Xt([_r()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=Xt([_r()],t.MoveEvent),t.RotateEvent=class extends fl{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=Xt([_r()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=Xt([_r()],t.SwipeEvent),t.ZoomEvent=class extends fl{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=Xt([_r()],t.ZoomEvent),t.KeyEvent=class extends fl{},t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=Xt([_r()],t.KeyEvent);const wl={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:xl.getSwipeDirection(I.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 ya,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some((e=>e.draggable||e.editable||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},xl=wl,bl=new ya,{getDragEventData:El,getDropEventData:Bl,getSwipeEventData:Pl}=wl;class kl{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=El(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,r=t.DragEvent.list||this.draggableList||bl;return this.dragging&&(n?e?bl:new ya(i?[...s.list,...s.dragHoverExclude]:s.list):r)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&gl.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach((t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y}))}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],(e.draggable||e.editable)&&e.hitSelf&&!e.locked){this.draggableList=new ya(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:r,throughPath:o}=n;this.dragData=El(n,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=r,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(){const{running:e}=this.interaction,i=this.realDraggableList;if(i.length&&e){const{totalX:e,totalY:s}=this.dragData;i.forEach((i=>i.draggable&&i.move(t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:e,y:s}))))}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:r,throughPath:o}=s,a=El(s,e,e);if(o&&(a.throughPath=o),a.path=r,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const r=this.getList();this.dragging=!1,i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(I.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Pl(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=Bl(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Rl=Et.get("emit");const Cl=["move","zoom","rotate","key"];function Tl(t,e,i,s,n){if(Cl.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Ll(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&Sl(r,e,i,s,n)}}function Sl(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Ll(t,n)&&(eh.updateEventStyle&&!s&&eh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=It.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Ll(t,e){return e&&e.has(t)}const Dl={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:Al,pathCanDrag:Ol,pathHasOutside:Il}=wl;class Ml{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&&gl.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&gl.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&_l.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(Dl),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new ya(t),this.createTransformer(),this.dragger=new kl(this),s&&(this.config=Wt.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(gl.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),gl.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=gl.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&gl.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=I.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;gl.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,_l.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;const{code:i}=e;this.downKeyMap[i]=!1,_l.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new ya),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach((t=>i.add(t))));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,r=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some((t=>Al(e.path,t)));n<i.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}),i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,i){const{hitRadius:s,through:n}=this.p,{bottomList:r,target:o}=this;e.backgrounder||t.origin||o&&o.updateLayout();const a=this.selector.getByPoint(t,s,Object.assign({bottomList:r,name:t.type},i||{through:n}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Il(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Ol(t.path))&&!Il(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y};return this.p.snap&&I.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)}),this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Al(e.path,t.PointerEvent.LONG_TAP)||Al(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new ct(this.canvas.bounds),this.shrinkCanvasBounds.spread(-("number"==typeof t?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Jr.RESIZE,this.__onResize,this)],t.once(so.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],Sl(n,t,e,!0,s))return;n.isApp&&Tl(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&Tl(n,t,e,!1,s),Sl(n,t,e,!1,s))return}catch(t){Rl.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 Fl{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Fl.custom={};class Wl extends Ft{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new ya,this.pixelList=new ya}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),i.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),i.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:Ul,copy:Nl,setRadius:zl}=I,Yl={},jl=t.Leaf.prototype;jl.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,n=i.width<10&&i.height<10;if(e.hitRadius&&(Nl(Yl,t),zl(t=Yl,e.hitRadius)),Ul(t,i,Yl),e.hitBox||n){if(at.hitRadiusPoint(s.boxBounds,Yl))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Yl)},jl.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},jl.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},jl.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},jl.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Hl=new Y,Xl=t.UI.prototype;Xl.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const t=this.__,{hitCanvasManager:i}=this.leafer||this.parent.leafer,s=(t.__pixelFill||t.__isCanvas)&&"pixel"===t.hitFill,n=t.__pixelStroke&&"pixel"===t.hitStroke,r=s||n;this.__hitCanvas||(this.__hitCanvas=r?i.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):i.getPathType(this));const o=this.__hitCanvas;if(r){const{renderBounds:i}=this.__layout,r=e.image.hitCanvasSize,a=o.hitScale=ut.set(0,0,r,r).getFitMatrix(i).a,{x:h,y:l,width:d,height:c}=ut.set(i).scale(a);o.resize({width:d,height:c,pixelRatio:1}),o.clear(),Bn.patternLocked=!0,this.__renderShape(o,{matrix:Hl.setWith(this.__world).scaleWith(1/a).invertWith().translate(-h,-l)},!s,!n),Bn.patternLocked=!1,o.resetTransform(),t.__isHitPixel=!0}else t.__isHitPixel&&(t.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(t)},Xl.__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:n,__strokeWidth:r}=e,o=e.stroke&&("path"===n||"pixel"===n&&!e.__pixelStroke)||"all"===n;if(!s&&!o)return!1;const a=2*t.radiusX;let h=a;if(o)switch(e.strokeAlign){case"inside":if(h+=2*r,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=r;break;case"outside":if(h+=2*r,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Gl=t.UI.prototype,Vl=t.Rect.prototype,ql=t.Box.prototype;Vl.__updateHitCanvas=ql.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Gl.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Vl.__hitFill=ql.__hitFill=function(t){return this.__hitCanvas?Gl.__hitFill.call(this,t):at.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach((n=>t.rect(n.x,n.y-s,n.width,e<i?i:e)))},t.Group.prototype.pick=function(t,s){return s||(s=Yt),this.updateLayout(),function(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=i.selector())}(this).getByPoint(t,s.hitRadius||0,Object.assign(Object.assign({},s),{target:this}))};const Kl=se.prototype;Kl.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Kl.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Kl.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),ut.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(ut.x,ut.y,ut.width||1,ut.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 Zl={convert(t,e){const i=wl.getBase(t),s=Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===s.pointerType&&(s.tangentialPressure=t.tangentialPressure,s.tiltX=t.tiltX,s.tiltY=t.tiltY,s.twist=t.twist),s},convertMouse(t,e){const i=wl.getBase(t);return Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=Zl.getTouch(t),s=wl.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})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},$l={convert(t){const e=wl.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:Ql}=wl;class Jl extends Ml{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),window.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,s=t.length;i<s;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown($l.convert(t))}onKeyUp(t){this.keyUp($l.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(Zl.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.config.pointer.touch||this.useMultiTouch||(this.usePointer||(this.usePointer=!0),this.pointerDown(Zl.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.config.pointer.touch||this.useMultiTouch||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=Zl.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.config.pointer.touch||this.useMultiTouch||this.preventWindowPointer(t)||this.pointerUp(Zl.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(Zl.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerMove(Zl.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerUp(Zl.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){const e=Zl.getTouch(t),i=this.getLocal(e,!0),{preventDefault:s}=this.config.touch;(!0===s||"auto"===s&&Ql(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.usePointer||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(Zl.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.usePointer||this.preventWindowPointer(t))return;const e=Zl.getTouch(t);this.pointerMove(Zl.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.usePointer||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout((()=>{this.useTouch=!1}),500);const e=Zl.getTouch(t);this.pointerUp(Zl.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||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(wl.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)))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},wl.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(t){if(this.useMultiTouch)return;this.preventDefaultWheel(t);const e=wl.getBase(t);Object.assign(e,this.getLocal(t));const i=t.scale/this.lastGestureScale,s=(t.rotation-this.lastGestureRotation)/Math.PI*180*(h.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},e),{scale:i*i})),this.rotate(Object.assign(Object.assign({},e),{rotation:s})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),"object"==typeof e[e.length-1]&&e.push("default"),this.canvas.view.style.cursor=e.map((t=>"object"==typeof t?`url(${t.url}) ${t.x||0} ${t.y||0}`:t)).join(",")}eachCursor(t,e,i=0){if(i++,t instanceof Array)t.forEach((t=>this.eachCursor(t,e,i)));else{const s="string"==typeof t&&Fl.get(t);s&&i<2?this.eachCursor(s,e,i):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function td(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:r}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.fillText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.fillText(t.char,t.x,i.y)}));if(r){const{decorationColor:t,decorationHeight:i}=s;t&&(e.fillStyle=t),n.forEach((t=>r.forEach((s=>e.fillRect(t.x,t.y+s,t.width,i)))))}}function ed(t,e,i){const{strokeAlign:s}=e.__,n="string"!=typeof t;switch(s){case"center":i.setStroke(n?void 0:t,e.__.strokeWidth,e.__),n?nd(t,!0,e,i):sd(e,i);break;case"inside":id("inside",t,n,e,i);break;case"outside":id("outside",t,n,e,i)}}function id(t,e,i,s,n){const{__strokeWidth:r,__font:o}=s.__,a=n.getSameCanvas(!0,!0);a.setStroke(i?void 0:e,2*r,s.__),a.font=o,i?nd(e,!0,s,a):sd(s,a),a.blendMode="outside"===t?"destination-out":"destination-in",td(s,a),a.blendMode="normal",s.__worldFlipped?n.copyWorldByReset(a,s.__nowWorld):n.copyWorldToInner(a,s.__nowWorld,s.__layout.renderBounds),a.recycle(s.__nowWorld)}function sd(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:r}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)}));if(r){const{decorationHeight:t}=s;n.forEach((i=>r.forEach((s=>e.strokeRect(i.x,i.y+s,i.width,t)))))}}function nd(t,e,i,s){let n;for(let r=0,o=t.length;r<o;r++)n=t[r],n.image&&Za.checkImage(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?sd(i,s):s.stroke(),s.restoreBlendMode()):e?sd(i,s):s.stroke())}function rd(t,e){t.__.dashPattern&&(e.beginPath(),t.__drawPathByData(e,t.__.__pathForArrow),e.dashPattern=null,e.stroke())}const{getSpread:od,getOuterOf:ad,getByMove:hd,getIntersectData:ld}=at;let dd;function cd(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:n,blendMode:r,color:o,opacity:a}=e;return{type:n,blendMode:r,style:Ga.string(o,a)};case"image":return Za.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:Ga.string(e)}:void 0}}const ud={compute:function(t,e){const i=e.__,s=[];let n,r=i.__input[t];r instanceof Array||(r=[r]),dd=Za.recycleImage(t,i);for(let i,n=0,o=r.length;n<o;n++)i=cd(t,r[n],e),i&&s.push(i);i["_"+t]=s.length?s:void 0,s.length&&s[0].image&&(n=s[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=n:i.__pixelStroke=n},fill:function(t,e,i){i.fillStyle=t,e.__.__font?td(e,i):e.__.windingRule?i.fill(e.__.windingRule):i.fill()},fills:function(t,e,i){let s;const{windingRule:n,__font:r}=e.__;for(let o=0,a=t.length;o<a;o++)s=t[o],s.image&&Za.checkImage(e,i,s,!r)||s.style&&(i.fillStyle=s.style,s.transform?(i.save(),i.transform(s.transform),s.blendMode&&(i.blendMode=s.blendMode),r?td(e,i):n?i.fill(n):i.fill(),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),r?td(e,i):n?i.fill(n):i.fill(),i.restoreBlendMode()):r?td(e,i):n?i.fill(n):i.fill())},fillText:td,stroke:function(t,e,i){const s=e.__,{__strokeWidth:n,strokeAlign:r,__font:o}=s;if(n)if(o)ed(t,e,i);else switch(r){case"center":i.setStroke(t,n,s),i.stroke(),s.__useArrow&&rd(e,i);break;case"inside":i.save(),i.setStroke(t,2*n,s),s.windingRule?i.clip(s.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const r=i.getSameCanvas(!0,!0);r.setStroke(t,2*n,s),e.__drawRenderPath(r),r.stroke(),s.windingRule?r.clip(s.windingRule):r.clip(),r.clearWorld(e.__layout.renderBounds),e.__worldFlipped?i.copyWorldByReset(r,e.__nowWorld):i.copyWorldToInner(r,e.__nowWorld,e.__layout.renderBounds),r.recycle(e.__nowWorld)}},strokes:function(t,e,i){const s=e.__,{__strokeWidth:n,strokeAlign:r,__font:o}=s;if(n)if(o)ed(t,e,i);else switch(r){case"center":i.setStroke(void 0,n,s),nd(t,!1,e,i),s.__useArrow&&rd(e,i);break;case"inside":i.save(),i.setStroke(void 0,2*n,s),s.windingRule?i.clip(s.windingRule):i.clip(),nd(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),o.setStroke(void 0,2*n,s),nd(t,!1,e,o),s.windingRule?o.clip(s.windingRule):o.clip(),o.clearWorld(r),e.__worldFlipped?i.copyWorldByReset(o,e.__nowWorld):i.copyWorldToInner(o,e.__nowWorld,r),o.recycle(e.__nowWorld)}},strokeText:ed,drawTextStroke:sd,shape:function(t,e,i){const s=e.getSameCanvas(),n=t.__nowWorld;let r,o,a,h,{scaleX:l,scaleY:d}=n;if(l<0&&(l=-l),d<0&&(d=-d),e.bounds.includes(n))h=s,r=a=n;else{const{renderShapeSpread:s}=t.__layout,c=ld(s?od(e.bounds,l===d?s*l:[s*d,s*l]):e.bounds,n);o=e.bounds.getFitMatrix(c);let{a:u,d:p}=o;if(o.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,d*=p),a=ad(n,o),r=hd(a,-o.e,-o.f),i.matrix){const{matrix:t}=i;o.multiply(t),u*=t.scaleX,p*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:o.withScale(u,p)})}return t.__renderShape(s,i),{canvas:s,matrix:o,bounds:r,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:d}}};let pd={};const{get:_d,rotateOfOuter:gd,translate:fd,scaleOfOuter:yd,scale:md,rotate:vd}=E;function wd(t,e,i,s,n,r,o){const a=_d();fd(a,e.x+i,e.y+s),md(a,n,r),o&&gd(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a}function xd(t,e,i,s,n,r,o){const a=_d();fd(a,e.x+i,e.y+s),n&&md(a,n,r),o&&vd(a,o),t.transform=a}function bd(t,e,i,s,n,r,o,a,h,l){const d=_d();if(h)if("center"===l)gd(d,{x:i/2,y:s/2},h);else switch(vd(d,h),h){case 90:fd(d,s,0);break;case 180:fd(d,i,s);break;case 270:fd(d,0,i)}pd.x=e.x+n,pd.y=e.y+r,fd(d,pd.x,pd.y),o&&yd(d,pd,o,a),t.transform=d}const{get:Ed,translate:Bd}=E,Pd=new ct,kd={},Rd={};function Cd(t,e,i,s){const{blendMode:n,changeful:r,sync:o}=i;n&&(t.blendMode=n),r&&(t.changeful=r),o&&(t.sync=o),t.data=Td(i,s,e)}function Td(t,e,i){let{width:s,height:n}=i;t.padding&&(e=Pd.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{opacity:r,mode:o,align:a,offset:l,scale:d,size:c,rotation:u,repeat:p,filters:_}=t,g=e.width===s&&e.height===n,f={mode:o},y="center"!==a&&(u||0)%180==90,m=y?n:s,v=y?s:n;let w,x,b=0,E=0;if(o&&"cover"!==o&&"fit"!==o)(d||c)&&(h.getScaleData(d,c,i,Rd),w=Rd.scaleX,x=Rd.scaleY);else if(!g||u){const t=e.width/m,i=e.height/v;w=x="fit"===o?Math.min(t,i):Math.max(t,i),b+=(e.width-s*w)/2,E+=(e.height-n*x)/2}if(a){const t={x:b,y:E,width:m,height:v};w&&(t.width*=w,t.height*=x),wt.toPoint(a,t,e,kd,!0),b+=kd.x,E+=kd.y}switch(l&&(b+=l.x,E+=l.y),o){case"stretch":g||(s=e.width,n=e.height);break;case"normal":case"clip":(b||E||w||u)&&xd(f,e,b,E,w,x,u);break;case"repeat":(!g||w||u)&&bd(f,e,s,n,b,E,w,x,u,a),p||(f.repeat="repeat");break;default:w&&wd(f,e,b,E,w,x,u)}return f.transform||(e.x||e.y)&&(f.transform=Ed(),Bd(f.transform,e.x,e.y)),w&&"stretch"!==o&&(f.scaleX=w,f.scaleY=x),f.width=s,f.height=n,r&&(f.opacity=r),_&&(f.filters=_),p&&(f.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat"),f}let Sd,Ld=new ct;const{isSame:Dd}=at;function Ad(t,e,i,s,n,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||Cd(n,s,i,r),!0}function Od(t,e){Fd(t,Qr.LOAD,e)}function Id(t,e){Fd(t,Qr.LOADED,e)}function Md(t,e,i){e.error=i,t.forceUpdate("surface"),Fd(t,Qr.ERROR,e)}function Fd(t,e,i){t.hasEvent(e)&&t.emitEvent(new Qr(e,i))}function Wd(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Ud,scale:Nd,copy:zd}=E,{ceil:Yd,abs:jd}=Math;function Hd(t,i,s){let{scaleX:n,scaleY:r}=Bn.patternLocked?t.__world:t.__nowWorld;const o=n+"-"+r+"-"+s;if(i.patternId===o||t.destroyed)return!1;{n=jd(n),r=jd(r);const{image:t,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:p,transform:_,repeat:g}=a;u&&(l=Ud(),zd(l,_),Nd(l,1/u,1/p),n*=u,r*=p),n*=s,r*=s,d*=n,c*=r;const f=d*c;if(!g&&f>e.image.maxCacheSize)return!1;let y=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;y>e&&(y=e)}f>y&&(h=Math.sqrt(f/y)),h&&(n/=h,r/=h,d/=h,c/=h),u&&(n/=u,r/=p),(_||1!==n||1!==r)&&(l||(l=Ud(),_&&zd(l,_)),Nd(l,1/n,1/r));const m=t.getCanvas(Yd(d)||1,Yd(c)||1,a.opacity,a.filters),v=t.getPattern(m,g||e.origin.noRepeat||"no-repeat",l,i);return i.style=v,i.patternId=o,!0}}const{abs:Xd}=Math;const Gd={image:function(t,e,i,s,n){let r,o;const a=Bn.get(i);return Sd&&i===Sd.paint&&Dd(s,Sd.boxBounds)?r=Sd.leafPaint:(r={type:i.type,image:a},Sd=a.use>1?{leafPaint:r,paint:i,boxBounds:Ld.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Ad(t,e,i,a,r,s),n&&(Od(t,o),Id(t,o))):a.error?n&&Md(t,o,a.error):(n&&(Wd(t,!0),Od(t,o)),r.loadId=a.load((()=>{Wd(t,!1),t.destroyed||(Ad(t,e,i,a,r,s)&&(a.hasOpacityPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Id(t,o)),r.loadId=null}),(e=>{Wd(t,!1),Md(t,o,e),r.loadId=null}))),r},checkImage:function(t,i,s,n){const{scaleX:r,scaleY:o}=Bn.patternLocked?t.__world:t.__nowWorld,{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===r+"-"+o+"-"+a&&!th.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||Jr.isResizing(t)||th.running)){let{width:t,height:i}=h;t*=Xd(r)*a,i*=Xd(o)*a,h.scaleX&&(t*=h.scaleX,i*=h.scaleY),n=t*i>e.image.maxCacheSize}return n?(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()}(t,i,s,h),!0):(!s.style||s.sync||th.running?Hd(t,s,a):s.patternTask||(s.patternTask=Bn.patternTasker.add((()=>Gt(this,void 0,void 0,(function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&Hd(t,s,a),t.forceUpdate("surface")}))),300)),!1)},createPattern:Hd,recycleImage:function(t,e){const i=e["_"+t];if(i instanceof Array){let s,n,r,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,Bn.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],o instanceof Array||(o=[o])),n.unload(i[h].loadId,!o.some((t=>t.url===a)))));return r}return null},createData:Cd,getPatternData:Td,fillOrFitMode:wd,clipMode:xd,repeatMode:bd},{toPoint:Vd}=yt,qd={},Kd={};function Zd(t,e,i){if(e){let s;for(let n=0,r=e.length;n<r;n++)s=e[n],"string"==typeof s?t.addColorStop(n/(r-1),Ga.string(s,i)):t.addColorStop(s.offset,Ga.string(s.color,i))}}const{getAngle:$d,getDistance:Qd}=I,{get:Jd,rotateOfOuter:tc,scaleOfOuter:ec}=E,{toPoint:ic}=yt,sc={},nc={};function rc(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=$d(e,i);r=Jd(),n?(ec(r,e,o/a*(s||1),1),tc(r,e,t+90)):(ec(r,e,1,o/a*(s||1)),tc(r,e,t))}return r}const{getDistance:oc}=I,{toPoint:ac}=yt,hc={},lc={};const dc={linearGradient:function(t,i){let{from:s,to:n,type:r,blendMode:o,opacity:a}=t;Vd(s||"top",i,qd),Vd(n||"bottom",i,Kd);const h=e.canvas.createLinearGradient(qd.x,qd.y,Kd.x,Kd.y);Zd(h,t.stops,a);const l={type:r,style:h};return o&&(l.blendMode=o),l},radialGradient:function(t,i){let{from:s,to:n,type:r,opacity:o,blendMode:a,stretch:h}=t;ic(s||"center",i,sc),ic(n||"bottom",i,nc);const l=e.canvas.createRadialGradient(sc.x,sc.y,0,sc.x,sc.y,Qd(sc,nc));Zd(l,t.stops,o);const d={type:r,style:l},c=rc(i,sc,nc,h,!0);return c&&(d.transform=c),a&&(d.blendMode=a),d},conicGradient:function(t,i){let{from:s,to:n,type:r,opacity:o,blendMode:a,stretch:h}=t;ac(s||"center",i,hc),ac(n||"bottom",i,lc);const l=e.conicGradientSupport?e.canvas.createConicGradient(0,hc.x,hc.y):e.canvas.createRadialGradient(hc.x,hc.y,0,hc.x,hc.y,oc(hc,lc));Zd(l,t.stops,o);const d={type:r,style:l},c=rc(i,hc,lc,h||1,e.conicGradientRotate90);return c&&(d.transform=c),a&&(d.blendMode=a),d},getTransform:rc},{copy:cc,toOffsetOutBounds:uc}=at,pc={},_c={};function gc(t,i,s,n){const{bounds:r,shapeBounds:o}=n;if(e.fullImageShadow){if(cc(pc,t.bounds),pc.x+=i.x-o.x,pc.y+=i.y-o.y,s){const{matrix:t}=n;pc.x-=(r.x+(t?t.e:0)+r.width/2)*(s-1),pc.y-=(r.y+(t?t.f:0)+r.height/2)*(s-1),pc.width*=s,pc.height*=s}t.copyWorld(n.canvas,t.bounds,pc)}else s&&(cc(pc,i),pc.x-=i.width/2*(s-1),pc.y-=i.height/2*(s-1),pc.width*=s,pc.height*=s),t.copyWorld(n.canvas,o,s?pc:i)}const{toOffsetOutBounds:fc}=at,yc={};const mc={shadow:function(t,e,i){let s,n;const{__nowWorld:r,__layout:o}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=a.length-1;uc(l,_c),a.forEach(((a,g)=>{p.setWorldShadow(_c.offsetX+a.x*c,_c.offsetY+a.y*u,a.blur*c,Ga.string(a.color)),n=a.spread?1+2*a.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,gc(p,_c,n,i),s=l,a.box&&(p.restore(),p.save(),h&&(p.copyWorld(p,l,r,"copy"),s=r),h?p.copyWorld(h,r,r,"destination-out"):p.copyWorld(i.canvas,d,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(p,s,r,a.blendMode):e.copyWorldToInner(p,s,o.renderBounds,a.blendMode),_&&g<_&&p.clearWorld(s,!0)})),p.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r,__layout:o}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=a.length-1;fc(l,yc),a.forEach(((a,g)=>{p.save(),p.setWorldShadow(yc.offsetX+a.x*c,yc.offsetY+a.y*u,a.blur*c),n=a.spread?1-2*a.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,gc(p,yc,n,i),p.restore(),h?(p.copyWorld(p,l,r,"copy"),p.copyWorld(h,r,r,"source-out"),s=r):(p.copyWorld(i.canvas,d,l,"source-out"),s=l),p.fillWorld(s,Ga.string(a.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(p,s,r,a.blendMode):e.copyWorldToInner(p,s,o.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:vc}=Ar;function wc(t,e,i,s,n,r){switch(e){case"grayscale":n.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,s){const n=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,n),s.recycle(n),bc(t,e,i,1)}(t,i,s,n);break;case"opacity-path":bc(t,i,s,r);break;case"path":i.restore()}}function xc(t){return t.getSameCanvas(!1,!0)}function bc(t,e,i,s){const n=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,n),i.recycle(n)}t.Group.prototype.__renderMask=function(t,e){let i,s,n,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++)i=h[l],a=i.__.mask,a&&(o&&(wc(this,o,t,n,s,r),s=n=null),"path"===a||"clipping-path"===a?(i.opacity<1?(o="opacity-path",r=i.opacity,n||(n=xc(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=xc(t)),n||(n=xc(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a)||vc(i,e)||i.__render(n||t,e);wc(this,o,t,n,s,r)};const Ec=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Bc=Ec+"_#~&*+\\=|≮≯≈≠=…",Pc=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 kc(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Rc=kc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Cc=kc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Tc=kc(Ec),Sc=kc(Bc),Lc=kc("- —/~|┆·");var Dc;!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"}(Dc||(Dc={}));const{Letter:Ac,Single:Oc,Before:Ic,After:Mc,Symbol:Fc,Break:Wc}=Dc;function Uc(t){return Rc[t]?Ac:Lc[t]?Wc:Cc[t]?Ic:Tc[t]?Mc:Sc[t]?Fc:Pc.test(t)?Oc:Ac}const Nc={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function zc(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:Yc}=Nc,{Letter:jc,Single:Hc,Before:Xc,After:Gc,Symbol:Vc,Break:qc}=Dc;let Kc,Zc,$c,Qc,Jc,tu,eu,iu,su,nu,ru,ou,au,hu,lu,du,cu,uu=[];function pu(t,e){su&&!iu&&(iu=su),Kc.data.push({char:t,width:e}),$c+=e}function _u(){Qc+=$c,Kc.width=$c,Zc.words.push(Kc),Kc={data:[]},$c=0}function gu(){hu&&(lu.paraNumber++,Zc.paraStart=!0,hu=!1),su&&(Zc.startCharSize=iu,Zc.endCharSize=su,iu=0),Zc.width=Qc,du.width?Yc(Zc):cu&&fu(),uu.push(Zc),Zc={words:[]},Qc=0}function fu(){Qc>(lu.maxWidth||0)&&(lu.maxWidth=Qc)}const{top:yu,right:mu,bottom:vu,left:wu}=t.Direction4;function xu(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const bu={getDrawData:function(t,i){"string"!=typeof t&&(t=String(t));let s=0,n=0,r=i.__getInput("width")||0,o=i.__getInput("height")||0;const{textDecoration:a,__font:h,__padding:l}=i;l&&(r?(s=l[wu],r-=l[mu]+l[wu]):i.autoSizeAlign||(s=l[wu]),o?(n=l[yu],o-=l[yu]+l[vu]):i.autoSizeAlign||(n=l[yu]));const d={bounds:{x:s,y:n,width:r,height:o},rows:[],paraNumber:0,font:e.canvas.font=h};return function(t,i,s){lu=t,uu=t.rows,du=t.bounds,cu=!du.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:r,textCase:o}=s,{canvas:a}=e,{width:h,height:l}=du;if(h||l||n||"none"!==o){const t="none"!==s.textWrap,e="break"===s.textWrap;hu=!0,ru=null,iu=eu=su=$c=Qc=0,Kc={data:[]},Zc={words:[]};for(let s=0,l=i.length;s<l;s++)tu=i[s],"\n"===tu?($c&&_u(),Zc.paraEnd=!0,gu(),hu=!0):(nu=Uc(tu),nu===jc&&"none"!==o&&(tu=zc(tu,o,!$c)),eu=a.measureText(tu).width,n&&(n<0&&(su=eu),eu+=n),ou=nu===Hc&&(ru===Hc||ru===jc)||ru===Hc&&nu!==Gc,au=!(nu!==Xc&&nu!==Hc||ru!==Vc&&ru!==Gc),Jc=hu&&r?h-r:h,t&&h&&Qc+$c+eu>Jc&&(e?($c&&_u(),Qc&&gu()):(au||(au=nu===jc&&ru==Gc),ou||au||nu===qc||nu===Xc||nu===Hc||$c+eu>Jc?($c&&_u(),Qc&&gu()):Qc&&gu()))," "===tu&&!0!==hu&&Qc+$c===0||(nu===qc?(" "===tu&&$c&&_u(),pu(tu,eu),_u()):ou||au?($c&&_u(),pu(tu,eu)):pu(tu,eu)),ru=nu);$c&&_u(),Qc&&gu(),uu.length>0&&(uu[uu.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{lu.paraNumber++,Qc=a.measureText(t).width,uu.push({x:r||0,text:t,width:Qc,paraStart:!0}),cu&&fu()}))}(d,t,i),l&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":xu(e,"x",t[wu]);break;case"right":xu(e,"x",-t[mu])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":xu(e,"y",t[yu]);break;case"bottom":xu(e,"y",-t[vu])}}(l,d,i,r,o),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:p,y:_,width:g,height:f}=s,y=r*n+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":_+=(f-y)/2;break;case"bottom":_+=f-y}m+=_;let v,w,x,b=g||u?g:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],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&&o>0&&(m+=c),v.y=m,m+=r,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+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:n,paraIndent:r,letterSpacing:o}=e;let a,h,l,d,c,u;s.forEach((t=>{t.words&&(l=r&&t.paraStart?r:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-l)/(u-1):0,d=o||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach(((e,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach((t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==n||i===u-1||(a+=h,t.width+=h)}))),t.words=null)}))}(d,i,r),d.overflow&&function(t,i,s,n){if(!n)return;const{rows:r,overflow:o}=t;let{textOverflow:a}=i;if(r.splice(o),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=s+n-l;("none"===i.textWrap?r:[r[o-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<d));s--){if(h<d&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(d,i,s,r),"none"!==a&&function(t,e){let i;const{fontSize:s,textDecoration:n}=e;switch(t.decorationHeight=s/11,"object"==typeof n?(i=n.type,n.color&&(t.decorationColor=Ga.string(n.color))):i=n,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(d,i),d}};const Eu={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!Ga.object)return t;t=Ga.object(t)}let s=void 0===t.a?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign(Xa,bu),Object.assign(Ga,Eu),Object.assign(Ka,ud),Object.assign(Za,Gd),Object.assign($a,dc),Object.assign(Qa,mc),Object.assign(i,{interaction:(t,e,i,s)=>new Jl(t,e,i,s),hitCanvas:(t,e)=>new wa(t,e),hitCanvasManager:()=>new Wl}),Ea();class Bu extends ah{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}function Pu(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i),this.waitLeafer((()=>e?eh.setStyleName(this,e,i):eh.set(this,i)))}})))}function ku(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}})))}function Ru(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 Cu(t,e){"object"!=typeof e&&(e=void 0),Lu(t,e,"in")}function Tu(t,e){const{normalStyle:i}=t;"object"!=typeof e&&(e=void 0),i&&(e||(e=i),Lu(t,e,"out"))}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;t instanceof Array?t.forEach((t=>this.__loadRobot(t,e,e+=t.total||1))):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),void 0!==t)if("number"==typeof t)this.now=t;else if("object"==typeof t){const e=t instanceof Array,i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=Bn.get(t);s.ready?this.__createFrames(s,t,e,i):s.load((()=>this.__createFrames(s,t,e,i)))}__createFrames(t,e,i,s){const{offset:n,size:r,total:o}=e,{width:a,height:h}=r&&("number"==typeof r?{width:r,height:r}:r)||(o>1?this:t);let l=n?n.x:0,d=n?n.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 Qr(Qr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),void 0!==n.loop&&(s=n.loop)),this.__timer=setTimeout((()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)}),1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},Xt([nr(Bu)],t.Robot.prototype,"__",void 0),Xt([Un()],t.Robot.prototype,"robot",void 0),Xt([On()],t.Robot.prototype,"actions",void 0),Xt([On("")],t.Robot.prototype,"action",void 0),Xt([qn(0)],t.Robot.prototype,"now",void 0),Xt([On(12)],t.Robot.prototype,"FPS",void 0),Xt([On(!0)],t.Robot.prototype,"loop",void 0),t.Robot=Xt([pr()],t.Robot),St.add("robot");const Su={};function Lu(t,e,i){const{normalStyle:s}=t;e||(e=Su),e.scale&&(h.assignScale(e,e.scale),delete e.scale),e!==Su&&eh.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&jt(i[s])&&jt(e[s])&&(s="transition");return jt(e[s])?i[s]:e[s]}(i,e,t);const r=n?function(t,e){const i=Ou(e,t),s=t.animate();s&&Ou(i,t,s.fromStyle);return i}(t,e):void 0;eh.canAnimate&&Du(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const o=Du(t);if(o){const{animation:s}=o;if(s){const r=t.animate(s,void 0,"animation",!0);Object.assign(o,r.endingStyle),"in"!==i||e.animation!==s?r.kill():n=!1,delete o.animation}t.normalStyle=Au(o,t),t.set(o,"temp")}else t.normalStyle=void 0;if(n){const e=Au(r,t);t.set(r,"temp"),t.animate([r,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function Du(t){let e;const i={},s=Ru(t),n=s?t.state||s.state:t.state,r=n&&t.states[n];r&&eh.isState(n,t,s)&&(e=Iu(i,r));const o=i.selectedStyle||t.selectedStyle;if(o&&eh.isSelected(t,s)&&(e=Iu(i,o)),eh.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Iu(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&eh.isFocus(t,s)&&(e=Iu(i,n));const r=i.hoverStyle||t.hoverStyle;r&&eh.isHover(t,s)&&(e=Iu(i,r));const o=i.pressStyle||t.pressStyle;o&&eh.isPress(t,s)&&(e=Iu(i,o))}return e?i:void 0}function Au(t,e,i,s){const n=i?t:{},r=i||t;for(let t in r)s&&eh.animateExcludes[t]||(n[t]=e[t]);return n}function Ou(t,e,i){return Au(t,e,i,!0)}function Iu(t,e){return Object.assign(t,e),!0}function Mu(t,e){const i=t[e];i&&Cu(t,i),t.button&&Wu(t.children,e)}function Fu(t,e,i){i||(i=t.states[e]),Cu(t,i),t.button&&Wu(t.children,null,e)}function Wu(t,e,i){if(!t)return;let s,n;for(let r=0,o=t.length;r<o;r++){if(s=t[r],e){switch(n=!0,e){case"hoverStyle":eh.isHover(s)&&(n=!1);break;case"pressStyle":eh.isPress(s)&&(n=!1);break;case"focusStyle":eh.isFocus(s)&&(n=!1)}n&&Mu(s,e)}else void 0!==i&&Fu(s,i);s.isBranch&&Wu(s.children,e,i)}}function Uu(t,e){const i=t[e];i&&Tu(t,i),t.button&&zu(t.children,e)}function Nu(t,e,i){Tu(t,i),t.button&&zu(t.children,null,e)}function zu(t,e,i){if(!t)return;let s;for(let n=0,r=t.length;n<r;n++)s=t[n],e?Uu(s,e):void 0!==i&&Nu(s,i),s.isBranch&&zu(s.children,e,i)}function Yu(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const r=Ru(e,i);r&&(s=n[t](r))}return s}function ju(t,e,i){let s=e[t];if(!s&&i){const n=Ru(e,i);n&&(s=n[t])}return s}St.add("state"),eh.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1},eh.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=Ru(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},eh.isSelected=function(t,e){return ju("selected",t,e)},eh.isDisabled=function(t,e){return ju("disabled",t,e)},eh.isFocus=function(t,e){return Yu("isFocus",t,e)},eh.isHover=function(t,e){return Yu("isHover",t,e)},eh.isPress=function(t,e){return Yu("isPress",t,e)},eh.isDrag=function(t,e){return Yu("isDrag",t,e)},eh.setStyleName=function(t,e,i){i?Fu(t,e,t[e]):Nu(t,e,t[e])},eh.set=function(t,e){const i=t.states[e];i?Fu(t,e,i):Nu(t,e,i)},eh.getStyle=Du,eh.updateStyle=Lu,eh.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:Mu(e,"hoverStyle");break;case t.PointerEvent.LEAVE:Uu(e,"hoverStyle");break;case t.PointerEvent.DOWN:Mu(e,"pressStyle");break;case t.PointerEvent.UP:Uu(e,"pressStyle")}};const Hu=t.UI.prototype;t.UI.addAttr("selected",!1,Pu,"selectedStyle"),t.UI.addAttr("disabled",!1,Pu,"disabledStyle"),t.UI.addAttr("states",{},ku),t.UI.addAttr("state","",Pu),t.UI.addAttr("normalStyle",void 0,On),t.UI.addAttr("hoverStyle",void 0,ku),t.UI.addAttr("pressStyle",void 0,ku),t.UI.addAttr("focusStyle",void 0,ku),t.UI.addAttr("selectedStyle",void 0,ku),t.UI.addAttr("disabledStyle",void 0,ku),t.UI.addAttr("button",!1,On),Hu.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?Mu(this,"focusStyle"):Uu(this,"focusStyle")}))},Hu.updateState=function(){eh.updateStyle(this,void 0,"in")};const{cos:Xu,sin:Gu,pow:Vu,sqrt:qu,abs:Ku,ceil:Zu,floor:$u,round:Qu,PI:Ju}=Math,tp=5*Ju,ep=1.70158,ip=2.5949095,sp=7.5625,np=2.75;function rp(t){return e=>Vu(e,t)}function op(t){return e=>1-Vu(1-e,t)}function ap(t){return e=>e<.5?.5*Vu(2*e,t):1-.5*Vu(2-2*e,t)}function hp(t){return t<1/np?sp*t*t:t<2/np?sp*(t-=1.5/np)*t+.75:t<2.5/np?sp*(t-=2.25/np)*t+.9375:sp*(t-=2.625/np)*t+.984375}function lp(t,e,i,s){const n={};return r=>{const o=~~(1e4*r),a=n[o];if(a)return a;let h,l,d,c=r;for(let e=0;e<8&&(h=1-c,d=dp(c,t,i)-r,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Ku(l)<1e-6));e++)c-=d/l;return n[o]=dp(c,e,s)}}function dp(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const cp={get(t){const{list:e}=cp;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){cp.list[t]=e},list:{linear:t=>t,ease:lp(.25,.1,.25,1),"ease-in":lp(.42,0,1,1),"ease-out":lp(0,0,.58,1),"ease-in-out":lp(.42,0,.58,1),"sine-in":t=>1-Xu(t*Ju*.5),"sine-out":t=>Gu(t*Ju*.5),"sine-in-out":t=>.5*(1-Xu(t*Ju)),"quad-in":rp(2),"quad-out":op(2),"quad-in-out":ap(2),"cubic-in":rp(3),"cubic-out":op(3),"cubic-in-out":ap(3),"quart-in":rp(4),"quart-out":op(4),"quart-in-out":ap(4),"quint-in":rp(5),"quint-out":op(5),"quint-in-out":ap(5),"expo-in":t=>t?Vu(2,10*t-10):0,"expo-out":t=>1===t?1:1-Vu(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Vu(2,2*t*10-10):.5*(2-Vu(2,10-2*t*10)),"circ-in":t=>1-qu(1-Vu(t,2)),"circ-out":t=>qu(1-Vu(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-qu(1-Vu(2*t,2))):.5*(qu(1-Vu(2-2*t,2))+1),"back-in":t=>((ep+1)*t-ep)*t*t,"back-out":t=>(t-=1)*t*((ep+1)*t+ep)+1,"back-in-out":t=>t<.5?(t*=2)*t*((ip+1)*t-ip)*.5:.5*((t=2*t-2)*t*((ip+1)*t+ip)+2),"elastic-in":t=>0===t||1===t?t:-Vu(2,10*(t-1))*Gu((t-1.1)*tp),"elastic-out":t=>0===t||1===t?t:Vu(2,-10*t)*Gu((t-.1)*tp)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Vu(2,10*((t*=2)-1))*Gu((t-1.1)*tp)*.5:Vu(2,10*(1-(t*=2)))*Gu((t-1.1)*tp)*.5+1,"bounce-in":t=>1-hp(1-t),"bounce-out":hp,"bounce-in-out":t=>t<.5?.5*(1-hp(1-2*t)):.5*(1+hp(2*t-1)),"cubic-bezier":lp,steps:function(t,e="floor"){return i=>("floor"===e?$u(i*t):"ceil"===e?Zu(i*t):Qu(i*t))/t}}};function up(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 pp{}pp.CREATED="created",pp.PLAY="play",pp.PAUSE="pause",pp.STOP="stop",pp.SEEK="seek",pp.UPDATE="update",pp.COMPLETED="completed";t.Animate=class extends ro{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&"number"==typeof n&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=e instanceof Array?e:e?[e]:[];const{easing:n,attrs:r}=this;this.easingFn=cp.get(n),(r||this.attrsMap)&&(this.attrsMap=r?r.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(pp.PLAY,this))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emit(pp.PAUSE,this))}stop(){this.destroyed||(this.complete(),this.emit(pp.STOP,this))}seek(t){this.destroyed||("object"==typeof t&&(t=Va.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(pp.SEEK,this))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,r=!(n>1)||this.join;let o,a,h,l,d,c=0,u=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(a=i[s],l=a.style||a,o||(o=r?t:l),h={style:l,beforeStyle:{}},d=1,a.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:r,loop:o}=a;r&&(h.swing="number"==typeof r?r:2,d=2*h.swing-1),o&&(h.loop=d="number"==typeof o?o: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),n&&(h.easingFn=cp.get(n))}if(h.autoDuration||void 0!==h.duration||(n>1?s>0||r?u+=d:h.duration=0:h.duration=this.duration),n>1)this.setBefore(h,l,o);else{for(let e in l)h.beforeStyle[e]=t[e];this.fromStyle=h.beforeStyle,this.toStyle=h.style}o=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(pp.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:n,target:r}=this;for(let o in e)void 0===s[o]&&(s[o]=n[o]=e===i?i[o]:r[o]),t.beforeStyle[o]=void 0===i[o]?n[o]:i[o],n[o]=e[o]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],void 0===e.duration&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),e.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout((()=>{this.timer=0,this.begin()}),e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout((()=>{this.timer=0,this.begin()}),t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emit(pp.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,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:r}=this;let{betweenStyle:o}=this.frame;o||(o=this.frame.betweenStyle={}),ih.setBetweenStyle(o,s,n,e,t,r,i),this.setStyle(o)}this.emit(pp.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)}},Xt([up("ease")],t.Animate.prototype,"easing",void 0),Xt([up(0)],t.Animate.prototype,"delay",void 0),Xt([up(.2)],t.Animate.prototype,"duration",void 0),Xt([up("auto")],t.Animate.prototype,"ending",void 0),Xt([up(!1)],t.Animate.prototype,"reverse",void 0),Xt([up(!1)],t.Animate.prototype,"swing",void 0),Xt([up(!1)],t.Animate.prototype,"loop",void 0),Xt([up(0)],t.Animate.prototype,"loopDelay",void 0),Xt([up(1)],t.Animate.prototype,"speed",void 0),Xt([up(!0)],t.Animate.prototype,"autoplay",void 0),Xt([up()],t.Animate.prototype,"join",void 0),Xt([up()],t.Animate.prototype,"attrs",void 0),t.Animate=Xt([ur(yo)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every((t=>t.completed))}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter((t=>{const{completed:e}=t;return e&&t.destroy(),!e}))),this.list=e.map((e=>{const s=e.target?e:new t.Animate(this.target,e,i);return Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s}))}play(){this.each((t=>t.play()))}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)}},t.AnimateList=Xt([ur(yo)],t.AnimateList);const _p={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"},gp=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,fp=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,yp=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,mp=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,vp=parseInt,wp=parseFloat,{round:xp}=Math;let bp={},Ep=0;function Bp(t){let e,i,s,n=1;switch(t.length){case 9:e=vp(t.slice(1,3),16),i=vp(t.slice(3,5),16),s=vp(t.slice(5,7),16),n=vp(t.slice(7,9),16)/255;break;case 7:e=vp(t.slice(1,3),16),i=vp(t.slice(3,5),16),s=vp(t.slice(5,7),16);break;case 5:e=vp(t[1]+t[1],16),i=vp(t[2]+t[2],16),s=vp(t[3]+t[3],16),n=vp(t[4]+t[4],16)/255;break;case 4:e=vp(t[1]+t[1],16),i=vp(t[2]+t[2],16),s=vp(t[3]+t[3],16);break;case 3:e=i=s=vp(t[1]+t[2],16);break;case 2:e=i=s=vp(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const Pp=1/6,kp=.5,Rp=2/3,Cp=1/3;function Tp(t,e,i){return i<0?i++:i>1&&i--,i<Pp?t+6*(e-t)*i:i<kp?e:i<Rp?t+(e-t)*(Rp-i)*6:t}function Sp(t,e,i,s=1){let n,r,o;if(t/=360,i/=100,0===(e/=100))n=r=o=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=Tp(a,s,t+Cp),r=Tp(a,s,t),o=Tp(a,s,t-Cp)}return{r:xp(255*n),g:xp(255*r),b:xp(255*o),a:s}}St.add("color"),Ga.object=function(t,e){let i,s=void 0!==e&&1!==e;if("string"==typeof t){const e=bp[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Bp(t);break;case"R":case"r":"("===t[4]&&fp.test(t)?i=function(t){const e=fp.exec(t);return{r:vp(e[1]),g:vp(e[2]),b:vp(e[3]),a:wp(e[4])}}(t):"("===t[3]&&gp.test(t)&&(i=function(t){const e=gp.exec(t);return{r:vp(e[1]),g:vp(e[2]),b:vp(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&mp.test(t)?i=function(t){const e=mp.exec(t);return Sp(wp(e[1]),wp(e[2]),wp(e[3]),wp(e[4]))}(t):"("===t[3]&&yp.test(t)&&(i=function(t){const e=yp.exec(t);return Sp(wp(e[1]),wp(e[2]),wp(e[3]),1)}(t))}if(!i){const e=_p[t.toLowerCase()];e&&(i=Bp("#"+e))}i&&(Ep++,Ep>1e4&&(bp={},Ep=0),bp[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:Lp}=Math,{fourNumber:Dp}=h,Ap={fill:Wp,stroke:Wp,cornerRadius:(t,e,i)=>"number"==typeof t&&"number"==typeof e?Mp(t,e,i):(t=Dp(t),e=Dp(e),t.map(((t,s)=>Mp(t,e[s],i)))),text(t,e,i){if("string"==typeof t&&"string"==typeof e){const s=t.length,n=e.length,r=Mp(s,n,i,1);return s<n?e.substring(0,r):t.substring(0,r)}return"number"==typeof t||"number"==typeof e?h.float(Mp(t,e,i),Math.max(Ip(t),Ip(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return ih.setBetweenStyle(n,t,e,n,i,s),n},shadow:Up,innerShadow:Up},Op={value:function(t,e,i){const s="number"==typeof t,n="number"==typeof e;return s&&n?t+(e-t)*i:n||s?Mp(t,e,i):t},number:Mp,color:Fp,setBetweenStyle:function(t,e,i,s,n,r,o){let a,h,l;const{list:d,value:c}=ih;for(let u in s)o&&!o[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,r)))}};function Ip(t){const e=String(t).split(".")[1];return e?e.length:0}function Mp(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?Lp(n):n}function Fp(t,e,i){t=Ga.object(t),e=Ga.object(e);const s=Mp(t.r,e.r,i,1)+","+Mp(t.g,e.g,i,1)+","+Mp(t.b,e.b,i,1),n=Mp(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function Wp(t,e,i){return"string"==typeof t&&"string"==typeof e?Fp(t,e,i):e}function Up(t,e,i){return t instanceof Array||e instanceof Array?e:(e=e||{},{x:Mp((t=t||{}).x,e.x,i),y:Mp(t.y,e.y,i),blur:Mp(t.blur,e.blur,i),spread:Mp(t.spread,e.spread,i),color:Fp(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}St.add("animate","color"),eh.canAnimate=!0,Object.assign(ih.list,Ap),Object.assign(ih,Op);const Np=t.UI.prototype;t.UI.addAttr("animation",void 0,(function(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}})))})),t.UI.addAttr("animationOut",void 0,On),t.UI.addAttr("transition",!0,On),t.UI.addAttr("transitionOut",void 0,On),Np.animate=function(e,i,s,n){if(void 0===e)return this.__animate;let r=e instanceof Array&&!i&&s?new t.AnimateList(this,e,n):new t.Animate(this,e,i,n);this.killAnimate(s,r.toStyle);const o=this.__animate;return o&&(r instanceof t.AnimateList?r.list.unshift(o):r=new t.AnimateList(this,[o,r])),this.__animate=r},Np.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},Np.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(pp.COMPLETED,e)};const zp=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Yp=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:jp}=Math,Hp={getDistance(t,e,i,s,n,r,o,a,h=1){let l,d,c,u,p,_,g=0,f=h/2;for(let h=0;h<zp.length;h++)l=f*(1+zp[h]),d=f*(1-zp[h]),c=Xp(l,t,i,n,o),u=Xp(l,e,s,r,a),p=Xp(d,t,i,n,o),_=Xp(d,e,s,r,a),g+=Yp[h]*(jp(c*c+u*u)+jp(p*p+_*_));return g*f},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)},getRotation(t,e,i,s,n,r,o,a,h){const l=Xp(t,e,s,r,a),c=Xp(t,i,n,o,h);return Math.atan2(c,l)/d},getT(t,e,i,s,n,r,o,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>_;)Gp(i,s,n,r,o,a,h,l,p)<t?c=p:u=p,p=(c+u)/2;return p},cut(t,e,i,s,n,r,o,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*r,p=d*n+e*o,_=d*r+e*a,g=d*c+e*p,f=d*u+e*_,y=d*g+e*(d*p+e*(d*o+e*h)),m=d*f+e*(d*_+e*(d*a+e*l));t.push(oe.C,c,u,g,f,y,m)}},{getDerivative:Xp,getDistance:Gp}=Hp,{M:Vp,L:qp,C:Kp,Z:Zp}=oe,$p={},Qp={},Jp={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Vp:case qp:Jp.transformPoints(t,e,s,1),s+=3;break;case Kp:Jp.transformPoints(t,e,s,3),s+=7;break;case Zp:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,r=n+2*s;n<r;n+=2)$p.x=t[n],$p.y=t[n+1],E.toOuterPoint(e,$p),t[n]=$p.x,t[n+1]=$p.y},getMotionPathData(t){let e,i,s,n,r=0,o=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case Vp:case qp:i=t[a+1],s=t[a+2],e=n===qp&&a>0?I.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Kp:i=t[a+5],s=t[a+6],e=Hp.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 Zp:a+=1;default:e=0}o.push(e),r+=e}return{total:r,segments:o,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=Va.number(e,t.total);let r,o,a,h,l,d,c,u,p,_=0,g={},f=0,y=0,m=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case Vp:case qp:if(o=n[f+1],a=n[f+2],r=s[y],_+r>=e||!t.total)return f||(m=o,v=a),Qp.x=m,Qp.y=v,g.x=o,g.y=a,I.getDistancePoint(Qp,g,e-_,!0),g.rotation=I.getAngle(Qp,g),g;m=o,v=a,f+=3;break;case Kp:if(o=n[f+5],a=n[f+6],r=s[y],_+r>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],p=Hp.getT(e-_,r,m,v,l,d,c,u,o,a,i),De.getPointAndSet(p,m,v,l,d,c,u,o,a,g),g.rotation=Hp.getRotation(p,m,v,l,d,c,u,o,a),g;m=o,v=a,f+=7;break;case Zp:f+=1;default:r=0}y++,_+=r}return g},getDistancePath(t,e,i){const{segments:s,data:n}=t,r=[];e=Va.number(e,t.total);let o,a,h,l,d,c,u,p,_,g=0,f={},y=0,m=0,v=0,w=0;const x=n.length;for(;y<x;){switch(l=n[y],l){case Vp:case qp:if(a=n[y+1],h=n[y+2],o=s[m],g+o>=e||!t.total)return y||(v=a,w=h),Qp.x=v,Qp.y=w,f.x=a,f.y=h,I.getDistancePoint(Qp,f,e-g,!0),r.push(l,f.x,f.y),r;v=a,w=h,y+=3,r.push(l,v,w);break;case Kp:if(d=n[y+1],c=n[y+2],u=n[y+3],p=n[y+4],a=n[y+5],h=n[y+6],o=s[m],g+o>=e)return _=Hp.getT(e-g,o,v,w,d,c,u,p,a,h,i),Hp.cut(r,_,v,w,d,c,u,p,a,h),r;v=a,w=h,y+=7,r.push(l,d,c,u,p,a,h);break;case Zp:y+=1,r.push(l);default:o=0}m++,g+=o}return r}};function t_(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!jt(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}St.add("motion-path"),ih.register("motion",(function(t,e,i,s){return t?"object"==typeof t&&(t=Va.number(t,s.getMotionTotal())):t=0,e?"object"==typeof e&&(e=Va.number(e,s.getMotionTotal())):e=0,ih.number(t,e,i)})),ih.register("motionRotation",(function(t,e,i){return ih.number(t,e,i)}));const e_=t.UI.prototype,{updateMatrix:i_,updateAllMatrix:s_}=kr,{updateBounds:n_}=Ir;function r_(t){const{motion:e,leaferIsCreated:i}=t;if(!jt(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=a_(t);i.total&&(t.__.__pathForRender=Jp.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(s_(t),n_(t,t)):i_(t));i&&(t.leafer.created=!0)}}function o_(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 a_(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Jp.getMotionPathData(t.getPath(!0,!0))}t.UI.addAttr("motionPath",void 0,t_),t.UI.addAttr("motionPrecision",1,t_),t.UI.addAttr("motion",void 0,t_),t.UI.addAttr("motionRotation",!0,t_),e_.getMotionPathData=function(){return a_(o_(this))},e_.getMotionPoint=function(t){const e=o_(this),i=a_(e);if(!i.total)return{};const s=Jp.getDistancePoint(i,t,e.motionPrecision);E.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:"number"==typeof n&&(s.rotation+=n),s},e_.getMotionTotal=function(){return this.getMotionPathData().total},e_.__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],jt(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),r_(t))}else r_(this)};const{Yes:h_,NoAndSkip:l_,YesAndSkip:d_}=t.Answer,c_={},u_={},p_={};class __{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":c_.id=t.substring(1),t=c_;break;case".":u_.className=t.substring(1),t=u_;break;default:p_.tag=t,t=p_}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,n=s instanceof Array;return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?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&&kr.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),r===h_||r===d_){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<l_&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Zr.REMOVE,this.__onRemoveChild,this),this.target.on_($r.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const g_=t.UI.prototype;function f_(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=i.selector())}return g_.find=function(t,e){return f_(this).getBy(t,this,!1,e)},g_.findOne=function(t,e){return f_(this).getBy(t,this,!0,e)},St.add("find"),i.finder=function(t){return new __(t)},t.AlignHelper=wt,t.AnimateEasing=cp,t.AnimateEvent=pp,t.AroundHelper=yt,t.AutoBounds=pt,t.BezierHelper=De,t.Bounds=ct,t.BoundsHelper=at,t.BoxData=dh,t.BranchHelper=Ir,t.BranchRender=Wo,t.CanvasData=Eh,t.CanvasManager=Ft,t.ChildEvent=Zr,t.ColorConvert=Ga,t.Creator=i,t.Cursor=Fl,t.DataHelper=Wt,t.Debug=Et,t.Dragger=kl,t.Effect=Qa,t.EllipseData=gh,t.EllipseHelper=ze,t.Event=Kr,t.EventCreator=It,t.Eventer=ro,t.Export=th,t.FileHelper=fn,t.Filter=Ja,t.Finder=__,t.FrameData=uh,t.GroupData=lh,t.HighBezierHelper=Hp,t.HighCurveHelper=Jp,t.HitCanvasManager=Wl,t.ImageData=bh,t.ImageEvent=Qr,t.ImageManager=Bn,t.IncrementId=s,t.Interaction=Jl,t.InteractionBase=Ml,t.InteractionHelper=wl,t.Keyboard=_l,t.LayoutEvent=eo,t.Layouter=Ma,t.LeafBounds=Io,t.LeafBoundsHelper=Ar,t.LeafData=Nt,t.LeafDataProxy=wo,t.LeafEventer=yo,t.LeafHelper=kr,t.LeafLayout=qr,t.LeafLevelList=ma,t.LeafList=ya,t.LeafMatrix=Ro,t.LeafRender=Mo,t.LeaferCanvas=wa,t.LeaferCanvasBase=se,t.LeaferData=ch,t.LeaferEvent=so,t.LeaferImage=Cn,t.LineData=ph,t.MathHelper=h,t.Matrix=Y,t.MatrixHelper=E,t.MyDragEvent=vl,t.MyImage=hl,t.MyPointerEvent=yl,t.NeedConvertToCanvasCommandMap=he,t.OneRadian=d,t.PI2=c,t.PI_2=u,t.Paint=Ka,t.PaintGradient=$a,t.PaintImage=Za,t.PathArrow=qa,t.PathBounds=rn,t.PathCommandDataHelper=qi,t.PathCommandMap=oe,t.PathConvert=Pi,t.PathCorner=un,t.PathCreator=cs,t.PathData=mh,t.PathDrawer=ks,t.PathHelper=ne,t.PathNumberCommandLengthMap=ue,t.PathNumberCommandMap=ce,t.PenData=vh,t.Picker=Na,t.Platform=e,t.Plugin=St,t.Point=N,t.PointHelper=I,t.PointerButton=gl,t.PolygonData=fh,t.PropertyEvent=$r,t.RectData=_h,t.RectHelper=pe,t.RectRender=Rh,t.RenderEvent=io,t.Renderer=Wa,t.ResizeEvent=Jr,t.Resource=bn,t.RobotData=Bu,t.Run=Rt,t.Selector=za,t.StarData=yh,t.State=eh,t.StringNumberMap=xt,t.TaskItem=vn,t.TaskProcessor=wn,t.TextConvert=Xa,t.TextData=xh,t.Transition=ih,t.TwoPointBoundsHelper=H,t.UIBounds=Bh,t.UICreator=Dt,t.UIData=ah,t.UIEvent=fl,t.UIRender=Ph,t.UnitConvert=Va,t.WaitHelper=Ur,t.WatchEvent=to,t.Watcher=Pa,t.affectRenderBoundsType=Vn,t.affectStrokeBoundsType=Hn,t.attr=Dn,t.autoLayoutType=Mn,t.boundsType=Un,t.canvasPatch=gn,t.canvasSizeAttrs=ie,t.cursorType=sr,t.dataProcessor=nr,t.dataType=On,t.decorateLeafAttr=Ln,t.defineDataProcessor=rr,t.defineKey=Tn,t.defineLeafAttr=An,t.doBoundsType=zn,t.doStrokeType=Xn,t.effectType=Ya,t.emptyData=Yt,t.eraserType=er,t.getBoundsData=_,t.getDescriptor=Sn,t.getMatrixData=g,t.getPointData=p,t.hitType=ir,t.isEmptyData=Ht,t.isNull=jt,t.layoutProcessor=function(t){return(e,i)=>{Tn(e,"__LayoutProcessor",{get:()=>t})}},t.maskType=tr,t.motionPathType=t_,t.naturalBoundsType=Nn,t.opacityType=Kn,t.pathInputType=Yn,t.pathType=jn,t.pen=pn,t.positionType=In,t.registerUI=pr,t.registerUIEvent=_r,t.resizeType=ja,t.rewrite=lr,t.rewriteAble=dr,t.rotationType=Wn,t.scaleType=Fn,t.sortType=Jn,t.stateStyleType=ku,t.stateType=Pu,t.strokeType=Gn,t.surfaceType=qn,t.tempBounds=ut,t.tempMatrix=j,t.tempPoint=z,t.useCanvas=Ea,t.useModule=ur,t.version="1.6.1",t.visibleType=Zn,t.zoomLayerType=Ha,t}({});
1
+ var LeaferUI=function(t){"use strict";const e={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(t){const{prefix:i,suffix:s}=e.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),i&&"/"===t[0]&&(t=i+t),t}}},i={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=n;return e[t]?e[t]++:(e[t]=1,0)}},n=s,{round:r,pow:o,PI:a}=Math,h={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)),h.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=r(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,n=("number"==typeof e?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&h.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:l,randColor:t=>`rgba(${l(255)},${l(255)},${l(255)},${t||1})`};function l(t){return Math.round(Math.random()*t)}const d=a/180,c=2*a,u=a/2;function p(){return{x:0,y:0}}function _(){return{x:0,y:0,width:0,height:0}}function g(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:f,cos:y,acos:m,sqrt:v}=Math,{float:w}=h,x={};function b(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const E={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:b(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:g,getWorld:b,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,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,x),B.scaleOfInner(t,x,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:n,d:r}=t,o=y(e*=d),a=f(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){B.toInnerPoint(t,e,x),B.rotateOfInner(t,x,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:n,c:r,d:o}=t;i&&(i*=d,t.a=s+r*i,t.b=n+o*i),e&&(e*=d,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){B.toInnerPoint(t,e,x),B.skewOfInner(t,x,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:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+a},multiplyParent(t,e,i,s,n,r){let{e:o,f:a}=t;if(r&&(o+=r.scrollX,a+=r.scrollY),i||(i=t),void 0===s&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*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:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*h}},setLayout(t,e,i,s,n){const{x:r,y:o,scaleX:a,scaleY:h}=e;if(void 0===n&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,r=i*d,o=y(r),l=f(r);if(s||n){const e=s*d,i=n*d;t.a=(o+i*-l)*a,t.b=(l+i*o)*a,t.c=(e*o-l)*h,t.d=(o+e*l)*h}else t.a=o*a,t.b=l*a,t.c=-l*h,t.d=o*h}else t.a=a,t.b=0,t.c=0,t.d=h;t.e=r,t.f=o,(i=i||s)&&B.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let c,p,_,g,x,b=h,E=l;if(r||o){const t=n*a-r*o;if(o&&!s){c=v(n*n+r*r),p=t/c;const e=n/c;_=r>0?m(e):-m(e)}else{p=v(o*o+a*a),c=t/p;const e=o/p;_=u-(a>0?m(-e):-m(e))}const e=w(y(_)),i=f(_);c=w(c),p=w(p),g=e?w((o/p+i)/e/d,9):0,x=e?w((r/c-i)/e/d,9):0,_=w(_/d)}else c=n,p=a,_=g=x=0;return(e=i||e)&&(b+=e.x*n+e.y*o,E+=e.x*r+e.y*a,i||(b-=e.x,E-=e.y)),{x:b,y:E,scaleX:c,scaleY:p,rotation:_,skewX:g,skewY:x}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=v(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){B.set(t)}},B=E,{toInnerPoint:P,toOuterPoint:k}=E,{sin:C,cos:R,abs:T,sqrt:S,atan2:L,min:D,round:A,PI:O}=Math,I={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=void 0===i?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?A(t.x-.5)+.5:A(t.x),t.y=e?A(t.y-.5)+.5:A(t.y)},move(t,e,i){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=M.defaultPoint);const s=R(e*=d),n=C(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=M;return W(i,t),P(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=M;return W(i,t),k(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=M;return W(i,t),M.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),P(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){P(e,t,i)},toOuterOf(t,e,i){k(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 n=T(i-t),r=T(s-e);return S(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>D(F(t,e,i,s),F(i,s,n,r)),getAngle:(t,e)=>U(t,e)/d,getRotation:(t,e,i,s)=>(s||(s=e),M.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/d),getRadianFrom(t,e,i,s,n,r,o,a){void 0===o&&(o=i,a=s);let h=L(e-s,t-i);const l=L(r-a,n-o)-h;return l<-O?l+c:l},getAtan2:(t,e)=>L(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=U(t,e);return(e=s?e:{}).x=t.x+R(n)*i,e.y=t.y+C(n)*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){M.reset(t)}},M=I,{getDistanceFrom:F,copy:W,getAtan2:U}=M;class N{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?I.copy(this,t):I.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new N(this)}move(t,e){return I.move(this,t,e),this}scale(t,e){return I.scale(this,t,e),this}scaleOf(t,e,i){return I.scaleOf(this,t,e,i),this}rotate(t,e){return I.rotate(this,t,e),this}rotateOf(t,e){return I.rotate(this,e,t),this}getRotation(t,e,i){return I.getRotation(this,t,e,i)}toInnerOf(t,e){return I.toInnerOf(this,t,e),this}toOuterOf(t,e){return I.toOuterOf(this,t,e),this}getCenter(t){return new N(I.getCenter(this,t))}getDistance(t){return I.getDistance(this,t)}getDistancePoint(t,e,i){return new N(I.getDistancePoint(this,t,e,i))}getAngle(t){return I.getAngle(this,t)}getAtan2(t){return I.getAtan2(this,t)}reset(){return I.reset(this),this}}const z=new N;class j{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return"object"==typeof t?E.copy(this,t):E.set(this,t,e,i,s,n,r),this}setWith(t){return E.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new j(this)}translate(t,e){return E.translate(this,t,e),this}translateInner(t,e){return E.translateInner(this,t,e),this}scale(t,e){return E.scale(this,t,e),this}scaleWith(t,e){return E.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return E.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return E.scaleOfInner(this,t,e,i),this}rotate(t){return E.rotate(this,t),this}rotateOfOuter(t,e){return E.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return E.rotateOfInner(this,t,e),this}skew(t,e){return E.skew(this,t,e),this}skewOfOuter(t,e,i){return E.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return E.skewOfInner(this,t,e,i),this}multiply(t){return E.multiply(this,t),this}multiplyParent(t){return E.multiplyParent(this,t),this}divide(t){return E.divide(this,t),this}divideParent(t){return E.divideParent(this,t),this}invert(){return E.invert(this),this}invertWith(){return E.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){E.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){E.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return E.setLayout(this,t,e,i),this}getLayout(t,e,i){return E.getLayout(this,t,e,i)}withScale(t,e){return E.withScale(this,t,e)}reset(){E.reset(this)}}const Y=new j,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,n){X(t,e,i),X(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:X}=H,{tempPointBounds:G,setPoint:V,addPoint:q,toBounds:K}=H,{toOuterPoint:Z}=E,{float:$,fourNumber:Q}=h,{floor:J,ceil:tt}=Math;let et,it,st,nt;const rt={},ot={},at={tempBounds:{},set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(i instanceof Array){const e=Q(i);s?ht.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):ht.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),ht.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,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),ht.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?dt(e,t):e=t,i?(e.offsetX=-(ht.maxX(i)-t.x),e.offsetY=-(ht.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),ht.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e){I.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){I.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(ht.copy(ht.tempBounds,t),ht.toOuterOf(ht.tempBounds,e),ht.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),ht.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n}=e;s>0?(i.width=t.width*s,i.x=e.e+t.x*s):(i.width=t.width*-s,i.x=e.e+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=e.f+t.y*n):(i.height=t.height*-n,i.y=e.f+t.y*n-i.height)}else rt.x=t.x,rt.y=t.y,Z(e,rt,ot),V(G,ot.x,ot.y),rt.x=t.x+t.width,Z(e,rt,ot),q(G,ot.x,ot.y),rt.y=t.y+t.height,Z(e,rt,ot),q(G,ot.x,ot.y),rt.x=t.x,Z(e,rt,ot),q(G,ot.x,ot.y),K(G,i)},toInnerOf(t,e,i){i||(i=t),ht.move(i,-e.e,-e.f),ht.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 j(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e,i){const s={};return ht.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){ht.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){ht.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=J(t.x),t.y=J(t.y),t.width=e>t.x?tt(t.width+e-t.x):tt(t.width),t.height=i>t.y?tt(t.height+i-t.y):tt(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=$(t.x,e),t.y=$(t.y,e),t.width=$(t.width,e),t.height=$(t.height,e)},add(t,e,i){et=t.x+t.width,it=t.y+t.height,st=e.x,nt=e.y,i||(st+=e.width,nt+=e.height),et=et>st?et:st,it=it>nt?it:nt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=et-t.x,t.height=it-t.y},addList(t,e){ht.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){ht.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){ht.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o]):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||dt(t,n)):lt(t,n));r&&ht.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?V(G,t.x,t.y):q(G,t.x,t.y))),K(G,t)},setPoint(t,e){ht.set(t,e.x,e.y)},addPoint(t,e){lt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=I.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=I.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=ht.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=ht.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=ht.tempToOuterOf(e,i)),!ht.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return et=s+r,it=n+o,st=t.x+t.width,nt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,et=et<st?et:st,it=it<nt?it:nt,r=et-s,o=it-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){ht.copy(t,ht.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){ht.set(t)}},ht=at,{add:lt,copy:dt}=ht;class ct{get minX(){return at.minX(this)}get minY(){return at.minY(this)}get maxX(){return at.maxX(this)}get maxY(){return at.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return"object"==typeof t?at.copy(this,t):at.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 ct(this)}move(t,e){return at.move(this,t,e),this}scale(t,e){return at.scale(this,t,e),this}scaleOf(t,e,i){return at.scaleOf(this,t,e,i),this}toOuterOf(t,e){return at.toOuterOf(this,t,e),this}toInnerOf(t,e){return at.toInnerOf(this,t,e),this}getFitMatrix(t,e){return at.getFitMatrix(this,t,e)}spread(t,e){return at.spread(this,t,e),this}shrink(t,e){return at.shrink(this,t,e),this}ceil(){return at.ceil(this),this}unsign(){return at.unsign(this),this}float(t){return at.float(this,t),this}add(t){return at.add(this,t),this}addList(t){return at.setList(this,t,!0),this}setList(t){return at.setList(this,t),this}addListWithFn(t,e){return at.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return at.setListWithFn(this,t,e),this}setPoint(t){return at.setPoint(this,t),this}setPoints(t){return at.setPoints(this,t),this}addPoint(t){return at.addPoint(this,t),this}getPoints(){return at.getPoints(this)}hitPoint(t,e){return at.hitPoint(this,t,e)}hitRadiusPoint(t,e){return at.hitRadiusPoint(this,t,e)}hit(t,e){return at.hit(this,t,e)}includes(t,e){return at.includes(this,t,e)}intersect(t,e){return at.intersect(this,t,e),this}getIntersect(t,e){return new ct(at.getIntersectData(this,t,e))}isSame(t){return at.isSame(this,t)}isEmpty(){return at.isEmpty(this)}reset(){at.reset(this)}}const ut=new ct;class pt{constructor(t,e,i,s,n,r){"object"==typeof t?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new ct(n,e,r||t.width-n-i,o||t.height-e-s)}}var _t,gt;t.Direction4=void 0,(_t=t.Direction4||(t.Direction4={}))[_t.top=0]="top",_t[_t.right=1]="right",_t[_t.bottom=2]="bottom",_t[_t.left=3]="left",t.Direction9=void 0,(gt=t.Direction9||(t.Direction9={}))[gt.topLeft=0]="topLeft",gt[gt.top=1]="top",gt[gt.topRight=2]="topRight",gt[gt.right=3]="right",gt[gt.bottomRight=4]="bottomRight",gt[gt.bottom=5]="bottom",gt[gt.bottomLeft=6]="bottomLeft",gt[gt.left=7]="left",gt[gt.center=8]="center",gt[gt["top-left"]=0]="top-left",gt[gt["top-right"]=2]="top-right",gt[gt["bottom-right"]=4]="bottom-right",gt[gt["bottom-left"]=6]="bottom-left";const ft=[{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}];ft.forEach((t=>t.type="percent"));const yt={directionData:ft,tempPoint:{},get:mt,toPoint(t,e,i,s,n){const r=mt(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,n&&(i.x-=n.x,i.y-=n.y,r.x&&(i.x-=1===r.x?n.width:.5===r.x?r.x*n.width:0),r.y&&(i.y-=1===r.y?n.height:.5===r.y?r.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)}};function mt(e){return"string"==typeof e?ft[t.Direction9[e]]:e}const{toPoint:vt}=yt,wt={toPoint(t,e,i,s,n){vt(t,i,s,n,e)}},xt={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:bt}=h;class Et{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Et(t)}static set filter(t){this.filterList=Bt(t)}static set exclude(t){this.excludeList=Bt(t)}static drawRepaint(t,e){const i=bt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Et.showBounds,n=t.__nowWorld,r=bt();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(Pt.enable){if(Pt.filterList.length&&Pt.filterList.every((t=>t!==this.name)))return;if(Pt.excludeList.length&&Pt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Pt.enable&&this.warn(...t)}warn(...t){Pt.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 Bt(t){return t?"string"==typeof t&&(t=[t]):t=[],t}Et.filterList=[],Et.excludeList=[],Et.showWarn=!0;const Pt=Et,kt=Et.get("RunTime"),Ct={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return Rt.currentId=Rt.idMap[i]=e?performance.now():Date.now(),Rt.currentName=Rt.nameMap[i]=t,Rt.nameToIdMap[t]=i,i},end(t,e){const i=Rt.idMap[t],s=Rt.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;Rt.idMap[t]=Rt.nameMap[t]=Rt.nameToIdMap[s]=void 0,kt.log(s,n,"ms")},endOfName(t,e){const i=Rt.nameToIdMap[t];void 0!==i&&Rt.end(i,e)}},Rt=Ct,Tt=[],St={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 plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout((()=>Tt.forEach((t=>St.has(t,!0)))));const Lt=Et.get("UICreator"),Dt={list:{},register(t){const{__tag:e}=t.prototype;At[e]&&Lt.repeat(e),At[e]=t},get(t,e,i,s,n,r){At[t]||Lt.error("not register "+t);const o=new At[t](e);return void 0!==i&&(o.x=i,s&&(o.y=s),n&&(o.width=n),r&&(o.height=r)),o}},{list:At}=Dt,Ot=Et.get("EventCreator"),It={nameList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(Mt[e]&&Ot.repeat(e),Mt[e]=t)}))},changeName(t,e){const i=Mt[t];if(i){const s=Object.keys(i).find((e=>i[e]===t));s&&(i[s]=e,Mt[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Mt[t](...e)},{nameList:Mt}=It;class Ft{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,n=s.length;i<n;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const n=i.canvas(t);return this.add(n),n}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)=>(Ut(e,t),Ut(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach((n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return Ut(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&Ut(t[n]={},e[n],i[n]):t[n]=e[n]}))},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:Ut}=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 n in this)if("_"!==n[0]&&(t=this["_"+n],void 0!==t)){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=void 0===e?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,f:o}}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 zt;t.Answer=void 0,(zt=t.Answer||(t.Answer={}))[zt.No=0]="No",zt[zt.Yes=1]="Yes",zt[zt.NoAndSkip=2]="NoAndSkip",zt[zt.YesAndSkip=3]="YesAndSkip";const jt={};function Yt(t){return null==t}function Ht(t){return"{}"===JSON.stringify(t)}function Xt(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function Gt(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof i?t:new i((function(e){e(t)}))}(t.value).then(o,a)}h((s=s.apply(t,e||[])).next())}))}function Vt(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 Kt(){return(t,e)=>{qt.push(e)}}const Zt=[];class $t{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;qt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){"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,n,r)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}Xt([Vt("imageSmoothingEnabled")],$t.prototype,"smooth",void 0),Xt([Vt("imageSmoothingQuality")],$t.prototype,"smoothLevel",void 0),Xt([Vt("globalAlpha")],$t.prototype,"opacity",void 0),Xt([Vt()],$t.prototype,"fillStyle",void 0),Xt([Vt()],$t.prototype,"strokeStyle",void 0),Xt([Vt("lineWidth")],$t.prototype,"strokeWidth",void 0),Xt([Vt("lineCap")],$t.prototype,"strokeCap",void 0),Xt([Vt("lineJoin")],$t.prototype,"strokeJoin",void 0),Xt([Vt("lineDashOffset")],$t.prototype,"dashOffset",void 0),Xt([Vt()],$t.prototype,"miterLimit",void 0),Xt([Vt()],$t.prototype,"shadowBlur",void 0),Xt([Vt()],$t.prototype,"shadowColor",void 0),Xt([Vt()],$t.prototype,"shadowOffsetX",void 0),Xt([Vt()],$t.prototype,"shadowOffsetY",void 0),Xt([Vt()],$t.prototype,"filter",void 0),Xt([Vt()],$t.prototype,"font",void 0),Xt([Vt()],$t.prototype,"fontKerning",void 0),Xt([Vt()],$t.prototype,"fontStretch",void 0),Xt([Vt()],$t.prototype,"fontVariantCaps",void 0),Xt([Vt()],$t.prototype,"textAlign",void 0),Xt([Vt()],$t.prototype,"textBaseline",void 0),Xt([Vt()],$t.prototype,"textRendering",void 0),Xt([Vt()],$t.prototype,"wordSpacing",void 0),Xt([Vt()],$t.prototype,"letterSpacing",void 0),Xt([Vt()],$t.prototype,"direction",void 0),Xt([Kt()],$t.prototype,"setTransform",null),Xt([Kt()],$t.prototype,"resetTransform",null),Xt([Kt()],$t.prototype,"getTransform",null),Xt([Kt()],$t.prototype,"save",null),Xt([Kt()],$t.prototype,"restore",null),Xt([Kt()],$t.prototype,"translate",null),Xt([Kt()],$t.prototype,"scale",null),Xt([Kt()],$t.prototype,"rotate",null),Xt([Kt()],$t.prototype,"fill",null),Xt([Kt()],$t.prototype,"stroke",null),Xt([Kt()],$t.prototype,"clip",null),Xt([Kt()],$t.prototype,"fillRect",null),Xt([Kt()],$t.prototype,"strokeRect",null),Xt([Kt()],$t.prototype,"clearRect",null),Xt([Kt()],$t.prototype,"beginPath",null),Xt([Kt()],$t.prototype,"moveTo",null),Xt([Kt()],$t.prototype,"lineTo",null),Xt([Kt()],$t.prototype,"bezierCurveTo",null),Xt([Kt()],$t.prototype,"quadraticCurveTo",null),Xt([Kt()],$t.prototype,"closePath",null),Xt([Kt()],$t.prototype,"arc",null),Xt([Kt()],$t.prototype,"arcTo",null),Xt([Kt()],$t.prototype,"ellipse",null),Xt([Kt()],$t.prototype,"rect",null),Xt([Kt()],$t.prototype,"roundRect",null),Xt([Kt()],$t.prototype,"createConicGradient",null),Xt([Kt()],$t.prototype,"createLinearGradient",null),Xt([Kt()],$t.prototype,"createPattern",null),Xt([Kt()],$t.prototype,"createRadialGradient",null),Xt([Kt()],$t.prototype,"fillText",null),Xt([Kt()],$t.prototype,"measureText",null),Xt([Kt()],$t.prototype,"strokeText",null);const{copy:Qt,multiplyParent:Jt}=E,{round:te}=Math,ee={width:1,height:1,pixelRatio:1},ie=["width","height","pixelRatio"];class se extends $t{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(t,i){super(),this.size={},this.worldTransform={},t||(t=ee),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:n,height:r,pixelRatio:o}=t;this.autoLayout=!n||!r,this.size.pixelRatio=o|e.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;Wt.copyAttrs(s,t,ie),ie.forEach((t=>s[t]||(s[t]=1))),this.bounds=new ct(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle())}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&Jt(t,e,n),n.a=t.a*i,n.b=t.b*i,n.c=t.c*i,n.d=t.d*i,n.e=t.e*i,n.f=t.f*i,s&&(t.half&&t.half*i%2?(n.e=te(n.e-.5)+.5,n.f=te(n.f-.5)+.5):(n.e=te(n.e),n.f=te(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i){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:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s){if(s&&(this.blendMode=s),e){const{pixelRatio:s}=this;i||(i=e),this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x*s,i.y*s,i.width*s,i.height*s)}else this.drawImage(t.view,0,0);s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s){if(s&&(this.blendMode=s),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,at.tempToOuterOf(i,e)),this.restore();else{const{pixelRatio:s}=this;this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x,i.y,i.width,i.height)}s&&(this.blendMode="source-over")}copyWorldByReset(t,e,i,s,n){this.resetTransform(),this.copyWorld(t,e,i,s),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(ut.x,ut.y,ut.width,ut.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,ut.x,ut.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(ut.x,ut.y,ut.width,ut.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(ut.x,ut.y,ut.width,ut.height),i&&(this.blendMode="source-over")}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(ut.x,ut.y,ut.width,ut.height)}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(ut.x,ut.y,ut.width,ut.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,i){ut.set(t),i&&ut.intersect(this.bounds),ut.scale(this.pixelRatio),e&&ut.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:n}=this,r=this.manager?this.manager.get(s):i.canvas(Object.assign({},s));return r.save(),t&&(Qt(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==n&&(r.pixelSnap=n),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const ne={creator:{},parse(t,e){},convertToCanvasData(t,e){}},re={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},oe=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},re),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),re),de=oe,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,n,r){const o=h.fourNumber(r,Math.min(s/2,n/2)),a=e+s,l=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,l,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,l,e,l,o[2]):t.lineTo(a,l),o[3]?t.arcTo(e,l,e,i,o[3]):t.lineTo(e,l),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:_e,cos:ge,atan2:fe,ceil:ye,abs:me,PI:ve,sqrt:we,pow:xe}=Math,{setPoint:be,addPoint:Ee}=H,{set:Be,toNumberPoints:Pe}=I,{M:ke,L:Ce,C:Re,Q:Te,Z:Se}=oe,Le={},De={points(t,e,i,s){let n=Pe(e);if(t.push(ke,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,p,_,g,f,y=n.length;const m=!0===i?.5:i;s&&(n=[n[y-2],n[y-1],...n,n[0],n[1],n[2],n[3]],y=n.length);for(let i=2;i<y-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],_=we(xe(o-e,2)+xe(a-r,2)),g=we(xe(h-o,2)+xe(l-a,2)),f=_+g,_=m*_/f,g=m*g/f,h-=e,l-=r,d=o-_*h,c=a-_*l,2===i?s||t.push(Te,d,c,o,a):t.push(Re,u,p,d,c,o,a),u=o+g*h,p=a+g*l;s||t.push(Te,u,p,n[y-2],n[y-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(Ce,n[e],n[e+1]);s&&t.push(Se)},rect(t,e,i,s,n){ne.creator.path=t,ne.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){ne.creator.path=[],pe.drawRoundRect(ne.creator,e,i,s,n,r),t.push(...ne.convertToCanvasData(ne.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,p){const _=s-e,g=n-i,f=r-s,y=o-n;let m=fe(g,_),v=fe(y,f),w=v-m;if(w<0&&(w+=c),w===ve||me(_+g)<1e-12||me(f+y)<1e-12)return t&&t.push(Ce,s,n),h&&(be(h,e,i),Ee(h,s,n)),p&&Be(p,e,i),void(l&&Be(l,s,n));const x=_*y-f*g<0,b=x?-1:1,E=a/ge(w/2),B=s+E*ge(m+w/2+u*b),P=n+E*_e(m+w/2+u*b);return m-=u*b,v-=u*b,Ie(t,B,P,a,a,0,m/d,v/d,x,h,l,p)},arc:(t,e,i,s,n,r,o,a,h,l)=>Ie(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,p,_){const g=r*d,f=_e(g),y=ge(g);let m=o*d,v=a*d;m>ve&&(m-=c),v<0&&(v+=c);let w=v-m;w<0?w+=c:w>c&&(w-=c),h&&(w-=c);const x=ye(me(w/u)),b=w/x,E=_e(b/4),B=8/3*E*E/_e(b/2);v=m+b;let P,k,C,R,T,S,L,D,A=ge(m),O=_e(m),I=C=y*s*A-f*n*O,M=R=f*s*A+y*n*O,F=e+C,W=i+R;t&&t.push(t.length?Ce:ke,F,W),l&&be(l,F,W),_&&Be(_,F,W);for(let r=0;r<x;r++)P=ge(v),k=_e(v),C=y*s*P-f*n*k,R=f*s*P+y*n*k,T=e+I-B*(y*s*O+f*n*A),S=i+M-B*(f*s*O-y*n*A),L=e+C+B*(y*s*k+f*n*P),D=i+R+B*(f*s*k-y*n*P),t&&t.push(Re,T,S,L,D,e+C,i+R),l&&Oe(e+I,i+M,T,S,L,D,e+C,i+R,l,!0),I=C,M=R,A=P,O=k,m=v,v+=b;p&&Be(p,e+C,i+R)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(Re,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){Oe(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,p,_,g,f,y,m,v=t,w=i,x=n,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=r,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,p=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else y=u*u-4*p*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Ee(h,t,e):be(h,t,e),Ee(h,o,a);for(let l=0,c=d.length;l<c;l++)Ae(d[l],t,e,i,s,n,r,o,a,Le),Ee(h,Le.x,Le.y)},getPointAndSet(t,e,i,s,n,r,o,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*r+_*a,l.y=c*i+u*n+p*o+_*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return Ae(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:Ae,toTwoPointBounds:Oe,ellipse:Ie}=De,{sin:Me,cos:Fe,sqrt:We,atan2:Ue}=Math,{ellipse:Ne}=De,ze={ellipticalArc(t,i,s,n,r,o,a,h,l,u,p){const _=(l-i)/2,g=(u-s)/2,f=o*d,y=Me(f),m=Fe(f),v=-m*_-y*g,w=-m*g+y*_,x=n*n,b=r*r,E=w*w,B=v*v,P=x*b-x*E-b*B;let k=0;if(P<0){const t=We(1-P/(x*b));n*=t,r*=t}else k=(a===h?-1:1)*We(P/(x*E+b*B));const C=k*n*w/r,R=-k*r*v/n,T=Ue((w-R)/r,(v-C)/n),S=Ue((-w-R)/r,(-v-C)/n);let L=S-T;0===h&&L>0?L-=c:1===h&&L<0&&(L+=c);const D=i+_+m*C-y*R,A=s+g+y*C+m*R,O=L<0?1:0;p||e.ellipseToCurve?Ne(t,D,A,n,r,o,T/d,S/d,O):n!==r||o?t.push(oe.G,D,A,n,r,o,T/d,S/d,O):t.push(oe.O,D,A,n,T/d,S/d,O)}},{M:je,m:Ye,L:He,l:Xe,H:Ge,h:Ve,V:qe,v:Ke,C:Ze,c:$e,S:Qe,s:Je,Q:ti,q:ei,T:ii,t:si,A:ni,a:ri,Z:oi,z:ai,N:hi,D:li,X:di,G:ci,F:ui,O:pi,P:_i,U:gi}=oe,{rect:fi,roundRect:yi,arcTo:mi,arc:vi,ellipse:wi,quadraticCurveTo:xi}=De,{ellipticalArc:bi}=ze,Ei=Et.get("PathConvert"),Bi={},Pi={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=ue[s],a+=s===n?" ":ce[s];for(let s=1;s<i;s++)a+=h.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?le:he;for(let e=0,h=t.length;e<h;e++)s=t[e],xt[s]?("."===s&&(ki.dot&&(Ci(o,r),r=""),ki.dot++),"0"===r&&"."!==s&&(Ci(o,r),r=""),r+=s):oe[s]?(r&&(Ci(o,r),r=""),ki.name=oe[s],ki.length=ae[s],ki.index=0,Ci(o,ki.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&Ci(o,r),r=s):r&&(Ci(o,r),r=""),n=s;return r&&Ci(o,r),i?Pi.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(n=t[c],n){case Ye:t[c+1]+=a,t[c+2]+=h;case je:a=t[c+1],h=t[c+2],p.push(je,a,h),c+=3;break;case Ve:t[c+1]+=a;case Ge:a=t[c+1],p.push(He,a,h),c+=2;break;case Ke:t[c+1]+=h;case qe:h=t[c+1],p.push(He,a,h),c+=2;break;case Xe:t[c+1]+=a,t[c+2]+=h;case He:a=t[c+1],h=t[c+2],p.push(He,a,h),c+=3;break;case Je:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Qe;case Qe:o=r===Ze||r===Qe,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(Ze,l,d,i,s,a,h),c+=5;break;case $e:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Ze;case Ze:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(Ze,t[c+1],t[c+2],i,s,a,h),c+=7;break;case si:t[c+1]+=a,t[c+2]+=h,n=ii;case ii:o=r===ti||r===ii,i=o?2*a-i:t[c+1],s=o?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,n=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 ri:t[c+6]+=a,t[c+7]+=h;case ni: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 oi:p.push(oi),c++;break;case hi:a=t[c+1],h=t[c+2],e?fi(p,a,h,t[c+3],t[c+4]):Ri(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]]):Ri(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]):Ri(p,t,c,6),c+=6;break;case ci:wi(e?p:Ri(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,Bi),a=Bi.x,h=Bi.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):Ri(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case pi:vi(e?p:Ri(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Bi),a=Bi.x,h=Bi.y,c+=7;break;case _i:e?vi(p,t[c+1],t[c+2],t[c+3],0,360,!1):Ri(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case gi:mi(e?p:Ri(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Bi),a=Bi.x,h=Bi.y,c+=6;break;default:return Ei.error(`command: ${n} [index:${c}]`,t),p}r=n}return p},objectToCanvasData(t){const e=[];return t.forEach((t=>{switch(t.name){case"M":e.push(je,t.x,t.y);break;case"L":e.push(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(ti,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(oi)}})),e},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){ki.index===ki.length&&(ki.index=1,t.push(ki.name)),t.push(Number(e)),ki.index++,ki.dot=0}},{current:ki,pushData:Ci,copyData:Ri}=Pi,{M:Ti,L:Si,C:Li,Q:Di,Z:Ai,N:Oi,D:Ii,X:Mi,G:Fi,F:Wi,O:Ui,P:Ni,U:zi}=oe,{getMinDistanceFrom:ji,getRadianFrom:Yi}=I,{tan:Hi,min:Xi,abs:Gi}=Math,Vi={},qi={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Ti,e,i)},lineTo(t,e,i){t.push(Si,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(Li,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(Di,e,i,s,n)},closePath(t){t.push(Ai)},rect(t,e,i,s,n){t.push(Oi,e,i,s,n)},roundRect(t,e,i,s,n,r){if("number"==typeof r)t.push(Mi,e,i,s,n,r);else{const o=h.fourNumber(r);o?t.push(Ii,e,i,s,n,...o):t.push(Oi,e,i,s,n)}},ellipse(t,e,i,s,n,r,o,a,h){void 0===r?t.push(Wi,e,i,s,n):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Fi,e,i,s,n,r,o,a,h?1:0))},arc(t,e,i,s,n,r,o){void 0===n?t.push(Ni,e,i,s):(void 0===r&&(r=360),t.push(Ui,e,i,s,n,r,o?1:0))},arcTo(t,e,i,s,n,r,o,a){if(void 0!==o){const t=ji(o,a,e,i,s,n);r=Xi(r,Xi(t/2,t/2*Gi(Hi(Yi(o,a,e,i,s,n)/2))))}t.push(zi,e,i,s,n,r)},drawEllipse(t,e,i,s,n,r,o,a,h){De.ellipse(null,e,i,s,n,void 0===r?0:r,void 0===o?0:o,void 0===a?360:a,h,null,null,Vi),t.push(Ti,Vi.x,Vi.y),Ki(t,e,i,s,n,r,o,a,h)},drawArc(t,e,i,s,n,r,o){De.arc(null,e,i,s,void 0===n?0:n,void 0===r?360:r,o,null,null,Vi),t.push(Ti,Vi.x,Vi.y),Zi(t,e,i,s,n,r,o)},drawPoints(t,e,i,s){De.points(t,e,i,s)}},{ellipse:Ki,arc:Zi}=qi,{moveTo:$i,lineTo:Qi,quadraticCurveTo:Ji,bezierCurveTo:ts,closePath:es,beginPath:is,rect:ss,roundRect:ns,ellipse:rs,arc:os,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?ne.parse(t):t:[],this}beginPath(){return is(this.__path),this.paint(),this}moveTo(t,e){return $i(this.__path,t,e),this.paint(),this}lineTo(t,e){return Qi(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return ts(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ji(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,n){return ns(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return rs(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return os(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return as(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return hs(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return ls(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return ds(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:us,L:ps,C:_s,Q:gs,Z:fs,N:ys,D:ms,X:vs,G:ws,F:xs,O:bs,P:Es,U:Bs}=oe,Ps=Et.get("PathDrawer"),ks={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)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]*d,e[s+6]*d,e[s+7]*d,e[s+8]),s+=9;break;case xs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,c,!1),s+=5;break;case bs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*d,e[s+5]*d,e[s+6]),s+=7;break;case Es:t.arc(e[s+1],e[s+2],e[s+3],0,c,!1),s+=4;break;case Bs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Ps.error(`command: ${i} [index:${s}]`,e)}}},{M:Cs,L:Rs,C:Ts,Q:Ss,Z:Ls,N:Ds,D:As,X:Os,G:Is,F:Ms,O:Fs,P:Ws,U:Us}=oe,{toTwoPointBounds:Ns,toTwoPointBoundsByQuadraticCurve:zs,arcTo:js,arc:Ys,ellipse:Hs}=De,{addPointBounds:Xs,copy:Gs,addPoint:Vs,setPoint:qs,addBounds:Ks,toBounds:Zs}=H,$s=Et.get("PathBounds");let Qs,Js,tn;const en={},sn={},nn={},rn={toBounds(t,e){rn.toTwoPointBounds(t,sn),Zs(sn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return qs(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===Ls||o===Ts||o===Ss?qs(e,h,l):qs(e,t[a+1],t[a+2])),o){case Cs:case Rs:h=t[a+1],l=t[a+2],Vs(e,h,l),a+=3;break;case Ts:n=t[a+5],r=t[a+6],Ns(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,en),Xs(e,en),h=n,l=r,a+=7;break;case Ss:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],zs(h,l,i,s,n,r,en),Xs(e,en),h=n,l=r,a+=5;break;case Ls:a+=1;break;case Ds:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=5;break;case As:case Os:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=o===As?9:6;break;case Is: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],en,nn),0===a?Gs(e,en):Xs(e,en),h=nn.x,l=nn.y,a+=9;break;case Ms:h=t[a+1],l=t[a+2],Js=t[a+3],tn=t[a+4],Ks(e,h-Js,l-tn,2*Js,2*tn),h+=Js,a+=5;break;case Fs:Ys(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],en,nn),0===a?Gs(e,en):Xs(e,en),h=nn.x,l=nn.y,a+=7;break;case Ws:h=t[a+1],l=t[a+2],Qs=t[a+3],Ks(e,h-Qs,l-Qs,2*Qs,2*Qs),h+=Qs,a+=4;break;case Us:js(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],en,nn),0===a?Gs(e,en):Xs(e,en),h=nn.x,l=nn.y,a+=6;break;default:return void $s.error(`command: ${o} [index:${a}]`,t)}}},{M:on,L:an,Z:hn}=oe,{getCenterX:ln,getCenterY:dn}=I,{arcTo:cn}=qi,un={smooth(t,e,i){let s,n,r=0,o=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0;const _=t.length,g=[];for(;r<_;)switch(s=t[r],s){case on:h=u=t[r+1],l=p=t[r+2],r+=3,t[r]===an?(d=t[r+1],c=t[r+2],g.push(on,ln(h,d),dn(l,c))):g.push(on,h,l);break;case an:switch(o=t[r+1],a=t[r+2],r+=3,t[r]){case an:cn(g,o,a,t[r+1],t[r+2],e,u,p);break;case hn:cn(g,o,a,h,l,e,u,p);break;default:g.push(an,o,a)}u=o,p=a;break;case hn:cn(g,h,l,d,c,e,u,p),g.push(hn),r+=1;break;default:n=ue[s];for(let e=0;e<n;e++)g.push(t[r+e]);r+=n}return s!==hn&&(g[1]=h,g[2]=l),g}};ne.creator=new cs,ne.parse=Pi.parse,ne.convertToCanvasData=Pi.toCanvasData;const pn=new cs,{drawRoundRect:_n}=pe;function gn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){_n(this,t,e,i,s,n)})}(t)}const fn={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=yn.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{}}}},yn=fn;yn.opacityTypes.forEach((t=>yn.upperCaseTypeMap[t]=t.toUpperCase()));const mn=Et.get("TaskProcessor");class vn{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.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){mn.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class wn{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,n,r;const o=new vn(t);return o.parent=this,"number"==typeof e?r=e:e&&(s=e.parallel,i=e.start,n=e.time,r=e.delay),n&&(o.time=n),!1===s&&(o.parallel=!1),void 0===r?this.push(o,i):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(o,i))}),r)),this.isComplete=!1,o}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout((()=>this.start())))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)})):this.nextTask()}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout((()=>this.run()))}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let 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 xn=Et.get("Resource"),bn={tasker:new wn,map:{},get isComplete(){return En.tasker.isComplete},set(t,e){En.map[t]&&xn.repeat(t),En.map[t]=e},get:t=>En.map[t],remove(t){const e=En.map[t];e&&(e.destroy&&e.destroy(),delete En.map[t])},loadImage(t,e){return new Promise(((i,s)=>{const n=this.setImage(t,t,e);n.load((()=>i(n)),(t=>s(t)))}))},setImage(t,e,s){let n;return"string"==typeof e?n={url:e}:e.url||(n={url:t,view:e}),n&&(s&&(n.format=s),e=i.image(n)),En.set(t,e),e},destroy(){En.map={}}},En=bn,Bn={maxRecycled:10,recycledList:[],patternTasker:new wn,get(t){let e=bn.get(t.url);return e||bn.set(t.url,e=i.image(t)),e.use++,e},recycle(t){t.use--,setTimeout((()=>{t.use||Pn.recycledList.push(t)}))},clearRecycled(){const t=Pn.recycledList;t.length>Pn.maxRecycled&&(t.forEach((t=>!t.use&&t.url&&bn.remove(t.url))),t.length=0)},hasOpacityPixel:t=>fn.opacityTypes.some((e=>Pn.isFormat(e,t))),isFormat(t,e){if(e.format===t)return!0;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+fn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+fn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Pn.recycledList=[]}},Pn=Bn,{IMAGE:kn,create:Cn}=s;class Rn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Cn(kn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Bn.isFormat("svg",t)&&(this.isSVG=!0),Bn.hasOpacityPixel(t)&&(this.hasOpacityPixel=!0)}load(t,i){if(!this.loading){this.loading=!0;let{loadImage:t,loadImageWithProgress:i}=e.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(t=i),bn.tasker.add((()=>Gt(this,void 0,void 0,(function*(){return yield t(this.url,s).then((t=>this.setView(t))).catch((t=>{this.error=t,this.onComplete(!1)}))}))))}return this.waitComplete.push(t,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach(((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))})),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,i,s,n){if(t||(t=this.width),i||(i=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const r=e.origin.createCanvas(t,i),o=r.getContext("2d");return s&&(o.globalAlpha=s),o.drawImage(this.view,0,0,t,i),this.cache=this.use>1?{data:r,params:arguments}:null,r}getPattern(t,i,s,n){const r=e.canvas.createPattern(t,i);try{s&&r.setTransform&&(r.setTransform(s),s=null)}catch(t){}return n&&(n.transform=s),r}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Tn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Sn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Ln(t,e){return(i,s)=>An(i,s,t,e&&e(s))}function Dn(t){return t}function An(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Tn(t,e,Object.assign(n,s||{})),rr(t,e,i)}function On(t){return Ln(t)}function In(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}})))}function Mn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),zn(this))}})))}function Fn(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}})))}function Wn(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}})))}function Un(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i,e)&&zn(this)}})))}function Nn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(zn(this),this.__.__removeNaturalSize())}})))}function zn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function jn(t){return Ln(t,(t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),zn(this)}})))}const Yn=Un;function Hn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&Xn(this)}})))}function Xn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&zn(t)}const Gn=Hn;function Vn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}})))}function qn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})))}function Kn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&$n(this)}})))}function Zn(t){return Ln(t,(t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",(()=>Qn(this,t,e,i)))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Qn(this,t,e,i),this.mask&&$n(this)}})))}function $n(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Qn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||zn(t))}function Jn(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChange()})))}})))}function tr(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(e)})))}})))}function er(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&this.waitParent((()=>{this.parent.__updateEraser(e)}))}})))}function ir(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Et.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}})))}function sr(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}})))}function nr(t){return(e,i)=>{Tn(e,"__DataProcessor",{get:()=>t})}}function rr(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o={get(){const t=this[n];return void 0===t?i:t},set(t){this[n]=t}};if(void 0===i)o.get=function(){return this[n]};else if("function"==typeof i)o.get=function(){let t=this[n];return void 0===t?i(this.__leaf):t};else if("object"==typeof i){const t=Ht(i);o.get=function(){let e=this[n];return void 0===e?this[n]=t?{}:Wt.clone(i):e}}const a=t.isBranchLeaf;"width"===e?o.get=function(){const t=this[n];if(void 0===t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:a&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(o.get=function(){const t=this[n];if(void 0===t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:a&&s.children.length?s.boxBounds.height:i}return t});let h,l=s;for(;!h&&l;)h=Sn(l,e),l=l.__proto__;h&&h.set&&(o.set=h.set),s[r]&&(o.set=s[r],delete s[r]),Tn(s,e,o)}const or=new Et("rewrite"),ar=[],hr=["destroy","constructor"];function lr(t){return(e,i)=>{ar.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function dr(){return t=>{cr()}}function cr(t){ar.length&&(ar.forEach((e=>{t&&or.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),ar.length=0)}function ur(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach((s=>{if(!(hr.includes(s)||e&&e.includes(s)))if(t.prototype){Sn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]}))}}function pr(){return t=>{Dt.register(t)}}function _r(){return t=>{It.register(t)}}setTimeout((()=>cr(!0)));const{copy:gr,toInnerPoint:fr,toOuterPoint:yr,scaleOfOuter:mr,rotateOfOuter:vr,skewOfOuter:wr,multiplyParent:xr,divideParent:br,getLayout:Er}=E,Br={},{round:Pr}=Math,kr={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Tr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Rr(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++)Sr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Sr(t),t.__updateChange()},updateAllChange(t){if(Dr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Lr(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},moveWorld(t,e,i=0,s,n){const r="object"==typeof e?Object.assign({},e):{x:e,y:i};s?yr(t.localTransform,r,r,!0):t.parent&&fr(t.parent.worldTransform,r,r,!0),Cr.moveLocal(t,r.x,r.y,n)},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=Pr(e),i=Pr(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){Cr.zoomOfLocal(t,Ar(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if("number"!=typeof s&&(s&&(r=s),s=i),gr(Br,o),mr(Br,e,i,s),t.origin||t.around)Cr.setTransform(t,Br,n,r);else{const e=t.x+Br.e-o.e,a=t.y+Br.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){Cr.rotateOfLocal(t,Ar(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;gr(Br,n),vr(Br,e,i),t.origin||t.around?Cr.setTransform(t,Br,!1,s):t.set({x:t.x+Br.e-n.e,y:t.y+Br.f-n.f,rotation:h.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){Cr.skewOfLocal(t,Ar(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){gr(Br,t.__localMatrix),wr(Br,e,i,s),Cr.setTransform(t,Br,n,r)},transformWorld(t,e,i,s){gr(Br,t.worldTransform),xr(Br,e),t.parent&&br(Br,t.parent.worldTransform),Cr.setTransform(t,Br,i,s)},transform(t,e,i,s){gr(Br,t.localTransform),xr(Br,e),Cr.setTransform(t,Br,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&Cr.getInnerOrigin(t,n.origin),o=Er(e,r,n.around&&Cr.getInnerOrigin(t,n.around));if(i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){at.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Cr.getInnerOrigin(t,n.origin);I.move(o,r.x-s.x,r.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return mr(i,Cr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>I.tempToOuterOf(Cr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return yt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(gr(Br,t.worldTransform),br(Br,e.worldTransform),i?Br:Object.assign({},Br)),drop(t,e,i,s){t.setTransform(Cr.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}}},Cr=kr,{updateAllMatrix:Rr,updateMatrix:Tr,updateAllWorldOpacity:Sr,updateAllChange:Lr,updateChange:Dr}=Cr;function Ar(t,e){return t.__layout.update(),t.parent?I.tempToInnerOf(e,t.parent.__world):e}const Or={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:Ir}=kr,Mr={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),Fr(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++)Wr(e[t],e)},updateBounds(t,e){const i=[t];Wr(t,i),Ur(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)Ir(s[t]);e&&e===i||Ir(i)}}},{pushAllChildBranch:Fr,pushAllBranchStack:Wr,updateBoundsByBranchStack:Ur}=Mr,Nr={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:zr}=kr,{toOuterOf:jr,getPoints:Yr,copy:Hr}=at,Xr="_localContentBounds",Gr="_worldContentBounds",Vr="_worldBoxBounds",qr="_worldStrokeBounds";class Kr{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 jr(this.contentBounds,this.leaf.__localMatrix,this[Xr]||(this[Xr]={})),this[Xr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return jr(this.contentBounds,this.leaf.__world,this[Gr]||(this[Gr]={})),this[Gr]}get worldBoxBounds(){return jr(this.boxBounds,this.leaf.__world,this[Vr]||(this[Vr]={})),this[Vr]}get worldStrokeBounds(){return jr(this.strokeBounds,this.leaf.__world,this[qr]||(this[qr]={})),this[qr]}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:t}=this.leaf;if(t)t.ready?t.watcher.changed&&t.layouter.layout():t.start();else{let t=this.leaf;for(;t.parent&&!t.parent.leafer;)t=t.parent;const i=t;if(i.__fullLayouting)return;i.__fullLayouting=!0,e.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 E.defaultMatrix;case"page":t=e.zoomLayer;default:return zr(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 ct(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=E.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=zr(s,e,!0)}if(o||(o=E.getLayout(r)),Hr(o,a),I.copy(o,n),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Yr(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return void 0!==n&&s.forEach((t=>i.innerToWorld(t,null,!1,n))),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Zr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.event.stop(this.origin)}}class $r extends Zr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}$r.ADD="child.add",$r.REMOVE="child.remove",$r.CREATED="created",$r.MOUNTED="mounted",$r.UNMOUNTED="unmounted",$r.DESTROY="destroy";class Qr extends Zr{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}Qr.CHANGE="property.change",Qr.LEAFER_CHANGE="property.leafer_change";class Jr extends Zr{constructor(t,e){super(t),Object.assign(this,e)}}Jr.LOAD="image.load",Jr.LOADED="image.loaded",Jr.ERROR="image.error";class to extends Zr{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(to.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&void 0!==this.resizingKeys[t.innerId]}}to.RESIZE="resize";class eo extends Zr{constructor(t,e){super(t),this.data=e}}eo.REQUEST="watch.request",eo.DATA="watch.data";class io extends Zr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}io.REQUEST="layout.request",io.START="layout.start",io.BEFORE="layout.before",io.LAYOUT="layout",io.AFTER="layout.after",io.AGAIN="layout.again",io.END="layout.end";class so extends Zr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}so.REQUEST="render.request",so.CHILD_START="render.child_start",so.CHILD_END="render.child_end",so.START="render.start",so.BEFORE="render.before",so.RENDER="render",so.AFTER="render.after",so.AGAIN="render.again",so.END="render.end",so.NEXT="render.next";class no extends Zr{}no.START="leafer.start",no.BEFORE_READY="leafer.before_ready",no.READY="leafer.ready",no.AFTER_READY="leafer.after_ready",no.VIEW_READY="leafer.view_ready",no.VIEW_COMPLETED="leafer.view_completed",no.STOP="leafer.stop",no.RESTART="leafer.restart",no.END="leafer.end";const ro={};class oo{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,n,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const o=ao(this,s,!0),a="string"==typeof t?t.split(" "):t,h=n?{listener:e,once:n}:{listener:e};a.forEach((t=>{t&&(r=o[t],r?-1===r.findIndex((t=>t.listener===e))&&r.push(h):o[t]=[h])}))}off(t,e,i){if(t){const s="string"==typeof t?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=ao(this,t);s.forEach((t=>{t&&(n=o[t],n&&(r=n.findIndex((t=>t.listener===e)),r>-1&&n.splice(r,1),n.length||delete o[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&&It.has(t)&&(e=It.get(t,{type:t,target:this,current:this}));const s=ao(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],r=s&&s[t];return!!(void 0===e?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ao(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:ro)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:ro)}}const{on:ho,on_:lo,off:co,off_:uo,once:po,emit:_o,emitEvent:go,hasEvent:fo,destroy:yo}=oo.prototype,mo={on:ho,on_:lo,off:co,off_:uo,once:po,emit:_o,emitEvent:go,hasEvent:fo,destroyEventer:yo},{isFinite:vo}=Number,wo=Et.get("setAttr"),xo={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(i&&!vo(e)&&void 0!==e&&(wo.warn(this.innerName,t,e),e=void 0),"object"==typeof e||s!==e){this.__realSetAttr(t,e);const{CHANGE:i}=Qr,n=new Qr(i,this,t,s,e);return this.isLeafer?this.emitEvent(new Qr(Qr.LEAFER_CHANGE,this,t,s,e)):this.hasEvent(i)&&this.emitEvent(n),this.leafer.emitEvent(n),!0}return!1}return this.__realSetAttr(t,e),!0},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||void 0===i.normalStyle[t]||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:bo,multiplyParent:Eo,translateInner:Bo,defaultWorld:Po}=E,{toPoint:ko,tempPoint:Co}=yt,Ro={__updateWorldMatrix(){Eo(this.__local||this.__layout,this.parent?this.parent.__world:Po,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)&&(bo(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)&&(ko(i.around||i.origin,t.boxBounds,Co),Bo(e,-Co.x,-Co.y,!i.around))}this.__layout.matrixChanged=!1}},{updateMatrix:To,updateAllMatrix:So}=kr,{updateBounds:Lo}=Mr,{toOuterOf:Do,copyAndSpread:Ao,copy:Oo}=at,{toBounds:Io}=rn,Mo={__updateWorldBounds(){Do(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(),Do(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Do(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Do(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?Io(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(),So(this),Lo(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(So(this),Lo(this,this))):To(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;Ao(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?Ao(t.renderBounds,t.boxBounds,t.renderSpread):Oo(t.renderBounds,t.strokeBounds)}},Fo={__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);Et.showBounds&&Et.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:Wo}=Or,Uo={__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 n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Wo(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Wo(i[s],e)||i[s].__clip(t,e)}}},{LEAF:No,create:zo}=s,{toInnerPoint:jo,toOuterPoint:Yo,multiplyParent:Ho}=E,{toOuterOf:Xo}=at,{copy:Go,move:Vo}=I,{moveLocal:qo,zoomOfLocal:Ko,rotateOfLocal:Zo,skewOfLocal:$o,moveWorld:Qo,zoomOfWorld:Jo,rotateOfWorld:ta,skewOfWorld:ea,transform:ia,transformWorld:sa,setTransform:na,getFlipTransform:ra,getLocalOrigin:oa,getRelativeWorld:aa,drop:ha}=kr;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return Nt}get __LayoutProcessor(){return Kr}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=zo(No),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent($r.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($r.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on($r.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($r.MOUNTED)):this.__emitLifeEvent($r.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 Ho(i,t.matrix,e,void 0,i),Xo(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,n=i?t:{};return Xo(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Go(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Go(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),jo(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){Yo(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Vo(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Vo(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){na(this,t,e,i)}transform(t,e,i){ia(this,t,e,i)}move(t,e,i){qo(this,t,e,i)}moveInner(t,e,i){Qo(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Ko(this,oa(this,t),e,i,s,n)}rotateOf(t,e,i){Zo(this,oa(this,t),e,i)}skewOf(t,e,i,s,n){$o(this,oa(this,t),e,i,s,n)}transformWorld(t,e,i){sa(this,t,e,i)}moveWorld(t,e,i){Qo(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){Jo(this,t,e,i,s,n)}rotateOfWorld(t,e){ta(this,t,e)}skewOfWorld(t,e,i,s,n){ea(this,t,e,i,s,n)}flip(t,e){ia(this,ra(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 St.need("path")}getMotionPoint(t){return St.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):rr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Un),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new $r(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent($r.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=Xt([ur(xo),ur(Ro),ur(Mo),ur(mo),ur(Fo)],t.Leaf);const{setListWithFn:la}=at,{sort:da}=Mr,{localBoxBounds:ca,localStrokeBounds:ua,localRenderBounds:pa,maskLocalBoxBounds:_a,maskLocalStrokeBounds:ga,maskLocalRenderBounds:fa}=Or,ya=new Et("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(){la(this.__layout.boxBounds,this.children,this.__hasMask?_a:ca)}__updateStrokeBounds(){la(this.__layout.strokeBounds,this.children,this.__hasMask?ga:ua)}__updateRenderBounds(){la(this.__layout.renderBounds,this.children,this.__hasMask?fa: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(da),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return ya.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=Dt.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($r.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent($r.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($r.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent($r.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new $r(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=Xt([ur(Uo)],t.Branch);class ma{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,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)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 ma;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class va{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(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 wa=Et.get("LeaferCanvas");class xa extends se{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const s=i.children[t];s?(this.setAbsolute(s),i.insertBefore(e,s)):i.appendChild(s)}}init(){const{config:t}=this,i=t.view||t.canvas;i?this.__createViewFrom(i):this.__createView();const{style:s}=this.view;if(s.display||(s.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}e.syncDomFont&&!this.parentView&&(s.display="none",document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e="string"==typeof t?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else wa.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:s}=this.view;s.width=t+"px",s.height=e+"px",this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,i){if(this.resizeListener=i,t){this.autoBounds=t;try{this.resizeObserver=new ResizeObserver((t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)}));const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),wa.warn("no parent"))}catch(t){this.imitateResizeObserver()}}else window.addEventListener("resize",this.windowListener=()=>{const t=e.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:i}=this;this.emitResize({width:e,height:i,pixelRatio:t})}})}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),e.requestRender(this.imitateResizeObserver.bind(this)))}checkAutoBounds(t){const i=this.view,{x:s,y:n,width:r,height:o}=this.autoBounds.getBoundsFrom(t),a={width:r,height:o,pixelRatio:this.config.pixelRatio?this.pixelRatio:e.devicePixelRatio};if(!this.isSameSize(a)){const{style:t}=i;t.marginLeft=s+"px",t.marginTop=n+"px",this.emitResize(a)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};Wt.copyAttrs(e,this,ie),this.resize(t),this.resizeListener&&void 0!==this.width&&this.resizeListener(new to(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}gn(CanvasRenderingContext2D.prototype),gn(Path2D.prototype);const{mineType:ba,fileType:Ea}=fn;function Ba(t,s){e.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const s=ba(e),n=t.toDataURL(s,i);return"image/bmp"===s?n.replace("image/png;","image/bmp;"):n},canvasToBolb:(t,e,i)=>new Promise((s=>t.toBlob(s,ba(e),i))),canvasSaveAs:(t,i,s)=>{const n=t.toDataURL(ba(Ea(i)),s);return e.origin.download(n,i)},download:(t,e)=>new Promise((i=>{let s=document.createElement("a");s.href=t,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),i()})),loadImage:t=>new Promise(((i,s)=>{const n=new e.origin.Image,{crossOrigin:r}=e.image;r&&(n.setAttribute("crossOrigin",r),n.crossOrigin=r),n.onload=()=>{i(n)},n.onerror=t=>{s(t)},n.src=e.image.getRealURL(t)})),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},e.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},e.canvas=i.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(i,{canvas:(t,e)=>new xa(t,e),image:t=>new Rn(t)}),e.name="web",e.isMobile="ontouchstart"in window,e.requestRender=function(t){window.requestAnimationFrame(t)},Tn(e,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:Pa}=navigator;Pa.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0,e.syncDomFont=!0):Pa.indexOf("AppleWebKit")>-1&&(e.fullImageShadow=!0),Pa.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):Pa.indexOf("Mac")>-1?e.os="Mac":Pa.indexOf("Linux")>-1&&(e.os="Linux");class ka{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new ma;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 ma,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(so.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===$r.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 eo(eo.DATA,{updatedList:this.updatedList})),this.__updatedList=new ma,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Qr.CHANGE,this.__onAttrChange,this),t.on_([$r.ADD,$r.REMOVE],this.__onChildEvent,this),t.on_(eo.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:Ra,updateChange:Ta}=kr,{pushAllChildBranch:Sa,pushAllParent:La}=Mr;const{worldBounds:Da}=Or;class Aa{constructor(t){this.updatedBounds=new ct,this.beforeBounds=new ct,this.afterBounds=new ct,t instanceof Array&&(t=new ma(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Da)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Da),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:Oa,updateAllChange:Ia}=kr,Ma=Et.get("Layouter");class Fa{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new va,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.running)return;const{target:t}=this;this.times=0;try{t.emit(io.START),this.layoutOnce(),t.emitEvent(new io(io.END,this.layoutedBlocks,this.times))}catch(t){Ma.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ma.warn("layouting"):this.times>3?Ma.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(eo.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=Ct.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=io,a=this.getBlocks(s);a.forEach((t=>t.setBefore())),i.emitEvent(new io(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Ca(t,!0),e.add(t),t.isBranch&&Sa(t,e),La(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),La(t,e)))}))}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach((n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Ra(s[t])}Ra(i)}}))}(this.__levelList),function(t){t.list.forEach(Ta)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach((t=>t.setAfter())),i.emitEvent(new io(r,a,this.times)),i.emitEvent(new io(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Ct.end(e)}fullLayout(){const t=Ct.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=io,r=this.getBlocks(new ma(e));e.emitEvent(new io(i,r,this.times)),Fa.fullLayout(e),r.forEach((t=>{t.setAfter()})),e.emitEvent(new io(s,r,this.times)),e.emitEvent(new io(n,r,this.times)),this.addBlocks(r),Ct.end(t)}static fullLayout(t){Oa(t,!0),t.isBranch?Mr.updateBounds(t):kr.updateBounds(t),Ia(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Aa([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Aa(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_(io.REQUEST,this.layout,this),t.on_(io.AGAIN,this.layoutAgain,this),t.on_(eo.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Wa=Et.get("Renderer");class Ua{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(io.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(so.CHILD_START,t),t.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),t.emit(so.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(so.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new ct,Wa.log(e.innerName,"---\x3e");try{this.emitRender(so.START),this.renderOnce(t),this.emitRender(so.END,this.totalBounds),Bn.clearRecycled()}catch(t){this.rendering=!1,Wa.error(t)}Wa.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Wa.warn("rendering");if(this.times>3)return Wa.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new ct,this.renderOptions={},t)this.emitRender(so.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(so.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(so.RENDER,this.renderBounds,this.renderOptions),this.emitRender(so.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=Ct.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new ct(s);i.save(),s.spread(Ua.clipSpread).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0),this.__render(s,n),i.restore(),Ct.end(e)}fullRender(){const t=Ct.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Ct.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),Et.showRepaint&&Et.drawRepaint(i,t),this.target.__render(i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new ct;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);const i=this.requestTime=Date.now();e.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()}))}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new ct(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 ct(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||Wa.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 so(t,this.times,e,i))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(so.REQUEST,this.update,this),t.on_(io.END,this.__onLayoutEnd,this),t.on_(so.AGAIN,this.renderAgain,this),t.on_(to.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}Ua.clipSpread=10;const{hitRadiusPoint:Na}=at;class za{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new ma(i.findList),i.findList||this.hitBranch(r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}getBestMatchLeaf(t,e,i){if(t.length){let e;this.findList=new ma;const{x:s,y:n}=this.point,r={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||kr.worldHittable(e))&&(this.hitChild(e,r),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 ma;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 ma;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 ma,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let r=t.length-1;r>-1;r--)i=t[r],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||Na(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask&&!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 za(this.target=t,this),this.finder=i.finder&&i.finder()}getByPoint(t,i,s){const{target:n,picker:r}=this;return e.backgrounder&&n&&n.updateLayout(),r.getByPoint(t,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):St.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Ya(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function Ha(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function Xa(){return(t,e)=>{const i="_"+e;Tn(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(i,{watcher:(t,e)=>new ka(t,e),layouter:(t,e)=>new Fa(t,e),renderer:(t,e,i)=>new Ua(t,e,i),selector:(t,e)=>new ja(t,e)}),e.layout=Fa.fullLayout;const Ga={},Va={},qa={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},Ka={},Za={},$a={},Qa={},Ja={},th={apply(){St.need("filter")}},eh={},ih={setStyleName:()=>St.need("state"),set:()=>St.need("state")},sh={list:{},register(t,e){sh.list[t]=e},get:t=>sh.list[t]},{parse:nh,objectToCanvasData:rh}=Pi,oh={},ah=Et.get("UIData");class hh 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,ah.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,ah.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){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=oh)}}else this.__isFills&&(this.__removeInput("fill"),$a.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=oh)}}else this.__isStrokes&&(this.__removeInput("stroke"),$a.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){lh(this,"shadow",t)}setInnerShadow(t){lh(this,"innerShadow",t)}setFilter(t){lh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Za.compute("fill",this.__leaf),e&&Za.compute("stroke",this.__leaf),this.__needComputePaint=!1}}function lh(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 dh extends hh{}class ch extends dh{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 uh extends dh{__getInputData(t,e){const i=super.__getInputData(t,e);return ie.forEach((t=>delete i[t])),i}}class ph extends ch{}class _h extends hh{}class gh extends hh{get __boxStroke(){return!this.__pathInputed}}class fh extends hh{get __boxStroke(){return!this.__pathInputed}}class yh extends hh{}class mh extends hh{}class vh extends hh{get __pathInputed(){return 2}}class wh extends dh{}const xh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class bh extends hh{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),t=xh[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=Dt.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.strokeChange(),r.renderChanged&&n.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class Eh extends gh{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 gh{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 Ph={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,strokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Math.max(r.__layout.strokeSpread=r.__updateStrokeSpread(),t),e=r.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r}=this.__;e&&e.forEach((e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur))),s&&(t=Math.max(t,s)),r&&(t+=th.getSpread(r));let o=t=Math.ceil(t);return i&&i.forEach((t=>o=Math.max(o,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur))),n&&(o=Math.max(o,n)),this.__layout.renderShapeSpread=o,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},kh={__updateChange(){const t=this.__,e=this.__world;if(t.__useEffect){const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r}=this.__;t.__useEffect=!!(e||i||s||n||r)}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:n,stroke:r,__drawAfterFill:o}=s;if(this.__drawRenderPath(t),s.__useEffect){const a=Za.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:l,filter:d}=s;h&&Ja.shadow(this,t,a),n&&(s.__isFills?Za.fills(n,this,t):Za.fill(n,this,t)),o&&this.__drawAfterFill(t,e),l&&Ja.innerShadow(this,t,a),r&&(s.__isStrokes?Za.strokes(r,this,t):Za.stroke(r,this,t)),d&&th.apply(d,this,this.__nowWorld,t,i,a),a.worldCanvas&&a.worldCanvas.recycle(),a.canvas.recycle()}else n&&(s.__isFills?Za.fills(n,this,t):Za.fill(n,this,t)),o&&this.__drawAfterFill(t,e),r&&(s.__isStrokes?Za.strokes(r,this,t):Za.stroke(r,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:n,stroke:r}=this.__;this.__drawRenderPath(t),n&&!i&&(this.__.__pixelFill?Za.fills(n,this,t):Za.fill("#000000",this,t)),this.__.__isCanvas&&this.__drawAfterFill(t,e),r&&!s&&(this.__.__pixelStroke?Za.strokes(r,this,t):Za.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:n,__drawAfterFill:r}=t.__;t.__drawRenderPath(e),s&&Za.fill(s,t,e),r&&t.__drawAfterFill(e,i),n&&Za.stroke(n,t,e)}const Rh={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var Th,Sh;t.UI=Th=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){h.assignScale(this,t)}get scale(){return this.__.scale}get pen(){const{path:t}=this.__;return pn.set(this.path=t||[]),t||this.__drawPathByBox(pn),pn}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 St.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return St.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(pn.set(i=[]),this.__drawPathByBox(pn)),t?Pi.toCanvasData(i,!0):i}getPathString(t,e,i){return Pi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||eh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){if(this.__.path){const t=this.__;t.__pathForRender=t.cornerRadius?un.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?ks.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,n,"number"==typeof r?[r]:r)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e){Za.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return St.need("animate")}killAnimate(t,e){}export(t,e){return St.need("export")}syncExport(t,e){return St.need("export")}clone(t){const e=Wt.clone(this.toJSON());return t&&Object.assign(e,t),Th.one(e)}static one(t,e,i,s,n){return Dt.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){pr()(this)}static registerData(t){nr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},Xt([nr(hh)],t.UI.prototype,"__",void 0),Xt([Xa()],t.UI.prototype,"zoomLayer",void 0),Xt([On("")],t.UI.prototype,"id",void 0),Xt([On("")],t.UI.prototype,"name",void 0),Xt([On("")],t.UI.prototype,"className",void 0),Xt([qn("pass-through")],t.UI.prototype,"blendMode",void 0),Xt([Kn(1)],t.UI.prototype,"opacity",void 0),Xt([Zn(!0)],t.UI.prototype,"visible",void 0),Xt([qn(!1)],t.UI.prototype,"locked",void 0),Xt([qn(!1)],t.UI.prototype,"dim",void 0),Xt([qn(!1)],t.UI.prototype,"dimskip",void 0),Xt([Jn(0)],t.UI.prototype,"zIndex",void 0),Xt([tr(!1)],t.UI.prototype,"mask",void 0),Xt([er(!1)],t.UI.prototype,"eraser",void 0),Xt([In(0,!0)],t.UI.prototype,"x",void 0),Xt([In(0,!0)],t.UI.prototype,"y",void 0),Xt([Un(100,!0)],t.UI.prototype,"width",void 0),Xt([Un(100,!0)],t.UI.prototype,"height",void 0),Xt([Fn(1,!0)],t.UI.prototype,"scaleX",void 0),Xt([Fn(1,!0)],t.UI.prototype,"scaleY",void 0),Xt([Wn(0,!0)],t.UI.prototype,"rotation",void 0),Xt([Wn(0,!0)],t.UI.prototype,"skewX",void 0),Xt([Wn(0,!0)],t.UI.prototype,"skewY",void 0),Xt([In(0,!0)],t.UI.prototype,"offsetX",void 0),Xt([In(0,!0)],t.UI.prototype,"offsetY",void 0),Xt([In(0,!0)],t.UI.prototype,"scrollX",void 0),Xt([In(0,!0)],t.UI.prototype,"scrollY",void 0),Xt([Mn()],t.UI.prototype,"origin",void 0),Xt([Mn()],t.UI.prototype,"around",void 0),Xt([On(!1)],t.UI.prototype,"lazy",void 0),Xt([Nn(1)],t.UI.prototype,"pixelRatio",void 0),Xt([jn()],t.UI.prototype,"path",void 0),Xt([Yn()],t.UI.prototype,"windingRule",void 0),Xt([Yn(!0)],t.UI.prototype,"closed",void 0),Xt([Un(0)],t.UI.prototype,"padding",void 0),Xt([Un(!1)],t.UI.prototype,"lockRatio",void 0),Xt([Un()],t.UI.prototype,"widthRange",void 0),Xt([Un()],t.UI.prototype,"heightRange",void 0),Xt([On(!1)],t.UI.prototype,"draggable",void 0),Xt([On()],t.UI.prototype,"dragBounds",void 0),Xt([On(!1)],t.UI.prototype,"editable",void 0),Xt([ir(!0)],t.UI.prototype,"hittable",void 0),Xt([ir("path")],t.UI.prototype,"hitFill",void 0),Xt([Gn("path")],t.UI.prototype,"hitStroke",void 0),Xt([ir(!1)],t.UI.prototype,"hitBox",void 0),Xt([ir(!0)],t.UI.prototype,"hitChildren",void 0),Xt([ir(!0)],t.UI.prototype,"hitSelf",void 0),Xt([ir()],t.UI.prototype,"hitRadius",void 0),Xt([sr("")],t.UI.prototype,"cursor",void 0),Xt([qn()],t.UI.prototype,"fill",void 0),Xt([Gn()],t.UI.prototype,"stroke",void 0),Xt([Gn("inside")],t.UI.prototype,"strokeAlign",void 0),Xt([Gn(1)],t.UI.prototype,"strokeWidth",void 0),Xt([Gn(!1)],t.UI.prototype,"strokeWidthFixed",void 0),Xt([Gn("none")],t.UI.prototype,"strokeCap",void 0),Xt([Gn("miter")],t.UI.prototype,"strokeJoin",void 0),Xt([Gn()],t.UI.prototype,"dashPattern",void 0),Xt([Gn(0)],t.UI.prototype,"dashOffset",void 0),Xt([Gn(10)],t.UI.prototype,"miterLimit",void 0),Xt([Yn(0)],t.UI.prototype,"cornerRadius",void 0),Xt([Yn()],t.UI.prototype,"cornerSmoothing",void 0),Xt([Ya()],t.UI.prototype,"shadow",void 0),Xt([Ya()],t.UI.prototype,"innerShadow",void 0),Xt([Ya()],t.UI.prototype,"blur",void 0),Xt([Ya()],t.UI.prototype,"backgroundBlur",void 0),Xt([Ya()],t.UI.prototype,"grayscale",void 0),Xt([Ya()],t.UI.prototype,"filter",void 0),Xt([qn()],t.UI.prototype,"placeholderColor",void 0),Xt([On({})],t.UI.prototype,"data",void 0),Xt([lr(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Th=Xt([ur(Ph),ur(kh),dr()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach((t=>this.add(t))),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return 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(){}},Xt([nr(dh)],t.Group.prototype,"__",void 0),Xt([Un(0)],t.Group.prototype,"width",void 0),Xt([Un(0)],t.Group.prototype,"height",void 0),t.Group=Xt([ur(t.Branch),pr()],t.Group);const Lh=Et.get("Leafer");t.Leafer=Sh=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&bn.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),Sh.list.add(this)}init(t,e){if(this.canvas)return;let s;const{config:n}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),s=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,Wt.assign(n,t));const r=this.canvas=i.canvas(n);this.__controllers.push(this.renderer=i.renderer(this,r,n),this.watcher=i.watcher(this,n),this.layouter=i.layouter(this,n)),this.isApp&&this.__setApp(),this.__checkAutoLayout(n,e),this.view=r.view,e||(this.selector=i.selector(this),this.interaction=i.interaction(this,r,this.selector,n),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=i.hitCanvasManager()),this.canvasManager=new Ft,s=n.start),this.hittable=n.hittable,this.fill=n.fill,this.canvasManager.add(r),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),Nr.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(no.RESTART):this.emitLeafer(no.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(no.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 ct(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 to(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 pt(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(no.BEFORE_READY),this.emitLeafer(no.READY),this.emitLeafer(no.AFTER_READY),Nr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(no.VIEW_READY),Nr.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Nr.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(no.VIEW_COMPLETED),Nr.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 St.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 no(t,this))}__listenEvents(){const t=Ct.start("FirstCreate "+this.innerName);this.once(no.START,(()=>Ct.end(t))),this.once(io.START,(()=>this.updateLazyBounds())),this.once(so.START,(()=>this.__onCreated())),this.once(so.END,(()=>this.__onViewReady())),this.__eventIds.push(this.on_(eo.DATA,this.__onWatchData,this),this.on_(io.END,this.__onLayoutEnd,this),this.on_(so.NEXT,this.__onNextRender,this))}__removeListenEvents(){this.off_(this.__eventIds),this.__eventIds.length=0}destroy(t){const e=()=>{if(!this.destroyed){Sh.list.remove(this);try{this.stop(),this.emitEvent(new no(no.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((()=>{Bn.clearRecycled()}),100)}catch(t){Lh.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new ma,Xt([nr(uh)],t.Leafer.prototype,"__",void 0),Xt([Un()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=Sh=Xt([pr()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}constructor(t){super(t)}},Xt([nr(gh)],t.Rect.prototype,"__",void 0),t.Rect=Xt([ur(Rh),dr(),pr()],t.Rect);const{copy:Dh,add:Ah,includes:Oh}=at,Ih=t.Rect.prototype,Mh=t.Group.prototype,Fh={};t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){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(),Dh(Fh,e),this.__updateRectRenderBounds(),t=!Oh(e,Fh)||void 0,t&&"hide"!==this.__.overflow&&Ah(e,Fh)):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))}},Xt([nr(ch)],t.Box.prototype,"__",void 0),Xt([Un(100)],t.Box.prototype,"width",void 0),Xt([Un(100)],t.Box.prototype,"height",void 0),Xt([On(!1)],t.Box.prototype,"resizeChildren",void 0),Xt([Vn("show")],t.Box.prototype,"overflow",void 0),Xt([lr(Ih.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),Xt([lr(Ih.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),Xt([lr(Ih.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),Xt([lr(Ih.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),Xt([lr(Ih.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),Xt([lr(Ih.__updateChange)],t.Box.prototype,"__updateRectChange",null),Xt([lr(Ih.__render)],t.Box.prototype,"__renderRect",null),Xt([lr(Mh.__render)],t.Box.prototype,"__renderGroup",null),t.Box=Xt([dr(),pr()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},Xt([nr(ph)],t.Frame.prototype,"__",void 0),Xt([qn("#FFFFFF")],t.Frame.prototype,"fill",void 0),Xt([Vn("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=Xt([pr()],t.Frame);const{moveTo:Wh,closePath:Uh,ellipse:Nh}=qi;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:i,innerRadius:s,startAngle:n,endAngle:r}=this.__,o=t/2,a=i/2,h=this.__.path=[];s?(n||r?(s<1&&Nh(h,o,a,o*s,a*s,0,n,r,!1),Nh(h,o,a,o,a,0,r,n,!0),s<1&&Uh(h)):(s<1&&(Nh(h,o,a,o*s,a*s),Wh(h,t,a)),Nh(h,o,a,o,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||r?(Wh(h,o,a),Nh(h,o,a,o,a,0,n,r,!1),Uh(h)):Nh(h,o,a,o,a)}},Xt([nr(fh)],t.Ellipse.prototype,"__",void 0),Xt([Yn(0)],t.Ellipse.prototype,"innerRadius",void 0),Xt([Yn(0)],t.Ellipse.prototype,"startAngle",void 0),Xt([Yn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=Xt([pr()],t.Ellipse);const{moveTo:zh,lineTo:jh,drawPoints:Yh}=qi,{rotate:Hh,getAngle:Xh,getDistance:Gh,defaultPoint:Vh}=I,{toBounds:qh}=rn;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Hh(i,e),i}set toPoint(t){this.width=Gh(Vh,t),this.rotation=Xh(Vh,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Yh(e,t.points,!1,t.closed):(zh(e,0,0),jh(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Yh(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&Ka.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?qh(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},Xt([nr(_h)],t.Line.prototype,"__",void 0),Xt([Hn("center")],t.Line.prototype,"strokeAlign",void 0),Xt([Un(0)],t.Line.prototype,"height",void 0),Xt([Yn()],t.Line.prototype,"points",void 0),Xt([Yn(0)],t.Line.prototype,"curve",void 0),Xt([Yn(!1)],t.Line.prototype,"closed",void 0),t.Line=Xt([pr()],t.Line);const{sin:Kh,cos:Zh,PI:$h}=Math,{moveTo:Qh,lineTo:Jh,closePath:tl,drawPoints:el}=qi,il=t.Line.prototype;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)el(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,n=e/2,r=i/2;Qh(t,n,0);for(let e=1;e<s;e++)Jh(t,n+n*Kh(2*e*$h/s),r-r*Zh(2*e*$h/s))}tl(t)}__updateRenderPath(){}__updateBoxBounds(){}},Xt([nr(yh)],t.Polygon.prototype,"__",void 0),Xt([Yn(3)],t.Polygon.prototype,"sides",void 0),Xt([Yn()],t.Polygon.prototype,"points",void 0),Xt([Yn(0)],t.Polygon.prototype,"curve",void 0),Xt([lr(il.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),Xt([lr(il.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=Xt([dr(),pr()],t.Polygon);const{sin:sl,cos:nl,PI:rl}=Math,{moveTo:ol,lineTo:al,closePath:hl}=qi;t.Star=class extends t.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];ol(o,n,0);for(let t=1;t<2*i;t++)al(o,n+(t%2==0?n:n*s)*sl(t*rl/i),r-(t%2==0?r:r*s)*nl(t*rl/i));hl(o)}},Xt([nr(mh)],t.Star.prototype,"__",void 0),Xt([Yn(5)],t.Star.prototype,"corners",void 0),Xt([Yn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=Xt([pr()],t.Star),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t),this.on_(Jr.LOADED,this.__onLoaded,this)}__onLoaded(t){"fill"===t.attrName&&t.attrValue.url===this.url&&(this.image=t.image)}destroy(){this.image=null,super.destroy()}},Xt([nr(Eh)],t.Image.prototype,"__",void 0),Xt([Un("")],t.Image.prototype,"url",void 0),t.Image=Xt([pr()],t.Image);const ll=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get ready(){return!this.url}constructor(t){super(t),this.canvas=i.canvas(this.__),this.context=this.canvas.context,t&&t.url&&this.drawImage(t.url)}drawImage(t){new Rn({url:t}).load((t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Jr(Jr.LOADED,{image:t}))}))}draw(t,e,i,s){const n=new j(t.worldTransform).invert(),r=new j;e&&r.translate(e.x,e.y),i&&("number"==typeof i?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=this.context=null),super.destroy()}},Xt([nr(Bh)],t.Canvas.prototype,"__",void 0),Xt([Ha(100)],t.Canvas.prototype,"width",void 0),Xt([Ha(100)],t.Canvas.prototype,"height",void 0),Xt([Ha(1)],t.Canvas.prototype,"pixelRatio",void 0),Xt([Ha(!0)],t.Canvas.prototype,"smooth",void 0),Xt([On(!1)],t.Canvas.prototype,"safeResize",void 0),Xt([Ha()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=Xt([pr()],t.Canvas);const{copyAndSpread:dl,includes:cl,spread:ul,setList:pl}=at;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:r,italic:o,textCase:a,textOverflow:l,padding:d}=t;t.__lineHeight=qa.number(e,n),t.__letterSpacing=qa.number(i,n),t.__padding=d?h.fourNumber(d):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n}px ${s}`,t.__clipText="show"!==l&&!t.__autoSize,t.__textDrawData=Ga.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&ul(a,i/2),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i);const l=!cl(h,a)||void 0;l?(pl(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;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&&!eh.running||super.__draw(t,e,i)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},Xt([nr(bh)],t.Text.prototype,"__",void 0),Xt([Un(0)],t.Text.prototype,"width",void 0),Xt([Un(0)],t.Text.prototype,"height",void 0),Xt([qn()],t.Text.prototype,"boxStyle",void 0),Xt([On(!1)],t.Text.prototype,"resizeFontSize",void 0),Xt([qn("#000000")],t.Text.prototype,"fill",void 0),Xt([Hn("outside")],t.Text.prototype,"strokeAlign",void 0),Xt([ir("all")],t.Text.prototype,"hitFill",void 0),Xt([Un("")],t.Text.prototype,"text",void 0),Xt([Un("")],t.Text.prototype,"placeholder",void 0),Xt([Un("caption")],t.Text.prototype,"fontFamily",void 0),Xt([Un(12)],t.Text.prototype,"fontSize",void 0),Xt([Un("normal")],t.Text.prototype,"fontWeight",void 0),Xt([Un(!1)],t.Text.prototype,"italic",void 0),Xt([Un("none")],t.Text.prototype,"textCase",void 0),Xt([Un("none")],t.Text.prototype,"textDecoration",void 0),Xt([Un(0)],t.Text.prototype,"letterSpacing",void 0),Xt([Un({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),Xt([Un(0)],t.Text.prototype,"paraIndent",void 0),Xt([Un(0)],t.Text.prototype,"paraSpacing",void 0),Xt([Un("x")],t.Text.prototype,"writingMode",void 0),Xt([Un("left")],t.Text.prototype,"textAlign",void 0),Xt([Un("top")],t.Text.prototype,"verticalAlign",void 0),Xt([Un(!0)],t.Text.prototype,"autoSizeAlign",void 0),Xt([Un("normal")],t.Text.prototype,"textWrap",void 0),Xt([Un("show")],t.Text.prototype,"textOverflow",void 0),t.Text=Xt([pr()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}constructor(t){super(t)}},Xt([nr(vh)],t.Path.prototype,"__",void 0),Xt([Hn("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=Xt([pr()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},Xt([nr(wh)],t.Pen.prototype,"__",void 0),Xt([(t,e)=>{Tn(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=Xt([ur(cs,["set","path","paint"]),pr()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:s,sky:n,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(s||r)&&(this.tree=this.addLeafer(s||{type:t.type||"design"})),(n||r)&&(this.sky=this.addLeafer(n)),r&&this.sky.add(this.editor=i.editor(r))}}__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(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout((()=>this.add(t,e)),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),void 0!==e&&(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every((t=>t.created))}__onReady(){this.children.every((t=>t.ready))&&super.__onReady()}__onViewReady(){this.children.every((t=>t.viewReady))&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){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&&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(io.END,(()=>this.__onReady())),t.once(so.START,(()=>this.__onCreated())),t.once(so.END,(()=>this.__onViewReady())),this.realCanvas&&this.__eventIds.push(t.on_(so.END,this.__onChildRenderEnd,this))}},t.App=Xt([pr()],t.App);const _l={},gl={isHoldSpaceKey:()=>gl.isHold("Space"),isHold:t=>_l[t],setDownCode(t){_l[t]||(_l[t]=!0)},setUpCode(t){_l[t]=!1}},fl={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 yl extends Zr{get spaceKey(){return gl.isHoldSpaceKey()}get left(){return fl.left(this)}get right(){return fl.right(this)}get middle(){return fl.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){It.changeName(t,e)}}t.PointerEvent=class extends yl{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=Xt([_r()],t.PointerEvent);const ml=t.PointerEvent,vl={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof ma?t:new ma(t)}static setData(t){this.data=t}static getValidMove(t,e,i){const{draggable:s,dragBounds:n}=t,r=t.getLocalPoint(i,null,!0);return I.move(r,e.x-t.x,e.y-t.y),n&&this.getMoveInDragBounds(t.__localBoxBounds,"parent"===n?t.parent.boxBounds:n,r,!0),"x"===s&&(r.y=0),"y"===s&&(r.x=0),r}static getMoveInDragBounds(t,e,i,s){const n=t.x+i.x,r=t.y+i.y,o=n+t.width,a=r+t.height,h=e.x+e.width,l=e.y+e.height;return s||(i=Object.assign({},i)),at.includes(t,e)?(n>e.x?i.x+=e.x-n:o<h&&(i.x+=h-o),r>e.y?i.y+=e.y-r:a<l&&(i.y+=l-a)):(n<e.x?i.x+=e.x-n:o>h&&(i.x+=h-o),r<e.y?i.y+=e.y-r:a>l&&(i.y+=l-a)),i}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(vl,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(vl,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(vl,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 at.set(i,e.x-t.x,e.y-t.y,t.x,t.y),at.unsign(i),i}assignMove(t){vl.x=t?this.totalX:this.moveX,vl.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=Xt([_r()],t.DragEvent);const wl=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=Xt([_r()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=Xt([_r()],t.MoveEvent),t.RotateEvent=class extends yl{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=Xt([_r()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=Xt([_r()],t.SwipeEvent),t.ZoomEvent=class extends yl{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=Xt([_r()],t.ZoomEvent),t.KeyEvent=class extends yl{},t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=Xt([_r()],t.KeyEvent);const xl={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:bl.getSwipeDirection(I.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 ma,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some((e=>e.draggable||e.editable||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},bl=xl,El=new ma,{getDragEventData:Bl,getDropEventData:Pl,getSwipeEventData:kl}=xl;class Cl{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Bl(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,r=t.DragEvent.list||this.draggableList||El;return this.dragging&&(n?e?El:new ma(i?[...s.list,...s.dragHoverExclude]:s.list):r)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&fl.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach((t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y}))}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],(e.draggable||e.editable)&&e.hitSelf&&!e.locked){this.draggableList=new ma(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:r,throughPath:o}=n;this.dragData=Bl(n,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=r,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(){const{running:e}=this.interaction,i=this.realDraggableList;if(i.length&&e){const{totalX:e,totalY:s}=this.dragData;i.forEach((i=>i.draggable&&i.move(t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:e,y:s}))))}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:r,throughPath:o}=s,a=Bl(s,e,e);if(o&&(a.throughPath=o),a.path=r,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const r=this.getList();this.dragging=!1,i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(I.getDistance(e,t)>n.config.pointer.swipeDistance){const t=kl(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=Pl(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Rl=Et.get("emit");const Tl=["move","zoom","rotate","key"];function Sl(t,e,i,s,n){if(Tl.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Dl(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&Ll(r,e,i,s,n)}}function Ll(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Dl(t,n)&&(ih.updateEventStyle&&!s&&ih.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=It.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Dl(t,e){return e&&e.has(t)}const Al={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:Ol,pathCanDrag:Il,pathHasOutside:Ml}=xl;class Fl{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&&fl.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&fl.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&gl.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(Al),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new ma(t),this.createTransformer(),this.dragger=new Cl(this),s&&(this.config=Wt.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(fl.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),fl.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=fl.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&fl.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=I.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;fl.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,gl.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;const{code:i}=e;this.downKeyMap[i]=!1,gl.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new ma),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach((t=>i.add(t))));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,r=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some((t=>Ol(e.path,t)));n<i.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}),i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,i){const{hitRadius:s,through:n}=this.p,{bottomList:r,target:o}=this;e.backgrounder||t.origin||o&&o.updateLayout();const a=this.selector.getByPoint(t,s,Object.assign({bottomList:r,name:t.type},i||{through:n}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Ml(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Il(t.path))&&!Ml(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y};return this.p.snap&&I.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)}),this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Ol(e.path,t.PointerEvent.LONG_TAP)||Ol(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new ct(this.canvas.bounds),this.shrinkCanvasBounds.spread(-("number"==typeof t?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(to.RESIZE,this.__onResize,this)],t.once(no.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],Ll(n,t,e,!0,s))return;n.isApp&&Sl(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&Sl(n,t,e,!1,s),Ll(n,t,e,!1,s))return}catch(t){Rl.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 Wl{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Wl.custom={};class Ul extends Ft{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new ma,this.pixelList=new ma}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),i.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),i.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:Nl,copy:zl,setRadius:jl}=I,Yl={},Hl=t.Leaf.prototype;Hl.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,n=i.width<10&&i.height<10;if(e.hitRadius&&(zl(Yl,t),jl(t=Yl,e.hitRadius)),Nl(t,i,Yl),e.hitBox||n){if(at.hitRadiusPoint(s.boxBounds,Yl))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Yl)},Hl.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},Hl.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},Hl.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},Hl.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Xl=new j,Gl=t.UI.prototype;Gl.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const t=this.__,{hitCanvasManager:i}=this.leafer||this.parent.leafer,s=(t.__pixelFill||t.__isCanvas)&&"pixel"===t.hitFill,n=t.__pixelStroke&&"pixel"===t.hitStroke,r=s||n;this.__hitCanvas||(this.__hitCanvas=r?i.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):i.getPathType(this));const o=this.__hitCanvas;if(r){const{renderBounds:i}=this.__layout,r=e.image.hitCanvasSize,a=o.hitScale=ut.set(0,0,r,r).getFitMatrix(i).a,{x:h,y:l,width:d,height:c}=ut.set(i).scale(a);o.resize({width:d,height:c,pixelRatio:1}),o.clear(),Bn.patternLocked=!0,this.__renderShape(o,{matrix:Xl.setWith(this.__world).scaleWith(1/a).invertWith().translate(-h,-l)},!s,!n),Bn.patternLocked=!1,o.resetTransform(),t.__isHitPixel=!0}else t.__isHitPixel&&(t.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(t)},Gl.__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:n,__strokeWidth:r}=e,o=e.stroke&&("path"===n||"pixel"===n&&!e.__pixelStroke)||"all"===n;if(!s&&!o)return!1;const a=2*t.radiusX;let h=a;if(o)switch(e.strokeAlign){case"inside":if(h+=2*r,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=r;break;case"outside":if(h+=2*r,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Vl=t.UI.prototype,ql=t.Rect.prototype,Kl=t.Box.prototype;ql.__updateHitCanvas=Kl.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Vl.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},ql.__hitFill=Kl.__hitFill=function(t){return this.__hitCanvas?Vl.__hitFill.call(this,t):at.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach((n=>t.rect(n.x,n.y-s,n.width,e<i?i:e)))},t.Group.prototype.pick=function(t,s){return s||(s=jt),this.updateLayout(),function(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=i.selector())}(this).getByPoint(t,s.hitRadius||0,Object.assign(Object.assign({},s),{target:this}))};const Zl=se.prototype;Zl.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Zl.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Zl.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),ut.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(ut.x,ut.y,ut.width||1,ut.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 $l={convert(t,e){const i=xl.getBase(t),s=Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===s.pointerType&&(s.tangentialPressure=t.tangentialPressure,s.tiltX=t.tiltX,s.tiltY=t.tiltY,s.twist=t.twist),s},convertMouse(t,e){const i=xl.getBase(t);return Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=$l.getTouch(t),s=xl.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})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},Ql={convert(t){const e=xl.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:Jl}=xl;class td extends Fl{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),window.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,s=t.length;i<s;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown(Ql.convert(t))}onKeyUp(t){this.keyUp(Ql.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu($l.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.config.pointer.touch||this.useMultiTouch||(this.usePointer||(this.usePointer=!0),this.pointerDown($l.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.config.pointer.touch||this.useMultiTouch||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=$l.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.config.pointer.touch||this.useMultiTouch||this.preventWindowPointer(t)||this.pointerUp($l.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown($l.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerMove($l.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerUp($l.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){const e=$l.getTouch(t),i=this.getLocal(e,!0),{preventDefault:s}=this.config.touch;(!0===s||"auto"===s&&Jl(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.usePointer||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown($l.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.usePointer||this.preventWindowPointer(t))return;const e=$l.getTouch(t);this.pointerMove($l.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.usePointer||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout((()=>{this.useTouch=!1}),500);const e=$l.getTouch(t);this.pointerUp($l.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||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(xl.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)))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},xl.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(t){if(this.useMultiTouch)return;this.preventDefaultWheel(t);const e=xl.getBase(t);Object.assign(e,this.getLocal(t));const i=t.scale/this.lastGestureScale,s=(t.rotation-this.lastGestureRotation)/Math.PI*180*(h.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},e),{scale:i*i})),this.rotate(Object.assign(Object.assign({},e),{rotation:s})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),"object"==typeof e[e.length-1]&&e.push("default"),this.canvas.view.style.cursor=e.map((t=>"object"==typeof t?`url(${t.url}) ${t.x||0} ${t.y||0}`:t)).join(",")}eachCursor(t,e,i=0){if(i++,t instanceof Array)t.forEach((t=>this.eachCursor(t,e,i)));else{const s="string"==typeof t&&Wl.get(t);s&&i<2?this.eachCursor(s,e,i):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function ed(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let r;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)r=s[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach((t=>{e.fillText(t.char,t.x,r.y)}));if(n){const{decorationColor:t,decorationHeight:r}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach((t=>n.forEach((i=>e.fillRect(t.x,t.y+i,t.width,r)))))}}function id(t,e){t.__.__font?ed(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function sd(t,e,i){const{strokeAlign:s}=e.__,n="string"!=typeof t;switch(s){case"center":i.setStroke(n?void 0:t,e.__.strokeWidth,e.__),n?od(t,!0,e,i):rd(e,i);break;case"inside":nd("inside",t,n,e,i);break;case"outside":nd("outside",t,n,e,i)}}function nd(t,e,i,s,n){const{__strokeWidth:r,__font:o}=s.__,a=n.getSameCanvas(!0,!0);a.setStroke(i?void 0:e,2*r,s.__),a.font=o,i?od(e,!0,s,a):rd(s,a),a.blendMode="outside"===t?"destination-out":"destination-in",ed(s,a),a.blendMode="normal",s.__worldFlipped?n.copyWorldByReset(a,s.__nowWorld):n.copyWorldToInner(a,s.__nowWorld,s.__layout.renderBounds),a.recycle(s.__nowWorld)}function rd(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:r}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)}));if(r){const{decorationHeight:t}=s;n.forEach((i=>r.forEach((s=>e.strokeRect(i.x,i.y+s,i.width,t)))))}}function od(t,e,i,s){let n;for(let r=0,o=t.length;r<o;r++)n=t[r],n.image&&$a.checkImage(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?rd(i,s):s.stroke(),s.restoreBlendMode()):e?rd(i,s):s.stroke())}function ad(t,e){t.__.dashPattern&&(e.beginPath(),t.__drawPathByData(e,t.__.__pathForArrow),e.dashPattern=null,e.stroke())}const{getSpread:hd,getOuterOf:ld,getByMove:dd,getIntersectData:cd}=at;let ud;function pd(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:n,blendMode:r,color:o,opacity:a}=e;return{type:n,blendMode:r,style:Va.string(o,a)};case"image":return $a.image(i,t,e,s,!ud||!ud[e.url]);case"linear":return Qa.linearGradient(e,s);case"radial":return Qa.radialGradient(e,s);case"angular":return Qa.conicGradient(e,s);default:return void 0!==e.r?{type:"solid",style:Va.string(e)}:void 0}}const _d={compute:function(t,e){const i=e.__,s=[];let n,r=i.__input[t];r instanceof Array||(r=[r]),ud=$a.recycleImage(t,i);for(let i,n=0,o=r.length;n<o;n++)i=pd(t,r[n],e),i&&s.push(i);i["_"+t]=s.length?s:void 0,s.length&&s[0].image&&(n=s[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=n:i.__pixelStroke=n},fill:function(t,e,i){i.fillStyle=t,id(e,i)},fills:function(t,e,i){let s;for(let n=0,r=t.length;n<r;n++){if(s=t[n],s.image){if($a.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&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),id(e,i),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),id(e,i),i.restoreBlendMode()):id(e,i)}},fillPathOrText:id,fillText:ed,stroke:function(t,e,i){const s=e.__,{__strokeWidth:n,strokeAlign:r,__font:o}=s;if(n)if(o)sd(t,e,i);else switch(r){case"center":i.setStroke(t,n,s),i.stroke(),s.__useArrow&&ad(e,i);break;case"inside":i.save(),i.setStroke(t,2*n,s),s.windingRule?i.clip(s.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const r=i.getSameCanvas(!0,!0);r.setStroke(t,2*n,s),e.__drawRenderPath(r),r.stroke(),s.windingRule?r.clip(s.windingRule):r.clip(),r.clearWorld(e.__layout.renderBounds),e.__worldFlipped?i.copyWorldByReset(r,e.__nowWorld):i.copyWorldToInner(r,e.__nowWorld,e.__layout.renderBounds),r.recycle(e.__nowWorld)}},strokes:function(t,e,i){const s=e.__,{__strokeWidth:n,strokeAlign:r,__font:o}=s;if(n)if(o)sd(t,e,i);else switch(r){case"center":i.setStroke(void 0,n,s),od(t,!1,e,i),s.__useArrow&&ad(e,i);break;case"inside":i.save(),i.setStroke(void 0,2*n,s),s.windingRule?i.clip(s.windingRule):i.clip(),od(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),o.setStroke(void 0,2*n,s),od(t,!1,e,o),s.windingRule?o.clip(s.windingRule):o.clip(),o.clearWorld(r),e.__worldFlipped?i.copyWorldByReset(o,e.__nowWorld):i.copyWorldToInner(o,e.__nowWorld,r),o.recycle(e.__nowWorld)}},strokeText:sd,drawTextStroke:rd,shape:function(t,e,i){const s=e.getSameCanvas(),n=t.__nowWorld;let r,o,a,h,{scaleX:l,scaleY:d}=n;if(l<0&&(l=-l),d<0&&(d=-d),e.bounds.includes(n))h=s,r=a=n;else{const{renderShapeSpread:s}=t.__layout,c=cd(s?hd(e.bounds,l===d?s*l:[s*d,s*l]):e.bounds,n);o=e.bounds.getFitMatrix(c);let{a:u,d:p}=o;if(o.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,d*=p),a=ld(n,o),r=dd(a,-o.e,-o.f),i.matrix){const{matrix:t}=i;o.multiply(t),u*=t.scaleX,p*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:o.withScale(u,p)})}return t.__renderShape(s,i),{canvas:s,matrix:o,bounds:r,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:d}}};let gd={};const{get:fd,rotateOfOuter:yd,translate:md,scaleOfOuter:vd,scale:wd,rotate:xd}=E;function bd(t,e,i,s,n,r,o){const a=fd();md(a,e.x+i,e.y+s),wd(a,n,r),o&&yd(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a}function Ed(t,e,i,s,n,r,o){const a=fd();md(a,e.x+i,e.y+s),n&&wd(a,n,r),o&&xd(a,o),t.transform=a}function Bd(t,e,i,s,n,r,o,a,h,l){const d=fd();if(h)if("center"===l)yd(d,{x:i/2,y:s/2},h);else switch(xd(d,h),h){case 90:md(d,s,0);break;case 180:md(d,i,s);break;case 270:md(d,0,i)}gd.x=e.x+n,gd.y=e.y+r,md(d,gd.x,gd.y),o&&vd(d,gd,o,a),t.transform=d}const{get:Pd,translate:kd}=E,Cd=new ct,Rd={},Td={};function Sd(t,e,i,s){const{blendMode:n,changeful:r,sync:o}=i;n&&(t.blendMode=n),r&&(t.changeful=r),o&&(t.sync=o),t.data=Ld(i,s,e)}function Ld(t,e,i){let{width:s,height:n}=i;t.padding&&(e=Cd.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{opacity:r,mode:o,align:a,offset:l,scale:d,size:c,rotation:u,repeat:p,filters:_}=t,g=e.width===s&&e.height===n,f={mode:o},y="center"!==a&&(u||0)%180==90,m=y?n:s,v=y?s:n;let w,x,b=0,E=0;if(o&&"cover"!==o&&"fit"!==o)(d||c)&&(h.getScaleData(d,c,i,Td),w=Td.scaleX,x=Td.scaleY);else if(!g||u){const t=e.width/m,i=e.height/v;w=x="fit"===o?Math.min(t,i):Math.max(t,i),b+=(e.width-s*w)/2,E+=(e.height-n*x)/2}if(a){const t={x:b,y:E,width:m,height:v};w&&(t.width*=w,t.height*=x),wt.toPoint(a,t,e,Rd,!0),b+=Rd.x,E+=Rd.y}switch(l&&(b+=l.x,E+=l.y),o){case"stretch":g||(s=e.width,n=e.height);break;case"normal":case"clip":(b||E||w||u)&&Ed(f,e,b,E,w,x,u);break;case"repeat":(!g||w||u)&&Bd(f,e,s,n,b,E,w,x,u,a),p||(f.repeat="repeat");break;default:w&&bd(f,e,b,E,w,x,u)}return f.transform||(e.x||e.y)&&(f.transform=Pd(),kd(f.transform,e.x,e.y)),w&&"stretch"!==o&&(f.scaleX=w,f.scaleY=x),f.width=s,f.height=n,r&&(f.opacity=r),_&&(f.filters=_),p&&(f.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat"),f}let Dd,Ad=new ct;const{isSame:Od}=at;function Id(t,e,i,s,n,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||Sd(n,s,i,r),!0}function Md(t,e){Ud(t,Jr.LOAD,e)}function Fd(t,e){Ud(t,Jr.LOADED,e)}function Wd(t,e,i){e.error=i,t.forceUpdate("surface"),Ud(t,Jr.ERROR,e)}function Ud(t,e,i){t.hasEvent(e)&&t.emitEvent(new Jr(e,i))}function Nd(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:zd,scale:jd,copy:Yd}=E,{ceil:Hd,abs:Xd}=Math;function Gd(t,i,s){let{scaleX:n,scaleY:r}=Bn.patternLocked?t.__world:t.__nowWorld;const o=n+"-"+r+"-"+s;if(i.patternId===o||t.destroyed)return!1;{n=Xd(n),r=Xd(r);const{image:t,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:p,transform:_,repeat:g}=a;u&&(l=zd(),Yd(l,_),jd(l,1/u,1/p),n*=u,r*=p),n*=s,r*=s,d*=n,c*=r;const f=d*c;if(!g&&f>e.image.maxCacheSize)return!1;let y=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;y>e&&(y=e)}f>y&&(h=Math.sqrt(f/y)),h&&(n/=h,r/=h,d/=h,c/=h),u&&(n/=u,r/=p),(_||1!==n||1!==r)&&(l||(l=zd(),_&&Yd(l,_)),jd(l,1/n,1/r));const m=t.getCanvas(Hd(d)||1,Hd(c)||1,a.opacity,a.filters),v=t.getPattern(m,g||e.origin.noRepeat||"no-repeat",l,i);return i.style=v,i.patternId=o,!0}}const{abs:Vd}=Math;const qd={image:function(t,e,i,s,n){let r,o;const a=Bn.get(i);return Dd&&i===Dd.paint&&Od(s,Dd.boxBounds)?r=Dd.leafPaint:(r={type:i.type,image:a},Dd=a.use>1?{leafPaint:r,paint:i,boxBounds:Ad.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Id(t,e,i,a,r,s),n&&(Md(t,o),Fd(t,o))):a.error?n&&Wd(t,o,a.error):(n&&(Nd(t,!0),Md(t,o)),r.loadId=a.load((()=>{Nd(t,!1),t.destroyed||(Id(t,e,i,a,r,s)&&(a.hasOpacityPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Fd(t,o)),r.loadId=null}),(e=>{Nd(t,!1),Wd(t,o,e),r.loadId=null})),t.placeholderColor&&setTimeout((()=>{a.ready||a.isPlacehold||(a.isPlacehold=!0,t.forceUpdate("surface"))}),100)),r},checkImage:function(t,i,s,n){const{scaleX:r,scaleY:o}=Bn.patternLocked?t.__world:t.__nowWorld,{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===r+"-"+o+"-"+a&&!eh.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||to.isResizing(t)||eh.running)){let{width:t,height:i}=h;t*=Vd(r)*a,i*=Vd(o)*a,h.scaleX&&(t*=h.scaleX,i*=h.scaleY),n=t*i>e.image.maxCacheSize}return n?(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()}(t,i,s,h),!0):(!s.style||s.sync||eh.running?Gd(t,s,a):s.patternTask||(s.patternTask=Bn.patternTasker.add((()=>Gt(this,void 0,void 0,(function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&Gd(t,s,a),t.forceUpdate("surface")}))),300)),!1)},createPattern:Gd,recycleImage:function(t,e){const i=e["_"+t];if(i instanceof Array){let s,n,r,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,Bn.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],o instanceof Array||(o=[o])),n.unload(i[h].loadId,!o.some((t=>t.url===a)))));return r}return null},createData:Sd,getPatternData:Ld,fillOrFitMode:bd,clipMode:Ed,repeatMode:Bd},{toPoint:Kd}=yt,Zd={},$d={};function Qd(t,e,i){if(e){let s;for(let n=0,r=e.length;n<r;n++)s=e[n],"string"==typeof s?t.addColorStop(n/(r-1),Va.string(s,i)):t.addColorStop(s.offset,Va.string(s.color,i))}}const{getAngle:Jd,getDistance:tc}=I,{get:ec,rotateOfOuter:ic,scaleOfOuter:sc}=E,{toPoint:nc}=yt,rc={},oc={};function ac(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=Jd(e,i);r=ec(),n?(sc(r,e,o/a*(s||1),1),ic(r,e,t+90)):(sc(r,e,1,o/a*(s||1)),ic(r,e,t))}return r}const{getDistance:hc}=I,{toPoint:lc}=yt,dc={},cc={};const uc={linearGradient:function(t,i){let{from:s,to:n,type:r,blendMode:o,opacity:a}=t;Kd(s||"top",i,Zd),Kd(n||"bottom",i,$d);const h=e.canvas.createLinearGradient(Zd.x,Zd.y,$d.x,$d.y);Qd(h,t.stops,a);const l={type:r,style:h};return o&&(l.blendMode=o),l},radialGradient:function(t,i){let{from:s,to:n,type:r,opacity:o,blendMode:a,stretch:h}=t;nc(s||"center",i,rc),nc(n||"bottom",i,oc);const l=e.canvas.createRadialGradient(rc.x,rc.y,0,rc.x,rc.y,tc(rc,oc));Qd(l,t.stops,o);const d={type:r,style:l},c=ac(i,rc,oc,h,!0);return c&&(d.transform=c),a&&(d.blendMode=a),d},conicGradient:function(t,i){let{from:s,to:n,type:r,opacity:o,blendMode:a,stretch:h}=t;lc(s||"center",i,dc),lc(n||"bottom",i,cc);const l=e.conicGradientSupport?e.canvas.createConicGradient(0,dc.x,dc.y):e.canvas.createRadialGradient(dc.x,dc.y,0,dc.x,dc.y,hc(dc,cc));Qd(l,t.stops,o);const d={type:r,style:l},c=ac(i,dc,cc,h||1,e.conicGradientRotate90);return c&&(d.transform=c),a&&(d.blendMode=a),d},getTransform:ac},{copy:pc,toOffsetOutBounds:_c}=at,gc={},fc={};function yc(t,i,s,n){const{bounds:r,shapeBounds:o}=n;if(e.fullImageShadow){if(pc(gc,t.bounds),gc.x+=i.x-o.x,gc.y+=i.y-o.y,s){const{matrix:t}=n;gc.x-=(r.x+(t?t.e:0)+r.width/2)*(s-1),gc.y-=(r.y+(t?t.f:0)+r.height/2)*(s-1),gc.width*=s,gc.height*=s}t.copyWorld(n.canvas,t.bounds,gc)}else s&&(pc(gc,i),gc.x-=i.width/2*(s-1),gc.y-=i.height/2*(s-1),gc.width*=s,gc.height*=s),t.copyWorld(n.canvas,o,s?gc:i)}const{toOffsetOutBounds:mc}=at,vc={};const wc={shadow:function(t,e,i){let s,n;const{__nowWorld:r,__layout:o}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=a.length-1;_c(l,fc),a.forEach(((a,g)=>{p.setWorldShadow(fc.offsetX+a.x*c,fc.offsetY+a.y*u,a.blur*c,Va.string(a.color)),n=a.spread?1+2*a.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,yc(p,fc,n,i),s=l,a.box&&(p.restore(),p.save(),h&&(p.copyWorld(p,l,r,"copy"),s=r),h?p.copyWorld(h,r,r,"destination-out"):p.copyWorld(i.canvas,d,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(p,s,r,a.blendMode):e.copyWorldToInner(p,s,o.renderBounds,a.blendMode),_&&g<_&&p.clearWorld(s,!0)})),p.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r,__layout:o}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=a.length-1;mc(l,vc),a.forEach(((a,g)=>{p.save(),p.setWorldShadow(vc.offsetX+a.x*c,vc.offsetY+a.y*u,a.blur*c),n=a.spread?1-2*a.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,yc(p,vc,n,i),p.restore(),h?(p.copyWorld(p,l,r,"copy"),p.copyWorld(h,r,r,"source-out"),s=r):(p.copyWorld(i.canvas,d,l,"source-out"),s=l),p.fillWorld(s,Va.string(a.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(p,s,r,a.blendMode):e.copyWorldToInner(p,s,o.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:xc}=Or;function bc(t,e,i,s,n,r){switch(e){case"grayscale":n.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,s){const n=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,n),s.recycle(n),Bc(t,e,i,1)}(t,i,s,n);break;case"opacity-path":Bc(t,i,s,r);break;case"path":i.restore()}}function Ec(t){return t.getSameCanvas(!1,!0)}function Bc(t,e,i,s){const n=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,n),i.recycle(n)}t.Group.prototype.__renderMask=function(t,e){let i,s,n,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++)i=h[l],a=i.__.mask,a&&(o&&(bc(this,o,t,n,s,r),s=n=null),"path"===a||"clipping-path"===a?(i.opacity<1?(o="opacity-path",r=i.opacity,n||(n=Ec(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=Ec(t)),n||(n=Ec(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a)||xc(i,e)||i.__render(n||t,e);bc(this,o,t,n,s,r)};const Pc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",kc=Pc+"_#~&*+\\=|≮≯≈≠=…",Cc=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 Rc(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Tc=Rc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Sc=Rc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Lc=Rc(Pc),Dc=Rc(kc),Ac=Rc("- —/~|┆·");var Oc;!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"}(Oc||(Oc={}));const{Letter:Ic,Single:Mc,Before:Fc,After:Wc,Symbol:Uc,Break:Nc}=Oc;function zc(t){return Tc[t]?Ic:Ac[t]?Nc:Sc[t]?Fc:Lc[t]?Wc:Dc[t]?Uc:Cc.test(t)?Mc:Ic}const jc={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Yc(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:Hc}=jc,{Letter:Xc,Single:Gc,Before:Vc,After:qc,Symbol:Kc,Break:Zc}=Oc;let $c,Qc,Jc,tu,eu,iu,su,nu,ru,ou,au,hu,lu,du,cu,uu,pu,_u=[];function gu(t,e){ru&&!nu&&(nu=ru),$c.data.push({char:t,width:e}),Jc+=e}function fu(){tu+=Jc,$c.width=Jc,Qc.words.push($c),$c={data:[]},Jc=0}function yu(){du&&(cu.paraNumber++,Qc.paraStart=!0,du=!1),ru&&(Qc.startCharSize=nu,Qc.endCharSize=ru,nu=0),Qc.width=tu,uu.width?Hc(Qc):pu&&mu(),_u.push(Qc),Qc={words:[]},tu=0}function mu(){tu>(cu.maxWidth||0)&&(cu.maxWidth=tu)}const{top:vu,right:wu,bottom:xu,left:bu}=t.Direction4;function Eu(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const Bu={getDrawData:function(t,i){"string"!=typeof t&&(t=String(t));let s=0,n=0,r=i.__getInput("width")||0,o=i.__getInput("height")||0;const{textDecoration:a,__font:h,__padding:l}=i;l&&(r?(s=l[bu],r-=l[wu]+l[bu]):i.autoSizeAlign||(s=l[bu]),o?(n=l[vu],o-=l[vu]+l[xu]):i.autoSizeAlign||(n=l[vu]));const d={bounds:{x:s,y:n,width:r,height:o},rows:[],paraNumber:0,font:e.canvas.font=h};return function(t,i,s){cu=t,_u=t.rows,uu=t.bounds,pu=!uu.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:r,textCase:o}=s,{canvas:a}=e,{width:h,height:l}=uu;if(h||l||n||"none"!==o){const t="none"!==s.textWrap,e="break"===s.textWrap;du=!0,au=null,nu=su=ru=Jc=tu=0,$c={data:[]},Qc={words:[]};for(let s=0,l=i.length;s<l;s++)iu=i[s],"\n"===iu?(Jc&&fu(),Qc.paraEnd=!0,yu(),du=!0):(ou=zc(iu),ou===Xc&&"none"!==o&&(iu=Yc(iu,o,!Jc)),su=a.measureText(iu).width,n&&(n<0&&(ru=su),su+=n),hu=ou===Gc&&(au===Gc||au===Xc)||au===Gc&&ou!==qc,lu=!(ou!==Vc&&ou!==Gc||au!==Kc&&au!==qc),eu=du&&r?h-r:h,t&&h&&tu+Jc+su>eu&&(e?(Jc&&fu(),tu&&yu()):(lu||(lu=ou===Xc&&au==qc),hu||lu||ou===Zc||ou===Vc||ou===Gc||Jc+su>eu?(Jc&&fu(),tu&&yu()):tu&&yu()))," "===iu&&!0!==du&&tu+Jc===0||(ou===Zc?(" "===iu&&Jc&&fu(),gu(iu,su),fu()):hu||lu?(Jc&&fu(),gu(iu,su)):gu(iu,su)),au=ou);Jc&&fu(),tu&&yu(),_u.length>0&&(_u[_u.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{cu.paraNumber++,tu=a.measureText(t).width,_u.push({x:r||0,text:t,width:tu,paraStart:!0}),pu&&mu()}))}(d,t,i),l&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Eu(e,"x",t[bu]);break;case"right":Eu(e,"x",-t[wu])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Eu(e,"y",t[vu]);break;case"bottom":Eu(e,"y",-t[xu])}}(l,d,i,r,o),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:p,y:_,width:g,height:f}=s,y=r*n+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":_+=(f-y)/2;break;case"bottom":_+=f-y}m+=_;let v,w,x,b=g||u?g:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],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&&o>0&&(m+=c),v.y=m,m+=r,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+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:n,paraIndent:r,letterSpacing:o}=e;let a,h,l,d,c,u;s.forEach((t=>{t.words&&(l=r&&t.paraStart?r:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-l)/(u-1):0,d=o||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach(((e,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach((t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==n||i===u-1||(a+=h,t.width+=h)}))),t.words=null)}))}(d,i,r),d.overflow&&function(t,i,s,n){if(!n)return;const{rows:r,overflow:o}=t;let{textOverflow:a}=i;if(r.splice(o),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=s+n-l;("none"===i.textWrap?r:[r[o-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<d));s--){if(h<d&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(d,i,s,r),"none"!==a&&function(t,e){let i;const{fontSize:s,textDecoration:n}=e;switch(t.decorationHeight=s/11,"object"==typeof n?(i=n.type,n.color&&(t.decorationColor=Va.string(n.color))):i=n,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(d,i),d}};const Pu={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!Va.object)return t;t=Va.object(t)}let s=void 0===t.a?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign(Ga,Bu),Object.assign(Va,Pu),Object.assign(Za,_d),Object.assign($a,qd),Object.assign(Qa,uc),Object.assign(Ja,wc),Object.assign(i,{interaction:(t,e,i,s)=>new td(t,e,i,s),hitCanvas:(t,e)=>new xa(t,e),hitCanvasManager:()=>new Ul}),Ba();class ku extends hh{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}function Cu(t,e){return Ln(t,(t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?ih.setStyleName(this,e,i):ih.set(this,i):this.__layout.stateStyleChanged=!0}})))}function Ru(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}})))}function Tu(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 Su(t,e){"object"!=typeof e&&(e=void 0),Au(t,e,"in")}function Lu(t,e){const{normalStyle:i}=t;"object"!=typeof e&&(e=void 0),i&&(e||(e=i),Au(t,e,"out"))}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;t instanceof Array?t.forEach((t=>this.__loadRobot(t,e,e+=t.total||1))):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),void 0!==t)if("number"==typeof t)this.now=t;else if("object"==typeof t){const e=t instanceof Array,i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=Bn.get(t);s.ready?this.__createFrames(s,t,e,i):s.load((()=>this.__createFrames(s,t,e,i)))}__createFrames(t,e,i,s){const{offset:n,size:r,total:o}=e,{width:a,height:h}=r&&("number"==typeof r?{width:r,height:r}:r)||(o>1?this:t);let l=n?n.x:0,d=n?n.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 Jr(Jr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),void 0!==n.loop&&(s=n.loop)),this.__timer=setTimeout((()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)}),1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},Xt([nr(ku)],t.Robot.prototype,"__",void 0),Xt([Un()],t.Robot.prototype,"robot",void 0),Xt([On()],t.Robot.prototype,"actions",void 0),Xt([On("")],t.Robot.prototype,"action",void 0),Xt([qn(0)],t.Robot.prototype,"now",void 0),Xt([On(12)],t.Robot.prototype,"FPS",void 0),Xt([On(!0)],t.Robot.prototype,"loop",void 0),t.Robot=Xt([pr()],t.Robot),St.add("robot");const Du={};function Au(t,e,i){const{normalStyle:s}=t;e||(e=Du),e.scale&&(h.assignScale(e,e.scale),delete e.scale),e!==Du&&ih.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&Yt(i[s])&&Yt(e[s])&&(s="transition");return Yt(e[s])?i[s]:e[s]}(i,e,t);const r=n?function(t,e){const i=Mu(e,t),s=t.animate();s&&Mu(i,t,s.fromStyle);return i}(t,e):void 0;ih.canAnimate&&Ou(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const o=Ou(t);if(o){const{animation:s}=o;if(s){const r=t.animate(s,void 0,"animation",!0);Object.assign(o,r.endingStyle),"in"!==i||e.animation!==s?r.kill():n=!1,delete o.animation}t.normalStyle=Iu(o,t),t.set(o,"temp")}else t.normalStyle=void 0;if(n){const e=Iu(r,t);t.set(r,"temp"),t.animate([r,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function Ou(t){let e;const i={},s=Tu(t),n=s?t.state||s.state:t.state,r=n&&t.states[n];r&&ih.isState(n,t,s)&&(e=Fu(i,r));const o=i.selectedStyle||t.selectedStyle;o&&ih.isSelected(t,s)&&(e=Fu(i,o));const a=i.placeholderStyle||t.placeholderStyle;if(a&&ih.isPlacehold(t,s)&&(e=Fu(i,a)),ih.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Fu(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&ih.isFocus(t,s)&&(e=Fu(i,n));const r=i.hoverStyle||t.hoverStyle;r&&ih.isHover(t,s)&&(e=Fu(i,r));const o=i.pressStyle||t.pressStyle;o&&ih.isPress(t,s)&&(e=Fu(i,o))}return e?i:void 0}function Iu(t,e,i,s){const n=i?t:{},r=i||t;for(let t in r)s&&ih.animateExcludes[t]||(n[t]=e[t]);return n}function Mu(t,e,i){return Iu(t,e,i,!0)}function Fu(t,e){return Object.assign(t,e),!0}function Wu(t,e){const i=t[e];i&&Su(t,i),t.button&&Nu(t.children,e)}function Uu(t,e,i){i||(i=t.states[e]),Su(t,i),t.button&&Nu(t.children,null,e)}function Nu(t,e,i){if(!t)return;let s,n;for(let r=0,o=t.length;r<o;r++){if(s=t[r],e){switch(n=!0,e){case"hoverStyle":ih.isHover(s)&&(n=!1);break;case"pressStyle":ih.isPress(s)&&(n=!1);break;case"focusStyle":ih.isFocus(s)&&(n=!1)}n&&Wu(s,e)}else void 0!==i&&Uu(s,i);s.isBranch&&Nu(s.children,e,i)}}function zu(t,e){const i=t[e];i&&Lu(t,i),t.button&&Yu(t.children,e)}function ju(t,e,i){Lu(t,i),t.button&&Yu(t.children,null,e)}function Yu(t,e,i){if(!t)return;let s;for(let n=0,r=t.length;n<r;n++)s=t[n],e?zu(s,e):void 0!==i&&ju(s,i),s.isBranch&&Yu(s.children,e,i)}function Hu(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const r=Tu(e,i);r&&(s=n[t](r))}return s}function Xu(t,e,i){let s=e[t];if(!s&&i){const n=Tu(e,i);n&&(s=n[t])}return s}St.add("state"),ih.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},ih.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=Tu(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},ih.isSelected=function(t,e){return Xu("selected",t,e)},ih.isDisabled=function(t,e){return Xu("disabled",t,e)},ih.isFocus=function(t,e){return Hu("isFocus",t,e)},ih.isHover=function(t,e){return Hu("isHover",t,e)},ih.isPress=function(t,e){return Hu("isPress",t,e)},ih.isPlacehold=function(t,e){return t.__.__isPlacehold},ih.isDrag=function(t,e){return Hu("isDrag",t,e)},ih.setStyleName=function(t,e,i){i?Uu(t,e,t[e]):ju(t,e,t[e])},ih.set=function(t,e){const i=t.states[e];i?Uu(t,e,i):ju(t,e,i)},ih.getStyle=Ou,ih.updateStyle=Au,ih.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:Wu(e,"hoverStyle");break;case t.PointerEvent.LEAVE:zu(e,"hoverStyle");break;case t.PointerEvent.DOWN:Wu(e,"pressStyle");break;case t.PointerEvent.UP:zu(e,"pressStyle")}};const Gu=t.UI.prototype;t.UI.addAttr("selected",!1,Cu,"selectedStyle"),t.UI.addAttr("disabled",!1,Cu,"disabledStyle"),t.UI.addAttr("states",{},Ru),t.UI.addAttr("state","",Cu),t.UI.addAttr("normalStyle",void 0,On),t.UI.addAttr("hoverStyle",void 0,Ru),t.UI.addAttr("pressStyle",void 0,Ru),t.UI.addAttr("focusStyle",void 0,Ru),t.UI.addAttr("selectedStyle",void 0,Ru),t.UI.addAttr("disabledStyle",void 0,Ru),t.UI.addAttr("placeholderStyle",void 0,Ru),t.UI.addAttr("button",!1,On),Gu.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?Wu(this,"focusStyle"):zu(this,"focusStyle")}))},Gu.updateState=function(){ih.updateStyle(this,void 0,"in")};const Vu=t.Text.prototype,qu="text";Tn(Vu,qu,Object.assign(Object.assign({},Sn(Vu,qu)),{set(t){const e=this,i=e.text;e.__setAttr(qu,t)&&(zn(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:Ku,sin:Zu,pow:$u,sqrt:Qu,abs:Ju,ceil:tp,floor:ep,round:ip,PI:sp}=Math,np=5*sp,rp=1.70158,op=2.5949095,ap=7.5625,hp=2.75;function lp(t){return e=>$u(e,t)}function dp(t){return e=>1-$u(1-e,t)}function cp(t){return e=>e<.5?.5*$u(2*e,t):1-.5*$u(2-2*e,t)}function up(t){return t<1/hp?ap*t*t:t<2/hp?ap*(t-=1.5/hp)*t+.75:t<2.5/hp?ap*(t-=2.25/hp)*t+.9375:ap*(t-=2.625/hp)*t+.984375}function pp(t,e,i,s){const n={};return r=>{const o=~~(1e4*r),a=n[o];if(a)return a;let h,l,d,c=r;for(let e=0;e<8&&(h=1-c,d=_p(c,t,i)-r,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Ju(l)<1e-6));e++)c-=d/l;return n[o]=_p(c,e,s)}}function _p(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const gp={get(t){const{list:e}=gp;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){gp.list[t]=e},list:{linear:t=>t,ease:pp(.25,.1,.25,1),"ease-in":pp(.42,0,1,1),"ease-out":pp(0,0,.58,1),"ease-in-out":pp(.42,0,.58,1),"sine-in":t=>1-Ku(t*sp*.5),"sine-out":t=>Zu(t*sp*.5),"sine-in-out":t=>.5*(1-Ku(t*sp)),"quad-in":lp(2),"quad-out":dp(2),"quad-in-out":cp(2),"cubic-in":lp(3),"cubic-out":dp(3),"cubic-in-out":cp(3),"quart-in":lp(4),"quart-out":dp(4),"quart-in-out":cp(4),"quint-in":lp(5),"quint-out":dp(5),"quint-in-out":cp(5),"expo-in":t=>t?$u(2,10*t-10):0,"expo-out":t=>1===t?1:1-$u(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*$u(2,2*t*10-10):.5*(2-$u(2,10-2*t*10)),"circ-in":t=>1-Qu(1-$u(t,2)),"circ-out":t=>Qu(1-$u(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Qu(1-$u(2*t,2))):.5*(Qu(1-$u(2-2*t,2))+1),"back-in":t=>((rp+1)*t-rp)*t*t,"back-out":t=>(t-=1)*t*((rp+1)*t+rp)+1,"back-in-out":t=>t<.5?(t*=2)*t*((op+1)*t-op)*.5:.5*((t=2*t-2)*t*((op+1)*t+op)+2),"elastic-in":t=>0===t||1===t?t:-$u(2,10*(t-1))*Zu((t-1.1)*np),"elastic-out":t=>0===t||1===t?t:$u(2,-10*t)*Zu((t-.1)*np)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-$u(2,10*((t*=2)-1))*Zu((t-1.1)*np)*.5:$u(2,10*(1-(t*=2)))*Zu((t-1.1)*np)*.5+1,"bounce-in":t=>1-up(1-t),"bounce-out":up,"bounce-in-out":t=>t<.5?.5*(1-up(1-2*t)):.5*(1+up(2*t-1)),"cubic-bezier":pp,steps:function(t,e="floor"){return i=>("floor"===e?ep(i*t):"ceil"===e?tp(i*t):ip(i*t))/t}}};function fp(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 yp{}yp.CREATED="created",yp.PLAY="play",yp.PAUSE="pause",yp.STOP="stop",yp.SEEK="seek",yp.UPDATE="update",yp.COMPLETED="completed";t.Animate=class extends oo{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&"number"==typeof n&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=e instanceof Array?e:e?[e]:[];const{easing:n,attrs:r}=this;this.easingFn=gp.get(n),(r||this.attrsMap)&&(this.attrsMap=r?r.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(yp.PLAY,this))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emit(yp.PAUSE,this))}stop(){this.destroyed||(this.complete(),this.emit(yp.STOP,this))}seek(t){this.destroyed||("object"==typeof t&&(t=qa.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(yp.SEEK,this))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,r=!(n>1)||this.join;let o,a,h,l,d,c=0,u=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(a=i[s],l=a.style||a,o||(o=r?t:l),h={style:l,beforeStyle:{}},d=1,a.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:r,loop:o}=a;r&&(h.swing="number"==typeof r?r:2,d=2*h.swing-1),o&&(h.loop=d="number"==typeof o?o: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),n&&(h.easingFn=gp.get(n))}if(h.autoDuration||void 0!==h.duration||(n>1?s>0||r?u+=d:h.duration=0:h.duration=this.duration),n>1)this.setBefore(h,l,o);else{for(let e in l)h.beforeStyle[e]=t[e];this.fromStyle=h.beforeStyle,this.toStyle=h.style}o=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(yp.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:n,target:r}=this;for(let o in e)void 0===s[o]&&(s[o]=n[o]=e===i?i[o]:r[o]),t.beforeStyle[o]=void 0===i[o]?n[o]:i[o],n[o]=e[o]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],void 0===e.duration&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),e.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout((()=>{this.timer=0,this.begin()}),e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout((()=>{this.timer=0,this.begin()}),t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emit(yp.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,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:r}=this;let{betweenStyle:o}=this.frame;o||(o=this.frame.betweenStyle={}),sh.setBetweenStyle(o,s,n,e,t,r,i),this.setStyle(o)}this.emit(yp.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)}},Xt([fp("ease")],t.Animate.prototype,"easing",void 0),Xt([fp(0)],t.Animate.prototype,"delay",void 0),Xt([fp(.2)],t.Animate.prototype,"duration",void 0),Xt([fp("auto")],t.Animate.prototype,"ending",void 0),Xt([fp(!1)],t.Animate.prototype,"reverse",void 0),Xt([fp(!1)],t.Animate.prototype,"swing",void 0),Xt([fp(!1)],t.Animate.prototype,"loop",void 0),Xt([fp(0)],t.Animate.prototype,"loopDelay",void 0),Xt([fp(1)],t.Animate.prototype,"speed",void 0),Xt([fp(!0)],t.Animate.prototype,"autoplay",void 0),Xt([fp()],t.Animate.prototype,"join",void 0),Xt([fp()],t.Animate.prototype,"attrs",void 0),t.Animate=Xt([ur(mo)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every((t=>t.completed))}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter((t=>{const{completed:e}=t;return e&&t.destroy(),!e}))),this.list=e.map((e=>{const s=e.target?e:new t.Animate(this.target,e,i);return Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s}))}play(){this.each((t=>t.play()))}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)}},t.AnimateList=Xt([ur(mo)],t.AnimateList);const mp={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"},vp=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,wp=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,xp=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,bp=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Ep=parseInt,Bp=parseFloat,{round:Pp}=Math;let kp={},Cp=0;function Rp(t){let e,i,s,n=1;switch(t.length){case 9:e=Ep(t.slice(1,3),16),i=Ep(t.slice(3,5),16),s=Ep(t.slice(5,7),16),n=Ep(t.slice(7,9),16)/255;break;case 7:e=Ep(t.slice(1,3),16),i=Ep(t.slice(3,5),16),s=Ep(t.slice(5,7),16);break;case 5:e=Ep(t[1]+t[1],16),i=Ep(t[2]+t[2],16),s=Ep(t[3]+t[3],16),n=Ep(t[4]+t[4],16)/255;break;case 4:e=Ep(t[1]+t[1],16),i=Ep(t[2]+t[2],16),s=Ep(t[3]+t[3],16);break;case 3:e=i=s=Ep(t[1]+t[2],16);break;case 2:e=i=s=Ep(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const Tp=1/6,Sp=.5,Lp=2/3,Dp=1/3;function Ap(t,e,i){return i<0?i++:i>1&&i--,i<Tp?t+6*(e-t)*i:i<Sp?e:i<Lp?t+(e-t)*(Lp-i)*6:t}function Op(t,e,i,s=1){let n,r,o;if(t/=360,i/=100,0===(e/=100))n=r=o=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=Ap(a,s,t+Dp),r=Ap(a,s,t),o=Ap(a,s,t-Dp)}return{r:Pp(255*n),g:Pp(255*r),b:Pp(255*o),a:s}}St.add("color"),Va.object=function(t,e){let i,s=void 0!==e&&1!==e;if("string"==typeof t){const e=kp[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Rp(t);break;case"R":case"r":"("===t[4]&&wp.test(t)?i=function(t){const e=wp.exec(t);return{r:Ep(e[1]),g:Ep(e[2]),b:Ep(e[3]),a:Bp(e[4])}}(t):"("===t[3]&&vp.test(t)&&(i=function(t){const e=vp.exec(t);return{r:Ep(e[1]),g:Ep(e[2]),b:Ep(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&bp.test(t)?i=function(t){const e=bp.exec(t);return Op(Bp(e[1]),Bp(e[2]),Bp(e[3]),Bp(e[4]))}(t):"("===t[3]&&xp.test(t)&&(i=function(t){const e=xp.exec(t);return Op(Bp(e[1]),Bp(e[2]),Bp(e[3]),1)}(t))}if(!i){const e=mp[t.toLowerCase()];e&&(i=Rp("#"+e))}i&&(Cp++,Cp>1e4&&(kp={},Cp=0),kp[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:Ip}=Math,{fourNumber:Mp}=h,Fp={fill:jp,stroke:jp,cornerRadius:(t,e,i)=>"number"==typeof t&&"number"==typeof e?Np(t,e,i):(t=Mp(t),e=Mp(e),t.map(((t,s)=>Np(t,e[s],i)))),text(t,e,i){if("string"==typeof t&&"string"==typeof e){const s=t.length,n=e.length,r=Np(s,n,i,1);return s<n?e.substring(0,r):t.substring(0,r)}return"number"==typeof t||"number"==typeof e?h.float(Np(t,e,i),Math.max(Up(t),Up(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return sh.setBetweenStyle(n,t,e,n,i,s),n},shadow:Yp,innerShadow:Yp},Wp={value:function(t,e,i){const s="number"==typeof t,n="number"==typeof e;return s&&n?t+(e-t)*i:n||s?Np(t,e,i):t},number:Np,color:zp,setBetweenStyle:function(t,e,i,s,n,r,o){let a,h,l;const{list:d,value:c}=sh;for(let u in s)o&&!o[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,r)))}};function Up(t){const e=String(t).split(".")[1];return e?e.length:0}function Np(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?Ip(n):n}function zp(t,e,i){t=Va.object(t),e=Va.object(e);const s=Np(t.r,e.r,i,1)+","+Np(t.g,e.g,i,1)+","+Np(t.b,e.b,i,1),n=Np(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function jp(t,e,i){return"string"==typeof t&&"string"==typeof e?zp(t,e,i):e}function Yp(t,e,i){return t instanceof Array||e instanceof Array?e:(e=e||{},{x:Np((t=t||{}).x,e.x,i),y:Np(t.y,e.y,i),blur:Np(t.blur,e.blur,i),spread:Np(t.spread,e.spread,i),color:zp(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}St.add("animate","color"),ih.canAnimate=!0,Object.assign(sh.list,Fp),Object.assign(sh,Wp);const Hp=t.UI.prototype;t.UI.addAttr("animation",void 0,(function(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}})))})),t.UI.addAttr("animationOut",void 0,On),t.UI.addAttr("transition",!0,On),t.UI.addAttr("transitionOut",void 0,On),Hp.animate=function(e,i,s,n){if(void 0===e)return this.__animate;let r=e instanceof Array&&!i&&s?new t.AnimateList(this,e,n):new t.Animate(this,e,i,n);this.killAnimate(s,r.toStyle);const o=this.__animate;return o&&(r instanceof t.AnimateList?r.list.unshift(o):r=new t.AnimateList(this,[o,r])),this.__animate=r},Hp.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},Hp.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(yp.COMPLETED,e)};const Xp=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Gp=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Vp}=Math,{getDerivative:qp}=De,Kp={getDistance(t,e,i,s,n,r,o,a,h=1){let l,d,c,u,p,_,g=0,f=h/2;for(let h=0;h<Xp.length;h++)l=f*(1+Xp[h]),d=f*(1-Xp[h]),c=qp(l,t,i,n,o),u=qp(l,e,s,r,a),p=qp(d,t,i,n,o),_=qp(d,e,s,r,a),g+=Gp[h]*(Vp(c*c+u*u)+Vp(p*p+_*_));return g*f},getRotation(t,e,i,s,n,r,o,a,h){const l=qp(t,e,s,r,a),c=qp(t,i,n,o,h);return Math.atan2(c,l)/d},getT(t,e,i,s,n,r,o,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>_;)Zp(i,s,n,r,o,a,h,l,p)<t?c=p:u=p,p=(c+u)/2;return p},cut(t,e,i,s,n,r,o,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*r,p=d*n+e*o,_=d*r+e*a,g=d*c+e*p,f=d*u+e*_,y=d*g+e*(d*p+e*(d*o+e*h)),m=d*f+e*(d*_+e*(d*a+e*l));t.push(oe.C,c,u,g,f,y,m)}},{getDistance:Zp}=Kp,{M:$p,L:Qp,C:Jp,Z:t_}=oe,e_={},i_={},s_={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case $p:case Qp:s_.transformPoints(t,e,s,1),s+=3;break;case Jp:s_.transformPoints(t,e,s,3),s+=7;break;case t_:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,r=n+2*s;n<r;n+=2)e_.x=t[n],e_.y=t[n+1],E.toOuterPoint(e,e_),t[n]=e_.x,t[n+1]=e_.y},getMotionPathData(t){let e,i,s,n,r=0,o=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case $p:case Qp:i=t[a+1],s=t[a+2],e=n===Qp&&a>0?I.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Jp:i=t[a+5],s=t[a+6],e=Kp.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 t_:a+=1;default:e=0}o.push(e),r+=e}return{total:r,segments:o,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=qa.number(e,t.total);let r,o,a,h,l,d,c,u,p,_=0,g={},f=0,y=0,m=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case $p:case Qp:if(o=n[f+1],a=n[f+2],r=s[y],_+r>=e||!t.total)return f||(m=o,v=a),i_.x=m,i_.y=v,g.x=o,g.y=a,I.getDistancePoint(i_,g,e-_,!0),g.rotation=I.getAngle(i_,g),g;m=o,v=a,f+=3;break;case Jp:if(o=n[f+5],a=n[f+6],r=s[y],_+r>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],p=Kp.getT(e-_,r,m,v,l,d,c,u,o,a,i),De.getPointAndSet(p,m,v,l,d,c,u,o,a,g),g.rotation=Kp.getRotation(p,m,v,l,d,c,u,o,a),g;m=o,v=a,f+=7;break;case t_:f+=1;default:r=0}y++,_+=r}return g},getDistancePath(t,e,i){const{segments:s,data:n}=t,r=[];e=qa.number(e,t.total);let o,a,h,l,d,c,u,p,_,g=0,f={},y=0,m=0,v=0,w=0;const x=n.length;for(;y<x;){switch(l=n[y],l){case $p:case Qp:if(a=n[y+1],h=n[y+2],o=s[m],g+o>=e||!t.total)return y||(v=a,w=h),i_.x=v,i_.y=w,f.x=a,f.y=h,I.getDistancePoint(i_,f,e-g,!0),r.push(l,f.x,f.y),r;v=a,w=h,y+=3,r.push(l,v,w);break;case Jp:if(d=n[y+1],c=n[y+2],u=n[y+3],p=n[y+4],a=n[y+5],h=n[y+6],o=s[m],g+o>=e)return _=Kp.getT(e-g,o,v,w,d,c,u,p,a,h,i),Kp.cut(r,_,v,w,d,c,u,p,a,h),r;v=a,w=h,y+=7,r.push(l,d,c,u,p,a,h);break;case t_:y+=1,r.push(l);default:o=0}m++,g+=o}return r}};function n_(t){return Ln(t,(t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!Yt(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}St.add("motion-path"),sh.register("motion",(function(t,e,i,s){return t?"object"==typeof t&&(t=qa.number(t,s.getMotionTotal())):t=0,e?"object"==typeof e&&(e=qa.number(e,s.getMotionTotal())):e=0,sh.number(t,e,i)})),sh.register("motionRotation",(function(t,e,i){return sh.number(t,e,i)}));const r_=t.UI.prototype,{updateMatrix:o_,updateAllMatrix:a_}=kr,{updateBounds:h_}=Mr;function l_(t){const{motion:e,leaferIsCreated:i}=t;if(!Yt(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=c_(t);i.total&&(t.__.__pathForRender=s_.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(a_(t),h_(t,t)):o_(t));i&&(t.leafer.created=!0)}}function d_(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 c_(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=s_.getMotionPathData(t.getPath(!0,!0))}t.UI.addAttr("motionPath",void 0,n_),t.UI.addAttr("motionPrecision",1,n_),t.UI.addAttr("motion",void 0,n_),t.UI.addAttr("motionRotation",!0,n_),r_.getMotionPathData=function(){return c_(d_(this))},r_.getMotionPoint=function(t){const e=d_(this),i=c_(e);if(!i.total)return{};const s=s_.getDistancePoint(i,t,e.motionPrecision);E.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:"number"==typeof n&&(s.rotation+=n),s},r_.getMotionTotal=function(){return this.getMotionPathData().total},r_.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],Yt(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),l_(t))}else l_(this)};const{Yes:u_,NoAndSkip:p_,YesAndSkip:__}=t.Answer,g_={},f_={},y_={};class m_{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":g_.id=t.substring(1),t=g_;break;case".":f_.className=t.substring(1),t=f_;break;default:y_.tag=t,t=y_}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,n=s instanceof Array;return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?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&&kr.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),r===u_||r===__){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<p_&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_($r.REMOVE,this.__onRemoveChild,this),this.target.on_(Qr.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 v_=t.UI.prototype;function w_(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=i.selector())}return v_.find=function(t,e){return w_(this).getBy(t,this,!1,e)},v_.findOne=function(t,e){return w_(this).getBy(t,this,!0,e)},St.add("find"),i.finder=function(t){return new m_(t)},t.AlignHelper=wt,t.AnimateEasing=gp,t.AnimateEvent=yp,t.AroundHelper=yt,t.AutoBounds=pt,t.BezierHelper=De,t.Bounds=ct,t.BoundsHelper=at,t.BoxData=ch,t.BranchHelper=Mr,t.BranchRender=Uo,t.CanvasData=Bh,t.CanvasManager=Ft,t.ChildEvent=$r,t.ColorConvert=Va,t.Creator=i,t.Cursor=Wl,t.DataHelper=Wt,t.Debug=Et,t.Dragger=Cl,t.Effect=Ja,t.EllipseData=fh,t.EllipseHelper=ze,t.Event=Zr,t.EventCreator=It,t.Eventer=oo,t.Export=eh,t.FileHelper=fn,t.Filter=th,t.Finder=m_,t.FrameData=ph,t.GroupData=dh,t.HighBezierHelper=Kp,t.HighCurveHelper=s_,t.HitCanvasManager=Ul,t.ImageData=Eh,t.ImageEvent=Jr,t.ImageManager=Bn,t.IncrementId=s,t.Interaction=td,t.InteractionBase=Fl,t.InteractionHelper=xl,t.Keyboard=gl,t.LayoutEvent=io,t.Layouter=Fa,t.LeafBounds=Mo,t.LeafBoundsHelper=Or,t.LeafData=Nt,t.LeafDataProxy=xo,t.LeafEventer=mo,t.LeafHelper=kr,t.LeafLayout=Kr,t.LeafLevelList=va,t.LeafList=ma,t.LeafMatrix=Ro,t.LeafRender=Fo,t.LeaferCanvas=xa,t.LeaferCanvasBase=se,t.LeaferData=uh,t.LeaferEvent=no,t.LeaferImage=Rn,t.LineData=_h,t.MathHelper=h,t.Matrix=j,t.MatrixHelper=E,t.MyDragEvent=wl,t.MyImage=ll,t.MyPointerEvent=ml,t.NeedConvertToCanvasCommandMap=he,t.OneRadian=d,t.PI2=c,t.PI_2=u,t.Paint=Za,t.PaintGradient=Qa,t.PaintImage=$a,t.PathArrow=Ka,t.PathBounds=rn,t.PathCommandDataHelper=qi,t.PathCommandMap=oe,t.PathConvert=Pi,t.PathCorner=un,t.PathCreator=cs,t.PathData=vh,t.PathDrawer=ks,t.PathHelper=ne,t.PathNumberCommandLengthMap=ue,t.PathNumberCommandMap=ce,t.PenData=wh,t.Picker=za,t.Platform=e,t.Plugin=St,t.Point=N,t.PointHelper=I,t.PointerButton=fl,t.PolygonData=yh,t.PropertyEvent=Qr,t.RectData=gh,t.RectHelper=pe,t.RectRender=Rh,t.RenderEvent=so,t.Renderer=Ua,t.ResizeEvent=to,t.Resource=bn,t.RobotData=ku,t.Run=Ct,t.Selector=ja,t.StarData=mh,t.State=ih,t.StringNumberMap=xt,t.TaskItem=vn,t.TaskProcessor=wn,t.TextConvert=Ga,t.TextData=bh,t.Transition=sh,t.TwoPointBoundsHelper=H,t.UIBounds=Ph,t.UICreator=Dt,t.UIData=hh,t.UIEvent=yl,t.UIRender=kh,t.UnitConvert=qa,t.WaitHelper=Nr,t.WatchEvent=eo,t.Watcher=ka,t.affectRenderBoundsType=Vn,t.affectStrokeBoundsType=Hn,t.attr=Dn,t.autoLayoutType=Mn,t.boundsType=Un,t.canvasPatch=gn,t.canvasSizeAttrs=ie,t.cursorType=sr,t.dataProcessor=nr,t.dataType=On,t.decorateLeafAttr=Ln,t.defineDataProcessor=rr,t.defineKey=Tn,t.defineLeafAttr=An,t.doBoundsType=zn,t.doStrokeType=Xn,t.effectType=Ya,t.emptyData=jt,t.eraserType=er,t.getBoundsData=_,t.getDescriptor=Sn,t.getMatrixData=g,t.getPointData=p,t.hitType=ir,t.isEmptyData=Ht,t.isNull=Yt,t.layoutProcessor=function(t){return(e,i)=>{Tn(e,"__LayoutProcessor",{get:()=>t})}},t.maskType=tr,t.motionPathType=n_,t.naturalBoundsType=Nn,t.opacityType=Kn,t.pathInputType=jn,t.pathType=Yn,t.pen=pn,t.positionType=In,t.registerUI=pr,t.registerUIEvent=_r,t.resizeType=Ha,t.rewrite=lr,t.rewriteAble=dr,t.rotationType=Wn,t.scaleType=Fn,t.sortType=Jn,t.stateStyleType=Ru,t.stateType=Cu,t.strokeType=Gn,t.surfaceType=qn,t.tempBounds=ut,t.tempMatrix=Y,t.tempPoint=z,t.useCanvas=Ba,t.useModule=ur,t.version="1.6.2",t.visibleType=Zn,t.zoomLayerType=Xa,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
2
2
  //# sourceMappingURL=web.min.js.map