@worm-vue3-print/canvas 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,6 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),w=require("@worm-vue3-print/core/designer"),_e=require("jsbarcode"),et=require("qrcode"),ft=require("dompurify"),Pe=require("@worm-vue3-print/core/browser"),tt=Symbol("selected-ids"),ot=Symbol("preview-ids");function gt(o){const r=e.ref(new Set),t=e.ref(new Set),n=e.computed(()=>o.value.filter(C=>r.value.has(C.id))),l=e.computed(()=>r.value.size>0);function i(C,I=!1){if(I){const O=new Set(r.value);O.has(C)?O.delete(C):O.add(C),r.value=O}else r.value=new Set([C])}function a(){r.value=new Set}function c(C){r.value=new Set(C)}function h(C){t.value=new Set(C)}function u(){t.value=new Set}function f(){r.value=new Set(t.value),t.value=new Set}function E(){const C=n.value;if(C.length===0)return null;let I=1/0,O=1/0,z=-1/0,S=-1/0;return C.forEach(U=>{I=Math.min(I,U.options.left),O=Math.min(O,U.options.top),z=Math.max(z,U.options.left+U.options.width),S=Math.max(S,U.options.top+U.options.height)}),{left:I,top:O,width:z-I,height:S-O}}return{selectedIds:r,selectedElements:n,hasSelection:l,select:i,clearSelection:a,selectAll:c,getSelectionBounds:E,previewIds:t,setPreview:h,clearPreview:u,commitPreview:f}}function ht(){const o=e.ref(null);function r(l){o.value=l.map(i=>({options:{...i.options},printElementType:{...i.printElementType}}))}function t(l=10){return o.value?o.value.map(i=>({id:w.generateId(),options:{...i.options,left:i.options.left+l,top:i.options.top+l},printElementType:{...i.printElementType}})):null}function n(){return o.value!==null&&o.value.length>0}return{clipboard:o,copy:r,paste:t,hasData:n}}function bt(o){const t=e.ref([]),n=e.ref([]),l=e.ref(!1),i=e.ref(!1);function a(){l.value=t.value.length>0,i.value=n.value.length>0}function c(I){return{elements:JSON.parse(JSON.stringify(I?.elements??[])),templateData:JSON.parse(JSON.stringify(I?.templateData??{}))}}function h(I){return c(I)}function u(I){t.value.push(h(I)),n.value=[],t.value.length>50&&t.value.shift(),a()}function f(I){if(t.value.length===0)return null;const O=t.value.pop();return n.value.push(I?h(I):c(O)),a(),t.value.length>0?c(t.value[t.value.length-1]):null}function E(I){if(n.value.length===0)return null;const O=n.value.pop();return t.value.push(I?h(I):c(O)),a(),c(O)}function C(){t.value=[],n.value=[],a()}return{push:u,undo:f,redo:E,canUndo:l,canRedo:i,clear:C}}function nt(){return{paperSize:"A4",orientation:"portrait",unit:"mm",margins:{top:10,right:10,bottom:10,left:10},header:{height:10,elements:[]},footer:{height:10,elements:[]},firstPageOverlay:{height:0,elements:[]},elements:[],watermark:{}}}function Ue(o){const r=(t,n)=>(t??[]).map(l=>{const i={...l.options};return(l.printElementType?.type??l.type)==="table"&&w.syncTableElementSize(i),{id:l.id||w.generateId(),zone:n,options:i,printElementType:{...l.printElementType}}});return{...o,margins:{...o.margins},header:{height:o.header?.height??10,elements:[]},footer:{height:o.footer?.height??10,elements:[]},firstPageOverlay:{height:o.firstPageOverlay?.height??0,elements:[...o.firstPageOverlay?.elements??[]]},guides:[...o.guides??[]],elements:[...r(o.elements??[],"content"),...r(o.header?.elements??[],"header"),...r(o.footer?.elements??[],"footer")]}}function yt(o={}){const r=e.ref(100),t=e.ref(!0),n=e.ref(!0),l=e.ref(!1),i=e.ref(!0),a=e.ref(Ue(o.initialTemplate||nt())),c=e.computed({get:()=>a.value.elements,set:G=>{a.value.elements=G}}),h=e.ref(o.initialFields||[]),{selectedIds:u,selectedElements:f,select:E,clearSelection:C,selectAll:I,previewIds:O,setPreview:z,clearPreview:S,commitPreview:U}=gt(c),{group:K,ungroup:Z}=w.useGroup(),{copy:W,paste:Q,hasData:_}=ht(),{align:N}=w.useAlign(),{push:$,undo:M,redo:P,canUndo:x,canRedo:D}=bt(),s=e.computed(()=>{if(u.value.size===0)return null;const G=u.value.values().next().value;return c.value.find(te=>te.id===G)||null}),V=e.ref(null);function F(G){V.value=G}function Y(){return{elements:c.value.map(G=>({id:G.id,zone:G.zone,options:JSON.parse(JSON.stringify(G.options)),printElementType:{...G.printElementType}})),templateData:{paperSize:a.value.paperSize,orientation:a.value.orientation,margins:{...a.value.margins},header:{height:a.value.header.height,elements:[]},footer:{height:a.value.footer.height,elements:[]},firstPageOverlay:{height:a.value.firstPageOverlay.height,elements:[]},elements:[],customWidth:a.value.customWidth,customHeight:a.value.customHeight,watermark:a.value.watermark?{...a.value.watermark}:void 0,guides:[...a.value.guides??[]]}}}function j(){$(Y())}function ee(){const G=M(Y());G?.templateData&&(a.value={...G.templateData,elements:G.elements})}function ue(){const G=P(Y());G?.templateData&&(a.value={...G.templateData,elements:G.elements})}function oe(){W(f.value)}function se(){W(f.value),A()}function ae(){const G=Q();G&&G.length>0&&(c.value.push(...G),j())}function L(){W(f.value);const G=Q();G&&G.length>0&&(G.forEach(te=>{te.options.left+=5,te.options.top+=5}),c.value.push(...G),E(G[0].id,!1),j())}function p(){r.value=100}const k=e.computed(()=>_());let B=!1,T=null;const g=300;function d(G,te){const X=f.value.filter(ne=>!ne.options.locked);X.length!==0&&(X.forEach(ne=>{ne.options.left+=G,ne.options.top+=te}),B||(B=!0,j()),T&&clearTimeout(T),T=setTimeout(()=>{B=!1,T=null},g))}function m(){I(c.value.map(G=>G.id))}function y(G){N(f.value,G),j()}function v(){c.value=K(c.value,u.value),j()}function b(){c.value=Z(c.value,u.value),j()}function A(){u.value.size!==0&&(c.value=c.value.filter(G=>!u.value.has(G.id)),C(),j())}const{setup:q,cleanup:de}=w.useKeyboard({onMove:d,onDelete:A,onCopy:oe,onPaste:ae,onSelectAll:m,onUndo:ee,onRedo:ue,onDuplicate:L,onResetZoom:p,onAlignLeft:()=>y("left"),onAlignRight:()=>y("right"),onAlignCenterH:()=>y("vertical"),onAlignTop:()=>y("top"),onAlignBottom:()=>y("bottom"),onGroup:v,onUngroup:b});let re=null;function me(){re=Y()}function ve(){if(!re)return;const G=new Map(re.elements.map(ce=>[ce.id,ce]));let te=!1;for(const ce of c.value){const ye=G.get(ce.id);if(!ye)continue;(ye.options.left!==ce.options.left||ye.options.top!==ce.options.top||ye.options.width!==ce.options.width||ye.options.height!==ce.options.height)&&w.finalizeElementZone(ce,a.value).rejected&&(te=!0)}te&&alert("该元素类型不能放入页眉/页脚");const X=ce=>`${ce.id}:${ce.zone||"content"}:${ce.options.left},${ce.options.top},${ce.options.width},${ce.options.height}`,ne=re.elements.map(X).join("|"),be=Y().elements.map(X).join("|");re=null,ne!==be&&j()}function fe(G,te){const X=w.zoneFromPaperPoint(a.value,te.x,te.y);if(X!=="content"&&!w.ZONE_ALLOWED_TYPES.includes(G.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const ne=w.getZoneRects(a.value)[X];return G.zone=X,G.options.left=te.x-ne.left,G.options.top=te.y-ne.top,X!=="content"&&w.clampToZone(G,ne),!0}function ge(G,te){const X=w.createRuntimeElement(G);te&&!fe(X,te)||(c.value.push(X),E(X.id,!1),j())}function he(G,te){const X=w.createFieldElement(G);te&&!fe(X,te)||(c.value.push(X),E(X.id,!1),j())}function we(G){if(u.value.size===0)return;const te=u.value.values().next().value,X=c.value.find(Ve=>Ve.id===te);if(!X)return;const ne=X.options.zIndex??0,be=c.value.map(Ve=>Ve.options.zIndex??0),ce=Math.max(...be,0),ye=Math.min(...be,0);switch(G){case"top":X.options.zIndex=ce+1;break;case"bottom":X.options.zIndex=ye-1;break;case"up":X.options.zIndex=ne+1;break;case"down":X.options.zIndex=ne-1;break}j()}function Ne(G,te){const{width:X,height:ne}=w.getPaperDimensions(a.value),be=96/25.4;r.value=w.computeFitScale(G,te,X*be,ne*be)}function De(G){a.value={...G},j()}function Re(){const G=c.value,te=X=>G.filter(ne=>(ne.zone||"content")===X).map(ne=>({id:ne.id,type:ne.printElementType.type,options:{...ne.options},printElementType:{...ne.printElementType}}));return{unit:"mm",...a.value,header:{...a.value.header,elements:te("header")},footer:{...a.value.footer,elements:te("footer")},firstPageOverlay:{...a.value.firstPageOverlay,elements:a.value.firstPageOverlay.elements.map(X=>({id:X.id||w.generateId(),type:X.printElementType?.type||"text",options:{...X.options},printElementType:{...X.printElementType}}))},elements:te("content"),guides:[...a.value.guides??[]]}}function Ie(G,te){const X=w.normalizeTemplateUnits(G);a.value=Ue(X),te&&(a.value={...a.value,elements:te.map(ne=>({...ne,id:ne.id||w.generateId(),zone:ne.zone||"content",options:{...ne.options},printElementType:{...ne.printElementType}}))}),$(Y())}return $(Y()),e.onMounted(()=>q()),e.onUnmounted(()=>{de(),T&&(clearTimeout(T),T=null)}),{scale:r,showRuler:t,showGrid:n,snapToGrid:l,showTableGhostBorder:i,templateData:a,elements:c,fields:h,selectedIds:u,selectedElements:f,selectedElement:s,select:E,clearSelection:C,selectAll:m,previewIds:O,setPreview:z,clearPreview:S,commitPreview:U,hasClipboard:k,copy:oe,paste:ae,cutSelected:se,tableSelection:V,setTableSelection:F,canUndo:x,canRedo:D,undo:ee,redo:ue,recordHistory:j,alignSelected:y,groupSelected:v,ungroupSelected:b,deleteSelected:A,duplicateSelected:L,resetZoom:p,dragStart:me,dragStop:ve,addElement:ge,addFieldElement:he,moveLayer:we,fitToWindow:Ne,updateTemplateData:De,getTemplateJson:Re,loadTemplate:Ie}}let qe=0;function Et(){return qe+=1,`guide-${qe}`}function kt(o,r){const t=e.computed(()=>o.value.guides??[]);function n(h){o.value={...o.value,guides:h([...o.value.guides??[]])},r()}function l(h,u){n(f=>(f.push({type:h,position:u,id:Et()}),f))}function i(h,u){n(f=>f.map(E=>E.id===h?{...E,position:u}:E))}function a(h){n(u=>u.filter(f=>f.id!==h))}function c(){const h=[],u=[];for(const f of t.value)f.type==="vertical"?h.push(f.position):u.push(f.position);return{vertical:h,horizontal:u}}return{guides:t,addGuide:l,moveGuide:i,removeGuide:a,getGuidePositions:c}}const Te=Symbol("table-edit"),Ge=Symbol("print-upload-image"),Vt=e.defineComponent({__name:"HelpButton",emits:["click"],setup(o){return(r,t)=>(e.openBlock(),e.createElementBlock("button",{class:"help-button",title:"帮助文档",onClick:t[0]||(t[0]=n=>r.$emit("click"))},[...t[1]||(t[1]=[e.createElementVNode("span",{class:"help-icon"},"?",-1)])]))}}),J=(o,r)=>{const t=o.__vccOpts||o;for(const[n,l]of r)t[n]=l;return t},wt=J(Vt,[["__scopeId","data-v-80ccab03"]]),Nt={class:"designer-toolbar"},Ct={class:"tb-group"},St={class:"tb-title"},Bt={class:"tb-title-name"},$t={class:"tb-group"},xt=["disabled"],Tt=["disabled"],Dt={key:0,class:"tb-group"},Mt={key:1,class:"tb-group"},zt={key:2,class:"tb-group"},Lt={key:3,class:"tb-group"},Pt={class:"tb-group"},Rt={class:"tb-zoom"},It={key:4,class:"tb-group"},At={class:"tb-group"},Ht={class:"tb-group"},Ft=e.defineComponent({__name:"DesignerToolbar",props:e.mergeModels({isEdit:{type:Boolean},canUndo:{type:Boolean},canRedo:{type:Boolean},hasMultiSelection:{type:Boolean},hasSelection:{type:Boolean},showRuler:{type:Boolean,default:!0},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},selectedElementHasGroup:{type:Boolean},overlayVisible:{type:Boolean},showLoadDefault:{type:Boolean},showHelp:{type:Boolean,default:!0}},{scale:{default:100},scaleModifiers:{}}),emits:e.mergeModels(["preview","save","load-default","undo","redo","align","move-layer","toggle-ruler","toggle-grid","toggle-snap","toggle-table-ghost-border","toggle-overlay","group","ungroup","add-overlay-element","fit-window","zoom","help"],["update:scale"]),setup(o){const r=e.useModel(o,"scale");return(t,n)=>(e.openBlock(),e.createElementBlock("div",Nt,[e.createElementVNode("div",Ct,[n[30]||(n[30]=e.createStaticVNode('<span class="tb-mark" aria-hidden="true" data-v-e6d10b59><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-e6d10b59><rect x="5" y="3" width="14" height="18" rx="2.5" data-v-e6d10b59></rect><line x1="8.5" y1="8.5" x2="15.5" y2="8.5" data-v-e6d10b59></line><line x1="8.5" y1="12.5" x2="15.5" y2="12.5" data-v-e6d10b59></line><line x1="8.5" y1="16.5" x2="12.5" y2="16.5" data-v-e6d10b59></line></svg></span>',1)),e.createElementVNode("div",St,[e.createElementVNode("span",Bt,e.toDisplayString(o.isEdit?"编辑模板":"新建模板"),1),n[29]||(n[29]=e.createElementVNode("span",{class:"tb-title-sub"},"打印模板设计器",-1))])]),e.createElementVNode("div",$t,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.canUndo,onClick:n[0]||(n[0]=l=>t.$emit("undo")),"data-tip":"撤销"},"↶",8,xt),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.canRedo,onClick:n[1]||(n[1]=l=>t.$emit("redo")),"data-tip":"重做"},"↷",8,Tt)]),o.hasMultiSelection?(e.openBlock(),e.createElementBlock("div",Dt,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[2]||(n[2]=l=>t.$emit("align","left")),title:"左对齐"},"⇤"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[3]||(n[3]=l=>t.$emit("align","right")),title:"右对齐"},"⇥"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[4]||(n[4]=l=>t.$emit("align","top")),title:"顶对齐"},"⇡"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[5]||(n[5]=l=>t.$emit("align","bottom")),title:"底对齐"},"⇣"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[6]||(n[6]=l=>t.$emit("align","vertical")),title:"水平居中"},"↔"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[7]||(n[7]=l=>t.$emit("align","horizontal")),title:"垂直居中"},"↕"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[8]||(n[8]=l=>t.$emit("align","distributeHor")),title:"水平分布"},"⇔"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[9]||(n[9]=l=>t.$emit("align","distributeVer")),title:"垂直分布"},"⇕")])):e.createCommentVNode("",!0),o.hasMultiSelection?(e.openBlock(),e.createElementBlock("div",Mt,[e.createElementVNode("button",{class:"tb-btn",onClick:n[10]||(n[10]=l=>t.$emit("group")),title:"组合"},"组合")])):e.createCommentVNode("",!0),!o.hasMultiSelection&&o.selectedElementHasGroup?(e.openBlock(),e.createElementBlock("div",zt,[e.createElementVNode("button",{class:"tb-btn",onClick:n[11]||(n[11]=l=>t.$emit("ungroup")),title:"取消组合"},"取消组合")])):e.createCommentVNode("",!0),o.hasSelection?(e.openBlock(),e.createElementBlock("div",Lt,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[12]||(n[12]=l=>t.$emit("move-layer","top")),"data-tip":"置顶"},"⤒"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[13]||(n[13]=l=>t.$emit("move-layer","up")),"data-tip":"上移一层"},"↑"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[14]||(n[14]=l=>t.$emit("move-layer","down")),"data-tip":"下移一层"},"↓"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[15]||(n[15]=l=>t.$emit("move-layer","bottom")),"data-tip":"置底"},"⤓")])):e.createCommentVNode("",!0),e.createElementVNode("div",Pt,[e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:o.showRuler}]),"data-tip":"显示/隐藏标尺",onClick:n[16]||(n[16]=l=>t.$emit("toggle-ruler"))},[...n[31]||(n[31]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 标尺 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:o.showGrid}]),"data-tip":"显示/隐藏网格背景",onClick:n[17]||(n[17]=l=>t.$emit("toggle-grid"))},[...n[32]||(n[32]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 网格 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:o.showTableGhostBorder}]),"data-tip":"显示/隐藏无边框表格的虚拟虚线",onClick:n[18]||(n[18]=l=>t.$emit("toggle-table-ghost-border"))},[...n[33]||(n[33]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 虚框 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:o.snapToGrid}]),"data-tip":"开启/关闭元素吸附到网格",onClick:n[19]||(n[19]=l=>t.$emit("toggle-snap"))},[...n[34]||(n[34]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 吸附 ",-1)])],2),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[20]||(n[20]=l=>t.$emit("fit-window")),"data-tip":"适应窗口"},"⤢"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[21]||(n[21]=l=>t.$emit("zoom",-10)),"data-tip":"缩小"},"−"),e.createElementVNode("span",Rt,e.toDisplayString(r.value)+"%",1),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[22]||(n[22]=l=>t.$emit("zoom",10)),"data-tip":"放大"},"+")]),n[35]||(n[35]=e.createElementVNode("div",{class:"tb-spacer"},null,-1)),o.showHelp?(e.openBlock(),e.createElementBlock("div",It,[e.createVNode(wt,{onClick:n[23]||(n[23]=l=>t.$emit("help"))})])):e.createCommentVNode("",!0),e.createElementVNode("div",At,[e.createElementVNode("button",{class:"tb-btn",onClick:n[24]||(n[24]=l=>t.$emit("add-overlay-element"))},"首页专属"),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{warn:o.overlayVisible}]),onClick:n[25]||(n[25]=l=>t.$emit("toggle-overlay"))},"叠层对比",2)]),e.createElementVNode("div",Ht,[o.showLoadDefault?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn-secondary",onClick:n[26]||(n[26]=l=>t.$emit("load-default"))},"加载默认布局")):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"btn-secondary",onClick:n[27]||(n[27]=l=>t.$emit("preview"))},"预览"),e.createElementVNode("button",{class:"btn-primary",onClick:n[28]||(n[28]=l=>t.$emit("save"))},"保存")])]))}}),Ut=J(Ft,[["__scopeId","data-v-e6d10b59"]]),Gt={class:"layer-panel"},Ot=["onClick"],Wt={class:"layer-icon"},qt={class:"layer-name"},Kt={key:0,class:"layer-zone"},Yt={class:"layer-zindex"},jt={key:0,class:"layer-actions"},Xt=e.defineComponent({__name:"LayerPanel",props:{elements:{},selectedIds:{}},emits:["select","move-layer"],setup(o){const r=o,t=e.computed(()=>[...r.elements].sort((c,h)=>(h.options.zIndex??0)-(c.options.zIndex??0))),n={text:"T",longText:"¶",table:"⊞",image:"🖼",barcode:"≡",qrcode:"▣",hline:"—",vline:"|",rect:"□",oval:"○",html:"<>"};function l(c){return n[c.printElementType.type]||"?"}function i(c){return c.options.title||c.printElementType.title||c.printElementType.type}function a(c){return c.zone==="header"?"页眉":c.zone==="footer"?"页脚":""}return(c,h)=>(e.openBlock(),e.createElementBlock("div",Gt,[h[4]||(h[4]=e.createElementVNode("div",{class:"panel-title"},"图层",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,u=>(e.openBlock(),e.createElementBlock("div",{key:u.id,class:e.normalizeClass(["layer-item",{active:o.selectedIds.has(u.id)}]),onClick:f=>c.$emit("select",u.id,!1)},[e.createElementVNode("span",Wt,e.toDisplayString(l(u)),1),e.createElementVNode("span",qt,e.toDisplayString(i(u)),1),a(u)?(e.openBlock(),e.createElementBlock("span",Kt,e.toDisplayString(a(u)),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Yt,"z:"+e.toDisplayString(u.options.zIndex??0),1)],10,Ot))),128)),t.value.length>0?(e.openBlock(),e.createElementBlock("div",jt,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:h[0]||(h[0]=u=>c.$emit("move-layer","top")),title:"置顶"}," ⤒ "),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:h[1]||(h[1]=u=>c.$emit("move-layer","up")),title:"上移"}," ↑ "),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:h[2]||(h[2]=u=>c.$emit("move-layer","down")),title:"下移"}," ↓ "),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:h[3]||(h[3]=u=>c.$emit("move-layer","bottom")),title:"置底"}," ⤓ ")])):e.createCommentVNode("",!0)]))}}),Zt=J(Xt,[["__scopeId","data-v-f7a10482"]]),Jt={class:"field-tree-panel"},Qt={class:"tree-container"},_t=["onClick"],eo={class:"expand-icon"},to={class:"node-icon"},oo={class:"group-label"},no=["onDragstart"],lo={class:"node-label"},ao={class:"node-key"},io={key:0,class:"pd-empty"},ro=e.defineComponent({__name:"FieldTreePanel",props:{fields:{}},emits:["field-drag"],setup(o,{emit:r}){const t=o,n=r,l=e.ref(""),i=e.ref(new Set),a=e.computed(()=>!!l.value.trim()),c=e.computed(()=>w.filterGroups(w.groupFields(t.fields),l.value));function h(f){const E=new Set(i.value);E.has(f)?E.delete(f):E.add(f),i.value=E}function u(f,E){f.dataTransfer?.setData("fieldData",JSON.stringify({fieldKey:E.fieldKey,fieldLabel:E.fieldLabel})),f.dataTransfer&&(f.dataTransfer.effectAllowed="copy"),n("field-drag",E)}return(f,E)=>(e.openBlock(),e.createElementBlock("div",Jt,[E[2]||(E[2]=e.createElementVNode("div",{class:"panel-title"},"业务字段",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":E[0]||(E[0]=C=>l.value=C),class:"pd-input search-input",type:"search",placeholder:"搜索字段...","aria-label":"搜索字段"},null,512),[[e.vModelText,l.value]]),e.createElementVNode("div",Qt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,C=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:C.key||"_top"},[C.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["field-group-header",{"is-list":C.isList}]),onClick:I=>h(C.key)},[e.createElementVNode("span",eo,e.toDisplayString(i.value.has(C.key)&&!a.value?"▶":"▼"),1),e.createElementVNode("span",to,e.toDisplayString(C.isList?"📋":"📁"),1),e.createElementVNode("span",oo,e.toDisplayString(C.label),1)],10,_t)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.fields,I=>(e.openBlock(),e.createElementBlock("div",{key:I.fieldKey,class:"field-row",draggable:"true",style:e.normalizeStyle({paddingLeft:(C.key?22:8)+"px"}),onDragstart:O=>u(O,I)},[E[1]||(E[1]=e.createElementVNode("span",{class:"node-icon"},"📄",-1)),e.createElementVNode("span",lo,e.toDisplayString(I.fieldLabel),1),e.createElementVNode("span",ao,"("+e.toDisplayString(I.fieldKey)+")",1)],44,no))),128))],512),[[e.vShow,!C.key||a.value||!i.value.has(C.key)]])],64))),128))]),c.value.length===0?(e.openBlock(),e.createElementBlock("p",io,"暂无字段")):e.createCommentVNode("",!0)]))}}),so=J(ro,[["__scopeId","data-v-9b326f07"]]),co={key:0,class:"left-collapsed"},uo={class:"left-head"},mo={class:"pd-tabs left-tabs"},po={class:"pd-tab-bar",role:"tablist"},vo={class:"pd-tab-pane",role:"tabpanel"},fo=["onDragstart"],go={class:"material-icon"},ho={class:"material-label"},bo={class:"pd-tab-pane",role:"tabpanel"},yo={class:"pd-tab-pane",role:"tabpanel"},Eo=e.defineComponent({__name:"LeftPanel",props:{fields:{},elements:{},selectedIds:{},collapsed:{type:Boolean}},emits:["select","move-layer","toggle-visible","toggle-locked","field-drag","toggle-collapse"],setup(o,{emit:r}){const t=r,n=e.ref("elements"),l=[{type:"text",label:"文本",icon:"T"},{type:"barcode",label:"条形码",icon:"▍▍"},{type:"qrcode",label:"二维码",icon:"▦"},{type:"image",label:"图片",icon:"▧"},{type:"table",label:"表格",icon:"⊞"},{type:"longText",label:"长文",icon:"¶"},{type:"hline",label:"横线",icon:"―"},{type:"vline",label:"竖线",icon:"│"},{type:"rect",label:"矩形",icon:"▭"},{type:"oval",label:"椭圆",icon:"◯"},{type:"html",label:"HTML",icon:"<>"}];function i(h,u){h.dataTransfer?.setData("elementType",u)}function a(h){t("field-drag",h)}function c(h){n.value=h,t("toggle-collapse")}return(h,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["left-panel",{collapsed:o.collapsed}])},[o.collapsed?(e.openBlock(),e.createElementBlock("div",co,[e.createElementVNode("button",{class:"lc-btn",title:"展开素材台",onClick:u[0]||(u[0]=f=>c(n.value))},"»"),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="elements"}]),title:"元素",onClick:u[1]||(u[1]=f=>c("elements"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="fields"}]),title:"字段",onClick:u[2]||(u[2]=f=>c("fields"))},"⊛",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="layers"}]),title:"图层",onClick:u[3]||(u[3]=f=>c("layers"))},"≡",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",uo,[u[12]||(u[12]=e.createElementVNode("span",{class:"left-title"},"素材台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起素材台",onClick:u[4]||(u[4]=f=>h.$emit("toggle-collapse"))},"«")]),e.createElementVNode("div",mo,[e.createElementVNode("div",po,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="elements"}]),onClick:u[5]||(u[5]=f=>n.value="elements")},"元素",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="fields"}]),onClick:u[6]||(u[6]=f=>n.value="fields")},"字段",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="layers"}]),onClick:u[7]||(u[7]=f=>n.value="layers")},"图层",2)]),e.withDirectives(e.createElementVNode("div",vo,[u[13]||(u[13]=e.createElementVNode("div",{class:"panel-title"},"拖拽元素到画布",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(l,f=>e.createElementVNode("div",{key:f.type,class:"material-card",draggable:"true",onDragstart:E=>i(E,f.type)},[e.createElementVNode("span",go,e.toDisplayString(f.icon),1),e.createElementVNode("span",ho,e.toDisplayString(f.label),1)],40,fo)),64))],512),[[e.vShow,n.value==="elements"]]),e.withDirectives(e.createElementVNode("div",bo,[e.createVNode(so,{fields:o.fields,onFieldDrag:a},null,8,["fields"])],512),[[e.vShow,n.value==="fields"]]),e.withDirectives(e.createElementVNode("div",yo,[e.createVNode(Zt,{elements:o.elements,"selected-ids":o.selectedIds,onSelect:u[8]||(u[8]=(f,E)=>h.$emit("select",f,E)),onMoveLayer:u[9]||(u[9]=f=>h.$emit("move-layer",f)),onToggleVisible:u[10]||(u[10]=f=>h.$emit("toggle-visible",f)),onToggleLocked:u[11]||(u[11]=f=>h.$emit("toggle-locked",f))},null,8,["elements","selected-ids"])],512),[[e.vShow,n.value==="layers"]])])],64))],2))}}),ko=J(Eo,[["__scopeId","data-v-15dad0f0"]]);function Vo(o,r){const t=e.ref(!1),n=e.ref(null);let l=0,i=0,a=0,c=0,h=!1;function u(z){if(r.disabled)return;const S=z.target;if(!(S instanceof HTMLElement)||S.classList.contains("resize-handle"))return;t.value=!0,h=z.altKey,l=z.clientX,i=z.clientY;const U=o.value;U&&(a=parseFloat(U.style.left)||0,c=parseFloat(U.style.top)||0,n.value={left:a,top:c,width:parseFloat(U.style.width)||0,height:parseFloat(U.style.height)||0},r.onStart?.({altKey:h}),document.addEventListener("mousemove",E),document.addEventListener("mouseup",C),z.preventDefault())}function f(z){const S=r.getScale?.()??1;let U=a+(z.clientX-l)/S,K=c+(z.clientY-i)/S;if(r.axis==="x"&&(K=c),r.axis==="y"&&(U=a),r.onAdsorb){const Z=o.value;if(Z){const W=parseFloat(Z.style.width)||0,Q=parseFloat(Z.style.height)||0,_=r.onAdsorb({left:U,top:K,width:W,height:Q});U=_.left,K=_.top}}return{left:U,top:K}}function E(z){const S=f(z);n.value&&(n.value.left=S.left,n.value.top=S.top),r.onDrag(S)}function C(z){t.value=!1;const S=f(z);r.onDragEnd?.(S,{altKey:h}),r.onStop?.(),n.value=null,document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",C)}function I(){const z=o.value;z&&z.removeEventListener("mousedown",u),document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",C)}function O(){I();const z=o.value;z&&z.addEventListener("mousedown",u)}return{isDragging:t,dragPreview:n,setup:O,cleanup:I}}const wo=e.defineComponent({__name:"TextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t={top:"flex-start",middle:"center",bottom:"flex-end"},n={left:"flex-start",center:"center",right:"flex-end"},l=e.computed(()=>{const a=r.element.options;return{fontSize:(a.fontSize||12)+"pt",fontWeight:a.fontWeight||"normal",fontFamily:a.fontFamily||"inherit",color:a.color||"#333",backgroundColor:a.backgroundColor||"transparent",textAlign:a.textAlign||"left",lineHeight:a.lineHeight?a.lineHeight+"pt":"normal",letterSpacing:a.letterSpacing?a.letterSpacing+"pt":"normal",textDecoration:a.textDecoration||"none",padding:`${a.contentPaddingTop||0}pt ${a.contentPaddingRight||0}pt ${a.contentPaddingBottom||0}pt ${a.contentPaddingLeft||0}pt`,width:"100%",height:"100%",boxSizing:"border-box",overflow:"hidden",...a.verticalAlign?{display:"flex",alignItems:t[a.verticalAlign]??"flex-start",justifyContent:n[a.textAlign||"left"]??"flex-start"}:{}}}),i=e.computed(()=>r.designMode?r.element.options.testData?r.element.options.testData:r.element.options.formatter||"文本":w.resolveTextBinding(r.element.options,r.data));return(a,c)=>(e.openBlock(),e.createElementBlock("div",{class:"print-text",style:e.normalizeStyle(l.value)},e.toDisplayString(i.value),5))}}),No={class:"print-image"},Co=["src"],So={key:1,class:"image-placeholder"},Bo=e.defineComponent({__name:"ImageElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.computed(()=>{const a=r.element.options.src||"";return a?a.includes("{")?r.designMode?w.evaluateTemplate(a,w.DEFAULT_DEMO_DATA):w.evaluateTemplate(a,r.data?.[0]||{}):a:""}),n=e.ref(!1);function l(){n.value=!0}e.watch(t,()=>{n.value=!1});const i=e.computed(()=>({objectFit:r.element.options.fit||"contain"}));return(a,c)=>(e.openBlock(),e.createElementBlock("div",No,[t.value&&!n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,style:e.normalizeStyle(i.value),onError:l},null,44,Co)):(e.openBlock(),e.createElementBlock("div",So,"图片"))]))}}),$o=J(Bo,[["__scopeId","data-v-007a2979"]]),xo=e.defineComponent({__name:"LongTextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t={top:"flex-start",middle:"center",bottom:"flex-end"},n={left:"flex-start",center:"center",right:"flex-end"},l=e.computed(()=>{const a=r.element.options;return{fontSize:(a.fontSize||12)+"pt",fontWeight:a.fontWeight||"normal",fontFamily:a.fontFamily||"inherit",color:a.color||"#333",backgroundColor:a.backgroundColor||"transparent",textAlign:a.textAlign||"left",lineHeight:a.lineHeight?a.lineHeight+"pt":"1.5",letterSpacing:a.letterSpacing?a.letterSpacing+"pt":"normal",textIndent:a.longTextIndent?a.longTextIndent+"pt":"0",width:"100%",height:"100%",overflow:"hidden",wordBreak:"break-all",boxSizing:"border-box",...a.verticalAlign?{display:"flex",alignItems:t[a.verticalAlign]??"flex-start",justifyContent:n[a.textAlign||"left"]??"flex-start"}:{}}}),i=e.computed(()=>r.designMode?r.element.options.formatter?r.element.options.formatter:"长文本内容":w.resolveTextBinding(r.element.options,r.data));return(a,c)=>(e.openBlock(),e.createElementBlock("div",{class:"print-longtext",style:e.normalizeStyle(l.value)},e.toDisplayString(i.value),5))}}),To=["title"],Do=["title","onClick"],Mo=e.defineComponent({__name:"TableContextMenu",props:{visible:{type:Boolean},x:{},y:{},canDeleteRow:{type:Boolean},canDeleteCol:{type:Boolean},mergeDisabledReason:{},canSplit:{type:Boolean},currentRowType:{},rowTypeDisabledReason:{type:Function}},emits:["action"],setup(o,{emit:r}){const t=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行"},{value:"summary",label:"汇总行"}],n=r;function l(i,a){n("action",i,a)}return(i,a)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[o.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"table-ctx-menu",style:e.normalizeStyle({left:o.x+"px",top:o.y+"px"}),onMousedown:a[8]||(a[8]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:"menu-item",onClick:a[0]||(a[0]=c=>l("insert-row-above"))},"在上方插入行"),e.createElementVNode("div",{class:"menu-item",onClick:a[1]||(a[1]=c=>l("insert-row-below"))},"在下方插入行"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canDeleteRow}]),onClick:a[2]||(a[2]=c=>o.canDeleteRow&&l("delete-row"))}," 删除行 ",2),a[9]||(a[9]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:"menu-item",onClick:a[3]||(a[3]=c=>l("insert-col-left"))},"在左侧插入列"),e.createElementVNode("div",{class:"menu-item",onClick:a[4]||(a[4]=c=>l("insert-col-right"))},"在右侧插入列"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canDeleteCol}]),onClick:a[5]||(a[5]=c=>o.canDeleteCol&&l("delete-col"))}," 删除列 ",2),a[10]||(a[10]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!!o.mergeDisabledReason}]),title:o.mergeDisabledReason||"",onClick:a[6]||(a[6]=c=>!o.mergeDisabledReason&&l("merge"))}," 合并单元格 ",10,To),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canSplit}]),onClick:a[7]||(a[7]=c=>o.canSplit&&l("split"))}," 拆分单元格 ",2),a[11]||(a[11]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),a[12]||(a[12]=e.createElementVNode("div",{class:"menu-group-title"},"行类型",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(t,c=>e.createElementVNode("div",{key:c.value,class:e.normalizeClass(["menu-item",{disabled:!!o.rowTypeDisabledReason(c.value),active:o.currentRowType===c.value}]),title:o.rowTypeDisabledReason(c.value)||"",onClick:h=>!o.rowTypeDisabledReason(c.value)&&l("set-row-type",c.value)},e.toDisplayString(c.label),11,Do)),64))],36)):e.createCommentVNode("",!0)]))}}),zo=J(Mo,[["__scopeId","data-v-44e319c1"]]),Lo={class:"cell-barcode"},Po=["src"],Ro={key:1,class:"cell-barcode-fallback"},Io=e.defineComponent({__name:"CellBarcode",props:{cellType:{},value:{},barcodeType:{},qrCodeLevel:{},showText:{type:Boolean},fit:{},maxWidth:{},maxHeight:{}},setup(o){const r=o,t=e.ref(null),n=e.ref(!1),l=e.ref(""),i=e.computed(()=>({objectFit:r.fit||"contain",maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"})),a=e.computed(()=>({objectFit:r.fit||"contain",maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}));function c(){if(n.value=!1,!!t.value)try{_e(t.value,r.value,{format:r.barcodeType||"CODE128",width:1,height:28,displayValue:r.showText!==!1,fontSize:9,margin:0}),n.value=!0}catch{}}async function h(){if(!r.value){l.value="";return}try{l.value=await et.toDataURL(r.value,{width:96,margin:1,errorCorrectionLevel:r.qrCodeLevel||"M"})}catch{l.value=""}}function u(){r.cellType==="barcode"?c():h()}return e.onMounted(u),e.watch(()=>[r.cellType,r.value,r.barcodeType,r.qrCodeLevel,r.showText],u),(f,E)=>(e.openBlock(),e.createElementBlock("div",Lo,[e.withDirectives((e.openBlock(),e.createElementBlock("svg",{ref_key:"barcodeSvg",ref:t,preserveAspectRatio:"xMidYMid meet",style:e.normalizeStyle(i.value)},null,4)),[[e.vShow,o.cellType==="barcode"&&n.value]]),o.cellType==="qrcode"&&l.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:l.value,alt:"qrcode",style:e.normalizeStyle(a.value)},null,12,Po)):e.createCommentVNode("",!0),!n.value&&o.cellType==="barcode"?(e.openBlock(),e.createElementBlock("span",Ro,e.toDisplayString(o.value||"条码"),1)):e.createCommentVNode("",!0)]))}}),Ao=J(Io,[["__scopeId","data-v-612f4008"]]),Ho={class:"cell-image"},Fo=["src"],Uo={key:1,class:"image-placeholder"},Go=e.defineComponent({__name:"CellImage",props:{value:{},fit:{},maxWidth:{},maxHeight:{},designMode:{type:Boolean},data:{}},setup(o){const r=o,t=e.computed(()=>{const a=r.value||"";return a?a.includes("{")?r.designMode?w.evaluateTemplate(a,w.DEFAULT_DEMO_DATA):w.evaluateTemplate(a,r.data?.[0]||{}):a:""}),n=e.ref(!1);function l(){n.value=!0}e.watch(t,()=>{n.value=!1});const i=e.computed(()=>({objectFit:r.fit||"contain",maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}));return(a,c)=>(e.openBlock(),e.createElementBlock("div",Ho,[t.value&&!n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,style:e.normalizeStyle(i.value),onError:l},null,44,Fo)):(e.openBlock(),e.createElementBlock("div",Uo,"图片"))]))}}),Oo=J(Go,[["__scopeId","data-v-d5bc444b"]]),Wo=["rowspan","colspan","onMousedown","onMouseenter","onDblclick","onContextmenu"],qo={key:2,class:"data-placeholder"},Ko={key:0,class:"col-resize-layer"},Yo=["aria-label","onMousedown"],jo={key:1,class:"row-badges"},ze=3.7795275591,Xo=.1,Zo=e.defineComponent({__name:"TableElement",props:{element:{},designMode:{type:Boolean},isSelected:{type:Boolean},showTableGhostBorder:{type:Boolean},scale:{},data:{}},emits:["dblclick-element","dblclick-cell"],setup(o,{emit:r}){const t={header:"题",data:"数",subtotal:"小",summary:"汇"},n=o,l=r,i=e.inject(Te,{tableSelection:e.ref(null),setTableSelection:()=>{},recordHistory:()=>{},maxTableWidth:e.ref(1/0)}),a=e.computed(()=>n.element.options.tableRows??[]),c=e.computed(()=>n.element.options.tableColWidths??[]),h=e.computed(()=>n.element.options.tableDefaultFontSize??10),u=e.computed(()=>n.element.options.tableDefaultColor??"#333333"),f=e.computed(()=>{const d=i.tableSelection.value;return d&&d.elementId===n.element.id?d:null});function E(d){let m=0;for(let y=0;y<d;y++)m+=a.value[y].height;return m}const C=e.ref(null),I=e.ref([]);function O(){if(!n.designMode)return;const d=C.value;if(!d)return;const m=d.offsetHeight;if(m<=0)return;const y=n.element.options,v=m/ze;Math.abs(v-(y.height??0))>Xo&&(y.height=Math.round(v*100)/100);const b=d.offsetTop;I.value=Array.from(d.rows).map(A=>({top:(A.offsetTop-b)/ze,height:A.offsetHeight/ze}))}function z(d){return I.value[d]?.top??E(d)}function S(d){return I.value[d]?.height??a.value[d]?.height??0}e.watch(()=>[n.element.options,n.designMode],()=>O(),{deep:!0,flush:"post"}),e.onMounted(()=>{O(),document.fonts?.ready.then(()=>O())});const U=e.computed(()=>{const d=n.element.options.dataSource;if(d&&Array.isArray(w.DEFAULT_DEMO_DATA[d]))return w.DEFAULT_DEMO_DATA[d];for(const m of Object.values(w.DEFAULT_DEMO_DATA))if(Array.isArray(m))return m}),K=e.computed(()=>{if(n.data)return n.data});function Z(d){return d.cellType==="barcode"||d.cellType==="qrcode"}function W(d,m){return Z(m)?w.resolveBarcodeDesignValue(m.formatter,U.value):m.formatter||""}function Q(d,m){const y=n.element.options,v={designMode:n.designMode,showGhostBorder:n.showTableGhostBorder};return{fontFamily:m.fontFamily||"inherit",textAlign:m.align??"left",verticalAlign:m.valign??"middle",fontSize:(m.fontSize??h.value)+"pt",fontWeight:m.fontWeight??"normal",color:m.color??u.value,backgroundColor:m.backgroundColor??"transparent",borderTop:w.resolveCellBorderCss(m.borders?.top,v),borderRight:w.resolveCellBorderCss(m.borders?.right,v),borderBottom:w.resolveCellBorderCss(m.borders?.bottom,v),borderLeft:w.resolveCellBorderCss(m.borders?.left,v),padding:(m.padding??y.tableDefaultPadding??1)+"mm",whiteSpace:m.wordWrap??!0?"normal":"nowrap",overflow:m.wordWrap??!0?"visible":"hidden"}}function _(d,m){const y=f.value;return{"cell-selected":!!y&&d>=y.r1&&d<=y.r2&&m>=y.c1&&m<=y.c2,"row-data-bg":a.value[d].type==="data"}}const N=e.ref(null);function $(d,m){const y=w.normalizeSelection(a.value,d,m);i.setTableSelection({elementId:n.element.id,...y})}function M(d,m,y){!n.designMode||!n.isSelected||(y.stopPropagation(),y.shiftKey&&f.value?$({r:f.value.r1,c:f.value.c1},{r:d,c:m}):(N.value={r:d,c:m},$({r:d,c:m},{r:d,c:m})),window.addEventListener("mouseup",()=>{N.value=null},{once:!0}))}function P(d,m){N.value&&$(N.value,{r:d,c:m})}function x(d,m){n.designMode&&l("dblclick-cell",n.element.id,d,m)}const D=e.reactive({visible:!1,x:0,y:0});function s(d,m,y){if(!n.designMode||!n.isSelected)return;const v=f.value;v&&d>=v.r1&&d<=v.r2&&m>=v.c1&&m<=v.c2||$({r:d,c:m},{r:d,c:m}),D.x=y.clientX,D.y=y.clientY,D.visible=!0,window.addEventListener("mousedown",()=>{D.visible=!1},{once:!0})}const V=e.computed(()=>{const d=f.value;return d?w.canMergeReason(a.value,d):"未选择单元格"}),F=e.computed(()=>{const d=f.value;if(!d)return!1;for(let m=d.r1;m<=d.r2;m++)for(let y=d.c1;y<=d.c2;y++){const v=a.value[m].cells[y];if(!v.merged&&((v.rowspan??1)>1||(v.colspan??1)>1))return!0}return!1});function Y(d){const m=f.value;if(!m)return"未选择单元格";if(m.r1!==m.r2)return"行类型仅支持单行设置";const y=JSON.parse(JSON.stringify(a.value));return w.setRowType(y,m.r1,d)}function j(){w.syncTableElementSize(n.element.options)}function ee(d,m){const y=i.maxTableWidth.value,v=d.reduce((b,A)=>b+A,0)+d[m];return v>y?`插入后表格总宽 ${Math.round(v*10)/10}mm 超过打印范围宽度 ${y}mm,请先缩小列宽`:null}function ue(d,m){const y=f.value;if(!y)return;D.visible=!1;const v=n.element.options,b=v.tableRows,A=v.tableColWidths;let q=null;switch(d){case"insert-row-above":w.insertRow(b,y.r1,"above");break;case"insert-row-below":w.insertRow(b,y.r2,"below");break;case"delete-row":q=w.deleteRow(b,y.r1);break;case"insert-col-left":q=ee(A,y.c1),q||w.insertCol(b,A,y.c1,"left");break;case"insert-col-right":q=ee(A,y.c2),q||w.insertCol(b,A,y.c2,"right");break;case"delete-col":q=w.deleteCol(b,A,y.c1);break;case"merge":w.mergeCells(b,y);break;case"split":w.splitCells(b,y);break;case"set-row-type":q=w.setRowType(b,y.r1,m);break}if(q){alert(q);return}i.setTableSelection(null),j(),i.recordHistory()}const oe=e.computed(()=>n.designMode&&!!n.isSelected&&!n.element.options.locked&&c.value.length>=1),se=e.computed(()=>Array.from({length:c.value.length},(d,m)=>m+1));function ae(d){return c.value.slice(0,d).reduce((m,y)=>m+y,0)}const L=e.ref(null);let p=0,k=0;function B(d,m){oe.value&&(L.value=d,p=m.clientX,k=c.value[d-1],document.addEventListener("mousemove",T),document.addEventListener("mouseup",g))}function T(d){if(L.value===null)return;const m=n.scale||1,y=(d.clientX-p)/(m*ze),v=L.value-1,b=n.element.options.tableColWidths;b[v]=w.clampResizedColumnWidth(b,v,k+y,i.maxTableWidth.value),j()}function g(){document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",g),L.value!==null&&(L.value=null,j(),i.recordHistory())}return e.onUnmounted(()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",g)}),(d,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["print-table",{"design-mode":o.designMode}]),onContextmenu:m[0]||(m[0]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("table",{ref_key:"tableRef",ref:C,style:e.normalizeStyle({fontSize:h.value+"pt",color:u.value})},[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(y,v)=>(e.openBlock(),e.createElementBlock("col",{key:v,style:e.normalizeStyle({width:y+"mm"})},null,4))),128))]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(y,v)=>(e.openBlock(),e.createElementBlock("tr",{key:y.id,style:e.normalizeStyle({height:y.height+"mm"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.cells,(b,A)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b.id},[b.merged?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:b.rowspan||1,colspan:b.colspan||1,class:e.normalizeClass(_(v,A)),style:e.normalizeStyle(Q(y,b)),onMousedown:e.withModifiers(q=>M(v,A,q),["left"]),onMouseenter:q=>P(v,A),onDblclick:e.withModifiers(q=>x(v,A),["stop"]),onContextmenu:e.withModifiers(q=>s(v,A,q),["prevent","stop"])},[Z(b)?(e.openBlock(),e.createBlock(Ao,{key:0,"cell-type":b.cellType,value:W(y,b),"barcode-type":b.barcodeType,"qr-code-level":b.qrCodeLevel,"show-text":b.showBarcodeText,fit:b.fit,"max-width":b.maxWidth,"max-height":b.maxHeight},null,8,["cell-type","value","barcode-type","qr-code-level","show-text","fit","max-width","max-height"])):b.cellType==="image"?(e.openBlock(),e.createBlock(Oo,{key:1,value:b.formatter||"",fit:b.fit,"max-width":b.maxWidth,"max-height":b.maxHeight,"design-mode":o.designMode,data:K.value},null,8,["value","fit","max-width","max-height","design-mode","data"])):y.type==="data"?(e.openBlock(),e.createElementBlock("span",qo,e.toDisplayString(W(y,b)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode(e.toDisplayString(W(y,b)),1)],64))],46,Wo))],64))),128))],4))),128))])],4),oe.value?(e.openBlock(),e.createElementBlock("div",Ko,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(se.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y,class:e.normalizeClass(["col-resize-handle",{dragging:L.value===y}]),role:"separator","aria-label":"列宽手柄"+y,style:e.normalizeStyle({left:ae(y)+"mm"}),onMousedown:e.withModifiers(v=>B(y,v),["stop","prevent"])},null,46,Yo))),128))])):e.createCommentVNode("",!0),o.designMode&&o.isSelected?(e.openBlock(),e.createElementBlock("div",jo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(y,v)=>(e.openBlock(),e.createElementBlock("span",{key:y.id,class:"row-badge",style:e.normalizeStyle({top:z(v)+"mm",height:S(v)+"mm"})},e.toDisplayString(t[y.type]),5))),128))])):e.createCommentVNode("",!0),e.createVNode(zo,{visible:D.visible,x:D.x,y:D.y,"can-delete-row":a.value.length>1,"can-delete-col":c.value.length>1,"merge-disabled-reason":V.value,"can-split":F.value,"current-row-type":f.value?a.value[f.value.r1]?.type??null:null,"row-type-disabled-reason":Y,onAction:ue},null,8,["visible","x","y","can-delete-row","can-delete-col","merge-disabled-reason","can-split","current-row-type"])],34))}}),Jo=J(Zo,[["__scopeId","data-v-725d973d"]]),Ke=e.defineComponent({__name:"LineElement",props:{element:{}},setup(o){const r=o,t=e.computed(()=>r.element.printElementType.type==="hline"),n=e.computed(()=>{const l=r.element.options,i=(l.borderWidth||.75)+"pt",a=l.borderStyle||"solid",c=l.borderColor||"#333";return t.value?{width:"100%",height:"0",borderTop:`${i} ${a} ${c}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${i} ${a} ${c}`,boxSizing:"border-box"}});return(l,i)=>(e.openBlock(),e.createElementBlock("div",{class:"print-line",style:e.normalizeStyle(n.value)},null,4))}}),Ye=e.defineComponent({__name:"ShapeElement",props:{element:{}},setup(o){const r=o,t=e.computed(()=>r.element.printElementType.type==="oval"),n=e.computed(()=>{const l=r.element.options;return{width:"100%",height:"100%",borderWidth:(l.borderWidth||1)+"pt",borderStyle:l.borderStyle||"solid",borderColor:l.borderColor||"#333",backgroundColor:l.backgroundColor||"transparent",borderRadius:t.value?"50%":"0",boxSizing:"border-box"}});return(l,i)=>(e.openBlock(),e.createElementBlock("div",{class:"print-shape",style:e.normalizeStyle(n.value)},null,4))}}),Qo={class:"print-barcode",ref:"containerRef"},_o=96/25.4,en=e.defineComponent({__name:"BarcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.ref(null);function n(){if(!t.value)return;const l=r.element.options,i=(r.designMode?l.testData||l.formatter:w.resolveTextBinding(l,r.data))||"条码",a=!l.hideTitle,c=(l.fontSize||12)*(96/72),h=(l.height||40)*_o,u=a?c+4:0,f=Math.max(8,h-u);try{_e(t.value,i,{format:l.barcodeType||"CODE128",width:l.barWidth?l.barWidth/2:1,height:f,displayValue:a,fontSize:c,margin:2})}catch{}}return e.onMounted(n),e.watch(()=>[r.element.options.formatter,r.element.options.testData,r.element.options.barcodeType,r.element.options.width,r.element.options.height,r.element.options.barWidth,r.element.options.hideTitle,r.element.options.fontSize],n),(l,i)=>(e.openBlock(),e.createElementBlock("div",Qo,[(e.openBlock(),e.createElementBlock("svg",{ref_key:"svgRef",ref:t,preserveAspectRatio:"xMidYMid meet"},null,512))],512))}}),tn=J(en,[["__scopeId","data-v-ca0cff7f"]]),on={class:"print-qrcode"},nn=["src"],ln=e.defineComponent({__name:"QrcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.ref("");async function n(){const l=r.element.options,i=(r.designMode?l.testData||l.formatter:w.resolveTextBinding(l,r.data))||"二维码",a=Math.min(l.width||80,l.height||80);try{t.value=await et.toDataURL(i,{width:a,margin:1,errorCorrectionLevel:String(l.qrCodeLevel??"M")})}catch{t.value=""}}return e.onMounted(n),e.watch(()=>[r.element.options.formatter,r.element.options.testData],n),(l,i)=>(e.openBlock(),e.createElementBlock("div",on,[t.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,alt:"qrcode"},null,8,nn)):e.createCommentVNode("",!0)]))}}),an=J(ln,[["__scopeId","data-v-dfb6875c"]]),rn=["innerHTML"],sn=e.defineComponent({__name:"HtmlElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.computed(()=>{if(r.element.options.formatter){const n=r.data&&r.data.length>0?r.data[0]:{},l=w.evaluateTemplate(r.element.options.formatter,n??{});return l?ft.sanitize(l):""}return'<div style="background:#e0e0e0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:10pt;color:#999">HTML</div>'});return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"print-html",innerHTML:t.value},null,8,rn))}}),dn=J(sn,[["__scopeId","data-v-880bbde5"]]),cn=e.defineComponent({__name:"PageNumberElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.computed(()=>{const l=r.element.options;return{fontSize:(l.fontSize||12)+"pt",fontWeight:l.fontWeight||"normal",fontFamily:l.fontFamily||"inherit",color:l.color||"#333",textAlign:l.textAlign||"left",lineHeight:l.lineHeight?l.lineHeight+"pt":"normal",letterSpacing:l.letterSpacing?l.letterSpacing+"pt":"normal"}}),n=e.computed(()=>r.designMode?r.element.options.title||"{pageIndex}/{totalPages}":r.element.options.title||"");return(l,i)=>(e.openBlock(),e.createElementBlock("div",{class:"page-number-element",style:e.normalizeStyle(t.value)},e.toDisplayString(n.value),5))}}),un=J(cn,[["__scopeId","data-v-38f1d7df"]]),mn={key:0,class:"drag-preview"},pn={key:1,class:"resize-handles"},vn=["onMousedown"],fn={key:2,class:"selected-indicator"},gn={class:"position-label"},hn=e.defineComponent({__name:"BaseElement",props:{element:{},isSelected:{type:Boolean},designMode:{type:Boolean},printData:{},scale:{},allElements:{},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},zone:{},adsorbHandler:{type:Function},clearAdsorbGuides:{type:Function}},emits:["select","update:element","drag-start","drag-stop","dblclick-element","dblclick-cell","contextmenu","clone-element"],setup(o,{emit:r}){const t=o,n=r,l=e.ref(null),i=e.inject(tt,null),a=e.computed(()=>i?.value?i.value.has(t.element.id):t.isSelected??!1),c=e.inject(ot,null),h=e.computed(()=>c?.value.has(t.element.id)??!1),u={text:e.markRaw(wo),image:e.markRaw($o),longText:e.markRaw(xo),table:e.markRaw(Jo),hline:e.markRaw(Ke),vline:e.markRaw(Ke),rect:e.markRaw(Ye),oval:e.markRaw(Ye),barcode:e.markRaw(tn),qrcode:e.markRaw(an),html:e.markRaw(dn),pageNumber:e.markRaw(un)},f=e.computed(()=>u[t.element.printElementType.type]),E=e.computed(()=>t.element.printElementType.type==="table"?{showTableGhostBorder:t.showTableGhostBorder,scale:t.scale}:{}),C=e.computed(()=>{const x=t.element.options;return{position:"absolute",left:x.left+"mm",top:x.top+"mm",width:x.width+"mm",height:x.height+"mm",zIndex:x.zIndex||"auto"}}),I=e.computed(()=>{const x=t.element.options;return`x:${Math.round(x.left)} y:${Math.round(x.top)} ${Math.round(x.width)}×${Math.round(x.height)}mm`});let O=0,z=0;const S=e.reactive({disabled:!t.designMode||!!t.element.options.locked,getScale:()=>(t.scale||1)*w.mmToPx(1),onDrag:x=>{const D=x.left-O,s=x.top-z;l.value&&(l.value.style.transform=`translate(${D}mm, ${s}mm)`)},onDragEnd:(x,D)=>{if(D.altKey){const F=JSON.parse(JSON.stringify(t.element));F.id=w.generateId(),F.options.left=x.left,F.options.top=x.top,n("clone-element",F,{left:x.left,top:x.top}),l.value&&(l.value.style.transform="");return}const s=x.left-O,V=x.top-z;if(t.element.options.left=x.left,t.element.options.top=x.top,l.value&&(l.value.style.transform=""),t.element.options.groupId&&t.allElements)for(const F of t.allElements)F.id!==t.element.id&&F.options.groupId===t.element.options.groupId&&(F.options.left+=s,F.options.top+=V)},onStart:()=>{O=t.element.options.left,z=t.element.options.top,n("select",t.element.id,!1),n("drag-start")},onStop:()=>{t.clearAdsorbGuides?.(),n("drag-stop")},onAdsorb:x=>{let D=x.left,s=x.top;return t.snapToGrid&&(D=Math.round(x.left/5)*5,s=Math.round(x.top/5)*5),t.adsorbHandler?t.adsorbHandler({id:t.element.id,left:D,top:s,width:t.element.options.width,height:t.element.options.height}):{left:D,top:s,lines:[]}}}),{setup:U,cleanup:K,isDragging:Z}=Vo(l,S);e.watchEffect(()=>{S.disabled=!t.designMode||!!t.element.options.locked});const W=e.computed(()=>a.value&&!!t.designMode&&!t.element.options.locked&&t.element.printElementType.type!=="table"),{startResize:Q,cleanup:_}=w.useResize({minWidth:3.5,minHeight:3.5,getScale:()=>(t.scale||1)*w.mmToPx(1),getRect:()=>({left:t.element.options.left,top:t.element.options.top,width:t.element.options.width,height:t.element.options.height}),onResize:x=>{t.element.options.left=x.left,t.element.options.top=x.top,t.element.options.width=x.width,t.element.options.height=x.height},onStart:()=>{n("drag-start")},onStop:()=>{n("drag-stop")}});function N(x){t.designMode&&n("select",t.element.id,x.ctrlKey||x.metaKey)}function $(){t.designMode&&n("dblclick-element",t.element.id)}function M(x,D,s){t.designMode&&n("dblclick-cell",x,D,s)}e.onMounted(()=>{t.designMode&&U()});function P(){K(),_(),t.clearAdsorbGuides?.()}return e.onUnmounted(()=>{P()}),(x,D)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:l,class:e.normalizeClass(["print-element",{selected:a.value,previewed:h.value,"design-mode":o.designMode,locked:o.element.options.locked,hidden:o.element.options.visible===!1,"drag-ghost":e.unref(Z),[`type-${o.element.printElementType.type}`]:!0,[`zone-${o.zone||"content"}`]:!0}]),style:e.normalizeStyle(C.value),onMousedown:e.withModifiers(N,["stop"]),onDblclick:e.withModifiers($,["stop"]),onContextmenu:D[0]||(D[0]=e.withModifiers(s=>x.$emit("contextmenu",o.element.id,s),["prevent","stop"]))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(f.value),e.mergeProps({element:o.element,data:o.printData,"design-mode":o.designMode,"is-selected":a.value},E.value,{onDblclickCell:M}),null,16,["element","data","design-mode","is-selected"])),e.unref(Z)?(e.openBlock(),e.createElementBlock("div",mn)):e.createCommentVNode("",!0),W.value?(e.openBlock(),e.createElementBlock("div",pn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(w.RESIZE_POINTS),s=>(e.openBlock(),e.createElementBlock("div",{key:s,class:e.normalizeClass(["resize-handle",`handle-${s}`]),onMousedown:e.withModifiers(V=>e.unref(Q)(s,V),["stop"])},null,42,vn))),128))])):e.createCommentVNode("",!0),a.value&&o.designMode?(e.openBlock(),e.createElementBlock("div",fn,[e.createElementVNode("div",gn,e.toDisplayString(I.value),1)])):e.createCommentVNode("",!0)],38))}}),He=J(hn,[["__scopeId","data-v-c1100c7b"]]);function bn(o={}){const r=e.ref([]),t=e.ref({width:0,height:0});function n(a,c,h){return w.computeAdsorb(a,c,h,o)}function l(a,c,h){r.value=a,t.value={width:c,height:h}}function i(){r.value=[]}return{check:n,renderLines:l,clearLines:i,guideLines:r,paperSize:t}}function yn(o){const{check:r,renderLines:t,clearLines:n,guideLines:l,paperSize:i}=bn(o.config??{adsorbMin:1,adsorbLineMin:2,showAdsorbLine:!0});function a(h){const u=o.getElements().filter(C=>C.id!==h.id).map(C=>({id:C.id,left:C.options.left,top:C.options.top,width:C.options.width,height:C.options.height})),f=r(h,u,o.getGuides?.()),E=o.getPaperSize();return t(f.lines,E.width,E.height),f}function c(){n()}return{requestAdsorb:a,clearGuides:c,guideLines:l,paperSize:i}}const En={key:0,class:"zone-label"},kn={key:0,class:"zone-height-tip"},Vn={key:0,class:"zone-label"},wn={key:0,class:"zone-height-tip"},Nn=["onMousedown","onDblclick"],Cn=e.defineComponent({__name:"CanvasPaper",props:{templateData:{},runtimeElements:{},designMode:{type:Boolean},printData:{},scale:{},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},guides:{}},emits:["select","drag-start","drag-stop","dblclick-element","dblclick-cell","contextmenu","zone-height-change","zone-height-commit","guide-move","guide-remove","clone-element"],setup(o,{expose:r,emit:t}){const n=o,l=t,i=e.ref(null),a=e.computed(()=>w.getPaperDimensions(n.templateData).width),c=e.computed(()=>w.getPaperDimensions(n.templateData).height),h=e.computed(()=>`${8/(n.scale||1)}px`),u=e.computed(()=>{const p=n.scale||1,k=w.mmToPx(a.value)*p,B=w.mmToPx(c.value)*p;return{width:k+"px",height:B+"px",position:"relative"}}),f=e.computed(()=>{const p=n.templateData.margins,k=n.templateData.header.height,B=n.templateData.footer.height,T=a.value-p.left-p.right;return{header:{left:p.left,top:p.top,width:T,height:k},content:{left:p.left,top:p.top+k,width:T,height:c.value-p.top-p.bottom-k-B},footer:{left:p.left,top:c.value-p.bottom-B,width:T,height:B}}});function E(p){return{position:"absolute",left:p.left+"mm",top:p.top+"mm",width:p.width+"mm",height:p.height+"mm"}}const C=e.computed(()=>{const p={header:[],footer:[],content:[]};for(const k of n.runtimeElements)k.zone==="header"?p.header.push(k):k.zone==="footer"?p.footer.push(k):p.content.push(k);return p}),I=e.computed(()=>C.value.header),O=e.computed(()=>C.value.footer),z=e.computed(()=>C.value.content);let S="content";const{requestAdsorb:U,clearGuides:K,guideLines:Z,paperSize:W}=yn({getElements:()=>C.value[S],getPaperSize:()=>{const p=f.value[S];return{width:p.width,height:p.height}},getGuides:()=>{const p=[],k=[];for(const B of n.guides??[])B.type==="vertical"?p.push(B.position):k.push(B.position);return{vertical:p,horizontal:k}}});function Q(p){S=n.runtimeElements.find(T=>T.id===p.id)?.zone||"content";const B=U(p);return(B.left!==p.left||B.top!==p.top)&&s(B.left+p.width/2,B.top+p.height/2),B}function _(p,k){const B=k.position,T=p.clientX,g=p.clientY,d=n.scale??1,m=25.4/96,y=b=>{const A=(k.type==="vertical"?b.clientX-T:b.clientY-g)/d*m,q=k.type==="vertical"?a.value:c.value,de=Math.min(Math.max(B+A,0),q);l("guide-move",k.id,de)},v=()=>{window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",v)};window.addEventListener("mousemove",y),window.addEventListener("mouseup",v)}const N=e.computed(()=>({width:a.value+"mm",minHeight:c.value+"mm",background:n.templateData.pageBackground||"var(--pd-paper, #fff)",boxShadow:"var(--pd-shadow-paper, 0 1px 2px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08))",overflow:"hidden",position:"relative",transform:n.scale?`scale(${n.scale})`:void 0,transformOrigin:"0 0"})),$=e.computed(()=>{const p=n.templateData.margins;return{padding:`${p.top}mm ${p.right}mm ${p.bottom}mm ${p.left}mm`,position:"relative",boxSizing:"border-box",minHeight:c.value+"mm"}}),M=e.computed(()=>({backgroundImage:`url("data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M0 .5H20M.5 0V20" fill="none" stroke="rgba(0,0,0,0.08)" stroke-width="1" stroke-dasharray="4 4"/></svg>')}")`,backgroundSize:"5mm 5mm",backgroundPosition:"0 0"}));let P=0,x=null;const D=e.ref(null);function s(p,k){P+=1,D.value={left:p,top:k,key:P},x&&clearTimeout(x),x=setTimeout(()=>{D.value=null},300)}const V=e.computed(()=>{const p=n.templateData.watermark;return p?!p.mode||p.mode==="fixed"?!!p.content&&p.content.trim().length>0:!!p.binding:!1}),F=e.computed(()=>{const p=n.templateData.watermark||{},k=p.color||"#cccccc",B=p.opacity??.15,T=p.rotate??-30;let g=Y(p);if(p.timestamp){const d=new Date,m=`${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,"0")}-${String(d.getDate()).padStart(2,"0")} ${String(d.getHours()).padStart(2,"0")}:${String(d.getMinutes()).padStart(2,"0")}`;g=g?`${g} ${m}`:m}return{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"0",overflow:"hidden",opacity:String(B),backgroundImage:j(g,k,T),backgroundRepeat:"repeat"}});function Y(p){if(!p.mode||p.mode==="fixed")return p.content||"";if(p.binding){const k=n.printData?.[0];return k&&k[p.binding]!==void 0&&k[p.binding]!==null?String(k[p.binding]):p.testData||`[${p.binding}]`}return""}function j(p,k,B){const T=p.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),g=`<svg xmlns="http://www.w3.org/2000/svg" width="260" height="180">
2
- <text x="130" y="90" font-size="16" fill="${k}" text-anchor="middle" dominant-baseline="middle" transform="rotate(${B},130,90)">${T}</text>
3
- </svg>`;return`url("data:image/svg+xml,${encodeURIComponent(g)}")`}const ee=e.ref(null);function ue(p,k){ae(),ee.value={zone:p,startY:k.clientY,startH:n.templateData[p].height},window.addEventListener("mousemove",oe),window.addEventListener("mouseup",se)}function oe(p){if(!ee.value)return;const{zone:k,startY:B,startH:T}=ee.value,d=(p.clientY-B)/(n.scale||1)*25.4/96,m=k==="header"?d:-d,y=Math.min(100,c.value-n.templateData.margins.top-n.templateData.margins.bottom-(k==="header"?n.templateData.footer.height:n.templateData.header.height)-10),v=Math.min(y,Math.max(0,Math.round((T+m)*10)/10));l("zone-height-change",k,v)}function se(){if(!ee.value)return;const p=ee.value.zone;ee.value=null,window.removeEventListener("mousemove",oe),window.removeEventListener("mouseup",se),l("zone-height-commit",p)}function ae(){window.removeEventListener("mousemove",oe),window.removeEventListener("mouseup",se),ee.value=null}e.onUnmounted(()=>{ae(),x&&clearTimeout(x)});function L(p,k){l("select",p,k)}return r({contentRef:i}),(p,k)=>(e.openBlock(),e.createElementBlock("div",{class:"paper-wrapper",style:e.normalizeStyle(u.value)},[e.createElementVNode("div",{class:"hiprint-printPaper",style:e.normalizeStyle(N.value)},[e.createElementVNode("div",{class:"hiprint-printPaper-content",ref_key:"contentRef",ref:i,style:e.normalizeStyle($.value)},[o.showGrid&&o.designMode?(e.openBlock(),e.createElementBlock("div",{key:0,class:"grid-bg",style:e.normalizeStyle(M.value)},null,4)):e.createCommentVNode("",!0),D.value?(e.openBlock(),e.createElementBlock("div",{key:D.value.key,class:"snap-indicator",style:e.normalizeStyle({left:D.value.left+"mm",top:D.value.top+"mm"})},null,4)):e.createCommentVNode("",!0),V.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:"watermark-layer",style:e.normalizeStyle(F.value)},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-header",{"design-mode":o.designMode}]),style:e.normalizeStyle(E(f.value.header))},[o.designMode?(e.openBlock(),e.createElementBlock("span",En,"页眉")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,B=>(e.openBlock(),e.createBlock(He,{key:B.id,element:B,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":I.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"header","adsorb-handler":Q,"clear-adsorb-guides":e.unref(K),onSelect:L,onDragStart:k[0]||(k[0]=T=>p.$emit("drag-start")),onDragStop:k[1]||(k[1]=T=>p.$emit("drag-stop")),onDblclickElement:k[2]||(k[2]=T=>p.$emit("dblclick-element",T)),onDblclickCell:k[3]||(k[3]=(T,g,d)=>p.$emit("dblclick-cell",T,g,d)),onContextmenu:k[4]||(k[4]=(T,g)=>p.$emit("contextmenu",T,g)),onCloneElement:(T,g)=>p.$emit("clone-element",T,g)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),o.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-bottom",onMousedown:k[5]||(k[5]=e.withModifiers(B=>ue("header",B),["prevent","stop"]))},[ee.value?.zone==="header"?(e.openBlock(),e.createElementBlock("div",kn,e.toDisplayString(o.templateData.header.height.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)],6),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-content",{"design-mode":o.designMode}]),style:e.normalizeStyle(E(f.value.content))},[o.designMode&&o.templateData.firstPageOverlay.height>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:"zone-overlay",style:e.normalizeStyle({height:o.templateData.firstPageOverlay.height+"mm"})},[...k[17]||(k[17]=[e.createElementVNode("span",{class:"zone-label"},"首页叠加",-1)])],4)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,B=>(e.openBlock(),e.createBlock(He,{key:B.id,element:B,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":z.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"content","adsorb-handler":Q,"clear-adsorb-guides":e.unref(K),onSelect:L,onDragStart:k[6]||(k[6]=T=>p.$emit("drag-start")),onDragStop:k[7]||(k[7]=T=>p.$emit("drag-stop")),onDblclickElement:k[8]||(k[8]=T=>p.$emit("dblclick-element",T)),onDblclickCell:k[9]||(k[9]=(T,g,d)=>p.$emit("dblclick-cell",T,g,d)),onContextmenu:k[10]||(k[10]=(T,g)=>p.$emit("contextmenu",T,g)),onCloneElement:(T,g)=>p.$emit("clone-element",T,g)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128))],6),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-footer",{"design-mode":o.designMode}]),style:e.normalizeStyle(E(f.value.footer))},[o.designMode?(e.openBlock(),e.createElementBlock("span",Vn,"页脚")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(O.value,B=>(e.openBlock(),e.createBlock(He,{key:B.id,element:B,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":O.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"footer","adsorb-handler":Q,"clear-adsorb-guides":e.unref(K),onSelect:L,onDragStart:k[11]||(k[11]=T=>p.$emit("drag-start")),onDragStop:k[12]||(k[12]=T=>p.$emit("drag-stop")),onDblclickElement:k[13]||(k[13]=T=>p.$emit("dblclick-element",T)),onDblclickCell:k[14]||(k[14]=(T,g,d)=>p.$emit("dblclick-cell",T,g,d)),onContextmenu:k[15]||(k[15]=(T,g)=>p.$emit("contextmenu",T,g)),onCloneElement:(T,g)=>p.$emit("clone-element",T,g)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),o.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-top",onMousedown:k[16]||(k[16]=e.withModifiers(B=>ue("footer",B),["prevent","stop"]))},[ee.value?.zone==="footer"?(e.openBlock(),e.createElementBlock("div",wn,e.toDisplayString(o.templateData.footer.height.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)],6),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Z),(B,T)=>(e.openBlock(),e.createElementBlock("div",{key:T,class:e.normalizeClass(["adsorb-guide",[`guide-${B.type}`]]),style:e.normalizeStyle(B.type==="vertical"?{left:B.position+"mm",top:"0",height:e.unref(W).height+"mm",borderLeftColor:B.color||"var(--pd-accent-secondary, #f56c6c)"}:{top:B.position+"mm",left:"0",width:e.unref(W).width+"mm",borderTopColor:B.color||"var(--pd-accent-secondary, #f56c6c)"})},null,6))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.guides,B=>(e.openBlock(),e.createElementBlock("div",{key:"mg-"+B.id,class:e.normalizeClass(["manual-guide",[`guide-${B.type}`]]),style:e.normalizeStyle(B.type==="vertical"?{left:B.position+"mm",top:"0",height:c.value+"mm","--guide-hit":h.value}:{top:B.position+"mm",left:"0",width:a.value+"mm","--guide-hit":h.value}),onMousedown:e.withModifiers(T=>_(T,B),["prevent","stop"]),onDblclick:e.withModifiers(T=>B.id&&l("guide-remove",B.id),["prevent","stop"])},null,46,Nn))),128))],4)],4)],4))}}),Sn=J(Cn,[["__scopeId","data-v-de85ab4d"]]),Bn=e.defineComponent({__name:"Ruler",props:{orientation:{},viewportPx:{},originPx:{},paperLengthMM:{},scale:{},cursorPx:{}},emits:["add-guide","guide-dragging"],setup(o,{emit:r}){const t=o,n=r,l=e.computed(()=>t.orientation==="horizontal"),i=e.computed(()=>l.value?"vertical":"horizontal"),a=e.ref(null),c=e.ref(null),h=e.computed(()=>c.value??t.cursorPx??null),u=e.computed(()=>l.value?{width:t.viewportPx+"px",height:w.RULER_THICKNESS+"px"}:{width:w.RULER_THICKNESS+"px",height:t.viewportPx+"px"});let f=0;function E(){f||(f=requestAnimationFrame(()=>{f=0,C()}))}function C(){const N=a.value;if(!N)return;const $=N.getContext("2d");if(!$)return;const M=window.devicePixelRatio||1,P=Math.max(0,Math.round(t.viewportPx)),x=w.RULER_THICKNESS;N.width=(l.value?P:x)*M,N.height=(l.value?x:P)*M,$.setTransform(M,0,0,M,0,0);const D=getComputedStyle(N),s=D.getPropertyValue("--pd-ruler-bg").trim()||"#F8F9FC",V=D.getPropertyValue("--pd-ruler").trim()||"#9AA1AF",F=D.getPropertyValue("--pd-accent").trim()||"#165DFF";$.fillStyle=s,$.fillRect(0,0,l.value?P:x,l.value?x:P);const Y=t.scale>0?t.scale:1,j=w.mmToPx(1)*Y;if(j<=0)return;const ee=-t.originPx/j,ue=(P-t.originPx)/j,oe=w.chooseMajorStepMM(Y),se=w.buildRulerTicks(ee,ue,oe);I($,se,j,V,!0),I($,se,j,V,!1),O($,0,F),O($,t.paperLengthMM,F);const ae=h.value;if(ae!==null&&ae>=0&&ae<=P){if($.strokeStyle=F,$.lineWidth=1.5,$.beginPath(),l.value){const L=Math.round(ae)+.5;$.moveTo(L,0),$.lineTo(L,x)}else{const L=Math.round(ae)+.5;$.moveTo(0,L),$.lineTo(x,L)}$.stroke()}}function I(N,$,M,P,x){N.strokeStyle=P,N.fillStyle=P,N.globalAlpha=x?.32:1,N.lineWidth=1,N.font="9px ui-monospace, Menlo, monospace",N.textBaseline="top";for(const D of $){if((D.mm<0||D.mm>t.paperLengthMM)!==x)continue;const V=Math.round(t.originPx+D.mm*M)+.5,F=D.major?8:4;N.beginPath(),l.value?(N.moveTo(V,0),N.lineTo(V,F)):(N.moveTo(0,V),N.lineTo(F,V)),N.stroke(),D.major&&D.label&&(l.value?N.fillText(D.label,V+2,11):(N.save(),N.translate(11,V+2),N.rotate(-Math.PI/2),N.fillText(D.label,0,0),N.restore()))}N.globalAlpha=1}function O(N,$,M){const P=w.mmToPx(1)*(t.scale>0?t.scale:1),x=Math.round(t.originPx+$*P)+.5;x<=0||x>=t.viewportPx||(N.strokeStyle=M,N.globalAlpha=.55,N.lineWidth=1,N.beginPath(),l.value?(N.moveTo(x,0),N.lineTo(x,w.RULER_THICKNESS)):(N.moveTo(0,x),N.lineTo(w.RULER_THICKNESS,x)),N.stroke(),N.globalAlpha=1)}e.watch(()=>[t.viewportPx,t.originPx,t.paperLengthMM,t.scale,t.cursorPx,t.orientation],E),e.onMounted(E),e.onBeforeUnmount(()=>{f&&cancelAnimationFrame(f)});let z=!1;function S(N){const $=a.value;if(!$)return null;const M=$.getBoundingClientRect(),P=l.value?N.clientX-M.left:N.clientY-M.top;if(P<0||P>t.viewportPx)return null;const x=w.mmToPx(1)*(t.scale>0?t.scale:1);return(P-t.originPx)/x}function U(N){z=!0,N.preventDefault(),window.addEventListener("mousemove",Q),window.addEventListener("mouseup",_),W(N)}function K(N){const $=a.value;if(!$)return;const M=$.getBoundingClientRect();c.value=l.value?N.clientX-M.left:N.clientY-M.top,E()}function Z(){c.value=null,E()}function W(N){const $=S(N);n("guide-dragging",$)}function Q(N){z&&W(N)}function _(N){if(!z)return;z=!1,window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",_);const $=S(N);$!==null&&$>=0&&$<=t.paperLengthMM&&n("add-guide",i.value,$),n("guide-dragging",null)}return e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",_)}),(N,$)=>(e.openBlock(),e.createElementBlock("canvas",{ref_key:"canvasRef",ref:a,class:e.normalizeClass(["pd-ruler",`is-${o.orientation}`]),style:e.normalizeStyle(u.value),onMousedown:U,onMousemove:K,onMouseleave:Z},null,38))}}),je=J(Bn,[["__scopeId","data-v-86284054"]]),$n={class:"canvas-scroll"},xn={key:0,class:"overlay-layer"},Tn=["src"],Le=96/25.4,Dn=e.defineComponent({__name:"CanvasArea",props:{templateData:{},elements:{},scale:{},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},hasClipboard:{type:Boolean},guides:{},overlayVisible:{type:Boolean},screenshotUrl:{},overlayOpacity:{},selectedElementHasGroup:{type:Boolean},showRuler:{type:Boolean,default:!0}},emits:["select","drop-element","drop-field","drag-start","drag-stop","dblclick-element","dblclick-cell","zone-height-change","zone-height-commit","select-all","clear-selection","preview","commit-preview","paste","copy","cut","delete","move-layer","group","ungroup","coordinate","add-guide","guide-move","guide-remove","zoom","clone-element"],setup(o,{expose:r,emit:t}){const n=o,l=t;function i(g,d){l("select",g,d)}const a=e.ref(null),c=e.computed(()=>w.getPaperDimensions(n.templateData).width),h=e.computed(()=>w.getPaperDimensions(n.templateData).height),u=e.reactive({originX:0,originY:0,viewW:0,viewH:0,paperScale:1}),f=e.reactive({x:null,y:null}),E=e.reactive({x:0,y:0}),C=e.computed(()=>({transform:`translate(${E.x}px, ${E.y}px)`}));function I(){const g=a.value,d=g?.querySelector(".hiprint-printPaper");if(!g||!d)return;const m=g.getBoundingClientRect(),y=d.getBoundingClientRect(),v=n.scale||1,b=y.width/w.mmToPx(c.value);u.paperScale=Math.abs(b-v)<.002?v:b,u.originX=y.left-m.left-w.RULER_THICKNESS,u.originY=y.top-m.top-w.RULER_THICKNESS,u.viewW=g.clientWidth-w.RULER_THICKNESS,u.viewH=g.clientHeight-w.RULER_THICKNESS}function O(){E.x=a.value?.scrollLeft??0,E.y=a.value?.scrollTop??0,I()}let z=null,S=0;function U(){cancelAnimationFrame(S);const g=performance.now()+220,d=()=>{I(),performance.now()<g&&(S=requestAnimationFrame(d))};S=requestAnimationFrame(d)}const K=e.ref(null);function Z(g,d){K.value=d===null?null:{type:g,mm:d}}const W=e.computed(()=>{const g=K.value,d=a.value?.querySelector(".hiprint-printPaper");if(!g||!d)return{};const m=d.getBoundingClientRect(),y=m.width/w.mmToPx(c.value),v=w.mmToPx(g.mm)*(y>0?y:n.scale||1);return g.type==="vertical"?{left:m.left+v+"px",top:m.top+"px",height:m.height+"px"}:{left:m.left+"px",top:m.top+v+"px",width:m.width+"px"}});function Q(g){const d=a.value?.querySelector(".hiprint-printPaper");if(!d)return;const m=d.getBoundingClientRect(),y=n.scale||1,v=w.pxToMm((g.clientX-m.left)/y),b=w.pxToMm((g.clientY-m.top)/y);if(!(v<0||b<0))return{x:v,y:b}}function _(g){const d=Q(g),m=g.dataTransfer?.getData("fieldData");if(m)try{const v=JSON.parse(m);l("drop-field",v,d);return}catch{}const y=g.dataTransfer?.getData("elementType");y&&l("drop-element",y,d)}const N=e.reactive({visible:!1,x:0,y:0,w:0,h:0});let $={x:0,y:0};function M(g){return!g||!(g instanceof HTMLElement)?!1:!!(g===a.value||g.classList.contains("canvas-scroll")||g.classList.contains("hiprint-printPaper")||g.classList.contains("hiprint-printPaper-content")||g.classList.contains("zone-layer")||g.classList.contains("grid-bg")||g.classList.contains("watermark-layer"))}function P(g){const d=a.value,m=d?.querySelector(".hiprint-printPaper");if(!d||!m)return;const y=d.getBoundingClientRect();f.x=g.clientX-y.left-w.RULER_THICKNESS,f.y=g.clientY-y.top-w.RULER_THICKNESS;const v=m.getBoundingClientRect(),b=n.scale||1,A=w.pxToMm((g.clientX-v.left)/b),q=w.pxToMm((g.clientY-v.top)/b);if(A<0||q<0){l("coordinate",null);return}l("coordinate",{x:A,y:q})}function x(){l("coordinate",null),f.x=null,f.y=null}function D(g,d,m,y){const v=a.value;if(!v)return;const b=Math.max(y,Math.round(g)),A=Math.round((n.scale||1)*100);if(b===A)return;const q=n.scale||1,de=b/100/q,re=getComputedStyle(v),me=parseFloat(re.paddingLeft)||0,ve=parseFloat(re.paddingTop)||0,fe=v.scrollLeft+d-me,ge=v.scrollTop+m-ve;l("zoom",b-A),e.nextTick(()=>{const he=getComputedStyle(v),we=parseFloat(he.paddingLeft)||0,Ne=parseFloat(he.paddingTop)||0;v.scrollLeft=fe*de-d+we,v.scrollTop=ge*de-m+Ne})}function s(g){if(!(g.ctrlKey||g.metaKey))return;g.preventDefault();const d=a.value;if(!d)return;const m=Math.round((n.scale||1)*100),y=w.nextWheelScale(m,g.deltaY>0?-1:1);if(y===m)return;const v=d.getBoundingClientRect();D(y,g.clientX-v.left,g.clientY-v.top,w.MIN_SCALE_PERCENT)}function V(g){const d=a.value;if(!d)return;const m=Math.round((n.scale||1)*100),y=w.nextWheelScale(m,g);D(y,d.clientWidth/2,d.clientHeight/2,w.MIN_SCALE_PERCENT)}function F(g){const d=a.value;d&&D(g,d.clientWidth/2,d.clientHeight/2,w.FIT_SCALE_MIN_PERCENT)}function Y(g){g.button!==2&&M(g.target)&&(l("clear-selection"),$={x:g.clientX,y:g.clientY},N.visible=!0,N.x=g.clientX,N.y=g.clientY,N.w=0,N.h=0,window.addEventListener("mousemove",ee),window.addEventListener("mouseup",ue))}function j(){if(N.w<3||N.h<3)return[];const g=a.value?.querySelector(".hiprint-printPaper");if(!g)return[];const d=g.getBoundingClientRect(),m=n.scale||1,y=N.x<$.x,v=[];for(const b of n.elements){if(b.options.visible===!1||b.options.locked)continue;const A=d.left+b.options.left*Le*m,q=d.top+b.options.top*Le*m,de=A+b.options.width*Le*m,re=q+b.options.height*Le*m,me=A<N.x+N.w&&de>N.x&&q<N.y+N.h&&re>N.y,ve=A>=N.x&&de<=N.x+N.w&&q>=N.y&&re<=N.y+N.h;(y?ve:me)&&v.push(b.id)}return v}function ee(g){const d=g.clientX-$.x,m=g.clientY-$.y;N.x=d>=0?$.x:g.clientX,N.y=m>=0?$.y:g.clientY,N.w=Math.abs(d),N.h=Math.abs(m),l("preview",j())}function ue(){window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",ue);const g=j();l("preview",g),g.length>0?l("commit-preview"):l("clear-selection"),l("preview",[]),N.visible=!1}const oe=e.reactive({visible:!1,x:0,y:0,targetId:null});function se(g,d){if(!d&&!M(g.target))return;const m=a.value?.getBoundingClientRect();m&&(oe.x=g.clientX-m.left,oe.y=g.clientY-m.top,oe.targetId=d??null,oe.visible=!0,window.removeEventListener("mousedown",ae),setTimeout(()=>{window.addEventListener("mousedown",ae,{once:!0})},0))}function ae(){oe.visible=!1,window.removeEventListener("mousedown",ae)}function L(){oe.visible=!1,n.hasClipboard&&l("paste")}function p(){oe.visible=!1,l("select-all")}function k(){oe.visible=!1,l("clear-selection")}function B(g,d){oe.visible=!1,g==="copy"?l("copy"):g==="cut"?l("cut"):g==="paste"?l("paste"):g==="delete"?l("delete"):g==="move-layer"?l("move-layer",d):g==="group"?l("group"):g==="ungroup"&&n.selectedElementHasGroup&&l("ungroup")}e.onMounted(()=>{e.nextTick(I),a.value&&typeof ResizeObserver<"u"&&(z=new ResizeObserver(I),z.observe(a.value))}),e.watch(()=>n.scale,U),e.watch([c,h],()=>e.nextTick(I));function T(){const g=a.value;if(!g)return;let d=0,m=0,y=0;const v=performance.now()+800,b=()=>{const{scrollWidth:A,scrollHeight:q}=g;if(A===m&&q===y?d++:d=0,m=A,y=q,d>=2||performance.now()>v){const de=g.scrollWidth,re=g.scrollHeight,me=g.clientWidth,ve=g.clientHeight;g.scrollLeft=Math.max(0,(de-me)/2),g.scrollTop=Math.max(0,(re-ve)/2);return}requestAnimationFrame(b)};requestAnimationFrame(b)}return r({centerScroll:T,fitToWindow:F,zoomByStep:V}),e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",ue),z?.disconnect(),cancelAnimationFrame(S)}),(g,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:a,class:"canvas-area",onDragover:d[24]||(d[24]=e.withModifiers(()=>{},["prevent"])),onDrop:_,onMousedown:Y,onMousemove:P,onMouseleave:x,onWheel:s,onScroll:O,onContextmenu:e.withModifiers(se,["prevent"])},[e.createElementVNode("div",$n,[e.createVNode(Sn,{"template-data":o.templateData,"runtime-elements":o.elements,"design-mode":!0,"print-data":[],scale:o.scale,"show-grid":o.showGrid,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,guides:o.guides,onSelect:i,onGuideMove:d[0]||(d[0]=(m,y)=>g.$emit("guide-move",m,y)),onGuideRemove:d[1]||(d[1]=m=>g.$emit("guide-remove",m)),onDragStart:d[2]||(d[2]=m=>g.$emit("drag-start")),onDragStop:d[3]||(d[3]=m=>g.$emit("drag-stop")),onDblclickElement:d[4]||(d[4]=m=>g.$emit("dblclick-element",m)),onDblclickCell:d[5]||(d[5]=(m,y,v)=>g.$emit("dblclick-cell",m,y,v)),onContextmenu:d[6]||(d[6]=(m,y)=>se(y,m)),onZoneHeightChange:d[7]||(d[7]=(m,y)=>g.$emit("zone-height-change",m,y)),onZoneHeightCommit:d[8]||(d[8]=m=>g.$emit("zone-height-commit",m)),onCloneElement:d[9]||(d[9]=(m,y)=>g.$emit("clone-element",m,y))},null,8,["template-data","runtime-elements","scale","show-grid","snap-to-grid","show-table-ghost-border","guides"]),o.overlayVisible&&o.screenshotUrl?(e.openBlock(),e.createElementBlock("div",xn,[e.createElementVNode("img",{src:o.screenshotUrl,class:"overlay-image",style:e.normalizeStyle({opacity:o.overlayOpacity??.5})},null,12,Tn)])):e.createCommentVNode("",!0)]),o.showRuler?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ruler-overlay",style:e.normalizeStyle(C.value)},[d[25]||(d[25]=e.createElementVNode("div",{class:"ruler-corner"},null,-1)),e.createVNode(je,{orientation:"horizontal","viewport-px":u.viewW,"origin-px":u.originX,"paper-length-m-m":c.value,scale:u.paperScale,"cursor-px":f.x,onAddGuide:d[10]||(d[10]=(m,y)=>l("add-guide",m,y)),onGuideDragging:d[11]||(d[11]=m=>Z("vertical",m))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"]),e.createVNode(je,{orientation:"vertical","viewport-px":u.viewH,"origin-px":u.originY,"paper-length-m-m":h.value,scale:u.paperScale,"cursor-px":f.y,onAddGuide:d[12]||(d[12]=(m,y)=>l("add-guide",m,y)),onGuideDragging:d[13]||(d[13]=m=>Z("horizontal",m))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"])],4)):e.createCommentVNode("",!0),K.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ruler-guide-preview",`guide-${K.value.type}`]),style:e.normalizeStyle(W.value)},null,6)):e.createCommentVNode("",!0),N.visible?(e.openBlock(),e.createElementBlock("div",{key:2,class:"marquee-selection",style:e.normalizeStyle({left:N.x+"px",top:N.y+"px",width:N.w+"px",height:N.h+"px"})},null,4)):e.createCommentVNode("",!0),oe.visible?(e.openBlock(),e.createElementBlock("div",{key:3,class:"context-menu",style:e.normalizeStyle({left:oe.x+"px",top:oe.y+"px"})},[oe.targetId?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"context-menu-item",onClick:d[14]||(d[14]=m=>B("copy"))},"复制"),e.createElementVNode("div",{class:"context-menu-item",onClick:d[15]||(d[15]=m=>B("cut"))},"剪切"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!o.hasClipboard}]),onClick:d[16]||(d[16]=m=>B("paste"))},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:d[17]||(d[17]=m=>B("delete"))},"删除"),d[26]||(d[26]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:d[18]||(d[18]=m=>B("move-layer","top"))},"置顶"),e.createElementVNode("div",{class:"context-menu-item",onClick:d[19]||(d[19]=m=>B("move-layer","up"))},"上移"),e.createElementVNode("div",{class:"context-menu-item",onClick:d[20]||(d[20]=m=>B("move-layer","down"))},"下移"),e.createElementVNode("div",{class:"context-menu-item",onClick:d[21]||(d[21]=m=>B("move-layer","bottom"))},"置底"),d[27]||(d[27]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:d[22]||(d[22]=m=>B("group"))},"编组 Ctrl+G"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!o.selectedElementHasGroup}]),onClick:d[23]||(d[23]=m=>B("ungroup"))},"取消编组 Ctrl+Shift+G",2)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!o.hasClipboard}]),onClick:L},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:p},"全选"),e.createElementVNode("div",{class:"context-menu-item",onClick:k},"取消选择")],64))],4)):e.createCommentVNode("",!0)],544))}}),Mn=J(Dn,[["__scopeId","data-v-fb2558b3"]]),zn={class:"property-search"},Ln=e.defineComponent({__name:"PropertySearch",emits:["search"],setup(o,{emit:r}){const t=e.ref(""),n=r;function l(){n("search",t.value)}return(i,a)=>(e.openBlock(),e.createElementBlock("div",zn,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=c=>t.value=c),class:"pd-input",type:"search",placeholder:"搜索属性...","aria-label":"搜索属性",onInput:l},null,544),[[e.vModelText,t.value]])]))}}),Pn=J(Ln,[["__scopeId","data-v-10ab6c84"]]),Rn={class:"group-icon"},In={class:"group-title"},An={class:"expand-icon"},Hn={class:"group-content"},Fn=e.defineComponent({__name:"PropertyGroup",props:{title:{},icon:{},defaultExpanded:{type:Boolean},groupKey:{}},setup(o){const r=o,t=e.ref(r.defaultExpanded??!0),l={Document:"≡",Brush:"◧",Setting:"⚙"}[r.icon]||"•";function i(){t.value=!t.value,a()}function a(){const h=`property-group-${r.groupKey}`;try{localStorage.setItem(h,String(t.value))}catch{}}function c(){const h=`property-group-${r.groupKey}`;try{const u=localStorage.getItem(h);u!==null&&(t.value=u==="true")}catch{}}return e.onMounted(()=>{c()}),(h,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-group",{"is-expanded":t.value}])},[e.createElementVNode("div",{class:"group-header",onClick:i},[e.createElementVNode("span",Rn,e.toDisplayString(e.unref(l)),1),e.createElementVNode("span",In,e.toDisplayString(o.title),1),e.createElementVNode("span",An,e.toDisplayString(t.value?"▾":"▸"),1)]),e.withDirectives(e.createElementVNode("div",Hn,[e.renderSlot(h.$slots,"default",{},void 0,!0)],512),[[e.vShow,t.value]])],2))}}),ke=J(Fn,[["__scopeId","data-v-2ba57031"]]),Un={class:"pd-stepper"},Gn=["disabled"],On=["value","placeholder","min","max","step"],Wn=["disabled"],qn=e.defineComponent({__name:"StepperInput",props:{modelValue:{},min:{},max:{},step:{default:1},placeholder:{}},emits:["update:modelValue"],setup(o,{emit:r}){const t=o,n=r,l=e.computed(()=>{const z=String(t.step),S=z.indexOf(".");return S===-1?0:z.length-S-1});function i(z){return Number.isFinite(z)?Number(z.toFixed(l.value)):0}const a=e.computed(()=>{const z=t.modelValue;if(!(z==null||!Number.isFinite(z)))return i(z)}),c=e.ref(a.value===void 0?"":String(a.value));e.watch(a,z=>{c.value=z===void 0?"":String(z)});const h=e.computed(()=>a.value!==void 0?a.value:t.min!==void 0?t.min:0),u=e.computed(()=>t.min!==void 0&&h.value<=t.min),f=e.computed(()=>t.max!==void 0&&h.value>=t.max);function E(z){let S=i(z);return t.min!==void 0&&S<t.min&&(S=t.min),t.max!==void 0&&S>t.max&&(S=t.max),S}function C(z){if(z<0&&u.value||z>0&&f.value)return;const S=E(h.value+z*t.step);c.value=String(S),n("update:modelValue",S)}function I(z){c.value=z.target.value}function O(){const z=c.value.trim();if(z===""){a.value!==void 0&&(c.value=String(a.value));return}const S=Number(z);if(!Number.isFinite(S)){c.value=a.value===void 0?"":String(a.value);return}const U=E(S);c.value=String(U),U!==a.value&&n("update:modelValue",U)}return(z,S)=>(e.openBlock(),e.createElementBlock("div",Un,[e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:u.value,title:"减小","aria-label":"减小",onClick:S[0]||(S[0]=U=>C(-1))},"−",8,Gn),e.createElementVNode("input",{type:"number",class:"pd-input pd-step-input",value:c.value,placeholder:o.placeholder,min:o.min,max:o.max,step:o.step,onInput:I,onChange:O,onBlur:O,onKeydown:S[1]||(S[1]=e.withKeys(e.withModifiers(U=>U.target.blur(),["prevent"]),["enter"]))},null,40,On),e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:f.value,title:"增大","aria-label":"增大",onClick:S[2]||(S[2]=U=>C(1))},"+",8,Wn)]))}}),ie=J(qn,[["__scopeId","data-v-9722a7cf"]]),Kn={class:"position-grid"},Yn={class:"pd-field"},jn={class:"pd-field"},Xn={class:"pd-field"},Zn={class:"pd-field"},Jn=e.defineComponent({__name:"PositionSizeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const r=o;function t(n){return r.searching?r.matchedKeys?.has(n)??!0:!0}return(n,l)=>(e.openBlock(),e.createBlock(ke,{title:"位置与尺寸",icon:"Location","default-expanded":"","group-key":"position-size"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:l[4]||(l[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Kn,[e.withDirectives(e.createElementVNode("div",Yn,[l[5]||(l[5]=e.createElementVNode("span",{class:"pd-label"},"X",-1)),e.createVNode(ie,{modelValue:o.element.options.left,"onUpdate:modelValue":l[0]||(l[0]=i=>o.element.options.left=i),min:0},null,8,["modelValue"])],512),[[e.vShow,t("ps-left")]]),e.withDirectives(e.createElementVNode("div",jn,[l[6]||(l[6]=e.createElementVNode("span",{class:"pd-label"},"Y",-1)),e.createVNode(ie,{modelValue:o.element.options.top,"onUpdate:modelValue":l[1]||(l[1]=i=>o.element.options.top=i),min:0},null,8,["modelValue"])],512),[[e.vShow,t("ps-top")]]),e.withDirectives(e.createElementVNode("div",Xn,[l[7]||(l[7]=e.createElementVNode("span",{class:"pd-label"},"W",-1)),e.createVNode(ie,{modelValue:o.element.options.width,"onUpdate:modelValue":l[2]||(l[2]=i=>o.element.options.width=i),min:4},null,8,["modelValue"])],512),[[e.vShow,t("ps-width")]]),e.withDirectives(e.createElementVNode("div",Zn,[l[8]||(l[8]=e.createElementVNode("span",{class:"pd-label"},"H",-1)),e.createVNode(ie,{modelValue:o.element.options.height,"onUpdate:modelValue":l[3]||(l[3]=i=>o.element.options.height=i),min:4},null,8,["modelValue"])],512),[[e.vShow,t("ps-height")]])])],32)]),_:1}))}}),Qn=J(Jn,[["__scopeId","data-v-bc364679"]]),_n=["aria-expanded","title"],el={class:"picker-preview"},tl={class:"preset-color-grid"},ol=["title","aria-label","onClick"],nl=e.defineComponent({__name:"PresetColorPicker",props:{modelValue:{}},emits:["update:modelValue"],setup(o,{emit:r}){const t=o,n=r,l=e.ref(!1),i=e.ref(),a=e.ref(),c=e.ref(),h=e.ref({}),u=e.ref(0),f=e.ref(0),E=e.ref(0),C=e.ref("#000000"),I=e.ref(!1),O=e.computed({get:()=>t.modelValue||"#000000",set:L=>n("update:modelValue",L)}),z=e.computed(()=>ee(oe(u.value,f.value,E.value))),S=e.computed({get:()=>Math.round(u.value),set:L=>W(se(L),f.value,E.value)});e.watch(O,Z,{immediate:!0});function U(L){C.value=L.toUpperCase(),Z(L),n("update:modelValue",L)}function K(L){const k=L.target.value.trim();Y(k)&&(Z(k),n("update:modelValue",j(k)))}function Z(L){const p=Y(L);if(!p)return;const k=ue(p.r,p.g,p.b);u.value=k.h,f.value=k.s,E.value=k.v,C.value=j(L).toUpperCase()}function W(L,p,k){u.value=se(L),f.value=ae(p),E.value=ae(k),C.value=z.value.toUpperCase(),n("update:modelValue",z.value)}function Q(L){L.currentTarget.setPointerCapture(L.pointerId),I.value=!0,$(L)}function _(L){I.value&&$(L)}function N(L){I.value=!1;const p=L.currentTarget;p.hasPointerCapture(L.pointerId)&&p.releasePointerCapture(L.pointerId)}function $(L){const p=c.value;if(!p)return;const k=p.getBoundingClientRect(),B=ae((L.clientX-k.left)/k.width),T=ae(1-(L.clientY-k.top)/k.height);W(u.value,B,T)}function M(L){const p=L.shiftKey?.1:.02;let k=!0;L.key==="ArrowLeft"?W(u.value,f.value-p,E.value):L.key==="ArrowRight"?W(u.value,f.value+p,E.value):L.key==="ArrowUp"?W(u.value,f.value,E.value+p):L.key==="ArrowDown"?W(u.value,f.value,E.value-p):k=!1,k&&L.preventDefault()}function P(){l.value?D():x()}async function x(){const L=i.value;if(!L)return;Z(O.value),l.value=!0,await e.nextTick();const p=L.getBoundingClientRect(),k=190,B=a.value?.offsetHeight??216,T=8,g=Math.min(p.left,window.innerWidth-k-T),d=p.bottom+6,m=d+B>window.innerHeight-T?Math.max(T,p.top-B-6):d;h.value={left:`${Math.max(T,g)}px`,top:`${m}px`}}function D(){l.value=!1}function s(L){const p=L.target;i.value?.contains(p)||a.value?.contains(p)||D()}function V(){l.value&&D()}function F(L){L.key==="Escape"&&l.value&&D()}function Y(L){const p=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(L.trim());if(!p)return null;const k=p[1],B=k.length===3?k.split("").map(T=>T+T).join(""):k;return{r:Number.parseInt(B.slice(0,2),16),g:Number.parseInt(B.slice(2,4),16),b:Number.parseInt(B.slice(4,6),16)}}function j(L){const p=Y(L);return p?ee(p):"#000000"}function ee({r:L,g:p,b:k}){return`#${[L,p,k].map(B=>Math.round(ae(B/255)*255).toString(16).padStart(2,"0")).join("")}`}function ue(L,p,k){const B=L/255,T=p/255,g=k/255,d=Math.max(B,T,g),m=Math.min(B,T,g),y=d-m;let v=0;return y!==0&&(d===B?v=(T-g)/y%6:d===T?v=(g-B)/y+2:v=(B-T)/y+4,v*=60,v<0&&(v+=360)),{h:v,s:d===0?0:y/d,v:d}}function oe(L,p,k){const B=k*p,T=(L%360+360)%360/60,g=B*(1-Math.abs(T%2-1)),[d,m,y]=T<1?[B,g,0]:T<2?[g,B,0]:T<3?[0,B,g]:T<4?[0,g,B]:T<5?[g,0,B]:[B,0,g],v=k-B;return{r:(d+v)*255,g:(m+v)*255,b:(y+v)*255}}function se(L){return((Number.isFinite(L)?L:0)%360+360)%360}function ae(L){return Math.min(1,Math.max(0,Number.isFinite(L)?L:0))}return e.onMounted(()=>{document.addEventListener("pointerdown",s,!0),window.addEventListener("scroll",V,!0),window.addEventListener("resize",V),document.addEventListener("keydown",F)}),e.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",s,!0),window.removeEventListener("scroll",V,!0),window.removeEventListener("resize",V),document.removeEventListener("keydown",F)}),(L,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("button",{ref_key:"triggerRef",ref:i,type:"button",class:"preset-color-trigger","aria-expanded":l.value,"aria-haspopup":"dialog",title:o.modelValue||"自动",onClick:P},[e.createElementVNode("span",{class:"preset-color-swatch",style:e.normalizeStyle({background:O.value})},null,4)],8,_n),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[l.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"panelRef",ref:a,class:"preset-color-panel",role:"dialog","aria-label":"颜色选择",style:e.normalizeStyle(h.value),onPointerdown:p[2]||(p[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",el,[e.createElementVNode("span",{class:"picker-current",style:e.normalizeStyle({background:z.value})},null,4),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":p[0]||(p[0]=k=>C.value=k),class:"picker-hex",type:"text",maxlength:"7",spellcheck:"false","aria-label":"颜色值",onInput:K},null,544),[[e.vModelText,C.value]])]),e.createElementVNode("div",{ref_key:"areaRef",ref:c,class:"picker-area",style:e.normalizeStyle({"--picker-hue":`${Math.round(u.value)}deg`}),"aria-label":"自定义颜色",tabindex:"0",onPointerdown:Q,onPointermove:_,onPointerup:N,onPointercancel:N,onKeydown:M},[e.createElementVNode("span",{class:"picker-handle",style:e.normalizeStyle({left:`${f.value*100}%`,top:`${(1-E.value)*100}%`,background:z.value})},null,4)],36),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":p[1]||(p[1]=k=>S.value=k),class:"picker-hue",type:"range",min:"0",max:"360",step:"1","aria-label":"色相"},null,512),[[e.vModelText,S.value,void 0,{number:!0}]]),p[3]||(p[3]=e.createElementVNode("div",{class:"picker-heading"},"常用颜色",-1)),e.createElementVNode("div",tl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(w.PRESET_COLORS),k=>(e.openBlock(),e.createElementBlock("button",{key:k,type:"button",class:e.normalizeClass(["preset-color-item",{active:k.toLowerCase()===z.value.toLowerCase()}]),style:e.normalizeStyle({background:k}),title:k,"aria-label":k,onClick:B=>U(k)},null,14,ol))),128))])],36)):e.createCommentVNode("",!0)]))],64))}}),Ee=J(nl,[["__scopeId","data-v-079f8fdd"]]),ll={class:"pd-field"},al={class:"pd-field"},il={class:"pd-field"},rl={class:"pd-radio-group",role:"radiogroup"},sl={class:"pd-radio"},dl={class:"pd-radio"},cl={class:"pd-radio"},ul={class:"pd-field"},ml={class:"pd-radio-group",role:"radiogroup"},pl={class:"pd-radio"},vl={class:"pd-radio"},fl={class:"pd-radio"},gl={class:"color-row"},hl={class:"pd-field"},bl={class:"pd-field"},yl={class:"pd-field"},El={class:"pd-field"},kl={key:1,class:"pd-empty"},Vl=e.defineComponent({__name:"AppearanceGroup",props:{element:{},isTextType:{type:Boolean},matchedKeys:{},searching:{type:Boolean}},setup(o){const r=o;function t(l){return r.searching?r.matchedKeys?.has(l)??!0:!0}const n=e.computed(()=>r.element.printElementType.type==="table");return(l,i)=>(e.openBlock(),e.createBlock(ke,{title:"外观",icon:"Brush","default-expanded":"","group-key":"appearance"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:i[12]||(i[12]=e.withModifiers(()=>{},["prevent"]))},[o.isTextType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",ll,[i[13]||(i[13]=e.createElementVNode("span",{class:"pd-label"},"字体大小",-1)),e.createVNode(ie,{modelValue:o.element.options.fontSize,"onUpdate:modelValue":i[0]||(i[0]=a=>o.element.options.fontSize=a),min:8,max:72},null,8,["modelValue"])],512),[[e.vShow,t("ap-font-size")]]),e.withDirectives(e.createElementVNode("div",al,[i[15]||(i[15]=e.createElementVNode("span",{class:"pd-label"},"字体粗细",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":i[1]||(i[1]=a=>o.element.options.fontWeight=a),style:{width:"100%"}},[...i[14]||(i[14]=[e.createElementVNode("option",{value:"normal"},"正常",-1),e.createElementVNode("option",{value:"bold"},"粗体",-1),e.createElementVNode("option",{value:"bolder"},"更粗",-1),e.createElementVNode("option",{value:"lighter"},"细体",-1)])],512),[[e.vModelSelect,o.element.options.fontWeight]])],512),[[e.vShow,t("ap-font-weight")]]),e.withDirectives(e.createElementVNode("div",il,[i[19]||(i[19]=e.createElementVNode("span",{class:"pd-label"},"对齐",-1)),e.createElementVNode("div",rl,[e.createElementVNode("label",sl,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[2]||(i[2]=a=>o.element.options.textAlign=a),value:"left"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),i[16]||(i[16]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",dl,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[3]||(i[3]=a=>o.element.options.textAlign=a),value:"center"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),i[17]||(i[17]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",cl,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[4]||(i[4]=a=>o.element.options.textAlign=a),value:"right"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),i[18]||(i[18]=e.createElementVNode("span",null,"右",-1))])])],512),[[e.vShow,t("ap-align")]]),e.withDirectives(e.createElementVNode("div",ul,[i[23]||(i[23]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",ml,[e.createElementVNode("label",pl,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[5]||(i[5]=a=>o.element.options.verticalAlign=a),value:"top"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),i[20]||(i[20]=e.createElementVNode("span",null,"顶",-1))]),e.createElementVNode("label",vl,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[6]||(i[6]=a=>o.element.options.verticalAlign=a),value:"middle"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),i[21]||(i[21]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",fl,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[7]||(i[7]=a=>o.element.options.verticalAlign=a),value:"bottom"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),i[22]||(i[22]=e.createElementVNode("span",null,"底",-1))])])],512),[[e.vShow,t("ap-vertical-align")]]),e.createElementVNode("div",gl,[e.withDirectives(e.createElementVNode("div",hl,[i[24]||(i[24]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(Ee,{modelValue:o.element.options.color,"onUpdate:modelValue":i[8]||(i[8]=a=>o.element.options.color=a)},null,8,["modelValue"])],512),[[e.vShow,t("ap-color")]]),e.withDirectives(e.createElementVNode("div",bl,[i[25]||(i[25]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ee,{modelValue:o.element.options.backgroundColor,"onUpdate:modelValue":i[9]||(i[9]=a=>o.element.options.backgroundColor=a)},null,8,["modelValue"])],512),[[e.vShow,t("ap-bg-color")]])]),e.withDirectives(e.createElementVNode("div",yl,[i[26]||(i[26]=e.createElementVNode("span",{class:"pd-label"},"行高",-1)),e.createVNode(ie,{modelValue:o.element.options.lineHeight,"onUpdate:modelValue":i[10]||(i[10]=a=>o.element.options.lineHeight=a),min:0,max:100},null,8,["modelValue"])],512),[[e.vShow,t("ap-line-height")]]),e.withDirectives(e.createElementVNode("div",El,[i[27]||(i[27]=e.createElementVNode("span",{class:"pd-label"},"字间距",-1)),e.createVNode(ie,{modelValue:o.element.options.letterSpacing,"onUpdate:modelValue":i[11]||(i[11]=a=>o.element.options.letterSpacing=a),min:0,max:20,step:.5},null,8,["modelValue"])],512),[[e.vShow,t("ap-letter-spacing")]])],64)):e.createCommentVNode("",!0),!o.isTextType&&!n.value?(e.openBlock(),e.createElementBlock("p",kl,"当前元素不支持外观设置")):e.createCommentVNode("",!0)],32)]),_:1}))}}),wl=J(Vl,[["__scopeId","data-v-9d989c80"]]),Nl={class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},Cl={class:"pd-dialog-header"},Sl={class:"expression-editor"},Bl={class:"ee-nav"},$l={class:"ee-nav-tabs"},xl={class:"ee-content"},Tl={class:"ee-content-search"},Dl=["placeholder"],Ml={class:"ee-content-list"},zl={class:"ee-field-group-icon"},Ll=["onDblclick"],Pl={class:"ee-field-info"},Rl={class:"ee-item-label"},Il={class:"ee-item-key"},Al={key:0,class:"pd-empty"},Hl=["onDblclick"],Fl={class:"ee-field-info"},Ul={class:"ee-item-label"},Gl={class:"ee-item-key"},Ol={class:"ee-func-group"},Wl=["onDblclick"],ql={class:"ee-field-info"},Kl={class:"ee-item-label"},Yl={class:"ee-item-key"},jl={class:"ee-func-group"},Xl=["onDblclick"],Zl={class:"ee-field-info"},Jl={class:"ee-item-label"},Ql={class:"ee-item-key"},_l={class:"ee-editor"},ea={class:"ee-editor-section"},ta={class:"ee-editor-section"},oa={class:"pd-dialog-footer"},na=e.defineComponent({__name:"ExpressionEditor",props:{modelValue:{type:Boolean},expression:{},fields:{}},emits:["update:modelValue","update:expression"],setup(o,{emit:r}){const t=o,n=r,l=e.computed({get:()=>t.modelValue,set:$=>n("update:modelValue",$)}),i=e.ref("field"),a=e.computed(()=>{switch(i.value){case"field":return"搜索字段...";case"variable":return"搜索变量...";case"function":return"搜索函数...";default:return"搜索..."}}),c=e.ref(""),h=e.computed(()=>w.filterGroups(w.groupFields(t.fields??[]),c.value));e.watch(l,$=>{$&&(S.value=t.expression||"")});function u($){const{insideParens:M}=C();_(M?$.fieldKey:`{${$.fieldKey}}`)}function f($){const{insideParens:M}=C();_(M?$.template.replace(/^\{|\}$/g,""):$.template)}function E($){const{insideBlock:M}=C(),P=M?$.template:`{${$.template}}`,x=P.indexOf("(")+1;_(P,x)}function C(){const M=U.value?.selectionStart??S.value.length,P=S.value.substring(0,M);let x=!1;const D=P.lastIndexOf("{");D!==-1&&!P.slice(D+1).includes("}")&&(x=!0);let s=!1;const V=P.lastIndexOf("(");return V!==-1&&!P.slice(V+1).includes(")")&&(s=!0),{insideBlock:x,insideParens:s}}const I=e.computed(()=>{if(!c.value.trim())return W;const $=c.value.trim().toLowerCase();return W.filter(M=>M.label.toLowerCase().includes($)||M.name.toLowerCase().includes($))}),O=e.computed(()=>{if(!c.value.trim())return K;const $=c.value.trim().toLowerCase();return K.filter(M=>M.label.toLowerCase().includes($)||M.name.toLowerCase().includes($))}),z=e.computed(()=>{if(!c.value.trim())return Z;const $=c.value.trim().toLowerCase();return Z.filter(M=>M.label.toLowerCase().includes($)||M.name.toLowerCase().includes($))}),S=e.ref(t.expression||""),U=e.ref(null);e.watch(()=>t.expression,$=>{S.value=$||""});const K=[{name:"SUM",label:"求和",template:"SUM()"},{name:"AVG",label:"平均值",template:"AVG()"},{name:"COUNT",label:"计数",template:"COUNT()"},{name:"MIN",label:"最小值",template:"MIN()"},{name:"MAX",label:"最大值",template:"MAX()"}],Z=[{name:"MONEY",label:"金额格式化",template:"MONEY()"},{name:"DATE",label:"日期格式化",template:"DATE()"},{name:"UPPER",label:"大写金额",template:"UPPER()"},{name:"IF",label:"条件判断",template:"IF()"}],W=[{name:"pageIndex",label:"当前页码",template:"{pageIndex}"},{name:"totalPages",label:"总页数",template:"{totalPages}"},{name:"printDate",label:"打印日期",template:"{printDate}"},{name:"printTime",label:"打印时间",template:"{printTime}"}],Q=e.computed(()=>{if(!S.value.trim())return"(输入表达式后预览)";try{const $={...w.DEFAULT_DEMO_DATA,pageIndex:1,totalPages:1,printDate:new Date().toISOString().split("T")[0],printTime:Date.now()},M=w.evaluateTemplate(S.value,$);return M==null?"(无法计算)":String(M)}catch{return"(表达式错误)"}});function _($,M=$.length){const P=U.value;if(!P){S.value+=$;return}const x=P.selectionStart,D=P.selectionEnd,s=S.value.substring(0,x),V=S.value.substring(D);S.value=s+$+V;const F=x+M;e.nextTick(()=>{P.focus(),P.selectionStart=P.selectionEnd=F})}function N(){n("update:expression",S.value),l.value=!1}return($,M)=>l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pd-dialog-overlay",onKeydown:M[7]||(M[7]=e.withKeys(P=>l.value=!1,["esc"]))},[e.createElementVNode("section",Nl,[e.createElementVNode("header",Cl,[M[8]||(M[8]=e.createElementVNode("strong",{id:"expression-editor-title"},"编辑表达式",-1)),e.createElementVNode("button",{type:"button",class:"pd-close","aria-label":"关闭",onClick:M[0]||(M[0]=P=>l.value=!1)},"×")]),e.createElementVNode("div",Sl,[e.createElementVNode("div",Bl,[M[9]||(M[9]=e.createElementVNode("div",{class:"ee-nav-title"},"类型",-1)),e.createElementVNode("div",$l,[e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:i.value==="field"}]),onClick:M[1]||(M[1]=P=>i.value="field")}," 📁 字段 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:i.value==="variable"}]),onClick:M[2]||(M[2]=P=>i.value="variable")}," 🔧 变量 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:i.value==="function"}]),onClick:M[3]||(M[3]=P=>i.value="function")}," ⚡ 函数 ",2)])]),e.createElementVNode("div",xl,[e.createElementVNode("div",Tl,[e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":M[4]||(M[4]=P=>c.value=P),placeholder:a.value},null,8,Dl),[[e.vModelText,c.value]])]),e.createElementVNode("div",Ml,[i.value==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,P=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:P.key||"_top"},[P.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ee-field-group",{"is-list":P.isList}])},[e.createElementVNode("span",zl,e.toDisplayString(P.isList?"📋":"📁"),1),e.createElementVNode("span",null,e.toDisplayString(P.label),1)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P.fields,x=>(e.openBlock(),e.createElementBlock("div",{key:x.fieldKey,class:"ee-list-item ee-field-item",style:e.normalizeStyle({paddingLeft:P.key?"22px":"10px"}),onDblclick:D=>u(x)},[e.createElementVNode("div",Pl,[e.createElementVNode("span",Rl,e.toDisplayString(x.fieldLabel),1),e.createElementVNode("span",Il,e.toDisplayString(x.fieldKey),1)])],44,Ll))),128))],64))),128)),h.value.length===0?(e.openBlock(),e.createElementBlock("p",Al,"暂无字段")):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),i.value==="variable"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(I.value,P=>(e.openBlock(),e.createElementBlock("div",{key:P.name,class:"ee-list-item",onDblclick:x=>f(P)},[e.createElementVNode("div",Fl,[e.createElementVNode("span",Ul,e.toDisplayString(P.label),1),e.createElementVNode("span",Gl,e.toDisplayString(P.template),1)])],40,Hl))),128)):e.createCommentVNode("",!0),i.value==="function"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",Ol,[M[10]||(M[10]=e.createElementVNode("div",{class:"ee-func-group-title"},"聚合函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(O.value,P=>(e.openBlock(),e.createElementBlock("div",{key:P.name,class:"ee-list-item",onDblclick:x=>E(P)},[e.createElementVNode("div",ql,[e.createElementVNode("span",Kl,e.toDisplayString(P.label),1),e.createElementVNode("span",Yl,e.toDisplayString(P.name)+"()",1)])],40,Wl))),128))]),e.createElementVNode("div",jl,[M[11]||(M[11]=e.createElementVNode("div",{class:"ee-func-group-title"},"格式化函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,P=>(e.openBlock(),e.createElementBlock("div",{key:P.name,class:"ee-list-item",onDblclick:x=>E(P)},[e.createElementVNode("div",Zl,[e.createElementVNode("span",Jl,e.toDisplayString(P.label),1),e.createElementVNode("span",Ql,e.toDisplayString(P.name)+"()",1)])],40,Xl))),128))])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",_l,[e.createElementVNode("div",ea,[M[12]||(M[12]=e.createElementVNode("div",{class:"ee-editor-title"},"表达式编辑",-1)),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:U,"onUpdate:modelValue":M[5]||(M[5]=P=>S.value=P),class:"ee-textarea",rows:"6",placeholder:"双击左侧字段/变量/函数插入,或直接输入静态内容"},null,512),[[e.vModelText,S.value]])]),e.createElementVNode("div",ta,[M[13]||(M[13]=e.createElementVNode("div",{class:"ee-editor-title"},"预览结果",-1)),e.createElementVNode("div",{class:e.normalizeClass(["ee-preview",{"ee-preview-error":Q.value==="(表达式错误)"}])},e.toDisplayString(Q.value),3)]),M[14]||(M[14]=e.createStaticVNode('<div class="ee-help-section" data-v-ef66ca45><div class="ee-help-title" data-v-ef66ca45>帮助信息</div><div class="ee-help-grid" data-v-ef66ca45><div class="ee-help-card ee-help-field" data-v-ef66ca45><div class="ee-help-card-title" data-v-ef66ca45>输入方式</div><div class="ee-help-card-content" data-v-ef66ca45> 双击左侧字段、变量、函数即可插入到表达式输入框中<br data-v-ef66ca45> 静态数据直接输入即可,如:供应商名称<br data-v-ef66ca45> 动态解析字段、变量、函数必须用 {} 包裹<br data-v-ef66ca45> 示例:{SUM(supplier.name)}<br data-v-ef66ca45> 注意:只能嵌套一层 </div></div><div class="ee-help-card ee-help-function" data-v-ef66ca45><div class="ee-help-card-title" data-v-ef66ca45>函数使用</div><div class="ee-help-card-content" data-v-ef66ca45> SUM(字段) - 求和<br data-v-ef66ca45> AVG(字段) - 平均值<br data-v-ef66ca45> COUNT(字段) - 计数<br data-v-ef66ca45> IF(条件, 真值, 假值) - 条件判断 </div></div><div class="ee-help-card ee-help-variable" data-v-ef66ca45><div class="ee-help-card-title" data-v-ef66ca45>系统变量</div><div class="ee-help-card-content" data-v-ef66ca45> {pageIndex} - 当前页码<br data-v-ef66ca45> {totalPages} - 总页数<br data-v-ef66ca45> {printDate} - 打印日期 </div></div><div class="ee-help-card ee-help-conditional" data-v-ef66ca45><div class="ee-help-card-title" data-v-ef66ca45>示例</div><div class="ee-help-card-content" data-v-ef66ca45> 静态文本:供应商名称<br data-v-ef66ca45> 动态字段:{supplier.name}<br data-v-ef66ca45> 函数调用:{SUM(amount)}<br data-v-ef66ca45> 条件判断:{IF(amount&gt;1000, &quot;大单&quot;, &quot;小单&quot;)} </div></div></div></div>',1))])]),e.createElementVNode("footer",oa,[e.createElementVNode("button",{type:"button",class:"pd-button",onClick:M[6]||(M[6]=P=>l.value=!1)},"取消"),e.createElementVNode("button",{type:"button",class:"pd-button primary",onClick:N},"确定")])])],32)):e.createCommentVNode("",!0)}}),Oe=J(na,[["__scopeId","data-v-ef66ca45"]]),la={class:"pd-field"},aa={class:"pd-label"},ia=["value","placeholder"],ra=e.defineComponent({__name:"BindingControl",props:{descriptor:{},modelValue:{},fields:{}},emits:["update:modelValue"],setup(o,{emit:r}){const t=r,n=e.ref(!1);function l(){n.value=!0}return(i,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",la,[e.createElementVNode("span",aa,e.toDisplayString(o.descriptor.label),1),e.createElementVNode("input",{value:o.modelValue,class:"pd-input",placeholder:o.descriptor.placeholder||"输入内容,支持 {字段} 表达式",onInput:a[0]||(a[0]=c=>t("update:modelValue",c.target.value)),onDblclick:l},null,40,ia)]),e.createVNode(Oe,{modelValue:n.value,"onUpdate:modelValue":a[1]||(a[1]=c=>n.value=c),fields:o.fields,expression:o.modelValue,"onUpdate:expression":a[2]||(a[2]=c=>t("update:modelValue",c))},null,8,["modelValue","fields","expression"])],64))}}),sa=J(ra,[["__scopeId","data-v-40a99329"]]),da={class:"pd-field"},ca=["value"],ua=["value"],ma={class:"pd-field"},pa={class:"pd-field"},va={class:"pd-field"},fa={class:"pd-field"},ga={style:{width:"60px"}},ha=e.defineComponent({__name:"TableSettingsGroup",props:{element:{},fields:{}},setup(o){const r=o,t=e.inject(Te,null),n=e.computed(()=>r.fields.filter(a=>a.fieldType==="list").map(a=>({label:a.fieldLabel,value:a.fieldKey})));function l(a){r.element.options.dataSource=a||void 0,t?.recordHistory()}function i(a,c){if(c===void 0)return;const h=r.element.options.tableColWidths,u=t?.maxTableWidth.value??1/0,f=h.reduce((E,C,I)=>I===a?E:E+C,0);if(f+c>u){const E=Math.max(5,Math.round((u-f)*10)/10);alert(`表格总宽不能超过打印范围宽度 ${u}mm,列${a+1} 已调整为 ${E}mm`),h[a]=E}else h[a]=c;w.syncTableElementSize(r.element.options),t?.recordHistory()}return(a,c)=>(e.openBlock(),e.createBlock(ke,{title:"表格设置",icon:"Grid","default-expanded":"","group-key":"table-settings"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:c[4]||(c[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",da,[c[5]||(c[5]=e.createElementVNode("span",{class:"pd-label"},"列表数据源字段",-1)),e.createElementVNode("select",{value:o.element.options.dataSource,class:"pd-select",style:{width:"100%"},onChange:c[0]||(c[0]=h=>l(h.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,h=>(e.openBlock(),e.createElementBlock("option",{key:h.value,value:h.value},e.toDisplayString(h.label),9,ua))),128))],40,ca)]),e.createElementVNode("div",ma,[c[6]||(c[6]=e.createElementVNode("span",{class:"pd-label"},"默认字号 (pt)",-1)),e.createVNode(ie,{modelValue:o.element.options.tableDefaultFontSize,"onUpdate:modelValue":c[1]||(c[1]=h=>o.element.options.tableDefaultFontSize=h),min:5,max:72,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",pa,[c[7]||(c[7]=e.createElementVNode("span",{class:"pd-label"},"默认文字颜色",-1)),e.createVNode(Ee,{modelValue:o.element.options.tableDefaultColor,"onUpdate:modelValue":c[2]||(c[2]=h=>o.element.options.tableDefaultColor=h)},null,8,["modelValue"])]),e.createElementVNode("div",va,[c[8]||(c[8]=e.createElementVNode("span",{class:"pd-label"},"默认内边距 (mm)",-1)),e.createVNode(ie,{modelValue:o.element.options.tableDefaultPadding,"onUpdate:modelValue":c[3]||(c[3]=h=>o.element.options.tableDefaultPadding=h),min:0,max:10,step:.5,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",fa,[c[9]||(c[9]=e.createElementVNode("span",{class:"pd-label"},"列宽 (mm)",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.element.options.tableColWidths,(h,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:"col-width-row"},[e.createElementVNode("span",ga,"列"+e.toDisplayString(u+1),1),e.createVNode(ie,{"model-value":h,min:5,max:200,"onUpdate:modelValue":f=>i(u,f)},null,8,["model-value","onUpdate:modelValue"])]))),128))])],32)]),_:1}))}}),ba=J(ha,[["__scopeId","data-v-b5fdc7ff"]]),ya={class:"border-row"},Ea={class:"pd-field"},ka={class:"pd-field"},Va={class:"pd-field"},wa=e.defineComponent({__name:"BorderBgGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const r=o;function t(n){return r.searching?r.matchedKeys?.has(n)??!0:!0}return(n,l)=>(e.openBlock(),e.createBlock(ke,{title:"边框与背景",icon:"Picture","default-expanded":"","group-key":"border-bg"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:l[3]||(l[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",ya,[e.withDirectives(e.createElementVNode("div",Ea,[l[4]||(l[4]=e.createElementVNode("span",{class:"pd-label"},"边框宽度",-1)),e.createVNode(ie,{modelValue:o.element.options.borderWidth,"onUpdate:modelValue":l[0]||(l[0]=i=>o.element.options.borderWidth=i),min:0,max:20,step:.25},null,8,["modelValue"])],512),[[e.vShow,t("bb-border-width")]]),e.withDirectives(e.createElementVNode("div",ka,[l[5]||(l[5]=e.createElementVNode("span",{class:"pd-label"},"边框颜色",-1)),e.createVNode(Ee,{modelValue:o.element.options.borderColor,"onUpdate:modelValue":l[1]||(l[1]=i=>o.element.options.borderColor=i)},null,8,["modelValue"])],512),[[e.vShow,t("bb-border-color")]])]),e.withDirectives(e.createElementVNode("div",Va,[l[6]||(l[6]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ee,{modelValue:o.element.options.backgroundColor,"onUpdate:modelValue":l[2]||(l[2]=i=>o.element.options.backgroundColor=i)},null,8,["modelValue"])],512),[[e.vShow,t("bb-bg-color")]])],32)]),_:1}))}}),Na=J(wa,[["__scopeId","data-v-e0e6d714"]]),Ca={class:"advanced-row"},Sa={class:"pd-field"},Ba={class:"pd-field"},$a={class:"pd-field"},xa={class:"pd-field"},Ta=e.defineComponent({__name:"AdvancedGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["delete-element"],setup(o){const r=o;function t(n){return r.searching?r.matchedKeys?.has(n)??!0:!0}return(n,l)=>(e.openBlock(),e.createBlock(ke,{title:"高级设置",icon:"Setting","group-key":"advanced"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:l[4]||(l[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Ca,[e.withDirectives(e.createElementVNode("div",Sa,[l[5]||(l[5]=e.createElementVNode("span",{class:"pd-label"},"锁定",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":l[0]||(l[0]=i=>o.element.options.locked=i)},null,512),[[e.vModelCheckbox,o.element.options.locked]])],512),[[e.vShow,t("ad-locked")]]),e.withDirectives(e.createElementVNode("div",Ba,[l[6]||(l[6]=e.createElementVNode("span",{class:"pd-label"},"每页重复",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":l[1]||(l[1]=i=>o.element.options.fixed=i)},null,512),[[e.vModelCheckbox,o.element.options.fixed]])],512),[[e.vShow,t("ad-fixed")]])]),e.withDirectives(e.createElementVNode("div",$a,[l[7]||(l[7]=e.createElementVNode("span",{class:"pd-label"},"层级",-1)),e.createVNode(ie,{modelValue:o.element.options.zIndex,"onUpdate:modelValue":l[2]||(l[2]=i=>o.element.options.zIndex=i),min:0,max:999},null,8,["modelValue"])],512),[[e.vShow,t("ad-z-index")]]),e.withDirectives(e.createElementVNode("div",xa,[e.createElementVNode("button",{type:"button",class:"pd-button danger",onClick:l[3]||(l[3]=i=>n.$emit("delete-element"))}," 删除元素 ")],512),[[e.vShow,t("ad-delete")]])],32)]),_:1}))}}),Da=J(Ta,[["__scopeId","data-v-14924be2"]]),Ma={key:0,class:"pd-field"},za=["checked"],La={class:"pd-field"},Pa=["checked"],Ra={class:"pd-field"},Ia=["checked"],Xe=e.defineComponent({__name:"PaginationGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const r=o,t=e.computed(()=>r.element.printElementType.type==="table"),n=e.computed({get:()=>r.element.options.tablePagination?.enabled??!0,set:()=>{}});function l(f){r.element.options.tablePagination={enabled:f}}const i=e.computed({get:()=>r.element.options.pagination?.pageable??!0,set:()=>{}}),a=e.computed({get:()=>r.element.options.pagination?.keepWithNext??!1,set:()=>{}});function c(f){r.element.options.pagination={pageable:f,keepWithNext:a.value}}function h(f){r.element.options.pagination={pageable:i.value,keepWithNext:f}}function u(f){return r.searching?r.matchedKeys?.has(f)??!0:!0}return(f,E)=>(e.openBlock(),e.createBlock(ke,{title:"分页配置",icon:"Document","group-key":"pagination"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:E[3]||(E[3]=e.withModifiers(()=>{},["prevent"]))},[t.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",Ma,[E[4]||(E[4]=e.createElementVNode("span",{class:"pd-label"},"启用分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:n.value,onChange:E[0]||(E[0]=C=>l(C.target.checked))},null,40,za)],512)),[[e.vShow,u("pg-enabled")]]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.withDirectives(e.createElementVNode("div",La,[E[5]||(E[5]=e.createElementVNode("span",{class:"pd-label"},"参与分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:i.value,onChange:E[1]||(E[1]=C=>c(C.target.checked))},null,40,Pa)],512),[[e.vShow,u("pg-pageable")]]),e.withDirectives(e.createElementVNode("div",Ra,[E[6]||(E[6]=e.createElementVNode("span",{class:"pd-label"},"与下元素同页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:a.value,onChange:E[2]||(E[2]=C=>h(C.target.checked))},null,40,Ia)],512),[[e.vShow,u("pg-keep-with-next")]])],64))],32)]),_:1}))}}),Aa={class:"image-content-upload"},Ha=["disabled"],Fa=e.defineComponent({__name:"ImageContentUpload",props:{disabled:{type:Boolean}},emits:["success"],setup(o,{emit:r}){const t=o,n=r,l=e.ref(!1),i=e.inject(Ge,e.computed(()=>{})),a=e.computed(()=>t.disabled||l.value||!i.value);async function c(h){const u=h.target,f=u.files?.[0];if(f){if(!f.type.startsWith("image/")){alert("仅支持上传图片文件"),u.value="";return}if(!i.value){alert("图片上传能力未配置"),u.value="";return}l.value=!0;try{const E=await i.value(f);E?n("success",E):alert("图片上传失败")}catch(E){alert(E instanceof Error?E.message:"图片上传失败")}finally{l.value=!1,u.value=""}}}return(h,u)=>(e.openBlock(),e.createElementBlock("div",Aa,[e.createElementVNode("label",{class:e.normalizeClass(["pd-button small upload-label",{disabled:a.value}])},[u[0]||(u[0]=e.createElementVNode("svg",{class:"pd-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[e.createElementVNode("path",{fill:"currentColor",d:"M12 3l4 4h-3v7h-2V7H8zm-7 12h14v5H5Z"})],-1)),e.createTextVNode(" "+e.toDisplayString(l.value?"上传中...":"上传图片")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:a.value,onChange:c},null,40,Ha)],2),u[1]||(u[1]=e.createElementVNode("p",{class:"upload-tip"},"支持 jpg/png/gif/bmp/webp/svg 等图片,上传后填入相对路径",-1))]))}}),Ua=J(Fa,[["__scopeId","data-v-b730e8e6"]]),Ga={class:"pd-field"},Oa=["value"],Wa={class:"pd-field"},qa={key:0,class:"pd-field"},Ka=["checked"],Ya=e.defineComponent({__name:"TableRowGroup",props:{element:{},selection:{}},setup(o){const r=o,t=e.inject(Te),n=e.computed(()=>r.element.options.tableRows[r.selection.r1]);function l(c){const h=w.setRowType(r.element.options.tableRows,r.selection.r1,c);if(h){alert(h);return}t.recordHistory()}function i(c){c!==void 0&&(n.value.height=c,w.syncTableElementSize(r.element.options),t.recordHistory())}function a(c){n.value.repeatOnPage=c,t.recordHistory()}return(c,h)=>(e.openBlock(),e.createBlock(ke,{title:"行属性",icon:"Grid","default-expanded":"","group-key":"table-row"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:h[2]||(h[2]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Ga,[h[4]||(h[4]=e.createElementVNode("span",{class:"pd-label"},"行类型",-1)),e.createElementVNode("select",{value:n.value.type,class:"pd-select",style:{width:"100%"},onChange:h[0]||(h[0]=u=>l(u.target.value))},[...h[3]||(h[3]=[e.createElementVNode("option",{value:"header"},"标题行",-1),e.createElementVNode("option",{value:"data"},"数据行",-1),e.createElementVNode("option",{value:"subtotal"},"小计行(每页小计)",-1),e.createElementVNode("option",{value:"summary"},"汇总行",-1)])],40,Oa)]),e.createElementVNode("div",Wa,[h[5]||(h[5]=e.createElementVNode("span",{class:"pd-label"},"行高 (mm)",-1)),e.createVNode(ie,{"model-value":n.value.height,min:3,max:100,step:.5,"onUpdate:modelValue":i},null,8,["model-value"])]),n.value.type==="header"?(e.openBlock(),e.createElementBlock("div",qa,[h[6]||(h[6]=e.createElementVNode("span",{class:"pd-label"},"每页顶部重复",-1)),e.createElementVNode("input",{checked:n.value.repeatOnPage??!1,type:"checkbox",class:"pd-switch",onInput:h[1]||(h[1]=u=>a(!!u.target.checked))},null,40,Ka)])):e.createCommentVNode("",!0)],32)]),_:1}))}}),ja={class:"pd-field"},Xa={class:"pd-radio-group",role:"radiogroup"},Za={class:"pd-radio"},Ja=["checked"],Qa={class:"pd-radio"},_a=["checked"],ei={class:"pd-radio"},ti=["checked"],oi={class:"pd-radio"},ni=["checked"],li={key:0,class:"pd-field"},ai=["value"],ii={key:1,class:"pd-field"},ri=["checked"],si={key:2,class:"pd-field"},di=["value"],ci={key:3,class:"pd-field"},ui=["value"],mi={key:4,class:"pd-field"},pi={key:5,class:"pd-field"},vi={class:"pd-field"},fi=["value"],gi={class:"pd-field"},hi={class:"pd-radio-group",role:"radiogroup"},bi={class:"pd-radio"},yi=["checked"],Ei={class:"pd-radio"},ki=["checked"],Vi={class:"pd-radio"},wi=["checked"],Ni={class:"pd-field"},Ci={class:"pd-radio-group",role:"radiogroup"},Si={class:"pd-radio"},Bi=["checked"],$i={class:"pd-radio"},xi=["checked"],Ti={class:"pd-radio"},Di=["checked"],Mi={class:"cell-style-grid"},zi={class:"pd-field"},Li=["value"],Pi={class:"pd-field"},Ri={class:"pd-field"},Ii=["checked"],Ai={class:"pd-field"},Hi={class:"pd-field"},Fi={class:"border-style-row"},Ui={style:{width:"112px","flex-shrink":"0"}},Gi={class:"pd-button-group border-presets"},Oi={class:"pd-checkbox-group"},Wi={class:"pd-checkbox"},qi={class:"pd-checkbox"},Ki={class:"pd-checkbox"},Yi={class:"pd-checkbox"},ji={class:"pd-field"},Xi={class:"pd-field"},Zi=["checked"],Ji={class:"merge-btns"},Qi=["disabled","title"],_i=["disabled"],er=e.defineComponent({__name:"TableCellGroup",props:{element:{},selection:{},fields:{}},setup(o,{expose:r}){const t=o,n=e.inject(Te),l=e.computed(()=>t.element.options.tableRows),i=e.computed(()=>{const D=w.findMainCell(l.value,t.selection.r1,t.selection.c1);return l.value[D.r].cells[D.c]}),a=e.ref(!1),c=e.ref(""),h=e.computed(()=>i.value.cellType==="barcode"),u=e.computed(()=>i.value.cellType==="qrcode"),f=e.computed(()=>i.value.cellType==="image");function E(D){S(s=>{s.align=D})}function C(D){S(s=>{s.valign=D})}function I(D){S(s=>{s.cellType=D==="text"?void 0:D,D!=="barcode"&&(s.barcodeType=void 0,s.showBarcodeText=void 0),D!=="qrcode"&&(s.qrCodeLevel=void 0)})}function O(){c.value=i.value.formatter||"",a.value=!0}function z(D){S(s=>{s.formatter=D||void 0})}function S(D){const s=t.selection;for(let V=s.r1;V<=s.r2;V++)for(let F=s.c1;F<=s.c2;F++){const Y=l.value[V].cells[F];Y.merged||D(Y)}n.recordHistory()}const U=e.ref("solid"),K=e.ref(.75),Z=e.ref("#333333"),W=e.ref([]);function Q(){return{width:K.value,style:U.value,color:Z.value}}function _(D){w.applyBorderPreset(l.value,t.selection,D,Q()),n.recordHistory()}function N(D){const s=D.target,V=new Set(W.value);s.checked?V.add(s.value):V.delete(s.value),W.value=[...V];const F=Q();S(Y=>{const j={...Y.borders??{}};for(const ee of["top","right","bottom","left"])V.has(ee)?j[ee]={...F}:delete j[ee];Y.borders=j})}const $=e.computed(()=>w.canMergeReason(l.value,t.selection)),M=e.computed(()=>{const D=t.selection;for(let s=D.r1;s<=D.r2;s++)for(let V=D.c1;V<=D.c2;V++){const F=l.value[s].cells[V];if(!F.merged&&((F.rowspan??1)>1||(F.colspan??1)>1))return!0}return!1});function P(){w.mergeCells(l.value,t.selection),n.recordHistory()}function x(){w.splitCells(l.value,t.selection),n.recordHistory()}return r({openFormatterEditor:O}),(D,s)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(ke,{title:"单元格",icon:"Menu","default-expanded":"","group-key":"table-cell"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:s[39]||(s[39]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",ja,[s[45]||(s[45]=e.createElementVNode("span",{class:"pd-label"},"单元格类型",-1)),e.createElementVNode("div",Xa,[e.createElementVNode("label",Za,[e.createElementVNode("input",{type:"radio",value:"text",checked:(i.value.cellType||"text")==="text",onChange:s[0]||(s[0]=V=>I(V.target.value))},null,40,Ja),s[41]||(s[41]=e.createElementVNode("span",null,"文本",-1))]),e.createElementVNode("label",Qa,[e.createElementVNode("input",{type:"radio",value:"barcode",checked:i.value.cellType==="barcode",onChange:s[1]||(s[1]=V=>I(V.target.value))},null,40,_a),s[42]||(s[42]=e.createElementVNode("span",null,"条形码",-1))]),e.createElementVNode("label",ei,[e.createElementVNode("input",{type:"radio",value:"qrcode",checked:i.value.cellType==="qrcode",onChange:s[2]||(s[2]=V=>I(V.target.value))},null,40,ti),s[43]||(s[43]=e.createElementVNode("span",null,"二维码",-1))]),e.createElementVNode("label",oi,[e.createElementVNode("input",{type:"radio",value:"image",checked:i.value.cellType==="image",onChange:s[3]||(s[3]=V=>I(V.target.value))},null,40,ni),s[44]||(s[44]=e.createElementVNode("span",null,"图片",-1))])])]),h.value?(e.openBlock(),e.createElementBlock("div",li,[s[47]||(s[47]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{value:i.value.barcodeType||"CODE128",class:"pd-select",onChange:s[4]||(s[4]=V=>S(F=>{F.barcodeType=V.target.value||void 0}))},[...s[46]||(s[46]=[e.createElementVNode("option",{value:"CODE128"},"CODE128(通用)",-1),e.createElementVNode("option",{value:"EAN13"},"EAN13(商品码)",-1),e.createElementVNode("option",{value:"EAN8"},"EAN8",-1),e.createElementVNode("option",{value:"UPC"},"UPC",-1),e.createElementVNode("option",{value:"CODE39"},"CODE39",-1),e.createElementVNode("option",{value:"ITF14"},"ITF14",-1)])],40,ai)])):e.createCommentVNode("",!0),h.value?(e.openBlock(),e.createElementBlock("div",ii,[s[48]||(s[48]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:i.value.showBarcodeText!==!1,type:"checkbox",class:"pd-switch",onInput:s[5]||(s[5]=V=>S(F=>{F.showBarcodeText=!!V.target.checked}))},null,40,ri)])):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",si,[s[50]||(s[50]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{value:i.value.qrCodeLevel||"M",class:"pd-select",onChange:s[6]||(s[6]=V=>S(F=>{F.qrCodeLevel=V.target.value||void 0}))},[...s[49]||(s[49]=[e.createElementVNode("option",{value:"L"},"L(最低,容量大)",-1),e.createElementVNode("option",{value:"M"},"M(推荐)",-1),e.createElementVNode("option",{value:"Q"},"Q",-1),e.createElementVNode("option",{value:"H"},"H(最高)",-1)])],40,di)])):e.createCommentVNode("",!0),h.value||u.value||f.value?(e.openBlock(),e.createElementBlock("div",ci,[s[52]||(s[52]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{value:i.value.fit||"contain",class:"pd-select",onChange:s[7]||(s[7]=V=>S(F=>{F.fit=V.target.value}))},[...s[51]||(s[51]=[e.createElementVNode("option",{value:"contain"},"包含(保持比例)",-1),e.createElementVNode("option",{value:"cover"},"覆盖(保持比例)",-1),e.createElementVNode("option",{value:"fill"},"拉伸填满",-1),e.createElementVNode("option",{value:"none"},"原始尺寸",-1),e.createElementVNode("option",{value:"scale-down"},"缩小(保持比例)",-1)])],40,ui)])):e.createCommentVNode("",!0),h.value||u.value||f.value?(e.openBlock(),e.createElementBlock("div",mi,[s[53]||(s[53]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(ie,{"model-value":i.value.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":s[8]||(s[8]=V=>S(F=>{F.maxWidth=V??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),h.value||u.value||f.value?(e.openBlock(),e.createElementBlock("div",pi,[s[54]||(s[54]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(ie,{"model-value":i.value.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":s[9]||(s[9]=V=>S(F=>{F.maxHeight=V??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",vi,[s[55]||(s[55]=e.createElementVNode("span",{class:"pd-label"},"内容",-1)),e.createElementVNode("input",{value:i.value.formatter||"",class:"pd-input",placeholder:"输入内容,支持 {字段} 表达式",onInput:s[10]||(s[10]=V=>S(F=>{F.formatter=V.target.value||void 0})),onDblclick:O},null,40,fi)]),e.createElementVNode("div",gi,[s[59]||(s[59]=e.createElementVNode("span",{class:"pd-label"},"水平对齐",-1)),e.createElementVNode("div",hi,[e.createElementVNode("label",bi,[e.createElementVNode("input",{type:"radio",value:"left",checked:i.value.align==="left",onChange:s[11]||(s[11]=V=>E(V.target.value))},null,40,yi),s[56]||(s[56]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",Ei,[e.createElementVNode("input",{type:"radio",value:"center",checked:i.value.align==="center",onChange:s[12]||(s[12]=V=>E(V.target.value))},null,40,ki),s[57]||(s[57]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Vi,[e.createElementVNode("input",{type:"radio",value:"right",checked:i.value.align==="right",onChange:s[13]||(s[13]=V=>E(V.target.value))},null,40,wi),s[58]||(s[58]=e.createElementVNode("span",null,"右",-1))])])]),e.createElementVNode("div",Ni,[s[63]||(s[63]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",Ci,[e.createElementVNode("label",Si,[e.createElementVNode("input",{type:"radio",value:"top",checked:i.value.valign==="top",onChange:s[14]||(s[14]=V=>C(V.target.value))},null,40,Bi),s[60]||(s[60]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",$i,[e.createElementVNode("input",{type:"radio",value:"middle",checked:i.value.valign==="middle",onChange:s[15]||(s[15]=V=>C(V.target.value))},null,40,xi),s[61]||(s[61]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Ti,[e.createElementVNode("input",{type:"radio",value:"bottom",checked:i.value.valign==="bottom",onChange:s[16]||(s[16]=V=>C(V.target.value))},null,40,Di),s[62]||(s[62]=e.createElementVNode("span",null,"下",-1))])])]),e.createElementVNode("div",Mi,[e.createElementVNode("div",zi,[s[65]||(s[65]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createElementVNode("select",{value:i.value.fontFamily,class:"pd-select",placeholder:"继承默认",onChange:s[17]||(s[17]=V=>S(F=>{F.fontFamily=V.target.value||void 0}))},[...s[64]||(s[64]=[e.createElementVNode("option",{value:"SimSun"},"宋体",-1),e.createElementVNode("option",{value:"SimHei"},"黑体",-1),e.createElementVNode("option",{value:"Microsoft YaHei"},"微软雅黑",-1),e.createElementVNode("option",{value:"KaiTi"},"楷体",-1),e.createElementVNode("option",{value:"FangSong"},"仿宋",-1),e.createElementVNode("option",{value:"Arial"},"Arial",-1)])],40,Li)]),e.createElementVNode("div",Pi,[s[66]||(s[66]=e.createElementVNode("span",{class:"pd-label"},"字号 (pt)",-1)),e.createVNode(ie,{"model-value":i.value.fontSize,min:5,max:72,placeholder:"默认","onUpdate:modelValue":s[18]||(s[18]=V=>S(F=>{F.fontSize=V??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",Ri,[s[67]||(s[67]=e.createElementVNode("span",{class:"pd-label"},"加粗",-1)),e.createElementVNode("input",{checked:i.value.fontWeight==="bold",type:"checkbox",class:"pd-switch",onInput:s[19]||(s[19]=V=>S(F=>{F.fontWeight=V.target.checked?"bold":void 0}))},null,40,Ii)]),e.createElementVNode("div",Ai,[s[68]||(s[68]=e.createElementVNode("span",{class:"pd-label"},"文字颜色",-1)),e.createVNode(Ee,{"model-value":i.value.color,"onUpdate:modelValue":s[20]||(s[20]=V=>S(F=>{F.color=V}))},null,8,["model-value"])]),e.createElementVNode("div",Hi,[s[69]||(s[69]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ee,{"model-value":i.value.backgroundColor,"onUpdate:modelValue":s[21]||(s[21]=V=>S(F=>{F.backgroundColor=V}))},null,8,["model-value"])])]),s[77]||(s[77]=e.createElementVNode("h3",{class:"pd-divider"},"边框",-1)),e.createElementVNode("div",Fi,[e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":s[22]||(s[22]=V=>U.value=V),style:{width:"90px"}},[...s[70]||(s[70]=[e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1),e.createElementVNode("option",{value:"double"},"双线",-1)])],512),[[e.vModelSelect,U.value]]),e.createElementVNode("div",Ui,[e.createVNode(ie,{modelValue:K.value,"onUpdate:modelValue":s[23]||(s[23]=V=>K.value=V),min:.25,max:5,step:.25},null,8,["modelValue"])]),e.createVNode(Ee,{modelValue:Z.value,"onUpdate:modelValue":s[24]||(s[24]=V=>Z.value=V)},null,8,["modelValue"])]),e.createElementVNode("div",Gi,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:s[25]||(s[25]=V=>_("all"))},"全部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:s[26]||(s[26]=V=>_("outer"))},"外侧"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:s[27]||(s[27]=V=>_("inner"))},"内部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:s[28]||(s[28]=V=>_("none"))},"无")]),e.createElementVNode("div",Oi,[e.createElementVNode("label",Wi,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s[29]||(s[29]=V=>W.value=V),value:"top",onChange:s[30]||(s[30]=V=>N(V))},null,544),[[e.vModelCheckbox,W.value]]),s[71]||(s[71]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",qi,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s[31]||(s[31]=V=>W.value=V),value:"right",onChange:s[32]||(s[32]=V=>N(V))},null,544),[[e.vModelCheckbox,W.value]]),s[72]||(s[72]=e.createElementVNode("span",null,"右",-1))]),e.createElementVNode("label",Ki,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s[33]||(s[33]=V=>W.value=V),value:"bottom",onChange:s[34]||(s[34]=V=>N(V))},null,544),[[e.vModelCheckbox,W.value]]),s[73]||(s[73]=e.createElementVNode("span",null,"下",-1))]),e.createElementVNode("label",Yi,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s[35]||(s[35]=V=>W.value=V),value:"left",onChange:s[36]||(s[36]=V=>N(V))},null,544),[[e.vModelCheckbox,W.value]]),s[74]||(s[74]=e.createElementVNode("span",null,"左",-1))])]),e.createElementVNode("div",ji,[s[75]||(s[75]=e.createElementVNode("span",{class:"pd-label"},"内边距 (mm)",-1)),e.createVNode(ie,{"model-value":i.value.padding,min:0,max:10,step:.5,placeholder:"默认","onUpdate:modelValue":s[37]||(s[37]=V=>S(F=>{F.padding=V??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",Xi,[s[76]||(s[76]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:i.value.wordWrap??!0,type:"checkbox",class:"pd-switch",onInput:s[38]||(s[38]=V=>S(F=>{F.wordWrap=!!V.target.checked}))},null,40,Zi)]),e.createElementVNode("div",Ji,[e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!!$.value,title:$.value||"",onClick:P}," 合并单元格 ",8,Qi),e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!M.value,onClick:x},"拆分单元格",8,_i)])],32)]),_:1}),e.createVNode(Oe,{modelValue:a.value,"onUpdate:modelValue":s[40]||(s[40]=V=>a.value=V),fields:o.fields,expression:c.value,"onUpdate:expression":z},null,8,["modelValue","fields","expression"])],64))}}),tr=J(er,[["__scopeId","data-v-7372566f"]]),or={key:0,class:"prop-collapsed"},nr={class:"prop-head"},lr={class:"pd-tabs prop-tabs"},ar={class:"pd-tab-bar",role:"tablist"},ir={class:"pd-tab-pane",role:"tabpanel"},rr={class:"property-content"},sr={key:1,class:"pd-empty"},dr={class:"pd-tab-pane",role:"tabpanel"},cr={class:"pd-field"},ur=["value"],mr=["value"],pr={key:0,class:"pd-field"},vr={class:"custom-size-grid"},fr={class:"pd-field"},gr={class:"pd-radio-group",role:"radiogroup"},hr={class:"pd-radio"},br=["checked"],yr={class:"pd-radio"},Er=["checked"],kr={class:"pd-field"},Vr={class:"page-bg-row"},wr={class:"margin-grid"},Nr={class:"pd-field"},Cr={class:"pd-field"},Sr={class:"pd-field"},Br={class:"pd-field"},$r={class:"pd-field"},xr={class:"pd-field"},Tr={class:"pd-field"},Dr=e.defineComponent({__name:"PropertyPanel",props:{element:{},templateData:{},fields:{},activeTab:{},tableSelection:{},recordHistory:{type:Function},collapsed:{type:Boolean}},emits:["delete-element","update:templateData","update:activeTab","toggle-collapse"],setup(o,{emit:r}){const t=o,n=r,l=w.PAPER_PRESETS,i=e.ref(""),a=e.computed(()=>t.element?["text","longText"].includes(t.element.printElementType.type):!1),c=e.computed(()=>t.element?t.element.printElementType.type==="image":!1),h=e.computed(()=>!t.element||t.element.printElementType.type!=="table"?!1:!!t.tableSelection&&t.tableSelection.elementId===t.element.id),u=e.computed(()=>t.element?t.element.printElementType.type==="table":!1),f=e.computed(()=>w.searchProperties(i.value)),E=e.computed(()=>f.value.groups),C=e.computed(()=>f.value.itemKeys),I=e.computed(()=>!!i.value.trim()),O=e.computed(()=>{if(!t.element)return[];if(t.element.printElementType.type==="table"&&t.tableSelection){const{r1:v,c1:b}=t.tableSelection,A=t.element.options.tableRows;if(A&&A[v]){const q=A[v],de=t.element.options.fields?.[0]?.dataSource;return w.getTableCellBindings(q.type,v,b,de)}}return w.getElementBindings(t.element)});function z(v){return v.split(".").flatMap(b=>{const A=b.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!A)return[b];const q=A[1],de=[...A[2].matchAll(/\[(\d+)\]/g)].map(re=>Number(re[1]));return[q,...de]})}function S(v){return t.element?z(v).reduce((q,de)=>q==null?"":q[de],t.element)??"":""}function U(v,b){if(!t.element)return;const A=z(v),q=A.pop(),de=A.reduce((re,me)=>((re[me]===void 0||re[me]===null)&&(re[me]={}),re[me]),t.element);de[q]=b||void 0,t.recordHistory?.()}function K(v){i.value=v}function Z(v){t.element&&U("options.src",v)}const W=e.computed(()=>t.templateData?.paperSize||"A4"),Q=e.computed(()=>t.templateData?.orientation||"portrait"),_=e.computed({get:()=>t.templateData?.pageBackground||"#ffffff",set:v=>ue(v)}),N=e.computed(()=>t.templateData?.margins.top??10),$=e.computed(()=>t.templateData?.margins.bottom??10),M=e.computed(()=>t.templateData?.margins.left??10),P=e.computed(()=>t.templateData?.margins.right??10),x=e.computed(()=>t.templateData?.header.height??10),D=e.computed(()=>t.templateData?.footer.height??10),s=e.computed(()=>t.templateData?.firstPageOverlay.height??0),V=e.computed(()=>t.templateData?.customWidth??210),F=e.computed(()=>t.templateData?.customHeight??297);function Y(v){t.templateData&&n("update:templateData",{...t.templateData,...v})}function j(v){if(v==="CUSTOM"){Y({paperSize:"CUSTOM"});return}l[v]&&Y({paperSize:v})}function ee(v){Y({orientation:String(v)})}function ue(v){const b=v&&v.toLowerCase()!=="#ffffff"&&v.toLowerCase()!=="#fff"?v:void 0;Y(b===void 0?{pageBackground:void 0}:{pageBackground:b})}function oe(){Y({pageBackground:void 0})}function se(v){v!==void 0&&Y({customWidth:v})}function ae(v){v!==void 0&&Y({customHeight:v})}function L(v){v!==void 0&&Y({margins:{...t.templateData.margins,top:v}})}function p(v){v!==void 0&&Y({margins:{...t.templateData.margins,bottom:v}})}function k(v){v!==void 0&&Y({margins:{...t.templateData.margins,left:v}})}function B(v){v!==void 0&&Y({margins:{...t.templateData.margins,right:v}})}function T(v){v!==void 0&&Y({header:{...t.templateData.header,height:v}})}function g(v){v!==void 0&&Y({footer:{...t.templateData.footer,height:v}})}function d(v){v!==void 0&&Y({firstPageOverlay:{...t.templateData.firstPageOverlay,height:v}})}const m=e.computed(()=>t.activeTab||"page");function y(v){n("update:activeTab",v),n("toggle-collapse")}return(v,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-panel",{collapsed:o.collapsed}])},[o.collapsed?(e.openBlock(),e.createElementBlock("div",or,[e.createElementVNode("button",{class:"pc-btn",title:"展开属性台",onClick:b[0]||(b[0]=A=>y(m.value))},"«"),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:m.value==="element"}]),title:"元素属性",onClick:b[1]||(b[1]=A=>y("element"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:m.value==="page"}]),title:"页面属性",onClick:b[2]||(b[2]=A=>y("page"))},"▤",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",nr,[b[12]||(b[12]=e.createElementVNode("span",{class:"prop-title"},"属性台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起属性台",onClick:b[3]||(b[3]=A=>v.$emit("toggle-collapse"))},"»")]),e.createElementVNode("div",lr,[e.createElementVNode("div",ar,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(o.activeTab||"page")==="element"}]),onClick:b[4]||(b[4]=A=>v.$emit("update:activeTab","element"))},"元素属性",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(o.activeTab||"page")==="page"}]),onClick:b[5]||(b[5]=A=>v.$emit("update:activeTab","page"))},"页面属性",2)]),e.withDirectives(e.createElementVNode("div",ir,[o.element?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(Pn,{onSearch:K}),e.createElementVNode("div",rr,[E.value.includes("position-size")&&!h.value?(e.openBlock(),e.createBlock(Qn,{key:0,element:o.element,"matched-keys":C.value,searching:I.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),E.value.includes("appearance")?(e.openBlock(),e.createBlock(wl,{key:1,element:o.element,"is-text-type":a.value,"matched-keys":C.value,searching:I.value},null,8,["element","is-text-type","matched-keys","searching"])):e.createCommentVNode("",!0),E.value.includes("binding")?(e.openBlock(),e.createBlock(ke,{key:2,title:"内容",icon:"Document","default-expanded":"","group-key":"binding"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(O.value,A=>(e.openBlock(),e.createBlock(sa,{key:A.targetPath,descriptor:A,fields:o.fields,"model-value":S(A.targetPath),"onUpdate:modelValue":q=>U(A.targetPath,q)},null,8,["descriptor","fields","model-value","onUpdate:modelValue"]))),128)),c.value?(e.openBlock(),e.createBlock(Ua,{key:0,onSuccess:Z})):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),u.value&&o.tableSelection&&o.tableSelection.elementId===o.element.id?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createVNode(Ya,{element:o.element,selection:o.tableSelection},null,8,["element","selection"]),e.createVNode(tr,{element:o.element,selection:o.tableSelection,fields:o.fields},null,8,["element","selection","fields"])],64)):e.createCommentVNode("",!0),u.value&&E.value.includes("content")?(e.openBlock(),e.createBlock(ba,{key:4,element:o.element,fields:o.fields},null,8,["element","fields"])):e.createCommentVNode("",!0),E.value.includes("border-bg")?(e.openBlock(),e.createBlock(Na,{key:5,element:o.element,"matched-keys":C.value,searching:I.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),E.value.includes("pagination")&&u.value?(e.openBlock(),e.createBlock(Xe,{key:6,element:o.element,"matched-keys":C.value,searching:I.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),E.value.includes("pagination")&&!u.value?(e.openBlock(),e.createBlock(Xe,{key:7,element:o.element,"matched-keys":C.value,searching:I.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),E.value.includes("advanced")?(e.openBlock(),e.createBlock(Da,{key:8,element:o.element,"matched-keys":C.value,searching:I.value,onDeleteElement:b[6]||(b[6]=A=>v.$emit("delete-element"))},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0)])],64)):(e.openBlock(),e.createElementBlock("p",sr,"请在画布中选择一个元素"))],512),[[e.vShow,(o.activeTab||"page")==="element"]]),e.withDirectives(e.createElementVNode("div",dr,[e.createElementVNode("form",{class:"pd-form",onSubmit:b[11]||(b[11]=e.withModifiers(()=>{},["prevent"]))},[b[28]||(b[28]=e.createElementVNode("h3",{class:"pd-divider"},"纸张设置",-1)),e.createElementVNode("div",cr,[b[14]||(b[14]=e.createElementVNode("span",{class:"pd-label"},"纸张尺寸",-1)),e.createElementVNode("select",{value:W.value,class:"pd-select",onChange:b[7]||(b[7]=A=>j(A.target.value)),style:{width:"100%"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),(A,q)=>(e.openBlock(),e.createElementBlock("option",{key:q,value:q},e.toDisplayString(q),9,mr))),128)),b[13]||(b[13]=e.createElementVNode("option",{value:"CUSTOM"},"自定义",-1))],40,ur)]),W.value==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",pr,[b[16]||(b[16]=e.createElementVNode("span",{class:"pd-label"},"自定义宽高 (mm)",-1)),e.createElementVNode("div",vr,[e.createVNode(ie,{"model-value":V.value,min:25,max:2e3,"onUpdate:modelValue":se},null,8,["model-value"]),b[15]||(b[15]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(ie,{"model-value":F.value,min:25,max:2e3,"onUpdate:modelValue":ae},null,8,["model-value"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",fr,[b[19]||(b[19]=e.createElementVNode("span",{class:"pd-label"},"方向",-1)),e.createElementVNode("div",gr,[e.createElementVNode("label",hr,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:Q.value==="portrait",onChange:b[8]||(b[8]=A=>ee(A.target.value))},null,40,br),b[17]||(b[17]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",yr,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:Q.value==="landscape",onChange:b[9]||(b[9]=A=>ee(A.target.value))},null,40,Er),b[18]||(b[18]=e.createElementVNode("span",null,"横向",-1))])])]),e.createElementVNode("div",kr,[b[20]||(b[20]=e.createElementVNode("span",{class:"pd-label"},"页面背景色",-1)),e.createElementVNode("div",Vr,[e.createVNode(Ee,{modelValue:_.value,"onUpdate:modelValue":b[10]||(b[10]=A=>_.value=A),class:"page-bg-picker"},null,8,["modelValue"]),e.createElementVNode("button",{type:"button",class:"pd-reset",title:"恢复为默认白色",onClick:oe},"默认")])]),b[29]||(b[29]=e.createElementVNode("h3",{class:"pd-divider"},"页边距 (mm)",-1)),e.createElementVNode("div",wr,[e.createElementVNode("div",Nr,[b[21]||(b[21]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(ie,{"model-value":N.value,min:0,max:50,"onUpdate:modelValue":L},null,8,["model-value"])]),e.createElementVNode("div",Cr,[b[22]||(b[22]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(ie,{"model-value":$.value,min:0,max:50,"onUpdate:modelValue":p},null,8,["model-value"])]),e.createElementVNode("div",Sr,[b[23]||(b[23]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(ie,{"model-value":M.value,min:0,max:50,"onUpdate:modelValue":k},null,8,["model-value"])]),e.createElementVNode("div",Br,[b[24]||(b[24]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(ie,{"model-value":P.value,min:0,max:50,"onUpdate:modelValue":B},null,8,["model-value"])])]),b[30]||(b[30]=e.createElementVNode("h3",{class:"pd-divider"},"三区高度 (mm)",-1)),e.createElementVNode("div",$r,[b[25]||(b[25]=e.createElementVNode("span",{class:"pd-label"},"页眉高度",-1)),e.createVNode(ie,{"model-value":x.value,min:0,max:100,step:.1,"onUpdate:modelValue":T},null,8,["model-value"])]),e.createElementVNode("div",xr,[b[26]||(b[26]=e.createElementVNode("span",{class:"pd-label"},"页脚高度",-1)),e.createVNode(ie,{"model-value":D.value,min:0,max:100,step:.1,"onUpdate:modelValue":g},null,8,["model-value"])]),e.createElementVNode("div",Tr,[b[27]||(b[27]=e.createElementVNode("span",{class:"pd-label"},"首页叠加高度",-1)),e.createVNode(ie,{"model-value":s.value,min:0,max:200,"onUpdate:modelValue":d},null,8,["model-value"])])],32)],512),[[e.vShow,(o.activeTab||"page")==="page"]])])],64))],2))}}),Mr=J(Dr,[["__scopeId","data-v-d8fa9541"]]),zr={class:"status-bar"},Lr={key:0,class:"status-item coord"},Pr={class:"status-item"},Rr={class:"status-item"},Ir={class:"status-item status-paper"},Ar=e.defineComponent({__name:"StatusBar",props:{coordinate:{},scale:{},elementCount:{},selectedCount:{},paper:{},dirty:{type:Boolean}},setup(o){return(r,t)=>(e.openBlock(),e.createElementBlock("div",zr,[o.coordinate?(e.openBlock(),e.createElementBlock("span",Lr," x:"+e.toDisplayString(o.coordinate.x.toFixed(1))+" y:"+e.toDisplayString(o.coordinate.y.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0),e.createElementVNode("span",Pr,"缩放 "+e.toDisplayString(o.scale)+"%",1),e.createElementVNode("span",Rr,"元素 "+e.toDisplayString(o.elementCount)+e.toDisplayString(o.selectedCount?` (选中 ${o.selectedCount})`:""),1),e.createElementVNode("span",{class:e.normalizeClass(["status-dirty",{on:o.dirty}])},[t[0]||(t[0]=e.createElementVNode("span",{class:"dirty-dot"},null,-1)),e.createTextVNode(e.toDisplayString(o.dirty?"未保存":"已保存"),1)],2),e.createElementVNode("span",Ir,e.toDisplayString(o.paper),1)]))}}),Hr=J(Ar,[["__scopeId","data-v-eb34e9a7"]]),Fr={id:"getting-started",title:"快速入门",content:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),ge=require("@worm-vue3-print/core"),h=require("@worm-vue3-print/core/designer"),Ue=require("@worm-vue3-print/core/browser"),Bt=require("jsbarcode"),xt=require("qrcode"),Ft=require("dompurify"),$t=Symbol("selected-ids"),Tt=Symbol("preview-ids");function Ut(o){const i=e.ref(new Set),t=e.ref(new Set),n=e.computed(()=>o.value.filter(k=>i.value.has(k.id))),l=e.computed(()=>i.value.size>0);function d(k,y=!1){if(y){const R=new Set(i.value);R.has(k)?R.delete(k):R.add(k),i.value=R}else i.value=new Set([k])}function s(){i.value=new Set}function a(k){i.value=new Set(k)}function r(k){t.value=new Set(k)}function u(){t.value=new Set}function m(){i.value=new Set(t.value),t.value=new Set}function g(){const k=n.value;if(k.length===0)return null;let y=1/0,R=1/0,C=-1/0,v=-1/0;return k.forEach(f=>{y=Math.min(y,f.options.left),R=Math.min(R,f.options.top),C=Math.max(C,f.options.left+f.options.width),v=Math.max(v,f.options.top+f.options.height)}),{left:y,top:R,width:C-y,height:v-R}}return{selectedIds:i,selectedElements:n,hasSelection:l,select:d,clearSelection:s,selectAll:a,getSelectionBounds:g,previewIds:t,setPreview:r,clearPreview:u,commitPreview:m}}function Ht(){const o=e.ref(null);function i(l){o.value=l.map(d=>({options:{...d.options},printElementType:{...d.printElementType}}))}function t(l=10){if(!o.value)return null;const d=new Map;for(const a of o.value){const r=a.options.groupId;r&&d.set(r,(d.get(r)??0)+1)}const s=new Map;for(const[a,r]of d)s.set(a,r>=2?h.generateGroupId():void 0);return o.value.map(a=>({id:h.generateId(),options:{...a.options,left:a.options.left+l,top:a.options.top+l,groupId:a.options.groupId?s.get(a.options.groupId):void 0},printElementType:{...a.printElementType}}))}function n(){return o.value!==null&&o.value.length>0}return{clipboard:o,copy:i,paste:t,hasData:n}}function Ot(o){const t=e.ref([]),n=e.ref([]),l=e.ref(!1),d=e.ref(!1);function s(){l.value=t.value.length>0,d.value=n.value.length>0}function a(y){const R={elements:JSON.parse(JSON.stringify(y?.elements??[])),templateData:JSON.parse(JSON.stringify(y?.templateData??{}))};return y?.pages&&(R.pages=JSON.parse(JSON.stringify(y.pages)),y.activePageIndex!==void 0&&(R.activePageIndex=y.activePageIndex)),R}function r(y){return a(y)}function u(y){t.value.push(r(y)),n.value=[],t.value.length>50&&t.value.shift(),s()}function m(y){if(t.value.length===0)return null;const R=t.value.pop();return n.value.push(y?r(y):a(R)),s(),t.value.length>0?a(t.value[t.value.length-1]):null}function g(y){if(n.value.length===0)return null;const R=n.value.pop();return t.value.push(y?r(y):a(R)),s(),a(R)}function k(){t.value=[],n.value=[],s()}return{push:u,undo:m,redo:g,canUndo:l,canRedo:d,clear:k}}const rt="开启拼版后只能有一个设计页面";function Re(){return{paperSize:"A4",orientation:"portrait",unit:"mm",margins:{top:10,right:10,bottom:10,left:10},header:{height:10,elements:[]},footer:{height:10,elements:[]},firstPageOverlay:{height:0,elements:[]},elements:[],watermark:{}}}function Ze(o){const i=(t,n)=>(t??[]).map(l=>{const d={...l.options};return(l.printElementType?.type??l.type)==="table"&&h.syncTableElementSize(d),{id:l.id||h.generateId(),zone:n,options:d,printElementType:{...l.printElementType}}});return{...o,margins:{...o.margins},header:{height:o.header?.height??10,elements:[]},footer:{height:o.footer?.height??10,elements:[]},firstPageOverlay:{height:o.firstPageOverlay?.height??0,elements:[...o.firstPageOverlay?.elements??[]]},guides:[...o.guides??[]],elements:[...i(o.elements??[],"content"),...i(o.header?.elements??[],"header"),...i(o.footer?.elements??[],"footer")]}}function vt(o){const i=(n,l)=>{const d=Ze(h.normalizeTemplateUnits(n));return d.name||(d.name=`页面 ${l+1}`),d};if(!o)return[i(Re(),0)];const t=Array.isArray(o.pages)?o.pages:[o];return t.length?t.map(i):[i(Re(),0)]}function ft(o){const i=o.elements,t=n=>i.filter(l=>(l.zone||"content")===n).map(l=>({id:l.id,type:l.printElementType.type,options:{...l.options},printElementType:{...l.printElementType}}));return{unit:"mm",...o,header:{...o.header,elements:t("header")},footer:{...o.footer,elements:t("footer")},firstPageOverlay:{...o.firstPageOverlay,elements:(o.firstPageOverlay?.elements??[]).map(n=>({id:n.id||h.generateId(),type:n.printElementType?.type||"text",options:{...n.options},printElementType:{...n.printElementType}}))},elements:t("content"),guides:[...o.guides??[]]}}function Wt(o={}){const i=e.ref(100),t=e.ref(!0),n=e.ref(!0),l=e.ref(!1),d=e.ref(!0),s=e.ref(vt(o.initialTemplate)),a=e.ref(0),r=e.ref(s.value[0]??Ze(Re())),u=e.computed(()=>s.value.some(L=>L.tiling?.enabled===!0));function m(){return u.value?(alert(rt),!0):!1}function g(){s.value[a.value]=r.value}function k(L){L<0||L>=s.value.length||(g(),a.value=L,r.value=s.value[L],ce())}const y=e.computed({get:()=>r.value.elements,set:L=>{r.value.elements=L}}),R=e.ref(o.initialFields||[]),{selectedIds:C,selectedElements:v,select:f,clearSelection:M,selectAll:j,previewIds:ne,setPreview:H,clearPreview:K,commitPreview:b}=Ut(y),{group:B,ungroup:S,getGroupedIds:x}=h.useGroup(),{copy:T,paste:X,hasData:ee}=Ht(),{align:le}=h.useAlign(),{push:ie,undo:ue,redo:J,canUndo:c,canRedo:N}=Ot(),W=e.computed(()=>{if(C.value.size===0)return null;const L=C.value.values().next().value;return y.value.find(te=>te.id===L)||null}),he=e.ref(null);function pe(L){he.value=L}function ce(){M(),pe(null)}function ve(){return{elements:y.value.map(L=>({id:L.id,zone:L.zone,options:JSON.parse(JSON.stringify(L.options)),printElementType:{...L.printElementType}})),templateData:{paperSize:r.value.paperSize,orientation:r.value.orientation,outputRotation:r.value.outputRotation,margins:{...r.value.margins},header:{height:r.value.header.height,elements:[]},footer:{height:r.value.footer.height,elements:[]},firstPageOverlay:{height:r.value.firstPageOverlay.height,elements:[]},elements:[],customWidth:r.value.customWidth,customHeight:r.value.customHeight,watermark:r.value.watermark?{...r.value.watermark}:void 0,guides:[...r.value.guides??[]]},pages:JSON.parse(JSON.stringify(s.value)),activePageIndex:a.value}}function z(){ie(ve())}function V(L){return L.pages?.[L.activePageIndex??0]?.elements??L.elements}function w(){const L=ue(ve());L?.pages?(s.value=L.pages,a.value=L.activePageIndex??0,r.value=s.value[a.value]??s.value[0],ce()):L?.templateData&&(r.value={...L.templateData,elements:L.elements})}function F(){const L=J(ve());L?.pages?(s.value=L.pages,a.value=L.activePageIndex??0,r.value=s.value[a.value]??s.value[0],ce()):L?.templateData&&(r.value={...L.templateData,elements:L.elements})}function p(){T(v.value)}function E(){T(v.value),Z()}function $(){const L=X();L&&L.length>0&&(y.value.push(...L),z())}function Y(){T(v.value);const L=X();L&&L.length>0&&(L.forEach(te=>{te.options.left+=5,te.options.top+=5}),y.value.push(...L),f(L[0].id,!1),z())}function Q(){i.value=100}const oe=e.computed(()=>ee());let me=!1,P=null;const I=300;function O(L,te){const ae=v.value.filter(ye=>!ye.options.locked);ae.length!==0&&(ae.forEach(ye=>{ye.options.left+=L,ye.options.top+=te}),me||(me=!0,z()),P&&clearTimeout(P),P=setTimeout(()=>{me=!1,P=null},I))}function _(){j(y.value.map(L=>L.id))}function q(L){le(v.value,L),z()}function fe(L,te=!1){if(te){f(L,!0);return}C.value=new Set(x(y.value,L))}function A(){y.value=B(y.value,C.value),z()}function D(){y.value=S(y.value,C.value),z()}function Z(){C.value.size!==0&&(y.value=y.value.filter(L=>!C.value.has(L.id)),M(),z())}const{setup:be,cleanup:ke}=h.useKeyboard({onMove:O,onDelete:Z,onCopy:p,onPaste:$,onSelectAll:_,onUndo:w,onRedo:F,onDuplicate:Y,onResetZoom:Q,onAlignLeft:()=>q("left"),onAlignRight:()=>q("right"),onAlignCenterH:()=>q("vertical"),onAlignTop:()=>q("top"),onAlignBottom:()=>q("bottom"),onGroup:A,onUngroup:D});let Ve=null;function xe(){Ve=ve()}function Qe(){if(!Ve)return;const L=new Map(Ve.elements.map(Ee=>[Ee.id,Ee]));let te=!1;for(const Ee of y.value){const Be=L.get(Ee.id);if(!Be)continue;(Be.options.left!==Ee.options.left||Be.options.top!==Ee.options.top||Be.options.width!==Ee.options.width||Be.options.height!==Ee.options.height)&&h.finalizeElementZone(Ee,r.value).rejected&&(te=!0)}te&&alert("该元素类型不能放入页眉/页脚");const ae=Ee=>`${Ee.id}:${Ee.zone||"content"}:${Ee.options.left},${Ee.options.top},${Ee.options.width},${Ee.options.height}`,ye=V(Ve).map(ae).join("|"),Se=V(ve()).map(ae).join("|");Ve=null,ye!==Se&&z()}function We(L,te){const ae=h.zoneFromPaperPoint(r.value,te.x,te.y);if(ae!=="content"&&!h.ZONE_ALLOWED_TYPES.includes(L.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const ye=h.getZoneRects(r.value)[ae];return L.zone=ae,L.options.left=te.x-ye.left,L.options.top=te.y-ye.top,ae!=="content"&&h.clampToZone(L,ye),!0}function Ae(L,te){const ae=h.createRuntimeElement(L);te&&!We(ae,te)||(y.value.push(ae),f(ae.id,!1),z())}function Me(L,te){const ae=h.createFieldElement(L);te&&!We(ae,te)||(y.value.push(ae),f(ae.id,!1),z())}function De(L){if(C.value.size===0)return;const te=C.value.values().next().value,ae=y.value.find(ze=>ze.id===te);if(!ae)return;const ye=ae.options.zIndex??0,Se=y.value.map(ze=>ze.options.zIndex??0),Ee=Math.max(...Se,0),Be=Math.min(...Se,0);switch(L){case"top":ae.options.zIndex=Ee+1;break;case"bottom":ae.options.zIndex=Be-1;break;case"up":ae.options.zIndex=ye+1;break;case"down":ae.options.zIndex=ye-1;break}z()}function Pe(L,te){const{width:ae,height:ye}=h.getPaperDimensions(r.value),Se=96/25.4;i.value=h.computeFitScale(L,te,ae*Se,ye*Se)}function _e(L){if(r.value={...L},s.value[a.value]=r.value,s.value.length>1){const te={paperSize:L.paperSize,orientation:L.orientation,outputRotation:L.outputRotation,customWidth:L.customWidth,customHeight:L.customHeight};for(const ae of s.value)Object.assign(ae,te)}z()}function et(){return g(),s.value.length<=1?ft(s.value[0]):{version:1,pages:s.value.map(ft)}}function Ge(L,te){s.value=vt(L),a.value=0,r.value=s.value[0],te&&(r.value={...r.value,elements:te.map(ae=>({...ae,id:ae.id||h.generateId(),zone:ae.zone||"content",options:{...ae.options},printElementType:{...ae.printElementType}}))},s.value[a.value]=r.value),ie(ve())}function tt(){const L=new Set(s.value.map(ae=>ae.name));let te=s.value.length+1;for(;L.has(`页面 ${te}`);)te++;return`页面 ${te}`}function ot(){if(m())return;g();const L=s.value[a.value]??Re(),te=Ze({...Re(),paperSize:L.paperSize,orientation:L.orientation,customWidth:L.customWidth,customHeight:L.customHeight,name:tt()});s.value.push(te),a.value=s.value.length-1,r.value=te,ce(),z()}function Ke(){if(m())return;g();const L=s.value[a.value],te=JSON.parse(JSON.stringify(L));te.name=`${L.name??`页面 ${a.value+1}`} 副本`,te.elements=te.elements.map(ae=>({...ae,id:h.generateId()})),te.firstPageOverlay={...te.firstPageOverlay,elements:(te.firstPageOverlay?.elements??[]).map(ae=>({...ae,id:h.generateId()}))},s.value.splice(a.value+1,0,te),k(a.value+1),z()}function nt(L){s.value.length<=1||(g(),s.value.splice(L,1),L<a.value?a.value--:L===a.value&&a.value>=s.value.length&&(a.value=s.value.length-1),r.value=s.value[a.value],ce(),z())}function lt(L,te){s.value[L]&&(s.value[L].name=te)}function qe(L,te){if(L===te)return;g();const[ae]=s.value.splice(L,1);s.value.splice(te,0,ae),a.value=te,r.value=ae,ce(),z()}return ie(ve()),e.onMounted(()=>be()),e.onUnmounted(()=>{ke(),P&&(clearTimeout(P),P=null)}),{scale:i,showRuler:t,showGrid:n,snapToGrid:l,showTableGhostBorder:d,templateData:r,elements:y,fields:R,tilingEnabled:u,pages:s,activePageIndex:a,switchPage:k,addPage:ot,duplicatePage:Ke,deletePage:nt,renamePage:lt,movePage:qe,selectedIds:C,selectedElements:v,selectedElement:W,select:f,selectElement:fe,clearSelection:M,selectAll:_,previewIds:ne,setPreview:H,clearPreview:K,commitPreview:b,hasClipboard:oe,copy:p,paste:$,cutSelected:E,tableSelection:he,setTableSelection:pe,canUndo:c,canRedo:N,undo:w,redo:F,recordHistory:z,alignSelected:q,groupSelected:A,ungroupSelected:D,deleteSelected:Z,duplicateSelected:Y,resetZoom:Q,dragStart:xe,dragStop:Qe,addElement:Ae,addFieldElement:Me,moveLayer:De,fitToWindow:Pe,updateTemplateData:_e,getTemplateJson:et,loadTemplate:Ge}}let gt=0;function Gt(){return gt+=1,`guide-${gt}`}function Kt(o,i){const t=e.computed(()=>o.value.guides??[]);function n(r){o.value={...o.value,guides:r([...o.value.guides??[]])},i()}function l(r,u){n(m=>(m.push({type:r,position:u,id:Gt()}),m))}function d(r,u){n(m=>m.map(g=>g.id===r?{...g,position:u}:g))}function s(r){n(u=>u.filter(m=>m.id!==r))}function a(){const r=[],u=[];for(const m of t.value)m.type==="vertical"?r.push(m.position):u.push(m.position);return{vertical:r,horizontal:u}}return{guides:t,addGuide:l,moveGuide:d,removeGuide:s,getGuidePositions:a}}const Oe=Symbol("table-edit"),dt=Symbol("print-upload-image"),ct=Symbol("print-upload-design-background"),ut=Symbol("print-font-catalog"),qt=e.computed(()=>[]);function Yt(o){return{catalog:e.computed(()=>{const t=[],n=new Set;for(const l of e.toValue(o)??[]){const d=l?.family?.trim();if(!d)continue;const s=d.toLowerCase();if(n.has(s))continue;n.add(s);const a=l.label?.trim();t.push(a?{family:d,label:a}:{family:d})}return t})}}function jt(){return e.inject(ut,qt)}function ht(o,i){const t=i?.trim().toLowerCase();if(t)return o.find(n=>n.family.trim().toLowerCase()===t)}function bt(o){return o.label?`${o.label}(${o.family})`:o.family}function He(o){return o.toLowerCase().replace(/\s+/g,"")}function Et(o,i){if(o===i)return 0;if(o.startsWith(i))return 1;if(o.includes(i))return 2;let t=0;for(const n of o)if(n===i[t]&&t++,t===i.length)return 3;return-1}function Xt(o,i){const t=He(i.trim());return t?o.map((n,l)=>({font:n,index:l,rank:Zt(n,t)})).filter(n=>n.rank>=0).sort((n,l)=>n.rank-l.rank||n.index-l.index).map(n=>n.font):[...o]}function Zt(o,i){const t=Et(He(o.family),i);if(!o.label)return t;const n=Et(He(o.label),i);return t<0?n:n<0?t:Math.min(t,n)}const Jt="print-designer-font-face";function Qt(o){const i=`${Jt}-${e.useId()}`;let t;e.watchEffect(()=>{const n=e.toValue(o);if(!n){t?.remove(),t=void 0;return}t||(t=document.createElement("style"),t.id=i,document.head.appendChild(t)),t.textContent=n}),e.onUnmounted(()=>{t?.remove(),t=void 0})}const _t=e.defineComponent({__name:"HelpButton",emits:["click"],setup(o){return(i,t)=>(e.openBlock(),e.createElementBlock("button",{class:"help-button",title:"帮助文档",onClick:t[0]||(t[0]=n=>i.$emit("click"))},[...t[1]||(t[1]=[e.createElementVNode("span",{class:"help-icon"},"?",-1)])]))}}),re=(o,i)=>{const t=o.__vccOpts||o;for(const[n,l]of i)t[n]=l;return t},eo=re(_t,[["__scopeId","data-v-80ccab03"]]),to={class:"designer-toolbar"},oo={class:"tb-group"},no={class:"tb-title"},lo={class:"tb-title-name"},ao={class:"tb-group"},io=["disabled"],so=["disabled"],ro={key:0,class:"tb-group"},co={key:1,class:"tb-group"},uo={key:2,class:"tb-group"},mo={key:3,class:"tb-group"},po={class:"tb-group"},vo={class:"tb-zoom"},fo={key:4,class:"tb-group"},go={class:"tb-group"},ho={class:"tb-group"},bo=e.defineComponent({__name:"DesignerToolbar",props:e.mergeModels({isEdit:{type:Boolean},canUndo:{type:Boolean},canRedo:{type:Boolean},hasMultiSelection:{type:Boolean},hasSelection:{type:Boolean},showRuler:{type:Boolean,default:!0},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},selectedElementHasGroup:{type:Boolean},overlayVisible:{type:Boolean},showHelp:{type:Boolean,default:!0}},{scale:{default:100},scaleModifiers:{}}),emits:e.mergeModels(["preview","save","undo","redo","align","move-layer","toggle-ruler","toggle-grid","toggle-snap","toggle-table-ghost-border","toggle-overlay","group","ungroup","add-overlay-element","fit-window","zoom","help"],["update:scale"]),setup(o){const i=e.useModel(o,"scale");return(t,n)=>(e.openBlock(),e.createElementBlock("div",to,[e.createElementVNode("div",oo,[n[29]||(n[29]=e.createStaticVNode('<span class="tb-mark" aria-hidden="true" data-v-7a58c9f4><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-7a58c9f4><rect x="5" y="3" width="14" height="18" rx="2.5" data-v-7a58c9f4></rect><line x1="8.5" y1="8.5" x2="15.5" y2="8.5" data-v-7a58c9f4></line><line x1="8.5" y1="12.5" x2="15.5" y2="12.5" data-v-7a58c9f4></line><line x1="8.5" y1="16.5" x2="12.5" y2="16.5" data-v-7a58c9f4></line></svg></span>',1)),e.createElementVNode("div",no,[e.createElementVNode("span",lo,e.toDisplayString(o.isEdit?"编辑模板":"新建模板"),1),n[28]||(n[28]=e.createElementVNode("span",{class:"tb-title-sub"},"打印模板设计器",-1))])]),e.createElementVNode("div",ao,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.canUndo,onClick:n[0]||(n[0]=l=>t.$emit("undo")),"data-tip":"撤销"},"↶",8,io),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.canRedo,onClick:n[1]||(n[1]=l=>t.$emit("redo")),"data-tip":"重做"},"↷",8,so)]),o.hasMultiSelection?(e.openBlock(),e.createElementBlock("div",ro,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[2]||(n[2]=l=>t.$emit("align","left")),title:"左对齐"},"⇤"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[3]||(n[3]=l=>t.$emit("align","right")),title:"右对齐"},"⇥"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[4]||(n[4]=l=>t.$emit("align","top")),title:"顶对齐"},"⇡"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[5]||(n[5]=l=>t.$emit("align","bottom")),title:"底对齐"},"⇣"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[6]||(n[6]=l=>t.$emit("align","vertical")),title:"水平居中"},"↔"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[7]||(n[7]=l=>t.$emit("align","horizontal")),title:"垂直居中"},"↕"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[8]||(n[8]=l=>t.$emit("align","distributeHor")),title:"水平分布"},"⇔"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[9]||(n[9]=l=>t.$emit("align","distributeVer")),title:"垂直分布"},"⇕")])):e.createCommentVNode("",!0),o.hasMultiSelection?(e.openBlock(),e.createElementBlock("div",co,[e.createElementVNode("button",{class:"tb-btn",onClick:n[10]||(n[10]=l=>t.$emit("group")),title:"组合"},"组合")])):e.createCommentVNode("",!0),!o.hasMultiSelection&&o.selectedElementHasGroup?(e.openBlock(),e.createElementBlock("div",uo,[e.createElementVNode("button",{class:"tb-btn",onClick:n[11]||(n[11]=l=>t.$emit("ungroup")),title:"取消组合"},"取消组合")])):e.createCommentVNode("",!0),o.hasSelection?(e.openBlock(),e.createElementBlock("div",mo,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[12]||(n[12]=l=>t.$emit("move-layer","top")),"data-tip":"置顶"},"⤒"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[13]||(n[13]=l=>t.$emit("move-layer","up")),"data-tip":"上移一层"},"↑"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[14]||(n[14]=l=>t.$emit("move-layer","down")),"data-tip":"下移一层"},"↓"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[15]||(n[15]=l=>t.$emit("move-layer","bottom")),"data-tip":"置底"},"⤓")])):e.createCommentVNode("",!0),e.createElementVNode("div",po,[e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:o.showRuler}]),"data-tip":"显示/隐藏标尺",onClick:n[16]||(n[16]=l=>t.$emit("toggle-ruler"))},[...n[30]||(n[30]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 标尺 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:o.showGrid}]),"data-tip":"显示/隐藏网格背景",onClick:n[17]||(n[17]=l=>t.$emit("toggle-grid"))},[...n[31]||(n[31]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 网格 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:o.showTableGhostBorder}]),"data-tip":"显示/隐藏无边框表格的虚拟虚线",onClick:n[18]||(n[18]=l=>t.$emit("toggle-table-ghost-border"))},[...n[32]||(n[32]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 虚框 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{on:o.snapToGrid}]),"data-tip":"开启/关闭元素吸附到网格",onClick:n[19]||(n[19]=l=>t.$emit("toggle-snap"))},[...n[33]||(n[33]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 吸附 ",-1)])],2),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[20]||(n[20]=l=>t.$emit("fit-window")),"data-tip":"适应窗口"},"⤢"),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[21]||(n[21]=l=>t.$emit("zoom",-10)),"data-tip":"缩小"},"−"),e.createElementVNode("span",vo,e.toDisplayString(i.value)+"%",1),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:n[22]||(n[22]=l=>t.$emit("zoom",10)),"data-tip":"放大"},"+")]),n[34]||(n[34]=e.createElementVNode("div",{class:"tb-spacer"},null,-1)),o.showHelp?(e.openBlock(),e.createElementBlock("div",fo,[e.createVNode(eo,{onClick:n[23]||(n[23]=l=>t.$emit("help"))})])):e.createCommentVNode("",!0),e.createElementVNode("div",go,[e.createElementVNode("button",{class:"tb-btn",onClick:n[24]||(n[24]=l=>t.$emit("add-overlay-element"))},"首页专属"),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn",{warn:o.overlayVisible}]),onClick:n[25]||(n[25]=l=>t.$emit("toggle-overlay"))},"叠层对比",2)]),e.createElementVNode("div",ho,[e.createElementVNode("button",{class:"btn-secondary",onClick:n[26]||(n[26]=l=>t.$emit("preview"))},"预览"),e.createElementVNode("button",{class:"btn-primary",onClick:n[27]||(n[27]=l=>t.$emit("save"))},"保存")])]))}}),Eo=re(bo,[["__scopeId","data-v-7a58c9f4"]]),yo={class:"layer-panel"},ko=["onClick"],Vo={class:"layer-icon"},No={class:"layer-name"},wo={key:0,class:"layer-zone"},Co={class:"layer-zindex"},So={key:0,class:"layer-actions"},Bo=e.defineComponent({__name:"LayerPanel",props:{elements:{},selectedIds:{}},emits:["select","move-layer"],setup(o){const i=o,t=e.computed(()=>[...i.elements].sort((a,r)=>(r.options.zIndex??0)-(a.options.zIndex??0))),n={text:"T",longText:"¶",table:"⊞",image:"🖼",barcode:"≡",qrcode:"▣",hline:"—",vline:"|",rect:"□",oval:"○",html:"<>"};function l(a){return n[a.printElementType.type]||"?"}function d(a){return a.options.title||a.printElementType.title||a.printElementType.type}function s(a){return a.zone==="header"?"页眉":a.zone==="footer"?"页脚":""}return(a,r)=>(e.openBlock(),e.createElementBlock("div",yo,[r[4]||(r[4]=e.createElementVNode("div",{class:"panel-title"},"图层",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,u=>(e.openBlock(),e.createElementBlock("div",{key:u.id,class:e.normalizeClass(["layer-item",{active:o.selectedIds.has(u.id)}]),onClick:m=>a.$emit("select",u.id,!1)},[e.createElementVNode("span",Vo,e.toDisplayString(l(u)),1),e.createElementVNode("span",No,e.toDisplayString(d(u)),1),s(u)?(e.openBlock(),e.createElementBlock("span",wo,e.toDisplayString(s(u)),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Co,"z:"+e.toDisplayString(u.options.zIndex??0),1)],10,ko))),128)),t.value.length>0?(e.openBlock(),e.createElementBlock("div",So,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:r[0]||(r[0]=u=>a.$emit("move-layer","top")),title:"置顶"}," ⤒ "),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:r[1]||(r[1]=u=>a.$emit("move-layer","up")),title:"上移"}," ↑ "),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:r[2]||(r[2]=u=>a.$emit("move-layer","down")),title:"下移"}," ↓ "),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:r[3]||(r[3]=u=>a.$emit("move-layer","bottom")),title:"置底"}," ⤓ ")])):e.createCommentVNode("",!0)]))}}),xo=re(Bo,[["__scopeId","data-v-f7a10482"]]),$o={class:"field-tree-panel"},To={class:"tree-container"},Do=["onClick"],Mo={class:"expand-icon"},Po={class:"node-icon"},zo={class:"group-label"},Lo=["onDragstart"],Ro={class:"node-label"},Ao={class:"node-key"},Io={key:0,class:"pd-empty"},Fo=e.defineComponent({__name:"FieldTreePanel",props:{fields:{}},emits:["field-drag"],setup(o,{emit:i}){const t=o,n=i,l=e.ref(""),d=e.ref(new Set),s=e.computed(()=>!!l.value.trim()),a=e.computed(()=>h.filterGroups(h.groupFields(t.fields),l.value));function r(m){const g=new Set(d.value);g.has(m)?g.delete(m):g.add(m),d.value=g}function u(m,g){m.dataTransfer?.setData("fieldData",JSON.stringify({fieldKey:g.fieldKey,fieldLabel:g.fieldLabel})),m.dataTransfer&&(m.dataTransfer.effectAllowed="copy"),n("field-drag",g)}return(m,g)=>(e.openBlock(),e.createElementBlock("div",$o,[g[2]||(g[2]=e.createElementVNode("div",{class:"panel-title"},"业务字段",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":g[0]||(g[0]=k=>l.value=k),class:"pd-input search-input",type:"search",placeholder:"搜索字段...","aria-label":"搜索字段"},null,512),[[e.vModelText,l.value]]),e.createElementVNode("div",To,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,k=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:k.key||"_top"},[k.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["field-group-header",{"is-list":k.isList}]),onClick:y=>r(k.key)},[e.createElementVNode("span",Mo,e.toDisplayString(d.value.has(k.key)&&!s.value?"▶":"▼"),1),e.createElementVNode("span",Po,e.toDisplayString(k.isList?"📋":"📁"),1),e.createElementVNode("span",zo,e.toDisplayString(k.label),1)],10,Do)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.fields,y=>(e.openBlock(),e.createElementBlock("div",{key:y.fieldKey,class:"field-row",draggable:"true",style:e.normalizeStyle({paddingLeft:(k.key?22:8)+"px"}),onDragstart:R=>u(R,y)},[g[1]||(g[1]=e.createElementVNode("span",{class:"node-icon"},"📄",-1)),e.createElementVNode("span",Ro,e.toDisplayString(y.fieldLabel),1),e.createElementVNode("span",Ao,"("+e.toDisplayString(y.fieldKey)+")",1)],44,Lo))),128))],512),[[e.vShow,!k.key||s.value||!d.value.has(k.key)]])],64))),128))]),a.value.length===0?(e.openBlock(),e.createElementBlock("p",Io,"暂无字段")):e.createCommentVNode("",!0)]))}}),Uo=re(Fo,[["__scopeId","data-v-9b326f07"]]),Ho={key:0,class:"left-collapsed"},Oo={class:"left-head"},Wo={class:"pd-tabs left-tabs"},Go={class:"pd-tab-bar",role:"tablist"},Ko={class:"pd-tab-pane",role:"tabpanel"},qo=["onDragstart"],Yo={class:"material-icon"},jo={class:"material-label"},Xo={class:"pd-tab-pane",role:"tabpanel"},Zo={class:"pd-tab-pane",role:"tabpanel"},Jo=e.defineComponent({__name:"LeftPanel",props:{fields:{},elements:{},selectedIds:{},collapsed:{type:Boolean}},emits:["select","move-layer","toggle-visible","toggle-locked","field-drag","toggle-collapse"],setup(o,{emit:i}){const t=i,n=e.ref("elements"),l=[{type:"text",label:"文本",icon:"T"},{type:"barcode",label:"条形码",icon:"▍▍"},{type:"qrcode",label:"二维码",icon:"▦"},{type:"image",label:"图片",icon:"▧"},{type:"table",label:"表格",icon:"⊞"},{type:"longText",label:"长文",icon:"¶"},{type:"hline",label:"横线",icon:"―"},{type:"vline",label:"竖线",icon:"│"},{type:"rect",label:"矩形",icon:"▭"},{type:"oval",label:"椭圆",icon:"◯"},{type:"html",label:"HTML",icon:"<>"}];function d(r,u){r.dataTransfer?.setData("elementType",u)}function s(r){t("field-drag",r)}function a(r){n.value=r,t("toggle-collapse")}return(r,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["left-panel",{collapsed:o.collapsed}])},[o.collapsed?(e.openBlock(),e.createElementBlock("div",Ho,[e.createElementVNode("button",{class:"lc-btn",title:"展开素材台",onClick:u[0]||(u[0]=m=>a(n.value))},"»"),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="elements"}]),title:"元素",onClick:u[1]||(u[1]=m=>a("elements"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="fields"}]),title:"字段",onClick:u[2]||(u[2]=m=>a("fields"))},"⊛",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="layers"}]),title:"图层",onClick:u[3]||(u[3]=m=>a("layers"))},"≡",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Oo,[u[12]||(u[12]=e.createElementVNode("span",{class:"left-title"},"素材台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起素材台",onClick:u[4]||(u[4]=m=>r.$emit("toggle-collapse"))},"«")]),e.createElementVNode("div",Wo,[e.createElementVNode("div",Go,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="elements"}]),onClick:u[5]||(u[5]=m=>n.value="elements")},"元素",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="fields"}]),onClick:u[6]||(u[6]=m=>n.value="fields")},"字段",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="layers"}]),onClick:u[7]||(u[7]=m=>n.value="layers")},"图层",2)]),e.withDirectives(e.createElementVNode("div",Ko,[u[13]||(u[13]=e.createElementVNode("div",{class:"panel-title"},"拖拽元素到画布",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(l,m=>e.createElementVNode("div",{key:m.type,class:"material-card",draggable:"true",onDragstart:g=>d(g,m.type)},[e.createElementVNode("span",Yo,e.toDisplayString(m.icon),1),e.createElementVNode("span",jo,e.toDisplayString(m.label),1)],40,qo)),64))],512),[[e.vShow,n.value==="elements"]]),e.withDirectives(e.createElementVNode("div",Xo,[e.createVNode(Uo,{fields:o.fields,onFieldDrag:s},null,8,["fields"])],512),[[e.vShow,n.value==="fields"]]),e.withDirectives(e.createElementVNode("div",Zo,[e.createVNode(xo,{elements:o.elements,"selected-ids":o.selectedIds,onSelect:u[8]||(u[8]=(m,g)=>r.$emit("select",m,g)),onMoveLayer:u[9]||(u[9]=m=>r.$emit("move-layer",m)),onToggleVisible:u[10]||(u[10]=m=>r.$emit("toggle-visible",m)),onToggleLocked:u[11]||(u[11]=m=>r.$emit("toggle-locked",m))},null,8,["elements","selected-ids"])],512),[[e.vShow,n.value==="layers"]])])],64))],2))}}),Qo=re(Jo,[["__scopeId","data-v-15dad0f0"]]);function _o(o,i){const t=e.ref(!1),n=e.ref(null);let l=0,d=0,s=0,a=0,r=!1;function u(C){if(i.disabled||C.button!==0)return;const v=C.target;if(!(v instanceof Element)||v.classList.contains("resize-handle"))return;t.value=!0,r=C.altKey,l=C.clientX,d=C.clientY;const f=o.value;f&&(s=parseFloat(f.style.left)||0,a=parseFloat(f.style.top)||0,n.value={left:s,top:a,width:parseFloat(f.style.width)||0,height:parseFloat(f.style.height)||0},i.onStart?.({altKey:r}),document.addEventListener("mousemove",g),document.addEventListener("mouseup",k),C.preventDefault())}function m(C){const v=i.getScale?.()??1;let f=s+(C.clientX-l)/v,M=a+(C.clientY-d)/v;if(i.axis==="x"&&(M=a),i.axis==="y"&&(f=s),i.onAdsorb){const j=o.value;if(j){const ne=parseFloat(j.style.width)||0,H=parseFloat(j.style.height)||0,K=i.onAdsorb({left:f,top:M,width:ne,height:H});f=K.left,M=K.top}}return{left:f,top:M}}function g(C){const v=m(C);n.value&&(n.value.left=v.left,n.value.top=v.top),i.onDrag(v)}function k(C){t.value=!1;const v=m(C);i.onDragEnd?.(v,{altKey:r}),i.onStop?.(),n.value=null,document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",k)}function y(){const C=o.value;C&&C.removeEventListener("mousedown",u),document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",k)}function R(){y();const C=o.value;C&&C.addEventListener("mousedown",u)}return{isDragging:t,dragPreview:n,setup:R,cleanup:y}}function en(o){const i=[];return o.getAttribute("data-fit")==="shrink"&&i.push(o),o.querySelectorAll('[data-fit="shrink"]').forEach(t=>i.push(t)),i}function tn(o){o.querySelectorAll("[data-fit-size]").forEach(i=>{if(i.getAttribute("data-fit")==="shrink")return;i.removeAttribute("data-fit-size");const t=i.getAttribute("data-fit-base");t?i.style.fontSize=`${t}pt`:i.style.removeProperty("font-size")})}function mt(o,i){const t=()=>{const n=o.value;n&&(en(n).forEach(Ue.fitTextNode),tn(n))};e.watchEffect(()=>{i(),e.nextTick(t)},{flush:"post"}),e.onMounted(()=>{e.nextTick(t)})}const on=["data-fit","data-fit-base","data-fit-min"],nn=e.defineComponent({__name:"TextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t={top:"flex-start",middle:"center",bottom:"flex-end"},n={left:"flex-start",center:"center",right:"flex-end"},l=e.ref(null),d=e.computed(()=>h.resolveElementTextFit("text",i.element.options)),s=e.computed(()=>i.element.options.fontSize||12),a=e.computed(()=>h.resolveShrinkMinFontSize(i.element.options.shrinkMinFontSize)),r=e.computed(()=>{const m=i.element.options,g=d.value==="autoHeight";return{fontSize:s.value+"pt",fontWeight:m.fontWeight||"normal",fontFamily:m.fontFamily||"inherit",color:m.color||"#333",backgroundColor:m.backgroundColor||"transparent",textAlign:m.textAlign||"left",lineHeight:m.lineHeight?m.lineHeight+"pt":"normal",letterSpacing:m.letterSpacing?m.letterSpacing+"pt":"normal",textDecoration:m.textDecoration||"none",padding:`${m.contentPaddingTop||0}pt ${m.contentPaddingRight||0}pt ${m.contentPaddingBottom||0}pt ${m.contentPaddingLeft||0}pt`,width:"100%",height:g?"auto":"100%",boxSizing:"border-box",overflow:g?"visible":"hidden",...m.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...m.verticalAlign?{display:"flex",alignItems:t[m.verticalAlign]??"flex-start",justifyContent:n[m.textAlign||"left"]??"flex-start"}:{}}}),u=e.computed(()=>i.designMode?i.element.options.testData?i.element.options.testData:i.element.options.formatter||"文本":h.resolveTextBinding(i.element.options,i.data));return mt(l,()=>[d.value,s.value,a.value,i.element.options.width,i.element.options.height,i.element.options.wordWrap,i.element.options.letterSpacing,i.element.options.lineHeight,u.value]),(m,g)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:l,class:"print-text",style:e.normalizeStyle(r.value),"data-fit":d.value==="shrink"?"shrink":void 0,"data-fit-base":String(s.value),"data-fit-min":String(a.value)},e.toDisplayString(u.value),13,on))}}),ln={class:"print-image"},an=["src"],sn={key:1,class:"image-placeholder"},rn=e.defineComponent({__name:"ImageElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t=e.computed(()=>{const s=i.element.options.src||"";return s?s.includes("{")?i.designMode?h.evaluateTemplate(s,h.DEFAULT_DEMO_DATA):h.evaluateTemplate(s,i.data?.[0]||{}):s:""}),n=e.ref(!1);function l(){n.value=!0}e.watch(t,()=>{n.value=!1});const d=e.computed(()=>({objectFit:i.element.options.fit||"contain"}));return(s,a)=>(e.openBlock(),e.createElementBlock("div",ln,[t.value&&!n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,style:e.normalizeStyle(d.value),onError:l},null,44,an)):(e.openBlock(),e.createElementBlock("div",sn,"图片"))]))}}),dn=re(rn,[["__scopeId","data-v-007a2979"]]),cn=["data-fit","data-fit-base","data-fit-min"],un=e.defineComponent({__name:"LongTextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t={top:"flex-start",middle:"center",bottom:"flex-end"},n={left:"flex-start",center:"center",right:"flex-end"},l=e.ref(null),d=e.computed(()=>h.resolveElementTextFit("longText",i.element.options)),s=e.computed(()=>i.element.options.fontSize||12),a=e.computed(()=>h.resolveShrinkMinFontSize(i.element.options.shrinkMinFontSize)),r=e.computed(()=>{const m=i.element.options,g=d.value==="autoHeight";return{fontSize:s.value+"pt",fontWeight:m.fontWeight||"normal",fontFamily:m.fontFamily||"inherit",color:m.color||"#333",backgroundColor:m.backgroundColor||"transparent",textAlign:m.textAlign||"left",lineHeight:m.lineHeight?m.lineHeight+"pt":"1.5",letterSpacing:m.letterSpacing?m.letterSpacing+"pt":"normal",textIndent:m.longTextIndent?m.longTextIndent+"pt":"0",width:"100%",height:g?"auto":"100%",overflow:g?"visible":"hidden",wordBreak:"break-all",boxSizing:"border-box",...m.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...m.verticalAlign?{display:"flex",alignItems:t[m.verticalAlign]??"flex-start",justifyContent:n[m.textAlign||"left"]??"flex-start"}:{}}}),u=e.computed(()=>i.designMode?i.element.options.formatter?i.element.options.formatter:"长文本内容":h.resolveTextBinding(i.element.options,i.data));return mt(l,()=>[d.value,s.value,a.value,i.element.options.width,i.element.options.height,i.element.options.wordWrap,i.element.options.lineHeight,u.value]),(m,g)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:l,class:"print-longtext",style:e.normalizeStyle(r.value),"data-fit":d.value==="shrink"?"shrink":void 0,"data-fit-base":String(s.value),"data-fit-min":String(a.value)},e.toDisplayString(u.value),13,cn))}}),mn=["title"],pn=["title","onClick"],vn=e.defineComponent({__name:"TableContextMenu",props:{visible:{type:Boolean},x:{},y:{},canDeleteRow:{type:Boolean},canDeleteCol:{type:Boolean},mergeDisabledReason:{},canSplit:{type:Boolean},currentRowType:{},rowTypeDisabledReason:{type:Function}},emits:["action"],setup(o,{emit:i}){const t=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行"},{value:"summary",label:"汇总行"}],n=i;function l(d,s){n("action",d,s)}return(d,s)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[o.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"table-ctx-menu",style:e.normalizeStyle({left:o.x+"px",top:o.y+"px"}),onMousedown:s[8]||(s[8]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:"menu-item",onClick:s[0]||(s[0]=a=>l("insert-row-above"))},"在上方插入行"),e.createElementVNode("div",{class:"menu-item",onClick:s[1]||(s[1]=a=>l("insert-row-below"))},"在下方插入行"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canDeleteRow}]),onClick:s[2]||(s[2]=a=>o.canDeleteRow&&l("delete-row"))}," 删除行 ",2),s[9]||(s[9]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:"menu-item",onClick:s[3]||(s[3]=a=>l("insert-col-left"))},"在左侧插入列"),e.createElementVNode("div",{class:"menu-item",onClick:s[4]||(s[4]=a=>l("insert-col-right"))},"在右侧插入列"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canDeleteCol}]),onClick:s[5]||(s[5]=a=>o.canDeleteCol&&l("delete-col"))}," 删除列 ",2),s[10]||(s[10]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!!o.mergeDisabledReason}]),title:o.mergeDisabledReason||"",onClick:s[6]||(s[6]=a=>!o.mergeDisabledReason&&l("merge"))}," 合并单元格 ",10,mn),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canSplit}]),onClick:s[7]||(s[7]=a=>o.canSplit&&l("split"))}," 拆分单元格 ",2),s[11]||(s[11]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),s[12]||(s[12]=e.createElementVNode("div",{class:"menu-group-title"},"行类型",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(t,a=>e.createElementVNode("div",{key:a.value,class:e.normalizeClass(["menu-item",{disabled:!!o.rowTypeDisabledReason(a.value),active:o.currentRowType===a.value}]),title:o.rowTypeDisabledReason(a.value)||"",onClick:r=>!o.rowTypeDisabledReason(a.value)&&l("set-row-type",a.value)},e.toDisplayString(a.label),11,pn)),64))],36)):e.createCommentVNode("",!0)]))}}),fn=re(vn,[["__scopeId","data-v-44e319c1"]]),gn={class:"cell-barcode"},hn=["preserveAspectRatio"],bn=["src"],En={key:1,class:"cell-barcode-fallback"},yn=e.defineComponent({__name:"CellBarcode",props:{cellType:{},value:{},barcodeType:{},qrCodeLevel:{},showText:{type:Boolean},fit:{},maxWidth:{},maxHeight:{},printerDpi:{},targetWidthMm:{},targetHeightMm:{},barWidth:{},barFontSize:{}},setup(o){const i=o,t=e.ref(null),n=e.ref(!1),l=e.ref(""),d=e.ref(null),s={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},a=e.computed(()=>s[i.fit||"contain"]??"xMidYMid meet"),r=e.computed(()=>d.value?{width:d.value.width,height:d.value.height}:{maxWidth:i.maxWidth?`${i.maxWidth}mm`:"100%",maxHeight:i.maxHeight?`${i.maxHeight}mm`:"100%"}),u=e.computed(()=>({objectFit:i.fit||"contain",maxWidth:i.maxWidth?`${i.maxWidth}mm`:"100%",maxHeight:i.maxHeight?`${i.maxHeight}mm`:"100%"}));function m(){if(n.value=!1,d.value=null,!t.value)return;const R=h.barcodeUnitsPerModule(i.barWidth);try{Bt(t.value,i.value,{format:i.barcodeType||"CODE128",width:R,height:h.BARCODE_BAR_HEIGHT_MODULES*R,displayValue:i.showText!==!1,fontSize:(i.barFontSize??h.BARCODE_TEXT_FONT_SIZE_MODULES)*R,margin:0,marginLeft:h.BARCODE_QUIET_ZONE_MODULES*R,marginRight:h.BARCODE_QUIET_ZONE_MODULES*R,marginTop:0,marginBottom:h.BARCODE_MARGIN_BOTTOM_MODULES*R})}catch{return}n.value=!0;const C=g(t.value),v=C?h.resolveBarcodeSize({unitWidth:C.width/R,unitHeight:C.height/R,boxWidthMm:h.barcodeAvailableBoxMm(i.targetWidthMm,i.maxWidth),boxHeightMm:h.barcodeAvailableBoxMm(i.targetHeightMm,i.maxHeight),dpi:i.printerDpi,barWidth:i.barWidth}):null;d.value=v?{width:`${v.widthMm}mm`,height:`${v.heightMm}mm`}:null,t.value.setAttribute("shape-rendering","crispEdges")}function g(R){const C=(R.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return C.length!==4||C.some(v=>!Number.isFinite(v))?null:{width:C[2],height:C[3]}}async function k(){if(!i.value){l.value="";return}try{l.value=await xt.toDataURL(i.value,{width:96,margin:1,errorCorrectionLevel:i.qrCodeLevel||"M"})}catch{l.value=""}}function y(){i.cellType==="barcode"?m():k()}return e.onMounted(y),e.watch(()=>[i.cellType,i.value,i.barcodeType,i.qrCodeLevel,i.showText,i.printerDpi,i.targetWidthMm,i.targetHeightMm,i.barWidth,i.barFontSize,i.maxWidth,i.maxHeight],y),(R,C)=>(e.openBlock(),e.createElementBlock("div",gn,[e.withDirectives((e.openBlock(),e.createElementBlock("svg",{ref_key:"barcodeSvg",ref:t,preserveAspectRatio:a.value,style:e.normalizeStyle(r.value)},null,12,hn)),[[e.vShow,o.cellType==="barcode"&&n.value]]),o.cellType==="qrcode"&&l.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:l.value,alt:"qrcode",style:e.normalizeStyle(u.value)},null,12,bn)):e.createCommentVNode("",!0),!n.value&&o.cellType==="barcode"?(e.openBlock(),e.createElementBlock("span",En,e.toDisplayString(o.value||"条码"),1)):e.createCommentVNode("",!0)]))}}),kn=re(yn,[["__scopeId","data-v-81e37239"]]),Vn={class:"cell-image"},Nn=["src"],wn={key:1,class:"image-placeholder"},Cn=e.defineComponent({__name:"CellImage",props:{value:{},fit:{},maxWidth:{},maxHeight:{},designMode:{type:Boolean},data:{}},setup(o){const i=o,t=e.computed(()=>{const s=i.value||"";return s?s.includes("{")?i.designMode?h.evaluateTemplate(s,h.DEFAULT_DEMO_DATA):h.evaluateTemplate(s,i.data?.[0]||{}):s:""}),n=e.ref(!1);function l(){n.value=!0}e.watch(t,()=>{n.value=!1});const d=e.computed(()=>({objectFit:i.fit||"contain",maxWidth:i.maxWidth?`${i.maxWidth}mm`:"100%",maxHeight:i.maxHeight?`${i.maxHeight}mm`:"100%"}));return(s,a)=>(e.openBlock(),e.createElementBlock("div",Vn,[t.value&&!n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,style:e.normalizeStyle(d.value),onError:l},null,44,Nn)):(e.openBlock(),e.createElementBlock("div",wn,"图片"))]))}}),Sn=re(Cn,[["__scopeId","data-v-d5bc444b"]]),Bn=["rowspan","colspan","onMousedown","onMouseenter","onDblclick","onContextmenu"],xn=["data-fit","data-fit-base","data-fit-min","data-fit-mm"],$n={key:0,class:"data-placeholder"},Tn={key:3,class:"data-placeholder"},Dn={key:0,class:"col-resize-layer"},Mn=["aria-label","onMousedown"],Pn={key:1,class:"row-badges"},je=3.7795275591,zn=.1,Ln=e.defineComponent({__name:"TableElement",props:{element:{},designMode:{type:Boolean},isSelected:{type:Boolean},showTableGhostBorder:{type:Boolean},scale:{},data:{}},emits:["dblclick-element","dblclick-cell"],setup(o,{emit:i}){const t={header:"题",data:"数",subtotal:"小",summary:"汇"},n=o,l=i,d=e.inject(Oe,{tableSelection:e.ref(null),setTableSelection:()=>{},recordHistory:()=>{},maxTableWidth:e.ref(1/0)}),s=e.computed(()=>n.element.options.tableRows??[]),a=e.computed(()=>n.element.options.tableColWidths??[]),r=e.computed(()=>n.element.options.tableDefaultFontSize??10),u=e.computed(()=>n.element.options.tableDefaultColor??"#333333"),m=e.computed(()=>{const P=d.tableSelection.value;return P&&P.elementId===n.element.id?P:null});function g(P){let I=0;for(let O=0;O<P;O++)I+=s.value[O].height;return I}const k=e.ref(null),y=e.ref(null),R=e.ref([]);function C(){if(!n.designMode)return;const P=k.value;if(!P)return;const I=P.offsetHeight;if(I<=0)return;const O=n.element.options,_=I/je;Math.abs(_-(O.height??0))>zn&&(O.height=Math.round(_*100)/100);const q=P.offsetTop;R.value=Array.from(P.rows).map(fe=>({top:(fe.offsetTop-q)/je,height:fe.offsetHeight/je}))}function v(P){return R.value[P]?.top??g(P)}function f(P){return R.value[P]?.height??s.value[P]?.height??0}e.watch(()=>[n.element.options,n.designMode],()=>C(),{deep:!0,flush:"post"}),e.onMounted(()=>{C(),document.fonts?.ready.then(()=>C())});const M=e.computed(()=>{const P=n.element.options.dataSource;if(P&&Array.isArray(h.DEFAULT_DEMO_DATA[P]))return h.DEFAULT_DEMO_DATA[P];for(const I of Object.values(h.DEFAULT_DEMO_DATA))if(Array.isArray(I))return I}),j=e.computed(()=>{if(n.data)return n.data});function ne(P){return P.cellType==="barcode"||P.cellType==="qrcode"}function H(P,I){return ne(I)?h.resolveBarcodeDesignValue(I.formatter,M.value):I.formatter||""}function K(P,I){const O=n.element.options,_={designMode:n.designMode,showGhostBorder:n.showTableGhostBorder};return{fontFamily:I.fontFamily||"inherit",textAlign:I.align??"left",verticalAlign:I.valign??"middle",fontSize:(I.fontSize??r.value)+"pt",fontWeight:I.fontWeight??"normal",color:I.color??u.value,backgroundColor:I.backgroundColor??"transparent",borderTop:h.resolveCellBorderCss(I.borders?.top,_),borderRight:h.resolveCellBorderCss(I.borders?.right,_),borderBottom:h.resolveCellBorderCss(I.borders?.bottom,_),borderLeft:h.resolveCellBorderCss(I.borders?.left,_),padding:(I.padding??O.tableDefaultPadding??1)+"mm",whiteSpace:I.wordWrap??!0?"normal":"nowrap",overflow:I.wordWrap??!0?"visible":"hidden"}}function b(P){return h.resolveCellTextFit(P)}function B(P){return b(P)!=="autoHeight"}function S(P){return P.fontSize??r.value}function x(P,I){return h.cellFitCapMm(s.value,P,I,n.element.options.tableDefaultPadding??1)}function T(P,I){return h.cellFitWidthMm(a.value,P,I,n.element.options.tableDefaultPadding??1)}function X(P,I){return{maxHeight:x(I,P)+"mm",overflow:"hidden",...P.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{}}}mt(y,()=>[n.designMode,n.data?.length,a.value.join(","),r.value,n.element.options.tableDefaultPadding,s.value.map(P=>`${P.height}:${P.cells.map(I=>`${I.formatter??""}|${I.fontSize??""}|${I.wordWrap??""}|${I.textFit??""}|${I.colspan??1}`).join("~")}`).join(",")]);function ee(P,I){const O=m.value;return{"cell-selected":!!O&&P>=O.r1&&P<=O.r2&&I>=O.c1&&I<=O.c2,"row-data-bg":s.value[P].type==="data"}}const le=e.ref(null);function ie(P,I){const O=h.normalizeSelection(s.value,P,I);d.setTableSelection({elementId:n.element.id,...O})}function ue(P,I,O){!n.designMode||!n.isSelected||(O.stopPropagation(),O.shiftKey&&m.value?ie({r:m.value.r1,c:m.value.c1},{r:P,c:I}):(le.value={r:P,c:I},ie({r:P,c:I},{r:P,c:I})),window.addEventListener("mouseup",()=>{le.value=null},{once:!0}))}function J(P,I){le.value&&ie(le.value,{r:P,c:I})}function c(P,I){n.designMode&&l("dblclick-cell",n.element.id,P,I)}const N=e.reactive({visible:!1,x:0,y:0});function W(P,I,O){if(!n.designMode||!n.isSelected)return;const _=m.value;_&&P>=_.r1&&P<=_.r2&&I>=_.c1&&I<=_.c2||ie({r:P,c:I},{r:P,c:I}),N.x=O.clientX,N.y=O.clientY,N.visible=!0,window.addEventListener("mousedown",()=>{N.visible=!1},{once:!0})}const he=e.computed(()=>{const P=m.value;return P?h.canMergeReason(s.value,P):"未选择单元格"}),pe=e.computed(()=>{const P=m.value;if(!P)return!1;for(let I=P.r1;I<=P.r2;I++)for(let O=P.c1;O<=P.c2;O++){const _=s.value[I].cells[O];if(!_.merged&&((_.rowspan??1)>1||(_.colspan??1)>1))return!0}return!1});function ce(P){const I=m.value;if(!I)return"未选择单元格";if(I.r1!==I.r2)return"行类型仅支持单行设置";const O=JSON.parse(JSON.stringify(s.value));return h.setRowType(O,I.r1,P)}function ve(){h.syncTableElementSize(n.element.options)}function z(P,I){const O=d.maxTableWidth.value,_=P.reduce((q,fe)=>q+fe,0)+P[I];return _>O?`插入后表格总宽 ${Math.round(_*10)/10}mm 超过打印范围宽度 ${O}mm,请先缩小列宽`:null}function V(P,I){const O=m.value;if(!O)return;N.visible=!1;const _=n.element.options,q=_.tableRows,fe=_.tableColWidths;let A=null;switch(P){case"insert-row-above":h.insertRow(q,O.r1,"above");break;case"insert-row-below":h.insertRow(q,O.r2,"below");break;case"delete-row":A=h.deleteRow(q,O.r1);break;case"insert-col-left":A=z(fe,O.c1),A||h.insertCol(q,fe,O.c1,"left");break;case"insert-col-right":A=z(fe,O.c2),A||h.insertCol(q,fe,O.c2,"right");break;case"delete-col":A=h.deleteCol(q,fe,O.c1);break;case"merge":h.mergeCells(q,O);break;case"split":h.splitCells(q,O);break;case"set-row-type":A=h.setRowType(q,O.r1,I);break}if(A){alert(A);return}d.setTableSelection(null),ve(),d.recordHistory()}const w=e.computed(()=>n.designMode&&!!n.isSelected&&!n.element.options.locked&&a.value.length>=1),F=e.computed(()=>Array.from({length:a.value.length},(P,I)=>I+1));function p(P){return a.value.slice(0,P).reduce((I,O)=>I+O,0)}const E=e.ref(null);let $=0,Y=0;function Q(P,I){w.value&&I.button===0&&(E.value=P,$=I.clientX,Y=a.value[P-1],document.addEventListener("mousemove",oe),document.addEventListener("mouseup",me))}function oe(P){if(E.value===null)return;const I=n.scale||1,O=(P.clientX-$)/(I*je),_=E.value-1,q=n.element.options.tableColWidths;q[_]=h.clampResizedColumnWidth(q,_,Y+O,d.maxTableWidth.value),ve()}function me(){document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",me),E.value!==null&&(E.value=null,ve(),d.recordHistory())}return e.onUnmounted(()=>{document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",me)}),(P,I)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:y,class:e.normalizeClass(["print-table",{"design-mode":o.designMode}]),onContextmenu:I[0]||(I[0]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("table",{ref_key:"tableRef",ref:k,style:e.normalizeStyle({fontSize:r.value+"pt",color:u.value})},[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(O,_)=>(e.openBlock(),e.createElementBlock("col",{key:_,style:e.normalizeStyle({width:O+"mm"})},null,4))),128))]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(O,_)=>(e.openBlock(),e.createElementBlock("tr",{key:O.id,style:e.normalizeStyle({height:O.height+"mm"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(O.cells,(q,fe)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:q.id},[q.merged?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:q.rowspan||1,colspan:q.colspan||1,class:e.normalizeClass(ee(_,fe)),style:e.normalizeStyle(K(O,q)),onMousedown:e.withModifiers(A=>ue(_,fe,A),["left"]),onMouseenter:A=>J(_,fe),onDblclick:e.withModifiers(A=>c(_,fe),["stop"]),onContextmenu:e.withModifiers(A=>W(_,fe,A),["prevent","stop"])},[ne(q)?(e.openBlock(),e.createBlock(kn,{key:0,"cell-type":q.cellType,value:H(O,q),"barcode-type":q.barcodeType,"qr-code-level":q.qrCodeLevel,"show-text":q.showBarcodeText!==!1,fit:q.fit,"max-width":q.maxWidth,"max-height":q.maxHeight,"printer-dpi":q.printerDpi,"target-width-mm":T(fe,q),"target-height-mm":x(_,q),"bar-width":q.barWidth,"bar-font-size":q.barFontSize},null,8,["cell-type","value","barcode-type","qr-code-level","show-text","fit","max-width","max-height","printer-dpi","target-width-mm","target-height-mm","bar-width","bar-font-size"])):q.cellType==="image"?(e.openBlock(),e.createBlock(Sn,{key:1,value:q.formatter||"",fit:q.fit,"max-width":q.maxWidth,"max-height":q.maxHeight,"design-mode":o.designMode,data:j.value},null,8,["value","fit","max-width","max-height","design-mode","data"])):B(q)?(e.openBlock(),e.createElementBlock("div",{key:2,class:"cell-fit",style:e.normalizeStyle(X(q,_)),"data-fit":b(q)==="shrink"?"shrink":void 0,"data-fit-base":String(S(q)),"data-fit-min":String(e.unref(h.resolveShrinkMinFontSize)(q.shrinkMinFontSize)),"data-fit-mm":x(_,q)},[O.type==="data"?(e.openBlock(),e.createElementBlock("span",$n,e.toDisplayString(H(O,q)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(H(O,q)),1)],64))],12,xn)):O.type==="data"?(e.openBlock(),e.createElementBlock("span",Tn,e.toDisplayString(H(O,q)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createTextVNode(e.toDisplayString(H(O,q)),1)],64))],46,Bn))],64))),128))],4))),128))])],4),w.value?(e.openBlock(),e.createElementBlock("div",Dn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.value,O=>(e.openBlock(),e.createElementBlock("div",{key:O,class:e.normalizeClass(["col-resize-handle",{dragging:E.value===O}]),role:"separator","aria-label":"列宽手柄"+O,style:e.normalizeStyle({left:p(O)+"mm"}),onMousedown:e.withModifiers(_=>Q(O,_),["stop","prevent"])},null,46,Mn))),128))])):e.createCommentVNode("",!0),o.designMode&&o.isSelected?(e.openBlock(),e.createElementBlock("div",Pn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(O,_)=>(e.openBlock(),e.createElementBlock("span",{key:O.id,class:"row-badge",style:e.normalizeStyle({top:v(_)+"mm",height:f(_)+"mm"})},e.toDisplayString(t[O.type]),5))),128))])):e.createCommentVNode("",!0),e.createVNode(fn,{visible:N.visible,x:N.x,y:N.y,"can-delete-row":s.value.length>1,"can-delete-col":a.value.length>1,"merge-disabled-reason":he.value,"can-split":pe.value,"current-row-type":m.value?s.value[m.value.r1]?.type??null:null,"row-type-disabled-reason":ce,onAction:V},null,8,["visible","x","y","can-delete-row","can-delete-col","merge-disabled-reason","can-split","current-row-type"])],34))}}),Rn=re(Ln,[["__scopeId","data-v-4531a154"]]),yt=e.defineComponent({__name:"LineElement",props:{element:{}},setup(o){const i=o,t=e.computed(()=>i.element.printElementType.type==="hline"),n=e.computed(()=>{const l=i.element.options,d=(l.borderWidth||.75)+"pt",s=l.borderStyle||"solid",a=l.borderColor||"#333";return t.value?{width:"100%",height:"0",borderTop:`${d} ${s} ${a}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${d} ${s} ${a}`,boxSizing:"border-box"}});return(l,d)=>(e.openBlock(),e.createElementBlock("div",{class:"print-line",style:e.normalizeStyle(n.value)},null,4))}}),kt=e.defineComponent({__name:"ShapeElement",props:{element:{}},setup(o){const i=o,t=e.computed(()=>i.element.printElementType.type==="oval"),n=e.computed(()=>{const l=i.element.options;return{width:"100%",height:"100%",borderWidth:(l.borderWidth||1)+"pt",borderStyle:l.borderStyle||"solid",borderColor:l.borderColor||"#333",backgroundColor:l.backgroundColor||"transparent",borderRadius:t.value?"50%":"0",boxSizing:"border-box"}});return(l,d)=>(e.openBlock(),e.createElementBlock("div",{class:"print-shape",style:e.normalizeStyle(n.value)},null,4))}}),An={class:"print-barcode",ref:"containerRef"},In=["preserveAspectRatio"],Fn=e.defineComponent({__name:"BarcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t=e.ref(null),n=e.ref(null),l={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},d=e.computed(()=>l[i.element.options.fit||"contain"]??"xMidYMid meet"),s=e.computed(()=>n.value?{width:n.value.width,height:n.value.height}:{maxWidth:"100%",maxHeight:"100%"});function a(){if(!t.value)return;const u=i.element.options,m=(i.designMode?u.testData||u.formatter:h.resolveTextBinding(u,i.data))||"条码",g=h.barcodeUnitsPerModule(u.barWidth);try{Bt(t.value,m,{format:u.barcodeType||"CODE128",width:g,height:h.BARCODE_BAR_HEIGHT_MODULES*g,displayValue:!u.hideTitle,fontSize:(u.fontSize??h.BARCODE_TEXT_FONT_SIZE_MODULES)*g,margin:0,marginLeft:h.BARCODE_QUIET_ZONE_MODULES*g,marginRight:h.BARCODE_QUIET_ZONE_MODULES*g,marginTop:0,marginBottom:h.BARCODE_MARGIN_BOTTOM_MODULES*g})}catch{n.value=null;return}const k=r(t.value),y=k?h.resolveBarcodeSize({unitWidth:k.width/g,unitHeight:k.height/g,boxWidthMm:h.barcodeAvailableBoxMm(u.width,u.maxWidth),boxHeightMm:h.barcodeAvailableBoxMm(u.height,u.maxHeight),dpi:u.printerDpi,barWidth:u.barWidth}):null;n.value=y?{width:`${y.widthMm}mm`,height:`${y.heightMm}mm`}:null,t.value.setAttribute("shape-rendering","crispEdges")}function r(u){const m=(u.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return m.length!==4||m.some(g=>!Number.isFinite(g))?null:{width:m[2],height:m[3]}}return e.onMounted(a),e.watch(()=>[i.element.options.formatter,i.element.options.testData,i.element.options.barcodeType,i.element.options.width,i.element.options.height,i.element.options.barWidth,i.element.options.printerDpi,i.element.options.hideTitle,i.element.options.fontSize,i.element.options.maxWidth,i.element.options.maxHeight],a),(u,m)=>(e.openBlock(),e.createElementBlock("div",An,[(e.openBlock(),e.createElementBlock("svg",{ref_key:"svgRef",ref:t,preserveAspectRatio:d.value,style:e.normalizeStyle(s.value)},null,12,In))],512))}}),Un=re(Fn,[["__scopeId","data-v-6eb95a40"]]),Hn={class:"print-qrcode"},On=["src"],Wn=e.defineComponent({__name:"QrcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t=e.ref(""),n=e.computed(()=>{const d=i.element.options;return{objectFit:d.fit||"contain",maxWidth:d.maxWidth?`${d.maxWidth}mm`:"100%",maxHeight:d.maxHeight?`${d.maxHeight}mm`:"100%"}});async function l(){const d=i.element.options,s=(i.designMode?d.testData||d.formatter:h.resolveTextBinding(d,i.data))||"二维码",a=Math.min(d.width||80,d.height||80);try{t.value=await xt.toDataURL(s,{width:a,margin:1,errorCorrectionLevel:String(d.qrCodeLevel??"M")})}catch{t.value=""}}return e.onMounted(l),e.watch(()=>[i.element.options.formatter,i.element.options.testData,i.element.options.qrCodeLevel],l),(d,s)=>(e.openBlock(),e.createElementBlock("div",Hn,[t.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,alt:"qrcode",style:e.normalizeStyle(n.value)},null,12,On)):e.createCommentVNode("",!0)]))}}),Gn=re(Wn,[["__scopeId","data-v-3454544f"]]),Kn=["innerHTML"],qn=e.defineComponent({__name:"HtmlElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t=e.computed(()=>{if(i.element.options.formatter){const n=i.data&&i.data.length>0?i.data[0]:{},l=h.evaluateTemplate(i.element.options.formatter,n??{});return l?Ft.sanitize(l):""}return'<div style="background:#e0e0e0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:10pt;color:#999">HTML</div>'});return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"print-html",innerHTML:t.value},null,8,Kn))}}),Yn=re(qn,[["__scopeId","data-v-880bbde5"]]),jn=e.defineComponent({__name:"PageNumberElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const i=o,t=e.computed(()=>{const l=i.element.options;return{fontSize:(l.fontSize||12)+"pt",fontWeight:l.fontWeight||"normal",fontFamily:l.fontFamily||"inherit",color:l.color||"#333",textAlign:l.textAlign||"left",lineHeight:l.lineHeight?l.lineHeight+"pt":"normal",letterSpacing:l.letterSpacing?l.letterSpacing+"pt":"normal"}}),n=e.computed(()=>i.designMode?i.element.options.title||"{pageIndex}/{totalPages}":i.element.options.title||"");return(l,d)=>(e.openBlock(),e.createElementBlock("div",{class:"page-number-element",style:e.normalizeStyle(t.value)},e.toDisplayString(n.value),5))}}),Xn=re(jn,[["__scopeId","data-v-38f1d7df"]]),Zn={key:0,class:"drag-preview"},Jn={key:1,class:"resize-handles"},Qn=["onMousedown"],_n={key:2,class:"selected-indicator"},el={class:"position-label"},tl=e.defineComponent({__name:"BaseElement",props:{element:{},isSelected:{type:Boolean},designMode:{type:Boolean},printData:{},scale:{},allElements:{},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},zone:{},adsorbHandler:{type:Function},clearAdsorbGuides:{type:Function}},emits:["select","update:element","drag-start","drag-stop","dblclick-element","dblclick-cell","contextmenu","clone-element"],setup(o,{emit:i}){const t=o,n=i,l=e.ref(null),d=e.inject($t,null),s=e.computed(()=>d?.value?d.value.has(t.element.id):t.isSelected??!1),a=e.inject(Tt,null),r=e.computed(()=>a?.value.has(t.element.id)??!1),u={text:e.markRaw(nn),image:e.markRaw(dn),longText:e.markRaw(un),table:e.markRaw(Rn),hline:e.markRaw(yt),vline:e.markRaw(yt),rect:e.markRaw(kt),oval:e.markRaw(kt),barcode:e.markRaw(Un),qrcode:e.markRaw(Gn),html:e.markRaw(Yn),pageNumber:e.markRaw(Xn)},m=e.computed(()=>u[t.element.printElementType.type]),g=e.computed(()=>t.element.printElementType.type==="table"?{showTableGhostBorder:t.showTableGhostBorder,scale:t.scale}:{}),k=e.computed(()=>{const T=t.element.options;return{position:"absolute",left:T.left+"mm",top:T.top+"mm",width:T.width+"mm",height:T.height+"mm",zIndex:T.zIndex||"auto"}}),y=e.computed(()=>{const T=t.element.options;return`x:${Math.round(T.left)} y:${Math.round(T.top)} ${Math.round(T.width)}×${Math.round(T.height)}mm`});let R=0,C=0;const v=e.reactive({disabled:!t.designMode||!!t.element.options.locked,getScale:()=>(t.scale||1)*h.mmToPx(1),onDrag:T=>{const X=T.left-R,ee=T.top-C;l.value&&(l.value.style.transform=`translate(${X}mm, ${ee}mm)`)},onDragEnd:(T,X)=>{if(X.altKey){const ie=JSON.parse(JSON.stringify(t.element));ie.id=h.generateId(),ie.options.left=T.left,ie.options.top=T.top,ie.options.groupId=void 0,n("clone-element",ie,{left:T.left,top:T.top}),l.value&&(l.value.style.transform="");return}const ee=T.left-R,le=T.top-C;if(t.element.options.left=T.left,t.element.options.top=T.top,l.value&&(l.value.style.transform=""),t.element.options.groupId&&t.allElements)for(const ie of t.allElements)ie.id!==t.element.id&&ie.options.groupId===t.element.options.groupId&&(ie.options.left+=ee,ie.options.top+=le)},onStart:()=>{R=t.element.options.left,C=t.element.options.top,n("select",t.element.id,!1),n("drag-start")},onStop:()=>{t.clearAdsorbGuides?.(),n("drag-stop")},onAdsorb:T=>{let X=T.left,ee=T.top;return t.snapToGrid&&(X=Math.round(T.left/5)*5,ee=Math.round(T.top/5)*5),t.adsorbHandler?t.adsorbHandler({id:t.element.id,left:X,top:ee,width:t.element.options.width,height:t.element.options.height}):{left:X,top:ee,lines:[]}}}),{setup:f,cleanup:M,isDragging:j}=_o(l,v);e.watchEffect(()=>{v.disabled=!t.designMode||!!t.element.options.locked});const ne=e.computed(()=>s.value&&!!t.designMode&&!t.element.options.locked&&t.element.printElementType.type!=="table"),{startResize:H,cleanup:K}=h.useResize({minWidth:3.5,minHeight:3.5,getScale:()=>(t.scale||1)*h.mmToPx(1),getRect:()=>({left:t.element.options.left,top:t.element.options.top,width:t.element.options.width,height:t.element.options.height}),onResize:T=>{t.element.options.left=T.left,t.element.options.top=T.top,t.element.options.width=T.width,t.element.options.height=T.height},onStart:()=>{n("drag-start")},onStop:()=>{n("drag-stop")}});function b(T){t.designMode&&T.button===0&&n("select",t.element.id,T.ctrlKey||T.metaKey)}function B(){t.designMode&&n("dblclick-element",t.element.id)}function S(T,X,ee){t.designMode&&n("dblclick-cell",T,X,ee)}e.onMounted(()=>{t.designMode&&f()});function x(){M(),K(),t.clearAdsorbGuides?.()}return e.onUnmounted(()=>{x()}),(T,X)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:l,class:e.normalizeClass(["print-element",{selected:s.value,previewed:r.value,"design-mode":o.designMode,locked:o.element.options.locked,hidden:o.element.options.visible===!1,"drag-ghost":e.unref(j),[`type-${o.element.printElementType.type}`]:!0,[`zone-${o.zone||"content"}`]:!0}]),style:e.normalizeStyle(k.value),onMousedown:e.withModifiers(b,["stop"]),onDblclick:e.withModifiers(B,["stop"]),onContextmenu:X[0]||(X[0]=e.withModifiers(ee=>T.$emit("contextmenu",o.element.id,ee),["prevent","stop"]))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.value),e.mergeProps({element:o.element,data:o.printData,"design-mode":o.designMode,"is-selected":s.value},g.value,{onDblclickCell:S}),null,16,["element","data","design-mode","is-selected"])),e.unref(j)?(e.openBlock(),e.createElementBlock("div",Zn)):e.createCommentVNode("",!0),ne.value?(e.openBlock(),e.createElementBlock("div",Jn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(h.RESIZE_POINTS),ee=>(e.openBlock(),e.createElementBlock("div",{key:ee,class:e.normalizeClass(["resize-handle",`handle-${ee}`]),onMousedown:e.withModifiers(le=>e.unref(H)(ee,le),["stop"])},null,42,Qn))),128))])):e.createCommentVNode("",!0),s.value&&o.designMode?(e.openBlock(),e.createElementBlock("div",_n,[e.createElementVNode("div",el,e.toDisplayString(y.value),1)])):e.createCommentVNode("",!0)],38))}}),it=re(tl,[["__scopeId","data-v-45a5eb4c"]]);function ol(o={}){const i=e.ref([]),t=e.ref({width:0,height:0});function n(s,a,r){return h.computeAdsorb(s,a,r,o)}function l(s,a,r){i.value=s,t.value={width:a,height:r}}function d(){i.value=[]}return{check:n,renderLines:l,clearLines:d,guideLines:i,paperSize:t}}function nl(o){const{check:i,renderLines:t,clearLines:n,guideLines:l,paperSize:d}=ol(o.config??{adsorbMin:1,adsorbLineMin:2,showAdsorbLine:!0});function s(r){const u=o.getElements().filter(k=>k.id!==r.id).map(k=>({id:k.id,left:k.options.left,top:k.options.top,width:k.options.width,height:k.options.height})),m=i(r,u,o.getGuides?.()),g=o.getPaperSize();return t(m.lines,g.width,g.height),m}function a(){n()}return{requestAdsorb:s,clearGuides:a,guideLines:l,paperSize:d}}const ll=["src"],al=["width","height","viewBox"],il=["x","y","font-size","fill","transform"],sl={key:0,class:"zone-label"},rl={key:0,class:"zone-height-tip"},dl={key:0,class:"zone-label"},cl={key:0,class:"zone-height-tip"},ul=["onMousedown","onDblclick"],ml=e.defineComponent({__name:"CanvasPaper",props:{templateData:{},runtimeElements:{},designMode:{type:Boolean},printData:{},scale:{},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},guides:{}},emits:["select","drag-start","drag-stop","dblclick-element","dblclick-cell","contextmenu","zone-height-change","zone-height-commit","guide-move","guide-remove","clone-element"],setup(o,{expose:i,emit:t}){const n=o,l=t,d=e.ref(null),s=e.computed(()=>h.getPaperDimensions(n.templateData).width),a=e.computed(()=>h.getPaperDimensions(n.templateData).height),r=e.computed(()=>n.templateData.designBackground),u=e.ref(!1);e.watch(()=>r.value?.src,()=>{u.value=!1});const m=e.computed(()=>{const V=r.value?.rotation;return V===90||V===180||V===270?V:0}),g=e.computed(()=>{const V=m.value,w=V===90||V===270,F=w?a.value:s.value,p=w?s.value:a.value,E={width:F+"mm",height:p+"mm",left:(s.value-F)/2+"mm",top:(a.value-p)/2+"mm"};return V!==0&&(E.transform=`rotate(${V}deg)`),E});function k(){u.value=!0,console.warn("[print-designer] 设计背景图加载失败:",r.value?.src)}const y=e.computed(()=>`${8/(n.scale||1)}px`),R=e.computed(()=>{const V=n.scale||1,w=h.mmToPx(s.value)*V,F=h.mmToPx(a.value)*V;return{width:w+"px",height:F+"px",position:"relative"}}),C=e.computed(()=>{const V=n.templateData.margins,w=n.templateData.header.height,F=n.templateData.footer.height,p=s.value-V.left-V.right;return{header:{left:V.left,top:V.top,width:p,height:w},content:{left:V.left,top:V.top+w,width:p,height:a.value-V.top-V.bottom-w-F},footer:{left:V.left,top:a.value-V.bottom-F,width:p,height:F}}});function v(V){return{position:"absolute",left:V.left+"mm",top:V.top+"mm",width:V.width+"mm",height:V.height+"mm"}}const f=e.computed(()=>{const V={header:[],footer:[],content:[]};for(const w of n.runtimeElements)w.zone==="header"?V.header.push(w):w.zone==="footer"?V.footer.push(w):V.content.push(w);return V}),M=e.computed(()=>f.value.header),j=e.computed(()=>f.value.footer),ne=e.computed(()=>f.value.content);let H="content";const{requestAdsorb:K,clearGuides:b,guideLines:B,paperSize:S}=nl({getElements:()=>f.value[H],getPaperSize:()=>{const V=C.value[H];return{width:V.width,height:V.height}},getGuides:()=>{const V=[],w=[];for(const F of n.guides??[])F.type==="vertical"?V.push(F.position):w.push(F.position);return{vertical:V,horizontal:w}}});function x(V){H=n.runtimeElements.find(p=>p.id===V.id)?.zone||"content";const F=K(V);return(F.left!==V.left||F.top!==V.top)&&c(F.left+V.width/2,F.top+V.height/2),F}function T(V,w){if(V.button!==0)return;const F=w.position,p=V.clientX,E=V.clientY,$=n.scale??1,Y=25.4/96,Q=me=>{const P=(w.type==="vertical"?me.clientX-p:me.clientY-E)/$*Y,I=w.type==="vertical"?s.value:a.value,O=Math.min(Math.max(F+P,0),I);l("guide-move",w.id,O)},oe=()=>{window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",oe)};window.addEventListener("mousemove",Q),window.addEventListener("mouseup",oe)}const X=e.computed(()=>({width:s.value+"mm",minHeight:a.value+"mm",background:n.templateData.pageBackground||"var(--pd-paper, #fff)",boxShadow:"var(--pd-shadow-paper, 0 1px 2px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08))",overflow:"hidden",position:"relative",transform:n.scale?`scale(${n.scale})`:void 0,transformOrigin:"0 0"})),ee=e.computed(()=>{const V=n.templateData.margins;return{padding:`${V.top}mm ${V.right}mm ${V.bottom}mm ${V.left}mm`,position:"relative",boxSizing:"border-box",minHeight:a.value+"mm"}}),le=e.computed(()=>({backgroundImage:`url("data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M0 .5H20M.5 0V20" fill="none" stroke="rgba(0,0,0,0.08)" stroke-width="1" stroke-dasharray="4 4"/></svg>')}")`,backgroundSize:"5mm 5mm",backgroundPosition:"0 0"}));let ie=0,ue=null;const J=e.ref(null);function c(V,w){ie+=1,J.value={left:V,top:w,key:ie},ue&&clearTimeout(ue),ue=setTimeout(()=>{J.value=null},300)}const N=e.computed(()=>ge.resolveWatermarkLayout(n.templateData.watermark,n.printData,{width:s.value,height:a.value})),W=e.ref(null);function he(V,w){w.button===0&&(ve(),W.value={zone:V,startY:w.clientY,startH:n.templateData[V].height},window.addEventListener("mousemove",pe),window.addEventListener("mouseup",ce))}function pe(V){if(!W.value)return;const{zone:w,startY:F,startH:p}=W.value,$=(V.clientY-F)/(n.scale||1)*25.4/96,Y=w==="header"?$:-$,Q=Math.min(100,a.value-n.templateData.margins.top-n.templateData.margins.bottom-(w==="header"?n.templateData.footer.height:n.templateData.header.height)-10),oe=Math.min(Q,Math.max(0,Math.round((p+Y)*10)/10));l("zone-height-change",w,oe)}function ce(){if(!W.value)return;const V=W.value.zone;W.value=null,window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",ce),l("zone-height-commit",V)}function ve(){window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",ce),W.value=null}e.onUnmounted(()=>{ve(),ue&&clearTimeout(ue)});function z(V,w){l("select",V,w)}return i({contentRef:d}),(V,w)=>(e.openBlock(),e.createElementBlock("div",{class:"paper-wrapper",style:e.normalizeStyle(R.value)},[e.createElementVNode("div",{class:"hiprint-printPaper",style:e.normalizeStyle(X.value)},[o.designMode&&r.value?.src&&!u.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"design-background",style:e.normalizeStyle(g.value)},[e.createElementVNode("img",{src:r.value.src,draggable:"false",alt:"",onError:k},null,40,ll)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"hiprint-printPaper-content",ref_key:"contentRef",ref:d,style:e.normalizeStyle(ee.value)},[o.showGrid&&o.designMode?(e.openBlock(),e.createElementBlock("div",{key:0,class:"grid-bg",style:e.normalizeStyle(le.value)},null,4)):e.createCommentVNode("",!0),J.value?(e.openBlock(),e.createElementBlock("div",{key:J.value.key,class:"snap-indicator",style:e.normalizeStyle({left:J.value.left+"mm",top:J.value.top+"mm"})},null,4)):e.createCommentVNode("",!0),N.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:"watermark-layer",style:e.normalizeStyle({opacity:String(N.value.opacity)})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value.tiles,(F,p)=>(e.openBlock(),e.createElementBlock("svg",{key:p,class:"watermark-tile",width:F.widthMm+"mm",height:F.heightMm+"mm",viewBox:`0 0 ${N.value.tileWidthPx} ${N.value.tileHeightPx}`,style:e.normalizeStyle({left:F.leftMm+"mm",top:F.topMm+"mm"}),xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("text",{x:N.value.tileWidthPx/2,y:N.value.tileHeightPx/2,"font-size":N.value.fontSizePx,fill:N.value.color,"text-anchor":"middle","dominant-baseline":"middle",transform:`rotate(${N.value.rotate},${N.value.tileWidthPx/2},${N.value.tileHeightPx/2})`},e.toDisplayString(N.value.text),9,il)],12,al))),128))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-header",{"design-mode":o.designMode}]),style:e.normalizeStyle(v(C.value.header))},[o.designMode?(e.openBlock(),e.createElementBlock("span",sl,"页眉")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,F=>(e.openBlock(),e.createBlock(it,{key:F.id,element:F,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":M.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"header","adsorb-handler":x,"clear-adsorb-guides":e.unref(b),onSelect:z,onDragStart:w[0]||(w[0]=p=>V.$emit("drag-start")),onDragStop:w[1]||(w[1]=p=>V.$emit("drag-stop")),onDblclickElement:w[2]||(w[2]=p=>V.$emit("dblclick-element",p)),onDblclickCell:w[3]||(w[3]=(p,E,$)=>V.$emit("dblclick-cell",p,E,$)),onContextmenu:w[4]||(w[4]=(p,E)=>V.$emit("contextmenu",p,E)),onCloneElement:(p,E)=>V.$emit("clone-element",p,E)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),o.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-bottom",onMousedown:w[5]||(w[5]=e.withModifiers(F=>he("header",F),["prevent","stop"]))},[W.value?.zone==="header"?(e.openBlock(),e.createElementBlock("div",rl,e.toDisplayString(o.templateData.header.height.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)],6),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-content",{"design-mode":o.designMode}]),style:e.normalizeStyle(v(C.value.content))},[o.designMode&&o.templateData.firstPageOverlay.height>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:"zone-overlay",style:e.normalizeStyle({height:o.templateData.firstPageOverlay.height+"mm"})},[...w[17]||(w[17]=[e.createElementVNode("span",{class:"zone-label"},"首页叠加",-1)])],4)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ne.value,F=>(e.openBlock(),e.createBlock(it,{key:F.id,element:F,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":ne.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"content","adsorb-handler":x,"clear-adsorb-guides":e.unref(b),onSelect:z,onDragStart:w[6]||(w[6]=p=>V.$emit("drag-start")),onDragStop:w[7]||(w[7]=p=>V.$emit("drag-stop")),onDblclickElement:w[8]||(w[8]=p=>V.$emit("dblclick-element",p)),onDblclickCell:w[9]||(w[9]=(p,E,$)=>V.$emit("dblclick-cell",p,E,$)),onContextmenu:w[10]||(w[10]=(p,E)=>V.$emit("contextmenu",p,E)),onCloneElement:(p,E)=>V.$emit("clone-element",p,E)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128))],6),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-footer",{"design-mode":o.designMode}]),style:e.normalizeStyle(v(C.value.footer))},[o.designMode?(e.openBlock(),e.createElementBlock("span",dl,"页脚")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(j.value,F=>(e.openBlock(),e.createBlock(it,{key:F.id,element:F,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":j.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"footer","adsorb-handler":x,"clear-adsorb-guides":e.unref(b),onSelect:z,onDragStart:w[11]||(w[11]=p=>V.$emit("drag-start")),onDragStop:w[12]||(w[12]=p=>V.$emit("drag-stop")),onDblclickElement:w[13]||(w[13]=p=>V.$emit("dblclick-element",p)),onDblclickCell:w[14]||(w[14]=(p,E,$)=>V.$emit("dblclick-cell",p,E,$)),onContextmenu:w[15]||(w[15]=(p,E)=>V.$emit("contextmenu",p,E)),onCloneElement:(p,E)=>V.$emit("clone-element",p,E)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),o.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-top",onMousedown:w[16]||(w[16]=e.withModifiers(F=>he("footer",F),["prevent","stop"]))},[W.value?.zone==="footer"?(e.openBlock(),e.createElementBlock("div",cl,e.toDisplayString(o.templateData.footer.height.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)],6),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(B),(F,p)=>(e.openBlock(),e.createElementBlock("div",{key:p,class:e.normalizeClass(["adsorb-guide",[`guide-${F.type}`]]),style:e.normalizeStyle(F.type==="vertical"?{left:F.position+"mm",top:"0",height:e.unref(S).height+"mm",borderLeftColor:F.color||"var(--pd-accent-secondary, #f56c6c)"}:{top:F.position+"mm",left:"0",width:e.unref(S).width+"mm",borderTopColor:F.color||"var(--pd-accent-secondary, #f56c6c)"})},null,6))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.guides,F=>(e.openBlock(),e.createElementBlock("div",{key:"mg-"+F.id,class:e.normalizeClass(["manual-guide",[`guide-${F.type}`]]),style:e.normalizeStyle(F.type==="vertical"?{left:F.position+"mm",top:"0",height:a.value+"mm","--guide-hit":y.value}:{top:F.position+"mm",left:"0",width:s.value+"mm","--guide-hit":y.value}),onMousedown:e.withModifiers(p=>T(p,F),["prevent","stop"]),onDblclick:e.withModifiers(p=>F.id&&l("guide-remove",F.id),["prevent","stop"])},null,46,ul))),128))],4)],4)],4))}}),pl=re(ml,[["__scopeId","data-v-38b3a452"]]),vl=e.defineComponent({__name:"Ruler",props:{orientation:{},viewportPx:{},originPx:{},paperLengthMM:{},scale:{},cursorPx:{}},emits:["add-guide","guide-dragging"],setup(o,{emit:i}){const t=o,n=i,l=e.computed(()=>t.orientation==="horizontal"),d=e.computed(()=>l.value?"vertical":"horizontal"),s=e.ref(null),a=e.ref(null),r=e.computed(()=>a.value??t.cursorPx??null),u=e.computed(()=>l.value?{width:t.viewportPx+"px",height:h.RULER_THICKNESS+"px"}:{width:h.RULER_THICKNESS+"px",height:t.viewportPx+"px"});let m=0;function g(){m||(m=requestAnimationFrame(()=>{m=0,k()}))}function k(){const b=s.value;if(!b)return;const B=b.getContext("2d");if(!B)return;const S=window.devicePixelRatio||1,x=Math.max(0,Math.round(t.viewportPx)),T=h.RULER_THICKNESS;b.width=(l.value?x:T)*S,b.height=(l.value?T:x)*S,B.setTransform(S,0,0,S,0,0);const X=getComputedStyle(b),ee=X.getPropertyValue("--pd-ruler-bg").trim()||"#F8F9FC",le=X.getPropertyValue("--pd-ruler").trim()||"#9AA1AF",ie=X.getPropertyValue("--pd-accent").trim()||"#165DFF";B.fillStyle=ee,B.fillRect(0,0,l.value?x:T,l.value?T:x);const ue=t.scale>0?t.scale:1,J=h.mmToPx(1)*ue;if(J<=0)return;const c=-t.originPx/J,N=(x-t.originPx)/J,W=h.chooseMajorStepMM(ue),he=h.buildRulerTicks(c,N,W);y(B,he,J,le,!0),y(B,he,J,le,!1),R(B,0,ie),R(B,t.paperLengthMM,ie);const pe=r.value;if(pe!==null&&pe>=0&&pe<=x){if(B.strokeStyle=ie,B.lineWidth=1.5,B.beginPath(),l.value){const ce=Math.round(pe)+.5;B.moveTo(ce,0),B.lineTo(ce,T)}else{const ce=Math.round(pe)+.5;B.moveTo(0,ce),B.lineTo(T,ce)}B.stroke()}}function y(b,B,S,x,T){b.strokeStyle=x,b.fillStyle=x,b.globalAlpha=T?.32:1,b.lineWidth=1,b.font="9px ui-monospace, Menlo, monospace",b.textBaseline="top";for(const X of B){if((X.mm<0||X.mm>t.paperLengthMM)!==T)continue;const le=Math.round(t.originPx+X.mm*S)+.5,ie=X.major?8:4;b.beginPath(),l.value?(b.moveTo(le,0),b.lineTo(le,ie)):(b.moveTo(0,le),b.lineTo(ie,le)),b.stroke(),X.major&&X.label&&(l.value?b.fillText(X.label,le+2,11):(b.save(),b.translate(11,le+2),b.rotate(-Math.PI/2),b.fillText(X.label,0,0),b.restore()))}b.globalAlpha=1}function R(b,B,S){const x=h.mmToPx(1)*(t.scale>0?t.scale:1),T=Math.round(t.originPx+B*x)+.5;T<=0||T>=t.viewportPx||(b.strokeStyle=S,b.globalAlpha=.55,b.lineWidth=1,b.beginPath(),l.value?(b.moveTo(T,0),b.lineTo(T,h.RULER_THICKNESS)):(b.moveTo(0,T),b.lineTo(h.RULER_THICKNESS,T)),b.stroke(),b.globalAlpha=1)}e.watch(()=>[t.viewportPx,t.originPx,t.paperLengthMM,t.scale,t.cursorPx,t.orientation],g),e.onMounted(g),e.onBeforeUnmount(()=>{m&&cancelAnimationFrame(m)});let C=!1;function v(b){const B=s.value;if(!B)return null;const S=B.getBoundingClientRect(),x=l.value?b.clientX-S.left:b.clientY-S.top;if(x<0||x>t.viewportPx)return null;const T=h.mmToPx(1)*(t.scale>0?t.scale:1);return(x-t.originPx)/T}function f(b){b.button===0&&(C=!0,b.preventDefault(),window.addEventListener("mousemove",H),window.addEventListener("mouseup",K),ne(b))}function M(b){const B=s.value;if(!B)return;const S=B.getBoundingClientRect();a.value=l.value?b.clientX-S.left:b.clientY-S.top,g()}function j(){a.value=null,g()}function ne(b){const B=v(b);n("guide-dragging",B)}function H(b){C&&ne(b)}function K(b){if(!C)return;C=!1,window.removeEventListener("mousemove",H),window.removeEventListener("mouseup",K);const B=v(b);B!==null&&B>=0&&B<=t.paperLengthMM&&n("add-guide",d.value,B),n("guide-dragging",null)}return e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",H),window.removeEventListener("mouseup",K)}),(b,B)=>(e.openBlock(),e.createElementBlock("canvas",{ref_key:"canvasRef",ref:s,class:e.normalizeClass(["pd-ruler",`is-${o.orientation}`]),style:e.normalizeStyle(u.value),onMousedown:f,onMousemove:M,onMouseleave:j},null,38))}}),Vt=re(vl,[["__scopeId","data-v-1e7d0633"]]),fl={class:"canvas-scroll"},gl={key:0,class:"overlay-layer"},hl=["src"],Xe=96/25.4,bl=e.defineComponent({__name:"CanvasArea",props:{templateData:{},elements:{},scale:{},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},hasClipboard:{type:Boolean},guides:{},overlayVisible:{type:Boolean},screenshotUrl:{},overlayOpacity:{},selectedElementHasGroup:{type:Boolean},showRuler:{type:Boolean,default:!0}},emits:["select","drop-element","drop-field","drag-start","drag-stop","dblclick-element","dblclick-cell","zone-height-change","zone-height-commit","select-all","clear-selection","preview","commit-preview","paste","copy","cut","delete","move-layer","group","ungroup","coordinate","add-guide","guide-move","guide-remove","zoom","clone-element"],setup(o,{expose:i,emit:t}){const n=o,l=t;function d(p,E){l("select",p,E)}const s=e.ref(null),a=e.computed(()=>h.getPaperDimensions(n.templateData).width),r=e.computed(()=>h.getPaperDimensions(n.templateData).height),u=e.reactive({originX:0,originY:0,viewW:0,viewH:0,paperScale:1}),m=e.reactive({x:null,y:null}),g=e.reactive({x:0,y:0}),k=e.computed(()=>({transform:`translate(${g.x}px, ${g.y}px)`}));function y(){const p=s.value,E=p?.querySelector(".hiprint-printPaper");if(!p||!E)return;const $=p.getBoundingClientRect(),Y=E.getBoundingClientRect(),Q=n.scale||1,oe=Y.width/h.mmToPx(a.value);u.paperScale=Math.abs(oe-Q)<.002?Q:oe,u.originX=Y.left-$.left-h.RULER_THICKNESS,u.originY=Y.top-$.top-h.RULER_THICKNESS,u.viewW=p.clientWidth-h.RULER_THICKNESS,u.viewH=p.clientHeight-h.RULER_THICKNESS}function R(){g.x=s.value?.scrollLeft??0,g.y=s.value?.scrollTop??0,y()}let C=null,v=0;function f(){cancelAnimationFrame(v);const p=performance.now()+220,E=()=>{y(),performance.now()<p&&(v=requestAnimationFrame(E))};v=requestAnimationFrame(E)}const M=e.ref(null);function j(p,E){M.value=E===null?null:{type:p,mm:E}}const ne=e.computed(()=>{const p=M.value,E=s.value?.querySelector(".hiprint-printPaper");if(!p||!E)return{};const $=E.getBoundingClientRect(),Y=$.width/h.mmToPx(a.value),Q=h.mmToPx(p.mm)*(Y>0?Y:n.scale||1);return p.type==="vertical"?{left:$.left+Q+"px",top:$.top+"px",height:$.height+"px"}:{left:$.left+"px",top:$.top+Q+"px",width:$.width+"px"}});function H(p){const E=s.value?.querySelector(".hiprint-printPaper");if(!E)return;const $=E.getBoundingClientRect(),Y=n.scale||1,Q=h.pxToMm((p.clientX-$.left)/Y),oe=h.pxToMm((p.clientY-$.top)/Y);if(!(Q<0||oe<0))return{x:Q,y:oe}}function K(p){const E=H(p),$=p.dataTransfer?.getData("fieldData");if($)try{const Q=JSON.parse($);l("drop-field",Q,E);return}catch{}const Y=p.dataTransfer?.getData("elementType");Y&&l("drop-element",Y,E)}const b=e.reactive({visible:!1,x:0,y:0,w:0,h:0});let B={x:0,y:0};function S(p){return!p||!(p instanceof HTMLElement)?!1:!!(p===s.value||p.classList.contains("canvas-scroll")||p.classList.contains("hiprint-printPaper")||p.classList.contains("hiprint-printPaper-content")||p.classList.contains("zone-layer")||p.classList.contains("grid-bg")||p.classList.contains("watermark-layer"))}function x(p){const E=s.value,$=E?.querySelector(".hiprint-printPaper");if(!E||!$)return;const Y=E.getBoundingClientRect();m.x=p.clientX-Y.left-h.RULER_THICKNESS,m.y=p.clientY-Y.top-h.RULER_THICKNESS;const Q=$.getBoundingClientRect(),oe=n.scale||1,me=h.pxToMm((p.clientX-Q.left)/oe),P=h.pxToMm((p.clientY-Q.top)/oe);if(me<0||P<0){l("coordinate",null);return}l("coordinate",{x:me,y:P})}function T(){l("coordinate",null),m.x=null,m.y=null}function X(p,E,$,Y){const Q=s.value;if(!Q)return;const oe=Math.max(Y,Math.round(p)),me=Math.round((n.scale||1)*100);if(oe===me)return;const P=n.scale||1,I=oe/100/P,O=getComputedStyle(Q),_=parseFloat(O.paddingLeft)||0,q=parseFloat(O.paddingTop)||0,fe=Q.scrollLeft+E-_,A=Q.scrollTop+$-q;l("zoom",oe-me),e.nextTick(()=>{const D=getComputedStyle(Q),Z=parseFloat(D.paddingLeft)||0,be=parseFloat(D.paddingTop)||0;Q.scrollLeft=fe*I-E+Z,Q.scrollTop=A*I-$+be})}function ee(p){if(!(p.ctrlKey||p.metaKey))return;p.preventDefault();const E=s.value;if(!E)return;const $=Math.round((n.scale||1)*100),Y=h.nextWheelScale($,p.deltaY>0?-1:1);if(Y===$)return;const Q=E.getBoundingClientRect();X(Y,p.clientX-Q.left,p.clientY-Q.top,h.MIN_SCALE_PERCENT)}function le(p){const E=s.value;if(!E)return;const $=Math.round((n.scale||1)*100),Y=h.nextWheelScale($,p);X(Y,E.clientWidth/2,E.clientHeight/2,h.MIN_SCALE_PERCENT)}function ie(p){const E=s.value;if(!E)return;const $=E.querySelector(".hiprint-printPaper"),Y=$?.style.transition??"";$&&($.style.transition="none"),X(p,E.clientWidth/2,E.clientHeight/2,h.FIT_SCALE_MIN_PERCENT),e.nextTick(()=>{$&&($.style.transition=Y)})}function ue(p){p.button!==2&&S(p.target)&&(l("clear-selection"),B={x:p.clientX,y:p.clientY},b.visible=!0,b.x=p.clientX,b.y=p.clientY,b.w=0,b.h=0,window.addEventListener("mousemove",c),window.addEventListener("mouseup",N))}function J(){if(b.w<3||b.h<3)return[];const p=s.value?.querySelector(".hiprint-printPaper");if(!p)return[];const E=p.getBoundingClientRect(),$=n.scale||1,Y=b.x<B.x,Q=[];for(const oe of n.elements){if(oe.options.visible===!1||oe.options.locked)continue;const me=E.left+oe.options.left*Xe*$,P=E.top+oe.options.top*Xe*$,I=me+oe.options.width*Xe*$,O=P+oe.options.height*Xe*$,_=me<b.x+b.w&&I>b.x&&P<b.y+b.h&&O>b.y,q=me>=b.x&&I<=b.x+b.w&&P>=b.y&&O<=b.y+b.h;(Y?q:_)&&Q.push(oe.id)}return Q}function c(p){const E=p.clientX-B.x,$=p.clientY-B.y;b.x=E>=0?B.x:p.clientX,b.y=$>=0?B.y:p.clientY,b.w=Math.abs(E),b.h=Math.abs($),l("preview",J())}function N(){window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",N);const p=J();l("preview",p),p.length>0?l("commit-preview"):l("clear-selection"),l("preview",[]),b.visible=!1}const W=e.reactive({visible:!1,x:0,y:0,flipX:0,flipY:0,targetId:null}),he=e.ref(null);function pe(p,E){!E&&!S(p.target)||(W.targetId=E??null,W.visible=!0,W.x=p.clientX,W.y=p.clientY,W.flipX=0,W.flipY=0,e.nextTick(()=>{const $=he.value;if(!$)return;const Y=$.getBoundingClientRect(),Q=4;p.clientX+Y.width+Q>window.innerWidth&&(W.flipX=-Y.width),p.clientY+Y.height+Q>window.innerHeight&&(W.flipY=-Y.height)}),window.removeEventListener("mousedown",ce),setTimeout(()=>{window.addEventListener("mousedown",ce,{once:!0})},0))}function ce(){W.visible=!1,window.removeEventListener("mousedown",ce)}function ve(){W.visible=!1,n.hasClipboard&&l("paste")}function z(){W.visible=!1,l("select-all")}function V(){W.visible=!1,l("clear-selection")}function w(p,E){W.visible=!1,p==="copy"?l("copy"):p==="cut"?l("cut"):p==="paste"?l("paste"):p==="delete"?l("delete"):p==="move-layer"?l("move-layer",E):p==="group"?l("group"):p==="ungroup"&&n.selectedElementHasGroup&&l("ungroup")}e.onMounted(()=>{e.nextTick(y),s.value&&typeof ResizeObserver<"u"&&(C=new ResizeObserver(y),C.observe(s.value))}),e.watch(()=>n.scale,f),e.watch([a,r],()=>e.nextTick(y));function F(){const p=s.value;if(!p)return;let E=0,$=0,Y=0;const Q=performance.now()+800,oe=()=>{const{scrollWidth:me,scrollHeight:P}=p;if(me===$&&P===Y?E++:E=0,$=me,Y=P,E>=2||performance.now()>Q){const I=p.scrollWidth,O=p.scrollHeight,_=p.clientWidth,q=p.clientHeight;p.scrollLeft=Math.max(0,(I-_)/2),p.scrollTop=Math.max(0,(O-q)/2);return}requestAnimationFrame(oe)};requestAnimationFrame(oe)}return i({centerScroll:F,fitToWindow:ie,zoomByStep:le}),e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",N),C?.disconnect(),cancelAnimationFrame(v)}),(p,E)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:s,class:"canvas-area",onDragover:E[24]||(E[24]=e.withModifiers(()=>{},["prevent"])),onDrop:K,onMousedown:ue,onMousemove:x,onMouseleave:T,onWheel:ee,onScroll:R,onContextmenu:e.withModifiers(pe,["prevent"])},[e.createElementVNode("div",fl,[e.createVNode(pl,{"template-data":o.templateData,"runtime-elements":o.elements,"design-mode":!0,"print-data":[],scale:o.scale,"show-grid":o.showGrid,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,guides:o.guides,onSelect:d,onGuideMove:E[0]||(E[0]=($,Y)=>p.$emit("guide-move",$,Y)),onGuideRemove:E[1]||(E[1]=$=>p.$emit("guide-remove",$)),onDragStart:E[2]||(E[2]=$=>p.$emit("drag-start")),onDragStop:E[3]||(E[3]=$=>p.$emit("drag-stop")),onDblclickElement:E[4]||(E[4]=$=>p.$emit("dblclick-element",$)),onDblclickCell:E[5]||(E[5]=($,Y,Q)=>p.$emit("dblclick-cell",$,Y,Q)),onContextmenu:E[6]||(E[6]=($,Y)=>pe(Y,$)),onZoneHeightChange:E[7]||(E[7]=($,Y)=>p.$emit("zone-height-change",$,Y)),onZoneHeightCommit:E[8]||(E[8]=$=>p.$emit("zone-height-commit",$)),onCloneElement:E[9]||(E[9]=($,Y)=>p.$emit("clone-element",$,Y))},null,8,["template-data","runtime-elements","scale","show-grid","snap-to-grid","show-table-ghost-border","guides"]),o.overlayVisible&&o.screenshotUrl?(e.openBlock(),e.createElementBlock("div",gl,[e.createElementVNode("img",{src:o.screenshotUrl,class:"overlay-image",style:e.normalizeStyle({opacity:o.overlayOpacity??.5})},null,12,hl)])):e.createCommentVNode("",!0)]),o.showRuler?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ruler-overlay",style:e.normalizeStyle(k.value)},[E[25]||(E[25]=e.createElementVNode("div",{class:"ruler-corner"},null,-1)),e.createVNode(Vt,{orientation:"horizontal","viewport-px":u.viewW,"origin-px":u.originX,"paper-length-m-m":a.value,scale:u.paperScale,"cursor-px":m.x,onAddGuide:E[10]||(E[10]=($,Y)=>l("add-guide",$,Y)),onGuideDragging:E[11]||(E[11]=$=>j("vertical",$))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"]),e.createVNode(Vt,{orientation:"vertical","viewport-px":u.viewH,"origin-px":u.originY,"paper-length-m-m":r.value,scale:u.paperScale,"cursor-px":m.y,onAddGuide:E[12]||(E[12]=($,Y)=>l("add-guide",$,Y)),onGuideDragging:E[13]||(E[13]=$=>j("horizontal",$))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"])],4)):e.createCommentVNode("",!0),M.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ruler-guide-preview",`guide-${M.value.type}`]),style:e.normalizeStyle(ne.value)},null,6)):e.createCommentVNode("",!0),b.visible?(e.openBlock(),e.createElementBlock("div",{key:2,class:"marquee-selection",style:e.normalizeStyle({left:b.x+"px",top:b.y+"px",width:b.w+"px",height:b.h+"px"})},null,4)):e.createCommentVNode("",!0),W.visible?(e.openBlock(),e.createElementBlock("div",{key:3,ref_key:"contextMenuRef",ref:he,class:"context-menu",style:e.normalizeStyle({left:W.x+W.flipX+"px",top:W.y+W.flipY+"px"})},[W.targetId?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"context-menu-item",onClick:E[14]||(E[14]=$=>w("copy"))},"复制"),e.createElementVNode("div",{class:"context-menu-item",onClick:E[15]||(E[15]=$=>w("cut"))},"剪切"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!o.hasClipboard}]),onClick:E[16]||(E[16]=$=>w("paste"))},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:E[17]||(E[17]=$=>w("delete"))},"删除"),E[26]||(E[26]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:E[18]||(E[18]=$=>w("move-layer","top"))},"置顶"),e.createElementVNode("div",{class:"context-menu-item",onClick:E[19]||(E[19]=$=>w("move-layer","up"))},"上移"),e.createElementVNode("div",{class:"context-menu-item",onClick:E[20]||(E[20]=$=>w("move-layer","down"))},"下移"),e.createElementVNode("div",{class:"context-menu-item",onClick:E[21]||(E[21]=$=>w("move-layer","bottom"))},"置底"),E[27]||(E[27]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:E[22]||(E[22]=$=>w("group"))},"编组 Ctrl+G"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!o.selectedElementHasGroup}]),onClick:E[23]||(E[23]=$=>w("ungroup"))},"取消编组 Ctrl+Shift+G",2)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!o.hasClipboard}]),onClick:ve},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:z},"全选"),e.createElementVNode("div",{class:"context-menu-item",onClick:V},"取消选择")],64))],4)):e.createCommentVNode("",!0)],544))}}),El=re(bl,[["__scopeId","data-v-b3acf7d7"]]),yl={class:"property-search"},kl=e.defineComponent({__name:"PropertySearch",emits:["search"],setup(o,{emit:i}){const t=e.ref(""),n=i;function l(){n("search",t.value)}return(d,s)=>(e.openBlock(),e.createElementBlock("div",yl,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=a=>t.value=a),class:"pd-input",type:"search",placeholder:"搜索属性...","aria-label":"搜索属性",onInput:l},null,544),[[e.vModelText,t.value]])]))}}),Vl=re(kl,[["__scopeId","data-v-10ab6c84"]]),Nl={class:"group-icon"},wl={class:"group-title"},Cl={class:"expand-icon"},Sl={class:"group-content"},Bl=e.defineComponent({__name:"PropertyGroup",props:{title:{},icon:{},defaultExpanded:{type:Boolean},groupKey:{}},setup(o){const i=o,t=e.ref(i.defaultExpanded??!0),l={Document:"≡",Brush:"◧",Setting:"⚙"}[i.icon]||"•";function d(){t.value=!t.value,s()}function s(){const r=`property-group-${i.groupKey}`;try{localStorage.setItem(r,String(t.value))}catch{}}function a(){const r=`property-group-${i.groupKey}`;try{const u=localStorage.getItem(r);u!==null&&(t.value=u==="true")}catch{}}return e.onMounted(()=>{a()}),(r,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-group",{"is-expanded":t.value}])},[e.createElementVNode("div",{class:"group-header",onClick:d},[e.createElementVNode("span",Nl,e.toDisplayString(e.unref(l)),1),e.createElementVNode("span",wl,e.toDisplayString(o.title),1),e.createElementVNode("span",Cl,e.toDisplayString(t.value?"▾":"▸"),1)]),e.withDirectives(e.createElementVNode("div",Sl,[e.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[e.vShow,t.value]])],2))}}),Ce=re(Bl,[["__scopeId","data-v-2ba57031"]]),xl={class:"pd-stepper"},$l=["disabled"],Tl=["value","placeholder","min","max","step"],Dl=["disabled"],Ml=e.defineComponent({__name:"StepperInput",props:{modelValue:{},min:{},max:{},step:{default:1},placeholder:{}},emits:["update:modelValue"],setup(o,{emit:i}){const t=o,n=i,l=e.computed(()=>{const C=String(t.step),v=C.indexOf(".");return v===-1?0:C.length-v-1});function d(C){return Number.isFinite(C)?Number(C.toFixed(l.value)):0}const s=e.computed(()=>{const C=t.modelValue;if(!(C==null||!Number.isFinite(C)))return d(C)}),a=e.ref(s.value===void 0?"":String(s.value));e.watch(s,C=>{a.value=C===void 0?"":String(C)});const r=e.computed(()=>s.value!==void 0?s.value:t.min!==void 0?t.min:0),u=e.computed(()=>t.min!==void 0&&r.value<=t.min),m=e.computed(()=>t.max!==void 0&&r.value>=t.max);function g(C){let v=d(C);return t.min!==void 0&&v<t.min&&(v=t.min),t.max!==void 0&&v>t.max&&(v=t.max),v}function k(C){if(C<0&&u.value||C>0&&m.value)return;const v=g(r.value+C*t.step);a.value=String(v),n("update:modelValue",v)}function y(C){a.value=C.target.value}function R(){const C=a.value.trim();if(C===""){s.value!==void 0&&(a.value=String(s.value));return}const v=Number(C);if(!Number.isFinite(v)){a.value=s.value===void 0?"":String(s.value);return}const f=g(v);a.value=String(f),f!==s.value&&n("update:modelValue",f)}return(C,v)=>(e.openBlock(),e.createElementBlock("div",xl,[e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:u.value,title:"减小","aria-label":"减小",onClick:v[0]||(v[0]=f=>k(-1))},"−",8,$l),e.createElementVNode("input",{type:"number",class:"pd-input pd-step-input",value:a.value,placeholder:o.placeholder,min:o.min,max:o.max,step:o.step,onInput:y,onChange:R,onBlur:R,onKeydown:v[1]||(v[1]=e.withKeys(e.withModifiers(f=>f.target.blur(),["prevent"]),["enter"]))},null,40,Tl),e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:m.value,title:"增大","aria-label":"增大",onClick:v[2]||(v[2]=f=>k(1))},"+",8,Dl)]))}}),se=re(Ml,[["__scopeId","data-v-9722a7cf"]]),Pl={class:"position-grid"},zl={class:"pd-field"},Ll={class:"pd-field"},Rl={class:"pd-field"},Al={class:"pd-field"},Il=e.defineComponent({__name:"PositionSizeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const i=o;function t(n){return i.searching?i.matchedKeys?.has(n)??!0:!0}return(n,l)=>(e.openBlock(),e.createBlock(Ce,{title:"位置与尺寸",icon:"Location","default-expanded":"","group-key":"position-size"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:l[4]||(l[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Pl,[e.withDirectives(e.createElementVNode("div",zl,[l[5]||(l[5]=e.createElementVNode("span",{class:"pd-label"},"X",-1)),e.createVNode(se,{modelValue:o.element.options.left,"onUpdate:modelValue":l[0]||(l[0]=d=>o.element.options.left=d),min:0},null,8,["modelValue"])],512),[[e.vShow,t("ps-left")]]),e.withDirectives(e.createElementVNode("div",Ll,[l[6]||(l[6]=e.createElementVNode("span",{class:"pd-label"},"Y",-1)),e.createVNode(se,{modelValue:o.element.options.top,"onUpdate:modelValue":l[1]||(l[1]=d=>o.element.options.top=d),min:0},null,8,["modelValue"])],512),[[e.vShow,t("ps-top")]]),e.withDirectives(e.createElementVNode("div",Rl,[l[7]||(l[7]=e.createElementVNode("span",{class:"pd-label"},"W",-1)),e.createVNode(se,{modelValue:o.element.options.width,"onUpdate:modelValue":l[2]||(l[2]=d=>o.element.options.width=d),min:4},null,8,["modelValue"])],512),[[e.vShow,t("ps-width")]]),e.withDirectives(e.createElementVNode("div",Al,[l[8]||(l[8]=e.createElementVNode("span",{class:"pd-label"},"H",-1)),e.createVNode(se,{modelValue:o.element.options.height,"onUpdate:modelValue":l[3]||(l[3]=d=>o.element.options.height=d),min:4},null,8,["modelValue"])],512),[[e.vShow,t("ps-height")]])])],32)]),_:1}))}}),Fl=re(Il,[["__scopeId","data-v-bc364679"]]),Ul=["aria-expanded","title"],Hl={class:"picker-preview"},Ol={class:"picker-heading"},Wl=["disabled"],Gl={class:"preset-color-grid"},Kl=["title","aria-label","onClick"],ql=e.defineComponent({__name:"PresetColorPicker",props:{modelValue:{},clearable:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(o,{emit:i}){const t=o,n=i,l=e.ref(!1),d=e.ref(),s=e.ref(),a=e.ref(),r=e.ref({}),u=e.ref(0),m=e.ref(0),g=e.ref(0),k=e.ref("#000000"),y=e.ref(!1),R=e.computed(()=>t.modelValue||"#000000"),C=e.computed(()=>t.modelValue?{background:t.modelValue}:{background:"transparent"}),v=e.computed(()=>W(pe(u.value,m.value,g.value))),f=e.computed({get:()=>Math.round(u.value),set:z=>K(ce(z),m.value,g.value)});e.watch(()=>t.modelValue,z=>{if(!z){k.value="";return}H(z)},{immediate:!0});function M(z){k.value=z.toUpperCase(),H(z),n("update:modelValue",z)}function j(){t.clearable&&n("update:modelValue","")}function ne(z){const w=z.target.value.trim();if(!w){t.clearable&&n("update:modelValue","");return}c(w)&&(H(w),n("update:modelValue",N(w)))}function H(z){const V=c(z);if(!V)return;const w=he(V.r,V.g,V.b);u.value=w.h,m.value=w.s,g.value=w.v,k.value=N(z).toUpperCase()}function K(z,V,w){u.value=ce(z),m.value=ve(V),g.value=ve(w),k.value=v.value.toUpperCase(),n("update:modelValue",v.value)}function b(z){z.currentTarget.setPointerCapture(z.pointerId),y.value=!0,x(z)}function B(z){y.value&&x(z)}function S(z){y.value=!1;const V=z.currentTarget;V.hasPointerCapture(z.pointerId)&&V.releasePointerCapture(z.pointerId)}function x(z){const V=a.value;if(!V)return;const w=V.getBoundingClientRect(),F=ve((z.clientX-w.left)/w.width),p=ve(1-(z.clientY-w.top)/w.height);K(u.value,F,p)}function T(z){const V=z.shiftKey?.1:.02;let w=!0;z.key==="ArrowLeft"?K(u.value,m.value-V,g.value):z.key==="ArrowRight"?K(u.value,m.value+V,g.value):z.key==="ArrowUp"?K(u.value,m.value,g.value+V):z.key==="ArrowDown"?K(u.value,m.value,g.value-V):w=!1,w&&z.preventDefault()}function X(){l.value?le():ee()}async function ee(){const z=d.value;if(!z)return;t.modelValue&&H(R.value),l.value=!0,await e.nextTick();const V=z.getBoundingClientRect(),w=190,F=s.value?.offsetHeight??216,p=8,E=Math.min(V.left,window.innerWidth-w-p),$=V.bottom+6,Y=$+F>window.innerHeight-p?Math.max(p,V.top-F-6):$;r.value={left:`${Math.max(p,E)}px`,top:`${Y}px`}}function le(){l.value=!1}function ie(z){const V=z.target;d.value?.contains(V)||s.value?.contains(V)||le()}function ue(){l.value&&le()}function J(z){z.key==="Escape"&&l.value&&le()}function c(z){const V=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(z.trim());if(!V)return null;const w=V[1],F=w.length===3?w.split("").map(p=>p+p).join(""):w;return{r:Number.parseInt(F.slice(0,2),16),g:Number.parseInt(F.slice(2,4),16),b:Number.parseInt(F.slice(4,6),16)}}function N(z){const V=c(z);return V?W(V):"#000000"}function W({r:z,g:V,b:w}){return`#${[z,V,w].map(F=>Math.round(ve(F/255)*255).toString(16).padStart(2,"0")).join("")}`}function he(z,V,w){const F=z/255,p=V/255,E=w/255,$=Math.max(F,p,E),Y=Math.min(F,p,E),Q=$-Y;let oe=0;return Q!==0&&($===F?oe=(p-E)/Q%6:$===p?oe=(E-F)/Q+2:oe=(F-p)/Q+4,oe*=60,oe<0&&(oe+=360)),{h:oe,s:$===0?0:Q/$,v:$}}function pe(z,V,w){const F=w*V,p=(z%360+360)%360/60,E=F*(1-Math.abs(p%2-1)),[$,Y,Q]=p<1?[F,E,0]:p<2?[E,F,0]:p<3?[0,F,E]:p<4?[0,E,F]:p<5?[E,0,F]:[F,0,E],oe=w-F;return{r:($+oe)*255,g:(Y+oe)*255,b:(Q+oe)*255}}function ce(z){return((Number.isFinite(z)?z:0)%360+360)%360}function ve(z){return Math.min(1,Math.max(0,Number.isFinite(z)?z:0))}return e.onMounted(()=>{document.addEventListener("pointerdown",ie,!0),window.addEventListener("scroll",ue,!0),window.addEventListener("resize",ue),document.addEventListener("keydown",J)}),e.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",ie,!0),window.removeEventListener("scroll",ue,!0),window.removeEventListener("resize",ue),document.removeEventListener("keydown",J)}),(z,V)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("button",{ref_key:"triggerRef",ref:d,type:"button",class:"preset-color-trigger","aria-expanded":l.value,"aria-haspopup":"dialog",title:o.modelValue||"自动",onClick:X},[e.createElementVNode("span",{class:"preset-color-swatch",style:e.normalizeStyle(C.value)},null,4)],8,Ul),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[l.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"panelRef",ref:s,class:"preset-color-panel",role:"dialog","aria-label":"颜色选择",style:e.normalizeStyle(r.value),onPointerdown:V[2]||(V[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",Hl,[e.createElementVNode("span",{class:e.normalizeClass(["picker-current",{"is-empty":!o.modelValue}]),style:e.normalizeStyle(o.modelValue?{background:v.value}:void 0)},null,6),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":V[0]||(V[0]=w=>k.value=w),class:"picker-hex",type:"text",maxlength:"7",spellcheck:"false","aria-label":"颜色值",onInput:ne},null,544),[[e.vModelText,k.value]])]),e.createElementVNode("div",{ref_key:"areaRef",ref:a,class:"picker-area",style:e.normalizeStyle({"--picker-hue":`${Math.round(u.value)}deg`}),"aria-label":"自定义颜色",tabindex:"0",onPointerdown:b,onPointermove:B,onPointerup:S,onPointercancel:S,onKeydown:T},[e.createElementVNode("span",{class:"picker-handle",style:e.normalizeStyle({left:`${m.value*100}%`,top:`${(1-g.value)*100}%`,background:v.value})},null,4)],36),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":V[1]||(V[1]=w=>f.value=w),class:"picker-hue",type:"range",min:"0",max:"360",step:"1","aria-label":"色相"},null,512),[[e.vModelText,f.value,void 0,{number:!0}]]),e.createElementVNode("div",Ol,[V[4]||(V[4]=e.createElementVNode("span",null,"常用颜色",-1)),o.clearable?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"picker-clear",disabled:!o.modelValue,title:"清除选中的颜色",onClick:j},[...V[3]||(V[3]=[e.createElementVNode("svg",{viewBox:"0 0 16 16",width:"12",height:"12","aria-hidden":"true"},[e.createElementVNode("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",fill:"none"})],-1),e.createTextVNode(" 清除 ",-1)])],8,Wl)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Gl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(h.PRESET_COLORS),w=>(e.openBlock(),e.createElementBlock("button",{key:w,type:"button",class:e.normalizeClass(["preset-color-item",{active:!!o.modelValue&&w.toLowerCase()===o.modelValue.toLowerCase()}]),style:e.normalizeStyle({background:w}),title:w,"aria-label":w,onClick:F=>M(w)},null,14,Kl))),128))])],36)):e.createCommentVNode("",!0)]))],64))}}),we=re(ql,[["__scopeId","data-v-12290e7e"]]),Yl={class:"font-select"},jl=["placeholder","aria-expanded","aria-activedescendant","onKeydown"],Xl=["id","aria-selected","onMousedown"],Zl=e.defineComponent({__name:"FontSelect",props:{modelValue:{},placeholder:{default:"默认"}},emits:["update:model-value"],setup(o,{emit:i}){const t=o,n=i,l=jt(),d=`font-select-list-${e.useId()}`,s=e.ref(null),a=e.ref(R(t.modelValue)),r=e.ref(""),u=e.ref(!1),m=e.ref(-1),g=e.computed(()=>{const S=t.modelValue?.trim();return S?ht(l.value,S)?"":S:""}),k=e.computed(()=>{const S=(t.modelValue??"").trim(),x=(ee,le,ie,ue)=>({kind:ee,key:le,label:ie,value:ue,selected:(ue??"")===S}),T=r.value.trim();if(!T){const ee=[x("clear","__clear__",t.placeholder)];g.value&&ee.push(x("unknown","__unknown__",`${g.value}(未知)`,g.value));for(const le of l.value)ee.push(x("font",le.family,bt(le),le.family));return ee}const X=Xt(l.value,T).map(ee=>x("font",ee.family,bt(ee),ee.family));if(!X.length){const ee=y(T);X.push(x("free","__free__",`使用「${ee}」`,ee))}return X});function y(S){const x=He(S);return l.value.find(X=>X.label&&He(X.label)===x)?.family??S}function R(S){const x=S?.trim();return x?ht(l.value,x)?.label??x:""}const C=e.computed(()=>u.value&&m.value>=0?`${d}-${m.value}`:void 0);function v(){const S=(t.modelValue??"").trim();return k.value.findIndex(x=>(x.value??"")===S)}function f(){u.value||(u.value=!0,r.value="",m.value=v())}function M(){u.value=!0}function j(){u.value=!0,r.value=a.value,m.value=k.value.length?0:-1}function ne(S){if(!u.value){f();return}const x=k.value.length-1;x<0||(m.value=Math.min(Math.max(m.value+S,0),x),H())}function H(){e.nextTick(()=>{s.value?.children[m.value]?.scrollIntoView?.({block:"nearest"})})}function K(){if(!u.value)return;const S=k.value[m.value];if(S){b(S);return}const x=r.value.trim();if(x){const T=y(x);b({value:T})}}function b(S){a.value=R(S.value),r.value="",u.value=!1,m.value=-1,n("update:model-value",S.value)}function B(){u.value=!1,r.value="",m.value=-1,a.value=R(t.modelValue)}return e.watch(()=>t.modelValue,S=>{a.value=R(S)}),(S,x)=>(e.openBlock(),e.createElementBlock("div",Yl,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":x[0]||(x[0]=T=>a.value=T),class:"pd-input font-select-input",type:"text",role:"combobox","aria-autocomplete":"list",autocomplete:"off",placeholder:o.placeholder,"aria-expanded":u.value,"aria-controls":d,"aria-activedescendant":C.value,onFocus:f,onClick:M,onInput:j,onKeydown:[x[1]||(x[1]=e.withKeys(e.withModifiers(T=>ne(1),["prevent"]),["down"])),x[2]||(x[2]=e.withKeys(e.withModifiers(T=>ne(-1),["prevent"]),["up"])),e.withKeys(e.withModifiers(K,["prevent"]),["enter"]),e.withKeys(e.withModifiers(B,["prevent"]),["esc"])],onBlur:B},null,40,jl),[[e.vModelText,a.value]]),u.value?(e.openBlock(),e.createElementBlock("ul",{key:0,id:d,ref_key:"listRef",ref:s,class:"font-select-list",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,(T,X)=>(e.openBlock(),e.createElementBlock("li",{id:`${d}-${X}`,key:T.key,class:e.normalizeClass(["font-select-option",{"is-active":X===m.value,"is-muted":T.kind==="unknown"||T.kind==="free"}]),role:"option","aria-selected":T.selected,onMousedown:e.withModifiers(ee=>b(T),["prevent"])},e.toDisplayString(T.label),43,Xl))),128))],512)):e.createCommentVNode("",!0)]))}}),Dt=re(Zl,[["__scopeId","data-v-c559b167"]]),Jl={class:"pd-field"},Ql={class:"pd-field"},_l={class:"pd-field"},ea={class:"pd-field"},ta={class:"pd-radio-group",role:"radiogroup"},oa={class:"pd-radio"},na={class:"pd-radio"},la={class:"pd-radio"},aa={class:"pd-field"},ia={class:"pd-radio-group",role:"radiogroup"},sa={class:"pd-radio"},ra={class:"pd-radio"},da={class:"pd-radio"},ca={class:"color-row"},ua={class:"pd-field"},ma={class:"pd-field"},pa={class:"pd-field"},va={class:"pd-field"},fa={class:"pd-field"},ga=["value"],ha={key:0,class:"pd-field"},ba={class:"pd-field"},Ea=["checked"],ya={key:1,class:"pd-empty"},ka=e.defineComponent({__name:"AppearanceGroup",props:{element:{},isTextType:{type:Boolean},matchedKeys:{},searching:{type:Boolean}},setup(o){const i=o;function t(s){return i.searching?i.matchedKeys?.has(s)??!0:!0}const n=e.computed(()=>i.element.printElementType.type==="table"),l=e.computed(()=>h.resolveElementTextFit(i.element.printElementType.type||"text",i.element.options));function d(s){i.element.options.textFit=s.target.value}return(s,a)=>(e.openBlock(),e.createBlock(Ce,{title:"外观",icon:"Brush","default-expanded":"","group-key":"appearance"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:a[15]||(a[15]=e.withModifiers(()=>{},["prevent"]))},[o.isTextType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",Jl,[a[16]||(a[16]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(Dt,{modelValue:o.element.options.fontFamily,"onUpdate:modelValue":a[0]||(a[0]=r=>o.element.options.fontFamily=r)},null,8,["modelValue"])],512),[[e.vShow,t("ap-font-family")]]),e.withDirectives(e.createElementVNode("div",Ql,[a[17]||(a[17]=e.createElementVNode("span",{class:"pd-label"},"字体大小",-1)),e.createVNode(se,{modelValue:o.element.options.fontSize,"onUpdate:modelValue":a[1]||(a[1]=r=>o.element.options.fontSize=r),min:8,max:72},null,8,["modelValue"])],512),[[e.vShow,t("ap-font-size")]]),e.withDirectives(e.createElementVNode("div",_l,[a[19]||(a[19]=e.createElementVNode("span",{class:"pd-label"},"字体粗细",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":a[2]||(a[2]=r=>o.element.options.fontWeight=r),style:{width:"100%"}},[...a[18]||(a[18]=[e.createElementVNode("option",{value:"normal"},"正常",-1),e.createElementVNode("option",{value:"bold"},"粗体",-1),e.createElementVNode("option",{value:"bolder"},"更粗",-1),e.createElementVNode("option",{value:"lighter"},"细体",-1)])],512),[[e.vModelSelect,o.element.options.fontWeight]])],512),[[e.vShow,t("ap-font-weight")]]),e.withDirectives(e.createElementVNode("div",ea,[a[23]||(a[23]=e.createElementVNode("span",{class:"pd-label"},"对齐",-1)),e.createElementVNode("div",ta,[e.createElementVNode("label",oa,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":a[3]||(a[3]=r=>o.element.options.textAlign=r),value:"left"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),a[20]||(a[20]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",na,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":a[4]||(a[4]=r=>o.element.options.textAlign=r),value:"center"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),a[21]||(a[21]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",la,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":a[5]||(a[5]=r=>o.element.options.textAlign=r),value:"right"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),a[22]||(a[22]=e.createElementVNode("span",null,"右",-1))])])],512),[[e.vShow,t("ap-align")]]),e.withDirectives(e.createElementVNode("div",aa,[a[27]||(a[27]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",ia,[e.createElementVNode("label",sa,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":a[6]||(a[6]=r=>o.element.options.verticalAlign=r),value:"top"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),a[24]||(a[24]=e.createElementVNode("span",null,"顶",-1))]),e.createElementVNode("label",ra,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":a[7]||(a[7]=r=>o.element.options.verticalAlign=r),value:"middle"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),a[25]||(a[25]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",da,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":a[8]||(a[8]=r=>o.element.options.verticalAlign=r),value:"bottom"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),a[26]||(a[26]=e.createElementVNode("span",null,"底",-1))])])],512),[[e.vShow,t("ap-vertical-align")]]),e.createElementVNode("div",ca,[e.withDirectives(e.createElementVNode("div",ua,[a[28]||(a[28]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(we,{modelValue:o.element.options.color,"onUpdate:modelValue":a[9]||(a[9]=r=>o.element.options.color=r)},null,8,["modelValue"])],512),[[e.vShow,t("ap-color")]]),e.withDirectives(e.createElementVNode("div",ma,[a[29]||(a[29]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(we,{modelValue:o.element.options.backgroundColor,"onUpdate:modelValue":a[10]||(a[10]=r=>o.element.options.backgroundColor=r)},null,8,["modelValue"])],512),[[e.vShow,t("ap-bg-color")]])]),e.withDirectives(e.createElementVNode("div",pa,[a[30]||(a[30]=e.createElementVNode("span",{class:"pd-label"},"行高",-1)),e.createVNode(se,{modelValue:o.element.options.lineHeight,"onUpdate:modelValue":a[11]||(a[11]=r=>o.element.options.lineHeight=r),min:0,max:100},null,8,["modelValue"])],512),[[e.vShow,t("ap-line-height")]]),e.withDirectives(e.createElementVNode("div",va,[a[31]||(a[31]=e.createElementVNode("span",{class:"pd-label"},"字间距",-1)),e.createVNode(se,{modelValue:o.element.options.letterSpacing,"onUpdate:modelValue":a[12]||(a[12]=r=>o.element.options.letterSpacing=r),min:0,max:20,step:.5},null,8,["modelValue"])],512),[[e.vShow,t("ap-letter-spacing")]]),e.withDirectives(e.createElementVNode("div",fa,[a[33]||(a[33]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:l.value,style:{width:"100%"},onChange:d},[...a[32]||(a[32]=[e.createElementVNode("option",{value:"clip"},"截断",-1),e.createElementVNode("option",{value:"shrink"},"自动缩小",-1),e.createElementVNode("option",{value:"autoHeight"},"自适应行高",-1)])],40,ga)],512),[[e.vShow,t("ap-text-fit")]]),l.value==="shrink"?e.withDirectives((e.openBlock(),e.createElementBlock("div",ha,[a[34]||(a[34]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(se,{"model-value":o.element.options.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":a[13]||(a[13]=r=>o.element.options.shrinkMinFontSize=r??void 0)},null,8,["model-value"])],512)),[[e.vShow,t("ap-shrink-min")]]):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",ba,[a[35]||(a[35]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:o.element.options.wordWrap!==!1,type:"checkbox",class:"pd-switch",onInput:a[14]||(a[14]=r=>o.element.options.wordWrap=r.target.checked?void 0:!1)},null,40,Ea)],512),[[e.vShow,t("ap-word-wrap")]])],64)):e.createCommentVNode("",!0),!o.isTextType&&!n.value?(e.openBlock(),e.createElementBlock("p",ya,"当前元素不支持外观设置")):e.createCommentVNode("",!0)],32)]),_:1}))}}),Va=re(ka,[["__scopeId","data-v-ec9e5cb7"]]),Na={class:"pd-field"},wa=["value"],Ca={class:"pd-field"},Sa=["value"],Ba={class:"pd-hint"},xa={class:"pd-field"},$a={class:"pd-field"},Ta=["checked"],Da={class:"pd-field"},Ma={key:1,class:"pd-field"},Pa=["value"],za={key:2,class:"pd-hint"},La={key:3,class:"pd-field"},Ra=["value"],Aa={class:"pd-field"},Ia={class:"pd-field"},Fa=e.defineComponent({__name:"CodeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["change"],setup(o,{emit:i}){const t=o,n=i,l=e.computed(()=>t.element.printElementType.type==="barcode"),d=e.computed(()=>t.element.printElementType.type==="qrcode"),s=e.computed(()=>(t.element.options.barcodeType||"CODE128").toUpperCase()),a=e.computed(()=>t.element.options.printerDpi?String(t.element.options.printerDpi):""),r=e.computed(()=>!!t.element.options.printerDpi),u=e.computed(()=>l.value&&r.value);function m(C){const v=Number(C.target.value);t.element.options.printerDpi=v>0?v:void 0,R()}function g(C){const v=C.target.value;t.element.options.barcodeType=v==="CODE128"?void 0:v,R()}function k(C){t.element.options.fit=C.target.value||void 0,R()}function y(C){return t.searching?t.matchedKeys?.has(C)??!0:!0}function R(){n("change")}return(C,v)=>(e.openBlock(),e.createBlock(Ce,{title:"条码设置",icon:"Postcard","default-expanded":"","group-key":"code"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:v[6]||(v[6]=e.withModifiers(()=>{},["prevent"]))},[l.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",Na,[v[8]||(v[8]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{class:"pd-select",value:s.value,onChange:g},[...v[7]||(v[7]=[e.createElementVNode("option",{value:"CODE128"},"CODE128(通用)",-1),e.createElementVNode("option",{value:"EAN13"},"EAN13(商品码)",-1),e.createElementVNode("option",{value:"EAN8"},"EAN8",-1),e.createElementVNode("option",{value:"UPC"},"UPC",-1),e.createElementVNode("option",{value:"CODE39"},"CODE39",-1),e.createElementVNode("option",{value:"ITF14"},"ITF14",-1)])],40,wa)],512),[[e.vShow,y("cd-type")]]),e.withDirectives(e.createElementVNode("div",Ca,[v[10]||(v[10]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{class:"pd-select",value:a.value,onChange:m},[...v[9]||(v[9]=[e.createElementVNode("option",{value:""},"不指定(按条宽渲染)",-1),e.createElementVNode("option",{value:"203"},"203 dpi(8 点/mm)",-1),e.createElementVNode("option",{value:"300"},"300 dpi(11.8 点/mm)",-1),e.createElementVNode("option",{value:"600"},"600 dpi(23.6 点/mm)",-1)])],40,Sa)],512),[[e.vShow,y("cd-dpi")]]),e.withDirectives(e.createElementVNode("p",Ba,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小",512),[[e.vShow,y("cd-dpi")]]),e.withDirectives(e.createElementVNode("div",xa,[v[11]||(v[11]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(se,{"model-value":o.element.options.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":v[0]||(v[0]=f=>{o.element.options.barWidth=f,R()})},null,8,["model-value"])],512),[[e.vShow,y("cd-bar-width")]]),e.withDirectives(e.createElementVNode("p",{class:"pd-hint"},e.toDisplayString(u.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),元素框放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),513),[[e.vShow,y("cd-bar-width")]]),e.withDirectives(e.createElementVNode("div",$a,[v[12]||(v[12]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:o.element.options.hideTitle!==!0,type:"checkbox",class:"pd-switch",onInput:v[1]||(v[1]=f=>{o.element.options.hideTitle=f.target.checked?void 0:!0,R()})},null,40,Ta)],512),[[e.vShow,y("cd-show-text")]]),e.withDirectives(e.createElementVNode("div",Da,[v[13]||(v[13]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(se,{"model-value":o.element.options.fontSize,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":v[2]||(v[2]=f=>{o.element.options.fontSize=f??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,y("cd-font-size")]])],64)):d.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",Ma,[v[15]||(v[15]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{class:"pd-select",value:String(o.element.options.qrCodeLevel??"M"),onChange:v[3]||(v[3]=f=>{o.element.options.qrCodeLevel=f.target.value,R()})},[...v[14]||(v[14]=[e.createElementVNode("option",{value:"L"},"L(最低,容量大)",-1),e.createElementVNode("option",{value:"M"},"M(推荐)",-1),e.createElementVNode("option",{value:"Q"},"Q",-1),e.createElementVNode("option",{value:"H"},"H(最高)",-1)])],40,Pa)],512)),[[e.vShow,y("cd-ec-level")]]):e.createCommentVNode("",!0),v[20]||(v[20]=e.createElementVNode("h3",{class:"pd-divider"},"自定义设置",-1)),l.value?(e.openBlock(),e.createElementBlock("p",za,"条码尺寸由「条宽」与「打印机分辨率」结算:宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),l.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("div",La,[v[17]||(v[17]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{class:"pd-select",value:o.element.options.fit||"contain",onChange:k},[...v[16]||(v[16]=[e.createElementVNode("option",{value:"contain"},"包含(保持比例)",-1),e.createElementVNode("option",{value:"cover"},"覆盖(保持比例)",-1),e.createElementVNode("option",{value:"fill"},"拉伸填满",-1),e.createElementVNode("option",{value:"none"},"原始尺寸",-1),e.createElementVNode("option",{value:"scale-down"},"缩小(保持比例)",-1)])],40,Ra)],512)),[[e.vShow,y("cd-fit")]]),e.withDirectives(e.createElementVNode("div",Aa,[v[18]||(v[18]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(se,{"model-value":o.element.options.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":v[4]||(v[4]=f=>{o.element.options.maxWidth=f??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,y("cd-max-width")]]),e.withDirectives(e.createElementVNode("div",Ia,[v[19]||(v[19]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(se,{"model-value":o.element.options.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":v[5]||(v[5]=f=>{o.element.options.maxHeight=f??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,y("cd-max-height")]])],32)]),_:1}))}}),Ua={class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},Ha={class:"pd-dialog-header"},Oa={class:"expression-editor"},Wa={class:"ee-nav"},Ga={class:"ee-nav-tabs"},Ka={class:"ee-content"},qa={class:"ee-content-search"},Ya=["placeholder"],ja={class:"ee-content-list"},Xa={class:"ee-field-group-icon"},Za=["onDblclick"],Ja={class:"ee-field-info"},Qa={class:"ee-item-label"},_a={class:"ee-item-key"},ei={key:0,class:"pd-empty"},ti=["onDblclick"],oi={class:"ee-field-info"},ni={class:"ee-item-label"},li={class:"ee-item-key"},ai={class:"ee-func-group"},ii=["onDblclick"],si={class:"ee-field-info"},ri={class:"ee-item-label"},di={class:"ee-item-key"},ci={class:"ee-func-group"},ui=["onDblclick"],mi={class:"ee-field-info"},pi={class:"ee-item-label"},vi={class:"ee-item-key"},fi={class:"ee-editor"},gi={class:"ee-editor-section"},hi={class:"ee-editor-section"},bi={class:"pd-dialog-footer"},Ei=e.defineComponent({__name:"ExpressionEditor",props:{modelValue:{type:Boolean},expression:{},fields:{}},emits:["update:modelValue","update:expression"],setup(o,{emit:i}){const t=o,n=i,l=e.computed({get:()=>t.modelValue,set:B=>n("update:modelValue",B)}),d=e.ref("field"),s=e.computed(()=>{switch(d.value){case"field":return"搜索字段...";case"variable":return"搜索变量...";case"function":return"搜索函数...";default:return"搜索..."}}),a=e.ref(""),r=e.computed(()=>h.filterGroups(h.groupFields(t.fields??[]),a.value));e.watch(l,B=>{B&&(v.value=t.expression||"")});function u(B){const{insideParens:S}=k();K(S?B.fieldKey:`{${B.fieldKey}}`)}function m(B){const{insideParens:S}=k();K(S?B.template.replace(/^\{|\}$/g,""):B.template)}function g(B){const{insideBlock:S}=k(),x=S?B.template:`{${B.template}}`,T=x.indexOf("(")+1;K(x,T)}function k(){const S=f.value?.selectionStart??v.value.length,x=v.value.substring(0,S);let T=!1;const X=x.lastIndexOf("{");X!==-1&&!x.slice(X+1).includes("}")&&(T=!0);let ee=!1;const le=x.lastIndexOf("(");return le!==-1&&!x.slice(le+1).includes(")")&&(ee=!0),{insideBlock:T,insideParens:ee}}const y=e.computed(()=>{if(!a.value.trim())return ne;const B=a.value.trim().toLowerCase();return ne.filter(S=>S.label.toLowerCase().includes(B)||S.name.toLowerCase().includes(B))}),R=e.computed(()=>{if(!a.value.trim())return M;const B=a.value.trim().toLowerCase();return M.filter(S=>S.label.toLowerCase().includes(B)||S.name.toLowerCase().includes(B))}),C=e.computed(()=>{if(!a.value.trim())return j;const B=a.value.trim().toLowerCase();return j.filter(S=>S.label.toLowerCase().includes(B)||S.name.toLowerCase().includes(B))}),v=e.ref(t.expression||""),f=e.ref(null);e.watch(()=>t.expression,B=>{v.value=B||""});const M=[{name:"SUM",label:"求和",template:"SUM()"},{name:"AVG",label:"平均值",template:"AVG()"},{name:"COUNT",label:"计数",template:"COUNT()"},{name:"MIN",label:"最小值",template:"MIN()"},{name:"MAX",label:"最大值",template:"MAX()"}],j=[{name:"MONEY",label:"金额格式化",template:"MONEY()"},{name:"DATE",label:"日期格式化",template:"DATE()"},{name:"UPPER",label:"大写金额",template:"UPPER()"},{name:"IF",label:"条件判断",template:"IF()"}],ne=[{name:"pageIndex",label:"当前页码",template:"{pageIndex}"},{name:"totalPages",label:"总页数",template:"{totalPages}"},{name:"printDate",label:"打印日期",template:"{printDate}"},{name:"printTime",label:"打印时间",template:"{printTime}"}],H=e.computed(()=>{if(!v.value.trim())return"(输入表达式后预览)";try{const B={...h.DEFAULT_DEMO_DATA,...ge.resolveSystemVariables()},S=h.evaluateTemplate(v.value,B);return S==null?"(无法计算)":String(S)}catch{return"(表达式错误)"}});function K(B,S=B.length){const x=f.value;if(!x){v.value+=B;return}const T=x.selectionStart,X=x.selectionEnd,ee=v.value.substring(0,T),le=v.value.substring(X);v.value=ee+B+le;const ie=T+S;e.nextTick(()=>{x.focus(),x.selectionStart=x.selectionEnd=ie})}function b(){n("update:expression",v.value),l.value=!1}return(B,S)=>l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pd-dialog-overlay",onKeydown:S[7]||(S[7]=e.withKeys(x=>l.value=!1,["esc"]))},[e.createElementVNode("section",Ua,[e.createElementVNode("header",Ha,[S[8]||(S[8]=e.createElementVNode("strong",{id:"expression-editor-title"},"编辑表达式",-1)),e.createElementVNode("button",{type:"button",class:"pd-close","aria-label":"关闭",onClick:S[0]||(S[0]=x=>l.value=!1)},"×")]),e.createElementVNode("div",Oa,[e.createElementVNode("div",Wa,[S[9]||(S[9]=e.createElementVNode("div",{class:"ee-nav-title"},"类型",-1)),e.createElementVNode("div",Ga,[e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:d.value==="field"}]),onClick:S[1]||(S[1]=x=>d.value="field")}," 📁 字段 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:d.value==="variable"}]),onClick:S[2]||(S[2]=x=>d.value="variable")}," 🔧 变量 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:d.value==="function"}]),onClick:S[3]||(S[3]=x=>d.value="function")}," ⚡ 函数 ",2)])]),e.createElementVNode("div",Ka,[e.createElementVNode("div",qa,[e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":S[4]||(S[4]=x=>a.value=x),placeholder:s.value},null,8,Ya),[[e.vModelText,a.value]])]),e.createElementVNode("div",ja,[d.value==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,x=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:x.key||"_top"},[x.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ee-field-group",{"is-list":x.isList}])},[e.createElementVNode("span",Xa,e.toDisplayString(x.isList?"📋":"📁"),1),e.createElementVNode("span",null,e.toDisplayString(x.label),1)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.fields,T=>(e.openBlock(),e.createElementBlock("div",{key:T.fieldKey,class:"ee-list-item ee-field-item",style:e.normalizeStyle({paddingLeft:x.key?"22px":"10px"}),onDblclick:X=>u(T)},[e.createElementVNode("div",Ja,[e.createElementVNode("span",Qa,e.toDisplayString(T.fieldLabel),1),e.createElementVNode("span",_a,e.toDisplayString(T.fieldKey),1)])],44,Za))),128))],64))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("p",ei,"暂无字段")):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),d.value==="variable"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(y.value,x=>(e.openBlock(),e.createElementBlock("div",{key:x.name,class:"ee-list-item",onDblclick:T=>m(x)},[e.createElementVNode("div",oi,[e.createElementVNode("span",ni,e.toDisplayString(x.label),1),e.createElementVNode("span",li,e.toDisplayString(x.template),1)])],40,ti))),128)):e.createCommentVNode("",!0),d.value==="function"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",ai,[S[10]||(S[10]=e.createElementVNode("div",{class:"ee-func-group-title"},"聚合函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,x=>(e.openBlock(),e.createElementBlock("div",{key:x.name,class:"ee-list-item",onDblclick:T=>g(x)},[e.createElementVNode("div",si,[e.createElementVNode("span",ri,e.toDisplayString(x.label),1),e.createElementVNode("span",di,e.toDisplayString(x.name)+"()",1)])],40,ii))),128))]),e.createElementVNode("div",ci,[S[11]||(S[11]=e.createElementVNode("div",{class:"ee-func-group-title"},"格式化函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,x=>(e.openBlock(),e.createElementBlock("div",{key:x.name,class:"ee-list-item",onDblclick:T=>g(x)},[e.createElementVNode("div",mi,[e.createElementVNode("span",pi,e.toDisplayString(x.label),1),e.createElementVNode("span",vi,e.toDisplayString(x.name)+"()",1)])],40,ui))),128))])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",fi,[e.createElementVNode("div",gi,[S[12]||(S[12]=e.createElementVNode("div",{class:"ee-editor-title"},"表达式编辑",-1)),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:f,"onUpdate:modelValue":S[5]||(S[5]=x=>v.value=x),class:"ee-textarea",rows:"6",placeholder:"双击左侧字段/变量/函数插入,或直接输入静态内容"},null,512),[[e.vModelText,v.value]])]),e.createElementVNode("div",hi,[S[13]||(S[13]=e.createElementVNode("div",{class:"ee-editor-title"},"预览结果",-1)),e.createElementVNode("div",{class:e.normalizeClass(["ee-preview",{"ee-preview-error":H.value==="(表达式错误)"}])},e.toDisplayString(H.value),3)]),S[14]||(S[14]=e.createStaticVNode('<div class="ee-help-section" data-v-9788fc78><div class="ee-help-title" data-v-9788fc78>帮助信息</div><div class="ee-help-grid" data-v-9788fc78><div class="ee-help-card ee-help-field" data-v-9788fc78><div class="ee-help-card-title" data-v-9788fc78>输入方式</div><div class="ee-help-card-content" data-v-9788fc78> 双击左侧字段、变量、函数即可插入到表达式输入框中<br data-v-9788fc78> 静态数据直接输入即可,如:供应商名称<br data-v-9788fc78> 动态解析字段、变量、函数必须用 {} 包裹<br data-v-9788fc78> 示例:{SUM(supplier.name)}<br data-v-9788fc78> 注意:只能嵌套一层 </div></div><div class="ee-help-card ee-help-function" data-v-9788fc78><div class="ee-help-card-title" data-v-9788fc78>函数使用</div><div class="ee-help-card-content" data-v-9788fc78> SUM(字段) - 求和<br data-v-9788fc78> AVG(字段) - 平均值<br data-v-9788fc78> COUNT(字段) - 计数<br data-v-9788fc78> IF(条件, 真值, 假值) - 条件判断 </div></div><div class="ee-help-card ee-help-variable" data-v-9788fc78><div class="ee-help-card-title" data-v-9788fc78>系统变量</div><div class="ee-help-card-content" data-v-9788fc78> {pageIndex} - 当前页码<br data-v-9788fc78> {totalPages} - 总页数<br data-v-9788fc78> {printDate} - 打印日期 </div></div><div class="ee-help-card ee-help-conditional" data-v-9788fc78><div class="ee-help-card-title" data-v-9788fc78>示例</div><div class="ee-help-card-content" data-v-9788fc78> 静态文本:供应商名称<br data-v-9788fc78> 动态字段:{supplier.name}<br data-v-9788fc78> 函数调用:{SUM(amount)}<br data-v-9788fc78> 条件判断:{IF(amount&gt;1000, &quot;大单&quot;, &quot;小单&quot;)} </div></div></div></div>',1))])]),e.createElementVNode("footer",bi,[e.createElementVNode("button",{type:"button",class:"pd-button",onClick:S[6]||(S[6]=x=>l.value=!1)},"取消"),e.createElementVNode("button",{type:"button",class:"pd-button primary",onClick:b},"确定")])])],32)):e.createCommentVNode("",!0)}}),Je=re(Ei,[["__scopeId","data-v-9788fc78"]]),yi={class:"pd-field"},ki={class:"pd-label"},Vi=["value","placeholder"],Ni=e.defineComponent({__name:"BindingControl",props:{descriptor:{},modelValue:{},fields:{}},emits:["update:modelValue"],setup(o,{emit:i}){const t=i,n=e.ref(!1);function l(){n.value=!0}return(d,s)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",yi,[e.createElementVNode("span",ki,e.toDisplayString(o.descriptor.label),1),e.createElementVNode("input",{value:o.modelValue,class:"pd-input",placeholder:o.descriptor.placeholder||"输入内容,支持 {字段} 表达式",onInput:s[0]||(s[0]=a=>t("update:modelValue",a.target.value)),onDblclick:l},null,40,Vi)]),e.createVNode(Je,{modelValue:n.value,"onUpdate:modelValue":s[1]||(s[1]=a=>n.value=a),fields:o.fields,expression:o.modelValue,"onUpdate:expression":s[2]||(s[2]=a=>t("update:modelValue",a))},null,8,["modelValue","fields","expression"])],64))}}),wi=re(Ni,[["__scopeId","data-v-40a99329"]]),Ci={class:"pd-field"},Si=["value"],Bi=["value"],xi={class:"pd-field"},$i={class:"pd-field"},Ti={class:"pd-field"},Di={class:"pd-field"},Mi={style:{width:"60px"}},Pi=e.defineComponent({__name:"TableSettingsGroup",props:{element:{},fields:{}},setup(o){const i=o,t=e.inject(Oe,null),n=e.computed(()=>i.fields.filter(s=>s.fieldType==="list").map(s=>({label:s.fieldLabel,value:s.fieldKey})));function l(s){i.element.options.dataSource=s||void 0,t?.recordHistory()}function d(s,a){if(a===void 0)return;const r=i.element.options.tableColWidths,u=t?.maxTableWidth.value??1/0,m=r.reduce((g,k,y)=>y===s?g:g+k,0);if(m+a>u){const g=Math.max(5,Math.round((u-m)*10)/10);alert(`表格总宽不能超过打印范围宽度 ${u}mm,列${s+1} 已调整为 ${g}mm`),r[s]=g}else r[s]=a;h.syncTableElementSize(i.element.options),t?.recordHistory()}return(s,a)=>(e.openBlock(),e.createBlock(Ce,{title:"表格设置",icon:"Grid","default-expanded":"","group-key":"table-settings"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:a[4]||(a[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Ci,[a[5]||(a[5]=e.createElementVNode("span",{class:"pd-label"},"列表数据源字段",-1)),e.createElementVNode("select",{value:o.element.options.dataSource,class:"pd-select",style:{width:"100%"},onChange:a[0]||(a[0]=r=>l(r.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,r=>(e.openBlock(),e.createElementBlock("option",{key:r.value,value:r.value},e.toDisplayString(r.label),9,Bi))),128))],40,Si)]),e.createElementVNode("div",xi,[a[6]||(a[6]=e.createElementVNode("span",{class:"pd-label"},"默认字号 (pt)",-1)),e.createVNode(se,{modelValue:o.element.options.tableDefaultFontSize,"onUpdate:modelValue":a[1]||(a[1]=r=>o.element.options.tableDefaultFontSize=r),min:5,max:72,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",$i,[a[7]||(a[7]=e.createElementVNode("span",{class:"pd-label"},"默认文字颜色",-1)),e.createVNode(we,{modelValue:o.element.options.tableDefaultColor,"onUpdate:modelValue":a[2]||(a[2]=r=>o.element.options.tableDefaultColor=r)},null,8,["modelValue"])]),e.createElementVNode("div",Ti,[a[8]||(a[8]=e.createElementVNode("span",{class:"pd-label"},"默认内边距 (mm)",-1)),e.createVNode(se,{modelValue:o.element.options.tableDefaultPadding,"onUpdate:modelValue":a[3]||(a[3]=r=>o.element.options.tableDefaultPadding=r),min:0,max:10,step:.5,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Di,[a[9]||(a[9]=e.createElementVNode("span",{class:"pd-label"},"列宽 (mm)",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.element.options.tableColWidths,(r,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:"col-width-row"},[e.createElementVNode("span",Mi,"列"+e.toDisplayString(u+1),1),e.createVNode(se,{"model-value":r,min:5,max:200,"onUpdate:modelValue":m=>d(u,m)},null,8,["model-value","onUpdate:modelValue"])]))),128))])],32)]),_:1}))}}),zi=re(Pi,[["__scopeId","data-v-b5fdc7ff"]]),Li={class:"border-row"},Ri={class:"pd-field"},Ai={class:"pd-field"},Ii={class:"pd-field"},Fi=e.defineComponent({__name:"BorderBgGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const i=o;function t(n){return i.searching?i.matchedKeys?.has(n)??!0:!0}return(n,l)=>(e.openBlock(),e.createBlock(Ce,{title:"边框与背景",icon:"Picture","default-expanded":"","group-key":"border-bg"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:l[3]||(l[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Li,[e.withDirectives(e.createElementVNode("div",Ri,[l[4]||(l[4]=e.createElementVNode("span",{class:"pd-label"},"边框宽度",-1)),e.createVNode(se,{modelValue:o.element.options.borderWidth,"onUpdate:modelValue":l[0]||(l[0]=d=>o.element.options.borderWidth=d),min:0,max:20,step:.25},null,8,["modelValue"])],512),[[e.vShow,t("bb-border-width")]]),e.withDirectives(e.createElementVNode("div",Ai,[l[5]||(l[5]=e.createElementVNode("span",{class:"pd-label"},"边框颜色",-1)),e.createVNode(we,{modelValue:o.element.options.borderColor,"onUpdate:modelValue":l[1]||(l[1]=d=>o.element.options.borderColor=d)},null,8,["modelValue"])],512),[[e.vShow,t("bb-border-color")]])]),e.withDirectives(e.createElementVNode("div",Ii,[l[6]||(l[6]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(we,{modelValue:o.element.options.backgroundColor,"onUpdate:modelValue":l[2]||(l[2]=d=>o.element.options.backgroundColor=d)},null,8,["modelValue"])],512),[[e.vShow,t("bb-bg-color")]])],32)]),_:1}))}}),Ui=re(Fi,[["__scopeId","data-v-e0e6d714"]]),Hi={class:"advanced-row"},Oi={class:"pd-field"},Wi={class:"pd-field"},Gi={class:"pd-field"},Ki={class:"pd-field"},qi=e.defineComponent({__name:"AdvancedGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["delete-element"],setup(o){const i=o;function t(n){return i.searching?i.matchedKeys?.has(n)??!0:!0}return(n,l)=>(e.openBlock(),e.createBlock(Ce,{title:"高级设置",icon:"Setting","group-key":"advanced"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:l[4]||(l[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Hi,[e.withDirectives(e.createElementVNode("div",Oi,[l[5]||(l[5]=e.createElementVNode("span",{class:"pd-label"},"锁定",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":l[0]||(l[0]=d=>o.element.options.locked=d)},null,512),[[e.vModelCheckbox,o.element.options.locked]])],512),[[e.vShow,t("ad-locked")]]),e.withDirectives(e.createElementVNode("div",Wi,[l[6]||(l[6]=e.createElementVNode("span",{class:"pd-label"},"每页重复",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":l[1]||(l[1]=d=>o.element.options.fixed=d)},null,512),[[e.vModelCheckbox,o.element.options.fixed]])],512),[[e.vShow,t("ad-fixed")]])]),e.withDirectives(e.createElementVNode("div",Gi,[l[7]||(l[7]=e.createElementVNode("span",{class:"pd-label"},"层级",-1)),e.createVNode(se,{modelValue:o.element.options.zIndex,"onUpdate:modelValue":l[2]||(l[2]=d=>o.element.options.zIndex=d),min:0,max:999},null,8,["modelValue"])],512),[[e.vShow,t("ad-z-index")]]),e.withDirectives(e.createElementVNode("div",Ki,[e.createElementVNode("button",{type:"button",class:"pd-button danger",onClick:l[3]||(l[3]=d=>n.$emit("delete-element"))}," 删除元素 ")],512),[[e.vShow,t("ad-delete")]])],32)]),_:1}))}}),Yi=re(qi,[["__scopeId","data-v-14924be2"]]),ji={key:0,class:"pd-field"},Xi=["checked"],Zi={class:"pd-field"},Ji=["checked"],Qi={class:"pd-field"},_i=["checked"],Nt=e.defineComponent({__name:"PaginationGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const i=o,t=e.computed(()=>i.element.printElementType.type==="table"),n=e.computed({get:()=>i.element.options.tablePagination?.enabled??!0,set:()=>{}});function l(m){i.element.options.tablePagination={enabled:m}}const d=e.computed({get:()=>i.element.options.pagination?.pageable??!0,set:()=>{}}),s=e.computed({get:()=>i.element.options.pagination?.keepWithNext??!1,set:()=>{}});function a(m){i.element.options.pagination={pageable:m,keepWithNext:s.value}}function r(m){i.element.options.pagination={pageable:d.value,keepWithNext:m}}function u(m){return i.searching?i.matchedKeys?.has(m)??!0:!0}return(m,g)=>(e.openBlock(),e.createBlock(Ce,{title:"分页配置",icon:"Document","group-key":"pagination"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:g[3]||(g[3]=e.withModifiers(()=>{},["prevent"]))},[t.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",ji,[g[4]||(g[4]=e.createElementVNode("span",{class:"pd-label"},"启用分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:n.value,onChange:g[0]||(g[0]=k=>l(k.target.checked))},null,40,Xi)],512)),[[e.vShow,u("pg-enabled")]]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.withDirectives(e.createElementVNode("div",Zi,[g[5]||(g[5]=e.createElementVNode("span",{class:"pd-label"},"参与分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:d.value,onChange:g[1]||(g[1]=k=>a(k.target.checked))},null,40,Ji)],512),[[e.vShow,u("pg-pageable")]]),e.withDirectives(e.createElementVNode("div",Qi,[g[6]||(g[6]=e.createElementVNode("span",{class:"pd-label"},"与下元素同页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:s.value,onChange:g[2]||(g[2]=k=>r(k.target.checked))},null,40,_i)],512),[[e.vShow,u("pg-keep-with-next")]])],64))],32)]),_:1}))}}),es={class:"image-content-upload"},ts=["disabled"],os=e.defineComponent({__name:"ImageContentUpload",props:{disabled:{type:Boolean}},emits:["success"],setup(o,{emit:i}){const t=o,n=i,l=e.ref(!1),d=e.inject(dt,e.computed(()=>{})),s=e.computed(()=>t.disabled||l.value||!d.value);async function a(r){const u=r.target,m=u.files?.[0];if(m){if(!m.type.startsWith("image/")){alert("仅支持上传图片文件"),u.value="";return}if(!d.value){alert("图片上传能力未配置"),u.value="";return}l.value=!0;try{const g=await d.value(m);g?n("success",g):alert("图片上传失败")}catch(g){alert(g instanceof Error?g.message:"图片上传失败")}finally{l.value=!1,u.value=""}}}return(r,u)=>(e.openBlock(),e.createElementBlock("div",es,[e.createElementVNode("label",{class:e.normalizeClass(["pd-button small upload-label",{disabled:s.value}])},[u[0]||(u[0]=e.createElementVNode("svg",{class:"pd-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[e.createElementVNode("path",{fill:"currentColor",d:"M12 3l4 4h-3v7h-2V7H8zm-7 12h14v5H5Z"})],-1)),e.createTextVNode(" "+e.toDisplayString(l.value?"上传中...":"上传图片")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:s.value,onChange:a},null,40,ts)],2),u[1]||(u[1]=e.createElementVNode("p",{class:"upload-tip"},"支持 jpg/png/gif/bmp/webp/svg 等图片,上传后填入相对路径",-1))]))}}),ns=re(os,[["__scopeId","data-v-b730e8e6"]]),ls={class:"pd-field"},as=["value"],is={class:"pd-field"},ss={key:0,class:"pd-field"},rs=["checked"],ds=e.defineComponent({__name:"TableRowGroup",props:{element:{},selection:{}},setup(o){const i=o,t=e.inject(Oe),n=e.computed(()=>i.element.options.tableRows[i.selection.r1]);function l(a){const r=h.setRowType(i.element.options.tableRows,i.selection.r1,a);if(r){alert(r);return}t.recordHistory()}function d(a){a!==void 0&&(n.value.height=a,h.syncTableElementSize(i.element.options),t.recordHistory())}function s(a){n.value.repeatOnPage=a,t.recordHistory()}return(a,r)=>(e.openBlock(),e.createBlock(Ce,{title:"行属性",icon:"Grid","default-expanded":"","group-key":"table-row"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:r[2]||(r[2]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",ls,[r[4]||(r[4]=e.createElementVNode("span",{class:"pd-label"},"行类型",-1)),e.createElementVNode("select",{value:n.value.type,class:"pd-select",style:{width:"100%"},onChange:r[0]||(r[0]=u=>l(u.target.value))},[...r[3]||(r[3]=[e.createElementVNode("option",{value:"header"},"标题行",-1),e.createElementVNode("option",{value:"data"},"数据行",-1),e.createElementVNode("option",{value:"subtotal"},"小计行(每页小计)",-1),e.createElementVNode("option",{value:"summary"},"汇总行",-1)])],40,as)]),e.createElementVNode("div",is,[r[5]||(r[5]=e.createElementVNode("span",{class:"pd-label"},"行高 (mm)",-1)),e.createVNode(se,{"model-value":n.value.height,min:3,max:100,step:.5,"onUpdate:modelValue":d},null,8,["model-value"])]),n.value.type==="header"?(e.openBlock(),e.createElementBlock("div",ss,[r[6]||(r[6]=e.createElementVNode("span",{class:"pd-label"},"每页顶部重复",-1)),e.createElementVNode("input",{checked:n.value.repeatOnPage??!1,type:"checkbox",class:"pd-switch",onInput:r[1]||(r[1]=u=>s(!!u.target.checked))},null,40,rs)])):e.createCommentVNode("",!0)],32)]),_:1}))}}),cs={class:"pd-field"},us={class:"pd-radio-group",role:"radiogroup"},ms={class:"pd-radio"},ps=["checked"],vs={class:"pd-radio"},fs=["checked"],gs={class:"pd-radio"},hs=["checked"],bs={class:"pd-radio"},Es=["checked"],ys={key:0,class:"pd-field"},ks=["value"],Vs={key:1,class:"pd-field"},Ns=["checked"],ws={key:2,class:"pd-field"},Cs={key:3,class:"pd-hint"},Ss={key:4,class:"pd-field"},Bs={key:5,class:"pd-field"},xs=["value"],$s={key:6,class:"pd-hint"},Ts={key:7,class:"pd-field"},Ds=["value"],Ms={key:8,class:"pd-hint"},Ps={key:9,class:"pd-field"},zs=["value"],Ls={key:10,class:"pd-field"},Rs={key:11,class:"pd-field"},As={class:"pd-field"},Is=["value"],Fs={class:"pd-field"},Us={class:"pd-radio-group",role:"radiogroup"},Hs={class:"pd-radio"},Os=["checked"],Ws={class:"pd-radio"},Gs=["checked"],Ks={class:"pd-radio"},qs=["checked"],Ys={class:"pd-field"},js={class:"pd-radio-group",role:"radiogroup"},Xs={class:"pd-radio"},Zs=["checked"],Js={class:"pd-radio"},Qs=["checked"],_s={class:"pd-radio"},er=["checked"],tr={class:"cell-style-grid"},or={class:"pd-field cell-font-field"},nr={class:"pd-field"},lr={class:"pd-field"},ar=["checked"],ir={class:"pd-field"},sr={class:"pd-field"},rr={class:"border-style-row"},dr={style:{width:"112px","flex-shrink":"0"}},cr={class:"pd-button-group border-presets"},ur={class:"pd-checkbox-group"},mr={class:"pd-checkbox"},pr={class:"pd-checkbox"},vr={class:"pd-checkbox"},fr={class:"pd-checkbox"},gr={class:"pd-field"},hr={class:"pd-field"},br=["checked"],Er={key:12,class:"pd-field"},yr=["value"],kr={key:13,class:"pd-field"},Vr={class:"merge-btns"},Nr=["disabled","title"],wr=["disabled"],Cr=e.defineComponent({__name:"TableCellGroup",props:{element:{},selection:{},fields:{}},setup(o,{expose:i}){const t=o,n=e.inject(Oe),l=e.computed(()=>t.element.options.tableRows),d=e.computed(()=>{const J=h.findMainCell(l.value,t.selection.r1,t.selection.c1);return l.value[J.r].cells[J.c]}),s=e.ref(!1),a=e.ref(""),r=e.computed(()=>d.value.cellType==="barcode"),u=e.computed(()=>d.value.cellType==="qrcode"),m=e.computed(()=>d.value.cellType==="image"),g=e.computed(()=>r.value&&!!d.value.printerDpi),k=e.computed(()=>!r.value&&!u.value&&!m.value),y=e.computed(()=>h.resolveCellTextFit(d.value));function R(J){const c=J.target.value;H(N=>{N.textFit=c})}function C(J){H(c=>{c.align=J})}function v(J){H(c=>{c.valign=J})}function f(J){const c=Number(J);H(N=>{N.printerDpi=c>0?c:void 0})}function M(J){H(c=>{c.cellType=J==="text"?void 0:J,J!=="barcode"&&(c.barcodeType=void 0,c.showBarcodeText=void 0,c.printerDpi=void 0),J!=="qrcode"&&(c.qrCodeLevel=void 0)})}function j(){a.value=d.value.formatter||"",s.value=!0}function ne(J){H(c=>{c.formatter=J||void 0})}function H(J){const c=t.selection;for(let N=c.r1;N<=c.r2;N++)for(let W=c.c1;W<=c.c2;W++){const he=l.value[N].cells[W];he.merged||J(he)}n.recordHistory()}const K=e.ref("solid"),b=e.ref(.75),B=e.ref("#333333"),S=e.ref([]);function x(){return{width:b.value,style:K.value,color:B.value}}function T(J){h.applyBorderPreset(l.value,t.selection,J,x()),n.recordHistory()}function X(J){const c=J.target,N=new Set(S.value);c.checked?N.add(c.value):N.delete(c.value),S.value=[...N];const W=x();H(he=>{const pe={...he.borders??{}};for(const ce of["top","right","bottom","left"])N.has(ce)?pe[ce]={...W}:delete pe[ce];he.borders=pe})}const ee=e.computed(()=>h.canMergeReason(l.value,t.selection)),le=e.computed(()=>{const J=t.selection;for(let c=J.r1;c<=J.r2;c++)for(let N=J.c1;N<=J.c2;N++){const W=l.value[c].cells[N];if(!W.merged&&((W.rowspan??1)>1||(W.colspan??1)>1))return!0}return!1});function ie(){h.mergeCells(l.value,t.selection),n.recordHistory()}function ue(){h.splitCells(l.value,t.selection),n.recordHistory()}return i({openFormatterEditor:j}),(J,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ce,{title:"单元格",icon:"Menu","default-expanded":"","group-key":"table-cell"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:c[43]||(c[43]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",cs,[c[49]||(c[49]=e.createElementVNode("span",{class:"pd-label"},"单元格类型",-1)),e.createElementVNode("div",us,[e.createElementVNode("label",ms,[e.createElementVNode("input",{type:"radio",value:"text",checked:(d.value.cellType||"text")==="text",onChange:c[0]||(c[0]=N=>M(N.target.value))},null,40,ps),c[45]||(c[45]=e.createElementVNode("span",null,"文本",-1))]),e.createElementVNode("label",vs,[e.createElementVNode("input",{type:"radio",value:"barcode",checked:d.value.cellType==="barcode",onChange:c[1]||(c[1]=N=>M(N.target.value))},null,40,fs),c[46]||(c[46]=e.createElementVNode("span",null,"条形码",-1))]),e.createElementVNode("label",gs,[e.createElementVNode("input",{type:"radio",value:"qrcode",checked:d.value.cellType==="qrcode",onChange:c[2]||(c[2]=N=>M(N.target.value))},null,40,hs),c[47]||(c[47]=e.createElementVNode("span",null,"二维码",-1))]),e.createElementVNode("label",bs,[e.createElementVNode("input",{type:"radio",value:"image",checked:d.value.cellType==="image",onChange:c[3]||(c[3]=N=>M(N.target.value))},null,40,Es),c[48]||(c[48]=e.createElementVNode("span",null,"图片",-1))])])]),r.value?(e.openBlock(),e.createElementBlock("div",ys,[c[51]||(c[51]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{value:d.value.barcodeType||"CODE128",class:"pd-select",onChange:c[4]||(c[4]=N=>H(W=>{W.barcodeType=N.target.value||void 0}))},[...c[50]||(c[50]=[e.createElementVNode("option",{value:"CODE128"},"CODE128(通用)",-1),e.createElementVNode("option",{value:"EAN13"},"EAN13(商品码)",-1),e.createElementVNode("option",{value:"EAN8"},"EAN8",-1),e.createElementVNode("option",{value:"UPC"},"UPC",-1),e.createElementVNode("option",{value:"CODE39"},"CODE39",-1),e.createElementVNode("option",{value:"ITF14"},"ITF14",-1)])],40,ks)])):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("div",Vs,[c[52]||(c[52]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:d.value.showBarcodeText!==!1,type:"checkbox",class:"pd-switch",onInput:c[5]||(c[5]=N=>H(W=>{W.showBarcodeText=!!N.target.checked}))},null,40,Ns)])):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("div",ws,[c[53]||(c[53]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(se,{"model-value":d.value.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":c[6]||(c[6]=N=>H(W=>{W.barWidth=N}))},null,8,["model-value"])])):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("p",Cs,e.toDisplayString(g.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),单元格放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),1)):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("div",Ss,[c[54]||(c[54]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(se,{"model-value":d.value.barFontSize??10,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":c[7]||(c[7]=N=>H(W=>{W.barFontSize=N??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("div",Bs,[c[56]||(c[56]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{value:d.value.printerDpi?String(d.value.printerDpi):"",class:"pd-select",onChange:c[8]||(c[8]=N=>f(N.target.value))},[...c[55]||(c[55]=[e.createElementVNode("option",{value:""},"不指定(按条宽渲染)",-1),e.createElementVNode("option",{value:"203"},"203 dpi(8 点/mm)",-1),e.createElementVNode("option",{value:"300"},"300 dpi(11.8 点/mm)",-1),e.createElementVNode("option",{value:"600"},"600 dpi(23.6 点/mm)",-1)])],40,xs)])):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("p",$s,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小")):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",Ts,[c[58]||(c[58]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{value:d.value.qrCodeLevel||"M",class:"pd-select",onChange:c[9]||(c[9]=N=>H(W=>{W.qrCodeLevel=N.target.value||void 0}))},[...c[57]||(c[57]=[e.createElementVNode("option",{value:"L"},"L(最低,容量大)",-1),e.createElementVNode("option",{value:"M"},"M(推荐)",-1),e.createElementVNode("option",{value:"Q"},"Q",-1),e.createElementVNode("option",{value:"H"},"H(最高)",-1)])],40,Ds)])):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("p",Ms,"单元格条码尺寸由「条宽」与「打印机分辨率」结算:可用宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),u.value||m.value?(e.openBlock(),e.createElementBlock("div",Ps,[c[60]||(c[60]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{value:d.value.fit||"contain",class:"pd-select",onChange:c[10]||(c[10]=N=>H(W=>{W.fit=N.target.value}))},[...c[59]||(c[59]=[e.createElementVNode("option",{value:"contain"},"包含(保持比例)",-1),e.createElementVNode("option",{value:"cover"},"覆盖(保持比例)",-1),e.createElementVNode("option",{value:"fill"},"拉伸填满",-1),e.createElementVNode("option",{value:"none"},"原始尺寸",-1),e.createElementVNode("option",{value:"scale-down"},"缩小(保持比例)",-1)])],40,zs)])):e.createCommentVNode("",!0),r.value||u.value||m.value?(e.openBlock(),e.createElementBlock("div",Ls,[c[61]||(c[61]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(se,{"model-value":d.value.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":c[11]||(c[11]=N=>H(W=>{W.maxWidth=N??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),r.value||u.value||m.value?(e.openBlock(),e.createElementBlock("div",Rs,[c[62]||(c[62]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(se,{"model-value":d.value.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":c[12]||(c[12]=N=>H(W=>{W.maxHeight=N??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",As,[c[63]||(c[63]=e.createElementVNode("span",{class:"pd-label"},"内容",-1)),e.createElementVNode("input",{value:d.value.formatter||"",class:"pd-input",placeholder:"输入内容,支持 {字段} 表达式",onInput:c[13]||(c[13]=N=>H(W=>{W.formatter=N.target.value||void 0})),onDblclick:j},null,40,Is)]),e.createElementVNode("div",Fs,[c[67]||(c[67]=e.createElementVNode("span",{class:"pd-label"},"水平对齐",-1)),e.createElementVNode("div",Us,[e.createElementVNode("label",Hs,[e.createElementVNode("input",{type:"radio",value:"left",checked:d.value.align==="left",onChange:c[14]||(c[14]=N=>C(N.target.value))},null,40,Os),c[64]||(c[64]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",Ws,[e.createElementVNode("input",{type:"radio",value:"center",checked:d.value.align==="center",onChange:c[15]||(c[15]=N=>C(N.target.value))},null,40,Gs),c[65]||(c[65]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Ks,[e.createElementVNode("input",{type:"radio",value:"right",checked:d.value.align==="right",onChange:c[16]||(c[16]=N=>C(N.target.value))},null,40,qs),c[66]||(c[66]=e.createElementVNode("span",null,"右",-1))])])]),e.createElementVNode("div",Ys,[c[71]||(c[71]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",js,[e.createElementVNode("label",Xs,[e.createElementVNode("input",{type:"radio",value:"top",checked:d.value.valign==="top",onChange:c[17]||(c[17]=N=>v(N.target.value))},null,40,Zs),c[68]||(c[68]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",Js,[e.createElementVNode("input",{type:"radio",value:"middle",checked:d.value.valign==="middle",onChange:c[18]||(c[18]=N=>v(N.target.value))},null,40,Qs),c[69]||(c[69]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",_s,[e.createElementVNode("input",{type:"radio",value:"bottom",checked:d.value.valign==="bottom",onChange:c[19]||(c[19]=N=>v(N.target.value))},null,40,er),c[70]||(c[70]=e.createElementVNode("span",null,"下",-1))])])]),e.createElementVNode("div",tr,[e.createElementVNode("div",or,[c[72]||(c[72]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(Dt,{"model-value":d.value.fontFamily,placeholder:"继承默认","onUpdate:modelValue":c[20]||(c[20]=N=>H(W=>{W.fontFamily=N}))},null,8,["model-value"])]),e.createElementVNode("div",nr,[c[73]||(c[73]=e.createElementVNode("span",{class:"pd-label"},"字号 (pt)",-1)),e.createVNode(se,{"model-value":d.value.fontSize,min:5,max:72,placeholder:"默认","onUpdate:modelValue":c[21]||(c[21]=N=>H(W=>{W.fontSize=N??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",lr,[c[74]||(c[74]=e.createElementVNode("span",{class:"pd-label"},"加粗",-1)),e.createElementVNode("input",{checked:d.value.fontWeight==="bold",type:"checkbox",class:"pd-switch",onInput:c[22]||(c[22]=N=>H(W=>{W.fontWeight=N.target.checked?"bold":void 0}))},null,40,ar)]),e.createElementVNode("div",ir,[c[75]||(c[75]=e.createElementVNode("span",{class:"pd-label"},"文字颜色",-1)),e.createVNode(we,{"model-value":d.value.color,"onUpdate:modelValue":c[23]||(c[23]=N=>H(W=>{W.color=N}))},null,8,["model-value"])]),e.createElementVNode("div",sr,[c[76]||(c[76]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(we,{"model-value":d.value.backgroundColor,"onUpdate:modelValue":c[24]||(c[24]=N=>H(W=>{W.backgroundColor=N}))},null,8,["model-value"])])]),c[87]||(c[87]=e.createElementVNode("h3",{class:"pd-divider"},"边框",-1)),e.createElementVNode("div",rr,[e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":c[25]||(c[25]=N=>K.value=N),style:{width:"90px"}},[...c[77]||(c[77]=[e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1),e.createElementVNode("option",{value:"double"},"双线",-1)])],512),[[e.vModelSelect,K.value]]),e.createElementVNode("div",dr,[e.createVNode(se,{modelValue:b.value,"onUpdate:modelValue":c[26]||(c[26]=N=>b.value=N),min:.25,max:5,step:.25},null,8,["modelValue"])]),e.createVNode(we,{modelValue:B.value,"onUpdate:modelValue":c[27]||(c[27]=N=>B.value=N),clearable:!1},null,8,["modelValue"])]),e.createElementVNode("div",cr,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:c[28]||(c[28]=N=>T("all"))},"全部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:c[29]||(c[29]=N=>T("outer"))},"外侧"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:c[30]||(c[30]=N=>T("inner"))},"内部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:c[31]||(c[31]=N=>T("none"))},"无")]),e.createElementVNode("div",ur,[e.createElementVNode("label",mr,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c[32]||(c[32]=N=>S.value=N),value:"top",onChange:c[33]||(c[33]=N=>X(N))},null,544),[[e.vModelCheckbox,S.value]]),c[78]||(c[78]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",pr,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c[34]||(c[34]=N=>S.value=N),value:"right",onChange:c[35]||(c[35]=N=>X(N))},null,544),[[e.vModelCheckbox,S.value]]),c[79]||(c[79]=e.createElementVNode("span",null,"右",-1))]),e.createElementVNode("label",vr,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c[36]||(c[36]=N=>S.value=N),value:"bottom",onChange:c[37]||(c[37]=N=>X(N))},null,544),[[e.vModelCheckbox,S.value]]),c[80]||(c[80]=e.createElementVNode("span",null,"下",-1))]),e.createElementVNode("label",fr,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c[38]||(c[38]=N=>S.value=N),value:"left",onChange:c[39]||(c[39]=N=>X(N))},null,544),[[e.vModelCheckbox,S.value]]),c[81]||(c[81]=e.createElementVNode("span",null,"左",-1))])]),e.createElementVNode("div",gr,[c[82]||(c[82]=e.createElementVNode("span",{class:"pd-label"},"内边距 (mm)",-1)),e.createVNode(se,{"model-value":d.value.padding,min:0,max:10,step:.5,placeholder:"默认","onUpdate:modelValue":c[40]||(c[40]=N=>H(W=>{W.padding=N??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",hr,[c[83]||(c[83]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:d.value.wordWrap??!0,type:"checkbox",class:"pd-switch",onInput:c[41]||(c[41]=N=>H(W=>{W.wordWrap=!!N.target.checked}))},null,40,br)]),k.value?(e.openBlock(),e.createElementBlock("div",Er,[c[85]||(c[85]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:y.value,style:{width:"100%"},onChange:R},[...c[84]||(c[84]=[e.createElementVNode("option",{value:"clip"},"截断",-1),e.createElementVNode("option",{value:"shrink"},"自动缩小",-1),e.createElementVNode("option",{value:"autoHeight"},"自适应行高",-1)])],40,yr)])):e.createCommentVNode("",!0),k.value&&y.value==="shrink"?(e.openBlock(),e.createElementBlock("div",kr,[c[86]||(c[86]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(se,{"model-value":d.value.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":c[42]||(c[42]=N=>H(W=>{W.shrinkMinFontSize=N??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Vr,[e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!!ee.value,title:ee.value||"",onClick:ie}," 合并单元格 ",8,Nr),e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!le.value,onClick:ue},"拆分单元格",8,wr)])],32)]),_:1}),e.createVNode(Je,{modelValue:s.value,"onUpdate:modelValue":c[44]||(c[44]=N=>s.value=N),fields:o.fields,expression:a.value,"onUpdate:expression":ne},null,8,["modelValue","fields","expression"])],64))}}),Sr=re(Cr,[["__scopeId","data-v-8a66df60"]]),Br={class:"watermark-config"},xr={class:"pd-field"},$r={key:0,class:"pd-field"},Tr={class:"pd-field"},Dr={class:"pd-hint"},Mr={class:"pd-field"},Pr={class:"pd-field"},zr={class:"pd-hint"},Lr={class:"pd-field"},Rr=["value"],Ar={class:"pd-field"},Ir=["min"],Fr={class:"pd-field"},Ur=["min"],Hr=e.defineComponent({__name:"WatermarkConfig",props:{modelValue:{},fields:{}},emits:["update:modelValue"],setup(o,{emit:i}){const t=o,n=i,l=ge.WATERMARK_DENSITY_PRESETS,d=ge.WATERMARK_DEFAULTS.minTileWidth,s=ge.WATERMARK_DEFAULTS.minTileHeight;function a(K){const b=K.trim();return b?/[{}]/.test(b)||/^[A-Za-z_$][\w$]*\s*\(/.test(b)?!0:/^[A-Za-z_$][\w$]*(\.[\w$]+)+$/.test(b):!1}function r(K){return K?K.mode==="binding"?K.binding??"":K.content??"":""}const u=e.ref(r(t.modelValue)),m=e.ref(t.modelValue?.testData||""),g=e.ref(!1),k=e.ref(t.modelValue?.mode==="binding"?"binding":"fixed"),y=e.reactive({rotate:t.modelValue?.rotate??ge.WATERMARK_DEFAULTS.rotate,color:t.modelValue?.color||ge.WATERMARK_DEFAULTS.color,opacity:t.modelValue?.opacity??ge.WATERMARK_DEFAULTS.opacity,tileWidth:t.modelValue?.tileWidth??ge.WATERMARK_DEFAULTS.tileWidth,tileHeight:t.modelValue?.tileHeight??ge.WATERMARK_DEFAULTS.tileHeight}),R=e.computed(()=>k.value==="binding");e.watch(()=>t.modelValue,K=>{K&&(u.value=r(K),k.value=K.mode==="binding"?"binding":"fixed",m.value=K.testData||"",y.rotate=K.rotate??ge.WATERMARK_DEFAULTS.rotate,y.color=K.color||ge.WATERMARK_DEFAULTS.color,y.opacity=K.opacity??ge.WATERMARK_DEFAULTS.opacity,y.tileWidth=K.tileWidth??ge.WATERMARK_DEFAULTS.tileWidth,y.tileHeight=K.tileHeight??ge.WATERMARK_DEFAULTS.tileHeight)},{deep:!0});const C=e.computed({get(){const{tileWidth:K,tileHeight:b}=y;for(const[B,S]of Object.entries(l))if(K===S.width&&b===S.height)return B;return"custom"},set(K){const b=l[K];b&&(y.tileWidth=b.width,y.tileHeight=b.height)}});function v(){k.value=a(u.value)?"binding":"fixed",H()}function f(){v()}function M(){g.value=!0}function j(K){u.value=K,v()}function ne(K){y.color=K,H()}function H(){const K={testData:m.value,rotate:y.rotate,color:y.color,opacity:y.opacity,tileWidth:y.tileWidth,tileHeight:y.tileHeight};n("update:modelValue",k.value==="binding"?{...K,mode:"binding",binding:u.value,content:""}:{...K,mode:"fixed",content:u.value,binding:""})}return(K,b)=>(e.openBlock(),e.createElementBlock("div",Br,[b[18]||(b[18]=e.createElementVNode("h3",{class:"pd-divider"},"水印",-1)),e.createElementVNode("form",{class:"pd-form",onSubmit:b[8]||(b[8]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",xr,[b[9]||(b[9]=e.createElementVNode("span",{class:"pd-label"},"水印表达式",-1)),e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":b[0]||(b[0]=B=>u.value=B),placeholder:"直接输入文字,或用表达式:{order.no}、{printDate}",title:"双击或点「编辑表达式」打开表达式弹框",onInput:f,onDblclick:M},null,544),[[e.vModelText,u.value]]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:M},"编辑表达式")]),R.value?(e.openBlock(),e.createElementBlock("div",$r,[b[10]||(b[10]=e.createElementVNode("span",{class:"pd-label"},"测试值",-1)),e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":b[1]||(b[1]=B=>m.value=B),placeholder:"表达式取不到值时预览显示",onInput:H},null,544),[[e.vModelText,m.value]])])):e.createCommentVNode("",!0),e.createVNode(Je,{modelValue:g.value,"onUpdate:modelValue":b[2]||(b[2]=B=>g.value=B),fields:o.fields,expression:u.value,"onUpdate:expression":j},null,8,["modelValue","fields","expression"]),e.createElementVNode("div",Tr,[b[11]||(b[11]=e.createElementVNode("span",{class:"pd-label"},"旋转角度",-1)),e.withDirectives(e.createElementVNode("input",{type:"range",class:"pd-range","onUpdate:modelValue":b[3]||(b[3]=B=>y.rotate=B),min:-90,max:90,step:5,onChange:H},null,544),[[e.vModelText,y.rotate,void 0,{number:!0}]]),e.createElementVNode("span",Dr,e.toDisplayString(y.rotate)+"°",1)]),e.createElementVNode("div",Mr,[b[12]||(b[12]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(we,{"model-value":y.color,"onUpdate:modelValue":ne},null,8,["model-value"])]),e.createElementVNode("div",Pr,[b[13]||(b[13]=e.createElementVNode("span",{class:"pd-label"},"透明度",-1)),e.withDirectives(e.createElementVNode("input",{type:"range",class:"pd-range","onUpdate:modelValue":b[4]||(b[4]=B=>y.opacity=B),min:.05,max:.5,step:.05,onChange:H},null,544),[[e.vModelText,y.opacity,void 0,{number:!0}]]),e.createElementVNode("span",zr,e.toDisplayString(y.opacity.toFixed(2)),1)]),e.createElementVNode("div",Lr,[b[15]||(b[15]=e.createElementVNode("span",{class:"pd-label"},"密度",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":b[5]||(b[5]=B=>C.value=B),style:{width:"100%"},onChange:H},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),(B,S)=>(e.openBlock(),e.createElementBlock("option",{key:S,value:S},e.toDisplayString(B.label)+"("+e.toDisplayString(B.width)+"×"+e.toDisplayString(B.height)+")",9,Rr))),128)),b[14]||(b[14]=e.createElementVNode("option",{value:"custom"},"自定义",-1))],544),[[e.vModelSelect,C.value]])]),C.value==="custom"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Ar,[b[16]||(b[16]=e.createElementVNode("span",{class:"pd-label"},"瓦片宽",-1)),e.withDirectives(e.createElementVNode("input",{type:"number",class:"pd-input","onUpdate:modelValue":b[6]||(b[6]=B=>y.tileWidth=B),min:e.unref(d),step:10,onChange:H},null,40,Ir),[[e.vModelText,y.tileWidth,void 0,{number:!0}]])]),e.createElementVNode("div",Fr,[b[17]||(b[17]=e.createElementVNode("span",{class:"pd-label"},"瓦片高",-1)),e.withDirectives(e.createElementVNode("input",{type:"number",class:"pd-input","onUpdate:modelValue":b[7]||(b[7]=B=>y.tileHeight=B),min:e.unref(s),step:10,onChange:H},null,40,Ur),[[e.vModelText,y.tileHeight,void 0,{number:!0}]])])],64)):e.createCommentVNode("",!0)],32)]))}}),Or=re(Hr,[["__scopeId","data-v-b55bfc50"]]),Wr={class:"design-background-config"},Gr=["title"],Kr={class:"design-background-actions"},qr=["disabled"],Yr=e.defineComponent({__name:"DesignBackgroundConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(o,{emit:i}){const t=o,n=i,l=e.ref(!1),d=e.inject(ct,e.computed(()=>{})),s=e.computed(()=>l.value||!d.value),a=e.computed(()=>t.modelValue?.rotation??0);async function r(g){const k=g.target,y=k.files?.[0];if(y){if(!y.type.startsWith("image/")){alert("仅支持上传图片文件"),k.value="";return}if(!d.value){alert("设计背景上传能力未配置"),k.value="";return}l.value=!0;try{const R=await d.value(y);R?n("update:modelValue",{src:R,rotation:0}):alert("设计背景上传失败")}catch(R){alert(R instanceof Error?R.message:"设计背景上传失败")}finally{l.value=!1,k.value=""}}}function u(){if(!t.modelValue?.src)return;const g=(a.value+90)%360;n("update:modelValue",{src:t.modelValue.src,rotation:g})}function m(){n("update:modelValue",void 0)}return(g,k)=>(e.openBlock(),e.createElementBlock("div",Wr,[k[0]||(k[0]=e.createElementVNode("h3",{class:"pd-divider"},"设计背景",-1)),k[1]||(k[1]=e.createElementVNode("p",{class:"design-background-tip"},"仅设计器显示,用于套打定位,不会出现在预览和打印中",-1)),o.modelValue?.src?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"design-background-path",title:o.modelValue.src},e.toDisplayString(o.modelValue.src),9,Gr),e.createElementVNode("div",Kr,[e.createElementVNode("button",{type:"button",class:"pd-button small rotate-btn",onClick:u}," 旋转("+e.toDisplayString(a.value)+"°) ",1),e.createElementVNode("button",{type:"button",class:"pd-button small remove-btn",onClick:m},"移除")])],64)):(e.openBlock(),e.createElementBlock("label",{key:1,class:e.normalizeClass(["pd-button small upload-label",{disabled:s.value}])},[e.createTextVNode(e.toDisplayString(l.value?"上传中...":"上传背景图")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:s.value,onChange:r},null,40,qr)],2))]))}}),jr=re(Yr,[["__scopeId","data-v-3f4d2e32"]]),Xr={class:"tiling-config","data-test":"tiling-config"},Zr={class:"pd-field"},Jr={class:"tiling-switch"},Qr=["checked","disabled"],_r={key:0,class:"pd-hint tiling-error"},ed={class:"pd-field"},td=["value"],od=["value"],nd={key:0,class:"pd-field"},ld={class:"custom-size-grid"},ad={key:1,class:"pd-field"},id={class:"pd-radio-group",role:"radiogroup"},sd={class:"pd-radio"},rd=["checked"],dd={class:"pd-radio"},cd=["checked"],ud={class:"margin-grid"},md={class:"pd-field"},pd={class:"pd-field"},vd={class:"pd-field"},fd={class:"pd-field"},gd={class:"pd-field"},hd={class:"pd-field"},bd={class:"pd-field"},Ed={key:2,class:"pd-hint tiling-summary"},yd=e.defineComponent({__name:"TilingConfig",props:{modelValue:{},templateData:{}},emits:["update:modelValue"],setup(o,{emit:i}){const t=o,n=i,l=Object.keys(h.PAPER_PRESETS).filter(v=>v!=="CUSTOM"&&!h.PAPER_PRESETS[v]?.continuous),d=e.computed(()=>h.isContinuousPaperSize(t.templateData?.paperSize)),s=e.computed(()=>({...ge.TILE_DEFAULTS,...t.modelValue??{},enabled:t.modelValue?.enabled??!1,sheetMargin:{...ge.TILE_DEFAULTS.sheetMargin,...t.modelValue?.sheetMargin??{}}})),a=e.computed(()=>t.templateData?{...t.templateData,tiling:s.value}:void 0),r=e.computed(()=>a.value?ge.validateTiling(a.value):[]),u=e.computed(()=>{const v=a.value;return v?Math.max(ge.computeMaxColumns(v),1):1}),m=e.computed(()=>{const v=a.value;if(!(!v||r.value.length))try{return ge.computeTileLayout(v)}catch{return}}),g=e.computed(()=>{const v=m.value,f=a.value;if(!v||!f)return"";const M=ge.resolveSheetMm(f),j=s.value.sheetPaperSize==="CUSTOM"?"自定义":s.value.sheetPaperSize??"A4",ne=s.value.sheetPaperSize==="CUSTOM"?"":s.value.sheetOrientation==="landscape"?" 横向":" 纵向";return`目标纸 ${j}${ne} ${M.width}×${M.height}mm · ${v.columns} 列 × ${v.rows} 行 = 每张 ${v.perSheet} 格`});function k(v){n("update:modelValue",{...s.value,...v})}function y(v,f){k({sheetMargin:{...s.value.sheetMargin,[v]:f??0}})}function R(v){if(v!=="CUSTOM"){k({sheetPaperSize:v});return}const f=a.value,M=f?ge.resolveSheetMm(f):{width:210,height:297};k({sheetPaperSize:"CUSTOM",sheetCustomWidth:s.value.sheetCustomWidth??M.width,sheetCustomHeight:s.value.sheetCustomHeight??M.height})}function C(v){if(!v){k({enabled:!1});return}const f=u.value,M=f>=1?Math.min(ge.TILE_DEFAULTS.columns,f):1;k({...ge.TILE_DEFAULTS,columns:M})}return(v,f)=>(e.openBlock(),e.createElementBlock("div",Xr,[f[30]||(f[30]=e.createElementVNode("h3",{class:"pd-divider"},"拼版打印",-1)),f[31]||(f[31]=e.createElementVNode("p",{class:"pd-hint"},"把标签按「列 × 行」铺到一张大纸上批量打印",-1)),e.createElementVNode("div",Zr,[e.createElementVNode("label",Jr,[e.createElementVNode("input",{type:"checkbox",checked:s.value.enabled,disabled:d.value,onChange:f[0]||(f[0]=M=>C(M.target.checked))},null,40,Qr),f[13]||(f[13]=e.createElementVNode("span",null,"启用拼版",-1))]),d.value?(e.openBlock(),e.createElementBlock("p",_r,"连续纸不支持拼版")):e.createCommentVNode("",!0)]),s.value.enabled&&!d.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",ed,[f[15]||(f[15]=e.createElementVNode("span",{class:"pd-label"},"目标纸张",-1)),e.createElementVNode("select",{class:"pd-select",style:{width:"100%"},value:s.value.sheetPaperSize??"A4",onChange:f[1]||(f[1]=M=>R(M.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),M=>(e.openBlock(),e.createElementBlock("option",{key:M,value:M},e.toDisplayString(e.unref(h.PAPER_PRESETS)[M]?.label??M),9,od))),128)),f[14]||(f[14]=e.createElementVNode("option",{value:"CUSTOM"},"自定义",-1))],40,td)]),s.value.sheetPaperSize==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",nd,[f[17]||(f[17]=e.createElementVNode("span",{class:"pd-label"},"目标纸宽高 (mm)",-1)),e.createElementVNode("div",ld,[e.createVNode(se,{"model-value":s.value.sheetCustomWidth,min:25,max:2e3,"onUpdate:modelValue":f[2]||(f[2]=M=>k({sheetCustomWidth:M}))},null,8,["model-value"]),f[16]||(f[16]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(se,{"model-value":s.value.sheetCustomHeight,min:25,max:2e3,"onUpdate:modelValue":f[3]||(f[3]=M=>k({sheetCustomHeight:M}))},null,8,["model-value"])])])):(e.openBlock(),e.createElementBlock("div",ad,[f[20]||(f[20]=e.createElementVNode("span",{class:"pd-label"},"目标纸方向",-1)),e.createElementVNode("div",id,[e.createElementVNode("label",sd,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:(s.value.sheetOrientation??"portrait")==="portrait",onChange:f[4]||(f[4]=M=>k({sheetOrientation:"portrait"}))},null,40,rd),f[18]||(f[18]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",dd,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:s.value.sheetOrientation==="landscape",onChange:f[5]||(f[5]=M=>k({sheetOrientation:"landscape"}))},null,40,cd),f[19]||(f[19]=e.createElementVNode("span",null,"横向",-1))])])])),f[28]||(f[28]=e.createElementVNode("h3",{class:"pd-divider"},"拼版留白 (mm)",-1)),e.createElementVNode("div",ud,[e.createElementVNode("div",md,[f[21]||(f[21]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(se,{"model-value":s.value.sheetMargin.top,min:0,max:100,"onUpdate:modelValue":f[6]||(f[6]=M=>y("top",M))},null,8,["model-value"])]),e.createElementVNode("div",pd,[f[22]||(f[22]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(se,{"model-value":s.value.sheetMargin.bottom,min:0,max:100,"onUpdate:modelValue":f[7]||(f[7]=M=>y("bottom",M))},null,8,["model-value"])]),e.createElementVNode("div",vd,[f[23]||(f[23]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(se,{"model-value":s.value.sheetMargin.left,min:0,max:100,"onUpdate:modelValue":f[8]||(f[8]=M=>y("left",M))},null,8,["model-value"])]),e.createElementVNode("div",fd,[f[24]||(f[24]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(se,{"model-value":s.value.sheetMargin.right,min:0,max:100,"onUpdate:modelValue":f[9]||(f[9]=M=>y("right",M))},null,8,["model-value"])])]),f[29]||(f[29]=e.createElementVNode("h3",{class:"pd-divider"},"格间距与列数",-1)),e.createElementVNode("div",gd,[f[25]||(f[25]=e.createElementVNode("span",{class:"pd-label"},"横向间距",-1)),e.createVNode(se,{"model-value":s.value.gapX,min:0,max:50,"onUpdate:modelValue":f[10]||(f[10]=M=>k({gapX:M??0}))},null,8,["model-value"])]),e.createElementVNode("div",hd,[f[26]||(f[26]=e.createElementVNode("span",{class:"pd-label"},"纵向间距",-1)),e.createVNode(se,{"model-value":s.value.gapY,min:0,max:50,"onUpdate:modelValue":f[11]||(f[11]=M=>k({gapY:M??0}))},null,8,["model-value"])]),e.createElementVNode("div",bd,[f[27]||(f[27]=e.createElementVNode("span",{class:"pd-label"},"列数",-1)),e.createVNode(se,{"model-value":s.value.columns,min:1,max:u.value,"onUpdate:modelValue":f[12]||(f[12]=M=>k({columns:M??1}))},null,8,["model-value","max"])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,M=>(e.openBlock(),e.createElementBlock("p",{key:M.code,class:"pd-hint tiling-error"},e.toDisplayString(M.message),1))),128)),!r.value.length&&g.value?(e.openBlock(),e.createElementBlock("p",Ed,e.toDisplayString(g.value),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]))}}),kd=re(yd,[["__scopeId","data-v-aa278268"]]),Vd={key:0,class:"prop-collapsed"},Nd={class:"prop-head"},wd={class:"pd-tabs prop-tabs"},Cd={class:"pd-tab-bar",role:"tablist"},Sd={class:"pd-tab-pane",role:"tabpanel"},Bd={class:"property-content"},xd={key:1,class:"pd-empty"},$d={class:"pd-tab-pane",role:"tabpanel"},Td={class:"pd-field"},Dd=["value"],Md=["label"],Pd=["value"],zd={key:0,class:"pd-hint"},Ld={key:1,class:"pd-field"},Rd={class:"pd-label"},Ad={class:"custom-size-grid"},Id={key:2,class:"pd-field"},Fd={class:"pd-radio-group",role:"radiogroup"},Ud={class:"pd-radio"},Hd=["checked"],Od={class:"pd-radio"},Wd=["checked"],Gd={key:3,class:"pd-field"},Kd={class:"pd-radio-group pd-radio-group--2col",role:"radiogroup"},qd={class:"pd-radio"},Yd=["checked"],jd={class:"pd-radio"},Xd=["checked"],Zd={class:"pd-radio"},Jd=["checked"],Qd={class:"pd-radio"},_d=["checked"],ec={class:"pd-field"},tc={class:"page-bg-row"},oc={key:5,class:"pd-hint"},nc={class:"margin-grid"},lc={class:"pd-field"},ac={class:"pd-field"},ic={class:"pd-field"},sc={class:"pd-field"},rc={class:"pd-field"},dc={class:"pd-field"},cc={class:"pd-field"},uc=e.defineComponent({__name:"PropertyPanel",props:{element:{},templateData:{},fields:{},activeTab:{},tableSelection:{},recordHistory:{type:Function},collapsed:{type:Boolean},multiPage:{type:Boolean}},emits:["delete-element","update:templateData","update:activeTab","toggle-collapse"],setup(o,{emit:i}){const t=o,n=i,l=e.computed(()=>{const A=[];for(const[D,Z]of Object.entries(h.PAPER_PRESETS)){if(t.multiPage&&h.isContinuousPaperSize(D))continue;const be=Z.group??"其他";let ke=A.find(Ve=>Ve.group===be);ke||(ke={group:be,items:[]},A.push(ke)),ke.items.push({key:D,label:Z.label??D})}return A}),d=e.ref(""),s=e.computed(()=>t.element?["text","longText"].includes(t.element.printElementType.type):!1),a=e.computed(()=>t.element?t.element.printElementType.type==="image":!1),r=e.computed(()=>t.element?["barcode","qrcode"].includes(t.element.printElementType.type):!1),u=e.computed(()=>!t.element||t.element.printElementType.type!=="table"?!1:!!t.tableSelection&&t.tableSelection.elementId===t.element.id),m=e.computed(()=>t.element?t.element.printElementType.type==="table":!1),g=e.computed(()=>h.searchProperties(d.value)),k=e.computed(()=>g.value.groups),y=e.computed(()=>g.value.itemKeys),R=e.computed(()=>!!d.value.trim()),C=e.computed(()=>{if(!t.element)return[];if(t.element.printElementType.type==="table"&&t.tableSelection){const{r1:A,c1:D}=t.tableSelection,Z=t.element.options.tableRows;if(Z&&Z[A]){const be=Z[A],ke=t.element.options.fields?.[0]?.dataSource;return h.getTableCellBindings(be.type,A,D,ke)}}return h.getElementBindings(t.element)});function v(A){return A.split(".").flatMap(D=>{const Z=D.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!Z)return[D];const be=Z[1],ke=[...Z[2].matchAll(/\[(\d+)\]/g)].map(Ve=>Number(Ve[1]));return[be,...ke]})}function f(A){return t.element?v(A).reduce((be,ke)=>be==null?"":be[ke],t.element)??"":""}function M(A,D){if(!t.element)return;const Z=v(A),be=Z.pop(),ke=Z.reduce((Ve,xe)=>((Ve[xe]===void 0||Ve[xe]===null)&&(Ve[xe]={}),Ve[xe]),t.element);ke[be]=D||void 0,t.recordHistory?.()}function j(A){d.value=A}function ne(A){t.element&&M("options.src",A)}const H=e.computed(()=>t.templateData?.paperSize||"A4"),K=e.computed(()=>!t.multiPage&&h.isContinuousPaperSize(H.value)),b=e.computed(()=>h.isLabelPaperSize(H.value)),B=e.computed(()=>t.templateData?.orientation||"portrait"),S=e.computed(()=>!!t.templateData?.tiling?.enabled),x=e.computed(()=>t.templateData?.outputRotation??0),T=e.computed({get:()=>t.templateData?.pageBackground||"#ffffff",set:A=>p(A)}),X=e.computed(()=>t.templateData?.margins.top??10),ee=e.computed(()=>t.templateData?.margins.bottom??10),le=e.computed(()=>t.templateData?.margins.left??10),ie=e.computed(()=>t.templateData?.margins.right??10),ue=e.computed(()=>t.templateData?.header.height??10),J=e.computed(()=>t.templateData?.footer.height??10),c=e.computed(()=>t.templateData?.firstPageOverlay.height??0),N=e.computed(()=>t.templateData?.customWidth??h.PAPER_PRESETS[H.value]?.width??210),W=e.computed(()=>t.templateData?.customHeight??297),he=e.computed(()=>t.templateData?.designBackground);function pe(A){if(t.templateData){if(!A){const D={...t.templateData};delete D.designBackground,n("update:templateData",D);return}z({designBackground:A})}}const ce=e.computed(()=>t.templateData?.watermark??{});function ve(A){z({watermark:A})}function z(A){if(!t.templateData)return;const D={...t.templateData,...A};n("update:templateData",D)}function V(A){if(t.templateData){if(h.isContinuousPaperSize(A)){z({paperSize:A,customWidth:A==="CONTINUOUS"?t.templateData?.customWidth??80:void 0,orientation:"portrait",margins:{...t.templateData.margins,bottom:t.templateData?.margins.bottom??0}});return}if(A==="CUSTOM"){z({paperSize:"CUSTOM"});return}if(h.PAPER_PRESETS[A]){if(h.isLabelPaperSize(A)){z({paperSize:A,...h.labelPaperDefaults(t.templateData)});return}z({paperSize:A})}}}function w(A){z({orientation:String(A)})}function F(A){z({outputRotation:Number(A)})}function p(A){const D=A&&A.toLowerCase()!=="#ffffff"&&A.toLowerCase()!=="#fff"?A:void 0;z(D===void 0?{pageBackground:void 0}:{pageBackground:D})}function E(){z({pageBackground:void 0})}function $(A){A!==void 0&&z({customWidth:A})}function Y(A){A!==void 0&&z({customHeight:A})}function Q(A){A!==void 0&&z({margins:{...t.templateData.margins,top:A}})}function oe(A){A!==void 0&&z({margins:{...t.templateData.margins,bottom:A}})}function me(A){A!==void 0&&z({margins:{...t.templateData.margins,left:A}})}function P(A){A!==void 0&&z({margins:{...t.templateData.margins,right:A}})}function I(A){A!==void 0&&z({header:{...t.templateData.header,height:A}})}function O(A){A!==void 0&&z({footer:{...t.templateData.footer,height:A}})}function _(A){A!==void 0&&z({firstPageOverlay:{...t.templateData.firstPageOverlay,height:A}})}const q=e.computed(()=>t.activeTab||"page");function fe(A){n("update:activeTab",A),n("toggle-collapse")}return(A,D)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-panel",{collapsed:o.collapsed}])},[o.collapsed?(e.openBlock(),e.createElementBlock("div",Vd,[e.createElementVNode("button",{class:"pc-btn",title:"展开属性台",onClick:D[0]||(D[0]=Z=>fe(q.value))},"«"),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:q.value==="element"}]),title:"元素属性",onClick:D[1]||(D[1]=Z=>fe("element"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:q.value==="page"}]),title:"页面属性",onClick:D[2]||(D[2]=Z=>fe("page"))},"▤",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Nd,[D[18]||(D[18]=e.createElementVNode("span",{class:"prop-title"},"属性台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起属性台",onClick:D[3]||(D[3]=Z=>A.$emit("toggle-collapse"))},"»")]),e.createElementVNode("div",wd,[e.createElementVNode("div",Cd,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(o.activeTab||"page")==="element"}]),onClick:D[4]||(D[4]=Z=>A.$emit("update:activeTab","element"))},"元素属性",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(o.activeTab||"page")==="page"}]),onClick:D[5]||(D[5]=Z=>A.$emit("update:activeTab","page"))},"页面属性",2)]),e.withDirectives(e.createElementVNode("div",Sd,[o.element?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(Vl,{onSearch:j}),e.createElementVNode("div",Bd,[k.value.includes("position-size")&&!u.value?(e.openBlock(),e.createBlock(Fl,{key:0,element:o.element,"matched-keys":y.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),k.value.includes("appearance")?(e.openBlock(),e.createBlock(Va,{key:1,element:o.element,"is-text-type":s.value,"matched-keys":y.value,searching:R.value},null,8,["element","is-text-type","matched-keys","searching"])):e.createCommentVNode("",!0),k.value.includes("code")&&r.value?(e.openBlock(),e.createBlock(Fa,{key:2,element:o.element,"matched-keys":y.value,searching:R.value,onChange:D[6]||(D[6]=Z=>o.recordHistory?.())},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),k.value.includes("binding")?(e.openBlock(),e.createBlock(Ce,{key:3,title:"内容",icon:"Document","default-expanded":"","group-key":"binding"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,Z=>(e.openBlock(),e.createBlock(wi,{key:Z.targetPath,descriptor:Z,fields:o.fields,"model-value":f(Z.targetPath),"onUpdate:modelValue":be=>M(Z.targetPath,be)},null,8,["descriptor","fields","model-value","onUpdate:modelValue"]))),128)),a.value?(e.openBlock(),e.createBlock(ns,{key:0,onSuccess:ne})):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),m.value&&o.tableSelection&&o.tableSelection.elementId===o.element.id?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createVNode(ds,{element:o.element,selection:o.tableSelection},null,8,["element","selection"]),e.createVNode(Sr,{element:o.element,selection:o.tableSelection,fields:o.fields},null,8,["element","selection","fields"])],64)):e.createCommentVNode("",!0),m.value&&k.value.includes("content")?(e.openBlock(),e.createBlock(zi,{key:5,element:o.element,fields:o.fields},null,8,["element","fields"])):e.createCommentVNode("",!0),k.value.includes("border-bg")?(e.openBlock(),e.createBlock(Ui,{key:6,element:o.element,"matched-keys":y.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),k.value.includes("pagination")&&m.value?(e.openBlock(),e.createBlock(Nt,{key:7,element:o.element,"matched-keys":y.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),k.value.includes("pagination")&&!m.value?(e.openBlock(),e.createBlock(Nt,{key:8,element:o.element,"matched-keys":y.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),k.value.includes("advanced")?(e.openBlock(),e.createBlock(Yi,{key:9,element:o.element,"matched-keys":y.value,searching:R.value,onDeleteElement:D[7]||(D[7]=Z=>A.$emit("delete-element"))},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0)])],64)):(e.openBlock(),e.createElementBlock("p",xd,"请在画布中选择一个元素"))],512),[[e.vShow,(o.activeTab||"page")==="element"]]),e.withDirectives(e.createElementVNode("div",$d,[e.createElementVNode("form",{class:"pd-form",onSubmit:D[17]||(D[17]=e.withModifiers(()=>{},["prevent"]))},[D[40]||(D[40]=e.createElementVNode("h3",{class:"pd-divider"},"纸张设置",-1)),e.createElementVNode("div",Td,[D[20]||(D[20]=e.createElementVNode("span",{class:"pd-label"},"纸张尺寸",-1)),e.createElementVNode("select",{value:H.value,class:"pd-select",onChange:D[8]||(D[8]=Z=>V(Z.target.value)),style:{width:"100%"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,Z=>(e.openBlock(),e.createElementBlock("optgroup",{key:Z.group,label:Z.group},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Z.items,be=>(e.openBlock(),e.createElementBlock("option",{key:be.key,value:be.key},e.toDisplayString(be.label),9,Pd))),128))],8,Md))),128)),D[19]||(D[19]=e.createElementVNode("option",{value:"CUSTOM"},"自定义宽高",-1))],40,Dd)]),b.value?(e.openBlock(),e.createElementBlock("p",zd,"标签纸默认整张给内容区:已取消页边距与页眉页脚,可在下方自行改回")):e.createCommentVNode("",!0),K.value||H.value==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",Ld,[e.createElementVNode("span",Rd,e.toDisplayString(K.value?"纸宽 (mm)":"自定义宽高 (mm)"),1),e.createElementVNode("div",Ad,[e.createVNode(se,{"model-value":N.value,min:25,max:2e3,"onUpdate:modelValue":$},null,8,["model-value"]),H.value==="CUSTOM"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[D[21]||(D[21]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(se,{"model-value":W.value,min:25,max:2e3,"onUpdate:modelValue":Y},null,8,["model-value"])],64)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),K.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Id,[D[24]||(D[24]=e.createElementVNode("span",{class:"pd-label"},"纸张方向",-1)),e.createElementVNode("div",Fd,[e.createElementVNode("label",Ud,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:B.value==="portrait",onChange:D[9]||(D[9]=Z=>w(Z.target.value))},null,40,Hd),D[22]||(D[22]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",Od,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:B.value==="landscape",onChange:D[10]||(D[10]=Z=>w(Z.target.value))},null,40,Wd),D[23]||(D[23]=e.createElementVNode("span",null,"横向",-1))])]),D[25]||(D[25]=e.createElementVNode("p",{class:"pd-hint"},"切换即交换纸张长宽(设计稿内容随之铺在该尺寸上)",-1))])),!K.value&&!S.value?(e.openBlock(),e.createElementBlock("div",Gd,[D[30]||(D[30]=e.createElementVNode("span",{class:"pd-label"},"内容旋转角度",-1)),e.createElementVNode("div",Kd,[e.createElementVNode("label",qd,[e.createElementVNode("input",{type:"radio",value:"0",checked:x.value===0,onChange:D[11]||(D[11]=Z=>F(Z.target.value))},null,40,Yd),D[26]||(D[26]=e.createElementVNode("span",null,"0°",-1))]),e.createElementVNode("label",jd,[e.createElementVNode("input",{type:"radio",value:"90",checked:x.value===90,onChange:D[12]||(D[12]=Z=>F(Z.target.value))},null,40,Xd),D[27]||(D[27]=e.createElementVNode("span",null,"90°",-1))]),e.createElementVNode("label",Zd,[e.createElementVNode("input",{type:"radio",value:"180",checked:x.value===180,onChange:D[13]||(D[13]=Z=>F(Z.target.value))},null,40,Jd),D[28]||(D[28]=e.createElementVNode("span",null,"180°",-1))]),e.createElementVNode("label",Qd,[e.createElementVNode("input",{type:"radio",value:"270",checked:x.value===270,onChange:D[14]||(D[14]=Z=>F(Z.target.value))},null,40,_d),D[29]||(D[29]=e.createElementVNode("span",null,"270°",-1))])]),D[31]||(D[31]=e.createElementVNode("p",{class:"pd-hint"},"整页内容旋转对应角度出纸;90°/270° 时纸张长宽互换以贴合内容,内容不变形不裁切;0° 为不旋转(默认)",-1))])):e.createCommentVNode("",!0),e.createElementVNode("div",ec,[D[32]||(D[32]=e.createElementVNode("span",{class:"pd-label"},"页面背景色",-1)),e.createElementVNode("div",tc,[e.createVNode(we,{modelValue:T.value,"onUpdate:modelValue":D[15]||(D[15]=Z=>T.value=Z),class:"page-bg-picker"},null,8,["modelValue"]),e.createElementVNode("button",{type:"button",class:"pd-reset",title:"恢复为默认白色",onClick:E},"默认")])]),e.createVNode(jr,{"model-value":he.value,"onUpdate:modelValue":pe},null,8,["model-value"]),o.multiPage?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(kd,{key:4,"model-value":o.templateData?.tiling,"template-data":o.templateData,"onUpdate:modelValue":D[16]||(D[16]=Z=>z({tiling:Z}))},null,8,["model-value","template-data"])),D[41]||(D[41]=e.createElementVNode("h3",{class:"pd-divider"},"页边距 (mm)",-1)),K.value?(e.openBlock(),e.createElementBlock("p",oc,"底部边距即连续纸走纸留白")):e.createCommentVNode("",!0),e.createElementVNode("div",nc,[e.createElementVNode("div",lc,[D[33]||(D[33]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(se,{"model-value":X.value,min:0,max:50,"onUpdate:modelValue":Q},null,8,["model-value"])]),e.createElementVNode("div",ac,[D[34]||(D[34]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(se,{"model-value":ee.value,min:0,max:100,"onUpdate:modelValue":oe},null,8,["model-value"])]),e.createElementVNode("div",ic,[D[35]||(D[35]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(se,{"model-value":le.value,min:0,max:50,"onUpdate:modelValue":me},null,8,["model-value"])]),e.createElementVNode("div",sc,[D[36]||(D[36]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(se,{"model-value":ie.value,min:0,max:50,"onUpdate:modelValue":P},null,8,["model-value"])])]),D[42]||(D[42]=e.createElementVNode("h3",{class:"pd-divider"},"三区高度 (mm)",-1)),e.createElementVNode("div",rc,[D[37]||(D[37]=e.createElementVNode("span",{class:"pd-label"},"页眉高度",-1)),e.createVNode(se,{"model-value":ue.value,min:0,max:100,step:.1,"onUpdate:modelValue":I},null,8,["model-value"])]),e.createElementVNode("div",dc,[D[38]||(D[38]=e.createElementVNode("span",{class:"pd-label"},"页脚高度",-1)),e.createVNode(se,{"model-value":J.value,min:0,max:100,step:.1,"onUpdate:modelValue":O},null,8,["model-value"])]),e.createElementVNode("div",cc,[D[39]||(D[39]=e.createElementVNode("span",{class:"pd-label"},"首页叠加高度",-1)),e.createVNode(se,{"model-value":c.value,min:0,max:200,"onUpdate:modelValue":_},null,8,["model-value"])])],32),e.createVNode(Or,{"model-value":ce.value,fields:o.fields,"onUpdate:modelValue":ve},null,8,["model-value","fields"])],512),[[e.vShow,(o.activeTab||"page")==="page"]])])],64))],2))}}),mc=re(uc,[["__scopeId","data-v-f7152fc4"]]),pc={class:"status-bar"},vc={key:0,class:"status-item coord"},fc={class:"status-item"},gc={class:"status-item"},hc={class:"status-item status-paper"},bc=e.defineComponent({__name:"StatusBar",props:{coordinate:{},scale:{},elementCount:{},selectedCount:{},paper:{},dirty:{type:Boolean}},setup(o){return(i,t)=>(e.openBlock(),e.createElementBlock("div",pc,[o.coordinate?(e.openBlock(),e.createElementBlock("span",vc," x:"+e.toDisplayString(o.coordinate.x.toFixed(1))+" y:"+e.toDisplayString(o.coordinate.y.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0),e.createElementVNode("span",fc,"缩放 "+e.toDisplayString(o.scale)+"%",1),e.createElementVNode("span",gc,"元素 "+e.toDisplayString(o.elementCount)+e.toDisplayString(o.selectedCount?` (选中 ${o.selectedCount})`:""),1),e.createElementVNode("span",{class:e.normalizeClass(["status-dirty",{on:o.dirty}])},[t[0]||(t[0]=e.createElementVNode("span",{class:"dirty-dot"},null,-1)),e.createTextVNode(e.toDisplayString(o.dirty?"未保存":"已保存"),1)],2),e.createElementVNode("span",hc,e.toDisplayString(o.paper),1)]))}}),Ec=re(bc,[["__scopeId","data-v-a91952ff"]]),yc={id:"getting-started",title:"快速入门",content:`
4
2
  <h2>界面布局</h2>
5
3
  <p>打印模板设计器采用三栏布局:</p>
6
4
  <ul>
@@ -37,7 +35,7 @@
37
35
  <p><strong>项目名称:</strong>worm-vue3-print</p>
38
36
  <p><strong>仓库地址:</strong><a href="https://gitee.com/liulong_oschina/worm-vue3-print" target="_blank" rel="noopener noreferrer">https://gitee.com/liulong_oschina/worm-vue3-print</a></p>
39
37
  <p>基于 Vue 3 的可视化打印模板设计器,支持拖拽式模板编辑、表达式数据绑定和浏览器端打印预览。</p>
40
- `},Ur={id:"features",title:"功能说明",content:`
38
+ `},kc={id:"features",title:"功能说明",content:`
41
39
  <h2>元素类型</h2>
42
40
  <table>
43
41
  <thead>
@@ -161,11 +159,13 @@
161
159
 
162
160
  <h2>水印配置</h2>
163
161
  <ul>
164
- <li>支持固定文本或绑定字段</li>
165
- <li>可设置旋转角度和透明度</li>
166
- <li>支持显示打印时间戳</li>
162
+ <li>水印内容用统一的「水印表达式」输入:直接输入文字即为静态水印;写成 <code>{order.no}</code>、<code>CONCAT(...)</code> 等即按表达式解析</li>
163
+ <li>点击「编辑表达式」(或双击输入框)打开表达式弹框,可直接选择业务字段与系统变量:打印日期 <code>{printDate}</code>、打印时间 <code>{printTime}</code>、当前页码 <code>{pageIndex}</code>、总页数 <code>{totalPages}</code>;表达式取不到值时回退到测试值</li>
164
+ <li>可设置旋转角度(-90°~90°)、颜色与透明度</li>
165
+ <li>支持调节水印密度(密/中/疏/自定义瓦片尺寸),以及设置水印颜色</li>
166
+ <li>水印在画布、浏览器预览、服务端 PDF、静默打印四端渲染一致</li>
167
167
  </ul>
168
- `},Gr={id:"shortcuts",title:"快捷键",content:`
168
+ `},Vc={id:"shortcuts",title:"快捷键",content:`
169
169
  <h2>常用操作</h2>
170
170
  <table>
171
171
  <thead>
@@ -233,13 +233,14 @@
233
233
  <blockquote>
234
234
  <p><strong>注意</strong>:当焦点在输入框、文本框、下拉框内时,快捷键不生效。</p>
235
235
  </blockquote>
236
- `},Or={id:"faq",title:"常见问题",content:`
236
+ `},Nc={id:"faq",title:"常见问题",content:`
237
237
  <h2>如何调整纸张大小?</h2>
238
238
  <ol>
239
239
  <li>在右侧面板选择"页面设置"</li>
240
- <li>选择预设纸张(A4、A3、A5、Letter、Legal)</li>
241
- <li>或选择"自定义"输入宽度和高度(mm)</li>
242
- <li>设置方向:纵向(portrait)或横向(landscape)</li>
240
+ <li>选择预设纸张:常用纸张(A4、A3、A5、Letter、Legal)、针式打印纸(全等分 / 二等分 / 三等分)、标签纸(80×60、60×40、40×30)、小票纸(57 / 80 / 110mm)</li>
241
+ <li>或选择"自定义"输入宽度和高度(mm);"连续纸"可自定义纸宽,出纸高度按内容自动推导</li>
242
+ <li>设置方向:纵向(portrait)或横向(landscape);切换即交换纸张长宽,设计稿内容随之铺在该尺寸上。连续纸与小票纸固定纵向</li>
243
+ <li>内容旋转角度:0° / 90° / 180° / 270°,整页内容旋转对应角度出纸。90° / 270° 时纸张长宽互换以贴合旋转后的内容,设计稿内容保持原方向、不变形不裁切;0° 为不旋转(默认)。连续纸与小票纸固定纵向、无旋转概念</li>
243
244
  </ol>
244
245
 
245
246
  <h2>如何处理分页?</h2>
@@ -256,8 +257,8 @@
256
257
  <ul>
257
258
  <li><code>fields</code>:字段定义数组,用于字段树显示</li>
258
259
  <li><code>initialTemplate</code>:初始模板数据</li>
259
- <li><code>loadDefaultTemplate</code>:加载默认模板的回调函数</li>
260
260
  </ul>
261
+ <p>模板加载 / 重置(如「加载默认布局」)由宿主实现:把新的模板数据赋给 <code>initialTemplate</code> 即可重载画布。</p>
261
262
 
262
263
  <h2>如何使用表达式绑定字段?</h2>
263
264
  <ol>
@@ -335,7 +336,43 @@
335
336
  <blockquote>
336
337
  <p><strong>注意</strong>:如果存在选中的单元格,右侧面板将显示单元格属性而非表格属性。</p>
337
338
  </blockquote>
338
- `},Wr={id:"changelog",title:"更新记录",content:`
339
+
340
+ <h2>为什么部分页面有水印、部分页面没有?</h2>
341
+ <ol>
342
+ <li>水印是<strong>按模板</strong>独立设置的,每一个设计的模板都需要单独配置自己的水印信息,不会自动继承其他模板。</li>
343
+ <li>如果出现部分页面存在水印、部分页面没有水印的情况,说明该页面所在的模板没有为自身设置水印。</li>
344
+ <li>为模板添加水印:进入该模板专属页面,在右侧的"页面属性"中找到"水印"配置项进行设计即可。</li>
345
+ </ol>
346
+ <blockquote>
347
+ <p><strong>提示</strong>:水印配置保存在模板 JSON 的 <code>watermark</code> 字段中,仅对当前模板生效。</p>
348
+ </blockquote>
349
+ `},wc={id:"changelog",title:"更新记录",content:`
350
+ <h2>v1.3.0 <small>2026-09-20</small></h2>
351
+
352
+ <h3>新增</h3>
353
+ <ul>
354
+ <li><strong>多页面模板</strong>:一份文书可以由版式不同的多个页面按固定顺序组成(如「封面 + 正文 + 条款」),各页绑定同一份数据,下一次出纸就是完整的一份文档。顶部页面栏支持新增、复制、删除、前移/后移、双击重命名与点击切换;删到只剩一页时自动回到单页模式。</li>
355
+ <li><strong>内容旋转角度</strong>:页面属性新增「内容旋转角度」(0° / 90° / 180° / 270°),支持横版设计、竖版出纸——内容整体旋转填满出纸版面,不缩放也不裁切。</li>
356
+ <li><strong>设计背景(套打底图)</strong>:页面属性支持上传、90° 步进旋转与移除底图,照着现成单据排版更省力。底图只在设计画布显示,预览与打印都不会输出。</li>
357
+ </ul>
358
+
359
+ <h3>变更</h3>
360
+ <ul>
361
+ <li><strong>条码尺寸</strong>:条形码(元素与表格单元格)不再拉伸填满元素框,改为按「条宽 → 打印机分辨率 → 等比缩小」结算:默认条宽下每模块 0.25mm,装得下就按原尺寸落纸;设置了「打印机分辨率」(203/300/600)时吸附到整数打印点;宽度不足时整体等比缩小。要更大的条码请调大「条宽」,需要上限请用「最大宽高」——条形码不再提供「缩放模式」。<strong>同一份旧模板的条码会变小</strong>,这是让出纸条宽保持稳定所必需的。</li>
362
+ <li><strong>文字溢出</strong>:文本元素与表格单元格支持「截断 / 自动缩小 / 自适应行高」三种显示形式(属性面板「文字溢出」),缺省值与原有行为一致,存量模板不受影响。</li>
363
+ <li><strong>标签纸</strong>:纸张切到标签纸(80×60 / 60×40 / 40×30mm)时默认取消页边距与页眉页脚,整张纸都给内容区;只在切换纸型时套用一次,之后仍可自行改回,存量模板不会被改写。</li>
364
+ <li><strong>多页面约束</strong>:纸张设置对所有页生效,页边距、页眉页脚、首页叠加、水印与内容元素则按页各自独立;多页模式下隐藏拼版配置、禁用连续纸。</li>
365
+ </ul>
366
+
367
+ <h3>修复</h3>
368
+ <ul>
369
+ <li>多页面模板页面重排后页签名漂移、删除页面后再新增出现重名。</li>
370
+ <li>条形码经热敏打印机出纸条宽忽宽忽窄、边缘发灰;条宽倍率在不同模式下视觉不一致。</li>
371
+ <li>元素堆叠与显式编组在分页时被拆散;单击编组内的任一成员改为选中整组。</li>
372
+ <li>水印经真实打印机出纸被放大约 3 倍、位置偏移、平铺错乱(改为逐块矢量瓦片渲染)。</li>
373
+ <li>小纸张模板(如 80×60mm 自定义纸)输出多出一张空白首页。</li>
374
+ </ul>
375
+
339
376
  <h2>v1.2.2 <small>2026-09-11</small></h2>
340
377
 
341
378
  <h3>变更</h3>
@@ -438,5 +475,5 @@
438
475
  <blockquote>
439
476
  <p>完整更新记录请查阅仓库 <code>docs/中文/CHANGELOG.md</code> 与 <code>docs/en/CHANGELOG.en.md</code>。</p>
440
477
  </blockquote>
441
- `},qr=[Fr,Ur,Gr,Or,Wr],Kr={class:"help-modal"},Yr={class:"help-modal-header"},jr={class:"help-modal-body"},Xr={class:"help-modal-sidebar"},Zr=["onClick"],Jr={class:"help-modal-content"},Qr=["innerHTML"],Fe="worm-print-help-tab",_r=e.defineComponent({__name:"HelpModal",props:{visible:{type:Boolean},initialTab:{default:"getting-started"}},emits:["close","update:tab"],setup(o,{emit:r}){const t=o,n=r,l=qr,i=e.ref(t.initialTab);e.onMounted(()=>{const u=localStorage.getItem(Fe);u&&l.some(f=>f.id===u)&&(i.value=u)}),e.watch(()=>t.visible,u=>{if(u){const f=localStorage.getItem(Fe);f&&l.some(E=>E.id===f)&&(i.value=f)}});function a(u){i.value=u,localStorage.setItem(Fe,u),n("update:tab",u)}const c=e.computed(()=>l.find(f=>f.id===i.value)?.content||"");function h(u){u.key==="Escape"&&t.visible&&n("close")}return e.onMounted(()=>{document.addEventListener("keydown",h)}),e.onUnmounted(()=>{document.removeEventListener("keydown",h)}),(u,f)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"help-modal"},{default:e.withCtx(()=>[o.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"help-modal-overlay",onClick:f[1]||(f[1]=e.withModifiers(E=>u.$emit("close"),["self"]))},[e.createElementVNode("div",Kr,[e.createElementVNode("div",Yr,[f[2]||(f[2]=e.createElementVNode("div",{class:"help-modal-title-wrap"},[e.createElementVNode("h2",{class:"help-modal-title"},"帮助文档"),e.createElementVNode("span",{class:"help-modal-project"},"worm-vue3-print")],-1)),e.createElementVNode("button",{class:"help-modal-close",title:"关闭",onClick:f[0]||(f[0]=E=>u.$emit("close"))}," × ")]),e.createElementVNode("div",jr,[e.createElementVNode("div",Xr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),E=>(e.openBlock(),e.createElementBlock("button",{key:E.id,class:e.normalizeClass(["help-tab",{active:i.value===E.id}]),onClick:C=>a(E.id)},e.toDisplayString(E.title),11,Zr))),128))]),e.createElementVNode("div",Jr,[e.createElementVNode("div",{class:"help-content",innerHTML:c.value},null,8,Qr)])])])])):e.createCommentVNode("",!0)]),_:1})]))}}),es=J(_r,[["__scopeId","data-v-31115934"]]),Ze="print-studio:left",Je="print-studio:right";function Qe(o,r){try{const t=localStorage.getItem(o);return t===null?r:t==="1"}catch{return r}}function ts(){const o=e.ref(Qe(Ze,!1)),r=e.ref(Qe(Je,!1)),t=e.ref(!1);e.watch(o,a=>{try{localStorage.setItem(Ze,a?"1":"0")}catch{}},{flush:"sync"}),e.watch(r,a=>{try{localStorage.setItem(Je,a?"1":"0")}catch{}},{flush:"sync"});function n(){o.value=!o.value}function l(){r.value=!r.value}function i(){t.value=!1}return{leftCollapsed:o,rightCollapsed:r,toggleLeft:n,toggleRight:l,dirty:t,markSaved:i}}const os={class:"designer-container"},ns={class:"designer-body"},ls=e.defineComponent({__name:"PrintDesigner",props:{initialTemplate:{},initialElements:{},fields:{},isEdit:{type:Boolean},requestScreenshot:{type:Function},uploadImage:{type:Function},loadDefaultTemplate:{type:Function},showHelp:{type:Boolean}},emits:["preview","save"],setup(o,{expose:r,emit:t}){const n=o,l=t,i=e.ref(!1);e.watch(()=>n.showHelp,R=>{R===!1&&(i.value=!1)});const{leftCollapsed:a,rightCollapsed:c,toggleLeft:h,toggleRight:u,dirty:f,markSaved:E}=ts(),{scale:C,showRuler:I,showGrid:O,snapToGrid:z,showTableGhostBorder:S,templateData:U,elements:K,fields:Z,selectedIds:W,selectedElement:Q,select:_,clearSelection:N,selectAll:$,previewIds:M,setPreview:P,commitPreview:x,hasClipboard:D,copy:s,paste:V,cutSelected:F,canUndo:Y,canRedo:j,undo:ee,redo:ue,alignSelected:oe,groupSelected:se,ungroupSelected:ae,deleteSelected:L,dragStart:p,dragStop:k,addElement:B,addFieldElement:T,moveLayer:g,updateTemplateData:d,getTemplateJson:m,loadTemplate:y,tableSelection:v,setTableSelection:b,recordHistory:A}=yt({initialTemplate:n.initialTemplate,initialElements:n.initialElements,initialFields:n.fields});e.watch([K,U],()=>{f.value=!0},{deep:!0});const{guides:q,addGuide:de,moveGuide:re,removeGuide:me}=kt(U,A),ve=e.computed(()=>{const R=U.value,{width:H}=w.getPaperDimensions(R);return H-R.margins.left-R.margins.right});e.provide(Te,{tableSelection:v,setTableSelection:b,recordHistory:A,maxTableWidth:ve}),e.provide(tt,W),e.provide(ot,M),e.provide(Ge,e.computed(()=>n.uploadImage)),e.watch(Q,R=>{(!R||R.printElementType.type!=="table")&&b(null)});const fe=e.ref(null),ge=e.ref(!1),he=e.ref(""),we=e.ref(.5);async function Ne(){if(ge.value){ge.value=!1;return}const R=m();if(!R){alert("模板数据为空");return}if(!n.requestScreenshot){alert("截图服务未配置");return}try{const H=await n.requestScreenshot({templateJson:R,printData:w.DEFAULT_DEMO_DATA});he.value&&URL.revokeObjectURL(he.value),he.value=URL.createObjectURL(H),ge.value=!0}catch{alert("截图生成失败")}}const De=e.ref(null);function Re(R){De.value=R}const Ie=e.computed(()=>{const R=U.value,H=w.getPaperDimensions(R),le=R.orientation==="landscape"?"横向":"纵向";return`${R.paperSize} ${le} ${Math.round(H.width)}×${Math.round(H.height)}mm`});function G(){const R=fe.value?.$el;if(R){const H=getComputedStyle(R),le=parseFloat(H.paddingLeft)+parseFloat(H.paddingRight),pe=parseFloat(H.paddingTop)+parseFloat(H.paddingBottom),Be=w.getPaperDimensions(U.value),$e=96/25.4,xe=w.computeFitScale(R.clientWidth-le,R.clientHeight-pe,Be.width*$e,Be.height*$e);fe.value?.fitToWindow(xe)}}function te(R){C.value=Math.max(w.FIT_SCALE_MIN_PERCENT,C.value+R)}function X(R){fe.value?.zoomByStep(R>0?1:-1)}function ne(R){const H=R.target.tagName;H==="INPUT"||H==="TEXTAREA"||H==="SELECT"||(R.ctrlKey||R.metaKey)&&R.key==="0"&&(R.preventDefault(),G())}e.onMounted(()=>document.addEventListener("keydown",ne)),e.onUnmounted(()=>document.removeEventListener("keydown",ne));function be(R){const H=U.value.header.height,le=U.value.footer.height;d(R),R.header.height<H&&Ve("header"),R.footer.height<le&&Ve("footer")}function ce(R,H){U.value={...U.value,[R]:{...U.value[R],height:H}}}function ye(R){d({...U.value}),Ve(R)}function Ve(R){const H=w.getZoneRects(U.value)[R];K.value.some(pe=>pe.zone===R&&(pe.options.top+pe.options.height>H.height||pe.options.left+pe.options.width>H.width))&&alert(`${R==="header"?"页眉":"页脚"}高度已小于区域内元素,请手动调整元素位置`)}function lt(){const R=U.value.firstPageOverlay,H={options:{left:0,top:0,width:50,height:10,title:"首页叠加"},printElementType:{type:"text",title:"首页叠加"}};U.value={...U.value,firstPageOverlay:{...R,elements:[...R.elements,H]}}}const We=_;function at(R){const H=K.value.find(le=>le.id===R);H&&(H.options.visible=H.options.visible===!1)}function it(R){const H=K.value.find(le=>le.id===R);H&&(H.options.locked=!H.options.locked)}const Ce=e.ref("page");e.watch(Q,R=>{Ce.value=R?"element":"page"});const rt={text:"formatter",longText:"formatter",barcode:"formatter",qrcode:"formatter",image:"src"},Se=e.ref(!1),Me=e.ref(null),Ae=e.ref("");function st(R){const H=K.value.find(pe=>pe.id===R);if(!H||(_(R,!1),Ce.value="element",H.options.locked))return;const le=rt[H.printElementType.type];le&&(Me.value={kind:"element",element:H,field:le},Ae.value=H.options[le]||"",Se.value=!0)}function dt(R,H,le){const pe=K.value.find(vt=>vt.id===R);if(!pe||(_(R,!1),Ce.value="element",pe.options.locked))return;const Be=pe.options.tableRows??[],$e=w.findMainCell(Be,H,le),xe=Be[$e.r]?.cells[$e.c];xe&&(Me.value={kind:"cell",cell:xe},Ae.value=xe.formatter||"",Se.value=!0)}function ct(R){const H=Me.value;H?.kind==="element"?H.element.options[H.field]=R||void 0:H?.kind==="cell"&&(H.cell.formatter=R||void 0),A(),Se.value=!1,Me.value=null}function ut(R,H){K.value.push(R),_(R.id,!1),A()}e.watch(()=>n.initialTemplate,R=>{R&&y(R,n.initialElements)}),e.watch(()=>n.initialElements,R=>{R&&!n.initialTemplate&&(U.value={...U.value,elements:R.map(H=>({...H,options:{...H.options},printElementType:{...H.printElementType}}))})}),e.watch(()=>n.fields,R=>{Z.value=R||[]}),r({getTemplateJson:m});async function mt(){if(n.loadDefaultTemplate&&confirm("将覆盖当前画布内容,是否继续?"))try{const R=await n.loadDefaultTemplate();if(!R){alert("未获取到默认布局");return}y(R),alert("默认布局已加载")}catch{alert("加载默认布局失败")}}function pt(){l("save",JSON.stringify(m())),E()}return(R,H)=>(e.openBlock(),e.createElementBlock("div",os,[e.createVNode(Ut,{"is-edit":o.isEdit,"can-undo":e.unref(Y),"can-redo":e.unref(j),"has-multi-selection":e.unref(W).size>=2,"has-selection":e.unref(W).size>=1,"show-ruler":e.unref(I),"show-grid":e.unref(O),"snap-to-grid":e.unref(z),"show-table-ghost-border":e.unref(S),"selected-element-has-group":!!e.unref(Q)?.options.groupId,"overlay-visible":ge.value,"show-load-default":!!o.loadDefaultTemplate,"show-help":o.showHelp!==!1,scale:e.unref(C),"onUpdate:scale":H[0]||(H[0]=le=>e.isRef(C)?C.value=le:null),onPreview:H[1]||(H[1]=le=>R.$emit("preview")),onSave:pt,onLoadDefault:mt,onUndo:e.unref(ee),onRedo:e.unref(ue),onAlign:H[2]||(H[2]=le=>e.unref(oe)(le)),onMoveLayer:e.unref(g),onToggleRuler:H[3]||(H[3]=le=>I.value=!e.unref(I)),onToggleGrid:H[4]||(H[4]=le=>O.value=!e.unref(O)),onToggleSnap:H[5]||(H[5]=le=>z.value=!e.unref(z)),onToggleTableGhostBorder:H[6]||(H[6]=le=>S.value=!e.unref(S)),onToggleOverlay:Ne,onGroup:e.unref(se),onUngroup:e.unref(ae),onAddOverlayElement:lt,onFitWindow:G,onZoom:X,onHelp:H[7]||(H[7]=le=>i.value=!0)},null,8,["is-edit","can-undo","can-redo","has-multi-selection","has-selection","show-ruler","show-grid","snap-to-grid","show-table-ghost-border","selected-element-has-group","overlay-visible","show-load-default","show-help","scale","onUndo","onRedo","onMoveLayer","onGroup","onUngroup"]),e.createElementVNode("div",ns,[e.createVNode(ko,{fields:e.unref(Z),elements:e.unref(K),"selected-ids":e.unref(W),collapsed:e.unref(a),onSelect:e.unref(We),onMoveLayer:e.unref(g),onToggleVisible:at,onToggleLocked:it,onToggleCollapse:e.unref(h)},null,8,["fields","elements","selected-ids","collapsed","onSelect","onMoveLayer","onToggleCollapse"]),e.createVNode(Mn,{ref_key:"canvasAreaRef",ref:fe,"template-data":e.unref(U),elements:e.unref(K),scale:e.unref(C)/100,"show-ruler":e.unref(I),"show-grid":e.unref(O),"snap-to-grid":e.unref(z),"show-table-ghost-border":e.unref(S),"has-clipboard":e.unref(D),guides:e.unref(q),"overlay-visible":ge.value,"screenshot-url":he.value,"overlay-opacity":we.value,"selected-element-has-group":!!e.unref(Q)?.options.groupId,onSelect:e.unref(We),onDropElement:e.unref(B),onDropField:e.unref(T),onDragStart:e.unref(p),onDragStop:e.unref(k),onDblclickElement:st,onDblclickCell:dt,onZoneHeightChange:ce,onZoneHeightCommit:ye,onSelectAll:e.unref($),onClearSelection:e.unref(N),onPreview:e.unref(P),onCommitPreview:e.unref(x),onPaste:e.unref(V),onCopy:e.unref(s),onCut:e.unref(F),onDelete:e.unref(L),onMoveLayer:e.unref(g),onCoordinate:Re,onGroup:e.unref(se),onUngroup:e.unref(ae),onAddGuide:e.unref(de),onGuideMove:e.unref(re),onGuideRemove:e.unref(me),onZoom:te,onCloneElement:ut},null,8,["template-data","elements","scale","show-ruler","show-grid","snap-to-grid","show-table-ghost-border","has-clipboard","guides","overlay-visible","screenshot-url","overlay-opacity","selected-element-has-group","onSelect","onDropElement","onDropField","onDragStart","onDragStop","onSelectAll","onClearSelection","onPreview","onCommitPreview","onPaste","onCopy","onCut","onDelete","onMoveLayer","onGroup","onUngroup","onAddGuide","onGuideMove","onGuideRemove"]),e.createVNode(Mr,{element:e.unref(Q),"template-data":e.unref(U),fields:e.unref(Z),"table-selection":e.unref(v),"record-history":e.unref(A),collapsed:e.unref(c),"active-tab":Ce.value,"onUpdate:activeTab":H[8]||(H[8]=le=>Ce.value=le),onDeleteElement:e.unref(L),"onUpdate:templateData":be,onToggleCollapse:e.unref(u)},null,8,["element","template-data","fields","table-selection","record-history","collapsed","active-tab","onDeleteElement","onToggleCollapse"])]),e.createVNode(Hr,{coordinate:De.value,scale:e.unref(C),"element-count":e.unref(K).length,"selected-count":e.unref(W).size,paper:Ie.value,dirty:e.unref(f)},null,8,["coordinate","scale","element-count","selected-count","paper","dirty"]),e.createVNode(Oe,{modelValue:Se.value,"onUpdate:modelValue":H[9]||(H[9]=le=>Se.value=le),fields:e.unref(Z),expression:Ae.value,"onUpdate:expression":ct},null,8,["modelValue","fields","expression"]),e.createVNode(es,{visible:i.value,onClose:H[10]||(H[10]=le=>i.value=!1)},null,8,["visible"])]))}}),as=J(ls,[["__scopeId","data-v-7f247429"]]),is={class:"print-html-preview"},rs={key:0,class:"print-html-preview-error"},ss={key:1,class:"print-html-preview-loading"},ds=e.defineComponent({__name:"PrintHtmlPreview",props:{templateJson:{},printData:{},baseUrl:{}},emits:["rendered","error"],setup(o,{expose:r,emit:t}){const n=o,l=t,i=e.ref(),a=e.ref(!1),c=e.ref("");let h=0;async function u(){if(!n.templateJson){c.value="",a.value=!1;return}const E=++h;a.value=!0,c.value="";try{const{html:C,pageCount:I}=await Pe.renderHtmlPages(n.templateJson,n.printData,n.baseUrl,Pe.browserCodeRenderer);if(E!==h)return;const O=i.value?.contentWindow?.document;O&&(O.open(),O.write(C),O.close()),l("rendered",I)}catch(C){if(E!==h)return;c.value=C instanceof Error?C.message:"未知错误",l("error",c.value)}finally{E===h&&(a.value=!1)}}function f(){const E=i.value?.contentWindow;E&&(E.focus(),E.print())}return e.watch(()=>[n.templateJson,n.printData,n.baseUrl],()=>{u()},{immediate:!0,deep:!0}),e.onBeforeUnmount(()=>{h++}),r({print:f,rerender:u}),(E,C)=>(e.openBlock(),e.createElementBlock("div",is,[c.value?(e.openBlock(),e.createElementBlock("div",rs,[e.createElementVNode("span",null,"预览渲染失败:"+e.toDisplayString(c.value),1)])):a.value?(e.openBlock(),e.createElementBlock("div",ss,"预览渲染中…")):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("iframe",{ref_key:"iframeRef",ref:i,class:"print-html-preview-iframe",title:"打印预览"},null,512),[[e.vShow,!a.value&&!c.value]])]))}}),cs=J(ds,[["__scopeId","data-v-6b659619"]]);Object.defineProperty(exports,"DEFAULT_DEMO_DATA",{enumerable:!0,get:()=>w.DEFAULT_DEMO_DATA});Object.defineProperty(exports,"getDemoData",{enumerable:!0,get:()=>w.getDemoData});Object.defineProperty(exports,"browserCodeRenderer",{enumerable:!0,get:()=>Pe.browserCodeRenderer});Object.defineProperty(exports,"renderHtmlPages",{enumerable:!0,get:()=>Pe.renderHtmlPages});exports.PrintDesigner=as;exports.PrintHtmlPreview=cs;exports.UPLOAD_IMAGE_KEY=Ge;exports.createDefaultTemplate=nt;exports.toRuntimePool=Ue;
478
+ `},Cc=[yc,kc,Vc,Nc,wc],Sc={class:"help-modal"},Bc={class:"help-modal-header"},xc={class:"help-modal-body"},$c={class:"help-modal-sidebar"},Tc=["onClick"],Dc={class:"help-modal-content"},Mc=["innerHTML"],st="worm-print-help-tab",Pc=e.defineComponent({__name:"HelpModal",props:{visible:{type:Boolean},initialTab:{default:"getting-started"}},emits:["close","update:tab"],setup(o,{emit:i}){const t=o,n=i,l=Cc,d=e.ref(t.initialTab);e.onMounted(()=>{const u=localStorage.getItem(st);u&&l.some(m=>m.id===u)&&(d.value=u)}),e.watch(()=>t.visible,u=>{if(u){const m=localStorage.getItem(st);m&&l.some(g=>g.id===m)&&(d.value=m)}});function s(u){d.value=u,localStorage.setItem(st,u),n("update:tab",u)}const a=e.computed(()=>l.find(m=>m.id===d.value)?.content||"");function r(u){u.key==="Escape"&&t.visible&&n("close")}return e.onMounted(()=>{document.addEventListener("keydown",r)}),e.onUnmounted(()=>{document.removeEventListener("keydown",r)}),(u,m)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"help-modal"},{default:e.withCtx(()=>[o.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"help-modal-overlay",onClick:m[1]||(m[1]=e.withModifiers(g=>u.$emit("close"),["self"]))},[e.createElementVNode("div",Sc,[e.createElementVNode("div",Bc,[m[2]||(m[2]=e.createElementVNode("div",{class:"help-modal-title-wrap"},[e.createElementVNode("h2",{class:"help-modal-title"},"帮助文档"),e.createElementVNode("span",{class:"help-modal-project"},"worm-vue3-print")],-1)),e.createElementVNode("button",{class:"help-modal-close",title:"关闭",onClick:m[0]||(m[0]=g=>u.$emit("close"))}," × ")]),e.createElementVNode("div",xc,[e.createElementVNode("div",$c,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),g=>(e.openBlock(),e.createElementBlock("button",{key:g.id,class:e.normalizeClass(["help-tab",{active:d.value===g.id}]),onClick:k=>s(g.id)},e.toDisplayString(g.title),11,Tc))),128))]),e.createElementVNode("div",Dc,[e.createElementVNode("div",{class:"help-content",innerHTML:a.value},null,8,Mc)])])])])):e.createCommentVNode("",!0)]),_:1})]))}}),zc=re(Pc,[["__scopeId","data-v-31115934"]]),Lc={class:"page-tabs-list"},Rc=["onBlur","onKeydown"],Ac=["data-tip","onClick","onDblclick"],Ic={class:"page-tabs-actions"},Fc=["data-tip","disabled"],Uc=["data-tip","disabled"],Hc=["data-tip","disabled"],Oc=["data-tip","disabled"],Wc=["data-tip","disabled"],Gc=e.defineComponent({__name:"PageTabs",props:{pages:{},activeIndex:{},multi:{type:Boolean},tilingEnabled:{type:Boolean}},emits:["select","add","duplicate","delete","rename","move"],setup(o,{emit:i}){const t=o,n=i,l=e.ref(-1),d=e.ref(""),s=e.computed(()=>t.pages[t.activeIndex]?.name||`页面 ${t.activeIndex+1}`),a=e.computed(()=>t.tilingEnabled?rt:"新增页面(在当前页后追加空白页)"),r=e.computed(()=>t.tilingEnabled?rt:`复制当前页「${s.value}」`);function u(M){l.value=M,d.value=t.pages[M]?.name??""}function m(M){if(l.value!==M)return;const j=d.value.trim();j&&n("rename",M,j),l.value=-1}function g(){l.value=-1}const k=e.ref(null);let y=null;function R(M){const j=M.dataset.tip;if(!j)return;const ne=M.getBoundingClientRect(),H=Math.min(Math.max(ne.left+ne.width/2,80),window.innerWidth-80);k.value={text:j,x:H,y:ne.bottom+6}}function C(M){const j=M.target.closest?.("[data-tip]");j&&(y&&clearTimeout(y),y=setTimeout(()=>R(j),300))}function v(M){const j=M.target.closest?.("[data-tip]");j&&M.relatedTarget?.closest?.("[data-tip]")===j||f()}function f(){y&&(clearTimeout(y),y=null),k.value=null}return e.onUnmounted(f),(M,j)=>(e.openBlock(),e.createElementBlock("div",{class:"page-tabs",onMouseover:C,onMouseout:v,onMouseleave:f},[e.createElementVNode("div",Lc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.pages,(ne,H)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:H},[l.value===H?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":j[0]||(j[0]=K=>d.value=K),class:"page-tab-rename","data-test":"page-rename-input",onBlur:K=>m(H),onKeydown:[e.withKeys(K=>m(H),["enter"]),e.withKeys(g,["esc"])]},null,40,Rc)),[[e.vModelText,d.value]]):(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["page-tab",{active:H===o.activeIndex}]),"data-tip":ne.name?`${ne.name}(双击重命名)`:"双击重命名",onClick:K=>M.$emit("select",H),onDblclick:K=>u(H)},e.toDisplayString(ne.name||`页面 ${H+1}`),43,Ac))],64))),128))]),e.createElementVNode("div",Ic,[e.createElementVNode("button",{"data-test":"add-page","data-tip":a.value,disabled:o.tilingEnabled,onClick:j[1]||(j[1]=ne=>M.$emit("add"))},"+",8,Fc),e.createElementVNode("button",{"data-test":"duplicate-page","data-tip":r.value,disabled:o.tilingEnabled,onClick:j[2]||(j[2]=ne=>M.$emit("duplicate"))},"⧉",8,Uc),e.createElementVNode("button",{"data-test":"delete-page","data-tip":o.multi?`删除当前页「${s.value}」`:"仅多页面模板可删除页面",disabled:!o.multi,onClick:j[3]||(j[3]=ne=>M.$emit("delete",o.activeIndex))},"✕",8,Hc),e.createElementVNode("button",{"data-test":"move-left","data-tip":`前移「${s.value}」`,disabled:o.activeIndex<=0,onClick:j[4]||(j[4]=ne=>M.$emit("move",o.activeIndex,o.activeIndex-1))},"←",8,Oc),e.createElementVNode("button",{"data-test":"move-right","data-tip":`后移「${s.value}」`,disabled:o.activeIndex>=o.pages.length-1,onClick:j[5]||(j[5]=ne=>M.$emit("move",o.activeIndex,o.activeIndex+1))},"→",8,Wc)]),k.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"page-tabs-tip",style:e.normalizeStyle({left:`${k.value.x}px`,top:`${k.value.y}px`})},e.toDisplayString(k.value.text),5)):e.createCommentVNode("",!0)],32))}}),Kc=re(Gc,[["__scopeId","data-v-f1c7a18e"]]),wt="print-studio:left",Ct="print-studio:right";function St(o,i){try{const t=localStorage.getItem(o);return t===null?i:t==="1"}catch{return i}}function qc(){const o=e.ref(St(wt,!1)),i=e.ref(St(Ct,!1)),t=e.ref(!1);e.watch(o,s=>{try{localStorage.setItem(wt,s?"1":"0")}catch{}},{flush:"sync"}),e.watch(i,s=>{try{localStorage.setItem(Ct,s?"1":"0")}catch{}},{flush:"sync"});function n(){o.value=!o.value}function l(){i.value=!i.value}function d(){t.value=!1}return{leftCollapsed:o,rightCollapsed:i,toggleLeft:n,toggleRight:l,dirty:t,markSaved:d}}const Yc={class:"designer-container"},jc={class:"designer-body"},Xc=e.defineComponent({__name:"PrintDesigner",props:{initialTemplate:{},initialElements:{},fields:{},isEdit:{type:Boolean},requestScreenshot:{type:Function},uploadImage:{type:Function},uploadDesignBackground:{type:Function},showHelp:{type:Boolean},fonts:{}},emits:["preview","save"],setup(o,{expose:i,emit:t}){const n=o,l=t,d=e.ref(!1);e.watch(()=>n.showHelp,U=>{U===!1&&(d.value=!1)});const{leftCollapsed:s,rightCollapsed:a,toggleLeft:r,toggleRight:u,dirty:m,markSaved:g}=qc(),{scale:k,showRuler:y,showGrid:R,snapToGrid:C,showTableGhostBorder:v,templateData:f,elements:M,fields:j,tilingEnabled:ne,selectedIds:H,selectedElement:K,select:b,selectElement:B,clearSelection:S,selectAll:x,previewIds:T,setPreview:X,commitPreview:ee,hasClipboard:le,copy:ie,paste:ue,cutSelected:J,canUndo:c,canRedo:N,undo:W,redo:he,alignSelected:pe,groupSelected:ce,ungroupSelected:ve,deleteSelected:z,dragStart:V,dragStop:w,addElement:F,addFieldElement:p,moveLayer:E,updateTemplateData:$,getTemplateJson:Y,loadTemplate:Q,pages:oe,activePageIndex:me,switchPage:P,addPage:I,duplicatePage:O,deletePage:_,renamePage:q,movePage:fe,tableSelection:A,setTableSelection:D,recordHistory:Z}=Wt({initialTemplate:n.initialTemplate,initialElements:n.initialElements,initialFields:n.fields});e.watch([M,f],()=>{m.value=!0},{deep:!0});const{guides:be,addGuide:ke,moveGuide:Ve,removeGuide:xe}=Kt(f,Z),Qe=e.computed(()=>{const U=f.value,{width:G}=h.getPaperDimensions(U);return G-U.margins.left-U.margins.right});e.provide(Oe,{tableSelection:A,setTableSelection:D,recordHistory:Z,maxTableWidth:Qe}),e.provide($t,H),e.provide(Tt,T),e.provide(dt,e.computed(()=>n.uploadImage)),e.provide(ct,e.computed(()=>n.uploadDesignBackground));const{catalog:We}=Yt(e.computed(()=>n.fonts));e.provide(ut,We),Qt(e.computed(()=>ge.buildFontFaceCss(n.fonts)));function Ae(){const U=Y();return n.fonts?.length?Array.isArray(U.pages)?{...U,pages:U.pages.map(G=>({...G,fonts:[...n.fonts]}))}:{...U,fonts:[...n.fonts]}:U}e.watch(K,U=>{(!U||U.printElementType.type!=="table")&&D(null)});const Me=e.ref(null),De=e.ref(!1),Pe=e.ref(""),_e=e.ref(.5);async function et(){if(De.value){De.value=!1;return}const U=Ae();if(!U){alert("模板数据为空");return}if(!n.requestScreenshot){alert("截图服务未配置");return}try{const G=U,de=Array.isArray(G.pages)?G.pages[me.value]:U,Ne=await n.requestScreenshot({templateJson:de,printData:h.DEFAULT_DEMO_DATA});Pe.value&&URL.revokeObjectURL(Pe.value),Pe.value=URL.createObjectURL(Ne),De.value=!0}catch{alert("截图生成失败")}}const Ge=e.ref(null);function tt(U){Ge.value=U}const ot=e.computed(()=>{const U=f.value,G=h.getPaperDimensions(U),de=U.orientation==="landscape"?"横向":"纵向",$e=`${h.PAPER_PRESETS[U.paperSize]?.label??U.paperSize} ${de} ${Math.round(G.width)}×${Math.round(G.height)}mm`,Te=U.outputRotation;return Te?`${$e}(旋转${Te}°)`:$e});function Ke(){const U=Me.value?.$el;if(U){const G=getComputedStyle(U),de=parseFloat(G.paddingLeft)+parseFloat(G.paddingRight),Ne=parseFloat(G.paddingTop)+parseFloat(G.paddingBottom),$e=h.getPaperDimensions(f.value),Te=96/25.4,Fe=h.computeFitScale(U.clientWidth-de,U.clientHeight-Ne,$e.width*Te,$e.height*Te);Me.value?.fitToWindow(Fe)}}function nt(U){k.value=Math.max(h.FIT_SCALE_MIN_PERCENT,k.value+U)}function lt(U){Me.value?.zoomByStep(U>0?1:-1)}function qe(U){const G=U.target.tagName;G==="INPUT"||G==="TEXTAREA"||G==="SELECT"||(U.ctrlKey||U.metaKey)&&U.key==="0"&&(U.preventDefault(),Ke())}e.onMounted(()=>document.addEventListener("keydown",qe)),e.onUnmounted(()=>document.removeEventListener("keydown",qe));function L(U){const G=f.value.header.height,de=f.value.footer.height;$(U),U.header.height<G&&ye("header"),U.footer.height<de&&ye("footer")}function te(U,G){f.value={...f.value,[U]:{...f.value[U],height:G}}}function ae(U){$({...f.value}),ye(U)}function ye(U){const G=h.getZoneRects(f.value)[U];M.value.some(Ne=>Ne.zone===U&&(Ne.options.top+Ne.options.height>G.height||Ne.options.left+Ne.options.width>G.width))&&alert(`${U==="header"?"页眉":"页脚"}高度已小于区域内元素,请手动调整元素位置`)}function Se(){const U=f.value.firstPageOverlay,G={options:{left:0,top:0,width:50,height:10,title:"首页叠加"},printElementType:{type:"text",title:"首页叠加"}};f.value={...f.value,firstPageOverlay:{...U,elements:[...U.elements,G]}}}const Ee=B;function Be(U){const G=M.value.find(de=>de.id===U);G&&(G.options.visible=G.options.visible===!1)}function ze(U){const G=M.value.find(de=>de.id===U);G&&(G.options.locked=!G.options.locked)}const Le=e.ref("page");e.watch(K,U=>{Le.value=U?"element":"page"});const Mt={text:"formatter",longText:"formatter",barcode:"formatter",qrcode:"formatter",image:"src"},Ie=e.ref(!1),Ye=e.ref(null),at=e.ref("");function Pt(U){const G=M.value.find(Ne=>Ne.id===U);if(!G||(b(U,!1),Le.value="element",G.options.locked))return;const de=Mt[G.printElementType.type];de&&(Ye.value={kind:"element",element:G,field:de},at.value=G.options[de]||"",Ie.value=!0)}function zt(U,G,de){const Ne=M.value.find(It=>It.id===U);if(!Ne||(b(U,!1),Le.value="element",Ne.options.locked))return;const $e=Ne.options.tableRows??[],Te=h.findMainCell($e,G,de),Fe=$e[Te.r]?.cells[Te.c];Fe&&(Ye.value={kind:"cell",cell:Fe},at.value=Fe.formatter||"",Ie.value=!0)}function Lt(U){const G=Ye.value;G?.kind==="element"?G.element.options[G.field]=U||void 0:G?.kind==="cell"&&(G.cell.formatter=U||void 0),Z(),Ie.value=!1,Ye.value=null}function Rt(U,G){M.value.push(U),b(U.id,!1),Z()}e.watch(()=>n.initialTemplate,U=>{U&&Q(U,n.initialElements)}),e.watch(()=>n.initialElements,U=>{U&&!n.initialTemplate&&(f.value={...f.value,elements:U.map(G=>({...G,options:{...G.options},printElementType:{...G.printElementType}}))})}),e.watch(()=>n.fields,U=>{j.value=U||[]});const pt=e.computed(()=>{const U=f.value;return U?.tiling?.enabled!==!0?[]:ge.validateTiling(U)});i({getTemplateJson:Ae,validateTemplate:()=>pt.value});function At(){const U=pt.value;if(U.length){alert(U[0].message),Le.value="page";return}const G=Ae();if(Array.isArray(G.pages))try{ge.normalizeTemplate(G)}catch(de){alert(de instanceof Error?de.message:String(de));return}l("save",JSON.stringify(G)),g()}return(U,G)=>(e.openBlock(),e.createElementBlock("div",Yc,[e.createVNode(Eo,{"is-edit":o.isEdit,"can-undo":e.unref(c),"can-redo":e.unref(N),"has-multi-selection":e.unref(H).size>=2,"has-selection":e.unref(H).size>=1,"show-ruler":e.unref(y),"show-grid":e.unref(R),"snap-to-grid":e.unref(C),"show-table-ghost-border":e.unref(v),"selected-element-has-group":!!e.unref(K)?.options.groupId,"overlay-visible":De.value,"show-help":o.showHelp!==!1,scale:e.unref(k),"onUpdate:scale":G[0]||(G[0]=de=>e.isRef(k)?k.value=de:null),onPreview:G[1]||(G[1]=de=>U.$emit("preview")),onSave:At,onUndo:e.unref(W),onRedo:e.unref(he),onAlign:G[2]||(G[2]=de=>e.unref(pe)(de)),onMoveLayer:e.unref(E),onToggleRuler:G[3]||(G[3]=de=>y.value=!e.unref(y)),onToggleGrid:G[4]||(G[4]=de=>R.value=!e.unref(R)),onToggleSnap:G[5]||(G[5]=de=>C.value=!e.unref(C)),onToggleTableGhostBorder:G[6]||(G[6]=de=>v.value=!e.unref(v)),onToggleOverlay:et,onGroup:e.unref(ce),onUngroup:e.unref(ve),onAddOverlayElement:Se,onFitWindow:Ke,onZoom:lt,onHelp:G[7]||(G[7]=de=>d.value=!0)},null,8,["is-edit","can-undo","can-redo","has-multi-selection","has-selection","show-ruler","show-grid","snap-to-grid","show-table-ghost-border","selected-element-has-group","overlay-visible","show-help","scale","onUndo","onRedo","onMoveLayer","onGroup","onUngroup"]),e.createVNode(Kc,{pages:e.unref(oe),"active-index":e.unref(me),multi:e.unref(oe).length>1,"tiling-enabled":e.unref(ne),onSelect:e.unref(P),onAdd:e.unref(I),onDuplicate:e.unref(O),onDelete:e.unref(_),onRename:e.unref(q),onMove:e.unref(fe)},null,8,["pages","active-index","multi","tiling-enabled","onSelect","onAdd","onDuplicate","onDelete","onRename","onMove"]),e.createElementVNode("div",jc,[e.createVNode(Qo,{fields:e.unref(j),elements:e.unref(M),"selected-ids":e.unref(H),collapsed:e.unref(s),onSelect:e.unref(Ee),onMoveLayer:e.unref(E),onToggleVisible:Be,onToggleLocked:ze,onToggleCollapse:e.unref(r)},null,8,["fields","elements","selected-ids","collapsed","onSelect","onMoveLayer","onToggleCollapse"]),e.createVNode(El,{ref_key:"canvasAreaRef",ref:Me,"template-data":e.unref(f),elements:e.unref(M),scale:e.unref(k)/100,"show-ruler":e.unref(y),"show-grid":e.unref(R),"snap-to-grid":e.unref(C),"show-table-ghost-border":e.unref(v),"has-clipboard":e.unref(le),guides:e.unref(be),"overlay-visible":De.value,"screenshot-url":Pe.value,"overlay-opacity":_e.value,"selected-element-has-group":!!e.unref(K)?.options.groupId,onSelect:e.unref(Ee),onDropElement:e.unref(F),onDropField:e.unref(p),onDragStart:e.unref(V),onDragStop:e.unref(w),onDblclickElement:Pt,onDblclickCell:zt,onZoneHeightChange:te,onZoneHeightCommit:ae,onSelectAll:e.unref(x),onClearSelection:e.unref(S),onPreview:e.unref(X),onCommitPreview:e.unref(ee),onPaste:e.unref(ue),onCopy:e.unref(ie),onCut:e.unref(J),onDelete:e.unref(z),onMoveLayer:e.unref(E),onCoordinate:tt,onGroup:e.unref(ce),onUngroup:e.unref(ve),onAddGuide:e.unref(ke),onGuideMove:e.unref(Ve),onGuideRemove:e.unref(xe),onZoom:nt,onCloneElement:Rt},null,8,["template-data","elements","scale","show-ruler","show-grid","snap-to-grid","show-table-ghost-border","has-clipboard","guides","overlay-visible","screenshot-url","overlay-opacity","selected-element-has-group","onSelect","onDropElement","onDropField","onDragStart","onDragStop","onSelectAll","onClearSelection","onPreview","onCommitPreview","onPaste","onCopy","onCut","onDelete","onMoveLayer","onGroup","onUngroup","onAddGuide","onGuideMove","onGuideRemove"]),e.createVNode(mc,{element:e.unref(K),"template-data":e.unref(f),fields:e.unref(j),"table-selection":e.unref(A),"record-history":e.unref(Z),collapsed:e.unref(a),"multi-page":e.unref(oe).length>1,"active-tab":Le.value,"onUpdate:activeTab":G[8]||(G[8]=de=>Le.value=de),onDeleteElement:e.unref(z),"onUpdate:templateData":L,onToggleCollapse:e.unref(u)},null,8,["element","template-data","fields","table-selection","record-history","collapsed","multi-page","active-tab","onDeleteElement","onToggleCollapse"])]),e.createVNode(Ec,{coordinate:Ge.value,scale:e.unref(k),"element-count":e.unref(M).length,"selected-count":e.unref(H).size,paper:ot.value,dirty:e.unref(m)},null,8,["coordinate","scale","element-count","selected-count","paper","dirty"]),e.createVNode(Je,{modelValue:Ie.value,"onUpdate:modelValue":G[9]||(G[9]=de=>Ie.value=de),fields:e.unref(j),expression:at.value,"onUpdate:expression":Lt},null,8,["modelValue","fields","expression"]),e.createVNode(zc,{visible:d.value,onClose:G[10]||(G[10]=de=>d.value=!1)},null,8,["visible"])]))}}),Zc=re(Xc,[["__scopeId","data-v-080dee1a"]]),Jc={class:"print-html-preview"},Qc={key:0,class:"print-html-preview-error"},_c={key:1,class:"print-html-preview-loading"},eu=e.defineComponent({__name:"PrintHtmlPreview",props:{templateJson:{},printData:{},baseUrl:{},fontBaseUrl:{}},emits:["rendered","error"],setup(o,{expose:i,emit:t}){const n=o,l=t,d=e.ref(),s=e.ref(!1),a=e.ref("");let r=0;async function u(){if(!n.templateJson){a.value="",s.value=!1;return}const g=++r;s.value=!0,a.value="";try{const{html:k,pageCount:y,copies:R}=await Ue.renderHtmlPages(n.templateJson,n.printData,n.baseUrl,Ue.browserCodeRenderer,{fontBaseUrl:n.fontBaseUrl});if(g!==r)return;const C=d.value?.contentWindow?.document;C&&(C.open(),C.write(k),C.close()),l("rendered",y,R)}catch(k){if(g!==r)return;a.value=k instanceof Error?k.message:"未知错误",l("error",a.value)}finally{g===r&&(s.value=!1)}}function m(){const g=d.value?.contentWindow;g&&(g.focus(),g.print())}return e.watch(()=>[n.templateJson,n.printData,n.baseUrl,n.fontBaseUrl],()=>{u()},{immediate:!0,deep:!0}),e.onBeforeUnmount(()=>{r++}),i({print:m,rerender:u}),(g,k)=>(e.openBlock(),e.createElementBlock("div",Jc,[a.value?(e.openBlock(),e.createElementBlock("div",Qc,[e.createElementVNode("span",null,"预览渲染失败:"+e.toDisplayString(a.value),1)])):s.value?(e.openBlock(),e.createElementBlock("div",_c,"预览渲染中…")):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("iframe",{ref_key:"iframeRef",ref:d,class:"print-html-preview-iframe",title:"打印预览"},null,512),[[e.vShow,!s.value&&!a.value]])]))}}),tu=re(eu,[["__scopeId","data-v-ff7de2b5"]]);Object.defineProperty(exports,"DEFAULT_DEMO_DATA",{enumerable:!0,get:()=>h.DEFAULT_DEMO_DATA});Object.defineProperty(exports,"getDemoData",{enumerable:!0,get:()=>h.getDemoData});Object.defineProperty(exports,"browserCodeRenderer",{enumerable:!0,get:()=>Ue.browserCodeRenderer});Object.defineProperty(exports,"renderHtmlPages",{enumerable:!0,get:()=>Ue.renderHtmlPages});exports.FONT_CATALOG_KEY=ut;exports.PrintDesigner=Zc;exports.PrintHtmlPreview=tu;exports.UPLOAD_DESIGN_BACKGROUND_KEY=ct;exports.UPLOAD_IMAGE_KEY=dt;exports.createDefaultTemplate=Re;exports.toRuntimePool=Ze;
442
479
  //# sourceMappingURL=index.cjs.map