@worm-print-platform/canvas 1.5.3 → 1.6.1

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 (70) hide show
  1. package/README.md +12 -4
  2. package/dist/browser-bundle.d.ts +1 -1
  3. package/dist/canvas.css +6 -1
  4. package/dist/canvas.js +1173 -119
  5. package/dist/core/default-template.d.ts +1 -1
  6. package/dist/core/element-definitions.d.ts +1 -1
  7. package/dist/core/format.d.ts +1 -1
  8. package/dist/core/h.d.ts +3 -17
  9. package/dist/core/icons.d.ts +1 -1
  10. package/dist/core/plugin.d.ts +4 -3
  11. package/dist/core/store.d.ts +3 -2
  12. package/dist/host-contract.d.ts +16 -3
  13. package/dist/index.cjs +1043 -13
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +6225 -4961
  16. package/dist/print-designer.d.ts +22 -3
  17. package/dist/shell/binding.d.ts +2 -2
  18. package/dist/shell/canvas.d.ts +2 -2
  19. package/dist/shell/code.d.ts +3 -3
  20. package/dist/shell/color-picker.d.ts +3 -39
  21. package/dist/shell/controls.d.ts +29 -11
  22. package/dist/shell/crop-anchor.d.ts +2 -2
  23. package/dist/shell/elements.d.ts +2 -2
  24. package/dist/shell/expression-editor.d.ts +3 -28
  25. package/dist/shell/flow-list.d.ts +2 -4
  26. package/dist/shell/font-select.d.ts +1 -1
  27. package/dist/shell/format-bar.d.ts +2 -2
  28. package/dist/shell/help-content/{advanced-settings.d.ts → en-US/advanced-settings.d.ts} +1 -1
  29. package/dist/shell/help-content/{changelog.d.ts → en-US/changelog.d.ts} +1 -1
  30. package/dist/shell/help-content/{faq.d.ts → en-US/faq.d.ts} +1 -1
  31. package/dist/shell/help-content/{features.d.ts → en-US/features.d.ts} +1 -1
  32. package/dist/shell/help-content/{getting-started.d.ts → en-US/getting-started.d.ts} +1 -1
  33. package/dist/shell/help-content/{shortcuts.d.ts → en-US/shortcuts.d.ts} +1 -1
  34. package/dist/shell/help-content/index.d.ts +4 -1
  35. package/dist/shell/help-content/th-TH/advanced-settings.d.ts +12 -0
  36. package/dist/shell/help-content/th-TH/changelog.d.ts +12 -0
  37. package/dist/shell/help-content/th-TH/faq.d.ts +12 -0
  38. package/dist/shell/help-content/th-TH/features.d.ts +12 -0
  39. package/dist/shell/help-content/th-TH/getting-started.d.ts +12 -0
  40. package/dist/shell/help-content/th-TH/shortcuts.d.ts +12 -0
  41. package/dist/shell/help-content/zh-CN/advanced-settings.d.ts +12 -0
  42. package/dist/shell/help-content/zh-CN/changelog.d.ts +12 -0
  43. package/dist/shell/help-content/zh-CN/faq.d.ts +12 -0
  44. package/dist/shell/help-content/zh-CN/features.d.ts +12 -0
  45. package/dist/shell/help-content/zh-CN/getting-started.d.ts +12 -0
  46. package/dist/shell/help-content/zh-CN/shortcuts.d.ts +12 -0
  47. package/dist/shell/help-modal.d.ts +6 -1
  48. package/dist/shell/page-extras.d.ts +1 -1
  49. package/dist/shell/panels.d.ts +4 -4
  50. package/dist/shell/plugin-ui.d.ts +1 -1
  51. package/dist/shell/prop-group.d.ts +1 -1
  52. package/dist/shell/property-panel.d.ts +1 -1
  53. package/dist/shell/property-search.d.ts +1 -1
  54. package/dist/shell/ruler.d.ts +1 -1
  55. package/dist/shell/table-props.d.ts +1 -1
  56. package/dist/shell/table.d.ts +1 -1
  57. package/dist/shell/toolbar-overflow.d.ts +4 -4
  58. package/dist/shell/toolbar.d.ts +2 -2
  59. package/dist/shell/watermark.d.ts +1 -1
  60. package/dist/test-setup.d.ts +7 -0
  61. package/dist/theme-tokens.d.ts +1 -1
  62. package/dist/version.d.ts +2 -2
  63. package/dist/vue3/PrintDesigner.d.ts +24 -1
  64. package/dist/vue3/PrintHtmlPreview.d.ts +1 -1
  65. package/dist/vue3/index.cjs +2 -2
  66. package/dist/vue3/index.d.ts +1 -1
  67. package/dist/vue3/index.js +85 -75
  68. package/dist/vue3/previewStyle.d.ts +1 -1
  69. package/dist/vue3/toolbarOverflow.d.ts +1 -1
  70. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@worm-print-platform/core/designer"),_=require("@worm-print-platform/core"),Ti=require("@worm-print-platform/core/browser"),ci=require("@worm-print-platform/plugin-kit"),rr=require("jsbarcode");function a(t,e={},o=[]){return{tag:t,props:e,children:o}}const Si="http://www.w3.org/2000/svg",wa=new Set(["draggable","contenteditable","spellcheck"]),Ea=new Set(["indeterminate"]);function Ta(t){return t==="svg"||t==="path"||t==="circle"||t==="rect"||t==="line"||t==="g"}function Sa(t){return t instanceof Element&&t.namespaceURI===Si}function ve(t,e){if(typeof t=="string"){const s=document.createTextNode(t);return e.appendChild(s),s}if(t instanceof Node)return e.appendChild(t),t;const{tag:o,props:i,children:n}=t,r=Ta(o)||Sa(e)?document.createElementNS(Si,o):document.createElement(o);for(const[s,l]of Object.entries(i))if(!(l==null||l===!1))if(s==="class")r.setAttribute("class",String(l));else if(s==="style")typeof l=="string"?r.style.cssText=l:Object.assign(r.style,l);else if(s==="html")r.innerHTML=String(l);else if(s==="text")r.textContent=String(l);else if(s.startsWith("on")&&typeof l=="function")r.addEventListener(s.slice(2).toLowerCase(),l);else if(s==="dataset")for(const[p,u]of Object.entries(l))r.dataset[p]=u;else Ea.has(s)?r[s]=!0:typeof l=="boolean"?l&&r.setAttribute(s,wa.has(s)?"true":""):r.setAttribute(s,String(l));for(const s of n)ve(s,r);return e.appendChild(r),r}function ar(t){for(;t.firstChild;)t.removeChild(t.firstChild)}const ka=Si;function $t(){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:{}}}const pi="开启拼版后只能有一个设计页面";function ki(t){const e=(o,i)=>(o??[]).map(n=>{const r={...n.options};return(n.printElementType?.type??n.type)==="table"&&c.syncTableElementSize(r),{id:n.id||c.generateId(),zone:i,options:r,printElementType:{...n.printElementType}}});return{...t,margins:{...t.margins},header:{height:t.header?.height??10,elements:[]},footer:{height:t.footer?.height??10,elements:[]},guides:[...t.guides??[]],elements:[...e(t.elements??[],"content"),...e(t.header?.elements??[],"header"),...e(t.footer?.elements??[],"footer")]}}function sr(t){const e=t.elements,o=i=>e.filter(n=>(n.zone||"content")===i).map(n=>({id:n.id,type:n.printElementType.type,options:{...n.options},printElementType:{...n.printElementType}}));return{unit:"mm",...t,header:{...t.header,elements:o("header")},footer:{...t.footer,elements:o("footer")},elements:o("content"),guides:[...t.guides??[]]}}function pn(t){const e=(i,n)=>{const r=ki(c.normalizeTemplateUnits(i));return r.name||(r.name=`页面 ${n+1}`),r};if(!t)return[e($t(),0)];const o=Array.isArray(t.pages)?t.pages:[t];return o.length?o.map(e):[e($t(),0)]}const St=t=>JSON.parse(JSON.stringify(t));class lr{scale=100;showRuler=!0;showGrid=!0;snapToGrid=!1;showTableGhostBorder=!0;dirty=!1;pages;activePageIndex=0;fields;selectedIds=new Set;previewIds=new Set;tableSelection=null;draggingIds=new Set;adsorbGuides=[];live=new Map;clipboard=[];moveSessionActive=!1;moveTimer=null;dragBefore=null;undoStack=[];redoStack=[];listeners=new Set;align=c.useAlign();group=c.useGroup();constructor(e={}){if(this.pages=pn(e.initialTemplate),this.fields=e.initialFields??[],e.initialElements?.length){const o=this.pages[0];o.elements=[...o.elements,...e.initialElements]}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}emit(e=!0){e&&(this.dirty=!0);for(const o of[...this.listeners])o()}get templateData(){return this.pages[this.activePageIndex]}set templateData(e){this.pages[this.activePageIndex]=e}get elements(){return this.templateData.elements.map(e=>this.live.get(e.id)??e)}get tilingEnabled(){return this.pages.some(e=>e.tiling?.enabled===!0)}switchPage(e){e<0||e>=this.pages.length||(this.activePageIndex=e,this.resetSelection(),this.emit(!1))}addPage(){if(this.tilingEnabled){window.alert(pi);return}this.recordHistory();const e=this.pages[this.activePageIndex]??$t();this.pages.push(ki({...$t(),paperSize:e.paperSize,orientation:e.orientation,outputRotation:e.outputRotation,customWidth:e.customWidth,customHeight:e.customHeight,name:this.nextDefaultPageName()})),this.switchPage(this.pages.length-1),this.emit()}nextDefaultPageName(){const e=new Set(this.pages.map(i=>i.name));let o=this.pages.length+1;for(;e.has(`页面 ${o}`);)o++;return`页面 ${o}`}duplicatePage(e){if(this.tilingEnabled){window.alert(pi);return}this.recordHistory();const o=St(this.pages[e]);o.name=`${o.name??`页面 ${e+1}`} 副本`,o.elements=o.elements.map(i=>({...i,id:c.generateId()})),this.pages.splice(e+1,0,o),this.switchPage(e+1),this.emit()}deletePage(e){this.pages.length<=1||(this.recordHistory(),this.pages.splice(e,1),this.activePageIndex=Math.max(0,Math.min(this.activePageIndex,this.pages.length-1)),this.resetSelection(),this.emit())}renamePage(e,o){this.recordHistory(),this.pages[e].name=o,this.emit()}movePage(e,o){if(o<0||o>=this.pages.length||e===o)return;this.recordHistory();const[i]=this.pages.splice(e,1);this.pages.splice(o,0,i),this.activePageIndex=o,this.emit()}onSelectionChanged;setSelection(e){this.selectedIds=e,this.onSelectionChanged?.(),this.emit(!1)}select(e){this.setSelection(new Set(e))}selectOne(e,o=!1){if(o){const i=new Set(this.selectedIds);i.has(e)?i.delete(e):i.add(e),this.setSelection(i)}else this.setSelection(new Set([e]))}clearSelection(){this.setSelection(new Set)}selectElement(e,o=!1){if(o){this.selectOne(e,!0);return}this.setSelection(new Set(this.group.getGroupedIds(this.elements,e)))}selectAll(){this.setSelection(new Set(this.elements.map(e=>e.id)))}get selectedElements(){return this.elements.filter(e=>this.selectedIds.has(e.id))}get selectedElement(){const e=this.selectedIds.values().next().value;return e?this.elements.find(o=>o.id===e)??null:null}resetSelection(){this.selectedIds=new Set,this.tableSelection=null,this.onSelectionChanged?.()}setTableSelection(e){this.tableSelection=e,this.emit(!1)}setPreview(e){this.previewIds=e,this.emit(!1)}commitPreview(){this.previewIds=new Set,this.emit(!1)}addGuide(e,o){const i=this.templateData.guides??[];this.templateData.guides=[...i,{id:c.generateId(),type:e,position:Math.round(o*10)/10}],this.emit()}moveGuide(e,o){const i=this.templateData.guides??[];this.templateData.guides=i.map(n=>n.id===e?{...n,position:Math.round(o*10)/10}:n),this.emit(!1)}removeGuide(e){this.templateData.guides=(this.templateData.guides??[]).filter(o=>o.id!==e),this.emit()}addElement(e,o={},i){const n=c.createRuntimeElement(e,o);return i&&!this.placeAtDropPoint(n,i)||(this.recordHistory(),this.templateData.elements.push(n),this.select(new Set([n.id])),this.emit()),n}addFieldElement(e,o={},i,n=!1){const r=n?c.createFieldLabelElement(e):c.createFieldElement(e);return Object.assign(r.options,o),i&&!this.placeAtDropPoint(r,i)||(this.recordHistory(),this.templateData.elements.push(r),this.select(new Set([r.id])),this.emit()),r}placeAtDropPoint(e,o){const i=this.templateData,n=c.zoneFromPaperPoint(i,o.x,o.y);if(n!=="content"&&!c.isZoneAllowedType(e.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const r=c.getZoneRects(i)[n];return e.zone=n,e.options.left=o.x-r.left,e.options.top=o.y-r.top,n!=="content"&&c.clampToZone(e,r),!0}deleteSelected(){this.selectedIds.size&&(this.recordHistory(),this.templateData.elements=this.templateData.elements.filter(e=>!this.selectedIds.has(e.id)),this.selectedIds=new Set,this.emit())}livePatch(e,o){const i=this.templateData.elements.find(r=>r.id===e);if(!i)return;const n=this.live.get(e)??i;this.live.set(e,{...n,options:{...n.options,...o}})}commitLive(){if(!this.live.size)return;this.recordHistory();const e=this.templateData.elements;for(const[o,i]of this.live){const n=e.find(r=>r.id===o);n&&Object.assign(n.options,i.options)}this.live.clear(),this.emit()}dragIds(e){const o=this.templateData.elements.find(i=>i.id===e);return!o||o.options.locked?[]:Array.from(this.group.getGroupedIds(this.elements,e))}discardLive(){this.live.clear()}dragStart(){this.dragBefore=new Map(this.elements.map(e=>[e.id,this.geoSig(e)]))}dragStop(){const e=this.dragBefore;if(!e)return;this.dragBefore=null;let o=!1;for(const i of this.elements){const n=e.get(i.id);!n||n===this.geoSig(i)||c.finalizeElementZone(i,this.templateData).rejected&&(o=!0)}o&&alert("该元素类型不能放入页眉/页脚"),this.emit()}geoSig(e){return`${e.zone||"content"}:${e.options.left},${e.options.top},${e.options.width},${e.options.height}`}updateElement(e,o,i=!0){i&&this.recordHistory();const n=this.templateData.elements.find(r=>r.id===e);n&&(Object.assign(n.options,o),n.printElementType.type==="table"&&c.syncTableElementSize(n.options),this.emit())}updateTemplateData(e){this.recordHistory(),Object.assign(this.templateData,e);for(const o of["paperSize","customWidth","customHeight"])if(o in e)for(const i of this.pages)Object.assign(i,{[o]:e[o]});this.emit()}moveLayer(e){if(!this.selectedIds.size)return;this.recordHistory();const o=this.templateData.elements,i=o.filter(r=>this.selectedIds.has(r.id)),n=o.filter(r=>!this.selectedIds.has(r.id));if(e==="top")this.templateData.elements=[...n,...i];else if(e==="bottom")this.templateData.elements=[...i,...n];else{const r=o.findIndex(p=>this.selectedIds.has(p.id)),s=e==="up"?r+1:r-1;if(s<0||s>=o.length)return;const l=[...o];[l[r],l[s]]=[l[s],l[r]],this.templateData.elements=l}this.emit()}alignSelected(e){this.selectedIds.size<2||(this.recordHistory(),this.align.align(this.elements.filter(o=>this.selectedIds.has(o.id)),e),this.emit())}groupSelected(){this.selectedIds.size<2||(this.recordHistory(),this.templateData.elements=this.group.group(this.elements,this.selectedIds),this.emit())}ungroupSelected(){this.selectedIds.size&&(this.recordHistory(),this.templateData.elements=this.group.ungroup(this.elements,this.selectedIds),this.emit())}copy(){this.clipboard=St(this.selectedElements),this.emit(!1)}cutSelected(){this.copy(),this.deleteSelected()}paste(e=10){if(!this.clipboard.length)return;this.recordHistory();const o=new Map;for(const r of this.clipboard){const s=r.options.groupId;s&&o.set(s,(o.get(s)??0)+1)}const i=new Map;for(const[r,s]of o)i.set(r,s>=2?c.generateGroupId():void 0);const n=this.templateData.elements;for(const r of this.clipboard){const s=St(r);s.id=c.generateId(),s.options.left+=e,s.options.top+=e,s.options.groupId=s.options.groupId?i.get(s.options.groupId):void 0,n.push(s)}this.emit()}duplicateSelected(){if(this.copy(),!this.clipboard.length)return;this.paste(15);const e=this.templateData.elements;this.selectOne(e[e.length-this.clipboard.length].id)}get hasClipboard(){return this.clipboard.length>0}moveSelected(e,o){const i=this.selectedElements.filter(n=>!n.options.locked);if(i.length){this.moveSessionActive||(this.moveSessionActive=!0,this.recordHistory());for(const n of i)n.options.left+=e,n.options.top+=o;this.moveTimer&&clearTimeout(this.moveTimer),this.moveTimer=setTimeout(()=>{this.moveSessionActive=!1,this.moveTimer=null},300),this.emit()}}cloneElement(e){this.recordHistory(),this.templateData.elements.push(e),this.selectedIds=new Set([e.id]),this.emit()}recordHistory(){this.undoStack.push({pages:St(this.pages),activePageIndex:this.activePageIndex}),this.undoStack.length>100&&this.undoStack.shift(),this.redoStack=[]}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}undo(){const e=this.undoStack.pop();e&&(this.redoStack.push({pages:St(this.pages),activePageIndex:this.activePageIndex}),this.pages=e.pages,this.activePageIndex=Math.min(e.activePageIndex,e.pages.length-1),this.resetSelection(),this.emit())}redo(){const e=this.redoStack.pop();e&&(this.undoStack.push({pages:St(this.pages),activePageIndex:this.activePageIndex}),this.pages=e.pages,this.activePageIndex=Math.min(e.activePageIndex,e.pages.length-1),this.resetSelection(),this.emit())}resetZoom(){this.setScale(100)}setScale(e,o=c.MIN_SCALE_PERCENT){this.scale=Math.max(o,Math.round(e)),this.emit(!1)}getTemplateJson(){const e=this.pages.map(sr),o=e.length===1?e[0]:{version:1,pages:e};return JSON.stringify(o)}loadTemplate(e){this.pages=pn(e),this.activePageIndex=0,this.resetSelection(),this.recordHistory(),this.emit()}get paperSize(){return c.getPaperDimensions(this.templateData)}}const ht=Symbol("mixed"),qo=new Set(["text","longText"]),Ca=["top","right","bottom","left"],Aa={on:!0,off:!1,mixed:ht};function un(t){const e=c.resolveBorderEdgeStates(t),o={};for(const i of Ca)o[i]=Aa[e[i]];return o}const Da=["fontFamily","fontSize","fontWeight","color","textAlign","verticalAlign","textDecoration"];class Ma{constructor(e){this.store=e}store;borderStyle="solid";borderWidth=.75;borderColor="#333333";borderMixed={style:!1,width:!1,color:!1};borderDraftKey="";get borderMixedAny(){return this.borderMixed.style||this.borderMixed.width||this.borderMixed.color}painterActive=!1;painterLocked=!1;painterSource=null;painterSnapshot=null;get selectedElements(){return this.store.elements.filter(e=>this.store.selectedIds.has(e.id)&&!e.options.locked)}get tableElement(){const e=this.store.tableSelection;return e?this.store.elements.find(o=>o.id===e.elementId)??null:null}get context(){return this.store.tableSelection&&this.tableElement?"cells":this.selectedElements.length>0||this.store.selectedIds.size>0?"elements":"none"}get targetCells(){const e=this.store.tableSelection,o=this.tableElement?.options.tableRows;if(!e||!o)return[];const i=[];for(let n=e.r1;n<=e.r2;n++)for(let r=e.c1;r<=e.c2;r++){const s=o[n]?.cells[r];s&&!s.merged&&i.push(s)}return i}get textTargets(){return this.selectedElements.filter(e=>qo.has(e.printElementType.type))}get fontEditable(){return this.context==="cells"?this.targetCells.length>0:this.context!=="elements"?!1:this.selectedElements.length>0&&this.textTargets.length===this.selectedElements.length}get styleTargets(){return this.context==="cells"?this.targetCells:this.textTargets.map(e=>e.options)}pick(e){if(!e.length)return;const o=e[0];return e.every(i=>i===o)?o:ht}hasToken(e,o){return(e??"").split(/\s+/).includes(o)}get values(){const e=this.styleTargets;if(!e.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=e.map(n=>n.fontWeight==="bold"||n.fontWeight==="bolder"),i=e.map(n=>n.textDecoration);return{fontFamily:this.pick(e.map(n=>n.fontFamily)),fontSize:this.pick(e.map(n=>n.fontSize)),color:this.pick(e.map(n=>n.color)),backgroundColor:this.pick(e.map(n=>n.backgroundColor)),textAlign:this.pick(e.map(n=>this.context==="cells"?n.align:n.textAlign)),verticalAlign:this.pick(e.map(n=>this.context==="cells"?n.valign:n.verticalAlign)),bold:o.every(Boolean)?!0:o.some(Boolean)?ht:!1,underline:i.map(n=>this.hasToken(n,"underline")).every(Boolean)?!0:i.some(n=>this.hasToken(n,"underline"))?ht:!1,strike:i.map(n=>this.hasToken(n,"line-through")).every(Boolean)?!0:i.some(n=>this.hasToken(n,"line-through"))?ht:!1}}commit(){this.store.recordHistory(),this.store.emit()}writeCells(e){const o=this.targetCells;o.length&&(o.forEach(e),this.commit())}applyStyle(e){if(this.context==="cells"){this.writeCells(l=>{"fontFamily"in e&&(l.fontFamily=e.fontFamily),"fontSize"in e&&(l.fontSize=e.fontSize),"color"in e&&(l.color=e.color),"backgroundColor"in e&&(l.backgroundColor=e.backgroundColor),"textAlign"in e&&(l.align=e.textAlign),"verticalAlign"in e&&(l.valign=e.verticalAlign)});return}const o=this.textTargets,i=this.selectedElements,r=["fontFamily","fontSize","color","textAlign","verticalAlign"].some(l=>l in e),s="backgroundColor"in e;!(o.length&&r)&&!(i.length&&s)||(o.forEach(l=>{const p=l.options;"fontFamily"in e&&(p.fontFamily=e.fontFamily),"fontSize"in e&&(p.fontSize=e.fontSize),"color"in e&&(p.color=e.color),"textAlign"in e&&(p.textAlign=e.textAlign),"verticalAlign"in e&&(p.verticalAlign=e.verticalAlign)}),s&&i.forEach(l=>{l.options.backgroundColor=e.backgroundColor}),this.commit())}toggleBold(){if(this.context==="cells"){const i=this.values.bold!==!0;this.writeCells(n=>{n.fontWeight=i?"bold":void 0});return}const e=this.values.bold!==!0,o=this.textTargets;o.length&&(o.forEach(i=>{i.options.fontWeight=e?"bold":"normal"}),this.commit())}toggleDecoration(e){if(this.context==="cells")return;const o=this.textTargets;if(!o.length)return;const i=this.values[e==="underline"?"underline":"strike"]!==!0;o.forEach(n=>{const r=(n.options.textDecoration??"").split(/\s+/).filter(Boolean),s=r.indexOf(e);i&&s<0&&r.push(e),!i&&s>=0&&r.splice(s,1),n.options.textDecoration=r.length?r.join(" "):void 0}),this.commit()}toggleUnderline(){this.toggleDecoration("underline")}toggleStrike(){this.toggleDecoration("line-through")}syncBorderDraft(){if(this.context!=="cells"){this.borderDraftKey&&(this.borderDraftKey="",this.borderStyle="solid",this.borderWidth=.75,this.borderColor="#333333",this.borderMixed={style:!1,width:!1,color:!1});return}const e=this.store.tableSelection,o=this.tableElement?.options.tableRows;if(!e||!o)return;const i=`cells:${e.elementId}:${e.r1}:${e.c1}:${e.r2}:${e.c2}`;if(i===this.borderDraftKey)return;if(this.borderDraftKey=i,c.resolveCellGroupMode(o,e).mode==="multi"){this.borderStyle="solid",this.borderWidth=.75,this.borderColor="#333333",this.borderMixed={style:!1,width:!1,color:!1};return}const n=c.resolveCellBorderDisplay(o,e);if(n.style===void 0&&n.width===void 0&&n.color===void 0){this.borderMixed={style:!1,width:!1,color:!1},this.borderStyle=null,this.borderWidth=0,this.borderColor="#333333";return}this.borderMixed={style:n.style==="mixed",width:n.width==="mixed",color:n.color==="mixed"},this.borderMixed.style?this.borderStyle=null:n.style===void 0?this.borderStyle="solid":n.style==="none"?this.borderStyle=null:this.borderStyle=n.style,this.borderWidth=this.borderMixed.width?void 0:typeof n.width=="number"?n.width:.75,this.borderColor=this.borderMixed.color?void 0:typeof n.color=="string"?n.color:"#333333"}borderSpec(){const e=this.borderStyle??(this.borderMixed.style?"solid":"none");return{width:this.borderWidth??.75,style:e,color:this.borderColor??"#333333"}}setBorderWidth(e){this.borderWidth=e,this.borderMixed.width=!1}setBorderColor(e){this.borderColor=e,this.borderMixed.color=!1}settleBorderDraft(){this.context==="cells"&&(this.borderMixed.style&&(this.borderStyle="solid",this.borderMixed.style=!1),this.borderMixed.width&&(this.borderWidth=.75,this.borderMixed.width=!1),this.borderMixed.color&&(this.borderColor="#333333",this.borderMixed.color=!1))}toggleBorderStyle(e){const o=this.borderStyle===e?null:e;this.borderMixed.style=!1,this.borderStyle=o,o===null?this.borderWidth=0:this.borderWidth===0&&(this.borderWidth=.75)}applyElementBorder(e,o){const i=this.selectedElements;i.length&&(i.forEach(n=>{c.applyElementBorderPreset(n.options,e,o)}),this.commit())}applyCellBorderPreset(e,o){const i=this.store.tableSelection,n=this.tableElement?.options.tableRows;!i||!n||(c.applyBorderPreset(n,{r1:i.r1,c1:i.c1,r2:i.r2,c2:i.c2},e,o),this.commit())}applyCellBorderEdges(e,o,i){this.writeCells(n=>{for(const r of e)c.setCellBorderEdge(n,r,i?o:null)})}get cellEdges(){if(this.context!=="cells")return null;const e=this.targetCells;return e.length?un(e.map(o=>o.borders)):null}toggleCellEdge(e,o){const i=this.cellEdges?.[e]!==!0;this.applyCellBorderEdges([e],o,i)}get elementEdges(){if(this.context!=="elements")return null;const e=this.selectedElements;return e.length?un(e.map(o=>c.elementVisibleBorders(o.options))):null}toggleElementEdge(e,o){const i=this.selectedElements;if(!i.length)return;const n=this.elementEdges?.[e]!==!0;i.forEach(r=>c.setElementBorderEdgeVisible(r.options,e,n,o)),this.commit()}applyBorderPreset(e){const o=this.borderStyle===null;if(this.context==="cells"){const i=o&&!this.borderMixed.style;this.applyCellBorderPreset(i?"none":e,this.borderSpec()),this.settleBorderDraft()}else this.applyElementBorder(o||e==="none"?"none":"all",this.borderSpec())}applyEdge(e){if(this.borderStyle===null&&!this.borderMixed.style){this.context==="cells"?(this.applyCellBorderEdges([e],this.borderSpec(),!1),this.settleBorderDraft()):this.clearElementEdge(e);return}this.context==="cells"?(this.toggleCellEdge(e,this.borderSpec()),this.settleBorderDraft()):this.toggleElementEdge(e,this.borderSpec())}clearElementEdge(e){const o=this.selectedElements;o.length&&(o.forEach(i=>c.setElementBorderEdgeVisible(i.options,e,!1)),this.commit())}edgeOn(e){return(this.context==="cells"?this.cellEdges:this.elementEdges)?.[e]===!0}get painterCapturable(){return this.selectedElements.length===1}clonePainterBorders(e){if(!e)return;const o={};for(const i of c.ELEMENT_BORDER_SIDES){const n=e[i];n&&(o[i]={...n})}return o}pickPainterSource(e=!1){const o=this.selectedElements[0];if(!o)return!1;const i=o.options,n=o.printElementType.type;return this.painterSnapshot={text:qo.has(n)?Object.fromEntries(Da.map(r=>[r,i[r]])):null,backgroundColor:i.backgroundColor,border:c.acceptsElementBorder(n)?{borderWidth:i.borderWidth,borderStyle:i.borderStyle,borderColor:i.borderColor,borders:this.clonePainterBorders(i.borders)}:null},this.painterSource=o.id,this.painterActive=!0,this.painterLocked=e,!0}cancelPainter(){this.painterActive=!1,this.painterLocked=!1,this.painterSource=null,this.painterSnapshot=null}applyPainter(e){const o=this.painterSnapshot;if(!o||e.options.locked||e.id===this.painterSource)return!1;const i=e.options,n=e.printElementType.type;return o.text&&qo.has(n)&&Object.assign(i,o.text),i.backgroundColor=o.backgroundColor,o.border&&c.acceptsElementBorder(n)&&(i.borderWidth=o.border.borderWidth,i.borderStyle=o.border.borderStyle,i.borderColor=o.border.borderColor,i.borders=this.clonePainterBorders(o.border.borders)),!0}painterSyncSelection(){if(!this.painterActive||!this.painterSnapshot)return;const e=this.selectedElements;if(!e.length){this.cancelPainter();return}let o=!1;e.forEach(i=>{o=this.applyPainter(i)||o}),o&&(this.commit(),this.painterLocked||this.cancelPainter())}handlePainterKeydown(e){if(e.key!=="Escape"||!this.painterActive)return;const o=e.target?.tagName;o==="INPUT"||o==="TEXTAREA"||o==="SELECT"||this.cancelPainter()}}const _a="自定义属性";function dr(){const t=[];for(const{plugin:e,kind:o}of c.getElementPluginKinds()){const i=ci.getElementUI(o.type);if(!i)continue;const r=(o.designer??e.designer)?.materialCard;t.push({type:o.type,label:o.label,icon:o.icon??r?.icon??"Shapes",group:r?.group??i.group,ui:i})}return t}function Ci(t){if(t)return dr().find(e=>e.type===t)}function ui(t){if(!t)return;const e=Ci(t.printElementType.type);if(!e||!e.ui.renderProperty)return;const o=e.ui;if(o.hasProperties)try{if(!o.hasProperties(t))return}catch{return}const i=_a;return{ui:o,label:i,icon:e.icon,searchKeywords:o.searchKeywords?[...o.searchKeywords]:[i,e.label,e.type]}}const fo=Object.freeze([{type:"text",label:"文本",icon:"Type",material:!0,propertyGroup:"text",dblEditableField:"formatter",origin:"builtin"},{type:"barcode",label:"条形码",icon:"Barcode",material:!0,propertyGroup:"code",dblEditableField:"formatter",origin:"builtin"},{type:"qrcode",label:"二维码",icon:"QrCode",material:!0,propertyGroup:"code",dblEditableField:"formatter",origin:"builtin"},{type:"image",label:"图片",icon:"Image",material:!0,propertyGroup:"general",dblEditableField:"src",origin:"builtin"},{type:"table",label:"表格",icon:"Table",material:!0,propertyGroup:"table",origin:"builtin"},{type:"longText",label:"长文",icon:"TextAlignStart",material:!0,propertyGroup:"text",dblEditableField:"formatter",origin:"builtin"},{type:"flowList",label:"流式列表",icon:"List",material:!0,propertyGroup:"general",dblEditableField:"formatter",origin:"builtin"},{type:"hline",label:"横线",icon:"Minus",material:!0,propertyGroup:"general",origin:"builtin"},{type:"vline",label:"竖线",icon:"SeparatorVertical",material:!0,propertyGroup:"general",origin:"builtin"},{type:"rect",label:"矩形",icon:"Square",material:!0,propertyGroup:"general",origin:"builtin"},{type:"oval",label:"椭圆",icon:"Circle",material:!0,propertyGroup:"general",origin:"builtin"},{type:"html",label:"HTML",icon:"Code",material:!1,propertyGroup:"general",origin:"builtin"},{type:"pageNumber",label:"页码",icon:"Shapes",material:!1,propertyGroup:"general",origin:"builtin"}]),hn=Symbol.for("worm-print-platform.element-definitions.v1"),fn=globalThis;function ze(){const t=fn[hn];if(t)return t;const e={overrides:new Map,builtinRenderers:new Map,rendererOverrides:new Map,listeners:new Set,nextSeq:0,seq:new Map};return fn[hn]=e,e}function Bt(){for(const t of[...ze().listeners])try{t()}catch{}}function cr(t){const e=ze();return e.listeners.add(t),()=>{e.listeners.delete(t)}}function Ra(){return new Map(fo.map(t=>[t.type,t]))}function Pa(t){if(!t?.type||typeof t.type!="string")throw new Error("registerElementDefinition: type 必须是非空字符串");if(!t.label||typeof t.label!="string")throw new Error("registerElementDefinition: label 必须是非空字符串");const e=ze(),o={...t,origin:t.origin??"custom"};return e.overrides.set(o.type,o),e.seq.set(o.type,e.nextSeq++),Bt(),()=>{const i=ze();i.overrides.get(o.type)===o&&(i.overrides.delete(o.type),Bt())}}function Ia(t,e){if(!t||typeof e!="function")throw new Error("registerElementRenderer: 需要 type 与渲染函数");return ze().rendererOverrides.set(t,e),Bt(),()=>{const i=ze();i.rendererOverrides.get(t)===e&&(i.rendererOverrides.delete(t),Bt())}}function pr(t){const e=ze();for(const[o,i]of Object.entries(t))e.builtinRenderers.set(o,i);return()=>{const o=ze();for(const[i,n]of Object.entries(t))o.builtinRenderers.get(i)===n&&o.builtinRenderers.delete(i)}}function Fa(t){const e=Ci(t);if(e)return{type:e.type,label:e.label,icon:e.icon,group:e.group,material:!0,propertyGroup:"general",origin:"plugin"}}function nt(t){if(!t)return;const e=ze(),o=e.overrides.get(t)??Ra().get(t)??Fa(t);if(!o)return;const i=e.rendererOverrides.get(t)??e.builtinRenderers.get(t);return i?{...o,renderContent:i}:o}function ur(){const t=ze(),e=[],o=new Set;for(const n of fo)e.push(nt(n.type)??n),o.add(n.type);const i=[...t.overrides.entries()].filter(([n])=>!o.has(n)).sort((n,r)=>(t.seq.get(n[0])??0)-(t.seq.get(r[0])??0));for(const[n]of i){const r=nt(n);r&&e.push(r),o.add(n)}for(const n of dr()){if(o.has(n.type))continue;const r=nt(n.type);r&&e.push(r),o.add(n.type)}return e}function hr(){return ur().filter(t=>t.material)}function fr(t){return nt(t)?.propertyGroup??"general"}function gr(t){return nt(t)?.dblEditableField}function mr(t){return nt(t)?.icon??"Shapes"}function La(){const t=ze();t.overrides.clear(),t.rendererOverrides.clear(),t.seq.clear(),t.nextSeq=0,Bt()}const Ai="1.2.0",br="print-designer",Di=["template","fields","name","fonts","design-data","theme","theme-config"],xr=["is-edit","show-help","show-preview","show-save"],za=Object.freeze({bubbles:!0,composed:!0}),Mi=["container","toolbar","format-bar","left-panel","canvas-area","property-panel","status-bar","page-tabs"],vr=["--pd-bg","--pd-surface","--pd-field-bg","--pd-sidebar","--pd-sidebar-hover","--pd-canvas-bg","--pd-paper","--pd-accent","--pd-accent-2","--pd-accent-soft","--pd-accent-secondary","--pd-danger-soft","--pd-ink-green","--pd-text","--pd-text-muted","--pd-text-faint","--pd-border","--pd-border-soft","--pd-input-bg","--pd-hover-tint","--pd-danger","--pd-danger-bg","--pd-danger-border","--pd-menu-text","--pd-menu-hover","--pd-menu-border","--pd-menu-divider","--pd-menu-muted","--pd-menu-disabled","--pd-scrollbar","--pd-scrollbar-thumb","--pd-scrollbar-thumb-hover","--pd-help-field-bg","--pd-help-field-line","--pd-help-field-ink","--pd-help-function-bg","--pd-help-function-line","--pd-help-function-ink","--pd-help-variable-bg","--pd-help-variable-line","--pd-help-variable-ink","--pd-help-conditional-bg","--pd-help-conditional-line","--pd-help-conditional-ink","--pd-handle","--pd-ruler","--pd-ruler-bg","--pd-ruler-cursor","--pd-radius","--pd-shadow-sm","--pd-shadow-md","--pd-shadow-paper","--pd-success","--pd-text-regular","--pd-fill-light"],yr=["getTemplateJson","loadTemplate","save","validateTemplate","getGeometryWarnings"],wr=["template","fields","fonts","designData","isEdit","showHelp","showPreview","showSave","theme","themeConfig","uploadImage","uploadDesignBackground"],Le=Object.freeze({save:"save",preview:"preview",help:"help",dblclickElement:"dblclick-element",dblclickCell:"dblclick-cell"}),Er=[Le.save,Le.preview,Le.help,Le.dblclickElement,Le.dblclickCell];function hi(){return{version:Ai,tag:br,attributes:Di,booleanAttributes:xr,events:Er,parts:Mi,themeTokens:vr,methods:yr,properties:wr}}const Oa={"--pd-bg":"#181a20","--pd-surface":"#1f2229","--pd-field-bg":"#252830","--pd-sidebar":"#1f2229","--pd-sidebar-hover":"#2b2f39","--pd-accent":"#4C8DFF","--pd-accent-2":"#6C9DFF","--pd-accent-soft":"rgba(76, 141, 255, .16)","--pd-accent-secondary":"#ff7a7a","--pd-danger-soft":"rgba(255, 122, 122, .14)","--pd-ink-green":"#6cce5a","--pd-text":"#e6e8ee","--pd-text-muted":"#9aa0ad","--pd-text-faint":"#6f7683","--pd-text-regular":"#c9cdd8","--pd-border":"#3a3f4b","--pd-border-soft":"#2d323c","--pd-input-bg":"#262a33","--pd-hover-tint":"rgba(76, 141, 255, .12)","--pd-fill-light":"#2b2f39","--pd-danger":"#ff6b6b","--pd-danger-bg":"#3a2226","--pd-danger-border":"#6b3535","--pd-success":"#4ade80","--pd-menu-text":"#d6d9e0","--pd-menu-hover":"#2b2f39","--pd-menu-border":"#3a3f4b","--pd-menu-divider":"#2d323c","--pd-menu-muted":"#8b91a0","--pd-menu-disabled":"#555b68","--pd-scrollbar":"rgba(255, 255, 255, .18)","--pd-scrollbar-thumb":"rgba(255, 255, 255, .16)","--pd-scrollbar-thumb-hover":"rgba(255, 255, 255, .3)","--pd-help-field-bg":"#16283a","--pd-help-field-line":"#2c5870","--pd-help-field-ink":"#7cc4f5","--pd-help-function-bg":"#162e22","--pd-help-function-line":"#2c5b3c","--pd-help-function-ink":"#79d69a","--pd-help-variable-bg":"#302c16","--pd-help-variable-line":"#6b5d24","--pd-help-variable-ink":"#d6b25e","--pd-help-conditional-bg":"#301a28","--pd-help-conditional-line":"#6b3454","--pd-help-conditional-ink":"#e58ab5","--pd-shadow-sm":"0 1px 2px rgba(0, 0, 0, .3)","--pd-shadow-md":"0 2px 8px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .5)"};function gn(t,e){(e==null||e>t.length)&&(e=t.length);for(var o=0,i=Array(e);o<e;o++)i[o]=t[o];return i}function Na(t){if(Array.isArray(t))return t}function $a(t,e){var o=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(o!=null){var i,n,r,s,l=[],p=!0,u=!1;try{if(r=(o=o.call(t)).next,e!==0)for(;!(p=(i=r.call(o)).done)&&(l.push(i.value),l.length!==e);p=!0);}catch(h){u=!0,n=h}finally{try{if(!p&&o.return!=null&&(s=o.return(),Object(s)!==s))return}finally{if(u)throw n}}return l}}function Ba(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ha(t,e){return Na(t)||$a(t,e)||Ua(t,e)||Ba()}function Ua(t,e){if(t){if(typeof t=="string")return gn(t,e);var o={}.toString.call(t).slice(8,-1);return o==="Object"&&t.constructor&&(o=t.constructor.name),o==="Map"||o==="Set"?Array.from(t):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?gn(t,e):void 0}}const Tr=Object.entries,Wa=Object.keys,mn=Object.setPrototypeOf,Ga=Object.isFrozen,Sr=Object.getPrototypeOf,kr=Object.getOwnPropertyDescriptor;let fe=Object.freeze,se=Object.seal,it=Object.create,Cr=typeof Reflect<"u"&&Reflect,so=Cr.apply,fi=Cr.construct;fe||(fe=function(e){return e});se||(se=function(e){return e});so||(so=function(e,o){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return e.apply(o,n)});fi||(fi=function(e){for(var o=arguments.length,i=new Array(o>1?o-1:0),n=1;n<o;n++)i[n-1]=arguments[n];return new e(...i)});const qe=J(Array.prototype.forEach),qa=J(Array.prototype.lastIndexOf),bn=J(Array.prototype.pop),Pt=J(Array.prototype.push),Ka=J(Array.prototype.slice),Va=J(Array.prototype.splice),Dt=Array.isArray,Ko=Ar(Set),Vo=J(Set.prototype.add),It=J(Set.prototype.has),pt=J(String.prototype.toLowerCase),jo=J(String.prototype.toString),ja=J(String.prototype.match),eo=J(String.prototype.replace),Yo=J(String.prototype.indexOf),Ya=J(String.prototype.trim),Xa=J(Number.prototype.toString),Za=J(Boolean.prototype.toString),xn=typeof BigInt>"u"?null:J(BigInt.prototype.toString),vn=typeof Symbol>"u"?null:J(Symbol.prototype.toString),xe=J(Object.prototype.hasOwnProperty),Ft=J(Object.prototype.toString),Qa=RegExp.prototype.test,he=function(e,o){return e instanceof RegExp&&(e.lastIndex=0),so(Qa,e,[o])},Ke=Ar(TypeError);function J(t){return function(e){for(var o=arguments.length,i=new Array(o>1?o-1:0),n=1;n<o;n++)i[n-1]=arguments[n];return so(t,e,i)}}function Ar(t){return function(){for(var e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return fi(t,o)}}function q(t,e){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:pt;if(mn&&mn(t,null),!Dt(e))return t;let i=e.length;for(;i--;){let n=e[i];if(typeof n=="string"){const r=o(n);r!==n&&(Ga(e)||(e[i]=r),n=r)}t[n]=!0}return t}function Ja(t){for(let e=0;e<t.length;e++)xe(t,e)||(t[e]=null);return t}function lo(t){const e=it(null);for(const i of Tr(t)){var o=Ha(i,2);const n=o[0],r=o[1];xe(t,n)&&(Dt(r)?e[n]=Ja(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=lo(r):e[n]=r)}return e}function Ot(t){const e=it(null),o=Wa(t);let i=o.length;for(;i--;)e[o[i]]=t[o[i]];return e}function es(t){switch(typeof t){case"string":return t;case"number":return Xa(t);case"boolean":return Za(t);case"bigint":return xn?xn(t):"0";case"symbol":return vn?vn(t):"Symbol()";case"undefined":return Ft(t);case"function":case"object":{if(t===null)return Ft(t);const e=t,o=Ae(e,"toString");if(typeof o=="function"){const i=o(e);return typeof i=="string"?i:Ft(i)}return Ft(t)}default:return Ft(t)}}function Ae(t,e){for(;t!==null;){const i=kr(t,e);if(i){if(i.get)return J(i.get);if(typeof i.value=="function")return J(i.value)}t=Sr(t)}function o(){return null}return o}function ts(t,e){for(;t!==null;){const o=kr(t,e);if(o)return o.get?J(o.get):null;t=Sr(t)}return null}function os(t){if(!t)return!1;try{return he(t,""),!0}catch{return!1}}const yn=fe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Xo=fe(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Zo=fe(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),is=fe(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Qo=fe(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ns=fe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),wn=fe(["#text"]),En=fe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Jo=fe(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Tn=fe(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),to=fe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),rs=se(/{{[\w\W]*|^[\w\W]*}}/g),as=se(/<%[\w\W]*|^[\w\W]*%>/g),ss=se(/\${[\w\W]*/g),ls=se(/{{|}}|\${|<%|%>|&lt;%|%&gt;/),ds=se(/^data-[\-\w.\u00B7-\uFFFF]+$/),cs=se(/^aria-[\-\w]+$/),Sn=se(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ps=se(/^(?:\w+script|data):/i),us=se(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),hs=se(/^html$/i),fs=se(/^[a-z][.\w]*(-[.\w]+)+$/i),ei=se(/<[/\w!]/g),kn=se(/<[/\w]/g),gs=se(/<\/no(script|embed|frames)/i),Cn=se(/\/>/i),ms=se(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),bs=se(/^[\r\n\t ]+/),ne={element:1,text:3,processingInstruction:7,comment:8,document:9,documentFragment:11},xs=fe(q({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),vs=function(){return typeof window>"u"?null:window},ys=function(e,o){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const n="data-tt-policy-suffix";o&&o.hasAttribute(n)&&(i=o.getAttribute(n));const r="dompurify"+(i?"#"+i:"");try{return e.createPolicy(r,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},An=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},tt=function(e,o,i,n){return xe(e,o)&&Dt(e[o])?q(n.base?Ot(n.base):{},e[o],n.transform):i},ti=function(e,o,i){const n=xe(e,o)?e[o]:void 0;return n&&typeof n=="object"?lo(n):i};function Dr(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:vs();const e=E=>Dr(E);if(e.version="3.4.18",e.removed=[],!t||!t.document||t.document.nodeType!==ne.document||!t.Element)return e.isSupported=!1,e;let o=t.document;const i=o,n=i.currentScript,r=t.HTMLTemplateElement,s=t.Node,l=t.Element,p=t.NodeFilter,u=t.DOMParser,h=t.trustedTypes,m=l.prototype,g=Ae(m,"cloneNode"),T=Ae(m,"remove"),b=Ae(m,"removeAttributeNode"),k=Ae(m,"nextSibling"),y=Ae(m,"childNodes"),C=Ae(m,"parentNode"),D=Ae(m,"shadowRoot"),P=Ae(m,"attributes"),A=s&&s.prototype?Ae(s.prototype,"nodeType"):null,L=s&&s.prototype?Ae(s.prototype,"nodeName"):null,K=s&&s.prototype?Ae(s.prototype,"ownerDocument"):null,N=function(d){return A?A(d):d.nodeType},F=function(d){return L?L(d):d.nodeName},z=ts(m,"namespaceURI"),ee=function(d){return z?z(d):d.namespaceURI};if(typeof r=="function"){const E=o.createElement("template");E.content&&E.content.ownerDocument&&(o=E.content.ownerDocument)}let H,pe="",te,ke=!1,x=0;const Z=function(){if(x>0)throw Ke('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},le=function(d){Z(),x++;try{return H.createHTML(d)}finally{x--}},De=function(d){return H&&Ao?le(d):d},B=function(d){Z(),x++;try{return H.createScriptURL(d)}finally{x--}},Ue=function(){return ke||(te=ys(h,n),ke=!0),te},re=o,ye=re.implementation,Me=re.createNodeIterator,G=re.createDocumentFragment,Ze=re.getElementsByTagName,Wt=i.importNode;let j=An();e.isSupported=typeof Tr=="function"&&typeof C=="function"&&ye&&ye.createHTMLDocument!==void 0;const yo=rs,at=as,Ee=ss,Ce=ds,wo=cs,Eo=ps,To=us,So=fs;let Gt=Sn,Y=null;const Qe=q({},[...yn,...Xo,...Zo,...Qo,...wn]);let X=null;const Je=q({},[...En,...Jo,...Tn,...to]);let ue=null,st=null,V=null;const _e=Object.seal(it(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Mt=!0,v=!0,U=!1,ge=!0,Q=!1,Re=!0,We=!1,ko=!1,qt=null,Kt=null,Co=!1,xt=!1,Vt=!1,Ao=!1,Ui=!0,Wi=!1;const Gi="user-content-";let Do=!0,Mo=!1,lt=null,vt=!1,dt=null;const qi=q({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Ki=null;const Vi=q({},["audio","video","img","source","image","track"]);let ji=null;const Yi=q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),jt="http://www.w3.org/1998/Math/MathML",Yt="http://www.w3.org/2000/svg",Oe="http://www.w3.org/1999/xhtml";let yt=Oe,_o=!1,Xi=null;const Xr=q({},[jt,Yt,Oe],jo),Zr=fe(q({},["mi","mo","mn","ms","mtext"]));let Ro=null;const Qr=fe(q({},["annotation-xml"]));let Po=null;const Jr=fe(it(null)),ea=q({},["title","style","font","a","script"]);let _t=null;const ta=["application/xhtml+xml","text/html"],oa="text/html";let ie=null,Xt=null;const ia=o.createElement("form"),Zi=function(d){return d instanceof RegExp||d instanceof Function},Io=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(!d||typeof d!="object")&&(d={}),d=lo(d),_t=ta.indexOf(d.PARSER_MEDIA_TYPE)===-1?oa:d.PARSER_MEDIA_TYPE,ie=_t==="application/xhtml+xml"?jo:pt,Y=tt(d,"ALLOWED_TAGS",Qe,{transform:ie}),X=tt(d,"ALLOWED_ATTR",Je,{transform:ie}),Xi=tt(d,"ALLOWED_NAMESPACES",Xr,{transform:jo}),ji=tt(d,"ADD_URI_SAFE_ATTR",Yi,{transform:ie,base:Yi}),Ki=tt(d,"ADD_DATA_URI_TAGS",Vi,{transform:ie,base:Vi}),dt=tt(d,"FORBID_CONTENTS",qi,{transform:ie}),st=tt(d,"FORBID_TAGS",it(null),{transform:ie}),V=tt(d,"FORBID_ATTR",it(null),{transform:ie}),vt=xe(d,"USE_PROFILES")?d.USE_PROFILES&&typeof d.USE_PROFILES=="object"?lo(d.USE_PROFILES):d.USE_PROFILES:!1,Mt=d.ALLOW_ARIA_ATTR!==!1,v=d.ALLOW_DATA_ATTR!==!1,U=d.ALLOW_UNKNOWN_PROTOCOLS||!1,ge=d.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Q=d.SAFE_FOR_TEMPLATES||!1,Re=d.SAFE_FOR_XML!==!1,We=d.WHOLE_DOCUMENT||!1,xt=d.RETURN_DOM||!1,Vt=d.RETURN_DOM_FRAGMENT||!1,Ao=d.RETURN_TRUSTED_TYPE||!1,Co=d.FORCE_BODY||!1,Ui=d.SANITIZE_DOM!==!1,Wi=d.SANITIZE_NAMED_PROPS||!1,Do=d.KEEP_CONTENT!==!1,Mo=d.IN_PLACE||!1,Gt=os(d.ALLOWED_URI_REGEXP)?d.ALLOWED_URI_REGEXP:Sn,yt=typeof d.NAMESPACE=="string"?d.NAMESPACE:Oe,Ro=ti(d,"MATHML_TEXT_INTEGRATION_POINTS",Zr),Po=ti(d,"HTML_INTEGRATION_POINTS",Qr);const f=ti(d,"CUSTOM_ELEMENT_HANDLING",Jr);if(ue=it(null),xe(f,"tagNameCheck")&&Zi(f.tagNameCheck)&&(ue.tagNameCheck=f.tagNameCheck),xe(f,"attributeNameCheck")&&Zi(f.attributeNameCheck)&&(ue.attributeNameCheck=f.attributeNameCheck),xe(f,"allowCustomizedBuiltInElements")&&typeof f.allowCustomizedBuiltInElements=="boolean"&&(ue.allowCustomizedBuiltInElements=f.allowCustomizedBuiltInElements),se(ue),Q&&(v=!1),Vt&&(xt=!0),vt&&((xe(d,"ALLOWED_TAGS")||xe(d,"ALLOWED_ATTR"))&&typeof console<"u"&&typeof console.warn=="function"&&console.warn("DOMPurify: USE_PROFILES overrides ALLOWED_TAGS and ALLOWED_ATTR. Do not use these options together."),Y=q({},wn),X=it(null),vt.html===!0&&(q(Y,yn),q(X,En)),vt.svg===!0&&(q(Y,Xo),q(X,Jo),q(X,to)),vt.svgFilters===!0&&(q(Y,Zo),q(X,Jo),q(X,to)),vt.mathMl===!0&&(q(Y,Qo),q(X,Tn),q(X,to))),_e.tagCheck=null,_e.attributeCheck=null,xe(d,"ADD_TAGS")&&(typeof d.ADD_TAGS=="function"?_e.tagCheck=d.ADD_TAGS:Dt(d.ADD_TAGS)&&(Y===Qe&&(Y=Ot(Y)),q(Y,d.ADD_TAGS,ie))),xe(d,"ADD_ATTR")&&(typeof d.ADD_ATTR=="function"?_e.attributeCheck=d.ADD_ATTR:Dt(d.ADD_ATTR)&&(X===Je&&(X=Ot(X)),q(X,d.ADD_ATTR,ie))),xe(d,"ADD_FORBID_CONTENTS")&&Dt(d.ADD_FORBID_CONTENTS)&&(dt===qi&&(dt=Ot(dt)),q(dt,d.ADD_FORBID_CONTENTS,ie)),Do&&(Y["#text"]=!0),We&&q(Y,["html","head","body"]),Y.table&&(Y.tbody=!0,delete st.tbody),d.TRUSTED_TYPES_POLICY){if(typeof d.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ke('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof d.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ke('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const w=H;H=d.TRUSTED_TYPES_POLICY;try{pe=le("")}catch(S){throw H=w,S}}else d.TRUSTED_TYPES_POLICY===null?(H=void 0,pe=""):(H===void 0&&(H=Ue()),H&&typeof pe=="string"&&(pe=le("")));Xt=fe(d)},Qi=q({},[...Xo,...Zo,...is]),Ji=q({},[...Qo,...ns]),na=function(d,f,w){return f===Oe?d==="svg":f===jt?d==="svg"&&(w==="annotation-xml"||Ro[w]):!!Qi[d]},ra=function(d,f,w){return f===Oe?d==="math":f===Yt?d==="math"&&Po[w]:!!Ji[d]},aa=function(d,f,w){return f===Yt&&!Po[w]||f===jt&&!Ro[w]?!1:!Ji[d]&&(ea[d]||!Qi[d])},sa=function(d){const f=ee(d),w=pt(F(d)),S=C(d);let R=yt,I="template";return S&&N(S)===ne.element&&(R=ee(S),I=pt(F(S))),Xi[f]?f===Yt?na(w,R,I):f===jt?ra(w,R,I):f===Oe?aa(w,R,I):_t==="application/xhtml+xml":!1},et=function(d){Pt(e.removed,{element:d});try{C(d).removeChild(d)}catch{if(T(d),!C(d))throw Ke("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},en=function(d,f,w){try{b(d,f)}catch{try{d.removeAttribute(w)}catch{}}},Fo=function(d){Oo(d);const f=y(d);f&&qe(Ka(f),w=>{try{T(w)}catch{}}),N(d)===ne.element&&Lo(d,!1)},wt=function(d,f,w){if(!w)try{w=f.getAttributeNode(d)}catch{w=null}if(Pt(e.removed,{attribute:w||null,from:f}),w)en(f,w,d);else try{f.removeAttribute(d)}catch{}if(d==="is")if(xt||Vt)try{et(f)}catch{}else try{f.setAttribute(d,"")}catch{}},Lo=function(d,f){const w=P(d);if(w)for(let S=w.length-1;S>=0;--S){const R=w[S],I=R&&R.name;typeof I=="string"&&!(f&&X[ie(I)])&&en(d,R,I)}},zo=function(d,f){let w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const S=[d];for(;S.length>0;){const R=S.pop();if(f(R)===!1)continue;if(w&&N(R)===ne.element){const $=D(R);Et($)&&S.push($)}const I=y(R);if(I)for(let $=I.length-1;$>=0;--$)S.push(I[$])}},Oo=function(d){zo(d,f=>{N(f)===ne.element&&Lo(f,!0)})},No=function(d){const f=[];return zo(d,w=>{f.push(w)},!0),f},la=function(d,f){const w=Ko();qe(No(d),S=>{N(S)===ne.element&&Vo(w,S)}),qe(f,S=>{N(S)===ne.element&&!It(w,S)&&Lo(S,!0)})},tn=function(d,f){let w=!1;return qe(e.removed,S=>{S.element&&(w=w||S.element===d,Oo(S.element))}),la(d,f),w},da=8,ca=function(d,f){const w=lt;let S=null;const R=()=>(S||(S=Ko(),qe(f,I=>{Vo(S,I)})),S);for(let I=0;;I++){const $=No(d),de=[d];let Ge=!1;if(qe($,Ie=>{N(Ie)===ne.documentFragment?Pt(de,Ie):!Ge&&!It(w,Ie)&&(Ge=It(R(),Ie))}),!Ge)return;if(I>=da)throw Ke("the tree kept changing during in-place sanitization; refusing to return it");qe(de,(Ie,Te)=>{pa(Ie,Te>0,d,R())})}},pa=function(d,f,w,S){const R=Zt(d);let I;for(;I=R.nextNode();)!It(S,I)||It(lt,I)||(f&&Pe(j.uponSanitizeShadowNode,I,null),Uo(I,w))},ua=function(d){lt&&Vo(lt,d)},on=function(d,f){return Re?d==="patchsrc"?!0:d==="for"&&f!=="label"&&f!=="output":!1},ha=function(d){Re&&zo(d,f=>{const w=N(f);if(w===ne.processingInstruction||w===ne.comment&&he(kn,f.data)){try{T(f)}catch{}return!1}if(w===ne.element){const S=f,R=ie(F(f));try{S.hasAttribute&&S.hasAttribute("patchsrc")&&S.removeAttribute("patchsrc"),S.hasAttribute&&S.hasAttribute("for")&&on("for",R)&&S.removeAttribute("for")}catch{}}return!0})},nn=function(d){let f=null,w=null;if(Co)d="<remove></remove>"+d;else{const I=ja(d,bs);w=I&&I[0]}_t==="application/xhtml+xml"&&yt===Oe&&(d='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+d+"</body></html>");const S=H?le(d):d;if(yt===Oe)try{f=new u().parseFromString(S,_t)}catch{}if(!f||!f.documentElement){f=ye.createDocument(yt,"template",null);try{f.documentElement.innerHTML=_o?pe:S}catch{}}const R=f.body||f.documentElement;return d&&w&&R.insertBefore(o.createTextNode(w),R.childNodes[0]||null),yt===Oe?Ze.call(f,We?"html":"body")[0]:We?f.documentElement:R},Zt=function(d){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const w=K?K(d):d.ownerDocument;return Me.call(w||d,d,(f?0:p.SHOW_ELEMENT)|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},$o=function(d){return d=eo(d,yo," "),d=eo(d,at," "),d=eo(d,Ee," "),d},Bo=function(d){var f;Ho(d);const w=(f=d.querySelectorAll)===null||f===void 0?void 0:f.call(d,"template");w&&qe(w,S=>{Et(S.content)&&Bo(S.content)})},Ho=function(d){d.normalize();const f=Zt(d,!0);let w=f.nextNode();for(;w;)w.data=$o(w.data),w=f.nextNode()},Qt=function(d){const f=L?L(d):null;return typeof f!="string"||ie(f)!=="form"?!1:typeof d.nodeName!="string"||typeof d.textContent!="string"||typeof d.removeChild!="function"||d.attributes!==P(d)||typeof d.removeAttribute!="function"||typeof d.removeAttributeNode!="function"||typeof d.getAttributeNode!="function"||typeof d.setAttribute!="function"||typeof d.namespaceURI!="string"||typeof d.insertBefore!="function"||typeof d.hasChildNodes!="function"||d.nodeType!==A(d)||d.childNodes!==y(d)},rn=function(d){if(!A||typeof d!="object"||d===null)return null;try{const f=A(d);return typeof f=="number"?f:null}catch{return null}},Et=function(d){return rn(d)===ne.documentFragment},Rt=function(d){return rn(d)!==null};function Pe(E,d,f){E.length!==0&&qe(E,w=>{w.call(e,d,f,Xt)})}const fa=function(d,f,w){return!!(Re&&w===ne.element&&d.hasChildNodes()&&!Rt(d.firstElementChild)&&he(ei,d.textContent)&&he(ei,d.innerHTML)||Re&&xs[f]&&w===ne.element&&ee(d)===Oe&&(Rt(d.firstElementChild)||typeof d.textContent=="string"&&he(ei,d.textContent))||w===ne.processingInstruction||Re&&w===ne.comment&&he(kn,d.data))},Jt=function(d,f){if(d instanceof RegExp)return he(d,f);if(d instanceof Function){for(var w=arguments.length,S=new Array(w>2?w-2:0),R=2;R<w;R++)S[R-2]=arguments[R];return!!d(f,...S)}return!1},ga=function(d,f,w){if(!st[f]&&ln(f)&&Jt(ue.tagNameCheck,f))return!1;if(Do&&!dt[f]&&!dt[pt(f)]){const S=C(d),R=y(d);if(R&&S){const I=R.length;for(let $=I-1;$>=0;--$){const de=d===w?g(R[$],!0):R[$];S.insertBefore(de,k(d))}}}return et(d),!0},an=function(d,f,w,S){return d.length===0?f:f===w||f===S?Ot(f):f},Tt=function(d,f){return d===f||C(d)!==null?!1:(Mo&&Oo(d),!0)},ma=function(d,f){if(ua(d),Pe(j.beforeSanitizeElements,d,null),Tt(d,f))return!0;if(Qt(d))return et(d),!0;const w=ie(F(d)),S=N(d);if(Y=an(j.uponSanitizeElement,Y,Qe,qt),Pe(j.uponSanitizeElement,d,{tagName:w,allowedTags:Y}),Tt(d,f))return!0;if(fa(d,w,S))return et(d),!0;if(st[w]||!(_e.tagCheck instanceof Function&&_e.tagCheck(w))&&!Y[w]){const R=ga(d,w,f);return R===!1&&(Pe(j.afterSanitizeElements,d,null),Tt(d,f))?!0:R}if(S===ne.element&&!sa(d)||(w==="noscript"||w==="noembed"||w==="noframes")&&he(gs,d.innerHTML))return et(d),!0;if(Q&&S===ne.text){const R=d.textContent,I=$o(R);R!==I&&(Pt(e.removed,{element:d.cloneNode()}),d.textContent=I)}return Pe(j.afterSanitizeElements,d,null),Tt(d,f)},sn=function(d,f,w){if(V[f]||on(f,d)||Ui&&(f==="id"||f==="name")&&(w in o||w in ia))return!1;const S=X[f]||_e.attributeCheck instanceof Function&&_e.attributeCheck(f,d);if(v&&he(Ce,f)||Mt&&he(wo,f))return!0;if(!S)return ln(d)&&Jt(ue.tagNameCheck,d)&&Jt(ue.attributeNameCheck,f,d)||f==="is"&&ue.allowCustomizedBuiltInElements&&Jt(ue.tagNameCheck,w);if(ji[f])return!0;const R=eo(w,To,"");return he(Gt,R)||(f==="src"||f==="xlink:href"||f==="href")&&d!=="script"&&Yo(w,"data:")===0&&Ki[d]||U&&!he(Eo,R)?!0:!w},ba=q({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ln=function(d){return!ba[pt(d)]&&he(So,d)},xa=function(d,f,w,S){if(H&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!w)switch(h.getAttributeType(d,f)){case"TrustedHTML":return le(S);case"TrustedScriptURL":return B(S)}return S},va=function(d,f,w,S){try{return w?d.setAttributeNS(w,f,S):d.setAttribute(f,S),Qt(d)?(et(d),!1):!0}catch{return wt(f,d),!1}},dn=function(d,f){return Re&&he(ms,f)?!0:pt(d)==="attributename"&&Yo(f,"href")!==-1},ya=function(d,f){if(Pe(j.beforeSanitizeAttributes,d,null),Tt(d,f))return;const w=d.attributes;if(!w||Qt(d))return;X=an(j.uponSanitizeAttribute,X,Je,Kt);const S={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:X,forceKeepAttr:void 0};let R=w.length;const I=ie(F(d));for(;R--;){const $=w[R],de=$.name,Ge=$.namespaceURI,Ie=$.value,Te=ie(de),Ne=Ie;let me=de==="value"?Ne:Ya(Ne),cn=!1;if(S.attrName=Te,S.attrValue=me,S.keepAttr=!0,S.forceKeepAttr=void 0,Pe(j.uponSanitizeAttribute,d,S),me=S.attrValue,Wi&&(Te==="id"||Te==="name")&&Yo(me,Gi)!==0&&(wt(de,d,$),me=Gi+me,cn=!0),dn(de,me)){wt(de,d,$);continue}if(!S.forceKeepAttr){if(!S.keepAttr){wt(de,d,$);continue}if(!ge&&he(Cn,me)){wt(de,d,$);continue}if(Q&&(me=$o(me)),!sn(I,Te,me)){wt(de,d,$);continue}me=xa(I,Te,Ge,me),me!==Ne&&va(d,de,Ge,me)&&cn&&bn(e.removed)}}Pe(j.afterSanitizeAttributes,d,null),Tt(d,f)},Uo=function(d,f){ma(d,f),ya(d,f),Et(d.content)&&Wo(d.content)},Wo=function(d){let f=null;const w=Zt(d);for(Pe(j.beforeSanitizeShadowDOM,d,null);f=w.nextNode();)if(Pe(j.uponSanitizeShadowNode,f,null),Uo(f,d),N(f)===ne.element){const S=D(f);Et(S)&&(Go(S),Wo(S))}Q&&Ho(d),Pe(j.afterSanitizeShadowDOM,d,null)},Go=function(d){const f=[{node:d,shadow:null}];for(;f.length>0;){const w=f.pop();if(w.shadow){Wo(w.shadow);continue}const S=w.node,R=N(S)===ne.element,I=y(S);if(I)for(let $=I.length-1;$>=0;--$)f.push({node:I[$],shadow:null});if(R){const $=L?L(S):null;if(typeof $=="string"&&ie($)==="template"){const de=S.content;Et(de)&&f.push({node:de,shadow:null})}}if(R){const $=D(S);Et($)&&f.push({node:null,shadow:$},{node:$,shadow:null})}}};return e.sanitize=function(E){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=null,w=null,S=null,R=null;if(_o=!E,_o&&(E="<!-->"),typeof E!="string"&&!Rt(E)&&(E=es(E),typeof E!="string"))throw Ke("dirty is not a string, aborting");if(!e.isSupported)return E;ko?(Y=qt,X=Kt):Io(d),e.removed=[];const I=Mo&&typeof E!="string"&&Rt(E);let $=[];const de=lt;if(I){ha(E);const Ne=F(E);if(typeof Ne=="string"){const me=ie(Ne);if(!Y[me]||st[me])throw Fo(E),Ke("root node is forbidden and cannot be sanitized in-place")}if(Qt(E))throw Fo(E),Ke("root node is clobbered and cannot be sanitized in-place");$=No(E),lt=Ko()}else if(Rt(E))f=nn("<!---->"),w=f.ownerDocument.importNode(E,!0),w.nodeType===ne.element&&w.nodeName==="BODY"||w.nodeName==="HTML"?f=w:f.appendChild(w),Go(f);else{if(!xt&&!Q&&!We&&E.indexOf("<")===-1)return De(E);if(f=nn(E),!f)return xt?null:Ao?pe:""}f&&Co&&et(f.firstChild);const Ge=I?E:f;try{I&&Go(E);const Ne=Zt(Ge);for(;S=Ne.nextNode();)Uo(S,Ge);I&&ca(E,$)}catch(Ne){throw I&&(Fo(E),tn(E,$)),Ne}finally{lt=de}if(I){if(tn(E,$))throw Ke("a node selected for removal could not be safely returned; refusing to sanitize in place");return Q&&Bo(E),E}if(xt){if(Q&&Bo(f),Vt)for(R=G.call(f.ownerDocument);f.firstChild;)R.appendChild(f.firstChild);else R=f;return(X.shadowroot||X.shadowrootmode)&&(R=Wt.call(i,R,!0)),R}const Ie=()=>We?f.outerHTML:f.innerHTML;let Te=Ie();return Q&&he(ls,Te)&&(Ho(f),Te=Ie()),We&&Y["!doctype"]&&f.ownerDocument&&f.ownerDocument.doctype&&f.ownerDocument.doctype.name&&he(hs,f.ownerDocument.doctype.name)&&(Te="<!DOCTYPE "+f.ownerDocument.doctype.name+`>
3
- `+Te),De(Te)},e.setConfig=function(){let E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Io(E),ko=!0,qt=Y,Kt=X},e.clearConfig=function(){Xt=null,ko=!1,qt=null,Kt=null,H=te,pe=""},e.isValidAttribute=function(E,d,f){Xt||Io({});const w=ie(E),S=ie(d);return typeof f=="string"&&(dn(d,f)||!ge&&he(Cn,f))?!1:sn(w,S,f)},e.addHook=function(E,d){typeof d=="function"&&xe(j,E)&&Pt(j[E],d)},e.removeHook=function(E,d){if(xe(j,E)){if(d!==void 0){const f=qa(j[E],d);return f===-1?void 0:Va(j[E],f,1)[0]}return bn(j[E])}},e.removeHooks=function(E){xe(j,E)&&(j[E]=[])},e.removeAllHooks=function(){j=An()},e}var ws=Dr();const Es={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"};function Ts(t,e){const o=t.options;return c.resolveBarcodeDesignValue(o.formatter,e,String(o.testData||o.title||""))||"1234567890128"}function Ss(t){return a("div",{class:"print-qrcode",dataset:{codeId:t.id,codeKind:"qrcode"}})}function ks(t){const e=t.options;return a("div",{class:"print-barcode",dataset:{codeId:t.id,codeKind:"barcode"}},[a("svg",{preserveAspectRatio:Es[String(e.fit||"contain")]??"xMidYMid meet",style:{maxWidth:"100%",maxHeight:"100%"}})])}function Cs(t){const e=(t.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return e.length!==4||e.some(o=>!Number.isFinite(o))?null:{width:e[2],height:e[3]}}function As(t,e,o){const i=t.options,n=c.barcodeUnitsPerModule(i.barWidth),r=c.barcodeQuietZoneModules(i.barQuietZone),s=l=>{rr(e,Ts(t,o),{format:String(i.barcodeType||"CODE128"),width:n,height:l*n,displayValue:!i.hideTitle,fontSize:(i.fontSize??c.BARCODE_TEXT_FONT_SIZE_MODULES)*n,margin:0,marginLeft:r*n,marginRight:r*n,marginTop:0,marginBottom:c.BARCODE_MARGIN_BOTTOM_MODULES*n});const p=Cs(e);return p?{widthUnits:p.width,heightUnits:p.height}:null};try{const l=c.layoutBarcodeSize({barHeightMm:i.barHeight,boxWidthMm:c.barcodeAvailableBoxMm(i.width,i.maxWidth),boxHeightMm:c.barcodeAvailableBoxMm(i.height,i.maxHeight),dpi:i.printerDpi,barWidth:i.barWidth,measure:s});e.style.width=l.size?`${l.size.widthMm}mm`:"",e.style.height=l.size?`${l.size.heightMm}mm`:""}catch{e.replaceChildren();return}e.setAttribute("shape-rendering","crispEdges")}function Ds(t,e,o){const i=t.options,n=c.resolveBarcodeDesignValue(i.formatter,o,String(i.testData||i.title||""))||"二维码";e.replaceChildren();try{const r=Ti.browserCodeRenderer.render(n,"qrcode",{qrCodeLevel:String(i.qrCodeLevel??"M"),qrQuietZone:typeof i.qrQuietZone=="number"?i.qrQuietZone:void 0}),s=document.createElement("img");s.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(r)}`,s.alt="qrcode",s.style.width="100%",s.style.height="100%",s.style.objectFit=String(i.fit||"contain"),s.style.maxWidth=i.maxWidth?`${i.maxWidth}mm`:"100%",s.style.maxHeight=i.maxHeight?`${i.maxHeight}mm`:"100%",e.appendChild(s)}catch{}}function Ms(t,e,o){for(const i of Array.from(t.querySelectorAll("[data-code-kind]"))){const n=i.dataset.codeId,r=e.find(s=>s.id===n);if(r)if(i.dataset.codeKind==="barcode"){const s=i.querySelector("svg");s&&As(r,s,o)}else Ds(r,i,o)}}const co=new Map;function _s(t){return typeof Node<"u"&&t instanceof Node}function Mr(t,e,o){if(_r(t),typeof e=="string"){o.innerHTML=e;return}if(_s(e)){o.appendChild(e);return}typeof e.node=="string"?o.innerHTML=e.node:o.appendChild(e.node),typeof e.dispose=="function"&&co.set(t,e.dispose)}function _r(t){const e=co.get(t);if(e){co.delete(t);try{e()}catch{}}}function Dn(){for(const t of[...co.keys()])_r(t)}const Rs={header:"题",data:"数",subtotal:"小",summary:"汇"},Ps=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行"},{value:"summary",label:"汇总行"}],ro=3.7795275591,Is=.1,gi=t=>JSON.parse(JSON.stringify(t)),Mn=new WeakMap;function Xe(t){let e=Mn.get(t);return e||(e={menu:null,menuElId:null,anchor:null,layouts:new Map},Mn.set(t,e)),e}function Ut(t,e){return t.templateData.elements.find(o=>o.id===e)??null}function Fs(t,e){const o=t.tableSelection;return!o||o.elementId!==e.id?null:t.selectedElement?.id!==e.id?(t.tableSelection=null,null):o}function Rr(t,e,o,i){const n=Ut(t,o.id);if(!n)return null;const r=o.options;return{store:t,fire:e,el:o,real:n,options:r,rows:r.tableRows??[],colWidths:r.tableColWidths??[],isSelected:t.selectedIds.has(o.id),selection:Fs(t,o),maxTableWidth:Pr(t),designData:i}}function Pr(t){return t.paperSize.width-t.templateData.margins.left-t.templateData.margins.right}function _i(t){return t.options.tableDefaultFontSize??10}function Ir(t){return t.options.tableDefaultColor??"#333333"}function Ls(t,e){let o=0;for(let i=0;i<e;i++)o+=t.rows[i].height;return o}function zs(t,e){return Xe(t.store).layouts.get(t.el.id)?.[e]?.top??Ls(t,e)}function Os(t,e){return Xe(t.store).layouts.get(t.el.id)?.[e]?.height??t.rows[e]?.height??0}function Ns(t){const e=t.options.dataSource;if(e&&Array.isArray(c.DEFAULT_DEMO_DATA[e]))return c.DEFAULT_DEMO_DATA[e];for(const o of Object.values(c.DEFAULT_DEMO_DATA))if(Array.isArray(o))return o}function Fr(t){return t.cellType==="barcode"||t.cellType==="qrcode"}function Lr(t,e){return Fr(e)?c.resolveBarcodeDesignValue(e.formatter,Ns(t)):e.formatter||""}function $s(t,e){const o={designMode:!0,showGhostBorder:t.store.showTableGhostBorder};return{fontFamily:_.resolveCanvasFontFamily(e.fontFamily??t.options.tableDefaultFontFamily),textAlign:e.align??"left",...e.align==="justify"?{textAlignLast:"justify"}:{},verticalAlign:e.valign??"middle",fontSize:(e.fontSize??_i(t))+"pt",fontWeight:e.fontWeight??"normal",color:e.color??Ir(t),backgroundColor:e.backgroundColor??"transparent",borderTop:c.resolveCellBorderCss(e.borders?.top,o),borderRight:c.resolveCellBorderCss(e.borders?.right,o),borderBottom:c.resolveCellBorderCss(e.borders?.bottom,o),borderLeft:c.resolveCellBorderCss(e.borders?.left,o),padding:(e.padding??t.options.tableDefaultPadding??1)+"mm",whiteSpace:e.wordWrap??!0?"pre-wrap":"nowrap",overflow:e.wordWrap??!0?"visible":"hidden"}}function Bs(t,e,o){const i=t.selection;return[!!i&&e>=i.r1&&e<=i.r2&&o>=i.c1&&o<=i.c2?"cell-selected":"",t.rows[e]?.type==="data"?"row-data-bg":""].filter(Boolean).join(" ")}function zr(t){return c.resolveCellTextFit(t)}function Hs(t){return zr(t)!=="autoHeight"}function Us(t,e){return e.fontSize??_i(t)}function go(t,e,o){return c.cellFitCapMm(t.rows,e,o,t.options.tableDefaultPadding??1)}function Ws(t,e,o){return c.cellFitWidthMm(t.colWidths,e,o,t.options.tableDefaultPadding??1)}function Gs(t,e,o){return{maxHeight:go(t,o,e)+"mm",overflow:"hidden",...e.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{}}}function qs(t,e,o){const i={fitBase:String(Us(t,e)),fitMin:String(c.resolveShrinkMinFontSize(e.shrinkMinFontSize)),fitMm:String(go(t,o,e))};return zr(e)==="shrink"&&(i.fit="shrink"),i}function Ks(t){const e=(t.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return e.length!==4||e.some(o=>!Number.isFinite(o))?null:{width:e[2],height:e[3]}}const Vs={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"};function js(t,e,o,i){const n=document.createElement("div");n.className="cell-barcode";const r=document.createElementNS(ka,"svg");n.appendChild(r);const s=Lr(t,i);if(i.cellType==="barcode"){r.setAttribute("preserveAspectRatio",Vs[i.fit||"contain"]??"xMidYMid meet");const l=c.barcodeUnitsPerModule(i.barWidth),p=c.barcodeQuietZoneModules(i.barQuietZone),u=g=>{rr(r,s,{format:i.barcodeType||"CODE128",width:l,height:g*l,displayValue:i.showBarcodeText!==!1,fontSize:(i.barFontSize??c.BARCODE_TEXT_FONT_SIZE_MODULES)*l,margin:0,marginLeft:p*l,marginRight:p*l,marginTop:0,marginBottom:c.BARCODE_MARGIN_BOTTOM_MODULES*l});const T=Ks(r);return T?{widthUnits:T.width,heightUnits:T.height}:null};let h=null;try{h=c.layoutBarcodeSize({barHeightMm:i.barHeight,boxWidthMm:c.barcodeAvailableBoxMm(Ws(t,o,i),i.maxWidth),boxHeightMm:c.barcodeAvailableBoxMm(go(t,e,i),i.maxHeight),dpi:i.printerDpi,barWidth:i.barWidth,measure:u})}catch{h=null}if(!h){r.style.display="none";const g=document.createElement("span");return g.className="cell-barcode-fallback",g.textContent=s||"条码",n.appendChild(g),n}const m=h.size;return m?(r.style.width=`${m.widthMm}mm`,r.style.height=`${m.heightMm}mm`):(r.style.maxWidth=i.maxWidth?`${i.maxWidth}mm`:"100%",r.style.maxHeight=i.maxHeight?`${i.maxHeight}mm`:"100%"),r.setAttribute("shape-rendering","crispEdges"),n}if(r.style.display="none",!s)return n;try{const l=Ti.browserCodeRenderer.render(s,"qrcode",{qrCodeLevel:String(i.qrCodeLevel||"M"),qrQuietZone:typeof i.qrQuietZone=="number"?i.qrQuietZone:void 0}),p=document.createElement("img");p.setAttribute("src",`data:image/svg+xml;charset=utf-8,${encodeURIComponent(l)}`),p.setAttribute("alt","qrcode"),p.style.width="100%",p.style.height="100%",p.style.objectFit=i.fit||"contain",i.objectPosition&&(p.style.objectPosition=i.objectPosition),p.style.maxWidth=i.maxWidth?`${i.maxWidth}mm`:"100%",p.style.maxHeight=i.maxHeight?`${i.maxHeight}mm`:"100%",n.appendChild(p)}catch{}return n}function _n(){const t=document.createElement("div");return t.className="image-placeholder",t.textContent="图片",t}function Ys(t,e){const o=t.formatter||"";if(!o)return"";if(!o.includes("{"))return o;const i=e.designData?.length?e.designData[0]:c.DEFAULT_DEMO_DATA;return c.evaluateTemplate(o,i)}function Xs(t,e,o){const i=document.createElement("div");i.className="cell-image";const n=c.cellImageBoxMm(o.fit,go(t,e,o));n!==void 0&&(i.style.height=`${n}mm`);const r=Ys(o,t);if(!r)return i.appendChild(_n()),i;const s=document.createElement("img");s.setAttribute("src",r),n!==void 0&&(s.style.width="100%",s.style.height="100%"),s.style.objectFit=o.fit||"contain";for(const[l,p]of Object.entries(c.cropStyleDeclarations(o.fit,o.fitScale,o.objectPosition)))s.style[l]=p;return s.style.maxWidth=o.maxWidth?`${o.maxWidth}mm`:"100%",s.style.maxHeight=o.maxHeight?`${o.maxHeight}mm`:"100%",s.addEventListener("error",()=>{s.remove(),i.appendChild(_n())},{once:!0}),i.appendChild(s),i}function Zs(t,e,o,i,n){if(Fr(n))return js(t,o,i,n);if(n.cellType==="image")return Xs(t,o,n);const r=Lr(t,n),s=()=>e.type==="data"?a("span",{class:"data-placeholder",text:r}):r;return Hs(n)?a("div",{class:"cell-fit",style:Gs(t,n,o),dataset:qs(t,n,o)},[s()]):s()}function po(t,e,o){const i={elementId:t.el.id,...c.normalizeSelection(t.rows,e,o)};t.store.setTableSelection(i),t.fire("table-selection-change",{elementId:t.el.id,selection:i})}function Qs(t,e,o,i,n){if(n.button!==0||(t.fire("table-cell-mousedown",{elementId:t.el.id,r:e,c:o,cellId:i,event:n}),!t.isSelected))return;n.stopPropagation();const r=Xe(t.store);n.shiftKey&&t.selection?po(t,{r:t.selection.r1,c:t.selection.c1},{r:e,c:o}):(r.anchor={r:e,c:o},po(t,{r:e,c:o},{r:e,c:o})),document.addEventListener("mouseup",()=>{Xe(t.store).anchor=null},{once:!0})}function Js(t,e,o){const i=Xe(t.store).anchor;i&&po(t,i,{r:e,c:o})}function Ri(t,e){const o=Xe(t);o.menu?.visible&&(o.menu.visible=!1,e("table-menu-close",{elementId:o.menuElId}),t.emit(!1))}function el(t,e,o,i){i.preventDefault(),i.stopPropagation(),t.isSelected||t.store.selectOne(t.el.id);const n=t.selection;n&&e>=n.r1&&e<=n.r2&&o>=n.c1&&o<=n.c2||po(t,{r:e,c:o},{r:e,c:o});const s=Xe(t.store);s.menuElId=t.el.id,s.menu&&(s.menu.x=i.clientX,s.menu.y=i.clientY,s.menu.visible=!0),t.fire("table-cell-contextmenu",{elementId:t.el.id,r:e,c:o,clientX:i.clientX,clientY:i.clientY}),t.store.emit(!1),document.addEventListener("mousedown",()=>Ri(t.store,t.fire),{once:!0})}function Rn(t,e,o){const i=t.reduce((n,r)=>n+r,0)+(t[e]??0);return i>o?`插入后表格总宽 ${Math.round(i*10)/10}mm 超过打印范围宽度 ${o}mm,请先缩小列宽`:null}function tl(t,e){const o=t.real.options.tableRows??[],i=t.real.options.tableColWidths??[],n=e(gi(o),gi(i));return n?(window.alert(n),!1):(t.store.recordHistory(),e(o,i),t.store.setTableSelection(null),c.syncTableElementSize(t.real.options),t.store.emit(),!0)}function Ve(t,e,o){Ri(t.store,t.fire);const i=t.selection;if(!i)return;let n=null;switch(e){case"insert-row-above":n=r=>(c.insertRow(r,i.r1,"above"),null);break;case"insert-row-below":n=r=>(c.insertRow(r,i.r2,"below"),null);break;case"delete-row":n=r=>c.deleteRow(r,i.r1);break;case"insert-col-left":n=(r,s)=>{const l=Rn(s,i.c1,t.maxTableWidth);return l||(c.insertCol(r,s,i.c1,"left"),null)};break;case"insert-col-right":n=(r,s)=>{const l=Rn(s,i.c2,t.maxTableWidth);return l||(c.insertCol(r,s,i.c2,"right"),null)};break;case"delete-col":n=(r,s)=>c.deleteCol(r,s,i.c1);break;case"merge":n=r=>(c.mergeCells(r,i),null);break;case"split":n=r=>(c.splitCells(r,i),null);break;case"set-row-type":n=r=>o?c.setRowType(r,i.r1,o):"未指定行类型";break}n&&tl(t,n)&&t.fire(`table-${e}`,{elementId:t.el.id,...o?{type:o}:{}})}function ol(t){const e=t.selection;if(!e)return!1;for(let o=e.r1;o<=e.r2;o++)for(let i=e.c1;i<=e.c2;i++){const n=t.rows[o]?.cells[i];if(n&&!n.merged&&((n.rowspan??1)>1||(n.colspan??1)>1))return!0}return!1}function il(t){const e=t.selection;if(!e)return;const o=c.findMainCell(t.rows,e.r1,e.c1),i=!t.rows[o.r]?.cells[o.c]?.mergeSameValue;for(let n=e.r1;n<=e.r2;n++)for(let r=e.c1;r<=e.c2;r++){const s=t.rows[n]?.cells[r];s&&!s.merged&&(s.mergeSameValue=i)}t.store.updateElement(t.el.id,{tableRows:t.rows}),Ri(t.store,t.fire)}function Pn(t){const e=t.selection;if(!e)return"未选择单元格";for(let o=e.r1;o<=e.r2;o++)if(t.rows[o]?.type!=="data")return"仅数据行(明细行)支持按值合并";return null}function In(t,e){const o=t.selection;return o?o.r1!==o.r2?"行类型仅支持单行设置":c.setRowType(gi(t.rows),o.r1,e):"未选择单元格"}function $e(t,e,o={}){return a("div",{class:`menu-item${o.disabled?" disabled":""}${o.active?" active":""}`,title:o.title||"",text:t,onClick:()=>{o.disabled||e()}})}const oi=()=>a("div",{class:"menu-divider"});function nl(t,e,o){const i=Xe(t);if(i.menu=o,!o.visible||!i.menuElId)return"";const n=Ut(t,i.menuElId);if(!n||n.printElementType.type!=="table")return"";const r=Rr(t,e,n);if(!r)return"";const s=r.selection?c.canMergeReason(r.rows,r.selection):"未选择单元格",l=r.selection?r.rows[r.selection.r1]?.type??null:null;return a("div",{class:"table-ctx-menu",style:{left:o.x+"px",top:o.y+"px"},onMousedown:p=>p.stopPropagation()},[$e("在上方插入行",()=>Ve(r,"insert-row-above")),$e("在下方插入行",()=>Ve(r,"insert-row-below")),$e("删除行",()=>Ve(r,"delete-row"),{disabled:r.rows.length<=1}),oi(),$e("在左侧插入列",()=>Ve(r,"insert-col-left")),$e("在右侧插入列",()=>Ve(r,"insert-col-right")),$e("删除列",()=>Ve(r,"delete-col"),{disabled:r.colWidths.length<=1}),oi(),$e("合并单元格",()=>Ve(r,"merge"),{disabled:!!s,title:s||""}),$e("拆分单元格",()=>Ve(r,"split"),{disabled:!ol(r)}),$e("按值合并",()=>il(r),{disabled:!!Pn(r),title:Pn(r)||"",active:(()=>{const p=r.selection;if(!p)return!1;const u=c.findMainCell(r.rows,p.r1,p.c1);return r.rows[u.r]?.cells[u.c]?.mergeSameValue===!0})()}),oi(),a("div",{class:"menu-group-title",text:"行类型"}),...Ps.map(p=>$e(p.label,()=>Ve(r,"set-row-type",p.value),{disabled:!!In(r,p.value),title:In(r,p.value)||"",active:l===p.value}))])}let gt=null;function Or(){gt&&(document.removeEventListener("mousemove",Pi),document.removeEventListener("mouseup",Ii),gt.handle.classList.remove("dragging"),gt=null)}function rl(t,e){const o=t.closest(".hiprint-printPaper");return(o&&o.offsetWidth>0?o.getBoundingClientRect().width/o.offsetWidth:0)||(e.scale||100)/100}function al(t,e,o){if(o.button!==0)return;const i=o.currentTarget,n=i.closest(".print-table");if(!n)return;Or();const r=t.real.options.tableColWidths??[];gt={store:t.store,fire:t.fire,elId:t.real.id,boundary:e,startX:o.clientX,startWidth:r[e-1]??0,scale:rl(n,t.store),root:n,wrapper:i.closest(".print-element"),handle:i},i.classList.add("dragging"),t.store.recordHistory(),document.addEventListener("mousemove",Pi),document.addEventListener("mouseup",Ii)}function Pi(t){const e=gt;if(!e)return;const o=Ut(e.store,e.elId),i=o?.options.tableColWidths;if(!o||!i)return;const n=(t.clientX-e.startX)/(e.scale*ro),r=e.boundary-1;i[r]=c.clampResizedColumnWidth(i,r,e.startWidth+n,Pr(e.store)),c.syncTableElementSize(o.options),i.forEach((s,l)=>{const p=e.root.querySelector(`colgroup col:nth-child(${l+1})`);p&&(p.style.width=`${s}mm`)}),e.root.querySelectorAll(".col-resize-handle").forEach((s,l)=>{s.style.left=`${i.slice(0,l+1).reduce((p,u)=>p+u,0)}mm`}),e.wrapper&&(e.wrapper.style.width=`${o.options.width}mm`,e.wrapper.style.height=`${o.options.height}mm`)}function Ii(){document.removeEventListener("mousemove",Pi),document.removeEventListener("mouseup",Ii);const t=gt;if(!t)return;gt=null,t.handle.classList.remove("dragging");const e=Ut(t.store,t.elId);e&&c.syncTableElementSize(e.options),t.store.emit(),t.fire("table-col-resize-end",{elementId:t.elId})}function sl(t,e,o){const i=o.querySelector("table");if(!i)return;const n=i.offsetHeight;if(n<=0)return;const r=Ut(t,e);if(!r)return;let s=!1;const l=n/ro;Math.abs(l-(r.options.height??0))>Is&&(r.options.height=Math.round(l*100)/100,s=!0);const p=i.offsetTop,u=Array.from(i.rows).map(m=>({top:(m.offsetTop-p)/ro,height:m.offsetHeight/ro})),h=Xe(t);ll(h.layouts.get(e),u)||(h.layouts.set(e,u),s=!0),s&&t.emit(!1)}function ll(t,e){return!t||t.length!==e.length?!1:e.every((o,i)=>{const n=t[i];return Math.round(o.top*10)===Math.round(n.top*10)&&Math.round(o.height*10)===Math.round(n.height*10)})}function dl(t,e){const o=document.createComment("pd-table-measure");return requestAnimationFrame(()=>{if(!o.isConnected)return;const i=o.parentElement;i&&sl(t,e,i)}),o}function cl(t){return t.isSelected&&!t.real.options.locked&&t.colWidths.length>=1}function pl(t){return Array.from({length:t.colWidths.length},(e,o)=>o+1)}function ul(t,e){return t.colWidths.slice(0,e).reduce((o,i)=>o+i,0)}function hl(t,e,o,i){const n=Rr(e,o,t,i);if(!n)return a("div",{class:"print-table"});const r=[a("table",{style:{fontSize:`${_i(n)}pt`,color:Ir(n)}},[a("colgroup",{},n.colWidths.map(s=>a("col",{style:{width:s+"mm"}}))),a("tbody",{},n.rows.map((s,l)=>a("tr",{style:{height:s.height+"mm"}},s.cells.map((p,u)=>p.merged?"":a("td",{rowspan:p.rowspan||1,colspan:p.colspan||1,class:Bs(n,l,u),style:$s(n,p),onMousedown:h=>Qs(n,l,u,p.id,h),onMouseenter:()=>Js(n,l,u),onContextmenu:h=>el(n,l,u,h)},[Zs(n,s,l,u,p)])).filter(Boolean))))])];return cl(n)&&r.push(a("div",{class:"col-resize-layer"},pl(n).map(s=>a("div",{class:"col-resize-handle",role:"separator","aria-label":`列宽手柄${s}`,style:{left:ul(n,s)+"mm"},onMousedown:l=>{l.stopPropagation(),l.preventDefault(),al(n,s,l)}})))),n.isSelected&&r.push(a("div",{class:"row-badges"},n.rows.map((s,l)=>a("span",{class:"row-badge",style:{top:zs(n,l)+"mm",height:Os(n,l)+"mm"},text:Rs[s.type]})))),r.push(dl(e,t.id)),a("div",{class:"print-table design-mode",dataset:{tableId:t.id},onContextmenu:s=>s.preventDefault()},r)}const fl=["黄芪 20g","当归尾 15g","赤芍 10g","川芎 10g","地龙 10g","桃仁 10g","红花 10g"];function mi(t){return Array.isArray(t)&&t.length>0?t:[]}function gl(t,e){const o=c.detectFlowListKey(t,e)??(e?Object.keys(e).find(n=>Array.isArray(e[n])):void 0);if(o)return mi(e?.[o]);const i=c.detectFlowListKey(t,c.DEFAULT_DEMO_DATA);return i?mi(c.DEFAULT_DEMO_DATA[i]):[]}function ml(t,e){const o=t.options,i=typeof o.formatter=="string"?o.formatter:"",n=mi(e)[0],r=gl(i,n);if(r.length===0)return[...fl];if(!i)return r.map(p=>String(p?.name??JSON.stringify(p)));const s=n??{},l=c.detectFlowListKey(i,s)??Object.keys(s).find(p=>Array.isArray(s[p]));return r.map(p=>{try{return c.evaluateTemplate(i,{...s,...p,...l?{[l]:p}:{}})}catch{return i}})}const bl=3.7795275591,xl=.1;function vl(t,e){return t.templateData.elements.find(o=>o.id===e)??null}function yl(t){const e=t.parentElement;if(!e?.classList.contains("print-element"))return 0;const o=getComputedStyle(e);return(parseFloat(o.borderTopWidth)||0)+(parseFloat(o.borderBottomWidth)||0)}function wl(t,e,o){const i=o.offsetHeight+yl(o);if(i<=0)return;const n=vl(t,e);if(!n)return;const r=i/bl;Math.abs(r-(n.options.height??0))>xl&&(n.options.height=Math.round(r*100)/100,t.emit(!1))}function El(t,e){const o=document.createComment("pd-flowlist-measure");return requestAnimationFrame(()=>{if(!o.isConnected)return;const i=o.parentElement;i&&wl(t,e,i)}),o}function Tl(t,e,o){const i=t.options,n=c.resolveFlowColumns(i.flowColumns),r=c.resolveFlowGapX(i.flowGapX),s=c.resolveFlowRowHeight(i.flowRowHeight),l=c.resolveFlowLayoutMode(i.flowLayoutMode)==="dynamic",p=c.resolveFlowPadding(i),u={display:"grid",gridTemplateColumns:`repeat(${n},minmax(0,1fr))`,columnGap:`${r}mm`,gridAutoRows:`minmax(${s}mm,auto)`,width:"100%",...l?{padding:`${p.top}mm ${p.right}mm ${p.bottom}mm ${p.left}mm`,height:"auto",overflow:"visible"}:{height:"100%",overflow:"hidden"},fontSize:`${i.fontSize||12}pt`,fontWeight:i.fontWeight||"normal",color:i.color||"#333",boxSizing:"border-box"};i.fontFamily&&(u.fontFamily=String(i.fontFamily)),i.backgroundColor&&(u.backgroundColor=String(i.backgroundColor));const h=ml(t,e).map(m=>a("div",{class:"print-flow-cell",text:m}));return l&&o&&h.push(El(o,t.id)),a("div",{class:"print-flowlist",style:u},h)}const Fn={top:"flex-start",middle:"center",bottom:"flex-end"},Sl={left:"flex-start",center:"center",right:"flex-end"};function kl(t,e){const o=t.options,i=c.resolveElementMargins(o),n=c.resolveElementBorder(t.printElementType.type,o),r={};if(n?.all&&(r.border=`${n.all.borderWidth} ${n.all.borderStyle} ${n.all.borderColor}`),n)for(const s of c.ELEMENT_BORDER_SIDES){const l=n.edges[s];l&&(r[`border${s.charAt(0).toUpperCase()}${s.slice(1)}`]=`${l.borderWidth} ${l.borderStyle} ${l.borderColor}`)}return{position:"absolute",left:`${o.left}mm`,top:`${o.top}mm`,width:`${o.width}mm`,height:`${o.height}mm`,...i.top!==0?{marginTop:`${i.top}mm`}:{},...i.right!==0?{marginRight:`${i.right}mm`}:{},...i.bottom!==0?{marginBottom:`${i.bottom}mm`}:{},...i.left!==0?{marginLeft:`${i.left}mm`}:{},zIndex:String(o.zIndex||"auto"),...r,...Cl(t,e)}}function Cl(t,e){if(e?.has(t.id))return{};const o=c.resolveElementRotation(t.printElementType.type,t.options);return o===void 0?{}:{rotate:`${o}deg`}}function Ln(t){const e=t.options,o=t.printElementType.type==="longText",i=c.resolveElementTextFit(t.printElementType.type,e),n=e.fontSize||12,r=i==="autoHeight",s={fontSize:`${n}pt`,fontWeight:e.fontWeight||"normal",fontFamily:_.resolveCanvasFontFamily(e.fontFamily),color:e.color||"#333",backgroundColor:e.backgroundColor||"transparent",textAlign:e.textAlign||"left",...e.textAlign==="justify"?{textAlignLast:"justify"}:{},lineHeight:e.lineHeight?`${e.lineHeight}pt`:o?"1.5":"normal",letterSpacing:e.letterSpacing?`${e.letterSpacing}pt`:"normal",width:"100%",height:r?"auto":"100%",boxSizing:"border-box",overflow:r?"visible":"hidden",...o?{wordBreak:"break-all",textIndent:e.longTextIndent?`${e.longTextIndent}em`:"0"}:{textDecoration:e.textDecoration||"none",padding:`${e.contentPaddingTop||0}pt ${e.contentPaddingRight||0}pt ${e.contentPaddingBottom||0}pt ${e.contentPaddingLeft||0}pt`}};c.resolveElementNowrap(e)&&(s.whiteSpace="nowrap",s.textOverflow="ellipsis");const l=c.resolveElementWhiteSpace(e);return l&&(s.whiteSpace=l),e.verticalAlign&&(s.display="flex",e.textAlign==="justify"?(s.flexDirection="column",s.justifyContent=Fn[e.verticalAlign]??"flex-start"):(s.alignItems=Fn[e.verticalAlign]??"flex-start",s.justifyContent=Sl[e.textAlign||"left"]??"flex-start")),{style:s,fit:i}}function zn(t){const e=t.options,o=`${e.borderWidth||.75}pt`,i=e.borderStyle||"solid",n=e.borderColor||"#333";return t.printElementType.type==="hline"?{width:"100%",height:"0",borderTop:`${o} ${i} ${n}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${o} ${i} ${n}`,boxSizing:"border-box"}}function On(t){const e=t.options;return{width:"100%",height:"100%",borderWidth:`${e.borderWidth||1}pt`,borderStyle:e.borderStyle||"solid",borderColor:e.borderColor||"#333",backgroundColor:e.backgroundColor||"transparent",borderRadius:t.printElementType.type==="oval"?"50%":"0",boxSizing:"border-box"}}function Al(t){const e=t.options;return{objectFit:e.fit||"contain",...c.cropStyleDeclarations(e.fit,e.fitScale,e.objectPosition),maxWidth:e.maxWidth?`${e.maxWidth}mm`:"100%",maxHeight:e.maxHeight?`${e.maxHeight}mm`:"100%"}}function Nn(t){const e=t.options,o={fitBase:String(e.fontSize||12),fitMin:String(c.resolveShrinkMinFontSize(e.shrinkMinFontSize))};return c.resolveElementTextFit(t.printElementType.type,e)==="shrink"&&(o.fit="shrink"),o}const Dl={text:t=>{const{style:e}=Ln(t),o=t.options;return a("div",{class:"print-text",style:e,dataset:Nn(t),text:String(o.testData||o.formatter||"")||"文本"})},longText:t=>{const{style:e}=Ln(t),o=t.options;return a("div",{class:"print-longtext",style:e,dataset:Nn(t),text:String(o.formatter||"")||"长文本内容"})},hline:t=>a("div",{class:"print-line",style:zn(t)}),vline:t=>a("div",{class:"print-line",style:zn(t)}),rect:t=>a("div",{class:"print-shape",style:On(t)}),oval:t=>a("div",{class:"print-shape",style:On(t)}),image:(t,e,o)=>{const i=t.options,n=String(i.src??""),r=o?.designData?.length?o.designData[0]:c.DEFAULT_DEMO_DATA,s=n.includes("{")?c.evaluateTemplate(n,r):n;return a("div",{class:"print-image"},[s?a("img",{src:s,style:Al(t)}):a("div",{class:"image-placeholder",text:"图片"})])},qrcode:t=>Ss(t),barcode:t=>ks(t),html:t=>{const e=t.options,o=String(e.formatter??""),i=o?ws.sanitize(c.evaluateTemplate(o,{})):'<div style="background:#e0e0e0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:10pt;color:#999">HTML</div>';return a("div",{class:"print-html",html:i})},pageNumber:(t,e)=>{const o=t.options;return a("div",{class:"page-number-element",style:{fontSize:`${o.fontSize||12}pt`,fontWeight:o.fontWeight||"normal",fontFamily:_.resolveCanvasFontFamily(o.fontFamily),color:o.color||"#333",textAlign:o.textAlign||"left",...o.textAlign==="justify"?{textAlignLast:"justify"}:{}},text:e?o.title||"{pageIndex}/{totalPages}":String(o.title||"")})},table:(t,e,o)=>o?hl(t,o.store,o.fire,o.designData):a("div",{class:"print-table"}),flowList:(t,e,o)=>Tl(t,void 0,o?.store)};pr(Dl);function Ml(t,e,o){const i=t.printElementType.type,n=nt(i)?.renderContent;if(n)return n(t,e,o);const r=Ci(i);if(!r)return a("div",{text:i});const s=document.createElement("div");s.className="plugin-kit-canvas",s.style.width="100%",s.style.height="100%";try{Mr(`canvas:${t.id}`,r.ui.renderCanvas({element:t,data:o?.designData?.length?o.designData:[c.DEFAULT_DEMO_DATA],designMode:!0}),s)}catch{s.textContent=String(i)}return s}function Nr(t){return`x:${Math.round(t.left)} y:${Math.round(t.top)} ${Math.round(t.width)}×${Math.round(t.height)}mm`}function _l(t,e,o){const i=t.store,n=i.selectedIds.has(e.id),r=i.previewIds.has(e.id),s=e.options,l=e.zone||"content",p=[Ml(e,!0,{store:i,fire:t.fire,designData:t.host.designData})];return i.draggingIds.has(e.id)&&p.push(a("div",{class:"drag-preview"})),n&&(p.push(a("div",{class:"resize-handles"},c.RESIZE_POINTS.map(u=>a("div",{class:`resize-handle handle-${u}`,dataset:{point:u,elId:e.id},onMousedown:h=>t.fire("resize-start",{event:h,id:e.id,point:u})})))),p.push(a("div",{class:"selected-indicator"},[a("div",{class:"position-label",text:Nr(s)})]))),a("div",{class:["print-element",`type-${e.printElementType.type}`,`zone-${l}`,n?"selected":"",r?"previewed":"",i.draggingIds.has(e.id)?"drag-ghost":"","design-mode",s.locked?"locked":"",s.visible===!1?"hidden":""].filter(Boolean).join(" "),style:kl(e,o),dataset:{elId:e.id},onMousedown:u=>t.fire("element-mousedown",{event:u,id:e.id}),onContextmenu:u=>{u.preventDefault(),u.stopPropagation(),t.fire("contextmenu",{event:u,id:e.id})}},p)}function bi(t,e){const o=t.margins,i=t.header?.height??10,n=t.footer?.height??10,r=e.width-o.left-o.right;return{header:{left:o.left,top:o.top,width:r,height:i},content:{left:o.left,top:o.top+i,width:r,height:e.height-o.top-o.bottom-i-n},footer:{left:o.left,top:e.height-o.bottom-n,width:r,height:n}}}const Rl='<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>';function $n(t,e){return t.type==="vertical"?{left:`${t.position}mm`,top:"0",height:`${e.height}mm`,borderLeftColor:t.color||"var(--pd-accent-secondary, #f56c6c)"}:{top:`${t.position}mm`,left:"0",width:`${e.width}mm`,borderTopColor:t.color||"var(--pd-accent-secondary, #f56c6c)"}}function Pl(t,e){const o=_.resolveWatermarkLayout(t.watermark,[],e);return o?a("div",{class:"watermark-layer",style:{opacity:String(o.opacity)}},o.tiles.map(i=>a("svg",{class:"watermark-tile",width:`${i.widthMm}mm`,height:`${i.heightMm}mm`,viewBox:`0 0 ${o.tileWidthPx} ${o.tileHeightPx}`,style:{left:`${i.leftMm}mm`,top:`${i.topMm}mm`}},[a("text",{x:String(o.tileWidthPx/2),y:String(o.tileHeightPx/2),"font-size":String(o.fontSizePx),fill:o.color,"text-anchor":"middle","dominant-baseline":"middle",transform:`rotate(${o.rotate},${o.tileWidthPx/2},${o.tileHeightPx/2})`,text:o.text})]))):""}function ii(t,e,o,i,n,r){const s=t.store,l=[];o!=="content"&&l.push(a("span",{class:"zone-label",text:o==="header"?"页眉":"页脚"}));const p=o==="content"?_.collectFollowMemberIds(n):void 0;if(l.push(...n.map(u=>_l(t,u,p))),o!=="content"){const u=o==="header"?"bottom":"top";l.push(a("div",{class:`zone-resize-handle handle-${u}`,dataset:{zone:o},onMousedown:h=>t.fire("zone-resize",{event:h,zone:o})},[e.zoneResizing===o?a("div",{class:"zone-height-tip",text:`${(o==="header"?s.templateData.header.height:s.templateData.footer.height).toFixed(1)}mm`}):""]))}return a("div",{class:`zone-layer zone-${o} design-mode`,style:{position:"absolute",left:`${i.left}mm`,top:`${i.top}mm`,width:`${i.width}mm`,height:`${i.height}mm`},dataset:{zone:o,paperWidth:String(r.width),paperHeight:String(r.height)}},l.filter(Boolean))}function Il(t){const e=t.currentTarget,o=t.dataTransfer?.types??[],i=o.includes("fieldkey"),n=o.includes("elementtype");if(!i&&!n){e.querySelector(".drop-hint")?.remove();return}i&&(t.ctrlKey||t.metaKey)&&(e.dataset.dropLabelIntent="1");const r=n?"+ 元素":e.dataset.dropLabelIntent?"+ 静态文本":"+ 取值字段";let s=e.querySelector(".drop-hint");s||(s=document.createElement("div"),s.className="drop-hint",e.appendChild(s)),s.textContent=r,s.style.left=`${t.clientX+14}px`,s.style.top=`${t.clientY+18}px`}function $r(t){t&&(t.querySelector(".drop-hint")?.remove(),delete t.dataset.dropLabelIntent)}function Fl(t,e){const o=t.store,i=o.templateData,n=_.getPaperDimensions(i),r=(o.scale||100)/100,s=bi(i,n),l=m=>o.elements.filter(g=>(g.zone||"content")===m),p=a("div",{class:"hiprint-printPaper-content",dataset:{content:""},style:{padding:`${i.margins.top}mm ${i.margins.right}mm ${i.margins.bottom}mm ${i.margins.left}mm`,position:"relative",boxSizing:"border-box",minHeight:`${n.height}mm`}},[o.showGrid?a("div",{class:"grid-bg",style:{backgroundImage:`url("data:image/svg+xml,${encodeURIComponent(Rl)}")`,backgroundSize:"5mm 5mm",backgroundPosition:"0 0"}}):"",...i.watermark&&Object.keys(i.watermark).length?[Pl(i,n)]:[],ii(t,e,"header",s.header,l("header"),n),ii(t,e,"content",s.content,l("content"),n),ii(t,e,"footer",s.footer,l("footer"),n),...o.adsorbGuides.map(m=>a("div",{class:`adsorb-guide guide-${m.type}`,style:$n(m,n)})),...(i.guides??[]).map(m=>a("div",{class:`manual-guide guide-${m.type}`,style:{...$n(m,n),"--guide-hit":`${8/r}px`},dataset:{guideId:String(m.id??"")},onMousedown:g=>t.fire("guide-mousedown",{event:g,id:m.id}),onDblclick:g=>{g.preventDefault(),t.fire("guide-remove",m.id)}}))].filter(Boolean)),u=a("div",{class:"hiprint-printPaper",dataset:{test:"paper"},style:{width:`${n.width}mm`,minHeight:`${n.height}mm`,background:i.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:`scale(${r})`,transformOrigin:"0 0"}},[...i.designBackground?.src?[a("div",{class:"design-background",style:{width:`${n.width}mm`,height:`${n.height}mm`,left:"0",top:"0",transform:i.designBackground.rotation?`rotate(${i.designBackground.rotation}deg)`:""}},[a("img",{src:i.designBackground.src,draggable:!1,alt:""})])]:[],p]),h=[a("div",{class:"canvas-scroll"},[a("div",{class:"paper-wrapper",style:{width:`${_.mmToPx(n.width)*r}px`,height:`${_.mmToPx(n.height)*r}px`,position:"relative"}},[u])])];if(o.showRuler&&h.push(a("div",{class:"ruler-overlay",style:{transform:`translate(${e.scrollX}px, ${e.scrollY}px)`}},[a("div",{class:"ruler-corner"}),a("canvas",{class:"pd-ruler is-horizontal",dataset:{ruler:"horizontal"},style:{width:`${e.geom.viewW}px`,height:"20px"},onMousedown:m=>t.fire("ruler-mousedown",{event:m,orientation:"horizontal"})}),a("canvas",{class:"pd-ruler is-vertical",dataset:{ruler:"vertical"},style:{width:"20px",height:`${e.geom.viewH}px`},onMousedown:m=>t.fire("ruler-mousedown",{event:m,orientation:"vertical"})})])),e.guidePreview&&h.push(a("div",{class:`ruler-guide-preview guide-${e.guidePreview.type}`,style:e.guidePreview.type==="vertical"?{left:`${e.guidePreview.position}px`,top:"0",height:"100%"}:{top:`${e.guidePreview.position}px`,left:"0",width:"100%"}})),e.marquee.visible&&h.push(a("div",{class:"marquee-selection",style:{left:`${e.marquee.x}px`,top:`${e.marquee.y}px`,width:`${e.marquee.w}px`,height:`${e.marquee.h}px`}})),e.contextMenu.visible){const m=e.contextMenu;h.push(a("div",{class:"context-menu",style:{left:`${e.contextMenu.x+e.contextMenu.flipX}px`,top:`${e.contextMenu.y+e.contextMenu.flipY}px`}},e.contextMenu.targetId?[Fe(t,m,"复制","copy"),Fe(t,m,"剪切","cut"),Fe(t,m,"粘贴","paste",!o.hasClipboard),Fe(t,m,"删除","delete"),a("div",{class:"context-menu-sep"}),Fe(t,m,"置顶","move-layer",!1,"top"),Fe(t,m,"上移","move-layer",!1,"up"),Fe(t,m,"下移","move-layer",!1,"down"),Fe(t,m,"置底","move-layer",!1,"bottom")]:[Fe(t,m,"粘贴","paste-at",!o.hasClipboard),Fe(t,m,"全选","select-all"),Fe(t,m,"取消选择","clear-selection")]))}return a("div",{class:"canvas-area",dataset:{test:"canvas-area"},onDragover:m=>{const g=m;g.preventDefault(),g.dataTransfer&&(g.dataTransfer.dropEffect="copy"),Il(g)},onDragleave:m=>{const g=m.currentTarget,T=m.relatedTarget;(!T||!g.contains(T))&&g.querySelector(".drop-hint")?.remove()},onDrop:m=>{const g=m,T=m.currentTarget,b=T.dataset.dropLabelIntent==="1";$r(T),b&&(g.labelIntent=!0),t.fire("drop",g)},onMousedown:m=>t.fire("canvas-mousedown",m),onMousemove:m=>t.fire("canvas-mousemove",m),onMouseleave:()=>t.fire("canvas-mouseleave"),onWheel:m=>t.fire("wheel",m),onScroll:m=>t.fire("scroll",m),onContextmenu:m=>{m.preventDefault(),t.fire("canvas-contextmenu",m)}},h.filter(Boolean))}function Fe(t,e,o,i,n=!1,r){return a("div",{class:`context-menu-item${n?" disabled":""}`,text:o,onClick:()=>{e.visible=!1,n||t.fire(i,r),t.repaint()}})}const Ll={AlignCenterHorizontal:'<path d="M2 12h20" /><path d="M10 16v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4" /><path d="M10 8V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v4" /><path d="M20 16v1a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-1" /><path d="M14 8V7c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v1" />',AlignCenterVertical:'<path d="M12 2v20" /><path d="M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4" /><path d="M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4" /><path d="M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1" /><path d="M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1" />',AlignEndHorizontal:'<rect width="6" height="16" x="4" y="2" rx="2" /><rect width="6" height="9" x="14" y="9" rx="2" /><path d="M22 22H2" />',AlignEndVertical:'<rect width="16" height="6" x="2" y="4" rx="2" /><rect width="9" height="6" x="9" y="14" rx="2" /><path d="M22 22V2" />',AlignHorizontalSpaceBetween:'<rect width="6" height="14" x="3" y="5" rx="2" /><rect width="6" height="10" x="15" y="7" rx="2" /><path d="M3 2v20" /><path d="M21 2v20" />',AlignStartHorizontal:'<rect width="6" height="16" x="4" y="6" rx="2" /><rect width="6" height="9" x="14" y="6" rx="2" /><path d="M22 2H2" />',AlignStartVertical:'<rect width="9" height="6" x="6" y="14" rx="2" /><rect width="16" height="6" x="6" y="4" rx="2" /><path d="M2 2v20" />',AlignVerticalSpaceBetween:'<rect width="14" height="6" x="5" y="15" rx="2" /><rect width="10" height="6" x="7" y="3" rx="2" /><path d="M2 21h20" /><path d="M2 3h20" />',ArrowDown:'<path d="M12 5v14" /><path d="m19 12-7 7-7-7" />',ArrowDownToLine:'<path d="M12 17V3" /><path d="m6 11 6 6 6-6" /><path d="M19 21H5" />',ArrowUp:'<path d="m5 12 7-7 7 7" /><path d="M12 19V5" />',ArrowUpToLine:'<path d="M5 3h14" /><path d="m18 13-6-6-6 6" /><path d="M12 7v14" />',Barcode:'<path d="M3 5v14" /><path d="M8 5v14" /><path d="M12 5v14" /><path d="M17 5v14" /><path d="M21 5v14" />',Bold:'<path d="M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8" />',ChartArea:'<path d="M3 3v16a2 2 0 0 0 2 2h16" /><path d="M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z" />',ChartBar:'<path d="M3 3v16a2 2 0 0 0 2 2h16" /><path d="M7 16h8" /><path d="M7 11h12" /><path d="M7 6h3" />',ChartColumn:'<path d="M3 3v16a2 2 0 0 0 2 2h16" /><path d="M18 17V9" /><path d="M13 17V5" /><path d="M8 17v-3" />',ChartLine:'<path d="M3 3v16a2 2 0 0 0 2 2h16" /><path d="m19 9-5 5-4-4-3 3" />',ChartPie:'<path d="M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z" /><path d="M21.21 15.89A10 10 0 1 1 8 2.83" />',ChartScatter:'<circle cx="7.5" cy="7.5" r=".5" fill="currentColor" /><circle cx="18.5" cy="5.5" r=".5" fill="currentColor" /><circle cx="11.5" cy="11.5" r=".5" fill="currentColor" /><circle cx="7.5" cy="16.5" r=".5" fill="currentColor" /><circle cx="17.5" cy="14.5" r=".5" fill="currentColor" /><path d="M3 3v16a2 2 0 0 0 2 2h16" />',Check:'<path d="M20 6 9 17l-5-5" />',ChevronDown:'<path d="m6 9 6 6 6-6" />',ChevronsLeft:'<path d="m11 17-5-5 5-5" /><path d="m18 17-5-5 5-5" />',ChevronsRight:'<path d="m6 17 5-5-5-5" /><path d="m13 17 5-5-5-5" />',ChevronsUpDown:'<path d="m7 15 5 5 5-5" /><path d="m7 9 5-5 5 5" />',Circle:'<circle cx="12" cy="12" r="10" />',ClipboardPaste:'<path d="M11 14h10" /><path d="M16 4h2a2 2 0 0 1 2 2v1.344" /><path d="m17 18 4-4-4-4" /><path d="M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113" /><rect x="8" y="2" width="8" height="4" rx="1" />',Code:'<path d="m16 18 6-6-6-6" /><path d="m8 6-6 6 6 6" />',Copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2" /><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />',Donut:'<path d="M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3" /><circle cx="12" cy="12" r="3" />',Ellipsis:'<circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" /><circle cx="5" cy="12" r="1" />',Eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" /><circle cx="12" cy="12" r="3" />',FileText:'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" /><path d="M14 2v5a1 1 0 0 0 1 1h5" /><path d="M10 9H8" /><path d="M16 13H8" /><path d="M16 17H8" />',Funnel:'<path d="M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z" />',Gauge:'<path d="m12 14 4-4" /><path d="M3.34 19a10 10 0 1 1 17.32 0" />',Grid3x3:'<rect width="18" height="18" x="3" y="3" rx="2" /><path d="M3 9h18" /><path d="M3 15h18" /><path d="M9 3v18" /><path d="M15 3v18" />',Group:'<path d="M3 7V5c0-1.1.9-2 2-2h2" /><path d="M17 3h2c1.1 0 2 .9 2 2v2" /><path d="M21 17v2c0 1.1-.9 2-2 2h-2" /><path d="M7 21H5c-1.1 0-2-.9-2-2v-2" /><rect width="7" height="5" x="7" y="7" rx="1" /><rect width="7" height="5" x="10" y="12" rx="1" />',Image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2" /><circle cx="9" cy="9" r="2" /><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />',Layers:'<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z" /><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12" /><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17" />',List:'<path d="M3 5h.01" /><path d="M3 12h.01" /><path d="M3 19h.01" /><path d="M8 5h13" /><path d="M8 12h13" /><path d="M8 19h13" />',ListTree:'<path d="M8 5h13" /><path d="M13 12h8" /><path d="M13 19h8" /><path d="M3 10a2 2 0 0 0 2 2h3" /><path d="M3 5v12a2 2 0 0 0 2 2h3" />',Maximize:'<path d="M8 3H5a2 2 0 0 0-2 2v3" /><path d="M21 8V5a2 2 0 0 0-2-2h-3" /><path d="M3 16v3a2 2 0 0 0 2 2h3" /><path d="M16 21h3a2 2 0 0 0 2-2v-3" />',Minus:'<path d="M5 12h14" />',PaintBucket:'<path d="M11 7 6 2" /><path d="M18.992 12H2.041" /><path d="M21.145 18.38A3.34 3.34 0 0 1 20 16.5a3.3 3.3 0 0 1-1.145 1.88c-.575.46-.855 1.02-.855 1.595A2 2 0 0 0 20 22a2 2 0 0 0 2-2.025c0-.58-.285-1.13-.855-1.595" /><path d="m8.5 4.5 2.148-2.148a1.205 1.205 0 0 1 1.704 0l7.296 7.296a1.205 1.205 0 0 1 0 1.704l-7.592 7.592a3.615 3.615 0 0 1-5.112 0l-3.888-3.888a3.615 3.615 0 0 1 0-5.112L5.67 7.33" />',Paintbrush:'<path d="m14.622 17.897-10.68-2.913" /><path d="M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z" /><path d="M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15" />',QrCode:'<rect width="5" height="5" x="3" y="3" rx="1" /><rect width="5" height="5" x="16" y="3" rx="1" /><rect width="5" height="5" x="3" y="16" rx="1" /><path d="M21 16h-3a2 2 0 0 0-2 2v3" /><path d="M21 21v.01" /><path d="M12 7v3a2 2 0 0 1-2 2H7" /><path d="M3 12h.01" /><path d="M12 3h.01" /><path d="M12 16v.01" /><path d="M16 12h1" /><path d="M21 12v.01" /><path d="M12 21v-1" />',Radar:'<path d="M19.07 4.93A10 10 0 0 0 6.99 3.34" /><path d="M4 6h.01" /><path d="M2.29 9.62A10 10 0 1 0 21.31 8.35" /><path d="M16.24 7.76A6 6 0 1 0 8.23 16.67" /><path d="M12 18h.01" /><path d="M17.99 11.66A6 6 0 0 1 15.77 16.67" /><circle cx="12" cy="12" r="2" /><path d="m13.41 10.59 5.66-5.66" />',Redo2:'<path d="m15 14 5-5-5-5" /><path d="M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13" />',RotateCcw:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" /><path d="M3 3v5h5" />',SeparatorVertical:'<path d="M12 3v18" /><path d="m16 16 4-4-4-4" /><path d="m8 8-4 4 4 4" />',Shapes:'<path d="M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z" /><rect x="3" y="14" width="7" height="7" rx="1" /><circle cx="17.5" cy="17.5" r="3.5" />',Square:'<rect width="18" height="18" x="3" y="3" rx="2" />',Strikethrough:'<path d="M16 4H9a3 3 0 0 0-2.83 4" /><path d="M14 12a4 4 0 0 1 0 8H6" /><line x1="4" x2="20" y1="12" y2="12" />',Table:'<path d="M12 3v18" /><rect width="18" height="18" x="3" y="3" rx="2" /><path d="M3 9h18" /><path d="M3 15h18" />',Table2:'<path d="M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18" />',TextAlignCenter:'<path d="M21 5H3" /><path d="M17 12H7" /><path d="M19 19H5" />',TextAlignEnd:'<path d="M21 5H3" /><path d="M21 12H9" /><path d="M21 19H7" />',TextAlignJustify:'<path d="M3 5h18" /><path d="M3 12h18" /><path d="M3 19h18" />',TextAlignStart:'<path d="M21 5H3" /><path d="M15 12H3" /><path d="M17 19H3" />',Trash2:'<path d="M10 11v6" /><path d="M14 11v6" /><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" /><path d="M3 6h18" /><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />',Type:'<path d="M12 4v16" /><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2" /><path d="M9 20h6" />',Underline:'<path d="M6 4v6a6 6 0 0 0 12 0V4" /><line x1="4" x2="20" y1="20" y2="20" />',Undo2:'<path d="M9 14 4 9l5-5" /><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11" />',Ungroup:'<rect width="8" height="6" x="5" y="4" rx="1" /><rect width="8" height="6" x="11" y="14" rx="1" />',ZoomIn:'<circle cx="11" cy="11" r="8" /><line x1="21" x2="16.65" y1="21" y2="16.65" /><line x1="11" x2="11" y1="8" y2="14" /><line x1="8" x2="14" y1="11" y2="11" />',ZoomOut:'<circle cx="11" cy="11" r="8" /><line x1="21" x2="16.65" y1="21" y2="16.65" /><line x1="8" x2="14" y1="11" y2="11" />'};function ce(t,e=15,o){const i=Ll[t];return i?`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${e}"${o?` class="${o}"`:""} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${i}</svg>`:""}let ft=null;function Fi(t){const e=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t.trim());if(!e)return null;const o=e[1],i=o.length===3?o.split("").map(n=>n+n).join(""):o;return{r:Number.parseInt(i.slice(0,2),16),g:Number.parseInt(i.slice(2,4),16),b:Number.parseInt(i.slice(4,6),16)}}function Li(t){const e=Fi(t);return e?Br(e):"#000000"}function Br({r:t,g:e,b:o}){return`#${[t,e,o].map(i=>Math.round(Ht(i/255)*255).toString(16).padStart(2,"0")).join("")}`}function zl(t,e,o){const i=t/255,n=e/255,r=o/255,s=Math.max(i,n,r),l=Math.min(i,n,r),p=s-l;let u=0;return p!==0&&(s===i?u=(n-r)/p%6:s===n?u=(r-i)/p+2:u=(i-n)/p+4,u*=60,u<0&&(u+=360)),{h:u,s:s===0?0:p/s,v:s}}function Ol(t,e,o){const i=o*e,n=(t%360+360)%360/60,r=i*(1-Math.abs(n%2-1)),[s,l,p]=n<1?[i,r,0]:n<2?[r,i,0]:n<3?[0,i,r]:n<4?[0,r,i]:n<5?[r,0,i]:[i,0,r],u=o-i;return{r:(s+u)*255,g:(l+u)*255,b:(p+u)*255}}function Nl(t){return((Number.isFinite(t)?t:0)%360+360)%360}function Ht(t){return Math.min(1,Math.max(0,Number.isFinite(t)?t:0))}function $l(t){const e=t.title??"颜色选择";return a("button",{type:"button",class:`preset-color-trigger${t.triggerClass?` ${t.triggerClass}`:""}`,"aria-expanded":"false","aria-haspopup":"dialog",title:e,onClick:o=>{const i=o.currentTarget??o.target,n=i.getRootNode();if(!!ft&&ft.root===n&&ft.title===e&&ft.trigger===i){Nt();return}Nt(),Bl(i,t)}},[a("span",{class:"preset-color-swatch",style:t.value?{background:t.value}:{background:"transparent"}})])}function Nt(){const t=ft;t&&(ft=null,t.teardowns.forEach(e=>e()),t.trigger.setAttribute("aria-expanded","false"),t.panel.remove())}function Bl(t,e){const o=t.getRootNode(),i=o instanceof ShadowRoot?o:document.body,n={root:o,title:e.title??"颜色选择",trigger:t,panel:null,clearable:e.clearable!==!1,onChange:e.onChange,model:e.value||void 0,hue:0,saturation:0,value_:0,hexText:"",dragging:!1,current:null,hex:null,area:null,handle:null,hueRange:null,clearBtn:null,items:[],teardowns:[]};e.value&&Oi(n,e.value)?n.hexText=Li(e.value).toUpperCase():n.hexText=e.value?String(e.value):"",n.panel=ve(Gl(n),i),n.current=n.panel.querySelector(".picker-current"),n.hex=n.panel.querySelector(".picker-hex"),n.area=n.panel.querySelector(".picker-area"),n.handle=n.panel.querySelector(".picker-handle"),n.hueRange=n.panel.querySelector(".picker-hue"),n.clearBtn=n.panel.querySelector(".picker-clear"),n.items=Array.from(n.panel.querySelectorAll(".preset-color-item")).map((r,s)=>({el:r,color:c.PRESET_COLORS[s]})),mo(n),Hl(n),Ul(n),ft=n,t.setAttribute("aria-expanded","true")}function Hl(t){const e=t.trigger.getBoundingClientRect(),o=190,i=t.panel.offsetHeight||216,n=8,r=Math.max(n,Math.min(e.left,window.innerWidth-o-n)),s=e.bottom+6,l=s+i>window.innerHeight-n?Math.max(n,e.top-i-6):s;t.panel.style.left=`${r}px`,t.panel.style.top=`${l}px`}function Ul(t){const e=n=>{const r=Wl(n);r.includes(t.trigger)||r.includes(t.panel)||Nt()},o=n=>{n.key==="Escape"&&Nt()},i=()=>Nt();document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",o),window.addEventListener("scroll",i,!0),window.addEventListener("resize",i),t.root.addEventListener("scroll",i,!0),t.teardowns.push(()=>document.removeEventListener("pointerdown",e,!0),()=>document.removeEventListener("keydown",o),()=>window.removeEventListener("scroll",i,!0),()=>window.removeEventListener("resize",i),()=>t.root.removeEventListener("scroll",i,!0))}function Wl(t){const e=typeof t.composedPath=="function"?t.composedPath():[];return e.length?e:[t.target]}function Gl(t){return a("div",{class:"preset-color-panel",role:"dialog","aria-label":"颜色选择",style:{position:"fixed"},onPointerdown:e=>e.stopPropagation()},[a("div",{class:"picker-preview"},[a("span",{class:"picker-current"}),a("input",{class:"picker-hex",type:"text",maxlength:7,spellcheck:"false","aria-label":"颜色值",onInput:e=>Kl(t,e.target.value)})]),a("div",{class:"picker-area","aria-label":"自定义颜色",tabindex:0,onPointerdown:e=>Vl(t,e),onKeydown:e=>jl(t,e)},[a("span",{class:"picker-handle"})]),a("input",{class:"picker-hue",type:"range",min:0,max:360,step:1,"aria-label":"色相",onInput:e=>Yl(t,Number(e.target.value)),onChange:()=>Ni(t)}),a("div",{class:"picker-heading"},[a("span",{text:"常用颜色"}),t.clearable?a("button",{type:"button",class:"picker-clear",title:"清除选中的颜色",onClick:()=>uo(t,void 0)},[a("svg",{viewBox:"0 0 16 16",width:12,height:12,"aria-hidden":"true"},[a("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",fill:"none"})]),"清除"]):""].filter(Boolean)),a("div",{class:"preset-color-grid"},c.PRESET_COLORS.map(e=>a("button",{type:"button",class:"preset-color-item",style:{background:e},title:e,"aria-label":e,onClick:()=>ql(t,e)})))])}function zi(t){return Br(Ol(t.hue,t.saturation,t.value_))}function mo(t){const e=zi(t);t.hex.value!==t.hexText&&(t.hex.value=t.hexText),t.current.className=t.model?"picker-current":"picker-current is-empty",t.model?t.current.style.background=e:t.current.style.removeProperty("background"),t.area.style.setProperty("--picker-hue",`${Math.round(t.hue)}deg`),t.handle.style.left=`${t.saturation*100}%`,t.handle.style.top=`${(1-t.value_)*100}%`,t.handle.style.background=e;const o=String(Math.round(t.hue));t.hueRange.value!==o&&(t.hueRange.value=o),t.clearBtn&&(t.clearBtn.disabled=!t.model);for(const i of t.items)i.el.className=t.model&&i.color.toLowerCase()===t.model.toLowerCase()?"preset-color-item active":"preset-color-item"}function Oi(t,e){const o=Fi(e);if(!o)return!1;const i=zl(o.r,o.g,o.b);return t.hue=i.h,t.saturation=i.s,t.value_=i.v,t.hexText=Li(e).toUpperCase(),!0}function At(t,e,o,i){t.hue=Nl(e),t.saturation=Ht(o),t.value_=Ht(i),t.hexText=zi(t).toUpperCase(),mo(t)}function Ni(t){const e=zi(t);t.model=e,mo(t),t.onChange(e)}function uo(t,e){t.model=e,e||(t.hexText=""),mo(t),t.onChange(e)}function ql(t,e){Oi(t,e),uo(t,e)}function Kl(t,e){const o=e.trim();if(!o){t.clearable&&uo(t,void 0);return}Fi(o)&&(Oi(t,o),uo(t,Li(o)))}function Vl(t,e){t.dragging=!0,Bn(t,e);const o=n=>{t.dragging&&Bn(t,n)},i=()=>{t.dragging&&(t.dragging=!1,document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",i),document.removeEventListener("pointercancel",i),Ni(t))};document.addEventListener("pointermove",o),document.addEventListener("pointerup",i),document.addEventListener("pointercancel",i)}function Bn(t,e){const o=t.area.getBoundingClientRect();if(!o.width||!o.height)return;const i=Ht((e.clientX-o.left)/o.width),n=Ht(1-(e.clientY-o.top)/o.height);At(t,t.hue,i,n)}function jl(t,e){const o=e.shiftKey?.1:.02;let i=!0;e.key==="ArrowLeft"?At(t,t.hue,t.saturation-o,t.value_):e.key==="ArrowRight"?At(t,t.hue,t.saturation+o,t.value_):e.key==="ArrowUp"?At(t,t.hue,t.saturation,t.value_+o):e.key==="ArrowDown"?At(t,t.hue,t.saturation,t.value_-o):i=!1,i&&(e.preventDefault(),Ni(t))}function Yl(t,e){At(t,e,t.saturation,t.value_)}function oe(t,e,o,i){return a("button",{class:`tb-btn tb-icon${i.on?" on":""}${i.danger?" danger":""}`,type:"button",disabled:!!i.disabled,dataset:{tip:i.tip,...i.test?{test:i.test}:{}},onClick:()=>t.fire(o,i.arg),html:ce(e)})}function ho(t,e,o,i){const n=t.state.openDd===e,r=()=>{t.state.openDd=n?null:e,t.repaint()};return a("div",{class:"tb-dd"},[a("button",{type:"button",class:`tb-dd-trigger${n?" on":""}`,disabled:!!o.disabled,dataset:{test:o.testId??e,tip:o.tip},onClick:r,html:`${o.icon?ce(o.icon):""}${o.text?`<span class="${o.textClass??"tb-btn-text"}">${o.text}</span>`:""}${ce("ChevronDown",12,`tb-dd-arrow${n?" up":""}`)}`}),n?a("div",{class:`tb-dd-panel${o.panelClass?` ${o.panelClass}`:""}`},i):""].filter(Boolean))}function O(t){const e=t.step??1,o=String(e),i=o.indexOf("."),n=i===-1?0:o.length-i-1,r=m=>Number.isFinite(m)?Number(m.toFixed(n)):0,s=m=>{let g=r(m);return t.min!==void 0&&g<t.min&&(g=t.min),t.max!==void 0&&g>t.max&&(g=t.max),g},l=t.value===void 0||t.value===null||!Number.isFinite(t.value)?void 0:r(t.value),p=l??t.min??0,u=m=>{m!==l&&t.onCommit(m)},h=a("input",{class:"pd-input pd-step-input",type:"number",value:l===void 0?"":String(l),min:t.min,max:t.max,step:e,placeholder:t.placeholder,disabled:!!t.disabled,onChange:m=>{const g=m.target,T=(g.value??"").trim();if(T===""){l!==void 0&&(g.value=String(l));return}const b=Number(T);if(!Number.isFinite(b)){g.value=l===void 0?"":String(l);return}const k=s(b);g.value=String(k),u(k)}});return a("div",{class:"pd-stepper"},[a("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:!!t.disabled||p<=(t.min??-1/0),title:"减小","aria-label":"减小",text:"−",onClick:()=>u(s(p-e))}),h,a("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:!!t.disabled||p>=(t.max??1/0),title:"增大","aria-label":"增大",text:"+",onClick:()=>u(s(p+e))})])}function W(t,e,o,i){return a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:t}),i??""]),e,o?a("p",{class:"pd-hint",text:o}):""].filter(Boolean))}const xi=t=>a("button",{class:"pd-help",type:"button","data-tip":t,"aria-label":"字段说明"});function be(t,e,o,i){return a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t"},[t,xi(o)]),i??""]),e])}function bt(t){const e=t.base?.[t.propKey],o=t.target?.[t.propKey]!==e,i=t.force===!0||o,n=t.tipOverride??(t.tipValue===void 0?"恢复默认值":`恢复默认值(${t.tipValue}${t.tipUnit?" "+t.tipUnit:""})`),r=t.force?`${n}(应用到全部选中格)`:n;return a("button",{type:"button",class:`pd-reset-btn${o&&!t.force?" is-dirty":""}`,"data-tip":r,"aria-label":r,html:ce("RotateCcw",13),onClick:()=>{i&&(t.write?t.write(e):t.target[t.propKey]=e,t.onReset?.())}})}const He=t=>a("h3",{class:"pd-divider",text:t});function Se(t,e,o="颜色选择",i){return $l({value:t,title:o,triggerClass:i,onChange:n=>e(n)})}function rt(t,e,o,i,n=!1){return a("div",{class:`pd-radio-group${n?" pd-radio-group--2col":""}`,role:"radiogroup"},e.map(r=>a("label",{class:"pd-radio"},[a("input",{type:"radio",name:t,value:r.value,checked:o===r.value,onChange:()=>i(r.value)}),a("span",{text:r.label})])))}function Hr(t,e,o,i={}){const n=document.createElement("select");n.className=i.className??"pd-select",i.width&&(n.style.width=i.width);for(const r of e){const s=document.createElement("option");s.value=r.value,s.textContent=r.label,r.disabled&&(s.disabled=!0),n.appendChild(s)}return n.value=t,e.some(r=>r.value===t)||(n.selectedIndex=-1),n.addEventListener("change",()=>o(n.value)),n}function Xl(t){const e=window.innerHeight;for(let o=t.parentElement;o&&o!==document.body;o=o.parentElement){const i=getComputedStyle(o).overflowY;if(i==="auto"||i==="scroll"||i==="hidden"||i==="clip"){const n=o.getBoundingClientRect();return{top:Math.max(0,n.top),bottom:Math.min(e,n.bottom)}}}return{top:0,bottom:e}}function bo(t){const e=_.normalizeFontCatalog(t.fonts),o=t.placeholder??"默认",i=`font-select-list-${t.id}`,n=F=>{const z=F?.trim();return z?_.findFontOption(e,z)?.label??z:""},r=F=>{const z=_.normalizeFontQuery(F);return e.find(H=>H.label&&_.normalizeFontQuery(H.label)===z)?.family??F},s=()=>{const F=t.value?.trim();return F?_.findFontOption(e,F)?"":F:""},l=F=>{const z=(t.value??"").trim(),ee=(te,ke,x,Z)=>({kind:te,key:ke,label:x,value:Z,selected:(Z??"")===z}),H=F.trim();if(!H){const te=[ee("clear","__clear__",o)],ke=s();ke&&te.push(ee("unknown","__unknown__",`${ke}(未知)`,ke));for(const x of e)te.push(ee("font",x.family,_.fontOptionLabel(x),x.family));return te}const pe=_.filterFontOptions(e,H).map(te=>ee("font",te.family,_.fontOptionLabel(te),te.family));if(!pe.length){const te=r(H);pe.push(ee("free","__free__",`使用「${te}」`,te))}return pe},p=document.createElement("div");p.className="font-select";const u=document.createElement("input");u.className="pd-input font-select-input",u.type="text",u.setAttribute("role","combobox"),u.setAttribute("aria-autocomplete","list"),u.setAttribute("aria-controls",i),u.autocomplete="off",u.placeholder=o,u.disabled=!!t.disabled,u.value=n(t.value);const h=document.createElement("ul");h.id=i,h.className="font-select-list",h.setAttribute("role","listbox");const m=t.state.fontOpen?.id===t.id?t.state.fontOpen:null,g={open:!!m&&!t.disabled,query:m?.query??"",highlighted:m?.highlighted??-1};g.open&&(u.value=g.query);const T=()=>{t.state.fontOpen=g.open?{id:t.id,query:g.query,highlighted:g.highlighted}:null};T();const b=()=>{const F=(t.value??"").trim();return l(g.query).findIndex(z=>(z.value??"")===F)},k=()=>{const F=u.getBoundingClientRect(),z=Xl(u);h.classList.toggle("is-up",c.resolveOverlayPlacement({triggerTop:F.top,triggerBottom:F.bottom,overlayHeight:h.getBoundingClientRect().height,boundaryTop:z.top,boundaryBottom:z.bottom})==="up")},y=()=>{if(!g.open){h.isConnected&&h.remove(),u.setAttribute("aria-expanded","false"),u.setAttribute("aria-activedescendant","");return}h.isConnected||p.appendChild(h);const F=l(g.query);h.replaceChildren(...F.map((z,ee)=>{const H=document.createElement("li");return H.id=`${i}-${ee}`,H.className="font-select-option"+(ee===g.highlighted?" is-active":"")+(z.kind==="unknown"||z.kind==="free"?" is-muted":""),H.setAttribute("role","option"),H.setAttribute("aria-selected",String(z.selected)),H.textContent=z.label,H.addEventListener("mousedown",pe=>{pe.preventDefault(),K(z)}),H})),u.setAttribute("aria-expanded","true"),u.setAttribute("aria-activedescendant",g.highlighted>=0?`${i}-${g.highlighted}`:""),k()},C=()=>{g.open||t.disabled||(g.open=!0,g.query="",g.highlighted=b(),T(),y())},D=()=>{g.open||C()},P=()=>{g.open=!0,g.query=u.value,g.highlighted=l(g.query).length?0:-1,T(),y()},A=F=>{if(!g.open){C();return}const z=l(g.query).length-1;if(z<0)return;g.highlighted=Math.min(Math.max(g.highlighted+F,0),z),T(),y(),h.children[g.highlighted]?.scrollIntoView?.({block:"nearest"})},L=()=>{if(!g.open)return;const F=l(g.query)[g.highlighted];if(F){K(F);return}const z=g.query.trim();if(z){const ee=r(z);K({value:ee})}},K=F=>{g.open=!1,g.query="",g.highlighted=-1,T(),u.value=n(F.value),y(),t.onChange(F.value)},N=()=>{g.open&&(g.open=!1,g.query="",g.highlighted=-1,T(),u.value=n(t.value),y())};return u.addEventListener("focus",C),u.addEventListener("click",D),u.addEventListener("input",P),u.addEventListener("blur",N),u.addEventListener("keydown",F=>{const z=F;z.key==="ArrowDown"?(z.preventDefault(),A(1)):z.key==="ArrowUp"?(z.preventDefault(),A(-1)):z.key==="Enter"?(z.preventDefault(),L()):z.key==="Escape"&&(z.preventDefault(),N())}),p.append(u),y(),g.open&&(u.focus(),u.setSelectionRange(g.query.length,g.query.length)),p}const Zl=[{key:"solid",label:"实线",preview:"1.5px solid currentColor"},{key:"dashed",label:"虚线",preview:"1.5px dashed currentColor"},{key:"dotted",label:"点线",preview:"1.5px dotted currentColor"},{key:"double",label:"双线",preview:"3px double currentColor"}],Ql={left:"TextAlignStart",center:"TextAlignCenter",right:"TextAlignEnd",justify:"TextAlignJustify"};function ot(t,e,o,i,n={}){return a("button",{type:"button",class:`ft-cell-btn${n.on?" on":""}`,dataset:{test:t,tip:e},disabled:!!n.disabled,onClick:i,html:`<svg viewBox="0 0 18 18" width="18" height="18" aria-hidden="true">${o}</svg>`})}const kt='<rect class="g-faint" x="2.5" y="2.5" width="13" height="13" />',Hn='<rect class="g-solid" x="2.5" y="2.5" width="13" height="13" fill="none" />';function Jl(t){const e=t.format;e.syncBorderDraft();const o=e.values,i=!e.fontEditable,n=i||e.context==="cells",r=e.context==="none",s=e.context==="cells",l=!e.painterActive&&(e.context==="none"||e.context==="cells"||!e.painterCapturable),p=e.painterActive?"退出格式刷(Esc)":e.context==="cells"?"格式刷(表格单元格暂不支持)":e.context==="none"?"格式刷(需选中元素)":e.painterCapturable?"格式刷:单击刷一次,双击连续刷":"格式刷(请仅选中一个源元素)",u=g=>i?`${g}(需选中文本元素)`:g,h=[a("div",{class:"ft-border-panel",dataset:{test:"border-panel"}},[a("div",{class:"ft-border-grid"},[ot("preset-none","无边框",`${kt}<line class="g-solid" x1="4" y1="14" x2="14" y2="4" />`,()=>e.applyBorderPreset("none")),ot("preset-all","所有边框",`${Hn}<line class="g-solid" x1="9" y1="3" x2="9" y2="15" /><line class="g-solid" x1="3" y1="9" x2="15" y2="9" />`,()=>e.applyBorderPreset("all")),ot("preset-outer","外侧边框",Hn,()=>e.applyBorderPreset("outer")),ot("preset-inner",s?"内部边框":"内部边框(仅表格单元格可用)",`${kt}<line class="g-solid" x1="9" y1="3" x2="9" y2="15" /><line class="g-solid" x1="3" y1="9" x2="15" y2="9" />`,()=>e.applyBorderPreset("inner"),{disabled:!s}),ot("edge-top","上边框",`${kt}<line class="g-solid" x1="2" y1="3" x2="16" y2="3" />`,()=>e.applyEdge("top"),{on:e.edgeOn("top")}),ot("edge-bottom","下边框",`${kt}<line class="g-solid" x1="2" y1="15" x2="16" y2="15" />`,()=>e.applyEdge("bottom"),{on:e.edgeOn("bottom")}),ot("edge-left","左边框",`${kt}<line class="g-solid" x1="3" y1="2" x2="3" y2="16" />`,()=>e.applyEdge("left"),{on:e.edgeOn("left")}),ot("edge-right","右边框",`${kt}<line class="g-solid" x1="15" y1="2" x2="15" y2="16" />`,()=>e.applyEdge("right"),{on:e.edgeOn("right")})]),a("div",{class:"ft-style-row"},Zl.map(g=>a("button",{type:"button",class:`ft-style-btn${e.borderStyle===g.key?" on":""}`,dataset:{test:`style-${g.key}`,tip:e.borderStyle===g.key?`${g.label}(再点一次取消,线型=无)`:g.label},onClick:()=>{e.toggleBorderStyle(g.key),t.repaint()}},[a("span",{class:"ft-style-line",style:{borderTop:g.preview}})]))),a("div",{class:"ft-border-style-row"},[a("span",{class:"ft-edge-label",text:"粗细"}),a("div",{class:"ft-line-width"},[O({value:e.borderWidth,min:.25,max:5,step:.25,placeholder:e.borderMixed.width?"混合":void 0,onCommit:g=>{e.setBorderWidth(g),t.repaint()}})])]),a("div",{class:"ft-border-style-row"},[a("span",{class:"ft-edge-label",text:"颜色"}),Se(e.borderColor,g=>{e.setBorderColor(g),t.repaint()},"边框颜色")]),e.borderMixedAny?a("p",{class:"pd-hint",text:"当前单元格四边规格不一致:留空的项不谎报,点预设/单边时按缺省档(实线 0.75 / #333333)批写"}):""].filter(Boolean))],m=[a("div",{class:"ft-align-panel",dataset:{test:"align-panel"}},[a("div",{class:"ft-align-row"},[["left","左对齐","TextAlignStart"],["center","水平居中","TextAlignCenter"],["right","右对齐","TextAlignEnd"],["justify","两端对齐(撑满行宽,含末行)","TextAlignJustify"]].map(([g,T,b])=>a("button",{type:"button",class:`ft-cell-btn${o.textAlign===g?" on":""}`,dataset:{test:`align-${g}`,tip:T},disabled:i,onClick:()=>e.applyStyle({textAlign:g}),html:ce(b)}))),a("div",{class:"ft-align-row"},[["top","顶端对齐","ArrowUpToLine"],["middle","垂直居中","ChevronsUpDown"],["bottom","底端对齐","ArrowDownToLine"]].map(([g,T,b])=>a("button",{type:"button",class:`ft-cell-btn${o.verticalAlign===g?" on":""}`,dataset:{test:`valign-${g}`,tip:T},disabled:i,onClick:()=>e.applyStyle({verticalAlign:g}),html:ce(b)})))])];return a("div",{class:"format-toolbar"},[a("div",{class:"tb-ou ft-group",dataset:{unit:"painter"}},[a("button",{type:"button",class:`ft-btn${e.painterActive?" on":""}`,dataset:{test:"format-painter",tip:p},disabled:l,onClick:()=>{e.painterActive?e.cancelPainter():e.pickPainterSource(!1),t.repaint()},onDblclick:()=>{e.pickPainterSource(!0),t.repaint()},html:ce("Paintbrush")})]),a("div",{class:"tb-ou ft-group",dataset:{unit:"font"}},[a("div",{class:"ft-font"},[bo({id:"ft-font",state:t.state,fonts:t.host.fonts,value:typeof o.fontFamily=="string"?o.fontFamily:void 0,placeholder:o.fontFamily===ht?"混合":"默认",disabled:i,onChange:g=>e.applyStyle({fontFamily:g})})]),a("div",{class:"ft-size",dataset:{test:"font-size"}},[O({value:typeof o.fontSize=="number"?o.fontSize:void 0,min:5,max:72,disabled:i,placeholder:o.fontSize===ht?"混合":"默认",onCommit:g=>e.applyStyle({fontSize:g})})])]),a("div",{class:"tb-ou ft-group",dataset:{unit:"style"}},[...[["bold","Bold","加粗",()=>e.toggleBold()],["underline","Underline","下划线",()=>e.toggleUnderline()],["strike","Strikethrough","删除线",()=>e.toggleStrike()]].map(([g,T,b,k])=>a("button",{type:"button",class:`ft-btn${o[g]===!0?" on":""}`,dataset:{test:g,tip:u(b)},disabled:g==="bold"?i:n,onClick:k,html:ce(T)}))]),a("div",{class:"tb-ou ft-group",dataset:{unit:"color"}},[a("span",{class:`ft-color-btn${i?" dim":""}`,title:`字体颜色${i?"(需选中或混选文本元素)":""}`},[Se(typeof o.color=="string"?o.color:void 0,g=>e.applyStyle({color:g})),a("span",{class:"ft-glyph",text:"A"})]),a("span",{class:`ft-color-btn${r?" dim":""}`,title:"背景色"},[Se(typeof o.backgroundColor=="string"?o.backgroundColor:void 0,g=>e.applyStyle({backgroundColor:g})),a("span",{class:"ft-glyph",html:ce("PaintBucket",14)})])]),a("div",{class:"tb-ou ft-group",dataset:{unit:"align"}},[ho(t,"align",{icon:Ql[String(o.textAlign)]??"TextAlignStart",text:"对齐",textClass:"ft-btn-text",tip:i?"对齐(需选中文本元素或单元格)":"对齐",disabled:i,testId:"align-dd"},m)]),a("div",{class:"tb-ou ft-group",dataset:{unit:"border"}},[ho(t,"border",{icon:"Grid3x3",text:"边框",textClass:"ft-btn-text",tip:r?"边框(需选中元素)":"边框",disabled:r,testId:"border"},h)])])}const ed="1.5.3";fo.filter(t=>t.material).map(t=>({type:t.type,label:t.label,icon:t.icon}));function xo(t,e){return ce(t??"Shapes",e)||ce("Shapes",e)}function td(t){const e=t.state;if(e.leftCollapsed)return a("div",{class:"left-panel collapsed"},[a("div",{class:"left-collapsed"},[Un("ChevronsRight","展开素材台",()=>{e.leftCollapsed=!1,t.repaint()}),...[["elements","元素","Table2"],["fields","字段","ListTree"],["layers","图层","Layers"]].map(([i,n,r])=>a("button",{type:"button",class:`lc-btn${e.leftTab===i?" on":""}`,title:n,html:xo(r,14),onClick:()=>{e.leftTab=i,e.leftCollapsed=!1,t.repaint()}}))])]);const o=(i,n,r="")=>a("div",{class:`pd-tab-pane${r?` ${r}`:""}`,role:"tabpanel",dataset:{pane:`left:${i}`},style:e.leftTab===i?"":{display:"none"}},n);return a("div",{class:"left-panel"},[a("div",{class:"left-head"},[a("span",{class:"left-title",text:"素材台"}),Un("ChevronsLeft","收起素材台",()=>{e.leftCollapsed=!0,t.repaint()})]),a("div",{class:"pd-tabs left-tabs"},[a("div",{class:"pd-tab-bar",role:"tablist"},[...[["elements","元素"],["fields","字段"],["layers","图层"]].map(([i,n])=>a("button",{type:"button",class:`pd-tab${e.leftTab===i?" active":""}`,text:n,onClick:()=>{e.leftTab=i,t.repaint()}}))]),o("elements",id(),"material-grid"),o("fields",[nd(t)]),o("layers",[rd(t)])])])}function Un(t,e,o){return a("button",{type:"button",class:"collapse-btn",title:e,html:xo(t,14),onClick:o})}function od(t,e,o){return a("div",{class:`material-card${c.isWideMaterialLabel(e)?" material-card--wide":""}`,draggable:!0,dataset:{test:`material-${t}`},onDragstart:i=>{const n=i.dataTransfer;n?.setData("elementType",t),n&&(n.effectAllowed="all")}},[a("span",{class:"material-icon","data-icon":o,html:xo(o,14)}),a("span",{class:"material-label",text:e})])}function id(){const t=[];let e;for(const o of hr()){const i=o.group;i&&i!==e&&t.push(a("div",{class:"material-group-title",text:i})),i&&(e=i),t.push(od(o.type,o.label,o.icon))}return[a("div",{class:"panel-title",text:"拖拽元素到画布"}),...t]}function nd(t){const e=t.state,o=c.groupFields(t.store.fields),i=(e.fieldSearch??"").trim().toLowerCase(),n=i?o.map(r=>({...r,fields:r.fields.filter(s=>`${s.fieldLabel}${s.fieldKey}`.toLowerCase().includes(i))})).filter(r=>r.fields.length):o;return a("div",{class:"field-tree-panel"},[a("div",{class:"panel-title",text:"业务字段"}),a("input",{class:"pd-input search-input",type:"search",placeholder:"搜索字段...","aria-label":"搜索字段",value:e.fieldSearch??"",onInput:r=>{e.fieldSearch=r.target.value},onChange:()=>t.repaint()}),a("div",{class:"tree-container"},n.flatMap(r=>{const s=e.collapsedGroups.has(r.key)&&!i,l=r.key?a("div",{class:`field-group-header${r.isList?" is-list":""}`,onClick:()=>{s?e.collapsedGroups.delete(r.key):e.collapsedGroups.add(r.key),t.repaint()}},[a("span",{class:"expand-icon",text:s?"▶":"▼"}),a("span",{class:"node-icon",text:r.isList?"📋":"📁"}),a("span",{class:"group-label",text:r.label,"data-tip":r.label})]):"",p=s?[]:r.fields.map(u=>a("div",{class:"field-row",draggable:!0,"data-tip":`${u.fieldLabel} (${u.fieldKey}) · 单击复制字段名 · 拖动中按住 Ctrl(Mac 为 ⌘)切换为插入字段名`,style:{paddingLeft:`${r.key?22:8}px`},onDragstart:h=>{const m=h.dataTransfer;m?.setData("fieldKey",u.fieldKey),m&&(m.effectAllowed="all")},onClick:()=>{c.copyTextToClipboard(u.fieldLabel||u.fieldKey).then(h=>{h&&(e.copiedFieldKey=u.fieldKey,t.repaint(),setTimeout(()=>{e.copiedFieldKey===u.fieldKey&&(e.copiedFieldKey="",t.repaint())},1200))})}},[a("span",{class:"node-icon",text:"📄"}),a("span",{class:"node-meta"},[a("span",{class:"node-label",text:u.fieldLabel}),a("span",{class:"node-key",text:`(${u.fieldKey})`})]),e.copiedFieldKey===u.fieldKey?a("span",{class:"copy-hint",text:"已复制"}):""].filter(Boolean)));return[l,a("div",{},p.filter(Boolean))].filter(Boolean)})),n.length===0?a("p",{class:"pd-empty",text:"暂无字段"}):""].filter(Boolean))}function rd(t){const e=t.store,o=[...e.elements].sort((l,p)=>(p.options.zIndex??0)-(l.options.zIndex??0)),i=e.elements.filter(l=>e.selectedIds.has(l.id)),n=i.length>=2,r=i.some(l=>!!l.options.groupId),s=l=>l.zone==="header"?"页眉":l.zone==="footer"?"页脚":"";return a("div",{class:"layer-panel"},[a("div",{class:"panel-title",text:"图层"}),...o.map(l=>{const p=mr(l.printElementType.type);return a("div",{class:`layer-item${e.selectedIds.has(l.id)?" active":""}`,onClick:u=>e.selectElement(l.id,u.ctrlKey||u.metaKey)},[a("span",{class:"layer-icon","data-icon":p??"Shapes",html:xo(p,12)}),a("span",{class:"layer-name",text:l.options.title||l.printElementType.title||l.printElementType.type}),s(l)?a("span",{class:"layer-zone",text:s(l)}):"",a("span",{class:"layer-zindex",text:`z:${l.options.zIndex??0}`})].filter(Boolean))}),o.length?a("div",{class:"layer-actions"},[...[["top","置顶","ArrowUpToLine"],["up","上移","ArrowUp"],["down","下移","ArrowDown"],["bottom","置底","ArrowDownToLine"]].map(([l,p,u])=>a("button",{type:"button",class:"pd-button small",title:p,html:ce(u,14),onClick:()=>t.fire("move-layer",l)}))]):"",n||r?a("div",{class:"layer-actions"},[n?a("button",{type:"button",class:"pd-button small",title:"组合 (Ctrl+G)",html:ce("Group",14),onClick:()=>t.fire("group")}):"",r?a("button",{type:"button",class:"pd-button small",title:"取消组合 (Ctrl+Shift+G)",html:ce("Ungroup",14),onClick:()=>t.fire("ungroup")}):""].filter(Boolean)):""].filter(Boolean))}function ad(t){const e=t.store,o=t.state,i=e.pages.length>1,n=e.pages[e.activePageIndex]?.name||`页面 ${e.activePageIndex+1}`,r=e.tilingEnabled;return a("div",{class:"page-tabs"},[a("div",{class:"page-tabs-list"},e.pages.map((l,p)=>o.renamingPage===p?a("input",{class:"page-tab-rename",dataset:{test:"page-rename-input"},value:o.renameText??"",onInput:u=>{o.renameText=u.target.value},onBlur:()=>s(),onKeydown:u=>{const h=u;if(h.key==="Enter"){s();return}h.key==="Escape"&&(o.renamingPage=null,t.repaint())}}):a("button",{type:"button",class:`page-tab${p===e.activePageIndex?" active":""}`,dataset:{tip:l.name?`${l.name}(双击重命名)`:"双击重命名"},text:l.name||`页面 ${p+1}`,onClick:()=>e.switchPage(p),onDblclick:()=>{o.renamingPage=p,o.renameText=l.name??"",t.repaint()}}))),a("div",{class:"page-tabs-actions"},[a("button",{type:"button",dataset:{test:"add-page",tip:r?"拼版模板仅允许一个设计页面":"新增页面(在当前页后追加空白页)"},disabled:r,text:"+",onClick:()=>t.fire("add-page")}),a("button",{type:"button",dataset:{test:"duplicate-page",tip:r?"拼版模板仅允许一个设计页面":`复制当前页「${n}」`},disabled:r,text:"⧉",onClick:()=>t.fire("duplicate-page")}),a("button",{type:"button",dataset:{test:"delete-page",tip:i?`删除当前页「${n}」`:"仅多页面模板可删除页面"},disabled:!i,text:"✕",onClick:()=>t.fire("delete-page")}),a("button",{type:"button",dataset:{test:"move-left",tip:`前移「${n}」`},disabled:e.activePageIndex<=0,text:"←",onClick:()=>t.fire("move-page",-1)}),a("button",{type:"button",dataset:{test:"move-right",tip:`后移「${n}」`},disabled:e.activePageIndex>=e.pages.length-1,text:"→",onClick:()=>t.fire("move-page",1)})])]);function s(){const l=(o.renameText??"").trim();o.renamingPage!==null&&l&&e.renamePage(o.renamingPage,l),o.renamingPage=null,t.repaint()}}function sd(t){const e=t.store,o=e.templateData,i=c.getPaperDimensions(o),n=o.orientation==="landscape"?"横向":"纵向",r=c.PAPER_PRESETS[o.paperSize]?.label??o.paperSize,s=o.outputRotation,l=`${r} ${n} ${Math.round(i.width)}×${Math.round(i.height)}mm${s?`(旋转${s}°)`:""}`;return a("div",{class:"status-bar"},[a("span",{class:"status-item coord",dataset:{coord:""},style:{display:"none"}}),a("span",{class:"status-item",text:`缩放 ${e.scale}%`}),a("span",{class:"status-item",text:`元素 ${e.elements.length}${e.selectedIds.size?` (选中 ${e.selectedIds.size})`:""}`}),a("span",{class:"status-item status-version",text:`v${ed}`}),a("span",{class:"status-item status-paper",text:l})])}const ld=Object.keys(c.PAPER_PRESETS).filter(t=>t!=="CUSTOM"&&!c.PAPER_PRESETS[t]?.continuous);function dd(t){const e=document.createElement("label");e.className="pd-button small upload-label";const o=document.createTextNode("上传背景图"),i=document.createElement("input");i.className="visually-hidden",i.type="file",i.accept="image/*",e.append(o,i);const n=r=>{e.className=`pd-button small upload-label${r?" disabled":""}`,i.disabled=r};return i.addEventListener("change",async()=>{const r=i.files?.[0];if(!r)return;if(!r.type.startsWith("image/")){alert("仅支持上传图片文件"),i.value="";return}const s=t.host.uploadDesignBackground;if(!s){alert("设计背景上传能力未配置"),i.value="";return}n(!0),o.textContent="上传中...";try{const l=await s(r);l?t.store.updateTemplateData({designBackground:{src:l,rotation:0}}):alert("设计背景上传失败")}catch(l){alert(l instanceof Error?l.message:"设计背景上传失败")}finally{o.textContent="上传背景图",n(!t.host.uploadDesignBackground),i.value=""}}),t.host.uploadDesignBackground||n(!0),e}function cd(t){const o=t.store.templateData.designBackground,i=o?.rotation??0;return a("div",{class:"design-background-config"},[He("设计背景"),a("p",{class:"design-background-tip",text:"仅设计器显示,用于套打定位,不会出现在预览和打印中"}),o?.src?[a("div",{class:"design-background-path",title:o.src,text:o.src}),a("div",{class:"design-background-actions"},[a("button",{type:"button",class:"pd-button small rotate-btn",text:`旋转(${(i+90)%360}°)`,onClick:()=>t.store.updateTemplateData({designBackground:{...o,rotation:(i+90)%360}})}),a("button",{type:"button",class:"pd-button small remove-btn",text:"移除",onClick:()=>t.store.updateTemplateData({designBackground:void 0})})])]:dd(t)].flat())}function pd(t){const e=t.store,o=e.templateData,i=o.tiling,n={..._.TILE_DEFAULTS,...i??{},enabled:i?.enabled??!1,sheetMargin:{..._.TILE_DEFAULTS.sheetMargin,...i?.sheetMargin??{}}},r=c.isContinuousPaperSize(o.paperSize),s=b=>e.updateTemplateData({tiling:{...n,...b}}),l=b=>bt({target:n,base:_.TILE_DEFAULTS,propKey:b,write:()=>s({[b]:_.TILE_DEFAULTS[b]})}),p=b=>bt({target:n.sheetMargin,base:_.TILE_DEFAULTS.sheetMargin,propKey:b,write:()=>u(b,_.TILE_DEFAULTS.sheetMargin[b])}),u=(b,k)=>s({sheetMargin:{...n.sheetMargin,[b]:k??0}}),h={...o,tiling:n},m=_.validateTiling(h),g=Math.max(_.computeMaxColumns(h),1);let T="";if(!m.length)try{const b=_.computeTileLayout(h),k=_.resolveSheetMm(h),y=n.sheetPaperSize==="CUSTOM"?"自定义":n.sheetPaperSize??"A4",C=n.sheetPaperSize==="CUSTOM"?"":n.sheetOrientation==="landscape"?" 横向":" 纵向";T=`目标纸 ${y}${C} ${k.width}×${k.height}mm · ${b.columns} 列 × ${b.rows} 行 = 每张 ${b.perSheet} 格 · 每格 ${b.tile.width}×${b.tile.height}mm`}catch{T=""}return a("div",{class:"tiling-config",dataset:{test:"tiling-config"}},[He("拼版打印"),a("p",{class:"pd-hint",text:"把标签按「列 × 行」铺到一张大纸上批量打印"}),a("div",{class:"pd-field"},[a("label",{class:"tiling-switch"},[a("input",{type:"checkbox",checked:n.enabled===!0,disabled:r,onChange:b=>{if(!b.target.checked){s({enabled:!1});return}s({..._.TILE_DEFAULTS,columns:Math.min(_.TILE_DEFAULTS.columns,Math.max(g,1))})}}),a("span",{text:"启用拼版"})]),r?a("p",{class:"pd-hint tiling-error",text:"连续纸不支持拼版"}):""].filter(Boolean)),n.enabled&&!r?[W("目标纸张",a("select",{class:"pd-select",style:{width:"100%"},onChange:b=>{const k=b.target.value;if(k!=="CUSTOM"){s({sheetPaperSize:k});return}const y=_.resolveSheetMm(h);s({sheetPaperSize:"CUSTOM",sheetCustomWidth:n.sheetCustomWidth??y.width,sheetCustomHeight:n.sheetCustomHeight??y.height})}},[...ld.map(b=>a("option",{value:b,text:c.PAPER_PRESETS[b]?.label??b,selected:(n.sheetPaperSize??"A4")===b})),a("option",{value:"CUSTOM",text:"自定义",selected:n.sheetPaperSize==="CUSTOM"})]),void 0,l("sheetPaperSize")),n.sheetPaperSize==="CUSTOM"?W("目标纸宽高 (mm)",a("div",{class:"custom-size-grid"},[O({value:Number(n.sheetCustomWidth??0),min:25,max:2e3,onCommit:b=>s({sheetCustomWidth:b})}),a("span",{class:"custom-size-x",text:"×"}),O({value:Number(n.sheetCustomHeight??0),min:25,max:2e3,onCommit:b=>s({sheetCustomHeight:b})})])):W("目标纸方向",rt("tiling-ori",[{value:"portrait",label:"纵向"},{value:"landscape",label:"横向"}],n.sheetOrientation==="landscape"?"landscape":"portrait",b=>s({sheetOrientation:b})),void 0,l("sheetOrientation")),He("拼版留白 (mm)"),a("div",{class:"margin-grid"},[W("上",O({value:n.sheetMargin.top??0,min:0,max:100,onCommit:b=>u("top",b)}),void 0,p("top")),W("下",O({value:n.sheetMargin.bottom??0,min:0,max:100,onCommit:b=>u("bottom",b)}),void 0,p("bottom")),W("左",O({value:n.sheetMargin.left??0,min:0,max:100,onCommit:b=>u("left",b)}),void 0,p("left")),W("右",O({value:n.sheetMargin.right??0,min:0,max:100,onCommit:b=>u("right",b)}),void 0,p("right"))]),He("格间距与列数"),W("横向间距",O({value:n.gapX??0,min:0,max:50,onCommit:b=>s({gapX:b??0})}),void 0,l("gapX")),W("纵向间距",O({value:n.gapY??0,min:0,max:50,onCommit:b=>s({gapY:b??0})}),void 0,l("gapY")),W("列数",O({value:n.columns??1,min:1,max:g,onCommit:b=>s({columns:b||1})})),...m.map(b=>a("p",{class:"pd-hint tiling-error",text:b.message})),!m.length&&T?a("p",{class:"pd-hint tiling-summary",text:T}):""]:""].flat().filter(Boolean))}const ud=new Set(c.PROPERTY_REGISTRY.map(t=>t.group)),hd={"table-settings":"content"},Wn=new Map;function $i(t){const e=t??"";let o=Wn.get(e);if(!o){const{groups:i,itemKeys:n}=c.searchProperties(e);o={groups:i,keys:n,searching:!!e.trim()},Wn.set(e,o)}return o}function Bi(t){const e=hd[t]??t;return ud.has(e)?e:""}function fd(t,e){const o=$i(t.state.propSearch);if(!o.searching)return!0;const i=Bi(e);return!i||o.groups.includes(i)}function gd(t,e){const o=$i(t.state.propSearch);return!o.searching||o.keys.has(e)}function Ur(t,e){const o=t.props.style??{};return t.props.style={...o,display:e?"":"none"},t}function M(t,e,o){const i=o.props.dataset??{};return o.props.dataset={...i,propKey:e},Ur(o,gd(t,e))}function md(t,e,o){const i=Bi(e);if(!i)return o;const n=o.props.dataset??{};return o.props.dataset={...n,propGroup:i},Ur(o,fd(t,e))}function Wr(t,e){const o=$i(e);for(const i of Array.from(t.querySelectorAll("[data-prop-group]"))){const n=Bi(i.dataset.propGroup??"");i.style.display=!o.searching||!n||o.groups.includes(n)?"":"none"}for(const i of Array.from(t.querySelectorAll("[data-prop-key]")))i.style.display=!o.searching||o.keys.has(i.dataset.propKey??"")?"":"none"}function bd(t){return a("div",{class:"property-search"},[a("input",{class:"pd-input",type:"search",placeholder:"搜索属性...","aria-label":"搜索属性",value:t.state.propSearch??"",onInput:e=>{const o=e.target,i=o.value;t.state.propSearch=i,Wr(o.getRootNode(),i)}})])}const xd={Document:"≡",Brush:"◧",Setting:"⚙"};function vd(t,e){try{const o=window.localStorage.getItem(`property-group-${t}`);return o===null?e:o==="true"}catch{return e}}function yd(t,e){try{window.localStorage.setItem(`property-group-${t}`,String(e))}catch{}}function we(t,e,o,i,n,r=!0,s=[]){const l=vd(e,r);return md(t,e,a("div",{class:`property-group${l?" is-expanded":""}`},[a("div",{class:"group-header",onClick:()=>{yd(e,!l),t.repaint()}},[a("span",{class:"group-icon",text:xd[i]||"•"}),a("span",{class:"group-title",text:o}),...s,a("span",{class:"expand-icon",text:l?"▾":"▸"})]),a("div",{class:"group-content",style:l?"":{display:"none"}},n.filter(Boolean))]))}function vo(t){return a("form",{class:"pd-form",onSubmit:e=>e.preventDefault()},t.filter(Boolean))}function Gr(t){return t.split(".").flatMap(e=>{const o=e.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!o)return[e];const i=o[1],n=[...o[2].matchAll(/\[(\d+)\]/g)].map(r=>Number(r[1]));return[i,...n]})}function Gn(t,e){return Gr(e).reduce((n,r)=>n==null?"":n[r],t)??""}function Hi(t,e,o,i){const n=Gr(o),r=n.pop(),s=n.reduce((l,p)=>((l[p]===void 0||l[p]===null)&&(l[p]={}),l[p]),e);s[r]=i||void 0,t.recordHistory(),t.emit()}function wd(t,e){const o=t.store;if(e.printElementType.type==="table"&&o.tableSelection?.elementId===e.id){const{r1:i,c1:n}=o.tableSelection,r=(e.options.tableRows??[])[i];if(r)return c.getTableCellBindings(r.type,i,n,e.options.fields?.[0]?.dataSource)}return c.getElementBindings(e)}function Ed(t,e){const o=document.createElement("label");o.className="pd-button small upload-label",ve(a("svg",{class:"pd-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[a("path",{fill:"currentColor",d:"M12 3l4 4h-3v7h-2V7H8zm-7 12h14v5H5Z"})]),o);const i=document.createTextNode("上传图片"),n=document.createElement("input");n.className="visually-hidden",n.type="file",n.accept="image/*",o.append(i,n);const r=p=>{o.className=`pd-button small upload-label${p?" disabled":""}`,n.disabled=p};n.addEventListener("change",async()=>{const p=n.files?.[0];if(!p)return;if(!p.type.startsWith("image/")){alert("仅支持上传图片文件"),n.value="";return}const u=t.host.uploadImage;if(!u){alert("图片上传能力未配置"),n.value="";return}r(!0),i.textContent="上传中...";try{const h=await u(p);h?Hi(t.store,e,"options.src",h):alert("图片上传失败")}catch(h){alert(h instanceof Error?h.message:"图片上传失败")}finally{i.textContent="上传图片",r(!t.host.uploadImage),n.value=""}}),t.host.uploadImage||r(!0);const s=document.createElement("div");s.className="image-content-upload";const l=document.createElement("p");return l.className="upload-tip",l.textContent="支持 jpg/png/gif/bmp/webp/svg 等图片,上传后填入相对路径",s.append(o,l),s}function Td(t,e){const o=i=>t.fire("open-expression",{elementId:e.id,targetPath:i.targetPath,value:Gn(e,i.targetPath)});return we(t,"binding","内容","Document",[...wd(t,e).map(i=>W(i.label,a("input",{class:"pd-input",type:"text",value:Gn(e,i.targetPath),placeholder:i.placeholder||"输入内容,支持 {字段} 表达式",onChange:n=>Hi(t.store,e,i.targetPath,n.target.value),onDblclick:()=>o(i)}))),e.printElementType.type==="image"?Ed(t,e):""].filter(Boolean))}const Lt=new Map;function oo(t){return`${Math.round(t*1e4)/1e4}%`}function qr(t,e){const o=c.parseCropAnchor(e.value),i=o.kind==="custom",n=o.kind==="axes"?o.x:50,r=o.kind==="axes"?o.y:50,s=c.resolveCropPreview(e.src),l=Lt.get(s.src),p={widthMm:e.widthMm,heightMm:e.heightMm,naturalWidth:l?.width,naturalHeight:l?.height,fit:e.fit,scalePct:e.scale},u=c.resolveCropTravel(p),h=c.cropWindow(p,n,r),m=document.createElement("select");m.className="pd-select",m.style.width="100%";for(const k of c.cropPresetOptions(u,n,r)){const y=document.createElement("option");y.value=k.value,y.textContent=k.label,m.appendChild(y)}if(i){const k=document.createElement("option");k.value="custom",k.textContent="自定义(保留原值)",m.appendChild(k)}m.value=i?"custom":`${n},${r}`,m.selectedIndex<0&&(m.selectedIndex=i?m.options.length-1:0),m.addEventListener("change",()=>{if(m.value==="custom")return;const[k,y]=m.value.split(",").map(Number);e.onCommit(c.buildCropAnchor(k,y))});const g=c.propertyTip(e.fieldKey),T=[a("div",{class:"pd-field",dataset:{field:e.fieldKey}},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t"},[e.label,xi(g)]),e.resetAnchor??""].filter(Boolean)),m])];T.push(a("div",{class:"pd-field",dataset:{field:"ap-img-fit-scale"}},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t"},[c.CROP_SCALE_LABEL,xi(c.propertyTip("ap-img-fit-scale"))]),e.resetScale??""].filter(Boolean)),O({value:e.scale,min:c.CROP_SCALE_MIN,max:c.CROP_SCALE_MAX,step:5,placeholder:"默认 100",onCommit:k=>e.onScaleCommit(k>c.CROP_SCALE_MIN?k:void 0)})]));for(const k of c.cropAxisFields(u,n,r))T.push(a("div",{class:"pd-field",dataset:{field:e.fieldKey}},[a("span",{class:"pd-label",text:k.label}),O({value:k.value,min:0,max:100,step:1,onCommit:y=>e.onCommit(c.buildCropAnchor(k.name==="horizontal"?y:n,k.name==="vertical"?y:r))})]));const b=c.cropAxisNote(u,i);return b&&T.push(a("p",{class:"pd-crop-note",text:b})),s.isSample&&T.push(a("p",{class:"pd-crop-note",text:c.CROP_SAMPLE_NOTE})),T.push(a("div",{class:"pd-crop-preview"},[a("img",{class:"pd-crop-thumb",src:s.src,alt:s.isSample?"示例图":"原图",onLoad:k=>{const y=k.target;if(!(y.naturalWidth>0&&y.naturalHeight>0))return;const C=Lt.get(s.src);C&&C.width===y.naturalWidth&&C.height===y.naturalHeight||(Lt.set(s.src,{width:y.naturalWidth,height:y.naturalHeight}),t.repaint())},onError:()=>{Lt.has(s.src)&&(Lt.delete(s.src),t.repaint())}}),h?a("div",{class:"pd-crop-win",style:{left:oo(h.leftPct),top:oo(h.topPct),width:oo(h.widthPct),height:oo(h.heightPct)}}):""])),a("div",{class:e.containerClass??"pd-crop-anchor"},T)}const ut=t=>Number(t??0),vi=t=>t||void 0;function mt(t,e,o,i,n,r){return a("div",{class:"pd-field"},[a("span",{class:"pd-label",...i?{title:i}:{}},[a("span",{class:"pd-label-t",text:t}),n??""].filter(Boolean)),a("input",{class:"pd-switch",type:"checkbox",checked:e,...r?{disabled:!0}:{},onChange:s=>o(s.target.checked)})])}function Kr(t,e,o,i,n=!1,r){return a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:t}),""].filter(Boolean)),a("select",{class:"pd-select",...n?{style:{width:"100%"}}:{},onChange:s=>i(s.target.value)},o.map(s=>a("option",{value:s.value,text:s.label,selected:s.value===e})))])}function zt(t,e,o,i,n={}){return a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:t}),n.reset??""].filter(Boolean)),Hr(e,o,i,{className:"pd-select",...n.full?{width:"100%"}:{}})])}const Ct=t=>a("p",{class:"pd-hint",text:t}),Sd="多级表头作为一个结构整体重复,勾选后表头区所有行都会在每页顶部重复",kd=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行(每页小计)"},{value:"summary",label:"汇总行"}],Cd=[{value:"CODE128",label:"CODE128(通用)"},{value:"EAN13",label:"EAN13(商品码)"},{value:"EAN8",label:"EAN8"},{value:"UPC",label:"UPC"},{value:"CODE39",label:"CODE39"},{value:"ITF14",label:"ITF14"}],Ad=[{value:"L",label:"L(最低,容量大)"},{value:"M",label:"M(推荐)"},{value:"Q",label:"Q"},{value:"H",label:"H(最高)"}],Dd=[{value:"clip",label:"截断"},{value:"shrink",label:"自动缩小"},{value:"autoHeight",label:"自适应行高"}],Md={value:"__multi__",label:"多选",disabled:!0};function _d(t,e){const o=t.store,i=o.tableSelection,n=e.options.tableRows??[],r=i?n[i.r1]:void 0;if(!i||!r)return we(t,"table-row","行属性","Grid",[]);const s=l=>o.updateElement(e.id,l);return we(t,"table-row","行属性","Grid",[vo([Kr("行类型",r.type,kd,l=>{const p=c.setRowType(n,i.r1,l);if(p){window.alert(p);return}s({tableRows:n})},!0),a("div",{class:"pd-field"},[a("span",{class:"pd-label",text:"行高 (mm)"}),O({value:r.height,min:3,max:100,step:.5,onCommit:l=>{r.height=l,s({tableRows:n})}})]),r.type==="header"?mt("表头每页重复",r.repeatOnPage??!1,l=>{c.setHeaderRepeat(n,l),s({tableRows:n})},Sd):""])])}function Rd(t,e){const o=t.store,i=e.options,n=h=>o.updateElement(e.id,h),r=i.tableColWidths??[],s=o.paperSize.width-o.templateData.margins.left-o.templateData.margins.right,l=o.fields.filter(h=>h.fieldType==="list").map(h=>({value:h.fieldKey,label:h.fieldLabel})),p=c.createDefaultOptions("table"),u=h=>bt({target:i,base:p,propKey:h,write:()=>n({[h]:p[h]})});return we(t,"table-settings","表格设置","Grid",[vo([Kr("列表数据源字段",i.dataSource??"",l,h=>n({dataSource:h||void 0}),!0),a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"默认字体"}),u("tableDefaultFontFamily")]),bo({id:"table-default-font",state:t.state,fonts:t.host.fonts,value:i.tableDefaultFontFamily,placeholder:"默认",onChange:h=>n({tableDefaultFontFamily:h||void 0})})]),a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"默认字号 (pt)"}),u("tableDefaultFontSize")]),O({value:ut(i.tableDefaultFontSize),min:0,max:72,placeholder:"默认",onCommit:h=>n({tableDefaultFontSize:vi(h)})})]),a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"默认文字颜色"}),u("tableDefaultColor")]),Se(i.tableDefaultColor,h=>n({tableDefaultColor:h}),"默认文字颜色")]),a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"默认内边距 (mm)"}),u("tableDefaultPadding")]),O({value:ut(i.tableDefaultPadding),min:0,max:10,step:.5,placeholder:"默认",onCommit:h=>n({tableDefaultPadding:vi(h)})})]),a("div",{class:"pd-field"},[a("span",{class:"pd-label",text:"列宽 (mm)"}),...r.map((h,m)=>a("div",{class:"col-width-row"},[a("span",{style:{width:"60px"},text:`列${m+1}`}),O({value:h,min:5,max:200,onCommit:g=>{const T=r.reduce((b,k,y)=>y===m?b:b+k,0);if(T+g>s){const b=Math.max(5,Math.round((s-T)*10)/10);window.alert(`表格总宽不能超过打印范围宽度 ${s}mm,列${m+1} 已调整为 ${b}mm`),r[m]=b}else r[m]=g;n({tableColWidths:r})}})]))])])])}function Pd(t,e){const o=t.store,i=e.options,n=e.printElementType.type==="table",r=l=>o.updateElement(e.id,l),s=[];if(n)s.push(M(t,"pg-enabled",mt("启用分页",i.tablePagination?.enabled??!0,l=>r({tablePagination:{enabled:l}}))));else{const l=i.pagination?.pageable??!0,p=i.pagination?.keepWithNext??!1;s.push(M(t,"pg-pageable",mt("参与分页",l,u=>r({pagination:{pageable:u,keepWithNext:p}})))),s.push(M(t,"pg-keep-with-next",mt("与下元素同页",p,u=>r({pagination:{pageable:l,keepWithNext:u}}))))}return we(t,"pagination","分页配置","Document",[vo(s)],!1)}const ni=new WeakMap,qn=[{value:"top",label:"上"},{value:"right",label:"右"},{value:"bottom",label:"下"},{value:"left",label:"左"}];function Id(t,e){const o=t.store,i=o.tableSelection,n=e.options.tableRows??[];if(!i)return we(t,"table-cell","单元格","Menu",[]);const r=c.findMainCell(n,i.r1,i.c1),s=n[r.r]?.cells[r.c];if(!s)return we(t,"table-cell","单元格","Menu",[]);const l=()=>c.collectWritableCells(n,i),p=c.resolveCellGroupMode(n,i),u=p.count,h=p.mode==="multi",m=`${e.id}:${i.r1}:${i.c1}:${i.r2}:${i.c2}`,g=ni.get(o),T=g?.key===m?g:{key:m,border:{},values:{},edges:{}};g?.key!==m&&ni.set(o,T);const b=v=>{ni.set(o,{key:m,border:v.border??T.border,values:v.values??T.values,edges:v.edges??T.edges})},k=(v,U)=>{b({border:{...T.border,[v]:U}}),t.repaint()},y=(v,U)=>{l().forEach(v),h&&U&&b({values:{...T.values,...U}}),o.updateElement(e.id,{tableRows:n})},C=(v,U)=>{y(ge=>{ge[v]=U},{[v]:U})},D=v=>h?T.values[v]:s[v],P=v=>h&&v in T.values,A=h?{width:void 0,style:void 0,color:void 0}:c.resolveCellBorderDisplay(n,i),L=!h&&l().some(v=>!!v.borders&&!!(v.borders.top||v.borders.right||v.borders.bottom||v.borders.left)),K=!h&&!L,N={width:K?0:typeof A.width=="number"?A.width:c.DEFAULT_BORDER.width,style:K?"none":typeof A.style=="string"&&A.style!=="mixed"?A.style:c.DEFAULT_BORDER.style,color:typeof A.color=="string"&&A.color!=="mixed"?A.color:c.DEFAULT_BORDER.color,...T.border},F="__mixed__",z={style:!h&&A.style==="mixed",width:!h&&A.width==="mixed",color:!h&&A.color==="mixed"},ee=z.style&&!("style"in T.border),H=z.width&&!("width"in T.border),pe=z.color&&!("color"in T.border),te=ee||H||pe,ke=ee?F:N.style,x=H?void 0:N.width,Z=pe?void 0:N.color,le=v=>{const U={style:v};v!=="none"&&x===0?U.width=c.DEFAULT_BORDER.width:v==="none"&&!L&&(U.width=0),b({border:{...T.border,...U}}),t.repaint()},De=()=>({...N}),B=h?qn.reduce((v,U)=>(v[U.value]=T.edges[U.value]?"on":"off",v),{}):c.resolveBorderEdgeStates(l().map(v=>v.borders)),Ue=h?"cellType"in T.values?T.values.cellType??"text":c.resolveSharedCellType(n,i):s.cellType??"text",re=Ue==="barcode",ye=Ue==="qrcode",Me=Ue==="image",G=Ue==="text",Ze=re&&!!D("printerDpi"),Wt=c.barcodeBarWidthRecommendText(D("printerDpi"),D("barWidth")),j=h?T.values.textFit:c.resolveCellTextFit(s),yo=h?"cellType"in T.values?T.values.cellType??"text":"":s.cellType||"text",at=v=>h?[Md,...v]:v,Ee=v=>h?"多选":v,Ce=(v,U)=>h?T.values[v]:U,wo=h?D("barcodeType")??"__multi__":s.barcodeType||"CODE128",Eo=h?P("printerDpi")?D("printerDpi")?String(D("printerDpi")):"":"__multi__":s.printerDpi?String(s.printerDpi):"",To=h?D("qrCodeLevel")??"__multi__":s.qrCodeLevel||"M",So=h?D("fit")??"__multi__":s.fit||"contain",Gt=j??"__multi__",Y=c.canMergeReason(n,i);let Qe=!0;for(let v=i.r1;v<=i.r2;v++)if(n[v]?.type!=="data"){Qe=!1;break}const X=Qe?"":"仅数据行(明细行)支持按值合并";let Je=!1;for(let v=i.r1;v<=i.r2&&!Je;v++)for(let U=i.c1;U<=i.c2&&!Je;U++){const ge=n[v]?.cells[U];ge&&!ge.merged&&((ge.rowspan??1)>1||(ge.colspan??1)>1)&&(Je=!0)}const ue=(v,U,ge,Q={},Re)=>a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:v}),Re??""].filter(Boolean)),O({value:U,...Q,onCommit:We=>C(ge,vi(We))})]),st="恢复默认值(跟随表格默认)",V=v=>bt({target:s,base:{},propKey:v,tipOverride:st,force:h,write:()=>C(v,void 0)}),_e=e.options.tableDefaultPadding??1,Mt={width:c.cellFitWidthMm(e.options.tableColWidths??[],r.c,s,_e),height:c.cellFitCapMm(n,r.r,s,_e)};return we(t,"table-cell","单元格","Menu",[vo([h?Ct(`已选 ${u} 格 · 批量设置:不显示单格配置,改动会应用到全部选中格`):"",a("div",{class:"pd-field"},[a("span",{class:"pd-label",text:"单元格类型"}),rt("cell-type",[{value:"text",label:"文本"},{value:"barcode",label:"条形码"},{value:"qrcode",label:"二维码"},{value:"image",label:"图片"}],yo,v=>{const U=v==="text"?void 0:v,ge={cellType:v};v!=="barcode"&&Object.assign(ge,{barcodeType:void 0,showBarcodeText:void 0,printerDpi:void 0,barQuietZone:void 0,barHeight:void 0}),v!=="qrcode"&&Object.assign(ge,{qrCodeLevel:void 0,qrQuietZone:void 0}),y(Q=>{Q.cellType=U,v!=="barcode"&&(Q.barcodeType=void 0,Q.showBarcodeText=void 0,Q.printerDpi=void 0,Q.barQuietZone=void 0,Q.barHeight=void 0),v!=="qrcode"&&(Q.qrCodeLevel=void 0,Q.qrQuietZone=void 0)},ge)})]),re?zt("码制",wo,at(Cd),v=>{v!=="__multi__"&&C("barcodeType",v||void 0)}):"",re?mt("显示文本",h?T.values.showBarcodeText===!0:s.showBarcodeText!==!1,v=>C("showBarcodeText",v),void 0,V("showBarcodeText")):"",re?ue("条宽(倍率)",Ce("barWidth",s.barWidth??2),"barWidth",{min:2,max:8,step:.5,placeholder:Ee("")},V("barWidth")):"",re?Ct((Ze?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),单元格放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定")+(Wt?`。${Wt}`:"")):"",re?be("静区 (模块)",O({value:Ce("barQuietZone",s.barQuietZone),min:0,max:20,placeholder:Ee("默认 10"),onCommit:v=>C("barQuietZone",v)}),c.propertyTip("cd-bar-quiet-zone"),V("barQuietZone")):"",re?be("条高 (mm)",O({value:Ce("barHeight",s.barHeight),min:1,max:100,placeholder:Ee("默认 30 模块"),onCommit:v=>C("barHeight",v??void 0)}),c.propertyTip("cd-bar-height"),V("barHeight")):"",re?ue("文本字号(相对条高,条高为 30)",Ce("barFontSize",s.barFontSize??10),"barFontSize",{min:5,max:24,placeholder:Ee("默认 10")},V("barFontSize")):"",re?zt("打印机分辨率",Eo,at([{value:"",label:"不指定(按条宽渲染)"},{value:"203",label:"203 dpi(8 点/mm)"},{value:"300",label:"300 dpi(11.8 点/mm)"},{value:"600",label:"600 dpi(23.6 点/mm)"}]),v=>{if(v==="__multi__")return;const U=Number(v);C("printerDpi",U>0?U:void 0)},{reset:V("printerDpi")}):"",re?Ct("填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小"):"",ye?zt("纠错级别",To,at(Ad),v=>{v!=="__multi__"&&C("qrCodeLevel",v||void 0)},{reset:V("qrCodeLevel")}):"",ye?be("静区 (模块)",O({value:Ce("qrQuietZone",s.qrQuietZone),min:0,max:8,placeholder:Ee("默认 0"),onCommit:v=>C("qrQuietZone",v)}),c.propertyTip("cd-quiet-zone"),V("qrQuietZone")):"",re?Ct("单元格条码尺寸由「条宽」与「打印机分辨率」结算:可用宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限。要放大条码:先加条宽倍率,再收窄静区(左右白边会换成条宽),必要时关掉显示文本以让出文本区高度"):"",ye||Me?zt("缩放模式",So,at(c.IMAGE_FIT_OPTIONS),v=>{v!=="__multi__"&&C("fit",v)},{reset:V("fit")}):"",Me&&!h&&s.fit==="cover"?qr(t,{fieldKey:"ap-img-object-position",label:"裁剪锚点",src:c.resolveDesignImageSrc(s.formatter),fit:s.fit,containerClass:"pd-cell-anchor",widthMm:Mt.width,heightMm:Mt.height,scale:s.fitScale,value:s.objectPosition,onCommit:v=>C("objectPosition",v),onScaleCommit:v=>C("fitScale",v),resetAnchor:V("objectPosition"),resetScale:V("fitScale")}):"",re||ye||Me?ue("最大宽度 (mm)",Ce("maxWidth",ut(s.maxWidth)),"maxWidth",{min:0,max:200,placeholder:Ee("默认")},V("maxWidth")):"",re||ye||Me?ue("最大高度 (mm)",Ce("maxHeight",ut(s.maxHeight)),"maxHeight",{min:0,max:200,placeholder:Ee("默认")},V("maxHeight")):"",a("div",{class:"pd-field"},[a("span",{class:"pd-label",text:"内容"}),a("input",{class:"pd-input",type:"text",value:h?D("formatter")??"":s.formatter||"",placeholder:h?"多选(输入后覆盖全部选中格)":"输入内容,支持 {字段} 表达式",onChange:v=>C("formatter",v.target.value||void 0),onDblclick:()=>t.fire("table-cell-dblclick",{elementId:e.id,r:r.r,c:r.c,cellId:s.id})})]),a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"水平对齐"}),V("align")]),rt("cell-align",[{value:"left",label:"左"},{value:"center",label:"中"},{value:"right",label:"右"},{value:"justify",label:"两端"}],h?T.values.align??"":s.align||"left",v=>C("align",v))]),a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"垂直对齐"}),V("valign")]),rt("cell-valign",[{value:"top",label:"上"},{value:"middle",label:"中"},{value:"bottom",label:"下"}],h?T.values.valign??"":s.valign||"top",v=>C("valign",v))]),a("div",{class:"cell-style-grid"},[a("div",{class:"pd-field cell-font-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"字体"}),V("fontFamily")]),bo({id:"cell-font",state:t.state,fonts:t.host.fonts,value:h?D("fontFamily"):s.fontFamily,placeholder:Ee("继承默认"),onChange:v=>C("fontFamily",v)})]),ue("字号 (pt)",Ce("fontSize",ut(s.fontSize)),"fontSize",{min:0,max:72,placeholder:Ee("默认")},V("fontSize")),a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"加粗"}),V("fontWeight")]),a("input",{class:"pd-switch",type:"checkbox",checked:h?T.values.fontWeight==="bold":s.fontWeight==="bold",onChange:v=>C("fontWeight",v.target.checked?"bold":void 0)})]),a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"文字颜色"}),V("color")]),Se(h?D("color"):s.color,v=>C("color",v),"文字颜色")]),a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"背景色"}),V("backgroundColor")]),Se(h?D("backgroundColor"):s.backgroundColor,v=>C("backgroundColor",v),"背景颜色")])]),He("边框"),a("div",{class:"border-style-row"},[Hr(ke,[...ee?[{value:F,label:"混合",disabled:!0}]:[],...c.BORDER_LINE_STYLES],v=>{v!==F&&le(v)},{width:"90px"}),a("div",{style:{width:"112px",flexShrink:"0"}},[O({value:x,min:.25,max:5,step:.25,placeholder:h?"多选":H?"混合":void 0,onCommit:v=>k("width",v)})]),Se(Z,v=>k("color",v),"边框颜色")]),a("div",{class:"pd-button-group border-presets"},[["all","全部"],["outer","外侧"],["inner","内部"],["none","无"]].map(([v,U])=>a("button",{type:"button",class:"pd-button small",text:U,onClick:()=>{c.applyBorderPreset(n,i,N.style==="none"?"none":v,De()),o.updateElement(e.id,{tableRows:n})}}))),a("div",{class:"pd-checkbox-group"},qn.map(v=>a("label",{class:"pd-checkbox"},[a("input",{type:"checkbox",value:v.value,checked:B[v.value]==="on",indeterminate:B[v.value]==="mixed",onChange:U=>{const Q=U.target.checked&&N.style!=="none";h&&b({edges:{...T.edges,[v.value]:Q}}),y(Re=>{c.setCellBorderEdge(Re,v.value,Q?De():null)})}}),a("span",{text:v.label})]))),Ct(h?c.CELL_BORDER_APPLY_HINT_MULTI:te?c.CELL_BORDER_APPLY_HINT_MIXED:c.CELL_BORDER_APPLY_HINT),ue("内边距 (mm)",Ce("padding",ut(s.padding)),"padding",{min:0,max:10,step:.5,placeholder:Ee("默认")},V("padding")),mt("自动换行",h?T.values.wordWrap===!0:s.wordWrap??!0,v=>C("wordWrap",v),void 0,V("wordWrap")),G?zt("文字溢出",Gt,at(Dd),v=>{v!=="__multi__"&&C("textFit",v)},{full:!0,reset:V("textFit")}):"",G&&j==="shrink"?ue("最小字号 (pt)",Ce("shrinkMinFontSize",ut(s.shrinkMinFontSize)),"shrinkMinFontSize",{min:0,max:72,step:.5,placeholder:Ee("默认 6")},V("shrinkMinFontSize")):"",a("div",{class:"merge-card"},[a("div",{class:"merge-card-title",text:"单元格合并"}),a("div",{class:"merge-btns"},[a("button",{type:"button",class:"pd-button small",text:"合并单元格",disabled:!!Y,title:Y||"",onClick:()=>{c.mergeCells(n,i),o.updateElement(e.id,{tableRows:n})}}),a("button",{type:"button",class:"pd-button small",text:"拆分单元格",disabled:!Je,onClick:()=>{c.splitCells(n,i),o.updateElement(e.id,{tableRows:n})}})]),a("div",{class:"merge-card-divider"}),mt("按值合并",h?T.values.mergeSameValue===!0:s.mergeSameValue===!0,v=>C("mergeSameValue",v),X||void 0,Qe?V("mergeSameValue"):void 0,!Qe),Ct("明细相邻行同值时自动纵向合并;跨页时在该页内成段,续页首行重放该值")])])])}const ri=_.WATERMARK_DENSITY_PRESETS;function yi(t){const e=t.trim();return e?/[{}]/.test(e)||/^[A-Za-z_$][\w$]*\s*\(/.test(e)?!0:/^[A-Za-z_$][\w$]*(\.[\w$]+)+$/.test(e):!1}function Fd(t){return t?t.mode==="binding"?t.binding??"":t.content??"":""}function Ld(t){const e=t.store.templateData.watermark,o=Fd(e),i=e?.mode==="binding"||o!==""&&yi(o),n=(()=>{const u=e?.tileWidth??_.WATERMARK_DEFAULTS.tileWidth,h=e?.tileHeight??_.WATERMARK_DEFAULTS.tileHeight;for(const[m,g]of Object.entries(ri))if(g.width===u&&g.height===h)return m;return"custom"})(),r=u=>{const h={...e,testData:e?.testData??"",rotate:e?.rotate??_.WATERMARK_DEFAULTS.rotate,color:e?.color||_.WATERMARK_DEFAULTS.color,opacity:e?.opacity??_.WATERMARK_DEFAULTS.opacity,tileWidth:e?.tileWidth??_.WATERMARK_DEFAULTS.tileWidth,tileHeight:e?.tileHeight??_.WATERMARK_DEFAULTS.tileHeight};t.store.updateTemplateData({watermark:{...h,...u}})},s=()=>t.fire("open-expression",{elementId:"",targetPath:"watermark.content",value:o}),l={rotate:e?.rotate??_.WATERMARK_DEFAULTS.rotate,color:e?.color||_.WATERMARK_DEFAULTS.color,opacity:e?.opacity??_.WATERMARK_DEFAULTS.opacity,tileWidth:e?.tileWidth??_.WATERMARK_DEFAULTS.tileWidth,tileHeight:e?.tileHeight??_.WATERMARK_DEFAULTS.tileHeight},p=u=>bt({target:l,base:_.WATERMARK_DEFAULTS,propKey:u,write:()=>r({[u]:_.WATERMARK_DEFAULTS[u]})});return a("div",{class:"watermark-config"},[He("水印"),a("form",{class:"pd-form",onSubmit:u=>u.preventDefault()},[a("div",{class:"pd-field"},[a("span",{class:"pd-label",text:"水印表达式"}),a("input",{class:"pd-input",type:"text",value:o,placeholder:"直接输入文字,或用表达式:{order.no}、{printDate}",title:"双击或点「编辑表达式」打开表达式弹框",onChange:u=>{const h=u.target.value;r(yi(h)?{mode:"binding",binding:h,content:""}:{mode:"fixed",content:h,binding:""})},onDblclick:s}),a("button",{type:"button",class:"pd-button small",text:"编辑表达式",onClick:s})]),i?W("测试值",a("input",{class:"pd-input",type:"text",value:e?.testData??"",placeholder:"表达式取不到值时预览显示",onChange:u=>r({testData:u.target.value})})):"",a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"旋转角度"}),p("rotate")]),a("input",{type:"range",class:"pd-range",min:-90,max:90,step:5,value:String(e?.rotate??_.WATERMARK_DEFAULTS.rotate),onChange:u=>r({rotate:Number(u.target.value)})}),a("span",{class:"pd-hint",text:`${e?.rotate??_.WATERMARK_DEFAULTS.rotate}°`})]),W("颜色",Se(e?.color||_.WATERMARK_DEFAULTS.color,u=>r({color:u}),"水印颜色"),void 0,p("color")),a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"透明度"}),p("opacity")]),a("input",{type:"range",class:"pd-range",min:.05,max:.5,step:.05,value:String(e?.opacity??_.WATERMARK_DEFAULTS.opacity),onChange:u=>r({opacity:Number(u.target.value)})}),a("span",{class:"pd-hint",text:(e?.opacity??_.WATERMARK_DEFAULTS.opacity).toFixed(2)})]),a("div",{class:"pd-field"},[a("span",{class:"pd-label",text:"密度"}),a("select",{class:"pd-select",style:{width:"100%"},onChange:u=>{const h=u.target.value,m=ri[h];m&&r({tileWidth:m.width,tileHeight:m.height})}},[...Object.entries(ri).map(([u,h])=>a("option",{value:u,text:`${h.label}(${h.width}×${h.height})`,selected:n===u})),a("option",{value:"custom",text:"自定义",selected:n==="custom"})])]),n==="custom"?a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"瓦片宽"}),p("tileWidth")]),a("input",{type:"number",class:"pd-input",min:_.WATERMARK_DEFAULTS.minTileWidth,step:10,value:String(e?.tileWidth??_.WATERMARK_DEFAULTS.tileWidth),onChange:u=>r({tileWidth:Number(u.target.value)})})]):"",n==="custom"?a("div",{class:"pd-field"},[a("span",{class:"pd-label"},[a("span",{class:"pd-label-t",text:"瓦片高"}),p("tileHeight")]),a("input",{type:"number",class:"pd-input",min:_.WATERMARK_DEFAULTS.minTileHeight,step:10,value:String(e?.tileHeight??_.WATERMARK_DEFAULTS.tileHeight),onChange:u=>r({tileHeight:Number(u.target.value)})})]):""].filter(Boolean))])}function ae(t,e,o,i,n={},r){return W(e,O({value:o,...n,onCommit:i}),void 0,r)}function je(t,e,o,i,n,r,s){const l=document.createElement("select");l.className="pd-select",l.addEventListener("change",()=>n(l.value));for(const p of i){const u=document.createElement("option");u.value=p.value,u.textContent=p.label,l.appendChild(u)}return l.value=o,i.some(p=>p.value===o)||(l.selectedIndex=-1),r?be(e,l,r,s):W(e,l,void 0,s)}function ct(t,e,o,i,n){return W(e,a("input",{type:"checkbox",class:"pd-switch",checked:o,onChange:r=>i(r.target.checked)}),void 0,n)}const zd=[{value:"all",label:"全部"},{value:"outer",label:"外侧"},{value:"inner",label:"内部"},{value:"none",label:"无"}],Od=[{value:"top",label:"上"},{value:"right",label:"右"},{value:"bottom",label:"下"},{value:"left",label:"左"}];function Nd(t,e){const o=t.store,i=e.options,n=e.printElementType.type,r=x=>o.updateElement(e.id,x),s=fr(n),l=s==="text",p=s==="code",u=s==="table",h=u&&o.tableSelection?.elementId===e.id,m=h&&c.resolveCellGroupMode(e.options.tableRows??[],o.tableSelection).mode==="multi",g=[];m||g.push(Td(t,e));const T=c.createDefaultOptions(n),b=(x,Z)=>{const le=c.propertyDefault(Z);return bt({target:i,base:T,propKey:x,tipValue:le?.value,tipUnit:le?.unit,write:()=>r({[x]:T[x]})})};h||g.push(we(t,"position-size","位置与尺寸","Location",[a("form",{class:"pd-form",onSubmit:x=>x.preventDefault()},[a("div",{class:"position-grid"},[M(t,"ps-left",ae(t,"X",i.left,x=>r({left:x}),{min:0})),M(t,"ps-top",ae(t,"Y",i.top,x=>r({top:x}),{min:0})),M(t,"ps-width",ae(t,"W",i.width,x=>r({width:x}),{min:4})),M(t,"ps-height",ae(t,"H",i.height,x=>r({height:x}),{min:4}))]),a("h3",{class:"pd-divider",text:"外边距 (mm)"}),a("div",{class:"margin-grid"},[M(t,"ps-margin-top",ae(t,"上",i.marginTop,x=>r({marginTop:x===0?void 0:x}),{},b("marginTop","ps-margin-top"))),M(t,"ps-margin-right",ae(t,"右",i.marginRight,x=>r({marginRight:x===0?void 0:x}),{},b("marginRight","ps-margin-right"))),M(t,"ps-margin-bottom",ae(t,"下",i.marginBottom,x=>r({marginBottom:x===0?void 0:x}),{},b("marginBottom","ps-margin-bottom"))),M(t,"ps-margin-left",ae(t,"左",i.marginLeft,x=>r({marginLeft:x===0?void 0:x}),{},b("marginLeft","ps-margin-left")))])])]));const k=typeof i.rotate=="number"&&Number.isFinite(i.rotate)&&i.rotate!==0?c.normalizeRotationAngle(i.rotate):void 0,y=x=>r({rotate:x===void 0||x===0?void 0:c.normalizeRotationAngle(x)}),C=c.isFreeAngleEditable(n,i),D=c.isRotationExcludedType(n)||c.collectFollowMemberIds(o.elements).has(e.id),P=D?"":M(t,"ap-rotate",be("旋转 (°)",a("div",{class:"pd-rotate-row"},[a("button",{type:"button",class:"pd-rotate-btn",title:"逆时针 90°","aria-label":"逆时针旋转 90 度",text:"↺",onClick:()=>y((k??0)-90)}),a("div",{class:"pd-rotate-stepper"},[O({value:k,min:0,max:359,placeholder:"0",disabled:!C,onCommit:x=>y(x)})]),a("button",{type:"button",class:"pd-rotate-btn",title:"顺时针 90°","aria-label":"顺时针旋转 90 度",text:"↻",onClick:()=>y((k??0)+90)})]),c.propertyTip("ap-rotate"),b("rotate","ap-rotate"))),A=D||C?"":a("p",{class:"pd-hint pd-rotate-note",text:c.CODE_OBLIQUE_NOTE});if(g.push(we(t,"appearance","外观","Brush",[a("form",{class:"pd-form",onSubmit:x=>x.preventDefault()},l?[M(t,"ap-font-family",W("字体",bo({id:"prop-font",state:t.state,fonts:t.host.fonts,value:typeof i.fontFamily=="string"?i.fontFamily:void 0,placeholder:"默认",onChange:x=>r({fontFamily:x})}),void 0,b("fontFamily","ap-font-family"))),M(t,"ap-font-size",ae(t,"字体大小",i.fontSize,x=>r({fontSize:x}),{min:8,max:72},b("fontSize","ap-font-size"))),M(t,"ap-font-weight",je(t,"字体粗细",String(i.fontWeight??""),[{value:"normal",label:"正常"},{value:"bold",label:"粗体"},{value:"bolder",label:"更粗"},{value:"lighter",label:"细体"}],x=>r({fontWeight:x}),void 0,b("fontWeight","ap-font-weight"))),M(t,"ap-align",W("对齐",rt("ta",[{value:"left",label:"左"},{value:"center",label:"中"},{value:"right",label:"右"},{value:"justify",label:"两端"}],i.textAlign||"left",x=>r({textAlign:x})),void 0,b("textAlign","ap-align"))),M(t,"ap-vertical-align",W("垂直对齐",rt("va",[{value:"top",label:"顶"},{value:"middle",label:"中"},{value:"bottom",label:"底"}],i.verticalAlign||"top",x=>r({verticalAlign:x})),void 0,b("verticalAlign","ap-vertical-align"))),a("div",{class:"color-row"},[M(t,"ap-color",W("颜色",Se(i.color,x=>r({color:x}),"字体颜色"),void 0,b("color","ap-color"))),M(t,"ap-bg-color",W("背景色",Se(i.backgroundColor,x=>r({backgroundColor:x}),"背景颜色"),void 0,b("backgroundColor","ap-bg-color")))]),M(t,"ap-line-height",ae(t,"行高",i.lineHeight,x=>r({lineHeight:x||void 0}),{min:0,max:100},b("lineHeight","ap-line-height"))),M(t,"ap-letter-spacing",ae(t,"字间距",i.letterSpacing,x=>r({letterSpacing:x||void 0}),{min:0,max:20,step:.5},b("letterSpacing","ap-letter-spacing"))),M(t,"ap-text-fit",je(t,"文字溢出",c.resolveElementTextFit(n,i),[{value:"clip",label:"截断"},{value:"shrink",label:"自动缩小"},{value:"autoHeight",label:"自适应行高"}],x=>r({textFit:x}),void 0,b("textFit","ap-text-fit"))),i.textFit==="shrink"?M(t,"ap-shrink-min",W("最小字号 (pt)",O({value:i.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6",onCommit:x=>r({shrinkMinFontSize:x||void 0})}),void 0,b("shrinkMinFontSize","ap-shrink-min"))):"",n==="longText"?M(t,"ap-long-text-indent",be("首行缩进 (字符)",O({value:i.longTextIndent,min:0,max:10,placeholder:"默认 0",onCommit:x=>r({longTextIndent:x||void 0})}),c.propertyTip("ap-long-text-indent"),b("longTextIndent","ap-long-text-indent"))):"",M(t,"ap-word-wrap",ct(t,"自动换行",i.wordWrap!==!1,x=>r({wordWrap:x?void 0:!1}),b("wordWrap","ap-word-wrap"))),M(t,"ap-keep-line-breaks",ct(t,"保留换行符",i.keepLineBreaks===!0,x=>r({keepLineBreaks:x?!0:void 0}),b("keepLineBreaks","ap-keep-line-breaks"))),P,A]:[n==="image"?M(t,"ap-img-fit",je(t,"缩放模式",String(i.fit??"contain"),c.IMAGE_FIT_OPTIONS,x=>r({fit:x}),c.propertyTip("ap-img-fit"),b("fit","ap-img-fit"))):"",n==="image"&&i.fit==="cover"?M(t,"ap-img-object-position",qr(t,{fieldKey:"ap-img-object-position",label:"裁剪锚点",src:c.resolveDesignImageSrc(i.src),widthMm:Number(i.width)||0,heightMm:Number(i.height)||0,fit:i.fit,scale:i.fitScale,value:i.objectPosition===void 0?void 0:String(i.objectPosition),onCommit:x=>r({objectPosition:x}),onScaleCommit:x=>r({fitScale:x}),resetAnchor:b("objectPosition","ap-img-object-position"),resetScale:b("fitScale","ap-img-fit-scale")})):"",P,A,n==="flowList"?a("p",{class:"pd-empty",text:"当前元素不支持外观设置"}):""].filter(Boolean))])),p){const x=n==="barcode",Z=String(i.barcodeType||"CODE128").toUpperCase(),le=i.printerDpi?String(i.printerDpi):"",De=c.barcodeBarWidthRecommendText(i.printerDpi,i.barWidth);g.push(we(t,"code","条码设置","Postcard",[a("form",{class:"pd-form",onSubmit:B=>B.preventDefault()},[x?[M(t,"cd-type",je(t,"码制",Z,[{value:"CODE128",label:"CODE128(通用)"},{value:"EAN13",label:"EAN13(商品码)"},{value:"EAN8",label:"EAN8"},{value:"UPC",label:"UPC"},{value:"CODE39",label:"CODE39"},{value:"ITF14",label:"ITF14"}],B=>r({barcodeType:B==="CODE128"?void 0:B}))),M(t,"cd-dpi",je(t,"打印机分辨率",le,[{value:"",label:"不指定(按条宽渲染)"},{value:"203",label:"203 dpi(8 点/mm)"},{value:"300",label:"300 dpi(11.8 点/mm)"},{value:"600",label:"600 dpi(23.6 点/mm)"}],B=>r({printerDpi:Number(B)>0?Number(B):void 0}),void 0,b("printerDpi","cd-dpi"))),M(t,"cd-dpi",a("p",{class:"pd-hint",text:"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小"})),M(t,"cd-bar-width",ae(t,"条宽(倍率)",i.barWidth??2,B=>r({barWidth:B}),{min:2,max:8,step:.5},b("barWidth","cd-bar-width"))),M(t,"cd-bar-width",a("p",{class:"pd-hint",text:(le?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),元素框放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定")+(De?`。${De}`:"")})),M(t,"cd-bar-quiet-zone",be("静区 (模块)",O({value:i.barQuietZone,min:0,max:20,placeholder:"默认 10",onCommit:B=>r({barQuietZone:B})}),c.propertyTip("cd-bar-quiet-zone"),b("barQuietZone","cd-bar-quiet-zone"))),M(t,"cd-bar-height",be("条高 (mm)",O({value:i.barHeight,min:1,max:100,placeholder:"默认 30 模块",onCommit:B=>r({barHeight:B??void 0})}),c.propertyTip("cd-bar-height"),b("barHeight","cd-bar-height"))),M(t,"cd-show-text",ct(t,"显示文本",i.hideTitle!==!0,B=>r({hideTitle:B?void 0:!0}),b("hideTitle","cd-show-text"))),M(t,"cd-font-size",W("文本字号(相对条高,条高为 30)",O({value:i.fontSize,min:5,max:24,placeholder:"默认 10",onCommit:B=>r({fontSize:B||void 0})}),void 0,b("fontSize","cd-font-size")))]:[M(t,"cd-ec-level",je(t,"纠错级别",String(i.qrCodeLevel??"M"),[{value:"L",label:"L(最低,容量大)"},{value:"M",label:"M(推荐)"},{value:"Q",label:"Q"},{value:"H",label:"H(最高)"}],B=>r({qrCodeLevel:B}),void 0,b("qrCodeLevel","cd-ec-level"))),M(t,"cd-quiet-zone",be("静区 (模块)",O({value:i.qrQuietZone,min:0,max:8,placeholder:"默认 0",onCommit:B=>r({qrQuietZone:B})}),c.propertyTip("cd-quiet-zone"),b("qrQuietZone","cd-quiet-zone")))],He("自定义设置"),x?a("p",{class:"pd-hint",text:"条码尺寸由「条宽」与「打印机分辨率」结算:宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限。要放大条码:先加条宽倍率,再收窄静区(左右白边会换成条宽),必要时关掉显示文本以让出文本区高度"}):"",x?"":M(t,"cd-fit",je(t,"缩放模式",String(i.fit||"contain"),c.IMAGE_FIT_OPTIONS,B=>r({fit:B||void 0}),void 0,b("fit","cd-fit"))),M(t,"cd-max-width",W("最大宽度 (mm)",O({value:i.maxWidth,min:1,max:200,placeholder:"默认",onCommit:B=>r({maxWidth:B||void 0})}),void 0,b("maxWidth","cd-max-width"))),M(t,"cd-max-height",W("最大高度 (mm)",O({value:i.maxHeight,min:1,max:200,placeholder:"默认",onCommit:B=>r({maxHeight:B||void 0})}),void 0,b("maxHeight","cd-max-height")))].flat().filter(Boolean))]))}if(h&&(g.push(_d(t,e)),g.push(Id(t,e))),u&&g.push(Rd(t,e)),n==="flowList"){const x=c.resolveFlowColumns(i.flowColumns),Z=c.resolveFlowRowHeight(i.flowRowHeight),le=c.resolveFlowGapX(i.flowGapX),De=c.resolveFlowMaxSpan(i.flowMaxSpan,x),B=c.suggestFlowColumns(i.width??0,le,i.fontSize??12),Ue=c.resolveFlowLayoutMode(i.flowLayoutMode),re=Ue==="dynamic",ye=c.resolveFlowPadding(i),Me=(G,Ze)=>{r({[G]:typeof Ze=="number"&&Number.isFinite(Ze)&&Ze>0?Ze:0})};g.push(we(t,"flowList","流式列表","Grid3x3",[a("form",{class:"pd-form",onSubmit:G=>G.preventDefault()},[M(t,"fl-layout-mode",je(t,"布局模式",Ue,[{value:"fixed",label:"固定高度"},{value:"dynamic",label:"动态分页"}],G=>r({flowLayoutMode:G==="dynamic"?"dynamic":"fixed"}),c.propertyTip("fl-layout-mode"))),...re?[M(t,"fl-padding-top",be("上内边距 (mm)",O({value:ye.top,min:0,max:100,step:.5,onCommit:G=>Me("flowPaddingTop",G)}),c.propertyTip("fl-padding-top"))),M(t,"fl-padding-right",be("右内边距 (mm)",O({value:ye.right,min:0,max:100,step:.5,onCommit:G=>Me("flowPaddingRight",G)}),c.propertyTip("fl-padding-right"))),M(t,"fl-padding-bottom",be("下内边距 (mm)",O({value:ye.bottom,min:0,max:100,step:.5,onCommit:G=>Me("flowPaddingBottom",G)}),c.propertyTip("fl-padding-bottom"))),M(t,"fl-padding-left",be("左内边距 (mm)",O({value:ye.left,min:0,max:100,step:.5,onCommit:G=>Me("flowPaddingLeft",G)}),c.propertyTip("fl-padding-left")))]:[],M(t,"fl-columns",be("每行列数",O({value:x,min:1,max:12,onCommit:G=>r({flowColumns:c.resolveFlowColumns(G),flowMaxSpan:c.resolveFlowMaxSpan(i.flowMaxSpan,c.resolveFlowColumns(G))})}),c.propertyTip("fl-columns"))),M(t,"fl-row-height",be("行高 (mm)",O({value:Z,min:3,max:100,step:.5,onCommit:G=>r({flowRowHeight:c.resolveFlowRowHeight(G)})}),c.propertyTip("fl-row-height"))),M(t,"fl-gap-x",be("单元横向间距 (mm)",O({value:le,min:0,max:50,step:.5,onCommit:G=>r({flowGapX:c.resolveFlowGapX(G)})}),c.propertyTip("fl-gap-x"))),M(t,"fl-auto-span",ct(t,"内容过长时跨列",i.flowAutoSpan===!0,G=>{r(G?{flowAutoSpan:G,flowMaxSpan:De}:{flowAutoSpan:G})})),i.flowAutoSpan===!0?M(t,"fl-max-span",be("最多跨几列",O({value:De,min:1,max:x,onCommit:G=>r({flowMaxSpan:c.resolveFlowMaxSpan(G,x)})}),c.propertyTip("fl-max-span"))):"",x>B?a("p",{class:"pd-hint",text:`按当前字号与框宽,${x} 列偏挤(可放约 ${B} 列)。数值保持不变,出纸按 ${x} 列排。`}):""].flat().filter(Boolean))]))}const L=()=>({borderWidth:i.borderWidth,borderStyle:i.borderStyle,borderColor:i.borderColor,borders:i.borders}),K=x=>{const Z=L();c.applyElementBorderPreset(Z,x,c.effectiveElementBorderSpec(Z)),r(Z)},N=x=>{const Z=L();c.setElementBorderEdgeVisible(Z,x,!c.elementBorderEdgeVisible(Z,x)),r(Z)},F=c.resolveElementBorderDisplay(i),z=F.style==="mixed",ee=typeof F.width=="number"?F.width:void 0,H=z||F.style===void 0?"":F.style,pe=typeof F.color=="string"?F.color:void 0,te=(x,Z)=>{const le=L();c.setElementBorderField(le,x,Z),r(le)},ke=z?[{value:"",label:"混合"},...c.BORDER_LINE_STYLES]:[...c.BORDER_LINE_STYLES];return g.push(we(t,"border-bg","边框与背景","Picture",[a("form",{class:"pd-form",onSubmit:x=>x.preventDefault()},[M(t,"bb-border-style",je(t,"线型",H,ke,x=>te("borderStyle",x))),a("div",{class:"border-row"},[M(t,"bb-border-width",ae(t,"边框宽度",ee,x=>te("borderWidth",x),{min:0,max:20,step:.25,placeholder:F.width==="mixed"?"混合":void 0},b("borderWidth","bb-border-width"))),M(t,"bb-border-color",W("边框颜色",Se(pe,x=>te("borderColor",x),"边框颜色"),void 0,b("borderColor","bb-border-color")))]),...c.acceptsElementBorder(n)?[a("div",{class:"pd-button-group border-presets"},zd.map(x=>a("button",{type:"button",class:"pd-button small",text:x.label,disabled:x.value==="inner",onClick:()=>K(x.value)}))),a("div",{class:"pd-checkbox-group"},Od.map(x=>a("label",{class:"pd-checkbox"},[a("input",{type:"checkbox",checked:c.elementBorderEdgeVisible(i,x.value),onChange:()=>N(x.value)}),a("span",{text:x.label})]))),a("p",{class:"pd-hint",text:c.ELEMENT_BORDER_APPLY_HINT})]:[],M(t,"bb-bg-color",W("背景色",Se(i.backgroundColor,x=>r({backgroundColor:x}),"背景颜色"),void 0,b("backgroundColor","bb-bg-color")))])])),g.push(Pd(t,e)),g.push(we(t,"advanced","高级设置","Setting",[a("form",{class:"pd-form",onSubmit:x=>x.preventDefault()},[a("div",{class:"advanced-row"},[M(t,"ad-locked",ct(t,"锁定",!!i.locked,x=>r({locked:x}),b("locked","ad-locked"))),M(t,"ad-fixed",ct(t,"每页重复",!!i.repeatOnEveryPage,x=>r({repeatOnEveryPage:x}),b("repeatOnEveryPage","ad-fixed"))),M(t,"ad-fixed-position",ct(t,"每页固定",!!i.fixed,x=>r({fixed:x}),b("fixed","ad-fixed-position")))]),M(t,"ad-z-index",ae(t,"层级",i.zIndex,x=>r({zIndex:x}),{min:0,max:999},b("zIndex","ad-z-index"))),M(t,"ad-delete",a("div",{class:"pd-field"},[a("button",{type:"button",class:"pd-button danger",text:"删除元素",onClick:()=>o.deleteSelected()})]))])],!1,[a("button",{type:"button",class:"group-help",title:"高级设置说明","aria-label":"高级设置说明",text:"?",onClick:x=>{x.stopPropagation(),t.fire("help","advanced-settings")}})])),a("div",{class:"property-content"},g)}function $d(t){const e=t.store,o=e.templateData,i=p=>e.updateTemplateData(p),n=p=>{const u=o.tiling,h=m=>m===90||m===270;if(u?.enabled&&h(p)!==h(o.outputRotation)){const m=_.computeMaxColumns({...o,outputRotation:p});i({outputRotation:p,tiling:{...u,columns:Math.max(m,1)}});return}i({outputRotation:p})},r=[];for(const[p,u]of Object.entries(c.PAPER_PRESETS)){const h=u.group??"其他";let m=r.find(g=>g.group===h);m||(m={group:h,items:[]},r.push(m)),m.items.push({key:p,label:u.label??p})}const s=!c.PAPER_PRESETS[o.paperSize],l=c.isContinuousPaperSize(o.paperSize);return a("form",{class:"pd-form",onSubmit:p=>p.preventDefault()},[He("纸张设置"),W("纸张尺寸",a("select",{class:"pd-select",style:{width:"100%"},onChange:p=>i({paperSize:p.target.value})},[...r.map(p=>a("optgroup",{label:p.group},p.items.map(u=>a("option",{value:u.key,text:u.label,selected:o.paperSize===u.key})))),a("option",{value:"CUSTOM",text:"自定义宽高",selected:s})])),l||s?W(l?"纸宽 (mm)":"自定义宽高 (mm)",a("div",{class:"custom-size-grid"},[O({value:Number(o.customWidth??0),min:25,max:2e3,onCommit:p=>i({customWidth:p})}),...s?[a("span",{class:"custom-size-x",text:"×"}),O({value:Number(o.customHeight??0),min:25,max:2e3,onCommit:p=>i({customHeight:p})})]:[]])):"",l?"":W("纸张方向",rt("ori",[{value:"portrait",label:"纵向"},{value:"landscape",label:"横向"}],o.orientation==="landscape"?"landscape":"portrait",p=>i({orientation:p})),"切换即交换纸张长宽(设计稿内容随之铺在该尺寸上)"),l?"":W("内容旋转角度",rt("rot",[{value:"0",label:"0°"},{value:"90",label:"90°"},{value:"180",label:"180°"},{value:"270",label:"270°"}],String(o.outputRotation??0),p=>n(Number(p)),!0),o.tiling?.enabled?"拼版时每个标签的内容按该角度旋转;90°/270° 时每格占位宽高互换,列数自动铺满新档位上限,行数按互换后重算;0° 为不旋转(默认)":"整页内容旋转对应角度出纸;90°/270° 时纸张长宽互换以贴合内容,内容不变形不裁切;0° 为不旋转(默认)"),W("页面背景色",a("div",{class:"page-bg-row"},[Se(o.pageBackground,p=>i({pageBackground:p}),"页面背景色","page-bg-picker")]),void 0,bt({target:o,base:{pageBackground:void 0},propKey:"pageBackground",write:()=>i({pageBackground:void 0})})),cd(t),e.pages.length>1?"":pd(t),He("页边距 (mm)"),a("div",{class:"margin-grid"},[ae(t,"上",o.margins.top,p=>i({margins:{...o.margins,top:p}}),{min:0,max:50}),ae(t,"下",o.margins.bottom,p=>i({margins:{...o.margins,bottom:p}}),{min:0,max:100}),ae(t,"左",o.margins.left,p=>i({margins:{...o.margins,left:p}}),{min:0,max:50}),ae(t,"右",o.margins.right,p=>i({margins:{...o.margins,right:p}}),{min:0,max:50})]),He("页眉/页脚高度 (mm)"),ae(t,"页眉高度",o.header.height??10,p=>i({header:{...o.header,height:p}}),{min:0,max:100,step:.1}),ae(t,"页脚高度",o.footer.height??10,p=>i({footer:{...o.footer,height:p}}),{min:0,max:100,step:.1}),Ld(t)].filter(Boolean))}function Bd(t,e,o){const i=(t.state.propSearch??"").trim(),n=!i||c.matchKeywords(i,[...o.searchKeywords,o.label]),r=document.createElement("div");if(r.className="property-content",n)try{Mr(`property:${e.id}`,o.ui.renderProperty({element:e,data:t.host.designData?.length?t.host.designData:[c.DEFAULT_DEMO_DATA],fields:t.host.fields??[],update:s=>t.store.updateElement(e.id,s),repaint:()=>t.repaint()}),r)}catch{}return a("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:custom"},style:t.state.propTab==="custom"?"":{display:"none"}},[r])}function Hd(t){const e=t.store,o=t.state,i=e.selectedElement,n=i?ui(i):void 0;if(o.propCollapsed)return a("div",{class:"property-panel collapsed"},[a("div",{class:"prop-collapsed"},[a("button",{type:"button",class:"pc-btn",title:"展开属性台",text:"«",onClick:()=>{o.propCollapsed=!1,t.repaint()}}),...n?[a("button",{type:"button",class:`pc-btn${o.propTab==="custom"?" on":""}`,title:n.label,html:ce(n.icon,14)||ce("Shapes",14),onClick:()=>{o.propTab="custom",o.propCollapsed=!1,t.repaint()}})]:[],...[["element","元素属性","▦"],["page","页面属性","▤"]].map(([s,l,p])=>a("button",{type:"button",class:`pc-btn${o.propTab===s?" on":""}`,title:l,text:p,onClick:()=>{o.propTab=s,o.propCollapsed=!1,t.repaint()}}))])]);const r=i?o.propTab==="custom"&&!n?"element":o.propTab:"page";return a("div",{class:"property-panel"},[a("div",{class:"prop-head"},[a("span",{class:"prop-title",text:"属性台"}),a("button",{type:"button",class:"collapse-btn",title:"收起属性台",text:"»",onClick:()=>{o.propCollapsed=!0,t.repaint()}})]),a("div",{class:"pd-tabs prop-tabs"},[a("div",{class:"pd-tab-bar",role:"tablist"},[...n?[a("button",{type:"button",class:`pd-tab${r==="custom"?" active":""}`,text:n.label,onClick:()=>{o.propTab="custom",t.repaint()}})]:[],a("button",{type:"button",class:`pd-tab${r==="element"?" active":""}`,text:"元素属性",onClick:()=>{o.propTab="element",t.repaint()}}),a("button",{type:"button",class:`pd-tab${r==="page"?" active":""}`,text:"页面属性",onClick:()=>{o.propTab="page",t.repaint()}})]),n&&i?Bd(t,i,n):"",a("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:element"},style:r==="element"?"":{display:"none"}},i?[bd(t),Nd(t,i)]:[a("p",{class:"pd-empty",text:"请在画布中选择一个元素"})]),a("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:page"},style:r==="page"?"":{display:"none"}},[$d(t)])].filter(Boolean))])}const ai=[{key:"field",text:"📁 字段"},{key:"variable",text:"🔧 变量"},{key:"function",text:"⚡ 函数"}],Kn={field:"搜索字段...",variable:"搜索变量...",function:"搜索函数..."},Ud=[{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()"}],Wd=[{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()"}],Gd=[{name:"MONEY",label:"金额格式化",template:"MONEY()"},{name:"DATE",label:"日期格式化",template:"DATE()"},{name:"UPPER",label:"大写金额",template:"UPPER()"},{name:"IF",label:"条件判断",template:"IF()"}],qd=[{name:"pageIndex",label:"当前页码",template:"{pageIndex}"},{name:"totalPages",label:"总页数",template:"{totalPages}"},{name:"printDate",label:"打印日期",template:"{printDate}"},{name:"printTime",label:"打印时间",template:"{printTime}"}],Kd=[{title:"聚合函数",items:Ud},{title:"数值运算",items:Wd},{title:"格式化函数",items:Gd}],Vd="(输入表达式后预览)",jd="(无法计算)",wi="(表达式错误)";function Vn(t,e){if(!t.trim())return Vd;try{const o={...c.DEFAULT_DEMO_DATA,...e??{},..._.resolveSystemVariables()},i=c.evaluateTemplate(t,o);return i==null?jd:String(i)}catch{return wi}}function jn(t,e){const o=e.trim().toLowerCase();return o?t.filter(i=>i.label.toLowerCase().includes(o)||i.name.toLowerCase().includes(o)):t}function Yd(t,e){const o=t.substring(0,e),i=o.lastIndexOf("{"),n=i!==-1&&!o.slice(i+1).includes("}"),r=o.lastIndexOf("("),s=r!==-1&&!o.slice(r+1).includes(")");return{insideBlock:n,insideParens:s}}const Xd=t=>/[\u4e00-\u9fff]/.test(t),Zd=t=>`字段「${t}」含中文,请用 {${t}} 引用(函数参数内写 ${t});中文可直接在 {} 中使用,无需 data['...'] 方括号`;function Qd(t,e){const o=/^\{\s*([^{}]+?)\s*\}$/.exec(t.trim());if(!o)return null;const i=o[1]??"";return e.find(n=>n.fieldKey===i)??null}function si(t,e){return a("div",{class:"ee-field-info"},[a("span",{class:"ee-item-label",text:t}),a("span",{class:"ee-item-key",text:e})])}function Be(t){return t.currentTarget.getRootNode()}function io(t,e,o){const i=[];return o.forEach((n,r)=>{i.push(n),r<o.length-1&&i.push(a("br"))}),a("div",{class:`ee-help-card ${t}`},[a("div",{class:"ee-help-card-title",text:e}),a("div",{class:"ee-help-card-content"},i)])}function Jd(){return a("div",{class:"ee-help-section"},[a("div",{class:"ee-help-title",text:"帮助信息"}),a("div",{class:"ee-help-grid"},[io("ee-help-field","输入方式",["双击左侧字段、变量、函数即可插入到表达式输入框中","双击途中按住 Ctrl(Mac 为 ⌘)切换为插入字段名称,当静态文本用","静态数据直接输入即可,如:供应商名称","动态解析字段、变量、函数必须用 {} 包裹","示例:{SUM(supplier.name)}","中文 key 直接写 {字段名},如 {姓名}、{supplier.名称}","注意:只能嵌套一层"]),io("ee-help-function","函数使用",["SUM(字段) - 求和","AVG(字段) - 平均值","COUNT(字段) - 计数","IF(条件, 真值, 假值) - 条件判断","四则运算:{qty * price}、{ADD(qty, 1)}","修约:ROUND 四舍五入 / ROUNDUP 进一 / ROUNDDOWN 去尾 / ROUNDBANK 四舍六入五成双"]),io("ee-help-variable","系统变量",["{pageIndex} - 当前页码","{totalPages} - 总页数","{printDate} - 打印日期"]),io("ee-help-conditional","示例",["静态文本:供应商名称","动态字段:{supplier.name}","函数调用:{SUM(amount)}",'条件判断:{IF(amount>1000, "大单", "小单")}',"运算并修约:{ROUND(qty * price, 2)}"])])])}function ec(t,e){const o={activeTab:"field",searchText:"",expression:e.value||"",binding:e.binding,copiedFieldKey:"",keyHint:""},i=(y,C)=>y.querySelector(C),n=y=>{const C=i(y,".ee-preview");if(!C)return;const D=Vn(o.expression,t.demoData);C.textContent=D,C.classList.toggle("ee-preview-error",D===wi)},r=y=>{const C=i(y,".ee-key-hint");C&&(C.textContent=o.keyHint,C.style.display=o.keyHint?"":"none")},s=()=>{if(o.activeTab==="variable")return jn(qd,o.searchText).map(D=>a("div",{class:"ee-list-item",onDblclick:P=>{const{insideParens:A}=u(P);h(Be(P),A?D.template.replace(/^\{|\}$/g,""):D.template,void 0,"")}},[si(D.label,D.template)]));if(o.activeTab==="function")return Kd.map(D=>a("div",{class:"ee-func-group"},[a("div",{class:"ee-func-group-title",text:D.title}),...jn(D.items,o.searchText).map(P=>a("div",{class:"ee-list-item",onDblclick:A=>{const{insideBlock:L}=u(A),K=L?P.template:`{${P.template}}`;h(Be(A),K,K.indexOf("(")+1,"")}},[si(P.label,`${P.name}()`)]))]));const y=c.filterGroups(c.groupFields(t.fields??[]),o.searchText);if(!y.length)return[a("p",{class:"pd-empty",text:"暂无字段"})];const C=[];for(const D of y){D.key&&C.push(a("div",{class:`ee-field-group${D.isList?" is-list":""}`},[a("span",{class:"ee-field-group-icon",text:D.isList?"📋":"📁"}),a("span",{text:D.label})]));for(const P of D.fields)C.push(a("div",{class:"ee-list-item ee-field-item",style:{paddingLeft:D.key?"22px":"10px"},onDblclick:A=>{const{insideParens:L}=u(A),K=A;if(K.ctrlKey||K.metaKey){const N=P.fieldLabel||P.fieldKey;h(Be(A),L?`"${N}"`:N,void 0,"");return}h(Be(A),L?P.fieldKey:`{${P.fieldKey}}`,void 0,Xd(P.fieldKey)?Zd(P.fieldKey):"")}},[si(P.fieldLabel,P.fieldKey),a("button",{type:"button",class:`ee-copy-btn${o.copiedFieldKey===P.fieldKey?" is-copied":""}`,"data-tip":o.copiedFieldKey===P.fieldKey?"已复制":`复制字段名「${P.fieldLabel}」`,"aria-label":`复制字段名 ${P.fieldLabel}`,html:ce(o.copiedFieldKey===P.fieldKey?"Check":"Copy",13),onClick:A=>{A.stopPropagation(),p(A,P)},onDblclick:A=>A.stopPropagation()})]))}return C},l=y=>{Array.from(y.querySelectorAll(".ee-nav-tab")).forEach((L,K)=>L.classList.toggle("active",ai[K]?.key===o.activeTab));const D=i(y,".ee-content-search .pd-input");if(D){const L=Kn[o.activeTab];D.placeholder!==L&&(D.placeholder=L),D.value!==o.searchText&&(D.value=o.searchText)}const P=i(y,".ee-textarea");P&&P.value!==o.expression&&(P.value=o.expression);const A=i(y,".ee-content-list");if(A){ar(A);for(const L of s())ve(L,A)}n(y),r(y)};function p(y,C){const D=Be(y);c.copyTextToClipboard(C.fieldLabel||C.fieldKey).then(P=>{P&&(o.copiedFieldKey=C.fieldKey,l(D),setTimeout(()=>{o.copiedFieldKey===C.fieldKey&&(o.copiedFieldKey="",l(D))},1200))})}const u=y=>{const D=i(Be(y),".ee-textarea")?.selectionStart??o.expression.length;return Yd(o.expression,D)},h=(y,C,D=C.length,P)=>{P!==void 0&&(o.keyHint=P);const A=i(y,".ee-textarea");if(!A){o.expression+=C,n(y),r(y);return}const L=A.selectionStart??o.expression.length,K=A.selectionEnd??L;o.expression=o.expression.substring(0,L)+C+o.expression.substring(K);const N=L+D;A.value=o.expression,A.focus(),A.selectionStart=A.selectionEnd=N,n(y),r(y)},m=()=>{const y=o.expression;if(o.binding===void 0){t.onApply({formatter:y}),t.onClose();return}const C=Qd(y,t.fields??[]);t.onApply(C?{formatter:y,binding:C.fieldKey,title:C.fieldLabel}:{formatter:y}),t.onClose()},g=a("div",{class:"ee-nav"},[a("div",{class:"ee-nav-title",text:"类型"}),a("div",{class:"ee-nav-tabs"},ai.map((y,C)=>a("div",{class:`ee-nav-tab${o.activeTab===y.key?" active":""}`,text:y.text,onClick:D=>{o.activeTab=ai[C].key,l(Be(D))}})))]),T=a("div",{class:"ee-content"},[a("div",{class:"ee-content-search"},[a("input",{class:"pd-input",placeholder:Kn[o.activeTab],onInput:y=>{o.searchText=y.target.value,l(Be(y))}})]),a("div",{class:"ee-content-list"},s())]),b=Vn(o.expression,t.demoData),k=a("div",{class:"ee-editor"},[a("div",{class:"ee-editor-section"},[a("div",{class:"ee-editor-title",text:"表达式编辑"}),a("textarea",{class:"ee-textarea",rows:6,placeholder:"双击左侧字段/变量/函数插入,双击途中按住 Ctrl(Mac 为 ⌘)切换为插入字段名,或直接输入静态内容",text:o.expression,onInput:y=>{o.expression=y.target.value,o.keyHint="",n(Be(y)),r(Be(y))}}),a("div",{class:"pd-hint ee-key-hint",style:{display:"none",color:"var(--pd-accent, #165DFF)"},text:""})]),a("div",{class:"ee-editor-section"},[a("div",{class:"ee-editor-title",text:"预览结果"}),a("div",{class:`ee-preview${b===wi?" ee-preview-error":""}`,text:b})]),Jd()]);return a("div",{class:"pd-dialog-overlay",onKeydown:y=>{y.key==="Escape"&&t.onClose()}},[a("section",{class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},[a("header",{class:"pd-dialog-header"},[a("strong",{id:"expression-editor-title",text:"编辑表达式"}),a("button",{type:"button",class:"pd-close","aria-label":"关闭",text:"×",onClick:()=>t.onClose()})]),a("div",{class:"expression-editor"},[g,T,k]),a("footer",{class:"pd-dialog-footer"},[a("button",{type:"button",class:"pd-button",text:"取消",onClick:()=>t.onClose()}),a("button",{type:"button",class:"pd-button primary",text:"确定",onClick:()=>m()})])])])}const tc={id:"getting-started",title:"快速入门",content:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@worm-print-platform/core/designer"),R=require("@worm-print-platform/core"),Dr=require("@worm-print-platform/core/browser"),gr=require("@worm-print-platform/plugin-kit"),we=require("@worm-print-platform/core/i18n"),pn=require("jsbarcode");function l(e,t={},o=[]){return{tag:e,props:t,children:o}}var Pr="http://www.w3.org/2000/svg",Pa=new Set(["draggable","contenteditable","spellcheck"]),Aa=new Set(["indeterminate"]);function Ma(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="g"}function _a(e){return e instanceof Element&&e.namespaceURI===Pr}function Se(e,t){if(typeof e=="string"){const s=document.createTextNode(e);return t.appendChild(s),s}if(e instanceof Node)return t.appendChild(e),e;const{tag:o,props:r,children:i}=e,n=Ma(o)||_a(t)?document.createElementNS(Pr,o):document.createElement(o);for(const[s,d]of Object.entries(r))if(!(d==null||d===!1))if(s==="class")n.setAttribute("class",String(d));else if(s==="style")typeof d=="string"?n.style.cssText=d:Object.assign(n.style,d);else if(s==="html")n.innerHTML=String(d);else if(s==="text")n.textContent=String(d);else if(s.startsWith("on")&&typeof d=="function")n.addEventListener(s.slice(2).toLowerCase(),d);else if(s==="dataset")for(const[c,u]of Object.entries(d))n.dataset[c]=u;else Aa.has(s)?n[s]=!0:typeof d=="boolean"?d&&n.setAttribute(s,Pa.has(s)?"true":""):n.setAttribute(s,String(d));for(const s of i)Se(s,n);return t.appendChild(n),n}function cn(e){for(;e.firstChild;)e.removeChild(e.firstChild)}var Ra=Pr;function Vt(){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:{}}}const Fa="开启拼版后只能有一个设计页面",fi=()=>we.t("store.tilingSinglePage");function Ar(e){const t=(o,r)=>(o??[]).map(i=>{const n={...i.options};return(i.printElementType?.type??i.type)==="table"&&h.syncTableElementSize(n),{id:i.id||h.generateId(),zone:r,options:n,printElementType:{...i.printElementType}}});return{...e,margins:{...e.margins},header:{height:e.header?.height??10,elements:[]},footer:{height:e.footer?.height??10,elements:[]},guides:[...e.guides??[]],elements:[...t(e.elements??[],"content"),...t(e.header?.elements??[],"header"),...t(e.footer?.elements??[],"footer")]}}function hn(e){const t=e.elements,o=r=>t.filter(i=>(i.zone||"content")===r).map(i=>({id:i.id,type:i.printElementType.type,options:{...i.options},printElementType:{...i.printElementType}}));return{unit:"mm",...e,header:{...e.header,elements:o("header")},footer:{...e.footer,elements:o("footer")},elements:o("content"),guides:[...e.guides??[]]}}function gi(e){const t=(r,i)=>{const n=Ar(h.normalizeTemplateUnits(r));return n.name||(n.name=`页面 ${i+1}`),n};if(!e)return[t(Vt(),0)];const o=Array.isArray(e.pages)?e.pages:[e];return o.length?o.map(t):[t(Vt(),0)]}const At=e=>JSON.parse(JSON.stringify(e));class un{scale=100;showRuler=!0;showGrid=!0;snapToGrid=!1;showTableGhostBorder=!0;dirty=!1;pages;activePageIndex=0;fields;selectedIds=new Set;previewIds=new Set;tableSelection=null;draggingIds=new Set;adsorbGuides=[];live=new Map;clipboard=[];moveSessionActive=!1;moveTimer=null;dragBefore=null;undoStack=[];redoStack=[];listeners=new Set;align=h.useAlign();group=h.useGroup();constructor(t={}){if(this.pages=gi(t.initialTemplate),this.fields=t.initialFields??[],t.initialElements?.length){const o=this.pages[0];o.elements=[...o.elements,...t.initialElements]}}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}emit(t=!0){t&&(this.dirty=!0);for(const o of[...this.listeners])o()}get templateData(){return this.pages[this.activePageIndex]}set templateData(t){this.pages[this.activePageIndex]=t}get elements(){return this.templateData.elements.map(t=>this.live.get(t.id)??t)}get tilingEnabled(){return this.pages.some(t=>t.tiling?.enabled===!0)}switchPage(t){t<0||t>=this.pages.length||(this.activePageIndex=t,this.resetSelection(),this.emit(!1))}addPage(){if(this.tilingEnabled){window.alert(fi());return}this.recordHistory();const t=this.pages[this.activePageIndex]??Vt();this.pages.push(Ar({...Vt(),paperSize:t.paperSize,orientation:t.orientation,outputRotation:t.outputRotation,customWidth:t.customWidth,customHeight:t.customHeight,name:this.nextDefaultPageName()})),this.switchPage(this.pages.length-1),this.emit()}nextDefaultPageName(){const t=new Set(this.pages.map(r=>r.name));let o=this.pages.length+1;for(;t.has(`页面 ${o}`);)o++;return`页面 ${o}`}duplicatePage(t){if(this.tilingEnabled){window.alert(fi());return}this.recordHistory();const o=At(this.pages[t]);o.name=`${o.name??`页面 ${t+1}`} 副本`,o.elements=o.elements.map(r=>({...r,id:h.generateId()})),this.pages.splice(t+1,0,o),this.switchPage(t+1),this.emit()}deletePage(t){this.pages.length<=1||(this.recordHistory(),this.pages.splice(t,1),this.activePageIndex=Math.max(0,Math.min(this.activePageIndex,this.pages.length-1)),this.resetSelection(),this.emit())}renamePage(t,o){this.recordHistory(),this.pages[t].name=o,this.emit()}movePage(t,o){if(o<0||o>=this.pages.length||t===o)return;this.recordHistory();const[r]=this.pages.splice(t,1);this.pages.splice(o,0,r),this.activePageIndex=o,this.emit()}onSelectionChanged;setSelection(t){this.selectedIds=t,this.onSelectionChanged?.(),this.emit(!1)}select(t){this.setSelection(new Set(t))}selectOne(t,o=!1){if(o){const r=new Set(this.selectedIds);r.has(t)?r.delete(t):r.add(t),this.setSelection(r)}else this.setSelection(new Set([t]))}clearSelection(){this.setSelection(new Set)}selectElement(t,o=!1){if(o){this.selectOne(t,!0);return}this.setSelection(new Set(this.group.getGroupedIds(this.elements,t)))}selectAll(){this.setSelection(new Set(this.elements.map(t=>t.id)))}get selectedElements(){return this.elements.filter(t=>this.selectedIds.has(t.id))}get selectedElement(){const t=this.selectedIds.values().next().value;return t?this.elements.find(o=>o.id===t)??null:null}resetSelection(){this.selectedIds=new Set,this.tableSelection=null,this.onSelectionChanged?.()}setTableSelection(t){this.tableSelection=t,this.emit(!1)}setPreview(t){this.previewIds=t,this.emit(!1)}commitPreview(){this.previewIds=new Set,this.emit(!1)}addGuide(t,o){const r=this.templateData.guides??[];this.templateData.guides=[...r,{id:h.generateId(),type:t,position:Math.round(o*10)/10}],this.emit()}moveGuide(t,o){const r=this.templateData.guides??[];this.templateData.guides=r.map(i=>i.id===t?{...i,position:Math.round(o*10)/10}:i),this.emit(!1)}removeGuide(t){this.templateData.guides=(this.templateData.guides??[]).filter(o=>o.id!==t),this.emit()}addElement(t,o={},r){const i=h.createRuntimeElement(t,o);return r&&!this.placeAtDropPoint(i,r)||(this.recordHistory(),this.templateData.elements.push(i),this.select(new Set([i.id])),this.emit()),i}addFieldElement(t,o={},r,i=!1){const n=i?h.createFieldLabelElement(t):h.createFieldElement(t);return Object.assign(n.options,o),r&&!this.placeAtDropPoint(n,r)||(this.recordHistory(),this.templateData.elements.push(n),this.select(new Set([n.id])),this.emit()),n}placeAtDropPoint(t,o){const r=this.templateData,i=h.zoneFromPaperPoint(r,o.x,o.y);if(i!=="content"&&!h.isZoneAllowedType(t.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const n=h.getZoneRects(r)[i];return t.zone=i,t.options.left=o.x-n.left,t.options.top=o.y-n.top,i!=="content"&&h.clampToZone(t,n),!0}deleteSelected(){this.selectedIds.size&&(this.recordHistory(),this.templateData.elements=this.templateData.elements.filter(t=>!this.selectedIds.has(t.id)),this.selectedIds=new Set,this.emit())}livePatch(t,o){const r=this.templateData.elements.find(n=>n.id===t);if(!r)return;const i=this.live.get(t)??r;this.live.set(t,{...i,options:{...i.options,...o}})}commitLive(){if(!this.live.size)return;this.recordHistory();const t=this.templateData.elements;for(const[o,r]of this.live){const i=t.find(n=>n.id===o);i&&Object.assign(i.options,r.options)}this.live.clear(),this.emit()}dragIds(t){const o=this.templateData.elements.find(r=>r.id===t);return!o||o.options.locked?[]:Array.from(this.group.getGroupedIds(this.elements,t))}discardLive(){this.live.clear()}dragStart(){this.dragBefore=new Map(this.elements.map(t=>[t.id,this.geoSig(t)]))}dragStop(){const t=this.dragBefore;if(!t)return;this.dragBefore=null;let o=!1;for(const r of this.elements){const i=t.get(r.id);!i||i===this.geoSig(r)||h.finalizeElementZone(r,this.templateData).rejected&&(o=!0)}o&&alert("该元素类型不能放入页眉/页脚"),this.emit()}geoSig(t){return`${t.zone||"content"}:${t.options.left},${t.options.top},${t.options.width},${t.options.height}`}updateElement(t,o,r=!0){r&&this.recordHistory();const i=this.templateData.elements.find(n=>n.id===t);i&&(Object.assign(i.options,o),i.printElementType.type==="table"&&h.syncTableElementSize(i.options),this.emit())}updateTemplateData(t){this.recordHistory(),Object.assign(this.templateData,t);for(const o of["paperSize","customWidth","customHeight"])if(o in t)for(const r of this.pages)Object.assign(r,{[o]:t[o]});this.emit()}moveLayer(t){if(!this.selectedIds.size)return;this.recordHistory();const o=this.templateData.elements,r=o.filter(n=>this.selectedIds.has(n.id)),i=o.filter(n=>!this.selectedIds.has(n.id));if(t==="top")this.templateData.elements=[...i,...r];else if(t==="bottom")this.templateData.elements=[...r,...i];else{const n=o.findIndex(c=>this.selectedIds.has(c.id)),s=t==="up"?n+1:n-1;if(s<0||s>=o.length)return;const d=[...o];[d[n],d[s]]=[d[s],d[n]],this.templateData.elements=d}this.emit()}alignSelected(t){this.selectedIds.size<2||(this.recordHistory(),this.align.align(this.elements.filter(o=>this.selectedIds.has(o.id)),t),this.emit())}groupSelected(){this.selectedIds.size<2||(this.recordHistory(),this.templateData.elements=this.group.group(this.elements,this.selectedIds),this.emit())}ungroupSelected(){this.selectedIds.size&&(this.recordHistory(),this.templateData.elements=this.group.ungroup(this.elements,this.selectedIds),this.emit())}copy(){this.clipboard=At(this.selectedElements),this.emit(!1)}cutSelected(){this.copy(),this.deleteSelected()}paste(t=10){if(!this.clipboard.length)return;this.recordHistory();const o=new Map;for(const n of this.clipboard){const s=n.options.groupId;s&&o.set(s,(o.get(s)??0)+1)}const r=new Map;for(const[n,s]of o)r.set(n,s>=2?h.generateGroupId():void 0);const i=this.templateData.elements;for(const n of this.clipboard){const s=At(n);s.id=h.generateId(),s.options.left+=t,s.options.top+=t,s.options.groupId=s.options.groupId?r.get(s.options.groupId):void 0,i.push(s)}this.emit()}duplicateSelected(){if(this.copy(),!this.clipboard.length)return;this.paste(15);const t=this.templateData.elements;this.selectOne(t[t.length-this.clipboard.length].id)}get hasClipboard(){return this.clipboard.length>0}moveSelected(t,o){const r=this.selectedElements.filter(i=>!i.options.locked);if(r.length){this.moveSessionActive||(this.moveSessionActive=!0,this.recordHistory());for(const i of r)i.options.left+=t,i.options.top+=o;this.moveTimer&&clearTimeout(this.moveTimer),this.moveTimer=setTimeout(()=>{this.moveSessionActive=!1,this.moveTimer=null},300),this.emit()}}cloneElement(t){this.recordHistory(),this.templateData.elements.push(t),this.selectedIds=new Set([t.id]),this.emit()}recordHistory(){this.undoStack.push({pages:At(this.pages),activePageIndex:this.activePageIndex}),this.undoStack.length>100&&this.undoStack.shift(),this.redoStack=[]}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}undo(){const t=this.undoStack.pop();t&&(this.redoStack.push({pages:At(this.pages),activePageIndex:this.activePageIndex}),this.pages=t.pages,this.activePageIndex=Math.min(t.activePageIndex,t.pages.length-1),this.resetSelection(),this.emit())}redo(){const t=this.redoStack.pop();t&&(this.undoStack.push({pages:At(this.pages),activePageIndex:this.activePageIndex}),this.pages=t.pages,this.activePageIndex=Math.min(t.activePageIndex,t.pages.length-1),this.resetSelection(),this.emit())}resetZoom(){this.setScale(100)}setScale(t,o=h.MIN_SCALE_PERCENT){this.scale=Math.max(o,Math.round(t)),this.emit(!1)}getTemplateJson(){const t=this.pages.map(hn),o=t.length===1?t[0]:{version:1,pages:t};return JSON.stringify(o)}loadTemplate(t){this.pages=gi(t),this.activePageIndex=0,this.resetSelection(),this.recordHistory(),this.emit()}get paperSize(){return h.getPaperDimensions(this.templateData)}}const yt=Symbol("mixed"),Xo=new Set(["text","longText"]),Ia=["top","right","bottom","left"],La={on:!0,off:!1,mixed:yt};function mi(e){const t=h.resolveBorderEdgeStates(e),o={};for(const r of Ia)o[r]=La[t[r]];return o}const za=["fontFamily","fontSize","fontWeight","color","textAlign","verticalAlign","textDecoration"];class Oa{constructor(t){this.store=t}store;borderStyle="solid";borderWidth=.75;borderColor="#333333";borderMixed={style:!1,width:!1,color:!1};borderDraftKey="";get borderMixedAny(){return this.borderMixed.style||this.borderMixed.width||this.borderMixed.color}painterActive=!1;painterLocked=!1;painterSource=null;painterSnapshot=null;get selectedElements(){return this.store.elements.filter(t=>this.store.selectedIds.has(t.id)&&!t.options.locked)}get tableElement(){const t=this.store.tableSelection;return t?this.store.elements.find(o=>o.id===t.elementId)??null:null}get context(){return this.store.tableSelection&&this.tableElement?"cells":this.selectedElements.length>0||this.store.selectedIds.size>0?"elements":"none"}get targetCells(){const t=this.store.tableSelection,o=this.tableElement?.options.tableRows;if(!t||!o)return[];const r=[];for(let i=t.r1;i<=t.r2;i++)for(let n=t.c1;n<=t.c2;n++){const s=o[i]?.cells[n];s&&!s.merged&&r.push(s)}return r}get textTargets(){return this.selectedElements.filter(t=>Xo.has(t.printElementType.type))}get fontEditable(){return this.context==="cells"?this.targetCells.length>0:this.context!=="elements"?!1:this.selectedElements.length>0&&this.textTargets.length===this.selectedElements.length}get styleTargets(){return this.context==="cells"?this.targetCells:this.textTargets.map(t=>t.options)}pick(t){if(!t.length)return;const o=t[0];return t.every(r=>r===o)?o:yt}hasToken(t,o){return(t??"").split(/\s+/).includes(o)}get values(){const t=this.styleTargets;if(!t.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=t.map(i=>i.fontWeight==="bold"||i.fontWeight==="bolder"),r=t.map(i=>i.textDecoration);return{fontFamily:this.pick(t.map(i=>i.fontFamily)),fontSize:this.pick(t.map(i=>i.fontSize)),color:this.pick(t.map(i=>i.color)),backgroundColor:this.pick(t.map(i=>i.backgroundColor)),textAlign:this.pick(t.map(i=>this.context==="cells"?i.align:i.textAlign)),verticalAlign:this.pick(t.map(i=>this.context==="cells"?i.valign:i.verticalAlign)),bold:o.every(Boolean)?!0:o.some(Boolean)?yt:!1,underline:r.map(i=>this.hasToken(i,"underline")).every(Boolean)?!0:r.some(i=>this.hasToken(i,"underline"))?yt:!1,strike:r.map(i=>this.hasToken(i,"line-through")).every(Boolean)?!0:r.some(i=>this.hasToken(i,"line-through"))?yt:!1}}commit(){this.store.recordHistory(),this.store.emit()}writeCells(t){const o=this.targetCells;o.length&&(o.forEach(t),this.commit())}applyStyle(t){if(this.context==="cells"){this.writeCells(d=>{"fontFamily"in t&&(d.fontFamily=t.fontFamily),"fontSize"in t&&(d.fontSize=t.fontSize),"color"in t&&(d.color=t.color),"backgroundColor"in t&&(d.backgroundColor=t.backgroundColor),"textAlign"in t&&(d.align=t.textAlign),"verticalAlign"in t&&(d.valign=t.verticalAlign)});return}const o=this.textTargets,r=this.selectedElements,n=["fontFamily","fontSize","color","textAlign","verticalAlign"].some(d=>d in t),s="backgroundColor"in t;!(o.length&&n)&&!(r.length&&s)||(o.forEach(d=>{const c=d.options;"fontFamily"in t&&(c.fontFamily=t.fontFamily),"fontSize"in t&&(c.fontSize=t.fontSize),"color"in t&&(c.color=t.color),"textAlign"in t&&(c.textAlign=t.textAlign),"verticalAlign"in t&&(c.verticalAlign=t.verticalAlign)}),s&&r.forEach(d=>{d.options.backgroundColor=t.backgroundColor}),this.commit())}toggleBold(){if(this.context==="cells"){const r=this.values.bold!==!0;this.writeCells(i=>{i.fontWeight=r?"bold":void 0});return}const t=this.values.bold!==!0,o=this.textTargets;o.length&&(o.forEach(r=>{r.options.fontWeight=t?"bold":"normal"}),this.commit())}toggleDecoration(t){if(this.context==="cells")return;const o=this.textTargets;if(!o.length)return;const r=this.values[t==="underline"?"underline":"strike"]!==!0;o.forEach(i=>{const n=(i.options.textDecoration??"").split(/\s+/).filter(Boolean),s=n.indexOf(t);r&&s<0&&n.push(t),!r&&s>=0&&n.splice(s,1),i.options.textDecoration=n.length?n.join(" "):void 0}),this.commit()}toggleUnderline(){this.toggleDecoration("underline")}toggleStrike(){this.toggleDecoration("line-through")}syncBorderDraft(){if(this.context!=="cells"){this.borderDraftKey&&(this.borderDraftKey="",this.borderStyle="solid",this.borderWidth=.75,this.borderColor="#333333",this.borderMixed={style:!1,width:!1,color:!1});return}const t=this.store.tableSelection,o=this.tableElement?.options.tableRows;if(!t||!o)return;const r=`cells:${t.elementId}:${t.r1}:${t.c1}:${t.r2}:${t.c2}`;if(r===this.borderDraftKey)return;if(this.borderDraftKey=r,h.resolveCellGroupMode(o,t).mode==="multi"){this.borderStyle="solid",this.borderWidth=.75,this.borderColor="#333333",this.borderMixed={style:!1,width:!1,color:!1};return}const i=h.resolveCellBorderDisplay(o,t);if(i.style===void 0&&i.width===void 0&&i.color===void 0){this.borderMixed={style:!1,width:!1,color:!1},this.borderStyle=null,this.borderWidth=0,this.borderColor="#333333";return}this.borderMixed={style:i.style==="mixed",width:i.width==="mixed",color:i.color==="mixed"},this.borderMixed.style?this.borderStyle=null:i.style===void 0?this.borderStyle="solid":i.style==="none"?this.borderStyle=null:this.borderStyle=i.style,this.borderWidth=this.borderMixed.width?void 0:typeof i.width=="number"?i.width:.75,this.borderColor=this.borderMixed.color?void 0:typeof i.color=="string"?i.color:"#333333"}borderSpec(){const t=this.borderStyle??(this.borderMixed.style?"solid":"none");return{width:this.borderWidth??.75,style:t,color:this.borderColor??"#333333"}}setBorderWidth(t){this.borderWidth=t,this.borderMixed.width=!1}setBorderColor(t){this.borderColor=t,this.borderMixed.color=!1}settleBorderDraft(){this.context==="cells"&&(this.borderMixed.style&&(this.borderStyle="solid",this.borderMixed.style=!1),this.borderMixed.width&&(this.borderWidth=.75,this.borderMixed.width=!1),this.borderMixed.color&&(this.borderColor="#333333",this.borderMixed.color=!1))}toggleBorderStyle(t){const o=this.borderStyle===t?null:t;this.borderMixed.style=!1,this.borderStyle=o,o===null?this.borderWidth=0:this.borderWidth===0&&(this.borderWidth=.75)}applyElementBorder(t,o){const r=this.selectedElements;r.length&&(r.forEach(i=>{h.applyElementBorderPreset(i.options,t,o)}),this.commit())}applyCellBorderPreset(t,o){const r=this.store.tableSelection,i=this.tableElement?.options.tableRows;!r||!i||(h.applyBorderPreset(i,{r1:r.r1,c1:r.c1,r2:r.r2,c2:r.c2},t,o),this.commit())}applyCellBorderEdges(t,o,r){this.writeCells(i=>{for(const n of t)h.setCellBorderEdge(i,n,r?o:null)})}get cellEdges(){if(this.context!=="cells")return null;const t=this.targetCells;return t.length?mi(t.map(o=>o.borders)):null}toggleCellEdge(t,o){const r=this.cellEdges?.[t]!==!0;this.applyCellBorderEdges([t],o,r)}get elementEdges(){if(this.context!=="elements")return null;const t=this.selectedElements;return t.length?mi(t.map(o=>h.elementVisibleBorders(o.options))):null}toggleElementEdge(t,o){const r=this.selectedElements;if(!r.length)return;const i=this.elementEdges?.[t]!==!0;r.forEach(n=>h.setElementBorderEdgeVisible(n.options,t,i,o)),this.commit()}applyBorderPreset(t){const o=this.borderStyle===null;if(this.context==="cells"){const r=o&&!this.borderMixed.style;this.applyCellBorderPreset(r?"none":t,this.borderSpec()),this.settleBorderDraft()}else this.applyElementBorder(o||t==="none"?"none":"all",this.borderSpec())}applyEdge(t){if(this.borderStyle===null&&!this.borderMixed.style){this.context==="cells"?(this.applyCellBorderEdges([t],this.borderSpec(),!1),this.settleBorderDraft()):this.clearElementEdge(t);return}this.context==="cells"?(this.toggleCellEdge(t,this.borderSpec()),this.settleBorderDraft()):this.toggleElementEdge(t,this.borderSpec())}clearElementEdge(t){const o=this.selectedElements;o.length&&(o.forEach(r=>h.setElementBorderEdgeVisible(r.options,t,!1)),this.commit())}edgeOn(t){return(this.context==="cells"?this.cellEdges:this.elementEdges)?.[t]===!0}get painterCapturable(){return this.selectedElements.length===1}clonePainterBorders(t){if(!t)return;const o={};for(const r of h.ELEMENT_BORDER_SIDES){const i=t[r];i&&(o[r]={...i})}return o}pickPainterSource(t=!1){const o=this.selectedElements[0];if(!o)return!1;const r=o.options,i=o.printElementType.type;return this.painterSnapshot={text:Xo.has(i)?Object.fromEntries(za.map(n=>[n,r[n]])):null,backgroundColor:r.backgroundColor,border:h.acceptsElementBorder(i)?{borderWidth:r.borderWidth,borderStyle:r.borderStyle,borderColor:r.borderColor,borders:this.clonePainterBorders(r.borders)}:null},this.painterSource=o.id,this.painterActive=!0,this.painterLocked=t,!0}cancelPainter(){this.painterActive=!1,this.painterLocked=!1,this.painterSource=null,this.painterSnapshot=null}applyPainter(t){const o=this.painterSnapshot;if(!o||t.options.locked||t.id===this.painterSource)return!1;const r=t.options,i=t.printElementType.type;return o.text&&Xo.has(i)&&Object.assign(r,o.text),r.backgroundColor=o.backgroundColor,o.border&&h.acceptsElementBorder(i)&&(r.borderWidth=o.border.borderWidth,r.borderStyle=o.border.borderStyle,r.borderColor=o.border.borderColor,r.borders=this.clonePainterBorders(o.border.borders)),!0}painterSyncSelection(){if(!this.painterActive||!this.painterSnapshot)return;const t=this.selectedElements;if(!t.length){this.cancelPainter();return}let o=!1;t.forEach(r=>{o=this.applyPainter(r)||o}),o&&(this.commit(),this.painterLocked||this.cancelPainter())}handlePainterKeydown(t){if(t.key!=="Escape"||!this.painterActive)return;const o=t.target?.tagName;o==="INPUT"||o==="TEXTAREA"||o==="SELECT"||this.cancelPainter()}}const Na={AlignCenterHorizontal:'<path d="M2 12h20" /><path d="M10 16v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4" /><path d="M10 8V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v4" /><path d="M20 16v1a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-1" /><path d="M14 8V7c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v1" />',AlignCenterVertical:'<path d="M12 2v20" /><path d="M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4" /><path d="M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4" /><path d="M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1" /><path d="M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1" />',AlignEndHorizontal:'<rect width="6" height="16" x="4" y="2" rx="2" /><rect width="6" height="9" x="14" y="9" rx="2" /><path d="M22 22H2" />',AlignEndVertical:'<rect width="16" height="6" x="2" y="4" rx="2" /><rect width="9" height="6" x="9" y="14" rx="2" /><path d="M22 22V2" />',AlignHorizontalSpaceBetween:'<rect width="6" height="14" x="3" y="5" rx="2" /><rect width="6" height="10" x="15" y="7" rx="2" /><path d="M3 2v20" /><path d="M21 2v20" />',AlignStartHorizontal:'<rect width="6" height="16" x="4" y="6" rx="2" /><rect width="6" height="9" x="14" y="6" rx="2" /><path d="M22 2H2" />',AlignStartVertical:'<rect width="9" height="6" x="6" y="14" rx="2" /><rect width="16" height="6" x="6" y="4" rx="2" /><path d="M2 2v20" />',AlignVerticalSpaceBetween:'<rect width="14" height="6" x="5" y="15" rx="2" /><rect width="10" height="6" x="7" y="3" rx="2" /><path d="M2 21h20" /><path d="M2 3h20" />',ArrowDown:'<path d="M12 5v14" /><path d="m19 12-7 7-7-7" />',ArrowDownToLine:'<path d="M12 17V3" /><path d="m6 11 6 6 6-6" /><path d="M19 21H5" />',ArrowUp:'<path d="m5 12 7-7 7 7" /><path d="M12 19V5" />',ArrowUpToLine:'<path d="M5 3h14" /><path d="m18 13-6-6-6 6" /><path d="M12 7v14" />',Barcode:'<path d="M3 5v14" /><path d="M8 5v14" /><path d="M12 5v14" /><path d="M17 5v14" /><path d="M21 5v14" />',Bold:'<path d="M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8" />',ChartArea:'<path d="M3 3v16a2 2 0 0 0 2 2h16" /><path d="M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z" />',ChartBar:'<path d="M3 3v16a2 2 0 0 0 2 2h16" /><path d="M7 16h8" /><path d="M7 11h12" /><path d="M7 6h3" />',ChartColumn:'<path d="M3 3v16a2 2 0 0 0 2 2h16" /><path d="M18 17V9" /><path d="M13 17V5" /><path d="M8 17v-3" />',ChartLine:'<path d="M3 3v16a2 2 0 0 0 2 2h16" /><path d="m19 9-5 5-4-4-3 3" />',ChartPie:'<path d="M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z" /><path d="M21.21 15.89A10 10 0 1 1 8 2.83" />',ChartScatter:'<circle cx="7.5" cy="7.5" r=".5" fill="currentColor" /><circle cx="18.5" cy="5.5" r=".5" fill="currentColor" /><circle cx="11.5" cy="11.5" r=".5" fill="currentColor" /><circle cx="7.5" cy="16.5" r=".5" fill="currentColor" /><circle cx="17.5" cy="14.5" r=".5" fill="currentColor" /><path d="M3 3v16a2 2 0 0 0 2 2h16" />',Check:'<path d="M20 6 9 17l-5-5" />',ChevronDown:'<path d="m6 9 6 6 6-6" />',ChevronsLeft:'<path d="m11 17-5-5 5-5" /><path d="m18 17-5-5 5-5" />',ChevronsRight:'<path d="m6 17 5-5-5-5" /><path d="m13 17 5-5-5-5" />',ChevronsUpDown:'<path d="m7 15 5 5 5-5" /><path d="m7 9 5-5 5 5" />',Circle:'<circle cx="12" cy="12" r="10" />',ClipboardPaste:'<path d="M11 14h10" /><path d="M16 4h2a2 2 0 0 1 2 2v1.344" /><path d="m17 18 4-4-4-4" /><path d="M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113" /><rect x="8" y="2" width="8" height="4" rx="1" />',Code:'<path d="m16 18 6-6-6-6" /><path d="m8 6-6 6 6 6" />',Copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2" /><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />',Donut:'<path d="M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3" /><circle cx="12" cy="12" r="3" />',Ellipsis:'<circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" /><circle cx="5" cy="12" r="1" />',Eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" /><circle cx="12" cy="12" r="3" />',FileText:'<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" /><path d="M14 2v5a1 1 0 0 0 1 1h5" /><path d="M10 9H8" /><path d="M16 13H8" /><path d="M16 17H8" />',Funnel:'<path d="M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z" />',Gauge:'<path d="m12 14 4-4" /><path d="M3.34 19a10 10 0 1 1 17.32 0" />',Grid3x3:'<rect width="18" height="18" x="3" y="3" rx="2" /><path d="M3 9h18" /><path d="M3 15h18" /><path d="M9 3v18" /><path d="M15 3v18" />',Group:'<path d="M3 7V5c0-1.1.9-2 2-2h2" /><path d="M17 3h2c1.1 0 2 .9 2 2v2" /><path d="M21 17v2c0 1.1-.9 2-2 2h-2" /><path d="M7 21H5c-1.1 0-2-.9-2-2v-2" /><rect width="7" height="5" x="7" y="7" rx="1" /><rect width="7" height="5" x="10" y="12" rx="1" />',Image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2" /><circle cx="9" cy="9" r="2" /><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />',Layers:'<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z" /><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12" /><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17" />',List:'<path d="M3 5h.01" /><path d="M3 12h.01" /><path d="M3 19h.01" /><path d="M8 5h13" /><path d="M8 12h13" /><path d="M8 19h13" />',ListTree:'<path d="M8 5h13" /><path d="M13 12h8" /><path d="M13 19h8" /><path d="M3 10a2 2 0 0 0 2 2h3" /><path d="M3 5v12a2 2 0 0 0 2 2h3" />',Maximize:'<path d="M8 3H5a2 2 0 0 0-2 2v3" /><path d="M21 8V5a2 2 0 0 0-2-2h-3" /><path d="M3 16v3a2 2 0 0 0 2 2h3" /><path d="M16 21h3a2 2 0 0 0 2-2v-3" />',Minus:'<path d="M5 12h14" />',PaintBucket:'<path d="M11 7 6 2" /><path d="M18.992 12H2.041" /><path d="M21.145 18.38A3.34 3.34 0 0 1 20 16.5a3.3 3.3 0 0 1-1.145 1.88c-.575.46-.855 1.02-.855 1.595A2 2 0 0 0 20 22a2 2 0 0 0 2-2.025c0-.58-.285-1.13-.855-1.595" /><path d="m8.5 4.5 2.148-2.148a1.205 1.205 0 0 1 1.704 0l7.296 7.296a1.205 1.205 0 0 1 0 1.704l-7.592 7.592a3.615 3.615 0 0 1-5.112 0l-3.888-3.888a3.615 3.615 0 0 1 0-5.112L5.67 7.33" />',Paintbrush:'<path d="m14.622 17.897-10.68-2.913" /><path d="M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z" /><path d="M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15" />',QrCode:'<rect width="5" height="5" x="3" y="3" rx="1" /><rect width="5" height="5" x="16" y="3" rx="1" /><rect width="5" height="5" x="3" y="16" rx="1" /><path d="M21 16h-3a2 2 0 0 0-2 2v3" /><path d="M21 21v.01" /><path d="M12 7v3a2 2 0 0 1-2 2H7" /><path d="M3 12h.01" /><path d="M12 3h.01" /><path d="M12 16v.01" /><path d="M16 12h1" /><path d="M21 12v.01" /><path d="M12 21v-1" />',Radar:'<path d="M19.07 4.93A10 10 0 0 0 6.99 3.34" /><path d="M4 6h.01" /><path d="M2.29 9.62A10 10 0 1 0 21.31 8.35" /><path d="M16.24 7.76A6 6 0 1 0 8.23 16.67" /><path d="M12 18h.01" /><path d="M17.99 11.66A6 6 0 0 1 15.77 16.67" /><circle cx="12" cy="12" r="2" /><path d="m13.41 10.59 5.66-5.66" />',Redo2:'<path d="m15 14 5-5-5-5" /><path d="M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13" />',RotateCcw:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" /><path d="M3 3v5h5" />',SeparatorVertical:'<path d="M12 3v18" /><path d="m16 16 4-4-4-4" /><path d="m8 8-4 4 4 4" />',Shapes:'<path d="M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z" /><rect x="3" y="14" width="7" height="7" rx="1" /><circle cx="17.5" cy="17.5" r="3.5" />',Square:'<rect width="18" height="18" x="3" y="3" rx="2" />',Strikethrough:'<path d="M16 4H9a3 3 0 0 0-2.83 4" /><path d="M14 12a4 4 0 0 1 0 8H6" /><line x1="4" x2="20" y1="12" y2="12" />',Table:'<path d="M12 3v18" /><rect width="18" height="18" x="3" y="3" rx="2" /><path d="M3 9h18" /><path d="M3 15h18" />',Table2:'<path d="M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18" />',TextAlignCenter:'<path d="M21 5H3" /><path d="M17 12H7" /><path d="M19 19H5" />',TextAlignEnd:'<path d="M21 5H3" /><path d="M21 12H9" /><path d="M21 19H7" />',TextAlignJustify:'<path d="M3 5h18" /><path d="M3 12h18" /><path d="M3 19h18" />',TextAlignStart:'<path d="M21 5H3" /><path d="M15 12H3" /><path d="M17 19H3" />',Trash2:'<path d="M10 11v6" /><path d="M14 11v6" /><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" /><path d="M3 6h18" /><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />',Type:'<path d="M12 4v16" /><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2" /><path d="M9 20h6" />',Underline:'<path d="M6 4v6a6 6 0 0 0 12 0V4" /><line x1="4" x2="20" y1="20" y2="20" />',Undo2:'<path d="M9 14 4 9l5-5" /><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11" />',Ungroup:'<rect width="8" height="6" x="5" y="4" rx="1" /><rect width="8" height="6" x="11" y="14" rx="1" />',ZoomIn:'<circle cx="11" cy="11" r="8" /><line x1="21" x2="16.65" y1="21" y2="16.65" /><line x1="11" x2="11" y1="8" y2="14" /><line x1="8" x2="14" y1="11" y2="11" />',ZoomOut:'<circle cx="11" cy="11" r="8" /><line x1="21" x2="16.65" y1="21" y2="16.65" /><line x1="8" x2="14" y1="11" y2="11" />'};function ge(e,t=15,o){const r=Na[e];return r?`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}"${o?` class="${o}"`:""} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${r}</svg>`:""}var vt=null;function Mr(e){const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;const o=t[1],r=o.length===3?o.split("").map(i=>i+i).join(""):o;return{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16)}}function _r(e){const t=Mr(e);return t?fn(t):"#000000"}function fn({r:e,g:t,b:o}){return`#${[e,t,o].map(r=>Math.round(Gt(r/255)*255).toString(16).padStart(2,"0")).join("")}`}function Ba(e,t,o){const r=e/255,i=t/255,n=o/255,s=Math.max(r,i,n),d=Math.min(r,i,n),c=s-d;let u=0;return c!==0&&(s===r?u=(i-n)/c%6:s===i?u=(n-r)/c+2:u=(r-i)/c+4,u*=60,u<0&&(u+=360)),{h:u,s:s===0?0:c/s,v:s}}function Ua(e,t,o){const r=o*t,i=(e%360+360)%360/60,n=r*(1-Math.abs(i%2-1)),[s,d,c]=i<1?[r,n,0]:i<2?[n,r,0]:i<3?[0,r,n]:i<4?[0,n,r]:i<5?[n,0,r]:[r,0,n],u=o-r;return{r:(s+u)*255,g:(d+u)*255,b:(c+u)*255}}function Ha(e){return((Number.isFinite(e)?e:0)%360+360)%360}function Gt(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}function $a(e){const t=e.translator??we.t,o=e.title??t("colorPicker.pickColor");return l("button",{type:"button",class:`preset-color-trigger${e.triggerClass?` ${e.triggerClass}`:""}`,"aria-expanded":"false","aria-haspopup":"dialog",title:o,onClick:r=>{const i=r.currentTarget??r.target,n=i.getRootNode();if(!!vt&&vt.root===n&&vt.title===o&&vt.trigger===i){Kt();return}Kt(),Wa(i,e,t)}},[l("span",{class:"preset-color-swatch",style:e.value?{background:e.value}:{background:"transparent"}})])}function Kt(){const e=vt;e&&(vt=null,e.teardowns.forEach(t=>t()),e.trigger.setAttribute("aria-expanded","false"),e.panel.remove())}function Wa(e,t,o){const r=e.getRootNode(),i=r instanceof ShadowRoot?r:document.body,n={root:r,title:t.title??o("colorPicker.pickColor"),trigger:e,panel:null,clearable:t.clearable!==!1,onChange:t.onChange,model:t.value||void 0,hue:0,saturation:0,value_:0,hexText:"",dragging:!1,current:null,hex:null,area:null,handle:null,hueRange:null,clearBtn:null,translator:o,items:[],teardowns:[]};t.value&&Fr(n,t.value)?n.hexText=_r(t.value).toUpperCase():n.hexText=t.value?String(t.value):"",n.panel=Se(qa(n),i),n.current=n.panel.querySelector(".picker-current"),n.hex=n.panel.querySelector(".picker-hex"),n.area=n.panel.querySelector(".picker-area"),n.handle=n.panel.querySelector(".picker-handle"),n.hueRange=n.panel.querySelector(".picker-hue"),n.clearBtn=n.panel.querySelector(".picker-clear"),n.items=Array.from(n.panel.querySelectorAll(".preset-color-item")).map((s,d)=>({el:s,color:h.PRESET_COLORS[d]})),vo(n),Ka(n),Va(n),vt=n,e.setAttribute("aria-expanded","true")}function Ka(e){const t=e.trigger.getBoundingClientRect(),o=190,r=e.panel.offsetHeight||216,i=8,n=Math.max(i,Math.min(t.left,window.innerWidth-o-i)),s=t.bottom+6,d=s+r>window.innerHeight-i?Math.max(i,t.top-r-6):s;e.panel.style.left=`${n}px`,e.panel.style.top=`${d}px`}function Va(e){const t=i=>{const n=Ga(i);n.includes(e.trigger)||n.includes(e.panel)||Kt()},o=i=>{i.key==="Escape"&&Kt()},r=()=>Kt();document.addEventListener("pointerdown",t,!0),document.addEventListener("keydown",o),window.addEventListener("scroll",r,!0),window.addEventListener("resize",r),e.root.addEventListener("scroll",r,!0),e.teardowns.push(()=>document.removeEventListener("pointerdown",t,!0),()=>document.removeEventListener("keydown",o),()=>window.removeEventListener("scroll",r,!0),()=>window.removeEventListener("resize",r),()=>e.root.removeEventListener("scroll",r,!0))}function Ga(e){const t=typeof e.composedPath=="function"?e.composedPath():[];return t.length?t:[e.target]}function qa(e){const t=e.translator;return l("div",{class:"preset-color-panel",role:"dialog","aria-label":t("colorPicker.pickColor"),style:{position:"fixed"},onPointerdown:o=>o.stopPropagation()},[l("div",{class:"picker-preview"},[l("span",{class:"picker-current"}),l("input",{class:"picker-hex",type:"text",maxlength:7,spellcheck:"false","aria-label":t("colorPicker.hexValue"),onInput:o=>ja(e,o.target.value)})]),l("div",{class:"picker-area","aria-label":t("colorPicker.customColor"),tabindex:0,onPointerdown:o=>Xa(e,o),onKeydown:o=>Za(e,o)},[l("span",{class:"picker-handle"})]),l("input",{class:"picker-hue",type:"range",min:0,max:360,step:1,"aria-label":t("colorPicker.hue"),onInput:o=>Qa(e,Number(o.target.value)),onChange:()=>Ir(e)}),l("div",{class:"picker-heading"},[l("span",{text:t("colorPicker.commonColors")}),e.clearable?l("button",{type:"button",class:"picker-clear",title:t("colorPicker.clear"),onClick:()=>uo(e,void 0)},[l("svg",{viewBox:"0 0 16 16",width:12,height:12,"aria-hidden":"true"},[l("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",fill:"none"})]),t("colorPicker.clearShort")]):""].filter(Boolean)),l("div",{class:"preset-color-grid"},h.PRESET_COLORS.map(o=>l("button",{type:"button",class:"preset-color-item",style:{background:o},title:o,"aria-label":o,onClick:()=>Ya(e,o)})))])}function Rr(e){return fn(Ua(e.hue,e.saturation,e.value_))}function vo(e){const t=Rr(e);e.hex.value!==e.hexText&&(e.hex.value=e.hexText),e.current.className=e.model?"picker-current":"picker-current is-empty",e.model?e.current.style.background=t:e.current.style.removeProperty("background"),e.area.style.setProperty("--picker-hue",`${Math.round(e.hue)}deg`),e.handle.style.left=`${e.saturation*100}%`,e.handle.style.top=`${(1-e.value_)*100}%`,e.handle.style.background=t;const o=String(Math.round(e.hue));e.hueRange.value!==o&&(e.hueRange.value=o),e.clearBtn&&(e.clearBtn.disabled=!e.model);for(const r of e.items)r.el.className=e.model&&r.color.toLowerCase()===e.model.toLowerCase()?"preset-color-item active":"preset-color-item"}function Fr(e,t){const o=Mr(t);if(!o)return!1;const r=Ba(o.r,o.g,o.b);return e.hue=r.h,e.saturation=r.s,e.value_=r.v,e.hexText=_r(t).toUpperCase(),!0}function Rt(e,t,o,r){e.hue=Ha(t),e.saturation=Gt(o),e.value_=Gt(r),e.hexText=Rr(e).toUpperCase(),vo(e)}function Ir(e){const t=Rr(e);e.model=t,vo(e),e.onChange(t)}function uo(e,t){e.model=t,t||(e.hexText=""),vo(e),e.onChange(t)}function Ya(e,t){Fr(e,t),uo(e,t)}function ja(e,t){const o=t.trim();if(!o){e.clearable&&uo(e,void 0);return}Mr(o)&&(Fr(e,o),uo(e,_r(o)))}function Xa(e,t){e.dragging=!0,bi(e,t);const o=i=>{e.dragging&&bi(e,i)},r=()=>{e.dragging&&(e.dragging=!1,document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",r),document.removeEventListener("pointercancel",r),Ir(e))};document.addEventListener("pointermove",o),document.addEventListener("pointerup",r),document.addEventListener("pointercancel",r)}function bi(e,t){const o=e.area.getBoundingClientRect();if(!o.width||!o.height)return;const r=Gt((t.clientX-o.left)/o.width),i=Gt(1-(t.clientY-o.top)/o.height);Rt(e,e.hue,r,i)}function Za(e,t){const o=t.shiftKey?.1:.02;let r=!0;t.key==="ArrowLeft"?Rt(e,e.hue,e.saturation-o,e.value_):t.key==="ArrowRight"?Rt(e,e.hue,e.saturation+o,e.value_):t.key==="ArrowUp"?Rt(e,e.hue,e.saturation,e.value_+o):t.key==="ArrowDown"?Rt(e,e.hue,e.saturation,e.value_-o):r=!1,r&&(t.preventDefault(),Ir(e))}function Qa(e,t){Rt(e,t,e.saturation,e.value_)}function a(e,t,o){return e.t?e.t(t,o):we.t(t,o)}let Ft=null;function Ja(e,t){const o=Ft;Ft=e;try{t()}finally{Ft=o}}function N(e,t){return Ft?Ft(e,t):we.t(e,t)}function ne(e,t,o,r){return l("button",{class:`tb-btn tb-icon${r.on?" on":""}${r.danger?" danger":""}`,type:"button",disabled:!!r.disabled,dataset:{tip:r.tip,...r.test?{test:r.test}:{}},onClick:()=>e.fire(o,r.arg),html:ge(t)})}function fo(e,t,o,r){const i=e.state.openDd===t,n=()=>{e.state.openDd=i?null:t,e.repaint()};return l("div",{class:"tb-dd"},[l("button",{type:"button",class:`tb-dd-trigger${i?" on":""}`,disabled:!!o.disabled,dataset:{test:o.testId??t,tip:o.tip},onClick:n,html:`${o.icon?ge(o.icon):""}${o.text?`<span class="${o.textClass??"tb-btn-text"}">${o.text}</span>`:""}${ge("ChevronDown",12,`tb-dd-arrow${i?" up":""}`)}`}),i?l("div",{class:`tb-dd-panel${o.panelClass?` ${o.panelClass}`:""}`},r):""].filter(Boolean))}function H(e){const t=e.step??1,o=String(t),r=o.indexOf("."),i=r===-1?0:o.length-r-1,n=b=>Number.isFinite(b)?Number(b.toFixed(i)):0,s=b=>{let m=n(b);return e.min!==void 0&&m<e.min&&(m=e.min),e.max!==void 0&&m>e.max&&(m=e.max),m},d=e.value===void 0||e.value===null||!Number.isFinite(e.value)?void 0:n(e.value),c=d??e.min??0,u=b=>{b!==d&&e.onCommit(b)},f=l("input",{class:"pd-input pd-step-input",type:"number",value:d===void 0?"":String(d),min:e.min,max:e.max,step:t,placeholder:e.placeholder,disabled:!!e.disabled,onChange:b=>{const m=b.target,E=(m.value??"").trim();if(E===""){d!==void 0&&(m.value=String(d));return}const y=Number(E);if(!Number.isFinite(y)){m.value=d===void 0?"":String(d);return}const C=s(y);m.value=String(C),u(C)}});return l("div",{class:"pd-stepper"},[l("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:!!e.disabled||c<=(e.min??-1/0),title:N("controls.k28"),"aria-label":N("controls.k29"),text:"−",onClick:()=>u(s(c-t))}),f,l("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:!!e.disabled||c>=(e.max??1/0),title:N("controls.k30"),"aria-label":N("controls.k31"),text:"+",onClick:()=>u(s(c+t))})])}function q(e,t,o,r){return l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:e}),r??""]),t,o?l("p",{class:"pd-hint",text:o}):""].filter(Boolean))}const mr=e=>l("button",{class:"pd-help",type:"button","data-tip":e,"aria-label":N("controls.k32")});function xe(e,t,o,r){return l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t"},[e,mr(o)]),r??""]),t])}function kt(e){const t=e.base?.[e.propKey],o=e.target?.[e.propKey]!==t,r=e.force===!0||o,i=e.tipOverride??(e.tipValue===void 0?N("controls.k33"):N("controls.k34",{v0:e.tipValue,v1:e.tipUnit?" "+e.tipUnit:""})),n=e.force?N("controls.k35",{v0:i}):i;return l("button",{type:"button",class:`pd-reset-btn${o&&!e.force?" is-dirty":""}`,"data-tip":n,"aria-label":n,html:ge("RotateCcw",13),onClick:()=>{r&&(e.write?e.write(t):e.target[e.propKey]=t,e.onReset?.())}})}const Ge=e=>l("h3",{class:"pd-divider",text:e});function Ae(e,t,o=N("controls.k36"),r){return $a({value:e,title:o,triggerClass:r,translator:Ft??we.t,onChange:i=>t(i)})}function dt(e,t,o,r,i=!1){return l("div",{class:`pd-radio-group${i?" pd-radio-group--2col":""}`,role:"radiogroup"},t.map(n=>l("label",{class:"pd-radio"},[l("input",{type:"radio",name:e,value:n.value,checked:o===n.value,onChange:()=>r(n.value)}),l("span",{text:n.label})])))}function gn(e,t,o,r={}){const i=document.createElement("select");i.className=r.className??"pd-select",r.width&&(i.style.width=r.width);for(const n of t){const s=document.createElement("option");s.value=n.value,s.textContent=n.label,n.disabled&&(s.disabled=!0),i.appendChild(s)}return i.value=e,t.some(n=>n.value===e)||(i.selectedIndex=-1),i.addEventListener("change",()=>o(i.value)),i}const el="propertyPanel.k328",tl=()=>N(el);function mn(){const e=[];for(const{plugin:t,kind:o}of h.getElementPluginKinds()){const r=gr.getElementUI(o.type);if(!r)continue;const n=(o.designer??t.designer)?.materialCard;e.push({type:o.type,label:o.label,icon:o.icon??n?.icon??"Shapes",group:n?.group??r.group,ui:r})}return e}function Lr(e){if(e)return mn().find(t=>t.type===e)}function br(e){if(!e)return;const t=Lr(e.printElementType.type);if(!t||!t.ui.renderProperty)return;const o=t.ui;if(o.hasProperties)try{if(!o.hasProperties(e))return}catch{return}const r=tl();return{ui:o,label:r,icon:t.icon,searchKeywords:o.searchKeywords?[...o.searchKeywords]:[r,t.label,t.type]}}const xo=Object.freeze([{type:"text",label:N("elementDefinitions.k553"),icon:"Type",material:!0,propertyGroup:"text",dblEditableField:"formatter",origin:"builtin"},{type:"barcode",label:N("elementDefinitions.k554"),icon:"Barcode",material:!0,propertyGroup:"code",dblEditableField:"formatter",origin:"builtin"},{type:"qrcode",label:N("elementDefinitions.k555"),icon:"QrCode",material:!0,propertyGroup:"code",dblEditableField:"formatter",origin:"builtin"},{type:"image",label:N("elementDefinitions.k556"),icon:"Image",material:!0,propertyGroup:"general",dblEditableField:"src",origin:"builtin"},{type:"table",label:N("elementDefinitions.k557"),icon:"Table",material:!0,propertyGroup:"table",origin:"builtin"},{type:"longText",label:N("elementDefinitions.k558"),icon:"TextAlignStart",material:!0,propertyGroup:"text",dblEditableField:"formatter",origin:"builtin"},{type:"flowList",label:N("elementDefinitions.k559"),icon:"List",material:!0,propertyGroup:"general",dblEditableField:"formatter",origin:"builtin"},{type:"hline",label:N("elementDefinitions.k560"),icon:"Minus",material:!0,propertyGroup:"general",origin:"builtin"},{type:"vline",label:N("elementDefinitions.k561"),icon:"SeparatorVertical",material:!0,propertyGroup:"general",origin:"builtin"},{type:"rect",label:N("elementDefinitions.k562"),icon:"Square",material:!0,propertyGroup:"general",origin:"builtin"},{type:"oval",label:N("elementDefinitions.k563"),icon:"Circle",material:!0,propertyGroup:"general",origin:"builtin"},{type:"html",label:"HTML",icon:"Code",material:!1,propertyGroup:"general",origin:"builtin"},{type:"pageNumber",label:N("elementDefinitions.k564"),icon:"Shapes",material:!1,propertyGroup:"general",origin:"builtin"}]),yi=Symbol.for("worm-print-platform.element-definitions.v1"),vi=globalThis;function Ue(){const e=vi[yi];if(e)return e;const t={overrides:new Map,builtinRenderers:new Map,rendererOverrides:new Map,listeners:new Set,nextSeq:0,seq:new Map};return vi[yi]=t,t}function qt(){for(const e of[...Ue().listeners])try{e()}catch{}}function bn(e){const t=Ue();return t.listeners.add(e),()=>{t.listeners.delete(e)}}function ol(){return new Map(xo.map(e=>[e.type,e]))}function rl(e){if(!e?.type||typeof e.type!="string")throw new Error(N("elementDefinitions.k565"));if(!e.label||typeof e.label!="string")throw new Error(N("elementDefinitions.k566"));const t=Ue(),o={...e,origin:e.origin??"custom"};return t.overrides.set(o.type,o),t.seq.set(o.type,t.nextSeq++),qt(),()=>{const r=Ue();r.overrides.get(o.type)===o&&(r.overrides.delete(o.type),qt())}}function il(e,t){if(!e||typeof t!="function")throw new Error(N("elementDefinitions.k567"));return Ue().rendererOverrides.set(e,t),qt(),()=>{const r=Ue();r.rendererOverrides.get(e)===t&&(r.rendererOverrides.delete(e),qt())}}function yn(e){const t=Ue();for(const[o,r]of Object.entries(e))t.builtinRenderers.set(o,r);return()=>{const o=Ue();for(const[r,i]of Object.entries(e))o.builtinRenderers.get(r)===i&&o.builtinRenderers.delete(r)}}function nl(e){const t=Lr(e);if(t)return{type:t.type,label:t.label,icon:t.icon,group:t.group,material:!0,propertyGroup:"general",origin:"plugin"}}function pt(e){if(!e)return;const t=Ue(),o=t.overrides.get(e)??ol().get(e)??nl(e);if(!o)return;const r=t.rendererOverrides.get(e)??t.builtinRenderers.get(e);return r?{...o,renderContent:r}:o}function vn(){const e=Ue(),t=[],o=new Set;for(const i of xo)t.push(pt(i.type)??i),o.add(i.type);const r=[...e.overrides.entries()].filter(([i])=>!o.has(i)).sort((i,n)=>(e.seq.get(i[0])??0)-(e.seq.get(n[0])??0));for(const[i]of r){const n=pt(i);n&&t.push(n),o.add(i)}for(const i of mn()){if(o.has(i.type))continue;const n=pt(i.type);n&&t.push(n),o.add(i.type)}return t}function xn(){return vn().filter(e=>e.material)}function wn(e){return pt(e)?.propertyGroup??"general"}function kn(e){return pt(e)?.dblEditableField}function En(e){return pt(e)?.icon??"Shapes"}function al(){const e=Ue();e.overrides.clear(),e.rendererOverrides.clear(),e.seq.clear(),e.nextSeq=0,qt()}const zr="1.4.0",Sn="print-designer",Or=["template","fields","name","fonts","design-data","theme","theme-config","field-display","lang"],Tn=["is-edit","show-help","show-preview","show-save"],ll=Object.freeze({bubbles:!0,composed:!0}),Nr=["container","toolbar","format-bar","left-panel","canvas-area","property-panel","status-bar","page-tabs"],Cn=["--pd-bg","--pd-surface","--pd-field-bg","--pd-sidebar","--pd-sidebar-hover","--pd-canvas-bg","--pd-paper","--pd-accent","--pd-accent-2","--pd-accent-soft","--pd-accent-secondary","--pd-danger-soft","--pd-ink-green","--pd-text","--pd-text-muted","--pd-text-faint","--pd-border","--pd-border-soft","--pd-input-bg","--pd-hover-tint","--pd-danger","--pd-danger-bg","--pd-danger-border","--pd-menu-text","--pd-menu-hover","--pd-menu-border","--pd-menu-divider","--pd-menu-muted","--pd-menu-disabled","--pd-scrollbar","--pd-scrollbar-thumb","--pd-scrollbar-thumb-hover","--pd-help-field-bg","--pd-help-field-line","--pd-help-field-ink","--pd-help-function-bg","--pd-help-function-line","--pd-help-function-ink","--pd-help-variable-bg","--pd-help-variable-line","--pd-help-variable-ink","--pd-help-conditional-bg","--pd-help-conditional-line","--pd-help-conditional-ink","--pd-handle","--pd-ruler","--pd-ruler-bg","--pd-ruler-cursor","--pd-radius","--pd-shadow-sm","--pd-shadow-md","--pd-shadow-paper","--pd-success","--pd-text-regular","--pd-fill-light"],Dn=["getTemplateJson","loadTemplate","save","validateTemplate","getGeometryWarnings","setLocale"],Pn=["template","fields","fonts","designData","isEdit","showHelp","showPreview","showSave","theme","themeConfig","uploadImage","uploadDesignBackground","fieldDisplay","lang","messages"],Be=Object.freeze({save:"save",preview:"preview",help:"help",dblclickElement:"dblclick-element",dblclickCell:"dblclick-cell"}),An=[Be.save,Be.preview,Be.help,Be.dblclickElement,Be.dblclickCell];function yr(){return{version:zr,tag:Sn,attributes:Or,booleanAttributes:Tn,events:An,parts:Nr,themeTokens:Cn,methods:Dn,properties:Pn}}const sl={"--pd-bg":"#181a20","--pd-surface":"#1f2229","--pd-field-bg":"#252830","--pd-sidebar":"#1f2229","--pd-sidebar-hover":"#2b2f39","--pd-accent":"#4C8DFF","--pd-accent-2":"#6C9DFF","--pd-accent-soft":"rgba(76, 141, 255, .16)","--pd-accent-secondary":"#ff7a7a","--pd-danger-soft":"rgba(255, 122, 122, .14)","--pd-ink-green":"#6cce5a","--pd-text":"#e6e8ee","--pd-text-muted":"#9aa0ad","--pd-text-faint":"#6f7683","--pd-text-regular":"#c9cdd8","--pd-border":"#3a3f4b","--pd-border-soft":"#2d323c","--pd-input-bg":"#262a33","--pd-hover-tint":"rgba(76, 141, 255, .12)","--pd-fill-light":"#2b2f39","--pd-danger":"#ff6b6b","--pd-danger-bg":"#3a2226","--pd-danger-border":"#6b3535","--pd-success":"#4ade80","--pd-menu-text":"#d6d9e0","--pd-menu-hover":"#2b2f39","--pd-menu-border":"#3a3f4b","--pd-menu-divider":"#2d323c","--pd-menu-muted":"#8b91a0","--pd-menu-disabled":"#555b68","--pd-scrollbar":"rgba(255, 255, 255, .18)","--pd-scrollbar-thumb":"rgba(255, 255, 255, .16)","--pd-scrollbar-thumb-hover":"rgba(255, 255, 255, .3)","--pd-help-field-bg":"#16283a","--pd-help-field-line":"#2c5870","--pd-help-field-ink":"#7cc4f5","--pd-help-function-bg":"#162e22","--pd-help-function-line":"#2c5b3c","--pd-help-function-ink":"#79d69a","--pd-help-variable-bg":"#302c16","--pd-help-variable-line":"#6b5d24","--pd-help-variable-ink":"#d6b25e","--pd-help-conditional-bg":"#301a28","--pd-help-conditional-line":"#6b3454","--pd-help-conditional-ink":"#e58ab5","--pd-shadow-sm":"0 1px 2px rgba(0, 0, 0, .3)","--pd-shadow-md":"0 2px 8px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .5)"};function xi(e,t){(t==null||t>e.length)&&(t=e.length);for(var o=0,r=Array(t);o<t;o++)r[o]=e[o];return r}function dl(e){if(Array.isArray(e))return e}function pl(e,t){var o=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(o!=null){var r,i,n,s,d=[],c=!0,u=!1;try{if(n=(o=o.call(e)).next,t!==0)for(;!(c=(r=n.call(o)).done)&&(d.push(r.value),d.length!==t);c=!0);}catch(f){u=!0,i=f}finally{try{if(!c&&o.return!=null&&(s=o.return(),Object(s)!==s))return}finally{if(u)throw i}}return d}}function cl(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hl(e,t){return dl(e)||pl(e,t)||ul(e,t)||cl()}function ul(e,t){if(e){if(typeof e=="string")return xi(e,t);var o={}.toString.call(e).slice(8,-1);return o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set"?Array.from(e):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?xi(e,t):void 0}}const Mn=Object.entries,fl=Object.keys,wi=Object.setPrototypeOf,gl=Object.isFrozen,_n=Object.getPrototypeOf,Rn=Object.getOwnPropertyDescriptor;let me=Object.freeze,pe=Object.seal,st=Object.create,Fn=typeof Reflect<"u"&&Reflect,go=Fn.apply,vr=Fn.construct;me||(me=function(t){return t});pe||(pe=function(t){return t});go||(go=function(t,o){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];return t.apply(o,i)});vr||(vr=function(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),i=1;i<o;i++)r[i-1]=arguments[i];return new t(...r)});const Ze=oe(Array.prototype.forEach),ml=oe(Array.prototype.lastIndexOf),ki=oe(Array.prototype.pop),Nt=oe(Array.prototype.push),bl=oe(Array.prototype.slice),yl=oe(Array.prototype.splice),It=Array.isArray,Zo=In(Set),Qo=oe(Set.prototype.add),Bt=oe(Set.prototype.has),mt=oe(String.prototype.toLowerCase),Jo=oe(String.prototype.toString),vl=oe(String.prototype.match),no=oe(String.prototype.replace),er=oe(String.prototype.indexOf),xl=oe(String.prototype.trim),wl=oe(Number.prototype.toString),kl=oe(Boolean.prototype.toString),Ei=typeof BigInt>"u"?null:oe(BigInt.prototype.toString),Si=typeof Symbol>"u"?null:oe(Symbol.prototype.toString),Ee=oe(Object.prototype.hasOwnProperty),Ut=oe(Object.prototype.toString),El=RegExp.prototype.test,fe=function(t,o){return t instanceof RegExp&&(t.lastIndex=0),go(El,t,[o])},Qe=In(TypeError);function oe(e){return function(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),i=1;i<o;i++)r[i-1]=arguments[i];return go(e,t,r)}}function In(e){return function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return vr(e,o)}}function j(e,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:mt;if(wi&&wi(e,null),!It(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const n=o(i);n!==i&&(gl(t)||(t[r]=n),i=n)}e[i]=!0}return e}function Sl(e){for(let t=0;t<e.length;t++)Ee(e,t)||(e[t]=null);return e}function mo(e){const t=st(null);for(const r of Mn(e)){var o=hl(r,2);const i=o[0],n=o[1];Ee(e,i)&&(It(n)?t[i]=Sl(n):n&&typeof n=="object"&&n.constructor===Object?t[i]=mo(n):t[i]=n)}return t}function Wt(e){const t=st(null),o=fl(e);let r=o.length;for(;r--;)t[o[r]]=e[o[r]];return t}function Tl(e){switch(typeof e){case"string":return e;case"number":return wl(e);case"boolean":return kl(e);case"bigint":return Ei?Ei(e):"0";case"symbol":return Si?Si(e):"Symbol()";case"undefined":return Ut(e);case"function":case"object":{if(e===null)return Ut(e);const t=e,o=_e(t,"toString");if(typeof o=="function"){const r=o(t);return typeof r=="string"?r:Ut(r)}return Ut(e)}default:return Ut(e)}}function _e(e,t){for(;e!==null;){const r=Rn(e,t);if(r){if(r.get)return oe(r.get);if(typeof r.value=="function")return oe(r.value)}e=_n(e)}function o(){return null}return o}function Cl(e,t){for(;e!==null;){const o=Rn(e,t);if(o)return o.get?oe(o.get):null;e=_n(e)}return null}function Dl(e){if(!e)return!1;try{return fe(e,""),!0}catch{return!1}}const Ti=me(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),tr=me(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),or=me(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Pl=me(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),rr=me(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Al=me(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ci=me(["#text"]),Di=me(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),ir=me(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Pi=me(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ao=me(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ml=pe(/{{[\w\W]*|^[\w\W]*}}/g),_l=pe(/<%[\w\W]*|^[\w\W]*%>/g),Rl=pe(/\${[\w\W]*/g),Fl=pe(/{{|}}|\${|<%|%>|&lt;%|%&gt;/),Il=pe(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ll=pe(/^aria-[\-\w]+$/),Ai=pe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),zl=pe(/^(?:\w+script|data):/i),Ol=pe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Nl=pe(/^html$/i),Bl=pe(/^[a-z][.\w]*(-[.\w]+)+$/i),nr=pe(/<[/\w!]/g),Mi=pe(/<[/\w]/g),Ul=pe(/<\/no(script|embed|frames)/i),_i=pe(/\/>/i),Hl=pe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),$l=pe(/^[\r\n\t ]+/),se={element:1,text:3,processingInstruction:7,comment:8,document:9,documentFragment:11},Wl=me(j({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),Kl=function(){return typeof window>"u"?null:window},Vl=function(t,o){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";o&&o.hasAttribute(i)&&(r=o.getAttribute(i));const n="dompurify"+(r?"#"+r:"");try{return t.createPolicy(n,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},Ri=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},at=function(t,o,r,i){return Ee(t,o)&&It(t[o])?j(i.base?Wt(i.base):{},t[o],i.transform):r},ar=function(t,o,r){const i=Ee(t,o)?t[o]:void 0;return i&&typeof i=="object"?mo(i):r};function Ln(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Kl();const t=k=>Ln(k);if(t.version="3.4.18",t.removed=[],!e||!e.document||e.document.nodeType!==se.document||!e.Element)return t.isSupported=!1,t;let o=e.document;const r=o,i=r.currentScript,n=e.HTMLTemplateElement,s=e.Node,d=e.Element,c=e.NodeFilter,u=e.DOMParser,f=e.trustedTypes,b=d.prototype,m=_e(b,"cloneNode"),E=_e(b,"remove"),y=_e(b,"removeAttributeNode"),C=_e(b,"nextSibling"),D=_e(b,"childNodes"),S=_e(b,"parentNode"),_=_e(b,"shadowRoot"),z=_e(b,"attributes"),A=s&&s.prototype?_e(s.prototype,"nodeType"):null,I=s&&s.prototype?_e(s.prototype,"nodeName"):null,K=s&&s.prototype?_e(s.prototype,"ownerDocument"):null,B=function(p){return A?A(p):p.nodeType},L=function(p){return I?I(p):p.nodeName},U=Cl(b,"namespaceURI"),re=function(p){return U?U(p):p.namespaceURI};if(typeof n=="function"){const k=o.createElement("template");k.content&&k.content.ownerDocument&&(o=k.content.ownerDocument)}let V,he="",ie,Ce=!1,ke=0;const v=function(){if(ke>0)throw Qe('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ee=function(p){v(),ke++;try{return V.createHTML(p)}finally{ke--}},be=function(p){return V&&Ro?ee(p):p},He=function(p){v(),ke++;try{return V.createScriptURL(p)}finally{ke--}},W=function(){return Ce||(ie=Vl(f,i),Ce=!0),ie},ae=o,Re=ae.implementation,Fe=ae.createNodeIterator,qe=ae.createDocumentFragment,Y=ae.getElementsByTagName,Ye=r.importNode;let Z=Ri();t.isSupported=typeof Mn=="function"&&typeof S=="function"&&Re&&Re.createHTMLDocument!==void 0;const To=Ml,ct=_l,De=Rl,Me=Il,Co=Ll,Do=zl,Po=Ol,Ao=Bl;let jt=Ai,Q=null;const rt=j({},[...Ti,...tr,...or,...rr,...Ci]);let J=null;const it=j({},[...Di,...ir,...Pi,...ao]);let ue=null,ht=null,X=null;const Ie=Object.seal(st(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Lt=!0,x=!0,G=!1,ye=!0,te=!1,Le=!0,je=!1,Mo=!1,Xt=null,Zt=null,_o=!1,Et=!1,Qt=!1,Ro=!1,Gr=!0,qr=!1;const Yr="user-content-";let Fo=!0,Io=!1,ut=null,St=!1,ft=null;const jr=j({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Xr=null;const Zr=j({},["audio","video","img","source","image","track"]);let Qr=null;const Jr=j({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Jt="http://www.w3.org/1998/Math/MathML",eo="http://www.w3.org/2000/svg",$e="http://www.w3.org/1999/xhtml";let Tt=$e,Lo=!1,ei=null;const ra=j({},[Jt,eo,$e],Jo),ia=me(j({},["mi","mo","mn","ms","mtext"]));let zo=null;const na=me(j({},["annotation-xml"]));let Oo=null;const aa=me(st(null)),la=j({},["title","style","font","a","script"]);let zt=null;const sa=["application/xhtml+xml","text/html"],da="text/html";let le=null,to=null;const pa=o.createElement("form"),ti=function(p){return p instanceof RegExp||p instanceof Function},No=function(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(!p||typeof p!="object")&&(p={}),p=mo(p),zt=sa.indexOf(p.PARSER_MEDIA_TYPE)===-1?da:p.PARSER_MEDIA_TYPE,le=zt==="application/xhtml+xml"?Jo:mt,Q=at(p,"ALLOWED_TAGS",rt,{transform:le}),J=at(p,"ALLOWED_ATTR",it,{transform:le}),ei=at(p,"ALLOWED_NAMESPACES",ra,{transform:Jo}),Qr=at(p,"ADD_URI_SAFE_ATTR",Jr,{transform:le,base:Jr}),Xr=at(p,"ADD_DATA_URI_TAGS",Zr,{transform:le,base:Zr}),ft=at(p,"FORBID_CONTENTS",jr,{transform:le}),ht=at(p,"FORBID_TAGS",st(null),{transform:le}),X=at(p,"FORBID_ATTR",st(null),{transform:le}),St=Ee(p,"USE_PROFILES")?p.USE_PROFILES&&typeof p.USE_PROFILES=="object"?mo(p.USE_PROFILES):p.USE_PROFILES:!1,Lt=p.ALLOW_ARIA_ATTR!==!1,x=p.ALLOW_DATA_ATTR!==!1,G=p.ALLOW_UNKNOWN_PROTOCOLS||!1,ye=p.ALLOW_SELF_CLOSE_IN_ATTR!==!1,te=p.SAFE_FOR_TEMPLATES||!1,Le=p.SAFE_FOR_XML!==!1,je=p.WHOLE_DOCUMENT||!1,Et=p.RETURN_DOM||!1,Qt=p.RETURN_DOM_FRAGMENT||!1,Ro=p.RETURN_TRUSTED_TYPE||!1,_o=p.FORCE_BODY||!1,Gr=p.SANITIZE_DOM!==!1,qr=p.SANITIZE_NAMED_PROPS||!1,Fo=p.KEEP_CONTENT!==!1,Io=p.IN_PLACE||!1,jt=Dl(p.ALLOWED_URI_REGEXP)?p.ALLOWED_URI_REGEXP:Ai,Tt=typeof p.NAMESPACE=="string"?p.NAMESPACE:$e,zo=ar(p,"MATHML_TEXT_INTEGRATION_POINTS",ia),Oo=ar(p,"HTML_INTEGRATION_POINTS",na);const g=ar(p,"CUSTOM_ELEMENT_HANDLING",aa);if(ue=st(null),Ee(g,"tagNameCheck")&&ti(g.tagNameCheck)&&(ue.tagNameCheck=g.tagNameCheck),Ee(g,"attributeNameCheck")&&ti(g.attributeNameCheck)&&(ue.attributeNameCheck=g.attributeNameCheck),Ee(g,"allowCustomizedBuiltInElements")&&typeof g.allowCustomizedBuiltInElements=="boolean"&&(ue.allowCustomizedBuiltInElements=g.allowCustomizedBuiltInElements),pe(ue),te&&(x=!1),Qt&&(Et=!0),St&&((Ee(p,"ALLOWED_TAGS")||Ee(p,"ALLOWED_ATTR"))&&typeof console<"u"&&typeof console.warn=="function"&&console.warn("DOMPurify: USE_PROFILES overrides ALLOWED_TAGS and ALLOWED_ATTR. Do not use these options together."),Q=j({},Ci),J=st(null),St.html===!0&&(j(Q,Ti),j(J,Di)),St.svg===!0&&(j(Q,tr),j(J,ir),j(J,ao)),St.svgFilters===!0&&(j(Q,or),j(J,ir),j(J,ao)),St.mathMl===!0&&(j(Q,rr),j(J,Pi),j(J,ao))),Ie.tagCheck=null,Ie.attributeCheck=null,Ee(p,"ADD_TAGS")&&(typeof p.ADD_TAGS=="function"?Ie.tagCheck=p.ADD_TAGS:It(p.ADD_TAGS)&&(Q===rt&&(Q=Wt(Q)),j(Q,p.ADD_TAGS,le))),Ee(p,"ADD_ATTR")&&(typeof p.ADD_ATTR=="function"?Ie.attributeCheck=p.ADD_ATTR:It(p.ADD_ATTR)&&(J===it&&(J=Wt(J)),j(J,p.ADD_ATTR,le))),Ee(p,"ADD_FORBID_CONTENTS")&&It(p.ADD_FORBID_CONTENTS)&&(ft===jr&&(ft=Wt(ft)),j(ft,p.ADD_FORBID_CONTENTS,le)),Fo&&(Q["#text"]=!0),je&&j(Q,["html","head","body"]),Q.table&&(Q.tbody=!0,delete ht.tbody),p.TRUSTED_TYPES_POLICY){if(typeof p.TRUSTED_TYPES_POLICY.createHTML!="function")throw Qe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof p.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Qe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const w=V;V=p.TRUSTED_TYPES_POLICY;try{he=ee("")}catch(T){throw V=w,T}}else p.TRUSTED_TYPES_POLICY===null?(V=void 0,he=""):(V===void 0&&(V=W()),V&&typeof he=="string"&&(he=ee("")));to=me(p)},oi=j({},[...tr,...or,...Pl]),ri=j({},[...rr,...Al]),ca=function(p,g,w){return g===$e?p==="svg":g===Jt?p==="svg"&&(w==="annotation-xml"||zo[w]):!!oi[p]},ha=function(p,g,w){return g===$e?p==="math":g===eo?p==="math"&&Oo[w]:!!ri[p]},ua=function(p,g,w){return g===eo&&!Oo[w]||g===Jt&&!zo[w]?!1:!ri[p]&&(la[p]||!oi[p])},fa=function(p){const g=re(p),w=mt(L(p)),T=S(p);let F=Tt,O="template";return T&&B(T)===se.element&&(F=re(T),O=mt(L(T))),ei[g]?g===eo?ca(w,F,O):g===Jt?ha(w,F,O):g===$e?ua(w,F,O):zt==="application/xhtml+xml":!1},nt=function(p){Nt(t.removed,{element:p});try{S(p).removeChild(p)}catch{if(E(p),!S(p))throw Qe("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ii=function(p,g,w){try{y(p,g)}catch{try{p.removeAttribute(w)}catch{}}},Bo=function(p){$o(p);const g=D(p);g&&Ze(bl(g),w=>{try{E(w)}catch{}}),B(p)===se.element&&Uo(p,!1)},Ct=function(p,g,w){if(!w)try{w=g.getAttributeNode(p)}catch{w=null}if(Nt(t.removed,{attribute:w||null,from:g}),w)ii(g,w,p);else try{g.removeAttribute(p)}catch{}if(p==="is")if(Et||Qt)try{nt(g)}catch{}else try{g.setAttribute(p,"")}catch{}},Uo=function(p,g){const w=z(p);if(w)for(let T=w.length-1;T>=0;--T){const F=w[T],O=F&&F.name;typeof O=="string"&&!(g&&J[le(O)])&&ii(p,F,O)}},Ho=function(p,g){let w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const T=[p];for(;T.length>0;){const F=T.pop();if(g(F)===!1)continue;if(w&&B(F)===se.element){const $=_(F);Dt($)&&T.push($)}const O=D(F);if(O)for(let $=O.length-1;$>=0;--$)T.push(O[$])}},$o=function(p){Ho(p,g=>{B(g)===se.element&&Uo(g,!0)})},Wo=function(p){const g=[];return Ho(p,w=>{g.push(w)},!0),g},ga=function(p,g){const w=Zo();Ze(Wo(p),T=>{B(T)===se.element&&Qo(w,T)}),Ze(g,T=>{B(T)===se.element&&!Bt(w,T)&&Uo(T,!0)})},ni=function(p,g){let w=!1;return Ze(t.removed,T=>{T.element&&(w=w||T.element===p,$o(T.element))}),ga(p,g),w},ma=8,ba=function(p,g){const w=ut;let T=null;const F=()=>(T||(T=Zo(),Ze(g,O=>{Qo(T,O)})),T);for(let O=0;;O++){const $=Wo(p),ce=[p];let Xe=!1;if(Ze($,Oe=>{B(Oe)===se.documentFragment?Nt(ce,Oe):!Xe&&!Bt(w,Oe)&&(Xe=Bt(F(),Oe))}),!Xe)return;if(O>=ma)throw Qe("the tree kept changing during in-place sanitization; refusing to return it");Ze(ce,(Oe,Pe)=>{ya(Oe,Pe>0,p,F())})}},ya=function(p,g,w,T){const F=oo(p);let O;for(;O=F.nextNode();)!Bt(T,O)||Bt(ut,O)||(g&&ze(Z.uponSanitizeShadowNode,O,null),qo(O,w))},va=function(p){ut&&Qo(ut,p)},ai=function(p,g){return Le?p==="patchsrc"?!0:p==="for"&&g!=="label"&&g!=="output":!1},xa=function(p){Le&&Ho(p,g=>{const w=B(g);if(w===se.processingInstruction||w===se.comment&&fe(Mi,g.data)){try{E(g)}catch{}return!1}if(w===se.element){const T=g,F=le(L(g));try{T.hasAttribute&&T.hasAttribute("patchsrc")&&T.removeAttribute("patchsrc"),T.hasAttribute&&T.hasAttribute("for")&&ai("for",F)&&T.removeAttribute("for")}catch{}}return!0})},li=function(p){let g=null,w=null;if(_o)p="<remove></remove>"+p;else{const O=vl(p,$l);w=O&&O[0]}zt==="application/xhtml+xml"&&Tt===$e&&(p='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+p+"</body></html>");const T=V?ee(p):p;if(Tt===$e)try{g=new u().parseFromString(T,zt)}catch{}if(!g||!g.documentElement){g=Re.createDocument(Tt,"template",null);try{g.documentElement.innerHTML=Lo?he:T}catch{}}const F=g.body||g.documentElement;return p&&w&&F.insertBefore(o.createTextNode(w),F.childNodes[0]||null),Tt===$e?Y.call(g,je?"html":"body")[0]:je?g.documentElement:F},oo=function(p){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const w=K?K(p):p.ownerDocument;return Fe.call(w||p,p,(g?0:c.SHOW_ELEMENT)|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ko=function(p){return p=no(p,To," "),p=no(p,ct," "),p=no(p,De," "),p},Vo=function(p){var g;Go(p);const w=(g=p.querySelectorAll)===null||g===void 0?void 0:g.call(p,"template");w&&Ze(w,T=>{Dt(T.content)&&Vo(T.content)})},Go=function(p){p.normalize();const g=oo(p,!0);let w=g.nextNode();for(;w;)w.data=Ko(w.data),w=g.nextNode()},ro=function(p){const g=I?I(p):null;return typeof g!="string"||le(g)!=="form"?!1:typeof p.nodeName!="string"||typeof p.textContent!="string"||typeof p.removeChild!="function"||p.attributes!==z(p)||typeof p.removeAttribute!="function"||typeof p.removeAttributeNode!="function"||typeof p.getAttributeNode!="function"||typeof p.setAttribute!="function"||typeof p.namespaceURI!="string"||typeof p.insertBefore!="function"||typeof p.hasChildNodes!="function"||p.nodeType!==A(p)||p.childNodes!==D(p)},si=function(p){if(!A||typeof p!="object"||p===null)return null;try{const g=A(p);return typeof g=="number"?g:null}catch{return null}},Dt=function(p){return si(p)===se.documentFragment},Ot=function(p){return si(p)!==null};function ze(k,p,g){k.length!==0&&Ze(k,w=>{w.call(t,p,g,to)})}const wa=function(p,g,w){return!!(Le&&w===se.element&&p.hasChildNodes()&&!Ot(p.firstElementChild)&&fe(nr,p.textContent)&&fe(nr,p.innerHTML)||Le&&Wl[g]&&w===se.element&&re(p)===$e&&(Ot(p.firstElementChild)||typeof p.textContent=="string"&&fe(nr,p.textContent))||w===se.processingInstruction||Le&&w===se.comment&&fe(Mi,p.data))},io=function(p,g){if(p instanceof RegExp)return fe(p,g);if(p instanceof Function){for(var w=arguments.length,T=new Array(w>2?w-2:0),F=2;F<w;F++)T[F-2]=arguments[F];return!!p(g,...T)}return!1},ka=function(p,g,w){if(!ht[g]&&ci(g)&&io(ue.tagNameCheck,g))return!1;if(Fo&&!ft[g]&&!ft[mt(g)]){const T=S(p),F=D(p);if(F&&T){const O=F.length;for(let $=O-1;$>=0;--$){const ce=p===w?m(F[$],!0):F[$];T.insertBefore(ce,C(p))}}}return nt(p),!0},di=function(p,g,w,T){return p.length===0?g:g===w||g===T?Wt(g):g},Pt=function(p,g){return p===g||S(p)!==null?!1:(Io&&$o(p),!0)},Ea=function(p,g){if(va(p),ze(Z.beforeSanitizeElements,p,null),Pt(p,g))return!0;if(ro(p))return nt(p),!0;const w=le(L(p)),T=B(p);if(Q=di(Z.uponSanitizeElement,Q,rt,Xt),ze(Z.uponSanitizeElement,p,{tagName:w,allowedTags:Q}),Pt(p,g))return!0;if(wa(p,w,T))return nt(p),!0;if(ht[w]||!(Ie.tagCheck instanceof Function&&Ie.tagCheck(w))&&!Q[w]){const F=ka(p,w,g);return F===!1&&(ze(Z.afterSanitizeElements,p,null),Pt(p,g))?!0:F}if(T===se.element&&!fa(p)||(w==="noscript"||w==="noembed"||w==="noframes")&&fe(Ul,p.innerHTML))return nt(p),!0;if(te&&T===se.text){const F=p.textContent,O=Ko(F);F!==O&&(Nt(t.removed,{element:p.cloneNode()}),p.textContent=O)}return ze(Z.afterSanitizeElements,p,null),Pt(p,g)},pi=function(p,g,w){if(X[g]||ai(g,p)||Gr&&(g==="id"||g==="name")&&(w in o||w in pa))return!1;const T=J[g]||Ie.attributeCheck instanceof Function&&Ie.attributeCheck(g,p);if(x&&fe(Me,g)||Lt&&fe(Co,g))return!0;if(!T)return ci(p)&&io(ue.tagNameCheck,p)&&io(ue.attributeNameCheck,g,p)||g==="is"&&ue.allowCustomizedBuiltInElements&&io(ue.tagNameCheck,w);if(Qr[g])return!0;const F=no(w,Po,"");return fe(jt,F)||(g==="src"||g==="xlink:href"||g==="href")&&p!=="script"&&er(w,"data:")===0&&Xr[p]||G&&!fe(Do,F)?!0:!w},Sa=j({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ci=function(p){return!Sa[mt(p)]&&fe(Ao,p)},Ta=function(p,g,w,T){if(V&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!w)switch(f.getAttributeType(p,g)){case"TrustedHTML":return ee(T);case"TrustedScriptURL":return He(T)}return T},Ca=function(p,g,w,T){try{return w?p.setAttributeNS(w,g,T):p.setAttribute(g,T),ro(p)?(nt(p),!1):!0}catch{return Ct(g,p),!1}},hi=function(p,g){return Le&&fe(Hl,g)?!0:mt(p)==="attributename"&&er(g,"href")!==-1},Da=function(p,g){if(ze(Z.beforeSanitizeAttributes,p,null),Pt(p,g))return;const w=p.attributes;if(!w||ro(p))return;J=di(Z.uponSanitizeAttribute,J,it,Zt);const T={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0};let F=w.length;const O=le(L(p));for(;F--;){const $=w[F],ce=$.name,Xe=$.namespaceURI,Oe=$.value,Pe=le(ce),We=Oe;let ve=ce==="value"?We:xl(We),ui=!1;if(T.attrName=Pe,T.attrValue=ve,T.keepAttr=!0,T.forceKeepAttr=void 0,ze(Z.uponSanitizeAttribute,p,T),ve=T.attrValue,qr&&(Pe==="id"||Pe==="name")&&er(ve,Yr)!==0&&(Ct(ce,p,$),ve=Yr+ve,ui=!0),hi(ce,ve)){Ct(ce,p,$);continue}if(!T.forceKeepAttr){if(!T.keepAttr){Ct(ce,p,$);continue}if(!ye&&fe(_i,ve)){Ct(ce,p,$);continue}if(te&&(ve=Ko(ve)),!pi(O,Pe,ve)){Ct(ce,p,$);continue}ve=Ta(O,Pe,Xe,ve),ve!==We&&Ca(p,ce,Xe,ve)&&ui&&ki(t.removed)}}ze(Z.afterSanitizeAttributes,p,null),Pt(p,g)},qo=function(p,g){Ea(p,g),Da(p,g),Dt(p.content)&&Yo(p.content)},Yo=function(p){let g=null;const w=oo(p);for(ze(Z.beforeSanitizeShadowDOM,p,null);g=w.nextNode();)if(ze(Z.uponSanitizeShadowNode,g,null),qo(g,p),B(g)===se.element){const T=_(g);Dt(T)&&(jo(T),Yo(T))}te&&Go(p),ze(Z.afterSanitizeShadowDOM,p,null)},jo=function(p){const g=[{node:p,shadow:null}];for(;g.length>0;){const w=g.pop();if(w.shadow){Yo(w.shadow);continue}const T=w.node,F=B(T)===se.element,O=D(T);if(O)for(let $=O.length-1;$>=0;--$)g.push({node:O[$],shadow:null});if(F){const $=I?I(T):null;if(typeof $=="string"&&le($)==="template"){const ce=T.content;Dt(ce)&&g.push({node:ce,shadow:null})}}if(F){const $=_(T);Dt($)&&g.push({node:null,shadow:$},{node:$,shadow:null})}}};return t.sanitize=function(k){let p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=null,w=null,T=null,F=null;if(Lo=!k,Lo&&(k="<!-->"),typeof k!="string"&&!Ot(k)&&(k=Tl(k),typeof k!="string"))throw Qe("dirty is not a string, aborting");if(!t.isSupported)return k;Mo?(Q=Xt,J=Zt):No(p),t.removed=[];const O=Io&&typeof k!="string"&&Ot(k);let $=[];const ce=ut;if(O){xa(k);const We=L(k);if(typeof We=="string"){const ve=le(We);if(!Q[ve]||ht[ve])throw Bo(k),Qe("root node is forbidden and cannot be sanitized in-place")}if(ro(k))throw Bo(k),Qe("root node is clobbered and cannot be sanitized in-place");$=Wo(k),ut=Zo()}else if(Ot(k))g=li("<!---->"),w=g.ownerDocument.importNode(k,!0),w.nodeType===se.element&&w.nodeName==="BODY"||w.nodeName==="HTML"?g=w:g.appendChild(w),jo(g);else{if(!Et&&!te&&!je&&k.indexOf("<")===-1)return be(k);if(g=li(k),!g)return Et?null:Ro?he:""}g&&_o&&nt(g.firstChild);const Xe=O?k:g;try{O&&jo(k);const We=oo(Xe);for(;T=We.nextNode();)qo(T,Xe);O&&ba(k,$)}catch(We){throw O&&(Bo(k),ni(k,$)),We}finally{ut=ce}if(O){if(ni(k,$))throw Qe("a node selected for removal could not be safely returned; refusing to sanitize in place");return te&&Vo(k),k}if(Et){if(te&&Vo(g),Qt)for(F=qe.call(g.ownerDocument);g.firstChild;)F.appendChild(g.firstChild);else F=g;return(J.shadowroot||J.shadowrootmode)&&(F=Ye.call(r,F,!0)),F}const Oe=()=>je?g.outerHTML:g.innerHTML;let Pe=Oe();return te&&fe(Fl,Pe)&&(Go(g),Pe=Oe()),je&&Q["!doctype"]&&g.ownerDocument&&g.ownerDocument.doctype&&g.ownerDocument.doctype.name&&fe(Nl,g.ownerDocument.doctype.name)&&(Pe="<!DOCTYPE "+g.ownerDocument.doctype.name+`>
3
+ `+Pe),be(Pe)},t.setConfig=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};No(k),Mo=!0,Xt=Q,Zt=J},t.clearConfig=function(){to=null,Mo=!1,Xt=null,Zt=null,V=ie,he=""},t.isValidAttribute=function(k,p,g){to||No({});const w=le(k),T=le(p);return typeof g=="string"&&(hi(p,g)||!ye&&fe(_i,g))?!1:pi(w,T,g)},t.addHook=function(k,p){typeof p=="function"&&Ee(Z,k)&&Nt(Z[k],p)},t.removeHook=function(k,p){if(Ee(Z,k)){if(p!==void 0){const g=ml(Z[k],p);return g===-1?void 0:yl(Z[k],g,1)[0]}return ki(Z[k])}},t.removeHooks=function(k){Ee(Z,k)&&(Z[k]=[])},t.removeAllHooks=function(){Z=Ri()},t}var Gl=Ln();const ql={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"};function Yl(e,t){const o=e.options;return h.resolveBarcodeDesignValue(o.formatter,t,String(o.testData||o.title||""))||"1234567890128"}function jl(e){return l("div",{class:"print-qrcode",dataset:{codeId:e.id,codeKind:"qrcode"}})}function Xl(e){const t=e.options;return l("div",{class:"print-barcode",dataset:{codeId:e.id,codeKind:"barcode"}},[l("svg",{preserveAspectRatio:ql[String(t.fit||"contain")]??"xMidYMid meet",style:{maxWidth:"100%",maxHeight:"100%"}})])}function Zl(e){const t=(e.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return t.length!==4||t.some(o=>!Number.isFinite(o))?null:{width:t[2],height:t[3]}}function Ql(e,t,o){const r=e.options,i=h.barcodeUnitsPerModule(r.barWidth),n=h.barcodeQuietZoneModules(r.barQuietZone),s=d=>{pn(t,Yl(e,o),{format:String(r.barcodeType||"CODE128"),width:i,height:d*i,displayValue:!r.hideTitle,fontSize:(r.fontSize??h.BARCODE_TEXT_FONT_SIZE_MODULES)*i,margin:0,marginLeft:n*i,marginRight:n*i,marginTop:0,marginBottom:h.BARCODE_MARGIN_BOTTOM_MODULES*i});const c=Zl(t);return c?{widthUnits:c.width,heightUnits:c.height}:null};try{const d=h.layoutBarcodeSize({barHeightMm:r.barHeight,boxWidthMm:h.barcodeAvailableBoxMm(r.width,r.maxWidth),boxHeightMm:h.barcodeAvailableBoxMm(r.height,r.maxHeight),dpi:r.printerDpi,barWidth:r.barWidth,measure:s});t.style.width=d.size?`${d.size.widthMm}mm`:"",t.style.height=d.size?`${d.size.heightMm}mm`:""}catch{t.replaceChildren();return}t.setAttribute("shape-rendering","crispEdges")}function Jl(e,t,o){const r=e.options,i=h.resolveBarcodeDesignValue(r.formatter,o,String(r.testData||r.title||""))||N("code.k27");t.replaceChildren();try{const n=Dr.browserCodeRenderer.render(i,"qrcode",{qrCodeLevel:String(r.qrCodeLevel??"M"),qrQuietZone:typeof r.qrQuietZone=="number"?r.qrQuietZone:void 0}),s=document.createElement("img");s.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`,s.alt="qrcode",s.style.width="100%",s.style.height="100%",s.style.objectFit=String(r.fit||"contain"),s.style.maxWidth=r.maxWidth?`${r.maxWidth}mm`:"100%",s.style.maxHeight=r.maxHeight?`${r.maxHeight}mm`:"100%",t.appendChild(s)}catch{}}function es(e,t,o){for(const r of Array.from(e.querySelectorAll("[data-code-kind]"))){const i=r.dataset.codeId,n=t.find(s=>s.id===i);if(n)if(r.dataset.codeKind==="barcode"){const s=r.querySelector("svg");s&&Ql(n,s,o)}else Jl(n,r,o)}}const bo=new Map;function ts(e){return typeof Node<"u"&&e instanceof Node}function zn(e,t,o){if(On(e),typeof t=="string"){o.innerHTML=t;return}if(ts(t)){o.appendChild(t);return}typeof t.node=="string"?o.innerHTML=t.node:o.appendChild(t.node),typeof t.dispose=="function"&&bo.set(e,t.dispose)}function On(e){const t=bo.get(e);if(t){bo.delete(e);try{t()}catch{}}}function Fi(){for(const e of[...bo.keys()])On(e)}const os={header:"table.k450",data:"table.k451",subtotal:"table.k452",summary:"table.k453"},rs=[{value:"header",labelKey:"table.k454"},{value:"data",labelKey:"table.k455"},{value:"subtotal",labelKey:"table.k456"},{value:"summary",labelKey:"table.k457"}],co=3.7795275591,is=.1,xr=e=>JSON.parse(JSON.stringify(e)),Ii=new WeakMap;function ot(e){let t=Ii.get(e);return t||(t={menu:null,menuElId:null,anchor:null,layouts:new Map},Ii.set(e,t)),t}function Yt(e,t){return e.templateData.elements.find(o=>o.id===t)??null}function ns(e,t){const o=e.tableSelection;return!o||o.elementId!==t.id?null:e.selectedElement?.id!==t.id?(e.tableSelection=null,null):o}function Nn(e,t,o,r){const i=Yt(e,o.id);if(!i)return null;const n=o.options;return{store:e,fire:t,el:o,real:i,options:n,rows:n.tableRows??[],colWidths:n.tableColWidths??[],isSelected:e.selectedIds.has(o.id),selection:ns(e,o),maxTableWidth:Bn(e),designData:r}}function Bn(e){return e.paperSize.width-e.templateData.margins.left-e.templateData.margins.right}function Br(e){return e.options.tableDefaultFontSize??10}function Un(e){return e.options.tableDefaultColor??"#333333"}function as(e,t){let o=0;for(let r=0;r<t;r++)o+=e.rows[r].height;return o}function ls(e,t){return ot(e.store).layouts.get(e.el.id)?.[t]?.top??as(e,t)}function ss(e,t){return ot(e.store).layouts.get(e.el.id)?.[t]?.height??e.rows[t]?.height??0}function ds(e){const t=e.options.dataSource;if(t&&Array.isArray(h.DEFAULT_DEMO_DATA[t]))return h.DEFAULT_DEMO_DATA[t];for(const o of Object.values(h.DEFAULT_DEMO_DATA))if(Array.isArray(o))return o}function Hn(e){return e.cellType==="barcode"||e.cellType==="qrcode"}function $n(e,t){return Hn(t)?h.resolveBarcodeDesignValue(t.formatter,ds(e)):t.formatter||""}function ps(e,t){const o={designMode:!0,showGhostBorder:e.store.showTableGhostBorder};return{fontFamily:R.resolveCanvasFontFamily(t.fontFamily??e.options.tableDefaultFontFamily),textAlign:t.align??"left",...t.align==="justify"?{textAlignLast:"justify"}:{},verticalAlign:t.valign??"middle",fontSize:(t.fontSize??Br(e))+"pt",fontWeight:t.fontWeight??"normal",color:t.color??Un(e),backgroundColor:t.backgroundColor??"transparent",borderTop:h.resolveCellBorderCss(t.borders?.top,o),borderRight:h.resolveCellBorderCss(t.borders?.right,o),borderBottom:h.resolveCellBorderCss(t.borders?.bottom,o),borderLeft:h.resolveCellBorderCss(t.borders?.left,o),padding:(t.padding??e.options.tableDefaultPadding??1)+"mm",whiteSpace:t.wordWrap??!0?"pre-wrap":"nowrap",overflow:t.wordWrap??!0?"visible":"hidden"}}function cs(e,t,o){const r=e.selection;return[!!r&&t>=r.r1&&t<=r.r2&&o>=r.c1&&o<=r.c2?"cell-selected":"",e.rows[t]?.type==="data"?"row-data-bg":""].filter(Boolean).join(" ")}function Wn(e){return h.resolveCellTextFit(e)}function hs(e){return Wn(e)!=="autoHeight"}function us(e,t){return t.fontSize??Br(e)}function wo(e,t,o){return h.cellFitCapMm(e.rows,t,o,e.options.tableDefaultPadding??1)}function fs(e,t,o){return h.cellFitWidthMm(e.colWidths,t,o,e.options.tableDefaultPadding??1)}function gs(e,t,o){return{maxHeight:wo(e,o,t)+"mm",overflow:"hidden",...t.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{}}}function ms(e,t,o){const r={fitBase:String(us(e,t)),fitMin:String(h.resolveShrinkMinFontSize(t.shrinkMinFontSize)),fitMm:String(wo(e,o,t))};return Wn(t)==="shrink"&&(r.fit="shrink"),r}function bs(e){const t=(e.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return t.length!==4||t.some(o=>!Number.isFinite(o))?null:{width:t[2],height:t[3]}}const ys={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"};function vs(e,t,o,r){const i=document.createElement("div");i.className="cell-barcode";const n=document.createElementNS(Ra,"svg");i.appendChild(n);const s=$n(e,r);if(r.cellType==="barcode"){n.setAttribute("preserveAspectRatio",ys[r.fit||"contain"]??"xMidYMid meet");const d=h.barcodeUnitsPerModule(r.barWidth),c=h.barcodeQuietZoneModules(r.barQuietZone),u=m=>{pn(n,s,{format:r.barcodeType||"CODE128",width:d,height:m*d,displayValue:r.showBarcodeText!==!1,fontSize:(r.barFontSize??h.BARCODE_TEXT_FONT_SIZE_MODULES)*d,margin:0,marginLeft:c*d,marginRight:c*d,marginTop:0,marginBottom:h.BARCODE_MARGIN_BOTTOM_MODULES*d});const E=bs(n);return E?{widthUnits:E.width,heightUnits:E.height}:null};let f=null;try{f=h.layoutBarcodeSize({barHeightMm:r.barHeight,boxWidthMm:h.barcodeAvailableBoxMm(fs(e,o,r),r.maxWidth),boxHeightMm:h.barcodeAvailableBoxMm(wo(e,t,r),r.maxHeight),dpi:r.printerDpi,barWidth:r.barWidth,measure:u})}catch{f=null}if(!f){n.style.display="none";const m=document.createElement("span");return m.className="cell-barcode-fallback",m.textContent=s||a(e,"table.k458"),i.appendChild(m),i}const b=f.size;return b?(n.style.width=`${b.widthMm}mm`,n.style.height=`${b.heightMm}mm`):(n.style.maxWidth=r.maxWidth?`${r.maxWidth}mm`:"100%",n.style.maxHeight=r.maxHeight?`${r.maxHeight}mm`:"100%"),n.setAttribute("shape-rendering","crispEdges"),i}if(n.style.display="none",!s)return i;try{const d=Dr.browserCodeRenderer.render(s,"qrcode",{qrCodeLevel:String(r.qrCodeLevel||"M"),qrQuietZone:typeof r.qrQuietZone=="number"?r.qrQuietZone:void 0}),c=document.createElement("img");c.setAttribute("src",`data:image/svg+xml;charset=utf-8,${encodeURIComponent(d)}`),c.setAttribute("alt","qrcode"),c.style.width="100%",c.style.height="100%",c.style.objectFit=r.fit||"contain",r.objectPosition&&(c.style.objectPosition=r.objectPosition),c.style.maxWidth=r.maxWidth?`${r.maxWidth}mm`:"100%",c.style.maxHeight=r.maxHeight?`${r.maxHeight}mm`:"100%",i.appendChild(c)}catch{}return i}function Li(){const e=document.createElement("div");return e.className="image-placeholder",e.textContent=N("table.k459"),e}function xs(e,t){const o=e.formatter||"";if(!o)return"";if(!o.includes("{"))return o;const r=t.designData?.length?t.designData[0]:h.DEFAULT_DEMO_DATA;return h.evaluateTemplate(o,r)}function ws(e,t,o){const r=document.createElement("div");r.className="cell-image";const i=h.cellImageBoxMm(o.fit,wo(e,t,o));i!==void 0&&(r.style.height=`${i}mm`);const n=xs(o,e);if(!n)return r.appendChild(Li()),r;const s=document.createElement("img");s.setAttribute("src",n),i!==void 0&&(s.style.width="100%",s.style.height="100%"),s.style.objectFit=o.fit||"contain";for(const[d,c]of Object.entries(h.cropStyleDeclarations(o.fit,o.fitScale,o.objectPosition)))s.style[d]=c;return s.style.maxWidth=o.maxWidth?`${o.maxWidth}mm`:"100%",s.style.maxHeight=o.maxHeight?`${o.maxHeight}mm`:"100%",s.addEventListener("error",()=>{s.remove(),r.appendChild(Li())},{once:!0}),r.appendChild(s),r}function ks(e,t,o,r,i){if(Hn(i))return vs(e,o,r,i);if(i.cellType==="image")return ws(e,o,i);const n=$n(e,i),s=()=>t.type==="data"?l("span",{class:"data-placeholder",text:n}):n;return hs(i)?l("div",{class:"cell-fit",style:gs(e,i,o),dataset:ms(e,i,o)},[s()]):s()}function yo(e,t,o){const r={elementId:e.el.id,...h.normalizeSelection(e.rows,t,o)};e.store.setTableSelection(r),e.fire("table-selection-change",{elementId:e.el.id,selection:r})}function Es(e,t,o,r,i){if(i.button!==0||(e.fire("table-cell-mousedown",{elementId:e.el.id,r:t,c:o,cellId:r,event:i}),!e.isSelected))return;i.stopPropagation();const n=ot(e.store);i.shiftKey&&e.selection?yo(e,{r:e.selection.r1,c:e.selection.c1},{r:t,c:o}):(n.anchor={r:t,c:o},yo(e,{r:t,c:o},{r:t,c:o})),document.addEventListener("mouseup",()=>{ot(e.store).anchor=null},{once:!0})}function Ss(e,t,o){const r=ot(e.store).anchor;r&&yo(e,r,{r:t,c:o})}function Ur(e,t){const o=ot(e);o.menu?.visible&&(o.menu.visible=!1,t("table-menu-close",{elementId:o.menuElId}),e.emit(!1))}function Ts(e,t,o,r){r.preventDefault(),r.stopPropagation(),e.isSelected||e.store.selectOne(e.el.id);const i=e.selection;i&&t>=i.r1&&t<=i.r2&&o>=i.c1&&o<=i.c2||yo(e,{r:t,c:o},{r:t,c:o});const s=ot(e.store);s.menuElId=e.el.id,s.menu&&(s.menu.x=r.clientX,s.menu.y=r.clientY,s.menu.visible=!0),e.fire("table-cell-contextmenu",{elementId:e.el.id,r:t,c:o,clientX:r.clientX,clientY:r.clientY}),e.store.emit(!1),document.addEventListener("mousedown",()=>Ur(e.store,e.fire),{once:!0})}function zi(e,t,o){const r=e.reduce((i,n)=>i+n,0)+(e[t]??0);return r>o?N("table.k460",{v0:Math.round(r*10)/10,v1:o}):null}function Cs(e,t){const o=e.real.options.tableRows??[],r=e.real.options.tableColWidths??[],i=t(xr(o),xr(r));return i?(window.alert(i),!1):(e.store.recordHistory(),t(o,r),e.store.setTableSelection(null),h.syncTableElementSize(e.real.options),e.store.emit(),!0)}function Je(e,t,o){Ur(e.store,e.fire);const r=e.selection;if(!r)return;let i=null;switch(t){case"insert-row-above":i=n=>(h.insertRow(n,r.r1,"above"),null);break;case"insert-row-below":i=n=>(h.insertRow(n,r.r2,"below"),null);break;case"delete-row":i=n=>h.deleteRow(n,r.r1);break;case"insert-col-left":i=(n,s)=>{const d=zi(s,r.c1,e.maxTableWidth);return d||(h.insertCol(n,s,r.c1,"left"),null)};break;case"insert-col-right":i=(n,s)=>{const d=zi(s,r.c2,e.maxTableWidth);return d||(h.insertCol(n,s,r.c2,"right"),null)};break;case"delete-col":i=(n,s)=>h.deleteCol(n,s,r.c1);break;case"merge":i=n=>(h.mergeCells(n,r),null);break;case"split":i=n=>(h.splitCells(n,r),null);break;case"set-row-type":i=n=>o?h.setRowType(n,r.r1,o):a(e,"table.k461");break}i&&Cs(e,i)&&e.fire(`table-${t}`,{elementId:e.el.id,...o?{type:o}:{}})}function Ds(e){const t=e.selection;if(!t)return!1;for(let o=t.r1;o<=t.r2;o++)for(let r=t.c1;r<=t.c2;r++){const i=e.rows[o]?.cells[r];if(i&&!i.merged&&((i.rowspan??1)>1||(i.colspan??1)>1))return!0}return!1}function Ps(e){const t=e.selection;if(!t)return;const o=h.findMainCell(e.rows,t.r1,t.c1),r=!e.rows[o.r]?.cells[o.c]?.mergeSameValue;for(let i=t.r1;i<=t.r2;i++)for(let n=t.c1;n<=t.c2;n++){const s=e.rows[i]?.cells[n];s&&!s.merged&&(s.mergeSameValue=r)}e.store.updateElement(e.el.id,{tableRows:e.rows}),Ur(e.store,e.fire)}function Oi(e){const t=e.selection;if(!t)return a(e,"table.k462");for(let o=t.r1;o<=t.r2;o++)if(e.rows[o]?.type!=="data")return a(e,"table.k463");return null}function Ni(e,t){const o=e.selection;return o?o.r1!==o.r2?a(e,"table.k465"):h.setRowType(xr(e.rows),o.r1,t):a(e,"table.k464")}function Ke(e,t,o={}){return l("div",{class:`menu-item${o.disabled?" disabled":""}${o.active?" active":""}`,title:o.title||"",text:e,onClick:()=>{o.disabled||t()}})}const lr=()=>l("div",{class:"menu-divider"});function As(e,t,o){const r=ot(e);if(r.menu=o,!o.visible||!r.menuElId)return"";const i=Yt(e,r.menuElId);if(!i||i.printElementType.type!=="table")return"";const n=Nn(e,t,i);if(!n)return"";const s=n.selection?h.canMergeReason(n.rows,n.selection):a(n,"table.k466"),d=n.selection?n.rows[n.selection.r1]?.type??null:null;return l("div",{class:"table-ctx-menu",style:{left:o.x+"px",top:o.y+"px"},onMousedown:c=>c.stopPropagation()},[Ke(a(n,"table.k467"),()=>Je(n,"insert-row-above")),Ke(a(n,"table.k468"),()=>Je(n,"insert-row-below")),Ke(a(n,"table.k469"),()=>Je(n,"delete-row"),{disabled:n.rows.length<=1}),lr(),Ke(a(n,"table.k470"),()=>Je(n,"insert-col-left")),Ke(a(n,"table.k471"),()=>Je(n,"insert-col-right")),Ke(a(n,"table.k472"),()=>Je(n,"delete-col"),{disabled:n.colWidths.length<=1}),lr(),Ke(a(n,"table.k473"),()=>Je(n,"merge"),{disabled:!!s,title:s||""}),Ke(a(n,"table.k474"),()=>Je(n,"split"),{disabled:!Ds(n)}),Ke(a(n,"table.k475"),()=>Ps(n),{disabled:!!Oi(n),title:Oi(n)||"",active:(()=>{const c=n.selection;if(!c)return!1;const u=h.findMainCell(n.rows,c.r1,c.c1);return n.rows[u.r]?.cells[u.c]?.mergeSameValue===!0})()}),lr(),l("div",{class:"menu-group-title",text:a(n,"table.k476")}),...rs.map(c=>Ke(N(c.labelKey),()=>Je(n,"set-row-type",c.value),{disabled:!!Ni(n,c.value),title:Ni(n,c.value)||"",active:d===c.value}))])}let xt=null;function Kn(){xt&&(document.removeEventListener("mousemove",Hr),document.removeEventListener("mouseup",$r),xt.handle.classList.remove("dragging"),xt=null)}function Ms(e,t){const o=e.closest(".hiprint-printPaper");return(o&&o.offsetWidth>0?o.getBoundingClientRect().width/o.offsetWidth:0)||(t.scale||100)/100}function _s(e,t,o){if(o.button!==0)return;const r=o.currentTarget,i=r.closest(".print-table");if(!i)return;Kn();const n=e.real.options.tableColWidths??[];xt={store:e.store,fire:e.fire,elId:e.real.id,boundary:t,startX:o.clientX,startWidth:n[t-1]??0,scale:Ms(i,e.store),root:i,wrapper:r.closest(".print-element"),handle:r},r.classList.add("dragging"),e.store.recordHistory(),document.addEventListener("mousemove",Hr),document.addEventListener("mouseup",$r)}function Hr(e){const t=xt;if(!t)return;const o=Yt(t.store,t.elId),r=o?.options.tableColWidths;if(!o||!r)return;const i=(e.clientX-t.startX)/(t.scale*co),n=t.boundary-1;r[n]=h.clampResizedColumnWidth(r,n,t.startWidth+i,Bn(t.store)),h.syncTableElementSize(o.options),r.forEach((s,d)=>{const c=t.root.querySelector(`colgroup col:nth-child(${d+1})`);c&&(c.style.width=`${s}mm`)}),t.root.querySelectorAll(".col-resize-handle").forEach((s,d)=>{s.style.left=`${r.slice(0,d+1).reduce((c,u)=>c+u,0)}mm`}),t.wrapper&&(t.wrapper.style.width=`${o.options.width}mm`,t.wrapper.style.height=`${o.options.height}mm`)}function $r(){document.removeEventListener("mousemove",Hr),document.removeEventListener("mouseup",$r);const e=xt;if(!e)return;xt=null,e.handle.classList.remove("dragging");const t=Yt(e.store,e.elId);t&&h.syncTableElementSize(t.options),e.store.emit(),e.fire("table-col-resize-end",{elementId:e.elId})}function Rs(e,t,o){const r=o.querySelector("table");if(!r)return;const i=r.offsetHeight;if(i<=0)return;const n=Yt(e,t);if(!n)return;let s=!1;const d=i/co;Math.abs(d-(n.options.height??0))>is&&(n.options.height=Math.round(d*100)/100,s=!0);const c=r.offsetTop,u=Array.from(r.rows).map(b=>({top:(b.offsetTop-c)/co,height:b.offsetHeight/co})),f=ot(e);Fs(f.layouts.get(t),u)||(f.layouts.set(t,u),s=!0),s&&e.emit(!1)}function Fs(e,t){return!e||e.length!==t.length?!1:t.every((o,r)=>{const i=e[r];return Math.round(o.top*10)===Math.round(i.top*10)&&Math.round(o.height*10)===Math.round(i.height*10)})}function Is(e,t){const o=document.createComment("pd-table-measure");return requestAnimationFrame(()=>{if(!o.isConnected)return;const r=o.parentElement;r&&Rs(e,t,r)}),o}function Ls(e){return e.isSelected&&!e.real.options.locked&&e.colWidths.length>=1}function zs(e){return Array.from({length:e.colWidths.length},(t,o)=>o+1)}function Os(e,t){return e.colWidths.slice(0,t).reduce((o,r)=>o+r,0)}function Ns(e,t,o,r){const i=Nn(t,o,e,r);if(!i)return l("div",{class:"print-table"});const n=[l("table",{style:{fontSize:`${Br(i)}pt`,color:Un(i)}},[l("colgroup",{},i.colWidths.map(s=>l("col",{style:{width:s+"mm"}}))),l("tbody",{},i.rows.map((s,d)=>l("tr",{style:{height:s.height+"mm"}},s.cells.map((c,u)=>c.merged?"":l("td",{rowspan:c.rowspan||1,colspan:c.colspan||1,class:cs(i,d,u),style:ps(i,c),onMousedown:f=>Es(i,d,u,c.id,f),onMouseenter:()=>Ss(i,d,u),onContextmenu:f=>Ts(i,d,u,f)},[ks(i,s,d,u,c)])).filter(Boolean))))])];return Ls(i)&&n.push(l("div",{class:"col-resize-layer"},zs(i).map(s=>l("div",{class:"col-resize-handle",role:"separator","aria-label":a(i,"table.k477",{v0:s}),style:{left:Os(i,s)+"mm"},onMousedown:d=>{d.stopPropagation(),d.preventDefault(),_s(i,s,d)}})))),i.isSelected&&n.push(l("div",{class:"row-badges"},i.rows.map((s,d)=>l("span",{class:"row-badge",style:{top:ls(i,d)+"mm",height:ss(i,d)+"mm"},text:N(os[s.type])})))),n.push(Is(t,e.id)),l("div",{class:"print-table design-mode",dataset:{tableId:e.id},onContextmenu:s=>s.preventDefault()},n)}const Bs=["flowList.k44","flowList.k45","flowList.k46","flowList.k47","flowList.k48","flowList.k49","flowList.k50"];function Us(){return Bs.map(e=>N(e))}function wr(e){return Array.isArray(e)&&e.length>0?e:[]}function Hs(e,t){const o=h.detectFlowListKey(e,t)??(t?Object.keys(t).find(i=>Array.isArray(t[i])):void 0);if(o)return wr(t?.[o]);const r=h.detectFlowListKey(e,h.DEFAULT_DEMO_DATA);return r?wr(h.DEFAULT_DEMO_DATA[r]):[]}function $s(e,t){const o=e.options,r=typeof o.formatter=="string"?o.formatter:"",i=wr(t)[0],n=Hs(r,i);if(n.length===0)return Us();if(!r)return n.map(c=>String(c?.name??JSON.stringify(c)));const s=i??{},d=h.detectFlowListKey(r,s)??Object.keys(s).find(c=>Array.isArray(s[c]));return n.map(c=>{try{return h.evaluateTemplate(r,{...s,...c,...d?{[d]:c}:{}})}catch{return r}})}const Ws=3.7795275591,Ks=.1;function Vs(e,t){return e.templateData.elements.find(o=>o.id===t)??null}function Gs(e){const t=e.parentElement;if(!t?.classList.contains("print-element"))return 0;const o=getComputedStyle(t);return(parseFloat(o.borderTopWidth)||0)+(parseFloat(o.borderBottomWidth)||0)}function qs(e,t,o){const r=o.offsetHeight+Gs(o);if(r<=0)return;const i=Vs(e,t);if(!i)return;const n=r/Ws;Math.abs(n-(i.options.height??0))>Ks&&(i.options.height=Math.round(n*100)/100,e.emit(!1))}function Ys(e,t){const o=document.createComment("pd-flowlist-measure");return requestAnimationFrame(()=>{if(!o.isConnected)return;const r=o.parentElement;r&&qs(e,t,r)}),o}function js(e,t,o){const r=e.options,i=h.resolveFlowColumns(r.flowColumns),n=h.resolveFlowGapX(r.flowGapX),s=h.resolveFlowRowHeight(r.flowRowHeight),d=h.resolveFlowLayoutMode(r.flowLayoutMode)==="dynamic",c=h.resolveFlowPadding(r),u={display:"grid",gridTemplateColumns:`repeat(${i},minmax(0,1fr))`,columnGap:`${n}mm`,gridAutoRows:`minmax(${s}mm,auto)`,width:"100%",...d?{padding:`${c.top}mm ${c.right}mm ${c.bottom}mm ${c.left}mm`,height:"auto",overflow:"visible"}:{height:"100%",overflow:"hidden"},fontSize:`${r.fontSize||12}pt`,fontWeight:r.fontWeight||"normal",color:r.color||"#333",boxSizing:"border-box"};r.fontFamily&&(u.fontFamily=String(r.fontFamily)),r.backgroundColor&&(u.backgroundColor=String(r.backgroundColor));const f=$s(e,t).map(b=>l("div",{class:"print-flow-cell",text:b}));return d&&o&&f.push(Ys(o,e.id)),l("div",{class:"print-flowlist",style:u},f)}const Bi={top:"flex-start",middle:"center",bottom:"flex-end"},Xs={left:"flex-start",center:"center",right:"flex-end"};function Zs(e,t){const o=e.options,r=h.resolveElementMargins(o),i=h.resolveElementBorder(e.printElementType.type,o),n={};if(i?.all&&(n.border=`${i.all.borderWidth} ${i.all.borderStyle} ${i.all.borderColor}`),i)for(const s of h.ELEMENT_BORDER_SIDES){const d=i.edges[s];d&&(n[`border${s.charAt(0).toUpperCase()}${s.slice(1)}`]=`${d.borderWidth} ${d.borderStyle} ${d.borderColor}`)}return{position:"absolute",left:`${o.left}mm`,top:`${o.top}mm`,width:`${o.width}mm`,height:`${o.height}mm`,...r.top!==0?{marginTop:`${r.top}mm`}:{},...r.right!==0?{marginRight:`${r.right}mm`}:{},...r.bottom!==0?{marginBottom:`${r.bottom}mm`}:{},...r.left!==0?{marginLeft:`${r.left}mm`}:{},zIndex:String(o.zIndex||"auto"),...n,...Qs(e,t)}}function Qs(e,t){if(t?.has(e.id))return{};const o=h.resolveElementRotation(e.printElementType.type,e.options);return o===void 0?{}:{rotate:`${o}deg`}}function Ui(e){const t=e.options,o=e.printElementType.type==="longText",r=h.resolveElementTextFit(e.printElementType.type,t),i=t.fontSize||12,n=r==="autoHeight",s={fontSize:`${i}pt`,fontWeight:t.fontWeight||"normal",fontFamily:R.resolveCanvasFontFamily(t.fontFamily),color:t.color||"#333",backgroundColor:t.backgroundColor||"transparent",textAlign:t.textAlign||"left",...t.textAlign==="justify"?{textAlignLast:"justify"}:{},lineHeight:t.lineHeight?`${t.lineHeight}pt`:o?"1.5":"normal",letterSpacing:t.letterSpacing?`${t.letterSpacing}pt`:"normal",width:"100%",height:n?"auto":"100%",boxSizing:"border-box",overflow:n?"visible":"hidden",...o?{wordBreak:"break-all",textIndent:t.longTextIndent?`${t.longTextIndent}em`:"0"}:{textDecoration:t.textDecoration||"none",padding:`${t.contentPaddingTop||0}pt ${t.contentPaddingRight||0}pt ${t.contentPaddingBottom||0}pt ${t.contentPaddingLeft||0}pt`}};h.resolveElementNowrap(t)&&(s.whiteSpace="nowrap",s.textOverflow="ellipsis");const d=h.resolveElementWhiteSpace(t);return d&&(s.whiteSpace=d),t.verticalAlign&&(s.display="flex",t.textAlign==="justify"?(s.flexDirection="column",s.justifyContent=Bi[t.verticalAlign]??"flex-start"):(s.alignItems=Bi[t.verticalAlign]??"flex-start",s.justifyContent=Xs[t.textAlign||"left"]??"flex-start")),{style:s,fit:r}}function Hi(e){const t=e.options,o=`${t.borderWidth||.75}pt`,r=t.borderStyle||"solid",i=t.borderColor||"#333";return e.printElementType.type==="hline"?{width:"100%",height:"0",borderTop:`${o} ${r} ${i}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${o} ${r} ${i}`,boxSizing:"border-box"}}function $i(e){const t=e.options;return{width:"100%",height:"100%",borderWidth:`${t.borderWidth||1}pt`,borderStyle:t.borderStyle||"solid",borderColor:t.borderColor||"#333",backgroundColor:t.backgroundColor||"transparent",borderRadius:e.printElementType.type==="oval"?"50%":"0",boxSizing:"border-box"}}function Js(e){const t=e.options;return{objectFit:t.fit||"contain",...h.cropStyleDeclarations(t.fit,t.fitScale,t.objectPosition),maxWidth:t.maxWidth?`${t.maxWidth}mm`:"100%",maxHeight:t.maxHeight?`${t.maxHeight}mm`:"100%"}}function Wi(e){const t=e.options,o={fitBase:String(t.fontSize||12),fitMin:String(h.resolveShrinkMinFontSize(t.shrinkMinFontSize))};return h.resolveElementTextFit(e.printElementType.type,t)==="shrink"&&(o.fit="shrink"),o}const ed={text:e=>{const{style:t}=Ui(e),o=e.options;return l("div",{class:"print-text",style:t,dataset:Wi(e),text:String(o.testData||o.formatter||"")||N("elements.k41")})},longText:e=>{const{style:t}=Ui(e),o=e.options;return l("div",{class:"print-longtext",style:t,dataset:Wi(e),text:String(o.formatter||"")||N("elements.k42")})},hline:e=>l("div",{class:"print-line",style:Hi(e)}),vline:e=>l("div",{class:"print-line",style:Hi(e)}),rect:e=>l("div",{class:"print-shape",style:$i(e)}),oval:e=>l("div",{class:"print-shape",style:$i(e)}),image:(e,t,o)=>{const r=e.options,i=String(r.src??""),n=o?.designData?.length?o.designData[0]:h.DEFAULT_DEMO_DATA,s=i.includes("{")?h.evaluateTemplate(i,n):i;return l("div",{class:"print-image"},[s?l("img",{src:s,style:Js(e)}):l("div",{class:"image-placeholder",text:N("elements.k43")})])},qrcode:e=>jl(e),barcode:e=>Xl(e),html:e=>{const t=e.options,o=String(t.formatter??""),r=o?Gl.sanitize(h.evaluateTemplate(o,{})):'<div style="background:#e0e0e0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:10pt;color:#999">HTML</div>';return l("div",{class:"print-html",html:r})},pageNumber:(e,t)=>{const o=e.options;return l("div",{class:"page-number-element",style:{fontSize:`${o.fontSize||12}pt`,fontWeight:o.fontWeight||"normal",fontFamily:R.resolveCanvasFontFamily(o.fontFamily),color:o.color||"#333",textAlign:o.textAlign||"left",...o.textAlign==="justify"?{textAlignLast:"justify"}:{}},text:t?o.title||"{pageIndex}/{totalPages}":String(o.title||"")})},table:(e,t,o)=>o?Ns(e,o.store,o.fire,o.designData):l("div",{class:"print-table"}),flowList:(e,t,o)=>js(e,void 0,o?.store)};yn(ed);function td(e,t,o){const r=e.printElementType.type,i=pt(r)?.renderContent;if(i)return i(e,t,o);const n=Lr(r);if(!n)return l("div",{text:r});const s=document.createElement("div");s.className="plugin-kit-canvas",s.style.width="100%",s.style.height="100%";try{zn(`canvas:${e.id}`,n.ui.renderCanvas({element:e,data:o?.designData?.length?o.designData:[h.DEFAULT_DEMO_DATA],designMode:!0}),s)}catch{s.textContent=String(r)}return s}function Vn(e){return`x:${Math.round(e.left)} y:${Math.round(e.top)} ${Math.round(e.width)}×${Math.round(e.height)}mm`}function od(e,t,o){const r=e.store,i=r.selectedIds.has(t.id),n=r.previewIds.has(t.id),s=t.options,d=t.zone||"content",c=[td(t,!0,{store:r,fire:e.fire,designData:e.host.designData})];return r.draggingIds.has(t.id)&&c.push(l("div",{class:"drag-preview"})),i&&(c.push(l("div",{class:"resize-handles"},h.RESIZE_POINTS.map(u=>l("div",{class:`resize-handle handle-${u}`,dataset:{point:u,elId:t.id},onMousedown:f=>e.fire("resize-start",{event:f,id:t.id,point:u})})))),c.push(l("div",{class:"selected-indicator"},[l("div",{class:"position-label",text:Vn(s)})]))),l("div",{class:["print-element",`type-${t.printElementType.type}`,`zone-${d}`,i?"selected":"",n?"previewed":"",r.draggingIds.has(t.id)?"drag-ghost":"","design-mode",s.locked?"locked":"",s.visible===!1?"hidden":""].filter(Boolean).join(" "),style:Zs(t,o),dataset:{elId:t.id},onMousedown:u=>e.fire("element-mousedown",{event:u,id:t.id}),onContextmenu:u=>{u.preventDefault(),u.stopPropagation(),e.fire("contextmenu",{event:u,id:t.id})}},c)}function kr(e,t){const o=e.margins,r=e.header?.height??10,i=e.footer?.height??10,n=t.width-o.left-o.right;return{header:{left:o.left,top:o.top,width:n,height:r},content:{left:o.left,top:o.top+r,width:n,height:t.height-o.top-o.bottom-r-i},footer:{left:o.left,top:t.height-o.bottom-i,width:n,height:i}}}const rd='<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>';function Ki(e,t){return e.type==="vertical"?{left:`${e.position}mm`,top:"0",height:`${t.height}mm`,borderLeftColor:e.color||"var(--pd-accent-secondary, #f56c6c)"}:{top:`${e.position}mm`,left:"0",width:`${t.width}mm`,borderTopColor:e.color||"var(--pd-accent-secondary, #f56c6c)"}}function id(e,t){const o=R.resolveWatermarkLayout(e.watermark,[],t);return o?l("div",{class:"watermark-layer",style:{opacity:String(o.opacity)}},o.tiles.map(r=>l("svg",{class:"watermark-tile",width:`${r.widthMm}mm`,height:`${r.heightMm}mm`,viewBox:`0 0 ${o.tileWidthPx} ${o.tileHeightPx}`,style:{left:`${r.leftMm}mm`,top:`${r.topMm}mm`}},[l("text",{x:String(o.tileWidthPx/2),y:String(o.tileHeightPx/2),"font-size":String(o.fontSizePx),fill:o.color,"text-anchor":"middle","dominant-baseline":"middle",transform:`rotate(${o.rotate},${o.tileWidthPx/2},${o.tileHeightPx/2})`,text:o.text})]))):""}function sr(e,t,o,r,i,n){const s=e.store,d=[];o!=="content"&&d.push(l("span",{class:"zone-label",text:o==="header"?a(e,"canvas.k11"):a(e,"canvas.k12")}));const c=o==="content"?R.collectFollowMemberIds(i):void 0;if(d.push(...i.map(u=>od(e,u,c))),o!=="content"){const u=o==="header"?"bottom":"top";d.push(l("div",{class:`zone-resize-handle handle-${u}`,dataset:{zone:o},onMousedown:f=>e.fire("zone-resize",{event:f,zone:o})},[t.zoneResizing===o?l("div",{class:"zone-height-tip",text:`${(o==="header"?s.templateData.header.height:s.templateData.footer.height).toFixed(1)}mm`}):""]))}return l("div",{class:`zone-layer zone-${o} design-mode`,style:{position:"absolute",left:`${r.left}mm`,top:`${r.top}mm`,width:`${r.width}mm`,height:`${r.height}mm`},dataset:{zone:o,paperWidth:String(n.width),paperHeight:String(n.height)}},d.filter(Boolean))}function nd(e){const t=e.currentTarget,o=e.dataTransfer?.types??[],r=o.includes("fieldkey"),i=o.includes("elementtype");if(!r&&!i){t.querySelector(".drop-hint")?.remove();return}r&&(e.ctrlKey||e.metaKey)&&(t.dataset.dropLabelIntent="1");const n=i?N("canvas.k13"):t.dataset.dropLabelIntent?N("canvas.k14"):N("canvas.k15");let s=t.querySelector(".drop-hint");s||(s=document.createElement("div"),s.className="drop-hint",t.appendChild(s)),s.textContent=n,s.style.left=`${e.clientX+14}px`,s.style.top=`${e.clientY+18}px`}function Gn(e){e&&(e.querySelector(".drop-hint")?.remove(),delete e.dataset.dropLabelIntent)}function ad(e,t){const o=e.store,r=o.templateData,i=R.getPaperDimensions(r),n=(o.scale||100)/100,s=kr(r,i),d=b=>o.elements.filter(m=>(m.zone||"content")===b),c=l("div",{class:"hiprint-printPaper-content",dataset:{content:""},style:{padding:`${r.margins.top}mm ${r.margins.right}mm ${r.margins.bottom}mm ${r.margins.left}mm`,position:"relative",boxSizing:"border-box",minHeight:`${i.height}mm`}},[o.showGrid?l("div",{class:"grid-bg",style:{backgroundImage:`url("data:image/svg+xml,${encodeURIComponent(rd)}")`,backgroundSize:"5mm 5mm",backgroundPosition:"0 0"}}):"",...r.watermark&&Object.keys(r.watermark).length?[id(r,i)]:[],sr(e,t,"header",s.header,d("header"),i),sr(e,t,"content",s.content,d("content"),i),sr(e,t,"footer",s.footer,d("footer"),i),...o.adsorbGuides.map(b=>l("div",{class:`adsorb-guide guide-${b.type}`,style:Ki(b,i)})),...(r.guides??[]).map(b=>l("div",{class:`manual-guide guide-${b.type}`,style:{...Ki(b,i),"--guide-hit":`${8/n}px`},dataset:{guideId:String(b.id??"")},onMousedown:m=>e.fire("guide-mousedown",{event:m,id:b.id}),onDblclick:m=>{m.preventDefault(),e.fire("guide-remove",b.id)}}))].filter(Boolean)),u=l("div",{class:"hiprint-printPaper",dataset:{test:"paper"},style:{width:`${i.width}mm`,minHeight:`${i.height}mm`,background:r.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:`scale(${n})`,transformOrigin:"0 0"}},[...r.designBackground?.src?[l("div",{class:"design-background",style:{width:`${i.width}mm`,height:`${i.height}mm`,left:"0",top:"0",transform:r.designBackground.rotation?`rotate(${r.designBackground.rotation}deg)`:""}},[l("img",{src:r.designBackground.src,draggable:!1,alt:""})])]:[],c]),f=[l("div",{class:"canvas-scroll"},[l("div",{class:"paper-wrapper",style:{width:`${R.mmToPx(i.width)*n}px`,height:`${R.mmToPx(i.height)*n}px`,position:"relative"}},[u])])];if(o.showRuler&&f.push(l("div",{class:"ruler-overlay",style:{transform:`translate(${t.scrollX}px, ${t.scrollY}px)`}},[l("div",{class:"ruler-corner"}),l("canvas",{class:"pd-ruler is-horizontal",dataset:{ruler:"horizontal"},style:{width:`${t.geom.viewW}px`,height:"20px"},onMousedown:b=>e.fire("ruler-mousedown",{event:b,orientation:"horizontal"})}),l("canvas",{class:"pd-ruler is-vertical",dataset:{ruler:"vertical"},style:{width:"20px",height:`${t.geom.viewH}px`},onMousedown:b=>e.fire("ruler-mousedown",{event:b,orientation:"vertical"})})])),t.guidePreview&&f.push(l("div",{class:`ruler-guide-preview guide-${t.guidePreview.type}`,style:t.guidePreview.type==="vertical"?{left:`${t.guidePreview.position}px`,top:"0",height:"100%"}:{top:`${t.guidePreview.position}px`,left:"0",width:"100%"}})),t.marquee.visible&&f.push(l("div",{class:"marquee-selection",style:{left:`${t.marquee.x}px`,top:`${t.marquee.y}px`,width:`${t.marquee.w}px`,height:`${t.marquee.h}px`}})),t.contextMenu.visible){const b=t.contextMenu;f.push(l("div",{class:"context-menu",style:{left:`${t.contextMenu.x+t.contextMenu.flipX}px`,top:`${t.contextMenu.y+t.contextMenu.flipY}px`}},t.contextMenu.targetId?[Ne(e,b,a(e,"canvas.k16"),"copy"),Ne(e,b,a(e,"canvas.k17"),"cut"),Ne(e,b,a(e,"canvas.k18"),"paste",!o.hasClipboard),Ne(e,b,a(e,"canvas.k19"),"delete"),l("div",{class:"context-menu-sep"}),Ne(e,b,a(e,"canvas.k20"),"move-layer",!1,"top"),Ne(e,b,a(e,"canvas.k21"),"move-layer",!1,"up"),Ne(e,b,a(e,"canvas.k22"),"move-layer",!1,"down"),Ne(e,b,a(e,"canvas.k23"),"move-layer",!1,"bottom")]:[Ne(e,b,a(e,"canvas.k24"),"paste-at",!o.hasClipboard),Ne(e,b,a(e,"canvas.k25"),"select-all"),Ne(e,b,a(e,"canvas.k26"),"clear-selection")]))}return l("div",{class:"canvas-area",dataset:{test:"canvas-area"},onDragover:b=>{const m=b;m.preventDefault(),m.dataTransfer&&(m.dataTransfer.dropEffect="copy"),nd(m)},onDragleave:b=>{const m=b.currentTarget,E=b.relatedTarget;(!E||!m.contains(E))&&m.querySelector(".drop-hint")?.remove()},onDrop:b=>{const m=b,E=b.currentTarget,y=E.dataset.dropLabelIntent==="1";Gn(E),y&&(m.labelIntent=!0),e.fire("drop",m)},onMousedown:b=>e.fire("canvas-mousedown",b),onMousemove:b=>e.fire("canvas-mousemove",b),onMouseleave:()=>e.fire("canvas-mouseleave"),onWheel:b=>e.fire("wheel",b),onScroll:b=>e.fire("scroll",b),onContextmenu:b=>{b.preventDefault(),e.fire("canvas-contextmenu",b)}},f.filter(Boolean))}function Ne(e,t,o,r,i=!1,n){return l("div",{class:`context-menu-item${i?" disabled":""}`,text:o,onClick:()=>{t.visible=!1,i||e.fire(r,n),e.repaint()}})}function ld(e){const t=window.innerHeight;for(let o=e.parentElement;o&&o!==document.body;o=o.parentElement){const r=getComputedStyle(o).overflowY;if(r==="auto"||r==="scroll"||r==="hidden"||r==="clip"){const i=o.getBoundingClientRect();return{top:Math.max(0,i.top),bottom:Math.min(t,i.bottom)}}}return{top:0,bottom:t}}function ko(e){const t=R.normalizeFontCatalog(e.fonts),o=e.placeholder??N("fontSelect.k51"),r=`font-select-list-${e.id}`,i=L=>{const U=L?.trim();return U?R.findFontOption(t,U)?.label??U:""},n=L=>{const U=R.normalizeFontQuery(L);return t.find(V=>V.label&&R.normalizeFontQuery(V.label)===U)?.family??L},s=()=>{const L=e.value?.trim();return L?R.findFontOption(t,L)?"":L:""},d=L=>{const U=(e.value??"").trim(),re=(ie,Ce,ke,v)=>({kind:ie,key:Ce,label:ke,value:v,selected:(v??"")===U}),V=L.trim();if(!V){const ie=[re("clear","__clear__",o)],Ce=s();Ce&&ie.push(re("unknown","__unknown__",N("fontSelect.k52",{v0:Ce}),Ce));for(const ke of t)ie.push(re("font",ke.family,R.fontOptionLabel(ke),ke.family));return ie}const he=R.filterFontOptions(t,V).map(ie=>re("font",ie.family,R.fontOptionLabel(ie),ie.family));if(!he.length){const ie=n(V);he.push(re("free","__free__",N("fontSelect.k53",{v0:ie}),ie))}return he},c=document.createElement("div");c.className="font-select";const u=document.createElement("input");u.className="pd-input font-select-input",u.type="text",u.setAttribute("role","combobox"),u.setAttribute("aria-autocomplete","list"),u.setAttribute("aria-controls",r),u.autocomplete="off",u.placeholder=o,u.disabled=!!e.disabled,u.value=i(e.value);const f=document.createElement("ul");f.id=r,f.className="font-select-list",f.setAttribute("role","listbox");const b=e.state.fontOpen?.id===e.id?e.state.fontOpen:null,m={open:!!b&&!e.disabled,query:b?.query??"",highlighted:b?.highlighted??-1};m.open&&(u.value=m.query);const E=()=>{e.state.fontOpen=m.open?{id:e.id,query:m.query,highlighted:m.highlighted}:null};E();const y=()=>{const L=(e.value??"").trim();return d(m.query).findIndex(U=>(U.value??"")===L)},C=()=>{const L=u.getBoundingClientRect(),U=ld(u);f.classList.toggle("is-up",h.resolveOverlayPlacement({triggerTop:L.top,triggerBottom:L.bottom,overlayHeight:f.getBoundingClientRect().height,boundaryTop:U.top,boundaryBottom:U.bottom})==="up")},D=()=>{if(!m.open){f.isConnected&&f.remove(),u.setAttribute("aria-expanded","false"),u.setAttribute("aria-activedescendant","");return}f.isConnected||c.appendChild(f);const L=d(m.query);f.replaceChildren(...L.map((U,re)=>{const V=document.createElement("li");return V.id=`${r}-${re}`,V.className="font-select-option"+(re===m.highlighted?" is-active":"")+(U.kind==="unknown"||U.kind==="free"?" is-muted":""),V.setAttribute("role","option"),V.setAttribute("aria-selected",String(U.selected)),V.textContent=U.label,V.addEventListener("mousedown",he=>{he.preventDefault(),K(U)}),V})),u.setAttribute("aria-expanded","true"),u.setAttribute("aria-activedescendant",m.highlighted>=0?`${r}-${m.highlighted}`:""),C()},S=()=>{m.open||e.disabled||(m.open=!0,m.query="",m.highlighted=y(),E(),D())},_=()=>{m.open||S()},z=()=>{m.open=!0,m.query=u.value,m.highlighted=d(m.query).length?0:-1,E(),D()},A=L=>{if(!m.open){S();return}const U=d(m.query).length-1;if(U<0)return;m.highlighted=Math.min(Math.max(m.highlighted+L,0),U),E(),D(),f.children[m.highlighted]?.scrollIntoView?.({block:"nearest"})},I=()=>{if(!m.open)return;const L=d(m.query)[m.highlighted];if(L){K(L);return}const U=m.query.trim();if(U){const re=n(U);K({value:re})}},K=L=>{m.open=!1,m.query="",m.highlighted=-1,E(),u.value=i(L.value),D(),e.onChange(L.value)},B=()=>{m.open&&(m.open=!1,m.query="",m.highlighted=-1,E(),u.value=i(e.value),D())};return u.addEventListener("focus",S),u.addEventListener("click",_),u.addEventListener("input",z),u.addEventListener("blur",B),u.addEventListener("keydown",L=>{const U=L;U.key==="ArrowDown"?(U.preventDefault(),A(1)):U.key==="ArrowUp"?(U.preventDefault(),A(-1)):U.key==="Enter"?(U.preventDefault(),I()):U.key==="Escape"&&(U.preventDefault(),B())}),c.append(u),D(),m.open&&(u.focus(),u.setSelectionRange(m.query.length,m.query.length)),c}const sd=[{key:"solid",labelKey:"formatBar.k54",preview:"1.5px solid currentColor"},{key:"dashed",labelKey:"formatBar.k55",preview:"1.5px dashed currentColor"},{key:"dotted",labelKey:"formatBar.k56",preview:"1.5px dotted currentColor"},{key:"double",labelKey:"formatBar.k57",preview:"3px double currentColor"}],dd={left:"TextAlignStart",center:"TextAlignCenter",right:"TextAlignEnd",justify:"TextAlignJustify"};function lt(e,t,o,r,i={}){return l("button",{type:"button",class:`ft-cell-btn${i.on?" on":""}`,dataset:{test:e,tip:t},disabled:!!i.disabled,onClick:r,html:`<svg viewBox="0 0 18 18" width="18" height="18" aria-hidden="true">${o}</svg>`})}const Mt='<rect class="g-faint" x="2.5" y="2.5" width="13" height="13" />',Vi='<rect class="g-solid" x="2.5" y="2.5" width="13" height="13" fill="none" />';function pd(e){const t=e.format;t.syncBorderDraft();const o=t.values,r=!t.fontEditable,i=r||t.context==="cells",n=t.context==="none",s=t.context==="cells",d=!t.painterActive&&(t.context==="none"||t.context==="cells"||!t.painterCapturable),c=t.painterActive?a(e,"formatBar.k58"):t.context==="cells"?a(e,"formatBar.k59"):t.context==="none"?a(e,"formatBar.k60"):t.painterCapturable?a(e,"formatBar.k62"):a(e,"formatBar.k61"),u=m=>r?a(e,"formatBar.k63",{v0:m}):m,f=[l("div",{class:"ft-border-panel",dataset:{test:"border-panel"}},[l("div",{class:"ft-border-grid"},[lt("preset-none",a(e,"formatBar.k64"),`${Mt}<line class="g-solid" x1="4" y1="14" x2="14" y2="4" />`,()=>t.applyBorderPreset("none")),lt("preset-all",a(e,"formatBar.k65"),`${Vi}<line class="g-solid" x1="9" y1="3" x2="9" y2="15" /><line class="g-solid" x1="3" y1="9" x2="15" y2="9" />`,()=>t.applyBorderPreset("all")),lt("preset-outer",a(e,"formatBar.k66"),Vi,()=>t.applyBorderPreset("outer")),lt("preset-inner",s?a(e,"formatBar.k67"):a(e,"formatBar.k68"),`${Mt}<line class="g-solid" x1="9" y1="3" x2="9" y2="15" /><line class="g-solid" x1="3" y1="9" x2="15" y2="9" />`,()=>t.applyBorderPreset("inner"),{disabled:!s}),lt("edge-top",a(e,"formatBar.k69"),`${Mt}<line class="g-solid" x1="2" y1="3" x2="16" y2="3" />`,()=>t.applyEdge("top"),{on:t.edgeOn("top")}),lt("edge-bottom",a(e,"formatBar.k70"),`${Mt}<line class="g-solid" x1="2" y1="15" x2="16" y2="15" />`,()=>t.applyEdge("bottom"),{on:t.edgeOn("bottom")}),lt("edge-left",a(e,"formatBar.k71"),`${Mt}<line class="g-solid" x1="3" y1="2" x2="3" y2="16" />`,()=>t.applyEdge("left"),{on:t.edgeOn("left")}),lt("edge-right",a(e,"formatBar.k72"),`${Mt}<line class="g-solid" x1="15" y1="2" x2="15" y2="16" />`,()=>t.applyEdge("right"),{on:t.edgeOn("right")})]),l("div",{class:"ft-style-row"},sd.map(m=>l("button",{type:"button",class:`ft-style-btn${t.borderStyle===m.key?" on":""}`,dataset:{test:`style-${m.key}`,tip:t.borderStyle===m.key?a(e,"formatBar.k73",{v0:a(e,m.labelKey)}):a(e,m.labelKey)},onClick:()=>{t.toggleBorderStyle(m.key),e.repaint()}},[l("span",{class:"ft-style-line",style:{borderTop:m.preview}})]))),l("div",{class:"ft-border-style-row"},[l("span",{class:"ft-edge-label",text:a(e,"formatBar.k74")}),l("div",{class:"ft-line-width"},[H({value:t.borderWidth,min:.25,max:5,step:.25,placeholder:t.borderMixed.width?a(e,"formatBar.k75"):void 0,onCommit:m=>{t.setBorderWidth(m),e.repaint()}})])]),l("div",{class:"ft-border-style-row"},[l("span",{class:"ft-edge-label",text:a(e,"formatBar.k76")}),Ae(t.borderColor,m=>{t.setBorderColor(m),e.repaint()},a(e,"formatBar.k77"))]),t.borderMixedAny?l("p",{class:"pd-hint",text:a(e,"formatBar.k78")}):""].filter(Boolean))],b=[l("div",{class:"ft-align-panel",dataset:{test:"align-panel"}},[l("div",{class:"ft-align-row"},[["left",a(e,"formatBar.k79"),"TextAlignStart"],["center",a(e,"formatBar.k80"),"TextAlignCenter"],["right",a(e,"formatBar.k81"),"TextAlignEnd"],["justify",a(e,"formatBar.k82"),"TextAlignJustify"]].map(([m,E,y])=>l("button",{type:"button",class:`ft-cell-btn${o.textAlign===m?" on":""}`,dataset:{test:`align-${m}`,tip:E},disabled:r,onClick:()=>t.applyStyle({textAlign:m}),html:ge(y)}))),l("div",{class:"ft-align-row"},[["top",a(e,"formatBar.k83"),"ArrowUpToLine"],["middle",a(e,"formatBar.k84"),"ChevronsUpDown"],["bottom",a(e,"formatBar.k85"),"ArrowDownToLine"]].map(([m,E,y])=>l("button",{type:"button",class:`ft-cell-btn${o.verticalAlign===m?" on":""}`,dataset:{test:`valign-${m}`,tip:E},disabled:r,onClick:()=>t.applyStyle({verticalAlign:m}),html:ge(y)})))])];return l("div",{class:"format-toolbar"},[l("div",{class:"tb-ou ft-group",dataset:{unit:"painter"}},[l("button",{type:"button",class:`ft-btn${t.painterActive?" on":""}`,dataset:{test:"format-painter",tip:c},disabled:d,onClick:()=>{t.painterActive?t.cancelPainter():t.pickPainterSource(!1),e.repaint()},onDblclick:()=>{t.pickPainterSource(!0),e.repaint()},html:ge("Paintbrush")})]),l("div",{class:"tb-ou ft-group",dataset:{unit:"font"}},[l("div",{class:"ft-font"},[ko({id:"ft-font",state:e.state,fonts:e.host.fonts,value:typeof o.fontFamily=="string"?o.fontFamily:void 0,placeholder:o.fontFamily===yt?a(e,"formatBar.k86"):a(e,"formatBar.k87"),disabled:r,onChange:m=>t.applyStyle({fontFamily:m})})]),l("div",{class:"ft-size",dataset:{test:"font-size"}},[H({value:typeof o.fontSize=="number"?o.fontSize:void 0,min:5,max:72,disabled:r,placeholder:o.fontSize===yt?a(e,"formatBar.k88"):a(e,"formatBar.k89"),onCommit:m=>t.applyStyle({fontSize:m})})])]),l("div",{class:"tb-ou ft-group",dataset:{unit:"style"}},[...[["bold","Bold",a(e,"formatBar.k90"),()=>t.toggleBold()],["underline","Underline",a(e,"formatBar.k91"),()=>t.toggleUnderline()],["strike","Strikethrough",a(e,"formatBar.k92"),()=>t.toggleStrike()]].map(([m,E,y,C])=>l("button",{type:"button",class:`ft-btn${o[m]===!0?" on":""}`,dataset:{test:m,tip:u(y)},disabled:m==="bold"?r:i,onClick:C,html:ge(E)}))]),l("div",{class:"tb-ou ft-group",dataset:{unit:"color"}},[l("span",{class:`ft-color-btn${r?" dim":""}`,title:a(e,"formatBar.k93",{v0:r?a(e,"formatBar.fontDisabledHint"):""})},[Ae(typeof o.color=="string"?o.color:void 0,m=>t.applyStyle({color:m})),l("span",{class:"ft-glyph",text:"A"})]),l("span",{class:`ft-color-btn${n?" dim":""}`,title:a(e,"formatBar.k94")},[Ae(typeof o.backgroundColor=="string"?o.backgroundColor:void 0,m=>t.applyStyle({backgroundColor:m})),l("span",{class:"ft-glyph",html:ge("PaintBucket",14)})])]),l("div",{class:"tb-ou ft-group",dataset:{unit:"align"}},[fo(e,"align",{icon:dd[String(o.textAlign)]??"TextAlignStart",text:a(e,"formatBar.k95"),textClass:"ft-btn-text",tip:r?a(e,"formatBar.k96"):a(e,"formatBar.k97"),disabled:r,testId:"align-dd"},b)]),l("div",{class:"tb-ou ft-group",dataset:{unit:"border"}},[fo(e,"border",{icon:"Grid3x3",text:a(e,"formatBar.k98"),textClass:"ft-btn-text",tip:n?a(e,"formatBar.k99"):a(e,"formatBar.k100"),disabled:n,testId:"border"},f)])])}const cd="1.6.1";xo.filter(e=>e.material).map(e=>({type:e.type,label:e.label,icon:e.icon}));function Eo(e,t){return ge(e??"Shapes",t)||ge("Shapes",t)}function hd(e){const t=e.state;if(t.leftCollapsed)return l("div",{class:"left-panel collapsed"},[l("div",{class:"left-collapsed"},[Gi("ChevronsRight",a(e,"panels.k137"),()=>{t.leftCollapsed=!1,e.repaint()}),...[["elements",a(e,"panels.k138"),"Table2"],["fields",a(e,"panels.k139"),"ListTree"],["layers",a(e,"panels.k140"),"Layers"]].map(([r,i,n])=>l("button",{type:"button",class:`lc-btn${t.leftTab===r?" on":""}`,title:i,html:Eo(n,14),onClick:()=>{t.leftTab=r,t.leftCollapsed=!1,e.repaint()}}))])]);const o=(r,i,n="")=>l("div",{class:`pd-tab-pane${n?` ${n}`:""}`,role:"tabpanel",dataset:{pane:`left:${r}`},style:t.leftTab===r?"":{display:"none"}},i);return l("div",{class:"left-panel"},[l("div",{class:"left-head"},[l("span",{class:"left-title",text:a(e,"panels.k141")}),Gi("ChevronsLeft",a(e,"panels.k142"),()=>{t.leftCollapsed=!0,e.repaint()})]),l("div",{class:"pd-tabs left-tabs"},[l("div",{class:"pd-tab-bar",role:"tablist"},[...[["elements",a(e,"panels.k143")],["fields",a(e,"panels.k144")],["layers",a(e,"panels.k145")]].map(([r,i])=>l("button",{type:"button",class:`pd-tab${t.leftTab===r?" active":""}`,text:i,onClick:()=>{t.leftTab=r,e.repaint()}}))]),o("elements",gd(e),"material-grid"),o("fields",[md(e)]),o("layers",[yd(e)])])])}function Gi(e,t,o){return l("button",{type:"button",class:"collapse-btn",title:t,html:Eo(e,14),onClick:o})}const qn={text:"elementDefinitions.k553",barcode:"elementDefinitions.k554",qrcode:"elementDefinitions.k555",image:"elementDefinitions.k556",table:"elementDefinitions.k557",longText:"elementDefinitions.k558",flowList:"elementDefinitions.k559",hline:"elementDefinitions.k560",vline:"elementDefinitions.k561",rect:"elementDefinitions.k562",oval:"elementDefinitions.k563",pageNumber:"elementDefinitions.k564",barChart:"echarts.series.typeNames.bar",barHChart:"echarts.series.typeNames.barH",lineChart:"echarts.series.typeNames.line",areaChart:"echarts.series.typeNames.area",pieChart:"echarts.series.typeNames.pie",doughnutChart:"echarts.series.typeNames.doughnut",scatterChart:"echarts.series.typeNames.scatter",radarChart:"echarts.series.typeNames.radar",funnelChart:"echarts.series.typeNames.funnel",gaugeChart:"echarts.series.typeNames.gauge"},ud={barChart:"elementGroup.chart"};function fd(e,t,o,r){return l("div",{class:`material-card${h.isWideMaterialLabel(r??t)?" material-card--wide":""}`,draggable:!0,dataset:{test:`material-${e}`},onDragstart:i=>{const n=i.dataTransfer;n?.setData("elementType",e),n&&(n.effectAllowed="all")}},[l("span",{class:"material-icon","data-icon":o,html:Eo(o,14)}),l("span",{class:"material-label",text:r??t})])}function gd(e){const t=[];let o;for(const r of xn()){const i=r.group;if(i&&i!==o){const c=ud[r.type];t.push(l("div",{class:"material-group-title",text:c?a(e,c):i}))}i&&(o=i);const n=qn[r.type],s=n?a(e,n):void 0,d=s&&s!==n?s:void 0;t.push(fd(r.type,r.label,r.icon,d))}return[l("div",{class:"panel-title",text:a(e,"panels.k146")}),...t]}function md(e){const t=e.state,o=t.fieldDisplay??"both",r=h.groupFields(e.store.fields),i=(t.fieldSearch??"").trim().toLowerCase(),n=i?r.map(s=>({...s,fields:s.fields.filter(d=>`${d.fieldLabel}${d.fieldKey}`.toLowerCase().includes(i))})).filter(s=>s.fields.length):r;return l("div",{class:"field-tree-panel"},[l("div",{class:"panel-title",text:a(e,"panels.k147")}),l("input",{class:"pd-input search-input",type:"search",placeholder:a(e,"panels.k148"),"aria-label":a(e,"panels.k149"),value:t.fieldSearch??"",onInput:s=>{t.fieldSearch=s.target.value},onChange:()=>e.repaint()}),l("div",{class:"tree-container"},n.flatMap(s=>{const d=t.collapsedGroups.has(s.key)&&!i,c=s.key?l("div",{class:`field-group-header${s.isList?" is-list":""}`,onClick:()=>{d?t.collapsedGroups.delete(s.key):t.collapsedGroups.add(s.key),e.repaint()}},[l("span",{class:"expand-icon",text:d?"▶":"▼"}),l("span",{class:"node-icon",text:s.isList?"📋":"📁"}),l("span",{class:"group-label",text:s.label,"data-tip":s.label})]):"",u=d?[]:s.fields.map(f=>l("div",{class:"field-row",draggable:!0,"data-tip":a(e,"panels.k150",{v0:f.fieldLabel,v1:f.fieldKey}),style:{paddingLeft:`${s.key?22:8}px`},onDragstart:b=>{const m=b.dataTransfer;m?.setData("fieldKey",f.fieldKey),m&&(m.effectAllowed="all")},onClick:()=>{h.copyTextToClipboard(f.fieldLabel||f.fieldKey).then(b=>{b&&(t.copiedFieldKey=f.fieldKey,e.repaint(),setTimeout(()=>{t.copiedFieldKey===f.fieldKey&&(t.copiedFieldKey="",e.repaint())},1200))})}},[l("span",{class:"node-icon",text:"📄"}),l("span",{class:"node-meta"},[o!=="key"?l("span",{class:"node-label",text:f.fieldLabel||f.fieldKey}):"",o!=="label"?l("span",{class:`node-key${o==="key"?" is-primary":""}`,text:o==="key"?f.fieldKey:`(${f.fieldKey})`}):""].filter(Boolean)),t.copiedFieldKey===f.fieldKey?l("span",{class:"copy-hint",text:a(e,"panels.k151")}):""].filter(Boolean)));return[c,l("div",{},u.filter(Boolean))].filter(Boolean)})),n.length===0?l("p",{class:"pd-empty",text:a(e,"panels.k152")}):""].filter(Boolean))}function bd(e,t){if(e.options.title)return e.options.title;const o=qn[e.printElementType.type];return o?a(t,o):e.printElementType.title||e.printElementType.type}function yd(e){const t=e.store,o=[...t.elements].sort((d,c)=>(c.options.zIndex??0)-(d.options.zIndex??0)),r=t.elements.filter(d=>t.selectedIds.has(d.id)),i=r.length>=2,n=r.some(d=>!!d.options.groupId),s=d=>d.zone==="header"?a(e,"panels.k153"):d.zone==="footer"?a(e,"panels.k154"):"";return l("div",{class:"layer-panel"},[l("div",{class:"panel-title",text:a(e,"panels.k155")}),...o.map(d=>{const c=En(d.printElementType.type);return l("div",{class:`layer-item${t.selectedIds.has(d.id)?" active":""}`,onClick:u=>t.selectElement(d.id,u.ctrlKey||u.metaKey)},[l("span",{class:"layer-icon","data-icon":c??"Shapes",html:Eo(c,12)}),l("span",{class:"layer-name",text:bd(d,e)}),s(d)?l("span",{class:"layer-zone",text:s(d)}):"",l("span",{class:"layer-zindex",text:`z:${d.options.zIndex??0}`})].filter(Boolean))}),o.length?l("div",{class:"layer-actions"},[...[["top",a(e,"panels.k156"),"ArrowUpToLine"],["up",a(e,"panels.k157"),"ArrowUp"],["down",a(e,"panels.k158"),"ArrowDown"],["bottom",a(e,"panels.k159"),"ArrowDownToLine"]].map(([d,c,u])=>l("button",{type:"button",class:"pd-button small",title:c,html:ge(u,14),onClick:()=>e.fire("move-layer",d)}))]):"",i||n?l("div",{class:"layer-actions"},[i?l("button",{type:"button",class:"pd-button small",title:a(e,"panels.k160"),html:ge("Group",14),onClick:()=>e.fire("group")}):"",n?l("button",{type:"button",class:"pd-button small",title:a(e,"panels.k161"),html:ge("Ungroup",14),onClick:()=>e.fire("ungroup")}):""].filter(Boolean)):""].filter(Boolean))}function vd(e){const t=e.store,o=e.state,r=t.pages.length>1,i=t.pages[t.activePageIndex]?.name||a(e,"panels.k162",{v0:t.activePageIndex+1}),n=t.tilingEnabled;return l("div",{class:"page-tabs"},[l("div",{class:"page-tabs-list"},t.pages.map((d,c)=>o.renamingPage===c?l("input",{class:"page-tab-rename",dataset:{test:"page-rename-input"},value:o.renameText??"",onInput:u=>{o.renameText=u.target.value},onBlur:()=>s(),onKeydown:u=>{const f=u;if(f.key==="Enter"){s();return}f.key==="Escape"&&(o.renamingPage=null,e.repaint())}}):l("button",{type:"button",class:`page-tab${c===t.activePageIndex?" active":""}`,dataset:{tip:d.name?a(e,"panels.k163",{v0:d.name}):a(e,"panels.k164")},text:d.name||a(e,"panels.k165",{v0:c+1}),onClick:()=>t.switchPage(c),onDblclick:()=>{o.renamingPage=c,o.renameText=d.name??"",e.repaint()}}))),l("div",{class:"page-tabs-actions"},[l("button",{type:"button",dataset:{test:"add-page",tip:n?a(e,"panels.k166"):a(e,"panels.k167")},disabled:n,text:"+",onClick:()=>e.fire("add-page")}),l("button",{type:"button",dataset:{test:"duplicate-page",tip:n?a(e,"panels.k168"):a(e,"panels.k169",{v0:i})},disabled:n,text:"⧉",onClick:()=>e.fire("duplicate-page")}),l("button",{type:"button",dataset:{test:"delete-page",tip:r?a(e,"panels.k170",{v0:i}):a(e,"panels.k171")},disabled:!r,text:"✕",onClick:()=>e.fire("delete-page")}),l("button",{type:"button",dataset:{test:"move-left",tip:a(e,"panels.k172",{v0:i})},disabled:t.activePageIndex<=0,text:"←",onClick:()=>e.fire("move-page",-1)}),l("button",{type:"button",dataset:{test:"move-right",tip:a(e,"panels.k173",{v0:i})},disabled:t.activePageIndex>=t.pages.length-1,text:"→",onClick:()=>e.fire("move-page",1)})])]);function s(){const d=(o.renameText??"").trim();o.renamingPage!==null&&d&&t.renamePage(o.renamingPage,d),o.renamingPage=null,e.repaint()}}function xd(e){const t=e.store,o=t.templateData,r=h.getPaperDimensions(o),i=o.orientation==="landscape"?a(e,"panels.k174"):a(e,"panels.k175"),n=h.PAPER_PRESETS[o.paperSize],s=n?a(e,n.labelKey):o.paperSize,d=o.outputRotation,c=`${s} ${i} ${Math.round(r.width)}×${Math.round(r.height)}mm${d?a(e,"panels.paperRotated",{rot:d}):""}`;return l("div",{class:"status-bar"},[l("span",{class:"status-item coord",dataset:{coord:""},style:{display:"none"}}),l("span",{class:"status-item",text:a(e,"panels.k176",{v0:t.scale})}),l("span",{class:"status-item",text:a(e,"panels.statusElements",{count:t.elements.length,selected:t.selectedIds.size?a(e,"panels.statusSelected",{n:t.selectedIds.size}):""})}),l("span",{class:"status-item status-version",text:`v${cd}`}),l("span",{class:"status-item status-paper",text:c})])}const wd=Object.keys(h.PAPER_PRESETS).filter(e=>e!=="CUSTOM"&&!h.PAPER_PRESETS[e]?.continuous);function kd(e){const t=document.createElement("label");t.className="pd-button small upload-label";const o=document.createTextNode(a(e,"pageExtras.k103")),r=document.createElement("input");r.className="visually-hidden",r.type="file",r.accept="image/*",t.append(o,r);const i=n=>{t.className=`pd-button small upload-label${n?" disabled":""}`,r.disabled=n};return r.addEventListener("change",async()=>{const n=r.files?.[0];if(!n)return;if(!n.type.startsWith("image/")){alert(a(e,"pageExtras.k104")),r.value="";return}const s=e.host.uploadDesignBackground;if(!s){alert(a(e,"pageExtras.k105")),r.value="";return}i(!0),o.textContent=a(e,"pageExtras.k106");try{const d=await s(n);d?e.store.updateTemplateData({designBackground:{src:d,rotation:0}}):alert(a(e,"pageExtras.k107"))}catch(d){alert(d instanceof Error?d.message:a(e,"pageExtras.k108"))}finally{o.textContent=a(e,"pageExtras.k109"),i(!e.host.uploadDesignBackground),r.value=""}}),e.host.uploadDesignBackground||i(!0),t}function Ed(e){const o=e.store.templateData.designBackground,r=o?.rotation??0;return l("div",{class:"design-background-config"},[Ge(a(e,"pageExtras.k110")),l("p",{class:"design-background-tip",text:a(e,"pageExtras.k111")}),o?.src?[l("div",{class:"design-background-path",title:o.src,text:o.src}),l("div",{class:"design-background-actions"},[l("button",{type:"button",class:"pd-button small rotate-btn",text:a(e,"pageExtras.k112",{v0:(r+90)%360}),onClick:()=>e.store.updateTemplateData({designBackground:{...o,rotation:(r+90)%360}})}),l("button",{type:"button",class:"pd-button small remove-btn",text:a(e,"pageExtras.k113"),onClick:()=>e.store.updateTemplateData({designBackground:void 0})})])]:kd(e)].flat())}function Sd(e){const t=e.store,o=t.templateData,r=o.tiling,i={...R.TILE_DEFAULTS,...r??{},enabled:r?.enabled??!1,sheetMargin:{...R.TILE_DEFAULTS.sheetMargin,...r?.sheetMargin??{}}},n=h.isContinuousPaperSize(o.paperSize),s=y=>t.updateTemplateData({tiling:{...i,...y}}),d=y=>kt({target:i,base:R.TILE_DEFAULTS,propKey:y,write:()=>s({[y]:R.TILE_DEFAULTS[y]})}),c=y=>kt({target:i.sheetMargin,base:R.TILE_DEFAULTS.sheetMargin,propKey:y,write:()=>u(y,R.TILE_DEFAULTS.sheetMargin[y])}),u=(y,C)=>s({sheetMargin:{...i.sheetMargin,[y]:C??0}}),f={...o,tiling:i},b=R.validateTiling(f),m=Math.max(R.computeMaxColumns(f),1);let E="";if(!b.length)try{const y=R.computeTileLayout(f),C=R.resolveSheetMm(f),D=i.sheetPaperSize==="CUSTOM"?a(e,"pageExtras.k114"):i.sheetPaperSize??"A4",S=i.sheetPaperSize==="CUSTOM"?"":i.sheetOrientation==="landscape"?a(e,"pageExtras.k115"):a(e,"pageExtras.k116");E=a(e,"pageExtras.k117",{v0:D,v1:S,v2:C.width,v3:C.height,v4:y.columns,v5:y.rows,v6:y.perSheet,v7:y.tile.width,v8:y.tile.height})}catch{E=""}return l("div",{class:"tiling-config",dataset:{test:"tiling-config"}},[Ge(a(e,"pageExtras.k118")),l("p",{class:"pd-hint",text:a(e,"pageExtras.k119")}),l("div",{class:"pd-field"},[l("label",{class:"tiling-switch"},[l("input",{type:"checkbox",checked:i.enabled===!0,disabled:n,onChange:y=>{if(!y.target.checked){s({enabled:!1});return}s({...R.TILE_DEFAULTS,columns:Math.min(R.TILE_DEFAULTS.columns,Math.max(m,1))})}}),l("span",{text:a(e,"pageExtras.k120")})]),n?l("p",{class:"pd-hint tiling-error",text:a(e,"pageExtras.k121")}):""].filter(Boolean)),i.enabled&&!n?[q(a(e,"pageExtras.k122"),l("select",{class:"pd-select",style:{width:"100%"},onChange:y=>{const C=y.target.value;if(C!=="CUSTOM"){s({sheetPaperSize:C});return}const D=R.resolveSheetMm(f);s({sheetPaperSize:"CUSTOM",sheetCustomWidth:i.sheetCustomWidth??D.width,sheetCustomHeight:i.sheetCustomHeight??D.height})}},[...wd.map(y=>l("option",{value:y,text:a(e,h.PAPER_PRESETS[y]?.labelKey??y),selected:(i.sheetPaperSize??"A4")===y})),l("option",{value:"CUSTOM",text:a(e,"pageExtras.k123"),selected:i.sheetPaperSize==="CUSTOM"})]),void 0,d("sheetPaperSize")),i.sheetPaperSize==="CUSTOM"?q(a(e,"pageExtras.k124"),l("div",{class:"custom-size-grid"},[H({value:Number(i.sheetCustomWidth??0),min:25,max:2e3,onCommit:y=>s({sheetCustomWidth:y})}),l("span",{class:"custom-size-x",text:"×"}),H({value:Number(i.sheetCustomHeight??0),min:25,max:2e3,onCommit:y=>s({sheetCustomHeight:y})})])):q(a(e,"pageExtras.k125"),dt("tiling-ori",[{value:"portrait",label:a(e,"pageExtras.k126")},{value:"landscape",label:a(e,"pageExtras.k127")}],i.sheetOrientation==="landscape"?"landscape":"portrait",y=>s({sheetOrientation:y})),void 0,d("sheetOrientation")),Ge(a(e,"pageExtras.k128")),l("div",{class:"margin-grid"},[q(a(e,"pageExtras.k129"),H({value:i.sheetMargin.top??0,min:0,max:100,onCommit:y=>u("top",y)}),void 0,c("top")),q(a(e,"pageExtras.k130"),H({value:i.sheetMargin.bottom??0,min:0,max:100,onCommit:y=>u("bottom",y)}),void 0,c("bottom")),q(a(e,"pageExtras.k131"),H({value:i.sheetMargin.left??0,min:0,max:100,onCommit:y=>u("left",y)}),void 0,c("left")),q(a(e,"pageExtras.k132"),H({value:i.sheetMargin.right??0,min:0,max:100,onCommit:y=>u("right",y)}),void 0,c("right"))]),Ge(a(e,"pageExtras.k133")),q(a(e,"pageExtras.k134"),H({value:i.gapX??0,min:0,max:50,onCommit:y=>s({gapX:y??0})}),void 0,d("gapX")),q(a(e,"pageExtras.k135"),H({value:i.gapY??0,min:0,max:50,onCommit:y=>s({gapY:y??0})}),void 0,d("gapY")),q(a(e,"pageExtras.k136"),H({value:i.columns??1,min:1,max:m,onCommit:y=>s({columns:y||1})})),...b.map(y=>l("p",{class:"pd-hint tiling-error",text:y.message})),!b.length&&E?l("p",{class:"pd-hint tiling-summary",text:E}):""]:""].flat().filter(Boolean))}const Td=new Set(h.PROPERTY_REGISTRY.map(e=>e.group)),Cd={"table-settings":"content"},qi=new Map;function Wr(e){const t=e??"";let o=qi.get(t);if(!o){const{groups:r,itemKeys:i}=h.searchProperties(t);o={groups:r,keys:i,searching:!!t.trim()},qi.set(t,o)}return o}function Kr(e){const t=Cd[e]??e;return Td.has(t)?t:""}function Dd(e,t){const o=Wr(e.state.propSearch);if(!o.searching)return!0;const r=Kr(t);return!r||o.groups.includes(r)}function Pd(e,t){const o=Wr(e.state.propSearch);return!o.searching||o.keys.has(t)}function Yn(e,t){const o=e.props.style??{};return e.props.style={...o,display:t?"":"none"},e}function M(e,t,o){const r=o.props.dataset??{};return o.props.dataset={...r,propKey:t},Yn(o,Pd(e,t))}function Ad(e,t,o){const r=Kr(t);if(!r)return o;const i=o.props.dataset??{};return o.props.dataset={...i,propGroup:r},Yn(o,Dd(e,t))}function jn(e,t){const o=Wr(t);for(const r of Array.from(e.querySelectorAll("[data-prop-group]"))){const i=Kr(r.dataset.propGroup??"");r.style.display=!o.searching||!i||o.groups.includes(i)?"":"none"}for(const r of Array.from(e.querySelectorAll("[data-prop-key]")))r.style.display=!o.searching||o.keys.has(r.dataset.propKey??"")?"":"none"}function Md(e){return l("div",{class:"property-search"},[l("input",{class:"pd-input",type:"search",placeholder:a(e,"propertySearch.k328"),"aria-label":a(e,"propertySearch.k329"),value:e.state.propSearch??"",onInput:t=>{const o=t.target,r=o.value;e.state.propSearch=r,jn(o.getRootNode(),r)}})])}const _d={Document:"≡",Brush:"◧",Setting:"⚙"};function Rd(e,t){try{const o=window.localStorage.getItem(`property-group-${e}`);return o===null?t:o==="true"}catch{return t}}function Fd(e,t){try{window.localStorage.setItem(`property-group-${e}`,String(t))}catch{}}function Te(e,t,o,r,i,n=!0,s=[]){const d=Rd(t,n);return Ad(e,t,l("div",{class:`property-group${d?" is-expanded":""}`},[l("div",{class:"group-header",onClick:()=>{Fd(t,!d),e.repaint()}},[l("span",{class:"group-icon",text:_d[r]||"•"}),l("span",{class:"group-title",text:o}),...s,l("span",{class:"expand-icon",text:d?"▾":"▸"})]),l("div",{class:"group-content",style:d?"":{display:"none"}},i.filter(Boolean))]))}function So(e){return l("form",{class:"pd-form",onSubmit:t=>t.preventDefault()},e.filter(Boolean))}function Xn(e){return e.split(".").flatMap(t=>{const o=t.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!o)return[t];const r=o[1],i=[...o[2].matchAll(/\[(\d+)\]/g)].map(n=>Number(n[1]));return[r,...i]})}function Yi(e,t){return Xn(t).reduce((i,n)=>i==null?"":i[n],e)??""}function Vr(e,t,o,r){const i=Xn(o),n=i.pop(),s=i.reduce((d,c)=>((d[c]===void 0||d[c]===null)&&(d[c]={}),d[c]),t);s[n]=r||void 0,e.recordHistory(),e.emit()}function Id(e,t){const o=e.store;if(t.printElementType.type==="table"&&o.tableSelection?.elementId===t.id){const{r1:r,c1:i}=o.tableSelection,n=(t.options.tableRows??[])[r];if(n)return h.getTableCellBindings(n.type,r,i,t.options.fields?.[0]?.dataSource)}return h.getElementBindings(t)}function Ld(e,t){const o=document.createElement("label");o.className="pd-button small upload-label",Se(l("svg",{class:"pd-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[l("path",{fill:"currentColor",d:"M12 3l4 4h-3v7h-2V7H8zm-7 12h14v5H5Z"})]),o);const r=document.createTextNode(a(e,"binding.k1")),i=document.createElement("input");i.className="visually-hidden",i.type="file",i.accept="image/*",o.append(r,i);const n=c=>{o.className=`pd-button small upload-label${c?" disabled":""}`,i.disabled=c};i.addEventListener("change",async()=>{const c=i.files?.[0];if(!c)return;if(!c.type.startsWith("image/")){alert(a(e,"binding.k2")),i.value="";return}const u=e.host.uploadImage;if(!u){alert(a(e,"binding.k3")),i.value="";return}n(!0),r.textContent=a(e,"binding.k4");try{const f=await u(c);f?Vr(e.store,t,"options.src",f):alert(a(e,"binding.k5"))}catch(f){alert(f instanceof Error?f.message:a(e,"binding.k6"))}finally{r.textContent=a(e,"binding.k7"),n(!e.host.uploadImage),i.value=""}}),e.host.uploadImage||n(!0);const s=document.createElement("div");s.className="image-content-upload";const d=document.createElement("p");return d.className="upload-tip",d.textContent=a(e,"binding.k8"),s.append(o,d),s}function zd(e,t){const o=r=>e.fire("open-expression",{elementId:t.id,targetPath:r.targetPath,value:Yi(t,r.targetPath)});return Te(e,"binding",a(e,"binding.k9"),"Document",[...Id(e,t).map(r=>q(r.labelKey?a(e,r.labelKey):r.label,l("input",{class:"pd-input",type:"text",value:Yi(t,r.targetPath),placeholder:r.placeholder||a(e,"binding.k10"),onChange:i=>Vr(e.store,t,r.targetPath,i.target.value),onDblclick:()=>o(r)}))),t.printElementType.type==="image"?Ld(e,t):""].filter(Boolean))}const Ht=new Map;function lo(e){return`${Math.round(e*1e4)/1e4}%`}function Zn(e,t){const o=h.parseCropAnchor(t.value),r=o.kind==="custom",i=o.kind==="axes"?o.x:50,n=o.kind==="axes"?o.y:50,s=h.resolveCropPreview(t.src),d=Ht.get(s.src),c={widthMm:t.widthMm,heightMm:t.heightMm,naturalWidth:d?.width,naturalHeight:d?.height,fit:t.fit,scalePct:t.scale},u=h.resolveCropTravel(c),f=h.cropWindow(c,i,n),b=document.createElement("select");b.className="pd-select",b.style.width="100%";for(const C of h.cropPresetOptions(u,i,n)){const D=document.createElement("option");D.value=C.value,D.textContent=C.label,b.appendChild(D)}if(r){const C=document.createElement("option");C.value="custom",C.textContent=a(e,"cropAnchor.k37"),b.appendChild(C)}b.value=r?"custom":`${i},${n}`,b.selectedIndex<0&&(b.selectedIndex=r?b.options.length-1:0),b.addEventListener("change",()=>{if(b.value==="custom")return;const[C,D]=b.value.split(",").map(Number);t.onCommit(h.buildCropAnchor(C,D))});const m=a(e,`propertyTips.${t.fieldKey}`),E=[l("div",{class:"pd-field",dataset:{field:t.fieldKey}},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t"},[t.label,mr(m)]),t.resetAnchor??""].filter(Boolean)),b])];E.push(l("div",{class:"pd-field",dataset:{field:"ap-img-fit-scale"}},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t"},[h.cropScaleLabel(),mr(a(e,"propertyTips.ap-img-fit-scale"))]),t.resetScale??""].filter(Boolean)),H({value:t.scale,min:h.CROP_SCALE_MIN,max:h.CROP_SCALE_MAX,step:5,placeholder:a(e,"cropAnchor.k38"),onCommit:C=>t.onScaleCommit(C>h.CROP_SCALE_MIN?C:void 0)})]));for(const C of h.cropAxisFields(u,i,n))E.push(l("div",{class:"pd-field",dataset:{field:t.fieldKey}},[l("span",{class:"pd-label",text:C.label}),H({value:C.value,min:0,max:100,step:1,onCommit:D=>t.onCommit(h.buildCropAnchor(C.name==="horizontal"?D:i,C.name==="vertical"?D:n))})]));const y=h.cropAxisNote(u,r);return y&&E.push(l("p",{class:"pd-crop-note",text:y})),s.isSample&&E.push(l("p",{class:"pd-crop-note",text:h.cropSampleNote()})),E.push(l("div",{class:"pd-crop-preview"},[l("img",{class:"pd-crop-thumb",src:s.src,alt:s.isSample?a(e,"cropAnchor.k39"):a(e,"cropAnchor.k40"),onLoad:C=>{const D=C.target;if(!(D.naturalWidth>0&&D.naturalHeight>0))return;const S=Ht.get(s.src);S&&S.width===D.naturalWidth&&S.height===D.naturalHeight||(Ht.set(s.src,{width:D.naturalWidth,height:D.naturalHeight}),e.repaint())},onError:()=>{Ht.has(s.src)&&(Ht.delete(s.src),e.repaint())}}),f?l("div",{class:"pd-crop-win",style:{left:lo(f.leftPct),top:lo(f.topPct),width:lo(f.widthPct),height:lo(f.heightPct)}}):""])),l("div",{class:t.containerClass??"pd-crop-anchor"},E)}const bt=e=>Number(e??0),Er=e=>e||void 0;function wt(e,t,o,r,i,n){return l("div",{class:"pd-field"},[l("span",{class:"pd-label",...r?{title:r}:{}},[l("span",{class:"pd-label-t",text:e}),i??""].filter(Boolean)),l("input",{class:"pd-switch",type:"checkbox",checked:t,...n?{disabled:!0}:{},onChange:s=>o(s.target.checked)})])}function Qn(e,t,o,r,i=!1,n){return l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:e}),""].filter(Boolean)),l("select",{class:"pd-select",...i?{style:{width:"100%"}}:{},onChange:s=>r(s.target.value)},o.map(s=>l("option",{value:s.value,text:s.label,selected:s.value===t})))])}function $t(e,t,o,r,i={}){return l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:e}),i.reset??""].filter(Boolean)),gn(t,o,r,{className:"pd-select",...i.full?{width:"100%"}:{}})])}const _t=e=>l("p",{class:"pd-hint",text:e});function Jn(e,t){return e.map(o=>({value:o.value,label:o.labelKey?a(t,o.labelKey):o.label??o.value,...o.disabled?{disabled:!0}:{}}))}const Od="tableProps.k330",Nd=[{value:"header",labelKey:"tableProps.k331"},{value:"data",labelKey:"tableProps.k332"},{value:"subtotal",labelKey:"tableProps.k333"},{value:"summary",labelKey:"tableProps.k334"}],Bd=[{value:"CODE128",labelKey:"tableProps.k335"},{value:"EAN13",labelKey:"tableProps.k336"},{value:"EAN8",label:"EAN8"},{value:"UPC",label:"UPC"},{value:"CODE39",label:"CODE39"},{value:"ITF14",label:"ITF14"}],Ud=[{value:"L",labelKey:"tableProps.k337"},{value:"M",labelKey:"tableProps.k338"},{value:"Q",label:"Q"},{value:"H",labelKey:"tableProps.k339"}],Hd=[{value:"clip",labelKey:"tableProps.k340"},{value:"shrink",labelKey:"tableProps.k341"},{value:"autoHeight",labelKey:"tableProps.k342"}],$d={value:"__multi__",labelKey:"tableProps.k343",disabled:!0};function Wd(e,t){const o=e.store,r=o.tableSelection,i=t.options.tableRows??[],n=r?i[r.r1]:void 0;if(!r||!n)return Te(e,"table-row",a(e,"tableProps.k344"),"Grid",[]);const s=d=>o.updateElement(t.id,d);return Te(e,"table-row",a(e,"tableProps.k345"),"Grid",[So([Qn(a(e,"tableProps.k346"),n.type,Jn(Nd,e),d=>{const c=h.setRowType(i,r.r1,d);if(c){window.alert(c);return}s({tableRows:i})},!0),l("div",{class:"pd-field"},[l("span",{class:"pd-label",text:a(e,"tableProps.k347")}),H({value:n.height,min:3,max:100,step:.5,onCommit:d=>{n.height=d,s({tableRows:i})}})]),n.type==="header"?wt(a(e,"tableProps.k348"),n.repeatOnPage??!1,d=>{h.setHeaderRepeat(i,d),s({tableRows:i})},a(e,Od)):""])])}function Kd(e,t){const o=e.store,r=t.options,i=f=>o.updateElement(t.id,f),n=r.tableColWidths??[],s=o.paperSize.width-o.templateData.margins.left-o.templateData.margins.right,d=o.fields.filter(f=>f.fieldType==="list").map(f=>({value:f.fieldKey,label:f.fieldLabel})),c=h.createDefaultOptions("table"),u=f=>kt({target:r,base:c,propKey:f,write:()=>i({[f]:c[f]})});return Te(e,"table-settings",a(e,"tableProps.k349"),"Grid",[So([Qn(a(e,"tableProps.k350"),r.dataSource??"",d,f=>i({dataSource:f||void 0}),!0),l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"tableProps.k351")}),u("tableDefaultFontFamily")]),ko({id:"table-default-font",state:e.state,fonts:e.host.fonts,value:r.tableDefaultFontFamily,placeholder:a(e,"tableProps.k352"),onChange:f=>i({tableDefaultFontFamily:f||void 0})})]),l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"tableProps.k353")}),u("tableDefaultFontSize")]),H({value:bt(r.tableDefaultFontSize),min:0,max:72,placeholder:a(e,"tableProps.k354"),onCommit:f=>i({tableDefaultFontSize:Er(f)})})]),l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"tableProps.k355")}),u("tableDefaultColor")]),Ae(r.tableDefaultColor,f=>i({tableDefaultColor:f}),a(e,"tableProps.k356"))]),l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"tableProps.k357")}),u("tableDefaultPadding")]),H({value:bt(r.tableDefaultPadding),min:0,max:10,step:.5,placeholder:a(e,"tableProps.k358"),onCommit:f=>i({tableDefaultPadding:Er(f)})})]),l("div",{class:"pd-field"},[l("span",{class:"pd-label",text:a(e,"tableProps.k359")}),...n.map((f,b)=>l("div",{class:"col-width-row"},[l("span",{style:{width:"60px"},text:a(e,"tableProps.k360",{v0:b+1})}),H({value:f,min:5,max:200,onCommit:m=>{const E=n.reduce((y,C,D)=>D===b?y:y+C,0);if(E+m>s){const y=Math.max(5,Math.round((s-E)*10)/10);window.alert(a(e,"tableProps.k361",{v0:s,v1:b+1,v2:y})),n[b]=y}else n[b]=m;i({tableColWidths:n})}})]))])])])}function Vd(e,t){const o=e.store,r=t.options,i=t.printElementType.type==="table",n=d=>o.updateElement(t.id,d),s=[];if(i)s.push(M(e,"pg-enabled",wt(a(e,"tableProps.k362"),r.tablePagination?.enabled??!0,d=>n({tablePagination:{enabled:d}}))));else{const d=r.pagination?.pageable??!0,c=r.pagination?.keepWithNext??!1;s.push(M(e,"pg-pageable",wt(a(e,"tableProps.k363"),d,u=>n({pagination:{pageable:u,keepWithNext:c}})))),s.push(M(e,"pg-keep-with-next",wt(a(e,"tableProps.k364"),c,u=>n({pagination:{pageable:d,keepWithNext:u}}))))}return Te(e,"pagination",a(e,"tableProps.k365"),"Document",[So(s)],!1)}const dr=new WeakMap,ji=[{value:"top",labelKey:"tableProps.k366"},{value:"right",labelKey:"tableProps.k367"},{value:"bottom",labelKey:"tableProps.k368"},{value:"left",labelKey:"tableProps.k369"}];function Gd(e,t){const o=e.store,r=o.tableSelection,i=t.options.tableRows??[];if(!r)return Te(e,"table-cell",a(e,"tableProps.k370"),"Menu",[]);const n=h.findMainCell(i,r.r1,r.c1),s=i[n.r]?.cells[n.c];if(!s)return Te(e,"table-cell",a(e,"tableProps.k371"),"Menu",[]);const d=()=>h.collectWritableCells(i,r),c=h.resolveCellGroupMode(i,r),u=c.count,f=c.mode==="multi",b=`${t.id}:${r.r1}:${r.c1}:${r.r2}:${r.c2}`,m=dr.get(o),E=m?.key===b?m:{key:b,border:{},values:{},edges:{}};m?.key!==b&&dr.set(o,E);const y=x=>{dr.set(o,{key:b,border:x.border??E.border,values:x.values??E.values,edges:x.edges??E.edges})},C=(x,G)=>{y({border:{...E.border,[x]:G}}),e.repaint()},D=(x,G)=>{d().forEach(x),f&&G&&y({values:{...E.values,...G}}),o.updateElement(t.id,{tableRows:i})},S=(x,G)=>{D(ye=>{ye[x]=G},{[x]:G})},_=x=>f?E.values[x]:s[x],z=x=>f&&x in E.values,A=f?{width:void 0,style:void 0,color:void 0}:h.resolveCellBorderDisplay(i,r),I=!f&&d().some(x=>!!x.borders&&!!(x.borders.top||x.borders.right||x.borders.bottom||x.borders.left)),K=!f&&!I,B={width:K?0:typeof A.width=="number"?A.width:h.DEFAULT_BORDER.width,style:K?"none":typeof A.style=="string"&&A.style!=="mixed"?A.style:h.DEFAULT_BORDER.style,color:typeof A.color=="string"&&A.color!=="mixed"?A.color:h.DEFAULT_BORDER.color,...E.border},L="__mixed__",U={style:!f&&A.style==="mixed",width:!f&&A.width==="mixed",color:!f&&A.color==="mixed"},re=U.style&&!("style"in E.border),V=U.width&&!("width"in E.border),he=U.color&&!("color"in E.border),ie=re||V||he,Ce=re?L:B.style,ke=V?void 0:B.width,v=he?void 0:B.color,ee=x=>{const G={style:x};x!=="none"&&ke===0?G.width=h.DEFAULT_BORDER.width:x==="none"&&!I&&(G.width=0),y({border:{...E.border,...G}}),e.repaint()},be=()=>({...B}),He=f?ji.reduce((x,G)=>(x[G.value]=E.edges[G.value]?"on":"off",x),{}):h.resolveBorderEdgeStates(d().map(x=>x.borders)),W=f?"cellType"in E.values?E.values.cellType??"text":h.resolveSharedCellType(i,r):s.cellType??"text",ae=W==="barcode",Re=W==="qrcode",Fe=W==="image",qe=W==="text",Y=ae&&!!_("printerDpi"),Ye=h.barcodeBarWidthRecommendText(_("printerDpi"),_("barWidth"),e.t??N),Z=f?E.values.textFit:h.resolveCellTextFit(s),To=f?"cellType"in E.values?E.values.cellType??"text":"":s.cellType||"text",ct=x=>Jn(f?[$d,...x]:x,e),De=x=>f?a(e,"tableProps.k372"):x,Me=(x,G)=>f?E.values[x]:G,Co=f?_("barcodeType")??"__multi__":s.barcodeType||"CODE128",Do=f?z("printerDpi")?_("printerDpi")?String(_("printerDpi")):"":"__multi__":s.printerDpi?String(s.printerDpi):"",Po=f?_("qrCodeLevel")??"__multi__":s.qrCodeLevel||"M",Ao=f?_("fit")??"__multi__":s.fit||"contain",jt=Z??"__multi__",Q=h.canMergeReason(i,r);let rt=!0;for(let x=r.r1;x<=r.r2;x++)if(i[x]?.type!=="data"){rt=!1;break}const J=rt?"":a(e,"tableProps.k373");let it=!1;for(let x=r.r1;x<=r.r2&&!it;x++)for(let G=r.c1;G<=r.c2&&!it;G++){const ye=i[x]?.cells[G];ye&&!ye.merged&&((ye.rowspan??1)>1||(ye.colspan??1)>1)&&(it=!0)}const ue=(x,G,ye,te={},Le)=>l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:x}),Le??""].filter(Boolean)),H({value:G,...te,onCommit:je=>S(ye,Er(je))})]),ht=a(e,"tableProps.k374"),X=x=>kt({target:s,base:{},propKey:x,tipOverride:ht,force:f,write:()=>S(x,void 0)}),Ie=t.options.tableDefaultPadding??1,Lt={width:h.cellFitWidthMm(t.options.tableColWidths??[],n.c,s,Ie),height:h.cellFitCapMm(i,n.r,s,Ie)};return Te(e,"table-cell",a(e,"tableProps.k375"),"Menu",[So([f?_t(a(e,"tableProps.k376",{v0:u})):"",l("div",{class:"pd-field"},[l("span",{class:"pd-label",text:a(e,"tableProps.k377")}),dt("cell-type",[{value:"text",label:a(e,"tableProps.k378")},{value:"barcode",label:a(e,"tableProps.k379")},{value:"qrcode",label:a(e,"tableProps.k380")},{value:"image",label:a(e,"tableProps.k381")}],To,x=>{const G=x==="text"?void 0:x,ye={cellType:x};x!=="barcode"&&Object.assign(ye,{barcodeType:void 0,showBarcodeText:void 0,printerDpi:void 0,barQuietZone:void 0,barHeight:void 0}),x!=="qrcode"&&Object.assign(ye,{qrCodeLevel:void 0,qrQuietZone:void 0}),D(te=>{te.cellType=G,x!=="barcode"&&(te.barcodeType=void 0,te.showBarcodeText=void 0,te.printerDpi=void 0,te.barQuietZone=void 0,te.barHeight=void 0),x!=="qrcode"&&(te.qrCodeLevel=void 0,te.qrQuietZone=void 0)},ye)})]),ae?$t(a(e,"tableProps.k382"),Co,ct(Bd),x=>{x!=="__multi__"&&S("barcodeType",x||void 0)}):"",ae?wt(a(e,"tableProps.k383"),f?E.values.showBarcodeText===!0:s.showBarcodeText!==!1,x=>S("showBarcodeText",x),void 0,X("showBarcodeText")):"",ae?ue(a(e,"tableProps.k384"),Me("barWidth",s.barWidth??2),"barWidth",{min:2,max:8,step:.5,placeholder:De("")},X("barWidth")):"",ae?_t((Y?a(e,"tableProps.k385"):a(e,"tableProps.k386"))+(Ye?`。${Ye}`:"")):"",ae?xe(a(e,"tableProps.k387"),H({value:Me("barQuietZone",s.barQuietZone),min:0,max:20,placeholder:De(a(e,"tableProps.k388")),onCommit:x=>S("barQuietZone",x)}),a(e,"propertyTips.cd-bar-quiet-zone"),X("barQuietZone")):"",ae?xe(a(e,"tableProps.k389"),H({value:Me("barHeight",s.barHeight),min:1,max:100,placeholder:De(a(e,"tableProps.k390")),onCommit:x=>S("barHeight",x??void 0)}),a(e,"propertyTips.cd-bar-height"),X("barHeight")):"",ae?ue(a(e,"tableProps.k391"),Me("barFontSize",s.barFontSize??10),"barFontSize",{min:5,max:24,placeholder:De(a(e,"tableProps.k392"))},X("barFontSize")):"",ae?$t(a(e,"tableProps.k393"),Do,ct([{value:"",label:a(e,"tableProps.k394")},{value:"203",label:a(e,"tableProps.k395")},{value:"300",label:a(e,"tableProps.k396")},{value:"600",label:a(e,"tableProps.k397")}]),x=>{if(x==="__multi__")return;const G=Number(x);S("printerDpi",G>0?G:void 0)},{reset:X("printerDpi")}):"",ae?_t(a(e,"tableProps.k398")):"",Re?$t(a(e,"tableProps.k399"),Po,ct(Ud),x=>{x!=="__multi__"&&S("qrCodeLevel",x||void 0)},{reset:X("qrCodeLevel")}):"",Re?xe(a(e,"tableProps.k400"),H({value:Me("qrQuietZone",s.qrQuietZone),min:0,max:8,placeholder:De(a(e,"tableProps.k401")),onCommit:x=>S("qrQuietZone",x)}),a(e,"propertyTips.cd-quiet-zone"),X("qrQuietZone")):"",ae?_t(a(e,"tableProps.k402")):"",Re||Fe?$t(a(e,"tableProps.k403"),Ao,ct(h.imageFitOptions(e.t??N)),x=>{x!=="__multi__"&&S("fit",x)},{reset:X("fit")}):"",Fe&&!f&&s.fit==="cover"?Zn(e,{fieldKey:"ap-img-object-position",label:a(e,"tableProps.k404"),src:h.resolveDesignImageSrc(s.formatter),fit:s.fit,containerClass:"pd-cell-anchor",widthMm:Lt.width,heightMm:Lt.height,scale:s.fitScale,value:s.objectPosition,onCommit:x=>S("objectPosition",x),onScaleCommit:x=>S("fitScale",x),resetAnchor:X("objectPosition"),resetScale:X("fitScale")}):"",ae||Re||Fe?ue(a(e,"tableProps.k405"),Me("maxWidth",bt(s.maxWidth)),"maxWidth",{min:0,max:200,placeholder:De(a(e,"tableProps.k406"))},X("maxWidth")):"",ae||Re||Fe?ue(a(e,"tableProps.k407"),Me("maxHeight",bt(s.maxHeight)),"maxHeight",{min:0,max:200,placeholder:De(a(e,"tableProps.k408"))},X("maxHeight")):"",l("div",{class:"pd-field"},[l("span",{class:"pd-label",text:a(e,"tableProps.k409")}),l("input",{class:"pd-input",type:"text",value:f?_("formatter")??"":s.formatter||"",placeholder:f?a(e,"tableProps.k410"):a(e,"tableProps.k411"),onChange:x=>S("formatter",x.target.value||void 0),onDblclick:()=>e.fire("table-cell-dblclick",{elementId:t.id,r:n.r,c:n.c,cellId:s.id})})]),l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"tableProps.k412")}),X("align")]),dt("cell-align",[{value:"left",label:a(e,"tableProps.k413")},{value:"center",label:a(e,"tableProps.k414")},{value:"right",label:a(e,"tableProps.k415")},{value:"justify",label:a(e,"tableProps.k416")}],f?E.values.align??"":s.align||"left",x=>S("align",x))]),l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"tableProps.k417")}),X("valign")]),dt("cell-valign",[{value:"top",label:a(e,"tableProps.k418")},{value:"middle",label:a(e,"tableProps.k419")},{value:"bottom",label:a(e,"tableProps.k420")}],f?E.values.valign??"":s.valign||"top",x=>S("valign",x))]),l("div",{class:"cell-style-grid"},[l("div",{class:"pd-field cell-font-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"tableProps.k421")}),X("fontFamily")]),ko({id:"cell-font",state:e.state,fonts:e.host.fonts,value:f?_("fontFamily"):s.fontFamily,placeholder:De(a(e,"tableProps.k422")),onChange:x=>S("fontFamily",x)})]),ue(a(e,"tableProps.k423"),Me("fontSize",bt(s.fontSize)),"fontSize",{min:0,max:72,placeholder:De(a(e,"tableProps.k424"))},X("fontSize")),l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"tableProps.k425")}),X("fontWeight")]),l("input",{class:"pd-switch",type:"checkbox",checked:f?E.values.fontWeight==="bold":s.fontWeight==="bold",onChange:x=>S("fontWeight",x.target.checked?"bold":void 0)})]),l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"tableProps.k426")}),X("color")]),Ae(f?_("color"):s.color,x=>S("color",x),a(e,"tableProps.k427"))]),l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"tableProps.k428")}),X("backgroundColor")]),Ae(f?_("backgroundColor"):s.backgroundColor,x=>S("backgroundColor",x),a(e,"tableProps.k429"))])]),Ge(a(e,"tableProps.k430")),l("div",{class:"border-style-row"},[gn(Ce,[...re?[{value:L,label:a(e,"tableProps.k431"),disabled:!0}]:[],...h.BORDER_LINE_STYLES.map(x=>({...x,label:a(e,x.labelKey)}))],x=>{x!==L&&ee(x)},{width:"90px"}),l("div",{style:{width:"112px",flexShrink:"0"}},[H({value:ke,min:.25,max:5,step:.25,placeholder:f?a(e,"tableProps.k432"):V?a(e,"tableProps.k433"):void 0,onCommit:x=>C("width",x)})]),Ae(v,x=>C("color",x),a(e,"tableProps.k434"))]),l("div",{class:"pd-button-group border-presets"},[["all",a(e,"tableProps.k435")],["outer",a(e,"tableProps.k436")],["inner",a(e,"tableProps.k437")],["none",a(e,"tableProps.k438")]].map(([x,G])=>l("button",{type:"button",class:"pd-button small",text:G,onClick:()=>{h.applyBorderPreset(i,r,B.style==="none"?"none":x,be()),o.updateElement(t.id,{tableRows:i})}}))),l("div",{class:"pd-checkbox-group"},ji.map(x=>l("label",{class:"pd-checkbox"},[l("input",{type:"checkbox",value:x.value,checked:He[x.value]==="on",indeterminate:He[x.value]==="mixed",onChange:G=>{const te=G.target.checked&&B.style!=="none";f&&y({edges:{...E.edges,[x.value]:te}}),D(Le=>{h.setCellBorderEdge(Le,x.value,te?be():null)})}}),l("span",{text:a(e,x.labelKey)})]))),_t(a(e,f?h.CELL_BORDER_APPLY_HINT_MULTI_KEY:ie?h.CELL_BORDER_APPLY_HINT_MIXED_KEY:h.CELL_BORDER_APPLY_HINT_KEY)),ue(a(e,"tableProps.k439"),Me("padding",bt(s.padding)),"padding",{min:0,max:10,step:.5,placeholder:De(a(e,"tableProps.k440"))},X("padding")),wt(a(e,"tableProps.k441"),f?E.values.wordWrap===!0:s.wordWrap??!0,x=>S("wordWrap",x),void 0,X("wordWrap")),qe?$t(a(e,"tableProps.k442"),jt,ct(Hd),x=>{x!=="__multi__"&&S("textFit",x)},{full:!0,reset:X("textFit")}):"",qe&&Z==="shrink"?ue(a(e,"tableProps.k443"),Me("shrinkMinFontSize",bt(s.shrinkMinFontSize)),"shrinkMinFontSize",{min:0,max:72,step:.5,placeholder:De(a(e,"tableProps.k444"))},X("shrinkMinFontSize")):"",l("div",{class:"merge-card"},[l("div",{class:"merge-card-title",text:a(e,"tableProps.k445")}),l("div",{class:"merge-btns"},[l("button",{type:"button",class:"pd-button small",text:a(e,"tableProps.k446"),disabled:!!Q,title:Q||"",onClick:()=>{h.mergeCells(i,r),o.updateElement(t.id,{tableRows:i})}}),l("button",{type:"button",class:"pd-button small",text:a(e,"tableProps.k447"),disabled:!it,onClick:()=>{h.splitCells(i,r),o.updateElement(t.id,{tableRows:i})}})]),l("div",{class:"merge-card-divider"}),wt(a(e,"tableProps.k448"),f?E.values.mergeSameValue===!0:s.mergeSameValue===!0,x=>S("mergeSameValue",x),J||void 0,rt?X("mergeSameValue"):void 0,!rt),_t(a(e,"tableProps.k449"))])])])}const pr=R.WATERMARK_DENSITY_PRESETS;function Sr(e){const t=e.trim();return t?/[{}]/.test(t)||/^[A-Za-z_$][\w$]*\s*\(/.test(t)?!0:/^[A-Za-z_$][\w$]*(\.[\w$]+)+$/.test(t):!1}function qd(e){return e?e.mode==="binding"?e.binding??"":e.content??"":""}function Yd(e){const t=e.store.templateData.watermark,o=qd(t),r=t?.mode==="binding"||o!==""&&Sr(o),i=(()=>{const u=t?.tileWidth??R.WATERMARK_DEFAULTS.tileWidth,f=t?.tileHeight??R.WATERMARK_DEFAULTS.tileHeight;for(const[b,m]of Object.entries(pr))if(m.width===u&&m.height===f)return b;return"custom"})(),n=u=>{const f={...t,testData:t?.testData??"",rotate:t?.rotate??R.WATERMARK_DEFAULTS.rotate,color:t?.color||R.WATERMARK_DEFAULTS.color,opacity:t?.opacity??R.WATERMARK_DEFAULTS.opacity,tileWidth:t?.tileWidth??R.WATERMARK_DEFAULTS.tileWidth,tileHeight:t?.tileHeight??R.WATERMARK_DEFAULTS.tileHeight};e.store.updateTemplateData({watermark:{...f,...u}})},s=()=>e.fire("open-expression",{elementId:"",targetPath:"watermark.content",value:o}),d={rotate:t?.rotate??R.WATERMARK_DEFAULTS.rotate,color:t?.color||R.WATERMARK_DEFAULTS.color,opacity:t?.opacity??R.WATERMARK_DEFAULTS.opacity,tileWidth:t?.tileWidth??R.WATERMARK_DEFAULTS.tileWidth,tileHeight:t?.tileHeight??R.WATERMARK_DEFAULTS.tileHeight},c=u=>kt({target:d,base:R.WATERMARK_DEFAULTS,propKey:u,write:()=>n({[u]:R.WATERMARK_DEFAULTS[u]})});return l("div",{class:"watermark-config"},[Ge(a(e,"watermark.k538")),l("form",{class:"pd-form",onSubmit:u=>u.preventDefault()},[l("div",{class:"pd-field"},[l("span",{class:"pd-label",text:a(e,"watermark.k539")}),l("input",{class:"pd-input",type:"text",value:o,placeholder:a(e,"watermark.k540"),title:a(e,"watermark.k541"),onChange:u=>{const f=u.target.value;n(Sr(f)?{mode:"binding",binding:f,content:""}:{mode:"fixed",content:f,binding:""})},onDblclick:s}),l("button",{type:"button",class:"pd-button small",text:a(e,"watermark.k542"),onClick:s})]),r?q(a(e,"watermark.k543"),l("input",{class:"pd-input",type:"text",value:t?.testData??"",placeholder:a(e,"watermark.k544"),onChange:u=>n({testData:u.target.value})})):"",l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"watermark.k545")}),c("rotate")]),l("input",{type:"range",class:"pd-range",min:-90,max:90,step:5,value:String(t?.rotate??R.WATERMARK_DEFAULTS.rotate),onChange:u=>n({rotate:Number(u.target.value)})}),l("span",{class:"pd-hint",text:`${t?.rotate??R.WATERMARK_DEFAULTS.rotate}°`})]),q(a(e,"watermark.k546"),Ae(t?.color||R.WATERMARK_DEFAULTS.color,u=>n({color:u}),a(e,"watermark.k547")),void 0,c("color")),l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"watermark.k548")}),c("opacity")]),l("input",{type:"range",class:"pd-range",min:.05,max:.5,step:.05,value:String(t?.opacity??R.WATERMARK_DEFAULTS.opacity),onChange:u=>n({opacity:Number(u.target.value)})}),l("span",{class:"pd-hint",text:(t?.opacity??R.WATERMARK_DEFAULTS.opacity).toFixed(2)})]),l("div",{class:"pd-field"},[l("span",{class:"pd-label",text:a(e,"watermark.k549")}),l("select",{class:"pd-select",style:{width:"100%"},onChange:u=>{const f=u.target.value,b=pr[f];b&&n({tileWidth:b.width,tileHeight:b.height})}},[...Object.entries(pr).map(([u,f])=>l("option",{value:u,text:`${a(e,f.labelKey)}${a(e,"constants.watermark.density.size",{w:f.width,h:f.height})}`,selected:i===u})),l("option",{value:"custom",text:a(e,"watermark.k550"),selected:i==="custom"})])]),i==="custom"?l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"watermark.k551")}),c("tileWidth")]),l("input",{type:"number",class:"pd-input",min:R.WATERMARK_DEFAULTS.minTileWidth,step:10,value:String(t?.tileWidth??R.WATERMARK_DEFAULTS.tileWidth),onChange:u=>n({tileWidth:Number(u.target.value)})})]):"",i==="custom"?l("div",{class:"pd-field"},[l("span",{class:"pd-label"},[l("span",{class:"pd-label-t",text:a(e,"watermark.k552")}),c("tileHeight")]),l("input",{type:"number",class:"pd-input",min:R.WATERMARK_DEFAULTS.minTileHeight,step:10,value:String(t?.tileHeight??R.WATERMARK_DEFAULTS.tileHeight),onChange:u=>n({tileHeight:Number(u.target.value)})})]):""].filter(Boolean))])}function de(e,t,o,r,i={},n){return q(t,H({value:o,...i,onCommit:r}),void 0,n)}function et(e,t,o,r,i,n,s){const d=document.createElement("select");d.className="pd-select",d.addEventListener("change",()=>i(d.value));for(const c of r){const u=document.createElement("option");u.value=c.value,u.textContent=c.label,d.appendChild(u)}return d.value=o,r.some(c=>c.value===o)||(d.selectedIndex=-1),n?xe(t,d,n,s):q(t,d,void 0,s)}function gt(e,t,o,r,i){return q(t,l("input",{type:"checkbox",class:"pd-switch",checked:o,onChange:n=>r(n.target.checked)}),void 0,i)}const jd=[{value:"all",labelKey:"propertyPanel.k177"},{value:"outer",labelKey:"propertyPanel.k178"},{value:"inner",labelKey:"propertyPanel.k179"},{value:"none",labelKey:"propertyPanel.k180"}],Xd=[{value:"top",labelKey:"propertyPanel.k181"},{value:"right",labelKey:"propertyPanel.k182"},{value:"bottom",labelKey:"propertyPanel.k183"},{value:"left",labelKey:"propertyPanel.k184"}];function Zd(e,t){const o=e.store,r=t.options,i=t.printElementType.type,n=v=>o.updateElement(t.id,v),s=wn(i),d=s==="text",c=s==="code",u=s==="table",f=u&&o.tableSelection?.elementId===t.id,b=f&&h.resolveCellGroupMode(t.options.tableRows??[],o.tableSelection).mode==="multi",m=[];b||m.push(zd(e,t));const E=h.createDefaultOptions(i),y=(v,ee)=>{const be=h.propertyDefault(ee);return kt({target:r,base:E,propKey:v,tipValue:be?.value,tipUnit:be?.unit,write:()=>n({[v]:E[v]})})};f||m.push(Te(e,"position-size",a(e,"propertyPanel.k185"),"Location",[l("form",{class:"pd-form",onSubmit:v=>v.preventDefault()},[l("div",{class:"position-grid"},[M(e,"ps-left",de(e,"X",r.left,v=>n({left:v}),{min:0})),M(e,"ps-top",de(e,"Y",r.top,v=>n({top:v}),{min:0})),M(e,"ps-width",de(e,"W",r.width,v=>n({width:v}),{min:4})),M(e,"ps-height",de(e,"H",r.height,v=>n({height:v}),{min:4}))]),l("h3",{class:"pd-divider",text:a(e,"propertyPanel.k186")}),l("div",{class:"margin-grid"},[M(e,"ps-margin-top",de(e,a(e,"propertyPanel.k187"),r.marginTop,v=>n({marginTop:v===0?void 0:v}),{},y("marginTop","ps-margin-top"))),M(e,"ps-margin-right",de(e,a(e,"propertyPanel.k188"),r.marginRight,v=>n({marginRight:v===0?void 0:v}),{},y("marginRight","ps-margin-right"))),M(e,"ps-margin-bottom",de(e,a(e,"propertyPanel.k189"),r.marginBottom,v=>n({marginBottom:v===0?void 0:v}),{},y("marginBottom","ps-margin-bottom"))),M(e,"ps-margin-left",de(e,a(e,"propertyPanel.k190"),r.marginLeft,v=>n({marginLeft:v===0?void 0:v}),{},y("marginLeft","ps-margin-left")))])])]));const C=typeof r.rotate=="number"&&Number.isFinite(r.rotate)&&r.rotate!==0?h.normalizeRotationAngle(r.rotate):void 0,D=v=>n({rotate:v===void 0||v===0?void 0:h.normalizeRotationAngle(v)}),S=h.isFreeAngleEditable(i,r),_=h.isRotationExcludedType(i)||h.collectFollowMemberIds(o.elements).has(t.id),z=_?"":M(e,"ap-rotate",xe(a(e,"propertyPanel.k191"),l("div",{class:"pd-rotate-row"},[l("button",{type:"button",class:"pd-rotate-btn",title:a(e,"propertyPanel.k192"),"aria-label":a(e,"propertyPanel.k193"),text:"↺",onClick:()=>D((C??0)-90)}),l("div",{class:"pd-rotate-stepper"},[H({value:C,min:0,max:359,placeholder:"0",disabled:!S,onCommit:v=>D(v)})]),l("button",{type:"button",class:"pd-rotate-btn",title:a(e,"propertyPanel.k194"),"aria-label":a(e,"propertyPanel.k195"),text:"↻",onClick:()=>D((C??0)+90)})]),a(e,"propertyTips.ap-rotate"),y("rotate","ap-rotate"))),A=_||S?"":l("p",{class:"pd-hint pd-rotate-note",text:h.codeObliqueNote(e.t??N)});if(m.push(Te(e,"appearance",a(e,"propertyPanel.k196"),"Brush",[l("form",{class:"pd-form",onSubmit:v=>v.preventDefault()},d?[M(e,"ap-font-family",q(a(e,"propertyPanel.k197"),ko({id:"prop-font",state:e.state,fonts:e.host.fonts,value:typeof r.fontFamily=="string"?r.fontFamily:void 0,placeholder:a(e,"propertyPanel.k198"),onChange:v=>n({fontFamily:v})}),void 0,y("fontFamily","ap-font-family"))),M(e,"ap-font-size",de(e,a(e,"propertyPanel.k199"),r.fontSize,v=>n({fontSize:v}),{min:8,max:72},y("fontSize","ap-font-size"))),M(e,"ap-font-weight",et(e,a(e,"propertyPanel.k200"),String(r.fontWeight??""),[{value:"normal",label:a(e,"propertyPanel.k201")},{value:"bold",label:a(e,"propertyPanel.k202")},{value:"bolder",label:a(e,"propertyPanel.k203")},{value:"lighter",label:a(e,"propertyPanel.k204")}],v=>n({fontWeight:v}),void 0,y("fontWeight","ap-font-weight"))),M(e,"ap-align",q(a(e,"propertyPanel.k205"),dt("ta",[{value:"left",label:a(e,"propertyPanel.k206")},{value:"center",label:a(e,"propertyPanel.k207")},{value:"right",label:a(e,"propertyPanel.k208")},{value:"justify",label:a(e,"propertyPanel.k209")}],r.textAlign||"left",v=>n({textAlign:v})),void 0,y("textAlign","ap-align"))),M(e,"ap-vertical-align",q(a(e,"propertyPanel.k210"),dt("va",[{value:"top",label:a(e,"propertyPanel.k211")},{value:"middle",label:a(e,"propertyPanel.k212")},{value:"bottom",label:a(e,"propertyPanel.k213")}],r.verticalAlign||"top",v=>n({verticalAlign:v})),void 0,y("verticalAlign","ap-vertical-align"))),l("div",{class:"color-row"},[M(e,"ap-color",q(a(e,"propertyPanel.k214"),Ae(r.color,v=>n({color:v}),a(e,"propertyPanel.k215")),void 0,y("color","ap-color"))),M(e,"ap-bg-color",q(a(e,"propertyPanel.k216"),Ae(r.backgroundColor,v=>n({backgroundColor:v}),a(e,"propertyPanel.k217")),void 0,y("backgroundColor","ap-bg-color")))]),M(e,"ap-line-height",de(e,a(e,"propertyPanel.k218"),r.lineHeight,v=>n({lineHeight:v||void 0}),{min:0,max:100},y("lineHeight","ap-line-height"))),M(e,"ap-letter-spacing",de(e,a(e,"propertyPanel.k219"),r.letterSpacing,v=>n({letterSpacing:v||void 0}),{min:0,max:20,step:.5},y("letterSpacing","ap-letter-spacing"))),M(e,"ap-text-fit",et(e,a(e,"propertyPanel.k220"),h.resolveElementTextFit(i,r),[{value:"clip",label:a(e,"propertyPanel.k221")},{value:"shrink",label:a(e,"propertyPanel.k222")},{value:"autoHeight",label:a(e,"propertyPanel.k223")}],v=>n({textFit:v}),void 0,y("textFit","ap-text-fit"))),r.textFit==="shrink"?M(e,"ap-shrink-min",q(a(e,"propertyPanel.k224"),H({value:r.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:a(e,"propertyPanel.k225"),onCommit:v=>n({shrinkMinFontSize:v||void 0})}),void 0,y("shrinkMinFontSize","ap-shrink-min"))):"",i==="longText"?M(e,"ap-long-text-indent",xe(a(e,"propertyPanel.k226"),H({value:r.longTextIndent,min:0,max:10,placeholder:a(e,"propertyPanel.k227"),onCommit:v=>n({longTextIndent:v||void 0})}),a(e,"propertyTips.ap-long-text-indent"),y("longTextIndent","ap-long-text-indent"))):"",M(e,"ap-word-wrap",gt(e,a(e,"propertyPanel.k228"),r.wordWrap!==!1,v=>n({wordWrap:v?void 0:!1}),y("wordWrap","ap-word-wrap"))),M(e,"ap-keep-line-breaks",gt(e,a(e,"propertyPanel.k229"),r.keepLineBreaks===!0,v=>n({keepLineBreaks:v?!0:void 0}),y("keepLineBreaks","ap-keep-line-breaks"))),z,A]:[i==="image"?M(e,"ap-img-fit",et(e,a(e,"propertyPanel.k230"),String(r.fit??"contain"),h.imageFitOptions(e.t??N),v=>n({fit:v}),a(e,"propertyTips.ap-img-fit"),y("fit","ap-img-fit"))):"",i==="image"&&r.fit==="cover"?M(e,"ap-img-object-position",Zn(e,{fieldKey:"ap-img-object-position",label:a(e,"propertyPanel.k231"),src:h.resolveDesignImageSrc(r.src),widthMm:Number(r.width)||0,heightMm:Number(r.height)||0,fit:r.fit,scale:r.fitScale,value:r.objectPosition===void 0?void 0:String(r.objectPosition),onCommit:v=>n({objectPosition:v}),onScaleCommit:v=>n({fitScale:v}),resetAnchor:y("objectPosition","ap-img-object-position"),resetScale:y("fitScale","ap-img-fit-scale")})):"",z,A,i==="flowList"?l("p",{class:"pd-empty",text:a(e,"propertyPanel.k232")}):""].filter(Boolean))])),c){const v=i==="barcode",ee=String(r.barcodeType||"CODE128").toUpperCase(),be=r.printerDpi?String(r.printerDpi):"",He=h.barcodeBarWidthRecommendText(r.printerDpi,r.barWidth,e.t??N);m.push(Te(e,"code",a(e,"propertyPanel.k233"),"Postcard",[l("form",{class:"pd-form",onSubmit:W=>W.preventDefault()},[v?[M(e,"cd-type",et(e,a(e,"propertyPanel.k234"),ee,[{value:"CODE128",label:a(e,"propertyPanel.k235")},{value:"EAN13",label:a(e,"propertyPanel.k236")},{value:"EAN8",label:"EAN8"},{value:"UPC",label:"UPC"},{value:"CODE39",label:"CODE39"},{value:"ITF14",label:"ITF14"}],W=>n({barcodeType:W==="CODE128"?void 0:W}))),M(e,"cd-dpi",et(e,a(e,"propertyPanel.k237"),be,[{value:"",label:a(e,"propertyPanel.k238")},{value:"203",label:a(e,"propertyPanel.k239")},{value:"300",label:a(e,"propertyPanel.k240")},{value:"600",label:a(e,"propertyPanel.k241")}],W=>n({printerDpi:Number(W)>0?Number(W):void 0}),void 0,y("printerDpi","cd-dpi"))),M(e,"cd-dpi",l("p",{class:"pd-hint",text:a(e,"propertyPanel.k242")})),M(e,"cd-bar-width",de(e,a(e,"propertyPanel.k243"),r.barWidth??2,W=>n({barWidth:W}),{min:2,max:8,step:.5},y("barWidth","cd-bar-width"))),M(e,"cd-bar-width",l("p",{class:"pd-hint",text:(be?a(e,"propertyPanel.k244"):a(e,"propertyPanel.k245"))+(He?`。${He}`:"")})),M(e,"cd-bar-quiet-zone",xe(a(e,"propertyPanel.k246"),H({value:r.barQuietZone,min:0,max:20,placeholder:a(e,"propertyPanel.k247"),onCommit:W=>n({barQuietZone:W})}),a(e,"propertyTips.cd-bar-quiet-zone"),y("barQuietZone","cd-bar-quiet-zone"))),M(e,"cd-bar-height",xe(a(e,"propertyPanel.k248"),H({value:r.barHeight,min:1,max:100,placeholder:a(e,"propertyPanel.k249"),onCommit:W=>n({barHeight:W??void 0})}),a(e,"propertyTips.cd-bar-height"),y("barHeight","cd-bar-height"))),M(e,"cd-show-text",gt(e,a(e,"propertyPanel.k250"),r.hideTitle!==!0,W=>n({hideTitle:W?void 0:!0}),y("hideTitle","cd-show-text"))),M(e,"cd-font-size",q(a(e,"propertyPanel.k251"),H({value:r.fontSize,min:5,max:24,placeholder:a(e,"propertyPanel.k252"),onCommit:W=>n({fontSize:W||void 0})}),void 0,y("fontSize","cd-font-size")))]:[M(e,"cd-ec-level",et(e,a(e,"propertyPanel.k253"),String(r.qrCodeLevel??"M"),[{value:"L",label:a(e,"propertyPanel.k254")},{value:"M",label:a(e,"propertyPanel.k255")},{value:"Q",label:"Q"},{value:"H",label:a(e,"propertyPanel.k256")}],W=>n({qrCodeLevel:W}),void 0,y("qrCodeLevel","cd-ec-level"))),M(e,"cd-quiet-zone",xe(a(e,"propertyPanel.k257"),H({value:r.qrQuietZone,min:0,max:8,placeholder:a(e,"propertyPanel.k258"),onCommit:W=>n({qrQuietZone:W})}),a(e,"propertyTips.cd-quiet-zone"),y("qrQuietZone","cd-quiet-zone")))],Ge(a(e,"propertyPanel.k259")),v?l("p",{class:"pd-hint",text:a(e,"propertyPanel.k260")}):"",v?"":M(e,"cd-fit",et(e,a(e,"propertyPanel.k261"),String(r.fit||"contain"),h.imageFitOptions(e.t??N),W=>n({fit:W||void 0}),void 0,y("fit","cd-fit"))),M(e,"cd-max-width",q(a(e,"propertyPanel.k262"),H({value:r.maxWidth,min:1,max:200,placeholder:a(e,"propertyPanel.k263"),onCommit:W=>n({maxWidth:W||void 0})}),void 0,y("maxWidth","cd-max-width"))),M(e,"cd-max-height",q(a(e,"propertyPanel.k264"),H({value:r.maxHeight,min:1,max:200,placeholder:a(e,"propertyPanel.k265"),onCommit:W=>n({maxHeight:W||void 0})}),void 0,y("maxHeight","cd-max-height")))].flat().filter(Boolean))]))}if(f&&(m.push(Wd(e,t)),m.push(Gd(e,t))),u&&m.push(Kd(e,t)),i==="flowList"){const v=h.resolveFlowColumns(r.flowColumns),ee=h.resolveFlowRowHeight(r.flowRowHeight),be=h.resolveFlowGapX(r.flowGapX),He=h.resolveFlowMaxSpan(r.flowMaxSpan,v),W=h.suggestFlowColumns(r.width??0,be,r.fontSize??12),ae=h.resolveFlowLayoutMode(r.flowLayoutMode),Re=ae==="dynamic",Fe=h.resolveFlowPadding(r),qe=(Y,Ye)=>{n({[Y]:typeof Ye=="number"&&Number.isFinite(Ye)&&Ye>0?Ye:0})};m.push(Te(e,"flowList",a(e,"propertyPanel.k266"),"Grid3x3",[l("form",{class:"pd-form",onSubmit:Y=>Y.preventDefault()},[M(e,"fl-layout-mode",et(e,a(e,"propertyPanel.k267"),ae,[{value:"fixed",label:a(e,"propertyPanel.k268")},{value:"dynamic",label:a(e,"propertyPanel.k269")}],Y=>n({flowLayoutMode:Y==="dynamic"?"dynamic":"fixed"}),a(e,"propertyTips.fl-layout-mode"))),...Re?[M(e,"fl-padding-top",xe(a(e,"propertyPanel.k270"),H({value:Fe.top,min:0,max:100,step:.5,onCommit:Y=>qe("flowPaddingTop",Y)}),a(e,"propertyTips.fl-padding-top"))),M(e,"fl-padding-right",xe(a(e,"propertyPanel.k271"),H({value:Fe.right,min:0,max:100,step:.5,onCommit:Y=>qe("flowPaddingRight",Y)}),a(e,"propertyTips.fl-padding-right"))),M(e,"fl-padding-bottom",xe(a(e,"propertyPanel.k272"),H({value:Fe.bottom,min:0,max:100,step:.5,onCommit:Y=>qe("flowPaddingBottom",Y)}),a(e,"propertyTips.fl-padding-bottom"))),M(e,"fl-padding-left",xe(a(e,"propertyPanel.k273"),H({value:Fe.left,min:0,max:100,step:.5,onCommit:Y=>qe("flowPaddingLeft",Y)}),a(e,"propertyTips.fl-padding-left")))]:[],M(e,"fl-columns",xe(a(e,"propertyPanel.k274"),H({value:v,min:1,max:12,onCommit:Y=>n({flowColumns:h.resolveFlowColumns(Y),flowMaxSpan:h.resolveFlowMaxSpan(r.flowMaxSpan,h.resolveFlowColumns(Y))})}),a(e,"propertyTips.fl-columns"))),M(e,"fl-row-height",xe(a(e,"propertyPanel.k275"),H({value:ee,min:3,max:100,step:.5,onCommit:Y=>n({flowRowHeight:h.resolveFlowRowHeight(Y)})}),a(e,"propertyTips.fl-row-height"))),M(e,"fl-gap-x",xe(a(e,"propertyPanel.k276"),H({value:be,min:0,max:50,step:.5,onCommit:Y=>n({flowGapX:h.resolveFlowGapX(Y)})}),a(e,"propertyTips.fl-gap-x"))),M(e,"fl-auto-span",gt(e,a(e,"propertyPanel.k277"),r.flowAutoSpan===!0,Y=>{n(Y?{flowAutoSpan:Y,flowMaxSpan:He}:{flowAutoSpan:Y})})),r.flowAutoSpan===!0?M(e,"fl-max-span",xe(a(e,"propertyPanel.k278"),H({value:He,min:1,max:v,onCommit:Y=>n({flowMaxSpan:h.resolveFlowMaxSpan(Y,v)})}),a(e,"propertyTips.fl-max-span"))):"",v>W?l("p",{class:"pd-hint",text:a(e,"propertyPanel.k279",{v0:v,v1:W,v2:v})}):""].flat().filter(Boolean))]))}const I=()=>({borderWidth:r.borderWidth,borderStyle:r.borderStyle,borderColor:r.borderColor,borders:r.borders}),K=v=>{const ee=I();h.applyElementBorderPreset(ee,v,h.effectiveElementBorderSpec(ee)),n(ee)},B=v=>{const ee=I();h.setElementBorderEdgeVisible(ee,v,!h.elementBorderEdgeVisible(ee,v)),n(ee)},L=h.resolveElementBorderDisplay(r),U=L.style==="mixed",re=typeof L.width=="number"?L.width:void 0,V=U||L.style===void 0?"":L.style,he=typeof L.color=="string"?L.color:void 0,ie=(v,ee)=>{const be=I();h.setElementBorderField(be,v,ee),n(be)},Ce=h.BORDER_LINE_STYLES.map(v=>({...v,label:a(e,v.labelKey)})),ke=U?[{value:"",label:a(e,"propertyPanel.k280")},...Ce]:Ce;return m.push(Te(e,"border-bg",a(e,"propertyPanel.k281"),"Picture",[l("form",{class:"pd-form",onSubmit:v=>v.preventDefault()},[M(e,"bb-border-style",et(e,a(e,"propertyPanel.k282"),V,ke,v=>ie("borderStyle",v))),l("div",{class:"border-row"},[M(e,"bb-border-width",de(e,a(e,"propertyPanel.k283"),re,v=>ie("borderWidth",v),{min:0,max:20,step:.25,placeholder:L.width==="mixed"?a(e,"propertyPanel.k284"):void 0},y("borderWidth","bb-border-width"))),M(e,"bb-border-color",q(a(e,"propertyPanel.k285"),Ae(he,v=>ie("borderColor",v),a(e,"propertyPanel.k286")),void 0,y("borderColor","bb-border-color")))]),...h.acceptsElementBorder(i)?[l("div",{class:"pd-button-group border-presets"},jd.map(v=>l("button",{type:"button",class:"pd-button small",text:a(e,v.labelKey),disabled:v.value==="inner",onClick:()=>K(v.value)}))),l("div",{class:"pd-checkbox-group"},Xd.map(v=>l("label",{class:"pd-checkbox"},[l("input",{type:"checkbox",checked:h.elementBorderEdgeVisible(r,v.value),onChange:()=>B(v.value)}),l("span",{text:a(e,v.labelKey)})]))),l("p",{class:"pd-hint",text:a(e,h.ELEMENT_BORDER_APPLY_HINT_KEY)})]:[],M(e,"bb-bg-color",q(a(e,"propertyPanel.k287"),Ae(r.backgroundColor,v=>n({backgroundColor:v}),a(e,"propertyPanel.k288")),void 0,y("backgroundColor","bb-bg-color")))])])),m.push(Vd(e,t)),m.push(Te(e,"advanced",a(e,"propertyPanel.k289"),"Setting",[l("form",{class:"pd-form",onSubmit:v=>v.preventDefault()},[l("div",{class:"advanced-row"},[M(e,"ad-locked",gt(e,a(e,"propertyPanel.k290"),!!r.locked,v=>n({locked:v}),y("locked","ad-locked"))),M(e,"ad-fixed",gt(e,a(e,"propertyPanel.k291"),!!r.repeatOnEveryPage,v=>n({repeatOnEveryPage:v}),y("repeatOnEveryPage","ad-fixed"))),M(e,"ad-fixed-position",gt(e,a(e,"propertyPanel.k292"),!!r.fixed,v=>n({fixed:v}),y("fixed","ad-fixed-position")))]),M(e,"ad-z-index",de(e,a(e,"propertyPanel.k293"),r.zIndex,v=>n({zIndex:v}),{min:0,max:999},y("zIndex","ad-z-index"))),M(e,"ad-delete",l("div",{class:"pd-field"},[l("button",{type:"button",class:"pd-button danger",text:a(e,"propertyPanel.k294"),onClick:()=>o.deleteSelected()})]))])],!1,[l("button",{type:"button",class:"group-help",title:a(e,"propertyPanel.k295"),"aria-label":a(e,"propertyPanel.k296"),text:"?",onClick:v=>{v.stopPropagation(),e.fire("help","advanced-settings")}})])),l("div",{class:"property-content"},m)}function Qd(e){const t=e.store,o=t.templateData,r=c=>t.updateTemplateData(c),i=c=>{const u=o.tiling,f=b=>b===90||b===270;if(u?.enabled&&f(c)!==f(o.outputRotation)){const b=R.computeMaxColumns({...o,outputRotation:c});r({outputRotation:c,tiling:{...u,columns:Math.max(b,1)}});return}r({outputRotation:c})},n=[];for(const[c,u]of Object.entries(h.PAPER_PRESETS)){const f=a(e,`constants.paper.group.${u.group}`);let b=n.find(m=>m.group===f);b||(b={group:f,items:[]},n.push(b)),b.items.push({key:c,label:a(e,u.labelKey)})}const s=!h.PAPER_PRESETS[o.paperSize],d=h.isContinuousPaperSize(o.paperSize);return l("form",{class:"pd-form",onSubmit:c=>c.preventDefault()},[Ge(a(e,"propertyPanel.k298")),q(a(e,"propertyPanel.k299"),l("select",{class:"pd-select",style:{width:"100%"},onChange:c=>r({paperSize:c.target.value})},[...n.map(c=>l("optgroup",{label:c.group},c.items.map(u=>l("option",{value:u.key,text:u.label,selected:o.paperSize===u.key})))),l("option",{value:"CUSTOM",text:a(e,"propertyPanel.k300"),selected:s})])),d||s?q(d?a(e,"propertyPanel.k301"):a(e,"propertyPanel.k302"),l("div",{class:"custom-size-grid"},[H({value:Number(o.customWidth??0),min:25,max:2e3,onCommit:c=>r({customWidth:c})}),...s?[l("span",{class:"custom-size-x",text:"×"}),H({value:Number(o.customHeight??0),min:25,max:2e3,onCommit:c=>r({customHeight:c})})]:[]])):"",d?"":q(a(e,"propertyPanel.k303"),dt("ori",[{value:"portrait",label:a(e,"propertyPanel.k304")},{value:"landscape",label:a(e,"propertyPanel.k305")}],o.orientation==="landscape"?"landscape":"portrait",c=>r({orientation:c})),a(e,"propertyPanel.k306")),d?"":q(a(e,"propertyPanel.k307"),dt("rot",[{value:"0",label:"0°"},{value:"90",label:"90°"},{value:"180",label:"180°"},{value:"270",label:"270°"}],String(o.outputRotation??0),c=>i(Number(c)),!0),o.tiling?.enabled?a(e,"propertyPanel.k308"):a(e,"propertyPanel.k309")),q(a(e,"propertyPanel.k310"),l("div",{class:"page-bg-row"},[Ae(o.pageBackground,c=>r({pageBackground:c}),a(e,"propertyPanel.k311"),"page-bg-picker")]),void 0,kt({target:o,base:{pageBackground:void 0},propKey:"pageBackground",write:()=>r({pageBackground:void 0})})),Ed(e),t.pages.length>1?"":Sd(e),Ge(a(e,"propertyPanel.k312")),l("div",{class:"margin-grid"},[de(e,a(e,"propertyPanel.k313"),o.margins.top,c=>r({margins:{...o.margins,top:c}}),{min:0,max:50}),de(e,a(e,"propertyPanel.k314"),o.margins.bottom,c=>r({margins:{...o.margins,bottom:c}}),{min:0,max:100}),de(e,a(e,"propertyPanel.k315"),o.margins.left,c=>r({margins:{...o.margins,left:c}}),{min:0,max:50}),de(e,a(e,"propertyPanel.k316"),o.margins.right,c=>r({margins:{...o.margins,right:c}}),{min:0,max:50})]),Ge(a(e,"propertyPanel.k317")),de(e,a(e,"propertyPanel.k318"),o.header.height??10,c=>r({header:{...o.header,height:c}}),{min:0,max:100,step:.1}),de(e,a(e,"propertyPanel.k319"),o.footer.height??10,c=>r({footer:{...o.footer,height:c}}),{min:0,max:100,step:.1}),Yd(e)].filter(Boolean))}function Jd(e,t,o){const r=(e.state.propSearch??"").trim(),i=!r||h.matchKeywords(r,[...o.searchKeywords,o.label]),n=document.createElement("div");if(n.className="property-content",i)try{zn(`property:${t.id}`,o.ui.renderProperty({element:t,data:e.host.designData?.length?e.host.designData:[h.DEFAULT_DEMO_DATA],fields:e.host.fields??[],update:s=>e.store.updateElement(t.id,s),repaint:()=>e.repaint(),t:e.t??N}),n)}catch{}return l("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:custom"},style:e.state.propTab==="custom"?"":{display:"none"}},[n])}function ep(e){const t=e.store,o=e.state,r=t.selectedElement,i=r?br(r):void 0;if(o.propCollapsed)return l("div",{class:"property-panel collapsed"},[l("div",{class:"prop-collapsed"},[l("button",{type:"button",class:"pc-btn",title:a(e,"propertyPanel.k320"),text:"«",onClick:()=>{o.propCollapsed=!1,e.repaint()}}),...i?[l("button",{type:"button",class:`pc-btn${o.propTab==="custom"?" on":""}`,title:i.label,html:ge(i.icon,14)||ge("Shapes",14),onClick:()=>{o.propTab="custom",o.propCollapsed=!1,e.repaint()}})]:[],...[["element",a(e,"propertyPanel.k321"),"▦"],["page",a(e,"propertyPanel.k322"),"▤"]].map(([s,d,c])=>l("button",{type:"button",class:`pc-btn${o.propTab===s?" on":""}`,title:d,text:c,onClick:()=>{o.propTab=s,o.propCollapsed=!1,e.repaint()}}))])]);const n=r?o.propTab==="custom"&&!i?"element":o.propTab:"page";return l("div",{class:"property-panel"},[l("div",{class:"prop-head"},[l("span",{class:"prop-title",text:a(e,"propertyPanel.k323")}),l("button",{type:"button",class:"collapse-btn",title:a(e,"propertyPanel.k324"),text:"»",onClick:()=>{o.propCollapsed=!0,e.repaint()}})]),l("div",{class:"pd-tabs prop-tabs"},[l("div",{class:"pd-tab-bar",role:"tablist"},[...i?[l("button",{type:"button",class:`pd-tab${n==="custom"?" active":""}`,text:i.label,onClick:()=>{o.propTab="custom",e.repaint()}})]:[],l("button",{type:"button",class:`pd-tab${n==="element"?" active":""}`,text:a(e,"propertyPanel.k325"),onClick:()=>{o.propTab="element",e.repaint()}}),l("button",{type:"button",class:`pd-tab${n==="page"?" active":""}`,text:a(e,"propertyPanel.k326"),onClick:()=>{o.propTab="page",e.repaint()}})]),i&&r?Jd(e,r,i):"",l("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:element"},style:n==="element"?"":{display:"none"}},r?[Md(e),Zd(e,r)]:[l("p",{class:"pd-empty",text:a(e,"propertyPanel.k327")})]),l("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:page"},style:n==="page"?"":{display:"none"}},[Qd(e)])].filter(Boolean))])}var P=we.t,tp={Check:'<path d="M20 6 9 17l-5-5" />',Copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2" /><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />'};function op(e,t=16){return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${tp[e]??""}</svg>`}function ho(e){const t=typeof e=="string"?e.trim().toLowerCase():"";return t==="label"||t==="key"||t==="both"?t:"both"}function cr(){return[{key:"field",text:P("expression.tabField")},{key:"variable",text:P("expression.tabVariable")},{key:"function",text:P("expression.tabFunction")}]}function Xi(){return{field:P("expression.placeholderField"),variable:P("expression.placeholderVariable"),function:P("expression.placeholderFunction")}}function rp(){return[{name:"SUM",label:P("expression.fnSum"),template:"SUM()"},{name:"AVG",label:P("expression.fnAvg"),template:"AVG()"},{name:"COUNT",label:P("expression.fnCount"),template:"COUNT()"},{name:"MIN",label:P("expression.fnMin"),template:"MIN()"},{name:"MAX",label:P("expression.fnMax"),template:"MAX()"}]}function ip(){return[{name:"ADD",label:P("expression.fnAdd"),template:"ADD()"},{name:"SUB",label:P("expression.fnSub"),template:"SUB()"},{name:"MUL",label:P("expression.fnMul"),template:"MUL()"},{name:"DIV",label:P("expression.fnDiv"),template:"DIV()"},{name:"ROUND",label:P("expression.fnRound"),template:"ROUND()"},{name:"ROUNDUP",label:P("expression.fnRoundUp"),template:"ROUNDUP()"},{name:"ROUNDDOWN",label:P("expression.fnRoundDown"),template:"ROUNDDOWN()"},{name:"ROUNDBANK",label:P("expression.fnRoundBank"),template:"ROUNDBANK()"}]}function np(){return[{name:"MONEY",label:P("expression.fnMoney"),template:"MONEY()"},{name:"DATE",label:P("expression.fnDate"),template:"DATE()"},{name:"UPPER",label:P("expression.fnUpper"),template:"UPPER()"},{name:"IF",label:P("expression.fnIf"),template:"IF()"}]}function ap(){return[{name:"pageIndex",label:P("expression.varPageIndex"),template:"{pageIndex}"},{name:"totalPages",label:P("expression.varTotalPages"),template:"{totalPages}"},{name:"printDate",label:P("expression.varPrintDate"),template:"{printDate}"},{name:"printTime",label:P("expression.varPrintTime"),template:"{printTime}"}]}function lp(){return[{title:P("expression.groupAggregate"),items:rp()},{title:P("expression.groupMath"),items:ip()},{title:P("expression.groupFormat"),items:np()}]}var sp="expression.previewEmpty",dp="expression.previewNoValue",Tr="expression.previewError";function Zi(e,t){if(!e.trim())return P(sp);try{const o={...h.DEFAULT_DEMO_DATA,...t??{},...R.resolveSystemVariables()},r=h.evaluateTemplate(e,o);return r==null?P(dp):String(r)}catch{return P(Tr)}}function Qi(e,t){const o=t.trim().toLowerCase();return o?e.filter(r=>r.label.toLowerCase().includes(o)||r.name.toLowerCase().includes(o)):e}function pp(e,t){const o=e.substring(0,t),r=o.lastIndexOf("{"),i=r!==-1&&!o.slice(r+1).includes("}"),n=o.lastIndexOf("("),s=n!==-1&&!o.slice(n+1).includes(")");return{insideBlock:i,insideParens:s}}var cp=e=>/[\u4e00-\u9fff]/.test(e),hp=e=>`字段「${e}」含中文,请用 {${e}} 引用(函数参数内写 ${e});中文可直接在 {} 中使用,无需 data['...'] 方括号`;function up(e,t){const o=/^\{\s*([^{}]+?)\s*\}$/.exec(e.trim());if(!o)return null;const r=o[1]??"";return t.find(i=>i.fieldKey===r)??null}function hr(e,t,o="both"){return o==="label"?l("div",{class:"ee-field-info"},[l("span",{class:"ee-item-label",text:e})]):o==="key"?l("div",{class:"ee-field-info"},[l("span",{class:"ee-item-key is-primary",text:t})]):l("div",{class:"ee-field-info"},[l("span",{class:"ee-item-label",text:e}),l("span",{class:"ee-item-key",text:t})])}function Ve(e){return e.currentTarget.getRootNode()}function so(e,t,o){const r=[];return o.forEach((i,n)=>{r.push(i),n<o.length-1&&r.push(l("br"))}),l("div",{class:`ee-help-card ${e}`},[l("div",{class:"ee-help-card-title",text:t}),l("div",{class:"ee-help-card-content"},r)])}function fp(){return l("div",{class:"ee-help-section"},[l("div",{class:"ee-help-title",text:P("expression.k1")}),l("div",{class:"ee-help-grid"},[so("ee-help-field",P("expression.k2"),[P("expression.k3"),P("expression.k4"),P("expression.k5"),P("expression.k6"),P("expression.k7"),P("expression.k8"),P("expression.k9")]),so("ee-help-function",P("expression.k10"),[P("expression.k11"),P("expression.k12"),P("expression.k13"),P("expression.k14"),P("expression.k15"),P("expression.k16")]),so("ee-help-variable",P("expression.k17"),[P("expression.k18"),P("expression.k19"),P("expression.k20")]),so("ee-help-conditional",P("expression.k21"),[P("expression.k22"),P("expression.k23"),P("expression.k24"),P("expression.k25"),P("expression.k26")])])])}function gp(e,t){P=e.t??we.t;const o=ho(e.fieldDisplay),r={activeTab:"field",searchText:"",expression:t.value||"",binding:t.binding,copiedFieldKey:"",keyHint:""},i=(S,_)=>S.querySelector(_),n=S=>{const _=i(S,".ee-preview");if(!_)return;const z=Zi(r.expression,e.demoData);_.textContent=z,_.classList.toggle("ee-preview-error",z===P(Tr))},s=S=>{const _=i(S,".ee-key-hint");_&&(_.textContent=r.keyHint,_.style.display=r.keyHint?"":"none")},d=()=>{if(r.activeTab==="variable")return Qi(ap(),r.searchText).map(z=>l("div",{class:"ee-list-item",onDblclick:A=>{const{insideParens:I}=f(A);b(Ve(A),I?z.template.replace(/^\{|\}$/g,""):z.template,void 0,"")}},[hr(z.label,z.template)]));if(r.activeTab==="function")return lp().map(z=>l("div",{class:"ee-func-group"},[l("div",{class:"ee-func-group-title",text:z.title}),...Qi(z.items,r.searchText).map(A=>l("div",{class:"ee-list-item",onDblclick:I=>{const{insideBlock:K}=f(I),B=K?A.template:`{${A.template}}`;b(Ve(I),B,B.indexOf("(")+1,"")}},[hr(A.label,`${A.name}()`)]))]));const S=h.filterGroups(h.groupFields(e.fields??[]),r.searchText);if(!S.length)return[l("p",{class:"pd-empty",text:P("expression.k27")})];const _=[];for(const z of S){z.key&&_.push(l("div",{class:`ee-field-group${z.isList?" is-list":""}`},[l("span",{class:"ee-field-group-icon",text:z.isList?"📋":"📁"}),l("span",{text:z.label})]));for(const A of z.fields)_.push(l("div",{class:"ee-list-item ee-field-item",style:{paddingLeft:z.key?"22px":"10px"},onDblclick:I=>{const{insideParens:K}=f(I),B=I;if(B.ctrlKey||B.metaKey){const L=A.fieldLabel||A.fieldKey;b(Ve(I),K?`"${L}"`:L,void 0,"");return}b(Ve(I),K?A.fieldKey:`{${A.fieldKey}}`,void 0,cp(A.fieldKey)?hp(A.fieldKey):"")}},[hr(A.fieldLabel||A.fieldKey,A.fieldKey,o),l("button",{type:"button",class:`ee-copy-btn${r.copiedFieldKey===A.fieldKey?" is-copied":""}`,"data-tip":r.copiedFieldKey===A.fieldKey?P("expression.k28"):`复制字段名「${A.fieldLabel}」`,"aria-label":`复制字段名 ${A.fieldLabel}`,html:op(r.copiedFieldKey===A.fieldKey?"Check":"Copy",13),onClick:I=>{I.stopPropagation(),u(I,A)},onDblclick:I=>I.stopPropagation()})]))}return _},c=S=>{Array.from(S.querySelectorAll(".ee-nav-tab")).forEach((K,B)=>K.classList.toggle("active",cr()[B]?.key===r.activeTab));const z=i(S,".ee-content-search .pd-input");if(z){const K=Xi()[r.activeTab];z.placeholder!==K&&(z.placeholder=K),z.value!==r.searchText&&(z.value=r.searchText)}const A=i(S,".ee-textarea");A&&A.value!==r.expression&&(A.value=r.expression);const I=i(S,".ee-content-list");if(I){cn(I);for(const K of d())Se(K,I)}n(S),s(S)};function u(S,_){const z=Ve(S);h.copyTextToClipboard(_.fieldLabel||_.fieldKey).then(A=>{A&&(r.copiedFieldKey=_.fieldKey,c(z),setTimeout(()=>{r.copiedFieldKey===_.fieldKey&&(r.copiedFieldKey="",c(z))},1200))})}const f=S=>{const z=i(Ve(S),".ee-textarea")?.selectionStart??r.expression.length;return pp(r.expression,z)},b=(S,_,z=_.length,A)=>{A!==void 0&&(r.keyHint=A);const I=i(S,".ee-textarea");if(!I){r.expression+=_,n(S),s(S);return}const K=I.selectionStart??r.expression.length,B=I.selectionEnd??K;r.expression=r.expression.substring(0,K)+_+r.expression.substring(B);const L=K+z;I.value=r.expression,I.focus(),I.selectionStart=I.selectionEnd=L,n(S),s(S)},m=()=>{const S=r.expression;if(r.binding===void 0){e.onApply({formatter:S}),e.onClose();return}const _=up(S,e.fields??[]);e.onApply(_?{formatter:S,binding:_.fieldKey,title:_.fieldLabel}:{formatter:S}),e.onClose()},E=l("div",{class:"ee-nav"},[l("div",{class:"ee-nav-title",text:P("expression.k29")}),l("div",{class:"ee-nav-tabs"},cr().map((S,_)=>l("div",{class:`ee-nav-tab${r.activeTab===S.key?" active":""}`,text:S.text,onClick:z=>{r.activeTab=cr()[_].key,c(Ve(z))}})))]),y=l("div",{class:"ee-content"},[l("div",{class:"ee-content-search"},[l("input",{class:"pd-input",placeholder:Xi()[r.activeTab],onInput:S=>{r.searchText=S.target.value,c(Ve(S))}})]),l("div",{class:"ee-content-list"},d())]),C=Zi(r.expression,e.demoData),D=l("div",{class:"ee-editor"},[l("div",{class:"ee-editor-section"},[l("div",{class:"ee-editor-title",text:P("expression.k30")}),l("textarea",{class:"ee-textarea",rows:6,placeholder:P("expression.k31"),text:r.expression,onInput:S=>{r.expression=S.target.value,r.keyHint="",n(Ve(S)),s(Ve(S))}}),l("div",{class:"pd-hint ee-key-hint",style:{display:"none",color:"var(--pd-accent, #165DFF)"},text:""})]),l("div",{class:"ee-editor-section"},[l("div",{class:"ee-editor-title",text:P("expression.k32")}),l("div",{class:`ee-preview${C===P(Tr)?" ee-preview-error":""}`,text:C})]),fp()]);return l("div",{class:"pd-dialog-overlay",onKeydown:S=>{S.key==="Escape"&&e.onClose()}},[l("section",{class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},[l("header",{class:"pd-dialog-header"},[l("strong",{id:"expression-editor-title",text:P("expression.k33")}),l("button",{type:"button",class:"pd-close","aria-label":P("expression.k34"),text:"×",onClick:()=>e.onClose()})]),l("div",{class:"expression-editor"},[E,y,D]),l("footer",{class:"pd-dialog-footer"},[l("button",{type:"button",class:"pd-button",text:P("expression.k35"),onClick:()=>e.onClose()}),l("button",{type:"button",class:"pd-button primary",text:P("expression.k36"),onClick:()=>m()})])])])}const mp={id:"getting-started",title:"快速入门",content:`
4
4
  <h2>界面布局</h2>
5
5
  <p>打印模板设计器采用三栏布局:</p>
6
6
  <ul>
@@ -40,7 +40,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
40
40
  <p><strong>项目名称:</strong>worm-print-platform</p>
41
41
  <p><strong>仓库地址:</strong><a href="https://gitee.com/liulong_oschina/worm-print-platform" target="_blank" rel="noopener noreferrer">https://gitee.com/liulong_oschina/worm-print-platform</a></p>
42
42
  <p>基于 Vue 3 的可视化打印模板设计器,支持拖拽式模板编辑、表达式数据绑定和浏览器端打印预览。</p>
43
- `},oc={id:"features",title:"功能说明",content:`
43
+ `},bp={id:"features",title:"功能说明",content:`
44
44
  <h2>元素类型</h2>
45
45
  <table>
46
46
  <thead>
@@ -212,7 +212,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
212
212
  <li>支持调节水印密度(密/中/疏/自定义瓦片尺寸),以及设置水印颜色</li>
213
213
  <li>水印在画布、浏览器预览、服务端 PDF、静默打印四端渲染一致</li>
214
214
  </ul>
215
- `},ic={id:"advanced-settings",title:"高级设置",content:`
215
+ `},yp={id:"advanced-settings",title:"高级设置",content:`
216
216
  <h2>高级设置</h2>
217
217
  <p>高级设置用于控制元素的编辑保护、跨页展示、重叠顺序和删除操作。这里的设置保存在模板中,但各选项的分页语义不同,应按元素的版式角色选择。</p>
218
218
 
@@ -259,7 +259,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
259
259
  <li><strong>付款申请单右侧附件:</strong>推荐「每页固定」开启、「每页重复」关闭、「参与分页」关闭。这样每页位置一致,也不会挤压付款明细。</li>
260
260
  <li><strong>只需要第一页右侧附件:</strong>关闭「每页固定」和「每页重复」,同时关闭「参与分页」。</li>
261
261
  </ul>
262
- `},nc={id:"shortcuts",title:"快捷键",content:`
262
+ `},vp={id:"shortcuts",title:"快捷键",content:`
263
263
  <h2>常用操作</h2>
264
264
  <table>
265
265
  <thead>
@@ -329,7 +329,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
329
329
  <blockquote>
330
330
  <p><strong>注意</strong>:当焦点在输入框、文本框、下拉框内时,快捷键不生效。</p>
331
331
  </blockquote>
332
- `},rc={id:"faq",title:"常见问题",content:`
332
+ `},xp={id:"faq",title:"常见问题",content:`
333
333
  <h2>如何调整纸张大小?</h2>
334
334
  <ol>
335
335
  <li>在右侧面板选择"页面设置"</li>
@@ -463,7 +463,31 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
463
463
  <blockquote>
464
464
  <p><strong>提示</strong>:水印配置保存在模板 JSON 的 <code>watermark</code> 字段中,仅对当前模板生效。</p>
465
465
  </blockquote>
466
- `},ac={id:"changelog",title:"更新记录",content:`
466
+ `},wp={id:"changelog",title:"更新记录",content:`
467
+ <h2>V1.6.1<small>(2026-11-22)</small></h2>
468
+
469
+ <h3>新增</h3>
470
+ <ul>
471
+ <li><strong>自定义语言包</strong>:设计器外壳文案支持替换为自定义语言资源,并提供命令行工具导出骨架、校验译文与增量更新。</li>
472
+ </ul>
473
+
474
+ <h3>修复</h3>
475
+ <ul>
476
+ <li><strong>渲染与设计器细节</strong>:条码点阵、整页旋转、水印、图片边框与裁剪锚点等细节修复,属性搜索与表格矩阵更稳定。</li>
477
+ </ul>
478
+
479
+ <h2>V1.6.0<small>(2026-11-19)</small></h2>
480
+
481
+ <h3>新增</h3>
482
+ <ul>
483
+ <li><strong>字段显示可由宿主配置</strong>:新增 <code>field-display</code> 参数(属性名 <code>fieldDisplay</code>),可选「只显示中文名」「只显示字段 key」「两者都显示」,默认两者都显示。只显示 key 时,key 的字号、颜色与字族与中文名一致;字段分组名始终显示,搜索、复制与插入语义不变。</li>
484
+ </ul>
485
+
486
+ <h3>修复</h3>
487
+ <ul>
488
+ <li><strong>图表数据标签偏移</strong>:面板写入 ECharts 原生 <code>offset: [x, y]</code>,旧模板的 <code>offsetX</code> / <code>offsetY</code> 在读取、写回与出图前统一迁移,数据标签偏移现在真正生效。</li>
489
+ </ul>
490
+
467
491
  <h2>V1.5.3<small>(2026-11-18)</small></h2>
468
492
 
469
493
  <h3>新增</h3>
@@ -924,9 +948,1015 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
924
948
  <blockquote>
925
949
  <p>完整更新记录请查阅仓库 <code>docs/中文/CHANGELOG.md</code> 与 <code>docs/en/CHANGELOG.en.md</code>。</p>
926
950
  </blockquote>
927
- `},ao=[tc,oc,ic,nc,rc,ac],Vr="worm-print-help-tab",sc="getting-started";function Yn(t){return ao.some(e=>e.id===t)?String(t):""}function lc(t){let e=null;try{e=window.localStorage.getItem(Vr)}catch{e=null}return Yn(t)||Yn(e)||sc}function dc(t){const e=lc(t.initialTab),o=(i,n)=>{const r=i.currentTarget,s=r.closest(".help-modal");if(!s)return;for(const p of Array.from(s.querySelectorAll(".help-tab")))p.classList.toggle("active",p===r);const l=s.querySelector(".help-content");l&&(l.innerHTML=ao.find(p=>p.id===n)?.content??"");try{window.localStorage.setItem(Vr,n)}catch{}};return a("div",{class:"help-modal-overlay",tabindex:"-1",onClick:i=>{i.target===i.currentTarget&&t.onClose()},onKeydown:i=>{i.key==="Escape"&&t.onClose()}},[a("div",{class:"help-modal"},[a("div",{class:"help-modal-header"},[a("div",{class:"help-modal-title-wrap"},[a("h2",{class:"help-modal-title",text:"帮助文档"}),a("span",{class:"help-modal-project",text:"worm-print-platform"})]),a("button",{type:"button",class:"help-modal-close",title:"关闭",text:"×",onClick:()=>t.onClose()})]),a("div",{class:"help-modal-body"},[a("div",{class:"help-modal-sidebar"},ao.map(i=>a("button",{type:"button",class:`help-tab${i.id===e?" active":""}`,text:i.title,onClick:n=>o(n,i.id)}))),a("div",{class:"help-modal-content"},[a("div",{class:"help-content",html:ao.find(i=>i.id===e)?.content??""})])])])])}function cc(t,e){const o=ve(dc(e),t),i=n=>{n.key==="Escape"&&e.onClose()};return document.addEventListener("keydown",i),o.focus?.(),()=>{document.removeEventListener("keydown",i),o.remove()}}const pc=2,uc=74,Ei=[{id:"clipboard",order:1,label:"剪贴板"},{id:"painter",order:2,label:"格式刷"},{id:"zoom",order:3,label:"缩放"},{id:"arrange-view",order:4,label:"排列 / 视图"},{id:"border",order:5,label:"边框"},{id:"color",order:6,label:"颜色"},{id:"align",order:7,label:"对齐"},{id:"style",order:8,label:"文字样式"},{id:"font",order:9,label:"字体与字号"}];function hc(t){const e=!!t.state.openMore,o=Ei.slice().sort((i,n)=>i.order-n.order).map(i=>a("div",{class:"tb-more-item",dataset:{unit:i.id},style:{display:"none"}},[a("div",{class:"tb-menu-label",text:i.label}),a("div",{class:"tb-more-slot",id:`tb-more-slot-${i.id}`,dataset:{unit:i.id}})]));return a("div",{class:"tb-group tb-more-group",style:{display:"none"}},[a("div",{class:"tb-dd"},[a("button",{type:"button",class:`tb-dd-trigger${e?" on":""}`,dataset:{test:"more-dd",tip:"更多"},onClick:()=>{t.state.openMore=!e,t.repaint()},html:`${ce("Ellipsis",15)}<span class="tb-btn-text">更多</span>${ce("ChevronDown",12,"tb-dd-arrow")}`}),a("div",{class:`tb-dd-panel tb-more-panel${e?"":" is-hidden"}`},[a("div",{class:"tb-menu tb-more-menu"},o)])])])}const Xn=new WeakMap;function Zn(t){const e=t.querySelector(".designer-toolbar");if(!e)return{movedIds:[],overflowRemains:!1};const o=getComputedStyle(e),i=Number.parseFloat(o.gap)||pc,n=Number.parseFloat(o.paddingLeft)||0,r=Number.parseFloat(o.paddingRight)||0,s=new Map;for(const k of Array.from(e.querySelectorAll(".tb-ou[data-unit]"))){const y=k.parentElement;y&&!y.classList.contains("tb-more-slot")&&Xn.set(k,{parent:y,next:k.nextSibling}),s.set(k.dataset.unit,k)}for(const k of s.values()){const y=Xn.get(k);!y||k.parentElement===y.parent||(y.next?.parentElement===y.parent?y.parent.insertBefore(k,y.next):y.parent.appendChild(k))}let l=0;for(const k of Array.from(e.children)){if(k.classList.contains("tb-spacer")||k.classList.contains("tb-more-group"))continue;const y=Math.max(k.offsetWidth,k.scrollWidth);y<=0||(l+=y+i)}const p=new Map;for(const[k,y]of s){const C=y.offsetWidth;C>0&&p.set(k,C)}const u=Ei.map(k=>({id:k.id,order:k.order,width:p.get(k.id)??0})),h=u.reduce((k,y)=>k-y.width-i,l),m=e.clientWidth-n-r,{movedIds:g,overflowRemains:T}=c.resolveToolbarOverflow({available:m,pinned:h,moreTriggerWidth:uc,gap:i,units:u});for(const k of Ei){const y=e.querySelector(`.tb-more-item[data-unit="${k.id}"]`),C=e.querySelector(`#tb-more-slot-${k.id}`),D=s.get(k.id);if(!y||!C||!D)continue;const P=g.includes(k.id);P&&D.parentElement!==C&&C.appendChild(D),y.style.display=P?"":"none"}const b=e.querySelector(".tb-more-group");return b&&(b.style.display=g.length>0?"":"none"),e.classList.toggle("is-tight",T),{movedIds:g,overflowRemains:T}}function fc(t,e){const o=t.store,i=o.selectedIds.size>0,n=o.selectedIds.size>1,r=o.selectedElement,s=!i,l=t.isEdit?"编辑模板":"新建模板",p=[a("div",{class:"tb-menu",dataset:{test:"arrange-panel"}},[a("div",{class:"tb-menu-label",text:"对齐 / 分布"}),a("div",{class:"tb-menu-grid"},[oe(t,"AlignStartVertical","align",{arg:"left",tip:"左对齐",disabled:!n}),oe(t,"AlignEndVertical","align",{arg:"right",tip:"右对齐",disabled:!n}),oe(t,"AlignStartHorizontal","align",{arg:"top",tip:"顶对齐",disabled:!n}),oe(t,"AlignEndHorizontal","align",{arg:"bottom",tip:"底对齐",disabled:!n}),oe(t,"AlignCenterVertical","align",{arg:"vertical",tip:"水平居中",disabled:!n}),oe(t,"AlignCenterHorizontal","align",{arg:"horizontal",tip:"垂直居中",disabled:!n}),oe(t,"AlignHorizontalSpaceBetween","align",{arg:"distributeHor",tip:"水平分布",disabled:!n}),oe(t,"AlignVerticalSpaceBetween","align",{arg:"distributeVer",tip:"垂直分布",disabled:!n})]),a("div",{class:"tb-menu-label",text:"层级"}),a("div",{class:"tb-menu-grid"},[oe(t,"ArrowUpToLine","move-layer",{arg:"top",tip:"置顶",disabled:!i}),oe(t,"ArrowUp","move-layer",{arg:"up",tip:"上移一层",disabled:!i}),oe(t,"ArrowDown","move-layer",{arg:"down",tip:"下移一层",disabled:!i}),oe(t,"ArrowDownToLine","move-layer",{arg:"bottom",tip:"置底",disabled:!i})]),a("div",{class:"tb-menu-label",text:"组合"}),a("div",{class:"tb-menu-grid"},[oe(t,"Group","group",{tip:"组合 (Ctrl+G)",disabled:!n}),oe(t,"Ungroup","ungroup",{tip:"取消组合 (Ctrl+Shift+G)",disabled:!r?.options?.groupId})])])],u=[a("div",{class:"tb-menu tb-menu-rows",dataset:{test:"view-panel"}},[h("标尺",o.showRuler,"toggle-ruler","显示/隐藏标尺"),h("网格",o.showGrid,"toggle-grid","显示/隐藏网格背景"),h("虚框",o.showTableGhostBorder,"toggle-table-ghost-border","显示/隐藏无边框表格的虚拟虚线"),h("吸附",o.snapToGrid,"toggle-snap","开启/关闭元素吸附到网格")])];function h(m,g,T,b){return a("button",{type:"button",class:`tb-btn tb-menu-row${g?" on":""}`,dataset:{tip:b},onClick:()=>t.fire(T)},[a("span",{class:"dot"}),m])}return a("div",{class:"designer-toolbar"},[a("div",{class:"tb-group tb-brand"},[a("span",{class:"tb-mark","aria-hidden":"true",html:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="3" width="14" height="18" rx="2.5" /><line x1="8.5" y1="8.5" x2="15.5" y2="8.5" /><line x1="8.5" y1="12.5" x2="15.5" y2="12.5" /><line x1="8.5" y1="16.5" x2="12.5" y2="16.5" /></svg>'}),a("div",{class:"tb-title"},[a("span",{class:"tb-title-name",text:l}),a("span",{class:"tb-title-sub",text:"打印模板设计器"})])]),a("div",{class:"tb-group"},[oe(t,"Undo2","undo",{tip:"撤销",disabled:!o.canUndo}),oe(t,"Redo2","redo",{tip:"重做",disabled:!o.canRedo})]),e,a("div",{class:"tb-ou tb-group",dataset:{unit:"arrange-view"}},[ho(t,"arrange",{icon:"Layers",text:"排列",tip:"排列",testId:"arrange-dd"},p),ho(t,"view",{icon:"Eye",text:"视图",tip:"视图",testId:"view-dd"},u)]),a("div",{class:"tb-ou tb-group",dataset:{unit:"zoom"}},[oe(t,"Maximize","fit-window",{tip:"适应窗口"}),oe(t,"ZoomOut","zoom",{arg:-10,tip:"缩小"}),a("span",{class:"tb-zoom",text:`${o.scale}%`}),oe(t,"ZoomIn","zoom",{arg:10,tip:"放大"})]),a("div",{class:"tb-ou tb-group",dataset:{unit:"clipboard"}},[oe(t,"Copy","copy",{tip:s?"复制 (Ctrl+C),需选中元素":"复制 (Ctrl+C)",disabled:s,test:"copy"}),oe(t,"ClipboardPaste","paste",{tip:s?"粘贴 (Ctrl+V),需选中元素":o.hasClipboard?"粘贴 (Ctrl+V)":"粘贴 (Ctrl+V),剪贴板为空",disabled:s||!o.hasClipboard,test:"paste"}),oe(t,"Trash2","delete",{tip:s?"删除 (Delete),需选中元素":"删除 (Delete)",disabled:s,danger:!0,test:"delete"})]),hc(t),a("div",{class:"tb-spacer"}),t.showHelp?a("div",{class:"tb-group"},[a("button",{type:"button",class:"help-button",title:"帮助文档",onClick:()=>t.fire("help")},[a("span",{class:"help-icon",text:"?"})])]):"",(()=>{const m=[t.showPreview!==!1?a("button",{type:"button",class:"btn-secondary",dataset:{tip:"预览模板打印效果"},text:"预览",onClick:()=>t.fire("preview")}):"",t.showSave!==!1?a("button",{type:"button",class:"btn-primary",dataset:{tip:"保存模板"},text:"保存",onClick:()=>t.fire("save")}):""].filter(Boolean);return m.length?a("div",{class:"tb-group"},m):""})()].filter(Boolean))}function li(t,e,o){for(const i of e){const n=t.getPropertyValue(i).trim();if(n)return n}return o}function gc(t,e){const o=e.orientation==="horizontal",i=e.geom,n=o?i.viewW:i.viewH;t.style.width=`${o?n:c.RULER_THICKNESS}px`,t.style.height=`${o?c.RULER_THICKNESS:n}px`;const r=t.getContext("2d");if(!r)return;const s=window.devicePixelRatio||1,l=Math.max(0,Math.round(n)),p=c.RULER_THICKNESS;t.width=(o?l:p)*s,t.height=(o?p:l)*s,r.setTransform(s,0,0,s,0,0);const u=getComputedStyle(t),h=li(u,["--pd-ruler-bg"],"#F8F9FC"),m=li(u,["--pd-ruler"],"#9AA1AF"),g=li(u,["--pd-ruler-cursor","--pd-accent"],"#165DFF");r.fillStyle=h,r.fillRect(0,0,o?l:p,o?p:l);const T=e.scale>0?e.scale:i.paperScale>0?i.paperScale:1,b=c.mmToPx(1)*T;if(b<=0)return;const k={ctx:r,horizontal:o,viewportPx:n,thickness:p,originPx:o?i.originX:i.originY,pxPerMM:b,paperLengthMM:e.paperLengthMM},y=-k.originPx/b,C=(l-k.originPx)/b,D=c.chooseMajorStepMM(T),P=c.buildRulerTicks(y,C,D);Qn(k,P,m,!0),Qn(k,P,m,!1),Jn(k,0,g),Jn(k,e.paperLengthMM,g);const A=e.cursorPx??null;if(A!==null&&A>=0&&A<=l){if(r.strokeStyle=g,r.lineWidth=1.5,r.beginPath(),o){const L=Math.round(A)+.5;r.moveTo(L,0),r.lineTo(L,p)}else{const L=Math.round(A)+.5;r.moveTo(0,L),r.lineTo(p,L)}r.stroke()}}function jr(t,e){return Math.round(t.originPx+e*t.pxPerMM)+.5}function Qn(t,e,o,i){const{ctx:n,horizontal:r,paperLengthMM:s}=t;n.strokeStyle=o,n.fillStyle=o,n.globalAlpha=i?.32:1,n.lineWidth=1,n.font="9px ui-monospace, Menlo, monospace",n.textBaseline="top";for(const l of e){if((l.mm<0||l.mm>s)!==i)continue;const u=jr(t,l.mm),h=l.major?8:4;n.beginPath(),r?(n.moveTo(u,0),n.lineTo(u,h)):(n.moveTo(0,u),n.lineTo(h,u)),n.stroke(),l.major&&l.label&&(r?n.fillText(l.label,u+2,11):(n.save(),n.translate(11,u+2),n.rotate(-Math.PI/2),n.fillText(l.label,0,0),n.restore()))}n.globalAlpha=1}function Jn(t,e,o){const{ctx:i,horizontal:n,thickness:r,viewportPx:s}=t,l=jr(t,e);l<=0||l>=s||(i.strokeStyle=o,i.globalAlpha=.55,i.lineWidth=1,i.beginPath(),n?(i.moveTo(l,0),i.lineTo(l,r)):(i.moveTo(0,l),i.lineTo(r,l)),i.stroke(),i.globalAlpha=1)}const mc=':host{display:block;width:100%;height:100%}:host{--pd-bg: #f3f5f9;--pd-surface: #ffffff;--pd-field-bg: #f4f6fa;--pd-sidebar: #ffffff;--pd-sidebar-hover: #f0f3f9;--pd-canvas-bg: #e6e9f0;--pd-paper: #FFFFFF;--pd-accent: #165DFF;--pd-accent-2: #3D7BFF;--pd-accent-soft: rgba(22, 93, 255, .09);--pd-accent-secondary: #f56c6c;--pd-danger-soft: rgba(245, 108, 108, .1);--pd-ink-green: #67c23a;--pd-text: #2a2e37;--pd-text-muted: #8b909c;--pd-text-faint: #b4b9c4;--pd-border: #d9dde6;--pd-border-soft: #e9ecf2;--pd-input-bg: #ffffff;--pd-hover-tint: #ecf5ff;--pd-danger: #e53e3e;--pd-danger-bg: #fef2f2;--pd-danger-border: #fecaca;--pd-menu-text: #333;--pd-menu-hover: #f5f7fa;--pd-menu-border: #dcdfe6;--pd-menu-divider: #ebeef5;--pd-menu-muted: #909399;--pd-menu-disabled: #c0c4cc;--pd-scrollbar: rgba(23, 32, 60, .18);--pd-scrollbar-thumb: rgba(23, 32, 60, .16);--pd-scrollbar-thumb-hover: rgba(23, 32, 60, .3);--pd-help-field-bg: #f0f9ff;--pd-help-field-line: #bae6fd;--pd-help-field-ink: #0369a1;--pd-help-function-bg: #f0fdf4;--pd-help-function-line: #bbf7d0;--pd-help-function-ink: #166534;--pd-help-variable-bg: #fefce8;--pd-help-variable-line: #fde68a;--pd-help-variable-ink: #854d0e;--pd-help-conditional-bg: #fdf2f8;--pd-help-conditional-line: #fbcfe8;--pd-help-conditional-ink: #9d174d;--pd-handle: #165DFF;--pd-ruler: #9aa1af;--pd-ruler-bg: #f8f9fc;--pd-ruler-cursor: #165DFF;--pd-radius: 6px;--pd-shadow-sm: 0 1px 2px rgba(23, 32, 60, .05);--pd-shadow-md: 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07);--pd-shadow-paper: 0 0 0 1px rgba(23, 32, 60, .05), 0 1px 2px rgba(23, 32, 60, .06), 0 8px 20px rgba(23, 32, 60, .08), 0 26px 60px rgba(23, 32, 60, .15);--pd-success: #16a34a;--pd-text-regular: #606266;--pd-fill-light: #f5f7fa;height:100%;display:flex;flex-direction:column;background:var(--pd-bg)}.pd-form{display:flex;flex-direction:column;gap:10px;font-size:12px;color:var(--pd-text, #303133)}.pd-field{display:flex;flex-direction:column;gap:4px}.pd-label{font-size:11px;color:var(--pd-text-muted, #909399);display:inline-flex;align-items:center;position:relative;justify-content:space-between;gap:6px}.pd-label-t{display:inline-flex;align-items:center;gap:4px;min-width:0}.pd-reset-btn{flex:none;width:15px;height:15px;padding:0;border:1px solid transparent;border-radius:4px;background:transparent;color:var(--pd-text-faint, #b4b9c4);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:color .14s ease,border-color .14s ease,background .14s ease}.pd-reset-btn.is-dirty{color:var(--pd-text, #2a2e37)}.pd-reset-btn:hover{color:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.pd-help{position:static;display:inline-flex;align-items:center;justify-content:center;flex:none;width:13px;height:13px;margin-left:4px;padding:0;border:1px solid var(--pd-border, #d9dde6);border-radius:50%;background:transparent;color:var(--pd-text-muted, #909399);font-size:9px;line-height:1;cursor:help}.pd-help:before{content:"?";font-weight:600}.pd-help:hover,.pd-help:focus-visible{border-color:var(--pd-accent, #165DFF);color:var(--pd-accent, #165DFF)}.pd-help:after{content:attr(data-tip);position:absolute;top:calc(100% + 6px);left:0;z-index:120;width:196px;padding:5px 7px;border-radius:4px;background:#1e2330e0;color:#fff;font-size:12px;font-weight:400;line-height:1.45;text-align:left;white-space:normal;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .15s ease}.pd-help:hover:after,.pd-help:focus:after{opacity:1;visibility:visible}.pd-hover-tip{position:fixed;z-index:9999;transform:translate(-50%);padding:4px 8px;border-radius:4px;background:#2a2e37eb;color:#fff;font-size:12px;line-height:1.4;width:max-content;max-width:calc(100vw - 16px);box-sizing:border-box;overflow-wrap:anywhere;pointer-events:none}.pd-input,.pd-select,textarea.pd-input{width:100%;height:26px;min-height:26px;padding:3px 6px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-input-bg, #fff);color:inherit;font:inherit;box-sizing:border-box;transition:border-color .14s ease,box-shadow .14s ease}.pd-input:hover,.pd-select:hover{border-color:var(--pd-text-faint, #b4b9c4)}textarea.pd-input{height:auto;min-height:48px;resize:vertical}.pd-input:focus,.pd-select:focus{outline:none;border-color:var(--pd-accent, #165DFF);box-shadow:0 0 0 2px #165dff1f}.pd-select{appearance:auto}.pd-switch{appearance:none;width:32px;height:18px;margin:0;border:1px solid var(--pd-border, #dcdfe6);border-radius:999px;background:#dcdfe6;position:relative;cursor:pointer;transition:background .2s,border-color .2s}.pd-switch:checked{background:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF)}.pd-switch:after{content:"";position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:#fff;transition:transform .2s}.pd-switch:checked:after{transform:translate(14px)}.pd-range{width:100%;accent-color:var(--pd-accent, #165DFF)}.pd-radio-group,.pd-checkbox-group{display:flex;flex-wrap:wrap;gap:6px}.pd-radio-group--2col{display:grid;grid-template-columns:1fr 1fr}.pd-radio-group--2col>.pd-radio{width:60%;justify-content:flex-start}.pd-radio,.pd-checkbox{display:inline-flex;align-items:center;gap:4px;min-height:24px;padding:0 7px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-input-bg, #fff);cursor:pointer;transition:border-color .14s ease,background .14s ease,color .14s ease}.pd-radio:has(input:checked),.pd-checkbox:has(input:checked){color:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF);background:#165dff0f}.pd-button-group{display:inline-flex;gap:4px}.pd-button,.pd-tab{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:26px;padding:3px 8px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-bg, #f4f6fa);color:var(--pd-text, #2a2e37);font:inherit;cursor:pointer;transition:background .14s ease,border-color .14s ease,color .14s ease}.pd-button:hover{background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-text-faint, #b4b9c4)}.pd-button.primary{background:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF);color:#fff}.pd-button.danger{background:#f56c6c;border-color:#f56c6c;color:#fff}.pd-button.small{min-height:22px;padding:1px 6px;font-size:11px}.pd-button:disabled{opacity:.55;cursor:not-allowed}.pd-tabs{display:flex;flex-direction:column;min-height:0}.pd-tab-bar{display:flex;gap:4px;padding:8px 12px 0;border-bottom:1px solid var(--pd-border-soft, #ebeef5)}.pd-tab{border:0;border-bottom:2px solid transparent;border-radius:5px 5px 0 0;background:transparent;transition:color .14s ease,background .14s ease}.pd-tab-bar .pd-tab:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.pd-tab.active{color:var(--pd-accent, #165DFF);border-bottom-color:var(--pd-accent, #165DFF);background:transparent;font-weight:600}.pd-tab-pane{min-height:0;overflow:auto}.pd-divider{margin:6px 0;font-size:11px;color:var(--pd-text-muted, #909399)}.pd-empty{margin:16px 0;color:var(--pd-text-muted, #909399);text-align:center}.pd-dialog-overlay{position:fixed;inset:0;z-index:2000;display:grid;place-items:center;padding:16px;background:#00000073}.pd-dialog{display:flex;flex-direction:column;width:min(950px,90vw);max-height:90vh;overflow:hidden;background:var(--pd-surface, #fff);border-radius:12px;box-shadow:var(--pd-shadow-md, 0 12px 40px rgba(23, 32, 60, .18))}.pd-dialog-large{width:min(950px,90vw)}.pd-dialog-header,.pd-dialog-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 16px}.pd-dialog-header{border-bottom:1px solid var(--pd-border-soft, #ebeef5)}.pd-dialog-footer{justify-content:flex-end;border-top:1px solid var(--pd-border-soft, #ebeef5)}.pd-close{width:22px;height:22px;border:0;background:transparent;color:var(--pd-text-muted, #909399);font-size:16px;cursor:pointer}.pd-icon{display:inline-flex;width:14px;height:14px}.tb-more-panel{min-width:244px}.designer-container{scrollbar-width:thin;scrollbar-color:var(--pd-scrollbar, rgba(23, 32, 60, .18)) transparent}.designer-container ::-webkit-scrollbar{width:9px;height:9px}.designer-container ::-webkit-scrollbar-track{background:transparent}.designer-container ::-webkit-scrollbar-thumb{background:var(--pd-scrollbar-thumb, rgba(23, 32, 60, .16));border-radius:999px;border:2px solid transparent;background-clip:content-box}.designer-container ::-webkit-scrollbar-thumb:hover{background:var(--pd-scrollbar-thumb-hover, rgba(23, 32, 60, .3));border:2px solid transparent;background-clip:content-box}.designer-container ::-webkit-scrollbar-corner{background:transparent}.designer-container button:focus-visible,.designer-container [tabindex]:focus-visible,.designer-container .pd-tab:focus-visible{outline:2px solid var(--pd-accent, #165DFF);outline-offset:1px}@media(prefers-reduced-motion:reduce){.designer-container *,.designer-container *:before,.designer-container *:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}.help-button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;border-radius:4px;background:transparent;cursor:pointer;transition:background-color .15s}.help-button:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.help-icon{display:flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background:var(--pd-accent, #165DFF);color:#fff;font-size:12px;font-weight:600;line-height:1}.tb-dd{position:relative;display:inline-flex}.tb-dd-trigger{height:28px;min-width:28px;padding:0 5px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:3px;font-size:12px;transition:background .14s ease,color .14s ease}.tb-dd-trigger:hover:not(:disabled){color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.tb-dd-trigger:disabled{opacity:.32;cursor:default}.tb-dd-trigger.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.tb-dd-arrow{opacity:.6;transition:transform .14s ease}.tb-dd-arrow.up{transform:rotate(180deg)}.tb-dd-trigger[data-tip]{position:relative}.tb-dd-trigger[data-tip]:after{content:attr(data-tip);position:absolute;top:34px;left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:100}.tb-dd-trigger[data-tip]:hover:after{opacity:1}.tb-dd-panel{position:absolute;top:34px;left:0;background:var(--pd-surface, #fff);border:1px solid var(--pd-border, #d9dde6);border-radius:8px;box-shadow:var(--pd-shadow-md, 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07));z-index:200}.tb-dd-panel.is-hidden{display:none}.tb-more-group{flex-shrink:0}.tb-more-menu{display:flex;flex-direction:column;gap:8px;padding:8px;max-height:min(70vh,520px)}.tb-more-item{display:flex;flex-direction:column;gap:4px}.tb-menu-label{font-size:11px;color:var(--pd-text-muted, #8b909c);padding-left:2px}.tb-more-slot{display:flex;align-items:center}.designer-toolbar{display:flex;align-items:center;gap:2px;padding:0 12px;height:50px;background:var(--pd-surface, #ffffff);border-bottom:1px solid var(--pd-border-soft, #e9ecf2);box-shadow:0 1px 2px #17203c0a,0 6px 16px -12px #17203c40;flex-shrink:0;position:relative;z-index:100}.tb-ou{flex-shrink:0}.designer-toolbar>*{flex-shrink:0}.designer-toolbar>.tb-brand{flex-shrink:1;min-width:0}.tb-title,.tb-title-name,.tb-title-sub,.tb-btn-text,.tb-zoom{white-space:nowrap}.designer-toolbar.is-tight .tb-title{min-width:0;overflow:hidden}.designer-toolbar.is-tight .tb-title-name,.designer-toolbar.is-tight .tb-title-sub{overflow:hidden;text-overflow:ellipsis}.tb-group{display:flex;align-items:center;gap:2px;padding:0 8px}.tb-group+.tb-group{border-left:1px solid var(--pd-border-soft, #e9ecf2)}.tb-btn{height:30px;min-width:30px;padding:0 8px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:5px;transition:background .14s ease,color .14s ease,border-color .14s ease,box-shadow .14s ease}.tb-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.tb-btn:active{background:var(--pd-border-soft, #e9ecf2)}.tb-btn:disabled{opacity:.32;cursor:default;background:transparent;color:var(--pd-text-faint, #b4b9c4)}.tb-btn.danger:hover:not(:disabled){color:var(--pd-accent-secondary, #f56c6c);background:var(--pd-danger-soft, rgba(245, 108, 108, .1))}.tb-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));font-weight:600}.tb-btn .dot{width:6px;height:6px;border-radius:50%;background:var(--pd-text-faint, #b4b9c4);display:inline-block;transition:background .14s ease,box-shadow .14s ease}.tb-btn.on .dot{background:var(--pd-accent, #165DFF);box-shadow:0 0 0 3px #165dff1f}.tb-icon{font-size:15px;line-height:1}[data-tip]{position:relative}[data-tip]:after{content:attr(data-tip);position:absolute;bottom:-32px;left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:100}[data-tip]:hover:after{opacity:1}.tb-mark{width:28px;height:28px;margin-right:2px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;color:#fff;background:linear-gradient(150deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF));box-shadow:0 3px 8px #165dff47,inset 0 1px #ffffff38;flex-shrink:0}.tb-mark svg{width:16px;height:16px}.tb-title{display:flex;flex-direction:column;line-height:1.2;padding-left:6px}.tb-title-name{font-size:13px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:.2px}.tb-title-sub{font-size:10px;color:var(--pd-text-muted, #8b909c);letter-spacing:.8px}.tb-zoom{font-size:12px;color:var(--pd-text, #2a2e37);font-variant-numeric:tabular-nums;min-width:46px;text-align:center}.tb-spacer{flex:1}.tb-group .tb-dd-trigger{height:30px;min-width:30px;padding:0 8px}.tb-btn-text{font-size:12px}.tb-menu{padding:8px;display:flex;flex-direction:column;gap:4px}.tb-menu-rows{width:148px}.tb-menu-label{padding:2px 4px;font-size:11px;color:var(--pd-text-muted, #8b909c)}.tb-menu-grid{display:grid;grid-template-columns:repeat(4,32px);gap:2px;margin-bottom:4px}.tb-menu-row{justify-content:flex-start;width:100%}.btn-primary,.btn-secondary{height:32px;padding:0 16px;border-radius:7px;font-size:13px;font-weight:600;cursor:pointer;transition:filter .14s ease,background .14s ease,border-color .14s ease,box-shadow .14s ease}.btn-secondary{background:var(--pd-field-bg, #f4f6fa);color:var(--pd-text-muted, #606266);border:1px solid var(--pd-border, #d9dde6)}.btn-secondary:hover{border-color:var(--pd-accent, #165DFF);color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .06))}.btn-primary{background:linear-gradient(180deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF));color:#fff;border:none;box-shadow:0 3px 10px #165dff47,inset 0 1px #ffffff2e}.btn-primary:hover{filter:brightness(1.07);box-shadow:0 5px 14px #165dff57,inset 0 1px #ffffff2e}.btn-primary:active{filter:brightness(.97)}.font-select{position:relative}.font-select-input{display:block;width:100%}.font-select-list{position:absolute;top:calc(100% + 4px);left:0;width:100%;min-width:150px;z-index:200;margin:0;max-height:200px;overflow-y:auto;padding:2px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-surface, #ffffff);box-shadow:var(--pd-shadow-md, 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07));list-style:none}.font-select-list.is-up{top:auto;bottom:calc(100% + 4px)}.font-select-option{padding:4px 6px;border-radius:4px;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.font-select-option.is-active{background:var(--pd-sidebar-hover, #f0f3f9)}.font-select-option.is-muted{color:var(--pd-text-muted, #8b909c)}.pd-stepper{display:flex;align-items:center;width:100%}.pd-step-btn{width:26px;height:26px;flex-shrink:0;border:1px solid var(--pd-border, #d9dde6);background:var(--pd-field-bg, #f4f6fa);color:var(--pd-text, #2a2e37);font-size:14px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .14s ease,border-color .14s ease,color .14s ease}.pd-step-btn:hover:not(:disabled){background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-text-faint, #b4b9c4)}.pd-step-btn:disabled{opacity:.45;cursor:not-allowed}.pd-step-minus{border-radius:6px 0 0 6px;border-right:none}.pd-step-plus{border-radius:0 6px 6px 0;border-left:none}.pd-step-input.pd-input{border-radius:0;min-width:0;flex:1;text-align:center;-moz-appearance:textfield}.pd-step-input.pd-input::-webkit-outer-spin-button,.pd-step-input.pd-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.preset-color-trigger{display:flex;align-items:center;width:100%;min-height:26px;padding:1px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-surface, #fff);cursor:pointer;transition:border-color .14s ease,box-shadow .14s ease}.preset-color-trigger:hover,.preset-color-trigger[aria-expanded=true]{border-color:var(--pd-accent, #165DFF)}.preset-color-trigger:focus-visible{outline:none;border-color:var(--pd-accent, #165DFF);box-shadow:0 0 0 2px #165dff1f}.preset-color-swatch{width:100%;height:22px;border-radius:4px;background-image:linear-gradient(45deg,#e9ecef 25%,transparent 25%,transparent 75%,#e9ecef 75%);background-size:8px 8px;background-position:0 0,4px 4px}.preset-color-panel{position:fixed;z-index:3000;width:190px;padding:10px;border:1px solid var(--pd-border, #d9dde6);border-radius:8px;background:var(--pd-surface, #fff);box-shadow:0 8px 24px #17203c29}.picker-preview{display:flex;align-items:center;gap:8px;margin-bottom:8px}.picker-current{flex:0 0 26px;height:24px;border:1px solid rgb(0 0 0 / 12%);border-radius:5px;background-image:linear-gradient(45deg,#e9ecef 25%,transparent 25%,transparent 75%,#e9ecef 75%);background-size:8px 8px;background-position:0 0,4px 4px}.picker-current.is-empty{position:relative;background-color:#fff}.picker-current.is-empty:after{content:"";position:absolute;inset:3px;background:linear-gradient(to top right,transparent calc(50% - .7px),#f53f3f calc(50% - .7px),#f53f3f calc(50% + .7px),transparent calc(50% + .7px));border-radius:3px}.picker-hex{flex:1;min-width:0;height:24px;padding:0 6px;border:1px solid var(--pd-border, #d9dde6);border-radius:5px;color:var(--pd-text, #303133);font:inherit;font-size:11px;text-transform:uppercase}.picker-hex:focus{outline:none;border-color:var(--pd-accent, #165DFF);box-shadow:0 0 0 2px #165dff1f}.picker-area{position:relative;height:100px;border:1px solid rgb(0 0 0 / 12%);border-radius:6px;overflow:hidden;cursor:crosshair;touch-action:none;background:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,hsl(var(--picker-hue) 100% 50%))}.picker-handle{position:absolute;width:12px;height:12px;border:2px solid #fff;border-radius:50%;transform:translate(-50%,-50%);box-shadow:0 0 3px #00000073;pointer-events:none}.picker-hue{width:100%;height:14px;margin:10px 0 0;appearance:none;border:1px solid rgb(0 0 0 / 12%);border-radius:999px;background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);cursor:pointer}.picker-hue::-webkit-slider-thumb{appearance:none;width:12px;height:12px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 3px #00000073}.picker-hue::-moz-range-thumb{width:8px;height:8px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 3px #00000073}.picker-heading{display:flex;align-items:center;justify-content:space-between;margin-top:10px;margin-bottom:6px;font-size:11px;color:var(--pd-text-muted, #909399)}.picker-clear{display:inline-flex;align-items:center;gap:3px;padding:2px 6px;border:none;border-radius:4px;background:transparent;font-size:11px;line-height:1;color:var(--pd-text-muted, #909399);cursor:pointer}.picker-clear:hover:not(:disabled){background:#0000000f;color:var(--pd-danger, #f53f3f)}.picker-clear:disabled{opacity:.45;cursor:not-allowed}.preset-color-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:5px}.preset-color-item{width:22px;height:22px;padding:0;border:1px solid rgb(0 0 0 / 12%);border-radius:5px;cursor:pointer}.preset-color-item.active{box-shadow:0 0 0 2px #fff,0 0 0 3px var(--pd-accent, #165DFF)}.format-toolbar{display:flex;align-items:center;gap:2px;flex-shrink:0;min-width:0}.ft-group{display:flex;align-items:center;gap:2px;padding:0 8px;flex-shrink:0}.ft-group+.ft-group{border-left:1px solid var(--pd-border-soft, #e9ecf2)}.ft-btn{height:28px;min-width:28px;padding:0 5px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:4px;transition:background .14s ease,color .14s ease}.ft-btn:hover:not(:disabled){color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.ft-btn:disabled{opacity:.32;cursor:default}.ft-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.ft-btn-text{font-size:12px}.ft-btn[data-tip]{position:relative}.ft-btn[data-tip]:after{content:attr(data-tip);position:absolute;top:34px;left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:100}.ft-btn[data-tip]:hover:after{opacity:1}.ft-font{width:150px}.ft-size{width:96px}.ft-font .font-select-input,.ft-size .pd-input,.ft-size .pd-step-btn{font-size:12px}.ft-color-btn{position:relative;width:28px;height:28px;display:inline-flex;margin-left:2px}.ft-color-btn.dim{opacity:.35}.ft-color-btn .preset-color-trigger{width:100%;height:100%;min-height:0;padding:0;border:1px solid transparent;border-radius:6px;background:transparent;align-items:flex-end;justify-content:center}.ft-color-btn .preset-color-trigger:hover,.ft-color-btn .preset-color-trigger[aria-expanded=true]{background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-border-soft, #e9ecf2)}.ft-color-btn .preset-color-swatch{width:16px;height:4px;margin-bottom:3px;border-radius:1px;background-image:none;border-bottom:1px solid var(--pd-text-faint, #b4b9c4)}.ft-glyph{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding-bottom:7px;font-size:13px;font-weight:700;color:var(--pd-text, #2a2e37);pointer-events:none}.ft-border-panel{width:196px;padding:10px;display:flex;flex-direction:column;gap:8px}.ft-align-panel{padding:6px;display:flex;flex-direction:column;gap:4px}.ft-align-row{display:grid;grid-template-columns:repeat(3,36px);gap:4px}.ft-border-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}.ft-cell-btn{height:30px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:6px;background:transparent;color:var(--pd-text, #2a2e37);cursor:pointer}.ft-cell-btn:hover:not(:disabled){background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-border-soft, #e9ecf2)}.ft-cell-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));border-color:#165dff59}.ft-cell-btn:disabled{opacity:.32;cursor:default}.ft-cell-btn .g-faint{fill:none;stroke:var(--pd-text-faint, #b4b9c4);stroke-width:1;stroke-dasharray:2 2}.ft-cell-btn .g-solid{stroke:currentColor;stroke-width:1.6}.ft-cell-btn[data-tip],.ft-style-btn[data-tip]{position:relative}.ft-cell-btn[data-tip]:after,.ft-style-btn[data-tip]:after{content:attr(data-tip);position:absolute;top:calc(100% + 4px);left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;font-weight:400;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:210}.ft-cell-btn[data-tip]:hover:after,.ft-style-btn[data-tip]:hover:after{opacity:1}.ft-style-row{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}.ft-style-btn{height:22px;display:inline-flex;align-items:center;justify-content:center;padding:0 4px;border:1px solid transparent;border-radius:5px;background:transparent;color:var(--pd-text, #2a2e37);cursor:pointer}.ft-style-btn:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.ft-style-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));border-color:#165dff59}.ft-style-line{width:100%;height:0}.ft-border-style-row{display:flex;align-items:center;gap:6px}.ft-line-width{width:96px}.ft-edge-label{font-size:12px;color:var(--pd-text-muted, #8b909c);white-space:nowrap;flex-shrink:0}.layer-panel{border-top:1px solid var(--pd-border);padding:8px 12px;height:100%;box-sizing:border-box;overflow-y:auto}.panel-title{font-size:11px;color:var(--pd-text-muted);text-transform:uppercase;letter-spacing:.5px;margin-bottom:8px}.layer-item{display:flex;align-items:center;gap:6px;padding:4px 6px;margin-bottom:2px;border-radius:4px;cursor:pointer;font-size:12px;transition:background .1s}.layer-item:hover{background:var(--pd-sidebar-hover, #f0f2f5)}.layer-item.active{background:#165dff1a;color:var(--pd-accent, #165DFF);box-shadow:inset 2px 0 0 var(--pd-accent, #165DFF)}.layer-icon{width:18px;text-align:center;font-size:12px;color:var(--pd-text-muted, #909399)}.layer-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--pd-text, #303133)}.layer-zone{flex-shrink:0;padding:0 4px;font-size:10px;line-height:14px;color:var(--pd-ink-green, #67c23a);background:#67c23a1a;border-radius:3px}.layer-zindex{font-size:10px;color:var(--pd-text-muted, #909399);font-variant-numeric:tabular-nums}.layer-actions{display:flex;gap:4px;margin-top:8px}.field-tree-panel{padding:0}.panel-title{font-size:11px;color:var(--pd-text-muted);text-transform:uppercase;letter-spacing:.5px;padding:4px 0 8px;margin-bottom:8px;border-bottom:1px solid var(--pd-border)}.search-input{margin-bottom:8px}.tree-container{overflow-y:auto;min-height:0}.field-group-header{display:flex;align-items:center;gap:4px;padding:5px 8px;border-radius:4px;font-size:13px;color:var(--pd-text, #303133);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background .1s}.field-group-header:hover{background:var(--pd-sidebar-hover, #f0f2f5)}.field-group-header.is-list{color:var(--pd-accent, #165DFF);font-weight:500}.expand-icon{width:12px;font-size:8px;flex-shrink:0;color:var(--pd-text-muted, #909399)}.field-row{display:flex;align-items:center;gap:4px;padding:5px 8px;border-radius:4px;font-size:13px;color:var(--pd-text, #303133);cursor:grab;-webkit-user-select:none;user-select:none;transition:background .1s}.field-row:hover{background:var(--pd-sidebar-hover, #f0f2f5)}.node-icon{font-size:14px;flex-shrink:0;filter:saturate(.6);opacity:.9}.node-meta{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:center;column-gap:4px;row-gap:1px}.node-label{flex:1 1 auto;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.node-key{flex:0 1 auto;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--pd-text-muted, #909399)}.group-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.copy-hint{flex-shrink:0;margin-left:auto;font-size:11px;color:var(--pd-accent, #165DFF);white-space:nowrap}.left-panel{width:248px;min-width:248px;background:var(--pd-sidebar, #ffffff);border-right:1px solid var(--pd-border-soft, #e9ecf2);display:flex;flex-direction:column;overflow:hidden;transition:width .18s ease}.left-panel.collapsed{width:36px;min-width:36px;border-right:1px solid var(--pd-border-soft, #e9ecf2)}.left-collapsed{display:flex;flex-direction:column;align-items:center;gap:8px;padding-top:12px;flex:1}.lc-btn{width:26px;height:26px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .14s ease}.lc-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.lc-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.left-head{display:flex;align-items:center;justify-content:space-between;height:42px;padding:0 12px;flex-shrink:0;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.left-title{font-size:12px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:1.2px;display:inline-flex;align-items:center;gap:7px}.left-title:before{content:"";width:3px;height:12px;border-radius:2px;background:linear-gradient(180deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF))}.left-tabs{flex:1;display:flex;flex-direction:column;overflow:hidden}.left-tabs .pd-tab-pane{flex:1;min-height:0;overflow-y:auto;padding:12px}.material-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-content:start}.material-grid>.panel-title,.material-grid>.material-group-title,.material-grid>.material-card--wide{grid-column:1 / -1}.material-grid>.panel-title,.material-grid>.material-group-title{margin-bottom:0}.material-grid>.material-card{margin-bottom:0;min-width:0}.panel-title{font-size:11px;color:var(--pd-text-muted, #8b909c);letter-spacing:.6px;padding:2px 2px 8px;margin-bottom:10px;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.material-group-title{font-size:11px;color:var(--pd-text-muted, #8b909c);letter-spacing:.6px;padding:4px 2px 6px;margin:2px 0 8px;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.material-card{position:relative;display:flex;align-items:center;gap:9px;padding:7px 8px;border:1px solid var(--pd-border-soft, #e9ecf2);border-radius:7px;background:transparent;cursor:grab;-webkit-user-select:none;user-select:none;transition:background .16s ease,border-color .16s ease,transform .16s ease,box-shadow .16s ease}.material-card:before{content:"";position:absolute;left:0;top:50%;width:2px;height:0;border-radius:2px;background:var(--pd-accent, #165DFF);transform:translateY(-50%);transition:height .16s ease}.material-card:hover{background:var(--pd-hover-tint, #ecf5ff);border-color:#165dff73;transform:translate(2px)}.material-card:hover:before{height:56%}.material-card:active{cursor:grabbing;transform:translate(2px) scale(.985)}.material-icon{width:30px;height:30px;border:0;border-radius:7px;display:flex;align-items:center;justify-content:center;color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));box-shadow:inset 0 0 0 1px #165dff1f;flex-shrink:0;transition:background .16s ease,color .16s ease,box-shadow .16s ease,transform .16s ease}.material-card:hover .material-icon{background:var(--pd-accent, #165DFF);color:#fff;box-shadow:0 2px 6px #165dff47}.material-card:active .material-icon{transform:scale(.92)}.material-label{min-width:0;flex:1;font-size:12.5px;font-weight:500;line-height:1.3;color:var(--pd-text, #2a2e37);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:color .16s ease}.material-card:hover .material-label{color:var(--pd-accent, #165DFF)}.print-image{width:100%;height:100%;overflow:hidden}.print-image img{width:100%;height:100%;display:block}.table-ctx-menu{position:fixed;z-index:3000;min-width:140px;padding:4px 0;background:var(--pd-surface, #fff);border:1px solid var(--pd-menu-border, #dcdfe6);border-radius:4px;box-shadow:0 2px 12px #00000026;font-size:13px}.menu-item{padding:5px 14px;cursor:pointer;color:var(--pd-menu-text, #333)}.menu-item:hover{background:var(--pd-menu-hover, #f5f7fa)}.menu-item.disabled{color:var(--pd-menu-disabled, #c0c4cc);cursor:not-allowed}.menu-item.active{color:var(--pd-accent, #165DFF)}.menu-divider{height:1px;margin:4px 0;background:var(--pd-menu-divider, #ebeef5)}.menu-group-title{padding:4px 14px;font-size:12px;color:var(--pd-menu-muted, #909399)}.cell-barcode{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.cell-barcode svg{max-width:100%;max-height:100%}.cell-barcode img{max-width:100%;max-height:100%}.cell-barcode-fallback{font-style:italic;opacity:.6}.cell-image{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.cell-image img{max-width:100%;max-height:100%;display:block}.image-placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:#bbb;font-size:12px;border:1px dashed #ddd;box-sizing:border-box}.print-table{position:relative;width:100%;height:100%}.print-table table{border-collapse:collapse;table-layout:fixed;width:100%}.print-table td{box-sizing:border-box;word-break:normal;overflow-wrap:break-word}.cell-selected{outline:2px solid #165DFF;outline-offset:-2px;background-color:#165dff14}.row-data-bg{background-image:repeating-linear-gradient(45deg,rgba(22,93,255,.04) 0 6px,transparent 6px 12px)}.data-placeholder{color:#909399;font-style:italic}.row-badges{position:absolute;left:-16px;top:0;width:14px}.row-badge{position:absolute;width:14px;display:flex;align-items:center;justify-content:center;font-size:10px;color:#909399;background:#f5f7fa;border-radius:2px}.col-resize-layer{position:absolute;inset:0;pointer-events:none;z-index:3}.col-resize-handle{position:absolute;top:0;bottom:0;width:6px;transform:translate(-50%);cursor:col-resize;pointer-events:auto}.col-resize-handle:after{content:"";position:absolute;top:0;bottom:0;left:50%;border-left:1px solid transparent}.col-resize-handle:hover:after,.col-resize-handle.dragging:after{border-left-color:var(--pd-accent, #165DFF)}.print-barcode{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.print-barcode svg{max-width:100%;max-height:100%}.print-qrcode{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.print-qrcode img{max-width:100%;max-height:100%}.print-html,.page-number-element{width:100%;height:100%;overflow:hidden}.print-element{box-sizing:border-box;cursor:pointer;-webkit-user-select:none;user-select:none}.extension-placeholder{display:flex;align-items:center;justify-content:center;width:100%;height:100%;box-sizing:border-box;padding:2px;font-size:11px;line-height:1.4;text-align:center;color:var(--pd-text-muted, #8b909c);background:repeating-linear-gradient(45deg,#f4f6fa,#f4f6fa 6px,#fff 6px 12px);overflow:hidden}.element-margin-guide{position:absolute;box-sizing:border-box;pointer-events:none}.print-element.design-mode{outline:1px dashed #C3C9D6}.print-element.design-mode.zone-header,.print-element.design-mode.zone-footer{outline:1px dashed var(--pd-ink-green, #67c23a)}.print-element.selected{outline:1.5px solid var(--pd-accent, #165DFF);background:#165dff0a}.print-element.previewed{outline:1.5px solid rgba(22,93,255,.5);background:#165dff1a}.print-element.design-mode:hover{outline:1px dashed var(--pd-accent, #165DFF)}.print-element.locked{cursor:not-allowed}.print-element.locked:not(.selected){outline:1.5px dashed #999}.print-element.hidden{opacity:.3;pointer-events:none}.print-element.drag-ghost{opacity:.4}.drag-preview{position:absolute;inset:0;border:2px dashed var(--pd-accent, #165DFF);pointer-events:none;z-index:1000;box-sizing:border-box}.selected-indicator{position:absolute;top:-18px;left:0;font-size:10px;white-space:nowrap;pointer-events:none;z-index:20}.position-label{background:var(--pd-accent, #165DFF);color:#fff;padding:1px 6px;border-radius:3px;font-family:ui-monospace,SF Mono,Menlo,monospace;font-size:10px;font-variant-numeric:tabular-nums;letter-spacing:0;box-shadow:0 2px 6px #00000026}.resize-handles{position:absolute;inset:0;pointer-events:none}.resize-handle{position:absolute;width:7px;height:7px;background:var(--pd-handle, #165DFF);border:1.5px solid #fff;border-radius:2px;box-sizing:border-box;transform:translate(-50%,-50%);box-shadow:0 1px 3px #0000002e;z-index:10;pointer-events:auto}.handle-nw{top:0;left:0;cursor:nw-resize}.handle-n{top:0;left:50%;cursor:n-resize}.handle-ne{top:0;left:100%;cursor:ne-resize}.handle-e{top:50%;left:100%;cursor:e-resize}.handle-se{top:100%;left:100%;cursor:se-resize}.handle-s{top:100%;left:50%;cursor:s-resize}.handle-sw{top:100%;left:0;cursor:sw-resize}.handle-w{top:50%;left:0;cursor:w-resize}.paper-wrapper{display:block}.hiprint-printPaper{transition:transform .15s ease-out}.zone-layer{box-sizing:border-box}.zone-layer.zone-header.design-mode,.zone-layer.zone-footer.design-mode{outline:1px dashed var(--pd-ink-green, #67c23a);background:#67c23a0a}.zone-layer.zone-content.design-mode{outline:1px dashed #C3C9D6}.zone-label{position:absolute;top:2px;right:4px;font-size:9px;color:#909399;pointer-events:none;-webkit-user-select:none;user-select:none}.zone-resize-handle{position:absolute;left:0;width:100%;height:6px;cursor:ns-resize;z-index:5}.zone-resize-handle.handle-bottom{bottom:-3px}.zone-resize-handle.handle-top{top:-3px}.zone-resize-handle:hover{background:#10b98140}.zone-height-tip{position:absolute;right:4px;top:-22px;padding:1px 6px;font-size:11px;color:#fff;background:#10b981;border-radius:3px;white-space:nowrap;pointer-events:none}.design-background{position:absolute;z-index:0;overflow:hidden;pointer-events:none}.design-background img{display:block;width:100%;height:100%;object-fit:fill;pointer-events:none;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.grid-bg{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:0}.snap-indicator{position:absolute;width:6px;height:6px;background:var(--pd-accent, #165DFF);border-radius:50%;transform:translate(-50%,-50%);pointer-events:none;z-index:10;animation:snap-pulse-3160f418 .3s ease-out}@keyframes snap-pulse-3160f418{0%{transform:translate(-50%,-50%) scale(2);opacity:.5}to{transform:translate(-50%,-50%) scale(1);opacity:0}}.watermark-layer{position:absolute;top:0;left:0;width:100%;height:100%;z-index:0;overflow:hidden;pointer-events:none}.watermark-tile{position:absolute;pointer-events:none}.adsorb-guide{position:absolute;pointer-events:none;z-index:9999}.adsorb-guide.guide-vertical{border-left:1px dashed var(--pd-accent-secondary, #f56c6c)}.adsorb-guide.guide-horizontal{border-top:1px dashed var(--pd-accent-secondary, #f56c6c)}.manual-guide{position:absolute;pointer-events:auto;z-index:9998;cursor:move}.manual-guide.guide-vertical{border-left:1px solid #3B82F6;width:0}.manual-guide.guide-horizontal{border-top:1px solid #3B82F6;height:0}.manual-guide:before{content:"";position:absolute;pointer-events:auto}.manual-guide.guide-vertical:before{top:0;bottom:0;left:50%;width:var(--guide-hit, 8px);transform:translate(-50%)}.manual-guide.guide-horizontal:before{left:0;right:0;top:50%;height:var(--guide-hit, 8px);transform:translateY(-50%)}.manual-guide:hover{border-color:#ef4444!important}.pd-ruler{position:absolute;display:block;pointer-events:auto;cursor:crosshair;z-index:1;background:var(--pd-ruler-bg, #f8f9fc)}.pd-ruler.is-horizontal{box-shadow:0 1px 0 var(--pd-border-soft, #e9ecf2)}.pd-ruler.is-vertical{box-shadow:1px 0 0 var(--pd-border-soft, #e9ecf2)}.canvas-area{flex:1;overflow-x:scroll;overflow-y:auto;scrollbar-gutter:stable;display:flex;background-color:var(--pd-canvas-bg, #e6e9f0);background-image:radial-gradient(circle,rgba(23,32,60,.13) 1px,transparent 1.2px);background-size:20px 20px;background-position:center;padding:44px 28px 32px 44px;position:relative}.canvas-scroll{display:flex;flex-direction:column;align-items:center;gap:20px;position:relative;flex:none;margin:auto;width:fit-content}.marquee-selection{position:fixed;border:1.5px solid rgba(22,93,255,.7);background:#165dff14;border-radius:2px;pointer-events:none;z-index:10000}.drop-hint{position:fixed;z-index:10002;pointer-events:none;padding:2px 8px;border-radius:10px;background:var(--pd-accent, #165dff);color:#fff;font-size:12px;line-height:18px;white-space:nowrap;box-shadow:0 2px 8px #0000002e}.context-menu{position:fixed;background:var(--pd-surface, #ffffff);border:1px solid var(--pd-border-soft, #e9ecf2);border-radius:8px;box-shadow:var(--pd-shadow-md, 0 10px 28px rgba(23, 32, 60, .12));padding:5px;z-index:10001;min-width:132px}.context-menu-item{padding:7px 12px;border-radius:5px;font-size:12.5px;cursor:pointer;color:var(--pd-text, #2a2e37);-webkit-user-select:none;user-select:none;transition:background .12s ease,color .12s ease}.context-menu-item:hover{background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF)}.context-menu-item.disabled{color:var(--pd-text-faint, #b4b9c4);cursor:not-allowed}.context-menu-item.disabled:hover{background:transparent;color:var(--pd-text-faint, #b4b9c4)}.context-menu-sep{height:1px;background:var(--pd-border-soft, #e9ecf2);margin:5px 8px}.ruler-overlay{position:absolute;inset:0;pointer-events:none;z-index:60}.ruler-corner{position:absolute;top:0;left:0;width:22px;height:22px;background:var(--pd-ruler-bg, #f8f9fc);box-shadow:1px 1px 0 var(--pd-border-soft, #e9ecf2);z-index:2}.ruler-overlay .pd-ruler.is-horizontal{top:0;left:22px}.ruler-overlay .pd-ruler.is-vertical{top:22px;left:0}.ruler-guide-preview{position:fixed;pointer-events:none;z-index:9997}.ruler-guide-preview.guide-vertical{width:0;border-left:1px dashed var(--pd-accent, #165dff)}.ruler-guide-preview.guide-horizontal{height:0;border-top:1px dashed var(--pd-accent, #165dff)}.property-search{padding:0 0 10px;background:transparent}.property-group{border:1px solid var(--pd-border-soft, #e9ecf2);border-radius:8px;margin-bottom:10px;background:var(--pd-surface, #ffffff);overflow:hidden;transition:border-color .14s ease,box-shadow .14s ease}.property-group:last-child{margin-bottom:2px}.property-group.is-expanded{border-color:var(--pd-border-soft, #e9ecf2)}.group-header{display:flex;align-items:center;padding:9px 12px;cursor:pointer;-webkit-user-select:none;user-select:none;background:var(--pd-field-bg, #f4f6fa);transition:background .14s ease}.group-header:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.property-group.is-expanded .group-header{border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.group-icon{margin-right:8px;color:var(--pd-accent, #165DFF)}.group-title{flex:1;font-size:12px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:.3px}.expand-icon{color:var(--pd-text-muted, #8b909c);font-size:10px}.group-content{padding:10px 12px 12px;background:var(--pd-surface, #ffffff)}.position-grid,.margin-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.margin-grid{margin-top:8px}.pd-crop-note{margin:0 0 8px;font-size:12px;line-height:1.5;color:var(--pd-text-faint, #6b7280)}.pd-crop-preview{position:relative;overflow:hidden;margin-bottom:8px;border:1px solid var(--pd-border, #d9dde6);border-radius:4px;line-height:0;width:fit-content;max-width:100%}.pd-crop-thumb{max-width:100%;max-height:96px;display:block}.pd-crop-win{position:absolute;border:1px solid #ff5a5a;box-shadow:0 0 0 999px #0000008c;pointer-events:none}.color-row{display:flex;gap:12px}.color-row>.pd-field{flex:1 1 0;min-width:0}.pd-rotate-row{display:flex;align-items:stretch;width:100%}.pd-rotate-btn{width:26px;flex-shrink:0;border:1px solid var(--pd-border, #d9dde6);background:var(--pd-field-bg, #f4f6fa);color:var(--pd-text, #2a2e37);font-size:14px;line-height:1;cursor:pointer;transition:background .14s ease,border-color .14s ease}.pd-rotate-btn:hover{background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-text-faint, #b4b9c4)}.pd-rotate-btn:first-child{border-radius:6px 0 0 6px;border-right:none}.pd-rotate-btn:last-child{border-radius:0 6px 6px 0;border-left:none}.pd-rotate-stepper{flex:1;min-width:0}.pd-rotate-stepper .pd-step-minus,.pd-rotate-stepper .pd-step-plus{display:none}.pd-rotate-stepper .pd-step-input.pd-input{border-radius:0}.expression-editor{display:flex;height:450px;gap:0}.ee-nav{width:100px;background:var(--pd-sidebar);border-right:1px solid var(--pd-border);display:flex;flex-direction:column;flex-shrink:0}.ee-nav-title{padding:10px;border-bottom:1px solid var(--pd-border);font-weight:600;font-size:13px;color:var(--pd-text);text-align:center}.ee-nav-tabs{flex:1;display:flex;flex-direction:column;padding:6px;gap:4px}.ee-nav-tab{padding:8px 10px;border-radius:6px;cursor:pointer;font-size:12px;text-align:center;transition:all .2s}.ee-nav-tab.active{background:var(--pd-accent);color:#fff}.ee-nav-tab:not(.active){background:var(--pd-surface, white);border:1px solid var(--pd-border);color:var(--pd-text)}.ee-nav-tab:hover:not(.active){background:var(--pd-hover-tint, #ecf5ff);border-color:var(--pd-accent)}.ee-content{width:300px;display:flex;flex-direction:column;border-right:1px solid var(--pd-border);flex-shrink:0}.ee-content-search{padding:10px;border-bottom:1px solid var(--pd-border)}.ee-content-list{flex:1;padding:8px;overflow-y:auto;min-height:0}.ee-func-group{margin-bottom:12px}.ee-func-group-title{font-size:11px;font-weight:600;color:var(--pd-text-muted);padding:6px 10px;margin-bottom:2px;letter-spacing:.5px}.ee-field-group{display:flex;align-items:center;gap:4px;padding:6px 10px;font-size:12px;font-weight:600;color:var(--pd-text)}.ee-field-group.is-list{color:var(--pd-accent, #165DFF)}.ee-field-group-icon{font-size:13px;filter:saturate(.6)}.ee-list-item{padding:7px 10px;cursor:pointer;border-radius:4px;margin-bottom:2px;transition:background .15s}.ee-field-info{display:flex;flex-direction:column;gap:1px}.ee-field-info .ee-item-label{font-size:12px;color:var(--pd-text)}.ee-field-info .ee-item-key{font-size:10px;color:var(--pd-text-muted);font-family:monospace}.ee-field-item{display:flex;align-items:center;gap:6px}.ee-field-item .ee-field-info{flex:1;min-width:0}.ee-copy-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:1px solid transparent;border-radius:4px;background:transparent;color:var(--pd-text-muted);cursor:pointer;transition:color .15s,background .15s,border-color .15s}.ee-copy-btn:hover{background:var(--pd-surface, white);border-color:var(--pd-border);color:var(--pd-accent)}.ee-copy-btn.is-copied{color:var(--pd-success, #16a34a)}.ee-list-item:hover{background:var(--pd-hover-tint, #ecf5ff)}.ee-editor{flex:1;display:flex;flex-direction:column;background:var(--pd-sidebar);min-width:0}.ee-editor-section{padding:12px;border-bottom:1px solid var(--pd-border)}.ee-editor-title{font-size:11px;color:var(--pd-text-muted);margin-bottom:6px;text-transform:uppercase;letter-spacing:.5px}.ee-textarea{width:100%;border:1px solid var(--pd-border);border-radius:6px;padding:10px;font-family:monospace;font-size:13px;resize:vertical;box-sizing:border-box;min-height:100px}.ee-textarea:focus{outline:none;border-color:var(--pd-accent)}.ee-preview{padding:10px;background:var(--pd-bg);border:1px solid var(--pd-border);border-radius:6px;min-height:30px;font-size:13px;color:var(--pd-text);line-height:1.6;white-space:pre-wrap}.ee-preview-error{color:var(--pd-danger, #e53e3e);background:var(--pd-danger-bg, #fef2f2);border-color:var(--pd-danger-border, #fecaca)}.ee-help-section{flex:1;padding:12px;overflow-y:auto;min-height:0}.ee-help-title{font-size:11px;color:var(--pd-text-muted);margin-bottom:8px;text-transform:uppercase;letter-spacing:.5px}.ee-help-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.ee-help-card{border-radius:6px;padding:10px}.ee-help-card-title{font-size:12px;font-weight:600;margin-bottom:4px}.ee-help-card-content{font-size:11px;line-height:1.5;color:var(--pd-text)}.ee-help-field{background:var(--pd-help-field-bg, #f0f9ff);border:1px solid var(--pd-help-field-line, #bae6fd)}.ee-help-field .ee-help-card-title{color:var(--pd-help-field-ink, #0369a1)}.ee-help-function{background:var(--pd-help-function-bg, #f0fdf4);border:1px solid var(--pd-help-function-line, #bbf7d0)}.ee-help-function .ee-help-card-title{color:var(--pd-help-function-ink, #166534)}.ee-help-variable{background:var(--pd-help-variable-bg, #fefce8);border:1px solid var(--pd-help-variable-line, #fde68a)}.ee-help-variable .ee-help-card-title{color:var(--pd-help-variable-ink, #854d0e)}.ee-help-conditional{background:var(--pd-help-conditional-bg, #fdf2f8);border:1px solid var(--pd-help-conditional-line, #fbcfe8)}.ee-help-conditional .ee-help-card-title{color:var(--pd-help-conditional-ink, #9d174d)}.expression-editor{max-height:min(600px,80vh);overflow-y:auto;padding:16px}.col-width-row{display:flex;align-items:center;gap:8px;margin-bottom:4px;width:100%}.border-row{display:flex;gap:10px}.border-row .pd-field{flex:1;min-width:0}.advanced-row{display:flex;gap:16px}.group-help{flex:0 0 auto;width:18px;height:18px;margin-right:6px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;line-height:18px;cursor:pointer}.group-help:hover{background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF)}.group-help:focus-visible{outline:2px solid var(--pd-accent, #165DFF);outline-offset:1px}.image-content-upload{display:flex;flex-direction:column;align-items:flex-start;gap:4px;margin-top:4px}.upload-tip{margin:0;font-size:11px;color:var(--pd-text-muted, #909399)}.cell-style-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 8px}.cell-font-field{grid-column:1 / -1;padding-bottom:8px}.border-style-row{display:flex;gap:6px;margin-bottom:8px}.border-presets{margin-bottom:8px}.merge-btns{display:flex;gap:8px}.merge-card{margin-top:8px;padding:8px;border:1px solid var(--pd-border, #dcdfe6);border-radius:6px}.merge-card-title{font-size:12px;font-weight:600;color:var(--pd-text, #303133);margin-bottom:8px}.merge-card-divider{height:1px;background:var(--pd-menu-divider, #ebeef5);margin:8px 0}.merge-card-hint{margin-top:6px;font-size:11px;line-height:1.4;color:var(--pd-text-muted, #8b909c)}.watermark-config{padding:0 4px}.pd-hint{margin-left:8px;font-size:12px;color:#909399;min-width:32px}.design-background-config{padding:0 4px}.design-background-tip{margin:2px 0 6px;font-size:11px;line-height:1.4;color:var(--pd-text-muted, #909399)}.design-background-path{margin-bottom:6px;padding:4px 6px;font-size:11px;color:var(--pd-text-regular, #606266);background:var(--pd-fill-light, #f5f7fa);border-radius:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.design-background-actions{display:flex;gap:6px}.upload-label{cursor:pointer}.upload-label.disabled{opacity:.6;cursor:not-allowed}.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}.tiling-config{padding:0 4px}.tiling-switch{display:flex;align-items:center;gap:6px;font-size:12px;cursor:pointer}.tiling-error{color:#f56c6c}.tiling-summary{color:var(--pd-text-regular, #606266)}.property-panel{width:304px;min-width:304px;background:var(--pd-sidebar, #ffffff);border-left:1px solid var(--pd-border-soft, #e9ecf2);display:flex;flex-direction:column;overflow:hidden;transition:width .18s ease}.property-panel.collapsed{width:36px;min-width:36px;border-left:1px solid var(--pd-border-soft, #e9ecf2)}.prop-collapsed{display:flex;flex-direction:column;align-items:center;gap:8px;padding-top:12px;flex:1}.pc-btn{width:26px;height:26px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .14s ease}.pc-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.pc-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.prop-head{display:flex;align-items:center;justify-content:space-between;height:42px;padding:0 12px;flex-shrink:0;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.prop-title{font-size:12px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:1.2px;display:inline-flex;align-items:center;gap:7px}.prop-title:before{content:"";width:3px;height:12px;border-radius:2px;background:linear-gradient(180deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF))}.collapse-btn{border:none;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:14px;cursor:pointer;width:24px;height:24px;border-radius:5px;transition:all .14s ease}.collapse-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.prop-tabs{flex:1;display:flex;flex-direction:column;overflow:hidden}.prop-tabs .pd-tab-pane{flex:1;min-height:0;overflow-y:auto;padding:12px}.property-content{padding:0}.margin-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}.custom-size-grid{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:4px;width:100%}.custom-size-x{color:var(--pd-text-muted, #8b909c);font-size:12px}.pd-hint{margin:2px 0 6px;color:var(--pd-text-muted, #8b909c);font-size:12px;line-height:1.4}.page-bg-row{display:flex;align-items:center;gap:8px}.page-bg-picker{flex:1;min-width:0}.status-bar{position:relative;display:flex;align-items:center;gap:20px;height:30px;padding:0 16px;background:var(--pd-surface, #ffffff);border-top:1px solid var(--pd-border-soft, #e9ecf2);box-shadow:0 -1px 2px #17203c08;font-size:11.5px;color:var(--pd-text-muted, #8b909c);-webkit-user-select:none;user-select:none;flex-shrink:0}.status-item{white-space:nowrap;font-variant-numeric:tabular-nums;display:inline-flex;align-items:center}.coord{font-variant-numeric:tabular-nums;color:var(--pd-text, #2a2e37)}.status-paper{margin-left:auto;font-variant-numeric:tabular-nums;color:var(--pd-accent, #165DFF);font-weight:600}.status-version{font-variant-numeric:tabular-nums;color:var(--pd-text-muted, #8b909c)}.help-modal-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:1000}.help-modal{width:800px;max-width:90vw;height:600px;max-height:85vh;background:var(--pd-surface, #ffffff);border-radius:8px;box-shadow:0 4px 24px #00000026;display:flex;flex-direction:column;overflow:hidden}.help-modal-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid var(--pd-border, #d9dde6)}.help-modal-title{margin:0;font-size:16px;font-weight:600;color:var(--pd-text, #2a2e37)}.help-modal-title-wrap{display:flex;align-items:center;gap:10px}.help-modal-project{padding:2px 8px;border-radius:4px;background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF);font-size:12px;font-weight:500}.help-modal-close{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;border-radius:4px;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:20px;cursor:pointer;transition:all .15s}.help-modal-close:hover{background:var(--pd-sidebar-hover, #f0f3f9);color:var(--pd-text, #2a2e37)}.help-modal-body{flex:1;display:flex;overflow:hidden}.help-modal-sidebar{width:160px;padding:12px;border-right:1px solid var(--pd-border, #d9dde6);background:var(--pd-field-bg, #f4f6fa);overflow-y:auto}.help-tab{display:block;width:100%;padding:10px 12px;margin-bottom:4px;border:none;border-radius:4px;background:transparent;color:var(--pd-text, #2a2e37);font-size:13px;text-align:left;cursor:pointer;transition:all .15s}.help-tab:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.help-tab.active{background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF);font-weight:500}.help-modal-content{flex:1;padding:20px;overflow-y:auto}.help-content{font-size:14px;line-height:1.6;color:var(--pd-text, #2a2e37)}.help-content h2{margin:0 0 16px;padding-bottom:8px;border-bottom:1px solid var(--pd-border-soft, #e9ecf2);font-size:18px;font-weight:600}.help-content h3{margin:20px 0 12px;font-size:15px;font-weight:600}.help-content p{margin:0 0 12px}.help-content ul,.help-content ol{margin:0 0 12px;padding-left:24px}.help-content li{margin-bottom:4px}.help-content code{padding:2px 6px;border-radius:3px;background:var(--pd-field-bg, #f4f6fa);font-family:SF Mono,Monaco,monospace;font-size:13px}.help-content pre{margin:0 0 12px;padding:12px;border-radius:4px;background:var(--pd-field-bg, #f4f6fa);overflow-x:auto}.help-content pre code{padding:0;background:transparent}.help-content table{width:100%;margin:0 0 12px;border-collapse:collapse}.help-content th,.help-content td{padding:8px 12px;border:1px solid var(--pd-border, #d9dde6);text-align:left}.help-content th{background:var(--pd-field-bg, #f4f6fa);font-weight:600}.help-content blockquote{margin:0 0 12px;padding:12px 16px;border-left:3px solid var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.help-modal-enter-active,.help-modal-leave-active{transition:opacity .2s ease}.help-modal-enter-active .help-modal,.help-modal-leave-active .help-modal{transition:transform .2s ease}.help-modal-enter-from,.help-modal-leave-to{opacity:0}.help-modal-enter-from .help-modal,.help-modal-leave-to .help-modal{transform:scale(.95)}.page-tabs{display:flex;align-items:center;gap:8px;padding:4px 12px;background:var(--pd-sidebar, #fff);border-bottom:1px solid var(--pd-border, #d9dde6);flex-shrink:0}.page-tabs-list{display:flex;gap:4px;overflow-x:auto;align-items:center}.page-tab{padding:4px 12px;border:1px solid var(--pd-border, #d9dde6);border-radius:4px;background:transparent;cursor:pointer;white-space:nowrap;color:var(--pd-text, #2a2e37);font-size:12px}.page-tab.active{background:var(--pd-accent, #165DFF);color:#fff}.page-tab-rename{padding:4px 8px;width:96px;border:1px solid var(--pd-accent, #165DFF);border-radius:4px;font-size:12px;color:var(--pd-text, #2a2e37);outline:none}.page-tabs-actions{display:flex;gap:4px;margin-left:auto}.page-tabs-actions button{padding:4px 8px;border:1px solid var(--pd-border, #d9dde6);border-radius:4px;background:transparent;cursor:pointer;color:var(--pd-text-muted, #8b909c);font-size:12px;line-height:1}.page-tabs-actions button:disabled{opacity:.4;cursor:not-allowed}.designer-container{--pd-bg: #f3f5f9;--pd-surface: #ffffff;--pd-field-bg: #f4f6fa;--pd-sidebar: #ffffff;--pd-sidebar-hover: #f0f3f9;--pd-canvas-bg: #e6e9f0;--pd-paper: #FFFFFF;--pd-accent: #165DFF;--pd-accent-2: #3D7BFF;--pd-accent-soft: rgba(22, 93, 255, .09);--pd-accent-secondary: #f56c6c;--pd-danger-soft: rgba(245, 108, 108, .1);--pd-ink-green: #67c23a;--pd-text: #2a2e37;--pd-text-muted: #8b909c;--pd-text-faint: #b4b9c4;--pd-border: #d9dde6;--pd-border-soft: #e9ecf2;--pd-input-bg: #ffffff;--pd-hover-tint: #ecf5ff;--pd-danger: #e53e3e;--pd-danger-bg: #fef2f2;--pd-danger-border: #fecaca;--pd-menu-text: #333;--pd-menu-hover: #f5f7fa;--pd-menu-border: #dcdfe6;--pd-menu-divider: #ebeef5;--pd-menu-muted: #909399;--pd-menu-disabled: #c0c4cc;--pd-scrollbar: rgba(23, 32, 60, .18);--pd-scrollbar-thumb: rgba(23, 32, 60, .16);--pd-scrollbar-thumb-hover: rgba(23, 32, 60, .3);--pd-help-field-bg: #f0f9ff;--pd-help-field-line: #bae6fd;--pd-help-field-ink: #0369a1;--pd-help-function-bg: #f0fdf4;--pd-help-function-line: #bbf7d0;--pd-help-function-ink: #166534;--pd-help-variable-bg: #fefce8;--pd-help-variable-line: #fde68a;--pd-help-variable-ink: #854d0e;--pd-help-conditional-bg: #fdf2f8;--pd-help-conditional-line: #fbcfe8;--pd-help-conditional-ink: #9d174d;--pd-handle: #165DFF;--pd-ruler: #9aa1af;--pd-ruler-bg: #f8f9fc;--pd-ruler-cursor: #165DFF;--pd-radius: 6px;--pd-shadow-sm: 0 1px 2px rgba(23, 32, 60, .05);--pd-shadow-md: 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07);--pd-shadow-paper: 0 0 0 1px rgba(23, 32, 60, .05), 0 1px 2px rgba(23, 32, 60, .06), 0 8px 20px rgba(23, 32, 60, .08), 0 26px 60px rgba(23, 32, 60, .15);--pd-success: #16a34a;--pd-text-regular: #606266;--pd-fill-light: #f5f7fa;height:100%;display:flex;flex-direction:column;background:var(--pd-bg)}.designer-body{flex:1;display:flex;overflow:hidden}.designer-container.format-painting .canvas-area,.designer-container.format-painting .canvas-area *{cursor:copy!important}.print-html-preview{width:100%;height:100%;position:relative;background:#e9ebee}.print-html-preview-iframe{width:100%;height:100%;border:0;background:#fff}.print-html-preview-loading,.print-html-preview-error{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:#909399;font-size:14px}.print-html-preview-error{color:#f56c6c}.print-html-preview-warn{position:absolute;top:8px;left:12px;z-index:2;max-width:62%;padding:4px 8px;border:1px solid #e6a23c;border-radius:4px;background:#faecd1f0;color:#b88230;font-size:12px;line-height:1.5}.print-html-preview-zoom{position:absolute;top:8px;right:12px;z-index:2;display:flex;align-items:center;gap:4px;padding:3px 4px;border:1px solid var(--pd-border-soft, #ebeef5);border-radius:6px;background:#ffffffeb;box-shadow:0 1px 4px #00000014}.print-html-preview-zoom-btn{padding:2px 7px;border:0;border-radius:4px;background:transparent;color:var(--pd-text-muted, #909399);font-size:11px;line-height:18px;cursor:pointer;transition:color .14s ease,background .14s ease}.print-html-preview-zoom-btn:hover{background:var(--pd-sidebar-hover, #f0f3f9);color:var(--pd-text, #2a2e37)}.print-html-preview-zoom-btn.active{background:var(--pd-accent, #165DFF);color:#fff;font-weight:600}.print-html-preview-zoom-note{padding-right:4px;color:var(--pd-text-muted, #909399);font-size:11px}.print-html-preview-zoom-hint{color:#b88230;font-size:11px}.tiling-config .margin-grid,.tiling-config .custom-size-grid{display:block;grid-template-columns:none;gap:normal}.tiling-config .custom-size-x{display:inline;min-width:0;color:inherit}.pd-hint{min-width:auto}.watermark-config .pd-hint{min-width:32px;margin-left:8px;color:#909399}.tiling-config .tiling-error{color:#f56c6c}.tiling-config .tiling-summary{color:var(--pd-text-regular, #606266)}.pd-help{position:static}.pd-help:after{top:calc(100% + 6px);bottom:auto;left:0;transform:none;padding:5px 7px;white-space:normal;z-index:120}.page-tabs [data-tip]:after,.field-tree-panel [data-tip]:after{content:none}',no=20;function er(t){try{const e=JSON.parse(t);if(e&&typeof e=="object"&&!Array.isArray(e))return e}catch{}}const bc=".page-tabs, .field-tree-panel, .pd-dialog-overlay",xc=new Set(["z","y","a","c","x","v","d","g","1","l","r","e","t","b","0"]),tr="print-studio:left",or="print-studio:right";function ir(t){try{return localStorage.getItem(t)==="1"}catch{return!1}}function nr(t,e){try{localStorage.setItem(t,e?"1":"0")}catch{}}function di(t){let e=t;if(typeof e=="string")try{e=JSON.parse(e)}catch{return}if(Array.isArray(e))return e.filter(o=>!!o&&typeof o=="object"&&!Array.isArray(o));if(e&&typeof e=="object")return[e]}class Ye extends HTMLElement{root;store;format;unsub=null;unsubPluginUI=null;unsubDefinitions=null;pluginStyleEls=new Map;instanceDisposers=[];measureRaf=null;state={leftTab:"elements",leftCollapsed:!1,propTab:"page",propCollapsed:!1,openDd:null,openMore:!1,collapsedGroups:new Set,renamingPage:null};geom={originX:0,originY:0,viewW:0,viewH:0,paperScale:1};static active=null;docKeydown=null;docDragend=null;ro=null;roArea=null;toolbarRo=null;scrollPos={x:0,y:0};paneScroll=new Map;marquee={visible:!1,x:0,y:0,w:0,h:0};menu={visible:!1,x:0,y:0,flipX:0,flipY:0,targetId:null};guidePreview=null;zoneResizing=null;tableMenu={visible:!1,x:0,y:0};exprTarget=null;exprMountedFor=null;helpVisible=!1;helpInitialTab;unmountHelp=null;drag=null;snapTimer=null;hoverTipEl=null;hoverTipTimer=null;resize=null;raf=0;lastSelKey="";chromeKey="";_theme="auto";_themeConfig;systemDark=!1;themeMedia=null;onThemeMediaChange=()=>{this.systemDark=this.themeMedia?.matches??!1,this.applyTheme()};appliedThemeTokens=[];uploadImage;uploadDesignBackground;_designData;set designData(e){this._designData=di(e),this.repaint()}get designData(){return this._designData}_fonts;set fonts(e){this._fonts=e,this.applyFontFace(),this.repaint()}get fonts(){return this._fonts}fontFaceStyle=null;docFontFaceStyle=null;constructor(){super(),this.root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=mc,this.root.appendChild(e),ve(a("div",{class:"designer-container",dataset:{test:"designer-container"},part:"container"}),this.root)}set template(e){this.applyTemplate(e)}get template(){return this.store?.getTemplateJson()}set fields(e){this.store.fields=(typeof e=="string"?JSON.parse(e):e)??[],this.repaint()}set isEdit(e){this.setAttribute("is-edit",String(e)),this.repaint()}set showHelp(e){this.setAttribute("show-help",String(e)),e||this.closeHelp(),this.repaint()}set showPreview(e){this.setAttribute("show-preview",String(e)),this.repaint()}set showSave(e){this.setAttribute("show-save",String(e)),this.repaint()}set theme(e){const o=e==="dark"||e==="light"?e:"auto";this._theme=o,this.setAttribute("theme",o),this.applyTheme()}get theme(){return this._theme}set themeConfig(e){const o=typeof e=="string"?er(e):e;this._themeConfig=o,o===void 0?this.removeAttribute("theme-config"):this.setAttribute("theme-config",JSON.stringify(o)),this.applyTheme()}get themeConfig(){return this._themeConfig}static contractVersion=Ai;static getHostContract(){return hi()}getHostContract(){return hi()}static get observedAttributes(){return[...Di]}attributeChangedCallback(e,o,i){if(e==="design-data"){this._designData=i===null?void 0:di(i),this.repaint();return}if(e==="theme"){this._theme=i==="dark"||i==="light"?i:"auto",this.applyTheme();return}if(e==="theme-config"){this._themeConfig=i?er(i):void 0,this.applyTheme();return}if(!i)return;if(e==="name"){this.repaint();return}let n;try{n=JSON.parse(i)}catch{return}e==="template"?this.applyTemplate(n):e==="fields"?(this.store.fields=n,this.repaint()):e==="fonts"&&Array.isArray(n)&&(this.fonts=n)}connectedCallback(){if(this.attachThemeMedia(),this.applyTheme(),this.store){this.applyFontFace(),this.attachDocKeys(),this.attachPluginUI(),this.attachInstanceListeners();return}const e={},o=this.getAttribute("template");if(o)try{e.initialTemplate=JSON.parse(o)}catch{}const i=this.getAttribute("fields");if(i)try{e.initialFields=JSON.parse(i)}catch{}const n=this.getAttribute("design-data");n&&this._designData===void 0&&(this._designData=di(n)),this.store=new lr(e),this.format=new Ma(this.store),this.store.onSelectionChanged=()=>this.format.painterSyncSelection(),this.readChrome(),this.unsub=this.store.subscribe(()=>this.repaint()),this.attachDocKeys(),this.attachPluginUI(),this.attachInstanceListeners(),this.applyFontFace(),this.repaint(),this.measureRaf=requestAnimationFrame(()=>{this.measureRaf=null,this.measureRuler()})}attachThemeMedia(){typeof window>"u"||typeof window.matchMedia!="function"||(this.detachThemeMedia(),this.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),this.systemDark=this.themeMedia.matches,this.themeMedia.addEventListener("change",this.onThemeMediaChange))}detachThemeMedia(){this.themeMedia?.removeEventListener("change",this.onThemeMediaChange),this.themeMedia=null}applyTheme(){const e=this.root.querySelector(".designer-container");if(!e)return;for(const n of this.appliedThemeTokens)e.style.removeProperty(n);if(this.appliedThemeTokens=[],(this._theme==="dark"||this._theme==="light"?this._theme:this.systemDark?"dark":"light")==="dark")for(const[n,r]of Object.entries(Oa))r!==void 0&&(e.style.setProperty(n,r),this.appliedThemeTokens.push(n));const i=this._themeConfig?.overrides;if(i)for(const[n,r]of Object.entries(i))!n.startsWith("--pd-")||typeof r!="string"||(e.style.setProperty(n,r),this.appliedThemeTokens.includes(n)||this.appliedThemeTokens.push(n))}readChrome(){this.state.leftCollapsed=ir(tr),this.state.propCollapsed=ir(or),this.chromeKey=`${this.state.leftCollapsed?1:0}|${this.state.propCollapsed?1:0}`}persistChrome(){const e=`${this.state.leftCollapsed?1:0}|${this.state.propCollapsed?1:0}`;e!==this.chromeKey&&(this.chromeKey=e,nr(tr,this.state.leftCollapsed),nr(or,this.state.propCollapsed))}disconnectedCallback(){this.detachThemeMedia(),this.unsub?.(),this.unsub=null,this.unsubPluginUI?.(),this.unsubPluginUI=null,this.unsubDefinitions?.(),this.unsubDefinitions=null,Dn(),this.detachDocKeys(),this.ro?.disconnect(),this.ro=null,this.roArea=null,this.toolbarRo?.disconnect(),this.toolbarRo=null,Ye.active===this&&(Ye.active=null),Or(),this.unmountHelp?.(),this.unmountHelp=null,this.hideHoverTip(),this.snapTimer&&(clearTimeout(this.snapTimer),this.snapTimer=null);for(const e of this.instanceDisposers)e();this.instanceDisposers=[],this.docFontFaceStyle?.remove(),this.docFontFaceStyle=null,this.measureRaf!==null&&(cancelAnimationFrame(this.measureRaf),this.measureRaf=null)}applyFontFace(){const e=_.buildFontFaceCss(this._fonts);if(!e){this.fontFaceStyle?.remove(),this.fontFaceStyle=null,this.docFontFaceStyle?.remove(),this.docFontFaceStyle=null;return}this.fontFaceStyle||(this.fontFaceStyle=document.createElement("style"),this.root.appendChild(this.fontFaceStyle)),this.fontFaceStyle.textContent=e,this.docFontFaceStyle||(this.docFontFaceStyle=document.createElement("style"),this.ownerDocument.head.appendChild(this.docFontFaceStyle)),this.docFontFaceStyle.textContent=e}attachPluginUI(){this.unsubPluginUI||(this.unsubPluginUI=ci.subscribeElementUIRegistry(()=>this.repaint())),this.unsubDefinitions||(this.unsubDefinitions=cr(()=>this.repaint()))}syncPluginUIStyles(){const e=new Map;for(const{type:o,ui:i}of ci.getElementUIEntries())i.styles&&e.set(o,i.styles);for(const[o,i]of[...this.pluginStyleEls])e.has(o)||(i.remove(),this.pluginStyleEls.delete(o));for(const[o,i]of e){let n=this.pluginStyleEls.get(o);n||(n=document.createElement("style"),n.setAttribute("data-plugin-ui",o),this.root.appendChild(n),this.pluginStyleEls.set(o,n)),n.textContent!==i&&(n.textContent=i)}}templateJsonWithFonts(){const e=JSON.parse(this.store.getTemplateJson()),o=this.fonts;if(!o?.length)return e;if(Array.isArray(e.pages)){const i=e;return{...i,pages:i.pages.map(n=>({...n,fonts:[...o]}))}}return{...e,fonts:[...o]}}getTemplateJson(){return JSON.stringify(this.templateJsonWithFonts())}loadTemplate(e){this.applyTemplate(e)}save(){const e=this.validateTemplate();if(e.length){window.alert(e[0].message),this.state.propTab="page",this.repaint();return}const o=this.templateJsonWithFonts();if(Array.isArray(o.pages))try{_.normalizeTemplate(o)}catch(r){window.alert(r instanceof Error?r.message:String(r));return}const i=this.getGeometryWarnings();if(i.length&&!window.confirm(`出纸提示:部分内容超出纸面,打印时会被裁切。
928
- 是否接受裁切并继续保存?
929
- 点击“确定”继续保存,点击“取消”返回修改。
951
+ `},kp={id:"getting-started",title:"Getting Started",content:`
952
+ <h2>Interface Layout</h2>
953
+ <p>The print template designer uses a three-column layout:</p>
954
+ <ul>
955
+ <li><strong>Left panel</strong>: field tree and layer management for viewing and managing canvas elements</li>
956
+ <li><strong>Center canvas</strong>: design area with ruler, guides and grid display</li>
957
+ <li><strong>Right panel</strong>: property settings and template configuration</li>
958
+ <li><strong>Top toolbar</strong>: common action buttons</li>
959
+ <li><strong>Bottom status bar</strong>: coordinates, zoom ratio and element count</li>
960
+ </ul>
961
+
962
+ <h2>Adding Your First Element</h2>
963
+ <ol>
964
+ <li>Select an element type from the left panel (text, image, barcode, etc.)</li>
965
+ <li>Drag it onto the canvas and release</li>
966
+ <li>Select the element and drag to reposition it</li>
967
+ <li>Drag the corner handles to resize it</li>
968
+ </ol>
969
+
970
+ <h2>Data Binding Basics</h2>
971
+ <p>Use curly-brace <code>{field.path}</code> syntax to bind data fields:</p>
972
+ <pre><code>Supplier: {supplier.name}
973
+ Date: {order.date}
974
+ Amount: {MONEY(order.total)}
975
+ Total: {ROUND(qty * price, 2)}</code></pre>
976
+ <p>Inside braces you can write arithmetic (<code>{qty * price}</code>) or use <code>ADD</code> / <code>SUB</code> / <code>MUL</code> / <code>DIV</code>;
977
+ to keep a number of decimals use <code>ROUND</code> (half up), <code>ROUNDUP</code> (up), <code>ROUNDDOWN</code> (down) or <code>ROUNDBANK</code> (banker's rounding).</p>
978
+ <p>Double-click an element to open the expression editor and configure its binding.</p>
979
+
980
+ <h2>Saving and Preview</h2>
981
+ <ul>
982
+ <li>Click "Save" in the toolbar to export the template as JSON</li>
983
+ <li>Click "Preview" to see the print result</li>
984
+ <li>Template data includes page setup, element definitions and style configuration</li>
985
+ </ul>
986
+
987
+ <h2>About the Project</h2>
988
+ <p><strong>Project:</strong> worm-print-platform</p>
989
+ <p><strong>Repository:</strong><a href="https://gitee.com/liulong_oschina/worm-print-platform" target="_blank" rel="noopener noreferrer">https://gitee.com/liulong_oschina/worm-print-platform</a></p>
990
+ <p>A Vue 3 based visual print template designer with drag-and-drop editing, expression data binding and in-browser print preview.</p>
991
+ `},Ep={id:"features",title:"Features",content:`
992
+ <h2>Element Types</h2>
993
+ <table>
994
+ <thead><tr><th>Type</th><th>Description</th></tr></thead>
995
+ <tbody>
996
+ <tr><td>Text</td><td>Static or dynamic text, supports expression binding</td></tr>
997
+ <tr><td>Long Text</td><td>Multi-line text with automatic wrapping</td></tr>
998
+ <tr><td>Data Table</td><td>Dynamic rows and columns, supports pagination, header repeat, sequence/subtotal/summary</td></tr>
999
+ <tr><td>Barcode</td><td>Supports code128 and many other symbologies</td></tr>
1000
+ <tr><td>QR Code</td><td>Supports L/M/Q/H error correction; "Quiet zone (modules)" controls the border (0-8, default 0 = fill); use 4 for the ISO-recommended quiet zone</td></tr>
1001
+ <tr><td>Image</td><td>Static or dynamic images</td></tr>
1002
+ <tr><td>Line</td><td>Horizontal or vertical lines</td></tr>
1003
+ <tr><td>Shape</td><td>Rectangles and ellipses with borders and background colors</td></tr>
1004
+ <tr><td>HTML</td><td>Custom HTML content</td></tr>
1005
+ <tr><td>Page Number</td><td>Automatic page numbering</td></tr>
1006
+ <tr><td>Extension Element</td><td>Elements registered by optional plugins (e.g. the ECharts pack <code>@worm-print-platform/echarts</code>): they appear in the asset panel once registered, with a "Custom Properties" tab when selected; chart data is bound by template expressions at print time and output as vectors</td></tr>
1007
+ </tbody>
1008
+ </table>
1009
+
1010
+ <h2>Expression Editor</h2>
1011
+ <h3>Basic Syntax</h3>
1012
+ <p>Wrap expressions in curly braces <code>{}</code>; text outside braces is literal.</p>
1013
+
1014
+ <h3>Built-in Functions</h3>
1015
+ <table>
1016
+ <thead><tr><th>Function</th><th>Description</th><th>Example</th></tr></thead>
1017
+ <tbody>
1018
+ <tr><td><code>MONEY(value)</code></td><td>Amount formatting (thousands separator + 2 decimals)</td><td><code>{MONEY(order.total)}</code> -> "69,543.75"</td></tr>
1019
+ <tr><td><code>DATE(value, format)</code></td><td>Date formatting</td><td><code>{DATE(order.date, 'YYYY-MM-DD')}</code></td></tr>
1020
+ <tr><td><code>UPPER(value)</code></td><td>Number to uppercase Chinese amount</td><td><code>{UPPER(order.total)}</code></td></tr>
1021
+ <tr><td><code>IF(cond, true, false)</code></td><td>Conditional</td><td><code>{IF(qty > 100, 'large', 'small')}</code></td></tr>
1022
+ <tr><td><code>CONCAT(str1, str2, ...)</code></td><td>String concatenation</td><td><code>{CONCAT(name, '-', spec)}</code></td></tr>
1023
+ <tr><td><code>IFEMPTY(value, default)</code></td><td>Default for empty value</td><td><code>{IFEMPTY(remark, 'none')}</code></td></tr>
1024
+ <tr><td><code>ROUND(num, decimals)</code></td><td>Round half up (default 2 decimals)</td><td><code>{ROUND(price, 2)}</code></td></tr>
1025
+ <tr><td><code>ROUNDUP(n, d)</code> / <code>CEIL(n, d)</code></td><td>Round away from zero</td><td><code>{ROUNDUP(price, 2)}</code></td></tr>
1026
+ <tr><td><code>ROUNDDOWN(n, d)</code> / <code>FLOOR(n, d)</code></td><td>Round toward zero</td><td><code>{ROUNDDOWN(price, 2)}</code></td></tr>
1027
+ <tr><td><code>ROUNDBANK(n, d)</code></td><td>Banker's rounding (GB/T 8170)</td><td><code>{ROUNDBANK(price, 2)}</code></td></tr>
1028
+ <tr><td><code>ADD(a, b, ...)</code></td><td>Add (variadic)</td><td><code>{ADD(qty, 1)}</code></td></tr>
1029
+ <tr><td><code>SUB(a, b, ...)</code></td><td>Subtract</td><td><code>{SUB(total, discount)}</code></td></tr>
1030
+ <tr><td><code>MUL(a, b, ...)</code></td><td>Multiply (variadic)</td><td><code>{MUL(qty, price)}</code></td></tr>
1031
+ <tr><td><code>DIV(a, b)</code></td><td>Divide (returns 0 when divisor is 0)</td><td><code>{DIV(total, qty)}</code></td></tr>
1032
+ <tr><td><code>NOW()</code></td><td>Current date</td><td><code>{NOW()}</code></td></tr>
1033
+ <tr><td><code>SUBSTR(str, start, len)</code></td><td>Substring</td><td><code>{SUBSTR(name, 0, 3)}</code></td></tr>
1034
+ <tr><td><code>LEN(str)</code></td><td>String length</td><td><code>{LEN(name)}</code></td></tr>
1035
+ <tr><td><code>PAD(value, len, char)</code></td><td>Left padding</td><td><code>{PAD(qty, 5, '0')}</code></td></tr>
1036
+ </tbody>
1037
+ </table>
1038
+
1039
+ <h3>Aggregate Functions (table subtotal/summary rows)</h3>
1040
+ <table>
1041
+ <thead><tr><th>Function</th><th>Description</th></tr></thead>
1042
+ <tbody>
1043
+ <tr><td><code>SUM(field)</code></td><td>Sum</td></tr>
1044
+ <tr><td><code>AVG(field)</code></td><td>Average</td></tr>
1045
+ <tr><td><code>COUNT(field)</code></td><td>Count</td></tr>
1046
+ <tr><td><code>MIN(field)</code></td><td>Minimum</td></tr>
1047
+ <tr><td><code>MAX(field)</code></td><td>Maximum</td></tr>
1048
+ </tbody>
1049
+ </table>
1050
+
1051
+ <h3>System Variables</h3>
1052
+ <table>
1053
+ <thead><tr><th>Variable</th><th>Description</th></tr></thead>
1054
+ <tbody>
1055
+ <tr><td><code>pageIndex</code></td><td>Current page number</td></tr>
1056
+ <tr><td><code>totalPages</code></td><td>Total page count</td></tr>
1057
+ <tr><td><code>printDate</code></td><td>Print date (YYYY-MM-DD)</td></tr>
1058
+ <tr><td><code>printTime</code></td><td>Print timestamp</td></tr>
1059
+ </tbody>
1060
+ </table>
1061
+
1062
+ <h2>Data Table Configuration</h2>
1063
+ <h3>Row Types</h3>
1064
+ <ul>
1065
+ <li><strong>Header row</strong>: can repeat on every page</li>
1066
+ <li><strong>Data row</strong>: iterates over a bound list data source</li>
1067
+ <li><strong>Subtotal row</strong>: shows a subtotal at the end of the current page</li>
1068
+ <li><strong>Summary row</strong>: shown only on the last page</li>
1069
+ </ul>
1070
+
1071
+ <h3>Table Operations</h3>
1072
+ <ul>
1073
+ <li>Right-click a cell to open the table menu (the table is auto-selected); insert/delete rows and columns, merge/split cells, change row type</li>
1074
+ <li>Drag-select multiple cells to merge; right-click any member cell to split</li>
1075
+ <li>Supports cell merge/split</li>
1076
+ <li>Border presets: all / outside / inside / none</li>
1077
+ <li>Borderless tables show dashed guide lines in design mode</li>
1078
+ <li><strong>Resize columns</strong>: first select the table element in the left layer panel, then drag the column divider on the canvas</li>
1079
+ <li><strong>Edit table properties</strong>: make sure no cell is selected; click empty canvas to deselect, then select the table in the layer panel</li>
1080
+ <li><strong>Cell images</strong>: if an image cannot shrink, set its handling to "Scale down (keep ratio)"</li>
1081
+ </ul>
1082
+
1083
+ <h2>Format Toolbar and Format Painter</h2>
1084
+ <h3>Format Toolbar</h3>
1085
+ <ul>
1086
+ <li>Located in the top toolbar, enabled when an element or cell is selected; inapplicable buttons are greyed out with a hover reason</li>
1087
+ <li>Set: font, size, bold / underline / strikethrough, text color, background color, horizontal and vertical alignment, borders</li>
1088
+ <li>Inconsistent values in multi-selection show "Mixed"; setting a value unifies them</li>
1089
+ <li>Border panel offers all / outside / inside / none presets and per-side toggles with line style, width and color; "inside" is only for table cells</li>
1090
+ <li>Rectangles, ellipses and lines draw with element borders; tables use cell borders, so no element-level border is offered for them</li>
1091
+ </ul>
1092
+ <h3>Format Painter</h3>
1093
+ <ul>
1094
+ <li>First select a <strong>single</strong> element as the source, click the format painter (double-click for continuous mode)</li>
1095
+ <li>Click or drag-select target elements to apply; single mode exits after one application</li>
1096
+ <li>Press <code>Esc</code>, deselect, or click the painter button again to exit</li>
1097
+ <li>Auto-filters by target type: text styles only to text elements, borders only to border-capable types, background color to all</li>
1098
+ <li>Locked elements are not painted; the source element is not modified</li>
1099
+ </ul>
1100
+
1101
+ <h2>Alignment and Snapping</h2>
1102
+ <h3>Auto Alignment</h3>
1103
+ <p>Alignment guides appear automatically while dragging:</p>
1104
+ <ul>
1105
+ <li>Blue: left/top alignment</li>
1106
+ <li>Green: center alignment</li>
1107
+ <li>Orange: right/bottom alignment</li>
1108
+ </ul>
1109
+ <h3>Grid Snapping</h3>
1110
+ <p>When enabled, elements snap to grid points.</p>
1111
+ <h3>Manual Guides</h3>
1112
+ <p>Drag from the ruler area to add guides; guides participate in snapping.</p>
930
1113
 
931
- ${i.join(`
932
- `)}`))return;const n=JSON.stringify(o);this.store.dirty=!1,this.repaint(),this.dispatchEvent(new CustomEvent(Le.save,{detail:n,bubbles:!0,composed:!0}))}validateTemplate(){const e=this.store.templateData;return e.tiling?.enabled===!0?_.validateTiling(e):[]}getGeometryWarnings(){return _.collectPrintWarnings(this.store.templateData)}applyTemplate(e){if(!e)return;const o=typeof e=="string"?JSON.parse(e):e;this.store?this.store.loadTemplate(o):this.setAttribute("template",JSON.stringify(o))}openExpression(e){this.exprTarget=e,this.syncExpression()}closeExpression(){this.exprTarget=null,this.syncExpression()}syncExpression(){const e=Array.from(this.root.querySelectorAll(".pd-dialog-overlay"));if(!this.exprTarget){e.forEach(i=>i.remove()),this.exprMountedFor=null;return}if(this.exprMountedFor===this.exprTarget)return;e.forEach(i=>i.remove());const o=this.exprTarget;ve(ec({fields:this.store.fields,onClose:()=>this.closeExpression(),onApply:i=>this.applyExpression(o,i)},o),this.root),this.exprMountedFor=o}openHelp(e){this.helpInitialTab=e,this.helpVisible=!0,this.syncHelp()}closeHelp(){this.helpVisible&&(this.helpVisible=!1,this.syncHelp())}syncHelp(){const e=this.helpVisible&&this.getAttribute("show-help")!=="false";if(e&&!this.unmountHelp)this.unmountHelp=cc(this.root,{initialTab:this.helpInitialTab,onClose:()=>this.closeHelp()});else if(!e&&this.unmountHelp){const o=this.unmountHelp;this.unmountHelp=null,o()}}applyExpression(e,o){const i=o.formatter??"",n=e.targetPath;if(n.startsWith("options.")){if(n.includes("[")){const s=this.store.elements.find(l=>l.id===e.elementId);s&&Hi(this.store,s,n,i);return}const r={[n.slice(8)]:i||void 0};o.title!==void 0&&(r.title=o.title),this.store.updateElement(e.elementId,r);return}if(n==="watermark.content"){const r={...this.store.templateData.watermark};yi(i)?Object.assign(r,{mode:"binding",binding:i,content:""}):Object.assign(r,{mode:"fixed",content:i,binding:""}),this.store.updateTemplateData({watermark:r})}}dblEditElement(e){const o=this.store.elements.find(n=>n.id===e);if(!o||(this.store.selectOne(e),this.state.propTab=ui(o)?"custom":"element",o.options.locked))return;const i=gr(o.printElementType.type);i&&this.openExpression({elementId:o.id,targetPath:`options.${i}`,value:String(o.options[i]??"")})}dblEditCell(e){const o=this.store.elements.find(l=>l.id===e.elementId);if(!o||(this.store.selectOne(o.id),this.state.propTab="element",o.options.locked))return;const i=o.options.tableRows??[],n=c.findMainCell(i,e.r,e.c),s=i[n.r]?.cells[n.c];s&&this.openExpression({elementId:o.id,targetPath:`options.tableRows[${n.r}].cells[${n.c}].formatter`,value:s.formatter??""})}get ctx(){return{store:this.store,format:this.format,state:this.state,repaint:()=>this.repaint(),fire:(e,o)=>this.fire(e,o),showHelp:this.getAttribute("show-help")!=="false",showPreview:this.getAttribute("show-preview")!=="false",showSave:this.getAttribute("show-save")!=="false",isEdit:this.getAttribute("is-edit")==="true",host:{uploadImage:this.uploadImage,uploadDesignBackground:this.uploadDesignBackground,fonts:this.fonts,designData:this.designData,fields:this.store.fields}}}canvasUi(){return{geom:this.geom,marquee:this.marquee,contextMenu:this.menu,guidePreview:this.guidePreview,zoneResizing:this.zoneResizing,scrollX:this.scrollPos.x,scrollY:this.scrollPos.y}}repaint(){this.raf||(this.raf=requestAnimationFrame(()=>{this.raf=0,this.paint()}))}paint(){if(!this.store)return;Dn(),this.syncPluginUIStyles();const e=[...this.store.selectedIds].join(",");if(e!==this.lastSelKey){this.lastSelKey=e;const s=this.store.selectedElement;this.state.propTab=s?ui(s)?"custom":"element":"page"}const o=this.root.querySelector(".designer-container");o.classList.toggle("format-painting",this.format.painterActive);for(const s of o.querySelectorAll("[data-pane]"))s.style.display!=="none"&&this.paneScroll.set(s.dataset.pane,s.scrollTop);ar(o);const i=this.ctx;ve(fc(i,Jl(i)),o),ve(ad(i),o),ve(a("div",{class:"designer-body"},[td(i),Fl(i,this.canvasUi()),Hd(i)]),o),ve(sd(i),o),Zn(o),!this.toolbarRo&&typeof ResizeObserver<"u"&&(this.toolbarRo=new ResizeObserver(()=>Zn(o)),this.toolbarRo.observe(o));const n=nl(this.store,(s,l)=>this.fire(s,l),this.tableMenu);n&&ve(n,o),Ms(this.root,this.store.elements,this.designData),Wr(this.root,this.state.propSearch),this.applyShrinkFit();const r=this.root.querySelector(".canvas-area");r&&(r.scrollLeft=this.scrollPos.x,r.scrollTop=this.scrollPos.y);for(const s of o.querySelectorAll("[data-pane]")){const l=this.paneScroll.get(s.dataset.pane);l!==void 0&&(s.scrollTop=l)}this.syncRulers(),this.persistChrome(),this.applyHostParts(o)}applyHostParts(e){const o={".designer-toolbar":"toolbar",".format-toolbar":"format-bar",".left-panel":"left-panel",".canvas-area":"canvas-area",".property-panel":"property-panel",".status-bar":"status-bar",".page-tabs":"page-tabs"};for(const[i,n]of Object.entries(o)){const r=e.querySelector(i);r&&Mi.includes(n)&&r.setAttribute("part",n)}}applyShrinkFit(){for(const e of Array.from(this.root.querySelectorAll('[data-fit="shrink"]')))Ti.fitTextNode(e);for(const e of Array.from(this.root.querySelectorAll("[data-fit-size]"))){if(e.getAttribute("data-fit")==="shrink")continue;e.removeAttribute("data-fit-size");const o=e.getAttribute("data-fit-base");o?e.style.fontSize=`${o}pt`:e.style.removeProperty("font-size")}}measureRuler(){const e=this.root.querySelector(".canvas-area"),o=this.root.querySelector(".hiprint-printPaper");if(!e||!o)return;const i=e.getBoundingClientRect(),n=o.getBoundingClientRect(),r=(this.store.scale||100)/100,s=n.width/c.mmToPx(this.store.paperSize.width);this.geom={paperScale:Math.abs(s-r)<.002?r:s,originX:n.left-i.left-no,originY:n.top-i.top-no,viewW:e.clientWidth-no,viewH:e.clientHeight-no},this.observeCanvasArea()}observeCanvasArea(){const e=this.root.querySelector(".canvas-area");!e||typeof ResizeObserver>"u"||this.roArea===e||(this.roArea=e,this.ro?.disconnect(),this.ro=new ResizeObserver(()=>this.syncRulers()),this.ro.observe(e))}syncRulers(){this.measureRuler();const e=this.store.templateData,o=c.getPaperDimensions(e),i=this.geom.paperScale;for(const n of Array.from(this.root.querySelectorAll(".pd-ruler"))){const r=n.dataset.ruler==="vertical"?"vertical":"horizontal";gc(n,{orientation:r,geom:this.geom,scale:i,paperLengthMM:r==="horizontal"?o.width:o.height})}}patchElementDom(){for(const i of this.store.elements){const n=this.root.querySelector(`[data-el-id="${CSS.escape(i.id)}"]`);n&&(n.style.left=`${i.options.left}mm`,n.style.top=`${i.options.top}mm`,n.style.width=`${i.options.width}mm`,n.style.height=`${i.options.height}mm`)}const e=this.root.querySelector(".position-label"),o=this.store.selectedElement;e&&o&&!this.drag&&(e.textContent=Nr(o.options))}fire(e,o){const i=this.store;switch(e){case"undo":i.undo();break;case"redo":i.redo();break;case"align":i.alignSelected(o);break;case"move-layer":i.moveLayer(o);break;case"group":i.groupSelected();break;case"ungroup":i.ungroupSelected();break;case"copy":i.copy();break;case"cut":i.cutSelected();break;case"paste":i.paste();break;case"paste-at":i.paste();break;case"delete":i.deleteSelected();break;case"delete-page":i.deletePage(i.activePageIndex);break;case"add-page":i.addPage();break;case"duplicate-page":i.duplicatePage(i.activePageIndex);break;case"move-page":i.movePage(i.activePageIndex,i.activePageIndex+o);break;case"select-all":i.selectAll();break;case"clear-selection":i.clearSelection();break;case"toggle-ruler":i.showRuler=!i.showRuler,this.repaint();break;case"toggle-grid":i.showGrid=!i.showGrid,this.repaint();break;case"toggle-snap":i.snapToGrid=!i.snapToGrid,this.repaint();break;case"toggle-table-ghost-border":i.showTableGhostBorder=!i.showTableGhostBorder,this.repaint();break;case"fit-window":this.fitToWindow();break;case"zoom":this.zoomByStep(o>0?1:-1);break;case"preview":this.dispatchEvent(new CustomEvent(Le.preview,{detail:this.getTemplateJson(),bubbles:!0,composed:!0}));break;case"save":this.save();break;case"help":this.dispatchEvent(new CustomEvent(Le.help,{bubbles:!0,composed:!0})),this.openHelp(o);break;case"guide-remove":i.removeGuide(o);break;case"resize-start":this.beginResize(o);break;case"element-mousedown":{const n=o;n.event.button===0&&this.isDoubleTap(`el:${n.id}`,n.event)&&this.fire("element-dblclick",{event:n.event,id:n.id}),this.beginDrag(n);break}case"table-cell-mousedown":{const n=o;this.isDoubleTap(`cell:${n.elementId}:${n.r}:${n.c}`,n.event)&&(this.taps.delete(`el:${n.elementId}`),this.fire("table-cell-dblclick",{elementId:n.elementId,r:n.r,c:n.c,cellId:n.cellId}));break}case"zone-resize":this.beginZoneResize(o);break;case"guide-mousedown":this.beginGuideDrag(o);break;case"ruler-mousedown":this.beginRulerGuide(o);break;case"canvas-mousedown":this.onCanvasMouseDown(o);break;case"canvas-mousemove":this.onCanvasMouseMove(o);break;case"canvas-mouseleave":this.clearCoord();break;case"canvas-contextmenu":this.onContextMenu(o);break;case"contextmenu":this.onElementContextMenu(o);break;case"element-dblclick":{const{id:n}=o;this.dblEditElement(n),this.dispatchEvent(new CustomEvent(Le.dblclickElement,{detail:n,bubbles:!0,composed:!0}));break}case"table-cell-dblclick":{const n=o;this.dblEditCell(n),this.dispatchEvent(new CustomEvent(Le.dblclickCell,{detail:{elementId:n.elementId,r:n.r,c:n.c,cellId:n.cellId},bubbles:!0,composed:!0}));break}case"open-expression":this.openExpression(o);break;case"drop":this.onDrop(o);break;case"wheel":this.onWheel(o);break;case"scroll":this.onScroll();break}}onDrop(e){e.preventDefault();const o=e.dataTransfer,i=o?.getData("elementType"),n=o?.getData("fieldKey"),r=this.pointToPaperMm(e);if(!r)return;const s={x:r.left,y:r.top};if(i)this.store.addElement(i,{},s);else if(n){const l=this.store.fields.find(p=>p.fieldKey===n);l&&this.store.addFieldElement(l,{},s,e.ctrlKey||e.metaKey||e.labelIntent===!0)}}pointToPaperMm(e){const o=this.root.querySelector(".hiprint-printPaper");if(!o)return null;const i=o.getBoundingClientRect(),n=(this.store.scale||100)/100,r=c.pxToMm((e.clientX-i.left)/n),s=c.pxToMm((e.clientY-i.top)/n);return r<0||s<0?null:{left:r,top:s}}onCanvasMouseDown(e){const o=e.target;(o===this.root.querySelector(".canvas-area")||["canvas-scroll","hiprint-printPaper","hiprint-printPaper-content","zone-layer","grid-bg","watermark-layer"].some(n=>o.classList.contains(n)))&&(this.menu.visible=!1,this.state.openDd&&(this.state.openDd=null,this.repaint()),this.state.openMore&&(this.state.openMore=!1,this.repaint()),e.button===0&&(this.store.clearSelection(),this.startMarquee(e)))}onCanvasMouseMove(e){const o=this.pointToPaperMm(e),i=this.root.querySelector("[data-coord]");if(i){if(!o){i.style.display="none";return}i.style.display="",i.textContent=`x:${(o.left-this.store.templateData.margins.left).toFixed(1)} y:${(o.top-this.store.templateData.margins.top).toFixed(1)}mm`}}clearCoord(){const e=this.root.querySelector("[data-coord]");e&&(e.textContent="")}onContextMenu(e){this.openMenu(e,null)}onElementContextMenu(e){this.store.selectedIds.has(e.id)||this.store.selectOne(e.id),this.openMenu(e.event,e.id)}openMenu(e,o){this.menu.x=e.clientX,this.menu.y=e.clientY,this.menu.targetId=o,this.menu.visible=!0,this.menu.flipX=0,this.menu.flipY=0,this.repaint(),requestAnimationFrame(()=>{const i=this.root.querySelector(".context-menu");if(!i)return;const n=i.getBoundingClientRect();this.menu.flipX=n.right>window.innerWidth?window.innerWidth-n.right-8:0,this.menu.flipY=n.bottom>window.innerHeight?window.innerHeight-n.bottom-8:0,this.paint()})}startMarquee(e){const o={x:e.clientX,y:e.clientY},i=r=>{this.marquee={visible:!0,x:Math.min(o.x,r.clientX),y:Math.min(o.y,r.clientY),w:Math.abs(r.clientX-o.x),h:Math.abs(r.clientY-o.y)},this.paint()},n=()=>{window.removeEventListener("mousemove",i),window.removeEventListener("mouseup",n);const r={...this.marquee};if(this.marquee={visible:!1,x:0,y:0,w:0,h:0},r.w>2&&r.h>2){const s=this.store.elements.filter(l=>{const p=this.root.querySelector(`[data-el-id="${CSS.escape(l.id)}"]`);if(!p)return!1;const u=p.getBoundingClientRect();return u.left<r.x+r.w&&u.right>r.x&&u.top<r.y+r.h&&u.bottom>r.y});this.store.select(new Set(s.map(l=>l.id)))}else this.repaint()};window.addEventListener("mousemove",i),window.addEventListener("mouseup",n)}taps=new Map;isDoubleTap(e,o){const i=this.taps.get(e);return this.taps.set(e,{t:o.timeStamp,x:o.clientX,y:o.clientY}),!i||o.timeStamp-i.t>=500||Math.abs(o.clientX-i.x)>6||Math.abs(o.clientY-i.y)>6?!1:(this.taps.delete(e),!0)}beginDrag(e){const o=e.event;if(o.button!==0)return;const i=this.store;o.stopPropagation();const n=i.elements.find(l=>l.id===e.id);if(!n||(i.selectElement(n.id,o.ctrlKey||o.metaKey),n.options.locked))return;const r=o.altKey?[n.id]:i.dragIds(n.id),s=new Map;for(const l of r){const p=i.elements.find(u=>u.id===l);p&&s.set(l,{left:p.options.left,top:p.options.top})}this.drag={ids:r,primary:n.id,altKey:o.altKey,movedPositions:new Map,startX:o.clientX,startY:o.clientY,origin:s,zone:n.zone||"content",moved:!1},i.draggingIds=new Set(r),i.dragStart(),this.syncDragGhost()}syncDragGhost(){const e=this.store.draggingIds;for(const o of Array.from(this.root.querySelectorAll(".print-element"))){const i=e.has(o.dataset.elId??"");o.classList.toggle("drag-ghost",i);const n=o.querySelector(":scope > .drag-preview");i&&!n?ve(a("div",{class:"drag-preview"}),o):!i&&n&&n.remove()}}finishAltClone(e){const o=this.store;o.adsorbGuides=[];const i=o.elements.find(s=>s.id===e.primary),n=e.movedPositions.get(e.primary);if(o.discardLive(),!i||!n)return;const r=JSON.parse(JSON.stringify(i));r.id=c.generateId(),r.options.left=n.left,r.options.top=n.top,r.options.groupId=void 0,o.cloneElement(r)}flashSnapIndicator(e,o){const i=this.root.querySelector(".hiprint-printPaper-content");i&&(i.querySelector(".snap-indicator")?.remove(),ve(a("div",{class:"snap-indicator",style:{left:`${e}mm`,top:`${o}mm`}}),i),this.snapTimer&&clearTimeout(this.snapTimer),this.snapTimer=setTimeout(()=>{i.querySelector(".snap-indicator")?.remove(),this.snapTimer=null},300))}beginResize(e){const o=e.event;o.stopPropagation();const i=this.store.elements.find(n=>n.id===e.id);!i||i.options.locked||(this.resize={id:e.id,point:e.point,startX:o.clientX,startY:o.clientY,origin:{left:i.options.left,top:i.options.top,width:i.options.width,height:i.options.height}},this.store.dragStart())}beginZoneResize(e){e.event.stopPropagation(),e.event.preventDefault(),this.zoneResizing=e.zone;const o=e.event.clientY,i=this.store.templateData,n=e.zone==="header"?i.header.height:i.footer.height,r=(this.store.scale||100)/100,s=p=>{const u=c.pxToMm((p.clientY-o)/r),h=Math.max(0,Math.round((n+(e.zone==="header"?u:-u))*10)/10);e.zone==="header"?this.store.updateTemplateData({header:{...i.header,height:h}}):this.store.updateTemplateData({footer:{...i.footer,height:h}}),this.paint()},l=()=>{window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",l),this.zoneResizing=null,this.store.recordHistory(),this.repaint()};window.addEventListener("mousemove",s),window.addEventListener("mouseup",l)}beginGuideDrag(e){const o=(this.store.templateData.guides??[]).find(h=>h.id===e.id);if(!o)return;const i=c.getPaperDimensions(this.store.templateData),n=o.type==="vertical"?i.width:i.height,r=e.event.clientX,s=e.event.clientY,l=(this.store.scale||100)/100,p=h=>{const m=c.pxToMm((o.type==="vertical"?h.clientX-r:h.clientY-s)/l);this.store.moveGuide(o.id,Math.min(n,Math.max(0,o.position+m))),this.paint()},u=()=>{window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",u),this.store.recordHistory(),this.repaint()};window.addEventListener("mousemove",p),window.addEventListener("mouseup",u)}beginRulerGuide(e){const o=e.orientation==="horizontal"?"vertical":"horizontal",i=r=>{this.guidePreview={type:o,position:o==="vertical"?r.clientX:r.clientY},this.paint()},n=r=>{window.removeEventListener("mousemove",i),window.removeEventListener("mouseup",n);const s=this.rulerPointToMM(r,o);this.guidePreview=null,s!==null?this.store.addGuide(o,s):this.repaint()};window.addEventListener("mousemove",i),window.addEventListener("mouseup",n)}rulerPointToMM(e,o){const i=this.root.querySelector(".hiprint-printPaper");if(!i)return null;const n=i.getBoundingClientRect(),r=c.mmToPx(1)*(this.geom.paperScale||1),s=o==="vertical"?(e.clientX-n.left)/r:(e.clientY-n.top)/r,l=c.getPaperDimensions(this.store.templateData),p=o==="vertical"?l.width:l.height;return s<0||s>p?null:s}applyZoom(e,o,i,n){const r=this.root.querySelector(".canvas-area");if(!r)return;const s=Math.round(this.store.scale),l=Math.max(n,Math.round(e));if(l===s)return;const p=getComputedStyle(r),u=parseFloat(p.paddingLeft)||0,h=parseFloat(p.paddingTop)||0,m=r.scrollLeft+o-u,g=r.scrollTop+i-h,T=l/s;this.store.setScale(l,n),r.scrollLeft=m*T-o+u,r.scrollTop=g*T-i+h,this.scrollPos={x:r.scrollLeft,y:r.scrollTop}}zoomByStep(e){const o=this.root.querySelector(".canvas-area");o&&this.applyZoom(c.nextWheelScale(this.store.scale,e),o.clientWidth/2,o.clientHeight/2,c.MIN_SCALE_PERCENT)}fitToWindow(){const e=this.root.querySelector(".canvas-area");if(!e)return;const o=getComputedStyle(e),i=(parseFloat(o.paddingLeft)||0)+(parseFloat(o.paddingRight)||0),n=(parseFloat(o.paddingTop)||0)+(parseFloat(o.paddingBottom)||0),r=c.getPaperDimensions(this.store.templateData),s=c.computeFitScale(e.clientWidth-i,e.clientHeight-n,c.mmToPx(r.width),c.mmToPx(r.height));this.applyZoom(s,e.clientWidth/2,e.clientHeight/2,c.FIT_SCALE_MIN_PERCENT)}onWheel(e){if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const o=this.root.querySelector(".canvas-area");if(!o)return;const i=Math.round(this.store.scale),n=c.nextWheelScale(i,e.deltaY>0?-1:1);if(n===i)return;const r=o.getBoundingClientRect();this.applyZoom(n,e.clientX-r.left,e.clientY-r.top,c.MIN_SCALE_PERCENT)}onScroll(){const e=this.root.querySelector(".canvas-area");if(!e)return;this.scrollPos={x:e.scrollLeft,y:e.scrollTop};const o=this.root.querySelector(".ruler-overlay");o&&(o.style.transform=`translate(${this.scrollPos.x}px, ${this.scrollPos.y}px)`),this.syncRulers()}on(e,o,i,n){e.addEventListener(o,i,n),this.instanceDisposers.push(()=>e.removeEventListener(o,i,n))}attachInstanceListeners(){this.instanceDisposers.length||(this.bindPointer(),this.bindKeys(),this.bindPaneScroll())}bindPaneScroll(){this.on(this.root,"scroll",e=>{const o=e.target;if(!(o instanceof HTMLElement))return;const i=o.dataset.pane;i&&this.paneScroll.set(i,o.scrollTop)},!0)}bindPointer(){const e=s=>{const l=this.store;if(!l)return;const u=((l.scale||100)/100||1)*c.mmToPx(1),h=(m,g)=>({dx:m/u,dy:g/u});if(this.drag){const{dx:m,dy:g}=h(s.clientX-this.drag.startX,s.clientY-this.drag.startY);(Math.abs(m)>.05||Math.abs(g)>.05)&&(this.drag.moved=!0);const T=l.elements.find(A=>A.id===this.drag.primary),b=T&&c.resolveElementBoxes(T.options).margin,k=T&&b&&{id:T.id,left:(this.drag.origin.get(T.id)?.left??0)+m,top:(this.drag.origin.get(T.id)?.top??0)+g,width:b.width,height:b.height};let y=null;if(k&&l.snapToGrid!==!1){const A=l.elements.filter(N=>!this.drag.ids.includes(N.id)&&(N.zone||"content")===this.drag.zone).map(N=>({id:N.id,...c.resolveElementBoxes(N.options).margin})),L=bi(l.templateData,l.paperSize)[this.drag.zone],K=c.computeAdsorb(k,A,this.manualGuides());y={left:K.left,top:K.top},l.adsorbGuides=(K.lines??[]).filter(N=>N.position>=0&&N.position<=(N.type==="vertical"?L.width:L.height)),(y.left!==k.left||y.top!==k.top)&&this.flashSnapIndicator(y.left+k.width/2,y.top+k.height/2)}else l.adsorbGuides=[];const C=T?this.drag.origin.get(T.id):void 0,D=y&&C?y.left-C.left:m,P=y&&C?y.top-C.top:g;for(const A of this.drag.ids){const L=this.drag.origin.get(A);if(!L)continue;const K={left:L.left+D,top:L.top+P};this.drag.movedPositions.set(A,K),l.livePatch(A,K)}this.patchElementDom(),l.adsorbGuides.length&&this.paintGuidesOnly()}else if(this.resize){const{dx:m,dy:g}=h(s.clientX-this.resize.startX,s.clientY-this.resize.startY),T=c.calcResizeRect(this.resize.point,this.resize.origin,m,g,3.5,3.5);l.livePatch(this.resize.id,T),this.patchElementDom()}},o=()=>{const s=!!this.drag,l=this.drag;if(l?.moved&&l.altKey){this.finishAltClone(l),this.store.dragStop(),this.drag=null,this.store.draggingIds=new Set,this.repaint();return}this.drag?.moved||this.resize?(this.store.adsorbGuides=[],this.store.commitLive(),this.store.dragStop(),this.drag=null,this.resize=null,this.store.draggingIds=new Set,this.repaint()):(this.drag=null,this.store.dragStop(),s&&(this.store.draggingIds=new Set,this.syncDragGhost()))},i=s=>{const l=s.composedPath(),p=l.some(h=>h.classList?.contains("tb-dd"));this.state.openDd&&!p&&(this.state.openDd=null,this.repaint()),this.state.openMore&&!p&&(this.state.openMore=!1,this.repaint());const u=l.some(h=>h.classList?.contains("context-menu"));this.menu.visible&&!u&&(this.menu.visible=!1,this.repaint())},n=s=>{const p=s.target?.closest?.("[data-tip]");!p||!p.closest(bc)||(this.hoverTipTimer&&clearTimeout(this.hoverTipTimer),this.hoverTipTimer=setTimeout(()=>this.showHoverTip(p),300))},r=s=>{const l=s,p=l.target?.closest?.("[data-tip]");p&&l.relatedTarget?.closest?.("[data-tip]")!==p&&this.hideHoverTip()};this.on(window,"mousemove",e),this.on(window,"mouseup",o),this.on(this,"pointerdown",i),this.on(this.root,"mouseover",n),this.on(this.root,"mouseout",r)}showHoverTip(e){const o=e.dataset.tip;if(!o)return;this.hideHoverTip();const i=e.getBoundingClientRect(),n=i.left+i.width/2;this.hoverTipEl=ve(a("div",{class:"pd-hover-tip",style:{left:`${n}px`,top:`${i.bottom+6}px`},text:o}),this.root);const r=this.hoverTipEl.offsetWidth/2;if(!r)return;const s=r+8,l=Math.max(window.innerWidth-r-8,s);this.hoverTipEl.style.left=`${Math.min(Math.max(n,s),l)}px`}hideHoverTip(){this.hoverTipTimer&&(clearTimeout(this.hoverTipTimer),this.hoverTipTimer=null),this.hoverTipEl?.remove(),this.hoverTipEl=null}manualGuides(){const e=[],o=[];for(const i of this.store.templateData.guides??[])i.type==="vertical"?e.push(i.position):o.push(i.position);return{vertical:e,horizontal:o}}paintGuidesOnly(){const e=this.root.querySelector(".hiprint-printPaper-content");if(!e)return;for(const i of Array.from(e.querySelectorAll(".adsorb-guide")))i.remove();const o=this.store.paperSize;bi(this.store.templateData,o);for(const i of this.store.adsorbGuides){const n=document.createElement("div");n.className=`adsorb-guide guide-${i.type}`,i.type==="vertical"?n.style.cssText=`left:${i.position}mm;top:0;height:${o.height}mm;border-left-color:${i.color||"var(--pd-accent-secondary, #f56c6c)"}`:n.style.cssText=`top:${i.position}mm;left:0;width:${o.width}mm;border-top-color:${i.color||"var(--pd-accent-secondary, #f56c6c)"}`,e.appendChild(n)}}bindKeys(){this.setAttribute("tabindex","0");const e=()=>{Ye.active=this};this.on(this,"pointerdown",e),this.on(this,"focusin",e),Ye.active||(Ye.active=this)}attachDocKeys(){this.docKeydown||(this.docKeydown=e=>this.onGlobalKeydown(e),document.addEventListener("keydown",this.docKeydown),this.docDragend=()=>$r(this.root?.querySelector(".canvas-area")),document.addEventListener("dragend",this.docDragend,!0))}detachDocKeys(){this.docKeydown&&(document.removeEventListener("keydown",this.docKeydown),this.docKeydown=null,this.docDragend&&(document.removeEventListener("dragend",this.docDragend,!0),this.docDragend=null))}onGlobalKeydown(e){const o=this.store;if(!o||Ye.active!==this)return;const n=e.composedPath()[0]?.tagName;if(n==="INPUT"||n==="TEXTAREA"||n==="SELECT")return;if(this.format.handlePainterKeydown(e),e.key.startsWith("Arrow")){e.preventDefault();const s=e.shiftKey?10:e.ctrlKey?.5:1,l=e.key==="ArrowLeft"?-s:e.key==="ArrowRight"?s:0,p=e.key==="ArrowUp"?-s:e.key==="ArrowDown"?s:0;o.moveSelected(l,p);return}if(e.key==="Delete"||e.key==="Backspace"){e.preventDefault(),o.deleteSelected();return}if(!(e.ctrlKey||e.metaKey))return;const r=e.key.toLowerCase();xc.has(r)&&(e.preventDefault(),r==="z"?e.shiftKey?o.redo():o.undo():r==="y"?o.redo():r==="a"?o.selectAll():r==="c"?o.copy():r==="x"?o.cutSelected():r==="v"?o.paste():r==="d"?o.duplicateSelected():r==="g"?e.shiftKey?o.ungroupSelected():o.groupSelected():r==="1"?o.resetZoom():r==="l"?o.alignSelected("left"):r==="r"?o.alignSelected("right"):r==="e"?o.alignSelected("vertical"):r==="t"?o.alignSelected("top"):r==="b"?o.alignSelected("bottom"):r==="0"&&this.fire("fit-window"))}}function Yr(t="print-designer"){return customElements.get(t)||customElements.define(t,Ye),t}function vc(){return Yr()}Object.defineProperty(exports,"BUILTIN_ELEMENT_CAPABILITIES",{enumerable:!0,get:()=>c.BUILTIN_ELEMENT_CAPABILITIES});Object.defineProperty(exports,"getElementCapabilities",{enumerable:!0,get:()=>c.getElementCapabilities});Object.defineProperty(exports,"getElementCapabilityTypes",{enumerable:!0,get:()=>c.getElementCapabilityTypes});Object.defineProperty(exports,"registerElementCapabilities",{enumerable:!0,get:()=>c.registerElementCapabilities});Object.defineProperty(exports,"resetElementCapabilities",{enumerable:!0,get:()=>c.resetElementCapabilities});exports.BUILTIN_ELEMENT_DEFINITIONS=fo;exports.DesignerStore=lr;exports.PRINT_DESIGNER_ATTRIBUTES=Di;exports.PRINT_DESIGNER_BOOLEAN_ATTRIBUTES=xr;exports.PRINT_DESIGNER_CONTRACT_VERSION=Ai;exports.PRINT_DESIGNER_EVENT=Le;exports.PRINT_DESIGNER_EVENTS=Er;exports.PRINT_DESIGNER_EVENT_OPTIONS=za;exports.PRINT_DESIGNER_METHODS=yr;exports.PRINT_DESIGNER_PARTS=Mi;exports.PRINT_DESIGNER_PROPERTY_NAMES=wr;exports.PRINT_DESIGNER_TAG=br;exports.PRINT_DESIGNER_THEME_TOKENS=vr;exports.PrintDesignerElement=Ye;exports.TILING_SINGLE_PAGE_TIP=pi;exports.createDefaultTemplate=$t;exports.definePrintDesigner=Yr;exports.getElementDblEditableField=gr;exports.getElementDefinition=nt;exports.getElementDefinitions=ur;exports.getElementLayerIcon=mr;exports.getElementPropertyGroup=fr;exports.getHostContract=hi;exports.getMaterialElementDefinitions=hr;exports.registerAll=vc;exports.registerElementDefinition=Pa;exports.registerElementRenderer=Ia;exports.registerElementRenderers=pr;exports.resetElementDefinitions=La;exports.serializePage=sr;exports.subscribeElementDefinitions=cr;exports.toRuntimePool=ki;
1114
+ <h2>Layer Management</h2>
1115
+ <ul>
1116
+ <li>Change display order (bring to front / send to back / move up / move down)</li>
1117
+ <li>Show/hide elements</li>
1118
+ <li>Lock/unlock elements (locked elements cannot be edited)</li>
1119
+ </ul>
1120
+
1121
+ <h3>Grouping</h3>
1122
+ <p>Select multiple elements (Ctrl/⌘+click or marquee on empty area), then group them via the toolbar, layer panel button or <code>Ctrl + G</code>; ungroup with <code>Ctrl + Shift + G</code>. After grouping:</p>
1123
+ <ul>
1124
+ <li>Clicking any member selects the whole group; dragging any member moves the whole group</li>
1125
+ <li><strong>The group is forced onto a single page when printing</strong>, never split across pages</li>
1126
+ </ul>
1127
+ <p><strong>Note:</strong> the total height of group members must not exceed the page content area, otherwise the overflow is clipped. Split tall groups or ungroup them.</p>
1128
+
1129
+ <h3>Context Menu</h3>
1130
+ <ul>
1131
+ <li><strong>Right-click an element</strong>: copy / cut / paste / delete / bring to front / move up / move down / send to back. If the element is not in the current selection, selection is reduced to it; if it already belongs to a multi-selection, the selection is kept</li>
1132
+ <li><strong>Right-click empty area</strong>: paste / select all / deselect</li>
1133
+ <li>Paste is greyed out when there is nothing to paste</li>
1134
+ </ul>
1135
+
1136
+ <h2>Three-Zone Layout</h2>
1137
+ <p>A page has three zones:</p>
1138
+ <ul>
1139
+ <li><strong>Header</strong>: top area</li>
1140
+ <li><strong>Content</strong>: main body</li>
1141
+ <li><strong>Footer</strong>: bottom area</li>
1142
+ </ul>
1143
+ <p>Element types supported in header/footer: text, image, line, shape, barcode, QR code</p>
1144
+
1145
+ <h2>Watermark Configuration</h2>
1146
+ <ul>
1147
+ <li>Watermark content uses a single "watermark expression" input: plain text is a static watermark; <code>{order.no}</code>, <code>CONCAT(...)</code> etc. are parsed as expressions</li>
1148
+ <li>Click "Edit expression" (or double-click the input) to open the editor and pick business fields and system variables: print date <code>{printDate}</code>, print time <code>{printTime}</code>, current page <code>{pageIndex}</code>, total pages <code>{totalPages}</code>; a failed expression falls back to the test value</li>
1149
+ <li>Set rotation angle (-90° to 90°), color and opacity</li>
1150
+ <li>Adjust density (dense/medium/sparse/custom tile size) and watermark color</li>
1151
+ <li>Watermarks render consistently in the canvas, browser preview, server PDF and silent printing</li>
1152
+ </ul>
1153
+ `},Sp={id:"advanced-settings",title:"Advanced Settings",content:`
1154
+ <h2>Advanced Settings</h2>
1155
+ <p>Advanced settings control an element's edit protection, cross-page display, overlap order and deletion. These settings are saved in the template, but each option has different pagination semantics, so choose according to the element's layout role.</p>
1156
+
1157
+ <h3>Lock</h3>
1158
+ <ul>
1159
+ <li><strong>Effect:</strong> prevents accidental dragging or resizing on the canvas; suitable for finished titles, tables, lines and fixed marks.</li>
1160
+ <li><strong>Print impact:</strong> does not hide the element or change its content, position or pagination.</li>
1161
+ <li><strong>Use case:</strong> when the layout is finalized and you only need to adjust other elements; unlock first to adjust position or size again.</li>
1162
+ </ul>
1163
+
1164
+ <h3>Repeat on Every Page</h3>
1165
+ <ul>
1166
+ <li><strong>Effect:</strong> the element is output on every page. The first page keeps its designed position; continuation pages are normalized to the top repeat area, reserving body space by the element and its rotated bounding box height.</li>
1167
+ <li><strong>Suitable for:</strong> top horizontal areas such as page titles, payment info, contract info and notes. Using this on tables or dynamic lists repeats the whole item on each page, not just the header.</li>
1168
+ <li><strong>Not suitable for:</strong> right-side attachments, vertical text, floating marks that must keep their original coordinates. Use "Fix on Every Page" for those.</li>
1169
+ <li><strong>Note:</strong> continuation pages reserve the height of the whole repeat area and will not free space just because the element sits on the right. Rotated vertical attachments usually have a tall bounding box and can push body content to the bottom.</li>
1170
+ </ul>
1171
+
1172
+ <h3>Fix on Every Page</h3>
1173
+ <ul>
1174
+ <li><strong>Effect:</strong> the element keeps the same designed coordinates on every page, does not participate in body pagination, does not consume body height and is not grouped into table-follow regions.</li>
1175
+ <li><strong>Suitable for:</strong> right-side vertical attachments, fixed page-edge marks, seam hints, text or graphics that should appear at the same position on every page. Sheet paper outputs each page; continuous paper outputs once.</li>
1176
+ <li><strong>Table note:</strong> fixing a whole table repeats it entirely. When details need pagination, let the table paginate normally and use the table row option "Repeat header on every page".</li>
1177
+ </ul>
1178
+
1179
+ <h3>Z-Order</h3>
1180
+ <ul>
1181
+ <li><strong>Effect:</strong> controls the stacking order when elements overlap; larger values are on top.</li>
1182
+ <li><strong>Use case:</strong> place background blocks and border lines at the bottom; text, barcodes, QR codes and signatures at the top.</li>
1183
+ <li><strong>Print impact:</strong> only changes visual stacking, not coordinates, pagination order or body space.</li>
1184
+ </ul>
1185
+
1186
+ <h3>Delete Element</h3>
1187
+ <ul>
1188
+ <li><strong>Effect:</strong> removes the selected element from the current template.</li>
1189
+ <li><strong>Recovery:</strong> use toolbar "Undo" right after an accidental delete; before saving you can also close without saving to discard changes.</li>
1190
+ </ul>
1191
+
1192
+ <h3>Combination Rules and Suggestions</h3>
1193
+ <ul>
1194
+ <li><strong>Fix + Repeat:</strong> when both are on, "Fix on Every Page" wins and the element is output at its original coordinates on every page.</li>
1195
+ <li><strong>Repeat + Exclude from Pagination:</strong> repeat is handled in a separate repeat area first; "exclude from pagination" cannot stop continuation pages from reserving space.</li>
1196
+ <li><strong>Exclude from Pagination only:</strong> the element is placed at its designed coordinates on the first page only and does not join later pagination; it is not an every-page toggle.</li>
1197
+ <li><strong>Right-side attachment on a payment request:</strong> recommended "Fix on Every Page" on, "Repeat on Every Page" off, "Participate in Pagination" off. Positions stay consistent and payment details are not squeezed.</li>
1198
+ <li><strong>Right-side attachment on the first page only:</strong> turn off both "Fix on Every Page" and "Repeat on Every Page", and also turn off "Participate in Pagination".</li>
1199
+ </ul>
1200
+ `},Tp={id:"shortcuts",title:"Keyboard Shortcuts",content:`
1201
+ <h2>Common Operations</h2>
1202
+ <table>
1203
+ <thead><tr><th>Shortcut</th><th>Action</th></tr></thead>
1204
+ <tbody>
1205
+ <tr><td><code>Ctrl + Z</code> / <code>⌘ + Z</code></td><td>Undo</td></tr>
1206
+ <tr><td><code>Ctrl + Shift + Z</code> / <code>⌘ + Shift + Z</code></td><td>Redo</td></tr>
1207
+ <tr><td><code>Ctrl + C</code> / <code>⌘ + C</code></td><td>Copy selected element</td></tr>
1208
+ <tr><td><code>Ctrl + V</code> / <code>⌘ + V</code></td><td>Paste</td></tr>
1209
+ <tr><td><code>Delete</code> / <code>Backspace</code></td><td>Delete selected element</td></tr>
1210
+ <tr><td><code>Ctrl + A</code> / <code>⌘ + A</code></td><td>Select all</td></tr>
1211
+ <tr><td><code>Ctrl + G</code> / <code>⌘ + G</code></td><td>Group selected elements</td></tr>
1212
+ <tr><td><code>Ctrl + Shift + G</code> / <code>⌘ + Shift + G</code></td><td>Ungroup</td></tr>
1213
+ <tr><td><code>Arrow keys</code></td><td>Nudge selected element (hold Shift for larger step)</td></tr>
1214
+ <tr><td><code>Esc</code></td><td>Cancel selection / exit dialog or painter mode</td></tr>
1215
+ <tr><td><code>Space + drag</code></td><td>Pan the canvas</td></tr>
1216
+ <tr><td><code>Ctrl + scroll</code> / <code>⌘ + scroll</code></td><td>Zoom the canvas</td></tr>
1217
+ </tbody>
1218
+ </table>
1219
+
1220
+ <h2>Expression Editor</h2>
1221
+ <ul>
1222
+ <li>Double-click a field, variable or function in the left list to insert it into the expression</li>
1223
+ <li>Hold <code>Ctrl</code> (<code>⌘</code> on Mac) while double-clicking to insert the field name instead</li>
1224
+ <li>Use curly braces <code>{}</code> for field expressions; static text can be typed directly</li>
1225
+ </ul>
1226
+ `},Cp={id:"faq",title:"FAQ",content:`
1227
+ <h2>How do I adjust the paper size?</h2>
1228
+ <ol>
1229
+ <li>Select "Page Setup" in the right panel</li>
1230
+ <li>Choose a preset paper size from the "Paper Size" dropdown</li>
1231
+ <li>Or choose "Custom Size" and enter the width and height</li>
1232
+ </ol>
1233
+
1234
+ <h2>Why is my expression not evaluating?</h2>
1235
+ <p>Expressions must be wrapped in curly braces <code>{}</code>. Check that field names are spelled correctly and that functions use the right arguments. Double-click the element to open the expression editor and preview the result.</p>
1236
+
1237
+ <h2>Why is content clipped when printing?</h2>
1238
+ <p>Content extending beyond the printable area (inside the margins) is clipped. Reduce element size, adjust position, or switch to landscape orientation. The save dialog warns about estimated clipping.</p>
1239
+
1240
+ <h2>How do I repeat a table header on every page?</h2>
1241
+ <p>In the table row settings, set the header row to repeat, and make sure the table participates in normal pagination. Enabling "Fix on Every Page" on the whole table will repeat the entire table instead.</p>
1242
+
1243
+ <h2>How do I bind dynamic data to an element?</h2>
1244
+ <p>Use <code>{field.path}</code> syntax in a text element, or double-click the element to open the expression editor and pick a field from the left list. Fields come from the data you pass at print time.</p>
1245
+
1246
+ <h2>Why can't I drag a column border to resize it?</h2>
1247
+ <p>First select the table element in the left layer panel, then drag the column divider on the canvas. Make sure no individual cell is selected.</p>
1248
+
1249
+ <h2>How do I add a watermark?</h2>
1250
+ <p>Enable the watermark option in page setup, enter the watermark text or expression, then adjust rotation, color, opacity and density. Watermarks render consistently in the canvas, browser preview, server PDF and silent printing.</p>
1251
+
1252
+ <h2>Can I use charts and other custom elements?</h2>
1253
+ <p>Yes. Optional plugins such as the ECharts chart pack register extra element types. Once installed, they appear in the asset panel and provide a "Custom Properties" tab when selected.</p>
1254
+ `},Dp={id:"changelog",title:"Release Notes",content:`
1255
+ <h2>V1.6.1<small>(2026-11-22)</small></h2>
1256
+
1257
+ <h3>Added</h3>
1258
+ <ul>
1259
+ <li><strong>Custom language packs</strong>: designer shell text can be replaced with custom language resources, with a CLI to export skeletons, validate translations and apply incremental updates.</li>
1260
+ </ul>
1261
+
1262
+ <h3>Fixed</h3>
1263
+ <ul>
1264
+ <li><strong>Rendering and designer details</strong>: fixes for dot-matrix barcodes, full-page rotation, watermarks, image borders and crop anchors; property search and table matrices are more reliable.</li>
1265
+ </ul>
1266
+
1267
+ <h2>V1.6.0<small>(2026-11-19)</small></h2>
1268
+ <h3>Added</h3>
1269
+ <ul>
1270
+ <li><strong>Host-configurable field display</strong>: new <code>field-display</code> attribute (<code>fieldDisplay</code> property) with label-only, key-only or both modes (default both). Key-only styling matches the label style; group names always show; search/copy/insert semantics unchanged.</li>
1271
+ </ul>
1272
+ <h3>Fixed</h3>
1273
+ <ul>
1274
+ <li><strong>Chart data label offset</strong>: the panel now writes native ECharts <code>offset: [x, y]</code>; legacy <code>offsetX</code>/<code>offsetY</code> are migrated on read, write and render.</li>
1275
+ </ul>
1276
+
1277
+ <h2>V1.5.3<small>(2026-11-18)</small></h2>
1278
+ <h3>Fixed</h3>
1279
+ <ul>
1280
+ <li>Various stability and rendering fixes.</li>
1281
+ </ul>
1282
+
1283
+ <h2>V1.5.2<small>(2026-11-17)</small></h2>
1284
+ <h3>Added</h3>
1285
+ <ul>
1286
+ <li>Enhancements to the data preview plugin and expression handling.</li>
1287
+ </ul>
1288
+
1289
+ <h2>V1.5.1<small>(2026-11-16)</small></h2>
1290
+ <h3>Fixed</h3>
1291
+ <ul>
1292
+ <li>Minor fixes to element behavior and print output.</li>
1293
+ </ul>
1294
+
1295
+ <h2>V1.5.0<small>(2026-11-16)</small></h2>
1296
+ <h3>Added</h3>
1297
+ <ul>
1298
+ <li>New capabilities for element layout and pagination.</li>
1299
+ </ul>
1300
+
1301
+ <h2>V1.4.8<small>(2026-11-11)</small></h2>
1302
+ <h3>Fixed</h3>
1303
+ <ul>
1304
+ <li>Corrected table and pagination edge cases.</li>
1305
+ </ul>
1306
+
1307
+ <h2>V1.4.7<small>(2026-11-09)</small></h2>
1308
+ <h3>Added / Fixed</h3>
1309
+ <ul>
1310
+ <li>Improved geometry warning accuracy and various fixes.</li>
1311
+ </ul>
1312
+
1313
+ <h2>V1.4.6<small>(2026-11-05)</small></h2>
1314
+ <h3>Fixed</h3>
1315
+ <ul>
1316
+ <li>Fixes to rotation and text fitting.</li>
1317
+ </ul>
1318
+
1319
+ <h2>V1.4.5<small>(2026-11-04)</small></h2>
1320
+ <h3>Fixed</h3>
1321
+ <ul>
1322
+ <li>Fixes to table borders and property panel.</li>
1323
+ </ul>
1324
+
1325
+ <h2>V1.4.4<small>(2026-11-04)</small></h2>
1326
+ <h3>Added</h3>
1327
+ <ul>
1328
+ <li>Enhancements to chart labels and plugin UI.</li>
1329
+ </ul>
1330
+
1331
+ <h2>V1.4.3<small>(2026-11-01)</small></h2>
1332
+ <h3>Fixed</h3>
1333
+ <ul>
1334
+ <li>Fixes to expression evaluation and preview.</li>
1335
+ </ul>
1336
+
1337
+ <h2>V1.4.2<small>(2026-10-30)</small></h2>
1338
+ <h3>Added</h3>
1339
+ <ul>
1340
+ <li>Additions to the plugin marketplace and element capabilities.</li>
1341
+ </ul>
1342
+
1343
+ <h2>V1.4.1<small>(2026-10-28)</small></h2>
1344
+ <h3>Fixed</h3>
1345
+ <ul>
1346
+ <li>Minor stability fixes.</li>
1347
+ </ul>
1348
+
1349
+ <h2>V1.4.0<small>(2026-10-28)</small></h2>
1350
+ <h3>Added</h3>
1351
+ <ul>
1352
+ <li>Major feature release with new designer capabilities.</li>
1353
+ </ul>
1354
+
1355
+ <h2>V1.3.11<small>(2026-10-26)</small></h2>
1356
+ <h3>Fixed</h3>
1357
+ <ul>
1358
+ <li>Fixes to continuous paper and tiling.</li>
1359
+ </ul>
1360
+
1361
+ <h2>V1.3.10<small>(2026-10-24)</small></h2>
1362
+ <h3>Added / Fixed</h3>
1363
+ <ul>
1364
+ <li>Improvements to pagination and multiple fixes.</li>
1365
+ </ul>
1366
+
1367
+ <h2>V1.3.9<small>(2026-10-22)</small></h2>
1368
+ <h3>Fixed</h3>
1369
+ <ul>
1370
+ <li>Fixes to flow layout and rendering.</li>
1371
+ </ul>
1372
+
1373
+ <h2>V1.3.8<small>(2026-10-22)</small></h2>
1374
+ <h3>Fixed</h3>
1375
+ <ul>
1376
+ <li>Minor fixes to element rendering.</li>
1377
+ </ul>
1378
+
1379
+ <h2>V1.3.7<small>(2026-10-19)</small></h2>
1380
+ <h3>Added</h3>
1381
+ <ul>
1382
+ <li>Enhancements to design background and watermarks.</li>
1383
+ </ul>
1384
+
1385
+ <h2>V1.3.6<small>(2026-10-16)</small></h2>
1386
+ <h3>Fixed</h3>
1387
+ <ul>
1388
+ <li>Fixes to crop anchors and image handling.</li>
1389
+ </ul>
1390
+
1391
+ <h2>V1.3.5<small>(2026-10-05)</small></h2>
1392
+ <h3>Fixed</h3>
1393
+ <ul>
1394
+ <li>Minor fixes to property panel.</li>
1395
+ </ul>
1396
+
1397
+ <h2>V1.3.4<small>(2026-09-27)</small></h2>
1398
+ <h3>Added</h3>
1399
+ <ul>
1400
+ <li>New options for element styling.</li>
1401
+ </ul>
1402
+
1403
+ <h2>V1.3.3<small>(2026-09-27)</small></h2>
1404
+ <h3>Fixed</h3>
1405
+ <ul>
1406
+ <li>Fixes to data binding and expressions.</li>
1407
+ </ul>
1408
+
1409
+ <h2>V1.3.2<small>(2026-09-26)</small></h2>
1410
+ <h3>Fixed</h3>
1411
+ <ul>
1412
+ <li>Minor stability fixes.</li>
1413
+ </ul>
1414
+
1415
+ <h2>V1.3.1<small>(2026-09-21)</small></h2>
1416
+ <h3>Added</h3>
1417
+ <ul>
1418
+ <li>Enhancements to toolbar and panels.</li>
1419
+ </ul>
1420
+
1421
+ <h2>V1.3.0<small>(2026-09-20)</small></h2>
1422
+ <h3>Added</h3>
1423
+ <ul>
1424
+ <li>Major release with plugin architecture improvements.</li>
1425
+ </ul>
1426
+
1427
+ <h2>V1.2.2<small>(2026-09-11)</small></h2>
1428
+ <h3>Fixed</h3>
1429
+ <ul>
1430
+ <li>Fixes to printing and preview.</li>
1431
+ </ul>
1432
+
1433
+ <h2>V1.2.1<small>(2026-09-11)</small></h2>
1434
+ <h3>Fixed</h3>
1435
+ <ul>
1436
+ <li>Minor fixes.</li>
1437
+ </ul>
1438
+
1439
+ <h2>V1.2.0<small>(2026-09-10)</small></h2>
1440
+ <h3>Added</h3>
1441
+ <ul>
1442
+ <li>New rendering pipeline features.</li>
1443
+ </ul>
1444
+
1445
+ <h2>V1.1.0<small>(2026-09-06)</small></h2>
1446
+ <h3>Added</h3>
1447
+ <ul>
1448
+ <li>Additional element types and designer features.</li>
1449
+ </ul>
1450
+
1451
+ <h2>V1.0.0<small>(2026-09-02)</small></h2>
1452
+ <h3>Added</h3>
1453
+ <ul>
1454
+ <li>Initial release of the print template designer.</li>
1455
+ </ul>
1456
+ `},Pp={id:"getting-started",title:"เริ่มต้นใช้งาน",content:`
1457
+ <h2>เค้าโครงอินเทอร์เฟซ</h2>
1458
+ <p>ตัวออกแบบเทมเพลตการพิมพ์ใช้เค้าโครงสามคอลัมน์:</p>
1459
+ <ul>
1460
+ <li><strong>แผงด้านซ้าย</strong>: ต้นทางฟิลด์และการจัดการเลเยอร์สำหรับดูและจัดการองค์ประกอบบนพื้นที่ทำงาน</li>
1461
+ <li><strong>พื้นที่ทำงานกลาง</strong>: พื้นที่ออกแบบพร้อมไม้บรรทัด แนวนำทาง และการแสดงตารางนำทาง</li>
1462
+ <li><strong>แผงด้านขวา</strong>: การตั้งค่าคุณสมบัติและการกำหนดค่าเทมเพลต</li>
1463
+ <li><strong>แถบเครื่องมือด้านบน</strong>: ปุ่มการทำงานที่ใช้บ่อย</li>
1464
+ <li><strong>แถบสถานะด้านล่าง</strong>: พิกัด อัตราซูม และจำนวนองค์ประกอบ</li>
1465
+ </ul>
1466
+
1467
+ <h2>เพิ่มองค์ประกอบแรกของคุณ</h2>
1468
+ <ol>
1469
+ <li>เลือกประเภทองค์ประกอบจากแผงด้านซ้าย (ข้อความ รูปภาพ บาร์โค้ด ฯลฯ)</li>
1470
+ <li>ลากไปยังพื้นที่ทำงานแล้วปล่อย</li>
1471
+ <li>เลือกองค์ประกอบแล้วลากเพื่อเปลี่ยนตำแหน่ง</li>
1472
+ <li>ลากตัวจับที่มุมเพื่อปรับขนาด</li>
1473
+ </ol>
1474
+
1475
+ <h2>พื้นฐานการผูกข้อมูล</h2>
1476
+ <p>ใช้ไวยากรณ์วงเล็บปีกกา <code>{field.path}</code> เพื่อผูกฟิลด์ข้อมูล:</p>
1477
+ <pre><code>ผู้จัดจำหน่าย: {supplier.name}
1478
+ วันที่: {order.date}
1479
+ จำนวน: {MONEY(order.total)}
1480
+ รวม: {ROUND(qty * price, 2)}</code></pre>
1481
+ <p>ภายในวงเล็บปีกกาคุณสามารถเขียนการคำนวณ (<code>{qty * price}</code>) หรือใช้ <code>ADD</code> / <code>SUB</code> / <code>MUL</code> / <code>DIV</code>;
1482
+ หากต้องการคงจำนวนทศนิยมให้ใช้ <code>ROUND</code> (ปัดครึ่งขึ้น), <code>ROUNDUP</code> (ปัดขึ้น), <code>ROUNDDOWN</code> (ปัดลง) หรือ <code>ROUNDBANK</code> (ปัดแบบธนาคาร)</p>
1483
+ <p>ดับเบิลคลิกองค์ประกอบเพื่อเปิดตัวแก้ไขนิพจน์และกำหนดการผูกข้อมูล</p>
1484
+
1485
+ <h2>การบันทึกและตัวอย่าง</h2>
1486
+ <ul>
1487
+ <li>คลิก "บันทึก" ในแถบเครื่องมือเพื่อส่งออกเทมเพลตเป็น JSON</li>
1488
+ <li>คลิก "ตัวอย่าง" เพื่อดูผลการพิมพ์</li>
1489
+ <li>ข้อมูลเทมเพลตประกอบด้วยการตั้งค่าหน้า นิยามองค์ประกอบ และการกำหนดรูปแบบ</li>
1490
+ </ul>
1491
+
1492
+ <h2>เกี่ยวกับโปรเจกต์</h2>
1493
+ <p><strong>โปรเจกต์:</strong> worm-print-platform</p>
1494
+ <p><strong>ที่เก็บโค้ด:</strong><a href="https://gitee.com/liulong_oschina/worm-print-platform" target="_blank" rel="noopener noreferrer">https://gitee.com/liulong_oschina/worm-print-platform</a></p>
1495
+ <p>ตัวออกแบบเทมเพลตการพิมพ์แบบภาพที่ใช้ Vue 3 พร้อมการแก้ไขแบบลากและวาง การผูกข้อมูลด้วยนิพจน์ และการดูตัวอย่างการพิมพ์ในเบราว์เซอร์</p>
1496
+ `},Ap={id:"features",title:"ฟีเจอร์",content:`
1497
+ <h2>ประเภทองค์ประกอบ</h2>
1498
+ <table>
1499
+ <thead><tr><th>ประเภท</th><th>คำอธิบาย</th></tr></thead>
1500
+ <tbody>
1501
+ <tr><td>ข้อความ</td><td>ข้อความคงที่หรือไดนามิก รองรับการผูกนิพจน์</td></tr>
1502
+ <tr><td>ข้อความยาว</td><td>ข้อความหลายบรรทัดพร้อมการตัดคำอัตโนมัติ</td></tr>
1503
+ <tr><td>ตารางข้อมูล</td><td>แถวและคอลัมน์ไดนามิก รองรับการแบ่งหน้า ทำซ้ำส่วนหัว ลำดับ/รวมย่อย/สรุป</td></tr>
1504
+ <tr><td>บาร์โค้ด</td><td>รองรับ code128 และประเภทรหัสอื่นๆ อีกมากมาย</td></tr>
1505
+ <tr><td>คิวอาร์โค้ด</td><td>รองรับการแก้ไขข้อผิดพลาด L/M/Q/H; "โซนเงียบ (โมดูล)" ควบคุมขอบ (0-8, ค่าเริ่มต้น 0 = เต็ม); ใช้ 4 สำหรับโซนเงียบตามมาตรฐาน ISO</td></tr>
1506
+ <tr><td>รูปภาพ</td><td>รูปภาพคงที่หรือไดนามิก</td></tr>
1507
+ <tr><td>เส้น</td><td>เส้นแนวนอนหรือแนวตั้ง</td></tr>
1508
+ <tr><td>รูปทรง</td><td>สี่เหลี่ยมผืนผ้าและวงรีพร้อมเส้นขอบและสีพื้นหลัง</td></tr>
1509
+ <tr><td>HTML</td><td>เนื้อหา HTML ที่กำหนดเอง</td></tr>
1510
+ <tr><td>หมายเลขหน้า</td><td>การหมายเลขหน้าอัตโนมัติ</td></tr>
1511
+ <tr><td>องค์ประกอบส่วนเสริม</td><td>องค์ประกอบที่ลงทะเบียนโดยปลั๊กอินเสริม (เช่น ชุดแผนภูมิ ECharts <code>@worm-print-platform/echarts</code>): จะปรากฏในแผงทรัพยากรเมื่อลงทะเบียนแล้ว และมีแท็บ "คุณสมบัติที่กำหนดเอง" เมื่อเลือก; ข้อมูลแผนภูมิผูกด้วยนิพจน์เทมเพลตตอนพิมพ์และส่งออกเป็นเวกเตอร์</td></tr>
1512
+ </tbody>
1513
+ </table>
1514
+
1515
+ <h2>ตัวแก้ไขนิพจน์</h2>
1516
+ <h3>ไวยากรณ์พื้นฐาน</h3>
1517
+ <p>ล้อมนิพจน์ด้วยวงเล็บปีกกา <code>{}</code>; ข้อความนอกวงเล็บปีกกาเป็นตัวอักษรตามตัว</p>
1518
+
1519
+ <h3>ฟังก์ชันในตัว</h3>
1520
+ <table>
1521
+ <thead><tr><th>ฟังก์ชัน</th><th>คำอธิบาย</th><th>ตัวอย่าง</th></tr></thead>
1522
+ <tbody>
1523
+ <tr><td><code>MONEY(value)</code></td><td>จัดรูปแบบจำนวนเงิน (ตัวคั่นหลักพัน + 2 ทศนิยม)</td><td><code>{MONEY(order.total)}</code> -> "69,543.75"</td></tr>
1524
+ <tr><td><code>DATE(value, format)</code></td><td>จัดรูปแบบวันที่</td><td><code>{DATE(order.date, 'YYYY-MM-DD')}</code></td></tr>
1525
+ <tr><td><code>UPPER(value)</code></td><td>แปลงตัวเลขเป็นจำนวนเงินตัวอักษรภาษาไทย</td><td><code>{UPPER(order.total)}</code></td></tr>
1526
+ <tr><td><code>IF(cond, true, false)</code></td><td>เงื่อนไข</td><td><code>{IF(qty > 100, 'ใหญ่', 'เล็ก')}</code></td></tr>
1527
+ <tr><td><code>CONCAT(str1, str2, ...)</code></td><td>ต่อสตริง</td><td><code>{CONCAT(name, '-', spec)}</code></td></tr>
1528
+ <tr><td><code>IFEMPTY(value, default)</code></td><td>ค่าเริ่มต้นสำหรับค่าว่าง</td><td><code>{IFEMPTY(remark, 'none')}</code></td></tr>
1529
+ <tr><td><code>ROUND(num, decimals)</code></td><td>ปัดครึ่งขึ้น (ค่าเริ่มต้น 2 ทศนิยม)</td><td><code>{ROUND(price, 2)}</code></td></tr>
1530
+ <tr><td><code>ROUNDUP(n, d)</code> / <code>CEIL(n, d)</code></td><td>ปัดออกจากศูนย์</td><td><code>{ROUNDUP(price, 2)}</code></td></tr>
1531
+ <tr><td><code>ROUNDDOWN(n, d)</code> / <code>FLOOR(n, d)</code></td><td>ปัดเข้าหาศูนย์</td><td><code>{ROUNDDOWN(price, 2)}</code></td></tr>
1532
+ <tr><td><code>ROUNDBANK(n, d)</code></td><td>ปัดเศษแบบธนาคาร (GB/T 8170)</td><td><code>{ROUNDBANK(price, 2)}</code></td></tr>
1533
+ <tr><td><code>ADD(a, b, ...)</code></td><td>บวก (รับหลายค่า)</td><td><code>{ADD(qty, 1)}</code></td></tr>
1534
+ <tr><td><code>SUB(a, b, ...)</code></td><td>ลบ</td><td><code>{SUB(total, discount)}</code></td></tr>
1535
+ <tr><td><code>MUL(a, b, ...)</code></td><td>คูณ (รับหลายค่า)</td><td><code>{MUL(qty, price)}</code></td></tr>
1536
+ <tr><td><code>DIV(a, b)</code></td><td>หาร (คืน 0 เมื่อตัวหารเป็น 0)</td><td><code>{DIV(total, qty)}</code></td></tr>
1537
+ <tr><td><code>NOW()</code></td><td>วันที่ปัจจุบัน</td><td><code>{NOW()}</code></td></tr>
1538
+ <tr><td><code>SUBSTR(str, start, len)</code></td><td>สตริงย่อย</td><td><code>{SUBSTR(name, 0, 3)}</code></td></tr>
1539
+ <tr><td><code>LEN(str)</code></td><td>ความยาวสตริง</td><td><code>{LEN(name)}</code></td></tr>
1540
+ <tr><td><code>PAD(value, len, char)</code></td><td>เติมด้านซ้าย</td><td><code>{PAD(qty, 5, '0')}</code></td></tr>
1541
+ </tbody>
1542
+ </table>
1543
+
1544
+ <h3>ฟังก์ชันรวมค่า (แถวรวมย่อย/สรุปของตาราง)</h3>
1545
+ <table>
1546
+ <thead><tr><th>ฟังก์ชัน</th><th>คำอธิบาย</th></tr></thead>
1547
+ <tbody>
1548
+ <tr><td><code>SUM(field)</code></td><td>ผลรวม</td></tr>
1549
+ <tr><td><code>AVG(field)</code></td><td>ค่าเฉลี่ย</td></tr>
1550
+ <tr><td><code>COUNT(field)</code></td><td>จำนวน</td></tr>
1551
+ <tr><td><code>MIN(field)</code></td><td>ค่าต่ำสุด</td></tr>
1552
+ <tr><td><code>MAX(field)</code></td><td>ค่าสูงสุด</td></tr>
1553
+ </tbody>
1554
+ </table>
1555
+
1556
+ <h3>ตัวแปรระบบ</h3>
1557
+ <table>
1558
+ <thead><tr><th>ตัวแปร</th><th>คำอธิบาย</th></tr></thead>
1559
+ <tbody>
1560
+ <tr><td><code>pageIndex</code></td><td>หมายเลขหน้าปัจจุบัน</td></tr>
1561
+ <tr><td><code>totalPages</code></td><td>จำนวนหน้าทั้งหมด</td></tr>
1562
+ <tr><td><code>printDate</code></td><td>วันที่พิมพ์ (YYYY-MM-DD)</td></tr>
1563
+ <tr><td><code>printTime</code></td><td>เวลาพิมพ์</td></tr>
1564
+ </tbody>
1565
+ </table>
1566
+
1567
+ <h2>การกำหนดค่าตารางข้อมูล</h2>
1568
+ <h3>ประเภทแถว</h3>
1569
+ <ul>
1570
+ <li><strong>แถวหัว</strong>: ทำซ้ำได้ทุกหน้า</li>
1571
+ <li><strong>แถวข้อมูล</strong>: วนตามแหล่งข้อมูลรายการที่ผูกไว้</li>
1572
+ <li><strong>แถวรวมย่อย</strong>: แสดงยอดรวมย่อยที่ท้ายหน้าปัจจุบัน</li>
1573
+ <li><strong>แถวสรุป</strong>: แสดงเฉพาะหน้าสุดท้าย</li>
1574
+ </ul>
1575
+
1576
+ <h3>การทำงานกับตาราง</h3>
1577
+ <ul>
1578
+ <li>คลิกขวาที่เซลล์เพื่อเปิดเมนูตาราง (ตารางจะถูกเลือกอัตโนมัติ); แทรก/ลบแถวและคอลัมน์ รวม/แยกเซลล์ เปลี่ยนประเภทแถว</li>
1579
+ <li>ลากเพื่อเลือกหลายเซลล์เพื่อรวม; คลิกขวาที่เซลล์ใดก็ได้ในกลุ่มเพื่อแยก</li>
1580
+ <li>รองรับการรวม/แยกเซลล์</li>
1581
+ <li>ค่าที่ตั้งไว้ล่วงหน้าของเส้นขอบ: ทั้งหมด / ด้านนอก / ด้านใน / ไม่มี</li>
1582
+ <li>ตารางที่ไม่มีเส้นขอบจะแสดงแนวประในโหมดออกแบบ</li>
1583
+ <li><strong>ปรับขนาดคอลัมน์</strong>: เลือกองค์ประกอบตารางในแผงเลเยอร์ด้านซ้ายก่อน แล้วลากตัวแบ่งคอลัมน์บนพื้นที่ทำงาน</li>
1584
+ <li><strong>แก้ไขคุณสมบัติตาราง</strong>: ตรวจสอบว่าไม่มีเซลล์ใดถูกเลือก; คลิกพื้นที่ทำงานว่างเพื่อยกเลิกการเลือก แล้วเลือกตารางในแผงเลเยอร์</li>
1585
+ <li><strong>รูปภาพในเซลล์</strong>: หากรูปภาพย่อไม่ได้ ให้ตั้งการจัดการเป็น "ย่อ (คงอัตราส่วน)"</li>
1586
+ </ul>
1587
+
1588
+ <h2>แถบเครื่องมือจัดรูปแบบและเครื่องมือถ่ายรูปแบบ</h2>
1589
+ <h3>แถบเครื่องมือจัดรูปแบบ</h3>
1590
+ <ul>
1591
+ <li>อยู่ในแถบเครื่องมือด้านบน เปิดใช้งานเมื่อเลือกองค์ประกอบหรือเซลล์; ปุ่มที่ใช้ไม่ได้จะจางลงพร้อมเหตุผลเมื่อชี้เมาส์</li>
1592
+ <li>ตั้งค่า: ฟอนต์ ขนาด ตัวหนา/ขีดเส้นใต้/ขีดฆ่า สีข้อความ สีพื้นหลัง การจัดแนวนอนและแนวตั้ง เส้นขอบ</li>
1593
+ <li>ค่าที่ไม่สอดคล้องกันในการเลือกหลายรายการแสดง "ผสม"; การตั้งค่าใดจะทำให้ค่าทั้งหมดเหมือนกัน</li>
1594
+ <li>แผงเส้นขอบมีค่า ตั้งไว้ล่วงหน้า ทั้งหมด/ด้านนอก/ด้านใน/ไม่มี และสวิตช์แต่ละด้านพร้อมรูปแบบเส้น ความกว้าง และสี; "ด้านใน" เฉพาะเซลล์ตาราง</li>
1595
+ <li>สี่เหลี่ยมผืนผ้า วงรี และเส้นวาดด้วยเส้นขอบขององค์ประกอบ; ตารางใช้เส้นขอบของเซลล์ จึงไม่มีเส้นขอบระดับองค์ประกอบสำหรับตาราง</li>
1596
+ </ul>
1597
+ <h3>เครื่องมือถ่ายรูปแบบ</h3>
1598
+ <ul>
1599
+ <li>เลือกองค์ประกอบ<strong>เดียว</strong>เป็นต้นทางก่อน คลิกเครื่องมือถ่ายรูปแบบ (ดับเบิลคลิกสำหรับโหมดต่อเนื่อง)</li>
1600
+ <li>คลิกหรือลากเลือกองค์ประกอบปลายทางเพื่อใช้รูปแบบ; โหมดเดี่ยวจะออกหลังใช้ครั้งเดียว</li>
1601
+ <li>กด <code>Esc</code>, ยกเลิกการเลือก หรือคลิกปุ่มถ่ายรูปแบบอีกครั้งเพื่อออก</li>
1602
+ <li>กรองตามประเภทปลายทางอัตโนมัติ: รูปแบบข้อความเฉพาะองค์ประกอบข้อความ เส้นขอบเฉพาะประเภทที่รองรับ สีพื้นหลังกับทุกประเภท</li>
1603
+ <li>องค์ประกอบที่ล็อกจะไม่ถูกถ่ายรูปแบบ; องค์ประกอบต้นทางไม่ถูกเปลี่ยนแปลง</li>
1604
+ </ul>
1605
+
1606
+ <h2>การจัดตำแหน่งและการดูดติด</h2>
1607
+ <h3>การจัดตำแหน่งอัตโนมัติ</h3>
1608
+ <p>แนวชี้ตำแหน่งจะปรากฏอัตโนมัติขณะลาก:</p>
1609
+ <ul>
1610
+ <li>สีน้ำเงิน: จัดชิดซ้าย/บน</li>
1611
+ <li>สีเขียว: จัดกึ่งกลาง</li>
1612
+ <li>สีส้ม: จัดชิดขวา/ล่าง</li>
1613
+ </ul>
1614
+ <h3>การดูดติดตารางนำทาง</h3>
1615
+ <p>เมื่อเปิดใช้งาน องค์ประกอบจะดูดติดจุดตารางนำทาง</p>
1616
+ <h3>แนวนำทางที่กำหนดเอง</h3>
1617
+ <p>ลากจากพื้นที่ไม้บรรทัดเพื่อเพิ่มแนวนำทาง; แนวนำทางเข้าร่วมการดูดติดด้วย</p>
1618
+
1619
+ <h2>การจัดการเลเยอร์</h2>
1620
+ <ul>
1621
+ <li>เปลี่ยนลำดับการแสดงผล (นำไปด้านหน้าสุด / ส่งไปด้านหลังสุด / เลื่อนขึ้น / เลื่อนลง)</li>
1622
+ <li>แสดง/ซ่อนองค์ประกอบ</li>
1623
+ <li>ล็อก/ปลดล็อกองค์ประกอบ (องค์ประกอบที่ล็อกแก้ไขไม่ได้)</li>
1624
+ </ul>
1625
+
1626
+ <h3>การจัดกลุ่ม</h3>
1627
+ <p>เลือกหลายองค์ประกอบ (Ctrl/⌘+คลิก หรือลากกรอบในพื้นที่ว่าง) แล้วจัดกลุ่มผ่านแถบเครื่องมือ ปุ่มในแผงเลเยอร์ หรือ <code>Ctrl + G</code>; ยกเลิกกลุ่มด้วย <code>Ctrl + Shift + G</code> หลังจัดกลุ่ม:</p>
1628
+ <ul>
1629
+ <li>คลิกสมาชิกใดจะเลือกทั้งกลุ่ม; ลากสมาชิกใดจะย้ายทั้งกลุ่ม</li>
1630
+ <li><strong>กลุ่มถูกบังคับให้อยู่ในหน้าเดียวเมื่อพิมพ์</strong> ไม่ถูกแยกข้ามหน้า</li>
1631
+ </ul>
1632
+ <p><strong>หมายเหตุ:</strong> ความสูงรวมของสมาชิกในกลุ่มต้องไม่เกินพื้นที่เนื้อหาของหน้า มิฉะนั้นส่วนที่เกินจะถูกตัด แยกกลุ่มสูงๆ หรือยกเลิกกลุ่ม</p>
1633
+
1634
+ <h3>เมนูบริบท</h3>
1635
+ <ul>
1636
+ <li><strong>คลิกขวาที่องค์ประกอบ</strong>: คัดลอก / ตัด / วาง / ลบ / นำไปด้านหน้าสุด / เลื่อนขึ้น / เลื่อนลง / ส่งไปด้านหลังสุด หากองค์ประกอบไม่ได้อยู่ในการเลือกปัจจุบัน การเลือกจะลดเหลือเฉพาะมัน; หากอยู่ในการเลือกหลายรายการแล้วจะคงการเลือกไว้</li>
1637
+ <li><strong>คลิกขวาที่พื้นที่ว่าง</strong>: วาง / เลือกทั้งหมด / ยกเลิกการเลือก</li>
1638
+ <li>ปุ่มวางจะจางลงเมื่อไม่มีอะไรให้วาง</li>
1639
+ </ul>
1640
+
1641
+ <h2>เค้าโครงสามโซน</h2>
1642
+ <p>หนึ่งหน้ามีสามโซน:</p>
1643
+ <ul>
1644
+ <li><strong>ส่วนหัว</strong>: พื้นที่ด้านบน</li>
1645
+ <li><strong>เนื้อหา</strong>: เนื้อหาหลัก</li>
1646
+ <li><strong>ส่วนท้าย</strong>: พื้นที่ด้านล่าง</li>
1647
+ </ul>
1648
+ <p>ประเภทองค์ประกอบที่รองรับในส่วนหัว/ท้าย: ข้อความ รูปภาพ เส้น รูปทรง บาร์โค้ด คิวอาร์โค้ด</p>
1649
+
1650
+ <h2>การกำหนดค่าลายน้ำ</h2>
1651
+ <ul>
1652
+ <li>เนื้อหาลายน้ำใช้ช่องป้อนเดียวคือ "นิพจน์ลายน้ำ": ข้อความธรรมดาเป็นลายน้ำคงที่; <code>{order.no}</code>, <code>CONCAT(...)</code> ฯลฯ ถูกแยกวิเคราะห์เป็นนิพจน์</li>
1653
+ <li>คลิก "แก้ไขนิพจน์" (หรือดับเบิลคลิกช่องป้อน) เพื่อเปิดตัวแก้ไขและเลือกฟิลด์ธุรกิจและตัวแปรระบบ: วันที่พิมพ์ <code>{printDate}</code>, เวลาพิมพ์ <code>{printTime}</code>, หน้าปัจจุบัน <code>{pageIndex}</code>, จำนวนหน้า <code>{totalPages}</code>; นิพจน์ที่ล้มเหลวจะกลับไปใช้ค่าทดสอบ</li>
1654
+ <li>ตั้งมุมหมุน (-90° ถึง 90°), สี และความโปร่งใส</li>
1655
+ <li>ปรับความหนาแน่น (หนา/กลาง/บาง/ขนาดชิ้นกำหนดเอง) และสีลายน้ำ</li>
1656
+ <li>ลายน้ำแสดงผลสอดคล้องกันในพื้นที่ทำงาน ตัวอย่างเบราว์เซอร์ PDF บนเซิร์ฟเวอร์ และการพิมพ์แบบเงียบ</li>
1657
+ </ul>
1658
+ `},Mp={id:"advanced-settings",title:"การตั้งค่าขั้นสูง",content:`
1659
+ <h2>การตั้งค่าขั้นสูง</h2>
1660
+ <p>การตั้งค่าขั้นสูงควบคุมการป้องกันการแก้ไข การแสดงผลข้ามหน้า ลำดับการทับซ้อน และการลบขององค์ประกอบ การตั้งค่าเหล่านี้บันทึกในเทมเพลต แต่แต่ละตัวเลือกมีความหมายเชิงการแบ่งหน้าต่างกัน กรุณาเลือกตามบทบาทขององค์ประกอบในเค้าโครง</p>
1661
+
1662
+ <h3>ล็อก</h3>
1663
+ <ul>
1664
+ <li><strong>ผล:</strong> ป้องกันการลากหรือปรับขนาดบนพื้นที่ทำงานโดยไม่ตั้งใจ เหมาะสำหรับชื่อเรื่อง ตาราง เส้น และเครื่องหมายคงที่ที่เสร็จแล้ว</li>
1665
+ <li><strong>ผลต่อการพิมพ์:</strong> ไม่ซ่อนองค์ประกอบและไม่เปลี่ยนเนื้อหา ตำแหน่ง หรือการแบ่งหน้า</li>
1666
+ <li><strong>กรณีใช้งาน:</strong> เมื่อเค้าโครงเสร็จแล้วและต้องการปรับเฉพาะองค์ประกอบอื่น ให้ปลดล็อกก่อนจึงปรับตำแหน่งหรือขนาดได้อีกครั้ง</li>
1667
+ </ul>
1668
+
1669
+ <h3>ทำซ้ำทุกหน้า</h3>
1670
+ <ul>
1671
+ <li><strong>ผล:</strong> องค์ประกอบถูกส่งออกในทุกหน้า หน้าแรกคงตำแหน่งที่ออกแบบไว้ หน้าต่อเนื่องจะถูกจัดให้อยู่ในพื้นที่ทำซ้ำด้านบน โดยสงวนพื้นที่เนื้อหาตามความสูงขององค์ประกอบและกล่องล้อมรอบที่หมุนแล้ว</li>
1672
+ <li><strong>เหมาะสำหรับ:</strong> พื้นที่แนวนอนด้านบน เช่น ชื่อหน้า ข้อมูลการชำระเงิน ข้อมูลสัญญา และหมายเหตุ การใช้ตัวเลือกนี้กับตารางหรือรายการไดนามิกจะทำซ้ำทั้งรายการในแต่ละหน้า ไม่ใช่เฉพาะส่วนหัว</li>
1673
+ <li><strong>ไม่เหมาะสำหรับ:</strong> ไฟล์แนบด้านขวา ข้อความแนวตั้ง เครื่องหมายลอยที่ต้องคงพิกัดเดิม ใช้ "ตรึงทุกหน้า" สำหรับกรณีเหล่านั้น</li>
1674
+ <li><strong>หมายเหตุ:</strong> หน้าต่อเนื่องสงวนความสูงของพื้นที่ทำซ้ำทั้งหมดและจะไม่คืนพื้นที่เพียงเพราะองค์ประกอบอยู่ด้านขวา ไฟล์แนบแนวตั้งที่หมุนแล้วมักมีกล่องล้อมรอบสูง และอาจดันเนื้อหาไปด้านล่าง</li>
1675
+ </ul>
1676
+
1677
+ <h3>ตรึงทุกหน้า</h3>
1678
+ <ul>
1679
+ <li><strong>ผล:</strong> องค์ประกอบคงพิกัดที่ออกแบบไว้ในทุกหน้า ไม่เข้าร่วมการแบ่งหน้าเนื้อหา ไม่ใช้ความสูงเนื้อหา และไม่ถูกจัดกลุ่มเข้าพื้นที่ตามตาราง</li>
1680
+ <li><strong>เหมาะสำหรับ:</strong> ไฟล์แนบแนวตั้งด้านขวา เครื่องหมายขอบหน้าคงที่ คำแนะนำรอยต่อ ข้อความหรือกราฟิกที่ควรปรากฏตำแหน่งเดียวกันในทุกหน้า กระดาษแบบแผ่นส่งออกแต่ละหน้า กระดาษต่อเนื่องส่งออกครั้งเดียว</li>
1681
+ <li><strong>หมายเหตุตาราง:</strong> การตรึงตารางทั้งตารางจะทำซ้ำตารางทั้งหมด เมื่อรายละเอียดต้องการแบ่งหน้า ให้ตารางแบ่งหน้าตามปกติแล้วใช้ตัวเลือกแถวตาราง "ทำซ้ำส่วนหัวทุกหน้า"</li>
1682
+ </ul>
1683
+
1684
+ <h3>ลำดับชั้น (Z-Order)</h3>
1685
+ <ul>
1686
+ <li><strong>ผล:</strong> ควบคุมลำดับการทับซ้อนเมื่อองค์ประกอบทับกัน ค่าที่มากกว่าจะอยู่ด้านบน</li>
1687
+ <li><strong>กรณีใช้งาน:</strong> วางบล็อกพื้นหลังและเส้นขอบด้านล่าง ข้อความ บาร์โค้ด คิวอาร์โค้ด และลายเซ็นด้านบน</li>
1688
+ <li><strong>ผลต่อการพิมพ์:</strong> เปลี่ยนเฉพาะลำดับการแสดงผล ไม่เปลี่ยนพิกัด ลำดับการแบ่งหน้า หรือพื้นที่เนื้อหา</li>
1689
+ </ul>
1690
+
1691
+ <h3>ลบองค์ประกอบ</h3>
1692
+ <ul>
1693
+ <li><strong>ผล:</strong> ลบองค์ประกอบที่เลือกออกจากเทมเพลตปัจจุบัน</li>
1694
+ <li><strong>การกู้คืน:</strong> ใช้ "เลิกทำ" ในแถบเครื่องมือทันทีหลังลบโดยไม่ตั้งใจ หรือก่อนบันทึกให้ปิดโดยไม่บันทึกเพื่อยกเลิกการเปลี่ยนแปลง</li>
1695
+ </ul>
1696
+
1697
+ <h3>กฎและคำแนะนำการผสมผสาน</h3>
1698
+ <ul>
1699
+ <li><strong>ตรึง + ทำซ้ำ:</strong> เมื่อเปิดทั้งสอง "ตรึงทุกหน้า" จะมีผลเหนือกว่า และองค์ประกอบถูกส่งออกที่พิกัดเดิมในทุกหน้า</li>
1700
+ <li><strong>ทำซ้ำ + ไม่เข้าร่วมการแบ่งหน้า:</strong> การทำซ้ำจัดการในพื้นที่ทำซ้ำแยกก่อน "ไม่เข้าร่วมการแบ่งหน้า" ไม่สามารถหยุดหน้าต่อเนื่องจากการสงวนพื้นที่ได้</li>
1701
+ <li><strong>ไม่เข้าร่วมการแบ่งหน้าเพียงอย่างเดียว:</strong> องค์ประกอบวางที่พิกัดที่ออกแบบเฉพาะหน้าแรก และไม่เข้าร่วมการแบ่งหน้าถัดไป ไม่ใช่สวิตช์ทุกหน้า</li>
1702
+ <li><strong>ไฟล์แนบด้านขวาบนใบแจ้งชำระ:</strong> แนะนำเปิด "ตรึงทุกหน้า" ปิด "ทำซ้ำทุกหน้า" และปิด "เข้าร่วมการแบ่งหน้า" ตำแหน่งคงที่และรายละเอียดการชำระไม่ถูกบีบ</li>
1703
+ <li><strong>ไฟล์แนบด้านขวาเฉพาะหน้าแรก:</strong> ปิดทั้ง "ตรึงทุกหน้า" และ "ทำซ้ำทุกหน้า" และปิด "เข้าร่วมการแบ่งหน้า" ด้วย</li>
1704
+ </ul>
1705
+ `},_p={id:"shortcuts",title:"แป้นพิมพ์ลัด",content:`
1706
+ <h2>การทำงานทั่วไป</h2>
1707
+ <table>
1708
+ <thead><tr><th>แป้นพิมพ์ลัด</th><th>การทำงาน</th></tr></thead>
1709
+ <tbody>
1710
+ <tr><td><code>Ctrl + Z</code> / <code>⌘ + Z</code></td><td>เลิกทำ</td></tr>
1711
+ <tr><td><code>Ctrl + Shift + Z</code> / <code>⌘ + Shift + Z</code></td><td>ทำซ้ำ</td></tr>
1712
+ <tr><td><code>Ctrl + C</code> / <code>⌘ + C</code></td><td>คัดลอกองค์ประกอบที่เลือก</td></tr>
1713
+ <tr><td><code>Ctrl + V</code> / <code>⌘ + V</code></td><td>วาง</td></tr>
1714
+ <tr><td><code>Delete</code> / <code>Backspace</code></td><td>ลบองค์ประกอบที่เลือก</td></tr>
1715
+ <tr><td><code>Ctrl + A</code> / <code>⌘ + A</code></td><td>เลือกทั้งหมด</td></tr>
1716
+ <tr><td><code>Ctrl + G</code> / <code>⌘ + G</code></td><td>จัดกลุ่มองค์ประกอบที่เลือก</td></tr>
1717
+ <tr><td><code>Ctrl + Shift + G</code> / <code>⌘ + Shift + G</code></td><td>ยกเลิกจัดกลุ่ม</td></tr>
1718
+ <tr><td><code>Arrow keys</code></td><td>เลื่อนองค์ประกอบที่เลือกทีละนิด (ค้าง Shift เพื่อระยะใหญ่ขึ้น)</td></tr>
1719
+ <tr><td><code>Esc</code></td><td>ยกเลิกการเลือก / ออกจากกล่องโต้ตอบหรือโหมดถ่ายรูปแบบ</td></tr>
1720
+ <tr><td><code>Space + drag</code></td><td>เลื่อนมุมมองพื้นที่ทำงาน</td></tr>
1721
+ <tr><td><code>Ctrl + scroll</code> / <code>⌘ + scroll</code></td><td>ซูมพื้นที่ทำงาน</td></tr>
1722
+ </tbody>
1723
+ </table>
1724
+
1725
+ <h2>ตัวแก้ไขนิพจน์</h2>
1726
+ <ul>
1727
+ <li>ดับเบิลคลิกฟิลด์ ตัวแปร หรือฟังก์ชันในรายการด้านซ้ายเพื่อแทรกลงในนิพจน์</li>
1728
+ <li>ค้าง <code>Ctrl</code> (<code>⌘</code> บน Mac) ขณะดับเบิลคลิกเพื่อแทรกชื่อฟิลด์แทน</li>
1729
+ <li>ใช้วงเล็บปีกกา <code>{}</code> สำหรับนิพจน์ฟิลด์ ข้อความคงที่พิมพ์ได้โดยตรง</li>
1730
+ </ul>
1731
+ `},Rp={id:"faq",title:"คำถามที่พบบ่อย",content:`
1732
+ <h2>ฉันจะปรับขนาดกระดาษอย่างไร?</h2>
1733
+ <ol>
1734
+ <li>เลือก "การตั้งค่าหน้ากระดาษ" ในแผงด้านขวา</li>
1735
+ <li>เลือกขนาดกระดาษที่ตั้งไว้จากเมนู "ขนาดกระดาษ"</li>
1736
+ <li>หรือเลือก "ขนาดกำหนดเอง" แล้วป้อนความกว้างและความสูง</li>
1737
+ </ol>
1738
+
1739
+ <h2>เหตุใดนิพจน์ของฉันจึงไม่คำนวณ?</h2>
1740
+ <p>นิพจน์ต้องอยู่ในวงเล็บปีกกา <code>{}</code> ตรวจสอบว่าสะกดชื่อฟิลด์ถูกต้องและฟังก์ชันใช้พารามิเตอร์ที่ถูกต้อง ดับเบิลคลิกองค์ประกอบเพื่อเปิดตัวแก้ไขนิพจน์และดูตัวอย่างผลลัพธ์</p>
1741
+
1742
+ <h2>เหตุใดเนื้อหาจึงถูกตัดเมื่อพิมพ์?</h2>
1743
+ <p>เนื้อหาที่เกินพื้นที่พิมพ์ (ภายในระยะขอบ) จะถูกตัด ลดขนาดองค์ประกอบ ปรับตำแหน่ง หรือเปลี่ยนเป็นแนวนอน กล่องบันทึกจะแจ้งเตือนการตัดโดยประมาณ</p>
1744
+
1745
+ <h2>ฉันจะทำซ้ำส่วนหัวตารางในทุกหน้าอย่างไร?</h2>
1746
+ <p>ในการตั้งค่าแถวตาราง ให้ตั้งแถวหัวเป็นทำซ้ำ และตรวจสอบว่าตารางเข้าร่วมการแบ่งหน้าปกติ การเปิด "ตรึงทุกหน้า" บนตารางทั้งตารางจะทำซ้ำตารางทั้งหมดแทน</p>
1747
+
1748
+ <h2>ฉันจะผูกข้อมูลไดนามิกกับองค์ประกอบอย่างไร?</h2>
1749
+ <p>ใช้ไวยากรณ์ <code>{field.path}</code> ในองค์ประกอบข้อความ หรือดับเบิลคลิกองค์ประกอบเพื่อเปิดตัวแก้ไขนิพจน์และเลือกฟิลด์จากรายการด้านซ้าย ฟิลด์มาจากข้อมูลที่คุณส่งตอนพิมพ์</p>
1750
+
1751
+ <h2>เหตุใดฉันจึงลากขอบคอลัมน์เพื่อปรับขนาดไม่ได้?</h2>
1752
+ <p>ก่อนอื่นให้เลือกองค์ประกอบตารางในแผงเลเยอร์ด้านซ้าย แล้วลากตัวแบ่งคอลัมน์บนพื้นที่ทำงาน ตรวจสอบว่าไม่มีเซลล์ใดถูกเลือก</p>
1753
+
1754
+ <h2>ฉันจะเพิ่มลายน้ำอย่างไร?</h2>
1755
+ <p>เปิดใช้งานตัวเลือก ลายน้ำ ในการตั้งค่าหน้ากระดาษ ป้อนข้อความหรือนิพจน์ลายน้ำ แล้วปรับการหมุน สี ความโปร่งใส และความหนาแน่น ลายน้ำแสดงผลสอดคล้องกันในพื้นที่ทำงาน ตัวอย่างเบราว์เซอร์ PDF บนเซิร์ฟเวอร์ และการพิมพ์แบบเงียบ</p>
1756
+
1757
+ <h2>ฉันสามารถใช้แผนภูมิและองค์ประกอบกำหนดเองอื่นได้หรือไม่?</h2>
1758
+ <p>ได้ ปลั๊กอินเสริมเช่นชุดแผนภูมิ ECharts จะลงทะเบียนประเภทองค์ประกอบเพิ่มเติม เมื่อติดตั้งแล้วจะปรากฏในแผงทรัพยากรและมีแท็บ "คุณสมบัติที่กำหนดเอง" เมื่อเลือก</p>
1759
+ `},Fp={id:"changelog",title:"บันทึกการเปิดตัว",content:`
1760
+ <h2>V1.6.1<small>(2026-11-22)</small></h2>
1761
+
1762
+ <h3>เพิ่ม</h3>
1763
+ <ul>
1764
+ <li><strong>ชุดภาษาที่กำหนดเอง</strong>: รองรับการแทนที่ข้อความของตัวออกแบบด้วยชุดภาษาที่กำหนดเอง พร้อมเครื่องมือ CLI สำหรับส่งออกโครงสร้าง ตรวจสอบคำแปล และอัปเดตแบบเพิ่มเติม</li>
1765
+ </ul>
1766
+
1767
+ <h3>แก้ไข</h3>
1768
+ <ul>
1769
+ <li><strong>รายละเอียดการเรนเดอร์และตัวออกแบบ</strong>: แก้ไข barcode แบบจุด การหมุนทั้งหน้า ลายน้ำ ขอบรูป และจุดครอป ทำให้การค้นหาคุณสมบัติและตารางเสถียรขึ้น</li>
1770
+ </ul>
1771
+
1772
+ <h2>V1.6.0<small>(2026-11-19)</small></h2>
1773
+ <h3>เพิ่ม</h3>
1774
+ <ul>
1775
+ <li><strong>การแสดงผลฟิลด์ที่กำหนดได้โดยโฮสต์</strong>: แอตทริบิวต์ใหม่ <code>field-display</code> (พร็อพเพอร์ตี <code>fieldDisplay</code>) พร้อมโหมดเฉพาะป้ายชื่อ เฉพาะคีย์ หรือทั้งสองอย่าง (ค่าเริ่มต้นทั้งสอง) รูปแบบเฉพาะคีย์ตรงกับรูปแบบป้ายชื่อ ชื่อกลุ่มแสดงเสมอ ความหมายของการค้นหา/คัดลอก/แทรกไม่เปลี่ยนแปลง</li>
1776
+ </ul>
1777
+ <h3>แก้ไข</h3>
1778
+ <ul>
1779
+ <li><strong>ตำแหน่งป้ายข้อมูลแผนภูมิ</strong>: แผงเขียน <code>offset: [x, y]</code> แบบดั้งเดิมของ ECharts แล้ว; <code>offsetX</code>/<code>offsetY</code> แบบเดิมถูกย้ายข้อมูลตอนอ่าน เขียน และแสดงผล</li>
1780
+ </ul>
1781
+
1782
+ <h2>V1.5.3<small>(2026-11-18)</small></h2>
1783
+ <h3>แก้ไข</h3>
1784
+ <ul>
1785
+ <li>แก้ไขความเสถียรและการแสดงผลต่างๆ</li>
1786
+ </ul>
1787
+
1788
+ <h2>V1.5.2<small>(2026-11-17)</small></h2>
1789
+ <h3>เพิ่ม</h3>
1790
+ <ul>
1791
+ <li>ปรับปรุงปลั๊กอินตัวอย่างข้อมูลและการจัดการนิพจน์</li>
1792
+ </ul>
1793
+
1794
+ <h2>V1.5.1<small>(2026-11-16)</small></h2>
1795
+ <h3>แก้ไข</h3>
1796
+ <ul>
1797
+ <li>แก้ไขเล็กน้อยเกี่ยวกับพฤติกรรมองค์ประกอบและผลการพิมพ์</li>
1798
+ </ul>
1799
+
1800
+ <h2>V1.5.0<small>(2026-11-16)</small></h2>
1801
+ <h3>เพิ่ม</h3>
1802
+ <ul>
1803
+ <li>ความสามารถใหม่สำหรับการจัดวางองค์ประกอบและการแบ่งหน้า</li>
1804
+ </ul>
1805
+
1806
+ <h2>V1.4.8<small>(2026-11-11)</small></h2>
1807
+ <h3>แก้ไข</h3>
1808
+ <ul>
1809
+ <li>แก้ไขกรณีพิเศษของตารางและการแบ่งหน้า</li>
1810
+ </ul>
1811
+
1812
+ <h2>V1.4.7<small>(2026-11-09)</small></h2>
1813
+ <h3>เพิ่ม / แก้ไข</h3>
1814
+ <ul>
1815
+ <li>ปรับความแม่นยำของคำเตือนเกี่ยวกับรูปทรงและแก้ไขต่างๆ</li>
1816
+ </ul>
1817
+
1818
+ <h2>V1.4.6<small>(2026-11-05)</small></h2>
1819
+ <h3>แก้ไข</h3>
1820
+ <ul>
1821
+ <li>แก้ไขการหมุนและการปรับข้อความให้พอดี</li>
1822
+ </ul>
1823
+
1824
+ <h2>V1.4.5<small>(2026-11-04)</small></h2>
1825
+ <h3>แก้ไข</h3>
1826
+ <ul>
1827
+ <li>แก้ไขเส้นขอบตารางและแผงคุณสมบัติ</li>
1828
+ </ul>
1829
+
1830
+ <h2>V1.4.4<small>(2026-11-04)</small></h2>
1831
+ <h3>เพิ่ม</h3>
1832
+ <ul>
1833
+ <li>ปรับปรุงป้ายแผนภูมิและอินเทอร์เฟซปลั๊กอิน</li>
1834
+ </ul>
1835
+
1836
+ <h2>V1.4.3<small>(2026-11-01)</small></h2>
1837
+ <h3>แก้ไข</h3>
1838
+ <ul>
1839
+ <li>แก้ไขการคำนวณนิพจน์และตัวอย่าง</li>
1840
+ </ul>
1841
+
1842
+ <h2>V1.4.2<small>(2026-10-30)</small></h2>
1843
+ <h3>เพิ่ม</h3>
1844
+ <ul>
1845
+ <li>เพิ่มเติมตลาดปลั๊กอินและความสามารถขององค์ประกอบ</li>
1846
+ </ul>
1847
+
1848
+ <h2>V1.4.1<small>(2026-10-28)</small></h2>
1849
+ <h3>แก้ไข</h3>
1850
+ <ul>
1851
+ <li>แก้ไขความเสถียรเล็กน้อย</li>
1852
+ </ul>
1853
+
1854
+ <h2>V1.4.0<small>(2026-10-28)</small></h2>
1855
+ <h3>เพิ่ม</h3>
1856
+ <ul>
1857
+ <li>เปิดตัวฟีเจอร์ใหญ่พร้อมความสามารถใหม่ของตัวออกแบบ</li>
1858
+ </ul>
1859
+
1860
+ <h2>V1.3.11<small>(2026-10-26)</small></h2>
1861
+ <h3>แก้ไข</h3>
1862
+ <ul>
1863
+ <li>แก้ไขกระดาษต่อเนื่องและการจัดเรียงชิ้น</li>
1864
+ </ul>
1865
+
1866
+ <h2>V1.3.10<small>(2026-10-24)</small></h2>
1867
+ <h3>เพิ่ม / แก้ไข</h3>
1868
+ <ul>
1869
+ <li>ปรับปรุงการแบ่งหน้าและแก้ไขต่างๆ</li>
1870
+ </ul>
1871
+
1872
+ <h2>V1.3.9<small>(2026-10-22)</small></h2>
1873
+ <h3>แก้ไข</h3>
1874
+ <ul>
1875
+ <li>แก้ไขการจัดวางแบบไหลและการแสดงผล</li>
1876
+ </ul>
1877
+
1878
+ <h2>V1.3.8<small>(2026-10-22)</small></h2>
1879
+ <h3>แก้ไข</h3>
1880
+ <ul>
1881
+ <li>แก้ไขเล็กน้อยเกี่ยวกับการแสดงผลขององค์ประกอบ</li>
1882
+ </ul>
1883
+
1884
+ <h2>V1.3.7<small>(2026-10-19)</small></h2>
1885
+ <h3>เพิ่ม</h3>
1886
+ <ul>
1887
+ <li>ปรับปรุงพื้นหลังออกแบบและลายน้ำ</li>
1888
+ </ul>
1889
+
1890
+ <h2>V1.3.6<small>(2026-10-16)</small></h2>
1891
+ <h3>แก้ไข</h3>
1892
+ <ul>
1893
+ <li>แก้ไขจุดยึดการครอปและการจัดการรูปภาพ</li>
1894
+ </ul>
1895
+
1896
+ <h2>V1.3.5<small>(2026-10-05)</small></h2>
1897
+ <h3>แก้ไข</h3>
1898
+ <ul>
1899
+ <li>แก้ไขเล็กน้อยที่แผงคุณสมบัติ</li>
1900
+ </ul>
1901
+
1902
+ <h2>V1.3.4<small>(2026-09-27)</small></h2>
1903
+ <h3>เพิ่ม</h3>
1904
+ <ul>
1905
+ <li>ตัวเลือกใหม่สำหรับการจัดรูปแบบองค์ประกอบ</li>
1906
+ </ul>
1907
+
1908
+ <h2>V1.3.3<small>(2026-09-27)</small></h2>
1909
+ <h3>แก้ไข</h3>
1910
+ <ul>
1911
+ <li>แก้ไขการผูกข้อมูลและนิพจน์</li>
1912
+ </ul>
1913
+
1914
+ <h2>V1.3.2<small>(2026-09-26)</small></h2>
1915
+ <h3>แก้ไข</h3>
1916
+ <ul>
1917
+ <li>แก้ไขความเสถียรเล็กน้อย</li>
1918
+ </ul>
1919
+
1920
+ <h2>V1.3.1<small>(2026-09-21)</small></h2>
1921
+ <h3>เพิ่ม</h3>
1922
+ <ul>
1923
+ <li>ปรับปรุงแถบเครื่องมือและแผงต่างๆ</li>
1924
+ </ul>
1925
+
1926
+ <h2>V1.3.0<small>(2026-09-20)</small></h2>
1927
+ <h3>เพิ่ม</h3>
1928
+ <ul>
1929
+ <li>เปิดตัวใหญ่พร้อมการปรับปรุงสถาปัตยกรรมปลั๊กอิน</li>
1930
+ </ul>
1931
+
1932
+ <h2>V1.2.2<small>(2026-09-11)</small></h2>
1933
+ <h3>แก้ไข</h3>
1934
+ <ul>
1935
+ <li>แก้ไขการพิมพ์และตัวอย่าง</li>
1936
+ </ul>
1937
+
1938
+ <h2>V1.2.1<small>(2026-09-11)</small></h2>
1939
+ <h3>แก้ไข</h3>
1940
+ <ul>
1941
+ <li>แก้ไขเล็กน้อย</li>
1942
+ </ul>
1943
+
1944
+ <h2>V1.2.0<small>(2026-09-10)</small></h2>
1945
+ <h3>เพิ่ม</h3>
1946
+ <ul>
1947
+ <li>ฟีเจอร์ใหม่ของไปป์ไลน์การแสดงผล</li>
1948
+ </ul>
1949
+
1950
+ <h2>V1.1.0<small>(2026-09-06)</small></h2>
1951
+ <h3>เพิ่ม</h3>
1952
+ <ul>
1953
+ <li>ประเภทองค์ประกอบและฟีเจอร์ตัวออกแบบเพิ่มเติม</li>
1954
+ </ul>
1955
+
1956
+ <h2>V1.0.0<small>(2026-09-02)</small></h2>
1957
+ <h3>เพิ่ม</h3>
1958
+ <ul>
1959
+ <li>เปิดตัวครั้งแรกของตัวออกแบบเทมเพลตการพิมพ์</li>
1960
+ </ul>
1961
+ `},Ip=[mp,bp,yp,vp,xp,wp],Lp=[kp,Ep,Sp,Tp,Cp,Dp],zp=[Pp,Ap,Mp,_p,Rp,Fp];function Op(e){return e&&/^th([-_]|$)/i.test(e)?zp:e&&/^en([-_]|$)/i.test(e)?Lp:Ip}const ea="worm-print-help-tab",Np="getting-started";function Ji(e,t){return e.some(o=>o.id===t)?String(t):""}function Bp(e,t){let o=null;try{o=window.localStorage.getItem(ea)}catch{o=null}return Ji(e,t)||Ji(e,o)||Np}function Up(e){const t=Op(e.locale),o=e.t??we.createTranslator(e.locale??"zh-CN"),r=Bp(t,e.initialTab),i=(n,s)=>{const d=n.currentTarget,c=d.closest(".help-modal");if(!c)return;for(const f of Array.from(c.querySelectorAll(".help-tab")))f.classList.toggle("active",f===d);const u=c.querySelector(".help-content");u&&(u.innerHTML=t.find(f=>f.id===s)?.content??"");try{window.localStorage.setItem(ea,s)}catch{}};return l("div",{class:"help-modal-overlay",tabindex:"-1",onClick:n=>{n.target===n.currentTarget&&e.onClose()},onKeydown:n=>{n.key==="Escape"&&e.onClose()}},[l("div",{class:"help-modal"},[l("div",{class:"help-modal-header"},[l("div",{class:"help-modal-title-wrap"},[l("h2",{class:"help-modal-title",text:o("helpModal.k101")}),l("span",{class:"help-modal-project",text:"worm-print-platform"})]),l("button",{type:"button",class:"help-modal-close",title:o("helpModal.k102"),text:"×",onClick:()=>e.onClose()})]),l("div",{class:"help-modal-body"},[l("div",{class:"help-modal-sidebar"},t.map(n=>l("button",{type:"button",class:`help-tab${n.id===r?" active":""}`,text:n.title,onClick:s=>i(s,n.id)}))),l("div",{class:"help-modal-content"},[l("div",{class:"help-content",html:t.find(n=>n.id===r)?.content??""})])])])])}function Hp(e,t){const o=Se(Up(t),e),r=i=>{i.key==="Escape"&&t.onClose()};return document.addEventListener("keydown",r),o.focus?.(),()=>{document.removeEventListener("keydown",r),o.remove()}}const $p=2,Wp=74,Cr=[{id:"clipboard",order:1,labelKey:"toolbarOverflow.k478"},{id:"painter",order:2,labelKey:"toolbarOverflow.k479"},{id:"zoom",order:3,labelKey:"toolbarOverflow.k480"},{id:"arrange-view",order:4,labelKey:"toolbarOverflow.k481"},{id:"border",order:5,labelKey:"toolbarOverflow.k482"},{id:"color",order:6,labelKey:"toolbarOverflow.k483"},{id:"align",order:7,labelKey:"toolbarOverflow.k484"},{id:"style",order:8,labelKey:"toolbarOverflow.k485"},{id:"font",order:9,labelKey:"toolbarOverflow.k486"}];function Kp(e){const t=!!e.state.openMore,o=Cr.slice().sort((r,i)=>r.order-i.order).map(r=>l("div",{class:"tb-more-item",dataset:{unit:r.id},style:{display:"none"}},[l("div",{class:"tb-menu-label",text:a(e,r.labelKey)}),l("div",{class:"tb-more-slot",id:`tb-more-slot-${r.id}`,dataset:{unit:r.id}})]));return l("div",{class:"tb-group tb-more-group",style:{display:"none"}},[l("div",{class:"tb-dd"},[l("button",{type:"button",class:`tb-dd-trigger${t?" on":""}`,dataset:{test:"more-dd",tip:a(e,"toolbarOverflow.k487")},onClick:()=>{e.state.openMore=!t,e.repaint()},html:a(e,"toolbarOverflow.k488",{v0:ge("Ellipsis",15),v1:ge("ChevronDown",12,"tb-dd-arrow")})}),l("div",{class:`tb-dd-panel tb-more-panel${t?"":" is-hidden"}`},[l("div",{class:"tb-menu tb-more-menu"},o)])])])}const en=new WeakMap;function tn(e){const t=e.querySelector(".designer-toolbar");if(!t)return{movedIds:[],overflowRemains:!1};const o=getComputedStyle(t),r=Number.parseFloat(o.gap)||$p,i=Number.parseFloat(o.paddingLeft)||0,n=Number.parseFloat(o.paddingRight)||0,s=new Map;for(const C of Array.from(t.querySelectorAll(".tb-ou[data-unit]"))){const D=C.parentElement;D&&!D.classList.contains("tb-more-slot")&&en.set(C,{parent:D,next:C.nextSibling}),s.set(C.dataset.unit,C)}for(const C of s.values()){const D=en.get(C);!D||C.parentElement===D.parent||(D.next?.parentElement===D.parent?D.parent.insertBefore(C,D.next):D.parent.appendChild(C))}let d=0;for(const C of Array.from(t.children)){if(C.classList.contains("tb-spacer")||C.classList.contains("tb-more-group"))continue;const D=Math.max(C.offsetWidth,C.scrollWidth);D<=0||(d+=D+r)}const c=new Map;for(const[C,D]of s){const S=D.offsetWidth;S>0&&c.set(C,S)}const u=Cr.map(C=>({id:C.id,order:C.order,width:c.get(C.id)??0})),f=u.reduce((C,D)=>C-D.width-r,d),b=t.clientWidth-i-n,{movedIds:m,overflowRemains:E}=h.resolveToolbarOverflow({available:b,pinned:f,moreTriggerWidth:Wp,gap:r,units:u});for(const C of Cr){const D=t.querySelector(`.tb-more-item[data-unit="${C.id}"]`),S=t.querySelector(`#tb-more-slot-${C.id}`),_=s.get(C.id);if(!D||!S||!_)continue;const z=m.includes(C.id);z&&_.parentElement!==S&&S.appendChild(_),D.style.display=z?"":"none"}const y=t.querySelector(".tb-more-group");return y&&(y.style.display=m.length>0?"":"none"),t.classList.toggle("is-tight",E),{movedIds:m,overflowRemains:E}}function Vp(e,t){const o=e.store,r=o.selectedIds.size>0,i=o.selectedIds.size>1,n=o.selectedElement,s=!r,d=e.isEdit?a(e,"toolbar.k489"):a(e,"toolbar.k490"),c=[l("div",{class:"tb-menu",dataset:{test:"arrange-panel"}},[l("div",{class:"tb-menu-label",text:a(e,"toolbar.k491")}),l("div",{class:"tb-menu-grid"},[ne(e,"AlignStartVertical","align",{arg:"left",tip:a(e,"toolbar.k492"),disabled:!i}),ne(e,"AlignEndVertical","align",{arg:"right",tip:a(e,"toolbar.k493"),disabled:!i}),ne(e,"AlignStartHorizontal","align",{arg:"top",tip:a(e,"toolbar.k494"),disabled:!i}),ne(e,"AlignEndHorizontal","align",{arg:"bottom",tip:a(e,"toolbar.k495"),disabled:!i}),ne(e,"AlignCenterVertical","align",{arg:"vertical",tip:a(e,"toolbar.k496"),disabled:!i}),ne(e,"AlignCenterHorizontal","align",{arg:"horizontal",tip:a(e,"toolbar.k497"),disabled:!i}),ne(e,"AlignHorizontalSpaceBetween","align",{arg:"distributeHor",tip:a(e,"toolbar.k498"),disabled:!i}),ne(e,"AlignVerticalSpaceBetween","align",{arg:"distributeVer",tip:a(e,"toolbar.k499"),disabled:!i})]),l("div",{class:"tb-menu-label",text:a(e,"toolbar.k500")}),l("div",{class:"tb-menu-grid"},[ne(e,"ArrowUpToLine","move-layer",{arg:"top",tip:a(e,"toolbar.k501"),disabled:!r}),ne(e,"ArrowUp","move-layer",{arg:"up",tip:a(e,"toolbar.k502"),disabled:!r}),ne(e,"ArrowDown","move-layer",{arg:"down",tip:a(e,"toolbar.k503"),disabled:!r}),ne(e,"ArrowDownToLine","move-layer",{arg:"bottom",tip:a(e,"toolbar.k504"),disabled:!r})]),l("div",{class:"tb-menu-label",text:a(e,"toolbar.k505")}),l("div",{class:"tb-menu-grid"},[ne(e,"Group","group",{tip:a(e,"toolbar.k506"),disabled:!i}),ne(e,"Ungroup","ungroup",{tip:a(e,"toolbar.k507"),disabled:!n?.options?.groupId})])])],u=[l("div",{class:"tb-menu tb-menu-rows",dataset:{test:"view-panel"}},[f(a(e,"toolbar.k508"),o.showRuler,"toggle-ruler",a(e,"toolbar.k509")),f(a(e,"toolbar.k510"),o.showGrid,"toggle-grid",a(e,"toolbar.k511")),f(a(e,"toolbar.k512"),o.showTableGhostBorder,"toggle-table-ghost-border",a(e,"toolbar.k513")),f(a(e,"toolbar.k514"),o.snapToGrid,"toggle-snap",a(e,"toolbar.k515"))])];function f(b,m,E,y){return l("button",{type:"button",class:`tb-btn tb-menu-row${m?" on":""}`,dataset:{tip:y},onClick:()=>e.fire(E)},[l("span",{class:"dot"}),b])}return l("div",{class:"designer-toolbar"},[l("div",{class:"tb-group tb-brand"},[l("span",{class:"tb-mark","aria-hidden":"true",html:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="3" width="14" height="18" rx="2.5" /><line x1="8.5" y1="8.5" x2="15.5" y2="8.5" /><line x1="8.5" y1="12.5" x2="15.5" y2="12.5" /><line x1="8.5" y1="16.5" x2="12.5" y2="16.5" /></svg>'}),l("div",{class:"tb-title"},[l("span",{class:"tb-title-name",text:d}),l("span",{class:"tb-title-sub",text:a(e,"toolbar.k516")})])]),l("div",{class:"tb-group"},[ne(e,"Undo2","undo",{tip:a(e,"toolbar.k517"),disabled:!o.canUndo}),ne(e,"Redo2","redo",{tip:a(e,"toolbar.k518"),disabled:!o.canRedo})]),t,l("div",{class:"tb-ou tb-group",dataset:{unit:"arrange-view"}},[fo(e,"arrange",{icon:"Layers",text:a(e,"toolbar.k519"),tip:a(e,"toolbar.k520"),testId:"arrange-dd"},c),fo(e,"view",{icon:"Eye",text:a(e,"toolbar.k521"),tip:a(e,"toolbar.k522"),testId:"view-dd"},u)]),l("div",{class:"tb-ou tb-group",dataset:{unit:"zoom"}},[ne(e,"Maximize","fit-window",{tip:a(e,"toolbar.k523")}),ne(e,"ZoomOut","zoom",{arg:-10,tip:a(e,"toolbar.k524")}),l("span",{class:"tb-zoom",text:`${o.scale}%`}),ne(e,"ZoomIn","zoom",{arg:10,tip:a(e,"toolbar.k525")})]),l("div",{class:"tb-ou tb-group",dataset:{unit:"clipboard"}},[ne(e,"Copy","copy",{tip:s?a(e,"toolbar.k526"):a(e,"toolbar.k527"),disabled:s,test:"copy"}),ne(e,"ClipboardPaste","paste",{tip:s?a(e,"toolbar.k528"):o.hasClipboard?a(e,"toolbar.k530"):a(e,"toolbar.k529"),disabled:s||!o.hasClipboard,test:"paste"}),ne(e,"Trash2","delete",{tip:s?a(e,"toolbar.k531"):a(e,"toolbar.k532"),disabled:s,danger:!0,test:"delete"})]),Kp(e),l("div",{class:"tb-spacer"}),e.showHelp?l("div",{class:"tb-group"},[l("button",{type:"button",class:"help-button",title:a(e,"toolbar.k533"),onClick:()=>e.fire("help")},[l("span",{class:"help-icon",text:"?"})])]):"",(()=>{const b=[e.showPreview!==!1?l("button",{type:"button",class:"btn-secondary",dataset:{tip:a(e,"toolbar.k534")},text:a(e,"toolbar.k535"),onClick:()=>e.fire("preview")}):"",e.showSave!==!1?l("button",{type:"button",class:"btn-primary",dataset:{tip:a(e,"toolbar.k536")},text:a(e,"toolbar.k537"),onClick:()=>e.fire("save")}):""].filter(Boolean);return b.length?l("div",{class:"tb-group"},b):""})()].filter(Boolean))}function ur(e,t,o){for(const r of t){const i=e.getPropertyValue(r).trim();if(i)return i}return o}function Gp(e,t){const o=t.orientation==="horizontal",r=t.geom,i=o?r.viewW:r.viewH;e.style.width=`${o?i:h.RULER_THICKNESS}px`,e.style.height=`${o?h.RULER_THICKNESS:i}px`;const n=e.getContext("2d");if(!n)return;const s=window.devicePixelRatio||1,d=Math.max(0,Math.round(i)),c=h.RULER_THICKNESS;e.width=(o?d:c)*s,e.height=(o?c:d)*s,n.setTransform(s,0,0,s,0,0);const u=getComputedStyle(e),f=ur(u,["--pd-ruler-bg"],"#F8F9FC"),b=ur(u,["--pd-ruler"],"#9AA1AF"),m=ur(u,["--pd-ruler-cursor","--pd-accent"],"#165DFF");n.fillStyle=f,n.fillRect(0,0,o?d:c,o?c:d);const E=t.scale>0?t.scale:r.paperScale>0?r.paperScale:1,y=h.mmToPx(1)*E;if(y<=0)return;const C={ctx:n,horizontal:o,viewportPx:i,thickness:c,originPx:o?r.originX:r.originY,pxPerMM:y,paperLengthMM:t.paperLengthMM},D=-C.originPx/y,S=(d-C.originPx)/y,_=h.chooseMajorStepMM(E),z=h.buildRulerTicks(D,S,_);on(C,z,b,!0),on(C,z,b,!1),rn(C,0,m),rn(C,t.paperLengthMM,m);const A=t.cursorPx??null;if(A!==null&&A>=0&&A<=d){if(n.strokeStyle=m,n.lineWidth=1.5,n.beginPath(),o){const I=Math.round(A)+.5;n.moveTo(I,0),n.lineTo(I,c)}else{const I=Math.round(A)+.5;n.moveTo(0,I),n.lineTo(c,I)}n.stroke()}}function ta(e,t){return Math.round(e.originPx+t*e.pxPerMM)+.5}function on(e,t,o,r){const{ctx:i,horizontal:n,paperLengthMM:s}=e;i.strokeStyle=o,i.fillStyle=o,i.globalAlpha=r?.32:1,i.lineWidth=1,i.font="9px ui-monospace, Menlo, monospace",i.textBaseline="top";for(const d of t){if((d.mm<0||d.mm>s)!==r)continue;const u=ta(e,d.mm),f=d.major?8:4;i.beginPath(),n?(i.moveTo(u,0),i.lineTo(u,f)):(i.moveTo(0,u),i.lineTo(f,u)),i.stroke(),d.major&&d.label&&(n?i.fillText(d.label,u+2,11):(i.save(),i.translate(11,u+2),i.rotate(-Math.PI/2),i.fillText(d.label,0,0),i.restore()))}i.globalAlpha=1}function rn(e,t,o){const{ctx:r,horizontal:i,thickness:n,viewportPx:s}=e,d=ta(e,t);d<=0||d>=s||(r.strokeStyle=o,r.globalAlpha=.55,r.lineWidth=1,r.beginPath(),i?(r.moveTo(d,0),r.lineTo(d,n)):(r.moveTo(0,d),r.lineTo(n,d)),r.stroke(),r.globalAlpha=1)}const qp=':host{display:block;width:100%;height:100%}:host{--pd-bg: #f3f5f9;--pd-surface: #ffffff;--pd-field-bg: #f4f6fa;--pd-sidebar: #ffffff;--pd-sidebar-hover: #f0f3f9;--pd-canvas-bg: #e6e9f0;--pd-paper: #FFFFFF;--pd-accent: #165DFF;--pd-accent-2: #3D7BFF;--pd-accent-soft: rgba(22, 93, 255, .09);--pd-accent-secondary: #f56c6c;--pd-danger-soft: rgba(245, 108, 108, .1);--pd-ink-green: #67c23a;--pd-text: #2a2e37;--pd-text-muted: #8b909c;--pd-text-faint: #b4b9c4;--pd-border: #d9dde6;--pd-border-soft: #e9ecf2;--pd-input-bg: #ffffff;--pd-hover-tint: #ecf5ff;--pd-danger: #e53e3e;--pd-danger-bg: #fef2f2;--pd-danger-border: #fecaca;--pd-menu-text: #333;--pd-menu-hover: #f5f7fa;--pd-menu-border: #dcdfe6;--pd-menu-divider: #ebeef5;--pd-menu-muted: #909399;--pd-menu-disabled: #c0c4cc;--pd-scrollbar: rgba(23, 32, 60, .18);--pd-scrollbar-thumb: rgba(23, 32, 60, .16);--pd-scrollbar-thumb-hover: rgba(23, 32, 60, .3);--pd-help-field-bg: #f0f9ff;--pd-help-field-line: #bae6fd;--pd-help-field-ink: #0369a1;--pd-help-function-bg: #f0fdf4;--pd-help-function-line: #bbf7d0;--pd-help-function-ink: #166534;--pd-help-variable-bg: #fefce8;--pd-help-variable-line: #fde68a;--pd-help-variable-ink: #854d0e;--pd-help-conditional-bg: #fdf2f8;--pd-help-conditional-line: #fbcfe8;--pd-help-conditional-ink: #9d174d;--pd-handle: #165DFF;--pd-ruler: #9aa1af;--pd-ruler-bg: #f8f9fc;--pd-ruler-cursor: #165DFF;--pd-radius: 6px;--pd-shadow-sm: 0 1px 2px rgba(23, 32, 60, .05);--pd-shadow-md: 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07);--pd-shadow-paper: 0 0 0 1px rgba(23, 32, 60, .05), 0 1px 2px rgba(23, 32, 60, .06), 0 8px 20px rgba(23, 32, 60, .08), 0 26px 60px rgba(23, 32, 60, .15);--pd-success: #16a34a;--pd-text-regular: #606266;--pd-fill-light: #f5f7fa;height:100%;display:flex;flex-direction:column;background:var(--pd-bg)}.pd-form{display:flex;flex-direction:column;gap:10px;font-size:12px;color:var(--pd-text, #303133)}.pd-field{display:flex;flex-direction:column;gap:4px}.pd-label{font-size:11px;color:var(--pd-text-muted, #909399);display:inline-flex;align-items:center;position:relative;justify-content:space-between;gap:6px}.pd-label-t{display:inline-flex;align-items:center;gap:4px;min-width:0}.pd-reset-btn{flex:none;width:15px;height:15px;padding:0;border:1px solid transparent;border-radius:4px;background:transparent;color:var(--pd-text-faint, #b4b9c4);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:color .14s ease,border-color .14s ease,background .14s ease}.pd-reset-btn.is-dirty{color:var(--pd-text, #2a2e37)}.pd-reset-btn:hover{color:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.pd-help{position:static;display:inline-flex;align-items:center;justify-content:center;flex:none;width:13px;height:13px;margin-left:4px;padding:0;border:1px solid var(--pd-border, #d9dde6);border-radius:50%;background:transparent;color:var(--pd-text-muted, #909399);font-size:9px;line-height:1;cursor:help}.pd-help:before{content:"?";font-weight:600}.pd-help:hover,.pd-help:focus-visible{border-color:var(--pd-accent, #165DFF);color:var(--pd-accent, #165DFF)}.pd-help:after{content:attr(data-tip);position:absolute;top:calc(100% + 6px);left:0;z-index:120;width:196px;padding:5px 7px;border-radius:4px;background:#1e2330e0;color:#fff;font-size:12px;font-weight:400;line-height:1.45;text-align:left;white-space:normal;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .15s ease}.pd-help:hover:after,.pd-help:focus:after{opacity:1;visibility:visible}.pd-hover-tip{position:fixed;z-index:9999;transform:translate(-50%);padding:4px 8px;border-radius:4px;background:#2a2e37eb;color:#fff;font-size:12px;line-height:1.4;width:max-content;max-width:calc(100vw - 16px);box-sizing:border-box;overflow-wrap:anywhere;pointer-events:none}.pd-input,.pd-select,textarea.pd-input{width:100%;height:26px;min-height:26px;padding:3px 6px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-input-bg, #fff);color:inherit;font:inherit;box-sizing:border-box;transition:border-color .14s ease,box-shadow .14s ease}.pd-input:hover,.pd-select:hover{border-color:var(--pd-text-faint, #b4b9c4)}textarea.pd-input{height:auto;min-height:48px;resize:vertical}.pd-input:focus,.pd-select:focus{outline:none;border-color:var(--pd-accent, #165DFF);box-shadow:0 0 0 2px #165dff1f}.pd-select{appearance:auto}.pd-switch{appearance:none;width:32px;height:18px;margin:0;border:1px solid var(--pd-border, #dcdfe6);border-radius:999px;background:#dcdfe6;position:relative;cursor:pointer;transition:background .2s,border-color .2s}.pd-switch:checked{background:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF)}.pd-switch:after{content:"";position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:#fff;transition:transform .2s}.pd-switch:checked:after{transform:translate(14px)}.pd-range{width:100%;accent-color:var(--pd-accent, #165DFF)}.pd-radio-group,.pd-checkbox-group{display:flex;flex-wrap:wrap;gap:6px}.pd-radio-group--2col{display:grid;grid-template-columns:1fr 1fr}.pd-radio-group--2col>.pd-radio{width:60%;justify-content:flex-start}.pd-radio,.pd-checkbox{display:inline-flex;align-items:center;gap:4px;min-height:24px;padding:0 7px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-input-bg, #fff);cursor:pointer;transition:border-color .14s ease,background .14s ease,color .14s ease}.pd-radio:has(input:checked),.pd-checkbox:has(input:checked){color:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF);background:#165dff0f}.pd-button-group{display:inline-flex;gap:4px}.pd-button,.pd-tab{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:26px;padding:3px 8px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-bg, #f4f6fa);color:var(--pd-text, #2a2e37);font:inherit;cursor:pointer;transition:background .14s ease,border-color .14s ease,color .14s ease}.pd-button:hover{background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-text-faint, #b4b9c4)}.pd-button.primary{background:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF);color:#fff}.pd-button.danger{background:#f56c6c;border-color:#f56c6c;color:#fff}.pd-button.small{min-height:22px;padding:1px 6px;font-size:11px}.pd-button:disabled{opacity:.55;cursor:not-allowed}.pd-tabs{display:flex;flex-direction:column;min-height:0}.pd-tab-bar{display:flex;gap:4px;padding:8px 12px 0;border-bottom:1px solid var(--pd-border-soft, #ebeef5)}.pd-tab{border:0;border-bottom:2px solid transparent;border-radius:5px 5px 0 0;background:transparent;transition:color .14s ease,background .14s ease}.pd-tab-bar .pd-tab:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.pd-tab.active{color:var(--pd-accent, #165DFF);border-bottom-color:var(--pd-accent, #165DFF);background:transparent;font-weight:600}.pd-tab-pane{min-height:0;overflow:auto}.pd-divider{margin:6px 0;font-size:11px;color:var(--pd-text-muted, #909399)}.pd-empty{margin:16px 0;color:var(--pd-text-muted, #909399);text-align:center}.pd-dialog-overlay{position:fixed;inset:0;z-index:2000;display:grid;place-items:center;padding:16px;background:#00000073}.pd-dialog{display:flex;flex-direction:column;width:min(950px,90vw);max-height:90vh;overflow:hidden;background:var(--pd-surface, #fff);border-radius:12px;box-shadow:var(--pd-shadow-md, 0 12px 40px rgba(23, 32, 60, .18))}.pd-dialog-large{width:min(950px,90vw)}.pd-dialog-header,.pd-dialog-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 16px}.pd-dialog-header{border-bottom:1px solid var(--pd-border-soft, #ebeef5)}.pd-dialog-footer{justify-content:flex-end;border-top:1px solid var(--pd-border-soft, #ebeef5)}.pd-close{width:22px;height:22px;border:0;background:transparent;color:var(--pd-text-muted, #909399);font-size:16px;cursor:pointer}.pd-icon{display:inline-flex;width:14px;height:14px}.tb-more-panel{min-width:244px}.designer-container{scrollbar-width:thin;scrollbar-color:var(--pd-scrollbar, rgba(23, 32, 60, .18)) transparent}.designer-container ::-webkit-scrollbar{width:9px;height:9px}.designer-container ::-webkit-scrollbar-track{background:transparent}.designer-container ::-webkit-scrollbar-thumb{background:var(--pd-scrollbar-thumb, rgba(23, 32, 60, .16));border-radius:999px;border:2px solid transparent;background-clip:content-box}.designer-container ::-webkit-scrollbar-thumb:hover{background:var(--pd-scrollbar-thumb-hover, rgba(23, 32, 60, .3));border:2px solid transparent;background-clip:content-box}.designer-container ::-webkit-scrollbar-corner{background:transparent}.designer-container button:focus-visible,.designer-container [tabindex]:focus-visible,.designer-container .pd-tab:focus-visible{outline:2px solid var(--pd-accent, #165DFF);outline-offset:1px}@media(prefers-reduced-motion:reduce){.designer-container *,.designer-container *:before,.designer-container *:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}.help-button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;border-radius:4px;background:transparent;cursor:pointer;transition:background-color .15s}.help-button:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.help-icon{display:flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background:var(--pd-accent, #165DFF);color:#fff;font-size:12px;font-weight:600;line-height:1}.tb-dd{position:relative;display:inline-flex}.tb-dd-trigger{height:28px;min-width:28px;padding:0 5px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:3px;font-size:12px;transition:background .14s ease,color .14s ease}.tb-dd-trigger:hover:not(:disabled){color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.tb-dd-trigger:disabled{opacity:.32;cursor:default}.tb-dd-trigger.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.tb-dd-arrow{opacity:.6;transition:transform .14s ease}.tb-dd-arrow.up{transform:rotate(180deg)}.tb-dd-trigger[data-tip]{position:relative}.tb-dd-trigger[data-tip]:after{content:attr(data-tip);position:absolute;top:34px;left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:100}.tb-dd-trigger[data-tip]:hover:after{opacity:1}.tb-dd-panel{position:absolute;top:34px;left:0;background:var(--pd-surface, #fff);border:1px solid var(--pd-border, #d9dde6);border-radius:8px;box-shadow:var(--pd-shadow-md, 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07));z-index:200}.tb-dd-panel.is-hidden{display:none}.tb-more-group{flex-shrink:0}.tb-more-menu{display:flex;flex-direction:column;gap:8px;padding:8px;max-height:min(70vh,520px)}.tb-more-item{display:flex;flex-direction:column;gap:4px}.tb-menu-label{font-size:11px;color:var(--pd-text-muted, #8b909c);padding-left:2px}.tb-more-slot{display:flex;align-items:center}.designer-toolbar{display:flex;align-items:center;gap:2px;padding:0 12px;height:50px;background:var(--pd-surface, #ffffff);border-bottom:1px solid var(--pd-border-soft, #e9ecf2);box-shadow:0 1px 2px #17203c0a,0 6px 16px -12px #17203c40;flex-shrink:0;position:relative;z-index:100}.tb-ou{flex-shrink:0}.designer-toolbar>*{flex-shrink:0}.designer-toolbar>.tb-brand{flex-shrink:1;min-width:0}.tb-title,.tb-title-name,.tb-title-sub,.tb-btn-text,.tb-zoom{white-space:nowrap}.designer-toolbar.is-tight .tb-title{min-width:0;overflow:hidden}.designer-toolbar.is-tight .tb-title-name,.designer-toolbar.is-tight .tb-title-sub{overflow:hidden;text-overflow:ellipsis}.tb-group{display:flex;align-items:center;gap:2px;padding:0 8px}.tb-group+.tb-group{border-left:1px solid var(--pd-border-soft, #e9ecf2)}.tb-btn{height:30px;min-width:30px;padding:0 8px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:5px;transition:background .14s ease,color .14s ease,border-color .14s ease,box-shadow .14s ease}.tb-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.tb-btn:active{background:var(--pd-border-soft, #e9ecf2)}.tb-btn:disabled{opacity:.32;cursor:default;background:transparent;color:var(--pd-text-faint, #b4b9c4)}.tb-btn.danger:hover:not(:disabled){color:var(--pd-accent-secondary, #f56c6c);background:var(--pd-danger-soft, rgba(245, 108, 108, .1))}.tb-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));font-weight:600}.tb-btn .dot{width:6px;height:6px;border-radius:50%;background:var(--pd-text-faint, #b4b9c4);display:inline-block;transition:background .14s ease,box-shadow .14s ease}.tb-btn.on .dot{background:var(--pd-accent, #165DFF);box-shadow:0 0 0 3px #165dff1f}.tb-icon{font-size:15px;line-height:1}[data-tip]{position:relative}[data-tip]:after{content:attr(data-tip);position:absolute;bottom:-32px;left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:100}[data-tip]:hover:after{opacity:1}.tb-mark{width:28px;height:28px;margin-right:2px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;color:#fff;background:linear-gradient(150deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF));box-shadow:0 3px 8px #165dff47,inset 0 1px #ffffff38;flex-shrink:0}.tb-mark svg{width:16px;height:16px}.tb-title{display:flex;flex-direction:column;line-height:1.2;padding-left:6px}.tb-title-name{font-size:13px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:.2px}.tb-title-sub{font-size:10px;color:var(--pd-text-muted, #8b909c);letter-spacing:.8px}.tb-zoom{font-size:12px;color:var(--pd-text, #2a2e37);font-variant-numeric:tabular-nums;min-width:46px;text-align:center}.tb-spacer{flex:1}.tb-group .tb-dd-trigger{height:30px;min-width:30px;padding:0 8px}.tb-btn-text{font-size:12px}.tb-menu{padding:8px;display:flex;flex-direction:column;gap:4px}.tb-menu-rows{width:148px}.tb-menu-label{padding:2px 4px;font-size:11px;color:var(--pd-text-muted, #8b909c)}.tb-menu-grid{display:grid;grid-template-columns:repeat(4,32px);gap:2px;margin-bottom:4px}.tb-menu-row{justify-content:flex-start;width:100%}.btn-primary,.btn-secondary{height:32px;padding:0 16px;border-radius:7px;font-size:13px;font-weight:600;cursor:pointer;transition:filter .14s ease,background .14s ease,border-color .14s ease,box-shadow .14s ease}.btn-secondary{background:var(--pd-field-bg, #f4f6fa);color:var(--pd-text-muted, #606266);border:1px solid var(--pd-border, #d9dde6)}.btn-secondary:hover{border-color:var(--pd-accent, #165DFF);color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .06))}.btn-primary{background:linear-gradient(180deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF));color:#fff;border:none;box-shadow:0 3px 10px #165dff47,inset 0 1px #ffffff2e}.btn-primary:hover{filter:brightness(1.07);box-shadow:0 5px 14px #165dff57,inset 0 1px #ffffff2e}.btn-primary:active{filter:brightness(.97)}.font-select{position:relative}.font-select-input{display:block;width:100%}.font-select-list{position:absolute;top:calc(100% + 4px);left:0;width:100%;min-width:150px;z-index:200;margin:0;max-height:200px;overflow-y:auto;padding:2px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-surface, #ffffff);box-shadow:var(--pd-shadow-md, 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07));list-style:none}.font-select-list.is-up{top:auto;bottom:calc(100% + 4px)}.font-select-option{padding:4px 6px;border-radius:4px;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.font-select-option.is-active{background:var(--pd-sidebar-hover, #f0f3f9)}.font-select-option.is-muted{color:var(--pd-text-muted, #8b909c)}.pd-stepper{display:flex;align-items:center;width:100%}.pd-step-btn{width:26px;height:26px;flex-shrink:0;border:1px solid var(--pd-border, #d9dde6);background:var(--pd-field-bg, #f4f6fa);color:var(--pd-text, #2a2e37);font-size:14px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .14s ease,border-color .14s ease,color .14s ease}.pd-step-btn:hover:not(:disabled){background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-text-faint, #b4b9c4)}.pd-step-btn:disabled{opacity:.45;cursor:not-allowed}.pd-step-minus{border-radius:6px 0 0 6px;border-right:none}.pd-step-plus{border-radius:0 6px 6px 0;border-left:none}.pd-step-input.pd-input{border-radius:0;min-width:0;flex:1;text-align:center;-moz-appearance:textfield}.pd-step-input.pd-input::-webkit-outer-spin-button,.pd-step-input.pd-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.preset-color-trigger{display:flex;align-items:center;width:100%;min-height:26px;padding:1px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-surface, #fff);cursor:pointer;transition:border-color .14s ease,box-shadow .14s ease}.preset-color-trigger:hover,.preset-color-trigger[aria-expanded=true]{border-color:var(--pd-accent, #165DFF)}.preset-color-trigger:focus-visible{outline:none;border-color:var(--pd-accent, #165DFF);box-shadow:0 0 0 2px #165dff1f}.preset-color-swatch{width:100%;height:22px;border-radius:4px;background-image:linear-gradient(45deg,#e9ecef 25%,transparent 25%,transparent 75%,#e9ecef 75%);background-size:8px 8px;background-position:0 0,4px 4px}.preset-color-panel{position:fixed;z-index:3000;width:190px;padding:10px;border:1px solid var(--pd-border, #d9dde6);border-radius:8px;background:var(--pd-surface, #fff);box-shadow:0 8px 24px #17203c29}.picker-preview{display:flex;align-items:center;gap:8px;margin-bottom:8px}.picker-current{flex:0 0 26px;height:24px;border:1px solid rgb(0 0 0 / 12%);border-radius:5px;background-image:linear-gradient(45deg,#e9ecef 25%,transparent 25%,transparent 75%,#e9ecef 75%);background-size:8px 8px;background-position:0 0,4px 4px}.picker-current.is-empty{position:relative;background-color:#fff}.picker-current.is-empty:after{content:"";position:absolute;inset:3px;background:linear-gradient(to top right,transparent calc(50% - .7px),#f53f3f calc(50% - .7px),#f53f3f calc(50% + .7px),transparent calc(50% + .7px));border-radius:3px}.picker-hex{flex:1;min-width:0;height:24px;padding:0 6px;border:1px solid var(--pd-border, #d9dde6);border-radius:5px;color:var(--pd-text, #303133);font:inherit;font-size:11px;text-transform:uppercase}.picker-hex:focus{outline:none;border-color:var(--pd-accent, #165DFF);box-shadow:0 0 0 2px #165dff1f}.picker-area{position:relative;height:100px;border:1px solid rgb(0 0 0 / 12%);border-radius:6px;overflow:hidden;cursor:crosshair;touch-action:none;background:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,hsl(var(--picker-hue) 100% 50%))}.picker-handle{position:absolute;width:12px;height:12px;border:2px solid #fff;border-radius:50%;transform:translate(-50%,-50%);box-shadow:0 0 3px #00000073;pointer-events:none}.picker-hue{width:100%;height:14px;margin:10px 0 0;appearance:none;border:1px solid rgb(0 0 0 / 12%);border-radius:999px;background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);cursor:pointer}.picker-hue::-webkit-slider-thumb{appearance:none;width:12px;height:12px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 3px #00000073}.picker-hue::-moz-range-thumb{width:8px;height:8px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 3px #00000073}.picker-heading{display:flex;align-items:center;justify-content:space-between;margin-top:10px;margin-bottom:6px;font-size:11px;color:var(--pd-text-muted, #909399)}.picker-clear{display:inline-flex;align-items:center;gap:3px;padding:2px 6px;border:none;border-radius:4px;background:transparent;font-size:11px;line-height:1;color:var(--pd-text-muted, #909399);cursor:pointer}.picker-clear:hover:not(:disabled){background:#0000000f;color:var(--pd-danger, #f53f3f)}.picker-clear:disabled{opacity:.45;cursor:not-allowed}.preset-color-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:5px}.preset-color-item{width:22px;height:22px;padding:0;border:1px solid rgb(0 0 0 / 12%);border-radius:5px;cursor:pointer}.preset-color-item.active{box-shadow:0 0 0 2px #fff,0 0 0 3px var(--pd-accent, #165DFF)}.format-toolbar{display:flex;align-items:center;gap:2px;flex-shrink:0;min-width:0}.ft-group{display:flex;align-items:center;gap:2px;padding:0 8px;flex-shrink:0}.ft-group+.ft-group{border-left:1px solid var(--pd-border-soft, #e9ecf2)}.ft-btn{height:28px;min-width:28px;padding:0 5px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:4px;transition:background .14s ease,color .14s ease}.ft-btn:hover:not(:disabled){color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.ft-btn:disabled{opacity:.32;cursor:default}.ft-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.ft-btn-text{font-size:12px}.ft-btn[data-tip]{position:relative}.ft-btn[data-tip]:after{content:attr(data-tip);position:absolute;top:34px;left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:100}.ft-btn[data-tip]:hover:after{opacity:1}.ft-font{width:150px}.ft-size{width:96px}.ft-font .font-select-input,.ft-size .pd-input,.ft-size .pd-step-btn{font-size:12px}.ft-color-btn{position:relative;width:28px;height:28px;display:inline-flex;margin-left:2px}.ft-color-btn.dim{opacity:.35}.ft-color-btn .preset-color-trigger{width:100%;height:100%;min-height:0;padding:0;border:1px solid transparent;border-radius:6px;background:transparent;align-items:flex-end;justify-content:center}.ft-color-btn .preset-color-trigger:hover,.ft-color-btn .preset-color-trigger[aria-expanded=true]{background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-border-soft, #e9ecf2)}.ft-color-btn .preset-color-swatch{width:16px;height:4px;margin-bottom:3px;border-radius:1px;background-image:none;border-bottom:1px solid var(--pd-text-faint, #b4b9c4)}.ft-glyph{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding-bottom:7px;font-size:13px;font-weight:700;color:var(--pd-text, #2a2e37);pointer-events:none}.ft-border-panel{width:196px;padding:10px;display:flex;flex-direction:column;gap:8px}.ft-align-panel{padding:6px;display:flex;flex-direction:column;gap:4px}.ft-align-row{display:grid;grid-template-columns:repeat(3,36px);gap:4px}.ft-border-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}.ft-cell-btn{height:30px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:6px;background:transparent;color:var(--pd-text, #2a2e37);cursor:pointer}.ft-cell-btn:hover:not(:disabled){background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-border-soft, #e9ecf2)}.ft-cell-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));border-color:#165dff59}.ft-cell-btn:disabled{opacity:.32;cursor:default}.ft-cell-btn .g-faint{fill:none;stroke:var(--pd-text-faint, #b4b9c4);stroke-width:1;stroke-dasharray:2 2}.ft-cell-btn .g-solid{stroke:currentColor;stroke-width:1.6}.ft-cell-btn[data-tip],.ft-style-btn[data-tip]{position:relative}.ft-cell-btn[data-tip]:after,.ft-style-btn[data-tip]:after{content:attr(data-tip);position:absolute;top:calc(100% + 4px);left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;font-weight:400;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:210}.ft-cell-btn[data-tip]:hover:after,.ft-style-btn[data-tip]:hover:after{opacity:1}.ft-style-row{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}.ft-style-btn{height:22px;display:inline-flex;align-items:center;justify-content:center;padding:0 4px;border:1px solid transparent;border-radius:5px;background:transparent;color:var(--pd-text, #2a2e37);cursor:pointer}.ft-style-btn:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.ft-style-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));border-color:#165dff59}.ft-style-line{width:100%;height:0}.ft-border-style-row{display:flex;align-items:center;gap:6px}.ft-line-width{width:96px}.ft-edge-label{font-size:12px;color:var(--pd-text-muted, #8b909c);white-space:nowrap;flex-shrink:0}.layer-panel{border-top:1px solid var(--pd-border);padding:8px 12px;height:100%;box-sizing:border-box;overflow-y:auto}.panel-title{font-size:11px;color:var(--pd-text-muted);text-transform:uppercase;letter-spacing:.5px;margin-bottom:8px}.layer-item{display:flex;align-items:center;gap:6px;padding:4px 6px;margin-bottom:2px;border-radius:4px;cursor:pointer;font-size:12px;transition:background .1s}.layer-item:hover{background:var(--pd-sidebar-hover, #f0f2f5)}.layer-item.active{background:#165dff1a;color:var(--pd-accent, #165DFF);box-shadow:inset 2px 0 0 var(--pd-accent, #165DFF)}.layer-icon{width:18px;text-align:center;font-size:12px;color:var(--pd-text-muted, #909399)}.layer-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--pd-text, #303133)}.layer-zone{flex-shrink:0;padding:0 4px;font-size:10px;line-height:14px;color:var(--pd-ink-green, #67c23a);background:#67c23a1a;border-radius:3px}.layer-zindex{font-size:10px;color:var(--pd-text-muted, #909399);font-variant-numeric:tabular-nums}.layer-actions{display:flex;gap:4px;margin-top:8px}.field-tree-panel{padding:0}.panel-title{font-size:11px;color:var(--pd-text-muted);text-transform:uppercase;letter-spacing:.5px;padding:4px 0 8px;margin-bottom:8px;border-bottom:1px solid var(--pd-border)}.search-input{margin-bottom:8px}.tree-container{overflow-y:auto;min-height:0}.field-group-header{display:flex;align-items:center;gap:4px;padding:5px 8px;border-radius:4px;font-size:13px;color:var(--pd-text, #303133);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background .1s}.field-group-header:hover{background:var(--pd-sidebar-hover, #f0f2f5)}.field-group-header.is-list{color:var(--pd-accent, #165DFF);font-weight:500}.expand-icon{width:12px;font-size:8px;flex-shrink:0;color:var(--pd-text-muted, #909399)}.field-row{display:flex;align-items:center;gap:4px;padding:5px 8px;border-radius:4px;font-size:13px;color:var(--pd-text, #303133);cursor:grab;-webkit-user-select:none;user-select:none;transition:background .1s}.field-row:hover{background:var(--pd-sidebar-hover, #f0f2f5)}.node-icon{font-size:14px;flex-shrink:0;filter:saturate(.6);opacity:.9}.node-meta{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:center;column-gap:4px;row-gap:1px}.node-label{flex:1 1 auto;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.node-key{flex:0 1 auto;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--pd-text-muted, #909399)}.field-row .node-key.is-primary{font-size:13px;color:var(--pd-text, #303133)}.group-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.copy-hint{flex-shrink:0;margin-left:auto;font-size:11px;color:var(--pd-accent, #165DFF);white-space:nowrap}.left-panel{width:248px;min-width:248px;background:var(--pd-sidebar, #ffffff);border-right:1px solid var(--pd-border-soft, #e9ecf2);display:flex;flex-direction:column;overflow:hidden;transition:width .18s ease}.left-panel.collapsed{width:36px;min-width:36px;border-right:1px solid var(--pd-border-soft, #e9ecf2)}.left-collapsed{display:flex;flex-direction:column;align-items:center;gap:8px;padding-top:12px;flex:1}.lc-btn{width:26px;height:26px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .14s ease}.lc-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.lc-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.left-head{display:flex;align-items:center;justify-content:space-between;height:42px;padding:0 12px;flex-shrink:0;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.left-title{font-size:12px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:1.2px;display:inline-flex;align-items:center;gap:7px}.left-title:before{content:"";width:3px;height:12px;border-radius:2px;background:linear-gradient(180deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF))}.left-tabs{flex:1;display:flex;flex-direction:column;overflow:hidden}.left-tabs .pd-tab-pane{flex:1;min-height:0;overflow-y:auto;padding:12px}.material-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-content:start}.material-grid>.panel-title,.material-grid>.material-group-title,.material-grid>.material-card--wide{grid-column:1 / -1}.material-grid>.panel-title,.material-grid>.material-group-title{margin-bottom:0}.material-grid>.material-card{margin-bottom:0;min-width:0}.panel-title{font-size:11px;color:var(--pd-text-muted, #8b909c);letter-spacing:.6px;padding:2px 2px 8px;margin-bottom:10px;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.material-group-title{font-size:11px;color:var(--pd-text-muted, #8b909c);letter-spacing:.6px;padding:4px 2px 6px;margin:2px 0 8px;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.material-card{position:relative;display:flex;align-items:center;gap:9px;padding:7px 8px;border:1px solid var(--pd-border-soft, #e9ecf2);border-radius:7px;background:transparent;cursor:grab;-webkit-user-select:none;user-select:none;transition:background .16s ease,border-color .16s ease,transform .16s ease,box-shadow .16s ease}.material-card:before{content:"";position:absolute;left:0;top:50%;width:2px;height:0;border-radius:2px;background:var(--pd-accent, #165DFF);transform:translateY(-50%);transition:height .16s ease}.material-card:hover{background:var(--pd-hover-tint, #ecf5ff);border-color:#165dff73;transform:translate(2px)}.material-card:hover:before{height:56%}.material-card:active{cursor:grabbing;transform:translate(2px) scale(.985)}.material-icon{width:30px;height:30px;border:0;border-radius:7px;display:flex;align-items:center;justify-content:center;color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));box-shadow:inset 0 0 0 1px #165dff1f;flex-shrink:0;transition:background .16s ease,color .16s ease,box-shadow .16s ease,transform .16s ease}.material-card:hover .material-icon{background:var(--pd-accent, #165DFF);color:#fff;box-shadow:0 2px 6px #165dff47}.material-card:active .material-icon{transform:scale(.92)}.material-label{min-width:0;flex:1;font-size:12.5px;font-weight:500;line-height:1.3;color:var(--pd-text, #2a2e37);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:color .16s ease}.material-card:hover .material-label{color:var(--pd-accent, #165DFF)}.print-image{width:100%;height:100%;overflow:hidden}.print-image img{width:100%;height:100%;display:block}.table-ctx-menu{position:fixed;z-index:3000;min-width:140px;padding:4px 0;background:var(--pd-surface, #fff);border:1px solid var(--pd-menu-border, #dcdfe6);border-radius:4px;box-shadow:0 2px 12px #00000026;font-size:13px}.menu-item{padding:5px 14px;cursor:pointer;color:var(--pd-menu-text, #333)}.menu-item:hover{background:var(--pd-menu-hover, #f5f7fa)}.menu-item.disabled{color:var(--pd-menu-disabled, #c0c4cc);cursor:not-allowed}.menu-item.active{color:var(--pd-accent, #165DFF)}.menu-divider{height:1px;margin:4px 0;background:var(--pd-menu-divider, #ebeef5)}.menu-group-title{padding:4px 14px;font-size:12px;color:var(--pd-menu-muted, #909399)}.cell-barcode{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.cell-barcode svg{max-width:100%;max-height:100%}.cell-barcode img{max-width:100%;max-height:100%}.cell-barcode-fallback{font-style:italic;opacity:.6}.cell-image{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.cell-image img{max-width:100%;max-height:100%;display:block}.image-placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:#bbb;font-size:12px;border:1px dashed #ddd;box-sizing:border-box}.print-table{position:relative;width:100%;height:100%}.print-table table{border-collapse:collapse;table-layout:fixed;width:100%}.print-table td{box-sizing:border-box;word-break:normal;overflow-wrap:break-word}.cell-selected{outline:2px solid #165DFF;outline-offset:-2px;background-color:#165dff14}.row-data-bg{background-image:repeating-linear-gradient(45deg,rgba(22,93,255,.04) 0 6px,transparent 6px 12px)}.data-placeholder{color:#909399;font-style:italic}.row-badges{position:absolute;left:-16px;top:0;width:14px}.row-badge{position:absolute;width:14px;display:flex;align-items:center;justify-content:center;font-size:10px;color:#909399;background:#f5f7fa;border-radius:2px}.col-resize-layer{position:absolute;inset:0;pointer-events:none;z-index:3}.col-resize-handle{position:absolute;top:0;bottom:0;width:6px;transform:translate(-50%);cursor:col-resize;pointer-events:auto}.col-resize-handle:after{content:"";position:absolute;top:0;bottom:0;left:50%;border-left:1px solid transparent}.col-resize-handle:hover:after,.col-resize-handle.dragging:after{border-left-color:var(--pd-accent, #165DFF)}.print-barcode{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.print-barcode svg{max-width:100%;max-height:100%}.print-qrcode{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.print-qrcode img{max-width:100%;max-height:100%}.print-html,.page-number-element{width:100%;height:100%;overflow:hidden}.print-element{box-sizing:border-box;cursor:pointer;-webkit-user-select:none;user-select:none}.extension-placeholder{display:flex;align-items:center;justify-content:center;width:100%;height:100%;box-sizing:border-box;padding:2px;font-size:11px;line-height:1.4;text-align:center;color:var(--pd-text-muted, #8b909c);background:repeating-linear-gradient(45deg,#f4f6fa,#f4f6fa 6px,#fff 6px 12px);overflow:hidden}.element-margin-guide{position:absolute;box-sizing:border-box;pointer-events:none}.print-element.design-mode{outline:1px dashed #C3C9D6}.print-element.design-mode.zone-header,.print-element.design-mode.zone-footer{outline:1px dashed var(--pd-ink-green, #67c23a)}.print-element.selected{outline:1.5px solid var(--pd-accent, #165DFF);background:#165dff0a}.print-element.previewed{outline:1.5px solid rgba(22,93,255,.5);background:#165dff1a}.print-element.design-mode:hover{outline:1px dashed var(--pd-accent, #165DFF)}.print-element.locked{cursor:not-allowed}.print-element.locked:not(.selected){outline:1.5px dashed #999}.print-element.hidden{opacity:.3;pointer-events:none}.print-element.drag-ghost{opacity:.4}.drag-preview{position:absolute;inset:0;border:2px dashed var(--pd-accent, #165DFF);pointer-events:none;z-index:1000;box-sizing:border-box}.selected-indicator{position:absolute;top:-18px;left:0;font-size:10px;white-space:nowrap;pointer-events:none;z-index:20}.position-label{background:var(--pd-accent, #165DFF);color:#fff;padding:1px 6px;border-radius:3px;font-family:ui-monospace,SF Mono,Menlo,monospace;font-size:10px;font-variant-numeric:tabular-nums;letter-spacing:0;box-shadow:0 2px 6px #00000026}.resize-handles{position:absolute;inset:0;pointer-events:none}.resize-handle{position:absolute;width:7px;height:7px;background:var(--pd-handle, #165DFF);border:1.5px solid #fff;border-radius:2px;box-sizing:border-box;transform:translate(-50%,-50%);box-shadow:0 1px 3px #0000002e;z-index:10;pointer-events:auto}.handle-nw{top:0;left:0;cursor:nw-resize}.handle-n{top:0;left:50%;cursor:n-resize}.handle-ne{top:0;left:100%;cursor:ne-resize}.handle-e{top:50%;left:100%;cursor:e-resize}.handle-se{top:100%;left:100%;cursor:se-resize}.handle-s{top:100%;left:50%;cursor:s-resize}.handle-sw{top:100%;left:0;cursor:sw-resize}.handle-w{top:50%;left:0;cursor:w-resize}.paper-wrapper{display:block}.hiprint-printPaper{transition:transform .15s ease-out}.zone-layer{box-sizing:border-box}.zone-layer.zone-header.design-mode,.zone-layer.zone-footer.design-mode{outline:1px dashed var(--pd-ink-green, #67c23a);background:#67c23a0a}.zone-layer.zone-content.design-mode{outline:1px dashed #C3C9D6}.zone-label{position:absolute;top:2px;right:4px;font-size:9px;color:#909399;pointer-events:none;-webkit-user-select:none;user-select:none}.zone-resize-handle{position:absolute;left:0;width:100%;height:6px;cursor:ns-resize;z-index:5}.zone-resize-handle.handle-bottom{bottom:-3px}.zone-resize-handle.handle-top{top:-3px}.zone-resize-handle:hover{background:#10b98140}.zone-height-tip{position:absolute;right:4px;top:-22px;padding:1px 6px;font-size:11px;color:#fff;background:#10b981;border-radius:3px;white-space:nowrap;pointer-events:none}.design-background{position:absolute;z-index:0;overflow:hidden;pointer-events:none}.design-background img{display:block;width:100%;height:100%;object-fit:fill;pointer-events:none;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.grid-bg{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:0}.snap-indicator{position:absolute;width:6px;height:6px;background:var(--pd-accent, #165DFF);border-radius:50%;transform:translate(-50%,-50%);pointer-events:none;z-index:10;animation:snap-pulse-3160f418 .3s ease-out}@keyframes snap-pulse-3160f418{0%{transform:translate(-50%,-50%) scale(2);opacity:.5}to{transform:translate(-50%,-50%) scale(1);opacity:0}}.watermark-layer{position:absolute;top:0;left:0;width:100%;height:100%;z-index:0;overflow:hidden;pointer-events:none}.watermark-tile{position:absolute;pointer-events:none}.adsorb-guide{position:absolute;pointer-events:none;z-index:9999}.adsorb-guide.guide-vertical{border-left:1px dashed var(--pd-accent-secondary, #f56c6c)}.adsorb-guide.guide-horizontal{border-top:1px dashed var(--pd-accent-secondary, #f56c6c)}.manual-guide{position:absolute;pointer-events:auto;z-index:9998;cursor:move}.manual-guide.guide-vertical{border-left:1px solid #3B82F6;width:0}.manual-guide.guide-horizontal{border-top:1px solid #3B82F6;height:0}.manual-guide:before{content:"";position:absolute;pointer-events:auto}.manual-guide.guide-vertical:before{top:0;bottom:0;left:50%;width:var(--guide-hit, 8px);transform:translate(-50%)}.manual-guide.guide-horizontal:before{left:0;right:0;top:50%;height:var(--guide-hit, 8px);transform:translateY(-50%)}.manual-guide:hover{border-color:#ef4444!important}.pd-ruler{position:absolute;display:block;pointer-events:auto;cursor:crosshair;z-index:1;background:var(--pd-ruler-bg, #f8f9fc)}.pd-ruler.is-horizontal{box-shadow:0 1px 0 var(--pd-border-soft, #e9ecf2)}.pd-ruler.is-vertical{box-shadow:1px 0 0 var(--pd-border-soft, #e9ecf2)}.canvas-area{flex:1;overflow-x:scroll;overflow-y:auto;scrollbar-gutter:stable;display:flex;background-color:var(--pd-canvas-bg, #e6e9f0);background-image:radial-gradient(circle,rgba(23,32,60,.13) 1px,transparent 1.2px);background-size:20px 20px;background-position:center;padding:44px 28px 32px 44px;position:relative}.canvas-scroll{display:flex;flex-direction:column;align-items:center;gap:20px;position:relative;flex:none;margin:auto;width:fit-content}.marquee-selection{position:fixed;border:1.5px solid rgba(22,93,255,.7);background:#165dff14;border-radius:2px;pointer-events:none;z-index:10000}.drop-hint{position:fixed;z-index:10002;pointer-events:none;padding:2px 8px;border-radius:10px;background:var(--pd-accent, #165dff);color:#fff;font-size:12px;line-height:18px;white-space:nowrap;box-shadow:0 2px 8px #0000002e}.context-menu{position:fixed;background:var(--pd-surface, #ffffff);border:1px solid var(--pd-border-soft, #e9ecf2);border-radius:8px;box-shadow:var(--pd-shadow-md, 0 10px 28px rgba(23, 32, 60, .12));padding:5px;z-index:10001;min-width:132px}.context-menu-item{padding:7px 12px;border-radius:5px;font-size:12.5px;cursor:pointer;color:var(--pd-text, #2a2e37);-webkit-user-select:none;user-select:none;transition:background .12s ease,color .12s ease}.context-menu-item:hover{background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF)}.context-menu-item.disabled{color:var(--pd-text-faint, #b4b9c4);cursor:not-allowed}.context-menu-item.disabled:hover{background:transparent;color:var(--pd-text-faint, #b4b9c4)}.context-menu-sep{height:1px;background:var(--pd-border-soft, #e9ecf2);margin:5px 8px}.ruler-overlay{position:absolute;inset:0;pointer-events:none;z-index:60}.ruler-corner{position:absolute;top:0;left:0;width:22px;height:22px;background:var(--pd-ruler-bg, #f8f9fc);box-shadow:1px 1px 0 var(--pd-border-soft, #e9ecf2);z-index:2}.ruler-overlay .pd-ruler.is-horizontal{top:0;left:22px}.ruler-overlay .pd-ruler.is-vertical{top:22px;left:0}.ruler-guide-preview{position:fixed;pointer-events:none;z-index:9997}.ruler-guide-preview.guide-vertical{width:0;border-left:1px dashed var(--pd-accent, #165dff)}.ruler-guide-preview.guide-horizontal{height:0;border-top:1px dashed var(--pd-accent, #165dff)}.property-search{padding:0 0 10px;background:transparent}.property-group{border:1px solid var(--pd-border-soft, #e9ecf2);border-radius:8px;margin-bottom:10px;background:var(--pd-surface, #ffffff);overflow:hidden;transition:border-color .14s ease,box-shadow .14s ease}.property-group:last-child{margin-bottom:2px}.property-group.is-expanded{border-color:var(--pd-border-soft, #e9ecf2)}.group-header{display:flex;align-items:center;padding:9px 12px;cursor:pointer;-webkit-user-select:none;user-select:none;background:var(--pd-field-bg, #f4f6fa);transition:background .14s ease}.group-header:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.property-group.is-expanded .group-header{border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.group-icon{margin-right:8px;color:var(--pd-accent, #165DFF)}.group-title{flex:1;font-size:12px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:.3px}.expand-icon{color:var(--pd-text-muted, #8b909c);font-size:10px}.group-content{padding:10px 12px 12px;background:var(--pd-surface, #ffffff)}.position-grid,.margin-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.margin-grid{margin-top:8px}.pd-crop-note{margin:0 0 8px;font-size:12px;line-height:1.5;color:var(--pd-text-faint, #6b7280)}.pd-crop-preview{position:relative;overflow:hidden;margin-bottom:8px;border:1px solid var(--pd-border, #d9dde6);border-radius:4px;line-height:0;width:fit-content;max-width:100%}.pd-crop-thumb{max-width:100%;max-height:96px;display:block}.pd-crop-win{position:absolute;border:1px solid #ff5a5a;box-shadow:0 0 0 999px #0000008c;pointer-events:none}.color-row{display:flex;gap:12px}.color-row>.pd-field{flex:1 1 0;min-width:0}.pd-rotate-row{display:flex;align-items:stretch;width:100%}.pd-rotate-btn{width:26px;flex-shrink:0;border:1px solid var(--pd-border, #d9dde6);background:var(--pd-field-bg, #f4f6fa);color:var(--pd-text, #2a2e37);font-size:14px;line-height:1;cursor:pointer;transition:background .14s ease,border-color .14s ease}.pd-rotate-btn:hover{background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-text-faint, #b4b9c4)}.pd-rotate-btn:first-child{border-radius:6px 0 0 6px;border-right:none}.pd-rotate-btn:last-child{border-radius:0 6px 6px 0;border-left:none}.pd-rotate-stepper{flex:1;min-width:0}.pd-rotate-stepper .pd-step-minus,.pd-rotate-stepper .pd-step-plus{display:none}.pd-rotate-stepper .pd-step-input.pd-input{border-radius:0}.expression-editor{display:flex;height:450px;gap:0}.ee-nav{width:100px;background:var(--pd-sidebar);border-right:1px solid var(--pd-border);display:flex;flex-direction:column;flex-shrink:0}.ee-nav-title{padding:10px;border-bottom:1px solid var(--pd-border);font-weight:600;font-size:13px;color:var(--pd-text);text-align:center}.ee-nav-tabs{flex:1;display:flex;flex-direction:column;padding:6px;gap:4px}.ee-nav-tab{padding:8px 10px;border-radius:6px;cursor:pointer;font-size:12px;text-align:center;transition:all .2s}.ee-nav-tab.active{background:var(--pd-accent);color:#fff}.ee-nav-tab:not(.active){background:var(--pd-surface, white);border:1px solid var(--pd-border);color:var(--pd-text)}.ee-nav-tab:hover:not(.active){background:var(--pd-hover-tint, #ecf5ff);border-color:var(--pd-accent)}.ee-content{width:300px;display:flex;flex-direction:column;border-right:1px solid var(--pd-border);flex-shrink:0}.ee-content-search{padding:10px;border-bottom:1px solid var(--pd-border)}.ee-content-list{flex:1;padding:8px;overflow-y:auto;min-height:0}.ee-func-group{margin-bottom:12px}.ee-func-group-title{font-size:11px;font-weight:600;color:var(--pd-text-muted);padding:6px 10px;margin-bottom:2px;letter-spacing:.5px}.ee-field-group{display:flex;align-items:center;gap:4px;padding:6px 10px;font-size:12px;font-weight:600;color:var(--pd-text)}.ee-field-group.is-list{color:var(--pd-accent, #165DFF)}.ee-field-group-icon{font-size:13px;filter:saturate(.6)}.ee-list-item{padding:7px 10px;cursor:pointer;border-radius:4px;margin-bottom:2px;transition:background .15s}.ee-field-info{display:flex;flex-direction:column;gap:1px}.ee-field-info .ee-item-label{font-size:12px;color:var(--pd-text)}.ee-field-info .ee-item-key{font-size:10px;color:var(--pd-text-muted);font-family:monospace}.ee-field-info .ee-item-key.is-primary{font-size:12px;color:var(--pd-text, #303133);font-family:inherit}.ee-field-item{display:flex;align-items:center;gap:6px}.ee-field-item .ee-field-info{flex:1;min-width:0}.ee-copy-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:1px solid transparent;border-radius:4px;background:transparent;color:var(--pd-text-muted);cursor:pointer;transition:color .15s,background .15s,border-color .15s}.ee-copy-btn:hover{background:var(--pd-surface, white);border-color:var(--pd-border);color:var(--pd-accent)}.ee-copy-btn.is-copied{color:var(--pd-success, #16a34a)}.ee-list-item:hover{background:var(--pd-hover-tint, #ecf5ff)}.ee-editor{flex:1;display:flex;flex-direction:column;background:var(--pd-sidebar);min-width:0}.ee-editor-section{padding:12px;border-bottom:1px solid var(--pd-border)}.ee-editor-title{font-size:11px;color:var(--pd-text-muted);margin-bottom:6px;text-transform:uppercase;letter-spacing:.5px}.ee-textarea{width:100%;border:1px solid var(--pd-border);border-radius:6px;padding:10px;font-family:monospace;font-size:13px;resize:vertical;box-sizing:border-box;min-height:100px}.ee-textarea:focus{outline:none;border-color:var(--pd-accent)}.ee-preview{padding:10px;background:var(--pd-bg);border:1px solid var(--pd-border);border-radius:6px;min-height:30px;font-size:13px;color:var(--pd-text);line-height:1.6;white-space:pre-wrap}.ee-preview-error{color:var(--pd-danger, #e53e3e);background:var(--pd-danger-bg, #fef2f2);border-color:var(--pd-danger-border, #fecaca)}.ee-help-section{flex:1;padding:12px;overflow-y:auto;min-height:0}.ee-help-title{font-size:11px;color:var(--pd-text-muted);margin-bottom:8px;text-transform:uppercase;letter-spacing:.5px}.ee-help-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.ee-help-card{border-radius:6px;padding:10px}.ee-help-card-title{font-size:12px;font-weight:600;margin-bottom:4px}.ee-help-card-content{font-size:11px;line-height:1.5;color:var(--pd-text)}.ee-help-field{background:var(--pd-help-field-bg, #f0f9ff);border:1px solid var(--pd-help-field-line, #bae6fd)}.ee-help-field .ee-help-card-title{color:var(--pd-help-field-ink, #0369a1)}.ee-help-function{background:var(--pd-help-function-bg, #f0fdf4);border:1px solid var(--pd-help-function-line, #bbf7d0)}.ee-help-function .ee-help-card-title{color:var(--pd-help-function-ink, #166534)}.ee-help-variable{background:var(--pd-help-variable-bg, #fefce8);border:1px solid var(--pd-help-variable-line, #fde68a)}.ee-help-variable .ee-help-card-title{color:var(--pd-help-variable-ink, #854d0e)}.ee-help-conditional{background:var(--pd-help-conditional-bg, #fdf2f8);border:1px solid var(--pd-help-conditional-line, #fbcfe8)}.ee-help-conditional .ee-help-card-title{color:var(--pd-help-conditional-ink, #9d174d)}.expression-editor{max-height:min(600px,80vh);overflow-y:auto;padding:16px}.col-width-row{display:flex;align-items:center;gap:8px;margin-bottom:4px;width:100%}.border-row{display:flex;gap:10px}.border-row .pd-field{flex:1;min-width:0}.advanced-row{display:flex;gap:16px}.group-help{flex:0 0 auto;width:18px;height:18px;margin-right:6px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;line-height:18px;cursor:pointer}.group-help:hover{background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF)}.group-help:focus-visible{outline:2px solid var(--pd-accent, #165DFF);outline-offset:1px}.image-content-upload{display:flex;flex-direction:column;align-items:flex-start;gap:4px;margin-top:4px}.upload-tip{margin:0;font-size:11px;color:var(--pd-text-muted, #909399)}.cell-style-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 8px}.cell-font-field{grid-column:1 / -1;padding-bottom:8px}.border-style-row{display:flex;gap:6px;margin-bottom:8px}.border-presets{margin-bottom:8px}.merge-btns{display:flex;gap:8px}.merge-card{margin-top:8px;padding:8px;border:1px solid var(--pd-border, #dcdfe6);border-radius:6px}.merge-card-title{font-size:12px;font-weight:600;color:var(--pd-text, #303133);margin-bottom:8px}.merge-card-divider{height:1px;background:var(--pd-menu-divider, #ebeef5);margin:8px 0}.merge-card-hint{margin-top:6px;font-size:11px;line-height:1.4;color:var(--pd-text-muted, #8b909c)}.watermark-config{padding:0 4px}.pd-hint{margin-left:8px;font-size:12px;color:#909399;min-width:32px}.design-background-config{padding:0 4px}.design-background-tip{margin:2px 0 6px;font-size:11px;line-height:1.4;color:var(--pd-text-muted, #909399)}.design-background-path{margin-bottom:6px;padding:4px 6px;font-size:11px;color:var(--pd-text-regular, #606266);background:var(--pd-fill-light, #f5f7fa);border-radius:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.design-background-actions{display:flex;gap:6px}.upload-label{cursor:pointer}.upload-label.disabled{opacity:.6;cursor:not-allowed}.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}.tiling-config{padding:0 4px}.tiling-switch{display:flex;align-items:center;gap:6px;font-size:12px;cursor:pointer}.tiling-error{color:#f56c6c}.tiling-summary{color:var(--pd-text-regular, #606266)}.property-panel{width:304px;min-width:304px;background:var(--pd-sidebar, #ffffff);border-left:1px solid var(--pd-border-soft, #e9ecf2);display:flex;flex-direction:column;overflow:hidden;transition:width .18s ease}.property-panel.collapsed{width:36px;min-width:36px;border-left:1px solid var(--pd-border-soft, #e9ecf2)}.prop-collapsed{display:flex;flex-direction:column;align-items:center;gap:8px;padding-top:12px;flex:1}.pc-btn{width:26px;height:26px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .14s ease}.pc-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.pc-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.prop-head{display:flex;align-items:center;justify-content:space-between;height:42px;padding:0 12px;flex-shrink:0;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.prop-title{font-size:12px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:1.2px;display:inline-flex;align-items:center;gap:7px}.prop-title:before{content:"";width:3px;height:12px;border-radius:2px;background:linear-gradient(180deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF))}.collapse-btn{border:none;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:14px;cursor:pointer;width:24px;height:24px;border-radius:5px;transition:all .14s ease}.collapse-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.prop-tabs{flex:1;display:flex;flex-direction:column;overflow:hidden}.prop-tabs .pd-tab-pane{flex:1;min-height:0;overflow-y:auto;padding:12px}.property-content{padding:0}.margin-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}.custom-size-grid{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:4px;width:100%}.custom-size-x{color:var(--pd-text-muted, #8b909c);font-size:12px}.pd-hint{margin:2px 0 6px;color:var(--pd-text-muted, #8b909c);font-size:12px;line-height:1.4}.page-bg-row{display:flex;align-items:center;gap:8px}.page-bg-picker{flex:1;min-width:0}.status-bar{position:relative;display:flex;align-items:center;gap:20px;height:30px;padding:0 16px;background:var(--pd-surface, #ffffff);border-top:1px solid var(--pd-border-soft, #e9ecf2);box-shadow:0 -1px 2px #17203c08;font-size:11.5px;color:var(--pd-text-muted, #8b909c);-webkit-user-select:none;user-select:none;flex-shrink:0}.status-item{white-space:nowrap;font-variant-numeric:tabular-nums;display:inline-flex;align-items:center}.coord{font-variant-numeric:tabular-nums;color:var(--pd-text, #2a2e37)}.status-paper{margin-left:auto;font-variant-numeric:tabular-nums;color:var(--pd-accent, #165DFF);font-weight:600}.status-version{font-variant-numeric:tabular-nums;color:var(--pd-text-muted, #8b909c)}.help-modal-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:1000}.help-modal{width:800px;max-width:90vw;height:600px;max-height:85vh;background:var(--pd-surface, #ffffff);border-radius:8px;box-shadow:0 4px 24px #00000026;display:flex;flex-direction:column;overflow:hidden}.help-modal-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid var(--pd-border, #d9dde6)}.help-modal-title{margin:0;font-size:16px;font-weight:600;color:var(--pd-text, #2a2e37)}.help-modal-title-wrap{display:flex;align-items:center;gap:10px}.help-modal-project{padding:2px 8px;border-radius:4px;background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF);font-size:12px;font-weight:500}.help-modal-close{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;border-radius:4px;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:20px;cursor:pointer;transition:all .15s}.help-modal-close:hover{background:var(--pd-sidebar-hover, #f0f3f9);color:var(--pd-text, #2a2e37)}.help-modal-body{flex:1;display:flex;overflow:hidden}.help-modal-sidebar{width:160px;padding:12px;border-right:1px solid var(--pd-border, #d9dde6);background:var(--pd-field-bg, #f4f6fa);overflow-y:auto}.help-tab{display:block;width:100%;padding:10px 12px;margin-bottom:4px;border:none;border-radius:4px;background:transparent;color:var(--pd-text, #2a2e37);font-size:13px;text-align:left;cursor:pointer;transition:all .15s}.help-tab:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.help-tab.active{background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF);font-weight:500}.help-modal-content{flex:1;padding:20px;overflow-y:auto}.help-content{font-size:14px;line-height:1.6;color:var(--pd-text, #2a2e37)}.help-content h2{margin:0 0 16px;padding-bottom:8px;border-bottom:1px solid var(--pd-border-soft, #e9ecf2);font-size:18px;font-weight:600}.help-content h3{margin:20px 0 12px;font-size:15px;font-weight:600}.help-content p{margin:0 0 12px}.help-content ul,.help-content ol{margin:0 0 12px;padding-left:24px}.help-content li{margin-bottom:4px}.help-content code{padding:2px 6px;border-radius:3px;background:var(--pd-field-bg, #f4f6fa);font-family:SF Mono,Monaco,monospace;font-size:13px}.help-content pre{margin:0 0 12px;padding:12px;border-radius:4px;background:var(--pd-field-bg, #f4f6fa);overflow-x:auto}.help-content pre code{padding:0;background:transparent}.help-content table{width:100%;margin:0 0 12px;border-collapse:collapse}.help-content th,.help-content td{padding:8px 12px;border:1px solid var(--pd-border, #d9dde6);text-align:left}.help-content th{background:var(--pd-field-bg, #f4f6fa);font-weight:600}.help-content blockquote{margin:0 0 12px;padding:12px 16px;border-left:3px solid var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.help-modal-enter-active,.help-modal-leave-active{transition:opacity .2s ease}.help-modal-enter-active .help-modal,.help-modal-leave-active .help-modal{transition:transform .2s ease}.help-modal-enter-from,.help-modal-leave-to{opacity:0}.help-modal-enter-from .help-modal,.help-modal-leave-to .help-modal{transform:scale(.95)}.page-tabs{display:flex;align-items:center;gap:8px;padding:4px 12px;background:var(--pd-sidebar, #fff);border-bottom:1px solid var(--pd-border, #d9dde6);flex-shrink:0}.page-tabs-list{display:flex;gap:4px;overflow-x:auto;align-items:center}.page-tab{padding:4px 12px;border:1px solid var(--pd-border, #d9dde6);border-radius:4px;background:transparent;cursor:pointer;white-space:nowrap;color:var(--pd-text, #2a2e37);font-size:12px}.page-tab.active{background:var(--pd-accent, #165DFF);color:#fff}.page-tab-rename{padding:4px 8px;width:96px;border:1px solid var(--pd-accent, #165DFF);border-radius:4px;font-size:12px;color:var(--pd-text, #2a2e37);outline:none}.page-tabs-actions{display:flex;gap:4px;margin-left:auto}.page-tabs-actions button{padding:4px 8px;border:1px solid var(--pd-border, #d9dde6);border-radius:4px;background:transparent;cursor:pointer;color:var(--pd-text-muted, #8b909c);font-size:12px;line-height:1}.page-tabs-actions button:disabled{opacity:.4;cursor:not-allowed}.designer-container{--pd-bg: #f3f5f9;--pd-surface: #ffffff;--pd-field-bg: #f4f6fa;--pd-sidebar: #ffffff;--pd-sidebar-hover: #f0f3f9;--pd-canvas-bg: #e6e9f0;--pd-paper: #FFFFFF;--pd-accent: #165DFF;--pd-accent-2: #3D7BFF;--pd-accent-soft: rgba(22, 93, 255, .09);--pd-accent-secondary: #f56c6c;--pd-danger-soft: rgba(245, 108, 108, .1);--pd-ink-green: #67c23a;--pd-text: #2a2e37;--pd-text-muted: #8b909c;--pd-text-faint: #b4b9c4;--pd-border: #d9dde6;--pd-border-soft: #e9ecf2;--pd-input-bg: #ffffff;--pd-hover-tint: #ecf5ff;--pd-danger: #e53e3e;--pd-danger-bg: #fef2f2;--pd-danger-border: #fecaca;--pd-menu-text: #333;--pd-menu-hover: #f5f7fa;--pd-menu-border: #dcdfe6;--pd-menu-divider: #ebeef5;--pd-menu-muted: #909399;--pd-menu-disabled: #c0c4cc;--pd-scrollbar: rgba(23, 32, 60, .18);--pd-scrollbar-thumb: rgba(23, 32, 60, .16);--pd-scrollbar-thumb-hover: rgba(23, 32, 60, .3);--pd-help-field-bg: #f0f9ff;--pd-help-field-line: #bae6fd;--pd-help-field-ink: #0369a1;--pd-help-function-bg: #f0fdf4;--pd-help-function-line: #bbf7d0;--pd-help-function-ink: #166534;--pd-help-variable-bg: #fefce8;--pd-help-variable-line: #fde68a;--pd-help-variable-ink: #854d0e;--pd-help-conditional-bg: #fdf2f8;--pd-help-conditional-line: #fbcfe8;--pd-help-conditional-ink: #9d174d;--pd-handle: #165DFF;--pd-ruler: #9aa1af;--pd-ruler-bg: #f8f9fc;--pd-ruler-cursor: #165DFF;--pd-radius: 6px;--pd-shadow-sm: 0 1px 2px rgba(23, 32, 60, .05);--pd-shadow-md: 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07);--pd-shadow-paper: 0 0 0 1px rgba(23, 32, 60, .05), 0 1px 2px rgba(23, 32, 60, .06), 0 8px 20px rgba(23, 32, 60, .08), 0 26px 60px rgba(23, 32, 60, .15);--pd-success: #16a34a;--pd-text-regular: #606266;--pd-fill-light: #f5f7fa;height:100%;display:flex;flex-direction:column;background:var(--pd-bg)}.designer-body{flex:1;display:flex;overflow:hidden}.designer-container.format-painting .canvas-area,.designer-container.format-painting .canvas-area *{cursor:copy!important}.print-html-preview{width:100%;height:100%;position:relative;background:#e9ebee}.print-html-preview-iframe{width:100%;height:100%;border:0;background:#fff}.print-html-preview-loading,.print-html-preview-error{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:#909399;font-size:14px}.print-html-preview-error{color:#f56c6c}.print-html-preview-warn{position:absolute;top:8px;left:12px;z-index:2;max-width:62%;padding:4px 8px;border:1px solid #e6a23c;border-radius:4px;background:#faecd1f0;color:#b88230;font-size:12px;line-height:1.5}.print-html-preview-zoom{position:absolute;top:8px;right:12px;z-index:2;display:flex;align-items:center;gap:4px;padding:3px 4px;border:1px solid var(--pd-border-soft, #ebeef5);border-radius:6px;background:#ffffffeb;box-shadow:0 1px 4px #00000014}.print-html-preview-zoom-btn{padding:2px 7px;border:0;border-radius:4px;background:transparent;color:var(--pd-text-muted, #909399);font-size:11px;line-height:18px;cursor:pointer;transition:color .14s ease,background .14s ease}.print-html-preview-zoom-btn:hover{background:var(--pd-sidebar-hover, #f0f3f9);color:var(--pd-text, #2a2e37)}.print-html-preview-zoom-btn.active{background:var(--pd-accent, #165DFF);color:#fff;font-weight:600}.print-html-preview-zoom-note{padding-right:4px;color:var(--pd-text-muted, #909399);font-size:11px}.print-html-preview-zoom-hint{color:#b88230;font-size:11px}.advanced-row{display:flex;flex-direction:column;gap:10px}.advanced-row .pd-label,.advanced-row .pd-label-t{white-space:nowrap}.tiling-config .margin-grid,.tiling-config .custom-size-grid{display:block;grid-template-columns:none;gap:normal}.tiling-config .custom-size-x{display:inline;min-width:0;color:inherit}.pd-hint{min-width:auto}.watermark-config .pd-hint{min-width:32px;margin-left:8px;color:#909399}.tiling-config .tiling-error{color:#f56c6c}.tiling-config .tiling-summary{color:var(--pd-text-regular, #606266)}.pd-help{position:static}.pd-help:after{top:calc(100% + 6px);bottom:auto;left:0;transform:none;padding:5px 7px;white-space:normal;z-index:120}.page-tabs [data-tip]:after,.field-tree-panel [data-tip]:after{content:none}',po=20;function nn(e){try{const t=JSON.parse(e);if(t&&typeof t=="object"&&!Array.isArray(t))return t}catch{}}const Yp=".page-tabs, .field-tree-panel, .pd-dialog-overlay",jp=new Set(["z","y","a","c","x","v","d","g","1","l","r","e","t","b","0"]),an="print-studio:left",ln="print-studio:right";function sn(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function dn(e,t){try{localStorage.setItem(e,t?"1":"0")}catch{}}function fr(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return}if(Array.isArray(t))return t.filter(o=>!!o&&typeof o=="object"&&!Array.isArray(o));if(t&&typeof t=="object")return[t]}class tt extends HTMLElement{root;store;format;unsub=null;unsubPluginUI=null;unsubDefinitions=null;pluginStyleEls=new Map;instanceDisposers=[];_lang;_messages;unsubI18n=null;measureRaf=null;state={leftTab:"elements",leftCollapsed:!1,propTab:"page",propCollapsed:!1,openDd:null,openMore:!1,collapsedGroups:new Set,renamingPage:null,fieldDisplay:"both"};geom={originX:0,originY:0,viewW:0,viewH:0,paperScale:1};static active=null;docKeydown=null;docDragend=null;ro=null;roArea=null;toolbarRo=null;scrollPos={x:0,y:0};paneScroll=new Map;marquee={visible:!1,x:0,y:0,w:0,h:0};menu={visible:!1,x:0,y:0,flipX:0,flipY:0,targetId:null};guidePreview=null;zoneResizing=null;tableMenu={visible:!1,x:0,y:0};exprTarget=null;exprMountedFor=null;helpVisible=!1;helpInitialTab;unmountHelp=null;drag=null;snapTimer=null;hoverTipEl=null;hoverTipTimer=null;resize=null;raf=0;lastSelKey="";chromeKey="";_theme="auto";_themeConfig;systemDark=!1;themeMedia=null;onThemeMediaChange=()=>{this.systemDark=this.themeMedia?.matches??!1,this.applyTheme()};appliedThemeTokens=[];uploadImage;uploadDesignBackground;_designData;set designData(t){this._designData=fr(t),this.repaint()}get designData(){return this._designData}_fonts;set fonts(t){this._fonts=t,this.applyFontFace(),this.repaint()}get fonts(){return this._fonts}fontFaceStyle=null;docFontFaceStyle=null;constructor(){super(),this.root=this.attachShadow({mode:"open"});const t=document.createElement("style");t.textContent=qp,this.root.appendChild(t),Se(l("div",{class:"designer-container",dataset:{test:"designer-container"},part:"container"}),this.root)}set template(t){this.applyTemplate(t)}get template(){return this.store?.getTemplateJson()}set fields(t){this.store.fields=(typeof t=="string"?JSON.parse(t):t)??[],this.repaint()}set isEdit(t){this.setAttribute("is-edit",String(t)),this.repaint()}set showHelp(t){this.setAttribute("show-help",String(t)),t||this.closeHelp(),this.repaint()}set showPreview(t){this.setAttribute("show-preview",String(t)),this.repaint()}set showSave(t){this.setAttribute("show-save",String(t)),this.repaint()}set fieldDisplay(t){const o=ho(t);this.state.fieldDisplay=o,this.getAttribute("field-display")!==o&&this.setAttribute("field-display",o),this.repaint()}get fieldDisplay(){return this.state.fieldDisplay??"both"}set lang(t){this._lang=t?we.normalizeLocale(t):void 0,t===void 0?this.hasAttribute("lang")&&this.removeAttribute("lang"):this.getAttribute("lang")!==this._lang&&this.setAttribute("lang",this._lang),this.helpVisible&&this.unmountHelp&&(this.unmountHelp(),this.unmountHelp=null),this.repaint()}get lang(){return this._lang??we.getLocale()}set messages(t){this._messages=t,this.repaint()}setLocale(t){this.lang=we.normalizeLocale(t)}set theme(t){const o=t==="dark"||t==="light"?t:"auto";this._theme=o,this.setAttribute("theme",o),this.applyTheme()}get theme(){return this._theme}set themeConfig(t){const o=typeof t=="string"?nn(t):t;this._themeConfig=o,o===void 0?this.removeAttribute("theme-config"):this.setAttribute("theme-config",JSON.stringify(o)),this.applyTheme()}get themeConfig(){return this._themeConfig}static contractVersion=zr;static getHostContract(){return yr()}getHostContract(){return yr()}static get observedAttributes(){return[...Or]}attributeChangedCallback(t,o,r){if(t==="design-data"){this._designData=r===null?void 0:fr(r),this.repaint();return}if(t==="theme"){this._theme=r==="dark"||r==="light"?r:"auto",this.applyTheme();return}if(t==="theme-config"){this._themeConfig=r?nn(r):void 0,this.applyTheme();return}if(t==="field-display"){this.state.fieldDisplay=ho(r),this.repaint();return}if(t==="lang"){this.lang=r??void 0;return}if(!r)return;if(t==="name"){this.repaint();return}let i;try{i=JSON.parse(r)}catch{return}t==="template"?this.applyTemplate(i):t==="fields"?(this.store.fields=i,this.repaint()):t==="fonts"&&Array.isArray(i)&&(this.fonts=i)}connectedCallback(){if(this.attachThemeMedia(),this.applyTheme(),this.store){this.applyFontFace(),this.attachDocKeys(),this.attachPluginUI(),this.attachInstanceListeners(),this.unsubI18n=we.subscribe(()=>{this._lang||this.repaint()});return}const t={},o=this.getAttribute("template");if(o)try{t.initialTemplate=JSON.parse(o)}catch{}const r=this.getAttribute("fields");if(r)try{t.initialFields=JSON.parse(r)}catch{}const i=this.getAttribute("design-data");i&&this._designData===void 0&&(this._designData=fr(i)),this.store=new un(t),this.format=new Oa(this.store),this.store.onSelectionChanged=()=>this.format.painterSyncSelection(),this.state.fieldDisplay=ho(this.getAttribute("field-display")),this.readChrome(),this.unsub=this.store.subscribe(()=>this.repaint()),this.unsubI18n=we.subscribe(()=>{this._lang||this.repaint()}),this.attachDocKeys(),this.attachPluginUI(),this.attachInstanceListeners(),this.applyFontFace(),this.repaint(),this.measureRaf=requestAnimationFrame(()=>{this.measureRaf=null,this.measureRuler()})}attachThemeMedia(){typeof window>"u"||typeof window.matchMedia!="function"||(this.detachThemeMedia(),this.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),this.systemDark=this.themeMedia.matches,this.themeMedia.addEventListener("change",this.onThemeMediaChange))}detachThemeMedia(){this.themeMedia?.removeEventListener("change",this.onThemeMediaChange),this.themeMedia=null}applyTheme(){const t=this.root.querySelector(".designer-container");if(!t)return;for(const i of this.appliedThemeTokens)t.style.removeProperty(i);if(this.appliedThemeTokens=[],(this._theme==="dark"||this._theme==="light"?this._theme:this.systemDark?"dark":"light")==="dark")for(const[i,n]of Object.entries(sl))n!==void 0&&(t.style.setProperty(i,n),this.appliedThemeTokens.push(i));const r=this._themeConfig?.overrides;if(r)for(const[i,n]of Object.entries(r))!i.startsWith("--pd-")||typeof n!="string"||(t.style.setProperty(i,n),this.appliedThemeTokens.includes(i)||this.appliedThemeTokens.push(i))}readChrome(){this.state.leftCollapsed=sn(an),this.state.propCollapsed=sn(ln),this.chromeKey=`${this.state.leftCollapsed?1:0}|${this.state.propCollapsed?1:0}`}persistChrome(){const t=`${this.state.leftCollapsed?1:0}|${this.state.propCollapsed?1:0}`;t!==this.chromeKey&&(this.chromeKey=t,dn(an,this.state.leftCollapsed),dn(ln,this.state.propCollapsed))}disconnectedCallback(){this.detachThemeMedia(),this.unsub?.(),this.unsub=null,this.unsubI18n?.(),this.unsubI18n=null,this.unsubPluginUI?.(),this.unsubPluginUI=null,this.unsubDefinitions?.(),this.unsubDefinitions=null,Fi(),this.detachDocKeys(),this.ro?.disconnect(),this.ro=null,this.roArea=null,this.toolbarRo?.disconnect(),this.toolbarRo=null,tt.active===this&&(tt.active=null),Kn(),this.unmountHelp?.(),this.unmountHelp=null,this.hideHoverTip(),this.snapTimer&&(clearTimeout(this.snapTimer),this.snapTimer=null);for(const t of this.instanceDisposers)t();this.instanceDisposers=[],this.docFontFaceStyle?.remove(),this.docFontFaceStyle=null,this.measureRaf!==null&&(cancelAnimationFrame(this.measureRaf),this.measureRaf=null)}applyFontFace(){const t=R.buildFontFaceCss(this._fonts);if(!t){this.fontFaceStyle?.remove(),this.fontFaceStyle=null,this.docFontFaceStyle?.remove(),this.docFontFaceStyle=null;return}this.fontFaceStyle||(this.fontFaceStyle=document.createElement("style"),this.root.appendChild(this.fontFaceStyle)),this.fontFaceStyle.textContent=t,this.docFontFaceStyle||(this.docFontFaceStyle=document.createElement("style"),this.ownerDocument.head.appendChild(this.docFontFaceStyle)),this.docFontFaceStyle.textContent=t}attachPluginUI(){this.unsubPluginUI||(this.unsubPluginUI=gr.subscribeElementUIRegistry(()=>this.repaint())),this.unsubDefinitions||(this.unsubDefinitions=bn(()=>this.repaint()))}syncPluginUIStyles(){const t=new Map;for(const{type:o,ui:r}of gr.getElementUIEntries())r.styles&&t.set(o,r.styles);for(const[o,r]of[...this.pluginStyleEls])t.has(o)||(r.remove(),this.pluginStyleEls.delete(o));for(const[o,r]of t){let i=this.pluginStyleEls.get(o);i||(i=document.createElement("style"),i.setAttribute("data-plugin-ui",o),this.root.appendChild(i),this.pluginStyleEls.set(o,i)),i.textContent!==r&&(i.textContent=r)}}templateJsonWithFonts(){const t=JSON.parse(this.store.getTemplateJson()),o=this.fonts;if(!o?.length)return t;if(Array.isArray(t.pages)){const r=t;return{...r,pages:r.pages.map(i=>({...i,fonts:[...o]}))}}return{...t,fonts:[...o]}}getTemplateJson(){return JSON.stringify(this.templateJsonWithFonts())}loadTemplate(t){this.applyTemplate(t)}save(){const t=this.validateTemplate();if(t.length){window.alert(t[0].message),this.state.propTab="page",this.repaint();return}const o=this.templateJsonWithFonts();if(Array.isArray(o.pages))try{R.normalizeTemplate(o)}catch(n){window.alert(n instanceof Error?n.message:String(n));return}const r=this.getGeometryWarnings();if(r.length&&!window.confirm((this.ctx.t??we.t)("save.geometryWarningConfirm",{warnings:r.join(`
1962
+ `)})))return;const i=JSON.stringify(o);this.store.dirty=!1,this.repaint(),this.dispatchEvent(new CustomEvent(Be.save,{detail:i,bubbles:!0,composed:!0}))}validateTemplate(){const t=this.store.templateData;return t.tiling?.enabled===!0?R.validateTiling(t):[]}getGeometryWarnings(){return R.collectPrintWarnings(this.store.templateData)}applyTemplate(t){if(!t)return;const o=typeof t=="string"?JSON.parse(t):t;this.store?this.store.loadTemplate(o):this.setAttribute("template",JSON.stringify(o))}openExpression(t){this.exprTarget=t,this.syncExpression()}closeExpression(){this.exprTarget=null,this.syncExpression()}syncExpression(){const t=Array.from(this.root.querySelectorAll(".pd-dialog-overlay"));if(!this.exprTarget){t.forEach(r=>r.remove()),this.exprMountedFor=null;return}if(this.exprMountedFor===this.exprTarget)return;t.forEach(r=>r.remove());const o=this.exprTarget;Se(gp({fields:this.store.fields,fieldDisplay:this.state.fieldDisplay,t:this.ctx.t,onClose:()=>this.closeExpression(),onApply:r=>this.applyExpression(o,r)},o),this.root),this.exprMountedFor=o}openHelp(t){this.helpInitialTab=t,this.helpVisible=!0,this.syncHelp()}closeHelp(){this.helpVisible&&(this.helpVisible=!1,this.syncHelp())}syncHelp(){const t=this.helpVisible&&this.getAttribute("show-help")!=="false";if(t&&!this.unmountHelp)this.unmountHelp=Hp(this.root,{initialTab:this.helpInitialTab,locale:this.lang,t:we.createTranslator(this.lang,this._messages),onClose:()=>this.closeHelp()});else if(!t&&this.unmountHelp){const o=this.unmountHelp;this.unmountHelp=null,o()}}applyExpression(t,o){const r=o.formatter??"",i=t.targetPath;if(i.startsWith("options.")){if(i.includes("[")){const s=this.store.elements.find(d=>d.id===t.elementId);s&&Vr(this.store,s,i,r);return}const n={[i.slice(8)]:r||void 0};o.title!==void 0&&(n.title=o.title),this.store.updateElement(t.elementId,n);return}if(i==="watermark.content"){const n={...this.store.templateData.watermark};Sr(r)?Object.assign(n,{mode:"binding",binding:r,content:""}):Object.assign(n,{mode:"fixed",content:r,binding:""}),this.store.updateTemplateData({watermark:n})}}dblEditElement(t){const o=this.store.elements.find(i=>i.id===t);if(!o||(this.store.selectOne(t),this.state.propTab=br(o)?"custom":"element",o.options.locked))return;const r=kn(o.printElementType.type);r&&this.openExpression({elementId:o.id,targetPath:`options.${r}`,value:String(o.options[r]??"")})}dblEditCell(t){const o=this.store.elements.find(d=>d.id===t.elementId);if(!o||(this.store.selectOne(o.id),this.state.propTab="element",o.options.locked))return;const r=o.options.tableRows??[],i=h.findMainCell(r,t.r,t.c),s=r[i.r]?.cells[i.c];s&&this.openExpression({elementId:o.id,targetPath:`options.tableRows[${i.r}].cells[${i.c}].formatter`,value:s.formatter??""})}get ctx(){return{store:this.store,format:this.format,state:this.state,repaint:()=>this.repaint(),fire:(t,o)=>this.fire(t,o),showHelp:this.getAttribute("show-help")!=="false",showPreview:this.getAttribute("show-preview")!=="false",showSave:this.getAttribute("show-save")!=="false",isEdit:this.getAttribute("is-edit")==="true",t:we.createTranslator(this.lang,this._messages),lang:this.lang,host:{uploadImage:this.uploadImage,uploadDesignBackground:this.uploadDesignBackground,fonts:this.fonts,designData:this.designData,fields:this.store.fields}}}canvasUi(){return{geom:this.geom,marquee:this.marquee,contextMenu:this.menu,guidePreview:this.guidePreview,zoneResizing:this.zoneResizing,scrollX:this.scrollPos.x,scrollY:this.scrollPos.y}}repaint(){this.raf||(this.raf=requestAnimationFrame(()=>{this.raf=0,this.paint()}))}paint(){Ja(we.createTranslator(this.lang,this._messages),()=>this.paintInternal())}paintInternal(){if(!this.store)return;Fi(),this.syncPluginUIStyles();const t=[...this.store.selectedIds].join(",");if(t!==this.lastSelKey){this.lastSelKey=t;const s=this.store.selectedElement;this.state.propTab=s?br(s)?"custom":"element":"page"}const o=this.root.querySelector(".designer-container");o.classList.toggle("format-painting",this.format.painterActive);for(const s of o.querySelectorAll("[data-pane]"))s.style.display!=="none"&&this.paneScroll.set(s.dataset.pane,s.scrollTop);cn(o);const r=this.ctx;Se(Vp(r,pd(r)),o),Se(vd(r),o),Se(l("div",{class:"designer-body"},[hd(r),ad(r,this.canvasUi()),ep(r)]),o),Se(xd(r),o),tn(o),!this.toolbarRo&&typeof ResizeObserver<"u"&&(this.toolbarRo=new ResizeObserver(()=>tn(o)),this.toolbarRo.observe(o));const i=As(this.store,(s,d)=>this.fire(s,d),this.tableMenu);i&&Se(i,o),es(this.root,this.store.elements,this.designData),jn(this.root,this.state.propSearch),this.applyShrinkFit();const n=this.root.querySelector(".canvas-area");n&&(n.scrollLeft=this.scrollPos.x,n.scrollTop=this.scrollPos.y);for(const s of o.querySelectorAll("[data-pane]")){const d=this.paneScroll.get(s.dataset.pane);d!==void 0&&(s.scrollTop=d)}this.syncRulers(),this.persistChrome(),this.applyHostParts(o)}applyHostParts(t){const o={".designer-toolbar":"toolbar",".format-toolbar":"format-bar",".left-panel":"left-panel",".canvas-area":"canvas-area",".property-panel":"property-panel",".status-bar":"status-bar",".page-tabs":"page-tabs"};for(const[r,i]of Object.entries(o)){const n=t.querySelector(r);n&&Nr.includes(i)&&n.setAttribute("part",i)}}applyShrinkFit(){for(const t of Array.from(this.root.querySelectorAll('[data-fit="shrink"]')))Dr.fitTextNode(t);for(const t of Array.from(this.root.querySelectorAll("[data-fit-size]"))){if(t.getAttribute("data-fit")==="shrink")continue;t.removeAttribute("data-fit-size");const o=t.getAttribute("data-fit-base");o?t.style.fontSize=`${o}pt`:t.style.removeProperty("font-size")}}measureRuler(){const t=this.root.querySelector(".canvas-area"),o=this.root.querySelector(".hiprint-printPaper");if(!t||!o)return;const r=t.getBoundingClientRect(),i=o.getBoundingClientRect(),n=(this.store.scale||100)/100,s=i.width/h.mmToPx(this.store.paperSize.width);this.geom={paperScale:Math.abs(s-n)<.002?n:s,originX:i.left-r.left-po,originY:i.top-r.top-po,viewW:t.clientWidth-po,viewH:t.clientHeight-po},this.observeCanvasArea()}observeCanvasArea(){const t=this.root.querySelector(".canvas-area");!t||typeof ResizeObserver>"u"||this.roArea===t||(this.roArea=t,this.ro?.disconnect(),this.ro=new ResizeObserver(()=>this.syncRulers()),this.ro.observe(t))}syncRulers(){this.measureRuler();const t=this.store.templateData,o=h.getPaperDimensions(t),r=this.geom.paperScale;for(const i of Array.from(this.root.querySelectorAll(".pd-ruler"))){const n=i.dataset.ruler==="vertical"?"vertical":"horizontal";Gp(i,{orientation:n,geom:this.geom,scale:r,paperLengthMM:n==="horizontal"?o.width:o.height})}}patchElementDom(){for(const r of this.store.elements){const i=this.root.querySelector(`[data-el-id="${CSS.escape(r.id)}"]`);i&&(i.style.left=`${r.options.left}mm`,i.style.top=`${r.options.top}mm`,i.style.width=`${r.options.width}mm`,i.style.height=`${r.options.height}mm`)}const t=this.root.querySelector(".position-label"),o=this.store.selectedElement;t&&o&&!this.drag&&(t.textContent=Vn(o.options))}fire(t,o){const r=this.store;switch(t){case"undo":r.undo();break;case"redo":r.redo();break;case"align":r.alignSelected(o);break;case"move-layer":r.moveLayer(o);break;case"group":r.groupSelected();break;case"ungroup":r.ungroupSelected();break;case"copy":r.copy();break;case"cut":r.cutSelected();break;case"paste":r.paste();break;case"paste-at":r.paste();break;case"delete":r.deleteSelected();break;case"delete-page":r.deletePage(r.activePageIndex);break;case"add-page":r.addPage();break;case"duplicate-page":r.duplicatePage(r.activePageIndex);break;case"move-page":r.movePage(r.activePageIndex,r.activePageIndex+o);break;case"select-all":r.selectAll();break;case"clear-selection":r.clearSelection();break;case"toggle-ruler":r.showRuler=!r.showRuler,this.repaint();break;case"toggle-grid":r.showGrid=!r.showGrid,this.repaint();break;case"toggle-snap":r.snapToGrid=!r.snapToGrid,this.repaint();break;case"toggle-table-ghost-border":r.showTableGhostBorder=!r.showTableGhostBorder,this.repaint();break;case"fit-window":this.fitToWindow();break;case"zoom":this.zoomByStep(o>0?1:-1);break;case"preview":this.dispatchEvent(new CustomEvent(Be.preview,{detail:this.getTemplateJson(),bubbles:!0,composed:!0}));break;case"save":this.save();break;case"help":this.dispatchEvent(new CustomEvent(Be.help,{bubbles:!0,composed:!0})),this.openHelp(o);break;case"guide-remove":r.removeGuide(o);break;case"resize-start":this.beginResize(o);break;case"element-mousedown":{const i=o;i.event.button===0&&this.isDoubleTap(`el:${i.id}`,i.event)&&this.fire("element-dblclick",{event:i.event,id:i.id}),this.beginDrag(i);break}case"table-cell-mousedown":{const i=o;this.isDoubleTap(`cell:${i.elementId}:${i.r}:${i.c}`,i.event)&&(this.taps.delete(`el:${i.elementId}`),this.fire("table-cell-dblclick",{elementId:i.elementId,r:i.r,c:i.c,cellId:i.cellId}));break}case"zone-resize":this.beginZoneResize(o);break;case"guide-mousedown":this.beginGuideDrag(o);break;case"ruler-mousedown":this.beginRulerGuide(o);break;case"canvas-mousedown":this.onCanvasMouseDown(o);break;case"canvas-mousemove":this.onCanvasMouseMove(o);break;case"canvas-mouseleave":this.clearCoord();break;case"canvas-contextmenu":this.onContextMenu(o);break;case"contextmenu":this.onElementContextMenu(o);break;case"element-dblclick":{const{id:i}=o;this.dblEditElement(i),this.dispatchEvent(new CustomEvent(Be.dblclickElement,{detail:i,bubbles:!0,composed:!0}));break}case"table-cell-dblclick":{const i=o;this.dblEditCell(i),this.dispatchEvent(new CustomEvent(Be.dblclickCell,{detail:{elementId:i.elementId,r:i.r,c:i.c,cellId:i.cellId},bubbles:!0,composed:!0}));break}case"open-expression":this.openExpression(o);break;case"drop":this.onDrop(o);break;case"wheel":this.onWheel(o);break;case"scroll":this.onScroll();break}}onDrop(t){t.preventDefault();const o=t.dataTransfer,r=o?.getData("elementType"),i=o?.getData("fieldKey"),n=this.pointToPaperMm(t);if(!n)return;const s={x:n.left,y:n.top};if(r)this.store.addElement(r,{},s);else if(i){const d=this.store.fields.find(c=>c.fieldKey===i);d&&this.store.addFieldElement(d,{},s,t.ctrlKey||t.metaKey||t.labelIntent===!0)}}pointToPaperMm(t){const o=this.root.querySelector(".hiprint-printPaper");if(!o)return null;const r=o.getBoundingClientRect(),i=(this.store.scale||100)/100,n=h.pxToMm((t.clientX-r.left)/i),s=h.pxToMm((t.clientY-r.top)/i);return n<0||s<0?null:{left:n,top:s}}onCanvasMouseDown(t){const o=t.target;(o===this.root.querySelector(".canvas-area")||["canvas-scroll","hiprint-printPaper","hiprint-printPaper-content","zone-layer","grid-bg","watermark-layer"].some(i=>o.classList.contains(i)))&&(this.menu.visible=!1,this.state.openDd&&(this.state.openDd=null,this.repaint()),this.state.openMore&&(this.state.openMore=!1,this.repaint()),t.button===0&&(this.store.clearSelection(),this.startMarquee(t)))}onCanvasMouseMove(t){const o=this.pointToPaperMm(t),r=this.root.querySelector("[data-coord]");if(r){if(!o){r.style.display="none";return}r.style.display="",r.textContent=`x:${(o.left-this.store.templateData.margins.left).toFixed(1)} y:${(o.top-this.store.templateData.margins.top).toFixed(1)}mm`}}clearCoord(){const t=this.root.querySelector("[data-coord]");t&&(t.textContent="")}onContextMenu(t){this.openMenu(t,null)}onElementContextMenu(t){this.store.selectedIds.has(t.id)||this.store.selectOne(t.id),this.openMenu(t.event,t.id)}openMenu(t,o){this.menu.x=t.clientX,this.menu.y=t.clientY,this.menu.targetId=o,this.menu.visible=!0,this.menu.flipX=0,this.menu.flipY=0,this.repaint(),requestAnimationFrame(()=>{const r=this.root.querySelector(".context-menu");if(!r)return;const i=r.getBoundingClientRect();this.menu.flipX=i.right>window.innerWidth?window.innerWidth-i.right-8:0,this.menu.flipY=i.bottom>window.innerHeight?window.innerHeight-i.bottom-8:0,this.paint()})}startMarquee(t){const o={x:t.clientX,y:t.clientY},r=n=>{this.marquee={visible:!0,x:Math.min(o.x,n.clientX),y:Math.min(o.y,n.clientY),w:Math.abs(n.clientX-o.x),h:Math.abs(n.clientY-o.y)},this.paint()},i=()=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",i);const n={...this.marquee};if(this.marquee={visible:!1,x:0,y:0,w:0,h:0},n.w>2&&n.h>2){const s=this.store.elements.filter(d=>{const c=this.root.querySelector(`[data-el-id="${CSS.escape(d.id)}"]`);if(!c)return!1;const u=c.getBoundingClientRect();return u.left<n.x+n.w&&u.right>n.x&&u.top<n.y+n.h&&u.bottom>n.y});this.store.select(new Set(s.map(d=>d.id)))}else this.repaint()};window.addEventListener("mousemove",r),window.addEventListener("mouseup",i)}taps=new Map;isDoubleTap(t,o){const r=this.taps.get(t);return this.taps.set(t,{t:o.timeStamp,x:o.clientX,y:o.clientY}),!r||o.timeStamp-r.t>=500||Math.abs(o.clientX-r.x)>6||Math.abs(o.clientY-r.y)>6?!1:(this.taps.delete(t),!0)}beginDrag(t){const o=t.event;if(o.button!==0)return;const r=this.store;o.stopPropagation();const i=r.elements.find(d=>d.id===t.id);if(!i||(r.selectElement(i.id,o.ctrlKey||o.metaKey),i.options.locked))return;const n=o.altKey?[i.id]:r.dragIds(i.id),s=new Map;for(const d of n){const c=r.elements.find(u=>u.id===d);c&&s.set(d,{left:c.options.left,top:c.options.top})}this.drag={ids:n,primary:i.id,altKey:o.altKey,movedPositions:new Map,startX:o.clientX,startY:o.clientY,origin:s,zone:i.zone||"content",moved:!1},r.draggingIds=new Set(n),r.dragStart(),this.syncDragGhost()}syncDragGhost(){const t=this.store.draggingIds;for(const o of Array.from(this.root.querySelectorAll(".print-element"))){const r=t.has(o.dataset.elId??"");o.classList.toggle("drag-ghost",r);const i=o.querySelector(":scope > .drag-preview");r&&!i?Se(l("div",{class:"drag-preview"}),o):!r&&i&&i.remove()}}finishAltClone(t){const o=this.store;o.adsorbGuides=[];const r=o.elements.find(s=>s.id===t.primary),i=t.movedPositions.get(t.primary);if(o.discardLive(),!r||!i)return;const n=JSON.parse(JSON.stringify(r));n.id=h.generateId(),n.options.left=i.left,n.options.top=i.top,n.options.groupId=void 0,o.cloneElement(n)}flashSnapIndicator(t,o){const r=this.root.querySelector(".hiprint-printPaper-content");r&&(r.querySelector(".snap-indicator")?.remove(),Se(l("div",{class:"snap-indicator",style:{left:`${t}mm`,top:`${o}mm`}}),r),this.snapTimer&&clearTimeout(this.snapTimer),this.snapTimer=setTimeout(()=>{r.querySelector(".snap-indicator")?.remove(),this.snapTimer=null},300))}beginResize(t){const o=t.event;o.stopPropagation();const r=this.store.elements.find(i=>i.id===t.id);!r||r.options.locked||(this.resize={id:t.id,point:t.point,startX:o.clientX,startY:o.clientY,origin:{left:r.options.left,top:r.options.top,width:r.options.width,height:r.options.height}},this.store.dragStart())}beginZoneResize(t){t.event.stopPropagation(),t.event.preventDefault(),this.zoneResizing=t.zone;const o=t.event.clientY,r=this.store.templateData,i=t.zone==="header"?r.header.height:r.footer.height,n=(this.store.scale||100)/100,s=c=>{const u=h.pxToMm((c.clientY-o)/n),f=Math.max(0,Math.round((i+(t.zone==="header"?u:-u))*10)/10);t.zone==="header"?this.store.updateTemplateData({header:{...r.header,height:f}}):this.store.updateTemplateData({footer:{...r.footer,height:f}}),this.paint()},d=()=>{window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",d),this.zoneResizing=null,this.store.recordHistory(),this.repaint()};window.addEventListener("mousemove",s),window.addEventListener("mouseup",d)}beginGuideDrag(t){const o=(this.store.templateData.guides??[]).find(f=>f.id===t.id);if(!o)return;const r=h.getPaperDimensions(this.store.templateData),i=o.type==="vertical"?r.width:r.height,n=t.event.clientX,s=t.event.clientY,d=(this.store.scale||100)/100,c=f=>{const b=h.pxToMm((o.type==="vertical"?f.clientX-n:f.clientY-s)/d);this.store.moveGuide(o.id,Math.min(i,Math.max(0,o.position+b))),this.paint()},u=()=>{window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",u),this.store.recordHistory(),this.repaint()};window.addEventListener("mousemove",c),window.addEventListener("mouseup",u)}beginRulerGuide(t){const o=t.orientation==="horizontal"?"vertical":"horizontal",r=n=>{this.guidePreview={type:o,position:o==="vertical"?n.clientX:n.clientY},this.paint()},i=n=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",i);const s=this.rulerPointToMM(n,o);this.guidePreview=null,s!==null?this.store.addGuide(o,s):this.repaint()};window.addEventListener("mousemove",r),window.addEventListener("mouseup",i)}rulerPointToMM(t,o){const r=this.root.querySelector(".hiprint-printPaper");if(!r)return null;const i=r.getBoundingClientRect(),n=h.mmToPx(1)*(this.geom.paperScale||1),s=o==="vertical"?(t.clientX-i.left)/n:(t.clientY-i.top)/n,d=h.getPaperDimensions(this.store.templateData),c=o==="vertical"?d.width:d.height;return s<0||s>c?null:s}applyZoom(t,o,r,i){const n=this.root.querySelector(".canvas-area");if(!n)return;const s=Math.round(this.store.scale),d=Math.max(i,Math.round(t));if(d===s)return;const c=getComputedStyle(n),u=parseFloat(c.paddingLeft)||0,f=parseFloat(c.paddingTop)||0,b=n.scrollLeft+o-u,m=n.scrollTop+r-f,E=d/s;this.store.setScale(d,i),n.scrollLeft=b*E-o+u,n.scrollTop=m*E-r+f,this.scrollPos={x:n.scrollLeft,y:n.scrollTop}}zoomByStep(t){const o=this.root.querySelector(".canvas-area");o&&this.applyZoom(h.nextWheelScale(this.store.scale,t),o.clientWidth/2,o.clientHeight/2,h.MIN_SCALE_PERCENT)}fitToWindow(){const t=this.root.querySelector(".canvas-area");if(!t)return;const o=getComputedStyle(t),r=(parseFloat(o.paddingLeft)||0)+(parseFloat(o.paddingRight)||0),i=(parseFloat(o.paddingTop)||0)+(parseFloat(o.paddingBottom)||0),n=h.getPaperDimensions(this.store.templateData),s=h.computeFitScale(t.clientWidth-r,t.clientHeight-i,h.mmToPx(n.width),h.mmToPx(n.height));this.applyZoom(s,t.clientWidth/2,t.clientHeight/2,h.FIT_SCALE_MIN_PERCENT)}onWheel(t){if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();const o=this.root.querySelector(".canvas-area");if(!o)return;const r=Math.round(this.store.scale),i=h.nextWheelScale(r,t.deltaY>0?-1:1);if(i===r)return;const n=o.getBoundingClientRect();this.applyZoom(i,t.clientX-n.left,t.clientY-n.top,h.MIN_SCALE_PERCENT)}onScroll(){const t=this.root.querySelector(".canvas-area");if(!t)return;this.scrollPos={x:t.scrollLeft,y:t.scrollTop};const o=this.root.querySelector(".ruler-overlay");o&&(o.style.transform=`translate(${this.scrollPos.x}px, ${this.scrollPos.y}px)`),this.syncRulers()}on(t,o,r,i){t.addEventListener(o,r,i),this.instanceDisposers.push(()=>t.removeEventListener(o,r,i))}attachInstanceListeners(){this.instanceDisposers.length||(this.bindPointer(),this.bindKeys(),this.bindPaneScroll())}bindPaneScroll(){this.on(this.root,"scroll",t=>{const o=t.target;if(!(o instanceof HTMLElement))return;const r=o.dataset.pane;r&&this.paneScroll.set(r,o.scrollTop)},!0)}bindPointer(){const t=s=>{const d=this.store;if(!d)return;const u=((d.scale||100)/100||1)*h.mmToPx(1),f=(b,m)=>({dx:b/u,dy:m/u});if(this.drag){const{dx:b,dy:m}=f(s.clientX-this.drag.startX,s.clientY-this.drag.startY);(Math.abs(b)>.05||Math.abs(m)>.05)&&(this.drag.moved=!0);const E=d.elements.find(A=>A.id===this.drag.primary),y=E&&h.resolveElementBoxes(E.options).margin,C=E&&y&&{id:E.id,left:(this.drag.origin.get(E.id)?.left??0)+b,top:(this.drag.origin.get(E.id)?.top??0)+m,width:y.width,height:y.height};let D=null;if(C&&d.snapToGrid!==!1){const A=d.elements.filter(B=>!this.drag.ids.includes(B.id)&&(B.zone||"content")===this.drag.zone).map(B=>({id:B.id,...h.resolveElementBoxes(B.options).margin})),I=kr(d.templateData,d.paperSize)[this.drag.zone],K=h.computeAdsorb(C,A,this.manualGuides());D={left:K.left,top:K.top},d.adsorbGuides=(K.lines??[]).filter(B=>B.position>=0&&B.position<=(B.type==="vertical"?I.width:I.height)),(D.left!==C.left||D.top!==C.top)&&this.flashSnapIndicator(D.left+C.width/2,D.top+C.height/2)}else d.adsorbGuides=[];const S=E?this.drag.origin.get(E.id):void 0,_=D&&S?D.left-S.left:b,z=D&&S?D.top-S.top:m;for(const A of this.drag.ids){const I=this.drag.origin.get(A);if(!I)continue;const K={left:I.left+_,top:I.top+z};this.drag.movedPositions.set(A,K),d.livePatch(A,K)}this.patchElementDom(),d.adsorbGuides.length&&this.paintGuidesOnly()}else if(this.resize){const{dx:b,dy:m}=f(s.clientX-this.resize.startX,s.clientY-this.resize.startY),E=h.calcResizeRect(this.resize.point,this.resize.origin,b,m,3.5,3.5);d.livePatch(this.resize.id,E),this.patchElementDom()}},o=()=>{const s=!!this.drag,d=this.drag;if(d?.moved&&d.altKey){this.finishAltClone(d),this.store.dragStop(),this.drag=null,this.store.draggingIds=new Set,this.repaint();return}this.drag?.moved||this.resize?(this.store.adsorbGuides=[],this.store.commitLive(),this.store.dragStop(),this.drag=null,this.resize=null,this.store.draggingIds=new Set,this.repaint()):(this.drag=null,this.store.dragStop(),s&&(this.store.draggingIds=new Set,this.syncDragGhost()))},r=s=>{const d=s.composedPath(),c=d.some(f=>f.classList?.contains("tb-dd"));this.state.openDd&&!c&&(this.state.openDd=null,this.repaint()),this.state.openMore&&!c&&(this.state.openMore=!1,this.repaint());const u=d.some(f=>f.classList?.contains("context-menu"));this.menu.visible&&!u&&(this.menu.visible=!1,this.repaint())},i=s=>{const c=s.target?.closest?.("[data-tip]");!c||!c.closest(Yp)||(this.hoverTipTimer&&clearTimeout(this.hoverTipTimer),this.hoverTipTimer=setTimeout(()=>this.showHoverTip(c),300))},n=s=>{const d=s,c=d.target?.closest?.("[data-tip]");c&&d.relatedTarget?.closest?.("[data-tip]")!==c&&this.hideHoverTip()};this.on(window,"mousemove",t),this.on(window,"mouseup",o),this.on(this,"pointerdown",r),this.on(this.root,"mouseover",i),this.on(this.root,"mouseout",n)}showHoverTip(t){const o=t.dataset.tip;if(!o)return;this.hideHoverTip();const r=t.getBoundingClientRect(),i=r.left+r.width/2;this.hoverTipEl=Se(l("div",{class:"pd-hover-tip",style:{left:`${i}px`,top:`${r.bottom+6}px`},text:o}),this.root);const n=this.hoverTipEl.offsetWidth/2;if(!n)return;const s=n+8,d=Math.max(window.innerWidth-n-8,s);this.hoverTipEl.style.left=`${Math.min(Math.max(i,s),d)}px`}hideHoverTip(){this.hoverTipTimer&&(clearTimeout(this.hoverTipTimer),this.hoverTipTimer=null),this.hoverTipEl?.remove(),this.hoverTipEl=null}manualGuides(){const t=[],o=[];for(const r of this.store.templateData.guides??[])r.type==="vertical"?t.push(r.position):o.push(r.position);return{vertical:t,horizontal:o}}paintGuidesOnly(){const t=this.root.querySelector(".hiprint-printPaper-content");if(!t)return;for(const r of Array.from(t.querySelectorAll(".adsorb-guide")))r.remove();const o=this.store.paperSize;kr(this.store.templateData,o);for(const r of this.store.adsorbGuides){const i=document.createElement("div");i.className=`adsorb-guide guide-${r.type}`,r.type==="vertical"?i.style.cssText=`left:${r.position}mm;top:0;height:${o.height}mm;border-left-color:${r.color||"var(--pd-accent-secondary, #f56c6c)"}`:i.style.cssText=`top:${r.position}mm;left:0;width:${o.width}mm;border-top-color:${r.color||"var(--pd-accent-secondary, #f56c6c)"}`,t.appendChild(i)}}bindKeys(){this.setAttribute("tabindex","0");const t=()=>{tt.active=this};this.on(this,"pointerdown",t),this.on(this,"focusin",t),tt.active||(tt.active=this)}attachDocKeys(){this.docKeydown||(this.docKeydown=t=>this.onGlobalKeydown(t),document.addEventListener("keydown",this.docKeydown),this.docDragend=()=>Gn(this.root?.querySelector(".canvas-area")),document.addEventListener("dragend",this.docDragend,!0))}detachDocKeys(){this.docKeydown&&(document.removeEventListener("keydown",this.docKeydown),this.docKeydown=null,this.docDragend&&(document.removeEventListener("dragend",this.docDragend,!0),this.docDragend=null))}onGlobalKeydown(t){const o=this.store;if(!o||tt.active!==this)return;const i=t.composedPath()[0]?.tagName;if(i==="INPUT"||i==="TEXTAREA"||i==="SELECT")return;if(this.format.handlePainterKeydown(t),t.key.startsWith("Arrow")){t.preventDefault();const s=t.shiftKey?10:t.ctrlKey?.5:1,d=t.key==="ArrowLeft"?-s:t.key==="ArrowRight"?s:0,c=t.key==="ArrowUp"?-s:t.key==="ArrowDown"?s:0;o.moveSelected(d,c);return}if(t.key==="Delete"||t.key==="Backspace"){t.preventDefault(),o.deleteSelected();return}if(!(t.ctrlKey||t.metaKey))return;const n=t.key.toLowerCase();jp.has(n)&&(t.preventDefault(),n==="z"?t.shiftKey?o.redo():o.undo():n==="y"?o.redo():n==="a"?o.selectAll():n==="c"?o.copy():n==="x"?o.cutSelected():n==="v"?o.paste():n==="d"?o.duplicateSelected():n==="g"?t.shiftKey?o.ungroupSelected():o.groupSelected():n==="1"?o.resetZoom():n==="l"?o.alignSelected("left"):n==="r"?o.alignSelected("right"):n==="e"?o.alignSelected("vertical"):n==="t"?o.alignSelected("top"):n==="b"?o.alignSelected("bottom"):n==="0"&&this.fire("fit-window"))}}function oa(e="print-designer"){return customElements.get(e)||customElements.define(e,tt),e}function Xp(){return oa()}Object.defineProperty(exports,"BUILTIN_ELEMENT_CAPABILITIES",{enumerable:!0,get:()=>h.BUILTIN_ELEMENT_CAPABILITIES});Object.defineProperty(exports,"getElementCapabilities",{enumerable:!0,get:()=>h.getElementCapabilities});Object.defineProperty(exports,"getElementCapabilityTypes",{enumerable:!0,get:()=>h.getElementCapabilityTypes});Object.defineProperty(exports,"registerElementCapabilities",{enumerable:!0,get:()=>h.registerElementCapabilities});Object.defineProperty(exports,"resetElementCapabilities",{enumerable:!0,get:()=>h.resetElementCapabilities});exports.BUILTIN_ELEMENT_DEFINITIONS=xo;exports.DesignerStore=un;exports.PRINT_DESIGNER_ATTRIBUTES=Or;exports.PRINT_DESIGNER_BOOLEAN_ATTRIBUTES=Tn;exports.PRINT_DESIGNER_CONTRACT_VERSION=zr;exports.PRINT_DESIGNER_EVENT=Be;exports.PRINT_DESIGNER_EVENTS=An;exports.PRINT_DESIGNER_EVENT_OPTIONS=ll;exports.PRINT_DESIGNER_METHODS=Dn;exports.PRINT_DESIGNER_PARTS=Nr;exports.PRINT_DESIGNER_PROPERTY_NAMES=Pn;exports.PRINT_DESIGNER_TAG=Sn;exports.PRINT_DESIGNER_THEME_TOKENS=Cn;exports.PrintDesignerElement=tt;exports.TILING_SINGLE_PAGE_TIP=Fa;exports.createDefaultTemplate=Vt;exports.definePrintDesigner=oa;exports.getElementDblEditableField=kn;exports.getElementDefinition=pt;exports.getElementDefinitions=vn;exports.getElementLayerIcon=En;exports.getElementPropertyGroup=wn;exports.getHostContract=yr;exports.getMaterialElementDefinitions=xn;exports.registerAll=Xp;exports.registerElementDefinition=rl;exports.registerElementRenderer=il;exports.registerElementRenderers=yn;exports.resetElementDefinitions=al;exports.serializePage=hn;exports.subscribeElementDefinitions=bn;exports.toRuntimePool=Ar;