@zzalai/leafer-multi-roi 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/leafer-multi-roi.css +2 -0
- package/dist/leafer-multi-roi.es.js +1 -0
- package/dist/leafer-multi-roi.umd.js +1 -0
- package/dist/src/App.vue.d.ts +3 -0
- package/dist/src/components/RoiEditor.vue.d.ts +98 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/main.d.ts +1 -0
- package/dist/src/types/index.d.ts +33 -0
- package/dist/src/utils/coordinates.d.ts +5 -0
- package/dist/src/utils/icons.d.ts +1 -0
- package/dist/src/utils/uuid.d.ts +1 -0
- package/package.json +61 -60
- package/vite.config.ts +6 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).LeaferMultiRoi={},t.Vue)}(this,function(t,e){var i;Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(i||(i={}));var s={};function r(t){return void 0===t}function o(t){return null==t}function n(t){return"string"==typeof t}var{isFinite:a}=Number;function h(t){return"number"==typeof t}var{isArray:l}=Array;function d(t){return t&&"object"==typeof t}var c,u,p,g={default:(t,e)=>(_(e,t),_(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var o,n;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(o=t[r])||void 0===o?void 0:o.constructor)===Object)return _(t[r],e[r],i&&i[r]);i&&r in i?(null===(n=i[r])||void 0===n?void 0:n.constructor)===Object&&_(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:_}=g,f=class{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(l(t))for(let s of t)i[s]=this.__getInput(s);else for(let s in t)i[s]=this.__getInput(s);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],!r(t))){if("path"===o&&!this.__pathInputed)continue;e=s?s[o]:void 0,i[o]=r(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:o,f:n}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:o,f:n}}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,this.__complexData&&this.__complexData.destroy()}},m={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=y;return e[t]?e[t]++:(e[t]=1,0)}},y=m,{max:v}=Math,w=[0,0,0,0],x={zero:[...w],tempFour:w,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)=>b(w,t,e,i,s),toTempAB(t,e,i){p=i?h(t)?e:t:[],h(t)?(c=E(t),u=e):h(e)?(c=t,u=E(e)):(c=t,u=e),4!==c.length&&(c=k(c)),4!==u.length&&(u=k(u))},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 s=0;s<4;s++)i[s]>e&&(i[s]=e);return i},max:(t,e,i)=>h(t)&&h(e)?v(t,e):(S(t,e,i),b(p,v(c[0],u[0]),v(c[1],u[1]),v(c[2],u[2]),v(c[3],u[3]))),add:(t,e,i)=>h(t)&&h(e)?t+e:(S(t,e,i),b(p,c[0]+u[0],c[1]+u[1],c[2]+u[2],c[3]+u[3])),swapAndScale(t,e,i,s){if(h(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[o,n,a,l]=4===t.length?t:k(t);return b(r,a*i,l*e,o*i,n*e)}},{set:b,get:k,setTemp:E,toTempAB:S}=x,{round:B,pow:T,max:C,floor:O,PI:R}=Math,P={},L={within:(t,e,i)=>(d(e)&&(i=e.max,e=e.min),!r(e)&&t<e&&(t=e),!r(i)&&t>i&&(t=i),t),fourNumber:x.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),L.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:T(10,e);return-0===(t=B(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&&L.assignScale(s,t);return s},getScaleFixedData(t,e,i,s,r){let{scaleX:o,scaleY:n}=t;if((s||e)&&(o<0&&(o=-o),n<0&&(n=-n)),e)if(!0===e)o=n=i?1:1/o;else{let t;h(e)?t=e:"zoom-in"===e&&(t=1),t&&(o=n=o>t||n>t?i?1:1/o:i?1:1/t)}return P.scaleX=o,P.scaleY=n,P},assignScale(t,e){h(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>C(O(t),e)/t,randInt:M,randColor:t=>`rgba(${M(255)},${M(255)},${M(255)},${t||1})`};function M(t){return Math.round(Math.random()*t)}var D=R/180,A=2*R,I=R/2;function W(){return{a:1,b:0,c:0,d:1,e:0,f:0}}var{sin:z,cos:F,acos:N,sqrt:V}=Math,{float:Y}=L,X={};function H(){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})}var U,j,G={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:H(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,o=0,n=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=o,t.f=n},get:W,getWorld:H,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){K.toInnerPoint(t,e,X),K.scaleOfInner(t,X,i,s)},scaleOfInner(t,e,i,s=i){K.translateInner(t,e.x,e.y),K.scale(t,i,s),K.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:o}=t,n=F(e*=D),a=z(e);t.a=i*n-s*a,t.b=i*a+s*n,t.c=r*n-o*a,t.d=r*a+o*n},rotateOfOuter(t,e,i){K.toInnerPoint(t,e,X),K.rotateOfInner(t,X,i)},rotateOfInner(t,e,i){K.translateInner(t,e.x,e.y),K.rotate(t,i),K.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:o,d:n}=t;i&&(i*=D,t.a=s+o*i,t.b=r+n*i),e&&(e*=D,t.c=o+s*e,t.d=n+r*e)},skewOfOuter(t,e,i,s){K.toInnerPoint(t,e,X),K.skewOfInner(t,X,i,s)},skewOfInner(t,e,i,s=0){K.translateInner(t,e.x,e.y),K.skew(t,i,s),K.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:o,e:n,f:a}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*o,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*o,t.e=e.e*i+e.f*r+n,t.f=e.e*s+e.f*o+a},multiplyParent(t,e,i,s,o){const{e:n,f:a}=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:n,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=n*e.a+a*e.c,i.d=n*e.b+a*e.d,o&&(i.scaleX=e.scaleX*o.scaleX,i.scaleY=e.scaleY*o.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,o&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=n*e.a+a*e.c+e.e,i.f=n*e.b+a*e.d+e.f},divide(t,e){K.multiply(t,K.tempInvert(e))},divideParent(t,e){K.multiplyParent(t,K.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=K;return K.copy(e,t),K.invert(e),e},invert(t){const{a:e,b:i,c:s,d:r,e:o,f:n}=t;if(i||s){const a=1/(e*r-i*s);t.a=r*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(o*r-n*s)*a,t.f=-(n*e-o*i)*a}else if(1===e&&1===r)t.e=-o,t.f=-n;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-o*r*i,t.f=-n*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:o}=e;i||(i=e),i.x=r*t.a+o*t.c,i.y=r*t.b+o*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:o,c:n,d:a}=t,h=1/(r*a-o*n),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*n)*h,i.y=(d*r-l*o)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*n)*h,i.y-=(s*r-e*o)*h}},setLayout(t,e,i,s,o){const{x:n,y:a,scaleX:h,scaleY:l}=e;if(r(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:i,skewX:s,skewY:r}=e,o=i*D,n=F(o),a=z(o);if(s||r){const e=s*D,i=r*D;t.a=(n+i*-a)*h,t.b=(a+i*n)*h,t.c=(e*n-a)*l,t.d=(n+e*a)*l}else t.a=n*h,t.b=a*h,t.c=-a*l,t.d=n*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=n,t.f=a,(i=i||s)&&K.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:r,b:o,c:n,d:a,e:h,f:l}=t;let d,c,u,p,g,_=h,f=l;if(o||n){const t=r*a-o*n;if(n&&!s){d=V(r*r+o*o),c=t/d;const e=r/d;u=o>0?N(e):-N(e)}else{c=V(n*n+a*a),d=t/c;const e=n/c;u=I-(a>0?N(-e):-N(e))}const e=Y(F(u)),i=z(u);d=Y(d),c=Y(c),p=e?Y((n/c+i)/e/D,9):0,g=e?Y((o/d-i)/e/D,9):0,u=Y(u/D)}else d=r,c=a,u=p=g=0;return(e=i||e)&&(_+=e.x*r+e.y*n,f+=e.x*o+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:g}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:o,d:n}=t;r||o?i=(s*n-r*o)/(e=V(s*s+r*r)):(e=s,i=n)}return s.scaleX=e,s.scaleY=i,s},reset(t){K.set(t)}},K=G,{float:Z}=L,{toInnerPoint:q,toOuterPoint:$}=G,{sin:J,cos:Q,abs:tt,sqrt:et,atan2:it,min:st,round:rt}=Math,ot={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?rt(t.x-.5)+.5:rt(t.x),t.y=e?rt(t.y-.5)+.5:rt(t.y)},move(t,e,i){d(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=nt.defaultPoint);const s=Q(e*=D),r=J(e),o=t.x-i.x,n=t.y-i.y;t.x=i.x+o*s-n*r,t.y=i.y+o*r+n*s},tempToInnerOf(t,e){const{tempPoint:i}=nt;return ht(i,t),q(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=nt;return ht(i,t),$(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=nt;return ht(i,t),nt.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(ht(t,e),lt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),q(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){q(e,t,i)},toOuterOf(t,e,i){$(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)=>at(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=tt(i-t),o=tt(s-e);return et(r*r+o*o)},getMinDistanceFrom:(t,e,i,s,r,o)=>st(at(t,e,i,s),at(i,s,r,o)),getAngle:(t,e)=>dt(t,e)/D,getRotation:(t,e,i,s)=>(s||(s=e),nt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/D),getRadianFrom(t,e,i,s,o,n,a,h){r(a)&&(a=i,h=s);const l=t-i,d=e-s,c=o-a,u=n-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>it(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,r){const o=dt(t,e);return r&&(t=e),s||(e={}),e.x=t.x+Q(o)*i,e.y=t.y+J(o)*i,e},toNumberPoints(t){let e=t;return d(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e,i)=>i?t.x===e.x&&t.y===e.y:Z(t.x)===Z(e.x)&&Z(t.y)===Z(e.y),reset(t){nt.reset(t)}},nt=ot,{getDistanceFrom:at,copy:ht,setRadius:lt,getAtan2:dt}=nt,ct=class t{constructor(t,e){this.set(t,e)}set(t,e){return d(t)?ot.copy(this,t):ot.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new t(this)}move(t,e){return ot.move(this,t,e),this}scale(t,e){return ot.scale(this,t,e),this}scaleOf(t,e,i){return ot.scaleOf(this,t,e,i),this}rotate(t,e){return ot.rotate(this,t,e),this}rotateOf(t,e){return ot.rotate(this,e,t),this}getRotation(t,e,i){return ot.getRotation(this,t,e,i)}toInnerOf(t,e){return ot.toInnerOf(this,t,e),this}toOuterOf(t,e){return ot.toOuterOf(this,t,e),this}getCenter(e){return new t(ot.getCenter(this,e))}getDistance(t){return ot.getDistance(this,t)}getDistancePoint(e,i,s,r){return new t(ot.getDistancePoint(this,e,i,s,r))}getAngle(t){return ot.getAngle(this,t)}getAtan2(t){return ot.getAtan2(this,t)}isSame(t,e){return ot.isSame(this,t,e)}reset(){return ot.reset(this),this}},ut=(new ct,class t{constructor(t,e,i,s,r,o){this.set(t,e,i,s,r,o)}set(t,e,i,s,r,o){return d(t)?G.copy(this,t):G.set(this,t,e,i,s,r,o),this}setWith(t){return G.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:o}=this;return{a:t,b:e,c:i,d:s,e:r,f:o}}clone(){return new t(this)}translate(t,e){return G.translate(this,t,e),this}translateInner(t,e){return G.translateInner(this,t,e),this}scale(t,e){return G.scale(this,t,e),this}scaleWith(t,e){return G.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return G.pixelScale(this,t),this}scaleOfOuter(t,e,i){return G.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return G.scaleOfInner(this,t,e,i),this}rotate(t){return G.rotate(this,t),this}rotateOfOuter(t,e){return G.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return G.rotateOfInner(this,t,e),this}skew(t,e){return G.skew(this,t,e),this}skewOfOuter(t,e,i){return G.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return G.skewOfInner(this,t,e,i),this}multiply(t){return G.multiply(this,t),this}multiplyParent(t){return G.multiplyParent(this,t),this}divide(t){return G.divide(this,t),this}divideParent(t){return G.divideParent(this,t),this}invert(){return G.invert(this),this}invertWith(){return G.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){G.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){G.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return G.setLayout(this,t,e,i),this}getLayout(t,e,i){return G.getLayout(this,t,e,i)}withScale(t,e){return G.withScale(this,t,e)}reset(){G.reset(this)}}),pt=(new ut,{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){gt(t,e,i),gt(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:gt}=pt;(function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"})(U||(U={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(j||(j={}));var _t=[{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}];_t.forEach(t=>t.type="percent");var ft={directionData:_t,tempPoint:{},get:mt,toPoint(t,e,i,s,r,o){const n=mt(t);i.x=n.x,i.y=n.y,"percent"===n.type&&(i.x*=e.width,i.y*=e.height,r&&(o||(i.x-=r.x,i.y-=r.y),n.x&&(i.x-=1===n.x?r.width:.5===n.x?n.x*r.width:0),n.y&&(i.y-=1===n.y?r.height:.5===n.y?n.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i,s=!0)=>(i||(i={}),ft.toPoint(t,e,i,s),i)};function mt(t){return n(t)?_t[j[t]]:t}var yt,vt,wt,xt,{toPoint:bt}=ft,kt={toPoint(t,e,i,s,r,o){bt(t,i,s,r,e,o)}},{tempPointBounds:Et,setPoint:St,addPoint:Bt,toBounds:Tt}=pt,{toOuterPoint:Ct}=G,{float:Ot,fourNumber:Rt}=L,{floor:Pt,ceil:Lt}=Math,Mt={},Dt={},At={},It={tempBounds:At,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:o,y:n,width:a,height:h}=e;if(l(i)){const e=Rt(i);s?Wt.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):Wt.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Wt.set(t,o-i,n-i,a+2*i,h+2*i);r&&("width"===r?(t.y=n,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Wt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Ft(e,t):e=t,i||(i=t),e.offsetX=Wt.maxX(i),e.offsetY=Wt.maxY(i),Wt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ot.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ot.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Wt.copy(At,t),Wt.toOuterOf(At,e),At),getOuterOf:(t,e)=>(t=Object.assign({},t),Wt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r,e:o,f:n}=e;s>0?(i.width=t.width*s,i.x=o+t.x*s):(i.width=t.width*-s,i.x=o+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=n+t.y*r):(i.height=t.height*-r,i.y=n+t.y*r-i.height)}else Mt.x=t.x,Mt.y=t.y,Ct(e,Mt,Dt),St(Et,Dt.x,Dt.y),Mt.x=t.x+t.width,Ct(e,Mt,Dt),Bt(Et,Dt.x,Dt.y),Mt.y=t.y+t.height,Ct(e,Mt,Dt),Bt(Et,Dt.x,Dt.y),Mt.x=t.x,Ct(e,Mt,Dt),Bt(Et,Dt.x,Dt.y),Tt(Et,i)},toInnerOf(t,e,i){i||(i=t),Wt.move(i,-e.e,-e.f),Wt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Wt.getFitScale(t,e));return new ut(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,o){o||(o=e),n(s)&&(s=Wt.getFitScale(t,e,"cover"===s)),At.width=r?e.width*=s:e.width*s,At.height=r?e.height*=s:e.height*s,kt.toPoint(i,At,t,o,!0,!0)},getSpread(t,e,i){const s={};return Wt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Wt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Wt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Pt(t.x),t.y=Pt(t.y),t.width=e>t.x?Lt(t.width+e-t.x):Lt(t.width),t.height=i>t.y?Lt(t.height+i-t.y):Lt(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){yt=t.x+t.width,vt=t.y+t.height,wt=e.x,xt=e.y,i||(wt+=e.width,xt+=e.height),yt=yt>wt?yt:wt,vt=vt>xt?vt:xt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=yt-t.x,t.height=vt-t.y},addList(t,e){Wt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Wt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Wt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let r,o=!0;for(let n=0,a=e.length;n<a;n++)r=i?i(e[n],n):e[n],r&&(r.width||r.height)&&(o?(o=!1,s||Ft(t,r)):zt(t,r));o&&Wt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?St(Et,t.x,t.y):Bt(Et,t.x,t.y)),Tt(Et,t)},setPoint(t,e){Wt.set(t,e.x,e.y)},addPoint(t,e){zt(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}]},getPoint:(t,e,i=!1,s)=>ft.getPoint(e,t,s,i),hitRadiusPoint:(t,e,i)=>(i&&(e=ot.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=ot.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=Wt.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=Wt.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=Wt.tempToOuterOf(e,i)),!Wt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:o,height:n}=e;return yt=s+o,vt=r+n,wt=t.x+t.width,xt=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,o=(yt=yt<wt?yt:wt)-s,n=(vt=vt<xt?vt:xt)-r,{x:s,y:r,width:o,height:n}},intersect(t,e,i){Wt.copy(t,Wt.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,hasSize:t=>t.width&&t.height,reset(t){Wt.set(t)}},Wt=It,{add:zt,copy:Ft}=Wt,Nt=class t{get minX(){return It.minX(this)}get minY(){return It.minY(this)}get maxX(){return It.maxX(this)}get maxY(){return It.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return d(t)?It.copy(this,t):It.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 t(this)}move(t,e){return It.move(this,t,e),this}scale(t,e,i){return It.scale(this,t,e,i),this}scaleOf(t,e,i){return It.scaleOf(this,t,e,i),this}toOuterOf(t,e){return It.toOuterOf(this,t,e),this}toInnerOf(t,e){return It.toInnerOf(this,t,e),this}getFitMatrix(t,e){return It.getFitMatrix(this,t,e)}put(t,e,i){It.put(this,t,e,i)}spread(t,e){return It.spread(this,t,e),this}shrink(t,e){return It.shrink(this,t,e),this}ceil(){return It.ceil(this),this}unsign(){return It.unsign(this),this}float(t){return It.float(this,t),this}add(t){return It.add(this,t),this}addList(t){return It.setList(this,t,!0),this}setList(t){return It.setList(this,t),this}addListWithFn(t,e){return It.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return It.setListWithFn(this,t,e),this}setPoint(t){return It.setPoint(this,t),this}setPoints(t){return It.setPoints(this,t),this}addPoint(t){return It.addPoint(this,t),this}getPoints(){return It.getPoints(this)}getPoint(t,e,i){return It.getPoint(this,t,e,i)}hitPoint(t,e){return It.hitPoint(this,t,e)}hitRadiusPoint(t,e){return It.hitRadiusPoint(this,t,e)}hit(t,e){return It.hit(this,t,e)}includes(t,e){return It.includes(this,t,e)}intersect(t,e){return It.intersect(this,t,e),this}getIntersect(e,i){return new t(It.getIntersectData(this,e,i))}isSame(t){return It.isSame(this,t)}isEmpty(){return It.isEmpty(this)}reset(){It.reset(this)}},Vt=new Nt,Yt=class{constructor(t,e,i,s,r,o){d(t)?this.copy(t):this.set(t,e,i,s,r,o)}set(t=0,e=0,i=0,s=0,r=0,o=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=o}copy(t){const{top:e,right:i,bottom:s,left:r,width:o,height:n}=t;this.set(e,i,s,r,o,n)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:o,height:n}=this;return new Nt(r,e,o||t.width-r-i,n||t.height-e-s)}},Xt={number:(t,e)=>d(t)?"percent"===t.type?t.value*e:t.value:t},Ht={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},{floor:Ut,max:jt}=Math,Gt={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||Kt.maxCacheSize),isSuperLarge:(t,e,i)=>Kt.isLarge(t,e,i,Kt.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=Kt;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,o,n,a,h,l){const d=jt(Ut(e+(s||0)),1),c=jt(Ut(i+(r||0)),1);let u,p,g;l&&(g=Xt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:p=!0);const _=Gt.origin.createCanvas(p?2*d:d,u?2*c:c),f=_.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==n,Kt.canUse(t)){if(o){const s=e/o.width,r=i/o.height;f.setTransform(s,0,0,r,-o.x*s,-o.y*r),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);g&&(f.drawImage(_,0,0,d,c,u?g-d:d,u?c:g-c,d,c),f.drawImage(_,0,0,d,c,u?g:d,u?c:g,d,c))}return _},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&g.stintSet(i,"transform",e)}}},{image:Kt}=Gt,{randColor:Zt}=L,qt=class t{constructor(t){this.repeatMap={},this.name=t}static get(e){return new t(e)}static set filter(t){this.filterList=$t(t)}static set exclude(t){this.excludeList=$t(t)}static drawRepaint(t,e){const i=Zt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(e,i,s){const r="hit"===t.showBounds,o=e.__nowWorld,n=Zt();r&&(i.setWorld(o),e.__drawHitPath(i),i.fillStyle=n.replace("1)",".2)"),i.fill()),i.resetTransform(),i.setStroke(n,2),r?i.stroke():i.strokeWorld(o,n)}log(...t){if(Jt.enable){if(Jt.filterList.length&&Jt.filterList.every(t=>t!==this.name))return;if(Jt.excludeList.length&&Jt.excludeList.some(t=>t===this.name))return}}tip(...t){Jt.enable&&this.warn(...t)}warn(...t){Jt.showWarn}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(s){}}};function $t(t){return t?n(t)&&(t=[t]):t=[],t}qt.filterList=[],qt.excludeList=[],qt.showWarn=!0;var Jt=qt,Qt=qt.get("RunTime"),te={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=m.create(m.RUNTIME);return ee.currentId=ee.idMap[i]=e?performance.now():Date.now(),ee.currentName=ee.nameMap[i]=t,ee.nameToIdMap[t]=i,i},end(t,e){const i=ee.idMap[t],s=ee.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;ee.idMap[t]=ee.nameMap[t]=ee.nameToIdMap[s]=void 0,Qt.log(s,r,"ms")},endOfName(t,e){const i=ee.nameToIdMap[t];r(i)||ee.end(i,e)}},ee=te,ie=[],se={list:{},add(t,...e){this.list[t]=!0,ie.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){}};setTimeout(()=>ie.forEach(t=>se.has(t,!0)));var re={editor:t=>se.need("editor")},oe=qt.get("UICreator"),ne={list:{},register(t){const{__tag:e}=t.prototype;ae[e]&&oe.repeat(e),ae[e]=t},get(t,e,i,s,o,n){if(!ae[t])return void oe.warn("not register "+t);const a=new ae[t](e);return r(i)||(a.x=i,s&&(a.y=s),o&&(a.width=o),n&&(a.height=n)),a}},{list:ae}=ne,he=qt.get("EventCreator"),le={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],n(e)&&(de[e]&&he.repeat(e),de[e]=t)})},changeName(t,e){const i=de[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,de[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new de[t](...e)},{nameList:de}=le,ce=class{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let r=0,o=i.length;r<o;r++)if(e=i[r],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=re.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 ue(t,e,i,s){var r,o=arguments.length,n=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,i,n):r(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n}function pe(t,e,i,s){return new(i||(i=Promise))(function(r,o){function n(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(n,a)}h((s=s.apply(t,e||[])).next())})}function ge(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)}}var _e=[];function fe(){return(t,e)=>{_e.push(e)}}var me=[],ye=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||me)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;_e.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,o){d(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,o+=t,a-=t}if(i<0){const t=-i/r*h;r+=i,i=0,n+=t,h-=t}this.context.drawImage(t,e,i,s,r,o,n,a,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,o){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,o){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,o,n,a){}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,o){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};ue([ge("imageSmoothingEnabled")],ye.prototype,"smooth",void 0),ue([ge("imageSmoothingQuality")],ye.prototype,"smoothLevel",void 0),ue([ge("globalAlpha")],ye.prototype,"opacity",void 0),ue([ge()],ye.prototype,"fillStyle",void 0),ue([ge()],ye.prototype,"strokeStyle",void 0),ue([ge("lineWidth")],ye.prototype,"strokeWidth",void 0),ue([ge("lineCap")],ye.prototype,"strokeCap",void 0),ue([ge("lineJoin")],ye.prototype,"strokeJoin",void 0),ue([ge("lineDashOffset")],ye.prototype,"dashOffset",void 0),ue([ge()],ye.prototype,"miterLimit",void 0),ue([ge()],ye.prototype,"shadowBlur",void 0),ue([ge()],ye.prototype,"shadowColor",void 0),ue([ge()],ye.prototype,"shadowOffsetX",void 0),ue([ge()],ye.prototype,"shadowOffsetY",void 0),ue([ge()],ye.prototype,"filter",void 0),ue([ge()],ye.prototype,"font",void 0),ue([ge()],ye.prototype,"fontKerning",void 0),ue([ge()],ye.prototype,"fontStretch",void 0),ue([ge()],ye.prototype,"fontVariantCaps",void 0),ue([ge()],ye.prototype,"textAlign",void 0),ue([ge()],ye.prototype,"textBaseline",void 0),ue([ge()],ye.prototype,"textRendering",void 0),ue([ge()],ye.prototype,"wordSpacing",void 0),ue([ge()],ye.prototype,"letterSpacing",void 0),ue([ge()],ye.prototype,"direction",void 0),ue([fe()],ye.prototype,"setTransform",null),ue([fe()],ye.prototype,"resetTransform",null),ue([fe()],ye.prototype,"getTransform",null),ue([fe()],ye.prototype,"save",null),ue([fe()],ye.prototype,"restore",null),ue([fe()],ye.prototype,"translate",null),ue([fe()],ye.prototype,"scale",null),ue([fe()],ye.prototype,"rotate",null),ue([fe()],ye.prototype,"fill",null),ue([fe()],ye.prototype,"stroke",null),ue([fe()],ye.prototype,"clip",null),ue([fe()],ye.prototype,"fillRect",null),ue([fe()],ye.prototype,"strokeRect",null),ue([fe()],ye.prototype,"clearRect",null),ue([fe()],ye.prototype,"beginPath",null),ue([fe()],ye.prototype,"moveTo",null),ue([fe()],ye.prototype,"lineTo",null),ue([fe()],ye.prototype,"bezierCurveTo",null),ue([fe()],ye.prototype,"quadraticCurveTo",null),ue([fe()],ye.prototype,"closePath",null),ue([fe()],ye.prototype,"arc",null),ue([fe()],ye.prototype,"arcTo",null),ue([fe()],ye.prototype,"ellipse",null),ue([fe()],ye.prototype,"rect",null),ue([fe()],ye.prototype,"roundRect",null),ue([fe()],ye.prototype,"createConicGradient",null),ue([fe()],ye.prototype,"createLinearGradient",null),ue([fe()],ye.prototype,"createPattern",null),ue([fe()],ye.prototype,"createRadialGradient",null),ue([fe()],ye.prototype,"fillText",null),ue([fe()],ye.prototype,"measureText",null),ue([fe()],ye.prototype,"strokeText",null);var{copy:ve,multiplyParent:we,pixelScale:xe}=G,{round:be}=Math,ke=new Nt,Ee=new Nt,Se={width:1,height:1,pixelRatio:1},Be=["width","height","pixelRatio"],Te=class extends ye{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=m.create(m.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||Gt.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;g.copyAttrs(s,t,Be),Be.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Nt(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&&we(t,e,r),xe(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=be(r.e-.5)+.5,r.f=be(r.f-.5)+.5):(r.e=be(r.e),r.f=be(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:o,dashOffset:n,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),r(e.dashPattern)||(o=e.dashPattern),r(e.dashOffset)||(n=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=o,this.dashOffset=n,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio: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=Ee):i=ke,this.drawImage(t.view,ke.x,ke.y,ke.width,ke.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,It.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),this.drawImage(t.view,ke.x,ke.y,ke.width,ke.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,r,o){this.resetTransform(),this.copyWorld(t,e,i,s,o),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(ke.x,ke.y,ke.width,ke.height),{data:o}=r;for(let n=0,a=o.length;n<a;n+=4)i=.299*o[n]+.587*o[n+1]+.114*o[n+2],(e=o[n+3])&&(o[n+3]=255===e?i:e*(i/255));s.putImageData(r,ke.x,ke.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(ke.x,ke.y,ke.width,ke.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(ke.x,ke.y,ke.width,ke.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(ke.x,ke.y,ke.width,ke.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(ke.x,ke.y,ke.width,ke.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(ke,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Ee,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):re.canvas(Object.assign({},i));return r.save(),t&&(ve(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}},Ce={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Oe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Re=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Oe),Pe={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},Le={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Me=Object.assign(Object.assign({},Le),Oe),De=Re,Ae={};for(let Xf in De)Ae[De[Xf]]=Xf;var Ie={};for(let Xf in De)Ie[De[Xf]]=Pe[Xf];var We,ze,Fe,Ne={drawRoundRect(t,e,i,s,r,o){const n=L.fourNumber(o,Math.min(s/2,r/2)),a=e+s,h=i+r;n[0]?t.moveTo(e+n[0],i):t.moveTo(e,i),n[1]?t.arcTo(a,i,a,h,n[1]):t.lineTo(a,i),n[2]?t.arcTo(a,h,e,h,n[2]):t.lineTo(a,h),n[3]?t.arcTo(e,h,e,i,n[3]):t.lineTo(e,h),n[0]?t.arcTo(e,i,a,i,n[0]):t.lineTo(e,i)}},{sin:Ve,cos:Ye,hypot:Xe,atan2:He,ceil:Ue,abs:je,PI:Ge,sqrt:Ke,pow:Ze}=Math,{setPoint:qe,addPoint:$e}=pt,{set:Je,toNumberPoints:Qe}=ot,{M:ti,L:ei,C:ii,Q:si,Z:ri}=Re,oi={},ni={points(t,e,i,s){let r=Qe(e);if(t.push(ti,r[0],r[1]),i&&r.length>5){let e,o,n,a,h,l,d,c,u,p,g,_,f,m,y,v=r.length;const w=!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],o=r[i-1],n=r[i],a=r[i+1],h=r[i+2],l=r[i+3],g=n-e,_=a-o,f=Ke(Ze(g,2)+Ze(_,2)),m=Ke(Ze(h-n,2)+Ze(l-a,2)),(f||m)&&(y=f+m,f=w*f/y,m=w*m/y,h-=e,l-=o,d=n-f*h,c=a-f*l,2===i?s||t.push(si,d,c,n,a):(g||_)&&t.push(ii,u,p,d,c,n,a),u=n+m*h,p=a+m*l);s||t.push(si,u,p,r[v-2],r[v-1])}else for(let o=2,n=r.length;o<n;o+=2)t.push(ei,r[o],r[o+1]);s&&t.push(ri)},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,o){Ce.creator.path=[],Ne.drawRoundRect(Ce.creator,e,i,s,r,o),t.push(...Ce.convertToCanvasData(Ce.creator.path,!0))},arcTo(t,e,i,s,r,o,n,a,h,l,d){const c=s-e,u=r-i,p=o-s,g=n-r;let _=He(u,c),f=He(g,p);const m=Xe(c,u),y=Xe(p,g);let v=f-_;if(v<0&&(v+=A),m<1e-12||y<1e-12||v<1e-12||je(v-Ge)<1e-12)return t&&t.push(ei,s,r),h&&(qe(h,e,i),$e(h,s,r)),d&&Je(d,e,i),void(l&&Je(l,s,r));const w=c*g-p*u<0,x=w?-1:1,b=a/Ye(v/2),k=s+b*Ye(_+v/2+I*x),E=r+b*Ve(_+v/2+I*x);return _-=I*x,f-=I*x,li(t,k,E,a,a,0,_/D,f/D,w,h,l,d)},arc:(t,e,i,s,r,o,n,a,h,l)=>li(t,e,i,s,s,0,r,o,n,a,h,l),ellipse(t,e,i,s,r,o,n,a,h,l,d,c){const u=o*D,p=Ve(u),g=Ye(u);let _=n*D,f=a*D;_>Ge&&(_-=A),f<0&&(f+=A);let m=f-_;m<0?m+=A:m>A&&(m-=A),h&&(m-=A);const y=Ue(je(m/I)),v=m/y,w=Ve(v/4),x=8/3*w*w/Ve(v/2);f=_+v;let b,k,E,S,B,T,C,O,R=Ye(_),P=Ve(_),L=E=g*s*R-p*r*P,M=S=p*s*R+g*r*P,W=e+E,z=i+S;t&&t.push(t.length?ei:ti,W,z),l&&qe(l,W,z),c&&Je(c,W,z);for(let D=0;D<y;D++)b=Ye(f),k=Ve(f),E=g*s*b-p*r*k,S=p*s*b+g*r*k,B=e+L-x*(g*s*P+p*r*R),T=i+M-x*(p*s*P-g*r*R),C=e+E+x*(g*s*k+p*r*b),O=i+S+x*(p*s*k-g*r*b),t&&t.push(ii,B,T,C,O,e+E,i+S),l&&hi(e+L,i+M,B,T,C,O,e+E,i+S,l,!0),L=E,M=S,R=b,P=k,_=f,f+=v;d&&Je(d,e+E,i+S)},quadraticCurveTo(t,e,i,s,r,o,n){t.push(ii,(e+2*s)/3,(i+2*r)/3,(o+2*s)/3,(n+2*r)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,o,n,a){hi(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(o+2*s)/3,r,o,n,a)},toTwoPointBounds(t,e,i,s,r,o,n,a,h,l){const d=[];let c,u,p,g,_,f,m,y,v=t,w=i,x=r,b=n;for(let k=0;k<2;++k)if(1==k&&(v=e,w=s,x=o,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,p=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;g=-p/u,0<g&&g<1&&d.push(g)}else m=u*u-4*p*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?$e(h,t,e):qe(h,t,e),$e(h,n,a);for(let k=0,E=d.length;k<E;k++)ai(d[k],t,e,i,s,r,o,n,a,oi),$e(h,oi.x,oi.y)},getPointAndSet(t,e,i,s,r,o,n,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,g=t*t*t;l.x=c*e+u*s+p*o+g*a,l.y=c*i+u*r+p*n+g*h},getPoint(t,e,i,s,r,o,n,a,h){const l={};return ai(t,e,i,s,r,o,n,a,h,l),l},getDerivative(t,e,i,s,r){const o=1-t;return 3*o*o*(i-e)+6*o*t*(s-i)+3*t*t*(r-s)},cut(t,e,i,s,r,o,n,a,h){if(t<=0)return{left:null,right:[s,r,o,n,a,h]};if(t>=1)return{left:[s,r,o,n,a,h],right:null};const l=1-t,d=e*l+s*t,c=i*l+r*t,u=s*l+o*t,p=r*l+n*t,g=o*l+a*t,_=n*l+h*t,f=d*l+u*t,m=c*l+p*t,y=u*l+g*t,v=p*l+_*t;return{left:[d,c,f,m,f*l+y*t,m*l+v*t],right:[y,v,g,_,a,h]}}},{getPointAndSet:ai,toTwoPointBounds:hi,ellipse:li}=ni,{sin:di,cos:ci,sqrt:ui,atan2:pi}=Math,{ellipse:gi}=ni,_i={ellipticalArc(t,e,i,s,r,o,n,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,p=o*D,g=di(p),_=ci(p),f=-_*c-g*u,m=-_*u+g*c,y=s*s,v=r*r,w=m*m,x=f*f,b=y*v-y*w-v*x;let k=0;if(b<0){const t=ui(1-b/(y*v));s*=t,r*=t}else k=(n===a?-1:1)*ui(b/(y*w+v*x));const E=k*s*m/r,S=-k*r*f/s,B=pi((m-S)/r,(f-E)/s),T=pi((-m-S)/r,(-f-E)/s);let C=T-B;0===a&&C>0?C-=A:1===a&&C<0&&(C+=A);const O=e+c+_*E-g*S,R=i+u+g*E+_*S,P=C<0?1:0;d||Gt.ellipseToCurve?gi(t,O,R,s,r,o,B/D,T/D,P):s!==r||o?t.push(Re.G,O,R,s,r,o,B/D,T/D,P):t.push(Re.O,O,R,s,B/D,T/D,P)}},fi=t=>[],{M:mi,m:yi,L:vi,l:wi,H:xi,h:bi,V:ki,v:Ei,C:Si,c:Bi,S:Ti,s:Ci,Q:Oi,q:Ri,T:Pi,t:Li,A:Mi,a:Di,Z:Ai,z:Ii,N:Wi,D:zi,X:Fi,G:Ni,F:Vi,O:Yi,P:Xi,U:Hi}=Re,{rect:Ui,roundRect:ji,arcTo:Gi,arc:Ki,ellipse:Zi,quadraticCurveTo:qi}=ni,{ellipticalArc:$i}=_i,Ji=qt.get("PathConvert"),Qi={},ts={current:{dot:0},stringify(t,e){let i,s,r,o=0,n=t.length,a="";for(;o<n;){s=t[o],i=Ie[s],a+=s===r?" ":Ae[s];for(let s=1;s<i;s++)a+=L.float(t[o+s],e),s===i-1||(a+=" ");r=s,o+=i}return a},parse(t,e){let i,s,r,o="";const n=[],a=e?Me:Le;for(let h=0,l=t.length;h<l;h++)s=t[h],Ht[s]?("."===s&&(es.dot&&(is(n,o),o=""),es.dot++),"0"===o&&"."!==s&&(is(n,o),o=""),o+=s):Re[s]?(o&&(is(n,o),o=""),es.name=Re[s],es.length=Pe[s],es.index=0,is(n,es.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?o+=s:(o&&is(n,o),o=s):o&&(is(n,o),o=""),r=s;return o&&is(n,o),i?ts.toCanvasData(n,e):n},toCanvasData(t,e){let i,s,r,o,n,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(r=t[c],r){case yi:t[c+1]+=a,t[c+2]+=h;case mi:a=t[c+1],h=t[c+2],p.push(mi,a,h),c+=3;break;case bi:t[c+1]+=a;case xi:a=t[c+1],p.push(vi,a,h),c+=2;break;case Ei:t[c+1]+=h;case ki:h=t[c+1],p.push(vi,a,h),c+=2;break;case wi:t[c+1]+=a,t[c+2]+=h;case vi:a=t[c+1],h=t[c+2],p.push(vi,a,h),c+=3;break;case Ci:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Ti;case Ti:n=o===Si||o===Ti,l=n?2*a-i:t[c+1],d=n?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(Si,l,d,i,s,a,h),c+=5;break;case Bi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=Si;case Si:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(Si,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Li:t[c+1]+=a,t[c+2]+=h,r=Pi;case Pi:n=o===Oi||o===Pi,i=n?2*a-i:t[c+1],s=n?2*h-s:t[c+2],e?qi(p,a,h,i,s,t[c+1],t[c+2]):p.push(Oi,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Ri:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Oi;case Oi:i=t[c+1],s=t[c+2],e?qi(p,a,h,i,s,t[c+3],t[c+4]):p.push(Oi,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Di:t[c+6]+=a,t[c+7]+=h;case Mi:$i(p,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Ii:case Ai:p.push(Ai),c++;break;case Wi:a=t[c+1],h=t[c+2],e?Ui(p,a,h,t[c+3],t[c+4]):ss(p,t,c,5),c+=5;break;case zi:a=t[c+1],h=t[c+2],e?ji(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ss(p,t,c,9),c+=9;break;case Fi:a=t[c+1],h=t[c+2],e?ji(p,a,h,t[c+3],t[c+4],t[c+5]):ss(p,t,c,6),c+=6;break;case Ni:Zi(e?p:ss(p,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Qi),a=Qi.x,h=Qi.y,c+=9;break;case Vi:e?Zi(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ss(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Yi:Ki(e?p:ss(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Qi),a=Qi.x,h=Qi.y,c+=7;break;case Xi:e?Ki(p,t[c+1],t[c+2],t[c+3],0,360,!1):ss(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Hi:Gi(e?p:ss(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Qi),a=Qi.x,h=Qi.y,c+=6;break;default:return Ji.error(`command: ${r} [index:${c}]`,t),p}o=r}return p},objectToCanvasData(t){if(t[0].name.length>1)return fi(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(mi,t.x,t.y);break;case"L":e.push(vi,t.x,t.y);break;case"C":e.push(Si,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Oi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ai)}}),e}},copyData(t,e,i,s){for(let r=i,o=i+s;r<o;r++)t.push(e[r])},pushData(t,e){es.index===es.length&&(es.index=1,t.push(es.name)),t.push(Number(e)),es.index++,es.dot=0}},{current:es,pushData:is,copyData:ss}=ts,{M:rs,L:os,C:ns,Q:as,Z:hs,N:ls,D:ds,X:cs,G:us,F:ps,O:gs,P:_s,U:fs}=Re,{getMinDistanceFrom:ms,getRadianFrom:ys}=ot,{tan:vs,min:ws,abs:xs}=Math,bs={},ks={beginPath(t){t.length=0},moveTo(t,e,i){t.push(rs,e,i)},lineTo(t,e,i){t.push(os,e,i)},bezierCurveTo(t,e,i,s,r,o,n){t.push(ns,e,i,s,r,o,n)},quadraticCurveTo(t,e,i,s,r){t.push(as,e,i,s,r)},closePath(t){t.push(hs)},rect(t,e,i,s,r){t.push(ls,e,i,s,r)},roundRect(t,e,i,s,r,o){if(h(o))t.push(cs,e,i,s,r,o);else{const n=L.fourNumber(o);n?t.push(ds,e,i,s,r,...n):t.push(ls,e,i,s,r)}},ellipse(t,e,i,s,r,n,a,h,l){if(s===r)return Ss(t,e,i,s,a,h,l);o(n)?t.push(ps,e,i,s,r):(o(a)&&(a=0),o(h)&&(h=360),t.push(us,e,i,s,r,n,a,h,l?1:0))},arc(t,e,i,s,r,n,a){o(r)?t.push(_s,e,i,s):(o(r)&&(r=0),o(n)&&(n=360),t.push(gs,e,i,s,r,n,a?1:0))},arcTo(t,e,i,s,o,n,a,h,l){if(!r(a)){const t=ms(a,h,e,i,s,o)/(l?1:2);n=ws(n,ws(t,t*xs(vs(ys(a,h,e,i,s,o)/2))))}t.push(fs,e,i,s,o,n)},drawEllipse(t,e,i,s,r,n,a,h,l){ni.ellipse(null,e,i,s,r,o(n)?0:n,o(a)?0:a,o(h)?360:h,l,null,null,bs),t.push(rs,bs.x,bs.y),Es(t,e,i,s,r,n,a,h,l)},drawArc(t,e,i,s,r,n,a){ni.arc(null,e,i,s,o(r)?0:r,o(n)?360:n,a,null,null,bs),t.push(rs,bs.x,bs.y),Ss(t,e,i,s,r,n,a)},drawPoints(t,e,i,s){ni.points(t,e,i,s)}},{ellipse:Es,arc:Ss}=ks,{moveTo:Bs,lineTo:Ts,quadraticCurveTo:Cs,bezierCurveTo:Os,closePath:Rs,beginPath:Ps,rect:Ls,roundRect:Ms,ellipse:Ds,arc:As,arcTo:Is,drawEllipse:Ws,drawArc:zs,drawPoints:Fs}=ks,Ns=class{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?n(t)?Ce.parse(t):t:[],this}beginPath(){return Ps(this.__path),this.paint(),this}moveTo(t,e){return Bs(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ts(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,o){return Os(this.__path,t,e,i,s,r,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return Cs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Rs(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 Ms(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,o,n,a){return Ds(this.__path,t,e,i,s,r,o,n,a),this.paint(),this}arc(t,e,i,s,r,o){return As(this.__path,t,e,i,s,r,o),this.paint(),this}arcTo(t,e,i,s,r){return Is(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,o,n,a){return Ws(this.__path,t,e,i,s,r,o,n,a),this.paint(),this}drawArc(t,e,i,s,r,o){return zs(this.__path,t,e,i,s,r,o),this.paint(),this}drawPoints(t,e,i){return Fs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}},{M:Vs,L:Ys,C:Xs,Q:Hs,Z:Us,N:js,D:Gs,X:Ks,G:Zs,F:qs,O:$s,P:Js,U:Qs}=Re,tr=qt.get("PathDrawer"),er={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Vs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Ys:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Xs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Hs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Us: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 Ks: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]*D,e[s+6]*D,e[s+7]*D,e[s+8]),s+=9;break;case qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,A,!1),s+=5;break;case $s:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*D,e[s+5]*D,e[s+6]),s+=7;break;case Js:t.arc(e[s+1],e[s+2],e[s+3],0,A,!1),s+=4;break;case Qs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void tr.error(`command: ${i} [index:${s}]`,e)}}},{M:ir,L:sr,C:rr,Q:or,Z:nr,N:ar,D:hr,X:lr,G:dr,F:cr,O:ur,P:pr,U:gr}=Re,{toTwoPointBounds:_r,toTwoPointBoundsByQuadraticCurve:fr,arcTo:mr,arc:yr,ellipse:vr}=ni,{addPointBounds:wr,copy:xr,addPoint:br,setPoint:kr,addBounds:Er,toBounds:Sr}=pt,Br=qt.get("PathBounds"),Tr={},Cr={},Or={},Rr={toBounds(t,e){Rr.toTwoPointBounds(t,Cr),Sr(Cr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return kr(e,0,0);let i,s,r,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===nr||n===rr||n===or?kr(e,h,l):kr(e,t[a+1],t[a+2])),n){case ir:case sr:h=t[a+1],l=t[a+2],br(e,h,l),a+=3;break;case rr:r=t[a+5],o=t[a+6],_r(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,o,Tr),wr(e,Tr),h=r,l=o,a+=7;break;case or:i=t[a+1],s=t[a+2],r=t[a+3],o=t[a+4],fr(h,l,i,s,r,o,Tr),wr(e,Tr),h=r,l=o,a+=5;break;case nr:a+=1;break;case ar:h=t[a+1],l=t[a+2],Er(e,h,l,t[a+3],t[a+4]),a+=5;break;case hr:case lr:h=t[a+1],l=t[a+2],Er(e,h,l,t[a+3],t[a+4]),a+=n===hr?9:6;break;case dr:vr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],Tr,Or),0===a?xr(e,Tr):wr(e,Tr),h=Or.x,l=Or.y,a+=9;break;case cr:h=t[a+1],l=t[a+2],ze=t[a+3],Fe=t[a+4],Er(e,h-ze,l-Fe,2*ze,2*Fe),h+=ze,a+=5;break;case ur:yr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Tr,Or),0===a?xr(e,Tr):wr(e,Tr),h=Or.x,l=Or.y,a+=7;break;case pr:h=t[a+1],l=t[a+2],We=t[a+3],Er(e,h-We,l-We,2*We,2*We),h+=We,a+=4;break;case gr:mr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Tr,Or),0===a?xr(e,Tr):wr(e,Tr),h=Or.x,l=Or.y,a+=6;break;default:return void Br.error(`command: ${n} [index:${a}]`,t)}}},{M:Pr,L:Lr,Z:Mr}=Re,{getCenterX:Dr,getCenterY:Ar}=ot,{arcTo:Ir}=ks,Wr={smooth(t,e,i){let s,r,o,n=0,a=0,h=0,d=0,c=0,u=0,p=0,g=0,_=0;l(e)&&(e=e[0]||0);const f=t.length,m=9===f,y=[];for(;n<f;){switch(s=t[n],s){case Pr:d=g=t[n+1],c=_=t[n+2],n+=3,t[n]===Lr?(u=t[n+1],p=t[n+2],m?y.push(Pr,d,c):y.push(Pr,Dr(d,u),Ar(c,p))):y.push(Pr,d,c);break;case Lr:switch(a=t[n+1],h=t[n+2],n+=3,t[n]){case Lr:Ir(y,a,h,t[n+1],t[n+2],e,g,_,m);break;case Mr:Ir(y,a,h,d,c,e,g,_,m);break;default:y.push(Lr,a,h)}g=a,_=h;break;case Mr:r!==Mr&&(Ir(y,d,c,u,p,e,g,_,m),y.push(Mr)),n+=1;break;default:o=Ie[s];for(let e=0;e<o;e++)y.push(t[n+e]);n+=o}r=s}return s!==Mr&&(y[1]=d,y[2]=c),y}};function zr(t){return new Ns(t)}var Fr=zr();Ce.creator=zr(),Ce.parse=ts.parse,Ce.convertToCanvasData=ts.toCanvasData;var{drawRoundRect:Nr}=Ne;function Vr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){Nr(this,t,e,i,s,r)})}(t)}var Yr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mimeType:(t,e="image")=>!t||t.startsWith(e)?t:("jpg"===t&&(t="jpeg"),e+"/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Xr.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{}}}},Xr=Yr;Xr.mineType=Xr.mimeType,Xr.alphaPixelTypes.forEach(t=>Xr.upperCaseTypeMap[t]=t.toUpperCase());var Hr=qt.get("TaskProcessor"),Ur=class{constructor(t){this.parallel=!0,this.time=1,this.id=m.create(m.TASK),this.task=t}run(){return pe(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(i){Hr.error(i)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}},jr=class{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&&g.assign(this.config,t),this.empty()}add(t,e,i){let s,o,n,a;const l=new Ur(t);return l.parent=this,h(e)?a=e:e&&(o=e.parallel,s=e.start,n=e.time,a=e.delay,i||(i=e.canUse)),n&&(l.time=n),!1===o&&(l.parallel=!1),i&&(l.canUse=i),r(a)?this.push(l,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,s))},a)),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.run()}),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 o=s;o<r&&(t=i[o],t.parallel);o++)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()}},Gr=qt.get("Resource"),Kr={tasker:new jr,queue:new jr({parallel:1}),map:{},get isComplete(){return Zr.tasker.isComplete},set(t,e){Zr.map[t]&&Gr.repeat(t),Zr.map[t]=e},get:t=>Zr.map[t],remove(t){const e=Zr.map[t];e&&(e.destroy&&e.destroy(),delete Zr.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 n(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=re.image(s)),Zr.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){Zr.map={}}},Zr=Kr,qr={maxRecycled:10,recycledList:[],patternTasker:Kr.queue,get(t,e){let i=Kr.get(t.url);return i||Kr.set(t.url,i="film"===e?re.film(t):re.image(t)),i.use++,i},recycle(t){t.parent&&(t=t.parent),t.use--,setTimeout(()=>{t.use||(Gt.image.isLarge(t)?t.url&&Kr.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&&Kr.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>Yr.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:"+Yr.mimeType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Yr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},$r=qr,{IMAGE:Jr,create:Qr}=m,to=class{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return r(t)?Gt.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Qr(Jr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}qr.isFormat("svg",t)&&(this.isSVG=!0),qr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,Kr.tasker.add(()=>pe(this,void 0,void 0,function*(){return yield Gt.origin["load"+this.tag](this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),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||(this.width=t.width,this.height=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,o,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 h=Gt.image.resize(this.view,t,e,r,o,void 0,n,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const r=Gt.canvas.createPattern(t,e);return Gt.image.setPatternTransform(r,i,s),r}render(t,e,i,s,r,o,n,a,h){t.drawImage(this.view,e,i,s,r)}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroyFilter(){}destroy(){this.clearLevels(),this.destroyFilter();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}};function eo(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function io(t,e){return Object.getOwnPropertyDescriptor(t,e)}function so(t,e){return(i,s)=>function(t,e,i,s){eo(t,e,Object.assign({get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}},s||{})),ko(t,e,i)}(i,s,t,e&&e(s))}function ro(t){return so(t)}function oo(t,e){return so(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function no(t,e){return so(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function ao(t){return so(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),uo(this))}}))}function ho(t,e){return so(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function lo(t,e){return so(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function co(t,e){return so(t,t=>({set(i){this.__setAttr(t,i,e)&&uo(this)}}))}function uo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}var po=co;function go(t,e){return so(t,t=>({set(i){this.__setAttr(t,i)&&(function(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&uo(t)}(this),e&&(this.__.__useStroke=!0))}}))}var _o=go;function fo(t){return so(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function mo(t){return so(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function yo(t){return so(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;g.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip)}}}))}function vo(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function wo(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||uo(t))}function xo(t){return so(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,this.leafer&&this.leafer.updateCursor())}}))}function bo(t){return(e,i)=>{eo(e,"__DataProcessor",{get:()=>t})}}function ko(t,e,i){const s=t.__DataProcessor.prototype,o="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=function(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}(e,i);if(r(i))a.get=function(){return this[o]};else if("function"==typeof i)a.get=function(){const t=this[o];return null==t?i(this.__leaf):t};else if(d(i)){const t=function(t){return"{}"===JSON.stringify(t)}(i);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:g.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];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&&(a.get=function(){const t=this[o];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,c=s;for(;!l&&c;)l=io(c,e),c=c.__proto__;l&&l.set&&(a.set=l.set),s[n]&&(a.set=s[n],delete s[n]),eo(s,e,a)}var Eo=new qt("rewrite"),So=[],Bo=["destroy","constructor"];function To(t){return(e,i)=>{So.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Co(){return t=>{Oo()}}function Oo(t){So.length&&(So.forEach(e=>{t&&Eo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),So.length=0)}function Ro(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{Bo.includes(s)||e&&e.includes(s)||(t.prototype?io(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s]):i.prototype[s]=t[s])})}}function Po(){return t=>{ne.register(t)}}function Lo(){return t=>{le.register(t)}}setTimeout(()=>Oo(!0));var{copy:Mo,toInnerPoint:Do,toOuterPoint:Ao,scaleOfOuter:Io,rotateOfOuter:Wo,skewOfOuter:zo,multiplyParent:Fo,divideParent:No,getLayout:Vo}=G,Yo={},{round:Xo}=Math,Ho={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Go(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)jo(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++)Ko(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Ko(t),t.__updateChange(),e.surfaceChanged&&(t.__hasComplex&&Uo.updateComplex(t),e.surfaceChanged=!1)},updateAllChange(t){if(qo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Zo(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,o){s||(s=t.__nowWorld),t.__worldFlipped||Gt.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,r,o):e.copyWorldToInner(i,s,t.__layout.renderBounds,r)},renderComplex(t,e,i){},updateComplex(t){},checkComplex(t){},moveWorld(t,e,i=0,s,r){const o=d(e)?Object.assign({},e):{x:e,y:i};s?Ao(t.localTransform,o,o,!0):t.parent&&Do(t.parent.scrollWorldTransform,o,o,!0),Uo.moveLocal(t,o.x,o.y,r)},moveLocal(t,e,i=0,s){d(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Xo(e),i=Xo(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,o){Uo.zoomOfLocal(t,$o(t,e),i,s,r,o)},zoomOfLocal(t,e,i,s=i,r,o){const n=t.__localMatrix;if(h(s)||(s&&(o=s),s=i),Mo(Yo,n),Io(Yo,e,i,s),Uo.hasHighPosition(t))Uo.setTransform(t,Yo,r,o);else{const e=t.x+Yo.e-n.e,a=t.y+Yo.f-n.f;o&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){Uo.rotateOfLocal(t,$o(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;Mo(Yo,r),Wo(Yo,e,i),Uo.hasHighPosition(t)?Uo.setTransform(t,Yo,!1,s):t.set({x:t.x+Yo.e-r.e,y:t.y+Yo.f-r.f,rotation:L.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,o){Uo.skewOfLocal(t,$o(t,e),i,s,r,o)},skewOfLocal(t,e,i,s=0,r,o){Mo(Yo,t.__localMatrix),zo(Yo,e,i,s),Uo.setTransform(t,Yo,r,o)},transformWorld(t,e,i,s){Mo(Yo,t.worldTransform),Fo(Yo,e),t.parent&&No(Yo,t.parent.scrollWorldTransform),Uo.setTransform(t,Yo,i,s)},transform(t,e,i,s){Mo(Yo,t.localTransform),Fo(Yo,e),Uo.setTransform(t,Yo,i,s)},setTransform(t,e,i,s){const r=t.__,o=r.origin&&Uo.getInnerOrigin(t,r.origin),n=Vo(e,o,r.around&&Uo.getInnerOrigin(t,r.around));if(Uo.hasOffset(t)&&(n.x-=r.offsetX,n.y-=r.offsetY),i){const e=n.scaleX/t.scaleX,i=n.scaleY/t.scaleY;if(delete n.scaleX,delete n.scaleY,o){It.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Uo.getInnerOrigin(t,r.origin);ot.move(n,o.x-s.x,o.y-s.y)}t.set(n),t.scaleResize(e,i,!1)}else t.set(n,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Io(i,Uo.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ot.tempToOuterOf(Uo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return ft.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Mo(Yo,t.worldTransform),No(Yo,e.scrollWorldTransform),i?Yo:Object.assign({},Yo)),updateScaleFixedWorld(t){},updateOuterBounds(t){},cacheId(t){},drop(t,e,i,s){t.setTransform(Uo.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||Uo.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),Gt.requestRender(()=>Uo.animateMove(t,e,i))}}},Uo=Ho,{updateAllMatrix:jo,updateMatrix:Go,updateAllWorldOpacity:Ko,updateAllChange:Zo,updateChange:qo}=Uo;function $o(t,e){return t.updateLayout(),t.parent?ot.tempToInnerOf(e,t.parent.scrollWorldTransform):e}var Jo,Qo={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){const{__:e,__layout:i}=t;return e.eraser||0===e.visible?null:i.localOuterBounds||i.localRenderBounds},maskLocalBoxBounds:(t,e)=>tn(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>tn(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds(t,e){const{__layout:i}=t;return tn(t,e)&&(i.localOuterBounds||i.localRenderBounds)},excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};function tn(t,e){return e||(Jo=0),t.__.mask&&(Jo=1),Jo<0?null:(Jo&&(Jo=-1),!0)}var{updateBounds:en}=Ho,sn={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),rn(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 r=0,o=s.length;r<o;r++)s[r].isBranch&&e.push(s[r]);for(let r=i,o=e.length;r<o;r++)on(e[r],e)},updateBounds(t,e){const i=[t];on(t,i),nn(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++)en(s[t]);e&&e===i||en(i)}},move(t,e,i){let s;const{children:r}=t;for(let o=0,n=r.length;o<n;o++)s=(t=r[o]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&an(t,e,i)},scale(t,e,i,s,r,o,n){let a;const{children:h}=t,l=s-1,d=r-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=r,(a.b||a.c)&&(a.b*=s,a.c*=r),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-o)*l+e,a.y=a.f+=(a.f-n)*d+i):(a.e+=(a.e-o)*l+e,a.f+=(a.f-n)*d+i,a.x+=(a.x-o)*l+e,a.y+=(a.y-n)*d+i),a.width*=s,a.height*=r,a.scaleX*=s,a.scaleY*=r,t.isBranch&&hn(t,e,i,s,r,o,n)}},{pushAllChildBranch:rn,pushAllBranchStack:on,updateBoundsByBranchStack:nn,move:an,scale:hn}=sn,ln={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:dn,updateBounds:cn}=Ho,{toOuterOf:un,getPoints:pn,copy:gn}=It,_n="_localContentBounds",fn="_worldContentBounds",mn="_worldBoxBounds",yn="_worldStrokeBounds",vn=class{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 un(this.contentBounds,this.leaf.__localMatrix,this[_n]||(this[_n]={})),this[_n]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return un(this.contentBounds,this.leaf.__world,this[fn]||(this[fn]={})),this[fn]}get worldBoxBounds(){return un(this.boxBounds,this.leaf.__world,this[mn]||(this[mn]={})),this[mn]}get worldStrokeBounds(){return un(this.strokeBounds,this.leaf.__world,this[yn]||(this[yn]={})),this[yn]}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 cn(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,Gt.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 G.defaultMatrix;case"page":t=e.zoomLayer;default:return dn(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 Nt(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,o,n,a=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(a),o=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;n={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(a);break;case"inner":r=a,o=G.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(a,e),o=dn(s,e,!0)}if(n||(n=G.getLayout(o)),gn(n,a),ot.copy(n,r),i){const{scaleX:t,scaleY:e}=n,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(n.scaleX/=i,n.scaleY/=s,n.width*=i,n.height*=s)}return n}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=pn(this.getInnerBounds(t));let o;switch(e){case"world":o=null;break;case"local":o=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:o=e}return r(o)||s.forEach(t=>i.innerToWorld(t,null,!1,o)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.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}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}},wn=class{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&Gt.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&Gt.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&Gt.event.stop(this.origin)}},xn=class extends wn{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}};xn.ADD="child.add",xn.REMOVE="child.remove",xn.CREATED="created",xn.MOUNTED="mounted",xn.UNMOUNTED="unmounted",xn.DESTROY="destroy";var bn="property.scroll",kn=class extends wn{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}};kn.CHANGE="property.change",kn.LEAFER_CHANGE="property.leafer_change",kn.SCROLL=bn;var En={scrollX:bn,scrollY:bn},Sn=class extends wn{constructor(t,e){super(t),Object.assign(this,e)}};Sn.LOAD="image.load",Sn.LOADED="image.loaded",Sn.ERROR="image.error";var Bn=class extends wn{static checkHas(t,e,i){"on"===i?e===Rn?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Tn)||t.hasEvent(Cn)||t.hasEvent(On),t.__hasWorldEvent=t.hasEvent(Rn))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Tn,t),"inner"===e&&t.emit(Cn,t)),t.emit(On,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Rn,t)}};Bn.RESIZE="bounds.resize",Bn.INNER="bounds.inner",Bn.LOCAL="bounds.local",Bn.WORLD="bounds.world";var{RESIZE:Tn,INNER:Cn,LOCAL:On,WORLD:Rn}=Bn,Pn={};[Tn,Cn,On,Rn].forEach(t=>Pn[t]=1);var Ln=class t extends wn{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(e,i){d(e)?(super(t.RESIZE),Object.assign(this,e)):super(e),this.old=i}static isResizing(t){return this.resizingKeys&&!r(this.resizingKeys[t.innerId])}};Ln.RESIZE="resize";var Mn=class extends wn{constructor(t,e){super(t),this.data=e}};Mn.REQUEST="watch.request",Mn.DATA="watch.data";var Dn=class extends wn{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}};Dn.REQUEST="layout.request",Dn.START="layout.start",Dn.BEFORE="layout.before",Dn.LAYOUT="layout",Dn.AFTER="layout.after",Dn.AGAIN="layout.again",Dn.END="layout.end";var An=class extends wn{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}};An.REQUEST="render.request",An.CHILD_START="render.child_start",An.CHILD_END="render.child_end",An.START="render.start",An.BEFORE="render.before",An.RENDER="render",An.AFTER="render.after",An.AGAIN="render.again",An.END="render.end",An.NEXT="render.next";var In=class extends wn{};In.START="leafer.start",In.BEFORE_READY="leafer.before_ready",In.READY="leafer.ready",In.AFTER_READY="leafer.after_ready",In.VIEW_READY="leafer.view_ready",In.VIEW_COMPLETED="leafer.view_completed",In.STOP="leafer.stop",In.RESTART="leafer.restart",In.END="leafer.end",In.UPDATE_MODE="leafer.update_mode",In.TRANSFORM="leafer.transform",In.MOVE="leafer.move",In.SCALE="leafer.scale",In.ROTATE="leafer.rotate",In.SKEW="leafer.skew";var{MOVE:Wn,SCALE:zn,ROTATE:Fn,SKEW:Nn}=In,Vn={x:Wn,y:Wn,scaleX:zn,scaleY:zn,rotation:Fn,skewX:Nn,skewY:Nn},Yn={};function Xn(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Yn)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Yn)}}var{on:Hn,on_:Un,off:jn,off_:Gn,once:Kn,emit:Zn,emitEvent:qn,hasEvent:$n,destroy:Jn}=class{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(l(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)l(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,r,o;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const a=Xn(this,s,!0),h=n(t)?t.split(" "):t,d=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(o=a[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(d):a[t]=[d],Pn[t]&&Bn.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=n(t)?t.split(" "):t;if(e){let t,r,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const n=Xn(this,t);s.forEach(t=>{t&&(r=n[t],r&&(o=r.findIndex(t=>t.listener===e),o>-1&&r.splice(o,1),r.length||delete n[t],Pn[t]&&Bn.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):l(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=l(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):l(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 l(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));d(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&le.has(t)&&(e=le.get(t,{type:t,target:this,current:this}));const s=Xn(this,i)[t];if(s){let r;for(let o=0,n=s.length;o<n&&!((r=s[o])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),o--,n--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,o=i&&i[t],n=s&&s[t];return!!(r(e)?o||n:e?n:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}.prototype,Qn={on:Hn,on_:Un,off:jn,off_:Gn,once:Kn,emit:Zn,emitEvent:qn,hasEvent:$n,destroyEventer:Jn},ta=qt.get("setAttr"),ea={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||a(e)||r(e)||(ta.warn(this.innerName,t,e),e=void 0),d(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new kn(kn.LEAFER_CHANGE,this,t,s,e));const i=Vn[t];i&&(this.emitEvent(new In(i,this)),this.emitEvent(new In(In.TRANSFORM,this)))}this.emitPropertyEvent(kn.CHANGE,t,s,e);const i=En[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 kn(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:ia,multiplyParent:sa,translateInner:ra,defaultWorld:oa}=G,{toPoint:na,tempPoint:aa}=ft,ha={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:r}=this;sa(this.__local||e,t?t.__scrollWorld||t.__world:oa,i,!!e.affectScaleOrRotation,r),s&&ra(Object.assign(s,i),r.scrollX,r.scrollY),e.scaleFixed&&Ho.updateScaleFixedWorld(this)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(ia(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)&&(na(i.around||i.origin,t.boxBounds,aa),ra(e,-aa.x,-aa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:la,updateAllMatrix:da}=Ho,{updateBounds:ca}=sn,{toOuterOf:ua,copyAndSpread:pa,copy:ga}=It,{toBounds:_a}=Rr,fa={__updateWorldBounds(){const{__layout:t,__world:e}=this;ua(t.renderBounds,e,e),this.__hasComplex&&Ho.checkComplex(this),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Bn.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Bn.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.outerScale&&Ho.updateOuterBounds(this),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),ua(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ua(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ua(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?_a(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(),da(this),ca(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(da(this),ca(this,this))):la(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;pa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;h(i)&&i<=0?ga(e.renderBounds,e.strokeBounds):pa(e.renderBounds,e.boxBounds,i)}},ma={__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.ignoreOpacity?1: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),Ho.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);qt.showBounds&&qt.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:ya}=Qo,{hasSize:va}=It,wa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&va(i)){const s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const r=t.getSameCanvas(!1,!0);this.__renderBranch(r,e),t.opacity=e.ignoreOpacity?1:e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(r,i,i,s.__blendMode,!0),r.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{let i;const{children:s}=this;for(let r=0,o=s.length;r<o;r++)i=s[r],ya(i,e)||(i.__hasComplex?Ho.renderComplex(i,t,e):i.__render(t,e))}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)ya(i[s],e)||i[s].__clip(t,e)}}},{LEAF:xa,create:ba}=m,{stintSet:ka}=g,{toInnerPoint:Ea,toOuterPoint:Sa,multiplyParent:Ba}=G,{toOuterOf:Ta}=It,{copy:Ca,move:Oa}=ot,{getScaleFixedData:Ra}=L,{moveLocal:Pa,zoomOfLocal:La,rotateOfLocal:Ma,skewOfLocal:Da,moveWorld:Aa,zoomOfWorld:Ia,rotateOfWorld:Wa,skewOfWorld:za,transform:Fa,transformWorld:Na,setTransform:Va,getFlipTransform:Ya,getLocalOrigin:Xa,getRelativeWorld:Ha,drop:Ua}=Ho,ja=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 f}get __LayoutProcessor(){return vn}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=ba(xa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(xn.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(xn.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(xn.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(xn.MOUNTED),t.cacheId&&Ho.cacheId(this)):this.__emitLifeEvent(xn.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 Ba(i,t.matrix,e,void 0,i),Ta(this.__layout.renderBounds,e,e),ka(e,"half",i.half),ka(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,i=!0){return Ra(qr.patternLocked?this.__world:this.__nowWorld||this.__world,e,i,t)}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?Ha(this,e):this.worldTransform,r=i?t:{};return Ta(t,s,r),r}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ca(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ca(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ea(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){Sa(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){const r=this.getInnerPoint(t,e,i,s);return i?r:this.getBoxPointByInner(r,null,null,!0)}getBoxPointByInner(t,e,i,s){const r=s?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return Oa(r,-o,-n),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:o,y:n}=this.boxBounds;return Oa(r,o,n),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){Va(this,t,e,i)}transform(t,e,i){Fa(this,t,e,i)}move(t,e,i){Pa(this,t,e,i)}moveInner(t,e,i){Aa(this,t,e,!0,i)}scaleOf(t,e,i,s,r){La(this,Xa(this,t),e,i,s,r)}rotateOf(t,e,i){Ma(this,Xa(this,t),e,i)}skewOf(t,e,i,s,r){Da(this,Xa(this,t),e,i,s,r)}transformWorld(t,e,i){Na(this,t,e,i)}moveWorld(t,e,i){Aa(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){Ia(this,t,e,i,s,r)}rotateOfWorld(t,e){Wa(this,t,e)}skewOfWorld(t,e,i,s,r){za(this,t,e,i,s,r)}flip(t,e){Fa(this,Ya(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(t){}getMotionPathData(){return se.need("path")}getMotionPoint(t){return se.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){Ua(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):ko(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=co),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new xn(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(xn.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};ja=ue([Ro(ea),Ro(ha),Ro(fa),Ro(Qn),Ro(ma)],ja);var{setListWithFn:Ga}=It,{sort:Ka}=sn,{localBoxBounds:Za,localStrokeBounds:qa,localRenderBounds:$a,maskLocalBoxBounds:Ja,maskLocalStrokeBounds:Qa,maskLocalRenderBounds:th}=Qo,eh=new qt("Branch"),ih=class extends ja{__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(){let t;const{children:e}=this;for(let i=0,s=e.length;i<s;i++)if(t=e[i].__layout,t.renderSpread||t.localOuterBounds)return 1;return 0}__updateBoxBounds(t,e){Ga(e||this.__layout.boxBounds,this.children,this.__hasMask?Ja:Za)}__updateStrokeBounds(t){Ga(t||this.__layout.strokeBounds,this.children,this.__hasMask?Qa:qa)}__updateRenderBounds(t){Ga(t||this.__layout.renderBounds,this.children,this.__hasMask?th:$a)}__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(Ka),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return eh.warn("add self or destroyed");const i=r(e);if(!t.__){if(l(t))return t.forEach(t=>{this.add(t,e),i||e++});if(!(t=ne.get(t.tag,t)))return}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(xn.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(xn.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(xn.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(xn.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new xn(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};ih=ue([Ro(wa)],ih);var sh=class t{get length(){return this.list.length}constructor(t){this.reset(),t&&(l(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,o=e.length;s<o;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 e=new t;return e.list=[...this.list],e.keys=Object.assign({},this.keys),e}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()}},rh=class{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(l(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 s=0,r=e.length;s<r;s++)t(e[s])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}};function oh(t,e,i,s){var r,o=arguments.length,n=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,i,n):r(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n}function nh(t){return so(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0);const i=this.__layout;i.renderChanged||i.renderChange(),i.surfaceChange()}}))}function ah(t){return so(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}var hh={},lh={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}},dh=Xt,ch={},uh={},ph={},gh={},_h={},fh={apply(){se.need("filter")}},mh={},yh={setStyleName:()=>se.need("state"),set:()=>se.need("state")},{parse:vh,objectToCanvasData:wh}=ts,{stintSet:xh}=g,{hasTransparent:bh}=lh,kh={originPaint:{}},Eh=qt.get("UIData"),Sh=class extends f{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,e=t.__hasStrokeSides||t.strokeWidth;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,e):e}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 null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==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,Eh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Eh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),n(t)||!t?(xh(this,"__isTransparentFill",bh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):d(t)&&this.__setPaint("fill",t)}setStroke(t){n(t)||!t?(xh(this,"__isTransparentStroke",bh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):d(t)&&this.__setPaint("stroke",t)}setPath(t){const e=n(t);e||t&&d(t[0])?(this.__setInput("path",t),this._path=e?vh(t):wh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Bh(this,"shadow",t)}setInnerShadow(t){Bh(this,"innerShadow",t)}setFilter(t){Bh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&uh.compute("fill",this.__leaf),e&&uh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeScaleFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),r(t.strokeScaleFixed)||(i=t.strokeScaleFixed)),i){const{scaleX:t}=this.__leaf.getRenderScaleData(!0,i,!1);if(1!==t)return e*t}return e}__checkComplex(){const t=this;xh(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),l(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=kh)):(this.__isStrokes=!0,this._stroke||(this._stroke=kh))}__removePaint(t,e){e&&this.__removeInput(t),ph.recycleImage(t,this),"fill"===t?(xh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(xh(this,"__isAlphaPixelStroke",void 0),xh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}};function Bh(t,e,i){t.__setInput(e,i),l(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}var Th=class extends Sh{},Ch=class extends Th{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)}},Oh=class extends Sh{get __usePathBox(){return this.points||this.__pathInputed}},Rh=class extends Sh{get __boxStroke(){return!this.__pathInputed}},Ph={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900},{max:Lh,add:Mh}=x,Dh={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:r}=i,o=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke||i.__useArrow)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),o&&(t=Lh(t,o.__layout.strokeSpread=o.__updateStrokeSpread()),e=Math.max(e,o.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:o,renderSpread:n}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=_h.getShadowRenderSpread(this,e)),s&&(t=Lh(t,s)),o&&(t=Mh(t,fh.getSpread(o))),n&&(t=Mh(t,n)),a&&(t=Mh(t,a));let l=t;return i&&(l=Lh(l,_h.getInnerShadowSpread(this,i))),r&&(l=Lh(l,r)),this.__layout.renderShapeSpread=l,h?Lh(h.__updateRenderSpread(),t):t}},{stintSet:Ah}=g,Ih={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Ah(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Ah(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;Ah(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!_h.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(l(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),t.__checkComplex()},__drawFast(t,e){Wh(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:r,stroke:o,__drawAfterFill:n,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=uh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&_h.shadow(this,t,h),a&&(s.__isStrokes?uh.strokes(o,this,t,e):uh.stroke(o,this,t,e)),r&&(s.__isFills?uh.fills(r,this,t,e):uh.fill(r,this,t,e)),n&&this.__drawAfterFill(t,e),d&&_h.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?uh.strokes(o,this,t,e):uh.stroke(o,this,t,e)),c&&fh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?uh.strokes(o,this,t,e):uh.stroke(o,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,lh.string(e.color))}r&&(s.__isFills?uh.fills(r,this,t,e):uh.fill(r,this,t,e)),h&&t.restore(),n&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?uh.strokes(o,this,t,e):uh.stroke(o,this,t,e))}}else s.__pathForRender?Wh(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?uh.fills(s,this,t,e):uh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?uh.strokes(r,this,t,e):uh.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 Wh(t,e,i){const{fill:s,stroke:r,__drawAfterFill:o,__fillAfterStroke:n}=t.__;t.__drawRenderPath(e),n&&uh.stroke(r,t,e,i),s&&uh.fill(s,t,e,i),o&&t.__drawAfterFill(e,i),r&&!n&&uh.stroke(r,t,e,i)}var zh,Fh={__drawFast(t,e){let{x:i,y:s,width:r,height:o}=this.__layout.boxBounds;const{fill:n,stroke:a,__drawAfterFill:h}=this.__;if(n&&(t.fillStyle=n,t.fillRect(i,s,r,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:n,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(n){case"center":t.strokeRect(0,0,r,o);break;case"inside":r-=h,o-=h,r<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,o),t.restore()):t.strokeRect(i+l,s+l,r,o);break;case"outside":t.strokeRect(i-l,s-l,r+h,o+h)}}}},Nh=zh=class extends ja{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set strokeWidthFixed(t){this.strokeScaleFixed=t}get strokeWidthFixed(){return this.strokeScaleFixed}set scale(t){L.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 Fr.set(this.path=t||[]),t||this.__drawPathByBox(Fr),Fr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return n(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}clearProxyData(){}find(t,e){return se.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return se.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Fr.set(i=[]),this.__drawPathByBox(Fr,!e)),t?ts.toCanvasData(i,!0):i}getPathString(t,e,i){return ts.stringify(this.getPath(t,e),i)}asPath(t,e){this.path=this.getPath(t,e)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||mh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(t){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius||e.path.radius?Wr.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&ch.addArrows(this,t)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){const e=this.__;t.beginPath(),e.__useArrow&&ch.updateArrow(this),this.__drawPathByData(t,e.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?er.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:r,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,r,o,h(e)?[e]:e)}else t.rect(i,s,r,o);t.closePath()}drawImagePlaceholder(t,e,i){uh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),se.need("animate")}killAnimate(t,e){}export(t,e){return se.need("export")}syncExport(t,e){return se.need("export")}clone(t){const e=g.clone(this.toJSON());return t&&Object.assign(e,t),zh.one(e)}static one(t,e,i,s,r){return ne.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){Po()(this)}static registerData(t){bo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.__.__willDestroy=!0,this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};oh([bo(Sh)],Nh.prototype,"__",void 0),oh([(t,e)=>{const i="_"+e;eo(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}})}],Nh.prototype,"zoomLayer",void 0),oh([ro("")],Nh.prototype,"id",void 0),oh([ro("")],Nh.prototype,"name",void 0),oh([ro("")],Nh.prototype,"className",void 0),oh([mo("pass-through")],Nh.prototype,"blendMode",void 0),oh([function(t){return so(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&vo(this)}}))}(1)],Nh.prototype,"opacity",void 0),oh([function(t){return so(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>wo(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");wo(this,t,e,i),this.mask&&vo(this)}}))}(!0)],Nh.prototype,"visible",void 0),oh([mo(!1)],Nh.prototype,"locked",void 0),oh([yo(!1)],Nh.prototype,"dim",void 0),oh([yo(!1)],Nh.prototype,"dimskip",void 0),oh([function(t){return so(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__layout.childrenSortChange()})}}))}(0)],Nh.prototype,"zIndex",void 0),oh([function(t){return so(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}(!1)],Nh.prototype,"mask",void 0),oh([function(t){return so(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}(!1)],Nh.prototype,"eraser",void 0),oh([oo(0,!0)],Nh.prototype,"x",void 0),oh([oo(0,!0)],Nh.prototype,"y",void 0),oh([co(100,!0)],Nh.prototype,"width",void 0),oh([co(100,!0)],Nh.prototype,"height",void 0),oh([ho(1,!0)],Nh.prototype,"scaleX",void 0),oh([ho(1,!0)],Nh.prototype,"scaleY",void 0),oh([lo(0,!0)],Nh.prototype,"rotation",void 0),oh([lo(0,!0)],Nh.prototype,"skewX",void 0),oh([lo(0,!0)],Nh.prototype,"skewY",void 0),oh([oo(0,!0)],Nh.prototype,"offsetX",void 0),oh([oo(0,!0)],Nh.prototype,"offsetY",void 0),oh([no(0,!0)],Nh.prototype,"scrollX",void 0),oh([no(0,!0)],Nh.prototype,"scrollY",void 0),oh([ao()],Nh.prototype,"origin",void 0),oh([ao()],Nh.prototype,"around",void 0),oh([ro(!1)],Nh.prototype,"lazy",void 0),oh([function(t){return so(t,t=>({set(e){this.__setAttr(t,e)&&(uo(this),this.__.__removeNaturalSize())}}))}(1)],Nh.prototype,"pixelRatio",void 0),oh([fo(0)],Nh.prototype,"renderSpread",void 0),oh([function(t){return so(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),uo(this)}}))}()],Nh.prototype,"path",void 0),oh([po()],Nh.prototype,"windingRule",void 0),oh([po(!0)],Nh.prototype,"closed",void 0),oh([co(0)],Nh.prototype,"padding",void 0),oh([co(!1)],Nh.prototype,"lockRatio",void 0),oh([co()],Nh.prototype,"widthRange",void 0),oh([co()],Nh.prototype,"heightRange",void 0),oh([ro(!1)],Nh.prototype,"draggable",void 0),oh([ro()],Nh.prototype,"dragBounds",void 0),oh([ro("auto")],Nh.prototype,"dragBoundsType",void 0),oh([ro(!1)],Nh.prototype,"editable",void 0),oh([xo(!0)],Nh.prototype,"hittable",void 0),oh([xo("path")],Nh.prototype,"hitFill",void 0),oh([_o("path")],Nh.prototype,"hitStroke",void 0),oh([xo(!1)],Nh.prototype,"hitBox",void 0),oh([xo(!0)],Nh.prototype,"hitChildren",void 0),oh([xo(!0)],Nh.prototype,"hitSelf",void 0),oh([xo()],Nh.prototype,"hitRadius",void 0),oh([function(t){return so(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}("")],Nh.prototype,"cursor",void 0),oh([mo()],Nh.prototype,"fill",void 0),oh([_o(void 0,!0)],Nh.prototype,"stroke",void 0),oh([_o("inside")],Nh.prototype,"strokeAlign",void 0),oh([_o(1,!0)],Nh.prototype,"strokeWidth",void 0),oh([_o(!1)],Nh.prototype,"strokeScaleFixed",void 0),oh([_o("none")],Nh.prototype,"strokeCap",void 0),oh([_o("miter")],Nh.prototype,"strokeJoin",void 0),oh([_o()],Nh.prototype,"dashPattern",void 0),oh([_o(0)],Nh.prototype,"dashOffset",void 0),oh([_o(10)],Nh.prototype,"miterLimit",void 0),oh([po(0)],Nh.prototype,"cornerRadius",void 0),oh([po()],Nh.prototype,"cornerSmoothing",void 0),oh([nh()],Nh.prototype,"shadow",void 0),oh([nh()],Nh.prototype,"innerShadow",void 0),oh([nh()],Nh.prototype,"blur",void 0),oh([nh()],Nh.prototype,"backgroundBlur",void 0),oh([nh()],Nh.prototype,"grayscale",void 0),oh([nh()],Nh.prototype,"filter",void 0),oh([mo()],Nh.prototype,"placeholderColor",void 0),oh([ro(100)],Nh.prototype,"placeholderDelay",void 0),oh([ro({})],Nh.prototype,"data",void 0),oh([To(ja.prototype.reset)],Nh.prototype,"reset",null),Nh=zh=oh([Ro(Dh),Ro(Ih),Co()],Nh);var Vh,Yh=class extends Nh{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);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return 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(){}};oh([bo(Th)],Yh.prototype,"__",void 0),oh([co(0)],Yh.prototype,"width",void 0),oh([co(0)],Yh.prototype,"height",void 0),Yh=oh([Ro(ih),Po()],Yh);var Xh=qt.get("Leafer"),Hh=Vh=class extends Yh{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Kr.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),Vh.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,g.assign(s,t));const r=this.canvas=re.canvas(s);this.__controllers.push(this.renderer=re.renderer(this,r,s),this.watcher=re.watcher(this,s),this.layouter=re.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=re.selector(this),this.interaction=re.interaction(this,r,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=re.hitCanvasManager()),this.canvasManager=new ce,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))),ln.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(In.RESTART):this.emitLeafer(In.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(In.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=g.copyAttrs({},t,Be);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Nt(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=g.copyAttrs({},this.canvas,Be);e.resize(t),this.updateLazyBounds(),this.__onResize(new Ln(t,i))}__onResize(t){this.emitEvent(t),g.copyAttrs(this.__,t,Be),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 Yt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Be.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(In.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Be.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,r=g.copyAttrs({},s,Be);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(In.BEFORE_READY),this.emitLeafer(In.READY),this.emitLeafer(In.AFTER_READY),ln.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(In.VIEW_READY),ln.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:o}=this;const n="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,n.x+n.width)),i||(r=Math.max(1,n.y+n.height)),this.__doResize({width:s,height:r,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){ln.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(In.VIEW_COMPLETED),ln.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 r=0;r<s.length;r++)if(s[r]===t){s.splice(r,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return se.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 In(t,this))}__listenEvents(){const t=te.start("FirstCreate "+this.innerName);this.once([[In.START,()=>te.end(t)],[Dn.START,this.updateLazyBounds,this],[An.START,this.__onCreated,this],[An.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Mn.DATA,this.__onWatchData,this],[Dn.END,this.__onLayoutEnd,this],[An.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Vh.list.remove(this);try{this.stop(),this.emitLeafer(In.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(()=>{qr.clearRecycled()},100)}catch(t){Xh.error(t)}}};t?e():setTimeout(e)}};Hh.list=new sh,oh([bo(class extends Th{__getInputData(t,e){const i=super.__getInputData(t,e);return Be.forEach(t=>delete i[t]),i}})],Hh.prototype,"__",void 0),oh([co()],Hh.prototype,"pixelRatio",void 0),oh([ro("normal")],Hh.prototype,"mode",void 0),Hh=Vh=oh([Po()],Hh);var Uh=class extends Nh{get __tag(){return"Rect"}};oh([bo(Rh)],Uh.prototype,"__",void 0),Uh=oh([Ro(Fh),Co(),Po()],Uh);var{add:jh,includes:Gh,scroll:Kh}=It,Zh=Uh.prototype,qh=Yh.prototype,$h=class extends Yh{get __tag(){return"Box"}get isBranchLeaf(){return!0}get __useSelfBox(){return this.pathInputed}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.__useSelfBox){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:o}=s,{overflow:n}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=n&&n.includes("scroll"))&&(jh(a,o),Kh(a,i)),this.__updateRectRenderBounds(),t=!Gh(o,a),t&&"show"===n&&jh(r,a)}else this.__updateRectRenderBounds();g.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))}};oh([bo(Ch)],$h.prototype,"__",void 0),oh([co(100)],$h.prototype,"width",void 0),oh([co(100)],$h.prototype,"height",void 0),oh([ro(!1)],$h.prototype,"resizeChildren",void 0),oh([fo("show")],$h.prototype,"overflow",void 0),oh([To(Zh.__updateStrokeSpread)],$h.prototype,"__updateStrokeSpread",null),oh([To(Zh.__updateRenderSpread)],$h.prototype,"__updateRectRenderSpread",null),oh([To(Zh.__updateBoxBounds)],$h.prototype,"__updateRectBoxBounds",null),oh([To(Zh.__updateStrokeBounds)],$h.prototype,"__updateStrokeBounds",null),oh([To(Zh.__updateRenderBounds)],$h.prototype,"__updateRectRenderBounds",null),oh([To(Zh.__updateChange)],$h.prototype,"__updateRectChange",null),oh([To(Zh.__render)],$h.prototype,"__renderRect",null),oh([To(qh.__render)],$h.prototype,"__renderGroup",null),$h=oh([Co(),Po()],$h);var Jh=class extends $h{get __tag(){return"Frame"}get isFrame(){return!0}};oh([bo(class extends Ch{})],Jh.prototype,"__",void 0),oh([mo("#FFFFFF")],Jh.prototype,"fill",void 0),oh([fo("hide")],Jh.prototype,"overflow",void 0),Jh=oh([Po()],Jh);var{moveTo:Qh,closePath:tl,ellipse:el}=ks,il=class extends Nh{get __tag(){return"Ellipse"}__updatePath(){const t=this.__,{width:e,height:i,innerRadius:s,startAngle:r,endAngle:o}=t,n=e/2,a=i/2,h=t.path=[];let l;s?r||o?(s<1?el(h,n,a,n*s,a*s,0,r,o,!1):l=!0,el(h,n,a,n,a,0,o,r,!0)):(s<1&&(el(h,n,a,n*s,a*s),Qh(h,e,a)),el(h,n,a,n,a,0,360,0,!0)):r||o?(Qh(h,n,a),el(h,n,a,n,a,0,r,o,!1)):el(h,n,a,n,a),l||tl(h),(Gt.ellipseToCurve||t.__useArrow||t.cornerRadius)&&(t.path=this.getPath(!0))}};oh([bo(class extends Sh{get __boxStroke(){return!this.__pathInputed}})],il.prototype,"__",void 0),oh([po(0)],il.prototype,"innerRadius",void 0),oh([po(0)],il.prototype,"startAngle",void 0),oh([po(0)],il.prototype,"endAngle",void 0),il=oh([Po()],il);var{sin:sl,cos:rl,PI:ol}=Math,{moveTo:nl,lineTo:al,closePath:hl,drawPoints:ll}=ks,dl=class extends Nh{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ll(e,t.points,t.curve,t.closed);else{const{width:i,height:s,sides:r,startAngle:o}=t,n=i/2,a=s/2;let h,l=0;o?(l=o*D,nl(e,n+n*sl(l),a-a*rl(l))):nl(e,n,0);for(let t=1;t<r;t++)h=2*t*ol/r+l,al(e,n+n*sl(h),a-a*rl(h));hl(e)}}};oh([bo(class extends Oh{})],dl.prototype,"__",void 0),oh([po(3)],dl.prototype,"sides",void 0),oh([po(0)],dl.prototype,"startAngle",void 0),oh([po()],dl.prototype,"points",void 0),oh([po(0)],dl.prototype,"curve",void 0),dl=oh([Co(),Po()],dl);var{sin:cl,cos:ul,PI:pl}=Math,{moveTo:gl,lineTo:_l,closePath:fl}=ks,ml=class extends Nh{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s,startAngle:r}=this.__,o=t/2,n=e/2,a=this.__.path=[];let h,l=0;r?(l=r*D,gl(a,o+o*cl(l),n-n*ul(l))):gl(a,o,0);for(let d=1;d<2*i;d++)h=d*pl/i+l,_l(a,o+(d%2==0?o:o*s)*cl(h),n-(d%2==0?n:n*s)*ul(h));fl(a)}};oh([bo(class extends Sh{get __boxStroke(){return!this.__pathInputed}})],ml.prototype,"__",void 0),oh([po(5)],ml.prototype,"corners",void 0),oh([po(.382)],ml.prototype,"innerRadius",void 0),oh([po(0)],ml.prototype,"startAngle",void 0),ml=oh([Po()],ml);var{moveTo:yl,lineTo:vl,drawPoints:wl}=ks,{rotate:xl,getAngle:bl,getDistance:kl,defaultPoint:El}=ot,Sl=class extends Nh{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&xl(i,e),i}set toPoint(t){this.width=kl(El,t),this.rotation=bl(El,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?wl(e,t.points,t.curve,t.closed):(yl(e,0,0),vl(e,this.width,0))}};oh([bo(Oh)],Sl.prototype,"__",void 0),oh([go("center")],Sl.prototype,"strokeAlign",void 0),oh([co(0)],Sl.prototype,"height",void 0),oh([po()],Sl.prototype,"points",void 0),oh([po(0)],Sl.prototype,"curve",void 0),oh([po(!1)],Sl.prototype,"closed",void 0),Sl=oh([Po()],Sl);var Bl=class extends Uh{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return l(t)&&t[0].image}};oh([bo(class extends Rh{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,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}})],Bl.prototype,"__",void 0),oh([co("")],Bl.prototype,"url",void 0),Bl=oh([Po()],Bl);var Tl=class extends Uh{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=re.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new to({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Sn(Sn.LOADED,{image:t}))})}draw(t,e,i,s){const r=new ut(t.worldTransform).invert(),o=new ut;e&&o.translate(e.x,e.y),i&&(h(i)?o.scale(i):o.scale(i.x,i.y)),s&&o.rotate(s),r.multiplyParent(o),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()}};oh([bo(class extends Rh{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}})],Tl.prototype,"__",void 0),oh([ah(100)],Tl.prototype,"width",void 0),oh([ah(100)],Tl.prototype,"height",void 0),oh([ah(1)],Tl.prototype,"pixelRatio",void 0),oh([ah(!0)],Tl.prototype,"smooth",void 0),oh([ro(!1)],Tl.prototype,"safeResize",void 0),oh([ah()],Tl.prototype,"contextSettings",void 0),Tl=oh([Po()],Tl);var{copyAndSpread:Cl,includes:Ol,spread:Rl,setList:Pl}=It,{stintSet:Ll}=g,Ml=class extends Nh{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:r,fontWeight:o,italic:n,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=dh.number(e,r),t.__letterSpacing=dh.number(i,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${n?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${r||12}px ${s||"caption"}`,Ll(t,"__padding",l&&L.fourNumber(l)),Ll(t,"__clipText","show"!==h&&!t.__autoSize),Ll(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=hh.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:o,__autoHeight:n}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Rl(a,i/2),o||n){if(h.x=o?a.x:0,h.y=n?a.y:0,h.width=o?a.width:t.width,h.height=n?a.height:t.height,r){const[e,i,s,r]=t.__padding;o&&(h.x-=r,h.width+=i+r),n&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),g.stintSet(this,"isOverflow",!Ol(h,a)),this.isOverflow?(Pl(t.__textBoxBounds={},[h,a]),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;Cl(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()}};oh([bo(class extends Sh{get __useNaturalRatio(){return!1}setFontWeight(t){n(t)?(this.__setInput("fontWeight",t),t=Ph[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=ne.get("Rect",0);const r=e.__layout,o=i.__layout;s||(i.parent=e,i.__world=e.__world,o.boxBounds=r.boxBounds),i.set(t),o.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}})],Ml.prototype,"__",void 0),oh([co(0)],Ml.prototype,"width",void 0),oh([co(0)],Ml.prototype,"height",void 0),oh([mo()],Ml.prototype,"boxStyle",void 0),oh([ro(!1)],Ml.prototype,"resizeFontSize",void 0),oh([mo("#000000")],Ml.prototype,"fill",void 0),oh([go("outside")],Ml.prototype,"strokeAlign",void 0),oh([xo("all")],Ml.prototype,"hitFill",void 0),oh([co("")],Ml.prototype,"text",void 0),oh([co("")],Ml.prototype,"placeholder",void 0),oh([co("caption")],Ml.prototype,"fontFamily",void 0),oh([co(12)],Ml.prototype,"fontSize",void 0),oh([co("normal")],Ml.prototype,"fontWeight",void 0),oh([co(!1)],Ml.prototype,"italic",void 0),oh([co("none")],Ml.prototype,"textCase",void 0),oh([co("none")],Ml.prototype,"textDecoration",void 0),oh([co(0)],Ml.prototype,"letterSpacing",void 0),oh([co({type:"percent",value:1.5})],Ml.prototype,"lineHeight",void 0),oh([co(0)],Ml.prototype,"paraIndent",void 0),oh([co(0)],Ml.prototype,"paraSpacing",void 0),oh([co("x")],Ml.prototype,"writingMode",void 0),oh([co("left")],Ml.prototype,"textAlign",void 0),oh([co("top")],Ml.prototype,"verticalAlign",void 0),oh([co(!0)],Ml.prototype,"autoSizeAlign",void 0),oh([co("normal")],Ml.prototype,"textWrap",void 0),oh([co("show")],Ml.prototype,"textOverflow",void 0),oh([mo(!1)],Ml.prototype,"textEditing",void 0),Ml=oh([Po()],Ml);var Dl=class extends Nh{get __tag(){return"Path"}};oh([bo(class extends Sh{get __pathInputed(){return 2}})],Dl.prototype,"__",void 0),oh([go("center")],Dl.prototype,"strokeAlign",void 0),Dl=oh([Po()],Dl);var Al=class extends Yh{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Dl(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,r,o){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,o,n,a){return this}arc(t,e,i,s,r,o){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,o,n,a){return this}drawArc(t,e,i,s,r,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){const{pathElement:t}=this;t.__layout.boxChanged||t.forceUpdate("path")}};function Il(t,e,i,s){var r,o=arguments.length,n=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,i,n):r(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n}oh([bo(class extends Th{})],Al.prototype,"__",void 0),oh([(t,e)=>{eo(t,e,{get(){return this.__path}})}],Al.prototype,"path",void 0),Al=oh([Ro(Ns,["set","path","paint"]),Po()],Al);var Wl=class extends Hh{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&&re.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(t){const e=new Hh(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),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,void 0,void 0,!0))}__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&&g.assign(e,t),this.autoLayout&&g.copyAttrs(e,this,Be),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Dn.END,this.__onReady,this],[An.START,this.__onCreated,this],[An.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(An.END,this.__onChildRenderEnd,this))}};Wl=Il([Po()],Wl);var zl={},Fl={isHoldSpaceKey:()=>Fl.isHold("Space"),isHold:t=>zl[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){zl[t]||(zl[t]=!0)},setUpCode(t){zl[t]=!1}},Nl={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},Vl=class extends wn{get spaceKey(){return Fl.isHoldSpaceKey()}get left(){return Nl.left(this)}get right(){return Nl.right(this)}get middle(){return Nl.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Fl.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){le.changeName(t,e)}},{min:Yl,max:Xl,abs:Hl}=Math,{float:Ul,sign:jl}=L,{minX:Gl,maxX:Kl,minY:Zl,maxY:ql}=It,$l=new Nt,Jl=new Nt,Ql={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&td.getValidMove(t.__localBoxBounds,td.getDragBounds(t),s,e,!0),td.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:r,dragBoundsType:o}=t;r&&td.getValidScaleOf(t.__localBoxBounds,td.getDragBounds(t),o,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&&Ul(t[s])>Ul(e[s]),getValidMove(t,e,i,s,r){const o=t.x+s.x,n=t.y+s.y,a=o+t.width,h=n+t.height,l=e.x+e.width,d=e.y+e.height;return r||(s=Object.assign({},s)),td.isInnerMode(t,e,i,"width")?o>e.x?s.x+=e.x-o:a<l&&(s.x+=l-a):o<e.x?s.x+=e.x-o:a>l&&(s.x+=l-a),td.isInnerMode(t,e,i,"height")?n>e.y?s.y+=e.y-n:h<d&&(s.y+=d-h):n<e.y?s.y+=e.y-n:h>d&&(s.y+=d-h),s.x=Ul(s.x),s.y=Ul(s.y),s},getValidScaleOf(t,e,i,s,r,o,n){n||(r=Object.assign({},r)),Jl.set(e),$l.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,m=1;return td.isInnerMode(t,e,i,"width")?(r.x<0&&$l.scaleOf(s,f=1/r.x,1),g=Ul($l.minX-Jl.minX),_=Ul(Jl.maxX-$l.maxX),u=h&&g>0?1+g/(h*$l.width):1,p=l&&_>0?1+_/(l*$l.width):1,f*=Xl(u,p)):(r.x<0&&((Ul(Gl(t)-Gl(e))<=0||Ul(Kl(e)-Kl(t))<=0)&&$l.scaleOf(s,f=1/r.x,1),$l.unsign()),g=Ul(Jl.minX-$l.minX),_=Ul($l.maxX-Jl.maxX),u=h&&g>0?1-g/(h*$l.width):1,p=l&&_>0?1-_/(l*$l.width):1,f*=Yl(u,p)),td.isInnerMode(t,e,i,"height")?(r.y<0&&$l.scaleOf(s,1,m=1/r.y),g=Ul($l.minY-Jl.minY),_=Ul(Jl.maxY-$l.maxY),u=d&&g>0?1+g/(d*$l.height):1,p=c&&_>0?1+_/(c*$l.height):1,m*=Xl(u,p),o&&(u=Xl(Hl(f),Hl(m)),f=jl(f)*u,m=jl(m)*u)):(r.y<0&&((Ul(Zl(t)-Zl(e))<=0||Ul(ql(e)-ql(t))<=0)&&$l.scaleOf(s,1,m=1/r.y),$l.unsign()),g=Ul(Jl.minY-$l.minY),_=Ul($l.maxY-Jl.maxY),u=d&&g>0?1-g/(d*$l.height):1,p=c&&_>0?1-_/(c*$l.height):1,m*=Yl(u,p)),r.x*=a(f)?f:1,r.y*=a(m)?m:1,r}},td=Ql,ed=class extends Vl{};ed.POINTER="pointer",ed.BEFORE_DOWN="pointer.before_down",ed.BEFORE_MOVE="pointer.before_move",ed.BEFORE_UP="pointer.before_up",ed.DOWN="pointer.down",ed.MOVE="pointer.move",ed.UP="pointer.up",ed.OVER="pointer.over",ed.OUT="pointer.out",ed.ENTER="pointer.enter",ed.LEAVE="pointer.leave",ed.TAP="tap",ed.DOUBLE_TAP="double_tap",ed.CLICK="click",ed.DOUBLE_CLICK="double_click",ed.LONG_PRESS="long_press",ed.LONG_TAP="long_tap",ed.MENU="pointer.menu",ed.MENU_TAP="pointer.menu_tap";ed=Il([Lo()],ed);var id={},sd=class extends ed{static setList(t){this.list=t instanceof sh?t:new sh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const r=t.getLocalPoint(i,null,!0);return ot.move(r,e.x-t.x,e.y-t.y),s&&this.limitMove(t,r),Ql.axisMove(t,r),r}static limitMove(t,e){Ql.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 It.set(i,e.x-t.x,e.y-t.y,t.x,t.y),It.unsign(i),i}assignMove(t){id.x=t?this.totalX:this.moveX,id.y=t?this.totalY:this.moveY}};sd.BEFORE_DRAG="drag.before_drag",sd.START="drag.start",sd.DRAG="drag",sd.END="drag.end",sd.OVER="drag.over",sd.OUT="drag.out",sd.ENTER="drag.enter",sd.LEAVE="drag.leave",sd=Il([Lo()],sd);var rd=class extends ed{static setList(t){sd.setList(t)}static setData(t){sd.setData(t)}};rd.DROP="drop",rd=Il([Lo()],rd);var od=class extends sd{};od.BEFORE_MOVE="move.before_move",od.START="move.start",od.MOVE="move",od.DRAG_ANIMATE="move.drag_animate",od.END="move.end",od.PULL_DOWN="move.pull_down",od.REACH_BOTTOM="move.reach_bottom",od=Il([Lo()],od);var nd=class extends Vl{};nd=Il([Lo()],nd);var ad=class extends ed{};ad.BEFORE_ROTATE="rotate.before_rotate",ad.START="rotate.start",ad.ROTATE="rotate",ad.END="rotate.end",ad=Il([Lo()],ad);var hd=class extends sd{};hd.SWIPE="swipe",hd.LEFT="swipe.left",hd.RIGHT="swipe.right",hd.UP="swipe.up",hd.DOWN="swipe.down",hd=Il([Lo()],hd);var ld=class extends ed{};ld.BEFORE_ZOOM="zoom.before_zoom",ld.START="zoom.start",ld.ZOOM="zoom",ld.END="zoom.end",ld=Il([Lo()],ld);var dd=class extends Vl{};dd.BEFORE_DOWN="key.before_down",dd.BEFORE_UP="key.before_up",dd.DOWN="key.down",dd.HOLD="key.hold",dd.UP="key.up",dd=Il([Lo()],dd);var cd={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?hd.UP:t>45&&t<135?hd.DOWN:t<=45&&t>=-45?hd.RIGHT:hd.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:ud.getSwipeDirection(ot.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 s=0,r=i.length;s<r;s++)if(i[s].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new sh,{list:s}=t;for(let r=0,o=s.length;r<o;r++)s[r].hasEvent(e)&&i.add(s[r]);return i},pathCanDrag:t=>t&&t.list.some(t=>Ho.draggable(t)||!t.isLeafer&&t.hasEvent(sd.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},ud=cd,pd=new sh,{getDragEventData:gd,getDropEventData:_d,getSwipeEventData:fd}=cd,md=class{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=gd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,r=sd.list||this.draggableList||pd;return this.dragging&&(s?t?pd:new sh(e?[...i.list,...i.dragHoverExclude]:i.list):r)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(od.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Nl.left(t),this.dragging&&(this.interaction.emit(sd.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],Ho.draggable(e)){this.draggableList=new sh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:r,throughPath:o}=s;this.dragData=gd(s,i,t),o&&(this.dragData.throughPath=o),this.dragData.path=r,this.dragDataList.push(this.dragData),this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(od.BEFORE_MOVE,this.dragData),e.emit(od.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(sd.BEFORE_DRAG,this.dragData),e.emit(sd.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:r}=this.dragData,{dragLimitAnimate:o}=e.p,a=!o||!!t;s.forEach(e=>{if(e.draggable){const s=n(e.draggable),l=sd.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:r},a||s);o&&!s&&t?Ho.animateMove(e,l,h(o)?o:.3):e.move(l)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(sd.OUT,t,i),e.emit(sd.OVER,t,s)):e.emit(sd.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(sd.LEAVE,t,i,s),e.emit(sd.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:r,throughPath:o}=i,n=gd(i,t,t);if(o&&(n.throughPath=o),n.path=r,this.moving&&(this.moving=!1,n.moveType="drag",e.emit(od.END,n)),this.dragging){const r=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(sd.END,n),this.swipe(t,i,s,n),this.drop(t,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(ot.getDistance(e,t)>r.config.pointer.swipeDistance){const t=fd(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=_d(t,e,sd.data);s.path=i,this.interaction.emit(rd.DROP,s),this.interaction.emit(sd.LEAVE,t,i)}dragReset(){sd.list=sd.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()}},yd=qt.get("emit"),vd=["move","zoom","rotate","key"];function wd(t,e,i,s,r){if(vd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!bd(t,r)){let o;for(let n=0,a=t.children.length;n<a;n++)o=t.children[n],!i.path.has(o)&&o.__.hittable&&xd(o,e,i,s,r)}}function xd(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!bd(t,r)&&(yh.updateEventStyle&&!s&&yh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=le.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function bd(t,e){return e&&e.has(t)}var kd={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:Ed,pathCanDrag:Sd,pathHasOutside:Bd}=cd,Td=class{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&&Nl.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Nl.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Fl.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=g.clone(kd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new sh(t),this.createTransformer(),this.dragger=new md(this),s&&(this.config=g.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Nl.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(ed.BEFORE_DOWN,t),t.path.needUpdate&&this.updateDownData(t),this.emit(ed.DOWN,t),Nl.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Nl.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Nl.defaultLeft(t),(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(ed.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=ot.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(ed.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Nl.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(ed.BEFORE_UP,t),this.emit(ed.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(ed.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(ed.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(dd.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Fl.setDownCode(e),this.emit(dd.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(dd.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(dd.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Fl.setUpCode(e),this.emit(dd.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new sh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(ed.OUT,t,i),this.emit(ed.OVER,t,e)):this.emit(ed.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(ed.LEAVE,t,i,e),this.emit(ed.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(ed.LEAVE,t),this.dragger.dragging&&this.emit(rd.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,r=[ed.DOUBLE_TAP,ed.DOUBLE_CLICK].some(e=>Ed(t.path,e));s<e.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:r,target:o}=this;Gt.backgrounder||t.origin||o&&o.updateLayout();const n=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));return n.throughPath&&(t.throughPath=n.throughPath),t.path=n.path,n.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&&!Bd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Sd(t.path))&&!Bd(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()}replaceDownTarget(t){const{downData:e}=this;if(e&&t){const{path:i}=e;i.remove(i.list[0]),i.addAt(t,0)}}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:ed.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let r=0,o=s.length;r<o&&(e=s.list[r],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);r++);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&&ot.round(s),s}emitTap(t){this.emit(ed.TAP,t),this.emit(ed.CLICK,t)}emitDoubleTap(t){this.emit(ed.DOUBLE_TAP,t),this.emit(ed.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(ed.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(ed.LONG_TAP,t),(Ed(t.path,ed.LONG_TAP)||Ed(t.path,ed.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Nt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(h(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Ln.RESIZE,this.__onResize,this)],t.once(In.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 o=i.length-1;o>-1;o--){if(r=i.list[o],xd(r,t,e,!0,s))return;r.isApp&&wd(r,t,e,!0,s)}for(let o=0,n=i.length;o<n;o++)if(r=i.list[o],r.isApp&&wd(r,t,e,!1,s),xd(r,t,e,!1,s))return}catch(t){yd.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)}},Cd=class{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}};Cd.custom={};var Od=class extends ce{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new sh,this.pixelList=new sh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),re.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),re.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()}};Gt.getSelector=function(t){return t.leafer?t.leafer.selector:Gt.selector||(Gt.selector=re.selector())};var{toInnerRadiusPointOf:Rd,copyRadiusPoint:Pd}=ot,{hitRadiusPoint:Ld,hitPoint:Md}=It,Dd={},Ad={},Id=ja.prototype;Id.hit=function(t,e=0){this.updateLayout(),Pd(Ad,t,e);const i=this.__world;return!!(e?Ld(i,Ad):Md(i,Ad))&&(this.isBranch?Gt.getSelector(this).hitPoint(Object.assign({},Ad),e,{target:this}):this.__hitWorld(Ad))},Id.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,r=this.__layout,o=s.width<10&&s.height<10;if(i.hitRadius&&(Pd(Dd,t,i.hitRadius),t=Dd),Rd(t,s,Dd),i.hitBox||o){if(It.hitRadiusPoint(r.boxBounds,Dd))return!0;if(o)return!1}return!r.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),r.boundsChanged||(r.hitCanvasChanged=!1)),this.__hit(Dd,e)},Id.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Id.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Id.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Id.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};var Wd=new ut,zd=Nh.prototype;zd.__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 o=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,r=Gt.image.hitCanvasSize,n=o.hitScale=Vt.set(0,0,r,r).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Vt.set(t).scale(n);o.resize({width:l,height:d,pixelRatio:1}),o.clear(),qr.patternLocked=!0,this.__renderShape(o,{matrix:Wd.setWith(this.__world).scaleWith(1/n).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),qr.patternLocked=!1,o.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(e)},zd.__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:o,__maxStrokeWidth:n}=i,a=i.stroke&&("path"===o||"pixel"===o&&!i.__isAlphaPixelStroke)||"all"===o;if(!r&&!a)return!1;const h=2*t.radiusX;let l=h;if(a)switch(i.strokeAlign){case"inside":if(l+=2*n,!r&&this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h;break;case"center":l+=n;break;case"outside":if(l+=2*n,!r){if(!this.__hitFill(t)&&this.__hitStroke(t,l))return!0;l=h}}return!!l&&this.__hitStroke(t,l)};var Fd=Nh.prototype,Nd=Uh.prototype,Vd=$h.prototype;Nd.__updateHitCanvas=Vd.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Fd.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Nd.__hitFill=Vd.__hitFill=function(t){return this.__hitCanvas?Fd.__hitFill.call(this,t):It.hitRadiusPoint(this.__layout.boxBounds,t)},Ml.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:r,__textDrawData:o}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):o.rows.forEach(r=>t.rect(r.x,r.y-s,r.width,e<i?i:e))},Yh.prototype.pick=function(t,e){return e||(e=s),this.updateLayout(),Gt.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};var Yd,Xd=Te.prototype;function Hd(t,e,i,s){return new(i||(i=Promise))(function(r,o){function n(t){try{h(s.next(t))}catch(t){o(t)}}function a(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(n,a)}h((s=s.apply(t,e||[])).next())})}Xd.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Xd.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Xd.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:o,radiusY:n}=t;e&&(s-=e.x,r-=e.y),Vt.set(s-o,r-n,2*o,2*n).scale(i).ceil();const{data:a}=this.context.getImageData(Vt.x,Vt.y,Vt.width||1,Vt.height||1);for(let h=0,l=a.length;h<l;h+=4)if(a[h+3]>0)return!0;return a[3]>0},function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(Yd||(Yd={}));var Ud=qt.get("LeaferCanvas"),jd=class extends Te{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const s=i.children[t];s?(this.setAbsolute(s),i.insertBefore(e,s)):i.appendChild(s)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:i}=this.view;if(i.display||(i.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none",this.view.classList.add("leafer-canvas-view")}Gt.syncDomFont&&!this.parentView&&(i.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=n(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else Ud.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:s}=this.view;s.width=t+"px",s.height=e+"px",this.unreal||(this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i))}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),Ud.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),Gt.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=Gt.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:i}=this;this.emitResize({width:e,height:i,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const e=this.view,{x:i,y:s,width:r,height:o}=this.autoBounds.getBoundsFrom(t),n={width:r,height:o,pixelRatio:this.config.pixelRatio?this.pixelRatio:Gt.devicePixelRatio};if(!this.isSameSize(n)){const{style:t}=e;t.marginLeft=i+"px",t.marginTop=s+"px",this.emitResize(n)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};g.copyAttrs(e,this,Be),this.resize(t),this.resizeListener&&!r(this.width)&&this.resizeListener(new Ln(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){let t=this.view;t&&t.remove(),t=this.view=document.createElement("div"),this.parentView.appendChild(this.view),t.classList.add("leafer-app-view"),this.unreal=!0}}destroy(){const{view:t}=this;t&&(this.stopAutoLayout(),this.stopListenPixelRatio(),t.parentElement&&t.remove(),super.destroy())}};Vr(CanvasRenderingContext2D.prototype),Vr(Path2D.prototype),Object.assign(re,{canvas:(t,e)=>new jd(t,e),image:t=>new to(t)}),Gt.name="web",Gt.isMobile="ontouchstart"in window,Gt.requestRender=function(t){window.requestAnimationFrame(t)},eo(Gt,"devicePixelRatio",{get:()=>devicePixelRatio});var{userAgent:Gd}=navigator;Gd.indexOf("Firefox")>-1?(Gt.intWheelDeltaY=!0,Gt.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(Gt.fullImageShadow=!0),Gd.indexOf("Windows")>-1?(Gt.os="Windows",Gt.intWheelDeltaY=!0):Gd.indexOf("Mac")>-1?Gt.os="Mac":Gd.indexOf("Linux")>-1&&(Gt.os="Linux");var Kd=class{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new sh;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 sh,this.target=t,e&&(this.config=g.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(An.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===xn.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 i=0,s=e.length;i<s;i++)this.__pushChild(e[i])}__onRquestData(){this.target.emitEvent(new Mn(Mn.DATA,{updatedList:this.updatedList})),this.__updatedList=new sh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[kn.CHANGE,this.__onAttrChange,this],[[xn.ADD,xn.REMOVE],this.__onChildEvent,this],[Mn.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}},{updateAllMatrix:Zd,updateBounds:qd,updateChange:$d}=Ho,{pushAllChildBranch:Jd,pushAllParent:Qd}=sn,{worldBounds:tc}=Qo,ec=class{constructor(t){this.updatedBounds=new Nt,this.beforeBounds=new Nt,this.afterBounds=new Nt,l(t)&&(t=new sh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,tc)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,tc),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}},{updateAllMatrix:ic,updateAllChange:sc}=Ho,rc=qt.get("Layouter"),oc=class t{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new rh,this.target=t,e&&(this.config=g.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(Dn.START),this.layoutOnce(),t.emitEvent(new Dn(Dn.END,this.layoutedBlocks,this.times))}catch(t){rc.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?rc.warn("layouting"):this.times>3?rc.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Mn.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=te.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=Dn,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Dn(r,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Zd(t,!0),e.add(t),t.isBranch&&Jd(t,e),Qd(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Qd(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,o=e.length;t<o;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||qd(s[t])}qd(i)}})}(this.__levelList),function(t){t.list.forEach($d)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Dn(o,a,this.times)),i.emitEvent(new Dn(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,te.end(e)}fullLayout(){const e=te.start("FullLayout"),{target:i}=this,{BEFORE:s,LAYOUT:r,AFTER:o}=Dn,n=this.getBlocks(new sh(i));i.emitEvent(new Dn(s,n,this.times)),t.fullLayout(i),n.forEach(t=>{t.setAfter()}),i.emitEvent(new Dn(r,n,this.times)),i.emitEvent(new Dn(o,n,this.times)),this.addBlocks(n),te.end(e)}static fullLayout(t){ic(t,!0),t.isBranch?sn.updateBounds(t):Ho.updateBounds(t),sc(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new ec([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new ec(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_([[Dn.REQUEST,this.layout,this],[Dn.AGAIN,this.layoutAgain,this],[Mn.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}},nc=qt.get("Renderer"),ac=class t{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,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=g.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(Dn.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(An.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(An.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(An.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Nt,nc.log(e.innerName,"---\x3e");try{this.emitRender(An.START),this.renderOnce(t),this.emitRender(An.END,this.totalBounds),qr.clearRecycled()}catch(t){this.rendering=!1,nc.error(t)}nc.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return nc.warn("rendering");if(this.times>3)return nc.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Nt,this.renderOptions={},t)this.emitRender(An.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(An.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(An.RENDER,this.renderBounds,this.renderOptions),this.emitRender(An.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(e){const i=te.start("PartRender"),{canvas:s}=this,r=e.getIntersect(s.bounds),o=new Nt(r);s.save(),r.spread(t.clipSpread).ceil();const{ceilPartPixel:n}=this.config;s.clipWorld(r,n),s.clearWorld(r,n),this.__render(r,o),s.restore(),te.end(i)}fullRender(){const t=te.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),te.end(t)}__render(t,e){const{canvas:i,target:s}=this,r=t.includes(s.__world),o=r?{includes:r}:{bounds:t,includes:r};this.needFill&&i.fillWorld(t,this.config.fill),qt.showRepaint&&qt.drawRepaint(i,t),this.config.useCellRender&&(o.cellList=this.getCellList()),Gt.render(s,i,o),this.renderBounds=e=e||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Nt;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 Gt.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()};Gt.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Nt(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 Nt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:i}=t;i&&i.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||nc.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,i)})}emitRender(t,e,i){this.target.emitEvent(new An(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[An.REQUEST,this.update,this],[Dn.END,this.__onLayoutEnd,this],[An.AGAIN,this.renderAgain,this],[Ln.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}};ac.clipSpread=10;var hc={},{copyRadiusPoint:lc}=ot,{hitRadiusPoint:dc}=It,cc=class{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,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new sh(i.findList),i.findList||this.hitBranch(o.isBranchLeaf?{children:[o]}:o);const{list:n}=this.findList,a=this.getBestMatchLeaf(n,i.bottomList,r,!!i.findList),h=r?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:n.length?this.getThroughPath(n):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const r=this.findList=new sh;if(t.length){let e;const{x:s,y:o}=this.point,n={x:s,y:o,radiusX:0,radiusY:0};for(let a=0,h=t.length;a<h;a++)if(e=t[a],(i||Ho.worldHittable(e))&&(this.hitChild(e,n),r.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&Ho.hasParent(t,e))){r.reset();break}return r.list[0]}}if(e)for(let o=0,n=e.length;o<n;o++)if(this.hitChild(e[o].target,this.point,e[o].proxy),r.length)return r.list[0];return s?null:i?t[0]:t.find(t=>Ho.worldHittable(t))}getPath(t){const e=new sh,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 sh;for(let r=e.list.length-1;r>-1&&(i=e.list[r],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));r--);return s}getThroughPath(t){const e=new sh,i=[];for(let n=t.length-1;n>-1;n--)i.push(this.getPath(t[n]));let s,r,o;for(let n=0,a=i.length;n<a;n++){s=i[n],r=i[n+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!r||!r.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,r;const{point:o}=this;for(let n=t.length-1;n>-1;n--)if(i=t[n],r=i.__,r.visible&&(!e||r.mask))if(s=dc(i.__world,r.hitRadius?lc(hc,o,r.hitRadius):o),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&r.__clipAfterFill&&!i.__hitWorld(o,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)}}else s&&this.hitChild(i,o)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,r=[];const{children:o}=s;for(let s=0,n=o.length;s<n;s++)if(i=o[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()}},uc=class{constructor(t,e){this.config={},e&&(this.config=g.default(e,this.config)),this.picker=new cc(this.target=t,this),this.finder=re.finder&&re.finder(t,this.config)}getByPoint(t,e,i){const{target:s,picker:r}=this;return Gt.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):se.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}};Object.assign(re,{watcher:(t,e)=>new Kd(t,e),layouter:(t,e)=>new oc(t,e),renderer:(t,e,i)=>new ac(t,e,i),selector:(t,e)=>new uc(t,e)}),Gt.layout=oc.fullLayout,Gt.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new sh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};var pc={convert(t,e){const i=cd.getBase(t),{x:s,y:r}=e,o=Object.assign(Object.assign({},i),{x:s,y:r,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===o.pointerType&&(o.tangentialPressure=t.tangentialPressure,o.tiltX=t.tiltX,o.tiltY=t.tiltY,o.twist=t.twist),o},convertMouse(t,e){const i=cd.getBase(t),{x:s,y:r}=e;return Object.assign(Object.assign({},i),{x:s,y:r,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=pc.getTouch(t),s=cd.getBase(t),{x:r,y:o}=e;return Object.assign(Object.assign({},s),{x:r,y:o,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},gc={convert(t){const e=cd.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:_c}=cd,fc=class extends Td{get windowTarget(){const{view:t}=this;return t&&t.ownerDocument||window}get notPointer(){const{p:t}=this;return"pointer"!==t.type||t.touch||this.useMultiTouch}get notTouch(){const{p:t}=this;return"mouse"===t.type||this.usePointer}get notMouse(){return this.usePointer||this.useTouch}__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let s in e)e[s]=e[s].bind(this),t.addEventListener(s,e[s]);for(let s in i)i[s]=i[s].bind(this),this.windowTarget.addEventListener(s,i[s])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let i in t)this.view.removeEventListener(i,t[i]),this.viewEvents={};for(let i in e)this.windowTarget.removeEventListener(i,e[i]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,s=t.length;i<s;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!(this.downData||t.target===this.view||this.config.shadowDOM&&t.composedPath&&t.composedPath().includes(this.view))}onKeyDown(t){this.keyDown(gc.convert(t))}onKeyUp(t){this.keyUp(gc.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(pc.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.notPointer||(this.usePointer||(this.usePointer=!0),this.pointerDown(pc.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.notPointer||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=pc.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.notPointer||this.preventWindowPointer(t)||this.pointerUp(pc.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.notMouse||this.pointerDown(pc.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.notMouse||this.preventWindowPointer(t)||this.pointerMove(pc.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.notMouse||this.preventWindowPointer(t)||this.pointerUp(pc.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.notMouse||this.pointerCancel()}onTouchStart(t){const e=pc.getTouch(t),i=this.getLocal(e,!0),{preventDefault:s}=this.config.touch;(!0===s||"auto"===s&&_c(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.notTouch||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(pc.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.notTouch||this.preventWindowPointer(t))return;const e=pc.getTouch(t);this.pointerMove(pc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.notTouch||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout(()=>{this.useTouch=!1},500);const e=pc.getTouch(t);this.pointerUp(pc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.notTouch||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(cd.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},cd.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(t){if(this.useMultiTouch)return;this.preventDefaultWheel(t);const e=cd.getBase(t);Object.assign(e,this.getLocal(t));const i=t.scale/this.lastGestureScale,s=(t.rotation-this.lastGestureRotation)/Math.PI*180*(L.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},e),{scale:i*i})),this.rotate(Object.assign(Object.assign({},e),{rotation:s})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),d(e[e.length-1])&&e.push("default"),this.canvas.view.style.cursor=e.map(t=>d(t)?`url(${t.url}) ${t.x||0} ${t.y||0}`:t).join(",")}eachCursor(t,e,i=0){if(i++,l(t))t.forEach(t=>this.eachCursor(t,e,i));else{const s=n(t)&&Cd.get(t);s&&i<2?this.eachCursor(s,e,i):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}};function mc(t,e,i){t.__.__font?uh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function yc(t,e,i,s,r){const o=i.__;d(t)?uh.drawStrokesStyle(t,e,!1,i,s,r):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&uh.strokeArrow(t,i,s,r)}function vc(t,e,i,s,r){const o=i.__;d(t)?uh.drawStrokesStyle(t,e,!0,i,s,r):(s.setStroke(t,o.__strokeWidth*e,o),uh.drawTextStroke(i,s,r))}function wc(t,e,i,s,r){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,vc(t,2,i,o,r),o.blendMode="outside"===e?"destination-out":"destination-in",uh.fillText(i,o,r),o.blendMode="normal",Ho.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}var xc,{getSpread:bc,copyAndSpread:kc,toOuterOf:Ec,getOuterOf:Sc,getByMove:Bc,move:Tc,getIntersectData:Cc}=It,Oc={},{stintSet:Rc}=g,{hasTransparent:Pc}=lh;function Lc(t,e,i){if(!d(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:o}=i.__layout,{type:a}=e;switch(a){case"image":case"film":case"video":if(!e.url)return;s=ph.image(i,t,e,o,!xc||!xc[e.url]),"image"!==a&&ph[a](s);break;case"linear":s=gh.linearGradient(e,o);break;case"radial":s=gh.radialGradient(e,o);break;case"angular":s=gh.conicGradient(e,o);break;case"solid":const{color:n,opacity:h}=e;s={type:a,style:lh.string(n,h)};break;default:r(e.r)||(s={type:"solid",style:lh.string(e)})}if(s&&(s.originPaint=e,n(s.style)&&Pc(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}var Mc,Dc={compute:function(t,e){const i=e.__,s=[];let r,o,n,a=i.__input[t];l(a)||(a=[a]),xc=ph.recycleImage(t,i);for(let h,l=0,d=a.length;l<d;l++)(h=Lc(t,a[l],e))&&(s.push(h),h.strokeStyle&&(n||(n=1),h.strokeStyle.strokeWidth&&(n=Math.max(n,h.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),o=!0),"fill"===t?(Rc(i,"__isAlphaPixelFill",r),Rc(i,"__isTransparentFill",o)):(Rc(i,"__isAlphaPixelStroke",r),Rc(i,"__isTransparentStroke",o),Rc(i,"__hasMultiStrokeStyle",n))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,mc(e,i,s)},fills:function(t,e,i,s){let r,o,n;for(let a=0,h=t.length;a<h;a++){if(r=t[a],o=r.originPaint,r.image){if(n?n++:n=1,ph.checkImage(r,!e.__.__font,e,i,s))continue;if(!r.style){1===n&&r.image.isPlacehold&&e.drawImagePlaceholder(r,i,s);continue}}if(i.fillStyle=r.style,r.transform||o.scaleFixed){if(i.save(),r.transform&&i.transform(r.transform),o.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0,o.scaleFixed,!1);1!==t&&i.scale(t,s)}o.blendMode&&(i.blendMode=o.blendMode),mc(e,i,s),i.restore()}else o.blendMode?(i.saveBlendMode(o.blendMode),mc(e,i,s),i.restoreBlendMode()):mc(e,i,s)}},fillPathOrText:mc,fillText:function(t,e,i){const s=t.__,{rows:r,decorationY:o}=s.__textDrawData;let n;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let a=0,h=r.length;a<h;a++)n=r[a],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.fillText(t.char,t.x,n.y)});if(o){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>o.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)uh.strokeText(t,e,i,s);else if(r.__pathForStroke)uh.fillStroke(t,e,i,s);else switch(r.strokeAlign){case"center":yc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),yc(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)yc(t,2,e,i,s);else{const{renderBounds:o}=e.__layout,n=i.getSameCanvas(!0,!0);e.__drawRenderPath(n),yc(t,2,e,n,s),n.clipUI(r),n.clearWorld(o),Ho.copyCanvasByWorld(e,i,n),n.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){uh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":vc(t,1,e,i,s);break;case"inside":wc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?vc(t,2,e,i,s):wc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,r=t.__.__textDrawData;const{rows:o,decorationY:n}=r;for(let a=0,h=o.length;a<h;a++)s=o[a],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(n){const{decorationHeight:t}=r;o.forEach(i=>n.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,r,o){let n;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||r.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(n=t[l],(!n.image||!ph.checkImage(n,!1,s,r,o))&&n.style){if(h){const{strokeStyle:t}=n;t?r.setStroke(n.style,a.__getRealStrokeWidth(t)*e,a,t):r.setStroke(n.style,a.__strokeWidth*e,a)}else r.strokeStyle=n.style;n.originPaint.blendMode?(r.saveBlendMode(n.originPaint.blendMode),i?uh.drawTextStroke(s,r,o):r.stroke(),r.restoreBlendMode()):i?uh.drawTextStroke(s,r,o):r.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),r=e.bounds,o=t.__nowWorld,n=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,p;Ec(n.strokeSpread?(kc(Oc,n.boxBounds,n.strokeSpread),Oc):n.boxBounds,o,a);let{scaleX:g,scaleY:_}=t.getRenderScaleData(!0);if(r.includes(a))p=s,h=u=a,l=o;else{let s;s=Gt.fullImageShadow?a:Cc(n.renderShapeSpread?bc(r,x.swapAndScale(n.renderShapeSpread,g,_)):r,a),c=r.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(p=e.getSameCanvas(),t.__renderShape(p,i),g*=f,_*=m),u=Sc(a,c),h=Bc(u,-c.e,-c.f),l=Sc(o,c),Tc(l,-c.e,-c.f);const y=i.matrix;y?(d=new ut(c),d.multiply(y),f*=y.scaleX,m*=y.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:p,shapeBounds:u,scaleX:g,scaleY:_}}},Ac=new Nt,{isSame:Ic}=It;function Wc(t,e,i,s,r,o){let n=!0;const a=t.__;if("fill"!==e||a.__naturalWidth||(a.__naturalWidth=s.width/a.pixelRatio,a.__naturalHeight=s.height/a.pixelRatio,a.__autoSide&&(t.forceUpdate("width"),Ho.updateBounds(t),t.__proxyData&&(t.setProxyAttr("width",a.width),t.setProxyAttr("height",a.height)),n=!1)),!r.data){ph.createData(r,s,i,o);const{transform:t}=r.data,{opacity:e,blendMode:n}=i,h=t&&!t.onlyScale||a.path||a.cornerRadius;(h||e&&e<1||n)&&(r.complex=!h||2)}return i.filter&&ph.applyFilter(r,s,i.filter,t),n}function zc(t,e){Vc(t,Sn.LOAD,e)}function Fc(t,e){Vc(t,Sn.LOADED,e)}function Nc(t,e,i){e.error=i,t.forceUpdate("surface"),Vc(t,Sn.ERROR,e)}function Vc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Sn(e,i))}function Yc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}var{get:Xc,translate:Hc}=G,Uc=new Nt,jc={},Gc={};function Kc(t,e,i,s){const r=n(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&r<0?0:r}var Zc={},qc={a:1,b:0,c:0,d:1,e:0,f:0},{get:$c,set:Jc,rotateOfOuter:Qc,translate:tu,scaleOfOuter:eu,multiplyParent:iu,scale:su,rotate:ru,skew:ou}=G;function nu(t,e,i,s,r,o,n,a){n&&ru(t,n),a&&ou(t,a.x,a.y),r&&su(t,r,o),tu(t,e.x+i,e.y+s)}var{get:au,scale:hu,copy:lu}=G,{getFloorScale:du}=L,{abs:cu}=Math,uu={image:function(t,e,i,s,r){let o,n;const a=qr.get(i,i.type);return Mc&&i===Mc.paint&&Ic(s,Mc.boxBounds)?o=Mc.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Mc=a.use>1?{leafPaint:o,paint:i,boxBounds:Ac.set(s)}:null),(r||a.loading)&&(n={image:a,attrName:e,attrValue:i}),a.ready?(Wc(t,e,i,a,o,s),r&&(zc(t,n),Fc(t,n))):a.error?r&&Nc(t,n,a.error):(r&&(Yc(t,!0),zc(t,n)),o.loadId=a.load(()=>{Yc(t,!1),t.destroyed||(Wc(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Fc(t,n)),o.loadId=void 0},e=>{Yc(t,!1),Nc(t,n,e),o.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,e,i,s,r){const{scaleX:o,scaleY:n}=ph.getImageRenderScaleData(t,i,s,r),a=t.film?t.nowIndex:o+"-"+n,{image:h,data:l,originPaint:d}=t,{exporting:c,snapshot:u}=r;return!(!l||t.patternId===a&&!c||u||(e&&(l.repeat?e=!1:d.changeful||t.film||"miniapp"===Gt.name||c||(e=Gt.image.isLarge(h,o,n)||h.width*o>8096||h.height*n>8096)),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),ph.drawImage(t,o,n,i,s,r),0):(!t.style||d.sync||c?ph.createPattern(t,i,s,r):ph.createPatternTask(t,i,s,r),1)))},drawImage:function(t,e,i,s,r,o){const{data:n,image:a,complex:h}=t;let{width:l,height:d}=a;if(h){const{blendMode:o,opacity:c}=t.originPaint,{transform:u}=n;r.save(),2===h&&r.clipUI(s),o&&(r.blendMode=o),c&&(r.opacity*=c),u&&r.transform(u),a.render(r,0,0,l,d,s,t,e,i),r.restore()}else n.scaleX&&(l*=n.scaleX,d*=n.scaleY),a.render(r,0,0,l,d,s,t,e,i)},getImageRenderScaleData:function(t,e,i,s){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:o}=t;if(i){const{pixelRatio:t}=i;r.scaleX*=t,r.scaleY*=t}return o&&o.scaleX&&(r.scaleX*=Math.abs(o.scaleX),r.scaleY*=Math.abs(o.scaleY)),r},recycleImage:function(t,e){const i=e["_"+t];if(l(i)){let s,r,o,n,a;for(let h=0,d=i.length;h<d;h++)s=i[h],r=s.image,a=r&&r.url,a&&(o||(o={}),o[a]=!0,qr.recyclePaint(s),e.__willDestroy&&r.parent&&ph.recycleFilter(r,e.__leaf),r.loading&&(n||(n=e.__input&&e.__input[t]||[],l(n)||(n=[n])),r.unload(i[h].loadId,!n.some(t=>t.url===a))));return o}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=qr.patternTasker.add(()=>Hd(this,void 0,void 0,function*(){ph.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:o}=ph.getImageRenderScaleData(t,e,i,s),n=t.film?t.nowIndex:r+"-"+o;if(t.patternId!==n&&!e.destroyed&&(!Gt.image.isLarge(t.image,r,o)||t.data.repeat)){const{image:i,data:s}=t,{opacity:a}=t.originPaint,{transform:h,gap:l}=s,d=ph.getPatternFixScale(t,r,o);let c,u,p,{width:g,height:_}=i;d&&(r*=d,o*=d),g*=r,_*=o,l&&(u=l.x*r/cu(s.scaleX||1),p=l.y*o/cu(s.scaleY||1)),(h||1!==r||1!==o)&&(r*=du(g+(u||0)),o*=du(_+(p||0)),c=au(),h&&lu(c,h),hu(c,1/r,1/o));const f=i.getCanvas(g,_,a,void 0,u,p,e.leafer&&e.leafer.config.smooth,s.interlace);t.style=i.getPattern(f,s.repeat||Gt.origin.noRepeat||"no-repeat",c,t),t.patternId=n}},getPatternFixScale:function(t,e,i){const{image:s}=t;let r,o=Gt.image.maxPatternSize,n=s.width*s.height;return s.isSVG?e>1&&(r=Math.ceil(e)/e):o>n&&(o=n),(n*=e*i)>o&&(r=Math.sqrt(o/n)),r},createData:function(t,e,i,s){t.data=ph.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Uc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:r}=i,{mode:o,align:a,offset:l,scale:c,size:u,rotation:p,skew:g,clipSize:_,repeat:f,gap:m,interlace:y}=t,v=e.width===s&&e.height===r,w={mode:o},x="center"!==a&&(p||0)%180==90;let b,k;switch(It.set(Gc,0,0,x?r:s,x?s:r),o&&"cover"!==o&&"fit"!==o?((c||u)&&(L.getScaleData(c,u,i,jc),b=jc.scaleX,k=jc.scaleY),(a||m||f)&&(b&&It.scale(Gc,b,k,!0),a&&kt.toPoint(a,Gc,e,Gc,!0,!0))):v&&!p||(b=k=It.getFitScale(e,Gc,"fit"!==o),It.put(e,i,a,b,!1,Gc),It.scale(Gc,b,k,!0)),l&&ot.move(Gc,l),o){case"stretch":v?b&&(b=k=void 0):(b=e.width/s,k=e.height/r,ph.stretchMode(w,e,b,k));break;case"normal":case"clip":if(Gc.x||Gc.y||b||_||p||g){let t,i;_&&(t=e.width/_.width,i=e.height/_.height),ph.clipMode(w,e,Gc.x,Gc.y,b,k,p,g,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||p||g)&&ph.repeatMode(w,e,s,r,Gc.x,Gc.y,b,k,p,g,a,t.freeTransform),f||(w.repeat="repeat");const i=d(f);(m||i)&&(w.gap=function(t,e,i,s,r){let o,n;return d(t)?(o=t.x,n=t.y):o=n=t,{x:Kc(o,i,r.width,e&&e.x),y:Kc(n,s,r.height,e&&e.y)}}(m,i&&f,Gc.width,Gc.height,e));break;default:b&&ph.fillOrFitMode(w,e,Gc.x,Gc.y,b,k,p)}return w.transform||(e.x||e.y)&&Hc(w.transform=Xc(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=k),f&&(w.repeat=n(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),y&&(w.interlace=h(y)||"percent"===y.type?{type:"x",offset:y}:y),w},stretchMode:function(t,e,i,s){const r=$c(),{x:o,y:n}=e;o||n?tu(r,o,n):i>0&&s>0&&(r.onlyScale=!0),su(r,i,s),t.transform=r},fillOrFitMode:function(t,e,i,s,r,o,n){const a=$c();tu(a,e.x+i,e.y+s),su(a,r,o),n&&Qc(a,{x:e.x+e.width/2,y:e.y+e.height/2},n),t.transform=a},clipMode:function(t,e,i,s,r,o,n,a,h,l){const d=$c();nu(d,e,i,s,r,o,n,a),h&&(n||a?(Jc(qc),eu(qc,e,h,l),iu(d,qc)):eu(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,r,o,n,a,h,l,d,c){const u=$c();if(c)nu(u,e,r,o,n,a,h,l);else{if(h)if("center"===d)Qc(u,{x:i/2,y:s/2},h);else switch(ru(u,h),h){case 90:tu(u,s,0);break;case 180:tu(u,i,s);break;case 270:tu(u,0,i)}Zc.x=e.x+r,Zc.y=e.y+o,tu(u,Zc.x,Zc.y),n&&eu(u,Zc,n,a)}t.transform=u}},{toPoint:pu}=ft,{hasTransparent:gu}=lh,_u={},fu={};function mu(t,e,i,s){if(i){let r,o,a,h;for(let t=0,l=i.length;t<l;t++)r=i[t],n(r)?(a=t/(l-1),o=lh.string(r,s)):(a=r.offset,o=lh.string(r.color,s)),e.addColorStop(a,o),!h&&gu(o)&&(h=!0);h&&(t.isTransparent=!0)}}var{getAngle:yu,getDistance:vu}=ot,{get:wu,rotateOfOuter:xu,scaleOfOuter:bu}=G,{toPoint:ku}=ft,Eu={},Su={};function Bu(t,e,i,s,r){let o;const{width:n,height:a}=t;if(n!==a||s){const t=yu(e,i);o=wu(),r?(bu(o,e,n/a*(s||1),1),xu(o,e,t+90)):(bu(o,e,1,n/a*(s||1)),xu(o,e,t))}return o}var{getDistance:Tu}=ot,{toPoint:Cu}=ft,Ou={},Ru={},Pu={linearGradient:function(t,e){let{from:i,to:s,type:r,opacity:o}=t;pu(i||"top",e,_u),pu(s||"bottom",e,fu);const n=Gt.canvas.createLinearGradient(_u.x,_u.y,fu.x,fu.y),a={type:r,style:n};return mu(a,n,t.stops,o),a},radialGradient:function(t,e){let{from:i,to:s,type:r,opacity:o,stretch:n}=t;ku(i||"center",e,Eu),ku(s||"bottom",e,Su);const a=Gt.canvas.createRadialGradient(Eu.x,Eu.y,0,Eu.x,Eu.y,vu(Eu,Su)),h={type:r,style:a};mu(h,a,t.stops,o);const l=Bu(e,Eu,Su,n,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:r,opacity:o,rotation:n,stretch:a}=t;Cu(i||"center",e,Ou),Cu(s||"bottom",e,Ru);const h=Gt.conicGradientSupport?Gt.canvas.createConicGradient(n?n*D:0,Ou.x,Ou.y):Gt.canvas.createRadialGradient(Ou.x,Ou.y,0,Ou.x,Ou.y,Tu(Ou,Ru)),l={type:r,style:h};mu(l,h,t.stops,o);const d=Bu(e,Ou,Ru,a||1,Gt.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Bu},{copy:Lu,move:Mu,toOffsetOutBounds:Du}=It,{max:Au,abs:Iu}=Math,Wu={},zu=new ut,Fu={};function Nu(t,e){let i,s,r,o,n=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,o=1.5*(t.blur||0),r=Iu(t.spread||0),n=Au(n,r+o-s),a=Au(a,r+o+i),h=Au(h,r+o+s),l=Au(l,r+o-i)}),n===a&&a===h&&h===l?n:[n,a,h,l]}function Vu(t,e,i){const{shapeBounds:s}=i;let r,o;Gt.fullImageShadow?(Lu(Wu,t.bounds),Mu(Wu,e.x-s.x,e.y-s.y),r=t.bounds,o=Wu):(r=s,o=e),t.copyWorld(i.canvas,r,o)}var Yu,{toOffsetOutBounds:Xu}=It,Hu={},Uu={shadow:function(t,e,i){let s,r;const{__nowWorld:o}=t,{shadow:n}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),g=n.length-1;Du(h,Fu,l),n.forEach((n,_)=>{let f=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}p.setWorldShadow(Fu.offsetX+(n.x||0)*c*f,Fu.offsetY+(n.y||0)*u*f,(n.blur||0)*c*f,lh.string(n.color)),r=_h.getShadowTransform(t,p,i,n,Fu,f),r&&p.setTransform(r),Vu(p,Fu,i),r&&p.resetTransform(),s=l,n.box&&(p.restore(),p.save(),a&&(p.copyWorld(p,l,o,"copy"),s=o),a?p.copyWorld(a,o,o,"destination-out"):p.copyWorld(i.canvas,d,h,"destination-out")),Ho.copyCanvasByWorld(t,e,p,s,n.blendMode),g&&_<g&&p.clearWorld(s)}),p.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:o}=t,{innerShadow:n}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),g=n.length-1;Xu(h,Hu,l),n.forEach((n,_)=>{let f=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(Hu.offsetX+(n.x||0)*c*f,Hu.offsetY+(n.y||0)*u*f,(n.blur||0)*c*f),r=_h.getShadowTransform(t,p,i,n,Hu,f,!0),r&&p.setTransform(r),Vu(p,Hu,i),p.restore(),a?(p.copyWorld(p,l,o,"copy"),p.copyWorld(a,o,o,"source-out"),s=o):(p.copyWorld(i.canvas,d,h,"source-out"),s=l),p.fillWorld(s,lh.string(n.color),"source-in"),Ho.copyCanvasByWorld(t,e,p,s,n.blendMode),g&&_<g&&p.clearWorld(s)}),p.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:Nu,getShadowTransform:function(t,e,i,s,r,o,n){if(s.spread){const i=2*s.spread*o*(n?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return zu.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+i/a,1+i/h),zu}},isTransformShadow(t){},getInnerShadowSpread:Nu},{excludeRenderBounds:ju}=Qo;function Gu(t,e,i,s,r,o,n,a){switch(e){case"grayscale":Yu||(Yu=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,r,o){const n=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,n),o&&s.recycle(n),Zu(t,e,i,1,r,o)}(t,i,s,r,n,a);break;case"opacity-path":Zu(t,i,s,o,n,a);break;case"path":a&&i.restore()}}function Ku(t){return t.getSameCanvas(!1,!0)}function Zu(t,e,i,s,r,o){const n=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,n,void 0,r),o?i.recycle(n):i.clearWorld(n)}Yh.prototype.__renderMask=function(t,e){let i,s,r,o,n,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){n&&(Gu(this,n,t,r,s,o,void 0,!0),s=r=null),"clipping"!==a&&"clipping-path"!==a||ju(i,e)||i.__render(t,e),o=i.__.opacity,Yu=!1,"path"===a||"clipping-path"===a?(o<1?(n="opacity-path",r||(r=Ku(t))):(n="path",t.save()),i.__clip(r||t,e)):(n="grayscale"===a?"grayscale":"alpha",s||(s=Ku(t)),r||(r=Ku(t)),i.__render(s,e));continue}const d=1===o&&i.__.__blendMode;d&&Gu(this,n,t,r,s,o,void 0,!1),ju(i,e)||i.__render(r||t,e),d&&Gu(this,n,t,r,s,o,d,!1)}Gu(this,n,t,r,s,o,void 0,!0)};var 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 $u(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}var Ju,Qu=$u("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),tp=$u("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ep=$u(">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰"),ip=$u(">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰_#~&*+\\=|≮≯≈≠=…"),sp=$u("- —/~|┆·");!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"}(Ju||(Ju={}));var{Letter:rp,Single:op,Before:np,After:ap,Symbol:hp,Break:lp}=Ju;function dp(t){return Qu[t]?rp:sp[t]?lp:tp[t]?np:ep[t]?ap:ip[t]?hp:qu.test(t)?op:rp}var cp={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let o=r-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function up(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}}var pp,gp,_p,fp,mp,yp,vp,wp,xp,bp,kp,Ep,Sp,Bp,Tp,Cp,Op,{trimRight:Rp}=cp,{Letter:Pp,Single:Lp,Before:Mp,After:Dp,Symbol:Ap,Break:Ip}=Ju,Wp=[];function zp(t,e){xp&&!wp&&(wp=xp),pp.data.push({char:t,width:e}),_p+=e}function Fp(){fp+=_p,pp.width=_p,gp.words.push(pp),pp={data:[]},_p=0}function Np(){Bp&&(Tp.paraNumber++,gp.paraStart=!0,Bp=!1),xp&&(gp.startCharSize=wp,gp.endCharSize=xp,wp=0),gp.width=fp,Cp.width?Rp(gp):Op&&Vp(),Wp.push(gp),gp={words:[]},fp=0}function Vp(){fp>(Tp.maxWidth||0)&&(Tp.maxWidth=fp)}var{top:Yp,right:Xp,bottom:Hp,left:Up}=U;function jp(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let o=0;o<r.length;o++)r[o][e]+=i}Object.assign(hh,{getDrawData:function(t,e){n(t)||(t=String(t));let i=0,s=0,r=e.__getInput("width")||0,o=e.__getInput("height")||0;const{__padding:a}=e;a&&(r?(i=a[Up],r-=a[Xp]+a[Up],!r&&(r=.01)):e.autoSizeAlign||(i=a[Up]),o?(s=a[Yp],o-=a[Yp]+a[Hp],!o&&(o=.01)):e.autoSizeAlign||(s=a[Yp]));const h={bounds:{x:i,y:s,width:r,height:o},rows:[],paraNumber:0,font:Gt.canvas.font=e.__font};return function(t,e,i){Tp=t,Wp=t.rows,Op=!(Cp=t.bounds).width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:r,textCase:o}=i,{canvas:n}=Gt,{width:a}=Cp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;Bp=!0,kp=null,wp=vp=xp=_p=fp=0,pp={data:[]},gp={words:[]};for(let i=0,l=(e=[...e]).length;i<l;i++)"\n"===(yp=e[i])?(_p&&Fp(),gp.paraEnd=!0,Np(),Bp=!0):((bp=dp(yp))===Pp&&"none"!==o&&(yp=up(yp,o,!_p)),vp=n.measureText(yp).width,s&&(s<0&&(xp=vp),vp+=s),Ep=bp===Lp&&(kp===Lp||kp===Pp)||kp===Lp&&bp!==Dp,Sp=!(bp!==Mp&&bp!==Lp||kp!==Ap&&kp!==Dp),mp=Bp&&r?a-r:a,t&&a&&fp+_p+vp>mp&&(h?(_p&&Fp(),fp&&Np()):(Sp||(Sp=bp===Pp&&kp==Dp),Ep||Sp||bp===Ip||bp===Mp||bp===Lp||_p+vp>mp?(_p&&Fp(),fp&&Np()):fp&&Np()))," "===yp&&!0!==Bp&&fp+_p===0||(bp===Ip?(" "===yp&&_p&&Fp(),zp(yp,vp),Fp()):Ep||Sp?(_p&&Fp(),zp(yp,vp)):zp(yp,vp)),kp=bp);_p&&Fp(),fp&&Np(),Wp.length>0&&(Wp[Wp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Tp.paraNumber++,fp=n.measureText(t).width,Wp.push({x:r||0,text:t,width:fp,paraStart:!0}),Op&&Vp()})}(h,t,e),a&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":jp(e,"x",t[Up]);break;case"right":jp(e,"x",-t[Xp])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":jp(e,"y",t[Yp]);break;case"bottom":jp(e,"y",-t[Hp])}}(a,h,e,r,o),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:o,__baseLine:n,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:p,y:g,width:_,height:f}=s,m=o*r+(c?c*(t.paraNumber-1):0),y=n;if(h&&m>f)m=Math.max(e.__autoHeight?m:f,o),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":g+=(f-m)/2;break;case"bottom":g+=f-m}y+=g;let v,w,x,b=_||u?_:t.maxWidth;for(let k=0,E=r;k<E;k++){if(v=i[k],v.x=p,v.width<_||v.width>_&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&k>0&&(y+=c),v.y=y,y+=o,t.overflow>k&&y>m&&(v.isOverflow=!0,t.overflow=k+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&_&&_<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=m}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:o,__letterSpacing:n}=e,a=i&&r.includes("both"),h=a||i&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,p,g,_,f,m,y,v;s.forEach(t=>{t.words&&(g=o&&t.paraStart?o:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-g,l?p=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),_=n||t.isOverflow||l?0:u?1:2,t.isOverflow&&!n&&(t.textMode=!0),2===_?(t.x+=g,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=g,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===_?(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&&p),v&&(y=i===m-1,u?y||(d+=u,t.width+=u):p&&(t.width+=p*(e.data.length-(y?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,i,s){const{rows:r,overflow:o}=t;let{textOverflow:n}=e;if(o&&r.splice(o),s&&n&&"show"!==n){let t,a;"hide"===n?n="":"ellipsis"===n&&(n="...");const h=n?Gt.canvas.measureText(n).width:0,l=i+s-h;("none"===e.textWrap?r:[r[o-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<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:n,x:a}),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:o}=e;switch(t.decorationHeight=r/11,d(o)?(i=o.type,o.color&&(t.decorationColor=lh.string(o.color)),o.offset&&(s=Math.min(.3*r,Math.max(o.offset,.15*-r)))):i=o,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}}),Object.assign(lh,{string:function(t,e){if(!t)return"#000";const i=h(e)&&e<1;if(n(t)){if(!i||!lh.object)return t;t=lh.object(t)}let s=r(t.a)?1:t.a;i&&(s*=e);const o=t.r+","+t.g+","+t.b;return 1===s?"rgb("+o+")":"rgba("+o+","+s+")"}}),Object.assign(uh,Dc),Object.assign(ph,uu),Object.assign(gh,Pu),Object.assign(_h,Uu),Object.assign(re,{interaction:(t,e,i,s)=>new fc(t,e,i,s),hitCanvas:(t,e)=>new jd(t,e),hitCanvasManager:()=>new Od}),Gt.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const s=Yr.mimeType(e),r=t.toDataURL(s,i);return"image/bmp"===s?r.replace("image/png;","image/bmp;"):r},canvasToBolb:(t,e,i)=>new Promise(s=>t.toBlob(s,Yr.mimeType(e),i)),canvasSaveAs:(t,e,i)=>{const s=t.toDataURL(Yr.mimeType(Yr.fileType(e)),i);return Gt.origin.download(s,e)},download(t,e){return Hd(this,void 0,void 0,function*(){let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i)})},loadImage:(t,e,i)=>new Promise((i,s)=>{const r=new Gt.origin.Image;e&&(r.setAttribute("crossOrigin",e),r.crossOrigin=e),r.onload=()=>{i(r)},r.onerror=t=>{s(t)},r.src=Gt.image.getRealURL(t)}),loadContent(t){return Hd(this,arguments,void 0,function*(t,e="text"){const i=yield fetch(t);if(!i.ok)throw new Error(`${i.status}`);return yield i[e]()})},Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},Gt.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},Gt.canvas=re.canvas(),Gt.conicGradientSupport=!!Gt.canvas.context.createConicGradient;var{M:Gp,L:Kp,C:Zp,Q:qp,Z:$p,N:Jp,D:Qp,X:tg,G:eg,F:ig,O:sg,P:rg,U:og}=Re,ng={scale(t,e,i){if(!t)return;let s,r=0,o=t.length;for(;r<o;)switch(s=t[r],s){case Gp:case Kp:ag(t,e,i,r,1),r+=3;break;case Zp:ag(t,e,i,r,3),r+=7;break;case qp:ag(t,e,i,r,2),r+=5;break;case $p:r+=1;break;case Jp:ag(t,e,i,r,2),r+=5;break;case Qp:ag(t,e,i,r,2),r+=9;break;case tg:ag(t,e,i,r,2),r+=6;break;case eg:ag(t,e,i,r,2),r+=9;break;case ig:ag(t,e,i,r,2),r+=5;break;case sg:t[r]=eg,t.splice(r+4,0,t[r+3],0),ag(t,e,i,r,2),r+=9,o+=2;break;case rg:t[r]=ig,t.splice(r+4,0,t[r+3]),ag(t,e,i,r,2),r+=5,o+=1;break;case og:ag(t,e,i,r,2),r+=6}},scalePoints(t,e,i,s,r){for(let o=r?s+1:0,n=r?o+2*r:t.length;o<n;o+=2)t[o]*=e,t[o+1]*=i}},{scalePoints:ag}=ng,hg=G.get(),{topLeft:lg,top:dg,topRight:cg,right:ug,bottom:pg,left:gg}=j;function _g(t,e,i){t.pathInputed?mg(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function fg(t,e,i,s){let o=e;if(!r(s)){const r=t.__layout;let{width:n,height:a}=r.boxBounds;switch(n*=i-e,a*=e-i,s){case dg:case pg:o=i,r.affectScaleOrRotation?t.moveInner(-n/2,0):t.x-=n/2;break;case gg:case ug:r.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case lg:case cg:r.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=o;const n=t.__,{padding:a,lineHeight:h,letterSpacing:c}=n;a&&(t.padding=l(a)?a.map(t=>t*o):a*o),n.__autoWidth||(t.width*=o),n.__autoHeight||(t.height*=o),d(h)?"px"===h.type&&(n.lineHeight={type:"px",value:h.value*o}):h&&(n.lineHeight=h*o),d(c)?"px"===c.type&&(n.letterSpacing={type:"px",value:c.value*o}):c&&(n.letterSpacing=c*o)}function mg(t,e,i){ng.scale(t.__.path,e,i),t.path=t.__.path}function yg(t,e,i){const{points:s}=t;d(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):ng.scalePoints(s,e,i),t.points=s}function vg(t,e,i){const{children:s}=t;for(let r=0;r<s.length;r++)hg.a=e,hg.d=i,s[r].transform(hg,!0)}var wg=ja.prototype;function xg(t,e,i,s){var r,o=arguments.length,n=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,i,n):r(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n}function bg(t){return t?l(t)?t:[t]:[]}wg.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},wg.__scaleResize=function(t,e){_g(this,t,e)},wg.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},wg.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Ml.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,r=i&&i.editor,o=r&&r.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||o&&"font-size"===r.mergedConfig.editSize)fg(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:r,verticalAlign:o}=this.__,{boxBounds:n}=this.__layout;i&&"left"!==r&&1!==t&&(this.x+=n.x),s&&"top"!==o&&1!==e&&(this.y+=n.y),_g(this,t,e)}},Dl.prototype.__scaleResize=function(t,e){mg(this,t,e)},Sl.prototype.__scaleResize=function(t,e){this.pathInputed?mg(this,t,e):this.points?yg(this,t,e):this.width*=t},dl.prototype.__scaleResize=function(t,e){this.pathInputed?mg(this,t,e):this.points?yg(this,t,e):_g(this,t,e)},Yh.prototype.__scaleResize=function(t,e){vg(this,t,e)},$h.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||_g(this,t,e),i&&vg(this,t,e)},se.add("resize");var kg=class extends wn{get list(){return bg(this.value)}get oldList(){return bg(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}};function Eg(t){return(e,i)=>{const s="_"+i;eo(e,i,{get(){return this[s]},set(e){const r=this[s];if(r!==e){const o=this;if(o.config){const t="target"===i;if(t){const{beforeSelect:t}=o.config;if(t){const i=t({target:e});if(d(i))e=i;else if(!1===i)return}o.hasDimOthers&&o.cancelDimOthers(),l(e)&&e.length>1&&e[0].locked&&e.splice(0,1),o.single&&(delete o.element.syncEventer,delete o.element.__world.ignorePixelSnap)}const s=t?kg.BEFORE_SELECT:kg.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new kg(s,{editor:o,value:e,oldValue:r}))}this[s]=e,t(this,r)}}})}}kg.BEFORE_SELECT="editor.before_select",kg.SELECT="editor.select",kg.AFTER_SELECT="editor.after_select",kg.BEFORE_HOVER="editor.before_hover",kg.HOVER="editor.hover";var{abs:Sg}=Math,{copy:Bg}=G,{setListWithFn:Tg}=It,{worldBounds:Cg}=Qo,Og={a:1,b:0,c:0,d:1,e:0,f:0},Rg={x:0,y:0,width:0,height:0},Pg=class extends Nh{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(Tg(Rg,e,Cg),t&&this.set(t),this.set(Rg),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const r=this.__,{stroke:o,strokeWidth:a,fill:h}=r,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=Sg(c.scaleX),l=Sg(c.scaleY);if(Bg(Og,c),Og.half=a%2,t.setWorld(Og,e.matrix),t.beginPath(),"path"===this.strokePathType||s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),r.strokeWidth=a/Math.max(i,l),r.shadow){const e=r.shadow[0],{scaleX:i,scaleY:s}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*s,e.blur*i,lh.string(e.color))}o&&(n(o)?uh.stroke(o,this,t,e):uh.strokes(o,this,t,e)),h&&(n(h)?uh.fill(h,this,t,e):uh.fills(h,this,t,e)),r.shadow&&t.restore()}}r.strokeWidth=a}}destroy(){this.target=null,super.destroy()}};xg([Eg(function(t){const e=t.target;t.list=e?l(e)?e:[e]:[]})],Pg.prototype,"target",void 0),xg([mo("render-path")],Pg.prototype,"strokePathType",void 0);var Lg=class extends Yh{constructor(t){super(t),this.strokeArea=new Uh({strokeAlign:"center"}),this.fillArea=new Uh,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:r}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:r},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}},Mg={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return Dg([t],i,e),i}};function Dg(t,e,i){let s,r;for(let o=0,n=t.length;o<n;o++)if(s=t[o],r=s.__,r.hittable&&r.visible&&!r.locked&&i.hit(s.__world)){if(r.editable){if(s.isBranch&&!r.hitChildren){r.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&r.hitSelf&&e.push(s)}s.isBranch&&Dg(s.children,e,i)}}var{findOne:Ag,findByBounds:Ig}=Mg,Wg=class extends Yh{get dragging(){return!!this.originList}get running(){const{editor:t,app:e}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector&&e&&"normal"===e.mode}get isMoveMode(){const{app:t}=this;return t&&t.interaction.moveMode}constructor(t){super(),this.hoverStroker=new Pg,this.targetStroker=new Pg,this.bounds=new Nt,this.selectArea=new Lg,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{hoverTarget:e,mergeConfig:i}=t,s=Object.assign({},i);e&&e.editConfig&&Object.assign(s,e.editConfig);const{stroke:r,strokeWidth:o,hover:n,hoverStyle:a}=s;this.hoverStroker.setTarget(n?e:null,Object.assign({stroke:r,strokeWidth:o},a||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedPathType:i,selectedStyle:s}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2),strokePathType:i},s||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i,selectKeep:s}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(s||(e.target=null))}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?(this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i,t.path.needUpdate=!0):this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||this.editor.mergedConfig.selectKeep||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:r,y:o}=t.getInnerPoint(this);this.bounds.set(r,o),this.selectArea.setStyle({visible:!0,stroke:i,x:r,y:o},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),r=new sh(Ig(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),r.length){const t=[];this.originList.forEach(e=>{r.has(e)||t.push(e)}),r.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!Ag(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new sh(this.editor.editBox.rect)};return Ag(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Ag(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[kg.HOVER,this.onHover,this],[kg.SELECT,this.onSelect,this]]),e.on_([[ed.MOVE,this.onPointerMove,this],[ed.BEFORE_DOWN,this.onBeforeDown,this],[ed.TAP,this.onTap,this],[sd.START,this.onDragStart,this,!0],[sd.DRAG,this.onDrag,this],[sd.END,this.onDragEnd,this],[od.MOVE,this.onAutoMove,this],[[ld.ZOOM,od.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}},{topLeft:zg,top:Fg,topRight:Ng,right:Vg,bottomRight:Yg,bottom:Xg,bottomLeft:Hg,left:Ug}=j,{toPoint:jg}=ft,{within:Gg,sign:Kg}=L,{abs:Zg}=Math,qg={getScaleData(t,e,i,s,r,o,n,a){let l,d,c={},u=1,p=1;const{boxBounds:g,widthRange:_,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,k=Kg(x),E=Kg(b),S=a?x:k*g.width/v,B=a?b:E*g.height/w;if(h(s))u=p=Math.sqrt(s);else{o&&(s.x*=2,s.y*=2),s.x*=a?x:k,s.y*=a?b:E;const t=(-s.y+w)/w,e=(s.x+v)/v,n=(s.y+w)/w,h=(-s.x+v)/v;switch(i){case Fg:p=t,l="bottom";break;case Vg:u=e,l="left";break;case Xg:p=n,l="top";break;case Ug:u=h,l="right";break;case zg:p=t,u=h,l="bottom-right";break;case Ng:p=t,u=e,l="bottom-left";break;case Yg:p=n,u=e,l="top-left";break;case Hg:p=n,u=h,l="top-right"}if(r)if("corner"===r&&i%2)r=!1;else switch(i){case Fg:case Xg:u=p;break;case Ug:case Vg:p=u;break;default:d=Math.sqrt(Zg(u*p)),u=Kg(u)*d,p=Kg(p)*d}}const T=1!==u,C=1!==p;if(T&&(u/=S),C&&(p/=B),!n){const{worldTransform:e}=t;u<0&&(u=1/g.width/e.scaleX),p<0&&(p=1/g.height/e.scaleY)}if(jg(o||l,g,c,!0),m){const e={x:u,y:p};Ql.limitScaleOf(t,c,e,r),u=e.x,p=e.y}if(T&&_){const e=g.width*t.scaleX;u=Gg(e*u,_)/e}if(C&&f){const e=g.height*t.scaleY;p=Gg(e*p,f)/e}return T&&Zg(u*y.width)<1&&(u=Kg(u)/y.width),C&&Zg(p*y.height)<1&&(p=Kg(p)/y.height),r&&u!==p&&(d=Math.min(Zg(u),Zg(p)),u=Kg(u)*d,p=Kg(p)*d),isFinite(u)||(u=1),isFinite(p)||(p=1),{origin:c,scaleX:u,scaleY:p,direction:i,lockRatio:r,around:o}},getRotateData(t,e,i,s,r){let o,n={};switch(e){case zg:o="bottom-right";break;case Ng:o="bottom-left";break;case Yg:o="top-left";break;case Hg:o="top-right";break;default:o="center"}return jg(r||o,t.boxBounds,n,!0),{origin:n,rotation:ot.getRotation(s,t.getWorldPointByBox(n),i)}},getSkewData(t,e,i,s){let r,o,n={},a=0,h=0;switch(e){case Fg:case zg:o={x:.5,y:0},r="bottom",a=1;break;case Xg:case Yg:o={x:.5,y:1},r="top",a=1;break;case Ug:case Hg:o={x:0,y:.5},r="right",h=1;break;case Vg:case Ng:o={x:1,y:.5},r="left",h=1}const{width:l,height:d}=t;o.x=o.x*l,o.y=o.y*d,jg(s||r,t,n,!0);const c=ot.getRotation(o,n,{x:o.x+(a?i.x:0),y:o.y+(h?i.y:0)});return a?a=-c:h=c,{origin:n,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case Ug:t=Vg;break;case zg:t=Ng;break;case Hg:t=Yg;break;case Vg:t=Ug;break;case Ng:t=zg;break;case Yg:t=Hg}if(i)switch(t){case Fg:t=Xg;break;case zg:t=Hg;break;case Ng:t=Yg;break;case Xg:t=Fg;break;case Hg:t=zg;break;case Yg:t=Ng}return t}},$g={};function Jg(t,e){const{enterPoint:i,dragging:s,skewing:r,resizing:o,flippedX:n,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return Qg(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:p,moveable:g,resizeable:_,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(g||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!_)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?r?p:o?c:u:v?p:y?c:u;h+=45*(qg.getFlipDirection(i.direction,n,a)+1),h=2*Math.round(L.formatRotation(h,!0)/2);const{url:x,x:b,y:k}=w,E=x+h;$g[E]?i.cursor=$g[E]:$g[E]=i.cursor={url:t_(x,h),x:b,y:k}}function Qg(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function t_(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}var e_=class extends $h{constructor(t){super(t),this.useFastShadow=!0}},i_=["top","right","bottom","left"],s_=void 0,r_=class extends Yh{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.app&&this.editor.editing}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return n(t)||n(e)||n(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Yh,this.rect=new e_({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new e_({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Yh({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:r,rotatePoints:o,resizeLines:n,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let c=0;c<8;c++)t=new e_({name:"rotate-point",around:d[c],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",c),c%2&&(e=new e_({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),n.push(e),this.listenPointEvents(e,"resize",c)),i=new e_({name:"resize-point",hitRadius:5}),r.push(i),this.listenPointEvents(i,"resize",c);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...o,a,h,l,...n,...r),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:r,resizePoints:n,resizeLines:a}=this,{stroke:h,strokeWidth:l,ignorePixelSnap:d}=e,c=this.getPointsStyle(),u=this.getMiddlePointsStyle(),p=this.getResizeLinesStyle();let _;this.visible=!t.locked;for(let o=0;o<8;o++)_=n[o],_.set(this.getPointStyle(o%2?u[(o-1)/2%u.length]:c[o/2%c.length])),_.rotation=(o-(o%2?1:0))/2*90,o%2&&a[(o-1)/2].set(Object.assign({pointType:"resize",rotation:(o-1)/2*90},p[(o-1)/2%p.length]||{}));r.set(this.getPointStyle(e.circle||e.rotatePoint||c[0])),s.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:s_},e.rect||{}));const f=o(e.rectThrough)?i:e.rectThrough;s.hittable=!f,f&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),i&&g.stintSet(t.__world,"ignorePixelSnap",d),Qg(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:r,rotation:o,skewX:n,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:r,rotation:o,skewX:n,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editor:e,mergeConfig:i,single:s,rect:o,circle:n,buttons:a,resizePoints:l,rotatePoints:d,resizeLines:c}=this,{editMask:u}=e,{middlePoint:p,resizeable:g,rotateable:_,hideOnSmall:f,editBox:m,mask:y,dimOthers:v,bright:w,spread:x,hideRotatePoints:b,hideResizeLines:k}=i;if(u.visible=!!y||0,r(v)&&r(w)?e.hasDimOthers&&e.cancelDimOthers():(e.setDimOthers(v),e.setBright(!!v||w),e.hasDimOthers=!0),x&&It.spread(t,x),this.view.worldOpacity){const{width:e,height:r}=t,u=h(f)?f:10,y=m&&!(f&&e<u&&r<u);let v,w,x,E={};for(let i=0;i<8;i++)ft.toPoint(ft.directionData[i],t,E),w=l[i],v=d[i],w.set(E),v.set(E),w.visible=y&&!(!g&&!_),v.visible=y&&_&&g&&!b,i%2&&(x=c[(i-1)/2],x.set(E),x.visible=w.visible&&!k,w.visible&&(w.visible=!!p),v.visible&&(v.visible=!!p),(i+1)/2%2?(x.width=e+x.height,f&&2*w.width>e&&(w.visible=!1)):(x.width=r+x.height,f&&2*w.width>r&&(w.visible=!1)));n.visible=y&&_&&!(!i.circle&&!i.rotatePoint),n.visible&&this.layoutCircle(),o.path&&(o.path=null),o.set(Object.assign(Object.assign({},t),{visible:!s||m})),a.visible=y&&a.children.length>0||0,a.visible&&this.layoutButtons()}else o.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:r}=this.mergedConfig,o=i_.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,o,e||i,!!r)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:r}=this.mergedConfig,{flippedX:o,flippedY:n}=this;let a=i_.indexOf(e);(a%2&&o||(a+1)%2&&n)&&i&&(a=(a+2)%4);const h=i?qg.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!r),i&&(t.rotation=90*(h-a)),t.scaleX=o?-1:1,t.scaleY=n?-1:1}setButtonPosition(t,e,i,s){const r=this.resizePoints[2*e+1],o=e%2,n=e&&3!==e?1:-1,a=(i+(e%2?(s?r.width:0)+t.boxBounds.width:(s?r.height:0)+t.boxBounds.height)/2)*n;o?(t.x=r.x+a,t.y=r.y):(t.x=r.x,t.y=r.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:r,pointRadius:o}=this.mergedConfig,n={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",opacity:1,width:r,height:r,cornerRadius:o,offsetX:0,offsetY:0,editConfig:s_};return t?Object.assign(n,t):n}getPointsStyle(){const{point:t}=this.mergedConfig;return l(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return l(t)?t:t?[t]:this.getPointsStyle()}getResizeLinesStyle(){const{resizeLine:t}=this.mergedConfig;return l(t)?t:[t]}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:r,rotateable:o,skewable:n,onCopy:a}=this.mergeConfig;"move"===i?(t.altKey&&a&&a()&&this.editor.single&&this.app.interaction.replaceDownTarget(this.target),s&&(this.moving=!0)):(i.includes("rotate")||this.isHoldRotateKey(t)||!r?(o&&(this.rotating=!0),"resize-rotate"===i?r&&(this.resizing=!0):"resize-line"===e.name&&(n&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&r&&(this.resizing=!0),"skew"===i&&n&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:r,skewing:o}=this;if(i)e.onMove(t);else if(s||r||o){const i=t.current;i.pointType&&(this.enterPoint=i),r&&e.onRotate(t),s&&e.onScale(t),o&&e.onSkew(t)}Jg(this,t)}onDragEnd(t){this.onTransformEnd(t),this.dragPoint=null}onTransformStart(t){(this.moving||this.gesturing)&&(this.editor.opacity=this.mergedConfig.hideOnMove?0:1),this.resizing&&(Ln.resizingKeys=this.editor.leafList.keys);const{dragStartData:e,target:i}=this;e.x=t.x,e.y=t.y,e.totalOffset={x:0,y:0},e.point={x:i.x,y:i.y},e.bounds=Object.assign({},i.getLayoutBounds("box","local")),e.rotation=i.rotation}onTransformEnd(t){this.canDragLimitAnimate&&(t instanceof sd||t instanceof od)&&this.transformTool.onMove(t),this.resizing&&(Ln.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.editor.update()}onMove(t){if(this.canGesture&&"drag"!==t.moveType&&(t.stop(),n(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,t.type){case od.START:this.onTransformStart(t);break;case od.END:this.onTransformEnd(t);break;default:this.transformTool.onMove(t)}}onScale(t){if(this.canGesture&&(t.stop(),n(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,t.type){case ld.START:this.onTransformStart(t);break;case ld.END:this.onTransformEnd(t);break;default:this.transformTool.onScale(t)}}onRotate(t){if(this.canGesture&&(t.stop(),n(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,t.type){case ld.START:this.onTransformStart(t);break;case ld.END:this.onTransformEnd(t);break;default:this.transformTool.onRotate(t)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){Jg(this,t)}onArrow(t){if(this.canUse){let e=0,i=0;switch(t.code){case"ArrowDown":i=1;break;case"ArrowUp":i=-1;break;case"ArrowLeft":e=-1;break;case"ArrowRight":e=1}if(e||i){const{keyEvent:s,arrowStep:r,arrowFastStep:o}=this.mergeConfig;if(s){const s=t.shiftKey?o:r;this.transformTool.move(e*s,i*s)}}}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof Ml)||t.find(t=>t instanceof Ml);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e,this.__eventIds.push(t.on_([[sd.START,this.onDragStart,this],[sd.DRAG,this.onDrag,this],[sd.END,this.onDragEnd,this],[ed.ENTER,e=>{this.enterPoint=t,Jg(this,e)}],[ed.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[ed.DOUBLE_TAP,this.onDoubleTap,this],[ed.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[dd.HOLD,dd.UP],this.onKey,this],[dd.DOWN,this.onArrow,this],[[od.START,od.BEFORE_MOVE,od.END],this.onMove,this,!0],[[ld.START,ld.BEFORE_ZOOM,ld.END],this.onScale,this,!0],[[ad.START,ad.BEFORE_ROTATE,ad.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}},o_={x:0,y:0,width:1e5,height:1e5},n_=class extends Nh{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,o_),Object.assign(this.__world,o_)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach(i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)}),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}},a_='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',h_={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,arrowStep:1,arrowFastStep:10,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${a_}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${a_}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${a_}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},l_=new Nt;function d_(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{l_.setListWithFn(i,t=>t.getBounds("box","page")),0===l_.width&&(l_.width=.1),0===l_.height&&(l_.height=.1),e.reset(l_.get())}),s.add(e)}var c_=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),u_=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),p_={group(t,e,i){t.sort(u_);const{app:s,parent:r}=t[0];let o;o=i&&i.add?i:new Yh(i),r.addAt(o,r.children.indexOf(t[0])),t.sort(c_);const n=new ut(e.worldTransform);return n.divideParent(r.scrollWorldTransform),o.setTransform(n),o.editable=!0,o.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(o)),s.unlockLayout(),o},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(c_),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(u_),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},g_=qt.get("EditToolCreator");function __(){return t=>{f_.register(t)}}var f_={list:{},register(t){const{tag:e}=t.prototype;m_[e]&&g_.repeat(e),m_[e]=t},get:(t,e)=>new m_[t](e)},{list:m_}=f_,y_=class extends kg{constructor(t,e){super(t,e)}};y_.BEFORE_OPEN="innerEditor.before_open",y_.OPEN="innerEditor.open",y_.BEFORE_CLOSE="innerEditor.before_close",y_.CLOSE="innerEditor.close";var v_=class extends kg{constructor(t,e){super(t,e)}};v_.BEFORE_GROUP="editor.before_group",v_.GROUP="editor.group",v_.BEFORE_UNGROUP="editor.before_ungroup",v_.UNGROUP="editor.ungroup",v_.BEFORE_OPEN="editor.before_open_group",v_.OPEN="editor.open_group",v_.BEFORE_CLOSE="editor.before_close_group",v_.CLOSE="editor.close_group";var{updateMatrix:w_}=Ho,x_={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},b_="top-left",k_=class extends Uh{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.skipJSON=!0,this.on(kn.CHANGE,e=>{if(this.checkChange&&x_[e.attrName]){const{attrName:i,newValue:s,oldValue:r}=e,o="s"===i[0]?(s||1)/(r||1):(s||0)-(r||0);this.canChange=!1;const n=this.__;n[i]=r,w_(this.parent),w_(this);const a=new ut(this.__world);switch(n[i]=s,this.__layout.rotationChange(),w_(this),this.changedTransform=new ut(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(b_,o);break;case"scaleX":t.scaleOf(b_,o,1);break;case"scaleY":t.scaleOf(b_,1,o);break;case"skewX":t.skewOf(b_,o,0);break;case"skewY":t.skewOf(b_,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}},E_=class extends kg{constructor(t,e){super(t,e)}};E_.BEFORE_MOVE="editor.before_move",E_.MOVE="editor.move";var S_=class extends kg{constructor(t,e){super(t,e)}};S_.BEFORE_SCALE="editor.before_scale",S_.SCALE="editor.scale";var B_=class extends kg{constructor(t,e){super(t,e)}};B_.BEFORE_ROTATE="editor.before_rotate",B_.ROTATE="editor.rotate";var T_=class extends kg{constructor(t,e){super(t,e)}};T_.BEFORE_SKEW="editor.before_skew",T_.SKEW="editor.skew";var C_=class extends Yh{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new sh,this.openedGroupList=new sh,this.simulateTarget=new k_(this),this.editBox=new r_(this),this.editToolList={},this.selector=new Wg(this),this.editMask=new n_(this),this.targetEventIds=[];let i=g.clone(h_);t&&(i=g.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),se.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}getItem(t){return this.list[t||0]}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?l(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>g.stintSet(i,e,t))}setBright(t){this.setDimOthers(t,"bright",this.list)}cancelDimOthers(){this.setDimOthers(!1),this.setBright(!1),this.hasDimOthers=void 0}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&d_(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||f_.get(t,this)}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(n(s))e=s;else if(!1===s)return}if(f_.list[e]){const t=this.editTool=this.getEditTool(e);this.editBox.load(),t.load(),this.update()}}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(v_.BEFORE_GROUP),this.target=p_.group(this.list,this.element,t),this.emitGroupEvent(v_.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(v_.BEFORE_UNGROUP,t)),this.target=p_.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(v_.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(v_.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(v_.OPEN,t)}closeGroup(t){this.emitGroupEvent(v_.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(v_.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!Ho.hasParent(e,t))&&e.push(t))),e.forEach(t=>this.closeGroup(t))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new v_(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||f_.get(t,this)}openInnerEditor(t,e,i){let s;if(n(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(n(i))s=i;else if(!1===i)return}f_.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(y_.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(y_.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(y_.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(y_.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new y_(t,{editTarget:i,innerEditor:e});this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach(t=>t.locked=!0),this.update()}unlock(){this.list.forEach(t=>t.locked=!1),this.update()}toTop(){this.list.length&&(p_.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(p_.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}onChildScroll(){this.multiple&&this.updateEditBox()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,targetLeafer:i,editMask:s}=this;this.targetEventIds=[e.on_(An.START,this.onRenderStart,this),i&&i.on_(kn.SCROLL,this.onChildScroll,this),t.on_(An.CHILD_START,this.onAppRenderStart,this),t.on_(In.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};xg([(t,e)=>{eo(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,editTool:n,innerEditor:a,app:h}=this,l=Object.assign({},t);if(a?a.editConfig&&Object.assign(l,a.editConfig):n&&n.editConfig&&Object.assign(l,n.editConfig),e&&e.editConfig){let{editConfig:t}=e;(t.hover||t.hoverStyle)&&(t=Object.assign({},t),delete t.hover,delete t.hoverStyle),Object.assign(l,t)}return s.config&&Object.assign(l,s.config),i&&(i.editConfig&&Object.assign(l,i.editConfig),"font-size"===l.editSize&&(l.lockRatio=!0),"resize-rotate"===i.pointType&&(l.around||(l.around="center"),o(l.lockRatio)&&(l.lockRatio=!0))),r(l.dragLimitAnimate)&&(l.dragLimitAnimate=h&&h.config.pointer.dragLimitAnimate),this.mergedConfig=l}})}],C_.prototype,"mergeConfig",void 0),xg([Eg(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof sh?i:new sh(i),t.multiple&&d_(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new kg(kg.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new kg(kg.AFTER_SELECT,s))})],C_.prototype,"target",void 0),xg([Eg(function(t,e){t.emitEvent(new kg(kg.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],C_.prototype,"hoverTarget",void 0),C_=xg([Ro(class{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let r,{dragLimitAnimate:o}=i;const a=t.type===od.END||t.type===sd.END,l=n(e.draggable),d=!o||a||l,c={x:t.totalX,y:t.totalY};t instanceof od&&ot.move(c,e.getWorldPointByLocal(s.totalOffset,null,!0)),t.shiftKey&&(Math.abs(c.x)>Math.abs(c.y)?c.y=0:c.x=0),r=sd.getValidMove(e,s.point,c,d),(r.x||r.y)&&(o&&!l&&a?Ho.animateMove(this,r,h(o)?o:.3):this.move(r))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:r}=this.editBox;let o,{around:n,lockRatio:a,flipable:h,editSize:l}=i;t instanceof ld?(n||(n=e.getBoxPoint(t)),o=t.totalScale):o=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=qg.getScaleData(e,r.bounds,d,o,a,qg.getAround(n,t.altKey),h,!s||"scale"===l),u=e.x,p=e.y;t instanceof sd&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),ot.move(r.totalOffset,e.x-u,e.y-p)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:r,rotateAround:o,rotateGap:n,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof ad)d=t.rotation,l=o?ft.getPoint(o,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,n=qg.getRotateData(e,h,t,s,i?null:o||e.around||e.origin||r||"center");d=s.rotation+n.rotation-e.rotation,l=n.origin}if(d=L.float(L.getGapRotation(d,n,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),ot.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:r,skewX:o,skewY:n}=qg.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),qg.getAround(s,t.altKey));(o||n)&&this.skewOf(r,o,n)}move(t,e=0){if(!this.checkTransform("moveable"))return;d(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:r,editor:o}=this.editBox,{beforeMove:n}=s;if(n){const s=n({target:i,x:t,y:e});if(d(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);r||i.safeChange(()=>i.move(t,e));const h={target:i,editor:o,moveX:a.x,moveY:a.y};this.emitEvent(new E_(E_.BEFORE_MOVE,h));const l=new E_(E_.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:r}=i;if(r){const{origin:i,scaleX:s,scaleY:o,drag:n}=t;if(!1===r({target:e,drag:n,origin:i,scaleX:s,scaleY:o}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new S_(S_.BEFORE_SCALE,t));const o=new S_(S_.SCALE,t);this.editTool.onScaleWithDrag(o),this.emitEvent(o)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:r,mergeConfig:o,single:n,editor:a}=this.editBox,{beforeScale:h}=o;if(h){const s=h({target:r,origin:t,scaleX:e,scaleY:i});if(d(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),c=!n&&this.getChangedTransform(()=>r.safeChange(()=>r.scaleOf(t,e,i))),u={target:r,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:c};this.emitEvent(new S_(S_.BEFORE_SCALE,u));const p=new S_(S_.SCALE,u);this.doScale(p),this.emitEvent(p)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,r=this.getWorldOrigin("center"),o=i?new ut(Ho.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),n={target:e,editor:s,worldOrigin:r,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:o};this.emitEvent(new S_(S_.BEFORE_SCALE,n));const a=new S_(S_.SCALE,n);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:r,editor:o}=this.editBox,{beforeRotate:n}=s;if(n){const s=n({target:i,origin:t,rotation:e});if(h(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),l=!r&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:o,worldOrigin:a,rotation:e,transform:l};this.emitEvent(new B_(B_.BEFORE_ROTATE,d));const c=new B_(B_.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:r,mergeConfig:o,single:n,editor:a}=this.editBox,{beforeSkew:h}=o;if(h){const s=h({target:r,origin:t,skewX:e,skewY:i});if(d(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),c=!n&&this.getChangedTransform(()=>r.safeChange(()=>r.skewOf(t,e,i))),u={target:r,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:c};this.emitEvent(new T_(T_.BEFORE_SKEW,u));const p=new T_(T_.SKEW,u);this.doSkew(p),this.emitEvent(p)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(Ho.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new ut(e.worldTransform);return t(),new ut(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}},["editBox","editTool","emitEvent"])],C_);var O_=class{static registerInnerEditor(){f_.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this._editBox||this.editor.editBox}set editBox(t){this._editBox=t}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new Yh,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}},R_=class extends O_{static registerEditTool(){f_.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:r,list:o}=s;r.lockLayout(),o.forEach(t=>{t.moveWorld(e,i)}),r.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:r,editor:o}=t,{app:n,list:a}=o;n.lockLayout(),a.forEach(t=>{const n="scale"!==o.getEditSize(t);s?t.transformWorld(s,n):t.scaleOfWorld(r,e,i,n)}),n.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:r}=t,{app:o,list:n}=r;o.lockLayout(),n.forEach(t=>{const o="scale"!==r.getEditSize(t);i?t.transformWorld(i,o):t.rotateOfWorld(s,e)}),o.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:r,editor:o}=t,{app:n,list:a}=o;n.lockLayout(),a.forEach(t=>{const n="scale"!==o.getEditSize(t);s?t.transformWorld(s,n):t.skewOfWorld(r,e,i,n)}),n.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};R_=xg([__()],R_);var{left:P_,right:L_}=j,{move:M_,copy:D_,toNumberPoints:A_}=ot,I_=class extends R_{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:r}=t,o=t.target,n=i===P_;if(o.pathInputed){const{path:t}=o.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,n,r,this.getInnerMove(o,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,o.path=t}else if(o.points){const{points:t}=o,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,n,r,this.getInnerMove(o,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,o.points=t}else{const t={x:0,y:0},{toPoint:i}=o;o.rotation=0,this.dragPoint(t,i,n,r,this.getInnerMove(o,e,s)),o.getLocalPointByInner(t,null,null,!0),o.getLocalPointByInner(i,null,null,!0),o.x=t.x,o.y=t.y,o.getInnerPointByLocal(i,null,null,!0),o.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=A_(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,r){const{x:o,y:n}=r;i?(M_(t,o,n),s&&M_(e,-o,-n)):(s&&M_(t,-o,-n),M_(e,o,n))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:r}=t,o=t.target;let n,a;if(o.pathInputed?n=this.getFromToByPath(o.__.path):o.points&&(n=this.getFromToByPoints(o.__.points)),n){const{from:i,to:a}=n;o.innerToWorld(i,i,!1,t),o.innerToWorld(a,a,!1,t),r.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),D_(s[7],i),D_(e[7],i),D_(s[3],a),D_(e[3],a)}for(let h=0;h<8;h++)h<4&&(i[h].visible=!1),a=h===P_||h===L_,s[h].visible=a,e[h].visible=!n&&a}};function W_(t){const{scroll:e,disabled:i}=t.app.config.move;return!e||i?"":!0===e?"free":e}function z_(t,e,i){(function(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&g.assign(i,e),g.assign(t.config,i,t.userConfig)})(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(od.BEFORE_MOVE,e=>{const i=t.getValidMove(e.moveX,e.moveY,!1);if(W_(t).includes("limit")){const s=t.getValidMove(0,0);if(s.x||s.y){const t=100,r=200,o="drag"===e.moveType?.3:.05;Math.abs(s.x)>t?i.x=0:i.x*=o,Math.abs(s.y)>r?i.y=0:i.y*=o}}t.zoomLayer.move(i)}),t.on_(od.DRAG_ANIMATE,()=>{const e=t.getValidMove(0,0);(e.x||e.y)&&t.interaction.stopDragAnimate()}),t.on_(od.END,e=>{Ho.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(ld.BEFORE_ZOOM,e=>{const{zoomLayer:i,layouter:s}=t,r=t.getValidScale(e.scale);1!==r&&(s.stop(),Ho.updateMatrix(t),i.scaleOfWorld(e,r),s.start())}))}I_=xg([__()],I_),se.add("editor","resize"),re.editor=function(t,e){const i=new C_(t);return e&&e.sky.add(e.editor=i),i},$h.addAttr("textBox",!1,ro),Nh.addAttr("editConfig",void 0,ro),Nh.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),ro),Nh.addAttr("editInner","PathEditor",ro),Yh.addAttr("editInner","",ro),Ml.addAttr("editInner","TextEditor",ro),Nh.setEditConfig=function(t){this.changeAttr("editConfig",t)},Nh.setEditOuter=function(t){this.changeAttr("editOuter",t)},Nh.setEditInner=function(t){this.changeAttr("editInner",t)};var F_=qt.get("LeaferTypeCreator"),N_={list:{},register(t,e){V_[t]&&F_.repeat(t),V_[t]=e},run(t,e){const i=V_[t];i&&i(e)}},{list:V_,register:Y_}=N_;Y_("viewport",z_),Y_("custom",function(t){z_(t,null,!0)}),Y_("design",function(t){z_(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Y_("document",function(t){z_(t,{zoom:{min:1},move:{scroll:"limit"}})});var X_,H_,U_,j_,G_={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=ot.getCenter(e.from,i.from),r=ot.getCenter(e.to,i.to),o={x:r.x-s.x,y:r.y-s.y},n=ot.getDistance(e.from,i.from);return{move:o,scale:ot.getDistance(e.to,i.to)/n,rotation:ot.getRotation(e.from,i.from,e.to,i.to),center:r}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),r=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&r<1?"none":i>=s&&i>=r?"move":s>=r?"zoom":"rotate"},detect(t,e){const{state:i}=K_,s=K_.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),K_.add(t,i.totalData),i.totalData=t,s===i.type){if(i.typeCount++,i.typeCount>=(e.count||3)&&"none"!==s)return s}else i.type=s,i.typeCount=1;return Date.now()-i.startTime>=(e.time||160)?K_.getType(i.totalData,e):"none"},add(t,e){e&&(ot.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=K_;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},K_=G_,{abs:Z_,max:q_}=Math,{sign:$_,within:J_}=L,Q_={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:r}=t;t.shiftKey&&!s&&(s=r,r=0);const o=Z_(s),n=Z_(r);return o>50&&(s=q_(50,o/3)*$_(s)),n>50&&(r=q_(50,n/3)*$_(r)),{x:-s*i*2,y:-r*i*2}},getScale(t,e){let i,s=1,{zoomMode:r,zoomSpeed:o}=e;const n=t.deltaY||t.deltaX;if(r?(i="mouse"===r||!t.deltaX&&(Gt.intWheelDeltaY?Math.abs(n)>17:Math.ceil(n)!==n),(t.shiftKey||t.metaKey||t.ctrlKey)&&(i=!0)):i=!t.shiftKey&&(t.metaKey||t.ctrlKey),i){o=J_(o,0,1);const i=t.deltaY?e.delta.y:e.delta.x,r=J_(1-Z_(n)/(4*i)*o,.5,2);s=n>0?r:1/r}return s}},tf=class{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),X_=0,H_=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:X_,totalY:H_}),e.emit(od.START,this.moveData)),t.path=this.moveData.path,t.totalX=X_+=t.moveX,t.totalY=H_+=t.moveY,e.emit(od.BEFORE_MOVE,t),e.emit(od.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),U_=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:U_}),e.emit(ld.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=U_*=t.scale,e.emit(ld.BEFORE_ZOOM,t),e.emit(ld.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),j_=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:j_}),e.emit(ad.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=j_+=t.rotation,e.emit(ad.BEFORE_ROTATE,t),e.emit(ad.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(od.END,Object.assign(Object.assign({},e),{totalX:X_,totalY:H_})),i&&t.emit(ld.END,Object.assign(Object.assign({},i),{totalScale:U_})),s&&t.emit(ad.END,Object.assign(Object.assign({},s),{totalRotation:j_})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}},ef=Hh.prototype,sf=new Nt,rf=new ct;function of(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function nf(t,e){return Object.assign(Object.assign({},e),{scale:t})}ef.initType=function(t){N_.run(t,this)},ef.getValidMove=function(t,e,i=!0){const{disabled:s,scrollSpread:r}=this.app.config.move;rf.set(t,e);const o=W_(this);return o&&(o.includes("x")?rf.y=0:o.includes("y")?rf.x=0:Math.abs(rf.x)>Math.abs(rf.y)?rf.y=0:rf.x=0,i&&o.includes("limit")&&(sf.set(this.__world).addPoint(this.zoomLayer),r&&sf.spread(r),Ql.getValidMove(sf,this.canvas.bounds,"auto",rf,!0),o.includes("x")?rf.y=0:o.includes("y")&&(rf.x=0))),{x:s?0:rf.x,y:s?0:rf.y}},ef.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:r}=this.app.config.zoom,o=Math.abs(e*t);return i&&o<i?t=i/e:s&&o>s&&(t=s/e),r?1:t};var af=Td.prototype;af.createTransformer=function(){this.transformer=new tf(this)},af.move=function(t){this.transformer.move(t)},af.zoom=function(t){this.transformer.zoom(t)},af.rotate=function(t){this.transformer.rotate(t)},af.transformEnd=function(){this.transformer.transformEnd()},af.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:r}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):r&&(t.deltaX*=r),t.deltaY>0?s&&(t.deltaY*=s):r&&(t.deltaY*=r);const o=e.getScale?e.getScale(t,e):Q_.getScale(t,e);if(1!==o)this.zoom(nf(o,t));else{const s=e.getMove?e.getMove(t,e):Q_.getMove(t,e);i.snap&&ot.round(s),this.move(of(s,t))}},af.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let r=G_.getData(e),{moving:o,zooming:n,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(G_.detect(r,d(s)?s:{})){case"move":o=!0;break;case"zoom":n=!0;break;case"rotate":a=!0;break;default:return}G_.reset()}o||(r.center=G_.state.center)}else o=n=a=!0;var h,l;Object.assign(t,r.center),t.multiTouch=!0,a&&this.rotate((h=r.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),n&&this.zoom(nf(r.scale,t)),o&&this.move(of(r.move,t))};var hf=md.prototype,{abs:lf,min:df,max:cf,hypot:uf}=Math;function pf(t,e){let i=1;const s="out"===e,r=Math.abs(t);if(r>1){for(;s?i<r:i<=r;)i*=2;s&&(i/=2)}else{for(;s?i>=r:i>r;)i/=2;s||(i*=2)}return i/t}hf.checkDragEndAnimate=function(t){const{interaction:e}=this,i=this.canAnimate&&this.moving&&e.m.dragAnimate;if(i){const s=h(i)?i:.95,r=.15,o=150;let n,a,l,d=0,c=0,u=0,p=0,g=3;const{dragDataList:_}=this,f=_.length;for(let t=f-1;t>=cf(f-3,0)&&(l=_[t],!(l.time&&Date.now()-l.time>100));t--)n=g--,d+=l.moveX*n,c+=l.moveY*n,p+=n,a=uf(l.moveX,l.moveY),a>u&&(u=a);if(p&&(d/=p,c/=p),u>8){const t=1.15+.4500000000000002*df((u-8)/17,1);d*=t,c*=t}const m=cf(lf(d),lf(c));m>o&&(a=o/m,d*=a,c*=a);const y=()=>{if(d*=s,c*=s,t=Object.assign({},t),lf(d)<r&&lf(c)<r)return this.dragEndReal(t);ot.move(t,d,c),this.drag(t),this.animate(y),e.emit(od.DRAG_ANIMATE,t)};this.animate(y)}return i},hf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},hf.stopAnimate=function(){this.animate(null,"off"),this.interaction.target.nextRender(()=>{this.dragData&&this.dragEndReal(this.dragData)})},hf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},hf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:r,dragOut:o}=e.m;if(!o||!s||!r)return;const n=e.shrinkCanvasBounds,{x:a,y:h}=n,l=It.maxX(n),d=It.maxY(n),c=t.x<a?r:l<t.x?-r:0,u=t.y<h?r:d<t.y?-r:0;let p=0,g=0;this.autoMoveTimer=setInterval(()=>{p+=c,g+=u,ot.move(i,c,u),ot.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:p,totalY:g,moveType:"drag"})),e.pointerMoveReal(t)},10)},hf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},se.add("viewport"),se.add("view"),Hh.prototype.zoom=function(t,e,i,s){let r;!function(t){return d(t)&&!l(t)}(e)?r=e:(r=e.padding,i=e.scroll,s=e.transition);const{zoomLayer:a}=this,c=this.canvas.bounds.clone().shrink(o(r)?30:r),u=new Nt,p={x:c.x+c.width/2,y:c.y+c.height/2};let g;a.killAnimate();const{x:_,y:f,scaleX:m,scaleY:y}=a.__,{boxBounds:v}=a;if(n(t))switch(t){case"in":g=pf(m,"in");break;case"out":g=pf(m,"out");break;case"fit":t=v;break;case"fit-width":(t=new Nt(v)).height=0;break;case"fit-height":(t=new Nt(v)).width=0}else h(t)&&(g=t/m);if(g)g=this.getValidScale(g),a.scaleOfWorld(p,g,g,!1,s);else if(d(t)){const e={x:_,y:f,scaleX:m,scaleY:y},r=l(t);if(r||t.tag){const e=r?t:[t];u.setListWithFn(e,Qo.worldBounds)}else{const e=function(t,e){let i,{x:s,y:r,width:o,height:n}=t;return n||(n=o*(e.height/e.width),i=!0),o||(o=n*(e.width/e.height),i=!0),i?{x:s,y:r,width:o,height:n}:t}(t,c);u.set(a.getWorldBounds(e))}const{width:o,height:n}=u;let h=c.x-u.x,d=c.y-u.y;return i?(h+=Math.max((c.width-o)/2,0),d+=Math.max((c.height-n)/2,0)):(g=this.getValidScale(Math.min(c.width/o,c.height/n)),h+=(c.width-o*g)/2,d+=(c.height-n*g)/2,ot.scaleOf(e,u,g),u.scaleOf(u,g),e.scaleX*=g,e.scaleY*=g),"x"===i?d=0:"y"===i&&(h=0),ot.move(e,h,d),u.move(h,d),a.set(e,s),u}return a.worldBoxBounds};var gf=class{constructor(t){this.undoStack=[],this.redoStack=[],this.limit=50,void 0!==t&&t>0&&(this.limit=t)}executeCommand(t){t.execute(),this.undoStack.push(t),this.redoStack=[],this.undoStack.length>this.limit&&this.undoStack.shift()}undo(){if(this.canUndo()){const t=this.undoStack.pop();t&&(t.undo(),this.redoStack.push(t))}}redo(){if(this.canRedo()){const t=this.redoStack.pop();t&&(t.execute(),this.undoStack.push(t))}}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}clear(){this.undoStack=[],this.redoStack=[]}},_f=class{constructor(t,e,i,s,r){this.target=t,this.fromX=e,this.fromY=i,this.toX=s,this.toY=r}execute(){this.target.x=this.toX,this.target.y=this.toY}undo(){this.target.x=this.fromX,this.target.y=this.fromY}},ff=class{constructor(t,e,i,s,r){this.target=t,this.fromWidth=e,this.fromHeight=i,this.toWidth=s,this.toHeight=r}execute(){this.target.width=this.toWidth,this.target.height=this.toHeight}undo(){this.target.width=this.fromWidth,this.target.height=this.fromHeight}},mf=class{constructor(t,e){this.parent=t,this.element=e}execute(){this.parent.add(this.element)}undo(){this.parent.remove(this.element)}},yf=class{constructor(t,e,i){this.parent=t,this.element=e,this.index=i}execute(){this.parent.remove(this.element)}undo(){this.parent.add(this.element)}},vf=class{constructor(t){this.commands=t}execute(){this.commands.forEach(t=>t.execute())}undo(){for(let t=this.commands.length-1;t>=0;t--)this.commands[t].undo()}},wf=["Shift","Meta","Alt","Control"],xf="object"==typeof navigator?navigator.platform:"",bf=/Mac|iPod|iPhone|iPad/.test(xf)?"Meta":"Control",kf="Win32"===xf?["Control","Alt"]:["Alt"];function Ef(t){let e=t.target;return t.repeat||t.isComposing||e!==t.currentTarget&&e.matches("[contenteditable],input,select,textarea")}function Sf(t,e){return"function"==typeof t.getModifierState&&(t.getModifierState(e)||kf.includes(e)&&t.getModifierState("AltGraph"))}function Bf(t,[e,i,s]){const r=e.includes("AltGraph");return!((s instanceof RegExp?!s.test(t.key)&&!s.test(t.code):s.toUpperCase()!==t.key.toUpperCase()&&s!==t.code)||e.find(e=>!Sf(t,e))||wf.find(o=>!e.includes(o)&&!i.includes(o)&&s!==o&&Sf(t,o)&&!(r&&kf.includes(o))))}function Tf(t,e,i={}){let s=i.event??"keydown",r=function(t,e={}){let i=e.timeout??1e3,s=e.ignore??Ef,r=Object.keys(t).map(e=>{return[e,(i=e,i.trim().split(" ").map(t=>{let e=t.split(/(?<=\w|\])\+/),i=e.pop(),s=i.match(/^\((.+)\)$/),r=s?new RegExp(`^(?:${s[1]})$`,"iv"):i,o=[],n=[];for(const a of e){let t=a.match(/^\[(.*)\]$/),e=t?.[1]??a;e="$mod"===e?bf:e,t?n.push(e):o.push(e)}return[o,n,r]})),t[e]];var i}),o=new Map,n=null;return t=>{if(!function(t){return!!(t.key&&t.code&&t.getModifierState)}(t)||s(t))return;let e=[];for(let[i,s,n]of r){let r=o.get(i),[a,...h]=r||s;if(Bf(t,a)){if(h.length>0)o.set(i,h),e.push(i);else if(o.delete(i),!e.length){n(t);break}}else Sf(t,t.key)||o.delete(i)}n&&clearTimeout(n),n=setTimeout(()=>o.clear(),i)}}(e,i);return t.addEventListener(s,r,i.capture),()=>{t.removeEventListener(s,r,i.capture)}}var Cf={key:0,class:"loading-overlay",style:{}},Of={key:1,class:"error-overlay"},Rf={class:"zoom-controller"},Pf={key:0,class:"hotkey-hint"},Lf={key:0,class:"hotkey-hint"},Mf={key:0,class:"hotkey-hint"},Df={class:"toolbar"},Af={key:0,class:"hotkey-hint"},If={key:0,class:"hotkey-hint"},Wf={key:0,class:"hotkey-hint"},zf={key:0,class:"hotkey-hint"},Ff={key:0,class:"hotkey-hint"},Nf=(0,e.defineComponent)({__name:"RoiEditor",props:{imageSource:{type:Object,required:!0},options:{type:Object,default:()=>({})}},emits:["roiChange","loadStart","loadSuccess","loadError","undoStateChange","redoStateChange"],setup(t,{expose:i,emit:s}){const r=t,o=s,n=(0,e.ref)(void 0),a=(0,e.ref)("idle"),h=(0,e.ref)(null),l=(0,e.ref)(null);let d=null,c=null;const u=new Yh({name:"contentLayer"}),p=(0,e.ref)({x:0,y:0}),g=(0,e.ref)(!1),_=(0,e.ref)(!1),f=(0,e.ref)(!1),m=(0,e.ref)("rectangle"),y=(0,e.ref)(100),v=(0,e.ref)(!1),w=(0,e.ref)(0),x=(0,e.ref)(0);let b,k=null,E=null,S=null;const B=t=>{b.executeCommand(t)},T=()=>{b=new gf(r.options.maxUndoSteps??100),d=new Wl({view:n.value,width:n.value?.clientWidth||800,height:n.value?.clientHeight||600,fill:"#e3e3e3",zoom:{min:.2,max:4},editor:{rotateable:!1,middlePoint:{},selectedStyle:{...r.options.selectedRegionStyle}},tree:{type:"design"}}),d?.tree.add(u),d&&(d.on(ed.DOWN,M),d.on(ed.MOVE,D),d.on(ed.UP,A),d.on(sd.START,t=>{const e=t.target;e instanceof Uh&&e.parent===u&&(E={target:e,fromX:e.x||0,fromY:e.y||0,toX:e.x||0,toY:e.y||0})}),d.on(sd.DRAG,t=>{E&&(E.toX=t.target.x||0,E.toY=t.target.y||0)}),d.on(sd.END,()=>{if(E){const t=E.target;E.fromX===E.toX&&E.fromY===E.toY||(B(new _f(t,E.fromX,E.fromY,E.toX,E.toY)),o("roiChange",O())),E=null}}),d.on(ld.ZOOM,t=>{j()}),d.editor?.on(S_.BEFORE_SCALE,t=>{const e=t.target;e instanceof Uh&&e.parent===u&&(S||(S={target:e,fromWidth:e.width||0,fromHeight:e.height||0,toWidth:e.width||0,toHeight:e.height||0}))}),d.editor?.on(S_.SCALE,t=>{S&&(S.toWidth=t.target.width||0,S.toHeight=t.target.height||0)}),d.on(ed.UP,()=>{S&&function(){if(S){const t=S.target;S.fromWidth===S.toWidth&&S.fromHeight===S.toHeight||(B(new ff(t,S.fromWidth,S.fromHeight,S.toWidth,S.toHeight)),o("roiChange",O())),S=null}}()}))};const C=async t=>{const e=t||r.imageSource.url;if(d&&e){c&&(u.clear(),c.destroy()),a.value="loading",o("loadStart"),h.value=null,l.value=null;try{const t=await(i=e,new Promise((t,e)=>{const s=new window.Image;s.onload=()=>{t({width:s.width,height:s.height})},s.onerror=e,s.src=i}));h.value=t.width,l.value=t.height,c=new Bl({url:e,draggable:!1,editable:!1,lazy:!0,zIndex:-1,placeholderColor:"transparent"}),c.on(Sn.LOADED,function(){a.value="success",o("loadSuccess"),L()}),c.on(Sn.ERROR,function(t){a.value="error",o("loadError",t)}),u.add(c)}catch(s){a.value="error",o("loadError",s)}var i}},O=()=>{if(!u||!h.value||!l.value)return[];const t=[],e=h.value,i=l.value;return Array.from(u.children).forEach(s=>{if(!s.url){const r=s,o=r.id||`roi-${t.length}`,n=r.x||0,a=r.y||0,h=r.width||0,l=r.height||0,d=[{x:n,y:a},{x:n+h,y:a},{x:n+h,y:a+l},{x:n,y:a+l}],c=d.map(t=>({x:e>0?t.x/e:0,y:i>0?t.y/i:0}));t.push({id:o,x:n,y:a,width:h,height:l,points:d,normalized:{x:e>0?n/e:0,y:i>0?a/i:0,width:e>0?h/e:0,height:i>0?l/i:0,points:c}})}}),t},R=()=>({id:r.imageSource.id,url:r.imageSource.url,width:h.value,height:l.value});(0,e.onMounted)(()=>{(0,e.nextTick)(()=>{T(),C(),window.addEventListener("keydown",W),window.addEventListener("mousemove",P);const t=Tf(window,{v:t=>{(g.value||_.value)&&(t.preventDefault(),F())},m:t=>{(g.value||_.value)&&(t.preventDefault(),N())},"$mod+KeyZ":t=>{(g.value||_.value)&&(t.preventDefault(),t.stopPropagation(),V())},"$mod+KeyY":t=>{(g.value||_.value)&&(t.preventDefault(),t.stopPropagation(),Y())},Delete:t=>{(g.value||_.value)&&(t.preventDefault(),t.stopPropagation(),G())},"$mod+Equal":t=>{(g.value||_.value)&&(t.preventDefault(),t.stopPropagation(),H())},"$mod+Minus":t=>{(g.value||_.value)&&(t.preventDefault(),t.stopPropagation(),X())},"$mod+0":t=>{(g.value||_.value)&&(t.preventDefault(),t.stopPropagation(),U())},Alt:t=>{(g.value||_.value)&&(t.preventDefault(),f.value=!f.value)}});window.__roiEditorHotkeysUnsubscribe=t})});const P=t=>{p.value={x:t.clientX,y:t.clientY}},L=()=>{if(!(d&&c&&h.value&&l.value))return;const t=d.width,e=d.height,i=h.value,s=l.value,r=t/i,o=e/s,n=Math.min(r,o,1),a=(t-i*Number(n.toFixed(2)))/2,u=(e-s*Number(n.toFixed(2)))/2;d.tree.scale=Number(n.toFixed(2)),d.tree.x=a,d.tree.y=u,j()},M=t=>{if("rectangle"!==m.value)return;if(t.ctrlKey||t.metaKey)return;if(t.target){if(t.target.parent===u&&!t.target.url)return;if(t.target.parent&&t.target.parent.parent===u&&!t.target.parent.url)return;if("resize"===t.target.pointType)return;if("rotate"===t.target.pointType)return}const e=u.getBoxPoint({x:t.x,y:t.y});I(e.x,e.y)&&(v.value=!0,w.value=e.x,x.value=e.y)},D=t=>{if(!v.value)return;const e=u.getBoxPoint({x:t.x,y:t.y}),i=e.x,s=e.y,o=Math.max(0,Math.min(i,h.value||0)),n=Math.max(0,Math.min(s,l.value||0)),a=Math.min(w.value,o),d=Math.min(x.value,n),c=Math.abs(o-w.value),p=Math.abs(n-x.value);k?(k.x=a,k.y=d,k.width=c,k.height=p):(k=new Uh({id:crypto.randomUUID(),x:a,y:d,width:c,height:p,stroke:"rgba(100, 149, 237, 0.8)",fill:"rgba(100, 149, 237, 0.3)",strokeWidth:2,draggable:!1,editable:!1,...r.options.regionStyle}),u.add(k))},A=()=>{if(v.value&&(v.value=!1,k)){const t=k.width||0,e=k.height||0;if(t<5||e<5)k.remove(),k=null;else{const t=r.options.maxRegions??20;if(O().length>=t)return alert(`已达到最大区域数量限制(${t}个)`),k.remove(),void(k=null);k.draggable=!0,k.editable=!0,k.dragBounds={x:0,y:0,width:h.value||0,height:l.value||0},B(new mf(u,k)),o("roiChange",O()),k=null}}},I=(t,e)=>t>=0&&t<=(h.value||0)&&e>=0&&e<=(l.value||0),W=t=>{if("Space"===t.code&&z())return t.preventDefault(),!1},z=()=>{if(!n.value)return!1;const t=n.value.getBoundingClientRect();return p.value.x>=t.left&&p.value.x<=t.right&&p.value.y>=t.top&&p.value.y<=t.bottom};(0,e.onUnmounted)(()=>{c&&(d?.tree.remove(c),c=null),d?.destroy(),d=null,window.removeEventListener("keydown",W),window.removeEventListener("mousemove",P),window.__roiEditorHotkeysUnsubscribe&&(window.__roiEditorHotkeysUnsubscribe(),delete window.__roiEditorHotkeysUnsubscribe)});const F=()=>{m.value="select"},N=()=>{m.value="rectangle"},V=()=>{b.undo(),o("roiChange",O())},Y=()=>{b.redo(),o("roiChange",O())},X=()=>{d&&(d.tree.zoom("out"),j())},H=()=>{d&&(d.tree.zoom("in"),j())},U=()=>{d&&(d.tree.zoom(1),j())},j=()=>{d&&d.tree&&void 0!==d.tree.scaleX&&(y.value=Math.round(100*d.tree.scaleX))},G=()=>{if(!d)return;const t=d.editor?.list||[];if(0===t.length)return;const e=t.filter(t=>t instanceof Uh&&t.parent===u);if(0===e.length)return;const i=[];e.forEach(t=>{const e=t.parent?.children.indexOf(t)??-1;t.remove();const s=new yf(u,t,e);i.push(s)}),i.length>0&&B(new vf(i)),d&&d.editor&&d.editor.cancel(),o("roiChange",O())};return i({getROIAnnotations:O,getImageInfo:R,exportCanvasJSON:()=>{const t={version:"1.0",canvas:{width:h.value,height:l.value,zoom:y.value/100},image:R(),leaferJSON:d?.tree?.toJSON?.()||null,annotations:O(),exportedAt:(new Date).toISOString()};return JSON.stringify(t,null,2)},importCanvasJSON:async(t,e)=>{try{const s=JSON.parse(t);if(!s.leaferJSON)return!1;if(u){for(;u.children.length>0;)u.children[0].remove();if(s.leaferJSON&&s.leaferJSON.children){let t=null;const e=i=>{for(const s of i){if(s.url)return t=s,!0;if(s.children&&s.children.length>0&&e(s.children))return!0}return!1};if(e(s.leaferJSON.children),t)try{await C(t.url)}catch(i){h.value=t.width||s.canvas?.width||0,l.value=t.height||s.canvas?.height||0}const r=t=>{for(const e of t){if(e.url)continue;const t=JSON.parse(JSON.stringify(e));u.add(t),e.children&&e.children.length>0&&r(e.children)}};r(s.leaferJSON.children[0].children)}d?.tree.forceUpdate()}return e?.resetZoom&&s.canvas?.zoom&&(y.value=100*s.canvas.zoom,j()),o("roiChange",O()),!0}catch(i){return!1}},loadImage:C}),(t,i)=>((0,e.openBlock)(),(0,e.createElementBlock)("div",{class:"roi-editor",onFocus:i[1]||(i[1]=t=>g.value=!0),onBlur:i[2]||(i[2]=t=>g.value=!1),onMouseenter:i[3]||(i[3]=t=>_.value=!0),onMouseleave:i[4]||(i[4]=t=>_.value=!1)},[(0,e.createElementVNode)("div",{ref_key:"canvasContainer",ref:n,class:"canvas-container",tabindex:"0"},["loading"===a.value?((0,e.openBlock)(),(0,e.createElementBlock)("div",Cf,[...i[5]||(i[5]=[(0,e.createElementVNode)("div",{class:"gradient-animation"},null,-1),(0,e.createElementVNode)("div",{class:"loading-text"},"图片加载中",-1)])])):(0,e.createCommentVNode)("",!0),"error"===a.value?((0,e.openBlock)(),(0,e.createElementBlock)("div",Of,[i[6]||(i[6]=(0,e.createElementVNode)("p",null,"加载失败",-1)),(0,e.createElementVNode)("button",{onClick:i[0]||(i[0]=t=>C())},"重试")])):(0,e.createCommentVNode)("",!0),(0,e.createElementVNode)("div",Rf,[(0,e.createElementVNode)("button",{class:"zoom-button",title:"缩小 (Ctrl+-)",onClick:X},[i[7]||(i[7]=(0,e.createElementVNode)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[(0,e.createElementVNode)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)),f.value?((0,e.openBlock)(),(0,e.createElementBlock)("span",Pf,"Ctrl+-")):(0,e.createCommentVNode)("",!0)]),(0,e.createElementVNode)("div",{class:"zoom-value",onClick:U,title:"点击重置为100% (Ctrl+0)"},[(0,e.createTextVNode)((0,e.toDisplayString)(y.value)+"% ",1),f.value?((0,e.openBlock)(),(0,e.createElementBlock)("span",Lf,"Ctrl+0")):(0,e.createCommentVNode)("",!0)]),(0,e.createElementVNode)("button",{class:"zoom-button",title:"放大 (Ctrl++)",onClick:H},[i[8]||(i[8]=(0,e.createElementVNode)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[(0,e.createElementVNode)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,e.createElementVNode)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)),f.value?((0,e.openBlock)(),(0,e.createElementBlock)("span",Mf,"Ctrl++")):(0,e.createCommentVNode)("",!0)])])],512),(0,e.createElementVNode)("div",Df,[(0,e.createElementVNode)("button",{class:(0,e.normalizeClass)(["tool-button",{active:"select"===m.value}]),title:"选择工具 (V)",onClick:F},[i[9]||(i[9]=(0,e.createElementVNode)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-mouse-pointer2-icon lucide-mouse-pointer-2"},[(0,e.createElementVNode)("path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"})],-1)),f.value?((0,e.openBlock)(),(0,e.createElementBlock)("span",Af,"V")):(0,e.createCommentVNode)("",!0)],2),(0,e.createElementVNode)("button",{class:(0,e.normalizeClass)(["tool-button",{active:"rectangle"===m.value}]),title:"框选工具 (M)",onClick:N},[i[10]||(i[10]=(0,e.createElementVNode)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[(0,e.createElementVNode)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"})],-1)),f.value?((0,e.openBlock)(),(0,e.createElementBlock)("span",If,"M")):(0,e.createCommentVNode)("",!0)],2),(0,e.createElementVNode)("button",{class:"tool-button",title:"撤销 (Ctrl+Z)",onClick:V},[i[11]||(i[11]=(0,e.createElementVNode)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[(0,e.createElementVNode)("path",{d:"M3 7v6h6"}),(0,e.createElementVNode)("path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"})],-1)),f.value?((0,e.openBlock)(),(0,e.createElementBlock)("span",Wf,"Ctrl+Z")):(0,e.createCommentVNode)("",!0)]),(0,e.createElementVNode)("button",{class:"tool-button",title:"重做 (Ctrl+Y)",onClick:Y},[i[12]||(i[12]=(0,e.createElementVNode)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[(0,e.createElementVNode)("path",{d:"M21 7v6h-6"}),(0,e.createElementVNode)("path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"})],-1)),f.value?((0,e.openBlock)(),(0,e.createElementBlock)("span",zf,"Ctrl+Y")):(0,e.createCommentVNode)("",!0)]),(0,e.createElementVNode)("button",{class:"tool-button",title:"删除 (Delete)",onClick:G},[i[13]||(i[13]=(0,e.createElementVNode)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[(0,e.createElementVNode)("path",{d:"M3 6h18"}),(0,e.createElementVNode)("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),(0,e.createElementVNode)("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})],-1)),f.value?((0,e.openBlock)(),(0,e.createElementBlock)("span",Ff,"Del")):(0,e.createCommentVNode)("",!0)])])],32))}}),Vf=((t,e)=>{const i=t.__vccOpts||t;for(const[s,r]of e)i[s]=r;return i})(Nf,[["__scopeId","data-v-9c4af5f9"]]),Yf={install(t){t.component("RoiEditor",Vf)}};t.RoiEditor=Vf,t.default=Yf});
|