template-designer 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6943,9 +6943,9 @@ const hF = /* @__PURE__ */ bA(dF, [["render", fF]]), ru = [
|
|
|
6943
6943
|
], nu = ru.flatMap((e) => e.components);
|
|
6944
6944
|
async function gF(e) {
|
|
6945
6945
|
try {
|
|
6946
|
-
return (await vd(/* @__PURE__ */ Object.assign({ "./props/lodop.js": () => import("./lodop-
|
|
6946
|
+
return (await vd(/* @__PURE__ */ Object.assign({ "./props/lodop.js": () => import("./lodop-3ad7ee87.mjs"), "./props/rfid.js": () => import("./rfid-fd7914ef.mjs") }), `./props/${e}.js`)).default;
|
|
6947
6947
|
} catch {
|
|
6948
|
-
return console.warn(`配置文件 ./props/${e}.js 不存在,使用默认配置`), (await import("./lodop-
|
|
6948
|
+
return console.warn(`配置文件 ./props/${e}.js 不存在,使用默认配置`), (await import("./lodop-3ad7ee87.mjs")).default;
|
|
6949
6949
|
}
|
|
6950
6950
|
}
|
|
6951
6951
|
function pF(e = {}, A = {}) {
|
|
@@ -56,4 +56,4 @@ Minimum version required to store current data is: `+a+`.
|
|
|
56
56
|
content: "" !important;
|
|
57
57
|
display: none !important;
|
|
58
58
|
}`,by=function(e){My(e,"."+il+Iy+Bu+`
|
|
59
|
-
.`+sl+Sy+Bu)},My=function(e,A){var t=e.ownerDocument;if(t){var r=t.createElement("style");r.textContent=A,e.appendChild(r)}},fu=function(){function e(){}return e.getOrigin=function(A){var t=e._link;return t?(t.href=A,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},e.isSameOrigin=function(A){return e.getOrigin(A)===e._origin},e.setContext=function(A){e._link=A.document.createElement("a"),e._origin=e.getOrigin(A.location.href)},e._origin="about:blank",e}(),Hy=function(){function e(A,t){this.context=A,this._options=t,this._cache={}}return e.prototype.addImage=function(A){var t=Promise.resolve();return this.has(A)||(ul(A)||Oy(A))&&(this._cache[A]=this.loadImage(A)).catch(function(){}),t},e.prototype.match=function(A){return this._cache[A]},e.prototype.loadImage=function(A){return vA(this,void 0,void 0,function(){var t,r,n,a,l=this;return CA(this,function(i){switch(i.label){case 0:return t=fu.isSameOrigin(A),r=!cl(A)&&this._options.useCORS===!0&&FA.SUPPORT_CORS_IMAGES&&!t,n=!cl(A)&&!t&&!ul(A)&&typeof this._options.proxy=="string"&&FA.SUPPORT_CORS_XHR&&!r,!t&&this._options.allowTaint===!1&&!cl(A)&&!ul(A)&&!n&&!r?[2]:(a=A,n?[4,this.proxy(a)]:[3,2]);case 1:a=i.sent(),i.label=2;case 2:return this.context.logger.debug("Added image "+A.substring(0,256)),[4,new Promise(function(s,c){var u=new Image;u.onload=function(){return s(u)},u.onerror=c,(Wy(a)||r)&&(u.crossOrigin="anonymous"),u.src=a,u.complete===!0&&setTimeout(function(){return s(u)},500),l._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+l._options.imageTimeout+"ms) loading image")},l._options.imageTimeout)})];case 3:return[2,i.sent()]}})})},e.prototype.has=function(A){return typeof this._cache[A]<"u"},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(A){var t=this,r=this._options.proxy;if(!r)throw new Error("No proxy defined");var n=A.substring(0,256);return new Promise(function(a,l){var i=FA.SUPPORT_RESPONSE_TYPE?"blob":"text",s=new XMLHttpRequest;s.onload=function(){if(s.status===200)if(i==="text")a(s.response);else{var d=new FileReader;d.addEventListener("load",function(){return a(d.result)},!1),d.addEventListener("error",function(B){return l(B)},!1),d.readAsDataURL(s.response)}else l("Failed to proxy resource "+n+" with status code "+s.status)},s.onerror=l;var c=r.indexOf("?")>-1?"&":"?";if(s.open("GET",""+r+c+"url="+encodeURIComponent(A)+"&responseType="+i),i!=="text"&&s instanceof XMLHttpRequest&&(s.responseType=i),t._options.imageTimeout){var u=t._options.imageTimeout;s.timeout=u,s.ontimeout=function(){return l("Timed out ("+u+"ms) proxying "+n)}}s.send()})},e}(),xy=/^data:image\/svg\+xml/i,ky=/^data:image\/.*;base64,/i,Zy=/^data:image\/.*/i,Oy=function(e){return FA.SUPPORT_SVG_DRAWING||!Dy(e)},cl=function(e){return Zy.test(e)},Wy=function(e){return ky.test(e)},ul=function(e){return e.substr(0,4)==="blob"},Dy=function(e){return e.substr(-3).toLowerCase()==="svg"||xy.test(e)},W=function(){function e(A,t){this.type=0,this.x=A,this.y=t}return e.prototype.add=function(A,t){return new e(this.x+A,this.y+t)},e}(),mt=function(e,A,t){return new W(e.x+(A.x-e.x)*t,e.y+(A.y-e.y)*t)},Hn=function(){function e(A,t,r,n){this.type=1,this.start=A,this.startControl=t,this.endControl=r,this.end=n}return e.prototype.subdivide=function(A,t){var r=mt(this.start,this.startControl,A),n=mt(this.startControl,this.endControl,A),a=mt(this.endControl,this.end,A),l=mt(r,n,A),i=mt(n,a,A),s=mt(l,i,A);return t?new e(this.start,r,l,s):new e(s,i,a,this.end)},e.prototype.add=function(A,t){return new e(this.start.add(A,t),this.startControl.add(A,t),this.endControl.add(A,t),this.end.add(A,t))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),XA=function(e){return e.type===1},Ly=function(){function e(A){var t=A.styles,r=A.bounds,n=or(t.borderTopLeftRadius,r.width,r.height),a=n[0],l=n[1],i=or(t.borderTopRightRadius,r.width,r.height),s=i[0],c=i[1],u=or(t.borderBottomRightRadius,r.width,r.height),d=u[0],B=u[1],U=or(t.borderBottomLeftRadius,r.width,r.height),p=U[0],f=U[1],g=[];g.push((a+s)/r.width),g.push((p+d)/r.width),g.push((l+f)/r.height),g.push((c+B)/r.height);var h=Math.max.apply(Math,g);h>1&&(a/=h,l/=h,s/=h,c/=h,d/=h,B/=h,p/=h,f/=h);var Q=r.width-s,E=r.height-B,C=r.width-d,F=r.height-f,V=t.borderTopWidth,v=t.borderRightWidth,b=t.borderBottomWidth,m=t.borderLeftWidth,N=iA(t.paddingTop,A.bounds.width),R=iA(t.paddingRight,A.bounds.width),M=iA(t.paddingBottom,A.bounds.width),I=iA(t.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=a>0||l>0?uA(r.left+m/3,r.top+V/3,a-m/3,l-V/3,nA.TOP_LEFT):new W(r.left+m/3,r.top+V/3),this.topRightBorderDoubleOuterBox=a>0||l>0?uA(r.left+Q,r.top+V/3,s-v/3,c-V/3,nA.TOP_RIGHT):new W(r.left+r.width-v/3,r.top+V/3),this.bottomRightBorderDoubleOuterBox=d>0||B>0?uA(r.left+C,r.top+E,d-v/3,B-b/3,nA.BOTTOM_RIGHT):new W(r.left+r.width-v/3,r.top+r.height-b/3),this.bottomLeftBorderDoubleOuterBox=p>0||f>0?uA(r.left+m/3,r.top+F,p-m/3,f-b/3,nA.BOTTOM_LEFT):new W(r.left+m/3,r.top+r.height-b/3),this.topLeftBorderDoubleInnerBox=a>0||l>0?uA(r.left+m*2/3,r.top+V*2/3,a-m*2/3,l-V*2/3,nA.TOP_LEFT):new W(r.left+m*2/3,r.top+V*2/3),this.topRightBorderDoubleInnerBox=a>0||l>0?uA(r.left+Q,r.top+V*2/3,s-v*2/3,c-V*2/3,nA.TOP_RIGHT):new W(r.left+r.width-v*2/3,r.top+V*2/3),this.bottomRightBorderDoubleInnerBox=d>0||B>0?uA(r.left+C,r.top+E,d-v*2/3,B-b*2/3,nA.BOTTOM_RIGHT):new W(r.left+r.width-v*2/3,r.top+r.height-b*2/3),this.bottomLeftBorderDoubleInnerBox=p>0||f>0?uA(r.left+m*2/3,r.top+F,p-m*2/3,f-b*2/3,nA.BOTTOM_LEFT):new W(r.left+m*2/3,r.top+r.height-b*2/3),this.topLeftBorderStroke=a>0||l>0?uA(r.left+m/2,r.top+V/2,a-m/2,l-V/2,nA.TOP_LEFT):new W(r.left+m/2,r.top+V/2),this.topRightBorderStroke=a>0||l>0?uA(r.left+Q,r.top+V/2,s-v/2,c-V/2,nA.TOP_RIGHT):new W(r.left+r.width-v/2,r.top+V/2),this.bottomRightBorderStroke=d>0||B>0?uA(r.left+C,r.top+E,d-v/2,B-b/2,nA.BOTTOM_RIGHT):new W(r.left+r.width-v/2,r.top+r.height-b/2),this.bottomLeftBorderStroke=p>0||f>0?uA(r.left+m/2,r.top+F,p-m/2,f-b/2,nA.BOTTOM_LEFT):new W(r.left+m/2,r.top+r.height-b/2),this.topLeftBorderBox=a>0||l>0?uA(r.left,r.top,a,l,nA.TOP_LEFT):new W(r.left,r.top),this.topRightBorderBox=s>0||c>0?uA(r.left+Q,r.top,s,c,nA.TOP_RIGHT):new W(r.left+r.width,r.top),this.bottomRightBorderBox=d>0||B>0?uA(r.left+C,r.top+E,d,B,nA.BOTTOM_RIGHT):new W(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=p>0||f>0?uA(r.left,r.top+F,p,f,nA.BOTTOM_LEFT):new W(r.left,r.top+r.height),this.topLeftPaddingBox=a>0||l>0?uA(r.left+m,r.top+V,Math.max(0,a-m),Math.max(0,l-V),nA.TOP_LEFT):new W(r.left+m,r.top+V),this.topRightPaddingBox=s>0||c>0?uA(r.left+Math.min(Q,r.width-v),r.top+V,Q>r.width+v?0:Math.max(0,s-v),Math.max(0,c-V),nA.TOP_RIGHT):new W(r.left+r.width-v,r.top+V),this.bottomRightPaddingBox=d>0||B>0?uA(r.left+Math.min(C,r.width-m),r.top+Math.min(E,r.height-b),Math.max(0,d-v),Math.max(0,B-b),nA.BOTTOM_RIGHT):new W(r.left+r.width-v,r.top+r.height-b),this.bottomLeftPaddingBox=p>0||f>0?uA(r.left+m,r.top+Math.min(F,r.height-b),Math.max(0,p-m),Math.max(0,f-b),nA.BOTTOM_LEFT):new W(r.left+m,r.top+r.height-b),this.topLeftContentBox=a>0||l>0?uA(r.left+m+I,r.top+V+N,Math.max(0,a-(m+I)),Math.max(0,l-(V+N)),nA.TOP_LEFT):new W(r.left+m+I,r.top+V+N),this.topRightContentBox=s>0||c>0?uA(r.left+Math.min(Q,r.width+m+I),r.top+V+N,Q>r.width+m+I?0:s-m+I,c-(V+N),nA.TOP_RIGHT):new W(r.left+r.width-(v+R),r.top+V+N),this.bottomRightContentBox=d>0||B>0?uA(r.left+Math.min(C,r.width-(m+I)),r.top+Math.min(E,r.height+V+N),Math.max(0,d-(v+R)),B-(b+M),nA.BOTTOM_RIGHT):new W(r.left+r.width-(v+R),r.top+r.height-(b+M)),this.bottomLeftContentBox=p>0||f>0?uA(r.left+m+I,r.top+F,Math.max(0,p-(m+I)),f-(b+M),nA.BOTTOM_LEFT):new W(r.left+m+I,r.top+r.height-(b+M))}return e}(),nA;(function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(nA||(nA={}));var uA=function(e,A,t,r,n){var a=4*((Math.sqrt(2)-1)/3),l=t*a,i=r*a,s=e+t,c=A+r;switch(n){case nA.TOP_LEFT:return new Hn(new W(e,c),new W(e,c-i),new W(s-l,A),new W(s,A));case nA.TOP_RIGHT:return new Hn(new W(e,A),new W(e+l,A),new W(s,c-i),new W(s,c));case nA.BOTTOM_RIGHT:return new Hn(new W(s,A),new W(s,A+i),new W(e+l,c),new W(e,c));case nA.BOTTOM_LEFT:default:return new Hn(new W(s,c),new W(s-l,c),new W(e,A+i),new W(e,A))}},xn=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Jy=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},kn=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Ky=function(){function e(A,t,r){this.offsetX=A,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return e}(),Zn=function(){function e(A,t){this.path=A,this.target=t,this.type=1}return e}(),Gy=function(){function e(A){this.opacity=A,this.type=2,this.target=6}return e}(),Yy=function(e){return e.type===0},hu=function(e){return e.type===1},zy=function(e){return e.type===2},pu=function(e,A){return e.length===A.length?e.some(function(t,r){return t===A[r]}):!1},jy=function(e,A,t,r,n){return e.map(function(a,l){switch(l){case 0:return a.add(A,t);case 1:return a.add(A+r,t);case 2:return a.add(A+r,t+n);case 3:return a.add(A,t+n)}return a})},gu=function(){function e(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),Uu=function(){function e(A,t){if(this.container=A,this.parent=t,this.effects=[],this.curves=new Ly(this.container),this.container.styles.opacity<1&&this.effects.push(new Gy(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,a=this.container.styles.transform;this.effects.push(new Ky(r,n,a))}if(this.container.styles.overflowX!==0){var l=xn(this.curves),i=kn(this.curves);pu(l,i)?this.effects.push(new Zn(l,6)):(this.effects.push(new Zn(l,2)),this.effects.push(new Zn(i,4)))}}return e.prototype.getEffects=function(A){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,n=this.effects.slice(0);r;){var a=r.effects.filter(function(s){return!hu(s)});if(t||r.container.styles.position!==0||!r.parent){if(n.unshift.apply(n,a),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var l=xn(r.curves),i=kn(r.curves);pu(l,i)||n.unshift(new Zn(i,6))}}else n.unshift.apply(n,a);r=r.parent}return n.filter(function(s){return gA(s.target,A)})},e}(),dl=function(e,A,t,r){e.container.elements.forEach(function(n){var a=gA(n.flags,4),l=gA(n.flags,2),i=new Uu(n,e);gA(n.styles.display,2048)&&r.push(i);var s=gA(n.flags,8)?[]:r;if(a||l){var c=a||n.styles.isPositioned()?t:A,u=new gu(i);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var d=n.styles.zIndex.order;if(d<0){var B=0;c.negativeZIndex.some(function(p,f){return d>p.element.container.styles.zIndex.order?(B=f,!1):B>0}),c.negativeZIndex.splice(B,0,u)}else if(d>0){var U=0;c.positiveZIndex.some(function(p,f){return d>=p.element.container.styles.zIndex.order?(U=f+1,!1):U>0}),c.positiveZIndex.splice(U,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else n.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);dl(i,u,a?u:t,s)}else n.styles.isInlineLevel()?A.inlineLevel.push(i):A.nonInlineLevel.push(i),dl(i,A,t,s);gA(n.flags,8)&&Qu(n,s)})},Qu=function(e,A){for(var t=e instanceof el?e.start:1,r=e instanceof el?e.reversed:!1,n=0;n<A.length;n++){var a=A[n];a.container instanceof Kc&&typeof a.container.value=="number"&&a.container.value!==0&&(t=a.container.value),a.listValue=ur(t,a.container.styles.listStyleType,!0),t+=r?-1:1}},Xy=function(e){var A=new Uu(e,null),t=new gu(A),r=[];return dl(A,t,t,r),Qu(A.container,r),t},wu=function(e,A){switch(A){case 0:return PA(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return PA(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return PA(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);case 3:default:return PA(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},Py=function(e,A){switch(A){case 0:return PA(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return PA(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return PA(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);case 3:default:return PA(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},_y=function(e,A){switch(A){case 0:return PA(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return PA(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return PA(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);case 3:default:return PA(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},qy=function(e,A){switch(A){case 0:return On(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return On(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return On(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);case 3:default:return On(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},On=function(e,A){var t=[];return XA(e)?t.push(e.subdivide(.5,!1)):t.push(e),XA(A)?t.push(A.subdivide(.5,!0)):t.push(A),t},PA=function(e,A,t,r){var n=[];return XA(e)?n.push(e.subdivide(.5,!1)):n.push(e),XA(t)?n.push(t.subdivide(.5,!0)):n.push(t),XA(r)?n.push(r.subdivide(.5,!0).reverse()):n.push(r),XA(A)?n.push(A.subdivide(.5,!1).reverse()):n.push(A),n},mu=function(e){var A=e.bounds,t=e.styles;return A.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},Wn=function(e){var A=e.styles,t=e.bounds,r=iA(A.paddingLeft,t.width),n=iA(A.paddingRight,t.width),a=iA(A.paddingTop,t.width),l=iA(A.paddingBottom,t.width);return t.add(r+A.borderLeftWidth,a+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+r+n),-(A.borderTopWidth+A.borderBottomWidth+a+l))},$y=function(e,A){return e===0?A.bounds:e===2?Wn(A):mu(A)},AV=function(e,A){return e===0?A.bounds:e===2?Wn(A):mu(A)},Bl=function(e,A,t){var r=$y(Ft(e.styles.backgroundOrigin,A),e),n=AV(Ft(e.styles.backgroundClip,A),e),a=eV(Ft(e.styles.backgroundSize,A),t,r),l=a[0],i=a[1],s=or(Ft(e.styles.backgroundPosition,A),r.width-l,r.height-i),c=tV(Ft(e.styles.backgroundRepeat,A),s,a,r,n),u=Math.round(r.left+s[0]),d=Math.round(r.top+s[1]);return[c,u,d,l,i]},Et=function(e){return aA(e)&&e.value===gt.AUTO},Dn=function(e){return typeof e=="number"},eV=function(e,A,t){var r=A[0],n=A[1],a=A[2],l=e[0],i=e[1];if(!l)return[0,0];if(pA(l)&&i&&pA(i))return[iA(l,t.width),iA(i,t.height)];var s=Dn(a);if(aA(l)&&(l.value===gt.CONTAIN||l.value===gt.COVER)){if(Dn(a)){var c=t.width/t.height;return c<a!=(l.value===gt.COVER)?[t.width,t.width/a]:[t.height*a,t.height]}return[t.width,t.height]}var u=Dn(r),d=Dn(n),B=u||d;if(Et(l)&&(!i||Et(i))){if(u&&d)return[r,n];if(!s&&!B)return[t.width,t.height];if(B&&s){var U=u?r:n*a,p=d?n:r/a;return[U,p]}var f=u?r:t.width,g=d?n:t.height;return[f,g]}if(s){var h=0,Q=0;return pA(l)?h=iA(l,t.width):pA(i)&&(Q=iA(i,t.height)),Et(l)?h=Q*a:(!i||Et(i))&&(Q=h/a),[h,Q]}var E=null,C=null;if(pA(l)?E=iA(l,t.width):i&&pA(i)&&(C=iA(i,t.height)),E!==null&&(!i||Et(i))&&(C=u&&d?E/r*n:t.height),C!==null&&Et(l)&&(E=u&&d?C/n*r:t.width),E!==null&&C!==null)return[E,C];throw new Error("Unable to calculate background-size for element")},Ft=function(e,A){var t=e[A];return typeof t>"u"?e[0]:t},tV=function(e,A,t,r,n){var a=A[0],l=A[1],i=t[0],s=t[1];switch(e){case 2:return[new W(Math.round(r.left),Math.round(r.top+l)),new W(Math.round(r.left+r.width),Math.round(r.top+l)),new W(Math.round(r.left+r.width),Math.round(s+r.top+l)),new W(Math.round(r.left),Math.round(s+r.top+l))];case 3:return[new W(Math.round(r.left+a),Math.round(r.top)),new W(Math.round(r.left+a+i),Math.round(r.top)),new W(Math.round(r.left+a+i),Math.round(r.height+r.top)),new W(Math.round(r.left+a),Math.round(r.height+r.top))];case 1:return[new W(Math.round(r.left+a),Math.round(r.top+l)),new W(Math.round(r.left+a+i),Math.round(r.top+l)),new W(Math.round(r.left+a+i),Math.round(r.top+l+s)),new W(Math.round(r.left+a),Math.round(r.top+l+s))];default:return[new W(Math.round(n.left),Math.round(n.top)),new W(Math.round(n.left+n.width),Math.round(n.top)),new W(Math.round(n.left+n.width),Math.round(n.height+n.top)),new W(Math.round(n.left),Math.round(n.height+n.top))]}},rV="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Eu="Hidden Text",nV=function(){function e(A){this._data={},this._document=A}return e.prototype.parseMetrics=function(A,t){var r=this._document.createElement("div"),n=this._document.createElement("img"),a=this._document.createElement("span"),l=this._document.body;r.style.visibility="hidden",r.style.fontFamily=A,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",l.appendChild(r),n.src=rV,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",a.style.fontFamily=A,a.style.fontSize=t,a.style.margin="0",a.style.padding="0",a.appendChild(this._document.createTextNode(Eu)),r.appendChild(a),r.appendChild(n);var i=n.offsetTop-a.offsetTop+2;r.removeChild(a),r.appendChild(this._document.createTextNode(Eu)),r.style.lineHeight="normal",n.style.verticalAlign="super";var s=n.offsetTop-r.offsetTop+2;return l.removeChild(r),{baseline:i,middle:s}},e.prototype.getMetrics=function(A,t){var r=A+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(A,t)),this._data[r]},e}(),Fu=function(){function e(A,t){this.context=A,this.options=t}return e}(),oV=1e4,aV=function(e){ee(A,e);function A(t,r){var n=e.call(this,t,r)||this;return n._activeEffects=[],n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),r.canvas||(n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px"),n.fontMetrics=new nV(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),n}return A.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(n){return r.applyEffect(n)})},A.prototype.applyEffect=function(t){this.ctx.save(),zy(t)&&(this.ctx.globalAlpha=t.opacity),Yy(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),hu(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},A.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},A.prototype.renderStack=function(t){return vA(this,void 0,void 0,function(){var r;return CA(this,function(n){switch(n.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},A.prototype.renderNode=function(t){return vA(this,void 0,void 0,function(){return CA(this,function(r){switch(r.label){case 0:if(gA(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},A.prototype.renderTextWithLetterSpacing=function(t,r,n){var a=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+n);else{var l=Al(t.text);l.reduce(function(i,s){return a.ctx.fillText(s,i,t.bounds.top+n),i+a.ctx.measureText(s).width},t.bounds.left)}},A.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(l){return l==="normal"||l==="small-caps"}).join(""),n=uV(t.fontFamily).join(", "),a=nr(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,a,n].join(" "),n,a]},A.prototype.renderTextNode=function(t,r){return vA(this,void 0,void 0,function(){var n,a,l,i,s,c,u,d,B=this;return CA(this,function(U){return n=this.createFontStyle(r),a=n[0],l=n[1],i=n[2],this.ctx.font=a,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",s=this.fontMetrics.getMetrics(l,i),c=s.baseline,u=s.middle,d=r.paintOrder,t.textBounds.forEach(function(p){d.forEach(function(f){switch(f){case 0:B.ctx.fillStyle=wA(r.color),B.renderTextWithLetterSpacing(p,r.letterSpacing,c);var g=r.textShadow;g.length&&p.text.trim().length&&(g.slice(0).reverse().forEach(function(h){B.ctx.shadowColor=wA(h.color),B.ctx.shadowOffsetX=h.offsetX.number*B.options.scale,B.ctx.shadowOffsetY=h.offsetY.number*B.options.scale,B.ctx.shadowBlur=h.blur.number,B.renderTextWithLetterSpacing(p,r.letterSpacing,c)}),B.ctx.shadowColor="",B.ctx.shadowOffsetX=0,B.ctx.shadowOffsetY=0,B.ctx.shadowBlur=0),r.textDecorationLine.length&&(B.ctx.fillStyle=wA(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(h){switch(h){case 1:B.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top+c),p.bounds.width,1);break;case 2:B.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top),p.bounds.width,1);break;case 3:B.ctx.fillRect(p.bounds.left,Math.ceil(p.bounds.top+u),p.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&p.text.trim().length&&(B.ctx.strokeStyle=wA(r.webkitTextStrokeColor),B.ctx.lineWidth=r.webkitTextStrokeWidth,B.ctx.lineJoin=window.chrome?"miter":"round",B.ctx.strokeText(p.text,p.bounds.left,p.bounds.top+c)),B.ctx.strokeStyle="",B.ctx.lineWidth=0,B.ctx.lineJoin="miter";break}})}),[2]})})},A.prototype.renderReplacedElement=function(t,r,n){if(n&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var a=Wn(t),l=kn(r);this.path(l),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,t.intrinsicWidth,t.intrinsicHeight,a.left,a.top,a.width,a.height),this.ctx.restore()}},A.prototype.renderNodeContent=function(t){return vA(this,void 0,void 0,function(){var r,n,a,l,i,s,Q,Q,c,u,d,B,C,U,p,F,f,g,h,Q,E,C,F;return CA(this,function(V){switch(V.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,n=t.curves,a=r.styles,l=0,i=r.textNodes,V.label=1;case 1:return l<i.length?(s=i[l],[4,this.renderTextNode(s,a)]):[3,4];case 2:V.sent(),V.label=3;case 3:return l++,[3,1];case 4:if(!(r instanceof Dc))return[3,8];V.label=5;case 5:return V.trys.push([5,7,,8]),[4,this.context.cache.match(r.src)];case 6:return Q=V.sent(),this.renderReplacedElement(r,n,Q),[3,8];case 7:return V.sent(),this.context.logger.error("Error loading image "+r.src),[3,8];case 8:if(r instanceof Lc&&this.renderReplacedElement(r,n,r.canvas),!(r instanceof Jc))return[3,12];V.label=9;case 9:return V.trys.push([9,11,,12]),[4,this.context.cache.match(r.svg)];case 10:return Q=V.sent(),this.renderReplacedElement(r,n,Q),[3,12];case 11:return V.sent(),this.context.logger.error("Error loading svg "+r.svg.substring(0,255)),[3,12];case 12:return r instanceof jc&&r.tree?(c=new A(this.context,{scale:this.options.scale,backgroundColor:r.backgroundColor,x:0,y:0,width:r.width,height:r.height}),[4,c.render(r.tree)]):[3,14];case 13:u=V.sent(),r.width&&r.height&&this.ctx.drawImage(u,0,0,r.width,r.height,r.bounds.left,r.bounds.top,r.bounds.width,r.bounds.height),V.label=14;case 14:if(r instanceof tl&&(d=Math.min(r.bounds.width,r.bounds.height),r.type===Nn?r.checked&&(this.ctx.save(),this.path([new W(r.bounds.left+d*.39363,r.bounds.top+d*.79),new W(r.bounds.left+d*.16,r.bounds.top+d*.5549),new W(r.bounds.left+d*.27347,r.bounds.top+d*.44071),new W(r.bounds.left+d*.39694,r.bounds.top+d*.5649),new W(r.bounds.left+d*.72983,r.bounds.top+d*.23),new W(r.bounds.left+d*.84,r.bounds.top+d*.34085),new W(r.bounds.left+d*.39363,r.bounds.top+d*.79)]),this.ctx.fillStyle=wA(Gc),this.ctx.fill(),this.ctx.restore()):r.type===vn&&r.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(r.bounds.left+d/2,r.bounds.top+d/2,d/4,0,Math.PI*2,!0),this.ctx.fillStyle=wA(Gc),this.ctx.fill(),this.ctx.restore())),lV(r)&&r.value.length){switch(B=this.createFontStyle(a),C=B[0],U=B[1],p=this.fontMetrics.getMetrics(C,U).baseline,this.ctx.font=C,this.ctx.fillStyle=wA(a.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=sV(r.styles.textAlign),F=Wn(r),f=0,r.styles.textAlign){case 1:f+=F.width/2;break;case 2:f+=F.width;break}g=F.add(f,0,0,-F.height/2+1),this.ctx.save(),this.path([new W(F.left,F.top),new W(F.left+F.width,F.top),new W(F.left+F.width,F.top+F.height),new W(F.left,F.top+F.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new sr(r.value,g),a.letterSpacing,p),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!gA(r.styles.display,2048))return[3,20];if(r.styles.listStyleImage===null)return[3,19];if(h=r.styles.listStyleImage,h.type!==0)return[3,18];Q=void 0,E=h.url,V.label=15;case 15:return V.trys.push([15,17,,18]),[4,this.context.cache.match(E)];case 16:return Q=V.sent(),this.ctx.drawImage(Q,r.bounds.left-(Q.width+10),r.bounds.top),[3,18];case 17:return V.sent(),this.context.logger.error("Error loading list-style-image "+E),[3,18];case 18:return[3,20];case 19:t.listValue&&r.styles.listStyleType!==-1&&(C=this.createFontStyle(a)[0],this.ctx.font=C,this.ctx.fillStyle=wA(a.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",F=new ue(r.bounds.left,r.bounds.top+iA(r.styles.paddingTop,r.bounds.width),r.bounds.width,Ec(a.lineHeight,a.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new sr(t.listValue,F),a.letterSpacing,Ec(a.lineHeight,a.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),V.label=20;case 20:return[2]}})})},A.prototype.renderStackContent=function(t){return vA(this,void 0,void 0,function(){var r,n,h,a,l,h,i,s,h,c,u,h,d,B,h,U,p,h,f,g,h;return CA(this,function(Q){switch(Q.label){case 0:if(gA(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:Q.sent(),r=0,n=t.negativeZIndex,Q.label=2;case 2:return r<n.length?(h=n[r],[4,this.renderStack(h)]):[3,5];case 3:Q.sent(),Q.label=4;case 4:return r++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:Q.sent(),a=0,l=t.nonInlineLevel,Q.label=7;case 7:return a<l.length?(h=l[a],[4,this.renderNode(h)]):[3,10];case 8:Q.sent(),Q.label=9;case 9:return a++,[3,7];case 10:i=0,s=t.nonPositionedFloats,Q.label=11;case 11:return i<s.length?(h=s[i],[4,this.renderStack(h)]):[3,14];case 12:Q.sent(),Q.label=13;case 13:return i++,[3,11];case 14:c=0,u=t.nonPositionedInlineLevel,Q.label=15;case 15:return c<u.length?(h=u[c],[4,this.renderStack(h)]):[3,18];case 16:Q.sent(),Q.label=17;case 17:return c++,[3,15];case 18:d=0,B=t.inlineLevel,Q.label=19;case 19:return d<B.length?(h=B[d],[4,this.renderNode(h)]):[3,22];case 20:Q.sent(),Q.label=21;case 21:return d++,[3,19];case 22:U=0,p=t.zeroOrAutoZIndexOrTransformedOrOpacity,Q.label=23;case 23:return U<p.length?(h=p[U],[4,this.renderStack(h)]):[3,26];case 24:Q.sent(),Q.label=25;case 25:return U++,[3,23];case 26:f=0,g=t.positiveZIndex,Q.label=27;case 27:return f<g.length?(h=g[f],[4,this.renderStack(h)]):[3,30];case 28:Q.sent(),Q.label=29;case 29:return f++,[3,27];case 30:return[2]}})})},A.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},A.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},A.prototype.formatPath=function(t){var r=this;t.forEach(function(n,a){var l=XA(n)?n.start:n;a===0?r.ctx.moveTo(l.x,l.y):r.ctx.lineTo(l.x,l.y),XA(n)&&r.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},A.prototype.renderRepeat=function(t,r,n,a){this.path(t),this.ctx.fillStyle=r,this.ctx.translate(n,a),this.ctx.fill(),this.ctx.translate(-n,-a)},A.prototype.resizeImage=function(t,r,n){var a;if(t.width===r&&t.height===n)return t;var l=(a=this.canvas.ownerDocument)!==null&&a!==void 0?a:document,i=l.createElement("canvas");i.width=Math.max(1,r),i.height=Math.max(1,n);var s=i.getContext("2d");return s.drawImage(t,0,0,t.width,t.height,0,0,r,n),i},A.prototype.renderBackgroundImage=function(t){return vA(this,void 0,void 0,function(){var r,n,a,l,i,s;return CA(this,function(c){switch(c.label){case 0:r=t.styles.backgroundImage.length-1,n=function(u){var d,B,U,N,S,Y,I,O,b,p,N,S,Y,I,O,f,g,h,Q,E,C,F,V,v,b,m,N,R,M,I,O,P,S,Y,z,$,J,Z,x,j,eA,oA;return CA(this,function(lA){switch(lA.label){case 0:if(u.type!==0)return[3,5];d=void 0,B=u.url,lA.label=1;case 1:return lA.trys.push([1,3,,4]),[4,a.context.cache.match(B)];case 2:return d=lA.sent(),[3,4];case 3:return lA.sent(),a.context.logger.error("Error loading background-image "+B),[3,4];case 4:return d&&(U=Bl(t,r,[d.width,d.height,d.width/d.height]),N=U[0],S=U[1],Y=U[2],I=U[3],O=U[4],b=a.ctx.createPattern(a.resizeImage(d,I,O),"repeat"),a.renderRepeat(N,b,S,Y)),[3,6];case 5:YE(u)?(p=Bl(t,r,[null,null,null]),N=p[0],S=p[1],Y=p[2],I=p[3],O=p[4],f=DE(u.angle,I,O),g=f[0],h=f[1],Q=f[2],E=f[3],C=f[4],F=document.createElement("canvas"),F.width=I,F.height=O,V=F.getContext("2d"),v=V.createLinearGradient(h,E,Q,C),uc(u.stops,g).forEach(function(tA){return v.addColorStop(tA.stop,wA(tA.color))}),V.fillStyle=v,V.fillRect(0,0,I,O),I>0&&O>0&&(b=a.ctx.createPattern(F,"repeat"),a.renderRepeat(N,b,S,Y))):zE(u)&&(m=Bl(t,r,[null,null,null]),N=m[0],R=m[1],M=m[2],I=m[3],O=m[4],P=u.position.length===0?[Oa]:u.position,S=iA(P[0],I),Y=iA(P[P.length-1],O),z=LE(u,S,Y,I,O),$=z[0],J=z[1],$>0&&J>0&&(Z=a.ctx.createRadialGradient(R+S,M+Y,0,R+S,M+Y,$),uc(u.stops,$*2).forEach(function(tA){return Z.addColorStop(tA.stop,wA(tA.color))}),a.path(N),a.ctx.fillStyle=Z,$!==J?(x=t.bounds.left+.5*t.bounds.width,j=t.bounds.top+.5*t.bounds.height,eA=J/$,oA=1/eA,a.ctx.save(),a.ctx.translate(x,j),a.ctx.transform(1,0,0,eA,0,0),a.ctx.translate(-x,-j),a.ctx.fillRect(R,oA*(M-j)+j,I,O*oA),a.ctx.restore()):a.ctx.fill())),lA.label=6;case 6:return r--,[2]}})},a=this,l=0,i=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return l<i.length?(s=i[l],[5,n(s)]):[3,4];case 2:c.sent(),c.label=3;case 3:return l++,[3,1];case 4:return[2]}})})},A.prototype.renderSolidBorder=function(t,r,n){return vA(this,void 0,void 0,function(){return CA(this,function(a){return this.path(wu(n,r)),this.ctx.fillStyle=wA(t),this.ctx.fill(),[2]})})},A.prototype.renderDoubleBorder=function(t,r,n,a){return vA(this,void 0,void 0,function(){var l,i;return CA(this,function(s){switch(s.label){case 0:return r<3?[4,this.renderSolidBorder(t,n,a)]:[3,2];case 1:return s.sent(),[2];case 2:return l=Py(a,n),this.path(l),this.ctx.fillStyle=wA(t),this.ctx.fill(),i=_y(a,n),this.path(i),this.ctx.fill(),[2]}})})},A.prototype.renderNodeBackgroundAndBorders=function(t){return vA(this,void 0,void 0,function(){var r,n,a,l,i,s,c,u,d=this;return CA(this,function(B){switch(B.label){case 0:return this.applyEffects(t.getEffects(2)),r=t.container.styles,n=!Ve(r.backgroundColor)||r.backgroundImage.length,a=[{style:r.borderTopStyle,color:r.borderTopColor,width:r.borderTopWidth},{style:r.borderRightStyle,color:r.borderRightColor,width:r.borderRightWidth},{style:r.borderBottomStyle,color:r.borderBottomColor,width:r.borderBottomWidth},{style:r.borderLeftStyle,color:r.borderLeftColor,width:r.borderLeftWidth}],l=iV(Ft(r.backgroundClip,0),t.curves),n||r.boxShadow.length?(this.ctx.save(),this.path(l),this.ctx.clip(),Ve(r.backgroundColor)||(this.ctx.fillStyle=wA(r.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:B.sent(),this.ctx.restore(),r.boxShadow.slice(0).reverse().forEach(function(U){d.ctx.save();var p=xn(t.curves),f=U.inset?0:oV,g=jy(p,-f+(U.inset?1:-1)*U.spread.number,(U.inset?1:-1)*U.spread.number,U.spread.number*(U.inset?-2:2),U.spread.number*(U.inset?-2:2));U.inset?(d.path(p),d.ctx.clip(),d.mask(g)):(d.mask(p),d.ctx.clip(),d.path(g)),d.ctx.shadowOffsetX=U.offsetX.number+f,d.ctx.shadowOffsetY=U.offsetY.number,d.ctx.shadowColor=wA(U.color),d.ctx.shadowBlur=U.blur.number,d.ctx.fillStyle=U.inset?wA(U.color):"rgba(0,0,0,1)",d.ctx.fill(),d.ctx.restore()}),B.label=2;case 2:i=0,s=0,c=a,B.label=3;case 3:return s<c.length?(u=c[s],u.style!==0&&!Ve(u.color)&&u.width>0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,i,t.curves,2)]:[3,11]):[3,13];case 4:return B.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,i,t.curves,3)];case 6:return B.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,i,t.curves)];case 8:return B.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,i,t.curves)];case 10:B.sent(),B.label=11;case 11:i++,B.label=12;case 12:return s++,[3,3];case 13:return[2]}})})},A.prototype.renderDashedDottedBorder=function(t,r,n,a,l){return vA(this,void 0,void 0,function(){var i,s,c,u,d,B,U,p,f,g,h,Q,E,C,F,V,F,V;return CA(this,function(v){return this.ctx.save(),i=qy(a,n),s=wu(a,n),l===2&&(this.path(s),this.ctx.clip()),XA(s[0])?(c=s[0].start.x,u=s[0].start.y):(c=s[0].x,u=s[0].y),XA(s[1])?(d=s[1].end.x,B=s[1].end.y):(d=s[1].x,B=s[1].y),n===0||n===2?U=Math.abs(c-d):U=Math.abs(u-B),this.ctx.beginPath(),l===3?this.formatPath(i):this.formatPath(s.slice(0,2)),p=r<3?r*3:r*2,f=r<3?r*2:r,l===3&&(p=r,f=r),g=!0,U<=p*2?g=!1:U<=p*2+f?(h=U/(2*p+f),p*=h,f*=h):(Q=Math.floor((U+f)/(p+f)),E=(U-Q*p)/(Q-1),C=(U-(Q+1)*p)/Q,f=C<=0||Math.abs(f-E)<Math.abs(f-C)?E:C),g&&(l===3?this.ctx.setLineDash([0,p+f]):this.ctx.setLineDash([p,f])),l===3?(this.ctx.lineCap="round",this.ctx.lineWidth=r):this.ctx.lineWidth=r*2+1.1,this.ctx.strokeStyle=wA(t),this.ctx.stroke(),this.ctx.setLineDash([]),l===2&&(XA(s[0])&&(F=s[3],V=s[0],this.ctx.beginPath(),this.formatPath([new W(F.end.x,F.end.y),new W(V.start.x,V.start.y)]),this.ctx.stroke()),XA(s[1])&&(F=s[1],V=s[2],this.ctx.beginPath(),this.formatPath([new W(F.end.x,F.end.y),new W(V.start.x,V.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},A.prototype.render=function(t){return vA(this,void 0,void 0,function(){var r;return CA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=wA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),r=Xy(t),[4,this.renderStack(r)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},A}(Fu),lV=function(e){return e instanceof zc||e instanceof Yc?!0:e instanceof tl&&e.type!==vn&&e.type!==Nn},iV=function(e,A){switch(e){case 0:return xn(A);case 2:return Jy(A);case 1:default:return kn(A)}},sV=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},cV=["-apple-system","system-ui"],uV=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(A){return cV.indexOf(A)===-1}):e},dV=function(e){ee(A,e);function A(t,r){var n=e.call(this,t,r)||this;return n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=r,n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+r.width+"x"+r.height+" at "+r.x+","+r.y+") with scale "+r.scale),n}return A.prototype.render=function(t){return vA(this,void 0,void 0,function(){var r,n;return CA(this,function(a){switch(a.label){case 0:return r=$a(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,BV(r)];case 1:return n=a.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=wA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},A}(Fu),BV=function(e){return new Promise(function(A,t){var r=new Image;r.onload=function(){A(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},fV=function(){function e(A){var t=A.id,r=A.enabled;this.id=t,this.enabled=r,this.start=Date.now()}return e.prototype.debug=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,jr([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},e.prototype.getTime=function(){return Date.now()-this.start},e.prototype.info=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,jr([this.id,this.getTime()+"ms"],A))},e.prototype.warn=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,jr([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},e.prototype.error=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,jr([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},e.instances={},e}(),hV=function(){function e(A,t){var r;this.windowBounds=t,this.instanceName="#"+e.instanceCount++,this.logger=new fV({id:this.instanceName,enabled:A.logging}),this.cache=(r=A.cache)!==null&&r!==void 0?r:new Hy(this,A)}return e.instanceCount=1,e}(),pV=function(e,A){return A===void 0&&(A={}),gV(e,A)};typeof window<"u"&&fu.setContext(window);var gV=function(e,A){return vA(void 0,void 0,void 0,function(){var t,r,n,a,l,i,s,c,u,d,B,U,p,f,g,h,Q,E,C,F,v,V,v,b,m,N,R,M,I,O,P,S,Y,z,$,J,Z,x,j,eA;return CA(this,function(oA){switch(oA.label){case 0:if(!e||typeof e!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=e.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(r=t.defaultView,!r)throw new Error("Document is not attached to a Window");return n={allowTaint:(b=A.allowTaint)!==null&&b!==void 0?b:!1,imageTimeout:(m=A.imageTimeout)!==null&&m!==void 0?m:15e3,proxy:A.proxy,useCORS:(N=A.useCORS)!==null&&N!==void 0?N:!1},a=Ua({logging:(R=A.logging)!==null&&R!==void 0?R:!0,cache:A.cache},n),l={windowWidth:(M=A.windowWidth)!==null&&M!==void 0?M:r.innerWidth,windowHeight:(I=A.windowHeight)!==null&&I!==void 0?I:r.innerHeight,scrollX:(O=A.scrollX)!==null&&O!==void 0?O:r.pageXOffset,scrollY:(P=A.scrollY)!==null&&P!==void 0?P:r.pageYOffset},i=new ue(l.scrollX,l.scrollY,l.windowWidth,l.windowHeight),s=new hV(a,i),c=(S=A.foreignObjectRendering)!==null&&S!==void 0?S:!1,u={allowTaint:(Y=A.allowTaint)!==null&&Y!==void 0?Y:!1,onclone:A.onclone,ignoreElements:A.ignoreElements,inlineImages:c,copyStyles:c},s.logger.debug("Starting document clone with size "+i.width+"x"+i.height+" scrolled to "+-i.left+","+-i.top),d=new du(s,e,u),B=d.clonedReferenceElement,B?[4,d.toIFrame(t,i)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return U=oA.sent(),p=nl(B)||Uy(B)?jw(B.ownerDocument):Xr(s,B),f=p.width,g=p.height,h=p.left,Q=p.top,E=UV(s,B,A.backgroundColor),C={canvas:A.canvas,backgroundColor:E,scale:($=(z=A.scale)!==null&&z!==void 0?z:r.devicePixelRatio)!==null&&$!==void 0?$:1,x:((J=A.x)!==null&&J!==void 0?J:0)+h,y:((Z=A.y)!==null&&Z!==void 0?Z:0)+Q,width:(x=A.width)!==null&&x!==void 0?x:Math.ceil(f),height:(j=A.height)!==null&&j!==void 0?j:Math.ceil(g)},c?(s.logger.debug("Document cloned, using foreign object rendering"),v=new dV(s,C),[4,v.render(B)]):[3,3];case 2:return F=oA.sent(),[3,5];case 3:return s.logger.debug("Document cloned, element located at "+h+","+Q+" with size "+f+"x"+g+" using computed rendering"),s.logger.debug("Starting DOM parsing"),V=Pc(s,B),E===V.styles.backgroundColor&&(V.styles.backgroundColor=Be.TRANSPARENT),s.logger.debug("Starting renderer for element at "+C.x+","+C.y+" with size "+C.width+"x"+C.height),v=new aV(s,C),[4,v.render(V)];case 4:F=oA.sent(),oA.label=5;case 5:return(!((eA=A.removeContainer)!==null&&eA!==void 0)||eA)&&(du.destroy(U)||s.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),s.logger.debug("Finished rendering"),[2,F]}})})},UV=function(e,A,t){var r=A.ownerDocument,n=r.documentElement?ar(e,getComputedStyle(r.documentElement).backgroundColor):Be.TRANSPARENT,a=r.body?ar(e,getComputedStyle(r.body).backgroundColor):Be.TRANSPARENT,l=typeof t=="string"?ar(e,t):t===null?Be.TRANSPARENT:4294967295;return A===r.documentElement?Ve(n)?Ve(a)?l:a:n:l};const OR="",QV={class:"label-designer"},wV={class:"toolbar"},mV={class:"center-container"},EV={key:0,class:"loader-container"},FV={class:"center-toolbar"},CV={class:"zoom-controls"},yV=["disabled"],VV=["disabled"],RV={class:"canvas-container"},TV={class:"ruler-horizontal"},NV={class:"ruler-vertical"},vV={key:0,class:"drag-extend-lines"},IV={key:1,class:"alignment-guides"},SV=["data-item-id","onMousedown"],bV=["onMousedown"],MV=["onMousedown"],HV=["onMousedown"],xV=["onMousedown"],kV=["onMousedown"],ZV=["onMousedown"],OV=["onMousedown"],WV=["onMousedown"],DV=["onMousedown"],LV=["onClick"],JV={class:"property-panel",tabindex:"0"},KV={class:"position-controls"},GV={class:"control-group"},YV={class:"number-input"},zV=["value"],jV={class:"control-group"},XV={class:"number-input"},PV=["value"],_V={key:0,class:"control-group"},qV={class:"number-input"},$V={key:1,class:"control-group"},AR={class:"number-input"},eR={class:"control-group"},tR={class:"number-input"},rR={key:2,class:"control-group"},nR={class:"switch-input"},Ln=.05,oR=QA({__name:"panels",props:{templateInfo:{type:Object,default:()=>({graphData:{},width:0,height:0,printWidth:0,printHeight:0,items:[]})},options:{type:Object,default:()=>({})},showGraphConfig:{type:Boolean,default:!1},templateType:{type:String,default:"lodop"},config:{type:Object,default:()=>({})}},setup(e,{expose:A}){const t=e,r=o.ref({}),n=o.ref(0),a=o.ref(!0),l=o.ref([]),i=o.ref(1);let s=1;const c=o.computed(()=>{var y;return((y=r.value)==null?void 0:y.printWidth)||0}),u=o.computed(()=>{var y;return((y=r.value)==null?void 0:y.printHeight)||0});o.ref(!1);const d=o.ref(!1),B=o.ref(!1),U=new Ze(BA.CACHE.STYLE_CACHE_SIZE),p=new Ze(BA.CACHE.BOUNDING_BOX_CACHE_SIZE),f=new Map(Qs.map(y=>[y.type,y])),{selectedItems:g,selectItem:h,getCurrentSelected:Q,clearSelection:E}=Ww(),{dragging:C,dragItem:F,startDrag:V}=Zw({scale:i,canvasWidth:c,canvasHeight:u,selectItem:h,onStartDrag:()=>{d.value=!0,o.nextTick(()=>{I()})},onStopDrag:()=>{d.value=!1,o.nextTick(()=>{B.value=!1}),O()},onDragUpdate:()=>{I()}}),{startResize:v,resizing:b,resizeDirection:m,resizeItem:N}=Ow(c,u,i,g),{alignmentGuides:R,showGuides:M,updateAlignmentGuides:I,clearAlignmentGuides:O}=Gw({items:l,dragItem:F,resizeItem:N,dragging:C,resizing:b,resizeDirection:m,canvasWidth:c,canvasHeight:u}),{startRotate:P}=Dw();o.watch(()=>g.value,()=>{U.clear()},{deep:!0}),o.watch(()=>b.value,y=>{y?I():O()}),o.watch(()=>{var y;return(y=N.value)==null?void 0:y.props},()=>{b.value&&I()},{deep:!0}),o.watch(()=>F.value,()=>{(C.value||b.value)&&I()}),o.watch(()=>N.value,()=>{(C.value||b.value)&&I()}),o.watch(()=>l.value,()=>{(C.value||b.value)&&I()},{deep:!0});const S=y=>{const w=`${y.id}_${H(y.props.x,1)}_${H(y.props.y,1)}_${y.props.width}_${y.props.height}_${y.props.rotation}`;if(p.has(w))return p.get(w);const X=(y.props.rotation||0)*Math.PI/180,rA=[{x:0,y:0},{x:y.props.width,y:0},{x:y.props.width,y:y.props.height},{x:0,y:y.props.height}],K=y.props.width/2,_=y.props.height/2,G=rA.map(T=>{const D=T.x-K,q=T.y-_,dA=D*Math.cos(X)-q*Math.sin(X),sA=D*Math.sin(X)+q*Math.cos(X);return{x:H(dA+K+y.props.x,3),y:H(sA+_+y.props.y,3)}});return p.set(w,G),G},Y=y=>{const w=S(y),k=w.map(D=>D.x),X=w.map(D=>D.y),rA=H(Math.min(...k),3),K=H(Math.max(...k),3),_=H(Math.min(...X),3),G=H(Math.max(...X),3);return{minX:rA,maxX:K,minY:_,maxY:G,width:H(K-rA,3),height:H(G-_,3),centerX:H((rA+K)/2,3),centerY:H((_+G)/2,3)}},z=(y,w)=>{const k=Y(y),rA=(_=>_.type==="rectangle"?parseFloat(_.props.LineWidth||"0.5")/3.78:0)(y),K=(_,G,T)=>{if(T==="rectangle"&&rA>0){const D=rA/2;if(G==="left"||G==="top")return _-D;if(G==="right"||G==="bottom")return _+D}return _};if(y.type==="line")switch(w){case"left":return{left:H(K(k.minX,w,y.type),3)+"mm"};case"right":return{left:H(K(k.maxX,w,y.type),3)+"mm"};case"top":return{top:H(K(k.minY,w,y.type),3)+"mm"};case"bottom":return{top:H(K(k.maxY,w,y.type),3)+"mm"};default:return{}}if(y.type==="verline"&&w==="right"){const G=parseFloat(y.props.LineWidth||"0.5")/3.78;return{left:H(K(k.minX+G,w,y.type),3)+"mm"}}switch(w){case"left":return{left:H(K(k.minX,w,y.type),3)+"mm"};case"right":return{left:H(K(k.maxX,w,y.type),3)+"mm"};case"top":return{top:H(K(k.minY,w,y.type),3)+"mm"};case"bottom":return{top:H(K(k.maxY,w,y.type),3)+"mm"};default:return{}}},$=()=>{o.nextTick(()=>{const y=document.querySelector(".canvas-container");if(!y||!c.value||!u.value)return;const w=y.getBoundingClientRect(),k=Or(c.value),X=Or(u.value),rA=16,K=21,_=21,G=20,T=24,D=24,q=w.width-rA*2-K-D,dA=w.height-rA-_-G-T;let sA=q/k,mA=dA/X,RA=Math.min(sA,mA);RA=RA*.95;const SA=Math.min(4,RA);s=Math.max(.8,Math.min(SA,RA)),i.value=J(s,1),setTimeout(()=>{n.value=1,a.value=!1},500)})};function J(y,w){y=y.toString();let k=y.indexOf(".");return k!==-1?y=y.substring(0,w+k+1):y=y.substring(0),Number(parseFloat(y).toFixed(w))}const Z=y=>f.get(y)||null,x=y=>{const w=g.value.indexOf(y),k=w===g.value.length-1,X=w!==-1,rA=`${y.id}_${Math.round(y.props.x*10)}_${Math.round(y.props.y*10)}_${y.props.width}_${y.props.height}_${y.props.rotation}_${X}_${k}`;if(U.has(rA))return U.get(rA);const K={width:y.props.width+"mm",height:y.props.height+"mm",transform:`translate(${y.props.x}mm, ${y.props.y}mm) rotate(${y.props.rotation}deg)`};return X?k?K.zIndex=1e3:K.zIndex=999:K.zIndex=10,U.set(rA,K),K},j=y=>{const w=g.value.some(X=>X.id===y.id),k=Q()===y;return{"component-selected":w,"component-current":w&&k,"no-outline":w&&(y.type==="line"||y.type==="verline")}},eA=(y,w)=>{const X=((y.props.rotation||0)%360+360)%360;if(y.type==="line"&&(w==="left"||w==="right")){let G;const D=((w==="left"?270:90)+X)%360;return D>=337.5||D<22.5?G="n-resize":D>=22.5&&D<67.5?G="ne-resize":D>=67.5&&D<112.5?G="e-resize":D>=112.5&&D<157.5?G="se-resize":D>=157.5&&D<202.5?G="s-resize":D>=202.5&&D<247.5?G="sw-resize":D>=247.5&&D<292.5?G="w-resize":D>=292.5&&D<337.5&&(G="nw-resize"),{cursor:G,top:"50%",transform:"translateY(-50%)"}}if(y.type==="verline"&&(w==="top"||w==="bottom")){let G;const D=((w==="top"?0:180)+X)%360;return D>=337.5||D<22.5?G="n-resize":D>=22.5&&D<67.5?G="ne-resize":D>=67.5&&D<112.5?G="e-resize":D>=112.5&&D<157.5?G="se-resize":D>=157.5&&D<202.5?G="s-resize":D>=202.5&&D<247.5?G="sw-resize":D>=247.5&&D<292.5?G="w-resize":D>=292.5&&D<337.5&&(G="nw-resize"),{cursor:G,left:"50%",transform:"translateX(-50%)"}}const K=({top:0,"top-right":45,right:90,"bottom-right":135,bottom:180,"bottom-left":225,left:270,"top-left":315}[w]+X)%360;let _="pointer";return K>=337.5||K<22.5?_="n-resize":K>=22.5&&K<67.5?_="ne-resize":K>=67.5&&K<112.5?_="e-resize":K>=112.5&&K<157.5?_="se-resize":K>=157.5&&K<202.5?_="s-resize":K>=202.5&&K<247.5?_="sw-resize":K>=247.5&&K<292.5?_="w-resize":K>=292.5&&K<337.5&&(_="nw-resize"),{cursor:_,display:"block",visibility:"visible",opacity:"1"}},oA=()=>{i.value<4&&(i.value+=.1)},lA=()=>{i.value>.8&&(i.value-=.1)},tA=()=>{var w;const y=Q();return!y||y.type!=="line"?((w=y==null?void 0:y.props)==null?void 0:w.x)||0:y.props.x1||y.props.x||0},VA=()=>{var w;const y=Q();return!y||y.type!=="line"?((w=y==null?void 0:y.props)==null?void 0:w.y)||0:y.props.y1||y.props.y||0},IA=(y,w)=>{const k=Q();if(!k||k.type!=="line"){ie(y,w);return}const X=Number(w);if(isNaN(X))return;const rA=k.props.width||15,K=k.props.rotation||0,G=(k.props.height||.5)/2,T=rA/2,D=G,q=K*Math.PI/180,dA=Math.cos(q),sA=Math.sin(q),RA=-(rA/2),kA=0,SA=RA*dA-kA*sA,ZA=RA*sA+kA*dA;if(y==="x"){const he=X-T-SA;k.props.x=Number(he.toFixed(2))}else if(y==="y"){const he=X-D-ZA;k.props.y=Number(he.toFixed(2))}};function Kn(y){const w=document.activeElement.tagName.toLowerCase();if(w==="input"||w==="textarea")return;const k=Q();if(!k)return;const X=Number(k.props.width)||0,rA=Number(k.props.height)||0;let K=k.props.x,_=k.props.y,G=!1;if(y.key==="ArrowLeft"?(K=H(k.props.x-Ln),G=!0):y.key==="ArrowRight"?(K=H(k.props.x+Ln),G=!0):y.key==="ArrowUp"?(_=H(k.props.y-Ln),G=!0):y.key==="ArrowDown"&&(_=H(k.props.y+Ln),G=!0),G){const T=c.value-X,D=u.value-rA;K<0?K=0:K>T&&(K=T),_<0?_=0:_>D&&(_=D),(we(k.props.x,K)||we(k.props.y,_))&&(k.props.x=K,k.props.y=_),y.preventDefault()}}const fl=({e:y,comp:w,previewDiv:k})=>{var X,rA;(X=y==null?void 0:y.dataTransfer)==null||X.setData("comp",JSON.stringify(w)),document.body.appendChild(k),(rA=y==null?void 0:y.dataTransfer)==null||rA.setDragImage(k,0,0),setTimeout(()=>document.body.removeChild(k),0)},Gn=async y=>{var Pn,Ru,Tu;y.preventDefault();const w=JSON.parse(((Ru=(Pn=y==null?void 0:y.dataTransfer)==null?void 0:Pn.getData)==null?void 0:Ru.call(Pn,"comp"))||"{}")||{},k=(w==null?void 0:w.type)||"";if(!k)return;const X=document.querySelector("#design").getBoundingClientRect(),rA=(y.clientX-X.left)/i.value,K=(y.clientY-X.top)/i.value,_=xA.value[k]||{};let G=zi(rA),T=zi(K);const D=_.width,q=_.height,dA=c.value-D,sA=u.value-q;G=Math.max(0,Math.min(G,dA)),T=Math.max(0,Math.min(T,sA));const{propertyPanel:mA,...RA}=_;let kA={...RA,x:H(G),y:H(T),width:H(D),height:H(q)};if((Tu=xA.value[k])!=null&&Tu.propertyPanel){const Ye=Oe(xA.value[k].propertyPanel)||{};if(kA={...kA,...Ye},k==="line"&&Ye.LineWidth){const Vt=parseFloat(Ye.LineWidth)*.3528;kA.height=H(Vt,3)}}const ZA=((Ye,gl)=>{const{width:Vt,height:_n,lockAspectRatio:iR}=Ye;let hr=Vt,pr=_n;const qn=c.value-2,$n=u.value-2;let Ul=!1;if(Vt>qn&&(hr=qn,Ul=!0),_n>$n&&(pr=$n,Ul=!0),iR&&Ul){const sR=qn/Vt,cR=$n/_n,Nu=Math.min(sR,cR);hr=H(Vt*Nu,2),pr=H(_n*Nu,2),hr=Math.min(hr,qn),pr=Math.min(pr,$n)}return{width:hr,height:pr}})(kA);if(kA.width=ZA.width,kA.height=ZA.height,ZA.width!==D||ZA.height!==q){const Ye=c.value-ZA.width,gl=u.value-ZA.height;G=Math.max(0,Math.min(G,Ye)),T=Math.max(0,Math.min(T,gl)),kA.x=H(G),kA.y=H(T)}const he={id:$A(),type:k,props:kA};l.value.push(he),h(he)};function hl(y){let w=y.target;for(;w&&w!==document.querySelector("#design");){if(w.classList&&(w.classList.contains("canvas-item")||w.classList.contains("resize-handle")||w.classList.contains("delete-btn")||w.classList.contains("rotate-handle")||w.classList.contains("property-panel")||w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.tagName==="BUTTON"))return;w=w.parentElement}E()}const pl=(y,w)=>{if(y.stopPropagation(),g.value.length===0){h(w),V(y,w);return}if(Q()===w){V(y,w);return}h(w),V(y,w)},_A=y=>{if(U.clear(),p.clear(),l.value.find(k=>k.id===y)&&(l.value=l.value.filter(k=>k.id!==y)),g.value.some(k=>k.id===y)){const k=g.value.filter(X=>X.id!==y);g.value=k}o.nextTick(()=>{})},qA=y=>{var k;const w=document.activeElement.tagName.toLowerCase();w==="input"||w==="textarea"||(y.key==="Delete"||y.key==="Backspace")&&g.value.length>0&&_A((k=Q())==null?void 0:k.id)},{handleMouseWheel:HA,handleInputChange:ie,adjustRotation:Yn}=Jw(g,c,u),Br=()=>{setTimeout(()=>{const y=document.querySelector(".center-container");if(!y)return;const w=y.getBoundingClientRect();y.style.height=`calc(100vh - ${w==null?void 0:w.top}px)`,$()},200)};o.watch(()=>t.templateInfo,(y,w)=>{y!==w&&(r.value=y||{},l.value=(y==null?void 0:y.items)||[])},{deep:!0,immediate:!0});const{handleCopy:zn,handlePaste:jn}=Kw(l,g,c,u),xA=o.ref({}),Ct=o.ref(!1),UA=async y=>{try{Ct.value=!1,xA.value=await cw(y),Ct.value=!0}catch{xA.value={},Ct.value=!0}};o.watch(()=>t.templateType,async y=>{try{await UA(y),E(),U.clear(),p.clear()}catch{}},{immediate:!0}),o.onMounted(async()=>{Ct.value||await UA(t.templateType),window.addEventListener("resize",Br),window.addEventListener("keydown",qA),window.addEventListener("keydown",zn),window.addEventListener("keydown",jn),window.addEventListener("keydown",Kn),Br(),fr()}),o.onBeforeUnmount(()=>{window.removeEventListener("resize",Br),window.removeEventListener("keydown",qA),window.removeEventListener("keydown",zn),window.removeEventListener("keydown",jn),window.removeEventListener("keydown",Kn),U.clear(),p.clear()});function $A(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,y=>{const w=Math.random()*16|0;return(y==="x"?w:w&3|8).toString(16)})}const Ge=y=>{var k;if(!xA.value||!xA.value[y])return{};const w=xA.value[y]||{};return y==="image"&&((k=t.config)!=null&&k.image)?{...w,image:{...w.image,...t.config.image}}:w},yt=()=>Lw(l,r.value),Xn=y=>{r.value.graphData=y||{},fr()},fr=()=>{var w;const y=zw(r.value.graphData)||"";y&&((w=document.querySelector("#design"))==null||w.appendChild(y))},yu=async y=>{var k;const w=JSON.parse(JSON.stringify(y));for(const X of w)if(X.type==="image"&&((k=X.props)!=null&&k.ImageSrc)){const rA=X.props.ImageSrc;typeof rA=="object"&&rA.fileSrc&&rA.fileSrc}return w},lR=()=>new Promise(async(y,w)=>{var k;try{E();const X=JSON.parse(JSON.stringify(l.value)),rA=((k=t.config)==null?void 0:k.textDisplayPriority)||"text";X==null||X.forEach(T=>{var D,q;if(T.type=="text"){const dA=((q=(D=t.options)==null?void 0:D.fields)==null?void 0:q.find(sA=>{var mA;return sA.value==((mA=T==null?void 0:T.props)==null?void 0:mA.FieldName)}))||{};T.props.Text=rA=="text"?T.props.Text||(dA==null?void 0:dA.label):(dA==null?void 0:dA.label)||T.props.Text}});const K=await yu(X),_=[...l.value];l.value=K;const G=()=>{var q;const T=((q=document.querySelector("#design"))==null?void 0:q.querySelectorAll("img"))||[],D=Array.from(T).map(dA=>dA.complete?Promise.resolve():new Promise(sA=>{dA.onload=dA.onerror=sA}));return Promise.all(D)};o.nextTick(async()=>{var dA;await new Promise(sA=>setTimeout(sA,100)),await G(),(((dA=document.querySelector("#design"))==null?void 0:dA.querySelectorAll("img"))||[]).forEach((sA,mA)=>{});const D=document.querySelector("#design");if(!D){w(new Error("找不到要转换的DOM元素"));return}const q=i.value;G().then(()=>{pV(D,{scale:Math.max(window.devicePixelRatio*2,3),useCORS:!0,allowTaint:!0,backgroundColor:null,logging:!1,imageTimeout:15e3,onclone:sA=>{const mA=sA.querySelector(".canvas-wrapper");if(mA){const ZA=mA.style.transform.replace(/scale\([^)]*\)/g,"").replace(/\s+/g," ").trim();mA.style.transform=ZA||"none",mA.style.opacity="1"}const RA=sA.querySelector("#design");if(RA){const SA=window.getComputedStyle(D);for(let ZA=0;ZA<SA.length;ZA++){const he=SA[ZA];RA.style[he]=SA.getPropertyValue(he)}}sA.querySelectorAll("img").forEach(SA=>{SA.style.imageRendering="high-quality",SA.style.webkitImageRendering="high-quality",SA.style.mozImageRendering="high-quality",SA.style.objectFit="contain",SA.style.objectPosition="center"})}}).then(sA=>{l.value=_;const mA=sA.toDataURL("image/png");y({data:yt(),image:mA})}).catch(sA=>{l.value=_,w(sA)})}).catch(sA=>{w(sA)})})}catch(X){w(X)}}),Vu=()=>new Promise((y,w)=>{l.value.forEach(X=>{if(X.type==="image"&&!X.props.ImageSrc)return It.warning("图片控件请选择图片!"),w("图片控件请选择图片!")}),y(!0)});return A({getJson:()=>Vu().then(()=>yt()),clear:()=>{l.value=[],E()},snapshot:()=>Vu().then(()=>lR())}),(y,w)=>{var _,G;const k=o.resolveComponent("el-icon-refresh-left"),X=o.resolveComponent("el-icon"),rA=o.resolveComponent("el-icon-close"),K=o.resolveComponent("el-switch");return o.openBlock(),o.createElementBlock("div",QV,[o.createElementVNode("div",wV,[o.createVNode(Uw,{onDragStart:fl,config:e.config,propsConfig:xA.value},null,8,["config","propsConfig"])]),o.createElementVNode("div",mV,[a.value?(o.openBlock(),o.createElementBlock("div",EV,w[32]||(w[32]=[o.createElementVNode("div",{class:"loader-circle"},null,-1),o.createElementVNode("p",null,"设计画板加载中...",-1)]))):o.createCommentVNode("",!0),o.createElementVNode("div",FV,[e.showGraphConfig?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createVNode(kw,{"graph-data":(_=r.value)==null?void 0:_.graphData,onSuccess:Xn},null,8,["graph-data"]),w[33]||(w[33]=o.createElementVNode("div",{style:{width:"30px"}},null,-1))],64)):o.createCommentVNode("",!0),o.createElementVNode("div",CV,[o.createElementVNode("button",{onClick:lA,disabled:i.value<=.8},"-",8,yV),o.createElementVNode("span",null,o.toDisplayString(Math.round(i.value*100))+"%",1),o.createElementVNode("button",{onClick:oA,disabled:i.value>=4},"+",8,VV)])]),o.createElementVNode("div",RV,[o.createElementVNode("div",{class:"canvas-wrapper",style:o.normalizeStyle(`transform: scale(${i.value});opacity: ${n.value};`)},[c.value&&u.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createElementVNode("div",TV,[o.createVNode(ws,{direction:"horizontal",length:c.value},null,8,["length"])]),o.createElementVNode("div",NV,[o.createVNode(ws,{direction:"vertical",length:u.value},null,8,["length"])])],64)):o.createCommentVNode("",!0),o.createElementVNode("div",{id:"design",class:"canvas",style:o.normalizeStyle(`width: ${c.value}mm; height: ${u.value}mm;`),onDrop:Gn,onDragover:w[1]||(w[1]=o.withModifiers(()=>{},["prevent"])),onPointerdown:hl},[o.unref(C)&&o.unref(F)?(o.openBlock(),o.createElementBlock("div",vV,[o.createElementVNode("div",{class:"drag-extend-line vertical",style:o.normalizeStyle(z(o.unref(F),"left"))},null,4),o.createElementVNode("div",{class:"drag-extend-line vertical",style:o.normalizeStyle(z(o.unref(F),"right"))},null,4),o.createElementVNode("div",{class:"drag-extend-line horizontal",style:o.normalizeStyle(z(o.unref(F),"top"))},null,4),o.createElementVNode("div",{class:"drag-extend-line horizontal",style:o.normalizeStyle(z(o.unref(F),"bottom"))},null,4)])):o.createCommentVNode("",!0),o.unref(M)?(o.openBlock(),o.createElementBlock("div",IV,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(R).horizontal,(T,D)=>(o.openBlock(),o.createElementBlock("div",{key:`h-${D}`,class:o.normalizeClass(["alignment-guide horizontal",`guide-${T.type}`]),style:o.normalizeStyle({top:`${T.y}mm`,left:"0",right:"0"})},null,6))),128)),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(R).vertical,(T,D)=>(o.openBlock(),o.createElementBlock("div",{key:`v-${D}`,class:o.normalizeClass(["alignment-guide vertical",`guide-${T.type}`]),style:o.normalizeStyle({left:`${T.x}mm`,top:"0",bottom:"0"})},null,6))),128))])):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value,T=>{var D;return o.openBlock(),o.createElementBlock("div",{key:T.id,class:o.normalizeClass(["canvas-item",j(T)]),style:o.normalizeStyle(x(T)),"data-item-id":T.id,onMousedown:q=>pl(q,T)},[o.unref(Q)()===T?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[T.props.lockAspectRatio?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[T.type!=="line"?(o.openBlock(),o.createElementBlock("div",{key:0,class:"resize-handle top",style:o.normalizeStyle(eA(T,"top")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"top"),["stop"])},null,44,bV)):o.createCommentVNode("",!0),T.type!=="verline"&&T.type!=="line"?(o.openBlock(),o.createElementBlock("div",{key:1,class:"resize-handle right",style:o.normalizeStyle(eA(T,"right")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"right"),["stop"])},null,44,MV)):o.createCommentVNode("",!0),T.type!=="line"?(o.openBlock(),o.createElementBlock("div",{key:2,class:"resize-handle bottom",style:o.normalizeStyle(eA(T,"bottom")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"bottom"),["stop"])},null,44,HV)):o.createCommentVNode("",!0),T.type!=="verline"?(o.openBlock(),o.createElementBlock("div",{key:3,class:"resize-handle left",style:o.normalizeStyle(eA(T,"left")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"left"),["stop"])},null,44,xV)):o.createCommentVNode("",!0)],64)),T.type!=="line"&&T.type!=="verline"?(o.openBlock(),o.createElementBlock("div",{key:1,class:"resize-handle top-left",style:o.normalizeStyle(eA(T,"top-left")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"top-left"),["stop"])},null,44,kV)):o.createCommentVNode("",!0),T.type!=="line"&&T.type!=="verline"?(o.openBlock(),o.createElementBlock("div",{key:2,class:"resize-handle top-right",style:o.normalizeStyle(eA(T,"top-right")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"top-right"),["stop"])},null,44,ZV)):o.createCommentVNode("",!0),T.type!=="line"&&T.type!=="verline"?(o.openBlock(),o.createElementBlock("div",{key:3,class:"resize-handle bottom-right",style:o.normalizeStyle(eA(T,"bottom-right")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"bottom-right"),["stop"])},null,44,OV)):o.createCommentVNode("",!0),T.type!=="line"&&T.type!=="verline"?(o.openBlock(),o.createElementBlock("div",{key:4,class:"resize-handle bottom-left",style:o.normalizeStyle(eA(T,"bottom-left")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"bottom-left"),["stop"])},null,44,WV)):o.createCommentVNode("",!0),T.type!=="verline"?(o.openBlock(),o.createElementBlock("div",{key:5,class:"rotate-handle",onMousedown:o.withModifiers(q=>o.unref(P)(q,T),["stop"])},[o.createVNode(X,{size:"6"},{default:o.withCtx(()=>[o.createVNode(k)]),_:1})],40,DV)):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"delete-btn",onClick:o.withModifiers(q=>_A(T.id),["stop"]),onMousedown:w[0]||(w[0]=o.withModifiers(()=>{},["stop"])),title:"删除"},[o.createVNode(X,{size:"6"},{default:o.withCtx(()=>[o.createVNode(rA)]),_:1})],40,LV)],64)):o.createCommentVNode("",!0),T.props&&Ct.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(((D=Z(T.type))==null?void 0:D.component)||null),{key:`${T.id}-${T.type}`,modelValue:{...T.props,__selected:o.unref(Q)()===T,options:t.options},propsConfig:xA.value,"onUpdate:modelValue":q=>{const{__selected:dA,options:sA,...mA}=q;Object.keys(mA).forEach(RA=>{mA[RA]!==void 0&&(T.props[RA]=mA[RA])})}},null,8,["modelValue","propsConfig","onUpdate:modelValue"])):o.createCommentVNode("",!0)],46,SV)}),128))],36)],4)])]),o.createElementVNode("div",JV,[o.unref(g).length>0?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[w[38]||(w[38]=o.createElementVNode("h3",{class:"property-panel-title"},"属性设置",-1)),o.createElementVNode("div",KV,[o.createElementVNode("div",GV,[o.createElementVNode("label",null,o.toDisplayString(o.unref(Q)().type==="line"?"起点X:":"X坐标:"),1),o.createElementVNode("div",YV,[o.createElementVNode("button",{onClick:w[2]||(w[2]=o.withModifiers(T=>o.unref(HA)(T,"x",-.5),["stop"]))},"-"),o.createElementVNode("input",{type:"number",value:tA(),onInput:w[3]||(w[3]=T=>IA("x",T.target.value)),onClick:w[4]||(w[4]=o.withModifiers(()=>{},["stop"])),onMousedown:w[5]||(w[5]=o.withModifiers(()=>{},["stop"]))},null,40,zV),o.createElementVNode("button",{onClick:w[6]||(w[6]=o.withModifiers(T=>o.unref(HA)(T,"x",.5),["stop"]))},"+")])]),o.createElementVNode("div",jV,[o.createElementVNode("label",null,o.toDisplayString(o.unref(Q)().type==="line"?"起点Y:":"Y坐标:"),1),o.createElementVNode("div",XV,[o.createElementVNode("button",{onClick:w[7]||(w[7]=o.withModifiers(T=>o.unref(HA)(T,"y",-.5),["stop"]))},"-"),o.createElementVNode("input",{type:"number",value:VA(),onInput:w[8]||(w[8]=T=>IA("y",T.target.value)),onClick:w[9]||(w[9]=o.withModifiers(()=>{},["stop"])),onMousedown:w[10]||(w[10]=o.withModifiers(()=>{},["stop"]))},null,40,PV),o.createElementVNode("button",{onClick:w[11]||(w[11]=o.withModifiers(T=>o.unref(HA)(T,"y",.5),["stop"]))},"+")])]),o.unref(Q)().type!=="verline"?(o.openBlock(),o.createElementBlock("div",_V,[w[34]||(w[34]=o.createElementVNode("label",null,"宽度:",-1)),o.createElementVNode("div",qV,[o.createElementVNode("button",{onClick:w[12]||(w[12]=o.withModifiers(T=>o.unref(HA)(T,"width",-.5,1),["stop"]))},"-"),o.withDirectives(o.createElementVNode("input",{type:"number","onUpdate:modelValue":w[13]||(w[13]=T=>o.unref(Q)().props.width=T),onInput:w[14]||(w[14]=T=>o.unref(ie)("width",T.target.value)),onClick:w[15]||(w[15]=o.withModifiers(()=>{},["stop"])),onMousedown:w[16]||(w[16]=o.withModifiers(()=>{},["stop"]))},null,544),[[o.vModelText,o.unref(Q)().props.width,void 0,{number:!0}]]),o.createElementVNode("button",{onClick:w[17]||(w[17]=o.withModifiers(T=>o.unref(HA)(T,"width",.5,1),["stop"]))},"+")])])):o.createCommentVNode("",!0),o.unref(Q)().type!=="line"?(o.openBlock(),o.createElementBlock("div",$V,[w[35]||(w[35]=o.createElementVNode("label",null,"高度:",-1)),o.createElementVNode("div",AR,[o.createElementVNode("button",{onClick:w[18]||(w[18]=o.withModifiers(T=>o.unref(HA)(T,"height",-.5,1),["stop"]))},"-"),o.withDirectives(o.createElementVNode("input",{type:"number","onUpdate:modelValue":w[19]||(w[19]=T=>o.unref(Q)().props.height=T),onInput:w[20]||(w[20]=T=>o.unref(ie)("height",T.target.value)),onClick:w[21]||(w[21]=o.withModifiers(()=>{},["stop"])),onMousedown:w[22]||(w[22]=o.withModifiers(()=>{},["stop"]))},null,544),[[o.vModelText,o.unref(Q)().props.height,void 0,{number:!0}]]),o.createElementVNode("button",{onClick:w[23]||(w[23]=o.withModifiers(T=>o.unref(HA)(T,"height",.5,1),["stop"]))},"+")])])):o.createCommentVNode("",!0),o.createElementVNode("div",eR,[w[36]||(w[36]=o.createElementVNode("label",null,"旋转:",-1)),o.createElementVNode("div",tR,[o.createElementVNode("button",{onClick:w[24]||(w[24]=o.withModifiers(T=>o.unref(Yn)(-1),["stop"]))},"-"),o.withDirectives(o.createElementVNode("input",{type:"number","onUpdate:modelValue":w[25]||(w[25]=T=>o.unref(Q)().props.rotation=T),onInput:w[26]||(w[26]=T=>o.unref(ie)("rotation",T.target.value)),onClick:w[27]||(w[27]=o.withModifiers(()=>{},["stop"])),onMousedown:w[28]||(w[28]=o.withModifiers(()=>{},["stop"]))},null,544),[[o.vModelText,o.unref(Q)().props.rotation,void 0,{number:!0}]]),o.createElementVNode("button",{onClick:w[29]||(w[29]=o.withModifiers(T=>o.unref(Yn)(1),["stop"]))},"+")])]),o.unref(Q)().type!=="line"?(o.openBlock(),o.createElementBlock("div",rR,[w[37]||(w[37]=o.createElementVNode("label",null,"锁定宽高比:",-1)),o.createElementVNode("div",nR,[o.createVNode(K,{modelValue:o.unref(Q)().props.lockAspectRatio,"onUpdate:modelValue":w[30]||(w[30]=T=>o.unref(Q)().props.lockAspectRatio=T),"active-value":!0,"inactive-value":!1},null,8,["modelValue"])])])):o.createCommentVNode("",!0)]),(o.openBlock(),o.createBlock(o.resolveDynamicComponent(((G=Z(o.unref(Q)().type))==null?void 0:G.propertyPanel)||null),{modelValue:o.unref(Q)().props,"onUpdate:modelValue":w[31]||(w[31]=T=>o.unref(Q)().props=T),options:e.options,"props-config":Ge(o.unref(Q)().type)},null,8,["modelValue","options","props-config"]))],64)):o.createCommentVNode("",!0)])])}}},[["__scopeId","data-v-30c717ec"]]),DR="",Jn=QA({__name:"index",props:{templateData:{type:Object,default:()=>({graphData:{},width:0,height:0,printWidth:0,printHeight:0,items:[]})},config:{type:Object,default:()=>({})}},setup(e){const A=o.getCurrentInstance(),t=e,r=o.ref(!1),n=o.ref({}),a=o.ref(),l=o.ref(0),i=o.ref(!1),s=(g,h)=>{let Q;return function(...C){const F=()=>{clearTimeout(Q),g(...C)};clearTimeout(Q),Q=setTimeout(F,h)}},c=o.ref({rectTop:0,isInModal:!1}),u=()=>{if(!a.value)return;const g=a.value.getBoundingClientRect(),h=B(a.value);let Q=0;if(g.top>0)Q=g.top;else if(h){const E=U(a.value);Q=E>0?E:60}else{const E=a.value.offsetTop;E>0?Q=E:Q=60}(Q!==c.value.rectTop||h!==c.value.isInModal)&&(l.value=Q,i.value=h,c.value={rectTop:Q,isInModal:h})},d=s(u,100),B=g=>{let h=g.parentElement;for(;h;){if(h.classList&&(h.classList.contains("el-dialog")||h.classList.contains("el-drawer")||h.classList.contains("sc-dialog")))return!0;h=h.parentElement}return!1},U=g=>{let h=g.parentElement;for(;h;){if(h.classList&&(h.classList.contains("el-dialog")||h.classList.contains("el-drawer")||h.classList.contains("sc-dialog"))){const Q=h.getBoundingClientRect();return Q.top>0?Q.top:60}h=h.parentElement}return 60};o.onMounted(()=>{setTimeout(()=>u(),100),setTimeout(()=>u(),300),window.addEventListener("resize",d),o.onBeforeUnmount(()=>{window.removeEventListener("resize",d)})}),o.watch(()=>r.value,g=>{g&&o.nextTick(()=>setTimeout(()=>u(),50))}),o.watch(()=>t.templateData,g=>p(g),{deep:!0,immediate:!0});function p(g){if(r.value=(g==null?void 0:g.width)>0&&(g==null?void 0:g.height)>0,!r.value)return;const h={...g};h.printWidth||Object.assign(h,{printWidth:h.width}),h.printHeight||Object.assign(h,{printHeight:h.height}),h!=null&&h.graphData||Object.assign(h,{graphData:{printList:[{x:0,y:0,width:g.printWidth,height:g.printHeight,topLeftRadius:4,topRightRadius:4,bottomLeftRadius:4,bottomRightRadius:4}],punchingList:[]}}),h!=null&&h.items||Object.assign(h,{items:[]}),n.value=h}function f(g){A.exposed=g||{},A.exposeProxy=g||{}}return(g,h)=>{const Q=o.resolveDirective("loading");return o.withDirectives((o.openBlock(),o.createElementBlock("div",{ref_key:"templateDesignerRef",ref:a,class:o.normalizeClass(["template-designer",{"template-designer-border-top":i.value}]),style:o.normalizeStyle({height:"calc(100vh - "+(l.value+1)+"px)"})},[r.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.h(oR,{...g.$attrs,...t,ref:f},g.$slots)),{key:0,"template-info":n.value},null,8,["template-info"])):o.createCommentVNode("",!0)],6)),[[Q,!r.value]])}}},[["__scopeId","data-v-a3d9b11f"]]);Jn.install=e=>{e.component(Jn.name||"TemplateDesigner",Jn)};const Cu=Object.freeze(Object.defineProperty({__proto__:null,default:{text:{width:20,height:4.2,rotation:0,lockAspectRatio:!1,propertyPanel:[{prop:"Title",label:"标题",default:"",layout:"full",desc:"用于固定文案的打印,不需要则不填。示例:如果填写“价格:”,则打印时内容为“价格:【字段对应值】”"},{prop:"FieldName",label:"字段名称",type:"select",multiple:!0,optionsKey:"fields",default:"",layout:"full"},{prop:"Text",label:"测试数据(展示使用,无实际意义)",default:"测试文本",layout:"full"},{prop:"FontName",label:"字体名称",type:"select",desc:"注意:选择的字体需要计算机中安装有对应字体才有效",options:[{label:"黑体",value:"黑体",cssValue:"SimHei"},{label:"楷体",value:"楷体",cssValue:"KaiTi"},{label:"宋体",value:"宋体",cssValue:"SimSun"},{label:"隶书",value:"隶书",cssValue:"LiSu"},{label:"缅语Arial",value:"Arial",cssValue:"Arial"},{label:"缅语Segoe UI",value:"Segoe UI",cssValue:"Segoe UI"}],default:"黑体",layout:"half"},{prop:"FontSize",label:"字体大小",type:"number",min:1,max:100,default:10,layout:"half"},{prop:"FontColor",label:"字体颜色",type:"color",hide:!0,default:"#000000",layout:"half"},{prop:"Bold",label:"字体加粗",type:"select",options:[{label:"加粗",value:1},{label:"不加粗",value:0}],default:0,layout:"half"},{prop:"Italic",label:"是否斜体",type:"select",options:[{label:"是",value:1},{label:"否",value:0}],default:0,layout:"half"},{prop:"Underline",label:"下划线",type:"select",options:[{label:"是",value:1},{label:"否",value:0}],default:0,hide:!0},{prop:"Alignment",label:"对齐方式",type:"select",options:[{label:"居左",value:1},{label:"居中",value:2},{label:"居右",value:3}],default:2},{prop:"TextWrap",label:"文本换行",type:"select",options:[{label:"换行",value:1},{label:"不换行&省略",value:2},{label:"不换行&隐藏",value:3}],default:1,hide:!0},{prop:"HOrient",label:"水平锁定",type:"select",options:[{label:"无",value:0},{label:"左边距锁定",value:1},{label:"右边距锁定",value:2},{label:"水平居中",value:3}],hide:!0,default:0},{prop:"VOrient",label:"垂直锁定",type:"select",options:[{label:"无",value:0},{label:"上边距锁定",value:1},{label:"下边距锁定",value:2},{label:"垂直居中",value:3}],hide:!0,default:0},{prop:"PenWidth",label:"线宽",type:"number",min:0,hide:!0,default:0},{prop:"PenStyle",label:"线型",type:"select",hide:!0,options:[{label:"实线",value:0},{label:"破折线",value:1},{label:"点线",value:2},{label:"点划线",value:3},{label:"双点划线",value:4}],default:0},{prop:"Stretch",label:"缩放模式",type:"select",options:[{label:"扩展",value:1},{label:"缩放",value:2}],hide:!0,default:1},{prop:"PreviewOnly",label:"仅预览",type:"select",hide:!0,options:[{label:"是",value:1},{label:"否",value:0}],default:0},{prop:"ReadOnly",label:"只读",type:"select",hide:!0,options:[{label:"是",value:1},{label:"否",value:0}],default:0}]},barcode:{width:20,height:6,rotation:0,lockAspectRatio:!1,propertyPanel:[{prop:"FieldName",label:"字段名称",type:"select",optionsKey:"fields",default:"goods_sn",layout:"full"},{prop:"BarcodeValue",label:"测试数据(展示使用,无实际意义)",type:"text",default:"1234567890"},{prop:"CodeType",label:"条码类型",type:"select",options:[{label:"CODE128",value:"128Auto",compValue:"CODE128"},{label:"CODE39",value:"Code39",compValue:"CODE39"},{label:"EAN13",value:"EAN13",compValue:"EAN13"}],hide:!0,default:"128Auto"},{prop:"AlignJustify",label:"对齐方式",type:"select",options:[{label:"两端对齐",value:0},{label:"左",value:1},{label:"中",value:2},{label:"右",value:3}],hide:!0,default:0},{prop:"LineColor",label:"条形码颜色",type:"color",hide:!0,default:"#000000"}]},qrcode:{width:10,height:10,rotation:0,lockAspectRatio:!0,propertyPanel:[{prop:"FieldName",label:"字段名称",type:"select",optionsKey:"fields",default:"",layout:"full"},{prop:"QRCodeValue",label:"测试数据(展示使用,无实际意义)",type:"text",default:"FB-GOLD"},{prop:"QRCodeVersion",label:"二维码版本",type:"number",min:1,max:40,hide:!0,default:7},{prop:"QRCodeErrorLevel",label:"纠错级别",type:"select",options:[{label:"L (7%)",value:"L"},{label:"M (15%)",value:"M"},{label:"Q (25%)",value:"Q"},{label:"H (30%)",value:"H"}],hide:!0,default:"H"},{prop:"QRCodeEncodeMode",label:"编码模式",type:"select",options:[{label:"数字",value:"N"},{label:"二进制或汉语",value:"B"},{label:"英文字母",value:"A"}],hide:!0,default:"B"},{prop:"QRCodeForeground",label:"前景色",type:"color",hide:!0,default:"#000000"},{prop:"QRCodeBackground",label:"背景景色",type:"color",hide:!0,default:"transparent"}]},image:{width:12,height:12,rotation:0,lockAspectRatio:!1,propertyPanel:[{prop:"ImageSrc",label:"图片地址",type:"file",accept:"image/*",default:""},{prop:"ScaleMode",label:"图片缩放",type:"select",options:[{label:"原始尺寸",value:1},{label:"居中裁剪",value:2},{label:"填充",value:3}],default:1},{prop:"IsPrint",label:"是否打印",type:"select",options:[{label:"是",value:!0},{label:"否",value:!1}],default:!0}]},rectangle:{width:15,height:10,rotation:0,lockAspectRatio:!1,propertyPanel:[{prop:"LineWidth",type:"select",label:"线宽",default:"0.5",options:[{label:"默认",value:"0.5"},{label:"1px",value:"1"},{label:"2px",value:"2"},{label:"3px",value:"3"},{label:"4px",value:"4"},{label:"5px",value:"5"},{label:"6px",value:"6"},{label:"7px",value:"7"},{label:"8px",value:"8"},{label:"9px",value:"9"},{label:"10px",value:"10"}]},{prop:"LineStyle",type:"select",label:"样式",default:1,options:[{label:"实线",value:1},{label:"虚线",value:2}]},{prop:"BorderRadius",type:"number",label:"圆角",default:0,min:0,step:1,hide:!0}]},line:{width:15,height:.5,rotation:0,lockAspectRatio:!1,x1:0,y1:0,x2:15,y2:0,propertyPanel:[{prop:"LineWidth",type:"select",label:"线宽",default:"0.5",options:[{label:"默认",value:"0.5"},{label:"1px",value:"1"},{label:"2px",value:"2"},{label:"3px",value:"3"},{label:"4px",value:"4"},{label:"5px",value:"5"},{label:"6px",value:"6"},{label:"7px",value:"7"},{label:"8px",value:"8"},{label:"9px",value:"9"},{label:"10px",value:"10"}]},{prop:"LineStyle",type:"select",label:"样式",default:1,options:[{label:"实线",value:1},{label:"虚线",value:2}]}]}}},Symbol.toStringTag,{value:"Module"})),aR=Object.freeze(Object.defineProperty({__proto__:null,default:{text:{x:0,y:0,width:20,height:4.2,rotation:0,Title:"",FieldName:"",Text:"测试文本",FontName:"黑体",FontSize:10,FontColor:"#000000",Bold:0,Italic:0,Underline:0,Alignment:2,TextWrap:1,HOrient:0,VOrient:0,PenWidth:0,PenStyle:0,Stretch:1,PreviewOnly:0,ReadOnly:0,propertyPanel:[{prop:"Title",label:"标题",default:"",layout:"full",desc:"设置文本组件的标题内容,用于显示在组件上"},{prop:"FieldName",label:"字段名称",type:"select",optionsKey:"fields",default:"",layout:"full"},{prop:"Text",label:"测试数据(展示使用,无实际意义)",default:"测试文本",layout:"full"},{prop:"FontName",label:"字体名称",type:"select",desc:"注意:选择的字体需要计算机中安装有对应字体才有效",options:[{label:"黑体",value:"黑体",cssValue:"SimHei"},{label:"楷体",value:"楷体",cssValue:"KaiTi"},{label:"宋体",value:"宋体",cssValue:"SimSun"},{label:"隶书",value:"隶书",cssValue:"LiSu"}],default:"黑体",layout:"half"},{prop:"FontSize",label:"字体大小",type:"number",min:1,max:100,default:10,layout:"half"},{prop:"FontColor",label:"字体颜色",type:"color",hide:!0,default:"#000000",layout:"half"},{prop:"Bold",label:"字体加粗",type:"select",options:[{label:"加粗",value:1},{label:"不加粗",value:0}],default:0,layout:"half"},{prop:"Italic",label:"是否斜体",type:"select",options:[{label:"是",value:1},{label:"否",value:0}],default:0,layout:"half"},{prop:"Alignment",label:"对齐方式",type:"select",options:[{label:"居左",value:1},{label:"居中",value:2},{label:"居右",value:3}],default:2,layout:"half"},{prop:"TextWrap",label:"文本换行",type:"select",options:[{label:"换行",value:1},{label:"不换行",value:2}],default:1,layout:"half"}]},barcode:{x:0,y:0,width:20,height:6,rotation:0,FieldName:"goodsSn",BarcodeValue:"1234567890",CodeType:"128Auto",AlignJustify:0,LineColor:"#000000",propertyPanel:[{prop:"FieldName",label:"字段名称",type:"select",optionsKey:"fields",default:"goods_sn",layout:"full"},{prop:"BarcodeValue",label:"测试数据(展示使用,无实际意义)",type:"text",default:"1234567890"},{prop:"CodeType",label:"条码类型",type:"select",options:[{label:"CODE128",value:"128Auto",compValue:"CODE128"},{label:"CODE39",value:"Code39",compValue:"CODE39"},{label:"EAN13",value:"EAN13",compValue:"EAN13"}],hide:!0,default:"128Auto"},{prop:"AlignJustify",label:"对齐方式",type:"select",options:[{label:"两端对齐",value:0},{label:"左",value:1},{label:"中",value:2},{label:"右",value:3}],hide:!0,default:0},{prop:"LineColor",label:"条形码颜色",type:"color",hide:!0,default:"#000000"}]},qrcode:{x:0,y:0,width:10,height:10,rotation:0,FieldName:"",QRCodeValue:"FB-GOLD",QRCodeVersion:7,QRCodeErrorLevel:"Q",QRCodeEncodeMode:"B",QRCodeForeground:"#000000",QRCodeBackground:"transparent",LockAspectRatio:!0,lockAspectRatio:!0,propertyPanel:[{prop:"FieldName",label:"字段名称",type:"select",optionsKey:"fields",default:"",layout:"full"},{prop:"QRCodeValue",label:"测试数据(展示使用,无实际意义)",type:"text",default:"FB-GOLD"},{prop:"QRCodeVersion",label:"二维码版本",type:"number",min:1,max:40,hide:!0,default:7},{prop:"QRCodeErrorLevel",label:"纠错级别",type:"select",options:[{label:"L (7%)",value:"L"},{label:"M (15%)",value:"M"},{label:"Q (25%)",value:"Q"},{label:"H (30%)",value:"H"}],hide:!0,default:"Q"},{prop:"QRCodeEncodeMode",label:"编码模式",type:"select",options:[{label:"数字",value:"N"},{label:"二进制或汉语",value:"B"},{label:"英文字母",value:"A"}],hide:!0,default:"B"},{prop:"QRCodeForeground",label:"前景色",type:"color",hide:!0,default:"#000000"},{prop:"QRCodeBackground",label:"背景景色",type:"color",hide:!0,default:"transparent"}]},image:{width:12,height:12,rotation:0,lockAspectRatio:!1,propertyPanel:[{prop:"ImageSrc",label:"图片地址",type:"file",accept:"image/*",default:""},{prop:"ScaleMode",label:"图片缩放",type:"select",options:[{label:"原始尺寸",value:1},{label:"居中裁剪",value:2},{label:"填充",value:3}],default:1},{prop:"IsPrint",label:"是否打印",type:"select",options:[{label:"是",value:!0},{label:"否",value:!1}],default:!1}]}}},Symbol.toStringTag,{value:"Module"}));return Jn});
|
|
59
|
+
.`+sl+Sy+Bu)},My=function(e,A){var t=e.ownerDocument;if(t){var r=t.createElement("style");r.textContent=A,e.appendChild(r)}},fu=function(){function e(){}return e.getOrigin=function(A){var t=e._link;return t?(t.href=A,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},e.isSameOrigin=function(A){return e.getOrigin(A)===e._origin},e.setContext=function(A){e._link=A.document.createElement("a"),e._origin=e.getOrigin(A.location.href)},e._origin="about:blank",e}(),Hy=function(){function e(A,t){this.context=A,this._options=t,this._cache={}}return e.prototype.addImage=function(A){var t=Promise.resolve();return this.has(A)||(ul(A)||Oy(A))&&(this._cache[A]=this.loadImage(A)).catch(function(){}),t},e.prototype.match=function(A){return this._cache[A]},e.prototype.loadImage=function(A){return vA(this,void 0,void 0,function(){var t,r,n,a,l=this;return CA(this,function(i){switch(i.label){case 0:return t=fu.isSameOrigin(A),r=!cl(A)&&this._options.useCORS===!0&&FA.SUPPORT_CORS_IMAGES&&!t,n=!cl(A)&&!t&&!ul(A)&&typeof this._options.proxy=="string"&&FA.SUPPORT_CORS_XHR&&!r,!t&&this._options.allowTaint===!1&&!cl(A)&&!ul(A)&&!n&&!r?[2]:(a=A,n?[4,this.proxy(a)]:[3,2]);case 1:a=i.sent(),i.label=2;case 2:return this.context.logger.debug("Added image "+A.substring(0,256)),[4,new Promise(function(s,c){var u=new Image;u.onload=function(){return s(u)},u.onerror=c,(Wy(a)||r)&&(u.crossOrigin="anonymous"),u.src=a,u.complete===!0&&setTimeout(function(){return s(u)},500),l._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+l._options.imageTimeout+"ms) loading image")},l._options.imageTimeout)})];case 3:return[2,i.sent()]}})})},e.prototype.has=function(A){return typeof this._cache[A]<"u"},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(A){var t=this,r=this._options.proxy;if(!r)throw new Error("No proxy defined");var n=A.substring(0,256);return new Promise(function(a,l){var i=FA.SUPPORT_RESPONSE_TYPE?"blob":"text",s=new XMLHttpRequest;s.onload=function(){if(s.status===200)if(i==="text")a(s.response);else{var d=new FileReader;d.addEventListener("load",function(){return a(d.result)},!1),d.addEventListener("error",function(B){return l(B)},!1),d.readAsDataURL(s.response)}else l("Failed to proxy resource "+n+" with status code "+s.status)},s.onerror=l;var c=r.indexOf("?")>-1?"&":"?";if(s.open("GET",""+r+c+"url="+encodeURIComponent(A)+"&responseType="+i),i!=="text"&&s instanceof XMLHttpRequest&&(s.responseType=i),t._options.imageTimeout){var u=t._options.imageTimeout;s.timeout=u,s.ontimeout=function(){return l("Timed out ("+u+"ms) proxying "+n)}}s.send()})},e}(),xy=/^data:image\/svg\+xml/i,ky=/^data:image\/.*;base64,/i,Zy=/^data:image\/.*/i,Oy=function(e){return FA.SUPPORT_SVG_DRAWING||!Dy(e)},cl=function(e){return Zy.test(e)},Wy=function(e){return ky.test(e)},ul=function(e){return e.substr(0,4)==="blob"},Dy=function(e){return e.substr(-3).toLowerCase()==="svg"||xy.test(e)},W=function(){function e(A,t){this.type=0,this.x=A,this.y=t}return e.prototype.add=function(A,t){return new e(this.x+A,this.y+t)},e}(),mt=function(e,A,t){return new W(e.x+(A.x-e.x)*t,e.y+(A.y-e.y)*t)},Hn=function(){function e(A,t,r,n){this.type=1,this.start=A,this.startControl=t,this.endControl=r,this.end=n}return e.prototype.subdivide=function(A,t){var r=mt(this.start,this.startControl,A),n=mt(this.startControl,this.endControl,A),a=mt(this.endControl,this.end,A),l=mt(r,n,A),i=mt(n,a,A),s=mt(l,i,A);return t?new e(this.start,r,l,s):new e(s,i,a,this.end)},e.prototype.add=function(A,t){return new e(this.start.add(A,t),this.startControl.add(A,t),this.endControl.add(A,t),this.end.add(A,t))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),XA=function(e){return e.type===1},Ly=function(){function e(A){var t=A.styles,r=A.bounds,n=or(t.borderTopLeftRadius,r.width,r.height),a=n[0],l=n[1],i=or(t.borderTopRightRadius,r.width,r.height),s=i[0],c=i[1],u=or(t.borderBottomRightRadius,r.width,r.height),d=u[0],B=u[1],U=or(t.borderBottomLeftRadius,r.width,r.height),p=U[0],f=U[1],g=[];g.push((a+s)/r.width),g.push((p+d)/r.width),g.push((l+f)/r.height),g.push((c+B)/r.height);var h=Math.max.apply(Math,g);h>1&&(a/=h,l/=h,s/=h,c/=h,d/=h,B/=h,p/=h,f/=h);var Q=r.width-s,E=r.height-B,C=r.width-d,F=r.height-f,V=t.borderTopWidth,v=t.borderRightWidth,b=t.borderBottomWidth,m=t.borderLeftWidth,N=iA(t.paddingTop,A.bounds.width),R=iA(t.paddingRight,A.bounds.width),M=iA(t.paddingBottom,A.bounds.width),I=iA(t.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=a>0||l>0?uA(r.left+m/3,r.top+V/3,a-m/3,l-V/3,nA.TOP_LEFT):new W(r.left+m/3,r.top+V/3),this.topRightBorderDoubleOuterBox=a>0||l>0?uA(r.left+Q,r.top+V/3,s-v/3,c-V/3,nA.TOP_RIGHT):new W(r.left+r.width-v/3,r.top+V/3),this.bottomRightBorderDoubleOuterBox=d>0||B>0?uA(r.left+C,r.top+E,d-v/3,B-b/3,nA.BOTTOM_RIGHT):new W(r.left+r.width-v/3,r.top+r.height-b/3),this.bottomLeftBorderDoubleOuterBox=p>0||f>0?uA(r.left+m/3,r.top+F,p-m/3,f-b/3,nA.BOTTOM_LEFT):new W(r.left+m/3,r.top+r.height-b/3),this.topLeftBorderDoubleInnerBox=a>0||l>0?uA(r.left+m*2/3,r.top+V*2/3,a-m*2/3,l-V*2/3,nA.TOP_LEFT):new W(r.left+m*2/3,r.top+V*2/3),this.topRightBorderDoubleInnerBox=a>0||l>0?uA(r.left+Q,r.top+V*2/3,s-v*2/3,c-V*2/3,nA.TOP_RIGHT):new W(r.left+r.width-v*2/3,r.top+V*2/3),this.bottomRightBorderDoubleInnerBox=d>0||B>0?uA(r.left+C,r.top+E,d-v*2/3,B-b*2/3,nA.BOTTOM_RIGHT):new W(r.left+r.width-v*2/3,r.top+r.height-b*2/3),this.bottomLeftBorderDoubleInnerBox=p>0||f>0?uA(r.left+m*2/3,r.top+F,p-m*2/3,f-b*2/3,nA.BOTTOM_LEFT):new W(r.left+m*2/3,r.top+r.height-b*2/3),this.topLeftBorderStroke=a>0||l>0?uA(r.left+m/2,r.top+V/2,a-m/2,l-V/2,nA.TOP_LEFT):new W(r.left+m/2,r.top+V/2),this.topRightBorderStroke=a>0||l>0?uA(r.left+Q,r.top+V/2,s-v/2,c-V/2,nA.TOP_RIGHT):new W(r.left+r.width-v/2,r.top+V/2),this.bottomRightBorderStroke=d>0||B>0?uA(r.left+C,r.top+E,d-v/2,B-b/2,nA.BOTTOM_RIGHT):new W(r.left+r.width-v/2,r.top+r.height-b/2),this.bottomLeftBorderStroke=p>0||f>0?uA(r.left+m/2,r.top+F,p-m/2,f-b/2,nA.BOTTOM_LEFT):new W(r.left+m/2,r.top+r.height-b/2),this.topLeftBorderBox=a>0||l>0?uA(r.left,r.top,a,l,nA.TOP_LEFT):new W(r.left,r.top),this.topRightBorderBox=s>0||c>0?uA(r.left+Q,r.top,s,c,nA.TOP_RIGHT):new W(r.left+r.width,r.top),this.bottomRightBorderBox=d>0||B>0?uA(r.left+C,r.top+E,d,B,nA.BOTTOM_RIGHT):new W(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=p>0||f>0?uA(r.left,r.top+F,p,f,nA.BOTTOM_LEFT):new W(r.left,r.top+r.height),this.topLeftPaddingBox=a>0||l>0?uA(r.left+m,r.top+V,Math.max(0,a-m),Math.max(0,l-V),nA.TOP_LEFT):new W(r.left+m,r.top+V),this.topRightPaddingBox=s>0||c>0?uA(r.left+Math.min(Q,r.width-v),r.top+V,Q>r.width+v?0:Math.max(0,s-v),Math.max(0,c-V),nA.TOP_RIGHT):new W(r.left+r.width-v,r.top+V),this.bottomRightPaddingBox=d>0||B>0?uA(r.left+Math.min(C,r.width-m),r.top+Math.min(E,r.height-b),Math.max(0,d-v),Math.max(0,B-b),nA.BOTTOM_RIGHT):new W(r.left+r.width-v,r.top+r.height-b),this.bottomLeftPaddingBox=p>0||f>0?uA(r.left+m,r.top+Math.min(F,r.height-b),Math.max(0,p-m),Math.max(0,f-b),nA.BOTTOM_LEFT):new W(r.left+m,r.top+r.height-b),this.topLeftContentBox=a>0||l>0?uA(r.left+m+I,r.top+V+N,Math.max(0,a-(m+I)),Math.max(0,l-(V+N)),nA.TOP_LEFT):new W(r.left+m+I,r.top+V+N),this.topRightContentBox=s>0||c>0?uA(r.left+Math.min(Q,r.width+m+I),r.top+V+N,Q>r.width+m+I?0:s-m+I,c-(V+N),nA.TOP_RIGHT):new W(r.left+r.width-(v+R),r.top+V+N),this.bottomRightContentBox=d>0||B>0?uA(r.left+Math.min(C,r.width-(m+I)),r.top+Math.min(E,r.height+V+N),Math.max(0,d-(v+R)),B-(b+M),nA.BOTTOM_RIGHT):new W(r.left+r.width-(v+R),r.top+r.height-(b+M)),this.bottomLeftContentBox=p>0||f>0?uA(r.left+m+I,r.top+F,Math.max(0,p-(m+I)),f-(b+M),nA.BOTTOM_LEFT):new W(r.left+m+I,r.top+r.height-(b+M))}return e}(),nA;(function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(nA||(nA={}));var uA=function(e,A,t,r,n){var a=4*((Math.sqrt(2)-1)/3),l=t*a,i=r*a,s=e+t,c=A+r;switch(n){case nA.TOP_LEFT:return new Hn(new W(e,c),new W(e,c-i),new W(s-l,A),new W(s,A));case nA.TOP_RIGHT:return new Hn(new W(e,A),new W(e+l,A),new W(s,c-i),new W(s,c));case nA.BOTTOM_RIGHT:return new Hn(new W(s,A),new W(s,A+i),new W(e+l,c),new W(e,c));case nA.BOTTOM_LEFT:default:return new Hn(new W(s,c),new W(s-l,c),new W(e,A+i),new W(e,A))}},xn=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Jy=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},kn=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Ky=function(){function e(A,t,r){this.offsetX=A,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return e}(),Zn=function(){function e(A,t){this.path=A,this.target=t,this.type=1}return e}(),Gy=function(){function e(A){this.opacity=A,this.type=2,this.target=6}return e}(),Yy=function(e){return e.type===0},hu=function(e){return e.type===1},zy=function(e){return e.type===2},pu=function(e,A){return e.length===A.length?e.some(function(t,r){return t===A[r]}):!1},jy=function(e,A,t,r,n){return e.map(function(a,l){switch(l){case 0:return a.add(A,t);case 1:return a.add(A+r,t);case 2:return a.add(A+r,t+n);case 3:return a.add(A,t+n)}return a})},gu=function(){function e(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),Uu=function(){function e(A,t){if(this.container=A,this.parent=t,this.effects=[],this.curves=new Ly(this.container),this.container.styles.opacity<1&&this.effects.push(new Gy(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,a=this.container.styles.transform;this.effects.push(new Ky(r,n,a))}if(this.container.styles.overflowX!==0){var l=xn(this.curves),i=kn(this.curves);pu(l,i)?this.effects.push(new Zn(l,6)):(this.effects.push(new Zn(l,2)),this.effects.push(new Zn(i,4)))}}return e.prototype.getEffects=function(A){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,n=this.effects.slice(0);r;){var a=r.effects.filter(function(s){return!hu(s)});if(t||r.container.styles.position!==0||!r.parent){if(n.unshift.apply(n,a),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var l=xn(r.curves),i=kn(r.curves);pu(l,i)||n.unshift(new Zn(i,6))}}else n.unshift.apply(n,a);r=r.parent}return n.filter(function(s){return gA(s.target,A)})},e}(),dl=function(e,A,t,r){e.container.elements.forEach(function(n){var a=gA(n.flags,4),l=gA(n.flags,2),i=new Uu(n,e);gA(n.styles.display,2048)&&r.push(i);var s=gA(n.flags,8)?[]:r;if(a||l){var c=a||n.styles.isPositioned()?t:A,u=new gu(i);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var d=n.styles.zIndex.order;if(d<0){var B=0;c.negativeZIndex.some(function(p,f){return d>p.element.container.styles.zIndex.order?(B=f,!1):B>0}),c.negativeZIndex.splice(B,0,u)}else if(d>0){var U=0;c.positiveZIndex.some(function(p,f){return d>=p.element.container.styles.zIndex.order?(U=f+1,!1):U>0}),c.positiveZIndex.splice(U,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else n.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);dl(i,u,a?u:t,s)}else n.styles.isInlineLevel()?A.inlineLevel.push(i):A.nonInlineLevel.push(i),dl(i,A,t,s);gA(n.flags,8)&&Qu(n,s)})},Qu=function(e,A){for(var t=e instanceof el?e.start:1,r=e instanceof el?e.reversed:!1,n=0;n<A.length;n++){var a=A[n];a.container instanceof Kc&&typeof a.container.value=="number"&&a.container.value!==0&&(t=a.container.value),a.listValue=ur(t,a.container.styles.listStyleType,!0),t+=r?-1:1}},Xy=function(e){var A=new Uu(e,null),t=new gu(A),r=[];return dl(A,t,t,r),Qu(A.container,r),t},wu=function(e,A){switch(A){case 0:return PA(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return PA(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return PA(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);case 3:default:return PA(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},Py=function(e,A){switch(A){case 0:return PA(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return PA(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return PA(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);case 3:default:return PA(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},_y=function(e,A){switch(A){case 0:return PA(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return PA(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return PA(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);case 3:default:return PA(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},qy=function(e,A){switch(A){case 0:return On(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return On(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return On(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);case 3:default:return On(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},On=function(e,A){var t=[];return XA(e)?t.push(e.subdivide(.5,!1)):t.push(e),XA(A)?t.push(A.subdivide(.5,!0)):t.push(A),t},PA=function(e,A,t,r){var n=[];return XA(e)?n.push(e.subdivide(.5,!1)):n.push(e),XA(t)?n.push(t.subdivide(.5,!0)):n.push(t),XA(r)?n.push(r.subdivide(.5,!0).reverse()):n.push(r),XA(A)?n.push(A.subdivide(.5,!1).reverse()):n.push(A),n},mu=function(e){var A=e.bounds,t=e.styles;return A.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},Wn=function(e){var A=e.styles,t=e.bounds,r=iA(A.paddingLeft,t.width),n=iA(A.paddingRight,t.width),a=iA(A.paddingTop,t.width),l=iA(A.paddingBottom,t.width);return t.add(r+A.borderLeftWidth,a+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+r+n),-(A.borderTopWidth+A.borderBottomWidth+a+l))},$y=function(e,A){return e===0?A.bounds:e===2?Wn(A):mu(A)},AV=function(e,A){return e===0?A.bounds:e===2?Wn(A):mu(A)},Bl=function(e,A,t){var r=$y(Ft(e.styles.backgroundOrigin,A),e),n=AV(Ft(e.styles.backgroundClip,A),e),a=eV(Ft(e.styles.backgroundSize,A),t,r),l=a[0],i=a[1],s=or(Ft(e.styles.backgroundPosition,A),r.width-l,r.height-i),c=tV(Ft(e.styles.backgroundRepeat,A),s,a,r,n),u=Math.round(r.left+s[0]),d=Math.round(r.top+s[1]);return[c,u,d,l,i]},Et=function(e){return aA(e)&&e.value===gt.AUTO},Dn=function(e){return typeof e=="number"},eV=function(e,A,t){var r=A[0],n=A[1],a=A[2],l=e[0],i=e[1];if(!l)return[0,0];if(pA(l)&&i&&pA(i))return[iA(l,t.width),iA(i,t.height)];var s=Dn(a);if(aA(l)&&(l.value===gt.CONTAIN||l.value===gt.COVER)){if(Dn(a)){var c=t.width/t.height;return c<a!=(l.value===gt.COVER)?[t.width,t.width/a]:[t.height*a,t.height]}return[t.width,t.height]}var u=Dn(r),d=Dn(n),B=u||d;if(Et(l)&&(!i||Et(i))){if(u&&d)return[r,n];if(!s&&!B)return[t.width,t.height];if(B&&s){var U=u?r:n*a,p=d?n:r/a;return[U,p]}var f=u?r:t.width,g=d?n:t.height;return[f,g]}if(s){var h=0,Q=0;return pA(l)?h=iA(l,t.width):pA(i)&&(Q=iA(i,t.height)),Et(l)?h=Q*a:(!i||Et(i))&&(Q=h/a),[h,Q]}var E=null,C=null;if(pA(l)?E=iA(l,t.width):i&&pA(i)&&(C=iA(i,t.height)),E!==null&&(!i||Et(i))&&(C=u&&d?E/r*n:t.height),C!==null&&Et(l)&&(E=u&&d?C/n*r:t.width),E!==null&&C!==null)return[E,C];throw new Error("Unable to calculate background-size for element")},Ft=function(e,A){var t=e[A];return typeof t>"u"?e[0]:t},tV=function(e,A,t,r,n){var a=A[0],l=A[1],i=t[0],s=t[1];switch(e){case 2:return[new W(Math.round(r.left),Math.round(r.top+l)),new W(Math.round(r.left+r.width),Math.round(r.top+l)),new W(Math.round(r.left+r.width),Math.round(s+r.top+l)),new W(Math.round(r.left),Math.round(s+r.top+l))];case 3:return[new W(Math.round(r.left+a),Math.round(r.top)),new W(Math.round(r.left+a+i),Math.round(r.top)),new W(Math.round(r.left+a+i),Math.round(r.height+r.top)),new W(Math.round(r.left+a),Math.round(r.height+r.top))];case 1:return[new W(Math.round(r.left+a),Math.round(r.top+l)),new W(Math.round(r.left+a+i),Math.round(r.top+l)),new W(Math.round(r.left+a+i),Math.round(r.top+l+s)),new W(Math.round(r.left+a),Math.round(r.top+l+s))];default:return[new W(Math.round(n.left),Math.round(n.top)),new W(Math.round(n.left+n.width),Math.round(n.top)),new W(Math.round(n.left+n.width),Math.round(n.height+n.top)),new W(Math.round(n.left),Math.round(n.height+n.top))]}},rV="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Eu="Hidden Text",nV=function(){function e(A){this._data={},this._document=A}return e.prototype.parseMetrics=function(A,t){var r=this._document.createElement("div"),n=this._document.createElement("img"),a=this._document.createElement("span"),l=this._document.body;r.style.visibility="hidden",r.style.fontFamily=A,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",l.appendChild(r),n.src=rV,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",a.style.fontFamily=A,a.style.fontSize=t,a.style.margin="0",a.style.padding="0",a.appendChild(this._document.createTextNode(Eu)),r.appendChild(a),r.appendChild(n);var i=n.offsetTop-a.offsetTop+2;r.removeChild(a),r.appendChild(this._document.createTextNode(Eu)),r.style.lineHeight="normal",n.style.verticalAlign="super";var s=n.offsetTop-r.offsetTop+2;return l.removeChild(r),{baseline:i,middle:s}},e.prototype.getMetrics=function(A,t){var r=A+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(A,t)),this._data[r]},e}(),Fu=function(){function e(A,t){this.context=A,this.options=t}return e}(),oV=1e4,aV=function(e){ee(A,e);function A(t,r){var n=e.call(this,t,r)||this;return n._activeEffects=[],n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),r.canvas||(n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px"),n.fontMetrics=new nV(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),n}return A.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(n){return r.applyEffect(n)})},A.prototype.applyEffect=function(t){this.ctx.save(),zy(t)&&(this.ctx.globalAlpha=t.opacity),Yy(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),hu(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},A.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},A.prototype.renderStack=function(t){return vA(this,void 0,void 0,function(){var r;return CA(this,function(n){switch(n.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},A.prototype.renderNode=function(t){return vA(this,void 0,void 0,function(){return CA(this,function(r){switch(r.label){case 0:if(gA(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},A.prototype.renderTextWithLetterSpacing=function(t,r,n){var a=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+n);else{var l=Al(t.text);l.reduce(function(i,s){return a.ctx.fillText(s,i,t.bounds.top+n),i+a.ctx.measureText(s).width},t.bounds.left)}},A.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(l){return l==="normal"||l==="small-caps"}).join(""),n=uV(t.fontFamily).join(", "),a=nr(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,a,n].join(" "),n,a]},A.prototype.renderTextNode=function(t,r){return vA(this,void 0,void 0,function(){var n,a,l,i,s,c,u,d,B=this;return CA(this,function(U){return n=this.createFontStyle(r),a=n[0],l=n[1],i=n[2],this.ctx.font=a,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",s=this.fontMetrics.getMetrics(l,i),c=s.baseline,u=s.middle,d=r.paintOrder,t.textBounds.forEach(function(p){d.forEach(function(f){switch(f){case 0:B.ctx.fillStyle=wA(r.color),B.renderTextWithLetterSpacing(p,r.letterSpacing,c);var g=r.textShadow;g.length&&p.text.trim().length&&(g.slice(0).reverse().forEach(function(h){B.ctx.shadowColor=wA(h.color),B.ctx.shadowOffsetX=h.offsetX.number*B.options.scale,B.ctx.shadowOffsetY=h.offsetY.number*B.options.scale,B.ctx.shadowBlur=h.blur.number,B.renderTextWithLetterSpacing(p,r.letterSpacing,c)}),B.ctx.shadowColor="",B.ctx.shadowOffsetX=0,B.ctx.shadowOffsetY=0,B.ctx.shadowBlur=0),r.textDecorationLine.length&&(B.ctx.fillStyle=wA(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(h){switch(h){case 1:B.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top+c),p.bounds.width,1);break;case 2:B.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top),p.bounds.width,1);break;case 3:B.ctx.fillRect(p.bounds.left,Math.ceil(p.bounds.top+u),p.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&p.text.trim().length&&(B.ctx.strokeStyle=wA(r.webkitTextStrokeColor),B.ctx.lineWidth=r.webkitTextStrokeWidth,B.ctx.lineJoin=window.chrome?"miter":"round",B.ctx.strokeText(p.text,p.bounds.left,p.bounds.top+c)),B.ctx.strokeStyle="",B.ctx.lineWidth=0,B.ctx.lineJoin="miter";break}})}),[2]})})},A.prototype.renderReplacedElement=function(t,r,n){if(n&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var a=Wn(t),l=kn(r);this.path(l),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,t.intrinsicWidth,t.intrinsicHeight,a.left,a.top,a.width,a.height),this.ctx.restore()}},A.prototype.renderNodeContent=function(t){return vA(this,void 0,void 0,function(){var r,n,a,l,i,s,Q,Q,c,u,d,B,C,U,p,F,f,g,h,Q,E,C,F;return CA(this,function(V){switch(V.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,n=t.curves,a=r.styles,l=0,i=r.textNodes,V.label=1;case 1:return l<i.length?(s=i[l],[4,this.renderTextNode(s,a)]):[3,4];case 2:V.sent(),V.label=3;case 3:return l++,[3,1];case 4:if(!(r instanceof Dc))return[3,8];V.label=5;case 5:return V.trys.push([5,7,,8]),[4,this.context.cache.match(r.src)];case 6:return Q=V.sent(),this.renderReplacedElement(r,n,Q),[3,8];case 7:return V.sent(),this.context.logger.error("Error loading image "+r.src),[3,8];case 8:if(r instanceof Lc&&this.renderReplacedElement(r,n,r.canvas),!(r instanceof Jc))return[3,12];V.label=9;case 9:return V.trys.push([9,11,,12]),[4,this.context.cache.match(r.svg)];case 10:return Q=V.sent(),this.renderReplacedElement(r,n,Q),[3,12];case 11:return V.sent(),this.context.logger.error("Error loading svg "+r.svg.substring(0,255)),[3,12];case 12:return r instanceof jc&&r.tree?(c=new A(this.context,{scale:this.options.scale,backgroundColor:r.backgroundColor,x:0,y:0,width:r.width,height:r.height}),[4,c.render(r.tree)]):[3,14];case 13:u=V.sent(),r.width&&r.height&&this.ctx.drawImage(u,0,0,r.width,r.height,r.bounds.left,r.bounds.top,r.bounds.width,r.bounds.height),V.label=14;case 14:if(r instanceof tl&&(d=Math.min(r.bounds.width,r.bounds.height),r.type===Nn?r.checked&&(this.ctx.save(),this.path([new W(r.bounds.left+d*.39363,r.bounds.top+d*.79),new W(r.bounds.left+d*.16,r.bounds.top+d*.5549),new W(r.bounds.left+d*.27347,r.bounds.top+d*.44071),new W(r.bounds.left+d*.39694,r.bounds.top+d*.5649),new W(r.bounds.left+d*.72983,r.bounds.top+d*.23),new W(r.bounds.left+d*.84,r.bounds.top+d*.34085),new W(r.bounds.left+d*.39363,r.bounds.top+d*.79)]),this.ctx.fillStyle=wA(Gc),this.ctx.fill(),this.ctx.restore()):r.type===vn&&r.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(r.bounds.left+d/2,r.bounds.top+d/2,d/4,0,Math.PI*2,!0),this.ctx.fillStyle=wA(Gc),this.ctx.fill(),this.ctx.restore())),lV(r)&&r.value.length){switch(B=this.createFontStyle(a),C=B[0],U=B[1],p=this.fontMetrics.getMetrics(C,U).baseline,this.ctx.font=C,this.ctx.fillStyle=wA(a.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=sV(r.styles.textAlign),F=Wn(r),f=0,r.styles.textAlign){case 1:f+=F.width/2;break;case 2:f+=F.width;break}g=F.add(f,0,0,-F.height/2+1),this.ctx.save(),this.path([new W(F.left,F.top),new W(F.left+F.width,F.top),new W(F.left+F.width,F.top+F.height),new W(F.left,F.top+F.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new sr(r.value,g),a.letterSpacing,p),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!gA(r.styles.display,2048))return[3,20];if(r.styles.listStyleImage===null)return[3,19];if(h=r.styles.listStyleImage,h.type!==0)return[3,18];Q=void 0,E=h.url,V.label=15;case 15:return V.trys.push([15,17,,18]),[4,this.context.cache.match(E)];case 16:return Q=V.sent(),this.ctx.drawImage(Q,r.bounds.left-(Q.width+10),r.bounds.top),[3,18];case 17:return V.sent(),this.context.logger.error("Error loading list-style-image "+E),[3,18];case 18:return[3,20];case 19:t.listValue&&r.styles.listStyleType!==-1&&(C=this.createFontStyle(a)[0],this.ctx.font=C,this.ctx.fillStyle=wA(a.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",F=new ue(r.bounds.left,r.bounds.top+iA(r.styles.paddingTop,r.bounds.width),r.bounds.width,Ec(a.lineHeight,a.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new sr(t.listValue,F),a.letterSpacing,Ec(a.lineHeight,a.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),V.label=20;case 20:return[2]}})})},A.prototype.renderStackContent=function(t){return vA(this,void 0,void 0,function(){var r,n,h,a,l,h,i,s,h,c,u,h,d,B,h,U,p,h,f,g,h;return CA(this,function(Q){switch(Q.label){case 0:if(gA(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:Q.sent(),r=0,n=t.negativeZIndex,Q.label=2;case 2:return r<n.length?(h=n[r],[4,this.renderStack(h)]):[3,5];case 3:Q.sent(),Q.label=4;case 4:return r++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:Q.sent(),a=0,l=t.nonInlineLevel,Q.label=7;case 7:return a<l.length?(h=l[a],[4,this.renderNode(h)]):[3,10];case 8:Q.sent(),Q.label=9;case 9:return a++,[3,7];case 10:i=0,s=t.nonPositionedFloats,Q.label=11;case 11:return i<s.length?(h=s[i],[4,this.renderStack(h)]):[3,14];case 12:Q.sent(),Q.label=13;case 13:return i++,[3,11];case 14:c=0,u=t.nonPositionedInlineLevel,Q.label=15;case 15:return c<u.length?(h=u[c],[4,this.renderStack(h)]):[3,18];case 16:Q.sent(),Q.label=17;case 17:return c++,[3,15];case 18:d=0,B=t.inlineLevel,Q.label=19;case 19:return d<B.length?(h=B[d],[4,this.renderNode(h)]):[3,22];case 20:Q.sent(),Q.label=21;case 21:return d++,[3,19];case 22:U=0,p=t.zeroOrAutoZIndexOrTransformedOrOpacity,Q.label=23;case 23:return U<p.length?(h=p[U],[4,this.renderStack(h)]):[3,26];case 24:Q.sent(),Q.label=25;case 25:return U++,[3,23];case 26:f=0,g=t.positiveZIndex,Q.label=27;case 27:return f<g.length?(h=g[f],[4,this.renderStack(h)]):[3,30];case 28:Q.sent(),Q.label=29;case 29:return f++,[3,27];case 30:return[2]}})})},A.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},A.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},A.prototype.formatPath=function(t){var r=this;t.forEach(function(n,a){var l=XA(n)?n.start:n;a===0?r.ctx.moveTo(l.x,l.y):r.ctx.lineTo(l.x,l.y),XA(n)&&r.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},A.prototype.renderRepeat=function(t,r,n,a){this.path(t),this.ctx.fillStyle=r,this.ctx.translate(n,a),this.ctx.fill(),this.ctx.translate(-n,-a)},A.prototype.resizeImage=function(t,r,n){var a;if(t.width===r&&t.height===n)return t;var l=(a=this.canvas.ownerDocument)!==null&&a!==void 0?a:document,i=l.createElement("canvas");i.width=Math.max(1,r),i.height=Math.max(1,n);var s=i.getContext("2d");return s.drawImage(t,0,0,t.width,t.height,0,0,r,n),i},A.prototype.renderBackgroundImage=function(t){return vA(this,void 0,void 0,function(){var r,n,a,l,i,s;return CA(this,function(c){switch(c.label){case 0:r=t.styles.backgroundImage.length-1,n=function(u){var d,B,U,N,S,Y,I,O,b,p,N,S,Y,I,O,f,g,h,Q,E,C,F,V,v,b,m,N,R,M,I,O,P,S,Y,z,$,J,Z,x,j,eA,oA;return CA(this,function(lA){switch(lA.label){case 0:if(u.type!==0)return[3,5];d=void 0,B=u.url,lA.label=1;case 1:return lA.trys.push([1,3,,4]),[4,a.context.cache.match(B)];case 2:return d=lA.sent(),[3,4];case 3:return lA.sent(),a.context.logger.error("Error loading background-image "+B),[3,4];case 4:return d&&(U=Bl(t,r,[d.width,d.height,d.width/d.height]),N=U[0],S=U[1],Y=U[2],I=U[3],O=U[4],b=a.ctx.createPattern(a.resizeImage(d,I,O),"repeat"),a.renderRepeat(N,b,S,Y)),[3,6];case 5:YE(u)?(p=Bl(t,r,[null,null,null]),N=p[0],S=p[1],Y=p[2],I=p[3],O=p[4],f=DE(u.angle,I,O),g=f[0],h=f[1],Q=f[2],E=f[3],C=f[4],F=document.createElement("canvas"),F.width=I,F.height=O,V=F.getContext("2d"),v=V.createLinearGradient(h,E,Q,C),uc(u.stops,g).forEach(function(tA){return v.addColorStop(tA.stop,wA(tA.color))}),V.fillStyle=v,V.fillRect(0,0,I,O),I>0&&O>0&&(b=a.ctx.createPattern(F,"repeat"),a.renderRepeat(N,b,S,Y))):zE(u)&&(m=Bl(t,r,[null,null,null]),N=m[0],R=m[1],M=m[2],I=m[3],O=m[4],P=u.position.length===0?[Oa]:u.position,S=iA(P[0],I),Y=iA(P[P.length-1],O),z=LE(u,S,Y,I,O),$=z[0],J=z[1],$>0&&J>0&&(Z=a.ctx.createRadialGradient(R+S,M+Y,0,R+S,M+Y,$),uc(u.stops,$*2).forEach(function(tA){return Z.addColorStop(tA.stop,wA(tA.color))}),a.path(N),a.ctx.fillStyle=Z,$!==J?(x=t.bounds.left+.5*t.bounds.width,j=t.bounds.top+.5*t.bounds.height,eA=J/$,oA=1/eA,a.ctx.save(),a.ctx.translate(x,j),a.ctx.transform(1,0,0,eA,0,0),a.ctx.translate(-x,-j),a.ctx.fillRect(R,oA*(M-j)+j,I,O*oA),a.ctx.restore()):a.ctx.fill())),lA.label=6;case 6:return r--,[2]}})},a=this,l=0,i=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return l<i.length?(s=i[l],[5,n(s)]):[3,4];case 2:c.sent(),c.label=3;case 3:return l++,[3,1];case 4:return[2]}})})},A.prototype.renderSolidBorder=function(t,r,n){return vA(this,void 0,void 0,function(){return CA(this,function(a){return this.path(wu(n,r)),this.ctx.fillStyle=wA(t),this.ctx.fill(),[2]})})},A.prototype.renderDoubleBorder=function(t,r,n,a){return vA(this,void 0,void 0,function(){var l,i;return CA(this,function(s){switch(s.label){case 0:return r<3?[4,this.renderSolidBorder(t,n,a)]:[3,2];case 1:return s.sent(),[2];case 2:return l=Py(a,n),this.path(l),this.ctx.fillStyle=wA(t),this.ctx.fill(),i=_y(a,n),this.path(i),this.ctx.fill(),[2]}})})},A.prototype.renderNodeBackgroundAndBorders=function(t){return vA(this,void 0,void 0,function(){var r,n,a,l,i,s,c,u,d=this;return CA(this,function(B){switch(B.label){case 0:return this.applyEffects(t.getEffects(2)),r=t.container.styles,n=!Ve(r.backgroundColor)||r.backgroundImage.length,a=[{style:r.borderTopStyle,color:r.borderTopColor,width:r.borderTopWidth},{style:r.borderRightStyle,color:r.borderRightColor,width:r.borderRightWidth},{style:r.borderBottomStyle,color:r.borderBottomColor,width:r.borderBottomWidth},{style:r.borderLeftStyle,color:r.borderLeftColor,width:r.borderLeftWidth}],l=iV(Ft(r.backgroundClip,0),t.curves),n||r.boxShadow.length?(this.ctx.save(),this.path(l),this.ctx.clip(),Ve(r.backgroundColor)||(this.ctx.fillStyle=wA(r.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:B.sent(),this.ctx.restore(),r.boxShadow.slice(0).reverse().forEach(function(U){d.ctx.save();var p=xn(t.curves),f=U.inset?0:oV,g=jy(p,-f+(U.inset?1:-1)*U.spread.number,(U.inset?1:-1)*U.spread.number,U.spread.number*(U.inset?-2:2),U.spread.number*(U.inset?-2:2));U.inset?(d.path(p),d.ctx.clip(),d.mask(g)):(d.mask(p),d.ctx.clip(),d.path(g)),d.ctx.shadowOffsetX=U.offsetX.number+f,d.ctx.shadowOffsetY=U.offsetY.number,d.ctx.shadowColor=wA(U.color),d.ctx.shadowBlur=U.blur.number,d.ctx.fillStyle=U.inset?wA(U.color):"rgba(0,0,0,1)",d.ctx.fill(),d.ctx.restore()}),B.label=2;case 2:i=0,s=0,c=a,B.label=3;case 3:return s<c.length?(u=c[s],u.style!==0&&!Ve(u.color)&&u.width>0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,i,t.curves,2)]:[3,11]):[3,13];case 4:return B.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,i,t.curves,3)];case 6:return B.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,i,t.curves)];case 8:return B.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,i,t.curves)];case 10:B.sent(),B.label=11;case 11:i++,B.label=12;case 12:return s++,[3,3];case 13:return[2]}})})},A.prototype.renderDashedDottedBorder=function(t,r,n,a,l){return vA(this,void 0,void 0,function(){var i,s,c,u,d,B,U,p,f,g,h,Q,E,C,F,V,F,V;return CA(this,function(v){return this.ctx.save(),i=qy(a,n),s=wu(a,n),l===2&&(this.path(s),this.ctx.clip()),XA(s[0])?(c=s[0].start.x,u=s[0].start.y):(c=s[0].x,u=s[0].y),XA(s[1])?(d=s[1].end.x,B=s[1].end.y):(d=s[1].x,B=s[1].y),n===0||n===2?U=Math.abs(c-d):U=Math.abs(u-B),this.ctx.beginPath(),l===3?this.formatPath(i):this.formatPath(s.slice(0,2)),p=r<3?r*3:r*2,f=r<3?r*2:r,l===3&&(p=r,f=r),g=!0,U<=p*2?g=!1:U<=p*2+f?(h=U/(2*p+f),p*=h,f*=h):(Q=Math.floor((U+f)/(p+f)),E=(U-Q*p)/(Q-1),C=(U-(Q+1)*p)/Q,f=C<=0||Math.abs(f-E)<Math.abs(f-C)?E:C),g&&(l===3?this.ctx.setLineDash([0,p+f]):this.ctx.setLineDash([p,f])),l===3?(this.ctx.lineCap="round",this.ctx.lineWidth=r):this.ctx.lineWidth=r*2+1.1,this.ctx.strokeStyle=wA(t),this.ctx.stroke(),this.ctx.setLineDash([]),l===2&&(XA(s[0])&&(F=s[3],V=s[0],this.ctx.beginPath(),this.formatPath([new W(F.end.x,F.end.y),new W(V.start.x,V.start.y)]),this.ctx.stroke()),XA(s[1])&&(F=s[1],V=s[2],this.ctx.beginPath(),this.formatPath([new W(F.end.x,F.end.y),new W(V.start.x,V.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},A.prototype.render=function(t){return vA(this,void 0,void 0,function(){var r;return CA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=wA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),r=Xy(t),[4,this.renderStack(r)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},A}(Fu),lV=function(e){return e instanceof zc||e instanceof Yc?!0:e instanceof tl&&e.type!==vn&&e.type!==Nn},iV=function(e,A){switch(e){case 0:return xn(A);case 2:return Jy(A);case 1:default:return kn(A)}},sV=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},cV=["-apple-system","system-ui"],uV=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(A){return cV.indexOf(A)===-1}):e},dV=function(e){ee(A,e);function A(t,r){var n=e.call(this,t,r)||this;return n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=r,n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+r.width+"x"+r.height+" at "+r.x+","+r.y+") with scale "+r.scale),n}return A.prototype.render=function(t){return vA(this,void 0,void 0,function(){var r,n;return CA(this,function(a){switch(a.label){case 0:return r=$a(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,BV(r)];case 1:return n=a.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=wA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},A}(Fu),BV=function(e){return new Promise(function(A,t){var r=new Image;r.onload=function(){A(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},fV=function(){function e(A){var t=A.id,r=A.enabled;this.id=t,this.enabled=r,this.start=Date.now()}return e.prototype.debug=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,jr([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},e.prototype.getTime=function(){return Date.now()-this.start},e.prototype.info=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,jr([this.id,this.getTime()+"ms"],A))},e.prototype.warn=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,jr([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},e.prototype.error=function(){for(var A=[],t=0;t<arguments.length;t++)A[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,jr([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},e.instances={},e}(),hV=function(){function e(A,t){var r;this.windowBounds=t,this.instanceName="#"+e.instanceCount++,this.logger=new fV({id:this.instanceName,enabled:A.logging}),this.cache=(r=A.cache)!==null&&r!==void 0?r:new Hy(this,A)}return e.instanceCount=1,e}(),pV=function(e,A){return A===void 0&&(A={}),gV(e,A)};typeof window<"u"&&fu.setContext(window);var gV=function(e,A){return vA(void 0,void 0,void 0,function(){var t,r,n,a,l,i,s,c,u,d,B,U,p,f,g,h,Q,E,C,F,v,V,v,b,m,N,R,M,I,O,P,S,Y,z,$,J,Z,x,j,eA;return CA(this,function(oA){switch(oA.label){case 0:if(!e||typeof e!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=e.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(r=t.defaultView,!r)throw new Error("Document is not attached to a Window");return n={allowTaint:(b=A.allowTaint)!==null&&b!==void 0?b:!1,imageTimeout:(m=A.imageTimeout)!==null&&m!==void 0?m:15e3,proxy:A.proxy,useCORS:(N=A.useCORS)!==null&&N!==void 0?N:!1},a=Ua({logging:(R=A.logging)!==null&&R!==void 0?R:!0,cache:A.cache},n),l={windowWidth:(M=A.windowWidth)!==null&&M!==void 0?M:r.innerWidth,windowHeight:(I=A.windowHeight)!==null&&I!==void 0?I:r.innerHeight,scrollX:(O=A.scrollX)!==null&&O!==void 0?O:r.pageXOffset,scrollY:(P=A.scrollY)!==null&&P!==void 0?P:r.pageYOffset},i=new ue(l.scrollX,l.scrollY,l.windowWidth,l.windowHeight),s=new hV(a,i),c=(S=A.foreignObjectRendering)!==null&&S!==void 0?S:!1,u={allowTaint:(Y=A.allowTaint)!==null&&Y!==void 0?Y:!1,onclone:A.onclone,ignoreElements:A.ignoreElements,inlineImages:c,copyStyles:c},s.logger.debug("Starting document clone with size "+i.width+"x"+i.height+" scrolled to "+-i.left+","+-i.top),d=new du(s,e,u),B=d.clonedReferenceElement,B?[4,d.toIFrame(t,i)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return U=oA.sent(),p=nl(B)||Uy(B)?jw(B.ownerDocument):Xr(s,B),f=p.width,g=p.height,h=p.left,Q=p.top,E=UV(s,B,A.backgroundColor),C={canvas:A.canvas,backgroundColor:E,scale:($=(z=A.scale)!==null&&z!==void 0?z:r.devicePixelRatio)!==null&&$!==void 0?$:1,x:((J=A.x)!==null&&J!==void 0?J:0)+h,y:((Z=A.y)!==null&&Z!==void 0?Z:0)+Q,width:(x=A.width)!==null&&x!==void 0?x:Math.ceil(f),height:(j=A.height)!==null&&j!==void 0?j:Math.ceil(g)},c?(s.logger.debug("Document cloned, using foreign object rendering"),v=new dV(s,C),[4,v.render(B)]):[3,3];case 2:return F=oA.sent(),[3,5];case 3:return s.logger.debug("Document cloned, element located at "+h+","+Q+" with size "+f+"x"+g+" using computed rendering"),s.logger.debug("Starting DOM parsing"),V=Pc(s,B),E===V.styles.backgroundColor&&(V.styles.backgroundColor=Be.TRANSPARENT),s.logger.debug("Starting renderer for element at "+C.x+","+C.y+" with size "+C.width+"x"+C.height),v=new aV(s,C),[4,v.render(V)];case 4:F=oA.sent(),oA.label=5;case 5:return(!((eA=A.removeContainer)!==null&&eA!==void 0)||eA)&&(du.destroy(U)||s.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),s.logger.debug("Finished rendering"),[2,F]}})})},UV=function(e,A,t){var r=A.ownerDocument,n=r.documentElement?ar(e,getComputedStyle(r.documentElement).backgroundColor):Be.TRANSPARENT,a=r.body?ar(e,getComputedStyle(r.body).backgroundColor):Be.TRANSPARENT,l=typeof t=="string"?ar(e,t):t===null?Be.TRANSPARENT:4294967295;return A===r.documentElement?Ve(n)?Ve(a)?l:a:n:l};const OR="",QV={class:"label-designer"},wV={class:"toolbar"},mV={class:"center-container"},EV={key:0,class:"loader-container"},FV={class:"center-toolbar"},CV={class:"zoom-controls"},yV=["disabled"],VV=["disabled"],RV={class:"canvas-container"},TV={class:"ruler-horizontal"},NV={class:"ruler-vertical"},vV={key:0,class:"drag-extend-lines"},IV={key:1,class:"alignment-guides"},SV=["data-item-id","onMousedown"],bV=["onMousedown"],MV=["onMousedown"],HV=["onMousedown"],xV=["onMousedown"],kV=["onMousedown"],ZV=["onMousedown"],OV=["onMousedown"],WV=["onMousedown"],DV=["onMousedown"],LV=["onClick"],JV={class:"property-panel",tabindex:"0"},KV={class:"position-controls"},GV={class:"control-group"},YV={class:"number-input"},zV=["value"],jV={class:"control-group"},XV={class:"number-input"},PV=["value"],_V={key:0,class:"control-group"},qV={class:"number-input"},$V={key:1,class:"control-group"},AR={class:"number-input"},eR={class:"control-group"},tR={class:"number-input"},rR={key:2,class:"control-group"},nR={class:"switch-input"},Ln=.05,oR=QA({__name:"panels",props:{templateInfo:{type:Object,default:()=>({graphData:{},width:0,height:0,printWidth:0,printHeight:0,items:[]})},options:{type:Object,default:()=>({})},showGraphConfig:{type:Boolean,default:!1},templateType:{type:String,default:"lodop"},config:{type:Object,default:()=>({})}},setup(e,{expose:A}){const t=e,r=o.ref({}),n=o.ref(0),a=o.ref(!0),l=o.ref([]),i=o.ref(1);let s=1;const c=o.computed(()=>{var y;return((y=r.value)==null?void 0:y.printWidth)||0}),u=o.computed(()=>{var y;return((y=r.value)==null?void 0:y.printHeight)||0});o.ref(!1);const d=o.ref(!1),B=o.ref(!1),U=new Ze(BA.CACHE.STYLE_CACHE_SIZE),p=new Ze(BA.CACHE.BOUNDING_BOX_CACHE_SIZE),f=new Map(Qs.map(y=>[y.type,y])),{selectedItems:g,selectItem:h,getCurrentSelected:Q,clearSelection:E}=Ww(),{dragging:C,dragItem:F,startDrag:V}=Zw({scale:i,canvasWidth:c,canvasHeight:u,selectItem:h,onStartDrag:()=>{d.value=!0,o.nextTick(()=>{I()})},onStopDrag:()=>{d.value=!1,o.nextTick(()=>{B.value=!1}),O()},onDragUpdate:()=>{I()}}),{startResize:v,resizing:b,resizeDirection:m,resizeItem:N}=Ow(c,u,i,g),{alignmentGuides:R,showGuides:M,updateAlignmentGuides:I,clearAlignmentGuides:O}=Gw({items:l,dragItem:F,resizeItem:N,dragging:C,resizing:b,resizeDirection:m,canvasWidth:c,canvasHeight:u}),{startRotate:P}=Dw();o.watch(()=>g.value,()=>{U.clear()},{deep:!0}),o.watch(()=>b.value,y=>{y?I():O()}),o.watch(()=>{var y;return(y=N.value)==null?void 0:y.props},()=>{b.value&&I()},{deep:!0}),o.watch(()=>F.value,()=>{(C.value||b.value)&&I()}),o.watch(()=>N.value,()=>{(C.value||b.value)&&I()}),o.watch(()=>l.value,()=>{(C.value||b.value)&&I()},{deep:!0});const S=y=>{const w=`${y.id}_${H(y.props.x,1)}_${H(y.props.y,1)}_${y.props.width}_${y.props.height}_${y.props.rotation}`;if(p.has(w))return p.get(w);const X=(y.props.rotation||0)*Math.PI/180,rA=[{x:0,y:0},{x:y.props.width,y:0},{x:y.props.width,y:y.props.height},{x:0,y:y.props.height}],K=y.props.width/2,_=y.props.height/2,G=rA.map(T=>{const D=T.x-K,q=T.y-_,dA=D*Math.cos(X)-q*Math.sin(X),sA=D*Math.sin(X)+q*Math.cos(X);return{x:H(dA+K+y.props.x,3),y:H(sA+_+y.props.y,3)}});return p.set(w,G),G},Y=y=>{const w=S(y),k=w.map(D=>D.x),X=w.map(D=>D.y),rA=H(Math.min(...k),3),K=H(Math.max(...k),3),_=H(Math.min(...X),3),G=H(Math.max(...X),3);return{minX:rA,maxX:K,minY:_,maxY:G,width:H(K-rA,3),height:H(G-_,3),centerX:H((rA+K)/2,3),centerY:H((_+G)/2,3)}},z=(y,w)=>{const k=Y(y),rA=(_=>_.type==="rectangle"?parseFloat(_.props.LineWidth||"0.5")/3.78:0)(y),K=(_,G,T)=>{if(T==="rectangle"&&rA>0){const D=rA/2;if(G==="left"||G==="top")return _-D;if(G==="right"||G==="bottom")return _+D}return _};if(y.type==="line")switch(w){case"left":return{left:H(K(k.minX,w,y.type),3)+"mm"};case"right":return{left:H(K(k.maxX,w,y.type),3)+"mm"};case"top":return{top:H(K(k.minY,w,y.type),3)+"mm"};case"bottom":return{top:H(K(k.maxY,w,y.type),3)+"mm"};default:return{}}if(y.type==="verline"&&w==="right"){const G=parseFloat(y.props.LineWidth||"0.5")/3.78;return{left:H(K(k.minX+G,w,y.type),3)+"mm"}}switch(w){case"left":return{left:H(K(k.minX,w,y.type),3)+"mm"};case"right":return{left:H(K(k.maxX,w,y.type),3)+"mm"};case"top":return{top:H(K(k.minY,w,y.type),3)+"mm"};case"bottom":return{top:H(K(k.maxY,w,y.type),3)+"mm"};default:return{}}},$=()=>{o.nextTick(()=>{const y=document.querySelector(".canvas-container");if(!y||!c.value||!u.value)return;const w=y.getBoundingClientRect(),k=Or(c.value),X=Or(u.value),rA=16,K=21,_=21,G=20,T=24,D=24,q=w.width-rA*2-K-D,dA=w.height-rA-_-G-T;let sA=q/k,mA=dA/X,RA=Math.min(sA,mA);RA=RA*.95;const SA=Math.min(4,RA);s=Math.max(.8,Math.min(SA,RA)),i.value=J(s,1),setTimeout(()=>{n.value=1,a.value=!1},500)})};function J(y,w){y=y.toString();let k=y.indexOf(".");return k!==-1?y=y.substring(0,w+k+1):y=y.substring(0),Number(parseFloat(y).toFixed(w))}const Z=y=>f.get(y)||null,x=y=>{const w=g.value.indexOf(y),k=w===g.value.length-1,X=w!==-1,rA=`${y.id}_${Math.round(y.props.x*10)}_${Math.round(y.props.y*10)}_${y.props.width}_${y.props.height}_${y.props.rotation}_${X}_${k}`;if(U.has(rA))return U.get(rA);const K={width:y.props.width+"mm",height:y.props.height+"mm",transform:`translate(${y.props.x}mm, ${y.props.y}mm) rotate(${y.props.rotation}deg)`};return X?k?K.zIndex=1e3:K.zIndex=999:K.zIndex=10,U.set(rA,K),K},j=y=>{const w=g.value.some(X=>X.id===y.id),k=Q()===y;return{"component-selected":w,"component-current":w&&k,"no-outline":w&&(y.type==="line"||y.type==="verline")}},eA=(y,w)=>{const X=((y.props.rotation||0)%360+360)%360;if(y.type==="line"&&(w==="left"||w==="right")){let G;const D=((w==="left"?270:90)+X)%360;return D>=337.5||D<22.5?G="n-resize":D>=22.5&&D<67.5?G="ne-resize":D>=67.5&&D<112.5?G="e-resize":D>=112.5&&D<157.5?G="se-resize":D>=157.5&&D<202.5?G="s-resize":D>=202.5&&D<247.5?G="sw-resize":D>=247.5&&D<292.5?G="w-resize":D>=292.5&&D<337.5&&(G="nw-resize"),{cursor:G,top:"50%",transform:"translateY(-50%)"}}if(y.type==="verline"&&(w==="top"||w==="bottom")){let G;const D=((w==="top"?0:180)+X)%360;return D>=337.5||D<22.5?G="n-resize":D>=22.5&&D<67.5?G="ne-resize":D>=67.5&&D<112.5?G="e-resize":D>=112.5&&D<157.5?G="se-resize":D>=157.5&&D<202.5?G="s-resize":D>=202.5&&D<247.5?G="sw-resize":D>=247.5&&D<292.5?G="w-resize":D>=292.5&&D<337.5&&(G="nw-resize"),{cursor:G,left:"50%",transform:"translateX(-50%)"}}const K=({top:0,"top-right":45,right:90,"bottom-right":135,bottom:180,"bottom-left":225,left:270,"top-left":315}[w]+X)%360;let _="pointer";return K>=337.5||K<22.5?_="n-resize":K>=22.5&&K<67.5?_="ne-resize":K>=67.5&&K<112.5?_="e-resize":K>=112.5&&K<157.5?_="se-resize":K>=157.5&&K<202.5?_="s-resize":K>=202.5&&K<247.5?_="sw-resize":K>=247.5&&K<292.5?_="w-resize":K>=292.5&&K<337.5&&(_="nw-resize"),{cursor:_,display:"block",visibility:"visible",opacity:"1"}},oA=()=>{i.value<4&&(i.value+=.1)},lA=()=>{i.value>.8&&(i.value-=.1)},tA=()=>{var w;const y=Q();return!y||y.type!=="line"?((w=y==null?void 0:y.props)==null?void 0:w.x)||0:y.props.x1||y.props.x||0},VA=()=>{var w;const y=Q();return!y||y.type!=="line"?((w=y==null?void 0:y.props)==null?void 0:w.y)||0:y.props.y1||y.props.y||0},IA=(y,w)=>{const k=Q();if(!k||k.type!=="line"){ie(y,w);return}const X=Number(w);if(isNaN(X))return;const rA=k.props.width||15,K=k.props.rotation||0,G=(k.props.height||.5)/2,T=rA/2,D=G,q=K*Math.PI/180,dA=Math.cos(q),sA=Math.sin(q),RA=-(rA/2),kA=0,SA=RA*dA-kA*sA,ZA=RA*sA+kA*dA;if(y==="x"){const he=X-T-SA;k.props.x=Number(he.toFixed(2))}else if(y==="y"){const he=X-D-ZA;k.props.y=Number(he.toFixed(2))}};function Kn(y){const w=document.activeElement.tagName.toLowerCase();if(w==="input"||w==="textarea")return;const k=Q();if(!k)return;const X=Number(k.props.width)||0,rA=Number(k.props.height)||0;let K=k.props.x,_=k.props.y,G=!1;if(y.key==="ArrowLeft"?(K=H(k.props.x-Ln),G=!0):y.key==="ArrowRight"?(K=H(k.props.x+Ln),G=!0):y.key==="ArrowUp"?(_=H(k.props.y-Ln),G=!0):y.key==="ArrowDown"&&(_=H(k.props.y+Ln),G=!0),G){const T=c.value-X,D=u.value-rA;K<0?K=0:K>T&&(K=T),_<0?_=0:_>D&&(_=D),(we(k.props.x,K)||we(k.props.y,_))&&(k.props.x=K,k.props.y=_),y.preventDefault()}}const fl=({e:y,comp:w,previewDiv:k})=>{var X,rA;(X=y==null?void 0:y.dataTransfer)==null||X.setData("comp",JSON.stringify(w)),document.body.appendChild(k),(rA=y==null?void 0:y.dataTransfer)==null||rA.setDragImage(k,0,0),setTimeout(()=>document.body.removeChild(k),0)},Gn=async y=>{var Pn,Ru,Tu;y.preventDefault();const w=JSON.parse(((Ru=(Pn=y==null?void 0:y.dataTransfer)==null?void 0:Pn.getData)==null?void 0:Ru.call(Pn,"comp"))||"{}")||{},k=(w==null?void 0:w.type)||"";if(!k)return;const X=document.querySelector("#design").getBoundingClientRect(),rA=(y.clientX-X.left)/i.value,K=(y.clientY-X.top)/i.value,_=xA.value[k]||{};let G=zi(rA),T=zi(K);const D=_.width,q=_.height,dA=c.value-D,sA=u.value-q;G=Math.max(0,Math.min(G,dA)),T=Math.max(0,Math.min(T,sA));const{propertyPanel:mA,...RA}=_;let kA={...RA,x:H(G),y:H(T),width:H(D),height:H(q)};if((Tu=xA.value[k])!=null&&Tu.propertyPanel){const Ye=Oe(xA.value[k].propertyPanel)||{};if(kA={...kA,...Ye},k==="line"&&Ye.LineWidth){const Vt=parseFloat(Ye.LineWidth)*.3528;kA.height=H(Vt,3)}}const ZA=((Ye,gl)=>{const{width:Vt,height:_n,lockAspectRatio:iR}=Ye;let hr=Vt,pr=_n;const qn=c.value-2,$n=u.value-2;let Ul=!1;if(Vt>qn&&(hr=qn,Ul=!0),_n>$n&&(pr=$n,Ul=!0),iR&&Ul){const sR=qn/Vt,cR=$n/_n,Nu=Math.min(sR,cR);hr=H(Vt*Nu,2),pr=H(_n*Nu,2),hr=Math.min(hr,qn),pr=Math.min(pr,$n)}return{width:hr,height:pr}})(kA);if(kA.width=ZA.width,kA.height=ZA.height,ZA.width!==D||ZA.height!==q){const Ye=c.value-ZA.width,gl=u.value-ZA.height;G=Math.max(0,Math.min(G,Ye)),T=Math.max(0,Math.min(T,gl)),kA.x=H(G),kA.y=H(T)}const he={id:$A(),type:k,props:kA};l.value.push(he),h(he)};function hl(y){let w=y.target;for(;w&&w!==document.querySelector("#design");){if(w.classList&&(w.classList.contains("canvas-item")||w.classList.contains("resize-handle")||w.classList.contains("delete-btn")||w.classList.contains("rotate-handle")||w.classList.contains("property-panel")||w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.tagName==="BUTTON"))return;w=w.parentElement}E()}const pl=(y,w)=>{if(y.stopPropagation(),g.value.length===0){h(w),V(y,w);return}if(Q()===w){V(y,w);return}h(w),V(y,w)},_A=y=>{if(U.clear(),p.clear(),l.value.find(k=>k.id===y)&&(l.value=l.value.filter(k=>k.id!==y)),g.value.some(k=>k.id===y)){const k=g.value.filter(X=>X.id!==y);g.value=k}o.nextTick(()=>{})},qA=y=>{var k;const w=document.activeElement.tagName.toLowerCase();w==="input"||w==="textarea"||(y.key==="Delete"||y.key==="Backspace")&&g.value.length>0&&_A((k=Q())==null?void 0:k.id)},{handleMouseWheel:HA,handleInputChange:ie,adjustRotation:Yn}=Jw(g,c,u),Br=()=>{setTimeout(()=>{const y=document.querySelector(".center-container");if(!y)return;const w=y.getBoundingClientRect();y.style.height=`calc(100vh - ${w==null?void 0:w.top}px)`,$()},200)};o.watch(()=>t.templateInfo,(y,w)=>{y!==w&&(r.value=y||{},l.value=(y==null?void 0:y.items)||[])},{deep:!0,immediate:!0});const{handleCopy:zn,handlePaste:jn}=Kw(l,g,c,u),xA=o.ref({}),Ct=o.ref(!1),UA=async y=>{try{Ct.value=!1,xA.value=await cw(y),Ct.value=!0}catch{xA.value={},Ct.value=!0}};o.watch(()=>t.templateType,async y=>{try{await UA(y),E(),U.clear(),p.clear()}catch{}},{immediate:!0}),o.onMounted(async()=>{Ct.value||await UA(t.templateType),window.addEventListener("resize",Br),window.addEventListener("keydown",qA),window.addEventListener("keydown",zn),window.addEventListener("keydown",jn),window.addEventListener("keydown",Kn),Br(),fr()}),o.onBeforeUnmount(()=>{window.removeEventListener("resize",Br),window.removeEventListener("keydown",qA),window.removeEventListener("keydown",zn),window.removeEventListener("keydown",jn),window.removeEventListener("keydown",Kn),U.clear(),p.clear()});function $A(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,y=>{const w=Math.random()*16|0;return(y==="x"?w:w&3|8).toString(16)})}const Ge=y=>{var k;if(!xA.value||!xA.value[y])return{};const w=xA.value[y]||{};return y==="image"&&((k=t.config)!=null&&k.image)?{...w,image:{...w.image,...t.config.image}}:w},yt=()=>Lw(l,r.value),Xn=y=>{r.value.graphData=y||{},fr()},fr=()=>{var w;const y=zw(r.value.graphData)||"";y&&((w=document.querySelector("#design"))==null||w.appendChild(y))},yu=async y=>{var k;const w=JSON.parse(JSON.stringify(y));for(const X of w)if(X.type==="image"&&((k=X.props)!=null&&k.ImageSrc)){const rA=X.props.ImageSrc;typeof rA=="object"&&rA.fileSrc&&rA.fileSrc}return w},lR=()=>new Promise(async(y,w)=>{var k;try{E();const X=JSON.parse(JSON.stringify(l.value)),rA=((k=t.config)==null?void 0:k.textDisplayPriority)||"text";X==null||X.forEach(T=>{var D,q;if(T.type=="text"){const dA=((q=(D=t.options)==null?void 0:D.fields)==null?void 0:q.find(sA=>{var mA;return sA.value==((mA=T==null?void 0:T.props)==null?void 0:mA.FieldName)}))||{};T.props.Text=rA=="text"?T.props.Text||(dA==null?void 0:dA.label):(dA==null?void 0:dA.label)||T.props.Text}});const K=await yu(X),_=[...l.value];l.value=K;const G=()=>{var q;const T=((q=document.querySelector("#design"))==null?void 0:q.querySelectorAll("img"))||[],D=Array.from(T).map(dA=>dA.complete?Promise.resolve():new Promise(sA=>{dA.onload=dA.onerror=sA}));return Promise.all(D)};o.nextTick(async()=>{var dA;await new Promise(sA=>setTimeout(sA,100)),await G(),(((dA=document.querySelector("#design"))==null?void 0:dA.querySelectorAll("img"))||[]).forEach((sA,mA)=>{});const D=document.querySelector("#design");if(!D){w(new Error("找不到要转换的DOM元素"));return}const q=i.value;G().then(()=>{pV(D,{scale:Math.max(window.devicePixelRatio*2,3),useCORS:!0,allowTaint:!0,backgroundColor:null,logging:!1,imageTimeout:15e3,onclone:sA=>{const mA=sA.querySelector(".canvas-wrapper");if(mA){const ZA=mA.style.transform.replace(/scale\([^)]*\)/g,"").replace(/\s+/g," ").trim();mA.style.transform=ZA||"none",mA.style.opacity="1"}const RA=sA.querySelector("#design");if(RA){const SA=window.getComputedStyle(D);for(let ZA=0;ZA<SA.length;ZA++){const he=SA[ZA];RA.style[he]=SA.getPropertyValue(he)}}sA.querySelectorAll("img").forEach(SA=>{SA.style.imageRendering="high-quality",SA.style.webkitImageRendering="high-quality",SA.style.mozImageRendering="high-quality",SA.style.objectFit="contain",SA.style.objectPosition="center"})}}).then(sA=>{l.value=_;const mA=sA.toDataURL("image/png");y({data:yt(),image:mA})}).catch(sA=>{l.value=_,w(sA)})}).catch(sA=>{w(sA)})})}catch(X){w(X)}}),Vu=()=>new Promise((y,w)=>{l.value.forEach(X=>{if(X.type==="image"&&!X.props.ImageSrc)return It.warning("图片控件请选择图片!"),w("图片控件请选择图片!")}),y(!0)});return A({getJson:()=>Vu().then(()=>yt()),clear:()=>{l.value=[],E()},snapshot:()=>Vu().then(()=>lR())}),(y,w)=>{var _,G;const k=o.resolveComponent("el-icon-refresh-left"),X=o.resolveComponent("el-icon"),rA=o.resolveComponent("el-icon-close"),K=o.resolveComponent("el-switch");return o.openBlock(),o.createElementBlock("div",QV,[o.createElementVNode("div",wV,[o.createVNode(Uw,{onDragStart:fl,config:e.config,propsConfig:xA.value},null,8,["config","propsConfig"])]),o.createElementVNode("div",mV,[a.value?(o.openBlock(),o.createElementBlock("div",EV,w[32]||(w[32]=[o.createElementVNode("div",{class:"loader-circle"},null,-1),o.createElementVNode("p",null,"设计画板加载中...",-1)]))):o.createCommentVNode("",!0),o.createElementVNode("div",FV,[e.showGraphConfig?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createVNode(kw,{"graph-data":(_=r.value)==null?void 0:_.graphData,onSuccess:Xn},null,8,["graph-data"]),w[33]||(w[33]=o.createElementVNode("div",{style:{width:"30px"}},null,-1))],64)):o.createCommentVNode("",!0),o.createElementVNode("div",CV,[o.createElementVNode("button",{onClick:lA,disabled:i.value<=.8},"-",8,yV),o.createElementVNode("span",null,o.toDisplayString(Math.round(i.value*100))+"%",1),o.createElementVNode("button",{onClick:oA,disabled:i.value>=4},"+",8,VV)])]),o.createElementVNode("div",RV,[o.createElementVNode("div",{class:"canvas-wrapper",style:o.normalizeStyle(`transform: scale(${i.value});opacity: ${n.value};`)},[c.value&&u.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createElementVNode("div",TV,[o.createVNode(ws,{direction:"horizontal",length:c.value},null,8,["length"])]),o.createElementVNode("div",NV,[o.createVNode(ws,{direction:"vertical",length:u.value},null,8,["length"])])],64)):o.createCommentVNode("",!0),o.createElementVNode("div",{id:"design",class:"canvas",style:o.normalizeStyle(`width: ${c.value}mm; height: ${u.value}mm;`),onDrop:Gn,onDragover:w[1]||(w[1]=o.withModifiers(()=>{},["prevent"])),onPointerdown:hl},[o.unref(C)&&o.unref(F)?(o.openBlock(),o.createElementBlock("div",vV,[o.createElementVNode("div",{class:"drag-extend-line vertical",style:o.normalizeStyle(z(o.unref(F),"left"))},null,4),o.createElementVNode("div",{class:"drag-extend-line vertical",style:o.normalizeStyle(z(o.unref(F),"right"))},null,4),o.createElementVNode("div",{class:"drag-extend-line horizontal",style:o.normalizeStyle(z(o.unref(F),"top"))},null,4),o.createElementVNode("div",{class:"drag-extend-line horizontal",style:o.normalizeStyle(z(o.unref(F),"bottom"))},null,4)])):o.createCommentVNode("",!0),o.unref(M)?(o.openBlock(),o.createElementBlock("div",IV,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(R).horizontal,(T,D)=>(o.openBlock(),o.createElementBlock("div",{key:`h-${D}`,class:o.normalizeClass(["alignment-guide horizontal",`guide-${T.type}`]),style:o.normalizeStyle({top:`${T.y}mm`,left:"0",right:"0"})},null,6))),128)),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(R).vertical,(T,D)=>(o.openBlock(),o.createElementBlock("div",{key:`v-${D}`,class:o.normalizeClass(["alignment-guide vertical",`guide-${T.type}`]),style:o.normalizeStyle({left:`${T.x}mm`,top:"0",bottom:"0"})},null,6))),128))])):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value,T=>{var D;return o.openBlock(),o.createElementBlock("div",{key:T.id,class:o.normalizeClass(["canvas-item",j(T)]),style:o.normalizeStyle(x(T)),"data-item-id":T.id,onMousedown:q=>pl(q,T)},[o.unref(Q)()===T?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[T.props.lockAspectRatio?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[T.type!=="line"?(o.openBlock(),o.createElementBlock("div",{key:0,class:"resize-handle top",style:o.normalizeStyle(eA(T,"top")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"top"),["stop"])},null,44,bV)):o.createCommentVNode("",!0),T.type!=="verline"&&T.type!=="line"?(o.openBlock(),o.createElementBlock("div",{key:1,class:"resize-handle right",style:o.normalizeStyle(eA(T,"right")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"right"),["stop"])},null,44,MV)):o.createCommentVNode("",!0),T.type!=="line"?(o.openBlock(),o.createElementBlock("div",{key:2,class:"resize-handle bottom",style:o.normalizeStyle(eA(T,"bottom")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"bottom"),["stop"])},null,44,HV)):o.createCommentVNode("",!0),T.type!=="verline"?(o.openBlock(),o.createElementBlock("div",{key:3,class:"resize-handle left",style:o.normalizeStyle(eA(T,"left")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"left"),["stop"])},null,44,xV)):o.createCommentVNode("",!0)],64)),T.type!=="line"&&T.type!=="verline"?(o.openBlock(),o.createElementBlock("div",{key:1,class:"resize-handle top-left",style:o.normalizeStyle(eA(T,"top-left")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"top-left"),["stop"])},null,44,kV)):o.createCommentVNode("",!0),T.type!=="line"&&T.type!=="verline"?(o.openBlock(),o.createElementBlock("div",{key:2,class:"resize-handle top-right",style:o.normalizeStyle(eA(T,"top-right")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"top-right"),["stop"])},null,44,ZV)):o.createCommentVNode("",!0),T.type!=="line"&&T.type!=="verline"?(o.openBlock(),o.createElementBlock("div",{key:3,class:"resize-handle bottom-right",style:o.normalizeStyle(eA(T,"bottom-right")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"bottom-right"),["stop"])},null,44,OV)):o.createCommentVNode("",!0),T.type!=="line"&&T.type!=="verline"?(o.openBlock(),o.createElementBlock("div",{key:4,class:"resize-handle bottom-left",style:o.normalizeStyle(eA(T,"bottom-left")),onMousedown:o.withModifiers(q=>o.unref(v)(q,T,"bottom-left"),["stop"])},null,44,WV)):o.createCommentVNode("",!0),T.type!=="verline"?(o.openBlock(),o.createElementBlock("div",{key:5,class:"rotate-handle",onMousedown:o.withModifiers(q=>o.unref(P)(q,T),["stop"])},[o.createVNode(X,{size:"6"},{default:o.withCtx(()=>[o.createVNode(k)]),_:1})],40,DV)):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"delete-btn",onClick:o.withModifiers(q=>_A(T.id),["stop"]),onMousedown:w[0]||(w[0]=o.withModifiers(()=>{},["stop"])),title:"删除"},[o.createVNode(X,{size:"6"},{default:o.withCtx(()=>[o.createVNode(rA)]),_:1})],40,LV)],64)):o.createCommentVNode("",!0),T.props&&Ct.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(((D=Z(T.type))==null?void 0:D.component)||null),{key:`${T.id}-${T.type}`,modelValue:{...T.props,__selected:o.unref(Q)()===T,options:t.options},propsConfig:xA.value,"onUpdate:modelValue":q=>{const{__selected:dA,options:sA,...mA}=q;Object.keys(mA).forEach(RA=>{mA[RA]!==void 0&&(T.props[RA]=mA[RA])})}},null,8,["modelValue","propsConfig","onUpdate:modelValue"])):o.createCommentVNode("",!0)],46,SV)}),128))],36)],4)])]),o.createElementVNode("div",JV,[o.unref(g).length>0?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[w[38]||(w[38]=o.createElementVNode("h3",{class:"property-panel-title"},"属性设置",-1)),o.createElementVNode("div",KV,[o.createElementVNode("div",GV,[o.createElementVNode("label",null,o.toDisplayString(o.unref(Q)().type==="line"?"起点X:":"X坐标:"),1),o.createElementVNode("div",YV,[o.createElementVNode("button",{onClick:w[2]||(w[2]=o.withModifiers(T=>o.unref(HA)(T,"x",-.5),["stop"]))},"-"),o.createElementVNode("input",{type:"number",value:tA(),onInput:w[3]||(w[3]=T=>IA("x",T.target.value)),onClick:w[4]||(w[4]=o.withModifiers(()=>{},["stop"])),onMousedown:w[5]||(w[5]=o.withModifiers(()=>{},["stop"]))},null,40,zV),o.createElementVNode("button",{onClick:w[6]||(w[6]=o.withModifiers(T=>o.unref(HA)(T,"x",.5),["stop"]))},"+")])]),o.createElementVNode("div",jV,[o.createElementVNode("label",null,o.toDisplayString(o.unref(Q)().type==="line"?"起点Y:":"Y坐标:"),1),o.createElementVNode("div",XV,[o.createElementVNode("button",{onClick:w[7]||(w[7]=o.withModifiers(T=>o.unref(HA)(T,"y",-.5),["stop"]))},"-"),o.createElementVNode("input",{type:"number",value:VA(),onInput:w[8]||(w[8]=T=>IA("y",T.target.value)),onClick:w[9]||(w[9]=o.withModifiers(()=>{},["stop"])),onMousedown:w[10]||(w[10]=o.withModifiers(()=>{},["stop"]))},null,40,PV),o.createElementVNode("button",{onClick:w[11]||(w[11]=o.withModifiers(T=>o.unref(HA)(T,"y",.5),["stop"]))},"+")])]),o.unref(Q)().type!=="verline"?(o.openBlock(),o.createElementBlock("div",_V,[w[34]||(w[34]=o.createElementVNode("label",null,"宽度:",-1)),o.createElementVNode("div",qV,[o.createElementVNode("button",{onClick:w[12]||(w[12]=o.withModifiers(T=>o.unref(HA)(T,"width",-.5,1),["stop"]))},"-"),o.withDirectives(o.createElementVNode("input",{type:"number","onUpdate:modelValue":w[13]||(w[13]=T=>o.unref(Q)().props.width=T),onInput:w[14]||(w[14]=T=>o.unref(ie)("width",T.target.value)),onClick:w[15]||(w[15]=o.withModifiers(()=>{},["stop"])),onMousedown:w[16]||(w[16]=o.withModifiers(()=>{},["stop"]))},null,544),[[o.vModelText,o.unref(Q)().props.width,void 0,{number:!0}]]),o.createElementVNode("button",{onClick:w[17]||(w[17]=o.withModifiers(T=>o.unref(HA)(T,"width",.5,1),["stop"]))},"+")])])):o.createCommentVNode("",!0),o.unref(Q)().type!=="line"?(o.openBlock(),o.createElementBlock("div",$V,[w[35]||(w[35]=o.createElementVNode("label",null,"高度:",-1)),o.createElementVNode("div",AR,[o.createElementVNode("button",{onClick:w[18]||(w[18]=o.withModifiers(T=>o.unref(HA)(T,"height",-.5,1),["stop"]))},"-"),o.withDirectives(o.createElementVNode("input",{type:"number","onUpdate:modelValue":w[19]||(w[19]=T=>o.unref(Q)().props.height=T),onInput:w[20]||(w[20]=T=>o.unref(ie)("height",T.target.value)),onClick:w[21]||(w[21]=o.withModifiers(()=>{},["stop"])),onMousedown:w[22]||(w[22]=o.withModifiers(()=>{},["stop"]))},null,544),[[o.vModelText,o.unref(Q)().props.height,void 0,{number:!0}]]),o.createElementVNode("button",{onClick:w[23]||(w[23]=o.withModifiers(T=>o.unref(HA)(T,"height",.5,1),["stop"]))},"+")])])):o.createCommentVNode("",!0),o.createElementVNode("div",eR,[w[36]||(w[36]=o.createElementVNode("label",null,"旋转:",-1)),o.createElementVNode("div",tR,[o.createElementVNode("button",{onClick:w[24]||(w[24]=o.withModifiers(T=>o.unref(Yn)(-1),["stop"]))},"-"),o.withDirectives(o.createElementVNode("input",{type:"number","onUpdate:modelValue":w[25]||(w[25]=T=>o.unref(Q)().props.rotation=T),onInput:w[26]||(w[26]=T=>o.unref(ie)("rotation",T.target.value)),onClick:w[27]||(w[27]=o.withModifiers(()=>{},["stop"])),onMousedown:w[28]||(w[28]=o.withModifiers(()=>{},["stop"]))},null,544),[[o.vModelText,o.unref(Q)().props.rotation,void 0,{number:!0}]]),o.createElementVNode("button",{onClick:w[29]||(w[29]=o.withModifiers(T=>o.unref(Yn)(1),["stop"]))},"+")])]),o.unref(Q)().type!=="line"?(o.openBlock(),o.createElementBlock("div",rR,[w[37]||(w[37]=o.createElementVNode("label",null,"锁定宽高比:",-1)),o.createElementVNode("div",nR,[o.createVNode(K,{modelValue:o.unref(Q)().props.lockAspectRatio,"onUpdate:modelValue":w[30]||(w[30]=T=>o.unref(Q)().props.lockAspectRatio=T),"active-value":!0,"inactive-value":!1},null,8,["modelValue"])])])):o.createCommentVNode("",!0)]),(o.openBlock(),o.createBlock(o.resolveDynamicComponent(((G=Z(o.unref(Q)().type))==null?void 0:G.propertyPanel)||null),{modelValue:o.unref(Q)().props,"onUpdate:modelValue":w[31]||(w[31]=T=>o.unref(Q)().props=T),options:e.options,"props-config":Ge(o.unref(Q)().type)},null,8,["modelValue","options","props-config"]))],64)):o.createCommentVNode("",!0)])])}}},[["__scopeId","data-v-30c717ec"]]),DR="",Jn=QA({__name:"index",props:{templateData:{type:Object,default:()=>({graphData:{},width:0,height:0,printWidth:0,printHeight:0,items:[]})},config:{type:Object,default:()=>({})}},setup(e){const A=o.getCurrentInstance(),t=e,r=o.ref(!1),n=o.ref({}),a=o.ref(),l=o.ref(0),i=o.ref(!1),s=(g,h)=>{let Q;return function(...C){const F=()=>{clearTimeout(Q),g(...C)};clearTimeout(Q),Q=setTimeout(F,h)}},c=o.ref({rectTop:0,isInModal:!1}),u=()=>{if(!a.value)return;const g=a.value.getBoundingClientRect(),h=B(a.value);let Q=0;if(g.top>0)Q=g.top;else if(h){const E=U(a.value);Q=E>0?E:60}else{const E=a.value.offsetTop;E>0?Q=E:Q=60}(Q!==c.value.rectTop||h!==c.value.isInModal)&&(l.value=Q,i.value=h,c.value={rectTop:Q,isInModal:h})},d=s(u,100),B=g=>{let h=g.parentElement;for(;h;){if(h.classList&&(h.classList.contains("el-dialog")||h.classList.contains("el-drawer")||h.classList.contains("sc-dialog")))return!0;h=h.parentElement}return!1},U=g=>{let h=g.parentElement;for(;h;){if(h.classList&&(h.classList.contains("el-dialog")||h.classList.contains("el-drawer")||h.classList.contains("sc-dialog"))){const Q=h.getBoundingClientRect();return Q.top>0?Q.top:60}h=h.parentElement}return 60};o.onMounted(()=>{setTimeout(()=>u(),100),setTimeout(()=>u(),300),window.addEventListener("resize",d),o.onBeforeUnmount(()=>{window.removeEventListener("resize",d)})}),o.watch(()=>r.value,g=>{g&&o.nextTick(()=>setTimeout(()=>u(),50))}),o.watch(()=>t.templateData,g=>p(g),{deep:!0,immediate:!0});function p(g){if(r.value=(g==null?void 0:g.width)>0&&(g==null?void 0:g.height)>0,!r.value)return;const h={...g};h.printWidth||Object.assign(h,{printWidth:h.width}),h.printHeight||Object.assign(h,{printHeight:h.height}),h!=null&&h.graphData||Object.assign(h,{graphData:{printList:[{x:0,y:0,width:g.printWidth,height:g.printHeight,topLeftRadius:4,topRightRadius:4,bottomLeftRadius:4,bottomRightRadius:4}],punchingList:[]}}),h!=null&&h.items||Object.assign(h,{items:[]}),n.value=h}function f(g){A.exposed=g||{},A.exposeProxy=g||{}}return(g,h)=>{const Q=o.resolveDirective("loading");return o.withDirectives((o.openBlock(),o.createElementBlock("div",{ref_key:"templateDesignerRef",ref:a,class:o.normalizeClass(["template-designer",{"template-designer-border-top":i.value}]),style:o.normalizeStyle({height:"calc(100vh - "+(l.value+1)+"px)"})},[r.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.h(oR,{...g.$attrs,...t,ref:f},g.$slots)),{key:0,"template-info":n.value},null,8,["template-info"])):o.createCommentVNode("",!0)],6)),[[Q,!r.value]])}}},[["__scopeId","data-v-a3d9b11f"]]);Jn.install=e=>{e.component(Jn.name||"TemplateDesigner",Jn)};const Cu=Object.freeze(Object.defineProperty({__proto__:null,default:{text:{width:20,height:4.2,rotation:0,lockAspectRatio:!1,propertyPanel:[{prop:"Title",label:"标题",default:"",layout:"full",desc:"用于固定文案的打印,不需要则不填。示例:如果填写“价格:”,则打印时内容为“价格:【字段对应值】”"},{prop:"FieldName",label:"字段名称",type:"select",multiple:!0,optionsKey:"fields",default:"",layout:"full"},{prop:"Text",label:"测试数据(展示使用,无实际意义)",default:"测试文本",layout:"full"},{prop:"FontName",label:"字体名称",type:"select",desc:"注意:选择的字体需要计算机中安装有对应字体才有效",options:[{label:"黑体",value:"黑体",cssValue:"SimHei"},{label:"楷体",value:"楷体",cssValue:"KaiTi"},{label:"宋体",value:"宋体",cssValue:"SimSun"},{label:"隶书",value:"隶书",cssValue:"LiSu"},{label:"缅语Arial",value:"Arial",cssValue:"Arial"},{label:"缅语Segoe UI",value:"Segoe UI",cssValue:"Segoe UI"}],default:"黑体",layout:"half"},{prop:"FontSize",label:"字体大小",type:"number",min:1,max:100,default:10,layout:"half"},{prop:"FontColor",label:"字体颜色",type:"color",hide:!0,default:"#000000",layout:"half"},{prop:"Bold",label:"字体加粗",type:"select",options:[{label:"加粗",value:1},{label:"不加粗",value:0}],default:0,layout:"half"},{prop:"Italic",label:"是否斜体",type:"select",options:[{label:"是",value:1},{label:"否",value:0}],default:0,layout:"half"},{prop:"Underline",label:"下划线",type:"select",options:[{label:"是",value:1},{label:"否",value:0}],default:0,hide:!0},{prop:"Alignment",label:"对齐方式",type:"select",options:[{label:"居左",value:1},{label:"居中",value:2},{label:"居右",value:3}],default:2},{prop:"TextWrap",label:"文本换行",type:"select",options:[{label:"换行",value:1},{label:"不换行&省略",value:2},{label:"不换行&隐藏",value:3}],default:1,hide:!0},{prop:"HOrient",label:"水平锁定",type:"select",options:[{label:"无",value:0},{label:"左边距锁定",value:1},{label:"右边距锁定",value:2},{label:"水平居中",value:3}],hide:!0,default:0},{prop:"VOrient",label:"垂直锁定",type:"select",options:[{label:"无",value:0},{label:"上边距锁定",value:1},{label:"下边距锁定",value:2},{label:"垂直居中",value:3}],hide:!0,default:0},{prop:"PenWidth",label:"线宽",type:"number",min:0,hide:!0,default:0},{prop:"PenStyle",label:"线型",type:"select",hide:!0,options:[{label:"实线",value:0},{label:"破折线",value:1},{label:"点线",value:2},{label:"点划线",value:3},{label:"双点划线",value:4}],default:0},{prop:"Stretch",label:"缩放模式",type:"select",options:[{label:"扩展",value:1},{label:"缩放",value:2}],hide:!0,default:1},{prop:"PreviewOnly",label:"仅预览",type:"select",hide:!0,options:[{label:"是",value:1},{label:"否",value:0}],default:0},{prop:"ReadOnly",label:"只读",type:"select",hide:!0,options:[{label:"是",value:1},{label:"否",value:0}],default:0}]},barcode:{width:20,height:6,rotation:0,lockAspectRatio:!1,propertyPanel:[{prop:"FieldName",label:"字段名称",type:"select",optionsKey:"fields",default:"goods_sn",layout:"full"},{prop:"BarcodeValue",label:"测试数据(展示使用,无实际意义)",type:"text",default:"1234567890"},{prop:"CodeType",label:"条码类型",type:"select",options:[{label:"CODE128",value:"128Auto",compValue:"CODE128"},{label:"CODE39",value:"Code39",compValue:"CODE39"},{label:"EAN13",value:"EAN13",compValue:"EAN13"}],hide:!0,default:"128Auto"},{prop:"AlignJustify",label:"对齐方式",type:"select",options:[{label:"两端对齐",value:0},{label:"左",value:1},{label:"中",value:2},{label:"右",value:3}],hide:!0,default:0},{prop:"LineColor",label:"条形码颜色",type:"color",hide:!0,default:"#000000"}]},qrcode:{width:10,height:10,rotation:0,lockAspectRatio:!0,propertyPanel:[{prop:"FieldName",label:"字段名称",type:"select",optionsKey:"fields",default:"",layout:"full"},{prop:"QRCodeValue",label:"测试数据(展示使用,无实际意义)",type:"text",default:"FB-GOLD"},{prop:"QRCodeVersion",label:"二维码版本",type:"number",min:1,max:40,hide:!0,default:7},{prop:"QRCodeErrorLevel",label:"纠错级别",type:"select",options:[{label:"L (7%)",value:"L"},{label:"M (15%)",value:"M"},{label:"Q (25%)",value:"Q"},{label:"H (30%)",value:"H"}],hide:!0,default:"H"},{prop:"QRCodeEncodeMode",label:"编码模式",type:"select",options:[{label:"数字",value:"N"},{label:"二进制或汉语",value:"B"},{label:"英文字母",value:"A"}],hide:!0,default:"B"},{prop:"QRCodeForeground",label:"前景色",type:"color",hide:!0,default:"#000000"},{prop:"QRCodeBackground",label:"背景景色",type:"color",hide:!0,default:"transparent"}]},image:{width:12,height:12,rotation:0,lockAspectRatio:!1,propertyPanel:[{prop:"ImageSrc",label:"图片地址",type:"file",accept:"image/*",default:""},{prop:"ScaleMode",label:"图片缩放",type:"select",options:[{label:"原始尺寸",value:1},{label:"居中裁剪",value:2},{label:"填充",value:3}],default:1},{prop:"IsPrint",label:"是否打印",type:"select",options:[{label:"是",value:!0},{label:"否",value:!1}],default:!0}]},rectangle:{width:15,height:10,rotation:0,lockAspectRatio:!1,propertyPanel:[{prop:"LineWidth",type:"select",label:"线宽",default:"0.5",options:[{label:"默认",value:"0.5"},{label:"1px",value:"1"},{label:"2px",value:"2"},{label:"3px",value:"3"},{label:"4px",value:"4"},{label:"5px",value:"5"},{label:"6px",value:"6"},{label:"7px",value:"7"},{label:"8px",value:"8"},{label:"9px",value:"9"},{label:"10px",value:"10"}]},{prop:"LineStyle",type:"select",label:"样式",default:1,options:[{label:"实线",value:1},{label:"虚线",value:2}]},{prop:"BorderRadius",type:"number",label:"圆角",default:0,min:0,step:1,hide:!0}]},line:{width:15,height:.5,rotation:0,lockAspectRatio:!1,x1:0,y1:0,x2:15,y2:0,propertyPanel:[{prop:"LineWidth",type:"select",label:"线宽",default:"0.5",options:[{label:"默认",value:"0.5"},{label:"1px",value:"1"},{label:"2px",value:"2"},{label:"3px",value:"3"},{label:"4px",value:"4"},{label:"5px",value:"5"},{label:"6px",value:"6"},{label:"7px",value:"7"},{label:"8px",value:"8"},{label:"9px",value:"9"},{label:"10px",value:"10"}]},{prop:"LineStyle",type:"select",label:"样式",default:1,options:[{label:"实线",value:1},{label:"虚线",value:2}]}]}}},Symbol.toStringTag,{value:"Module"})),aR=Object.freeze(Object.defineProperty({__proto__:null,default:{text:{x:0,y:0,width:20,height:4.2,rotation:0,Title:"",FieldName:"",Text:"测试文本",FontName:"黑体",FontSize:10,FontColor:"#000000",Bold:0,Italic:0,Underline:0,Alignment:2,TextWrap:1,HOrient:0,VOrient:0,PenWidth:0,PenStyle:0,Stretch:1,PreviewOnly:0,ReadOnly:0,propertyPanel:[{prop:"Title",label:"标题",default:"",layout:"full",desc:"设置文本组件的标题内容,用于显示在组件上"},{prop:"FieldName",label:"字段名称",type:"select",optionsKey:"fields",default:"",layout:"full"},{prop:"Text",label:"测试数据(展示使用,无实际意义)",default:"测试文本",layout:"full"},{prop:"FontName",label:"字体名称",type:"select",multiple:!0,desc:"注意:选择的字体需要计算机中安装有对应字体才有效",options:[{label:"黑体",value:"黑体",cssValue:"SimHei"},{label:"楷体",value:"楷体",cssValue:"KaiTi"},{label:"宋体",value:"宋体",cssValue:"SimSun"},{label:"隶书",value:"隶书",cssValue:"LiSu"}],default:"黑体",layout:"half"},{prop:"FontSize",label:"字体大小",type:"number",min:1,max:100,default:10,layout:"half"},{prop:"FontColor",label:"字体颜色",type:"color",hide:!0,default:"#000000",layout:"half"},{prop:"Bold",label:"字体加粗",type:"select",options:[{label:"加粗",value:1},{label:"不加粗",value:0}],default:0,layout:"half"},{prop:"Italic",label:"是否斜体",type:"select",options:[{label:"是",value:1},{label:"否",value:0}],default:0,layout:"half"},{prop:"Alignment",label:"对齐方式",type:"select",options:[{label:"居左",value:1},{label:"居中",value:2},{label:"居右",value:3}],default:2,layout:"half"},{prop:"TextWrap",label:"文本换行",type:"select",options:[{label:"换行",value:1},{label:"不换行",value:2}],default:1,layout:"half"}]},barcode:{x:0,y:0,width:20,height:6,rotation:0,FieldName:"goodsSn",BarcodeValue:"1234567890",CodeType:"128Auto",AlignJustify:0,LineColor:"#000000",propertyPanel:[{prop:"FieldName",label:"字段名称",type:"select",optionsKey:"fields",default:"goods_sn",layout:"full"},{prop:"BarcodeValue",label:"测试数据(展示使用,无实际意义)",type:"text",default:"1234567890"},{prop:"CodeType",label:"条码类型",type:"select",options:[{label:"CODE128",value:"128Auto",compValue:"CODE128"},{label:"CODE39",value:"Code39",compValue:"CODE39"},{label:"EAN13",value:"EAN13",compValue:"EAN13"}],hide:!0,default:"128Auto"},{prop:"AlignJustify",label:"对齐方式",type:"select",options:[{label:"两端对齐",value:0},{label:"左",value:1},{label:"中",value:2},{label:"右",value:3}],hide:!0,default:0},{prop:"LineColor",label:"条形码颜色",type:"color",hide:!0,default:"#000000"}]},qrcode:{x:0,y:0,width:10,height:10,rotation:0,FieldName:"",QRCodeValue:"FB-GOLD",QRCodeVersion:7,QRCodeErrorLevel:"Q",QRCodeEncodeMode:"B",QRCodeForeground:"#000000",QRCodeBackground:"transparent",LockAspectRatio:!0,lockAspectRatio:!0,propertyPanel:[{prop:"FieldName",label:"字段名称",type:"select",optionsKey:"fields",default:"",layout:"full"},{prop:"QRCodeValue",label:"测试数据(展示使用,无实际意义)",type:"text",default:"FB-GOLD"},{prop:"QRCodeVersion",label:"二维码版本",type:"number",min:1,max:40,hide:!0,default:7},{prop:"QRCodeErrorLevel",label:"纠错级别",type:"select",options:[{label:"L (7%)",value:"L"},{label:"M (15%)",value:"M"},{label:"Q (25%)",value:"Q"},{label:"H (30%)",value:"H"}],hide:!0,default:"Q"},{prop:"QRCodeEncodeMode",label:"编码模式",type:"select",options:[{label:"数字",value:"N"},{label:"二进制或汉语",value:"B"},{label:"英文字母",value:"A"}],hide:!0,default:"B"},{prop:"QRCodeForeground",label:"前景色",type:"color",hide:!0,default:"#000000"},{prop:"QRCodeBackground",label:"背景景色",type:"color",hide:!0,default:"transparent"}]},image:{width:12,height:12,rotation:0,lockAspectRatio:!1,propertyPanel:[{prop:"ImageSrc",label:"图片地址",type:"file",accept:"image/*",default:""},{prop:"ScaleMode",label:"图片缩放",type:"select",options:[{label:"原始尺寸",value:1},{label:"居中裁剪",value:2},{label:"填充",value:3}],default:1},{prop:"IsPrint",label:"是否打印",type:"select",options:[{label:"是",value:!0},{label:"否",value:!1}],default:!1}]}}},Symbol.toStringTag,{value:"Module"}));return Jn});
|