@leafer-ui/draw 1.9.3 → 1.9.4
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 +6 -11
- package/lib/draw.esm.js +6 -11
- package/lib/draw.esm.min.js +1 -1
- package/lib/draw.esm.min.js.map +1 -1
- package/lib/draw.min.cjs +1 -1
- package/lib/draw.min.cjs.map +1 -1
- package/package.json +6 -6
package/lib/draw.cjs
CHANGED
|
@@ -1387,29 +1387,24 @@ exports.Box = class Box extends exports.Group {
|
|
|
1387
1387
|
}
|
|
1388
1388
|
__updateStrokeBounds() {}
|
|
1389
1389
|
__updateRenderBounds() {
|
|
1390
|
-
let isOverflow;
|
|
1390
|
+
let isOverflow, isScrollMode;
|
|
1391
1391
|
if (this.children.length) {
|
|
1392
|
-
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
1392
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
|
|
1393
1393
|
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = core.getBoundsData());
|
|
1394
1394
|
super.__updateRenderBounds(childrenRenderBounds);
|
|
1395
|
-
if (
|
|
1395
|
+
if (isScrollMode = overflow.includes("scroll")) {
|
|
1396
1396
|
add(childrenRenderBounds, boxBounds);
|
|
1397
1397
|
scroll(childrenRenderBounds, data);
|
|
1398
1398
|
}
|
|
1399
1399
|
this.__updateRectRenderBounds();
|
|
1400
1400
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
1401
|
-
if (isOverflow &&
|
|
1401
|
+
if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
1402
1402
|
} else this.__updateRectRenderBounds();
|
|
1403
1403
|
core.DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
1404
|
-
this.__checkScroll();
|
|
1404
|
+
this.__checkScroll(isScrollMode);
|
|
1405
1405
|
}
|
|
1406
1406
|
__updateRectRenderBounds() {}
|
|
1407
|
-
|
|
1408
|
-
if (this.hasScroller) this.__updateScroll();
|
|
1409
|
-
super.__updateWorldBounds();
|
|
1410
|
-
}
|
|
1411
|
-
__checkScroll() {}
|
|
1412
|
-
__updateScroll() {}
|
|
1407
|
+
__checkScroll(_isScrollMode) {}
|
|
1413
1408
|
__updateRectChange() {}
|
|
1414
1409
|
__updateChange() {
|
|
1415
1410
|
super.__updateChange();
|
package/lib/draw.esm.js
CHANGED
|
@@ -1387,29 +1387,24 @@ let Box = class Box extends Group {
|
|
|
1387
1387
|
}
|
|
1388
1388
|
__updateStrokeBounds() {}
|
|
1389
1389
|
__updateRenderBounds() {
|
|
1390
|
-
let isOverflow;
|
|
1390
|
+
let isOverflow, isScrollMode;
|
|
1391
1391
|
if (this.children.length) {
|
|
1392
|
-
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
1392
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
|
|
1393
1393
|
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
|
|
1394
1394
|
super.__updateRenderBounds(childrenRenderBounds);
|
|
1395
|
-
if (
|
|
1395
|
+
if (isScrollMode = overflow.includes("scroll")) {
|
|
1396
1396
|
add(childrenRenderBounds, boxBounds);
|
|
1397
1397
|
scroll(childrenRenderBounds, data);
|
|
1398
1398
|
}
|
|
1399
1399
|
this.__updateRectRenderBounds();
|
|
1400
1400
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
1401
|
-
if (isOverflow &&
|
|
1401
|
+
if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
1402
1402
|
} else this.__updateRectRenderBounds();
|
|
1403
1403
|
DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
1404
|
-
this.__checkScroll();
|
|
1404
|
+
this.__checkScroll(isScrollMode);
|
|
1405
1405
|
}
|
|
1406
1406
|
__updateRectRenderBounds() {}
|
|
1407
|
-
|
|
1408
|
-
if (this.hasScroller) this.__updateScroll();
|
|
1409
|
-
super.__updateWorldBounds();
|
|
1410
|
-
}
|
|
1411
|
-
__checkScroll() {}
|
|
1412
|
-
__updateScroll() {}
|
|
1407
|
+
__checkScroll(_isScrollMode) {}
|
|
1413
1408
|
__updateRectChange() {}
|
|
1414
1409
|
__updateChange() {
|
|
1415
1410
|
super.__updateChange();
|
package/lib/draw.esm.min.js
CHANGED
|
@@ -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 _,LeafData as h,isString as d,isUndefined as l,isArray as p,canvasSizeAttrs as u,UICreator as c,MathHelper as y,dataProcessor as g,dataType as v,surfaceType as f,opacityType as w,visibleType as x,sortType as S,maskType as m,eraserType as R,positionType as k,boundsType as B,scaleType as b,rotationType as A,scrollType as C,autoLayoutType as P,naturalBoundsType as F,affectRenderBoundsType as W,pathInputType as E,pathType as T,hitType as I,strokeType as D,cursorType as z,rewrite as L,Leaf as M,useModule as O,rewriteAble as N,pen as V,PathCorner as H,PathDrawer as Y,isNumber as U,registerUI as j,Branch as X,LeafList as J,Resource as q,getBoundsData as G,Creator as $,CanvasManager as K,WaitHelper as Q,LeaferEvent as Z,Bounds 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 _t,PathCommandDataHelper as ht,Platform as dt,PointHelper as lt,PathBounds as pt,affectStrokeBoundsType as ut,getPointData as ct,LeaferImage as yt,ImageEvent as gt,Matrix as vt,PathCreator as ft}from"@leafer/core";export*from"@leafer/core";function wt(t,e,i,s){var o,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(r<3?o(a):r>3?o(e,i,a):o(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a}function xt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function St(t){return e(t,t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function mt(){return(e,i)=>{const s="_"+i;t(e,i,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}function Rt(e){return(i,o)=>{t(i,o,s(o,e))}}"function"==typeof SuppressedError&&SuppressedError;const kt={},Bt={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},bt={number:(t,e)=>r(t)?"percent"===t.type?t.value*e:t.value:t},At={},Ct={},Pt={},Ft={},Wt={},Et={apply(){o.need("filter")}},Tt={},It={setStyleName:()=>o.need("state"),set:()=>o.need("state")},Dt={list:{},register(t,e){Dt.list[t]=e},get:t=>Dt.list[t]},{parse:zt,objectToCanvasData:Lt}=a,{stintSet:Mt}=n,{hasTransparent:Ot}=Bt,Nt={},Vt=_.get("UIData");class Ht 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;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Vt.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Vt.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),d(t)||!t?(Mt(this,"__isTransparentFill",Ot(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):r(t)&&this.__setPaint("fill",t)}setStroke(t){d(t)||!t?(Mt(this,"__isTransparentStroke",Ot(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):r(t)&&this.__setPaint("stroke",t)}setPath(t){const e=d(t);e||t&&r(t[0])?(this.__setInput("path",t),this._path=e?zt(t):Lt(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Yt(this,"shadow",t)}setInnerShadow(t){Yt(this,"innerShadow",t)}setFilter(t){Yt(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Ct.compute("fill",this.__leaf),e&&Ct.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),l(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),p(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Nt)):(this.__isStrokes=!0,this._stroke||(this._stroke=Nt))}__removePaint(t,e){e&&this.__removeInput(t),Pt.recycleImage(t,this),"fill"===t?(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 Yt(t,e,i){t.__setInput(e,i),p(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class Ut extends Ht{}class jt extends Ut{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Xt extends Ut{__getInputData(t,e){const i=super.__getInputData(t,e);return u.forEach(t=>delete i[t]),i}}class Jt extends jt{}class qt extends Ht{}class Gt extends Ht{get __boxStroke(){return!this.__pathInputed}}class $t extends Ht{get __boxStroke(){return!this.__pathInputed}}class Kt extends Ht{}class Qt extends Ht{}class Zt extends Ht{get __pathInputed(){return 2}}class te extends Ut{}const ee={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ie extends Ht{get __useNaturalRatio(){return!1}setFontWeight(t){d(t)?(this.__setInput("fontWeight",t),t=ee[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=c.get("Rect",0);const o=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=o.boxBounds),i.set(t),r.strokeChanged&&o.strokeChange(),r.renderChanged&&o.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class se extends Gt{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class oe extends Gt{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const re={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),r&&(t=Math.max(r.__layout.strokeSpread=r.__updateStrokeSpread(),t),e=r.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:r,renderSpread:a}=this.__;e&&e.forEach(e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)),s&&(t=Math.max(t,s)),r&&(t+=Et.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}},ae={getValidMove(t,e,i,s,o){const r=t.x+s.x,a=t.y+s.y,n=r+t.width,_=a+t.height,h=e.x+e.width,d=e.y+e.height;o||(s=Object.assign({},s));const l=t.width>e.width,p=t.height>e.height;return l&&"outer"!==i?r>e.x?s.x+=e.x-r:n<h&&(s.x+=h-n):r<e.x?s.x+=e.x-r:n>h&&(s.x+=h-n),p&&"outer"!==i?a>e.y?s.y+=e.y-a:_<d&&(s.y+=d-_):a<e.y?s.y+=e.y-a:_>d&&(s.y+=d-_),s.x=y.float(s.x),s.y=y.float(s.y),s},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&ne.getValidMove(t.__localBoxBounds,"parent"===i?t.parent.boxBounds:i,s,e,!0),ne.axisMove(t,e)}},ne=ae,{stintSet:_e}=n,he={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);_e(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),_e(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;_e(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&i&&!t.__isTransparentFill&&!(p(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),_e(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){de(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 _=Ct.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:d,filter:l}=s;h&&Wt.shadow(this,t,_),n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t)),o&&(s.__isFills?Ct.fills(o,this,t):Ct.fill(o,this,t)),a&&this.__drawAfterFill(t,e),d&&Wt.innerShadow(this,t,_),r&&!n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t)),l&&Et.apply(l,this,this.__nowWorld,t,i,_),_.worldCanvas&&_.worldCanvas.recycle(),_.canvas.recycle()}else{if(n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t)),_){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,Bt.string(e.color))}o&&(s.__isFills?Ct.fills(o,this,t):Ct.fill(o,this,t)),_&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t))}}else s.__pathInputed?de(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Ct.fills(s,this,t):Ct.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Ct.strokes(o,this,t):Ct.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function de(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Ct.stroke(o,t,e),s&&Ct.fill(s,t,e),r&&t.__drawAfterFill(e,i),o&&!a&&Ct.stroke(o,t,e)}const le={__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 pe;let ue=pe=class extends M{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 V.set(this.path=t||[]),t||this.__drawPathByBox(V),V}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):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||(V.set(i=[]),this.__drawPathByBox(V)),t?a.toCanvasData(i,!0):i}getPathString(t,e,i){return a.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Tt.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?H.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&At.addArrows(this,!t.cornerRadius)):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?Y.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,U(r)?[r]:r)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){Ct.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return 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),pe.one(e)}static one(t,e,i,s,o){return c.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){j()(this)}static registerData(t){g(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};wt([g(Ht)],ue.prototype,"__",void 0),wt([mt()],ue.prototype,"zoomLayer",void 0),wt([v("")],ue.prototype,"id",void 0),wt([v("")],ue.prototype,"name",void 0),wt([v("")],ue.prototype,"className",void 0),wt([f("pass-through")],ue.prototype,"blendMode",void 0),wt([w(1)],ue.prototype,"opacity",void 0),wt([x(!0)],ue.prototype,"visible",void 0),wt([f(!1)],ue.prototype,"locked",void 0),wt([f(!1)],ue.prototype,"dim",void 0),wt([f(!1)],ue.prototype,"dimskip",void 0),wt([S(0)],ue.prototype,"zIndex",void 0),wt([m(!1)],ue.prototype,"mask",void 0),wt([R(!1)],ue.prototype,"eraser",void 0),wt([k(0,!0)],ue.prototype,"x",void 0),wt([k(0,!0)],ue.prototype,"y",void 0),wt([B(100,!0)],ue.prototype,"width",void 0),wt([B(100,!0)],ue.prototype,"height",void 0),wt([b(1,!0)],ue.prototype,"scaleX",void 0),wt([b(1,!0)],ue.prototype,"scaleY",void 0),wt([A(0,!0)],ue.prototype,"rotation",void 0),wt([A(0,!0)],ue.prototype,"skewX",void 0),wt([A(0,!0)],ue.prototype,"skewY",void 0),wt([k(0,!0)],ue.prototype,"offsetX",void 0),wt([k(0,!0)],ue.prototype,"offsetY",void 0),wt([C(0,!0)],ue.prototype,"scrollX",void 0),wt([C(0,!0)],ue.prototype,"scrollY",void 0),wt([P()],ue.prototype,"origin",void 0),wt([P()],ue.prototype,"around",void 0),wt([v(!1)],ue.prototype,"lazy",void 0),wt([F(1)],ue.prototype,"pixelRatio",void 0),wt([W(0)],ue.prototype,"renderSpread",void 0),wt([E()],ue.prototype,"path",void 0),wt([T()],ue.prototype,"windingRule",void 0),wt([T(!0)],ue.prototype,"closed",void 0),wt([B(0)],ue.prototype,"padding",void 0),wt([B(!1)],ue.prototype,"lockRatio",void 0),wt([B()],ue.prototype,"widthRange",void 0),wt([B()],ue.prototype,"heightRange",void 0),wt([v(!1)],ue.prototype,"draggable",void 0),wt([v()],ue.prototype,"dragBounds",void 0),wt([v("auto")],ue.prototype,"dragBoundsType",void 0),wt([v(!1)],ue.prototype,"editable",void 0),wt([I(!0)],ue.prototype,"hittable",void 0),wt([I("path")],ue.prototype,"hitFill",void 0),wt([D("path")],ue.prototype,"hitStroke",void 0),wt([I(!1)],ue.prototype,"hitBox",void 0),wt([I(!0)],ue.prototype,"hitChildren",void 0),wt([I(!0)],ue.prototype,"hitSelf",void 0),wt([I()],ue.prototype,"hitRadius",void 0),wt([z("")],ue.prototype,"cursor",void 0),wt([f()],ue.prototype,"fill",void 0),wt([D(void 0,!0)],ue.prototype,"stroke",void 0),wt([D("inside")],ue.prototype,"strokeAlign",void 0),wt([D(1,!0)],ue.prototype,"strokeWidth",void 0),wt([D(!1)],ue.prototype,"strokeWidthFixed",void 0),wt([D("none")],ue.prototype,"strokeCap",void 0),wt([D("miter")],ue.prototype,"strokeJoin",void 0),wt([D()],ue.prototype,"dashPattern",void 0),wt([D(0)],ue.prototype,"dashOffset",void 0),wt([D(10)],ue.prototype,"miterLimit",void 0),wt([T(0)],ue.prototype,"cornerRadius",void 0),wt([T()],ue.prototype,"cornerSmoothing",void 0),wt([xt()],ue.prototype,"shadow",void 0),wt([xt()],ue.prototype,"innerShadow",void 0),wt([xt()],ue.prototype,"blur",void 0),wt([xt()],ue.prototype,"backgroundBlur",void 0),wt([xt()],ue.prototype,"grayscale",void 0),wt([xt()],ue.prototype,"filter",void 0),wt([f()],ue.prototype,"placeholderColor",void 0),wt([v(100)],ue.prototype,"placeholderDelay",void 0),wt([v({})],ue.prototype,"data",void 0),wt([L(M.prototype.reset)],ue.prototype,"reset",null),ue=pe=wt([O(re),O(he),N()],ue);let ce=class extends ue{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}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 ye;wt([g(Ut)],ce.prototype,"__",void 0),wt([B(0)],ce.prototype,"width",void 0),wt([B(0)],ce.prototype,"height",void 0),ce=wt([O(X),j()],ce);const ge=_.get("Leafer");let ve=ye=class extends ce{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 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)||G()}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),ye.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=$.canvas(s);this.__controllers.push(this.renderer=$.renderer(this,o,s),this.watcher=$.watcher(this,s),this.layouter=$.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=o.view,e||(this.selector=$.selector(this),this.interaction=$.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=$.hitCanvasManager()),this.canvasManager=new K,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))),Q.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(Z.RESTART):this.emitLeafer(Z.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(Z.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 tt(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(t,e){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()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&u.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=n.copyAttrs({},this.canvas,u);i[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(i)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Z.BEFORE_READY),this.emitLeafer(Z.READY),this.emitLeafer(Z.AFTER_READY),Q.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Z.VIEW_READY),Q.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){Q.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(Z.VIEW_COMPLETED),Q.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 Z(t,this))}__listenEvents(){const t=st.start("FirstCreate "+this.innerName);this.once([[Z.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){ye.list.remove(this);try{this.stop(),this.emitLeafer(Z.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.destroy()),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){ge.error(t)}}};t?e():setTimeout(e)}};ve.list=new J,wt([g(Xt)],ve.prototype,"__",void 0),wt([B()],ve.prototype,"pixelRatio",void 0),ve=ye=wt([j()],ve);let fe=class extends ue{get __tag(){return"Rect"}constructor(t){super(t)}};wt([g(Gt)],fe.prototype,"__",void 0),fe=wt([O(le),N(),j()],fe);const{add:we,includes:xe,scroll:Se}=_t,me=fe.prototype,Re=ce.prototype;let ke=class extends ce{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;if(this.children.length){const e=this.__,i=this.__layout,{renderBounds:s,boxBounds:o}=i,r=i.childrenRenderBounds||(i.childrenRenderBounds=G());super.__updateRenderBounds(r),e.overflow.includes("scroll")&&(we(r,o),Se(r,e)),this.__updateRectRenderBounds(),t=!xe(o,r),t&&"show"===e.overflow&&we(s,r)}else this.__updateRectRenderBounds();n.stintSet(this,"isOverflow",t),this.__checkScroll()}__updateRectRenderBounds(){}__updateWorldBounds(){this.hasScroller&&this.__updateScroll(),super.__updateWorldBounds()}__checkScroll(){}__updateScroll(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};wt([g(jt)],ke.prototype,"__",void 0),wt([B(100)],ke.prototype,"width",void 0),wt([B(100)],ke.prototype,"height",void 0),wt([v(!1)],ke.prototype,"resizeChildren",void 0),wt([W("show")],ke.prototype,"overflow",void 0),wt([L(me.__updateStrokeSpread)],ke.prototype,"__updateStrokeSpread",null),wt([L(me.__updateRenderSpread)],ke.prototype,"__updateRectRenderSpread",null),wt([L(me.__updateBoxBounds)],ke.prototype,"__updateRectBoxBounds",null),wt([L(me.__updateStrokeBounds)],ke.prototype,"__updateStrokeBounds",null),wt([L(me.__updateRenderBounds)],ke.prototype,"__updateRectRenderBounds",null),wt([L(me.__updateChange)],ke.prototype,"__updateRectChange",null),wt([L(me.__render)],ke.prototype,"__renderRect",null),wt([L(Re.__render)],ke.prototype,"__renderGroup",null),ke=wt([N(),j()],ke);let Be=class extends ke{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};wt([g(Jt)],Be.prototype,"__",void 0),wt([f("#FFFFFF")],Be.prototype,"fill",void 0),wt([W("hide")],Be.prototype,"overflow",void 0),Be=wt([j()],Be);const{moveTo:be,closePath:Ae,ellipse:Ce}=ht;let Pe=class extends ue{get __tag(){return"Ellipse"}constructor(t){super(t)}__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&&Ce(n,r,a,r*i,a*i,0,s,o,!1),Ce(n,r,a,r,a,0,o,s,!0),i<1&&Ae(n)):(i<1&&(Ce(n,r,a,r*i,a*i),be(n,t,a)),Ce(n,r,a,r,a,0,360,0,!0)),dt.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(be(n,r,a),Ce(n,r,a,r,a,0,s,o,!1),Ae(n)):Ce(n,r,a,r,a)}};wt([g($t)],Pe.prototype,"__",void 0),wt([T(0)],Pe.prototype,"innerRadius",void 0),wt([T(0)],Pe.prototype,"startAngle",void 0),wt([T(0)],Pe.prototype,"endAngle",void 0),Pe=wt([j()],Pe);const{moveTo:Fe,lineTo:We,drawPoints:Ee}=ht,{rotate:Te,getAngle:Ie,getDistance:De,defaultPoint:ze}=lt,{toBounds:Le}=pt;let Me=class extends ue{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=ct();return t&&(i.x=t),e&&Te(i,e),i}set toPoint(t){this.width=De(ze,t),this.rotation=Ie(ze,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Ee(e,t.points,!1,t.closed):(Fe(e,0,0),We(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Ee(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&At.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?Le(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};wt([g(qt)],Me.prototype,"__",void 0),wt([ut("center")],Me.prototype,"strokeAlign",void 0),wt([B(0)],Me.prototype,"height",void 0),wt([T()],Me.prototype,"points",void 0),wt([T(0)],Me.prototype,"curve",void 0),wt([T(!1)],Me.prototype,"closed",void 0),Me=wt([j()],Me);const{sin:Oe,cos:Ne,PI:Ve}=Math,{moveTo:He,lineTo:Ye,closePath:Ue,drawPoints:je}=ht,Xe=Me.prototype;let Je=class extends ue{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)je(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,o=e/2,r=i/2;He(t,o,0);for(let e=1;e<s;e++)Ye(t,o+o*Oe(2*e*Ve/s),r-r*Ne(2*e*Ve/s));Ue(t)}}__updateRenderPath(){}__updateBoxBounds(){}};wt([g(Kt)],Je.prototype,"__",void 0),wt([T(3)],Je.prototype,"sides",void 0),wt([T()],Je.prototype,"points",void 0),wt([T(0)],Je.prototype,"curve",void 0),wt([L(Xe.__updateRenderPath)],Je.prototype,"__updateRenderPath",null),wt([L(Xe.__updateBoxBounds)],Je.prototype,"__updateBoxBounds",null),Je=wt([N(),j()],Je);const{sin:qe,cos:Ge,PI:$e}=Math,{moveTo:Ke,lineTo:Qe,closePath:Ze}=ht;let ti=class extends ue{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,r=e/2,a=this.__.path=[];Ke(a,o,0);for(let t=1;t<2*i;t++)Qe(a,o+(t%2==0?o:o*s)*qe(t*$e/i),r-(t%2==0?r:r*s)*Ge(t*$e/i));Ze(a)}};wt([g(Qt)],ti.prototype,"__",void 0),wt([T(5)],ti.prototype,"corners",void 0),wt([T(.382)],ti.prototype,"innerRadius",void 0),ti=wt([j()],ti);let ei=class extends fe{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}constructor(t){super(t)}};wt([g(se)],ei.prototype,"__",void 0),wt([B("")],ei.prototype,"url",void 0),ei=wt([j()],ei);const ii=ei;let si=class extends fe{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=$.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 gt(gt.LOADED,{image:t}))})}draw(t,e,i,s){const o=new vt(t.worldTransform).invert(),r=new vt;e&&r.translate(e.x,e.y),i&&(U(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),o.multiplyParent(r),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};wt([g(oe)],si.prototype,"__",void 0),wt([St(100)],si.prototype,"width",void 0),wt([St(100)],si.prototype,"height",void 0),wt([St(1)],si.prototype,"pixelRatio",void 0),wt([St(!0)],si.prototype,"smooth",void 0),wt([v(!1)],si.prototype,"safeResize",void 0),wt([St()],si.prototype,"contextSettings",void 0),si=wt([j()],si);const{copyAndSpread:oi,includes:ri,spread:ai,setList:ni}=_t;let _i=class extends ue{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:r,italic:a,textCase:n,textOverflow:_,padding:h}=t;t.__lineHeight=bt.number(e,o),t.__letterSpacing=bt.number(i,o),t.__padding=h?y.fourNumber(h):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"!==_&&!t.__autoSize,t.__textDrawData=kt.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:r,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:_}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=_,t.__lineHeight<i&&ai(_,i/2),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",!ri(h,_)),this.isOverflow?(ni(t.__textBoxBounds={},[h,_]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;oi(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};wt([g(ie)],_i.prototype,"__",void 0),wt([B(0)],_i.prototype,"width",void 0),wt([B(0)],_i.prototype,"height",void 0),wt([f()],_i.prototype,"boxStyle",void 0),wt([v(!1)],_i.prototype,"resizeFontSize",void 0),wt([f("#000000")],_i.prototype,"fill",void 0),wt([ut("outside")],_i.prototype,"strokeAlign",void 0),wt([I("all")],_i.prototype,"hitFill",void 0),wt([B("")],_i.prototype,"text",void 0),wt([B("")],_i.prototype,"placeholder",void 0),wt([B("caption")],_i.prototype,"fontFamily",void 0),wt([B(12)],_i.prototype,"fontSize",void 0),wt([B("normal")],_i.prototype,"fontWeight",void 0),wt([B(!1)],_i.prototype,"italic",void 0),wt([B("none")],_i.prototype,"textCase",void 0),wt([B("none")],_i.prototype,"textDecoration",void 0),wt([B(0)],_i.prototype,"letterSpacing",void 0),wt([B({type:"percent",value:1.5})],_i.prototype,"lineHeight",void 0),wt([B(0)],_i.prototype,"paraIndent",void 0),wt([B(0)],_i.prototype,"paraSpacing",void 0),wt([B("x")],_i.prototype,"writingMode",void 0),wt([B("left")],_i.prototype,"textAlign",void 0),wt([B("top")],_i.prototype,"verticalAlign",void 0),wt([B(!0)],_i.prototype,"autoSizeAlign",void 0),wt([B("normal")],_i.prototype,"textWrap",void 0),wt([B("show")],_i.prototype,"textOverflow",void 0),wt([f(!1)],_i.prototype,"textEditing",void 0),_i=wt([j()],_i);let hi=class extends ue{get __tag(){return"Path"}constructor(t){super(t)}};wt([g(Zt)],hi.prototype,"__",void 0),wt([ut("center")],hi.prototype,"strokeAlign",void 0),hi=wt([j()],hi);let di=class extends ce{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new hi(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,r,a,n){return this}arc(t,e,i,s,o,r){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,r,a,n){return this}drawArc(t,e,i,s,o,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};wt([g(te)],di.prototype,"__",void 0),wt([(e,i)=>{t(e,i,{get(){return this.__path}})}],di.prototype,"path",void 0),di=wt([O(ft,["set","path","paint"]),j()],di);export{ke as Box,jt as BoxData,si as Canvas,oe as CanvasData,Bt as ColorConvert,ae as DragBoundsHelper,Wt as Effect,Pe as Ellipse,$t as EllipseData,Tt as Export,Et as Filter,Be as Frame,Jt as FrameData,ce as Group,Ut as GroupData,ei as Image,se as ImageData,ve as Leafer,Xt as LeaferData,Me as Line,qt as LineData,ii as MyImage,Ct as Paint,Ft as PaintGradient,Pt as PaintImage,hi as Path,At as PathArrow,Zt as PathData,di as Pen,te as PenData,Je as Polygon,Kt as PolygonData,fe as Rect,Gt as RectData,le as RectRender,ti as Star,Qt as StarData,It as State,_i as Text,kt as TextConvert,ie as TextData,Dt as Transition,ue as UI,re as UIBounds,Ht as UIData,he as UIRender,bt as UnitConvert,Rt as createAttr,xt as effectType,St as resizeType,mt 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 _,LeafData as h,isString as d,isUndefined as l,isArray as p,canvasSizeAttrs as u,UICreator as c,MathHelper as y,dataProcessor as g,dataType as v,surfaceType as f,opacityType as w,visibleType as x,sortType as S,maskType as m,eraserType as R,positionType as k,boundsType as B,scaleType as b,rotationType as A,scrollType as C,autoLayoutType as P,naturalBoundsType as F,affectRenderBoundsType as W,pathInputType as E,pathType as T,hitType as I,strokeType as D,cursorType as z,rewrite as L,Leaf as M,useModule as O,rewriteAble as N,pen as V,PathCorner as H,PathDrawer as Y,isNumber as U,registerUI as j,Branch as X,LeafList as J,Resource as q,getBoundsData as G,Creator as $,CanvasManager as K,WaitHelper as Q,LeaferEvent as Z,Bounds 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 _t,PathCommandDataHelper as ht,Platform as dt,PointHelper as lt,PathBounds as pt,affectStrokeBoundsType as ut,getPointData as ct,LeaferImage as yt,ImageEvent as gt,Matrix as vt,PathCreator as ft}from"@leafer/core";export*from"@leafer/core";function wt(t,e,i,s){var o,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(r<3?o(a):r>3?o(e,i,a):o(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a}function xt(t){return e(t,t=>i({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function St(t){return e(t,t=>i({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function mt(){return(e,i)=>{const s="_"+i;t(e,i,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}function Rt(e){return(i,o)=>{t(i,o,s(o,e))}}"function"==typeof SuppressedError&&SuppressedError;const kt={},Bt={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},bt={number:(t,e)=>r(t)?"percent"===t.type?t.value*e:t.value:t},At={},Ct={},Pt={},Ft={},Wt={},Et={apply(){o.need("filter")}},Tt={},It={setStyleName:()=>o.need("state"),set:()=>o.need("state")},Dt={list:{},register(t,e){Dt.list[t]=e},get:t=>Dt.list[t]},{parse:zt,objectToCanvasData:Lt}=a,{stintSet:Mt}=n,{hasTransparent:Ot}=Bt,Nt={},Vt=_.get("UIData");class Ht 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;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Vt.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Vt.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),d(t)||!t?(Mt(this,"__isTransparentFill",Ot(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):r(t)&&this.__setPaint("fill",t)}setStroke(t){d(t)||!t?(Mt(this,"__isTransparentStroke",Ot(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):r(t)&&this.__setPaint("stroke",t)}setPath(t){const e=d(t);e||t&&r(t[0])?(this.__setInput("path",t),this._path=e?zt(t):Lt(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Yt(this,"shadow",t)}setInnerShadow(t){Yt(this,"innerShadow",t)}setFilter(t){Yt(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Ct.compute("fill",this.__leaf),e&&Ct.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),l(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),p(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Nt)):(this.__isStrokes=!0,this._stroke||(this._stroke=Nt))}__removePaint(t,e){e&&this.__removeInput(t),Pt.recycleImage(t,this),"fill"===t?(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 Yt(t,e,i){t.__setInput(e,i),p(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class Ut extends Ht{}class jt extends Ut{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Xt extends Ut{__getInputData(t,e){const i=super.__getInputData(t,e);return u.forEach(t=>delete i[t]),i}}class Jt extends jt{}class qt extends Ht{}class Gt extends Ht{get __boxStroke(){return!this.__pathInputed}}class $t extends Ht{get __boxStroke(){return!this.__pathInputed}}class Kt extends Ht{}class Qt extends Ht{}class Zt extends Ht{get __pathInputed(){return 2}}class te extends Ut{}const ee={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ie extends Ht{get __useNaturalRatio(){return!1}setFontWeight(t){d(t)?(this.__setInput("fontWeight",t),t=ee[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=c.get("Rect",0);const o=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=o.boxBounds),i.set(t),r.strokeChanged&&o.strokeChange(),r.renderChanged&&o.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class se extends Gt{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class oe extends Gt{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const re={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),r&&(t=Math.max(r.__layout.strokeSpread=r.__updateStrokeSpread(),t),e=r.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:r,renderSpread:a}=this.__;e&&e.forEach(e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)),s&&(t=Math.max(t,s)),r&&(t+=Et.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}},ae={getValidMove(t,e,i,s,o){const r=t.x+s.x,a=t.y+s.y,n=r+t.width,_=a+t.height,h=e.x+e.width,d=e.y+e.height;o||(s=Object.assign({},s));const l=t.width>e.width,p=t.height>e.height;return l&&"outer"!==i?r>e.x?s.x+=e.x-r:n<h&&(s.x+=h-n):r<e.x?s.x+=e.x-r:n>h&&(s.x+=h-n),p&&"outer"!==i?a>e.y?s.y+=e.y-a:_<d&&(s.y+=d-_):a<e.y?s.y+=e.y-a:_>d&&(s.y+=d-_),s.x=y.float(s.x),s.y=y.float(s.y),s},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&ne.getValidMove(t.__localBoxBounds,"parent"===i?t.parent.boxBounds:i,s,e,!0),ne.axisMove(t,e)}},ne=ae,{stintSet:_e}=n,he={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);_e(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),_e(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;_e(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&i&&!t.__isTransparentFill&&!(p(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),_e(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){de(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 _=Ct.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:h,innerShadow:d,filter:l}=s;h&&Wt.shadow(this,t,_),n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t)),o&&(s.__isFills?Ct.fills(o,this,t):Ct.fill(o,this,t)),a&&this.__drawAfterFill(t,e),d&&Wt.innerShadow(this,t,_),r&&!n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t)),l&&Et.apply(l,this,this.__nowWorld,t,i,_),_.worldCanvas&&_.worldCanvas.recycle(),_.canvas.recycle()}else{if(n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t)),_){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,Bt.string(e.color))}o&&(s.__isFills?Ct.fills(o,this,t):Ct.fill(o,this,t)),_&&t.restore(),a&&this.__drawAfterFill(t,e),r&&!n&&(s.__isStrokes?Ct.strokes(r,this,t):Ct.stroke(r,this,t))}}else s.__pathInputed?de(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Ct.fills(s,this,t):Ct.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Ct.strokes(o,this,t):Ct.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function de(t,e,i){const{fill:s,stroke:o,__drawAfterFill:r,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Ct.stroke(o,t,e),s&&Ct.fill(s,t,e),r&&t.__drawAfterFill(e,i),o&&!a&&Ct.stroke(o,t,e)}const le={__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 pe;let ue=pe=class extends M{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 V.set(this.path=t||[]),t||this.__drawPathByBox(V),V}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):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||(V.set(i=[]),this.__drawPathByBox(V)),t?a.toCanvasData(i,!0):i}getPathString(t,e,i){return a.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Tt.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?H.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&At.addArrows(this,!t.cornerRadius)):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?Y.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,U(r)?[r]:r)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){Ct.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return 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),pe.one(e)}static one(t,e,i,s,o){return c.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){j()(this)}static registerData(t){g(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};wt([g(Ht)],ue.prototype,"__",void 0),wt([mt()],ue.prototype,"zoomLayer",void 0),wt([v("")],ue.prototype,"id",void 0),wt([v("")],ue.prototype,"name",void 0),wt([v("")],ue.prototype,"className",void 0),wt([f("pass-through")],ue.prototype,"blendMode",void 0),wt([w(1)],ue.prototype,"opacity",void 0),wt([x(!0)],ue.prototype,"visible",void 0),wt([f(!1)],ue.prototype,"locked",void 0),wt([f(!1)],ue.prototype,"dim",void 0),wt([f(!1)],ue.prototype,"dimskip",void 0),wt([S(0)],ue.prototype,"zIndex",void 0),wt([m(!1)],ue.prototype,"mask",void 0),wt([R(!1)],ue.prototype,"eraser",void 0),wt([k(0,!0)],ue.prototype,"x",void 0),wt([k(0,!0)],ue.prototype,"y",void 0),wt([B(100,!0)],ue.prototype,"width",void 0),wt([B(100,!0)],ue.prototype,"height",void 0),wt([b(1,!0)],ue.prototype,"scaleX",void 0),wt([b(1,!0)],ue.prototype,"scaleY",void 0),wt([A(0,!0)],ue.prototype,"rotation",void 0),wt([A(0,!0)],ue.prototype,"skewX",void 0),wt([A(0,!0)],ue.prototype,"skewY",void 0),wt([k(0,!0)],ue.prototype,"offsetX",void 0),wt([k(0,!0)],ue.prototype,"offsetY",void 0),wt([C(0,!0)],ue.prototype,"scrollX",void 0),wt([C(0,!0)],ue.prototype,"scrollY",void 0),wt([P()],ue.prototype,"origin",void 0),wt([P()],ue.prototype,"around",void 0),wt([v(!1)],ue.prototype,"lazy",void 0),wt([F(1)],ue.prototype,"pixelRatio",void 0),wt([W(0)],ue.prototype,"renderSpread",void 0),wt([E()],ue.prototype,"path",void 0),wt([T()],ue.prototype,"windingRule",void 0),wt([T(!0)],ue.prototype,"closed",void 0),wt([B(0)],ue.prototype,"padding",void 0),wt([B(!1)],ue.prototype,"lockRatio",void 0),wt([B()],ue.prototype,"widthRange",void 0),wt([B()],ue.prototype,"heightRange",void 0),wt([v(!1)],ue.prototype,"draggable",void 0),wt([v()],ue.prototype,"dragBounds",void 0),wt([v("auto")],ue.prototype,"dragBoundsType",void 0),wt([v(!1)],ue.prototype,"editable",void 0),wt([I(!0)],ue.prototype,"hittable",void 0),wt([I("path")],ue.prototype,"hitFill",void 0),wt([D("path")],ue.prototype,"hitStroke",void 0),wt([I(!1)],ue.prototype,"hitBox",void 0),wt([I(!0)],ue.prototype,"hitChildren",void 0),wt([I(!0)],ue.prototype,"hitSelf",void 0),wt([I()],ue.prototype,"hitRadius",void 0),wt([z("")],ue.prototype,"cursor",void 0),wt([f()],ue.prototype,"fill",void 0),wt([D(void 0,!0)],ue.prototype,"stroke",void 0),wt([D("inside")],ue.prototype,"strokeAlign",void 0),wt([D(1,!0)],ue.prototype,"strokeWidth",void 0),wt([D(!1)],ue.prototype,"strokeWidthFixed",void 0),wt([D("none")],ue.prototype,"strokeCap",void 0),wt([D("miter")],ue.prototype,"strokeJoin",void 0),wt([D()],ue.prototype,"dashPattern",void 0),wt([D(0)],ue.prototype,"dashOffset",void 0),wt([D(10)],ue.prototype,"miterLimit",void 0),wt([T(0)],ue.prototype,"cornerRadius",void 0),wt([T()],ue.prototype,"cornerSmoothing",void 0),wt([xt()],ue.prototype,"shadow",void 0),wt([xt()],ue.prototype,"innerShadow",void 0),wt([xt()],ue.prototype,"blur",void 0),wt([xt()],ue.prototype,"backgroundBlur",void 0),wt([xt()],ue.prototype,"grayscale",void 0),wt([xt()],ue.prototype,"filter",void 0),wt([f()],ue.prototype,"placeholderColor",void 0),wt([v(100)],ue.prototype,"placeholderDelay",void 0),wt([v({})],ue.prototype,"data",void 0),wt([L(M.prototype.reset)],ue.prototype,"reset",null),ue=pe=wt([O(re),O(he),N()],ue);let ce=class extends ue{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}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 ye;wt([g(Ut)],ce.prototype,"__",void 0),wt([B(0)],ce.prototype,"width",void 0),wt([B(0)],ce.prototype,"height",void 0),ce=wt([O(X),j()],ce);const ge=_.get("Leafer");let ve=ye=class extends ce{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 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)||G()}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),ye.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=$.canvas(s);this.__controllers.push(this.renderer=$.renderer(this,o,s),this.watcher=$.watcher(this,s),this.layouter=$.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=o.view,e||(this.selector=$.selector(this),this.interaction=$.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=$.hitCanvasManager()),this.canvasManager=new K,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))),Q.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(Z.RESTART):this.emitLeafer(Z.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(Z.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 tt(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(t,e){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()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&u.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=n.copyAttrs({},this.canvas,u);i[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(i)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Z.BEFORE_READY),this.emitLeafer(Z.READY),this.emitLeafer(Z.AFTER_READY),Q.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Z.VIEW_READY),Q.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){Q.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(Z.VIEW_COMPLETED),Q.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 Z(t,this))}__listenEvents(){const t=st.start("FirstCreate "+this.innerName);this.once([[Z.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){ye.list.remove(this);try{this.stop(),this.emitLeafer(Z.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.destroy()),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){ge.error(t)}}};t?e():setTimeout(e)}};ve.list=new J,wt([g(Xt)],ve.prototype,"__",void 0),wt([B()],ve.prototype,"pixelRatio",void 0),ve=ye=wt([j()],ve);let fe=class extends ue{get __tag(){return"Rect"}constructor(t){super(t)}};wt([g(Gt)],fe.prototype,"__",void 0),fe=wt([O(le),N(),j()],fe);const{add:we,includes:xe,scroll:Se}=_t,me=fe.prototype,Re=ce.prototype;let ke=class extends ce{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=G());super.__updateRenderBounds(n),(e=a.includes("scroll"))&&(we(n,r),Se(n,i)),this.__updateRectRenderBounds(),t=!xe(r,n),t&&"show"===a&&we(o,n)}else this.__updateRectRenderBounds();n.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};wt([g(jt)],ke.prototype,"__",void 0),wt([B(100)],ke.prototype,"width",void 0),wt([B(100)],ke.prototype,"height",void 0),wt([v(!1)],ke.prototype,"resizeChildren",void 0),wt([W("show")],ke.prototype,"overflow",void 0),wt([L(me.__updateStrokeSpread)],ke.prototype,"__updateStrokeSpread",null),wt([L(me.__updateRenderSpread)],ke.prototype,"__updateRectRenderSpread",null),wt([L(me.__updateBoxBounds)],ke.prototype,"__updateRectBoxBounds",null),wt([L(me.__updateStrokeBounds)],ke.prototype,"__updateStrokeBounds",null),wt([L(me.__updateRenderBounds)],ke.prototype,"__updateRectRenderBounds",null),wt([L(me.__updateChange)],ke.prototype,"__updateRectChange",null),wt([L(me.__render)],ke.prototype,"__renderRect",null),wt([L(Re.__render)],ke.prototype,"__renderGroup",null),ke=wt([N(),j()],ke);let Be=class extends ke{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};wt([g(Jt)],Be.prototype,"__",void 0),wt([f("#FFFFFF")],Be.prototype,"fill",void 0),wt([W("hide")],Be.prototype,"overflow",void 0),Be=wt([j()],Be);const{moveTo:be,closePath:Ae,ellipse:Ce}=ht;let Pe=class extends ue{get __tag(){return"Ellipse"}constructor(t){super(t)}__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&&Ce(n,r,a,r*i,a*i,0,s,o,!1),Ce(n,r,a,r,a,0,o,s,!0),i<1&&Ae(n)):(i<1&&(Ce(n,r,a,r*i,a*i),be(n,t,a)),Ce(n,r,a,r,a,0,360,0,!0)),dt.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(be(n,r,a),Ce(n,r,a,r,a,0,s,o,!1),Ae(n)):Ce(n,r,a,r,a)}};wt([g($t)],Pe.prototype,"__",void 0),wt([T(0)],Pe.prototype,"innerRadius",void 0),wt([T(0)],Pe.prototype,"startAngle",void 0),wt([T(0)],Pe.prototype,"endAngle",void 0),Pe=wt([j()],Pe);const{moveTo:Fe,lineTo:We,drawPoints:Ee}=ht,{rotate:Te,getAngle:Ie,getDistance:De,defaultPoint:ze}=lt,{toBounds:Le}=pt;let Me=class extends ue{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i=ct();return t&&(i.x=t),e&&Te(i,e),i}set toPoint(t){this.width=De(ze,t),this.rotation=Ie(ze,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Ee(e,t.points,!1,t.closed):(Fe(e,0,0),We(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Ee(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&At.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?Le(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};wt([g(qt)],Me.prototype,"__",void 0),wt([ut("center")],Me.prototype,"strokeAlign",void 0),wt([B(0)],Me.prototype,"height",void 0),wt([T()],Me.prototype,"points",void 0),wt([T(0)],Me.prototype,"curve",void 0),wt([T(!1)],Me.prototype,"closed",void 0),Me=wt([j()],Me);const{sin:Oe,cos:Ne,PI:Ve}=Math,{moveTo:He,lineTo:Ye,closePath:Ue,drawPoints:je}=ht,Xe=Me.prototype;let Je=class extends ue{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)je(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,o=e/2,r=i/2;He(t,o,0);for(let e=1;e<s;e++)Ye(t,o+o*Oe(2*e*Ve/s),r-r*Ne(2*e*Ve/s));Ue(t)}}__updateRenderPath(){}__updateBoxBounds(){}};wt([g(Kt)],Je.prototype,"__",void 0),wt([T(3)],Je.prototype,"sides",void 0),wt([T()],Je.prototype,"points",void 0),wt([T(0)],Je.prototype,"curve",void 0),wt([L(Xe.__updateRenderPath)],Je.prototype,"__updateRenderPath",null),wt([L(Xe.__updateBoxBounds)],Je.prototype,"__updateBoxBounds",null),Je=wt([N(),j()],Je);const{sin:qe,cos:Ge,PI:$e}=Math,{moveTo:Ke,lineTo:Qe,closePath:Ze}=ht;let ti=class extends ue{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,r=e/2,a=this.__.path=[];Ke(a,o,0);for(let t=1;t<2*i;t++)Qe(a,o+(t%2==0?o:o*s)*qe(t*$e/i),r-(t%2==0?r:r*s)*Ge(t*$e/i));Ze(a)}};wt([g(Qt)],ti.prototype,"__",void 0),wt([T(5)],ti.prototype,"corners",void 0),wt([T(.382)],ti.prototype,"innerRadius",void 0),ti=wt([j()],ti);let ei=class extends fe{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}constructor(t){super(t)}};wt([g(se)],ei.prototype,"__",void 0),wt([B("")],ei.prototype,"url",void 0),ei=wt([j()],ei);const ii=ei;let si=class extends fe{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=$.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 gt(gt.LOADED,{image:t}))})}draw(t,e,i,s){const o=new vt(t.worldTransform).invert(),r=new vt;e&&r.translate(e.x,e.y),i&&(U(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),o.multiplyParent(r),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};wt([g(oe)],si.prototype,"__",void 0),wt([St(100)],si.prototype,"width",void 0),wt([St(100)],si.prototype,"height",void 0),wt([St(1)],si.prototype,"pixelRatio",void 0),wt([St(!0)],si.prototype,"smooth",void 0),wt([v(!1)],si.prototype,"safeResize",void 0),wt([St()],si.prototype,"contextSettings",void 0),si=wt([j()],si);const{copyAndSpread:oi,includes:ri,spread:ai,setList:ni}=_t;let _i=class extends ue{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:r,italic:a,textCase:n,textOverflow:_,padding:h}=t;t.__lineHeight=bt.number(e,o),t.__letterSpacing=bt.number(i,o),t.__padding=h?y.fourNumber(h):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"!==_&&!t.__autoSize,t.__textDrawData=kt.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:r,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:_}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=_,t.__lineHeight<i&&ai(_,i/2),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",!ri(h,_)),this.isOverflow?(ni(t.__textBoxBounds={},[h,_]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;oi(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};wt([g(ie)],_i.prototype,"__",void 0),wt([B(0)],_i.prototype,"width",void 0),wt([B(0)],_i.prototype,"height",void 0),wt([f()],_i.prototype,"boxStyle",void 0),wt([v(!1)],_i.prototype,"resizeFontSize",void 0),wt([f("#000000")],_i.prototype,"fill",void 0),wt([ut("outside")],_i.prototype,"strokeAlign",void 0),wt([I("all")],_i.prototype,"hitFill",void 0),wt([B("")],_i.prototype,"text",void 0),wt([B("")],_i.prototype,"placeholder",void 0),wt([B("caption")],_i.prototype,"fontFamily",void 0),wt([B(12)],_i.prototype,"fontSize",void 0),wt([B("normal")],_i.prototype,"fontWeight",void 0),wt([B(!1)],_i.prototype,"italic",void 0),wt([B("none")],_i.prototype,"textCase",void 0),wt([B("none")],_i.prototype,"textDecoration",void 0),wt([B(0)],_i.prototype,"letterSpacing",void 0),wt([B({type:"percent",value:1.5})],_i.prototype,"lineHeight",void 0),wt([B(0)],_i.prototype,"paraIndent",void 0),wt([B(0)],_i.prototype,"paraSpacing",void 0),wt([B("x")],_i.prototype,"writingMode",void 0),wt([B("left")],_i.prototype,"textAlign",void 0),wt([B("top")],_i.prototype,"verticalAlign",void 0),wt([B(!0)],_i.prototype,"autoSizeAlign",void 0),wt([B("normal")],_i.prototype,"textWrap",void 0),wt([B("show")],_i.prototype,"textOverflow",void 0),wt([f(!1)],_i.prototype,"textEditing",void 0),_i=wt([j()],_i);let hi=class extends ue{get __tag(){return"Path"}constructor(t){super(t)}};wt([g(Zt)],hi.prototype,"__",void 0),wt([ut("center")],hi.prototype,"strokeAlign",void 0),hi=wt([j()],hi);let di=class extends ce{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new hi(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,r,a,n){return this}arc(t,e,i,s,o,r){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,r,a,n){return this}drawArc(t,e,i,s,o,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};wt([g(te)],di.prototype,"__",void 0),wt([(e,i)=>{t(e,i,{get(){return this.__path}})}],di.prototype,"path",void 0),di=wt([O(ft,["set","path","paint"]),j()],di);export{ke as Box,jt as BoxData,si as Canvas,oe as CanvasData,Bt as ColorConvert,ae as DragBoundsHelper,Wt as Effect,Pe as Ellipse,$t as EllipseData,Tt as Export,Et as Filter,Be as Frame,Jt as FrameData,ce as Group,Ut as GroupData,ei as Image,se as ImageData,ve as Leafer,Xt as LeaferData,Me as Line,qt as LineData,ii as MyImage,Ct as Paint,Ft as PaintGradient,Pt as PaintImage,hi as Path,At as PathArrow,Zt as PathData,di as Pen,te as PenData,Je as Polygon,Kt as PolygonData,fe as Rect,Gt as RectData,le as RectRender,ti as Star,Qt as StarData,It as State,_i as Text,kt as TextConvert,ie as TextData,Dt as Transition,ue as UI,re as UIBounds,Ht as UIData,he as UIRender,bt as UnitConvert,Rt as createAttr,xt as effectType,St as resizeType,mt as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=draw.esm.min.js.map
|