@leafer-ui/draw 1.9.6 → 1.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/draw.cjs CHANGED
@@ -412,39 +412,41 @@ class CanvasData extends RectData {
412
412
  }
413
413
  }
414
414
 
415
+ const {max: max, add: add$1} = core.FourNumberHelper;
416
+
415
417
  const UIBounds = {
416
418
  __updateStrokeSpread() {
417
- let width = 0, boxWidth = 0;
419
+ let spread = 0, boxSpread = 0;
418
420
  const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
419
421
  if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
420
- boxWidth = width = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
422
+ boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
421
423
  if (!data.__boxStroke) {
422
- const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width;
424
+ const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
423
425
  const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
424
- width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
426
+ spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
425
427
  }
426
428
  }
427
- if (data.__useArrow) width += strokeWidth * 5;
429
+ if (data.__useArrow) spread += strokeWidth * 5;
428
430
  if (box) {
429
- width = Math.max(box.__layout.strokeSpread = box.__updateStrokeSpread(), width);
430
- boxWidth = box.__layout.strokeBoxSpread;
431
+ spread = max(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
432
+ boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
431
433
  }
432
- this.__layout.strokeBoxSpread = boxWidth;
433
- return width;
434
+ this.__layout.strokeBoxSpread = boxSpread;
435
+ return spread;
434
436
  },
435
437
  __updateRenderSpread() {
436
- let width = 0;
437
- const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
438
- if (shadow) width = Effect.getShadowSpread(this, shadow);
439
- if (blur) width = Math.max(width, blur);
440
- if (filter) width += Filter.getSpread(filter);
441
- if (renderSpread) width += renderSpread;
442
- let shapeWidth = width = Math.ceil(width);
443
- if (innerShadow) innerShadow.forEach(item => shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5));
444
- if (backgroundBlur) shapeWidth = Math.max(shapeWidth, backgroundBlur);
445
- this.__layout.renderShapeSpread = shapeWidth;
446
- width += this.__layout.strokeSpread || 0;
447
- return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
438
+ let spread = 0;
439
+ const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
440
+ if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
441
+ if (blur) spread = max(spread, blur);
442
+ if (filter) spread = add$1(spread, Filter.getSpread(filter));
443
+ if (renderSpread) spread = add$1(spread, renderSpread);
444
+ if (strokeSpread) spread = add$1(spread, strokeSpread);
445
+ let shapeSpread = spread;
446
+ if (innerShadow) shapeSpread = max(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
447
+ if (backgroundBlur) shapeSpread = max(shapeSpread, backgroundBlur);
448
+ this.__layout.renderShapeSpread = shapeSpread;
449
+ return box ? max(box.__updateRenderSpread(), spread) : spread;
448
450
  }
449
451
  };
450
452
 
@@ -788,9 +790,9 @@ __decorate([ core.visibleType(true) ], exports.UI.prototype, "visible", void 0);
788
790
 
789
791
  __decorate([ core.surfaceType(false) ], exports.UI.prototype, "locked", void 0);
790
792
 
791
- __decorate([ core.surfaceType(false) ], exports.UI.prototype, "dim", void 0);
793
+ __decorate([ core.dimType(false) ], exports.UI.prototype, "dim", void 0);
792
794
 
793
- __decorate([ core.surfaceType(false) ], exports.UI.prototype, "dimskip", void 0);
795
+ __decorate([ core.dimType(false) ], exports.UI.prototype, "dimskip", void 0);
794
796
 
795
797
  __decorate([ core.sortType(0) ], exports.UI.prototype, "zIndex", void 0);
796
798
 
@@ -1802,9 +1804,9 @@ exports.Text = class Text extends exports.UI {
1802
1804
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
1803
1805
  }
1804
1806
  __updateRenderSpread() {
1805
- let width = super.__updateRenderSpread();
1806
- if (!width) width = this.isOverflow ? 1 : 0;
1807
- return width;
1807
+ let spread = super.__updateRenderSpread();
1808
+ if (!spread) spread = this.isOverflow ? 1 : 0;
1809
+ return spread;
1808
1810
  }
1809
1811
  __updateRenderBounds() {
1810
1812
  const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
package/lib/draw.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineKey, decorateLeafAttr, attr, createDescriptor, Plugin, isObject, PathConvert, DataHelper, Debug, LeafData, isString, isUndefined, isArray, canvasSizeAttrs, UICreator, MathHelper, Bounds, dataProcessor, dataType, surfaceType, opacityType, visibleType, sortType, maskType, eraserType, positionType, boundsType, scaleType, rotationType, scrollType, autoLayoutType, naturalBoundsType, affectRenderBoundsType, pathInputType, pathType, hitType, strokeType, cursorType, rewrite, Leaf, useModule, rewriteAble, pen, PathCorner, PathDrawer, isNumber, registerUI, Branch, LeafList, Resource, getBoundsData, Creator, CanvasManager, WaitHelper, LeaferEvent, ResizeEvent, AutoBounds, Run, LayoutEvent, RenderEvent, WatchEvent, ImageManager, BoundsHelper, PathCommandDataHelper, Platform, PointHelper, affectStrokeBoundsType, getPointData, LeaferImage, ImageEvent, Matrix, PathCreator } from "@leafer/core";
1
+ import { defineKey, decorateLeafAttr, attr, createDescriptor, Plugin, isObject, PathConvert, DataHelper, Debug, LeafData, isString, isUndefined, isArray, canvasSizeAttrs, UICreator, FourNumberHelper, MathHelper, Bounds, dataProcessor, dataType, surfaceType, opacityType, visibleType, dimType, sortType, maskType, eraserType, positionType, boundsType, scaleType, rotationType, scrollType, autoLayoutType, naturalBoundsType, affectRenderBoundsType, pathInputType, pathType, hitType, strokeType, cursorType, rewrite, Leaf, useModule, rewriteAble, pen, PathCorner, PathDrawer, isNumber, registerUI, Branch, LeafList, Resource, getBoundsData, Creator, CanvasManager, WaitHelper, LeaferEvent, ResizeEvent, AutoBounds, Run, LayoutEvent, RenderEvent, WatchEvent, ImageManager, BoundsHelper, PathCommandDataHelper, Platform, PointHelper, affectStrokeBoundsType, getPointData, LeaferImage, ImageEvent, Matrix, PathCreator } from "@leafer/core";
2
2
 
3
3
  export * from "@leafer/core";
4
4
 
@@ -412,39 +412,41 @@ class CanvasData extends RectData {
412
412
  }
413
413
  }
414
414
 
415
+ const {max: max, add: add$1} = FourNumberHelper;
416
+
415
417
  const UIBounds = {
416
418
  __updateStrokeSpread() {
417
- let width = 0, boxWidth = 0;
419
+ let spread = 0, boxSpread = 0;
418
420
  const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
419
421
  if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
420
- boxWidth = width = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
422
+ boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
421
423
  if (!data.__boxStroke) {
422
- const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width;
424
+ const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
423
425
  const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
424
- width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
426
+ spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
425
427
  }
426
428
  }
427
- if (data.__useArrow) width += strokeWidth * 5;
429
+ if (data.__useArrow) spread += strokeWidth * 5;
428
430
  if (box) {
429
- width = Math.max(box.__layout.strokeSpread = box.__updateStrokeSpread(), width);
430
- boxWidth = box.__layout.strokeBoxSpread;
431
+ spread = max(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
432
+ boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
431
433
  }
432
- this.__layout.strokeBoxSpread = boxWidth;
433
- return width;
434
+ this.__layout.strokeBoxSpread = boxSpread;
435
+ return spread;
434
436
  },
435
437
  __updateRenderSpread() {
436
- let width = 0;
437
- const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
438
- if (shadow) width = Effect.getShadowSpread(this, shadow);
439
- if (blur) width = Math.max(width, blur);
440
- if (filter) width += Filter.getSpread(filter);
441
- if (renderSpread) width += renderSpread;
442
- let shapeWidth = width = Math.ceil(width);
443
- if (innerShadow) innerShadow.forEach(item => shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5));
444
- if (backgroundBlur) shapeWidth = Math.max(shapeWidth, backgroundBlur);
445
- this.__layout.renderShapeSpread = shapeWidth;
446
- width += this.__layout.strokeSpread || 0;
447
- return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
438
+ let spread = 0;
439
+ const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
440
+ if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
441
+ if (blur) spread = max(spread, blur);
442
+ if (filter) spread = add$1(spread, Filter.getSpread(filter));
443
+ if (renderSpread) spread = add$1(spread, renderSpread);
444
+ if (strokeSpread) spread = add$1(spread, strokeSpread);
445
+ let shapeSpread = spread;
446
+ if (innerShadow) shapeSpread = max(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
447
+ if (backgroundBlur) shapeSpread = max(shapeSpread, backgroundBlur);
448
+ this.__layout.renderShapeSpread = shapeSpread;
449
+ return box ? max(box.__updateRenderSpread(), spread) : spread;
448
450
  }
449
451
  };
450
452
 
@@ -788,9 +790,9 @@ __decorate([ visibleType(true) ], UI.prototype, "visible", void 0);
788
790
 
789
791
  __decorate([ surfaceType(false) ], UI.prototype, "locked", void 0);
790
792
 
791
- __decorate([ surfaceType(false) ], UI.prototype, "dim", void 0);
793
+ __decorate([ dimType(false) ], UI.prototype, "dim", void 0);
792
794
 
793
- __decorate([ surfaceType(false) ], UI.prototype, "dimskip", void 0);
795
+ __decorate([ dimType(false) ], UI.prototype, "dimskip", void 0);
794
796
 
795
797
  __decorate([ sortType(0) ], UI.prototype, "zIndex", void 0);
796
798
 
@@ -1802,9 +1804,9 @@ let Text = class Text extends UI {
1802
1804
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
1803
1805
  }
1804
1806
  __updateRenderSpread() {
1805
- let width = super.__updateRenderSpread();
1806
- if (!width) width = this.isOverflow ? 1 : 0;
1807
- return width;
1807
+ let spread = super.__updateRenderSpread();
1808
+ if (!spread) spread = this.isOverflow ? 1 : 0;
1809
+ return spread;
1808
1810
  }
1809
1811
  __updateRenderBounds() {
1810
1812
  const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
@@ -1,2 +1,2 @@
1
- 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,sortType as m,maskType as R,eraserType as k,positionType as B,boundsType as b,scaleType as A,rotationType as C,scrollType as P,autoLayoutType as F,naturalBoundsType as W,affectRenderBoundsType as I,pathInputType as T,pathType as D,hitType as E,strokeType as L,cursorType as M,rewrite as z,Leaf as O,useModule as N,rewriteAble as V,pen as H,PathCorner as Y,PathDrawer as U,isNumber as j,registerUI as X,Branch as J,LeafList as q,Resource as G,getBoundsData as $,Creator as K,CanvasManager as Q,WaitHelper as Z,LeaferEvent as tt,ResizeEvent as et,AutoBounds as it,Run as st,LayoutEvent as ot,RenderEvent as rt,WatchEvent as at,ImageManager as nt,BoundsHelper as ht,PathCommandDataHelper as _t,Platform as dt,PointHelper as lt,affectStrokeBoundsType as pt,getPointData as ut,LeaferImage as ct,ImageEvent as gt,Matrix as yt,PathCreator as vt}from"@leafer/core";export*from"@leafer/core";function ft(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 wt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function xt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function St(){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 mt(e){return(i,o)=>{t(i,o,s(o,e))}}"function"==typeof SuppressedError&&SuppressedError;const Rt={},kt={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},bt={},At={},Ct={},Pt={},Ft={},Wt={apply(){o.need("filter")}},It={},Tt={setStyleName:()=>o.need("state"),set:()=>o.need("state")},Dt={list:{},register(t,e){Dt.list[t]=e},get:t=>Dt.list[t]},{parse:Et,objectToCanvasData:Lt}=a,{stintSet:Mt}=n,{hasTransparent:zt}=kt,Ot={},Nt=h.get("UIData");class Vt 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,Nt.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Nt.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),d(t)||!t?(Mt(this,"__isTransparentFill",zt(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):r(t)&&this.__setPaint("fill",t)}setStroke(t){d(t)||!t?(Mt(this,"__isTransparentStroke",zt(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?Et(t):Lt(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Ht(this,"shadow",t)}setInnerShadow(t){Ht(this,"innerShadow",t)}setFilter(t){Ht(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&At.compute("fill",this.__leaf),e&&At.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=Ot)):(this.__isStrokes=!0,this._stroke||(this._stroke=Ot))}__removePaint(t,e){e&&this.__removeInput(t),Ct.recycleImage(t,this),"fill"===t?(Mt(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Mt(this,"__isAlphaPixelStroke",void 0),Mt(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Ht(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 Yt extends Vt{}class Ut extends Yt{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 Yt{__getInputData(t,e){const i=super.__getInputData(t,e);return u.forEach(t=>delete i[t]),i}}class Xt extends Ut{}class Jt extends Vt{get __usePathBox(){return this.points||this.__pathInputed}}class qt extends Vt{get __boxStroke(){return!this.__pathInputed}}class Gt extends Vt{get __boxStroke(){return!this.__pathInputed}}class $t extends Jt{}class Kt extends Vt{}class Qt extends Vt{get __pathInputed(){return 2}}class Zt extends Yt{}const te={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ee extends Vt{get __useNaturalRatio(){return!1}setFontWeight(t){d(t)?(this.__setInput("fontWeight",t),t=te[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 ie extends qt{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 se extends qt{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 oe={__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=Ft.getShadowSpread(this,e)),s&&(t=Math.max(t,s)),r&&(t+=Wt.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:re}=g,ae=new y,ne=new y,he=new y,_e={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&de.getValidMove(t.__localBoxBounds,de.getDragBounds(t),s,e,!0),de.axisMove(t,e)},limitScaleOf(t,e,i){const{dragBounds:s,dragBoundsType:o}=t;s&&de.getValidScaleOf(t.__localBoxBounds,de.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)),de.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),de.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=re(s.x),s.y=re(s.y),s},getValidScaleOf(t,e,i,s,o,r){let a,n;return r||(o=Object.assign({},o)),ae.set(t).scaleOf(s,o.x,o.y).unsign(),ne.set(ae).add(e),he.set(ae).intersect(e),a=de.isInnerMode(t,e,i,"width")?ne.width/ae.width:he.width/ae.width,n=de.isInnerMode(t,e,i,"height")?ne.height/ae.height:he.height/ae.height,o.x=re(he.width)?o.x*a:1,o.y=re(he.height)?o.y*n:1,o}},de=_e,{stintSet:le}=n,pe={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);le(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),le(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;le(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!Ft.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(p(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),le(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){ue(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=At.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:_,innerShadow:d,filter:l}=s;_&&Ft.shadow(this,t,h),n&&(s.__isStrokes?At.strokes(r,this,t):At.stroke(r,this,t)),o&&(s.__isFills?At.fills(o,this,t):At.fill(o,this,t)),a&&this.__drawAfterFill(t,e),d&&Ft.innerShadow(this,t,h),r&&!n&&(s.__isStrokes?At.strokes(r,this,t):At.stroke(r,this,t)),l&&Wt.apply(l,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(n&&(s.__isStrokes?At.strokes(r,this,t):At.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,kt.string(e.color))}o&&(s.__isFills?At.fills(o,this,t):At.fill(o,this,t)),h&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?At.strokes(r,this,t):At.stroke(r,this,t))}}else s.__pathInputed?ue(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?At.fills(s,this,t):At.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?At.strokes(o,this,t):At.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 ue(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&At.stroke(o,t,e),s&&At.fill(s,t,e),r&&t.__drawAfterFill(e,i),o&&!a&&At.stroke(o,t,e)}const ce={__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 ge;let ye=ge=class extends O{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 H.set(this.path=t||[]),t||this.__drawPathByBox(H),H}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||(H.set(i=[]),this.__drawPathByBox(H)),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||It.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Y.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&bt.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?U.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){At.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),ge.one(e)}static one(t,e,i,s,o){return c.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){X()(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()}};ft([v(Vt)],ye.prototype,"__",void 0),ft([St()],ye.prototype,"zoomLayer",void 0),ft([f("")],ye.prototype,"id",void 0),ft([f("")],ye.prototype,"name",void 0),ft([f("")],ye.prototype,"className",void 0),ft([w("pass-through")],ye.prototype,"blendMode",void 0),ft([x(1)],ye.prototype,"opacity",void 0),ft([S(!0)],ye.prototype,"visible",void 0),ft([w(!1)],ye.prototype,"locked",void 0),ft([w(!1)],ye.prototype,"dim",void 0),ft([w(!1)],ye.prototype,"dimskip",void 0),ft([m(0)],ye.prototype,"zIndex",void 0),ft([R(!1)],ye.prototype,"mask",void 0),ft([k(!1)],ye.prototype,"eraser",void 0),ft([B(0,!0)],ye.prototype,"x",void 0),ft([B(0,!0)],ye.prototype,"y",void 0),ft([b(100,!0)],ye.prototype,"width",void 0),ft([b(100,!0)],ye.prototype,"height",void 0),ft([A(1,!0)],ye.prototype,"scaleX",void 0),ft([A(1,!0)],ye.prototype,"scaleY",void 0),ft([C(0,!0)],ye.prototype,"rotation",void 0),ft([C(0,!0)],ye.prototype,"skewX",void 0),ft([C(0,!0)],ye.prototype,"skewY",void 0),ft([B(0,!0)],ye.prototype,"offsetX",void 0),ft([B(0,!0)],ye.prototype,"offsetY",void 0),ft([P(0,!0)],ye.prototype,"scrollX",void 0),ft([P(0,!0)],ye.prototype,"scrollY",void 0),ft([F()],ye.prototype,"origin",void 0),ft([F()],ye.prototype,"around",void 0),ft([f(!1)],ye.prototype,"lazy",void 0),ft([W(1)],ye.prototype,"pixelRatio",void 0),ft([I(0)],ye.prototype,"renderSpread",void 0),ft([T()],ye.prototype,"path",void 0),ft([D()],ye.prototype,"windingRule",void 0),ft([D(!0)],ye.prototype,"closed",void 0),ft([b(0)],ye.prototype,"padding",void 0),ft([b(!1)],ye.prototype,"lockRatio",void 0),ft([b()],ye.prototype,"widthRange",void 0),ft([b()],ye.prototype,"heightRange",void 0),ft([f(!1)],ye.prototype,"draggable",void 0),ft([f()],ye.prototype,"dragBounds",void 0),ft([f("auto")],ye.prototype,"dragBoundsType",void 0),ft([f(!1)],ye.prototype,"editable",void 0),ft([E(!0)],ye.prototype,"hittable",void 0),ft([E("path")],ye.prototype,"hitFill",void 0),ft([L("path")],ye.prototype,"hitStroke",void 0),ft([E(!1)],ye.prototype,"hitBox",void 0),ft([E(!0)],ye.prototype,"hitChildren",void 0),ft([E(!0)],ye.prototype,"hitSelf",void 0),ft([E()],ye.prototype,"hitRadius",void 0),ft([M("")],ye.prototype,"cursor",void 0),ft([w()],ye.prototype,"fill",void 0),ft([L(void 0,!0)],ye.prototype,"stroke",void 0),ft([L("inside")],ye.prototype,"strokeAlign",void 0),ft([L(1,!0)],ye.prototype,"strokeWidth",void 0),ft([L(!1)],ye.prototype,"strokeWidthFixed",void 0),ft([L("none")],ye.prototype,"strokeCap",void 0),ft([L("miter")],ye.prototype,"strokeJoin",void 0),ft([L()],ye.prototype,"dashPattern",void 0),ft([L(0)],ye.prototype,"dashOffset",void 0),ft([L(10)],ye.prototype,"miterLimit",void 0),ft([D(0)],ye.prototype,"cornerRadius",void 0),ft([D()],ye.prototype,"cornerSmoothing",void 0),ft([wt()],ye.prototype,"shadow",void 0),ft([wt()],ye.prototype,"innerShadow",void 0),ft([wt()],ye.prototype,"blur",void 0),ft([wt()],ye.prototype,"backgroundBlur",void 0),ft([wt()],ye.prototype,"grayscale",void 0),ft([wt()],ye.prototype,"filter",void 0),ft([w()],ye.prototype,"placeholderColor",void 0),ft([f(100)],ye.prototype,"placeholderDelay",void 0),ft([f({})],ye.prototype,"data",void 0),ft([z(O.prototype.reset)],ye.prototype,"reset",null),ye=ge=ft([N(oe),N(pe),V()],ye);let ve=class extends ye{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 fe;ft([v(Yt)],ve.prototype,"__",void 0),ft([b(0)],ve.prototype,"width",void 0),ft([b(0)],ve.prototype,"height",void 0),ve=ft([N(J),X()],ve);const we=h.get("Leafer");let xe=fe=class extends ve{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&G.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)||$()}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),fe.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=K.canvas(s);this.__controllers.push(this.renderer=K.renderer(this,o,s),this.watcher=K.watcher(this,s),this.layouter=K.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=o.view,e||(this.selector=K.selector(this),this.interaction=K.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=K.hitCanvasManager()),this.canvasManager=new Q,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))),Z.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(tt.RESTART):this.emitLeafer(tt.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(tt.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 et(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 it(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(tt.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(tt.BEFORE_READY),this.emitLeafer(tt.READY),this.emitLeafer(tt.AFTER_READY),Z.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(tt.VIEW_READY),Z.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){Z.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(tt.VIEW_COMPLETED),Z.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 tt(t,this))}__listenEvents(){const t=st.start("FirstCreate "+this.innerName);this.once([[tt.START,()=>st.end(t)],[ot.START,this.updateLazyBounds,this],[rt.START,this.__onCreated,this],[rt.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[at.DATA,this.__onWatchData,this],[ot.END,this.__onLayoutEnd,this],[rt.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){fe.list.remove(this);try{this.stop(),this.emitLeafer(tt.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(()=>{nt.clearRecycled()},100)}catch(t){we.error(t)}}};t?e():setTimeout(e)}};xe.list=new q,ft([v(jt)],xe.prototype,"__",void 0),ft([b()],xe.prototype,"pixelRatio",void 0),ft([f("normal")],xe.prototype,"mode",void 0),xe=fe=ft([X()],xe);let Se=class extends ye{get __tag(){return"Rect"}};ft([v(qt)],Se.prototype,"__",void 0),Se=ft([N(ce),V(),X()],Se);const{add:me,includes:Re,scroll:ke}=ht,Be=Se.prototype,be=ve.prototype;let Ae=class extends ve{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=$());super.__updateRenderBounds(n),(e=a.includes("scroll"))&&(me(n,r),ke(n,i)),this.__updateRectRenderBounds(),t=!Re(r,n),t&&"show"===a&&me(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))}};ft([v(Ut)],Ae.prototype,"__",void 0),ft([b(100)],Ae.prototype,"width",void 0),ft([b(100)],Ae.prototype,"height",void 0),ft([f(!1)],Ae.prototype,"resizeChildren",void 0),ft([I("show")],Ae.prototype,"overflow",void 0),ft([z(Be.__updateStrokeSpread)],Ae.prototype,"__updateStrokeSpread",null),ft([z(Be.__updateRenderSpread)],Ae.prototype,"__updateRectRenderSpread",null),ft([z(Be.__updateBoxBounds)],Ae.prototype,"__updateRectBoxBounds",null),ft([z(Be.__updateStrokeBounds)],Ae.prototype,"__updateStrokeBounds",null),ft([z(Be.__updateRenderBounds)],Ae.prototype,"__updateRectRenderBounds",null),ft([z(Be.__updateChange)],Ae.prototype,"__updateRectChange",null),ft([z(Be.__render)],Ae.prototype,"__renderRect",null),ft([z(be.__render)],Ae.prototype,"__renderGroup",null),Ae=ft([V(),X()],Ae);let Ce=class extends Ae{get __tag(){return"Frame"}get isFrame(){return!0}};ft([v(Xt)],Ce.prototype,"__",void 0),ft([w("#FFFFFF")],Ce.prototype,"fill",void 0),ft([I("hide")],Ce.prototype,"overflow",void 0),Ce=ft([X()],Ce);const{moveTo:Pe,closePath:Fe,ellipse:We}=_t;let Ie=class extends ye{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&&We(n,r,a,r*i,a*i,0,s,o,!1),We(n,r,a,r,a,0,o,s,!0),i<1&&Fe(n)):(i<1&&(We(n,r,a,r*i,a*i),Pe(n,t,a)),We(n,r,a,r,a,0,360,0,!0)),dt.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(Pe(n,r,a),We(n,r,a,r,a,0,s,o,!1),Fe(n)):We(n,r,a,r,a)}};ft([v(Gt)],Ie.prototype,"__",void 0),ft([D(0)],Ie.prototype,"innerRadius",void 0),ft([D(0)],Ie.prototype,"startAngle",void 0),ft([D(0)],Ie.prototype,"endAngle",void 0),Ie=ft([X()],Ie);const{sin:Te,cos:De,PI:Ee}=Math,{moveTo:Le,lineTo:Me,closePath:ze,drawPoints:Oe}=_t;let Ne=class extends ye{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Oe(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:o}=t,r=i/2,a=s/2;Le(e,r,0);for(let t=1;t<o;t++)Me(e,r+r*Te(2*t*Ee/o),a-a*De(2*t*Ee/o));ze(e)}}};ft([v($t)],Ne.prototype,"__",void 0),ft([D(3)],Ne.prototype,"sides",void 0),ft([D()],Ne.prototype,"points",void 0),ft([D(0)],Ne.prototype,"curve",void 0),Ne=ft([V(),X()],Ne);const{sin:Ve,cos:He,PI:Ye}=Math,{moveTo:Ue,lineTo:je,closePath:Xe}=_t;let Je=class extends ye{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,r=e/2,a=this.__.path=[];Ue(a,o,0);for(let t=1;t<2*i;t++)je(a,o+(t%2==0?o:o*s)*Ve(t*Ye/i),r-(t%2==0?r:r*s)*He(t*Ye/i));Xe(a)}};ft([v(Kt)],Je.prototype,"__",void 0),ft([D(5)],Je.prototype,"corners",void 0),ft([D(.382)],Je.prototype,"innerRadius",void 0),Je=ft([X()],Je);const{moveTo:qe,lineTo:Ge,drawPoints:$e}=_t,{rotate:Ke,getAngle:Qe,getDistance:Ze,defaultPoint:ti}=lt;let ei=class extends ye{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=ut();return t&&(i.x=t),e&&Ke(i,e),i}set toPoint(t){this.width=Ze(ti,t),this.rotation=Qe(ti,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?$e(e,t.points,t.curve,t.closed):(qe(e,0,0),Ge(e,this.width,0))}};ft([v(Jt)],ei.prototype,"__",void 0),ft([pt("center")],ei.prototype,"strokeAlign",void 0),ft([b(0)],ei.prototype,"height",void 0),ft([D()],ei.prototype,"points",void 0),ft([D(0)],ei.prototype,"curve",void 0),ft([D(!1)],ei.prototype,"closed",void 0),ei=ft([X()],ei);let ii=class extends Se{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}};ft([v(ie)],ii.prototype,"__",void 0),ft([b("")],ii.prototype,"url",void 0),ii=ft([X()],ii);const si=ii;let oi=class extends Se{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=K.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new ct({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new gt(gt.LOADED,{image:t}))})}draw(t,e,i,s){const o=new yt(t.worldTransform).invert(),r=new yt;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()}};ft([v(se)],oi.prototype,"__",void 0),ft([xt(100)],oi.prototype,"width",void 0),ft([xt(100)],oi.prototype,"height",void 0),ft([xt(1)],oi.prototype,"pixelRatio",void 0),ft([xt(!0)],oi.prototype,"smooth",void 0),ft([f(!1)],oi.prototype,"safeResize",void 0),ft([xt()],oi.prototype,"contextSettings",void 0),oi=ft([X()],oi);const{copyAndSpread:ri,includes:ai,spread:ni,setList:hi}=ht;let _i=class extends ye{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=Rt.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&&ni(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",!ai(_,h)),this.isOverflow?(hi(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;ri(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()}};ft([v(ee)],_i.prototype,"__",void 0),ft([b(0)],_i.prototype,"width",void 0),ft([b(0)],_i.prototype,"height",void 0),ft([w()],_i.prototype,"boxStyle",void 0),ft([f(!1)],_i.prototype,"resizeFontSize",void 0),ft([w("#000000")],_i.prototype,"fill",void 0),ft([pt("outside")],_i.prototype,"strokeAlign",void 0),ft([E("all")],_i.prototype,"hitFill",void 0),ft([b("")],_i.prototype,"text",void 0),ft([b("")],_i.prototype,"placeholder",void 0),ft([b("caption")],_i.prototype,"fontFamily",void 0),ft([b(12)],_i.prototype,"fontSize",void 0),ft([b("normal")],_i.prototype,"fontWeight",void 0),ft([b(!1)],_i.prototype,"italic",void 0),ft([b("none")],_i.prototype,"textCase",void 0),ft([b("none")],_i.prototype,"textDecoration",void 0),ft([b(0)],_i.prototype,"letterSpacing",void 0),ft([b({type:"percent",value:1.5})],_i.prototype,"lineHeight",void 0),ft([b(0)],_i.prototype,"paraIndent",void 0),ft([b(0)],_i.prototype,"paraSpacing",void 0),ft([b("x")],_i.prototype,"writingMode",void 0),ft([b("left")],_i.prototype,"textAlign",void 0),ft([b("top")],_i.prototype,"verticalAlign",void 0),ft([b(!0)],_i.prototype,"autoSizeAlign",void 0),ft([b("normal")],_i.prototype,"textWrap",void 0),ft([b("show")],_i.prototype,"textOverflow",void 0),ft([w(!1)],_i.prototype,"textEditing",void 0),_i=ft([X()],_i);let di=class extends ye{get __tag(){return"Path"}};ft([v(Qt)],di.prototype,"__",void 0),ft([pt("center")],di.prototype,"strokeAlign",void 0),di=ft([X()],di);let li=class extends ve{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new di(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")}};ft([v(Zt)],li.prototype,"__",void 0),ft([(e,i)=>{t(e,i,{get(){return this.__path}})}],li.prototype,"path",void 0),li=ft([N(vt,["set","path","paint"]),X()],li);export{Ae as Box,Ut as BoxData,oi as Canvas,se as CanvasData,kt as ColorConvert,_e as DragBoundsHelper,Ft as Effect,Ie as Ellipse,Gt as EllipseData,It as Export,Wt as Filter,Ce as Frame,Xt as FrameData,ve as Group,Yt as GroupData,ii as Image,ie as ImageData,xe as Leafer,jt as LeaferData,ei as Line,Jt as LineData,si as MyImage,At as Paint,Pt as PaintGradient,Ct as PaintImage,di as Path,bt as PathArrow,Qt as PathData,li as Pen,Zt as PenData,Ne as Polygon,$t as PolygonData,Se as Rect,qt as RectData,ce as RectRender,Je as Star,Kt as StarData,Tt as State,_i as Text,Rt as TextConvert,ee as TextData,Dt as Transition,ye as UI,oe as UIBounds,Vt as UIData,pe as UIRender,Bt as UnitConvert,mt as createAttr,wt as effectType,xt as resizeType,St as zoomLayerType};
1
+ 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};
2
2
  //# sourceMappingURL=draw.esm.min.js.map