You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@leafer-ui/draw

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leafer-ui/draw - npm Package Compare versions

Comparing version
1.9.7
to
1.9.8
+1
-1
lib/draw.esm.min.js

@@ -1,2 +0,2 @@

import{defineKey as t,decorateLeafAttr as e,attr as i,createDescriptor as s,Plugin as o,isObject as r,PathConvert as a,DataHelper as n,Debug as h,LeafData as _,isString as d,isUndefined as l,isArray as p,canvasSizeAttrs as u,UICreator as c,MathHelper as g,Bounds as y,dataProcessor as v,dataType as f,surfaceType as w,opacityType as x,visibleType as S,dimType as m,sortType as R,maskType as k,eraserType as B,positionType as b,boundsType as A,scaleType as C,rotationType as P,scrollType as F,autoLayoutType as W,naturalBoundsType as I,affectRenderBoundsType as T,pathInputType as D,pathType as E,hitType as L,strokeType as M,cursorType as z,rewrite as O,Leaf as N,useModule as V,rewriteAble as H,pen as Y,PathCorner as U,PathDrawer as j,isNumber as X,registerUI as J,Branch as q,LeafList as G,Resource as $,getBoundsData as K,Creator as Q,CanvasManager as Z,WaitHelper as tt,LeaferEvent as et,ResizeEvent as it,AutoBounds as st,Run as ot,LayoutEvent as rt,RenderEvent as at,WatchEvent as nt,ImageManager as ht,BoundsHelper as _t,PathCommandDataHelper as dt,Platform as lt,PointHelper as pt,affectStrokeBoundsType as ut,getPointData as ct,LeaferImage as gt,ImageEvent as yt,Matrix as vt,PathCreator as ft}from"@leafer/core";export*from"@leafer/core";function wt(t,e,i,s){var o,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(r<3?o(a):r>3?o(e,i,a):o(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a}function xt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function St(t){return e(t,t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function mt(){return(e,i)=>{const s="_"+i;t(e,i,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}function Rt(e){return(i,o)=>{t(i,o,s(o,e))}}"function"==typeof SuppressedError&&SuppressedError;const kt={},Bt={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}},bt={number:(t,e)=>r(t)?"percent"===t.type?t.value*e:t.value:t},At={},Ct={},Pt={},Ft={},Wt={},It={apply(){o.need("filter")}},Tt={},Dt={setStyleName:()=>o.need("state"),set:()=>o.need("state")},Et={list:{},register(t,e){Et.list[t]=e},get:t=>Et.list[t]},{parse:Lt,objectToCanvasData:Mt}=a,{stintSet:zt}=n,{hasTransparent:Ot}=Bt,Nt={},Vt=h.get("UIData");class Ht extends _{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Vt.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Vt.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),d(t)||!t?(zt(this,"__isTransparentFill",Ot(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):r(t)&&this.__setPaint("fill",t)}setStroke(t){d(t)||!t?(zt(this,"__isTransparentStroke",Ot(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):r(t)&&this.__setPaint("stroke",t)}setPath(t){const e=d(t);e||t&&r(t[0])?(this.__setInput("path",t),this._path=e?Lt(t):Mt(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Yt(this,"shadow",t)}setInnerShadow(t){Yt(this,"innerShadow",t)}setFilter(t){Yt(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Ct.compute("fill",this.__leaf),e&&Ct.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),l(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),p(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Nt)):(this.__isStrokes=!0,this._stroke||(this._stroke=Nt))}__removePaint(t,e){e&&this.__removeInput(t),Pt.recycleImage(t,this),"fill"===t?(zt(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(zt(this,"__isAlphaPixelStroke",void 0),zt(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Yt(t,e,i){t.__setInput(e,i),p(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class Ut extends Ht{}class jt extends Ut{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Xt extends Ut{__getInputData(t,e){const i=super.__getInputData(t,e);return u.forEach(t=>delete i[t]),i}}class Jt extends jt{}class qt extends Ht{get __usePathBox(){return this.points||this.__pathInputed}}class Gt extends Ht{get __boxStroke(){return!this.__pathInputed}}class $t extends Ht{get __boxStroke(){return!this.__pathInputed}}class Kt extends qt{}class Qt extends Ht{}class Zt extends Ht{get __pathInputed(){return 2}}class te extends Ut{}const ee={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ie extends Ht{get __useNaturalRatio(){return!1}setFontWeight(t){d(t)?(this.__setInput("fontWeight",t),t=ee[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=c.get("Rect",0);const o=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=o.boxBounds),i.set(t),r.strokeChanged&&o.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class se extends Gt{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class oe extends Gt{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const re={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),r&&(t=Math.max(r.__layout.strokeSpread=r.__updateStrokeSpread(),t),e=r.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:r,renderSpread:a}=this.__;e&&(t=Wt.getShadowSpread(this,e)),s&&(t=Math.max(t,s)),r&&(t+=It.getSpread(r)),a&&(t+=a);let n=t=Math.ceil(t);return i&&i.forEach(t=>n=Math.max(n,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),o&&(n=Math.max(n,o)),this.__layout.renderShapeSpread=n,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{float:ae}=g,ne=new y,he=new y,_e=new y,de={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&le.getValidMove(t.__localBoxBounds,le.getDragBounds(t),s,e,!0),le.axisMove(t,e)},limitScaleOf(t,e,i){const{dragBounds:s,dragBoundsType:o}=t;s&&le.getValidScaleOf(t.__localBoxBounds,le.getDragBounds(t),o,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,o){const r=t.x+s.x,a=t.y+s.y,n=r+t.width,h=a+t.height,_=e.x+e.width,d=e.y+e.height;return o||(s=Object.assign({},s)),le.isInnerMode(t,e,i,"width")?r>e.x?s.x+=e.x-r:n<_&&(s.x+=_-n):r<e.x?s.x+=e.x-r:n>_&&(s.x+=_-n),le.isInnerMode(t,e,i,"height")?a>e.y?s.y+=e.y-a:h<d&&(s.y+=d-h):a<e.y?s.y+=e.y-a:h>d&&(s.y+=d-h),s.x=ae(s.x),s.y=ae(s.y),s},getValidScaleOf(t,e,i,s,o,r){let a,n;return r||(o=Object.assign({},o)),ne.set(t).scaleOf(s,o.x,o.y).unsign(),he.set(ne).add(e),_e.set(ne).intersect(e),a=le.isInnerMode(t,e,i,"width")?he.width/ne.width:_e.width/ne.width,n=le.isInnerMode(t,e,i,"height")?he.height/ne.height:_e.height/ne.height,o.x=ae(_e.width)?o.x*a:1,o.y=ae(_e.height)?o.y*n:1,o}},le=de,{stintSet:pe}=n,ue={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);pe(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),pe(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;pe(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!Wt.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(p(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),pe(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){ce(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:r,__drawAfterFill:a,__fillAfterStroke:n,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Ct.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:_,innerShadow:d,filter:l}=s;_&&Wt.shadow(this,t,h),n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t)),o&&(s.__isFills?Ct.fills(o,this,t):Ct.fill(o,this,t)),a&&this.__drawAfterFill(t,e),d&&Wt.innerShadow(this,t,h),r&&!n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t)),l&&It.apply(l,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,Bt.string(e.color))}o&&(s.__isFills?Ct.fills(o,this,t):Ct.fill(o,this,t)),h&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t))}}else s.__pathInputed?ce(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Ct.fills(s,this,t):Ct.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Ct.strokes(o,this,t):Ct.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function ce(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Ct.stroke(o,t,e),s&&Ct.fill(s,t,e),r&&t.__drawAfterFill(e,i),o&&!a&&Ct.stroke(o,t,e)}const ge={__drawFast(t,e){let{x:i,y:s,width:o,height:r}=this.__layout.boxBounds;const{fill:a,stroke:n,__drawAfterFill:h}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,o,r)),h&&this.__drawAfterFill(t,e),n){const{strokeAlign:a,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(n,h,this.__);const _=h/2;switch(a){case"center":t.strokeRect(0,0,o,r);break;case"inside":o-=h,r-=h,o<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+_,s+_,o,r),t.restore()):t.strokeRect(i+_,s+_,o,r);break;case"outside":t.strokeRect(i-_,s-_,o+h,r+h)}}}};var ye;let ve=ye=class extends N{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){g.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 Y.set(this.path=t||[]),t||this.__drawPathByBox(Y),Y}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return d(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return o.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return o.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Y.set(i=[]),this.__drawPathByBox(Y)),t?a.toCanvasData(i,!0):i}getPathString(t,e,i){return a.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Tt.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?U.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&At.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?j.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,o,X(r)?[r]:r)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){Ct.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return this.set(t),o.need("animate")}killAnimate(t,e){}export(t,e){return o.need("export")}syncExport(t,e){return o.need("export")}clone(t){const e=n.clone(this.toJSON());return t&&Object.assign(e,t),ye.one(e)}static one(t,e,i,s,o){return c.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){J()(this)}static registerData(t){v(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};wt([v(Ht)],ve.prototype,"__",void 0),wt([mt()],ve.prototype,"zoomLayer",void 0),wt([f("")],ve.prototype,"id",void 0),wt([f("")],ve.prototype,"name",void 0),wt([f("")],ve.prototype,"className",void 0),wt([w("pass-through")],ve.prototype,"blendMode",void 0),wt([x(1)],ve.prototype,"opacity",void 0),wt([S(!0)],ve.prototype,"visible",void 0),wt([w(!1)],ve.prototype,"locked",void 0),wt([m(!1)],ve.prototype,"dim",void 0),wt([m(!1)],ve.prototype,"dimskip",void 0),wt([R(0)],ve.prototype,"zIndex",void 0),wt([k(!1)],ve.prototype,"mask",void 0),wt([B(!1)],ve.prototype,"eraser",void 0),wt([b(0,!0)],ve.prototype,"x",void 0),wt([b(0,!0)],ve.prototype,"y",void 0),wt([A(100,!0)],ve.prototype,"width",void 0),wt([A(100,!0)],ve.prototype,"height",void 0),wt([C(1,!0)],ve.prototype,"scaleX",void 0),wt([C(1,!0)],ve.prototype,"scaleY",void 0),wt([P(0,!0)],ve.prototype,"rotation",void 0),wt([P(0,!0)],ve.prototype,"skewX",void 0),wt([P(0,!0)],ve.prototype,"skewY",void 0),wt([b(0,!0)],ve.prototype,"offsetX",void 0),wt([b(0,!0)],ve.prototype,"offsetY",void 0),wt([F(0,!0)],ve.prototype,"scrollX",void 0),wt([F(0,!0)],ve.prototype,"scrollY",void 0),wt([W()],ve.prototype,"origin",void 0),wt([W()],ve.prototype,"around",void 0),wt([f(!1)],ve.prototype,"lazy",void 0),wt([I(1)],ve.prototype,"pixelRatio",void 0),wt([T(0)],ve.prototype,"renderSpread",void 0),wt([D()],ve.prototype,"path",void 0),wt([E()],ve.prototype,"windingRule",void 0),wt([E(!0)],ve.prototype,"closed",void 0),wt([A(0)],ve.prototype,"padding",void 0),wt([A(!1)],ve.prototype,"lockRatio",void 0),wt([A()],ve.prototype,"widthRange",void 0),wt([A()],ve.prototype,"heightRange",void 0),wt([f(!1)],ve.prototype,"draggable",void 0),wt([f()],ve.prototype,"dragBounds",void 0),wt([f("auto")],ve.prototype,"dragBoundsType",void 0),wt([f(!1)],ve.prototype,"editable",void 0),wt([L(!0)],ve.prototype,"hittable",void 0),wt([L("path")],ve.prototype,"hitFill",void 0),wt([M("path")],ve.prototype,"hitStroke",void 0),wt([L(!1)],ve.prototype,"hitBox",void 0),wt([L(!0)],ve.prototype,"hitChildren",void 0),wt([L(!0)],ve.prototype,"hitSelf",void 0),wt([L()],ve.prototype,"hitRadius",void 0),wt([z("")],ve.prototype,"cursor",void 0),wt([w()],ve.prototype,"fill",void 0),wt([M(void 0,!0)],ve.prototype,"stroke",void 0),wt([M("inside")],ve.prototype,"strokeAlign",void 0),wt([M(1,!0)],ve.prototype,"strokeWidth",void 0),wt([M(!1)],ve.prototype,"strokeWidthFixed",void 0),wt([M("none")],ve.prototype,"strokeCap",void 0),wt([M("miter")],ve.prototype,"strokeJoin",void 0),wt([M()],ve.prototype,"dashPattern",void 0),wt([M(0)],ve.prototype,"dashOffset",void 0),wt([M(10)],ve.prototype,"miterLimit",void 0),wt([E(0)],ve.prototype,"cornerRadius",void 0),wt([E()],ve.prototype,"cornerSmoothing",void 0),wt([xt()],ve.prototype,"shadow",void 0),wt([xt()],ve.prototype,"innerShadow",void 0),wt([xt()],ve.prototype,"blur",void 0),wt([xt()],ve.prototype,"backgroundBlur",void 0),wt([xt()],ve.prototype,"grayscale",void 0),wt([xt()],ve.prototype,"filter",void 0),wt([w()],ve.prototype,"placeholderColor",void 0),wt([f(100)],ve.prototype,"placeholderDelay",void 0),wt([f({})],ve.prototype,"data",void 0),wt([O(N.prototype.reset)],ve.prototype,"reset",null),ve=ye=wt([V(re),V(ue),H()],ve);let fe=class extends ve{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var we;wt([v(Ut)],fe.prototype,"__",void 0),wt([A(0)],fe.prototype,"width",void 0),wt([A(0)],fe.prototype,"height",void 0),fe=wt([V(q),J()],fe);const xe=h.get("Leafer");let Se=we=class extends fe{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&$.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||K()}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),we.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,n.assign(s,t));const o=this.canvas=Q.canvas(s);this.__controllers.push(this.renderer=Q.renderer(this,o,s),this.watcher=Q.watcher(this,s),this.layouter=Q.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=o.view,e||(this.selector=Q.selector(this),this.interaction=Q.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Q.hitCanvasManager()),this.canvasManager=new Z,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),tt.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(et.RESTART):this.emitLeafer(et.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(et.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=n.copyAttrs({},t,u);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new y(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=n.copyAttrs({},this.canvas,u);e.resize(t),this.updateLazyBounds(),this.__onResize(new it(t,i))}__onResize(t){this.emitEvent(t),n.copyAttrs(this.__,t,u),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 st(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(u.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(et.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&u.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=n.copyAttrs({},s,u);o[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(o)}__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(et.BEFORE_READY),this.emitLeafer(et.READY),this.emitLeafer(et.AFTER_READY),tt.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(et.VIEW_READY),tt.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:r}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(o=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:o,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){tt.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(et.VIEW_COMPLETED),tt.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return o.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 et(t,this))}__listenEvents(){const t=ot.start("FirstCreate "+this.innerName);this.once([[et.START,()=>ot.end(t)],[rt.START,this.updateLazyBounds,this],[at.START,this.__onCreated,this],[at.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[nt.DATA,this.__onWatchData,this],[rt.END,this.__onLayoutEnd,this],[at.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){we.list.remove(this);try{this.stop(),this.emitLeafer(et.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{ht.clearRecycled()},100)}catch(t){xe.error(t)}}};t?e():setTimeout(e)}};Se.list=new G,wt([v(Xt)],Se.prototype,"__",void 0),wt([A()],Se.prototype,"pixelRatio",void 0),wt([f("normal")],Se.prototype,"mode",void 0),Se=we=wt([J()],Se);let me=class extends ve{get __tag(){return"Rect"}};wt([v(Gt)],me.prototype,"__",void 0),me=wt([V(ge),H(),J()],me);const{add:Re,includes:ke,scroll:Be}=_t,be=me.prototype,Ae=fe.prototype;let Ce=class extends fe{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:o,boxBounds:r}=s,{overflow:a}=i,n=s.childrenRenderBounds||(s.childrenRenderBounds=K());super.__updateRenderBounds(n),(e=a.includes("scroll"))&&(Re(n,r),Be(n,i)),this.__updateRectRenderBounds(),t=!ke(r,n),t&&"show"===a&&Re(o,n)}else this.__updateRectRenderBounds();n.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))}};wt([v(jt)],Ce.prototype,"__",void 0),wt([A(100)],Ce.prototype,"width",void 0),wt([A(100)],Ce.prototype,"height",void 0),wt([f(!1)],Ce.prototype,"resizeChildren",void 0),wt([T("show")],Ce.prototype,"overflow",void 0),wt([O(be.__updateStrokeSpread)],Ce.prototype,"__updateStrokeSpread",null),wt([O(be.__updateRenderSpread)],Ce.prototype,"__updateRectRenderSpread",null),wt([O(be.__updateBoxBounds)],Ce.prototype,"__updateRectBoxBounds",null),wt([O(be.__updateStrokeBounds)],Ce.prototype,"__updateStrokeBounds",null),wt([O(be.__updateRenderBounds)],Ce.prototype,"__updateRectRenderBounds",null),wt([O(be.__updateChange)],Ce.prototype,"__updateRectChange",null),wt([O(be.__render)],Ce.prototype,"__renderRect",null),wt([O(Ae.__render)],Ce.prototype,"__renderGroup",null),Ce=wt([H(),J()],Ce);let Pe=class extends Ce{get __tag(){return"Frame"}get isFrame(){return!0}};wt([v(Jt)],Pe.prototype,"__",void 0),wt([w("#FFFFFF")],Pe.prototype,"fill",void 0),wt([T("hide")],Pe.prototype,"overflow",void 0),Pe=wt([J()],Pe);const{moveTo:Fe,closePath:We,ellipse:Ie}=dt;let Te=class extends ve{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:o}=this.__,r=t/2,a=e/2,n=this.__.path=[];i?(s||o?(i<1&&Ie(n,r,a,r*i,a*i,0,s,o,!1),Ie(n,r,a,r,a,0,o,s,!0),i<1&&We(n)):(i<1&&(Ie(n,r,a,r*i,a*i),Fe(n,t,a)),Ie(n,r,a,r,a,0,360,0,!0)),lt.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(Fe(n,r,a),Ie(n,r,a,r,a,0,s,o,!1),We(n)):Ie(n,r,a,r,a)}};wt([v($t)],Te.prototype,"__",void 0),wt([E(0)],Te.prototype,"innerRadius",void 0),wt([E(0)],Te.prototype,"startAngle",void 0),wt([E(0)],Te.prototype,"endAngle",void 0),Te=wt([J()],Te);const{sin:De,cos:Ee,PI:Le}=Math,{moveTo:Me,lineTo:ze,closePath:Oe,drawPoints:Ne}=dt;let Ve=class extends ve{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Ne(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:o}=t,r=i/2,a=s/2;Me(e,r,0);for(let t=1;t<o;t++)ze(e,r+r*De(2*t*Le/o),a-a*Ee(2*t*Le/o));Oe(e)}}};wt([v(Kt)],Ve.prototype,"__",void 0),wt([E(3)],Ve.prototype,"sides",void 0),wt([E()],Ve.prototype,"points",void 0),wt([E(0)],Ve.prototype,"curve",void 0),Ve=wt([H(),J()],Ve);const{sin:He,cos:Ye,PI:Ue}=Math,{moveTo:je,lineTo:Xe,closePath:Je}=dt;let qe=class extends ve{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,r=e/2,a=this.__.path=[];je(a,o,0);for(let t=1;t<2*i;t++)Xe(a,o+(t%2==0?o:o*s)*He(t*Ue/i),r-(t%2==0?r:r*s)*Ye(t*Ue/i));Je(a)}};wt([v(Qt)],qe.prototype,"__",void 0),wt([E(5)],qe.prototype,"corners",void 0),wt([E(.382)],qe.prototype,"innerRadius",void 0),qe=wt([J()],qe);const{moveTo:Ge,lineTo:$e,drawPoints:Ke}=dt,{rotate:Qe,getAngle:Ze,getDistance:ti,defaultPoint:ei}=pt;let ii=class extends ve{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=ct();return t&&(i.x=t),e&&Qe(i,e),i}set toPoint(t){this.width=ti(ei,t),this.rotation=Ze(ei,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Ke(e,t.points,t.curve,t.closed):(Ge(e,0,0),$e(e,this.width,0))}};wt([v(qt)],ii.prototype,"__",void 0),wt([ut("center")],ii.prototype,"strokeAlign",void 0),wt([A(0)],ii.prototype,"height",void 0),wt([E()],ii.prototype,"points",void 0),wt([E(0)],ii.prototype,"curve",void 0),wt([E(!1)],ii.prototype,"closed",void 0),ii=wt([J()],ii);let si=class extends me{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return p(t)&&t[0].image}};wt([v(se)],si.prototype,"__",void 0),wt([A("")],si.prototype,"url",void 0),si=wt([J()],si);const oi=si;let ri=class extends me{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Q.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new gt({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new yt(yt.LOADED,{image:t}))})}draw(t,e,i,s){const o=new vt(t.worldTransform).invert(),r=new vt;e&&r.translate(e.x,e.y),i&&(X(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),o.multiplyParent(r),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};wt([v(oe)],ri.prototype,"__",void 0),wt([St(100)],ri.prototype,"width",void 0),wt([St(100)],ri.prototype,"height",void 0),wt([St(1)],ri.prototype,"pixelRatio",void 0),wt([St(!0)],ri.prototype,"smooth",void 0),wt([f(!1)],ri.prototype,"safeResize",void 0),wt([St()],ri.prototype,"contextSettings",void 0),ri=wt([J()],ri);const{copyAndSpread:ai,includes:ni,spread:hi,setList:_i}=_t;let di=class extends ve{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:r,italic:a,textCase:n,textOverflow:h,padding:_}=t;t.__lineHeight=bt.number(e,o),t.__letterSpacing=bt.number(i,o),t.__padding=_?g.fourNumber(_):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${a?"italic ":""}${"small-caps"===n?"small-caps ":""}${"normal"!==r?r+" ":""}${o||12}px ${s||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=kt.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:r,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:h}=t.__textDrawData,_=e.boxBounds;if(e.contentBounds=h,t.__lineHeight<i&&hi(h,i/2),r||a){if(_.x=r?h.x:0,_.y=a?h.y:0,_.width=r?h.width:t.width,_.height=a?h.height:t.height,o){const[e,i,s,o]=t.__padding;r&&(_.x-=o,_.width+=i+o),a&&(_.y-=e,_.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(_.width+=.16*i),n.stintSet(this,"isOverflow",!ni(_,h)),this.isOverflow?(_i(t.__textBoxBounds={},[_,h]),e.renderChanged=!0):t.__textBoxBounds=_}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;ai(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()}};wt([v(ie)],di.prototype,"__",void 0),wt([A(0)],di.prototype,"width",void 0),wt([A(0)],di.prototype,"height",void 0),wt([w()],di.prototype,"boxStyle",void 0),wt([f(!1)],di.prototype,"resizeFontSize",void 0),wt([w("#000000")],di.prototype,"fill",void 0),wt([ut("outside")],di.prototype,"strokeAlign",void 0),wt([L("all")],di.prototype,"hitFill",void 0),wt([A("")],di.prototype,"text",void 0),wt([A("")],di.prototype,"placeholder",void 0),wt([A("caption")],di.prototype,"fontFamily",void 0),wt([A(12)],di.prototype,"fontSize",void 0),wt([A("normal")],di.prototype,"fontWeight",void 0),wt([A(!1)],di.prototype,"italic",void 0),wt([A("none")],di.prototype,"textCase",void 0),wt([A("none")],di.prototype,"textDecoration",void 0),wt([A(0)],di.prototype,"letterSpacing",void 0),wt([A({type:"percent",value:1.5})],di.prototype,"lineHeight",void 0),wt([A(0)],di.prototype,"paraIndent",void 0),wt([A(0)],di.prototype,"paraSpacing",void 0),wt([A("x")],di.prototype,"writingMode",void 0),wt([A("left")],di.prototype,"textAlign",void 0),wt([A("top")],di.prototype,"verticalAlign",void 0),wt([A(!0)],di.prototype,"autoSizeAlign",void 0),wt([A("normal")],di.prototype,"textWrap",void 0),wt([A("show")],di.prototype,"textOverflow",void 0),wt([w(!1)],di.prototype,"textEditing",void 0),di=wt([J()],di);let li=class extends ve{get __tag(){return"Path"}};wt([v(Zt)],li.prototype,"__",void 0),wt([ut("center")],li.prototype,"strokeAlign",void 0),li=wt([J()],li);let pi=class extends fe{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new li(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,r,a,n){return this}arc(t,e,i,s,o,r){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,r,a,n){return this}drawArc(t,e,i,s,o,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};wt([v(te)],pi.prototype,"__",void 0),wt([(e,i)=>{t(e,i,{get(){return this.__path}})}],pi.prototype,"path",void 0),pi=wt([V(ft,["set","path","paint"]),J()],pi);export{Ce as Box,jt as BoxData,ri as Canvas,oe as CanvasData,Bt as ColorConvert,de as DragBoundsHelper,Wt as Effect,Te as Ellipse,$t as EllipseData,Tt as Export,It as Filter,Pe as Frame,Jt as FrameData,fe as Group,Ut as GroupData,si as Image,se as ImageData,Se as Leafer,Xt as LeaferData,ii as Line,qt as LineData,oi as MyImage,Ct as Paint,Ft as PaintGradient,Pt as PaintImage,li as Path,At as PathArrow,Zt as PathData,pi as Pen,te as PenData,Ve as Polygon,Kt as PolygonData,me as Rect,Gt as RectData,ge as RectRender,qe as Star,Qt as StarData,Dt as State,di as Text,kt as TextConvert,ie as TextData,Et as Transition,ve as UI,re as UIBounds,Ht as UIData,ue as UIRender,bt as UnitConvert,Rt as createAttr,xt as effectType,St as resizeType,mt as zoomLayerType};
import{defineKey as t,decorateLeafAttr as e,attr as i,createDescriptor as s,Plugin as o,isObject as r,PathConvert as a,DataHelper as n,Debug as h,LeafData as _,isString as d,isUndefined as l,isArray as p,canvasSizeAttrs as u,UICreator as c,FourNumberHelper as g,MathHelper as y,Bounds as v,dataProcessor as f,dataType as w,surfaceType as x,opacityType as S,visibleType as m,dimType as R,sortType as k,maskType as B,eraserType as b,positionType as A,boundsType as C,scaleType as P,rotationType as F,scrollType as W,autoLayoutType as I,naturalBoundsType as T,affectRenderBoundsType as D,pathInputType as E,pathType as L,hitType as z,strokeType as M,cursorType as O,rewrite as N,Leaf as V,useModule as H,rewriteAble as Y,pen as U,PathCorner as j,PathDrawer as X,isNumber as J,registerUI as q,Branch as G,LeafList as $,Resource as K,getBoundsData as Q,Creator as Z,CanvasManager as tt,WaitHelper as et,LeaferEvent as it,ResizeEvent as st,AutoBounds as ot,Run as rt,LayoutEvent as at,RenderEvent as nt,WatchEvent as ht,ImageManager as _t,BoundsHelper as dt,PathCommandDataHelper as lt,Platform as pt,PointHelper as ut,affectStrokeBoundsType as ct,getPointData as gt,LeaferImage as yt,ImageEvent as vt,Matrix as ft,PathCreator as wt}from"@leafer/core";export*from"@leafer/core";function xt(t,e,i,s){var o,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(r<3?o(a):r>3?o(e,i,a):o(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a}function St(t){return e(t,t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function mt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Rt(){return(e,i)=>{const s="_"+i;t(e,i,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}function kt(e){return(i,o)=>{t(i,o,s(o,e))}}"function"==typeof SuppressedError&&SuppressedError;const Bt={},bt={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}},At={number:(t,e)=>r(t)?"percent"===t.type?t.value*e:t.value:t},Ct={},Pt={},Ft={},Wt={},It={},Tt={apply(){o.need("filter")}},Dt={},Et={setStyleName:()=>o.need("state"),set:()=>o.need("state")},Lt={list:{},register(t,e){Lt.list[t]=e},get:t=>Lt.list[t]},{parse:zt,objectToCanvasData:Mt}=a,{stintSet:Ot}=n,{hasTransparent:Nt}=bt,Vt={},Ht=h.get("UIData");class Yt extends _{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Ht.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Ht.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),d(t)||!t?(Ot(this,"__isTransparentFill",Nt(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):r(t)&&this.__setPaint("fill",t)}setStroke(t){d(t)||!t?(Ot(this,"__isTransparentStroke",Nt(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):r(t)&&this.__setPaint("stroke",t)}setPath(t){const e=d(t);e||t&&r(t[0])?(this.__setInput("path",t),this._path=e?zt(t):Mt(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Ut(this,"shadow",t)}setInnerShadow(t){Ut(this,"innerShadow",t)}setFilter(t){Ut(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Pt.compute("fill",this.__leaf),e&&Pt.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),l(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),p(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Vt)):(this.__isStrokes=!0,this._stroke||(this._stroke=Vt))}__removePaint(t,e){e&&this.__removeInput(t),Ft.recycleImage(t,this),"fill"===t?(Ot(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Ot(this,"__isAlphaPixelStroke",void 0),Ot(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Ut(t,e,i){t.__setInput(e,i),p(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class jt extends Yt{}class Xt extends jt{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Jt extends jt{__getInputData(t,e){const i=super.__getInputData(t,e);return u.forEach(t=>delete i[t]),i}}class qt extends Xt{}class Gt extends Yt{get __usePathBox(){return this.points||this.__pathInputed}}class $t extends Yt{get __boxStroke(){return!this.__pathInputed}}class Kt extends Yt{get __boxStroke(){return!this.__pathInputed}}class Qt extends Gt{}class Zt extends Yt{}class te extends Yt{get __pathInputed(){return 2}}class ee extends jt{}const ie={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class se extends Yt{get __useNaturalRatio(){return!1}setFontWeight(t){d(t)?(this.__setInput("fontWeight",t),t=ie[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=c.get("Rect",0);const o=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=o.boxBounds),i.set(t),r.strokeChanged&&o.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class oe extends $t{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class re extends $t{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:ae,add:ne}=g,he={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),r&&(t=ae(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:r,renderSpread:a}=this.__,{strokeSpread:n}=this.__layout,h=this.__box;e&&(t=It.getShadowRenderSpread(this,e)),s&&(t=ae(t,s)),r&&(t=ne(t,Tt.getSpread(r))),a&&(t=ne(t,a)),n&&(t=ne(t,n));let _=t;return i&&(_=ae(_,It.getInnerShadowSpread(this,i))),o&&(_=ae(_,o)),this.__layout.renderShapeSpread=_,h?ae(h.__updateRenderSpread(),t):t}},{float:_e}=y,de=new v,le=new v,pe=new v,ue={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&ce.getValidMove(t.__localBoxBounds,ce.getDragBounds(t),s,e,!0),ce.axisMove(t,e)},limitScaleOf(t,e,i){const{dragBounds:s,dragBoundsType:o}=t;s&&ce.getValidScaleOf(t.__localBoxBounds,ce.getDragBounds(t),o,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,o){const r=t.x+s.x,a=t.y+s.y,n=r+t.width,h=a+t.height,_=e.x+e.width,d=e.y+e.height;return o||(s=Object.assign({},s)),ce.isInnerMode(t,e,i,"width")?r>e.x?s.x+=e.x-r:n<_&&(s.x+=_-n):r<e.x?s.x+=e.x-r:n>_&&(s.x+=_-n),ce.isInnerMode(t,e,i,"height")?a>e.y?s.y+=e.y-a:h<d&&(s.y+=d-h):a<e.y?s.y+=e.y-a:h>d&&(s.y+=d-h),s.x=_e(s.x),s.y=_e(s.y),s},getValidScaleOf(t,e,i,s,o,r){let a,n;return r||(o=Object.assign({},o)),de.set(t).scaleOf(s,o.x,o.y).unsign(),le.set(de).add(e),pe.set(de).intersect(e),a=ce.isInnerMode(t,e,i,"width")?le.width/de.width:pe.width/de.width,n=ce.isInnerMode(t,e,i,"height")?le.height/de.height:pe.height/de.height,o.x=_e(pe.width)?o.x*a:1,o.y=_e(pe.height)?o.y*n:1,o}},ce=ue,{stintSet:ge}=n,ye={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);ge(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),ge(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;ge(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!It.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(p(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),ge(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){ve(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:r,__drawAfterFill:a,__fillAfterStroke:n,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Pt.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:_,innerShadow:d,filter:l}=s;_&&It.shadow(this,t,h),n&&(s.__isStrokes?Pt.strokes(r,this,t):Pt.stroke(r,this,t)),o&&(s.__isFills?Pt.fills(o,this,t):Pt.fill(o,this,t)),a&&this.__drawAfterFill(t,e),d&&It.innerShadow(this,t,h),r&&!n&&(s.__isStrokes?Pt.strokes(r,this,t):Pt.stroke(r,this,t)),l&&Tt.apply(l,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(n&&(s.__isStrokes?Pt.strokes(r,this,t):Pt.stroke(r,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,bt.string(e.color))}o&&(s.__isFills?Pt.fills(o,this,t):Pt.fill(o,this,t)),h&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?Pt.strokes(r,this,t):Pt.stroke(r,this,t))}}else s.__pathInputed?ve(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Pt.fills(s,this,t):Pt.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Pt.strokes(o,this,t):Pt.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function ve(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Pt.stroke(o,t,e),s&&Pt.fill(s,t,e),r&&t.__drawAfterFill(e,i),o&&!a&&Pt.stroke(o,t,e)}const fe={__drawFast(t,e){let{x:i,y:s,width:o,height:r}=this.__layout.boxBounds;const{fill:a,stroke:n,__drawAfterFill:h}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,o,r)),h&&this.__drawAfterFill(t,e),n){const{strokeAlign:a,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(n,h,this.__);const _=h/2;switch(a){case"center":t.strokeRect(0,0,o,r);break;case"inside":o-=h,r-=h,o<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+_,s+_,o,r),t.restore()):t.strokeRect(i+_,s+_,o,r);break;case"outside":t.strokeRect(i-_,s-_,o+h,r+h)}}}};var we;let xe=we=class extends V{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){y.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 U.set(this.path=t||[]),t||this.__drawPathByBox(U),U}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return d(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return o.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return o.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(U.set(i=[]),this.__drawPathByBox(U)),t?a.toCanvasData(i,!0):i}getPathString(t,e,i){return a.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Dt.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?j.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Ct.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?X.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,o,J(r)?[r]:r)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){Pt.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return this.set(t),o.need("animate")}killAnimate(t,e){}export(t,e){return o.need("export")}syncExport(t,e){return o.need("export")}clone(t){const e=n.clone(this.toJSON());return t&&Object.assign(e,t),we.one(e)}static one(t,e,i,s,o){return c.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){q()(this)}static registerData(t){f(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};xt([f(Yt)],xe.prototype,"__",void 0),xt([Rt()],xe.prototype,"zoomLayer",void 0),xt([w("")],xe.prototype,"id",void 0),xt([w("")],xe.prototype,"name",void 0),xt([w("")],xe.prototype,"className",void 0),xt([x("pass-through")],xe.prototype,"blendMode",void 0),xt([S(1)],xe.prototype,"opacity",void 0),xt([m(!0)],xe.prototype,"visible",void 0),xt([x(!1)],xe.prototype,"locked",void 0),xt([R(!1)],xe.prototype,"dim",void 0),xt([R(!1)],xe.prototype,"dimskip",void 0),xt([k(0)],xe.prototype,"zIndex",void 0),xt([B(!1)],xe.prototype,"mask",void 0),xt([b(!1)],xe.prototype,"eraser",void 0),xt([A(0,!0)],xe.prototype,"x",void 0),xt([A(0,!0)],xe.prototype,"y",void 0),xt([C(100,!0)],xe.prototype,"width",void 0),xt([C(100,!0)],xe.prototype,"height",void 0),xt([P(1,!0)],xe.prototype,"scaleX",void 0),xt([P(1,!0)],xe.prototype,"scaleY",void 0),xt([F(0,!0)],xe.prototype,"rotation",void 0),xt([F(0,!0)],xe.prototype,"skewX",void 0),xt([F(0,!0)],xe.prototype,"skewY",void 0),xt([A(0,!0)],xe.prototype,"offsetX",void 0),xt([A(0,!0)],xe.prototype,"offsetY",void 0),xt([W(0,!0)],xe.prototype,"scrollX",void 0),xt([W(0,!0)],xe.prototype,"scrollY",void 0),xt([I()],xe.prototype,"origin",void 0),xt([I()],xe.prototype,"around",void 0),xt([w(!1)],xe.prototype,"lazy",void 0),xt([T(1)],xe.prototype,"pixelRatio",void 0),xt([D(0)],xe.prototype,"renderSpread",void 0),xt([E()],xe.prototype,"path",void 0),xt([L()],xe.prototype,"windingRule",void 0),xt([L(!0)],xe.prototype,"closed",void 0),xt([C(0)],xe.prototype,"padding",void 0),xt([C(!1)],xe.prototype,"lockRatio",void 0),xt([C()],xe.prototype,"widthRange",void 0),xt([C()],xe.prototype,"heightRange",void 0),xt([w(!1)],xe.prototype,"draggable",void 0),xt([w()],xe.prototype,"dragBounds",void 0),xt([w("auto")],xe.prototype,"dragBoundsType",void 0),xt([w(!1)],xe.prototype,"editable",void 0),xt([z(!0)],xe.prototype,"hittable",void 0),xt([z("path")],xe.prototype,"hitFill",void 0),xt([M("path")],xe.prototype,"hitStroke",void 0),xt([z(!1)],xe.prototype,"hitBox",void 0),xt([z(!0)],xe.prototype,"hitChildren",void 0),xt([z(!0)],xe.prototype,"hitSelf",void 0),xt([z()],xe.prototype,"hitRadius",void 0),xt([O("")],xe.prototype,"cursor",void 0),xt([x()],xe.prototype,"fill",void 0),xt([M(void 0,!0)],xe.prototype,"stroke",void 0),xt([M("inside")],xe.prototype,"strokeAlign",void 0),xt([M(1,!0)],xe.prototype,"strokeWidth",void 0),xt([M(!1)],xe.prototype,"strokeWidthFixed",void 0),xt([M("none")],xe.prototype,"strokeCap",void 0),xt([M("miter")],xe.prototype,"strokeJoin",void 0),xt([M()],xe.prototype,"dashPattern",void 0),xt([M(0)],xe.prototype,"dashOffset",void 0),xt([M(10)],xe.prototype,"miterLimit",void 0),xt([L(0)],xe.prototype,"cornerRadius",void 0),xt([L()],xe.prototype,"cornerSmoothing",void 0),xt([St()],xe.prototype,"shadow",void 0),xt([St()],xe.prototype,"innerShadow",void 0),xt([St()],xe.prototype,"blur",void 0),xt([St()],xe.prototype,"backgroundBlur",void 0),xt([St()],xe.prototype,"grayscale",void 0),xt([St()],xe.prototype,"filter",void 0),xt([x()],xe.prototype,"placeholderColor",void 0),xt([w(100)],xe.prototype,"placeholderDelay",void 0),xt([w({})],xe.prototype,"data",void 0),xt([N(V.prototype.reset)],xe.prototype,"reset",null),xe=we=xt([H(he),H(ye),Y()],xe);let Se=class extends xe{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var me;xt([f(jt)],Se.prototype,"__",void 0),xt([C(0)],Se.prototype,"width",void 0),xt([C(0)],Se.prototype,"height",void 0),Se=xt([H(G),q()],Se);const Re=h.get("Leafer");let ke=me=class extends Se{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&K.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||Q()}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),me.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,n.assign(s,t));const o=this.canvas=Z.canvas(s);this.__controllers.push(this.renderer=Z.renderer(this,o,s),this.watcher=Z.watcher(this,s),this.layouter=Z.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=o.view,e||(this.selector=Z.selector(this),this.interaction=Z.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Z.hitCanvasManager()),this.canvasManager=new tt,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),et.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(it.RESTART):this.emitLeafer(it.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(it.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=n.copyAttrs({},t,u);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new v(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=n.copyAttrs({},this.canvas,u);e.resize(t),this.updateLazyBounds(),this.__onResize(new st(t,i))}__onResize(t){this.emitEvent(t),n.copyAttrs(this.__,t,u),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 ot(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(u.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(it.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&u.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=n.copyAttrs({},s,u);o[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(o)}__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(it.BEFORE_READY),this.emitLeafer(it.READY),this.emitLeafer(it.AFTER_READY),et.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(it.VIEW_READY),et.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:r}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(o=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:o,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){et.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(it.VIEW_COMPLETED),et.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return o.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 it(t,this))}__listenEvents(){const t=rt.start("FirstCreate "+this.innerName);this.once([[it.START,()=>rt.end(t)],[at.START,this.updateLazyBounds,this],[nt.START,this.__onCreated,this],[nt.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[ht.DATA,this.__onWatchData,this],[at.END,this.__onLayoutEnd,this],[nt.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){me.list.remove(this);try{this.stop(),this.emitLeafer(it.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{_t.clearRecycled()},100)}catch(t){Re.error(t)}}};t?e():setTimeout(e)}};ke.list=new $,xt([f(Jt)],ke.prototype,"__",void 0),xt([C()],ke.prototype,"pixelRatio",void 0),xt([w("normal")],ke.prototype,"mode",void 0),ke=me=xt([q()],ke);let Be=class extends xe{get __tag(){return"Rect"}};xt([f($t)],Be.prototype,"__",void 0),Be=xt([H(fe),Y(),q()],Be);const{add:be,includes:Ae,scroll:Ce}=dt,Pe=Be.prototype,Fe=Se.prototype;let We=class extends Se{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:o,boxBounds:r}=s,{overflow:a}=i,n=s.childrenRenderBounds||(s.childrenRenderBounds=Q());super.__updateRenderBounds(n),(e=a.includes("scroll"))&&(be(n,r),Ce(n,i)),this.__updateRectRenderBounds(),t=!Ae(r,n),t&&"show"===a&&be(o,n)}else this.__updateRectRenderBounds();n.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))}};xt([f(Xt)],We.prototype,"__",void 0),xt([C(100)],We.prototype,"width",void 0),xt([C(100)],We.prototype,"height",void 0),xt([w(!1)],We.prototype,"resizeChildren",void 0),xt([D("show")],We.prototype,"overflow",void 0),xt([N(Pe.__updateStrokeSpread)],We.prototype,"__updateStrokeSpread",null),xt([N(Pe.__updateRenderSpread)],We.prototype,"__updateRectRenderSpread",null),xt([N(Pe.__updateBoxBounds)],We.prototype,"__updateRectBoxBounds",null),xt([N(Pe.__updateStrokeBounds)],We.prototype,"__updateStrokeBounds",null),xt([N(Pe.__updateRenderBounds)],We.prototype,"__updateRectRenderBounds",null),xt([N(Pe.__updateChange)],We.prototype,"__updateRectChange",null),xt([N(Pe.__render)],We.prototype,"__renderRect",null),xt([N(Fe.__render)],We.prototype,"__renderGroup",null),We=xt([Y(),q()],We);let Ie=class extends We{get __tag(){return"Frame"}get isFrame(){return!0}};xt([f(qt)],Ie.prototype,"__",void 0),xt([x("#FFFFFF")],Ie.prototype,"fill",void 0),xt([D("hide")],Ie.prototype,"overflow",void 0),Ie=xt([q()],Ie);const{moveTo:Te,closePath:De,ellipse:Ee}=lt;let Le=class extends xe{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:o}=this.__,r=t/2,a=e/2,n=this.__.path=[];i?(s||o?(i<1&&Ee(n,r,a,r*i,a*i,0,s,o,!1),Ee(n,r,a,r,a,0,o,s,!0),i<1&&De(n)):(i<1&&(Ee(n,r,a,r*i,a*i),Te(n,t,a)),Ee(n,r,a,r,a,0,360,0,!0)),pt.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(Te(n,r,a),Ee(n,r,a,r,a,0,s,o,!1),De(n)):Ee(n,r,a,r,a)}};xt([f(Kt)],Le.prototype,"__",void 0),xt([L(0)],Le.prototype,"innerRadius",void 0),xt([L(0)],Le.prototype,"startAngle",void 0),xt([L(0)],Le.prototype,"endAngle",void 0),Le=xt([q()],Le);const{sin:ze,cos:Me,PI:Oe}=Math,{moveTo:Ne,lineTo:Ve,closePath:He,drawPoints:Ye}=lt;let Ue=class extends xe{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Ye(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:o}=t,r=i/2,a=s/2;Ne(e,r,0);for(let t=1;t<o;t++)Ve(e,r+r*ze(2*t*Oe/o),a-a*Me(2*t*Oe/o));He(e)}}};xt([f(Qt)],Ue.prototype,"__",void 0),xt([L(3)],Ue.prototype,"sides",void 0),xt([L()],Ue.prototype,"points",void 0),xt([L(0)],Ue.prototype,"curve",void 0),Ue=xt([Y(),q()],Ue);const{sin:je,cos:Xe,PI:Je}=Math,{moveTo:qe,lineTo:Ge,closePath:$e}=lt;let Ke=class extends xe{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,r=e/2,a=this.__.path=[];qe(a,o,0);for(let t=1;t<2*i;t++)Ge(a,o+(t%2==0?o:o*s)*je(t*Je/i),r-(t%2==0?r:r*s)*Xe(t*Je/i));$e(a)}};xt([f(Zt)],Ke.prototype,"__",void 0),xt([L(5)],Ke.prototype,"corners",void 0),xt([L(.382)],Ke.prototype,"innerRadius",void 0),Ke=xt([q()],Ke);const{moveTo:Qe,lineTo:Ze,drawPoints:ti}=lt,{rotate:ei,getAngle:ii,getDistance:si,defaultPoint:oi}=ut;let ri=class extends xe{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=gt();return t&&(i.x=t),e&&ei(i,e),i}set toPoint(t){this.width=si(oi,t),this.rotation=ii(oi,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?ti(e,t.points,t.curve,t.closed):(Qe(e,0,0),Ze(e,this.width,0))}};xt([f(Gt)],ri.prototype,"__",void 0),xt([ct("center")],ri.prototype,"strokeAlign",void 0),xt([C(0)],ri.prototype,"height",void 0),xt([L()],ri.prototype,"points",void 0),xt([L(0)],ri.prototype,"curve",void 0),xt([L(!1)],ri.prototype,"closed",void 0),ri=xt([q()],ri);let ai=class extends Be{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return p(t)&&t[0].image}};xt([f(oe)],ai.prototype,"__",void 0),xt([C("")],ai.prototype,"url",void 0),ai=xt([q()],ai);const ni=ai;let hi=class extends Be{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Z.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new yt({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new vt(vt.LOADED,{image:t}))})}draw(t,e,i,s){const o=new ft(t.worldTransform).invert(),r=new ft;e&&r.translate(e.x,e.y),i&&(J(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),o.multiplyParent(r),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};xt([f(re)],hi.prototype,"__",void 0),xt([mt(100)],hi.prototype,"width",void 0),xt([mt(100)],hi.prototype,"height",void 0),xt([mt(1)],hi.prototype,"pixelRatio",void 0),xt([mt(!0)],hi.prototype,"smooth",void 0),xt([w(!1)],hi.prototype,"safeResize",void 0),xt([mt()],hi.prototype,"contextSettings",void 0),hi=xt([q()],hi);const{copyAndSpread:_i,includes:di,spread:li,setList:pi}=dt;let ui=class extends xe{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:r,italic:a,textCase:n,textOverflow:h,padding:_}=t;t.__lineHeight=At.number(e,o),t.__letterSpacing=At.number(i,o),t.__padding=_?y.fourNumber(_):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${a?"italic ":""}${"small-caps"===n?"small-caps ":""}${"normal"!==r?r+" ":""}${o||12}px ${s||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=Bt.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:r,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:h}=t.__textDrawData,_=e.boxBounds;if(e.contentBounds=h,t.__lineHeight<i&&li(h,i/2),r||a){if(_.x=r?h.x:0,_.y=a?h.y:0,_.width=r?h.width:t.width,_.height=a?h.height:t.height,o){const[e,i,s,o]=t.__padding;r&&(_.x-=o,_.width+=i+o),a&&(_.y-=e,_.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(_.width+=.16*i),n.stintSet(this,"isOverflow",!di(_,h)),this.isOverflow?(pi(t.__textBoxBounds={},[_,h]),e.renderChanged=!0):t.__textBoxBounds=_}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;_i(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()}};xt([f(se)],ui.prototype,"__",void 0),xt([C(0)],ui.prototype,"width",void 0),xt([C(0)],ui.prototype,"height",void 0),xt([x()],ui.prototype,"boxStyle",void 0),xt([w(!1)],ui.prototype,"resizeFontSize",void 0),xt([x("#000000")],ui.prototype,"fill",void 0),xt([ct("outside")],ui.prototype,"strokeAlign",void 0),xt([z("all")],ui.prototype,"hitFill",void 0),xt([C("")],ui.prototype,"text",void 0),xt([C("")],ui.prototype,"placeholder",void 0),xt([C("caption")],ui.prototype,"fontFamily",void 0),xt([C(12)],ui.prototype,"fontSize",void 0),xt([C("normal")],ui.prototype,"fontWeight",void 0),xt([C(!1)],ui.prototype,"italic",void 0),xt([C("none")],ui.prototype,"textCase",void 0),xt([C("none")],ui.prototype,"textDecoration",void 0),xt([C(0)],ui.prototype,"letterSpacing",void 0),xt([C({type:"percent",value:1.5})],ui.prototype,"lineHeight",void 0),xt([C(0)],ui.prototype,"paraIndent",void 0),xt([C(0)],ui.prototype,"paraSpacing",void 0),xt([C("x")],ui.prototype,"writingMode",void 0),xt([C("left")],ui.prototype,"textAlign",void 0),xt([C("top")],ui.prototype,"verticalAlign",void 0),xt([C(!0)],ui.prototype,"autoSizeAlign",void 0),xt([C("normal")],ui.prototype,"textWrap",void 0),xt([C("show")],ui.prototype,"textOverflow",void 0),xt([x(!1)],ui.prototype,"textEditing",void 0),ui=xt([q()],ui);let ci=class extends xe{get __tag(){return"Path"}};xt([f(te)],ci.prototype,"__",void 0),xt([ct("center")],ci.prototype,"strokeAlign",void 0),ci=xt([q()],ci);let gi=class extends Se{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new ci(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,r,a,n){return this}arc(t,e,i,s,o,r){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,r,a,n){return this}drawArc(t,e,i,s,o,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};xt([f(ee)],gi.prototype,"__",void 0),xt([(e,i)=>{t(e,i,{get(){return this.__path}})}],gi.prototype,"path",void 0),gi=xt([H(wt,["set","path","paint"]),q()],gi);export{We as Box,Xt as BoxData,hi as Canvas,re as CanvasData,bt as ColorConvert,ue as DragBoundsHelper,It as Effect,Le as Ellipse,Kt as EllipseData,Dt as Export,Tt as Filter,Ie as Frame,qt as FrameData,Se as Group,jt as GroupData,ai as Image,oe as ImageData,ke as Leafer,Jt as LeaferData,ri as Line,Gt as LineData,ni as MyImage,Pt as Paint,Wt as PaintGradient,Ft as PaintImage,ci as Path,Ct as PathArrow,te as PathData,gi as Pen,ee as PenData,Ue as Polygon,Qt as PolygonData,Be as Rect,$t as RectData,fe as RectRender,Ke as Star,Zt as StarData,Et as State,ui as Text,Bt as TextConvert,se as TextData,Lt as Transition,xe as UI,he as UIBounds,Yt as UIData,ye as UIRender,At as UnitConvert,kt as createAttr,St as effectType,mt as resizeType,Rt as zoomLayerType};
//# sourceMappingURL=draw.esm.min.js.map

@@ -1,2 +0,2 @@

"use strict";var t=require("@leafer/core");function e(t,e,s,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,r);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(i<3?o(a):i>3?o(e,s,a):o(e,s))||a);return i>3&&a&&Object.defineProperty(e,s,a),a}function s(e){return t.decorateLeafAttr(e,e=>t.attr({set(t){this.__setAttr(e,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function r(e){return t.decorateLeafAttr(e,e=>t.attr({set(t){this.__setAttr(e,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function o(){return(e,s)=>{const r="_"+s;t.defineKey(e,s,{set(t){this.isLeafer&&(this[r]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[r]||this:this.leafer&&this.leafer.zoomLayer}})}}"function"==typeof SuppressedError&&SuppressedError;const i={},a={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}},n={number:(e,s)=>t.isObject(e)?"percent"===e.type?e.value*s:e.value:e},p={},h={},d={},_={},l={apply(){t.Plugin.need("filter")}},u={},c={setStyleName:()=>t.Plugin.need("state"),set:()=>t.Plugin.need("state")},x={list:{},register(t,e){x.list[t]=e},get:t=>x.list[t]},{parse:y,objectToCanvasData:g}=t.PathConvert,{stintSet:v}=t.DataHelper,{hasTransparent:f}=a,w={},T=t.Debug.get("UIData");class m extends t.LeafData{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,T.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,T.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(e){this.__naturalWidth&&this.__removeNaturalSize(),t.isString(e)||!e?(v(this,"__isTransparentFill",f(e)),this.__isFills&&this.__removePaint("fill",!0),this._fill=e):t.isObject(e)&&this.__setPaint("fill",e)}setStroke(e){t.isString(e)||!e?(v(this,"__isTransparentStroke",f(e)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=e):t.isObject(e)&&this.__setPaint("stroke",e)}setPath(e){const s=t.isString(e);s||e&&t.isObject(e[0])?(this.__setInput("path",e),this._path=s?y(e):g(e)):(this.__input&&this.__removeInput("path"),this._path=e)}setShadow(t){S(this,"shadow",t)}setInnerShadow(t){S(this,"innerShadow",t)}setFilter(t){S(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&h.compute("fill",this.__leaf),e&&h.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(e){let{strokeWidth:s,strokeWidthFixed:r}=this;if(e&&(e.strokeWidth&&(s=e.strokeWidth),t.isUndefined(e.strokeWidthFixed)||(r=e.strokeWidthFixed)),r){const t=this.__leaf.getClampRenderScale();return t>1?s/t:s}return s}__setPaint(e,s){this.__setInput(e,s);const r=this.__leaf.__layout;r.boxChanged||r.boxChange(),t.isArray(s)&&!s.length?this.__removePaint(e):"fill"===e?(this.__isFills=!0,this._fill||(this._fill=w)):(this.__isStrokes=!0,this._stroke||(this._stroke=w))}__removePaint(t,e){e&&this.__removeInput(t),d.recycleImage(t,this),"fill"===t?(v(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(v(this,"__isAlphaPixelStroke",void 0),v(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function S(e,s,r){e.__setInput(s,r),t.isArray(r)?(r.some(t=>!1===t.visible)&&(r=r.filter(t=>!1!==t.visible)),r.length||(r=void 0)):r=r&&!1!==r.visible?[r]:void 0,e["_"+s]=r}class I extends m{}class R extends I{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class k extends I{__getInputData(e,s){const r=super.__getInputData(e,s);return t.canvasSizeAttrs.forEach(t=>delete r[t]),r}}class P extends R{}class b extends m{get __usePathBox(){return this.points||this.__pathInputed}}class B extends m{get __boxStroke(){return!this.__pathInputed}}class C extends m{get __boxStroke(){return!this.__pathInputed}}class U extends b{}class A extends m{}class D extends m{get __pathInputed(){return 2}}class L extends I{}const E={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class F extends m{get __useNaturalRatio(){return!1}setFontWeight(e){t.isString(e)?(this.__setInput("fontWeight",e),e=E[e]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=e}setBoxStyle(e){let s=this.__leaf,r=s.__box;if(e){const{boxStyle:o}=this;if(r)for(let t in o)r[t]=void 0;else r=s.__box=t.UICreator.get("Rect",0);const i=s.__layout,a=r.__layout;o||(r.parent=s,r.__world=s.__world,a.boxBounds=i.boxBounds),r.set(e),a.strokeChanged&&i.strokeChange()}else r&&(s.__box=r.parent=null,r.destroy());this._boxStyle=e}}class W extends B{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const s=super.__getInputData(t,e);return delete s.fill,s}}class M extends B{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const z={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:r,__maxStrokeWidth:o}=s,i=this.__box;if((s.stroke||"all"===s.hitStroke)&&o&&"inside"!==r&&(e=t="center"===r?o/2:o,!s.__boxStroke)){const e=s.__isLinePath?0:10*t,r="none"===s.strokeCap?0:o;t+=Math.max(e,r)}return s.__useArrow&&(t+=5*o),i&&(t=Math.max(i.__layout.strokeSpread=i.__updateStrokeSpread(),t),e=i.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:r,backgroundBlur:o,filter:i,renderSpread:a}=this.__;e&&(t=_.getShadowSpread(this,e)),r&&(t=Math.max(t,r)),i&&(t+=l.getSpread(i)),a&&(t+=a);let n=t=Math.ceil(t);return s&&s.forEach(t=>n=Math.max(n,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),o&&(n=Math.max(n,o)),this.__layout.renderShapeSpread=n,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{float:O}=t.MathHelper,H=new t.Bounds,N=new t.Bounds,G=new t.Bounds,V={limitMove(t,e){const{dragBounds:s,dragBoundsType:r}=t;s&&j.getValidMove(t.__localBoxBounds,j.getDragBounds(t),r,e,!0),j.axisMove(t,e)},limitScaleOf(t,e,s){const{dragBounds:r,dragBoundsType:o}=t;r&&j.getValidScaleOf(t.__localBoxBounds,j.getDragBounds(t),o,t.getLocalPointByInner(t.getInnerPointByBox(e)),s,!0)},axisMove(t,e){const{draggable:s}=t;"x"===s&&(e.y=0),"y"===s&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,s,r)=>"inner"===s||"auto"===s&&t[r]>e[r],getValidMove(t,e,s,r,o){const i=t.x+r.x,a=t.y+r.y,n=i+t.width,p=a+t.height,h=e.x+e.width,d=e.y+e.height;return o||(r=Object.assign({},r)),j.isInnerMode(t,e,s,"width")?i>e.x?r.x+=e.x-i:n<h&&(r.x+=h-n):i<e.x?r.x+=e.x-i:n>h&&(r.x+=h-n),j.isInnerMode(t,e,s,"height")?a>e.y?r.y+=e.y-a:p<d&&(r.y+=d-p):a<e.y?r.y+=e.y-a:p>d&&(r.y+=d-p),r.x=O(r.x),r.y=O(r.y),r},getValidScaleOf(t,e,s,r,o,i){let a,n;return i||(o=Object.assign({},o)),H.set(t).scaleOf(r,o.x,o.y).unsign(),N.set(H).add(e),G.set(H).intersect(e),a=j.isInnerMode(t,e,s,"width")?N.width/H.width:G.width/H.width,n=j.isInnerMode(t,e,s,"height")?N.height/H.height:G.height/H.height,o.x=O(G.width)?o.x*a:1,o.y=O(G.height)?o.y*n:1,o}},j=V,{stintSet:Y}=t.DataHelper,X={__updateChange(){const e=this.__;if(e.__useStroke){const t=e.__useStroke=!(!e.stroke||!e.strokeWidth);Y(this.__world,"half",t&&"center"===e.strokeAlign&&e.strokeWidth%2),Y(e,"__fillAfterStroke",t&&"outside"===e.strokeAlign&&e.fill&&!e.__isTransparentFill)}if(e.__useEffect){const{shadow:s,fill:r,stroke:o}=e,i=e.innerShadow||e.blur||e.backgroundBlur||e.filter;Y(e,"__isFastShadow",s&&!i&&s.length<2&&!s[0].spread&&!_.isTransformShadow(s[0])&&r&&!e.__isTransparentFill&&!(t.isArray(r)&&r.length>1)&&(this.useFastShadow||!o||o&&"inside"===e.strokeAlign)),e.__useEffect=!(!s&&!i)}e.__checkSingle(),Y(e,"__complex",e.__isFills||e.__isStrokes||e.cornerRadius||e.__useEffect)},__drawFast(t,e){q(this,t,e)},__draw(t,e,s){const r=this.__;if(r.__complex){r.__needComputePaint&&r.__computePaint();const{fill:o,stroke:i,__drawAfterFill:n,__fillAfterStroke:p,__isFastShadow:d}=r;if(this.__drawRenderPath(t),r.__useEffect&&!d){const a=h.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:d,innerShadow:u,filter:c}=r;d&&_.shadow(this,t,a),p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t)),o&&(r.__isFills?h.fills(o,this,t):h.fill(o,this,t)),n&&this.__drawAfterFill(t,e),u&&_.innerShadow(this,t,a),i&&!p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t)),c&&l.apply(c,this,this.__nowWorld,t,s,a),a.worldCanvas&&a.worldCanvas.recycle(),a.canvas.recycle()}else{if(p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t)),d){const e=r.shadow[0],{scaleX:s,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*s,e.y*o,e.blur*s,a.string(e.color))}o&&(r.__isFills?h.fills(o,this,t):h.fill(o,this,t)),d&&t.restore(),n&&this.__drawAfterFill(t,e),i&&!p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t))}}else r.__pathInputed?q(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const s=this.__,{fill:r,stroke:o}=s;r&&!e.ignoreFill&&(s.__isAlphaPixelFill?h.fills(r,this,t):h.fill("#000000",this,t)),s.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?h.strokes(o,this,t):h.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function q(t,e,s){const{fill:r,stroke:o,__drawAfterFill:i,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&h.stroke(o,t,e),r&&h.fill(r,t,e),i&&t.__drawAfterFill(e,s),o&&!a&&h.stroke(o,t,e)}const J={__drawFast(t,e){let{x:s,y:r,width:o,height:i}=this.__layout.boxBounds;const{fill:a,stroke:n,__drawAfterFill:p}=this.__;if(a&&(t.fillStyle=a,t.fillRect(s,r,o,i)),p&&this.__drawAfterFill(t,e),n){const{strokeAlign:a,__strokeWidth:p}=this.__;if(!p)return;t.setStroke(n,p,this.__);const h=p/2;switch(a){case"center":t.strokeRect(0,0,o,i);break;case"inside":o-=p,i-=p,o<0||i<0?(t.save(),this.__clip(t,e),t.strokeRect(s+h,r+h,o,i),t.restore()):t.strokeRect(s+h,r+h,o,i);break;case"outside":t.strokeRect(s-h,r-h,o+p,i+p)}}}};var $,K;exports.UI=$=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(e){t.MathHelper.assignScale(this,e)}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:e}=this.__;return t.pen.set(this.path=e||[]),e||this.__drawPathByBox(t.pen),t.pen}reset(t){}set(t,e){t&&Object.assign(this,t)}get(e){return t.isString(e)?this.__.__getInput(e):this.__.__getInputData(e)}createProxyData(){}find(e,s){return t.Plugin.need("find")}findTag(t){return this.find({tag:t})}findOne(e,s){return t.Plugin.need("find")}findId(t){return this.findOne({id:t})}getPath(e,s){this.__layout.update();let r=s?this.__.__pathForRender:this.__.path;return r||(t.pen.set(r=[]),this.__drawPathByBox(t.pen)),e?t.PathConvert.toCanvasData(r,!0):r}getPathString(e,s,r){return t.PathConvert.stringify(this.getPath(e,s),r)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||u.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius?t.PathCorner.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&p.addArrows(this)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(e,s){s?t.PathDrawer.drawPathByData(e,s):this.__drawPathByBox(e)}__drawPathByBox(e){const{x:s,y:r,width:o,height:i}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:a}=this.__;e.roundRect(s,r,o,i,t.isNumber(a)?[a]:a)}else e.rect(s,r,o,i)}drawImagePlaceholder(t,e){h.fill(this.__.placeholderColor,this,t)}animate(e,s,r,o){return this.set(e),t.Plugin.need("animate")}killAnimate(t,e){}export(e,s){return t.Plugin.need("export")}syncExport(e,s){return t.Plugin.need("export")}clone(e){const s=t.DataHelper.clone(this.toJSON());return e&&Object.assign(s,e),$.one(s)}static one(e,s,r,o,i){return t.UICreator.get(e.tag||this.prototype.__tag,e,s,r,o,i)}static registerUI(){t.registerUI()(this)}static registerData(e){t.dataProcessor(e)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},e([t.dataProcessor(m)],exports.UI.prototype,"__",void 0),e([o()],exports.UI.prototype,"zoomLayer",void 0),e([t.dataType("")],exports.UI.prototype,"id",void 0),e([t.dataType("")],exports.UI.prototype,"name",void 0),e([t.dataType("")],exports.UI.prototype,"className",void 0),e([t.surfaceType("pass-through")],exports.UI.prototype,"blendMode",void 0),e([t.opacityType(1)],exports.UI.prototype,"opacity",void 0),e([t.visibleType(!0)],exports.UI.prototype,"visible",void 0),e([t.surfaceType(!1)],exports.UI.prototype,"locked",void 0),e([t.dimType(!1)],exports.UI.prototype,"dim",void 0),e([t.dimType(!1)],exports.UI.prototype,"dimskip",void 0),e([t.sortType(0)],exports.UI.prototype,"zIndex",void 0),e([t.maskType(!1)],exports.UI.prototype,"mask",void 0),e([t.eraserType(!1)],exports.UI.prototype,"eraser",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"x",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"y",void 0),e([t.boundsType(100,!0)],exports.UI.prototype,"width",void 0),e([t.boundsType(100,!0)],exports.UI.prototype,"height",void 0),e([t.scaleType(1,!0)],exports.UI.prototype,"scaleX",void 0),e([t.scaleType(1,!0)],exports.UI.prototype,"scaleY",void 0),e([t.rotationType(0,!0)],exports.UI.prototype,"rotation",void 0),e([t.rotationType(0,!0)],exports.UI.prototype,"skewX",void 0),e([t.rotationType(0,!0)],exports.UI.prototype,"skewY",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"offsetX",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"offsetY",void 0),e([t.scrollType(0,!0)],exports.UI.prototype,"scrollX",void 0),e([t.scrollType(0,!0)],exports.UI.prototype,"scrollY",void 0),e([t.autoLayoutType()],exports.UI.prototype,"origin",void 0),e([t.autoLayoutType()],exports.UI.prototype,"around",void 0),e([t.dataType(!1)],exports.UI.prototype,"lazy",void 0),e([t.naturalBoundsType(1)],exports.UI.prototype,"pixelRatio",void 0),e([t.affectRenderBoundsType(0)],exports.UI.prototype,"renderSpread",void 0),e([t.pathInputType()],exports.UI.prototype,"path",void 0),e([t.pathType()],exports.UI.prototype,"windingRule",void 0),e([t.pathType(!0)],exports.UI.prototype,"closed",void 0),e([t.boundsType(0)],exports.UI.prototype,"padding",void 0),e([t.boundsType(!1)],exports.UI.prototype,"lockRatio",void 0),e([t.boundsType()],exports.UI.prototype,"widthRange",void 0),e([t.boundsType()],exports.UI.prototype,"heightRange",void 0),e([t.dataType(!1)],exports.UI.prototype,"draggable",void 0),e([t.dataType()],exports.UI.prototype,"dragBounds",void 0),e([t.dataType("auto")],exports.UI.prototype,"dragBoundsType",void 0),e([t.dataType(!1)],exports.UI.prototype,"editable",void 0),e([t.hitType(!0)],exports.UI.prototype,"hittable",void 0),e([t.hitType("path")],exports.UI.prototype,"hitFill",void 0),e([t.strokeType("path")],exports.UI.prototype,"hitStroke",void 0),e([t.hitType(!1)],exports.UI.prototype,"hitBox",void 0),e([t.hitType(!0)],exports.UI.prototype,"hitChildren",void 0),e([t.hitType(!0)],exports.UI.prototype,"hitSelf",void 0),e([t.hitType()],exports.UI.prototype,"hitRadius",void 0),e([t.cursorType("")],exports.UI.prototype,"cursor",void 0),e([t.surfaceType()],exports.UI.prototype,"fill",void 0),e([t.strokeType(void 0,!0)],exports.UI.prototype,"stroke",void 0),e([t.strokeType("inside")],exports.UI.prototype,"strokeAlign",void 0),e([t.strokeType(1,!0)],exports.UI.prototype,"strokeWidth",void 0),e([t.strokeType(!1)],exports.UI.prototype,"strokeWidthFixed",void 0),e([t.strokeType("none")],exports.UI.prototype,"strokeCap",void 0),e([t.strokeType("miter")],exports.UI.prototype,"strokeJoin",void 0),e([t.strokeType()],exports.UI.prototype,"dashPattern",void 0),e([t.strokeType(0)],exports.UI.prototype,"dashOffset",void 0),e([t.strokeType(10)],exports.UI.prototype,"miterLimit",void 0),e([t.pathType(0)],exports.UI.prototype,"cornerRadius",void 0),e([t.pathType()],exports.UI.prototype,"cornerSmoothing",void 0),e([s()],exports.UI.prototype,"shadow",void 0),e([s()],exports.UI.prototype,"innerShadow",void 0),e([s()],exports.UI.prototype,"blur",void 0),e([s()],exports.UI.prototype,"backgroundBlur",void 0),e([s()],exports.UI.prototype,"grayscale",void 0),e([s()],exports.UI.prototype,"filter",void 0),e([t.surfaceType()],exports.UI.prototype,"placeholderColor",void 0),e([t.dataType(100)],exports.UI.prototype,"placeholderDelay",void 0),e([t.dataType({})],exports.UI.prototype,"data",void 0),e([t.rewrite(t.Leaf.prototype.reset)],exports.UI.prototype,"reset",null),exports.UI=$=e([t.useModule(z),t.useModule(X),t.rewriteAble()],exports.UI),exports.Group=class extends exports.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach(t=>this.add(t)),t.children=s}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},e([t.dataProcessor(I)],exports.Group.prototype,"__",void 0),e([t.boundsType(0)],exports.Group.prototype,"width",void 0),e([t.boundsType(0)],exports.Group.prototype,"height",void 0),exports.Group=e([t.useModule(t.Branch),t.registerUI()],exports.Group);const Q=t.Debug.get("Leafer");exports.Leafer=K=class extends exports.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&t.Resource.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||t.getBoundsData()}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),K.list.add(this)}init(e,s){if(this.canvas)return;let r;const{config:o}=this;this.__setLeafer(this),s&&(this.parentApp=s,this.__bindApp(s),r=s.running),e&&(this.parent=s,this.initType(e.type),this.parent=void 0,t.DataHelper.assign(o,e));const i=this.canvas=t.Creator.canvas(o);this.__controllers.push(this.renderer=t.Creator.renderer(this,i,o),this.watcher=t.Creator.watcher(this,o),this.layouter=t.Creator.layouter(this,o)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=i.view,s||(this.selector=t.Creator.selector(this),this.interaction=t.Creator.interaction(this,i,this.selector,o),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=t.Creator.hitCanvasManager()),this.canvasManager=new t.CanvasManager,r=o.start),this.hittable=o.hittable,this.fill=o.fill,this.canvasManager.add(i),this.__listenEvents(),r&&(this.__startTimer=setTimeout(this.start.bind(this))),t.WaitHelper.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(t.LeaferEvent.RESTART):this.emitLeafer(t.LeaferEvent.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(t.LeaferEvent.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(e){const s=t.DataHelper.copyAttrs({},e,t.canvasSizeAttrs);Object.keys(s).forEach(t=>this[t]=s[t])}forceRender(e,s){const{renderer:r}=this;r&&(r.addBlock(e?new t.Bounds(e):this.canvas.bounds),this.viewReady&&(s?r.render():r.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(e){const{canvas:s}=this;if(!s||s.isSameSize(e))return;const r=t.DataHelper.copyAttrs({},this.canvas,t.canvasSizeAttrs);s.resize(e),this.updateLazyBounds(),this.__onResize(new t.ResizeEvent(e,r))}__onResize(e){this.emitEvent(e),t.DataHelper.copyAttrs(this.__,e,t.canvasSizeAttrs),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:e,parentApp:s}=this;s||(e.width&&e.height||(this.autoLayout=new t.AutoBounds(e)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(e,s){return this.canvas&&(t.canvasSizeAttrs.includes(e)?this.__changeCanvasSize(e,s):"fill"===e?this.__changeFill(s):"hittable"===e?this.parent||(this.canvas.hittable=s):"zIndex"===e?(this.canvas.zIndex=s,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===e&&this.emit(t.LeaferEvent.UPDATE_MODE,{mode:s})),super.__setAttr(e,s)}__getAttr(e){return this.canvas&&t.canvasSizeAttrs.includes(e)?this.canvas[e]:super.__getAttr(e)}__changeCanvasSize(e,s){const{config:r,canvas:o}=this,i=t.DataHelper.copyAttrs({},o,t.canvasSizeAttrs);i[e]=r[e]=s,r.width&&r.height?o.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(i)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(t.LeaferEvent.BEFORE_READY),this.emitLeafer(t.LeaferEvent.READY),this.emitLeafer(t.LeaferEvent.AFTER_READY),t.WaitHelper.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(t.LeaferEvent.VIEW_READY),t.WaitHelper.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:r,height:o,pixelRatio:i}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(r=Math.max(1,a.x+a.width)),s||(o=Math.max(1,a.y+a.height)),this.__doResize({width:r,height:o,pixelRatio:i})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){t.WaitHelper.run(this.__nextRenderWait);const{imageReady:e}=this;e&&!this.viewCompleted&&this.__checkViewCompleted(),e||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(e=!0){this.nextRender(()=>{this.imageReady&&(e&&this.emitLeafer(t.LeaferEvent.VIEW_COMPLETED),t.WaitHelper.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,s){e&&(t=t.bind(e));const r=this.__nextRenderWait;if(s){for(let e=0;e<r.length;e++)if(r[e]===t){r.splice(e,1);break}}else r.push(t);this.requestRender()}zoom(e,s,r,o){return t.Plugin.need("view")}getValidMove(t,e,s){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:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(e){this.emitEvent(new t.LeaferEvent(e,this))}__listenEvents(){const e=t.Run.start("FirstCreate "+this.innerName);this.once([[t.LeaferEvent.START,()=>t.Run.end(e)],[t.LayoutEvent.START,this.updateLazyBounds,this],[t.RenderEvent.START,this.__onCreated,this],[t.RenderEvent.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[t.WatchEvent.DATA,this.__onWatchData,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(e){const s=()=>{if(!this.destroyed){K.list.remove(this);try{this.stop(),this.emitLeafer(t.LeaferEvent.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{t.ImageManager.clearRecycled()},100)}catch(t){Q.error(t)}}};e?s():setTimeout(s)}},exports.Leafer.list=new t.LeafList,e([t.dataProcessor(k)],exports.Leafer.prototype,"__",void 0),e([t.boundsType()],exports.Leafer.prototype,"pixelRatio",void 0),e([t.dataType("normal")],exports.Leafer.prototype,"mode",void 0),exports.Leafer=K=e([t.registerUI()],exports.Leafer),exports.Rect=class extends exports.UI{get __tag(){return"Rect"}},e([t.dataProcessor(B)],exports.Rect.prototype,"__",void 0),exports.Rect=e([t.useModule(J),t.rewriteAble(),t.registerUI()],exports.Rect);const{add:Z,includes:tt,scroll:et}=t.BoundsHelper,st=exports.Rect.prototype,rt=exports.Group.prototype;exports.Box=class extends exports.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let e,s;if(this.children.length){const r=this.__,o=this.__layout,{renderBounds:i,boxBounds:a}=o,{overflow:n}=r,p=o.childrenRenderBounds||(o.childrenRenderBounds=t.getBoundsData());super.__updateRenderBounds(p),(s=n.includes("scroll"))&&(Z(p,a),et(p,r)),this.__updateRectRenderBounds(),e=!tt(a,p),e&&"show"===n&&Z(i,p)}else this.__updateRectRenderBounds();t.DataHelper.stintSet(this,"isOverflow",e),this.__checkScroll(s)}__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))}},e([t.dataProcessor(R)],exports.Box.prototype,"__",void 0),e([t.boundsType(100)],exports.Box.prototype,"width",void 0),e([t.boundsType(100)],exports.Box.prototype,"height",void 0),e([t.dataType(!1)],exports.Box.prototype,"resizeChildren",void 0),e([t.affectRenderBoundsType("show")],exports.Box.prototype,"overflow",void 0),e([t.rewrite(st.__updateStrokeSpread)],exports.Box.prototype,"__updateStrokeSpread",null),e([t.rewrite(st.__updateRenderSpread)],exports.Box.prototype,"__updateRectRenderSpread",null),e([t.rewrite(st.__updateBoxBounds)],exports.Box.prototype,"__updateRectBoxBounds",null),e([t.rewrite(st.__updateStrokeBounds)],exports.Box.prototype,"__updateStrokeBounds",null),e([t.rewrite(st.__updateRenderBounds)],exports.Box.prototype,"__updateRectRenderBounds",null),e([t.rewrite(st.__updateChange)],exports.Box.prototype,"__updateRectChange",null),e([t.rewrite(st.__render)],exports.Box.prototype,"__renderRect",null),e([t.rewrite(rt.__render)],exports.Box.prototype,"__renderGroup",null),exports.Box=e([t.rewriteAble(),t.registerUI()],exports.Box),exports.Frame=class extends exports.Box{get __tag(){return"Frame"}get isFrame(){return!0}},e([t.dataProcessor(P)],exports.Frame.prototype,"__",void 0),e([t.surfaceType("#FFFFFF")],exports.Frame.prototype,"fill",void 0),e([t.affectRenderBoundsType("hide")],exports.Frame.prototype,"overflow",void 0),exports.Frame=e([t.registerUI()],exports.Frame);const{moveTo:ot,closePath:it,ellipse:at}=t.PathCommandDataHelper;exports.Ellipse=class extends exports.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:e,height:s,innerRadius:r,startAngle:o,endAngle:i}=this.__,a=e/2,n=s/2,p=this.__.path=[];r?(o||i?(r<1&&at(p,a,n,a*r,n*r,0,o,i,!1),at(p,a,n,a,n,0,i,o,!0),r<1&&it(p)):(r<1&&(at(p,a,n,a*r,n*r),ot(p,e,n)),at(p,a,n,a,n,0,360,0,!0)),t.Platform.ellipseToCurve&&(this.__.path=this.getPath(!0))):o||i?(ot(p,a,n),at(p,a,n,a,n,0,o,i,!1),it(p)):at(p,a,n,a,n)}},e([t.dataProcessor(C)],exports.Ellipse.prototype,"__",void 0),e([t.pathType(0)],exports.Ellipse.prototype,"innerRadius",void 0),e([t.pathType(0)],exports.Ellipse.prototype,"startAngle",void 0),e([t.pathType(0)],exports.Ellipse.prototype,"endAngle",void 0),exports.Ellipse=e([t.registerUI()],exports.Ellipse);const{sin:nt,cos:pt,PI:ht}=Math,{moveTo:dt,lineTo:_t,closePath:lt,drawPoints:ut}=t.PathCommandDataHelper;exports.Polygon=class extends exports.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)ut(e,t.points,t.curve,!0);else{const{width:s,height:r,sides:o}=t,i=s/2,a=r/2;dt(e,i,0);for(let t=1;t<o;t++)_t(e,i+i*nt(2*t*ht/o),a-a*pt(2*t*ht/o));lt(e)}}},e([t.dataProcessor(U)],exports.Polygon.prototype,"__",void 0),e([t.pathType(3)],exports.Polygon.prototype,"sides",void 0),e([t.pathType()],exports.Polygon.prototype,"points",void 0),e([t.pathType(0)],exports.Polygon.prototype,"curve",void 0),exports.Polygon=e([t.rewriteAble(),t.registerUI()],exports.Polygon);const{sin:ct,cos:xt,PI:yt}=Math,{moveTo:gt,lineTo:vt,closePath:ft}=t.PathCommandDataHelper;exports.Star=class extends exports.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:s,innerRadius:r}=this.__,o=t/2,i=e/2,a=this.__.path=[];gt(a,o,0);for(let t=1;t<2*s;t++)vt(a,o+(t%2==0?o:o*r)*ct(t*yt/s),i-(t%2==0?i:i*r)*xt(t*yt/s));ft(a)}},e([t.dataProcessor(A)],exports.Star.prototype,"__",void 0),e([t.pathType(5)],exports.Star.prototype,"corners",void 0),e([t.pathType(.382)],exports.Star.prototype,"innerRadius",void 0),exports.Star=e([t.registerUI()],exports.Star);const{moveTo:wt,lineTo:Tt,drawPoints:mt}=t.PathCommandDataHelper,{rotate:St,getAngle:It,getDistance:Rt,defaultPoint:kt}=t.PointHelper;exports.Line=class extends exports.UI{get __tag(){return"Line"}get toPoint(){const{width:e,rotation:s}=this.__,r=t.getPointData();return e&&(r.x=e),s&&St(r,s),r}set toPoint(t){this.width=Rt(kt,t),this.rotation=It(kt,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?mt(e,t.points,t.curve,t.closed):(wt(e,0,0),Tt(e,this.width,0))}},e([t.dataProcessor(b)],exports.Line.prototype,"__",void 0),e([t.affectStrokeBoundsType("center")],exports.Line.prototype,"strokeAlign",void 0),e([t.boundsType(0)],exports.Line.prototype,"height",void 0),e([t.pathType()],exports.Line.prototype,"points",void 0),e([t.pathType(0)],exports.Line.prototype,"curve",void 0),e([t.pathType(!1)],exports.Line.prototype,"closed",void 0),exports.Line=e([t.registerUI()],exports.Line),exports.Image=class extends exports.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:e}=this.__;return t.isArray(e)&&e[0].image}},e([t.dataProcessor(W)],exports.Image.prototype,"__",void 0),e([t.boundsType("")],exports.Image.prototype,"url",void 0),exports.Image=e([t.registerUI()],exports.Image);const Pt=exports.Image;exports.Canvas=class extends exports.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(e){super(e),this.canvas=t.Creator.canvas(this.__),e&&e.url&&this.drawImage(e.url)}drawImage(e){new t.LeaferImage({url:e}).load(e=>{this.context.drawImage(e.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new t.ImageEvent(t.ImageEvent.LOADED,{image:e}))})}draw(e,s,r,o){const i=new t.Matrix(e.worldTransform).invert(),a=new t.Matrix;s&&a.translate(s.x,s.y),r&&(t.isNumber(r)?a.scale(r):a.scale(r.x,r.y)),o&&a.rotate(o),i.multiplyParent(a),e.__render(this.canvas,{matrix:i.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:r}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,s,r)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},e([t.dataProcessor(M)],exports.Canvas.prototype,"__",void 0),e([r(100)],exports.Canvas.prototype,"width",void 0),e([r(100)],exports.Canvas.prototype,"height",void 0),e([r(1)],exports.Canvas.prototype,"pixelRatio",void 0),e([r(!0)],exports.Canvas.prototype,"smooth",void 0),e([t.dataType(!1)],exports.Canvas.prototype,"safeResize",void 0),e([r()],exports.Canvas.prototype,"contextSettings",void 0),exports.Canvas=e([t.registerUI()],exports.Canvas);const{copyAndSpread:bt,includes:Bt,spread:Ct,setList:Ut}=t.BoundsHelper;exports.Text=class extends exports.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const e=this.__,{lineHeight:s,letterSpacing:r,fontFamily:o,fontSize:a,fontWeight:p,italic:h,textCase:d,textOverflow:_,padding:l}=e;e.__lineHeight=n.number(s,a),e.__letterSpacing=n.number(r,a),e.__padding=l?t.MathHelper.fourNumber(l):void 0,e.__baseLine=e.__lineHeight-(e.__lineHeight-.7*a)/2,e.__font=`${h?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==p?p+" ":""}${a||12}px ${o||"caption"}`,e.__clipText="show"!==_&&!e.__autoSize,e.__textDrawData=i.getDrawData((e.__isPlacehold=e.placeholder&&""===e.text)?e.placeholder:e.text,this.__)}__updateBoxBounds(){const e=this.__,s=this.__layout,{fontSize:r,italic:o,padding:i,__autoWidth:a,__autoHeight:n}=e;this.__updateTextDrawData();const{bounds:p}=e.__textDrawData,h=s.boxBounds;if(s.contentBounds=p,e.__lineHeight<r&&Ct(p,r/2),a||n){if(h.x=a?p.x:0,h.y=n?p.y:0,h.width=a?p.width:e.width,h.height=n?p.height:e.height,i){const[t,s,r,o]=e.__padding;a&&(h.x-=o,h.width+=s+o),n&&(h.y-=t,h.height+=r+t)}this.__updateNaturalSize()}else super.__updateBoxBounds();o&&(h.width+=.16*r),t.DataHelper.stintSet(this,"isOverflow",!Bt(h,p)),this.isOverflow?(Ut(e.__textBoxBounds={},[h,p]),s.renderChanged=!0):e.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;bt(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,s){const r=this.__box;r&&(r.__nowWorld=this.__nowWorld,r.__draw(t,e,s)),this.textEditing&&!e.exporting||super.__draw(t,e,s)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},e([t.dataProcessor(F)],exports.Text.prototype,"__",void 0),e([t.boundsType(0)],exports.Text.prototype,"width",void 0),e([t.boundsType(0)],exports.Text.prototype,"height",void 0),e([t.surfaceType()],exports.Text.prototype,"boxStyle",void 0),e([t.dataType(!1)],exports.Text.prototype,"resizeFontSize",void 0),e([t.surfaceType("#000000")],exports.Text.prototype,"fill",void 0),e([t.affectStrokeBoundsType("outside")],exports.Text.prototype,"strokeAlign",void 0),e([t.hitType("all")],exports.Text.prototype,"hitFill",void 0),e([t.boundsType("")],exports.Text.prototype,"text",void 0),e([t.boundsType("")],exports.Text.prototype,"placeholder",void 0),e([t.boundsType("caption")],exports.Text.prototype,"fontFamily",void 0),e([t.boundsType(12)],exports.Text.prototype,"fontSize",void 0),e([t.boundsType("normal")],exports.Text.prototype,"fontWeight",void 0),e([t.boundsType(!1)],exports.Text.prototype,"italic",void 0),e([t.boundsType("none")],exports.Text.prototype,"textCase",void 0),e([t.boundsType("none")],exports.Text.prototype,"textDecoration",void 0),e([t.boundsType(0)],exports.Text.prototype,"letterSpacing",void 0),e([t.boundsType({type:"percent",value:1.5})],exports.Text.prototype,"lineHeight",void 0),e([t.boundsType(0)],exports.Text.prototype,"paraIndent",void 0),e([t.boundsType(0)],exports.Text.prototype,"paraSpacing",void 0),e([t.boundsType("x")],exports.Text.prototype,"writingMode",void 0),e([t.boundsType("left")],exports.Text.prototype,"textAlign",void 0),e([t.boundsType("top")],exports.Text.prototype,"verticalAlign",void 0),e([t.boundsType(!0)],exports.Text.prototype,"autoSizeAlign",void 0),e([t.boundsType("normal")],exports.Text.prototype,"textWrap",void 0),e([t.boundsType("show")],exports.Text.prototype,"textOverflow",void 0),e([t.surfaceType(!1)],exports.Text.prototype,"textEditing",void 0),exports.Text=e([t.registerUI()],exports.Text),exports.Path=class extends exports.UI{get __tag(){return"Path"}},e([t.dataProcessor(D)],exports.Path.prototype,"__",void 0),e([t.affectStrokeBoundsType("center")],exports.Path.prototype,"strokeAlign",void 0),exports.Path=e([t.registerUI()],exports.Path),exports.Pen=class extends exports.Group{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new exports.Path(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,s,r,o,i){return this}quadraticCurveTo(t,e,s,r){return this}closePath(){return this}rect(t,e,s,r){return this}roundRect(t,e,s,r,o){return this}ellipse(t,e,s,r,o,i,a,n){return this}arc(t,e,s,r,o,i){return this}arcTo(t,e,s,r,o){return this}drawEllipse(t,e,s,r,o,i,a,n){return this}drawArc(t,e,s,r,o,i){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},e([t.dataProcessor(L)],exports.Pen.prototype,"__",void 0),e([(e,s)=>{t.defineKey(e,s,{get(){return this.__path}})}],exports.Pen.prototype,"path",void 0),exports.Pen=e([t.useModule(t.PathCreator,["set","path","paint"]),t.registerUI()],exports.Pen),exports.BoxData=R,exports.CanvasData=M,exports.ColorConvert=a,exports.DragBoundsHelper=V,exports.Effect=_,exports.EllipseData=C,exports.Export=u,exports.Filter=l,exports.FrameData=P,exports.GroupData=I,exports.ImageData=W,exports.LeaferData=k,exports.LineData=b,exports.MyImage=Pt,exports.Paint=h,exports.PaintGradient={},exports.PaintImage=d,exports.PathArrow=p,exports.PathData=D,exports.PenData=L,exports.PolygonData=U,exports.RectData=B,exports.RectRender=J,exports.StarData=A,exports.State=c,exports.TextConvert=i,exports.TextData=F,exports.Transition=x,exports.UIBounds=z,exports.UIData=m,exports.UIRender=X,exports.UnitConvert=n,exports.createAttr=function(e){return(s,r)=>{t.defineKey(s,r,t.createDescriptor(r,e))}},exports.effectType=s,exports.resizeType=r,exports.zoomLayerType=o,Object.keys(t).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});
"use strict";var t=require("@leafer/core");function e(t,e,s,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,r);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(i<3?o(a):i>3?o(e,s,a):o(e,s))||a);return i>3&&a&&Object.defineProperty(e,s,a),a}function s(e){return t.decorateLeafAttr(e,e=>t.attr({set(t){this.__setAttr(e,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function r(e){return t.decorateLeafAttr(e,e=>t.attr({set(t){this.__setAttr(e,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function o(){return(e,s)=>{const r="_"+s;t.defineKey(e,s,{set(t){this.isLeafer&&(this[r]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[r]||this:this.leafer&&this.leafer.zoomLayer}})}}"function"==typeof SuppressedError&&SuppressedError;const i={},a={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}},n={number:(e,s)=>t.isObject(e)?"percent"===e.type?e.value*s:e.value:e},p={},h={},d={},_={},l={apply(){t.Plugin.need("filter")}},u={},c={setStyleName:()=>t.Plugin.need("state"),set:()=>t.Plugin.need("state")},x={list:{},register(t,e){x.list[t]=e},get:t=>x.list[t]},{parse:y,objectToCanvasData:g}=t.PathConvert,{stintSet:v}=t.DataHelper,{hasTransparent:f}=a,w={},T=t.Debug.get("UIData");class S extends t.LeafData{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,T.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,T.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(e){this.__naturalWidth&&this.__removeNaturalSize(),t.isString(e)||!e?(v(this,"__isTransparentFill",f(e)),this.__isFills&&this.__removePaint("fill",!0),this._fill=e):t.isObject(e)&&this.__setPaint("fill",e)}setStroke(e){t.isString(e)||!e?(v(this,"__isTransparentStroke",f(e)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=e):t.isObject(e)&&this.__setPaint("stroke",e)}setPath(e){const s=t.isString(e);s||e&&t.isObject(e[0])?(this.__setInput("path",e),this._path=s?y(e):g(e)):(this.__input&&this.__removeInput("path"),this._path=e)}setShadow(t){m(this,"shadow",t)}setInnerShadow(t){m(this,"innerShadow",t)}setFilter(t){m(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&h.compute("fill",this.__leaf),e&&h.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(e){let{strokeWidth:s,strokeWidthFixed:r}=this;if(e&&(e.strokeWidth&&(s=e.strokeWidth),t.isUndefined(e.strokeWidthFixed)||(r=e.strokeWidthFixed)),r){const t=this.__leaf.getClampRenderScale();return t>1?s/t:s}return s}__setPaint(e,s){this.__setInput(e,s);const r=this.__leaf.__layout;r.boxChanged||r.boxChange(),t.isArray(s)&&!s.length?this.__removePaint(e):"fill"===e?(this.__isFills=!0,this._fill||(this._fill=w)):(this.__isStrokes=!0,this._stroke||(this._stroke=w))}__removePaint(t,e){e&&this.__removeInput(t),d.recycleImage(t,this),"fill"===t?(v(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(v(this,"__isAlphaPixelStroke",void 0),v(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function m(e,s,r){e.__setInput(s,r),t.isArray(r)?(r.some(t=>!1===t.visible)&&(r=r.filter(t=>!1!==t.visible)),r.length||(r=void 0)):r=r&&!1!==r.visible?[r]:void 0,e["_"+s]=r}class I extends S{}class R extends I{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class k extends I{__getInputData(e,s){const r=super.__getInputData(e,s);return t.canvasSizeAttrs.forEach(t=>delete r[t]),r}}class P extends R{}class B extends S{get __usePathBox(){return this.points||this.__pathInputed}}class b extends S{get __boxStroke(){return!this.__pathInputed}}class C extends S{get __boxStroke(){return!this.__pathInputed}}class U extends B{}class A extends S{}class D extends S{get __pathInputed(){return 2}}class L extends I{}const E={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class F extends S{get __useNaturalRatio(){return!1}setFontWeight(e){t.isString(e)?(this.__setInput("fontWeight",e),e=E[e]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=e}setBoxStyle(e){let s=this.__leaf,r=s.__box;if(e){const{boxStyle:o}=this;if(r)for(let t in o)r[t]=void 0;else r=s.__box=t.UICreator.get("Rect",0);const i=s.__layout,a=r.__layout;o||(r.parent=s,r.__world=s.__world,a.boxBounds=i.boxBounds),r.set(e),a.strokeChanged&&i.strokeChange()}else r&&(s.__box=r.parent=null,r.destroy());this._boxStyle=e}}class W extends b{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const s=super.__getInputData(t,e);return delete s.fill,s}}class z extends b{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const{max:M,add:O}=t.FourNumberHelper,H={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:r,__maxStrokeWidth:o}=s,i=this.__box;if((s.stroke||"all"===s.hitStroke)&&o&&"inside"!==r&&(e=t="center"===r?o/2:o,!s.__boxStroke)){const e=s.__isLinePath?0:10*t,r="none"===s.strokeCap?0:o;t+=Math.max(e,r)}return s.__useArrow&&(t+=5*o),i&&(t=M(t,i.__layout.strokeSpread=i.__updateStrokeSpread()),e=Math.max(e,i.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:r,backgroundBlur:o,filter:i,renderSpread:a}=this.__,{strokeSpread:n}=this.__layout,p=this.__box;e&&(t=_.getShadowRenderSpread(this,e)),r&&(t=M(t,r)),i&&(t=O(t,l.getSpread(i))),a&&(t=O(t,a)),n&&(t=O(t,n));let h=t;return s&&(h=M(h,_.getInnerShadowSpread(this,s))),o&&(h=M(h,o)),this.__layout.renderShapeSpread=h,p?M(p.__updateRenderSpread(),t):t}},{float:N}=t.MathHelper,G=new t.Bounds,V=new t.Bounds,j=new t.Bounds,Y={limitMove(t,e){const{dragBounds:s,dragBoundsType:r}=t;s&&X.getValidMove(t.__localBoxBounds,X.getDragBounds(t),r,e,!0),X.axisMove(t,e)},limitScaleOf(t,e,s){const{dragBounds:r,dragBoundsType:o}=t;r&&X.getValidScaleOf(t.__localBoxBounds,X.getDragBounds(t),o,t.getLocalPointByInner(t.getInnerPointByBox(e)),s,!0)},axisMove(t,e){const{draggable:s}=t;"x"===s&&(e.y=0),"y"===s&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,s,r)=>"inner"===s||"auto"===s&&t[r]>e[r],getValidMove(t,e,s,r,o){const i=t.x+r.x,a=t.y+r.y,n=i+t.width,p=a+t.height,h=e.x+e.width,d=e.y+e.height;return o||(r=Object.assign({},r)),X.isInnerMode(t,e,s,"width")?i>e.x?r.x+=e.x-i:n<h&&(r.x+=h-n):i<e.x?r.x+=e.x-i:n>h&&(r.x+=h-n),X.isInnerMode(t,e,s,"height")?a>e.y?r.y+=e.y-a:p<d&&(r.y+=d-p):a<e.y?r.y+=e.y-a:p>d&&(r.y+=d-p),r.x=N(r.x),r.y=N(r.y),r},getValidScaleOf(t,e,s,r,o,i){let a,n;return i||(o=Object.assign({},o)),G.set(t).scaleOf(r,o.x,o.y).unsign(),V.set(G).add(e),j.set(G).intersect(e),a=X.isInnerMode(t,e,s,"width")?V.width/G.width:j.width/G.width,n=X.isInnerMode(t,e,s,"height")?V.height/G.height:j.height/G.height,o.x=N(j.width)?o.x*a:1,o.y=N(j.height)?o.y*n:1,o}},X=Y,{stintSet:q}=t.DataHelper,J={__updateChange(){const e=this.__;if(e.__useStroke){const t=e.__useStroke=!(!e.stroke||!e.strokeWidth);q(this.__world,"half",t&&"center"===e.strokeAlign&&e.strokeWidth%2),q(e,"__fillAfterStroke",t&&"outside"===e.strokeAlign&&e.fill&&!e.__isTransparentFill)}if(e.__useEffect){const{shadow:s,fill:r,stroke:o}=e,i=e.innerShadow||e.blur||e.backgroundBlur||e.filter;q(e,"__isFastShadow",s&&!i&&s.length<2&&!s[0].spread&&!_.isTransformShadow(s[0])&&r&&!e.__isTransparentFill&&!(t.isArray(r)&&r.length>1)&&(this.useFastShadow||!o||o&&"inside"===e.strokeAlign)),e.__useEffect=!(!s&&!i)}e.__checkSingle(),q(e,"__complex",e.__isFills||e.__isStrokes||e.cornerRadius||e.__useEffect)},__drawFast(t,e){$(this,t,e)},__draw(t,e,s){const r=this.__;if(r.__complex){r.__needComputePaint&&r.__computePaint();const{fill:o,stroke:i,__drawAfterFill:n,__fillAfterStroke:p,__isFastShadow:d}=r;if(this.__drawRenderPath(t),r.__useEffect&&!d){const a=h.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:d,innerShadow:u,filter:c}=r;d&&_.shadow(this,t,a),p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t)),o&&(r.__isFills?h.fills(o,this,t):h.fill(o,this,t)),n&&this.__drawAfterFill(t,e),u&&_.innerShadow(this,t,a),i&&!p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t)),c&&l.apply(c,this,this.__nowWorld,t,s,a),a.worldCanvas&&a.worldCanvas.recycle(),a.canvas.recycle()}else{if(p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t)),d){const e=r.shadow[0],{scaleX:s,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*s,e.y*o,e.blur*s,a.string(e.color))}o&&(r.__isFills?h.fills(o,this,t):h.fill(o,this,t)),d&&t.restore(),n&&this.__drawAfterFill(t,e),i&&!p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t))}}else r.__pathInputed?$(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const s=this.__,{fill:r,stroke:o}=s;r&&!e.ignoreFill&&(s.__isAlphaPixelFill?h.fills(r,this,t):h.fill("#000000",this,t)),s.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?h.strokes(o,this,t):h.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function $(t,e,s){const{fill:r,stroke:o,__drawAfterFill:i,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&h.stroke(o,t,e),r&&h.fill(r,t,e),i&&t.__drawAfterFill(e,s),o&&!a&&h.stroke(o,t,e)}const K={__drawFast(t,e){let{x:s,y:r,width:o,height:i}=this.__layout.boxBounds;const{fill:a,stroke:n,__drawAfterFill:p}=this.__;if(a&&(t.fillStyle=a,t.fillRect(s,r,o,i)),p&&this.__drawAfterFill(t,e),n){const{strokeAlign:a,__strokeWidth:p}=this.__;if(!p)return;t.setStroke(n,p,this.__);const h=p/2;switch(a){case"center":t.strokeRect(0,0,o,i);break;case"inside":o-=p,i-=p,o<0||i<0?(t.save(),this.__clip(t,e),t.strokeRect(s+h,r+h,o,i),t.restore()):t.strokeRect(s+h,r+h,o,i);break;case"outside":t.strokeRect(s-h,r-h,o+p,i+p)}}}};var Q,Z;exports.UI=Q=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(e){t.MathHelper.assignScale(this,e)}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:e}=this.__;return t.pen.set(this.path=e||[]),e||this.__drawPathByBox(t.pen),t.pen}reset(t){}set(t,e){t&&Object.assign(this,t)}get(e){return t.isString(e)?this.__.__getInput(e):this.__.__getInputData(e)}createProxyData(){}find(e,s){return t.Plugin.need("find")}findTag(t){return this.find({tag:t})}findOne(e,s){return t.Plugin.need("find")}findId(t){return this.findOne({id:t})}getPath(e,s){this.__layout.update();let r=s?this.__.__pathForRender:this.__.path;return r||(t.pen.set(r=[]),this.__drawPathByBox(t.pen)),e?t.PathConvert.toCanvasData(r,!0):r}getPathString(e,s,r){return t.PathConvert.stringify(this.getPath(e,s),r)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||u.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius?t.PathCorner.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&p.addArrows(this)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(e,s){s?t.PathDrawer.drawPathByData(e,s):this.__drawPathByBox(e)}__drawPathByBox(e){const{x:s,y:r,width:o,height:i}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:a}=this.__;e.roundRect(s,r,o,i,t.isNumber(a)?[a]:a)}else e.rect(s,r,o,i)}drawImagePlaceholder(t,e){h.fill(this.__.placeholderColor,this,t)}animate(e,s,r,o){return this.set(e),t.Plugin.need("animate")}killAnimate(t,e){}export(e,s){return t.Plugin.need("export")}syncExport(e,s){return t.Plugin.need("export")}clone(e){const s=t.DataHelper.clone(this.toJSON());return e&&Object.assign(s,e),Q.one(s)}static one(e,s,r,o,i){return t.UICreator.get(e.tag||this.prototype.__tag,e,s,r,o,i)}static registerUI(){t.registerUI()(this)}static registerData(e){t.dataProcessor(e)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},e([t.dataProcessor(S)],exports.UI.prototype,"__",void 0),e([o()],exports.UI.prototype,"zoomLayer",void 0),e([t.dataType("")],exports.UI.prototype,"id",void 0),e([t.dataType("")],exports.UI.prototype,"name",void 0),e([t.dataType("")],exports.UI.prototype,"className",void 0),e([t.surfaceType("pass-through")],exports.UI.prototype,"blendMode",void 0),e([t.opacityType(1)],exports.UI.prototype,"opacity",void 0),e([t.visibleType(!0)],exports.UI.prototype,"visible",void 0),e([t.surfaceType(!1)],exports.UI.prototype,"locked",void 0),e([t.dimType(!1)],exports.UI.prototype,"dim",void 0),e([t.dimType(!1)],exports.UI.prototype,"dimskip",void 0),e([t.sortType(0)],exports.UI.prototype,"zIndex",void 0),e([t.maskType(!1)],exports.UI.prototype,"mask",void 0),e([t.eraserType(!1)],exports.UI.prototype,"eraser",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"x",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"y",void 0),e([t.boundsType(100,!0)],exports.UI.prototype,"width",void 0),e([t.boundsType(100,!0)],exports.UI.prototype,"height",void 0),e([t.scaleType(1,!0)],exports.UI.prototype,"scaleX",void 0),e([t.scaleType(1,!0)],exports.UI.prototype,"scaleY",void 0),e([t.rotationType(0,!0)],exports.UI.prototype,"rotation",void 0),e([t.rotationType(0,!0)],exports.UI.prototype,"skewX",void 0),e([t.rotationType(0,!0)],exports.UI.prototype,"skewY",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"offsetX",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"offsetY",void 0),e([t.scrollType(0,!0)],exports.UI.prototype,"scrollX",void 0),e([t.scrollType(0,!0)],exports.UI.prototype,"scrollY",void 0),e([t.autoLayoutType()],exports.UI.prototype,"origin",void 0),e([t.autoLayoutType()],exports.UI.prototype,"around",void 0),e([t.dataType(!1)],exports.UI.prototype,"lazy",void 0),e([t.naturalBoundsType(1)],exports.UI.prototype,"pixelRatio",void 0),e([t.affectRenderBoundsType(0)],exports.UI.prototype,"renderSpread",void 0),e([t.pathInputType()],exports.UI.prototype,"path",void 0),e([t.pathType()],exports.UI.prototype,"windingRule",void 0),e([t.pathType(!0)],exports.UI.prototype,"closed",void 0),e([t.boundsType(0)],exports.UI.prototype,"padding",void 0),e([t.boundsType(!1)],exports.UI.prototype,"lockRatio",void 0),e([t.boundsType()],exports.UI.prototype,"widthRange",void 0),e([t.boundsType()],exports.UI.prototype,"heightRange",void 0),e([t.dataType(!1)],exports.UI.prototype,"draggable",void 0),e([t.dataType()],exports.UI.prototype,"dragBounds",void 0),e([t.dataType("auto")],exports.UI.prototype,"dragBoundsType",void 0),e([t.dataType(!1)],exports.UI.prototype,"editable",void 0),e([t.hitType(!0)],exports.UI.prototype,"hittable",void 0),e([t.hitType("path")],exports.UI.prototype,"hitFill",void 0),e([t.strokeType("path")],exports.UI.prototype,"hitStroke",void 0),e([t.hitType(!1)],exports.UI.prototype,"hitBox",void 0),e([t.hitType(!0)],exports.UI.prototype,"hitChildren",void 0),e([t.hitType(!0)],exports.UI.prototype,"hitSelf",void 0),e([t.hitType()],exports.UI.prototype,"hitRadius",void 0),e([t.cursorType("")],exports.UI.prototype,"cursor",void 0),e([t.surfaceType()],exports.UI.prototype,"fill",void 0),e([t.strokeType(void 0,!0)],exports.UI.prototype,"stroke",void 0),e([t.strokeType("inside")],exports.UI.prototype,"strokeAlign",void 0),e([t.strokeType(1,!0)],exports.UI.prototype,"strokeWidth",void 0),e([t.strokeType(!1)],exports.UI.prototype,"strokeWidthFixed",void 0),e([t.strokeType("none")],exports.UI.prototype,"strokeCap",void 0),e([t.strokeType("miter")],exports.UI.prototype,"strokeJoin",void 0),e([t.strokeType()],exports.UI.prototype,"dashPattern",void 0),e([t.strokeType(0)],exports.UI.prototype,"dashOffset",void 0),e([t.strokeType(10)],exports.UI.prototype,"miterLimit",void 0),e([t.pathType(0)],exports.UI.prototype,"cornerRadius",void 0),e([t.pathType()],exports.UI.prototype,"cornerSmoothing",void 0),e([s()],exports.UI.prototype,"shadow",void 0),e([s()],exports.UI.prototype,"innerShadow",void 0),e([s()],exports.UI.prototype,"blur",void 0),e([s()],exports.UI.prototype,"backgroundBlur",void 0),e([s()],exports.UI.prototype,"grayscale",void 0),e([s()],exports.UI.prototype,"filter",void 0),e([t.surfaceType()],exports.UI.prototype,"placeholderColor",void 0),e([t.dataType(100)],exports.UI.prototype,"placeholderDelay",void 0),e([t.dataType({})],exports.UI.prototype,"data",void 0),e([t.rewrite(t.Leaf.prototype.reset)],exports.UI.prototype,"reset",null),exports.UI=Q=e([t.useModule(H),t.useModule(J),t.rewriteAble()],exports.UI),exports.Group=class extends exports.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach(t=>this.add(t)),t.children=s}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},e([t.dataProcessor(I)],exports.Group.prototype,"__",void 0),e([t.boundsType(0)],exports.Group.prototype,"width",void 0),e([t.boundsType(0)],exports.Group.prototype,"height",void 0),exports.Group=e([t.useModule(t.Branch),t.registerUI()],exports.Group);const tt=t.Debug.get("Leafer");exports.Leafer=Z=class extends exports.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&t.Resource.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||t.getBoundsData()}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),Z.list.add(this)}init(e,s){if(this.canvas)return;let r;const{config:o}=this;this.__setLeafer(this),s&&(this.parentApp=s,this.__bindApp(s),r=s.running),e&&(this.parent=s,this.initType(e.type),this.parent=void 0,t.DataHelper.assign(o,e));const i=this.canvas=t.Creator.canvas(o);this.__controllers.push(this.renderer=t.Creator.renderer(this,i,o),this.watcher=t.Creator.watcher(this,o),this.layouter=t.Creator.layouter(this,o)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=i.view,s||(this.selector=t.Creator.selector(this),this.interaction=t.Creator.interaction(this,i,this.selector,o),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=t.Creator.hitCanvasManager()),this.canvasManager=new t.CanvasManager,r=o.start),this.hittable=o.hittable,this.fill=o.fill,this.canvasManager.add(i),this.__listenEvents(),r&&(this.__startTimer=setTimeout(this.start.bind(this))),t.WaitHelper.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(t.LeaferEvent.RESTART):this.emitLeafer(t.LeaferEvent.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(t.LeaferEvent.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(e){const s=t.DataHelper.copyAttrs({},e,t.canvasSizeAttrs);Object.keys(s).forEach(t=>this[t]=s[t])}forceRender(e,s){const{renderer:r}=this;r&&(r.addBlock(e?new t.Bounds(e):this.canvas.bounds),this.viewReady&&(s?r.render():r.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(e){const{canvas:s}=this;if(!s||s.isSameSize(e))return;const r=t.DataHelper.copyAttrs({},this.canvas,t.canvasSizeAttrs);s.resize(e),this.updateLazyBounds(),this.__onResize(new t.ResizeEvent(e,r))}__onResize(e){this.emitEvent(e),t.DataHelper.copyAttrs(this.__,e,t.canvasSizeAttrs),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:e,parentApp:s}=this;s||(e.width&&e.height||(this.autoLayout=new t.AutoBounds(e)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(e,s){return this.canvas&&(t.canvasSizeAttrs.includes(e)?this.__changeCanvasSize(e,s):"fill"===e?this.__changeFill(s):"hittable"===e?this.parent||(this.canvas.hittable=s):"zIndex"===e?(this.canvas.zIndex=s,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===e&&this.emit(t.LeaferEvent.UPDATE_MODE,{mode:s})),super.__setAttr(e,s)}__getAttr(e){return this.canvas&&t.canvasSizeAttrs.includes(e)?this.canvas[e]:super.__getAttr(e)}__changeCanvasSize(e,s){const{config:r,canvas:o}=this,i=t.DataHelper.copyAttrs({},o,t.canvasSizeAttrs);i[e]=r[e]=s,r.width&&r.height?o.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(i)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(t.LeaferEvent.BEFORE_READY),this.emitLeafer(t.LeaferEvent.READY),this.emitLeafer(t.LeaferEvent.AFTER_READY),t.WaitHelper.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(t.LeaferEvent.VIEW_READY),t.WaitHelper.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:r,height:o,pixelRatio:i}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(r=Math.max(1,a.x+a.width)),s||(o=Math.max(1,a.y+a.height)),this.__doResize({width:r,height:o,pixelRatio:i})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){t.WaitHelper.run(this.__nextRenderWait);const{imageReady:e}=this;e&&!this.viewCompleted&&this.__checkViewCompleted(),e||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(e=!0){this.nextRender(()=>{this.imageReady&&(e&&this.emitLeafer(t.LeaferEvent.VIEW_COMPLETED),t.WaitHelper.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,s){e&&(t=t.bind(e));const r=this.__nextRenderWait;if(s){for(let e=0;e<r.length;e++)if(r[e]===t){r.splice(e,1);break}}else r.push(t);this.requestRender()}zoom(e,s,r,o){return t.Plugin.need("view")}getValidMove(t,e,s){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:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(e){this.emitEvent(new t.LeaferEvent(e,this))}__listenEvents(){const e=t.Run.start("FirstCreate "+this.innerName);this.once([[t.LeaferEvent.START,()=>t.Run.end(e)],[t.LayoutEvent.START,this.updateLazyBounds,this],[t.RenderEvent.START,this.__onCreated,this],[t.RenderEvent.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[t.WatchEvent.DATA,this.__onWatchData,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(e){const s=()=>{if(!this.destroyed){Z.list.remove(this);try{this.stop(),this.emitLeafer(t.LeaferEvent.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{t.ImageManager.clearRecycled()},100)}catch(t){tt.error(t)}}};e?s():setTimeout(s)}},exports.Leafer.list=new t.LeafList,e([t.dataProcessor(k)],exports.Leafer.prototype,"__",void 0),e([t.boundsType()],exports.Leafer.prototype,"pixelRatio",void 0),e([t.dataType("normal")],exports.Leafer.prototype,"mode",void 0),exports.Leafer=Z=e([t.registerUI()],exports.Leafer),exports.Rect=class extends exports.UI{get __tag(){return"Rect"}},e([t.dataProcessor(b)],exports.Rect.prototype,"__",void 0),exports.Rect=e([t.useModule(K),t.rewriteAble(),t.registerUI()],exports.Rect);const{add:et,includes:st,scroll:rt}=t.BoundsHelper,ot=exports.Rect.prototype,it=exports.Group.prototype;exports.Box=class extends exports.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let e,s;if(this.children.length){const r=this.__,o=this.__layout,{renderBounds:i,boxBounds:a}=o,{overflow:n}=r,p=o.childrenRenderBounds||(o.childrenRenderBounds=t.getBoundsData());super.__updateRenderBounds(p),(s=n.includes("scroll"))&&(et(p,a),rt(p,r)),this.__updateRectRenderBounds(),e=!st(a,p),e&&"show"===n&&et(i,p)}else this.__updateRectRenderBounds();t.DataHelper.stintSet(this,"isOverflow",e),this.__checkScroll(s)}__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))}},e([t.dataProcessor(R)],exports.Box.prototype,"__",void 0),e([t.boundsType(100)],exports.Box.prototype,"width",void 0),e([t.boundsType(100)],exports.Box.prototype,"height",void 0),e([t.dataType(!1)],exports.Box.prototype,"resizeChildren",void 0),e([t.affectRenderBoundsType("show")],exports.Box.prototype,"overflow",void 0),e([t.rewrite(ot.__updateStrokeSpread)],exports.Box.prototype,"__updateStrokeSpread",null),e([t.rewrite(ot.__updateRenderSpread)],exports.Box.prototype,"__updateRectRenderSpread",null),e([t.rewrite(ot.__updateBoxBounds)],exports.Box.prototype,"__updateRectBoxBounds",null),e([t.rewrite(ot.__updateStrokeBounds)],exports.Box.prototype,"__updateStrokeBounds",null),e([t.rewrite(ot.__updateRenderBounds)],exports.Box.prototype,"__updateRectRenderBounds",null),e([t.rewrite(ot.__updateChange)],exports.Box.prototype,"__updateRectChange",null),e([t.rewrite(ot.__render)],exports.Box.prototype,"__renderRect",null),e([t.rewrite(it.__render)],exports.Box.prototype,"__renderGroup",null),exports.Box=e([t.rewriteAble(),t.registerUI()],exports.Box),exports.Frame=class extends exports.Box{get __tag(){return"Frame"}get isFrame(){return!0}},e([t.dataProcessor(P)],exports.Frame.prototype,"__",void 0),e([t.surfaceType("#FFFFFF")],exports.Frame.prototype,"fill",void 0),e([t.affectRenderBoundsType("hide")],exports.Frame.prototype,"overflow",void 0),exports.Frame=e([t.registerUI()],exports.Frame);const{moveTo:at,closePath:nt,ellipse:pt}=t.PathCommandDataHelper;exports.Ellipse=class extends exports.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:e,height:s,innerRadius:r,startAngle:o,endAngle:i}=this.__,a=e/2,n=s/2,p=this.__.path=[];r?(o||i?(r<1&&pt(p,a,n,a*r,n*r,0,o,i,!1),pt(p,a,n,a,n,0,i,o,!0),r<1&&nt(p)):(r<1&&(pt(p,a,n,a*r,n*r),at(p,e,n)),pt(p,a,n,a,n,0,360,0,!0)),t.Platform.ellipseToCurve&&(this.__.path=this.getPath(!0))):o||i?(at(p,a,n),pt(p,a,n,a,n,0,o,i,!1),nt(p)):pt(p,a,n,a,n)}},e([t.dataProcessor(C)],exports.Ellipse.prototype,"__",void 0),e([t.pathType(0)],exports.Ellipse.prototype,"innerRadius",void 0),e([t.pathType(0)],exports.Ellipse.prototype,"startAngle",void 0),e([t.pathType(0)],exports.Ellipse.prototype,"endAngle",void 0),exports.Ellipse=e([t.registerUI()],exports.Ellipse);const{sin:ht,cos:dt,PI:_t}=Math,{moveTo:lt,lineTo:ut,closePath:ct,drawPoints:xt}=t.PathCommandDataHelper;exports.Polygon=class extends exports.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)xt(e,t.points,t.curve,!0);else{const{width:s,height:r,sides:o}=t,i=s/2,a=r/2;lt(e,i,0);for(let t=1;t<o;t++)ut(e,i+i*ht(2*t*_t/o),a-a*dt(2*t*_t/o));ct(e)}}},e([t.dataProcessor(U)],exports.Polygon.prototype,"__",void 0),e([t.pathType(3)],exports.Polygon.prototype,"sides",void 0),e([t.pathType()],exports.Polygon.prototype,"points",void 0),e([t.pathType(0)],exports.Polygon.prototype,"curve",void 0),exports.Polygon=e([t.rewriteAble(),t.registerUI()],exports.Polygon);const{sin:yt,cos:gt,PI:vt}=Math,{moveTo:ft,lineTo:wt,closePath:Tt}=t.PathCommandDataHelper;exports.Star=class extends exports.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:s,innerRadius:r}=this.__,o=t/2,i=e/2,a=this.__.path=[];ft(a,o,0);for(let t=1;t<2*s;t++)wt(a,o+(t%2==0?o:o*r)*yt(t*vt/s),i-(t%2==0?i:i*r)*gt(t*vt/s));Tt(a)}},e([t.dataProcessor(A)],exports.Star.prototype,"__",void 0),e([t.pathType(5)],exports.Star.prototype,"corners",void 0),e([t.pathType(.382)],exports.Star.prototype,"innerRadius",void 0),exports.Star=e([t.registerUI()],exports.Star);const{moveTo:St,lineTo:mt,drawPoints:It}=t.PathCommandDataHelper,{rotate:Rt,getAngle:kt,getDistance:Pt,defaultPoint:Bt}=t.PointHelper;exports.Line=class extends exports.UI{get __tag(){return"Line"}get toPoint(){const{width:e,rotation:s}=this.__,r=t.getPointData();return e&&(r.x=e),s&&Rt(r,s),r}set toPoint(t){this.width=Pt(Bt,t),this.rotation=kt(Bt,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?It(e,t.points,t.curve,t.closed):(St(e,0,0),mt(e,this.width,0))}},e([t.dataProcessor(B)],exports.Line.prototype,"__",void 0),e([t.affectStrokeBoundsType("center")],exports.Line.prototype,"strokeAlign",void 0),e([t.boundsType(0)],exports.Line.prototype,"height",void 0),e([t.pathType()],exports.Line.prototype,"points",void 0),e([t.pathType(0)],exports.Line.prototype,"curve",void 0),e([t.pathType(!1)],exports.Line.prototype,"closed",void 0),exports.Line=e([t.registerUI()],exports.Line),exports.Image=class extends exports.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:e}=this.__;return t.isArray(e)&&e[0].image}},e([t.dataProcessor(W)],exports.Image.prototype,"__",void 0),e([t.boundsType("")],exports.Image.prototype,"url",void 0),exports.Image=e([t.registerUI()],exports.Image);const bt=exports.Image;exports.Canvas=class extends exports.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(e){super(e),this.canvas=t.Creator.canvas(this.__),e&&e.url&&this.drawImage(e.url)}drawImage(e){new t.LeaferImage({url:e}).load(e=>{this.context.drawImage(e.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new t.ImageEvent(t.ImageEvent.LOADED,{image:e}))})}draw(e,s,r,o){const i=new t.Matrix(e.worldTransform).invert(),a=new t.Matrix;s&&a.translate(s.x,s.y),r&&(t.isNumber(r)?a.scale(r):a.scale(r.x,r.y)),o&&a.rotate(o),i.multiplyParent(a),e.__render(this.canvas,{matrix:i.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:r}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,s,r)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},e([t.dataProcessor(z)],exports.Canvas.prototype,"__",void 0),e([r(100)],exports.Canvas.prototype,"width",void 0),e([r(100)],exports.Canvas.prototype,"height",void 0),e([r(1)],exports.Canvas.prototype,"pixelRatio",void 0),e([r(!0)],exports.Canvas.prototype,"smooth",void 0),e([t.dataType(!1)],exports.Canvas.prototype,"safeResize",void 0),e([r()],exports.Canvas.prototype,"contextSettings",void 0),exports.Canvas=e([t.registerUI()],exports.Canvas);const{copyAndSpread:Ct,includes:Ut,spread:At,setList:Dt}=t.BoundsHelper;exports.Text=class extends exports.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const e=this.__,{lineHeight:s,letterSpacing:r,fontFamily:o,fontSize:a,fontWeight:p,italic:h,textCase:d,textOverflow:_,padding:l}=e;e.__lineHeight=n.number(s,a),e.__letterSpacing=n.number(r,a),e.__padding=l?t.MathHelper.fourNumber(l):void 0,e.__baseLine=e.__lineHeight-(e.__lineHeight-.7*a)/2,e.__font=`${h?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==p?p+" ":""}${a||12}px ${o||"caption"}`,e.__clipText="show"!==_&&!e.__autoSize,e.__textDrawData=i.getDrawData((e.__isPlacehold=e.placeholder&&""===e.text)?e.placeholder:e.text,this.__)}__updateBoxBounds(){const e=this.__,s=this.__layout,{fontSize:r,italic:o,padding:i,__autoWidth:a,__autoHeight:n}=e;this.__updateTextDrawData();const{bounds:p}=e.__textDrawData,h=s.boxBounds;if(s.contentBounds=p,e.__lineHeight<r&&At(p,r/2),a||n){if(h.x=a?p.x:0,h.y=n?p.y:0,h.width=a?p.width:e.width,h.height=n?p.height:e.height,i){const[t,s,r,o]=e.__padding;a&&(h.x-=o,h.width+=s+o),n&&(h.y-=t,h.height+=r+t)}this.__updateNaturalSize()}else super.__updateBoxBounds();o&&(h.width+=.16*r),t.DataHelper.stintSet(this,"isOverflow",!Ut(h,p)),this.isOverflow?(Dt(e.__textBoxBounds={},[h,p]),s.renderChanged=!0):e.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Ct(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,s){const r=this.__box;r&&(r.__nowWorld=this.__nowWorld,r.__draw(t,e,s)),this.textEditing&&!e.exporting||super.__draw(t,e,s)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},e([t.dataProcessor(F)],exports.Text.prototype,"__",void 0),e([t.boundsType(0)],exports.Text.prototype,"width",void 0),e([t.boundsType(0)],exports.Text.prototype,"height",void 0),e([t.surfaceType()],exports.Text.prototype,"boxStyle",void 0),e([t.dataType(!1)],exports.Text.prototype,"resizeFontSize",void 0),e([t.surfaceType("#000000")],exports.Text.prototype,"fill",void 0),e([t.affectStrokeBoundsType("outside")],exports.Text.prototype,"strokeAlign",void 0),e([t.hitType("all")],exports.Text.prototype,"hitFill",void 0),e([t.boundsType("")],exports.Text.prototype,"text",void 0),e([t.boundsType("")],exports.Text.prototype,"placeholder",void 0),e([t.boundsType("caption")],exports.Text.prototype,"fontFamily",void 0),e([t.boundsType(12)],exports.Text.prototype,"fontSize",void 0),e([t.boundsType("normal")],exports.Text.prototype,"fontWeight",void 0),e([t.boundsType(!1)],exports.Text.prototype,"italic",void 0),e([t.boundsType("none")],exports.Text.prototype,"textCase",void 0),e([t.boundsType("none")],exports.Text.prototype,"textDecoration",void 0),e([t.boundsType(0)],exports.Text.prototype,"letterSpacing",void 0),e([t.boundsType({type:"percent",value:1.5})],exports.Text.prototype,"lineHeight",void 0),e([t.boundsType(0)],exports.Text.prototype,"paraIndent",void 0),e([t.boundsType(0)],exports.Text.prototype,"paraSpacing",void 0),e([t.boundsType("x")],exports.Text.prototype,"writingMode",void 0),e([t.boundsType("left")],exports.Text.prototype,"textAlign",void 0),e([t.boundsType("top")],exports.Text.prototype,"verticalAlign",void 0),e([t.boundsType(!0)],exports.Text.prototype,"autoSizeAlign",void 0),e([t.boundsType("normal")],exports.Text.prototype,"textWrap",void 0),e([t.boundsType("show")],exports.Text.prototype,"textOverflow",void 0),e([t.surfaceType(!1)],exports.Text.prototype,"textEditing",void 0),exports.Text=e([t.registerUI()],exports.Text),exports.Path=class extends exports.UI{get __tag(){return"Path"}},e([t.dataProcessor(D)],exports.Path.prototype,"__",void 0),e([t.affectStrokeBoundsType("center")],exports.Path.prototype,"strokeAlign",void 0),exports.Path=e([t.registerUI()],exports.Path),exports.Pen=class extends exports.Group{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new exports.Path(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,s,r,o,i){return this}quadraticCurveTo(t,e,s,r){return this}closePath(){return this}rect(t,e,s,r){return this}roundRect(t,e,s,r,o){return this}ellipse(t,e,s,r,o,i,a,n){return this}arc(t,e,s,r,o,i){return this}arcTo(t,e,s,r,o){return this}drawEllipse(t,e,s,r,o,i,a,n){return this}drawArc(t,e,s,r,o,i){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},e([t.dataProcessor(L)],exports.Pen.prototype,"__",void 0),e([(e,s)=>{t.defineKey(e,s,{get(){return this.__path}})}],exports.Pen.prototype,"path",void 0),exports.Pen=e([t.useModule(t.PathCreator,["set","path","paint"]),t.registerUI()],exports.Pen),exports.BoxData=R,exports.CanvasData=z,exports.ColorConvert=a,exports.DragBoundsHelper=Y,exports.Effect=_,exports.EllipseData=C,exports.Export=u,exports.Filter=l,exports.FrameData=P,exports.GroupData=I,exports.ImageData=W,exports.LeaferData=k,exports.LineData=B,exports.MyImage=bt,exports.Paint=h,exports.PaintGradient={},exports.PaintImage=d,exports.PathArrow=p,exports.PathData=D,exports.PenData=L,exports.PolygonData=U,exports.RectData=b,exports.RectRender=K,exports.StarData=A,exports.State=c,exports.TextConvert=i,exports.TextData=F,exports.Transition=x,exports.UIBounds=H,exports.UIData=S,exports.UIRender=J,exports.UnitConvert=n,exports.createAttr=function(e){return(s,r)=>{t.defineKey(s,r,t.createDescriptor(r,e))}},exports.effectType=s,exports.resizeType=r,exports.zoomLayerType=o,Object.keys(t).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});
//# sourceMappingURL=draw.min.cjs.map
{
"name": "@leafer-ui/draw",
"version": "1.9.7",
"version": "1.9.8",
"description": "@leafer-ui/draw",

@@ -32,8 +32,8 @@ "author": "Chao (Leafer) Wan",

"dependencies": {
"@leafer/core": "1.9.7",
"@leafer-ui/display": "1.9.7",
"@leafer-ui/display-module": "1.9.7",
"@leafer-ui/decorator": "1.9.7",
"@leafer-ui/external": "1.9.7"
"@leafer/core": "1.9.8",
"@leafer-ui/display": "1.9.8",
"@leafer-ui/display-module": "1.9.8",
"@leafer-ui/decorator": "1.9.8",
"@leafer-ui/external": "1.9.8"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display