@leafer-ui/worker 1.12.1 → 1.12.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.
@@ -1,2 +1,2 @@
1
- var LeaferUI=function(t){"use strict";var e,i;t.PathNodeHandleType=void 0,(e=t.PathNodeHandleType||(t.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror",t.Answer=void 0,(i=t.Answer||(t.Answer={}))[i.No=0]="No",i[i.Yes=1]="Yes",i[i.NoAndSkip=2]="NoAndSkip",i[i.YesAndSkip=3]="YesAndSkip";const s={};function r(t){return void 0===t}function n(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:o}=Number;function h(t){return"number"==typeof t}const l=/^-?\d+(?:\.\d+)?$/;const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return"{}"===JSON.stringify(t)}const _={default:(t,e)=>(p(e,t),p(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var n,a;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return p(t[r],e[r],i&&i[r]);i&&r in i?(null===(a=i[r])||void 0===a?void 0:a.constructor)===Object&&p(t[r]={},e[r],i[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{r(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:p}=_;class g{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=r(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!r(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(d(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!r(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=r(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:a}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:a}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{floor:f,max:y}=Math,m={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",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||v.maxCacheSize),isSuperLarge:(t,e,i)=>v.isLarge(t,e,i,v.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=m.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,r,n,a,o,h){const l=m.origin.createCanvas(y(f(e+(s||0)),1),y(f(i+(r||0)),1)),d=l.getContext("2d");if(o&&(d.globalAlpha=o),d.imageSmoothingEnabled=!1!==a,n){const s=e/n.width,r=i/n.height;d.setTransform(s,0,0,r,-n.x*s,-n.y*r),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&_.stintSet(i,"transform",e)}}},{image:v}=m,x={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=w;return e[t]?e[t]++:(e[t]=1,0)}},w=x;let b,E,P;const{max:B}=Math,k=[0,0,0,0],S={zero:[...k],tempFour:k,set:(t,e,i,s,r)=>(void 0===i&&(i=s=r=e),t[0]=e,t[1]=i,t[2]=s,t[3]=r,t),setTemp:(t,e,i,s)=>R(k,t,e,i,s),toTempAB(t,e,i){P=i?h(t)?e:t:[],h(t)?(b=C(t),E=e):h(e)?(b=t,E=C(e)):(b=t,E=e),4!==b.length&&(b=T(b)),4!==E.length&&(E=T(E))},get(t,e){let i;if(!h(t))switch(t.length){case 4:i=r(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!r(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>h(t)&&h(e)?B(t,e):(L(t,e,i),R(P,B(b[0],E[0]),B(b[1],E[1]),B(b[2],E[2]),B(b[3],E[3]))),add:(t,e,i)=>h(t)&&h(e)?t+e:(L(t,e,i),R(P,b[0]+E[0],b[1]+E[1],b[2]+E[2],b[3]+E[3])),swapAndScale(t,e,i,s){if(h(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[n,a,o,l]=4===t.length?t:T(t);return R(r,o*i,l*e,n*i,a*e)}},{set:R,get:T,setTemp:C,toTempAB:L}=S,{round:O,pow:I,max:D,floor:A,PI:M}=Math,W={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!r(e)&&t<e&&(t=e),!r(i)&&t>i&&(t=i),t),fourNumber:S.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),W.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=r(e)?1e12:I(10,e);return-0===(t=O(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(h(e)?e:e.width||0)/i.width,r=(h(e)?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&W.assignScale(s,t);return s},assignScale(t,e){h(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>D(A(t),e)/t,randInt:F,randColor:t=>`rgba(${F(255)},${F(255)},${F(255)},${t||1})`};function F(t){return Math.round(Math.random()*t)}const U=M/180,N=2*M,z=M/2;function Y(){return{x:0,y:0}}function X(){return{x:0,y:0,width:0,height:0}}function H(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:j,cos:G,acos:V,sqrt:K}=Math,{float:q}=W,Z={};function Q(){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 J={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Q(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,n=0,a=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=a},get:H,getWorld:Q,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},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){$.toInnerPoint(t,e,Z),$.scaleOfInner(t,Z,i,s)},scaleOfInner(t,e,i,s=i){$.translateInner(t,e.x,e.y),$.scale(t,i,s),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,a=G(e*=U),o=j(e);t.a=i*a-s*o,t.b=i*o+s*a,t.c=r*a-n*o,t.d=r*o+n*a},rotateOfOuter(t,e,i){$.toInnerPoint(t,e,Z),$.rotateOfInner(t,Z,i)},rotateOfInner(t,e,i){$.translateInner(t,e.x,e.y),$.rotate(t,i),$.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:a}=t;i&&(i*=U,t.a=s+n*i,t.b=r+a*i),e&&(e*=U,t.c=n+s*e,t.d=a+r*e)},skewOfOuter(t,e,i,s){$.toInnerPoint(t,e,Z),$.skewOfInner(t,Z,i,s)},skewOfInner(t,e,i,s=0){$.translateInner(t,e.x,e.y),$.skew(t,i,s),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:a,f:o}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+a,t.f=e.e*s+e.f*n+o},multiplyParent(t,e,i,s,n){const{e:a,f:o}=t;if(i||(i=t),r(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:a,d:o}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=a*e.a+o*e.c,i.d=a*e.b+o*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=a*e.a+o*e.c+e.e,i.f=a*e.b+o*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:i,c:s,d:r,e:n,f:a}=t;if(i||s){const o=1/(e*r-i*s);t.a=r*o,t.b=-i*o,t.c=-s*o,t.d=e*o,t.e=-(n*r-a*s)*o,t.f=-(a*e-n*i)*o}else if(1===e&&1===r)t.e=-n,t.f=-a;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-a*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:a,d:o}=t,h=1/(r*o-n*a),{x:l,y:d}=e;if(i||(i=e),i.x=(l*o-d*a)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*o-s*a)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,s,n){const{x:a,y:o,scaleX:h,scaleY:l}=e;if(r(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:r}=e,n=i*U,a=G(n),o=j(n);if(s||r){const e=s*U,i=r*U;t.a=(a+i*-o)*h,t.b=(o+i*a)*h,t.c=(e*a-o)*l,t.d=(a+e*o)*l}else t.a=a*h,t.b=o*h,t.c=-o*l,t.d=a*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=a,t.f=o,(i=i||s)&&$.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:r,b:n,c:a,d:o,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||a){const t=r*o-n*a;if(a&&!s){d=K(r*r+n*n),c=t/d;const e=r/d;u=n>0?V(e):-V(e)}else{c=K(a*a+o*o),d=t/c;const e=a/c;u=z-(o>0?V(-e):-V(e))}const e=q(G(u)),i=j(u);d=q(d),c=q(c),_=e?q((a/c+i)/e/U,9):0,p=e?q((n/d-i)/e/U,9):0,u=q(u/U)}else d=r,c=o,u=_=p=0;return(e=i||e)&&(g+=e.x*r+e.y*a,f+=e.x*n+e.y*o,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:a}=t;r||n?i=(s*a-r*n)/(e=K(s*s+r*r)):(e=s,i=a)}return s.scaleX=e,s.scaleY=i,s},reset(t){$.set(t)}},$=J,{toInnerPoint:tt,toOuterPoint:et}=J,{sin:it,cos:st,abs:rt,sqrt:nt,atan2:at,min:ot,round:ht}=Math,lt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=r(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=dt.defaultPoint);const s=st(e*=U),r=it(e),n=t.x-i.x,a=t.y-i.y;t.x=i.x+n*s-a*r,t.y=i.y+n*r+a*s},tempToInnerOf(t,e){const{tempPoint:i}=dt;return ut(i,t),tt(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=dt;return ut(i,t),et(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=dt;return ut(i,t),dt.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),tt(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){tt(e,t,i)},toOuterOf(t,e,i){et(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)=>ct(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=rt(i-t),n=rt(s-e);return nt(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>ot(ct(t,e,i,s),ct(i,s,r,n)),getAngle:(t,e)=>_t(t,e)/U,getRotation:(t,e,i,s)=>(s||(s=e),dt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/U),getRadianFrom(t,e,i,s,n,a,o,h){r(o)&&(o=i,h=s);const l=t-i,d=e-s,c=n-o,u=a-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>at(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,r){const n=_t(t,e);return r&&(t=e),s||(e={}),e.x=t.x+st(n)*i,e.y=t.y+it(n)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>t.x===e.x&&t.y===e.y,reset(t){dt.reset(t)}},dt=lt,{getDistanceFrom:ct,copy:ut,getAtan2:_t}=dt;class pt{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?lt.copy(this,t):lt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new pt(this)}move(t,e){return lt.move(this,t,e),this}scale(t,e){return lt.scale(this,t,e),this}scaleOf(t,e,i){return lt.scaleOf(this,t,e,i),this}rotate(t,e){return lt.rotate(this,t,e),this}rotateOf(t,e){return lt.rotate(this,e,t),this}getRotation(t,e,i){return lt.getRotation(this,t,e,i)}toInnerOf(t,e){return lt.toInnerOf(this,t,e),this}toOuterOf(t,e){return lt.toOuterOf(this,t,e),this}getCenter(t){return new pt(lt.getCenter(this,t))}getDistance(t){return lt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new pt(lt.getDistancePoint(this,t,e,i,s))}getAngle(t){return lt.getAngle(this,t)}getAtan2(t){return lt.getAtan2(this,t)}isSame(t){return lt.isSame(this,t)}reset(){return lt.reset(this),this}}const gt=new pt;class ft{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return c(t)?J.copy(this,t):J.set(this,t,e,i,s,r,n),this}setWith(t){return J.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new ft(this)}translate(t,e){return J.translate(this,t,e),this}translateInner(t,e){return J.translateInner(this,t,e),this}scale(t,e){return J.scale(this,t,e),this}scaleWith(t,e){return J.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return J.pixelScale(this,t),this}scaleOfOuter(t,e,i){return J.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return J.scaleOfInner(this,t,e,i),this}rotate(t){return J.rotate(this,t),this}rotateOfOuter(t,e){return J.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return J.rotateOfInner(this,t,e),this}skew(t,e){return J.skew(this,t,e),this}skewOfOuter(t,e,i){return J.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return J.skewOfInner(this,t,e,i),this}multiply(t){return J.multiply(this,t),this}multiplyParent(t){return J.multiplyParent(this,t),this}divide(t){return J.divide(this,t),this}divideParent(t){return J.divideParent(this,t),this}invert(){return J.invert(this),this}invertWith(){return J.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){J.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){J.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return J.setLayout(this,t,e,i),this}getLayout(t,e,i){return J.getLayout(this,t,e,i)}withScale(t,e){return J.withScale(this,t,e)}reset(){J.reset(this)}}const yt=new ft,mt={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,r){vt(t,e,i),vt(t,e+s,i+r)},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:vt}=mt;var xt,wt;t.Direction4=void 0,(xt=t.Direction4||(t.Direction4={}))[xt.top=0]="top",xt[xt.right=1]="right",xt[xt.bottom=2]="bottom",xt[xt.left=3]="left",t.Direction9=void 0,(wt=t.Direction9||(t.Direction9={}))[wt.topLeft=0]="topLeft",wt[wt.top=1]="top",wt[wt.topRight=2]="topRight",wt[wt.right=3]="right",wt[wt.bottomRight=4]="bottomRight",wt[wt.bottom=5]="bottom",wt[wt.bottomLeft=6]="bottomLeft",wt[wt.left=7]="left",wt[wt.center=8]="center",wt[wt["top-left"]=0]="top-left",wt[wt["top-right"]=2]="top-right",wt[wt["bottom-right"]=4]="bottom-right",wt[wt["bottom-left"]=6]="bottom-left";const bt=[{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}];bt.forEach(t=>t.type="percent");const Et={directionData:bt,tempPoint:{},get:Pt,toPoint(t,e,i,s,r,n){const a=Pt(t);i.x=a.x,i.y=a.y,"percent"===a.type&&(i.x*=e.width,i.y*=e.height,r&&(n||(i.x-=r.x,i.y-=r.y),a.x&&(i.x-=1===a.x?r.width:.5===a.x?a.x*r.width:0),a.y&&(i.y-=1===a.y?r.height:.5===a.y?a.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),Et.toPoint(t,e,i,!0),i)};function Pt(e){return a(e)?bt[t.Direction9[e]]:e}const{toPoint:Bt}=Et,kt={toPoint(t,e,i,s,r,n){Bt(t,i,s,r,e,n)}},{tempPointBounds:St,setPoint:Rt,addPoint:Tt,toBounds:Ct}=mt,{toOuterPoint:Lt}=J,{float:Ot,fourNumber:It}=W,{floor:Dt,ceil:At}=Math;let Mt,Wt,Ft,Ut;const Nt={},zt={},Yt={},Xt={tempBounds:Yt,set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,r){const{x:n,y:a,width:o,height:h}=e;if(d(i)){const e=It(i);s?Ht.set(t,n+e[3],a+e[0],o-e[1]-e[3],h-e[2]-e[0]):Ht.set(t,n-e[3],a-e[0],o+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ht.set(t,n-i,a-i,o+2*i,h+2*i);r&&("width"===r?(t.y=a,t.height=h):(t.x=n,t.width=o))},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},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Ht.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Gt(e,t):e=t,i||(i=t),e.offsetX=Ht.maxX(i),e.offsetY=Ht.maxY(i),Ht.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||lt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){lt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ht.copy(Yt,t),Ht.toOuterOf(Yt,e),Yt),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:r,e:n,f:a}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=a+t.y*r):(i.height=t.height*-r,i.y=a+t.y*r-i.height)}else Nt.x=t.x,Nt.y=t.y,Lt(e,Nt,zt),Rt(St,zt.x,zt.y),Nt.x=t.x+t.width,Lt(e,Nt,zt),Tt(St,zt.x,zt.y),Nt.y=t.y+t.height,Lt(e,Nt,zt),Tt(St,zt.x,zt.y),Nt.x=t.x,Lt(e,Nt,zt),Tt(St,zt.x,zt.y),Ct(St,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,Ht.getFitScale(t,e));return new ft(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,r=t.height/e.height;return i?Math.max(s,r):Math.min(s,r)},put(t,e,i="center",s=1,r=!0,n){n||(n=e),a(s)&&(s=Ht.getFitScale(t,e,"cover"===s)),Yt.width=r?e.width*=s:e.width*s,Yt.height=r?e.height*=s:e.height*s,kt.toPoint(i,Yt,t,n,!0,!0)},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=Dt(t.x),t.y=Dt(t.y),t.width=e>t.x?At(t.width+e-t.x):At(t.width),t.height=i>t.y?At(t.height+i-t.y):At(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=Ot(t.x,e),t.y=Ot(t.y,e),t.width=Ot(t.width,e),t.height=Ot(t.height,e)},add(t,e,i){Mt=t.x+t.width,Wt=t.y+t.height,Ft=e.x,Ut=e.y,i||(Ft+=e.width,Ut+=e.height),Mt=Mt>Ft?Mt:Ft,Wt=Wt>Ut?Wt:Ut,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Mt-t.x,t.height=Wt-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 r,n=!0;for(let a=0,o=e.length;a<o;a++)r=i?i(e[a],a):e[a],r&&(r.width||r.height)&&(n?(n=!1,s||Gt(t,r)):jt(t,r));n&&Ht.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Rt(St,t.x,t.y):Tt(St,t.x,t.y)),Ct(St,t)},setPoint(t,e){Ht.set(t,e.x,e.y)},addPoint(t,e){jt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},hitRadiusPoint:(t,e,i)=>(i&&(e=lt.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=lt.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:r,width:n,height:a}=e;return Mt=s+n,Wt=r+a,Ft=t.x+t.width,Ut=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,Mt=Mt<Ft?Mt:Ft,Wt=Wt<Ut?Wt:Ut,n=Mt-s,a=Wt-r,{x:s,y:r,width:n,height:a}},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=Xt,{add:jt,copy:Gt}=Ht;class Vt{get minX(){return Xt.minX(this)}get minY(){return Xt.minY(this)}get maxX(){return Xt.maxX(this)}get maxY(){return Xt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Xt.copy(this,t):Xt.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 Vt(this)}move(t,e){return Xt.move(this,t,e),this}scale(t,e,i){return Xt.scale(this,t,e,i),this}scaleOf(t,e,i){return Xt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Xt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Xt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Xt.getFitMatrix(this,t,e)}put(t,e,i){Xt.put(this,t,e,i)}spread(t,e){return Xt.spread(this,t,e),this}shrink(t,e){return Xt.shrink(this,t,e),this}ceil(){return Xt.ceil(this),this}unsign(){return Xt.unsign(this),this}float(t){return Xt.float(this,t),this}add(t){return Xt.add(this,t),this}addList(t){return Xt.setList(this,t,!0),this}setList(t){return Xt.setList(this,t),this}addListWithFn(t,e){return Xt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Xt.setListWithFn(this,t,e),this}setPoint(t){return Xt.setPoint(this,t),this}setPoints(t){return Xt.setPoints(this,t),this}addPoint(t){return Xt.addPoint(this,t),this}getPoints(){return Xt.getPoints(this)}hitPoint(t,e){return Xt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Xt.hitRadiusPoint(this,t,e)}hit(t,e){return Xt.hit(this,t,e)}includes(t,e){return Xt.includes(this,t,e)}intersect(t,e){return Xt.intersect(this,t,e),this}getIntersect(t,e){return new Vt(Xt.getIntersectData(this,t,e))}isSame(t){return Xt.isSame(this,t)}isEmpty(){return Xt.isEmpty(this)}reset(){Xt.reset(this)}}const Kt=new Vt;class qt{constructor(t,e,i,s,r,n){c(t)?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=t;this.set(e,i,s,r,n,a)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=this;return new Vt(r,e,n||t.width-r-i,a||t.height-e-s)}}const Zt={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:Qt}=W;class Jt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Jt(t)}static set filter(t){this.filterList=$t(t)}static set exclude(t){this.excludeList=$t(t)}static drawRepaint(t,e){const i=Qt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Jt.showBounds,r=t.__nowWorld,n=Qt();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if(te.enable){if(te.filterList.length&&te.filterList.every(t=>t!==this.name))return;if(te.excludeList.length&&te.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){te.enable&&this.warn(...t)}warn(...t){te.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 $t(t){return t?a(t)&&(t=[t]):t=[],t}Jt.filterList=[],Jt.excludeList=[],Jt.showWarn=!0;const te=Jt,ee=Jt.get("RunTime"),ie={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=x.create(x.RUNTIME);return se.currentId=se.idMap[i]=e?performance.now():Date.now(),se.currentName=se.nameMap[i]=t,se.nameToIdMap[t]=i,i},end(t,e){const i=se.idMap[t],s=se.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;se.idMap[t]=se.nameMap[t]=se.nameToIdMap[s]=void 0,ee.log(s,r,"ms")},endOfName(t,e){const i=se.nameToIdMap[t];r(i)||se.end(i,e)}},se=ie,re=[],ne={list:{},add(t,...e){this.list[t]=!0,re.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>re.forEach(t=>ne.has(t,!0)));const ae={editor:t=>ne.need("editor")},oe=Jt.get("UICreator"),he={list:{},register(t){const{__tag:e}=t.prototype;le[e]&&oe.repeat(e),le[e]=t},get(t,e,i,s,n,a){le[t]||oe.error("not register "+t);const o=new le[t](e);return r(i)||(o.x=i,s&&(o.y=s),n&&(o.width=n),a&&(o.height=a)),o}},{list:le}=he,de=Jt.get("EventCreator"),ce={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(ue[e]&&de.repeat(e),ue[e]=t)})},changeName(t,e){const i=ue[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ue[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ue[t](...e)},{nameList:ue}=ce;class _e{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,r=i.length;s<r;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ae.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function pe(t,e,i,s){var r,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}function ge(t,e,i,s){return new(i||(i=Promise))(function(r,n){function a(t){try{h(s.next(t))}catch(t){n(t)}}function o(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,o)}h((s=s.apply(t,e||[])).next())})}function fe(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const ye=[];function me(){return(t,e)=>{ye.push(e)}}const ve=[];class xe{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||ve)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ye.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,a,o,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*o;s+=e,e=0,n+=t,o-=t}if(i<0){const t=-i/r*h;r+=i,i=0,a+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,a,o,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,a,o){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}pe([fe("imageSmoothingEnabled")],xe.prototype,"smooth",void 0),pe([fe("imageSmoothingQuality")],xe.prototype,"smoothLevel",void 0),pe([fe("globalAlpha")],xe.prototype,"opacity",void 0),pe([fe()],xe.prototype,"fillStyle",void 0),pe([fe()],xe.prototype,"strokeStyle",void 0),pe([fe("lineWidth")],xe.prototype,"strokeWidth",void 0),pe([fe("lineCap")],xe.prototype,"strokeCap",void 0),pe([fe("lineJoin")],xe.prototype,"strokeJoin",void 0),pe([fe("lineDashOffset")],xe.prototype,"dashOffset",void 0),pe([fe()],xe.prototype,"miterLimit",void 0),pe([fe()],xe.prototype,"shadowBlur",void 0),pe([fe()],xe.prototype,"shadowColor",void 0),pe([fe()],xe.prototype,"shadowOffsetX",void 0),pe([fe()],xe.prototype,"shadowOffsetY",void 0),pe([fe()],xe.prototype,"filter",void 0),pe([fe()],xe.prototype,"font",void 0),pe([fe()],xe.prototype,"fontKerning",void 0),pe([fe()],xe.prototype,"fontStretch",void 0),pe([fe()],xe.prototype,"fontVariantCaps",void 0),pe([fe()],xe.prototype,"textAlign",void 0),pe([fe()],xe.prototype,"textBaseline",void 0),pe([fe()],xe.prototype,"textRendering",void 0),pe([fe()],xe.prototype,"wordSpacing",void 0),pe([fe()],xe.prototype,"letterSpacing",void 0),pe([fe()],xe.prototype,"direction",void 0),pe([me()],xe.prototype,"setTransform",null),pe([me()],xe.prototype,"resetTransform",null),pe([me()],xe.prototype,"getTransform",null),pe([me()],xe.prototype,"save",null),pe([me()],xe.prototype,"restore",null),pe([me()],xe.prototype,"translate",null),pe([me()],xe.prototype,"scale",null),pe([me()],xe.prototype,"rotate",null),pe([me()],xe.prototype,"fill",null),pe([me()],xe.prototype,"stroke",null),pe([me()],xe.prototype,"clip",null),pe([me()],xe.prototype,"fillRect",null),pe([me()],xe.prototype,"strokeRect",null),pe([me()],xe.prototype,"clearRect",null),pe([me()],xe.prototype,"beginPath",null),pe([me()],xe.prototype,"moveTo",null),pe([me()],xe.prototype,"lineTo",null),pe([me()],xe.prototype,"bezierCurveTo",null),pe([me()],xe.prototype,"quadraticCurveTo",null),pe([me()],xe.prototype,"closePath",null),pe([me()],xe.prototype,"arc",null),pe([me()],xe.prototype,"arcTo",null),pe([me()],xe.prototype,"ellipse",null),pe([me()],xe.prototype,"rect",null),pe([me()],xe.prototype,"roundRect",null),pe([me()],xe.prototype,"createConicGradient",null),pe([me()],xe.prototype,"createLinearGradient",null),pe([me()],xe.prototype,"createPattern",null),pe([me()],xe.prototype,"createRadialGradient",null),pe([me()],xe.prototype,"fillText",null),pe([me()],xe.prototype,"measureText",null),pe([me()],xe.prototype,"strokeText",null);const{copy:we,multiplyParent:be,pixelScale:Ee}=J,{round:Pe}=Math,Be=new Vt,ke=new Vt,Se={width:1,height:1,pixelRatio:1},Re=["width","height","pixelRatio"];class Te extends xe{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Se),this.manager=e,this.innerId=x.create(x.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||m.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;_.copyAttrs(s,t,Re),Re.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Vt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!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,r=this.worldTransform;e&&be(t,e,r),Ee(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=Pe(r.e-.5)+.5,r.f=Pe(r.f-.5)+.5):(r.e=Pe(r.e),r.f=Pe(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:a,miterLimit:o}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),r(e.dashPattern)||(n=e.dashPattern),r(e.dashOffset)||(a=e.dashOffset),e.miterLimit&&(o=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=a,this.miterLimit=o}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:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,r=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,r),i?(this.setTempPixelBounds2(i,r),i=ke):i=Be,this.drawImage(t.view,Be.x,Be.y,Be.width,Be.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Xt.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),this.drawImage(t.view,Be.x,Be.y,Be.width,Be.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,r,n=!0){this.resetTransform(),this.copyWorld(t,e,i,s,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(Be.x,Be.y,Be.width,Be.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,Be.x,Be.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,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Be.x,Be.y,Be.width,Be.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Be.x,Be.y,Be.width,Be.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Be.x,Be.y,Be.width,Be.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Be.x,Be.y,Be.width,Be.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Be,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(ke,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,r=this.manager?this.manager.get(i):ae.canvas(Object.assign({},i));return r.save(),t&&(we(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==s&&(r.pixelSnap=s),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Ce={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Le={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},Le),Ie={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},De={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},Ae=Object.assign(Object.assign({},De),Le),Me=Oe,We={};for(let t in Me)We[Me[t]]=t;const Fe={};for(let t in Me)Fe[Me[t]]=Ie[t];const Ue={drawRoundRect(t,e,i,s,r,n){const a=W.fourNumber(n,Math.min(s/2,r/2)),o=e+s,h=i+r;a[0]?t.moveTo(e+a[0],i):t.moveTo(e,i),a[1]?t.arcTo(o,i,o,h,a[1]):t.lineTo(o,i),a[2]?t.arcTo(o,h,e,h,a[2]):t.lineTo(o,h),a[3]?t.arcTo(e,h,e,i,a[3]):t.lineTo(e,h),a[0]?t.arcTo(e,i,o,i,a[0]):t.lineTo(e,i)}},{sin:Ne,cos:ze,hypot:Ye,atan2:Xe,ceil:He,abs:je,PI:Ge,sqrt:Ve,pow:Ke}=Math,{setPoint:qe,addPoint:Ze}=mt,{set:Qe,toNumberPoints:Je}=lt,{M:$e,L:ti,C:ei,Q:ii,Z:si}=Oe,ri={},ni={points(t,e,i,s){let r=Je(e);if(t.push($e,r[0],r[1]),i&&r.length>5){let e,n,a,o,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===i?.5:i;s&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let i=2;i<y-2;i+=2)e=r[i-2],n=r[i-1],a=r[i],o=r[i+1],h=r[i+2],l=r[i+3],p=Ve(Ke(a-e,2)+Ke(o-n,2)),g=Ve(Ke(h-a,2)+Ke(l-o,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=n,d=a-p*h,c=o-p*l,2===i?s||t.push(ii,d,c,a,o):t.push(ei,u,_,d,c,a,o),u=a+g*h,_=o+g*l);s||t.push(ii,u,_,r[y-2],r[y-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push(ti,r[e],r[e+1]);s&&t.push(si)},rect(t,e,i,s,r){Ce.creator.path=t,Ce.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){Ce.creator.path=[],Ue.drawRoundRect(Ce.creator,e,i,s,r,n),t.push(...Ce.convertToCanvasData(Ce.creator.path,!0))},arcTo(t,e,i,s,r,n,a,o,h,l,d){const c=s-e,u=r-i,_=n-s,p=a-r;let g=Xe(u,c),f=Xe(p,_);const y=Ye(c,u),m=Ye(_,p);let v=f-g;if(v<0&&(v+=N),y<1e-12||m<1e-12||v<1e-12||je(v-Ge)<1e-12)return t&&t.push(ti,s,r),h&&(qe(h,e,i),Ze(h,s,r)),d&&Qe(d,e,i),void(l&&Qe(l,s,r));const x=c*p-_*u<0,w=x?-1:1,b=o/ze(v/2),E=s+b*ze(g+v/2+z*w),P=r+b*Ne(g+v/2+z*w);return g-=z*w,f-=z*w,hi(t,E,P,o,o,0,g/U,f/U,x,h,l,d)},arc:(t,e,i,s,r,n,a,o,h,l)=>hi(t,e,i,s,s,0,r,n,a,o,h,l),ellipse(t,e,i,s,r,n,a,o,h,l,d,c){const u=n*U,_=Ne(u),p=ze(u);let g=a*U,f=o*U;g>Ge&&(g-=N),f<0&&(f+=N);let y=f-g;y<0?y+=N:y>N&&(y-=N),h&&(y-=N);const m=He(je(y/z)),v=y/m,x=Ne(v/4),w=8/3*x*x/Ne(v/2);f=g+v;let b,E,P,B,k,S,R,T,C=ze(g),L=Ne(g),O=P=p*s*C-_*r*L,I=B=_*s*C+p*r*L,D=e+P,A=i+B;t&&t.push(t.length?ti:$e,D,A),l&&qe(l,D,A),c&&Qe(c,D,A);for(let n=0;n<m;n++)b=ze(f),E=Ne(f),P=p*s*b-_*r*E,B=_*s*b+p*r*E,k=e+O-w*(p*s*L+_*r*C),S=i+I-w*(_*s*L-p*r*C),R=e+P+w*(p*s*E+_*r*b),T=i+B+w*(_*s*E-p*r*b),t&&t.push(ei,k,S,R,T,e+P,i+B),l&&oi(e+O,i+I,k,S,R,T,e+P,i+B,l,!0),O=P,I=B,C=b,L=E,g=f,f+=v;d&&Qe(d,e+P,i+B)},quadraticCurveTo(t,e,i,s,r,n,a){t.push(ei,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(a+2*r)/3,n,a)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,a,o){oi(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,a,o)},toTwoPointBounds(t,e,i,s,r,n,a,o,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,x=i,w=r,b=a;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=n,b=o),c=-3*v+9*x-9*w+3*b,u=6*v-12*x+6*w,_=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Ze(h,t,e):qe(h,t,e),Ze(h,a,o);for(let l=0,c=d.length;l<c;l++)ai(d[l],t,e,i,s,r,n,a,o,ri),Ze(h,ri.x,ri.y)},getPointAndSet(t,e,i,s,r,n,a,o,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*o,l.y=c*i+u*r+_*a+p*h},getPoint(t,e,i,s,r,n,a,o,h){const l={};return ai(t,e,i,s,r,n,a,o,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)}},{getPointAndSet:ai,toTwoPointBounds:oi,ellipse:hi}=ni,{sin:li,cos:di,sqrt:ci,atan2:ui}=Math,{ellipse:_i}=ni,pi={ellipticalArc(t,e,i,s,r,n,a,o,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=n*U,p=li(_),g=di(_),f=-g*c-p*u,y=-g*u+p*c,v=s*s,x=r*r,w=y*y,b=f*f,E=v*x-v*w-x*b;let P=0;if(E<0){const t=ci(1-E/(v*x));s*=t,r*=t}else P=(a===o?-1:1)*ci(E/(v*w+x*b));const B=P*s*y/r,k=-P*r*f/s,S=ui((y-k)/r,(f-B)/s),R=ui((-y-k)/r,(-f-B)/s);let T=R-S;0===o&&T>0?T-=N:1===o&&T<0&&(T+=N);const C=e+c+g*B-p*k,L=i+u+p*B+g*k,O=T<0?1:0;d||m.ellipseToCurve?_i(t,C,L,s,r,n,S/U,R/U,O):s!==r||n?t.push(Oe.G,C,L,s,r,n,S/U,R/U,O):t.push(Oe.O,C,L,s,S/U,R/U,O)}},gi={toCommand:t=>[],toNode:t=>[]},{M:fi,m:yi,L:mi,l:vi,H:xi,h:wi,V:bi,v:Ei,C:Pi,c:Bi,S:ki,s:Si,Q:Ri,q:Ti,T:Ci,t:Li,A:Oi,a:Ii,Z:Di,z:Ai,N:Mi,D:Wi,X:Fi,G:Ui,F:Ni,O:zi,P:Yi,U:Xi}=Oe,{rect:Hi,roundRect:ji,arcTo:Gi,arc:Vi,ellipse:Ki,quadraticCurveTo:qi}=ni,{ellipticalArc:Zi}=pi,Qi=Jt.get("PathConvert"),Ji={},$i={current:{dot:0},stringify(t,e){let i,s,r,n=0,a=t.length,o="";for(;n<a;){s=t[n],i=Fe[s],o+=s===r?" ":We[s];for(let s=1;s<i;s++)o+=W.float(t[n+s],e),s===i-1||(o+=" ");r=s,n+=i}return o},parse(t,e){let i,s,r,n="";const a=[],o=e?Ae:De;for(let e=0,h=t.length;e<h;e++)s=t[e],Zt[s]?("."===s&&(ts.dot&&(es(a,n),n=""),ts.dot++),"0"===n&&"."!==s&&(es(a,n),n=""),n+=s):Oe[s]?(n&&(es(a,n),n=""),ts.name=Oe[s],ts.length=Ie[s],ts.index=0,es(a,ts.name),!i&&o[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&es(a,n),n=s):n&&(es(a,n),n=""),r=s;return n&&es(a,n),i?$i.toCanvasData(a,e):a},toCanvasData(t,e){let i,s,r,n,a,o=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case yi:t[c+1]+=o,t[c+2]+=h;case fi:o=t[c+1],h=t[c+2],_.push(fi,o,h),c+=3;break;case wi:t[c+1]+=o;case xi:o=t[c+1],_.push(mi,o,h),c+=2;break;case Ei:t[c+1]+=h;case bi:h=t[c+1],_.push(mi,o,h),c+=2;break;case vi:t[c+1]+=o,t[c+2]+=h;case mi:o=t[c+1],h=t[c+2],_.push(mi,o,h),c+=3;break;case Si:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=ki;case ki:a=n===Pi||n===ki,l=a?2*o-i:t[c+1],d=a?2*h-s:t[c+2],i=t[c+1],s=t[c+2],o=t[c+3],h=t[c+4],_.push(Pi,l,d,i,s,o,h),c+=5;break;case Bi:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,t[c+5]+=o,t[c+6]+=h,r=Pi;case Pi:i=t[c+3],s=t[c+4],o=t[c+5],h=t[c+6],_.push(Pi,t[c+1],t[c+2],i,s,o,h),c+=7;break;case Li:t[c+1]+=o,t[c+2]+=h,r=Ci;case Ci:a=n===Ri||n===Ci,i=a?2*o-i:t[c+1],s=a?2*h-s:t[c+2],e?qi(_,o,h,i,s,t[c+1],t[c+2]):_.push(Ri,i,s,t[c+1],t[c+2]),o=t[c+1],h=t[c+2],c+=3;break;case Ti:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Ri;case Ri:i=t[c+1],s=t[c+2],e?qi(_,o,h,i,s,t[c+3],t[c+4]):_.push(Ri,i,s,t[c+3],t[c+4]),o=t[c+3],h=t[c+4],c+=5;break;case Ii:t[c+6]+=o,t[c+7]+=h;case Oi:Zi(_,o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),o=t[c+6],h=t[c+7],c+=8;break;case Ai:case Di:_.push(Di),c++;break;case Mi:o=t[c+1],h=t[c+2],e?Hi(_,o,h,t[c+3],t[c+4]):is(_,t,c,5),c+=5;break;case Wi:o=t[c+1],h=t[c+2],e?ji(_,o,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):is(_,t,c,9),c+=9;break;case Fi:o=t[c+1],h=t[c+2],e?ji(_,o,h,t[c+3],t[c+4],t[c+5]):is(_,t,c,6),c+=6;break;case Ui:Ki(e?_:is(_,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,Ji),o=Ji.x,h=Ji.y,c+=9;break;case Ni:e?Ki(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):is(_,t,c,5),o=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case zi:Vi(e?_:is(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ji),o=Ji.x,h=Ji.y,c+=7;break;case Yi:e?Vi(_,t[c+1],t[c+2],t[c+3],0,360,!1):is(_,t,c,4),o=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Xi:Gi(e?_:is(_,t,c,6),o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ji),o=Ji.x,h=Ji.y,c+=6;break;default:return Qi.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return gi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(fi,t.x,t.y);break;case"L":e.push(mi,t.x,t.y);break;case"C":e.push(Pi,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ri,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Di)}}),e}},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){ts.index===ts.length&&(ts.index=1,t.push(ts.name)),t.push(Number(e)),ts.index++,ts.dot=0}},{current:ts,pushData:es,copyData:is}=$i,{M:ss,L:rs,C:ns,Q:as,Z:os,N:hs,D:ls,X:ds,G:cs,F:us,O:_s,P:ps,U:gs}=Oe,{getMinDistanceFrom:fs,getRadianFrom:ys}=lt,{tan:ms,min:vs,abs:xs}=Math,ws={},bs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(ss,e,i)},lineTo(t,e,i){t.push(rs,e,i)},bezierCurveTo(t,e,i,s,r,n,a){t.push(ns,e,i,s,r,n,a)},quadraticCurveTo(t,e,i,s,r){t.push(as,e,i,s,r)},closePath(t){t.push(os)},rect(t,e,i,s,r){t.push(hs,e,i,s,r)},roundRect(t,e,i,s,r,n){if(h(n))t.push(ds,e,i,s,r,n);else{const a=W.fourNumber(n);a?t.push(ls,e,i,s,r,...a):t.push(hs,e,i,s,r)}},ellipse(t,e,i,s,r,a,o,h,l){n(a)?t.push(us,e,i,s,r):(n(o)&&(o=0),n(h)&&(h=360),t.push(cs,e,i,s,r,a,o,h,l?1:0))},arc(t,e,i,s,r,a,o){n(r)?t.push(ps,e,i,s):(n(a)&&(a=360),t.push(_s,e,i,s,r,a,o?1:0))},arcTo(t,e,i,s,n,a,o,h){if(!r(o)){const t=fs(o,h,e,i,s,n);a=vs(a,vs(t/2,t/2*xs(ms(ys(o,h,e,i,s,n)/2))))}t.push(gs,e,i,s,n,a)},drawEllipse(t,e,i,s,r,a,o,h,l){ni.ellipse(null,e,i,s,r,n(a)?0:a,n(o)?0:o,n(h)?360:h,l,null,null,ws),t.push(ss,ws.x,ws.y),Es(t,e,i,s,r,a,o,h,l)},drawArc(t,e,i,s,r,a,o){ni.arc(null,e,i,s,n(r)?0:r,n(a)?360:a,o,null,null,ws),t.push(ss,ws.x,ws.y),Ps(t,e,i,s,r,a,o)},drawPoints(t,e,i,s){ni.points(t,e,i,s)}},{ellipse:Es,arc:Ps}=bs,{moveTo:Bs,lineTo:ks,quadraticCurveTo:Ss,bezierCurveTo:Rs,closePath:Ts,beginPath:Cs,rect:Ls,roundRect:Os,ellipse:Is,arc:Ds,arcTo:As,drawEllipse:Ms,drawArc:Ws,drawPoints:Fs}=bs;class Us{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?Ce.parse(t):t:[],this}beginPath(){return Cs(this.__path),this.paint(),this}moveTo(t,e){return Bs(this.__path,t,e),this.paint(),this}lineTo(t,e){return ks(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return Rs(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ss(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ts(this.__path),this.paint(),this}rect(t,e,i,s){return Ls(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return Os(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,a,o){return Is(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}arc(t,e,i,s,r,n){return Ds(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return As(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,a,o){return Ms(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}drawArc(t,e,i,s,r,n){return Ws(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return Fs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ns,L:zs,C:Ys,Q:Xs,Z:Hs,N:js,D:Gs,X:Vs,G:Ks,F:qs,O:Zs,P:Qs,U:Js}=Oe,$s=Jt.get("PathDrawer"),tr={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Ns:t.moveTo(e[s+1],e[s+2]),s+=3;break;case zs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ys:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Xs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Hs:t.closePath(),s+=1;break;case js:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs: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 Ks:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*U,e[s+6]*U,e[s+7]*U,e[s+8]),s+=9;break;case qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,N,!1),s+=5;break;case Zs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*U,e[s+5]*U,e[s+6]),s+=7;break;case Qs:t.arc(e[s+1],e[s+2],e[s+3],0,N,!1),s+=4;break;case Js:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void $s.error(`command: ${i} [index:${s}]`,e)}}},{M:er,L:ir,C:sr,Q:rr,Z:nr,N:ar,D:or,X:hr,G:lr,F:dr,O:cr,P:ur,U:_r}=Oe,{toTwoPointBounds:pr,toTwoPointBoundsByQuadraticCurve:gr,arcTo:fr,arc:yr,ellipse:mr}=ni,{addPointBounds:vr,copy:xr,addPoint:wr,setPoint:br,addBounds:Er,toBounds:Pr}=mt,Br=Jt.get("PathBounds");let kr,Sr,Rr;const Tr={},Cr={},Lr={},Or={toBounds(t,e){Or.toTwoPointBounds(t,Cr),Pr(Cr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return br(e,0,0);let i,s,r,n,a,o=0,h=0,l=0;const d=t.length;for(;o<d;)switch(a=t[o],0===o&&(a===nr||a===sr||a===rr?br(e,h,l):br(e,t[o+1],t[o+2])),a){case er:case ir:h=t[o+1],l=t[o+2],wr(e,h,l),o+=3;break;case sr:r=t[o+5],n=t[o+6],pr(h,l,t[o+1],t[o+2],t[o+3],t[o+4],r,n,Tr),vr(e,Tr),h=r,l=n,o+=7;break;case rr:i=t[o+1],s=t[o+2],r=t[o+3],n=t[o+4],gr(h,l,i,s,r,n,Tr),vr(e,Tr),h=r,l=n,o+=5;break;case nr:o+=1;break;case ar:h=t[o+1],l=t[o+2],Er(e,h,l,t[o+3],t[o+4]),o+=5;break;case or:case hr:h=t[o+1],l=t[o+2],Er(e,h,l,t[o+3],t[o+4]),o+=a===or?9:6;break;case lr:mr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],t[o+7],t[o+8],Tr,Lr),0===o?xr(e,Tr):vr(e,Tr),h=Lr.x,l=Lr.y,o+=9;break;case dr:h=t[o+1],l=t[o+2],Sr=t[o+3],Rr=t[o+4],Er(e,h-Sr,l-Rr,2*Sr,2*Rr),h+=Sr,o+=5;break;case cr:yr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],Tr,Lr),0===o?xr(e,Tr):vr(e,Tr),h=Lr.x,l=Lr.y,o+=7;break;case ur:h=t[o+1],l=t[o+2],kr=t[o+3],Er(e,h-kr,l-kr,2*kr,2*kr),h+=kr,o+=4;break;case _r:fr(null,h,l,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],Tr,Lr),0===o?xr(e,Tr):vr(e,Tr),h=Lr.x,l=Lr.y,o+=6;break;default:return void Br.error(`command: ${a} [index:${o}]`,t)}}},{M:Ir,L:Dr,Z:Ar}=Oe,{getCenterX:Mr,getCenterY:Wr}=lt,{arcTo:Fr}=bs,Ur={smooth(t,e,i){let s,r,n,a=0,o=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;a<g;){switch(s=t[a],s){case Ir:l=_=t[a+1],d=p=t[a+2],a+=3,t[a]===Dr?(c=t[a+1],u=t[a+2],f.push(Ir,Mr(l,c),Wr(d,u))):f.push(Ir,l,d);break;case Dr:switch(o=t[a+1],h=t[a+2],a+=3,t[a]){case Dr:Fr(f,o,h,t[a+1],t[a+2],e,_,p);break;case Ar:Fr(f,o,h,l,d,e,_,p);break;default:f.push(Dr,o,h)}_=o,p=h;break;case Ar:r!==Ar&&(Fr(f,l,d,c,u,e,_,p),f.push(Ar)),a+=1;break;default:n=Fe[s];for(let e=0;e<n;e++)f.push(t[a+e]);a+=n}r=s}return s!==Ar&&(f[1]=l,f[2]=d),f}};function Nr(t){return new Us(t)}const zr=Nr();Ce.creator=Nr(),Ce.parse=$i.parse,Ce.convertToCanvasData=$i.toCanvasData;const{drawRoundRect:Yr}=Ue;function Xr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){Yr(this,t,e,i,s,r)})}(t)}const Hr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=jr.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{}}}},jr=Hr;jr.alphaPixelTypes.forEach(t=>jr.upperCaseTypeMap[t]=t.toUpperCase());const Gr=Jt.get("TaskProcessor");class Vr{constructor(t){this.parallel=!0,this.time=1,this.id=x.create(x.TASK),this.task=t}run(){return ge(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Gr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Kr{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&&_.assign(this.config,t),this.empty()}add(t,e,i){let s,n,a,o;const l=new Vr(t);return l.parent=this,h(e)?o=e:e&&(n=e.parallel,s=e.start,a=e.time,o=e.delay,i||(i=e.canUse)),a&&(l.time=a),!1===n&&(l.parallel=!1),i&&(l.canUse=i),r(o)?this.push(l,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,s))},o)),this.isComplete=!1,l}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++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>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;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=s+e.parallel;if(r>i.length&&(r=i.length),e.parallel>1)for(let e=s;e<r&&(t=i[e],t.parallel);e++)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 qr=Jt.get("Resource"),Zr={tasker:new Kr,map:{},get isComplete(){return Qr.tasker.isComplete},set(t,e){Qr.map[t]&&qr.repeat(t),Qr.map[t]=e},get:t=>Qr.map[t],remove(t){const e=Qr.map[t];e&&(e.destroy&&e.destroy(),delete Qr.map[t])},loadImage(t,e){return new Promise((i,s)=>{const r=this.setImage(t,t,e);r.load(()=>i(r),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ae.image(s)),Qr.set(t,e),e},destroy(){Qr.map={}}},Qr=Zr,Jr={maxRecycled:10,recycledList:[],patternTasker:new Kr,get(t){let e=Zr.get(t.url);return e||Zr.set(t.url,e=ae.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(m.image.isLarge(t)?t.url&&Zr.remove(t.url):(t.clearLevels(),$r.recycledList.push(t)))})},recyclePaint(t){$r.recycle(t.image)},clearRecycled(t){const e=$r.recycledList;(e.length>$r.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&Zr.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Hr.alphaPixelTypes.some(e=>$r.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Hr.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Hr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},$r=Jr,{IMAGE:tn,create:en}=x;class sn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=en(tn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Jr.isFormat("svg",t)&&(this.isSVG=!0),Jr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;Zr.tasker.add(()=>ge(this,void 0,void 0,function*(){return yield m.origin.loadImage(this.url,r(t)?m.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),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,e,i,s,r,n,a){if(t||(t=this.width),e||(e=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 o=m.image.resize(this.view,t,e,r,n,void 0,a,i,s);return this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(t,e,i,s){const r=m.canvas.createPattern(t,e);return m.image.setPatternTransform(r,i,s),r}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function rn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function nn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function an(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function on(t,e){return(i,s)=>ln(i,s,t,e&&e(s))}function hn(t){return t}function ln(t,e,i,s){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};rn(t,e,Object.assign(r,s||{})),Wn(t,e,i)}function dn(t){return on(t)}function cn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function un(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function _n(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),mn(this))}}))}function pn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function gn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function fn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i,e)&&mn(this)}}))}function yn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(mn(this),this.__.__removeNaturalSize())}}))}function mn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function vn(t){return on(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),mn(this)}}))}const xn=fn;function wn(t,e){return on(t,t=>({set(i){this.__setAttr(t,i)&&(bn(this),e&&(this.__.__useStroke=!0))}}))}function bn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&mn(t)}const En=wn;function Pn(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Bn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function kn(t){return on(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;_.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Sn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Tn(this)}}))}function Rn(t){return on(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Cn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Cn(this,t,e,i),this.mask&&Tn(this)}}))}function Tn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Cn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||mn(t))}function Ln(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function On(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function In(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Dn(t){return on(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Jt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function An(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Mn(t){return(e,i)=>{rn(e,"__DataProcessor",{get:()=>t})}}function Wn(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,a=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o=an(e,i);if(r(i))o.get=function(){return this[n]};else if("function"==typeof i)o.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(c(i)){const t=u(i);o.get=function(){const e=this[n];return null==e?this[n]=t?{}:_.clone(i):e}}const h=t.isBranchLeaf;"width"===e?o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=nn(d,e),d=d.__proto__;l&&l.set&&(o.set=l.set),s[a]&&(o.set=s[a],delete s[a]),rn(s,e,o)}const Fn=new Jt("rewrite"),Un=[],Nn=["destroy","constructor"];function zn(t){return(e,i)=>{Un.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Yn(){return t=>{Xn()}}function Xn(t){Un.length&&(Un.forEach(e=>{t&&Fn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Un.length=0)}function Hn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Nn.includes(s)||e&&e.includes(s)))if(t.prototype){nn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function jn(){return t=>{he.register(t)}}function Gn(){return t=>{ce.register(t)}}setTimeout(()=>Xn(!0));const{copy:Vn,toInnerPoint:Kn,toOuterPoint:qn,scaleOfOuter:Zn,rotateOfOuter:Qn,skewOfOuter:Jn,multiplyParent:$n,divideParent:ta,getLayout:ea}=J,ia={},{round:sa}=Math,ra={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),oa(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)aa(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++)ha(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&ha(t),t.__updateChange()},updateAllChange(t){if(da(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)la(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,r,n){s||(s=t.__nowWorld),t.__worldFlipped||m.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,r,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,r){const n=c(e)?Object.assign({},e):{x:e,y:i};s?qn(t.localTransform,n,n,!0):t.parent&&Kn(t.parent.scrollWorldTransform,n,n,!0),na.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,i=0,s){c(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=sa(e),i=sa(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,n){na.zoomOfLocal(t,ca(t,e),i,s,r,n)},zoomOfLocal(t,e,i,s=i,r,n){const a=t.__localMatrix;if(h(s)||(s&&(n=s),s=i),Vn(ia,a),Zn(ia,e,i,s),na.hasHighPosition(t))na.setTransform(t,ia,r,n);else{const e=t.x+ia.e-a.e,o=t.y+ia.f-a.f;n&&!r?t.animate({x:e,y:o,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=o,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){na.rotateOfLocal(t,ca(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;Vn(ia,r),Qn(ia,e,i),na.hasHighPosition(t)?na.setTransform(t,ia,!1,s):t.set({x:t.x+ia.e-r.e,y:t.y+ia.f-r.f,rotation:W.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,n){na.skewOfLocal(t,ca(t,e),i,s,r,n)},skewOfLocal(t,e,i,s=0,r,n){Vn(ia,t.__localMatrix),Jn(ia,e,i,s),na.setTransform(t,ia,r,n)},transformWorld(t,e,i,s){Vn(ia,t.worldTransform),$n(ia,e),t.parent&&ta(ia,t.parent.scrollWorldTransform),na.setTransform(t,ia,i,s)},transform(t,e,i,s){Vn(ia,t.localTransform),$n(ia,e),na.setTransform(t,ia,i,s)},setTransform(t,e,i,s){const r=t.__,n=r.origin&&na.getInnerOrigin(t,r.origin),a=ea(e,n,r.around&&na.getInnerOrigin(t,r.around));if(na.hasOffset(t)&&(a.x-=r.offsetX,a.y-=r.offsetY),i){const e=a.scaleX/t.scaleX,i=a.scaleY/t.scaleY;if(delete a.scaleX,delete a.scaleY,n){Xt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=na.getInnerOrigin(t,r.origin);lt.move(a,n.x-s.x,n.y-s.y)}t.set(a),t.scaleResize(e,i,!1)}else t.set(a,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Zn(i,na.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>lt.tempToOuterOf(na.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Et.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Vn(ia,t.worldTransform),ta(ia,e.scrollWorldTransform),i?ia:Object.assign({},ia)),drop(t,e,i,s){t.setTransform(na.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||na.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,r=e.y*i;e.x-=s,e.y-=r,t.move(s,r),m.requestRender(()=>na.animateMove(t,e,i))}}},na=ra,{updateAllMatrix:aa,updateMatrix:oa,updateAllWorldOpacity:ha,updateAllChange:la,updateChange:da}=na;function ca(t,e){return t.updateLayout(),t.parent?lt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const ua={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>pa(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>pa(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>pa(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let _a;function pa(t,e){return e||(_a=0),t.__.mask&&(_a=1),_a<0?null:(_a&&(_a=-1),!0)}const{updateBounds:ga}=ra,fa={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,r=i.length;s<r;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),ya(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&r(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)ma(e[t],e)},updateBounds(t,e){const i=[t];ma(t,i),va(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let r=t.length-1;r>-1;r--){i=t[r],s=i.children;for(let t=0,e=s.length;t<e;t++)ga(s[t]);e&&e===i||ga(i)}},move(t,e,i){let s;const{children:r}=t;for(let n=0,a=r.length;n<a;n++)s=(t=r[n]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&xa(t,e,i)},scale(t,e,i,s,r,n,a){let o;const{children:h}=t,l=s-1,d=r-1;for(let c=0,u=h.length;c<u;c++)o=(t=h[c]).__world,o.a*=s,o.d*=r,(o.b||o.c)&&(o.b*=s,o.c*=r),o.e===o.x&&o.f===o.y?(o.x=o.e+=(o.e-n)*l+e,o.y=o.f+=(o.f-a)*d+i):(o.e+=(o.e-n)*l+e,o.f+=(o.f-a)*d+i,o.x+=(o.x-n)*l+e,o.y+=(o.y-a)*d+i),o.width*=s,o.height*=r,o.scaleX*=s,o.scaleY*=r,t.isBranch&&wa(t,e,i,s,r,n,a)}},{pushAllChildBranch:ya,pushAllBranchStack:ma,updateBoundsByBranchStack:va,move:xa,scale:wa}=fa,ba={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:Ea,updateBounds:Pa}=ra,{toOuterOf:Ba,getPoints:ka,copy:Sa}=Xt,Ra="_localContentBounds",Ta="_worldContentBounds",Ca="_worldBoxBounds",La="_worldStrokeBounds";class Oa{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 Ba(this.contentBounds,this.leaf.__localMatrix,this[Ra]||(this[Ra]={})),this[Ra]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Ba(this.contentBounds,this.leaf.__world,this[Ta]||(this[Ta]={})),this[Ta]}get worldBoxBounds(){return Ba(this.boxBounds,this.leaf.__world,this[Ca]||(this[Ca]={})),this[Ca]}get worldStrokeBounds(){return Ba(this.strokeBounds,this.leaf.__world,this[La]||(this[La]={})),this[La]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return Pa(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,m.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 J.defaultMatrix;case"page":t=e.zoomLayer;default:return Ea(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 Vt(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 r,n,a,o=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(o),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;a={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(o);break;case"inner":r=o,n=J.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(o,e),n=Ea(s,e,!0)}if(a||(a=J.getLayout(n)),Sa(a,o),lt.copy(a,r),i){const{scaleX:t,scaleY:e}=a,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(a.scaleX/=i,a.scaleY/=s,a.width*=i,a.height*=s)}return a}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=ka(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return r(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):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.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Ia{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&m.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&m.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&m.event.stop(this.origin)}}class Da extends Ia{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Da.ADD="child.add",Da.REMOVE="child.remove",Da.CREATED="created",Da.MOUNTED="mounted",Da.UNMOUNTED="unmounted",Da.DESTROY="destroy";const Aa="property.scroll";class Ma extends Ia{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}}Ma.CHANGE="property.change",Ma.LEAFER_CHANGE="property.leafer_change",Ma.SCROLL=Aa;const Wa={scrollX:Aa,scrollY:Aa};class Fa extends Ia{constructor(t,e){super(t),Object.assign(this,e)}}Fa.LOAD="image.load",Fa.LOADED="image.loaded",Fa.ERROR="image.error";class Ua extends Ia{static checkHas(t,e,i){"on"===i?e===Xa?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Na)||t.hasEvent(za)||t.hasEvent(Ya),t.__hasWorldEvent=t.hasEvent(Xa))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Na,t),"inner"===e&&t.emit(za,t)),t.emit(Ya,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Xa,this)}}Ua.RESIZE="bounds.resize",Ua.INNER="bounds.inner",Ua.LOCAL="bounds.local",Ua.WORLD="bounds.world";const{RESIZE:Na,INNER:za,LOCAL:Ya,WORLD:Xa}=Ua,Ha={};[Na,za,Ya,Xa].forEach(t=>Ha[t]=1);class ja extends Ia{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){c(t)?(super(ja.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!r(this.resizingKeys[t.innerId])}}ja.RESIZE="resize";class Ga extends Ia{constructor(t,e){super(t),this.data=e}}Ga.REQUEST="watch.request",Ga.DATA="watch.data";class Va extends Ia{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Va.REQUEST="layout.request",Va.START="layout.start",Va.BEFORE="layout.before",Va.LAYOUT="layout",Va.AFTER="layout.after",Va.AGAIN="layout.again",Va.END="layout.end";class Ka extends Ia{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Ka.REQUEST="render.request",Ka.CHILD_START="render.child_start",Ka.CHILD_END="render.child_end",Ka.START="render.start",Ka.BEFORE="render.before",Ka.RENDER="render",Ka.AFTER="render.after",Ka.AGAIN="render.again",Ka.END="render.end",Ka.NEXT="render.next";class qa extends Ia{}qa.START="leafer.start",qa.BEFORE_READY="leafer.before_ready",qa.READY="leafer.ready",qa.AFTER_READY="leafer.after_ready",qa.VIEW_READY="leafer.view_ready",qa.VIEW_COMPLETED="leafer.view_completed",qa.STOP="leafer.stop",qa.RESTART="leafer.restart",qa.END="leafer.end",qa.UPDATE_MODE="leafer.update_mode",qa.TRANSFORM="leafer.transform",qa.MOVE="leafer.move",qa.SCALE="leafer.scale",qa.ROTATE="leafer.rotate",qa.SKEW="leafer.skew";const{MOVE:Za,SCALE:Qa,ROTATE:Ja,SKEW:$a}=qa,to={x:Za,y:Za,scaleX:Qa,scaleY:Qa,rotation:Ja,skewX:$a,skewY:$a},eo={};class io{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,r,n;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const o=so(this,s,!0),h=a(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(n=o[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(l):o[t]=[l],Ha[t]&&Ua.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,r,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const a=so(this,t);s.forEach(t=>{t&&(r=a[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete a[t],Ha[t]&&Ua.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ce.has(t)&&(e=ce.get(t,{type:t,target:this,current:this}));const s=so(this,i)[t];if(s){let r;for(let n=0,a=s.length;n<a&&!((r=s[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),n--,a--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],a=s&&s[t];return!!(r(e)?n||a:e?a:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function so(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:eo)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:eo)}}const{on:ro,on_:no,off:ao,off_:oo,once:ho,emit:lo,emitEvent:co,hasEvent:uo,destroy:_o}=io.prototype,po={on:ro,on_:no,off:ao,off_:oo,once:ho,emit:lo,emitEvent:co,hasEvent:uo,destroyEventer:_o},go=Jt.get("setAttr"),fo={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||o(e)||r(e)||(go.warn(this.innerName,t,e),e=void 0),c(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Ma(Ma.LEAFER_CHANGE,this,t,s,e));const i=to[t];i&&(this.emitEvent(new qa(i,this)),this.emitEvent(new qa(qa.TRANSFORM,this)))}this.emitPropertyEvent(Ma.CHANGE,t,s,e);const i=Wa[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const r=new Ma(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||r(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:yo,multiplyParent:mo,translateInner:vo,defaultWorld:xo}=J,{toPoint:wo,tempPoint:bo}=Et,Eo={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:r}=this;mo(this.__local||e,t?t.__scrollWorld||t.__world:xo,i,!!e.affectScaleOrRotation,r),s&&vo(Object.assign(s,i),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(yo(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(wo(i.around||i.origin,t.boxBounds,bo),vo(e,-bo.x,-bo.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Po,updateAllMatrix:Bo}=ra,{updateBounds:ko}=fa,{toOuterOf:So,copyAndSpread:Ro,copy:To}=Xt,{toBounds:Co}=Or,Lo={__updateWorldBounds(){const{__layout:t,__world:e}=this;So(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Ua.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Ua.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),So(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){So(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){So(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Co(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Bo(this),ko(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Bo(this),ko(this,this))):Po(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ro(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;h(i)&&i<=0?To(e.renderBounds,e.strokeBounds):Ro(e.renderBounds,e.boxBounds,i)}},Oo={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(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),ra.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Jt.showBounds&&Jt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Io}=ua,Do={__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.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,r,r,i.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Io(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Io(i[s],e)||i[s].__clip(t,e)}}},Ao={},{LEAF:Mo,create:Wo}=x,{stintSet:Fo}=_,{toInnerPoint:Uo,toOuterPoint:No,multiplyParent:zo}=J,{toOuterOf:Yo}=Xt,{copy:Xo,move:Ho}=lt,{moveLocal:jo,zoomOfLocal:Go,rotateOfLocal:Vo,skewOfLocal:Ko,moveWorld:qo,zoomOfWorld:Zo,rotateOfWorld:Qo,skewOfWorld:Jo,transform:$o,transformWorld:th,setTransform:eh,getFlipTransform:ih,getLocalOrigin:sh,getRelativeWorld:rh,drop:nh}=ra;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 g}get __LayoutProcessor(){return Oa}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 scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}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.updateLayout(),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=Wo(Mo),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Da.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(Da.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Da.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(Da.MOUNTED)):this.__emitLifeEvent(Da.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){r(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=r(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__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 zo(i,t.matrix,e,void 0,i),Yo(this.__layout.renderBounds,e,e),Fo(e,"half",i.half),Fo(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=Jr.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Ao.scaleX=i,Ao.scaleY=s,Ao}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?rh(this,e):this.worldTransform,r=i?t:{};return Yo(t,s,r),r}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),Uo(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){No(this.scrollWorldTransform,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 r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return Ho(r,-n,-a),r}getInnerPoint(t,e,i,s){const r=s?t:{};return this.worldToInner(t,r,i,e),r}getInnerPointByBox(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return Ho(r,n,a),r}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const r=s?t:{};return this.worldToLocal(t,r,i,e),r}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 r=s?t:{};return this.innerToWorld(t,r,i,e),r}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const r=s?t:{};return this.localToWorld(t,r,i,e),r}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){eh(this,t,e,i)}transform(t,e,i){$o(this,t,e,i)}move(t,e,i){jo(this,t,e,i)}moveInner(t,e,i){qo(this,t,e,!0,i)}scaleOf(t,e,i,s,r){Go(this,sh(this,t),e,i,s,r)}rotateOf(t,e,i){Vo(this,sh(this,t),e,i)}skewOf(t,e,i,s,r){Ko(this,sh(this,t),e,i,s,r)}transformWorld(t,e,i){th(this,t,e,i)}moveWorld(t,e,i){qo(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){Zo(this,t,e,i,s,r)}rotateOfWorld(t,e){Qo(this,t,e)}skewOfWorld(t,e,i,s,r){Jo(this,t,e,i,s,r)}flip(t,e){$o(this,ih(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return ne.need("path")}getMotionPoint(t){return ne.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){nh(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Wn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=fn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Da(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Da.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=pe([Hn(fo),Hn(Eo),Hn(Lo),Hn(po),Hn(Oo)],t.Leaf);const{setListWithFn:ah}=Xt,{sort:oh}=fa,{localBoxBounds:hh,localStrokeBounds:lh,localRenderBounds:dh,maskLocalBoxBounds:ch,maskLocalStrokeBounds:uh,maskLocalRenderBounds:_h}=ua,ph=new Jt("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(t,e){ah(e||this.__layout.boxBounds,this.children,this.__hasMask?ch:hh)}__updateStrokeBounds(t){ah(t||this.__layout.strokeBounds,this.children,this.__hasMask?uh:lh)}__updateRenderBounds(t){ah(t||this.__layout.renderBounds,this.children,this.__hasMask?_h:dh)}__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(oh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return ph.warn("add self or destroyed");const i=r(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=he.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(Da.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Da.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):r(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Da.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Da.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Da(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=pe([Hn(Do)],t.Branch);class gh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!r(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return r(e)?-1:e}add(t){const{list:e,keys:i}=this;r(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(r(i[t.innerId])){const{list:s}=this;for(let t=e,r=s.length;t<r;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)r(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;r(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new gh;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 fh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!r(this.keys[t.innerId])}without(t){return r(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class yh extends Te{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=m.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}Xr(OffscreenCanvasRenderingContext2D.prototype),Xr(Path2D.prototype);const{mineType:mh}=Hr;function vh(t,e){m.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,r)=>{t.convertToBlob({type:mh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)}).catch(t=>{r(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:mh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",m.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},m.canvas=ae.canvas(),m.conicGradientSupport=!!m.canvas.context.createConicGradient}Object.assign(ae,{canvas:(t,e)=>new yh(t,e),image:t=>new sn(t)}),m.name="web",m.isWorker=!0,m.backgrounder=!0,m.requestRender=function(t){requestAnimationFrame(t)},rn(m,"devicePixelRatio",{get:()=>1});const{userAgent:xh}=navigator;xh.indexOf("Firefox")>-1?(m.conicGradientRotate90=!0,m.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(m.fullImageShadow=!0),xh.indexOf("Windows")>-1?(m.os="Windows",m.intWheelDeltaY=!0):xh.indexOf("Mac")>-1?m.os="Mac":xh.indexOf("Linux")>-1&&(m.os="Linux");class wh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new gh;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 gh,this.target=t,e&&(this.config=_.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(Ka.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Da.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 Ga(Ga.DATA,{updatedList:this.updatedList})),this.__updatedList=new gh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Ma.CHANGE,this.__onAttrChange,this],[[Da.ADD,Da.REMOVE],this.__onChildEvent,this],[Ga.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:bh,updateBounds:Eh,updateChange:Ph}=ra,{pushAllChildBranch:Bh,pushAllParent:kh}=fa;const{worldBounds:Sh}=ua;class Rh{constructor(t){this.updatedBounds=new Vt,this.beforeBounds=new Vt,this.afterBounds=new Vt,d(t)&&(t=new gh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Sh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Sh),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:Th,updateAllChange:Ch}=ra,Lh=Jt.get("Layouter");class Oh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new fh,this.target=t,e&&(this.config=_.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(Va.START),this.layoutOnce(),t.emitEvent(new Va(Va.END,this.layoutedBlocks,this.times))}catch(t){Lh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Lh.warn("layouting"):this.times>3?Lh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Ga.REQUEST),this.totalTimes>1&&this.config.usePartLayout?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=ie.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:n,AFTER:a}=Va,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),i.emitEvent(new Va(r,o,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?(bh(t,!0),e.add(t),t.isBranch&&Bh(t,e),kh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),kh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;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||Eh(s[t])}Eh(i)}})}(this.__levelList),function(t){t.list.forEach(Ph)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),i.emitEvent(new Va(n,o,this.times)),i.emitEvent(new Va(a,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,ie.end(e)}fullLayout(){const t=ie.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:r}=Va,n=this.getBlocks(new gh(e));e.emitEvent(new Va(i,n,this.times)),Oh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Va(s,n,this.times)),e.emitEvent(new Va(r,n,this.times)),this.addBlocks(n),ie.end(t)}static fullLayout(t){Th(t,!0),t.isBranch?fa.updateBounds(t):ra.updateBounds(t),Ch(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Rh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Rh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[Va.REQUEST,this.layout,this],[Va.AGAIN,this.layoutAgain,this],[Ga.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Ih=Jt.get("Renderer");class Dh{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:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=_.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.requestTime||this.__requestRender()}requestLayout(){this.target.emit(Va.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Ka.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Ka.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Ka.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Vt,Ih.log(e.innerName,"---\x3e");try{this.emitRender(Ka.START),this.renderOnce(t),this.emitRender(Ka.END,this.totalBounds),Jr.clearRecycled()}catch(t){this.rendering=!1,Ih.error(t)}Ih.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ih.warn("rendering");if(this.times>3)return Ih.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Vt,this.renderOptions={},t)this.emitRender(Ka.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Ka.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Ka.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Ka.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=ie.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),r=new Vt(s);i.save(),s.spread(Dh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,r),i.restore(),ie.end(e)}fullRender(){const t=ie.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ie.end(t)}__render(t,e){const{canvas:i,target:s}=this,r=t.includes(s.__world),n=r?{includes:r}:{bounds:t,includes:r};this.needFill&&i.fillWorld(t,this.config.fill),Jt.showRepaint&&Jt.drawRepaint(i,t),this.config.useCellRender&&(n.cellList=this.getCellList()),m.render(s,i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Vt;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);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return m.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};m.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Vt(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 Vt(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||Ih.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 Ka(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Ka.REQUEST,this.update,this],[Va.END,this.__onLayoutEnd,this],[Ka.AGAIN,this.renderAgain,this],[ja.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Dh.clipSpread=10;const{hitRadiusPoint:Ah}=Xt;class Mh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,r=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new gh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:a}=this.findList,o=this.getBestMatchLeaf(a,i.bottomList,r,!!i.findList),h=r?this.getPath(o):this.getHitablePath(o);return this.clear(),s?{path:h,target:o,throughPath:a.length?this.getThroughPath(a):h}:{path:h,target:o}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const r=this.findList=new gh;if(t.length){let e;const{x:s,y:n}=this.point,a={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||ra.worldHittable(e))&&(this.hitChild(e,a),r.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ra.hasParent(t,e))){r.reset();break}return r.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),r.length)return r.list[0];return s?null:i?t[0]:t.find(t=>ra.worldHittable(t))}getPath(t){const e=new gh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new gh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new gh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,r,n;for(let t=0,a=i.length;t<a;t++){s=i[t],r=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!r||!r.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:r}=this;for(let n=t.length-1;n>-1;n--)if(i=t[n],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Ah(i.__world,r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(r,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,r=[];const{children:n}=s;for(let s=0,a=n.length;s<a;s++)if(i=n[s],i.__.mask&&r.push(i),i===t){if(r&&!r.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Wh{constructor(t,e){this.config={},e&&(this.config=_.default(e,this.config)),this.picker=new Mh(this.target=t,this),this.finder=ae.finder&&ae.finder()}getByPoint(t,e,i){const{target:s,picker:r}=this;return m.backgrounder&&s&&s.updateLayout(),r.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):ne.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Fh(t){return on(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Uh(t){return on(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Nh(){return(t,e)=>{const i="_"+e;rn(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(ae,{watcher:(t,e)=>new wh(t,e),layouter:(t,e)=>new Oh(t,e),renderer:(t,e,i)=>new Dh(t,e,i),selector:(t,e)=>new Wh(t,e)}),m.layout=Oh.fullLayout,m.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new gh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const zh={},Yh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Xh={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Hh={},jh={},Gh={},Vh={},Kh={},qh={apply(){ne.need("filter")}},Zh={},Qh={setStyleName:()=>ne.need("state"),set:()=>ne.need("state")},Jh={list:{},register(t,e){Jh.list[t]=e},get:t=>Jh.list[t]},{parse:$h,objectToCanvasData:tl}=$i,{stintSet:el}=_,{hasTransparent:il}=Yh,sl={originPaint:{}},rl=Jt.get("UIData");class nl extends g{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,rl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,rl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(el(this,"__isTransparentFill",il(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(el(this,"__isTransparentStroke",il(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?$h(t):tl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){al(this,"shadow",t)}setInnerShadow(t){al(this,"innerShadow",t)}setFilter(t){al(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&jh.compute("fill",this.__leaf),e&&jh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),r(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=sl)):(this.__isStrokes=!0,this._stroke||(this._stroke=sl))}__removePaint(t,e){e&&this.__removeInput(t),Gh.recycleImage(t,this),"fill"===t?(el(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(el(this,"__isAlphaPixelStroke",void 0),el(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function al(t,e,i){t.__setInput(e,i),d(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class ol extends nl{}class hl extends ol{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class ll extends ol{__getInputData(t,e){const i=super.__getInputData(t,e);return Re.forEach(t=>delete i[t]),i}}class dl extends hl{}class cl extends nl{get __usePathBox(){return this.points||this.__pathInputed}}class ul extends nl{get __boxStroke(){return!this.__pathInputed}}class _l extends nl{get __boxStroke(){return!this.__pathInputed}}class pl extends cl{}class gl extends nl{}class fl extends nl{get __pathInputed(){return 2}}class yl extends ol{}const ml={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class vl extends nl{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=ml[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=he.get("Rect",0);const r=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=r.boxBounds),i.set(t),n.strokeChanged&&r.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class xl extends ul{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class wl extends ul{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{max:bl,add:El}=S,Pl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:r}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),n&&(t=bl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n,renderSpread:a}=this.__,{strokeSpread:o}=this.__layout,h=this.__box;e&&(t=Kh.getShadowRenderSpread(this,e)),s&&(t=bl(t,s)),n&&(t=El(t,qh.getSpread(n))),a&&(t=El(t,a)),o&&(t=El(t,o));let l=t;return i&&(l=bl(l,Kh.getInnerShadowSpread(this,i))),r&&(l=bl(l,r)),this.__layout.renderShapeSpread=l,h?bl(h.__updateRenderSpread(),t):t}},{stintSet:Bl}=_,kl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Bl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Bl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Bl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Kh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),Bl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Sl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:r,stroke:n,__drawAfterFill:a,__fillAfterStroke:o,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=jh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Kh.shadow(this,t,h),o&&(s.__isStrokes?jh.strokes(n,this,t,e):jh.stroke(n,this,t,e)),r&&(s.__isFills?jh.fills(r,this,t,e):jh.fill(r,this,t,e)),a&&this.__drawAfterFill(t,e),d&&Kh.innerShadow(this,t,h),n&&!o&&(s.__isStrokes?jh.strokes(n,this,t,e):jh.stroke(n,this,t,e)),c&&qh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(o&&(s.__isStrokes?jh.strokes(n,this,t,e):jh.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*r,e.blur*i,Yh.string(e.color))}r&&(s.__isFills?jh.fills(r,this,t,e):jh.fill(r,this,t,e)),h&&t.restore(),a&&this.__drawAfterFill(t,e),n&&!o&&(s.__isStrokes?jh.strokes(n,this,t,e):jh.stroke(n,this,t,e))}}else s.__pathInputed?Sl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:r}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?jh.fills(s,this,t,e):jh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?jh.strokes(r,this,t,e):jh.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Sl(t,e,i){const{fill:s,stroke:r,__drawAfterFill:n,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&jh.stroke(r,t,e,i),s&&jh.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),r&&!a&&jh.stroke(r,t,e,i)}const Rl={__drawFast(t,e){let{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;const{fill:a,stroke:o,__drawAfterFill:h}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,r,n)),h&&this.__drawAfterFill(t,e),o){const{strokeAlign:a,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(o,h,this.__);const l=h/2;switch(a){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,n),t.restore()):t.strokeRect(i+l,s+l,r,n);break;case"outside":t.strokeRect(i-l,s-l,r+h,n+h)}}}};var Tl,Cl;t.UI=Tl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){W.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return zr.set(this.path=t||[]),t||this.__drawPathByBox(zr),zr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return ne.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ne.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(zr.set(i=[]),this.__drawPathByBox(zr)),t?$i.toCanvasData(i,!0):i}getPathString(t,e,i){return $i.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Zh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Ur.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Hh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?tr.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,r,h(n)?[n]:n)}else t.rect(e,i,s,r)}drawImagePlaceholder(t,e,i){jh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),ne.need("animate")}killAnimate(t,e){}export(t,e){return ne.need("export")}syncExport(t,e){return ne.need("export")}clone(t){const e=_.clone(this.toJSON());return t&&Object.assign(e,t),Tl.one(e)}static one(t,e,i,s,r){return he.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){jn()(this)}static registerData(t){Mn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},pe([Mn(nl)],t.UI.prototype,"__",void 0),pe([Nh()],t.UI.prototype,"zoomLayer",void 0),pe([dn("")],t.UI.prototype,"id",void 0),pe([dn("")],t.UI.prototype,"name",void 0),pe([dn("")],t.UI.prototype,"className",void 0),pe([Bn("pass-through")],t.UI.prototype,"blendMode",void 0),pe([Sn(1)],t.UI.prototype,"opacity",void 0),pe([Rn(!0)],t.UI.prototype,"visible",void 0),pe([Bn(!1)],t.UI.prototype,"locked",void 0),pe([kn(!1)],t.UI.prototype,"dim",void 0),pe([kn(!1)],t.UI.prototype,"dimskip",void 0),pe([Ln(0)],t.UI.prototype,"zIndex",void 0),pe([On(!1)],t.UI.prototype,"mask",void 0),pe([In(!1)],t.UI.prototype,"eraser",void 0),pe([cn(0,!0)],t.UI.prototype,"x",void 0),pe([cn(0,!0)],t.UI.prototype,"y",void 0),pe([fn(100,!0)],t.UI.prototype,"width",void 0),pe([fn(100,!0)],t.UI.prototype,"height",void 0),pe([pn(1,!0)],t.UI.prototype,"scaleX",void 0),pe([pn(1,!0)],t.UI.prototype,"scaleY",void 0),pe([gn(0,!0)],t.UI.prototype,"rotation",void 0),pe([gn(0,!0)],t.UI.prototype,"skewX",void 0),pe([gn(0,!0)],t.UI.prototype,"skewY",void 0),pe([cn(0,!0)],t.UI.prototype,"offsetX",void 0),pe([cn(0,!0)],t.UI.prototype,"offsetY",void 0),pe([un(0,!0)],t.UI.prototype,"scrollX",void 0),pe([un(0,!0)],t.UI.prototype,"scrollY",void 0),pe([_n()],t.UI.prototype,"origin",void 0),pe([_n()],t.UI.prototype,"around",void 0),pe([dn(!1)],t.UI.prototype,"lazy",void 0),pe([yn(1)],t.UI.prototype,"pixelRatio",void 0),pe([Pn(0)],t.UI.prototype,"renderSpread",void 0),pe([vn()],t.UI.prototype,"path",void 0),pe([xn()],t.UI.prototype,"windingRule",void 0),pe([xn(!0)],t.UI.prototype,"closed",void 0),pe([fn(0)],t.UI.prototype,"padding",void 0),pe([fn(!1)],t.UI.prototype,"lockRatio",void 0),pe([fn()],t.UI.prototype,"widthRange",void 0),pe([fn()],t.UI.prototype,"heightRange",void 0),pe([dn(!1)],t.UI.prototype,"draggable",void 0),pe([dn()],t.UI.prototype,"dragBounds",void 0),pe([dn("auto")],t.UI.prototype,"dragBoundsType",void 0),pe([dn(!1)],t.UI.prototype,"editable",void 0),pe([Dn(!0)],t.UI.prototype,"hittable",void 0),pe([Dn("path")],t.UI.prototype,"hitFill",void 0),pe([En("path")],t.UI.prototype,"hitStroke",void 0),pe([Dn(!1)],t.UI.prototype,"hitBox",void 0),pe([Dn(!0)],t.UI.prototype,"hitChildren",void 0),pe([Dn(!0)],t.UI.prototype,"hitSelf",void 0),pe([Dn()],t.UI.prototype,"hitRadius",void 0),pe([An("")],t.UI.prototype,"cursor",void 0),pe([Bn()],t.UI.prototype,"fill",void 0),pe([En(void 0,!0)],t.UI.prototype,"stroke",void 0),pe([En("inside")],t.UI.prototype,"strokeAlign",void 0),pe([En(1,!0)],t.UI.prototype,"strokeWidth",void 0),pe([En(!1)],t.UI.prototype,"strokeWidthFixed",void 0),pe([En("none")],t.UI.prototype,"strokeCap",void 0),pe([En("miter")],t.UI.prototype,"strokeJoin",void 0),pe([En()],t.UI.prototype,"dashPattern",void 0),pe([En(0)],t.UI.prototype,"dashOffset",void 0),pe([En(10)],t.UI.prototype,"miterLimit",void 0),pe([xn(0)],t.UI.prototype,"cornerRadius",void 0),pe([xn()],t.UI.prototype,"cornerSmoothing",void 0),pe([Fh()],t.UI.prototype,"shadow",void 0),pe([Fh()],t.UI.prototype,"innerShadow",void 0),pe([Fh()],t.UI.prototype,"blur",void 0),pe([Fh()],t.UI.prototype,"backgroundBlur",void 0),pe([Fh()],t.UI.prototype,"grayscale",void 0),pe([Fh()],t.UI.prototype,"filter",void 0),pe([Bn()],t.UI.prototype,"placeholderColor",void 0),pe([dn(100)],t.UI.prototype,"placeholderDelay",void 0),pe([dn({})],t.UI.prototype,"data",void 0),pe([zn(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Tl=pe([Hn(Pl),Hn(kl),Yn()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},pe([Mn(ol)],t.Group.prototype,"__",void 0),pe([fn(0)],t.Group.prototype,"width",void 0),pe([fn(0)],t.Group.prototype,"height",void 0),t.Group=pe([Hn(t.Branch),jn()],t.Group);const Ll=Jt.get("Leafer");t.Leafer=Cl=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&&Zr.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),Cl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,_.assign(s,t));const r=this.canvas=ae.canvas(s);this.__controllers.push(this.renderer=ae.renderer(this,r,s),this.watcher=ae.watcher(this,s),this.layouter=ae.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=ae.selector(this),this.interaction=ae.interaction(this,r,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ae.hitCanvasManager()),this.canvasManager=new _e,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(r),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),ba.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(qa.RESTART):this.emitLeafer(qa.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(qa.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=_.copyAttrs({},t,Re);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Vt(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=_.copyAttrs({},this.canvas,Re);e.resize(t),this.updateLazyBounds(),this.__onResize(new ja(t,i))}__onResize(t){this.emitEvent(t),_.copyAttrs(this.__,t,Re),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(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new qt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Re.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())):"mode"===t&&this.emit(qa.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Re.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,r=_.copyAttrs({},s,Re);r[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__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(qa.BEFORE_READY),this.emitLeafer(qa.READY),this.emitLeafer(qa.AFTER_READY),ba.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(qa.VIEW_READY),ba.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:n}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(r=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){ba.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(qa.VIEW_COMPLETED),ba.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 ne.need("view")}getValidMove(t,e,i){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 qa(t,this))}__listenEvents(){const t=ie.start("FirstCreate "+this.innerName);this.once([[qa.START,()=>ie.end(t)],[Va.START,this.updateLazyBounds,this],[Ka.START,this.__onCreated,this],[Ka.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Ga.DATA,this.__onWatchData,this],[Va.END,this.__onLayoutEnd,this],[Ka.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Cl.list.remove(this);try{this.stop(),this.emitLeafer(qa.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Jr.clearRecycled()},100)}catch(t){Ll.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new gh,pe([Mn(ll)],t.Leafer.prototype,"__",void 0),pe([fn()],t.Leafer.prototype,"pixelRatio",void 0),pe([dn("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Cl=pe([jn()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},pe([Mn(ul)],t.Rect.prototype,"__",void 0),t.Rect=pe([Hn(Rl),Yn(),jn()],t.Rect);const{add:Ol,includes:Il,scroll:Dl}=Xt,Al=t.Rect.prototype,Ml=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:r,boxBounds:n}=s,{overflow:a}=i,o=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(o),(e=a&&a.includes("scroll"))&&(Ol(o,n),Dl(o,i)),this.__updateRectRenderBounds(),t=!Il(n,o),t&&"show"===a&&Ol(r,o)}else this.__updateRectRenderBounds();_.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},pe([Mn(hl)],t.Box.prototype,"__",void 0),pe([fn(100)],t.Box.prototype,"width",void 0),pe([fn(100)],t.Box.prototype,"height",void 0),pe([dn(!1)],t.Box.prototype,"resizeChildren",void 0),pe([Pn("show")],t.Box.prototype,"overflow",void 0),pe([zn(Al.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),pe([zn(Al.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),pe([zn(Al.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),pe([zn(Al.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),pe([zn(Al.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),pe([zn(Al.__updateChange)],t.Box.prototype,"__updateRectChange",null),pe([zn(Al.__render)],t.Box.prototype,"__renderRect",null),pe([zn(Ml.__render)],t.Box.prototype,"__renderGroup",null),t.Box=pe([Yn(),jn()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},pe([Mn(dl)],t.Frame.prototype,"__",void 0),pe([Bn("#FFFFFF")],t.Frame.prototype,"fill",void 0),pe([Pn("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=pe([jn()],t.Frame);const{moveTo:Wl,closePath:Fl,ellipse:Ul}=bs;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:r}=this.__,n=t/2,a=e/2,o=this.__.path=[];i?(s||r?(i<1&&Ul(o,n,a,n*i,a*i,0,s,r,!1),Ul(o,n,a,n,a,0,r,s,!0),i<1&&Fl(o)):(i<1&&(Ul(o,n,a,n*i,a*i),Wl(o,t,a)),Ul(o,n,a,n,a,0,360,0,!0)),m.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||r?(Wl(o,n,a),Ul(o,n,a,n,a,0,s,r,!1),Fl(o)):Ul(o,n,a,n,a)}},pe([Mn(_l)],t.Ellipse.prototype,"__",void 0),pe([xn(0)],t.Ellipse.prototype,"innerRadius",void 0),pe([xn(0)],t.Ellipse.prototype,"startAngle",void 0),pe([xn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=pe([jn()],t.Ellipse);const{sin:Nl,cos:zl,PI:Yl}=Math,{moveTo:Xl,lineTo:Hl,closePath:jl,drawPoints:Gl}=bs;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Gl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:r}=t,n=i/2,a=s/2;Xl(e,n,0);for(let t=1;t<r;t++)Hl(e,n+n*Nl(2*t*Yl/r),a-a*zl(2*t*Yl/r));jl(e)}}},pe([Mn(pl)],t.Polygon.prototype,"__",void 0),pe([xn(3)],t.Polygon.prototype,"sides",void 0),pe([xn()],t.Polygon.prototype,"points",void 0),pe([xn(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=pe([Yn(),jn()],t.Polygon);const{sin:Vl,cos:Kl,PI:ql}=Math,{moveTo:Zl,lineTo:Ql,closePath:Jl}=bs;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,r=t/2,n=e/2,a=this.__.path=[];Zl(a,r,0);for(let t=1;t<2*i;t++)Ql(a,r+(t%2==0?r:r*s)*Vl(t*ql/i),n-(t%2==0?n:n*s)*Kl(t*ql/i));Jl(a)}},pe([Mn(gl)],t.Star.prototype,"__",void 0),pe([xn(5)],t.Star.prototype,"corners",void 0),pe([xn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=pe([jn()],t.Star);const{moveTo:$l,lineTo:td,drawPoints:ed}=bs,{rotate:id,getAngle:sd,getDistance:rd,defaultPoint:nd}=lt;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&&id(i,e),i}set toPoint(t){this.width=rd(nd,t),this.rotation=sd(nd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?ed(e,t.points,t.curve,t.closed):($l(e,0,0),td(e,this.width,0))}},pe([Mn(cl)],t.Line.prototype,"__",void 0),pe([wn("center")],t.Line.prototype,"strokeAlign",void 0),pe([fn(0)],t.Line.prototype,"height",void 0),pe([xn()],t.Line.prototype,"points",void 0),pe([xn(0)],t.Line.prototype,"curve",void 0),pe([xn(!1)],t.Line.prototype,"closed",void 0),t.Line=pe([jn()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}},pe([Mn(xl)],t.Image.prototype,"__",void 0),pe([fn("")],t.Image.prototype,"url",void 0),t.Image=pe([jn()],t.Image);const ad=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ae.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new sn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Fa(Fa.LOADED,{image:t}))})}draw(t,e,i,s){const r=new ft(t.worldTransform).invert(),n=new ft;e&&n.translate(e.x,e.y),i&&(h(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},pe([Mn(wl)],t.Canvas.prototype,"__",void 0),pe([Uh(100)],t.Canvas.prototype,"width",void 0),pe([Uh(100)],t.Canvas.prototype,"height",void 0),pe([Uh(1)],t.Canvas.prototype,"pixelRatio",void 0),pe([Uh(!0)],t.Canvas.prototype,"smooth",void 0),pe([dn(!1)],t.Canvas.prototype,"safeResize",void 0),pe([Uh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=pe([jn()],t.Canvas);const{copyAndSpread:od,includes:hd,spread:ld,setList:dd}=Xt,{stintSet:cd}=_;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:r,fontWeight:n,italic:a,textCase:o,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Xh.number(e,r),t.__letterSpacing=Xh.number(i,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${a?"italic ":""}${"small-caps"===o?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${s||"caption"}`,cd(t,"__padding",l&&W.fourNumber(l)),cd(t,"__clipText","show"!==h&&!t.__autoSize),cd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==o),t.__textDrawData=zh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:r,__autoWidth:n,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:o}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=o,t.__lineHeight<i&&ld(o,i/2),n||a){if(h.x=n?o.x:0,h.y=a?o.y:0,h.width=n?o.width:t.width,h.height=a?o.height:t.height,r){const[e,i,s,r]=t.__padding;n&&(h.x-=r,h.width+=i+r),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),_.stintSet(this,"isOverflow",!hd(h,o)),this.isOverflow?(dd(t.__textBoxBounds={},[h,o]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;od(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},pe([Mn(vl)],t.Text.prototype,"__",void 0),pe([fn(0)],t.Text.prototype,"width",void 0),pe([fn(0)],t.Text.prototype,"height",void 0),pe([Bn()],t.Text.prototype,"boxStyle",void 0),pe([dn(!1)],t.Text.prototype,"resizeFontSize",void 0),pe([Bn("#000000")],t.Text.prototype,"fill",void 0),pe([wn("outside")],t.Text.prototype,"strokeAlign",void 0),pe([Dn("all")],t.Text.prototype,"hitFill",void 0),pe([fn("")],t.Text.prototype,"text",void 0),pe([fn("")],t.Text.prototype,"placeholder",void 0),pe([fn("caption")],t.Text.prototype,"fontFamily",void 0),pe([fn(12)],t.Text.prototype,"fontSize",void 0),pe([fn("normal")],t.Text.prototype,"fontWeight",void 0),pe([fn(!1)],t.Text.prototype,"italic",void 0),pe([fn("none")],t.Text.prototype,"textCase",void 0),pe([fn("none")],t.Text.prototype,"textDecoration",void 0),pe([fn(0)],t.Text.prototype,"letterSpacing",void 0),pe([fn({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),pe([fn(0)],t.Text.prototype,"paraIndent",void 0),pe([fn(0)],t.Text.prototype,"paraSpacing",void 0),pe([fn("x")],t.Text.prototype,"writingMode",void 0),pe([fn("left")],t.Text.prototype,"textAlign",void 0),pe([fn("top")],t.Text.prototype,"verticalAlign",void 0),pe([fn(!0)],t.Text.prototype,"autoSizeAlign",void 0),pe([fn("normal")],t.Text.prototype,"textWrap",void 0),pe([fn("show")],t.Text.prototype,"textOverflow",void 0),pe([Bn(!1)],t.Text.prototype,"textEditing",void 0),t.Text=pe([jn()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},pe([Mn(fl)],t.Path.prototype,"__",void 0),pe([wn("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=pe([jn()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}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,r,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,n,a,o){return this}arc(t,e,i,s,r,n){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,n,a,o){return this}drawArc(t,e,i,s,r,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},pe([Mn(yl)],t.Pen.prototype,"__",void 0),pe([(t,e)=>{rn(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=pe([Hn(Us,["set","path","paint"]),jn()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(i||r)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||r)&&(this.sky=this.addLeafer(s)),r&&ae.editor(r,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),r(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&_.assign(e,t),this.autoLayout&&_.copyAttrs(e,this,Re),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Va.END,this.__onReady,this],[Ka.START,this.__onCreated,this],[Ka.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Ka.END,this.__onChildRenderEnd,this))}},t.App=pe([jn()],t.App);const ud={},_d={isHoldSpaceKey:()=>_d.isHold("Space"),isHold:t=>ud[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){ud[t]||(ud[t]=!0)},setUpCode(t){ud[t]=!1}},pd={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 gd extends Ia{get spaceKey(){return _d.isHoldSpaceKey()}get left(){return pd.left(this)}get right(){return pd.right(this)}get middle(){return pd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return _d.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){ce.changeName(t,e)}}const{min:fd,max:yd,abs:md}=Math,{float:vd,sign:xd}=W,{minX:wd,maxX:bd,minY:Ed,maxY:Pd}=Xt,Bd=new Vt,kd=new Vt,Sd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Rd.getValidMove(t.__localBoxBounds,Rd.getDragBounds(t),s,e,!0),Rd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:r,dragBoundsType:n}=t;r&&Rd.getValidScaleOf(t.__localBoxBounds,Rd.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,r){const n=t.x+s.x,a=t.y+s.y,o=n+t.width,h=a+t.height,l=e.x+e.width,d=e.y+e.height;return r||(s=Object.assign({},s)),Rd.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:o<l&&(s.x+=l-o):n<e.x?s.x+=e.x-n:o>l&&(s.x+=l-o),Rd.isInnerMode(t,e,i,"height")?a>e.y?s.y+=e.y-a:h<d&&(s.y+=d-h):a<e.y?s.y+=e.y-a:h>d&&(s.y+=d-h),s.x=vd(s.x),s.y=vd(s.y),s},getValidScaleOf(t,e,i,s,r,n,a){a||(r=Object.assign({},r)),kd.set(e),Bd.set(t).scaleOf(s,r.x,r.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,_,p,g,f=1,y=1;return Rd.isInnerMode(t,e,i,"width")?(r.x<0&&Bd.scaleOf(s,f=1/r.x,1),p=vd(Bd.minX-kd.minX),g=vd(kd.maxX-Bd.maxX),u=h&&p>0?1+p/(h*Bd.width):1,_=l&&g>0?1+g/(l*Bd.width):1,f*=yd(u,_)):(r.x<0&&((vd(wd(t)-wd(e))<=0||vd(bd(e)-bd(t))<=0)&&Bd.scaleOf(s,f=1/r.x,1),Bd.unsign()),p=vd(kd.minX-Bd.minX),g=vd(Bd.maxX-kd.maxX),u=h&&p>0?1-p/(h*Bd.width):1,_=l&&g>0?1-g/(l*Bd.width):1,f*=fd(u,_)),Rd.isInnerMode(t,e,i,"height")?(r.y<0&&Bd.scaleOf(s,1,y=1/r.y),p=vd(Bd.minY-kd.minY),g=vd(kd.maxY-Bd.maxY),u=d&&p>0?1+p/(d*Bd.height):1,_=c&&g>0?1+g/(c*Bd.height):1,y*=yd(u,_),n&&(u=yd(md(f),md(y)),f=xd(f)*u,y=xd(y)*u)):(r.y<0&&((vd(Ed(t)-Ed(e))<=0||vd(Pd(e)-Pd(t))<=0)&&Bd.scaleOf(s,1,y=1/r.y),Bd.unsign()),p=vd(kd.minY-Bd.minY),g=vd(Bd.maxY-kd.maxY),u=d&&p>0?1-p/(d*Bd.height):1,_=c&&g>0?1-g/(c*Bd.height):1,y*=fd(u,_)),r.x*=o(f)?f:1,r.y*=o(y)?y:1,r}},Rd=Sd;t.PointerEvent=class extends gd{},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=pe([Gn()],t.PointerEvent);const Td=t.PointerEvent,Cd={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof gh?t:new gh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const r=t.getLocalPoint(i,null,!0);return lt.move(r,e.x-t.x,e.y-t.y),s&&this.limitMove(t,r),Sd.axisMove(t,r),r}static limitMove(t,e){Sd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Cd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Cd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Cd,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 Xt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Xt.unsign(i),i}assignMove(t){Cd.x=t?this.totalX:this.moveX,Cd.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=pe([Gn()],t.DragEvent);const Ld=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=pe([Gn()],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=pe([Gn()],t.MoveEvent),t.TouchEvent=class extends gd{},t.TouchEvent=pe([Gn()],t.TouchEvent);const Od=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=pe([Gn()],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=pe([Gn()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=pe([Gn()],t.ZoomEvent),t.KeyEvent=class extends gd{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=pe([Gn()],t.KeyEvent);const Id={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:Dd.getSwipeDirection(lt.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:r(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new gh,{list:s}=t;for(let t=0,r=s.length;t<r;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>ra.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Dd=Id,Ad=new gh,{getDragEventData:Md,getDropEventData:Wd,getSwipeEventData:Fd}=Id;class Ud{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Md(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,r=s&&s.list.length,n=t.DragEvent.list||this.draggableList||Ad;return this.dragging&&(r?e?Ad:new gh(i?[...s.list,...s.dragHoverExclude]:s.list):n)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&pd.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],ra.draggable(e)){this.draggableList=new gh(e);break}}drag(e){const{interaction:i,dragData:s,downData:r}=this,{path:n,throughPath:a}=r;this.dragData=Md(r,s,e),a&&(this.dragData.throughPath=a),this.dragData.path=n,this.moving?(e.moving=!0,this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(e.dragging=!0,this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,r=this.realDraggableList;if(r.length&&s){const{totalX:s,totalY:n}=this.dragData,{dragLimitAnimate:o}=i.p,l=!o||!!e;r.forEach(i=>{if(i.draggable){const r=a(i.draggable),d=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:n},l||r);o&&!r&&e?ra.animateMove(i,d,h(o)?o:.3):i.move(d)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:r}=e;this.dragOverPath=r,s?r.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,r)):i.emit(t.DragEvent.OVER,e,r)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:r}=e;i.emit(t.DragEvent.LEAVE,e,s,r),i.emit(t.DragEvent.ENTER,e,r,s),this.dragEnterPath=r}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:r}=this;e||(e=r);const{path:n,throughPath:a}=s,o=Md(s,e,e);if(a&&(o.throughPath=a),o.path=n,this.moving&&(this.moving=!1,o.moveType="drag",i.emit(t.MoveEvent.END,o)),this.dragging){const n=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,o),this.swipe(e,s,r,o),this.drop(e,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(lt.getDistance(e,t)>r.config.pointer.swipeDistance){const t=Fd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const r=Wd(e,i,t.DragEvent.data);r.path=s,this.interaction.emit(t.DropEvent.DROP,r),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 Nd=Jt.get("emit");const zd=["move","zoom","rotate","key"];function Yd(t,e,i,s,r){if(zd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Hd(t,r)){let n;for(let a=0,o=t.children.length;a<o;a++)n=t.children[a],!i.path.has(n)&&n.__.hittable&&Xd(n,e,i,s,r)}}function Xd(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!Hd(t,r)&&(Qh.updateEventStyle&&!s&&Qh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=ce.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function Hd(t,e){return e&&e.has(t)}const jd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Gd,pathCanDrag:Vd,pathHasOutside:Kd}=Id;class qd{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&&pd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&pd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&_d.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=_.clone(jd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new gh(t),this.createTransformer(),this.dragger=new Ud(this),s&&(this.config=_.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(pd.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),pd.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=pd.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&&pd.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=lt.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;pd.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,_d.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,_d.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 gh),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 r=Date.now()-this.downTime,n=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>Gd(e.path,t));r<i.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:r,target:n}=this;m.backgrounder||t.origin||n&&n.updateLayout();const a=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));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&&!Kd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Vd(t.path))&&!Kd(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,r=s.length;t<r&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:r}=this.canvas;return s.x*=r.width/i.width,s.y*=r.height/i.height,this.p.snap&&lt.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),(Gd(e.path,t.PointerEvent.LONG_TAP)||Gd(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 Vt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(h(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ja.RESIZE,this.__onResize,this)],t.once(qa.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 r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(r=i.list[n],Xd(r,t,e,!0,s))return;r.isApp&&Yd(r,t,e,!0,s)}for(let n=0,a=i.length;n<a;n++)if(r=i.list[n],r.isApp&&Yd(r,t,e,!1,s),Xd(r,t,e,!1,s))return}catch(t){Nd.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 Zd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Zd.custom={};class Qd extends _e{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new gh,this.pixelList=new gh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ae.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ae.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()}}m.getSelector=function(t){return t.leafer?t.leafer.selector:m.selector||(m.selector=ae.selector())};const{toInnerRadiusPointOf:Jd,copy:$d,setRadius:tc}=lt,{hitRadiusPoint:ec,hitPoint:ic}=Xt,sc={},rc={},nc=t.Leaf.prototype;nc.hit=function(t,e=0){this.updateLayout(),$d(rc,t),tc(rc,e);const i=this.__world;return!!(e?ec(i,rc):ic(i,rc))&&(this.isBranch?m.getSelector(this).hitPoint(Object.assign({},rc),e,{target:this}):this.__hitWorld(rc))},nc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,r=this.__layout,n=s.width<10&&s.height<10;if(i.hitRadius&&($d(sc,t),tc(t=sc,i.hitRadius)),Jd(t,s,sc),i.hitBox||n){if(Xt.hitRadiusPoint(r.boxBounds,sc))return!0;if(n)return!1}return!r.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),r.boundsChanged||(r.hitCanvasChanged=!1)),this.__hit(sc,e)},nc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},nc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},nc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},nc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const ac=new ft,oc=t.UI.prototype;oc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,r=i||s;this.__hitCanvas||(this.__hitCanvas=r?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,r=m.image.hitCanvasSize,a=n.hitScale=Kt.set(0,0,r,r).getFitMatrix(t).a,{x:o,y:h,width:l,height:d}=Kt.set(t).scale(a);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),Jr.patternLocked=!0,this.__renderShape(n,{matrix:ac.setWith(this.__world).scaleWith(1/a).invertWith().translate(-o,-h),ignoreFill:!i,ignoreStroke:!s}),Jr.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},oc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,r=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(r&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:a}=i,o=i.stroke&&("path"===n||"pixel"===n&&!i.__isAlphaPixelStroke)||"all"===n;if(!r&&!o)return!1;const h=2*t.radiusX;let l=h;if(o)switch(i.strokeAlign){case"inside":if(l+=2*a,!r&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=a;break;case"outside":if(l+=2*a,!r){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const hc=t.UI.prototype,lc=t.Rect.prototype,dc=t.Box.prototype;lc.__updateHitCanvas=dc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?hc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},lc.__hitFill=dc.__hitFill=function(t){return this.__hitCanvas?hc.__hitFill.call(this,t):Xt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:r,__textDrawData:n}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):n.rows.forEach(r=>t.rect(r.x,r.y-s,r.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=s),this.updateLayout(),m.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const cc=Te.prototype;function uc(t,e,i){t.__.__font?jh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function _c(t,e,i,s,r){const n=i.__;c(t)?jh.drawStrokesStyle(t,e,!1,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&jh.strokeArrow(t,i,s,r)}function pc(t,e,i,s,r){const n=i.__;c(t)?jh.drawStrokesStyle(t,e,!0,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),jh.drawTextStroke(i,s,r))}function gc(t,e,i,s,r){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,pc(t,2,i,n,r),n.blendMode="outside"===e?"destination-out":"destination-in",jh.fillText(i,n,r),n.blendMode="normal",ra.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}cc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},cc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},cc.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:n,radiusY:a}=t;e&&(s-=e.x,r-=e.y),Kt.set(s-n,r-a,2*n,2*a).scale(i).ceil();const{data:o}=this.context.getImageData(Kt.x,Kt.y,Kt.width||1,Kt.height||1);for(let t=0,e=o.length;t<e;t+=4)if(o[t+3]>0)return!0;return o[3]>0};const{getSpread:fc,copyAndSpread:yc,toOuterOf:mc,getOuterOf:vc,getByMove:xc,move:wc,getIntersectData:bc}=Xt,Ec={};let Pc;const{stintSet:Bc}=_,{hasTransparent:kc}=Yh;function Sc(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":if(!e.url)return;s=Gh.image(i,t,e,n,!Pc||!Pc[e.url]);break;case"linear":s=Vh.linearGradient(e,n);break;case"radial":s=Vh.radialGradient(e,n);break;case"angular":s=Vh.conicGradient(e,n);break;case"solid":const{type:a,color:o,opacity:h}=e;s={type:a,style:Yh.string(o,h)};break;default:r(e.r)||(s={type:"solid",style:Yh.string(e)})}if(s&&(s.originPaint=e,a(s.style)&&kc(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Rc={compute:function(t,e){const i=e.__,s=[];let r,n,a,o=i.__input[t];d(o)||(o=[o]),Pc=Gh.recycleImage(t,i);for(let i,r=0,n=o.length;r<n;r++)(i=Sc(t,o[r],e))&&(s.push(i),i.strokeStyle&&(a||(a=1),i.strokeStyle.strokeWidth&&(a=Math.max(a,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(Bc(i,"__isAlphaPixelFill",r),Bc(i,"__isTransparentFill",n)):(Bc(i,"__isAlphaPixelStroke",r),Bc(i,"__isTransparentStroke",n),Bc(i,"__hasMultiStrokeStyle",a))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,uc(e,i,s)},fills:function(t,e,i,s){let r,n,a;for(let o=0,h=t.length;o<h;o++){if(r=t[o],n=r.originPaint,r.image){if(a?a++:a=1,Gh.checkImage(r,!e.__.__font,e,i,s))continue;if(!r.style){1===a&&r.image.isPlacehold&&e.drawImagePlaceholder(r,i,s);continue}}if(i.fillStyle=r.style,r.transform||n.scaleFixed){if(i.save(),r.transform&&i.transform(r.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),uc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),uc(e,i,s),i.restoreBlendMode()):uc(e,i,s)}},fillPathOrText:uc,fillText:function(t,e,i){const s=t.__,{rows:r,decorationY:n}=s.__textDrawData;let a;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=r.length;t<i;t++)a=r[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const r=e.__;if(r.__strokeWidth)if(r.__font)jh.strokeText(t,e,i,s);else switch(r.strokeAlign){case"center":_c(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),_c(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const r=e.__;if(r.__fillAfterStroke)_c(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),_c(t,2,e,a,s),a.clipUI(r),a.clearWorld(n),ra.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){jh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":pc(t,1,e,i,s);break;case"inside":gc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?pc(t,2,e,i,s):gc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,r=t.__.__textDrawData;const{rows:n,decorationY:a}=r;for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(a){const{decorationHeight:t}=r;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,r,n){let a;const o=s.__,{__hasMultiStrokeStyle:h}=o;h||r.setStroke(void 0,o.__strokeWidth*e,o);for(let l=0,d=t.length;l<d;l++)if(a=t[l],(!a.image||!Gh.checkImage(a,!1,s,r,n))&&a.style){if(h){const{strokeStyle:t}=a;t?r.setStroke(a.style,o.__getRealStrokeWidth(t)*e,o,t):r.setStroke(a.style,o.__strokeWidth*e,o)}else r.strokeStyle=a.style;a.originPaint.blendMode?(r.saveBlendMode(a.originPaint.blendMode),i?jh.drawTextStroke(s,r,n):r.stroke(),r.restoreBlendMode()):i?jh.drawTextStroke(s,r,n):r.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),r=e.bounds,n=t.__nowWorld,a=t.__layout,o=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;mc(a.strokeSpread?(yc(Ec,a.boxBounds,a.strokeSpread),Ec):a.boxBounds,n,o);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(o))_=s,h=u=o,l=n;else{let s;if(m.fullImageShadow)s=o;else{const t=a.renderShapeSpread?fc(r,S.swapAndScale(a.renderShapeSpread,p,g)):r;s=bc(t,o)}c=r.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=y),u=vc(o,c),h=xc(u,-c.e,-c.f),l=vc(n,c),wc(l,-c.e,-c.f);const v=i.matrix;v?(d=new ft(c),d.multiply(v),f*=v.scaleX,y*=v.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let Tc,Cc=new Vt;const{isSame:Lc}=Xt;function Oc(t,e,i,s,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||Gh.createData(r,s,i,n),!0}function Ic(t,e){Mc(t,Fa.LOAD,e)}function Dc(t,e){Mc(t,Fa.LOADED,e)}function Ac(t,e,i){e.error=i,t.forceUpdate("surface"),Mc(t,Fa.ERROR,e)}function Mc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Fa(e,i))}function Wc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Fc,translate:Uc}=J,Nc=new Vt,zc={},Yc={};function Xc(t,e,i,s){const r=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&r<0?0:r}let Hc={},jc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Gc,set:Vc,rotateOfOuter:Kc,translate:qc,scaleOfOuter:Zc,multiplyParent:Qc,scale:Jc,rotate:$c,skew:tu}=J;function eu(t,e,i,s,r,n,a,o){a&&$c(t,a),o&&tu(t,o.x,o.y),r&&Jc(t,r,n),qc(t,e.x+i,e.y+s)}const{get:iu,scale:su,copy:ru}=J,{getFloorScale:nu}=W,{abs:au}=Math;const ou={image:function(t,e,i,s,r){let n,a;const o=Jr.get(i);return Tc&&i===Tc.paint&&Lc(s,Tc.boxBounds)?n=Tc.leafPaint:(n={type:i.type,image:o},o.hasAlphaPixel&&(n.isTransparent=!0),Tc=o.use>1?{leafPaint:n,paint:i,boxBounds:Cc.set(s)}:null),(r||o.loading)&&(a={image:o,attrName:e,attrValue:i}),o.ready?(Oc(t,e,i,o,n,s),r&&(Ic(t,a),Dc(t,a))):o.error?r&&Ac(t,a,o.error):(r&&(Wc(t,!0),Ic(t,a)),n.loadId=o.load(()=>{Wc(t,!1),t.destroyed||(Oc(t,e,i,o,n,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Dc(t,a)),n.loadId=void 0},e=>{Wc(t,!1),Ac(t,a,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),n},checkImage:function(t,e,i,s,r){const{scaleX:n,scaleY:a}=Gh.getImageRenderScaleData(t,i,s,r),{image:o,data:h,originPaint:l}=t,{exporting:d}=r;return!(!h||t.patternId===n+"-"+a&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===m.name&&ja.isResizing(i)||d||(e=m.image.isLarge(o,n,a)||o.width*n>8096||o.height*a>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Gh.drawImage(t,n,a,i,s,r),!0):(!t.style||l.sync||d?Gh.createPattern(t,i,s,r):Gh.createPatternTask(t,i,s,r),!1))},drawImage:function(t,e,i,s,r,n){const{data:a,image:o}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=a,c=o.getFull(a.filters),u=s.__;let _,{width:p,height:g}=o;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(s),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(a.scaleX&&(p*=a.scaleX,g*=a.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,i,s){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;r.scaleX*=t,r.scaleY*=t}return n&&n.scaleX&&(r.scaleX*=Math.abs(n.scaleX),r.scaleY*=Math.abs(n.scaleY)),r},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,r,n,a,o;for(let h=0,l=i.length;h<l;h++)s=i[h],r=s.image,o=r&&r.url,o&&(n||(n={}),n[o]=!0,Jr.recyclePaint(s),r.loading&&(a||(a=e.__input&&e.__input[t]||[],d(a)||(a=[a])),r.unload(i[h].loadId,!a.some(t=>t.url===o))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=Jr.patternTasker.add(()=>ge(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&Gh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:r,scaleY:n}=Gh.getImageRenderScaleData(t,e,i,s),a=r+"-"+n;if(t.patternId!==a&&!e.destroyed&&(!m.image.isLarge(t.image,r,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:o,gap:h}=s,l=Gh.getPatternFixScale(t,r,n);let d,c,u,{width:_,height:p}=i;l&&(r*=l,n*=l),_*=r,p*=n,h&&(c=h.x*r/au(s.scaleX||1),u=h.y*n/au(s.scaleY||1)),(o||1!==r||1!==n)&&(r*=nu(_+(c||0)),n*=nu(p+(u||0)),d=iu(),o&&ru(d,o),su(d,1/r,1/n));const g=i.getCanvas(_,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(g,s.repeat||m.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=a}},getPatternFixScale:function(t,e,i){const{image:s}=t;let r,n=m.image.maxPatternSize,a=s.width*s.height;return s.isSVG?e>1&&(r=Math.ceil(e)/e):n>a&&(n=a),(a*=e*i)>n&&(r=Math.sqrt(n/a)),r},createData:function(t,e,i,s){t.data=Gh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Nc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:r}=i,{opacity:n,mode:o,align:h,offset:l,scale:d,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===r,x={mode:o},w="center"!==h&&(_||0)%180==90;let b,E;switch(Xt.set(Yc,0,0,w?r:s,w?s:r),o&&"cover"!==o&&"fit"!==o?((d||u)&&(W.getScaleData(d,u,i,zc),b=zc.scaleX,E=zc.scaleY),(h||y||f)&&(b&&Xt.scale(Yc,b,E,!0),h&&kt.toPoint(h,Yc,e,Yc,!0,!0))):v&&!_||(b=E=Xt.getFitScale(e,Yc,"fit"!==o),Xt.put(e,i,h,b,!1,Yc),Xt.scale(Yc,b,E,!0)),l&&lt.move(Yc,l),o){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/r,Gh.stretchMode(x,e,b,E));break;case"normal":case"clip":if(Yc.x||Yc.y||b||g||_||p){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),Gh.clipMode(x,e,Yc.x,Yc.y,b,E,_,p,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||_||p)&&Gh.repeatMode(x,e,s,r,Yc.x,Yc.y,b,E,_,p,h,t.freeTransform),f||(x.repeat="repeat");const i=c(f);(y||i)&&(x.gap=function(t,e,i,s,r){let n,a;c(t)?(n=t.x,a=t.y):n=a=t;return{x:Xc(n,i,r.width,e&&e.x),y:Xc(a,s,r.height,e&&e.y)}}(y,i&&f,Yc.width,Yc.height,e));break;default:b&&Gh.fillOrFitMode(x,e,Yc.x,Yc.y,b,E,_)}return x.transform||(e.x||e.y)&&Uc(x.transform=Fc(),e.x,e.y),b&&(x.scaleX=b,x.scaleY=E),n&&n<1&&(x.opacity=n),m&&(x.filters=m),f&&(x.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),x},stretchMode:function(t,e,i,s){const r=Gc(),{x:n,y:a}=e;n||a?qc(r,n,a):r.onlyScale=!0,Jc(r,i,s),t.transform=r},fillOrFitMode:function(t,e,i,s,r,n,a){const o=Gc();qc(o,e.x+i,e.y+s),Jc(o,r,n),a&&Kc(o,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=o},clipMode:function(t,e,i,s,r,n,a,o,h,l){const d=Gc();eu(d,e,i,s,r,n,a,o),h&&(a||o?(Vc(jc),Zc(jc,e,h,l),Qc(d,jc)):Zc(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,r,n,a,o,h,l,d,c){const u=Gc();if(c)eu(u,e,r,n,a,o,h,l);else{if(h)if("center"===d)Kc(u,{x:i/2,y:s/2},h);else switch($c(u,h),h){case 90:qc(u,s,0);break;case 180:qc(u,i,s);break;case 270:qc(u,0,i)}Hc.x=e.x+r,Hc.y=e.y+n,qc(u,Hc.x,Hc.y),a&&Zc(u,Hc,a,o)}t.transform=u}},{toPoint:hu}=Et,{hasTransparent:lu}=Yh,du={},cu={};function uu(t,e,i,s){if(i){let r,n,o,h;for(let t=0,l=i.length;t<l;t++)r=i[t],a(r)?(o=t/(l-1),n=Yh.string(r,s)):(o=r.offset,n=Yh.string(r.color,s)),e.addColorStop(o,n),!h&&lu(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:_u,getDistance:pu}=lt,{get:gu,rotateOfOuter:fu,scaleOfOuter:yu}=J,{toPoint:mu}=Et,vu={},xu={};function wu(t,e,i,s,r){let n;const{width:a,height:o}=t;if(a!==o||s){const t=_u(e,i);n=gu(),r?(yu(n,e,a/o*(s||1),1),fu(n,e,t+90)):(yu(n,e,1,a/o*(s||1)),fu(n,e,t))}return n}const{getDistance:bu}=lt,{toPoint:Eu}=Et,Pu={},Bu={};const ku={linearGradient:function(t,e){let{from:i,to:s,type:r,opacity:n}=t;hu(i||"top",e,du),hu(s||"bottom",e,cu);const a=m.canvas.createLinearGradient(du.x,du.y,cu.x,cu.y),o={type:r,style:a};return uu(o,a,t.stops,n),o},radialGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;mu(i||"center",e,vu),mu(s||"bottom",e,xu);const o=m.canvas.createRadialGradient(vu.x,vu.y,0,vu.x,vu.y,pu(vu,xu)),h={type:r,style:o};uu(h,o,t.stops,n);const l=wu(e,vu,xu,a,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;Eu(i||"center",e,Pu),Eu(s||"bottom",e,Bu);const o=m.conicGradientSupport?m.canvas.createConicGradient(0,Pu.x,Pu.y):m.canvas.createRadialGradient(Pu.x,Pu.y,0,Pu.x,Pu.y,bu(Pu,Bu)),h={type:r,style:o};uu(h,o,t.stops,n);const l=wu(e,Pu,Bu,a||1,m.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:wu},{copy:Su,move:Ru,toOffsetOutBounds:Tu}=Xt,{max:Cu,abs:Lu}=Math,Ou={},Iu=new ft,Du={};function Au(t,e){let i,s,r,n,a=0,o=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),r=Lu(t.spread||0),a=Cu(a,r+n-s),o=Cu(o,r+n+i),h=Cu(h,r+n+s),l=Cu(l,r+n-i)}),a===o&&o===h&&h===l?a:[a,o,h,l]}function Mu(t,e,i){const{shapeBounds:s}=i;let r,n;m.fullImageShadow?(Su(Ou,t.bounds),Ru(Ou,e.x-s.x,e.y-s.y),r=t.bounds,n=Ou):(r=s,n=e),t.copyWorld(i.canvas,r,n)}const{toOffsetOutBounds:Wu}=Xt,Fu={};const Uu=Au;const Nu={shadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{shadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Tu(h,Du,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Du.offsetX+(a.x||0)*c*f,Du.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f,Yh.string(a.color)),r=Kh.getShadowTransform(t,_,i,a,Du,f),r&&_.setTransform(r),Mu(_,Du,i),r&&_.resetTransform(),s=l,a.box&&(_.restore(),_.save(),o&&(_.copyWorld(_,l,n,"copy"),s=n),o?_.copyWorld(o,n,n,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),ra.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{innerShadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Wu(h,Fu,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Fu.offsetX+(a.x||0)*c*f,Fu.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f),r=Kh.getShadowTransform(t,_,i,a,Fu,f,!0),r&&_.setTransform(r),Mu(_,Fu,i),_.restore(),o?(_.copyWorld(_,l,n,"copy"),_.copyWorld(o,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,Yh.string(a.color),"source-in"),ra.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.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){},getShadowRenderSpread:Au,getShadowTransform:function(t,e,i,s,r,n,a){if(s.spread){const i=2*s.spread*n*(a?-1:1),{width:o,height:h}=t.__layout.strokeBounds;return Iu.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+i/o,1+i/h),Iu}},isTransformShadow(t){},getInnerShadowSpread:Uu},{excludeRenderBounds:zu}=ua;let Yu;function Xu(t,e,i,s,r,n,a,o){switch(e){case"grayscale":Yu||(Yu=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,r,n){const a=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,a),n&&s.recycle(a);ju(t,e,i,1,r,n)}(t,i,s,r,a,o);break;case"opacity-path":ju(t,i,s,n,a,o);break;case"path":o&&i.restore()}}function Hu(t){return t.getSameCanvas(!1,!0)}function ju(t,e,i,s,r,n){const a=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,a,void 0,r),n?i.recycle(a):i.clearWorld(a)}t.Group.prototype.__renderMask=function(t,e){let i,s,r,n,a,o;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],o=i.__.mask,o){a&&(Xu(this,a,t,r,s,n,void 0,!0),s=r=null),"clipping"!==o&&"clipping-path"!==o||zu(i,e)||i.__render(t,e),n=i.__.opacity,Yu=!1,"path"===o||"clipping-path"===o?(n<1?(a="opacity-path",r||(r=Hu(t))):(a="path",t.save()),i.__clip(r||t,e)):(a="grayscale"===o?"grayscale":"alpha",s||(s=Hu(t)),r||(r=Hu(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&Xu(this,a,t,r,s,n,void 0,!1),zu(i,e)||i.__render(r||t,e),d&&Xu(this,a,t,r,s,n,d,!1)}Xu(this,a,t,r,s,n,void 0,!0)};const Gu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Vu=Gu+"_#~&*+\\=|≮≯≈≠=…",Ku=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 qu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Zu=qu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Qu=qu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ju=qu(Gu),$u=qu(Vu),t_=qu("- —/~|┆·");var e_;!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"}(e_||(e_={}));const{Letter:i_,Single:s_,Before:r_,After:n_,Symbol:a_,Break:o_}=e_;function h_(t){return Zu[t]?i_:t_[t]?o_:Qu[t]?r_:Ju[t]?n_:$u[t]?a_:Ku.test(t)?s_:i_}const l_={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let n=r-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function d_(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:c_}=l_,{Letter:u_,Single:__,Before:p_,After:g_,Symbol:f_,Break:y_}=e_;let m_,v_,x_,w_,b_,E_,P_,B_,k_,S_,R_,T_,C_,L_,O_,I_,D_,A_=[];function M_(t,e){k_&&!B_&&(B_=k_),m_.data.push({char:t,width:e}),x_+=e}function W_(){w_+=x_,m_.width=x_,v_.words.push(m_),m_={data:[]},x_=0}function F_(){L_&&(O_.paraNumber++,v_.paraStart=!0,L_=!1),k_&&(v_.startCharSize=B_,v_.endCharSize=k_,B_=0),v_.width=w_,I_.width?c_(v_):D_&&U_(),A_.push(v_),v_={words:[]},w_=0}function U_(){w_>(O_.maxWidth||0)&&(O_.maxWidth=w_)}const{top:N_,right:z_,bottom:Y_,left:X_}=t.Direction4;function H_(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let t=0;t<r.length;t++)r[t][e]+=i}const j_={getDrawData:function(t,e){a(t)||(t=String(t));let i=0,s=0,r=e.__getInput("width")||0,n=e.__getInput("height")||0;const{__padding:o}=e;o&&(r?(i=o[X_],r-=o[z_]+o[X_],!r&&(r=.01)):e.autoSizeAlign||(i=o[X_]),n?(s=o[N_],n-=o[N_]+o[Y_],!n&&(n=.01)):e.autoSizeAlign||(s=o[N_]));const h={bounds:{x:i,y:s,width:r,height:n},rows:[],paraNumber:0,font:m.canvas.font=e.__font};return function(t,e,i){O_=t,A_=t.rows,I_=t.bounds,D_=!I_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:r,textCase:n}=i,{canvas:a}=m,{width:o}=I_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;L_=!0,R_=null,B_=P_=k_=x_=w_=0,m_={data:[]},v_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)E_=e[i],"\n"===E_?(x_&&W_(),v_.paraEnd=!0,F_(),L_=!0):(S_=h_(E_),S_===u_&&"none"!==n&&(E_=d_(E_,n,!x_)),P_=a.measureText(E_).width,s&&(s<0&&(k_=P_),P_+=s),T_=S_===__&&(R_===__||R_===u_)||R_===__&&S_!==g_,C_=!(S_!==p_&&S_!==__||R_!==f_&&R_!==g_),b_=L_&&r?o-r:o,t&&o&&w_+x_+P_>b_&&(h?(x_&&W_(),w_&&F_()):(C_||(C_=S_===u_&&R_==g_),T_||C_||S_===y_||S_===p_||S_===__||x_+P_>b_?(x_&&W_(),w_&&F_()):w_&&F_()))," "===E_&&!0!==L_&&w_+x_===0||(S_===y_?(" "===E_&&x_&&W_(),M_(E_,P_),W_()):T_||C_?(x_&&W_(),M_(E_,P_)):M_(E_,P_)),R_=S_);x_&&W_(),w_&&F_(),A_.length>0&&(A_[A_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{O_.paraNumber++,w_=a.measureText(t).width,A_.push({x:r||0,text:t,width:w_,paraStart:!0}),D_&&U_()})}(h,t,e),o&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":H_(e,"x",t[X_]);break;case"right":H_(e,"x",-t[z_])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":H_(e,"y",t[N_]);break;case"bottom":H_(e,"y",-t[Y_])}}(o,h,e,r,n),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:n,__baseLine:a,__letterSpacing:o,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*r+(c?c*(t.paraNumber-1):0),m=a;if(h&&y>f)y=Math.max(f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,x,w,b=g||u?g:t.maxWidth;for(let a=0,d=r;a<d;a++){if(v=i[a],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&a>0&&(m+=c),v.y=m,m+=n,t.overflow>a&&m>y&&(v.isOverflow=!0,t.overflow=a+1),x=v.x,w=v.width,o<0&&(v.width<0?(w=-v.width+e.fontSize+o,x-=w,w+=e.fontSize):w-=o),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&g&&g<w&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:n,letterSpacing:a}=e,o=i&&r.includes("both"),h=o||i&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,v;s.forEach(t=>{t.words&&(p=n&&t.paraStart?n:0,y=t.words.length,h&&(v=!t.paraEnd||o,c=i-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=a||t.isOverflow||l?0:u?1:2,t.isOverflow&&!a&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,r){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,v&&_),v&&(m=i===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:r,overflow:n}=t;let{textOverflow:a}=e;if(r.splice(n),a&&"show"!==a){let t,o;"hide"===a?a="":"ellipsis"===a&&(a="...");const h=a?m.canvas.measureText(a).width:0,l=i+s-h;("none"===e.textWrap?r:[r[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],o=t.x+t.width,!(s===i&&o<l));s--){if(o<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:a,x:o}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,c(n)?(i=n.type,n.color&&(t.decorationColor=Yh.string(n.color)),n.offset&&(s=Math.min(.3*r,Math.max(n.offset,.15*-r)))):i=n,i){case"under":t.decorationY=[.15*r+s];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+s,.35*-r]}}(h,e),h}};const G_={string:function(t,e){if(!t)return"#000";const i=h(e)&&e<1;if(a(t)){if(!i||!Yh.object)return t;t=Yh.object(t)}let s=r(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};return Object.assign(zh,j_),Object.assign(Yh,G_),Object.assign(jh,Rc),Object.assign(Gh,ou),Object.assign(Vh,ku),Object.assign(Kh,Nu),Object.assign(ae,{interaction:(t,e,i,s)=>new qd(t,e,i,s),hitCanvas:(t,e)=>new yh(t,e),hitCanvasManager:()=>new Qd}),vh(),t.AlignHelper=kt,t.AroundHelper=Et,t.AutoBounds=qt,t.BezierHelper=ni,t.Bounds=Vt,t.BoundsEvent=Ua,t.BoundsHelper=Xt,t.BoxData=hl,t.BranchHelper=fa,t.BranchRender=Do,t.CanvasData=wl,t.CanvasManager=_e,t.ChildEvent=Da,t.ColorConvert=Yh,t.Creator=ae,t.Cursor=Zd,t.DataHelper=_,t.Debug=Jt,t.DragBoundsHelper=Sd,t.Dragger=Ud,t.Effect=Kh,t.EllipseData=_l,t.EllipseHelper=pi,t.Event=Ia,t.EventCreator=ce,t.Eventer=io,t.Export=Zh,t.FileHelper=Hr,t.Filter=qh,t.FourNumberHelper=S,t.FrameData=dl,t.GroupData=ol,t.HitCanvasManager=Qd,t.ImageData=xl,t.ImageEvent=Fa,t.ImageManager=Jr,t.IncrementId=x,t.InteractionBase=qd,t.InteractionHelper=Id,t.Keyboard=_d,t.LayoutEvent=Va,t.Layouter=Oh,t.LeafBounds=Lo,t.LeafBoundsHelper=ua,t.LeafData=g,t.LeafDataProxy=fo,t.LeafEventer=po,t.LeafHelper=ra,t.LeafLayout=Oa,t.LeafLevelList=fh,t.LeafList=gh,t.LeafMatrix=Eo,t.LeafRender=Oo,t.LeaferCanvas=yh,t.LeaferCanvasBase=Te,t.LeaferData=ll,t.LeaferEvent=qa,t.LeaferImage=sn,t.LineData=cl,t.MathHelper=W,t.Matrix=ft,t.MatrixHelper=J,t.MyDragEvent=Ld,t.MyImage=ad,t.MyPointerEvent=Td,t.MyTouchEvent=Od,t.NeedConvertToCanvasCommandMap=De,t.OneRadian=U,t.PI2=N,t.PI_2=z,t.Paint=jh,t.PaintGradient=Vh,t.PaintImage=Gh,t.PathArrow=Hh,t.PathBounds=Or,t.PathCommandDataHelper=bs,t.PathCommandMap=Oe,t.PathCommandNodeHelper=gi,t.PathConvert=$i,t.PathCorner=Ur,t.PathCreator=Us,t.PathData=fl,t.PathDrawer=tr,t.PathHelper=Ce,t.PathNumberCommandLengthMap=Fe,t.PathNumberCommandMap=We,t.PenData=yl,t.Picker=Mh,t.Platform=m,t.Plugin=ne,t.Point=pt,t.PointHelper=lt,t.PointerButton=pd,t.PolygonData=pl,t.PropertyEvent=Ma,t.RectData=ul,t.RectHelper=Ue,t.RectRender=Rl,t.RenderEvent=Ka,t.Renderer=Dh,t.ResizeEvent=ja,t.Resource=Zr,t.Run=ie,t.Selector=Wh,t.StarData=gl,t.State=Qh,t.StringNumberMap=Zt,t.TaskItem=Vr,t.TaskProcessor=Kr,t.TextConvert=zh,t.TextData=vl,t.Transition=Jh,t.TwoPointBoundsHelper=mt,t.UIBounds=Pl,t.UICreator=he,t.UIData=nl,t.UIEvent=gd,t.UIRender=kl,t.UnitConvert=Xh,t.WaitHelper=ba,t.WatchEvent=Ga,t.Watcher=wh,t.affectRenderBoundsType=Pn,t.affectStrokeBoundsType=wn,t.attr=hn,t.autoLayoutType=_n,t.boundsType=fn,t.canvasPatch=Xr,t.canvasSizeAttrs=Re,t.createAttr=function(t){return(e,i)=>{rn(e,i,an(i,t))}},t.createDescriptor=an,t.cursorType=An,t.dataProcessor=Mn,t.dataType=dn,t.decorateLeafAttr=on,t.defineDataProcessor=Wn,t.defineKey=rn,t.defineLeafAttr=ln,t.dimType=kn,t.doBoundsType=mn,t.doStrokeType=bn,t.effectType=Fh,t.emptyData=s,t.eraserType=In,t.extraPropertyEventMap=Wa,t.getBoundsData=X,t.getDescriptor=nn,t.getMatrixData=H,t.getPointData=Y,t.hitType=Dn,t.isArray=d,t.isData=function(t){return c(t)&&!d(t)},t.isEmptyData=u,t.isFinite=o,t.isNull=n,t.isNumber=h,t.isObject=c,t.isString=a,t.isUndefined=r,t.layoutProcessor=function(t){return(e,i)=>{rn(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=to,t.maskType=On,t.naturalBoundsType=yn,t.opacityType=Sn,t.path=Nr,t.pathInputType=vn,t.pathType=xn,t.pen=zr,t.positionType=cn,t.registerUI=jn,t.registerUIEvent=Gn,t.resizeType=Uh,t.rewrite=zn,t.rewriteAble=Yn,t.rotationType=gn,t.scaleType=pn,t.scrollType=un,t.sortType=Ln,t.strokeType=En,t.surfaceType=Bn,t.tempBounds=Kt,t.tempMatrix=yt,t.tempPoint=gt,t.tryToNumber=function(t){return"string"==typeof t&&l.test(t)?+t:t},t.useCanvas=vh,t.useModule=Hn,t.version="1.12.1",t.visibleType=Rn,t.zoomLayerType=Nh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
1
+ var LeaferUI=function(t){"use strict";var e,i;t.PathNodeHandleType=void 0,(e=t.PathNodeHandleType||(t.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror",t.Answer=void 0,(i=t.Answer||(t.Answer={}))[i.No=0]="No",i[i.Yes=1]="Yes",i[i.NoAndSkip=2]="NoAndSkip",i[i.YesAndSkip=3]="YesAndSkip";const s={};function r(t){return void 0===t}function n(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:o}=Number;function h(t){return"number"==typeof t}const l=/^-?\d+(?:\.\d+)?$/;const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return"{}"===JSON.stringify(t)}const _={default:(t,e)=>(p(e,t),p(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var n,a;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return p(t[r],e[r],i&&i[r]);i&&r in i?(null===(a=i[r])||void 0===a?void 0:a.constructor)===Object&&p(t[r]={},e[r],i[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{r(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:p}=_;class g{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=r(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!r(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(d(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!r(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=r(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:a}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:a}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{floor:f,max:y}=Math,m={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",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||v.maxCacheSize),isSuperLarge:(t,e,i)=>v.isLarge(t,e,i,v.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=m.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,r,n,a,o,h){const l=m.origin.createCanvas(y(f(e+(s||0)),1),y(f(i+(r||0)),1)),d=l.getContext("2d");if(o&&(d.globalAlpha=o),d.imageSmoothingEnabled=!1!==a,n){const s=e/n.width,r=i/n.height;d.setTransform(s,0,0,r,-n.x*s,-n.y*r),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&_.stintSet(i,"transform",e)}}},{image:v}=m,x={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=w;return e[t]?e[t]++:(e[t]=1,0)}},w=x;let b,E,P;const{max:B}=Math,k=[0,0,0,0],S={zero:[...k],tempFour:k,set:(t,e,i,s,r)=>(void 0===i&&(i=s=r=e),t[0]=e,t[1]=i,t[2]=s,t[3]=r,t),setTemp:(t,e,i,s)=>R(k,t,e,i,s),toTempAB(t,e,i){P=i?h(t)?e:t:[],h(t)?(b=C(t),E=e):h(e)?(b=t,E=C(e)):(b=t,E=e),4!==b.length&&(b=T(b)),4!==E.length&&(E=T(E))},get(t,e){let i;if(!h(t))switch(t.length){case 4:i=r(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!r(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>h(t)&&h(e)?B(t,e):(L(t,e,i),R(P,B(b[0],E[0]),B(b[1],E[1]),B(b[2],E[2]),B(b[3],E[3]))),add:(t,e,i)=>h(t)&&h(e)?t+e:(L(t,e,i),R(P,b[0]+E[0],b[1]+E[1],b[2]+E[2],b[3]+E[3])),swapAndScale(t,e,i,s){if(h(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[n,a,o,l]=4===t.length?t:T(t);return R(r,o*i,l*e,n*i,a*e)}},{set:R,get:T,setTemp:C,toTempAB:L}=S,{round:O,pow:D,max:I,floor:A,PI:M}=Math,W={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!r(e)&&t<e&&(t=e),!r(i)&&t>i&&(t=i),t),fourNumber:S.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),W.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=r(e)?1e12:D(10,e);return-0===(t=O(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(h(e)?e:e.width||0)/i.width,r=(h(e)?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&W.assignScale(s,t);return s},assignScale(t,e){h(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>I(A(t),e)/t,randInt:F,randColor:t=>`rgba(${F(255)},${F(255)},${F(255)},${t||1})`};function F(t){return Math.round(Math.random()*t)}const U=M/180,N=2*M,z=M/2;function Y(){return{x:0,y:0}}function X(){return{x:0,y:0,width:0,height:0}}function H(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:j,cos:G,acos:V,sqrt:K}=Math,{float:q}=W,Z={};function Q(){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 J={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Q(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,n=0,a=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=a},get:H,getWorld:Q,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},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){$.toInnerPoint(t,e,Z),$.scaleOfInner(t,Z,i,s)},scaleOfInner(t,e,i,s=i){$.translateInner(t,e.x,e.y),$.scale(t,i,s),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,a=G(e*=U),o=j(e);t.a=i*a-s*o,t.b=i*o+s*a,t.c=r*a-n*o,t.d=r*o+n*a},rotateOfOuter(t,e,i){$.toInnerPoint(t,e,Z),$.rotateOfInner(t,Z,i)},rotateOfInner(t,e,i){$.translateInner(t,e.x,e.y),$.rotate(t,i),$.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:a}=t;i&&(i*=U,t.a=s+n*i,t.b=r+a*i),e&&(e*=U,t.c=n+s*e,t.d=a+r*e)},skewOfOuter(t,e,i,s){$.toInnerPoint(t,e,Z),$.skewOfInner(t,Z,i,s)},skewOfInner(t,e,i,s=0){$.translateInner(t,e.x,e.y),$.skew(t,i,s),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:a,f:o}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+a,t.f=e.e*s+e.f*n+o},multiplyParent(t,e,i,s,n){const{e:a,f:o}=t;if(i||(i=t),r(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:a,d:o}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=a*e.a+o*e.c,i.d=a*e.b+o*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=a*e.a+o*e.c+e.e,i.f=a*e.b+o*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:i,c:s,d:r,e:n,f:a}=t;if(i||s){const o=1/(e*r-i*s);t.a=r*o,t.b=-i*o,t.c=-s*o,t.d=e*o,t.e=-(n*r-a*s)*o,t.f=-(a*e-n*i)*o}else if(1===e&&1===r)t.e=-n,t.f=-a;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-a*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:a,d:o}=t,h=1/(r*o-n*a),{x:l,y:d}=e;if(i||(i=e),i.x=(l*o-d*a)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*o-s*a)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,s,n){const{x:a,y:o,scaleX:h,scaleY:l}=e;if(r(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:r}=e,n=i*U,a=G(n),o=j(n);if(s||r){const e=s*U,i=r*U;t.a=(a+i*-o)*h,t.b=(o+i*a)*h,t.c=(e*a-o)*l,t.d=(a+e*o)*l}else t.a=a*h,t.b=o*h,t.c=-o*l,t.d=a*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=a,t.f=o,(i=i||s)&&$.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:r,b:n,c:a,d:o,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||a){const t=r*o-n*a;if(a&&!s){d=K(r*r+n*n),c=t/d;const e=r/d;u=n>0?V(e):-V(e)}else{c=K(a*a+o*o),d=t/c;const e=a/c;u=z-(o>0?V(-e):-V(e))}const e=q(G(u)),i=j(u);d=q(d),c=q(c),_=e?q((a/c+i)/e/U,9):0,p=e?q((n/d-i)/e/U,9):0,u=q(u/U)}else d=r,c=o,u=_=p=0;return(e=i||e)&&(g+=e.x*r+e.y*a,f+=e.x*n+e.y*o,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:a}=t;r||n?i=(s*a-r*n)/(e=K(s*s+r*r)):(e=s,i=a)}return s.scaleX=e,s.scaleY=i,s},reset(t){$.set(t)}},$=J,{float:tt}=W,{toInnerPoint:et,toOuterPoint:it}=J,{sin:st,cos:rt,abs:nt,sqrt:at,atan2:ot,min:ht,round:lt}=Math,dt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=r(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?lt(t.x-.5)+.5:lt(t.x),t.y=e?lt(t.y-.5)+.5:lt(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=ct.defaultPoint);const s=rt(e*=U),r=st(e),n=t.x-i.x,a=t.y-i.y;t.x=i.x+n*s-a*r,t.y=i.y+n*r+a*s},tempToInnerOf(t,e){const{tempPoint:i}=ct;return _t(i,t),et(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ct;return _t(i,t),it(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ct;return _t(i,t),ct.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(_t(t,e),pt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),et(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){et(e,t,i)},toOuterOf(t,e,i){it(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)=>ut(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=nt(i-t),n=nt(s-e);return at(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>ht(ut(t,e,i,s),ut(i,s,r,n)),getAngle:(t,e)=>gt(t,e)/U,getRotation:(t,e,i,s)=>(s||(s=e),ct.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/U),getRadianFrom(t,e,i,s,n,a,o,h){r(o)&&(o=i,h=s);const l=t-i,d=e-s,c=n-o,u=a-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>ot(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,r){const n=gt(t,e);return r&&(t=e),s||(e={}),e.x=t.x+rt(n)*i,e.y=t.y+st(n)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>tt(t.x)===tt(e.x)&&tt(t.y)===tt(e.y),reset(t){ct.reset(t)}},ct=dt,{getDistanceFrom:ut,copy:_t,setRadius:pt,getAtan2:gt}=ct;class ft{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?dt.copy(this,t):dt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new ft(this)}move(t,e){return dt.move(this,t,e),this}scale(t,e){return dt.scale(this,t,e),this}scaleOf(t,e,i){return dt.scaleOf(this,t,e,i),this}rotate(t,e){return dt.rotate(this,t,e),this}rotateOf(t,e){return dt.rotate(this,e,t),this}getRotation(t,e,i){return dt.getRotation(this,t,e,i)}toInnerOf(t,e){return dt.toInnerOf(this,t,e),this}toOuterOf(t,e){return dt.toOuterOf(this,t,e),this}getCenter(t){return new ft(dt.getCenter(this,t))}getDistance(t){return dt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new ft(dt.getDistancePoint(this,t,e,i,s))}getAngle(t){return dt.getAngle(this,t)}getAtan2(t){return dt.getAtan2(this,t)}isSame(t){return dt.isSame(this,t)}reset(){return dt.reset(this),this}}const yt=new ft;class mt{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return c(t)?J.copy(this,t):J.set(this,t,e,i,s,r,n),this}setWith(t){return J.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new mt(this)}translate(t,e){return J.translate(this,t,e),this}translateInner(t,e){return J.translateInner(this,t,e),this}scale(t,e){return J.scale(this,t,e),this}scaleWith(t,e){return J.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return J.pixelScale(this,t),this}scaleOfOuter(t,e,i){return J.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return J.scaleOfInner(this,t,e,i),this}rotate(t){return J.rotate(this,t),this}rotateOfOuter(t,e){return J.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return J.rotateOfInner(this,t,e),this}skew(t,e){return J.skew(this,t,e),this}skewOfOuter(t,e,i){return J.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return J.skewOfInner(this,t,e,i),this}multiply(t){return J.multiply(this,t),this}multiplyParent(t){return J.multiplyParent(this,t),this}divide(t){return J.divide(this,t),this}divideParent(t){return J.divideParent(this,t),this}invert(){return J.invert(this),this}invertWith(){return J.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){J.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){J.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return J.setLayout(this,t,e,i),this}getLayout(t,e,i){return J.getLayout(this,t,e,i)}withScale(t,e){return J.withScale(this,t,e)}reset(){J.reset(this)}}const vt=new mt,xt={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,r){wt(t,e,i),wt(t,e+s,i+r)},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:wt}=xt;var bt,Et;t.Direction4=void 0,(bt=t.Direction4||(t.Direction4={}))[bt.top=0]="top",bt[bt.right=1]="right",bt[bt.bottom=2]="bottom",bt[bt.left=3]="left",t.Direction9=void 0,(Et=t.Direction9||(t.Direction9={}))[Et.topLeft=0]="topLeft",Et[Et.top=1]="top",Et[Et.topRight=2]="topRight",Et[Et.right=3]="right",Et[Et.bottomRight=4]="bottomRight",Et[Et.bottom=5]="bottom",Et[Et.bottomLeft=6]="bottomLeft",Et[Et.left=7]="left",Et[Et.center=8]="center",Et[Et["top-left"]=0]="top-left",Et[Et["top-right"]=2]="top-right",Et[Et["bottom-right"]=4]="bottom-right",Et[Et["bottom-left"]=6]="bottom-left";const Pt=[{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}];Pt.forEach(t=>t.type="percent");const Bt={directionData:Pt,tempPoint:{},get:kt,toPoint(t,e,i,s,r,n){const a=kt(t);i.x=a.x,i.y=a.y,"percent"===a.type&&(i.x*=e.width,i.y*=e.height,r&&(n||(i.x-=r.x,i.y-=r.y),a.x&&(i.x-=1===a.x?r.width:.5===a.x?a.x*r.width:0),a.y&&(i.y-=1===a.y?r.height:.5===a.y?a.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),Bt.toPoint(t,e,i,!0),i)};function kt(e){return a(e)?Pt[t.Direction9[e]]:e}const{toPoint:St}=Bt,Rt={toPoint(t,e,i,s,r,n){St(t,i,s,r,e,n)}},{tempPointBounds:Tt,setPoint:Ct,addPoint:Lt,toBounds:Ot}=xt,{toOuterPoint:Dt}=J,{float:It,fourNumber:At}=W,{floor:Mt,ceil:Wt}=Math;let Ft,Ut,Nt,zt;const Yt={},Xt={},Ht={},jt={tempBounds:Ht,set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,r){const{x:n,y:a,width:o,height:h}=e;if(d(i)){const e=At(i);s?Gt.set(t,n+e[3],a+e[0],o-e[1]-e[3],h-e[2]-e[0]):Gt.set(t,n-e[3],a-e[0],o+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Gt.set(t,n-i,a-i,o+2*i,h+2*i);r&&("width"===r?(t.y=a,t.height=h):(t.x=n,t.width=o))},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},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Gt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Kt(e,t):e=t,i||(i=t),e.offsetX=Gt.maxX(i),e.offsetY=Gt.maxY(i),Gt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||dt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){dt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Gt.copy(Ht,t),Gt.toOuterOf(Ht,e),Ht),getOuterOf:(t,e)=>(t=Object.assign({},t),Gt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r,e:n,f:a}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=a+t.y*r):(i.height=t.height*-r,i.y=a+t.y*r-i.height)}else Yt.x=t.x,Yt.y=t.y,Dt(e,Yt,Xt),Ct(Tt,Xt.x,Xt.y),Yt.x=t.x+t.width,Dt(e,Yt,Xt),Lt(Tt,Xt.x,Xt.y),Yt.y=t.y+t.height,Dt(e,Yt,Xt),Lt(Tt,Xt.x,Xt.y),Yt.x=t.x,Dt(e,Yt,Xt),Lt(Tt,Xt.x,Xt.y),Ot(Tt,i)},toInnerOf(t,e,i){i||(i=t),Gt.move(i,-e.e,-e.f),Gt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Gt.getFitScale(t,e));return new mt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,r=t.height/e.height;return i?Math.max(s,r):Math.min(s,r)},put(t,e,i="center",s=1,r=!0,n){n||(n=e),a(s)&&(s=Gt.getFitScale(t,e,"cover"===s)),Ht.width=r?e.width*=s:e.width*s,Ht.height=r?e.height*=s:e.height*s,Rt.toPoint(i,Ht,t,n,!0,!0)},getSpread(t,e,i){const s={};return Gt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Gt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Gt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Mt(t.x),t.y=Mt(t.y),t.width=e>t.x?Wt(t.width+e-t.x):Wt(t.width),t.height=i>t.y?Wt(t.height+i-t.y):Wt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=It(t.x,e),t.y=It(t.y,e),t.width=It(t.width,e),t.height=It(t.height,e)},add(t,e,i){Ft=t.x+t.width,Ut=t.y+t.height,Nt=e.x,zt=e.y,i||(Nt+=e.width,zt+=e.height),Ft=Ft>Nt?Ft:Nt,Ut=Ut>zt?Ut:zt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Ft-t.x,t.height=Ut-t.y},addList(t,e){Gt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Gt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Gt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let r,n=!0;for(let a=0,o=e.length;a<o;a++)r=i?i(e[a],a):e[a],r&&(r.width||r.height)&&(n?(n=!1,s||Kt(t,r)):Vt(t,r));n&&Gt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Tt,t.x,t.y):Lt(Tt,t.x,t.y)),Ot(Tt,t)},setPoint(t,e){Gt.set(t,e.x,e.y)},addPoint(t,e){Vt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},hitRadiusPoint:(t,e,i)=>(i&&(e=dt.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=dt.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=Gt.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=Gt.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=Gt.tempToOuterOf(e,i)),!Gt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:n,height:a}=e;return Ft=s+n,Ut=r+a,Nt=t.x+t.width,zt=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,Ft=Ft<Nt?Ft:Nt,Ut=Ut<zt?Ut:zt,n=Ft-s,a=Ut-r,{x:s,y:r,width:n,height:a}},intersect(t,e,i){Gt.copy(t,Gt.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){Gt.set(t)}},Gt=jt,{add:Vt,copy:Kt}=Gt;class qt{get minX(){return jt.minX(this)}get minY(){return jt.minY(this)}get maxX(){return jt.maxX(this)}get maxY(){return jt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?jt.copy(this,t):jt.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 qt(this)}move(t,e){return jt.move(this,t,e),this}scale(t,e,i){return jt.scale(this,t,e,i),this}scaleOf(t,e,i){return jt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return jt.toOuterOf(this,t,e),this}toInnerOf(t,e){return jt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return jt.getFitMatrix(this,t,e)}put(t,e,i){jt.put(this,t,e,i)}spread(t,e){return jt.spread(this,t,e),this}shrink(t,e){return jt.shrink(this,t,e),this}ceil(){return jt.ceil(this),this}unsign(){return jt.unsign(this),this}float(t){return jt.float(this,t),this}add(t){return jt.add(this,t),this}addList(t){return jt.setList(this,t,!0),this}setList(t){return jt.setList(this,t),this}addListWithFn(t,e){return jt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return jt.setListWithFn(this,t,e),this}setPoint(t){return jt.setPoint(this,t),this}setPoints(t){return jt.setPoints(this,t),this}addPoint(t){return jt.addPoint(this,t),this}getPoints(){return jt.getPoints(this)}hitPoint(t,e){return jt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return jt.hitRadiusPoint(this,t,e)}hit(t,e){return jt.hit(this,t,e)}includes(t,e){return jt.includes(this,t,e)}intersect(t,e){return jt.intersect(this,t,e),this}getIntersect(t,e){return new qt(jt.getIntersectData(this,t,e))}isSame(t){return jt.isSame(this,t)}isEmpty(){return jt.isEmpty(this)}reset(){jt.reset(this)}}const Zt=new qt;class Qt{constructor(t,e,i,s,r,n){c(t)?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=t;this.set(e,i,s,r,n,a)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=this;return new qt(r,e,n||t.width-r-i,a||t.height-e-s)}}const Jt={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:$t}=W;class te{constructor(t){this.repeatMap={},this.name=t}static get(t){return new te(t)}static set filter(t){this.filterList=ee(t)}static set exclude(t){this.excludeList=ee(t)}static drawRepaint(t,e){const i=$t();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===te.showBounds,r=t.__nowWorld,n=$t();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if(ie.enable){if(ie.filterList.length&&ie.filterList.every(t=>t!==this.name))return;if(ie.excludeList.length&&ie.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ie.enable&&this.warn(...t)}warn(...t){ie.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 ee(t){return t?a(t)&&(t=[t]):t=[],t}te.filterList=[],te.excludeList=[],te.showWarn=!0;const ie=te,se=te.get("RunTime"),re={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=x.create(x.RUNTIME);return ne.currentId=ne.idMap[i]=e?performance.now():Date.now(),ne.currentName=ne.nameMap[i]=t,ne.nameToIdMap[t]=i,i},end(t,e){const i=ne.idMap[t],s=ne.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;ne.idMap[t]=ne.nameMap[t]=ne.nameToIdMap[s]=void 0,se.log(s,r,"ms")},endOfName(t,e){const i=ne.nameToIdMap[t];r(i)||ne.end(i,e)}},ne=re,ae=[],oe={list:{},add(t,...e){this.list[t]=!0,ae.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>ae.forEach(t=>oe.has(t,!0)));const he={editor:t=>oe.need("editor")},le=te.get("UICreator"),de={list:{},register(t){const{__tag:e}=t.prototype;ce[e]&&le.repeat(e),ce[e]=t},get(t,e,i,s,n,a){ce[t]||le.error("not register "+t);const o=new ce[t](e);return r(i)||(o.x=i,s&&(o.y=s),n&&(o.width=n),a&&(o.height=a)),o}},{list:ce}=de,ue=te.get("EventCreator"),_e={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(pe[e]&&ue.repeat(e),pe[e]=t)})},changeName(t,e){const i=pe[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,pe[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new pe[t](...e)},{nameList:pe}=_e;class ge{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,r=i.length;s<r;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=he.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function fe(t,e,i,s){var r,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}function ye(t,e,i,s){return new(i||(i=Promise))(function(r,n){function a(t){try{h(s.next(t))}catch(t){n(t)}}function o(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,o)}h((s=s.apply(t,e||[])).next())})}function me(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const ve=[];function xe(){return(t,e)=>{ve.push(e)}}const we=[];class be{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||we)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ve.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,a,o,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*o;s+=e,e=0,n+=t,o-=t}if(i<0){const t=-i/r*h;r+=i,i=0,a+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,a,o,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,a,o){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}fe([me("imageSmoothingEnabled")],be.prototype,"smooth",void 0),fe([me("imageSmoothingQuality")],be.prototype,"smoothLevel",void 0),fe([me("globalAlpha")],be.prototype,"opacity",void 0),fe([me()],be.prototype,"fillStyle",void 0),fe([me()],be.prototype,"strokeStyle",void 0),fe([me("lineWidth")],be.prototype,"strokeWidth",void 0),fe([me("lineCap")],be.prototype,"strokeCap",void 0),fe([me("lineJoin")],be.prototype,"strokeJoin",void 0),fe([me("lineDashOffset")],be.prototype,"dashOffset",void 0),fe([me()],be.prototype,"miterLimit",void 0),fe([me()],be.prototype,"shadowBlur",void 0),fe([me()],be.prototype,"shadowColor",void 0),fe([me()],be.prototype,"shadowOffsetX",void 0),fe([me()],be.prototype,"shadowOffsetY",void 0),fe([me()],be.prototype,"filter",void 0),fe([me()],be.prototype,"font",void 0),fe([me()],be.prototype,"fontKerning",void 0),fe([me()],be.prototype,"fontStretch",void 0),fe([me()],be.prototype,"fontVariantCaps",void 0),fe([me()],be.prototype,"textAlign",void 0),fe([me()],be.prototype,"textBaseline",void 0),fe([me()],be.prototype,"textRendering",void 0),fe([me()],be.prototype,"wordSpacing",void 0),fe([me()],be.prototype,"letterSpacing",void 0),fe([me()],be.prototype,"direction",void 0),fe([xe()],be.prototype,"setTransform",null),fe([xe()],be.prototype,"resetTransform",null),fe([xe()],be.prototype,"getTransform",null),fe([xe()],be.prototype,"save",null),fe([xe()],be.prototype,"restore",null),fe([xe()],be.prototype,"translate",null),fe([xe()],be.prototype,"scale",null),fe([xe()],be.prototype,"rotate",null),fe([xe()],be.prototype,"fill",null),fe([xe()],be.prototype,"stroke",null),fe([xe()],be.prototype,"clip",null),fe([xe()],be.prototype,"fillRect",null),fe([xe()],be.prototype,"strokeRect",null),fe([xe()],be.prototype,"clearRect",null),fe([xe()],be.prototype,"beginPath",null),fe([xe()],be.prototype,"moveTo",null),fe([xe()],be.prototype,"lineTo",null),fe([xe()],be.prototype,"bezierCurveTo",null),fe([xe()],be.prototype,"quadraticCurveTo",null),fe([xe()],be.prototype,"closePath",null),fe([xe()],be.prototype,"arc",null),fe([xe()],be.prototype,"arcTo",null),fe([xe()],be.prototype,"ellipse",null),fe([xe()],be.prototype,"rect",null),fe([xe()],be.prototype,"roundRect",null),fe([xe()],be.prototype,"createConicGradient",null),fe([xe()],be.prototype,"createLinearGradient",null),fe([xe()],be.prototype,"createPattern",null),fe([xe()],be.prototype,"createRadialGradient",null),fe([xe()],be.prototype,"fillText",null),fe([xe()],be.prototype,"measureText",null),fe([xe()],be.prototype,"strokeText",null);const{copy:Ee,multiplyParent:Pe,pixelScale:Be}=J,{round:ke}=Math,Se=new qt,Re=new qt,Te={width:1,height:1,pixelRatio:1},Ce=["width","height","pixelRatio"];class Le extends be{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Te),this.manager=e,this.innerId=x.create(x.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||m.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;_.copyAttrs(s,t,Ce),Ce.forEach(t=>s[t]||(s[t]=1)),this.bounds=new qt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!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,r=this.worldTransform;e&&Pe(t,e,r),Be(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=ke(r.e-.5)+.5,r.f=ke(r.f-.5)+.5):(r.e=ke(r.e),r.f=ke(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:a,miterLimit:o}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),r(e.dashPattern)||(n=e.dashPattern),r(e.dashOffset)||(a=e.dashOffset),e.miterLimit&&(o=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=a,this.miterLimit=o}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:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,r){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,r),i?(this.setTempPixelBounds2(i,r),i=Re):i=Se,this.drawImage(t.view,Se.x,Se.y,Se.width,Se.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,r){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,jt.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),this.drawImage(t.view,Se.x,Se.y,Se.width,Se.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,r,n){this.resetTransform(),this.copyWorld(t,e,i,s,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(Se.x,Se.y,Se.width,Se.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,Se.x,Se.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,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Se.x,Se.y,Se.width,Se.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Se.x,Se.y,Se.width,Se.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Se.x,Se.y,Se.width,Se.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Se.x,Se.y,Se.width,Se.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Se,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Re,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,r=this.manager?this.manager.get(i):he.canvas(Object.assign({},i));return r.save(),t&&(Ee(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==s&&(r.pixelSnap=s),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Oe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},De={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ie=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},De),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},Me={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},We=Object.assign(Object.assign({},Me),De),Fe=Ie,Ue={};for(let t in Fe)Ue[Fe[t]]=t;const Ne={};for(let t in Fe)Ne[Fe[t]]=Ae[t];const ze={drawRoundRect(t,e,i,s,r,n){const a=W.fourNumber(n,Math.min(s/2,r/2)),o=e+s,h=i+r;a[0]?t.moveTo(e+a[0],i):t.moveTo(e,i),a[1]?t.arcTo(o,i,o,h,a[1]):t.lineTo(o,i),a[2]?t.arcTo(o,h,e,h,a[2]):t.lineTo(o,h),a[3]?t.arcTo(e,h,e,i,a[3]):t.lineTo(e,h),a[0]?t.arcTo(e,i,o,i,a[0]):t.lineTo(e,i)}},{sin:Ye,cos:Xe,hypot:He,atan2:je,ceil:Ge,abs:Ve,PI:Ke,sqrt:qe,pow:Ze}=Math,{setPoint:Qe,addPoint:Je}=xt,{set:$e,toNumberPoints:ti}=dt,{M:ei,L:ii,C:si,Q:ri,Z:ni}=Ie,ai={},oi={points(t,e,i,s){let r=ti(e);if(t.push(ei,r[0],r[1]),i&&r.length>5){let e,n,a,o,h,l,d,c,u,_,p,g,f,y,m,v=r.length;const x=!0===i?.5:i;s&&(r=[r[v-2],r[v-1],...r,r[0],r[1],r[2],r[3]],v=r.length);for(let i=2;i<v-2;i+=2)e=r[i-2],n=r[i-1],a=r[i],o=r[i+1],h=r[i+2],l=r[i+3],p=a-e,g=o-n,f=qe(Ze(p,2)+Ze(g,2)),y=qe(Ze(h-a,2)+Ze(l-o,2)),(f||y)&&(m=f+y,f=x*f/m,y=x*y/m,h-=e,l-=n,d=a-f*h,c=o-f*l,2===i?s||t.push(ri,d,c,a,o):(p||g)&&t.push(si,u,_,d,c,a,o),u=a+y*h,_=o+y*l);s||t.push(ri,u,_,r[v-2],r[v-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push(ii,r[e],r[e+1]);s&&t.push(ni)},rect(t,e,i,s,r){Oe.creator.path=t,Oe.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){Oe.creator.path=[],ze.drawRoundRect(Oe.creator,e,i,s,r,n),t.push(...Oe.convertToCanvasData(Oe.creator.path,!0))},arcTo(t,e,i,s,r,n,a,o,h,l,d){const c=s-e,u=r-i,_=n-s,p=a-r;let g=je(u,c),f=je(p,_);const y=He(c,u),m=He(_,p);let v=f-g;if(v<0&&(v+=N),y<1e-12||m<1e-12||v<1e-12||Ve(v-Ke)<1e-12)return t&&t.push(ii,s,r),h&&(Qe(h,e,i),Je(h,s,r)),d&&$e(d,e,i),void(l&&$e(l,s,r));const x=c*p-_*u<0,w=x?-1:1,b=o/Xe(v/2),E=s+b*Xe(g+v/2+z*w),P=r+b*Ye(g+v/2+z*w);return g-=z*w,f-=z*w,di(t,E,P,o,o,0,g/U,f/U,x,h,l,d)},arc:(t,e,i,s,r,n,a,o,h,l)=>di(t,e,i,s,s,0,r,n,a,o,h,l),ellipse(t,e,i,s,r,n,a,o,h,l,d,c){const u=n*U,_=Ye(u),p=Xe(u);let g=a*U,f=o*U;g>Ke&&(g-=N),f<0&&(f+=N);let y=f-g;y<0?y+=N:y>N&&(y-=N),h&&(y-=N);const m=Ge(Ve(y/z)),v=y/m,x=Ye(v/4),w=8/3*x*x/Ye(v/2);f=g+v;let b,E,P,B,k,S,R,T,C=Xe(g),L=Ye(g),O=P=p*s*C-_*r*L,D=B=_*s*C+p*r*L,I=e+P,A=i+B;t&&t.push(t.length?ii:ei,I,A),l&&Qe(l,I,A),c&&$e(c,I,A);for(let n=0;n<m;n++)b=Xe(f),E=Ye(f),P=p*s*b-_*r*E,B=_*s*b+p*r*E,k=e+O-w*(p*s*L+_*r*C),S=i+D-w*(_*s*L-p*r*C),R=e+P+w*(p*s*E+_*r*b),T=i+B+w*(_*s*E-p*r*b),t&&t.push(si,k,S,R,T,e+P,i+B),l&&li(e+O,i+D,k,S,R,T,e+P,i+B,l,!0),O=P,D=B,C=b,L=E,g=f,f+=v;d&&$e(d,e+P,i+B)},quadraticCurveTo(t,e,i,s,r,n,a){t.push(si,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(a+2*r)/3,n,a)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,a,o){li(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,a,o)},toTwoPointBounds(t,e,i,s,r,n,a,o,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,x=i,w=r,b=a;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=n,b=o),c=-3*v+9*x-9*w+3*b,u=6*v-12*x+6*w,_=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Je(h,t,e):Qe(h,t,e),Je(h,a,o);for(let l=0,c=d.length;l<c;l++)hi(d[l],t,e,i,s,r,n,a,o,ai),Je(h,ai.x,ai.y)},getPointAndSet(t,e,i,s,r,n,a,o,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*o,l.y=c*i+u*r+_*a+p*h},getPoint(t,e,i,s,r,n,a,o,h){const l={};return hi(t,e,i,s,r,n,a,o,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)}},{getPointAndSet:hi,toTwoPointBounds:li,ellipse:di}=oi,{sin:ci,cos:ui,sqrt:_i,atan2:pi}=Math,{ellipse:gi}=oi,fi={ellipticalArc(t,e,i,s,r,n,a,o,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=n*U,p=ci(_),g=ui(_),f=-g*c-p*u,y=-g*u+p*c,v=s*s,x=r*r,w=y*y,b=f*f,E=v*x-v*w-x*b;let P=0;if(E<0){const t=_i(1-E/(v*x));s*=t,r*=t}else P=(a===o?-1:1)*_i(E/(v*w+x*b));const B=P*s*y/r,k=-P*r*f/s,S=pi((y-k)/r,(f-B)/s),R=pi((-y-k)/r,(-f-B)/s);let T=R-S;0===o&&T>0?T-=N:1===o&&T<0&&(T+=N);const C=e+c+g*B-p*k,L=i+u+p*B+g*k,O=T<0?1:0;d||m.ellipseToCurve?gi(t,C,L,s,r,n,S/U,R/U,O):s!==r||n?t.push(Ie.G,C,L,s,r,n,S/U,R/U,O):t.push(Ie.O,C,L,s,S/U,R/U,O)}},yi={toCommand:t=>[],toNode:t=>[]},{M:mi,m:vi,L:xi,l:wi,H:bi,h:Ei,V:Pi,v:Bi,C:ki,c:Si,S:Ri,s:Ti,Q:Ci,q:Li,T:Oi,t:Di,A:Ii,a:Ai,Z:Mi,z:Wi,N:Fi,D:Ui,X:Ni,G:zi,F:Yi,O:Xi,P:Hi,U:ji}=Ie,{rect:Gi,roundRect:Vi,arcTo:Ki,arc:qi,ellipse:Zi,quadraticCurveTo:Qi}=oi,{ellipticalArc:Ji}=fi,$i=te.get("PathConvert"),ts={},es={current:{dot:0},stringify(t,e){let i,s,r,n=0,a=t.length,o="";for(;n<a;){s=t[n],i=Ne[s],o+=s===r?" ":Ue[s];for(let s=1;s<i;s++)o+=W.float(t[n+s],e),s===i-1||(o+=" ");r=s,n+=i}return o},parse(t,e){let i,s,r,n="";const a=[],o=e?We:Me;for(let e=0,h=t.length;e<h;e++)s=t[e],Jt[s]?("."===s&&(is.dot&&(ss(a,n),n=""),is.dot++),"0"===n&&"."!==s&&(ss(a,n),n=""),n+=s):Ie[s]?(n&&(ss(a,n),n=""),is.name=Ie[s],is.length=Ae[s],is.index=0,ss(a,is.name),!i&&o[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&ss(a,n),n=s):n&&(ss(a,n),n=""),r=s;return n&&ss(a,n),i?es.toCanvasData(a,e):a},toCanvasData(t,e){let i,s,r,n,a,o=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case vi:t[c+1]+=o,t[c+2]+=h;case mi:o=t[c+1],h=t[c+2],_.push(mi,o,h),c+=3;break;case Ei:t[c+1]+=o;case bi:o=t[c+1],_.push(xi,o,h),c+=2;break;case Bi:t[c+1]+=h;case Pi:h=t[c+1],_.push(xi,o,h),c+=2;break;case wi:t[c+1]+=o,t[c+2]+=h;case xi:o=t[c+1],h=t[c+2],_.push(xi,o,h),c+=3;break;case Ti:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Ri;case Ri:a=n===ki||n===Ri,l=a?2*o-i:t[c+1],d=a?2*h-s:t[c+2],i=t[c+1],s=t[c+2],o=t[c+3],h=t[c+4],_.push(ki,l,d,i,s,o,h),c+=5;break;case Si:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,t[c+5]+=o,t[c+6]+=h,r=ki;case ki:i=t[c+3],s=t[c+4],o=t[c+5],h=t[c+6],_.push(ki,t[c+1],t[c+2],i,s,o,h),c+=7;break;case Di:t[c+1]+=o,t[c+2]+=h,r=Oi;case Oi:a=n===Ci||n===Oi,i=a?2*o-i:t[c+1],s=a?2*h-s:t[c+2],e?Qi(_,o,h,i,s,t[c+1],t[c+2]):_.push(Ci,i,s,t[c+1],t[c+2]),o=t[c+1],h=t[c+2],c+=3;break;case Li:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Ci;case Ci:i=t[c+1],s=t[c+2],e?Qi(_,o,h,i,s,t[c+3],t[c+4]):_.push(Ci,i,s,t[c+3],t[c+4]),o=t[c+3],h=t[c+4],c+=5;break;case Ai:t[c+6]+=o,t[c+7]+=h;case Ii:Ji(_,o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),o=t[c+6],h=t[c+7],c+=8;break;case Wi:case Mi:_.push(Mi),c++;break;case Fi:o=t[c+1],h=t[c+2],e?Gi(_,o,h,t[c+3],t[c+4]):rs(_,t,c,5),c+=5;break;case Ui:o=t[c+1],h=t[c+2],e?Vi(_,o,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):rs(_,t,c,9),c+=9;break;case Ni:o=t[c+1],h=t[c+2],e?Vi(_,o,h,t[c+3],t[c+4],t[c+5]):rs(_,t,c,6),c+=6;break;case zi:Zi(e?_:rs(_,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,ts),o=ts.x,h=ts.y,c+=9;break;case Yi:e?Zi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):rs(_,t,c,5),o=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Xi:qi(e?_:rs(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,ts),o=ts.x,h=ts.y,c+=7;break;case Hi:e?qi(_,t[c+1],t[c+2],t[c+3],0,360,!1):rs(_,t,c,4),o=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case ji:Ki(e?_:rs(_,t,c,6),o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,ts),o=ts.x,h=ts.y,c+=6;break;default:return $i.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return yi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(mi,t.x,t.y);break;case"L":e.push(xi,t.x,t.y);break;case"C":e.push(ki,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ci,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Mi)}}),e}},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){is.index===is.length&&(is.index=1,t.push(is.name)),t.push(Number(e)),is.index++,is.dot=0}},{current:is,pushData:ss,copyData:rs}=es,{M:ns,L:as,C:os,Q:hs,Z:ls,N:ds,D:cs,X:us,G:_s,F:ps,O:gs,P:fs,U:ys}=Ie,{getMinDistanceFrom:ms,getRadianFrom:vs}=dt,{tan:xs,min:ws,abs:bs}=Math,Es={},Ps={beginPath(t){t.length=0},moveTo(t,e,i){t.push(ns,e,i)},lineTo(t,e,i){t.push(as,e,i)},bezierCurveTo(t,e,i,s,r,n,a){t.push(os,e,i,s,r,n,a)},quadraticCurveTo(t,e,i,s,r){t.push(hs,e,i,s,r)},closePath(t){t.push(ls)},rect(t,e,i,s,r){t.push(ds,e,i,s,r)},roundRect(t,e,i,s,r,n){if(h(n))t.push(us,e,i,s,r,n);else{const a=W.fourNumber(n);a?t.push(cs,e,i,s,r,...a):t.push(ds,e,i,s,r)}},ellipse(t,e,i,s,r,a,o,h,l){if(s===r)return ks(t,e,i,s,o,h,l);n(a)?t.push(ps,e,i,s,r):(n(o)&&(o=0),n(h)&&(h=360),t.push(_s,e,i,s,r,a,o,h,l?1:0))},arc(t,e,i,s,r,a,o){n(r)?t.push(fs,e,i,s):(n(r)&&(r=0),n(a)&&(a=360),t.push(gs,e,i,s,r,a,o?1:0))},arcTo(t,e,i,s,n,a,o,h){if(!r(o)){const t=ms(o,h,e,i,s,n);a=ws(a,ws(t/2,t/2*bs(xs(vs(o,h,e,i,s,n)/2))))}t.push(ys,e,i,s,n,a)},drawEllipse(t,e,i,s,r,a,o,h,l){oi.ellipse(null,e,i,s,r,n(a)?0:a,n(o)?0:o,n(h)?360:h,l,null,null,Es),t.push(ns,Es.x,Es.y),Bs(t,e,i,s,r,a,o,h,l)},drawArc(t,e,i,s,r,a,o){oi.arc(null,e,i,s,n(r)?0:r,n(a)?360:a,o,null,null,Es),t.push(ns,Es.x,Es.y),ks(t,e,i,s,r,a,o)},drawPoints(t,e,i,s){oi.points(t,e,i,s)}},{ellipse:Bs,arc:ks}=Ps,{moveTo:Ss,lineTo:Rs,quadraticCurveTo:Ts,bezierCurveTo:Cs,closePath:Ls,beginPath:Os,rect:Ds,roundRect:Is,ellipse:As,arc:Ms,arcTo:Ws,drawEllipse:Fs,drawArc:Us,drawPoints:Ns}=Ps;class zs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?Oe.parse(t):t:[],this}beginPath(){return Os(this.__path),this.paint(),this}moveTo(t,e){return Ss(this.__path,t,e),this.paint(),this}lineTo(t,e){return Rs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return Cs(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ts(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ls(this.__path),this.paint(),this}rect(t,e,i,s){return Ds(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return Is(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,a,o){return As(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}arc(t,e,i,s,r,n){return Ms(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return Ws(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,a,o){return Fs(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}drawArc(t,e,i,s,r,n){return Us(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return Ns(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ys,L:Xs,C:Hs,Q:js,Z:Gs,N:Vs,D:Ks,X:qs,G:Zs,F:Qs,O:Js,P:$s,U:tr}=Ie,er=te.get("PathDrawer"),ir={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Ys:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Xs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Hs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case js:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs:t.closePath(),s+=1;break;case Vs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ks: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 qs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Zs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*U,e[s+6]*U,e[s+7]*U,e[s+8]),s+=9;break;case Qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,N,!1),s+=5;break;case Js:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*U,e[s+5]*U,e[s+6]),s+=7;break;case $s:t.arc(e[s+1],e[s+2],e[s+3],0,N,!1),s+=4;break;case tr:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void er.error(`command: ${i} [index:${s}]`,e)}}},{M:sr,L:rr,C:nr,Q:ar,Z:or,N:hr,D:lr,X:dr,G:cr,F:ur,O:_r,P:pr,U:gr}=Ie,{toTwoPointBounds:fr,toTwoPointBoundsByQuadraticCurve:yr,arcTo:mr,arc:vr,ellipse:xr}=oi,{addPointBounds:wr,copy:br,addPoint:Er,setPoint:Pr,addBounds:Br,toBounds:kr}=xt,Sr=te.get("PathBounds");let Rr,Tr,Cr;const Lr={},Or={},Dr={},Ir={toBounds(t,e){Ir.toTwoPointBounds(t,Or),kr(Or,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Pr(e,0,0);let i,s,r,n,a,o=0,h=0,l=0;const d=t.length;for(;o<d;)switch(a=t[o],0===o&&(a===or||a===nr||a===ar?Pr(e,h,l):Pr(e,t[o+1],t[o+2])),a){case sr:case rr:h=t[o+1],l=t[o+2],Er(e,h,l),o+=3;break;case nr:r=t[o+5],n=t[o+6],fr(h,l,t[o+1],t[o+2],t[o+3],t[o+4],r,n,Lr),wr(e,Lr),h=r,l=n,o+=7;break;case ar:i=t[o+1],s=t[o+2],r=t[o+3],n=t[o+4],yr(h,l,i,s,r,n,Lr),wr(e,Lr),h=r,l=n,o+=5;break;case or:o+=1;break;case hr:h=t[o+1],l=t[o+2],Br(e,h,l,t[o+3],t[o+4]),o+=5;break;case lr:case dr:h=t[o+1],l=t[o+2],Br(e,h,l,t[o+3],t[o+4]),o+=a===lr?9:6;break;case cr:xr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],t[o+7],t[o+8],Lr,Dr),0===o?br(e,Lr):wr(e,Lr),h=Dr.x,l=Dr.y,o+=9;break;case ur:h=t[o+1],l=t[o+2],Tr=t[o+3],Cr=t[o+4],Br(e,h-Tr,l-Cr,2*Tr,2*Cr),h+=Tr,o+=5;break;case _r:vr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],Lr,Dr),0===o?br(e,Lr):wr(e,Lr),h=Dr.x,l=Dr.y,o+=7;break;case pr:h=t[o+1],l=t[o+2],Rr=t[o+3],Br(e,h-Rr,l-Rr,2*Rr,2*Rr),h+=Rr,o+=4;break;case gr:mr(null,h,l,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],Lr,Dr),0===o?br(e,Lr):wr(e,Lr),h=Dr.x,l=Dr.y,o+=6;break;default:return void Sr.error(`command: ${a} [index:${o}]`,t)}}},{M:Ar,L:Mr,Z:Wr}=Ie,{getCenterX:Fr,getCenterY:Ur}=dt,{arcTo:Nr}=Ps,zr={smooth(t,e,i){let s,r,n,a=0,o=0,h=0,l=0,c=0,u=0,_=0,p=0,g=0;d(e)&&(e=e[0]||0);const f=t.length,y=[];for(;a<f;){switch(s=t[a],s){case Ar:l=p=t[a+1],c=g=t[a+2],a+=3,t[a]===Mr?(u=t[a+1],_=t[a+2],y.push(Ar,Fr(l,u),Ur(c,_))):y.push(Ar,l,c);break;case Mr:switch(o=t[a+1],h=t[a+2],a+=3,t[a]){case Mr:Nr(y,o,h,t[a+1],t[a+2],e,p,g);break;case Wr:Nr(y,o,h,l,c,e,p,g);break;default:y.push(Mr,o,h)}p=o,g=h;break;case Wr:r!==Wr&&(Nr(y,l,c,u,_,e,p,g),y.push(Wr)),a+=1;break;default:n=Ne[s];for(let e=0;e<n;e++)y.push(t[a+e]);a+=n}r=s}return s!==Wr&&(y[1]=l,y[2]=c),y}};function Yr(t){return new zs(t)}const Xr=Yr();Oe.creator=Yr(),Oe.parse=es.parse,Oe.convertToCanvasData=es.toCanvasData;const{drawRoundRect:Hr}=ze;function jr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){Hr(this,t,e,i,s,r)})}(t)}const Gr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Vr.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{}}}},Vr=Gr;Vr.alphaPixelTypes.forEach(t=>Vr.upperCaseTypeMap[t]=t.toUpperCase());const Kr=te.get("TaskProcessor");class qr{constructor(t){this.parallel=!0,this.time=1,this.id=x.create(x.TASK),this.task=t}run(){return ye(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Kr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Zr{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&&_.assign(this.config,t),this.empty()}add(t,e,i){let s,n,a,o;const l=new qr(t);return l.parent=this,h(e)?o=e:e&&(n=e.parallel,s=e.start,a=e.time,o=e.delay,i||(i=e.canUse)),a&&(l.time=a),!1===n&&(l.parallel=!1),i&&(l.canUse=i),r(o)?this.push(l,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,s))},o)),this.isComplete=!1,l}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++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>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;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=s+e.parallel;if(r>i.length&&(r=i.length),e.parallel>1)for(let e=s;e<r&&(t=i[e],t.parallel);e++)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 Qr=te.get("Resource"),Jr={tasker:new Zr,map:{},get isComplete(){return $r.tasker.isComplete},set(t,e){$r.map[t]&&Qr.repeat(t),$r.map[t]=e},get:t=>$r.map[t],remove(t){const e=$r.map[t];e&&(e.destroy&&e.destroy(),delete $r.map[t])},loadImage(t,e){return new Promise((i,s)=>{const r=this.setImage(t,t,e);r.load(()=>i(r),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=he.image(s)),$r.set(t,e),e},destroy(){$r.map={}}},$r=Jr,tn={maxRecycled:10,recycledList:[],patternTasker:new Zr({parallel:1}),get(t){let e=Jr.get(t.url);return e||Jr.set(t.url,e=he.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||(m.image.isLarge(t)?t.url&&Jr.remove(t.url):(t.clearLevels(),en.recycledList.push(t)))})},recyclePaint(t){en.recycle(t.image)},clearRecycled(t){const e=en.recycledList;(e.length>en.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&Jr.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Gr.alphaPixelTypes.some(e=>en.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Gr.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Gr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},en=tn,{IMAGE:sn,create:rn}=x;class nn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=rn(sn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}tn.isFormat("svg",t)&&(this.isSVG=!0),tn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;Jr.tasker.add(()=>ye(this,void 0,void 0,function*(){return yield m.origin.loadImage(this.url,r(t)?m.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),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,e,i,s,r,n,a){if(t||(t=this.width),e||(e=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 o=m.image.resize(this.view,t,e,r,n,void 0,a,i,s);return this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(t,e,i,s){const r=m.canvas.createPattern(t,e);return m.image.setPatternTransform(r,i,s),r}clearLevels(t){}destroy(){this.clearLevels();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function an(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function on(t,e){return Object.getOwnPropertyDescriptor(t,e)}function hn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function ln(t,e){return(i,s)=>cn(i,s,t,e&&e(s))}function dn(t){return t}function cn(t,e,i,s){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};an(t,e,Object.assign(r,s||{})),Un(t,e,i)}function un(t){return ln(t)}function _n(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function pn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function gn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),xn(this))}}))}function fn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function yn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function mn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&xn(this)}}))}function vn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(xn(this),this.__.__removeNaturalSize())}}))}function xn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function wn(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),xn(this)}}))}const bn=mn;function En(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i)&&(Pn(this),e&&(this.__.__useStroke=!0))}}))}function Pn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&xn(t)}const Bn=En;function kn(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Sn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Rn(t){return ln(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;_.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Tn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Ln(this)}}))}function Cn(t){return ln(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>On(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");On(this,t,e,i),this.mask&&Ln(this)}}))}function Ln(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function On(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||xn(t))}function Dn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function In(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function An(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Mn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===te.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Wn(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Fn(t){return(e,i)=>{an(e,"__DataProcessor",{get:()=>t})}}function Un(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,a=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o=hn(e,i);if(r(i))o.get=function(){return this[n]};else if("function"==typeof i)o.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(c(i)){const t=u(i);o.get=function(){const e=this[n];return null==e?this[n]=t?{}:_.clone(i):e}}const h=t.isBranchLeaf;"width"===e?o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=on(d,e),d=d.__proto__;l&&l.set&&(o.set=l.set),s[a]&&(o.set=s[a],delete s[a]),an(s,e,o)}const Nn=new te("rewrite"),zn=[],Yn=["destroy","constructor"];function Xn(t){return(e,i)=>{zn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Hn(){return t=>{jn()}}function jn(t){zn.length&&(zn.forEach(e=>{t&&Nn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),zn.length=0)}function Gn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Yn.includes(s)||e&&e.includes(s)))if(t.prototype){on(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Vn(){return t=>{de.register(t)}}function Kn(){return t=>{_e.register(t)}}setTimeout(()=>jn(!0));const{copy:qn,toInnerPoint:Zn,toOuterPoint:Qn,scaleOfOuter:Jn,rotateOfOuter:$n,skewOfOuter:ta,multiplyParent:ea,divideParent:ia,getLayout:sa}=J,ra={},{round:na}=Math,aa={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),la(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)ha(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++)da(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&da(t),t.__updateChange()},updateAllChange(t){if(ua(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ca(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,e,i,s,r,n){s||(s=t.__nowWorld),t.__worldFlipped||m.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,r,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,r){const n=c(e)?Object.assign({},e):{x:e,y:i};s?Qn(t.localTransform,n,n,!0):t.parent&&Zn(t.parent.scrollWorldTransform,n,n,!0),oa.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,i=0,s){c(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=na(e),i=na(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,n){oa.zoomOfLocal(t,_a(t,e),i,s,r,n)},zoomOfLocal(t,e,i,s=i,r,n){const a=t.__localMatrix;if(h(s)||(s&&(n=s),s=i),qn(ra,a),Jn(ra,e,i,s),oa.hasHighPosition(t))oa.setTransform(t,ra,r,n);else{const e=t.x+ra.e-a.e,o=t.y+ra.f-a.f;n&&!r?t.animate({x:e,y:o,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=o,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){oa.rotateOfLocal(t,_a(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;qn(ra,r),$n(ra,e,i),oa.hasHighPosition(t)?oa.setTransform(t,ra,!1,s):t.set({x:t.x+ra.e-r.e,y:t.y+ra.f-r.f,rotation:W.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,n){oa.skewOfLocal(t,_a(t,e),i,s,r,n)},skewOfLocal(t,e,i,s=0,r,n){qn(ra,t.__localMatrix),ta(ra,e,i,s),oa.setTransform(t,ra,r,n)},transformWorld(t,e,i,s){qn(ra,t.worldTransform),ea(ra,e),t.parent&&ia(ra,t.parent.scrollWorldTransform),oa.setTransform(t,ra,i,s)},transform(t,e,i,s){qn(ra,t.localTransform),ea(ra,e),oa.setTransform(t,ra,i,s)},setTransform(t,e,i,s){const r=t.__,n=r.origin&&oa.getInnerOrigin(t,r.origin),a=sa(e,n,r.around&&oa.getInnerOrigin(t,r.around));if(oa.hasOffset(t)&&(a.x-=r.offsetX,a.y-=r.offsetY),i){const e=a.scaleX/t.scaleX,i=a.scaleY/t.scaleY;if(delete a.scaleX,delete a.scaleY,n){jt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=oa.getInnerOrigin(t,r.origin);dt.move(a,n.x-s.x,n.y-s.y)}t.set(a),t.scaleResize(e,i,!1)}else t.set(a,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Jn(i,oa.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>dt.tempToOuterOf(oa.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Bt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(qn(ra,t.worldTransform),ia(ra,e.scrollWorldTransform),i?ra:Object.assign({},ra)),drop(t,e,i,s){t.setTransform(oa.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||oa.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,r=e.y*i;e.x-=s,e.y-=r,t.move(s,r),m.requestRender(()=>oa.animateMove(t,e,i))}}},oa=aa,{updateAllMatrix:ha,updateMatrix:la,updateAllWorldOpacity:da,updateAllChange:ca,updateChange:ua}=oa;function _a(t,e){return t.updateLayout(),t.parent?dt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const pa={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>fa(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>fa(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>fa(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let ga;function fa(t,e){return e||(ga=0),t.__.mask&&(ga=1),ga<0?null:(ga&&(ga=-1),!0)}const{updateBounds:ya}=aa,ma={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,r=i.length;s<r;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),va(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&r(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)xa(e[t],e)},updateBounds(t,e){const i=[t];xa(t,i),wa(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let r=t.length-1;r>-1;r--){i=t[r],s=i.children;for(let t=0,e=s.length;t<e;t++)ya(s[t]);e&&e===i||ya(i)}},move(t,e,i){let s;const{children:r}=t;for(let n=0,a=r.length;n<a;n++)s=(t=r[n]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&ba(t,e,i)},scale(t,e,i,s,r,n,a){let o;const{children:h}=t,l=s-1,d=r-1;for(let c=0,u=h.length;c<u;c++)o=(t=h[c]).__world,o.a*=s,o.d*=r,(o.b||o.c)&&(o.b*=s,o.c*=r),o.e===o.x&&o.f===o.y?(o.x=o.e+=(o.e-n)*l+e,o.y=o.f+=(o.f-a)*d+i):(o.e+=(o.e-n)*l+e,o.f+=(o.f-a)*d+i,o.x+=(o.x-n)*l+e,o.y+=(o.y-a)*d+i),o.width*=s,o.height*=r,o.scaleX*=s,o.scaleY*=r,t.isBranch&&Ea(t,e,i,s,r,n,a)}},{pushAllChildBranch:va,pushAllBranchStack:xa,updateBoundsByBranchStack:wa,move:ba,scale:Ea}=ma,Pa={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:Ba,updateBounds:ka}=aa,{toOuterOf:Sa,getPoints:Ra,copy:Ta}=jt,Ca="_localContentBounds",La="_worldContentBounds",Oa="_worldBoxBounds",Da="_worldStrokeBounds";class Ia{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 Sa(this.contentBounds,this.leaf.__localMatrix,this[Ca]||(this[Ca]={})),this[Ca]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Sa(this.contentBounds,this.leaf.__world,this[La]||(this[La]={})),this[La]}get worldBoxBounds(){return Sa(this.boxBounds,this.leaf.__world,this[Oa]||(this[Oa]={})),this[Oa]}get worldStrokeBounds(){return Sa(this.strokeBounds,this.leaf.__world,this[Da]||(this[Da]={})),this[Da]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:e}=t;if(t.isApp)return ka(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,m.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 J.defaultMatrix;case"page":t=e.zoomLayer;default:return Ba(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 qt(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 r,n,a,o=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(o),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;a={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(o);break;case"inner":r=o,n=J.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(o,e),n=Ba(s,e,!0)}if(a||(a=J.getLayout(n)),Ta(a,o),dt.copy(a,r),i){const{scaleX:t,scaleY:e}=a,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(a.scaleX/=i,a.scaleY/=s,a.width*=i,a.height*=s)}return a}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Ra(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return r(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):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.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Aa{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&m.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&m.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&m.event.stop(this.origin)}}class Ma extends Aa{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Ma.ADD="child.add",Ma.REMOVE="child.remove",Ma.CREATED="created",Ma.MOUNTED="mounted",Ma.UNMOUNTED="unmounted",Ma.DESTROY="destroy";const Wa="property.scroll";class Fa extends Aa{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}}Fa.CHANGE="property.change",Fa.LEAFER_CHANGE="property.leafer_change",Fa.SCROLL=Wa;const Ua={scrollX:Wa,scrollY:Wa};class Na extends Aa{constructor(t,e){super(t),Object.assign(this,e)}}Na.LOAD="image.load",Na.LOADED="image.loaded",Na.ERROR="image.error";class za extends Aa{static checkHas(t,e,i){"on"===i?e===ja?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Ya)||t.hasEvent(Xa)||t.hasEvent(Ha),t.__hasWorldEvent=t.hasEvent(ja))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Ya,t),"inner"===e&&t.emit(Xa,t)),t.emit(Ha,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(ja,this)}}za.RESIZE="bounds.resize",za.INNER="bounds.inner",za.LOCAL="bounds.local",za.WORLD="bounds.world";const{RESIZE:Ya,INNER:Xa,LOCAL:Ha,WORLD:ja}=za,Ga={};[Ya,Xa,Ha,ja].forEach(t=>Ga[t]=1);class Va extends Aa{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){c(t)?(super(Va.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!r(this.resizingKeys[t.innerId])}}Va.RESIZE="resize";class Ka extends Aa{constructor(t,e){super(t),this.data=e}}Ka.REQUEST="watch.request",Ka.DATA="watch.data";class qa extends Aa{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}qa.REQUEST="layout.request",qa.START="layout.start",qa.BEFORE="layout.before",qa.LAYOUT="layout",qa.AFTER="layout.after",qa.AGAIN="layout.again",qa.END="layout.end";class Za extends Aa{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Za.REQUEST="render.request",Za.CHILD_START="render.child_start",Za.CHILD_END="render.child_end",Za.START="render.start",Za.BEFORE="render.before",Za.RENDER="render",Za.AFTER="render.after",Za.AGAIN="render.again",Za.END="render.end",Za.NEXT="render.next";class Qa extends Aa{}Qa.START="leafer.start",Qa.BEFORE_READY="leafer.before_ready",Qa.READY="leafer.ready",Qa.AFTER_READY="leafer.after_ready",Qa.VIEW_READY="leafer.view_ready",Qa.VIEW_COMPLETED="leafer.view_completed",Qa.STOP="leafer.stop",Qa.RESTART="leafer.restart",Qa.END="leafer.end",Qa.UPDATE_MODE="leafer.update_mode",Qa.TRANSFORM="leafer.transform",Qa.MOVE="leafer.move",Qa.SCALE="leafer.scale",Qa.ROTATE="leafer.rotate",Qa.SKEW="leafer.skew";const{MOVE:Ja,SCALE:$a,ROTATE:to,SKEW:eo}=Qa,io={x:Ja,y:Ja,scaleX:$a,scaleY:$a,rotation:to,skewX:eo,skewY:eo},so={};class ro{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,r,n;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const o=no(this,s,!0),h=a(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(n=o[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(l):o[t]=[l],Ga[t]&&za.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,r,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const a=no(this,t);s.forEach(t=>{t&&(r=a[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete a[t],Ga[t]&&za.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):d(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&_e.has(t)&&(e=_e.get(t,{type:t,target:this,current:this}));const s=no(this,i)[t];if(s){let r;for(let n=0,a=s.length;n<a&&!((r=s[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),n--,a--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],a=s&&s[t];return!!(r(e)?n||a:e?a:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function no(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:so)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:so)}}const{on:ao,on_:oo,off:ho,off_:lo,once:co,emit:uo,emitEvent:_o,hasEvent:po,destroy:go}=ro.prototype,fo={on:ao,on_:oo,off:ho,off_:lo,once:co,emit:uo,emitEvent:_o,hasEvent:po,destroyEventer:go},yo=te.get("setAttr"),mo={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||o(e)||r(e)||(yo.warn(this.innerName,t,e),e=void 0),c(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Fa(Fa.LEAFER_CHANGE,this,t,s,e));const i=io[t];i&&(this.emitEvent(new Qa(i,this)),this.emitEvent(new Qa(Qa.TRANSFORM,this)))}this.emitPropertyEvent(Fa.CHANGE,t,s,e);const i=Ua[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const r=new Fa(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||r(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:vo,multiplyParent:xo,translateInner:wo,defaultWorld:bo}=J,{toPoint:Eo,tempPoint:Po}=Bt,Bo={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:r}=this;xo(this.__local||e,t?t.__scrollWorld||t.__world:bo,i,!!e.affectScaleOrRotation,r),s&&wo(Object.assign(s,i),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(vo(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(Eo(i.around||i.origin,t.boxBounds,Po),wo(e,-Po.x,-Po.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ko,updateAllMatrix:So}=aa,{updateBounds:Ro}=ma,{toOuterOf:To,copyAndSpread:Co,copy:Lo}=jt,{toBounds:Oo}=Ir,Do={__updateWorldBounds(){const{__layout:t,__world:e}=this;To(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&za.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&za.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),To(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){To(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){To(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Oo(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),So(this),Ro(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(So(this),Ro(this,this))):ko(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Co(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;h(i)&&i<=0?Lo(e.renderBounds,e.strokeBounds):Co(e.renderBounds,e.boxBounds,i)}},Io={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(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),aa.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);te.showBounds&&te.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Ao}=pa,Mo={__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.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,r,r,i.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Ao(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)Ao(i[s],e)||i[s].__clip(t,e)}}},Wo={},{LEAF:Fo,create:Uo}=x,{stintSet:No}=_,{toInnerPoint:zo,toOuterPoint:Yo,multiplyParent:Xo}=J,{toOuterOf:Ho}=jt,{copy:jo,move:Go}=dt,{moveLocal:Vo,zoomOfLocal:Ko,rotateOfLocal:qo,skewOfLocal:Zo,moveWorld:Qo,zoomOfWorld:Jo,rotateOfWorld:$o,skewOfWorld:th,transform:eh,transformWorld:ih,setTransform:sh,getFlipTransform:rh,getLocalOrigin:nh,getRelativeWorld:ah,drop:oh}=aa;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 g}get __LayoutProcessor(){return Ia}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 scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}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.updateLayout(),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=Uo(Fo),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Ma.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(Ma.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Ma.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(Ma.MOUNTED)):this.__emitLifeEvent(Ma.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){r(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=r(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__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 Xo(i,t.matrix,e,void 0,i),Ho(this.__layout.renderBounds,e,e),No(e,"half",i.half),No(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=tn.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Wo.scaleX=i,Wo.scaleY=s,Wo}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?ah(this,e):this.worldTransform,r=i?t:{};return Ho(t,s,r),r}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&jo(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&jo(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),zo(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Yo(this.scrollWorldTransform,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 r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return Go(r,-n,-a),r}getInnerPoint(t,e,i,s){const r=s?t:{};return this.worldToInner(t,r,i,e),r}getInnerPointByBox(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return Go(r,n,a),r}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const r=s?t:{};return this.worldToLocal(t,r,i,e),r}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 r=s?t:{};return this.innerToWorld(t,r,i,e),r}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const r=s?t:{};return this.localToWorld(t,r,i,e),r}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){sh(this,t,e,i)}transform(t,e,i){eh(this,t,e,i)}move(t,e,i){Vo(this,t,e,i)}moveInner(t,e,i){Qo(this,t,e,!0,i)}scaleOf(t,e,i,s,r){Ko(this,nh(this,t),e,i,s,r)}rotateOf(t,e,i){qo(this,nh(this,t),e,i)}skewOf(t,e,i,s,r){Zo(this,nh(this,t),e,i,s,r)}transformWorld(t,e,i){ih(this,t,e,i)}moveWorld(t,e,i){Qo(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){Jo(this,t,e,i,s,r)}rotateOfWorld(t,e){$o(this,t,e)}skewOfWorld(t,e,i,s,r){th(this,t,e,i,s,r)}flip(t,e){eh(this,rh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t,e){return!0}__hit(t,e){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return oe.need("path")}getMotionPoint(t){return oe.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){oh(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Un(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=mn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Ma(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Ma.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=fe([Gn(mo),Gn(Bo),Gn(Do),Gn(fo),Gn(Io)],t.Leaf);const{setListWithFn:hh}=jt,{sort:lh}=ma,{localBoxBounds:dh,localStrokeBounds:ch,localRenderBounds:uh,maskLocalBoxBounds:_h,maskLocalStrokeBounds:ph,maskLocalRenderBounds:gh}=pa,fh=new te("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(t,e){hh(e||this.__layout.boxBounds,this.children,this.__hasMask?_h:dh)}__updateStrokeBounds(t){hh(t||this.__layout.strokeBounds,this.children,this.__hasMask?ph:ch)}__updateRenderBounds(t){hh(t||this.__layout.renderBounds,this.children,this.__hasMask?gh:uh)}__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(lh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return fh.warn("add self or destroyed");const i=r(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=de.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(Ma.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Ma.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):r(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Ma.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Ma.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Ma(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=fe([Gn(Mo)],t.Branch);class yh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!r(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return r(e)?-1:e}add(t){const{list:e,keys:i}=this;r(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(r(i[t.innerId])){const{list:s}=this;for(let t=e,r=s.length;t<r;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)r(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;r(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new yh;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 mh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!r(this.keys[t.innerId])}without(t){return r(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class vh extends Le{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=m.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}jr(OffscreenCanvasRenderingContext2D.prototype),jr(Path2D.prototype);const{mineType:xh}=Gr;function wh(t,e){m.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,r)=>{t.convertToBlob({type:xh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)}).catch(t=>{r(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:xh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",m.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},m.canvas=he.canvas(),m.conicGradientSupport=!!m.canvas.context.createConicGradient}Object.assign(he,{canvas:(t,e)=>new vh(t,e),image:t=>new nn(t)}),m.name="web",m.isWorker=!0,m.backgrounder=!0,m.requestRender=function(t){requestAnimationFrame(t)},an(m,"devicePixelRatio",{get:()=>1});const{userAgent:bh}=navigator;bh.indexOf("Firefox")>-1?(m.conicGradientRotate90=!0,m.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(m.fullImageShadow=!0),bh.indexOf("Windows")>-1?(m.os="Windows",m.intWheelDeltaY=!0):bh.indexOf("Mac")>-1?m.os="Mac":bh.indexOf("Linux")>-1&&(m.os="Linux");class Eh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new yh;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 yh,this.target=t,e&&(this.config=_.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(Za.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Ma.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 Ka(Ka.DATA,{updatedList:this.updatedList})),this.__updatedList=new yh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Fa.CHANGE,this.__onAttrChange,this],[[Ma.ADD,Ma.REMOVE],this.__onChildEvent,this],[Ka.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Ph,updateBounds:Bh,updateChange:kh}=aa,{pushAllChildBranch:Sh,pushAllParent:Rh}=ma;const{worldBounds:Th}=pa;class Ch{constructor(t){this.updatedBounds=new qt,this.beforeBounds=new qt,this.afterBounds=new qt,d(t)&&(t=new yh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Th)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Th),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:Lh,updateAllChange:Oh}=aa,Dh=te.get("Layouter");class Ih{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new mh,this.target=t,e&&(this.config=_.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(qa.START),this.layoutOnce(),t.emitEvent(new qa(qa.END,this.layoutedBlocks,this.times))}catch(t){Dh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Dh.warn("layouting"):this.times>3?Dh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Ka.REQUEST),this.totalTimes>1&&this.config.usePartLayout?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=re.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:n,AFTER:a}=qa,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),i.emitEvent(new qa(r,o,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?(Ph(t,!0),e.add(t),t.isBranch&&Sh(t,e),Rh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Rh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;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||Bh(s[t])}Bh(i)}})}(this.__levelList),function(t){t.list.forEach(kh)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),i.emitEvent(new qa(n,o,this.times)),i.emitEvent(new qa(a,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,re.end(e)}fullLayout(){const t=re.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:r}=qa,n=this.getBlocks(new yh(e));e.emitEvent(new qa(i,n,this.times)),Ih.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new qa(s,n,this.times)),e.emitEvent(new qa(r,n,this.times)),this.addBlocks(n),re.end(t)}static fullLayout(t){Lh(t,!0),t.isBranch?ma.updateBounds(t):aa.updateBounds(t),Oh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ch([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ch(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[qa.REQUEST,this.layout,this],[qa.AGAIN,this.layoutAgain,this],[Ka.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Ah=te.get("Renderer");class Mh{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:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=_.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.requestTime||this.__requestRender()}requestLayout(){this.target.emit(qa.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Za.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Za.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Za.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new qt,Ah.log(e.innerName,"---\x3e");try{this.emitRender(Za.START),this.renderOnce(t),this.emitRender(Za.END,this.totalBounds),tn.clearRecycled()}catch(t){this.rendering=!1,Ah.error(t)}Ah.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ah.warn("rendering");if(this.times>3)return Ah.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new qt,this.renderOptions={},t)this.emitRender(Za.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Za.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Za.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Za.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=re.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),r=new qt(s);i.save(),s.spread(Mh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,r),i.restore(),re.end(e)}fullRender(){const t=re.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),re.end(t)}__render(t,e){const{canvas:i,target:s}=this,r=t.includes(s.__world),n=r?{includes:r}:{bounds:t,includes:r};this.needFill&&i.fillWorld(t,this.config.fill),te.showRepaint&&te.drawRepaint(i,t),this.config.useCellRender&&(n.cellList=this.getCellList()),m.render(s,i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new qt;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);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return m.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};m.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new qt(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 qt(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||Ah.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 Za(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Za.REQUEST,this.update,this],[qa.END,this.__onLayoutEnd,this],[Za.AGAIN,this.renderAgain,this],[Va.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Mh.clipSpread=10;const Wh={},{copyRadiusPoint:Fh}=dt,{hitRadiusPoint:Uh}=jt;class Nh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,r=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new yh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:a}=this.findList,o=this.getBestMatchLeaf(a,i.bottomList,r,!!i.findList),h=r?this.getPath(o):this.getHitablePath(o);return this.clear(),s?{path:h,target:o,throughPath:a.length?this.getThroughPath(a):h}:{path:h,target:o}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const r=this.findList=new yh;if(t.length){let e;const{x:s,y:n}=this.point,a={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||aa.worldHittable(e))&&(this.hitChild(e,a),r.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&aa.hasParent(t,e))){r.reset();break}return r.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),r.length)return r.list[0];return s?null:i?t[0]:t.find(t=>aa.worldHittable(t))}getPath(t){const e=new yh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new yh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new yh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,r,n;for(let t=0,a=i.length;t<a;t++){s=i[t],r=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!r||!r.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,r;const{point:n}=this;for(let a=t.length-1;a>-1;a--)if(i=t[a],r=i.__,r.visible&&(!e||r.mask))if(s=Uh(i.__world,r.hitRadius?Fh(Wh,n,r.hitRadius):n),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&r.__clipAfterFill&&!i.__hitWorld(n,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)}}else s&&this.hitChild(i,n)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,r=[];const{children:n}=s;for(let s=0,a=n.length;s<a;s++)if(i=n[s],i.__.mask&&r.push(i),i===t){if(r&&!r.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class zh{constructor(t,e){this.config={},e&&(this.config=_.default(e,this.config)),this.picker=new Nh(this.target=t,this),this.finder=he.finder&&he.finder()}getByPoint(t,e,i){const{target:s,picker:r}=this;return m.backgrounder&&s&&s.updateLayout(),r.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):oe.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Yh(t){return ln(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Xh(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Hh(){return(t,e)=>{const i="_"+e;an(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(he,{watcher:(t,e)=>new Eh(t,e),layouter:(t,e)=>new Ih(t,e),renderer:(t,e,i)=>new Mh(t,e,i),selector:(t,e)=>new zh(t,e)}),m.layout=Ih.fullLayout,m.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new yh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const jh={},Gh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Vh={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Kh={},qh={},Zh={},Qh={},Jh={},$h={apply(){oe.need("filter")}},tl={},el={setStyleName:()=>oe.need("state"),set:()=>oe.need("state")},il={list:{},register(t,e){il.list[t]=e},get:t=>il.list[t]},{parse:sl,objectToCanvasData:rl}=es,{stintSet:nl}=_,{hasTransparent:al}=Gh,ol={originPaint:{}},hl=te.get("UIData");class ll extends g{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,hl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,hl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(nl(this,"__isTransparentFill",al(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(nl(this,"__isTransparentStroke",al(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?sl(t):rl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){dl(this,"shadow",t)}setInnerShadow(t){dl(this,"innerShadow",t)}setFilter(t){dl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&qh.compute("fill",this.__leaf),e&&qh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),r(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=ol)):(this.__isStrokes=!0,this._stroke||(this._stroke=ol))}__removePaint(t,e){e&&this.__removeInput(t),Zh.recycleImage(t,this),"fill"===t?(nl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(nl(this,"__isAlphaPixelStroke",void 0),nl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function dl(t,e,i){t.__setInput(e,i),d(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class cl extends ll{}class ul extends cl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class _l extends cl{__getInputData(t,e){const i=super.__getInputData(t,e);return Ce.forEach(t=>delete i[t]),i}}class pl extends ul{}class gl extends ll{get __usePathBox(){return this.points||this.__pathInputed}}class fl extends ll{get __boxStroke(){return!this.__pathInputed}}class yl extends ll{get __boxStroke(){return!this.__pathInputed}}class ml extends gl{}class vl extends ll{}class xl extends ll{get __pathInputed(){return 2}}class wl extends cl{}const bl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class El extends ll{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=bl[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=de.get("Rect",0);const r=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=r.boxBounds),i.set(t),n.strokeChanged&&r.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Pl extends fl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Bl extends fl{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{max:kl,add:Sl}=S,Rl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:r}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),n&&(t=kl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n,renderSpread:a}=this.__,{strokeSpread:o}=this.__layout,h=this.__box;e&&(t=Jh.getShadowRenderSpread(this,e)),s&&(t=kl(t,s)),n&&(t=Sl(t,$h.getSpread(n))),a&&(t=Sl(t,a)),o&&(t=Sl(t,o));let l=t;return i&&(l=kl(l,Jh.getInnerShadowSpread(this,i))),r&&(l=kl(l,r)),this.__layout.renderShapeSpread=l,h?kl(h.__updateRenderSpread(),t):t}},{stintSet:Tl}=_,Cl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Tl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Tl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Tl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Jh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),Tl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Ll(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:r,stroke:n,__drawAfterFill:a,__fillAfterStroke:o,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=qh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Jh.shadow(this,t,h),o&&(s.__isStrokes?qh.strokes(n,this,t,e):qh.stroke(n,this,t,e)),r&&(s.__isFills?qh.fills(r,this,t,e):qh.fill(r,this,t,e)),a&&this.__drawAfterFill(t,e),d&&Jh.innerShadow(this,t,h),n&&!o&&(s.__isStrokes?qh.strokes(n,this,t,e):qh.stroke(n,this,t,e)),c&&$h.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(o&&(s.__isStrokes?qh.strokes(n,this,t,e):qh.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*r,e.blur*i,Gh.string(e.color))}r&&(s.__isFills?qh.fills(r,this,t,e):qh.fill(r,this,t,e)),h&&t.restore(),a&&this.__drawAfterFill(t,e),n&&!o&&(s.__isStrokes?qh.strokes(n,this,t,e):qh.stroke(n,this,t,e))}}else s.__pathForRender?Ll(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:r}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?qh.fills(s,this,t,e):qh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?qh.strokes(r,this,t,e):qh.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Ll(t,e,i){const{fill:s,stroke:r,__drawAfterFill:n,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&qh.stroke(r,t,e,i),s&&qh.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),r&&!a&&qh.stroke(r,t,e,i)}const Ol={__drawFast(t,e){let{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;const{fill:a,stroke:o,__drawAfterFill:h}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,r,n)),h&&this.__drawAfterFill(t,e),o){const{strokeAlign:a,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(o,h,this.__);const l=h/2;switch(a){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,n),t.restore()):t.strokeRect(i+l,s+l,r,n);break;case"outside":t.strokeRect(i-l,s-l,r+h,n+h)}}}};var Dl,Il;t.UI=Dl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){W.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Xr.set(this.path=t||[]),t||this.__drawPathByBox(Xr),Xr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return oe.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return oe.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Xr.set(i=[]),this.__drawPathByBox(Xr,!e)),t?es.toCanvasData(i,!0):i}getPathString(t,e,i){return es.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||tl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?zr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Kh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?ir.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,r,n,h(e)?[e]:e)}else t.rect(i,s,r,n);t.closePath()}drawImagePlaceholder(t,e,i){qh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),oe.need("animate")}killAnimate(t,e){}export(t,e){return oe.need("export")}syncExport(t,e){return oe.need("export")}clone(t){const e=_.clone(this.toJSON());return t&&Object.assign(e,t),Dl.one(e)}static one(t,e,i,s,r){return de.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){Vn()(this)}static registerData(t){Fn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},fe([Fn(ll)],t.UI.prototype,"__",void 0),fe([Hh()],t.UI.prototype,"zoomLayer",void 0),fe([un("")],t.UI.prototype,"id",void 0),fe([un("")],t.UI.prototype,"name",void 0),fe([un("")],t.UI.prototype,"className",void 0),fe([Sn("pass-through")],t.UI.prototype,"blendMode",void 0),fe([Tn(1)],t.UI.prototype,"opacity",void 0),fe([Cn(!0)],t.UI.prototype,"visible",void 0),fe([Sn(!1)],t.UI.prototype,"locked",void 0),fe([Rn(!1)],t.UI.prototype,"dim",void 0),fe([Rn(!1)],t.UI.prototype,"dimskip",void 0),fe([Dn(0)],t.UI.prototype,"zIndex",void 0),fe([In(!1)],t.UI.prototype,"mask",void 0),fe([An(!1)],t.UI.prototype,"eraser",void 0),fe([_n(0,!0)],t.UI.prototype,"x",void 0),fe([_n(0,!0)],t.UI.prototype,"y",void 0),fe([mn(100,!0)],t.UI.prototype,"width",void 0),fe([mn(100,!0)],t.UI.prototype,"height",void 0),fe([fn(1,!0)],t.UI.prototype,"scaleX",void 0),fe([fn(1,!0)],t.UI.prototype,"scaleY",void 0),fe([yn(0,!0)],t.UI.prototype,"rotation",void 0),fe([yn(0,!0)],t.UI.prototype,"skewX",void 0),fe([yn(0,!0)],t.UI.prototype,"skewY",void 0),fe([_n(0,!0)],t.UI.prototype,"offsetX",void 0),fe([_n(0,!0)],t.UI.prototype,"offsetY",void 0),fe([pn(0,!0)],t.UI.prototype,"scrollX",void 0),fe([pn(0,!0)],t.UI.prototype,"scrollY",void 0),fe([gn()],t.UI.prototype,"origin",void 0),fe([gn()],t.UI.prototype,"around",void 0),fe([un(!1)],t.UI.prototype,"lazy",void 0),fe([vn(1)],t.UI.prototype,"pixelRatio",void 0),fe([kn(0)],t.UI.prototype,"renderSpread",void 0),fe([wn()],t.UI.prototype,"path",void 0),fe([bn()],t.UI.prototype,"windingRule",void 0),fe([bn(!0)],t.UI.prototype,"closed",void 0),fe([mn(0)],t.UI.prototype,"padding",void 0),fe([mn(!1)],t.UI.prototype,"lockRatio",void 0),fe([mn()],t.UI.prototype,"widthRange",void 0),fe([mn()],t.UI.prototype,"heightRange",void 0),fe([un(!1)],t.UI.prototype,"draggable",void 0),fe([un()],t.UI.prototype,"dragBounds",void 0),fe([un("auto")],t.UI.prototype,"dragBoundsType",void 0),fe([un(!1)],t.UI.prototype,"editable",void 0),fe([Mn(!0)],t.UI.prototype,"hittable",void 0),fe([Mn("path")],t.UI.prototype,"hitFill",void 0),fe([Bn("path")],t.UI.prototype,"hitStroke",void 0),fe([Mn(!1)],t.UI.prototype,"hitBox",void 0),fe([Mn(!0)],t.UI.prototype,"hitChildren",void 0),fe([Mn(!0)],t.UI.prototype,"hitSelf",void 0),fe([Mn()],t.UI.prototype,"hitRadius",void 0),fe([Wn("")],t.UI.prototype,"cursor",void 0),fe([Sn()],t.UI.prototype,"fill",void 0),fe([Bn(void 0,!0)],t.UI.prototype,"stroke",void 0),fe([Bn("inside")],t.UI.prototype,"strokeAlign",void 0),fe([Bn(1,!0)],t.UI.prototype,"strokeWidth",void 0),fe([Bn(!1)],t.UI.prototype,"strokeWidthFixed",void 0),fe([Bn("none")],t.UI.prototype,"strokeCap",void 0),fe([Bn("miter")],t.UI.prototype,"strokeJoin",void 0),fe([Bn()],t.UI.prototype,"dashPattern",void 0),fe([Bn(0)],t.UI.prototype,"dashOffset",void 0),fe([Bn(10)],t.UI.prototype,"miterLimit",void 0),fe([bn(0)],t.UI.prototype,"cornerRadius",void 0),fe([bn()],t.UI.prototype,"cornerSmoothing",void 0),fe([Yh()],t.UI.prototype,"shadow",void 0),fe([Yh()],t.UI.prototype,"innerShadow",void 0),fe([Yh()],t.UI.prototype,"blur",void 0),fe([Yh()],t.UI.prototype,"backgroundBlur",void 0),fe([Yh()],t.UI.prototype,"grayscale",void 0),fe([Yh()],t.UI.prototype,"filter",void 0),fe([Sn()],t.UI.prototype,"placeholderColor",void 0),fe([un(100)],t.UI.prototype,"placeholderDelay",void 0),fe([un({})],t.UI.prototype,"data",void 0),fe([Xn(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Dl=fe([Gn(Rl),Gn(Cl),Hn()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},fe([Fn(cl)],t.Group.prototype,"__",void 0),fe([mn(0)],t.Group.prototype,"width",void 0),fe([mn(0)],t.Group.prototype,"height",void 0),t.Group=fe([Gn(t.Branch),Vn()],t.Group);const Al=te.get("Leafer");t.Leafer=Il=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&&Jr.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}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),Il.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,_.assign(s,t));const r=this.canvas=he.canvas(s);this.__controllers.push(this.renderer=he.renderer(this,r,s),this.watcher=he.watcher(this,s),this.layouter=he.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=he.selector(this),this.interaction=he.interaction(this,r,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=he.hitCanvasManager()),this.canvasManager=new ge,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(r),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Pa.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(Qa.RESTART):this.emitLeafer(Qa.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(Qa.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=_.copyAttrs({},t,Ce);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new qt(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=_.copyAttrs({},this.canvas,Ce);e.resize(t),this.updateLazyBounds(),this.__onResize(new Va(t,i))}__onResize(t){this.emitEvent(t),_.copyAttrs(this.__,t,Ce),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Qt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Ce.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(Qa.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ce.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,r=_.copyAttrs({},s,Ce);r[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__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(Qa.BEFORE_READY),this.emitLeafer(Qa.READY),this.emitLeafer(Qa.AFTER_READY),Pa.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Qa.VIEW_READY),Pa.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:n}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(r=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Pa.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(Qa.VIEW_COMPLETED),Pa.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 oe.need("view")}getValidMove(t,e,i){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 Qa(t,this))}__listenEvents(){const t=re.start("FirstCreate "+this.innerName);this.once([[Qa.START,()=>re.end(t)],[qa.START,this.updateLazyBounds,this],[Za.START,this.__onCreated,this],[Za.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Ka.DATA,this.__onWatchData,this],[qa.END,this.__onLayoutEnd,this],[Za.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Il.list.remove(this);try{this.stop(),this.emitLeafer(Qa.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{tn.clearRecycled()},100)}catch(t){Al.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new yh,fe([Fn(_l)],t.Leafer.prototype,"__",void 0),fe([mn()],t.Leafer.prototype,"pixelRatio",void 0),fe([un("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Il=fe([Vn()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},fe([Fn(fl)],t.Rect.prototype,"__",void 0),t.Rect=fe([Gn(Ol),Hn(),Vn()],t.Rect);const{add:Ml,includes:Wl,scroll:Fl}=jt,Ul=t.Rect.prototype,Nl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:r,boxBounds:n}=s,{overflow:a}=i,o=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(o),(e=a&&a.includes("scroll"))&&(Ml(o,n),Fl(o,i)),this.__updateRectRenderBounds(),t=!Wl(n,o),t&&"show"===a&&Ml(r,o)}else this.__updateRectRenderBounds();_.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},fe([Fn(ul)],t.Box.prototype,"__",void 0),fe([mn(100)],t.Box.prototype,"width",void 0),fe([mn(100)],t.Box.prototype,"height",void 0),fe([un(!1)],t.Box.prototype,"resizeChildren",void 0),fe([kn("show")],t.Box.prototype,"overflow",void 0),fe([Xn(Ul.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),fe([Xn(Ul.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),fe([Xn(Ul.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),fe([Xn(Ul.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),fe([Xn(Ul.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),fe([Xn(Ul.__updateChange)],t.Box.prototype,"__updateRectChange",null),fe([Xn(Ul.__render)],t.Box.prototype,"__renderRect",null),fe([Xn(Nl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=fe([Hn(),Vn()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},fe([Fn(pl)],t.Frame.prototype,"__",void 0),fe([Sn("#FFFFFF")],t.Frame.prototype,"fill",void 0),fe([kn("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=fe([Vn()],t.Frame);const{moveTo:zl,closePath:Yl,ellipse:Xl}=Ps;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:r}=this.__,n=t/2,a=e/2,o=this.__.path=[];i?s||r?(i<1&&Xl(o,n,a,n*i,a*i,0,s,r,!1),Xl(o,n,a,n,a,0,r,s,!0)):(i<1&&(Xl(o,n,a,n*i,a*i),zl(o,t,a)),Xl(o,n,a,n,a,0,360,0,!0)):s||r?(zl(o,n,a),Xl(o,n,a,n,a,0,s,r,!1)):Xl(o,n,a,n,a),Yl(o),m.ellipseToCurve&&(this.__.path=this.getPath(!0))}},fe([Fn(yl)],t.Ellipse.prototype,"__",void 0),fe([bn(0)],t.Ellipse.prototype,"innerRadius",void 0),fe([bn(0)],t.Ellipse.prototype,"startAngle",void 0),fe([bn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=fe([Vn()],t.Ellipse);const{sin:Hl,cos:jl,PI:Gl}=Math,{moveTo:Vl,lineTo:Kl,closePath:ql,drawPoints:Zl}=Ps;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Zl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:r}=t,n=i/2,a=s/2;Vl(e,n,0);for(let t=1;t<r;t++)Kl(e,n+n*Hl(2*t*Gl/r),a-a*jl(2*t*Gl/r));ql(e)}}},fe([Fn(ml)],t.Polygon.prototype,"__",void 0),fe([bn(3)],t.Polygon.prototype,"sides",void 0),fe([bn()],t.Polygon.prototype,"points",void 0),fe([bn(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=fe([Hn(),Vn()],t.Polygon);const{sin:Ql,cos:Jl,PI:$l}=Math,{moveTo:td,lineTo:ed,closePath:id}=Ps;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,r=t/2,n=e/2,a=this.__.path=[];td(a,r,0);for(let t=1;t<2*i;t++)ed(a,r+(t%2==0?r:r*s)*Ql(t*$l/i),n-(t%2==0?n:n*s)*Jl(t*$l/i));id(a)}},fe([Fn(vl)],t.Star.prototype,"__",void 0),fe([bn(5)],t.Star.prototype,"corners",void 0),fe([bn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=fe([Vn()],t.Star);const{moveTo:sd,lineTo:rd,drawPoints:nd}=Ps,{rotate:ad,getAngle:od,getDistance:hd,defaultPoint:ld}=dt;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&&ad(i,e),i}set toPoint(t){this.width=hd(ld,t),this.rotation=od(ld,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?nd(e,t.points,t.curve,t.closed):(sd(e,0,0),rd(e,this.width,0))}},fe([Fn(gl)],t.Line.prototype,"__",void 0),fe([En("center")],t.Line.prototype,"strokeAlign",void 0),fe([mn(0)],t.Line.prototype,"height",void 0),fe([bn()],t.Line.prototype,"points",void 0),fe([bn(0)],t.Line.prototype,"curve",void 0),fe([bn(!1)],t.Line.prototype,"closed",void 0),t.Line=fe([Vn()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}},fe([Fn(Pl)],t.Image.prototype,"__",void 0),fe([mn("")],t.Image.prototype,"url",void 0),t.Image=fe([Vn()],t.Image);const dd=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=he.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new nn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Na(Na.LOADED,{image:t}))})}draw(t,e,i,s){const r=new mt(t.worldTransform).invert(),n=new mt;e&&n.translate(e.x,e.y),i&&(h(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},fe([Fn(Bl)],t.Canvas.prototype,"__",void 0),fe([Xh(100)],t.Canvas.prototype,"width",void 0),fe([Xh(100)],t.Canvas.prototype,"height",void 0),fe([Xh(1)],t.Canvas.prototype,"pixelRatio",void 0),fe([Xh(!0)],t.Canvas.prototype,"smooth",void 0),fe([un(!1)],t.Canvas.prototype,"safeResize",void 0),fe([Xh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=fe([Vn()],t.Canvas);const{copyAndSpread:cd,includes:ud,spread:_d,setList:pd}=jt,{stintSet:gd}=_;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:r,fontWeight:n,italic:a,textCase:o,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Vh.number(e,r),t.__letterSpacing=Vh.number(i,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${a?"italic ":""}${"small-caps"===o?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${s||"caption"}`,gd(t,"__padding",l&&W.fourNumber(l)),gd(t,"__clipText","show"!==h&&!t.__autoSize),gd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==o),t.__textDrawData=jh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:r,__autoWidth:n,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:o}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=o,t.__lineHeight<i&&_d(o,i/2),n||a){if(h.x=n?o.x:0,h.y=a?o.y:0,h.width=n?o.width:t.width,h.height=a?o.height:t.height,r){const[e,i,s,r]=t.__padding;n&&(h.x-=r,h.width+=i+r),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),_.stintSet(this,"isOverflow",!ud(h,o)),this.isOverflow?(pd(t.__textBoxBounds={},[h,o]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;cd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},fe([Fn(El)],t.Text.prototype,"__",void 0),fe([mn(0)],t.Text.prototype,"width",void 0),fe([mn(0)],t.Text.prototype,"height",void 0),fe([Sn()],t.Text.prototype,"boxStyle",void 0),fe([un(!1)],t.Text.prototype,"resizeFontSize",void 0),fe([Sn("#000000")],t.Text.prototype,"fill",void 0),fe([En("outside")],t.Text.prototype,"strokeAlign",void 0),fe([Mn("all")],t.Text.prototype,"hitFill",void 0),fe([mn("")],t.Text.prototype,"text",void 0),fe([mn("")],t.Text.prototype,"placeholder",void 0),fe([mn("caption")],t.Text.prototype,"fontFamily",void 0),fe([mn(12)],t.Text.prototype,"fontSize",void 0),fe([mn("normal")],t.Text.prototype,"fontWeight",void 0),fe([mn(!1)],t.Text.prototype,"italic",void 0),fe([mn("none")],t.Text.prototype,"textCase",void 0),fe([mn("none")],t.Text.prototype,"textDecoration",void 0),fe([mn(0)],t.Text.prototype,"letterSpacing",void 0),fe([mn({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),fe([mn(0)],t.Text.prototype,"paraIndent",void 0),fe([mn(0)],t.Text.prototype,"paraSpacing",void 0),fe([mn("x")],t.Text.prototype,"writingMode",void 0),fe([mn("left")],t.Text.prototype,"textAlign",void 0),fe([mn("top")],t.Text.prototype,"verticalAlign",void 0),fe([mn(!0)],t.Text.prototype,"autoSizeAlign",void 0),fe([mn("normal")],t.Text.prototype,"textWrap",void 0),fe([mn("show")],t.Text.prototype,"textOverflow",void 0),fe([Sn(!1)],t.Text.prototype,"textEditing",void 0),t.Text=fe([Vn()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},fe([Fn(xl)],t.Path.prototype,"__",void 0),fe([En("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=fe([Vn()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}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,r,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,n,a,o){return this}arc(t,e,i,s,r,n){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,n,a,o){return this}drawArc(t,e,i,s,r,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},fe([Fn(wl)],t.Pen.prototype,"__",void 0),fe([(t,e)=>{an(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=fe([Gn(zs,["set","path","paint"]),Vn()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(i||r)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||r)&&(this.sky=this.addLeafer(s)),r&&he.editor(r,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),r(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&_.assign(e,t),this.autoLayout&&_.copyAttrs(e,this,Ce),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[qa.END,this.__onReady,this],[Za.START,this.__onCreated,this],[Za.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Za.END,this.__onChildRenderEnd,this))}},t.App=fe([Vn()],t.App);const fd={},yd={isHoldSpaceKey:()=>yd.isHold("Space"),isHold:t=>fd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){fd[t]||(fd[t]=!0)},setUpCode(t){fd[t]=!1}},md={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 vd extends Aa{get spaceKey(){return yd.isHoldSpaceKey()}get left(){return md.left(this)}get right(){return md.right(this)}get middle(){return md.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return yd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){_e.changeName(t,e)}}const{min:xd,max:wd,abs:bd}=Math,{float:Ed,sign:Pd}=W,{minX:Bd,maxX:kd,minY:Sd,maxY:Rd}=jt,Td=new qt,Cd=new qt,Ld={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Od.getValidMove(t.__localBoxBounds,Od.getDragBounds(t),s,e,!0),Od.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:r,dragBoundsType:n}=t;r&&Od.getValidScaleOf(t.__localBoxBounds,Od.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,r){const n=t.x+s.x,a=t.y+s.y,o=n+t.width,h=a+t.height,l=e.x+e.width,d=e.y+e.height;return r||(s=Object.assign({},s)),Od.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:o<l&&(s.x+=l-o):n<e.x?s.x+=e.x-n:o>l&&(s.x+=l-o),Od.isInnerMode(t,e,i,"height")?a>e.y?s.y+=e.y-a:h<d&&(s.y+=d-h):a<e.y?s.y+=e.y-a:h>d&&(s.y+=d-h),s.x=Ed(s.x),s.y=Ed(s.y),s},getValidScaleOf(t,e,i,s,r,n,a){a||(r=Object.assign({},r)),Cd.set(e),Td.set(t).scaleOf(s,r.x,r.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,_,p,g,f=1,y=1;return Od.isInnerMode(t,e,i,"width")?(r.x<0&&Td.scaleOf(s,f=1/r.x,1),p=Ed(Td.minX-Cd.minX),g=Ed(Cd.maxX-Td.maxX),u=h&&p>0?1+p/(h*Td.width):1,_=l&&g>0?1+g/(l*Td.width):1,f*=wd(u,_)):(r.x<0&&((Ed(Bd(t)-Bd(e))<=0||Ed(kd(e)-kd(t))<=0)&&Td.scaleOf(s,f=1/r.x,1),Td.unsign()),p=Ed(Cd.minX-Td.minX),g=Ed(Td.maxX-Cd.maxX),u=h&&p>0?1-p/(h*Td.width):1,_=l&&g>0?1-g/(l*Td.width):1,f*=xd(u,_)),Od.isInnerMode(t,e,i,"height")?(r.y<0&&Td.scaleOf(s,1,y=1/r.y),p=Ed(Td.minY-Cd.minY),g=Ed(Cd.maxY-Td.maxY),u=d&&p>0?1+p/(d*Td.height):1,_=c&&g>0?1+g/(c*Td.height):1,y*=wd(u,_),n&&(u=wd(bd(f),bd(y)),f=Pd(f)*u,y=Pd(y)*u)):(r.y<0&&((Ed(Sd(t)-Sd(e))<=0||Ed(Rd(e)-Rd(t))<=0)&&Td.scaleOf(s,1,y=1/r.y),Td.unsign()),p=Ed(Cd.minY-Td.minY),g=Ed(Td.maxY-Cd.maxY),u=d&&p>0?1-p/(d*Td.height):1,_=c&&g>0?1-g/(c*Td.height):1,y*=xd(u,_)),r.x*=o(f)?f:1,r.y*=o(y)?y:1,r}},Od=Ld;t.PointerEvent=class extends vd{},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=fe([Kn()],t.PointerEvent);const Dd=t.PointerEvent,Id={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof yh?t:new yh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const r=t.getLocalPoint(i,null,!0);return dt.move(r,e.x-t.x,e.y-t.y),s&&this.limitMove(t,r),Ld.axisMove(t,r),r}static limitMove(t,e){Ld.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Id,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Id,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Id,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 jt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),jt.unsign(i),i}assignMove(t){Id.x=t?this.totalX:this.moveX,Id.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=fe([Kn()],t.DragEvent);const Ad=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=fe([Kn()],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.DRAG_ANIMATE="move.drag_animate",t.MoveEvent.END="move.end",t.MoveEvent=fe([Kn()],t.MoveEvent),t.TouchEvent=class extends vd{},t.TouchEvent=fe([Kn()],t.TouchEvent);const Md=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=fe([Kn()],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=fe([Kn()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=fe([Kn()],t.ZoomEvent),t.KeyEvent=class extends vd{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=fe([Kn()],t.KeyEvent);const Wd={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:Fd.getSwipeDirection(dt.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,time:Date.now(),buttons:r(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new yh,{list:s}=t;for(let t=0,r=s.length;t<r;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>aa.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Fd=Wd,Ud=new yh,{getDragEventData:Nd,getDropEventData:zd,getSwipeEventData:Yd}=Wd;class Xd{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Nd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,r=s&&s.list.length,n=t.DragEvent.list||this.draggableList||Ud;return this.dragging&&(r?e?Ud:new yh(i?[...s.list,...s.dragHoverExclude]:s.list):n)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&md.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],aa.draggable(e)){this.draggableList=new yh(e);break}}drag(e){const{interaction:i,dragData:s,downData:r}=this,{path:n,throughPath:a}=r;this.dragData=Nd(r,s,e),a&&(this.dragData.throughPath=a),this.dragData.path=n,this.dragDataList.push(this.dragData),this.moving?(e.moving=!0,this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(e.dragging=!0,this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,r=this.realDraggableList;if(r.length&&s){const{totalX:s,totalY:n}=this.dragData,{dragLimitAnimate:o}=i.p,l=!o||!!e;r.forEach(i=>{if(i.draggable){const r=a(i.draggable),d=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:n},l||r);o&&!r&&e?aa.animateMove(i,d,h(o)?o:.3):i.move(d)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:r}=e;this.dragOverPath=r,s?r.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,r)):i.emit(t.DragEvent.OVER,e,r)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:r}=e;i.emit(t.DragEvent.LEAVE,e,s,r),i.emit(t.DragEvent.ENTER,e,r,s),this.dragEnterPath=r}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:r}=this;e||(e=r);const{path:n,throughPath:a}=s,o=Nd(s,e,e);if(a&&(o.throughPath=a),o.path=n,this.moving&&(this.moving=!1,o.moveType="drag",i.emit(t.MoveEvent.END,o)),this.dragging){const n=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,o),this.swipe(e,s,r,o),this.drop(e,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(dt.getDistance(e,t)>r.config.pointer.swipeDistance){const t=Yd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const r=zd(e,i,t.DragEvent.data);r.path=s,this.interaction.emit(t.DropEvent.DROP,r),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,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Hd=te.get("emit");const jd=["move","zoom","rotate","key"];function Gd(t,e,i,s,r){if(jd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Kd(t,r)){let n;for(let a=0,o=t.children.length;a<o;a++)n=t.children[a],!i.path.has(n)&&n.__.hittable&&Vd(n,e,i,s,r)}}function Vd(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!Kd(t,r)&&(el.updateEventStyle&&!s&&el.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=_e.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function Kd(t,e){return e&&e.has(t)}const qd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Zd,pathCanDrag:Qd,pathHasOutside:Jd}=Wd;class $d{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&&md.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&md.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&yd.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=_.clone(qd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new yh(t),this.createTransformer(),this.dragger=new Xd(this),s&&(this.config=_.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(md.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),md.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=md.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&&md.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=dt.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;md.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,yd.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,yd.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 yh),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 r=Date.now()-this.downTime,n=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>Zd(e.path,t));r<i.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:r,target:n}=this;m.backgrounder||t.origin||n&&n.updateLayout();const a=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));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&&!Jd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Qd(t.path))&&!Jd(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))}stopDragAnimate(){this.dragger.stopAnimate()}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,r=s.length;t<r&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:r}=this.canvas;return s.x*=r.width/i.width,s.y*=r.height/i.height,this.p.snap&&dt.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),(Zd(e.path,t.PointerEvent.LONG_TAP)||Zd(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 qt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(h(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Va.RESIZE,this.__onResize,this)],t.once(Qa.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 r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(r=i.list[n],Vd(r,t,e,!0,s))return;r.isApp&&Gd(r,t,e,!0,s)}for(let n=0,a=i.length;n<a;n++)if(r=i.list[n],r.isApp&&Gd(r,t,e,!1,s),Vd(r,t,e,!1,s))return}catch(t){Hd.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 tc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}tc.custom={};class ec extends ge{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new yh,this.pixelList=new yh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),he.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),he.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()}}m.getSelector=function(t){return t.leafer?t.leafer.selector:m.selector||(m.selector=he.selector())};const{toInnerRadiusPointOf:ic,copyRadiusPoint:sc}=dt,{hitRadiusPoint:rc,hitPoint:nc}=jt,ac={},oc={},hc=t.Leaf.prototype;hc.hit=function(t,e=0){this.updateLayout(),sc(oc,t,e);const i=this.__world;return!!(e?rc(i,oc):nc(i,oc))&&(this.isBranch?m.getSelector(this).hitPoint(Object.assign({},oc),e,{target:this}):this.__hitWorld(oc))},hc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,r=this.__layout,n=s.width<10&&s.height<10;if(i.hitRadius&&(sc(ac,t,i.hitRadius),t=ac),ic(t,s,ac),i.hitBox||n){if(jt.hitRadiusPoint(r.boxBounds,ac))return!0;if(n)return!1}return!r.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),r.boundsChanged||(r.hitCanvasChanged=!1)),this.__hit(ac,e)},hc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},hc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},hc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},hc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const lc=new mt,dc=t.UI.prototype;dc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,r=i||s;this.__hitCanvas||(this.__hitCanvas=r?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,r=m.image.hitCanvasSize,a=n.hitScale=Zt.set(0,0,r,r).getFitMatrix(t).a,{x:o,y:h,width:l,height:d}=Zt.set(t).scale(a);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),tn.patternLocked=!0,this.__renderShape(n,{matrix:lc.setWith(this.__world).scaleWith(1/a).invertWith().translate(-o,-h),ignoreFill:!i,ignoreStroke:!s}),tn.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},dc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,r=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(r&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:a}=i,o=i.stroke&&("path"===n||"pixel"===n&&!i.__isAlphaPixelStroke)||"all"===n;if(!r&&!o)return!1;const h=2*t.radiusX;let l=h;if(o)switch(i.strokeAlign){case"inside":if(l+=2*a,!r&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=a;break;case"outside":if(l+=2*a,!r){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};const cc=t.UI.prototype,uc=t.Rect.prototype,_c=t.Box.prototype;uc.__updateHitCanvas=_c.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?cc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},uc.__hitFill=_c.__hitFill=function(t){return this.__hitCanvas?cc.__hitFill.call(this,t):jt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:r,__textDrawData:n}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):n.rows.forEach(r=>t.rect(r.x,r.y-s,r.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=s),this.updateLayout(),m.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const pc=Le.prototype;function gc(t,e,i){t.__.__font?qh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function fc(t,e,i,s,r){const n=i.__;c(t)?qh.drawStrokesStyle(t,e,!1,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&qh.strokeArrow(t,i,s,r)}function yc(t,e,i,s,r){const n=i.__;c(t)?qh.drawStrokesStyle(t,e,!0,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),qh.drawTextStroke(i,s,r))}function mc(t,e,i,s,r){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,yc(t,2,i,n,r),n.blendMode="outside"===e?"destination-out":"destination-in",qh.fillText(i,n,r),n.blendMode="normal",aa.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}pc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},pc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},pc.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:n,radiusY:a}=t;e&&(s-=e.x,r-=e.y),Zt.set(s-n,r-a,2*n,2*a).scale(i).ceil();const{data:o}=this.context.getImageData(Zt.x,Zt.y,Zt.width||1,Zt.height||1);for(let t=0,e=o.length;t<e;t+=4)if(o[t+3]>0)return!0;return o[3]>0};const{getSpread:vc,copyAndSpread:xc,toOuterOf:wc,getOuterOf:bc,getByMove:Ec,move:Pc,getIntersectData:Bc}=jt,kc={};let Sc;const{stintSet:Rc}=_,{hasTransparent:Tc}=Gh;function Cc(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":if(!e.url)return;s=Zh.image(i,t,e,n,!Sc||!Sc[e.url]);break;case"linear":s=Qh.linearGradient(e,n);break;case"radial":s=Qh.radialGradient(e,n);break;case"angular":s=Qh.conicGradient(e,n);break;case"solid":const{type:a,color:o,opacity:h}=e;s={type:a,style:Gh.string(o,h)};break;default:r(e.r)||(s={type:"solid",style:Gh.string(e)})}if(s&&(s.originPaint=e,a(s.style)&&Tc(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Lc={compute:function(t,e){const i=e.__,s=[];let r,n,a,o=i.__input[t];d(o)||(o=[o]),Sc=Zh.recycleImage(t,i);for(let i,r=0,n=o.length;r<n;r++)(i=Cc(t,o[r],e))&&(s.push(i),i.strokeStyle&&(a||(a=1),i.strokeStyle.strokeWidth&&(a=Math.max(a,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(Rc(i,"__isAlphaPixelFill",r),Rc(i,"__isTransparentFill",n)):(Rc(i,"__isAlphaPixelStroke",r),Rc(i,"__isTransparentStroke",n),Rc(i,"__hasMultiStrokeStyle",a))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,gc(e,i,s)},fills:function(t,e,i,s){let r,n,a;for(let o=0,h=t.length;o<h;o++){if(r=t[o],n=r.originPaint,r.image){if(a?a++:a=1,Zh.checkImage(r,!e.__.__font,e,i,s))continue;if(!r.style){1===a&&r.image.isPlacehold&&e.drawImagePlaceholder(r,i,s);continue}}if(i.fillStyle=r.style,r.transform||n.scaleFixed){if(i.save(),r.transform&&i.transform(r.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),gc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),gc(e,i,s),i.restoreBlendMode()):gc(e,i,s)}},fillPathOrText:gc,fillText:function(t,e,i){const s=t.__,{rows:r,decorationY:n}=s.__textDrawData;let a;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=r.length;t<i;t++)a=r[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const r=e.__;if(r.__strokeWidth)if(r.__font)qh.strokeText(t,e,i,s);else switch(r.strokeAlign){case"center":fc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),fc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const r=e.__;if(r.__fillAfterStroke)fc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),fc(t,2,e,a,s),a.clipUI(r),a.clearWorld(n),aa.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){qh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":yc(t,1,e,i,s);break;case"inside":mc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?yc(t,2,e,i,s):mc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,r=t.__.__textDrawData;const{rows:n,decorationY:a}=r;for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(a){const{decorationHeight:t}=r;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,r,n){let a;const o=s.__,{__hasMultiStrokeStyle:h}=o;h||r.setStroke(void 0,o.__strokeWidth*e,o);for(let l=0,d=t.length;l<d;l++)if(a=t[l],(!a.image||!Zh.checkImage(a,!1,s,r,n))&&a.style){if(h){const{strokeStyle:t}=a;t?r.setStroke(a.style,o.__getRealStrokeWidth(t)*e,o,t):r.setStroke(a.style,o.__strokeWidth*e,o)}else r.strokeStyle=a.style;a.originPaint.blendMode?(r.saveBlendMode(a.originPaint.blendMode),i?qh.drawTextStroke(s,r,n):r.stroke(),r.restoreBlendMode()):i?qh.drawTextStroke(s,r,n):r.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),r=e.bounds,n=t.__nowWorld,a=t.__layout,o=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;wc(a.strokeSpread?(xc(kc,a.boxBounds,a.strokeSpread),kc):a.boxBounds,n,o);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(o))_=s,h=u=o,l=n;else{let s;if(m.fullImageShadow)s=o;else{const t=a.renderShapeSpread?vc(r,S.swapAndScale(a.renderShapeSpread,p,g)):r;s=Bc(t,o)}c=r.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=y),u=bc(o,c),h=Ec(u,-c.e,-c.f),l=bc(n,c),Pc(l,-c.e,-c.f);const v=i.matrix;v?(d=new mt(c),d.multiply(v),f*=v.scaleX,y*=v.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let Oc,Dc=new qt;const{isSame:Ic}=jt;function Ac(t,e,i,s,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||Zh.createData(r,s,i,n),!0}function Mc(t,e){Uc(t,Na.LOAD,e)}function Wc(t,e){Uc(t,Na.LOADED,e)}function Fc(t,e,i){e.error=i,t.forceUpdate("surface"),Uc(t,Na.ERROR,e)}function Uc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Na(e,i))}function Nc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:zc,translate:Yc}=J,Xc=new qt,Hc={},jc={};function Gc(t,e,i,s){const r=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&r<0?0:r}let Vc={},Kc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:qc,set:Zc,rotateOfOuter:Qc,translate:Jc,scaleOfOuter:$c,multiplyParent:tu,scale:eu,rotate:iu,skew:su}=J;function ru(t,e,i,s,r,n,a,o){a&&iu(t,a),o&&su(t,o.x,o.y),r&&eu(t,r,n),Jc(t,e.x+i,e.y+s)}const{get:nu,scale:au,copy:ou}=J,{getFloorScale:hu}=W,{abs:lu}=Math;const du={image:function(t,e,i,s,r){let n,a;const o=tn.get(i);return Oc&&i===Oc.paint&&Ic(s,Oc.boxBounds)?n=Oc.leafPaint:(n={type:i.type,image:o},o.hasAlphaPixel&&(n.isTransparent=!0),Oc=o.use>1?{leafPaint:n,paint:i,boxBounds:Dc.set(s)}:null),(r||o.loading)&&(a={image:o,attrName:e,attrValue:i}),o.ready?(Ac(t,e,i,o,n,s),r&&(Mc(t,a),Wc(t,a))):o.error?r&&Fc(t,a,o.error):(r&&(Nc(t,!0),Mc(t,a)),n.loadId=o.load(()=>{Nc(t,!1),t.destroyed||(Ac(t,e,i,o,n,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Wc(t,a)),n.loadId=void 0},e=>{Nc(t,!1),Fc(t,a,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),n},checkImage:function(t,e,i,s,r){const{scaleX:n,scaleY:a}=Zh.getImageRenderScaleData(t,i,s,r),{image:o,data:h,originPaint:l}=t,{exporting:d}=r;return!(!h||t.patternId===n+"-"+a&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===m.name&&Va.isResizing(i)||d||(e=m.image.isLarge(o,n,a)||o.width*n>8096||o.height*a>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Zh.drawImage(t,n,a,i,s,r),!0):(!t.style||l.sync||d?Zh.createPattern(t,i,s,r):Zh.createPatternTask(t,i,s,r),!1))},drawImage:function(t,e,i,s,r,n){const{data:a,image:o}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=a,c=o.getFull(a.filters),u=s.__;let _,{width:p,height:g}=o;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(s),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(a.scaleX&&(p*=a.scaleX,g*=a.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,i,s){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;r.scaleX*=t,r.scaleY*=t}return n&&n.scaleX&&(r.scaleX*=Math.abs(n.scaleX),r.scaleY*=Math.abs(n.scaleY)),r},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,r,n,a,o;for(let h=0,l=i.length;h<l;h++)s=i[h],r=s.image,o=r&&r.url,o&&(n||(n={}),n[o]=!0,tn.recyclePaint(s),r.loading&&(a||(a=e.__input&&e.__input[t]||[],d(a)||(a=[a])),r.unload(i[h].loadId,!a.some(t=>t.url===o))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=tn.patternTasker.add(()=>ye(this,void 0,void 0,function*(){Zh.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:r,scaleY:n}=Zh.getImageRenderScaleData(t,e,i,s),a=r+"-"+n;if(t.patternId!==a&&!e.destroyed&&(!m.image.isLarge(t.image,r,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:o,gap:h}=s,l=Zh.getPatternFixScale(t,r,n);let d,c,u,{width:_,height:p}=i;l&&(r*=l,n*=l),_*=r,p*=n,h&&(c=h.x*r/lu(s.scaleX||1),u=h.y*n/lu(s.scaleY||1)),(o||1!==r||1!==n)&&(r*=hu(_+(c||0)),n*=hu(p+(u||0)),d=nu(),o&&ou(d,o),au(d,1/r,1/n));const g=i.getCanvas(_,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(g,s.repeat||m.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=a}},getPatternFixScale:function(t,e,i){const{image:s}=t;let r,n=m.image.maxPatternSize,a=s.width*s.height;return s.isSVG?e>1&&(r=Math.ceil(e)/e):n>a&&(n=a),(a*=e*i)>n&&(r=Math.sqrt(n/a)),r},createData:function(t,e,i,s){t.data=Zh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Xc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:r}=i,{opacity:n,mode:o,align:h,offset:l,scale:d,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===r,x={mode:o},w="center"!==h&&(_||0)%180==90;let b,E;switch(jt.set(jc,0,0,w?r:s,w?s:r),o&&"cover"!==o&&"fit"!==o?((d||u)&&(W.getScaleData(d,u,i,Hc),b=Hc.scaleX,E=Hc.scaleY),(h||y||f)&&(b&&jt.scale(jc,b,E,!0),h&&Rt.toPoint(h,jc,e,jc,!0,!0))):v&&!_||(b=E=jt.getFitScale(e,jc,"fit"!==o),jt.put(e,i,h,b,!1,jc),jt.scale(jc,b,E,!0)),l&&dt.move(jc,l),o){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/r,Zh.stretchMode(x,e,b,E));break;case"normal":case"clip":if(jc.x||jc.y||b||g||_||p){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),Zh.clipMode(x,e,jc.x,jc.y,b,E,_,p,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||_||p)&&Zh.repeatMode(x,e,s,r,jc.x,jc.y,b,E,_,p,h,t.freeTransform),f||(x.repeat="repeat");const i=c(f);(y||i)&&(x.gap=function(t,e,i,s,r){let n,a;c(t)?(n=t.x,a=t.y):n=a=t;return{x:Gc(n,i,r.width,e&&e.x),y:Gc(a,s,r.height,e&&e.y)}}(y,i&&f,jc.width,jc.height,e));break;default:b&&Zh.fillOrFitMode(x,e,jc.x,jc.y,b,E,_)}return x.transform||(e.x||e.y)&&Yc(x.transform=zc(),e.x,e.y),b&&(x.scaleX=b,x.scaleY=E),n&&n<1&&(x.opacity=n),m&&(x.filters=m),f&&(x.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),x},stretchMode:function(t,e,i,s){const r=qc(),{x:n,y:a}=e;n||a?Jc(r,n,a):r.onlyScale=!0,eu(r,i,s),t.transform=r},fillOrFitMode:function(t,e,i,s,r,n,a){const o=qc();Jc(o,e.x+i,e.y+s),eu(o,r,n),a&&Qc(o,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=o},clipMode:function(t,e,i,s,r,n,a,o,h,l){const d=qc();ru(d,e,i,s,r,n,a,o),h&&(a||o?(Zc(Kc),$c(Kc,e,h,l),tu(d,Kc)):$c(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,r,n,a,o,h,l,d,c){const u=qc();if(c)ru(u,e,r,n,a,o,h,l);else{if(h)if("center"===d)Qc(u,{x:i/2,y:s/2},h);else switch(iu(u,h),h){case 90:Jc(u,s,0);break;case 180:Jc(u,i,s);break;case 270:Jc(u,0,i)}Vc.x=e.x+r,Vc.y=e.y+n,Jc(u,Vc.x,Vc.y),a&&$c(u,Vc,a,o)}t.transform=u}},{toPoint:cu}=Bt,{hasTransparent:uu}=Gh,_u={},pu={};function gu(t,e,i,s){if(i){let r,n,o,h;for(let t=0,l=i.length;t<l;t++)r=i[t],a(r)?(o=t/(l-1),n=Gh.string(r,s)):(o=r.offset,n=Gh.string(r.color,s)),e.addColorStop(o,n),!h&&uu(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:fu,getDistance:yu}=dt,{get:mu,rotateOfOuter:vu,scaleOfOuter:xu}=J,{toPoint:wu}=Bt,bu={},Eu={};function Pu(t,e,i,s,r){let n;const{width:a,height:o}=t;if(a!==o||s){const t=fu(e,i);n=mu(),r?(xu(n,e,a/o*(s||1),1),vu(n,e,t+90)):(xu(n,e,1,a/o*(s||1)),vu(n,e,t))}return n}const{getDistance:Bu}=dt,{toPoint:ku}=Bt,Su={},Ru={};const Tu={linearGradient:function(t,e){let{from:i,to:s,type:r,opacity:n}=t;cu(i||"top",e,_u),cu(s||"bottom",e,pu);const a=m.canvas.createLinearGradient(_u.x,_u.y,pu.x,pu.y),o={type:r,style:a};return gu(o,a,t.stops,n),o},radialGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;wu(i||"center",e,bu),wu(s||"bottom",e,Eu);const o=m.canvas.createRadialGradient(bu.x,bu.y,0,bu.x,bu.y,yu(bu,Eu)),h={type:r,style:o};gu(h,o,t.stops,n);const l=Pu(e,bu,Eu,a,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;ku(i||"center",e,Su),ku(s||"bottom",e,Ru);const o=m.conicGradientSupport?m.canvas.createConicGradient(0,Su.x,Su.y):m.canvas.createRadialGradient(Su.x,Su.y,0,Su.x,Su.y,Bu(Su,Ru)),h={type:r,style:o};gu(h,o,t.stops,n);const l=Pu(e,Su,Ru,a||1,m.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:Pu},{copy:Cu,move:Lu,toOffsetOutBounds:Ou}=jt,{max:Du,abs:Iu}=Math,Au={},Mu=new mt,Wu={};function Fu(t,e){let i,s,r,n,a=0,o=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),r=Iu(t.spread||0),a=Du(a,r+n-s),o=Du(o,r+n+i),h=Du(h,r+n+s),l=Du(l,r+n-i)}),a===o&&o===h&&h===l?a:[a,o,h,l]}function Uu(t,e,i){const{shapeBounds:s}=i;let r,n;m.fullImageShadow?(Cu(Au,t.bounds),Lu(Au,e.x-s.x,e.y-s.y),r=t.bounds,n=Au):(r=s,n=e),t.copyWorld(i.canvas,r,n)}const{toOffsetOutBounds:Nu}=jt,zu={};const Yu=Fu;const Xu={shadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{shadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Ou(h,Wu,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Wu.offsetX+(a.x||0)*c*f,Wu.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f,Gh.string(a.color)),r=Jh.getShadowTransform(t,_,i,a,Wu,f),r&&_.setTransform(r),Uu(_,Wu,i),r&&_.resetTransform(),s=l,a.box&&(_.restore(),_.save(),o&&(_.copyWorld(_,l,n,"copy"),s=n),o?_.copyWorld(o,n,n,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),aa.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{innerShadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Nu(h,zu,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(zu.offsetX+(a.x||0)*c*f,zu.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f),r=Jh.getShadowTransform(t,_,i,a,zu,f,!0),r&&_.setTransform(r),Uu(_,zu,i),_.restore(),o?(_.copyWorld(_,l,n,"copy"),_.copyWorld(o,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,Gh.string(a.color),"source-in"),aa.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.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){},getShadowRenderSpread:Fu,getShadowTransform:function(t,e,i,s,r,n,a){if(s.spread){const i=2*s.spread*n*(a?-1:1),{width:o,height:h}=t.__layout.strokeBounds;return Mu.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+i/o,1+i/h),Mu}},isTransformShadow(t){},getInnerShadowSpread:Yu},{excludeRenderBounds:Hu}=pa;let ju;function Gu(t,e,i,s,r,n,a,o){switch(e){case"grayscale":ju||(ju=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,r,n){const a=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,a),n&&s.recycle(a);Ku(t,e,i,1,r,n)}(t,i,s,r,a,o);break;case"opacity-path":Ku(t,i,s,n,a,o);break;case"path":o&&i.restore()}}function Vu(t){return t.getSameCanvas(!1,!0)}function Ku(t,e,i,s,r,n){const a=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,a,void 0,r),n?i.recycle(a):i.clearWorld(a)}t.Group.prototype.__renderMask=function(t,e){let i,s,r,n,a,o;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],o=i.__.mask,o){a&&(Gu(this,a,t,r,s,n,void 0,!0),s=r=null),"clipping"!==o&&"clipping-path"!==o||Hu(i,e)||i.__render(t,e),n=i.__.opacity,ju=!1,"path"===o||"clipping-path"===o?(n<1?(a="opacity-path",r||(r=Vu(t))):(a="path",t.save()),i.__clip(r||t,e)):(a="grayscale"===o?"grayscale":"alpha",s||(s=Vu(t)),r||(r=Vu(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&Gu(this,a,t,r,s,n,void 0,!1),Hu(i,e)||i.__render(r||t,e),d&&Gu(this,a,t,r,s,n,d,!1)}Gu(this,a,t,r,s,n,void 0,!0)};const qu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Zu=qu+"_#~&*+\\=|≮≯≈≠=…",Qu=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 Ju(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const $u=Ju("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),t_=Ju("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),e_=Ju(qu),i_=Ju(Zu),s_=Ju("- —/~|┆·");var r_;!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"}(r_||(r_={}));const{Letter:n_,Single:a_,Before:o_,After:h_,Symbol:l_,Break:d_}=r_;function c_(t){return $u[t]?n_:s_[t]?d_:t_[t]?o_:e_[t]?h_:i_[t]?l_:Qu.test(t)?a_:n_}const u_={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let n=r-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function __(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:p_}=u_,{Letter:g_,Single:f_,Before:y_,After:m_,Symbol:v_,Break:x_}=r_;let w_,b_,E_,P_,B_,k_,S_,R_,T_,C_,L_,O_,D_,I_,A_,M_,W_,F_=[];function U_(t,e){T_&&!R_&&(R_=T_),w_.data.push({char:t,width:e}),E_+=e}function N_(){P_+=E_,w_.width=E_,b_.words.push(w_),w_={data:[]},E_=0}function z_(){I_&&(A_.paraNumber++,b_.paraStart=!0,I_=!1),T_&&(b_.startCharSize=R_,b_.endCharSize=T_,R_=0),b_.width=P_,M_.width?p_(b_):W_&&Y_(),F_.push(b_),b_={words:[]},P_=0}function Y_(){P_>(A_.maxWidth||0)&&(A_.maxWidth=P_)}const{top:X_,right:H_,bottom:j_,left:G_}=t.Direction4;function V_(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let t=0;t<r.length;t++)r[t][e]+=i}const K_={getDrawData:function(t,e){a(t)||(t=String(t));let i=0,s=0,r=e.__getInput("width")||0,n=e.__getInput("height")||0;const{__padding:o}=e;o&&(r?(i=o[G_],r-=o[H_]+o[G_],!r&&(r=.01)):e.autoSizeAlign||(i=o[G_]),n?(s=o[X_],n-=o[X_]+o[j_],!n&&(n=.01)):e.autoSizeAlign||(s=o[X_]));const h={bounds:{x:i,y:s,width:r,height:n},rows:[],paraNumber:0,font:m.canvas.font=e.__font};return function(t,e,i){A_=t,F_=t.rows,M_=t.bounds,W_=!M_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:r,textCase:n}=i,{canvas:a}=m,{width:o}=M_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;I_=!0,L_=null,R_=S_=T_=E_=P_=0,w_={data:[]},b_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)k_=e[i],"\n"===k_?(E_&&N_(),b_.paraEnd=!0,z_(),I_=!0):(C_=c_(k_),C_===g_&&"none"!==n&&(k_=__(k_,n,!E_)),S_=a.measureText(k_).width,s&&(s<0&&(T_=S_),S_+=s),O_=C_===f_&&(L_===f_||L_===g_)||L_===f_&&C_!==m_,D_=!(C_!==y_&&C_!==f_||L_!==v_&&L_!==m_),B_=I_&&r?o-r:o,t&&o&&P_+E_+S_>B_&&(h?(E_&&N_(),P_&&z_()):(D_||(D_=C_===g_&&L_==m_),O_||D_||C_===x_||C_===y_||C_===f_||E_+S_>B_?(E_&&N_(),P_&&z_()):P_&&z_()))," "===k_&&!0!==I_&&P_+E_===0||(C_===x_?(" "===k_&&E_&&N_(),U_(k_,S_),N_()):O_||D_?(E_&&N_(),U_(k_,S_)):U_(k_,S_)),L_=C_);E_&&N_(),P_&&z_(),F_.length>0&&(F_[F_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{A_.paraNumber++,P_=a.measureText(t).width,F_.push({x:r||0,text:t,width:P_,paraStart:!0}),W_&&Y_()})}(h,t,e),o&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":V_(e,"x",t[G_]);break;case"right":V_(e,"x",-t[H_])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":V_(e,"y",t[X_]);break;case"bottom":V_(e,"y",-t[j_])}}(o,h,e,r,n),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:n,__baseLine:a,__letterSpacing:o,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*r+(c?c*(t.paraNumber-1):0),m=a;if(h&&y>f)y=Math.max(f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,x,w,b=g||u?g:t.maxWidth;for(let a=0,d=r;a<d;a++){if(v=i[a],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&a>0&&(m+=c),v.y=m,m+=n,t.overflow>a&&m>y&&(v.isOverflow=!0,t.overflow=a+1),x=v.x,w=v.width,o<0&&(v.width<0?(w=-v.width+e.fontSize+o,x-=w,w+=e.fontSize):w-=o),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&g&&g<w&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:n,letterSpacing:a}=e,o=i&&r.includes("both"),h=o||i&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,v;s.forEach(t=>{t.words&&(p=n&&t.paraStart?n:0,y=t.words.length,h&&(v=!t.paraEnd||o,c=i-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=a||t.isOverflow||l?0:u?1:2,t.isOverflow&&!a&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,r){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,v&&_),v&&(m=i===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:r,overflow:n}=t;let{textOverflow:a}=e;if(r.splice(n),a&&"show"!==a){let t,o;"hide"===a?a="":"ellipsis"===a&&(a="...");const h=a?m.canvas.measureText(a).width:0,l=i+s-h;("none"===e.textWrap?r:[r[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],o=t.x+t.width,!(s===i&&o<l));s--){if(o<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:a,x:o}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,c(n)?(i=n.type,n.color&&(t.decorationColor=Gh.string(n.color)),n.offset&&(s=Math.min(.3*r,Math.max(n.offset,.15*-r)))):i=n,i){case"under":t.decorationY=[.15*r+s];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+s,.35*-r]}}(h,e),h}};const q_={string:function(t,e){if(!t)return"#000";const i=h(e)&&e<1;if(a(t)){if(!i||!Gh.object)return t;t=Gh.object(t)}let s=r(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};return Object.assign(jh,K_),Object.assign(Gh,q_),Object.assign(qh,Lc),Object.assign(Zh,du),Object.assign(Qh,Tu),Object.assign(Jh,Xu),Object.assign(he,{interaction:(t,e,i,s)=>new $d(t,e,i,s),hitCanvas:(t,e)=>new vh(t,e),hitCanvasManager:()=>new ec}),wh(),t.AlignHelper=Rt,t.AroundHelper=Bt,t.AutoBounds=Qt,t.BezierHelper=oi,t.Bounds=qt,t.BoundsEvent=za,t.BoundsHelper=jt,t.BoxData=ul,t.BranchHelper=ma,t.BranchRender=Mo,t.CanvasData=Bl,t.CanvasManager=ge,t.ChildEvent=Ma,t.ColorConvert=Gh,t.Creator=he,t.Cursor=tc,t.DataHelper=_,t.Debug=te,t.DragBoundsHelper=Ld,t.Dragger=Xd,t.Effect=Jh,t.EllipseData=yl,t.EllipseHelper=fi,t.Event=Aa,t.EventCreator=_e,t.Eventer=ro,t.Export=tl,t.FileHelper=Gr,t.Filter=$h,t.FourNumberHelper=S,t.FrameData=pl,t.GroupData=cl,t.HitCanvasManager=ec,t.ImageData=Pl,t.ImageEvent=Na,t.ImageManager=tn,t.IncrementId=x,t.InteractionBase=$d,t.InteractionHelper=Wd,t.Keyboard=yd,t.LayoutEvent=qa,t.Layouter=Ih,t.LeafBounds=Do,t.LeafBoundsHelper=pa,t.LeafData=g,t.LeafDataProxy=mo,t.LeafEventer=fo,t.LeafHelper=aa,t.LeafLayout=Ia,t.LeafLevelList=mh,t.LeafList=yh,t.LeafMatrix=Bo,t.LeafRender=Io,t.LeaferCanvas=vh,t.LeaferCanvasBase=Le,t.LeaferData=_l,t.LeaferEvent=Qa,t.LeaferImage=nn,t.LineData=gl,t.MathHelper=W,t.Matrix=mt,t.MatrixHelper=J,t.MyDragEvent=Ad,t.MyImage=dd,t.MyPointerEvent=Dd,t.MyTouchEvent=Md,t.NeedConvertToCanvasCommandMap=Me,t.OneRadian=U,t.PI2=N,t.PI_2=z,t.Paint=qh,t.PaintGradient=Qh,t.PaintImage=Zh,t.PathArrow=Kh,t.PathBounds=Ir,t.PathCommandDataHelper=Ps,t.PathCommandMap=Ie,t.PathCommandNodeHelper=yi,t.PathConvert=es,t.PathCorner=zr,t.PathCreator=zs,t.PathData=xl,t.PathDrawer=ir,t.PathHelper=Oe,t.PathNumberCommandLengthMap=Ne,t.PathNumberCommandMap=Ue,t.PenData=wl,t.Picker=Nh,t.Platform=m,t.Plugin=oe,t.Point=ft,t.PointHelper=dt,t.PointerButton=md,t.PolygonData=ml,t.PropertyEvent=Fa,t.RectData=fl,t.RectHelper=ze,t.RectRender=Ol,t.RenderEvent=Za,t.Renderer=Mh,t.ResizeEvent=Va,t.Resource=Jr,t.Run=re,t.Selector=zh,t.StarData=vl,t.State=el,t.StringNumberMap=Jt,t.TaskItem=qr,t.TaskProcessor=Zr,t.TextConvert=jh,t.TextData=El,t.Transition=il,t.TwoPointBoundsHelper=xt,t.UIBounds=Rl,t.UICreator=de,t.UIData=ll,t.UIEvent=vd,t.UIRender=Cl,t.UnitConvert=Vh,t.WaitHelper=Pa,t.WatchEvent=Ka,t.Watcher=Eh,t.affectRenderBoundsType=kn,t.affectStrokeBoundsType=En,t.attr=dn,t.autoLayoutType=gn,t.boundsType=mn,t.canvasPatch=jr,t.canvasSizeAttrs=Ce,t.createAttr=function(t){return(e,i)=>{an(e,i,hn(i,t))}},t.createDescriptor=hn,t.cursorType=Wn,t.dataProcessor=Fn,t.dataType=un,t.decorateLeafAttr=ln,t.defineDataProcessor=Un,t.defineKey=an,t.defineLeafAttr=cn,t.dimType=Rn,t.doBoundsType=xn,t.doStrokeType=Pn,t.effectType=Yh,t.emptyData=s,t.eraserType=An,t.extraPropertyEventMap=Ua,t.getBoundsData=X,t.getDescriptor=on,t.getMatrixData=H,t.getPointData=Y,t.hitType=Mn,t.isArray=d,t.isData=function(t){return c(t)&&!d(t)},t.isEmptyData=u,t.isFinite=o,t.isNull=n,t.isNumber=h,t.isObject=c,t.isString=a,t.isUndefined=r,t.layoutProcessor=function(t){return(e,i)=>{an(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=io,t.maskType=In,t.naturalBoundsType=vn,t.opacityType=Tn,t.path=Yr,t.pathInputType=wn,t.pathType=bn,t.pen=Xr,t.positionType=_n,t.registerUI=Vn,t.registerUIEvent=Kn,t.resizeType=Xh,t.rewrite=Xn,t.rewriteAble=Hn,t.rotationType=yn,t.scaleType=fn,t.scrollType=pn,t.sortType=Dn,t.strokeType=Bn,t.surfaceType=Sn,t.tempBounds=Zt,t.tempMatrix=vt,t.tempPoint=yt,t.tryToNumber=function(t){return"string"==typeof t&&l.test(t)?+t:t},t.useCanvas=wh,t.useModule=Gn,t.version="1.12.2",t.visibleType=Cn,t.zoomLayerType=Hh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
2
2
  //# sourceMappingURL=worker.min.js.map