@netless/appliance-plugin 1.1.31 → 1.1.32
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/cdn/cdn.js +1 -1
- package/cdn/{fullWorker-8cQCRH.js → fullWorker-BuCr8Z.js} +1 -1
- package/cdn/{subWorker-Bj1Oy7.js → subWorker-00SXWn.js} +1 -1
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +1 -1
- package/dist/fullWorker.js +1 -1
- package/dist/{index-MwM-TUUF.mjs → index-B9IvzEGP.mjs} +1 -1
- package/dist/{index-DiHYEAGm.mjs → index-BA9yB27Q.mjs} +351 -352
- package/dist/{index-OfIZzgAi.js → index-CcTOfya8.js} +1 -1
- package/dist/{index-CpRTvTdJ.mjs → index-DFQ4hkMe.mjs} +1 -1
- package/dist/{index-XJ7wx0mr.js → index-DfV03MPS.js} +1 -1
- package/dist/index-DpQJ_LNL.js +1 -0
- package/dist/subWorker.js +1 -1
- package/package.json +1 -1
- package/dist/index-D-zGeAx1.js +0 -1
package/cdn/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-BuCr8Z.js",e="/subWorker-00SXWn.js";exports.fullWorkerUrl=r;exports.subWorkerUrl=e;
|
|
@@ -396,7 +396,7 @@ _inherits(l,_r$default22);return _createClass(l,[{key:"texture",get:function get
|
|
|
396
396
|
h=="length"||// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
397
397
|
n&&(h=="offset"||h=="parent")||// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
398
398
|
s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||// Skip index properties.
|
|
399
|
-
ET(h,f)))&&l.push(h);return l;}var nh=bT,DT=Object.prototype;function NT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||DT;return i===t;}var yl=NT;function BT(i,e){return function(t){return i(e(t));};}var ih=BT,WT=ih,FT=WT(Object.keys,Object),UT=FT,YT=yl,XT=UT,zT=Object.prototype,$T=zT.hasOwnProperty;function jT(i){if(!YT(i))return XT(i);var e=[];for(var t in Object(i))$T.call(i,t)&&t!="constructor"&&e.push(t);return e;}var GT=jT,kT=Hu,HT=eh;function VT(i){return i!=null&&HT(i.length)&&!kT(i);}var Sl=VT,KT=nh,ZT=GT,JT=Sl;function QT(i){return JT(i)?KT(i):ZT(i);}var Pl=QT,qT=Po,_T=Pl;function tC(i,e){return i&&qT(e,_T(e),i);}var eC=tC;function rC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var nC=rC,iC=qi,sC=yl,oC=nC,aC=Object.prototype,lC=aC.hasOwnProperty;function fC(i){if(!iC(i))return oC(i);var e=sC(i),t=[];for(var r in i)r=="constructor"&&(e||!lC.call(i,r))||t.push(r);return t;}var cC=fC,uC=nh,hC=cC,dC=Sl;function pC(i){return dC(i)?uC(i,!0):hC(i);}var xl=pC,vC=Po,gC=xl;function mC(i,e){return i&&vC(e,gC(e),i);}var yC=mC,no={exports:{}};no.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(no,no.exports);var SC=no.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var xC=PC;function TC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var sh=TC;function CC(){return[];}var oh=CC,IC=sh,OC=oh,wC=Object.prototype,AC=wC.propertyIsEnumerable,tu=Object.getOwnPropertySymbols,EC=tu?function(i){return i==null?[]:(i=Object(i),IC(tu(i),function(e){return AC.call(i,e);}));}:OC,Tl=EC,MC=Po,LC=Tl;function RC(i,e){return MC(i,LC(i),e);}var bC=RC;function DC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Cl=DC,NC=ih,BC=NC(Object.getPrototypeOf,Object),ah=BC,WC=Cl,FC=ah,UC=Tl,YC=oh,XC=Object.getOwnPropertySymbols,zC=XC?function(i){for(var e=[];i;)WC(e,UC(i)),i=FC(i);return e;}:YC,lh=zC,$C=Po,jC=lh;function GC(i,e){return $C(i,jC(i),e);}var kC=GC,HC=Cl,VC=_i;function KC(i,e,t){var r=e(i);return VC(i)?r:HC(r,t(i));}var fh=KC,ZC=fh,JC=Tl,QC=Pl;function qC(i){return ZC(i,QC,JC);}var ch=qC,_C=fh,tI=lh,eI=xl;function rI(i){return _C(i,eI,tI);}var nI=rI,iI=Gn,sI=_r,oI=iI(sI,"DataView"),aI=oI,lI=Gn,fI=_r,cI=lI(fI,"Promise"),uI=cI,hI=Gn,dI=_r,pI=hI(dI,"Set"),uh=pI,vI=Gn,gI=_r,mI=vI(gI,"WeakMap"),yI=mI,ol=aI,al=vl,ll=uI,fl=uh,cl=yI,hh=Pi,Oi=Vu,eu="[object Map]",SI="[object Object]",ru="[object Promise]",nu="[object Set]",iu="[object WeakMap]",su="[object DataView]",PI=Oi(ol),xI=Oi(al),TI=Oi(ll),CI=Oi(fl),II=Oi(cl),zn=hh;(ol&&zn(new ol(new ArrayBuffer(1)))!=su||al&&zn(new al())!=eu||ll&&zn(ll.resolve())!=ru||fl&&zn(new fl())!=nu||cl&&zn(new cl())!=iu)&&(zn=function zn(i){var e=hh(i),t=e==SI?i.constructor:void 0,r=t?Oi(t):"";if(r)switch(r){case PI:return su;case xI:return eu;case TI:return ru;case CI:return nu;case II:return iu;}return e;});var To=zn,OI=Object.prototype,wI=OI.hasOwnProperty;function AI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&wI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var EI=AI,MI=_r,LI=MI.Uint8Array,dh=LI,ou=dh;function RI(i){var e=new i.constructor(i.byteLength);return new ou(e).set(new ou(i)),e;}var Il=RI,bI=Il;function DI(i,e){var t=e?bI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var NI=DI,BI=/\w*$/;function WI(i){var e=new i.constructor(i.source,BI.exec(i));return e.lastIndex=i.lastIndex,e;}var FI=WI,au=Qi,lu=au?au.prototype:void 0,fu=lu?lu.valueOf:void 0;function UI(i){return fu?Object(fu.call(i)):{};}var YI=UI,XI=Il;function zI(i,e){var t=e?XI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var $I=zI,jI=Il,GI=NI,kI=FI,HI=YI,VI=$I,KI="[object Boolean]",ZI="[object Date]",JI="[object Map]",QI="[object Number]",qI="[object RegExp]",_I="[object Set]",tO="[object String]",eO="[object Symbol]",rO="[object ArrayBuffer]",nO="[object DataView]",iO="[object Float32Array]",sO="[object Float64Array]",oO="[object Int8Array]",aO="[object Int16Array]",lO="[object Int32Array]",fO="[object Uint8Array]",cO="[object Uint8ClampedArray]",uO="[object Uint16Array]",hO="[object Uint32Array]";function dO(i,e,t){var r=i.constructor;switch(e){case rO:return jI(i);case KI:case ZI:return new r(+i);case nO:return GI(i,t);case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:case hO:return VI(i,t);case JI:return new r();case QI:case tO:return new r(i);case qI:return kI(i);case _I:return new r();case eO:return HI(i);}}var pO=dO,vO=qi,cu=Object.create,gO=/* @__PURE__ */function(){function i(){}return function(e){if(!vO(e))return{};if(cu)return cu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),mO=gO,yO=mO,SO=ah,PO=yl;function xO(i){return typeof i.constructor=="function"&&!PO(i)?yO(SO(i)):{};}var TO=xO,CO=To,IO=pn,OO="[object Map]";function wO(i){return IO(i)&&CO(i)==OO;}var AO=wO,EO=AO,MO=xo,uu=ml,hu=uu&&uu.isMap,LO=hu?MO(hu):EO,RO=LO,bO=To,DO=pn,NO="[object Set]";function BO(i){return DO(i)&&bO(i)==NO;}var WO=BO,FO=WO,UO=xo,du=ml,pu=du&&du.isSet,YO=pu?UO(pu):FO,ph=YO,XO=/* @__PURE__ */Ln(ph),zO=Zu,$O=dx,jO=qu,GO=eC,kO=yC,HO=SC,VO=xC,KO=bC,ZO=kC,JO=ch,QO=nI,qO=To,_O=EI,tw=pO,ew=TO,rw=_i,nw=gl,iw=RO,sw=qi,ow=ph,aw=Pl,lw=xl,fw=1,cw=2,uw=4,vh="[object Arguments]",hw="[object Array]",dw="[object Boolean]",pw="[object Date]",vw="[object Error]",gh="[object Function]",gw="[object GeneratorFunction]",mw="[object Map]",yw="[object Number]",mh="[object Object]",Sw="[object RegExp]",Pw="[object Set]",xw="[object String]",Tw="[object Symbol]",Cw="[object WeakMap]",Iw="[object ArrayBuffer]",Ow="[object DataView]",ww="[object Float32Array]",Aw="[object Float64Array]",Ew="[object Int8Array]",Mw="[object Int16Array]",Lw="[object Int32Array]",Rw="[object Uint8Array]",bw="[object Uint8ClampedArray]",Dw="[object Uint16Array]",Nw="[object Uint32Array]",Ye={};Ye[vh]=Ye[hw]=Ye[Iw]=Ye[Ow]=Ye[dw]=Ye[pw]=Ye[ww]=Ye[Aw]=Ye[Ew]=Ye[Mw]=Ye[Lw]=Ye[mw]=Ye[yw]=Ye[mh]=Ye[Sw]=Ye[Pw]=Ye[xw]=Ye[Tw]=Ye[Rw]=Ye[bw]=Ye[Dw]=Ye[Nw]=!0;Ye[vw]=Ye[gh]=Ye[Cw]=!1;function _s(i,e,t,r,n,s){var c,l=e&fw,f=e&cw,h=e&uw;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!sw(i))return i;var m=rw(i);if(m){if(c=_O(i),!l)return VO(i,c);}else{var u=qO(i),y=u==gh||u==gw;if(nw(i))return HO(i,l);if(u==mh||u==vh||y&&!n){if(c=f||y?{}:ew(i),!l)return f?ZO(i,kO(c,i)):KO(i,GO(c,i));}else{if(!Ye[u])return n?i:{};c=tw(i,u,l);}}s||(s=new zO());var T=s.get(i);if(T)return T;s.set(i,c),ow(i)?i.forEach(function(S){c.add(_s(S,e,t,S,i,s));}):iw(i)&&i.forEach(function(S,O){c.set(O,_s(S,e,t,O,i,s));});var w=h?f?QO:JO:f?lw:aw,I=m?void 0:w(i);return $O(I||i,function(S,O){I&&(O=S,S=i[O]),jO(c,O,_s(S,e,t,O,i,s));}),c;}var Bw=_s,Ww=Bw,Fw=1,Uw=4;function Yw(i){return Ww(i,Fw|Uw);}var Xw=Yw,fr=/* @__PURE__ */Ln(Xw);var yh="1.1.31",zw="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(zw,"@").concat(yh),window.__netlessUA=i;}var gr={useWorker:"auto",useSimple:!1,useBackgroundThread:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"},undoRedo:{enableGlobal:!1,maxStackLength:20},markmap:{enable:!0,timeout:1e4,options:{autoFit:!0,duration:0,zoom:!1,pan:!1,maxInitialScale:10}}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(ui(r),"L").concat(ui(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=hi(r,n);return e?"M".concat(hi(i[0],i[1]),"Q").concat(ui(i[1])).concat(hi(i[1],i[2]),"T").concat(s).concat(hi(i[t-1],i[0])).concat(hi(i[0],i[1]),"Z"):"M".concat(ui(i[0]),"Q").concat(ui(i[1])).concat(hi(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(ui(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",gr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",gr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",gr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};_e(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var w=l==null?void 0:l.getBoundingClientRect();return w&&(t=Zt(t,{x:Math.floor(w.x-Mr.SafeBorderPadding),y:Math.floor(w.y-Mr.SafeBorderPadding),w:Math.floor(w.width+Mr.SafeBorderPadding*2),h:Math.floor(w.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var w=c.getAttribute("scale");w=[w[0]*T,w[1]*T];var I=c.parent.parent,S=c.getAttribute("translate"),_O30=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),I,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},w,S),_d30=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d30,n,s,!1),_O30.appendChild(_d30);var v=_O30.parent;v.render();var p=_O30.renderer.canvasRenderer,x=p.context;if(!x)return;var E=p.options.displayRatio,R=_d30.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:I.width,h:I.height};if(Ji(D,U)===Tr.outside){Lr(_d30,v),I.removeChild(v),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,I.width)-W.x,W.h=Math.min(D.y+D.h,I.height)-W.y;var X=this.getGroupRect(W,E),B=X.x,N=X.y,$=X.w,J=X.h;var tt=x.getImageData(B,N,$,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d30,v),I.removeChild(v),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_O30.worldScaling});ut&&r.append(ut),Lr(_d30,v),I.removeChild(v),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new cr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(w,I){return I%2?w-r[1]:w-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var w=_ref164.detail;var I=w.context;n?I.blendFuncSeparate(I.ZERO,I.ZERO,I.ZERO,I.ZERO):I.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var w=_ref165.detail;var I=w.context;n?I.blendFuncSeparate(I.SRC_ALPHA,I.ONE_MINUS_SRC_ALPHA,I.ONE,I.ONE_MINUS_SRC_ALPHA):I.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new $u(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this60=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?sE(r,c,e):(c.remove(),_vr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_vr(l,(f=_this60.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_vr(l,_this60.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_vr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,w=r.thickness;var I;var S=c&&fr(c)||n.get(t.name);if(!S)return;_e(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);var O=t.parent;if(O){if(m&&y&&c){var v=[S.op[0],S.op[1]];Oo(S.op,u,y,f);var p=[S.op[0],S.op[1]],x=[p[0]-v[0],p[1]-v[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(var E=0;E<S.opt.eraserlines.length;E++){var _S$opt$eraserlines$E=S.opt.eraserlines[E],R=_S$opt$eraserlines$E.op,D=_S$opt$eraserlines$E.thickness;S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Nl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),S.opt.translate=f,c){var _v6=[f[0]*O.worldScaling[0],f[1]*O.worldScaling[1]];I=Zi(S.rect,_v6),S.rect=I;}else{var _v7=Mr.getRectFromLayer(O,t.name);S.rect=_v7||S.rect;}}else if(_e(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)I=Dl(S.rect,h),S.rect=I;else{var _v8=Mr.getRectFromLayer(O,t.name);S.rect=_v8||S.rect;}if(T){var _v9=T.get(t.name);if(_v9)for(var _p10=0,_x37=0;_p10<S.op.length;_p10+=3,_x37++)S.op[_p10]=_v9[_x37][0],S.op[_p10+1]=_v9[_x37][1];}if(w&&(d=S==null?void 0:S.opt)!=null&&d.thickness&&(S.opt.thickness=w),s&&!(m&&y&&c)){if(f){var _v10=S.op.map(function(p,x){var E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p;});if(S.op=_v10,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(var _p11=0;_p11<S.opt.eraserlines.length;_p11++){var _x38=S.opt.eraserlines[_p11].op;for(var _E7=0;_E7<_x38.length;_E7++){var _R3=_x38[_E7].map(function(D,U){return U%2?D+f[1]:D+f[0];});S.opt.eraserlines[_p11].op[_E7]=_R3;}}}else if(_e(h)){var _v11=S.op;if(QA(_v11,S.centerPos,h),S.op=_v11,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(var _p12=0;_p12<S.opt.eraserlines.length;_p12++){var _x39=S.opt.eraserlines[_p12].op;for(var _E8=0;_E8<_x39.length;_E8++)qA(_x39[_E8],S.centerPos,h);}}}S&&n.setInfo(t.name,S);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===xt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===xt.BackgroundSVG&&(s.translate||s.scale)||t===xt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&r.type===vo.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var Xt=Mr;var Ol=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var wl={exports:{}};wl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
399
|
+
ET(h,f)))&&l.push(h);return l;}var nh=bT,DT=Object.prototype;function NT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||DT;return i===t;}var yl=NT;function BT(i,e){return function(t){return i(e(t));};}var ih=BT,WT=ih,FT=WT(Object.keys,Object),UT=FT,YT=yl,XT=UT,zT=Object.prototype,$T=zT.hasOwnProperty;function jT(i){if(!YT(i))return XT(i);var e=[];for(var t in Object(i))$T.call(i,t)&&t!="constructor"&&e.push(t);return e;}var GT=jT,kT=Hu,HT=eh;function VT(i){return i!=null&&HT(i.length)&&!kT(i);}var Sl=VT,KT=nh,ZT=GT,JT=Sl;function QT(i){return JT(i)?KT(i):ZT(i);}var Pl=QT,qT=Po,_T=Pl;function tC(i,e){return i&&qT(e,_T(e),i);}var eC=tC;function rC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var nC=rC,iC=qi,sC=yl,oC=nC,aC=Object.prototype,lC=aC.hasOwnProperty;function fC(i){if(!iC(i))return oC(i);var e=sC(i),t=[];for(var r in i)r=="constructor"&&(e||!lC.call(i,r))||t.push(r);return t;}var cC=fC,uC=nh,hC=cC,dC=Sl;function pC(i){return dC(i)?uC(i,!0):hC(i);}var xl=pC,vC=Po,gC=xl;function mC(i,e){return i&&vC(e,gC(e),i);}var yC=mC,no={exports:{}};no.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(no,no.exports);var SC=no.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var xC=PC;function TC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var sh=TC;function CC(){return[];}var oh=CC,IC=sh,OC=oh,wC=Object.prototype,AC=wC.propertyIsEnumerable,tu=Object.getOwnPropertySymbols,EC=tu?function(i){return i==null?[]:(i=Object(i),IC(tu(i),function(e){return AC.call(i,e);}));}:OC,Tl=EC,MC=Po,LC=Tl;function RC(i,e){return MC(i,LC(i),e);}var bC=RC;function DC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Cl=DC,NC=ih,BC=NC(Object.getPrototypeOf,Object),ah=BC,WC=Cl,FC=ah,UC=Tl,YC=oh,XC=Object.getOwnPropertySymbols,zC=XC?function(i){for(var e=[];i;)WC(e,UC(i)),i=FC(i);return e;}:YC,lh=zC,$C=Po,jC=lh;function GC(i,e){return $C(i,jC(i),e);}var kC=GC,HC=Cl,VC=_i;function KC(i,e,t){var r=e(i);return VC(i)?r:HC(r,t(i));}var fh=KC,ZC=fh,JC=Tl,QC=Pl;function qC(i){return ZC(i,QC,JC);}var ch=qC,_C=fh,tI=lh,eI=xl;function rI(i){return _C(i,eI,tI);}var nI=rI,iI=Gn,sI=_r,oI=iI(sI,"DataView"),aI=oI,lI=Gn,fI=_r,cI=lI(fI,"Promise"),uI=cI,hI=Gn,dI=_r,pI=hI(dI,"Set"),uh=pI,vI=Gn,gI=_r,mI=vI(gI,"WeakMap"),yI=mI,ol=aI,al=vl,ll=uI,fl=uh,cl=yI,hh=Pi,Oi=Vu,eu="[object Map]",SI="[object Object]",ru="[object Promise]",nu="[object Set]",iu="[object WeakMap]",su="[object DataView]",PI=Oi(ol),xI=Oi(al),TI=Oi(ll),CI=Oi(fl),II=Oi(cl),zn=hh;(ol&&zn(new ol(new ArrayBuffer(1)))!=su||al&&zn(new al())!=eu||ll&&zn(ll.resolve())!=ru||fl&&zn(new fl())!=nu||cl&&zn(new cl())!=iu)&&(zn=function zn(i){var e=hh(i),t=e==SI?i.constructor:void 0,r=t?Oi(t):"";if(r)switch(r){case PI:return su;case xI:return eu;case TI:return ru;case CI:return nu;case II:return iu;}return e;});var To=zn,OI=Object.prototype,wI=OI.hasOwnProperty;function AI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&wI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var EI=AI,MI=_r,LI=MI.Uint8Array,dh=LI,ou=dh;function RI(i){var e=new i.constructor(i.byteLength);return new ou(e).set(new ou(i)),e;}var Il=RI,bI=Il;function DI(i,e){var t=e?bI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var NI=DI,BI=/\w*$/;function WI(i){var e=new i.constructor(i.source,BI.exec(i));return e.lastIndex=i.lastIndex,e;}var FI=WI,au=Qi,lu=au?au.prototype:void 0,fu=lu?lu.valueOf:void 0;function UI(i){return fu?Object(fu.call(i)):{};}var YI=UI,XI=Il;function zI(i,e){var t=e?XI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var $I=zI,jI=Il,GI=NI,kI=FI,HI=YI,VI=$I,KI="[object Boolean]",ZI="[object Date]",JI="[object Map]",QI="[object Number]",qI="[object RegExp]",_I="[object Set]",tO="[object String]",eO="[object Symbol]",rO="[object ArrayBuffer]",nO="[object DataView]",iO="[object Float32Array]",sO="[object Float64Array]",oO="[object Int8Array]",aO="[object Int16Array]",lO="[object Int32Array]",fO="[object Uint8Array]",cO="[object Uint8ClampedArray]",uO="[object Uint16Array]",hO="[object Uint32Array]";function dO(i,e,t){var r=i.constructor;switch(e){case rO:return jI(i);case KI:case ZI:return new r(+i);case nO:return GI(i,t);case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:case hO:return VI(i,t);case JI:return new r();case QI:case tO:return new r(i);case qI:return kI(i);case _I:return new r();case eO:return HI(i);}}var pO=dO,vO=qi,cu=Object.create,gO=/* @__PURE__ */function(){function i(){}return function(e){if(!vO(e))return{};if(cu)return cu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),mO=gO,yO=mO,SO=ah,PO=yl;function xO(i){return typeof i.constructor=="function"&&!PO(i)?yO(SO(i)):{};}var TO=xO,CO=To,IO=pn,OO="[object Map]";function wO(i){return IO(i)&&CO(i)==OO;}var AO=wO,EO=AO,MO=xo,uu=ml,hu=uu&&uu.isMap,LO=hu?MO(hu):EO,RO=LO,bO=To,DO=pn,NO="[object Set]";function BO(i){return DO(i)&&bO(i)==NO;}var WO=BO,FO=WO,UO=xo,du=ml,pu=du&&du.isSet,YO=pu?UO(pu):FO,ph=YO,XO=/* @__PURE__ */Ln(ph),zO=Zu,$O=dx,jO=qu,GO=eC,kO=yC,HO=SC,VO=xC,KO=bC,ZO=kC,JO=ch,QO=nI,qO=To,_O=EI,tw=pO,ew=TO,rw=_i,nw=gl,iw=RO,sw=qi,ow=ph,aw=Pl,lw=xl,fw=1,cw=2,uw=4,vh="[object Arguments]",hw="[object Array]",dw="[object Boolean]",pw="[object Date]",vw="[object Error]",gh="[object Function]",gw="[object GeneratorFunction]",mw="[object Map]",yw="[object Number]",mh="[object Object]",Sw="[object RegExp]",Pw="[object Set]",xw="[object String]",Tw="[object Symbol]",Cw="[object WeakMap]",Iw="[object ArrayBuffer]",Ow="[object DataView]",ww="[object Float32Array]",Aw="[object Float64Array]",Ew="[object Int8Array]",Mw="[object Int16Array]",Lw="[object Int32Array]",Rw="[object Uint8Array]",bw="[object Uint8ClampedArray]",Dw="[object Uint16Array]",Nw="[object Uint32Array]",Ye={};Ye[vh]=Ye[hw]=Ye[Iw]=Ye[Ow]=Ye[dw]=Ye[pw]=Ye[ww]=Ye[Aw]=Ye[Ew]=Ye[Mw]=Ye[Lw]=Ye[mw]=Ye[yw]=Ye[mh]=Ye[Sw]=Ye[Pw]=Ye[xw]=Ye[Tw]=Ye[Rw]=Ye[bw]=Ye[Dw]=Ye[Nw]=!0;Ye[vw]=Ye[gh]=Ye[Cw]=!1;function _s(i,e,t,r,n,s){var c,l=e&fw,f=e&cw,h=e&uw;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!sw(i))return i;var m=rw(i);if(m){if(c=_O(i),!l)return VO(i,c);}else{var u=qO(i),y=u==gh||u==gw;if(nw(i))return HO(i,l);if(u==mh||u==vh||y&&!n){if(c=f||y?{}:ew(i),!l)return f?ZO(i,kO(c,i)):KO(i,GO(c,i));}else{if(!Ye[u])return n?i:{};c=tw(i,u,l);}}s||(s=new zO());var T=s.get(i);if(T)return T;s.set(i,c),ow(i)?i.forEach(function(S){c.add(_s(S,e,t,S,i,s));}):iw(i)&&i.forEach(function(S,O){c.set(O,_s(S,e,t,O,i,s));});var w=h?f?QO:JO:f?lw:aw,I=m?void 0:w(i);return $O(I||i,function(S,O){I&&(O=S,S=i[O]),jO(c,O,_s(S,e,t,O,i,s));}),c;}var Bw=_s,Ww=Bw,Fw=1,Uw=4;function Yw(i){return Ww(i,Fw|Uw);}var Xw=Yw,fr=/* @__PURE__ */Ln(Xw);var yh="1.1.32",zw="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(zw,"@").concat(yh),window.__netlessUA=i;}var gr={useWorker:"auto",useSimple:!1,useBackgroundThread:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"},undoRedo:{enableGlobal:!1,maxStackLength:20},markmap:{enable:!0,timeout:1e4,options:{autoFit:!0,duration:0,zoom:!1,pan:!1,maxInitialScale:10}}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(ui(r),"L").concat(ui(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=hi(r,n);return e?"M".concat(hi(i[0],i[1]),"Q").concat(ui(i[1])).concat(hi(i[1],i[2]),"T").concat(s).concat(hi(i[t-1],i[0])).concat(hi(i[0],i[1]),"Z"):"M".concat(ui(i[0]),"Q").concat(ui(i[1])).concat(hi(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(ui(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",gr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",gr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",gr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};_e(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var w=l==null?void 0:l.getBoundingClientRect();return w&&(t=Zt(t,{x:Math.floor(w.x-Mr.SafeBorderPadding),y:Math.floor(w.y-Mr.SafeBorderPadding),w:Math.floor(w.width+Mr.SafeBorderPadding*2),h:Math.floor(w.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var w=c.getAttribute("scale");w=[w[0]*T,w[1]*T];var I=c.parent.parent,S=c.getAttribute("translate"),_O30=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),I,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},w,S),_d30=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d30,n,s,!1),_O30.appendChild(_d30);var v=_O30.parent;v.render();var p=_O30.renderer.canvasRenderer,x=p.context;if(!x)return;var E=p.options.displayRatio,R=_d30.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:I.width,h:I.height};if(Ji(D,U)===Tr.outside){Lr(_d30,v),I.removeChild(v),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,I.width)-W.x,W.h=Math.min(D.y+D.h,I.height)-W.y;var X=this.getGroupRect(W,E),B=X.x,N=X.y,$=X.w,J=X.h;var tt=x.getImageData(B,N,$,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d30,v),I.removeChild(v),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_O30.worldScaling});ut&&r.append(ut),Lr(_d30,v),I.removeChild(v),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new cr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(w,I){return I%2?w-r[1]:w-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var w=_ref164.detail;var I=w.context;n?I.blendFuncSeparate(I.ZERO,I.ZERO,I.ZERO,I.ZERO):I.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var w=_ref165.detail;var I=w.context;n?I.blendFuncSeparate(I.SRC_ALPHA,I.ONE_MINUS_SRC_ALPHA,I.ONE,I.ONE_MINUS_SRC_ALPHA):I.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new $u(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this60=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?sE(r,c,e):(c.remove(),_vr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_vr(l,(f=_this60.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_vr(l,_this60.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_vr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,w=r.thickness;var I;var S=c&&fr(c)||n.get(t.name);if(!S)return;_e(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);var O=t.parent;if(O){if(m&&y&&c){var v=[S.op[0],S.op[1]];Oo(S.op,u,y,f);var p=[S.op[0],S.op[1]],x=[p[0]-v[0],p[1]-v[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(var E=0;E<S.opt.eraserlines.length;E++){var _S$opt$eraserlines$E=S.opt.eraserlines[E],R=_S$opt$eraserlines$E.op,D=_S$opt$eraserlines$E.thickness;S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Nl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),S.opt.translate=f,c){var _v6=[f[0]*O.worldScaling[0],f[1]*O.worldScaling[1]];I=Zi(S.rect,_v6),S.rect=I;}else{var _v7=Mr.getRectFromLayer(O,t.name);S.rect=_v7||S.rect;}}else if(_e(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)I=Dl(S.rect,h),S.rect=I;else{var _v8=Mr.getRectFromLayer(O,t.name);S.rect=_v8||S.rect;}if(T){var _v9=T.get(t.name);if(_v9)for(var _p10=0,_x37=0;_p10<S.op.length;_p10+=3,_x37++)S.op[_p10]=_v9[_x37][0],S.op[_p10+1]=_v9[_x37][1];}if(w&&(d=S==null?void 0:S.opt)!=null&&d.thickness&&(S.opt.thickness=w),s&&!(m&&y&&c)){if(f){var _v10=S.op.map(function(p,x){var E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p;});if(S.op=_v10,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(var _p11=0;_p11<S.opt.eraserlines.length;_p11++){var _x38=S.opt.eraserlines[_p11].op;for(var _E7=0;_E7<_x38.length;_E7++){var _R3=_x38[_E7].map(function(D,U){return U%2?D+f[1]:D+f[0];});S.opt.eraserlines[_p11].op[_E7]=_R3;}}}else if(_e(h)){var _v11=S.op;if(QA(_v11,S.centerPos,h),S.op=_v11,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(var _p12=0;_p12<S.opt.eraserlines.length;_p12++){var _x39=S.opt.eraserlines[_p12].op;for(var _E8=0;_E8<_x39.length;_E8++)qA(_x39[_E8],S.centerPos,h);}}}S&&n.setInfo(t.name,S);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===xt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===xt.BackgroundSVG&&(s.translate||s.scale)||t===xt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&r.type===vo.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var Xt=Mr;var Ol=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var wl={exports:{}};wl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
400
400
|
compressToUint8Array:function compressToUint8Array(f){for(var h=l.compress(f),m=new Uint8Array(h.length*2),u=0,y=h.length;u<y;u++){var T=h.charCodeAt(u);m[u*2]=T>>>8,m[u*2+1]=T%256;}return m;},//decompress from uint8array (UCS-2 big endian format)
|
|
401
401
|
decompressFromUint8Array:function decompressFromUint8Array(f){if(f==null)return l.decompress(f);for(var h=new Array(f.length/2),m=0,u=h.length;m<u;m++)h[m]=f[m*2]*256+f[m*2+1];var y=[];return h.forEach(function(T){y.push(t(T));}),l.decompress(y.join(""));},//compress into a string that is already URI encoded
|
|
402
402
|
compressToEncodedURIComponent:function compressToEncodedURIComponent(f){return f==null?"":l._compress(f,6,function(h){return n.charAt(h);});},//decompress from an output of compressToEncodedURIComponent
|
|
@@ -396,7 +396,7 @@ _inherits(l,_r$default22);return _createClass(l,[{key:"texture",get:function get
|
|
|
396
396
|
h=="length"||// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
397
397
|
n&&(h=="offset"||h=="parent")||// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
398
398
|
s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||// Skip index properties.
|
|
399
|
-
ET(h,f)))&&l.push(h);return l;}var nh=bT,DT=Object.prototype;function NT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||DT;return i===t;}var yl=NT;function BT(i,e){return function(t){return i(e(t));};}var ih=BT,WT=ih,FT=WT(Object.keys,Object),UT=FT,YT=yl,XT=UT,zT=Object.prototype,$T=zT.hasOwnProperty;function jT(i){if(!YT(i))return XT(i);var e=[];for(var t in Object(i))$T.call(i,t)&&t!="constructor"&&e.push(t);return e;}var GT=jT,kT=Hu,HT=eh;function VT(i){return i!=null&&HT(i.length)&&!kT(i);}var Sl=VT,KT=nh,ZT=GT,JT=Sl;function QT(i){return JT(i)?KT(i):ZT(i);}var Pl=QT,qT=Po,_T=Pl;function tC(i,e){return i&&qT(e,_T(e),i);}var eC=tC;function rC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var nC=rC,iC=qi,sC=yl,oC=nC,aC=Object.prototype,lC=aC.hasOwnProperty;function fC(i){if(!iC(i))return oC(i);var e=sC(i),t=[];for(var r in i)r=="constructor"&&(e||!lC.call(i,r))||t.push(r);return t;}var cC=fC,uC=nh,hC=cC,dC=Sl;function pC(i){return dC(i)?uC(i,!0):hC(i);}var xl=pC,vC=Po,gC=xl;function mC(i,e){return i&&vC(e,gC(e),i);}var yC=mC,no={exports:{}};no.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(no,no.exports);var SC=no.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var xC=PC;function TC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var sh=TC;function CC(){return[];}var oh=CC,IC=sh,OC=oh,wC=Object.prototype,AC=wC.propertyIsEnumerable,tu=Object.getOwnPropertySymbols,EC=tu?function(i){return i==null?[]:(i=Object(i),IC(tu(i),function(e){return AC.call(i,e);}));}:OC,Tl=EC,MC=Po,LC=Tl;function RC(i,e){return MC(i,LC(i),e);}var bC=RC;function DC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Cl=DC,NC=ih,BC=NC(Object.getPrototypeOf,Object),ah=BC,WC=Cl,FC=ah,UC=Tl,YC=oh,XC=Object.getOwnPropertySymbols,zC=XC?function(i){for(var e=[];i;)WC(e,UC(i)),i=FC(i);return e;}:YC,lh=zC,$C=Po,jC=lh;function GC(i,e){return $C(i,jC(i),e);}var kC=GC,HC=Cl,VC=_i;function KC(i,e,t){var r=e(i);return VC(i)?r:HC(r,t(i));}var fh=KC,ZC=fh,JC=Tl,QC=Pl;function qC(i){return ZC(i,QC,JC);}var ch=qC,_C=fh,tI=lh,eI=xl;function rI(i){return _C(i,eI,tI);}var nI=rI,iI=Gn,sI=_r,oI=iI(sI,"DataView"),aI=oI,lI=Gn,fI=_r,cI=lI(fI,"Promise"),uI=cI,hI=Gn,dI=_r,pI=hI(dI,"Set"),uh=pI,vI=Gn,gI=_r,mI=vI(gI,"WeakMap"),yI=mI,ol=aI,al=vl,ll=uI,fl=uh,cl=yI,hh=Pi,Oi=Vu,eu="[object Map]",SI="[object Object]",ru="[object Promise]",nu="[object Set]",iu="[object WeakMap]",su="[object DataView]",PI=Oi(ol),xI=Oi(al),TI=Oi(ll),CI=Oi(fl),II=Oi(cl),zn=hh;(ol&&zn(new ol(new ArrayBuffer(1)))!=su||al&&zn(new al())!=eu||ll&&zn(ll.resolve())!=ru||fl&&zn(new fl())!=nu||cl&&zn(new cl())!=iu)&&(zn=function zn(i){var e=hh(i),t=e==SI?i.constructor:void 0,r=t?Oi(t):"";if(r)switch(r){case PI:return su;case xI:return eu;case TI:return ru;case CI:return nu;case II:return iu;}return e;});var To=zn,OI=Object.prototype,wI=OI.hasOwnProperty;function AI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&wI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var EI=AI,MI=_r,LI=MI.Uint8Array,dh=LI,ou=dh;function RI(i){var e=new i.constructor(i.byteLength);return new ou(e).set(new ou(i)),e;}var Il=RI,bI=Il;function DI(i,e){var t=e?bI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var NI=DI,BI=/\w*$/;function WI(i){var e=new i.constructor(i.source,BI.exec(i));return e.lastIndex=i.lastIndex,e;}var FI=WI,au=Qi,lu=au?au.prototype:void 0,fu=lu?lu.valueOf:void 0;function UI(i){return fu?Object(fu.call(i)):{};}var YI=UI,XI=Il;function zI(i,e){var t=e?XI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var $I=zI,jI=Il,GI=NI,kI=FI,HI=YI,VI=$I,KI="[object Boolean]",ZI="[object Date]",JI="[object Map]",QI="[object Number]",qI="[object RegExp]",_I="[object Set]",tO="[object String]",eO="[object Symbol]",rO="[object ArrayBuffer]",nO="[object DataView]",iO="[object Float32Array]",sO="[object Float64Array]",oO="[object Int8Array]",aO="[object Int16Array]",lO="[object Int32Array]",fO="[object Uint8Array]",cO="[object Uint8ClampedArray]",uO="[object Uint16Array]",hO="[object Uint32Array]";function dO(i,e,t){var r=i.constructor;switch(e){case rO:return jI(i);case KI:case ZI:return new r(+i);case nO:return GI(i,t);case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:case hO:return VI(i,t);case JI:return new r();case QI:case tO:return new r(i);case qI:return kI(i);case _I:return new r();case eO:return HI(i);}}var pO=dO,vO=qi,cu=Object.create,gO=/* @__PURE__ */function(){function i(){}return function(e){if(!vO(e))return{};if(cu)return cu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),mO=gO,yO=mO,SO=ah,PO=yl;function xO(i){return typeof i.constructor=="function"&&!PO(i)?yO(SO(i)):{};}var TO=xO,CO=To,IO=pn,OO="[object Map]";function wO(i){return IO(i)&&CO(i)==OO;}var AO=wO,EO=AO,MO=xo,uu=ml,hu=uu&&uu.isMap,LO=hu?MO(hu):EO,RO=LO,bO=To,DO=pn,NO="[object Set]";function BO(i){return DO(i)&&bO(i)==NO;}var WO=BO,FO=WO,UO=xo,du=ml,pu=du&&du.isSet,YO=pu?UO(pu):FO,ph=YO,XO=/* @__PURE__ */Ln(ph),zO=Zu,$O=dx,jO=qu,GO=eC,kO=yC,HO=SC,VO=xC,KO=bC,ZO=kC,JO=ch,QO=nI,qO=To,_O=EI,tw=pO,ew=TO,rw=_i,nw=gl,iw=RO,sw=qi,ow=ph,aw=Pl,lw=xl,fw=1,cw=2,uw=4,vh="[object Arguments]",hw="[object Array]",dw="[object Boolean]",pw="[object Date]",vw="[object Error]",gh="[object Function]",gw="[object GeneratorFunction]",mw="[object Map]",yw="[object Number]",mh="[object Object]",Sw="[object RegExp]",Pw="[object Set]",xw="[object String]",Tw="[object Symbol]",Cw="[object WeakMap]",Iw="[object ArrayBuffer]",Ow="[object DataView]",ww="[object Float32Array]",Aw="[object Float64Array]",Ew="[object Int8Array]",Mw="[object Int16Array]",Lw="[object Int32Array]",Rw="[object Uint8Array]",bw="[object Uint8ClampedArray]",Dw="[object Uint16Array]",Nw="[object Uint32Array]",Ye={};Ye[vh]=Ye[hw]=Ye[Iw]=Ye[Ow]=Ye[dw]=Ye[pw]=Ye[ww]=Ye[Aw]=Ye[Ew]=Ye[Mw]=Ye[Lw]=Ye[mw]=Ye[yw]=Ye[mh]=Ye[Sw]=Ye[Pw]=Ye[xw]=Ye[Tw]=Ye[Rw]=Ye[bw]=Ye[Dw]=Ye[Nw]=!0;Ye[vw]=Ye[gh]=Ye[Cw]=!1;function _s(i,e,t,r,n,s){var c,l=e&fw,f=e&cw,h=e&uw;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!sw(i))return i;var m=rw(i);if(m){if(c=_O(i),!l)return VO(i,c);}else{var u=qO(i),y=u==gh||u==gw;if(nw(i))return HO(i,l);if(u==mh||u==vh||y&&!n){if(c=f||y?{}:ew(i),!l)return f?ZO(i,kO(c,i)):KO(i,GO(c,i));}else{if(!Ye[u])return n?i:{};c=tw(i,u,l);}}s||(s=new zO());var T=s.get(i);if(T)return T;s.set(i,c),ow(i)?i.forEach(function(S){c.add(_s(S,e,t,S,i,s));}):iw(i)&&i.forEach(function(S,O){c.set(O,_s(S,e,t,O,i,s));});var w=h?f?QO:JO:f?lw:aw,I=m?void 0:w(i);return $O(I||i,function(S,O){I&&(O=S,S=i[O]),jO(c,O,_s(S,e,t,O,i,s));}),c;}var Bw=_s,Ww=Bw,Fw=1,Uw=4;function Yw(i){return Ww(i,Fw|Uw);}var Xw=Yw,fr=/* @__PURE__ */Ln(Xw);var yh="1.1.31",zw="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(zw,"@").concat(yh),window.__netlessUA=i;}var gr={useWorker:"auto",useSimple:!1,useBackgroundThread:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"},undoRedo:{enableGlobal:!1,maxStackLength:20},markmap:{enable:!0,timeout:1e4,options:{autoFit:!0,duration:0,zoom:!1,pan:!1,maxInitialScale:10}}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(ui(r),"L").concat(ui(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=hi(r,n);return e?"M".concat(hi(i[0],i[1]),"Q").concat(ui(i[1])).concat(hi(i[1],i[2]),"T").concat(s).concat(hi(i[t-1],i[0])).concat(hi(i[0],i[1]),"Z"):"M".concat(ui(i[0]),"Q").concat(ui(i[1])).concat(hi(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(ui(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",gr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",gr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",gr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};_e(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var w=l==null?void 0:l.getBoundingClientRect();return w&&(t=Zt(t,{x:Math.floor(w.x-Mr.SafeBorderPadding),y:Math.floor(w.y-Mr.SafeBorderPadding),w:Math.floor(w.width+Mr.SafeBorderPadding*2),h:Math.floor(w.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var w=c.getAttribute("scale");w=[w[0]*T,w[1]*T];var I=c.parent.parent,S=c.getAttribute("translate"),_O30=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),I,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},w,S),_d30=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d30,n,s,!1),_O30.appendChild(_d30);var v=_O30.parent;v.render();var p=_O30.renderer.canvasRenderer,x=p.context;if(!x)return;var E=p.options.displayRatio,R=_d30.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:I.width,h:I.height};if(Ji(D,U)===Tr.outside){Lr(_d30,v),I.removeChild(v),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,I.width)-W.x,W.h=Math.min(D.y+D.h,I.height)-W.y;var X=this.getGroupRect(W,E),B=X.x,N=X.y,$=X.w,J=X.h;var tt=x.getImageData(B,N,$,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d30,v),I.removeChild(v),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_O30.worldScaling});ut&&r.append(ut),Lr(_d30,v),I.removeChild(v),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new cr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(w,I){return I%2?w-r[1]:w-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var w=_ref164.detail;var I=w.context;n?I.blendFuncSeparate(I.ZERO,I.ZERO,I.ZERO,I.ZERO):I.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var w=_ref165.detail;var I=w.context;n?I.blendFuncSeparate(I.SRC_ALPHA,I.ONE_MINUS_SRC_ALPHA,I.ONE,I.ONE_MINUS_SRC_ALPHA):I.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new $u(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this60=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?sE(r,c,e):(c.remove(),_vr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_vr(l,(f=_this60.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_vr(l,_this60.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_vr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,w=r.thickness;var I;var S=c&&fr(c)||n.get(t.name);if(!S)return;_e(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);var O=t.parent;if(O){if(m&&y&&c){var v=[S.op[0],S.op[1]];Oo(S.op,u,y,f);var p=[S.op[0],S.op[1]],x=[p[0]-v[0],p[1]-v[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(var E=0;E<S.opt.eraserlines.length;E++){var _S$opt$eraserlines$E=S.opt.eraserlines[E],R=_S$opt$eraserlines$E.op,D=_S$opt$eraserlines$E.thickness;S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Nl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),S.opt.translate=f,c){var _v6=[f[0]*O.worldScaling[0],f[1]*O.worldScaling[1]];I=Zi(S.rect,_v6),S.rect=I;}else{var _v7=Mr.getRectFromLayer(O,t.name);S.rect=_v7||S.rect;}}else if(_e(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)I=Dl(S.rect,h),S.rect=I;else{var _v8=Mr.getRectFromLayer(O,t.name);S.rect=_v8||S.rect;}if(T){var _v9=T.get(t.name);if(_v9)for(var _p10=0,_x37=0;_p10<S.op.length;_p10+=3,_x37++)S.op[_p10]=_v9[_x37][0],S.op[_p10+1]=_v9[_x37][1];}if(w&&(d=S==null?void 0:S.opt)!=null&&d.thickness&&(S.opt.thickness=w),s&&!(m&&y&&c)){if(f){var _v10=S.op.map(function(p,x){var E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p;});if(S.op=_v10,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(var _p11=0;_p11<S.opt.eraserlines.length;_p11++){var _x38=S.opt.eraserlines[_p11].op;for(var _E7=0;_E7<_x38.length;_E7++){var _R3=_x38[_E7].map(function(D,U){return U%2?D+f[1]:D+f[0];});S.opt.eraserlines[_p11].op[_E7]=_R3;}}}else if(_e(h)){var _v11=S.op;if(QA(_v11,S.centerPos,h),S.op=_v11,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(var _p12=0;_p12<S.opt.eraserlines.length;_p12++){var _x39=S.opt.eraserlines[_p12].op;for(var _E8=0;_E8<_x39.length;_E8++)qA(_x39[_E8],S.centerPos,h);}}}S&&n.setInfo(t.name,S);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===xt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===xt.BackgroundSVG&&(s.translate||s.scale)||t===xt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&r.type===vo.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var Xt=Mr;var Ol=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var wl={exports:{}};wl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
399
|
+
ET(h,f)))&&l.push(h);return l;}var nh=bT,DT=Object.prototype;function NT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||DT;return i===t;}var yl=NT;function BT(i,e){return function(t){return i(e(t));};}var ih=BT,WT=ih,FT=WT(Object.keys,Object),UT=FT,YT=yl,XT=UT,zT=Object.prototype,$T=zT.hasOwnProperty;function jT(i){if(!YT(i))return XT(i);var e=[];for(var t in Object(i))$T.call(i,t)&&t!="constructor"&&e.push(t);return e;}var GT=jT,kT=Hu,HT=eh;function VT(i){return i!=null&&HT(i.length)&&!kT(i);}var Sl=VT,KT=nh,ZT=GT,JT=Sl;function QT(i){return JT(i)?KT(i):ZT(i);}var Pl=QT,qT=Po,_T=Pl;function tC(i,e){return i&&qT(e,_T(e),i);}var eC=tC;function rC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var nC=rC,iC=qi,sC=yl,oC=nC,aC=Object.prototype,lC=aC.hasOwnProperty;function fC(i){if(!iC(i))return oC(i);var e=sC(i),t=[];for(var r in i)r=="constructor"&&(e||!lC.call(i,r))||t.push(r);return t;}var cC=fC,uC=nh,hC=cC,dC=Sl;function pC(i){return dC(i)?uC(i,!0):hC(i);}var xl=pC,vC=Po,gC=xl;function mC(i,e){return i&&vC(e,gC(e),i);}var yC=mC,no={exports:{}};no.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(no,no.exports);var SC=no.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var xC=PC;function TC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var sh=TC;function CC(){return[];}var oh=CC,IC=sh,OC=oh,wC=Object.prototype,AC=wC.propertyIsEnumerable,tu=Object.getOwnPropertySymbols,EC=tu?function(i){return i==null?[]:(i=Object(i),IC(tu(i),function(e){return AC.call(i,e);}));}:OC,Tl=EC,MC=Po,LC=Tl;function RC(i,e){return MC(i,LC(i),e);}var bC=RC;function DC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Cl=DC,NC=ih,BC=NC(Object.getPrototypeOf,Object),ah=BC,WC=Cl,FC=ah,UC=Tl,YC=oh,XC=Object.getOwnPropertySymbols,zC=XC?function(i){for(var e=[];i;)WC(e,UC(i)),i=FC(i);return e;}:YC,lh=zC,$C=Po,jC=lh;function GC(i,e){return $C(i,jC(i),e);}var kC=GC,HC=Cl,VC=_i;function KC(i,e,t){var r=e(i);return VC(i)?r:HC(r,t(i));}var fh=KC,ZC=fh,JC=Tl,QC=Pl;function qC(i){return ZC(i,QC,JC);}var ch=qC,_C=fh,tI=lh,eI=xl;function rI(i){return _C(i,eI,tI);}var nI=rI,iI=Gn,sI=_r,oI=iI(sI,"DataView"),aI=oI,lI=Gn,fI=_r,cI=lI(fI,"Promise"),uI=cI,hI=Gn,dI=_r,pI=hI(dI,"Set"),uh=pI,vI=Gn,gI=_r,mI=vI(gI,"WeakMap"),yI=mI,ol=aI,al=vl,ll=uI,fl=uh,cl=yI,hh=Pi,Oi=Vu,eu="[object Map]",SI="[object Object]",ru="[object Promise]",nu="[object Set]",iu="[object WeakMap]",su="[object DataView]",PI=Oi(ol),xI=Oi(al),TI=Oi(ll),CI=Oi(fl),II=Oi(cl),zn=hh;(ol&&zn(new ol(new ArrayBuffer(1)))!=su||al&&zn(new al())!=eu||ll&&zn(ll.resolve())!=ru||fl&&zn(new fl())!=nu||cl&&zn(new cl())!=iu)&&(zn=function zn(i){var e=hh(i),t=e==SI?i.constructor:void 0,r=t?Oi(t):"";if(r)switch(r){case PI:return su;case xI:return eu;case TI:return ru;case CI:return nu;case II:return iu;}return e;});var To=zn,OI=Object.prototype,wI=OI.hasOwnProperty;function AI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&wI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var EI=AI,MI=_r,LI=MI.Uint8Array,dh=LI,ou=dh;function RI(i){var e=new i.constructor(i.byteLength);return new ou(e).set(new ou(i)),e;}var Il=RI,bI=Il;function DI(i,e){var t=e?bI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var NI=DI,BI=/\w*$/;function WI(i){var e=new i.constructor(i.source,BI.exec(i));return e.lastIndex=i.lastIndex,e;}var FI=WI,au=Qi,lu=au?au.prototype:void 0,fu=lu?lu.valueOf:void 0;function UI(i){return fu?Object(fu.call(i)):{};}var YI=UI,XI=Il;function zI(i,e){var t=e?XI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var $I=zI,jI=Il,GI=NI,kI=FI,HI=YI,VI=$I,KI="[object Boolean]",ZI="[object Date]",JI="[object Map]",QI="[object Number]",qI="[object RegExp]",_I="[object Set]",tO="[object String]",eO="[object Symbol]",rO="[object ArrayBuffer]",nO="[object DataView]",iO="[object Float32Array]",sO="[object Float64Array]",oO="[object Int8Array]",aO="[object Int16Array]",lO="[object Int32Array]",fO="[object Uint8Array]",cO="[object Uint8ClampedArray]",uO="[object Uint16Array]",hO="[object Uint32Array]";function dO(i,e,t){var r=i.constructor;switch(e){case rO:return jI(i);case KI:case ZI:return new r(+i);case nO:return GI(i,t);case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:case hO:return VI(i,t);case JI:return new r();case QI:case tO:return new r(i);case qI:return kI(i);case _I:return new r();case eO:return HI(i);}}var pO=dO,vO=qi,cu=Object.create,gO=/* @__PURE__ */function(){function i(){}return function(e){if(!vO(e))return{};if(cu)return cu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),mO=gO,yO=mO,SO=ah,PO=yl;function xO(i){return typeof i.constructor=="function"&&!PO(i)?yO(SO(i)):{};}var TO=xO,CO=To,IO=pn,OO="[object Map]";function wO(i){return IO(i)&&CO(i)==OO;}var AO=wO,EO=AO,MO=xo,uu=ml,hu=uu&&uu.isMap,LO=hu?MO(hu):EO,RO=LO,bO=To,DO=pn,NO="[object Set]";function BO(i){return DO(i)&&bO(i)==NO;}var WO=BO,FO=WO,UO=xo,du=ml,pu=du&&du.isSet,YO=pu?UO(pu):FO,ph=YO,XO=/* @__PURE__ */Ln(ph),zO=Zu,$O=dx,jO=qu,GO=eC,kO=yC,HO=SC,VO=xC,KO=bC,ZO=kC,JO=ch,QO=nI,qO=To,_O=EI,tw=pO,ew=TO,rw=_i,nw=gl,iw=RO,sw=qi,ow=ph,aw=Pl,lw=xl,fw=1,cw=2,uw=4,vh="[object Arguments]",hw="[object Array]",dw="[object Boolean]",pw="[object Date]",vw="[object Error]",gh="[object Function]",gw="[object GeneratorFunction]",mw="[object Map]",yw="[object Number]",mh="[object Object]",Sw="[object RegExp]",Pw="[object Set]",xw="[object String]",Tw="[object Symbol]",Cw="[object WeakMap]",Iw="[object ArrayBuffer]",Ow="[object DataView]",ww="[object Float32Array]",Aw="[object Float64Array]",Ew="[object Int8Array]",Mw="[object Int16Array]",Lw="[object Int32Array]",Rw="[object Uint8Array]",bw="[object Uint8ClampedArray]",Dw="[object Uint16Array]",Nw="[object Uint32Array]",Ye={};Ye[vh]=Ye[hw]=Ye[Iw]=Ye[Ow]=Ye[dw]=Ye[pw]=Ye[ww]=Ye[Aw]=Ye[Ew]=Ye[Mw]=Ye[Lw]=Ye[mw]=Ye[yw]=Ye[mh]=Ye[Sw]=Ye[Pw]=Ye[xw]=Ye[Tw]=Ye[Rw]=Ye[bw]=Ye[Dw]=Ye[Nw]=!0;Ye[vw]=Ye[gh]=Ye[Cw]=!1;function _s(i,e,t,r,n,s){var c,l=e&fw,f=e&cw,h=e&uw;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!sw(i))return i;var m=rw(i);if(m){if(c=_O(i),!l)return VO(i,c);}else{var u=qO(i),y=u==gh||u==gw;if(nw(i))return HO(i,l);if(u==mh||u==vh||y&&!n){if(c=f||y?{}:ew(i),!l)return f?ZO(i,kO(c,i)):KO(i,GO(c,i));}else{if(!Ye[u])return n?i:{};c=tw(i,u,l);}}s||(s=new zO());var T=s.get(i);if(T)return T;s.set(i,c),ow(i)?i.forEach(function(S){c.add(_s(S,e,t,S,i,s));}):iw(i)&&i.forEach(function(S,O){c.set(O,_s(S,e,t,O,i,s));});var w=h?f?QO:JO:f?lw:aw,I=m?void 0:w(i);return $O(I||i,function(S,O){I&&(O=S,S=i[O]),jO(c,O,_s(S,e,t,O,i,s));}),c;}var Bw=_s,Ww=Bw,Fw=1,Uw=4;function Yw(i){return Ww(i,Fw|Uw);}var Xw=Yw,fr=/* @__PURE__ */Ln(Xw);var yh="1.1.32",zw="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(zw,"@").concat(yh),window.__netlessUA=i;}var gr={useWorker:"auto",useSimple:!1,useBackgroundThread:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"},undoRedo:{enableGlobal:!1,maxStackLength:20},markmap:{enable:!0,timeout:1e4,options:{autoFit:!0,duration:0,zoom:!1,pan:!1,maxInitialScale:10}}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(ui(r),"L").concat(ui(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=hi(r,n);return e?"M".concat(hi(i[0],i[1]),"Q").concat(ui(i[1])).concat(hi(i[1],i[2]),"T").concat(s).concat(hi(i[t-1],i[0])).concat(hi(i[0],i[1]),"Z"):"M".concat(ui(i[0]),"Q").concat(ui(i[1])).concat(hi(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(ui(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",gr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",gr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",gr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};_e(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var w=l==null?void 0:l.getBoundingClientRect();return w&&(t=Zt(t,{x:Math.floor(w.x-Mr.SafeBorderPadding),y:Math.floor(w.y-Mr.SafeBorderPadding),w:Math.floor(w.width+Mr.SafeBorderPadding*2),h:Math.floor(w.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var w=c.getAttribute("scale");w=[w[0]*T,w[1]*T];var I=c.parent.parent,S=c.getAttribute("translate"),_O30=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),I,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},w,S),_d30=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d30,n,s,!1),_O30.appendChild(_d30);var v=_O30.parent;v.render();var p=_O30.renderer.canvasRenderer,x=p.context;if(!x)return;var E=p.options.displayRatio,R=_d30.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:I.width,h:I.height};if(Ji(D,U)===Tr.outside){Lr(_d30,v),I.removeChild(v),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,I.width)-W.x,W.h=Math.min(D.y+D.h,I.height)-W.y;var X=this.getGroupRect(W,E),B=X.x,N=X.y,$=X.w,J=X.h;var tt=x.getImageData(B,N,$,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d30,v),I.removeChild(v),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_O30.worldScaling});ut&&r.append(ut),Lr(_d30,v),I.removeChild(v),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new cr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(w,I){return I%2?w-r[1]:w-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var w=_ref164.detail;var I=w.context;n?I.blendFuncSeparate(I.ZERO,I.ZERO,I.ZERO,I.ZERO):I.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var w=_ref165.detail;var I=w.context;n?I.blendFuncSeparate(I.SRC_ALPHA,I.ONE_MINUS_SRC_ALPHA,I.ONE,I.ONE_MINUS_SRC_ALPHA):I.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new $u(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this60=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?sE(r,c,e):(c.remove(),_vr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_vr(l,(f=_this60.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_vr(l,_this60.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_vr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,w=r.thickness;var I;var S=c&&fr(c)||n.get(t.name);if(!S)return;_e(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);var O=t.parent;if(O){if(m&&y&&c){var v=[S.op[0],S.op[1]];Oo(S.op,u,y,f);var p=[S.op[0],S.op[1]],x=[p[0]-v[0],p[1]-v[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(var E=0;E<S.opt.eraserlines.length;E++){var _S$opt$eraserlines$E=S.opt.eraserlines[E],R=_S$opt$eraserlines$E.op,D=_S$opt$eraserlines$E.thickness;S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Nl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),S.opt.translate=f,c){var _v6=[f[0]*O.worldScaling[0],f[1]*O.worldScaling[1]];I=Zi(S.rect,_v6),S.rect=I;}else{var _v7=Mr.getRectFromLayer(O,t.name);S.rect=_v7||S.rect;}}else if(_e(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)I=Dl(S.rect,h),S.rect=I;else{var _v8=Mr.getRectFromLayer(O,t.name);S.rect=_v8||S.rect;}if(T){var _v9=T.get(t.name);if(_v9)for(var _p10=0,_x37=0;_p10<S.op.length;_p10+=3,_x37++)S.op[_p10]=_v9[_x37][0],S.op[_p10+1]=_v9[_x37][1];}if(w&&(d=S==null?void 0:S.opt)!=null&&d.thickness&&(S.opt.thickness=w),s&&!(m&&y&&c)){if(f){var _v10=S.op.map(function(p,x){var E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p;});if(S.op=_v10,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(var _p11=0;_p11<S.opt.eraserlines.length;_p11++){var _x38=S.opt.eraserlines[_p11].op;for(var _E7=0;_E7<_x38.length;_E7++){var _R3=_x38[_E7].map(function(D,U){return U%2?D+f[1]:D+f[0];});S.opt.eraserlines[_p11].op[_E7]=_R3;}}}else if(_e(h)){var _v11=S.op;if(QA(_v11,S.centerPos,h),S.op=_v11,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(var _p12=0;_p12<S.opt.eraserlines.length;_p12++){var _x39=S.opt.eraserlines[_p12].op;for(var _E8=0;_E8<_x39.length;_E8++)qA(_x39[_E8],S.centerPos,h);}}}S&&n.setInfo(t.name,S);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===xt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===xt.BackgroundSVG&&(s.translate||s.scale)||t===xt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&r.type===vo.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var Xt=Mr;var Ol=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var wl={exports:{}};wl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
400
400
|
compressToUint8Array:function compressToUint8Array(f){for(var h=l.compress(f),m=new Uint8Array(h.length*2),u=0,y=h.length;u<y;u++){var T=h.charCodeAt(u);m[u*2]=T>>>8,m[u*2+1]=T%256;}return m;},//decompress from uint8array (UCS-2 big endian format)
|
|
401
401
|
decompressFromUint8Array:function decompressFromUint8Array(f){if(f==null)return l.decompress(f);for(var h=new Array(f.length/2),m=0,u=h.length;m<u;m++)h[m]=f[m*2]*256+f[m*2+1];var y=[];return h.forEach(function(T){y.push(t(T));}),l.decompress(y.join(""));},//compress into a string that is already URI encoded
|
|
402
402
|
compressToEncodedURIComponent:function compressToEncodedURIComponent(f){return f==null?"":l._compress(f,6,function(h){return n.charAt(h);});},//decompress from an output of compressToEncodedURIComponent
|
package/dist/appliance-plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DpQJ_LNL.js");exports.ActiveContainerType=e.ActiveContainerType;exports.ApplianceMultiPlugin=e.ApplianceMultiPlugin;exports.ApplianceNames=e.ApplianceNames;exports.ApplianceSigleWrapper=e.ApplianceSigleWrapper;exports.ApplianceSinglePlugin=e.ApplianceSinglePlugin;exports.Cursor_Hover_Id=e.Cursor_Hover_Id;exports.ECanvasShowType=e.ECanvasShowType;exports.EDataType=e.EDataType;exports.EForceStopReason=e.EForceStopReason;exports.EImageType=e.EImageType;exports.EMatrixrRelationType=e.EMatrixrRelationType;exports.EOperationType=e.EOperationType;exports.EPostMessageType=e.EPostMessageType;exports.ERenderFilterType=e.ERenderFilterType;exports.ESVGType=e.ESVGType;exports.EScaleType=e.EScaleType;exports.EStrokeType=e.EStrokeType;exports.EToolsKey=e.EToolsKey;exports.ElayerType=e.ElayerType;exports.EmitEventType=e.EmitEventType;exports.EventMessageType=e.EventMessageType;exports.EvevtWorkState=e.EvevtWorkState;exports.EvevtWorkType=e.EvevtWorkType;exports.InternalMsgEmitterType=e.InternalMsgEmitterType;exports.Main_View_Id=e.Main_View_Id;exports.Plugin=e.Plugin;exports.ShapeType=e.ShapeType;exports.Task_Time_Interval=e.Task_Time_Interval;exports.fullWorkerUrl=e.fullWorker;exports.subWorkerUrl=e.subWorker;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { af as s, a9 as p, ac as r, ab as t, aa as i, a4 as l, Z as n, b as E, ag as T, t as o, j as y, ak as v, a as g, al as c, d as S, u, w as k, c as m, ai as M, E as _, ah as d, v as A, aj as I, ae as W, Y as P, am as b, ad as f, a6 as h, a7 as w, a8 as C } from "./index-
|
|
1
|
+
import { af as s, a9 as p, ac as r, ab as t, aa as i, a4 as l, Z as n, b as E, ag as T, t as o, j as y, ak as v, a as g, al as c, d as S, u, w as k, c as m, ai as M, E as _, ah as d, v as A, aj as I, ae as W, Y as P, am as b, ad as f, a6 as h, a7 as w, a8 as C } from "./index-BA9yB27Q.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ActiveContainerType,
|
|
4
4
|
p as ApplianceMultiPlugin,
|
package/dist/fullWorker.js
CHANGED
|
@@ -396,7 +396,7 @@ _inherits(l,_r$default22);return _createClass(l,[{key:"texture",get:function get
|
|
|
396
396
|
h=="length"||// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
397
397
|
n&&(h=="offset"||h=="parent")||// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
398
398
|
s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||// Skip index properties.
|
|
399
|
-
ET(h,f)))&&l.push(h);return l;}var nh=bT,DT=Object.prototype;function NT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||DT;return i===t;}var yl=NT;function BT(i,e){return function(t){return i(e(t));};}var ih=BT,WT=ih,FT=WT(Object.keys,Object),UT=FT,YT=yl,XT=UT,zT=Object.prototype,$T=zT.hasOwnProperty;function jT(i){if(!YT(i))return XT(i);var e=[];for(var t in Object(i))$T.call(i,t)&&t!="constructor"&&e.push(t);return e;}var GT=jT,kT=Hu,HT=eh;function VT(i){return i!=null&&HT(i.length)&&!kT(i);}var Sl=VT,KT=nh,ZT=GT,JT=Sl;function QT(i){return JT(i)?KT(i):ZT(i);}var Pl=QT,qT=Po,_T=Pl;function tC(i,e){return i&&qT(e,_T(e),i);}var eC=tC;function rC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var nC=rC,iC=qi,sC=yl,oC=nC,aC=Object.prototype,lC=aC.hasOwnProperty;function fC(i){if(!iC(i))return oC(i);var e=sC(i),t=[];for(var r in i)r=="constructor"&&(e||!lC.call(i,r))||t.push(r);return t;}var cC=fC,uC=nh,hC=cC,dC=Sl;function pC(i){return dC(i)?uC(i,!0):hC(i);}var xl=pC,vC=Po,gC=xl;function mC(i,e){return i&&vC(e,gC(e),i);}var yC=mC,no={exports:{}};no.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(no,no.exports);var SC=no.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var xC=PC;function TC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var sh=TC;function CC(){return[];}var oh=CC,IC=sh,OC=oh,wC=Object.prototype,AC=wC.propertyIsEnumerable,tu=Object.getOwnPropertySymbols,EC=tu?function(i){return i==null?[]:(i=Object(i),IC(tu(i),function(e){return AC.call(i,e);}));}:OC,Tl=EC,MC=Po,LC=Tl;function RC(i,e){return MC(i,LC(i),e);}var bC=RC;function DC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Cl=DC,NC=ih,BC=NC(Object.getPrototypeOf,Object),ah=BC,WC=Cl,FC=ah,UC=Tl,YC=oh,XC=Object.getOwnPropertySymbols,zC=XC?function(i){for(var e=[];i;)WC(e,UC(i)),i=FC(i);return e;}:YC,lh=zC,$C=Po,jC=lh;function GC(i,e){return $C(i,jC(i),e);}var kC=GC,HC=Cl,VC=_i;function KC(i,e,t){var r=e(i);return VC(i)?r:HC(r,t(i));}var fh=KC,ZC=fh,JC=Tl,QC=Pl;function qC(i){return ZC(i,QC,JC);}var ch=qC,_C=fh,tI=lh,eI=xl;function rI(i){return _C(i,eI,tI);}var nI=rI,iI=Gn,sI=_r,oI=iI(sI,"DataView"),aI=oI,lI=Gn,fI=_r,cI=lI(fI,"Promise"),uI=cI,hI=Gn,dI=_r,pI=hI(dI,"Set"),uh=pI,vI=Gn,gI=_r,mI=vI(gI,"WeakMap"),yI=mI,ol=aI,al=vl,ll=uI,fl=uh,cl=yI,hh=Pi,Oi=Vu,eu="[object Map]",SI="[object Object]",ru="[object Promise]",nu="[object Set]",iu="[object WeakMap]",su="[object DataView]",PI=Oi(ol),xI=Oi(al),TI=Oi(ll),CI=Oi(fl),II=Oi(cl),zn=hh;(ol&&zn(new ol(new ArrayBuffer(1)))!=su||al&&zn(new al())!=eu||ll&&zn(ll.resolve())!=ru||fl&&zn(new fl())!=nu||cl&&zn(new cl())!=iu)&&(zn=function zn(i){var e=hh(i),t=e==SI?i.constructor:void 0,r=t?Oi(t):"";if(r)switch(r){case PI:return su;case xI:return eu;case TI:return ru;case CI:return nu;case II:return iu;}return e;});var To=zn,OI=Object.prototype,wI=OI.hasOwnProperty;function AI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&wI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var EI=AI,MI=_r,LI=MI.Uint8Array,dh=LI,ou=dh;function RI(i){var e=new i.constructor(i.byteLength);return new ou(e).set(new ou(i)),e;}var Il=RI,bI=Il;function DI(i,e){var t=e?bI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var NI=DI,BI=/\w*$/;function WI(i){var e=new i.constructor(i.source,BI.exec(i));return e.lastIndex=i.lastIndex,e;}var FI=WI,au=Qi,lu=au?au.prototype:void 0,fu=lu?lu.valueOf:void 0;function UI(i){return fu?Object(fu.call(i)):{};}var YI=UI,XI=Il;function zI(i,e){var t=e?XI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var $I=zI,jI=Il,GI=NI,kI=FI,HI=YI,VI=$I,KI="[object Boolean]",ZI="[object Date]",JI="[object Map]",QI="[object Number]",qI="[object RegExp]",_I="[object Set]",tO="[object String]",eO="[object Symbol]",rO="[object ArrayBuffer]",nO="[object DataView]",iO="[object Float32Array]",sO="[object Float64Array]",oO="[object Int8Array]",aO="[object Int16Array]",lO="[object Int32Array]",fO="[object Uint8Array]",cO="[object Uint8ClampedArray]",uO="[object Uint16Array]",hO="[object Uint32Array]";function dO(i,e,t){var r=i.constructor;switch(e){case rO:return jI(i);case KI:case ZI:return new r(+i);case nO:return GI(i,t);case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:case hO:return VI(i,t);case JI:return new r();case QI:case tO:return new r(i);case qI:return kI(i);case _I:return new r();case eO:return HI(i);}}var pO=dO,vO=qi,cu=Object.create,gO=/* @__PURE__ */function(){function i(){}return function(e){if(!vO(e))return{};if(cu)return cu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),mO=gO,yO=mO,SO=ah,PO=yl;function xO(i){return typeof i.constructor=="function"&&!PO(i)?yO(SO(i)):{};}var TO=xO,CO=To,IO=pn,OO="[object Map]";function wO(i){return IO(i)&&CO(i)==OO;}var AO=wO,EO=AO,MO=xo,uu=ml,hu=uu&&uu.isMap,LO=hu?MO(hu):EO,RO=LO,bO=To,DO=pn,NO="[object Set]";function BO(i){return DO(i)&&bO(i)==NO;}var WO=BO,FO=WO,UO=xo,du=ml,pu=du&&du.isSet,YO=pu?UO(pu):FO,ph=YO,XO=/* @__PURE__ */Ln(ph),zO=Zu,$O=dx,jO=qu,GO=eC,kO=yC,HO=SC,VO=xC,KO=bC,ZO=kC,JO=ch,QO=nI,qO=To,_O=EI,tw=pO,ew=TO,rw=_i,nw=gl,iw=RO,sw=qi,ow=ph,aw=Pl,lw=xl,fw=1,cw=2,uw=4,vh="[object Arguments]",hw="[object Array]",dw="[object Boolean]",pw="[object Date]",vw="[object Error]",gh="[object Function]",gw="[object GeneratorFunction]",mw="[object Map]",yw="[object Number]",mh="[object Object]",Sw="[object RegExp]",Pw="[object Set]",xw="[object String]",Tw="[object Symbol]",Cw="[object WeakMap]",Iw="[object ArrayBuffer]",Ow="[object DataView]",ww="[object Float32Array]",Aw="[object Float64Array]",Ew="[object Int8Array]",Mw="[object Int16Array]",Lw="[object Int32Array]",Rw="[object Uint8Array]",bw="[object Uint8ClampedArray]",Dw="[object Uint16Array]",Nw="[object Uint32Array]",Ye={};Ye[vh]=Ye[hw]=Ye[Iw]=Ye[Ow]=Ye[dw]=Ye[pw]=Ye[ww]=Ye[Aw]=Ye[Ew]=Ye[Mw]=Ye[Lw]=Ye[mw]=Ye[yw]=Ye[mh]=Ye[Sw]=Ye[Pw]=Ye[xw]=Ye[Tw]=Ye[Rw]=Ye[bw]=Ye[Dw]=Ye[Nw]=!0;Ye[vw]=Ye[gh]=Ye[Cw]=!1;function _s(i,e,t,r,n,s){var c,l=e&fw,f=e&cw,h=e&uw;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!sw(i))return i;var m=rw(i);if(m){if(c=_O(i),!l)return VO(i,c);}else{var u=qO(i),y=u==gh||u==gw;if(nw(i))return HO(i,l);if(u==mh||u==vh||y&&!n){if(c=f||y?{}:ew(i),!l)return f?ZO(i,kO(c,i)):KO(i,GO(c,i));}else{if(!Ye[u])return n?i:{};c=tw(i,u,l);}}s||(s=new zO());var T=s.get(i);if(T)return T;s.set(i,c),ow(i)?i.forEach(function(S){c.add(_s(S,e,t,S,i,s));}):iw(i)&&i.forEach(function(S,O){c.set(O,_s(S,e,t,O,i,s));});var w=h?f?QO:JO:f?lw:aw,I=m?void 0:w(i);return $O(I||i,function(S,O){I&&(O=S,S=i[O]),jO(c,O,_s(S,e,t,O,i,s));}),c;}var Bw=_s,Ww=Bw,Fw=1,Uw=4;function Yw(i){return Ww(i,Fw|Uw);}var Xw=Yw,fr=/* @__PURE__ */Ln(Xw);var yh="1.1.31",zw="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(zw,"@").concat(yh),window.__netlessUA=i;}var gr={useWorker:"auto",useSimple:!1,useBackgroundThread:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"},undoRedo:{enableGlobal:!1,maxStackLength:20},markmap:{enable:!0,timeout:1e4,options:{autoFit:!0,duration:0,zoom:!1,pan:!1,maxInitialScale:10}}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(ui(r),"L").concat(ui(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=hi(r,n);return e?"M".concat(hi(i[0],i[1]),"Q").concat(ui(i[1])).concat(hi(i[1],i[2]),"T").concat(s).concat(hi(i[t-1],i[0])).concat(hi(i[0],i[1]),"Z"):"M".concat(ui(i[0]),"Q").concat(ui(i[1])).concat(hi(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(ui(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",gr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",gr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",gr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};_e(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var w=l==null?void 0:l.getBoundingClientRect();return w&&(t=Zt(t,{x:Math.floor(w.x-Mr.SafeBorderPadding),y:Math.floor(w.y-Mr.SafeBorderPadding),w:Math.floor(w.width+Mr.SafeBorderPadding*2),h:Math.floor(w.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var w=c.getAttribute("scale");w=[w[0]*T,w[1]*T];var I=c.parent.parent,S=c.getAttribute("translate"),_O30=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),I,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},w,S),_d30=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d30,n,s,!1),_O30.appendChild(_d30);var v=_O30.parent;v.render();var p=_O30.renderer.canvasRenderer,x=p.context;if(!x)return;var E=p.options.displayRatio,R=_d30.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:I.width,h:I.height};if(Ji(D,U)===Tr.outside){Lr(_d30,v),I.removeChild(v),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,I.width)-W.x,W.h=Math.min(D.y+D.h,I.height)-W.y;var X=this.getGroupRect(W,E),B=X.x,N=X.y,$=X.w,J=X.h;var tt=x.getImageData(B,N,$,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d30,v),I.removeChild(v),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_O30.worldScaling});ut&&r.append(ut),Lr(_d30,v),I.removeChild(v),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new cr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(w,I){return I%2?w-r[1]:w-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var w=_ref164.detail;var I=w.context;n?I.blendFuncSeparate(I.ZERO,I.ZERO,I.ZERO,I.ZERO):I.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var w=_ref165.detail;var I=w.context;n?I.blendFuncSeparate(I.SRC_ALPHA,I.ONE_MINUS_SRC_ALPHA,I.ONE,I.ONE_MINUS_SRC_ALPHA):I.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new $u(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this60=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?sE(r,c,e):(c.remove(),_vr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_vr(l,(f=_this60.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_vr(l,_this60.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_vr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,w=r.thickness;var I;var S=c&&fr(c)||n.get(t.name);if(!S)return;_e(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);var O=t.parent;if(O){if(m&&y&&c){var v=[S.op[0],S.op[1]];Oo(S.op,u,y,f);var p=[S.op[0],S.op[1]],x=[p[0]-v[0],p[1]-v[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(var E=0;E<S.opt.eraserlines.length;E++){var _S$opt$eraserlines$E=S.opt.eraserlines[E],R=_S$opt$eraserlines$E.op,D=_S$opt$eraserlines$E.thickness;S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Nl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),S.opt.translate=f,c){var _v6=[f[0]*O.worldScaling[0],f[1]*O.worldScaling[1]];I=Zi(S.rect,_v6),S.rect=I;}else{var _v7=Mr.getRectFromLayer(O,t.name);S.rect=_v7||S.rect;}}else if(_e(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)I=Dl(S.rect,h),S.rect=I;else{var _v8=Mr.getRectFromLayer(O,t.name);S.rect=_v8||S.rect;}if(T){var _v9=T.get(t.name);if(_v9)for(var _p10=0,_x37=0;_p10<S.op.length;_p10+=3,_x37++)S.op[_p10]=_v9[_x37][0],S.op[_p10+1]=_v9[_x37][1];}if(w&&(d=S==null?void 0:S.opt)!=null&&d.thickness&&(S.opt.thickness=w),s&&!(m&&y&&c)){if(f){var _v10=S.op.map(function(p,x){var E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p;});if(S.op=_v10,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(var _p11=0;_p11<S.opt.eraserlines.length;_p11++){var _x38=S.opt.eraserlines[_p11].op;for(var _E7=0;_E7<_x38.length;_E7++){var _R3=_x38[_E7].map(function(D,U){return U%2?D+f[1]:D+f[0];});S.opt.eraserlines[_p11].op[_E7]=_R3;}}}else if(_e(h)){var _v11=S.op;if(QA(_v11,S.centerPos,h),S.op=_v11,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(var _p12=0;_p12<S.opt.eraserlines.length;_p12++){var _x39=S.opt.eraserlines[_p12].op;for(var _E8=0;_E8<_x39.length;_E8++)qA(_x39[_E8],S.centerPos,h);}}}S&&n.setInfo(t.name,S);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===xt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===xt.BackgroundSVG&&(s.translate||s.scale)||t===xt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&r.type===vo.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var Xt=Mr;var Ol=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var wl={exports:{}};wl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
399
|
+
ET(h,f)))&&l.push(h);return l;}var nh=bT,DT=Object.prototype;function NT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||DT;return i===t;}var yl=NT;function BT(i,e){return function(t){return i(e(t));};}var ih=BT,WT=ih,FT=WT(Object.keys,Object),UT=FT,YT=yl,XT=UT,zT=Object.prototype,$T=zT.hasOwnProperty;function jT(i){if(!YT(i))return XT(i);var e=[];for(var t in Object(i))$T.call(i,t)&&t!="constructor"&&e.push(t);return e;}var GT=jT,kT=Hu,HT=eh;function VT(i){return i!=null&&HT(i.length)&&!kT(i);}var Sl=VT,KT=nh,ZT=GT,JT=Sl;function QT(i){return JT(i)?KT(i):ZT(i);}var Pl=QT,qT=Po,_T=Pl;function tC(i,e){return i&&qT(e,_T(e),i);}var eC=tC;function rC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var nC=rC,iC=qi,sC=yl,oC=nC,aC=Object.prototype,lC=aC.hasOwnProperty;function fC(i){if(!iC(i))return oC(i);var e=sC(i),t=[];for(var r in i)r=="constructor"&&(e||!lC.call(i,r))||t.push(r);return t;}var cC=fC,uC=nh,hC=cC,dC=Sl;function pC(i){return dC(i)?uC(i,!0):hC(i);}var xl=pC,vC=Po,gC=xl;function mC(i,e){return i&&vC(e,gC(e),i);}var yC=mC,no={exports:{}};no.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(no,no.exports);var SC=no.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var xC=PC;function TC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var sh=TC;function CC(){return[];}var oh=CC,IC=sh,OC=oh,wC=Object.prototype,AC=wC.propertyIsEnumerable,tu=Object.getOwnPropertySymbols,EC=tu?function(i){return i==null?[]:(i=Object(i),IC(tu(i),function(e){return AC.call(i,e);}));}:OC,Tl=EC,MC=Po,LC=Tl;function RC(i,e){return MC(i,LC(i),e);}var bC=RC;function DC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Cl=DC,NC=ih,BC=NC(Object.getPrototypeOf,Object),ah=BC,WC=Cl,FC=ah,UC=Tl,YC=oh,XC=Object.getOwnPropertySymbols,zC=XC?function(i){for(var e=[];i;)WC(e,UC(i)),i=FC(i);return e;}:YC,lh=zC,$C=Po,jC=lh;function GC(i,e){return $C(i,jC(i),e);}var kC=GC,HC=Cl,VC=_i;function KC(i,e,t){var r=e(i);return VC(i)?r:HC(r,t(i));}var fh=KC,ZC=fh,JC=Tl,QC=Pl;function qC(i){return ZC(i,QC,JC);}var ch=qC,_C=fh,tI=lh,eI=xl;function rI(i){return _C(i,eI,tI);}var nI=rI,iI=Gn,sI=_r,oI=iI(sI,"DataView"),aI=oI,lI=Gn,fI=_r,cI=lI(fI,"Promise"),uI=cI,hI=Gn,dI=_r,pI=hI(dI,"Set"),uh=pI,vI=Gn,gI=_r,mI=vI(gI,"WeakMap"),yI=mI,ol=aI,al=vl,ll=uI,fl=uh,cl=yI,hh=Pi,Oi=Vu,eu="[object Map]",SI="[object Object]",ru="[object Promise]",nu="[object Set]",iu="[object WeakMap]",su="[object DataView]",PI=Oi(ol),xI=Oi(al),TI=Oi(ll),CI=Oi(fl),II=Oi(cl),zn=hh;(ol&&zn(new ol(new ArrayBuffer(1)))!=su||al&&zn(new al())!=eu||ll&&zn(ll.resolve())!=ru||fl&&zn(new fl())!=nu||cl&&zn(new cl())!=iu)&&(zn=function zn(i){var e=hh(i),t=e==SI?i.constructor:void 0,r=t?Oi(t):"";if(r)switch(r){case PI:return su;case xI:return eu;case TI:return ru;case CI:return nu;case II:return iu;}return e;});var To=zn,OI=Object.prototype,wI=OI.hasOwnProperty;function AI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&wI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var EI=AI,MI=_r,LI=MI.Uint8Array,dh=LI,ou=dh;function RI(i){var e=new i.constructor(i.byteLength);return new ou(e).set(new ou(i)),e;}var Il=RI,bI=Il;function DI(i,e){var t=e?bI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var NI=DI,BI=/\w*$/;function WI(i){var e=new i.constructor(i.source,BI.exec(i));return e.lastIndex=i.lastIndex,e;}var FI=WI,au=Qi,lu=au?au.prototype:void 0,fu=lu?lu.valueOf:void 0;function UI(i){return fu?Object(fu.call(i)):{};}var YI=UI,XI=Il;function zI(i,e){var t=e?XI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var $I=zI,jI=Il,GI=NI,kI=FI,HI=YI,VI=$I,KI="[object Boolean]",ZI="[object Date]",JI="[object Map]",QI="[object Number]",qI="[object RegExp]",_I="[object Set]",tO="[object String]",eO="[object Symbol]",rO="[object ArrayBuffer]",nO="[object DataView]",iO="[object Float32Array]",sO="[object Float64Array]",oO="[object Int8Array]",aO="[object Int16Array]",lO="[object Int32Array]",fO="[object Uint8Array]",cO="[object Uint8ClampedArray]",uO="[object Uint16Array]",hO="[object Uint32Array]";function dO(i,e,t){var r=i.constructor;switch(e){case rO:return jI(i);case KI:case ZI:return new r(+i);case nO:return GI(i,t);case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:case hO:return VI(i,t);case JI:return new r();case QI:case tO:return new r(i);case qI:return kI(i);case _I:return new r();case eO:return HI(i);}}var pO=dO,vO=qi,cu=Object.create,gO=/* @__PURE__ */function(){function i(){}return function(e){if(!vO(e))return{};if(cu)return cu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),mO=gO,yO=mO,SO=ah,PO=yl;function xO(i){return typeof i.constructor=="function"&&!PO(i)?yO(SO(i)):{};}var TO=xO,CO=To,IO=pn,OO="[object Map]";function wO(i){return IO(i)&&CO(i)==OO;}var AO=wO,EO=AO,MO=xo,uu=ml,hu=uu&&uu.isMap,LO=hu?MO(hu):EO,RO=LO,bO=To,DO=pn,NO="[object Set]";function BO(i){return DO(i)&&bO(i)==NO;}var WO=BO,FO=WO,UO=xo,du=ml,pu=du&&du.isSet,YO=pu?UO(pu):FO,ph=YO,XO=/* @__PURE__ */Ln(ph),zO=Zu,$O=dx,jO=qu,GO=eC,kO=yC,HO=SC,VO=xC,KO=bC,ZO=kC,JO=ch,QO=nI,qO=To,_O=EI,tw=pO,ew=TO,rw=_i,nw=gl,iw=RO,sw=qi,ow=ph,aw=Pl,lw=xl,fw=1,cw=2,uw=4,vh="[object Arguments]",hw="[object Array]",dw="[object Boolean]",pw="[object Date]",vw="[object Error]",gh="[object Function]",gw="[object GeneratorFunction]",mw="[object Map]",yw="[object Number]",mh="[object Object]",Sw="[object RegExp]",Pw="[object Set]",xw="[object String]",Tw="[object Symbol]",Cw="[object WeakMap]",Iw="[object ArrayBuffer]",Ow="[object DataView]",ww="[object Float32Array]",Aw="[object Float64Array]",Ew="[object Int8Array]",Mw="[object Int16Array]",Lw="[object Int32Array]",Rw="[object Uint8Array]",bw="[object Uint8ClampedArray]",Dw="[object Uint16Array]",Nw="[object Uint32Array]",Ye={};Ye[vh]=Ye[hw]=Ye[Iw]=Ye[Ow]=Ye[dw]=Ye[pw]=Ye[ww]=Ye[Aw]=Ye[Ew]=Ye[Mw]=Ye[Lw]=Ye[mw]=Ye[yw]=Ye[mh]=Ye[Sw]=Ye[Pw]=Ye[xw]=Ye[Tw]=Ye[Rw]=Ye[bw]=Ye[Dw]=Ye[Nw]=!0;Ye[vw]=Ye[gh]=Ye[Cw]=!1;function _s(i,e,t,r,n,s){var c,l=e&fw,f=e&cw,h=e&uw;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!sw(i))return i;var m=rw(i);if(m){if(c=_O(i),!l)return VO(i,c);}else{var u=qO(i),y=u==gh||u==gw;if(nw(i))return HO(i,l);if(u==mh||u==vh||y&&!n){if(c=f||y?{}:ew(i),!l)return f?ZO(i,kO(c,i)):KO(i,GO(c,i));}else{if(!Ye[u])return n?i:{};c=tw(i,u,l);}}s||(s=new zO());var T=s.get(i);if(T)return T;s.set(i,c),ow(i)?i.forEach(function(S){c.add(_s(S,e,t,S,i,s));}):iw(i)&&i.forEach(function(S,O){c.set(O,_s(S,e,t,O,i,s));});var w=h?f?QO:JO:f?lw:aw,I=m?void 0:w(i);return $O(I||i,function(S,O){I&&(O=S,S=i[O]),jO(c,O,_s(S,e,t,O,i,s));}),c;}var Bw=_s,Ww=Bw,Fw=1,Uw=4;function Yw(i){return Ww(i,Fw|Uw);}var Xw=Yw,fr=/* @__PURE__ */Ln(Xw);var yh="1.1.32",zw="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(zw,"@").concat(yh),window.__netlessUA=i;}var gr={useWorker:"auto",useSimple:!1,useBackgroundThread:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"},undoRedo:{enableGlobal:!1,maxStackLength:20},markmap:{enable:!0,timeout:1e4,options:{autoFit:!0,duration:0,zoom:!1,pan:!1,maxInitialScale:10}}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(ui(r),"L").concat(ui(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=hi(r,n);return e?"M".concat(hi(i[0],i[1]),"Q").concat(ui(i[1])).concat(hi(i[1],i[2]),"T").concat(s).concat(hi(i[t-1],i[0])).concat(hi(i[0],i[1]),"Z"):"M".concat(ui(i[0]),"Q").concat(ui(i[1])).concat(hi(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(ui(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",gr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",gr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",gr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};_e(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var w=l==null?void 0:l.getBoundingClientRect();return w&&(t=Zt(t,{x:Math.floor(w.x-Mr.SafeBorderPadding),y:Math.floor(w.y-Mr.SafeBorderPadding),w:Math.floor(w.width+Mr.SafeBorderPadding*2),h:Math.floor(w.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var w=c.getAttribute("scale");w=[w[0]*T,w[1]*T];var I=c.parent.parent,S=c.getAttribute("translate"),_O30=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),I,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},w,S),_d30=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d30,n,s,!1),_O30.appendChild(_d30);var v=_O30.parent;v.render();var p=_O30.renderer.canvasRenderer,x=p.context;if(!x)return;var E=p.options.displayRatio,R=_d30.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:I.width,h:I.height};if(Ji(D,U)===Tr.outside){Lr(_d30,v),I.removeChild(v),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,I.width)-W.x,W.h=Math.min(D.y+D.h,I.height)-W.y;var X=this.getGroupRect(W,E),B=X.x,N=X.y,$=X.w,J=X.h;var tt=x.getImageData(B,N,$,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d30,v),I.removeChild(v),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_O30.worldScaling});ut&&r.append(ut),Lr(_d30,v),I.removeChild(v),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new cr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(w,I){return I%2?w-r[1]:w-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var w=_ref164.detail;var I=w.context;n?I.blendFuncSeparate(I.ZERO,I.ZERO,I.ZERO,I.ZERO):I.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var w=_ref165.detail;var I=w.context;n?I.blendFuncSeparate(I.SRC_ALPHA,I.ONE_MINUS_SRC_ALPHA,I.ONE,I.ONE_MINUS_SRC_ALPHA):I.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new $u(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this60=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?sE(r,c,e):(c.remove(),_vr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_vr(l,(f=_this60.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_vr(l,_this60.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_vr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,w=r.thickness;var I;var S=c&&fr(c)||n.get(t.name);if(!S)return;_e(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);var O=t.parent;if(O){if(m&&y&&c){var v=[S.op[0],S.op[1]];Oo(S.op,u,y,f);var p=[S.op[0],S.op[1]],x=[p[0]-v[0],p[1]-v[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(var E=0;E<S.opt.eraserlines.length;E++){var _S$opt$eraserlines$E=S.opt.eraserlines[E],R=_S$opt$eraserlines$E.op,D=_S$opt$eraserlines$E.thickness;S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Nl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),S.opt.translate=f,c){var _v6=[f[0]*O.worldScaling[0],f[1]*O.worldScaling[1]];I=Zi(S.rect,_v6),S.rect=I;}else{var _v7=Mr.getRectFromLayer(O,t.name);S.rect=_v7||S.rect;}}else if(_e(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)I=Dl(S.rect,h),S.rect=I;else{var _v8=Mr.getRectFromLayer(O,t.name);S.rect=_v8||S.rect;}if(T){var _v9=T.get(t.name);if(_v9)for(var _p10=0,_x37=0;_p10<S.op.length;_p10+=3,_x37++)S.op[_p10]=_v9[_x37][0],S.op[_p10+1]=_v9[_x37][1];}if(w&&(d=S==null?void 0:S.opt)!=null&&d.thickness&&(S.opt.thickness=w),s&&!(m&&y&&c)){if(f){var _v10=S.op.map(function(p,x){var E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p;});if(S.op=_v10,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(var _p11=0;_p11<S.opt.eraserlines.length;_p11++){var _x38=S.opt.eraserlines[_p11].op;for(var _E7=0;_E7<_x38.length;_E7++){var _R3=_x38[_E7].map(function(D,U){return U%2?D+f[1]:D+f[0];});S.opt.eraserlines[_p11].op[_E7]=_R3;}}}else if(_e(h)){var _v11=S.op;if(QA(_v11,S.centerPos,h),S.op=_v11,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(var _p12=0;_p12<S.opt.eraserlines.length;_p12++){var _x39=S.opt.eraserlines[_p12].op;for(var _E8=0;_E8<_x39.length;_E8++)qA(_x39[_E8],S.centerPos,h);}}}S&&n.setInfo(t.name,S);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===xt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===xt.BackgroundSVG&&(s.translate||s.scale)||t===xt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&r.type===vo.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var Xt=Mr;var Ol=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var wl={exports:{}};wl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
400
400
|
compressToUint8Array:function compressToUint8Array(f){for(var h=l.compress(f),m=new Uint8Array(h.length*2),u=0,y=h.length;u<y;u++){var T=h.charCodeAt(u);m[u*2]=T>>>8,m[u*2+1]=T%256;}return m;},//decompress from uint8array (UCS-2 big endian format)
|
|
401
401
|
decompressFromUint8Array:function decompressFromUint8Array(f){if(f==null)return l.decompress(f);for(var h=new Array(f.length/2),m=0,u=h.length;m<u;m++)h[m]=f[m*2]*256+f[m*2+1];var y=[];return h.forEach(function(T){y.push(t(T));}),l.decompress(y.join(""));},//compress into a string that is already URI encoded
|
|
402
402
|
compressToEncodedURIComponent:function compressToEncodedURIComponent(f){return f==null?"":l._compress(f,6,function(h){return n.charAt(h);});},//decompress from an output of compressToEncodedURIComponent
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _e = Object.defineProperty;
|
|
2
2
|
var Ve = (T, i, t) => i in T ? _e(T, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : T[i] = t;
|
|
3
3
|
var y = (T, i, t) => Ve(T, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
-
import { g as Jt, _ as Pe, i as te, p as St, e as Tt, D as J, f as E, h as Rt, j as Vt, k as st, P as O, l as W, s as Ht, m as ee, n as Nt, o as se, r as He, q as qe, c as k, t as Mt, u as U, a as w, b as x, v as A, w as G, x as tt, y as $, z as Zt, A as je, B as Ze, C as Ke, F as Qe, G as Je, H as ts, I as es, J as ss, K as X, L as os, M as he, N as Wt, O as We, T as Bt, Q as yt, R as is, U as Le, W as rs, X as ns, Y as ct, Z as _, $ as ut, a0 as as, a1 as cs, a2 as ls, a3 as hs, a4 as bt, a5 as ps, E as Y, a6 as pe, V as de, S as ds } from "./index-
|
|
4
|
+
import { g as Jt, _ as Pe, i as te, p as St, e as Tt, D as J, f as E, h as Rt, j as Vt, k as st, P as O, l as W, s as Ht, m as ee, n as Nt, o as se, r as He, q as qe, c as k, t as Mt, u as U, a as w, b as x, v as A, w as G, x as tt, y as $, z as Zt, A as je, B as Ze, C as Ke, F as Qe, G as Je, H as ts, I as es, J as ss, K as X, L as os, M as he, N as Wt, O as We, T as Bt, Q as yt, R as is, U as Le, W as rs, X as ns, Y as ct, Z as _, $ as ut, a0 as as, a1 as cs, a2 as ls, a3 as hs, a4 as bt, a5 as ps, E as Y, a6 as pe, V as de, S as ds } from "./index-BA9yB27Q.mjs";
|
|
5
5
|
import { Group as j, Path as wt, Sprite as Ce, Rect as Kt, Polyline as ht, Ellipse as us, Label as fs, Scene as oe, Layer as ms } from "spritejs";
|
|
6
6
|
import it from "clipper-lib";
|
|
7
7
|
import ie from "lineclip";
|