UNPKG

@leafer-editor/worker

Version:
1 lines 286 kB
var LeaferUI=function(t){"use strict";var e,i;function s(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function n(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,a)}h((s=s.apply(t,e||[])).next())})}t.PathNodeHandleType=void 0,(e=t.PathNodeHandleType||(t.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror","function"==typeof SuppressedError&&SuppressedError,t.Answer=void 0,(i=t.Answer||(t.Answer={}))[i.No=0]="No",i[i.Yes=1]="Yes",i[i.NoAndSkip=2]="NoAndSkip",i[i.YesAndSkip=3]="YesAndSkip";const r={};function o(t){return void 0===t}function a(t){return null==t}function h(t){return"string"==typeof t}const{isFinite:l}=Number;function d(t){return"number"==typeof t}const c=/^-?\d+(?:\.\d+)?$/;const{isArray:u}=Array;function p(t){return t&&"object"==typeof t}function g(t){return p(t)&&!u(t)}function _(t){return"{}"===JSON.stringify(t)}const f={default:(t,e)=>(m(e,t),m(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return m(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&m(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{o(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:m}=f;class y{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(!o(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]=o(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(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!o(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,f:o}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const v={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=x;return e[t]?e[t]++:(e[t]=1,0)}},x=v;let w,E,b;const{max:k}=Math,T=[0,0,0,0],S={zero:[...T],tempFour:T,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>B(T,t,e,i,s),toTempAB(t,e,i){b=i?d(t)?e:t:[],d(t)?(w=L(t),E=e):d(e)?(w=t,E=L(e)):(w=t,E=e),4!==w.length&&(w=P(w)),4!==E.length&&(E=P(E))},get(t,e){let i;if(!d(t))switch(t.length){case 4:i=o(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]),!o(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>d(t)&&d(e)?k(t,e):(R(t,e,i),B(b,k(w[0],E[0]),k(w[1],E[1]),k(w[2],E[2]),k(w[3],E[3]))),add:(t,e,i)=>d(t)&&d(e)?t+e:(R(t,e,i),B(b,w[0]+E[0],w[1]+E[1],w[2]+E[2],w[3]+E[3])),swapAndScale(t,e,i,s){if(d(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[r,o,a,h]=4===t.length?t:P(t);return B(n,a*i,h*e,r*i,o*e)}},{set:B,get:P,setTemp:L,toTempAB:R}=S,{round:C,pow:O,max:M,floor:D,PI:I}=Math,A={within:(t,e,i)=>(p(e)&&(i=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(i)&&t>i&&(t=i),t),fourNumber:S.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),A.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=o(e)?1e12:O(10,e);return-0===(t=C(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(d(e)?e:e.width||0)/i.width,n=(d(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&A.assignScale(s,t);return s},assignScale(t,e){d(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>M(D(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const F=I/180,z=2*I,U=I/2;function H(){return{x:0,y:0}}function N(){return{x:0,y:0,width:0,height:0}}function Y(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:X,cos:V,acos:j,sqrt:G}=Math,{float:K}=A,Z={};function q(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const J={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:q(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:Y,getWorld:q,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){$.toInnerPoint(t,e,Z),$.scaleOfInner(t,Z,i,s)},scaleOfInner(t,e,i,s=i){$.translateInner(t,e.x,e.y),$.scale(t,i,s),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=V(e*=F),a=X(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){$.toInnerPoint(t,e,Z),$.rotateOfInner(t,Z,i)},rotateOfInner(t,e,i){$.translateInner(t,e.x,e.y),$.rotate(t,i),$.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=F,t.a=s+r*i,t.b=n+o*i),e&&(e*=F,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){$.toInnerPoint(t,e,Z),$.skewOfInner(t,Z,i,s)},skewOfInner(t,e,i,s=0){$.translateInner(t,e.x,e.y),$.skew(t,i,s),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+a},multiplyParent(t,e,i,s,n){const{e:r,f:a}=t;if(i||(i=t),o(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*h}},setLayout(t,e,i,s,n){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(o(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,r=i*F,o=V(r),a=X(r);if(s||n){const e=s*F,i=n*F;t.a=(o+i*-a)*h,t.b=(a+i*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||s)&&$.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,p,g,_=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=G(n*n+r*r),c=t/d;const e=n/d;u=r>0?j(e):-j(e)}else{c=G(o*o+a*a),d=t/c;const e=o/c;u=U-(a>0?j(-e):-j(e))}const e=K(V(u)),i=X(u);d=K(d),c=K(c),p=e?K((o/c+i)/e/F,9):0,g=e?K((r/d-i)/e/F,9):0,u=K(u/F)}else d=n,c=a,u=p=g=0;return(e=i||e)&&(_+=e.x*n+e.y*o,f+=e.x*r+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:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=G(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){$.set(t)}},$=J,{float:Q}=A,{toInnerPoint:tt,toOuterPoint:et}=J,{sin:it,cos:st,abs:nt,sqrt:rt,atan2:ot,min:at,round:ht}=Math,lt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=o(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){p(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=dt.defaultPoint);const s=st(e*=F),n=it(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=dt;return ut(i,t),tt(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=dt;return ut(i,t),et(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=dt;return ut(i,t),dt.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(ut(t,e),pt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),tt(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){tt(e,t,i)},toOuterOf(t,e,i){et(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>ct(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=nt(i-t),r=nt(s-e);return rt(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>at(ct(t,e,i,s),ct(i,s,n,r)),getAngle:(t,e)=>gt(t,e)/F,getRotation:(t,e,i,s)=>(s||(s=e),dt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/F),getRadianFrom(t,e,i,s,n,r,a,h){o(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>ot(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const r=gt(t,e);return n&&(t=e),s||(e={}),e.x=t.x+st(r)*i,e.y=t.y+it(r)*i,e},toNumberPoints(t){let e=t;return p(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>Q(t.x)===Q(e.x)&&Q(t.y)===Q(e.y),reset(t){dt.reset(t)}},dt=lt,{getDistanceFrom:ct,copy:ut,setRadius:pt,getAtan2:gt}=dt;class _t{constructor(t,e){this.set(t,e)}set(t,e){return p(t)?lt.copy(this,t):lt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new _t(this)}move(t,e){return lt.move(this,t,e),this}scale(t,e){return lt.scale(this,t,e),this}scaleOf(t,e,i){return lt.scaleOf(this,t,e,i),this}rotate(t,e){return lt.rotate(this,t,e),this}rotateOf(t,e){return lt.rotate(this,e,t),this}getRotation(t,e,i){return lt.getRotation(this,t,e,i)}toInnerOf(t,e){return lt.toInnerOf(this,t,e),this}toOuterOf(t,e){return lt.toOuterOf(this,t,e),this}getCenter(t){return new _t(lt.getCenter(this,t))}getDistance(t){return lt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new _t(lt.getDistancePoint(this,t,e,i,s))}getAngle(t){return lt.getAngle(this,t)}getAtan2(t){return lt.getAtan2(this,t)}isSame(t){return lt.isSame(this,t)}reset(){return lt.reset(this),this}}const ft=new _t;class mt{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return p(t)?J.copy(this,t):J.set(this,t,e,i,s,n,r),this}setWith(t){return J.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new mt(this)}translate(t,e){return J.translate(this,t,e),this}translateInner(t,e){return J.translateInner(this,t,e),this}scale(t,e){return J.scale(this,t,e),this}scaleWith(t,e){return J.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return J.pixelScale(this,t),this}scaleOfOuter(t,e,i){return J.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return J.scaleOfInner(this,t,e,i),this}rotate(t){return J.rotate(this,t),this}rotateOfOuter(t,e){return J.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return J.rotateOfInner(this,t,e),this}skew(t,e){return J.skew(this,t,e),this}skewOfOuter(t,e,i){return J.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return J.skewOfInner(this,t,e,i),this}multiply(t){return J.multiply(this,t),this}multiplyParent(t){return J.multiplyParent(this,t),this}divide(t){return J.divide(this,t),this}divideParent(t){return J.divideParent(this,t),this}invert(){return J.invert(this),this}invertWith(){return J.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){J.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){J.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return J.setLayout(this,t,e,i),this}getLayout(t,e,i){return J.getLayout(this,t,e,i)}withScale(t,e){return J.withScale(this,t,e)}reset(){J.reset(this)}}const yt=new mt,vt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){xt(t,e,i),xt(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:xt}=vt;var wt,Et;t.Direction4=void 0,(wt=t.Direction4||(t.Direction4={}))[wt.top=0]="top",wt[wt.right=1]="right",wt[wt.bottom=2]="bottom",wt[wt.left=3]="left",t.Direction9=void 0,(Et=t.Direction9||(t.Direction9={}))[Et.topLeft=0]="topLeft",Et[Et.top=1]="top",Et[Et.topRight=2]="topRight",Et[Et.right=3]="right",Et[Et.bottomRight=4]="bottomRight",Et[Et.bottom=5]="bottom",Et[Et.bottomLeft=6]="bottomLeft",Et[Et.left=7]="left",Et[Et.center=8]="center",Et[Et["top-left"]=0]="top-left",Et[Et["top-right"]=2]="top-right",Et[Et["bottom-right"]=4]="bottom-right",Et[Et["bottom-left"]=6]="bottom-left";const bt=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];bt.forEach(t=>t.type="percent");const kt={directionData:bt,tempPoint:{},get:Tt,toPoint(t,e,i,s,n,r){const o=Tt(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),kt.toPoint(t,e,i,!0),i)};function Tt(e){return h(e)?bt[t.Direction9[e]]:e}const{toPoint:St}=kt,Bt={toPoint(t,e,i,s,n,r){St(t,i,s,n,e,r)}},{tempPointBounds:Pt,setPoint:Lt,addPoint:Rt,toBounds:Ct}=vt,{toOuterPoint:Ot}=J,{float:Mt,fourNumber:Dt}=A,{floor:It,ceil:At}=Math;let Wt,Ft,zt,Ut;const Ht={},Nt={},Yt={},Xt={tempBounds:Yt,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(u(i)){const e=Dt(i);s?Vt.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Vt.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Vt.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Vt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Gt(e,t):e=t,i||(i=t),e.offsetX=Vt.maxX(i),e.offsetY=Vt.maxY(i),Vt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||lt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){lt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Vt.copy(Yt,t),Vt.toOuterOf(Yt,e),Yt),getOuterOf:(t,e)=>(t=Object.assign({},t),Vt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:r,f:o}=e;s>0?(i.width=t.width*s,i.x=r+t.x*s):(i.width=t.width*-s,i.x=r+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=o+t.y*n):(i.height=t.height*-n,i.y=o+t.y*n-i.height)}else Ht.x=t.x,Ht.y=t.y,Ot(e,Ht,Nt),Lt(Pt,Nt.x,Nt.y),Ht.x=t.x+t.width,Ot(e,Ht,Nt),Rt(Pt,Nt.x,Nt.y),Ht.y=t.y+t.height,Ot(e,Ht,Nt),Rt(Pt,Nt.x,Nt.y),Ht.x=t.x,Ot(e,Ht,Nt),Rt(Pt,Nt.x,Nt.y),Ct(Pt,i)},toInnerOf(t,e,i){i||(i=t),Vt.move(i,-e.e,-e.f),Vt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Vt.getFitScale(t,e));return new mt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,r){r||(r=e),h(s)&&(s=Vt.getFitScale(t,e,"cover"===s)),Yt.width=n?e.width*=s:e.width*s,Yt.height=n?e.height*=s:e.height*s,Bt.toPoint(i,Yt,t,r,!0,!0)},getSpread(t,e,i){const s={};return Vt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Vt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Vt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=It(t.x),t.y=It(t.y),t.width=e>t.x?At(t.width+e-t.x):At(t.width),t.height=i>t.y?At(t.height+i-t.y):At(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Mt(t.x,e),t.y=Mt(t.y,e),t.width=Mt(t.width,e),t.height=Mt(t.height,e)},add(t,e,i){Wt=t.x+t.width,Ft=t.y+t.height,zt=e.x,Ut=e.y,i||(zt+=e.width,Ut+=e.height),Wt=Wt>zt?Wt:zt,Ft=Ft>Ut?Ft:Ut,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Wt-t.x,t.height=Ft-t.y},addList(t,e){Vt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Vt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Vt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||Gt(t,n)):jt(t,n));r&&Vt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Lt(Pt,t.x,t.y):Rt(Pt,t.x,t.y)),Ct(Pt,t)},setPoint(t,e){Vt.set(t,e.x,e.y)},addPoint(t,e){jt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=lt.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=lt.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Vt.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=Vt.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=Vt.tempToOuterOf(e,i)),!Vt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return Wt=s+r,Ft=n+o,zt=t.x+t.width,Ut=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Wt=Wt<zt?Wt:zt,Ft=Ft<Ut?Ft:Ut,r=Wt-s,o=Ft-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Vt.copy(t,Vt.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){Vt.set(t)}},Vt=Xt,{add:jt,copy:Gt}=Vt;class Kt{get minX(){return Xt.minX(this)}get minY(){return Xt.minY(this)}get maxX(){return Xt.maxX(this)}get maxY(){return Xt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return p(t)?Xt.copy(this,t):Xt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Kt(this)}move(t,e){return Xt.move(this,t,e),this}scale(t,e,i){return Xt.scale(this,t,e,i),this}scaleOf(t,e,i){return Xt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Xt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Xt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Xt.getFitMatrix(this,t,e)}put(t,e,i){Xt.put(this,t,e,i)}spread(t,e){return Xt.spread(this,t,e),this}shrink(t,e){return Xt.shrink(this,t,e),this}ceil(){return Xt.ceil(this),this}unsign(){return Xt.unsign(this),this}float(t){return Xt.float(this,t),this}add(t){return Xt.add(this,t),this}addList(t){return Xt.setList(this,t,!0),this}setList(t){return Xt.setList(this,t),this}addListWithFn(t,e){return Xt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Xt.setListWithFn(this,t,e),this}setPoint(t){return Xt.setPoint(this,t),this}setPoints(t){return Xt.setPoints(this,t),this}addPoint(t){return Xt.addPoint(this,t),this}getPoints(){return Xt.getPoints(this)}hitPoint(t,e){return Xt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Xt.hitRadiusPoint(this,t,e)}hit(t,e){return Xt.hit(this,t,e)}includes(t,e){return Xt.includes(this,t,e)}intersect(t,e){return Xt.intersect(this,t,e),this}getIntersect(t,e){return new Kt(Xt.getIntersectData(this,t,e))}isSame(t){return Xt.isSame(this,t)}isEmpty(){return Xt.isEmpty(this)}reset(){Xt.reset(this)}}const Zt=new Kt;class qt{constructor(t,e,i,s,n,r){p(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new Kt(n,e,r||t.width-n-i,o||t.height-e-s)}}const Jt={number:(t,e)=>p(t)?"percent"===t.type?t.value*e:t.value:t},$t={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:Qt,max:te}=Math,ee={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||ie.maxCacheSize),isSuperLarge:(t,e,i)=>ie.isLarge(t,e,i,ie.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=ie;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h,l){const d=te(Qt(e+(s||0)),1),c=te(Qt(i+(n||0)),1);let u,p,g;l&&(g=Jt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:p=!0);const _=ee.origin.createCanvas(p?2*d:d,u?2*c:c),f=_.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==o,ie.canUse(t)){if(r){const s=e/r.width,n=i/r.height;f.setTransform(s,0,0,n,-r.x*s,-r.y*n),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&&f.stintSet(i,"transform",e)}}},{image:ie}=ee,{randColor:se}=A;class ne{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ne(t)}static set filter(t){this.filterList=re(t)}static set exclude(t){this.excludeList=re(t)}static drawRepaint(t,e){const i=se();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ne.showBounds,n=t.__nowWorld,r=se();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(oe.enable){if(oe.filterList.length&&oe.filterList.every(t=>t!==this.name))return;if(oe.excludeList.length&&oe.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){oe.enable&&this.warn(...t)}warn(...t){oe.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function re(t){return t?h(t)&&(t=[t]):t=[],t}ne.filterList=[],ne.excludeList=[],ne.showWarn=!0;const oe=ne,ae=ne.get("RunTime"),he={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=v.create(v.RUNTIME);return le.currentId=le.idMap[i]=e?performance.now():Date.now(),le.currentName=le.nameMap[i]=t,le.nameToIdMap[t]=i,i},end(t,e){const i=le.idMap[t],s=le.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;le.idMap[t]=le.nameMap[t]=le.nameToIdMap[s]=void 0,ae.log(s,n,"ms")},endOfName(t,e){const i=le.nameToIdMap[t];o(i)||le.end(i,e)}},le=he,de=[],ce={list:{},add(t,...e){this.list[t]=!0,de.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>de.forEach(t=>ce.has(t,!0)));const ue={editor:t=>ce.need("editor")},pe=ne.get("UICreator"),ge={list:{},register(t){const{__tag:e}=t.prototype;_e[e]&&pe.repeat(e),_e[e]=t},get(t,e,i,s,n,r){if(!_e[t])return void pe.warn("not register "+t);const a=new _e[t](e);return o(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),r&&(a.height=r)),a}},{list:_e}=ge,fe=ne.get("EventCreator"),me={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],h(e)&&(ye[e]&&fe.repeat(e),ye[e]=t)})},changeName(t,e){const i=ye[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ye[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ye[t](...e)},{nameList:ye}=me;class ve{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ue.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 xe(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)}}const we=[];function Ee(){return(t,e)=>{we.push(e)}}const be=[];class ke{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||be)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;we.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){p(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,r)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}s([xe("imageSmoothingEnabled")],ke.prototype,"smooth",void 0),s([xe("imageSmoothingQuality")],ke.prototype,"smoothLevel",void 0),s([xe("globalAlpha")],ke.prototype,"opacity",void 0),s([xe()],ke.prototype,"fillStyle",void 0),s([xe()],ke.prototype,"strokeStyle",void 0),s([xe("lineWidth")],ke.prototype,"strokeWidth",void 0),s([xe("lineCap")],ke.prototype,"strokeCap",void 0),s([xe("lineJoin")],ke.prototype,"strokeJoin",void 0),s([xe("lineDashOffset")],ke.prototype,"dashOffset",void 0),s([xe()],ke.prototype,"miterLimit",void 0),s([xe()],ke.prototype,"shadowBlur",void 0),s([xe()],ke.prototype,"shadowColor",void 0),s([xe()],ke.prototype,"shadowOffsetX",void 0),s([xe()],ke.prototype,"shadowOffsetY",void 0),s([xe()],ke.prototype,"filter",void 0),s([xe()],ke.prototype,"font",void 0),s([xe()],ke.prototype,"fontKerning",void 0),s([xe()],ke.prototype,"fontStretch",void 0),s([xe()],ke.prototype,"fontVariantCaps",void 0),s([xe()],ke.prototype,"textAlign",void 0),s([xe()],ke.prototype,"textBaseline",void 0),s([xe()],ke.prototype,"textRendering",void 0),s([xe()],ke.prototype,"wordSpacing",void 0),s([xe()],ke.prototype,"letterSpacing",void 0),s([xe()],ke.prototype,"direction",void 0),s([Ee()],ke.prototype,"setTransform",null),s([Ee()],ke.prototype,"resetTransform",null),s([Ee()],ke.prototype,"getTransform",null),s([Ee()],ke.prototype,"save",null),s([Ee()],ke.prototype,"restore",null),s([Ee()],ke.prototype,"translate",null),s([Ee()],ke.prototype,"scale",null),s([Ee()],ke.prototype,"rotate",null),s([Ee()],ke.prototype,"fill",null),s([Ee()],ke.prototype,"stroke",null),s([Ee()],ke.prototype,"clip",null),s([Ee()],ke.prototype,"fillRect",null),s([Ee()],ke.prototype,"strokeRect",null),s([Ee()],ke.prototype,"clearRect",null),s([Ee()],ke.prototype,"beginPath",null),s([Ee()],ke.prototype,"moveTo",null),s([Ee()],ke.prototype,"lineTo",null),s([Ee()],ke.prototype,"bezierCurveTo",null),s([Ee()],ke.prototype,"quadraticCurveTo",null),s([Ee()],ke.prototype,"closePath",null),s([Ee()],ke.prototype,"arc",null),s([Ee()],ke.prototype,"arcTo",null),s([Ee()],ke.prototype,"ellipse",null),s([Ee()],ke.prototype,"rect",null),s([Ee()],ke.prototype,"roundRect",null),s([Ee()],ke.prototype,"createConicGradient",null),s([Ee()],ke.prototype,"createLinearGradient",null),s([Ee()],ke.prototype,"createPattern",null),s([Ee()],ke.prototype,"createRadialGradient",null),s([Ee()],ke.prototype,"fillText",null),s([Ee()],ke.prototype,"measureText",null),s([Ee()],ke.prototype,"strokeText",null);const{copy:Te,multiplyParent:Se,pixelScale:Be}=J,{round:Pe}=Math,Le=new Kt,Re=new Kt,Ce={width:1,height:1,pixelRatio:1},Oe=["width","height","pixelRatio"];class Me extends ke{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=Ce),this.manager=e,this.innerId=v.create(v.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||ee.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;f.copyAttrs(s,t,Oe),Oe.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Kt(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,n=this.worldTransform;e&&Se(t,e,n),Be(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Pe(n.e-.5)+.5,n.f=Pe(n.f-.5)+.5):(n.e=Pe(n.e),n.f=Pe(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),o(e.dashPattern)||(n=e.dashPattern),o(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=r,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Re):i=Le,this.drawImage(t.view,Le.x,Le.y,Le.width,Le.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,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Xt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Le.x,Le.y,Le.width,Le.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Le.x,Le.y,Le.width,Le.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,Le.x,Le.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(Le.x,Le.y,Le.width,Le.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Le.x,Le.y,Le.width,Le.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Le.x,Le.y,Le.width,Le.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Le.x,Le.y,Le.width,Le.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Le,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Re,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):ue.canvas(Object.assign({},i));return n.save(),t&&(Te(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const De={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ie={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ae=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},Ie),We={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},Fe={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},ze=Object.assign(Object.assign({},Fe),Ie),Ue=Ae,He={};for(let t in Ue)He[Ue[t]]=t;const Ne={};for(let t in Ue)Ne[Ue[t]]=We[t];const Ye={drawRoundRect(t,e,i,s,n,r){const o=A.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:Xe,cos:Ve,hypot:je,atan2:Ge,ceil:Ke,abs:Ze,PI:qe,sqrt:Je,pow:$e}=Math,{setPoint:Qe,addPoint:ti}=vt,{set:ei,toNumberPoints:ii}=lt,{M:si,L:ni,C:ri,Q:oi,Z:ai}=Ae,hi={},li={points(t,e,i,s){let n=ii(e);if(t.push(si,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,p,g,_,f,m,y,v=n.length;const x=!0===i?.5:i;s&&(n=[n[v-2],n[v-1],...n,n[0],n[1],n[2],n[3]],v=n.length);for(let i=2;i<v-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],g=o-e,_=a-r,f=Je($e(g,2)+$e(_,2)),m=Je($e(h-o,2)+$e(l-a,2)),(f||m)&&(y=f+m,f=x*f/y,m=x*m/y,h-=e,l-=r,d=o-f*h,c=a-f*l,2===i?s||t.push(oi,d,c,o,a):(g||_)&&t.push(ri,u,p,d,c,o,a),u=o+m*h,p=a+m*l);s||t.push(oi,u,p,n[v-2],n[v-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ni,n[e],n[e+1]);s&&t.push(ai)},rect(t,e,i,s,n){De.creator.path=t,De.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){De.creator.path=[],Ye.drawRoundRect(De.creator,e,i,s,n,r),t.push(...De.convertToCanvasData(De.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,p=r-s,g=o-n;let _=Ge(u,c),f=Ge(g,p);const m=je(c,u),y=je(p,g);let v=f-_;if(v<0&&(v+=z),m<1e-12||y<1e-12||v<1e-12||Ze(v-qe)<1e-12)return t&&t.push(ni,s,n),h&&(Qe(h,e,i),ti(h,s,n)),d&&ei(d,e,i),void(l&&ei(l,s,n));const x=c*g-p*u<0,w=x?-1:1,E=a/Ve(v/2),b=s+E*Ve(_+v/2+U*w),k=n+E*Xe(_+v/2+U*w);return _-=U*w,f-=U*w,ui(t,b,k,a,a,0,_/F,f/F,x,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>ui(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*F,p=Xe(u),g=Ve(u);let _=o*F,f=a*F;_>qe&&(_-=z),f<0&&(f+=z);let m=f-_;m<0?m+=z:m>z&&(m-=z),h&&(m-=z);const y=Ke(Ze(m/U)),v=m/y,x=Xe(v/4),w=8/3*x*x/Xe(v/2);f=_+v;let E,b,k,T,S,B,P,L,R=Ve(_),C=Xe(_),O=k=g*s*R-p*n*C,M=T=p*s*R+g*n*C,D=e+k,I=i+T;t&&t.push(t.length?ni:si,D,I),l&&Qe(l,D,I),c&&ei(c,D,I);for(let r=0;r<y;r++)E=Ve(f),b=Xe(f),k=g*s*E-p*n*b,T=p*s*E+g*n*b,S=e+O-w*(g*s*C+p*n*R),B=i+M-w*(p*s*C-g*n*R),P=e+k+w*(g*s*b+p*n*E),L=i+T+w*(p*s*b-g*n*E),t&&t.push(ri,S,B,P,L,e+k,i+T),l&&ci(e+O,i+M,S,B,P,L,e+k,i+T,l,!0),O=k,M=T,R=E,C=b,_=f,f+=v;d&&ei(d,e+k,i+T)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(ri,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){ci(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,p,g,_,f,m,y,v=t,x=i,w=n,E=o;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=r,E=a),c=-3*v+9*x-9*w+3*E,u=6*v-12*x+6*w,p=3*x-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?ti(h,t,e):Qe(h,t,e),ti(h,o,a);for(let l=0,c=d.length;l<c;l++)di(d[l],t,e,i,s,n,r,o,a,hi),ti(h,hi.x,hi.y)},getPointAndSet(t,e,i,s,n,r,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,g=t*t*t;l.x=c*e+u*s+p*r+g*a,l.y=c*i+u*n+p*o+g*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return di(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:di,toTwoPointBounds:ci,ellipse:ui}=li,{sin:pi,cos:gi,sqrt:_i,atan2:fi}=Math,{ellipse:mi}=li,yi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,p=r*F,g=pi(p),_=gi(p),f=-_*c-g*u,m=-_*u+g*c,y=s*s,v=n*n,x=m*m,w=f*f,E=y*v-y*x-v*w;let b=0;if(E<0){const t=_i(1-E/(y*v));s*=t,n*=t}else b=(o===a?-1:1)*_i(E/(y*x+v*w));const k=b*s*m/n,T=-b*n*f/s,S=fi((m-T)/n,(f-k)/s),B=fi((-m-T)/n,(-f-k)/s);let P=B-S;0===a&&P>0?P-=z:1===a&&P<0&&(P+=z);const L=e+c+_*k-g*T,R=i+u+g*k+_*T,C=P<0?1:0;d||ee.ellipseToCurve?mi(t,L,R,s,n,r,S/F,B/F,C):s!==n||r?t.push(Ae.G,L,R,s,n,r,S/F,B/F,C):t.push(Ae.O,L,R,s,S/F,B/F,C)}},vi={toCommand:t=>[],toNode:t=>[]},{M:xi,m:wi,L:Ei,l:bi,H:ki,h:Ti,V:Si,v:Bi,C:Pi,c:Li,S:Ri,s:Ci,Q:Oi,q:Mi,T:Di,t:Ii,A:Ai,a:Wi,Z:Fi,z:zi,N:Ui,D:Hi,X:Ni,G:Yi,F:Xi,O:Vi,P:ji,U:Gi}=Ae,{rect:Ki,roundRect:Zi,arcTo:qi,arc:Ji,ellipse:$i,quadraticCurveTo:Qi}=li,{ellipticalArc:ts}=yi,es=ne.get("PathConvert"),is={},ss={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=Ne[s],a+=s===n?" ":He[s];for(let s=1;s<i;s++)a+=A.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?ze:Fe;for(let e=0,h=t.length;e<h;e++)s=t[e],$t[s]?("."===s&&(ns.dot&&(rs(o,r),r=""),ns.dot++),"0"===r&&"."!==s&&(rs(o,r),r=""),r+=s):Ae[s]?(r&&(rs(o,r),r=""),ns.name=Ae[s],ns.length=We[s],ns.index=0,rs(o,ns.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&rs(o,r),r=s):r&&(rs(o,r),r=""),n=s;return r&&rs(o,r),i?ss.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(n=t[c],n){case wi:t[c+1]+=a,t[c+2]+=h;case xi:a=t[c+1],h=t[c+2],p.push(xi,a,h),c+=3;break;case Ti:t[c+1]+=a;case ki:a=t[c+1],p.push(Ei,a,h),c+=2;break;case Bi:t[c+1]+=h;case Si:h=t[c+1],p.push(Ei,a,h),c+=2;break;case bi:t[c+1]+=a,t[c+2]+=h;case Ei:a=t[c+1],h=t[c+2],p.push(Ei,a,h),c+=3;break;case Ci:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ri;case Ri:o=r===Pi||r===Ri,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(Pi,l,d,i,s,a,h),c+=5;break;case Li:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Pi;case Pi:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(Pi,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Ii:t[c+1]+=a,t[c+2]+=h,n=Di;case Di:o=r===Oi||r===Di,i=o?2*a-i:t[c+1],s=o?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 Mi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=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 Wi:t[c+6]+=a,t[c+7]+=h;case Ai:ts(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 zi:case Fi:p.push(Fi),c++;break;case Ui:a=t[c+1],h=t[c+2],e?Ki(p,a,h,t[c+3],t[c+4]):os(p,t,c,5),c+=5;break;case Hi:a=t[c+1],h=t[c+2],e?Zi(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):os(p,t,c,9),c+=9;break;case Ni:a=t[c+1],h=t[c+2],e?Zi(p,a,h,t[c+3],t[c+4],t[c+5]):os(p,t,c,6),c+=6;break;case Yi:$i(e?p:os(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,is),a=is.x,h=is.y,c+=9;break;case Xi:e?$i(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):os(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Vi:Ji(e?p:os(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,is),a=is.x,h=is.y,c+=7;break;case ji:e?Ji(p,t[c+1],t[c+2],t[c+3],0,360,!1):os(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Gi:qi(e?p:os(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,is),a=is.x,h=is.y,c+=6;break;default:return es.error(`command: ${n} [index:${c}]`,t),p}r=n}return p},objectToCanvasData(t){if(t[0].name.length>1)return vi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(xi,t.x,t.y);break;case"L":e.push(Ei,t.x,t.y);break;case"C":e.push(Pi,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Oi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Fi)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){ns.index===ns.length&&(ns.index=1,t.push(ns.name)),t.push(Number(e)),ns.index++,ns.dot=0}},{current:ns,pushData:rs,copyData:os}=ss,{M:as,L:hs,C:ls,Q:ds,Z:cs,N:us,D:ps,X:gs,G:_s,F:fs,O:ms,P:ys,U:vs}=Ae,{getMinDistanceFrom:xs,getRadianFrom:ws}=lt,{tan:Es,min:bs,abs:ks}=Math,Ts={},Ss={beginPath(t){t.length=0},moveTo(t,e,i){t.push(as,e,i)},lineTo(t,e,i){t.push(hs,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(ls,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(ds,e,i,s,n)},closePath(t){t.push(cs)},rect(t,e,i,s,n){t.push(us,e,i,s,n)},roundRect(t,e,i,s,n,r){if(d(r))t.push(gs,e,i,s,n,r);else{const o=A.fourNumber(r);o?t.push(ps,e,i,s,n,...o):t.push(us,e,i,s,n)}},ellipse(t,e,i,s,n,r,o,h,l){if(s===n)return Ps(t,e,i,s,o,h,l);a(r)?t.push(fs,e,i,s,n):(a(o)&&(o=0),a(h)&&(h=360),t.push(_s,e,i,s,n,r,o,h,l?1:0))},arc(t,e,i,s,n,r,o){a(n)?t.push(ys,e,i,s):(a(n)&&(n=0),a(r)&&(r=360),t.push(ms,e,i,s,n,r,o?1:0))},arcTo(t,e,i,s,n,r,a,h,l){if(!o(a)){const t=xs(a,h,e,i,s,n)/(l?1:2);r=bs(r,bs(t,t*ks(Es(ws(a,h,e,i,s,n)/2))))}t.push(vs,e,i,s,n,r)},drawEllipse(t,e,i,s,n,r,o,h,l){li.ellipse(null,e,i,s,n,a(r)?0:r,a(o)?0:o,a(h)?360:h,l,null,null,Ts),t.push(as,Ts.x,Ts.y),Bs(t,e,i,s,n,r,o,h,l)},drawArc(t,e,i,s,n,r,o){li.arc(null,e,i,s,a(n)?0:n,a(r)?360:r,o,null,null,Ts),t.push(as,Ts.x,Ts.y),Ps(t,e,i,s,n,r,o)},drawPoints(t,e,i,s){li.points(t,e,i,s)}},{ellipse:Bs,arc:Ps}=Ss,{moveTo:Ls,lineTo:Rs,quadraticCurveTo:Cs,bezierCurveTo:Os,closePath:Ms,beginPath:Ds,rect:Is,roundRect:As,ellipse:Ws,arc:Fs,arcTo:zs,drawEllipse:Us,drawArc:Hs,drawPoints:Ns}=Ss;class Ys{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?h(t)?De.parse(t):t:[],this}beginPath(){return Ds(this.__path),this.paint(),this}moveTo(t,e){return Ls(this.__path,t,e),this.paint(),this}lineTo(t,e){return Rs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return Os(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Cs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ms(this.__path),this.paint(),this}rect(t,e,i,s){return Is(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return As(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Ws(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return Fs(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return zs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return Us(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return Hs(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return Ns(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Xs,L:Vs,C:js,Q:Gs,Z:Ks,N:Zs,D:qs,X:Js,G:$s,F:Qs,O:tn,P:en,U:sn}=Ae,nn=ne.get("PathDrawer"),rn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Xs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Vs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case js:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Gs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ks:t.closePath(),s+=1;break;case Zs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case qs: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 Js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*F,e[s+6]*F,e[s+7]*F,e[s+8]),s+=9;break;case Qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,z,!1),s+=5;break;case tn:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*F,e[s+5]*F,e[s+6]),s+=7;break;case en:t.arc(e[s+1],e[s+2],e[s+3],0,z,!1),s+=4;break;case sn:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void nn.error(`command: ${i} [index:${s}]`,e)}}},{M:on,L:an,C:hn,Q:ln,Z:dn,N:cn,D:un,X:pn,G:gn,F:_n,O:fn,P:mn,U:yn}=Ae,{toTwoPointBounds:vn,toTwoPointBoundsByQuadraticCurve:xn,arcTo:wn,arc:En,ellipse:bn}=li,{addPointBounds:kn,copy:Tn,addPoint:Sn,setPoint:Bn,addBounds:Pn,toBounds:Ln}=vt,Rn=ne.get("PathBounds");let Cn,On,Mn;const Dn={},In={},An={},Wn={toBounds(t,e){Wn.toTwoPointBounds(t,In),Ln(In,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Bn(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===dn||o===hn||o===ln?Bn(e,h,l):Bn(e,t[a+1],t[a+2])),o){case on:case an:h=t[a+1],l=t[a+2],Sn(e,h,l),a+=3;break;case hn:n=t[a+5],r=t[a+6],vn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,Dn),kn(e,Dn),h=n,l=r,a+=7;break;case ln:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],xn(h,l,i,s,n,r,Dn),kn(e,Dn),h=n,l=r,a+=5;break;case dn:a+=1;break;case cn:h=t[a+1],l=t[a+2],Pn(e,h,l,t[a+3],t[a+4]),a+=5;break;case un:case pn:h=t[a+1],l=t[a+2],Pn(e,h,l,t[a+3],t[a+4]),a+=o===un?9:6;break;case gn:bn(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],Dn,An),0===a?Tn(e,Dn):kn(e,Dn),h=An.x,l=An.y,a+=9;break;case _n:h=t[a+1],l=t[a+2],On=t[a+3],Mn=t[a+4],Pn(e,h-On,l-Mn,2*On,2*Mn),h+=On,a+=5;break;case fn:En(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Dn,An),0===a?Tn(e,Dn):kn(e,Dn),h=An.x,l=An.y,a+=7;break;case mn:h=t[a+1],l=t[a+2],Cn=t[a+3],Pn(e,h-Cn,l-Cn,2*Cn,2*Cn),h+=Cn,a+=4;break;case yn:wn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Dn,An),0===a?Tn(e,Dn):kn(e,Dn),h=An.x,l=An.y,a+=6;break;default:return void Rn.error(`command: ${o} [index:${a}]`,t)}}},{M:Fn,L:zn,Z:Un}=Ae,{getCenterX:Hn,getCenterY:Nn}=lt,{arcTo:Yn}=Ss,Xn={smooth(t,e,i){let s,n,r,o=0,a=0,h=0,l=0,d=0,c=0,p=0,g=0,_=0;u(e)&&(e=e[0]||0);const f=t.length,m=9===f,y=[];for(;o<f;){switch(s=t[o],s){case Fn:l=g=t[o+1],d=_=t[o+2],o+=3,t[o]===zn?(c=t[o+1],p=t[o+2],m?y.push(Fn,l,d):y.push(Fn,Hn(l,c),Nn(d,p))):y.push(Fn,l,d);break;case zn:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case zn:Yn(y,a,h,t[o+1],t[o+2],e,g,_,m);break;case Un:Yn(y,a,h,l,d,e,g,_,m);break;default:y.push(zn,a,h)}g=a,_=h;break;case Un:n!==Un&&(Yn(y,l,d,c,p,e,g,_,m),y.push(Un)),o+=1;break;default:r=Ne[s];for(let e=0;e<r;e++)y.push(t[o+e]);o+=r}n=s}return s!==Un&&(y[1]=l,y[2]=d),y}};function Vn(t){return new Ys(t)}const jn=Vn();De.creator=Vn(),De.parse=ss.parse,De.convertToCanvasData=ss.toCanvasData;const{drawRoundRect:Gn}=Ye;function Kn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Gn(this,t,e,i,s,n)})}(t)}const Zn={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=qn.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){