@leafer-ui/draw 2.1.5 → 2.1.7

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
@@ -703,6 +703,7 @@ exports.UI = UI_1 = class UI extends core.Leaf {
703
703
  this.set(keyframe);
704
704
  return core.Plugin.need("animate");
705
705
  }
706
+ killAnimate(_type, _nextStyle) {}
706
707
  export(_filename, _options) {
707
708
  return core.Plugin.need("export");
708
709
  }
@@ -1462,32 +1463,53 @@ __decorate([ core.affectRenderBoundsType("hide") ], exports.Frame.prototype, "ov
1462
1463
 
1463
1464
  exports.Frame = __decorate([ core.registerUI() ], exports.Frame);
1464
1465
 
1465
- const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = core.PathCommandDataHelper;
1466
+ const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = core.PathCommandDataHelper, {tempPoint: tempPoint, set: set, rotate: rotate$1} = core.PointHelper, {abs: abs} = Math, tempCenter = {};
1466
1467
 
1467
1468
  exports.Ellipse = class Ellipse extends exports.UI {
1468
1469
  get __tag() {
1469
1470
  return "Ellipse";
1470
1471
  }
1471
1472
  __updatePath() {
1472
- const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
1473
+ const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle, closed: closed} = data;
1473
1474
  const rx = width / 2, ry = height / 2;
1474
1475
  const path = data.path = [];
1475
- let open;
1476
+ let open, hasAngle, closedAngle;
1477
+ if (startAngle || endAngle) hasAngle = true;
1478
+ if (hasAngle) closedAngle = abs(endAngle - startAngle) === 360;
1476
1479
  if (innerRadius) {
1477
- if (startAngle || endAngle) {
1478
- if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false); else open = true;
1479
- ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
1480
+ const drawInnerEllipse = innerRadius < 1 || closed;
1481
+ let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
1482
+ if (hasAngle) {
1483
+ if (drawInnerEllipse) {
1484
+ ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
1485
+ if (closedAngle) {
1486
+ set(tempPoint, width, ry);
1487
+ set(tempCenter, rx, ry);
1488
+ rotate$1(tempPoint, endAngle, tempCenter, rx, ry);
1489
+ moveTo$3(path, tempPoint.x, tempPoint.y);
1490
+ }
1491
+ outerStartAngle = endAngle;
1492
+ outerEndAngle = startAngle;
1493
+ outerAnticlockwise = true;
1494
+ } else {
1495
+ if (!closedAngle) open = true;
1496
+ }
1480
1497
  } else {
1481
- if (innerRadius < 1) {
1498
+ if (drawInnerEllipse) {
1482
1499
  ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
1500
+ closePath$2(path);
1483
1501
  moveTo$3(path, width, ry);
1502
+ outerStartAngle = 360;
1503
+ outerAnticlockwise = true;
1504
+ } else {
1505
+ outerEndAngle = 360;
1484
1506
  }
1485
- ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
1486
1507
  }
1508
+ ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
1487
1509
  } else {
1488
- if (startAngle || endAngle) {
1489
- moveTo$3(path, rx, ry);
1490
- ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
1510
+ if (hasAngle) {
1511
+ if (!closedAngle) moveTo$3(path, rx, ry);
1512
+ ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
1491
1513
  } else {
1492
1514
  ellipse(path, rx, ry, rx, ry);
1493
1515
  }
package/lib/draw.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineKey, decorateLeafAttr, attr, createDescriptor, Plugin, UnitConvertHelper, PathConvert, DataHelper, Debug, LeafData, isString, isObject, isUndefined, isArray, canvasSizeAttrs, UICreator, FourNumberHelper, dataProcessor, dataType, surfaceType, opacityType, visibleType, dimType, sortType, maskType, eraserType, positionType, boundsType, scaleType, rotationType, scrollType, autoLayoutType, naturalBoundsType, affectRenderBoundsType, pathInputType, pathType, hitType, strokeType, cursorType, useModule, rewriteAble, Leaf, MathHelper, pen, PathCorner, PathDrawer, isNumber, registerUI, Branch, LeafList, Resource, getBoundsData, Creator, CanvasManager, WaitHelper, LeaferEvent, Bounds, ResizeEvent, AutoBounds, Run, LayoutEvent, RenderEvent, WatchEvent, ImageManager, BoundsHelper, rewrite, PathCommandDataHelper, Platform, OneRadian, PointHelper, affectStrokeBoundsType, getPointData, LeaferImage, ImageEvent, Matrix, PathCreator } from "@leafer/core";
1
+ import { defineKey, decorateLeafAttr, attr, createDescriptor, Plugin, UnitConvertHelper, PathConvert, DataHelper, Debug, LeafData, isString, isObject, isUndefined, isArray, canvasSizeAttrs, UICreator, FourNumberHelper, dataProcessor, dataType, surfaceType, opacityType, visibleType, dimType, sortType, maskType, eraserType, positionType, boundsType, scaleType, rotationType, scrollType, autoLayoutType, naturalBoundsType, affectRenderBoundsType, pathInputType, pathType, hitType, strokeType, cursorType, useModule, rewriteAble, Leaf, MathHelper, pen, PathCorner, PathDrawer, isNumber, registerUI, Branch, LeafList, Resource, getBoundsData, Creator, CanvasManager, WaitHelper, LeaferEvent, Bounds, ResizeEvent, AutoBounds, Run, LayoutEvent, RenderEvent, WatchEvent, ImageManager, BoundsHelper, rewrite, PathCommandDataHelper, PointHelper, Platform, OneRadian, affectStrokeBoundsType, getPointData, LeaferImage, ImageEvent, Matrix, PathCreator } from "@leafer/core";
2
2
 
3
3
  export * from "@leafer/core";
4
4
 
@@ -703,6 +703,7 @@ let UI = UI_1 = class UI extends Leaf {
703
703
  this.set(keyframe);
704
704
  return Plugin.need("animate");
705
705
  }
706
+ killAnimate(_type, _nextStyle) {}
706
707
  export(_filename, _options) {
707
708
  return Plugin.need("export");
708
709
  }
@@ -1462,32 +1463,53 @@ __decorate([ affectRenderBoundsType("hide") ], Frame.prototype, "overflow", void
1462
1463
 
1463
1464
  Frame = __decorate([ registerUI() ], Frame);
1464
1465
 
1465
- const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper;
1466
+ const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint, set: set, rotate: rotate$1} = PointHelper, {abs: abs} = Math, tempCenter = {};
1466
1467
 
1467
1468
  let Ellipse = class Ellipse extends UI {
1468
1469
  get __tag() {
1469
1470
  return "Ellipse";
1470
1471
  }
1471
1472
  __updatePath() {
1472
- const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
1473
+ const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle, closed: closed} = data;
1473
1474
  const rx = width / 2, ry = height / 2;
1474
1475
  const path = data.path = [];
1475
- let open;
1476
+ let open, hasAngle, closedAngle;
1477
+ if (startAngle || endAngle) hasAngle = true;
1478
+ if (hasAngle) closedAngle = abs(endAngle - startAngle) === 360;
1476
1479
  if (innerRadius) {
1477
- if (startAngle || endAngle) {
1478
- if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false); else open = true;
1479
- ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
1480
+ const drawInnerEllipse = innerRadius < 1 || closed;
1481
+ let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
1482
+ if (hasAngle) {
1483
+ if (drawInnerEllipse) {
1484
+ ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
1485
+ if (closedAngle) {
1486
+ set(tempPoint, width, ry);
1487
+ set(tempCenter, rx, ry);
1488
+ rotate$1(tempPoint, endAngle, tempCenter, rx, ry);
1489
+ moveTo$3(path, tempPoint.x, tempPoint.y);
1490
+ }
1491
+ outerStartAngle = endAngle;
1492
+ outerEndAngle = startAngle;
1493
+ outerAnticlockwise = true;
1494
+ } else {
1495
+ if (!closedAngle) open = true;
1496
+ }
1480
1497
  } else {
1481
- if (innerRadius < 1) {
1498
+ if (drawInnerEllipse) {
1482
1499
  ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
1500
+ closePath$2(path);
1483
1501
  moveTo$3(path, width, ry);
1502
+ outerStartAngle = 360;
1503
+ outerAnticlockwise = true;
1504
+ } else {
1505
+ outerEndAngle = 360;
1484
1506
  }
1485
- ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
1486
1507
  }
1508
+ ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
1487
1509
  } else {
1488
- if (startAngle || endAngle) {
1489
- moveTo$3(path, rx, ry);
1490
- ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
1510
+ if (hasAngle) {
1511
+ if (!closedAngle) moveTo$3(path, rx, ry);
1512
+ ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
1491
1513
  } else {
1492
1514
  ellipse(path, rx, ry, rx, ry);
1493
1515
  }
@@ -1,2 +1,2 @@
1
- import{defineKey as t,decorateLeafAttr as e,attr as i,createDescriptor as s,Plugin as o,UnitConvertHelper as r,PathConvert as a,DataHelper as n,Debug as _,LeafData as h,isString as d,isObject as l,isUndefined as p,isArray as u,canvasSizeAttrs as c,UICreator as g,FourNumberHelper as y,dataProcessor as v,dataType as f,surfaceType as w,opacityType as x,visibleType as S,dimType as m,sortType as k,maskType as R,eraserType as A,positionType as B,boundsType as C,scaleType as b,rotationType as P,scrollType as F,autoLayoutType as W,naturalBoundsType as I,affectRenderBoundsType as D,pathInputType as E,pathType as T,hitType as L,strokeType as z,cursorType as M,useModule as O,rewriteAble as N,Leaf as H,MathHelper as V,pen as Y,PathCorner as U,PathDrawer as X,isNumber as J,registerUI as j,Branch as G,LeafList as $,Resource as q,getBoundsData as K,Creator as Q,CanvasManager as Z,WaitHelper as tt,LeaferEvent as et,Bounds as it,ResizeEvent as st,AutoBounds as ot,Run as rt,LayoutEvent as at,RenderEvent as nt,WatchEvent as _t,ImageManager as ht,BoundsHelper as dt,rewrite as lt,PathCommandDataHelper as pt,Platform as ut,OneRadian as ct,PointHelper as gt,affectStrokeBoundsType as yt,getPointData as vt,LeaferImage as ft,ImageEvent as wt,Matrix as xt,PathCreator as St}from"@leafer/core";export*from"@leafer/core";function mt(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 kt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0);const i=this.__layout;i.renderChanged||i.renderChange(),i.surfaceChange()}}))}function Rt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function At(){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 Bt(e){return(i,o)=>{t(i,o,s(o,e))}}"function"==typeof SuppressedError&&SuppressedError;const Ct={},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}},Pt=r,Ft={},Wt={},It={},Dt={},Et={},Tt={apply(){o.need("filter")}},Lt={},zt={setStyleName:()=>o.need("state"),set:()=>o.need("state")},Mt={list:{},register(t,e){Mt.list[t]=e},get:t=>Mt.list[t]},{parse:Ot,objectToCanvasData:Nt}=a,{stintSet:Ht}=n,{hasTransparent:Vt}=bt,Yt={originPaint:{}},Ut=_.get("UIData");class Xt extends h{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this,e=t.__hasStrokeSides||t.strokeWidth;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,e):e}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Ut.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Ut.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),d(t)||!t?(Ht(this,"__isTransparentFill",Vt(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):l(t)&&this.__setPaint("fill",t)}setStroke(t){d(t)||!t?(Ht(this,"__isTransparentStroke",Vt(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):l(t)&&this.__setPaint("stroke",t)}setPath(t){const e=d(t);e||t&&l(t[0])?(this.__setInput("path",t),this._path=e?Ot(t,this.__useArrow):Nt(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Jt(this,"shadow",t)}setInnerShadow(t){Jt(this,"innerShadow",t)}setFilter(t){Jt(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Wt.compute("fill",this.__leaf),e&&Wt.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeScaleFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),p(t.strokeScaleFixed)||(i=t.strokeScaleFixed)),i){const{scaleX:t}=this.__leaf.getRenderScaleData(!0,i,!1);if(1!==t)return e*t}return e}__checkComplex(){const t=this;Ht(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Yt)):(this.__isStrokes=!0,this._stroke||(this._stroke=Yt))}__removePaint(t,e){e&&this.__removeInput(t),It.recycleImage(t,this),"fill"===t?(Ht(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Ht(this,"__isAlphaPixelStroke",void 0),Ht(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Jt(t,e,i){t.__setInput(e,i),u(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 Xt{}class Gt 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 $t extends jt{__getInputData(t,e){const i=super.__getInputData(t,e);return c.forEach(t=>delete i[t]),i}}class qt extends Gt{}class Kt extends Xt{get __usePathBox(){return this.points||this.__pathInputed}}class Qt extends Xt{get __boxStroke(){return!this.__pathInputed}}class Zt extends Xt{get __boxStroke(){return!this.__pathInputed}}class te extends Xt{get __usePathBox(){return this.points||this.__pathInputed}}class ee extends Xt{get __boxStroke(){return!this.__pathInputed}}class ie extends Xt{get __pathInputed(){return 2}}class se extends jt{}const oe={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class re extends Xt{get __useNaturalRatio(){return!1}setFontWeight(t){d(t)?(this.__setInput("fontWeight",t),t=oe[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=g.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}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class ae extends Qt{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class ne 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{max:_e,add:he}=y,de={__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||i.__useArrow)){const e=i.__isLinePath?0:("miter"===i.strokeJoin?10:1)*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),r&&(t=_e(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,_=this.__box;e&&(t=Et.getShadowRenderSpread(this,e)),s&&(t=_e(t,s)),r&&(t=he(t,Tt.getSpread(r))),a&&(t=he(t,a)),n&&(t=he(t,n));let h=t;return i&&(h=_e(h,Et.getInnerShadowSpread(this,i))),o&&(h=_e(h,o)),this.__layout.renderShapeSpread=h,_?_e(_.__updateRenderSpread(),t):t}},{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&&!Et.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),t.__checkComplex()},__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:_}=s;if(this.__drawRenderPath(t),s.__useEffect&&!_){const _=Wt.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:d,filter:l}=s;h&&Et.shadow(this,t,_),n&&(s.__isStrokes?Wt.strokes(r,this,t,e):Wt.stroke(r,this,t,e)),o&&(s.__isFills?Wt.fills(o,this,t,e):Wt.fill(o,this,t,e)),a&&this.__drawAfterFill(t,e),d&&Et.innerShadow(this,t,_),r&&!n&&(s.__isStrokes?Wt.strokes(r,this,t,e):Wt.stroke(r,this,t,e)),l&&Tt.apply(l,this,this.__nowWorld,t,i,_),_.worldCanvas&&_.worldCanvas.recycle(),_.canvas.recycle()}else{if(n&&(s.__isStrokes?Wt.strokes(r,this,t,e):Wt.stroke(r,this,t,e)),_){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?Wt.fills(o,this,t,e):Wt.fill(o,this,t,e)),_&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?Wt.strokes(r,this,t,e):Wt.stroke(r,this,t,e))}}else s.__pathForRender?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?Wt.fills(s,this,t,e):Wt.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Wt.strokes(o,this,t,e):Wt.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function ue(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Wt.stroke(o,t,e,i),s&&Wt.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),o&&!a&&Wt.stroke(o,t,e,i)}const ce={__drawFast(t,e){let{x:i,y:s,width:o,height:r}=this.__layout.boxBounds;const{fill:a,stroke:n,__drawAfterFill:_}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,o,r)),_&&this.__drawAfterFill(t,e),n){const{strokeAlign:a,__strokeWidth:_}=this.__;if(!_)return;t.setStroke(n,_,this.__);const h=_/2;switch(a){case"center":t.strokeRect(0,0,o,r);break;case"inside":o-=_,r-=_,o<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+h,s+h,o,r),t.restore()):t.strokeRect(i+h,s+h,o,r);break;case"outside":t.strokeRect(i-h,s-h,o+_,r+_)}}}};var ge;let ye=ge=class extends H{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set strokeWidthFixed(t){this.strokeScaleFixed=t}get strokeWidthFixed(){return this.strokeScaleFixed}set scale(t){V.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}set(t,e){t&&Object.assign(this,t)}get(t){return d(t)?this.__.__getInput(t):this.__.__getInputData(t)}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,!e)),t?a.toCanvasData(i,!0):i}getPathString(t,e,i){return a.stringify(this.getPath(t,e),i)}asPath(t,e){this.path=this.getPath(t,e)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Lt.running?t.__computePaint():t.__needComputePaint=!0}}__updatePath(){}__updateRenderPath(t){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius||e.path.radius?U.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&Ft.addArrows(this,t)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){const e=this.__;t.beginPath(),e.__useArrow&&Ft.updateArrow(this),this.__drawPathByData(t,e.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?X.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:o,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,o,r,J(e)?[e]:e)}else t.rect(i,s,o,r);t.closePath()}drawImagePlaceholder(t,e,i){Wt.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),o.need("animate")}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 g.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.__.__willDestroy=!0,this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};mt([v(Xt)],ye.prototype,"__",void 0),mt([At()],ye.prototype,"zoomLayer",void 0),mt([f("")],ye.prototype,"id",void 0),mt([f("")],ye.prototype,"name",void 0),mt([f("")],ye.prototype,"className",void 0),mt([w("pass-through")],ye.prototype,"blendMode",void 0),mt([x(1)],ye.prototype,"opacity",void 0),mt([S(!0)],ye.prototype,"visible",void 0),mt([w(!1)],ye.prototype,"locked",void 0),mt([m(!1)],ye.prototype,"dim",void 0),mt([m(!1)],ye.prototype,"dimskip",void 0),mt([k(0)],ye.prototype,"zIndex",void 0),mt([R(!1)],ye.prototype,"mask",void 0),mt([A(!1)],ye.prototype,"eraser",void 0),mt([B(0,!0)],ye.prototype,"x",void 0),mt([B(0,!0)],ye.prototype,"y",void 0),mt([C(100,!0)],ye.prototype,"width",void 0),mt([C(100,!0)],ye.prototype,"height",void 0),mt([b(1,!0)],ye.prototype,"scaleX",void 0),mt([b(1,!0)],ye.prototype,"scaleY",void 0),mt([P(0,!0)],ye.prototype,"rotation",void 0),mt([P(0,!0)],ye.prototype,"skewX",void 0),mt([P(0,!0)],ye.prototype,"skewY",void 0),mt([B(0,!0)],ye.prototype,"offsetX",void 0),mt([B(0,!0)],ye.prototype,"offsetY",void 0),mt([F(0,!0)],ye.prototype,"scrollX",void 0),mt([F(0,!0)],ye.prototype,"scrollY",void 0),mt([W()],ye.prototype,"origin",void 0),mt([W()],ye.prototype,"around",void 0),mt([f(!1)],ye.prototype,"lazy",void 0),mt([I(1)],ye.prototype,"pixelRatio",void 0),mt([D(0)],ye.prototype,"renderSpread",void 0),mt([E()],ye.prototype,"path",void 0),mt([T()],ye.prototype,"windingRule",void 0),mt([T(!0)],ye.prototype,"closed",void 0),mt([C(0)],ye.prototype,"padding",void 0),mt([C(!1)],ye.prototype,"lockRatio",void 0),mt([C()],ye.prototype,"widthRange",void 0),mt([C()],ye.prototype,"heightRange",void 0),mt([f(!1)],ye.prototype,"draggable",void 0),mt([f()],ye.prototype,"dragBounds",void 0),mt([f("auto")],ye.prototype,"dragBoundsType",void 0),mt([f(!1)],ye.prototype,"editable",void 0),mt([L(!0)],ye.prototype,"hittable",void 0),mt([L("path")],ye.prototype,"hitFill",void 0),mt([z("path")],ye.prototype,"hitStroke",void 0),mt([L(!1)],ye.prototype,"hitBox",void 0),mt([L(!0)],ye.prototype,"hitChildren",void 0),mt([L(!0)],ye.prototype,"hitSelf",void 0),mt([L()],ye.prototype,"hitRadius",void 0),mt([M("")],ye.prototype,"cursor",void 0),mt([w()],ye.prototype,"fill",void 0),mt([z(void 0,!0)],ye.prototype,"stroke",void 0),mt([z("inside")],ye.prototype,"strokeAlign",void 0),mt([z(1,!0)],ye.prototype,"strokeWidth",void 0),mt([z(!1)],ye.prototype,"strokeScaleFixed",void 0),mt([z("none")],ye.prototype,"strokeCap",void 0),mt([z("miter")],ye.prototype,"strokeJoin",void 0),mt([z()],ye.prototype,"dashPattern",void 0),mt([z(0)],ye.prototype,"dashOffset",void 0),mt([z(10)],ye.prototype,"miterLimit",void 0),mt([T(0)],ye.prototype,"cornerRadius",void 0),mt([T()],ye.prototype,"cornerSmoothing",void 0),mt([kt()],ye.prototype,"shadow",void 0),mt([kt()],ye.prototype,"innerShadow",void 0),mt([kt()],ye.prototype,"blur",void 0),mt([kt()],ye.prototype,"backgroundBlur",void 0),mt([kt()],ye.prototype,"grayscale",void 0),mt([kt()],ye.prototype,"filter",void 0),mt([w()],ye.prototype,"placeholderColor",void 0),mt([f(100)],ye.prototype,"placeholderDelay",void 0),mt([f({})],ye.prototype,"data",void 0),ye=ge=mt([O(de),O(pe),N()],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);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return 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))}};var fe;mt([v(jt)],ve.prototype,"__",void 0),mt([C(0)],ve.prototype,"width",void 0),mt([C(0)],ve.prototype,"height",void 0),ve=mt([O(G),j()],ve);const we=_.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&&q.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||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),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=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(),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(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=n.copyAttrs({},t,c);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new it(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,c);e.resize(t),this.updateLazyBounds(),this.__onResize(new st(t,i))}__onResize(t){this.emitEvent(t),n.copyAttrs(this.__,t,c),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&&(c.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&&c.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=n.copyAttrs({},s,c);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=rt.start("FirstCreate "+this.innerName);this.once([[et.START,()=>rt.end(t)],[at.START,this.updateLazyBounds,this],[nt.START,this.__onCreated,this],[nt.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[_t.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){fe.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.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{ht.clearRecycled()},100)}catch(t){we.error(t)}}};t?e():setTimeout(e)}};xe.list=new $,mt([v($t)],xe.prototype,"__",void 0),mt([C()],xe.prototype,"pixelRatio",void 0),mt([f("normal")],xe.prototype,"mode",void 0),xe=fe=mt([j()],xe);let Se=class extends ye{get __tag(){return"Rect"}};mt([v(Qt)],Se.prototype,"__",void 0),Se=mt([O(ce),N(),j()],Se);const{add:me,includes:ke,scroll:Re}=dt,Ae=Se.prototype,Be=ve.prototype;let Ce=class extends ve{get __tag(){return"Box"}get isBranchLeaf(){return!0}get __useSelfBox(){return this.pathInputed}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.__useSelfBox){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:o,boxBounds:r}=s,{overflow:a}=i,n=s.childrenRenderBounds||(s.childrenRenderBounds=K());super.__updateRenderBounds(n),(e=a&&a.includes("scroll"))&&(me(n,r),Re(n,i)),this.__updateRectRenderBounds(),t=!ke(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))}};mt([v(Gt)],Ce.prototype,"__",void 0),mt([C(100)],Ce.prototype,"width",void 0),mt([C(100)],Ce.prototype,"height",void 0),mt([f(!1)],Ce.prototype,"resizeChildren",void 0),mt([D("show")],Ce.prototype,"overflow",void 0),mt([lt(Ae.__updateStrokeSpread)],Ce.prototype,"__updateStrokeSpread",null),mt([lt(Ae.__updateRenderSpread)],Ce.prototype,"__updateRectRenderSpread",null),mt([lt(Ae.__updateBoxBounds)],Ce.prototype,"__updateRectBoxBounds",null),mt([lt(Ae.__updateStrokeBounds)],Ce.prototype,"__updateStrokeBounds",null),mt([lt(Ae.__updateRenderBounds)],Ce.prototype,"__updateRectRenderBounds",null),mt([lt(Ae.__updateChange)],Ce.prototype,"__updateRectChange",null),mt([lt(Ae.__render)],Ce.prototype,"__renderRect",null),mt([lt(Be.__render)],Ce.prototype,"__renderGroup",null),Ce=mt([N(),j()],Ce);let be=class extends Ce{get __tag(){return"Frame"}get isFrame(){return!0}};mt([v(qt)],be.prototype,"__",void 0),mt([w("#FFFFFF")],be.prototype,"fill",void 0),mt([D("hide")],be.prototype,"overflow",void 0),be=mt([j()],be);const{moveTo:Pe,closePath:Fe,ellipse:We}=pt;let Ie=class extends ye{get __tag(){return"Ellipse"}__updatePath(){const t=this.__,{width:e,height:i,innerRadius:s,startAngle:o,endAngle:r}=t,a=e/2,n=i/2,_=t.path=[];let h;s?o||r?(s<1?We(_,a,n,a*s,n*s,0,o,r,!1):h=!0,We(_,a,n,a,n,0,r,o,!0)):(s<1&&(We(_,a,n,a*s,n*s),Pe(_,e,n)),We(_,a,n,a,n,0,360,0,!0)):o||r?(Pe(_,a,n),We(_,a,n,a,n,0,o,r,!1)):We(_,a,n,a,n),h||Fe(_),(ut.ellipseToCurve||t.__useArrow||t.cornerRadius)&&(t.path=this.getPath(!0))}};mt([v(Zt)],Ie.prototype,"__",void 0),mt([T(0)],Ie.prototype,"innerRadius",void 0),mt([T(0)],Ie.prototype,"startAngle",void 0),mt([T(0)],Ie.prototype,"endAngle",void 0),Ie=mt([j()],Ie);const{sin:De,cos:Ee,PI:Te}=Math,{moveTo:Le,lineTo:ze,closePath:Me,drawPoints:Oe}=pt;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,t.closed);else{const{width:i,height:s,sides:o,startAngle:r}=t,a=i/2,n=s/2;let _,h=0;r?(h=r*ct,Le(e,a+a*De(h),n-n*Ee(h))):Le(e,a,0);for(let t=1;t<o;t++)_=2*t*Te/o+h,ze(e,a+a*De(_),n-n*Ee(_));Me(e)}}};mt([v(te)],Ne.prototype,"__",void 0),mt([T(3)],Ne.prototype,"sides",void 0),mt([T(0)],Ne.prototype,"startAngle",void 0),mt([T()],Ne.prototype,"points",void 0),mt([T(0)],Ne.prototype,"curve",void 0),Ne=mt([N(),j()],Ne);const{sin:He,cos:Ve,PI:Ye}=Math,{moveTo:Ue,lineTo:Xe,closePath:Je}=pt;let je=class extends ye{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s,startAngle:o}=this.__,r=t/2,a=e/2,n=this.__.path=[];let _,h=0;o?(h=o*ct,Ue(n,r+r*He(h),a-a*Ve(h))):Ue(n,r,0);for(let t=1;t<2*i;t++)_=t*Ye/i+h,Xe(n,r+(t%2==0?r:r*s)*He(_),a-(t%2==0?a:a*s)*Ve(_));Je(n)}};mt([v(ee)],je.prototype,"__",void 0),mt([T(5)],je.prototype,"corners",void 0),mt([T(.382)],je.prototype,"innerRadius",void 0),mt([T(0)],je.prototype,"startAngle",void 0),je=mt([j()],je);const{moveTo:Ge,lineTo:$e,drawPoints:qe}=pt,{rotate:Ke,getAngle:Qe,getDistance:Ze,defaultPoint:ti}=gt;let ei=class extends ye{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=vt();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?qe(e,t.points,t.curve,t.closed):(Ge(e,0,0),$e(e,this.width,0))}};mt([v(Kt)],ei.prototype,"__",void 0),mt([yt("center")],ei.prototype,"strokeAlign",void 0),mt([C(0)],ei.prototype,"height",void 0),mt([T()],ei.prototype,"points",void 0),mt([T(0)],ei.prototype,"curve",void 0),mt([T(!1)],ei.prototype,"closed",void 0),ei=mt([j()],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 u(t)&&t[0].image}};mt([v(ae)],ii.prototype,"__",void 0),mt([C("")],ii.prototype,"url",void 0),ii=mt([j()],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=Q.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new ft({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new wt(wt.LOADED,{image:t}))})}draw(t,e,i,s){const o=new xt(t.worldTransform).invert(),r=new xt;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()}};mt([v(ne)],oi.prototype,"__",void 0),mt([Rt(100)],oi.prototype,"width",void 0),mt([Rt(100)],oi.prototype,"height",void 0),mt([Rt(1)],oi.prototype,"pixelRatio",void 0),mt([Rt(!0)],oi.prototype,"smooth",void 0),mt([f(!1)],oi.prototype,"safeResize",void 0),mt([Rt()],oi.prototype,"contextSettings",void 0),oi=mt([j()],oi);const{copyAndSpread:ri,includes:ai,setList:ni}=dt,{stintSet:_i}=n;let hi=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:_,padding:h,width:d,height:l}=t;t.__lineHeight=Pt.number(e,o),t.__letterSpacing=Pt.number(i,o),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"}`,_i(t,"__padding",h&&V.fourNumber(h)),_i(t,"__clipText","show"!==_&&!t.__autoSize),_i(t,"__isCharMode",d||l||t.__letterSpacing||"none"!==n),t.__textDrawData=Ct.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:_}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=_,t.__lineHeight<i&&(e.renderChanged=!0),r||a){if(h.x=r?_.x:0,h.y=a?_.y:0,h.width=r?_.width:t.width,h.height=a?_.height:t.height,o){const[e,i,s,o]=t.__padding;r&&(h.x-=o,h.width+=i+o),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),n.stintSet(this,"isOverflow",!ai(h,_)),this.isOverflow?(ni(t.__textBoxBounds={},[h,_]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();t||(t=this.isOverflow?1:0);const{__lineHeight:e,fontSize:i}=this.__;return e<i&&(t=y.max(t,(i-e)/2)),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()}};mt([v(re)],hi.prototype,"__",void 0),mt([C(0)],hi.prototype,"width",void 0),mt([C(0)],hi.prototype,"height",void 0),mt([w()],hi.prototype,"boxStyle",void 0),mt([f(!1)],hi.prototype,"resizeFontSize",void 0),mt([w("#000000")],hi.prototype,"fill",void 0),mt([yt("outside")],hi.prototype,"strokeAlign",void 0),mt([L("all")],hi.prototype,"hitFill",void 0),mt([C("")],hi.prototype,"text",void 0),mt([C("")],hi.prototype,"placeholder",void 0),mt([C("caption")],hi.prototype,"fontFamily",void 0),mt([C(12)],hi.prototype,"fontSize",void 0),mt([C("normal")],hi.prototype,"fontWeight",void 0),mt([C(!1)],hi.prototype,"italic",void 0),mt([C("none")],hi.prototype,"textCase",void 0),mt([C("none")],hi.prototype,"textDecoration",void 0),mt([C(0)],hi.prototype,"letterSpacing",void 0),mt([C({type:"percent",value:1.5})],hi.prototype,"lineHeight",void 0),mt([C(0)],hi.prototype,"paraIndent",void 0),mt([C(0)],hi.prototype,"paraSpacing",void 0),mt([C("x")],hi.prototype,"writingMode",void 0),mt([C("left")],hi.prototype,"textAlign",void 0),mt([C("top")],hi.prototype,"verticalAlign",void 0),mt([C(!0)],hi.prototype,"autoSizeAlign",void 0),mt([C("normal")],hi.prototype,"textWrap",void 0),mt([C("show")],hi.prototype,"textOverflow",void 0),mt([w(!1)],hi.prototype,"textEditing",void 0),hi=mt([j()],hi);let di=class extends ye{get __tag(){return"Path"}};mt([v(ie)],di.prototype,"__",void 0),mt([yt("center")],di.prototype,"strokeAlign",void 0),di=mt([j()],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}paint(){const{pathElement:t}=this;t.__layout.boxChanged||t.forceUpdate("path")}};mt([v(se)],li.prototype,"__",void 0),mt([(e,i)=>{t(e,i,{get(){return this.__path}})}],li.prototype,"path",void 0),li=mt([O(St,["set","path","paint"]),j()],li);export{Ce as Box,Gt as BoxData,oi as Canvas,ne as CanvasData,bt as ColorConvert,Et as Effect,Ie as Ellipse,Zt as EllipseData,Lt as Export,Tt as Filter,be as Frame,qt as FrameData,ve as Group,jt as GroupData,ii as Image,ae as ImageData,xe as Leafer,$t as LeaferData,ei as Line,Kt as LineData,si as MyImage,Wt as Paint,Dt as PaintGradient,It as PaintImage,di as Path,Ft as PathArrow,ie as PathData,li as Pen,se as PenData,Ne as Polygon,te as PolygonData,Se as Rect,Qt as RectData,ce as RectRender,je as Star,ee as StarData,zt as State,hi as Text,Ct as TextConvert,re as TextData,Mt as Transition,ye as UI,de as UIBounds,Xt as UIData,pe as UIRender,Pt as UnitConvert,Bt as createAttr,kt as effectType,Rt as resizeType,At as zoomLayerType};
1
+ import{defineKey as t,decorateLeafAttr as e,attr as i,createDescriptor as s,Plugin as o,UnitConvertHelper as r,PathConvert as a,DataHelper as n,Debug as _,LeafData as h,isString as d,isObject as l,isUndefined as p,isArray as u,canvasSizeAttrs as c,UICreator as g,FourNumberHelper as y,dataProcessor as v,dataType as f,surfaceType as w,opacityType as x,visibleType as S,dimType as m,sortType as k,maskType as R,eraserType as A,positionType as B,boundsType as C,scaleType as b,rotationType as P,scrollType as F,autoLayoutType as W,naturalBoundsType as I,affectRenderBoundsType as D,pathInputType as E,pathType as T,hitType as L,strokeType as z,cursorType as M,useModule as O,rewriteAble as N,Leaf as H,MathHelper as V,pen as Y,PathCorner as U,PathDrawer as X,isNumber as J,registerUI as j,Branch as G,LeafList as $,Resource as q,getBoundsData as K,Creator as Q,CanvasManager as Z,WaitHelper as tt,LeaferEvent as et,Bounds as it,ResizeEvent as st,AutoBounds as ot,Run as rt,LayoutEvent as at,RenderEvent as nt,WatchEvent as _t,ImageManager as ht,BoundsHelper as dt,rewrite as lt,PathCommandDataHelper as pt,PointHelper as ut,Platform as ct,OneRadian as gt,affectStrokeBoundsType as yt,getPointData as vt,LeaferImage as ft,ImageEvent as wt,Matrix as xt,PathCreator as St}from"@leafer/core";export*from"@leafer/core";function mt(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 kt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0);const i=this.__layout;i.renderChanged||i.renderChange(),i.surfaceChange()}}))}function Rt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function At(){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 Bt(e){return(i,o)=>{t(i,o,s(o,e))}}"function"==typeof SuppressedError&&SuppressedError;const Ct={},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}},Pt=r,Ft={},Wt={},It={},Dt={},Et={},Tt={apply(){o.need("filter")}},Lt={},zt={setStyleName:()=>o.need("state"),set:()=>o.need("state")},Mt={list:{},register(t,e){Mt.list[t]=e},get:t=>Mt.list[t]},{parse:Ot,objectToCanvasData:Nt}=a,{stintSet:Ht}=n,{hasTransparent:Vt}=bt,Yt={originPaint:{}},Ut=_.get("UIData");class Xt extends h{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this,e=t.__hasStrokeSides||t.strokeWidth;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,e):e}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Ut.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Ut.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),d(t)||!t?(Ht(this,"__isTransparentFill",Vt(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):l(t)&&this.__setPaint("fill",t)}setStroke(t){d(t)||!t?(Ht(this,"__isTransparentStroke",Vt(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):l(t)&&this.__setPaint("stroke",t)}setPath(t){const e=d(t);e||t&&l(t[0])?(this.__setInput("path",t),this._path=e?Ot(t,this.__useArrow):Nt(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Jt(this,"shadow",t)}setInnerShadow(t){Jt(this,"innerShadow",t)}setFilter(t){Jt(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Wt.compute("fill",this.__leaf),e&&Wt.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeScaleFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),p(t.strokeScaleFixed)||(i=t.strokeScaleFixed)),i){const{scaleX:t}=this.__leaf.getRenderScaleData(!0,i,!1);if(1!==t)return e*t}return e}__checkComplex(){const t=this;Ht(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Yt)):(this.__isStrokes=!0,this._stroke||(this._stroke=Yt))}__removePaint(t,e){e&&this.__removeInput(t),It.recycleImage(t,this),"fill"===t?(Ht(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Ht(this,"__isAlphaPixelStroke",void 0),Ht(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Jt(t,e,i){t.__setInput(e,i),u(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 Xt{}class Gt 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 $t extends jt{__getInputData(t,e){const i=super.__getInputData(t,e);return c.forEach(t=>delete i[t]),i}}class qt extends Gt{}class Kt extends Xt{get __usePathBox(){return this.points||this.__pathInputed}}class Qt extends Xt{get __boxStroke(){return!this.__pathInputed}}class Zt extends Xt{get __boxStroke(){return!this.__pathInputed}}class te extends Xt{get __usePathBox(){return this.points||this.__pathInputed}}class ee extends Xt{get __boxStroke(){return!this.__pathInputed}}class ie extends Xt{get __pathInputed(){return 2}}class se extends jt{}const oe={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class re extends Xt{get __useNaturalRatio(){return!1}setFontWeight(t){d(t)?(this.__setInput("fontWeight",t),t=oe[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=g.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}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class ae extends Qt{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class ne 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{max:_e,add:he}=y,de={__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||i.__useArrow)){const e=i.__isLinePath?0:("miter"===i.strokeJoin?10:1)*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),r&&(t=_e(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,_=this.__box;e&&(t=Et.getShadowRenderSpread(this,e)),s&&(t=_e(t,s)),r&&(t=he(t,Tt.getSpread(r))),a&&(t=he(t,a)),n&&(t=he(t,n));let h=t;return i&&(h=_e(h,Et.getInnerShadowSpread(this,i))),o&&(h=_e(h,o)),this.__layout.renderShapeSpread=h,_?_e(_.__updateRenderSpread(),t):t}},{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&&!Et.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),t.__checkComplex()},__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:_}=s;if(this.__drawRenderPath(t),s.__useEffect&&!_){const _=Wt.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:d,filter:l}=s;h&&Et.shadow(this,t,_),n&&(s.__isStrokes?Wt.strokes(r,this,t,e):Wt.stroke(r,this,t,e)),o&&(s.__isFills?Wt.fills(o,this,t,e):Wt.fill(o,this,t,e)),a&&this.__drawAfterFill(t,e),d&&Et.innerShadow(this,t,_),r&&!n&&(s.__isStrokes?Wt.strokes(r,this,t,e):Wt.stroke(r,this,t,e)),l&&Tt.apply(l,this,this.__nowWorld,t,i,_),_.worldCanvas&&_.worldCanvas.recycle(),_.canvas.recycle()}else{if(n&&(s.__isStrokes?Wt.strokes(r,this,t,e):Wt.stroke(r,this,t,e)),_){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?Wt.fills(o,this,t,e):Wt.fill(o,this,t,e)),_&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?Wt.strokes(r,this,t,e):Wt.stroke(r,this,t,e))}}else s.__pathForRender?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?Wt.fills(s,this,t,e):Wt.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Wt.strokes(o,this,t,e):Wt.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function ue(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Wt.stroke(o,t,e,i),s&&Wt.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),o&&!a&&Wt.stroke(o,t,e,i)}const ce={__drawFast(t,e){let{x:i,y:s,width:o,height:r}=this.__layout.boxBounds;const{fill:a,stroke:n,__drawAfterFill:_}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,o,r)),_&&this.__drawAfterFill(t,e),n){const{strokeAlign:a,__strokeWidth:_}=this.__;if(!_)return;t.setStroke(n,_,this.__);const h=_/2;switch(a){case"center":t.strokeRect(0,0,o,r);break;case"inside":o-=_,r-=_,o<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+h,s+h,o,r),t.restore()):t.strokeRect(i+h,s+h,o,r);break;case"outside":t.strokeRect(i-h,s-h,o+_,r+_)}}}};var ge;let ye=ge=class extends H{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set strokeWidthFixed(t){this.strokeScaleFixed=t}get strokeWidthFixed(){return this.strokeScaleFixed}set scale(t){V.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}set(t,e){t&&Object.assign(this,t)}get(t){return d(t)?this.__.__getInput(t):this.__.__getInputData(t)}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,!e)),t?a.toCanvasData(i,!0):i}getPathString(t,e,i){return a.stringify(this.getPath(t,e),i)}asPath(t,e){this.path=this.getPath(t,e)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Lt.running?t.__computePaint():t.__needComputePaint=!0}}__updatePath(){}__updateRenderPath(t){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius||e.path.radius?U.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&Ft.addArrows(this,t)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){const e=this.__;t.beginPath(),e.__useArrow&&Ft.updateArrow(this),this.__drawPathByData(t,e.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path,!0)}__drawPathByData(t,e,i){e?X.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:o,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,o,r,J(e)?[e]:e)}else t.rect(i,s,o,r);t.closePath()}drawImagePlaceholder(t,e,i){Wt.fill(this.__.placeholderColor,this,e,i)}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 g.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.__.__willDestroy=!0,this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};mt([v(Xt)],ye.prototype,"__",void 0),mt([At()],ye.prototype,"zoomLayer",void 0),mt([f("")],ye.prototype,"id",void 0),mt([f("")],ye.prototype,"name",void 0),mt([f("")],ye.prototype,"className",void 0),mt([w("pass-through")],ye.prototype,"blendMode",void 0),mt([x(1)],ye.prototype,"opacity",void 0),mt([S(!0)],ye.prototype,"visible",void 0),mt([w(!1)],ye.prototype,"locked",void 0),mt([m(!1)],ye.prototype,"dim",void 0),mt([m(!1)],ye.prototype,"dimskip",void 0),mt([k(0)],ye.prototype,"zIndex",void 0),mt([R(!1)],ye.prototype,"mask",void 0),mt([A(!1)],ye.prototype,"eraser",void 0),mt([B(0,!0)],ye.prototype,"x",void 0),mt([B(0,!0)],ye.prototype,"y",void 0),mt([C(100,!0)],ye.prototype,"width",void 0),mt([C(100,!0)],ye.prototype,"height",void 0),mt([b(1,!0)],ye.prototype,"scaleX",void 0),mt([b(1,!0)],ye.prototype,"scaleY",void 0),mt([P(0,!0)],ye.prototype,"rotation",void 0),mt([P(0,!0)],ye.prototype,"skewX",void 0),mt([P(0,!0)],ye.prototype,"skewY",void 0),mt([B(0,!0)],ye.prototype,"offsetX",void 0),mt([B(0,!0)],ye.prototype,"offsetY",void 0),mt([F(0,!0)],ye.prototype,"scrollX",void 0),mt([F(0,!0)],ye.prototype,"scrollY",void 0),mt([W()],ye.prototype,"origin",void 0),mt([W()],ye.prototype,"around",void 0),mt([f(!1)],ye.prototype,"lazy",void 0),mt([I(1)],ye.prototype,"pixelRatio",void 0),mt([D(0)],ye.prototype,"renderSpread",void 0),mt([E()],ye.prototype,"path",void 0),mt([T()],ye.prototype,"windingRule",void 0),mt([T(!0)],ye.prototype,"closed",void 0),mt([C(0)],ye.prototype,"padding",void 0),mt([C(!1)],ye.prototype,"lockRatio",void 0),mt([C()],ye.prototype,"widthRange",void 0),mt([C()],ye.prototype,"heightRange",void 0),mt([f(!1)],ye.prototype,"draggable",void 0),mt([f()],ye.prototype,"dragBounds",void 0),mt([f("auto")],ye.prototype,"dragBoundsType",void 0),mt([f(!1)],ye.prototype,"editable",void 0),mt([L(!0)],ye.prototype,"hittable",void 0),mt([L("path")],ye.prototype,"hitFill",void 0),mt([z("path")],ye.prototype,"hitStroke",void 0),mt([L(!1)],ye.prototype,"hitBox",void 0),mt([L(!0)],ye.prototype,"hitChildren",void 0),mt([L(!0)],ye.prototype,"hitSelf",void 0),mt([L()],ye.prototype,"hitRadius",void 0),mt([M("")],ye.prototype,"cursor",void 0),mt([w()],ye.prototype,"fill",void 0),mt([z(void 0,!0)],ye.prototype,"stroke",void 0),mt([z("inside")],ye.prototype,"strokeAlign",void 0),mt([z(1,!0)],ye.prototype,"strokeWidth",void 0),mt([z(!1)],ye.prototype,"strokeScaleFixed",void 0),mt([z("none")],ye.prototype,"strokeCap",void 0),mt([z("miter")],ye.prototype,"strokeJoin",void 0),mt([z()],ye.prototype,"dashPattern",void 0),mt([z(0)],ye.prototype,"dashOffset",void 0),mt([z(10)],ye.prototype,"miterLimit",void 0),mt([T(0)],ye.prototype,"cornerRadius",void 0),mt([T()],ye.prototype,"cornerSmoothing",void 0),mt([kt()],ye.prototype,"shadow",void 0),mt([kt()],ye.prototype,"innerShadow",void 0),mt([kt()],ye.prototype,"blur",void 0),mt([kt()],ye.prototype,"backgroundBlur",void 0),mt([kt()],ye.prototype,"grayscale",void 0),mt([kt()],ye.prototype,"filter",void 0),mt([w()],ye.prototype,"placeholderColor",void 0),mt([f(100)],ye.prototype,"placeholderDelay",void 0),mt([f({})],ye.prototype,"data",void 0),ye=ge=mt([O(de),O(pe),N()],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);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return 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))}};var fe;mt([v(jt)],ve.prototype,"__",void 0),mt([C(0)],ve.prototype,"width",void 0),mt([C(0)],ve.prototype,"height",void 0),ve=mt([O(G),j()],ve);const we=_.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&&q.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||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),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=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(),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(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=n.copyAttrs({},t,c);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new it(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,c);e.resize(t),this.updateLazyBounds(),this.__onResize(new st(t,i))}__onResize(t){this.emitEvent(t),n.copyAttrs(this.__,t,c),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&&(c.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&&c.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=n.copyAttrs({},s,c);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=rt.start("FirstCreate "+this.innerName);this.once([[et.START,()=>rt.end(t)],[at.START,this.updateLazyBounds,this],[nt.START,this.__onCreated,this],[nt.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[_t.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){fe.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.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{ht.clearRecycled()},100)}catch(t){we.error(t)}}};t?e():setTimeout(e)}};xe.list=new $,mt([v($t)],xe.prototype,"__",void 0),mt([C()],xe.prototype,"pixelRatio",void 0),mt([f("normal")],xe.prototype,"mode",void 0),xe=fe=mt([j()],xe);let Se=class extends ye{get __tag(){return"Rect"}};mt([v(Qt)],Se.prototype,"__",void 0),Se=mt([O(ce),N(),j()],Se);const{add:me,includes:ke,scroll:Re}=dt,Ae=Se.prototype,Be=ve.prototype;let Ce=class extends ve{get __tag(){return"Box"}get isBranchLeaf(){return!0}get __useSelfBox(){return this.pathInputed}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.__useSelfBox){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:o,boxBounds:r}=s,{overflow:a}=i,n=s.childrenRenderBounds||(s.childrenRenderBounds=K());super.__updateRenderBounds(n),(e=a&&a.includes("scroll"))&&(me(n,r),Re(n,i)),this.__updateRectRenderBounds(),t=!ke(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))}};mt([v(Gt)],Ce.prototype,"__",void 0),mt([C(100)],Ce.prototype,"width",void 0),mt([C(100)],Ce.prototype,"height",void 0),mt([f(!1)],Ce.prototype,"resizeChildren",void 0),mt([D("show")],Ce.prototype,"overflow",void 0),mt([lt(Ae.__updateStrokeSpread)],Ce.prototype,"__updateStrokeSpread",null),mt([lt(Ae.__updateRenderSpread)],Ce.prototype,"__updateRectRenderSpread",null),mt([lt(Ae.__updateBoxBounds)],Ce.prototype,"__updateRectBoxBounds",null),mt([lt(Ae.__updateStrokeBounds)],Ce.prototype,"__updateStrokeBounds",null),mt([lt(Ae.__updateRenderBounds)],Ce.prototype,"__updateRectRenderBounds",null),mt([lt(Ae.__updateChange)],Ce.prototype,"__updateRectChange",null),mt([lt(Ae.__render)],Ce.prototype,"__renderRect",null),mt([lt(Be.__render)],Ce.prototype,"__renderGroup",null),Ce=mt([N(),j()],Ce);let be=class extends Ce{get __tag(){return"Frame"}get isFrame(){return!0}};mt([v(qt)],be.prototype,"__",void 0),mt([w("#FFFFFF")],be.prototype,"fill",void 0),mt([D("hide")],be.prototype,"overflow",void 0),be=mt([j()],be);const{moveTo:Pe,closePath:Fe,ellipse:We}=pt,{tempPoint:Ie,set:De,rotate:Ee}=ut,{abs:Te}=Math,Le={};let ze=class extends ye{get __tag(){return"Ellipse"}__updatePath(){const t=this.__,{width:e,height:i,innerRadius:s,startAngle:o,endAngle:r,closed:a}=t,n=e/2,_=i/2,h=t.path=[];let d,l,p;if((o||r)&&(l=!0),l&&(p=360===Te(r-o)),s){const t=s<1||a;let i,u=o,c=r;l?t?(We(h,n,_,n*s,_*s,0,o,r),p&&(De(Ie,e,_),De(Le,n,_),Ee(Ie,r,Le,n,_),Pe(h,Ie.x,Ie.y)),u=r,c=o,i=!0):p||(d=!0):t?(We(h,n,_,n*s,_*s),Fe(h),Pe(h,e,_),u=360,i=!0):c=360,We(h,n,_,n,_,0,u,c,i)}else l?(p||Pe(h,n,_),We(h,n,_,n,_,0,o,r)):We(h,n,_,n,_);d||Fe(h),(ct.ellipseToCurve||t.__useArrow||t.cornerRadius)&&(t.path=this.getPath(!0))}};mt([v(Zt)],ze.prototype,"__",void 0),mt([T(0)],ze.prototype,"innerRadius",void 0),mt([T(0)],ze.prototype,"startAngle",void 0),mt([T(0)],ze.prototype,"endAngle",void 0),ze=mt([j()],ze);const{sin:Me,cos:Oe,PI:Ne}=Math,{moveTo:He,lineTo:Ve,closePath:Ye,drawPoints:Ue}=pt;let Xe=class extends ye{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Ue(e,t.points,t.curve,t.closed);else{const{width:i,height:s,sides:o,startAngle:r}=t,a=i/2,n=s/2;let _,h=0;r?(h=r*gt,He(e,a+a*Me(h),n-n*Oe(h))):He(e,a,0);for(let t=1;t<o;t++)_=2*t*Ne/o+h,Ve(e,a+a*Me(_),n-n*Oe(_));Ye(e)}}};mt([v(te)],Xe.prototype,"__",void 0),mt([T(3)],Xe.prototype,"sides",void 0),mt([T(0)],Xe.prototype,"startAngle",void 0),mt([T()],Xe.prototype,"points",void 0),mt([T(0)],Xe.prototype,"curve",void 0),Xe=mt([N(),j()],Xe);const{sin:Je,cos:je,PI:Ge}=Math,{moveTo:$e,lineTo:qe,closePath:Ke}=pt;let Qe=class extends ye{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s,startAngle:o}=this.__,r=t/2,a=e/2,n=this.__.path=[];let _,h=0;o?(h=o*gt,$e(n,r+r*Je(h),a-a*je(h))):$e(n,r,0);for(let t=1;t<2*i;t++)_=t*Ge/i+h,qe(n,r+(t%2==0?r:r*s)*Je(_),a-(t%2==0?a:a*s)*je(_));Ke(n)}};mt([v(ee)],Qe.prototype,"__",void 0),mt([T(5)],Qe.prototype,"corners",void 0),mt([T(.382)],Qe.prototype,"innerRadius",void 0),mt([T(0)],Qe.prototype,"startAngle",void 0),Qe=mt([j()],Qe);const{moveTo:Ze,lineTo:ti,drawPoints:ei}=pt,{rotate:ii,getAngle:si,getDistance:oi,defaultPoint:ri}=ut;let ai=class extends ye{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=vt();return t&&(i.x=t),e&&ii(i,e),i}set toPoint(t){this.width=oi(ri,t),this.rotation=si(ri,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?ei(e,t.points,t.curve,t.closed):(Ze(e,0,0),ti(e,this.width,0))}};mt([v(Kt)],ai.prototype,"__",void 0),mt([yt("center")],ai.prototype,"strokeAlign",void 0),mt([C(0)],ai.prototype,"height",void 0),mt([T()],ai.prototype,"points",void 0),mt([T(0)],ai.prototype,"curve",void 0),mt([T(!1)],ai.prototype,"closed",void 0),ai=mt([j()],ai);let ni=class extends Se{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return u(t)&&t[0].image}};mt([v(ae)],ni.prototype,"__",void 0),mt([C("")],ni.prototype,"url",void 0),ni=mt([j()],ni);const _i=ni;let hi=class extends Se{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 ft({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new wt(wt.LOADED,{image:t}))})}draw(t,e,i,s){const o=new xt(t.worldTransform).invert(),r=new xt;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()}};mt([v(ne)],hi.prototype,"__",void 0),mt([Rt(100)],hi.prototype,"width",void 0),mt([Rt(100)],hi.prototype,"height",void 0),mt([Rt(1)],hi.prototype,"pixelRatio",void 0),mt([Rt(!0)],hi.prototype,"smooth",void 0),mt([f(!1)],hi.prototype,"safeResize",void 0),mt([Rt()],hi.prototype,"contextSettings",void 0),hi=mt([j()],hi);const{copyAndSpread:di,includes:li,setList:pi}=dt,{stintSet:ui}=n;let ci=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:_,padding:h,width:d,height:l}=t;t.__lineHeight=Pt.number(e,o),t.__letterSpacing=Pt.number(i,o),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"}`,ui(t,"__padding",h&&V.fourNumber(h)),ui(t,"__clipText","show"!==_&&!t.__autoSize),ui(t,"__isCharMode",d||l||t.__letterSpacing||"none"!==n),t.__textDrawData=Ct.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:_}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=_,t.__lineHeight<i&&(e.renderChanged=!0),r||a){if(h.x=r?_.x:0,h.y=a?_.y:0,h.width=r?_.width:t.width,h.height=a?_.height:t.height,o){const[e,i,s,o]=t.__padding;r&&(h.x-=o,h.width+=i+o),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),n.stintSet(this,"isOverflow",!li(h,_)),this.isOverflow?(pi(t.__textBoxBounds={},[h,_]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();t||(t=this.isOverflow?1:0);const{__lineHeight:e,fontSize:i}=this.__;return e<i&&(t=y.max(t,(i-e)/2)),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;di(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()}};mt([v(re)],ci.prototype,"__",void 0),mt([C(0)],ci.prototype,"width",void 0),mt([C(0)],ci.prototype,"height",void 0),mt([w()],ci.prototype,"boxStyle",void 0),mt([f(!1)],ci.prototype,"resizeFontSize",void 0),mt([w("#000000")],ci.prototype,"fill",void 0),mt([yt("outside")],ci.prototype,"strokeAlign",void 0),mt([L("all")],ci.prototype,"hitFill",void 0),mt([C("")],ci.prototype,"text",void 0),mt([C("")],ci.prototype,"placeholder",void 0),mt([C("caption")],ci.prototype,"fontFamily",void 0),mt([C(12)],ci.prototype,"fontSize",void 0),mt([C("normal")],ci.prototype,"fontWeight",void 0),mt([C(!1)],ci.prototype,"italic",void 0),mt([C("none")],ci.prototype,"textCase",void 0),mt([C("none")],ci.prototype,"textDecoration",void 0),mt([C(0)],ci.prototype,"letterSpacing",void 0),mt([C({type:"percent",value:1.5})],ci.prototype,"lineHeight",void 0),mt([C(0)],ci.prototype,"paraIndent",void 0),mt([C(0)],ci.prototype,"paraSpacing",void 0),mt([C("x")],ci.prototype,"writingMode",void 0),mt([C("left")],ci.prototype,"textAlign",void 0),mt([C("top")],ci.prototype,"verticalAlign",void 0),mt([C(!0)],ci.prototype,"autoSizeAlign",void 0),mt([C("normal")],ci.prototype,"textWrap",void 0),mt([C("show")],ci.prototype,"textOverflow",void 0),mt([w(!1)],ci.prototype,"textEditing",void 0),ci=mt([j()],ci);let gi=class extends ye{get __tag(){return"Path"}};mt([v(ie)],gi.prototype,"__",void 0),mt([yt("center")],gi.prototype,"strokeAlign",void 0),gi=mt([j()],gi);let yi=class extends ve{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new gi(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}paint(){const{pathElement:t}=this;t.__layout.boxChanged||t.forceUpdate("path")}};mt([v(se)],yi.prototype,"__",void 0),mt([(e,i)=>{t(e,i,{get(){return this.__path}})}],yi.prototype,"path",void 0),yi=mt([O(St,["set","path","paint"]),j()],yi);export{Ce as Box,Gt as BoxData,hi as Canvas,ne as CanvasData,bt as ColorConvert,Et as Effect,ze as Ellipse,Zt as EllipseData,Lt as Export,Tt as Filter,be as Frame,qt as FrameData,ve as Group,jt as GroupData,ni as Image,ae as ImageData,xe as Leafer,$t as LeaferData,ai as Line,Kt as LineData,_i as MyImage,Wt as Paint,Dt as PaintGradient,It as PaintImage,gi as Path,Ft as PathArrow,ie as PathData,yi as Pen,se as PenData,Xe as Polygon,te as PolygonData,Se as Rect,Qt as RectData,ce as RectRender,Qe as Star,ee as StarData,zt as State,ci as Text,Ct as TextConvert,re as TextData,Mt as Transition,ye as UI,de as UIBounds,Xt as UIData,pe as UIRender,Pt as UnitConvert,Bt as createAttr,kt as effectType,Rt as resizeType,At as zoomLayerType};
2
2
  //# sourceMappingURL=draw.esm.min.js.map