@leafer-ui/worker 1.9.10 → 1.9.12

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/dist/worker.js CHANGED
@@ -3611,7 +3611,12 @@ var LeaferUI = function(exports) {
3611
3611
  runTask() {
3612
3612
  const task = this.list[this.index];
3613
3613
  if (!task) {
3614
- this.nextTask();
3614
+ this.timer = setTimeout(() => this.nextTask());
3615
+ return;
3616
+ }
3617
+ if (task.isCancel) {
3618
+ this.index++;
3619
+ this.runTask();
3615
3620
  return;
3616
3621
  }
3617
3622
  task.run().then(() => {
@@ -3642,16 +3647,15 @@ var LeaferUI = function(exports) {
3642
3647
  }
3643
3648
  setParallelList() {
3644
3649
  let task;
3650
+ const {config: config, list: list, index: index} = this;
3645
3651
  this.parallelList = [];
3646
3652
  this.parallelSuccessNumber = 0;
3647
- let end = this.index + this.config.parallel;
3648
- if (end > this.list.length) end = this.list.length;
3649
- for (let i = this.index; i < end; i++) {
3650
- task = this.list[i];
3651
- if (task.parallel) {
3652
- this.parallelList.push(task);
3653
- } else {
3654
- break;
3653
+ let end = index + config.parallel;
3654
+ if (end > list.length) end = list.length;
3655
+ if (config.parallel > 1) {
3656
+ for (let i = index; i < end; i++) {
3657
+ task = list[i];
3658
+ if (task.parallel) this.parallelList.push(task); else break;
3655
3659
  }
3656
3660
  }
3657
3661
  }
@@ -6409,7 +6413,7 @@ var LeaferUI = function(exports) {
6409
6413
  this.levelMap = null;
6410
6414
  }
6411
6415
  }
6412
- const version = "1.9.10";
6416
+ const version = "1.9.12";
6413
6417
  class LeaferCanvas extends LeaferCanvasBase {
6414
6418
  get allowBackgroundColor() {
6415
6419
  return true;
@@ -9082,7 +9086,7 @@ var LeaferUI = function(exports) {
9082
9086
  EventCreator.changeName(oldName, newName);
9083
9087
  }
9084
9088
  }
9085
- const {float: float, sign: sign} = MathHelper, {min: min, max: max$2, abs: abs$2} = Math;
9089
+ const {min: min, max: max$2, abs: abs$2} = Math, {float: float, sign: sign} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
9086
9090
  const tempContent = new Bounds, tempDragBounds = new Bounds;
9087
9091
  const DragBoundsHelper = {
9088
9092
  limitMove(leaf, move) {
@@ -9130,26 +9134,27 @@ var LeaferUI = function(exports) {
9130
9134
  tempContent.set(content).scaleOf(origin, scale.x, scale.y);
9131
9135
  const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
9132
9136
  const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
9133
- let correctScaleX, correctScaleY, aScale, bScale, aSize, bSize;
9137
+ let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
9134
9138
  if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
9135
- correctScaleX = scale.x < 0 ? 1 / scale.x : 1;
9136
- if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX, 1);
9139
+ if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
9137
9140
  aSize = float(tempContent.minX - tempDragBounds.minX);
9138
9141
  bSize = float(tempDragBounds.maxX - tempContent.maxX);
9139
9142
  aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
9140
9143
  bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
9141
9144
  correctScaleX *= max$2(aScale, bScale);
9142
9145
  } else {
9143
- if (scale.x < 0) tempContent.unsign();
9146
+ if (scale.x < 0) {
9147
+ if (float(minX(content) - minX(dragBounds)) <= 0 || float(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
9148
+ tempContent.unsign();
9149
+ }
9144
9150
  aSize = float(tempDragBounds.minX - tempContent.minX);
9145
9151
  bSize = float(tempContent.maxX - tempDragBounds.maxX);
9146
9152
  aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
9147
9153
  bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
9148
- correctScaleX = min(aScale, bScale);
9154
+ correctScaleX *= min(aScale, bScale);
9149
9155
  }
9150
9156
  if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
9151
- correctScaleY = scale.y < 0 ? 1 / scale.y : 1;
9152
- if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY);
9157
+ if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
9153
9158
  aSize = float(tempContent.minY - tempDragBounds.minY);
9154
9159
  bSize = float(tempDragBounds.maxY - tempContent.maxY);
9155
9160
  aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
@@ -9161,12 +9166,15 @@ var LeaferUI = function(exports) {
9161
9166
  correctScaleY = sign(correctScaleY) * aScale;
9162
9167
  }
9163
9168
  } else {
9164
- if (scale.y < 0) tempContent.unsign();
9169
+ if (scale.y < 0) {
9170
+ if (float(minY(content) - minY(dragBounds)) <= 0 || float(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
9171
+ tempContent.unsign();
9172
+ }
9165
9173
  aSize = float(tempDragBounds.minY - tempContent.minY);
9166
9174
  bSize = float(tempContent.maxY - tempDragBounds.maxY);
9167
9175
  aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
9168
9176
  bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
9169
- correctScaleY = min(aScale, bScale);
9177
+ correctScaleY *= min(aScale, bScale);
9170
9178
  }
9171
9179
  scale.x *= isFinite(correctScaleX) ? correctScaleX : 1;
9172
9180
  scale.y *= isFinite(correctScaleY) ? correctScaleY : 1;
@@ -10145,9 +10153,9 @@ var LeaferUI = function(exports) {
10145
10153
  const ui$1 = exports.UI.prototype;
10146
10154
  ui$1.__updateHitCanvas = function() {
10147
10155
  if (this.__box) this.__box.__updateHitCanvas();
10148
- const leafer = this.leafer || this.parent && this.parent.leafer;
10149
- if (!leafer) return;
10150
- const data = this.__, {hitCanvasManager: hitCanvasManager} = leafer;
10156
+ const {hitCanvasManager: hitCanvasManager} = this.leafer || this.parent && this.parent.leafer || {};
10157
+ if (!hitCanvasManager) return;
10158
+ const data = this.__;
10151
10159
  const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === "pixel";
10152
10160
  const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === "pixel";
10153
10161
  const isHitPixel = isHitPixelFill || isHitPixelStroke;
@@ -11144,11 +11152,11 @@ var LeaferUI = function(exports) {
11144
11152
  }
11145
11153
  function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
11146
11154
  if (shadow.spread) {
11147
- const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
11155
+ const spread = shadow.spread * 2 * otherScale * (isInnerShaodw ? -1 : 1), {width: width, height: height} = ui.__layout.strokeBounds;
11148
11156
  tempMatrix.set().scaleOfOuter({
11149
11157
  x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
11150
11158
  y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
11151
- }, spreadScale);
11159
+ }, 1 + spread / width, 1 + spread / height);
11152
11160
  return tempMatrix;
11153
11161
  }
11154
11162
  return undefined;
@@ -1,2 +1,2 @@
1
- "use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),n=require("@leafer-ui/draw");class i extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:n}=this;this.view.width=Math.ceil(t*n),this.view.height=Math.ceil(e*n),this.clientBounds=this.bounds}}t.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:a}=t.FileHelper;function r(e,n){t.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,n)=>new Promise((i,r)=>{t.convertToBlob({type:a(e),quality:n}).then(t=>{var e=new FileReader;e.onload=t=>i(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)}).catch(t=>{r(t)})}),canvasToBolb:(t,e,n)=>t.convertToBlob({type:a(e),quality:n}),canvasSaveAs:(t,e,n)=>new Promise(t=>t()),download(t,e){},loadImage:e=>new Promise((n,i)=>{let a=new XMLHttpRequest;a.open("GET",t.Platform.image.getRealURL(e),!0),a.responseType="blob",a.onload=()=>{createImageBitmap(a.response).then(t=>{n(t)}).catch(t=>{i(t)})},a.onerror=t=>i(t),a.send()})},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new i(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isWorker=!0,t.Platform.backgrounder=!0,t.Platform.requestRender=function(t){requestAnimationFrame(t)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:s}=navigator;s.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(t.Platform.fullImageShadow=!0),s.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):s.indexOf("Mac")>-1?t.Platform.os="Mac":s.indexOf("Linux")>-1&&(t.Platform.os="Linux");class o{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach(t=>{t.leafer&&e.add(t)}),e}return this.__updatedList}constructor(e,n){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,n=e.length;t<n;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:d,updateChange:h}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;class p{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,t.isArray(e)&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,f),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:g,updateAllChange:_}=t.LeafHelper,m=t.Debug.get("Layouter");class y{constructor(e,n){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){m.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?m.warn("layouting"):this.times>3?m.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const n=t.Run.start("PartLayout"),{target:i,__updatedList:a}=this,{BEFORE:r,LAYOUT:s,AFTER:o}=t.LayoutEvent,f=this.getBlocks(a);f.forEach(t=>t.setBefore()),i.emitEvent(new t.LayoutEvent(r,f,this.times)),this.extraBlock=null,a.sort(),function(t,e){let n;t.list.forEach(t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(l(t,!0),e.add(t),t.isBranch&&c(t,e),u(t,e)):n.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))})}(a,this.__levelList),function(t){let e,n,i;t.sort(!0),t.levels.forEach(a=>{e=t.levelMap[a];for(let t=0,a=e.length;t<a;t++){if(n=e[t],n.isBranch&&n.__tempNumber){i=n.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||d(i[t])}d(n)}})}(this.__levelList),function(t){t.list.forEach(h)}(a),this.extraBlock&&f.push(this.extraBlock),f.forEach(t=>t.setAfter()),i.emitEvent(new t.LayoutEvent(s,f,this.times)),i.emitEvent(new t.LayoutEvent(o,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(n)}fullLayout(){const e=t.Run.start("FullLayout"),{target:n}=this,{BEFORE:i,LAYOUT:a,AFTER:r}=t.LayoutEvent,s=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(i,s,this.times)),y.fullLayout(n),s.forEach(t=>{t.setAfter()}),n.emitEvent(new t.LayoutEvent(a,s,this.times)),n.emitEvent(new t.LayoutEvent(r,s,this.times)),this.addBlocks(s),t.Run.end(e)}static fullLayout(e){g(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:n}=this.extraBlock||(this.extraBlock=new p([]));e.length?n.add(t.__world):n.set(t.__world),e.add(t)}}createBlock(t){return new p(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[t.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const w=t.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=e,this.canvas=n,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:n}=this;this.times=0,this.totalBounds=new t.Bounds,w.log(n.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,w.error(t)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return w.warn("rendering");if(this.times>3)return w.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(e){const n=t.Run.start("PartRender"),{canvas:i}=this,a=e.getIntersect(i.bounds),r=new t.Bounds(a);i.save(),a.spread(v.clipSpread).ceil(),i.clearWorld(a),i.clipWorld(a),this.__render(a,r),i.restore(),t.Run.end(n)}fullRender(){const e=t.Run.start("FullRender"),{canvas:n}=this;n.save(),n.clear(),this.__render(n.bounds),n.restore(),t.Run.end(e)}__render(e,n){const{canvas:i}=this,a=e.includes(this.target.__world),r=a?{includes:a}:{bounds:e,includes:a};this.needFill&&i.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(i,e),t.Platform.render(this.target,i,r),this.renderBounds=n=n||e,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=n:this.totalBounds.add(n),i.updateRender(n)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const n=new t.Bounds;n.setList(e),e.length=0,e.push(n)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const n=()=>{const e=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&e>i)return t.Platform.requestRender(n);const{frames:a}=this;a.length>30&&a.shift(),a.push(e),this.FPS=Math.round(a.reduce((t,e)=>t+e,0)/a.length),this.requestTime=0,this.checkRender()};t.Platform.requestRender(n)}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:n,height:i}=e.old;if(!new t.Bounds(0,0,n,i).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||w.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(e,n,i){this.target.emitEvent(new t.RenderEvent(e,this.times,n,i))}__listenEvents(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[t.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}v.clipSpread=10;const{hitRadiusPoint:x}=t.BoundsHelper;class b{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,n,i){n||(n=0),i||(i={});const a=i.through||!1,r=i.ignoreHittable||!1,s=i.target||this.target;this.exclude=i.exclude||null,this.point={x:e.x,y:e.y,radiusX:n,radiusY:n},this.findList=new t.LeafList(i.findList),i.findList||this.hitBranch(s.isBranchLeaf?{children:[s]}:s);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,i.bottomList,r,!!i.findList),d=r?this.getPath(l):this.getHitablePath(l);return this.clear(),a?{path:d,target:l,throughPath:o.length?this.getThroughPath(o):d}:{path:d,target:l}}hitPoint(t,e,n){return!!this.getByPoint(t,e,n).target}getBestMatchLeaf(e,n,i,a){const r=this.findList=new t.LeafList;if(e.length){let n;const{x:a,y:s}=this.point,o={x:a,y:s,radiusX:0,radiusY:0};for(let a=0,s=e.length;a<s;a++)if(n=e[a],(i||t.LeafHelper.worldHittable(n))&&(this.hitChild(n,o),r.length)){if(n.isBranchLeaf&&e.some(e=>e!==n&&t.LeafHelper.hasParent(e,n))){r.reset();break}return r.list[0]}}if(n)for(let t=0,e=n.length;t<e;t++)if(this.hitChild(n[t].target,this.point,n[t].proxy),r.length)return r.list[0];return a?null:i?e[0]:e.find(e=>t.LeafHelper.worldHittable(e))}getPath(e){const n=new t.LeafList,i=[],{target:a}=this;for(;e&&(e.syncEventer&&i.push(e.syncEventer),n.add(e),(e=e.parent)!==a););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&n.add(t),(t=t.parent)!==a););}),a&&n.add(a),n}getHitablePath(e){const n=this.getPath(e&&e.hittable?e:null);let i,a=new t.LeafList;for(let t=n.list.length-1;t>-1&&(i=n.list[t],i.__.hittable)&&(a.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return a}getThroughPath(e){const n=new t.LeafList,i=[];for(let t=e.length-1;t>-1;t--)i.push(this.getPath(e[t]));let a,r,s;for(let t=0,e=i.length;t<e;t++){a=i[t],r=i[t+1];for(let t=0,e=a.length;t<e&&(s=a.list[t],!r||!r.has(s));t++)n.add(s)}return n}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let n,i;const{point:a}=this;for(let r=t.length-1;r>-1;r--)n=t[r],!n.__.visible||e&&!n.__.mask||(i=!!n.__.hitRadius||x(n.__world,a),n.isBranch?(i||n.__ignoreHitWorld)&&(n.topChildren&&this.eachFind(n.topChildren,!1),this.eachFind(n.children,n.__onlyHitMask),n.isBranchLeaf&&this.hitChild(n,a)):i&&this.hitChild(n,a))}hitChild(t,e,n){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:i}=t;if(i&&i.__hasMask&&!t.__.mask){let n,a=[];const{children:r}=i;for(let i=0,s=r.length;i<s;i++)if(n=r[i],n.__.mask&&a.push(n),n===t){if(a&&!a.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(n||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class B{constructor(e,n){this.config={},n&&(this.config=t.DataHelper.default(n,this.config)),this.picker=new b(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,n,i){const{target:a,picker:r}=this;return t.Platform.backgrounder&&a&&a.updateLayout(),r.getByPoint(e,n,i)}hitPoint(t,e,n){return this.picker.hitPoint(t,e,n)}getBy(e,n,i,a){return this.finder?this.finder.getBy(e,n,i,a):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function E(t,e){const n=t.__,{rows:i,decorationY:a}=n.__textDrawData;let r;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,n=i.length;t<n;t++)r=i[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(a){const{decorationColor:t,decorationHeight:r}=n.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>a.forEach(n=>e.fillRect(t.x,t.y+n,t.width,r)))}}function L(t,e){t.__.__font?E(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function S(t,e,n){switch(e.__.strokeAlign){case"center":k(t,1,e,n);break;case"inside":R(t,"inside",e,n);break;case"outside":e.__.__fillAfterStroke?k(t,2,e,n):R(t,"outside",e,n)}}function k(e,n,i,a){const r=i.__;t.isObject(e)?C(e,n,!0,i,a):(a.setStroke(e,r.__strokeWidth*n,r),P(i,a))}function R(e,n,i,a){const r=a.getSameCanvas(!0,!0);r.font=i.__.__font,k(e,2,i,r),r.blendMode="outside"===n?"destination-out":"destination-in",E(i,r),r.blendMode="normal",t.LeafHelper.copyCanvasByWorld(i,a,r),r.recycle(i.__nowWorld)}function P(t,e){let n,i=t.__.__textDrawData;const{rows:a,decorationY:r}=i;for(let t=0,i=a.length;t<i;t++)n=a[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.strokeText(t.char,t.x,n.y)});if(r){const{decorationHeight:t}=i;a.forEach(n=>r.forEach(i=>e.strokeRect(n.x,n.y+i,n.width,t)))}}function C(t,e,i,a,r){let s;const o=a.__,{__hasMultiStrokeStyle:l}=o;l||r.setStroke(void 0,o.__strokeWidth*e,o);for(let d=0,h=t.length;d<h;d++)if(s=t[d],(!s.image||!n.PaintImage.checkImage(a,r,s,!1))&&s.style){if(l){const{strokeStyle:t}=s;t?r.setStroke(s.style,o.__getRealStrokeWidth(t)*e,o,t):r.setStroke(s.style,o.__strokeWidth*e,o)}else r.strokeStyle=s.style;s.blendMode?(r.saveBlendMode(s.blendMode),i?P(a,r):r.stroke(),r.restoreBlendMode()):i?P(a,r):r.stroke()}}function A(e,n,i){const a=n.__;if(a.__strokeWidth)if(a.__font)S(e,n,i);else switch(a.strokeAlign){case"center":O(e,1,n,i);break;case"inside":!function(t,e,n){n.save(),n.clipUI(e),O(t,2,e,n),n.restore()}(e,n,i);break;case"outside":!function(e,n,i){const a=n.__;if(a.__fillAfterStroke)O(e,2,n,i);else{const{renderBounds:r}=n.__layout,s=i.getSameCanvas(!0,!0);n.__drawRenderPath(s),O(e,2,n,s),s.clipUI(a),s.clearWorld(r),t.LeafHelper.copyCanvasByWorld(n,i,s),s.recycle(n.__nowWorld)}}(e,n,i)}}function O(e,i,a,r){const s=a.__;t.isObject(e)?C(e,i,!1,a,r):(r.setStroke(e,s.__strokeWidth*i,s),r.stroke()),s.__useArrow&&n.Paint.strokeArrow(e,a,r)}Object.assign(t.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new y(t,e),renderer:(t,e,n)=>new v(t,e,n),selector:(t,e)=>new B(t,e)}),t.Platform.layout=y.fullLayout,t.Platform.render=function(e,n,i){const a=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new t.LeafList,e.__render(n,i),i.topList.length&&i.topList.forEach(t=>t.__render(n,a))};const{getSpread:T,copyAndSpread:M,toOuterOf:W,getOuterOf:D,getByMove:H,move:I,getIntersectData:F}=t.BoundsHelper,j={};let G;const{stintSet:Y}=t.DataHelper,{hasTransparent:z}=n.ColorConvert;function U(e,i,a){if(!t.isObject(i)||!1===i.visible||0===i.opacity)return;let r;const{boxBounds:s}=a.__layout;switch(i.type){case"image":r=n.PaintImage.image(a,e,i,s,!G||!G[i.url]);break;case"linear":r=n.PaintGradient.linearGradient(i,s);break;case"radial":r=n.PaintGradient.radialGradient(i,s);break;case"angular":r=n.PaintGradient.conicGradient(i,s);break;case"solid":const{type:o,color:l,opacity:d}=i;r={type:o,style:n.ColorConvert.string(l,d)};break;default:t.isUndefined(i.r)||(r={type:"solid",style:n.ColorConvert.string(i)})}if(r){if(t.isString(r.style)&&z(r.style)&&(r.isTransparent=!0),i.style){if(0===i.style.strokeWidth)return;r.strokeStyle=i.style}i.editing&&(r.editing=i.editing),i.blendMode&&(r.blendMode=i.blendMode)}return r}const q={compute:function(e,i){const a=i.__,r=[];let s,o,l,d=a.__input[e];t.isArray(d)||(d=[d]),G=n.PaintImage.recycleImage(e,a);for(let t,n=0,a=d.length;n<a;n++)(t=U(e,d[n],i))&&(r.push(t),t.strokeStyle&&(l||(l=1),t.strokeStyle.strokeWidth&&(l=Math.max(l,t.strokeStyle.strokeWidth))));a["_"+e]=r.length?r:void 0,r.length&&r.every(t=>t.isTransparent)&&(r.some(t=>t.image)&&(s=!0),o=!0),"fill"===e?(Y(a,"__isAlphaPixelFill",s),Y(a,"__isTransparentFill",o)):(Y(a,"__isAlphaPixelStroke",s),Y(a,"__isTransparentStroke",o),Y(a,"__hasMultiStrokeStyle",l))},fill:function(t,e,n){n.fillStyle=t,L(e,n)},fills:function(t,e,i){let a;for(let r=0,s=t.length;r<s;r++){if(a=t[r],a.image){if(n.PaintImage.checkImage(e,i,a,!e.__.__font))continue;if(!a.style){!r&&a.image.isPlacehold&&e.drawImagePlaceholder(i,a.image);continue}}if(i.fillStyle=a.style,a.transform||a.scaleFixed){if(i.save(),a.transform&&i.transform(a.transform),a.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===a.scaleFixed||"zoom-in"===a.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}a.blendMode&&(i.blendMode=a.blendMode),L(e,i),i.restore()}else a.blendMode?(i.saveBlendMode(a.blendMode),L(e,i),i.restoreBlendMode()):L(e,i)}},fillPathOrText:L,fillText:E,stroke:A,strokes:function(t,e,n){A(t,e,n)},strokeText:S,drawTextStroke:P,shape:function(e,n,i){const a=n.getSameCanvas(),r=n.bounds,s=e.__nowWorld,o=e.__layout,l=e.__nowWorldShapeBounds||(e.__nowWorldShapeBounds={});let d,h,c,u,f,p;W(o.strokeSpread?(M(j,o.boxBounds,o.strokeSpread),j):o.boxBounds,s,l);let{scaleX:g,scaleY:_}=e.getRenderScaleData(!0);if(r.includes(l))p=a,d=f=l,h=s;else{let a;if(t.Platform.fullImageShadow)a=l;else{const e=o.renderShapeSpread?T(r,t.FourNumberHelper.swapAndScale(o.renderShapeSpread,g,_)):r;a=F(e,l)}u=r.getFitMatrix(a);let{a:m,d:y}=u;u.a<1&&(p=n.getSameCanvas(),e.__renderShape(p,i),g*=m,_*=y),f=D(l,u),d=H(f,-u.e,-u.f),h=D(s,u),I(h,-u.e,-u.f);const w=i.matrix;w?(c=new t.Matrix(u),c.multiply(w),m*=w.scaleX,y*=w.scaleY):c=u,c.withScale(m,y),i=Object.assign(Object.assign({},i),{matrix:c})}return e.__renderShape(a,i),{canvas:a,matrix:c,fitMatrix:u,bounds:d,renderBounds:h,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:_}}};let X={},N=t.getMatrixData();const{get:V,set:Q,rotateOfOuter:Z,translate:K,scaleOfOuter:$,multiplyParent:J,scale:tt,rotate:et,skew:nt}=t.MatrixHelper;function it(t,e,n,i){const a=V();K(a,e.x,e.y),n&&tt(a,n,i),t.transform=a}function at(t,e,n,i,a,r,s){const o=V();K(o,e.x+n,e.y+i),tt(o,a,r),s&&Z(o,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=o}function rt(t,e,n,i,a,r,s,o,l,d){const h=V();ot(h,e,n,i,a,r,s,o),l&&(s||o?(Q(N),$(N,e,l,d),J(h,N)):$(h,e,l,d)),t.transform=h}function st(t,e,n,i,a,r,s,o,l,d,h,c){const u=V();if(c)ot(u,e,a,r,s,o,l,d);else{if(l)if("center"===h)Z(u,{x:n/2,y:i/2},l);else switch(et(u,l),l){case 90:K(u,i,0);break;case 180:K(u,n,i);break;case 270:K(u,0,n)}X.x=e.x+a,X.y=e.y+r,K(u,X.x,X.y),s&&$(u,X,s,o)}t.transform=u}function ot(t,e,n,i,a,r,s,o){s&&et(t,s),o&&nt(t,o.x,o.y),a&&tt(t,a,r),K(t,e.x+n,e.y+i)}const{get:lt,translate:dt}=t.MatrixHelper,ht=new t.Bounds,ct={},ut={};function ft(t,e,n,i){const{changeful:a,sync:r,scaleFixed:s}=n;a&&(t.changeful=a),r&&(t.sync=r),s&&(t.scaleFixed=s),t.data=pt(n,i,e)}function pt(e,n,i){e.padding&&(n=ht.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:a,height:r}=i;const{opacity:s,mode:o,align:l,offset:d,scale:h,size:c,rotation:u,skew:f,clipSize:p,repeat:g,gap:_,filters:m}=e,y=n.width===a&&n.height===r,w={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(t.BoundsHelper.set(ut,0,0,v?r:a,v?a:r),o&&"cover"!==o&&"fit"!==o?((h||c)&&(t.MathHelper.getScaleData(h,c,i,ct),x=ct.scaleX,b=ct.scaleY),(l||_||g)&&(x&&t.BoundsHelper.scale(ut,x,b,!0),l&&t.AlignHelper.toPoint(l,ut,n,ut,!0,!0))):y&&!u||(x=b=t.BoundsHelper.getFitScale(n,ut,"fit"!==o),t.BoundsHelper.put(n,i,l,x,!1,ut),t.BoundsHelper.scale(ut,x,b,!0)),d&&t.PointHelper.move(ut,d),o){case"stretch":y||(x=n.width/a,b=n.height/r,it(w,n,x,b));break;case"normal":case"clip":if(ut.x||ut.y||x||p||u||f){let t,e;p&&(t=n.width/p.width,e=n.height/p.height),rt(w,n,ut.x,ut.y,x,b,u,f,t,e),t&&(x=x?x*t:t,b=b?b*e:e)}break;case"repeat":(!y||x||u||f)&&st(w,n,a,r,ut.x,ut.y,x,b,u,f,l,e.freeTransform),g||(w.repeat="repeat");const i=t.isObject(g);(_||i)&&(w.gap=function(e,n,i,a,r){let s,o;t.isObject(e)?(s=e.x,o=e.y):s=o=e;return{x:gt(s,i,r.width,n&&n.x),y:gt(o,a,r.height,n&&n.y)}}(_,i&&g,ut.width,ut.height,n));break;default:x&&at(w,n,ut.x,ut.y,x,b,u)}return w.transform||(n.x||n.y)&&dt(w.transform=lt(),n.x,n.y),w.width=a,w.height=r,x&&(w.scaleX=x,w.scaleY=b),s&&(w.opacity=s),m&&(w.filters=m),g&&(w.repeat=t.isString(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),w}function gt(e,n,i,a){const r=t.isString(e)||a?(a?i-a*n:i%n)/((a||Math.floor(i/n))-1):e;return"auto"===e&&r<0?0:r}let _t,mt=new t.Bounds;const{isSame:yt}=t.BoundsHelper;function wt(t,e,n,i,a,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return a.data||ft(a,i,n,r),!0}function vt(e,n){Bt(e,t.ImageEvent.LOAD,n)}function xt(e,n){Bt(e,t.ImageEvent.LOADED,n)}function bt(e,n,i){n.error=i,e.forceUpdate("surface"),Bt(e,t.ImageEvent.ERROR,n)}function Bt(e,n,i){e.hasEvent(n)&&e.emitEvent(new t.ImageEvent(n,i))}function Et(t,e){const{leafer:n}=t;n&&n.viewReady&&(n.renderer.ignore=e)}const{get:Lt,scale:St,copy:kt}=t.MatrixHelper,{floor:Rt,ceil:Pt,max:Ct,abs:At}=Math;function Ot(e,n,i){let{scaleX:a,scaleY:r}=e.getRenderScaleData(!0,n.scaleFixed);const s=a+"-"+r+"-"+i;if(n.patternId===s||e.destroyed)return!1;{const{image:o,data:l}=n;let d,h,{width:c,height:u,scaleX:f,scaleY:p,transform:g,repeat:_,gap:m}=l;a*=i,r*=i,f&&(f=At(f),p=At(p),h=Lt(),kt(h,g),St(h,1/f,1/p),a*=f,r*=p),c*=a,u*=r;const y=c*u;if(!_&&y>t.Platform.image.maxCacheSize)return!1;let w=t.Platform.image.maxPatternSize;if(o.isSVG){const t=c/o.width;t>1&&(d=t/Pt(t))}else{const t=o.width*o.height;w>t&&(w=t)}y>w&&(d=Math.sqrt(y/w)),d&&(a/=d,r/=d,c/=d,u/=d),f&&(a/=f,r/=p);const v=m&&m.x*a,x=m&&m.y*r;if(g||1!==a||1!==r){const t=c+(v||0),e=u+(x||0);a/=t/Ct(Rt(t),1),r/=e/Ct(Rt(e),1),h||(h=Lt(),g&&kt(h,g)),St(h,1/a,1/r)}const b=o.getCanvas(c,u,l.opacity,l.filters,v,x,e.leafer&&e.leafer.config.smooth),B=o.getPattern(b,_||t.Platform.origin.noRepeat||"no-repeat",h,n);return n.style=B,n.patternId=s,!0}}function Tt(t,e,n,i){return new(n||(n=Promise))(function(a,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,o)}l((i=i.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Mt={image:function(e,n,i,a,r){let s,o;const l=t.ImageManager.get(i);return _t&&i===_t.paint&&yt(a,_t.boxBounds)?s=_t.leafPaint:(s={type:i.type,image:l},l.hasAlphaPixel&&(s.isTransparent=!0),_t=l.use>1?{leafPaint:s,paint:i,boxBounds:mt.set(a)}:null),(r||l.loading)&&(o={image:l,attrName:n,attrValue:i}),l.ready?(wt(e,n,i,l,s,a),r&&(vt(e,o),xt(e,o))):l.error?r&&bt(e,o,l.error):(r&&(Et(e,!0),vt(e,o)),s.loadId=l.load(()=>{Et(e,!1),e.destroyed||(wt(e,n,i,l,s,a)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),xt(e,o)),s.loadId=void 0},t=>{Et(e,!1),bt(e,o,t),s.loadId=void 0}),e.placeholderColor&&(e.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))},e.placeholderDelay):l.isPlacehold=!0)),s},checkImage:function(e,i,a,r){const{scaleX:s,scaleY:o}=e.getRenderScaleData(!0,a.scaleFixed),{pixelRatio:l}=i,{data:d}=a;if(!d||a.patternId===s+"-"+o+"-"+l&&!n.Export.running)return!1;if(r)if(d.repeat)r=!1;else if(!(a.changeful||"miniapp"===t.Platform.name&&t.ResizeEvent.isResizing(e)||n.Export.running)){let{width:e,height:n}=d;e*=s*l,n*=o*l,d.scaleX&&(e*=d.scaleX,n*=d.scaleY),r=e*n>t.Platform.image.maxCacheSize}return r?(e.__.__isFastShadow&&(i.fillStyle=a.style||"#000",i.fill()),function(t,e,n,i){e.save(),e.clipUI(t),n.blendMode&&(e.blendMode=n.blendMode);i.opacity&&(e.opacity*=i.opacity);i.transform&&e.transform(i.transform);e.drawImage(n.image.getFull(i.filters),0,0,i.width,i.height),e.restore()}(e,i,a,d),!0):(!a.style||a.sync||n.Export.running?Ot(e,a,l):a.patternTask||(a.patternTask=t.ImageManager.patternTasker.add(()=>Tt(this,void 0,void 0,function*(){a.patternTask=null,i.bounds.hit(e.__nowWorld)&&Ot(e,a,l),e.forceUpdate("surface")}),300)),!1)},createPattern:Ot,recycleImage:function(e,n){const i=n["_"+e];if(t.isArray(i)){let a,r,s,o,l;for(let d=0,h=i.length;d<h;d++)a=i[d],r=a.image,l=r&&r.url,l&&(s||(s={}),s[l]=!0,t.ImageManager.recycle(r),r.loading&&(o||(o=n.__input&&n.__input[e]||[],t.isArray(o)||(o=[o])),r.unload(i[d].loadId,!o.some(t=>t.url===l))));return s}return null},createData:ft,getPatternData:pt,stretchMode:it,fillOrFitMode:at,clipMode:rt,repeatMode:st},{toPoint:Wt}=t.AroundHelper,{hasTransparent:Dt}=n.ColorConvert,Ht={},It={};function Ft(e,i,a,r){if(a){let s,o,l,d;for(let e=0,h=a.length;e<h;e++)s=a[e],t.isString(s)?(l=e/(h-1),o=n.ColorConvert.string(s,r)):(l=s.offset,o=n.ColorConvert.string(s.color,r)),i.addColorStop(l,o),!d&&Dt(o)&&(d=!0);d&&(e.isTransparent=!0)}}const{getAngle:jt,getDistance:Gt}=t.PointHelper,{get:Yt,rotateOfOuter:zt,scaleOfOuter:Ut}=t.MatrixHelper,{toPoint:qt}=t.AroundHelper,Xt={},Nt={};function Vt(t,e,n,i,a){let r;const{width:s,height:o}=t;if(s!==o||i){const t=jt(e,n);r=Yt(),a?(Ut(r,e,s/o*(i||1),1),zt(r,e,t+90)):(Ut(r,e,1,s/o*(i||1)),zt(r,e,t))}return r}const{getDistance:Qt}=t.PointHelper,{toPoint:Zt}=t.AroundHelper,Kt={},$t={};const Jt={linearGradient:function(e,n){let{from:i,to:a,type:r,opacity:s}=e;Wt(i||"top",n,Ht),Wt(a||"bottom",n,It);const o=t.Platform.canvas.createLinearGradient(Ht.x,Ht.y,It.x,It.y),l={type:r,style:o};return Ft(l,o,e.stops,s),l},radialGradient:function(e,n){let{from:i,to:a,type:r,opacity:s,stretch:o}=e;qt(i||"center",n,Xt),qt(a||"bottom",n,Nt);const l=t.Platform.canvas.createRadialGradient(Xt.x,Xt.y,0,Xt.x,Xt.y,Gt(Xt,Nt)),d={type:r,style:l};Ft(d,l,e.stops,s);const h=Vt(n,Xt,Nt,o,!0);return h&&(d.transform=h),d},conicGradient:function(e,n){let{from:i,to:a,type:r,opacity:s,stretch:o}=e;Zt(i||"center",n,Kt),Zt(a||"bottom",n,$t);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Kt.x,Kt.y):t.Platform.canvas.createRadialGradient(Kt.x,Kt.y,0,Kt.x,Kt.y,Qt(Kt,$t)),d={type:r,style:l};Ft(d,l,e.stops,s);const h=Vt(n,Kt,$t,o||1,t.Platform.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Vt},{copy:te,move:ee,toOffsetOutBounds:ne}=t.BoundsHelper,{max:ie,abs:ae}=Math,re={},se=new t.Matrix,oe={};function le(t,e){let n,i,a,r,s=0,o=0,l=0,d=0;return e.forEach(t=>{n=t.x||0,i=t.y||0,r=1.5*(t.blur||0),a=ae(t.spread||0),s=ie(s,a+r-i),o=ie(o,a+r+n),l=ie(l,a+r+i),d=ie(d,a+r-n)}),s===o&&o===l&&l===d?s:[s,o,l,d]}function de(e,n,i){const{shapeBounds:a}=i;let r,s;t.Platform.fullImageShadow?(te(re,e.bounds),ee(re,n.x-a.x,n.y-a.y),r=e.bounds,s=re):(r=a,s=n),e.copyWorld(i.canvas,r,s)}const{toOffsetOutBounds:he}=t.BoundsHelper,ce={};const ue=le;const fe={shadow:function(e,i,a){let r,s;const{__nowWorld:o}=e,{shadow:l}=e.__,{worldCanvas:d,bounds:h,renderBounds:c,shapeBounds:u,scaleX:f,scaleY:p}=a,g=i.getSameCanvas(),_=l.length-1;ne(h,oe,c),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}g.setWorldShadow(oe.offsetX+(l.x||0)*f*y,oe.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y,n.ColorConvert.string(l.color)),s=n.Effect.getShadowTransform(e,g,a,l,oe,y),s&&g.setTransform(s),de(g,oe,a),s&&g.resetTransform(),r=c,l.box&&(g.restore(),g.save(),d&&(g.copyWorld(g,c,o,"copy"),r=o),d?g.copyWorld(d,o,o,"destination-out"):g.copyWorld(a.canvas,u,h,"destination-out")),t.LeafHelper.copyCanvasByWorld(e,i,g,r,l.blendMode),_&&m<_&&g.clearWorld(r)}),g.recycle(r)},innerShadow:function(e,i,a){let r,s;const{__nowWorld:o}=e,{innerShadow:l}=e.__,{worldCanvas:d,bounds:h,renderBounds:c,shapeBounds:u,scaleX:f,scaleY:p}=a,g=i.getSameCanvas(),_=l.length-1;he(h,ce,c),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}g.save(),g.setWorldShadow(ce.offsetX+(l.x||0)*f*y,ce.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y),s=n.Effect.getShadowTransform(e,g,a,l,ce,y,!0),s&&g.setTransform(s),de(g,ce,a),g.restore(),d?(g.copyWorld(g,c,o,"copy"),g.copyWorld(d,o,o,"source-out"),r=o):(g.copyWorld(a.canvas,u,h,"source-out"),r=c),g.fillWorld(r,n.ColorConvert.string(l.color),"source-in"),t.LeafHelper.copyCanvasByWorld(e,i,g,r,l.blendMode),_&&m<_&&g.clearWorld(r)}),g.recycle(r)},blur:function(t,e,n){const{blur:i}=t.__;n.setWorldBlur(i*t.__nowWorld.a),n.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),n.filter="none"},backgroundBlur:function(t,e,n){},getShadowRenderSpread:le,getShadowTransform:function(t,e,n,i,a,r,s){if(i.spread){const n=1+2*i.spread/t.__layout.strokeBounds.width*r*(s?-1:1);return se.set().scaleOfOuter({x:(a.x+a.width/2)*e.pixelRatio,y:(a.y+a.height/2)*e.pixelRatio},n),se}},isTransformShadow(t){},getInnerShadowSpread:ue},{excludeRenderBounds:pe}=t.LeafBoundsHelper;let ge;function _e(t,e,n,i,a,r,s,o){switch(e){case"grayscale":ge||(ge=!0,a.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,n,i,a,r){const s=t.__nowWorld;n.resetTransform(),n.opacity=1,n.useMask(i,s),r&&i.recycle(s);ye(t,e,n,1,a,r)}(t,n,i,a,s,o);break;case"opacity-path":ye(t,n,i,r,s,o);break;case"path":o&&n.restore()}}function me(t){return t.getSameCanvas(!1,!0)}function ye(t,e,n,i,a,r){const s=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(n,s,void 0,a),r?n.recycle(s):n.clearWorld(s)}n.Group.prototype.__renderMask=function(t,e){let n,i,a,r,s,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(n=l[d],o=n.__.mask,o){s&&(_e(this,s,t,a,i,r,void 0,!0),i=a=null),"clipping"!==o&&"clipping-path"!==o||pe(n,e)||n.__render(t,e),r=n.__.opacity,ge=!1,"path"===o||"clipping-path"===o?(r<1?(s="opacity-path",a||(a=me(t))):(s="path",t.save()),n.__clip(a||t,e)):(s="grayscale"===o?"grayscale":"alpha",i||(i=me(t)),a||(a=me(t)),n.__render(i,e));continue}const h=1===r&&n.__.__blendMode;h&&_e(this,s,t,a,i,r,void 0,!1),pe(n,e)||n.__render(a||t,e),h&&_e(this,s,t,a,i,r,h,!1)}_e(this,s,t,a,i,r,void 0,!0)};const we=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ve=we+"_#~&*+\\=|≮≯≈≠=…",xe=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function be(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Be=be("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Ee=be("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Le=be(we),Se=be(ve),ke=be("- —/~|┆·");var Re;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Re||(Re={}));const{Letter:Pe,Single:Ce,Before:Ae,After:Oe,Symbol:Te,Break:Me}=Re;function We(t){return Be[t]?Pe:ke[t]?Me:Ee[t]?Ae:Le[t]?Oe:Se[t]?Te:xe.test(t)?Ce:Pe}const De={trimRight(t){const{words:e}=t;let n,i=0,a=e.length;for(let r=a-1;r>-1&&(n=e[r].data[0]," "===n.char);r--)i++,t.width-=n.width;i&&e.splice(a-i,i)}};function He(t,e,n){switch(e){case"title":return n?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Ie}=De,{Letter:Fe,Single:je,Before:Ge,After:Ye,Symbol:ze,Break:Ue}=Re;let qe,Xe,Ne,Ve,Qe,Ze,Ke,$e,Je,tn,en,nn,an,rn,sn,on,ln,dn=[];function hn(t,e){Je&&!$e&&($e=Je),qe.data.push({char:t,width:e}),Ne+=e}function cn(){Ve+=Ne,qe.width=Ne,Xe.words.push(qe),qe={data:[]},Ne=0}function un(){rn&&(sn.paraNumber++,Xe.paraStart=!0,rn=!1),Je&&(Xe.startCharSize=$e,Xe.endCharSize=Je,$e=0),Xe.width=Ve,on.width?Ie(Xe):ln&&fn(),dn.push(Xe),Xe={words:[]},Ve=0}function fn(){Ve>(sn.maxWidth||0)&&(sn.maxWidth=Ve)}const{top:pn,right:gn,bottom:_n,left:mn}=t.Direction4;function yn(t,e,n){const{bounds:i,rows:a}=t;i[e]+=n;for(let t=0;t<a.length;t++)a[t][e]+=n}const wn={getDrawData:function(e,i){t.isString(e)||(e=String(e));let a=0,r=0,s=i.__getInput("width")||0,o=i.__getInput("height")||0;const{textDecoration:l,__font:d,__padding:h}=i;h&&(s?(a=h[mn],s-=h[gn]+h[mn]):i.autoSizeAlign||(a=h[mn]),o?(r=h[pn],o-=h[pn]+h[_n]):i.autoSizeAlign||(r=h[pn]));const c={bounds:{x:a,y:r,width:s,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,n,i){sn=e,dn=e.rows,on=e.bounds,ln=!on.width&&!i.autoSizeAlign;const{__letterSpacing:a,paraIndent:r,textCase:s}=i,{canvas:o}=t.Platform,{width:l,height:d}=on;if(l||d||a||"none"!==s){const t="none"!==i.textWrap,e="break"===i.textWrap;rn=!0,en=null,$e=Ke=Je=Ne=Ve=0,qe={data:[]},Xe={words:[]},a&&(n=[...n]);for(let i=0,d=n.length;i<d;i++)Ze=n[i],"\n"===Ze?(Ne&&cn(),Xe.paraEnd=!0,un(),rn=!0):(tn=We(Ze),tn===Fe&&"none"!==s&&(Ze=He(Ze,s,!Ne)),Ke=o.measureText(Ze).width,a&&(a<0&&(Je=Ke),Ke+=a),nn=tn===je&&(en===je||en===Fe)||en===je&&tn!==Ye,an=!(tn!==Ge&&tn!==je||en!==ze&&en!==Ye),Qe=rn&&r?l-r:l,t&&l&&Ve+Ne+Ke>Qe&&(e?(Ne&&cn(),Ve&&un()):(an||(an=tn===Fe&&en==Ye),nn||an||tn===Ue||tn===Ge||tn===je||Ne+Ke>Qe?(Ne&&cn(),Ve&&un()):Ve&&un()))," "===Ze&&!0!==rn&&Ve+Ne===0||(tn===Ue?(" "===Ze&&Ne&&cn(),hn(Ze,Ke),cn()):nn||an?(Ne&&cn(),hn(Ze,Ke)):hn(Ze,Ke)),en=tn);Ne&&cn(),Ve&&un(),dn.length>0&&(dn[dn.length-1].paraEnd=!0)}else n.split("\n").forEach(t=>{sn.paraNumber++,Ve=o.measureText(t).width,dn.push({x:r||0,text:t,width:Ve,paraStart:!0}),ln&&fn()})}(c,e,i),h&&function(t,e,n,i,a){if(!i&&n.autoSizeAlign)switch(n.textAlign){case"left":yn(e,"x",t[mn]);break;case"right":yn(e,"x",-t[gn])}if(!a&&n.autoSizeAlign)switch(n.verticalAlign){case"top":yn(e,"y",t[pn]);break;case"bottom":yn(e,"y",-t[_n])}}(h,c,i,s,o),function(t,e){const{rows:n,bounds:i}=t,a=n.length,{__lineHeight:r,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=i,m=r*a+(c?c*(t.paraNumber-1):0),y=s;if(l&&m>_)m=Math.max(_,r),a>1&&(t.overflow=a);else if(_||u)switch(h){case"middle":p+=(_-m)/2;break;case"bottom":p+=_-m}y+=p;let w,v,x,b=g||u?g:t.maxWidth;for(let s=0,h=a;s<h;s++){if(w=n[s],w.x=f,w.width<g||w.width>g&&!l)switch(d){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&c&&s>0&&(y+=c),w.y=y,y+=r,t.overflow>s&&y>m&&(w.isOverflow=!0,t.overflow=s+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<i.x&&(i.x=v),x>i.width&&(i.width=x),l&&g&&g<x&&(w.isOverflow=!0,t.overflow||(t.overflow=n.length))}i.y=p,i.height=m}(c,i),function(t,e,n){const{rows:i}=t,{textAlign:a,paraIndent:r,letterSpacing:s}=e;let o,l,d,h,c,u;i.forEach(t=>{t.words&&(d=r&&t.paraStart?r:0,u=t.words.length,l=n&&("justify"===a||"both"===a)&&u>1?(n-t.width-d)/(u-1):0,h=s||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!s&&(t.textMode=!0),2===h?(t.x+=d,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=d,o=t.x,t.data=[],t.words.forEach((e,n)=>{1===h?(c={char:"",x:o},o=function(t,e,n){return t.forEach(t=>{n.char+=t.char,e+=t.width}),e}(e.data,o,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):o=function(t,e,n,i){return t.forEach(t=>{(i||" "!==t.char)&&(t.x=e,n.push(t)),e+=t.width}),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==a||n===u-1||(o+=l,t.width+=l)})),t.words=null)})}(c,i,s),c.overflow&&function(e,n,i,a){if(!a)return;const{rows:r,overflow:s}=e;let{textOverflow:o}=n;if(r.splice(s),o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,h=i+a-d;("none"===n.textWrap?r:[r[s-1]]).forEach(t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let i=n;i>-1&&(e=t.data[i],l=e.x+e.width,!(i===n&&l<h));i--){if(l<h&&" "!==e.char||!i){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:o,x:l}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,i,a,s),"none"!==l&&function(e,i){let a,r=0;const{fontSize:s,textDecoration:o}=i;switch(e.decorationHeight=s/11,t.isObject(o)?(a=o.type,o.color&&(e.decorationColor=n.ColorConvert.string(o.color)),o.offset&&(r=Math.min(.3*s,Math.max(o.offset,.15*-s)))):a=o,a){case"under":e.decorationY=[.15*s+r];break;case"delete":e.decorationY=[.35*-s];break;case"under-delete":e.decorationY=[.15*s+r,.35*-s]}}(c,i),c}};const vn={string:function(e,i){if(!e)return"#000";const a=t.isNumber(i)&&i<1;if(t.isString(e)){if(!a||!n.ColorConvert.object)return e;e=n.ColorConvert.object(e)}let r=t.isUndefined(e.a)?1:e.a;a&&(r*=i);const s=e.r+","+e.g+","+e.b;return 1===r?"rgb("+s+")":"rgba("+s+","+r+")"}};Object.assign(n.TextConvert,wn),Object.assign(n.ColorConvert,vn),Object.assign(n.Paint,q),Object.assign(n.PaintImage,Mt),Object.assign(n.PaintGradient,Jt),Object.assign(n.Effect,fe),Object.assign(t.Creator,{interaction:(t,n,i,a)=>new e.InteractionBase(t,n,i,a),hitCanvas:(t,e)=>new i(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),r(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=y,exports.LeaferCanvas=i,exports.Picker=b,exports.Renderer=v,exports.Selector=B,exports.Watcher=o,exports.useCanvas=r,Object.keys(t).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}),Object.keys(e).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
1
+ "use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),n=require("@leafer-ui/draw");class i extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:n}=this;this.view.width=Math.ceil(t*n),this.view.height=Math.ceil(e*n),this.clientBounds=this.bounds}}t.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:a}=t.FileHelper;function r(e,n){t.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,n)=>new Promise((i,r)=>{t.convertToBlob({type:a(e),quality:n}).then(t=>{var e=new FileReader;e.onload=t=>i(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)}).catch(t=>{r(t)})}),canvasToBolb:(t,e,n)=>t.convertToBlob({type:a(e),quality:n}),canvasSaveAs:(t,e,n)=>new Promise(t=>t()),download(t,e){},loadImage:e=>new Promise((n,i)=>{let a=new XMLHttpRequest;a.open("GET",t.Platform.image.getRealURL(e),!0),a.responseType="blob",a.onload=()=>{createImageBitmap(a.response).then(t=>{n(t)}).catch(t=>{i(t)})},a.onerror=t=>i(t),a.send()})},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new i(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isWorker=!0,t.Platform.backgrounder=!0,t.Platform.requestRender=function(t){requestAnimationFrame(t)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:s}=navigator;s.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(t.Platform.fullImageShadow=!0),s.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):s.indexOf("Mac")>-1?t.Platform.os="Mac":s.indexOf("Linux")>-1&&(t.Platform.os="Linux");class o{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach(t=>{t.leafer&&e.add(t)}),e}return this.__updatedList}constructor(e,n){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,n=e.length;t<n;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:d,updateChange:h}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;class p{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,t.isArray(e)&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,f),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:g,updateAllChange:_}=t.LeafHelper,m=t.Debug.get("Layouter");class y{constructor(e,n){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){m.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?m.warn("layouting"):this.times>3?m.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const n=t.Run.start("PartLayout"),{target:i,__updatedList:a}=this,{BEFORE:r,LAYOUT:s,AFTER:o}=t.LayoutEvent,f=this.getBlocks(a);f.forEach(t=>t.setBefore()),i.emitEvent(new t.LayoutEvent(r,f,this.times)),this.extraBlock=null,a.sort(),function(t,e){let n;t.list.forEach(t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(l(t,!0),e.add(t),t.isBranch&&c(t,e),u(t,e)):n.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))})}(a,this.__levelList),function(t){let e,n,i;t.sort(!0),t.levels.forEach(a=>{e=t.levelMap[a];for(let t=0,a=e.length;t<a;t++){if(n=e[t],n.isBranch&&n.__tempNumber){i=n.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||d(i[t])}d(n)}})}(this.__levelList),function(t){t.list.forEach(h)}(a),this.extraBlock&&f.push(this.extraBlock),f.forEach(t=>t.setAfter()),i.emitEvent(new t.LayoutEvent(s,f,this.times)),i.emitEvent(new t.LayoutEvent(o,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(n)}fullLayout(){const e=t.Run.start("FullLayout"),{target:n}=this,{BEFORE:i,LAYOUT:a,AFTER:r}=t.LayoutEvent,s=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(i,s,this.times)),y.fullLayout(n),s.forEach(t=>{t.setAfter()}),n.emitEvent(new t.LayoutEvent(a,s,this.times)),n.emitEvent(new t.LayoutEvent(r,s,this.times)),this.addBlocks(s),t.Run.end(e)}static fullLayout(e){g(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:n}=this.extraBlock||(this.extraBlock=new p([]));e.length?n.add(t.__world):n.set(t.__world),e.add(t)}}createBlock(t){return new p(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[t.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const w=t.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=e,this.canvas=n,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:n}=this;this.times=0,this.totalBounds=new t.Bounds,w.log(n.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,w.error(t)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return w.warn("rendering");if(this.times>3)return w.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(e){const n=t.Run.start("PartRender"),{canvas:i}=this,a=e.getIntersect(i.bounds),r=new t.Bounds(a);i.save(),a.spread(v.clipSpread).ceil(),i.clearWorld(a),i.clipWorld(a),this.__render(a,r),i.restore(),t.Run.end(n)}fullRender(){const e=t.Run.start("FullRender"),{canvas:n}=this;n.save(),n.clear(),this.__render(n.bounds),n.restore(),t.Run.end(e)}__render(e,n){const{canvas:i}=this,a=e.includes(this.target.__world),r=a?{includes:a}:{bounds:e,includes:a};this.needFill&&i.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(i,e),t.Platform.render(this.target,i,r),this.renderBounds=n=n||e,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=n:this.totalBounds.add(n),i.updateRender(n)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const n=new t.Bounds;n.setList(e),e.length=0,e.push(n)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const n=()=>{const e=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&e>i)return t.Platform.requestRender(n);const{frames:a}=this;a.length>30&&a.shift(),a.push(e),this.FPS=Math.round(a.reduce((t,e)=>t+e,0)/a.length),this.requestTime=0,this.checkRender()};t.Platform.requestRender(n)}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:n,height:i}=e.old;if(!new t.Bounds(0,0,n,i).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||w.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(e,n,i){this.target.emitEvent(new t.RenderEvent(e,this.times,n,i))}__listenEvents(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[t.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}v.clipSpread=10;const{hitRadiusPoint:x}=t.BoundsHelper;class b{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,n,i){n||(n=0),i||(i={});const a=i.through||!1,r=i.ignoreHittable||!1,s=i.target||this.target;this.exclude=i.exclude||null,this.point={x:e.x,y:e.y,radiusX:n,radiusY:n},this.findList=new t.LeafList(i.findList),i.findList||this.hitBranch(s.isBranchLeaf?{children:[s]}:s);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,i.bottomList,r,!!i.findList),d=r?this.getPath(l):this.getHitablePath(l);return this.clear(),a?{path:d,target:l,throughPath:o.length?this.getThroughPath(o):d}:{path:d,target:l}}hitPoint(t,e,n){return!!this.getByPoint(t,e,n).target}getBestMatchLeaf(e,n,i,a){const r=this.findList=new t.LeafList;if(e.length){let n;const{x:a,y:s}=this.point,o={x:a,y:s,radiusX:0,radiusY:0};for(let a=0,s=e.length;a<s;a++)if(n=e[a],(i||t.LeafHelper.worldHittable(n))&&(this.hitChild(n,o),r.length)){if(n.isBranchLeaf&&e.some(e=>e!==n&&t.LeafHelper.hasParent(e,n))){r.reset();break}return r.list[0]}}if(n)for(let t=0,e=n.length;t<e;t++)if(this.hitChild(n[t].target,this.point,n[t].proxy),r.length)return r.list[0];return a?null:i?e[0]:e.find(e=>t.LeafHelper.worldHittable(e))}getPath(e){const n=new t.LeafList,i=[],{target:a}=this;for(;e&&(e.syncEventer&&i.push(e.syncEventer),n.add(e),(e=e.parent)!==a););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&n.add(t),(t=t.parent)!==a););}),a&&n.add(a),n}getHitablePath(e){const n=this.getPath(e&&e.hittable?e:null);let i,a=new t.LeafList;for(let t=n.list.length-1;t>-1&&(i=n.list[t],i.__.hittable)&&(a.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return a}getThroughPath(e){const n=new t.LeafList,i=[];for(let t=e.length-1;t>-1;t--)i.push(this.getPath(e[t]));let a,r,s;for(let t=0,e=i.length;t<e;t++){a=i[t],r=i[t+1];for(let t=0,e=a.length;t<e&&(s=a.list[t],!r||!r.has(s));t++)n.add(s)}return n}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let n,i;const{point:a}=this;for(let r=t.length-1;r>-1;r--)n=t[r],!n.__.visible||e&&!n.__.mask||(i=!!n.__.hitRadius||x(n.__world,a),n.isBranch?(i||n.__ignoreHitWorld)&&(n.topChildren&&this.eachFind(n.topChildren,!1),this.eachFind(n.children,n.__onlyHitMask),n.isBranchLeaf&&this.hitChild(n,a)):i&&this.hitChild(n,a))}hitChild(t,e,n){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:i}=t;if(i&&i.__hasMask&&!t.__.mask){let n,a=[];const{children:r}=i;for(let i=0,s=r.length;i<s;i++)if(n=r[i],n.__.mask&&a.push(n),n===t){if(a&&!a.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(n||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class B{constructor(e,n){this.config={},n&&(this.config=t.DataHelper.default(n,this.config)),this.picker=new b(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,n,i){const{target:a,picker:r}=this;return t.Platform.backgrounder&&a&&a.updateLayout(),r.getByPoint(e,n,i)}hitPoint(t,e,n){return this.picker.hitPoint(t,e,n)}getBy(e,n,i,a){return this.finder?this.finder.getBy(e,n,i,a):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function E(t,e){const n=t.__,{rows:i,decorationY:a}=n.__textDrawData;let r;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,n=i.length;t<n;t++)r=i[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(a){const{decorationColor:t,decorationHeight:r}=n.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>a.forEach(n=>e.fillRect(t.x,t.y+n,t.width,r)))}}function L(t,e){t.__.__font?E(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function S(t,e,n){switch(e.__.strokeAlign){case"center":k(t,1,e,n);break;case"inside":R(t,"inside",e,n);break;case"outside":e.__.__fillAfterStroke?k(t,2,e,n):R(t,"outside",e,n)}}function k(e,n,i,a){const r=i.__;t.isObject(e)?C(e,n,!0,i,a):(a.setStroke(e,r.__strokeWidth*n,r),P(i,a))}function R(e,n,i,a){const r=a.getSameCanvas(!0,!0);r.font=i.__.__font,k(e,2,i,r),r.blendMode="outside"===n?"destination-out":"destination-in",E(i,r),r.blendMode="normal",t.LeafHelper.copyCanvasByWorld(i,a,r),r.recycle(i.__nowWorld)}function P(t,e){let n,i=t.__.__textDrawData;const{rows:a,decorationY:r}=i;for(let t=0,i=a.length;t<i;t++)n=a[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.strokeText(t.char,t.x,n.y)});if(r){const{decorationHeight:t}=i;a.forEach(n=>r.forEach(i=>e.strokeRect(n.x,n.y+i,n.width,t)))}}function C(t,e,i,a,r){let s;const o=a.__,{__hasMultiStrokeStyle:l}=o;l||r.setStroke(void 0,o.__strokeWidth*e,o);for(let d=0,h=t.length;d<h;d++)if(s=t[d],(!s.image||!n.PaintImage.checkImage(a,r,s,!1))&&s.style){if(l){const{strokeStyle:t}=s;t?r.setStroke(s.style,o.__getRealStrokeWidth(t)*e,o,t):r.setStroke(s.style,o.__strokeWidth*e,o)}else r.strokeStyle=s.style;s.blendMode?(r.saveBlendMode(s.blendMode),i?P(a,r):r.stroke(),r.restoreBlendMode()):i?P(a,r):r.stroke()}}function A(e,n,i){const a=n.__;if(a.__strokeWidth)if(a.__font)S(e,n,i);else switch(a.strokeAlign){case"center":O(e,1,n,i);break;case"inside":!function(t,e,n){n.save(),n.clipUI(e),O(t,2,e,n),n.restore()}(e,n,i);break;case"outside":!function(e,n,i){const a=n.__;if(a.__fillAfterStroke)O(e,2,n,i);else{const{renderBounds:r}=n.__layout,s=i.getSameCanvas(!0,!0);n.__drawRenderPath(s),O(e,2,n,s),s.clipUI(a),s.clearWorld(r),t.LeafHelper.copyCanvasByWorld(n,i,s),s.recycle(n.__nowWorld)}}(e,n,i)}}function O(e,i,a,r){const s=a.__;t.isObject(e)?C(e,i,!1,a,r):(r.setStroke(e,s.__strokeWidth*i,s),r.stroke()),s.__useArrow&&n.Paint.strokeArrow(e,a,r)}Object.assign(t.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new y(t,e),renderer:(t,e,n)=>new v(t,e,n),selector:(t,e)=>new B(t,e)}),t.Platform.layout=y.fullLayout,t.Platform.render=function(e,n,i){const a=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new t.LeafList,e.__render(n,i),i.topList.length&&i.topList.forEach(t=>t.__render(n,a))};const{getSpread:T,copyAndSpread:M,toOuterOf:W,getOuterOf:D,getByMove:H,move:I,getIntersectData:F}=t.BoundsHelper,j={};let G;const{stintSet:Y}=t.DataHelper,{hasTransparent:z}=n.ColorConvert;function U(e,i,a){if(!t.isObject(i)||!1===i.visible||0===i.opacity)return;let r;const{boxBounds:s}=a.__layout;switch(i.type){case"image":r=n.PaintImage.image(a,e,i,s,!G||!G[i.url]);break;case"linear":r=n.PaintGradient.linearGradient(i,s);break;case"radial":r=n.PaintGradient.radialGradient(i,s);break;case"angular":r=n.PaintGradient.conicGradient(i,s);break;case"solid":const{type:o,color:l,opacity:d}=i;r={type:o,style:n.ColorConvert.string(l,d)};break;default:t.isUndefined(i.r)||(r={type:"solid",style:n.ColorConvert.string(i)})}if(r){if(t.isString(r.style)&&z(r.style)&&(r.isTransparent=!0),i.style){if(0===i.style.strokeWidth)return;r.strokeStyle=i.style}i.editing&&(r.editing=i.editing),i.blendMode&&(r.blendMode=i.blendMode)}return r}const q={compute:function(e,i){const a=i.__,r=[];let s,o,l,d=a.__input[e];t.isArray(d)||(d=[d]),G=n.PaintImage.recycleImage(e,a);for(let t,n=0,a=d.length;n<a;n++)(t=U(e,d[n],i))&&(r.push(t),t.strokeStyle&&(l||(l=1),t.strokeStyle.strokeWidth&&(l=Math.max(l,t.strokeStyle.strokeWidth))));a["_"+e]=r.length?r:void 0,r.length&&r.every(t=>t.isTransparent)&&(r.some(t=>t.image)&&(s=!0),o=!0),"fill"===e?(Y(a,"__isAlphaPixelFill",s),Y(a,"__isTransparentFill",o)):(Y(a,"__isAlphaPixelStroke",s),Y(a,"__isTransparentStroke",o),Y(a,"__hasMultiStrokeStyle",l))},fill:function(t,e,n){n.fillStyle=t,L(e,n)},fills:function(t,e,i){let a;for(let r=0,s=t.length;r<s;r++){if(a=t[r],a.image){if(n.PaintImage.checkImage(e,i,a,!e.__.__font))continue;if(!a.style){!r&&a.image.isPlacehold&&e.drawImagePlaceholder(i,a.image);continue}}if(i.fillStyle=a.style,a.transform||a.scaleFixed){if(i.save(),a.transform&&i.transform(a.transform),a.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===a.scaleFixed||"zoom-in"===a.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}a.blendMode&&(i.blendMode=a.blendMode),L(e,i),i.restore()}else a.blendMode?(i.saveBlendMode(a.blendMode),L(e,i),i.restoreBlendMode()):L(e,i)}},fillPathOrText:L,fillText:E,stroke:A,strokes:function(t,e,n){A(t,e,n)},strokeText:S,drawTextStroke:P,shape:function(e,n,i){const a=n.getSameCanvas(),r=n.bounds,s=e.__nowWorld,o=e.__layout,l=e.__nowWorldShapeBounds||(e.__nowWorldShapeBounds={});let d,h,c,u,f,p;W(o.strokeSpread?(M(j,o.boxBounds,o.strokeSpread),j):o.boxBounds,s,l);let{scaleX:g,scaleY:_}=e.getRenderScaleData(!0);if(r.includes(l))p=a,d=f=l,h=s;else{let a;if(t.Platform.fullImageShadow)a=l;else{const e=o.renderShapeSpread?T(r,t.FourNumberHelper.swapAndScale(o.renderShapeSpread,g,_)):r;a=F(e,l)}u=r.getFitMatrix(a);let{a:m,d:y}=u;u.a<1&&(p=n.getSameCanvas(),e.__renderShape(p,i),g*=m,_*=y),f=D(l,u),d=H(f,-u.e,-u.f),h=D(s,u),I(h,-u.e,-u.f);const w=i.matrix;w?(c=new t.Matrix(u),c.multiply(w),m*=w.scaleX,y*=w.scaleY):c=u,c.withScale(m,y),i=Object.assign(Object.assign({},i),{matrix:c})}return e.__renderShape(a,i),{canvas:a,matrix:c,fitMatrix:u,bounds:d,renderBounds:h,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:_}}};let X={},N=t.getMatrixData();const{get:V,set:Q,rotateOfOuter:Z,translate:K,scaleOfOuter:$,multiplyParent:J,scale:tt,rotate:et,skew:nt}=t.MatrixHelper;function it(t,e,n,i){const a=V();K(a,e.x,e.y),n&&tt(a,n,i),t.transform=a}function at(t,e,n,i,a,r,s){const o=V();K(o,e.x+n,e.y+i),tt(o,a,r),s&&Z(o,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=o}function rt(t,e,n,i,a,r,s,o,l,d){const h=V();ot(h,e,n,i,a,r,s,o),l&&(s||o?(Q(N),$(N,e,l,d),J(h,N)):$(h,e,l,d)),t.transform=h}function st(t,e,n,i,a,r,s,o,l,d,h,c){const u=V();if(c)ot(u,e,a,r,s,o,l,d);else{if(l)if("center"===h)Z(u,{x:n/2,y:i/2},l);else switch(et(u,l),l){case 90:K(u,i,0);break;case 180:K(u,n,i);break;case 270:K(u,0,n)}X.x=e.x+a,X.y=e.y+r,K(u,X.x,X.y),s&&$(u,X,s,o)}t.transform=u}function ot(t,e,n,i,a,r,s,o){s&&et(t,s),o&&nt(t,o.x,o.y),a&&tt(t,a,r),K(t,e.x+n,e.y+i)}const{get:lt,translate:dt}=t.MatrixHelper,ht=new t.Bounds,ct={},ut={};function ft(t,e,n,i){const{changeful:a,sync:r,scaleFixed:s}=n;a&&(t.changeful=a),r&&(t.sync=r),s&&(t.scaleFixed=s),t.data=pt(n,i,e)}function pt(e,n,i){e.padding&&(n=ht.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:a,height:r}=i;const{opacity:s,mode:o,align:l,offset:d,scale:h,size:c,rotation:u,skew:f,clipSize:p,repeat:g,gap:_,filters:m}=e,y=n.width===a&&n.height===r,w={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(t.BoundsHelper.set(ut,0,0,v?r:a,v?a:r),o&&"cover"!==o&&"fit"!==o?((h||c)&&(t.MathHelper.getScaleData(h,c,i,ct),x=ct.scaleX,b=ct.scaleY),(l||_||g)&&(x&&t.BoundsHelper.scale(ut,x,b,!0),l&&t.AlignHelper.toPoint(l,ut,n,ut,!0,!0))):y&&!u||(x=b=t.BoundsHelper.getFitScale(n,ut,"fit"!==o),t.BoundsHelper.put(n,i,l,x,!1,ut),t.BoundsHelper.scale(ut,x,b,!0)),d&&t.PointHelper.move(ut,d),o){case"stretch":y||(x=n.width/a,b=n.height/r,it(w,n,x,b));break;case"normal":case"clip":if(ut.x||ut.y||x||p||u||f){let t,e;p&&(t=n.width/p.width,e=n.height/p.height),rt(w,n,ut.x,ut.y,x,b,u,f,t,e),t&&(x=x?x*t:t,b=b?b*e:e)}break;case"repeat":(!y||x||u||f)&&st(w,n,a,r,ut.x,ut.y,x,b,u,f,l,e.freeTransform),g||(w.repeat="repeat");const i=t.isObject(g);(_||i)&&(w.gap=function(e,n,i,a,r){let s,o;t.isObject(e)?(s=e.x,o=e.y):s=o=e;return{x:gt(s,i,r.width,n&&n.x),y:gt(o,a,r.height,n&&n.y)}}(_,i&&g,ut.width,ut.height,n));break;default:x&&at(w,n,ut.x,ut.y,x,b,u)}return w.transform||(n.x||n.y)&&dt(w.transform=lt(),n.x,n.y),w.width=a,w.height=r,x&&(w.scaleX=x,w.scaleY=b),s&&(w.opacity=s),m&&(w.filters=m),g&&(w.repeat=t.isString(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),w}function gt(e,n,i,a){const r=t.isString(e)||a?(a?i-a*n:i%n)/((a||Math.floor(i/n))-1):e;return"auto"===e&&r<0?0:r}let _t,mt=new t.Bounds;const{isSame:yt}=t.BoundsHelper;function wt(t,e,n,i,a,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return a.data||ft(a,i,n,r),!0}function vt(e,n){Bt(e,t.ImageEvent.LOAD,n)}function xt(e,n){Bt(e,t.ImageEvent.LOADED,n)}function bt(e,n,i){n.error=i,e.forceUpdate("surface"),Bt(e,t.ImageEvent.ERROR,n)}function Bt(e,n,i){e.hasEvent(n)&&e.emitEvent(new t.ImageEvent(n,i))}function Et(t,e){const{leafer:n}=t;n&&n.viewReady&&(n.renderer.ignore=e)}const{get:Lt,scale:St,copy:kt}=t.MatrixHelper,{floor:Rt,ceil:Pt,max:Ct,abs:At}=Math;function Ot(e,n,i){let{scaleX:a,scaleY:r}=e.getRenderScaleData(!0,n.scaleFixed);const s=a+"-"+r+"-"+i;if(n.patternId===s||e.destroyed)return!1;{const{image:o,data:l}=n;let d,h,{width:c,height:u,scaleX:f,scaleY:p,transform:g,repeat:_,gap:m}=l;a*=i,r*=i,f&&(f=At(f),p=At(p),h=Lt(),kt(h,g),St(h,1/f,1/p),a*=f,r*=p),c*=a,u*=r;const y=c*u;if(!_&&y>t.Platform.image.maxCacheSize)return!1;let w=t.Platform.image.maxPatternSize;if(o.isSVG){const t=c/o.width;t>1&&(d=t/Pt(t))}else{const t=o.width*o.height;w>t&&(w=t)}y>w&&(d=Math.sqrt(y/w)),d&&(a/=d,r/=d,c/=d,u/=d),f&&(a/=f,r/=p);const v=m&&m.x*a,x=m&&m.y*r;if(g||1!==a||1!==r){const t=c+(v||0),e=u+(x||0);a/=t/Ct(Rt(t),1),r/=e/Ct(Rt(e),1),h||(h=Lt(),g&&kt(h,g)),St(h,1/a,1/r)}const b=o.getCanvas(c,u,l.opacity,l.filters,v,x,e.leafer&&e.leafer.config.smooth),B=o.getPattern(b,_||t.Platform.origin.noRepeat||"no-repeat",h,n);return n.style=B,n.patternId=s,!0}}function Tt(t,e,n,i){return new(n||(n=Promise))(function(a,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,o)}l((i=i.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Mt={image:function(e,n,i,a,r){let s,o;const l=t.ImageManager.get(i);return _t&&i===_t.paint&&yt(a,_t.boxBounds)?s=_t.leafPaint:(s={type:i.type,image:l},l.hasAlphaPixel&&(s.isTransparent=!0),_t=l.use>1?{leafPaint:s,paint:i,boxBounds:mt.set(a)}:null),(r||l.loading)&&(o={image:l,attrName:n,attrValue:i}),l.ready?(wt(e,n,i,l,s,a),r&&(vt(e,o),xt(e,o))):l.error?r&&bt(e,o,l.error):(r&&(Et(e,!0),vt(e,o)),s.loadId=l.load(()=>{Et(e,!1),e.destroyed||(wt(e,n,i,l,s,a)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),xt(e,o)),s.loadId=void 0},t=>{Et(e,!1),bt(e,o,t),s.loadId=void 0}),e.placeholderColor&&(e.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))},e.placeholderDelay):l.isPlacehold=!0)),s},checkImage:function(e,i,a,r){const{scaleX:s,scaleY:o}=e.getRenderScaleData(!0,a.scaleFixed),{pixelRatio:l}=i,{data:d}=a;if(!d||a.patternId===s+"-"+o+"-"+l&&!n.Export.running)return!1;if(r)if(d.repeat)r=!1;else if(!(a.changeful||"miniapp"===t.Platform.name&&t.ResizeEvent.isResizing(e)||n.Export.running)){let{width:e,height:n}=d;e*=s*l,n*=o*l,d.scaleX&&(e*=d.scaleX,n*=d.scaleY),r=e*n>t.Platform.image.maxCacheSize}return r?(e.__.__isFastShadow&&(i.fillStyle=a.style||"#000",i.fill()),function(t,e,n,i){e.save(),e.clipUI(t),n.blendMode&&(e.blendMode=n.blendMode);i.opacity&&(e.opacity*=i.opacity);i.transform&&e.transform(i.transform);e.drawImage(n.image.getFull(i.filters),0,0,i.width,i.height),e.restore()}(e,i,a,d),!0):(!a.style||a.sync||n.Export.running?Ot(e,a,l):a.patternTask||(a.patternTask=t.ImageManager.patternTasker.add(()=>Tt(this,void 0,void 0,function*(){a.patternTask=null,i.bounds.hit(e.__nowWorld)&&Ot(e,a,l),e.forceUpdate("surface")}),300)),!1)},createPattern:Ot,recycleImage:function(e,n){const i=n["_"+e];if(t.isArray(i)){let a,r,s,o,l;for(let d=0,h=i.length;d<h;d++)a=i[d],r=a.image,l=r&&r.url,l&&(s||(s={}),s[l]=!0,t.ImageManager.recycle(r),r.loading&&(o||(o=n.__input&&n.__input[e]||[],t.isArray(o)||(o=[o])),r.unload(i[d].loadId,!o.some(t=>t.url===l))));return s}return null},createData:ft,getPatternData:pt,stretchMode:it,fillOrFitMode:at,clipMode:rt,repeatMode:st},{toPoint:Wt}=t.AroundHelper,{hasTransparent:Dt}=n.ColorConvert,Ht={},It={};function Ft(e,i,a,r){if(a){let s,o,l,d;for(let e=0,h=a.length;e<h;e++)s=a[e],t.isString(s)?(l=e/(h-1),o=n.ColorConvert.string(s,r)):(l=s.offset,o=n.ColorConvert.string(s.color,r)),i.addColorStop(l,o),!d&&Dt(o)&&(d=!0);d&&(e.isTransparent=!0)}}const{getAngle:jt,getDistance:Gt}=t.PointHelper,{get:Yt,rotateOfOuter:zt,scaleOfOuter:Ut}=t.MatrixHelper,{toPoint:qt}=t.AroundHelper,Xt={},Nt={};function Vt(t,e,n,i,a){let r;const{width:s,height:o}=t;if(s!==o||i){const t=jt(e,n);r=Yt(),a?(Ut(r,e,s/o*(i||1),1),zt(r,e,t+90)):(Ut(r,e,1,s/o*(i||1)),zt(r,e,t))}return r}const{getDistance:Qt}=t.PointHelper,{toPoint:Zt}=t.AroundHelper,Kt={},$t={};const Jt={linearGradient:function(e,n){let{from:i,to:a,type:r,opacity:s}=e;Wt(i||"top",n,Ht),Wt(a||"bottom",n,It);const o=t.Platform.canvas.createLinearGradient(Ht.x,Ht.y,It.x,It.y),l={type:r,style:o};return Ft(l,o,e.stops,s),l},radialGradient:function(e,n){let{from:i,to:a,type:r,opacity:s,stretch:o}=e;qt(i||"center",n,Xt),qt(a||"bottom",n,Nt);const l=t.Platform.canvas.createRadialGradient(Xt.x,Xt.y,0,Xt.x,Xt.y,Gt(Xt,Nt)),d={type:r,style:l};Ft(d,l,e.stops,s);const h=Vt(n,Xt,Nt,o,!0);return h&&(d.transform=h),d},conicGradient:function(e,n){let{from:i,to:a,type:r,opacity:s,stretch:o}=e;Zt(i||"center",n,Kt),Zt(a||"bottom",n,$t);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Kt.x,Kt.y):t.Platform.canvas.createRadialGradient(Kt.x,Kt.y,0,Kt.x,Kt.y,Qt(Kt,$t)),d={type:r,style:l};Ft(d,l,e.stops,s);const h=Vt(n,Kt,$t,o||1,t.Platform.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Vt},{copy:te,move:ee,toOffsetOutBounds:ne}=t.BoundsHelper,{max:ie,abs:ae}=Math,re={},se=new t.Matrix,oe={};function le(t,e){let n,i,a,r,s=0,o=0,l=0,d=0;return e.forEach(t=>{n=t.x||0,i=t.y||0,r=1.5*(t.blur||0),a=ae(t.spread||0),s=ie(s,a+r-i),o=ie(o,a+r+n),l=ie(l,a+r+i),d=ie(d,a+r-n)}),s===o&&o===l&&l===d?s:[s,o,l,d]}function de(e,n,i){const{shapeBounds:a}=i;let r,s;t.Platform.fullImageShadow?(te(re,e.bounds),ee(re,n.x-a.x,n.y-a.y),r=e.bounds,s=re):(r=a,s=n),e.copyWorld(i.canvas,r,s)}const{toOffsetOutBounds:he}=t.BoundsHelper,ce={};const ue=le;const fe={shadow:function(e,i,a){let r,s;const{__nowWorld:o}=e,{shadow:l}=e.__,{worldCanvas:d,bounds:h,renderBounds:c,shapeBounds:u,scaleX:f,scaleY:p}=a,g=i.getSameCanvas(),_=l.length-1;ne(h,oe,c),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}g.setWorldShadow(oe.offsetX+(l.x||0)*f*y,oe.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y,n.ColorConvert.string(l.color)),s=n.Effect.getShadowTransform(e,g,a,l,oe,y),s&&g.setTransform(s),de(g,oe,a),s&&g.resetTransform(),r=c,l.box&&(g.restore(),g.save(),d&&(g.copyWorld(g,c,o,"copy"),r=o),d?g.copyWorld(d,o,o,"destination-out"):g.copyWorld(a.canvas,u,h,"destination-out")),t.LeafHelper.copyCanvasByWorld(e,i,g,r,l.blendMode),_&&m<_&&g.clearWorld(r)}),g.recycle(r)},innerShadow:function(e,i,a){let r,s;const{__nowWorld:o}=e,{innerShadow:l}=e.__,{worldCanvas:d,bounds:h,renderBounds:c,shapeBounds:u,scaleX:f,scaleY:p}=a,g=i.getSameCanvas(),_=l.length-1;he(h,ce,c),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}g.save(),g.setWorldShadow(ce.offsetX+(l.x||0)*f*y,ce.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y),s=n.Effect.getShadowTransform(e,g,a,l,ce,y,!0),s&&g.setTransform(s),de(g,ce,a),g.restore(),d?(g.copyWorld(g,c,o,"copy"),g.copyWorld(d,o,o,"source-out"),r=o):(g.copyWorld(a.canvas,u,h,"source-out"),r=c),g.fillWorld(r,n.ColorConvert.string(l.color),"source-in"),t.LeafHelper.copyCanvasByWorld(e,i,g,r,l.blendMode),_&&m<_&&g.clearWorld(r)}),g.recycle(r)},blur:function(t,e,n){const{blur:i}=t.__;n.setWorldBlur(i*t.__nowWorld.a),n.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),n.filter="none"},backgroundBlur:function(t,e,n){},getShadowRenderSpread:le,getShadowTransform:function(t,e,n,i,a,r,s){if(i.spread){const n=2*i.spread*r*(s?-1:1),{width:o,height:l}=t.__layout.strokeBounds;return se.set().scaleOfOuter({x:(a.x+a.width/2)*e.pixelRatio,y:(a.y+a.height/2)*e.pixelRatio},1+n/o,1+n/l),se}},isTransformShadow(t){},getInnerShadowSpread:ue},{excludeRenderBounds:pe}=t.LeafBoundsHelper;let ge;function _e(t,e,n,i,a,r,s,o){switch(e){case"grayscale":ge||(ge=!0,a.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,n,i,a,r){const s=t.__nowWorld;n.resetTransform(),n.opacity=1,n.useMask(i,s),r&&i.recycle(s);ye(t,e,n,1,a,r)}(t,n,i,a,s,o);break;case"opacity-path":ye(t,n,i,r,s,o);break;case"path":o&&n.restore()}}function me(t){return t.getSameCanvas(!1,!0)}function ye(t,e,n,i,a,r){const s=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(n,s,void 0,a),r?n.recycle(s):n.clearWorld(s)}n.Group.prototype.__renderMask=function(t,e){let n,i,a,r,s,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(n=l[d],o=n.__.mask,o){s&&(_e(this,s,t,a,i,r,void 0,!0),i=a=null),"clipping"!==o&&"clipping-path"!==o||pe(n,e)||n.__render(t,e),r=n.__.opacity,ge=!1,"path"===o||"clipping-path"===o?(r<1?(s="opacity-path",a||(a=me(t))):(s="path",t.save()),n.__clip(a||t,e)):(s="grayscale"===o?"grayscale":"alpha",i||(i=me(t)),a||(a=me(t)),n.__render(i,e));continue}const h=1===r&&n.__.__blendMode;h&&_e(this,s,t,a,i,r,void 0,!1),pe(n,e)||n.__render(a||t,e),h&&_e(this,s,t,a,i,r,h,!1)}_e(this,s,t,a,i,r,void 0,!0)};const we=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ve=we+"_#~&*+\\=|≮≯≈≠=…",xe=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function be(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Be=be("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Ee=be("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Le=be(we),Se=be(ve),ke=be("- —/~|┆·");var Re;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Re||(Re={}));const{Letter:Pe,Single:Ce,Before:Ae,After:Oe,Symbol:Te,Break:Me}=Re;function We(t){return Be[t]?Pe:ke[t]?Me:Ee[t]?Ae:Le[t]?Oe:Se[t]?Te:xe.test(t)?Ce:Pe}const De={trimRight(t){const{words:e}=t;let n,i=0,a=e.length;for(let r=a-1;r>-1&&(n=e[r].data[0]," "===n.char);r--)i++,t.width-=n.width;i&&e.splice(a-i,i)}};function He(t,e,n){switch(e){case"title":return n?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Ie}=De,{Letter:Fe,Single:je,Before:Ge,After:Ye,Symbol:ze,Break:Ue}=Re;let qe,Xe,Ne,Ve,Qe,Ze,Ke,$e,Je,tn,en,nn,an,rn,sn,on,ln,dn=[];function hn(t,e){Je&&!$e&&($e=Je),qe.data.push({char:t,width:e}),Ne+=e}function cn(){Ve+=Ne,qe.width=Ne,Xe.words.push(qe),qe={data:[]},Ne=0}function un(){rn&&(sn.paraNumber++,Xe.paraStart=!0,rn=!1),Je&&(Xe.startCharSize=$e,Xe.endCharSize=Je,$e=0),Xe.width=Ve,on.width?Ie(Xe):ln&&fn(),dn.push(Xe),Xe={words:[]},Ve=0}function fn(){Ve>(sn.maxWidth||0)&&(sn.maxWidth=Ve)}const{top:pn,right:gn,bottom:_n,left:mn}=t.Direction4;function yn(t,e,n){const{bounds:i,rows:a}=t;i[e]+=n;for(let t=0;t<a.length;t++)a[t][e]+=n}const wn={getDrawData:function(e,i){t.isString(e)||(e=String(e));let a=0,r=0,s=i.__getInput("width")||0,o=i.__getInput("height")||0;const{textDecoration:l,__font:d,__padding:h}=i;h&&(s?(a=h[mn],s-=h[gn]+h[mn]):i.autoSizeAlign||(a=h[mn]),o?(r=h[pn],o-=h[pn]+h[_n]):i.autoSizeAlign||(r=h[pn]));const c={bounds:{x:a,y:r,width:s,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,n,i){sn=e,dn=e.rows,on=e.bounds,ln=!on.width&&!i.autoSizeAlign;const{__letterSpacing:a,paraIndent:r,textCase:s}=i,{canvas:o}=t.Platform,{width:l,height:d}=on;if(l||d||a||"none"!==s){const t="none"!==i.textWrap,e="break"===i.textWrap;rn=!0,en=null,$e=Ke=Je=Ne=Ve=0,qe={data:[]},Xe={words:[]},a&&(n=[...n]);for(let i=0,d=n.length;i<d;i++)Ze=n[i],"\n"===Ze?(Ne&&cn(),Xe.paraEnd=!0,un(),rn=!0):(tn=We(Ze),tn===Fe&&"none"!==s&&(Ze=He(Ze,s,!Ne)),Ke=o.measureText(Ze).width,a&&(a<0&&(Je=Ke),Ke+=a),nn=tn===je&&(en===je||en===Fe)||en===je&&tn!==Ye,an=!(tn!==Ge&&tn!==je||en!==ze&&en!==Ye),Qe=rn&&r?l-r:l,t&&l&&Ve+Ne+Ke>Qe&&(e?(Ne&&cn(),Ve&&un()):(an||(an=tn===Fe&&en==Ye),nn||an||tn===Ue||tn===Ge||tn===je||Ne+Ke>Qe?(Ne&&cn(),Ve&&un()):Ve&&un()))," "===Ze&&!0!==rn&&Ve+Ne===0||(tn===Ue?(" "===Ze&&Ne&&cn(),hn(Ze,Ke),cn()):nn||an?(Ne&&cn(),hn(Ze,Ke)):hn(Ze,Ke)),en=tn);Ne&&cn(),Ve&&un(),dn.length>0&&(dn[dn.length-1].paraEnd=!0)}else n.split("\n").forEach(t=>{sn.paraNumber++,Ve=o.measureText(t).width,dn.push({x:r||0,text:t,width:Ve,paraStart:!0}),ln&&fn()})}(c,e,i),h&&function(t,e,n,i,a){if(!i&&n.autoSizeAlign)switch(n.textAlign){case"left":yn(e,"x",t[mn]);break;case"right":yn(e,"x",-t[gn])}if(!a&&n.autoSizeAlign)switch(n.verticalAlign){case"top":yn(e,"y",t[pn]);break;case"bottom":yn(e,"y",-t[_n])}}(h,c,i,s,o),function(t,e){const{rows:n,bounds:i}=t,a=n.length,{__lineHeight:r,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=i,m=r*a+(c?c*(t.paraNumber-1):0),y=s;if(l&&m>_)m=Math.max(_,r),a>1&&(t.overflow=a);else if(_||u)switch(h){case"middle":p+=(_-m)/2;break;case"bottom":p+=_-m}y+=p;let w,v,x,b=g||u?g:t.maxWidth;for(let s=0,h=a;s<h;s++){if(w=n[s],w.x=f,w.width<g||w.width>g&&!l)switch(d){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&c&&s>0&&(y+=c),w.y=y,y+=r,t.overflow>s&&y>m&&(w.isOverflow=!0,t.overflow=s+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<i.x&&(i.x=v),x>i.width&&(i.width=x),l&&g&&g<x&&(w.isOverflow=!0,t.overflow||(t.overflow=n.length))}i.y=p,i.height=m}(c,i),function(t,e,n){const{rows:i}=t,{textAlign:a,paraIndent:r,letterSpacing:s}=e;let o,l,d,h,c,u;i.forEach(t=>{t.words&&(d=r&&t.paraStart?r:0,u=t.words.length,l=n&&("justify"===a||"both"===a)&&u>1?(n-t.width-d)/(u-1):0,h=s||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!s&&(t.textMode=!0),2===h?(t.x+=d,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=d,o=t.x,t.data=[],t.words.forEach((e,n)=>{1===h?(c={char:"",x:o},o=function(t,e,n){return t.forEach(t=>{n.char+=t.char,e+=t.width}),e}(e.data,o,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):o=function(t,e,n,i){return t.forEach(t=>{(i||" "!==t.char)&&(t.x=e,n.push(t)),e+=t.width}),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==a||n===u-1||(o+=l,t.width+=l)})),t.words=null)})}(c,i,s),c.overflow&&function(e,n,i,a){if(!a)return;const{rows:r,overflow:s}=e;let{textOverflow:o}=n;if(r.splice(s),o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,h=i+a-d;("none"===n.textWrap?r:[r[s-1]]).forEach(t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let i=n;i>-1&&(e=t.data[i],l=e.x+e.width,!(i===n&&l<h));i--){if(l<h&&" "!==e.char||!i){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:o,x:l}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,i,a,s),"none"!==l&&function(e,i){let a,r=0;const{fontSize:s,textDecoration:o}=i;switch(e.decorationHeight=s/11,t.isObject(o)?(a=o.type,o.color&&(e.decorationColor=n.ColorConvert.string(o.color)),o.offset&&(r=Math.min(.3*s,Math.max(o.offset,.15*-s)))):a=o,a){case"under":e.decorationY=[.15*s+r];break;case"delete":e.decorationY=[.35*-s];break;case"under-delete":e.decorationY=[.15*s+r,.35*-s]}}(c,i),c}};const vn={string:function(e,i){if(!e)return"#000";const a=t.isNumber(i)&&i<1;if(t.isString(e)){if(!a||!n.ColorConvert.object)return e;e=n.ColorConvert.object(e)}let r=t.isUndefined(e.a)?1:e.a;a&&(r*=i);const s=e.r+","+e.g+","+e.b;return 1===r?"rgb("+s+")":"rgba("+s+","+r+")"}};Object.assign(n.TextConvert,wn),Object.assign(n.ColorConvert,vn),Object.assign(n.Paint,q),Object.assign(n.PaintImage,Mt),Object.assign(n.PaintGradient,Jt),Object.assign(n.Effect,fe),Object.assign(t.Creator,{interaction:(t,n,i,a)=>new e.InteractionBase(t,n,i,a),hitCanvas:(t,e)=>new i(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),r(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=y,exports.LeaferCanvas=i,exports.Picker=b,exports.Renderer=v,exports.Selector=B,exports.Watcher=o,exports.useCanvas=r,Object.keys(t).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}),Object.keys(e).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
2
2
  //# sourceMappingURL=worker.min.cjs.map