@worm-vue3-print/canvas 1.3.6 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/canvas.css +1 -1
  2. package/dist/components/CanvasArea.vue.d.ts +1 -1
  3. package/dist/components/CanvasPaper.vue.d.ts +1 -1
  4. package/dist/components/DesignerToolbar.vue.d.ts +1 -1
  5. package/dist/components/ExpressionEditor.vue.d.ts +1 -1
  6. package/dist/components/FieldTreePanel.vue.d.ts +1 -1
  7. package/dist/components/FormatToolbar.vue.d.ts +1 -1
  8. package/dist/components/HelpButton.vue.d.ts +1 -1
  9. package/dist/components/HelpModal.vue.d.ts +1 -1
  10. package/dist/components/LayerPanel.vue.d.ts +1 -1
  11. package/dist/components/LeftPanel.vue.d.ts +1 -1
  12. package/dist/components/PageTabs.vue.d.ts +1 -1
  13. package/dist/components/PresetColorPicker.vue.d.ts +1 -1
  14. package/dist/components/PrintDesigner.vue.d.ts +1 -1
  15. package/dist/components/PrintHtmlPreview.vue.d.ts +1 -1
  16. package/dist/components/PropertyPanel.vue.d.ts +1 -1
  17. package/dist/components/Ruler.vue.d.ts +1 -1
  18. package/dist/components/StatusBar.vue.d.ts +1 -1
  19. package/dist/components/ToolbarDropdown.vue.d.ts +4 -1
  20. package/dist/components/ToolbarMore.vue.d.ts +9 -0
  21. package/dist/components/WatermarkConfig.vue.d.ts +1 -1
  22. package/dist/components/elements/BarcodeElement.vue.d.ts +1 -1
  23. package/dist/components/elements/BaseElement.vue.d.ts +1 -1
  24. package/dist/components/elements/CellBarcode.vue.d.ts +3 -1
  25. package/dist/components/elements/CellImage.vue.d.ts +2 -1
  26. package/dist/components/elements/HtmlElement.vue.d.ts +1 -1
  27. package/dist/components/elements/ImageElement.vue.d.ts +1 -1
  28. package/dist/components/elements/LineElement.vue.d.ts +1 -1
  29. package/dist/components/elements/LongTextElement.vue.d.ts +1 -1
  30. package/dist/components/elements/PageNumberElement.vue.d.ts +1 -1
  31. package/dist/components/elements/QrcodeElement.vue.d.ts +1 -1
  32. package/dist/components/elements/ShapeElement.vue.d.ts +1 -1
  33. package/dist/components/elements/TableContextMenu.vue.d.ts +1 -1
  34. package/dist/components/elements/TableElement.vue.d.ts +1 -1
  35. package/dist/components/elements/TextElement.vue.d.ts +1 -1
  36. package/dist/components/property/AdvancedGroup.vue.d.ts +1 -1
  37. package/dist/components/property/AppearanceGroup.vue.d.ts +1 -1
  38. package/dist/components/property/BindingControl.vue.d.ts +1 -1
  39. package/dist/components/property/BorderBgGroup.vue.d.ts +1 -1
  40. package/dist/components/property/CodeGroup.vue.d.ts +1 -1
  41. package/dist/components/property/DesignBackgroundConfig.vue.d.ts +1 -1
  42. package/dist/components/property/FontSelect.vue.d.ts +1 -1
  43. package/dist/components/property/ImageContentUpload.vue.d.ts +1 -1
  44. package/dist/components/property/PaginationGroup.vue.d.ts +1 -1
  45. package/dist/components/property/PositionSizeGroup.vue.d.ts +1 -1
  46. package/dist/components/property/PropertyGroup.vue.d.ts +1 -1
  47. package/dist/components/property/PropertySearch.vue.d.ts +1 -1
  48. package/dist/components/property/StepperInput.vue.d.ts +1 -1
  49. package/dist/components/property/TableCellGroup.vue.d.ts +1 -1
  50. package/dist/components/property/TableRowGroup.vue.d.ts +1 -1
  51. package/dist/components/property/TableSettingsGroup.vue.d.ts +1 -1
  52. package/dist/components/property/TilingConfig.vue.d.ts +1 -1
  53. package/dist/composables/useAdsorb.d.ts +1 -1
  54. package/dist/composables/useAdsorbManager.d.ts +1 -1
  55. package/dist/composables/useClipboard.d.ts +9 -5
  56. package/dist/composables/useDesignerState.d.ts +49 -25
  57. package/dist/composables/useDocumentFontFace.d.ts +1 -1
  58. package/dist/composables/useDrag.d.ts +1 -1
  59. package/dist/composables/useFontCatalog.d.ts +1 -1
  60. package/dist/composables/useFormatPainter.d.ts +1 -1
  61. package/dist/composables/useFormatToolbar.d.ts +1 -1
  62. package/dist/composables/useGuides.d.ts +1 -1
  63. package/dist/composables/useHistory.d.ts +1 -1
  64. package/dist/composables/useHostAdapter.d.ts +1 -1
  65. package/dist/composables/useSelection.d.ts +1 -1
  66. package/dist/composables/useShrinkFit.d.ts +1 -1
  67. package/dist/composables/useStudioChrome.d.ts +1 -1
  68. package/dist/composables/useTableSelection.d.ts +1 -1
  69. package/dist/composables/useToolbarOverflow.d.ts +51 -0
  70. package/dist/help-content/changelog.d.ts +1 -1
  71. package/dist/help-content/faq.d.ts +1 -1
  72. package/dist/help-content/features.d.ts +1 -1
  73. package/dist/help-content/getting-started.d.ts +1 -1
  74. package/dist/help-content/index.d.ts +1 -1
  75. package/dist/help-content/shortcuts.d.ts +1 -1
  76. package/dist/index.cjs +33 -8
  77. package/dist/index.d.ts +3 -1
  78. package/dist/index.js +5568 -5123
  79. package/package.json +2 -2
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * @worm-vue3-print/canvas v1.3.6
2
+ * @worm-vue3-print/canvas v1.3.7
3
3
  * Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
4
4
  * SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
5
5
  * SPDX-License-Identifier: MIT
6
- */"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),he=require("@worm-vue3-print/core"),E=require("@worm-vue3-print/core/designer"),ie=require("lucide-vue-next"),Ie=require("@worm-vue3-print/core/browser"),zt=require("jsbarcode"),At=require("qrcode"),Wt=require("dompurify"),Je=Symbol("selected-ids"),Pt=Symbol("preview-ids");function Gt(o){const r=e.ref(new Set),t=e.ref(new Set),s=e.computed(()=>o.value.filter(g=>r.value.has(g.id))),n=e.computed(()=>r.value.size>0);function l(g,h=!1){if(h){const R=new Set(r.value);R.has(g)?R.delete(g):R.add(g),r.value=R}else r.value=new Set([g])}function a(){r.value=new Set}function i(g){r.value=new Set(g)}function d(g){t.value=new Set(g)}function m(){t.value=new Set}function c(){r.value=new Set(t.value),t.value=new Set}function f(){const g=s.value;if(g.length===0)return null;let h=1/0,R=1/0,C=-1/0,v=-1/0;return g.forEach(p=>{h=Math.min(h,p.options.left),R=Math.min(R,p.options.top),C=Math.max(C,p.options.left+p.options.width),v=Math.max(v,p.options.top+p.options.height)}),{left:h,top:R,width:C-h,height:v-R}}return{selectedIds:r,selectedElements:s,hasSelection:n,select:l,clearSelection:a,selectAll:i,getSelectionBounds:f,previewIds:t,setPreview:d,clearPreview:m,commitPreview:c}}function Kt(){const o=e.ref(null);function r(n){o.value=n.map(l=>({options:{...l.options},printElementType:{...l.printElementType}}))}function t(n=10){if(!o.value)return null;const l=new Map;for(const i of o.value){const d=i.options.groupId;d&&l.set(d,(l.get(d)??0)+1)}const a=new Map;for(const[i,d]of l)a.set(i,d>=2?E.generateGroupId():void 0);return o.value.map(i=>({id:E.generateId(),options:{...i.options,left:i.options.left+n,top:i.options.top+n,groupId:i.options.groupId?a.get(i.options.groupId):void 0},printElementType:{...i.printElementType}}))}function s(){return o.value!==null&&o.value.length>0}return{clipboard:o,copy:r,paste:t,hasData:s}}function qt(o){const t=e.ref([]),s=e.ref([]),n=e.ref(!1),l=e.ref(!1);function a(){n.value=t.value.length>0,l.value=s.value.length>0}function i(h){const R={elements:JSON.parse(JSON.stringify(h?.elements??[])),templateData:JSON.parse(JSON.stringify(h?.templateData??{}))};return h?.pages&&(R.pages=JSON.parse(JSON.stringify(h.pages)),h.activePageIndex!==void 0&&(R.activePageIndex=h.activePageIndex)),R}function d(h){return i(h)}function m(h){t.value.push(d(h)),s.value=[],t.value.length>50&&t.value.shift(),a()}function c(h){if(t.value.length===0)return null;const R=t.value.pop();return s.value.push(h?d(h):i(R)),a(),t.value.length>0?i(t.value[t.value.length-1]):null}function f(h){if(s.value.length===0)return null;const R=s.value.pop();return t.value.push(h?d(h):i(R)),a(),i(R)}function g(){t.value=[],s.value=[],a()}return{push:m,undo:c,redo:f,canUndo:n,canRedo:l,clear:g}}const mt="开启拼版后只能有一个设计页面";function Pe(){return{paperSize:"A4",orientation:"portrait",unit:"mm",margins:{top:10,right:10,bottom:10,left:10},header:{height:10,elements:[]},footer:{height:10,elements:[]},elements:[],watermark:{}}}function Xe(o){const r=(t,s)=>(t??[]).map(n=>{const l={...n.options};return(n.printElementType?.type??n.type)==="table"&&E.syncTableElementSize(l),{id:n.id||E.generateId(),zone:s,options:l,printElementType:{...n.printElementType}}});return{...o,margins:{...o.margins},header:{height:o.header?.height??10,elements:[]},footer:{height:o.footer?.height??10,elements:[]},guides:[...o.guides??[]],elements:[...r(o.elements??[],"content"),...r(o.header?.elements??[],"header"),...r(o.footer?.elements??[],"footer")]}}function yt(o){const r=(s,n)=>{const l=Xe(E.normalizeTemplateUnits(s));return l.name||(l.name=`页面 ${n+1}`),l};if(!o)return[r(Pe(),0)];const t=Array.isArray(o.pages)?o.pages:[o];return t.length?t.map(r):[r(Pe(),0)]}function kt(o){const r=o.elements,t=s=>r.filter(n=>(n.zone||"content")===s).map(n=>({id:n.id,type:n.printElementType.type,options:{...n.options},printElementType:{...n.printElementType}}));return{unit:"mm",...o,header:{...o.header,elements:t("header")},footer:{...o.footer,elements:t("footer")},elements:t("content"),guides:[...o.guides??[]]}}function Yt(o={}){const r=e.ref(100),t=e.ref(!0),s=e.ref(!0),n=e.ref(!1),l=e.ref(!0),a=e.ref(yt(o.initialTemplate)),i=e.ref(0),d=e.ref(a.value[0]??Xe(Pe())),m=e.computed(()=>a.value.some(H=>H.tiling?.enabled===!0));function c(){return m.value?(alert(mt),!0):!1}function f(){a.value[i.value]=d.value}function g(H){H<0||H>=a.value.length||(f(),i.value=H,d.value=a.value[H],fe())}const h=e.computed({get:()=>d.value.elements,set:H=>{d.value.elements=H}}),R=e.ref(o.initialFields||[]),{selectedIds:C,selectedElements:v,select:p,clearSelection:B,selectAll:_,previewIds:ne,setPreview:G,clearPreview:J,commitPreview:b}=Gt(h),{group:W,ungroup:j,getGroupedIds:U}=E.useGroup(),{copy:y,paste:M,hasData:N}=Kt(),{align:O}=E.useAlign(),{push:A,undo:k,redo:z,canUndo:u,canRedo:x}=qt(),Y=e.computed(()=>{if(C.value.size===0)return null;const H=C.value.values().next().value;return h.value.find(le=>le.id===H)||null}),be=e.ref(null);function ge(H){be.value=H}function fe(){B(),ge(null)}function se(){return{elements:h.value.map(H=>({id:H.id,zone:H.zone,options:JSON.parse(JSON.stringify(H.options)),printElementType:{...H.printElementType}})),templateData:{paperSize:d.value.paperSize,orientation:d.value.orientation,outputRotation:d.value.outputRotation,margins:{...d.value.margins},header:{height:d.value.header.height,elements:[]},footer:{height:d.value.footer.height,elements:[]},elements:[],customWidth:d.value.customWidth,customHeight:d.value.customHeight,watermark:d.value.watermark?{...d.value.watermark}:void 0,guides:[...d.value.guides??[]]},pages:JSON.parse(JSON.stringify(a.value)),activePageIndex:i.value}}function q(){A(se())}function S(H){return H.pages?.[H.activePageIndex??0]?.elements??H.elements}function D(){const H=k(se());H?.pages?(a.value=H.pages,i.value=H.activePageIndex??0,d.value=a.value[i.value]??a.value[0],fe()):H?.templateData&&(d.value={...H.templateData,elements:H.elements})}function K(){const H=z(se());H?.pages?(a.value=H.pages,i.value=H.activePageIndex??0,d.value=a.value[i.value]??a.value[0],fe()):H?.templateData&&(d.value={...H.templateData,elements:H.elements})}function Z(){y(v.value)}function te(){y(v.value),me()}function pe(){const H=M();H&&H.length>0&&(h.value.push(...H),q())}function T(){y(v.value);const H=M();H&&H.length>0&&(H.forEach(le=>{le.options.left+=5,le.options.top+=5}),h.value.push(...H),p(H[0].id,!1),q())}function $(){r.value=100}const I=e.computed(()=>N());let ee=!1,oe=null;const ue=300;function L(H,le){const de=v.value.filter(ke=>!ke.options.locked);de.length!==0&&(de.forEach(ke=>{ke.options.left+=H,ke.options.top+=le}),ee||(ee=!0,q()),oe&&clearTimeout(oe),oe=setTimeout(()=>{ee=!1,oe=null},ue))}function F(){_(h.value.map(H=>H.id))}function V(H){O(v.value,H),q()}function w(H,le=!1){if(le){p(H,!0);return}C.value=new Set(U(h.value,H))}function P(){h.value=W(h.value,C.value),q()}function ae(){h.value=j(h.value,C.value),q()}function me(){C.value.size!==0&&(h.value=h.value.filter(H=>!C.value.has(H.id)),B(),q())}const{setup:ye,cleanup:we}=E.useKeyboard({onMove:L,onDelete:me,onCopy:Z,onPaste:pe,onSelectAll:F,onUndo:D,onRedo:K,onDuplicate:T,onResetZoom:$,onAlignLeft:()=>V("left"),onAlignRight:()=>V("right"),onAlignCenterH:()=>V("vertical"),onAlignTop:()=>V("top"),onAlignBottom:()=>V("bottom"),onGroup:P,onUngroup:ae});let xe=null;function Re(){xe=se()}function _e(){if(!xe)return;const H=new Map(xe.elements.map(Ee=>[Ee.id,Ee]));let le=!1;for(const Ee of h.value){const Be=H.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)&&E.finalizeElementZone(Ee,d.value).rejected&&(le=!0)}le&&alert("该元素类型不能放入页眉/页脚");const de=Ee=>`${Ee.id}:${Ee.zone||"content"}:${Ee.options.left},${Ee.options.top},${Ee.options.width},${Ee.options.height}`,ke=S(xe).map(de).join("|"),Se=S(se()).map(de).join("|");xe=null,ke!==Se&&q()}function Oe(H,le){const de=E.zoneFromPaperPoint(d.value,le.x,le.y);if(de!=="content"&&!E.ZONE_ALLOWED_TYPES.includes(H.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const ke=E.getZoneRects(d.value)[de];return H.zone=de,H.options.left=le.x-ke.left,H.options.top=le.y-ke.top,de!=="content"&&E.clampToZone(H,ke),!0}function et(H,le){const de=E.createRuntimeElement(H);le&&!Oe(de,le)||(h.value.push(de),p(de.id,!1),q())}function tt(H,le){const de=E.createFieldElement(H);le&&!Oe(de,le)||(h.value.push(de),p(de.id,!1),q())}function ot(H){if(C.value.size===0)return;const le=C.value.values().next().value,de=h.value.find(ze=>ze.id===le);if(!de)return;const ke=de.options.zIndex??0,Se=h.value.map(ze=>ze.options.zIndex??0),Ee=Math.max(...Se,0),Be=Math.min(...Se,0);switch(H){case"top":de.options.zIndex=Ee+1;break;case"bottom":de.options.zIndex=Be-1;break;case"up":de.options.zIndex=ke+1;break;case"down":de.options.zIndex=ke-1;break}q()}function nt(H,le){const{width:de,height:ke}=E.getPaperDimensions(d.value),Se=96/25.4;r.value=E.computeFitScale(H,le,de*Se,ke*Se)}function lt(H){if(d.value={...H},a.value[i.value]=d.value,a.value.length>1){const le={paperSize:H.paperSize,orientation:H.orientation,outputRotation:H.outputRotation,customWidth:H.customWidth,customHeight:H.customHeight};for(const de of a.value)Object.assign(de,le)}q()}function We(){return f(),a.value.length<=1?kt(a.value[0]):{version:1,pages:a.value.map(kt)}}function Me(H,le){a.value=yt(H),i.value=0,d.value=a.value[0],le&&(d.value={...d.value,elements:le.map(de=>({...de,id:de.id||E.generateId(),zone:de.zone||"content",options:{...de.options},printElementType:{...de.printElementType}}))},a.value[i.value]=d.value),A(se())}function Ge(){const H=new Set(a.value.map(de=>de.name));let le=a.value.length+1;for(;H.has(`页面 ${le}`);)le++;return`页面 ${le}`}function at(){if(c())return;f();const H=a.value[i.value]??Pe(),le=Xe({...Pe(),paperSize:H.paperSize,orientation:H.orientation,customWidth:H.customWidth,customHeight:H.customHeight,name:Ge()});a.value.push(le),i.value=a.value.length-1,d.value=le,fe(),q()}function it(){if(c())return;f();const H=a.value[i.value],le=JSON.parse(JSON.stringify(H));le.name=`${H.name??`页面 ${i.value+1}`} 副本`,le.elements=le.elements.map(de=>({...de,id:E.generateId()})),a.value.splice(i.value+1,0,le),g(i.value+1),q()}function Ke(H){a.value.length<=1||(f(),a.value.splice(H,1),H<i.value?i.value--:H===i.value&&i.value>=a.value.length&&(i.value=a.value.length-1),d.value=a.value[i.value],fe(),q())}function rt(H,le){a.value[H]&&(a.value[H].name=le)}function st(H,le){if(H===le)return;f();const[de]=a.value.splice(H,1);a.value.splice(le,0,de),i.value=le,d.value=de,fe(),q()}return A(se()),e.onMounted(()=>ye()),e.onUnmounted(()=>{we(),oe&&(clearTimeout(oe),oe=null)}),{scale:r,showRuler:t,showGrid:s,snapToGrid:n,showTableGhostBorder:l,templateData:d,elements:h,fields:R,tilingEnabled:m,pages:a,activePageIndex:i,switchPage:g,addPage:at,duplicatePage:it,deletePage:Ke,renamePage:rt,movePage:st,selectedIds:C,selectedElements:v,selectedElement:Y,select:p,selectElement:w,clearSelection:B,selectAll:F,previewIds:ne,setPreview:G,clearPreview:J,commitPreview:b,hasClipboard:I,copy:Z,paste:pe,cutSelected:te,tableSelection:be,setTableSelection:ge,canUndo:u,canRedo:x,undo:D,redo:K,recordHistory:q,alignSelected:V,groupSelected:P,ungroupSelected:ae,deleteSelected:me,duplicateSelected:T,resetZoom:$,dragStart:Re,dragStop:_e,addElement:et,addFieldElement:tt,moveLayer:ot,fitToWindow:nt,updateTemplateData:lt,getTemplateJson:We,loadTemplate:Me}}const Ce=Symbol("mixed"),pt=new Set(["text","longText"]);function jt(o){const{elements:r,selectedIds:t,tableSelection:s,recordHistory:n}=o,l=e.computed(()=>r.value.filter(N=>t.value.has(N.id)&&!N.options.locked)),a=e.computed(()=>{const N=s.value;return N?r.value.find(O=>O.id===N.elementId)??null:null}),i=e.computed(()=>s.value&&a.value?"cells":l.value.length>0||t.value.size>0?"elements":"none"),d=e.computed(()=>{const N=s.value,O=a.value?.options.tableRows;if(!N||!O)return[];const A=[];for(let k=N.r1;k<=N.r2;k++)for(let z=N.c1;z<=N.c2;z++){const u=O[k]?.cells[z];u&&!u.merged&&A.push(u)}return A}),m=e.computed(()=>l.value.filter(N=>pt.has(N.printElementType.type))),c=e.computed(()=>i.value==="cells"?d.value.length>0:i.value!=="elements"?!1:l.value.length>0&&m.value.length===l.value.length),f=e.computed(()=>i.value==="cells"?d.value:m.value.map(N=>N.options));function g(N){if(!N.length)return;const O=N[0];return N.every(A=>A===O)?O:Ce}const h=(N,O)=>(N??"").split(/\s+/).includes(O),R=e.computed(()=>{const N=f.value;if(!N.length)return{fontFamily:void 0,fontSize:void 0,color:void 0,backgroundColor:void 0,textAlign:void 0,verticalAlign:void 0,bold:!1,underline:!1,strike:!1};const O=N.map(k=>k.fontWeight==="bold"||k.fontWeight==="bolder"),A=N.map(k=>k.textDecoration);return{fontFamily:g(N.map(k=>k.fontFamily)),fontSize:g(N.map(k=>k.fontSize)),color:g(N.map(k=>k.color)),backgroundColor:g(N.map(k=>k.backgroundColor)),textAlign:g(N.map(k=>i.value==="cells"?k.align:k.textAlign)),verticalAlign:g(N.map(k=>i.value==="cells"?k.valign:k.verticalAlign)),bold:O.every(Boolean)?!0:O.some(Boolean)?Ce:!1,underline:A.map(k=>h(k,"underline")).every(Boolean)?!0:A.some(k=>h(k,"underline"))?Ce:!1,strike:A.map(k=>h(k,"line-through")).every(Boolean)?!0:A.some(k=>h(k,"line-through"))?Ce:!1}});function C(N){const O=d.value;O.length&&(O.forEach(N),n())}function v(N){if(i.value==="cells"){C(x=>{"fontFamily"in N&&(x.fontFamily=N.fontFamily),"fontSize"in N&&(x.fontSize=N.fontSize),"color"in N&&(x.color=N.color),"backgroundColor"in N&&(x.backgroundColor=N.backgroundColor),"textAlign"in N&&(x.align=N.textAlign),"verticalAlign"in N&&(x.valign=N.verticalAlign)});return}const O=m.value,A=l.value,z=["fontFamily","fontSize","color","textAlign","verticalAlign"].some(x=>x in N),u="backgroundColor"in N;!(O.length&&z)&&!(A.length&&u)||(O.forEach(x=>{const Y=x.options;"fontFamily"in N&&(Y.fontFamily=N.fontFamily),"fontSize"in N&&(Y.fontSize=N.fontSize),"color"in N&&(Y.color=N.color),"textAlign"in N&&(Y.textAlign=N.textAlign),"verticalAlign"in N&&(Y.verticalAlign=N.verticalAlign)}),u&&A.forEach(x=>{x.options.backgroundColor=N.backgroundColor}),n())}function p(){if(i.value==="cells"){const A=R.value.bold!==!0;C(k=>{k.fontWeight=A?"bold":void 0});return}const N=R.value.bold!==!0,O=m.value;O.length&&(O.forEach(A=>{A.options.fontWeight=N?"bold":"normal"}),n())}function B(N){if(i.value==="cells")return;const O=m.value;if(!O.length)return;const A=R.value[N==="underline"?"underline":"strike"]!==!0;O.forEach(k=>{const z=(k.options.textDecoration??"").split(/\s+/).filter(Boolean),u=z.indexOf(N);A&&u<0&&z.push(N),!A&&u>=0&&z.splice(u,1),k.options.textDecoration=z.length?z.join(" "):void 0}),n()}const _=()=>B("underline"),ne=()=>B("line-through");function G(N,O){const A=l.value;A.length&&(A.forEach(k=>{k.options.borders=void 0,N==="none"?k.options.borderWidth=0:(k.options.borderWidth=O.width,k.options.borderStyle=O.style,k.options.borderColor=O.color)}),n())}function J(N,O){const A=s.value,k=a.value?.options.tableRows;!A||!k||(E.applyBorderPreset(k,{r1:A.r1,c1:A.c1,r2:A.r2,c2:A.c2},N,O),n())}function b(N,O,A){C(k=>{const z={...k.borders??{}};for(const u of N)A?z[u]={...O}:delete z[u];k.borders=z})}const W=["top","right","bottom","left"],j=e.computed(()=>{if(i.value!=="cells")return null;const N=d.value;if(!N.length)return null;const O={};for(const A of W){const k=N.map(z=>!!z.borders?.[A]);O[A]=k.every(Boolean)?!0:k.some(Boolean)?Ce:!1}return O});function U(N,O){const A=j.value?.[N]!==!0;b([N],O,A)}const y=e.computed(()=>{if(i.value!=="elements")return null;const N=l.value;if(!N.length)return null;const O={};for(const A of W){const k=N.map(z=>!!z.options.borders?.[A]);O[A]=k.every(Boolean)?!0:k.some(Boolean)?Ce:!1}return O});function M(N,O){const A=l.value;if(!A.length)return;const k=y.value?.[N]!==!0;A.forEach(z=>{const u={...z.options.borders??{}};k?u[N]={width:O.width,style:O.style,color:O.color}:delete u[N],z.options.borders=u}),n()}return{context:i,fontEditable:c,values:R,applyStyle:v,toggleBold:p,toggleUnderline:_,toggleStrike:ne,applyElementBorder:G,applyCellBorderPreset:J,applyCellBorderEdges:b,cellEdges:j,toggleCellEdge:U,elementEdges:y,toggleElementEdge:M}}const Xt=["fontFamily","fontSize","fontWeight","color","textAlign","verticalAlign","textDecoration"];function Zt(o){const{elements:r,selectedIds:t,recordHistory:s}=o,n=e.ref(!1),l=e.ref(!1),a=e.ref(null);let i=null;const d=e.computed(()=>r.value.filter(C=>t.value.has(C.id)&&!C.options.locked)),m=e.computed(()=>d.value.length===1);function c(C){if(!C)return;const v={};for(const p of E.ELEMENT_BORDER_SIDES){const B=C[p];B&&(v[p]={...B})}return v}function f(C=!1){const v=d.value[0];if(!v)return!1;const p=v.options,B=v.printElementType.type;return i={text:pt.has(B)?Object.fromEntries(Xt.map(_=>[_,p[_]])):null,backgroundColor:p.backgroundColor,border:E.acceptsElementBorder(B)?{borderWidth:p.borderWidth,borderStyle:p.borderStyle,borderColor:p.borderColor,borders:c(p.borders)}:null},a.value=v.id,n.value=!0,l.value=C,!0}function g(){n.value=!1,l.value=!1,a.value=null,i=null}function h(C){const v=i;if(!v||C.options.locked||C.id===a.value)return!1;const p=C.options,B=C.printElementType.type;return v.text&&pt.has(B)&&Object.assign(p,v.text),p.backgroundColor=v.backgroundColor,v.border&&E.acceptsElementBorder(B)&&(p.borderWidth=v.border.borderWidth,p.borderStyle=v.border.borderStyle,p.borderColor=v.border.borderColor,p.borders=c(v.border.borders)),!0}e.watch(t,()=>{if(!n.value||!i)return;const C=d.value;if(!C.length){g();return}let v=!1;C.forEach(p=>{v=h(p)||v}),v&&(s(),l.value||g())});function R(C){if(C.key!=="Escape"||!n.value)return;const v=C.target?.tagName;v==="INPUT"||v==="TEXTAREA"||v==="SELECT"||g()}return document.addEventListener("keydown",R),e.onScopeDispose(()=>document.removeEventListener("keydown",R)),{active:n,locked:l,sourceId:a,capturable:m,capture:f,cancel:g}}let Vt=0;function Jt(){return Vt+=1,`guide-${Vt}`}function Qt(o,r){const t=e.computed(()=>o.value.guides??[]);function s(d){o.value={...o.value,guides:d([...o.value.guides??[]])},r()}function n(d,m){s(c=>(c.push({type:d,position:m,id:Jt()}),c))}function l(d,m){s(c=>c.map(f=>f.id===d?{...f,position:m}:f))}function a(d){s(m=>m.filter(c=>c.id!==d))}function i(){const d=[],m=[];for(const c of t.value)c.type==="vertical"?d.push(c.position):m.push(c.position);return{vertical:d,horizontal:m}}return{guides:t,addGuide:n,moveGuide:l,removeGuide:a,getGuidePositions:i}}const He=Symbol("table-edit"),vt=Symbol("print-upload-image"),ft=Symbol("print-upload-design-background"),gt=Symbol("print-font-catalog"),_t=e.computed(()=>[]);function eo(o){return{catalog:e.computed(()=>{const t=[],s=new Set;for(const n of e.toValue(o)??[]){const l=n?.family?.trim();if(!l)continue;const a=l.toLowerCase();if(s.has(a))continue;s.add(a);const i=n.label?.trim();t.push(i?{family:l,label:i}:{family:l})}return t})}}function to(){return e.inject(gt,_t)}function Nt(o,r){const t=r?.trim().toLowerCase();if(t)return o.find(s=>s.family.trim().toLowerCase()===t)}function wt(o){return o.label?`${o.label}(${o.family})`:o.family}function Fe(o){return o.toLowerCase().replace(/\s+/g,"")}function Ct(o,r){if(o===r)return 0;if(o.startsWith(r))return 1;if(o.includes(r))return 2;let t=0;for(const s of o)if(s===r[t]&&t++,t===r.length)return 3;return-1}function oo(o,r){const t=Fe(r.trim());return t?o.map((s,n)=>({font:s,index:n,rank:no(s,t)})).filter(s=>s.rank>=0).sort((s,n)=>s.rank-n.rank||s.index-n.index).map(s=>s.font):[...o]}function no(o,r){const t=Ct(Fe(o.family),r);if(!o.label)return t;const s=Ct(Fe(o.label),r);return t<0?s:s<0?t:Math.min(t,s)}const lo="print-designer-font-face";function ao(o){const r=`${lo}-${e.useId()}`;let t;e.watchEffect(()=>{const s=e.toValue(o);if(!s){t?.remove(),t=void 0;return}t||(t=document.createElement("style"),t.id=r,document.head.appendChild(t)),t.textContent=s}),e.onUnmounted(()=>{t?.remove(),t=void 0})}const io=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]=s=>r.$emit("click"))},[...t[1]||(t[1]=[e.createElementVNode("span",{class:"help-icon"},"?",-1)])]))}}),ce=(o,r)=>{const t=o.__vccOpts||o;for(const[s,n]of r)t[s]=n;return t},ro=ce(io,[["__scopeId","data-v-80ccab03"]]),so=["disabled","data-test","data-tip"],co=e.defineComponent({__name:"ToolbarDropdown",props:{disabled:{type:Boolean,default:!1},testId:{default:"dd-trigger"},tip:{},panelClass:{}},setup(o){const r=o,t=e.ref(!1),s=e.ref(null);function n(l){t.value&&(s.value?.contains(l.target)||(t.value=!1))}return e.watch(()=>r.disabled,l=>{l&&(t.value=!1)}),e.onMounted(()=>document.addEventListener("pointerdown",n)),e.onUnmounted(()=>document.removeEventListener("pointerdown",n)),(l,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapRef",ref:s,class:"tb-dd"},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["tb-dd-trigger",{on:t.value}]),disabled:o.disabled,"data-test":o.testId,"data-tip":o.tip,onClick:a[0]||(a[0]=i=>t.value=!t.value)},[e.renderSlot(l.$slots,"trigger",{},void 0,!0),e.createVNode(e.unref(ie.ChevronDown),{size:12,class:e.normalizeClass(["tb-dd-arrow",{up:t.value}])},null,8,["class"])],10,so),t.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["tb-dd-panel",o.panelClass])},[e.renderSlot(l.$slots,"default",{},void 0,!0)],2)):e.createCommentVNode("",!0)],512))}}),Ze=ce(co,[["__scopeId","data-v-74fd00c6"]]),uo={class:"designer-toolbar"},mo={class:"tb-group"},po={class:"tb-title"},vo={class:"tb-title-name"},fo={class:"tb-group"},go=["disabled"],ho=["disabled"],bo={class:"tb-group"},Eo={class:"tb-menu","data-test":"arrange-panel"},yo={class:"tb-menu-grid"},ko=["disabled"],Vo=["disabled"],No=["disabled"],wo=["disabled"],Co=["disabled"],So=["disabled"],xo=["disabled"],$o=["disabled"],Bo={class:"tb-menu-grid"},Do=["disabled"],To=["disabled"],Mo=["disabled"],zo=["disabled"],Ao={class:"tb-menu-grid"},Po=["disabled"],Ro=["disabled"],Lo={class:"tb-menu tb-menu-rows","data-test":"view-panel"},Uo={class:"tb-group"},Io={class:"tb-zoom"},Fo={class:"tb-group"},Ho=["disabled","data-tip"],Oo=["disabled","data-tip"],Wo=["disabled","data-tip"],Go={key:0,class:"tb-group"},Ko={class:"tb-group"},qo=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},showHelp:{type:Boolean,default:!0},clipboardDisabled:{type:Boolean,default:!0},hasClipboard:{type:Boolean,default:!1}},{scale:{default:100},scaleModifiers:{}}),emits:e.mergeModels(["preview","save","undo","redo","align","move-layer","toggle-ruler","toggle-grid","toggle-snap","toggle-table-ghost-border","group","ungroup","fit-window","zoom","help","copy","paste","delete"],["update:scale"]),setup(o){const r=e.useModel(o,"scale"),t=o,s=e.computed(()=>t.clipboardDisabled?"粘贴 (Ctrl+V),需选中元素":t.hasClipboard?"粘贴 (Ctrl+V)":"粘贴 (Ctrl+V),剪贴板为空");return(n,l)=>(e.openBlock(),e.createElementBlock("div",uo,[e.createElementVNode("div",mo,[l[30]||(l[30]=e.createStaticVNode('<span class="tb-mark" aria-hidden="true" data-v-019401e4><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-019401e4><rect x="5" y="3" width="14" height="18" rx="2.5" data-v-019401e4></rect><line x1="8.5" y1="8.5" x2="15.5" y2="8.5" data-v-019401e4></line><line x1="8.5" y1="12.5" x2="15.5" y2="12.5" data-v-019401e4></line><line x1="8.5" y1="16.5" x2="12.5" y2="16.5" data-v-019401e4></line></svg></span>',1)),e.createElementVNode("div",po,[e.createElementVNode("span",vo,e.toDisplayString(o.isEdit?"编辑模板":"新建模板"),1),l[29]||(l[29]=e.createElementVNode("span",{class:"tb-title-sub"},"打印模板设计器",-1))])]),e.createElementVNode("div",fo,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.canUndo,onClick:l[0]||(l[0]=a=>n.$emit("undo")),"data-tip":"撤销"},[e.createVNode(e.unref(ie.Undo2),{size:15})],8,go),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.canRedo,onClick:l[1]||(l[1]=a=>n.$emit("redo")),"data-tip":"重做"},[e.createVNode(e.unref(ie.Redo2),{size:15})],8,ho)]),e.renderSlot(n.$slots,"default",{},void 0,!0),e.createElementVNode("div",bo,[e.createVNode(Ze,{"test-id":"arrange-dd",tip:"排列"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie.Layers),{size:15}),l[31]||(l[31]=e.createElementVNode("span",{class:"tb-btn-text"},"排列",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Eo,[l[32]||(l[32]=e.createElementVNode("div",{class:"tb-menu-label"},"对齐 / 分布",-1)),e.createElementVNode("div",yo,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[2]||(l[2]=a=>n.$emit("align","left")),"data-tip":"左对齐"},[e.createVNode(e.unref(ie.AlignStartVertical),{size:15})],8,ko),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[3]||(l[3]=a=>n.$emit("align","right")),"data-tip":"右对齐"},[e.createVNode(e.unref(ie.AlignEndVertical),{size:15})],8,Vo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[4]||(l[4]=a=>n.$emit("align","top")),"data-tip":"顶对齐"},[e.createVNode(e.unref(ie.AlignStartHorizontal),{size:15})],8,No),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[5]||(l[5]=a=>n.$emit("align","bottom")),"data-tip":"底对齐"},[e.createVNode(e.unref(ie.AlignEndHorizontal),{size:15})],8,wo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[6]||(l[6]=a=>n.$emit("align","vertical")),"data-tip":"水平居中"},[e.createVNode(e.unref(ie.AlignCenterVertical),{size:15})],8,Co),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[7]||(l[7]=a=>n.$emit("align","horizontal")),"data-tip":"垂直居中"},[e.createVNode(e.unref(ie.AlignCenterHorizontal),{size:15})],8,So),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[8]||(l[8]=a=>n.$emit("align","distributeHor")),"data-tip":"水平分布"},[e.createVNode(e.unref(ie.AlignHorizontalSpaceBetween),{size:15})],8,xo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[9]||(l[9]=a=>n.$emit("align","distributeVer")),"data-tip":"垂直分布"},[e.createVNode(e.unref(ie.AlignVerticalSpaceBetween),{size:15})],8,$o)]),l[33]||(l[33]=e.createElementVNode("div",{class:"tb-menu-label"},"层级",-1)),e.createElementVNode("div",Bo,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasSelection,onClick:l[10]||(l[10]=a=>n.$emit("move-layer","top")),"data-tip":"置顶"},[e.createVNode(e.unref(ie.ArrowUpToLine),{size:15})],8,Do),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasSelection,onClick:l[11]||(l[11]=a=>n.$emit("move-layer","up")),"data-tip":"上移一层"},[e.createVNode(e.unref(ie.ArrowUp),{size:15})],8,To),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasSelection,onClick:l[12]||(l[12]=a=>n.$emit("move-layer","down")),"data-tip":"下移一层"},[e.createVNode(e.unref(ie.ArrowDown),{size:15})],8,Mo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasSelection,onClick:l[13]||(l[13]=a=>n.$emit("move-layer","bottom")),"data-tip":"置底"},[e.createVNode(e.unref(ie.ArrowDownToLine),{size:15})],8,zo)]),l[34]||(l[34]=e.createElementVNode("div",{class:"tb-menu-label"},"组合",-1)),e.createElementVNode("div",Ao,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.hasMultiSelection,onClick:l[14]||(l[14]=a=>n.$emit("group")),"data-tip":"组合 (Ctrl+G)"},[e.createVNode(e.unref(ie.Group),{size:15})],8,Po),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!o.selectedElementHasGroup,onClick:l[15]||(l[15]=a=>n.$emit("ungroup")),"data-tip":"取消组合 (Ctrl+Shift+G)"},[e.createVNode(e.unref(ie.Ungroup),{size:15})],8,Ro)])])]),_:1}),e.createVNode(Ze,{"test-id":"view-dd",tip:"视图"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie.Eye),{size:15}),l[35]||(l[35]=e.createElementVNode("span",{class:"tb-btn-text"},"视图",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Lo,[e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:o.showRuler}]),"data-tip":"显示/隐藏标尺",onClick:l[16]||(l[16]=a=>n.$emit("toggle-ruler"))},[...l[36]||(l[36]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 标尺 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:o.showGrid}]),"data-tip":"显示/隐藏网格背景",onClick:l[17]||(l[17]=a=>n.$emit("toggle-grid"))},[...l[37]||(l[37]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 网格 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:o.showTableGhostBorder}]),"data-tip":"显示/隐藏无边框表格的虚拟虚线",onClick:l[18]||(l[18]=a=>n.$emit("toggle-table-ghost-border"))},[...l[38]||(l[38]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 虚框 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:o.snapToGrid}]),"data-tip":"开启/关闭元素吸附到网格",onClick:l[19]||(l[19]=a=>n.$emit("toggle-snap"))},[...l[39]||(l[39]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 吸附 ",-1)])],2)])]),_:1})]),e.createElementVNode("div",Uo,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:l[20]||(l[20]=a=>n.$emit("fit-window")),"data-tip":"适应窗口"},[e.createVNode(e.unref(ie.Maximize),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:l[21]||(l[21]=a=>n.$emit("zoom",-10)),"data-tip":"缩小"},[e.createVNode(e.unref(ie.ZoomOut),{size:15})]),e.createElementVNode("span",Io,e.toDisplayString(r.value)+"%",1),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:l[22]||(l[22]=a=>n.$emit("zoom",10)),"data-tip":"放大"},[e.createVNode(e.unref(ie.ZoomIn),{size:15})])]),e.createElementVNode("div",Fo,[e.createElementVNode("button",{class:"tb-btn tb-icon","data-test":"copy",disabled:o.clipboardDisabled,onClick:l[23]||(l[23]=a=>n.$emit("copy")),"data-tip":o.clipboardDisabled?"复制 (Ctrl+C),需选中元素":"复制 (Ctrl+C)"},[e.createVNode(e.unref(ie.Copy),{size:15})],8,Ho),e.createElementVNode("button",{class:"tb-btn tb-icon","data-test":"paste",disabled:o.clipboardDisabled||!o.hasClipboard,onClick:l[24]||(l[24]=a=>n.$emit("paste")),"data-tip":s.value},[e.createVNode(e.unref(ie.ClipboardPaste),{size:15})],8,Oo),e.createElementVNode("button",{class:"tb-btn tb-icon danger","data-test":"delete",disabled:o.clipboardDisabled,onClick:l[25]||(l[25]=a=>n.$emit("delete")),"data-tip":o.clipboardDisabled?"删除 (Delete),需选中元素":"删除 (Delete)"},[e.createVNode(e.unref(ie.Trash2),{size:15})],8,Wo)]),l[40]||(l[40]=e.createElementVNode("div",{class:"tb-spacer"},null,-1)),o.showHelp?(e.openBlock(),e.createElementBlock("div",Go,[e.createVNode(ro,{onClick:l[26]||(l[26]=a=>n.$emit("help"))})])):e.createCommentVNode("",!0),e.createElementVNode("div",Ko,[e.createElementVNode("button",{class:"btn-secondary","data-tip":"预览模板打印效果",onClick:l[27]||(l[27]=a=>n.$emit("preview"))},"预览"),e.createElementVNode("button",{class:"btn-primary","data-tip":"保存模板",onClick:l[28]||(l[28]=a=>n.$emit("save"))},"保存")])]))}}),Yo=ce(qo,[["__scopeId","data-v-019401e4"]]),jo={class:"font-select"},Xo=["placeholder","disabled","aria-expanded","aria-activedescendant","onKeydown"],Zo=["id","aria-selected","onMousedown"],Jo=e.defineComponent({__name:"FontSelect",props:{modelValue:{},placeholder:{default:"默认"},disabled:{type:Boolean,default:!1}},emits:["update:model-value"],setup(o,{emit:r}){const t=o,s=r,n=to(),l=`font-select-list-${e.useId()}`,a=e.ref(null),i=e.ref(R(t.modelValue)),d=e.ref(""),m=e.ref(!1),c=e.ref(-1),f=e.computed(()=>{const j=t.modelValue?.trim();return j?Nt(n.value,j)?"":j:""}),g=e.computed(()=>{const j=(t.modelValue??"").trim(),U=(N,O,A,k)=>({kind:N,key:O,label:A,value:k,selected:(k??"")===j}),y=d.value.trim();if(!y){const N=[U("clear","__clear__",t.placeholder)];f.value&&N.push(U("unknown","__unknown__",`${f.value}(未知)`,f.value));for(const O of n.value)N.push(U("font",O.family,wt(O),O.family));return N}const M=oo(n.value,y).map(N=>U("font",N.family,wt(N),N.family));if(!M.length){const N=h(y);M.push(U("free","__free__",`使用「${N}」`,N))}return M});function h(j){const U=Fe(j);return n.value.find(M=>M.label&&Fe(M.label)===U)?.family??j}function R(j){const U=j?.trim();return U?Nt(n.value,U)?.label??U:""}const C=e.computed(()=>m.value&&c.value>=0?`${l}-${c.value}`:void 0);function v(){const j=(t.modelValue??"").trim();return g.value.findIndex(U=>(U.value??"")===j)}function p(){m.value||(m.value=!0,d.value="",c.value=v())}function B(){m.value=!0}function _(){m.value=!0,d.value=i.value,c.value=g.value.length?0:-1}function ne(j){if(!m.value){p();return}const U=g.value.length-1;U<0||(c.value=Math.min(Math.max(c.value+j,0),U),G())}function G(){e.nextTick(()=>{a.value?.children[c.value]?.scrollIntoView?.({block:"nearest"})})}function J(){if(!m.value)return;const j=g.value[c.value];if(j){b(j);return}const U=d.value.trim();if(U){const y=h(U);b({value:y})}}function b(j){i.value=R(j.value),d.value="",m.value=!1,c.value=-1,s("update:model-value",j.value)}function W(){m.value=!1,d.value="",c.value=-1,i.value=R(t.modelValue)}return e.watch(()=>t.modelValue,j=>{i.value=R(j)}),(j,U)=>(e.openBlock(),e.createElementBlock("div",jo,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":U[0]||(U[0]=y=>i.value=y),class:"pd-input font-select-input",type:"text",role:"combobox","aria-autocomplete":"list",autocomplete:"off",placeholder:o.placeholder,disabled:o.disabled,"aria-expanded":m.value,"aria-controls":l,"aria-activedescendant":C.value,onFocus:p,onClick:B,onInput:_,onKeydown:[U[1]||(U[1]=e.withKeys(e.withModifiers(y=>ne(1),["prevent"]),["down"])),U[2]||(U[2]=e.withKeys(e.withModifiers(y=>ne(-1),["prevent"]),["up"])),e.withKeys(e.withModifiers(J,["prevent"]),["enter"]),e.withKeys(e.withModifiers(W,["prevent"]),["esc"])],onBlur:W},null,40,Xo),[[e.vModelText,i.value]]),m.value?(e.openBlock(),e.createElementBlock("ul",{key:0,id:l,ref_key:"listRef",ref:a,class:"font-select-list",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(y,M)=>(e.openBlock(),e.createElementBlock("li",{id:`${l}-${M}`,key:y.key,class:e.normalizeClass(["font-select-option",{"is-active":M===c.value,"is-muted":y.kind==="unknown"||y.kind==="free"}]),role:"option","aria-selected":y.selected,onMousedown:e.withModifiers(N=>b(y),["prevent"])},e.toDisplayString(y.label),43,Zo))),128))],512)):e.createCommentVNode("",!0)]))}}),ht=ce(Jo,[["__scopeId","data-v-f1aae453"]]),Qo={class:"pd-stepper"},_o=["disabled"],en=["value","placeholder","min","max","step","disabled"],tn=["disabled"],on=e.defineComponent({__name:"StepperInput",props:{modelValue:{},min:{},max:{},step:{default:1},placeholder:{},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(o,{emit:r}){const t=o,s=r,n=e.computed(()=>{const C=String(t.step),v=C.indexOf(".");return v===-1?0:C.length-v-1});function l(C){return Number.isFinite(C)?Number(C.toFixed(n.value)):0}const a=e.computed(()=>{const C=t.modelValue;if(!(C==null||!Number.isFinite(C)))return l(C)}),i=e.ref(a.value===void 0?"":String(a.value));e.watch(a,C=>{i.value=C===void 0?"":String(C)});const d=e.computed(()=>a.value!==void 0?a.value:t.min!==void 0?t.min:0),m=e.computed(()=>t.min!==void 0&&d.value<=t.min),c=e.computed(()=>t.max!==void 0&&d.value>=t.max);function f(C){let v=l(C);return t.min!==void 0&&v<t.min&&(v=t.min),t.max!==void 0&&v>t.max&&(v=t.max),v}function g(C){if(C<0&&m.value||C>0&&c.value)return;const v=f(d.value+C*t.step);i.value=String(v),s("update:modelValue",v)}function h(C){i.value=C.target.value}function R(){const C=i.value.trim();if(C===""){a.value!==void 0&&(i.value=String(a.value));return}const v=Number(C);if(!Number.isFinite(v)){i.value=a.value===void 0?"":String(a.value);return}const p=f(v);i.value=String(p),p!==a.value&&s("update:modelValue",p)}return(C,v)=>(e.openBlock(),e.createElementBlock("div",Qo,[e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:m.value||o.disabled,title:"减小","aria-label":"减小",onClick:v[0]||(v[0]=p=>g(-1))},"−",8,_o),e.createElementVNode("input",{type:"number",class:"pd-input pd-step-input",value:i.value,placeholder:o.placeholder,min:o.min,max:o.max,step:o.step,disabled:o.disabled,onInput:h,onChange:R,onBlur:R,onKeydown:v[1]||(v[1]=e.withKeys(e.withModifiers(p=>p.target.blur(),["prevent"]),["enter"]))},null,40,en),e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:c.value||o.disabled,title:"增大","aria-label":"增大",onClick:v[2]||(v[2]=p=>g(1))},"+",8,tn)]))}}),re=ce(on,[["__scopeId","data-v-627f09cb"]]),nn=["aria-expanded","title"],ln={class:"picker-preview"},an={class:"picker-heading"},rn=["disabled"],sn={class:"preset-color-grid"},dn=["title","aria-label","onClick"],cn=e.defineComponent({__name:"PresetColorPicker",props:{modelValue:{},clearable:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(o,{emit:r}){const t=o,s=r,n=e.ref(!1),l=e.ref(),a=e.ref(),i=e.ref(),d=e.ref({}),m=e.ref(0),c=e.ref(0),f=e.ref(0),g=e.ref("#000000"),h=e.ref(!1),R=e.computed(()=>t.modelValue||"#000000"),C=e.computed(()=>t.modelValue?{background:t.modelValue}:{background:"transparent"}),v=e.computed(()=>Y(ge(m.value,c.value,f.value))),p=e.computed({get:()=>Math.round(m.value),set:q=>J(fe(q),c.value,f.value)});e.watch(()=>t.modelValue,q=>{if(!q){g.value="";return}G(q)},{immediate:!0});function B(q){g.value=q.toUpperCase(),G(q),s("update:modelValue",q)}function _(){t.clearable&&s("update:modelValue","")}function ne(q){const D=q.target.value.trim();if(!D){t.clearable&&s("update:modelValue","");return}u(D)&&(G(D),s("update:modelValue",x(D)))}function G(q){const S=u(q);if(!S)return;const D=be(S.r,S.g,S.b);m.value=D.h,c.value=D.s,f.value=D.v,g.value=x(q).toUpperCase()}function J(q,S,D){m.value=fe(q),c.value=se(S),f.value=se(D),g.value=v.value.toUpperCase(),s("update:modelValue",v.value)}function b(q){q.currentTarget.setPointerCapture(q.pointerId),h.value=!0,U(q)}function W(q){h.value&&U(q)}function j(q){h.value=!1;const S=q.currentTarget;S.hasPointerCapture(q.pointerId)&&S.releasePointerCapture(q.pointerId)}function U(q){const S=i.value;if(!S)return;const D=S.getBoundingClientRect(),K=se((q.clientX-D.left)/D.width),Z=se(1-(q.clientY-D.top)/D.height);J(m.value,K,Z)}function y(q){const S=q.shiftKey?.1:.02;let D=!0;q.key==="ArrowLeft"?J(m.value,c.value-S,f.value):q.key==="ArrowRight"?J(m.value,c.value+S,f.value):q.key==="ArrowUp"?J(m.value,c.value,f.value+S):q.key==="ArrowDown"?J(m.value,c.value,f.value-S):D=!1,D&&q.preventDefault()}function M(){n.value?O():N()}async function N(){const q=l.value;if(!q)return;t.modelValue&&G(R.value),n.value=!0,await e.nextTick();const S=q.getBoundingClientRect(),D=190,K=a.value?.offsetHeight??216,Z=8,te=Math.min(S.left,window.innerWidth-D-Z),pe=S.bottom+6,T=pe+K>window.innerHeight-Z?Math.max(Z,S.top-K-6):pe;d.value={left:`${Math.max(Z,te)}px`,top:`${T}px`}}function O(){n.value=!1}function A(q){const S=q.target;l.value?.contains(S)||a.value?.contains(S)||O()}function k(){n.value&&O()}function z(q){q.key==="Escape"&&n.value&&O()}function u(q){const S=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(q.trim());if(!S)return null;const D=S[1],K=D.length===3?D.split("").map(Z=>Z+Z).join(""):D;return{r:Number.parseInt(K.slice(0,2),16),g:Number.parseInt(K.slice(2,4),16),b:Number.parseInt(K.slice(4,6),16)}}function x(q){const S=u(q);return S?Y(S):"#000000"}function Y({r:q,g:S,b:D}){return`#${[q,S,D].map(K=>Math.round(se(K/255)*255).toString(16).padStart(2,"0")).join("")}`}function be(q,S,D){const K=q/255,Z=S/255,te=D/255,pe=Math.max(K,Z,te),T=Math.min(K,Z,te),$=pe-T;let I=0;return $!==0&&(pe===K?I=(Z-te)/$%6:pe===Z?I=(te-K)/$+2:I=(K-Z)/$+4,I*=60,I<0&&(I+=360)),{h:I,s:pe===0?0:$/pe,v:pe}}function ge(q,S,D){const K=D*S,Z=(q%360+360)%360/60,te=K*(1-Math.abs(Z%2-1)),[pe,T,$]=Z<1?[K,te,0]:Z<2?[te,K,0]:Z<3?[0,K,te]:Z<4?[0,te,K]:Z<5?[te,0,K]:[K,0,te],I=D-K;return{r:(pe+I)*255,g:(T+I)*255,b:($+I)*255}}function fe(q){return((Number.isFinite(q)?q:0)%360+360)%360}function se(q){return Math.min(1,Math.max(0,Number.isFinite(q)?q:0))}return e.onMounted(()=>{document.addEventListener("pointerdown",A,!0),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),document.addEventListener("keydown",z)}),e.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",A,!0),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),document.removeEventListener("keydown",z)}),(q,S)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("button",{ref_key:"triggerRef",ref:l,type:"button",class:"preset-color-trigger","aria-expanded":n.value,"aria-haspopup":"dialog",title:o.modelValue||"自动",onClick:M},[e.createElementVNode("span",{class:"preset-color-swatch",style:e.normalizeStyle(C.value)},null,4)],8,nn),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"panelRef",ref:a,class:"preset-color-panel",role:"dialog","aria-label":"颜色选择",style:e.normalizeStyle(d.value),onPointerdown:S[2]||(S[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",ln,[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":S[0]||(S[0]=D=>g.value=D),class:"picker-hex",type:"text",maxlength:"7",spellcheck:"false","aria-label":"颜色值",onInput:ne},null,544),[[e.vModelText,g.value]])]),e.createElementVNode("div",{ref_key:"areaRef",ref:i,class:"picker-area",style:e.normalizeStyle({"--picker-hue":`${Math.round(m.value)}deg`}),"aria-label":"自定义颜色",tabindex:"0",onPointerdown:b,onPointermove:W,onPointerup:j,onPointercancel:j,onKeydown:y},[e.createElementVNode("span",{class:"picker-handle",style:e.normalizeStyle({left:`${c.value*100}%`,top:`${(1-f.value)*100}%`,background:v.value})},null,4)],36),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S[1]||(S[1]=D=>p.value=D),class:"picker-hue",type:"range",min:"0",max:"360",step:"1","aria-label":"色相"},null,512),[[e.vModelText,p.value,void 0,{number:!0}]]),e.createElementVNode("div",an,[S[4]||(S[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:_},[...S[3]||(S[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,rn)):e.createCommentVNode("",!0)]),e.createElementVNode("div",sn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E.PRESET_COLORS),D=>(e.openBlock(),e.createElementBlock("button",{key:D,type:"button",class:e.normalizeClass(["preset-color-item",{active:!!o.modelValue&&D.toLowerCase()===o.modelValue.toLowerCase()}]),style:e.normalizeStyle({background:D}),title:D,"aria-label":D,onClick:K=>B(D)},null,14,dn))),128))])],36)):e.createCommentVNode("",!0)]))],64))}}),Ne=ce(cn,[["__scopeId","data-v-12290e7e"]]),un={class:"format-toolbar"},mn={class:"ft-group"},pn=["disabled","data-tip"],vn={class:"ft-group"},fn={class:"ft-font"},gn={class:"ft-size","data-test":"font-size"},hn={class:"ft-group"},bn=["disabled","data-tip"],En=["disabled","data-tip"],yn=["disabled","data-tip"],kn={class:"ft-group"},Vn=["title"],Nn={class:"ft-glyph"},wn={class:"ft-group"},Cn={class:"ft-align-panel","data-test":"align-panel"},Sn={class:"ft-align-row"},xn={class:"ft-align-row"},$n={class:"ft-group"},Bn={class:"ft-border-panel","data-test":"border-panel"},Dn={class:"ft-border-grid"},Tn=["disabled","data-tip"],Mn={class:"ft-style-row"},zn=["data-test","data-tip","onClick"],An={class:"ft-border-style-row"},Pn={class:"ft-line-width"},Rn={class:"ft-border-style-row"},Ln=e.defineComponent({__name:"FormatToolbar",props:{format:{},painter:{}},setup(o){const r=o,t=e.computed(()=>r.format.values.value),s=e.computed(()=>!r.format.fontEditable.value),n=e.computed(()=>s.value||r.format.context.value==="cells"),l=e.computed(()=>r.format.context.value==="none"),a=e.computed(()=>r.painter?.active.value===!0),i=e.computed(()=>!r.painter||!a.value&&(r.format.context.value==="none"||r.format.context.value==="cells"||!r.painter.capturable.value)),d=e.computed(()=>a.value?"退出格式刷(Esc)":r.painter?r.format.context.value==="cells"?"格式刷(表格单元格暂不支持)":r.format.context.value==="none"?"格式刷(需选中元素)":r.painter.capturable.value?"格式刷:单击刷一次,双击连续刷":"格式刷(请仅选中一个源元素)":"格式刷");function m(){const A=r.painter;if(A){if(A.active.value){A.cancel();return}A.capture(!1)}}function c(){r.painter?.capture(!0)}const f=e.computed(()=>t.value.fontFamily===Ce?void 0:t.value.fontFamily),g=e.computed(()=>t.value.fontFamily===Ce?"混合":"默认"),h=e.computed(()=>t.value.fontSize===Ce?void 0:t.value.fontSize),R=e.computed(()=>t.value.fontSize===Ce?"混合":"默认"),C=e.computed(()=>t.value.bold===!0),v=e.computed(()=>t.value.color===Ce?void 0:t.value.color),p=e.computed(()=>t.value.backgroundColor===Ce?void 0:t.value.backgroundColor),B=e.computed(()=>t.value.textAlign==="center"?ie.TextAlignCenter:t.value.textAlign==="right"?ie.TextAlignEnd:ie.TextAlignStart),_=e.computed(()=>s.value?"对齐(需选中文本元素或单元格)":"对齐"),ne=e.computed(()=>l.value?"边框(需选中元素)":"边框");function G(A){return s.value?`${A}(需选中文本元素)`:r.format.context.value==="cells"?`${A}(单元格不支持)`:A}const J=e.ref("solid"),b=e.ref(.75),W=e.ref("#333333"),j=e.computed(()=>r.format.context.value==="cells"),U=[{key:"solid",label:"实线",preview:"2px solid currentColor"},{key:"dashed",label:"虚线",preview:"2px dashed currentColor"},{key:"dotted",label:"点线",preview:"2px dotted currentColor"},{key:"double",label:"双线",preview:"3px double currentColor"}];function y(){return{width:b.value,style:J.value,color:W.value}}function M(A){j.value?r.format.applyCellBorderPreset(A,y()):r.format.applyElementBorder(A==="none"?"none":"all",y())}function N(A){return(j.value?r.format.cellEdges.value:r.format.elementEdges.value)?.[A]===!0}function O(A){j.value?r.format.toggleCellEdge(A,y()):r.format.toggleElementEdge(A,y())}return(A,k)=>(e.openBlock(),e.createElementBlock("div",un,[e.createElementVNode("div",mn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:a.value}]),"data-test":"format-painter",disabled:i.value,"data-tip":d.value,onClick:m,onDblclick:c},[e.createVNode(e.unref(ie.Paintbrush),{size:15})],42,pn)]),e.createElementVNode("div",vn,[e.createElementVNode("div",fn,[e.createVNode(ht,{"model-value":f.value,placeholder:g.value,disabled:s.value,"onUpdate:modelValue":k[0]||(k[0]=z=>o.format.applyStyle({fontFamily:z}))},null,8,["model-value","placeholder","disabled"])]),e.createElementVNode("div",gn,[e.createVNode(re,{"model-value":h.value,min:5,max:72,placeholder:R.value,disabled:s.value,"onUpdate:modelValue":k[1]||(k[1]=z=>o.format.applyStyle({fontSize:z}))},null,8,["model-value","placeholder","disabled"])])]),e.createElementVNode("div",hn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:C.value}]),"data-test":"bold",disabled:s.value,"data-tip":s.value?"加粗(需选中文本元素或单元格)":"加粗",onClick:k[2]||(k[2]=z=>o.format.toggleBold())},[e.createVNode(e.unref(ie.Bold),{size:15})],10,bn),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:t.value.underline===!0}]),"data-test":"underline",disabled:n.value,"data-tip":G("下划线"),onClick:k[3]||(k[3]=z=>o.format.toggleUnderline())},[e.createVNode(e.unref(ie.Underline),{size:15})],10,En),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:t.value.strike===!0}]),"data-test":"strike",disabled:n.value,"data-tip":G("删除线"),onClick:k[4]||(k[4]=z=>o.format.toggleStrike())},[e.createVNode(e.unref(ie.Strikethrough),{size:15})],10,yn)]),e.createElementVNode("div",kn,[e.createElementVNode("span",{class:e.normalizeClass(["ft-color-btn",{dim:s.value}]),title:`字体颜色${s.value?"(需选中或混选文本元素)":""}`},[e.createVNode(Ne,{"model-value":v.value,"onUpdate:modelValue":k[5]||(k[5]=z=>o.format.applyStyle({color:z}))},null,8,["model-value"]),k[23]||(k[23]=e.createElementVNode("span",{class:"ft-glyph"},"A",-1))],10,Vn),e.createElementVNode("span",{class:e.normalizeClass(["ft-color-btn",{dim:l.value}]),title:"背景色"},[e.createVNode(Ne,{"model-value":p.value,"onUpdate:modelValue":k[6]||(k[6]=z=>o.format.applyStyle({backgroundColor:z}))},null,8,["model-value"]),e.createElementVNode("span",Nn,[e.createVNode(e.unref(ie.PaintBucket),{size:14})])],2)]),e.createElementVNode("div",wn,[e.createVNode(Ze,{"test-id":"align-dd",tip:_.value,disabled:s.value},{trigger:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(B.value),{size:15})),k[24]||(k[24]=e.createElementVNode("span",{class:"ft-btn-text"},"对齐",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Cn,[e.createElementVNode("div",Sn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:t.value.textAlign==="left"}]),"data-test":"align-left","data-tip":"左对齐",onClick:k[7]||(k[7]=z=>o.format.applyStyle({textAlign:"left"}))},[e.createVNode(e.unref(ie.TextAlignStart),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:t.value.textAlign==="center"}]),"data-test":"align-center","data-tip":"水平居中",onClick:k[8]||(k[8]=z=>o.format.applyStyle({textAlign:"center"}))},[e.createVNode(e.unref(ie.TextAlignCenter),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:t.value.textAlign==="right"}]),"data-test":"align-right","data-tip":"右对齐",onClick:k[9]||(k[9]=z=>o.format.applyStyle({textAlign:"right"}))},[e.createVNode(e.unref(ie.TextAlignEnd),{size:15})],2)]),e.createElementVNode("div",xn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:t.value.verticalAlign==="top"}]),"data-test":"valign-top","data-tip":"顶端对齐",onClick:k[10]||(k[10]=z=>o.format.applyStyle({verticalAlign:"top"}))},[e.createVNode(e.unref(ie.ArrowUpToLine),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:t.value.verticalAlign==="middle"}]),"data-test":"valign-middle","data-tip":"垂直居中",onClick:k[11]||(k[11]=z=>o.format.applyStyle({verticalAlign:"middle"}))},[e.createVNode(e.unref(ie.ChevronsUpDown),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:t.value.verticalAlign==="bottom"}]),"data-test":"valign-bottom","data-tip":"底端对齐",onClick:k[12]||(k[12]=z=>o.format.applyStyle({verticalAlign:"bottom"}))},[e.createVNode(e.unref(ie.ArrowDownToLine),{size:15})],2)])])]),_:1},8,["tip","disabled"])]),e.createElementVNode("div",$n,[e.createVNode(Ze,{"test-id":"border",tip:ne.value,disabled:l.value},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie.Grid3x3),{size:15}),k[25]||(k[25]=e.createElementVNode("span",{class:"ft-btn-text"},"边框",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Bn,[e.createElementVNode("div",Dn,[e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-none","data-tip":"无边框",onClick:k[13]||(k[13]=z=>M("none"))},[...k[26]||(k[26]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"4",y1:"14",x2:"14",y2:"4"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-all","data-tip":"所有边框",onClick:k[14]||(k[14]=z=>M("all"))},[...k[27]||(k[27]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-solid",x:"2.5",y:"2.5",width:"13",height:"13",fill:"none"}),e.createElementVNode("line",{class:"g-solid",x1:"9",y1:"3",x2:"9",y2:"15"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"9",x2:"15",y2:"9"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-outer","data-tip":"外侧边框",onClick:k[15]||(k[15]=z=>M("outer"))},[...k[28]||(k[28]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-solid",x:"2.5",y:"2.5",width:"13",height:"13",fill:"none"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-inner",disabled:!j.value,"data-tip":j.value?"内部边框":"内部边框(仅表格单元格可用)",onClick:k[16]||(k[16]=z=>M("inner"))},[...k[29]||(k[29]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"9",y1:"3",x2:"9",y2:"15"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"9",x2:"15",y2:"9"})],-1)])],8,Tn),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("top")}]),"data-test":"edge-top","data-tip":"上边框",onClick:k[17]||(k[17]=z=>O("top"))},[...k[30]||(k[30]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"2",y1:"3",x2:"16",y2:"3"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("bottom")}]),"data-test":"edge-bottom","data-tip":"下边框",onClick:k[18]||(k[18]=z=>O("bottom"))},[...k[31]||(k[31]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"2",y1:"15",x2:"16",y2:"15"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("left")}]),"data-test":"edge-left","data-tip":"左边框",onClick:k[19]||(k[19]=z=>O("left"))},[...k[32]||(k[32]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"2",x2:"3",y2:"16"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:N("right")}]),"data-test":"edge-right","data-tip":"右边框",onClick:k[20]||(k[20]=z=>O("right"))},[...k[33]||(k[33]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"15",y1:"2",x2:"15",y2:"16"})],-1)])],2)]),e.createElementVNode("div",Mn,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(U,z=>e.createElementVNode("button",{key:z.key,type:"button",class:e.normalizeClass(["ft-style-btn",{on:J.value===z.key}]),"data-test":`style-${z.key}`,"data-tip":z.label,onClick:u=>J.value=z.key},[e.createElementVNode("span",{class:"ft-style-line",style:e.normalizeStyle({borderTop:z.preview})},null,4)],10,zn)),64))]),e.createElementVNode("div",An,[k[34]||(k[34]=e.createElementVNode("span",{class:"ft-edge-label"},"粗细",-1)),e.createElementVNode("div",Pn,[e.createVNode(re,{modelValue:b.value,"onUpdate:modelValue":k[21]||(k[21]=z=>b.value=z),min:.25,max:5,step:.25},null,8,["modelValue"])])]),e.createElementVNode("div",Rn,[k[35]||(k[35]=e.createElementVNode("span",{class:"ft-edge-label"},"颜色",-1)),e.createVNode(Ne,{modelValue:W.value,"onUpdate:modelValue":k[22]||(k[22]=z=>W.value=z),clearable:!1},null,8,["modelValue"])])])]),_:1},8,["tip","disabled"])])]))}}),Un=ce(Ln,[["__scopeId","data-v-83fd8dc4"]]),In={class:"layer-panel"},Fn=["onClick"],Hn={class:"layer-icon"},On={class:"layer-name"},Wn={key:0,class:"layer-zone"},Gn={class:"layer-zindex"},Kn={key:0,class:"layer-actions"},qn={key:1,class:"layer-actions"},Yn=e.defineComponent({__name:"LayerPanel",props:{elements:{},selectedIds:{}},emits:["select","move-layer","group","ungroup"],setup(o){const r=o,t=e.computed(()=>r.elements.filter(c=>r.selectedIds.has(c.id))),s=e.computed(()=>t.value.length>=2),n=e.computed(()=>t.value.some(c=>!!c.options.groupId)),l=e.computed(()=>[...r.elements].sort((c,f)=>(f.options.zIndex??0)-(c.options.zIndex??0))),a={text:"T",longText:"¶",table:"⊞",image:"🖼",barcode:"≡",qrcode:"▣",hline:"—",vline:"|",rect:"□",oval:"○",html:"<>"};function i(c){return a[c.printElementType.type]||"?"}function d(c){return c.options.title||c.printElementType.title||c.printElementType.type}function m(c){return c.zone==="header"?"页眉":c.zone==="footer"?"页脚":""}return(c,f)=>(e.openBlock(),e.createElementBlock("div",In,[f[6]||(f[6]=e.createElementVNode("div",{class:"panel-title"},"图层",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.id,class:e.normalizeClass(["layer-item",{active:o.selectedIds.has(g.id)}]),onClick:h=>c.$emit("select",g.id,h.ctrlKey||h.metaKey)},[e.createElementVNode("span",Hn,e.toDisplayString(i(g)),1),e.createElementVNode("span",On,e.toDisplayString(d(g)),1),m(g)?(e.openBlock(),e.createElementBlock("span",Wn,e.toDisplayString(m(g)),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Gn,"z:"+e.toDisplayString(g.options.zIndex??0),1)],10,Fn))),128)),l.value.length>0?(e.openBlock(),e.createElementBlock("div",Kn,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[0]||(f[0]=g=>c.$emit("move-layer","top")),title:"置顶"},[e.createVNode(e.unref(ie.ArrowUpToLine),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[1]||(f[1]=g=>c.$emit("move-layer","up")),title:"上移"},[e.createVNode(e.unref(ie.ArrowUp),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[2]||(f[2]=g=>c.$emit("move-layer","down")),title:"下移"},[e.createVNode(e.unref(ie.ArrowDown),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[3]||(f[3]=g=>c.$emit("move-layer","bottom")),title:"置底"},[e.createVNode(e.unref(ie.ArrowDownToLine),{size:14})])])):e.createCommentVNode("",!0),s.value||n.value?(e.openBlock(),e.createElementBlock("div",qn,[s.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"pd-button small",onClick:f[4]||(f[4]=g=>c.$emit("group")),title:"组合 (Ctrl+G)"},[e.createVNode(e.unref(ie.Group),{size:14})])):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"pd-button small",onClick:f[5]||(f[5]=g=>c.$emit("ungroup")),title:"取消组合 (Ctrl+Shift+G)"},[e.createVNode(e.unref(ie.Ungroup),{size:14})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),jn=ce(Yn,[["__scopeId","data-v-567d273e"]]),Xn={class:"field-tree-panel"},Zn={class:"tree-container"},Jn=["onClick"],Qn={class:"expand-icon"},_n={class:"node-icon"},el={class:"group-label"},tl=["onDragstart"],ol={class:"node-label"},nl={class:"node-key"},ll={key:0,class:"pd-empty"},al=e.defineComponent({__name:"FieldTreePanel",props:{fields:{}},emits:["field-drag"],setup(o,{emit:r}){const t=o,s=r,n=e.ref(""),l=e.ref(new Set),a=e.computed(()=>!!n.value.trim()),i=e.computed(()=>E.filterGroups(E.groupFields(t.fields),n.value));function d(c){const f=new Set(l.value);f.has(c)?f.delete(c):f.add(c),l.value=f}function m(c,f){c.dataTransfer?.setData("fieldData",JSON.stringify({fieldKey:f.fieldKey,fieldLabel:f.fieldLabel})),c.dataTransfer&&(c.dataTransfer.effectAllowed="copy"),s("field-drag",f)}return(c,f)=>(e.openBlock(),e.createElementBlock("div",Xn,[f[2]||(f[2]=e.createElementVNode("div",{class:"panel-title"},"业务字段",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[0]||(f[0]=g=>n.value=g),class:"pd-input search-input",type:"search",placeholder:"搜索字段...","aria-label":"搜索字段"},null,512),[[e.vModelText,n.value]]),e.createElementVNode("div",Zn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,g=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g.key||"_top"},[g.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["field-group-header",{"is-list":g.isList}]),onClick:h=>d(g.key)},[e.createElementVNode("span",Qn,e.toDisplayString(l.value.has(g.key)&&!a.value?"▶":"▼"),1),e.createElementVNode("span",_n,e.toDisplayString(g.isList?"📋":"📁"),1),e.createElementVNode("span",el,e.toDisplayString(g.label),1)],10,Jn)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.fields,h=>(e.openBlock(),e.createElementBlock("div",{key:h.fieldKey,class:"field-row",draggable:"true",style:e.normalizeStyle({paddingLeft:(g.key?22:8)+"px"}),onDragstart:R=>m(R,h)},[f[1]||(f[1]=e.createElementVNode("span",{class:"node-icon"},"📄",-1)),e.createElementVNode("span",ol,e.toDisplayString(h.fieldLabel),1),e.createElementVNode("span",nl,"("+e.toDisplayString(h.fieldKey)+")",1)],44,tl))),128))],512),[[e.vShow,!g.key||a.value||!l.value.has(g.key)]])],64))),128))]),i.value.length===0?(e.openBlock(),e.createElementBlock("p",ll,"暂无字段")):e.createCommentVNode("",!0)]))}}),il=ce(al,[["__scopeId","data-v-9b326f07"]]),rl={key:0,class:"left-collapsed"},sl={class:"left-head"},dl={class:"pd-tabs left-tabs"},cl={class:"pd-tab-bar",role:"tablist"},ul={class:"pd-tab-pane",role:"tabpanel"},ml=["onDragstart"],pl={class:"material-icon"},vl={class:"material-label"},fl={class:"pd-tab-pane",role:"tabpanel"},gl={class:"pd-tab-pane",role:"tabpanel"},hl=e.defineComponent({__name:"LeftPanel",props:{fields:{},elements:{},selectedIds:{},collapsed:{type:Boolean}},emits:["select","move-layer","group","ungroup","toggle-visible","toggle-locked","field-drag","toggle-collapse"],setup(o,{emit:r}){const t=r,s=e.ref("elements"),n=[{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 l(d,m){d.dataTransfer?.setData("elementType",m)}function a(d){t("field-drag",d)}function i(d){s.value=d,t("toggle-collapse")}return(d,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["left-panel",{collapsed:o.collapsed}])},[o.collapsed?(e.openBlock(),e.createElementBlock("div",rl,[e.createElementVNode("button",{class:"lc-btn",title:"展开素材台",onClick:m[0]||(m[0]=c=>i(s.value))},"»"),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:s.value==="elements"}]),title:"元素",onClick:m[1]||(m[1]=c=>i("elements"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:s.value==="fields"}]),title:"字段",onClick:m[2]||(m[2]=c=>i("fields"))},"⊛",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:s.value==="layers"}]),title:"图层",onClick:m[3]||(m[3]=c=>i("layers"))},"≡",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",sl,[m[14]||(m[14]=e.createElementVNode("span",{class:"left-title"},"素材台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起素材台",onClick:m[4]||(m[4]=c=>d.$emit("toggle-collapse"))},"«")]),e.createElementVNode("div",dl,[e.createElementVNode("div",cl,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:s.value==="elements"}]),onClick:m[5]||(m[5]=c=>s.value="elements")},"元素",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:s.value==="fields"}]),onClick:m[6]||(m[6]=c=>s.value="fields")},"字段",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:s.value==="layers"}]),onClick:m[7]||(m[7]=c=>s.value="layers")},"图层",2)]),e.withDirectives(e.createElementVNode("div",ul,[m[15]||(m[15]=e.createElementVNode("div",{class:"panel-title"},"拖拽元素到画布",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(n,c=>e.createElementVNode("div",{key:c.type,class:"material-card",draggable:"true",onDragstart:f=>l(f,c.type)},[e.createElementVNode("span",pl,e.toDisplayString(c.icon),1),e.createElementVNode("span",vl,e.toDisplayString(c.label),1)],40,ml)),64))],512),[[e.vShow,s.value==="elements"]]),e.withDirectives(e.createElementVNode("div",fl,[e.createVNode(il,{fields:o.fields,onFieldDrag:a},null,8,["fields"])],512),[[e.vShow,s.value==="fields"]]),e.withDirectives(e.createElementVNode("div",gl,[e.createVNode(jn,{elements:o.elements,"selected-ids":o.selectedIds,onSelect:m[8]||(m[8]=(c,f)=>d.$emit("select",c,f)),onMoveLayer:m[9]||(m[9]=c=>d.$emit("move-layer",c)),onGroup:m[10]||(m[10]=c=>d.$emit("group")),onUngroup:m[11]||(m[11]=c=>d.$emit("ungroup")),onToggleVisible:m[12]||(m[12]=c=>d.$emit("toggle-visible",c)),onToggleLocked:m[13]||(m[13]=c=>d.$emit("toggle-locked",c))},null,8,["elements","selected-ids"])],512),[[e.vShow,s.value==="layers"]])])],64))],2))}}),bl=ce(hl,[["__scopeId","data-v-4501eea7"]]);function El(o,r){const t=e.ref(!1),s=e.ref(null);let n=0,l=0,a=0,i=0,d=!1;function m(C){if(r.disabled||C.button!==0)return;const v=C.target;if(!(v instanceof Element)||v.classList.contains("resize-handle"))return;t.value=!0,d=C.altKey,n=C.clientX,l=C.clientY;const p=o.value;p&&(a=parseFloat(p.style.left)||0,i=parseFloat(p.style.top)||0,s.value={left:a,top:i,width:parseFloat(p.style.width)||0,height:parseFloat(p.style.height)||0},r.onStart?.({altKey:d}),document.addEventListener("mousemove",f),document.addEventListener("mouseup",g),C.preventDefault())}function c(C){const v=r.getScale?.()??1;let p=a+(C.clientX-n)/v,B=i+(C.clientY-l)/v;if(r.axis==="x"&&(B=i),r.axis==="y"&&(p=a),r.onAdsorb){const _=o.value;if(_){const ne=parseFloat(_.style.width)||0,G=parseFloat(_.style.height)||0,J=r.onAdsorb({left:p,top:B,width:ne,height:G});p=J.left,B=J.top}}return{left:p,top:B}}function f(C){const v=c(C);s.value&&(s.value.left=v.left,s.value.top=v.top),r.onDrag(v)}function g(C){t.value=!1;const v=c(C);r.onDragEnd?.(v,{altKey:d}),r.onStop?.(),s.value=null,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",g)}function h(){const C=o.value;C&&C.removeEventListener("mousedown",m),document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",g)}function R(){h();const C=o.value;C&&C.addEventListener("mousedown",m)}return{isDragging:t,dragPreview:s,setup:R,cleanup:h}}function yl(o){const r=[];return o.getAttribute("data-fit")==="shrink"&&r.push(o),o.querySelectorAll('[data-fit="shrink"]').forEach(t=>r.push(t)),r}function kl(o){o.querySelectorAll("[data-fit-size]").forEach(r=>{if(r.getAttribute("data-fit")==="shrink")return;r.removeAttribute("data-fit-size");const t=r.getAttribute("data-fit-base");t?r.style.fontSize=`${t}pt`:r.style.removeProperty("font-size")})}function bt(o,r){const t=()=>{const s=o.value;s&&(yl(s).forEach(Ie.fitTextNode),kl(s))};e.watchEffect(()=>{r(),e.nextTick(t)},{flush:"post"}),e.onMounted(()=>{e.nextTick(t)})}const Vl=["data-fit","data-fit-base","data-fit-min"],Nl=e.defineComponent({__name:"TextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t={top:"flex-start",middle:"center",bottom:"flex-end"},s={left:"flex-start",center:"center",right:"flex-end"},n=e.ref(null),l=e.computed(()=>E.resolveElementTextFit("text",r.element.options)),a=e.computed(()=>r.element.options.fontSize||12),i=e.computed(()=>E.resolveShrinkMinFontSize(r.element.options.shrinkMinFontSize)),d=e.computed(()=>{const c=r.element.options,f=l.value==="autoHeight";return{fontSize:a.value+"pt",fontWeight:c.fontWeight||"normal",fontFamily:c.fontFamily||"inherit",color:c.color||"#333",backgroundColor:c.backgroundColor||"transparent",textAlign:c.textAlign||"left",lineHeight:c.lineHeight?c.lineHeight+"pt":"normal",letterSpacing:c.letterSpacing?c.letterSpacing+"pt":"normal",textDecoration:c.textDecoration||"none",padding:`${c.contentPaddingTop||0}pt ${c.contentPaddingRight||0}pt ${c.contentPaddingBottom||0}pt ${c.contentPaddingLeft||0}pt`,width:"100%",height:f?"auto":"100%",boxSizing:"border-box",overflow:f?"visible":"hidden",...c.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...c.verticalAlign?{display:"flex",alignItems:t[c.verticalAlign]??"flex-start",justifyContent:s[c.textAlign||"left"]??"flex-start"}:{}}}),m=e.computed(()=>r.designMode?r.element.options.testData?r.element.options.testData:r.element.options.formatter||"文本":E.resolveTextBinding(r.element.options,r.data));return bt(n,()=>[l.value,a.value,i.value,r.element.options.width,r.element.options.height,r.element.options.wordWrap,r.element.options.letterSpacing,r.element.options.lineHeight,m.value]),(c,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:n,class:"print-text",style:e.normalizeStyle(d.value),"data-fit":l.value==="shrink"?"shrink":void 0,"data-fit-base":String(a.value),"data-fit-min":String(i.value)},e.toDisplayString(m.value),13,Vl))}}),wl={class:"print-image"},Cl=["src"],Sl={key:1,class:"image-placeholder"},xl=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?E.evaluateTemplate(a,E.DEFAULT_DEMO_DATA):E.evaluateTemplate(a,r.data?.[0]||{}):a:""}),s=e.ref(!1);function n(){s.value=!0}e.watch(t,()=>{s.value=!1});const l=e.computed(()=>({objectFit:r.element.options.fit||"contain"}));return(a,i)=>(e.openBlock(),e.createElementBlock("div",wl,[t.value&&!s.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,style:e.normalizeStyle(l.value),onError:n},null,44,Cl)):(e.openBlock(),e.createElementBlock("div",Sl,"图片"))]))}}),$l=ce(xl,[["__scopeId","data-v-007a2979"]]),Bl=["data-fit","data-fit-base","data-fit-min"],Dl=e.defineComponent({__name:"LongTextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t={top:"flex-start",middle:"center",bottom:"flex-end"},s={left:"flex-start",center:"center",right:"flex-end"},n=e.ref(null),l=e.computed(()=>E.resolveElementTextFit("longText",r.element.options)),a=e.computed(()=>r.element.options.fontSize||12),i=e.computed(()=>E.resolveShrinkMinFontSize(r.element.options.shrinkMinFontSize)),d=e.computed(()=>{const c=r.element.options,f=l.value==="autoHeight";return{fontSize:a.value+"pt",fontWeight:c.fontWeight||"normal",fontFamily:c.fontFamily||"inherit",color:c.color||"#333",backgroundColor:c.backgroundColor||"transparent",textAlign:c.textAlign||"left",lineHeight:c.lineHeight?c.lineHeight+"pt":"1.5",letterSpacing:c.letterSpacing?c.letterSpacing+"pt":"normal",textIndent:c.longTextIndent?c.longTextIndent+"pt":"0",width:"100%",height:f?"auto":"100%",overflow:f?"visible":"hidden",wordBreak:"break-all",boxSizing:"border-box",...c.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...c.verticalAlign?{display:"flex",alignItems:t[c.verticalAlign]??"flex-start",justifyContent:s[c.textAlign||"left"]??"flex-start"}:{}}}),m=e.computed(()=>r.designMode?r.element.options.formatter?r.element.options.formatter:"长文本内容":E.resolveTextBinding(r.element.options,r.data));return bt(n,()=>[l.value,a.value,i.value,r.element.options.width,r.element.options.height,r.element.options.wordWrap,r.element.options.lineHeight,m.value]),(c,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:n,class:"print-longtext",style:e.normalizeStyle(d.value),"data-fit":l.value==="shrink"?"shrink":void 0,"data-fit-base":String(a.value),"data-fit-min":String(i.value)},e.toDisplayString(m.value),13,Bl))}}),Tl=["title"],Ml=["title","onClick"],zl=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:"汇总行"}],s=r;function n(l,a){s("action",l,a)}return(l,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]=i=>n("insert-row-above"))},"在上方插入行"),e.createElementVNode("div",{class:"menu-item",onClick:a[1]||(a[1]=i=>n("insert-row-below"))},"在下方插入行"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canDeleteRow}]),onClick:a[2]||(a[2]=i=>o.canDeleteRow&&n("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]=i=>n("insert-col-left"))},"在左侧插入列"),e.createElementVNode("div",{class:"menu-item",onClick:a[4]||(a[4]=i=>n("insert-col-right"))},"在右侧插入列"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canDeleteCol}]),onClick:a[5]||(a[5]=i=>o.canDeleteCol&&n("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]=i=>!o.mergeDisabledReason&&n("merge"))}," 合并单元格 ",10,Tl),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!o.canSplit}]),onClick:a[7]||(a[7]=i=>o.canSplit&&n("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,i=>e.createElementVNode("div",{key:i.value,class:e.normalizeClass(["menu-item",{disabled:!!o.rowTypeDisabledReason(i.value),active:o.currentRowType===i.value}]),title:o.rowTypeDisabledReason(i.value)||"",onClick:d=>!o.rowTypeDisabledReason(i.value)&&n("set-row-type",i.value)},e.toDisplayString(i.label),11,Ml)),64))],36)):e.createCommentVNode("",!0)]))}}),Al=ce(zl,[["__scopeId","data-v-44e319c1"]]),Pl={class:"cell-barcode"},Rl=["preserveAspectRatio"],Ll=["src"],Ul={key:1,class:"cell-barcode-fallback"},Il=e.defineComponent({__name:"CellBarcode",props:{cellType:{},value:{},barcodeType:{},qrCodeLevel:{},showText:{type:Boolean},fit:{},maxWidth:{},maxHeight:{},printerDpi:{},targetWidthMm:{},targetHeightMm:{},barWidth:{},barFontSize:{}},setup(o){const r=o,t=e.ref(null),s=e.ref(!1),n=e.ref(""),l=e.ref(null),a={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},i=e.computed(()=>a[r.fit||"contain"]??"xMidYMid meet"),d=e.computed(()=>l.value?{width:l.value.width,height:l.value.height}:{maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}),m=e.computed(()=>({objectFit:r.fit||"contain",maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}));function c(){if(s.value=!1,l.value=null,!t.value)return;const R=E.barcodeUnitsPerModule(r.barWidth);try{zt(t.value,r.value,{format:r.barcodeType||"CODE128",width:R,height:E.BARCODE_BAR_HEIGHT_MODULES*R,displayValue:r.showText!==!1,fontSize:(r.barFontSize??E.BARCODE_TEXT_FONT_SIZE_MODULES)*R,margin:0,marginLeft:E.BARCODE_QUIET_ZONE_MODULES*R,marginRight:E.BARCODE_QUIET_ZONE_MODULES*R,marginTop:0,marginBottom:E.BARCODE_MARGIN_BOTTOM_MODULES*R})}catch{return}s.value=!0;const C=f(t.value),v=C?E.resolveBarcodeSize({unitWidth:C.width/R,unitHeight:C.height/R,boxWidthMm:E.barcodeAvailableBoxMm(r.targetWidthMm,r.maxWidth),boxHeightMm:E.barcodeAvailableBoxMm(r.targetHeightMm,r.maxHeight),dpi:r.printerDpi,barWidth:r.barWidth}):null;l.value=v?{width:`${v.widthMm}mm`,height:`${v.heightMm}mm`}:null,t.value.setAttribute("shape-rendering","crispEdges")}function f(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 g(){if(!r.value){n.value="";return}try{n.value=await At.toDataURL(r.value,{width:96,margin:1,errorCorrectionLevel:r.qrCodeLevel||"M"})}catch{n.value=""}}function h(){r.cellType==="barcode"?c():g()}return e.onMounted(h),e.watch(()=>[r.cellType,r.value,r.barcodeType,r.qrCodeLevel,r.showText,r.printerDpi,r.targetWidthMm,r.targetHeightMm,r.barWidth,r.barFontSize,r.maxWidth,r.maxHeight],h),(R,C)=>(e.openBlock(),e.createElementBlock("div",Pl,[e.withDirectives((e.openBlock(),e.createElementBlock("svg",{ref_key:"barcodeSvg",ref:t,preserveAspectRatio:i.value,style:e.normalizeStyle(d.value)},null,12,Rl)),[[e.vShow,o.cellType==="barcode"&&s.value]]),o.cellType==="qrcode"&&n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.value,alt:"qrcode",style:e.normalizeStyle(m.value)},null,12,Ll)):e.createCommentVNode("",!0),!s.value&&o.cellType==="barcode"?(e.openBlock(),e.createElementBlock("span",Ul,e.toDisplayString(o.value||"条码"),1)):e.createCommentVNode("",!0)]))}}),Fl=ce(Il,[["__scopeId","data-v-81e37239"]]),Hl={class:"cell-image"},Ol=["src"],Wl={key:1,class:"image-placeholder"},Gl=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?E.evaluateTemplate(a,E.DEFAULT_DEMO_DATA):E.evaluateTemplate(a,r.data?.[0]||{}):a:""}),s=e.ref(!1);function n(){s.value=!0}e.watch(t,()=>{s.value=!1});const l=e.computed(()=>({objectFit:r.fit||"contain",maxWidth:r.maxWidth?`${r.maxWidth}mm`:"100%",maxHeight:r.maxHeight?`${r.maxHeight}mm`:"100%"}));return(a,i)=>(e.openBlock(),e.createElementBlock("div",Hl,[t.value&&!s.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,style:e.normalizeStyle(l.value),onError:n},null,44,Ol)):(e.openBlock(),e.createElementBlock("div",Wl,"图片"))]))}}),Kl=ce(Gl,[["__scopeId","data-v-d5bc444b"]]),ql=["rowspan","colspan","onMousedown","onMouseenter","onDblclick","onContextmenu"],Yl=["data-fit","data-fit-base","data-fit-min","data-fit-mm"],jl={key:0,class:"data-placeholder"},Xl={key:3,class:"data-placeholder"},Zl={key:0,class:"col-resize-layer"},Jl=["aria-label","onMousedown"],Ql={key:1,class:"row-badges"},Ye=3.7795275591,_l=.1,ea=e.defineComponent({__name:"TableElement",props:{element:{},designMode:{type:Boolean},isSelected:{type:Boolean},showTableGhostBorder:{type:Boolean},scale:{},data:{}},emits:["dblclick-cell"],setup(o,{emit:r}){const t={header:"题",data:"数",subtotal:"小",summary:"汇"},s=o,n=r,l=e.inject(He,{tableSelection:e.ref(null),setTableSelection:()=>{},recordHistory:()=>{},maxTableWidth:e.ref(1/0)}),a=e.computed(()=>s.element.options.tableRows??[]),i=e.computed(()=>s.element.options.tableColWidths??[]),d=e.computed(()=>s.element.options.tableDefaultFontSize??10),m=e.computed(()=>s.element.options.tableDefaultColor??"#333333"),c=e.computed(()=>{const L=l.tableSelection.value;return L&&L.elementId===s.element.id?L:null});function f(L){let F=0;for(let V=0;V<L;V++)F+=a.value[V].height;return F}const g=e.ref(null),h=e.ref(null),R=e.ref([]);function C(){if(!s.designMode)return;const L=g.value;if(!L)return;const F=L.offsetHeight;if(F<=0)return;const V=s.element.options,w=F/Ye;Math.abs(w-(V.height??0))>_l&&(V.height=Math.round(w*100)/100);const P=L.offsetTop;R.value=Array.from(L.rows).map(ae=>({top:(ae.offsetTop-P)/Ye,height:ae.offsetHeight/Ye}))}function v(L){return R.value[L]?.top??f(L)}function p(L){return R.value[L]?.height??a.value[L]?.height??0}e.watch(()=>[s.element.options,s.designMode],()=>C(),{deep:!0,flush:"post"}),e.onMounted(()=>{C(),document.fonts?.ready.then(()=>C())});const B=e.computed(()=>{const L=s.element.options.dataSource;if(L&&Array.isArray(E.DEFAULT_DEMO_DATA[L]))return E.DEFAULT_DEMO_DATA[L];for(const F of Object.values(E.DEFAULT_DEMO_DATA))if(Array.isArray(F))return F}),_=e.computed(()=>{if(s.data)return s.data});function ne(L){return L.cellType==="barcode"||L.cellType==="qrcode"}function G(L,F){return ne(F)?E.resolveBarcodeDesignValue(F.formatter,B.value):F.formatter||""}function J(L,F){const V=s.element.options,w={designMode:s.designMode,showGhostBorder:s.showTableGhostBorder};return{fontFamily:F.fontFamily||"inherit",textAlign:F.align??"left",verticalAlign:F.valign??"middle",fontSize:(F.fontSize??d.value)+"pt",fontWeight:F.fontWeight??"normal",color:F.color??m.value,backgroundColor:F.backgroundColor??"transparent",borderTop:E.resolveCellBorderCss(F.borders?.top,w),borderRight:E.resolveCellBorderCss(F.borders?.right,w),borderBottom:E.resolveCellBorderCss(F.borders?.bottom,w),borderLeft:E.resolveCellBorderCss(F.borders?.left,w),padding:(F.padding??V.tableDefaultPadding??1)+"mm",whiteSpace:F.wordWrap??!0?"normal":"nowrap",overflow:F.wordWrap??!0?"visible":"hidden"}}function b(L){return E.resolveCellTextFit(L)}function W(L){return b(L)!=="autoHeight"}function j(L){return L.fontSize??d.value}function U(L,F){return E.cellFitCapMm(a.value,L,F,s.element.options.tableDefaultPadding??1)}function y(L,F){return E.cellFitWidthMm(i.value,L,F,s.element.options.tableDefaultPadding??1)}function M(L,F){return{maxHeight:U(F,L)+"mm",overflow:"hidden",...L.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{}}}bt(h,()=>[s.designMode,s.data?.length,i.value.join(","),d.value,s.element.options.tableDefaultPadding,a.value.map(L=>`${L.height}:${L.cells.map(F=>`${F.formatter??""}|${F.fontSize??""}|${F.wordWrap??""}|${F.textFit??""}|${F.colspan??1}`).join("~")}`).join(",")]);function N(L,F){const V=c.value;return{"cell-selected":!!V&&L>=V.r1&&L<=V.r2&&F>=V.c1&&F<=V.c2,"row-data-bg":a.value[L].type==="data"}}const O=e.ref(null);function A(L,F){const V=E.normalizeSelection(a.value,L,F);l.setTableSelection({elementId:s.element.id,...V})}function k(L,F,V){!s.designMode||!s.isSelected||(V.stopPropagation(),V.shiftKey&&c.value?A({r:c.value.r1,c:c.value.c1},{r:L,c:F}):(O.value={r:L,c:F},A({r:L,c:F},{r:L,c:F})),window.addEventListener("mouseup",()=>{O.value=null},{once:!0}))}function z(L,F){O.value&&A(O.value,{r:L,c:F})}function u(L,F){s.designMode&&n("dblclick-cell",s.element.id,L,F)}const x=e.reactive({visible:!1,x:0,y:0}),Y=e.inject(Je,null);function be(L,F,V){if(!s.designMode)return;!s.isSelected&&Y&&(Y.value=new Set([s.element.id]));const w=c.value;w&&L>=w.r1&&L<=w.r2&&F>=w.c1&&F<=w.c2||A({r:L,c:F},{r:L,c:F}),x.x=V.clientX,x.y=V.clientY,x.visible=!0,window.removeEventListener("mouseup",ge),window.addEventListener("mouseup",ge)}function ge(L){L.target?.closest?.(".table-ctx-menu")||(x.visible=!1,window.removeEventListener("mouseup",ge))}const fe=e.computed(()=>{const L=c.value;return L?E.canMergeReason(a.value,L):"未选择单元格"}),se=e.computed(()=>{const L=c.value;if(!L)return!1;for(let F=L.r1;F<=L.r2;F++)for(let V=L.c1;V<=L.c2;V++){const w=a.value[F].cells[V];if(!w.merged&&((w.rowspan??1)>1||(w.colspan??1)>1))return!0}return!1});function q(L){const F=c.value;if(!F)return"未选择单元格";if(F.r1!==F.r2)return"行类型仅支持单行设置";const V=JSON.parse(JSON.stringify(a.value));return E.setRowType(V,F.r1,L)}function S(){E.syncTableElementSize(s.element.options)}function D(L,F){const V=l.maxTableWidth.value,w=L.reduce((P,ae)=>P+ae,0)+L[F];return w>V?`插入后表格总宽 ${Math.round(w*10)/10}mm 超过打印范围宽度 ${V}mm,请先缩小列宽`:null}function K(L,F){const V=c.value;if(!V)return;x.visible=!1;const w=s.element.options,P=w.tableRows,ae=w.tableColWidths;let me=null;switch(L){case"insert-row-above":E.insertRow(P,V.r1,"above");break;case"insert-row-below":E.insertRow(P,V.r2,"below");break;case"delete-row":me=E.deleteRow(P,V.r1);break;case"insert-col-left":me=D(ae,V.c1),me||E.insertCol(P,ae,V.c1,"left");break;case"insert-col-right":me=D(ae,V.c2),me||E.insertCol(P,ae,V.c2,"right");break;case"delete-col":me=E.deleteCol(P,ae,V.c1);break;case"merge":E.mergeCells(P,V);break;case"split":E.splitCells(P,V);break;case"set-row-type":me=E.setRowType(P,V.r1,F);break}if(me){alert(me);return}l.setTableSelection(null),S(),l.recordHistory()}const Z=e.computed(()=>s.designMode&&!!s.isSelected&&!s.element.options.locked&&i.value.length>=1),te=e.computed(()=>Array.from({length:i.value.length},(L,F)=>F+1));function pe(L){return i.value.slice(0,L).reduce((F,V)=>F+V,0)}const T=e.ref(null);let $=0,I=0;function ee(L,F){Z.value&&F.button===0&&(T.value=L,$=F.clientX,I=i.value[L-1],document.addEventListener("mousemove",oe),document.addEventListener("mouseup",ue))}function oe(L){if(T.value===null)return;const F=s.scale||1,V=(L.clientX-$)/(F*Ye),w=T.value-1,P=s.element.options.tableColWidths;P[w]=E.clampResizedColumnWidth(P,w,I+V,l.maxTableWidth.value),S()}function ue(){document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",ue),T.value!==null&&(T.value=null,S(),l.recordHistory())}return e.onUnmounted(()=>{document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",ue)}),(L,F)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:h,class:e.normalizeClass(["print-table",{"design-mode":o.designMode}]),onContextmenu:F[0]||(F[0]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("table",{ref_key:"tableRef",ref:g,style:e.normalizeStyle({fontSize:d.value+"pt",color:m.value})},[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(V,w)=>(e.openBlock(),e.createElementBlock("col",{key:w,style:e.normalizeStyle({width:V+"mm"})},null,4))),128))]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(V,w)=>(e.openBlock(),e.createElementBlock("tr",{key:V.id,style:e.normalizeStyle({height:V.height+"mm"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.cells,(P,ae)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:P.id},[P.merged?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:P.rowspan||1,colspan:P.colspan||1,class:e.normalizeClass(N(w,ae)),style:e.normalizeStyle(J(V,P)),onMousedown:e.withModifiers(me=>k(w,ae,me),["left"]),onMouseenter:me=>z(w,ae),onDblclick:e.withModifiers(me=>u(w,ae),["stop"]),onContextmenu:e.withModifiers(me=>be(w,ae,me),["prevent","stop"])},[ne(P)?(e.openBlock(),e.createBlock(Fl,{key:0,"cell-type":P.cellType,value:G(V,P),"barcode-type":P.barcodeType,"qr-code-level":P.qrCodeLevel,"show-text":P.showBarcodeText!==!1,fit:P.fit,"max-width":P.maxWidth,"max-height":P.maxHeight,"printer-dpi":P.printerDpi,"target-width-mm":y(ae,P),"target-height-mm":U(w,P),"bar-width":P.barWidth,"bar-font-size":P.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"])):P.cellType==="image"?(e.openBlock(),e.createBlock(Kl,{key:1,value:P.formatter||"",fit:P.fit,"max-width":P.maxWidth,"max-height":P.maxHeight,"design-mode":o.designMode,data:_.value},null,8,["value","fit","max-width","max-height","design-mode","data"])):W(P)?(e.openBlock(),e.createElementBlock("div",{key:2,class:"cell-fit",style:e.normalizeStyle(M(P,w)),"data-fit":b(P)==="shrink"?"shrink":void 0,"data-fit-base":String(j(P)),"data-fit-min":String(e.unref(E.resolveShrinkMinFontSize)(P.shrinkMinFontSize)),"data-fit-mm":U(w,P)},[V.type==="data"?(e.openBlock(),e.createElementBlock("span",jl,e.toDisplayString(G(V,P)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(G(V,P)),1)],64))],12,Yl)):V.type==="data"?(e.openBlock(),e.createElementBlock("span",Xl,e.toDisplayString(G(V,P)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createTextVNode(e.toDisplayString(G(V,P)),1)],64))],46,ql))],64))),128))],4))),128))])],4),Z.value?(e.openBlock(),e.createElementBlock("div",Zl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(te.value,V=>(e.openBlock(),e.createElementBlock("div",{key:V,class:e.normalizeClass(["col-resize-handle",{dragging:T.value===V}]),role:"separator","aria-label":"列宽手柄"+V,style:e.normalizeStyle({left:pe(V)+"mm"}),onMousedown:e.withModifiers(w=>ee(V,w),["stop","prevent"])},null,46,Jl))),128))])):e.createCommentVNode("",!0),o.designMode&&o.isSelected?(e.openBlock(),e.createElementBlock("div",Ql,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(V,w)=>(e.openBlock(),e.createElementBlock("span",{key:V.id,class:"row-badge",style:e.normalizeStyle({top:v(w)+"mm",height:p(w)+"mm"})},e.toDisplayString(t[V.type]),5))),128))])):e.createCommentVNode("",!0),e.createVNode(Al,{visible:x.visible,x:x.x,y:x.y,"can-delete-row":a.value.length>1,"can-delete-col":i.value.length>1,"merge-disabled-reason":fe.value,"can-split":se.value,"current-row-type":c.value?a.value[c.value.r1]?.type??null:null,"row-type-disabled-reason":q,onAction:K},null,8,["visible","x","y","can-delete-row","can-delete-col","merge-disabled-reason","can-split","current-row-type"])],34))}}),ta=ce(ea,[["__scopeId","data-v-0c170f83"]]),St=e.defineComponent({__name:"LineElement",props:{element:{}},setup(o){const r=o,t=e.computed(()=>r.element.printElementType.type==="hline"),s=e.computed(()=>{const n=r.element.options,l=(n.borderWidth||.75)+"pt",a=n.borderStyle||"solid",i=n.borderColor||"#333";return t.value?{width:"100%",height:"0",borderTop:`${l} ${a} ${i}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${l} ${a} ${i}`,boxSizing:"border-box"}});return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"print-line",style:e.normalizeStyle(s.value)},null,4))}}),xt=e.defineComponent({__name:"ShapeElement",props:{element:{}},setup(o){const r=o,t=e.computed(()=>r.element.printElementType.type==="oval"),s=e.computed(()=>{const n=r.element.options;return{width:"100%",height:"100%",borderWidth:(n.borderWidth||1)+"pt",borderStyle:n.borderStyle||"solid",borderColor:n.borderColor||"#333",backgroundColor:n.backgroundColor||"transparent",borderRadius:t.value?"50%":"0",boxSizing:"border-box"}});return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"print-shape",style:e.normalizeStyle(s.value)},null,4))}}),oa={class:"print-barcode",ref:"containerRef"},na=["preserveAspectRatio"],la=e.defineComponent({__name:"BarcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.ref(null),s=e.ref(null),n={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},l=e.computed(()=>n[r.element.options.fit||"contain"]??"xMidYMid meet"),a=e.computed(()=>s.value?{width:s.value.width,height:s.value.height}:{maxWidth:"100%",maxHeight:"100%"});function i(){if(!t.value)return;const m=r.element.options,c=(r.designMode?m.testData||m.formatter:E.resolveTextBinding(m,r.data))||"条码",f=E.barcodeUnitsPerModule(m.barWidth);try{zt(t.value,c,{format:m.barcodeType||"CODE128",width:f,height:E.BARCODE_BAR_HEIGHT_MODULES*f,displayValue:!m.hideTitle,fontSize:(m.fontSize??E.BARCODE_TEXT_FONT_SIZE_MODULES)*f,margin:0,marginLeft:E.BARCODE_QUIET_ZONE_MODULES*f,marginRight:E.BARCODE_QUIET_ZONE_MODULES*f,marginTop:0,marginBottom:E.BARCODE_MARGIN_BOTTOM_MODULES*f})}catch{s.value=null;return}const g=d(t.value),h=g?E.resolveBarcodeSize({unitWidth:g.width/f,unitHeight:g.height/f,boxWidthMm:E.barcodeAvailableBoxMm(m.width,m.maxWidth),boxHeightMm:E.barcodeAvailableBoxMm(m.height,m.maxHeight),dpi:m.printerDpi,barWidth:m.barWidth}):null;s.value=h?{width:`${h.widthMm}mm`,height:`${h.heightMm}mm`}:null,t.value.setAttribute("shape-rendering","crispEdges")}function d(m){const c=(m.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return c.length!==4||c.some(f=>!Number.isFinite(f))?null:{width:c[2],height:c[3]}}return e.onMounted(i),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.printerDpi,r.element.options.hideTitle,r.element.options.fontSize,r.element.options.maxWidth,r.element.options.maxHeight],i),(m,c)=>(e.openBlock(),e.createElementBlock("div",oa,[(e.openBlock(),e.createElementBlock("svg",{ref_key:"svgRef",ref:t,preserveAspectRatio:l.value,style:e.normalizeStyle(a.value)},null,12,na))],512))}}),aa=ce(la,[["__scopeId","data-v-6eb95a40"]]),ia={class:"print-qrcode"},ra=["src"],sa=e.defineComponent({__name:"QrcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.ref(""),s=e.computed(()=>{const l=r.element.options;return{objectFit:l.fit||"contain",maxWidth:l.maxWidth?`${l.maxWidth}mm`:"100%",maxHeight:l.maxHeight?`${l.maxHeight}mm`:"100%"}});async function n(){const l=r.element.options,a=(r.designMode?l.testData||l.formatter:E.resolveTextBinding(l,r.data))||"二维码",i=Math.min(l.width||80,l.height||80);try{t.value=await At.toDataURL(a,{width:i,margin:1,errorCorrectionLevel:String(l.qrCodeLevel??"M")})}catch{t.value=""}}return e.onMounted(n),e.watch(()=>[r.element.options.formatter,r.element.options.testData,r.element.options.qrCodeLevel],n),(l,a)=>(e.openBlock(),e.createElementBlock("div",ia,[t.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.value,alt:"qrcode",style:e.normalizeStyle(s.value)},null,12,ra)):e.createCommentVNode("",!0)]))}}),da=ce(sa,[["__scopeId","data-v-3454544f"]]),ca=["innerHTML"],ua=e.defineComponent({__name:"HtmlElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.computed(()=>{if(r.element.options.formatter){const s=r.data&&r.data.length>0?r.data[0]:{},n=E.evaluateTemplate(r.element.options.formatter,s??{});return n?Wt.sanitize(n):""}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(s,n)=>(e.openBlock(),e.createElementBlock("div",{class:"print-html",innerHTML:t.value},null,8,ca))}}),ma=ce(ua,[["__scopeId","data-v-880bbde5"]]),pa=e.defineComponent({__name:"PageNumberElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(o){const r=o,t=e.computed(()=>{const n=r.element.options;return{fontSize:(n.fontSize||12)+"pt",fontWeight:n.fontWeight||"normal",fontFamily:n.fontFamily||"inherit",color:n.color||"#333",textAlign:n.textAlign||"left",lineHeight:n.lineHeight?n.lineHeight+"pt":"normal",letterSpacing:n.letterSpacing?n.letterSpacing+"pt":"normal"}}),s=e.computed(()=>r.designMode?r.element.options.title||"{pageIndex}/{totalPages}":r.element.options.title||"");return(n,l)=>(e.openBlock(),e.createElementBlock("div",{class:"page-number-element",style:e.normalizeStyle(t.value)},e.toDisplayString(s.value),5))}}),va=ce(pa,[["__scopeId","data-v-38f1d7df"]]),fa={key:0,class:"drag-preview"},ga={key:1,class:"resize-handles"},ha=["onMousedown"],ba={key:2,class:"selected-indicator"},Ea={class:"position-label"},ya=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,s=r,n=e.ref(null),l=e.inject(Je,null),a=e.computed(()=>l?.value?l.value.has(t.element.id):t.isSelected??!1),i=e.inject(Pt,null),d=e.computed(()=>i?.value.has(t.element.id)??!1),m={text:e.markRaw(Nl),image:e.markRaw($l),longText:e.markRaw(Dl),table:e.markRaw(ta),hline:e.markRaw(St),vline:e.markRaw(St),rect:e.markRaw(xt),oval:e.markRaw(xt),barcode:e.markRaw(aa),qrcode:e.markRaw(da),html:e.markRaw(ma),pageNumber:e.markRaw(va)},c=e.computed(()=>m[t.element.printElementType.type]),f=e.computed(()=>t.element.printElementType.type==="table"?{showTableGhostBorder:t.showTableGhostBorder,scale:t.scale}:{}),g=e.computed(()=>{const y=t.element.options,M=E.resolveElementBorder(t.element.printElementType.type,y),N={};if(M?.all&&(N.border=`${M.all.borderWidth} ${M.all.borderStyle} ${M.all.borderColor}`),M)for(const O of E.ELEMENT_BORDER_SIDES){const A=M.edges[O];A&&(N[`border${O.charAt(0).toUpperCase()}${O.slice(1)}`]=`${A.borderWidth} ${A.borderStyle} ${A.borderColor}`)}return{position:"absolute",left:y.left+"mm",top:y.top+"mm",width:y.width+"mm",height:y.height+"mm",zIndex:y.zIndex||"auto",...N}}),h=e.computed(()=>{const y=t.element.options;return`x:${Math.round(y.left)} y:${Math.round(y.top)} ${Math.round(y.width)}×${Math.round(y.height)}mm`});let R=0,C=0;const v=e.reactive({disabled:!t.designMode||!!t.element.options.locked,getScale:()=>(t.scale||1)*E.mmToPx(1),onDrag:y=>{const M=y.left-R,N=y.top-C;n.value&&(n.value.style.transform=`translate(${M}mm, ${N}mm)`)},onDragEnd:(y,M)=>{if(M.altKey){const A=JSON.parse(JSON.stringify(t.element));A.id=E.generateId(),A.options.left=y.left,A.options.top=y.top,A.options.groupId=void 0,s("clone-element",A,{left:y.left,top:y.top}),n.value&&(n.value.style.transform="");return}const N=y.left-R,O=y.top-C;if(t.element.options.left=y.left,t.element.options.top=y.top,n.value&&(n.value.style.transform=""),t.element.options.groupId&&t.allElements)for(const A of t.allElements)A.id!==t.element.id&&A.options.groupId===t.element.options.groupId&&(A.options.left+=N,A.options.top+=O)},onStart:()=>{R=t.element.options.left,C=t.element.options.top,s("drag-start")},onStop:()=>{t.clearAdsorbGuides?.(),s("drag-stop")},onAdsorb:y=>{let M=y.left,N=y.top;return t.snapToGrid&&(M=Math.round(y.left/5)*5,N=Math.round(y.top/5)*5),t.adsorbHandler?t.adsorbHandler({id:t.element.id,left:M,top:N,width:t.element.options.width,height:t.element.options.height}):{left:M,top:N,lines:[]}}}),{setup:p,cleanup:B,isDragging:_}=El(n,v);e.watchEffect(()=>{v.disabled=!t.designMode||!!t.element.options.locked});const ne=e.computed(()=>a.value&&!!t.designMode&&!t.element.options.locked&&t.element.printElementType.type!=="table"),{startResize:G,cleanup:J}=E.useResize({minWidth:3.5,minHeight:3.5,getScale:()=>(t.scale||1)*E.mmToPx(1),getRect:()=>({left:t.element.options.left,top:t.element.options.top,width:t.element.options.width,height:t.element.options.height}),onResize:y=>{t.element.options.left=y.left,t.element.options.top=y.top,t.element.options.width=y.width,t.element.options.height=y.height},onStart:()=>{s("drag-start")},onStop:()=>{s("drag-stop")}});function b(y){t.designMode&&y.button===0&&s("select",t.element.id,y.ctrlKey||y.metaKey)}function W(){t.designMode&&s("dblclick-element",t.element.id)}function j(y,M,N){t.designMode&&s("dblclick-cell",y,M,N)}e.onMounted(()=>{t.designMode&&p()});function U(){B(),J(),t.clearAdsorbGuides?.()}return e.onUnmounted(()=>{U()}),(y,M)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:n,class:e.normalizeClass(["print-element",{selected:a.value,previewed:d.value,"design-mode":o.designMode,locked:o.element.options.locked,hidden:o.element.options.visible===!1,"drag-ghost":e.unref(_),[`type-${o.element.printElementType.type}`]:!0,[`zone-${o.zone||"content"}`]:!0}]),style:e.normalizeStyle(g.value),onMousedown:e.withModifiers(b,["stop"]),onDblclick:e.withModifiers(W,["stop"]),onContextmenu:M[0]||(M[0]=e.withModifiers(N=>y.$emit("contextmenu",o.element.id,N),["prevent","stop"]))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value),e.mergeProps({element:o.element,data:o.printData,"design-mode":o.designMode,"is-selected":a.value},f.value,{onDblclickCell:j}),null,16,["element","data","design-mode","is-selected"])),e.unref(_)?(e.openBlock(),e.createElementBlock("div",fa)):e.createCommentVNode("",!0),ne.value?(e.openBlock(),e.createElementBlock("div",ga,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E.RESIZE_POINTS),N=>(e.openBlock(),e.createElementBlock("div",{key:N,class:e.normalizeClass(["resize-handle",`handle-${N}`]),onMousedown:e.withModifiers(O=>e.unref(G)(N,O),["stop"])},null,42,ha))),128))])):e.createCommentVNode("",!0),a.value&&o.designMode?(e.openBlock(),e.createElementBlock("div",ba,[e.createElementVNode("div",Ea,e.toDisplayString(h.value),1)])):e.createCommentVNode("",!0)],38))}}),ct=ce(ya,[["__scopeId","data-v-5a7482f4"]]);function ka(o={}){const r=e.ref([]),t=e.ref({width:0,height:0});function s(a,i,d){return E.computeAdsorb(a,i,d,o)}function n(a,i,d){r.value=a,t.value={width:i,height:d}}function l(){r.value=[]}return{check:s,renderLines:n,clearLines:l,guideLines:r,paperSize:t}}function Va(o){const{check:r,renderLines:t,clearLines:s,guideLines:n,paperSize:l}=ka(o.config??{adsorbMin:1,adsorbLineMin:2,showAdsorbLine:!0});function a(d){const m=o.getElements().filter(g=>g.id!==d.id).map(g=>({id:g.id,left:g.options.left,top:g.options.top,width:g.options.width,height:g.options.height})),c=r(d,m,o.getGuides?.()),f=o.getPaperSize();return t(c.lines,f.width,f.height),c}function i(){s()}return{requestAdsorb:a,clearGuides:i,guideLines:n,paperSize:l}}const Na=["src"],wa=["width","height","viewBox"],Ca=["x","y","font-size","fill","transform"],Sa={key:0,class:"zone-label"},xa={key:0,class:"zone-height-tip"},$a={key:0,class:"zone-label"},Ba={key:0,class:"zone-height-tip"},Da=["onMousedown","onDblclick"],Ta=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 s=o,n=t,l=e.ref(null),a=e.computed(()=>E.getPaperDimensions(s.templateData).width),i=e.computed(()=>E.getPaperDimensions(s.templateData).height),d=e.computed(()=>s.templateData.designBackground),m=e.ref(!1);e.watch(()=>d.value?.src,()=>{m.value=!1});const c=e.computed(()=>{const S=d.value?.rotation;return S===90||S===180||S===270?S:0}),f=e.computed(()=>{const S=c.value,D=S===90||S===270,K=D?i.value:a.value,Z=D?a.value:i.value,te={width:K+"mm",height:Z+"mm",left:(a.value-K)/2+"mm",top:(i.value-Z)/2+"mm"};return S!==0&&(te.transform=`rotate(${S}deg)`),te});function g(){m.value=!0,console.warn("[print-designer] 设计背景图加载失败:",d.value?.src)}const h=e.computed(()=>`${8/(s.scale||1)}px`),R=e.computed(()=>{const S=s.scale||1,D=E.mmToPx(a.value)*S,K=E.mmToPx(i.value)*S;return{width:D+"px",height:K+"px",position:"relative"}}),C=e.computed(()=>{const S=s.templateData.margins,D=s.templateData.header.height,K=s.templateData.footer.height,Z=a.value-S.left-S.right;return{header:{left:S.left,top:S.top,width:Z,height:D},content:{left:S.left,top:S.top+D,width:Z,height:i.value-S.top-S.bottom-D-K},footer:{left:S.left,top:i.value-S.bottom-K,width:Z,height:K}}});function v(S){return{position:"absolute",left:S.left+"mm",top:S.top+"mm",width:S.width+"mm",height:S.height+"mm"}}const p=e.computed(()=>{const S={header:[],footer:[],content:[]};for(const D of s.runtimeElements)D.zone==="header"?S.header.push(D):D.zone==="footer"?S.footer.push(D):S.content.push(D);return S}),B=e.computed(()=>p.value.header),_=e.computed(()=>p.value.footer),ne=e.computed(()=>p.value.content);let G="content";const{requestAdsorb:J,clearGuides:b,guideLines:W,paperSize:j}=Va({getElements:()=>p.value[G],getPaperSize:()=>{const S=C.value[G];return{width:S.width,height:S.height}},getGuides:()=>{const S=[],D=[];for(const K of s.guides??[])K.type==="vertical"?S.push(K.position):D.push(K.position);return{vertical:S,horizontal:D}}});function U(S){G=s.runtimeElements.find(Z=>Z.id===S.id)?.zone||"content";const K=J(S);return(K.left!==S.left||K.top!==S.top)&&u(K.left+S.width/2,K.top+S.height/2),K}function y(S,D){if(S.button!==0)return;const K=D.position,Z=S.clientX,te=S.clientY,pe=s.scale??1,T=25.4/96,$=ee=>{const oe=(D.type==="vertical"?ee.clientX-Z:ee.clientY-te)/pe*T,ue=D.type==="vertical"?a.value:i.value,L=Math.min(Math.max(K+oe,0),ue);n("guide-move",D.id,L)},I=()=>{window.removeEventListener("mousemove",$),window.removeEventListener("mouseup",I)};window.addEventListener("mousemove",$),window.addEventListener("mouseup",I)}const M=e.computed(()=>({width:a.value+"mm",minHeight:i.value+"mm",background:s.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:s.scale?`scale(${s.scale})`:void 0,transformOrigin:"0 0"})),N=e.computed(()=>{const S=s.templateData.margins;return{padding:`${S.top}mm ${S.right}mm ${S.bottom}mm ${S.left}mm`,position:"relative",boxSizing:"border-box",minHeight:i.value+"mm"}}),O=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 A=0,k=null;const z=e.ref(null);function u(S,D){A+=1,z.value={left:S,top:D,key:A},k&&clearTimeout(k),k=setTimeout(()=>{z.value=null},300)}const x=e.computed(()=>he.resolveWatermarkLayout(s.templateData.watermark,s.printData,{width:a.value,height:i.value})),Y=e.ref(null);function be(S,D){D.button===0&&(se(),Y.value={zone:S,startY:D.clientY,startH:s.templateData[S].height},window.addEventListener("mousemove",ge),window.addEventListener("mouseup",fe))}function ge(S){if(!Y.value)return;const{zone:D,startY:K,startH:Z}=Y.value,pe=(S.clientY-K)/(s.scale||1)*25.4/96,T=D==="header"?pe:-pe,$=Math.min(100,i.value-s.templateData.margins.top-s.templateData.margins.bottom-(D==="header"?s.templateData.footer.height:s.templateData.header.height)-10),I=Math.min($,Math.max(0,Math.round((Z+T)*10)/10));n("zone-height-change",D,I)}function fe(){if(!Y.value)return;const S=Y.value.zone;Y.value=null,window.removeEventListener("mousemove",ge),window.removeEventListener("mouseup",fe),n("zone-height-commit",S)}function se(){window.removeEventListener("mousemove",ge),window.removeEventListener("mouseup",fe),Y.value=null}e.onUnmounted(()=>{se(),k&&clearTimeout(k)});function q(S,D){n("select",S,D)}return r({contentRef:l}),(S,D)=>(e.openBlock(),e.createElementBlock("div",{class:"paper-wrapper",style:e.normalizeStyle(R.value)},[e.createElementVNode("div",{class:"hiprint-printPaper",style:e.normalizeStyle(M.value)},[o.designMode&&d.value?.src&&!m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"design-background",style:e.normalizeStyle(f.value)},[e.createElementVNode("img",{src:d.value.src,draggable:"false",alt:"",onError:g},null,40,Na)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"hiprint-printPaper-content",ref_key:"contentRef",ref:l,style:e.normalizeStyle(N.value)},[o.showGrid&&o.designMode?(e.openBlock(),e.createElementBlock("div",{key:0,class:"grid-bg",style:e.normalizeStyle(O.value)},null,4)):e.createCommentVNode("",!0),z.value?(e.openBlock(),e.createElementBlock("div",{key:z.value.key,class:"snap-indicator",style:e.normalizeStyle({left:z.value.left+"mm",top:z.value.top+"mm"})},null,4)):e.createCommentVNode("",!0),x.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:"watermark-layer",style:e.normalizeStyle({opacity:String(x.value.opacity)})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value.tiles,(K,Z)=>(e.openBlock(),e.createElementBlock("svg",{key:Z,class:"watermark-tile",width:K.widthMm+"mm",height:K.heightMm+"mm",viewBox:`0 0 ${x.value.tileWidthPx} ${x.value.tileHeightPx}`,style:e.normalizeStyle({left:K.leftMm+"mm",top:K.topMm+"mm"}),xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("text",{x:x.value.tileWidthPx/2,y:x.value.tileHeightPx/2,"font-size":x.value.fontSizePx,fill:x.value.color,"text-anchor":"middle","dominant-baseline":"middle",transform:`rotate(${x.value.rotate},${x.value.tileWidthPx/2},${x.value.tileHeightPx/2})`},e.toDisplayString(x.value.text),9,Ca)],12,wa))),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",Sa,"页眉")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,K=>(e.openBlock(),e.createBlock(ct,{key:K.id,element:K,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":B.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"header","adsorb-handler":U,"clear-adsorb-guides":e.unref(b),onSelect:q,onDragStart:D[0]||(D[0]=Z=>S.$emit("drag-start")),onDragStop:D[1]||(D[1]=Z=>S.$emit("drag-stop")),onDblclickElement:D[2]||(D[2]=Z=>S.$emit("dblclick-element",Z)),onDblclickCell:D[3]||(D[3]=(Z,te,pe)=>S.$emit("dblclick-cell",Z,te,pe)),onContextmenu:D[4]||(D[4]=(Z,te)=>S.$emit("contextmenu",Z,te)),onCloneElement:(Z,te)=>S.$emit("clone-element",Z,te)},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:D[5]||(D[5]=e.withModifiers(K=>be("header",K),["prevent","stop"]))},[Y.value?.zone==="header"?(e.openBlock(),e.createElementBlock("div",xa,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))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ne.value,K=>(e.openBlock(),e.createBlock(ct,{key:K.id,element:K,"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":U,"clear-adsorb-guides":e.unref(b),onSelect:q,onDragStart:D[6]||(D[6]=Z=>S.$emit("drag-start")),onDragStop:D[7]||(D[7]=Z=>S.$emit("drag-stop")),onDblclickElement:D[8]||(D[8]=Z=>S.$emit("dblclick-element",Z)),onDblclickCell:D[9]||(D[9]=(Z,te,pe)=>S.$emit("dblclick-cell",Z,te,pe)),onContextmenu:D[10]||(D[10]=(Z,te)=>S.$emit("contextmenu",Z,te)),onCloneElement:(Z,te)=>S.$emit("clone-element",Z,te)},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",$a,"页脚")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,K=>(e.openBlock(),e.createBlock(ct,{key:K.id,element:K,"design-mode":o.designMode,"print-data":o.printData,scale:o.scale,"all-elements":_.value,"snap-to-grid":o.snapToGrid,"show-table-ghost-border":o.showTableGhostBorder,zone:"footer","adsorb-handler":U,"clear-adsorb-guides":e.unref(b),onSelect:q,onDragStart:D[11]||(D[11]=Z=>S.$emit("drag-start")),onDragStop:D[12]||(D[12]=Z=>S.$emit("drag-stop")),onDblclickElement:D[13]||(D[13]=Z=>S.$emit("dblclick-element",Z)),onDblclickCell:D[14]||(D[14]=(Z,te,pe)=>S.$emit("dblclick-cell",Z,te,pe)),onContextmenu:D[15]||(D[15]=(Z,te)=>S.$emit("contextmenu",Z,te)),onCloneElement:(Z,te)=>S.$emit("clone-element",Z,te)},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:D[16]||(D[16]=e.withModifiers(K=>be("footer",K),["prevent","stop"]))},[Y.value?.zone==="footer"?(e.openBlock(),e.createElementBlock("div",Ba,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(W),(K,Z)=>(e.openBlock(),e.createElementBlock("div",{key:Z,class:e.normalizeClass(["adsorb-guide",[`guide-${K.type}`]]),style:e.normalizeStyle(K.type==="vertical"?{left:K.position+"mm",top:"0",height:e.unref(j).height+"mm",borderLeftColor:K.color||"var(--pd-accent-secondary, #f56c6c)"}:{top:K.position+"mm",left:"0",width:e.unref(j).width+"mm",borderTopColor:K.color||"var(--pd-accent-secondary, #f56c6c)"})},null,6))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.guides,K=>(e.openBlock(),e.createElementBlock("div",{key:"mg-"+K.id,class:e.normalizeClass(["manual-guide",[`guide-${K.type}`]]),style:e.normalizeStyle(K.type==="vertical"?{left:K.position+"mm",top:"0",height:i.value+"mm","--guide-hit":h.value}:{top:K.position+"mm",left:"0",width:a.value+"mm","--guide-hit":h.value}),onMousedown:e.withModifiers(Z=>y(Z,K),["prevent","stop"]),onDblclick:e.withModifiers(Z=>K.id&&n("guide-remove",K.id),["prevent","stop"])},null,46,Da))),128))],4)],4)],4))}}),Ma=ce(Ta,[["__scopeId","data-v-4682b43a"]]),za=e.defineComponent({__name:"Ruler",props:{orientation:{},viewportPx:{},originPx:{},paperLengthMM:{},scale:{},cursorPx:{}},emits:["add-guide","guide-dragging"],setup(o,{emit:r}){const t=o,s=r,n=e.computed(()=>t.orientation==="horizontal"),l=e.computed(()=>n.value?"vertical":"horizontal"),a=e.ref(null),i=e.ref(null),d=e.computed(()=>i.value??t.cursorPx??null),m=e.computed(()=>n.value?{width:t.viewportPx+"px",height:E.RULER_THICKNESS+"px"}:{width:E.RULER_THICKNESS+"px",height:t.viewportPx+"px"});let c=0;function f(){c||(c=requestAnimationFrame(()=>{c=0,g()}))}function g(){const b=a.value;if(!b)return;const W=b.getContext("2d");if(!W)return;const j=window.devicePixelRatio||1,U=Math.max(0,Math.round(t.viewportPx)),y=E.RULER_THICKNESS;b.width=(n.value?U:y)*j,b.height=(n.value?y:U)*j,W.setTransform(j,0,0,j,0,0);const M=getComputedStyle(b),N=M.getPropertyValue("--pd-ruler-bg").trim()||"#F8F9FC",O=M.getPropertyValue("--pd-ruler").trim()||"#9AA1AF",A=M.getPropertyValue("--pd-accent").trim()||"#165DFF";W.fillStyle=N,W.fillRect(0,0,n.value?U:y,n.value?y:U);const k=t.scale>0?t.scale:1,z=E.mmToPx(1)*k;if(z<=0)return;const u=-t.originPx/z,x=(U-t.originPx)/z,Y=E.chooseMajorStepMM(k),be=E.buildRulerTicks(u,x,Y);h(W,be,z,O,!0),h(W,be,z,O,!1),R(W,0,A),R(W,t.paperLengthMM,A);const ge=d.value;if(ge!==null&&ge>=0&&ge<=U){if(W.strokeStyle=A,W.lineWidth=1.5,W.beginPath(),n.value){const fe=Math.round(ge)+.5;W.moveTo(fe,0),W.lineTo(fe,y)}else{const fe=Math.round(ge)+.5;W.moveTo(0,fe),W.lineTo(y,fe)}W.stroke()}}function h(b,W,j,U,y){b.strokeStyle=U,b.fillStyle=U,b.globalAlpha=y?.32:1,b.lineWidth=1,b.font="9px ui-monospace, Menlo, monospace",b.textBaseline="top";for(const M of W){if((M.mm<0||M.mm>t.paperLengthMM)!==y)continue;const O=Math.round(t.originPx+M.mm*j)+.5,A=M.major?8:4;b.beginPath(),n.value?(b.moveTo(O,0),b.lineTo(O,A)):(b.moveTo(0,O),b.lineTo(A,O)),b.stroke(),M.major&&M.label&&(n.value?b.fillText(M.label,O+2,11):(b.save(),b.translate(11,O+2),b.rotate(-Math.PI/2),b.fillText(M.label,0,0),b.restore()))}b.globalAlpha=1}function R(b,W,j){const U=E.mmToPx(1)*(t.scale>0?t.scale:1),y=Math.round(t.originPx+W*U)+.5;y<=0||y>=t.viewportPx||(b.strokeStyle=j,b.globalAlpha=.55,b.lineWidth=1,b.beginPath(),n.value?(b.moveTo(y,0),b.lineTo(y,E.RULER_THICKNESS)):(b.moveTo(0,y),b.lineTo(E.RULER_THICKNESS,y)),b.stroke(),b.globalAlpha=1)}e.watch(()=>[t.viewportPx,t.originPx,t.paperLengthMM,t.scale,t.cursorPx,t.orientation],f),e.onMounted(f),e.onBeforeUnmount(()=>{c&&cancelAnimationFrame(c)});let C=!1;function v(b){const W=a.value;if(!W)return null;const j=W.getBoundingClientRect(),U=n.value?b.clientX-j.left:b.clientY-j.top;if(U<0||U>t.viewportPx)return null;const y=E.mmToPx(1)*(t.scale>0?t.scale:1);return(U-t.originPx)/y}function p(b){b.button===0&&(C=!0,b.preventDefault(),window.addEventListener("mousemove",G),window.addEventListener("mouseup",J),ne(b))}function B(b){const W=a.value;if(!W)return;const j=W.getBoundingClientRect();i.value=n.value?b.clientX-j.left:b.clientY-j.top,f()}function _(){i.value=null,f()}function ne(b){const W=v(b);s("guide-dragging",W)}function G(b){C&&ne(b)}function J(b){if(!C)return;C=!1,window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",J);const W=v(b);W!==null&&W>=0&&W<=t.paperLengthMM&&s("add-guide",l.value,W),s("guide-dragging",null)}return e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",J)}),(b,W)=>(e.openBlock(),e.createElementBlock("canvas",{ref_key:"canvasRef",ref:a,class:e.normalizeClass(["pd-ruler",`is-${o.orientation}`]),style:e.normalizeStyle(m.value),onMousedown:p,onMousemove:B,onMouseleave:_},null,38))}}),$t=ce(za,[["__scopeId","data-v-1e7d0633"]]),Aa={class:"canvas-scroll"},je=96/25.4,Pa=e.defineComponent({__name:"CanvasArea",props:{templateData:{},elements:{},scale:{},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},hasClipboard:{type:Boolean},guides:{},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","coordinate","add-guide","guide-move","guide-remove","zoom","clone-element"],setup(o,{expose:r,emit:t}){const s=o,n=t;function l(T,$){n("select",T,$)}const a=e.ref(null),i=e.computed(()=>E.getPaperDimensions(s.templateData).width),d=e.computed(()=>E.getPaperDimensions(s.templateData).height),m=e.reactive({originX:0,originY:0,viewW:0,viewH:0,paperScale:1}),c=e.reactive({x:null,y:null}),f=e.reactive({x:0,y:0}),g=e.computed(()=>({transform:`translate(${f.x}px, ${f.y}px)`}));function h(){const T=a.value,$=T?.querySelector(".hiprint-printPaper");if(!T||!$)return;const I=T.getBoundingClientRect(),ee=$.getBoundingClientRect(),oe=s.scale||1,ue=ee.width/E.mmToPx(i.value);m.paperScale=Math.abs(ue-oe)<.002?oe:ue,m.originX=ee.left-I.left-E.RULER_THICKNESS,m.originY=ee.top-I.top-E.RULER_THICKNESS,m.viewW=T.clientWidth-E.RULER_THICKNESS,m.viewH=T.clientHeight-E.RULER_THICKNESS}function R(){f.x=a.value?.scrollLeft??0,f.y=a.value?.scrollTop??0,h()}let C=null,v=0;function p(){cancelAnimationFrame(v);const T=performance.now()+220,$=()=>{h(),performance.now()<T&&(v=requestAnimationFrame($))};v=requestAnimationFrame($)}const B=e.ref(null);function _(T,$){B.value=$===null?null:{type:T,mm:$}}const ne=e.computed(()=>{const T=B.value,$=a.value?.querySelector(".hiprint-printPaper");if(!T||!$)return{};const I=$.getBoundingClientRect(),ee=I.width/E.mmToPx(i.value),oe=E.mmToPx(T.mm)*(ee>0?ee:s.scale||1);return T.type==="vertical"?{left:I.left+oe+"px",top:I.top+"px",height:I.height+"px"}:{left:I.left+"px",top:I.top+oe+"px",width:I.width+"px"}});function G(T){const $=a.value?.querySelector(".hiprint-printPaper");if(!$)return;const I=$.getBoundingClientRect(),ee=s.scale||1,oe=E.pxToMm((T.clientX-I.left)/ee),ue=E.pxToMm((T.clientY-I.top)/ee);if(!(oe<0||ue<0))return{x:oe,y:ue}}function J(T){const $=G(T),I=T.dataTransfer?.getData("fieldData");if(I)try{const oe=JSON.parse(I);n("drop-field",oe,$);return}catch{}const ee=T.dataTransfer?.getData("elementType");ee&&n("drop-element",ee,$)}const b=e.reactive({visible:!1,x:0,y:0,w:0,h:0});let W={x:0,y:0};function j(T){return!T||!(T instanceof HTMLElement)?!1:!!(T===a.value||T.classList.contains("canvas-scroll")||T.classList.contains("hiprint-printPaper")||T.classList.contains("hiprint-printPaper-content")||T.classList.contains("zone-layer")||T.classList.contains("grid-bg")||T.classList.contains("watermark-layer"))}function U(T){const $=a.value,I=$?.querySelector(".hiprint-printPaper");if(!$||!I)return;const ee=$.getBoundingClientRect();c.x=T.clientX-ee.left-E.RULER_THICKNESS,c.y=T.clientY-ee.top-E.RULER_THICKNESS;const oe=I.getBoundingClientRect(),ue=s.scale||1,L=E.pxToMm((T.clientX-oe.left)/ue),F=E.pxToMm((T.clientY-oe.top)/ue);if(L<0||F<0){n("coordinate",null);return}n("coordinate",{x:L,y:F})}function y(){n("coordinate",null),c.x=null,c.y=null}function M(T,$,I,ee){const oe=a.value;if(!oe)return;const ue=Math.max(ee,Math.round(T)),L=Math.round((s.scale||1)*100);if(ue===L)return;const F=s.scale||1,V=ue/100/F,w=getComputedStyle(oe),P=parseFloat(w.paddingLeft)||0,ae=parseFloat(w.paddingTop)||0,me=oe.scrollLeft+$-P,ye=oe.scrollTop+I-ae;n("zoom",ue-L),e.nextTick(()=>{const we=getComputedStyle(oe),xe=parseFloat(we.paddingLeft)||0,Re=parseFloat(we.paddingTop)||0;oe.scrollLeft=me*V-$+xe,oe.scrollTop=ye*V-I+Re})}function N(T){if(!(T.ctrlKey||T.metaKey))return;T.preventDefault();const $=a.value;if(!$)return;const I=Math.round((s.scale||1)*100),ee=E.nextWheelScale(I,T.deltaY>0?-1:1);if(ee===I)return;const oe=$.getBoundingClientRect();M(ee,T.clientX-oe.left,T.clientY-oe.top,E.MIN_SCALE_PERCENT)}function O(T){const $=a.value;if(!$)return;const I=Math.round((s.scale||1)*100),ee=E.nextWheelScale(I,T);M(ee,$.clientWidth/2,$.clientHeight/2,E.MIN_SCALE_PERCENT)}function A(T){const $=a.value;if(!$)return;const I=$.querySelector(".hiprint-printPaper"),ee=I?.style.transition??"";I&&(I.style.transition="none"),M(T,$.clientWidth/2,$.clientHeight/2,E.FIT_SCALE_MIN_PERCENT),e.nextTick(()=>{I&&(I.style.transition=ee)})}function k(T){T.button!==2&&j(T.target)&&(n("clear-selection"),W={x:T.clientX,y:T.clientY},b.visible=!0,b.x=T.clientX,b.y=T.clientY,b.w=0,b.h=0,window.addEventListener("mousemove",u),window.addEventListener("mouseup",x))}function z(){if(b.w<3||b.h<3)return[];const T=a.value?.querySelector(".hiprint-printPaper");if(!T)return[];const $=T.getBoundingClientRect(),I=s.scale||1,ee=b.x<W.x,oe=[];for(const ue of s.elements){if(ue.options.visible===!1||ue.options.locked)continue;const L=$.left+ue.options.left*je*I,F=$.top+ue.options.top*je*I,V=L+ue.options.width*je*I,w=F+ue.options.height*je*I,P=L<b.x+b.w&&V>b.x&&F<b.y+b.h&&w>b.y,ae=L>=b.x&&V<=b.x+b.w&&F>=b.y&&w<=b.y+b.h;(ee?ae:P)&&oe.push(ue.id)}return oe}function u(T){const $=T.clientX-W.x,I=T.clientY-W.y;b.x=$>=0?W.x:T.clientX,b.y=I>=0?W.y:T.clientY,b.w=Math.abs($),b.h=Math.abs(I),n("preview",z())}function x(){window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",x);const T=z();n("preview",T),T.length>0?n("commit-preview"):n("clear-selection"),n("preview",[]),b.visible=!1}const Y=e.reactive({visible:!1,x:0,y:0,flipX:0,flipY:0,targetId:null}),be=e.ref(null),ge=e.inject(Je,null);function fe(T,$){if(!$&&!j(T.target))return;$&&!ge?.value.has($)&&n("select",$,!1),Y.targetId=$??null,Y.visible=!0,Y.x=T.clientX,Y.y=T.clientY,Y.flipX=0,Y.flipY=0,e.nextTick(()=>{const ee=be.value;if(!ee)return;const oe=ee.getBoundingClientRect(),ue=4;T.clientX+oe.width+ue>window.innerWidth&&(Y.flipX=-oe.width),T.clientY+oe.height+ue>window.innerHeight&&(Y.flipY=-oe.height)}),window.removeEventListener("mousedown",q);const I=++se;e.nextTick(()=>{I===se&&window.addEventListener("mousedown",q)})}let se=0;function q(T){const $=be.value;$&&$.contains(T.target)||S()}function S(){Y.visible=!1,window.removeEventListener("mousedown",q)}function D(){S(),s.hasClipboard&&n("paste")}function K(){S(),n("select-all")}function Z(){S(),n("clear-selection")}function te(T,$){S(),T==="copy"?n("copy"):T==="cut"?n("cut"):T==="paste"?D():T==="delete"?n("delete"):T==="move-layer"&&n("move-layer",$)}e.onMounted(()=>{e.nextTick(h),a.value&&typeof ResizeObserver<"u"&&(C=new ResizeObserver(h),C.observe(a.value))}),e.watch(()=>s.scale,p),e.watch([i,d],()=>e.nextTick(h));function pe(){const T=a.value;if(!T)return;let $=0,I=0,ee=0;const oe=performance.now()+800,ue=()=>{const{scrollWidth:L,scrollHeight:F}=T;if(L===I&&F===ee?$++:$=0,I=L,ee=F,$>=2||performance.now()>oe){const V=T.scrollWidth,w=T.scrollHeight,P=T.clientWidth,ae=T.clientHeight;T.scrollLeft=Math.max(0,(V-P)/2),T.scrollTop=Math.max(0,(w-ae)/2);return}requestAnimationFrame(ue)};requestAnimationFrame(ue)}return r({centerScroll:pe,fitToWindow:A,zoomByStep:O}),e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",x),window.removeEventListener("mousedown",q),C?.disconnect(),cancelAnimationFrame(v)}),(T,$)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:a,class:"canvas-area",onDragover:$[23]||($[23]=e.withModifiers(()=>{},["prevent"])),onDrop:J,onMousedown:k,onMousemove:U,onMouseleave:y,onWheel:N,onScroll:R,onContextmenu:e.withModifiers(fe,["prevent"])},[e.createElementVNode("div",Aa,[e.createVNode(Ma,{"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:l,onGuideMove:$[0]||($[0]=(I,ee)=>T.$emit("guide-move",I,ee)),onGuideRemove:$[1]||($[1]=I=>T.$emit("guide-remove",I)),onDragStart:$[2]||($[2]=I=>T.$emit("drag-start")),onDragStop:$[3]||($[3]=I=>T.$emit("drag-stop")),onDblclickElement:$[4]||($[4]=I=>T.$emit("dblclick-element",I)),onDblclickCell:$[5]||($[5]=(I,ee,oe)=>T.$emit("dblclick-cell",I,ee,oe)),onContextmenu:$[6]||($[6]=(I,ee)=>fe(ee,I)),onZoneHeightChange:$[7]||($[7]=(I,ee)=>T.$emit("zone-height-change",I,ee)),onZoneHeightCommit:$[8]||($[8]=I=>T.$emit("zone-height-commit",I)),onCloneElement:$[9]||($[9]=(I,ee)=>T.$emit("clone-element",I,ee))},null,8,["template-data","runtime-elements","scale","show-grid","snap-to-grid","show-table-ghost-border","guides"])]),o.showRuler?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ruler-overlay",style:e.normalizeStyle(g.value)},[$[24]||($[24]=e.createElementVNode("div",{class:"ruler-corner"},null,-1)),e.createVNode($t,{orientation:"horizontal","viewport-px":m.viewW,"origin-px":m.originX,"paper-length-m-m":i.value,scale:m.paperScale,"cursor-px":c.x,onAddGuide:$[10]||($[10]=(I,ee)=>n("add-guide",I,ee)),onGuideDragging:$[11]||($[11]=I=>_("vertical",I))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"]),e.createVNode($t,{orientation:"vertical","viewport-px":m.viewH,"origin-px":m.originY,"paper-length-m-m":d.value,scale:m.paperScale,"cursor-px":c.y,onAddGuide:$[12]||($[12]=(I,ee)=>n("add-guide",I,ee)),onGuideDragging:$[13]||($[13]=I=>_("horizontal",I))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"])],4)):e.createCommentVNode("",!0),B.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ruler-guide-preview",`guide-${B.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),Y.visible?(e.openBlock(),e.createElementBlock("div",{key:3,ref_key:"contextMenuRef",ref:be,class:"context-menu",onMousedown:$[22]||($[22]=e.withModifiers(()=>{},["stop"])),style:e.normalizeStyle({left:Y.x+Y.flipX+"px",top:Y.y+Y.flipY+"px"})},[Y.targetId?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"context-menu-item",onClick:$[14]||($[14]=I=>te("copy"))},"复制"),e.createElementVNode("div",{class:"context-menu-item",onClick:$[15]||($[15]=I=>te("cut"))},"剪切"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!o.hasClipboard}]),onClick:$[16]||($[16]=I=>te("paste"))},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:$[17]||($[17]=I=>te("delete"))},"删除"),$[25]||($[25]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:$[18]||($[18]=I=>te("move-layer","top"))},"置顶"),e.createElementVNode("div",{class:"context-menu-item",onClick:$[19]||($[19]=I=>te("move-layer","up"))},"上移"),e.createElementVNode("div",{class:"context-menu-item",onClick:$[20]||($[20]=I=>te("move-layer","down"))},"下移"),e.createElementVNode("div",{class:"context-menu-item",onClick:$[21]||($[21]=I=>te("move-layer","bottom"))},"置底")],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!o.hasClipboard}]),onClick:D},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:K},"全选"),e.createElementVNode("div",{class:"context-menu-item",onClick:Z},"取消选择")],64))],36)):e.createCommentVNode("",!0)],544))}}),Ra=ce(Pa,[["__scopeId","data-v-427d3548"]]),La={class:"property-search"},Ua=e.defineComponent({__name:"PropertySearch",emits:["search"],setup(o,{emit:r}){const t=e.ref(""),s=r;function n(){s("search",t.value)}return(l,a)=>(e.openBlock(),e.createElementBlock("div",La,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=i=>t.value=i),class:"pd-input",type:"search",placeholder:"搜索属性...","aria-label":"搜索属性",onInput:n},null,544),[[e.vModelText,t.value]])]))}}),Ia=ce(Ua,[["__scopeId","data-v-10ab6c84"]]),Fa={class:"group-icon"},Ha={class:"group-title"},Oa={class:"expand-icon"},Wa={class:"group-content"},Ga=e.defineComponent({__name:"PropertyGroup",props:{title:{},icon:{},defaultExpanded:{type:Boolean},groupKey:{}},setup(o){const r=o,t=e.ref(r.defaultExpanded??!0),n={Document:"≡",Brush:"◧",Setting:"⚙"}[r.icon]||"•";function l(){t.value=!t.value,a()}function a(){const d=`property-group-${r.groupKey}`;try{localStorage.setItem(d,String(t.value))}catch{}}function i(){const d=`property-group-${r.groupKey}`;try{const m=localStorage.getItem(d);m!==null&&(t.value=m==="true")}catch{}}return e.onMounted(()=>{i()}),(d,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-group",{"is-expanded":t.value}])},[e.createElementVNode("div",{class:"group-header",onClick:l},[e.createElementVNode("span",Fa,e.toDisplayString(e.unref(n)),1),e.createElementVNode("span",Ha,e.toDisplayString(o.title),1),e.createElementVNode("span",Oa,e.toDisplayString(t.value?"▾":"▸"),1)]),e.withDirectives(e.createElementVNode("div",Wa,[e.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[e.vShow,t.value]])],2))}}),$e=ce(Ga,[["__scopeId","data-v-2ba57031"]]),Ka={class:"position-grid"},qa={class:"pd-field"},Ya={class:"pd-field"},ja={class:"pd-field"},Xa={class:"pd-field"},Za=e.defineComponent({__name:"PositionSizeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const r=o;function t(s){return r.searching?r.matchedKeys?.has(s)??!0:!0}return(s,n)=>(e.openBlock(),e.createBlock($e,{title:"位置与尺寸",icon:"Location","default-expanded":"","group-key":"position-size"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:n[4]||(n[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Ka,[e.withDirectives(e.createElementVNode("div",qa,[n[5]||(n[5]=e.createElementVNode("span",{class:"pd-label"},"X",-1)),e.createVNode(re,{modelValue:o.element.options.left,"onUpdate:modelValue":n[0]||(n[0]=l=>o.element.options.left=l),min:0},null,8,["modelValue"])],512),[[e.vShow,t("ps-left")]]),e.withDirectives(e.createElementVNode("div",Ya,[n[6]||(n[6]=e.createElementVNode("span",{class:"pd-label"},"Y",-1)),e.createVNode(re,{modelValue:o.element.options.top,"onUpdate:modelValue":n[1]||(n[1]=l=>o.element.options.top=l),min:0},null,8,["modelValue"])],512),[[e.vShow,t("ps-top")]]),e.withDirectives(e.createElementVNode("div",ja,[n[7]||(n[7]=e.createElementVNode("span",{class:"pd-label"},"W",-1)),e.createVNode(re,{modelValue:o.element.options.width,"onUpdate:modelValue":n[2]||(n[2]=l=>o.element.options.width=l),min:4},null,8,["modelValue"])],512),[[e.vShow,t("ps-width")]]),e.withDirectives(e.createElementVNode("div",Xa,[n[8]||(n[8]=e.createElementVNode("span",{class:"pd-label"},"H",-1)),e.createVNode(re,{modelValue:o.element.options.height,"onUpdate:modelValue":n[3]||(n[3]=l=>o.element.options.height=l),min:4},null,8,["modelValue"])],512),[[e.vShow,t("ps-height")]])])],32)]),_:1}))}}),Ja=ce(Za,[["__scopeId","data-v-bc364679"]]),Qa={class:"pd-field"},_a={class:"pd-field"},ei={class:"pd-field"},ti={class:"pd-field"},oi={class:"pd-radio-group",role:"radiogroup"},ni={class:"pd-radio"},li={class:"pd-radio"},ai={class:"pd-radio"},ii={class:"pd-field"},ri={class:"pd-radio-group",role:"radiogroup"},si={class:"pd-radio"},di={class:"pd-radio"},ci={class:"pd-radio"},ui={class:"color-row"},mi={class:"pd-field"},pi={class:"pd-field"},vi={class:"pd-field"},fi={class:"pd-field"},gi={class:"pd-field"},hi=["value"],bi={key:0,class:"pd-field"},Ei={class:"pd-field"},yi=["checked"],ki={key:1,class:"pd-empty"},Vi=e.defineComponent({__name:"AppearanceGroup",props:{element:{},isTextType:{type:Boolean},matchedKeys:{},searching:{type:Boolean}},setup(o){const r=o;function t(a){return r.searching?r.matchedKeys?.has(a)??!0:!0}const s=e.computed(()=>r.element.printElementType.type==="table"),n=e.computed(()=>E.resolveElementTextFit(r.element.printElementType.type||"text",r.element.options));function l(a){r.element.options.textFit=a.target.value}return(a,i)=>(e.openBlock(),e.createBlock($e,{title:"外观",icon:"Brush","default-expanded":"","group-key":"appearance"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:i[15]||(i[15]=e.withModifiers(()=>{},["prevent"]))},[o.isTextType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",Qa,[i[16]||(i[16]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(ht,{modelValue:o.element.options.fontFamily,"onUpdate:modelValue":i[0]||(i[0]=d=>o.element.options.fontFamily=d)},null,8,["modelValue"])],512),[[e.vShow,t("ap-font-family")]]),e.withDirectives(e.createElementVNode("div",_a,[i[17]||(i[17]=e.createElementVNode("span",{class:"pd-label"},"字体大小",-1)),e.createVNode(re,{modelValue:o.element.options.fontSize,"onUpdate:modelValue":i[1]||(i[1]=d=>o.element.options.fontSize=d),min:8,max:72},null,8,["modelValue"])],512),[[e.vShow,t("ap-font-size")]]),e.withDirectives(e.createElementVNode("div",ei,[i[19]||(i[19]=e.createElementVNode("span",{class:"pd-label"},"字体粗细",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":i[2]||(i[2]=d=>o.element.options.fontWeight=d),style:{width:"100%"}},[...i[18]||(i[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",ti,[i[23]||(i[23]=e.createElementVNode("span",{class:"pd-label"},"对齐",-1)),e.createElementVNode("div",oi,[e.createElementVNode("label",ni,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[3]||(i[3]=d=>o.element.options.textAlign=d),value:"left"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),i[20]||(i[20]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",li,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[4]||(i[4]=d=>o.element.options.textAlign=d),value:"center"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),i[21]||(i[21]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",ai,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[5]||(i[5]=d=>o.element.options.textAlign=d),value:"right"},null,512),[[e.vModelRadio,o.element.options.textAlign]]),i[22]||(i[22]=e.createElementVNode("span",null,"右",-1))])])],512),[[e.vShow,t("ap-align")]]),e.withDirectives(e.createElementVNode("div",ii,[i[27]||(i[27]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",ri,[e.createElementVNode("label",si,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[6]||(i[6]=d=>o.element.options.verticalAlign=d),value:"top"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),i[24]||(i[24]=e.createElementVNode("span",null,"顶",-1))]),e.createElementVNode("label",di,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[7]||(i[7]=d=>o.element.options.verticalAlign=d),value:"middle"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),i[25]||(i[25]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",ci,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":i[8]||(i[8]=d=>o.element.options.verticalAlign=d),value:"bottom"},null,512),[[e.vModelRadio,o.element.options.verticalAlign]]),i[26]||(i[26]=e.createElementVNode("span",null,"底",-1))])])],512),[[e.vShow,t("ap-vertical-align")]]),e.createElementVNode("div",ui,[e.withDirectives(e.createElementVNode("div",mi,[i[28]||(i[28]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(Ne,{modelValue:o.element.options.color,"onUpdate:modelValue":i[9]||(i[9]=d=>o.element.options.color=d)},null,8,["modelValue"])],512),[[e.vShow,t("ap-color")]]),e.withDirectives(e.createElementVNode("div",pi,[i[29]||(i[29]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ne,{modelValue:o.element.options.backgroundColor,"onUpdate:modelValue":i[10]||(i[10]=d=>o.element.options.backgroundColor=d)},null,8,["modelValue"])],512),[[e.vShow,t("ap-bg-color")]])]),e.withDirectives(e.createElementVNode("div",vi,[i[30]||(i[30]=e.createElementVNode("span",{class:"pd-label"},"行高",-1)),e.createVNode(re,{modelValue:o.element.options.lineHeight,"onUpdate:modelValue":i[11]||(i[11]=d=>o.element.options.lineHeight=d),min:0,max:100},null,8,["modelValue"])],512),[[e.vShow,t("ap-line-height")]]),e.withDirectives(e.createElementVNode("div",fi,[i[31]||(i[31]=e.createElementVNode("span",{class:"pd-label"},"字间距",-1)),e.createVNode(re,{modelValue:o.element.options.letterSpacing,"onUpdate:modelValue":i[12]||(i[12]=d=>o.element.options.letterSpacing=d),min:0,max:20,step:.5},null,8,["modelValue"])],512),[[e.vShow,t("ap-letter-spacing")]]),e.withDirectives(e.createElementVNode("div",gi,[i[33]||(i[33]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:n.value,style:{width:"100%"},onChange:l},[...i[32]||(i[32]=[e.createElementVNode("option",{value:"clip"},"截断",-1),e.createElementVNode("option",{value:"shrink"},"自动缩小",-1),e.createElementVNode("option",{value:"autoHeight"},"自适应行高",-1)])],40,hi)],512),[[e.vShow,t("ap-text-fit")]]),n.value==="shrink"?e.withDirectives((e.openBlock(),e.createElementBlock("div",bi,[i[34]||(i[34]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(re,{"model-value":o.element.options.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":i[13]||(i[13]=d=>o.element.options.shrinkMinFontSize=d??void 0)},null,8,["model-value"])],512)),[[e.vShow,t("ap-shrink-min")]]):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",Ei,[i[35]||(i[35]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:o.element.options.wordWrap!==!1,type:"checkbox",class:"pd-switch",onInput:i[14]||(i[14]=d=>o.element.options.wordWrap=d.target.checked?void 0:!1)},null,40,yi)],512),[[e.vShow,t("ap-word-wrap")]])],64)):e.createCommentVNode("",!0),!o.isTextType&&!s.value?(e.openBlock(),e.createElementBlock("p",ki,"当前元素不支持外观设置")):e.createCommentVNode("",!0)],32)]),_:1}))}}),Ni=ce(Vi,[["__scopeId","data-v-ec9e5cb7"]]),wi={class:"pd-field"},Ci=["value"],Si={class:"pd-field"},xi=["value"],$i={class:"pd-hint"},Bi={class:"pd-field"},Di={class:"pd-field"},Ti=["checked"],Mi={class:"pd-field"},zi={key:1,class:"pd-field"},Ai=["value"],Pi={key:2,class:"pd-hint"},Ri={key:3,class:"pd-field"},Li=["value"],Ui={class:"pd-field"},Ii={class:"pd-field"},Fi=e.defineComponent({__name:"CodeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["change"],setup(o,{emit:r}){const t=o,s=r,n=e.computed(()=>t.element.printElementType.type==="barcode"),l=e.computed(()=>t.element.printElementType.type==="qrcode"),a=e.computed(()=>(t.element.options.barcodeType||"CODE128").toUpperCase()),i=e.computed(()=>t.element.options.printerDpi?String(t.element.options.printerDpi):""),d=e.computed(()=>!!t.element.options.printerDpi),m=e.computed(()=>n.value&&d.value);function c(C){const v=Number(C.target.value);t.element.options.printerDpi=v>0?v:void 0,R()}function f(C){const v=C.target.value;t.element.options.barcodeType=v==="CODE128"?void 0:v,R()}function g(C){t.element.options.fit=C.target.value||void 0,R()}function h(C){return t.searching?t.matchedKeys?.has(C)??!0:!0}function R(){s("change")}return(C,v)=>(e.openBlock(),e.createBlock($e,{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"]))},[n.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",wi,[v[8]||(v[8]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{class:"pd-select",value:a.value,onChange:f},[...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,Ci)],512),[[e.vShow,h("cd-type")]]),e.withDirectives(e.createElementVNode("div",Si,[v[10]||(v[10]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{class:"pd-select",value:i.value,onChange:c},[...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,xi)],512),[[e.vShow,h("cd-dpi")]]),e.withDirectives(e.createElementVNode("p",$i,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小",512),[[e.vShow,h("cd-dpi")]]),e.withDirectives(e.createElementVNode("div",Bi,[v[11]||(v[11]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(re,{"model-value":o.element.options.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":v[0]||(v[0]=p=>{o.element.options.barWidth=p,R()})},null,8,["model-value"])],512),[[e.vShow,h("cd-bar-width")]]),e.withDirectives(e.createElementVNode("p",{class:"pd-hint"},e.toDisplayString(m.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),元素框放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),513),[[e.vShow,h("cd-bar-width")]]),e.withDirectives(e.createElementVNode("div",Di,[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]=p=>{o.element.options.hideTitle=p.target.checked?void 0:!0,R()})},null,40,Ti)],512),[[e.vShow,h("cd-show-text")]]),e.withDirectives(e.createElementVNode("div",Mi,[v[13]||(v[13]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(re,{"model-value":o.element.options.fontSize,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":v[2]||(v[2]=p=>{o.element.options.fontSize=p??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,h("cd-font-size")]])],64)):l.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",zi,[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]=p=>{o.element.options.qrCodeLevel=p.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,Ai)],512)),[[e.vShow,h("cd-ec-level")]]):e.createCommentVNode("",!0),v[20]||(v[20]=e.createElementVNode("h3",{class:"pd-divider"},"自定义设置",-1)),n.value?(e.openBlock(),e.createElementBlock("p",Pi,"条码尺寸由「条宽」与「打印机分辨率」结算:宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),n.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("div",Ri,[v[17]||(v[17]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{class:"pd-select",value:o.element.options.fit||"contain",onChange:g},[...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,Li)],512)),[[e.vShow,h("cd-fit")]]),e.withDirectives(e.createElementVNode("div",Ui,[v[18]||(v[18]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(re,{"model-value":o.element.options.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":v[4]||(v[4]=p=>{o.element.options.maxWidth=p??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,h("cd-max-width")]]),e.withDirectives(e.createElementVNode("div",Ii,[v[19]||(v[19]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(re,{"model-value":o.element.options.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":v[5]||(v[5]=p=>{o.element.options.maxHeight=p??void 0,R()})},null,8,["model-value"])],512),[[e.vShow,h("cd-max-height")]])],32)]),_:1}))}}),Hi={class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},Oi={class:"pd-dialog-header"},Wi={class:"expression-editor"},Gi={class:"ee-nav"},Ki={class:"ee-nav-tabs"},qi={class:"ee-content"},Yi={class:"ee-content-search"},ji=["placeholder"],Xi={class:"ee-content-list"},Zi={class:"ee-field-group-icon"},Ji=["onDblclick"],Qi={class:"ee-field-info"},_i={class:"ee-item-label"},er={class:"ee-item-key"},tr={key:0,class:"pd-empty"},or=["onDblclick"],nr={class:"ee-field-info"},lr={class:"ee-item-label"},ar={class:"ee-item-key"},ir={class:"ee-func-group"},rr=["onDblclick"],sr={class:"ee-field-info"},dr={class:"ee-item-label"},cr={class:"ee-item-key"},ur={class:"ee-func-group"},mr=["onDblclick"],pr={class:"ee-field-info"},vr={class:"ee-item-label"},fr={class:"ee-item-key"},gr={class:"ee-func-group"},hr=["onDblclick"],br={class:"ee-field-info"},Er={class:"ee-item-label"},yr={class:"ee-item-key"},kr={class:"ee-editor"},Vr={class:"ee-editor-section"},Nr={class:"ee-editor-section"},wr={class:"pd-dialog-footer"},Cr=e.defineComponent({__name:"ExpressionEditor",props:{modelValue:{type:Boolean},expression:{},fields:{}},emits:["update:modelValue","update:expression"],setup(o,{emit:r}){const t=o,s=r,n=e.computed({get:()=>t.modelValue,set:U=>s("update:modelValue",U)}),l=e.ref("field"),a=e.computed(()=>{switch(l.value){case"field":return"搜索字段...";case"variable":return"搜索变量...";case"function":return"搜索函数...";default:return"搜索..."}}),i=e.ref(""),d=e.computed(()=>E.filterGroups(E.groupFields(t.fields??[]),i.value));e.watch(n,U=>{U&&(p.value=t.expression||"")});function m(U){const{insideParens:y}=g();W(y?U.fieldKey:`{${U.fieldKey}}`)}function c(U){const{insideParens:y}=g();W(y?U.template.replace(/^\{|\}$/g,""):U.template)}function f(U){const{insideBlock:y}=g(),M=y?U.template:`{${U.template}}`,N=M.indexOf("(")+1;W(M,N)}function g(){const y=B.value?.selectionStart??p.value.length,M=p.value.substring(0,y);let N=!1;const O=M.lastIndexOf("{");O!==-1&&!M.slice(O+1).includes("}")&&(N=!0);let A=!1;const k=M.lastIndexOf("(");return k!==-1&&!M.slice(k+1).includes(")")&&(A=!0),{insideBlock:N,insideParens:A}}const h=e.computed(()=>{if(!i.value.trim())return J;const U=i.value.trim().toLowerCase();return J.filter(y=>y.label.toLowerCase().includes(U)||y.name.toLowerCase().includes(U))}),R=e.computed(()=>{if(!i.value.trim())return _;const U=i.value.trim().toLowerCase();return _.filter(y=>y.label.toLowerCase().includes(U)||y.name.toLowerCase().includes(U))}),C=e.computed(()=>{if(!i.value.trim())return ne;const U=i.value.trim().toLowerCase();return ne.filter(y=>y.label.toLowerCase().includes(U)||y.name.toLowerCase().includes(U))}),v=e.computed(()=>{if(!i.value.trim())return G;const U=i.value.trim().toLowerCase();return G.filter(y=>y.label.toLowerCase().includes(U)||y.name.toLowerCase().includes(U))}),p=e.ref(t.expression||""),B=e.ref(null);e.watch(()=>t.expression,U=>{p.value=U||""});const _=[{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()"}],ne=[{name:"ADD",label:"相加",template:"ADD()"},{name:"SUB",label:"相减",template:"SUB()"},{name:"MUL",label:"相乘",template:"MUL()"},{name:"DIV",label:"相除",template:"DIV()"},{name:"ROUND",label:"四舍五入",template:"ROUND()"},{name:"ROUNDUP",label:"进一法",template:"ROUNDUP()"},{name:"ROUNDDOWN",label:"去尾法",template:"ROUNDDOWN()"},{name:"ROUNDBANK",label:"四舍六入五成双",template:"ROUNDBANK()"}],G=[{name:"MONEY",label:"金额格式化",template:"MONEY()"},{name:"DATE",label:"日期格式化",template:"DATE()"},{name:"UPPER",label:"大写金额",template:"UPPER()"},{name:"IF",label:"条件判断",template:"IF()"}],J=[{name:"pageIndex",label:"当前页码",template:"{pageIndex}"},{name:"totalPages",label:"总页数",template:"{totalPages}"},{name:"printDate",label:"打印日期",template:"{printDate}"},{name:"printTime",label:"打印时间",template:"{printTime}"}],b=e.computed(()=>{if(!p.value.trim())return"(输入表达式后预览)";try{const U={...E.DEFAULT_DEMO_DATA,...he.resolveSystemVariables()},y=E.evaluateTemplate(p.value,U);return y==null?"(无法计算)":String(y)}catch{return"(表达式错误)"}});function W(U,y=U.length){const M=B.value;if(!M){p.value+=U;return}const N=M.selectionStart,O=M.selectionEnd,A=p.value.substring(0,N),k=p.value.substring(O);p.value=A+U+k;const z=N+y;e.nextTick(()=>{M.focus(),M.selectionStart=M.selectionEnd=z})}function j(){s("update:expression",p.value),n.value=!1}return(U,y)=>n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pd-dialog-overlay",onKeydown:y[7]||(y[7]=e.withKeys(M=>n.value=!1,["esc"]))},[e.createElementVNode("section",Hi,[e.createElementVNode("header",Oi,[y[8]||(y[8]=e.createElementVNode("strong",{id:"expression-editor-title"},"编辑表达式",-1)),e.createElementVNode("button",{type:"button",class:"pd-close","aria-label":"关闭",onClick:y[0]||(y[0]=M=>n.value=!1)},"×")]),e.createElementVNode("div",Wi,[e.createElementVNode("div",Gi,[y[9]||(y[9]=e.createElementVNode("div",{class:"ee-nav-title"},"类型",-1)),e.createElementVNode("div",Ki,[e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:l.value==="field"}]),onClick:y[1]||(y[1]=M=>l.value="field")}," 📁 字段 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:l.value==="variable"}]),onClick:y[2]||(y[2]=M=>l.value="variable")}," 🔧 变量 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:l.value==="function"}]),onClick:y[3]||(y[3]=M=>l.value="function")}," ⚡ 函数 ",2)])]),e.createElementVNode("div",qi,[e.createElementVNode("div",Yi,[e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":y[4]||(y[4]=M=>i.value=M),placeholder:a.value},null,8,ji),[[e.vModelText,i.value]])]),e.createElementVNode("div",Xi,[l.value==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,M=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:M.key||"_top"},[M.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ee-field-group",{"is-list":M.isList}])},[e.createElementVNode("span",Zi,e.toDisplayString(M.isList?"📋":"📁"),1),e.createElementVNode("span",null,e.toDisplayString(M.label),1)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.fields,N=>(e.openBlock(),e.createElementBlock("div",{key:N.fieldKey,class:"ee-list-item ee-field-item",style:e.normalizeStyle({paddingLeft:M.key?"22px":"10px"}),onDblclick:O=>m(N)},[e.createElementVNode("div",Qi,[e.createElementVNode("span",_i,e.toDisplayString(N.fieldLabel),1),e.createElementVNode("span",er,e.toDisplayString(N.fieldKey),1)])],44,Ji))),128))],64))),128)),d.value.length===0?(e.openBlock(),e.createElementBlock("p",tr,"暂无字段")):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),l.value==="variable"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(h.value,M=>(e.openBlock(),e.createElementBlock("div",{key:M.name,class:"ee-list-item",onDblclick:N=>c(M)},[e.createElementVNode("div",nr,[e.createElementVNode("span",lr,e.toDisplayString(M.label),1),e.createElementVNode("span",ar,e.toDisplayString(M.template),1)])],40,or))),128)):e.createCommentVNode("",!0),l.value==="function"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",ir,[y[10]||(y[10]=e.createElementVNode("div",{class:"ee-func-group-title"},"聚合函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,M=>(e.openBlock(),e.createElementBlock("div",{key:M.name,class:"ee-list-item",onDblclick:N=>f(M)},[e.createElementVNode("div",sr,[e.createElementVNode("span",dr,e.toDisplayString(M.label),1),e.createElementVNode("span",cr,e.toDisplayString(M.name)+"()",1)])],40,rr))),128))]),e.createElementVNode("div",ur,[y[11]||(y[11]=e.createElementVNode("div",{class:"ee-func-group-title"},"数值运算",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,M=>(e.openBlock(),e.createElementBlock("div",{key:M.name,class:"ee-list-item",onDblclick:N=>f(M)},[e.createElementVNode("div",pr,[e.createElementVNode("span",vr,e.toDisplayString(M.label),1),e.createElementVNode("span",fr,e.toDisplayString(M.name)+"()",1)])],40,mr))),128))]),e.createElementVNode("div",gr,[y[12]||(y[12]=e.createElementVNode("div",{class:"ee-func-group-title"},"格式化函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,M=>(e.openBlock(),e.createElementBlock("div",{key:M.name,class:"ee-list-item",onDblclick:N=>f(M)},[e.createElementVNode("div",br,[e.createElementVNode("span",Er,e.toDisplayString(M.label),1),e.createElementVNode("span",yr,e.toDisplayString(M.name)+"()",1)])],40,hr))),128))])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",kr,[e.createElementVNode("div",Vr,[y[13]||(y[13]=e.createElementVNode("div",{class:"ee-editor-title"},"表达式编辑",-1)),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:B,"onUpdate:modelValue":y[5]||(y[5]=M=>p.value=M),class:"ee-textarea",rows:"6",placeholder:"双击左侧字段/变量/函数插入,或直接输入静态内容"},null,512),[[e.vModelText,p.value]])]),e.createElementVNode("div",Nr,[y[14]||(y[14]=e.createElementVNode("div",{class:"ee-editor-title"},"预览结果",-1)),e.createElementVNode("div",{class:e.normalizeClass(["ee-preview",{"ee-preview-error":b.value==="(表达式错误)"}])},e.toDisplayString(b.value),3)]),y[15]||(y[15]=e.createStaticVNode('<div class="ee-help-section" data-v-3fb017fe><div class="ee-help-title" data-v-3fb017fe>帮助信息</div><div class="ee-help-grid" data-v-3fb017fe><div class="ee-help-card ee-help-field" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>输入方式</div><div class="ee-help-card-content" data-v-3fb017fe> 双击左侧字段、变量、函数即可插入到表达式输入框中<br data-v-3fb017fe> 静态数据直接输入即可,如:供应商名称<br data-v-3fb017fe> 动态解析字段、变量、函数必须用 {} 包裹<br data-v-3fb017fe> 示例:{SUM(supplier.name)}<br data-v-3fb017fe> 注意:只能嵌套一层 </div></div><div class="ee-help-card ee-help-function" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>函数使用</div><div class="ee-help-card-content" data-v-3fb017fe> SUM(字段) - 求和<br data-v-3fb017fe> AVG(字段) - 平均值<br data-v-3fb017fe> COUNT(字段) - 计数<br data-v-3fb017fe> IF(条件, 真值, 假值) - 条件判断<br data-v-3fb017fe> 四则运算:{qty * price}、{ADD(qty, 1)}<br data-v-3fb017fe> 修约:ROUND 四舍五入 / ROUNDUP 进一 / ROUNDDOWN 去尾 / ROUNDBANK 四舍六入五成双 </div></div><div class="ee-help-card ee-help-variable" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>系统变量</div><div class="ee-help-card-content" data-v-3fb017fe> {pageIndex} - 当前页码<br data-v-3fb017fe> {totalPages} - 总页数<br data-v-3fb017fe> {printDate} - 打印日期 </div></div><div class="ee-help-card ee-help-conditional" data-v-3fb017fe><div class="ee-help-card-title" data-v-3fb017fe>示例</div><div class="ee-help-card-content" data-v-3fb017fe> 静态文本:供应商名称<br data-v-3fb017fe> 动态字段:{supplier.name}<br data-v-3fb017fe> 函数调用:{SUM(amount)}<br data-v-3fb017fe> 条件判断:{IF(amount&gt;1000, &quot;大单&quot;, &quot;小单&quot;)}<br data-v-3fb017fe> 运算并修约:{ROUND(qty * price, 2)} </div></div></div></div>',1))])]),e.createElementVNode("footer",wr,[e.createElementVNode("button",{type:"button",class:"pd-button",onClick:y[6]||(y[6]=M=>n.value=!1)},"取消"),e.createElementVNode("button",{type:"button",class:"pd-button primary",onClick:j},"确定")])])],32)):e.createCommentVNode("",!0)}}),Qe=ce(Cr,[["__scopeId","data-v-3fb017fe"]]),Sr={class:"pd-field"},xr={class:"pd-label"},$r=["value","placeholder"],Br=e.defineComponent({__name:"BindingControl",props:{descriptor:{},modelValue:{},fields:{}},emits:["update:modelValue"],setup(o,{emit:r}){const t=r,s=e.ref(!1);function n(){s.value=!0}return(l,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",Sr,[e.createElementVNode("span",xr,e.toDisplayString(o.descriptor.label),1),e.createElementVNode("input",{value:o.modelValue,class:"pd-input",placeholder:o.descriptor.placeholder||"输入内容,支持 {字段} 表达式",onInput:a[0]||(a[0]=i=>t("update:modelValue",i.target.value)),onDblclick:n},null,40,$r)]),e.createVNode(Qe,{modelValue:s.value,"onUpdate:modelValue":a[1]||(a[1]=i=>s.value=i),fields:o.fields,expression:o.modelValue,"onUpdate:expression":a[2]||(a[2]=i=>t("update:modelValue",i))},null,8,["modelValue","fields","expression"])],64))}}),Dr={class:"pd-field"},Tr=["value"],Mr=["value"],zr={class:"pd-field"},Ar={class:"pd-field"},Pr={class:"pd-field"},Rr={class:"pd-field"},Lr={style:{width:"60px"}},Ur=e.defineComponent({__name:"TableSettingsGroup",props:{element:{},fields:{}},setup(o){const r=o,t=e.inject(He,null),s=e.computed(()=>r.fields.filter(a=>a.fieldType==="list").map(a=>({label:a.fieldLabel,value:a.fieldKey})));function n(a){r.element.options.dataSource=a||void 0,t?.recordHistory()}function l(a,i){if(i===void 0)return;const d=r.element.options.tableColWidths,m=t?.maxTableWidth.value??1/0,c=d.reduce((f,g,h)=>h===a?f:f+g,0);if(c+i>m){const f=Math.max(5,Math.round((m-c)*10)/10);alert(`表格总宽不能超过打印范围宽度 ${m}mm,列${a+1} 已调整为 ${f}mm`),d[a]=f}else d[a]=i;E.syncTableElementSize(r.element.options),t?.recordHistory()}return(a,i)=>(e.openBlock(),e.createBlock($e,{title:"表格设置",icon:"Grid","default-expanded":"","group-key":"table-settings"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:i[4]||(i[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Dr,[i[5]||(i[5]=e.createElementVNode("span",{class:"pd-label"},"列表数据源字段",-1)),e.createElementVNode("select",{value:o.element.options.dataSource,class:"pd-select",style:{width:"100%"},onChange:i[0]||(i[0]=d=>n(d.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,d=>(e.openBlock(),e.createElementBlock("option",{key:d.value,value:d.value},e.toDisplayString(d.label),9,Mr))),128))],40,Tr)]),e.createElementVNode("div",zr,[i[6]||(i[6]=e.createElementVNode("span",{class:"pd-label"},"默认字号 (pt)",-1)),e.createVNode(re,{modelValue:o.element.options.tableDefaultFontSize,"onUpdate:modelValue":i[1]||(i[1]=d=>o.element.options.tableDefaultFontSize=d),min:5,max:72,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Ar,[i[7]||(i[7]=e.createElementVNode("span",{class:"pd-label"},"默认文字颜色",-1)),e.createVNode(Ne,{modelValue:o.element.options.tableDefaultColor,"onUpdate:modelValue":i[2]||(i[2]=d=>o.element.options.tableDefaultColor=d)},null,8,["modelValue"])]),e.createElementVNode("div",Pr,[i[8]||(i[8]=e.createElementVNode("span",{class:"pd-label"},"默认内边距 (mm)",-1)),e.createVNode(re,{modelValue:o.element.options.tableDefaultPadding,"onUpdate:modelValue":i[3]||(i[3]=d=>o.element.options.tableDefaultPadding=d),min:0,max:10,step:.5,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",Rr,[i[9]||(i[9]=e.createElementVNode("span",{class:"pd-label"},"列宽 (mm)",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.element.options.tableColWidths,(d,m)=>(e.openBlock(),e.createElementBlock("div",{key:m,class:"col-width-row"},[e.createElementVNode("span",Lr,"列"+e.toDisplayString(m+1),1),e.createVNode(re,{"model-value":d,min:5,max:200,"onUpdate:modelValue":c=>l(m,c)},null,8,["model-value","onUpdate:modelValue"])]))),128))])],32)]),_:1}))}}),Ir=ce(Ur,[["__scopeId","data-v-b5fdc7ff"]]),Fr={class:"border-row"},Hr={class:"pd-field"},Or={class:"pd-field"},Wr={class:"pd-field"},Gr=e.defineComponent({__name:"BorderBgGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const r=o;function t(s){return r.searching?r.matchedKeys?.has(s)??!0:!0}return(s,n)=>(e.openBlock(),e.createBlock($e,{title:"边框与背景",icon:"Picture","default-expanded":"","group-key":"border-bg"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:n[3]||(n[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Fr,[e.withDirectives(e.createElementVNode("div",Hr,[n[4]||(n[4]=e.createElementVNode("span",{class:"pd-label"},"边框宽度",-1)),e.createVNode(re,{modelValue:o.element.options.borderWidth,"onUpdate:modelValue":n[0]||(n[0]=l=>o.element.options.borderWidth=l),min:0,max:20,step:.25},null,8,["modelValue"])],512),[[e.vShow,t("bb-border-width")]]),e.withDirectives(e.createElementVNode("div",Or,[n[5]||(n[5]=e.createElementVNode("span",{class:"pd-label"},"边框颜色",-1)),e.createVNode(Ne,{modelValue:o.element.options.borderColor,"onUpdate:modelValue":n[1]||(n[1]=l=>o.element.options.borderColor=l)},null,8,["modelValue"])],512),[[e.vShow,t("bb-border-color")]])]),e.withDirectives(e.createElementVNode("div",Wr,[n[6]||(n[6]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ne,{modelValue:o.element.options.backgroundColor,"onUpdate:modelValue":n[2]||(n[2]=l=>o.element.options.backgroundColor=l)},null,8,["modelValue"])],512),[[e.vShow,t("bb-bg-color")]])],32)]),_:1}))}}),Kr=ce(Gr,[["__scopeId","data-v-e0e6d714"]]),qr={class:"advanced-row"},Yr={class:"pd-field"},jr={class:"pd-field"},Xr={class:"pd-field"},Zr={class:"pd-field"},Jr=e.defineComponent({__name:"AdvancedGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["delete-element"],setup(o){const r=o;function t(s){return r.searching?r.matchedKeys?.has(s)??!0:!0}return(s,n)=>(e.openBlock(),e.createBlock($e,{title:"高级设置",icon:"Setting","group-key":"advanced"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:n[4]||(n[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",qr,[e.withDirectives(e.createElementVNode("div",Yr,[n[5]||(n[5]=e.createElementVNode("span",{class:"pd-label"},"锁定",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":n[0]||(n[0]=l=>o.element.options.locked=l)},null,512),[[e.vModelCheckbox,o.element.options.locked]])],512),[[e.vShow,t("ad-locked")]]),e.withDirectives(e.createElementVNode("div",jr,[n[6]||(n[6]=e.createElementVNode("span",{class:"pd-label"},"每页重复",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":n[1]||(n[1]=l=>o.element.options.fixed=l)},null,512),[[e.vModelCheckbox,o.element.options.fixed]])],512),[[e.vShow,t("ad-fixed")]])]),e.withDirectives(e.createElementVNode("div",Xr,[n[7]||(n[7]=e.createElementVNode("span",{class:"pd-label"},"层级",-1)),e.createVNode(re,{modelValue:o.element.options.zIndex,"onUpdate:modelValue":n[2]||(n[2]=l=>o.element.options.zIndex=l),min:0,max:999},null,8,["modelValue"])],512),[[e.vShow,t("ad-z-index")]]),e.withDirectives(e.createElementVNode("div",Zr,[e.createElementVNode("button",{type:"button",class:"pd-button danger",onClick:n[3]||(n[3]=l=>s.$emit("delete-element"))}," 删除元素 ")],512),[[e.vShow,t("ad-delete")]])],32)]),_:1}))}}),Qr=ce(Jr,[["__scopeId","data-v-14924be2"]]),_r={key:0,class:"pd-field"},es=["checked"],ts={class:"pd-field"},os=["checked"],ns={class:"pd-field"},ls=["checked"],Bt=e.defineComponent({__name:"PaginationGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(o){const r=o,t=e.computed(()=>r.element.printElementType.type==="table"),s=e.computed({get:()=>r.element.options.tablePagination?.enabled??!0,set:()=>{}});function n(c){r.element.options.tablePagination={enabled:c}}const l=e.computed({get:()=>r.element.options.pagination?.pageable??!0,set:()=>{}}),a=e.computed({get:()=>r.element.options.pagination?.keepWithNext??!1,set:()=>{}});function i(c){r.element.options.pagination={pageable:c,keepWithNext:a.value}}function d(c){r.element.options.pagination={pageable:l.value,keepWithNext:c}}function m(c){return r.searching?r.matchedKeys?.has(c)??!0:!0}return(c,f)=>(e.openBlock(),e.createBlock($e,{title:"分页配置",icon:"Document","group-key":"pagination"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:f[3]||(f[3]=e.withModifiers(()=>{},["prevent"]))},[t.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",_r,[f[4]||(f[4]=e.createElementVNode("span",{class:"pd-label"},"启用分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:s.value,onChange:f[0]||(f[0]=g=>n(g.target.checked))},null,40,es)],512)),[[e.vShow,m("pg-enabled")]]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.withDirectives(e.createElementVNode("div",ts,[f[5]||(f[5]=e.createElementVNode("span",{class:"pd-label"},"参与分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:l.value,onChange:f[1]||(f[1]=g=>i(g.target.checked))},null,40,os)],512),[[e.vShow,m("pg-pageable")]]),e.withDirectives(e.createElementVNode("div",ns,[f[6]||(f[6]=e.createElementVNode("span",{class:"pd-label"},"与下元素同页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:a.value,onChange:f[2]||(f[2]=g=>d(g.target.checked))},null,40,ls)],512),[[e.vShow,m("pg-keep-with-next")]])],64))],32)]),_:1}))}}),as={class:"image-content-upload"},is=["disabled"],rs=e.defineComponent({__name:"ImageContentUpload",props:{disabled:{type:Boolean}},emits:["success"],setup(o,{emit:r}){const t=o,s=r,n=e.ref(!1),l=e.inject(vt,e.computed(()=>{})),a=e.computed(()=>t.disabled||n.value||!l.value);async function i(d){const m=d.target,c=m.files?.[0];if(c){if(!c.type.startsWith("image/")){alert("仅支持上传图片文件"),m.value="";return}if(!l.value){alert("图片上传能力未配置"),m.value="";return}n.value=!0;try{const f=await l.value(c);f?s("success",f):alert("图片上传失败")}catch(f){alert(f instanceof Error?f.message:"图片上传失败")}finally{n.value=!1,m.value=""}}}return(d,m)=>(e.openBlock(),e.createElementBlock("div",as,[e.createElementVNode("label",{class:e.normalizeClass(["pd-button small upload-label",{disabled:a.value}])},[m[0]||(m[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(n.value?"上传中...":"上传图片")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:a.value,onChange:i},null,40,is)],2),m[1]||(m[1]=e.createElementVNode("p",{class:"upload-tip"},"支持 jpg/png/gif/bmp/webp/svg 等图片,上传后填入相对路径",-1))]))}}),ss=ce(rs,[["__scopeId","data-v-b730e8e6"]]),ds={class:"pd-field"},cs=["value"],us={class:"pd-field"},ms={key:0,class:"pd-field"},ps=["checked"],vs=e.defineComponent({__name:"TableRowGroup",props:{element:{},selection:{}},setup(o){const r=o,t=e.inject(He),s=e.computed(()=>r.element.options.tableRows[r.selection.r1]);function n(i){const d=E.setRowType(r.element.options.tableRows,r.selection.r1,i);if(d){alert(d);return}t.recordHistory()}function l(i){i!==void 0&&(s.value.height=i,E.syncTableElementSize(r.element.options),t.recordHistory())}function a(i){E.setHeaderRepeat(r.element.options.tableRows,i),t.recordHistory()}return(i,d)=>(e.openBlock(),e.createBlock($e,{title:"行属性",icon:"Grid","default-expanded":"","group-key":"table-row"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:d[2]||(d[2]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",ds,[d[4]||(d[4]=e.createElementVNode("span",{class:"pd-label"},"行类型",-1)),e.createElementVNode("select",{value:s.value.type,class:"pd-select",style:{width:"100%"},onChange:d[0]||(d[0]=m=>n(m.target.value))},[...d[3]||(d[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,cs)]),e.createElementVNode("div",us,[d[5]||(d[5]=e.createElementVNode("span",{class:"pd-label"},"行高 (mm)",-1)),e.createVNode(re,{"model-value":s.value.height,min:3,max:100,step:.5,"onUpdate:modelValue":l},null,8,["model-value"])]),s.value.type==="header"?(e.openBlock(),e.createElementBlock("div",ms,[d[6]||(d[6]=e.createElementVNode("span",{class:"pd-label",title:"多级表头作为一个结构整体重复,勾选后表头区所有行都会在每页顶部重复"},"表头每页重复",-1)),e.createElementVNode("input",{checked:s.value.repeatOnPage??!1,type:"checkbox",class:"pd-switch",onInput:d[1]||(d[1]=m=>a(!!m.target.checked))},null,40,ps)])):e.createCommentVNode("",!0)],32)]),_:1}))}}),fs={class:"pd-field"},gs={class:"pd-radio-group",role:"radiogroup"},hs={class:"pd-radio"},bs=["checked"],Es={class:"pd-radio"},ys=["checked"],ks={class:"pd-radio"},Vs=["checked"],Ns={class:"pd-radio"},ws=["checked"],Cs={key:0,class:"pd-field"},Ss=["value"],xs={key:1,class:"pd-field"},$s=["checked"],Bs={key:2,class:"pd-field"},Ds={key:3,class:"pd-hint"},Ts={key:4,class:"pd-field"},Ms={key:5,class:"pd-field"},zs=["value"],As={key:6,class:"pd-hint"},Ps={key:7,class:"pd-field"},Rs=["value"],Ls={key:8,class:"pd-hint"},Us={key:9,class:"pd-field"},Is=["value"],Fs={key:10,class:"pd-field"},Hs={key:11,class:"pd-field"},Os={class:"pd-field"},Ws=["value"],Gs={class:"pd-field"},Ks={class:"pd-radio-group",role:"radiogroup"},qs={class:"pd-radio"},Ys=["checked"],js={class:"pd-radio"},Xs=["checked"],Zs={class:"pd-radio"},Js=["checked"],Qs={class:"pd-field"},_s={class:"pd-radio-group",role:"radiogroup"},ed={class:"pd-radio"},td=["checked"],od={class:"pd-radio"},nd=["checked"],ld={class:"pd-radio"},ad=["checked"],id={class:"cell-style-grid"},rd={class:"pd-field cell-font-field"},sd={class:"pd-field"},dd={class:"pd-field"},cd=["checked"],ud={class:"pd-field"},md={class:"pd-field"},pd={class:"border-style-row"},vd={style:{width:"112px","flex-shrink":"0"}},fd={class:"pd-button-group border-presets"},gd={class:"pd-checkbox-group"},hd={class:"pd-checkbox"},bd={class:"pd-checkbox"},Ed={class:"pd-checkbox"},yd={class:"pd-checkbox"},kd={class:"pd-field"},Vd={class:"pd-field"},Nd=["checked"],wd={key:12,class:"pd-field"},Cd=["value"],Sd={key:13,class:"pd-field"},xd={class:"merge-btns"},$d=["disabled","title"],Bd=["disabled"],Dd=e.defineComponent({__name:"TableCellGroup",props:{element:{},selection:{},fields:{}},setup(o,{expose:r}){const t=o,s=e.inject(He),n=e.computed(()=>t.element.options.tableRows),l=e.computed(()=>{const z=E.findMainCell(n.value,t.selection.r1,t.selection.c1);return n.value[z.r].cells[z.c]}),a=e.ref(!1),i=e.ref(""),d=e.computed(()=>l.value.cellType==="barcode"),m=e.computed(()=>l.value.cellType==="qrcode"),c=e.computed(()=>l.value.cellType==="image"),f=e.computed(()=>d.value&&!!l.value.printerDpi),g=e.computed(()=>!d.value&&!m.value&&!c.value),h=e.computed(()=>E.resolveCellTextFit(l.value));function R(z){const u=z.target.value;G(x=>{x.textFit=u})}function C(z){G(u=>{u.align=z})}function v(z){G(u=>{u.valign=z})}function p(z){const u=Number(z);G(x=>{x.printerDpi=u>0?u:void 0})}function B(z){G(u=>{u.cellType=z==="text"?void 0:z,z!=="barcode"&&(u.barcodeType=void 0,u.showBarcodeText=void 0,u.printerDpi=void 0),z!=="qrcode"&&(u.qrCodeLevel=void 0)})}function _(){i.value=l.value.formatter||"",a.value=!0}function ne(z){G(u=>{u.formatter=z||void 0})}function G(z){const u=t.selection;for(let x=u.r1;x<=u.r2;x++)for(let Y=u.c1;Y<=u.c2;Y++){const be=n.value[x].cells[Y];be.merged||z(be)}s.recordHistory()}const J=e.ref("solid"),b=e.ref(.75),W=e.ref("#333333"),j=e.ref([]);function U(){return{width:b.value,style:J.value,color:W.value}}function y(z){E.applyBorderPreset(n.value,t.selection,z,U()),s.recordHistory()}function M(z){const u=z.target,x=new Set(j.value);u.checked?x.add(u.value):x.delete(u.value),j.value=[...x];const Y=U();G(be=>{const ge={...be.borders??{}};for(const fe of["top","right","bottom","left"])x.has(fe)?ge[fe]={...Y}:delete ge[fe];be.borders=ge})}const N=e.computed(()=>E.canMergeReason(n.value,t.selection)),O=e.computed(()=>{const z=t.selection;for(let u=z.r1;u<=z.r2;u++)for(let x=z.c1;x<=z.c2;x++){const Y=n.value[u].cells[x];if(!Y.merged&&((Y.rowspan??1)>1||(Y.colspan??1)>1))return!0}return!1});function A(){E.mergeCells(n.value,t.selection),s.recordHistory()}function k(){E.splitCells(n.value,t.selection),s.recordHistory()}return r({openFormatterEditor:_}),(z,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode($e,{title:"单元格",icon:"Menu","default-expanded":"","group-key":"table-cell"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:u[43]||(u[43]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",fs,[u[49]||(u[49]=e.createElementVNode("span",{class:"pd-label"},"单元格类型",-1)),e.createElementVNode("div",gs,[e.createElementVNode("label",hs,[e.createElementVNode("input",{type:"radio",value:"text",checked:(l.value.cellType||"text")==="text",onChange:u[0]||(u[0]=x=>B(x.target.value))},null,40,bs),u[45]||(u[45]=e.createElementVNode("span",null,"文本",-1))]),e.createElementVNode("label",Es,[e.createElementVNode("input",{type:"radio",value:"barcode",checked:l.value.cellType==="barcode",onChange:u[1]||(u[1]=x=>B(x.target.value))},null,40,ys),u[46]||(u[46]=e.createElementVNode("span",null,"条形码",-1))]),e.createElementVNode("label",ks,[e.createElementVNode("input",{type:"radio",value:"qrcode",checked:l.value.cellType==="qrcode",onChange:u[2]||(u[2]=x=>B(x.target.value))},null,40,Vs),u[47]||(u[47]=e.createElementVNode("span",null,"二维码",-1))]),e.createElementVNode("label",Ns,[e.createElementVNode("input",{type:"radio",value:"image",checked:l.value.cellType==="image",onChange:u[3]||(u[3]=x=>B(x.target.value))},null,40,ws),u[48]||(u[48]=e.createElementVNode("span",null,"图片",-1))])])]),d.value?(e.openBlock(),e.createElementBlock("div",Cs,[u[51]||(u[51]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{value:l.value.barcodeType||"CODE128",class:"pd-select",onChange:u[4]||(u[4]=x=>G(Y=>{Y.barcodeType=x.target.value||void 0}))},[...u[50]||(u[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,Ss)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",xs,[u[52]||(u[52]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:l.value.showBarcodeText!==!1,type:"checkbox",class:"pd-switch",onInput:u[5]||(u[5]=x=>G(Y=>{Y.showBarcodeText=!!x.target.checked}))},null,40,$s)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Bs,[u[53]||(u[53]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(re,{"model-value":l.value.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":u[6]||(u[6]=x=>G(Y=>{Y.barWidth=x}))},null,8,["model-value"])])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("p",Ds,e.toDisplayString(f.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),单元格放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),1)):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Ts,[u[54]||(u[54]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(re,{"model-value":l.value.barFontSize??10,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":u[7]||(u[7]=x=>G(Y=>{Y.barFontSize=x??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Ms,[u[56]||(u[56]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{value:l.value.printerDpi?String(l.value.printerDpi):"",class:"pd-select",onChange:u[8]||(u[8]=x=>p(x.target.value))},[...u[55]||(u[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,zs)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("p",As,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小")):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createElementBlock("div",Ps,[u[58]||(u[58]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{value:l.value.qrCodeLevel||"M",class:"pd-select",onChange:u[9]||(u[9]=x=>G(Y=>{Y.qrCodeLevel=x.target.value||void 0}))},[...u[57]||(u[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,Rs)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("p",Ls,"单元格条码尺寸由「条宽」与「打印机分辨率」结算:可用宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),m.value||c.value?(e.openBlock(),e.createElementBlock("div",Us,[u[60]||(u[60]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{value:l.value.fit||"contain",class:"pd-select",onChange:u[10]||(u[10]=x=>G(Y=>{Y.fit=x.target.value}))},[...u[59]||(u[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,Is)])):e.createCommentVNode("",!0),d.value||m.value||c.value?(e.openBlock(),e.createElementBlock("div",Fs,[u[61]||(u[61]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(re,{"model-value":l.value.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":u[11]||(u[11]=x=>G(Y=>{Y.maxWidth=x??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),d.value||m.value||c.value?(e.openBlock(),e.createElementBlock("div",Hs,[u[62]||(u[62]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(re,{"model-value":l.value.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":u[12]||(u[12]=x=>G(Y=>{Y.maxHeight=x??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Os,[u[63]||(u[63]=e.createElementVNode("span",{class:"pd-label"},"内容",-1)),e.createElementVNode("input",{value:l.value.formatter||"",class:"pd-input",placeholder:"输入内容,支持 {字段} 表达式",onInput:u[13]||(u[13]=x=>G(Y=>{Y.formatter=x.target.value||void 0})),onDblclick:_},null,40,Ws)]),e.createElementVNode("div",Gs,[u[67]||(u[67]=e.createElementVNode("span",{class:"pd-label"},"水平对齐",-1)),e.createElementVNode("div",Ks,[e.createElementVNode("label",qs,[e.createElementVNode("input",{type:"radio",value:"left",checked:l.value.align==="left",onChange:u[14]||(u[14]=x=>C(x.target.value))},null,40,Ys),u[64]||(u[64]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",js,[e.createElementVNode("input",{type:"radio",value:"center",checked:l.value.align==="center",onChange:u[15]||(u[15]=x=>C(x.target.value))},null,40,Xs),u[65]||(u[65]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Zs,[e.createElementVNode("input",{type:"radio",value:"right",checked:l.value.align==="right",onChange:u[16]||(u[16]=x=>C(x.target.value))},null,40,Js),u[66]||(u[66]=e.createElementVNode("span",null,"右",-1))])])]),e.createElementVNode("div",Qs,[u[71]||(u[71]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",_s,[e.createElementVNode("label",ed,[e.createElementVNode("input",{type:"radio",value:"top",checked:l.value.valign==="top",onChange:u[17]||(u[17]=x=>v(x.target.value))},null,40,td),u[68]||(u[68]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",od,[e.createElementVNode("input",{type:"radio",value:"middle",checked:l.value.valign==="middle",onChange:u[18]||(u[18]=x=>v(x.target.value))},null,40,nd),u[69]||(u[69]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",ld,[e.createElementVNode("input",{type:"radio",value:"bottom",checked:l.value.valign==="bottom",onChange:u[19]||(u[19]=x=>v(x.target.value))},null,40,ad),u[70]||(u[70]=e.createElementVNode("span",null,"下",-1))])])]),e.createElementVNode("div",id,[e.createElementVNode("div",rd,[u[72]||(u[72]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(ht,{"model-value":l.value.fontFamily,placeholder:"继承默认","onUpdate:modelValue":u[20]||(u[20]=x=>G(Y=>{Y.fontFamily=x}))},null,8,["model-value"])]),e.createElementVNode("div",sd,[u[73]||(u[73]=e.createElementVNode("span",{class:"pd-label"},"字号 (pt)",-1)),e.createVNode(re,{"model-value":l.value.fontSize,min:5,max:72,placeholder:"默认","onUpdate:modelValue":u[21]||(u[21]=x=>G(Y=>{Y.fontSize=x??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",dd,[u[74]||(u[74]=e.createElementVNode("span",{class:"pd-label"},"加粗",-1)),e.createElementVNode("input",{checked:l.value.fontWeight==="bold",type:"checkbox",class:"pd-switch",onInput:u[22]||(u[22]=x=>G(Y=>{Y.fontWeight=x.target.checked?"bold":void 0}))},null,40,cd)]),e.createElementVNode("div",ud,[u[75]||(u[75]=e.createElementVNode("span",{class:"pd-label"},"文字颜色",-1)),e.createVNode(Ne,{"model-value":l.value.color,"onUpdate:modelValue":u[23]||(u[23]=x=>G(Y=>{Y.color=x}))},null,8,["model-value"])]),e.createElementVNode("div",md,[u[76]||(u[76]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ne,{"model-value":l.value.backgroundColor,"onUpdate:modelValue":u[24]||(u[24]=x=>G(Y=>{Y.backgroundColor=x}))},null,8,["model-value"])])]),u[87]||(u[87]=e.createElementVNode("h3",{class:"pd-divider"},"边框",-1)),e.createElementVNode("div",pd,[e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":u[25]||(u[25]=x=>J.value=x),style:{width:"90px"}},[...u[77]||(u[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,J.value]]),e.createElementVNode("div",vd,[e.createVNode(re,{modelValue:b.value,"onUpdate:modelValue":u[26]||(u[26]=x=>b.value=x),min:.25,max:5,step:.25},null,8,["modelValue"])]),e.createVNode(Ne,{modelValue:W.value,"onUpdate:modelValue":u[27]||(u[27]=x=>W.value=x),clearable:!1},null,8,["modelValue"])]),e.createElementVNode("div",fd,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[28]||(u[28]=x=>y("all"))},"全部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[29]||(u[29]=x=>y("outer"))},"外侧"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[30]||(u[30]=x=>y("inner"))},"内部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:u[31]||(u[31]=x=>y("none"))},"无")]),e.createElementVNode("div",gd,[e.createElementVNode("label",hd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[32]||(u[32]=x=>j.value=x),value:"top",onChange:u[33]||(u[33]=x=>M(x))},null,544),[[e.vModelCheckbox,j.value]]),u[78]||(u[78]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",bd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[34]||(u[34]=x=>j.value=x),value:"right",onChange:u[35]||(u[35]=x=>M(x))},null,544),[[e.vModelCheckbox,j.value]]),u[79]||(u[79]=e.createElementVNode("span",null,"右",-1))]),e.createElementVNode("label",Ed,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[36]||(u[36]=x=>j.value=x),value:"bottom",onChange:u[37]||(u[37]=x=>M(x))},null,544),[[e.vModelCheckbox,j.value]]),u[80]||(u[80]=e.createElementVNode("span",null,"下",-1))]),e.createElementVNode("label",yd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u[38]||(u[38]=x=>j.value=x),value:"left",onChange:u[39]||(u[39]=x=>M(x))},null,544),[[e.vModelCheckbox,j.value]]),u[81]||(u[81]=e.createElementVNode("span",null,"左",-1))])]),e.createElementVNode("div",kd,[u[82]||(u[82]=e.createElementVNode("span",{class:"pd-label"},"内边距 (mm)",-1)),e.createVNode(re,{"model-value":l.value.padding,min:0,max:10,step:.5,placeholder:"默认","onUpdate:modelValue":u[40]||(u[40]=x=>G(Y=>{Y.padding=x??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",Vd,[u[83]||(u[83]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:l.value.wordWrap??!0,type:"checkbox",class:"pd-switch",onInput:u[41]||(u[41]=x=>G(Y=>{Y.wordWrap=!!x.target.checked}))},null,40,Nd)]),g.value?(e.openBlock(),e.createElementBlock("div",wd,[u[85]||(u[85]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:h.value,style:{width:"100%"},onChange:R},[...u[84]||(u[84]=[e.createElementVNode("option",{value:"clip"},"截断",-1),e.createElementVNode("option",{value:"shrink"},"自动缩小",-1),e.createElementVNode("option",{value:"autoHeight"},"自适应行高",-1)])],40,Cd)])):e.createCommentVNode("",!0),g.value&&h.value==="shrink"?(e.openBlock(),e.createElementBlock("div",Sd,[u[86]||(u[86]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(re,{"model-value":l.value.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":u[42]||(u[42]=x=>G(Y=>{Y.shrinkMinFontSize=x??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",xd,[e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!!N.value,title:N.value||"",onClick:A}," 合并单元格 ",8,$d),e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!O.value,onClick:k},"拆分单元格",8,Bd)])],32)]),_:1}),e.createVNode(Qe,{modelValue:a.value,"onUpdate:modelValue":u[44]||(u[44]=x=>a.value=x),fields:o.fields,expression:i.value,"onUpdate:expression":ne},null,8,["modelValue","fields","expression"])],64))}}),Td=ce(Dd,[["__scopeId","data-v-291c10c6"]]),Md={class:"watermark-config"},zd={class:"pd-field"},Ad={key:0,class:"pd-field"},Pd={class:"pd-field"},Rd={class:"pd-hint"},Ld={class:"pd-field"},Ud={class:"pd-field"},Id={class:"pd-hint"},Fd={class:"pd-field"},Hd=["value"],Od={class:"pd-field"},Wd=["min"],Gd={class:"pd-field"},Kd=["min"],qd=e.defineComponent({__name:"WatermarkConfig",props:{modelValue:{},fields:{}},emits:["update:modelValue"],setup(o,{emit:r}){const t=o,s=r,n=he.WATERMARK_DENSITY_PRESETS,l=he.WATERMARK_DEFAULTS.minTileWidth,a=he.WATERMARK_DEFAULTS.minTileHeight;function i(J){const b=J.trim();return b?/[{}]/.test(b)||/^[A-Za-z_$][\w$]*\s*\(/.test(b)?!0:/^[A-Za-z_$][\w$]*(\.[\w$]+)+$/.test(b):!1}function d(J){return J?J.mode==="binding"?J.binding??"":J.content??"":""}const m=e.ref(d(t.modelValue)),c=e.ref(t.modelValue?.testData||""),f=e.ref(!1),g=e.ref(t.modelValue?.mode==="binding"?"binding":"fixed"),h=e.reactive({rotate:t.modelValue?.rotate??he.WATERMARK_DEFAULTS.rotate,color:t.modelValue?.color||he.WATERMARK_DEFAULTS.color,opacity:t.modelValue?.opacity??he.WATERMARK_DEFAULTS.opacity,tileWidth:t.modelValue?.tileWidth??he.WATERMARK_DEFAULTS.tileWidth,tileHeight:t.modelValue?.tileHeight??he.WATERMARK_DEFAULTS.tileHeight}),R=e.computed(()=>g.value==="binding");e.watch(()=>t.modelValue,J=>{J&&(m.value=d(J),g.value=J.mode==="binding"?"binding":"fixed",c.value=J.testData||"",h.rotate=J.rotate??he.WATERMARK_DEFAULTS.rotate,h.color=J.color||he.WATERMARK_DEFAULTS.color,h.opacity=J.opacity??he.WATERMARK_DEFAULTS.opacity,h.tileWidth=J.tileWidth??he.WATERMARK_DEFAULTS.tileWidth,h.tileHeight=J.tileHeight??he.WATERMARK_DEFAULTS.tileHeight)},{deep:!0});const C=e.computed({get(){const{tileWidth:J,tileHeight:b}=h;for(const[W,j]of Object.entries(n))if(J===j.width&&b===j.height)return W;return"custom"},set(J){const b=n[J];b&&(h.tileWidth=b.width,h.tileHeight=b.height)}});function v(){g.value=i(m.value)?"binding":"fixed",G()}function p(){v()}function B(){f.value=!0}function _(J){m.value=J,v()}function ne(J){h.color=J,G()}function G(){const J={testData:c.value,rotate:h.rotate,color:h.color,opacity:h.opacity,tileWidth:h.tileWidth,tileHeight:h.tileHeight};s("update:modelValue",g.value==="binding"?{...J,mode:"binding",binding:m.value,content:""}:{...J,mode:"fixed",content:m.value,binding:""})}return(J,b)=>(e.openBlock(),e.createElementBlock("div",Md,[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",zd,[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]=W=>m.value=W),placeholder:"直接输入文字,或用表达式:{order.no}、{printDate}",title:"双击或点「编辑表达式」打开表达式弹框",onInput:p,onDblclick:B},null,544),[[e.vModelText,m.value]]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:B},"编辑表达式")]),R.value?(e.openBlock(),e.createElementBlock("div",Ad,[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]=W=>c.value=W),placeholder:"表达式取不到值时预览显示",onInput:G},null,544),[[e.vModelText,c.value]])])):e.createCommentVNode("",!0),e.createVNode(Qe,{modelValue:f.value,"onUpdate:modelValue":b[2]||(b[2]=W=>f.value=W),fields:o.fields,expression:m.value,"onUpdate:expression":_},null,8,["modelValue","fields","expression"]),e.createElementVNode("div",Pd,[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]=W=>h.rotate=W),min:-90,max:90,step:5,onChange:G},null,544),[[e.vModelText,h.rotate,void 0,{number:!0}]]),e.createElementVNode("span",Rd,e.toDisplayString(h.rotate)+"°",1)]),e.createElementVNode("div",Ld,[b[12]||(b[12]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(Ne,{"model-value":h.color,"onUpdate:modelValue":ne},null,8,["model-value"])]),e.createElementVNode("div",Ud,[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]=W=>h.opacity=W),min:.05,max:.5,step:.05,onChange:G},null,544),[[e.vModelText,h.opacity,void 0,{number:!0}]]),e.createElementVNode("span",Id,e.toDisplayString(h.opacity.toFixed(2)),1)]),e.createElementVNode("div",Fd,[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]=W=>C.value=W),style:{width:"100%"},onChange:G},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),(W,j)=>(e.openBlock(),e.createElementBlock("option",{key:j,value:j},e.toDisplayString(W.label)+"("+e.toDisplayString(W.width)+"×"+e.toDisplayString(W.height)+")",9,Hd))),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",Od,[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]=W=>h.tileWidth=W),min:e.unref(l),step:10,onChange:G},null,40,Wd),[[e.vModelText,h.tileWidth,void 0,{number:!0}]])]),e.createElementVNode("div",Gd,[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]=W=>h.tileHeight=W),min:e.unref(a),step:10,onChange:G},null,40,Kd),[[e.vModelText,h.tileHeight,void 0,{number:!0}]])])],64)):e.createCommentVNode("",!0)],32)]))}}),Yd=ce(qd,[["__scopeId","data-v-b55bfc50"]]),jd={class:"design-background-config"},Xd=["title"],Zd={class:"design-background-actions"},Jd=["disabled"],Qd=e.defineComponent({__name:"DesignBackgroundConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(o,{emit:r}){const t=o,s=r,n=e.ref(!1),l=e.inject(ft,e.computed(()=>{})),a=e.computed(()=>n.value||!l.value),i=e.computed(()=>t.modelValue?.rotation??0);async function d(f){const g=f.target,h=g.files?.[0];if(h){if(!h.type.startsWith("image/")){alert("仅支持上传图片文件"),g.value="";return}if(!l.value){alert("设计背景上传能力未配置"),g.value="";return}n.value=!0;try{const R=await l.value(h);R?s("update:modelValue",{src:R,rotation:0}):alert("设计背景上传失败")}catch(R){alert(R instanceof Error?R.message:"设计背景上传失败")}finally{n.value=!1,g.value=""}}}function m(){if(!t.modelValue?.src)return;const f=(i.value+90)%360;s("update:modelValue",{src:t.modelValue.src,rotation:f})}function c(){s("update:modelValue",void 0)}return(f,g)=>(e.openBlock(),e.createElementBlock("div",jd,[g[0]||(g[0]=e.createElementVNode("h3",{class:"pd-divider"},"设计背景",-1)),g[1]||(g[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,Xd),e.createElementVNode("div",Zd,[e.createElementVNode("button",{type:"button",class:"pd-button small rotate-btn",onClick:m}," 旋转("+e.toDisplayString(i.value)+"°) ",1),e.createElementVNode("button",{type:"button",class:"pd-button small remove-btn",onClick:c},"移除")])],64)):(e.openBlock(),e.createElementBlock("label",{key:1,class:e.normalizeClass(["pd-button small upload-label",{disabled:a.value}])},[e.createTextVNode(e.toDisplayString(n.value?"上传中...":"上传背景图")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:a.value,onChange:d},null,40,Jd)],2))]))}}),_d=ce(Qd,[["__scopeId","data-v-3f4d2e32"]]),ec={class:"tiling-config","data-test":"tiling-config"},tc={class:"pd-field"},oc={class:"tiling-switch"},nc=["checked","disabled"],lc={key:0,class:"pd-hint tiling-error"},ac={class:"pd-field"},ic=["value"],rc=["value"],sc={key:0,class:"pd-field"},dc={class:"custom-size-grid"},cc={key:1,class:"pd-field"},uc={class:"pd-radio-group",role:"radiogroup"},mc={class:"pd-radio"},pc=["checked"],vc={class:"pd-radio"},fc=["checked"],gc={class:"margin-grid"},hc={class:"pd-field"},bc={class:"pd-field"},Ec={class:"pd-field"},yc={class:"pd-field"},kc={class:"pd-field"},Vc={class:"pd-field"},Nc={class:"pd-field"},wc={key:2,class:"pd-hint tiling-summary"},Cc=e.defineComponent({__name:"TilingConfig",props:{modelValue:{},templateData:{}},emits:["update:modelValue"],setup(o,{emit:r}){const t=o,s=r,n=Object.keys(E.PAPER_PRESETS).filter(v=>v!=="CUSTOM"&&!E.PAPER_PRESETS[v]?.continuous),l=e.computed(()=>E.isContinuousPaperSize(t.templateData?.paperSize)),a=e.computed(()=>({...he.TILE_DEFAULTS,...t.modelValue??{},enabled:t.modelValue?.enabled??!1,sheetMargin:{...he.TILE_DEFAULTS.sheetMargin,...t.modelValue?.sheetMargin??{}}})),i=e.computed(()=>t.templateData?{...t.templateData,tiling:a.value}:void 0),d=e.computed(()=>i.value?he.validateTiling(i.value):[]),m=e.computed(()=>{const v=i.value;return v?Math.max(he.computeMaxColumns(v),1):1}),c=e.computed(()=>{const v=i.value;if(!(!v||d.value.length))try{return he.computeTileLayout(v)}catch{return}}),f=e.computed(()=>{const v=c.value,p=i.value;if(!v||!p)return"";const B=he.resolveSheetMm(p),_=a.value.sheetPaperSize==="CUSTOM"?"自定义":a.value.sheetPaperSize??"A4",ne=a.value.sheetPaperSize==="CUSTOM"?"":a.value.sheetOrientation==="landscape"?" 横向":" 纵向";return`目标纸 ${_}${ne} ${B.width}×${B.height}mm · ${v.columns} 列 × ${v.rows} 行 = 每张 ${v.perSheet} 格`});function g(v){s("update:modelValue",{...a.value,...v})}function h(v,p){g({sheetMargin:{...a.value.sheetMargin,[v]:p??0}})}function R(v){if(v!=="CUSTOM"){g({sheetPaperSize:v});return}const p=i.value,B=p?he.resolveSheetMm(p):{width:210,height:297};g({sheetPaperSize:"CUSTOM",sheetCustomWidth:a.value.sheetCustomWidth??B.width,sheetCustomHeight:a.value.sheetCustomHeight??B.height})}function C(v){if(!v){g({enabled:!1});return}const p=m.value,B=p>=1?Math.min(he.TILE_DEFAULTS.columns,p):1;g({...he.TILE_DEFAULTS,columns:B})}return(v,p)=>(e.openBlock(),e.createElementBlock("div",ec,[p[30]||(p[30]=e.createElementVNode("h3",{class:"pd-divider"},"拼版打印",-1)),p[31]||(p[31]=e.createElementVNode("p",{class:"pd-hint"},"把标签按「列 × 行」铺到一张大纸上批量打印",-1)),e.createElementVNode("div",tc,[e.createElementVNode("label",oc,[e.createElementVNode("input",{type:"checkbox",checked:a.value.enabled,disabled:l.value,onChange:p[0]||(p[0]=B=>C(B.target.checked))},null,40,nc),p[13]||(p[13]=e.createElementVNode("span",null,"启用拼版",-1))]),l.value?(e.openBlock(),e.createElementBlock("p",lc,"连续纸不支持拼版")):e.createCommentVNode("",!0)]),a.value.enabled&&!l.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",ac,[p[15]||(p[15]=e.createElementVNode("span",{class:"pd-label"},"目标纸张",-1)),e.createElementVNode("select",{class:"pd-select",style:{width:"100%"},value:a.value.sheetPaperSize??"A4",onChange:p[1]||(p[1]=B=>R(B.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),B=>(e.openBlock(),e.createElementBlock("option",{key:B,value:B},e.toDisplayString(e.unref(E.PAPER_PRESETS)[B]?.label??B),9,rc))),128)),p[14]||(p[14]=e.createElementVNode("option",{value:"CUSTOM"},"自定义",-1))],40,ic)]),a.value.sheetPaperSize==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",sc,[p[17]||(p[17]=e.createElementVNode("span",{class:"pd-label"},"目标纸宽高 (mm)",-1)),e.createElementVNode("div",dc,[e.createVNode(re,{"model-value":a.value.sheetCustomWidth,min:25,max:2e3,"onUpdate:modelValue":p[2]||(p[2]=B=>g({sheetCustomWidth:B}))},null,8,["model-value"]),p[16]||(p[16]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(re,{"model-value":a.value.sheetCustomHeight,min:25,max:2e3,"onUpdate:modelValue":p[3]||(p[3]=B=>g({sheetCustomHeight:B}))},null,8,["model-value"])])])):(e.openBlock(),e.createElementBlock("div",cc,[p[20]||(p[20]=e.createElementVNode("span",{class:"pd-label"},"目标纸方向",-1)),e.createElementVNode("div",uc,[e.createElementVNode("label",mc,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:(a.value.sheetOrientation??"portrait")==="portrait",onChange:p[4]||(p[4]=B=>g({sheetOrientation:"portrait"}))},null,40,pc),p[18]||(p[18]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",vc,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:a.value.sheetOrientation==="landscape",onChange:p[5]||(p[5]=B=>g({sheetOrientation:"landscape"}))},null,40,fc),p[19]||(p[19]=e.createElementVNode("span",null,"横向",-1))])])])),p[28]||(p[28]=e.createElementVNode("h3",{class:"pd-divider"},"拼版留白 (mm)",-1)),e.createElementVNode("div",gc,[e.createElementVNode("div",hc,[p[21]||(p[21]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(re,{"model-value":a.value.sheetMargin.top,min:0,max:100,"onUpdate:modelValue":p[6]||(p[6]=B=>h("top",B))},null,8,["model-value"])]),e.createElementVNode("div",bc,[p[22]||(p[22]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(re,{"model-value":a.value.sheetMargin.bottom,min:0,max:100,"onUpdate:modelValue":p[7]||(p[7]=B=>h("bottom",B))},null,8,["model-value"])]),e.createElementVNode("div",Ec,[p[23]||(p[23]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(re,{"model-value":a.value.sheetMargin.left,min:0,max:100,"onUpdate:modelValue":p[8]||(p[8]=B=>h("left",B))},null,8,["model-value"])]),e.createElementVNode("div",yc,[p[24]||(p[24]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(re,{"model-value":a.value.sheetMargin.right,min:0,max:100,"onUpdate:modelValue":p[9]||(p[9]=B=>h("right",B))},null,8,["model-value"])])]),p[29]||(p[29]=e.createElementVNode("h3",{class:"pd-divider"},"格间距与列数",-1)),e.createElementVNode("div",kc,[p[25]||(p[25]=e.createElementVNode("span",{class:"pd-label"},"横向间距",-1)),e.createVNode(re,{"model-value":a.value.gapX,min:0,max:50,"onUpdate:modelValue":p[10]||(p[10]=B=>g({gapX:B??0}))},null,8,["model-value"])]),e.createElementVNode("div",Vc,[p[26]||(p[26]=e.createElementVNode("span",{class:"pd-label"},"纵向间距",-1)),e.createVNode(re,{"model-value":a.value.gapY,min:0,max:50,"onUpdate:modelValue":p[11]||(p[11]=B=>g({gapY:B??0}))},null,8,["model-value"])]),e.createElementVNode("div",Nc,[p[27]||(p[27]=e.createElementVNode("span",{class:"pd-label"},"列数",-1)),e.createVNode(re,{"model-value":a.value.columns,min:1,max:m.value,"onUpdate:modelValue":p[12]||(p[12]=B=>g({columns:B??1}))},null,8,["model-value","max"])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,B=>(e.openBlock(),e.createElementBlock("p",{key:B.code,class:"pd-hint tiling-error"},e.toDisplayString(B.message),1))),128)),!d.value.length&&f.value?(e.openBlock(),e.createElementBlock("p",wc,e.toDisplayString(f.value),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]))}}),Sc=ce(Cc,[["__scopeId","data-v-aa278268"]]),xc={key:0,class:"prop-collapsed"},$c={class:"prop-head"},Bc={class:"pd-tabs prop-tabs"},Dc={class:"pd-tab-bar",role:"tablist"},Tc={class:"pd-tab-pane",role:"tabpanel"},Mc={class:"property-content"},zc={key:1,class:"pd-empty"},Ac={class:"pd-tab-pane",role:"tabpanel"},Pc={class:"pd-field"},Rc=["value"],Lc=["label"],Uc=["value"],Ic={key:0,class:"pd-hint"},Fc={key:1,class:"pd-field"},Hc={class:"pd-label"},Oc={class:"custom-size-grid"},Wc={key:2,class:"pd-field"},Gc={class:"pd-radio-group",role:"radiogroup"},Kc={class:"pd-radio"},qc=["checked"],Yc={class:"pd-radio"},jc=["checked"],Xc={key:3,class:"pd-field"},Zc={class:"pd-radio-group pd-radio-group--2col",role:"radiogroup"},Jc={class:"pd-radio"},Qc=["checked"],_c={class:"pd-radio"},eu=["checked"],tu={class:"pd-radio"},ou=["checked"],nu={class:"pd-radio"},lu=["checked"],au={class:"pd-field"},iu={class:"page-bg-row"},ru={key:5,class:"pd-hint"},su={class:"margin-grid"},du={class:"pd-field"},cu={class:"pd-field"},uu={class:"pd-field"},mu={class:"pd-field"},pu={class:"pd-field"},vu={class:"pd-field"},fu=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:r}){const t=o,s=r,n=e.computed(()=>{const V=[];for(const[w,P]of Object.entries(E.PAPER_PRESETS)){if(t.multiPage&&E.isContinuousPaperSize(w))continue;const ae=P.group??"其他";let me=V.find(ye=>ye.group===ae);me||(me={group:ae,items:[]},V.push(me)),me.items.push({key:w,label:P.label??w})}return V}),l=e.ref(""),a=e.computed(()=>t.element?["text","longText"].includes(t.element.printElementType.type):!1),i=e.computed(()=>t.element?t.element.printElementType.type==="image":!1),d=e.computed(()=>t.element?["barcode","qrcode"].includes(t.element.printElementType.type):!1),m=e.computed(()=>!t.element||t.element.printElementType.type!=="table"?!1:!!t.tableSelection&&t.tableSelection.elementId===t.element.id),c=e.computed(()=>t.element?t.element.printElementType.type==="table":!1),f=e.computed(()=>E.searchProperties(l.value)),g=e.computed(()=>f.value.groups),h=e.computed(()=>f.value.itemKeys),R=e.computed(()=>!!l.value.trim()),C=e.computed(()=>{if(!t.element)return[];if(t.element.printElementType.type==="table"&&t.tableSelection){const{r1:V,c1:w}=t.tableSelection,P=t.element.options.tableRows;if(P&&P[V]){const ae=P[V],me=t.element.options.fields?.[0]?.dataSource;return E.getTableCellBindings(ae.type,V,w,me)}}return E.getElementBindings(t.element)});function v(V){return V.split(".").flatMap(w=>{const P=w.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!P)return[w];const ae=P[1],me=[...P[2].matchAll(/\[(\d+)\]/g)].map(ye=>Number(ye[1]));return[ae,...me]})}function p(V){return t.element?v(V).reduce((ae,me)=>ae==null?"":ae[me],t.element)??"":""}function B(V,w){if(!t.element)return;const P=v(V),ae=P.pop(),me=P.reduce((ye,we)=>((ye[we]===void 0||ye[we]===null)&&(ye[we]={}),ye[we]),t.element);me[ae]=w||void 0,t.recordHistory?.()}function _(V){l.value=V}function ne(V){t.element&&B("options.src",V)}const G=e.computed(()=>t.templateData?.paperSize||"A4"),J=e.computed(()=>!t.multiPage&&E.isContinuousPaperSize(G.value)),b=e.computed(()=>E.isLabelPaperSize(G.value)),W=e.computed(()=>t.templateData?.orientation||"portrait"),j=e.computed(()=>!!t.templateData?.tiling?.enabled),U=e.computed(()=>t.templateData?.outputRotation??0),y=e.computed({get:()=>t.templateData?.pageBackground||"#ffffff",set:V=>K(V)}),M=e.computed(()=>t.templateData?.margins.top??10),N=e.computed(()=>t.templateData?.margins.bottom??10),O=e.computed(()=>t.templateData?.margins.left??10),A=e.computed(()=>t.templateData?.margins.right??10),k=e.computed(()=>t.templateData?.header.height??10),z=e.computed(()=>t.templateData?.footer.height??10),u=e.computed(()=>t.templateData?.customWidth??E.PAPER_PRESETS[G.value]?.width??210),x=e.computed(()=>t.templateData?.customHeight??297),Y=e.computed(()=>t.templateData?.designBackground);function be(V){if(t.templateData){if(!V){const w={...t.templateData};delete w.designBackground,s("update:templateData",w);return}se({designBackground:V})}}const ge=e.computed(()=>t.templateData?.watermark??{});function fe(V){se({watermark:V})}function se(V){if(!t.templateData)return;const w={...t.templateData,...V};s("update:templateData",w)}function q(V){if(t.templateData){if(E.isContinuousPaperSize(V)){se({paperSize:V,customWidth:V==="CONTINUOUS"?t.templateData?.customWidth??80:void 0,orientation:"portrait",margins:{...t.templateData.margins,bottom:t.templateData?.margins.bottom??0}});return}if(V==="CUSTOM"){se({paperSize:"CUSTOM"});return}if(E.PAPER_PRESETS[V]){if(E.isLabelPaperSize(V)){se({paperSize:V,...E.labelPaperDefaults(t.templateData)});return}se({paperSize:V})}}}function S(V){se({orientation:String(V)})}function D(V){se({outputRotation:Number(V)})}function K(V){const w=V&&V.toLowerCase()!=="#ffffff"&&V.toLowerCase()!=="#fff"?V:void 0;se(w===void 0?{pageBackground:void 0}:{pageBackground:w})}function Z(){se({pageBackground:void 0})}function te(V){V!==void 0&&se({customWidth:V})}function pe(V){V!==void 0&&se({customHeight:V})}function T(V){V!==void 0&&se({margins:{...t.templateData.margins,top:V}})}function $(V){V!==void 0&&se({margins:{...t.templateData.margins,bottom:V}})}function I(V){V!==void 0&&se({margins:{...t.templateData.margins,left:V}})}function ee(V){V!==void 0&&se({margins:{...t.templateData.margins,right:V}})}function oe(V){V!==void 0&&se({header:{...t.templateData.header,height:V}})}function ue(V){V!==void 0&&se({footer:{...t.templateData.footer,height:V}})}const L=e.computed(()=>t.activeTab||"page");function F(V){s("update:activeTab",V),s("toggle-collapse")}return(V,w)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-panel",{collapsed:o.collapsed}])},[o.collapsed?(e.openBlock(),e.createElementBlock("div",xc,[e.createElementVNode("button",{class:"pc-btn",title:"展开属性台",onClick:w[0]||(w[0]=P=>F(L.value))},"«"),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:L.value==="element"}]),title:"元素属性",onClick:w[1]||(w[1]=P=>F("element"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:L.value==="page"}]),title:"页面属性",onClick:w[2]||(w[2]=P=>F("page"))},"▤",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",$c,[w[18]||(w[18]=e.createElementVNode("span",{class:"prop-title"},"属性台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起属性台",onClick:w[3]||(w[3]=P=>V.$emit("toggle-collapse"))},"»")]),e.createElementVNode("div",Bc,[e.createElementVNode("div",Dc,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(o.activeTab||"page")==="element"}]),onClick:w[4]||(w[4]=P=>V.$emit("update:activeTab","element"))},"元素属性",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(o.activeTab||"page")==="page"}]),onClick:w[5]||(w[5]=P=>V.$emit("update:activeTab","page"))},"页面属性",2)]),e.withDirectives(e.createElementVNode("div",Tc,[o.element?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(Ia,{onSearch:_}),e.createElementVNode("div",Mc,[g.value.includes("position-size")&&!m.value?(e.openBlock(),e.createBlock(Ja,{key:0,element:o.element,"matched-keys":h.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("appearance")?(e.openBlock(),e.createBlock(Ni,{key:1,element:o.element,"is-text-type":a.value,"matched-keys":h.value,searching:R.value},null,8,["element","is-text-type","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("code")&&d.value?(e.openBlock(),e.createBlock(Fi,{key:2,element:o.element,"matched-keys":h.value,searching:R.value,onChange:w[6]||(w[6]=P=>o.recordHistory?.())},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("binding")?(e.openBlock(),e.createBlock($e,{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,P=>(e.openBlock(),e.createBlock(Br,{key:P.targetPath,descriptor:P,fields:o.fields,"model-value":p(P.targetPath),"onUpdate:modelValue":ae=>B(P.targetPath,ae)},null,8,["descriptor","fields","model-value","onUpdate:modelValue"]))),128)),i.value?(e.openBlock(),e.createBlock(ss,{key:0,onSuccess:ne})):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),c.value&&o.tableSelection&&o.tableSelection.elementId===o.element.id?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createVNode(vs,{element:o.element,selection:o.tableSelection},null,8,["element","selection"]),e.createVNode(Td,{element:o.element,selection:o.tableSelection,fields:o.fields},null,8,["element","selection","fields"])],64)):e.createCommentVNode("",!0),c.value&&g.value.includes("content")?(e.openBlock(),e.createBlock(Ir,{key:5,element:o.element,fields:o.fields},null,8,["element","fields"])):e.createCommentVNode("",!0),g.value.includes("border-bg")?(e.openBlock(),e.createBlock(Kr,{key:6,element:o.element,"matched-keys":h.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("pagination")&&c.value?(e.openBlock(),e.createBlock(Bt,{key:7,element:o.element,"matched-keys":h.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("pagination")&&!c.value?(e.openBlock(),e.createBlock(Bt,{key:8,element:o.element,"matched-keys":h.value,searching:R.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("advanced")?(e.openBlock(),e.createBlock(Qr,{key:9,element:o.element,"matched-keys":h.value,searching:R.value,onDeleteElement:w[7]||(w[7]=P=>V.$emit("delete-element"))},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0)])],64)):(e.openBlock(),e.createElementBlock("p",zc,"请在画布中选择一个元素"))],512),[[e.vShow,(o.activeTab||"page")==="element"]]),e.withDirectives(e.createElementVNode("div",Ac,[e.createElementVNode("form",{class:"pd-form",onSubmit:w[17]||(w[17]=e.withModifiers(()=>{},["prevent"]))},[w[39]||(w[39]=e.createElementVNode("h3",{class:"pd-divider"},"纸张设置",-1)),e.createElementVNode("div",Pc,[w[20]||(w[20]=e.createElementVNode("span",{class:"pd-label"},"纸张尺寸",-1)),e.createElementVNode("select",{value:G.value,class:"pd-select",onChange:w[8]||(w[8]=P=>q(P.target.value)),style:{width:"100%"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,P=>(e.openBlock(),e.createElementBlock("optgroup",{key:P.group,label:P.group},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P.items,ae=>(e.openBlock(),e.createElementBlock("option",{key:ae.key,value:ae.key},e.toDisplayString(ae.label),9,Uc))),128))],8,Lc))),128)),w[19]||(w[19]=e.createElementVNode("option",{value:"CUSTOM"},"自定义宽高",-1))],40,Rc)]),b.value?(e.openBlock(),e.createElementBlock("p",Ic,"标签纸默认整张给内容区:已取消页边距与页眉页脚,可在下方自行改回")):e.createCommentVNode("",!0),J.value||G.value==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",Fc,[e.createElementVNode("span",Hc,e.toDisplayString(J.value?"纸宽 (mm)":"自定义宽高 (mm)"),1),e.createElementVNode("div",Oc,[e.createVNode(re,{"model-value":u.value,min:25,max:2e3,"onUpdate:modelValue":te},null,8,["model-value"]),G.value==="CUSTOM"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[w[21]||(w[21]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(re,{"model-value":x.value,min:25,max:2e3,"onUpdate:modelValue":pe},null,8,["model-value"])],64)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),J.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Wc,[w[24]||(w[24]=e.createElementVNode("span",{class:"pd-label"},"纸张方向",-1)),e.createElementVNode("div",Gc,[e.createElementVNode("label",Kc,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:W.value==="portrait",onChange:w[9]||(w[9]=P=>S(P.target.value))},null,40,qc),w[22]||(w[22]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",Yc,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:W.value==="landscape",onChange:w[10]||(w[10]=P=>S(P.target.value))},null,40,jc),w[23]||(w[23]=e.createElementVNode("span",null,"横向",-1))])]),w[25]||(w[25]=e.createElementVNode("p",{class:"pd-hint"},"切换即交换纸张长宽(设计稿内容随之铺在该尺寸上)",-1))])),!J.value&&!j.value?(e.openBlock(),e.createElementBlock("div",Xc,[w[30]||(w[30]=e.createElementVNode("span",{class:"pd-label"},"内容旋转角度",-1)),e.createElementVNode("div",Zc,[e.createElementVNode("label",Jc,[e.createElementVNode("input",{type:"radio",value:"0",checked:U.value===0,onChange:w[11]||(w[11]=P=>D(P.target.value))},null,40,Qc),w[26]||(w[26]=e.createElementVNode("span",null,"0°",-1))]),e.createElementVNode("label",_c,[e.createElementVNode("input",{type:"radio",value:"90",checked:U.value===90,onChange:w[12]||(w[12]=P=>D(P.target.value))},null,40,eu),w[27]||(w[27]=e.createElementVNode("span",null,"90°",-1))]),e.createElementVNode("label",tu,[e.createElementVNode("input",{type:"radio",value:"180",checked:U.value===180,onChange:w[13]||(w[13]=P=>D(P.target.value))},null,40,ou),w[28]||(w[28]=e.createElementVNode("span",null,"180°",-1))]),e.createElementVNode("label",nu,[e.createElementVNode("input",{type:"radio",value:"270",checked:U.value===270,onChange:w[14]||(w[14]=P=>D(P.target.value))},null,40,lu),w[29]||(w[29]=e.createElementVNode("span",null,"270°",-1))])]),w[31]||(w[31]=e.createElementVNode("p",{class:"pd-hint"},"整页内容旋转对应角度出纸;90°/270° 时纸张长宽互换以贴合内容,内容不变形不裁切;0° 为不旋转(默认)",-1))])):e.createCommentVNode("",!0),e.createElementVNode("div",au,[w[32]||(w[32]=e.createElementVNode("span",{class:"pd-label"},"页面背景色",-1)),e.createElementVNode("div",iu,[e.createVNode(Ne,{modelValue:y.value,"onUpdate:modelValue":w[15]||(w[15]=P=>y.value=P),class:"page-bg-picker"},null,8,["modelValue"]),e.createElementVNode("button",{type:"button",class:"pd-reset",title:"恢复为默认白色",onClick:Z},"默认")])]),e.createVNode(_d,{"model-value":Y.value,"onUpdate:modelValue":be},null,8,["model-value"]),o.multiPage?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Sc,{key:4,"model-value":o.templateData?.tiling,"template-data":o.templateData,"onUpdate:modelValue":w[16]||(w[16]=P=>se({tiling:P}))},null,8,["model-value","template-data"])),w[40]||(w[40]=e.createElementVNode("h3",{class:"pd-divider"},"页边距 (mm)",-1)),J.value?(e.openBlock(),e.createElementBlock("p",ru,"底部边距即连续纸走纸留白")):e.createCommentVNode("",!0),e.createElementVNode("div",su,[e.createElementVNode("div",du,[w[33]||(w[33]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(re,{"model-value":M.value,min:0,max:50,"onUpdate:modelValue":T},null,8,["model-value"])]),e.createElementVNode("div",cu,[w[34]||(w[34]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(re,{"model-value":N.value,min:0,max:100,"onUpdate:modelValue":$},null,8,["model-value"])]),e.createElementVNode("div",uu,[w[35]||(w[35]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(re,{"model-value":O.value,min:0,max:50,"onUpdate:modelValue":I},null,8,["model-value"])]),e.createElementVNode("div",mu,[w[36]||(w[36]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(re,{"model-value":A.value,min:0,max:50,"onUpdate:modelValue":ee},null,8,["model-value"])])]),w[41]||(w[41]=e.createElementVNode("h3",{class:"pd-divider"},"页眉/页脚高度 (mm)",-1)),e.createElementVNode("div",pu,[w[37]||(w[37]=e.createElementVNode("span",{class:"pd-label"},"页眉高度",-1)),e.createVNode(re,{"model-value":k.value,min:0,max:100,step:.1,"onUpdate:modelValue":oe},null,8,["model-value"])]),e.createElementVNode("div",vu,[w[38]||(w[38]=e.createElementVNode("span",{class:"pd-label"},"页脚高度",-1)),e.createVNode(re,{"model-value":z.value,min:0,max:100,step:.1,"onUpdate:modelValue":ue},null,8,["model-value"])])],32),e.createVNode(Yd,{"model-value":ge.value,fields:o.fields,"onUpdate:modelValue":fe},null,8,["model-value","fields"])],512),[[e.vShow,(o.activeTab||"page")==="page"]])])],64))],2))}}),gu=ce(fu,[["__scopeId","data-v-d2bf0fe4"]]),hu={class:"status-bar"},bu={key:0,class:"status-item coord"},Eu={class:"status-item"},yu={class:"status-item"},ku={class:"status-item status-paper"},Vu=e.defineComponent({__name:"StatusBar",props:{coordinate:{},scale:{},elementCount:{},selectedCount:{},paper:{},dirty:{type:Boolean}},setup(o){return(r,t)=>(e.openBlock(),e.createElementBlock("div",hu,[o.coordinate?(e.openBlock(),e.createElementBlock("span",bu," x:"+e.toDisplayString(o.coordinate.x.toFixed(1))+" y:"+e.toDisplayString(o.coordinate.y.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0),e.createElementVNode("span",Eu,"缩放 "+e.toDisplayString(o.scale)+"%",1),e.createElementVNode("span",yu,"元素 "+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",ku,e.toDisplayString(o.paper),1)]))}}),Nu=ce(Vu,[["__scopeId","data-v-a91952ff"]]),wu={id:"getting-started",title:"快速入门",content:`
6
+ */"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),be=require("@worm-vue3-print/core"),b=require("@worm-vue3-print/core/designer"),re=require("lucide-vue-next"),Me=require("@worm-vue3-print/core/browser"),Lt=require("jsbarcode"),Yt=require("dompurify"),Je=Symbol("selected-ids"),Ut=Symbol("preview-ids");function Xt(t){const l=e.ref(new Set),o=e.ref(new Set),n=e.computed(()=>t.value.filter(g=>l.value.has(g.id))),i=e.computed(()=>l.value.size>0);function u(g,p=!1){if(p){const w=new Set(l.value);w.has(g)?w.delete(g):w.add(g),l.value=w}else l.value=new Set([g])}function a(){l.value=new Set}function r(g){l.value=new Set(g)}function d(g){o.value=new Set(g)}function c(){o.value=new Set}function m(){l.value=new Set(o.value),o.value=new Set}function f(){const g=n.value;if(g.length===0)return null;let p=1/0,w=1/0,C=-1/0,N=-1/0;return g.forEach(v=>{p=Math.min(p,v.options.left),w=Math.min(w,v.options.top),C=Math.max(C,v.options.left+v.options.width),N=Math.max(N,v.options.top+v.options.height)}),{left:p,top:w,width:C-p,height:N-w}}return{selectedIds:l,selectedElements:n,hasSelection:i,select:u,clearSelection:a,selectAll:r,getSelectionBounds:f,previewIds:o,setPreview:d,clearPreview:c,commitPreview:m}}function Zt(){const t=e.ref(null);function l(i){t.value=i.map(u=>({options:{...u.options},printElementType:{...u.printElementType}}))}function o(i=10){if(!t.value)return null;const u=new Map;for(const r of t.value){const d=r.options.groupId;d&&u.set(d,(u.get(d)??0)+1)}const a=new Map;for(const[r,d]of u)a.set(r,d>=2?b.generateGroupId():void 0);return t.value.map(r=>({id:b.generateId(),options:{...r.options,left:r.options.left+i,top:r.options.top+i,groupId:r.options.groupId?a.get(r.options.groupId):void 0},printElementType:{...r.printElementType}}))}function n(){return t.value!==null&&t.value.length>0}return{clipboard:t,copy:l,paste:o,hasData:n}}function Jt(t){const o=e.ref([]),n=e.ref([]),i=e.ref(!1),u=e.ref(!1);function a(){i.value=o.value.length>0,u.value=n.value.length>0}function r(p){const w={elements:JSON.parse(JSON.stringify(p?.elements??[])),templateData:JSON.parse(JSON.stringify(p?.templateData??{}))};return p?.pages&&(w.pages=JSON.parse(JSON.stringify(p.pages)),p.activePageIndex!==void 0&&(w.activePageIndex=p.activePageIndex)),w}function d(p){return r(p)}function c(p){o.value.push(d(p)),n.value=[],o.value.length>50&&o.value.shift(),a()}function m(p){if(o.value.length===0)return null;const w=o.value.pop();return n.value.push(p?d(p):r(w)),a(),o.value.length>0?r(o.value[o.value.length-1]):null}function f(p){if(n.value.length===0)return null;const w=n.value.pop();return o.value.push(p?d(p):r(w)),a(),r(w)}function g(){o.value=[],n.value=[],a()}return{push:c,undo:m,redo:f,canUndo:i,canRedo:u,clear:g}}const pt="开启拼版后只能有一个设计页面";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:[]},elements:[],watermark:{}}}function Ze(t){const l=(o,n)=>(o??[]).map(i=>{const u={...i.options};return(i.printElementType?.type??i.type)==="table"&&b.syncTableElementSize(u),{id:i.id||b.generateId(),zone:n,options:u,printElementType:{...i.printElementType}}});return{...t,margins:{...t.margins},header:{height:t.header?.height??10,elements:[]},footer:{height:t.footer?.height??10,elements:[]},guides:[...t.guides??[]],elements:[...l(t.elements??[],"content"),...l(t.header?.elements??[],"header"),...l(t.footer?.elements??[],"footer")]}}function wt(t){const l=(n,i)=>{const u=Ze(b.normalizeTemplateUnits(n));return u.name||(u.name=`页面 ${i+1}`),u};if(!t)return[l(Re(),0)];const o=Array.isArray(t.pages)?t.pages:[t];return o.length?o.map(l):[l(Re(),0)]}function Ct(t){const l=t.elements,o=n=>l.filter(i=>(i.zone||"content")===n).map(i=>({id:i.id,type:i.printElementType.type,options:{...i.options},printElementType:{...i.printElementType}}));return{unit:"mm",...t,header:{...t.header,elements:o("header")},footer:{...t.footer,elements:o("footer")},elements:o("content"),guides:[...t.guides??[]]}}function Qt(t={}){const l=e.ref(100),o=e.ref(!0),n=e.ref(!0),i=e.ref(!1),u=e.ref(!0),a=e.ref(wt(t.initialTemplate)),r=e.ref(0),d=e.ref(a.value[0]??Ze(Re())),c=e.computed(()=>a.value.some(F=>F.tiling?.enabled===!0));function m(){return c.value?(alert(pt),!0):!1}function f(){a.value[r.value]=d.value}function g(F){F<0||F>=a.value.length||(f(),r.value=F,d.value=a.value[F],ge())}const p=e.computed({get:()=>d.value.elements,set:F=>{d.value.elements=F}}),w=e.ref(t.initialFields||[]),{selectedIds:C,selectedElements:N,select:v,clearSelection:$,selectAll:W,previewIds:te,setPreview:J,clearPreview:L,commitPreview:E}=Xt(p),{group:O,ungroup:Y,getGroupedIds:z}=b.useGroup(),{copy:h,paste:A,hasData:k}=Zt(),{align:H}=b.useAlign(),{push:G,undo:q,redo:_,canUndo:B,canRedo:s}=Jt(),x=e.computed(()=>{if(C.value.size===0)return null;const F=C.value.values().next().value;return p.value.find(ae=>ae.id===F)||null}),ee=e.ref(null);function he(F){ee.value=F}function ge(){$(),he(null)}function se(){return{elements:p.value.map(F=>({id:F.id,zone:F.zone,options:JSON.parse(JSON.stringify(F.options)),printElementType:{...F.printElementType}})),templateData:{paperSize:d.value.paperSize,orientation:d.value.orientation,outputRotation:d.value.outputRotation,margins:{...d.value.margins},header:{height:d.value.header.height,elements:[]},footer:{height:d.value.footer.height,elements:[]},elements:[],customWidth:d.value.customWidth,customHeight:d.value.customHeight,watermark:d.value.watermark?{...d.value.watermark}:void 0,guides:[...d.value.guides??[]]},pages:JSON.parse(JSON.stringify(a.value)),activePageIndex:r.value}}function K(){G(se())}function S(F){return F.pages?.[F.activePageIndex??0]?.elements??F.elements}function T(){const F=q(se());F?.pages?(a.value=F.pages,r.value=F.activePageIndex??0,d.value=a.value[r.value]??a.value[0],ge()):F?.templateData&&(d.value={...F.templateData,elements:F.elements})}function j(){const F=_(se());F?.pages?(a.value=F.pages,r.value=F.activePageIndex??0,d.value=a.value[r.value]??a.value[0],ge()):F?.templateData&&(d.value={...F.templateData,elements:F.elements})}function Z(){h(N.value)}function ne(){h(N.value),pe()}function ve(){const F=A();F&&F.length>0&&(p.value.push(...F),K())}function M(){h(N.value);const F=A();F&&F.length>0&&(F.forEach(ae=>{ae.options.left+=5,ae.options.top+=5}),p.value.push(...F),v(F[0].id,!1),K())}function D(){l.value=100}const U=e.computed(()=>k());let oe=!1,le=null;const me=300;function R(F,ae){const ce=N.value.filter(ke=>!ke.options.locked);ce.length!==0&&(ce.forEach(ke=>{ke.options.left+=F,ke.options.top+=ae}),oe||(oe=!0,K()),le&&clearTimeout(le),le=setTimeout(()=>{oe=!1,le=null},me))}function I(){W(p.value.map(F=>F.id))}function y(F){H(N.value,F),K()}function V(F,ae=!1){if(ae){v(F,!0);return}C.value=new Set(z(p.value,F))}function P(){p.value=O(p.value,C.value),K()}function ie(){p.value=Y(p.value,C.value),K()}function pe(){C.value.size!==0&&(p.value=p.value.filter(F=>!C.value.has(F.id)),$(),K())}const{setup:ye,cleanup:we}=b.useKeyboard({onMove:R,onDelete:pe,onCopy:Z,onPaste:ve,onSelectAll:I,onUndo:T,onRedo:j,onDuplicate:M,onResetZoom:D,onAlignLeft:()=>y("left"),onAlignRight:()=>y("right"),onAlignCenterH:()=>y("vertical"),onAlignTop:()=>y("top"),onAlignBottom:()=>y("bottom"),onGroup:P,onUngroup:ie});let xe=null;function Le(){xe=se()}function _e(){if(!xe)return;const F=new Map(xe.elements.map(Ee=>[Ee.id,Ee]));let ae=!1;for(const Ee of p.value){const $e=F.get(Ee.id);if(!$e)continue;($e.options.left!==Ee.options.left||$e.options.top!==Ee.options.top||$e.options.width!==Ee.options.width||$e.options.height!==Ee.options.height)&&b.finalizeElementZone(Ee,d.value).rejected&&(ae=!0)}ae&&alert("该元素类型不能放入页眉/页脚");const ce=Ee=>`${Ee.id}:${Ee.zone||"content"}:${Ee.options.left},${Ee.options.top},${Ee.options.width},${Ee.options.height}`,ke=S(xe).map(ce).join("|"),Se=S(se()).map(ce).join("|");xe=null,ke!==Se&&K()}function We(F,ae){const ce=b.zoneFromPaperPoint(d.value,ae.x,ae.y);if(ce!=="content"&&!b.ZONE_ALLOWED_TYPES.includes(F.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const ke=b.getZoneRects(d.value)[ce];return F.zone=ce,F.options.left=ae.x-ke.left,F.options.top=ae.y-ke.top,ce!=="content"&&b.clampToZone(F,ke),!0}function et(F,ae){const ce=b.createRuntimeElement(F);ae&&!We(ce,ae)||(p.value.push(ce),v(ce.id,!1),K())}function tt(F,ae){const ce=b.createFieldElement(F);ae&&!We(ce,ae)||(p.value.push(ce),v(ce.id,!1),K())}function ot(F){if(C.value.size===0)return;const ae=C.value.values().next().value,ce=p.value.find(Ae=>Ae.id===ae);if(!ce)return;const ke=ce.options.zIndex??0,Se=p.value.map(Ae=>Ae.options.zIndex??0),Ee=Math.max(...Se,0),$e=Math.min(...Se,0);switch(F){case"top":ce.options.zIndex=Ee+1;break;case"bottom":ce.options.zIndex=$e-1;break;case"up":ce.options.zIndex=ke+1;break;case"down":ce.options.zIndex=ke-1;break}K()}function nt(F,ae){const{width:ce,height:ke}=b.getPaperDimensions(d.value),Se=96/25.4;l.value=b.computeFitScale(F,ae,ce*Se,ke*Se)}function lt(F){if(d.value={...F},a.value[r.value]=d.value,a.value.length>1){const ae={paperSize:F.paperSize,orientation:F.orientation,outputRotation:F.outputRotation,customWidth:F.customWidth,customHeight:F.customHeight};for(const ce of a.value)Object.assign(ce,ae)}K()}function Ge(){return f(),a.value.length<=1?Ct(a.value[0]):{version:1,pages:a.value.map(Ct)}}function ze(F,ae){a.value=wt(F),r.value=0,d.value=a.value[0],ae&&(d.value={...d.value,elements:ae.map(ce=>({...ce,id:ce.id||b.generateId(),zone:ce.zone||"content",options:{...ce.options},printElementType:{...ce.printElementType}}))},a.value[r.value]=d.value),G(se())}function qe(){const F=new Set(a.value.map(ce=>ce.name));let ae=a.value.length+1;for(;F.has(`页面 ${ae}`);)ae++;return`页面 ${ae}`}function at(){if(m())return;f();const F=a.value[r.value]??Re(),ae=Ze({...Re(),paperSize:F.paperSize,orientation:F.orientation,customWidth:F.customWidth,customHeight:F.customHeight,name:qe()});a.value.push(ae),r.value=a.value.length-1,d.value=ae,ge(),K()}function it(){if(m())return;f();const F=a.value[r.value],ae=JSON.parse(JSON.stringify(F));ae.name=`${F.name??`页面 ${r.value+1}`} 副本`,ae.elements=ae.elements.map(ce=>({...ce,id:b.generateId()})),a.value.splice(r.value+1,0,ae),g(r.value+1),K()}function Ke(F){a.value.length<=1||(f(),a.value.splice(F,1),F<r.value?r.value--:F===r.value&&r.value>=a.value.length&&(r.value=a.value.length-1),d.value=a.value[r.value],ge(),K())}function rt(F,ae){a.value[F]&&(a.value[F].name=ae)}function st(F,ae){if(F===ae)return;f();const[ce]=a.value.splice(F,1);a.value.splice(ae,0,ce),r.value=ae,d.value=ce,ge(),K()}return G(se()),e.onMounted(()=>ye()),e.onUnmounted(()=>{we(),le&&(clearTimeout(le),le=null)}),{scale:l,showRuler:o,showGrid:n,snapToGrid:i,showTableGhostBorder:u,templateData:d,elements:p,fields:w,tilingEnabled:c,pages:a,activePageIndex:r,switchPage:g,addPage:at,duplicatePage:it,deletePage:Ke,renamePage:rt,movePage:st,selectedIds:C,selectedElements:N,selectedElement:x,select:v,selectElement:V,clearSelection:$,selectAll:I,previewIds:te,setPreview:J,clearPreview:L,commitPreview:E,hasClipboard:U,copy:Z,paste:ve,cutSelected:ne,tableSelection:ee,setTableSelection:he,canUndo:B,canRedo:s,undo:T,redo:j,recordHistory:K,alignSelected:y,groupSelected:P,ungroupSelected:ie,deleteSelected:pe,duplicateSelected:M,resetZoom:D,dragStart:Le,dragStop:_e,addElement:et,addFieldElement:tt,moveLayer:ot,fitToWindow:nt,updateTemplateData:lt,getTemplateJson:Ge,loadTemplate:ze}}const Ce=Symbol("mixed"),vt=new Set(["text","longText"]);function _t(t){const{elements:l,selectedIds:o,tableSelection:n,recordHistory:i}=t,u=e.computed(()=>l.value.filter(k=>o.value.has(k.id)&&!k.options.locked)),a=e.computed(()=>{const k=n.value;return k?l.value.find(H=>H.id===k.elementId)??null:null}),r=e.computed(()=>n.value&&a.value?"cells":u.value.length>0||o.value.size>0?"elements":"none"),d=e.computed(()=>{const k=n.value,H=a.value?.options.tableRows;if(!k||!H)return[];const G=[];for(let q=k.r1;q<=k.r2;q++)for(let _=k.c1;_<=k.c2;_++){const B=H[q]?.cells[_];B&&!B.merged&&G.push(B)}return G}),c=e.computed(()=>u.value.filter(k=>vt.has(k.printElementType.type))),m=e.computed(()=>r.value==="cells"?d.value.length>0:r.value!=="elements"?!1:u.value.length>0&&c.value.length===u.value.length),f=e.computed(()=>r.value==="cells"?d.value:c.value.map(k=>k.options));function g(k){if(!k.length)return;const H=k[0];return k.every(G=>G===H)?H:Ce}const p=(k,H)=>(k??"").split(/\s+/).includes(H),w=e.computed(()=>{const k=f.value;if(!k.length)return{fontFamily:void 0,fontSize:void 0,color:void 0,backgroundColor:void 0,textAlign:void 0,verticalAlign:void 0,bold:!1,underline:!1,strike:!1};const H=k.map(q=>q.fontWeight==="bold"||q.fontWeight==="bolder"),G=k.map(q=>q.textDecoration);return{fontFamily:g(k.map(q=>q.fontFamily)),fontSize:g(k.map(q=>q.fontSize)),color:g(k.map(q=>q.color)),backgroundColor:g(k.map(q=>q.backgroundColor)),textAlign:g(k.map(q=>r.value==="cells"?q.align:q.textAlign)),verticalAlign:g(k.map(q=>r.value==="cells"?q.valign:q.verticalAlign)),bold:H.every(Boolean)?!0:H.some(Boolean)?Ce:!1,underline:G.map(q=>p(q,"underline")).every(Boolean)?!0:G.some(q=>p(q,"underline"))?Ce:!1,strike:G.map(q=>p(q,"line-through")).every(Boolean)?!0:G.some(q=>p(q,"line-through"))?Ce:!1}});function C(k){const H=d.value;H.length&&(H.forEach(k),i())}function N(k){if(r.value==="cells"){C(s=>{"fontFamily"in k&&(s.fontFamily=k.fontFamily),"fontSize"in k&&(s.fontSize=k.fontSize),"color"in k&&(s.color=k.color),"backgroundColor"in k&&(s.backgroundColor=k.backgroundColor),"textAlign"in k&&(s.align=k.textAlign),"verticalAlign"in k&&(s.valign=k.verticalAlign)});return}const H=c.value,G=u.value,_=["fontFamily","fontSize","color","textAlign","verticalAlign"].some(s=>s in k),B="backgroundColor"in k;!(H.length&&_)&&!(G.length&&B)||(H.forEach(s=>{const x=s.options;"fontFamily"in k&&(x.fontFamily=k.fontFamily),"fontSize"in k&&(x.fontSize=k.fontSize),"color"in k&&(x.color=k.color),"textAlign"in k&&(x.textAlign=k.textAlign),"verticalAlign"in k&&(x.verticalAlign=k.verticalAlign)}),B&&G.forEach(s=>{s.options.backgroundColor=k.backgroundColor}),i())}function v(){if(r.value==="cells"){const G=w.value.bold!==!0;C(q=>{q.fontWeight=G?"bold":void 0});return}const k=w.value.bold!==!0,H=c.value;H.length&&(H.forEach(G=>{G.options.fontWeight=k?"bold":"normal"}),i())}function $(k){if(r.value==="cells")return;const H=c.value;if(!H.length)return;const G=w.value[k==="underline"?"underline":"strike"]!==!0;H.forEach(q=>{const _=(q.options.textDecoration??"").split(/\s+/).filter(Boolean),B=_.indexOf(k);G&&B<0&&_.push(k),!G&&B>=0&&_.splice(B,1),q.options.textDecoration=_.length?_.join(" "):void 0}),i()}const W=()=>$("underline"),te=()=>$("line-through");function J(k,H){const G=u.value;G.length&&(G.forEach(q=>{q.options.borders=void 0,k==="none"?q.options.borderWidth=0:(q.options.borderWidth=H.width,q.options.borderStyle=H.style,q.options.borderColor=H.color)}),i())}function L(k,H){const G=n.value,q=a.value?.options.tableRows;!G||!q||(b.applyBorderPreset(q,{r1:G.r1,c1:G.c1,r2:G.r2,c2:G.c2},k,H),i())}function E(k,H,G){C(q=>{const _={...q.borders??{}};for(const B of k)G?_[B]={...H}:delete _[B];q.borders=_})}const O=["top","right","bottom","left"],Y=e.computed(()=>{if(r.value!=="cells")return null;const k=d.value;if(!k.length)return null;const H={};for(const G of O){const q=k.map(_=>!!_.borders?.[G]);H[G]=q.every(Boolean)?!0:q.some(Boolean)?Ce:!1}return H});function z(k,H){const G=Y.value?.[k]!==!0;E([k],H,G)}const h=e.computed(()=>{if(r.value!=="elements")return null;const k=u.value;if(!k.length)return null;const H={};for(const G of O){const q=k.map(_=>!!_.options.borders?.[G]);H[G]=q.every(Boolean)?!0:q.some(Boolean)?Ce:!1}return H});function A(k,H){const G=u.value;if(!G.length)return;const q=h.value?.[k]!==!0;G.forEach(_=>{const B={..._.options.borders??{}};q?B[k]={width:H.width,style:H.style,color:H.color}:delete B[k],_.options.borders=B}),i()}return{context:r,fontEditable:m,values:w,applyStyle:N,toggleBold:v,toggleUnderline:W,toggleStrike:te,applyElementBorder:J,applyCellBorderPreset:L,applyCellBorderEdges:E,cellEdges:Y,toggleCellEdge:z,elementEdges:h,toggleElementEdge:A}}const eo=["fontFamily","fontSize","fontWeight","color","textAlign","verticalAlign","textDecoration"];function to(t){const{elements:l,selectedIds:o,recordHistory:n}=t,i=e.ref(!1),u=e.ref(!1),a=e.ref(null);let r=null;const d=e.computed(()=>l.value.filter(C=>o.value.has(C.id)&&!C.options.locked)),c=e.computed(()=>d.value.length===1);function m(C){if(!C)return;const N={};for(const v of b.ELEMENT_BORDER_SIDES){const $=C[v];$&&(N[v]={...$})}return N}function f(C=!1){const N=d.value[0];if(!N)return!1;const v=N.options,$=N.printElementType.type;return r={text:vt.has($)?Object.fromEntries(eo.map(W=>[W,v[W]])):null,backgroundColor:v.backgroundColor,border:b.acceptsElementBorder($)?{borderWidth:v.borderWidth,borderStyle:v.borderStyle,borderColor:v.borderColor,borders:m(v.borders)}:null},a.value=N.id,i.value=!0,u.value=C,!0}function g(){i.value=!1,u.value=!1,a.value=null,r=null}function p(C){const N=r;if(!N||C.options.locked||C.id===a.value)return!1;const v=C.options,$=C.printElementType.type;return N.text&&vt.has($)&&Object.assign(v,N.text),v.backgroundColor=N.backgroundColor,N.border&&b.acceptsElementBorder($)&&(v.borderWidth=N.border.borderWidth,v.borderStyle=N.border.borderStyle,v.borderColor=N.border.borderColor,v.borders=m(N.border.borders)),!0}e.watch(o,()=>{if(!i.value||!r)return;const C=d.value;if(!C.length){g();return}let N=!1;C.forEach(v=>{N=p(v)||N}),N&&(n(),u.value||g())});function w(C){if(C.key!=="Escape"||!i.value)return;const N=C.target?.tagName;N==="INPUT"||N==="TEXTAREA"||N==="SELECT"||g()}return document.addEventListener("keydown",w),e.onScopeDispose(()=>document.removeEventListener("keydown",w)),{active:i,locked:u,sourceId:a,capturable:c,capture:f,cancel:g}}let St=0;function oo(){return St+=1,`guide-${St}`}function no(t,l){const o=e.computed(()=>t.value.guides??[]);function n(d){t.value={...t.value,guides:d([...t.value.guides??[]])},l()}function i(d,c){n(m=>(m.push({type:d,position:c,id:oo()}),m))}function u(d,c){n(m=>m.map(f=>f.id===d?{...f,position:c}:f))}function a(d){n(c=>c.filter(m=>m.id!==d))}function r(){const d=[],c=[];for(const m of o.value)m.type==="vertical"?d.push(m.position):c.push(m.position);return{vertical:d,horizontal:c}}return{guides:o,addGuide:i,moveGuide:u,removeGuide:a,getGuidePositions:r}}const He=Symbol("table-edit"),ft=Symbol("print-upload-image"),gt=Symbol("print-upload-design-background"),ht=Symbol("print-font-catalog"),lo=e.computed(()=>[]);function ao(t){return{catalog:e.computed(()=>{const o=[],n=new Set;for(const i of e.toValue(t)??[]){const u=i?.family?.trim();if(!u)continue;const a=u.toLowerCase();if(n.has(a))continue;n.add(a);const r=i.label?.trim();o.push(r?{family:u,label:r}:{family:u})}return o})}}function io(){return e.inject(ht,lo)}function xt(t,l){const o=l?.trim().toLowerCase();if(o)return t.find(n=>n.family.trim().toLowerCase()===o)}function Bt(t){return t.label?`${t.label}(${t.family})`:t.family}function Fe(t){return t.toLowerCase().replace(/\s+/g,"")}function $t(t,l){if(t===l)return 0;if(t.startsWith(l))return 1;if(t.includes(l))return 2;let o=0;for(const n of t)if(n===l[o]&&o++,o===l.length)return 3;return-1}function ro(t,l){const o=Fe(l.trim());return o?t.map((n,i)=>({font:n,index:i,rank:so(n,o)})).filter(n=>n.rank>=0).sort((n,i)=>n.rank-i.rank||n.index-i.index).map(n=>n.font):[...t]}function so(t,l){const o=$t(Fe(t.family),l);if(!t.label)return o;const n=$t(Fe(t.label),l);return o<0?n:n<0?o:Math.min(o,n)}const co="print-designer-font-face";function uo(t){const l=`${co}-${e.useId()}`;let o;e.watchEffect(()=>{const n=e.toValue(t);if(!n){o?.remove(),o=void 0;return}o||(o=document.createElement("style"),o.id=l,document.head.appendChild(o)),o.textContent=n}),e.onUnmounted(()=>{o?.remove(),o=void 0})}const mo=e.defineComponent({__name:"HelpButton",emits:["click"],setup(t){return(l,o)=>(e.openBlock(),e.createElementBlock("button",{class:"help-button",title:"帮助文档",onClick:o[0]||(o[0]=n=>l.$emit("click"))},[...o[1]||(o[1]=[e.createElementVNode("span",{class:"help-icon"},"?",-1)])]))}}),ue=(t,l)=>{const o=t.__vccOpts||t;for(const[n,i]of l)o[n]=i;return o},po=ue(mo,[["__scopeId","data-v-80ccab03"]]),vo=["disabled","data-test","data-tip"],fo=e.defineComponent({__name:"ToolbarDropdown",props:{disabled:{type:Boolean,default:!1},testId:{default:"dd-trigger"},tip:{},panelClass:{},keepMounted:{type:Boolean,default:!1}},setup(t){const l=t,o=e.ref(!1),n=e.ref(null);function i(u){o.value&&(n.value?.contains(u.target)||(o.value=!1))}return e.watch(()=>l.disabled,u=>{u&&(o.value=!1)}),e.onMounted(()=>document.addEventListener("pointerdown",i)),e.onUnmounted(()=>document.removeEventListener("pointerdown",i)),(u,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapRef",ref:n,class:"tb-dd"},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["tb-dd-trigger",{on:o.value}]),disabled:t.disabled,"data-test":t.testId,"data-tip":t.tip,onClick:a[0]||(a[0]=r=>o.value=!o.value)},[e.renderSlot(u.$slots,"trigger",{},void 0,!0),e.createVNode(e.unref(re.ChevronDown),{size:12,class:e.normalizeClass(["tb-dd-arrow",{up:o.value}])},null,8,["class"])],10,vo),t.keepMounted||o.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["tb-dd-panel",[t.panelClass,{"is-hidden":t.keepMounted&&!o.value}]])},[e.renderSlot(u.$slots,"default",{},void 0,!0)],2)):e.createCommentVNode("",!0)],512))}}),Oe=ue(fo,[["__scopeId","data-v-e5f0ee73"]]);function go(t){return`tb-more-slot-${t}`}const bt=Symbol("worm-print-toolbar-overflow"),ct=2,ho=74;function bo(){const t=e.shallowRef(null),l=new Map,o=e.reactive(new Map),n=new Map;let i=0;const u=e.ref(new Set),a=e.ref(!1),r=e.computed(()=>[...o.values()].sort((W,te)=>W.order-te.order)),d=e.computed(()=>u.value.size>0);function c(){for(const[W,te]of l){const J=te.offsetWidth;J>0&&n.set(W,J)}}function m(W){const te=getComputedStyle(W),J=Number.parseFloat(te.gap)||ct,L=Number.parseFloat(te.paddingLeft)||0,E=Number.parseFloat(te.paddingRight)||0;let O=0;for(const Y of Array.from(W.children)){if(Y.hasAttribute("data-overflow-more")||Y.hasAttribute("data-overflow-spacer"))continue;const z=Math.max(Y.offsetWidth,Y.scrollWidth);z<=0||(O+=z+J)}return{available:W.clientWidth-L-E,natural:O}}function f(){const W=t.value;if(!W)return;const{available:te,natural:J}=m(W),L=u.value.size>0;L||(i=J,c());const E=r.value.map(h=>({id:h.id,order:h.order,width:n.get(h.id)??0})),O=E.reduce((h,A)=>h-A.width-ct,i),Y=b.resolveToolbarOverflow({available:te,pinned:O,moreTriggerWidth:ho,gap:ct,units:E});Y.movedIds.length===u.value.size&&Y.movedIds.every(h=>u.value.has(h))||(u.value=new Set(Y.movedIds)),a.value=Y.overflowRemains,L&&u.value.size===0&&e.nextTick(f)}let g=null;function p(W){W!==t.value&&(g?.disconnect(),t.value=W,W&&typeof ResizeObserver<"u"&&(g=new ResizeObserver(()=>f()),g.observe(W)),e.nextTick(f))}function w(W,te){o.set(W.id,W),l.set(W.id,te),e.nextTick(f)}function C(W){l.delete(W),o.delete(W),n.delete(W),e.nextTick(f)}const N=document.createElement("div");function v(W){return u.value.has(W)}function $(W){return u.value,t.value?.querySelector(`[data-overflow-slot="${W}"]`)??N}return e.onUnmounted(()=>g?.disconnect()),{attachRoot:p,registerUnit:w,unregisterUnit:C,refresh:f,movedIds:u,overflowRemains:a,hasMoved:d,chain:r,moved:v,slotEl:$}}function It(){const t=bo();return e.provide(bt,t),t}function Et(){return e.inject(bt,null)}function Ft(){const t=e.ref(new Set),l=document.createElement("div");return{attachRoot:()=>{},registerUnit:()=>{},unregisterUnit:()=>{},refresh:()=>{},movedIds:t,overflowRemains:e.ref(!1),hasMoved:e.computed(()=>!1),chain:e.computed(()=>[]),moved:()=>!1,slotEl:()=>l}}function yt(t){return{mounted(l,o){l.dataset.unit=o.value.id,t.registerUnit(o.value,l)},unmounted(l,o){t.unregisterUnit(o.value.id)}}}const Eo={key:0,class:"tb-group tb-more-group","data-overflow-more":""},yo={class:"tb-menu tb-more-menu"},ko=["data-unit"],Vo={class:"tb-menu-label"},No=["id","data-overflow-slot","data-unit"],wo=e.defineComponent({__name:"ToolbarMore",setup(t){const l=Et(),o=e.computed(()=>!!l&&l.hasMoved.value),n=e.computed(()=>l?.chain.value??[]),i=e.computed(()=>l?.movedIds.value??new Set);return(u,a)=>e.unref(l)?e.withDirectives((e.openBlock(),e.createElementBlock("div",Eo,[e.createVNode(Oe,{"test-id":"more-dd",tip:"更多","keep-mounted":"","panel-class":"tb-more-panel"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(re.Ellipsis),{size:15}),a[0]||(a[0]=e.createElementVNode("span",{class:"tb-btn-text"},"更多",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",yo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,r=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:r.id,class:"tb-more-item","data-unit":r.id},[e.createElementVNode("div",Vo,e.toDisplayString(r.label),1),e.createElementVNode("div",{id:e.unref(go)(r.id),class:"tb-more-slot","data-overflow-slot":r.id,"data-unit":r.id},null,8,No)],8,ko)),[[e.vShow,i.value.has(r.id)]])),128))])]),_:1})],512)),[[e.vShow,o.value]]):e.createCommentVNode("",!0)}}),Co=ue(wo,[["__scopeId","data-v-5d13dbea"]]),So={class:"tb-group tb-brand"},xo={class:"tb-title"},Bo={class:"tb-title-name"},$o={class:"tb-group"},Do=["disabled"],To=["disabled"],Mo={class:"tb-ou tb-group"},zo={class:"tb-menu","data-test":"arrange-panel"},Ao={class:"tb-menu-grid"},Po=["disabled"],Ro=["disabled"],Lo=["disabled"],Uo=["disabled"],Io=["disabled"],Fo=["disabled"],Oo=["disabled"],Ho=["disabled"],Wo={class:"tb-menu-grid"},Go=["disabled"],qo=["disabled"],Ko=["disabled"],jo=["disabled"],Yo={class:"tb-menu-grid"},Xo=["disabled"],Zo=["disabled"],Jo={class:"tb-menu tb-menu-rows","data-test":"view-panel"},Qo={class:"tb-ou tb-group"},_o={class:"tb-zoom"},en={class:"tb-ou tb-group"},tn=["disabled","data-tip"],on=["disabled","data-tip"],nn=["disabled","data-tip"],ln={key:0,class:"tb-group"},an={class:"tb-group"},rn=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},showHelp:{type:Boolean,default:!0},clipboardDisabled:{type:Boolean,default:!0},hasClipboard:{type:Boolean,default:!1}},{scale:{default:100},scaleModifiers:{}}),emits:e.mergeModels(["preview","save","undo","redo","align","move-layer","toggle-ruler","toggle-grid","toggle-snap","toggle-table-ghost-border","group","ungroup","fit-window","zoom","help","copy","paste","delete"],["update:scale"]),setup(t){const l=It(),o=yt(l),n=e.ref(null);e.onMounted(()=>l.attachRoot(n.value));const i=e.useModel(t,"scale"),u=t,a=e.computed(()=>u.clipboardDisabled?"粘贴 (Ctrl+V),需选中元素":u.hasClipboard?"粘贴 (Ctrl+V)":"粘贴 (Ctrl+V),剪贴板为空");return(r,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:n,class:e.normalizeClass(["designer-toolbar",{"is-tight":e.unref(l).overflowRemains.value}])},[e.createElementVNode("div",So,[d[30]||(d[30]=e.createStaticVNode('<span class="tb-mark" aria-hidden="true" data-v-b50decc4><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-b50decc4><rect x="5" y="3" width="14" height="18" rx="2.5" data-v-b50decc4></rect><line x1="8.5" y1="8.5" x2="15.5" y2="8.5" data-v-b50decc4></line><line x1="8.5" y1="12.5" x2="15.5" y2="12.5" data-v-b50decc4></line><line x1="8.5" y1="16.5" x2="12.5" y2="16.5" data-v-b50decc4></line></svg></span>',1)),e.createElementVNode("div",xo,[e.createElementVNode("span",Bo,e.toDisplayString(t.isEdit?"编辑模板":"新建模板"),1),d[29]||(d[29]=e.createElementVNode("span",{class:"tb-title-sub"},"打印模板设计器",-1))])]),e.createElementVNode("div",$o,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.canUndo,onClick:d[0]||(d[0]=c=>r.$emit("undo")),"data-tip":"撤销"},[e.createVNode(e.unref(re.Undo2),{size:15})],8,Do),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.canRedo,onClick:d[1]||(d[1]=c=>r.$emit("redo")),"data-tip":"重做"},[e.createVNode(e.unref(re.Redo2),{size:15})],8,To)]),e.renderSlot(r.$slots,"default",{},void 0,!0),(e.openBlock(),e.createBlock(e.Teleport,{to:e.unref(l).slotEl("arrange-view"),disabled:!e.unref(l).moved("arrange-view")},[e.withDirectives((e.openBlock(),e.createElementBlock("div",Mo,[e.createVNode(Oe,{"test-id":"arrange-dd",tip:"排列"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(re.Layers),{size:15}),d[31]||(d[31]=e.createElementVNode("span",{class:"tb-btn-text"},"排列",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",zo,[d[32]||(d[32]=e.createElementVNode("div",{class:"tb-menu-label"},"对齐 / 分布",-1)),e.createElementVNode("div",Ao,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:d[2]||(d[2]=c=>r.$emit("align","left")),"data-tip":"左对齐"},[e.createVNode(e.unref(re.AlignStartVertical),{size:15})],8,Po),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:d[3]||(d[3]=c=>r.$emit("align","right")),"data-tip":"右对齐"},[e.createVNode(e.unref(re.AlignEndVertical),{size:15})],8,Ro),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:d[4]||(d[4]=c=>r.$emit("align","top")),"data-tip":"顶对齐"},[e.createVNode(e.unref(re.AlignStartHorizontal),{size:15})],8,Lo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:d[5]||(d[5]=c=>r.$emit("align","bottom")),"data-tip":"底对齐"},[e.createVNode(e.unref(re.AlignEndHorizontal),{size:15})],8,Uo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:d[6]||(d[6]=c=>r.$emit("align","vertical")),"data-tip":"水平居中"},[e.createVNode(e.unref(re.AlignCenterVertical),{size:15})],8,Io),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:d[7]||(d[7]=c=>r.$emit("align","horizontal")),"data-tip":"垂直居中"},[e.createVNode(e.unref(re.AlignCenterHorizontal),{size:15})],8,Fo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:d[8]||(d[8]=c=>r.$emit("align","distributeHor")),"data-tip":"水平分布"},[e.createVNode(e.unref(re.AlignHorizontalSpaceBetween),{size:15})],8,Oo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:d[9]||(d[9]=c=>r.$emit("align","distributeVer")),"data-tip":"垂直分布"},[e.createVNode(e.unref(re.AlignVerticalSpaceBetween),{size:15})],8,Ho)]),d[33]||(d[33]=e.createElementVNode("div",{class:"tb-menu-label"},"层级",-1)),e.createElementVNode("div",Wo,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasSelection,onClick:d[10]||(d[10]=c=>r.$emit("move-layer","top")),"data-tip":"置顶"},[e.createVNode(e.unref(re.ArrowUpToLine),{size:15})],8,Go),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasSelection,onClick:d[11]||(d[11]=c=>r.$emit("move-layer","up")),"data-tip":"上移一层"},[e.createVNode(e.unref(re.ArrowUp),{size:15})],8,qo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasSelection,onClick:d[12]||(d[12]=c=>r.$emit("move-layer","down")),"data-tip":"下移一层"},[e.createVNode(e.unref(re.ArrowDown),{size:15})],8,Ko),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasSelection,onClick:d[13]||(d[13]=c=>r.$emit("move-layer","bottom")),"data-tip":"置底"},[e.createVNode(e.unref(re.ArrowDownToLine),{size:15})],8,jo)]),d[34]||(d[34]=e.createElementVNode("div",{class:"tb-menu-label"},"组合",-1)),e.createElementVNode("div",Yo,[e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.hasMultiSelection,onClick:d[14]||(d[14]=c=>r.$emit("group")),"data-tip":"组合 (Ctrl+G)"},[e.createVNode(e.unref(re.Group),{size:15})],8,Xo),e.createElementVNode("button",{class:"tb-btn tb-icon",disabled:!t.selectedElementHasGroup,onClick:d[15]||(d[15]=c=>r.$emit("ungroup")),"data-tip":"取消组合 (Ctrl+Shift+G)"},[e.createVNode(e.unref(re.Ungroup),{size:15})],8,Zo)])])]),_:1}),e.createVNode(Oe,{"test-id":"view-dd",tip:"视图"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(re.Eye),{size:15}),d[35]||(d[35]=e.createElementVNode("span",{class:"tb-btn-text"},"视图",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Jo,[e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:t.showRuler}]),"data-tip":"显示/隐藏标尺",onClick:d[16]||(d[16]=c=>r.$emit("toggle-ruler"))},[...d[36]||(d[36]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 标尺 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:t.showGrid}]),"data-tip":"显示/隐藏网格背景",onClick:d[17]||(d[17]=c=>r.$emit("toggle-grid"))},[...d[37]||(d[37]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 网格 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:t.showTableGhostBorder}]),"data-tip":"显示/隐藏无边框表格的虚拟虚线",onClick:d[18]||(d[18]=c=>r.$emit("toggle-table-ghost-border"))},[...d[38]||(d[38]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 虚框 ",-1)])],2),e.createElementVNode("button",{class:e.normalizeClass(["tb-btn tb-menu-row",{on:t.snapToGrid}]),"data-tip":"开启/关闭元素吸附到网格",onClick:d[19]||(d[19]=c=>r.$emit("toggle-snap"))},[...d[39]||(d[39]=[e.createElementVNode("span",{class:"dot"},null,-1),e.createTextVNode(" 吸附 ",-1)])],2)])]),_:1})])),[[e.unref(o),{id:"arrange-view",order:4,label:"排列 / 视图"}]])],8,["to","disabled"])),(e.openBlock(),e.createBlock(e.Teleport,{to:e.unref(l).slotEl("zoom"),disabled:!e.unref(l).moved("zoom")},[e.withDirectives((e.openBlock(),e.createElementBlock("div",Qo,[e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:d[20]||(d[20]=c=>r.$emit("fit-window")),"data-tip":"适应窗口"},[e.createVNode(e.unref(re.Maximize),{size:15})]),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:d[21]||(d[21]=c=>r.$emit("zoom",-10)),"data-tip":"缩小"},[e.createVNode(e.unref(re.ZoomOut),{size:15})]),e.createElementVNode("span",_o,e.toDisplayString(i.value)+"%",1),e.createElementVNode("button",{class:"tb-btn tb-icon",onClick:d[22]||(d[22]=c=>r.$emit("zoom",10)),"data-tip":"放大"},[e.createVNode(e.unref(re.ZoomIn),{size:15})])])),[[e.unref(o),{id:"zoom",order:3,label:"缩放"}]])],8,["to","disabled"])),(e.openBlock(),e.createBlock(e.Teleport,{to:e.unref(l).slotEl("clipboard"),disabled:!e.unref(l).moved("clipboard")},[e.withDirectives((e.openBlock(),e.createElementBlock("div",en,[e.createElementVNode("button",{class:"tb-btn tb-icon","data-test":"copy",disabled:t.clipboardDisabled,onClick:d[23]||(d[23]=c=>r.$emit("copy")),"data-tip":t.clipboardDisabled?"复制 (Ctrl+C),需选中元素":"复制 (Ctrl+C)"},[e.createVNode(e.unref(re.Copy),{size:15})],8,tn),e.createElementVNode("button",{class:"tb-btn tb-icon","data-test":"paste",disabled:t.clipboardDisabled||!t.hasClipboard,onClick:d[24]||(d[24]=c=>r.$emit("paste")),"data-tip":a.value},[e.createVNode(e.unref(re.ClipboardPaste),{size:15})],8,on),e.createElementVNode("button",{class:"tb-btn tb-icon danger","data-test":"delete",disabled:t.clipboardDisabled,onClick:d[25]||(d[25]=c=>r.$emit("delete")),"data-tip":t.clipboardDisabled?"删除 (Delete),需选中元素":"删除 (Delete)"},[e.createVNode(e.unref(re.Trash2),{size:15})],8,nn)])),[[e.unref(o),{id:"clipboard",order:1,label:"剪贴板"}]])],8,["to","disabled"])),e.createVNode(Co),d[40]||(d[40]=e.createElementVNode("div",{class:"tb-spacer","data-overflow-spacer":""},null,-1)),t.showHelp?(e.openBlock(),e.createElementBlock("div",ln,[e.createVNode(po,{onClick:d[26]||(d[26]=c=>r.$emit("help"))})])):e.createCommentVNode("",!0),e.createElementVNode("div",an,[e.createElementVNode("button",{class:"btn-secondary","data-tip":"预览模板打印效果",onClick:d[27]||(d[27]=c=>r.$emit("preview"))},"预览"),e.createElementVNode("button",{class:"btn-primary","data-tip":"保存模板",onClick:d[28]||(d[28]=c=>r.$emit("save"))},"保存")])],2))}}),sn=ue(rn,[["__scopeId","data-v-b50decc4"]]),dn={class:"font-select"},cn=["placeholder","disabled","aria-expanded","aria-activedescendant","onKeydown"],un=["id","aria-selected","onMousedown"],mn=e.defineComponent({__name:"FontSelect",props:{modelValue:{},placeholder:{default:"默认"},disabled:{type:Boolean,default:!1}},emits:["update:model-value"],setup(t,{emit:l}){const o=t,n=l,i=io(),u=`font-select-list-${e.useId()}`,a=e.ref(null),r=e.ref(w(o.modelValue)),d=e.ref(""),c=e.ref(!1),m=e.ref(-1),f=e.computed(()=>{const Y=o.modelValue?.trim();return Y?xt(i.value,Y)?"":Y:""}),g=e.computed(()=>{const Y=(o.modelValue??"").trim(),z=(k,H,G,q)=>({kind:k,key:H,label:G,value:q,selected:(q??"")===Y}),h=d.value.trim();if(!h){const k=[z("clear","__clear__",o.placeholder)];f.value&&k.push(z("unknown","__unknown__",`${f.value}(未知)`,f.value));for(const H of i.value)k.push(z("font",H.family,Bt(H),H.family));return k}const A=ro(i.value,h).map(k=>z("font",k.family,Bt(k),k.family));if(!A.length){const k=p(h);A.push(z("free","__free__",`使用「${k}」`,k))}return A});function p(Y){const z=Fe(Y);return i.value.find(A=>A.label&&Fe(A.label)===z)?.family??Y}function w(Y){const z=Y?.trim();return z?xt(i.value,z)?.label??z:""}const C=e.computed(()=>c.value&&m.value>=0?`${u}-${m.value}`:void 0);function N(){const Y=(o.modelValue??"").trim();return g.value.findIndex(z=>(z.value??"")===Y)}function v(){c.value||(c.value=!0,d.value="",m.value=N())}function $(){c.value=!0}function W(){c.value=!0,d.value=r.value,m.value=g.value.length?0:-1}function te(Y){if(!c.value){v();return}const z=g.value.length-1;z<0||(m.value=Math.min(Math.max(m.value+Y,0),z),J())}function J(){e.nextTick(()=>{a.value?.children[m.value]?.scrollIntoView?.({block:"nearest"})})}function L(){if(!c.value)return;const Y=g.value[m.value];if(Y){E(Y);return}const z=d.value.trim();if(z){const h=p(z);E({value:h})}}function E(Y){r.value=w(Y.value),d.value="",c.value=!1,m.value=-1,n("update:model-value",Y.value)}function O(){c.value=!1,d.value="",m.value=-1,r.value=w(o.modelValue)}return e.watch(()=>o.modelValue,Y=>{r.value=w(Y)}),(Y,z)=>(e.openBlock(),e.createElementBlock("div",dn,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":z[0]||(z[0]=h=>r.value=h),class:"pd-input font-select-input",type:"text",role:"combobox","aria-autocomplete":"list",autocomplete:"off",placeholder:t.placeholder,disabled:t.disabled,"aria-expanded":c.value,"aria-controls":u,"aria-activedescendant":C.value,onFocus:v,onClick:$,onInput:W,onKeydown:[z[1]||(z[1]=e.withKeys(e.withModifiers(h=>te(1),["prevent"]),["down"])),z[2]||(z[2]=e.withKeys(e.withModifiers(h=>te(-1),["prevent"]),["up"])),e.withKeys(e.withModifiers(L,["prevent"]),["enter"]),e.withKeys(e.withModifiers(O,["prevent"]),["esc"])],onBlur:O},null,40,cn),[[e.vModelText,r.value]]),c.value?(e.openBlock(),e.createElementBlock("ul",{key:0,id:u,ref_key:"listRef",ref:a,class:"font-select-list",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(h,A)=>(e.openBlock(),e.createElementBlock("li",{id:`${u}-${A}`,key:h.key,class:e.normalizeClass(["font-select-option",{"is-active":A===m.value,"is-muted":h.kind==="unknown"||h.kind==="free"}]),role:"option","aria-selected":h.selected,onMousedown:e.withModifiers(k=>E(h),["prevent"])},e.toDisplayString(h.label),43,un))),128))],512)):e.createCommentVNode("",!0)]))}}),kt=ue(mn,[["__scopeId","data-v-f1aae453"]]),pn={class:"pd-stepper"},vn=["disabled"],fn=["value","placeholder","min","max","step","disabled"],gn=["disabled"],hn=e.defineComponent({__name:"StepperInput",props:{modelValue:{},min:{},max:{},step:{default:1},placeholder:{},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:l}){const o=t,n=l,i=e.computed(()=>{const C=String(o.step),N=C.indexOf(".");return N===-1?0:C.length-N-1});function u(C){return Number.isFinite(C)?Number(C.toFixed(i.value)):0}const a=e.computed(()=>{const C=o.modelValue;if(!(C==null||!Number.isFinite(C)))return u(C)}),r=e.ref(a.value===void 0?"":String(a.value));e.watch(a,C=>{r.value=C===void 0?"":String(C)});const d=e.computed(()=>a.value!==void 0?a.value:o.min!==void 0?o.min:0),c=e.computed(()=>o.min!==void 0&&d.value<=o.min),m=e.computed(()=>o.max!==void 0&&d.value>=o.max);function f(C){let N=u(C);return o.min!==void 0&&N<o.min&&(N=o.min),o.max!==void 0&&N>o.max&&(N=o.max),N}function g(C){if(C<0&&c.value||C>0&&m.value)return;const N=f(d.value+C*o.step);r.value=String(N),n("update:modelValue",N)}function p(C){r.value=C.target.value}function w(){const C=r.value.trim();if(C===""){a.value!==void 0&&(r.value=String(a.value));return}const N=Number(C);if(!Number.isFinite(N)){r.value=a.value===void 0?"":String(a.value);return}const v=f(N);r.value=String(v),v!==a.value&&n("update:modelValue",v)}return(C,N)=>(e.openBlock(),e.createElementBlock("div",pn,[e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:c.value||t.disabled,title:"减小","aria-label":"减小",onClick:N[0]||(N[0]=v=>g(-1))},"−",8,vn),e.createElementVNode("input",{type:"number",class:"pd-input pd-step-input",value:r.value,placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,disabled:t.disabled,onInput:p,onChange:w,onBlur:w,onKeydown:N[1]||(N[1]=e.withKeys(e.withModifiers(v=>v.target.blur(),["prevent"]),["enter"]))},null,40,fn),e.createElementVNode("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:m.value||t.disabled,title:"增大","aria-label":"增大",onClick:N[2]||(N[2]=v=>g(1))},"+",8,gn)]))}}),de=ue(hn,[["__scopeId","data-v-627f09cb"]]),bn=["aria-expanded","title"],En={class:"picker-preview"},yn={class:"picker-heading"},kn=["disabled"],Vn={class:"preset-color-grid"},Nn=["title","aria-label","onClick"],wn=e.defineComponent({inheritAttrs:!1,__name:"PresetColorPicker",props:{modelValue:{},clearable:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{emit:l}){const o=t,n=l,i=e.ref(!1),u=e.ref(),a=e.ref(),r=e.ref(),d=e.ref({}),c=e.ref(0),m=e.ref(0),f=e.ref(0),g=e.ref("#000000"),p=e.ref(!1),w=e.computed(()=>o.modelValue||"#000000"),C=e.computed(()=>o.modelValue?{background:o.modelValue}:{background:"transparent"}),N=e.computed(()=>x(he(c.value,m.value,f.value))),v=e.computed({get:()=>Math.round(c.value),set:K=>L(ge(K),m.value,f.value)});e.watch(()=>o.modelValue,K=>{if(!K){g.value="";return}J(K)},{immediate:!0});function $(K){g.value=K.toUpperCase(),J(K),n("update:modelValue",K)}function W(){o.clearable&&n("update:modelValue","")}function te(K){const T=K.target.value.trim();if(!T){o.clearable&&n("update:modelValue","");return}B(T)&&(J(T),n("update:modelValue",s(T)))}function J(K){const S=B(K);if(!S)return;const T=ee(S.r,S.g,S.b);c.value=T.h,m.value=T.s,f.value=T.v,g.value=s(K).toUpperCase()}function L(K,S,T){c.value=ge(K),m.value=se(S),f.value=se(T),g.value=N.value.toUpperCase(),n("update:modelValue",N.value)}function E(K){K.currentTarget.setPointerCapture(K.pointerId),p.value=!0,z(K)}function O(K){p.value&&z(K)}function Y(K){p.value=!1;const S=K.currentTarget;S.hasPointerCapture(K.pointerId)&&S.releasePointerCapture(K.pointerId)}function z(K){const S=r.value;if(!S)return;const T=S.getBoundingClientRect(),j=se((K.clientX-T.left)/T.width),Z=se(1-(K.clientY-T.top)/T.height);L(c.value,j,Z)}function h(K){const S=K.shiftKey?.1:.02;let T=!0;K.key==="ArrowLeft"?L(c.value,m.value-S,f.value):K.key==="ArrowRight"?L(c.value,m.value+S,f.value):K.key==="ArrowUp"?L(c.value,m.value,f.value+S):K.key==="ArrowDown"?L(c.value,m.value,f.value-S):T=!1,T&&K.preventDefault()}function A(){i.value?H():k()}async function k(){const K=u.value;if(!K)return;o.modelValue&&J(w.value),i.value=!0,await e.nextTick();const S=K.getBoundingClientRect(),T=190,j=a.value?.offsetHeight??216,Z=8,ne=Math.min(S.left,window.innerWidth-T-Z),ve=S.bottom+6,M=ve+j>window.innerHeight-Z?Math.max(Z,S.top-j-6):ve;d.value={left:`${Math.max(Z,ne)}px`,top:`${M}px`}}function H(){i.value=!1}function G(K){const S=K.target;u.value?.contains(S)||a.value?.contains(S)||H()}function q(){i.value&&H()}function _(K){K.key==="Escape"&&i.value&&H()}function B(K){const S=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(K.trim());if(!S)return null;const T=S[1],j=T.length===3?T.split("").map(Z=>Z+Z).join(""):T;return{r:Number.parseInt(j.slice(0,2),16),g:Number.parseInt(j.slice(2,4),16),b:Number.parseInt(j.slice(4,6),16)}}function s(K){const S=B(K);return S?x(S):"#000000"}function x({r:K,g:S,b:T}){return`#${[K,S,T].map(j=>Math.round(se(j/255)*255).toString(16).padStart(2,"0")).join("")}`}function ee(K,S,T){const j=K/255,Z=S/255,ne=T/255,ve=Math.max(j,Z,ne),M=Math.min(j,Z,ne),D=ve-M;let U=0;return D!==0&&(ve===j?U=(Z-ne)/D%6:ve===Z?U=(ne-j)/D+2:U=(j-Z)/D+4,U*=60,U<0&&(U+=360)),{h:U,s:ve===0?0:D/ve,v:ve}}function he(K,S,T){const j=T*S,Z=(K%360+360)%360/60,ne=j*(1-Math.abs(Z%2-1)),[ve,M,D]=Z<1?[j,ne,0]:Z<2?[ne,j,0]:Z<3?[0,j,ne]:Z<4?[0,ne,j]:Z<5?[ne,0,j]:[j,0,ne],U=T-j;return{r:(ve+U)*255,g:(M+U)*255,b:(D+U)*255}}function ge(K){return((Number.isFinite(K)?K:0)%360+360)%360}function se(K){return Math.min(1,Math.max(0,Number.isFinite(K)?K:0))}return e.onMounted(()=>{document.addEventListener("pointerdown",G,!0),window.addEventListener("scroll",q,!0),window.addEventListener("resize",q),document.addEventListener("keydown",_)}),e.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",G,!0),window.removeEventListener("scroll",q,!0),window.removeEventListener("resize",q),document.removeEventListener("keydown",_)}),(K,S)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("button",e.mergeProps({ref_key:"triggerRef",ref:u},K.$attrs,{type:"button",class:"preset-color-trigger","aria-expanded":i.value,"aria-haspopup":"dialog",title:t.modelValue||"自动",onClick:A}),[e.createElementVNode("span",{class:"preset-color-swatch",style:e.normalizeStyle(C.value)},null,4)],16,bn),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[i.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"panelRef",ref:a,class:"preset-color-panel",role:"dialog","aria-label":"颜色选择",style:e.normalizeStyle(d.value),onPointerdown:S[2]||(S[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",En,[e.createElementVNode("span",{class:e.normalizeClass(["picker-current",{"is-empty":!t.modelValue}]),style:e.normalizeStyle(t.modelValue?{background:N.value}:void 0)},null,6),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S[0]||(S[0]=T=>g.value=T),class:"picker-hex",type:"text",maxlength:"7",spellcheck:"false","aria-label":"颜色值",onInput:te},null,544),[[e.vModelText,g.value]])]),e.createElementVNode("div",{ref_key:"areaRef",ref:r,class:"picker-area",style:e.normalizeStyle({"--picker-hue":`${Math.round(c.value)}deg`}),"aria-label":"自定义颜色",tabindex:"0",onPointerdown:E,onPointermove:O,onPointerup:Y,onPointercancel:Y,onKeydown:h},[e.createElementVNode("span",{class:"picker-handle",style:e.normalizeStyle({left:`${m.value*100}%`,top:`${(1-f.value)*100}%`,background:N.value})},null,4)],36),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S[1]||(S[1]=T=>v.value=T),class:"picker-hue",type:"range",min:"0",max:"360",step:"1","aria-label":"色相"},null,512),[[e.vModelText,v.value,void 0,{number:!0}]]),e.createElementVNode("div",yn,[S[4]||(S[4]=e.createElementVNode("span",null,"常用颜色",-1)),t.clearable?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"picker-clear",disabled:!t.modelValue,title:"清除选中的颜色",onClick:W},[...S[3]||(S[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,kn)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Vn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b.PRESET_COLORS),T=>(e.openBlock(),e.createElementBlock("button",{key:T,type:"button",class:e.normalizeClass(["preset-color-item",{active:!!t.modelValue&&T.toLowerCase()===t.modelValue.toLowerCase()}]),style:e.normalizeStyle({background:T}),title:T,"aria-label":T,onClick:j=>$(T)},null,14,Nn))),128))])],36)):e.createCommentVNode("",!0)]))],64))}}),Ne=ue(wn,[["__scopeId","data-v-4ff2cd97"]]),Cn={class:"format-toolbar"},Sn={class:"tb-ou ft-group"},xn=["disabled","data-tip"],Bn={class:"tb-ou ft-group"},$n={class:"ft-font"},Dn={class:"ft-size","data-test":"font-size"},Tn={class:"tb-ou ft-group"},Mn=["disabled","data-tip"],zn=["disabled","data-tip"],An=["disabled","data-tip"],Pn={class:"tb-ou ft-group"},Rn=["title"],Ln={class:"ft-glyph"},Un={class:"tb-ou ft-group"},In={class:"ft-align-panel","data-test":"align-panel"},Fn={class:"ft-align-row"},On={class:"ft-align-row"},Hn={class:"tb-ou ft-group"},Wn={class:"ft-border-panel","data-test":"border-panel"},Gn={class:"ft-border-grid"},qn=["disabled","data-tip"],Kn={class:"ft-style-row"},jn=["data-test","data-tip","onClick"],Yn={class:"ft-border-style-row"},Xn={class:"ft-line-width"},Zn={class:"ft-border-style-row"},Jn=e.defineComponent({__name:"FormatToolbar",props:{format:{},painter:{}},setup(t){const l=Et()??Ft(),o=yt(l),n=t,i=e.computed(()=>n.format.values.value),u=e.computed(()=>!n.format.fontEditable.value),a=e.computed(()=>u.value||n.format.context.value==="cells"),r=e.computed(()=>n.format.context.value==="none"),d=e.computed(()=>n.painter?.active.value===!0),c=e.computed(()=>!n.painter||!d.value&&(n.format.context.value==="none"||n.format.context.value==="cells"||!n.painter.capturable.value)),m=e.computed(()=>d.value?"退出格式刷(Esc)":n.painter?n.format.context.value==="cells"?"格式刷(表格单元格暂不支持)":n.format.context.value==="none"?"格式刷(需选中元素)":n.painter.capturable.value?"格式刷:单击刷一次,双击连续刷":"格式刷(请仅选中一个源元素)":"格式刷");function f(){const _=n.painter;if(_){if(_.active.value){_.cancel();return}_.capture(!1)}}function g(){n.painter?.capture(!0)}const p=e.computed(()=>i.value.fontFamily===Ce?void 0:i.value.fontFamily),w=e.computed(()=>i.value.fontFamily===Ce?"混合":"默认"),C=e.computed(()=>i.value.fontSize===Ce?void 0:i.value.fontSize),N=e.computed(()=>i.value.fontSize===Ce?"混合":"默认"),v=e.computed(()=>i.value.bold===!0),$=e.computed(()=>i.value.color===Ce?void 0:i.value.color),W=e.computed(()=>i.value.backgroundColor===Ce?void 0:i.value.backgroundColor),te=e.computed(()=>i.value.textAlign==="center"?re.TextAlignCenter:i.value.textAlign==="right"?re.TextAlignEnd:i.value.textAlign==="justify"?re.TextAlignJustify:re.TextAlignStart),J=e.computed(()=>u.value?"对齐(需选中文本元素或单元格)":"对齐"),L=e.computed(()=>r.value?"边框(需选中元素)":"边框");function E(_){return u.value?`${_}(需选中文本元素)`:n.format.context.value==="cells"?`${_}(单元格不支持)`:_}const O=e.ref("solid"),Y=e.ref(.75),z=e.ref("#333333"),h=e.computed(()=>n.format.context.value==="cells"),A=[{key:"solid",label:"实线",preview:"2px solid currentColor"},{key:"dashed",label:"虚线",preview:"2px dashed currentColor"},{key:"dotted",label:"点线",preview:"2px dotted currentColor"},{key:"double",label:"双线",preview:"3px double currentColor"}];function k(){return{width:Y.value,style:O.value,color:z.value}}function H(_){h.value?n.format.applyCellBorderPreset(_,k()):n.format.applyElementBorder(_==="none"?"none":"all",k())}function G(_){return(h.value?n.format.cellEdges.value:n.format.elementEdges.value)?.[_]===!0}function q(_){h.value?n.format.toggleCellEdge(_,k()):n.format.toggleElementEdge(_,k())}return(_,B)=>(e.openBlock(),e.createElementBlock("div",Cn,[(e.openBlock(),e.createBlock(e.Teleport,{to:e.unref(l).slotEl("painter"),disabled:!e.unref(l).moved("painter")},[e.withDirectives((e.openBlock(),e.createElementBlock("div",Sn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:d.value}]),"data-test":"format-painter",disabled:c.value,"data-tip":m.value,onClick:f,onDblclick:g},[e.createVNode(e.unref(re.Paintbrush),{size:15})],42,xn)])),[[e.unref(o),{id:"painter",order:2,label:"格式刷"}]])],8,["to","disabled"])),(e.openBlock(),e.createBlock(e.Teleport,{to:e.unref(l).slotEl("font"),disabled:!e.unref(l).moved("font")},[e.withDirectives((e.openBlock(),e.createElementBlock("div",Bn,[e.createElementVNode("div",$n,[e.createVNode(kt,{"model-value":p.value,placeholder:w.value,disabled:u.value,"onUpdate:modelValue":B[0]||(B[0]=s=>t.format.applyStyle({fontFamily:s}))},null,8,["model-value","placeholder","disabled"])]),e.createElementVNode("div",Dn,[e.createVNode(de,{"model-value":C.value,min:5,max:72,placeholder:N.value,disabled:u.value,"onUpdate:modelValue":B[1]||(B[1]=s=>t.format.applyStyle({fontSize:s}))},null,8,["model-value","placeholder","disabled"])])])),[[e.unref(o),{id:"font",order:9,label:"字体与字号"}]])],8,["to","disabled"])),(e.openBlock(),e.createBlock(e.Teleport,{to:e.unref(l).slotEl("style"),disabled:!e.unref(l).moved("style")},[e.withDirectives((e.openBlock(),e.createElementBlock("div",Tn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:v.value}]),"data-test":"bold",disabled:u.value,"data-tip":u.value?"加粗(需选中文本元素或单元格)":"加粗",onClick:B[2]||(B[2]=s=>t.format.toggleBold())},[e.createVNode(e.unref(re.Bold),{size:15})],10,Mn),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:i.value.underline===!0}]),"data-test":"underline",disabled:a.value,"data-tip":E("下划线"),onClick:B[3]||(B[3]=s=>t.format.toggleUnderline())},[e.createVNode(e.unref(re.Underline),{size:15})],10,zn),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-btn",{on:i.value.strike===!0}]),"data-test":"strike",disabled:a.value,"data-tip":E("删除线"),onClick:B[4]||(B[4]=s=>t.format.toggleStrike())},[e.createVNode(e.unref(re.Strikethrough),{size:15})],10,An)])),[[e.unref(o),{id:"style",order:8,label:"文字样式"}]])],8,["to","disabled"])),(e.openBlock(),e.createBlock(e.Teleport,{to:e.unref(l).slotEl("color"),disabled:!e.unref(l).moved("color")},[e.withDirectives((e.openBlock(),e.createElementBlock("div",Pn,[e.createElementVNode("span",{class:e.normalizeClass(["ft-color-btn",{dim:u.value}]),title:`字体颜色${u.value?"(需选中或混选文本元素)":""}`},[e.createVNode(Ne,{"model-value":$.value,"onUpdate:modelValue":B[5]||(B[5]=s=>t.format.applyStyle({color:s}))},null,8,["model-value"]),B[24]||(B[24]=e.createElementVNode("span",{class:"ft-glyph"},"A",-1))],10,Rn),e.createElementVNode("span",{class:e.normalizeClass(["ft-color-btn",{dim:r.value}]),title:"背景色"},[e.createVNode(Ne,{"model-value":W.value,"onUpdate:modelValue":B[6]||(B[6]=s=>t.format.applyStyle({backgroundColor:s}))},null,8,["model-value"]),e.createElementVNode("span",Ln,[e.createVNode(e.unref(re.PaintBucket),{size:14})])],2)])),[[e.unref(o),{id:"color",order:6,label:"颜色"}]])],8,["to","disabled"])),(e.openBlock(),e.createBlock(e.Teleport,{to:e.unref(l).slotEl("align"),disabled:!e.unref(l).moved("align")},[e.withDirectives((e.openBlock(),e.createElementBlock("div",Un,[e.createVNode(Oe,{"test-id":"align-dd",tip:J.value,disabled:u.value},{trigger:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(te.value),{size:15})),B[25]||(B[25]=e.createElementVNode("span",{class:"ft-btn-text"},"对齐",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",In,[e.createElementVNode("div",Fn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:i.value.textAlign==="left"}]),"data-test":"align-left","data-tip":"左对齐",onClick:B[7]||(B[7]=s=>t.format.applyStyle({textAlign:"left"}))},[e.createVNode(e.unref(re.TextAlignStart),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:i.value.textAlign==="center"}]),"data-test":"align-center","data-tip":"水平居中",onClick:B[8]||(B[8]=s=>t.format.applyStyle({textAlign:"center"}))},[e.createVNode(e.unref(re.TextAlignCenter),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:i.value.textAlign==="right"}]),"data-test":"align-right","data-tip":"右对齐",onClick:B[9]||(B[9]=s=>t.format.applyStyle({textAlign:"right"}))},[e.createVNode(e.unref(re.TextAlignEnd),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:i.value.textAlign==="justify"}]),"data-test":"align-justify","data-tip":"两端对齐(撑满行宽,含末行)",onClick:B[10]||(B[10]=s=>t.format.applyStyle({textAlign:"justify"}))},[e.createVNode(e.unref(re.TextAlignJustify),{size:15})],2)]),e.createElementVNode("div",On,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:i.value.verticalAlign==="top"}]),"data-test":"valign-top","data-tip":"顶端对齐",onClick:B[11]||(B[11]=s=>t.format.applyStyle({verticalAlign:"top"}))},[e.createVNode(e.unref(re.ArrowUpToLine),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:i.value.verticalAlign==="middle"}]),"data-test":"valign-middle","data-tip":"垂直居中",onClick:B[12]||(B[12]=s=>t.format.applyStyle({verticalAlign:"middle"}))},[e.createVNode(e.unref(re.ChevronsUpDown),{size:15})],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:i.value.verticalAlign==="bottom"}]),"data-test":"valign-bottom","data-tip":"底端对齐",onClick:B[13]||(B[13]=s=>t.format.applyStyle({verticalAlign:"bottom"}))},[e.createVNode(e.unref(re.ArrowDownToLine),{size:15})],2)])])]),_:1},8,["tip","disabled"])])),[[e.unref(o),{id:"align",order:7,label:"对齐"}]])],8,["to","disabled"])),(e.openBlock(),e.createBlock(e.Teleport,{to:e.unref(l).slotEl("border"),disabled:!e.unref(l).moved("border")},[e.withDirectives((e.openBlock(),e.createElementBlock("div",Hn,[e.createVNode(Oe,{"test-id":"border",tip:L.value,disabled:r.value},{trigger:e.withCtx(()=>[e.createVNode(e.unref(re.Grid3x3),{size:15}),B[26]||(B[26]=e.createElementVNode("span",{class:"ft-btn-text"},"边框",-1))]),default:e.withCtx(()=>[e.createElementVNode("div",Wn,[e.createElementVNode("div",Gn,[e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-none","data-tip":"无边框",onClick:B[14]||(B[14]=s=>H("none"))},[...B[27]||(B[27]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"4",y1:"14",x2:"14",y2:"4"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-all","data-tip":"所有边框",onClick:B[15]||(B[15]=s=>H("all"))},[...B[28]||(B[28]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-solid",x:"2.5",y:"2.5",width:"13",height:"13",fill:"none"}),e.createElementVNode("line",{class:"g-solid",x1:"9",y1:"3",x2:"9",y2:"15"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"9",x2:"15",y2:"9"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-outer","data-tip":"外侧边框",onClick:B[16]||(B[16]=s=>H("outer"))},[...B[29]||(B[29]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-solid",x:"2.5",y:"2.5",width:"13",height:"13",fill:"none"})],-1)])]),e.createElementVNode("button",{type:"button",class:"ft-cell-btn","data-test":"preset-inner",disabled:!h.value,"data-tip":h.value?"内部边框":"内部边框(仅表格单元格可用)",onClick:B[17]||(B[17]=s=>H("inner"))},[...B[30]||(B[30]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"9",y1:"3",x2:"9",y2:"15"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"9",x2:"15",y2:"9"})],-1)])],8,qn),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:G("top")}]),"data-test":"edge-top","data-tip":"上边框",onClick:B[18]||(B[18]=s=>q("top"))},[...B[31]||(B[31]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"2",y1:"3",x2:"16",y2:"3"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:G("bottom")}]),"data-test":"edge-bottom","data-tip":"下边框",onClick:B[19]||(B[19]=s=>q("bottom"))},[...B[32]||(B[32]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"2",y1:"15",x2:"16",y2:"15"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:G("left")}]),"data-test":"edge-left","data-tip":"左边框",onClick:B[20]||(B[20]=s=>q("left"))},[...B[33]||(B[33]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"3",y1:"2",x2:"3",y2:"16"})],-1)])],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ft-cell-btn",{on:G("right")}]),"data-test":"edge-right","data-tip":"右边框",onClick:B[21]||(B[21]=s=>q("right"))},[...B[34]||(B[34]=[e.createElementVNode("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":"true"},[e.createElementVNode("rect",{class:"g-faint",x:"2.5",y:"2.5",width:"13",height:"13"}),e.createElementVNode("line",{class:"g-solid",x1:"15",y1:"2",x2:"15",y2:"16"})],-1)])],2)]),e.createElementVNode("div",Kn,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(A,s=>e.createElementVNode("button",{key:s.key,type:"button",class:e.normalizeClass(["ft-style-btn",{on:O.value===s.key}]),"data-test":`style-${s.key}`,"data-tip":s.label,onClick:x=>O.value=s.key},[e.createElementVNode("span",{class:"ft-style-line",style:e.normalizeStyle({borderTop:s.preview})},null,4)],10,jn)),64))]),e.createElementVNode("div",Yn,[B[35]||(B[35]=e.createElementVNode("span",{class:"ft-edge-label"},"粗细",-1)),e.createElementVNode("div",Xn,[e.createVNode(de,{modelValue:Y.value,"onUpdate:modelValue":B[22]||(B[22]=s=>Y.value=s),min:.25,max:5,step:.25},null,8,["modelValue"])])]),e.createElementVNode("div",Zn,[B[36]||(B[36]=e.createElementVNode("span",{class:"ft-edge-label"},"颜色",-1)),e.createVNode(Ne,{modelValue:z.value,"onUpdate:modelValue":B[23]||(B[23]=s=>z.value=s),clearable:!1},null,8,["modelValue"])])])]),_:1},8,["tip","disabled"])])),[[e.unref(o),{id:"border",order:5,label:"边框"}]])],8,["to","disabled"]))]))}}),Qn=ue(Jn,[["__scopeId","data-v-721695e4"]]),_n={class:"layer-panel"},el=["onClick"],tl={class:"layer-icon"},ol={class:"layer-name"},nl={key:0,class:"layer-zone"},ll={class:"layer-zindex"},al={key:0,class:"layer-actions"},il={key:1,class:"layer-actions"},rl=e.defineComponent({__name:"LayerPanel",props:{elements:{},selectedIds:{}},emits:["select","move-layer","group","ungroup"],setup(t){const l=t,o=e.computed(()=>l.elements.filter(m=>l.selectedIds.has(m.id))),n=e.computed(()=>o.value.length>=2),i=e.computed(()=>o.value.some(m=>!!m.options.groupId)),u=e.computed(()=>[...l.elements].sort((m,f)=>(f.options.zIndex??0)-(m.options.zIndex??0))),a={text:"T",longText:"¶",table:"⊞",image:"🖼",barcode:"≡",qrcode:"▣",hline:"—",vline:"|",rect:"□",oval:"○",html:"<>"};function r(m){return a[m.printElementType.type]||"?"}function d(m){return m.options.title||m.printElementType.title||m.printElementType.type}function c(m){return m.zone==="header"?"页眉":m.zone==="footer"?"页脚":""}return(m,f)=>(e.openBlock(),e.createElementBlock("div",_n,[f[6]||(f[6]=e.createElementVNode("div",{class:"panel-title"},"图层",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.id,class:e.normalizeClass(["layer-item",{active:t.selectedIds.has(g.id)}]),onClick:p=>m.$emit("select",g.id,p.ctrlKey||p.metaKey)},[e.createElementVNode("span",tl,e.toDisplayString(r(g)),1),e.createElementVNode("span",ol,e.toDisplayString(d(g)),1),c(g)?(e.openBlock(),e.createElementBlock("span",nl,e.toDisplayString(c(g)),1)):e.createCommentVNode("",!0),e.createElementVNode("span",ll,"z:"+e.toDisplayString(g.options.zIndex??0),1)],10,el))),128)),u.value.length>0?(e.openBlock(),e.createElementBlock("div",al,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[0]||(f[0]=g=>m.$emit("move-layer","top")),title:"置顶"},[e.createVNode(e.unref(re.ArrowUpToLine),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[1]||(f[1]=g=>m.$emit("move-layer","up")),title:"上移"},[e.createVNode(e.unref(re.ArrowUp),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[2]||(f[2]=g=>m.$emit("move-layer","down")),title:"下移"},[e.createVNode(e.unref(re.ArrowDown),{size:14})]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:f[3]||(f[3]=g=>m.$emit("move-layer","bottom")),title:"置底"},[e.createVNode(e.unref(re.ArrowDownToLine),{size:14})])])):e.createCommentVNode("",!0),n.value||i.value?(e.openBlock(),e.createElementBlock("div",il,[n.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"pd-button small",onClick:f[4]||(f[4]=g=>m.$emit("group")),title:"组合 (Ctrl+G)"},[e.createVNode(e.unref(re.Group),{size:14})])):e.createCommentVNode("",!0),i.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"pd-button small",onClick:f[5]||(f[5]=g=>m.$emit("ungroup")),title:"取消组合 (Ctrl+Shift+G)"},[e.createVNode(e.unref(re.Ungroup),{size:14})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),sl=ue(rl,[["__scopeId","data-v-567d273e"]]),dl={class:"field-tree-panel"},cl={class:"tree-container"},ul=["onClick"],ml={class:"expand-icon"},pl={class:"node-icon"},vl={class:"group-label"},fl=["onDragstart"],gl={class:"node-label"},hl={class:"node-key"},bl={key:0,class:"pd-empty"},El=e.defineComponent({__name:"FieldTreePanel",props:{fields:{}},emits:["field-drag"],setup(t,{emit:l}){const o=t,n=l,i=e.ref(""),u=e.ref(new Set),a=e.computed(()=>!!i.value.trim()),r=e.computed(()=>b.filterGroups(b.groupFields(o.fields),i.value));function d(m){const f=new Set(u.value);f.has(m)?f.delete(m):f.add(m),u.value=f}function c(m,f){m.dataTransfer?.setData("fieldData",JSON.stringify({fieldKey:f.fieldKey,fieldLabel:f.fieldLabel})),m.dataTransfer&&(m.dataTransfer.effectAllowed="copy"),n("field-drag",f)}return(m,f)=>(e.openBlock(),e.createElementBlock("div",dl,[f[2]||(f[2]=e.createElementVNode("div",{class:"panel-title"},"业务字段",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[0]||(f[0]=g=>i.value=g),class:"pd-input search-input",type:"search",placeholder:"搜索字段...","aria-label":"搜索字段"},null,512),[[e.vModelText,i.value]]),e.createElementVNode("div",cl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,g=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g.key||"_top"},[g.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["field-group-header",{"is-list":g.isList}]),onClick:p=>d(g.key)},[e.createElementVNode("span",ml,e.toDisplayString(u.value.has(g.key)&&!a.value?"▶":"▼"),1),e.createElementVNode("span",pl,e.toDisplayString(g.isList?"📋":"📁"),1),e.createElementVNode("span",vl,e.toDisplayString(g.label),1)],10,ul)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.fields,p=>(e.openBlock(),e.createElementBlock("div",{key:p.fieldKey,class:"field-row",draggable:"true",style:e.normalizeStyle({paddingLeft:(g.key?22:8)+"px"}),onDragstart:w=>c(w,p)},[f[1]||(f[1]=e.createElementVNode("span",{class:"node-icon"},"📄",-1)),e.createElementVNode("span",gl,e.toDisplayString(p.fieldLabel),1),e.createElementVNode("span",hl,"("+e.toDisplayString(p.fieldKey)+")",1)],44,fl))),128))],512),[[e.vShow,!g.key||a.value||!u.value.has(g.key)]])],64))),128))]),r.value.length===0?(e.openBlock(),e.createElementBlock("p",bl,"暂无字段")):e.createCommentVNode("",!0)]))}}),yl=ue(El,[["__scopeId","data-v-9b326f07"]]),kl={key:0,class:"left-collapsed"},Vl={class:"left-head"},Nl={class:"pd-tabs left-tabs"},wl={class:"pd-tab-bar",role:"tablist"},Cl={class:"pd-tab-pane",role:"tabpanel"},Sl=["onDragstart"],xl={class:"material-icon"},Bl={class:"material-label"},$l={class:"pd-tab-pane",role:"tabpanel"},Dl={class:"pd-tab-pane",role:"tabpanel"},Tl=e.defineComponent({__name:"LeftPanel",props:{fields:{},elements:{},selectedIds:{},collapsed:{type:Boolean}},emits:["select","move-layer","group","ungroup","toggle-visible","toggle-locked","field-drag","toggle-collapse"],setup(t,{emit:l}){const o=l,n=e.ref("elements"),i=[{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 u(d,c){d.dataTransfer?.setData("elementType",c)}function a(d){o("field-drag",d)}function r(d){n.value=d,o("toggle-collapse")}return(d,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["left-panel",{collapsed:t.collapsed}])},[t.collapsed?(e.openBlock(),e.createElementBlock("div",kl,[e.createElementVNode("button",{class:"lc-btn",title:"展开素材台",onClick:c[0]||(c[0]=m=>r(n.value))},"»"),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="elements"}]),title:"元素",onClick:c[1]||(c[1]=m=>r("elements"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="fields"}]),title:"字段",onClick:c[2]||(c[2]=m=>r("fields"))},"⊛",2),e.createElementVNode("button",{class:e.normalizeClass(["lc-btn",{on:n.value==="layers"}]),title:"图层",onClick:c[3]||(c[3]=m=>r("layers"))},"≡",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Vl,[c[14]||(c[14]=e.createElementVNode("span",{class:"left-title"},"素材台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起素材台",onClick:c[4]||(c[4]=m=>d.$emit("toggle-collapse"))},"«")]),e.createElementVNode("div",Nl,[e.createElementVNode("div",wl,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="elements"}]),onClick:c[5]||(c[5]=m=>n.value="elements")},"元素",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="fields"}]),onClick:c[6]||(c[6]=m=>n.value="fields")},"字段",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:n.value==="layers"}]),onClick:c[7]||(c[7]=m=>n.value="layers")},"图层",2)]),e.withDirectives(e.createElementVNode("div",Cl,[c[15]||(c[15]=e.createElementVNode("div",{class:"panel-title"},"拖拽元素到画布",-1)),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(i,m=>e.createElementVNode("div",{key:m.type,class:"material-card",draggable:"true",onDragstart:f=>u(f,m.type)},[e.createElementVNode("span",xl,e.toDisplayString(m.icon),1),e.createElementVNode("span",Bl,e.toDisplayString(m.label),1)],40,Sl)),64))],512),[[e.vShow,n.value==="elements"]]),e.withDirectives(e.createElementVNode("div",$l,[e.createVNode(yl,{fields:t.fields,onFieldDrag:a},null,8,["fields"])],512),[[e.vShow,n.value==="fields"]]),e.withDirectives(e.createElementVNode("div",Dl,[e.createVNode(sl,{elements:t.elements,"selected-ids":t.selectedIds,onSelect:c[8]||(c[8]=(m,f)=>d.$emit("select",m,f)),onMoveLayer:c[9]||(c[9]=m=>d.$emit("move-layer",m)),onGroup:c[10]||(c[10]=m=>d.$emit("group")),onUngroup:c[11]||(c[11]=m=>d.$emit("ungroup")),onToggleVisible:c[12]||(c[12]=m=>d.$emit("toggle-visible",m)),onToggleLocked:c[13]||(c[13]=m=>d.$emit("toggle-locked",m))},null,8,["elements","selected-ids"])],512),[[e.vShow,n.value==="layers"]])])],64))],2))}}),Ml=ue(Tl,[["__scopeId","data-v-4501eea7"]]);function zl(t,l){const o=e.ref(!1),n=e.ref(null);let i=0,u=0,a=0,r=0,d=!1;function c(C){if(l.disabled||C.button!==0)return;const N=C.target;if(!(N instanceof Element)||N.classList.contains("resize-handle"))return;o.value=!0,d=C.altKey,i=C.clientX,u=C.clientY;const v=t.value;v&&(a=parseFloat(v.style.left)||0,r=parseFloat(v.style.top)||0,n.value={left:a,top:r,width:parseFloat(v.style.width)||0,height:parseFloat(v.style.height)||0},l.onStart?.({altKey:d}),document.addEventListener("mousemove",f),document.addEventListener("mouseup",g),C.preventDefault())}function m(C){const N=l.getScale?.()??1;let v=a+(C.clientX-i)/N,$=r+(C.clientY-u)/N;if(l.axis==="x"&&($=r),l.axis==="y"&&(v=a),l.onAdsorb){const W=t.value;if(W){const te=parseFloat(W.style.width)||0,J=parseFloat(W.style.height)||0,L=l.onAdsorb({left:v,top:$,width:te,height:J});v=L.left,$=L.top}}return{left:v,top:$}}function f(C){const N=m(C);n.value&&(n.value.left=N.left,n.value.top=N.top),l.onDrag(N)}function g(C){o.value=!1;const N=m(C);l.onDragEnd?.(N,{altKey:d}),l.onStop?.(),n.value=null,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",g)}function p(){const C=t.value;C&&C.removeEventListener("mousedown",c),document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",g)}function w(){p();const C=t.value;C&&C.addEventListener("mousedown",c)}return{isDragging:o,dragPreview:n,setup:w,cleanup:p}}function Al(t){const l=[];return t.getAttribute("data-fit")==="shrink"&&l.push(t),t.querySelectorAll('[data-fit="shrink"]').forEach(o=>l.push(o)),l}function Pl(t){t.querySelectorAll("[data-fit-size]").forEach(l=>{if(l.getAttribute("data-fit")==="shrink")return;l.removeAttribute("data-fit-size");const o=l.getAttribute("data-fit-base");o?l.style.fontSize=`${o}pt`:l.style.removeProperty("font-size")})}function Vt(t,l){const o=()=>{const n=t.value;n&&(Al(n).forEach(Me.fitTextNode),Pl(n))};e.watchEffect(()=>{l(),e.nextTick(o)},{flush:"post"}),e.onMounted(()=>{e.nextTick(o)})}const Rl=["data-fit","data-fit-base","data-fit-min"],Ll=e.defineComponent({__name:"TextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o={top:"flex-start",middle:"center",bottom:"flex-end"},n={left:"flex-start",center:"center",right:"flex-end"},i=e.ref(null),u=e.computed(()=>b.resolveElementTextFit("text",l.element.options)),a=e.computed(()=>l.element.options.fontSize||12),r=e.computed(()=>b.resolveShrinkMinFontSize(l.element.options.shrinkMinFontSize)),d=e.computed(()=>{const m=l.element.options,f=u.value==="autoHeight";return{fontSize:a.value+"pt",fontWeight:m.fontWeight||"normal",fontFamily:m.fontFamily||"inherit",color:m.color||"#333",backgroundColor:m.backgroundColor||"transparent",textAlign:m.textAlign||"left",...m.textAlign==="justify"?{textAlignLast:"justify"}:{},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:f?"auto":"100%",boxSizing:"border-box",overflow:f?"visible":"hidden",...m.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...m.verticalAlign?{display:"flex",...m.textAlign==="justify"?{flexDirection:"column",justifyContent:o[m.verticalAlign]??"flex-start"}:{alignItems:o[m.verticalAlign]??"flex-start",justifyContent:n[m.textAlign||"left"]??"flex-start"}}:{}}}),c=e.computed(()=>l.designMode?l.element.options.testData?l.element.options.testData:l.element.options.formatter||"文本":b.resolveTextBinding(l.element.options,l.data));return Vt(i,()=>[u.value,a.value,r.value,l.element.options.width,l.element.options.height,l.element.options.wordWrap,l.element.options.letterSpacing,l.element.options.lineHeight,c.value]),(m,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:i,class:"print-text",style:e.normalizeStyle(d.value),"data-fit":u.value==="shrink"?"shrink":void 0,"data-fit-base":String(a.value),"data-fit-min":String(r.value)},e.toDisplayString(c.value),13,Rl))}}),Ul={class:"print-image"},Il=["src"],Fl={key:1,class:"image-placeholder"},Ol=e.defineComponent({__name:"ImageElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o=e.computed(()=>{const a=l.element.options.src||"";return a?a.includes("{")?l.designMode?b.evaluateTemplate(a,b.DEFAULT_DEMO_DATA):b.evaluateTemplate(a,l.data?.[0]||{}):a:""}),n=e.ref(!1);function i(){n.value=!0}e.watch(o,()=>{n.value=!1});const u=e.computed(()=>({objectFit:l.element.options.fit||"contain",...l.element.options.objectPosition?{objectPosition:l.element.options.objectPosition}:{}}));return(a,r)=>(e.openBlock(),e.createElementBlock("div",Ul,[o.value&&!n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value,style:e.normalizeStyle(u.value),onError:i},null,44,Il)):(e.openBlock(),e.createElementBlock("div",Fl,"图片"))]))}}),Hl=ue(Ol,[["__scopeId","data-v-d61bb49e"]]),Wl=["data-fit","data-fit-base","data-fit-min"],Gl=e.defineComponent({__name:"LongTextElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o={top:"flex-start",middle:"center",bottom:"flex-end"},n={left:"flex-start",center:"center",right:"flex-end"},i=e.ref(null),u=e.computed(()=>b.resolveElementTextFit("longText",l.element.options)),a=e.computed(()=>l.element.options.fontSize||12),r=e.computed(()=>b.resolveShrinkMinFontSize(l.element.options.shrinkMinFontSize)),d=e.computed(()=>{const m=l.element.options,f=u.value==="autoHeight";return{fontSize:a.value+"pt",fontWeight:m.fontWeight||"normal",fontFamily:m.fontFamily||"inherit",color:m.color||"#333",backgroundColor:m.backgroundColor||"transparent",textAlign:m.textAlign||"left",...m.textAlign==="justify"?{textAlignLast:"justify"}:{},lineHeight:m.lineHeight?m.lineHeight+"pt":"1.5",letterSpacing:m.letterSpacing?m.letterSpacing+"pt":"normal",textIndent:m.longTextIndent?m.longTextIndent+"em":"0",width:"100%",height:f?"auto":"100%",overflow:f?"visible":"hidden",wordBreak:"break-all",boxSizing:"border-box",...m.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{},...m.verticalAlign?{display:"flex",...m.textAlign==="justify"?{flexDirection:"column",justifyContent:o[m.verticalAlign]??"flex-start"}:{alignItems:o[m.verticalAlign]??"flex-start",justifyContent:n[m.textAlign||"left"]??"flex-start"}}:{}}}),c=e.computed(()=>l.designMode?l.element.options.formatter?l.element.options.formatter:"长文本内容":b.resolveTextBinding(l.element.options,l.data));return Vt(i,()=>[u.value,a.value,r.value,l.element.options.width,l.element.options.height,l.element.options.wordWrap,l.element.options.lineHeight,c.value]),(m,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:i,class:"print-longtext",style:e.normalizeStyle(d.value),"data-fit":u.value==="shrink"?"shrink":void 0,"data-fit-base":String(a.value),"data-fit-min":String(r.value)},e.toDisplayString(c.value),13,Wl))}}),ql=["title"],Kl=["title","onClick"],jl=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(t,{emit:l}){const o=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行"},{value:"summary",label:"汇总行"}],n=l;function i(u,a){n("action",u,a)}return(u,a)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"table-ctx-menu",style:e.normalizeStyle({left:t.x+"px",top:t.y+"px"}),onMousedown:a[8]||(a[8]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:"menu-item",onClick:a[0]||(a[0]=r=>i("insert-row-above"))},"在上方插入行"),e.createElementVNode("div",{class:"menu-item",onClick:a[1]||(a[1]=r=>i("insert-row-below"))},"在下方插入行"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canDeleteRow}]),onClick:a[2]||(a[2]=r=>t.canDeleteRow&&i("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]=r=>i("insert-col-left"))},"在左侧插入列"),e.createElementVNode("div",{class:"menu-item",onClick:a[4]||(a[4]=r=>i("insert-col-right"))},"在右侧插入列"),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canDeleteCol}]),onClick:a[5]||(a[5]=r=>t.canDeleteCol&&i("delete-col"))}," 删除列 ",2),a[10]||(a[10]=e.createElementVNode("div",{class:"menu-divider"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!!t.mergeDisabledReason}]),title:t.mergeDisabledReason||"",onClick:a[6]||(a[6]=r=>!t.mergeDisabledReason&&i("merge"))}," 合并单元格 ",10,ql),e.createElementVNode("div",{class:e.normalizeClass(["menu-item",{disabled:!t.canSplit}]),onClick:a[7]||(a[7]=r=>t.canSplit&&i("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(o,r=>e.createElementVNode("div",{key:r.value,class:e.normalizeClass(["menu-item",{disabled:!!t.rowTypeDisabledReason(r.value),active:t.currentRowType===r.value}]),title:t.rowTypeDisabledReason(r.value)||"",onClick:d=>!t.rowTypeDisabledReason(r.value)&&i("set-row-type",r.value)},e.toDisplayString(r.label),11,Kl)),64))],36)):e.createCommentVNode("",!0)]))}}),Yl=ue(jl,[["__scopeId","data-v-fbbccae0"]]),Xl={class:"cell-barcode"},Zl=["preserveAspectRatio"],Jl=["src"],Ql={key:1,class:"cell-barcode-fallback"},_l=e.defineComponent({__name:"CellBarcode",props:{cellType:{},value:{},barcodeType:{},qrCodeLevel:{},qrQuietZone:{},showText:{type:Boolean},fit:{},maxWidth:{},maxHeight:{},printerDpi:{},targetWidthMm:{},targetHeightMm:{},barWidth:{},barFontSize:{}},setup(t){const l=t,o=e.ref(null),n=e.ref(!1),i=e.ref(""),u=e.ref(null),a={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},r=e.computed(()=>a[l.fit||"contain"]??"xMidYMid meet"),d=e.computed(()=>u.value?{width:u.value.width,height:u.value.height}:{maxWidth:l.maxWidth?`${l.maxWidth}mm`:"100%",maxHeight:l.maxHeight?`${l.maxHeight}mm`:"100%"}),c=e.computed(()=>({width:"100%",height:"100%",objectFit:l.fit||"contain",maxWidth:l.maxWidth?`${l.maxWidth}mm`:"100%",maxHeight:l.maxHeight?`${l.maxHeight}mm`:"100%"}));function m(){if(n.value=!1,u.value=null,!o.value)return;const w=b.barcodeUnitsPerModule(l.barWidth);try{Lt(o.value,l.value,{format:l.barcodeType||"CODE128",width:w,height:b.BARCODE_BAR_HEIGHT_MODULES*w,displayValue:l.showText!==!1,fontSize:(l.barFontSize??b.BARCODE_TEXT_FONT_SIZE_MODULES)*w,margin:0,marginLeft:b.BARCODE_QUIET_ZONE_MODULES*w,marginRight:b.BARCODE_QUIET_ZONE_MODULES*w,marginTop:0,marginBottom:b.BARCODE_MARGIN_BOTTOM_MODULES*w})}catch{return}n.value=!0;const C=f(o.value),N=C?b.resolveBarcodeSize({unitWidth:C.width/w,unitHeight:C.height/w,boxWidthMm:b.barcodeAvailableBoxMm(l.targetWidthMm,l.maxWidth),boxHeightMm:b.barcodeAvailableBoxMm(l.targetHeightMm,l.maxHeight),dpi:l.printerDpi,barWidth:l.barWidth}):null;u.value=N?{width:`${N.widthMm}mm`,height:`${N.heightMm}mm`}:null,o.value.setAttribute("shape-rendering","crispEdges")}function f(w){const C=(w.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return C.length!==4||C.some(N=>!Number.isFinite(N))?null:{width:C[2],height:C[3]}}function g(){if(!l.value){i.value="";return}try{const w=Me.browserCodeRenderer.render(l.value,"qrcode",{qrCodeLevel:String(l.qrCodeLevel||"M"),qrQuietZone:typeof l.qrQuietZone=="number"?l.qrQuietZone:void 0});i.value=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(w)}`}catch{i.value=""}}function p(){l.cellType==="barcode"?m():g()}return e.onMounted(p),e.watch(()=>[l.cellType,l.value,l.barcodeType,l.qrCodeLevel,l.qrQuietZone,l.showText,l.printerDpi,l.targetWidthMm,l.targetHeightMm,l.barWidth,l.barFontSize,l.maxWidth,l.maxHeight],p),(w,C)=>(e.openBlock(),e.createElementBlock("div",Xl,[e.withDirectives((e.openBlock(),e.createElementBlock("svg",{ref_key:"barcodeSvg",ref:o,preserveAspectRatio:r.value,style:e.normalizeStyle(d.value)},null,12,Zl)),[[e.vShow,t.cellType==="barcode"&&n.value]]),t.cellType==="qrcode"&&i.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:i.value,alt:"qrcode",style:e.normalizeStyle(c.value)},null,12,Jl)):e.createCommentVNode("",!0),!n.value&&t.cellType==="barcode"?(e.openBlock(),e.createElementBlock("span",Ql,e.toDisplayString(t.value||"条码"),1)):e.createCommentVNode("",!0)]))}}),ea=ue(_l,[["__scopeId","data-v-f7222c41"]]),ta={class:"cell-image"},oa=["src"],na={key:1,class:"image-placeholder"},la=e.defineComponent({__name:"CellImage",props:{value:{},fit:{},objectPosition:{},maxWidth:{},maxHeight:{},designMode:{type:Boolean},data:{}},setup(t){const l=t,o=e.computed(()=>{const a=l.value||"";return a?a.includes("{")?l.designMode?b.evaluateTemplate(a,b.DEFAULT_DEMO_DATA):b.evaluateTemplate(a,l.data?.[0]||{}):a:""}),n=e.ref(!1);function i(){n.value=!0}e.watch(o,()=>{n.value=!1});const u=e.computed(()=>({objectFit:l.fit||"contain",...l.objectPosition?{objectPosition:l.objectPosition}:{},maxWidth:l.maxWidth?`${l.maxWidth}mm`:"100%",maxHeight:l.maxHeight?`${l.maxHeight}mm`:"100%"}));return(a,r)=>(e.openBlock(),e.createElementBlock("div",ta,[o.value&&!n.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value,style:e.normalizeStyle(u.value),onError:i},null,44,oa)):(e.openBlock(),e.createElementBlock("div",na,"图片"))]))}}),aa=ue(la,[["__scopeId","data-v-0dc74627"]]),ia=["rowspan","colspan","onMousedown","onMouseenter","onDblclick","onContextmenu"],ra=["data-fit","data-fit-base","data-fit-min","data-fit-mm"],sa={key:0,class:"data-placeholder"},da={key:3,class:"data-placeholder"},ca={key:0,class:"col-resize-layer"},ua=["aria-label","onMousedown"],ma={key:1,class:"row-badges"},Ye=3.7795275591,pa=.1,va=e.defineComponent({__name:"TableElement",props:{element:{},designMode:{type:Boolean},isSelected:{type:Boolean},showTableGhostBorder:{type:Boolean},scale:{},data:{}},emits:["dblclick-cell"],setup(t,{emit:l}){const o={header:"题",data:"数",subtotal:"小",summary:"汇"},n=t,i=l,u=e.inject(He,{tableSelection:e.ref(null),setTableSelection:()=>{},recordHistory:()=>{},maxTableWidth:e.ref(1/0)}),a=e.computed(()=>n.element.options.tableRows??[]),r=e.computed(()=>n.element.options.tableColWidths??[]),d=e.computed(()=>n.element.options.tableDefaultFontSize??10),c=e.computed(()=>n.element.options.tableDefaultColor??"#333333"),m=e.computed(()=>{const R=u.tableSelection.value;return R&&R.elementId===n.element.id?R:null});function f(R){let I=0;for(let y=0;y<R;y++)I+=a.value[y].height;return I}const g=e.ref(null),p=e.ref(null),w=e.ref([]);function C(){if(!n.designMode)return;const R=g.value;if(!R)return;const I=R.offsetHeight;if(I<=0)return;const y=n.element.options,V=I/Ye;Math.abs(V-(y.height??0))>pa&&(y.height=Math.round(V*100)/100);const P=R.offsetTop;w.value=Array.from(R.rows).map(ie=>({top:(ie.offsetTop-P)/Ye,height:ie.offsetHeight/Ye}))}function N(R){return w.value[R]?.top??f(R)}function v(R){return w.value[R]?.height??a.value[R]?.height??0}e.watch(()=>[n.element.options,n.designMode],()=>C(),{deep:!0,flush:"post"}),e.onMounted(()=>{C(),document.fonts?.ready.then(()=>C())});const $=e.computed(()=>{const R=n.element.options.dataSource;if(R&&Array.isArray(b.DEFAULT_DEMO_DATA[R]))return b.DEFAULT_DEMO_DATA[R];for(const I of Object.values(b.DEFAULT_DEMO_DATA))if(Array.isArray(I))return I}),W=e.computed(()=>{if(n.data)return n.data});function te(R){return R.cellType==="barcode"||R.cellType==="qrcode"}function J(R,I){return te(I)?b.resolveBarcodeDesignValue(I.formatter,$.value):I.formatter||""}function L(R,I){const y=n.element.options,V={designMode:n.designMode,showGhostBorder:n.showTableGhostBorder};return{fontFamily:I.fontFamily||"inherit",textAlign:I.align??"left",...I.align==="justify"?{textAlignLast:"justify"}:{},verticalAlign:I.valign??"middle",fontSize:(I.fontSize??d.value)+"pt",fontWeight:I.fontWeight??"normal",color:I.color??c.value,backgroundColor:I.backgroundColor??"transparent",borderTop:b.resolveCellBorderCss(I.borders?.top,V),borderRight:b.resolveCellBorderCss(I.borders?.right,V),borderBottom:b.resolveCellBorderCss(I.borders?.bottom,V),borderLeft:b.resolveCellBorderCss(I.borders?.left,V),padding:(I.padding??y.tableDefaultPadding??1)+"mm",whiteSpace:I.wordWrap??!0?"normal":"nowrap",overflow:I.wordWrap??!0?"visible":"hidden"}}function E(R){return b.resolveCellTextFit(R)}function O(R){return E(R)!=="autoHeight"}function Y(R){return R.fontSize??d.value}function z(R,I){return b.cellFitCapMm(a.value,R,I,n.element.options.tableDefaultPadding??1)}function h(R,I){return b.cellFitWidthMm(r.value,R,I,n.element.options.tableDefaultPadding??1)}function A(R,I){return{maxHeight:z(I,R)+"mm",overflow:"hidden",...R.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{}}}Vt(p,()=>[n.designMode,n.data?.length,r.value.join(","),d.value,n.element.options.tableDefaultPadding,a.value.map(R=>`${R.height}:${R.cells.map(I=>`${I.formatter??""}|${I.fontSize??""}|${I.wordWrap??""}|${I.textFit??""}|${I.colspan??1}`).join("~")}`).join(",")]);function k(R,I){const y=m.value;return{"cell-selected":!!y&&R>=y.r1&&R<=y.r2&&I>=y.c1&&I<=y.c2,"row-data-bg":a.value[R].type==="data"}}const H=e.ref(null);function G(R,I){const y=b.normalizeSelection(a.value,R,I);u.setTableSelection({elementId:n.element.id,...y})}function q(R,I,y){!n.designMode||!n.isSelected||(y.stopPropagation(),y.shiftKey&&m.value?G({r:m.value.r1,c:m.value.c1},{r:R,c:I}):(H.value={r:R,c:I},G({r:R,c:I},{r:R,c:I})),window.addEventListener("mouseup",()=>{H.value=null},{once:!0}))}function _(R,I){H.value&&G(H.value,{r:R,c:I})}function B(R,I){n.designMode&&i("dblclick-cell",n.element.id,R,I)}const s=e.reactive({visible:!1,x:0,y:0}),x=e.inject(Je,null);function ee(R,I,y){if(!n.designMode)return;!n.isSelected&&x&&(x.value=new Set([n.element.id]));const V=m.value;V&&R>=V.r1&&R<=V.r2&&I>=V.c1&&I<=V.c2||G({r:R,c:I},{r:R,c:I}),s.x=y.clientX,s.y=y.clientY,s.visible=!0,window.removeEventListener("mouseup",he),window.addEventListener("mouseup",he)}function he(R){R.target?.closest?.(".table-ctx-menu")||(s.visible=!1,window.removeEventListener("mouseup",he))}const ge=e.computed(()=>{const R=m.value;return R?b.canMergeReason(a.value,R):"未选择单元格"}),se=e.computed(()=>{const R=m.value;if(!R)return!1;for(let I=R.r1;I<=R.r2;I++)for(let y=R.c1;y<=R.c2;y++){const V=a.value[I].cells[y];if(!V.merged&&((V.rowspan??1)>1||(V.colspan??1)>1))return!0}return!1});function K(R){const I=m.value;if(!I)return"未选择单元格";if(I.r1!==I.r2)return"行类型仅支持单行设置";const y=JSON.parse(JSON.stringify(a.value));return b.setRowType(y,I.r1,R)}function S(){b.syncTableElementSize(n.element.options)}function T(R,I){const y=u.maxTableWidth.value,V=R.reduce((P,ie)=>P+ie,0)+R[I];return V>y?`插入后表格总宽 ${Math.round(V*10)/10}mm 超过打印范围宽度 ${y}mm,请先缩小列宽`:null}function j(R,I){const y=m.value;if(!y)return;s.visible=!1;const V=n.element.options,P=V.tableRows,ie=V.tableColWidths;let pe=null;switch(R){case"insert-row-above":b.insertRow(P,y.r1,"above");break;case"insert-row-below":b.insertRow(P,y.r2,"below");break;case"delete-row":pe=b.deleteRow(P,y.r1);break;case"insert-col-left":pe=T(ie,y.c1),pe||b.insertCol(P,ie,y.c1,"left");break;case"insert-col-right":pe=T(ie,y.c2),pe||b.insertCol(P,ie,y.c2,"right");break;case"delete-col":pe=b.deleteCol(P,ie,y.c1);break;case"merge":b.mergeCells(P,y);break;case"split":b.splitCells(P,y);break;case"set-row-type":pe=b.setRowType(P,y.r1,I);break}if(pe){alert(pe);return}u.setTableSelection(null),S(),u.recordHistory()}const Z=e.computed(()=>n.designMode&&!!n.isSelected&&!n.element.options.locked&&r.value.length>=1),ne=e.computed(()=>Array.from({length:r.value.length},(R,I)=>I+1));function ve(R){return r.value.slice(0,R).reduce((I,y)=>I+y,0)}const M=e.ref(null);let D=0,U=0;function oe(R,I){Z.value&&I.button===0&&(M.value=R,D=I.clientX,U=r.value[R-1],document.addEventListener("mousemove",le),document.addEventListener("mouseup",me))}function le(R){if(M.value===null)return;const I=n.scale||1,y=(R.clientX-D)/(I*Ye),V=M.value-1,P=n.element.options.tableColWidths;P[V]=b.clampResizedColumnWidth(P,V,U+y,u.maxTableWidth.value),S()}function me(){document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",me),M.value!==null&&(M.value=null,S(),u.recordHistory())}return e.onUnmounted(()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",me)}),(R,I)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:p,class:e.normalizeClass(["print-table",{"design-mode":t.designMode}]),onContextmenu:I[0]||(I[0]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("table",{ref_key:"tableRef",ref:g,style:e.normalizeStyle({fontSize:d.value+"pt",color:c.value})},[e.createElementVNode("colgroup",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.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,(P,ie)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:P.id},[P.merged?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:P.rowspan||1,colspan:P.colspan||1,class:e.normalizeClass(k(V,ie)),style:e.normalizeStyle(L(y,P)),onMousedown:e.withModifiers(pe=>q(V,ie,pe),["left"]),onMouseenter:pe=>_(V,ie),onDblclick:e.withModifiers(pe=>B(V,ie),["stop"]),onContextmenu:e.withModifiers(pe=>ee(V,ie,pe),["prevent","stop"])},[te(P)?(e.openBlock(),e.createBlock(ea,{key:0,"cell-type":P.cellType,value:J(y,P),"barcode-type":P.barcodeType,"qr-code-level":P.qrCodeLevel,"qr-quiet-zone":P.qrQuietZone,"show-text":P.showBarcodeText!==!1,fit:P.fit,"max-width":P.maxWidth,"max-height":P.maxHeight,"printer-dpi":P.printerDpi,"target-width-mm":h(ie,P),"target-height-mm":z(V,P),"bar-width":P.barWidth,"bar-font-size":P.barFontSize},null,8,["cell-type","value","barcode-type","qr-code-level","qr-quiet-zone","show-text","fit","max-width","max-height","printer-dpi","target-width-mm","target-height-mm","bar-width","bar-font-size"])):P.cellType==="image"?(e.openBlock(),e.createBlock(aa,{key:1,value:P.formatter||"",fit:P.fit,"object-position":P.objectPosition,"max-width":P.maxWidth,"max-height":P.maxHeight,"design-mode":t.designMode,data:W.value},null,8,["value","fit","object-position","max-width","max-height","design-mode","data"])):O(P)?(e.openBlock(),e.createElementBlock("div",{key:2,class:"cell-fit",style:e.normalizeStyle(A(P,V)),"data-fit":E(P)==="shrink"?"shrink":void 0,"data-fit-base":String(Y(P)),"data-fit-min":String(e.unref(b.resolveShrinkMinFontSize)(P.shrinkMinFontSize)),"data-fit-mm":z(V,P)},[y.type==="data"?(e.openBlock(),e.createElementBlock("span",sa,e.toDisplayString(J(y,P)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(J(y,P)),1)],64))],12,ra)):y.type==="data"?(e.openBlock(),e.createElementBlock("span",da,e.toDisplayString(J(y,P)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createTextVNode(e.toDisplayString(J(y,P)),1)],64))],46,ia))],64))),128))],4))),128))])],4),Z.value?(e.openBlock(),e.createElementBlock("div",ca,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ne.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y,class:e.normalizeClass(["col-resize-handle",{dragging:M.value===y}]),role:"separator","aria-label":"列宽手柄"+y,style:e.normalizeStyle({left:ve(y)+"mm"}),onMousedown:e.withModifiers(V=>oe(y,V),["stop","prevent"])},null,46,ua))),128))])):e.createCommentVNode("",!0),t.designMode&&t.isSelected?(e.openBlock(),e.createElementBlock("div",ma,[(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:N(V)+"mm",height:v(V)+"mm"})},e.toDisplayString(o[y.type]),5))),128))])):e.createCommentVNode("",!0),e.createVNode(Yl,{visible:s.visible,x:s.x,y:s.y,"can-delete-row":a.value.length>1,"can-delete-col":r.value.length>1,"merge-disabled-reason":ge.value,"can-split":se.value,"current-row-type":m.value?a.value[m.value.r1]?.type??null:null,"row-type-disabled-reason":K,onAction:j},null,8,["visible","x","y","can-delete-row","can-delete-col","merge-disabled-reason","can-split","current-row-type"])],34))}}),fa=ue(va,[["__scopeId","data-v-f99767ff"]]),Dt=e.defineComponent({__name:"LineElement",props:{element:{}},setup(t){const l=t,o=e.computed(()=>l.element.printElementType.type==="hline"),n=e.computed(()=>{const i=l.element.options,u=(i.borderWidth||.75)+"pt",a=i.borderStyle||"solid",r=i.borderColor||"#333";return o.value?{width:"100%",height:"0",borderTop:`${u} ${a} ${r}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${u} ${a} ${r}`,boxSizing:"border-box"}});return(i,u)=>(e.openBlock(),e.createElementBlock("div",{class:"print-line",style:e.normalizeStyle(n.value)},null,4))}}),Tt=e.defineComponent({__name:"ShapeElement",props:{element:{}},setup(t){const l=t,o=e.computed(()=>l.element.printElementType.type==="oval"),n=e.computed(()=>{const i=l.element.options;return{width:"100%",height:"100%",borderWidth:(i.borderWidth||1)+"pt",borderStyle:i.borderStyle||"solid",borderColor:i.borderColor||"#333",backgroundColor:i.backgroundColor||"transparent",borderRadius:o.value?"50%":"0",boxSizing:"border-box"}});return(i,u)=>(e.openBlock(),e.createElementBlock("div",{class:"print-shape",style:e.normalizeStyle(n.value)},null,4))}}),ga={class:"print-barcode",ref:"containerRef"},ha=["preserveAspectRatio"],ba=e.defineComponent({__name:"BarcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o=e.ref(null),n=e.ref(null),i={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"},u=e.computed(()=>i[l.element.options.fit||"contain"]??"xMidYMid meet"),a=e.computed(()=>n.value?{width:n.value.width,height:n.value.height}:{maxWidth:"100%",maxHeight:"100%"});function r(){if(!o.value)return;const c=l.element.options,m=(l.designMode?c.testData||c.formatter:b.resolveTextBinding(c,l.data))||"条码",f=b.barcodeUnitsPerModule(c.barWidth);try{Lt(o.value,m,{format:c.barcodeType||"CODE128",width:f,height:b.BARCODE_BAR_HEIGHT_MODULES*f,displayValue:!c.hideTitle,fontSize:(c.fontSize??b.BARCODE_TEXT_FONT_SIZE_MODULES)*f,margin:0,marginLeft:b.BARCODE_QUIET_ZONE_MODULES*f,marginRight:b.BARCODE_QUIET_ZONE_MODULES*f,marginTop:0,marginBottom:b.BARCODE_MARGIN_BOTTOM_MODULES*f})}catch{n.value=null;return}const g=d(o.value),p=g?b.resolveBarcodeSize({unitWidth:g.width/f,unitHeight:g.height/f,boxWidthMm:b.barcodeAvailableBoxMm(c.width,c.maxWidth),boxHeightMm:b.barcodeAvailableBoxMm(c.height,c.maxHeight),dpi:c.printerDpi,barWidth:c.barWidth}):null;n.value=p?{width:`${p.widthMm}mm`,height:`${p.heightMm}mm`}:null,o.value.setAttribute("shape-rendering","crispEdges")}function d(c){const m=(c.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return m.length!==4||m.some(f=>!Number.isFinite(f))?null:{width:m[2],height:m[3]}}return e.onMounted(r),e.watch(()=>[l.element.options.formatter,l.element.options.testData,l.element.options.barcodeType,l.element.options.width,l.element.options.height,l.element.options.barWidth,l.element.options.printerDpi,l.element.options.hideTitle,l.element.options.fontSize,l.element.options.maxWidth,l.element.options.maxHeight],r),(c,m)=>(e.openBlock(),e.createElementBlock("div",ga,[(e.openBlock(),e.createElementBlock("svg",{ref_key:"svgRef",ref:o,preserveAspectRatio:u.value,style:e.normalizeStyle(a.value)},null,12,ha))],512))}}),Ea=ue(ba,[["__scopeId","data-v-6eb95a40"]]),ya={class:"print-qrcode"},ka=["src"],Va=e.defineComponent({__name:"QrcodeElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o=e.ref(""),n=e.computed(()=>{const u=l.element.options;return{width:"100%",height:"100%",objectFit:u.fit||"contain",maxWidth:u.maxWidth?`${u.maxWidth}mm`:"100%",maxHeight:u.maxHeight?`${u.maxHeight}mm`:"100%"}});function i(){const u=l.element.options,a=(l.designMode?u.testData||u.formatter:b.resolveTextBinding(u,l.data))||"二维码";try{const r=Me.browserCodeRenderer.render(a,"qrcode",{qrCodeLevel:String(u.qrCodeLevel??"M"),qrQuietZone:typeof u.qrQuietZone=="number"?u.qrQuietZone:void 0});o.value=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(r)}`}catch{o.value=""}}return e.onMounted(i),e.watch(()=>[l.element.options.formatter,l.element.options.testData,l.element.options.qrCodeLevel,l.element.options.qrQuietZone],i),(u,a)=>(e.openBlock(),e.createElementBlock("div",ya,[o.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value,alt:"qrcode",style:e.normalizeStyle(n.value)},null,12,ka)):e.createCommentVNode("",!0)]))}}),Na=ue(Va,[["__scopeId","data-v-792ee33c"]]),wa=["innerHTML"],Ca=e.defineComponent({__name:"HtmlElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o=e.computed(()=>{if(l.element.options.formatter){const n=l.data&&l.data.length>0?l.data[0]:{},i=b.evaluateTemplate(l.element.options.formatter,n??{});return i?Yt.sanitize(i):""}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,i)=>(e.openBlock(),e.createElementBlock("div",{class:"print-html",innerHTML:o.value},null,8,wa))}}),Sa=ue(Ca,[["__scopeId","data-v-880bbde5"]]),xa=e.defineComponent({__name:"PageNumberElement",props:{element:{},data:{},designMode:{type:Boolean}},setup(t){const l=t,o=e.computed(()=>{const i=l.element.options;return{fontSize:(i.fontSize||12)+"pt",fontWeight:i.fontWeight||"normal",fontFamily:i.fontFamily||"inherit",color:i.color||"#333",textAlign:i.textAlign||"left",...i.textAlign==="justify"?{textAlignLast:"justify"}:{},lineHeight:i.lineHeight?i.lineHeight+"pt":"normal",letterSpacing:i.letterSpacing?i.letterSpacing+"pt":"normal"}}),n=e.computed(()=>l.designMode?l.element.options.title||"{pageIndex}/{totalPages}":l.element.options.title||"");return(i,u)=>(e.openBlock(),e.createElementBlock("div",{class:"page-number-element",style:e.normalizeStyle(o.value)},e.toDisplayString(n.value),5))}}),Ba=ue(xa,[["__scopeId","data-v-9762b52f"]]),$a={key:0,class:"drag-preview"},Da={key:1,class:"resize-handles"},Ta=["onMousedown"],Ma={key:2,class:"selected-indicator"},za={class:"position-label"},Aa=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(t,{emit:l}){const o=t,n=l,i=e.ref(null),u=e.inject(Je,null),a=e.computed(()=>u?.value?u.value.has(o.element.id):o.isSelected??!1),r=e.inject(Ut,null),d=e.computed(()=>r?.value.has(o.element.id)??!1),c={text:e.markRaw(Ll),image:e.markRaw(Hl),longText:e.markRaw(Gl),table:e.markRaw(fa),hline:e.markRaw(Dt),vline:e.markRaw(Dt),rect:e.markRaw(Tt),oval:e.markRaw(Tt),barcode:e.markRaw(Ea),qrcode:e.markRaw(Na),html:e.markRaw(Sa),pageNumber:e.markRaw(Ba)},m=e.computed(()=>c[o.element.printElementType.type]),f=e.computed(()=>o.element.printElementType.type==="table"?{showTableGhostBorder:o.showTableGhostBorder,scale:o.scale}:{}),g=e.computed(()=>{const h=o.element.options,A=b.resolveElementBorder(o.element.printElementType.type,h),k={};if(A?.all&&(k.border=`${A.all.borderWidth} ${A.all.borderStyle} ${A.all.borderColor}`),A)for(const H of b.ELEMENT_BORDER_SIDES){const G=A.edges[H];G&&(k[`border${H.charAt(0).toUpperCase()}${H.slice(1)}`]=`${G.borderWidth} ${G.borderStyle} ${G.borderColor}`)}return{position:"absolute",left:h.left+"mm",top:h.top+"mm",width:h.width+"mm",height:h.height+"mm",zIndex:h.zIndex||"auto",...k}}),p=e.computed(()=>{const h=o.element.options;return`x:${Math.round(h.left)} y:${Math.round(h.top)} ${Math.round(h.width)}×${Math.round(h.height)}mm`});let w=0,C=0;const N=e.reactive({disabled:!o.designMode||!!o.element.options.locked,getScale:()=>(o.scale||1)*b.mmToPx(1),onDrag:h=>{const A=h.left-w,k=h.top-C;i.value&&(i.value.style.transform=`translate(${A}mm, ${k}mm)`)},onDragEnd:(h,A)=>{if(A.altKey){const G=JSON.parse(JSON.stringify(o.element));G.id=b.generateId(),G.options.left=h.left,G.options.top=h.top,G.options.groupId=void 0,n("clone-element",G,{left:h.left,top:h.top}),i.value&&(i.value.style.transform="");return}const k=h.left-w,H=h.top-C;if(o.element.options.left=h.left,o.element.options.top=h.top,i.value&&(i.value.style.transform=""),o.element.options.groupId&&o.allElements)for(const G of o.allElements)G.id!==o.element.id&&G.options.groupId===o.element.options.groupId&&(G.options.left+=k,G.options.top+=H)},onStart:()=>{w=o.element.options.left,C=o.element.options.top,n("drag-start")},onStop:()=>{o.clearAdsorbGuides?.(),n("drag-stop")},onAdsorb:h=>{let A=h.left,k=h.top;return o.snapToGrid&&(A=Math.round(h.left/5)*5,k=Math.round(h.top/5)*5),o.adsorbHandler?o.adsorbHandler({id:o.element.id,left:A,top:k,width:o.element.options.width,height:o.element.options.height}):{left:A,top:k,lines:[]}}}),{setup:v,cleanup:$,isDragging:W}=zl(i,N);e.watchEffect(()=>{N.disabled=!o.designMode||!!o.element.options.locked});const te=e.computed(()=>a.value&&!!o.designMode&&!o.element.options.locked&&o.element.printElementType.type!=="table"),{startResize:J,cleanup:L}=b.useResize({minWidth:3.5,minHeight:3.5,getScale:()=>(o.scale||1)*b.mmToPx(1),getRect:()=>({left:o.element.options.left,top:o.element.options.top,width:o.element.options.width,height:o.element.options.height}),onResize:h=>{o.element.options.left=h.left,o.element.options.top=h.top,o.element.options.width=h.width,o.element.options.height=h.height},onStart:()=>{n("drag-start")},onStop:()=>{n("drag-stop")}});function E(h){o.designMode&&h.button===0&&n("select",o.element.id,h.ctrlKey||h.metaKey)}function O(){o.designMode&&n("dblclick-element",o.element.id)}function Y(h,A,k){o.designMode&&n("dblclick-cell",h,A,k)}e.onMounted(()=>{o.designMode&&v()});function z(){$(),L(),o.clearAdsorbGuides?.()}return e.onUnmounted(()=>{z()}),(h,A)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:i,class:e.normalizeClass(["print-element",{selected:a.value,previewed:d.value,"design-mode":t.designMode,locked:t.element.options.locked,hidden:t.element.options.visible===!1,"drag-ghost":e.unref(W),[`type-${t.element.printElementType.type}`]:!0,[`zone-${t.zone||"content"}`]:!0}]),style:e.normalizeStyle(g.value),onMousedown:e.withModifiers(E,["stop"]),onDblclick:e.withModifiers(O,["stop"]),onContextmenu:A[0]||(A[0]=e.withModifiers(k=>h.$emit("contextmenu",t.element.id,k),["prevent","stop"]))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.value),e.mergeProps({element:t.element,data:t.printData,"design-mode":t.designMode,"is-selected":a.value},f.value,{onDblclickCell:Y}),null,16,["element","data","design-mode","is-selected"])),e.unref(W)?(e.openBlock(),e.createElementBlock("div",$a)):e.createCommentVNode("",!0),te.value?(e.openBlock(),e.createElementBlock("div",Da,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b.RESIZE_POINTS),k=>(e.openBlock(),e.createElementBlock("div",{key:k,class:e.normalizeClass(["resize-handle",`handle-${k}`]),onMousedown:e.withModifiers(H=>e.unref(J)(k,H),["stop"])},null,42,Ta))),128))])):e.createCommentVNode("",!0),a.value&&t.designMode?(e.openBlock(),e.createElementBlock("div",Ma,[e.createElementVNode("div",za,e.toDisplayString(p.value),1)])):e.createCommentVNode("",!0)],38))}}),ut=ue(Aa,[["__scopeId","data-v-5a7482f4"]]);function Pa(t={}){const l=e.ref([]),o=e.ref({width:0,height:0});function n(a,r,d){return b.computeAdsorb(a,r,d,t)}function i(a,r,d){l.value=a,o.value={width:r,height:d}}function u(){l.value=[]}return{check:n,renderLines:i,clearLines:u,guideLines:l,paperSize:o}}function Ra(t){const{check:l,renderLines:o,clearLines:n,guideLines:i,paperSize:u}=Pa(t.config??{adsorbMin:1,adsorbLineMin:2,showAdsorbLine:!0});function a(d){const c=t.getElements().filter(g=>g.id!==d.id).map(g=>({id:g.id,left:g.options.left,top:g.options.top,width:g.options.width,height:g.options.height})),m=l(d,c,t.getGuides?.()),f=t.getPaperSize();return o(m.lines,f.width,f.height),m}function r(){n()}return{requestAdsorb:a,clearGuides:r,guideLines:i,paperSize:u}}const La=["src"],Ua=["width","height","viewBox"],Ia=["x","y","font-size","fill","transform"],Fa={key:0,class:"zone-label"},Oa={key:0,class:"zone-height-tip"},Ha={key:0,class:"zone-label"},Wa={key:0,class:"zone-height-tip"},Ga=["onMousedown","onDblclick"],qa=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(t,{expose:l,emit:o}){const n=t,i=o,u=e.ref(null),a=e.computed(()=>b.getPaperDimensions(n.templateData).width),r=e.computed(()=>b.getPaperDimensions(n.templateData).height),d=e.computed(()=>n.templateData.designBackground),c=e.ref(!1);e.watch(()=>d.value?.src,()=>{c.value=!1});const m=e.computed(()=>{const S=d.value?.rotation;return S===90||S===180||S===270?S:0}),f=e.computed(()=>{const S=m.value,T=S===90||S===270,j=T?r.value:a.value,Z=T?a.value:r.value,ne={width:j+"mm",height:Z+"mm",left:(a.value-j)/2+"mm",top:(r.value-Z)/2+"mm"};return S!==0&&(ne.transform=`rotate(${S}deg)`),ne});function g(){c.value=!0,console.warn("[print-designer] 设计背景图加载失败:",d.value?.src)}const p=e.computed(()=>`${8/(n.scale||1)}px`),w=e.computed(()=>{const S=n.scale||1,T=b.mmToPx(a.value)*S,j=b.mmToPx(r.value)*S;return{width:T+"px",height:j+"px",position:"relative"}}),C=e.computed(()=>{const S=n.templateData.margins,T=n.templateData.header.height,j=n.templateData.footer.height,Z=a.value-S.left-S.right;return{header:{left:S.left,top:S.top,width:Z,height:T},content:{left:S.left,top:S.top+T,width:Z,height:r.value-S.top-S.bottom-T-j},footer:{left:S.left,top:r.value-S.bottom-j,width:Z,height:j}}});function N(S){return{position:"absolute",left:S.left+"mm",top:S.top+"mm",width:S.width+"mm",height:S.height+"mm"}}const v=e.computed(()=>{const S={header:[],footer:[],content:[]};for(const T of n.runtimeElements)T.zone==="header"?S.header.push(T):T.zone==="footer"?S.footer.push(T):S.content.push(T);return S}),$=e.computed(()=>v.value.header),W=e.computed(()=>v.value.footer),te=e.computed(()=>v.value.content);let J="content";const{requestAdsorb:L,clearGuides:E,guideLines:O,paperSize:Y}=Ra({getElements:()=>v.value[J],getPaperSize:()=>{const S=C.value[J];return{width:S.width,height:S.height}},getGuides:()=>{const S=[],T=[];for(const j of n.guides??[])j.type==="vertical"?S.push(j.position):T.push(j.position);return{vertical:S,horizontal:T}}});function z(S){J=n.runtimeElements.find(Z=>Z.id===S.id)?.zone||"content";const j=L(S);return(j.left!==S.left||j.top!==S.top)&&B(j.left+S.width/2,j.top+S.height/2),j}function h(S,T){if(S.button!==0)return;const j=T.position,Z=S.clientX,ne=S.clientY,ve=n.scale??1,M=25.4/96,D=oe=>{const le=(T.type==="vertical"?oe.clientX-Z:oe.clientY-ne)/ve*M,me=T.type==="vertical"?a.value:r.value,R=Math.min(Math.max(j+le,0),me);i("guide-move",T.id,R)},U=()=>{window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",U)};window.addEventListener("mousemove",D),window.addEventListener("mouseup",U)}const A=e.computed(()=>({width:a.value+"mm",minHeight:r.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"})),k=e.computed(()=>{const S=n.templateData.margins;return{padding:`${S.top}mm ${S.right}mm ${S.bottom}mm ${S.left}mm`,position:"relative",boxSizing:"border-box",minHeight:r.value+"mm"}}),H=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 G=0,q=null;const _=e.ref(null);function B(S,T){G+=1,_.value={left:S,top:T,key:G},q&&clearTimeout(q),q=setTimeout(()=>{_.value=null},300)}const s=e.computed(()=>be.resolveWatermarkLayout(n.templateData.watermark,n.printData,{width:a.value,height:r.value})),x=e.ref(null);function ee(S,T){T.button===0&&(se(),x.value={zone:S,startY:T.clientY,startH:n.templateData[S].height},window.addEventListener("mousemove",he),window.addEventListener("mouseup",ge))}function he(S){if(!x.value)return;const{zone:T,startY:j,startH:Z}=x.value,ve=(S.clientY-j)/(n.scale||1)*25.4/96,M=T==="header"?ve:-ve,D=Math.min(100,r.value-n.templateData.margins.top-n.templateData.margins.bottom-(T==="header"?n.templateData.footer.height:n.templateData.header.height)-10),U=Math.min(D,Math.max(0,Math.round((Z+M)*10)/10));i("zone-height-change",T,U)}function ge(){if(!x.value)return;const S=x.value.zone;x.value=null,window.removeEventListener("mousemove",he),window.removeEventListener("mouseup",ge),i("zone-height-commit",S)}function se(){window.removeEventListener("mousemove",he),window.removeEventListener("mouseup",ge),x.value=null}e.onUnmounted(()=>{se(),q&&clearTimeout(q)});function K(S,T){i("select",S,T)}return l({contentRef:u}),(S,T)=>(e.openBlock(),e.createElementBlock("div",{class:"paper-wrapper",style:e.normalizeStyle(w.value)},[e.createElementVNode("div",{class:"hiprint-printPaper",style:e.normalizeStyle(A.value)},[t.designMode&&d.value?.src&&!c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"design-background",style:e.normalizeStyle(f.value)},[e.createElementVNode("img",{src:d.value.src,draggable:"false",alt:"",onError:g},null,40,La)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"hiprint-printPaper-content",ref_key:"contentRef",ref:u,style:e.normalizeStyle(k.value)},[t.showGrid&&t.designMode?(e.openBlock(),e.createElementBlock("div",{key:0,class:"grid-bg",style:e.normalizeStyle(H.value)},null,4)):e.createCommentVNode("",!0),_.value?(e.openBlock(),e.createElementBlock("div",{key:_.value.key,class:"snap-indicator",style:e.normalizeStyle({left:_.value.left+"mm",top:_.value.top+"mm"})},null,4)):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:"watermark-layer",style:e.normalizeStyle({opacity:String(s.value.opacity)})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value.tiles,(j,Z)=>(e.openBlock(),e.createElementBlock("svg",{key:Z,class:"watermark-tile",width:j.widthMm+"mm",height:j.heightMm+"mm",viewBox:`0 0 ${s.value.tileWidthPx} ${s.value.tileHeightPx}`,style:e.normalizeStyle({left:j.leftMm+"mm",top:j.topMm+"mm"}),xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("text",{x:s.value.tileWidthPx/2,y:s.value.tileHeightPx/2,"font-size":s.value.fontSizePx,fill:s.value.color,"text-anchor":"middle","dominant-baseline":"middle",transform:`rotate(${s.value.rotate},${s.value.tileWidthPx/2},${s.value.tileHeightPx/2})`},e.toDisplayString(s.value.text),9,Ia)],12,Ua))),128))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["zone-layer zone-header",{"design-mode":t.designMode}]),style:e.normalizeStyle(N(C.value.header))},[t.designMode?(e.openBlock(),e.createElementBlock("span",Fa,"页眉")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,j=>(e.openBlock(),e.createBlock(ut,{key:j.id,element:j,"design-mode":t.designMode,"print-data":t.printData,scale:t.scale,"all-elements":$.value,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,zone:"header","adsorb-handler":z,"clear-adsorb-guides":e.unref(E),onSelect:K,onDragStart:T[0]||(T[0]=Z=>S.$emit("drag-start")),onDragStop:T[1]||(T[1]=Z=>S.$emit("drag-stop")),onDblclickElement:T[2]||(T[2]=Z=>S.$emit("dblclick-element",Z)),onDblclickCell:T[3]||(T[3]=(Z,ne,ve)=>S.$emit("dblclick-cell",Z,ne,ve)),onContextmenu:T[4]||(T[4]=(Z,ne)=>S.$emit("contextmenu",Z,ne)),onCloneElement:(Z,ne)=>S.$emit("clone-element",Z,ne)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),t.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-bottom",onMousedown:T[5]||(T[5]=e.withModifiers(j=>ee("header",j),["prevent","stop"]))},[x.value?.zone==="header"?(e.openBlock(),e.createElementBlock("div",Oa,e.toDisplayString(t.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":t.designMode}]),style:e.normalizeStyle(N(C.value.content))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(te.value,j=>(e.openBlock(),e.createBlock(ut,{key:j.id,element:j,"design-mode":t.designMode,"print-data":t.printData,scale:t.scale,"all-elements":te.value,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,zone:"content","adsorb-handler":z,"clear-adsorb-guides":e.unref(E),onSelect:K,onDragStart:T[6]||(T[6]=Z=>S.$emit("drag-start")),onDragStop:T[7]||(T[7]=Z=>S.$emit("drag-stop")),onDblclickElement:T[8]||(T[8]=Z=>S.$emit("dblclick-element",Z)),onDblclickCell:T[9]||(T[9]=(Z,ne,ve)=>S.$emit("dblclick-cell",Z,ne,ve)),onContextmenu:T[10]||(T[10]=(Z,ne)=>S.$emit("contextmenu",Z,ne)),onCloneElement:(Z,ne)=>S.$emit("clone-element",Z,ne)},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":t.designMode}]),style:e.normalizeStyle(N(C.value.footer))},[t.designMode?(e.openBlock(),e.createElementBlock("span",Ha,"页脚")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(W.value,j=>(e.openBlock(),e.createBlock(ut,{key:j.id,element:j,"design-mode":t.designMode,"print-data":t.printData,scale:t.scale,"all-elements":W.value,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,zone:"footer","adsorb-handler":z,"clear-adsorb-guides":e.unref(E),onSelect:K,onDragStart:T[11]||(T[11]=Z=>S.$emit("drag-start")),onDragStop:T[12]||(T[12]=Z=>S.$emit("drag-stop")),onDblclickElement:T[13]||(T[13]=Z=>S.$emit("dblclick-element",Z)),onDblclickCell:T[14]||(T[14]=(Z,ne,ve)=>S.$emit("dblclick-cell",Z,ne,ve)),onContextmenu:T[15]||(T[15]=(Z,ne)=>S.$emit("contextmenu",Z,ne)),onCloneElement:(Z,ne)=>S.$emit("clone-element",Z,ne)},null,8,["element","design-mode","print-data","scale","all-elements","snap-to-grid","show-table-ghost-border","clear-adsorb-guides","onCloneElement"]))),128)),t.designMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:"zone-resize-handle handle-top",onMousedown:T[16]||(T[16]=e.withModifiers(j=>ee("footer",j),["prevent","stop"]))},[x.value?.zone==="footer"?(e.openBlock(),e.createElementBlock("div",Wa,e.toDisplayString(t.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(O),(j,Z)=>(e.openBlock(),e.createElementBlock("div",{key:Z,class:e.normalizeClass(["adsorb-guide",[`guide-${j.type}`]]),style:e.normalizeStyle(j.type==="vertical"?{left:j.position+"mm",top:"0",height:e.unref(Y).height+"mm",borderLeftColor:j.color||"var(--pd-accent-secondary, #f56c6c)"}:{top:j.position+"mm",left:"0",width:e.unref(Y).width+"mm",borderTopColor:j.color||"var(--pd-accent-secondary, #f56c6c)"})},null,6))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.guides,j=>(e.openBlock(),e.createElementBlock("div",{key:"mg-"+j.id,class:e.normalizeClass(["manual-guide",[`guide-${j.type}`]]),style:e.normalizeStyle(j.type==="vertical"?{left:j.position+"mm",top:"0",height:r.value+"mm","--guide-hit":p.value}:{top:j.position+"mm",left:"0",width:a.value+"mm","--guide-hit":p.value}),onMousedown:e.withModifiers(Z=>h(Z,j),["prevent","stop"]),onDblclick:e.withModifiers(Z=>j.id&&i("guide-remove",j.id),["prevent","stop"])},null,46,Ga))),128))],4)],4)],4))}}),Ka=ue(qa,[["__scopeId","data-v-4682b43a"]]),ja=e.defineComponent({__name:"Ruler",props:{orientation:{},viewportPx:{},originPx:{},paperLengthMM:{},scale:{},cursorPx:{}},emits:["add-guide","guide-dragging"],setup(t,{emit:l}){const o=t,n=l,i=e.computed(()=>o.orientation==="horizontal"),u=e.computed(()=>i.value?"vertical":"horizontal"),a=e.ref(null),r=e.ref(null),d=e.computed(()=>r.value??o.cursorPx??null),c=e.computed(()=>i.value?{width:o.viewportPx+"px",height:b.RULER_THICKNESS+"px"}:{width:b.RULER_THICKNESS+"px",height:o.viewportPx+"px"});let m=0;function f(){m||(m=requestAnimationFrame(()=>{m=0,g()}))}function g(){const E=a.value;if(!E)return;const O=E.getContext("2d");if(!O)return;const Y=window.devicePixelRatio||1,z=Math.max(0,Math.round(o.viewportPx)),h=b.RULER_THICKNESS;E.width=(i.value?z:h)*Y,E.height=(i.value?h:z)*Y,O.setTransform(Y,0,0,Y,0,0);const A=getComputedStyle(E),k=A.getPropertyValue("--pd-ruler-bg").trim()||"#F8F9FC",H=A.getPropertyValue("--pd-ruler").trim()||"#9AA1AF",G=A.getPropertyValue("--pd-accent").trim()||"#165DFF";O.fillStyle=k,O.fillRect(0,0,i.value?z:h,i.value?h:z);const q=o.scale>0?o.scale:1,_=b.mmToPx(1)*q;if(_<=0)return;const B=-o.originPx/_,s=(z-o.originPx)/_,x=b.chooseMajorStepMM(q),ee=b.buildRulerTicks(B,s,x);p(O,ee,_,H,!0),p(O,ee,_,H,!1),w(O,0,G),w(O,o.paperLengthMM,G);const he=d.value;if(he!==null&&he>=0&&he<=z){if(O.strokeStyle=G,O.lineWidth=1.5,O.beginPath(),i.value){const ge=Math.round(he)+.5;O.moveTo(ge,0),O.lineTo(ge,h)}else{const ge=Math.round(he)+.5;O.moveTo(0,ge),O.lineTo(h,ge)}O.stroke()}}function p(E,O,Y,z,h){E.strokeStyle=z,E.fillStyle=z,E.globalAlpha=h?.32:1,E.lineWidth=1,E.font="9px ui-monospace, Menlo, monospace",E.textBaseline="top";for(const A of O){if((A.mm<0||A.mm>o.paperLengthMM)!==h)continue;const H=Math.round(o.originPx+A.mm*Y)+.5,G=A.major?8:4;E.beginPath(),i.value?(E.moveTo(H,0),E.lineTo(H,G)):(E.moveTo(0,H),E.lineTo(G,H)),E.stroke(),A.major&&A.label&&(i.value?E.fillText(A.label,H+2,11):(E.save(),E.translate(11,H+2),E.rotate(-Math.PI/2),E.fillText(A.label,0,0),E.restore()))}E.globalAlpha=1}function w(E,O,Y){const z=b.mmToPx(1)*(o.scale>0?o.scale:1),h=Math.round(o.originPx+O*z)+.5;h<=0||h>=o.viewportPx||(E.strokeStyle=Y,E.globalAlpha=.55,E.lineWidth=1,E.beginPath(),i.value?(E.moveTo(h,0),E.lineTo(h,b.RULER_THICKNESS)):(E.moveTo(0,h),E.lineTo(b.RULER_THICKNESS,h)),E.stroke(),E.globalAlpha=1)}e.watch(()=>[o.viewportPx,o.originPx,o.paperLengthMM,o.scale,o.cursorPx,o.orientation],f),e.onMounted(f),e.onBeforeUnmount(()=>{m&&cancelAnimationFrame(m)});let C=!1;function N(E){const O=a.value;if(!O)return null;const Y=O.getBoundingClientRect(),z=i.value?E.clientX-Y.left:E.clientY-Y.top;if(z<0||z>o.viewportPx)return null;const h=b.mmToPx(1)*(o.scale>0?o.scale:1);return(z-o.originPx)/h}function v(E){E.button===0&&(C=!0,E.preventDefault(),window.addEventListener("mousemove",J),window.addEventListener("mouseup",L),te(E))}function $(E){const O=a.value;if(!O)return;const Y=O.getBoundingClientRect();r.value=i.value?E.clientX-Y.left:E.clientY-Y.top,f()}function W(){r.value=null,f()}function te(E){const O=N(E);n("guide-dragging",O)}function J(E){C&&te(E)}function L(E){if(!C)return;C=!1,window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",L);const O=N(E);O!==null&&O>=0&&O<=o.paperLengthMM&&n("add-guide",u.value,O),n("guide-dragging",null)}return e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",L)}),(E,O)=>(e.openBlock(),e.createElementBlock("canvas",{ref_key:"canvasRef",ref:a,class:e.normalizeClass(["pd-ruler",`is-${t.orientation}`]),style:e.normalizeStyle(c.value),onMousedown:v,onMousemove:$,onMouseleave:W},null,38))}}),Mt=ue(ja,[["__scopeId","data-v-1e7d0633"]]),Ya={class:"canvas-scroll"},Xe=96/25.4,Xa=e.defineComponent({__name:"CanvasArea",props:{templateData:{},elements:{},scale:{},showGrid:{type:Boolean},snapToGrid:{type:Boolean},showTableGhostBorder:{type:Boolean},hasClipboard:{type:Boolean},guides:{},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","coordinate","add-guide","guide-move","guide-remove","zoom","clone-element"],setup(t,{expose:l,emit:o}){const n=t,i=o;function u(M,D){i("select",M,D)}const a=e.ref(null),r=e.computed(()=>b.getPaperDimensions(n.templateData).width),d=e.computed(()=>b.getPaperDimensions(n.templateData).height),c=e.reactive({originX:0,originY:0,viewW:0,viewH:0,paperScale:1}),m=e.reactive({x:null,y:null}),f=e.reactive({x:0,y:0}),g=e.computed(()=>({transform:`translate(${f.x}px, ${f.y}px)`}));function p(){const M=a.value,D=M?.querySelector(".hiprint-printPaper");if(!M||!D)return;const U=M.getBoundingClientRect(),oe=D.getBoundingClientRect(),le=n.scale||1,me=oe.width/b.mmToPx(r.value);c.paperScale=Math.abs(me-le)<.002?le:me,c.originX=oe.left-U.left-b.RULER_THICKNESS,c.originY=oe.top-U.top-b.RULER_THICKNESS,c.viewW=M.clientWidth-b.RULER_THICKNESS,c.viewH=M.clientHeight-b.RULER_THICKNESS}function w(){f.x=a.value?.scrollLeft??0,f.y=a.value?.scrollTop??0,p()}let C=null,N=0;function v(){cancelAnimationFrame(N);const M=performance.now()+220,D=()=>{p(),performance.now()<M&&(N=requestAnimationFrame(D))};N=requestAnimationFrame(D)}const $=e.ref(null);function W(M,D){$.value=D===null?null:{type:M,mm:D}}const te=e.computed(()=>{const M=$.value,D=a.value?.querySelector(".hiprint-printPaper");if(!M||!D)return{};const U=D.getBoundingClientRect(),oe=U.width/b.mmToPx(r.value),le=b.mmToPx(M.mm)*(oe>0?oe:n.scale||1);return M.type==="vertical"?{left:U.left+le+"px",top:U.top+"px",height:U.height+"px"}:{left:U.left+"px",top:U.top+le+"px",width:U.width+"px"}});function J(M){const D=a.value?.querySelector(".hiprint-printPaper");if(!D)return;const U=D.getBoundingClientRect(),oe=n.scale||1,le=b.pxToMm((M.clientX-U.left)/oe),me=b.pxToMm((M.clientY-U.top)/oe);if(!(le<0||me<0))return{x:le,y:me}}function L(M){const D=J(M),U=M.dataTransfer?.getData("fieldData");if(U)try{const le=JSON.parse(U);i("drop-field",le,D);return}catch{}const oe=M.dataTransfer?.getData("elementType");oe&&i("drop-element",oe,D)}const E=e.reactive({visible:!1,x:0,y:0,w:0,h:0});let O={x:0,y:0};function Y(M){return!M||!(M instanceof HTMLElement)?!1:!!(M===a.value||M.classList.contains("canvas-scroll")||M.classList.contains("hiprint-printPaper")||M.classList.contains("hiprint-printPaper-content")||M.classList.contains("zone-layer")||M.classList.contains("grid-bg")||M.classList.contains("watermark-layer"))}function z(M){const D=a.value,U=D?.querySelector(".hiprint-printPaper");if(!D||!U)return;const oe=D.getBoundingClientRect();m.x=M.clientX-oe.left-b.RULER_THICKNESS,m.y=M.clientY-oe.top-b.RULER_THICKNESS;const le=U.getBoundingClientRect(),me=n.scale||1,R=b.pxToMm((M.clientX-le.left)/me),I=b.pxToMm((M.clientY-le.top)/me);if(R<0||I<0){i("coordinate",null);return}i("coordinate",{x:R,y:I})}function h(){i("coordinate",null),m.x=null,m.y=null}function A(M,D,U,oe){const le=a.value;if(!le)return;const me=Math.max(oe,Math.round(M)),R=Math.round((n.scale||1)*100);if(me===R)return;const I=n.scale||1,y=me/100/I,V=getComputedStyle(le),P=parseFloat(V.paddingLeft)||0,ie=parseFloat(V.paddingTop)||0,pe=le.scrollLeft+D-P,ye=le.scrollTop+U-ie;i("zoom",me-R),e.nextTick(()=>{const we=getComputedStyle(le),xe=parseFloat(we.paddingLeft)||0,Le=parseFloat(we.paddingTop)||0;le.scrollLeft=pe*y-D+xe,le.scrollTop=ye*y-U+Le})}function k(M){if(!(M.ctrlKey||M.metaKey))return;M.preventDefault();const D=a.value;if(!D)return;const U=Math.round((n.scale||1)*100),oe=b.nextWheelScale(U,M.deltaY>0?-1:1);if(oe===U)return;const le=D.getBoundingClientRect();A(oe,M.clientX-le.left,M.clientY-le.top,b.MIN_SCALE_PERCENT)}function H(M){const D=a.value;if(!D)return;const U=Math.round((n.scale||1)*100),oe=b.nextWheelScale(U,M);A(oe,D.clientWidth/2,D.clientHeight/2,b.MIN_SCALE_PERCENT)}function G(M){const D=a.value;if(!D)return;const U=D.querySelector(".hiprint-printPaper"),oe=U?.style.transition??"";U&&(U.style.transition="none"),A(M,D.clientWidth/2,D.clientHeight/2,b.FIT_SCALE_MIN_PERCENT),e.nextTick(()=>{U&&(U.style.transition=oe)})}function q(M){M.button!==2&&Y(M.target)&&(i("clear-selection"),O={x:M.clientX,y:M.clientY},E.visible=!0,E.x=M.clientX,E.y=M.clientY,E.w=0,E.h=0,window.addEventListener("mousemove",B),window.addEventListener("mouseup",s))}function _(){if(E.w<3||E.h<3)return[];const M=a.value?.querySelector(".hiprint-printPaper");if(!M)return[];const D=M.getBoundingClientRect(),U=n.scale||1,oe=E.x<O.x,le=[];for(const me of n.elements){if(me.options.visible===!1||me.options.locked)continue;const R=D.left+me.options.left*Xe*U,I=D.top+me.options.top*Xe*U,y=R+me.options.width*Xe*U,V=I+me.options.height*Xe*U,P=R<E.x+E.w&&y>E.x&&I<E.y+E.h&&V>E.y,ie=R>=E.x&&y<=E.x+E.w&&I>=E.y&&V<=E.y+E.h;(oe?ie:P)&&le.push(me.id)}return le}function B(M){const D=M.clientX-O.x,U=M.clientY-O.y;E.x=D>=0?O.x:M.clientX,E.y=U>=0?O.y:M.clientY,E.w=Math.abs(D),E.h=Math.abs(U),i("preview",_())}function s(){window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",s);const M=_();i("preview",M),M.length>0?i("commit-preview"):i("clear-selection"),i("preview",[]),E.visible=!1}const x=e.reactive({visible:!1,x:0,y:0,flipX:0,flipY:0,targetId:null}),ee=e.ref(null),he=e.inject(Je,null);function ge(M,D){if(!D&&!Y(M.target))return;D&&!he?.value.has(D)&&i("select",D,!1),x.targetId=D??null,x.visible=!0,x.x=M.clientX,x.y=M.clientY,x.flipX=0,x.flipY=0,e.nextTick(()=>{const oe=ee.value;if(!oe)return;const le=oe.getBoundingClientRect(),me=4;M.clientX+le.width+me>window.innerWidth&&(x.flipX=-le.width),M.clientY+le.height+me>window.innerHeight&&(x.flipY=-le.height)}),window.removeEventListener("mousedown",K);const U=++se;e.nextTick(()=>{U===se&&window.addEventListener("mousedown",K)})}let se=0;function K(M){const D=ee.value;D&&D.contains(M.target)||S()}function S(){x.visible=!1,window.removeEventListener("mousedown",K)}function T(){S(),n.hasClipboard&&i("paste")}function j(){S(),i("select-all")}function Z(){S(),i("clear-selection")}function ne(M,D){S(),M==="copy"?i("copy"):M==="cut"?i("cut"):M==="paste"?T():M==="delete"?i("delete"):M==="move-layer"&&i("move-layer",D)}e.onMounted(()=>{e.nextTick(p),a.value&&typeof ResizeObserver<"u"&&(C=new ResizeObserver(p),C.observe(a.value))}),e.watch(()=>n.scale,v),e.watch([r,d],()=>e.nextTick(p));function ve(){const M=a.value;if(!M)return;let D=0,U=0,oe=0;const le=performance.now()+800,me=()=>{const{scrollWidth:R,scrollHeight:I}=M;if(R===U&&I===oe?D++:D=0,U=R,oe=I,D>=2||performance.now()>le){const y=M.scrollWidth,V=M.scrollHeight,P=M.clientWidth,ie=M.clientHeight;M.scrollLeft=Math.max(0,(y-P)/2),M.scrollTop=Math.max(0,(V-ie)/2);return}requestAnimationFrame(me)};requestAnimationFrame(me)}return l({centerScroll:ve,fitToWindow:G,zoomByStep:H}),e.onBeforeUnmount(()=>{window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",s),window.removeEventListener("mousedown",K),C?.disconnect(),cancelAnimationFrame(N)}),(M,D)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:a,class:"canvas-area",onDragover:D[23]||(D[23]=e.withModifiers(()=>{},["prevent"])),onDrop:L,onMousedown:q,onMousemove:z,onMouseleave:h,onWheel:k,onScroll:w,onContextmenu:e.withModifiers(ge,["prevent"])},[e.createElementVNode("div",Ya,[e.createVNode(Ka,{"template-data":t.templateData,"runtime-elements":t.elements,"design-mode":!0,"print-data":[],scale:t.scale,"show-grid":t.showGrid,"snap-to-grid":t.snapToGrid,"show-table-ghost-border":t.showTableGhostBorder,guides:t.guides,onSelect:u,onGuideMove:D[0]||(D[0]=(U,oe)=>M.$emit("guide-move",U,oe)),onGuideRemove:D[1]||(D[1]=U=>M.$emit("guide-remove",U)),onDragStart:D[2]||(D[2]=U=>M.$emit("drag-start")),onDragStop:D[3]||(D[3]=U=>M.$emit("drag-stop")),onDblclickElement:D[4]||(D[4]=U=>M.$emit("dblclick-element",U)),onDblclickCell:D[5]||(D[5]=(U,oe,le)=>M.$emit("dblclick-cell",U,oe,le)),onContextmenu:D[6]||(D[6]=(U,oe)=>ge(oe,U)),onZoneHeightChange:D[7]||(D[7]=(U,oe)=>M.$emit("zone-height-change",U,oe)),onZoneHeightCommit:D[8]||(D[8]=U=>M.$emit("zone-height-commit",U)),onCloneElement:D[9]||(D[9]=(U,oe)=>M.$emit("clone-element",U,oe))},null,8,["template-data","runtime-elements","scale","show-grid","snap-to-grid","show-table-ghost-border","guides"])]),t.showRuler?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ruler-overlay",style:e.normalizeStyle(g.value)},[D[24]||(D[24]=e.createElementVNode("div",{class:"ruler-corner"},null,-1)),e.createVNode(Mt,{orientation:"horizontal","viewport-px":c.viewW,"origin-px":c.originX,"paper-length-m-m":r.value,scale:c.paperScale,"cursor-px":m.x,onAddGuide:D[10]||(D[10]=(U,oe)=>i("add-guide",U,oe)),onGuideDragging:D[11]||(D[11]=U=>W("vertical",U))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"]),e.createVNode(Mt,{orientation:"vertical","viewport-px":c.viewH,"origin-px":c.originY,"paper-length-m-m":d.value,scale:c.paperScale,"cursor-px":m.y,onAddGuide:D[12]||(D[12]=(U,oe)=>i("add-guide",U,oe)),onGuideDragging:D[13]||(D[13]=U=>W("horizontal",U))},null,8,["viewport-px","origin-px","paper-length-m-m","scale","cursor-px"])],4)):e.createCommentVNode("",!0),$.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ruler-guide-preview",`guide-${$.value.type}`]),style:e.normalizeStyle(te.value)},null,6)):e.createCommentVNode("",!0),E.visible?(e.openBlock(),e.createElementBlock("div",{key:2,class:"marquee-selection",style:e.normalizeStyle({left:E.x+"px",top:E.y+"px",width:E.w+"px",height:E.h+"px"})},null,4)):e.createCommentVNode("",!0),x.visible?(e.openBlock(),e.createElementBlock("div",{key:3,ref_key:"contextMenuRef",ref:ee,class:"context-menu",onMousedown:D[22]||(D[22]=e.withModifiers(()=>{},["stop"])),style:e.normalizeStyle({left:x.x+x.flipX+"px",top:x.y+x.flipY+"px"})},[x.targetId?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"context-menu-item",onClick:D[14]||(D[14]=U=>ne("copy"))},"复制"),e.createElementVNode("div",{class:"context-menu-item",onClick:D[15]||(D[15]=U=>ne("cut"))},"剪切"),e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!t.hasClipboard}]),onClick:D[16]||(D[16]=U=>ne("paste"))},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:D[17]||(D[17]=U=>ne("delete"))},"删除"),D[25]||(D[25]=e.createElementVNode("div",{class:"context-menu-sep"},null,-1)),e.createElementVNode("div",{class:"context-menu-item",onClick:D[18]||(D[18]=U=>ne("move-layer","top"))},"置顶"),e.createElementVNode("div",{class:"context-menu-item",onClick:D[19]||(D[19]=U=>ne("move-layer","up"))},"上移"),e.createElementVNode("div",{class:"context-menu-item",onClick:D[20]||(D[20]=U=>ne("move-layer","down"))},"下移"),e.createElementVNode("div",{class:"context-menu-item",onClick:D[21]||(D[21]=U=>ne("move-layer","bottom"))},"置底")],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:e.normalizeClass(["context-menu-item",{disabled:!t.hasClipboard}]),onClick:T},"粘贴",2),e.createElementVNode("div",{class:"context-menu-item",onClick:j},"全选"),e.createElementVNode("div",{class:"context-menu-item",onClick:Z},"取消选择")],64))],36)):e.createCommentVNode("",!0)],544))}}),Za=ue(Xa,[["__scopeId","data-v-427d3548"]]),Ja={class:"property-search"},Qa=e.defineComponent({__name:"PropertySearch",emits:["search"],setup(t,{emit:l}){const o=e.ref(""),n=l;function i(){n("search",o.value)}return(u,a)=>(e.openBlock(),e.createElementBlock("div",Ja,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=r=>o.value=r),class:"pd-input",type:"search",placeholder:"搜索属性...","aria-label":"搜索属性",onInput:i},null,544),[[e.vModelText,o.value]])]))}}),_a=ue(Qa,[["__scopeId","data-v-10ab6c84"]]),ei={class:"group-icon"},ti={class:"group-title"},oi={class:"expand-icon"},ni={class:"group-content"},li=e.defineComponent({__name:"PropertyGroup",props:{title:{},icon:{},defaultExpanded:{type:Boolean},groupKey:{}},setup(t){const l=t,o=e.ref(l.defaultExpanded??!0),i={Document:"≡",Brush:"◧",Setting:"⚙"}[l.icon]||"•";function u(){o.value=!o.value,a()}function a(){const d=`property-group-${l.groupKey}`;try{localStorage.setItem(d,String(o.value))}catch{}}function r(){const d=`property-group-${l.groupKey}`;try{const c=localStorage.getItem(d);c!==null&&(o.value=c==="true")}catch{}}return e.onMounted(()=>{r()}),(d,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-group",{"is-expanded":o.value}])},[e.createElementVNode("div",{class:"group-header",onClick:u},[e.createElementVNode("span",ei,e.toDisplayString(e.unref(i)),1),e.createElementVNode("span",ti,e.toDisplayString(t.title),1),e.createElementVNode("span",oi,e.toDisplayString(o.value?"▾":"▸"),1)]),e.withDirectives(e.createElementVNode("div",ni,[e.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[e.vShow,o.value]])],2))}}),Be=ue(li,[["__scopeId","data-v-2ba57031"]]),ai={class:"position-grid"},ii={class:"pd-field"},ri={class:"pd-field"},si={class:"pd-field"},di={class:"pd-field"},ci=e.defineComponent({__name:"PositionSizeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const l=t;function o(n){return l.searching?l.matchedKeys?.has(n)??!0:!0}return(n,i)=>(e.openBlock(),e.createBlock(Be,{title:"位置与尺寸",icon:"Location","default-expanded":"","group-key":"position-size"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:i[4]||(i[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",ai,[e.withDirectives(e.createElementVNode("div",ii,[i[5]||(i[5]=e.createElementVNode("span",{class:"pd-label"},"X",-1)),e.createVNode(de,{modelValue:t.element.options.left,"onUpdate:modelValue":i[0]||(i[0]=u=>t.element.options.left=u),min:0},null,8,["modelValue"])],512),[[e.vShow,o("ps-left")]]),e.withDirectives(e.createElementVNode("div",ri,[i[6]||(i[6]=e.createElementVNode("span",{class:"pd-label"},"Y",-1)),e.createVNode(de,{modelValue:t.element.options.top,"onUpdate:modelValue":i[1]||(i[1]=u=>t.element.options.top=u),min:0},null,8,["modelValue"])],512),[[e.vShow,o("ps-top")]]),e.withDirectives(e.createElementVNode("div",si,[i[7]||(i[7]=e.createElementVNode("span",{class:"pd-label"},"W",-1)),e.createVNode(de,{modelValue:t.element.options.width,"onUpdate:modelValue":i[2]||(i[2]=u=>t.element.options.width=u),min:4},null,8,["modelValue"])],512),[[e.vShow,o("ps-width")]]),e.withDirectives(e.createElementVNode("div",di,[i[8]||(i[8]=e.createElementVNode("span",{class:"pd-label"},"H",-1)),e.createVNode(de,{modelValue:t.element.options.height,"onUpdate:modelValue":i[3]||(i[3]=u=>t.element.options.height=u),min:4},null,8,["modelValue"])],512),[[e.vShow,o("ps-height")]])])],32)]),_:1}))}}),ui=ue(ci,[["__scopeId","data-v-bc364679"]]),mi={class:"pd-field"},pi={class:"pd-field"},vi={class:"pd-field"},fi={class:"pd-field"},gi={class:"pd-radio-group",role:"radiogroup"},hi={class:"pd-radio"},bi={class:"pd-radio"},Ei={class:"pd-radio"},yi={class:"pd-radio"},ki={class:"pd-field"},Vi={class:"pd-radio-group",role:"radiogroup"},Ni={class:"pd-radio"},wi={class:"pd-radio"},Ci={class:"pd-radio"},Si={class:"color-row"},xi={class:"pd-field"},Bi={class:"pd-field"},$i={class:"pd-field"},Di={class:"pd-field"},Ti={class:"pd-field"},Mi=["value"],zi={key:0,class:"pd-field"},Ai={key:1,class:"pd-field"},Pi={class:"pd-label"},Ri=["data-tip"],Li={class:"pd-field"},Ui=["checked"],Ii={class:"pd-field"},Fi={class:"pd-label"},Oi=["data-tip"],Hi={class:"pd-field"},Wi={class:"pd-label"},Gi=["data-tip"],qi={key:2,class:"pd-empty"},Ki=e.defineComponent({__name:"AppearanceGroup",props:{element:{},isTextType:{type:Boolean},matchedKeys:{},searching:{type:Boolean}},setup(t){const l=t;function o(g){return l.searching?l.matchedKeys?.has(g)??!0:!0}const n=e.computed(()=>l.element.printElementType.type==="table"),i=e.computed(()=>l.element.printElementType.type==="longText"),u=e.computed(()=>l.element.printElementType.type==="image"),a=b.propertyTip("ap-long-text-indent"),r=b.propertyTip("ap-img-fit"),d=b.propertyTip("ap-img-object-position"),c=e.computed({get:()=>l.element.options.objectPosition??"",set:g=>{l.element.options.objectPosition=g.trim()||void 0}}),m=e.computed(()=>b.resolveElementTextFit(l.element.printElementType.type||"text",l.element.options));function f(g){l.element.options.textFit=g.target.value}return(g,p)=>(e.openBlock(),e.createBlock(Be,{title:"外观",icon:"Brush","default-expanded":"","group-key":"appearance"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:p[19]||(p[19]=e.withModifiers(()=>{},["prevent"]))},[t.isTextType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",mi,[p[20]||(p[20]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(kt,{modelValue:t.element.options.fontFamily,"onUpdate:modelValue":p[0]||(p[0]=w=>t.element.options.fontFamily=w)},null,8,["modelValue"])],512),[[e.vShow,o("ap-font-family")]]),e.withDirectives(e.createElementVNode("div",pi,[p[21]||(p[21]=e.createElementVNode("span",{class:"pd-label"},"字体大小",-1)),e.createVNode(de,{modelValue:t.element.options.fontSize,"onUpdate:modelValue":p[1]||(p[1]=w=>t.element.options.fontSize=w),min:8,max:72},null,8,["modelValue"])],512),[[e.vShow,o("ap-font-size")]]),e.withDirectives(e.createElementVNode("div",vi,[p[23]||(p[23]=e.createElementVNode("span",{class:"pd-label"},"字体粗细",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":p[2]||(p[2]=w=>t.element.options.fontWeight=w),style:{width:"100%"}},[...p[22]||(p[22]=[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,t.element.options.fontWeight]])],512),[[e.vShow,o("ap-font-weight")]]),e.withDirectives(e.createElementVNode("div",fi,[p[28]||(p[28]=e.createElementVNode("span",{class:"pd-label"},"对齐",-1)),e.createElementVNode("div",gi,[e.createElementVNode("label",hi,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":p[3]||(p[3]=w=>t.element.options.textAlign=w),value:"left"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),p[24]||(p[24]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",bi,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":p[4]||(p[4]=w=>t.element.options.textAlign=w),value:"center"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),p[25]||(p[25]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Ei,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":p[5]||(p[5]=w=>t.element.options.textAlign=w),value:"right"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),p[26]||(p[26]=e.createElementVNode("span",null,"右",-1))]),e.createElementVNode("label",yi,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":p[6]||(p[6]=w=>t.element.options.textAlign=w),value:"justify"},null,512),[[e.vModelRadio,t.element.options.textAlign]]),p[27]||(p[27]=e.createElementVNode("span",null,"两端",-1))])])],512),[[e.vShow,o("ap-align")]]),e.withDirectives(e.createElementVNode("div",ki,[p[32]||(p[32]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",Vi,[e.createElementVNode("label",Ni,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":p[7]||(p[7]=w=>t.element.options.verticalAlign=w),value:"top"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),p[29]||(p[29]=e.createElementVNode("span",null,"顶",-1))]),e.createElementVNode("label",wi,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":p[8]||(p[8]=w=>t.element.options.verticalAlign=w),value:"middle"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),p[30]||(p[30]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Ci,[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":p[9]||(p[9]=w=>t.element.options.verticalAlign=w),value:"bottom"},null,512),[[e.vModelRadio,t.element.options.verticalAlign]]),p[31]||(p[31]=e.createElementVNode("span",null,"底",-1))])])],512),[[e.vShow,o("ap-vertical-align")]]),e.createElementVNode("div",Si,[e.withDirectives(e.createElementVNode("div",xi,[p[33]||(p[33]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(Ne,{modelValue:t.element.options.color,"onUpdate:modelValue":p[10]||(p[10]=w=>t.element.options.color=w)},null,8,["modelValue"])],512),[[e.vShow,o("ap-color")]]),e.withDirectives(e.createElementVNode("div",Bi,[p[34]||(p[34]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ne,{modelValue:t.element.options.backgroundColor,"onUpdate:modelValue":p[11]||(p[11]=w=>t.element.options.backgroundColor=w)},null,8,["modelValue"])],512),[[e.vShow,o("ap-bg-color")]])]),e.withDirectives(e.createElementVNode("div",$i,[p[35]||(p[35]=e.createElementVNode("span",{class:"pd-label"},"行高",-1)),e.createVNode(de,{modelValue:t.element.options.lineHeight,"onUpdate:modelValue":p[12]||(p[12]=w=>t.element.options.lineHeight=w),min:0,max:100},null,8,["modelValue"])],512),[[e.vShow,o("ap-line-height")]]),e.withDirectives(e.createElementVNode("div",Di,[p[36]||(p[36]=e.createElementVNode("span",{class:"pd-label"},"字间距",-1)),e.createVNode(de,{modelValue:t.element.options.letterSpacing,"onUpdate:modelValue":p[13]||(p[13]=w=>t.element.options.letterSpacing=w),min:0,max:20,step:.5},null,8,["modelValue"])],512),[[e.vShow,o("ap-letter-spacing")]]),e.withDirectives(e.createElementVNode("div",Ti,[p[38]||(p[38]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:m.value,style:{width:"100%"},onChange:f},[...p[37]||(p[37]=[e.createElementVNode("option",{value:"clip"},"截断",-1),e.createElementVNode("option",{value:"shrink"},"自动缩小",-1),e.createElementVNode("option",{value:"autoHeight"},"自适应行高",-1)])],40,Mi)],512),[[e.vShow,o("ap-text-fit")]]),m.value==="shrink"?e.withDirectives((e.openBlock(),e.createElementBlock("div",zi,[p[39]||(p[39]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(de,{"model-value":t.element.options.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":p[14]||(p[14]=w=>t.element.options.shrinkMinFontSize=w??void 0)},null,8,["model-value"])],512)),[[e.vShow,o("ap-shrink-min")]]):e.createCommentVNode("",!0),i.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",Ai,[e.createElementVNode("span",Pi,[p[40]||(p[40]=e.createTextVNode("首行缩进 (字符)",-1)),e.createElementVNode("button",{type:"button",class:"pd-help","data-tip":e.unref(a),"aria-label":"字段说明"},null,8,Ri)]),e.createVNode(de,{modelValue:t.element.options.longTextIndent,"onUpdate:modelValue":p[15]||(p[15]=w=>t.element.options.longTextIndent=w),min:0,max:10,placeholder:"默认 0"},null,8,["modelValue"])],512)),[[e.vShow,o("ap-long-text-indent")]]):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",Li,[p[41]||(p[41]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:t.element.options.wordWrap!==!1,type:"checkbox",class:"pd-switch",onInput:p[16]||(p[16]=w=>t.element.options.wordWrap=w.target.checked?void 0:!1)},null,40,Ui)],512),[[e.vShow,o("ap-word-wrap")]])],64)):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.withDirectives(e.createElementVNode("div",Ii,[e.createElementVNode("span",Fi,[p[42]||(p[42]=e.createTextVNode("缩放模式",-1)),e.createElementVNode("button",{type:"button",class:"pd-help","data-tip":e.unref(r),"aria-label":"字段说明"},null,8,Oi)]),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":p[17]||(p[17]=w=>t.element.options.fit=w),style:{width:"100%"}},[...p[43]||(p[43]=[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)])],512),[[e.vModelSelect,t.element.options.fit]])],512),[[e.vShow,o("ap-img-fit")]]),e.withDirectives(e.createElementVNode("div",Hi,[e.createElementVNode("span",Wi,[p[44]||(p[44]=e.createTextVNode("裁剪锚点",-1)),e.createElementVNode("button",{type:"button",class:"pd-help","data-tip":e.unref(d),"aria-label":"字段说明"},null,8,Gi)]),e.withDirectives(e.createElementVNode("input",{class:"pd-input",type:"text","onUpdate:modelValue":p[18]||(p[18]=w=>c.value=w),placeholder:"缺省居中,如 center 20%"},null,512),[[e.vModelText,c.value]])],512),[[e.vShow,o("ap-img-object-position")]])],64)):e.createCommentVNode("",!0),!t.isTextType&&!u.value&&!n.value?(e.openBlock(),e.createElementBlock("p",qi,"当前元素不支持外观设置")):e.createCommentVNode("",!0)],32)]),_:1}))}}),ji=ue(Ki,[["__scopeId","data-v-239e0cf4"]]),Yi={class:"pd-field"},Xi=["value"],Zi={class:"pd-field"},Ji=["value"],Qi={class:"pd-hint"},_i={class:"pd-field"},er={class:"pd-field"},tr=["checked"],or={class:"pd-field"},nr={class:"pd-field"},lr=["value"],ar={class:"pd-field"},ir={class:"pd-label"},rr=["data-tip"],sr={key:2,class:"pd-hint"},dr={key:3,class:"pd-field"},cr=["value"],ur={class:"pd-field"},mr={class:"pd-field"},pr=e.defineComponent({__name:"CodeGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["change"],setup(t,{emit:l}){const o=b.propertyTip("cd-quiet-zone"),n=t,i=l,u=e.computed(()=>n.element.printElementType.type==="barcode"),a=e.computed(()=>n.element.printElementType.type==="qrcode"),r=e.computed(()=>(n.element.options.barcodeType||"CODE128").toUpperCase()),d=e.computed(()=>n.element.options.printerDpi?String(n.element.options.printerDpi):""),c=e.computed(()=>!!n.element.options.printerDpi),m=e.computed(()=>u.value&&c.value);function f(N){const v=Number(N.target.value);n.element.options.printerDpi=v>0?v:void 0,C()}function g(N){const v=N.target.value;n.element.options.barcodeType=v==="CODE128"?void 0:v,C()}function p(N){n.element.options.fit=N.target.value||void 0,C()}function w(N){return n.searching?n.matchedKeys?.has(N)??!0:!0}function C(){i("change")}return(N,v)=>(e.openBlock(),e.createBlock(Be,{title:"条码设置",icon:"Postcard","default-expanded":"","group-key":"code"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:v[7]||(v[7]=e.withModifiers(()=>{},["prevent"]))},[u.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.withDirectives(e.createElementVNode("div",Yi,[v[9]||(v[9]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{class:"pd-select",value:r.value,onChange:g},[...v[8]||(v[8]=[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,Xi)],512),[[e.vShow,w("cd-type")]]),e.withDirectives(e.createElementVNode("div",Zi,[v[11]||(v[11]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{class:"pd-select",value:d.value,onChange:f},[...v[10]||(v[10]=[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,Ji)],512),[[e.vShow,w("cd-dpi")]]),e.withDirectives(e.createElementVNode("p",Qi,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小",512),[[e.vShow,w("cd-dpi")]]),e.withDirectives(e.createElementVNode("div",_i,[v[12]||(v[12]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(de,{"model-value":t.element.options.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":v[0]||(v[0]=$=>{t.element.options.barWidth=$,C()})},null,8,["model-value"])],512),[[e.vShow,w("cd-bar-width")]]),e.withDirectives(e.createElementVNode("p",{class:"pd-hint"},e.toDisplayString(m.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),元素框放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),513),[[e.vShow,w("cd-bar-width")]]),e.withDirectives(e.createElementVNode("div",er,[v[13]||(v[13]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:t.element.options.hideTitle!==!0,type:"checkbox",class:"pd-switch",onInput:v[1]||(v[1]=$=>{t.element.options.hideTitle=$.target.checked?void 0:!0,C()})},null,40,tr)],512),[[e.vShow,w("cd-show-text")]]),e.withDirectives(e.createElementVNode("div",or,[v[14]||(v[14]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(de,{"model-value":t.element.options.fontSize,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":v[2]||(v[2]=$=>{t.element.options.fontSize=$??void 0,C()})},null,8,["model-value"])],512),[[e.vShow,w("cd-font-size")]])],64)):a.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.withDirectives(e.createElementVNode("div",nr,[v[16]||(v[16]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{class:"pd-select",value:String(t.element.options.qrCodeLevel??"M"),onChange:v[3]||(v[3]=$=>{t.element.options.qrCodeLevel=$.target.value,C()})},[...v[15]||(v[15]=[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,lr)],512),[[e.vShow,w("cd-ec-level")]]),e.withDirectives(e.createElementVNode("div",ar,[e.createElementVNode("span",ir,[v[17]||(v[17]=e.createTextVNode("静区 (模块)",-1)),e.createElementVNode("button",{type:"button",class:"pd-help","data-tip":e.unref(o),"aria-label":"字段说明"},null,8,rr)]),e.createVNode(de,{"model-value":t.element.options.qrQuietZone,min:0,max:8,placeholder:"默认 0","onUpdate:modelValue":v[4]||(v[4]=$=>{t.element.options.qrQuietZone=$??void 0,C()})},null,8,["model-value"])],512),[[e.vShow,w("cd-quiet-zone")]])],64)):e.createCommentVNode("",!0),v[22]||(v[22]=e.createElementVNode("h3",{class:"pd-divider"},"自定义设置",-1)),u.value?(e.openBlock(),e.createElementBlock("p",sr,"条码尺寸由「条宽」与「打印机分辨率」结算:宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),u.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("div",dr,[v[19]||(v[19]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{class:"pd-select",value:t.element.options.fit||"contain",onChange:p},[...v[18]||(v[18]=[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,cr)],512)),[[e.vShow,w("cd-fit")]]),e.withDirectives(e.createElementVNode("div",ur,[v[20]||(v[20]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(de,{"model-value":t.element.options.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":v[5]||(v[5]=$=>{t.element.options.maxWidth=$??void 0,C()})},null,8,["model-value"])],512),[[e.vShow,w("cd-max-width")]]),e.withDirectives(e.createElementVNode("div",mr,[v[21]||(v[21]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(de,{"model-value":t.element.options.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":v[6]||(v[6]=$=>{t.element.options.maxHeight=$??void 0,C()})},null,8,["model-value"])],512),[[e.vShow,w("cd-max-height")]])],32)]),_:1}))}}),vr={class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},fr={class:"pd-dialog-header"},gr={class:"expression-editor"},hr={class:"ee-nav"},br={class:"ee-nav-tabs"},Er={class:"ee-content"},yr={class:"ee-content-search"},kr=["placeholder"],Vr={class:"ee-content-list"},Nr={class:"ee-field-group-icon"},wr=["onDblclick"],Cr={class:"ee-field-info"},Sr={class:"ee-item-label"},xr={class:"ee-item-key"},Br={key:0,class:"pd-empty"},$r=["onDblclick"],Dr={class:"ee-field-info"},Tr={class:"ee-item-label"},Mr={class:"ee-item-key"},zr={class:"ee-func-group"},Ar=["onDblclick"],Pr={class:"ee-field-info"},Rr={class:"ee-item-label"},Lr={class:"ee-item-key"},Ur={class:"ee-func-group"},Ir=["onDblclick"],Fr={class:"ee-field-info"},Or={class:"ee-item-label"},Hr={class:"ee-item-key"},Wr={class:"ee-func-group"},Gr=["onDblclick"],qr={class:"ee-field-info"},Kr={class:"ee-item-label"},jr={class:"ee-item-key"},Yr={class:"ee-editor"},Xr={class:"ee-editor-section"},Zr={class:"ee-editor-section"},Jr={class:"pd-dialog-footer"},Qr=e.defineComponent({__name:"ExpressionEditor",props:{modelValue:{type:Boolean},expression:{},fields:{}},emits:["update:modelValue","update:expression"],setup(t,{emit:l}){const o=t,n=l,i=e.computed({get:()=>o.modelValue,set:z=>n("update:modelValue",z)}),u=e.ref("field"),a=e.computed(()=>{switch(u.value){case"field":return"搜索字段...";case"variable":return"搜索变量...";case"function":return"搜索函数...";default:return"搜索..."}}),r=e.ref(""),d=e.computed(()=>b.filterGroups(b.groupFields(o.fields??[]),r.value));e.watch(i,z=>{z&&(v.value=o.expression||"")});function c(z){const{insideParens:h}=g();O(h?z.fieldKey:`{${z.fieldKey}}`)}function m(z){const{insideParens:h}=g();O(h?z.template.replace(/^\{|\}$/g,""):z.template)}function f(z){const{insideBlock:h}=g(),A=h?z.template:`{${z.template}}`,k=A.indexOf("(")+1;O(A,k)}function g(){const h=$.value?.selectionStart??v.value.length,A=v.value.substring(0,h);let k=!1;const H=A.lastIndexOf("{");H!==-1&&!A.slice(H+1).includes("}")&&(k=!0);let G=!1;const q=A.lastIndexOf("(");return q!==-1&&!A.slice(q+1).includes(")")&&(G=!0),{insideBlock:k,insideParens:G}}const p=e.computed(()=>{if(!r.value.trim())return L;const z=r.value.trim().toLowerCase();return L.filter(h=>h.label.toLowerCase().includes(z)||h.name.toLowerCase().includes(z))}),w=e.computed(()=>{if(!r.value.trim())return W;const z=r.value.trim().toLowerCase();return W.filter(h=>h.label.toLowerCase().includes(z)||h.name.toLowerCase().includes(z))}),C=e.computed(()=>{if(!r.value.trim())return te;const z=r.value.trim().toLowerCase();return te.filter(h=>h.label.toLowerCase().includes(z)||h.name.toLowerCase().includes(z))}),N=e.computed(()=>{if(!r.value.trim())return J;const z=r.value.trim().toLowerCase();return J.filter(h=>h.label.toLowerCase().includes(z)||h.name.toLowerCase().includes(z))}),v=e.ref(o.expression||""),$=e.ref(null);e.watch(()=>o.expression,z=>{v.value=z||""});const W=[{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()"}],te=[{name:"ADD",label:"相加",template:"ADD()"},{name:"SUB",label:"相减",template:"SUB()"},{name:"MUL",label:"相乘",template:"MUL()"},{name:"DIV",label:"相除",template:"DIV()"},{name:"ROUND",label:"四舍五入",template:"ROUND()"},{name:"ROUNDUP",label:"进一法",template:"ROUNDUP()"},{name:"ROUNDDOWN",label:"去尾法",template:"ROUNDDOWN()"},{name:"ROUNDBANK",label:"四舍六入五成双",template:"ROUNDBANK()"}],J=[{name:"MONEY",label:"金额格式化",template:"MONEY()"},{name:"DATE",label:"日期格式化",template:"DATE()"},{name:"UPPER",label:"大写金额",template:"UPPER()"},{name:"IF",label:"条件判断",template:"IF()"}],L=[{name:"pageIndex",label:"当前页码",template:"{pageIndex}"},{name:"totalPages",label:"总页数",template:"{totalPages}"},{name:"printDate",label:"打印日期",template:"{printDate}"},{name:"printTime",label:"打印时间",template:"{printTime}"}],E=e.computed(()=>{if(!v.value.trim())return"(输入表达式后预览)";try{const z={...b.DEFAULT_DEMO_DATA,...be.resolveSystemVariables()},h=b.evaluateTemplate(v.value,z);return h==null?"(无法计算)":String(h)}catch{return"(表达式错误)"}});function O(z,h=z.length){const A=$.value;if(!A){v.value+=z;return}const k=A.selectionStart,H=A.selectionEnd,G=v.value.substring(0,k),q=v.value.substring(H);v.value=G+z+q;const _=k+h;e.nextTick(()=>{A.focus(),A.selectionStart=A.selectionEnd=_})}function Y(){n("update:expression",v.value),i.value=!1}return(z,h)=>i.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pd-dialog-overlay",onKeydown:h[7]||(h[7]=e.withKeys(A=>i.value=!1,["esc"]))},[e.createElementVNode("section",vr,[e.createElementVNode("header",fr,[h[8]||(h[8]=e.createElementVNode("strong",{id:"expression-editor-title"},"编辑表达式",-1)),e.createElementVNode("button",{type:"button",class:"pd-close","aria-label":"关闭",onClick:h[0]||(h[0]=A=>i.value=!1)},"×")]),e.createElementVNode("div",gr,[e.createElementVNode("div",hr,[h[9]||(h[9]=e.createElementVNode("div",{class:"ee-nav-title"},"类型",-1)),e.createElementVNode("div",br,[e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:u.value==="field"}]),onClick:h[1]||(h[1]=A=>u.value="field")}," 📁 字段 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:u.value==="variable"}]),onClick:h[2]||(h[2]=A=>u.value="variable")}," 🔧 变量 ",2),e.createElementVNode("div",{class:e.normalizeClass(["ee-nav-tab",{active:u.value==="function"}]),onClick:h[3]||(h[3]=A=>u.value="function")}," ⚡ 函数 ",2)])]),e.createElementVNode("div",Er,[e.createElementVNode("div",yr,[e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":h[4]||(h[4]=A=>r.value=A),placeholder:a.value},null,8,kr),[[e.vModelText,r.value]])]),e.createElementVNode("div",Vr,[u.value==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,A=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:A.key||"_top"},[A.key?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ee-field-group",{"is-list":A.isList}])},[e.createElementVNode("span",Nr,e.toDisplayString(A.isList?"📋":"📁"),1),e.createElementVNode("span",null,e.toDisplayString(A.label),1)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A.fields,k=>(e.openBlock(),e.createElementBlock("div",{key:k.fieldKey,class:"ee-list-item ee-field-item",style:e.normalizeStyle({paddingLeft:A.key?"22px":"10px"}),onDblclick:H=>c(k)},[e.createElementVNode("div",Cr,[e.createElementVNode("span",Sr,e.toDisplayString(k.fieldLabel),1),e.createElementVNode("span",xr,e.toDisplayString(k.fieldKey),1)])],44,wr))),128))],64))),128)),d.value.length===0?(e.openBlock(),e.createElementBlock("p",Br,"暂无字段")):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),u.value==="variable"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(p.value,A=>(e.openBlock(),e.createElementBlock("div",{key:A.name,class:"ee-list-item",onDblclick:k=>m(A)},[e.createElementVNode("div",Dr,[e.createElementVNode("span",Tr,e.toDisplayString(A.label),1),e.createElementVNode("span",Mr,e.toDisplayString(A.template),1)])],40,$r))),128)):e.createCommentVNode("",!0),u.value==="function"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",zr,[h[10]||(h[10]=e.createElementVNode("div",{class:"ee-func-group-title"},"聚合函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,A=>(e.openBlock(),e.createElementBlock("div",{key:A.name,class:"ee-list-item",onDblclick:k=>f(A)},[e.createElementVNode("div",Pr,[e.createElementVNode("span",Rr,e.toDisplayString(A.label),1),e.createElementVNode("span",Lr,e.toDisplayString(A.name)+"()",1)])],40,Ar))),128))]),e.createElementVNode("div",Ur,[h[11]||(h[11]=e.createElementVNode("div",{class:"ee-func-group-title"},"数值运算",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,A=>(e.openBlock(),e.createElementBlock("div",{key:A.name,class:"ee-list-item",onDblclick:k=>f(A)},[e.createElementVNode("div",Fr,[e.createElementVNode("span",Or,e.toDisplayString(A.label),1),e.createElementVNode("span",Hr,e.toDisplayString(A.name)+"()",1)])],40,Ir))),128))]),e.createElementVNode("div",Wr,[h[12]||(h[12]=e.createElementVNode("div",{class:"ee-func-group-title"},"格式化函数",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,A=>(e.openBlock(),e.createElementBlock("div",{key:A.name,class:"ee-list-item",onDblclick:k=>f(A)},[e.createElementVNode("div",qr,[e.createElementVNode("span",Kr,e.toDisplayString(A.label),1),e.createElementVNode("span",jr,e.toDisplayString(A.name)+"()",1)])],40,Gr))),128))])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Yr,[e.createElementVNode("div",Xr,[h[13]||(h[13]=e.createElementVNode("div",{class:"ee-editor-title"},"表达式编辑",-1)),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:$,"onUpdate:modelValue":h[5]||(h[5]=A=>v.value=A),class:"ee-textarea",rows:"6",placeholder:"双击左侧字段/变量/函数插入,或直接输入静态内容"},null,512),[[e.vModelText,v.value]])]),e.createElementVNode("div",Zr,[h[14]||(h[14]=e.createElementVNode("div",{class:"ee-editor-title"},"预览结果",-1)),e.createElementVNode("div",{class:e.normalizeClass(["ee-preview",{"ee-preview-error":E.value==="(表达式错误)"}])},e.toDisplayString(E.value),3)]),h[15]||(h[15]=e.createStaticVNode('<div class="ee-help-section" data-v-f3837718><div class="ee-help-title" data-v-f3837718>帮助信息</div><div class="ee-help-grid" data-v-f3837718><div class="ee-help-card ee-help-field" data-v-f3837718><div class="ee-help-card-title" data-v-f3837718>输入方式</div><div class="ee-help-card-content" data-v-f3837718> 双击左侧字段、变量、函数即可插入到表达式输入框中<br data-v-f3837718> 静态数据直接输入即可,如:供应商名称<br data-v-f3837718> 动态解析字段、变量、函数必须用 {} 包裹<br data-v-f3837718> 示例:{SUM(supplier.name)}<br data-v-f3837718> 注意:只能嵌套一层 </div></div><div class="ee-help-card ee-help-function" data-v-f3837718><div class="ee-help-card-title" data-v-f3837718>函数使用</div><div class="ee-help-card-content" data-v-f3837718> SUM(字段) - 求和<br data-v-f3837718> AVG(字段) - 平均值<br data-v-f3837718> COUNT(字段) - 计数<br data-v-f3837718> IF(条件, 真值, 假值) - 条件判断<br data-v-f3837718> 四则运算:{qty * price}、{ADD(qty, 1)}<br data-v-f3837718> 修约:ROUND 四舍五入 / ROUNDUP 进一 / ROUNDDOWN 去尾 / ROUNDBANK 四舍六入五成双 </div></div><div class="ee-help-card ee-help-variable" data-v-f3837718><div class="ee-help-card-title" data-v-f3837718>系统变量</div><div class="ee-help-card-content" data-v-f3837718> {pageIndex} - 当前页码<br data-v-f3837718> {totalPages} - 总页数<br data-v-f3837718> {printDate} - 打印日期 </div></div><div class="ee-help-card ee-help-conditional" data-v-f3837718><div class="ee-help-card-title" data-v-f3837718>示例</div><div class="ee-help-card-content" data-v-f3837718> 静态文本:供应商名称<br data-v-f3837718> 动态字段:{supplier.name}<br data-v-f3837718> 函数调用:{SUM(amount)}<br data-v-f3837718> 条件判断:{IF(amount&gt;1000, &quot;大单&quot;, &quot;小单&quot;)}<br data-v-f3837718> 运算并修约:{ROUND(qty * price, 2)} </div></div></div></div>',1))])]),e.createElementVNode("footer",Jr,[e.createElementVNode("button",{type:"button",class:"pd-button",onClick:h[6]||(h[6]=A=>i.value=!1)},"取消"),e.createElementVNode("button",{type:"button",class:"pd-button primary",onClick:Y},"确定")])])],32)):e.createCommentVNode("",!0)}}),Qe=ue(Qr,[["__scopeId","data-v-f3837718"]]),_r={class:"pd-field"},es={class:"pd-label"},ts=["value","placeholder"],os=e.defineComponent({__name:"BindingControl",props:{descriptor:{},modelValue:{},fields:{}},emits:["update:modelValue"],setup(t,{emit:l}){const o=l,n=e.ref(!1);function i(){n.value=!0}return(u,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",_r,[e.createElementVNode("span",es,e.toDisplayString(t.descriptor.label),1),e.createElementVNode("input",{value:t.modelValue,class:"pd-input",placeholder:t.descriptor.placeholder||"输入内容,支持 {字段} 表达式",onInput:a[0]||(a[0]=r=>o("update:modelValue",r.target.value)),onDblclick:i},null,40,ts)]),e.createVNode(Qe,{modelValue:n.value,"onUpdate:modelValue":a[1]||(a[1]=r=>n.value=r),fields:t.fields,expression:t.modelValue,"onUpdate:expression":a[2]||(a[2]=r=>o("update:modelValue",r))},null,8,["modelValue","fields","expression"])],64))}}),ns={class:"pd-field"},ls=["value"],as=["value"],is={class:"pd-field"},rs={class:"pd-field"},ss={class:"pd-field"},ds={class:"pd-field"},cs={style:{width:"60px"}},us=e.defineComponent({__name:"TableSettingsGroup",props:{element:{},fields:{}},setup(t){const l=t,o=e.inject(He,null),n=e.computed(()=>l.fields.filter(a=>a.fieldType==="list").map(a=>({label:a.fieldLabel,value:a.fieldKey})));function i(a){l.element.options.dataSource=a||void 0,o?.recordHistory()}function u(a,r){if(r===void 0)return;const d=l.element.options.tableColWidths,c=o?.maxTableWidth.value??1/0,m=d.reduce((f,g,p)=>p===a?f:f+g,0);if(m+r>c){const f=Math.max(5,Math.round((c-m)*10)/10);alert(`表格总宽不能超过打印范围宽度 ${c}mm,列${a+1} 已调整为 ${f}mm`),d[a]=f}else d[a]=r;b.syncTableElementSize(l.element.options),o?.recordHistory()}return(a,r)=>(e.openBlock(),e.createBlock(Be,{title:"表格设置",icon:"Grid","default-expanded":"","group-key":"table-settings"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:r[4]||(r[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",ns,[r[5]||(r[5]=e.createElementVNode("span",{class:"pd-label"},"列表数据源字段",-1)),e.createElementVNode("select",{value:t.element.options.dataSource,class:"pd-select",style:{width:"100%"},onChange:r[0]||(r[0]=d=>i(d.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,d=>(e.openBlock(),e.createElementBlock("option",{key:d.value,value:d.value},e.toDisplayString(d.label),9,as))),128))],40,ls)]),e.createElementVNode("div",is,[r[6]||(r[6]=e.createElementVNode("span",{class:"pd-label"},"默认字号 (pt)",-1)),e.createVNode(de,{modelValue:t.element.options.tableDefaultFontSize,"onUpdate:modelValue":r[1]||(r[1]=d=>t.element.options.tableDefaultFontSize=d),min:5,max:72,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",rs,[r[7]||(r[7]=e.createElementVNode("span",{class:"pd-label"},"默认文字颜色",-1)),e.createVNode(Ne,{modelValue:t.element.options.tableDefaultColor,"onUpdate:modelValue":r[2]||(r[2]=d=>t.element.options.tableDefaultColor=d)},null,8,["modelValue"])]),e.createElementVNode("div",ss,[r[8]||(r[8]=e.createElementVNode("span",{class:"pd-label"},"默认内边距 (mm)",-1)),e.createVNode(de,{modelValue:t.element.options.tableDefaultPadding,"onUpdate:modelValue":r[3]||(r[3]=d=>t.element.options.tableDefaultPadding=d),min:0,max:10,step:.5,placeholder:"默认"},null,8,["modelValue"])]),e.createElementVNode("div",ds,[r[9]||(r[9]=e.createElementVNode("span",{class:"pd-label"},"列宽 (mm)",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.element.options.tableColWidths,(d,c)=>(e.openBlock(),e.createElementBlock("div",{key:c,class:"col-width-row"},[e.createElementVNode("span",cs,"列"+e.toDisplayString(c+1),1),e.createVNode(de,{"model-value":d,min:5,max:200,"onUpdate:modelValue":m=>u(c,m)},null,8,["model-value","onUpdate:modelValue"])]))),128))])],32)]),_:1}))}}),ms=ue(us,[["__scopeId","data-v-b5fdc7ff"]]),ps={class:"border-row"},vs={class:"pd-field"},fs={class:"pd-field"},gs={class:"pd-field"},hs=e.defineComponent({__name:"BorderBgGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const l=t;function o(n){return l.searching?l.matchedKeys?.has(n)??!0:!0}return(n,i)=>(e.openBlock(),e.createBlock(Be,{title:"边框与背景",icon:"Picture","default-expanded":"","group-key":"border-bg"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:i[3]||(i[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",ps,[e.withDirectives(e.createElementVNode("div",vs,[i[4]||(i[4]=e.createElementVNode("span",{class:"pd-label"},"边框宽度",-1)),e.createVNode(de,{modelValue:t.element.options.borderWidth,"onUpdate:modelValue":i[0]||(i[0]=u=>t.element.options.borderWidth=u),min:0,max:20,step:.25},null,8,["modelValue"])],512),[[e.vShow,o("bb-border-width")]]),e.withDirectives(e.createElementVNode("div",fs,[i[5]||(i[5]=e.createElementVNode("span",{class:"pd-label"},"边框颜色",-1)),e.createVNode(Ne,{modelValue:t.element.options.borderColor,"onUpdate:modelValue":i[1]||(i[1]=u=>t.element.options.borderColor=u)},null,8,["modelValue"])],512),[[e.vShow,o("bb-border-color")]])]),e.withDirectives(e.createElementVNode("div",gs,[i[6]||(i[6]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ne,{modelValue:t.element.options.backgroundColor,"onUpdate:modelValue":i[2]||(i[2]=u=>t.element.options.backgroundColor=u)},null,8,["modelValue"])],512),[[e.vShow,o("bb-bg-color")]])],32)]),_:1}))}}),bs=ue(hs,[["__scopeId","data-v-e0e6d714"]]),Es={class:"advanced-row"},ys={class:"pd-field"},ks={class:"pd-field"},Vs={class:"pd-field"},Ns={class:"pd-field"},ws=e.defineComponent({__name:"AdvancedGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},emits:["delete-element"],setup(t){const l=t;function o(n){return l.searching?l.matchedKeys?.has(n)??!0:!0}return(n,i)=>(e.openBlock(),e.createBlock(Be,{title:"高级设置",icon:"Setting","group-key":"advanced"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:i[4]||(i[4]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Es,[e.withDirectives(e.createElementVNode("div",ys,[i[5]||(i[5]=e.createElementVNode("span",{class:"pd-label"},"锁定",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":i[0]||(i[0]=u=>t.element.options.locked=u)},null,512),[[e.vModelCheckbox,t.element.options.locked]])],512),[[e.vShow,o("ad-locked")]]),e.withDirectives(e.createElementVNode("div",ks,[i[6]||(i[6]=e.createElementVNode("span",{class:"pd-label"},"每页重复",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"pd-switch","onUpdate:modelValue":i[1]||(i[1]=u=>t.element.options.fixed=u)},null,512),[[e.vModelCheckbox,t.element.options.fixed]])],512),[[e.vShow,o("ad-fixed")]])]),e.withDirectives(e.createElementVNode("div",Vs,[i[7]||(i[7]=e.createElementVNode("span",{class:"pd-label"},"层级",-1)),e.createVNode(de,{modelValue:t.element.options.zIndex,"onUpdate:modelValue":i[2]||(i[2]=u=>t.element.options.zIndex=u),min:0,max:999},null,8,["modelValue"])],512),[[e.vShow,o("ad-z-index")]]),e.withDirectives(e.createElementVNode("div",Ns,[e.createElementVNode("button",{type:"button",class:"pd-button danger",onClick:i[3]||(i[3]=u=>n.$emit("delete-element"))}," 删除元素 ")],512),[[e.vShow,o("ad-delete")]])],32)]),_:1}))}}),Cs=ue(ws,[["__scopeId","data-v-14924be2"]]),Ss={key:0,class:"pd-field"},xs=["checked"],Bs={class:"pd-field"},$s=["checked"],Ds={class:"pd-field"},Ts=["checked"],zt=e.defineComponent({__name:"PaginationGroup",props:{element:{},matchedKeys:{},searching:{type:Boolean}},setup(t){const l=t,o=e.computed(()=>l.element.printElementType.type==="table"),n=e.computed({get:()=>l.element.options.tablePagination?.enabled??!0,set:()=>{}});function i(m){l.element.options.tablePagination={enabled:m}}const u=e.computed({get:()=>l.element.options.pagination?.pageable??!0,set:()=>{}}),a=e.computed({get:()=>l.element.options.pagination?.keepWithNext??!1,set:()=>{}});function r(m){l.element.options.pagination={pageable:m,keepWithNext:a.value}}function d(m){l.element.options.pagination={pageable:u.value,keepWithNext:m}}function c(m){return l.searching?l.matchedKeys?.has(m)??!0:!0}return(m,f)=>(e.openBlock(),e.createBlock(Be,{title:"分页配置",icon:"Document","group-key":"pagination"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:f[3]||(f[3]=e.withModifiers(()=>{},["prevent"]))},[o.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",Ss,[f[4]||(f[4]=e.createElementVNode("span",{class:"pd-label"},"启用分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:n.value,onChange:f[0]||(f[0]=g=>i(g.target.checked))},null,40,xs)],512)),[[e.vShow,c("pg-enabled")]]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.withDirectives(e.createElementVNode("div",Bs,[f[5]||(f[5]=e.createElementVNode("span",{class:"pd-label"},"参与分页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:u.value,onChange:f[1]||(f[1]=g=>r(g.target.checked))},null,40,$s)],512),[[e.vShow,c("pg-pageable")]]),e.withDirectives(e.createElementVNode("div",Ds,[f[6]||(f[6]=e.createElementVNode("span",{class:"pd-label"},"与下元素同页",-1)),e.createElementVNode("input",{type:"checkbox",class:"pd-switch",checked:a.value,onChange:f[2]||(f[2]=g=>d(g.target.checked))},null,40,Ts)],512),[[e.vShow,c("pg-keep-with-next")]])],64))],32)]),_:1}))}}),Ms={class:"image-content-upload"},zs=["disabled"],As=e.defineComponent({__name:"ImageContentUpload",props:{disabled:{type:Boolean}},emits:["success"],setup(t,{emit:l}){const o=t,n=l,i=e.ref(!1),u=e.inject(ft,e.computed(()=>{})),a=e.computed(()=>o.disabled||i.value||!u.value);async function r(d){const c=d.target,m=c.files?.[0];if(m){if(!m.type.startsWith("image/")){alert("仅支持上传图片文件"),c.value="";return}if(!u.value){alert("图片上传能力未配置"),c.value="";return}i.value=!0;try{const f=await u.value(m);f?n("success",f):alert("图片上传失败")}catch(f){alert(f instanceof Error?f.message:"图片上传失败")}finally{i.value=!1,c.value=""}}}return(d,c)=>(e.openBlock(),e.createElementBlock("div",Ms,[e.createElementVNode("label",{class:e.normalizeClass(["pd-button small upload-label",{disabled:a.value}])},[c[0]||(c[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(i.value?"上传中...":"上传图片")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:a.value,onChange:r},null,40,zs)],2),c[1]||(c[1]=e.createElementVNode("p",{class:"upload-tip"},"支持 jpg/png/gif/bmp/webp/svg 等图片,上传后填入相对路径",-1))]))}}),Ps=ue(As,[["__scopeId","data-v-b730e8e6"]]),Rs={class:"pd-field"},Ls=["value"],Us={class:"pd-field"},Is={key:0,class:"pd-field"},Fs=["checked"],Os=e.defineComponent({__name:"TableRowGroup",props:{element:{},selection:{}},setup(t){const l=t,o=e.inject(He),n=e.computed(()=>l.element.options.tableRows[l.selection.r1]);function i(r){const d=b.setRowType(l.element.options.tableRows,l.selection.r1,r);if(d){alert(d);return}o.recordHistory()}function u(r){r!==void 0&&(n.value.height=r,b.syncTableElementSize(l.element.options),o.recordHistory())}function a(r){b.setHeaderRepeat(l.element.options.tableRows,r),o.recordHistory()}return(r,d)=>(e.openBlock(),e.createBlock(Be,{title:"行属性",icon:"Grid","default-expanded":"","group-key":"table-row"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:d[2]||(d[2]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Rs,[d[4]||(d[4]=e.createElementVNode("span",{class:"pd-label"},"行类型",-1)),e.createElementVNode("select",{value:n.value.type,class:"pd-select",style:{width:"100%"},onChange:d[0]||(d[0]=c=>i(c.target.value))},[...d[3]||(d[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,Ls)]),e.createElementVNode("div",Us,[d[5]||(d[5]=e.createElementVNode("span",{class:"pd-label"},"行高 (mm)",-1)),e.createVNode(de,{"model-value":n.value.height,min:3,max:100,step:.5,"onUpdate:modelValue":u},null,8,["model-value"])]),n.value.type==="header"?(e.openBlock(),e.createElementBlock("div",Is,[d[6]||(d[6]=e.createElementVNode("span",{class:"pd-label",title:"多级表头作为一个结构整体重复,勾选后表头区所有行都会在每页顶部重复"},"表头每页重复",-1)),e.createElementVNode("input",{checked:n.value.repeatOnPage??!1,type:"checkbox",class:"pd-switch",onInput:d[1]||(d[1]=c=>a(!!c.target.checked))},null,40,Fs)])):e.createCommentVNode("",!0)],32)]),_:1}))}}),Hs={class:"pd-field"},Ws={class:"pd-radio-group",role:"radiogroup"},Gs={class:"pd-radio"},qs=["checked"],Ks={class:"pd-radio"},js=["checked"],Ys={class:"pd-radio"},Xs=["checked"],Zs={class:"pd-radio"},Js=["checked"],Qs={key:0,class:"pd-field"},_s=["value"],ed={key:1,class:"pd-field"},td=["checked"],od={key:2,class:"pd-field"},nd={key:3,class:"pd-hint"},ld={key:4,class:"pd-field"},ad={key:5,class:"pd-field"},id=["value"],rd={key:6,class:"pd-hint"},sd={key:7,class:"pd-field"},dd=["value"],cd={key:8,class:"pd-field"},ud={class:"pd-label"},md=["data-tip"],pd={key:9,class:"pd-hint"},vd={key:10,class:"pd-field"},fd=["value"],gd={key:11,class:"pd-field"},hd=["value"],bd={key:12,class:"pd-field"},Ed={key:13,class:"pd-field"},yd={class:"pd-field"},kd=["value"],Vd={class:"pd-field"},Nd={class:"pd-radio-group",role:"radiogroup"},wd={class:"pd-radio"},Cd=["checked"],Sd={class:"pd-radio"},xd=["checked"],Bd={class:"pd-radio"},$d=["checked"],Dd={class:"pd-radio"},Td=["checked"],Md={class:"pd-field"},zd={class:"pd-radio-group",role:"radiogroup"},Ad={class:"pd-radio"},Pd=["checked"],Rd={class:"pd-radio"},Ld=["checked"],Ud={class:"pd-radio"},Id=["checked"],Fd={class:"cell-style-grid"},Od={class:"pd-field cell-font-field"},Hd={class:"pd-field"},Wd={class:"pd-field"},Gd=["checked"],qd={class:"pd-field"},Kd={class:"pd-field"},jd={class:"border-style-row"},Yd={style:{width:"112px","flex-shrink":"0"}},Xd={class:"pd-button-group border-presets"},Zd={class:"pd-checkbox-group"},Jd={class:"pd-checkbox"},Qd={class:"pd-checkbox"},_d={class:"pd-checkbox"},ec={class:"pd-checkbox"},tc={class:"pd-field"},oc={class:"pd-field"},nc=["checked"],lc={key:14,class:"pd-field"},ac=["value"],ic={key:15,class:"pd-field"},rc={class:"merge-btns"},sc=["disabled","title"],dc=["disabled"],cc=e.defineComponent({__name:"TableCellGroup",props:{element:{},selection:{},fields:{}},setup(t,{expose:l}){const o=b.propertyTip("cd-quiet-zone"),n=t,i=e.inject(He),u=e.computed(()=>n.element.options.tableRows),a=e.computed(()=>{const B=b.findMainCell(u.value,n.selection.r1,n.selection.c1);return u.value[B.r].cells[B.c]}),r=e.ref(!1),d=e.ref(""),c=e.computed(()=>a.value.cellType==="barcode"),m=e.computed(()=>a.value.cellType==="qrcode"),f=e.computed(()=>a.value.cellType==="image"),g=e.computed(()=>c.value&&!!a.value.printerDpi),p=e.computed(()=>!c.value&&!m.value&&!f.value),w=e.computed(()=>b.resolveCellTextFit(a.value));function C(B){const s=B.target.value;L(x=>{x.textFit=s})}function N(B){L(s=>{s.align=B})}function v(B){L(s=>{s.valign=B})}function $(B){const s=Number(B);L(x=>{x.printerDpi=s>0?s:void 0})}function W(B){L(s=>{s.cellType=B==="text"?void 0:B,B!=="barcode"&&(s.barcodeType=void 0,s.showBarcodeText=void 0,s.printerDpi=void 0),B!=="qrcode"&&(s.qrCodeLevel=void 0,s.qrQuietZone=void 0)})}function te(){d.value=a.value.formatter||"",r.value=!0}function J(B){L(s=>{s.formatter=B||void 0})}function L(B){const s=n.selection;for(let x=s.r1;x<=s.r2;x++)for(let ee=s.c1;ee<=s.c2;ee++){const he=u.value[x].cells[ee];he.merged||B(he)}i.recordHistory()}const E=e.ref("solid"),O=e.ref(.75),Y=e.ref("#333333"),z=e.ref([]);function h(){return{width:O.value,style:E.value,color:Y.value}}function A(B){b.applyBorderPreset(u.value,n.selection,B,h()),i.recordHistory()}function k(B){const s=B.target,x=new Set(z.value);s.checked?x.add(s.value):x.delete(s.value),z.value=[...x];const ee=h();L(he=>{const ge={...he.borders??{}};for(const se of["top","right","bottom","left"])x.has(se)?ge[se]={...ee}:delete ge[se];he.borders=ge})}const H=e.computed(()=>b.canMergeReason(u.value,n.selection)),G=e.computed(()=>{const B=n.selection;for(let s=B.r1;s<=B.r2;s++)for(let x=B.c1;x<=B.c2;x++){const ee=u.value[s].cells[x];if(!ee.merged&&((ee.rowspan??1)>1||(ee.colspan??1)>1))return!0}return!1});function q(){b.mergeCells(u.value,n.selection),i.recordHistory()}function _(){b.splitCells(u.value,n.selection),i.recordHistory()}return l({openFormatterEditor:te}),(B,s)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Be,{title:"单元格",icon:"Menu","default-expanded":"","group-key":"table-cell"},{default:e.withCtx(()=>[e.createElementVNode("form",{class:"pd-form",onSubmit:s[46]||(s[46]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Hs,[s[52]||(s[52]=e.createElementVNode("span",{class:"pd-label"},"单元格类型",-1)),e.createElementVNode("div",Ws,[e.createElementVNode("label",Gs,[e.createElementVNode("input",{type:"radio",value:"text",checked:(a.value.cellType||"text")==="text",onChange:s[0]||(s[0]=x=>W(x.target.value))},null,40,qs),s[48]||(s[48]=e.createElementVNode("span",null,"文本",-1))]),e.createElementVNode("label",Ks,[e.createElementVNode("input",{type:"radio",value:"barcode",checked:a.value.cellType==="barcode",onChange:s[1]||(s[1]=x=>W(x.target.value))},null,40,js),s[49]||(s[49]=e.createElementVNode("span",null,"条形码",-1))]),e.createElementVNode("label",Ys,[e.createElementVNode("input",{type:"radio",value:"qrcode",checked:a.value.cellType==="qrcode",onChange:s[2]||(s[2]=x=>W(x.target.value))},null,40,Xs),s[50]||(s[50]=e.createElementVNode("span",null,"二维码",-1))]),e.createElementVNode("label",Zs,[e.createElementVNode("input",{type:"radio",value:"image",checked:a.value.cellType==="image",onChange:s[3]||(s[3]=x=>W(x.target.value))},null,40,Js),s[51]||(s[51]=e.createElementVNode("span",null,"图片",-1))])])]),c.value?(e.openBlock(),e.createElementBlock("div",Qs,[s[54]||(s[54]=e.createElementVNode("span",{class:"pd-label"},"码制",-1)),e.createElementVNode("select",{value:a.value.barcodeType||"CODE128",class:"pd-select",onChange:s[4]||(s[4]=x=>L(ee=>{ee.barcodeType=x.target.value||void 0}))},[...s[53]||(s[53]=[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,_s)])):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("div",ed,[s[55]||(s[55]=e.createElementVNode("span",{class:"pd-label"},"显示文本",-1)),e.createElementVNode("input",{checked:a.value.showBarcodeText!==!1,type:"checkbox",class:"pd-switch",onInput:s[5]||(s[5]=x=>L(ee=>{ee.showBarcodeText=!!x.target.checked}))},null,40,td)])):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("div",od,[s[56]||(s[56]=e.createElementVNode("span",{class:"pd-label"},"条宽(倍率)",-1)),e.createVNode(de,{"model-value":a.value.barWidth??2,min:2,max:4,step:.5,"onUpdate:modelValue":s[6]||(s[6]=x=>L(ee=>{ee.barWidth=x}))},null,8,["model-value"])])):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("p",nd,e.toDisplayString(g.value?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),单元格放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定"),1)):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("div",ld,[s[57]||(s[57]=e.createElementVNode("span",{class:"pd-label"},"文本字号(相对条高,条高为 30)",-1)),e.createVNode(de,{"model-value":a.value.barFontSize??10,min:5,max:24,placeholder:"默认 10","onUpdate:modelValue":s[7]||(s[7]=x=>L(ee=>{ee.barFontSize=x??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("div",ad,[s[59]||(s[59]=e.createElementVNode("span",{class:"pd-label"},"打印机分辨率",-1)),e.createElementVNode("select",{value:a.value.printerDpi?String(a.value.printerDpi):"",class:"pd-select",onChange:s[8]||(s[8]=x=>$(x.target.value))},[...s[58]||(s[58]=[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,id)])):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("p",rd,"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小")):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createElementBlock("div",sd,[s[61]||(s[61]=e.createElementVNode("span",{class:"pd-label"},"纠错级别",-1)),e.createElementVNode("select",{value:a.value.qrCodeLevel||"M",class:"pd-select",onChange:s[9]||(s[9]=x=>L(ee=>{ee.qrCodeLevel=x.target.value||void 0}))},[...s[60]||(s[60]=[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,dd)])):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createElementBlock("div",cd,[e.createElementVNode("span",ud,[s[62]||(s[62]=e.createTextVNode("静区 (模块)",-1)),e.createElementVNode("button",{type:"button",class:"pd-help","data-tip":e.unref(o),"aria-label":"字段说明"},null,8,md)]),e.createVNode(de,{"model-value":a.value.qrQuietZone,min:0,max:8,placeholder:"默认 0","onUpdate:modelValue":s[10]||(s[10]=x=>L(ee=>{ee.qrQuietZone=x??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("p",pd,"单元格条码尺寸由「条宽」与「打印机分辨率」结算:可用宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限")):e.createCommentVNode("",!0),m.value||f.value?(e.openBlock(),e.createElementBlock("div",vd,[s[64]||(s[64]=e.createElementVNode("span",{class:"pd-label"},"缩放模式",-1)),e.createElementVNode("select",{value:a.value.fit||"contain",class:"pd-select",onChange:s[11]||(s[11]=x=>L(ee=>{ee.fit=x.target.value}))},[...s[63]||(s[63]=[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,fd)])):e.createCommentVNode("",!0),f.value?(e.openBlock(),e.createElementBlock("div",gd,[s[65]||(s[65]=e.createElementVNode("span",{class:"pd-label"},"裁剪锚点",-1)),e.createElementVNode("input",{class:"pd-input",type:"text",value:a.value.objectPosition??"",placeholder:"缺省居中,如 center 20%",onChange:s[12]||(s[12]=x=>L(ee=>{ee.objectPosition=x.target.value.trim()||void 0}))},null,40,hd)])):e.createCommentVNode("",!0),c.value||m.value||f.value?(e.openBlock(),e.createElementBlock("div",bd,[s[66]||(s[66]=e.createElementVNode("span",{class:"pd-label"},"最大宽度 (mm)",-1)),e.createVNode(de,{"model-value":a.value.maxWidth,min:1,max:200,placeholder:"默认","onUpdate:modelValue":s[13]||(s[13]=x=>L(ee=>{ee.maxWidth=x??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),c.value||m.value||f.value?(e.openBlock(),e.createElementBlock("div",Ed,[s[67]||(s[67]=e.createElementVNode("span",{class:"pd-label"},"最大高度 (mm)",-1)),e.createVNode(de,{"model-value":a.value.maxHeight,min:1,max:200,placeholder:"默认","onUpdate:modelValue":s[14]||(s[14]=x=>L(ee=>{ee.maxHeight=x??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",yd,[s[68]||(s[68]=e.createElementVNode("span",{class:"pd-label"},"内容",-1)),e.createElementVNode("input",{value:a.value.formatter||"",class:"pd-input",placeholder:"输入内容,支持 {字段} 表达式",onInput:s[15]||(s[15]=x=>L(ee=>{ee.formatter=x.target.value||void 0})),onDblclick:te},null,40,kd)]),e.createElementVNode("div",Vd,[s[73]||(s[73]=e.createElementVNode("span",{class:"pd-label"},"水平对齐",-1)),e.createElementVNode("div",Nd,[e.createElementVNode("label",wd,[e.createElementVNode("input",{type:"radio",value:"left",checked:a.value.align==="left",onChange:s[16]||(s[16]=x=>N(x.target.value))},null,40,Cd),s[69]||(s[69]=e.createElementVNode("span",null,"左",-1))]),e.createElementVNode("label",Sd,[e.createElementVNode("input",{type:"radio",value:"center",checked:a.value.align==="center",onChange:s[17]||(s[17]=x=>N(x.target.value))},null,40,xd),s[70]||(s[70]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Bd,[e.createElementVNode("input",{type:"radio",value:"right",checked:a.value.align==="right",onChange:s[18]||(s[18]=x=>N(x.target.value))},null,40,$d),s[71]||(s[71]=e.createElementVNode("span",null,"右",-1))]),e.createElementVNode("label",Dd,[e.createElementVNode("input",{type:"radio",value:"justify",checked:a.value.align==="justify",onChange:s[19]||(s[19]=x=>N(x.target.value))},null,40,Td),s[72]||(s[72]=e.createElementVNode("span",null,"两端",-1))])])]),e.createElementVNode("div",Md,[s[77]||(s[77]=e.createElementVNode("span",{class:"pd-label"},"垂直对齐",-1)),e.createElementVNode("div",zd,[e.createElementVNode("label",Ad,[e.createElementVNode("input",{type:"radio",value:"top",checked:a.value.valign==="top",onChange:s[20]||(s[20]=x=>v(x.target.value))},null,40,Pd),s[74]||(s[74]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",Rd,[e.createElementVNode("input",{type:"radio",value:"middle",checked:a.value.valign==="middle",onChange:s[21]||(s[21]=x=>v(x.target.value))},null,40,Ld),s[75]||(s[75]=e.createElementVNode("span",null,"中",-1))]),e.createElementVNode("label",Ud,[e.createElementVNode("input",{type:"radio",value:"bottom",checked:a.value.valign==="bottom",onChange:s[22]||(s[22]=x=>v(x.target.value))},null,40,Id),s[76]||(s[76]=e.createElementVNode("span",null,"下",-1))])])]),e.createElementVNode("div",Fd,[e.createElementVNode("div",Od,[s[78]||(s[78]=e.createElementVNode("span",{class:"pd-label"},"字体",-1)),e.createVNode(kt,{"model-value":a.value.fontFamily,placeholder:"继承默认","onUpdate:modelValue":s[23]||(s[23]=x=>L(ee=>{ee.fontFamily=x}))},null,8,["model-value"])]),e.createElementVNode("div",Hd,[s[79]||(s[79]=e.createElementVNode("span",{class:"pd-label"},"字号 (pt)",-1)),e.createVNode(de,{"model-value":a.value.fontSize,min:5,max:72,placeholder:"默认","onUpdate:modelValue":s[24]||(s[24]=x=>L(ee=>{ee.fontSize=x??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",Wd,[s[80]||(s[80]=e.createElementVNode("span",{class:"pd-label"},"加粗",-1)),e.createElementVNode("input",{checked:a.value.fontWeight==="bold",type:"checkbox",class:"pd-switch",onInput:s[25]||(s[25]=x=>L(ee=>{ee.fontWeight=x.target.checked?"bold":void 0}))},null,40,Gd)]),e.createElementVNode("div",qd,[s[81]||(s[81]=e.createElementVNode("span",{class:"pd-label"},"文字颜色",-1)),e.createVNode(Ne,{"model-value":a.value.color,"onUpdate:modelValue":s[26]||(s[26]=x=>L(ee=>{ee.color=x}))},null,8,["model-value"])]),e.createElementVNode("div",Kd,[s[82]||(s[82]=e.createElementVNode("span",{class:"pd-label"},"背景色",-1)),e.createVNode(Ne,{"model-value":a.value.backgroundColor,"onUpdate:modelValue":s[27]||(s[27]=x=>L(ee=>{ee.backgroundColor=x}))},null,8,["model-value"])])]),s[93]||(s[93]=e.createElementVNode("h3",{class:"pd-divider"},"边框",-1)),e.createElementVNode("div",jd,[e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":s[28]||(s[28]=x=>E.value=x),style:{width:"90px"}},[...s[83]||(s[83]=[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,E.value]]),e.createElementVNode("div",Yd,[e.createVNode(de,{modelValue:O.value,"onUpdate:modelValue":s[29]||(s[29]=x=>O.value=x),min:.25,max:5,step:.25},null,8,["modelValue"])]),e.createVNode(Ne,{modelValue:Y.value,"onUpdate:modelValue":s[30]||(s[30]=x=>Y.value=x),clearable:!1},null,8,["modelValue"])]),e.createElementVNode("div",Xd,[e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:s[31]||(s[31]=x=>A("all"))},"全部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:s[32]||(s[32]=x=>A("outer"))},"外侧"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:s[33]||(s[33]=x=>A("inner"))},"内部"),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:s[34]||(s[34]=x=>A("none"))},"无")]),e.createElementVNode("div",Zd,[e.createElementVNode("label",Jd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s[35]||(s[35]=x=>z.value=x),value:"top",onChange:s[36]||(s[36]=x=>k(x))},null,544),[[e.vModelCheckbox,z.value]]),s[84]||(s[84]=e.createElementVNode("span",null,"上",-1))]),e.createElementVNode("label",Qd,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s[37]||(s[37]=x=>z.value=x),value:"right",onChange:s[38]||(s[38]=x=>k(x))},null,544),[[e.vModelCheckbox,z.value]]),s[85]||(s[85]=e.createElementVNode("span",null,"右",-1))]),e.createElementVNode("label",_d,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s[39]||(s[39]=x=>z.value=x),value:"bottom",onChange:s[40]||(s[40]=x=>k(x))},null,544),[[e.vModelCheckbox,z.value]]),s[86]||(s[86]=e.createElementVNode("span",null,"下",-1))]),e.createElementVNode("label",ec,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s[41]||(s[41]=x=>z.value=x),value:"left",onChange:s[42]||(s[42]=x=>k(x))},null,544),[[e.vModelCheckbox,z.value]]),s[87]||(s[87]=e.createElementVNode("span",null,"左",-1))])]),e.createElementVNode("div",tc,[s[88]||(s[88]=e.createElementVNode("span",{class:"pd-label"},"内边距 (mm)",-1)),e.createVNode(de,{"model-value":a.value.padding,min:0,max:10,step:.5,placeholder:"默认","onUpdate:modelValue":s[43]||(s[43]=x=>L(ee=>{ee.padding=x??void 0}))},null,8,["model-value"])]),e.createElementVNode("div",oc,[s[89]||(s[89]=e.createElementVNode("span",{class:"pd-label"},"自动换行",-1)),e.createElementVNode("input",{checked:a.value.wordWrap??!0,type:"checkbox",class:"pd-switch",onInput:s[44]||(s[44]=x=>L(ee=>{ee.wordWrap=!!x.target.checked}))},null,40,nc)]),p.value?(e.openBlock(),e.createElementBlock("div",lc,[s[91]||(s[91]=e.createElementVNode("span",{class:"pd-label"},"文字溢出",-1)),e.createElementVNode("select",{class:"pd-select",value:w.value,style:{width:"100%"},onChange:C},[...s[90]||(s[90]=[e.createElementVNode("option",{value:"clip"},"截断",-1),e.createElementVNode("option",{value:"shrink"},"自动缩小",-1),e.createElementVNode("option",{value:"autoHeight"},"自适应行高",-1)])],40,ac)])):e.createCommentVNode("",!0),p.value&&w.value==="shrink"?(e.openBlock(),e.createElementBlock("div",ic,[s[92]||(s[92]=e.createElementVNode("span",{class:"pd-label"},"最小字号 (pt)",-1)),e.createVNode(de,{"model-value":a.value.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6","onUpdate:modelValue":s[45]||(s[45]=x=>L(ee=>{ee.shrinkMinFontSize=x??void 0}))},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createElementVNode("div",rc,[e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!!H.value,title:H.value||"",onClick:q}," 合并单元格 ",8,sc),e.createElementVNode("button",{type:"button",class:"pd-button small",disabled:!G.value,onClick:_},"拆分单元格",8,dc)])],32)]),_:1}),e.createVNode(Qe,{modelValue:r.value,"onUpdate:modelValue":s[47]||(s[47]=x=>r.value=x),fields:t.fields,expression:d.value,"onUpdate:expression":J},null,8,["modelValue","fields","expression"])],64))}}),uc=ue(cc,[["__scopeId","data-v-2f71ec4e"]]),mc={class:"watermark-config"},pc={class:"pd-field"},vc={key:0,class:"pd-field"},fc={class:"pd-field"},gc={class:"pd-hint"},hc={class:"pd-field"},bc={class:"pd-field"},Ec={class:"pd-hint"},yc={class:"pd-field"},kc=["value"],Vc={class:"pd-field"},Nc=["min"],wc={class:"pd-field"},Cc=["min"],Sc=e.defineComponent({__name:"WatermarkConfig",props:{modelValue:{},fields:{}},emits:["update:modelValue"],setup(t,{emit:l}){const o=t,n=l,i=be.WATERMARK_DENSITY_PRESETS,u=be.WATERMARK_DEFAULTS.minTileWidth,a=be.WATERMARK_DEFAULTS.minTileHeight;function r(L){const E=L.trim();return E?/[{}]/.test(E)||/^[A-Za-z_$][\w$]*\s*\(/.test(E)?!0:/^[A-Za-z_$][\w$]*(\.[\w$]+)+$/.test(E):!1}function d(L){return L?L.mode==="binding"?L.binding??"":L.content??"":""}const c=e.ref(d(o.modelValue)),m=e.ref(o.modelValue?.testData||""),f=e.ref(!1),g=e.ref(o.modelValue?.mode==="binding"?"binding":"fixed"),p=e.reactive({rotate:o.modelValue?.rotate??be.WATERMARK_DEFAULTS.rotate,color:o.modelValue?.color||be.WATERMARK_DEFAULTS.color,opacity:o.modelValue?.opacity??be.WATERMARK_DEFAULTS.opacity,tileWidth:o.modelValue?.tileWidth??be.WATERMARK_DEFAULTS.tileWidth,tileHeight:o.modelValue?.tileHeight??be.WATERMARK_DEFAULTS.tileHeight}),w=e.computed(()=>g.value==="binding");e.watch(()=>o.modelValue,L=>{L&&(c.value=d(L),g.value=L.mode==="binding"?"binding":"fixed",m.value=L.testData||"",p.rotate=L.rotate??be.WATERMARK_DEFAULTS.rotate,p.color=L.color||be.WATERMARK_DEFAULTS.color,p.opacity=L.opacity??be.WATERMARK_DEFAULTS.opacity,p.tileWidth=L.tileWidth??be.WATERMARK_DEFAULTS.tileWidth,p.tileHeight=L.tileHeight??be.WATERMARK_DEFAULTS.tileHeight)},{deep:!0});const C=e.computed({get(){const{tileWidth:L,tileHeight:E}=p;for(const[O,Y]of Object.entries(i))if(L===Y.width&&E===Y.height)return O;return"custom"},set(L){const E=i[L];E&&(p.tileWidth=E.width,p.tileHeight=E.height)}});function N(){g.value=r(c.value)?"binding":"fixed",J()}function v(){N()}function $(){f.value=!0}function W(L){c.value=L,N()}function te(L){p.color=L,J()}function J(){const L={testData:m.value,rotate:p.rotate,color:p.color,opacity:p.opacity,tileWidth:p.tileWidth,tileHeight:p.tileHeight};n("update:modelValue",g.value==="binding"?{...L,mode:"binding",binding:c.value,content:""}:{...L,mode:"fixed",content:c.value,binding:""})}return(L,E)=>(e.openBlock(),e.createElementBlock("div",mc,[E[18]||(E[18]=e.createElementVNode("h3",{class:"pd-divider"},"水印",-1)),e.createElementVNode("form",{class:"pd-form",onSubmit:E[8]||(E[8]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",pc,[E[9]||(E[9]=e.createElementVNode("span",{class:"pd-label"},"水印表达式",-1)),e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":E[0]||(E[0]=O=>c.value=O),placeholder:"直接输入文字,或用表达式:{order.no}、{printDate}",title:"双击或点「编辑表达式」打开表达式弹框",onInput:v,onDblclick:$},null,544),[[e.vModelText,c.value]]),e.createElementVNode("button",{type:"button",class:"pd-button small",onClick:$},"编辑表达式")]),w.value?(e.openBlock(),e.createElementBlock("div",vc,[E[10]||(E[10]=e.createElementVNode("span",{class:"pd-label"},"测试值",-1)),e.withDirectives(e.createElementVNode("input",{class:"pd-input","onUpdate:modelValue":E[1]||(E[1]=O=>m.value=O),placeholder:"表达式取不到值时预览显示",onInput:J},null,544),[[e.vModelText,m.value]])])):e.createCommentVNode("",!0),e.createVNode(Qe,{modelValue:f.value,"onUpdate:modelValue":E[2]||(E[2]=O=>f.value=O),fields:t.fields,expression:c.value,"onUpdate:expression":W},null,8,["modelValue","fields","expression"]),e.createElementVNode("div",fc,[E[11]||(E[11]=e.createElementVNode("span",{class:"pd-label"},"旋转角度",-1)),e.withDirectives(e.createElementVNode("input",{type:"range",class:"pd-range","onUpdate:modelValue":E[3]||(E[3]=O=>p.rotate=O),min:-90,max:90,step:5,onChange:J},null,544),[[e.vModelText,p.rotate,void 0,{number:!0}]]),e.createElementVNode("span",gc,e.toDisplayString(p.rotate)+"°",1)]),e.createElementVNode("div",hc,[E[12]||(E[12]=e.createElementVNode("span",{class:"pd-label"},"颜色",-1)),e.createVNode(Ne,{"model-value":p.color,"onUpdate:modelValue":te},null,8,["model-value"])]),e.createElementVNode("div",bc,[E[13]||(E[13]=e.createElementVNode("span",{class:"pd-label"},"透明度",-1)),e.withDirectives(e.createElementVNode("input",{type:"range",class:"pd-range","onUpdate:modelValue":E[4]||(E[4]=O=>p.opacity=O),min:.05,max:.5,step:.05,onChange:J},null,544),[[e.vModelText,p.opacity,void 0,{number:!0}]]),e.createElementVNode("span",Ec,e.toDisplayString(p.opacity.toFixed(2)),1)]),e.createElementVNode("div",yc,[E[15]||(E[15]=e.createElementVNode("span",{class:"pd-label"},"密度",-1)),e.withDirectives(e.createElementVNode("select",{class:"pd-select","onUpdate:modelValue":E[5]||(E[5]=O=>C.value=O),style:{width:"100%"},onChange:J},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),(O,Y)=>(e.openBlock(),e.createElementBlock("option",{key:Y,value:Y},e.toDisplayString(O.label)+"("+e.toDisplayString(O.width)+"×"+e.toDisplayString(O.height)+")",9,kc))),128)),E[14]||(E[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",Vc,[E[16]||(E[16]=e.createElementVNode("span",{class:"pd-label"},"瓦片宽",-1)),e.withDirectives(e.createElementVNode("input",{type:"number",class:"pd-input","onUpdate:modelValue":E[6]||(E[6]=O=>p.tileWidth=O),min:e.unref(u),step:10,onChange:J},null,40,Nc),[[e.vModelText,p.tileWidth,void 0,{number:!0}]])]),e.createElementVNode("div",wc,[E[17]||(E[17]=e.createElementVNode("span",{class:"pd-label"},"瓦片高",-1)),e.withDirectives(e.createElementVNode("input",{type:"number",class:"pd-input","onUpdate:modelValue":E[7]||(E[7]=O=>p.tileHeight=O),min:e.unref(a),step:10,onChange:J},null,40,Cc),[[e.vModelText,p.tileHeight,void 0,{number:!0}]])])],64)):e.createCommentVNode("",!0)],32)]))}}),xc=ue(Sc,[["__scopeId","data-v-b55bfc50"]]),Bc={class:"design-background-config"},$c=["title"],Dc={class:"design-background-actions"},Tc=["disabled"],Mc=e.defineComponent({__name:"DesignBackgroundConfig",props:{modelValue:{}},emits:["update:modelValue"],setup(t,{emit:l}){const o=t,n=l,i=e.ref(!1),u=e.inject(gt,e.computed(()=>{})),a=e.computed(()=>i.value||!u.value),r=e.computed(()=>o.modelValue?.rotation??0);async function d(f){const g=f.target,p=g.files?.[0];if(p){if(!p.type.startsWith("image/")){alert("仅支持上传图片文件"),g.value="";return}if(!u.value){alert("设计背景上传能力未配置"),g.value="";return}i.value=!0;try{const w=await u.value(p);w?n("update:modelValue",{src:w,rotation:0}):alert("设计背景上传失败")}catch(w){alert(w instanceof Error?w.message:"设计背景上传失败")}finally{i.value=!1,g.value=""}}}function c(){if(!o.modelValue?.src)return;const f=(r.value+90)%360;n("update:modelValue",{src:o.modelValue.src,rotation:f})}function m(){n("update:modelValue",void 0)}return(f,g)=>(e.openBlock(),e.createElementBlock("div",Bc,[g[0]||(g[0]=e.createElementVNode("h3",{class:"pd-divider"},"设计背景",-1)),g[1]||(g[1]=e.createElementVNode("p",{class:"design-background-tip"},"仅设计器显示,用于套打定位,不会出现在预览和打印中",-1)),t.modelValue?.src?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"design-background-path",title:t.modelValue.src},e.toDisplayString(t.modelValue.src),9,$c),e.createElementVNode("div",Dc,[e.createElementVNode("button",{type:"button",class:"pd-button small rotate-btn",onClick:c}," 旋转("+e.toDisplayString(r.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:a.value}])},[e.createTextVNode(e.toDisplayString(i.value?"上传中...":"上传背景图")+" ",1),e.createElementVNode("input",{class:"visually-hidden",type:"file",accept:"image/*",disabled:a.value,onChange:d},null,40,Tc)],2))]))}}),zc=ue(Mc,[["__scopeId","data-v-3f4d2e32"]]),Ac={class:"tiling-config","data-test":"tiling-config"},Pc={class:"pd-field"},Rc={class:"tiling-switch"},Lc=["checked","disabled"],Uc={key:0,class:"pd-hint tiling-error"},Ic={class:"pd-field"},Fc=["value"],Oc=["value"],Hc={key:0,class:"pd-field"},Wc={class:"custom-size-grid"},Gc={key:1,class:"pd-field"},qc={class:"pd-radio-group",role:"radiogroup"},Kc={class:"pd-radio"},jc=["checked"],Yc={class:"pd-radio"},Xc=["checked"],Zc={class:"margin-grid"},Jc={class:"pd-field"},Qc={class:"pd-field"},_c={class:"pd-field"},eu={class:"pd-field"},tu={class:"pd-field"},ou={class:"pd-field"},nu={class:"pd-field"},lu={key:2,class:"pd-hint tiling-summary"},au=e.defineComponent({__name:"TilingConfig",props:{modelValue:{},templateData:{}},emits:["update:modelValue"],setup(t,{emit:l}){const o=t,n=l,i=Object.keys(b.PAPER_PRESETS).filter(N=>N!=="CUSTOM"&&!b.PAPER_PRESETS[N]?.continuous),u=e.computed(()=>b.isContinuousPaperSize(o.templateData?.paperSize)),a=e.computed(()=>({...be.TILE_DEFAULTS,...o.modelValue??{},enabled:o.modelValue?.enabled??!1,sheetMargin:{...be.TILE_DEFAULTS.sheetMargin,...o.modelValue?.sheetMargin??{}}})),r=e.computed(()=>o.templateData?{...o.templateData,tiling:a.value}:void 0),d=e.computed(()=>r.value?be.validateTiling(r.value):[]),c=e.computed(()=>{const N=r.value;return N?Math.max(be.computeMaxColumns(N),1):1}),m=e.computed(()=>{const N=r.value;if(!(!N||d.value.length))try{return be.computeTileLayout(N)}catch{return}}),f=e.computed(()=>{const N=m.value,v=r.value;if(!N||!v)return"";const $=be.resolveSheetMm(v),W=a.value.sheetPaperSize==="CUSTOM"?"自定义":a.value.sheetPaperSize??"A4",te=a.value.sheetPaperSize==="CUSTOM"?"":a.value.sheetOrientation==="landscape"?" 横向":" 纵向";return`目标纸 ${W}${te} ${$.width}×${$.height}mm · ${N.columns} 列 × ${N.rows} 行 = 每张 ${N.perSheet} 格`});function g(N){n("update:modelValue",{...a.value,...N})}function p(N,v){g({sheetMargin:{...a.value.sheetMargin,[N]:v??0}})}function w(N){if(N!=="CUSTOM"){g({sheetPaperSize:N});return}const v=r.value,$=v?be.resolveSheetMm(v):{width:210,height:297};g({sheetPaperSize:"CUSTOM",sheetCustomWidth:a.value.sheetCustomWidth??$.width,sheetCustomHeight:a.value.sheetCustomHeight??$.height})}function C(N){if(!N){g({enabled:!1});return}const v=c.value,$=v>=1?Math.min(be.TILE_DEFAULTS.columns,v):1;g({...be.TILE_DEFAULTS,columns:$})}return(N,v)=>(e.openBlock(),e.createElementBlock("div",Ac,[v[30]||(v[30]=e.createElementVNode("h3",{class:"pd-divider"},"拼版打印",-1)),v[31]||(v[31]=e.createElementVNode("p",{class:"pd-hint"},"把标签按「列 × 行」铺到一张大纸上批量打印",-1)),e.createElementVNode("div",Pc,[e.createElementVNode("label",Rc,[e.createElementVNode("input",{type:"checkbox",checked:a.value.enabled,disabled:u.value,onChange:v[0]||(v[0]=$=>C($.target.checked))},null,40,Lc),v[13]||(v[13]=e.createElementVNode("span",null,"启用拼版",-1))]),u.value?(e.openBlock(),e.createElementBlock("p",Uc,"连续纸不支持拼版")):e.createCommentVNode("",!0)]),a.value.enabled&&!u.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Ic,[v[15]||(v[15]=e.createElementVNode("span",{class:"pd-label"},"目标纸张",-1)),e.createElementVNode("select",{class:"pd-select",style:{width:"100%"},value:a.value.sheetPaperSize??"A4",onChange:v[1]||(v[1]=$=>w($.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),$=>(e.openBlock(),e.createElementBlock("option",{key:$,value:$},e.toDisplayString(e.unref(b.PAPER_PRESETS)[$]?.label??$),9,Oc))),128)),v[14]||(v[14]=e.createElementVNode("option",{value:"CUSTOM"},"自定义",-1))],40,Fc)]),a.value.sheetPaperSize==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",Hc,[v[17]||(v[17]=e.createElementVNode("span",{class:"pd-label"},"目标纸宽高 (mm)",-1)),e.createElementVNode("div",Wc,[e.createVNode(de,{"model-value":a.value.sheetCustomWidth,min:25,max:2e3,"onUpdate:modelValue":v[2]||(v[2]=$=>g({sheetCustomWidth:$}))},null,8,["model-value"]),v[16]||(v[16]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(de,{"model-value":a.value.sheetCustomHeight,min:25,max:2e3,"onUpdate:modelValue":v[3]||(v[3]=$=>g({sheetCustomHeight:$}))},null,8,["model-value"])])])):(e.openBlock(),e.createElementBlock("div",Gc,[v[20]||(v[20]=e.createElementVNode("span",{class:"pd-label"},"目标纸方向",-1)),e.createElementVNode("div",qc,[e.createElementVNode("label",Kc,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:(a.value.sheetOrientation??"portrait")==="portrait",onChange:v[4]||(v[4]=$=>g({sheetOrientation:"portrait"}))},null,40,jc),v[18]||(v[18]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",Yc,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:a.value.sheetOrientation==="landscape",onChange:v[5]||(v[5]=$=>g({sheetOrientation:"landscape"}))},null,40,Xc),v[19]||(v[19]=e.createElementVNode("span",null,"横向",-1))])])])),v[28]||(v[28]=e.createElementVNode("h3",{class:"pd-divider"},"拼版留白 (mm)",-1)),e.createElementVNode("div",Zc,[e.createElementVNode("div",Jc,[v[21]||(v[21]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(de,{"model-value":a.value.sheetMargin.top,min:0,max:100,"onUpdate:modelValue":v[6]||(v[6]=$=>p("top",$))},null,8,["model-value"])]),e.createElementVNode("div",Qc,[v[22]||(v[22]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(de,{"model-value":a.value.sheetMargin.bottom,min:0,max:100,"onUpdate:modelValue":v[7]||(v[7]=$=>p("bottom",$))},null,8,["model-value"])]),e.createElementVNode("div",_c,[v[23]||(v[23]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(de,{"model-value":a.value.sheetMargin.left,min:0,max:100,"onUpdate:modelValue":v[8]||(v[8]=$=>p("left",$))},null,8,["model-value"])]),e.createElementVNode("div",eu,[v[24]||(v[24]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(de,{"model-value":a.value.sheetMargin.right,min:0,max:100,"onUpdate:modelValue":v[9]||(v[9]=$=>p("right",$))},null,8,["model-value"])])]),v[29]||(v[29]=e.createElementVNode("h3",{class:"pd-divider"},"格间距与列数",-1)),e.createElementVNode("div",tu,[v[25]||(v[25]=e.createElementVNode("span",{class:"pd-label"},"横向间距",-1)),e.createVNode(de,{"model-value":a.value.gapX,min:0,max:50,"onUpdate:modelValue":v[10]||(v[10]=$=>g({gapX:$??0}))},null,8,["model-value"])]),e.createElementVNode("div",ou,[v[26]||(v[26]=e.createElementVNode("span",{class:"pd-label"},"纵向间距",-1)),e.createVNode(de,{"model-value":a.value.gapY,min:0,max:50,"onUpdate:modelValue":v[11]||(v[11]=$=>g({gapY:$??0}))},null,8,["model-value"])]),e.createElementVNode("div",nu,[v[27]||(v[27]=e.createElementVNode("span",{class:"pd-label"},"列数",-1)),e.createVNode(de,{"model-value":a.value.columns,min:1,max:c.value,"onUpdate:modelValue":v[12]||(v[12]=$=>g({columns:$??1}))},null,8,["model-value","max"])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,$=>(e.openBlock(),e.createElementBlock("p",{key:$.code,class:"pd-hint tiling-error"},e.toDisplayString($.message),1))),128)),!d.value.length&&f.value?(e.openBlock(),e.createElementBlock("p",lu,e.toDisplayString(f.value),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]))}}),iu=ue(au,[["__scopeId","data-v-aa278268"]]),ru={key:0,class:"prop-collapsed"},su={class:"prop-head"},du={class:"pd-tabs prop-tabs"},cu={class:"pd-tab-bar",role:"tablist"},uu={class:"pd-tab-pane",role:"tabpanel"},mu={class:"property-content"},pu={key:1,class:"pd-empty"},vu={class:"pd-tab-pane",role:"tabpanel"},fu={class:"pd-field"},gu=["value"],hu=["label"],bu=["value"],Eu={key:0,class:"pd-hint"},yu={key:1,class:"pd-field"},ku={class:"pd-label"},Vu={class:"custom-size-grid"},Nu={key:2,class:"pd-field"},wu={class:"pd-radio-group",role:"radiogroup"},Cu={class:"pd-radio"},Su=["checked"],xu={class:"pd-radio"},Bu=["checked"],$u={key:3,class:"pd-field"},Du={class:"pd-radio-group pd-radio-group--2col",role:"radiogroup"},Tu={class:"pd-radio"},Mu=["checked"],zu={class:"pd-radio"},Au=["checked"],Pu={class:"pd-radio"},Ru=["checked"],Lu={class:"pd-radio"},Uu=["checked"],Iu={class:"pd-field"},Fu={class:"page-bg-row"},Ou={class:"page-bg-picker"},Hu={key:5,class:"pd-hint"},Wu={class:"margin-grid"},Gu={class:"pd-field"},qu={class:"pd-field"},Ku={class:"pd-field"},ju={class:"pd-field"},Yu={class:"pd-field"},Xu={class:"pd-field"},Zu=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(t,{emit:l}){const o=t,n=l,i=e.computed(()=>{const y=[];for(const[V,P]of Object.entries(b.PAPER_PRESETS)){if(o.multiPage&&b.isContinuousPaperSize(V))continue;const ie=P.group??"其他";let pe=y.find(ye=>ye.group===ie);pe||(pe={group:ie,items:[]},y.push(pe)),pe.items.push({key:V,label:P.label??V})}return y}),u=e.ref(""),a=e.computed(()=>o.element?["text","longText"].includes(o.element.printElementType.type):!1),r=e.computed(()=>o.element?o.element.printElementType.type==="image":!1),d=e.computed(()=>o.element?["barcode","qrcode"].includes(o.element.printElementType.type):!1),c=e.computed(()=>!o.element||o.element.printElementType.type!=="table"?!1:!!o.tableSelection&&o.tableSelection.elementId===o.element.id),m=e.computed(()=>o.element?o.element.printElementType.type==="table":!1),f=e.computed(()=>b.searchProperties(u.value)),g=e.computed(()=>f.value.groups),p=e.computed(()=>f.value.itemKeys),w=e.computed(()=>!!u.value.trim()),C=e.computed(()=>{if(!o.element)return[];if(o.element.printElementType.type==="table"&&o.tableSelection){const{r1:y,c1:V}=o.tableSelection,P=o.element.options.tableRows;if(P&&P[y]){const ie=P[y],pe=o.element.options.fields?.[0]?.dataSource;return b.getTableCellBindings(ie.type,y,V,pe)}}return b.getElementBindings(o.element)});function N(y){return y.split(".").flatMap(V=>{const P=V.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!P)return[V];const ie=P[1],pe=[...P[2].matchAll(/\[(\d+)\]/g)].map(ye=>Number(ye[1]));return[ie,...pe]})}function v(y){return o.element?N(y).reduce((ie,pe)=>ie==null?"":ie[pe],o.element)??"":""}function $(y,V){if(!o.element)return;const P=N(y),ie=P.pop(),pe=P.reduce((ye,we)=>((ye[we]===void 0||ye[we]===null)&&(ye[we]={}),ye[we]),o.element);pe[ie]=V||void 0,o.recordHistory?.()}function W(y){u.value=y}function te(y){o.element&&$("options.src",y)}const J=e.computed(()=>o.templateData?.paperSize||"A4"),L=e.computed(()=>!o.multiPage&&b.isContinuousPaperSize(J.value)),E=e.computed(()=>b.isLabelPaperSize(J.value)),O=e.computed(()=>o.templateData?.orientation||"portrait"),Y=e.computed(()=>!!o.templateData?.tiling?.enabled),z=e.computed(()=>o.templateData?.outputRotation??0),h=e.computed({get:()=>o.templateData?.pageBackground||"#ffffff",set:y=>j(y)}),A=e.computed(()=>o.templateData?.margins.top??10),k=e.computed(()=>o.templateData?.margins.bottom??10),H=e.computed(()=>o.templateData?.margins.left??10),G=e.computed(()=>o.templateData?.margins.right??10),q=e.computed(()=>o.templateData?.header.height??10),_=e.computed(()=>o.templateData?.footer.height??10),B=e.computed(()=>o.templateData?.customWidth??b.PAPER_PRESETS[J.value]?.width??210),s=e.computed(()=>o.templateData?.customHeight??297),x=e.computed(()=>o.templateData?.designBackground);function ee(y){if(o.templateData){if(!y){const V={...o.templateData};delete V.designBackground,n("update:templateData",V);return}se({designBackground:y})}}const he=e.computed(()=>o.templateData?.watermark??{});function ge(y){se({watermark:y})}function se(y){if(!o.templateData)return;const V={...o.templateData,...y};n("update:templateData",V)}function K(y){if(o.templateData){if(b.isContinuousPaperSize(y)){se({paperSize:y,customWidth:y==="CONTINUOUS"?o.templateData?.customWidth??80:void 0,orientation:"portrait",margins:{...o.templateData.margins,bottom:o.templateData?.margins.bottom??0}});return}if(y==="CUSTOM"){se({paperSize:"CUSTOM"});return}if(b.PAPER_PRESETS[y]){if(b.isLabelPaperSize(y)){se({paperSize:y,...b.labelPaperDefaults(o.templateData)});return}se({paperSize:y})}}}function S(y){se({orientation:String(y)})}function T(y){se({outputRotation:Number(y)})}function j(y){const V=y&&y.toLowerCase()!=="#ffffff"&&y.toLowerCase()!=="#fff"?y:void 0;se(V===void 0?{pageBackground:void 0}:{pageBackground:V})}function Z(){se({pageBackground:void 0})}function ne(y){y!==void 0&&se({customWidth:y})}function ve(y){y!==void 0&&se({customHeight:y})}function M(y){y!==void 0&&se({margins:{...o.templateData.margins,top:y}})}function D(y){y!==void 0&&se({margins:{...o.templateData.margins,bottom:y}})}function U(y){y!==void 0&&se({margins:{...o.templateData.margins,left:y}})}function oe(y){y!==void 0&&se({margins:{...o.templateData.margins,right:y}})}function le(y){y!==void 0&&se({header:{...o.templateData.header,height:y}})}function me(y){y!==void 0&&se({footer:{...o.templateData.footer,height:y}})}const R=e.computed(()=>o.activeTab||"page");function I(y){n("update:activeTab",y),n("toggle-collapse")}return(y,V)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["property-panel",{collapsed:t.collapsed}])},[t.collapsed?(e.openBlock(),e.createElementBlock("div",ru,[e.createElementVNode("button",{class:"pc-btn",title:"展开属性台",onClick:V[0]||(V[0]=P=>I(R.value))},"«"),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:R.value==="element"}]),title:"元素属性",onClick:V[1]||(V[1]=P=>I("element"))},"▦",2),e.createElementVNode("button",{class:e.normalizeClass(["pc-btn",{on:R.value==="page"}]),title:"页面属性",onClick:V[2]||(V[2]=P=>I("page"))},"▤",2)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",su,[V[18]||(V[18]=e.createElementVNode("span",{class:"prop-title"},"属性台",-1)),e.createElementVNode("button",{class:"collapse-btn",title:"收起属性台",onClick:V[3]||(V[3]=P=>y.$emit("toggle-collapse"))},"»")]),e.createElementVNode("div",du,[e.createElementVNode("div",cu,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(t.activeTab||"page")==="element"}]),onClick:V[4]||(V[4]=P=>y.$emit("update:activeTab","element"))},"元素属性",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["pd-tab",{active:(t.activeTab||"page")==="page"}]),onClick:V[5]||(V[5]=P=>y.$emit("update:activeTab","page"))},"页面属性",2)]),e.withDirectives(e.createElementVNode("div",uu,[t.element?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(_a,{onSearch:W}),e.createElementVNode("div",mu,[g.value.includes("position-size")&&!c.value?(e.openBlock(),e.createBlock(ui,{key:0,element:t.element,"matched-keys":p.value,searching:w.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("appearance")?(e.openBlock(),e.createBlock(ji,{key:1,element:t.element,"is-text-type":a.value,"matched-keys":p.value,searching:w.value},null,8,["element","is-text-type","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("code")&&d.value?(e.openBlock(),e.createBlock(pr,{key:2,element:t.element,"matched-keys":p.value,searching:w.value,onChange:V[6]||(V[6]=P=>t.recordHistory?.())},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("binding")?(e.openBlock(),e.createBlock(Be,{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,P=>(e.openBlock(),e.createBlock(os,{key:P.targetPath,descriptor:P,fields:t.fields,"model-value":v(P.targetPath),"onUpdate:modelValue":ie=>$(P.targetPath,ie)},null,8,["descriptor","fields","model-value","onUpdate:modelValue"]))),128)),r.value?(e.openBlock(),e.createBlock(Ps,{key:0,onSuccess:te})):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),m.value&&t.tableSelection&&t.tableSelection.elementId===t.element.id?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createVNode(Os,{element:t.element,selection:t.tableSelection},null,8,["element","selection"]),e.createVNode(uc,{element:t.element,selection:t.tableSelection,fields:t.fields},null,8,["element","selection","fields"])],64)):e.createCommentVNode("",!0),m.value&&g.value.includes("content")?(e.openBlock(),e.createBlock(ms,{key:5,element:t.element,fields:t.fields},null,8,["element","fields"])):e.createCommentVNode("",!0),g.value.includes("border-bg")?(e.openBlock(),e.createBlock(bs,{key:6,element:t.element,"matched-keys":p.value,searching:w.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("pagination")&&m.value?(e.openBlock(),e.createBlock(zt,{key:7,element:t.element,"matched-keys":p.value,searching:w.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("pagination")&&!m.value?(e.openBlock(),e.createBlock(zt,{key:8,element:t.element,"matched-keys":p.value,searching:w.value},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0),g.value.includes("advanced")?(e.openBlock(),e.createBlock(Cs,{key:9,element:t.element,"matched-keys":p.value,searching:w.value,onDeleteElement:V[7]||(V[7]=P=>y.$emit("delete-element"))},null,8,["element","matched-keys","searching"])):e.createCommentVNode("",!0)])],64)):(e.openBlock(),e.createElementBlock("p",pu,"请在画布中选择一个元素"))],512),[[e.vShow,(t.activeTab||"page")==="element"]]),e.withDirectives(e.createElementVNode("div",vu,[e.createElementVNode("form",{class:"pd-form",onSubmit:V[17]||(V[17]=e.withModifiers(()=>{},["prevent"]))},[V[39]||(V[39]=e.createElementVNode("h3",{class:"pd-divider"},"纸张设置",-1)),e.createElementVNode("div",fu,[V[20]||(V[20]=e.createElementVNode("span",{class:"pd-label"},"纸张尺寸",-1)),e.createElementVNode("select",{value:J.value,class:"pd-select",onChange:V[8]||(V[8]=P=>K(P.target.value)),style:{width:"100%"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,P=>(e.openBlock(),e.createElementBlock("optgroup",{key:P.group,label:P.group},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P.items,ie=>(e.openBlock(),e.createElementBlock("option",{key:ie.key,value:ie.key},e.toDisplayString(ie.label),9,bu))),128))],8,hu))),128)),V[19]||(V[19]=e.createElementVNode("option",{value:"CUSTOM"},"自定义宽高",-1))],40,gu)]),E.value?(e.openBlock(),e.createElementBlock("p",Eu,"标签纸默认整张给内容区:已取消页边距与页眉页脚,可在下方自行改回")):e.createCommentVNode("",!0),L.value||J.value==="CUSTOM"?(e.openBlock(),e.createElementBlock("div",yu,[e.createElementVNode("span",ku,e.toDisplayString(L.value?"纸宽 (mm)":"自定义宽高 (mm)"),1),e.createElementVNode("div",Vu,[e.createVNode(de,{"model-value":B.value,min:25,max:2e3,"onUpdate:modelValue":ne},null,8,["model-value"]),J.value==="CUSTOM"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[V[21]||(V[21]=e.createElementVNode("span",{class:"custom-size-x"},"×",-1)),e.createVNode(de,{"model-value":s.value,min:25,max:2e3,"onUpdate:modelValue":ve},null,8,["model-value"])],64)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),L.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Nu,[V[24]||(V[24]=e.createElementVNode("span",{class:"pd-label"},"纸张方向",-1)),e.createElementVNode("div",wu,[e.createElementVNode("label",Cu,[e.createElementVNode("input",{type:"radio",value:"portrait",checked:O.value==="portrait",onChange:V[9]||(V[9]=P=>S(P.target.value))},null,40,Su),V[22]||(V[22]=e.createElementVNode("span",null,"纵向",-1))]),e.createElementVNode("label",xu,[e.createElementVNode("input",{type:"radio",value:"landscape",checked:O.value==="landscape",onChange:V[10]||(V[10]=P=>S(P.target.value))},null,40,Bu),V[23]||(V[23]=e.createElementVNode("span",null,"横向",-1))])]),V[25]||(V[25]=e.createElementVNode("p",{class:"pd-hint"},"切换即交换纸张长宽(设计稿内容随之铺在该尺寸上)",-1))])),!L.value&&!Y.value?(e.openBlock(),e.createElementBlock("div",$u,[V[30]||(V[30]=e.createElementVNode("span",{class:"pd-label"},"内容旋转角度",-1)),e.createElementVNode("div",Du,[e.createElementVNode("label",Tu,[e.createElementVNode("input",{type:"radio",value:"0",checked:z.value===0,onChange:V[11]||(V[11]=P=>T(P.target.value))},null,40,Mu),V[26]||(V[26]=e.createElementVNode("span",null,"0°",-1))]),e.createElementVNode("label",zu,[e.createElementVNode("input",{type:"radio",value:"90",checked:z.value===90,onChange:V[12]||(V[12]=P=>T(P.target.value))},null,40,Au),V[27]||(V[27]=e.createElementVNode("span",null,"90°",-1))]),e.createElementVNode("label",Pu,[e.createElementVNode("input",{type:"radio",value:"180",checked:z.value===180,onChange:V[13]||(V[13]=P=>T(P.target.value))},null,40,Ru),V[28]||(V[28]=e.createElementVNode("span",null,"180°",-1))]),e.createElementVNode("label",Lu,[e.createElementVNode("input",{type:"radio",value:"270",checked:z.value===270,onChange:V[14]||(V[14]=P=>T(P.target.value))},null,40,Uu),V[29]||(V[29]=e.createElementVNode("span",null,"270°",-1))])]),V[31]||(V[31]=e.createElementVNode("p",{class:"pd-hint"},"整页内容旋转对应角度出纸;90°/270° 时纸张长宽互换以贴合内容,内容不变形不裁切;0° 为不旋转(默认)",-1))])):e.createCommentVNode("",!0),e.createElementVNode("div",Iu,[V[32]||(V[32]=e.createElementVNode("span",{class:"pd-label"},"页面背景色",-1)),e.createElementVNode("div",Fu,[e.createElementVNode("div",Ou,[e.createVNode(Ne,{modelValue:h.value,"onUpdate:modelValue":V[15]||(V[15]=P=>h.value=P)},null,8,["modelValue"])]),e.createElementVNode("button",{type:"button",class:"pd-reset",title:"恢复为默认白色",onClick:Z},"默认")])]),e.createVNode(zc,{"model-value":x.value,"onUpdate:modelValue":ee},null,8,["model-value"]),t.multiPage?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(iu,{key:4,"model-value":t.templateData?.tiling,"template-data":t.templateData,"onUpdate:modelValue":V[16]||(V[16]=P=>se({tiling:P}))},null,8,["model-value","template-data"])),V[40]||(V[40]=e.createElementVNode("h3",{class:"pd-divider"},"页边距 (mm)",-1)),L.value?(e.openBlock(),e.createElementBlock("p",Hu,"底部边距即连续纸走纸留白")):e.createCommentVNode("",!0),e.createElementVNode("div",Wu,[e.createElementVNode("div",Gu,[V[33]||(V[33]=e.createElementVNode("span",{class:"pd-label"},"上",-1)),e.createVNode(de,{"model-value":A.value,min:0,max:50,"onUpdate:modelValue":M},null,8,["model-value"])]),e.createElementVNode("div",qu,[V[34]||(V[34]=e.createElementVNode("span",{class:"pd-label"},"下",-1)),e.createVNode(de,{"model-value":k.value,min:0,max:100,"onUpdate:modelValue":D},null,8,["model-value"])]),e.createElementVNode("div",Ku,[V[35]||(V[35]=e.createElementVNode("span",{class:"pd-label"},"左",-1)),e.createVNode(de,{"model-value":H.value,min:0,max:50,"onUpdate:modelValue":U},null,8,["model-value"])]),e.createElementVNode("div",ju,[V[36]||(V[36]=e.createElementVNode("span",{class:"pd-label"},"右",-1)),e.createVNode(de,{"model-value":G.value,min:0,max:50,"onUpdate:modelValue":oe},null,8,["model-value"])])]),V[41]||(V[41]=e.createElementVNode("h3",{class:"pd-divider"},"页眉/页脚高度 (mm)",-1)),e.createElementVNode("div",Yu,[V[37]||(V[37]=e.createElementVNode("span",{class:"pd-label"},"页眉高度",-1)),e.createVNode(de,{"model-value":q.value,min:0,max:100,step:.1,"onUpdate:modelValue":le},null,8,["model-value"])]),e.createElementVNode("div",Xu,[V[38]||(V[38]=e.createElementVNode("span",{class:"pd-label"},"页脚高度",-1)),e.createVNode(de,{"model-value":_.value,min:0,max:100,step:.1,"onUpdate:modelValue":me},null,8,["model-value"])])],32),e.createVNode(xc,{"model-value":he.value,fields:t.fields,"onUpdate:modelValue":ge},null,8,["model-value","fields"])],512),[[e.vShow,(t.activeTab||"page")==="page"]])])],64))],2))}}),Ju=ue(Zu,[["__scopeId","data-v-4782ce32"]]),Qu={class:"status-bar"},_u={key:0,class:"status-item coord"},em={class:"status-item"},tm={class:"status-item"},om={class:"status-item status-paper"},nm=e.defineComponent({__name:"StatusBar",props:{coordinate:{},scale:{},elementCount:{},selectedCount:{},paper:{},dirty:{type:Boolean}},setup(t){return(l,o)=>(e.openBlock(),e.createElementBlock("div",Qu,[t.coordinate?(e.openBlock(),e.createElementBlock("span",_u," x:"+e.toDisplayString(t.coordinate.x.toFixed(1))+" y:"+e.toDisplayString(t.coordinate.y.toFixed(1))+"mm ",1)):e.createCommentVNode("",!0),e.createElementVNode("span",em,"缩放 "+e.toDisplayString(t.scale)+"%",1),e.createElementVNode("span",tm,"元素 "+e.toDisplayString(t.elementCount)+e.toDisplayString(t.selectedCount?` (选中 ${t.selectedCount})`:""),1),e.createElementVNode("span",{class:e.normalizeClass(["status-dirty",{on:t.dirty}])},[o[0]||(o[0]=e.createElementVNode("span",{class:"dirty-dot"},null,-1)),e.createTextVNode(e.toDisplayString(t.dirty?"未保存":"已保存"),1)],2),e.createElementVNode("span",om,e.toDisplayString(t.paper),1)]))}}),lm=ue(nm,[["__scopeId","data-v-a91952ff"]]),am={id:"getting-started",title:"快速入门",content:`
7
7
  <h2>界面布局</h2>
8
8
  <p>打印模板设计器采用三栏布局:</p>
9
9
  <ul>
@@ -43,7 +43,7 @@
43
43
  <p><strong>项目名称:</strong>worm-vue3-print</p>
44
44
  <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>
45
45
  <p>基于 Vue 3 的可视化打印模板设计器,支持拖拽式模板编辑、表达式数据绑定和浏览器端打印预览。</p>
46
- `},Cu={id:"features",title:"功能说明",content:`
46
+ `},im={id:"features",title:"功能说明",content:`
47
47
  <h2>元素类型</h2>
48
48
  <table>
49
49
  <thead>
@@ -54,7 +54,7 @@
54
54
  <tr><td>长文本</td><td>多行文本,支持自动换行</td></tr>
55
55
  <tr><td>数据表格</td><td>动态行列,支持分页、表头重复、序号/小计/汇总</td></tr>
56
56
  <tr><td>条形码</td><td>支持 code128 等多种码制</td></tr>
57
- <tr><td>二维码</td><td>支持 L/M/Q/H 纠错级别</td></tr>
57
+ <tr><td>二维码</td><td>支持 L/M/Q/H 纠错级别;「静区 (模块)」控制四周白边(0~8,默认 0=码面等比铺满元素框),需 ISO 推荐静区时填 4</td></tr>
58
58
  <tr><td>图片</td><td>静态或动态图片</td></tr>
59
59
  <tr><td>线条</td><td>水平线或垂直线</td></tr>
60
60
  <tr><td>形状</td><td>矩形、椭圆,支持边框和背景色</td></tr>
@@ -214,7 +214,7 @@
214
214
  <li>支持调节水印密度(密/中/疏/自定义瓦片尺寸),以及设置水印颜色</li>
215
215
  <li>水印在画布、浏览器预览、服务端 PDF、静默打印四端渲染一致</li>
216
216
  </ul>
217
- `},Su={id:"shortcuts",title:"快捷键",content:`
217
+ `},rm={id:"shortcuts",title:"快捷键",content:`
218
218
  <h2>常用操作</h2>
219
219
  <table>
220
220
  <thead>
@@ -284,7 +284,7 @@
284
284
  <blockquote>
285
285
  <p><strong>注意</strong>:当焦点在输入框、文本框、下拉框内时,快捷键不生效。</p>
286
286
  </blockquote>
287
- `},xu={id:"faq",title:"常见问题",content:`
287
+ `},sm={id:"faq",title:"常见问题",content:`
288
288
  <h2>如何调整纸张大小?</h2>
289
289
  <ol>
290
290
  <li>在右侧面板选择"页面设置"</li>
@@ -410,7 +410,32 @@
410
410
  <blockquote>
411
411
  <p><strong>提示</strong>:水印配置保存在模板 JSON 的 <code>watermark</code> 字段中,仅对当前模板生效。</p>
412
412
  </blockquote>
413
- `},$u={id:"changelog",title:"更新记录",content:`
413
+ `},dm={id:"changelog",title:"更新记录",content:`
414
+ <h2>V1.3.7<small>(2026-10-19)</small></h2>
415
+
416
+ <h3>新增</h3>
417
+ <ul>
418
+ <li><strong>两端对齐</strong>:文本元素和表格单元格都能选「两端」,一行字会均匀铺开、左右两头都贴齐边界(含最后一行)。想撑满列宽的表头、签字栏不必再手动加空格。</li>
419
+ <li><strong>长文本首行缩进</strong>:按「字符」填写,2 就是常规的「缩进两个字符」,字号变小时缩进也跟着变窄。</li>
420
+ <li><strong>图片缩放模式与裁剪锚点</strong>:可拉伸铺满或等比裁切,并指定保住哪一侧(证件照保住头顶);表格里的图片单元格同样能设锚点。</li>
421
+ <li><strong>二维码静区(模块)</strong>:可填 0~8 控制码面四周留白,0 即码面等比铺满元素框;需要扫码合规白边时填 4。</li>
422
+ <li><strong>工具栏自适应收纳</strong>:窗口变窄放不下时按钮组自动收进「更多」下拉,分组标题与图标形态都保留,不再出现按钮文字竖排压住画布。</li>
423
+ </ul>
424
+
425
+ <h3>修复</h3>
426
+ <ul>
427
+ <li><strong>二维码不再小一圈</strong>:此前二维码按固定尺寸出图,元素框一旦偏大就明显填不满,缩放框体也没用(24mm 框看不出来,60mm 框只画约三分之二)。现在等比铺满元素框与单元格,反复改框大小也不会重画发虚。</li>
428
+ <li><strong>图片缩放模式出纸时生效</strong>:以前只有画布按所选模式显示,预览、导出 PDF 与桌面客户端出纸都被固定成「完整显示」,现在四条链路一致。</li>
429
+ <li><strong>桌面客户端出纸更准</strong>:改走与浏览器打印同一条通路,纸张按设计器算出的实际毫米下发(60×40 / 80×60 / 100×80 mm 实测落盘尺寸精确一致、内容正立),Windows 不再需要额外安装外部打印工具。</li>
430
+ <li><strong>属性台控件跟随主题</strong>:输入框、下拉、弹层、右键菜单与滚动条统一接入主题变量,浅色外观逐像素不变,换深色不再出现白色死角;说明气泡在部分宿主下被拉成超宽长条,已修正。</li>
431
+ </ul>
432
+
433
+ <h3>注意</h3>
434
+ <ul>
435
+ <li><strong>二维码留白变少</strong>:静区缺省由固定 4 模块改为 0,既有模板的码面占框比例会变大(铺满元素框)。要保留原来的白边,请把「静区 (模块)」填成 4。</li>
436
+ <li><strong>桌面客户端设置项调整</strong>:「出纸方式」配置项已取消,出纸固定走新通路;Windows / Linux 不再显示顶部应用菜单(文本框里的复制粘贴快捷键不受影响)。</li>
437
+ </ul>
438
+
414
439
  <h2>V1.3.6<small>(2026-10-16)</small></h2>
415
440
 
416
441
  <h3>修复</h3>
@@ -632,4 +657,4 @@
632
657
  <blockquote>
633
658
  <p>完整更新记录请查阅仓库 <code>docs/中文/CHANGELOG.md</code> 与 <code>docs/en/CHANGELOG.en.md</code>。</p>
634
659
  </blockquote>
635
- `},Bu=[wu,Cu,Su,xu,$u],Du={class:"help-modal"},Tu={class:"help-modal-header"},Mu={class:"help-modal-body"},zu={class:"help-modal-sidebar"},Au=["onClick"],Pu={class:"help-modal-content"},Ru=["innerHTML"],ut="worm-print-help-tab",Lu=e.defineComponent({__name:"HelpModal",props:{visible:{type:Boolean},initialTab:{default:"getting-started"}},emits:["close","update:tab"],setup(o,{emit:r}){const t=o,s=r,n=Bu,l=e.ref(t.initialTab);e.onMounted(()=>{const m=localStorage.getItem(ut);m&&n.some(c=>c.id===m)&&(l.value=m)}),e.watch(()=>t.visible,m=>{if(m){const c=localStorage.getItem(ut);c&&n.some(f=>f.id===c)&&(l.value=c)}});function a(m){l.value=m,localStorage.setItem(ut,m),s("update:tab",m)}const i=e.computed(()=>n.find(c=>c.id===l.value)?.content||"");function d(m){m.key==="Escape"&&t.visible&&s("close")}return e.onMounted(()=>{document.addEventListener("keydown",d)}),e.onUnmounted(()=>{document.removeEventListener("keydown",d)}),(m,c)=>(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:c[1]||(c[1]=e.withModifiers(f=>m.$emit("close"),["self"]))},[e.createElementVNode("div",Du,[e.createElementVNode("div",Tu,[c[2]||(c[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:c[0]||(c[0]=f=>m.$emit("close"))}," × ")]),e.createElementVNode("div",Mu,[e.createElementVNode("div",zu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),f=>(e.openBlock(),e.createElementBlock("button",{key:f.id,class:e.normalizeClass(["help-tab",{active:l.value===f.id}]),onClick:g=>a(f.id)},e.toDisplayString(f.title),11,Au))),128))]),e.createElementVNode("div",Pu,[e.createElementVNode("div",{class:"help-content",innerHTML:i.value},null,8,Ru)])])])])):e.createCommentVNode("",!0)]),_:1})]))}}),Uu=ce(Lu,[["__scopeId","data-v-31115934"]]),Iu={class:"page-tabs-list"},Fu=["onBlur","onKeydown"],Hu=["data-tip","onClick","onDblclick"],Ou={class:"page-tabs-actions"},Wu=["data-tip","disabled"],Gu=["data-tip","disabled"],Ku=["data-tip","disabled"],qu=["data-tip","disabled"],Yu=["data-tip","disabled"],ju=e.defineComponent({__name:"PageTabs",props:{pages:{},activeIndex:{},multi:{type:Boolean},tilingEnabled:{type:Boolean}},emits:["select","add","duplicate","delete","rename","move"],setup(o,{emit:r}){const t=o,s=r,n=e.ref(-1),l=e.ref(""),a=e.computed(()=>t.pages[t.activeIndex]?.name||`页面 ${t.activeIndex+1}`),i=e.computed(()=>t.tilingEnabled?mt:"新增页面(在当前页后追加空白页)"),d=e.computed(()=>t.tilingEnabled?mt:`复制当前页「${a.value}」`);function m(B){n.value=B,l.value=t.pages[B]?.name??""}function c(B){if(n.value!==B)return;const _=l.value.trim();_&&s("rename",B,_),n.value=-1}function f(){n.value=-1}const g=e.ref(null);let h=null;function R(B){const _=B.dataset.tip;if(!_)return;const ne=B.getBoundingClientRect(),G=Math.min(Math.max(ne.left+ne.width/2,80),window.innerWidth-80);g.value={text:_,x:G,y:ne.bottom+6}}function C(B){const _=B.target.closest?.("[data-tip]");_&&(h&&clearTimeout(h),h=setTimeout(()=>R(_),300))}function v(B){const _=B.target.closest?.("[data-tip]");_&&B.relatedTarget?.closest?.("[data-tip]")===_||p()}function p(){h&&(clearTimeout(h),h=null),g.value=null}return e.onUnmounted(p),(B,_)=>(e.openBlock(),e.createElementBlock("div",{class:"page-tabs",onMouseover:C,onMouseout:v,onMouseleave:p},[e.createElementVNode("div",Iu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.pages,(ne,G)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:G},[n.value===G?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":_[0]||(_[0]=J=>l.value=J),class:"page-tab-rename","data-test":"page-rename-input",onBlur:J=>c(G),onKeydown:[e.withKeys(J=>c(G),["enter"]),e.withKeys(f,["esc"])]},null,40,Fu)),[[e.vModelText,l.value]]):(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["page-tab",{active:G===o.activeIndex}]),"data-tip":ne.name?`${ne.name}(双击重命名)`:"双击重命名",onClick:J=>B.$emit("select",G),onDblclick:J=>m(G)},e.toDisplayString(ne.name||`页面 ${G+1}`),43,Hu))],64))),128))]),e.createElementVNode("div",Ou,[e.createElementVNode("button",{"data-test":"add-page","data-tip":i.value,disabled:o.tilingEnabled,onClick:_[1]||(_[1]=ne=>B.$emit("add"))},"+",8,Wu),e.createElementVNode("button",{"data-test":"duplicate-page","data-tip":d.value,disabled:o.tilingEnabled,onClick:_[2]||(_[2]=ne=>B.$emit("duplicate"))},"⧉",8,Gu),e.createElementVNode("button",{"data-test":"delete-page","data-tip":o.multi?`删除当前页「${a.value}」`:"仅多页面模板可删除页面",disabled:!o.multi,onClick:_[3]||(_[3]=ne=>B.$emit("delete",o.activeIndex))},"✕",8,Ku),e.createElementVNode("button",{"data-test":"move-left","data-tip":`前移「${a.value}」`,disabled:o.activeIndex<=0,onClick:_[4]||(_[4]=ne=>B.$emit("move",o.activeIndex,o.activeIndex-1))},"←",8,qu),e.createElementVNode("button",{"data-test":"move-right","data-tip":`后移「${a.value}」`,disabled:o.activeIndex>=o.pages.length-1,onClick:_[5]||(_[5]=ne=>B.$emit("move",o.activeIndex,o.activeIndex+1))},"→",8,Yu)]),g.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"page-tabs-tip",style:e.normalizeStyle({left:`${g.value.x}px`,top:`${g.value.y}px`})},e.toDisplayString(g.value.text),5)):e.createCommentVNode("",!0)],32))}}),Xu=ce(ju,[["__scopeId","data-v-f1c7a18e"]]),Dt="print-studio:left",Tt="print-studio:right";function Mt(o,r){try{const t=localStorage.getItem(o);return t===null?r:t==="1"}catch{return r}}function Zu(){const o=e.ref(Mt(Dt,!1)),r=e.ref(Mt(Tt,!1)),t=e.ref(!1);e.watch(o,a=>{try{localStorage.setItem(Dt,a?"1":"0")}catch{}},{flush:"sync"}),e.watch(r,a=>{try{localStorage.setItem(Tt,a?"1":"0")}catch{}},{flush:"sync"});function s(){o.value=!o.value}function n(){r.value=!r.value}function l(){t.value=!1}return{leftCollapsed:o,rightCollapsed:r,toggleLeft:s,toggleRight:n,dirty:t,markSaved:l}}const Ju={class:"designer-body"},Qu=e.defineComponent({__name:"PrintDesigner",props:{initialTemplate:{},initialElements:{},fields:{},isEdit:{type:Boolean},uploadImage:{type:Function},uploadDesignBackground:{type:Function},showHelp:{type:Boolean},fonts:{}},emits:["preview","save"],setup(o,{expose:r,emit:t}){const s=o,n=t,l=e.ref(!1);e.watch(()=>s.showHelp,X=>{X===!1&&(l.value=!1)});const{leftCollapsed:a,rightCollapsed:i,toggleLeft:d,toggleRight:m,dirty:c,markSaved:f}=Zu(),{scale:g,showRuler:h,showGrid:R,snapToGrid:C,showTableGhostBorder:v,templateData:p,elements:B,fields:_,tilingEnabled:ne,selectedIds:G,selectedElement:J,selectedElements:b,select:W,selectElement:j,clearSelection:U,selectAll:y,previewIds:M,setPreview:N,commitPreview:O,hasClipboard:A,copy:k,paste:z,cutSelected:u,canUndo:x,canRedo:Y,undo:be,redo:ge,alignSelected:fe,groupSelected:se,ungroupSelected:q,deleteSelected:S,dragStart:D,dragStop:K,addElement:Z,addFieldElement:te,moveLayer:pe,updateTemplateData:T,getTemplateJson:$,loadTemplate:I,pages:ee,activePageIndex:oe,switchPage:ue,addPage:L,duplicatePage:F,deletePage:V,renamePage:w,movePage:P,tableSelection:ae,setTableSelection:me,recordHistory:ye}=Yt({initialTemplate:s.initialTemplate,initialElements:s.initialElements,initialFields:s.fields}),we=jt({elements:B,selectedIds:G,tableSelection:ae,recordHistory:ye}),xe=Zt({elements:B,selectedIds:G,recordHistory:ye}),Re=e.computed(()=>xe.active.value);e.watch([B,p],()=>{c.value=!0},{deep:!0});const _e=e.computed(()=>b.value.some(X=>!!X.options.groupId)),{guides:Oe,addGuide:et,moveGuide:tt,removeGuide:ot}=Qt(p,ye),nt=e.computed(()=>{const X=p.value,{width:Q}=E.getPaperDimensions(X);return Q-X.margins.left-X.margins.right});e.provide(He,{tableSelection:ae,setTableSelection:me,recordHistory:ye,maxTableWidth:nt}),e.provide(Je,G),e.provide(Pt,M),e.provide(vt,e.computed(()=>s.uploadImage)),e.provide(ft,e.computed(()=>s.uploadDesignBackground));const{catalog:lt}=eo(e.computed(()=>s.fonts));e.provide(gt,lt),ao(e.computed(()=>he.buildFontFaceCss(s.fonts)));function We(){const X=$();return s.fonts?.length?Array.isArray(X.pages)?{...X,pages:X.pages.map(Q=>({...Q,fonts:[...s.fonts]}))}:{...X,fonts:[...s.fonts]}:X}e.watch(J,X=>{(!X||X.printElementType.type!=="table")&&me(null)});const Me=e.ref(null),Ge=e.ref(null);function at(X){Ge.value=X}const it=e.computed(()=>{const X=p.value,Q=E.getPaperDimensions(X),ve=X.orientation==="landscape"?"横向":"纵向",De=`${E.PAPER_PRESETS[X.paperSize]?.label??X.paperSize} ${ve} ${Math.round(Q.width)}×${Math.round(Q.height)}mm`,Te=X.outputRotation;return Te?`${De}(旋转${Te}°)`:De});function Ke(){const X=Me.value?.$el;if(X){const Q=getComputedStyle(X),ve=parseFloat(Q.paddingLeft)+parseFloat(Q.paddingRight),Ve=parseFloat(Q.paddingTop)+parseFloat(Q.paddingBottom),De=E.getPaperDimensions(p.value),Te=96/25.4,Ue=E.computeFitScale(X.clientWidth-ve,X.clientHeight-Ve,De.width*Te,De.height*Te);Me.value?.fitToWindow(Ue)}}function rt(X){g.value=Math.max(E.FIT_SCALE_MIN_PERCENT,g.value+X)}function st(X){Me.value?.zoomByStep(X>0?1:-1)}function H(X){const Q=X.target.tagName;Q==="INPUT"||Q==="TEXTAREA"||Q==="SELECT"||(X.ctrlKey||X.metaKey)&&X.key==="0"&&(X.preventDefault(),Ke())}e.onMounted(()=>document.addEventListener("keydown",H)),e.onUnmounted(()=>document.removeEventListener("keydown",H));function le(X){const Q=p.value.header.height,ve=p.value.footer.height;T(X),X.header.height<Q&&Se("header"),X.footer.height<ve&&Se("footer")}function de(X,Q){p.value={...p.value,[X]:{...p.value[X],height:Q}}}function ke(X){T({...p.value}),Se(X)}function Se(X){const Q=E.getZoneRects(p.value)[X];B.value.some(Ve=>Ve.zone===X&&(Ve.options.top+Ve.options.height>Q.height||Ve.options.left+Ve.options.width>Q.width))&&alert(`${X==="header"?"页眉":"页脚"}高度已小于区域内元素,请手动调整元素位置`)}const Ee=j;function Be(X){const Q=B.value.find(ve=>ve.id===X);Q&&(Q.options.visible=Q.options.visible===!1)}function ze(X){const Q=B.value.find(ve=>ve.id===X);Q&&(Q.options.locked=!Q.options.locked)}const Ae=e.ref("page");e.watch(J,X=>{Ae.value=X?"element":"page"});const Rt={text:"formatter",longText:"formatter",barcode:"formatter",qrcode:"formatter",image:"src"},Le=e.ref(!1),qe=e.ref(null),dt=e.ref("");function Lt(X){const Q=B.value.find(Ve=>Ve.id===X);if(!Q||(W(X,!1),Ae.value="element",Q.options.locked))return;const ve=Rt[Q.printElementType.type];ve&&(qe.value={kind:"element",element:Q,field:ve},dt.value=Q.options[ve]||"",Le.value=!0)}function Ut(X,Q,ve){const Ve=B.value.find(Ot=>Ot.id===X);if(!Ve||(W(X,!1),Ae.value="element",Ve.options.locked))return;const De=Ve.options.tableRows??[],Te=E.findMainCell(De,Q,ve),Ue=De[Te.r]?.cells[Te.c];Ue&&(qe.value={kind:"cell",cell:Ue},dt.value=Ue.formatter||"",Le.value=!0)}function It(X){const Q=qe.value;Q?.kind==="element"?Q.element.options[Q.field]=X||void 0:Q?.kind==="cell"&&(Q.cell.formatter=X||void 0),ye(),Le.value=!1,qe.value=null}function Ft(X,Q){B.value.push(X),W(X.id,!1),ye()}e.watch(()=>s.initialTemplate,X=>{X&&I(X,s.initialElements)}),e.watch(()=>s.initialElements,X=>{X&&!s.initialTemplate&&(p.value={...p.value,elements:X.map(Q=>({...Q,options:{...Q.options},printElementType:{...Q.printElementType}}))})}),e.watch(()=>s.fields,X=>{_.value=X||[]});const Et=e.computed(()=>{const X=p.value;return X?.tiling?.enabled!==!0?[]:he.validateTiling(X)});r({getTemplateJson:We,validateTemplate:()=>Et.value});function Ht(){const X=Et.value;if(X.length){alert(X[0].message),Ae.value="page";return}const Q=We();if(Array.isArray(Q.pages))try{he.normalizeTemplate(Q)}catch(ve){alert(ve instanceof Error?ve.message:String(ve));return}n("save",JSON.stringify(Q)),f()}return(X,Q)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["designer-container",{"format-painting":Re.value}])},[e.createVNode(Yo,{"is-edit":o.isEdit,"can-undo":e.unref(x),"can-redo":e.unref(Y),"has-multi-selection":e.unref(G).size>=2,"has-selection":e.unref(G).size>=1,"show-ruler":e.unref(h),"show-grid":e.unref(R),"snap-to-grid":e.unref(C),"show-table-ghost-border":e.unref(v),"selected-element-has-group":_e.value,"show-help":o.showHelp!==!1,"clipboard-disabled":e.unref(we).context.value!=="elements","has-clipboard":e.unref(A),scale:e.unref(g),"onUpdate:scale":Q[0]||(Q[0]=ve=>e.isRef(g)?g.value=ve:null),onPreview:Q[1]||(Q[1]=ve=>X.$emit("preview")),onSave:Ht,onUndo:e.unref(be),onRedo:e.unref(ge),onAlign:Q[2]||(Q[2]=ve=>e.unref(fe)(ve)),onMoveLayer:e.unref(pe),onToggleRuler:Q[3]||(Q[3]=ve=>h.value=!e.unref(h)),onToggleGrid:Q[4]||(Q[4]=ve=>R.value=!e.unref(R)),onToggleSnap:Q[5]||(Q[5]=ve=>C.value=!e.unref(C)),onToggleTableGhostBorder:Q[6]||(Q[6]=ve=>v.value=!e.unref(v)),onGroup:e.unref(se),onUngroup:e.unref(q),onFitWindow:Ke,onZoom:st,onHelp:Q[7]||(Q[7]=ve=>l.value=!0),onCopy:e.unref(k),onPaste:e.unref(z),onDelete:e.unref(S)},{default:e.withCtx(()=>[e.createVNode(Un,{format:e.unref(we),painter:e.unref(xe)},null,8,["format","painter"])]),_:1},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","show-help","clipboard-disabled","has-clipboard","scale","onUndo","onRedo","onMoveLayer","onGroup","onUngroup","onCopy","onPaste","onDelete"]),e.createVNode(Xu,{pages:e.unref(ee),"active-index":e.unref(oe),multi:e.unref(ee).length>1,"tiling-enabled":e.unref(ne),onSelect:e.unref(ue),onAdd:e.unref(L),onDuplicate:e.unref(F),onDelete:e.unref(V),onRename:e.unref(w),onMove:e.unref(P)},null,8,["pages","active-index","multi","tiling-enabled","onSelect","onAdd","onDuplicate","onDelete","onRename","onMove"]),e.createElementVNode("div",Ju,[e.createVNode(bl,{fields:e.unref(_),elements:e.unref(B),"selected-ids":e.unref(G),collapsed:e.unref(a),onSelect:e.unref(Ee),onMoveLayer:e.unref(pe),onGroup:e.unref(se),onUngroup:e.unref(q),onToggleVisible:Be,onToggleLocked:ze,onToggleCollapse:e.unref(d)},null,8,["fields","elements","selected-ids","collapsed","onSelect","onMoveLayer","onGroup","onUngroup","onToggleCollapse"]),e.createVNode(Ra,{ref_key:"canvasAreaRef",ref:Me,"template-data":e.unref(p),elements:e.unref(B),scale:e.unref(g)/100,"show-ruler":e.unref(h),"show-grid":e.unref(R),"snap-to-grid":e.unref(C),"show-table-ghost-border":e.unref(v),"has-clipboard":e.unref(A),guides:e.unref(Oe),onSelect:e.unref(Ee),onDropElement:e.unref(Z),onDropField:e.unref(te),onDragStart:e.unref(D),onDragStop:e.unref(K),onDblclickElement:Lt,onDblclickCell:Ut,onZoneHeightChange:de,onZoneHeightCommit:ke,onSelectAll:e.unref(y),onClearSelection:e.unref(U),onPreview:e.unref(N),onCommitPreview:e.unref(O),onPaste:e.unref(z),onCopy:e.unref(k),onCut:e.unref(u),onDelete:e.unref(S),onMoveLayer:e.unref(pe),onCoordinate:at,onAddGuide:e.unref(et),onGuideMove:e.unref(tt),onGuideRemove:e.unref(ot),onZoom:rt,onCloneElement:Ft},null,8,["template-data","elements","scale","show-ruler","show-grid","snap-to-grid","show-table-ghost-border","has-clipboard","guides","onSelect","onDropElement","onDropField","onDragStart","onDragStop","onSelectAll","onClearSelection","onPreview","onCommitPreview","onPaste","onCopy","onCut","onDelete","onMoveLayer","onAddGuide","onGuideMove","onGuideRemove"]),e.createVNode(gu,{element:e.unref(J),"template-data":e.unref(p),fields:e.unref(_),"table-selection":e.unref(ae),"record-history":e.unref(ye),collapsed:e.unref(i),"multi-page":e.unref(ee).length>1,"active-tab":Ae.value,"onUpdate:activeTab":Q[8]||(Q[8]=ve=>Ae.value=ve),onDeleteElement:e.unref(S),"onUpdate:templateData":le,onToggleCollapse:e.unref(m)},null,8,["element","template-data","fields","table-selection","record-history","collapsed","multi-page","active-tab","onDeleteElement","onToggleCollapse"])]),e.createVNode(Nu,{coordinate:Ge.value,scale:e.unref(g),"element-count":e.unref(B).length,"selected-count":e.unref(G).size,paper:it.value,dirty:e.unref(c)},null,8,["coordinate","scale","element-count","selected-count","paper","dirty"]),e.createVNode(Qe,{modelValue:Le.value,"onUpdate:modelValue":Q[9]||(Q[9]=ve=>Le.value=ve),fields:e.unref(_),expression:dt.value,"onUpdate:expression":It},null,8,["modelValue","fields","expression"]),e.createVNode(Uu,{visible:l.value,onClose:Q[10]||(Q[10]=ve=>l.value=!1)},null,8,["visible"])],2))}}),_u=ce(Qu,[["__scopeId","data-v-4f08a049"]]),em={class:"print-html-preview"},tm={key:0,class:"print-html-preview-error"},om={key:1,class:"print-html-preview-loading"},nm=e.defineComponent({__name:"PrintHtmlPreview",props:{templateJson:{},printData:{},baseUrl:{},fontBaseUrl:{}},emits:["rendered","error"],setup(o,{expose:r,emit:t}){const s=o,n=t,l=e.ref(),a=e.ref(!1),i=e.ref("");let d=0;async function m(){if(!s.templateJson){i.value="",a.value=!1;return}const f=++d;a.value=!0,i.value="";try{const{html:g,pageCount:h,copies:R}=await Ie.renderHtmlPages(s.templateJson,s.printData,s.baseUrl,Ie.browserCodeRenderer,{fontBaseUrl:s.fontBaseUrl});if(f!==d)return;const C=l.value?.contentWindow?.document;C&&(C.open(),C.write(g),C.close()),n("rendered",h,R)}catch(g){if(f!==d)return;i.value=g instanceof Error?g.message:"未知错误",n("error",i.value)}finally{f===d&&(a.value=!1)}}function c(){const f=l.value?.contentWindow;f&&(f.focus(),f.print())}return e.watch(()=>[s.templateJson,s.printData,s.baseUrl,s.fontBaseUrl],()=>{m()},{immediate:!0,deep:!0}),e.onBeforeUnmount(()=>{d++}),r({print:c,rerender:m}),(f,g)=>(e.openBlock(),e.createElementBlock("div",em,[i.value?(e.openBlock(),e.createElementBlock("div",tm,[e.createElementVNode("span",null,"预览渲染失败:"+e.toDisplayString(i.value),1)])):a.value?(e.openBlock(),e.createElementBlock("div",om,"预览渲染中…")):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("iframe",{ref_key:"iframeRef",ref:l,class:"print-html-preview-iframe",title:"打印预览"},null,512),[[e.vShow,!a.value&&!i.value]])]))}}),lm=ce(nm,[["__scopeId","data-v-ff7de2b5"]]);Object.defineProperty(exports,"DEFAULT_DEMO_DATA",{enumerable:!0,get:()=>E.DEFAULT_DEMO_DATA});Object.defineProperty(exports,"getDemoData",{enumerable:!0,get:()=>E.getDemoData});Object.defineProperty(exports,"browserCodeRenderer",{enumerable:!0,get:()=>Ie.browserCodeRenderer});Object.defineProperty(exports,"renderHtmlPages",{enumerable:!0,get:()=>Ie.renderHtmlPages});exports.FONT_CATALOG_KEY=gt;exports.PrintDesigner=_u;exports.PrintHtmlPreview=lm;exports.UPLOAD_DESIGN_BACKGROUND_KEY=ft;exports.UPLOAD_IMAGE_KEY=vt;exports.createDefaultTemplate=Pe;exports.toRuntimePool=Xe;
660
+ `},cm=[am,im,rm,sm,dm],um={class:"help-modal"},mm={class:"help-modal-header"},pm={class:"help-modal-body"},vm={class:"help-modal-sidebar"},fm=["onClick"],gm={class:"help-modal-content"},hm=["innerHTML"],mt="worm-print-help-tab",bm=e.defineComponent({__name:"HelpModal",props:{visible:{type:Boolean},initialTab:{default:"getting-started"}},emits:["close","update:tab"],setup(t,{emit:l}){const o=t,n=l,i=cm,u=e.ref(o.initialTab);e.onMounted(()=>{const c=localStorage.getItem(mt);c&&i.some(m=>m.id===c)&&(u.value=c)}),e.watch(()=>o.visible,c=>{if(c){const m=localStorage.getItem(mt);m&&i.some(f=>f.id===m)&&(u.value=m)}});function a(c){u.value=c,localStorage.setItem(mt,c),n("update:tab",c)}const r=e.computed(()=>i.find(m=>m.id===u.value)?.content||"");function d(c){c.key==="Escape"&&o.visible&&n("close")}return e.onMounted(()=>{document.addEventListener("keydown",d)}),e.onUnmounted(()=>{document.removeEventListener("keydown",d)}),(c,m)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"help-modal"},{default:e.withCtx(()=>[t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"help-modal-overlay",onClick:m[1]||(m[1]=e.withModifiers(f=>c.$emit("close"),["self"]))},[e.createElementVNode("div",um,[e.createElementVNode("div",mm,[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]=f=>c.$emit("close"))}," × ")]),e.createElementVNode("div",pm,[e.createElementVNode("div",vm,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),f=>(e.openBlock(),e.createElementBlock("button",{key:f.id,class:e.normalizeClass(["help-tab",{active:u.value===f.id}]),onClick:g=>a(f.id)},e.toDisplayString(f.title),11,fm))),128))]),e.createElementVNode("div",gm,[e.createElementVNode("div",{class:"help-content",innerHTML:r.value},null,8,hm)])])])])):e.createCommentVNode("",!0)]),_:1})]))}}),Em=ue(bm,[["__scopeId","data-v-31115934"]]),ym={class:"page-tabs-list"},km=["onBlur","onKeydown"],Vm=["data-tip","onClick","onDblclick"],Nm={class:"page-tabs-actions"},wm=["data-tip","disabled"],Cm=["data-tip","disabled"],Sm=["data-tip","disabled"],xm=["data-tip","disabled"],Bm=["data-tip","disabled"],$m=e.defineComponent({__name:"PageTabs",props:{pages:{},activeIndex:{},multi:{type:Boolean},tilingEnabled:{type:Boolean}},emits:["select","add","duplicate","delete","rename","move"],setup(t,{emit:l}){const o=t,n=l,i=e.ref(-1),u=e.ref(""),a=e.computed(()=>o.pages[o.activeIndex]?.name||`页面 ${o.activeIndex+1}`),r=e.computed(()=>o.tilingEnabled?pt:"新增页面(在当前页后追加空白页)"),d=e.computed(()=>o.tilingEnabled?pt:`复制当前页「${a.value}」`);function c($){i.value=$,u.value=o.pages[$]?.name??""}function m($){if(i.value!==$)return;const W=u.value.trim();W&&n("rename",$,W),i.value=-1}function f(){i.value=-1}const g=e.ref(null);let p=null;function w($){const W=$.dataset.tip;if(!W)return;const te=$.getBoundingClientRect(),J=Math.min(Math.max(te.left+te.width/2,80),window.innerWidth-80);g.value={text:W,x:J,y:te.bottom+6}}function C($){const W=$.target.closest?.("[data-tip]");W&&(p&&clearTimeout(p),p=setTimeout(()=>w(W),300))}function N($){const W=$.target.closest?.("[data-tip]");W&&$.relatedTarget?.closest?.("[data-tip]")===W||v()}function v(){p&&(clearTimeout(p),p=null),g.value=null}return e.onUnmounted(v),($,W)=>(e.openBlock(),e.createElementBlock("div",{class:"page-tabs",onMouseover:C,onMouseout:N,onMouseleave:v},[e.createElementVNode("div",ym,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.pages,(te,J)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:J},[i.value===J?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":W[0]||(W[0]=L=>u.value=L),class:"page-tab-rename","data-test":"page-rename-input",onBlur:L=>m(J),onKeydown:[e.withKeys(L=>m(J),["enter"]),e.withKeys(f,["esc"])]},null,40,km)),[[e.vModelText,u.value]]):(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["page-tab",{active:J===t.activeIndex}]),"data-tip":te.name?`${te.name}(双击重命名)`:"双击重命名",onClick:L=>$.$emit("select",J),onDblclick:L=>c(J)},e.toDisplayString(te.name||`页面 ${J+1}`),43,Vm))],64))),128))]),e.createElementVNode("div",Nm,[e.createElementVNode("button",{"data-test":"add-page","data-tip":r.value,disabled:t.tilingEnabled,onClick:W[1]||(W[1]=te=>$.$emit("add"))},"+",8,wm),e.createElementVNode("button",{"data-test":"duplicate-page","data-tip":d.value,disabled:t.tilingEnabled,onClick:W[2]||(W[2]=te=>$.$emit("duplicate"))},"⧉",8,Cm),e.createElementVNode("button",{"data-test":"delete-page","data-tip":t.multi?`删除当前页「${a.value}」`:"仅多页面模板可删除页面",disabled:!t.multi,onClick:W[3]||(W[3]=te=>$.$emit("delete",t.activeIndex))},"✕",8,Sm),e.createElementVNode("button",{"data-test":"move-left","data-tip":`前移「${a.value}」`,disabled:t.activeIndex<=0,onClick:W[4]||(W[4]=te=>$.$emit("move",t.activeIndex,t.activeIndex-1))},"←",8,xm),e.createElementVNode("button",{"data-test":"move-right","data-tip":`后移「${a.value}」`,disabled:t.activeIndex>=t.pages.length-1,onClick:W[5]||(W[5]=te=>$.$emit("move",t.activeIndex,t.activeIndex+1))},"→",8,Bm)]),g.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"page-tabs-tip",style:e.normalizeStyle({left:`${g.value.x}px`,top:`${g.value.y}px`})},e.toDisplayString(g.value.text),5)):e.createCommentVNode("",!0)],32))}}),Dm=ue($m,[["__scopeId","data-v-f1c7a18e"]]),At="print-studio:left",Pt="print-studio:right";function Rt(t,l){try{const o=localStorage.getItem(t);return o===null?l:o==="1"}catch{return l}}function Tm(){const t=e.ref(Rt(At,!1)),l=e.ref(Rt(Pt,!1)),o=e.ref(!1);e.watch(t,a=>{try{localStorage.setItem(At,a?"1":"0")}catch{}},{flush:"sync"}),e.watch(l,a=>{try{localStorage.setItem(Pt,a?"1":"0")}catch{}},{flush:"sync"});function n(){t.value=!t.value}function i(){l.value=!l.value}function u(){o.value=!1}return{leftCollapsed:t,rightCollapsed:l,toggleLeft:n,toggleRight:i,dirty:o,markSaved:u}}const Mm={class:"designer-body"},zm=e.defineComponent({__name:"PrintDesigner",props:{initialTemplate:{},initialElements:{},fields:{},isEdit:{type:Boolean},uploadImage:{type:Function},uploadDesignBackground:{type:Function},showHelp:{type:Boolean},fonts:{}},emits:["preview","save"],setup(t,{expose:l,emit:o}){const n=t,i=o,u=e.ref(!1);e.watch(()=>n.showHelp,X=>{X===!1&&(u.value=!1)});const{leftCollapsed:a,rightCollapsed:r,toggleLeft:d,toggleRight:c,dirty:m,markSaved:f}=Tm(),{scale:g,showRuler:p,showGrid:w,snapToGrid:C,showTableGhostBorder:N,templateData:v,elements:$,fields:W,tilingEnabled:te,selectedIds:J,selectedElement:L,selectedElements:E,select:O,selectElement:Y,clearSelection:z,selectAll:h,previewIds:A,setPreview:k,commitPreview:H,hasClipboard:G,copy:q,paste:_,cutSelected:B,canUndo:s,canRedo:x,undo:ee,redo:he,alignSelected:ge,groupSelected:se,ungroupSelected:K,deleteSelected:S,dragStart:T,dragStop:j,addElement:Z,addFieldElement:ne,moveLayer:ve,updateTemplateData:M,getTemplateJson:D,loadTemplate:U,pages:oe,activePageIndex:le,switchPage:me,addPage:R,duplicatePage:I,deletePage:y,renamePage:V,movePage:P,tableSelection:ie,setTableSelection:pe,recordHistory:ye}=Qt({initialTemplate:n.initialTemplate,initialElements:n.initialElements,initialFields:n.fields}),we=_t({elements:$,selectedIds:J,tableSelection:ie,recordHistory:ye}),xe=to({elements:$,selectedIds:J,recordHistory:ye}),Le=e.computed(()=>xe.active.value);e.watch([$,v],()=>{m.value=!0},{deep:!0});const _e=e.computed(()=>E.value.some(X=>!!X.options.groupId)),{guides:We,addGuide:et,moveGuide:tt,removeGuide:ot}=no(v,ye),nt=e.computed(()=>{const X=v.value,{width:Q}=b.getPaperDimensions(X);return Q-X.margins.left-X.margins.right});e.provide(He,{tableSelection:ie,setTableSelection:pe,recordHistory:ye,maxTableWidth:nt}),e.provide(Je,J),e.provide(Ut,A),e.provide(ft,e.computed(()=>n.uploadImage)),e.provide(gt,e.computed(()=>n.uploadDesignBackground));const{catalog:lt}=ao(e.computed(()=>n.fonts));e.provide(ht,lt),uo(e.computed(()=>be.buildFontFaceCss(n.fonts)));function Ge(){const X=D();return n.fonts?.length?Array.isArray(X.pages)?{...X,pages:X.pages.map(Q=>({...Q,fonts:[...n.fonts]}))}:{...X,fonts:[...n.fonts]}:X}e.watch(L,X=>{(!X||X.printElementType.type!=="table")&&pe(null)});const ze=e.ref(null),qe=e.ref(null);function at(X){qe.value=X}const it=e.computed(()=>{const X=v.value,Q=b.getPaperDimensions(X),fe=X.orientation==="landscape"?"横向":"纵向",De=`${b.PAPER_PRESETS[X.paperSize]?.label??X.paperSize} ${fe} ${Math.round(Q.width)}×${Math.round(Q.height)}mm`,Te=X.outputRotation;return Te?`${De}(旋转${Te}°)`:De});function Ke(){const X=ze.value?.$el;if(X){const Q=getComputedStyle(X),fe=parseFloat(Q.paddingLeft)+parseFloat(Q.paddingRight),Ve=parseFloat(Q.paddingTop)+parseFloat(Q.paddingBottom),De=b.getPaperDimensions(v.value),Te=96/25.4,Ie=b.computeFitScale(X.clientWidth-fe,X.clientHeight-Ve,De.width*Te,De.height*Te);ze.value?.fitToWindow(Ie)}}function rt(X){g.value=Math.max(b.FIT_SCALE_MIN_PERCENT,g.value+X)}function st(X){ze.value?.zoomByStep(X>0?1:-1)}function F(X){const Q=X.target.tagName;Q==="INPUT"||Q==="TEXTAREA"||Q==="SELECT"||(X.ctrlKey||X.metaKey)&&X.key==="0"&&(X.preventDefault(),Ke())}e.onMounted(()=>document.addEventListener("keydown",F)),e.onUnmounted(()=>document.removeEventListener("keydown",F));function ae(X){const Q=v.value.header.height,fe=v.value.footer.height;M(X),X.header.height<Q&&Se("header"),X.footer.height<fe&&Se("footer")}function ce(X,Q){v.value={...v.value,[X]:{...v.value[X],height:Q}}}function ke(X){M({...v.value}),Se(X)}function Se(X){const Q=b.getZoneRects(v.value)[X];$.value.some(Ve=>Ve.zone===X&&(Ve.options.top+Ve.options.height>Q.height||Ve.options.left+Ve.options.width>Q.width))&&alert(`${X==="header"?"页眉":"页脚"}高度已小于区域内元素,请手动调整元素位置`)}const Ee=Y;function $e(X){const Q=$.value.find(fe=>fe.id===X);Q&&(Q.options.visible=Q.options.visible===!1)}function Ae(X){const Q=$.value.find(fe=>fe.id===X);Q&&(Q.options.locked=!Q.options.locked)}const Pe=e.ref("page");e.watch(L,X=>{Pe.value=X?"element":"page"});const Ot={text:"formatter",longText:"formatter",barcode:"formatter",qrcode:"formatter",image:"src"},Ue=e.ref(!1),je=e.ref(null),dt=e.ref("");function Ht(X){const Q=$.value.find(Ve=>Ve.id===X);if(!Q||(O(X,!1),Pe.value="element",Q.options.locked))return;const fe=Ot[Q.printElementType.type];fe&&(je.value={kind:"element",element:Q,field:fe},dt.value=Q.options[fe]||"",Ue.value=!0)}function Wt(X,Q,fe){const Ve=$.value.find(jt=>jt.id===X);if(!Ve||(O(X,!1),Pe.value="element",Ve.options.locked))return;const De=Ve.options.tableRows??[],Te=b.findMainCell(De,Q,fe),Ie=De[Te.r]?.cells[Te.c];Ie&&(je.value={kind:"cell",cell:Ie},dt.value=Ie.formatter||"",Ue.value=!0)}function Gt(X){const Q=je.value;Q?.kind==="element"?Q.element.options[Q.field]=X||void 0:Q?.kind==="cell"&&(Q.cell.formatter=X||void 0),ye(),Ue.value=!1,je.value=null}function qt(X,Q){$.value.push(X),O(X.id,!1),ye()}e.watch(()=>n.initialTemplate,X=>{X&&U(X,n.initialElements)}),e.watch(()=>n.initialElements,X=>{X&&!n.initialTemplate&&(v.value={...v.value,elements:X.map(Q=>({...Q,options:{...Q.options},printElementType:{...Q.printElementType}}))})}),e.watch(()=>n.fields,X=>{W.value=X||[]});const Nt=e.computed(()=>{const X=v.value;return X?.tiling?.enabled!==!0?[]:be.validateTiling(X)});l({getTemplateJson:Ge,validateTemplate:()=>Nt.value});function Kt(){const X=Nt.value;if(X.length){alert(X[0].message),Pe.value="page";return}const Q=Ge();if(Array.isArray(Q.pages))try{be.normalizeTemplate(Q)}catch(fe){alert(fe instanceof Error?fe.message:String(fe));return}i("save",JSON.stringify(Q)),f()}return(X,Q)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["designer-container",{"format-painting":Le.value}])},[e.createVNode(sn,{"is-edit":t.isEdit,"can-undo":e.unref(s),"can-redo":e.unref(x),"has-multi-selection":e.unref(J).size>=2,"has-selection":e.unref(J).size>=1,"show-ruler":e.unref(p),"show-grid":e.unref(w),"snap-to-grid":e.unref(C),"show-table-ghost-border":e.unref(N),"selected-element-has-group":_e.value,"show-help":t.showHelp!==!1,"clipboard-disabled":e.unref(we).context.value!=="elements","has-clipboard":e.unref(G),scale:e.unref(g),"onUpdate:scale":Q[0]||(Q[0]=fe=>e.isRef(g)?g.value=fe:null),onPreview:Q[1]||(Q[1]=fe=>X.$emit("preview")),onSave:Kt,onUndo:e.unref(ee),onRedo:e.unref(he),onAlign:Q[2]||(Q[2]=fe=>e.unref(ge)(fe)),onMoveLayer:e.unref(ve),onToggleRuler:Q[3]||(Q[3]=fe=>p.value=!e.unref(p)),onToggleGrid:Q[4]||(Q[4]=fe=>w.value=!e.unref(w)),onToggleSnap:Q[5]||(Q[5]=fe=>C.value=!e.unref(C)),onToggleTableGhostBorder:Q[6]||(Q[6]=fe=>N.value=!e.unref(N)),onGroup:e.unref(se),onUngroup:e.unref(K),onFitWindow:Ke,onZoom:st,onHelp:Q[7]||(Q[7]=fe=>u.value=!0),onCopy:e.unref(q),onPaste:e.unref(_),onDelete:e.unref(S)},{default:e.withCtx(()=>[e.createVNode(Qn,{format:e.unref(we),painter:e.unref(xe)},null,8,["format","painter"])]),_:1},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","show-help","clipboard-disabled","has-clipboard","scale","onUndo","onRedo","onMoveLayer","onGroup","onUngroup","onCopy","onPaste","onDelete"]),e.createVNode(Dm,{pages:e.unref(oe),"active-index":e.unref(le),multi:e.unref(oe).length>1,"tiling-enabled":e.unref(te),onSelect:e.unref(me),onAdd:e.unref(R),onDuplicate:e.unref(I),onDelete:e.unref(y),onRename:e.unref(V),onMove:e.unref(P)},null,8,["pages","active-index","multi","tiling-enabled","onSelect","onAdd","onDuplicate","onDelete","onRename","onMove"]),e.createElementVNode("div",Mm,[e.createVNode(Ml,{fields:e.unref(W),elements:e.unref($),"selected-ids":e.unref(J),collapsed:e.unref(a),onSelect:e.unref(Ee),onMoveLayer:e.unref(ve),onGroup:e.unref(se),onUngroup:e.unref(K),onToggleVisible:$e,onToggleLocked:Ae,onToggleCollapse:e.unref(d)},null,8,["fields","elements","selected-ids","collapsed","onSelect","onMoveLayer","onGroup","onUngroup","onToggleCollapse"]),e.createVNode(Za,{ref_key:"canvasAreaRef",ref:ze,"template-data":e.unref(v),elements:e.unref($),scale:e.unref(g)/100,"show-ruler":e.unref(p),"show-grid":e.unref(w),"snap-to-grid":e.unref(C),"show-table-ghost-border":e.unref(N),"has-clipboard":e.unref(G),guides:e.unref(We),onSelect:e.unref(Ee),onDropElement:e.unref(Z),onDropField:e.unref(ne),onDragStart:e.unref(T),onDragStop:e.unref(j),onDblclickElement:Ht,onDblclickCell:Wt,onZoneHeightChange:ce,onZoneHeightCommit:ke,onSelectAll:e.unref(h),onClearSelection:e.unref(z),onPreview:e.unref(k),onCommitPreview:e.unref(H),onPaste:e.unref(_),onCopy:e.unref(q),onCut:e.unref(B),onDelete:e.unref(S),onMoveLayer:e.unref(ve),onCoordinate:at,onAddGuide:e.unref(et),onGuideMove:e.unref(tt),onGuideRemove:e.unref(ot),onZoom:rt,onCloneElement:qt},null,8,["template-data","elements","scale","show-ruler","show-grid","snap-to-grid","show-table-ghost-border","has-clipboard","guides","onSelect","onDropElement","onDropField","onDragStart","onDragStop","onSelectAll","onClearSelection","onPreview","onCommitPreview","onPaste","onCopy","onCut","onDelete","onMoveLayer","onAddGuide","onGuideMove","onGuideRemove"]),e.createVNode(Ju,{element:e.unref(L),"template-data":e.unref(v),fields:e.unref(W),"table-selection":e.unref(ie),"record-history":e.unref(ye),collapsed:e.unref(r),"multi-page":e.unref(oe).length>1,"active-tab":Pe.value,"onUpdate:activeTab":Q[8]||(Q[8]=fe=>Pe.value=fe),onDeleteElement:e.unref(S),"onUpdate:templateData":ae,onToggleCollapse:e.unref(c)},null,8,["element","template-data","fields","table-selection","record-history","collapsed","multi-page","active-tab","onDeleteElement","onToggleCollapse"])]),e.createVNode(lm,{coordinate:qe.value,scale:e.unref(g),"element-count":e.unref($).length,"selected-count":e.unref(J).size,paper:it.value,dirty:e.unref(m)},null,8,["coordinate","scale","element-count","selected-count","paper","dirty"]),e.createVNode(Qe,{modelValue:Ue.value,"onUpdate:modelValue":Q[9]||(Q[9]=fe=>Ue.value=fe),fields:e.unref(W),expression:dt.value,"onUpdate:expression":Gt},null,8,["modelValue","fields","expression"]),e.createVNode(Em,{visible:u.value,onClose:Q[10]||(Q[10]=fe=>u.value=!1)},null,8,["visible"])],2))}}),Am=ue(zm,[["__scopeId","data-v-4c3c139f"]]),Pm={class:"print-html-preview"},Rm={key:0,class:"print-html-preview-error"},Lm={key:1,class:"print-html-preview-loading"},Um=e.defineComponent({__name:"PrintHtmlPreview",props:{templateJson:{},printData:{},baseUrl:{},fontBaseUrl:{}},emits:["rendered","error"],setup(t,{expose:l,emit:o}){const n=t,i=o,u=e.ref(),a=e.ref(!1),r=e.ref("");let d=0;async function c(){if(!n.templateJson){r.value="",a.value=!1;return}const f=++d;a.value=!0,r.value="";try{const{html:g,pageCount:p,copies:w}=await Me.renderHtmlPages(n.templateJson,n.printData,n.baseUrl,Me.browserCodeRenderer,{fontBaseUrl:n.fontBaseUrl});if(f!==d)return;const C=u.value?.contentWindow?.document;C&&(C.open(),C.write(g),C.close()),i("rendered",p,w)}catch(g){if(f!==d)return;r.value=g instanceof Error?g.message:"未知错误",i("error",r.value)}finally{f===d&&(a.value=!1)}}function m(){const f=u.value?.contentWindow;f&&(f.focus(),f.print())}return e.watch(()=>[n.templateJson,n.printData,n.baseUrl,n.fontBaseUrl],()=>{c()},{immediate:!0,deep:!0}),e.onBeforeUnmount(()=>{d++}),l({print:m,rerender:c}),(f,g)=>(e.openBlock(),e.createElementBlock("div",Pm,[r.value?(e.openBlock(),e.createElementBlock("div",Rm,[e.createElementVNode("span",null,"预览渲染失败:"+e.toDisplayString(r.value),1)])):a.value?(e.openBlock(),e.createElementBlock("div",Lm,"预览渲染中…")):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("iframe",{ref_key:"iframeRef",ref:u,class:"print-html-preview-iframe",title:"打印预览"},null,512),[[e.vShow,!a.value&&!r.value]])]))}}),Im=ue(Um,[["__scopeId","data-v-ff7de2b5"]]);Object.defineProperty(exports,"DEFAULT_DEMO_DATA",{enumerable:!0,get:()=>b.DEFAULT_DEMO_DATA});Object.defineProperty(exports,"getDemoData",{enumerable:!0,get:()=>b.getDemoData});Object.defineProperty(exports,"browserCodeRenderer",{enumerable:!0,get:()=>Me.browserCodeRenderer});Object.defineProperty(exports,"renderHtmlPages",{enumerable:!0,get:()=>Me.renderHtmlPages});exports.FONT_CATALOG_KEY=ht;exports.PrintDesigner=Am;exports.PrintHtmlPreview=Im;exports.TOOLBAR_OVERFLOW=bt;exports.UPLOAD_DESIGN_BACKGROUND_KEY=gt;exports.UPLOAD_IMAGE_KEY=ft;exports.createDefaultTemplate=Re;exports.createOverflowUnitDirective=yt;exports.emptyToolbarOverflow=Ft;exports.provideToolbarOverflow=It;exports.toRuntimePool=Ze;exports.useToolbarOverflow=Et;